[Scummvm-cvs-logs] SF.net SVN: scummvm: [27659] scummvm/trunk/engines/scumm
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Jun 23 13:53:25 CEST 2007
Revision: 27659
http://scummvm.svn.sourceforge.net/scummvm/?rev=27659&view=rev
Author: fingolfin
Date: 2007-06-23 04:53:24 -0700 (Sat, 23 Jun 2007)
Log Message:
-----------
SCUMM: Added three FIXME comments to the _keyDownMap code, and made it use KEYCODE_ constants for clarity
Modified Paths:
--------------
scummvm/trunk/engines/scumm/input.cpp
scummvm/trunk/engines/scumm/insane/insane.cpp
scummvm/trunk/engines/scumm/script_v6.cpp
Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp 2007-06-23 11:49:28 UTC (rev 27658)
+++ scummvm/trunk/engines/scumm/input.cpp 2007-06-23 11:53:24 UTC (rev 27659)
@@ -142,6 +142,19 @@
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.
+
if (_keyPressed.ascii >= 512)
debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed.ascii);
else
Modified: scummvm/trunk/engines/scumm/insane/insane.cpp
===================================================================
--- scummvm/trunk/engines/scumm/insane/insane.cpp 2007-06-23 11:49:28 UTC (rev 27658)
+++ scummvm/trunk/engines/scumm/insane/insane.cpp 2007-06-23 11:53:24 UTC (rev 27659)
@@ -580,10 +580,10 @@
_enemyState[EN_BEN][1] += tmpy;
}
- if (_vm->getKeyState(0x0d))
+ if (_vm->getKeyState(Common::KEYCODE_RETURN))
retval |= 1;
- if (_vm->getKeyState(0x09))
+ if (_vm->getKeyState(Common::KEYCODE_TAB))
retval |= 2;
return retval;
Modified: scummvm/trunk/engines/scumm/script_v6.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v6.cpp 2007-06-23 11:49:28 UTC (rev 27658)
+++ scummvm/trunk/engines/scumm/script_v6.cpp 2007-06-23 11:53:24 UTC (rev 27659)
@@ -2803,25 +2803,34 @@
int ScummEngine::getKeyState(int key) {
switch (key) {
case 0x147: // Home
- return (_keyDownMap[0x107] || _keyDownMap[0x115]) ? 1 : 0;
+ // FIXME: There seems to be a mistake in the code here ("insert" vs. "home")
+ return (_keyDownMap[Common::KEYCODE_KP7] ||
+ _keyDownMap[Common::KEYCODE_INSERT]) ? 1 : 0;
case 0x148: // Up
- return (_keyDownMap[0x108] || _keyDownMap[0x111] ||
- _keyDownMap[0x38]) ? 1 : 0;
+ return (_keyDownMap[Common::KEYCODE_KP8] ||
+ _keyDownMap[Common::KEYCODE_UP] ||
+ _keyDownMap[Common::KEYCODE_8]) ? 1 : 0;
case 0x149: // PgUp
- return (_keyDownMap[0x109] || _keyDownMap[0x118]) ? 1 : 0;
+ return (_keyDownMap[Common::KEYCODE_KP9] ||
+ _keyDownMap[Common::KEYCODE_PAGEUP]) ? 1 : 0;
case 0x14B: // Left
- return (_keyDownMap[0x104] || _keyDownMap[0x114] ||
- _keyDownMap[0x34]) ? 1 : 0;
+ return (_keyDownMap[Common::KEYCODE_KP4] ||
+ _keyDownMap[Common::KEYCODE_LEFT] ||
+ _keyDownMap[Common::KEYCODE_4]) ? 1 : 0;
case 0x14D: // Right
- return (_keyDownMap[0x106] || _keyDownMap[0x113] ||
- _keyDownMap[0x36]) ? 1 : 0;
+ return (_keyDownMap[Common::KEYCODE_KP6] ||
+ _keyDownMap[Common::KEYCODE_RIGHT] ||
+ _keyDownMap[Common::KEYCODE_6]) ? 1 : 0;
case 0x14F: // End
- return (_keyDownMap[0x101] || _keyDownMap[0x117]) ? 1 : 0;
+ return (_keyDownMap[Common::KEYCODE_KP1] ||
+ _keyDownMap[Common::KEYCODE_END]) ? 1 : 0;
case 0x150: // Down
- return (_keyDownMap[0x102] || _keyDownMap[0x112] ||
- _keyDownMap[0x32]) ? 1 : 0;
+ return (_keyDownMap[Common::KEYCODE_KP2] ||
+ _keyDownMap[Common::KEYCODE_DOWN] ||
+ _keyDownMap[Common::KEYCODE_2]) ? 1 : 0;
case 0x151: // PgDn
- return (_keyDownMap[0x103] || _keyDownMap[0x119]) ? 1 : 0;
+ return (_keyDownMap[Common::KEYCODE_KP3] ||
+ _keyDownMap[Common::KEYCODE_PAGEDOWN]) ? 1 : 0;
default:
return (_keyDownMap[key]) ? 1 : 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