[Scummvm-cvs-logs] SF.net SVN: scummvm:[53878] scummvm/trunk/engines/sword25/input/inputengine .cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Oct 27 17:53:53 CEST 2010


Revision: 53878
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53878&view=rev
Author:   fingolfin
Date:     2010-10-27 15:53:53 +0000 (Wed, 27 Oct 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/input/inputengine.cpp

Modified: scummvm/trunk/engines/sword25/input/inputengine.cpp
===================================================================
--- scummvm/trunk/engines/sword25/input/inputengine.cpp	2010-10-27 15:53:36 UTC (rev 53877)
+++ scummvm/trunk/engines/sword25/input/inputengine.cpp	2010-10-27 15:53:53 UTC (rev 53878)
@@ -87,7 +87,14 @@
 
 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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list