Friday, December 27, 2013

FMod - The Vorticons EGA Reader

It's very difficult to follow file format specifications when they're wrong. This problem occurs semi-frequently when using community-produced documentation for old games like Commander Keen. Therefore, creating the EGA graphics exporter of FMod was challenging. First, the least significant bit in the header's compression flags does not tell whether that header is compressed; it refers to the latch file - the header is never compressed because that would be impossible.

Also, the tileset is not one big bitmap. It is actually about six hundred small 16x16 pixel bitmaps (32 rows each). If you try to read it as a large bitmap, you will spray rows nonsensically throughout the tile array.

Fortunately, those errors were the extent of the confusion. It was actually pretty easy to read the separate color planes into a more easily accessible array and then use that to put together the rows. The extractor first reads the header to get all the information about each entry and then puts each into the VortGraphics instance's appropriate list.

For my test program, I just had it use my ToFile method of the bitmap class on each of the graphics entries. I was shocked when it worked almost perfectly the first time. (The tiles were corrupted as I mentioned above, but that was an easy fix.) Tomorrow, recompilation of the three EGA files!

No comments:

Post a Comment