[Scummvm-cvs-logs] SF.net SVN: scummvm:[47505] scummvm/trunk/engines/cine/various.cpp

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Sun Jan 24 18:46:37 CET 2010


Revision: 47505
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47505&view=rev
Author:   buddha_
Date:     2010-01-24 17:46:37 +0000 (Sun, 24 Jan 2010)

Log Message:
-----------
Cine: executePlayerInput: Combine mouse handling plus a few other things.

 - Combines mouse position and button state fetching
   from two branches (allowPlayerInput / !allowPlayerInput)
   into a single loop with a little more exotic while-clause.
   NOTE! Added manageEvents-call into the unified version although
   there was no manageEvents-call in one of the versions that was
   combined. Tested a little and didn't seem to matter, but hopefully
   won't cause any regressions!
 - Limit first possible 'renderer->setCommand(commandBuffer)' call
   to Future Wars only (Checked with FW & OS disassembly).
 - Combined all cases of 'left and right mouse buttons are down'
   into a single if-clause (All those cases call makeSystemMenu).

Modified Paths:
--------------
    scummvm/trunk/engines/cine/various.cpp

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2010-01-24 17:24:11 UTC (rev 47504)
+++ scummvm/trunk/engines/cine/various.cpp	2010-01-24 17:46:37 UTC (rev 47505)
@@ -838,6 +838,7 @@
 	uint16 mouseX, mouseY, mouseButton;
 	uint16 currentEntry = 0;
 	uint16 di = 0;
+	bool limitMouseCheckCount = false;
 
 	canUseOnObject = 0;
 
@@ -848,29 +849,36 @@
 	}
 
 	if (allowPlayerInput) { // Player input is allowed
-		if (isDrawCommandEnabled) {
+		if (g_cine->getGameType() == Cine::GType_FW && isDrawCommandEnabled) {
 			renderer->setCommand(commandBuffer);
-			isDrawCommandEnabled = 0;
 		}
+		isDrawCommandEnabled = 0;
+		limitMouseCheckCount = true;
+	}
 
+	// Get mouse position and button states
+	di = 0;
+	currentEntry = 0;
+	getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
+
+	while (mouseButton && (!limitMouseCheckCount || currentEntry < 200) && !g_cine->shouldQuit()) {
+		di |= (mouseButton & (kLeftMouseButton | kRightMouseButton));
+		manageEvents();
 		getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
+		currentEntry++;
+	}
 
-		while (mouseButton && currentEntry < 200) {
-			di |= (mouseButton & (kLeftMouseButton | kRightMouseButton));
-			getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
-			currentEntry++;
-		}
+	if (di) {
+		mouseButton = di;
+	}
 
-		if (di) {
-			mouseButton = di;
-		}
-
+	if ((mouseButton & kLeftMouseButton) && (mouseButton & kRightMouseButton)) {
+		// Left and right mouse buttons are down
+		g_cine->makeSystemMenu();
+	} else if (allowPlayerInput) { // Player input is allowed
 		if (playerCommand != -1) { // A player command is given
 			if (mouseButton & kLeftMouseButton) { // Left mouse button is down
-				if (mouseButton & kRightMouseButton) { // Right mouse button is down
-					// A player command is given, left and right mouse buttons are down
-					g_cine->makeSystemMenu();
-				} else { // Right mouse button is up
+				if (!(mouseButton & kRightMouseButton)) { // Right mouse button is up
 					// A player command is given, left mouse button is down, right mouse button is up
 					int16 si;
 					do {
@@ -953,9 +961,6 @@
 					}
 
 					makeCommandLine();
-				} else { // Left mouse button is down
-					// No player command is given, left and right mouse buttons are down
-					g_cine->makeSystemMenu();
 				}
 			} else { // Right mouse button is up
 				if (mouseButton & kLeftMouseButton) { // Left mouse button is down
@@ -985,24 +990,6 @@
 				}
 			}
 		}
-	} else { // Player input is not allowed
-		di = 0;
-		getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
-
-		while (mouseButton && !g_cine->shouldQuit()) {
-			di |= (mouseButton & (kLeftMouseButton | kRightMouseButton));
-			manageEvents();
-			getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
-		}
-
-		if (di) {
-			mouseButton = di;
-		}
-
-		if ((mouseButton & kLeftMouseButton) && (mouseButton & kRightMouseButton)) {
-			// Player input is not allowed, left and right mouse buttons are down
-			g_cine->makeSystemMenu();
-		}
 	}
 
 	var_2 = menuVar & 0x7F;


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