From b9af5ad30496cf04604189008e9efe2af1b9164b Mon Sep 17 00:00:00 2001 From: lolbot-iichan Date: Mon, 3 Jun 2019 11:14:11 +0300 Subject: 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. --- engines/wintermute/base/base_keyboard_state.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/wintermute/base') 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; -- cgit v1.2.3