rem: ClearSemaphore (&GraphicsSem);
add: ClearSemaphore (GraphicsSem);
context: StartGame (void){	MENU_STATE MenuState;TimedOut:	LastActivity = GLOBAL (CurrentActivity);	GLOBAL (CurrentActivity) = 0;	if (LastActivity == (ACTIVITY)~0)		Introduction ();	memset ((PMENU_STATE)&MenuState, 0, sizeof (MenuState));	MenuState.InputFunc = DoRestart;	{		DWORD TimeOut;		BYTE black_buf[1];		extern ACTIVITY NextActivity;TryAgain:		ReinitQueue (&race_q[0]);		ReinitQueue (&race_q[1]);			black_buf[0] = FadeAllToBlack;		SetContext (ScreenContext);		SetContextBGFrame ((FRAME)0);		SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);		GLOBAL (CurrentActivity) |= CHECK_ABORT;		if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0				&& GET_GAME_STATE (UTWIG_BOMB_ON_SHIP)				&& !GET_GAME_STATE (UTWIG_BOMB))		{			BYTE white_buf[] = {FadeAllToWhite};			SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0);			SleepTask (XFormColorMap ((COLORMAPPTR)white_buf, ONE_SECOND / 8) + 2);			SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F));			ClearDrawable ();			FlushColorXForms ();			TimeOut = ONE_SECOND / 8;		}		else		{			TimeOut = ONE_SECOND / 2;#ifdef NOTYETLastActivity = WON_LAST_BATTLE;#endif /* NOTYET */			if (LOBYTE (LastActivity) == WON_LAST_BATTLE)			{				Victory ();				Credits ();				TimeOut = ONE_SECOND / 2;			}		}		LastActivity = NextActivity = 0;		{			RECT r;			STAMP s;			s.frame = CaptureDrawable (					LoadGraphic (RESTART_PMAP_ANIM)					);			MenuState.CurFrame = s.frame;			GetFrameRect (s.frame, &r);			s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1;			s.origin.y = (SCREEN_HEIGHT - r.extent.height) >> 1;			SleepTask (XFormColorMap ((COLORMAPPTR)black_buf, TimeOut));			if (TimeOut == ONE_SECOND / 8)				SleepTask (GetTimeCounter () + ONE_SECOND * 3);			SetContextBackGroundColor (BLACK_COLOR);			BatchGraphics ();			ClearDrawable ();			FlushColorXForms ();			DrawStamp (&s);			UnbatchGraphics ();			FlushInput ();			DoInput ((PVOID)&MenuState);						SetSemaphore (&GraphicsSem);			SetFlashRect ((PRECT)0, (FRAME)0);			ClearSemaphore (&GraphicsSem);			DestroyDrawable (ReleaseDrawable (s.frame));						if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)				goto TimedOut;#ifdef TESTINGif (GLOBAL (CurrentActivity) & CHECK_ABORT){	while (SoundPlaying ());	StopSound ();	FreeSC2Data ();	FreeLanderData ();	FreeIPData ();	FreeHyperData ();	FlushColorXForms ();	return (FALSE);}#endif /* TESTING */			TimeOut = XFormColorMap ((COLORMAPPTR)black_buf, ONE_SECOND / 2);		}				SleepTask (TimeOut);		FlushColorXForms ();		SeedRandomNumbers ();		if (LOBYTE (GLOBAL (CurrentActivity)) == SUPER_MELEE)		{FreeSC2Data ();FreeLanderData ();FreeIPData ();FreeHyperData ();			Melee ();			MenuState.Initialized = FALSE;			goto TryAgain;		}{extern STAR_DESC starmap_array[];extern const BYTE element_array[];extern const PlanetFrame planet_array[];star_array = starmap_array;Elements = element_array;PlanData = planet_array;}		PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING;		PlayerControl[1] =  COMPUTER_CONTROL | AWESOME_RATING;		SetPlayerInput ();		return (TRUE);	}	return (FALSE);}