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; RECT r;
STAMP s; STAMP s;
s.frame = CaptureDrawable ( s.frame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));
LoadGraphic (RESTART_PMAP_ANIM)
);
pMS->CurFrame = s.frame; pMS->CurFrame = s.frame;
GetFrameRect (s.frame, &r); GetFrameRect (s.frame, &r);
s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1; s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1;
@@ -83,8 +81,13 @@ DrawRestartMenu (BYTE OldState, BYTE NewState, FRAME f)
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
SetContext (ScreenContext); 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); SetContextClipRect (&r);
r.corner.x = 0; r.corner.x = 0;
r.corner.y = 0; r.corner.y = 0;
r.extent.width = SCREEN_WIDTH; r.extent.width = SCREEN_WIDTH;
@@ -134,7 +137,8 @@ DoRestart (MENU_STATE *pMS)
{ {
BYTE clut_buf[] = {FadeAllToColor}; 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) && while ((GetTimeCounter () <= TimeOut) &&
!(GLOBAL (CurrentActivity) & CHECK_ABORT)) !(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) else if (GLOBAL (CurrentActivity) & CHECK_ABORT)
{ {
return (FALSE); return (FALSE);
} }
else if (!(PulsedInputState.menu[KEY_MENU_UP] || PulsedInputState.menu[KEY_MENU_DOWN] || else if (!(PulsedInputState.menu[KEY_MENU_UP] ||
PulsedInputState.menu[KEY_MENU_LEFT] || PulsedInputState.menu[KEY_MENU_RIGHT] || PulsedInputState.menu[KEY_MENU_DOWN] ||
PulsedInputState.menu[KEY_MENU_LEFT] ||
PulsedInputState.menu[KEY_MENU_RIGHT] ||
PulsedInputState.menu[KEY_MENU_SELECT] || MouseButtonDown)) PulsedInputState.menu[KEY_MENU_SELECT] || MouseButtonDown))
{ {
@@ -187,7 +190,8 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
SetFlashRect (NULL, (FRAME)0); SetFlashRect (NULL, (FRAME)0);
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
SetupMenu (); SetupMenu ();
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT); SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN,
MENU_SOUND_SELECT);
InTime = GetTimeCounter (); InTime = GetTimeCounter ();
SetTransitionSource (NULL); SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
@@ -198,7 +202,8 @@ else if (InputState & DEVICE_EXIT) return (FALSE);
return TRUE; return TRUE;
case QUIT_GAME: case QUIT_GAME:
fade_buf[0] = FadeAllToBlack; fade_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)fade_buf, ONE_SECOND / 2)); SleepThreadUntil (XFormColorMap (
(COLORMAPPTR)fade_buf, ONE_SECOND / 2));
GLOBAL (CurrentActivity) = CHECK_ABORT; GLOBAL (CurrentActivity) = CHECK_ABORT;
break; break;
@@ -278,7 +283,8 @@ RestartMenu (MENU_STATE *pMS)
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)white_buf, SleepThreadUntil (XFormColorMap ((COLORMAPPTR)white_buf,
ONE_SECOND / 8) + ONE_SECOND / 60); 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 (); ClearDrawable ();
FlushColorXForms (); FlushColorXForms ();
@@ -417,3 +423,4 @@ StartGame (void)
return (TRUE); return (TRUE);
} }
+10 -30
View File
@@ -78,7 +78,7 @@ arilou_gate_task(void *data)
} }
FinishTask (task); FinishTask (task);
return(0); return 0;
} }
static void static void
@@ -131,8 +131,14 @@ while (--ac > 0)
extern sint32 initAudio (sint32 driver, sint32 flags); extern sint32 initAudio (sint32 driver, sint32 flags);
initAudio (snddriver, soundflags); 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"); log_add (log_Info, "We've loaded the Kernel");
Logo (); Logo ();
@@ -166,9 +172,7 @@ while (--ac > 0)
#endif #endif
if (!((GLOBAL (CurrentActivity) | NextActivity) & CHECK_LOAD)) if (!((GLOBAL (CurrentActivity) | NextActivity) & CHECK_LOAD))
ZeroVelocityComponents ( ZeroVelocityComponents (&GLOBAL (velocity));
&GLOBAL (velocity)
);
// not going into talking pet conversation // not going into talking pet conversation
else if (GLOBAL (CurrentActivity) & CHECK_LOAD) else if (GLOBAL (CurrentActivity) & CHECK_LOAD)
GLOBAL (CurrentActivity) = NextActivity; GLOBAL (CurrentActivity) = NextActivity;
@@ -203,23 +207,7 @@ while (--ac > 0)
else if (GLOBAL (CurrentActivity) & START_INTERPLANETARY) else if (GLOBAL (CurrentActivity) & START_INTERPLANETARY)
{ {
GLOBAL (CurrentActivity) = MAKE_WORD (IN_INTERPLANETARY, 0); GLOBAL (CurrentActivity) = MAKE_WORD (IN_INTERPLANETARY, 0);
ExploreSolarSys (); 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 else
{ {
@@ -264,15 +252,6 @@ while (--ac > 0)
// CloseJournal (); // CloseJournal ();
FreeGameData (); 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 (); FreeKernel ();
// XXX: the abort can now be changed to something cleaner; // XXX: the abort can now be changed to something cleaner;
@@ -282,3 +261,4 @@ while (--ac > 0)
(void) threadArg; /* Satisfying compiler (unused parameter) */ (void) threadArg; /* Satisfying compiler (unused parameter) */
return 0; return 0;
} }