tga2lmp

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

tga2lmp

Post by Baker »

Command line utility that converts TGA files to Quake LMP format in a folder.

Source + .exe: http://quake-1.com/docs/utils/tga2lmp.zip

Probably no one is interested in this :D I'm not either. Heheh. 2nd mini utility completed in a few hours, the utility I want is 3 or 4 utilities out.

The one that will let me sporadically make textures without converting anything to anything all the overhead happens automatically.

/ Note: It is a moderate pain in the arse to change C99 code so that Visual Studio likes it. C99 lets you do some funny things like make fixed arrays in functions with a variable size and other little things that make coding less of a hassle.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
qbism
Posts: 1238
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: tga2lmp

Post by qbism »

Nice! But were that the palette not hard-coded.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: tga2lmp

Post by revelator »

Just use my CB pack for C99 :) the minimal version aint that big anyway hehe.
Saves porting it to :mrgreen:
Productivity is a state of mind.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: tga2lmp

Post by mh »

Or use C++ - you can restrict yourself to the C-like subset of it.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: tga2lmp

Post by revelator »

can probably also use stlport for msvc missing subsets ;) weirdly enough microsoft states that they wont expand a lot on c99 instead they focus on the upcomming c++11.
Productivity is a state of mind.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: tga2lmp

Post by Baker »

I dealt with the differences prior to starting the thread. Had to malloc/free a few times, rewrite some stuff here and there.

C99 even Clang/LLVM vs. GCC with the C99 flag aren't even quite the same.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: tga2lmp

Post by revelator »

Clangs c++ subset is lacking a few things though improving.
Gcc has had C99 since the initial 4 release 4.1 i think. Msvc from v 6 could use it with stlport, i think they implemented some of it natively with msvc2003.
Its mildly annoying to port indeed but things will be much worse when c++11 makes it in since it will be abi incompatible with all prior releases (shudder).
Productivity is a state of mind.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: tga2lmp

Post by Baker »

Again, no one in their right mind should be interested in this, but this utility library has support for exporting tga, mip, lmp and for writing WAD2, WAD3, PAK:

http://quake-1.com/docs/utils/writetga.zip

This is the source for a command line utility. As strange as it sounds, I'm not interested in command line utilities, but I can test stuff without worrying about overhead and write clean and user-friendly code. :D

But the underlying code can generate a pak or wad file in ridiculously easy way. The code goes like this: PakFile_Build_Start (blah) ... PakFile_Build_Add_File (blah) ... PakFile_Build_Finish (blah).
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
qbism
Posts: 1238
Joined: Thu Nov 04, 2004 5:51 am
Contact:

Re: tga2lmp

Post by qbism »

Baker wrote:Again, no one in their right mind should be interested in this
You came to the right place. :lol:
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: tga2lmp

Post by Baker »

qbism wrote:
Baker wrote:Again, no one in their right mind should be interested in this
You came to the right place. :lol:
Good point. :D

I've done some interesting things with TGAs lately. The format (like most graphics formats I suspect) lets you <optionally> embed a comment right after the header. Loading a TGA skips those bytes, obviously.

I'm trying to build a pipeline to map with replacement textures transparently while the map editor uses lower resolution Quake paletted images. It's a bit of a tricky thing to pull off, but I'm within striking distance now.

In order to make this work, a TGA needs to know some things about its "source". To know whether or not it needs to be updated, and therefore the rest of the "pipeline" (the WAD2, WAD3, end result pak files containing textures). I'm going to put that in the TGA header.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Post Reply