Another completable game

Yes, your eyes didn’t mislead you: another engine is – almost – ready to be added to ScummVM, yaay! 😀

My last week was spent mostly with bug-hunting and implementation of stubbed functions, so I really can’t highlight anything from it. I also implemented the functionality of the two volume switches on the toolbar. It was a pretty good experience, because I had a lot of freedom regarding this subsystem‘s implementation compared to other parts of the engine, since ScummVM’s sound handling is highly different from DOS’s. Because of that, new bugs and unwanted behavior is still possible when you use the sound options of ScummVM and the related buttons on the game’s toolbar in parallel, but that’s what testers for… ;>

After fixing some very ugly bug connected to script-handling, Sfinx is absolutely completable now. Here’s the proof – without too many spoilers:

At the moment, we can say that the engine itself is almost complete too.
There’s only one more major bug about our coordinate-handling what affects the pathfinding, so it works a bit hectically. My plan is to get done with this issue during the next week completely.
Another nice-to-have thing is the autosave function. Now CGE2 only supports classic saving and loading (it gives you the opportunity to save or load anytime you want), but as Arnaud and Paul implemented in CGE1, I also plan to add an autosave save slot which will always be overwritten when the player exits the game, and the he/she won’t be able to delete this slot.
One more missing feature is the Return-to-Launcher support, but it’s really the work of a couple of minutes, thanks to ScummVM’s great system.

The most important thing now is the numerous memory leaks the engine still suffers from. I’ll concentrate my attention on this issue along with our FXP implementation during the upcoming days.

At last, but not least, the English translation is complete as well. Many thanks goes to Arnaud for this! Currently, Thierry is trying to improve it, so hopefully we can leave the “Alfa v0.1” tag from the ribbon of the ScummVM window soon. 😉

See you next week! 🙂

Sounds

Hi all! 🙂

During the past week, I mostly spend my time with the missing/badly working sound parts of my engine. The first and most nasty problem I had to solve was that in the original, every animation is blocked while a sound was playing. Clearly, it wasn’t the case with my version of the game until now. To specify the problem, it’s not true for every sound, only for the the speech of the characters. To achieve that, I had to add a block to the script parser of the engine, so there won’t be any action until the actual sound is fully played out. Luckily, that checking of the blocking flag was already in the original as well as the setting of it to true. The tricky part was to decide where, when and how to reset this flag. Again, ScummVM’s very friendly library came to my rescue. In the main loop of the game, I simply have to check the responsible sound handle:

void Sound::checkSoundHandle() {
    if (!_vm->_mixer->isSoundHandleActive(_soundHandle))
        _smpinf._counter = 0;
}

As you can see, if it’s no longer active – there’s no sound playing at the moment – I set the counter back to 0. This counter tells our LoopingAudioStream instance how many times it has to loop when playing the given sound, and the script parser checks for this number and doesn’t do anything if it’s a positive number.

After this issue fixed, my attention was fully paid to the buttons on the toolbar what are connected to sound manipulation. The “hard” part here was not the actual implementation of the buttons, but the fact that I have to pay extra attention to them so they keep in synchronization with ScummVM’s Launcher’s and Global Main Menu’s sound settings.
You can see the mentioned buttons on the toolbar with a cute pink outline around them on this picture:

Until now, I was only able to achieve complete functionality (and parallel behavior with ScummVM’s options) with the music on/off button. (This is the big grey round plate in the middle with a note on it.) Currently, I am working on the speech/text mode switches (to the right, with two blue arrows above them), so they’ll take into account the global options in the Launcher regarding speech only/text only/both modes.

Besides that, Arnaud is still progressing nicely with the translation. It’s not far from being complete, but there is still a very nasty blocking bug concerning the dentist’s scene we are looking at almost constantly.

For the next week, I’ll finish with the sounds completely, including the two remaining switches on the toolbar. Then I’ll keep on refactoring the code – what I already started to do here and there -, and fix memory leak issues as well as other persisting bugs. I already paid attention to eliminate all the remaining stubs in the engine, but there are still a bunch of them in the script parser. I plan to take care of these too as soon as possible.

See ya next time! 😉

Toolbar and memory leaks

Hi guys! 🙂

During the last week, the most spectacular part of my progress was the implementation of some functionalities on the toolbar. Now, you can switch between normal, colorful display, and “mono-color” mode, which is there to support players with seeing difficulties. Let me illustrate it with two pictures:

Pretty kind of the original developers, isn’t it? 🙂 Besides that, thanks to ScummVM’s another great feature, now you can enable this colorblind mode not just by clinking the purple sphere on the toolbar (next to Vincent’s inventory), but you can also configure the engine right from the launcher, so it always runs in this mode.

To do so, I only had to add this static array to detection.h:

static const ADExtraGuiOptionsMap optionsList[] = {
  {
   GAMEOPTION_COLOR_BLIND_DEFAULT_OFF,
   {
    _s("Color Blind Mode"),
    _s("Enable Color Blind Mode by default"),
    "enable_color_blind",
    false
   }
  },

  AD_EXTRA_GUI_OPTIONS_TERMINATOR
};

And just pass it as an argument to the constructor of my subclass of AdvancedMetaEngine. It’s quite awesomely simple, isn’t it? 🙂

Another feature I added is that now you can also switch between speech-only and text-only mode using the little ear and eye icons next to the main switch on the right side of the toolbar. Of course, you can still stick with both, simply clicking on the mouth icon above the two. 🙂

Besides that, my last week mostly spent with fixing various newly found bugs and patching up the engine in different places so it (hopefully) leaks less memory now.
In practice, I will keep on doing that during the next week, since now (many many thanks to Arnaud) all the scenes in the game are reachable and most of them are fully or at least partially translated too. So we are absolutely not far from saying that the game is in a completable state, but there are still a lot of showstopping bugs what need to be tended

See you soon! 🙂

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!