aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorFilippos Karapetis2008-12-19 12:03:22 +0000
committerFilippos Karapetis2008-12-19 12:03:22 +0000
commit0410d6dfaef068a57462cb241f6f3a96fde1cc4b (patch)
tree3b3aa78e195771a044432ae669bcdeb38d8e5613 /engines/saga
parent2911aa04c18654e32e985217f371eba74dfedd82 (diff)
downloadscummvm-rg350-0410d6dfaef068a57462cb241f6f3a96fde1cc4b.tar.gz
scummvm-rg350-0410d6dfaef068a57462cb241f6f3a96fde1cc4b.tar.bz2
scummvm-rg350-0410d6dfaef068a57462cb241f6f3a96fde1cc4b.zip
Removed the hasKey() hackery of my previous commit and used ConfMan.registerDefault() instead. Changed sound_volume back to sfx_volume, which got changed with the GSoC merge and was the actual cause that the sound effects were off by default
svn-id: r35437
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/interface.cpp2
-rw-r--r--engines/saga/saga.cpp22
-rw-r--r--engines/saga/sound.cpp4
3 files changed, 18 insertions, 10 deletions
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 43c4115cb0..24fd15594d 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -1637,7 +1637,7 @@ void Interface::setOption(PanelButton *panelButton) {
case kTextSound:
_vm->_soundVolume = _vm->_soundVolume + 25;
if (_vm->_soundVolume > 255) _vm->_soundVolume = 0;
- ConfMan.setInt("sound_volume", _vm->_soundVolume);
+ ConfMan.setInt("sfx_volume", _vm->_soundVolume);
_vm->_sound->setVolume();
break;
case kTextVoices:
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index 6035e7ee12..1fce2d1c65 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -141,10 +141,18 @@ SagaEngine::~SagaEngine() {
}
Common::Error SagaEngine::init() {
- _musicVolume = ConfMan.hasKey("music_volume") ? ConfMan.getInt("music_volume") : 255;
- _subtitlesEnabled = ConfMan.hasKey("subtitles") ? ConfMan.getBool("subtitles") : true;
+ // Assign default values to the config manager, in case settings are missing
+ ConfMan.registerDefault("music_volume", "255");
+ ConfMan.registerDefault("sfx_volume", "255");
+ ConfMan.registerDefault("speech_volume", "255");
+ ConfMan.registerDefault("talkspeed", "255");
+ ConfMan.registerDefault("subtitles", "true");
+ ConfMan.registerDefault("copy_protection", "false");
+
+ _musicVolume = ConfMan.getInt("music_volume");
+ _subtitlesEnabled = ConfMan.getBool("subtitles");
_readingSpeed = getTalkspeed();
- _copyProtection = ConfMan.hasKey("copy_protection") ? ConfMan.getBool("copy_protection") : false;
+ _copyProtection = ConfMan.getBool("copy_protection");
_gf_wyrmkeep = false;
_gf_compressed_sounds = false;
_musicWasPlaying = false;
@@ -217,7 +225,7 @@ Common::Error SagaEngine::init() {
_voicesEnabled = true;
ConfMan.setBool("voices", true);
} else {
- _voicesEnabled = ConfMan.hasKey("voices") ? ConfMan.getBool("voices") : true;
+ _voicesEnabled = ConfMan.getBool("voices");
}
} else {
_voicesEnabled = true;
@@ -518,17 +526,17 @@ void SagaEngine::setTalkspeed(int talkspeed) {
}
int SagaEngine::getTalkspeed() {
- return ((ConfMan.hasKey("talkspeed") ? ConfMan.getInt("talkspeed") : 255) * 3 + 255 / 2) / 255;
+ return (ConfMan.getInt("talkspeed") * 3 + 255 / 2) / 255;
}
void SagaEngine::syncSoundSettings() {
- _subtitlesEnabled = ConfMan.hasKey("subtitles") ? ConfMan.getBool("subtitles") : true;
+ _subtitlesEnabled = ConfMan.getBool("subtitles");
_readingSpeed = getTalkspeed();
if (_readingSpeed > 3)
_readingSpeed = 0;
- _musicVolume = ConfMan.hasKey("music_volume") ? ConfMan.getInt("music_volume") : 255;
+ _musicVolume = ConfMan.getInt("music_volume");
_music->setVolume(_musicVolume, 1);
_sound->setVolume();
}
diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp
index f87f30a3fa..e693e16629 100644
--- a/engines/saga/sound.cpp
+++ b/engines/saga/sound.cpp
@@ -206,8 +206,8 @@ void Sound::stopAll() {
}
void Sound::setVolume() {
- _vm->_soundVolume = ConfMan.hasKey("sound_volume") ? ConfMan.getInt("sound_volume") : 255;
- _vm->_speechVolume = ConfMan.hasKey("speech_volume") ? ConfMan.getInt("speech_volume") : 255;
+ _vm->_soundVolume = ConfMan.getInt("sfx_volume");
+ _vm->_speechVolume = ConfMan.getInt("speech_volume");
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _vm->_soundVolume);
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _vm->_speechVolume);
}