aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-07-23 09:52:05 +0200
committeruruk2014-07-23 09:52:05 +0200
commit71a9ead967180344310f28b329158cd5e812be31 (patch)
treef76ead424df24e6c78f47bbfbeba130c8e37cd9c
parent2f5e115e9a3b1a8cde9f17dade63b2ce1d0fa52d (diff)
downloadscummvm-rg350-71a9ead967180344310f28b329158cd5e812be31.tar.gz
scummvm-rg350-71a9ead967180344310f28b329158cd5e812be31.tar.bz2
scummvm-rg350-71a9ead967180344310f28b329158cd5e812be31.zip
CGE2: Add and implement checkSounds() and checkMusicSwitch().
-rw-r--r--engines/cge2/cge2.cpp1
-rw-r--r--engines/cge2/cge2.h3
-rw-r--r--engines/cge2/cge2_main.cpp24
3 files changed, 25 insertions, 3 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index 30529d9fbc..b6e406c1f7 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;
+ _musicMuted = false;
_startupMode = 1;
_now = 1;
_sex = 1;
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index dbde43ae32..df4e4f7fe0 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -190,6 +190,8 @@ public:
void keyClick();
void swapInPocket(Sprite *spr, Sprite *xspr);
void busyStep();
+ void checkSounds();
+ void checkMusicSwitch();
void optionTouch(int opt, uint16 mask);
void switchColorMode();
@@ -264,6 +266,7 @@ public:
bool _quitFlag;
Dac *_bitmapPalette;
bool _music;
+ bool _musicMuted;
int _startupMode;
int _now;
int _sex;
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 00b3adda38..37821fb375 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -540,8 +540,7 @@ void CGE2Engine::showBak(int ref) {
}
void CGE2Engine::mainLoop() {
- _sound->checkSoundHandle();
- checkSaySwitch();
+ checkSounds();
_vga->show();
_commandHandlerTurbo->runCommand();
@@ -557,6 +556,25 @@ void CGE2Engine::mainLoop() {
_quitFlag = shouldQuit();
}
+void CGE2Engine::checkSounds() {
+ _sound->checkSoundHandle();
+ checkSaySwitch();
+ checkMusicSwitch();
+}
+
+void CGE2Engine::checkMusicSwitch() {
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+ _musicMuted = mute;
+ int musicVolume = ConfMan.getInt("music_volume");
+ if (!_musicMuted)
+ _musicMuted = musicVolume == 0;
+
+ if (_musicMuted && _music)
+ switchMusic();
+}
+
void CGE2Engine::handleFrame() {
// Game frame delay
uint32 millis = g_system->getMillis();
@@ -1069,7 +1087,7 @@ void CGE2Engine::optionTouch(int opt, uint16 mask) {
switchColorMode();
break;
case 2:
- if (mask & kMouseLeftUp)
+ if ((mask & kMouseLeftUp) && !_musicMuted)
switchMusic();
break;
case 3: