[Scummvm-cvs-logs] SF.net SVN: scummvm: [27776] scummvm/trunk/engines/scumm/input.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Jun 30 00:36:56 CEST 2007
Revision: 27776
http://scummvm.svn.sourceforge.net/scummvm/?rev=27776&view=rev
Author: fingolfin
Date: 2007-06-29 15:36:56 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
SCUMM: Moved code for handling KBD_ALT combos (well, really only one: Alt-W) in MI2 to processKeyboard; some cleanup
Modified Paths:
--------------
scummvm/trunk/engines/scumm/input.cpp
Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp 2007-06-29 18:41:06 UTC (rev 27775)
+++ scummvm/trunk/engines/scumm/input.cpp 2007-06-29 22:36:56 UTC (rev 27776)
@@ -75,24 +75,14 @@
sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
_saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2;
_saveTemporaryState = false;
- } else if (event.kbd.flags == Common::KBD_CTRL) {
- if (event.kbd.keycode == 'f')
- _fastMode ^= 1;
- else if (event.kbd.keycode == 'g')
- _fastMode ^= 2;
- else if (event.kbd.keycode == 'd')
- _debugger->attach();
- else if (event.kbd.keycode == 's')
- _res->resourceStats();
- else
- _keyPressed = event.kbd; // Normal key press, pass on to the game.
- } else if (event.kbd.flags & Common::KBD_ALT) {
- // Handle KBD_ALT combos. We know that the result must be 273 for Alt-W
- // because that's what MI2 looks for in its "instant win" cheat.
-
- // FIXME: Handle this specific property of MI2 inside processKeyboard ?
- _keyPressed = event.kbd;
- _keyPressed.ascii = event.kbd.keycode + 154;
+ } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') {
+ _fastMode ^= 1;
+ } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'g') {
+ _fastMode ^= 2;
+ } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') {
+ _debugger->attach();
+ } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 's') {
+ _res->resourceStats();
} else {
// Normal key press, pass on to the game.
_keyPressed = event.kbd;
@@ -116,27 +106,27 @@
if (_game.heversion >= 80) {
// Keyboard is controlled via variable
- int _keyState = 0;
+ int keyState = 0;
if (event.kbd.keycode == Common::KEYCODE_LEFT) // Left
- _keyState = 1;
+ keyState = 1;
if (event.kbd.keycode == Common::KEYCODE_RIGHT) // Right
- _keyState |= 2;
+ keyState |= 2;
if (event.kbd.keycode == Common::KEYCODE_UP) // Up
- _keyState |= 4;
+ keyState |= 4;
if (event.kbd.keycode == Common::KEYCODE_DOWN) // Down
- _keyState |= 8;
+ keyState |= 8;
if (event.kbd.flags == Common::KBD_SHIFT)
- _keyState |= 16;
+ keyState |= 16;
if (event.kbd.flags == Common::KBD_CTRL)
- _keyState |= 32;
+ keyState |= 32;
- VAR(VAR_KEY_STATE) = _keyState;
+ VAR(VAR_KEY_STATE) = keyState;
}
// FIXME: There is a discrepancy between EVENT_KEYDOWN and EVENT_KEYUP here:
@@ -574,10 +564,15 @@
} else {
// FIXME: Possibly convert even more keycode/ascii pairs to their SCUMM counterparts?
- if (lastKeyHit.keycode >= Common::KEYCODE_F1 && lastKeyHit.keycode <= Common::KEYCODE_F9)
+ if (lastKeyHit.keycode >= Common::KEYCODE_F1 && lastKeyHit.keycode <= Common::KEYCODE_F9) {
_mouseAndKeyboardStat = lastKeyHit.keycode - Common::KEYCODE_F1 + 315;
- else
+ } else if (_game.id == GID_MONKEY2 && (lastKeyHit.flags & Common::KBD_ALT)) {
+ // Handle KBD_ALT combos in MI2. We know that the result must be 273 for Alt-W
+ // because that's what MI2 looks for in its "instant win" cheat.
+ _mouseAndKeyboardStat = lastKeyHit.keycode + 154;
+ } else {
_mouseAndKeyboardStat = lastKeyHit.ascii;
+ }
}
}
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