Thursday, July 3, 2014

FMod - Infoplane Override

Today in Abiathar, I got to hunt down a really awful level-corrupting bug! After the refactor, saving Keen Dreams levels with tileinfo in the map header caused the levels to become totally corrupted (unrecognizable even in a hex editor). It turns out that I had totally misused the optional parameter on DreamsLevels.ToFiles method, thinking it was a flag on whether to save tileinfo with the levels; it was actually the flag to force Huffman compression. Since Abiathar tried to avoid doing the expensive Huffman compression and hadn't set up the levels for recompression, it proceeded to totally mangle the data (really slowly too - it took almost 20 seconds to "save"). After using the correct positional optional parameter (inserting one comma in the code), everything was fine. Programming is hard!

Then, I found that the "changed" events don't fire on UI controls when the value property is set but actually sets what is already in the control. This is actually a massive pain - I was trusting that the event would trigger the controls to save their data into the dependency file in the New Project Wizard. This caused dependency files created on the second run (in one launch of the main application) of the NPW to be missing default data. It was annoying, but I fixed the problem by manually triggering each event in the appropriate Next button press.

Most interestingly, I implemented a new feature! Gridlock's Infoplane Override - having a different tileset for the foreground than the infoplane that uses the entire foreground ID range - is now officially part of Abiathar! It took a little bit of debugging to get right (mostly due to my thinking at first that the bitmap tile sheets are 13 tiles wide instead of the actual 18), but all the tileset components actually work really well with it. It was very simple to make the necessary adjustments to negate the infoplane division and ignore Assimilate Infoplane in the tileset wrappers. I suppose this is the benefit of having a good object model and API!

No comments:

Post a Comment