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

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Sun Jan 24 17:40:37 CET 2010


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

Log Message:
-----------
Cine: Document branches in executePlayerInput and remove dead code (if-clauses that are always true or always false).

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

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2010-01-24 16:25:08 UTC (rev 47502)
+++ scummvm/trunk/engines/cine/various.cpp	2010-01-24 16:40:37 UTC (rev 47503)
@@ -847,7 +847,7 @@
 		isInPause = 0;
 	}
 
-	if (allowPlayerInput) {
+	if (allowPlayerInput) { // Player input is allowed
 		if (isDrawCommandEnabled) {
 			renderer->setCommand(commandBuffer);
 			isDrawCommandEnabled = 0;
@@ -865,11 +865,13 @@
 			mouseButton = di;
 		}
 
-		if (playerCommand != -1) {
-			if (mouseButton & kLeftMouseButton) {
-				if (mouseButton & kRightMouseButton) {
+		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 {
+				} else { // Right mouse button is up
+					// A player command is given, left mouse button is down, right mouse button is up
 					int16 si;
 					do {
 						manageEvents();
@@ -915,14 +917,12 @@
 						globalVars[VAR_MOUSE_Y_POS] = mouseY;
 					}
 				}
-			} else if (mouseButton & kRightMouseButton) {
-				if (mouseButton & kLeftMouseButton) {
-					g_cine->makeSystemMenu();
-				}
-
+			} else if (mouseButton & kRightMouseButton) { // Right mouse button is down
+				// A player command is given, left mouse button is up, right mouse button is down
 				makeActionMenu();
 				makeCommandLine();
-			} else {
+			} else { // Left and right mouse buttons are up
+				// A player command is given, left and right mouse buttons are up
 				int16 objIdx;
 
 				objIdx = getObjectUnderCursor(mouseX, mouseY);
@@ -937,9 +937,10 @@
 
 				commandVar2 = objIdx;
 			}
-		} else {
-			if (mouseButton & kRightMouseButton) {
-				if (!(mouseButton & kLeftMouseButton)) {
+		} else { // No player command is given
+			if (mouseButton & kRightMouseButton) { // Right mouse button is down
+				if (!(mouseButton & kLeftMouseButton)) { // Left mouse button is up
+					// No player command is given, left mouse button is up, right mouse button is down
 					if (g_cine->getGameType() == Cine::GType_OS) {
 						playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70, true);
 
@@ -952,41 +953,39 @@
 					}
 
 					makeCommandLine();
-				} else {
+				} else { // Left mouse button is down
+					// No player command is given, left and right mouse buttons are down
 					g_cine->makeSystemMenu();
 				}
-			} else {
-				if (mouseButton & kLeftMouseButton) {
-					if (!(mouseButton & kRightMouseButton)) {
-						int16 objIdx;
-						int16 relEntry;
+			} else { // Right mouse button is up
+				if (mouseButton & kLeftMouseButton) { // Left mouse button is down
+					// No player command is given, left mouse button is down, right mouse button is up
+					int16 objIdx;
+					int16 relEntry;
 
-						globalVars[VAR_MOUSE_X_POS] = mouseX;
-						if (!mouseX) {
-							globalVars[VAR_MOUSE_X_POS]++;
-						}
+					globalVars[VAR_MOUSE_X_POS] = mouseX;
+					if (!mouseX) {
+						globalVars[VAR_MOUSE_X_POS]++;
+					}
 
-						globalVars[VAR_MOUSE_Y_POS] = mouseY;
+					globalVars[VAR_MOUSE_Y_POS] = mouseY;
 
-						objIdx = getObjectUnderCursor(mouseX, mouseY);
+					objIdx = getObjectUnderCursor(mouseX, mouseY);
 
-						if (objIdx != -1) {
-							currentSelectedObject.idx = objIdx;
-							currentSelectedObject.param = -1;
+					if (objIdx != -1) {
+						currentSelectedObject.idx = objIdx;
+						currentSelectedObject.param = -1;
 
-							relEntry = getRelEntryForObject(6, 1, &currentSelectedObject);
+						relEntry = getRelEntryForObject(6, 1, &currentSelectedObject);
 
-							if (relEntry != -1) {
-								runObjectScript(relEntry);
-							}
+						if (relEntry != -1) {
+							runObjectScript(relEntry);
 						}
-					} else {
-						g_cine->makeSystemMenu();
 					}
 				}
 			}
 		}
-	} else {
+	} else { // Player input is not allowed
 		di = 0;
 		getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
 
@@ -1001,6 +1000,7 @@
 		}
 
 		if ((mouseButton & kLeftMouseButton) && (mouseButton & kRightMouseButton)) {
+			// Player input is not allowed, left and right mouse buttons are down
 			g_cine->makeSystemMenu();
 		}
 	}


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