Cleanups.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2831 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2007-08-04 00:18:57 +00:00
parent b6f13049b3
commit 0489c250b2
2 changed files with 137 additions and 150 deletions
+20 -13
View File
@@ -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 ();
@@ -417,3 +423,4 @@ StartGame (void)
return (TRUE);
}
+13 -33
View File
@@ -78,7 +78,7 @@ arilou_gate_task(void *data)
}
FinishTask (task);
return(0);
return 0;
}
static void
@@ -131,8 +131,14 @@ while (--ac > 0)
extern sint32 initAudio (sint32 driver, sint32 flags);
initAudio (snddriver, soundflags);
if (LoadKernel (0,0))
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);
log_add (log_Fatal, "in the %s/packages directory.", baseContentPath);
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 ();
@@ -166,10 +172,8 @@ while (--ac > 0)
#endif
if (!((GLOBAL (CurrentActivity) | NextActivity) & CHECK_LOAD))
ZeroVelocityComponents (
&GLOBAL (velocity)
);
//not going into talking pet conversation
ZeroVelocityComponents (&GLOBAL (velocity));
// not going into talking pet conversation
else if (GLOBAL (CurrentActivity) & CHECK_LOAD)
GLOBAL (CurrentActivity) = NextActivity;
@@ -203,23 +207,7 @@ while (--ac > 0)
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
{
@@ -245,12 +233,12 @@ while (--ac > 0)
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
&& (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE
//if died for some reason
// 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
// surrendered to Ur-Quan
else if (GLOBAL (CurrentActivity) & CHECK_RESTART)
GLOBAL (CurrentActivity) &= ~CHECK_RESTART;
break;
@@ -264,15 +252,6 @@ while (--ac > 0)
// CloseJournal ();
FreeGameData ();
}
else
{
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);
log_add (log_Fatal, "in the %s/packages directory.", baseContentPath);
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);
}
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;
}