[Scummvm-cvs-logs] SF.net SVN: scummvm:[44525] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Thu Oct 1 18:47:35 CEST 2009


Revision: 44525
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44525&view=rev
Author:   spalek
Date:     2009-10-01 16:47:34 +0000 (Thu, 01 Oct 2009)

Log Message:
-----------
Fixed event handling.  ValGrind fixups.

My yesterday's fix on handling 1 event per call caused the game to be
unbearably slow on Linux.  The old way was much faster.  I have solved too
fast a succession of mouse button down and up by not clearing the mouse flag
when the button goes up instead.

Fixed a memory leak and uninitialized variable after my refactoring of game
location changes; found by ValGrind.

Modified Paths:
--------------
    scummvm/trunk/engines/draci/draci.cpp
    scummvm/trunk/engines/draci/game.cpp
    scummvm/trunk/engines/draci/mouse.cpp

Modified: scummvm/trunk/engines/draci/draci.cpp
===================================================================
--- scummvm/trunk/engines/draci/draci.cpp	2009-10-01 15:58:15 UTC (rev 44524)
+++ scummvm/trunk/engines/draci/draci.cpp	2009-10-01 16:47:34 UTC (rev 44525)
@@ -224,12 +224,6 @@
 		default:
 			_mouse->handleEvent(event);
 		}
-
-		// TODO: I place the break here to make sure that each event is
-		// processed.  If I don't do that and allow more than 1 event,
-		// then a very quick succession of mouse button down and up
-		// (occuring on a touchpad) cancels each other.
-		break;
 	}
 
 	// Show walking map overlay

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-10-01 15:58:15 UTC (rev 44524)
+++ scummvm/trunk/engines/draci/game.cpp	2009-10-01 16:47:34 UTC (rev 44525)
@@ -157,6 +157,8 @@
 	_shouldQuit = false;
 	_shouldExitLoop = false;
 	_scheduledPalette = 0;
+	setLoopStatus(kStatusGate);
+	setLoopSubstatus(kSubstatusOrdinary);
 
 	_animUnderCursor = kOverlayImage;
 
@@ -851,8 +853,7 @@
 		_vm->_anims->stop(_dialogueAnims[i]->getID());
 	}
 
-	_dialogueArchive->closeArchive();
-
+	delete _dialogueArchive;
 	delete[] _dialogueBlocks;
 
 	setLoopStatus(kStatusOrdinary);
@@ -1286,6 +1287,10 @@
 	  	_persons[kDragonObject]._y = 0;
 	}
 
+	// Set the appropriate loop statu before loading the room
+	setLoopStatus(kStatusGate);
+	setLoopSubstatus(kSubstatusOrdinary);
+
 	loadRoom(_newRoom);
 	loadOverlays();
 
@@ -1309,10 +1314,6 @@
 void Game::runGateProgram(int gate) {
 	debugC(6, kDraciLogicDebugLevel, "Running program for gate %d", gate);
 
-	// Set the appropriate loop statu before executing the gate program
-	setLoopStatus(kStatusGate);
-	setLoopSubstatus(kSubstatusOrdinary);
-
 	// Mark last animation
 	int lastAnimIndex = _vm->_anims->getLastIndex();
 

Modified: scummvm/trunk/engines/draci/mouse.cpp
===================================================================
--- scummvm/trunk/engines/draci/mouse.cpp	2009-10-01 15:58:15 UTC (rev 44524)
+++ scummvm/trunk/engines/draci/mouse.cpp	2009-10-01 16:47:34 UTC (rev 44525)
@@ -47,7 +47,10 @@
 
 	case Common::EVENT_LBUTTONUP:
 		debugC(6, kDraciGeneralDebugLevel, "Left button up (x: %u y: %u)", _x, _y);
-		_lButton = false;
+                // Don't set _lButton to false, because some touchpads generate
+                // down and up at such a quick succession, that they will
+                // cancel each other in the same call of handleEvents().  Let
+                // the game clear this flag by calling lButtonSet() instead.
 		break;
 
 	case Common::EVENT_RBUTTONDOWN:
@@ -57,7 +60,6 @@
 
 	case Common::EVENT_RBUTTONUP:
 		debugC(6, kDraciGeneralDebugLevel, "Right button up (x: %u y: %u)", _x, _y);
-		_rButton = false;
 		break;
 
 	case Common::EVENT_MOUSEMOVE:


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