TGA to OVM conversion
Select messages from
# through # Forum FAQ
[/[Print]\]

Close Combat Series -> Modding Workshop

#1: TGA to OVM conversion Author: ScnelleMeyer PostPosted: Thu Mar 04, 2021 10:58 pm
    —
Texture maker 3 can bulk convert a folder of BGMs, OVMs and MMMs to tga, but only works from tga to BGM.

Is there any tool that will convert tga to OVM?

Could anyone make such a tool by editing TM3 or any other way ?

#2: Re: TGA to OVM conversion Author: Jatke PostPosted: Fri Mar 05, 2021 12:27 am
    —
Try adding these two lines to the tga2cc.bat:

for %%f in (*.tga) do tga2cc %%f %%f.ovm

for %%f in (*.tga) do tga2cc %%f %%f.mmm

#3: Re: TGA to OVM conversion Author: ScnelleMeyer PostPosted: Fri Mar 05, 2021 11:56 am
    —
I tried that but the output files are not correct and does not display correctly ingame.

#4: Re: TGA to OVM conversion Author: Jatke PostPosted: Fri Mar 05, 2021 3:50 pm
    —
Sorry, forgot TM3 miscalculates the files size (2 x X x Y) in bytes 4-7 of the converted .ovm and .mmm headers. Used to have to hex edit the file size hexadecimal value from the original back into tga2cc converted .ovm and .mmms.

Bottom line - despite the promise of cmd line batch conversions, TM3 isnt the tool to convert tgas to ovm/mmm. Tin has the code up on Github somewhere but fixing this aspect of TM3 isnt realistic.

Of course there is 5CC or CC2Tools, but only one image at a time.

#5: Re: TGA to OVM conversion Author: ScnelleMeyer PostPosted: Fri Mar 05, 2021 4:03 pm
    —
I hex edited the headers of 64 files now as it seemed quicker than opening each and every map with 5CC, import a new ovm and then save. Only after did I notice that the header data I used turned the my new .ovms upside down. Bummer!
Now I am going 5CC route opening maps one by one. Why do you think fixing the TM3 code is unrealistic?

Best thing would be if bulk conversion could be had in 5CC, as the program already contains the code to import tga and export as .ovm.

#6: Re: TGA to OVM conversion Author: Jatke PostPosted: Fri Mar 05, 2021 4:14 pm
    —
Maybe not unrealistic. I found the tga2cc code on Github. Might throw this out on a Java help forum, explain the issue and ask for help.

PHP:
import java.io.*;

/**
 * DOES NOT SUPPORT 8 BIT AT THIS TIME
 */
public class TgaReader 
    public 
