diff options
| author | Max Horn | 2010-10-27 15:53:53 +0000 | 
|---|---|---|
| committer | Max Horn | 2010-10-27 15:53:53 +0000 | 
| commit | aaf7ffdd5c160447cfa56468bf0a8c768d14ad5d (patch) | |
| tree | 44b633b4881fb5aafe289eb52a1a7ae09baf2ab7 | |
| parent | 95353b0e60a8acaec28bd0e348b8f1c76d92cabf (diff) | |
| download | scummvm-rg350-aaf7ffdd5c160447cfa56468bf0a8c768d14ad5d.tar.gz scummvm-rg350-aaf7ffdd5c160447cfa56468bf0a8c768d14ad5d.tar.bz2 scummvm-rg350-aaf7ffdd5c160447cfa56468bf0a8c768d14ad5d.zip  | |
SWORD25: Fix keyboard state handling
Previously, you could get the game into a state where it would think a
key was constantly being pressed. E.g. by pressing 'p' several times
quickly in a row, the game would end in a state where it endlessly
toggled between pause mode and regular mode.
svn-id: r53878
| -rw-r--r-- | engines/sword25/input/inputengine.cpp | 7 | 
1 files changed, 7 insertions, 0 deletions
diff --git a/engines/sword25/input/inputengine.cpp b/engines/sword25/input/inputengine.cpp index a85096bc2f..0226458f5f 100644 --- a/engines/sword25/input/inputengine.cpp +++ b/engines/sword25/input/inputengine.cpp @@ -87,7 +87,14 @@ bool InputEngine::init() {  void InputEngine::update() {  	Common::Event event; + +	// We keep two sets of keyboard states: The current one, and that of +	// the previous frame. This allows us to detect which keys changed +	// state. Also, by keeping a single central keystate array, we +	// ensure that all script queries for key state during a single +	// frame get the same consistent replies.  	_currentState ^= 1; +	memcpy(_keyboardState[_currentState], _keyboardState[_currentState ^ 1], sizeof(_keyboardState[0]));  	// Loop through processing any pending events  	bool handleEvents = true;  | 
