[Scummvm-cvs-logs] scummvm master -> a5745434d30f0039db0f5ca7b5ff6781b777d819

digitall digitall at scummvm.org
Sat Apr 21 02:57:07 CEST 2012


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c4b08c0b98 CRUISE: Move cursor update to upper "idle" loop in main function.
f351a1d7ba CRUISE: Modification to main loop to update cursor, even in FastMode.
a5745434d3 CRUISE: Fix update of background animations while waiting for user.


Commit: c4b08c0b98331af3d92d3d2fce6b55b3b25adcc8
    https://github.com/scummvm/scummvm/commit/c4b08c0b98331af3d92d3d2fce6b55b3b25adcc8
Author: D G Turner (digitall at scummvm.org)
Date: 2012-04-20T17:55:03-07:00

Commit Message:
CRUISE: Move cursor update to upper "idle" loop in main function.

This is the first part of the patch supplied by Ignaz Forster on
bug #3423955 ("CRUISE: Slow / unresponsive game behaviour") for
avoiding blocking graphical updates during user wait loops.

Hotspots passed during the idle loop do _not_ give any user feedback
without this patch.

The original patch has been split to allow for better understanding of
the changes and to allow fine grained bisection if this introduces any
regressions.

Changed paths:
    engines/cruise/cruise_main.cpp



diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 6e2847d..4f202ca 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -1804,6 +1804,38 @@ void CruiseEngine::mainLoop() {
 			bool skipEvents = false;
 
 			do {
+				if (userEnabled && !userWait && !autoTrack) {
+					if (currentActiveMenu == -1) {
+						static int16 oldMouseX = -1;
+						static int16 oldMouseY = -1;
+
+						getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
+
+						if (mouseX != oldMouseX || mouseY != oldMouseY) {
+							int objectType;
+							int newCursor1;
+							int newCursor2;
+
+							oldMouseX = mouseX;
+							oldMouseY = mouseY;
+
+							objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2);
+
+							if (objectType == 9) {
+								changeCursor(CURSOR_EXIT);
+							} else if (objectType != -1) {
+								changeCursor(CURSOR_MAGNIFYING_GLASS);
+							} else {
+								changeCursor(CURSOR_WALK);
+							}
+						}
+					} else {
+						changeCursor(CURSOR_NORMAL);
+					}
+				} else {
+					changeCursor(CURSOR_NORMAL);
+				}
+
 				g_system->updateScreen();
 
 				g_system->delayMillis(10);
@@ -1918,38 +1950,6 @@ void CruiseEngine::mainLoop() {
 			mainDraw(userWait);
 			flipScreen();
 
-			if (userEnabled && !userWait && !autoTrack) {
-				if (currentActiveMenu == -1) {
-					static int16 oldMouseX = -1;
-					static int16 oldMouseY = -1;
-
-					getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
-
-					if (mouseX != oldMouseX || mouseY != oldMouseY) {
-						int objectType;
-						int newCursor1;
-						int newCursor2;
-
-						oldMouseX = mouseX;
-						oldMouseY = mouseY;
-
-						objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2);
-
-						if (objectType == 9) {
-							changeCursor(CURSOR_EXIT);
-						} else if (objectType != -1) {
-							changeCursor(CURSOR_MAGNIFYING_GLASS);
-						} else {
-							changeCursor(CURSOR_WALK);
-						}
-					}
-				} else {
-					changeCursor(CURSOR_NORMAL);
-				}
-			} else {
-				changeCursor(CURSOR_NORMAL);
-			}
-
 			if (userWait == 1) {
 				// Waiting for press - original wait loop has been integrated into the
 				// main event loop


Commit: f351a1d7ba28db0924e602e9ee9677edf4ac72f0
    https://github.com/scummvm/scummvm/commit/f351a1d7ba28db0924e602e9ee9677edf4ac72f0
Author: D G Turner (digitall at scummvm.org)
Date: 2012-04-20T17:55:04-07:00

Commit Message:
CRUISE: Modification to main loop to update cursor, even in FastMode.

This is the second part of the patch supplied by Ignaz Forster on
bug #3423955 ("CRUISE: Slow / unresponsive game behaviour") for
avoiding blocking graphical updates during user wait loops.

This removes the check for fastMode from the cursor update code and
other code in this "idle" loop, and moves it down to qualifying
only a few of the function calls.

Changed paths:
    engines/cruise/cruise_main.cpp



diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 4f202ca..fe113de 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -1799,64 +1799,60 @@ void CruiseEngine::mainLoop() {
 		// Handle frame delay
 		uint32 currentTick = g_system->getMillis();
 
-		if (!bFastMode) {
-			// Delay for the specified amount of time, but still respond to events
-			bool skipEvents = false;
+		// Delay for the specified amount of time, but still respond to events
+		bool skipEvents = false;
 
-			do {
-				if (userEnabled && !userWait && !autoTrack) {
-					if (currentActiveMenu == -1) {
-						static int16 oldMouseX = -1;
-						static int16 oldMouseY = -1;
+		do {
+			if (userEnabled && !userWait && !autoTrack) {
+				if (currentActiveMenu == -1) {
+					static int16 oldMouseX = -1;
+					static int16 oldMouseY = -1;
 
-						getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
+					getMouseStatus(&main10, &mouseX, &mouseButton, &mouseY);
 
-						if (mouseX != oldMouseX || mouseY != oldMouseY) {
-							int objectType;
-							int newCursor1;
-							int newCursor2;
+					if (mouseX != oldMouseX || mouseY != oldMouseY) {
+						int objectType;
+						int newCursor1;
+						int newCursor2;
 
-							oldMouseX = mouseX;
-							oldMouseY = mouseY;
+						oldMouseX = mouseX;
+						oldMouseY = mouseY;
 
-							objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2);
+						objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2);
 
-							if (objectType == 9) {
-								changeCursor(CURSOR_EXIT);
-							} else if (objectType != -1) {
-								changeCursor(CURSOR_MAGNIFYING_GLASS);
-							} else {
-								changeCursor(CURSOR_WALK);
-							}
+						if (objectType == 9) {
+							changeCursor(CURSOR_EXIT);
+						} else if (objectType != -1) {
+							changeCursor(CURSOR_MAGNIFYING_GLASS);
+						} else {
+							changeCursor(CURSOR_WALK);
 						}
-					} else {
-						changeCursor(CURSOR_NORMAL);
 					}
 				} else {
 					changeCursor(CURSOR_NORMAL);
 				}
+			} else {
+				changeCursor(CURSOR_NORMAL);
+			}
+
+			g_system->updateScreen();
 
-				g_system->updateScreen();
+			if (!skipEvents || bFastMode)
+				skipEvents = manageEvents();
 
+			if (bFastMode) {
+				if (currentTick >= (lastTickDebug + 10))
+					lastTickDebug = currentTick;
+			} else {
 				g_system->delayMillis(10);
 				currentTick = g_system->getMillis();
+			}
 
-				if (!skipEvents)
-					skipEvents = manageEvents();
-
-				if (playerDontAskQuit)
-					break;
-
-				_vm->getDebugger()->onFrame();
-			} while (currentTick < lastTick + _gameSpeed);
-		} else {
-			manageEvents();
+			if (playerDontAskQuit)
+				break;
 
-			if (currentTick >= (lastTickDebug + 10)) {
-				lastTickDebug = currentTick;
-				_vm->getDebugger()->onFrame();
-			}
-		}
+			_vm->getDebugger()->onFrame();
+		} while (currentTick < lastTick + _gameSpeed && !bFastMode);
 		if (playerDontAskQuit)
 			break;
 


Commit: a5745434d30f0039db0f5ca7b5ff6781b777d819
    https://github.com/scummvm/scummvm/commit/a5745434d30f0039db0f5ca7b5ff6781b777d819
Author: D G Turner (digitall at scummvm.org)
Date: 2012-04-20T17:55:05-07:00

Commit Message:
CRUISE: Fix update of background animations while waiting for user.

This is the third and final part of the patch supplied by Ignaz Forster
on bug #3423955 ("CRUISE: Slow / unresponsive game behaviour") for
avoiding blocking graphical updates during user wait loops.

The removal of the continue statement fixes the update of background
animations while waiting for user to respond i.e. try opening a locked
door on the upper deck of the boat and check the sea background
animation, but it also has the side effect of allowing hotspots to
respond during this period if the user clicks fast enough.

However, this bug was also present in the original interpreter, and
a workaround has been added to inhibit this.

Changed paths:
    engines/cruise/cruise_main.cpp



diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index fe113de..911041c 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -1872,6 +1872,14 @@ void CruiseEngine::mainLoop() {
 //      readKeyboard();
 
 		bool isUserWait = userWait != 0;
+		// WORKAROUND: This prevents hotspots responding during
+		// delays i.e. Menu opening if you click fast on another
+		// hotspot after trying to open a locked door, which
+		// occurred with the original interpreter.
+		if (userDelay) {
+			currentMouseButton = 0;
+		}
+
 		playerDontAskQuit = processInput();
 		if (playerDontAskQuit)
 			break;
@@ -1883,7 +1891,6 @@ void CruiseEngine::mainLoop() {
 
 		if (userDelay && !userWait) {
 			userDelay--;
-			continue;
 		}
 
 		if (isUserWait & !userWait) {






More information about the Scummvm-git-logs mailing list