aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2016-01-29 22:57:30 +0100
committerMartin Kiewitz2016-01-29 22:57:30 +0100
commit171b79c2c528d03a826ab095fcd3b0ebd3236f94 (patch)
tree59496fe1279e4aa5810b86b6585cac8296c62df6 /engines/sci
parent1e73796bd0b17740ca4c35b9a7bd1882f9de6a37 (diff)
downloadscummvm-rg350-171b79c2c528d03a826ab095fcd3b0ebd3236f94.tar.gz
scummvm-rg350-171b79c2c528d03a826ab095fcd3b0ebd3236f94.tar.bz2
scummvm-rg350-171b79c2c528d03a826ab095fcd3b0ebd3236f94.zip
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.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/event.cpp9
1 files changed, 9 insertions, 0 deletions
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)) {