예제 #1
0
파일: menuitem.cpp 프로젝트: paud/d2x-xl
short CMenuItem::SetColor (int bIsCurrent, int bTiny) 
{
if (bTiny) {
	if (!gameData.menu.bValid) {
		gameData.menu.warnColor = RED_RGBA;
		gameData.menu.keyColor = RGB_PAL (57, 49, 20);
		gameData.menu.tabbedColor = WHITE_RGBA;
		gameData.menu.tinyColors [0][0] = RGB_PAL (29, 29, 47);
		gameData.menu.tinyColors [0][1] = RED_RGBA;
		gameData.menu.tinyColors [1][0] = RGB_PAL (57, 49, 20);
		gameData.menu.tinyColors [1][1] = ORANGE_RGBA;
		gameData.menu.bValid = 1;
		}
	if (gameData.menu.colorOverride)
		fontManager.SetColorRGBi (gameData.menu.colorOverride, 1, 0, 0);
	else if (m_text [0] == '\t')
		fontManager.SetColorRGBi (gameData.menu.tabbedColor, 1, 0, 0);
	else 
		fontManager.SetColorRGBi (gameData.menu.tinyColors [bIsCurrent][m_bUnavailable], 1, 0, 0);
	}
else {
	if (bIsCurrent)
		fontManager.SetCurrent (SELECTED_FONT);
	else
		fontManager.SetCurrent (NORMAL_FONT);
	}
return CCanvas::Current ()->FontColor (0).index;
}
예제 #2
0
파일: statusbar.cpp 프로젝트: paud/d2x-xl
void CStatusBar::DrawScore (void)
{	                                                                                                                                                                                                                                                             
	char	szScore [20];
	int 	x, y;
	int	w, h, aw;

	static int lastX [4] = {SB_SCORE_RIGHT_L, SB_SCORE_RIGHT_L, SB_SCORE_RIGHT_H, SB_SCORE_RIGHT_H};
	static int nIdLabel = 0, nIdScore = 0;

CCanvas::Push ();
fontManager.SetScale (floor (float (CCanvas::Current ()->Width ()) / 640.0f));
CCanvas::SetCurrent (CurrentGameScreen ());
strcpy (szScore, (IsMultiGame && !IsCoopGame) ? TXT_KILLS : TXT_SCORE);
strcat (szScore, ":");
fontManager.Current ()->StringSize (szScore, w, h, aw);
fontManager.SetColorRGBi (MEDGREEN_RGBA, 1, 0, 0);
nIdLabel = PrintF (&nIdLabel, -(ScaleX (SB_SCORE_LABEL_X + int (w / fontManager.Scale ())) - w), SB_SCORE_Y, szScore);

sprintf (szScore, "%5d", (IsMultiGame && !IsCoopGame) ? LOCALPLAYER.netKillsTotal : LOCALPLAYER.score);
fontManager.Current ()->StringSize (szScore, w, h, aw);
x = ScaleX (SB_SCORE_RIGHT) - w - LHY (2);
y = SB_SCORE_Y;
#if 0
//erase old score
CCanvas::Current ()->SetColorRGBi (RGB_PAL (0, 0, 0));
Rect (lastX [(gameStates.video.nDisplayMode ? 2 : 0) + gameStates.render.vr.nCurrentPage], y, SB_SCORE_RIGHT, y + GAME_FONT->Height ());
#endif
fontManager.SetColorRGBi ((IsMultiGame && !IsCoopGame) ? MEDGREEN_RGBA : GREEN_RGBA, 1, 0, 0);
nIdScore = PrintF (&nIdScore, -x, y, szScore);
lastX [(gameStates.video.nDisplayMode ? 2 : 0) + gameStates.render.vr.nCurrentPage] = x;
fontManager.SetScale (1.0f);
CCanvas::Pop ();
}
예제 #3
0
파일: statusbar.cpp 프로젝트: paud/d2x-xl
void CStatusBar::ClearBombCount (int bgColor)
{
CCanvas::Push ();
CCanvas::SetCurrent (CurrentGameScreen ());
CCanvas::Current ()->SetColorRGBi (bgColor);
if (!gameStates.video.nDisplayMode) {
	Rect (169, 189, 189, 196);
	CCanvas::Current ()->SetColorRGBi (RGB_PAL (128, 128, 128));
	OglDrawLine (ScaleX (168), ScaleY (189), ScaleX (189), ScaleY (189));
	}
else {
	OglDrawFilledRect (ScaleX (338), ScaleY (453), ScaleX (378), ScaleY (470));
	CCanvas::Current ()->SetColorRGBi (RGB_PAL (128, 128, 128));
	OglDrawLine (ScaleX (336), ScaleY (453), ScaleX (378), ScaleY (453));
	}
CCanvas::Pop ();
}
예제 #4
0
파일: menuitem.cpp 프로젝트: paud/d2x-xl
void CMenuItem::ShowHelp (void)
{
if (m_szHelp && *m_szHelp) {
	int nInMenu = gameStates.menus.nInMenu;
	gameStates.menus.nInMenu = 0;
	gameData.menu.helpColor = RGB_PAL (47, 47, 47);
	gameData.menu.colorOverride = gameData.menu.helpColor;
	MsgBox ("D2X - XL online help", NULL, - 3, m_szHelp, " ", TXT_CLOSE);
	gameData.menu.colorOverride = 0;
	gameStates.menus.nInMenu = nInMenu;
	}
}
예제 #5
0
파일: statusbar.cpp 프로젝트: paud/d2x-xl
void CStatusBar::DrawLives (void)
{
	static int nIdLives [2] = {0, 0}, nIdKilled = 0;
  
	char		szLives [20];
	int		w, h, aw;

CCanvas::Push ();
fontManager.SetScale (floor (float (CCanvas::Current ()->Width ()) / 640.0f));
CCanvas::SetCurrent (CurrentGameScreen ());
fontManager.SetColorRGBi (MEDGREEN_RGBA, 1, 0, 0);
strcpy (szLives, IsMultiGame ? TXT_DEATHS : TXT_LIVES);
fontManager.Current ()->StringSize (szLives, w, h, aw);
nIdLives [0] = PrintF (&nIdLives [0], -(ScaleX (SB_LIVES_LABEL_X + int (w / fontManager.Scale ())) - w), -ScaleY (SB_LIVES_LABEL_Y + HeightPad ()), szLives);

if (IsMultiGame) {
	static int lastX [4] = {SB_SCORE_RIGHT_L, SB_SCORE_RIGHT_L, SB_SCORE_RIGHT_H, SB_SCORE_RIGHT_H};

	char	szKilled [20];
	int	x = SB_LIVES_X, 
			y = -(ScaleY (SB_LIVES_Y + 1) + HeightPad ());

	sprintf (szKilled, "%5d", LOCALPLAYER.netKilledTotal);
	fontManager.Current ()->StringSize (szKilled, w, h, aw);
	CCanvas::Current ()->SetColorRGBi (RGB_PAL (0, 0, 0));
	Rect (lastX [(gameStates.video.nDisplayMode ? 2 : 0) + gameStates.render.vr.nCurrentPage], 
			y + 1, SB_SCORE_RIGHT, y + GAME_FONT->Height ());
	fontManager.SetColorRGBi (MEDGREEN_RGBA, 1, 0, 0);
	x = SB_SCORE_RIGHT - w - 2;	
	nIdKilled = PrintF (&nIdKilled, x, y + 1, szKilled);
	lastX [(gameStates.video.nDisplayMode ? 2 : 0) + gameStates.render.vr.nCurrentPage] = x;
	}
else if (LOCALPLAYER.lives > 1) {
	int y = -ScaleY (SB_LIVES_Y + HeightPad ());
	fontManager.SetColorRGBi (MEDGREEN_RGBA, 1, 0, 0);
	CBitmap* bmP = BitBlt (GAUGE_LIVES, SB_LIVES_X, SB_LIVES_Y);
	nIdLives [1] = PrintF (&nIdLives [1], SB_LIVES_X + bmP->Width () + m_info.fontWidth, y, "x %d", LOCALPLAYER.lives - 1);
	}
fontManager.SetScale (1.0f);
CCanvas::Pop ();
}
예제 #6
0
void CMovie::ShowFrame (ubyte* buf, uint bufw, uint bufh, uint sx, uint sy, uint w, uint h, uint dstx, uint dsty)
{
	CBitmap bmFrame;

bmFrame.Init (BM_LINEAR, 0, 0, bufw, bufh, 1, buf);
bmFrame.SetPalette (movieManager.m_palette);

TRANSPARENCY_COLOR = 0;
if (gameOpts->movies.bFullScreen) {
	double r = (double) bufh / (double) bufw;
	int dh = (int) (CCanvas::Current ()->Width () * r);
	int yOffs = (CCanvas::Current ()->Height () - dh) / 2;

	ogl.SetBlending (false);
	bmFrame.Render (CCanvas::Current (), 0, yOffs, CCanvas::Current ()->Width (), dh, sx, sy, bufw, bufh, 1, 0, gameOpts->movies.nQuality);
	ogl.SetBlending (true);
	}
else {
	int xOffs = (CCanvas::Current ()->Width () - 640) / 2;
	int yOffs = (CCanvas::Current ()->Height () - 480) / 2;

	if (xOffs < 0)
		xOffs = 0;
	if (yOffs < 0)
		yOffs = 0;
	dstx += xOffs;
	dsty += yOffs;
	bmFrame.Blit (CCanvas::Current (), dstx, dsty, bufw, bufh, sx, sy, 1);
	if ((CCanvas::Current ()->Width () > 640) || (CCanvas::Current ()->Height () > 480)) {
		CCanvas::Current ()->SetColorRGBi (RGB_PAL (0, 0, 32));
		OglDrawEmptyRect (dstx - 1, dsty, dstx + w, dsty + h + 1);
		}
	}
TRANSPARENCY_COLOR = DEFAULT_TRANSPARENCY_COLOR;
bmFrame.SetBuffer (NULL);
}
예제 #7
0
파일: descent.cpp 프로젝트: paud/d2x-xl
void PrintVersionInfo (void)
{
if (gameStates.app.bGameRunning || gameStates.app.bBetweenLevels)
	return;

	static int bVertigo = -1;

	int y, w, ws, h, hs, aw;
	float grAlpha = gameStates.render.grAlpha;

gameStates.render.grAlpha = 1.0f;
if (gameStates.menus.bHires) {
	if (gameOpts->menus.altBg.bHave > 0)
		y = 8; //102
	else {
		y = (88 * (gameStates.render.vr.nScreenSize % 65536)) / 480;
		if (y < 88)
			y = 88;
		}
	}
else
	y = 37;

gameStates.menus.bDrawCopyright = 0;
CCanvas::Push ();
CCanvas::SetCurrent (NULL);
fontManager.SetCurrent (GAME_FONT);
fontManager.Current ()->StringSize ("V2.2", w, h, aw);
fontManager.SetColorRGBi (RGB_PAL (63, 47, 0), 1, 0, 0);
GrPrintF (NULL, 0x8000, CCanvas::Current ()->Height () - GAME_FONT->Height () - 2, "visit www.descent2.de");
fontManager.SetColorRGBi (RGB_PAL (23, 23, 23), 1, 0, 0);
GrPrintF (NULL, 0x8000, CCanvas::Current ()->Height () - GAME_FONT->Height () - h - 6, TXT_COPYRIGHT);
GrPrintF (NULL, CCanvas::Current ()->Width () - w - 2, 
			 CCanvas::Current ()->Height () - GAME_FONT->Height () - h - 6, "V%d.%d", D2X_MAJOR, D2X_MINOR);
if (bVertigo < 0)
	bVertigo = CFile::Exist ("d2x.hog", gameFolders.szMissionDir, 0);
if (bVertigo) {
	fontManager.SetCurrent (MEDIUM2_FONT);
	fontManager.Current ()->StringSize (TXT_VERTIGO, w, h, aw);
	GrPrintF (NULL, CCanvas::Current ()->Width () - w - SUBVER_XOFFS, 
				 y + (gameOpts->menus.altBg.bHave ? h + 2 : 0), TXT_VERTIGO);
	}
fontManager.SetCurrent (MEDIUM2_FONT);
fontManager.Current ()->StringSize (D2X_NAME, w, h, aw);
GrPrintF (NULL, CCanvas::Current ()->Width () - w - SUBVER_XOFFS, 
			 y + ((bVertigo && !gameOpts->menus.altBg.bHave) ? h + 2 : 0), D2X_NAME);
fontManager.SetCurrent (SMALL_FONT);
fontManager.Current ()->StringSize (VERSION, ws, hs, aw);
fontManager.SetColorRGBi (D2BLUE_RGBA, 1, 0, 0);
GrPrintF (NULL, CCanvas::Current ()->Width () - ws - 1, 
			 y + ((bVertigo && !gameOpts->menus.altBg.bHave) ? h + 2 : 0) + (h - hs) / 2, VERSION);
#if 0
if (!ogl.m_states.bShadersOk) {
	fontManager.SetColorRGBi (RGB_PAL (63, 0, 0), 1, 0, 0);
	GrPrintF (NULL, 0x8000, CCanvas::Current ()->Height () - 5 * (fontManager.Current ()->Height () + 2), "due to insufficient graphics hardware,");
	GrPrintF (NULL, 0x8000, CCanvas::Current ()->Height () - 4 * (fontManager.Current ()->Height () + 2), "D2X-XL will run at reduced settings.");
	}
#endif
fontManager.SetColorRGBi (RGB_PAL (6, 6, 6), 1, 0, 0);
CCanvas::Pop ();
gameStates.render.grAlpha = grAlpha;
}