aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2009-05-31 10:14:41 +0000
committerPaul Gilbert2009-05-31 10:14:41 +0000
commitf94025f482ae9231dad845fcaeb9f08a5ad37746 (patch)
tree88ca520f9e64a0e6fcfe2a0cea06dd843fe3af64 /engines
parentcb09622c5a820d4b624705b2728df0e0f3176acd (diff)
downloadscummvm-rg350-f94025f482ae9231dad845fcaeb9f08a5ad37746.tar.gz
scummvm-rg350-f94025f482ae9231dad845fcaeb9f08a5ad37746.tar.bz2
scummvm-rg350-f94025f482ae9231dad845fcaeb9f08a5ad37746.zip
Merged the wait for mouse press event loop into the main loop, fixing animation glitch and enabling pausing, player menu, and exiting the game when waiting for a mouse press
svn-id: r41063
Diffstat (limited to 'engines')
-rw-r--r--engines/cruise/cruise_main.cpp59
1 files changed, 35 insertions, 24 deletions
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 891e4bc4e7..752c8ded50 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -1298,18 +1298,11 @@ int processInput(void) {
buttonDown = 0;
}
- if (userDelay) {
+ if (userDelay && !userWait) {
userDelay--;
return 0;
}
- // Player Menu - test for both buttons or the F10 key
- if (((button & MB_BOTH) == MB_BOTH) || (keyboardCode == Common::KEYCODE_F10)) {
- changeCursor(CURSOR_NORMAL);
- keyboardCode = Common::KEYCODE_INVALID;
- return (playerMenu(mouseX, mouseY));
- }
-
// Check for Exit 'X' key
if (keyboardCode == Common::KEYCODE_x)
return 1;
@@ -1344,6 +1337,20 @@ int processInput(void) {
return 0;
}
+ // Player Menu - test for both buttons or the F10 key
+ if (((button & MB_BOTH) == MB_BOTH) || (keyboardCode == Common::KEYCODE_F10)) {
+ changeCursor(CURSOR_NORMAL);
+ keyboardCode = Common::KEYCODE_INVALID;
+ return (playerMenu(mouseX, mouseY));
+ }
+
+ if (userWait) {
+ // Check for left mouse button click or Space to end user waiting
+ if ((keyboardCode == Common::KEYCODE_SPACE) || (button == MB_LEFT))
+ userWait = 0;
+ return 0;
+ }
+
if (!userEnabled) {
return 0;
}
@@ -1759,10 +1766,18 @@ void CruiseEngine::mainLoop(void) {
// t_start=Osystem_GetTicks();
// readKeyboard();
+ bool isUserWait = userWait != 0;
+
playerDontAskQuit = processInput();
if (playerDontAskQuit)
break;
+ if (isUserWait && !userWait) {
+ // User waiting has ended
+ changeScriptParamInList(-1, -1, &procHead, 9999, 0);
+ changeScriptParamInList(-1, -1, &relHead, 9999, 0);
+ }
+
if (enableUser) {
userEnabled = 1;
enableUser = 0;
@@ -1799,7 +1814,7 @@ void CruiseEngine::mainLoop(void) {
PCFadeFlag = 0;
/*if (!PCFadeFlag)*/
- {
+ if (userWait != 2) {
mainDraw(0);
flipScreen();
}
@@ -1840,11 +1855,16 @@ void CruiseEngine::mainLoop(void) {
changeCursor(CURSOR_NORMAL);
}
- if (userWait) {
- int16 mouseButton = 0;
- checkInput(&mouseButton);
+ if (isUserWait) {
+ // User Wait handling
+ if (userWait == 1) {
+ // Initial step
+ ++userWait;
+ mainDraw(0);
+ flipScreen();
+ } else {
+ // Standard handling
- while (!mouseButton) {
manageScripts(&relHead);
manageScripts(&procHead);
@@ -1853,18 +1873,9 @@ void CruiseEngine::mainLoop(void) {
// Draw the next screen
processAnimation();
- mainDraw(0);
- flipScreen();
-
- // not exactly this
- manageEvents();
-
- checkInput(&mouseButton);
+ gfxModuleData_flipScreen();
}
-
- changeScriptParamInList(-1, -1, &procHead, 9999, 0);
- changeScriptParamInList(-1, -1, &relHead, 9999, 0);
- userWait = 0;
+ continue;
}
// wait for character to finish auto track