Save and load system

Hi everybody! 🙂

My last week’s progress is mainly centered around the save and load system. I had a couple of difficulties, but now CGE2 engine supports almost every Advanced Engine Features. I only left out “Return to Launcher” support, since the engine still have a lot of memory leak issues (even through I managed to solve a couple of them) needed to be fixed before that.

So as I said, now it’s possible to load a gamestate via the launcher, or even do saving or loading in-game. I plan to also implement an autosave functionality, similar to the one implemented in CGE1, but for now it works and that’s totally enough for debugging and the translation works of Arnaud.
I’ve got a couple of hardships during the implementation of this subsystem, but ScummVM’s built-in Common::Serializer class helped me a lot and spared me a great deal of time by hiding the actual stream operations behind an abstract interface. Since the original game only supports saving when exiting the game, and loading when starting it, I had to make so modifications in the engine itself to make it possible to save/load anytime during gameplay. But knowing the internal workings of the engine, it was quite straightforward. The hardest part was to rework Spare and the way it’s used, so now it’s not just a temporary container for some of the sprites in the game, but a big catalog, which stores every Sprite used by the engine, all the time, so most of the synchronization work is to keep Spare up to date.

Otherwise, I mostly spent my time with annoying and hard to find bugfixes like this miracle.

During the past week, Arnaud went on a translation-frenzy. 😀 Thanks to him, almost all of the scenes of the game (Warning, spoiler alert!) are reachable/finishable. I just can’t express my gratitude toward him. 🙂

My plans for the upcoming week is more bugfixes and even more taking care of various Valgrind errors, provided generously by David, what I am still really thankful for. 🙂

See you soon!