From 24cc8a8762ded511e8f69ee2790f38b913ddcae9 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 24 Jul 2014 18:11:10 +0200 Subject: CGE2: Implement checkSaySwitch() and add/fix connected code. --- engines/cge2/cge2.cpp | 10 +++++----- engines/cge2/cge2.h | 4 ++-- engines/cge2/saveload.cpp | 2 +- engines/cge2/toolbar.cpp | 31 +++++++++++++++++++++++++++++-- 4 files changed, 37 insertions(+), 10 deletions(-) (limited to 'engines/cge2') diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp index 94b876c724..5a5e3451aa 100644 --- a/engines/cge2/cge2.cpp +++ b/engines/cge2/cge2.cpp @@ -74,7 +74,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) _quitFlag = false; _bitmapPalette = nullptr; _music = true; - _oldMusicVolume = ConfMan.getInt("music_volume");; + _oldMusicVolume = ConfMan.getInt("music_volume"); _startupMode = 1; _now = 1; _sex = 1; @@ -94,7 +94,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) _enaVox = true; _sayCap = true; _sayVox = true; - _oldSayVox = false; + _oldSpeechVolume = ConfMan.getInt("speech_volume"); _req = 1; _midiNotify = nullptr; _spriteNotify = nullptr; @@ -167,6 +167,7 @@ bool CGE2Engine::hasFeature(EngineFeature f) const { Common::Error CGE2Engine::run() { syncSoundSettings(); + syncSpeechSettings(); initGraphics(kScrWidth, kScrHeight, false); init(); @@ -177,11 +178,10 @@ Common::Error CGE2Engine::run() { return Common::kNoError; } -void CGE2Engine::syncSoundSettings() { - Engine::syncSoundSettings(); - +void CGE2Engine::syncSpeechSettings() { _enaCap = _sayCap = ConfMan.getBool("subtitles"); _enaVox = _sayVox = !ConfMan.getBool("speech_mute"); } + } // End of namespace CGE2 diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h index 62db99a4ab..363c7c431c 100644 --- a/engines/cge2/cge2.h +++ b/engines/cge2/cge2.h @@ -133,7 +133,7 @@ private: void syncHeader(Common::Serializer &s); bool loadGame(int slotNumber); void resetGame(); - void syncSoundSettings(); + void syncSpeechSettings(); public: CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription); virtual bool hasFeature(EngineFeature f) const; @@ -285,7 +285,7 @@ public: bool _flag[4]; bool _sayCap; bool _sayVox; - bool _oldSayVox; + int _oldSpeechVolume; int _req; NotifyFunctionType _midiNotify; NotifyFunctionType _spriteNotify; diff --git a/engines/cge2/saveload.cpp b/engines/cge2/saveload.cpp index 6d7bb2492a..3c57e621f2 100644 --- a/engines/cge2/saveload.cpp +++ b/engines/cge2/saveload.cpp @@ -368,7 +368,7 @@ bool CGE2Engine::loadGame(int slotNumber) { syncGame(readStream, nullptr); delete readStream; - syncSoundSettings(); + syncSpeechSettings(); initToolbar(); loadHeroes(); diff --git a/engines/cge2/toolbar.cpp b/engines/cge2/toolbar.cpp index e643632bbe..3c0ee52606 100644 --- a/engines/cge2/toolbar.cpp +++ b/engines/cge2/toolbar.cpp @@ -75,8 +75,21 @@ void CGE2Engine::optionTouch(int opt, uint16 mask) { switchCap(); break; case 9: - if (mask & kMouseLeftUp) + if ((mask & kMouseLeftUp) && !ConfMan.getBool("mute")) { switchVox(); + + switch (_sayVox) { + case false: + _oldSpeechVolume = ConfMan.getInt("speech_volume"); + ConfMan.setInt("speech_volume", 0); + break; + case true: + ConfMan.setInt("speech_volume", _oldSpeechVolume); + break; + default: + break; + } + } break; default: break; @@ -162,7 +175,21 @@ void CGE2Engine::switchSay() { } void CGE2Engine::checkSaySwitch() { - warning("STUB: checkSaySwitch()"); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); + bool speechMuted = mute; + if (!speechMuted) { + int speechVolume = ConfMan.getInt("speech_volume"); + speechMuted = speechVolume == 0; + } + + if (!speechMuted && !_sayVox) { + switchVox(); + } + if (speechMuted && _sayVox) { + switchVox(); + } } void CGE2Engine::initToolbar() { -- cgit v1.2.3