aboutsummaryrefslogtreecommitdiff
path: root/engines/cge2/toolbar.cpp
diff options
context:
space:
mode:
authoruruk2014-07-25 23:19:11 +0200
committeruruk2014-07-25 23:19:11 +0200
commit5861b963ed4af0531052c2354159acdd57e661c7 (patch)
treecc0bc11d1fd3c977a49ed10d7113542fe96de823 /engines/cge2/toolbar.cpp
parent266f1c7dee502db432b047c1bef29595ba0ce332 (diff)
downloadscummvm-rg350-5861b963ed4af0531052c2354159acdd57e661c7.tar.gz
scummvm-rg350-5861b963ed4af0531052c2354159acdd57e661c7.tar.bz2
scummvm-rg350-5861b963ed4af0531052c2354159acdd57e661c7.zip
CGE2: Now refactor optionTouch() the right way.
Diffstat (limited to 'engines/cge2/toolbar.cpp')
-rw-r--r--engines/cge2/toolbar.cpp50
1 files changed, 28 insertions, 22 deletions
diff --git a/engines/cge2/toolbar.cpp b/engines/cge2/toolbar.cpp
index 3556ec72ca..b6bcfd7806 100644
--- a/engines/cge2/toolbar.cpp
+++ b/engines/cge2/toolbar.cpp
@@ -56,18 +56,7 @@ void CGE2Engine::optionTouch(int opt, uint16 mask) {
case 2:
if ((mask & kMouseLeftUp) && notMuted) {
switchMusic(_music = !_music);
-
- switch (_music) {
- case false:
- _oldMusicVolume = ConfMan.getInt("music_volume");
- ConfMan.setInt("music_volume", 0);
- _vol[1]->step(0);
- break;
- case true:
- ConfMan.setInt("music_volume", _oldMusicVolume);
- _vol[1]->step(_oldMusicVolume / kSoundNumtoStateRate);
- break;
- }
+ updateMusicVolume();
}
break;
case 3:
@@ -89,16 +78,7 @@ void CGE2Engine::optionTouch(int opt, uint16 mask) {
case 9:
if ((mask & kMouseLeftUp) && notMuted) {
switchVox();
-
- switch (_sayVox) {
- case false:
- _oldSpeechVolume = ConfMan.getInt("speech_volume");
- ConfMan.setInt("speech_volume", 0);
- break;
- case true:
- ConfMan.setInt("speech_volume", _oldSpeechVolume);
- break;
- }
+ updateSpeechVolume();
}
break;
default:
@@ -118,6 +98,20 @@ void CGE2Engine::switchMusic(bool on) {
_commandHandlerTurbo->addCommand(kCmdMidi, -1, on ? (_now << 8) : -1, nullptr);
}
+void CGE2Engine::updateMusicVolume() {
+ switch (_music) {
+ case false:
+ _oldMusicVolume = ConfMan.getInt("music_volume");
+ ConfMan.setInt("music_volume", 0);
+ _vol[1]->step(0);
+ break;
+ case true:
+ ConfMan.setInt("music_volume", _oldMusicVolume);
+ _vol[1]->step(_oldMusicVolume / kSoundNumtoStateRate);
+ break;
+ }
+}
+
void CGE2Engine::checkMusicSwitch() {
bool mute = false;
if (ConfMan.hasKey("mute"))
@@ -229,6 +223,18 @@ void CGE2Engine::switchVox() {
}
}
+void CGE2Engine::updateSpeechVolume() {
+ switch (_sayVox) {
+ case false:
+ _oldSpeechVolume = ConfMan.getInt("speech_volume");
+ ConfMan.setInt("speech_volume", 0);
+ break;
+ case true:
+ ConfMan.setInt("speech_volume", _oldSpeechVolume);
+ break;
+ }
+}
+
void CGE2Engine::switchSay() {
_commandHandlerTurbo->addCommand(kCmdSeq, 129, _sayVox, nullptr);
_commandHandlerTurbo->addCommand(kCmdSeq, 128, _sayCap, nullptr);