The main task of this last week was to implement saving. This had a surprising amount of nuance to it, since I need to provide ScummVM with various metadata, including a thumbnail of the savefile, the savegame description, etc… fortunately it wasn’t too difficult to use other engines as templates on how to accomplish this. I’m quite glad I found out about ScummVM’s built-in serializer before starting on this, as it reduces the amount of redundant code by a lot (saving and loading is done with the same code).
The main issue I encountered, was a portability concern. I can’t simply memcpy a data structure to save it, since there are no guarantees about struct packing, or endianness, etc… so, I need to specify each individual variable that goes into the savefile. This is a huge pain to do, since each individual room has its own set of variables, and I’m still figuring out what they are. I’ve mostly held off on saving room-specific variables for now. Hopefully I’ll find a better solution, but obviously I must eventually solve this for saves to work properly.
In the meantime, the next mission is coming along, in which Kirk faces off against the Elasi – some kind of “rebel alliance”, except, they’re the bad guys.