From e8791ac979b30b710774bc852f1cc433d09dfc4f Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 29 Jan 2016 22:49:24 +0100 Subject: AGI: add hack to make numpad cursor keys work should probably get fixed at some point in backend --- engines/agi/keyboard.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index c307b077b1..3368ea5c9e 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -171,11 +171,19 @@ void AgiEngine::processEvents() { break; } - if ((event.kbd.ascii) && (event.kbd.ascii <= 0xFF)) { + key = event.kbd.ascii; + if (event.kbd.keycode >= Common::KEYCODE_KP0 && event.kbd.keycode <= Common::KEYCODE_KP9) { + if (!(event.kbd.flags & Common::KBD_NUM)) { + // HACK: Num-Lock not enabled + // We shouldn't get a valid ascii code in these cases. We fix it here, so that cursor keys + // on the numpad work properly. + key = 0; + } + } + + if ((key) && (key <= 0xFF)) { // No special key, directly accept it // Is ISO-8859-1, we need lower 128 characters only, which is plain ASCII, so no mapping required - key = event.kbd.ascii; - if (Common::isAlpha(key)) { // Key is A-Z. // Map Ctrl-A to 1, Ctrl-B to 2, etc. @@ -187,7 +195,9 @@ void AgiEngine::processEvents() { } } } else { - switch (key = event.kbd.keycode) { + key = event.kbd.keycode; + + switch (key) { case Common::KEYCODE_LEFT: case Common::KEYCODE_KP4: if (_allowSynthetic || !event.synthetic) -- cgit v1.2.3