diff options
-rw-r--r-- | engines/cge2/cge2.cpp | 3 | ||||
-rw-r--r-- | engines/cge2/cge2.h | 2 | ||||
-rw-r--r-- | engines/cge2/toolbar.cpp | 10 |
3 files changed, 14 insertions, 1 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp index d28215bc93..9dbbf7db06 100644 --- a/engines/cge2/cge2.cpp +++ b/engines/cge2/cge2.cpp @@ -74,6 +74,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) _quitFlag = false; _bitmapPalette = nullptr; _music = true; + _sfx = true; _startupMode = 1; _now = 1; _sex = 1; @@ -102,7 +103,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) } else { _oldSpeechVolume = ConfMan.getInt("speech_volume"); _oldMusicVolume = _musicVolume = ConfMan.getInt("music_volume"); - _sfxVolume = ConfMan.getInt("sfx_volume"); + _oldSfxVolume = _sfxVolume = ConfMan.getInt("sfx_volume"); } } diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h index caf39227c6..613168e88e 100644 --- a/engines/cge2/cge2.h +++ b/engines/cge2/cge2.h @@ -260,7 +260,9 @@ public: bool _quitFlag; Dac *_bitmapPalette; bool _music; + bool _sfx; int _oldMusicVolume; + int _oldSfxVolume; int _startupMode; int _now; int _sex; diff --git a/engines/cge2/toolbar.cpp b/engines/cge2/toolbar.cpp index edabd123b0..bf538b5f5a 100644 --- a/engines/cge2/toolbar.cpp +++ b/engines/cge2/toolbar.cpp @@ -194,6 +194,16 @@ void CGE2Engine::checkVolumeSwitches() { if (musicMuted && _music) { _vol[1]->step(0); } + + if ((!sfxMuted && !_sfx) || (sfxVolume != _oldSfxVolume)) { + _vol[0]->step(sfxVolume / kSoundNumtoStateRate); + _oldSfxVolume = sfxVolume; + _sfx = true; + } + if (sfxMuted && _sfx) { + _vol[0]->step(0); + _sfx = false; + } } void CGE2Engine::switchCap() { |