aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1
diff options
context:
space:
mode:
authorThierry Crozat2017-07-08 12:54:29 +0100
committerThierry Crozat2017-07-08 12:55:12 +0100
commit56757592bd03bb7a35cf12641cfd1c672bb5606a (patch)
tree31d2ac9533fe6794994320ab54f4bab772cf4a05 /engines/sword1
parent6ff927bff745d1a5977b556b62840858bbb695e1 (diff)
downloadscummvm-rg350-56757592bd03bb7a35cf12641cfd1c672bb5606a.tar.gz
scummvm-rg350-56757592bd03bb7a35cf12641cfd1c672bb5606a.tar.bz2
scummvm-rg350-56757592bd03bb7a35cf12641cfd1c672bb5606a.zip
SWORD1: Only write config in in-game menu when they are changed
The in-game menu contains not only subtitles and volume settings, but also load and save game options. Every time the menu was opened it would write the subtitles and audio volumes to the ConfMan resulting in toggling on overriding global options for this game, which was a but strange when it was previously using global options and we only wanted to load a game. So now the settings are written to ConfMan from the in-game menu only when they are actually changed.
Diffstat (limited to 'engines/sword1')
-rw-r--r--engines/sword1/control.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index 0384e685b3..fbc3f6af4a 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -399,18 +399,31 @@ uint8 Control::runPanel() {
if (SwordEngine::_systemVars.controlPanelMode == CP_NORMAL) {
uint8 volL, volR;
_music->giveVolume(&volL, &volR);
- ConfMan.setInt("music_volume", (int)((volR + volL) / 2));
- ConfMan.setInt("music_balance", volToBalance(volL, volR));
+ int vol = (int)((volR + volL) / 2);
+ int volBalance = volToBalance(volL, volR);
+ if (vol != ConfMan.getInt("music_volume"))
+ ConfMan.setInt("music_volume", vol);
+ if (volBalance != ConfMan.getInt("music_balance"))
+ ConfMan.setInt("music_balance", volBalance);
_sound->giveSpeechVol(&volL, &volR);
- ConfMan.setInt("speech_volume", (int)((volR + volL) / 2));
- ConfMan.setInt("speech_balance", volToBalance(volL, volR));
+ vol = (int)((volR + volL) / 2);
+ volBalance = volToBalance(volL, volR);
+ if (vol != ConfMan.getInt("speech_volume"))
+ ConfMan.setInt("speech_volume", vol);
+ if (volBalance != ConfMan.getInt("speech_balance"))
+ ConfMan.setInt("speech_balance", volBalance);
_sound->giveSfxVol(&volL, &volR);
- ConfMan.setInt("sfx_volume", (int)((volR + volL) / 2));
- ConfMan.setInt("sfx_balance", volToBalance(volL, volR));
-
- ConfMan.setBool("subtitles", SwordEngine::_systemVars.showText);
+ vol = (int)((volR + volL) / 2);
+ volBalance = volToBalance(volL, volR);
+ if (vol != ConfMan.getInt("sfx_volume"))
+ ConfMan.setInt("sfx_volume", vol);
+ if (volBalance != ConfMan.getInt("sfx_balance"))
+ ConfMan.setInt("sfx_balance", volBalance);
+
+ if (SwordEngine::_systemVars.showText != ConfMan.getBool("subtitles"))
+ ConfMan.setBool("subtitles", SwordEngine::_systemVars.showText);
ConfMan.flushToDisk();
}