aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-07-23 12:31:06 +0200
committeruruk2014-07-23 12:31:06 +0200
commit6336ddb3ce4a9b2b42fc53985bad2e6a69012188 (patch)
treed3f4d5c305cc66b48598dfb49bee62a33ba32466
parent4c3bd3e0f51d20019d0cfe237f23b3a0f237cf0e (diff)
downloadscummvm-rg350-6336ddb3ce4a9b2b42fc53985bad2e6a69012188.tar.gz
scummvm-rg350-6336ddb3ce4a9b2b42fc53985bad2e6a69012188.tar.bz2
scummvm-rg350-6336ddb3ce4a9b2b42fc53985bad2e6a69012188.zip
CGE2: Keep music setting in sync with the Launcher.
-rw-r--r--engines/cge2/cge2.cpp1
-rw-r--r--engines/cge2/cge2.h3
-rw-r--r--engines/cge2/cge2_main.cpp29
3 files changed, 24 insertions, 9 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index b6e406c1f7..916b12fef9 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -75,6 +75,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_bitmapPalette = nullptr;
_music = true;
_musicMuted = false;
+ _oldMusicVolume = ConfMan.getInt("music_volume");;
_startupMode = 1;
_now = 1;
_sex = 1;
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index df4e4f7fe0..0c5ab4d29c 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -195,7 +195,7 @@ public:
void optionTouch(int opt, uint16 mask);
void switchColorMode();
- void switchMusic();
+ void switchMusic(bool on);
void quit();
void setVolume(int idx, int cnt);
void switchCap();
@@ -267,6 +267,7 @@ public:
Dac *_bitmapPalette;
bool _music;
bool _musicMuted;
+ int _oldMusicVolume;
int _startupMode;
int _now;
int _sex;
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 8341f8a276..a22df8d896 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -571,9 +571,14 @@ void CGE2Engine::checkMusicSwitch() {
int musicVolume = ConfMan.getInt("music_volume");
if (!_musicMuted)
_musicMuted = musicVolume == 0;
-
- if (_musicMuted && _music)
- switchMusic();
+
+ if (!_musicMuted && !_music) {
+ _oldMusicVolume = musicVolume;
+ switchMusic(_music = true);
+ }
+ if (_musicMuted && _music) {
+ switchMusic(_music = false);
+ }
}
void CGE2Engine::handleFrame() {
@@ -1093,8 +1098,8 @@ void CGE2Engine::optionTouch(int opt, uint16 mask) {
switchColorMode();
break;
case 2:
- if ((mask & kMouseLeftUp) && !_musicMuted)
- switchMusic();
+ if ((mask & kMouseLeftUp) && !ConfMan.getBool("mute"))
+ switchMusic(_music = !_music);
break;
case 3:
if (mask & kMouseLeftUp)
@@ -1127,10 +1132,18 @@ void CGE2Engine::switchColorMode() {
_vga->setColors(_vga->_sysPal, 64);
}
-void CGE2Engine::switchMusic() {
- _commandHandlerTurbo->addCommand(kCmdSeq, kMusicRef, (_music = !_music), nullptr);
+void CGE2Engine::switchMusic(bool on) {
+ _commandHandlerTurbo->addCommand(kCmdSeq, kMusicRef, on, nullptr);
keyClick();
- _commandHandlerTurbo->addCommand(kCmdMidi, -1, (_music) ? (_now << 8) : -1, nullptr);
+ _commandHandlerTurbo->addCommand(kCmdMidi, -1, on ? (_now << 8) : -1, nullptr);
+
+ if (!on) {
+ if (!_musicMuted) {
+ _oldMusicVolume = ConfMan.getInt("music_volume");
+ ConfMan.setInt("music_volume", 0);
+ }
+ } else
+ ConfMan.setInt("music_volume", _oldMusicVolume);
}
void CGE2Engine::quit() {