aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2012-11-21 23:07:30 -0500
committerMatthew Hoops2012-11-21 23:18:08 -0500
commit7f8b7e0916bf6cbbdc15d57f71eceba648034c50 (patch)
treecd42dc1fc711b039f761033d2a553eefcf3d76f7 /engines
parente9b04d018f13bf3f604175a97e3df7a4b8f7cac4 (diff)
downloadscummvm-rg350-7f8b7e0916bf6cbbdc15d57f71eceba648034c50.tar.gz
scummvm-rg350-7f8b7e0916bf6cbbdc15d57f71eceba648034c50.tar.bz2
scummvm-rg350-7f8b7e0916bf6cbbdc15d57f71eceba648034c50.zip
PEGASUS: Add a keymap
Diffstat (limited to 'engines')
-rw-r--r--engines/pegasus/pegasus.cpp39
-rw-r--r--engines/pegasus/pegasus.h1
2 files changed, 40 insertions, 0 deletions
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index d32e9dd8ea..b958def0da 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -33,6 +33,7 @@
#include "common/textconsole.h"
#include "common/translation.h"
#include "common/random.h"
+#include "backends/keymapper/keymapper.h"
#include "base/plugins.h"
#include "base/version.h"
#include "gui/saveload.h"
@@ -151,6 +152,7 @@ Common::Error PegasusEngine::run() {
}
// Set up input
+ initKeymap();
InputHandler::setInputHandler(this);
allowInput(true);
@@ -2349,4 +2351,41 @@ uint PegasusEngine::getNeighborhoodCD(const NeighborhoodID neighborhood) const {
return 1;
}
+void PegasusEngine::initKeymap() {
+#ifdef ENABLE_KEYMAPPER
+ static const char *const kKeymapName = "pegasus";
+ Common::Keymapper *const mapper = _eventMan->getKeymapper();
+
+ // Do not try to recreate same keymap over again
+ if (mapper->getKeymap(kKeymapName) != 0)
+ return;
+
+ Common::Keymap *const engineKeyMap = new Common::Keymap(kKeymapName);
+
+ // Since the game has multiple built-in keys for each of these anyway,
+ // this just attempts to remap one of them.
+ const Common::KeyActionEntry keyActionEntries[] = {
+ { Common::KEYCODE_UP, "UP", _("Up/Forward") },
+ { Common::KEYCODE_DOWN, "DWN", _("Down/Backward") },
+ { Common::KEYCODE_LEFT, "TL", _("Turn Left") },
+ { Common::KEYCODE_RIGHT, "TR", _("Turn Right") },
+ { Common::KEYCODE_BACKQUOTE, "TIV", _("Toggle Inventory Tray") },
+ { Common::KEYCODE_BACKSPACE, "TBI", _("Toggle Biochip Tray") },
+ { Common::KEYCODE_RETURN, "ENT", _("Enter/Select") },
+ { Common::KEYCODE_t, "TMA", _("Toggle Middle Area") },
+ { Common::KEYCODE_i, "TIN", _("Toggle Info") },
+ { Common::KEYCODE_ESCAPE, "PM", _("Activate Pause Menu") },
+ { Common::KEYCODE_e, "WTF", _("???") } // easter egg key (without being completely upfront about it)
+ };
+
+ for (uint i = 0; i < ARRAYSIZE(keyActionEntries); i++) {
+ Common::Action *const act = new Common::Action(engineKeyMap, keyActionEntries[i].id, keyActionEntries[i].description);
+ act->addKeyEvent(keyActionEntries[i].ks);
+ }
+
+ mapper->addGameKeymap(engineKeyMap);
+ mapper->pushKeymap(kKeymapName, true);
+#endif
+}
+
} // End of namespace Pegasus
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index 2a8ba22470..a8f2e1ffca 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -265,6 +265,7 @@ private:
void doSubChase();
uint getNeighborhoodCD(const NeighborhoodID neighborhood) const;
uint _currentCD;
+ void initKeymap();
// Menu
GameMenu *_gameMenu;