aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorMartin Kiewitz2016-01-29 22:49:24 +0100
committerMartin Kiewitz2016-01-29 22:49:24 +0100
commite8791ac979b30b710774bc852f1cc433d09dfc4f (patch)
treee893d65ec6623b017a825e2831fbb04052deb44a /engines/agi
parent855059ca059ce1d2c770475eac66ae1abaff2372 (diff)
downloadscummvm-rg350-e8791ac979b30b710774bc852f1cc433d09dfc4f.tar.gz
scummvm-rg350-e8791ac979b30b710774bc852f1cc433d09dfc4f.tar.bz2
scummvm-rg350-e8791ac979b30b710774bc852f1cc433d09dfc4f.zip
AGI: add hack to make numpad cursor keys work
should probably get fixed at some point in backend
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/keyboard.cpp18
1 files changed, 14 insertions, 4 deletions
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)