Allow for quits during fade-in and splash screen (addresses #422)

Still can't quit during fade-outs, because the fading is not paused, and
affects the confirmation window too.  Bad times.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1087 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2003-07-26 05:15:52 +00:00
parent 38a37975fb
commit cbb902048a
3 changed files with 48 additions and 12 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.3: Changes towards version 0.3:
- Can use F10 to quit during splash screen as well as main menu -Michael
- Fixed starship location when being teleported from Procyon to - Fixed starship location when being teleported from Procyon to
the Earth Starbase after the Precursor bomb is installed. - Svdb the Earth Starbase after the Precursor bomb is installed. - Svdb
- Crew death on planet is now counted properly in all cases (bug #70) -Mika - Crew death on planet is now counted properly in all cases (bug #70) -Mika
+33 -9
View File
@@ -89,19 +89,45 @@ Introduction (void)
FlushInput (); FlushInput ();
LoadMasterShipList ();
InitGameKernel ();
xform_buf[0] = FadeAllToColor; xform_buf[0] = FadeAllToColor;
TimeOut = XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2); TimeOut = XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2);
LoadMasterShipList (); while ((GetTimeCounter () <= TimeOut) &&
SleepThreadUntil (TimeOut); !(GLOBAL (CurrentActivity) & CHECK_ABORT))
{
UpdateInputState ();
TaskSwitch ();
}
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{
return;
}
/* There was a forcible setting of CHECK_ABORT here. I cannot
* find any purpose for this that DoRestart doesn't handle
* better (forcing all other threads but this one to quit out,
* I believe), and have thus removed it. It was interfering
* with the proper operation of the quit operation.
* --Michael */
GLOBAL (CurrentActivity) |= CHECK_ABORT;
TimeOut += ONE_SECOND * 3; TimeOut += ONE_SECOND * 3;
while (!(InputState = AnyButtonPress (FALSE)) && while (!(InputState = AnyButtonPress (FALSE)) &&
(TaskSwitch (), GetTimeCounter ()) <= TimeOut) (GetTimeCounter () <= TimeOut) &&
{ !(GLOBAL (CurrentActivity) & CHECK_ABORT))
// {
} TaskSwitch ();
}
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{
return;
}
GLOBAL (CurrentActivity) &= ~CHECK_ABORT; GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
/* You can't try to quit during a fade to black, because if
* you try, the confirmation window will fade to black too.
* Fixing this will require a rewrite of our whole rendering
* engine. -- Michael */
xform_buf[0] = FadeAllToBlack; xform_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2)); SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2));
@@ -112,8 +138,6 @@ Introduction (void)
DoFMV (play_intro ? "intro" : "drumall", NULL, TRUE); DoFMV (play_intro ? "intro" : "drumall", NULL, TRUE);
play_intro = !play_intro; play_intro = !play_intro;
} }
InitGameKernel ();
} }
void void
+14 -3
View File
@@ -84,7 +84,7 @@ DWORD InTime;
static BOOLEAN static BOOLEAN
DoRestart (PMENU_STATE pMS) DoRestart (PMENU_STATE pMS)
{ {
/* Cancel any presses of the Pause or Exit keys. */ /* Cancel any presses of the Pause key. */
GamePaused = FALSE; GamePaused = FALSE;
if (!pMS->Initialized) if (!pMS->Initialized)
@@ -94,8 +94,13 @@ DoRestart (PMENU_STATE pMS)
{ {
BYTE clut_buf[] = {FadeAllToColor}; BYTE clut_buf[] = {FadeAllToColor};
DWORD TimeOut = XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2);
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2)); while ((GetTimeCounter () <= TimeOut) &&
!(GLOBAL (CurrentActivity) & CHECK_ABORT))
{
UpdateInputState ();
TaskSwitch ();
}
} }
} }
#ifdef TESTING #ifdef TESTING
@@ -175,7 +180,13 @@ TimedOut:
LastActivity = GLOBAL (CurrentActivity); LastActivity = GLOBAL (CurrentActivity);
GLOBAL (CurrentActivity) = 0; GLOBAL (CurrentActivity) = 0;
if (LastActivity == (ACTIVITY)~0) if (LastActivity == (ACTIVITY)~0)
{
Introduction (); Introduction ();
if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{
TFB_Abort ();
}
}
memset ((PMENU_STATE)&MenuState, 0, sizeof (MenuState)); memset ((PMENU_STATE)&MenuState, 0, sizeof (MenuState));
MenuState.InputFunc = DoRestart; MenuState.InputFunc = DoRestart;