diff options
author | D G Turner | 2012-04-21 01:03:25 +0100 |
---|---|---|
committer | D G Turner | 2012-04-21 01:55:04 +0100 |
commit | f351a1d7ba28db0924e602e9ee9677edf4ac72f0 (patch) | |
tree | 39d8c90206306b27649577d1c56a55c3f899566d /engines | |
parent | c4b08c0b98331af3d92d3d2fce6b55b3b25adcc8 (diff) | |
download | scummvm-rg350-f351a1d7ba28db0924e602e9ee9677edf4ac72f0.tar.gz scummvm-rg350-f351a1d7ba28db0924e602e9ee9677edf4ac72f0.tar.bz2 scummvm-rg350-f351a1d7ba28db0924e602e9ee9677edf4ac72f0.zip |
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.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cruise/cruise_main.cpp | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 4f202ca4f6..fe113deebf 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; |