aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/lol.cpp63
-rw-r--r--engines/kyra/lol.h4
-rw-r--r--po/POTFILES1
3 files changed, 68 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;
diff --git a/po/POTFILES b/po/POTFILES
index 6ce26a0539..dcc501ae0e 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -36,6 +36,7 @@ engines/gob/inter_playtoons.cpp
engines/gob/inter_v2.cpp
engines/gob/inter_v5.cpp
engines/groovie/script.cpp
+engines/kyra/lol.cpp
engines/kyra/sound_midi.cpp
engines/m4/m4_menus.cpp
engines/sky/compact.cpp