aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sword25/input/inputengine.cpp3
-rw-r--r--engines/sword25/input/inputengine.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/engines/sword25/input/inputengine.cpp b/engines/sword25/input/inputengine.cpp
index 5d996d7f54..a85096bc2f 100644
--- a/engines/sword25/input/inputengine.cpp
+++ b/engines/sword25/input/inputengine.cpp
@@ -169,6 +169,7 @@ void InputEngine::testForLeftDoubleClick() {
}
void InputEngine::alterKeyboardState(int keycode, byte newState) {
+ assert(keycode < ARRAYSIZE(_keyboardState[_currentState]));
_keyboardState[_currentState][keycode] = newState;
}
@@ -193,10 +194,12 @@ int InputEngine::getMouseY() {
}
bool InputEngine::isKeyDown(uint keyCode) {
+ assert(keyCode < ARRAYSIZE(_keyboardState[_currentState]));
return (_keyboardState[_currentState][keyCode] & 0x80) != 0;
}
bool InputEngine::wasKeyDown(uint keyCode) {
+ assert(keyCode < ARRAYSIZE(_keyboardState[_currentState]));
return ((_keyboardState[_currentState][keyCode] & 0x80) == 0) &&
((_keyboardState[_currentState ^ 1][keyCode] & 0x80) != 0);
}
diff --git a/engines/sword25/input/inputengine.h b/engines/sword25/input/inputengine.h
index 20bea21a72..1734a19567 100644
--- a/engines/sword25/input/inputengine.h
+++ b/engines/sword25/input/inputengine.h
@@ -309,7 +309,7 @@ private:
void testForLeftDoubleClick();
void alterKeyboardState(int keycode, byte newState);
- byte _keyboardState[2][256];
+ byte _keyboardState[2][512];
bool _leftMouseState[2];
bool _rightMouseState[2];
uint _currentState;