Friday, October 7, 2005

Friday 7th

First on today's agenda was the tweakage of the Grab functions I've been writing over the last couple of days. It suddenly dawned on me last night that all of the functions are based around a 32x32 Tileset; due to the fact that thumbnail images are used when the Tileset differs from 32x32, I needed to adapt my code so that the Grab buffers are the correct size and that appropriate actions will not only update the current Tileset, but also the thumbnail Tileset.

This was a fairly lengthy process, but relatively straightforward once I knew which areas of the code to change, and after about an hour of changes, checks, and tweaks, everything was working as intended (one of those situations where, after a hard slog changing the code, the program performs exactly as it did before!).

Next came the addition of the I/O routines for saving and loading Buffers and Buffer Sets (the former saves and loads the current Grab buffer, the latter saves and loads all 8 Grab buffers). As this involved tinkering with the Grab Menu, I also took the liberty of tying in some of the menu options with the existing code.

Next I tackled a small bug in my Copy/Paste Range function; essentially, all of the Tilesets are arranged in a long, continuous bitmap file which is one tile high and 256 tiles long. However, the 128x128 Tileset is only 128 tiles long and 2 tiles high, due to the fact that its width would otherwise exceed Windows limitations. As my Copy/Paste code potentially allows the entire Tileset to be copied and pasted, I needed to limit this so that the image size is not exceeded.

After tinkering with the Tile functions, it became apparent that the Tile menu was just too damn big; out came the scissors, and within minutes I'd chopped out the Meta commands and Mask commends and housed them in their own menus. This actually makes a little more sense, as each Panel now has a corresponding Menu.

While writing the I/O routines earlier, the thought occurred to me that the facility to Import and Export a range of tiles would be a nice function (after all, once the range is copied to the buffer it's a single command to save this to disk). Within minutes I'd managed to get the code up and running, though it's apparent that my Menus will need a little bit of tidying up (basically, I'll have to renumber all of the menu commands and their corresponding checks - something of a dog's job but the code will be much more organised as a result).