TgaReader(String namethrows IOException {

        
// create output file
        
RandomAccessFile f = new RandomAccessFile(name"r");
        
        
// read interesting parts of the header
        
f.seek(12);
        
width  readIntelShort(f);
        
height readIntelShort(f);
        
        
f.seek(16);
        
bpp    f.readByte();

        final 
long bufferSize width*height*bpp/8;
        
buffer = new byte[(int)bufferSize];
        
f.read(buffer);
        
f.close();
    }
    
    public 
short getWidth() {
        return 
width;
    }
    
    public 
short getHeight() {
        return 
height;
    }

    public 
byte getBpp() {
        return 
bpp;
    }

    public 
byte[] getPixelData() {
        return 
buffer;
    }
    
    private 
byte  bpp;
    private 
short width;
    private 
short height;
    private 
byte[] buffer;
    
    private 
short readIntelShort(RandomAccessFile fthrows IOException {
        
short value = (short)(f.read() | f.read() << 8);
        return 
value;
    }
    
 

#7: Re: TGA to OVM conversion Author: ScnelleMeyer PostPosted: Fri Mar 05, 2021 4:28 pm
    —
I found the codebase too thanks to your tip. I am looking at it but not understanding much... I have only done a few tutorials on Photoshop java scripting so I wouldnt even know what to ask for in a forum.
Would you be able to make a post like that Jatke and check if someone is willing to help out ?

I need this function as I am making ovms with countours and it would shorten the time it takes to make them considerably.

#8: Re: TGA to OVM conversion Author: ScnelleMeyer PostPosted: Fri Mar 05, 2021 4:28 pm
    —
Double post

#9: Re: TGA to OVM conversion Author: Jatke PostPosted: Fri Mar 05, 2021 4:53 pm
    —
Can do. Will let you know.

Myself, Im looking to streamline custom scenario editing and need a short Python script to automate re-formatting CCReq's deployment output from a 33x33 matrix to 40x40. All I need to do is insert 7 bytes of 02 values every 33, then append 280 bytes of 02. I could kludge something together with a macro maker like MS's newly free Power Automated Desktop, but lack of an elegant solution would gnaw at me forever.

#10: Re: TGA to OVM conversion Author: ScnelleMeyer PostPosted: Fri Mar 05, 2021 6:06 pm
    —
Thanks a lot man!

Great work on the custom deploy post! - And now you will create a Python script to make it easier. Thats awesome!

#11: Re: TGA to OVM conversion Author: Jatke PostPosted: Fri Mar 05, 2021 7:59 pm
    —
Havent heard back from a Java guru but something is ganked in the txtf.exe in the source. That causes all converted .bgms, ovms & mmms to have the same value (00 05 91 00) in the second 4 bytes of the their headers. This value should be image Width x Height x bytes per pixel (2 in CC images) as in the original .bgm/.ovm/.mmms. So all tga2cc.exe images are wrong. Probably the only reason .bgms work is that the maximum space alloted for them, is even bigger than 00 05 91 00 (=9,504,000 decimal). So the tga2cc error is within their size tolerance.

.ovms & .mmms, being way smaller, are alloted much less, so their tolerance is exceeded.

Even with the code snippet I need, creating a custom deployment is still gonna require multiple CC tools. Just need to devise a new tool to enlarge CCReq's old 33x33 max grid to newer versions 40x40 grid and do the necessary hex edit automatically..



CCreq.jpg
 Description:
Custom deployment needs CCReq's familiar point & click GUI.
 Filesize:  116.19 KB
 Viewed:  5375 Time(s)

CCreq.jpg



#12: Re: TGA to OVM conversion Author: ScnelleMeyer PostPosted: Sat Mar 06, 2021 7:33 am
    —
Thanks for the update Jatke.  I wrote an email to Mafi yesterday as well to ask for implementation of bulk conversion of ovm map files within 5CC. Good find of the txtf issue!

#13: Re: TGA to OVM conversion Author: MafiLocation: Germany PostPosted: Sat Mar 06, 2021 11:38 am
    —
Good day, Sirs,

got the email. I must rethink the whole source code. Adding something to 5CC is completely unrealistic in short time, because I had to convert the old source to the lastest Xojo-compiler. Must have dived into my old HD: what you need is inside CC2Tools.exe. Not batch, but single file conversion TGA to OVM and back for any old CC-version (up to CC-TLD), should be faster than 5CC.


Cheers
Mafi

#14: Re: TGA to OVM conversion Author: Jatke PostPosted: Sat Mar 06, 2021 12:18 pm
    —
Mafi - Im looking for a way to customize deployment. Any chance BED9 could be adapted to record AL/AX/none deployment zone control as well as VL location? A binary export file from BED9, in the proper 40x40 byte array, could then be manually pasted into Save file deployment matrices to produce custom deployments.

Alternatively, good use could be made of a utility to format the older 33x33 deployment matrix to 40x40. This by inserting 7 bytes of 02 value every 33 bytes then appending 280 bytes of 02 value. With a tool like that, the custom 33x33 deployment, created in a save file by SgtWilson's CCreqXP tool, could be cut and pasted into a save created in one of the newer 40x40 CC versions.

thanks (again) - mick_xe5

#15: Re: TGA to OVM conversion Author: TejszdLocation: Canada PostPosted: Sat Mar 06, 2021 5:02 pm
    —
That would be great to have a tool to create the custom saved games.

Then we need work to on Steve to see if they could be added to the battle directory and be used without them being overwritten....

#16: Re: TGA to OVM conversion Author: ScnelleMeyer PostPosted: Sat Mar 06, 2021 5:25 pm
    —
I post my thanks to Mafi for his quick response and support to my question on email.

CC2Tools can do tga to .bgm/.ovm/.mmm for both for CC2 and CC3- - through to LSA!  I thought something was wrong initially as I got an error on my first converted .ovm file, but it turned out I was using the CC2 menu for conversion and not the CC3-LSA graphics conversion menu. So when Mafi helped me with pointing that out I was in business.
This will speed up the adding of contour lines to maps by a lot, even thought I still wish for a bulk conversion method:)

Hope the Java gurus comes up with something smart in that regard..

#17: Re: TGA to OVM conversion Author: Jatke PostPosted: Sat Mar 06, 2021 6:18 pm
    —
Tejszd - Best if save files could be put in the Data\Battles, Ops or Campaigns directories. Some custom deployment save files are 1 map, 1 turn (=Battle); some are multi-map, multi-turn (=Ops); and some are multi-map, multi-turn, multi-BG (=Campaigns).

And since we're wishing for new functionality -  it'd be so cool to put a custom deploy save in the same folder as custom .BTDs for all the maps used in the custom save. Then, when you choose to play that custom op, the corresponding custom .BTDs are loaded into the \Maps folder.

This can be done manually but the process is a little cumbersome and prone to user error.

SnarveiMeyer - I heard back from a Java guy that Tin's math (width*height*bpp/8 )  is good so one of the other source files must be borked to make the CC image header [pixel count x 2] always the same wrong value.



Close Combat Series -> Modding Workshop


output generated using printer-friendly topic mod. All times are GMT

Page 1 of 1