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.
This commit is contained in:
uruk 2014-08-13 21:16:20 +02:00
parent d7a9ea9e2a
commit 12a894a803
4 changed files with 15 additions and 2 deletions

View File

@ -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");

View File

@ -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;

View File

@ -540,6 +540,7 @@ void CGE2Engine::mainLoop() {
}
void CGE2Engine::checkSounds() {
checkMute();
_sound->checkSoundHandles();
checkVolumeSwitches();
_midiPlayer->syncVolume();

View File

@ -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