From cc6f4f4cdc1acd407cccd061e73b0ddb63f4b5ab Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 23 Jul 2010 19:52:58 +0000 Subject: SWORD2: Improve sync between local and global "mute" settings Broken Sword 2's options dialog allows you to mute any of speech, sound and sound effects, whereas ScummVM's options dialog just has one "master" mute setting. This is an attempt to keep them better in sync, though it's not perfect. Still, it may be good enough to fix bug #3032763 ("SWORD2: Mute setting does not work"). svn-id: r51218 --- engines/sword2/sword2.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 1060dcf728..3cdab2bd2b 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -326,12 +326,20 @@ void Sword2Engine::registerDefaultSettings() { } void Sword2Engine::syncSoundSettings() { - // Sound settings. At the time of writing, not all of these can be set - // by the global options dialog, but it seems silly to split them up. _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); setSubtitles(ConfMan.getBool("subtitles")); + + // Our own settings dialog can mute the music, speech and sound effects + // individually. ScummVM's settings dialog has one master mute setting. + + if (ConfMan.getBool("mute")) { + ConfMan.setBool("music_mute", true); + ConfMan.setBool("speech_mute", true); + ConfMan.setBool("sfx_mute", true); + } + _sound->muteMusic(ConfMan.getBool("music_mute")); _sound->muteSpeech(ConfMan.getBool("speech_mute")); _sound->muteFx(ConfMan.getBool("sfx_mute")); @@ -356,6 +364,13 @@ void Sword2Engine::writeSettings() { ConfMan.setBool("object_labels", _mouse->getObjectLabels()); ConfMan.setInt("reverse_stereo", _sound->isReverseStereo()); + // If even one sound type is unmuted, we can't say that all sound is + // muted. + + if (!_sound->isMusicMute() || !_sound->isSpeechMute() || !_sound->isFxMute()) { + ConfMan.setBool("mute", false); + } + ConfMan.flushToDisk(); } -- cgit v1.2.3