diff options
author | Max Horn | 2003-11-11 00:40:35 +0000 |
---|---|---|
committer | Max Horn | 2003-11-11 00:40:35 +0000 |
commit | 0bcc7ce80eb6a8daa35bf2591281974cceff8078 (patch) | |
tree | 570ec89c06a94d71ceb5219c4c17010c0da64331 | |
parent | b38995b288f2c5014ff1a9867d12807182ceb051 (diff) | |
download | scummvm-rg350-0bcc7ce80eb6a8daa35bf2591281974cceff8078.tar.gz scummvm-rg350-0bcc7ce80eb6a8daa35bf2591281974cceff8078.tar.bz2 scummvm-rg350-0bcc7ce80eb6a8daa35bf2591281974cceff8078.zip |
made Scumm::OptionsDialog subclass GUI::OptionsDialog (code reuse); replaced Sound::_sound_volume_master and friends by ConfMan.get() calls; some whitespace cleanup
svn-id: r11257
-rw-r--r-- | scumm/dialogs.cpp | 132 | ||||
-rw-r--r-- | scumm/dialogs.h | 55 | ||||
-rw-r--r-- | scumm/saveload.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 7 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 83 | ||||
-rw-r--r-- | scumm/sound.cpp | 8 | ||||
-rw-r--r-- | scumm/sound.h | 4 |
7 files changed, 116 insertions, 177 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 9003732324..6390d1774f 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -47,6 +47,8 @@ extern void save_key_mapping(); extern void load_key_mapping(); #endif +using namespace GUI; + namespace Scumm { struct ResString { @@ -389,11 +391,7 @@ void MainMenuDialog::load() { #pragma mark - enum { - kMasterVolumeChanged = 'mavc', - kMusicVolumeChanged = 'muvc', - kSfxVolumeChanged = 'sfvc', - kOKCmd = 'ok ', - kCancelCmd = 'cncl' + kOKCmd = 'ok ' }; enum { @@ -402,46 +400,29 @@ enum { #ifndef _WIN32_WCE OptionsDialog::OptionsDialog(ScummEngine *scumm) - : ScummDialog(scumm, 40, 30, 240, 124) { + : GUI::OptionsDialog("", 40, 30, 240, 124), _scumm(scumm) { #else OptionsDialog::OptionsDialog(ScummEngine *scumm) - : ScummDialog(scumm, 40, 30, 240, 124 + kButtonHeight + 4) { + : GUI::OptionsDialog("", 40, 30, 240, 124 + kButtonHeight + 4), _scumm(scumm) { #endif // // Add the buttons // #ifdef _WIN32_WCE - addButton(_w - kButtonWidth - 8, _h - 24 - kButtonHeight - 4, "OK", kOKCmd, 'O'); - addButton(_w - 2 * kButtonWidth - 12, _h - 24 - kButtonHeight - 4, "Cancel", kCancelCmd, 'C'); + addButton(_w - kButtonWidth - 8, _h - 24 - kButtonHeight - 4, "OK", GUI::OptionsDialog::kOKCmd, 'O'); + addButton(_w - 2 * kButtonWidth - 12, _h - 24 - kButtonHeight - 4, "Cancel", kCloseCmd, 'C'); addButton(kButtonWidth+12, _h - 24, "Keys", kKeysCmd, 'K'); #else - addButton(_w - kButtonWidth-8, _h - 24, "OK", kOKCmd, 'O'); - addButton(_w - 2 * kButtonWidth-12, _h - 24, "Cancel", kCancelCmd, 'C'); + addButton(_w - kButtonWidth-8, _h - 24, "OK", GUI::OptionsDialog::kOKCmd, 'O'); + addButton(_w - 2 * kButtonWidth-12, _h - 24, "Cancel", kCloseCmd, 'C'); #endif // // Sound controllers // int yoffset = 8; - - _masterVolumeSlider = new SliderWidget(this, 5, yoffset, 185, 12, "Master volume: ", 100, kMasterVolumeChanged); - _masterVolumeLabel = new StaticTextWidget(this, 200, yoffset + 2, 24, 16, "100%", kTextAlignLeft); - _masterVolumeSlider->setMinValue(0); _masterVolumeSlider->setMaxValue(255); - _masterVolumeLabel->setFlags(WIDGET_CLEARBG); - yoffset += 16; - - _musicVolumeSlider = new SliderWidget(this, 5, yoffset, 185, 12, "Music volume: ", 100, kMusicVolumeChanged); - _musicVolumeLabel = new StaticTextWidget(this, 200, yoffset+2, 24, 16, "100%", kTextAlignLeft); - _musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(255); - _musicVolumeLabel->setFlags(WIDGET_CLEARBG); - yoffset += 16; - - _sfxVolumeSlider = new SliderWidget(this, 5, yoffset, 185, 12, "SFX volume: ", 100, kSfxVolumeChanged); - _sfxVolumeLabel = new StaticTextWidget(this, 200, yoffset + 2, 24, 16, "100%", kTextAlignLeft); - _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(255); - _sfxVolumeLabel->setFlags(WIDGET_CLEARBG); - yoffset += 16; + yoffset = addVolumeControls(this, yoffset); // // Some misc options @@ -463,25 +444,41 @@ OptionsDialog::~OptionsDialog() { } void OptionsDialog::open() { - ScummDialog::open(); + GUI::OptionsDialog::open(); + + // update checkboxes, too + subtitlesCheckbox->setState(_scumm->_noSubtitles == false); +} - // display current sound settings - _soundVolumeMaster = _scumm->_sound->_sound_volume_master; - _soundVolumeMusic = _scumm->_sound->_sound_volume_music; - _soundVolumeSfx = _scumm->_sound->_sound_volume_sfx; +void OptionsDialog::close() { + + if (getResult()) { + // Subtitles + ConfMan.set("nosubtitles", !subtitlesCheckbox->getState(), _domain); + } + GUI::OptionsDialog::close(); - _masterVolumeSlider->setValue(_soundVolumeMaster); - _musicVolumeSlider->setValue(_soundVolumeMusic); - _sfxVolumeSlider->setValue(_soundVolumeSfx); - _masterVolumeLabel->setValue(_soundVolumeMaster); - _musicVolumeLabel->setValue(_soundVolumeMusic); - _sfxVolumeLabel->setValue(_soundVolumeSfx); + // Sync the engine with the config manager + int soundVolumeMaster = ConfMan.getInt("master_volume"); + int soundVolumeMusic = ConfMan.getInt("music_volume"); + int soundVolumeSfx = ConfMan.getInt("sfx_volume"); - // update checkboxes, too - subtitlesCheckbox->setState(_scumm->_noSubtitles == false); + if (_scumm->_imuse) { + _scumm->_imuse->set_music_volume(soundVolumeMusic); + } + if (_scumm->_musicEngine) { + _scumm->_musicEngine->setMasterVolume(soundVolumeMaster); + } + + _scumm->_mixer->setVolume(soundVolumeSfx * soundVolumeMaster / 255); + _scumm->_mixer->setMusicVolume(soundVolumeMusic); + + // Subtitles? + _scumm->_noSubtitles = ConfMan.getBool("nosubtitles"); } + void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { case kKeysCmd: @@ -489,53 +486,8 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data _keysDialog->runModal(); #endif break; - case kMasterVolumeChanged: - _soundVolumeMaster = _masterVolumeSlider->getValue(); - _masterVolumeLabel->setValue(_soundVolumeMaster); - _masterVolumeLabel->draw(); - break; - case kMusicVolumeChanged: - _soundVolumeMusic = _musicVolumeSlider->getValue(); - _musicVolumeLabel->setValue(_soundVolumeMusic); - _musicVolumeLabel->draw(); - break; - case kSfxVolumeChanged: - _soundVolumeSfx = _sfxVolumeSlider->getValue(); - _sfxVolumeLabel->setValue(_soundVolumeSfx); - _sfxVolumeLabel->draw(); - break; - case kOKCmd: { - // Update the sound settings - _scumm->_sound->_sound_volume_master = _soundVolumeMaster; // Master - _scumm->_sound->_sound_volume_music = _soundVolumeMusic; // Music - _scumm->_sound->_sound_volume_sfx = _soundVolumeSfx; // SFX - - if (_scumm->_imuse) { - _scumm->_imuse->set_music_volume(_soundVolumeMusic); - } - if (_scumm->_musicEngine) { - _scumm->_musicEngine->setMasterVolume(_soundVolumeMaster); - } - - _scumm->_mixer->setVolume(_soundVolumeSfx * _soundVolumeMaster / 255); - _scumm->_mixer->setMusicVolume(_soundVolumeMusic); - - ConfMan.set("master_volume", _soundVolumeMaster); - ConfMan.set("music_volume", _soundVolumeMusic); - ConfMan.set("sfx_volume", _soundVolumeSfx); - - // Subtitles? - _scumm->_noSubtitles = !subtitlesCheckbox->getState(); - ConfMan.set("nosubtitles", _scumm->_noSubtitles); - - // Finally flush the modified config - ConfMan.flushToDisk(); - } - case kCancelCmd: - close(); - break; default: - ScummDialog::handleCommand(sender, cmd, data); + GUI::OptionsDialog::handleCommand(sender, cmd, data); } } @@ -671,7 +623,7 @@ KeysDialog::KeysDialog(ScummEngine *scumm) : ScummDialog(scumm, 30, 20, 260, 160) { addButton(160, 20, "Map", kMapCmd, 'M'); // Map addButton(160, 40, "OK", kOKCmd, 'O'); // OK - addButton(160, 60, "Cancel", kCancelCmd, 'C'); // Cancel + addButton(160, 60, "Cancel", kCloseCmd, 'C'); // Cancel _actionsList = new ListWidget(this, 10, 20, 140, 90); _actionsList->setNumberingMode(kListNumberingZero); @@ -727,7 +679,7 @@ void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { save_key_mapping(); close(); break; - case kCancelCmd: + case kCloseCmd: load_key_mapping(); close(); break; diff --git a/scumm/dialogs.h b/scumm/dialogs.h index f7d22bbc55..7d9f7ff9fe 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -24,6 +24,7 @@ #include "common/str.h" #include "gui/about.h" #include "gui/dialog.h" +#include "gui/options.h" #include "gui/widget.h" #ifndef DISABLE_HELP @@ -33,17 +34,16 @@ namespace GUI { class ListWidget; } -using namespace GUI; // FIXME: Bad style to use a using directive in a header namespace Scumm { class ScummEngine; -class ScummDialog : public Dialog { +class ScummDialog : public GUI::Dialog { public: ScummDialog(ScummEngine *scumm, int x, int y, int w, int h) - : Dialog(x, y, w, h), _scumm(scumm) {} + : GUI::Dialog(x, y, w, h), _scumm(scumm) {} protected: typedef Common::String String; @@ -58,14 +58,14 @@ class MainMenuDialog : public ScummDialog { public: MainMenuDialog(ScummEngine *scumm); ~MainMenuDialog(); - virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); virtual void open(); virtual void close(); protected: - Dialog *_aboutDialog; + GUI::Dialog *_aboutDialog; #ifndef DISABLE_HELP - Dialog *_helpDialog; + GUI::Dialog *_helpDialog; #endif void save(); @@ -77,17 +77,17 @@ protected: class HelpDialog : public ScummDialog { public: HelpDialog(ScummEngine *scumm); - virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); protected: typedef Common::String String; - ButtonWidget *_nextButton; - ButtonWidget *_prevButton; + GUI::ButtonWidget *_nextButton; + GUI::ButtonWidget *_prevButton; - StaticTextWidget *_title; - StaticTextWidget *_key[HELP_NUM_LINES]; - StaticTextWidget *_dsc[HELP_NUM_LINES]; + GUI::StaticTextWidget *_title; + GUI::StaticTextWidget *_key[HELP_NUM_LINES]; + GUI::StaticTextWidget *_dsc[HELP_NUM_LINES]; int _page; int _numPages; @@ -97,10 +97,11 @@ protected: #endif -class OptionsDialog : public ScummDialog { +class OptionsDialog : public GUI::OptionsDialog { protected: + ScummEngine *_scumm; #ifdef _WIN32_WCE - Dialog *_keysDialog; + GUI::Dialog *_keysDialog; #endif public: @@ -108,23 +109,11 @@ public: ~OptionsDialog(); virtual void open(); - virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + virtual void close(); + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); protected: - - int _soundVolumeMaster; - int _soundVolumeMusic; - int _soundVolumeSfx; - - SliderWidget *_masterVolumeSlider; - SliderWidget *_musicVolumeSlider; - SliderWidget *_sfxVolumeSlider; - - StaticTextWidget *_masterVolumeLabel; - StaticTextWidget *_musicVolumeLabel; - StaticTextWidget *_sfxVolumeLabel; - - CheckboxWidget *subtitlesCheckbox; + GUI::CheckboxWidget *subtitlesCheckbox; }; class InfoDialog : public ScummDialog { @@ -170,14 +159,14 @@ class KeysDialog : public ScummDialog { public: KeysDialog(ScummEngine *scumm); - virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); protected: - ListWidget *_actionsList; - StaticTextWidget *_actionTitle; - StaticTextWidget *_keyMapping; + GUI::ListWidget *_actionsList; + GUI::StaticTextWidget *_actionTitle; + GUI::StaticTextWidget *_keyMapping; int _actionSelected; }; diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 6daef9eda9..856e0d09df 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -677,8 +677,8 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) { if (_imuse && (_saveSound || !_saveLoadCompatible)) { _imuse->save_or_load(s, this); - _imuse->setMasterVolume(_sound->_sound_volume_master); - _imuse->set_music_volume(_sound->_sound_volume_music); + _imuse->setMasterVolume(ConfMan.getInt("master_volume")); + _imuse->set_music_volume(ConfMan.getInt("music_volume")); } } diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 562b18c86f..b6339f3d09 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -20,6 +20,7 @@ */ #include "stdafx.h" +#include "common/config-manager.h" #include "scumm/actor.h" #include "scumm/akos.h" #include "scumm/charset.h" @@ -1472,13 +1473,13 @@ void ScummEngine_v8::o8_kernelGetFunctions() { } break; case 0xDD: // getMasterSFXVol - push(_sound->_sound_volume_sfx / 2); + push(ConfMan.getInt("sfx_volume") / 2); break; case 0xDE: // getMasterVoiceVol - push(_sound->_sound_volume_sfx / 2); + push(ConfMan.getInt("sfx_volume") / 2); break; case 0xDF: // getMasterMusicVol - push(_sound->_sound_volume_music / 2); + push(ConfMan.getInt("music_volume") / 2); break; case 0xE0: // readRegistryValue { diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index e52bc18713..e6e6a378bc 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -654,9 +654,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _debugger = new ScummDebugger(this); _sound = new Sound(this); - _sound->_sound_volume_master = ConfMan.getInt("master_volume"); - _sound->_sound_volume_sfx = ConfMan.getInt("sfx_volume"); - _sound->_sound_volume_music = ConfMan.getInt("music_volume"); #ifndef __GP32__ //ph0x FIXME, "quick dirty hack" /* Bind the mixer to the system => mixer will be invoked @@ -673,8 +670,8 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _silentDigitalImuse = true; _noDigitalSamples = true; } - _mixer->setVolume(_sound->_sound_volume_sfx * _sound->_sound_volume_master / 255); - _mixer->setMusicVolume(_sound->_sound_volume_music); + _mixer->setVolume(ConfMan.getInt("sfx_volume") * ConfMan.getInt("master_volume") / 255); + _mixer->setMusicVolume(ConfMan.getInt("music_volume")); // Init iMuse if (_features & GF_DIGI_IMUSE) { @@ -705,7 +702,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS } if (_features & GF_FMTOWNS) _imuse->property(IMuse::PROP_DIRECT_PASSTHROUGH, 1); - _imuse->set_music_volume(_sound->_sound_volume_music); + _imuse->set_music_volume(ConfMan.getInt("music_volume")); } } #endif // ph0x-hack @@ -1363,7 +1360,7 @@ load_game: #endif sprintf(buf, "Successfully saved game state in file:\n\n%s", filename); - TimedMessageDialog dialog(buf, 1500); + GUI::TimedMessageDialog dialog(buf, 1500); runDialog(dialog); } if (success && _saveLoadFlag != 1) @@ -1613,7 +1610,7 @@ void ScummEngine::parseEvents() { break; case OSystem::EVENT_QUIT: - if(_confirmExit) + if (_confirmExit) confirmexitDialog(); else _quit = true; @@ -1811,18 +1808,18 @@ void ScummEngine::processKbd() { stopTalk(); return; } else if (_lastKeyHit == '[') { // [ Music volume down - int vol = _sound->_sound_volume_music; + int vol = ConfMan.getInt("music_volume"); if (!(vol & 0xF) && vol) vol -= 16; vol = vol & 0xF0; - _sound->_sound_volume_music = vol; + ConfMan.set("music_volume", vol); if (_imuse) _imuse->set_music_volume (vol); } else if (_lastKeyHit == ']') { // ] Music volume up - int vol = _sound->_sound_volume_music; + int vol = ConfMan.getInt("music_volume"); vol = (vol + 16) & 0xFF0; if (vol > 255) vol = 255; - _sound->_sound_volume_music = vol; + ConfMan.set("music_volume", vol); if (_imuse) _imuse->set_music_volume (vol); } else if (_lastKeyHit == '-') { // - text speed down @@ -2493,7 +2490,7 @@ char ScummEngine::displayError(bool showCancel, const char *message, ...) { vsprintf(buf, message, va); va_end(va); - MessageDialog dialog(buf, "OK", "Cancel"); + GUI::MessageDialog dialog(buf, "OK", "Cancel"); return runDialog(dialog); } @@ -2503,70 +2500,74 @@ char ScummEngine::displayError(bool showCancel, const char *message, ...) { int SJIStoFMTChunk(int f, int s) //convert sjis code to fmt font offset { - enum {KANA = 0, KANJI = 1, EKANJI = 2}; + enum { + KANA = 0, + KANJI = 1, + EKANJI = 2 + }; int base = s - (s % 32) - 1; int c = 0, p = 0, chunk_f = 0, chunk = 0, cr, kanjiType = KANA; - if(f >= 0x81 && f <= 0x84) kanjiType = KANA; - if(f >= 0x88 && f <= 0x9f) kanjiType = KANJI; - if(f >= 0xe0 && f <= 0xea) kanjiType = EKANJI; + if (f >= 0x81 && f <= 0x84) kanjiType = KANA; + if (f >= 0x88 && f <= 0x9f) kanjiType = KANJI; + if (f >= 0xe0 && f <= 0xea) kanjiType = EKANJI; - if((f > 0xe8 || (f == 0xe8 && base >= 0x9f)) || (f > 0x90 || (f == 0x90 && base >= 0x9f))) { + if ((f > 0xe8 || (f == 0xe8 && base >= 0x9f)) || (f > 0x90 || (f == 0x90 && base >= 0x9f))) { c = 48; //correction p = -8; //correction } - if(kanjiType == KANA) {//Kana + if (kanjiType == KANA) {//Kana chunk_f = (f - 0x81) * 2; - } else if(kanjiType == KANJI) {//Standard Kanji + } else if (kanjiType == KANJI) {//Standard Kanji p += f - 0x88; chunk_f = c + 2 * p; - } else if(kanjiType == EKANJI) {//Enhanced Kanji + } else if (kanjiType == EKANJI) {//Enhanced Kanji p += f - 0xe0; chunk_f = c + 2 * p; } - if(base == 0x7f && s == 0x7f) + if (base == 0x7f && s == 0x7f) base -= 0x20; //correction - if((base == 0x7f && s == 0x9e) || (base == 0x9f && s == 0xbe) || (base == 0xbf && s == 0xde)) + if ((base == 0x7f && s == 0x9e) || (base == 0x9f && s == 0xbe) || (base == 0xbf && s == 0xde)) base += 0x20; //correction switch(base) { case 0x3f: cr = 0; //3f - if(kanjiType == KANA) chunk = 1; - else if(kanjiType == KANJI) chunk = 31; - else if(kanjiType == EKANJI) chunk = 111; + if (kanjiType == KANA) chunk = 1; + else if (kanjiType == KANJI) chunk = 31; + else if (kanjiType == EKANJI) chunk = 111; break; case 0x5f: cr = 0; //5f - if(kanjiType == KANA) chunk = 17; - else if(kanjiType == KANJI) chunk = 47; - else if(kanjiType == EKANJI) chunk = 127; + if (kanjiType == KANA) chunk = 17; + else if (kanjiType == KANJI) chunk = 47; + else if (kanjiType == EKANJI) chunk = 127; break; case 0x7f: cr = -1; //80 - if(kanjiType == KANA) chunk = 9; - else if(kanjiType == KANJI) chunk = 63; - else if(kanjiType == EKANJI) chunk = 143; + if (kanjiType == KANA) chunk = 9; + else if (kanjiType == KANJI) chunk = 63; + else if (kanjiType == EKANJI) chunk = 143; break; case 0x9f: cr = 1; //9e - if(kanjiType == KANA) chunk = 2; - else if(kanjiType == KANJI) chunk = 32; - else if(kanjiType == EKANJI) chunk = 112; + if (kanjiType == KANA) chunk = 2; + else if (kanjiType == KANJI) chunk = 32; + else if (kanjiType == EKANJI) chunk = 112; break; case 0xbf: cr = 1; //be - if(kanjiType == KANA) chunk = 18; - else if(kanjiType == KANJI) chunk = 48; - else if(kanjiType == EKANJI) chunk = 128; + if (kanjiType == KANA) chunk = 18; + else if (kanjiType == KANJI) chunk = 48; + else if (kanjiType == EKANJI) chunk = 128; break; case 0xdf: cr = 1; //de - if(kanjiType == KANA) chunk = 10; - else if(kanjiType == KANJI) chunk = 64; - else if(kanjiType == EKANJI) chunk = 144; + if (kanjiType == KANA) chunk = 10; + else if (kanjiType == KANJI) chunk = 64; + else if (kanjiType == EKANJI) chunk = 144; break; default: return 0; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index c3548ed306..91e3e60466 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -791,11 +791,11 @@ void Sound::setupSound() { if (_scumm->_imuse) { _scumm->_imuse->setBase(_scumm->res.address[rtSound]); - _scumm->_imuse->setMasterVolume(_sound_volume_master); - _scumm->_imuse->set_music_volume(_sound_volume_music); + _scumm->_imuse->setMasterVolume(ConfMan.getInt("master_volume")); + _scumm->_imuse->set_music_volume(ConfMan.getInt("music_volume")); } - _scumm->_mixer->setVolume(_sound_volume_sfx * _sound_volume_master / 255); - _scumm->_mixer->setMusicVolume(_sound_volume_music); + _scumm->_mixer->setVolume(ConfMan.getInt("sfx_volume") * ConfMan.getInt("master_volume") / 255); + _scumm->_mixer->setMusicVolume(ConfMan.getInt("music_volume")); delete _sfxFile; _sfxFile = openSfxFile(); } diff --git a/scumm/sound.h b/scumm/sound.h index d37a907c11..eb9ff522a7 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -101,10 +101,6 @@ public: bool _soundsPaused; byte _sfxMode; - // FIXME: Should add API to get/set volumes (and automatically - // update iMuse/iMuseDigi/Player_v2/SoundMIxer, too - int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx; - Bundle *_bundle; // FIXME: should be protected but is used by ScummEngine::askForDisk public: |