Welcome to Close Combat Series
  Login or Register Home  ·  Downloads  ·  Forums  ·  Combat Camera  ·  Help  

  Survey
Do incapacitations count as a soldier's kills?

Yes
No



Results
Polls

Votes 1179
Comments: 1

  Shout Box!!

Only registered users can shout. Please login or create an account.

  Main Menu
Articles & News  
    Help
    Player`s News
    Site News
    Multiplayer
    Terrain Challenge
    Boot Camp
Community  
    Forums
    Downloads
    Combat Camera
    MOOXE @ Youtube
    Statistics
Members  
    Private Messages
    Your Account
    Logout

  Donations
Anonymous - $25.00
08/15/2022

Anonymous - $25.00
08/15/2022

Anonymous - $25.00
12/18/2021

Anonymous - $100.00
11/08/2021

Anonymous - $15.00
04/09/2021

Anonymous - $100.00
04/05/2021

Anonymous - $20.00
02/20/2021

Anonymous - $10.00
12/29/2020

Anonymous - $1.00
11/06/2020

ZAPPI4 - $20.00
10/10/2020

Find our site useful? Make a small donation to show your support.



Search for at
Close Combat Series Advanced Search


 Author
Message
 
ScnelleMeyer

Rep: 190.3
votes: 18


PostPosted: Thu Mar 04, 2021 10:58 pm Post subject: TGA to OVM conversion Reply with quote

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 ?
Back to top
View user's profile Send private message
 
Jatke

Rep: 69.7
votes: 7


PostPosted: Fri Mar 05, 2021 12:27 am Post subject: Re: TGA to OVM conversion Reply with quote

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
Back to top
View user's profile Send private message
 
ScnelleMeyer

Rep: 190.3
votes: 18


PostPosted: Fri Mar 05, 2021 11:56 am Post subject: Re: TGA to OVM conversion Reply with quote

I tried that but the output files are not correct and does not display correctly ingame.
Back to top
View user's profile Send private message
 
Jatke

Rep: 69.7
votes: 7


PostPosted: Fri Mar 05, 2021 3:50 pm Post subject: Re: TGA to OVM conversion Reply with quote

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.
Back to top
View user's profile Send private message
 
ScnelleMeyer

Rep: 190.3
votes: 18


PostPosted: Fri Mar 05, 2021 4:03 pm Post subject: Re: TGA to OVM conversion Reply with quote

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.
Back to top
View user's profile Send private message
 
Jatke

Rep: 69.7
votes: 7


PostPosted: Fri Mar 05, 2021 4:14 pm Post subject: Re: TGA to OVM conversion Reply with quote

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;
    }
    
 
Back to top
View user's profile Send private message
 
ScnelleMeyer

Rep: 190.3
votes: 18


PostPosted: Fri Mar 05, 2021 4:28 pm Post subject: Re: TGA to OVM conversion Reply with quote

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.
Back to top
View user's profile Send private message
 
ScnelleMeyer

Rep: 190.3
votes: 18


PostPosted: Fri Mar 05, 2021 4:28 pm Post subject: Re: TGA to OVM conversion Reply with quote

Double post
Back to top
View user's profile Send private message
 
Jatke

Rep: 69.7
votes: 7


PostPosted: Fri Mar 05, 2021 4:53 pm Post subject: Re: TGA to OVM conversion Reply with quote

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.
Back to top
View user's profile Send private message
 
ScnelleMeyer

Rep: 190.3
votes: 18


PostPosted: Fri Mar 05, 2021 6:06 pm Post subject: Re: TGA to OVM conversion Reply with quote

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!
Back to top
View user's profile Send private message
 
Jatke

Rep: 69.7
votes: 7


PostPosted: Fri Mar 05, 2021 7:59 pm Post subject: Re: TGA to OVM conversion Reply with quote

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:  5221 Time(s)

CCreq.jpg


Back to top
View user's profile Send private message
 
ScnelleMeyer

Rep: 190.3
votes: 18


PostPosted: Sat Mar 06, 2021 7:33 am Post subject: Re: TGA to OVM conversion Reply with quote

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!
Back to top
View user's profile Send private message
 
Mafi

Rep: 2.7
votes: 17


PostPosted: Sat Mar 06, 2021 11:38 am Post subject: Re: TGA to OVM conversion Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
 
Jatke

Rep: 69.7
votes: 7


PostPosted: Sat Mar 06, 2021 12:18 pm Post subject: Re: TGA to OVM conversion Reply with quote

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
Back to top
View user's profile Send private message
 
Tejszd

Rep: 133.6
votes: 19


PostPosted: Sat Mar 06, 2021 5:02 pm Post subject: Re: TGA to OVM conversion Reply with quote

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....
Back to top
View user's profile Send private message
 
ScnelleMeyer

Rep: 190.3
votes: 18


PostPosted: Sat Mar 06, 2021 5:25 pm Post subject: Re: TGA to OVM conversion Reply with quote

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..
Back to top
View user's profile Send private message
 
Jatke

Rep: 69.7
votes: 7


PostPosted: Sat Mar 06, 2021 6:18 pm Post subject: Re: TGA to OVM conversion Reply with quote

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.
Back to top
View user's profile Send private message
 
 
Post new topicReply to topic printer-friendly view Close Combat Series Forum Index -> Modding Workshop


 
   
 


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum




Forums ©





In August of 2004, Zappi, Homba, Bambam887, RedScorpion and MOOXE all pitched
in to create this Close Combat site. I would to thank all the people who have visited and
found this site to thier liking. I hope you had time to check out some of the great Close Combat
mods and our forums. I'd also like to thank all the members of our volunteer staff that have
helped over the years, and all our users that contributed to this site!