aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config-file.cpp19
-rw-r--r--config-file.h7
-rw-r--r--gameDetector.cpp4
-rw-r--r--sound.cpp25
4 files changed, 33 insertions, 22 deletions
diff --git a/config-file.cpp b/config-file.cpp
index 68c787b41b..376031997d 100644
--- a/config-file.cpp
+++ b/config-file.cpp
@@ -232,6 +232,25 @@ const char *Config::get(const char *key, const char *d) const
return 0;
}
+const int Config::getInt(const char *key, int def, const char *d) const
+{
+ int i;
+
+ if (!d)
+ d = domain;
+
+ for (i = 0; i < ndomains; i++) {
+ if (hash[i]->is_domain(d)) {
+ const char *val = hash[i]->get(key);
+ if (val)
+ return atoi(val);
+ break;
+ }
+ }
+
+ return def;
+}
+
const char *Config::set(const char *key, const char *value, const char *d)
{
int i;
diff --git a/config-file.h b/config-file.h
index d1df1347ac..d972a44a6c 100644
--- a/config-file.h
+++ b/config-file.h
@@ -29,9 +29,10 @@ class Config {
public:
Config (const char * = "config.cfg", const char * = "default");
~Config ();
- const char *get(const char *, const char * = 0) const;
- const char *set(const char *, const char *, const char * = 0);
- const char *set(const char *, int, const char * = 0);
+ const char *get(const char *key, const char *dom = 0) const;
+ const int getInt(const char *key, int def = 0, const char *dom = 0) const;
+ const char *set(const char *key, const char *value, const char *dom = 0);
+ const char *set(const char *key, int value, const char *dom = 0);
void set_domain(const char *);
void flush() const;
void rename_domain(const char *);
diff --git a/gameDetector.cpp b/gameDetector.cpp
index 9210de725d..e273f8b121 100644
--- a/gameDetector.cpp
+++ b/gameDetector.cpp
@@ -489,8 +489,8 @@ int GameDetector::detectMain(int argc, char **argv)
#else
_gfx_mode = GFX_NORMAL;
#endif
- _sfx_volume = 100;
- _music_volume = 60;
+ _sfx_volume = 192;
+ _music_volume = 192;
#if defined(USE_NULL_DRIVER)
_gfx_driver = GD_NULL;
diff --git a/sound.cpp b/sound.cpp
index b38ea4473e..15b4debeab 100644
--- a/sound.cpp
+++ b/sound.cpp
@@ -585,24 +585,15 @@ void Scumm::talkSound(uint32 a, uint32 b, int mode)
void Scumm::setupSound()
{
- IMuse *se = _imuse;
- if (se) {
- se->setBase(res.address[rtSound]);
- if (!scummcfg->get("music_volume"))
- _sound_volume_music = 60;
- else
- _sound_volume_music = atoi(scummcfg->get("music_volume"));
- if (!scummcfg->get("master_volume"))
- _sound_volume_master = 125;
- else
- _sound_volume_master = atoi(scummcfg->get("master_volume"));
- if (!scummcfg->get("sfx_volume"))
- _sound_volume_sfx = 100;
- else
- _sound_volume_sfx = atoi(scummcfg->get("sfx_volume"));
+ if (_imuse) {
+ _imuse->setBase(res.address[rtSound]);
+
+ _sound_volume_music = scummcfg->getInt("music_volume", 192);
+ _sound_volume_master = scummcfg->getInt("master_volume", 192);
+ _sound_volume_sfx = scummcfg->getInt("sfx_volume", 192);
- se->set_master_volume(_sound_volume_master);
- se->set_music_volume(_sound_volume_music);
+ _imuse->set_master_volume(_sound_volume_master);
+ _imuse->set_music_volume(_sound_volume_music);
_mixer->set_volume(_sound_volume_sfx);
_mixer->set_music_volume(_sound_volume_music);
}