- Thu Jan 01, 2009 7:17 pm
#17093
EDIT: For anyone coming across this thread, the most recent and interesting updates are at the end, I suggest skipping there.
I just wanted to share what I've found out about level files, specifically frisco_01.lev. Since I don't plan on doing much of this sort of thing I'll just share what I find when I do.
Long stuff:
In the begining of the file it has a long series of names such as sky01, sky02, cleanwheel, damwheel, hubcap etc. I beleive these are the names of texture files. Using a hex-editor I later came across a series of bytes that looked like image data (see 1 for how). I soon found out that this is a palette (see 2 for how), what is used to provide color information for 8-bit images.
In short:
frisco_01.lev has a series of 8-bit images for textures, some for cars, some for the level. This means that the cars are likely to be contained within these files as well.
1. Color information is usually stored in 4 bytes, one each for red, green, blue, and alpha. I recognised it to be colors since every 4th byte was set to 0, which is usually the case for textures from old games (they have no alpha channel in the image).
2. I found out it was a palette by finding where the bytes mismatched, indicating the end of the colors. I then found the beginning and end of the data and subtracted them, finding the length in bytes. After dividing by 4 I found that there were 256 color entries, indicating a palette.
EDIT: Some more technical stuff:
Up until the 12th byte there doesn't seem to be any information about the images in the initial sequence of names, they are all just null-terminated strings. This means that there is either as many images as names or there is an index file somewhere, possibly one of the short files. I will be examining the first 12 bytes and also other files to find out.
I just wanted to share what I've found out about level files, specifically frisco_01.lev. Since I don't plan on doing much of this sort of thing I'll just share what I find when I do.
Long stuff:
In the begining of the file it has a long series of names such as sky01, sky02, cleanwheel, damwheel, hubcap etc. I beleive these are the names of texture files. Using a hex-editor I later came across a series of bytes that looked like image data (see 1 for how). I soon found out that this is a palette (see 2 for how), what is used to provide color information for 8-bit images.
In short:
frisco_01.lev has a series of 8-bit images for textures, some for cars, some for the level. This means that the cars are likely to be contained within these files as well.
1. Color information is usually stored in 4 bytes, one each for red, green, blue, and alpha. I recognised it to be colors since every 4th byte was set to 0, which is usually the case for textures from old games (they have no alpha channel in the image).
2. I found out it was a palette by finding where the bytes mismatched, indicating the end of the colors. I then found the beginning and end of the data and subtracted them, finding the length in bytes. After dividing by 4 I found that there were 256 color entries, indicating a palette.
EDIT: Some more technical stuff:
Up until the 12th byte there doesn't seem to be any information about the images in the initial sequence of names, they are all just null-terminated strings. This means that there is either as many images as names or there is an index file somewhere, possibly one of the short files. I will be examining the first 12 bytes and also other files to find out.
Last edited by someone972 on Sat Mar 07, 2009 2:33 pm, edited 1 time in total.