aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/saga.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/saga/saga.cpp')
-rw-r--r--engines/saga/saga.cpp22
1 files changed, 15 insertions, 7 deletions
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();
}