aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/agi.cpp
diff options
context:
space:
mode:
authorMax Horn2007-12-20 14:57:05 +0000
committerMax Horn2007-12-20 14:57:05 +0000
commit44effa32eb748e6d7d8458f9833de659411f1c08 (patch)
tree939cffeaf687780a2c89a3ddfc95200ef6d5c289 /engines/agi/agi.cpp
parent564fc06cf7196f44c46be24d15c18da0c4992795 (diff)
downloadscummvm-rg350-44effa32eb748e6d7d8458f9833de659411f1c08.tar.gz
scummvm-rg350-44effa32eb748e6d7d8458f9833de659411f1c08.tar.bz2
scummvm-rg350-44effa32eb748e6d7d8458f9833de659411f1c08.zip
Further changes to the AGI keyboard code, matching it against the original Sarien SDL input code. There are still quite some bits which are unclear to me, though
svn-id: r29921
Diffstat (limited to 'engines/agi/agi.cpp')
-rw-r--r--engines/agi/agi.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 0a1589703d..6327fa6a1f 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -219,14 +219,22 @@ void AgiEngine::processEvents() {
key = KEY_BACKSPACE;
break;
default:
- if (key < 256 && !isalpha(key))
- key = event.kbd.ascii;
- else if (event.kbd.flags & Common::KBD_CTRL)
- key = (key & ~0x20) - 0x40;
- else if (event.kbd.flags & Common::KBD_ALT)
- key = scancodeTable[(key & ~0x20) - 0x41] << 8;
- else if (event.kbd.flags & Common::KBD_SHIFT)
- key = event.kbd.ascii;
+ // FIXME: We let lots of keys slip through here unchanged, passing our internal
+ // keycode values directly to the AGI core. Do we really want that???
+ if (isalpha(key)) {
+ // FIXME: We probably should be using event.kbd.ascii at some point here,
+ // but it's not completly clear how/where, this needs testing.
+ // In particular, what about 'a' vs. 'A' (resp. the keys A vs. Shift-A) ?
+
+ // Key is A-Z.
+ // Map Ctrl-A to 1, Ctrl-B to 2, etc.
+ if (event.kbd.flags & Common::KBD_CTRL) {
+ key = toupper(key) - 'A' + 1;
+ } else if (event.kbd.flags & Common::KBD_ALT) {
+ // Map Alt-A, Alt-B etc. to special scancode values according to an internal scancode table.
+ key = scancodeTable[toupper(key) - 'A'] << 8;
+ }
+ }
break;
}
if (key)