From 171b79c2c528d03a826ab095fcd3b0ebd3236f94 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 29 Jan 2016 22:57:30 +0100 Subject: SCI: add code to make numpad cursor keys work again When the users presses keys on the numpad, we get digits in .ascii even when Num-Lock is not enabled. This caused numpad cursor keys not working anymore. Imo we should only get .ascii in those cases, when Num-Lock is enabled. --- engines/sci/event.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'engines/sci') diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index 3f615f610f..90ddaaf967 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -214,6 +214,15 @@ SciEvent EventManager::getScummVMEvent() { //((ev.kbd.flags & Common::KBD_CAPS) ? SCI_KEYMOD_CAPSLOCK : 0) | //((ev.kbd.flags & Common::KBD_SCRL) ? SCI_KEYMOD_SCRLOCK : 0) | + if (input.data >= Common::KEYCODE_KP0 && input.data <= Common::KEYCODE_KP9) { + if (!(ev.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. + input.character = 0; + } + } + if ((input.character) && (input.character <= 0xFF)) { // Directly accept most common keys without conversion if ((input.character >= 0x80) && (input.character <= 0xFF)) { -- cgit v1.2.3