diff options
-rw-r--r-- | engines/cge/events.cpp | 11 | ||||
-rw-r--r-- | engines/cge/events.h | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 1c2738f62e..e2aaaa587d 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -99,11 +99,16 @@ Sprite *Keyboard::setClient(Sprite *spr) { return spr; } -bool Keyboard::getKey(uint16 keycode, int &cgeCode) { +bool Keyboard::getKey(Common::Event &event, int &cgeCode) { + Common::KeyCode keycode = event.kbd.keycode; if ((keycode == Common::KEYCODE_LCTRL) || (keycode == Common::KEYCODE_RCTRL)) { cgeCode = 29; return true; } + if ((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT)) { + cgeCode = 56; + return true; + } if (keycode == Common::KEYCODE_KP_ENTER) { cgeCode = 28; return true; @@ -111,7 +116,7 @@ bool Keyboard::getKey(uint16 keycode, int &cgeCode) { // Scan through the ScummVM mapping list for (int idx = 0; idx < 0x60; idx++) { - if (_scummVmCodes[idx] == keycode) { + if (_scummVmCodes[idx] == event.kbd.ascii) { cgeCode = idx; return true; } @@ -122,7 +127,7 @@ bool Keyboard::getKey(uint16 keycode, int &cgeCode) { void Keyboard::newKeyboard(Common::Event &event) { int keycode; - if (!getKey(event.kbd.keycode, keycode)) + if (!getKey(event, keycode)) return; if (event.type == Common::EVENT_KEYUP) { diff --git a/engines/cge/events.h b/engines/cge/events.h index 671878f69a..2d85574bd7 100644 --- a/engines/cge/events.h +++ b/engines/cge/events.h @@ -47,7 +47,7 @@ namespace CGE { class Keyboard { private: - bool getKey(uint16 keycode, int &cgeCode); + bool getKey(Common::Event &event, int &cgeCode); public: static const uint16 _code[0x60]; static const uint16 _scummVmCodes[0x60]; |