diff options
Diffstat (limited to 'engines/illusions/input.cpp')
-rw-r--r-- | engines/illusions/input.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/engines/illusions/input.cpp b/engines/illusions/input.cpp index 56ce27a353..21042dcc1c 100644 --- a/engines/illusions/input.cpp +++ b/engines/illusions/input.cpp @@ -81,6 +81,7 @@ uint InputEvent::handle(Common::KeyCode key, int mouseButton, bool down) { // Input const uint kAllButtons = 0xFFFF; +static const char kCheatCode[] = "gosanta"; Input::Input() { _buttonStates = 0; @@ -92,6 +93,7 @@ Input::Input() { _cursorPos.y = 0; _prevCursorPos.x = 0; _prevCursorPos.y = 0; + _cheatCodeIndex = 0; } void Input::processEvent(Common::Event event) { @@ -177,6 +179,14 @@ void Input::handleKey(Common::KeyCode key, int mouseButton, bool down) { _buttonStates |= _newKeys; _newKeys = 0; _newButtons = ~prevButtonStates & _buttonStates; + + if ( !down && !isCheatModeActive() ) { + if( _cheatCodeIndex < 7 && key == kCheatCode[_cheatCodeIndex] ) { + _cheatCodeIndex++; + } else { + _cheatCodeIndex = 0; + } + } } void Input::handleMouseButton(int mouseButton, bool down) { @@ -211,4 +221,8 @@ void Input::discardButtons(uint bitMask) { _buttonStates &= ~bitMask; } +bool Input::isCheatModeActive() { + return _cheatCodeIndex == 7; +} + } // End of namespace Illusions |