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! 😉