aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTarek Soliman2011-12-30 11:50:15 -0600
committerTarek Soliman2011-12-30 12:36:11 -0600
commit40b68b41c7a507dad5a1d38813bfa7f89e7c6551 (patch)
treeb6eed041452dc5fb70db1cfaf2d3d90e4030ab74 /engines
parentb3f265696ffbf7d91e8ee303458ae78571cb6b68 (diff)
downloadscummvm-rg350-40b68b41c7a507dad5a1d38813bfa7f89e7c6551.tar.gz
scummvm-rg350-40b68b41c7a507dad5a1d38813bfa7f89e7c6551.tar.bz2
scummvm-rg350-40b68b41c7a507dad5a1d38813bfa7f89e7c6551.zip
KEYMAPPER: Make engine keymap init and cleanup more generic
Diffstat (limited to 'engines')
-rw-r--r--engines/engine.cpp8
-rw-r--r--engines/engine.h7
-rw-r--r--engines/kyra/lol.cpp10
3 files changed, 17 insertions, 8 deletions
diff --git a/engines/engine.cpp b/engines/engine.cpp
index e4e4630841..4811ba6917 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -45,6 +45,8 @@
#include "common/textconsole.h"
#include "common/translation.h"
+#include "backends/keymapper/keymapper.h"
+
#include "gui/debugger.h"
#include "gui/dialog.h"
#include "gui/message.h"
@@ -499,6 +501,12 @@ void Engine::syncSoundSettings() {
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
}
+void Engine::deinitKeymap() {
+#ifdef ENABLE_KEYMAPPER
+ _eventMan->getKeymapper()->cleanupGameKeymaps();
+#endif
+}
+
void Engine::flipMute() {
// Mute will be set to true by default here. This has two reasons:
// - if the game already has an "mute" config entry, it will be overwritten anyway.
diff --git a/engines/engine.h b/engines/engine.h
index d508b4ed18..a020dc4951 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -181,10 +181,15 @@ public:
virtual void syncSoundSettings();
/*
- * Initialize the engine-specific keymap
+ * Initialize any engine-specific keymaps.
*/
virtual void initKeymap() {}
+ /*
+ * Cleanup any engine-specific keymaps.
+ */
+ virtual void deinitKeymap();
+
/**
* Flip mute all sound option.
*/
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 62143e5f72..db71b80611 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -212,10 +212,6 @@ LoLEngine::~LoLEngine() {
setupPrologueData(false);
releaseTempData();
-#ifdef ENABLE_KEYMAPPER
- _eventMan->getKeymapper()->cleanupGameKeymaps();
-#endif
-
delete[] _landsFile;
delete[] _levelLangFile;
@@ -461,7 +457,9 @@ Common::Error LoLEngine::init() {
_spellProcs.push_back(new SpellProc(this, 0));
_spellProcs.push_back(new SpellProc(this, &LoLEngine::castGuardian));
- initKeymap();
+#ifdef ENABLE_KEYMAPPER
+ _eventMan->getKeymapper()->pushKeymap(kKeymapName, true);
+#endif
return Common::kNoError;
}
@@ -503,8 +501,6 @@ void LoLEngine::initKeymap() {
mapper->addGameKeymap(engineKeyMap);
- mapper->pushKeymap(kKeymapName, true);
-
#endif
}