• Welcome to Valhalla Legends Archive.
 

TGA Icon Extrapolation

Started by Fr3DBr, September 24, 2006, 10:23 PM

Previous topic - Next topic

Fr3DBr

Ok, now lets start about building separated files for each icon.

How anyone would plan doing that ?

We know that each icon has a 28x14 size.
We know each string that corresponds to each icon (in the extracted tga file), since the strings are in the same sequence as the icons shown on it !

So now we need to extrapolate then ! :D, how do you guys think it could be done ? :D

FrostWraith

Same way you read them. Just instead of stripping off the TGA Header, export it along with the pixel data to a new TGA File.

Fr3DBr

can you give more details on that ?

Joe[x86]

Well, you know VB, right? Then it shouldn't be a problem.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Fr3DBr

i know C#, but im just copying the tga data directly to a file... now i need to know how to cut each icon from its data buffer.

Joe[x86]

If you know C#, plus what I'm about to tell you, it'll be easy.

In VB, to create a new file, you use this code: Open Filename For Output As FileHandle where Filename is the full path of the file you wish to create and FileHandle is a number, usually hardcoded (such as #1).

To write to that file, use Print FileHandle, Data (String). However, this will put a CRLF after it. A nifty but awkward way of fixing this is to use Print Filehandle, Data (String); (notice the semicolon).

The data is written immediately, but to release the filehandle, use Close FileHandle.

There's a proper way of getting a free file handle but I've long forgotten it. Object Browser should be your friend on that, if you must know. Also, sorry for coming off as a jackass in the above post. :)
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

RealityRipple

Dim nFile as integer
nFile = FreeFile
Open Filename for Whatever as #nFile
Print #nFile, strData;
Close #nFile

Fr3DBr

actually duh i know how to write files without crlf as i stated i know C#....what i dont know is how to extrapolate each icon from the tga image....

RealityRipple

split the file up into little 16x28 squares?

Fr3DBr


RealityRipple

Read 16 rows of 28 pixels, put it into a file.
Read the next 16 rows of 28 pixels, put it into a second file.
Repeat until you reach the last pixel.

Fr3DBr

hmmm its starting to make sense... how do i know when a row have 28 pixels ?

rabbit

Tell your program to read 28 pixels' data?
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Fr3DBr

its easy saying, if you tell me to read 28 sequential bytes per row assuming that each pixel is byte then fine.... if not it stills like saying to hit a small point on a microscope with a bazooka.

rabbit

That's easy... bazookas can hit a lot of points.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.