MADS: Hook up sfx/music flags

This commit is contained in:
Paul Gilbert 2015-03-14 19:09:44 -04:00
parent 9eb342615c
commit 97ef41707a
4 changed files with 30 additions and 3 deletions

View File

@ -56,7 +56,7 @@ static const MADSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GUIO_NOSPEECH)
},
GType_RexNebular,
0
@ -74,7 +74,7 @@ static const MADSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GUIO_NOSPEECH)
},
GType_RexNebular,
0

View File

@ -44,6 +44,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
_textWindowStill = false;
_screenFade = SCREEN_FADE_SMOOTH;
_musicFlag = true;
_soundFlag = true;
_dithering = false;
_debugger = nullptr;
@ -107,12 +108,23 @@ void MADSEngine::loadOptions() {
_invObjectsAnimated = ConfMan.getBool("InvObjectsAnimated");
if (ConfMan.hasKey("TextWindowStill"))
_textWindowStill = ConfMan.getBool("TextWindowStill");
if (ConfMan.hasKey("mute") && ConfMan.getBool("mute")) {
_soundFlag = false;
_musicFlag = false;
} else {
_soundFlag = !ConfMan.hasKey("sfx_mute") || !ConfMan.getBool("sfx_mute");
_musicFlag = !ConfMan.hasGameDomain("music_mute") || !ConfMan.getBool("music_mute");
}
}
void MADSEngine::saveOptions() {
ConfMan.setBool("EasyMouse", _easyMouse);
ConfMan.setBool("InvObjectsAnimated", _invObjectsAnimated);
ConfMan.setBool("TextWindowStill", _textWindowStill);
ConfMan.setBool("mute", !_soundFlag && !_musicFlag);
ConfMan.setBool("sfx_mute", !_soundFlag && _musicFlag);
ConfMan.setBool("music_mute", _soundFlag && !_musicFlag);
ConfMan.flushToDisk();
}
@ -153,6 +165,12 @@ bool MADSEngine::canSaveGameStateCurrently() {
&& _events->_cursorId != CURSOR_WAIT;
}
void MADSEngine::syncSoundSettings() {
Engine::syncSoundSettings();
loadOptions();
}
/**
* Support method that generates a savegame name
* @param slot Slot number

View File

@ -106,6 +106,7 @@ public:
bool _textWindowStill;
ScreenFade _screenFade;
bool _musicFlag;
bool _soundFlag;
bool _dithering;
public:
MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc);
@ -148,6 +149,11 @@ public:
*/
virtual Common::Error saveGameState(int slot, const Common::String &desc);
/**
* Handles updating sound settings after they're changed in the GMM dialog
*/
virtual void syncSoundSettings();
void saveOptions();
};

View File

@ -146,7 +146,10 @@ void SoundManager::command(int commandId, int param) {
if (_queuedCommands.size() < 8)
_queuedCommands.push(commandId);
} else if (_driver) {
_driver->command(commandId, param);
// Note: I don't know any way to identify music commands versus sfx
// commands, so if sfx is mute, then so is music
if (_vm->_soundFlag)
_driver->command(commandId, param);
}
}