aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base
diff options
context:
space:
mode:
authorlolbot-iichan2019-06-03 11:14:11 +0300
committerFilippos Karapetis2019-06-25 08:10:16 +0300
commitb9af5ad30496cf04604189008e9efe2af1b9164b (patch)
tree095273aac4528ebfbe09db083bcbccbdb356d3fb /engines/wintermute/base
parent555e400d768004355a79e693e4b7e9258ac95c7a (diff)
downloadscummvm-rg350-b9af5ad30496cf04604189008e9efe2af1b9164b.tar.gz
scummvm-rg350-b9af5ad30496cf04604189008e9efe2af1b9164b.tar.bz2
scummvm-rg350-b9af5ad30496cf04604189008e9efe2af1b9164b.zip
WINTERMUTE: Fix IsKeyDown to work with ASCII
Tanya Grotter series has a cheat, that is triggered with (Keyboard.IsKeyDown("A") && Keyboard.IsControl && Keyboard.IsAlt && Game.DebugMode) condition. vKeyToKeyCode(97) would produce a warning message, fixed this.
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r--engines/wintermute/base/base_keyboard_state.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp
index e35e544918..e2803e3e7d 100644
--- a/engines/wintermute/base/base_keyboard_state.cpp
+++ b/engines/wintermute/base/base_keyboard_state.cpp
@@ -81,7 +81,7 @@ bool BaseKeyboardState::scCallMethod(ScScript *script, ScStack *stack, ScStack *
if (strcmp(name, "IsKeyDown") == 0) {
stack->correctParams(1);
ScValue *val = stack->pop();
- int vKey;
+ uint32 vKeyCode;
if (val->_type == VAL_STRING && strlen(val->getString()) > 0) {
const char *str = val->getString();
@@ -89,12 +89,12 @@ bool BaseKeyboardState::scCallMethod(ScScript *script, ScStack *stack, ScStack *
if (temp >= 'A' && temp <= 'Z') {
temp += ('a' - 'A');
}
- vKey = (int)temp;
+ vKeyCode = (int)temp;
} else {
- vKey = val->getInt();
+ vKeyCode = vKeyToKeyCode(val->getInt());
}
- bool isDown = _keyStates[vKeyToKeyCode(vKey)];
+ bool isDown = _keyStates[vKeyCode];
stack->pushBool(isDown);
return STATUS_OK;