Cleanups.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2831 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+21
-14
@@ -56,9 +56,7 @@ DrawRestartMenuGraphic (MENU_STATE *pMS)
|
||||
RECT r;
|
||||
STAMP s;
|
||||
|
||||
s.frame = CaptureDrawable (
|
||||
LoadGraphic (RESTART_PMAP_ANIM)
|
||||
);
|
||||
s.frame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));
|
||||
pMS->CurFrame = s.frame;
|
||||
GetFrameRect (s.frame, &r);
|
||||
s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1;
|
||||
@@ -83,8 +81,13 @@ DrawRestartMenu (BYTE OldState, BYTE NewState, FRAME f)
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
SetContext (ScreenContext);
|
||||
r.corner.x = r.corner.y = r.extent.width = r.extent.height = 0;
|
||||
|
||||
r.corner.x = 0;
|
||||
r.corner.y = 0;
|
||||
r.extent.width = 0;
|
||||
r.extent.height = 0;
|
||||
SetContextClipRect (&r);
|
||||
|
||||
r.corner.x = 0;
|
||||
r.corner.y = 0;
|
||||
r.extent.width = SCREEN_WIDTH;
|
||||
@@ -134,7 +137,8 @@ DoRestart (MENU_STATE *pMS)
|
||||
|
||||
{
|
||||
BYTE clut_buf[] = {FadeAllToColor};
|
||||
DWORD TimeOut = XFormColorMap ((COLORMAPPTR)clut_buf, ONE_SECOND / 2);
|
||||
DWORD TimeOut = XFormColorMap (
|
||||
(COLORMAPPTR)clut_buf, ONE_SECOND / 2);
|
||||
while ((GetTimeCounter () <= TimeOut) &&
|
||||
!(GLOBAL (CurrentActivity) & CHECK_ABORT))
|
||||
{
|
||||
@@ -143,15 +147,14 @@ DoRestart (MENU_STATE *pMS)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef TESTING
|
||||
else if (InputState & DEVICE_EXIT) return (FALSE);
|
||||
#endif /* TESTING */
|
||||
else if (GLOBAL (CurrentActivity) & CHECK_ABORT)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
else if (!(PulsedInputState.menu[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_DOWN] ||
|
||||
PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT] ||
|
||||
else if (!(PulsedInputState.menu[KEY_MENU_UP] ||
|
||||
PulsedInputState.menu[KEY_MENU_DOWN] ||
|
||||
PulsedInputState.menu[KEY_MENU_LEFT] ||
|
||||
PulsedInputState.menu[KEY_MENU_RIGHT] ||
|
||||
PulsedInputState.menu[KEY_MENU_SELECT] || MouseButtonDown))
|
||||
|
||||
{
|
||||
@@ -187,7 +190,8 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
|
||||
SetFlashRect (NULL, (FRAME)0);
|
||||
UnlockMutex (GraphicsLock);
|
||||
SetupMenu ();
|
||||
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
|
||||
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
|
||||
MENU_SOUND_SELECT);
|
||||
InTime = GetTimeCounter ();
|
||||
SetTransitionSource (NULL);
|
||||
BatchGraphics ();
|
||||
@@ -198,7 +202,8 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
|
||||
return TRUE;
|
||||
case QUIT_GAME:
|
||||
fade_buf[0] = FadeAllToBlack;
|
||||
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2));
|
||||
SleepThreadUntil (XFormColorMap (
|
||||
(COLORMAPPTR)fade_buf, ONE_SECOND / 2));
|
||||
|
||||
GLOBAL (CurrentActivity) = CHECK_ABORT;
|
||||
break;
|
||||
@@ -278,7 +283,8 @@ RestartMenu (MENU_STATE *pMS)
|
||||
|
||||
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)white_buf,
|
||||
ONE_SECOND / 8) + ONE_SECOND / 60);
|
||||
SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F));
|
||||
SetContextBackGroundColor (
|
||||
BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F));
|
||||
ClearDrawable ();
|
||||
FlushColorXForms ();
|
||||
|
||||
@@ -412,8 +418,9 @@ StartGame (void)
|
||||
}
|
||||
|
||||
PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING;
|
||||
PlayerControl[1] = COMPUTER_CONTROL | AWESOME_RATING;
|
||||
PlayerControl[1] = COMPUTER_CONTROL | AWESOME_RATING;
|
||||
SetPlayerInput ();
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
+116
-136
@@ -78,7 +78,7 @@ arilou_gate_task(void *data)
|
||||
}
|
||||
FinishTask (task);
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -131,141 +131,7 @@ while (--ac > 0)
|
||||
extern sint32 initAudio (sint32 driver, sint32 flags);
|
||||
initAudio (snddriver, soundflags);
|
||||
|
||||
if (LoadKernel (0,0))
|
||||
{
|
||||
log_add (log_Info, "We've loaded the Kernel");
|
||||
|
||||
Logo ();
|
||||
|
||||
GLOBAL (CurrentActivity) = 0;
|
||||
// show splash and init the kernel in the meantime
|
||||
SplashScreen (BackgroundInitKernel);
|
||||
|
||||
// OpenJournal ();
|
||||
while (StartGame ())
|
||||
{
|
||||
InitSIS ();
|
||||
InitGameClock ();
|
||||
|
||||
AddInitialGameEvents();
|
||||
do
|
||||
{
|
||||
SuspendGameClock ();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debugHook != NULL)
|
||||
{
|
||||
void (*saveDebugHook) (void);
|
||||
saveDebugHook = debugHook;
|
||||
debugHook = NULL;
|
||||
// No further debugHook calls unless the called
|
||||
// function resets debugHook.
|
||||
(*saveDebugHook) ();
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!((GLOBAL (CurrentActivity) | NextActivity) & CHECK_LOAD))
|
||||
ZeroVelocityComponents (
|
||||
&GLOBAL (velocity)
|
||||
);
|
||||
//not going into talking pet conversation
|
||||
else if (GLOBAL (CurrentActivity) & CHECK_LOAD)
|
||||
GLOBAL (CurrentActivity) = NextActivity;
|
||||
|
||||
if ((GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
||||
|| GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
|
||||
{
|
||||
if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2
|
||||
&& !GET_GAME_STATE (STARBASE_AVAILABLE))
|
||||
{ /* BGD mode */
|
||||
InstallBombAtEarth ();
|
||||
}
|
||||
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == (BYTE)~0
|
||||
|| GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
|
||||
{
|
||||
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
||||
VisitStarBase ();
|
||||
}
|
||||
else
|
||||
{
|
||||
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
||||
RaceCommunication ();
|
||||
}
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
GLOBAL (CurrentActivity) &= ~START_ENCOUNTER;
|
||||
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY)
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
}
|
||||
}
|
||||
else if (GLOBAL (CurrentActivity) & START_INTERPLANETARY)
|
||||
{
|
||||
GLOBAL (CurrentActivity) = MAKE_WORD (IN_INTERPLANETARY, 0);
|
||||
|
||||
ExploreSolarSys ();
|
||||
#ifdef TESTING
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
&& GLOBAL_SIS (CrewEnlisted) != (COUNT)~0)
|
||||
{
|
||||
if (!(GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
||||
&& (CurStarDescPtr = FindStar (NULL,
|
||||
&GLOBAL (autopilot), 0, 0)))
|
||||
{
|
||||
GLOBAL (autopilot.x) = ~0;
|
||||
GLOBAL (autopilot.y) = ~0;
|
||||
GLOBAL (ShipStamp.frame) = 0;
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
}
|
||||
}
|
||||
#endif //TESTING
|
||||
}
|
||||
else
|
||||
{
|
||||
Task ArilouTask;
|
||||
|
||||
GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0);
|
||||
|
||||
ArilouTask = AssignTask (arilou_gate_task, 128,
|
||||
"quasispace portal manager");
|
||||
|
||||
TaskSwitch ();
|
||||
|
||||
Battle ();
|
||||
if (ArilouTask)
|
||||
Task_SetState (ArilouTask, TASK_EXIT);
|
||||
}
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
SetFlashRect (NULL, (FRAME)0);
|
||||
UnlockMutex (GraphicsLock);
|
||||
|
||||
LastActivity = GLOBAL (CurrentActivity);
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
&& (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE
|
||||
//if died for some reason
|
||||
|| GLOBAL_SIS (CrewEnlisted) == (COUNT)~0))
|
||||
{
|
||||
if (GET_GAME_STATE (KOHR_AH_KILLED_ALL))
|
||||
InitCommunication (BLACKURQ_CONVERSATION);
|
||||
//surrendered to Ur-Quan
|
||||
else if (GLOBAL (CurrentActivity) & CHECK_RESTART)
|
||||
GLOBAL (CurrentActivity) &= ~CHECK_RESTART;
|
||||
break;
|
||||
}
|
||||
} while (!(GLOBAL (CurrentActivity) & CHECK_ABORT));
|
||||
|
||||
StopSound ();
|
||||
UninitGameClock ();
|
||||
UninitSIS ();
|
||||
}
|
||||
// CloseJournal ();
|
||||
|
||||
FreeGameData ();
|
||||
}
|
||||
else
|
||||
if (!LoadKernel (0,0))
|
||||
{
|
||||
log_add (log_Fatal, "\n *** FATAL ERROR: Could not load basic content ***\n\nUQM requires at least the base content pack to run properly.");
|
||||
log_add (log_Fatal, "This file is typically called uqm-%d.%d.0.uqm. UQM was expecting it", UQM_MAJOR_VERSION, UQM_MINOR_VERSION);
|
||||
@@ -273,6 +139,119 @@ while (--ac > 0)
|
||||
log_add (log_Fatal, "Either your installation did not install the content pack at all, or it\ninstalled it in a different directory.\n\nFix your installation and rerun UQM.\n\n *******************\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
log_add (log_Info, "We've loaded the Kernel");
|
||||
|
||||
Logo ();
|
||||
|
||||
GLOBAL (CurrentActivity) = 0;
|
||||
// show splash and init the kernel in the meantime
|
||||
SplashScreen (BackgroundInitKernel);
|
||||
|
||||
// OpenJournal ();
|
||||
while (StartGame ())
|
||||
{
|
||||
InitSIS ();
|
||||
InitGameClock ();
|
||||
|
||||
AddInitialGameEvents();
|
||||
do
|
||||
{
|
||||
SuspendGameClock ();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debugHook != NULL)
|
||||
{
|
||||
void (*saveDebugHook) (void);
|
||||
saveDebugHook = debugHook;
|
||||
debugHook = NULL;
|
||||
// No further debugHook calls unless the called
|
||||
// function resets debugHook.
|
||||
(*saveDebugHook) ();
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!((GLOBAL (CurrentActivity) | NextActivity) & CHECK_LOAD))
|
||||
ZeroVelocityComponents (&GLOBAL (velocity));
|
||||
// not going into talking pet conversation
|
||||
else if (GLOBAL (CurrentActivity) & CHECK_LOAD)
|
||||
GLOBAL (CurrentActivity) = NextActivity;
|
||||
|
||||
if ((GLOBAL (CurrentActivity) & START_ENCOUNTER)
|
||||
|| GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
|
||||
{
|
||||
if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2
|
||||
&& !GET_GAME_STATE (STARBASE_AVAILABLE))
|
||||
{ /* BGD mode */
|
||||
InstallBombAtEarth ();
|
||||
}
|
||||
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == (BYTE)~0
|
||||
|| GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
|
||||
{
|
||||
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
||||
VisitStarBase ();
|
||||
}
|
||||
else
|
||||
{
|
||||
GLOBAL (CurrentActivity) |= START_ENCOUNTER;
|
||||
RaceCommunication ();
|
||||
}
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
GLOBAL (CurrentActivity) &= ~START_ENCOUNTER;
|
||||
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY)
|
||||
GLOBAL (CurrentActivity) |= START_INTERPLANETARY;
|
||||
}
|
||||
}
|
||||
else if (GLOBAL (CurrentActivity) & START_INTERPLANETARY)
|
||||
{
|
||||
GLOBAL (CurrentActivity) = MAKE_WORD (IN_INTERPLANETARY, 0);
|
||||
ExploreSolarSys ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Task ArilouTask;
|
||||
|
||||
GLOBAL (CurrentActivity) = MAKE_WORD (IN_HYPERSPACE, 0);
|
||||
|
||||
ArilouTask = AssignTask (arilou_gate_task, 128,
|
||||
"quasispace portal manager");
|
||||
|
||||
TaskSwitch ();
|
||||
|
||||
Battle ();
|
||||
if (ArilouTask)
|
||||
Task_SetState (ArilouTask, TASK_EXIT);
|
||||
}
|
||||
|
||||
LockMutex (GraphicsLock);
|
||||
SetFlashRect (NULL, (FRAME)0);
|
||||
UnlockMutex (GraphicsLock);
|
||||
|
||||
LastActivity = GLOBAL (CurrentActivity);
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
|
||||
&& (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE
|
||||
// if died for some reason
|
||||
|| GLOBAL_SIS (CrewEnlisted) == (COUNT)~0))
|
||||
{
|
||||
if (GET_GAME_STATE (KOHR_AH_KILLED_ALL))
|
||||
InitCommunication (BLACKURQ_CONVERSATION);
|
||||
// surrendered to Ur-Quan
|
||||
else if (GLOBAL (CurrentActivity) & CHECK_RESTART)
|
||||
GLOBAL (CurrentActivity) &= ~CHECK_RESTART;
|
||||
break;
|
||||
}
|
||||
} while (!(GLOBAL (CurrentActivity) & CHECK_ABORT));
|
||||
|
||||
StopSound ();
|
||||
UninitGameClock ();
|
||||
UninitSIS ();
|
||||
}
|
||||
// CloseJournal ();
|
||||
|
||||
FreeGameData ();
|
||||
FreeKernel ();
|
||||
|
||||
// XXX: the abort can now be changed to something cleaner;
|
||||
@@ -282,3 +261,4 @@ while (--ac > 0)
|
||||
(void) threadArg; /* Satisfying compiler (unused parameter) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user