diff options
Diffstat (limited to 'engines/engine.cpp')
-rw-r--r-- | engines/engine.cpp | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/engines/engine.cpp b/engines/engine.cpp index 757a77f82b..ffc044a508 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -36,7 +36,9 @@ #include "common/savefile.h" #include "common/system.h" #include "gui/message.h" +#include "gui/newgui.h" #include "sound/mixer.h" +#include "engines/dialogs.h" #ifdef _WIN32_WCE extern bool isSmartphone(void); @@ -54,7 +56,10 @@ Engine::Engine(OSystem *syst) _saveFileMan(_system->getSavefileManager()), _targetName(ConfMan.getActiveDomainName()), _gameDataPath(ConfMan.get("path")), - _pauseLevel(0) { + _pauseLevel(0), + _mainMenuDialog(NULL), + _quit(false), + _rtl(false) { g_engine = this; _autosavePeriod = ConfMan.getInt("autosave_period"); @@ -72,7 +77,8 @@ Engine::Engine(OSystem *syst) Engine::~Engine() { _mixer->stopAll(); - + + delete _mainMenuDialog; g_engine = NULL; } @@ -210,3 +216,40 @@ void Engine::pauseEngineIntern(bool pause) { // By default, just (un)pause all digital sounds _mixer->pauseAll(pause); } + +void Engine::mainMenuDialog() { + if (!_mainMenuDialog) + _mainMenuDialog = new MainMenuDialog(this); + runDialog(*_mainMenuDialog); + syncSoundSettings(); +} + +int Engine::runDialog(Dialog &dialog) { + + pauseEngine(true); + + int result = dialog.runModal(); + + pauseEngine(false); + + return 0; +} + +void Engine::syncSoundSettings() { + + // Sync the engine with the config manager + int soundVolumeMusic = ConfMan.getInt("music_volume"); + int soundVolumeSFX = ConfMan.getInt("sfx_volume"); + int soundVolumeSpeech = ConfMan.getInt("speech_volume"); + + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech); +} + +void Engine::quitGame() { + Common::Event event; + + event.type = Common::EVENT_QUIT; + _eventMan->pushEvent(event); +} |