Thursday, May 28, 2015

Gash - CGA Success

I did lots of work on Gash today, meeting with much success. I finally got the GetPixelData and GetLowColorBitmap functions working with CGA graphics. The trick was that CGA places the full mask of the image before the image itself, with 2 instances of the mask bit per pixel. I had also completely forgotten to add unmasked support in GetLowColorBitmap, so that also caused issues when loading background tiles.

NextGenGraphics can now extract sprites, tiles (background and foreground), pictures (masked and unmasked), and the 8x8 tiles. The small 8x8 tiles were a challenge because all of them are stored in one chunk. I wasn't sure how to get the individual tiles out because there's no information on that in the ModdingWiki and the GalaxyGraphics code is super horrible. It turns out that the small tiles are just 8x8 pictures in the usual format all pushed up next to each other. That is, extracting a single one doesn't require any shuffling of chunk-wide planes, just grabbing a section of the chunk and treating it as a picture.


Another interesting fact is that the CGA version of Keen 4 has one fewer font and one more picture to fill that chunk. The extra picture seems to be a placeholder; it's just a pink square with a blue edge on the top and left. (Probably to make sure all the other chunk offsets don't get messed up from the font removal.)

All the extraction routines work for EGA graphics also. No bit twiddling is actually done until the image is called for, so the initial load is very quick.

All that's left to do in the core is extract fonts and miscellaneous resources, then figure out a way to put back modified graphics. I'm still looking into VGA support; it seems pretty tricky thanks to an extra (non-VGAGRAPH) file that holds the sprites.

No comments:

Post a Comment