Thursday, June 25, 2015

TliExtend

Today in the #KeenModding IRC channel, I was helping a Keen modder who was working on adding new tiles to a source code-based mod. Getting Abiathar to load the extra tiles was fairly easy (even though it's the only Keen level editor that can handle extended tilesets). The tricky part was fixing the tileinfo file to include those extra tiles.

You see, the tileinfo format is planar, so the information for each tile is spread out all over the file, and at offsets determined by the number of tiles in the file. Therefore, it can't just be extended by writing a bunch of zeros at the end; the spaces for the new tiles have to be inserted throughout the file. That would, of course, be very painful to do by hand in a hex editor.

So, I quickly (in under five minutes!) wrote TliExtend to solve this very problem. It's not super well-tested, but it did what it had to do. Its syntax is fairly simple; it takes six command-line arguments, in this order: existing tileinfo file name, current number of background tiles, current number of foreground tiles, output tileinfo file name, new number of background tiles, and new number of foreground tiles.

Note that TliExtend does not support the shrinking of tileinfo files. (It won't prune tiles off the end, and will probably do nothing if you ask it to reduce tile counts.)

I'll probably include TliExtend in Abiathar's File Emitter, but you can download it now if you'd like. (Requires FMod.dll, which comes with Abiathar.)

No comments:

Post a Comment