From 12a894a803bc183e0cae52144d0b01c08a189d78 Mon Sep 17 00:00:00 2001 From: uruk Date: Wed, 13 Aug 2014 21:16:20 +0200 Subject: CGE2: Add checkMute(). This keeps the "Mute All" option of ScummVM and the music on/off and speech on/off buttons of Sfinx's toolbar in sync. --- engines/cge2/cge2.cpp | 4 ++-- engines/cge2/cge2.h | 2 ++ engines/cge2/cge2_main.cpp | 1 + engines/cge2/toolbar.cpp | 10 ++++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp index 59d9fa9cbe..0a3d65a31d 100644 --- a/engines/cge2/cge2.cpp +++ b/engines/cge2/cge2.cpp @@ -99,9 +99,9 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) _sayCap = ConfMan.getBool("subtitles"); _sayVox = !ConfMan.getBool("speech_mute"); - if (ConfMan.getBool("mute")) { + if (_muteAll = ConfMan.getBool("mute")) { _oldMusicVolume = _oldSfxVolume = 0; - _music = false; + _music = _sayVox = false; } else { _oldMusicVolume = ConfMan.getInt("music_volume"); _oldSfxVolume = ConfMan.getInt("sfx_volume"); diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h index 4750d4a996..8e94683824 100644 --- a/engines/cge2/cge2.h +++ b/engines/cge2/cge2.h @@ -225,6 +225,7 @@ public: void switchSay(); void initToolbar(); void initVolumeSwitch(Sprite *volSwitch, int val); + void checkMute(); void checkSounds(); @@ -306,6 +307,7 @@ public: int _oldMusicVolume; int _oldSfxVolume; bool _music; + bool _muteAll; ResourceManager *_resman; Vga *_vga; diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index bb12c52746..c52a354f9e 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -540,6 +540,7 @@ void CGE2Engine::mainLoop() { } void CGE2Engine::checkSounds() { + checkMute(); _sound->checkSoundHandles(); checkVolumeSwitches(); _midiPlayer->syncVolume(); diff --git a/engines/cge2/toolbar.cpp b/engines/cge2/toolbar.cpp index 2b7604a447..dbbed3480e 100644 --- a/engines/cge2/toolbar.cpp +++ b/engines/cge2/toolbar.cpp @@ -212,4 +212,14 @@ void CGE2Engine::initVolumeSwitch(Sprite *volSwitch, int val) { volSwitch->step(state); } +void CGE2Engine::checkMute() { + bool mute = ConfMan.getBool("mute"); + bool mutedChanged = mute != _muteAll; + if (mutedChanged) { + switchMusic(); + switchVox(); + _muteAll = mute; + } +} + } // End of namespace CGE2 -- cgit v1.2.3