예제 #1
0
파일: hud.c 프로젝트: paud/d2x-xl
void ClearBackgroundMessages (void)
{
	#ifdef WINDOWS
if (bExtraClear == gameData.app.nFrameCount) 		//don't do extra clear on same frame
	return;
	#endif

#ifdef WINDOWS
if (( (gameStates.render.cockpit.nMode == CM_STATUS_BAR) || (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (nLastMsgYCrd != -1) && (dd_VR_render_sub_buffer [0].yoff >= 6)) {
	dd_grs_canvas *canv_save = dd_grd_curcanv;
#else
if (( (gameStates.render.cockpit.nMode == CM_STATUS_BAR) || (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (nLastMsgYCrd != -1) && (VR_render_sub_buffer [0].cv_bitmap.bm_props.y >= 6)) {
	grs_canvas	*canv_save = grdCurCanv;
#endif

WINDOS (
	DDGrSetCurrentCanvas (GetCurrentGameScreen ()),
	GrSetCurrentCanvas (GetCurrentGameScreen ())
	);
PA_DFX (pa_set_frontbuffer_current ());
PA_DFX (copy_background_rect (0, nLastMsgYCrd, grdCurCanv->cv_bitmap.bm_props.w, nLastMsgYCrd+nLastMsgHeight-1));
PA_DFX (pa_set_backbuffer_current ());
copy_background_rect (0, nLastMsgYCrd, grdCurCanv->cv_bitmap.bm_props.w, nLastMsgYCrd+nLastMsgHeight-1);
WINDOS (
	DDGrSetCurrentCanvas (canv_save),
	GrSetCurrentCanvas (canv_save)
	);
#ifdef WINDOWS
	if (bExtraClear || !GRMODEINFO (modex)) {
		bExtraClear = 0;
		nLastMsgYCrd = -1;
		}
	else
		bExtraClear = gameData.app.nFrameCount;
#else
	nLastMsgYCrd = -1;
#endif
	}
szDisplayedBackgroundMsg [nVRCurrentPage][0] = 0;
}

//	-----------------------------------------------------------------------------

void HUDClearMessages ()
{
	int i, j;
	tHUDMessage	*pMsgs;

for (j = 2, pMsgs = gameData.hud.msgs; j; j--, pMsgs++) {
	pMsgs->nMessages = 0;
	pMsgs->nFirst = 
	pMsgs->nLast = 0;
	pMsgs->xTimer = 0;
	ClearBackgroundMessages ();
	for (i = 0; i < HUD_MAX_MSGS; i++)
		sprintf (pMsgs->szMsgs [i], TXT_SLAGEL);
	}
}
예제 #2
0
파일: highscores.c 프로젝트: paud/d2x-xl
void ScoreTableDrawCoop ()
{
	int i, color;
	int sorted [MAX_NUM_NET_PLAYERS];

MultiSortKillList ();
WIN (DDGRLOCK (dd_grd_curcanv));
grdCurCanv->cvFont = MEDIUM3_FONT;
GrString (0x8000, LHY (10), "COOPERATIVE SUMMARY", NULL);
grdCurCanv->cvFont = SMALL_FONT;
MultiGetKillList (sorted);
ScoreTableDrawCoopNames (sorted);
for (i=0; i<gameData.multiplayer.nPlayers; i++) {
	color = sorted [i];
	if (gameData.multiplayer.players [sorted [i]].connected==0)
		GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0);
	else
		GrSetFontColorRGBi (RGBA_PAL2 (playerColors  [color].r, playerColors  [color].g, playerColors [color].b), 1, 0, 0);
	ScoreTableDrawCoopItem (i, sorted);
	}
ScoreTableDrawDeaths (sorted);
WIN (DDGRUNLOCK (dd_grd_curcanv));
WINDOS (
	DDGrSetCurrentCanvas (NULL),
	GrSetCurrentCanvas (NULL)
	);
PA_DFX (pa_set_frontbuffer_current ());
PA_DFX (pa_set_backbuffer_current ());
GrPaletteStepLoad (NULL);
GrUpdate (0);
}
예제 #3
0
파일: escort.c 프로젝트: paud/d2x-xl
void ShowEscortMenu(char *msg)
{	
	int	w,h,aw;
	int	x,y;
	bkg	bg;

	memset (&bg, 0, sizeof (bg));
	bg.bIgnoreBg = 1;

	WINDOS(
		DDGrSetCurrentCanvas(&dd_VR_screen_pages[0]),
		GrSetCurrentCanvas(&VR_screen_pages[0])
	);

	GrSetCurFont( GAME_FONT );
	GrGetStringSize(msg,&w,&h,&aw);
	x = (grdCurScreen->sc_w-w)/2;
	y = (grdCurScreen->sc_h-h)/4;
	GrSetFontColorRGBi (RGBA (0, PAL2RGBA (28), 0, 255), 1, 0, 0);
   PA_DFX (pa_set_frontbuffer_current());
	PA_DFX (NMDrawBackground(x-15,y-15,x+w+15-1,y+h+15-1));
   PA_DFX (pa_set_backbuffer_current());
   NMDrawBackground(NULL,x-15,y-15,x+w+15-1,y+h+15-1);
WIN(DDGRLOCK(dd_grd_curcanv));
	PA_DFX (pa_set_frontbuffer_current());
  	PA_DFX (GrUString( x, y, msg ));
	PA_DFX (pa_set_backbuffer_current());
  	GrUString( x, y, msg );
WIN(DDGRUNLOCK(dd_grd_curcanv));
	ResetCockpit();
}
예제 #4
0
파일: hud.c 프로젝트: paud/d2x-xl
void ClearBackgroundMessages (void)
{
if (( (gameStates.render.cockpit.nMode == CM_STATUS_BAR) || (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (nLastMsgYCrd != -1) && (gameStates.render.vr.buffers.subRender [0].cvBitmap.bmProps.y >= 6)) {
	gsrCanvas	*canv_save = grdCurCanv;

WINDOS (
	DDGrSetCurrentCanvas (GetCurrentGameScreen ()),
	GrSetCurrentCanvas (GetCurrentGameScreen ())
	);
PA_DFX (pa_set_frontbuffer_current ());
PA_DFX (copy_background_rect (0, nLastMsgYCrd, grdCurCanv->cvBitmap.bmProps.w, nLastMsgYCrd+nLastMsgHeight-1));
PA_DFX (pa_set_backbuffer_current ());
copy_background_rect (0, nLastMsgYCrd, grdCurCanv->cvBitmap.bmProps.w, nLastMsgYCrd+nLastMsgHeight-1);
WINDOS (
	DDGrSetCurrentCanvas (canv_save),
	GrSetCurrentCanvas (canv_save)
	);
	nLastMsgYCrd = -1;
	}
szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage][0] = 0;
}
예제 #5
0
파일: kmatrix.c 프로젝트: paud/d2x-xl
void kmatrix_redraw_coop ()
{
	int i, color;
	int sorted [MAX_NUM_NET_PLAYERS];

MultiSortKillList ();
WIN (DDGRLOCK (dd_grd_curcanv));
grdCurCanv->cv_font = MEDIUM3_FONT;
GrString (0x8000, LHY (10), "COOPERATIVE SUMMARY"	);
grdCurCanv->cv_font = SMALL_FONT;
MultiGetKillList (sorted);
kmatrix_draw_coop_names (sorted);
for (i=0; i<gameData.multi.nPlayers; i++) {
	color = sorted [i];
	if (gameData.multi.players [sorted [i]].connected==0)
		GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0);
	else
		GrSetFontColorRGBi (RGBA_PAL2 (player_rgb  [color].r, player_rgb  [color].g, player_rgb [color].b), 1, 0, 0);
	kmatrix_draw_coop_item (i, sorted);
	}
kmatrix_draw_deaths (sorted);
WIN (DDGRUNLOCK (dd_grd_curcanv));
WINDOS (
	DDGrSetCurrentCanvas (NULL),
	GrSetCurrentCanvas (NULL)
	);
#if defined (POLY_ACC)
pa_save_clut ();
pa_update_clut (grPalette, 0, 256, 0);
#endif
PA_DFX (pa_set_frontbuffer_current ());
PA_DFX (pa_set_backbuffer_current ());
#if defined (POLY_ACC)
pa_restore_clut ();
#endif
GrPaletteStepLoad (NULL);
GrUpdate (0);
}
예제 #6
0
파일: hud.c 프로젝트: paud/d2x-xl
void HUDRenderMessages (ubyte nType)
{
	int			h, i, n, w, y, aw, yStart, nMsg;
	char			*pszMsg;
	tHUDMessage *pMsgs = gameData.hud.msgs + nType;

if ((pMsgs->nMessages < 0) || (pMsgs->nMessages > HUD_MAX_MSGS))
	Int3 (); // Get Rob!
if ((pMsgs->nMessages < 1) && (nModexHUDMsgs == 0))
	return;
pMsgs->xTimer -= gameData.time.xFrame;
if ( pMsgs->xTimer < 0)	{
	// Timer expired... get rid of oldest pszMsg...
	if (pMsgs->nLast != pMsgs->nFirst)	{
		int	temp;

		//&pMsgs->szMsgs.szMsg [pMsgs->nFirst][0] is deing deleted...;
		pMsgs->nFirst = (pMsgs->nFirst + 1) % HUD_MAX_MSGS;
		pMsgs->xTimer = F1_0*2;
		if (!--pMsgs->nMessages)
			nModexHUDMsgs = 2;
		temp = nLastMsgYCrd;
		ClearBackgroundMessages ();			//	If in status bar mode and no messages, then erase.
		if (nModexHUDMsgs)
			nLastMsgYCrd = temp;
	}
}

if (pMsgs->nMessages > 0) {
	if (pMsgs->nColor == -1)
		pMsgs->nColor = GREEN_RGBA;

	if ((gameStates.render.vr.nRenderMode == VR_NONE) && ((gameStates.render.cockpit.nMode == CM_STATUS_BAR) || 
		 (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (gameStates.render.vr.buffers.subRender [0].cvBitmap.bmProps.y >= (gameData.render.window.hMax/8))) {
		// Only display the most recent pszMsg in this mode
		nMsg = (pMsgs->nFirst + pMsgs->nMessages-1) % HUD_MAX_MSGS;
		pszMsg = pMsgs->szMsgs [nMsg];

		if (strcmp (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg)) {
			int	ycrd;
			WINDOS (
				ddgrs_canvas *canv_save = dd_grd_curcanv,
				gsrCanvas	*canv_save = grdCurCanv
				);
			WINDOS (
				ycrd = dd_grd_curcanv->yoff - (SMALL_FONT->ftHeight+2),
				ycrd = grdCurCanv->cvBitmap.bmProps.y - (SMALL_FONT->ftHeight+2)
				);
			if (ycrd < 0)
				ycrd = 0;
			WINDOS (
				DDGrSetCurrentCanvas (GetCurrentGameScreen ()),
				GrSetCurrentCanvas (GetCurrentGameScreen ())
				);
			GrSetCurFont (SMALL_FONT);
			GrGetStringSize (pszMsg, &w, &h, &aw);
			ClearBackgroundMessages ();
			if (grdCurCanv->cvBitmap.bmProps.nType == BM_MODEX) {
				WIN (Int3 ());    // No no no no ....
				ycrd -= h;
				h *= 2;
				HUDModexMessage ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg, SMALL_FONT, 
									  pMsgs->nColor);
				if (nModexHUDMsgs > 0) {
					nModexHUDMsgs--;
					szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage][0] = '!';
					}
				else
					strcpy (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg);
				}
			else {
				WIN (DDGRLOCK (dd_grd_curcanv));
					if (pMsgs->nColor == -1)
						pMsgs->nColor = GREEN_RGBA;
					GrSetFontColorRGBi (pMsgs->nColor, 1, 0, 0);
					PA_DFX (pa_set_frontbuffer_current ());
					PA_DFX (GrPrintF ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg));
					PA_DFX (pa_set_backbuffer_current ());
					GrPrintF ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg);
					strcpy (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg);
				WIN (DDGRUNLOCK (dd_grd_curcanv));
				}
			WINDOS (
				DDGrSetCurrentCanvas (canv_save),
				GrSetCurrentCanvas (canv_save)
				);
			nLastMsgYCrd = ycrd;
			nLastMsgHeight = h;
			}
		} 
	else {
		GrSetCurFont ( SMALL_FONT);
		if ((gameStates.render.cockpit.nMode == CM_FULL_SCREEN) || 
			 (gameStates.render.cockpit.nMode == CM_LETTERBOX)) {
			if (gameData.render.window.w == gameData.render.window.wMax)
				yStart = SMALL_FONT->ftHeight / 2;
			else
				yStart= SMALL_FONT->ftHeight * 2;
		} else
			yStart = SMALL_FONT->ftHeight / 2;
		if (gameOpts->render.cockpit.bGuidedInMainView) {
			tObject *gmP = gameData.objs.guidedMissile [gameData.multiplayer.nLocalPlayer];
			if (gmP && 
				 (gmP->nType == OBJ_WEAPON) && 
				 (gmP->id == GUIDEDMSL_ID) &&
			    (gmP->nSignature == gameData.objs.guidedMissileSig [gameData.multiplayer.nLocalPlayer]))
				yStart += SMALL_FONT->ftHeight + 3;
			}

	WIN (DDGRLOCK (dd_grd_curcanv));
		for (i = 0, y = yStart; i < pMsgs->nMessages; i++)	{
			n = (pMsgs->nFirst + i) % HUD_MAX_MSGS;
			if ((n < 0) || (n >= HUD_MAX_MSGS))
				Int3 (); // Get Rob!!
			if (!strcmp (pMsgs->szMsgs [n], "This is a bug."))
				Int3 (); // Get Rob!!
			GrGetStringSize (pMsgs->szMsgs [n], &w, &h, &aw);
			GrSetFontColorRGBi (pMsgs->nColor, 1, 0, 0);
			PA_DFX (pa_set_frontbuffer_current ());
			y = yStart + i * (h + 1);
			if (nType)
				y += ((2 * HUD_MAX_MSGS - 1) * (h + 1)) / 2;
			PA_DFX (GrString ((grdCurCanv->cvBitmap.bmProps.w-w)/2, y [nType], pMsgs->szMsgs [n]));
			PA_DFX (pa_set_backbuffer_current ());
			GrString ((grdCurCanv->cvBitmap.bmProps.w-w)/2, y, pMsgs->szMsgs [n]);
			if (!gameOpts->render.cockpit.bSplitHUDMsgs) 
				y += h + 1;
			}
		WIN (DDGRUNLOCK (dd_grd_curcanv));
		}
	}
else if (GetCurrentGameScreen ()->cvBitmap.bmProps.nType == BM_MODEX) {
	if (nModexHUDMsgs) {
		int temp = nLastMsgYCrd;
		nModexHUDMsgs--;
		ClearBackgroundMessages ();			//	If in status bar mode and no messages, then erase.
		nLastMsgYCrd = temp;
		}
	}
GrSetCurFont ( GAME_FONT);
}
예제 #7
0
파일: cntrlcen.c 프로젝트: paud/d2x-xl
void DoCountdownFrame ()
{
	fix	oldTime;
	int	fc, h, div_scale;
	static fix cdtFrameTime;

if (!gameData.reactor.bDestroyed) {
	cdtFrameTime = 0;
	return;
	}
cdtFrameTime += gameData.time.xRealFrame;
if (gameStates.limitFPS.bCountDown && !gameStates.app.tick40fps.bTick)
	return;
if (!IS_D2_OEM && !IS_MAC_SHARE && !IS_SHAREWARE) {  // get countdown in OEM and SHAREWARE only
	// On last level, we don't want a countdown.
	if ((gameData.missions.nCurrentMission == gameData.missions.nBuiltinMission) && 
		 (gameData.missions.nCurrentLevel == gameData.missions.nLastLevel)) {
		if (!(gameData.app.nGameMode & GM_MULTI))
			return;
		if (gameData.app.nGameMode & GM_MULTI_ROBOTS)
			return;
		}
	}

//	Control center destroyed, rock the tPlayer's ship.
fc = gameData.reactor.countdown.nSecsLeft;
if (fc > 16)
	fc = 16;
//	At Trainee, decrease rocking of ship by 4x.
div_scale = 1;
if (gameStates.app.nDifficultyLevel == 0)
	div_scale = 4;
h = 3 * F1_0 / 16 + (F1_0 * (16 - fc)) / 32;
gameData.objs.console->mType.physInfo.rotVel.p.x += (FixMul (d_rand () - 16384, h)) / div_scale;
gameData.objs.console->mType.physInfo.rotVel.p.z += (FixMul (d_rand () - 16384, h)) / div_scale;
//	Hook in the rumble sound effect here.
oldTime = gameData.reactor.countdown.nTimer;
if (!TimeStopped ())
	gameData.reactor.countdown.nTimer -= cdtFrameTime;
cdtFrameTime = 0;
gameData.reactor.countdown.nSecsLeft = f2i (gameData.reactor.countdown.nTimer + F1_0 * 7 / 8);
if ((oldTime > COUNTDOWN_VOICE_TIME) && (gameData.reactor.countdown.nTimer <= COUNTDOWN_VOICE_TIME))	{
	DigiPlaySample (SOUND_COUNTDOWN_13_SECS, F3_0);
	}
if (f2i (oldTime + F1_0*7/8) != gameData.reactor.countdown.nSecsLeft) {
	if ((gameData.reactor.countdown.nSecsLeft >= 0) && (gameData.reactor.countdown.nSecsLeft < 10))
		DigiPlaySample ((short) (SOUND_COUNTDOWN_0_SECS + gameData.reactor.countdown.nSecsLeft), F3_0);
	if (gameData.reactor.countdown.nSecsLeft == gameData.reactor.countdown.nTotalTime - 1)
		DigiPlaySample (SOUND_COUNTDOWN_29_SECS, F3_0);
	}						
if (gameData.reactor.countdown.nTimer > 0) {
	fix size,old_size;
	size = (i2f (gameData.reactor.countdown.nTotalTime) - gameData.reactor.countdown.nTimer) / fl2f (0.65);
	old_size = (i2f (gameData.reactor.countdown.nTotalTime) - oldTime) / fl2f (0.65);
	if (size != old_size && (gameData.reactor.countdown.nSecsLeft < (gameData.reactor.countdown.nTotalTime-5)))	// Every 2 seconds!
		DigiPlaySample (SOUND_CONTROL_CENTER_WARNING_SIREN, F3_0);
	}
else {
	int flashValue = f2i (-gameData.reactor.countdown.nTimer * (64 / 4));	// 4 seconds to total whiteness
	if (oldTime > 0)
		DigiPlaySample (SOUND_MINE_BLEW_UP, F1_0);
	PALETTE_FLASH_SET (flashValue, flashValue, flashValue);
	if (gameStates.ogl.palAdd.blue > 64) {
		WINDOS (
			DDGrSetCurrentCanvas (NULL),
			GrSetCurrentCanvas (NULL)
			);
		WINDOS (
			dd_gr_clear_canvas (RGBA_PAL2 (31,31,31)),
			GrClearCanvas (RGBA_PAL2 (31,31,31))
			);														//make screen all white to match palette effect
		ResetCockpit ();								//force cockpit redraw next time
		ResetPaletteAdd ();							//restore palette for death message
		//controlcen->MaxCapacity = gameData.matCens.xFuelMaxAmount;
		//gauge_message ("Control Center Reset");
		DoPlayerDead ();		//kill_player ();
		}																				
	}
}
예제 #8
0
파일: scores.c 프로젝트: paud/d2x-xl
void scores_view(int citem)
{
	fix t0 = 0, t1;
	int c,i,done,looper;
	int k, bRedraw = 0;
	sbyte fades[64] = { 1,1,1,2,2,3,4,4,5,6,8,9,10,12,13,15,16,17,19,20,22,23,24,26,27,28,28,29,30,30,31,31,31,31,31,30,30,29,28,28,27,26,24,23,22,20,19,17,16,15,13,12,10,9,8,6,5,4,4,3,2,2,1,1 };
	bkg bg;
	
	memset (&bg, 0, sizeof (bg));

ReshowScores:
	scores_read();

	SetScreenMode(SCREEN_MENU);
 
	WINDOS(	DDGrSetCurrentCanvas(NULL),
				GrSetCurrentCanvas(NULL)
	);
	
	xOffs = (grdCurCanv->cv_bitmap.bm_props.w - 640) / 2;
	yOffs = (grdCurCanv->cv_bitmap.bm_props.h - 480) / 2;
	if (xOffs < 0)
		xOffs = 0;
	if (yOffs < 0)
		yOffs = 0; 

	GameFlushInputs();

	done = 0;
	looper = 0;

	while(!done)	{
		if (!bRedraw || gameOpts->menus.nStyle) {
			NMDrawBackground(&bg,xOffs, yOffs, xOffs + 640, xOffs + 480, bRedraw);
			grdCurCanv->cv_font = MEDIUM3_FONT;

		WIN(DDGRLOCK(dd_grd_curcanv));
			GrString( 0x8000, yOffs + LHY(15), TXT_HIGH_SCORES );

			grdCurCanv->cv_font = SMALL_FONT;

			GrSetFontColorRGBi (RGBA_PAL (31,26,5), 1, 0, 0);
			GrString(  xOffs + LHX(31+33+XX), yOffs + LHY(46+7+YY), TXT_NAME );
			GrString(  xOffs + LHX(82+33+XX), yOffs + LHY(46+7+YY), TXT_SCORE );
			GrString( xOffs + LHX(127+33+XX), yOffs + LHY(46+7+YY), TXT_SKILL );
			GrString( xOffs + LHX(170+33+XX), yOffs + LHY(46+7+YY), TXT_LEVELS );
		//	GrString( 202, 46, "Kills" );
		//	GrString( 234, 46, "Rescues" );
			GrString( xOffs + LHX(288-42+XX), yOffs + LHY(46+7+YY), TXT_TIME );

			if ( citem < 0 )	
				GrString( 0x8000, yOffs + LHY(175), TXT_PRESS_CTRL_R );

			GrSetFontColorRGBi (RGBA_PAL (28,28,28), 1, 0, 0);

			//GrPrintF( 0x8000, yOffs + LHY(31), "%c%s%c  - %s", 34, Scores.cool_saying, 34, Scores.stats[0].name );
		WIN(DDGRUNLOCK(dd_grd_curcanv));	

			for (i=0; i<MAX_HIGH_SCORES; i++ )		{
				//@@if (i==0)	{
				//@@	GrSetFontColorRGBi (RGBA_PAL (28,28,28), 1, 0, 0);
				//@@} else {
				//@@	GrSetFontColor( grFadeTable[BM_XRGB(28,28,28)+((28-i*2)*256)], 1, 0, 0);
				//@@}														 
				c = 28 - i * 2;
				GrSetFontColorRGBi (RGBA_PAL (c, c, c), 1, 0, 0);
				scores_draw_item( i, Scores.stats + i);
			}

			GrPaletteFadeIn( NULL,32, 0);

		#ifdef OGL
			if (citem < 0)
				GrUpdate (0);
		#endif
			bRedraw = 1;
			}
		if ( citem > -1 )	{
	
			t1	= TimerGetFixedSeconds();
			//if (t1 - t0 >= F1_0/128 ) 
			{
				t0 = t1;
				//@@GrSetFontColor( grFadeTable[fades[looper]*256+BM_XRGB(28,28,28)], -1 );
				c = 7 + fades [looper];
				GrSetFontColorRGBi (RGBA_PAL (c, c, c), 1, 0, 0);
				if (++looper > 63) 
				 looper=0;
				if ( citem ==  MAX_HIGH_SCORES )
					scores_draw_item( MAX_HIGH_SCORES, &Last_game );
				else
					scores_draw_item( citem, Scores.stats + citem );
				}
			GrUpdate (0);
		}

		for (i=0; i<4; i++ )	
			if (joy_get_button_down_cnt(i)>0) done=1;
		for (i=0; i<3; i++ )	
			if (MouseButtonDownCount(i)>0) done=1;

		//see if redbook song needs to be restarted
		songs_check_redbook_repeat();

	#ifdef WINDOWS
		{
			MSG msg;

			DoMessageStuff(&msg);

			if (_RedrawScreen) {
				_RedrawScreen = FALSE;
				goto ReshowScores;
			}

			DDGRRESTORE;
	 	}
	#endif

		k = KeyInKey();
		switch( k )	{
		case KEY_CTRLED+KEY_R:		
			if ( citem < 0 )		{
				// Reset scores...
				if ( ExecMessageBox( NULL, NULL, 2,  TXT_NO, TXT_YES, TXT_RESET_HIGH_SCORES )==1 )	{
					CFDelete(get_scores_filename(), gameFolders.szDataDir);
					GrPaletteFadeOut (NULL, 32, 0 );
					goto ReshowScores;
				}
			}
			break;
		case KEY_BACKSP:				Int3(); k = 0; break;
		case KEY_PRINT_SCREEN:		SaveScreenShot (NULL, 0); k = 0; break;
			
		case KEY_ENTER:
		case KEY_SPACEBAR:
		case KEY_ESC:
			done=1;
			break;
		}
	}

// Restore background and exit
	GrPaletteFadeOut (NULL, 32, 0 );

#ifdef WINDOWS
	DDGRRESTORE;
#endif

	WINDOS(	DDGrSetCurrentCanvas(NULL),
				GrSetCurrentCanvas(NULL)
	);

	GameFlushInputs();
	NMRemoveBackground (&bg);
	
}
예제 #9
0
void do_countdown_frame()
{
	fix	old_time;
	int	fc, div_scale;

	if (!Control_center_destroyed)	return;

	#if !defined(D2_OEM) && !defined(SHAREWARE)	// get countdown in OEM and SHAREWARE only
	//	On last level, we don't want a countdown.
	if ((Current_mission_num == 0) && (Current_level_num == Last_level))
    {		
     if (!(Game_mode & GM_MULTI))
	   return;
	  if (Game_mode & GM_MULTI_ROBOTS)
		return;
    }	 
	#endif
   
	//	Control center destroyed, rock the player's ship.
	fc = Countdown_seconds_left;
	if (fc > 16)
		fc = 16;

	//	At Trainee, decrease rocking of ship by 4x.
	div_scale = 1;
	if (Difficulty_level == 0)
		div_scale = 4;

	ConsoleObject->mtype.phys_info.rotvel.x += (fixmul(rand() - 16384, 3*F1_0/16 + (F1_0*(16-fc))/32))/div_scale;
	ConsoleObject->mtype.phys_info.rotvel.z += (fixmul(rand() - 16384, 3*F1_0/16 + (F1_0*(16-fc))/32))/div_scale;
	//	Hook in the rumble sound effect here.

	old_time = Countdown_timer;
	Countdown_timer -= RealFrameTime;
	Countdown_seconds_left = f2i(Countdown_timer + F1_0*7/8);

	if ( (old_time > COUNTDOWN_VOICE_TIME ) && (Countdown_timer <= COUNTDOWN_VOICE_TIME) )	{
		digi_play_sample( SOUND_COUNTDOWN_13_SECS, F3_0 );
	}
	if ( f2i(old_time + F1_0*7/8) != Countdown_seconds_left )	{
		if ( (Countdown_seconds_left>=0) && (Countdown_seconds_left<10) ) 
			digi_play_sample( SOUND_COUNTDOWN_0_SECS+Countdown_seconds_left, F3_0 );
		if ( Countdown_seconds_left==Total_countdown_time-1)
			digi_play_sample( SOUND_COUNTDOWN_29_SECS, F3_0 );
	}						

	if (Countdown_timer > 0) {
		fix size,old_size;
		size = (i2f(Total_countdown_time)-Countdown_timer) / fl2f(0.65);
		old_size = (i2f(Total_countdown_time)-old_time) / fl2f(0.65);
		if (size != old_size && (Countdown_seconds_left < (Total_countdown_time-5) ))		{			// Every 2 seconds!
			//@@if (Dead_controlcen_object_num != -1) {
			//@@	vms_vector vp;	//,v,c;
			//@@	compute_segment_center(&vp, &Segments[Objects[Dead_controlcen_object_num].segnum]);
			//@@	object_create_explosion( Objects[Dead_controlcen_object_num].segnum, &vp, size*10, VCLIP_SMALL_EXPLOSION);
			//@@}

			digi_play_sample( SOUND_CONTROL_CENTER_WARNING_SIREN, F3_0 );
		}
	}  else {
		int flash_value;

		if (old_time > 0)
			digi_play_sample( SOUND_MINE_BLEW_UP, F1_0 );

		flash_value = f2i(-Countdown_timer * (64 / 4));	// 4 seconds to total whiteness
		PALETTE_FLASH_SET(flash_value,flash_value,flash_value);

		if (PaletteBlueAdd > 64 )	{
		WINDOS(
			dd_gr_set_current_canvas(NULL),
			gr_set_current_canvas( NULL )
		);
		WINDOS(
			dd_gr_clear_canvas(BM_XRGB(31,31,31)),
			gr_clear_canvas(BM_XRGB(31,31,31))
		);														//make screen all white to match palette effect
			reset_cockpit();								//force cockpit redraw next time
			reset_palette_add();							//restore palette for death message
			//controlcen->MaxCapacity = Fuelcen_max_amount;
			//gauge_message( "Control Center Reset" );
			DoPlayerDead();		//kill_player();
		}																				
	}
}