aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorTarek Soliman2011-10-10 20:39:12 -0500
committerTarek Soliman2011-10-27 10:46:21 -0500
commit719020a3e7f222f6348e01c8285d85e226919d30 (patch)
tree3b9aca1f43cd8e8040c0aeaf4910bad1e5813fd6 /engines/kyra
parent5cbbf89f77de0e4f2a342d8dbcb0d85b76ce0999 (diff)
downloadscummvm-rg350-719020a3e7f222f6348e01c8285d85e226919d30.tar.gz
scummvm-rg350-719020a3e7f222f6348e01c8285d85e226919d30.tar.bz2
scummvm-rg350-719020a3e7f222f6348e01c8285d85e226919d30.zip
KYRA: Added basic game keymap for LoL
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/lol.cpp63
-rw-r--r--engines/kyra/lol.h4
2 files changed, 67 insertions, 0 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 5aba264ceb..8ed192a04a 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -34,6 +34,9 @@
#include "common/config-manager.h"
#include "common/system.h"
+#include "common/translation.h"
+
+#include "backends/keymapper/keymapper.h"
namespace Kyra {
@@ -541,9 +544,69 @@ Common::Error LoLEngine::init() {
_debugger = new Debugger_LoL(this);
assert(_debugger);
+ initKeymap();
+
return Common::kNoError;
}
+void LoLEngine::initKeymap() {
+#ifdef ENABLE_KEYMAPPER
+
+ using namespace Common;
+
+ bool tmp;
+ Keymapper *mapper = _eventMan->getKeymapper();
+
+ // Do not try to recreate same keymap over again
+ if (mapper->getKeymap(kKeymapName, tmp) != 0)
+ return;
+
+ Action *act;
+ Keymap *engineKeyMap = new Keymap(kKeymapName);
+
+ act = new Action(engineKeyMap, "AT1", _("Attack 1"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_F1, ASCII_F1 , 0));
+
+ act = new Action(engineKeyMap, "AT2", _("Attack 2"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_F1, ASCII_F1 , 0));
+
+ act = new Action(engineKeyMap, "AT3", _("Attack 3"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_F1, ASCII_F1 , 0));
+
+ act = new Action(engineKeyMap, "MVF", _("Move Forward"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_UP));
+
+ act = new Action(engineKeyMap, "MVB", _("Move Back"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_DOWN));
+
+ act = new Action(engineKeyMap, "SLL", _("Slide Left"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_LEFT));
+
+ act = new Action(engineKeyMap, "SLR", _("Slide Right"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_RIGHT));
+
+ act = new Action(engineKeyMap, "TL", _("Turn Left"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_HOME));
+
+ act = new Action(engineKeyMap, "TR", _("Turn Right"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_PAGEUP));
+
+ act = new Action(engineKeyMap, "RST", _("Rest"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_r));
+
+ act = new Action(engineKeyMap, "OPT", _("Options"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_o));
+
+ act = new Action(engineKeyMap, "SPL", _("Choose Spell"), kGenericActionType, kActionKeyType);
+ act->addKeyEvent(KeyState(KEYCODE_SLASH));
+
+ mapper->addGameKeymap(engineKeyMap);
+
+ mapper->pushKeymap(kKeymapName, true);
+
+#endif
+}
+
Common::Error LoLEngine::go() {
int action = -1;
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 164f030a1d..7204f156ec 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -296,6 +296,8 @@ struct MistOfDoomAnimData {
uint8 sound;
};
+static const char *const kKeymapName = "lol";
+
class LoLEngine : public KyraEngine_v1 {
friend class GUI_LoL;
friend class TextDisplayer_LoL;
@@ -307,6 +309,8 @@ public:
LoLEngine(OSystem *system, const GameFlags &flags);
~LoLEngine();
+ virtual void initKeymap();
+
Screen *screen();
GUI *gui() const;