Cleanup of input wait functions and looped AnyButtonPress() uses
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3343 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+1
-2
@@ -678,8 +678,7 @@ DoTalkSegue (COUNT wait_track)
|
|||||||
static void
|
static void
|
||||||
FlushTalkSegue (void)
|
FlushTalkSegue (void)
|
||||||
{
|
{
|
||||||
WaitForNoInput (ONE_SECOND / 2);
|
WaitForNoInput (ONE_SECOND / 2, TRUE);
|
||||||
FlushInput ();
|
|
||||||
|
|
||||||
// Wait until the animation task stops "talking"
|
// Wait until the animation task stops "talking"
|
||||||
do
|
do
|
||||||
|
|||||||
+10
-3
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "libs/compiler.h"
|
#include "libs/compiler.h"
|
||||||
#include "libs/strlib.h"
|
#include "libs/strlib.h"
|
||||||
|
#include "libs/timelib.h"
|
||||||
|
|
||||||
// Enumerated type for controls
|
// Enumerated type for controls
|
||||||
enum {
|
enum {
|
||||||
@@ -102,9 +102,16 @@ void ResetKeyRepeat (void);
|
|||||||
BOOLEAN PauseGame (void);
|
BOOLEAN PauseGame (void);
|
||||||
void SleepGame (void);
|
void SleepGame (void);
|
||||||
BOOLEAN DoConfirmExit (void);
|
BOOLEAN DoConfirmExit (void);
|
||||||
BOOLEAN WaitAnyButtonOrQuit (BOOLEAN CheckSpecial);
|
|
||||||
void WaitForNoInput (SIZE Duration);
|
|
||||||
BOOLEAN ConfirmExit (void);
|
BOOLEAN ConfirmExit (void);
|
||||||
|
|
||||||
|
#define WAIT_INFINITE ((TimePeriod)-1)
|
||||||
|
BOOLEAN WaitForAnyButton (BOOLEAN newButton, TimePeriod duration,
|
||||||
|
BOOLEAN resetInput);
|
||||||
|
BOOLEAN WaitForAnyButtonUntil (BOOLEAN newButton, TimeCount timeOut,
|
||||||
|
BOOLEAN resetInput);
|
||||||
|
BOOLEAN WaitForNoInput (TimePeriod duration, BOOLEAN resetInput);
|
||||||
|
BOOLEAN WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput);
|
||||||
|
|
||||||
void DoPopupWindow(const char *msg);
|
void DoPopupWindow(const char *msg);
|
||||||
void DoInput (void *pInputState, BOOLEAN resetInput);
|
void DoInput (void *pInputState, BOOLEAN resetInput);
|
||||||
|
|
||||||
|
|||||||
+3
-12
@@ -437,7 +437,6 @@ UninitEncounter (void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
BOOLEAN Sleepy;
|
BOOLEAN Sleepy;
|
||||||
DWORD Time;
|
|
||||||
SIZE VictoryState;
|
SIZE VictoryState;
|
||||||
COUNT RecycleAmount = 0;
|
COUNT RecycleAmount = 0;
|
||||||
SIZE i;
|
SIZE i;
|
||||||
@@ -625,7 +624,7 @@ UninitEncounter (void)
|
|||||||
|
|
||||||
if (Sleepy)
|
if (Sleepy)
|
||||||
{
|
{
|
||||||
Time = GetTimeCounter ();
|
TimeCount Time = GetTimeCounter ();
|
||||||
for (j = 0; j < NUM_SHIP_FADES; ++j)
|
for (j = 0; j < NUM_SHIP_FADES; ++j)
|
||||||
{
|
{
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
@@ -664,12 +663,8 @@ UninitEncounter (void)
|
|||||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||||
#endif /* NEVER */
|
#endif /* NEVER */
|
||||||
|
|
||||||
FlushInput ();
|
|
||||||
Time = GetTimeCounter () + (ONE_SECOND * 3);
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
// TODO: handle rapid quit
|
WaitForAnyButton (TRUE, ONE_SECOND * 3, FALSE);
|
||||||
while (!(AnyButtonPress (TRUE)) && GetTimeCounter () < Time)
|
|
||||||
TaskSwitch ();
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
||||||
{
|
{
|
||||||
@@ -696,12 +691,8 @@ UninitEncounter (void)
|
|||||||
str2 = GAME_STRING (ENCOUNTER_STRING_BASE + 7);
|
str2 = GAME_STRING (ENCOUNTER_STRING_BASE + 7);
|
||||||
// "Scavenged"
|
// "Scavenged"
|
||||||
DrawFadeText (str1, str2, TRUE, &scavenge_r);
|
DrawFadeText (str1, str2, TRUE, &scavenge_r);
|
||||||
Time = GetTimeCounter () + ONE_SECOND * 2;
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
// TODO: handle rapid quit
|
WaitForAnyButton (TRUE, ONE_SECOND * 2, FALSE);
|
||||||
while (!(AnyButtonPress (TRUE))
|
|
||||||
&& GetTimeCounter () < Time)
|
|
||||||
TaskSwitch ();
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
if (!CurrentInputState.key[PlayerControls[0]][KEY_ESCAPE])
|
||||||
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
DrawFadeText (str1, str2, FALSE, &scavenge_r);
|
||||||
|
|||||||
+1
-8
@@ -87,7 +87,6 @@ SplashScreen (void (* DoProcessing)(DWORD TimeOut))
|
|||||||
BYTE xform_buf[1];
|
BYTE xform_buf[1];
|
||||||
STAMP s;
|
STAMP s;
|
||||||
DWORD TimeOut;
|
DWORD TimeOut;
|
||||||
BOOLEAN InputState;
|
|
||||||
|
|
||||||
xform_buf[0] = FadeAllToBlack;
|
xform_buf[0] = FadeAllToBlack;
|
||||||
SleepThreadUntil (XFormColorMap (
|
SleepThreadUntil (XFormColorMap (
|
||||||
@@ -117,13 +116,7 @@ SplashScreen (void (* DoProcessing)(DWORD TimeOut))
|
|||||||
* with the proper operation of the quit operation.
|
* with the proper operation of the quit operation.
|
||||||
* --Michael */
|
* --Michael */
|
||||||
|
|
||||||
TimeOut += ONE_SECOND * 3;
|
WaitForAnyButton (FALSE, ONE_SECOND * 3, TRUE);
|
||||||
while (!(InputState = AnyButtonPress (FALSE)) &&
|
|
||||||
(GetTimeCounter () <= TimeOut) &&
|
|
||||||
!(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
|
||||||
{
|
|
||||||
TaskSwitch ();
|
|
||||||
}
|
|
||||||
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
+1
-1
@@ -1634,7 +1634,7 @@ UnbatchGraphics ();
|
|||||||
{
|
{
|
||||||
ClearSISRect (CLEAR_SIS_RADAR);
|
ClearSISRect (CLEAR_SIS_RADAR);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
WaitForNoInput (ONE_SECOND / 2);
|
WaitForNoInput (ONE_SECOND / 2, FALSE);
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
word_chars = utf8StringCountN (t.pStr, pStr);
|
word_chars = utf8StringCountN (t.pStr, pStr);
|
||||||
if ((col_cells += word_chars) <= NUM_CELL_COLS)
|
if ((col_cells += word_chars) <= NUM_CELL_COLS)
|
||||||
{
|
{
|
||||||
DWORD TimeOut;
|
TimeCount TimeOut;
|
||||||
|
|
||||||
if (StrLen -= word_chars)
|
if (StrLen -= word_chars)
|
||||||
--StrLen;
|
--StrLen;
|
||||||
@@ -181,22 +181,12 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
if (word_chars == 0)
|
if (word_chars == 0)
|
||||||
TimeOut += ONE_SECOND / 20;
|
TimeOut += ONE_SECOND / 20;
|
||||||
|
|
||||||
TaskSwitch ();
|
if (WaitForAnyButtonUntil (TRUE, TimeOut, FALSE))
|
||||||
while (GetTimeCounter () < TimeOut)
|
|
||||||
{
|
|
||||||
if (ButtonState)
|
|
||||||
{
|
|
||||||
if (!AnyButtonPress (TRUE))
|
|
||||||
ButtonState = 0;
|
|
||||||
}
|
|
||||||
else if (AnyButtonPress (TRUE))
|
|
||||||
{
|
{
|
||||||
Sleepy = FALSE;
|
Sleepy = FALSE;
|
||||||
|
// We draw the whole thing at once after this
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
break;
|
|
||||||
}
|
|
||||||
TaskSwitch();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.pStr = pNextStr;
|
t.pStr = pNextStr;
|
||||||
@@ -219,7 +209,7 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen)
|
|||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitAnyButtonOrQuit (TRUE))
|
if (!WaitForAnyButton (TRUE, WAIT_INFINITE, FALSE))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
InitPageCell:
|
InitPageCell:
|
||||||
@@ -289,9 +279,7 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
|||||||
DestroyContext (context);
|
DestroyContext (context);
|
||||||
|
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
FlushInput ();
|
WaitForNoInput (WAIT_INFINITE, TRUE);
|
||||||
while (AnyButtonPress (TRUE))
|
|
||||||
TaskSwitch ();
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+27
-26
@@ -928,7 +928,10 @@ callGenerateForScanType (SOLARSYS_STATE *solarSys, PLANET_DESC *world,
|
|||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
DoScan (MENU_STATE *pMS)
|
DoScan (MENU_STATE *pMS)
|
||||||
{
|
{
|
||||||
DWORD TimeIn, WaitTime;
|
#define SCAN_DURATION (ONE_SECOND * 7 / 4)
|
||||||
|
// NUM_FLASH_COLORS for flashing blips; 1 for the final frame
|
||||||
|
#define SCAN_LINES (MAP_HEIGHT + NUM_FLASH_COLORS + 1)
|
||||||
|
#define SCAN_LINE_WAIT (SCAN_DURATION / SCAN_LINES)
|
||||||
BOOLEAN select, cancel;
|
BOOLEAN select, cancel;
|
||||||
|
|
||||||
select = PulsedInputState.menu[KEY_MENU_SELECT];
|
select = PulsedInputState.menu[KEY_MENU_SELECT];
|
||||||
@@ -959,7 +962,6 @@ DoScan (MENU_STATE *pMS)
|
|||||||
{
|
{
|
||||||
BYTE min_scan, max_scan;
|
BYTE min_scan, max_scan;
|
||||||
RECT r;
|
RECT r;
|
||||||
BOOLEAN PressState, ButtonState;
|
|
||||||
|
|
||||||
if (pMS->CurState == DISPATCH_SHUTTLE)
|
if (pMS->CurState == DISPATCH_SHUTTLE)
|
||||||
{
|
{
|
||||||
@@ -1030,7 +1032,7 @@ DoScan (MENU_STATE *pMS)
|
|||||||
max_scan = BIOLOGICAL_SCAN;
|
max_scan = BIOLOGICAL_SCAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
for ( ; min_scan <= max_scan; ++min_scan)
|
||||||
{
|
{
|
||||||
TEXT t;
|
TEXT t;
|
||||||
SWORD i;
|
SWORD i;
|
||||||
@@ -1078,6 +1080,7 @@ DoScan (MENU_STATE *pMS)
|
|||||||
|
|
||||||
{
|
{
|
||||||
DWORD rgb;
|
DWORD rgb;
|
||||||
|
TimeCount TimeOut;
|
||||||
|
|
||||||
switch (min_scan)
|
switch (min_scan)
|
||||||
{
|
{
|
||||||
@@ -1092,45 +1095,43 @@ DoScan (MENU_STATE *pMS)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw a virgin surface
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawPlanet (0, 0, 0, 0);
|
DrawPlanet (0, 0, 0, 0);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
PressState = AnyButtonPress (TRUE);
|
// Draw the scan slowly line by line
|
||||||
WaitTime = (ONE_SECOND << 1) / MAP_HEIGHT;
|
TimeOut = GetTimeCounter ();
|
||||||
// LockMutex (GraphicsLock);
|
for (i = 0; i < SCAN_LINES; i++)
|
||||||
TimeIn = GetTimeCounter ();
|
|
||||||
for (i = 0; i < MAP_HEIGHT + NUM_FLASH_COLORS + 1; i++)
|
|
||||||
{
|
{
|
||||||
ButtonState = AnyButtonPress (TRUE);
|
TimeOut += SCAN_LINE_WAIT;
|
||||||
if (PressState)
|
if (WaitForAnyButtonUntil (TRUE, TimeOut, FALSE))
|
||||||
{
|
break;
|
||||||
PressState = ButtonState;
|
|
||||||
ButtonState = FALSE;
|
|
||||||
}
|
|
||||||
if (ButtonState)
|
|
||||||
i = -i;
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawPlanet (0, 0, i, rgb);
|
DrawPlanet (0, 0, i, rgb);
|
||||||
if (i < 0)
|
|
||||||
i = MAP_HEIGHT + NUM_FLASH_COLORS;
|
|
||||||
if (pMS->delta_item)
|
|
||||||
DrawScannedStuff (i, min_scan);
|
DrawScannedStuff (i, min_scan);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
// FlushGraphics ();
|
|
||||||
SleepThreadUntil (TimeIn + WaitTime);
|
|
||||||
TimeIn = GetTimeCounter ();
|
|
||||||
}
|
}
|
||||||
// UnlockMutex (GraphicsLock);
|
|
||||||
|
if (i < SCAN_LINES)
|
||||||
|
{ // Aborted by a keypress; draw in finished state
|
||||||
|
LockMutex (GraphicsLock);
|
||||||
|
BatchGraphics ();
|
||||||
|
// dy < 0 means "from dy to the end"
|
||||||
|
DrawPlanet (0, 0, -i, rgb);
|
||||||
|
DrawScannedStuff (SCAN_LINES - 1, min_scan);
|
||||||
|
UnbatchGraphics ();
|
||||||
|
UnlockMutex (GraphicsLock);
|
||||||
|
}
|
||||||
|
|
||||||
pSolarSysState->Tint_rgb = 0;
|
pSolarSysState->Tint_rgb = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} while (++min_scan <= max_scan);
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
SetContext (SpaceContext);
|
SetContext (SpaceContext);
|
||||||
|
|||||||
+1
-9
@@ -606,15 +606,7 @@ SaveProblem (void)
|
|||||||
FlushGraphics ();
|
FlushGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
while (AnyButtonPress (FALSE))
|
WaitForAnyButton (TRUE, WAIT_INFINITE, FALSE);
|
||||||
;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
TaskSwitch ();
|
|
||||||
UpdateInputState ();
|
|
||||||
} while (!(PulsedInputState.menu[KEY_MENU_SELECT] ||
|
|
||||||
PulsedInputState.menu[KEY_MENU_SPECIAL] ||
|
|
||||||
(GLOBAL (CurrentActivity) & CHECK_ABORT)));
|
|
||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
|
|||||||
+64
-48
@@ -111,39 +111,6 @@ SeedRandomNumbers (void)
|
|||||||
return (cur_time);
|
return (cur_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
WaitForNoInput (SIZE Duration)
|
|
||||||
{
|
|
||||||
BOOLEAN PressState;
|
|
||||||
|
|
||||||
PressState = AnyButtonPress (FALSE);
|
|
||||||
if (Duration < 0)
|
|
||||||
{
|
|
||||||
if (PressState)
|
|
||||||
return;
|
|
||||||
Duration = -Duration;
|
|
||||||
}
|
|
||||||
else if (!PressState)
|
|
||||||
return;
|
|
||||||
|
|
||||||
{
|
|
||||||
DWORD TimeOut;
|
|
||||||
BOOLEAN ButtonState;
|
|
||||||
|
|
||||||
TimeOut = GetTimeCounter () + Duration;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
ButtonState = AnyButtonPress (FALSE);
|
|
||||||
if (PressState)
|
|
||||||
{
|
|
||||||
PressState = ButtonState;
|
|
||||||
ButtonState = 0;
|
|
||||||
}
|
|
||||||
} while (!ButtonState &&
|
|
||||||
(TaskSwitch (), GetTimeCounter ()) <= TimeOut);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PauseGame (void)
|
PauseGame (void)
|
||||||
{
|
{
|
||||||
@@ -215,8 +182,7 @@ PauseGame (void)
|
|||||||
SetFrameHot (Screen, OldHot);
|
SetFrameHot (Screen, OldHot);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
|
|
||||||
WaitForNoInput (ONE_SECOND / 4);
|
WaitForNoInput (ONE_SECOND / 4, TRUE);
|
||||||
FlushInput ();
|
|
||||||
|
|
||||||
if (PlayingTrack ())
|
if (PlayingTrack ())
|
||||||
ResumeTrack ();
|
ResumeTrack ();
|
||||||
@@ -228,22 +194,73 @@ PauseGame (void)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waits for a new button to be pressed
|
// Waits for a button to be pressed
|
||||||
// and returns TRUE if Quit was selected
|
// Returns TRUE if the wait succeeded (found input)
|
||||||
|
// FALSE if timed out or game aborted
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
WaitAnyButtonOrQuit (BOOLEAN CheckSpecial)
|
WaitForAnyButtonUntil (BOOLEAN newButton, TimeCount timeOut,
|
||||||
|
BOOLEAN resetInput)
|
||||||
{
|
{
|
||||||
while (AnyButtonPress (TRUE))
|
BOOLEAN buttonPressed;
|
||||||
TaskSwitch ();
|
|
||||||
|
|
||||||
while (!AnyButtonPress (TRUE) &&
|
if (newButton && !WaitForNoInputUntil (timeOut, FALSE))
|
||||||
!(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
return FALSE;
|
||||||
TaskSwitch ();
|
|
||||||
|
|
||||||
/* Satisfy unused parameter */
|
buttonPressed = AnyButtonPress (TRUE);
|
||||||
(void) CheckSpecial;
|
while (!buttonPressed
|
||||||
|
&& (timeOut == WAIT_INFINITE || GetTimeCounter () < timeOut)
|
||||||
|
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||||
|
&& !QuitPosted)
|
||||||
|
{
|
||||||
|
SleepThread (ONE_SECOND / 40);
|
||||||
|
buttonPressed = AnyButtonPress (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
return (GLOBAL (CurrentActivity) & CHECK_ABORT) != 0;
|
if (resetInput)
|
||||||
|
FlushInput ();
|
||||||
|
|
||||||
|
return buttonPressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
WaitForAnyButton (BOOLEAN newButton, TimePeriod duration, BOOLEAN resetInput)
|
||||||
|
{
|
||||||
|
TimeCount timeOut = duration;
|
||||||
|
if (duration != WAIT_INFINITE)
|
||||||
|
timeOut += GetTimeCounter ();
|
||||||
|
return WaitForAnyButtonUntil (newButton, timeOut, resetInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns TRUE if the wait succeeded (found no input)
|
||||||
|
// FALSE if timed out or game aborted
|
||||||
|
BOOLEAN
|
||||||
|
WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput)
|
||||||
|
{
|
||||||
|
BOOLEAN buttonPressed;
|
||||||
|
|
||||||
|
buttonPressed = AnyButtonPress (TRUE);
|
||||||
|
while (buttonPressed
|
||||||
|
&& (timeOut == WAIT_INFINITE || GetTimeCounter () < timeOut)
|
||||||
|
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||||
|
&& !QuitPosted)
|
||||||
|
{
|
||||||
|
SleepThread (ONE_SECOND / 40);
|
||||||
|
buttonPressed = AnyButtonPress (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resetInput)
|
||||||
|
FlushInput ();
|
||||||
|
|
||||||
|
return !buttonPressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
WaitForNoInput (TimePeriod duration, BOOLEAN resetInput)
|
||||||
|
{
|
||||||
|
TimeCount timeOut = duration;
|
||||||
|
if (duration != WAIT_INFINITE)
|
||||||
|
timeOut += GetTimeCounter ();
|
||||||
|
return WaitForNoInputUntil (timeOut, resetInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stops game clock and music thread and minimizes interrupts/cycles
|
// Stops game clock and music thread and minimizes interrupts/cycles
|
||||||
@@ -268,8 +285,7 @@ SleepGame (void)
|
|||||||
|
|
||||||
log_add (log_Debug, "Game is waking up");
|
log_add (log_Debug, "Game is waking up");
|
||||||
|
|
||||||
WaitForNoInput (ONE_SECOND / 10);
|
WaitForNoInput (ONE_SECOND / 10, TRUE);
|
||||||
FlushInput ();
|
|
||||||
|
|
||||||
ResumeMusic ();
|
ResumeMusic ();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user