[Scummvm-cvs-logs] SF.net SVN: scummvm: [29921] scummvm/trunk/engines/agi/agi.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Dec 20 15:57:06 CET 2007


Revision: 29921
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29921&view=rev
Author:   fingolfin
Date:     2007-12-20 06:57:05 -0800 (Thu, 20 Dec 2007)

Log Message:
-----------
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

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.cpp

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2007-12-20 14:30:51 UTC (rev 29920)
+++ scummvm/trunk/engines/agi/agi.cpp	2007-12-20 14:57:05 UTC (rev 29921)
@@ -219,14 +219,22 @@
 				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)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list