From 5cbbf89f77de0e4f2a342d8dbcb0d85b76ce0999 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Sun, 9 Oct 2011 15:51:13 -0500 Subject: ENGINES: Added initKeymap() stub --- engines/engine.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines') diff --git a/engines/engine.h b/engines/engine.h index 2796df5c4f..d508b4ed18 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -180,6 +180,11 @@ public: */ virtual void syncSoundSettings(); + /* + * Initialize the engine-specific keymap + */ + virtual void initKeymap() {} + /** * Flip mute all sound option. */ -- cgit v1.2.3 From 719020a3e7f222f6348e01c8285d85e226919d30 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Mon, 10 Oct 2011 20:39:12 -0500 Subject: KYRA: Added basic game keymap for LoL --- engines/kyra/lol.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ engines/kyra/lol.h | 4 ++++ 2 files changed, 67 insertions(+) (limited to 'engines') 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; -- cgit v1.2.3 From 8d970f35684f15e1a2a2fb125d4da70ea901fecf Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Sat, 15 Oct 2011 00:38:10 -0500 Subject: KYRA: Cleanup game keymaps on RTL This fixes an RTL problem where the keymaps linger between same-engine games. Meaning the lol keymap shows up in kyra1 --- engines/kyra/lol.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines') diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 8ed192a04a..78ed428b69 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -249,6 +249,10 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy LoLEngine::~LoLEngine() { setupPrologueData(false); +#ifdef ENABLE_KEYMAPPER + _eventMan->getKeymapper()->cleanupGameKeymaps(); +#endif + delete[] _landsFile; delete[] _levelLangFile; -- cgit v1.2.3 From f4fa37fdf877c29577f2338b805f77da9b4c2438 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Fri, 28 Oct 2011 09:56:30 -0500 Subject: KYRA: Move kKeymapName to be inside LoLEngine Thanks LordHoto --- engines/kyra/lol.cpp | 2 ++ engines/kyra/lol.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 78ed428b69..45c626a3e0 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -40,6 +40,8 @@ namespace Kyra { +const char *const LoLEngine::kKeymapName = "lol"; + LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(system, flags) { _screen = 0; _gui = 0; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 7204f156ec..54f043fecf 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -296,8 +296,6 @@ struct MistOfDoomAnimData { uint8 sound; }; -static const char *const kKeymapName = "lol"; - class LoLEngine : public KyraEngine_v1 { friend class GUI_LoL; friend class TextDisplayer_LoL; @@ -337,6 +335,8 @@ private: void writeSettings(); void readSettings(); + static const char *const kKeymapName; + const char *const *_pakFileList; int _pakFileListSize; -- cgit v1.2.3 From 1ec5b491b7b2b34d85be8e358b82b842cdd766a3 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Fri, 28 Oct 2011 19:29:54 -0500 Subject: KYRA: Remove usage of using namespace Common in the keymap code thanks LordHoto --- engines/kyra/lol.cpp | 56 +++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) (limited to 'engines') diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 45c626a3e0..f793ab82bf 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -558,53 +558,51 @@ Common::Error LoLEngine::init() { void LoLEngine::initKeymap() { #ifdef ENABLE_KEYMAPPER - using namespace Common; - bool tmp; - Keymapper *mapper = _eventMan->getKeymapper(); + Common::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); + Common::Action *act; + Common::Keymap *engineKeyMap = new Common::Keymap(kKeymapName); - act = new Action(engineKeyMap, "AT1", _("Attack 1"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_F1, ASCII_F1 , 0)); + act = new Common::Action(engineKeyMap, "AT1", _("Attack 1"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0)); - act = new Action(engineKeyMap, "AT2", _("Attack 2"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_F1, ASCII_F1 , 0)); + act = new Common::Action(engineKeyMap, "AT2", _("Attack 2"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0)); - act = new Action(engineKeyMap, "AT3", _("Attack 3"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_F1, ASCII_F1 , 0)); + act = new Common::Action(engineKeyMap, "AT3", _("Attack 3"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0)); - act = new Action(engineKeyMap, "MVF", _("Move Forward"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_UP)); + act = new Common::Action(engineKeyMap, "MVF", _("Move Forward"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_UP)); - act = new Action(engineKeyMap, "MVB", _("Move Back"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_DOWN)); + act = new Common::Action(engineKeyMap, "MVB", _("Move Back"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_DOWN)); - act = new Action(engineKeyMap, "SLL", _("Slide Left"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_LEFT)); + act = new Common::Action(engineKeyMap, "SLL", _("Slide Left"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_LEFT)); - act = new Action(engineKeyMap, "SLR", _("Slide Right"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_RIGHT)); + act = new Common::Action(engineKeyMap, "SLR", _("Slide Right"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_RIGHT)); - act = new Action(engineKeyMap, "TL", _("Turn Left"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_HOME)); + act = new Common::Action(engineKeyMap, "TL", _("Turn Left"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_HOME)); - act = new Action(engineKeyMap, "TR", _("Turn Right"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_PAGEUP)); + act = new Common::Action(engineKeyMap, "TR", _("Turn Right"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_PAGEUP)); - act = new Action(engineKeyMap, "RST", _("Rest"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_r)); + act = new Common::Action(engineKeyMap, "RST", _("Rest"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_r)); - act = new Action(engineKeyMap, "OPT", _("Options"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_o)); + act = new Common::Action(engineKeyMap, "OPT", _("Options"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_o)); - act = new Action(engineKeyMap, "SPL", _("Choose Spell"), kGenericActionType, kActionKeyType); - act->addKeyEvent(KeyState(KEYCODE_SLASH)); + act = new Common::Action(engineKeyMap, "SPL", _("Choose Spell"), Common::kGenericActionType, Common::kActionKeyType); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_SLASH)); mapper->addGameKeymap(engineKeyMap); -- cgit v1.2.3 From 843f19788b7d83074f811f786663186fc43e64e1 Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Sun, 30 Oct 2011 22:37:32 -0500 Subject: KYRA: Fix some copy paste error in LoL keymap keycodes --- engines/kyra/lol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index f793ab82bf..f64e4f85f2 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -572,10 +572,10 @@ void LoLEngine::initKeymap() { act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0)); act = new Common::Action(engineKeyMap, "AT2", _("Attack 2"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0)); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_F2, Common::ASCII_F2 , 0)); act = new Common::Action(engineKeyMap, "AT3", _("Attack 3"), Common::kGenericActionType, Common::kActionKeyType); - act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0)); + act->addKeyEvent(Common::KeyState(Common::KEYCODE_F3, Common::ASCII_F3 , 0)); act = new Common::Action(engineKeyMap, "MVF", _("Move Forward"), Common::kGenericActionType, Common::kActionKeyType); act->addKeyEvent(Common::KeyState(Common::KEYCODE_UP)); -- cgit v1.2.3