aboutsummaryrefslogtreecommitdiff
path: root/engines/engine.cpp
diff options
context:
space:
mode:
authorMax Horn2008-09-01 17:30:03 +0000
committerMax Horn2008-09-01 17:30:03 +0000
commit027ae0a6f6bd7e7dfbfe6f7df0824596894f51ae (patch)
tree205993ffb25dcb2311e62b1871431eb6cf62185e /engines/engine.cpp
parent2db5747642446bad3e1824afd0358f51c1965c20 (diff)
parent852bc9dbb750b9995d31e70f4158c97d3758c46f (diff)
downloadscummvm-rg350-027ae0a6f6bd7e7dfbfe6f7df0824596894f51ae.tar.gz
scummvm-rg350-027ae0a6f6bd7e7dfbfe6f7df0824596894f51ae.tar.bz2
scummvm-rg350-027ae0a6f6bd7e7dfbfe6f7df0824596894f51ae.zip
First part of GSoC2008 RTL branch merge
svn-id: r34241
Diffstat (limited to 'engines/engine.cpp')
-rw-r--r--engines/engine.cpp56
1 files changed, 54 insertions, 2 deletions
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 757a77f82b..4840b19838 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -36,7 +36,10 @@
#include "common/savefile.h"
#include "common/system.h"
#include "gui/message.h"
+#include "gui/newgui.h"
#include "sound/mixer.h"
+#include "engines/dialogs.h"
+#include "engines/metaengine.h"
#ifdef _WIN32_WCE
extern bool isSmartphone(void);
@@ -54,7 +57,8 @@ Engine::Engine(OSystem *syst)
_saveFileMan(_system->getSavefileManager()),
_targetName(ConfMan.getActiveDomainName()),
_gameDataPath(ConfMan.get("path")),
- _pauseLevel(0) {
+ _pauseLevel(0),
+ _mainMenuDialog(NULL) {
g_engine = this;
_autosavePeriod = ConfMan.getInt("autosave_period");
@@ -72,7 +76,8 @@ Engine::Engine(OSystem *syst)
Engine::~Engine() {
_mixer->stopAll();
-
+
+ delete _mainMenuDialog;
g_engine = NULL;
}
@@ -210,3 +215,50 @@ 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 result;
+}
+
+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);
+}
+
+bool Engine::hasFeature(int f) {
+ const EnginePlugin *plugin = 0;
+ Common::String gameid = ConfMan.get("gameid");
+ gameid.toLowercase();
+ EngineMan.findGame(gameid, &plugin);
+
+ return ( (*plugin)->hasFeature((MetaEngine::MetaEngineFeature)f) );
+}
+