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.
This commit is contained in:
D G Turner 2012-04-20 21:50:26 +01:00
parent c5363006ed
commit c4b08c0b98

View File

@ -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