コード例 #1
0
ファイル: restart.c プロジェクト: njvack/uqm-ios
// Draw the full restart menu. Nothing is done with selections.
static void
DrawRestartMenuGraphic (MENU_STATE *pMS)
{
	RECT r;
	STAMP s;
	TEXT t;
	UNICODE buf[64];

	s.frame = pMS->CurFrame;
	GetFrameRect (s.frame, &r);
	s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1;
	s.origin.y = (SCREEN_HEIGHT - r.extent.height) >> 1;
	
	SetContextBackGroundColor (BLACK_COLOR);
	BatchGraphics ();
	ClearDrawable ();
	FlushColorXForms ();
	DrawStamp (&s);

	// Put the version number in the bottom right corner.
	SetContextFont (TinyFont);
	t.pStr = buf;
	t.baseline.x = SCREEN_WIDTH - 3;
	t.baseline.y = SCREEN_HEIGHT - 2;
	t.align = ALIGN_RIGHT;
	t.CharCount = (COUNT)~0;
	sprintf (buf, "v%d.%d.%d%s", UQM_MAJOR_VERSION, UQM_MINOR_VERSION,
			UQM_PATCH_VERSION, UQM_EXTRA_VERSION);
	SetContextForeGroundColor (WHITE_COLOR);
	font_DrawText (&t);

	UnbatchGraphics ();
}
コード例 #2
0
ファイル: restart.c プロジェクト: 0xDEC0DE/uqm-0.6.4-ee
static void
DrawRestartMenuGraphic (MENU_STATE *pMS)
{
	RECT r;
	STAMP s;

	s.frame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));
	pMS->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;
	
	SetContextBackGroundColor (BLACK_COLOR);
	BatchGraphics ();
	ClearDrawable ();
	FlushColorXForms ();
	LockMutex (GraphicsLock);
	DrawStamp (&s);
	UnlockMutex (GraphicsLock);
	UnbatchGraphics ();
}
コード例 #3
0
ファイル: restart.c プロジェクト: njvack/uqm-ios
static BOOLEAN
RestartMenu (MENU_STATE *pMS)
{
	TimeCount TimeOut;

	ReinitQueue (&race_q[0]);
	ReinitQueue (&race_q[1]);

	SetContext (ScreenContext);

	GLOBAL (CurrentActivity) |= CHECK_ABORT;
	if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0
			&& GET_GAME_STATE (UTWIG_BOMB_ON_SHIP)
			&& !GET_GAME_STATE (UTWIG_BOMB))
	{	// player blew himself up with Utwig bomb
		SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0);

		SleepThreadUntil (FadeScreen (FadeAllToWhite, ONE_SECOND / 8)
				+ ONE_SECOND / 60);
		SetContextBackGroundColor (
				BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F));
		ClearDrawable ();
		FlushColorXForms ();

		TimeOut = ONE_SECOND / 8;
	}
	else
	{
		TimeOut = ONE_SECOND / 2;

		if (LOBYTE (LastActivity) == WON_LAST_BATTLE)
		{
			GLOBAL (CurrentActivity) = WON_LAST_BATTLE;
			Victory ();
			Credits (TRUE);

			FreeGameData ();
			
			GLOBAL (CurrentActivity) = CHECK_ABORT;
		}
	}

	LastActivity = 0;
	NextActivity = 0;

	// TODO: This fade is not always necessary, especially after a splash
	//   screen. It only makes a user wait.
	SleepThreadUntil (FadeScreen (FadeAllToBlack, TimeOut));
	if (TimeOut == ONE_SECOND / 8)
		SleepThread (ONE_SECOND * 3);

	pMS->CurFrame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));

	DrawRestartMenuGraphic (pMS);
	GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
	SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
	SetDefaultMenuRepeatDelay ();
	DoInput (pMS, TRUE);
	
	StopMusic ();
	if (pMS->hMusic)
	{
		DestroyMusic (pMS->hMusic);
		pMS->hMusic = 0;
	}

	Flash_terminate (pMS->flashContext);
	pMS->flashContext = 0;
	DestroyDrawable (ReleaseDrawable (pMS->CurFrame));
	pMS->CurFrame = 0;

	if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
		return (FALSE); // timed out

	if (GLOBAL (CurrentActivity) & CHECK_ABORT)
		return (FALSE); // quit

	TimeOut = FadeScreen (FadeAllToBlack, ONE_SECOND / 2);
	
	SleepThreadUntil (TimeOut);
	FlushColorXForms ();

	SeedRandomNumbers ();

	return (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE);
}
コード例 #4
0
ファイル: init.c プロジェクト: intgr/sc2-uqm
SIZE
InitShips (void)
{
	SIZE num_ships;

	InitSpace ();

	SetContext (StatusContext);
	SetContext (SpaceContext);

	InitDisplayList ();
	InitGalaxy ();

	if (inHQSpace ())
	{
		ReinitQueue (&race_q[0]);
		ReinitQueue (&race_q[1]);

		BuildSIS ();
		LoadHyperspace ();

		num_ships = 1;
	}
	else
	{
		COUNT i;
		RECT r;

		SetContextFGFrame (Screen);
		r.corner.x = SAFE_X;
		r.corner.y = SAFE_Y;
		r.extent.width = SPACE_WIDTH;
		r.extent.height = SPACE_HEIGHT;
		SetContextClipRect (&r);

		SetContextBackGroundColor (BLACK_COLOR);
		{
			CONTEXT OldContext;

			OldContext = SetContext (ScreenContext);

			SetContextBackGroundColor (BLACK_COLOR);
			ClearDrawable ();

			SetContext (OldContext);
		}

		if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
			free_gravity_well ();
		else
		{
#define NUM_ASTEROIDS 5
			for (i = 0; i < NUM_ASTEROIDS; ++i)
				spawn_asteroid (NULL);
#define NUM_PLANETS 1
			for (i = 0; i < NUM_PLANETS; ++i)
				spawn_planet ();
		}
	
		num_ships = NUM_SIDES;
	}

	// FlushInput ();

	return (num_ships);
}
コード例 #5
0
ファイル: restart.c プロジェクト: smaass/UQM-MegaMod
// Draw the full restart menu. Nothing is done with selections.
static void
DrawRestartMenuGraphic (MENU_STATE *pMS)
{
	RECT r;
	STAMP s;
	TEXT t; 
	char *Credit;
	UNICODE buf[64];

	// Re-load all of the restart menu fonts so the text shows in correct size after changing the resolution.
	if (optRequiresRestart || !PacksInstalled()) {	
		DestroyFont (TinyFont);
		DestroyFont (PlyrFont);
		DestroyFont (StarConFont);
	}	

	// DC: Load the different menus and fonts depending on the resolution factor	
	switch (resolutionFactor){
		case 1:
			if (optRequiresRestart || !PacksInstalled()) {
				TinyFont = LoadFont (TINY_FALLBACK_TO2X_FONT);
				PlyrFont = LoadFont (PLYR_FALLBACK_TO2X_FONT);
				StarConFont = LoadFont (SCON_FALLBACK_TO2X_FONT);
			}
			pMS->CurFrame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM2x));
			break;
		case 2:
			if (optRequiresRestart || !PacksInstalled()) {
				TinyFont = LoadFont (TINY_FALLBACK_TO4X_FONT);
				PlyrFont = LoadFont (PLYR_FALLBACK_TO4X_FONT);
				StarConFont = LoadFont (SCON_FALLBACK_TO4X_FONT);
			}
			pMS->CurFrame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM4x));
			break;
		case 0:
		default:
			if (optRequiresRestart || !PacksInstalled()) {
				TinyFont = LoadFont (TINY_FALLBACK_TO1X_FONT);
				PlyrFont = LoadFont (PLYR_FALLBACK_TO1X_FONT);
				StarConFont = LoadFont (SCON_FALLBACK_TO1X_FONT);
			}
			pMS->CurFrame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));
			break;
	}

	s.frame = pMS->CurFrame;
	GetFrameRect (s.frame, &r);
	s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1;
	s.origin.y = (SCREEN_HEIGHT - r.extent.height) >> 1;
	
	SetContextBackGroundColor (BLACK_COLOR);
	BatchGraphics ();
	ClearDrawable ();
	FlushColorXForms ();
	DrawStamp (&s);

	// Put the version number in the bottom right corner.
	SetContextFont (TinyFont);
	t.pStr = buf;
	t.baseline.x = SCREEN_WIDTH - RES_SCALE(2);
	t.baseline.y = SCREEN_HEIGHT - RES_SCALE(2);
	t.align = ALIGN_RIGHT;
	t.CharCount = (COUNT)~0;
	sprintf (buf, "v%d.%d.%d %s", UQM_MAJOR_VERSION, UQM_MINOR_VERSION, UQM_PATCH_VERSION, UQM_EXTRA_VERSION);
	SetContextForeGroundColor (WHITE_COLOR);
	font_DrawText (&t);

	// Put the main menu music credit in the bottom left corner.
	memset(&buf[0], 0, sizeof(buf));
	t.baseline.x = RES_SCALE(2);
	t.baseline.y = SCREEN_HEIGHT - RES_SCALE(2);
	t.align = ALIGN_LEFT;
	Credit = (Rando == 0 ? "Saibuster" : (Rando == 1 ? "Rush AX" : "Mark Vera"));
	sprintf (buf, "Main Menu Music by %s", Credit);
	font_DrawText (&t);

	UnbatchGraphics ();
}
コード例 #6
0
// Draw the full restart menu. Nothing is done with selections.
static void
DrawRestartMenuGraphic (MENU_STATE *pMS)
{
	RECT r;
	STAMP s;
	TEXT t;
	UNICODE buf[64];
	COUNT svn_revision = 0; // JMS

	//DC: Load the different menus depending on the resolution factor
	if (resolutionFactor < 1)
		s.frame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));
	if (resolutionFactor == 1)
		s.frame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM2x));
	if (resolutionFactor > 1)
		s.frame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM4x));

	// Re-load the info box font so the text shows in correct size after changing the resolution.
	if (resFactorWasChanged)
	{	
		DestroyFont (StarConFont);
		
		if (resolutionFactor < 1)
			StarConFont = LoadFont (FALLBACK_TO1X_FONT);
		if (resolutionFactor == 1)
			StarConFont = LoadFont (FALLBACK_TO2X_FONT);
		if (resolutionFactor > 1)
			StarConFont = LoadFont (FALLBACK_TO4X_FONT);
	}
	
	pMS->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;
	
	SetContextBackGroundColor (BLACK_COLOR);
	BatchGraphics ();
	ClearDrawable ();
	FlushColorXForms ();
	LockMutex (GraphicsLock);
	DrawStamp (&s);

	// JMS: Hack for printing out the correct SVN revision number.
	{
		UNICODE svn_buf[64] = {0};
		char *colonPtr;
		
		strcpy(svn_buf, UQMHD_SVN_REVISION);
		colonPtr = strchr(svn_buf, ':');
		
		// The revision number is in format rXXX
		if (colonPtr == NULL)
		{
			// Let's just take the only number and be happy.
			svn_revision = atoi(svn_buf);
		}
		// the revision number is in format rXXX:ZZZ
		else
		{
			// Now we need to extract only the ZZZ number.
			UNICODE svn_buf2[10];
			strcpy(svn_buf2, colonPtr+1);
			svn_revision = atoi(svn_buf2);
		}
		
		// Think about this for a while ;)
		++svn_revision;
	}
	
	// Put the version number in the bottom right corner.
	SetContextFont (TinyFont);
	t.pStr = buf;
	t.baseline.x = SCREEN_WIDTH - 3;
	t.baseline.y = SCREEN_HEIGHT - 2;
	t.align = ALIGN_RIGHT;
	t.CharCount = (COUNT)~0;
	sprintf (buf, "v%d.%d.%d%s - SVN r%d", UQM_MAJOR_VERSION, UQM_MINOR_VERSION, UQM_PATCH_VERSION, UQM_EXTRA_VERSION, svn_revision);
	SetContextForeGroundColor (WHITE_COLOR);
	font_DrawText (&t);

	UnlockMutex (GraphicsLock);
	UnbatchGraphics ();
}
コード例 #7
0
static BOOLEAN
RestartMenu (PMENU_STATE pMS)
{
	DWORD TimeOut;
	BYTE black_buf[1];

	ReinitQueue (&race_q[0]);
	ReinitQueue (&race_q[1]);

	black_buf[0] = FadeAllToBlack;

	SetContext (ScreenContext);

	GLOBAL (CurrentActivity) |= CHECK_ABORT;
	if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0
			&& GET_GAME_STATE (UTWIG_BOMB_ON_SHIP)
			&& !GET_GAME_STATE (UTWIG_BOMB))
	{	// player blew himself up with Utwig bomb
		BYTE white_buf[] = {FadeAllToWhite};

		SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0);

		SleepThreadUntil (XFormColorMap ((COLORMAPPTR)white_buf,
				ONE_SECOND / 8) + ONE_SECOND / 60);
		SetContextBackGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F));
		ClearDrawable ();
		FlushColorXForms ();

		TimeOut = ONE_SECOND / 8;
	}
	else
	{
		TimeOut = ONE_SECOND / 2;

		if (LOBYTE (LastActivity) == WON_LAST_BATTLE)
		{
			GLOBAL (CurrentActivity) = WON_LAST_BATTLE;
			Victory ();
			Credits (TRUE);

			FreeGameData ();
			
			TimeOut = ONE_SECOND / 2;
			GLOBAL (CurrentActivity) = CHECK_ABORT;
		}
	}

	LastActivity = NextActivity = 0;

	SleepThreadUntil (XFormColorMap ((COLORMAPPTR)black_buf, TimeOut));
	if (TimeOut == ONE_SECOND / 8)
		SleepThread (ONE_SECOND * 3);
	DrawRestartMenuGraphic (pMS);
	FlushInput ();
	GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
	SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
	DoInput (pMS, TRUE);
	
	StopMusic ();
	if (pMS->hMusic)
	{
		DestroyMusic (pMS->hMusic);
		pMS->hMusic = 0;
	}

	LockMutex (GraphicsLock);
	SetFlashRect (NULL_PTR, (FRAME)0);
	UnlockMutex (GraphicsLock);
	DestroyDrawable (ReleaseDrawable (pMS->CurFrame));

	if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
		return (FALSE); // timed out

	if (GLOBAL (CurrentActivity) & CHECK_ABORT)
		return (FALSE); // quit

	TimeOut = XFormColorMap ((COLORMAPPTR)black_buf, ONE_SECOND / 2);
	
	SleepThreadUntil (TimeOut);
	FlushColorXForms ();

	SeedRandomNumbers ();

	return (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE);
}