[Scummvm-cvs-logs] SF.net SVN: scummvm: [27784] scummvm/trunk/engines/scumm/input.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jun 30 14:01:28 CEST 2007


Revision: 27784
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27784&view=rev
Author:   fingolfin
Date:     2007-06-30 05:01:27 -0700 (Sat, 30 Jun 2007)

Log Message:
-----------
Removed/clarified various FIXME comments

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/input.cpp

Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp	2007-06-30 11:57:50 UTC (rev 27783)
+++ scummvm/trunk/engines/scumm/input.cpp	2007-06-30 12:01:27 UTC (rev 27784)
@@ -114,19 +114,14 @@
 				VAR(VAR_KEY_STATE) = keyState;
 			}
 
-			// FIXME: There is a discrepancy between EVENT_KEYDOWN and EVENT_KEYUP here:
-			// For EVENT_KEYDOWN, we use _keyPressed.keycode, which has potentially been
-			// modified, while for EVENT_KEYUP we use the unfiltered event.kbd.keycode.
-			// This could lead problems (like a key becoming 'stuck').
-			
-			// FIXME #2: We are mixing ascii and keycode values here. We probably should
-			// be using keycodes, but at least INSANE checks for "Shift-V" by looking for
-			// the 'V' key being pressed. It would be easy to solve that by also storing the
-			// the modifier flags. However, since getKeyState() is also called by scripts,
-			// we have to be very careful with semantic changes.
-			// Nevertheless, it's bad to rely on "ascii" holdoing keycode values for special
-			// keys (like the function keys), so this should be fixed.
-
+			// FIXME: We are using ASCII values to index the _keyDownMap here,
+			// yet later one code which checks _keyDownMap will use KEYCODEs
+			// to do so. That is, we are mixing ascii and keycode values here,
+			// which is bad. We probably should be only using keycodes, but at
+			// least INSANE checks for "Shift-V" by looking for the 'V' key
+			// being pressed. It would be easy to solve that by also storing
+			// the modifier flags. However, since getKeyState() is also called
+			// by scripts, we have to be careful with semantic changes.
 			if (_keyPressed.ascii >= 512)
 				debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed.ascii);
 			else
@@ -134,11 +129,9 @@
 			break;
 
 		case Common::EVENT_KEYUP:
-			// FIXME: for some reason Common::KBD_ALT is set sometimes
-			// possible to a bug in sdl-common.cpp
-			if (event.kbd.ascii >= 512)
+			if (event.kbd.ascii >= 512) {
 				debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii);
-			else {
+			} else {
 				_keyDownMap[event.kbd.ascii] = false;
 
 				// Due to some weird bug with capslock key pressed
@@ -148,6 +141,8 @@
 				// both upper and lower letters are unpressed on keyup event
 				//
 				// Fixes bug #1709430: "FT: CAPSLOCK + V enables cheating for all fights"
+				//
+				// Fingolfin remarks: This wouldn't be a problem if we used keycodes.
 				_keyDownMap[toupper(event.kbd.ascii)] = false;
 			}
 			break;
@@ -473,12 +468,6 @@
 	if (_game.id == GID_CMI)
 		mainmenuKeyEnabled = true;
 
-/*
-	FIXME: We also used to force-enable F5 in Sam&Max and HE >= 72 games -- why?
-	if ((_game.version <= 3) || (_game.id == GID_SAMNMAX) || (_game.id == GID_CMI) || (_game.heversion >= 72))
-		mainmenuKeyEnabled = true;
-*/
-
 	if (mainmenuKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.flags == 0)) {
 		if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
 			runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);


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