Пример #1
0
/*
 ==================
 UI_Cinematics_Ownerdraw
 ==================
*/
static void UI_Cinematics_Ownerdraw (void *self){

	menuCommon_t	*item = (menuCommon_t *)self;
	int				x = 566, y = 210, w = 412, h = 348;

	if (item->id == ID_CINPREVIEW){
		UI_ScaleCoords(&x, &y, &w, &h);

		// Draw black background, cinematic frame and box
		UI_FillRect(x, y, w, h, colorBlack);

		if (uiStatic.playingCinematic){
//			CIN_UpdateCinematic();
//			CIN_DrawCinematic();
		}

		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, ((menuBitmap_t *)self)->pic);
	}
	else {
		if (uiCinematics.menu.items[uiCinematics.menu.cursor] == self)
			UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, UI_MOVEBOXFOCUS);
		else
			UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, UI_MOVEBOX);

		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, ((menuBitmap_t *)self)->pic);
	}
}
Пример #2
0
/*
 ==================
 UI_Performance_Ownerdraw
 ==================
*/
static void UI_Performance_Ownerdraw (void *self){

	menuCommon_t	*item = (menuCommon_t *)self;

	if (uiPerformance.menu.items[uiPerformance.menu.cursor] == self)
		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, UI_MOVEBOXFOCUS);
	else
		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, UI_MOVEBOX);

	UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, ((menuBitmap_t *)self)->pic);
}
Пример #3
0
/*
 ==================
 UI_Video_Ownerdraw
 ==================
*/
static void UI_Video_Ownerdraw (void *self){

	menuCommon_t	*item = (menuCommon_t *)self;

	if (uiVideo.menu.items[uiVideo.menu.cursor] == self)
		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, UI_MOVEBOXFOCUS);
	else
		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, UI_MOVEBOX);

	if (item->flags & QMF_GRAYED)
		UI_DrawPic(item->x, item->y, item->width, item->height, uiColorDarkGray, ((menuBitmap_t *)self)->pic);
	else
		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, ((menuBitmap_t *)self)->pic);
}
Пример #4
0
/*
=================
UI_LoadGame_Ownerdraw
=================
*/
static void UI_LoadGame_Ownerdraw( void *self )
{
	menuCommon_s	*item = (menuCommon_s *)self;

	if( item->type != QMTYPE_ACTION && item->id == ID_LEVELSHOT )
	{
		int	x, y, w, h;

		// draw the levelshot
		x = LEVELSHOT_X;
		y = LEVELSHOT_Y;
		w = LEVELSHOT_W;
		h = LEVELSHOT_H;
		
		UI_ScaleCoords( &x, &y, &w, &h );

		if( strlen( uiLoadGame.saveName[uiLoadGame.savesList.curItem] ))
		{
			char	saveshot[128];

			sprintf( saveshot, "save/%s.bmp", uiLoadGame.saveName[uiLoadGame.savesList.curItem] );

			if( !FILE_EXISTS( saveshot ))
				UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
			else UI_DrawPic( x, y, w, h, uiColorWhite, saveshot );
		}
		else UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );

		// draw the rectangle
		UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );
	}
}
Пример #5
0
/*
=================
UI_VidOptions_Ownerdraw
=================
*/
static void UI_VidOptions_Ownerdraw( void *self )
{
	menuCommon_s	*item = (menuCommon_s *)self;
	int		color = 0xFFFF0000; // 255, 0, 0, 255
	int		viewport[4];
	int		viewsize, size, sb_lines;

	viewsize = CVAR_GET_FLOAT( "viewsize" );

	if( viewsize >= 120 )
		sb_lines = 0;	// no status bar at all
	else if( viewsize >= 110 )
		sb_lines = 24;	// no inventory
	else sb_lines = 48;

	size = min( viewsize, 100 );

	viewport[2] = item->width * size / 100;
	viewport[3] = item->height * size / 100;

	if( viewport[3] > item->height - sb_lines )
		viewport[3] = item->height - sb_lines;
	if( viewport[3] > item->height )
		viewport[3] = item->height;

	viewport[2] &= ~7;
	viewport[3] &= ~1;

	viewport[0] = (item->width - viewport[2]) / 2;
	viewport[1] = (item->height - sb_lines - viewport[3]) / 2;

	UI_DrawPic( item->x + viewport[0], item->y + viewport[1], viewport[2], viewport[3], uiColorWhite, ((menuBitmap_s *)self)->pic );
	UI_DrawRectangleExt( item->x, item->y, item->width, item->height, color, uiVidOptions.outlineWidth );
}
Пример #6
0
/*
=================
UI_VidOptions_Ownerdraw
=================
*/
static void UI_VidOptions_Ownerdraw( void *self )
{
	menuCommon_s	*item = (menuCommon_s *)self;
	int		color = 0xFFFF0000; // 255, 0, 0, 255

	UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
	UI_DrawRectangleExt( item->x, item->y, item->width, item->height, color, uiVidOptions.outlineWidth );
}
/*
=================
UI_Credits_DrawFunc
=================
*/
static void UI_Credits_DrawFunc( void )
{
	int	i, y;
	float	speed = 40.0f;
	int	w = UI_MED_CHAR_WIDTH;
	int	h = UI_MED_CHAR_HEIGHT;
	int	color = 0;

	// draw the background first
	if( !uiCredits.finalCredits && !CVAR_GET_FLOAT( "sv_background" ))
		UI_DrawPic( 0, 0, 1024 * uiStatic.scaleX, 768 * uiStatic.scaleY, uiColorWhite, ART_BACKGROUND );
	else speed = 45.0f;	// syncronize with final background track :-)

	// otherwise running on cutscene
	speed = 32.0f * (768.0f / ScreenHeight);

	// now draw the credits
	UI_ScaleCoords( NULL, NULL, &w, &h );

	y = ScreenHeight - (((gpGlobals->time * 1000) - uiCredits.startTime ) / speed );

	// draw the credits
	for ( i = 0; i < uiCredits.numLines && uiCredits.credits[i]; i++, y += h )
	{
		// skip not visible lines, but always draw end line
		if( y <= -h && i != uiCredits.numLines - 1 ) continue;

		if(( y < ( ScreenHeight - h ) / 2 ) && i == uiCredits.numLines - 1 )
		{
			if( !uiCredits.fadeTime ) uiCredits.fadeTime = (gpGlobals->time * 1000);
			color = UI_FadeAlpha( uiCredits.fadeTime, uiCredits.showTime );
			if( UnpackAlpha( color ))
				UI_DrawString( 0, ( ScreenHeight - h ) / 2, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], color, true, w, h, 1, true );
		}
		else UI_DrawString( 0, y, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], uiColorWhite, false, w, h, 1, true );
	}

	if( y < 0 && UnpackAlpha( color ) == 0 )
	{
		uiCredits.active = false; // end of credits
		if( uiCredits.finalCredits )
			HOST_ENDGAME( gMenu.m_gameinfo.title );
	}

	if( !uiCredits.active )
		UI_PopMenu();
}
Пример #8
0
/*
=================
UI_DrawBackground_Callback
=================
*/
void UI_DrawBackground_Callback( void *self )
{
	if (!uiStatic.m_fHaveSteamBackground)
	{
		menuCommon_s *item = (menuCommon_s *)self;
		UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
		return;
	}

	int xpos, ypos;
	float xScale, yScale;

	// work out scaling factors
	xScale = ScreenWidth / uiStatic.m_flTotalWidth;
	yScale = ScreenHeight / uiStatic.m_flTotalHeight;

	// iterate and draw all the background pieces
	ypos = 0;
	for (int y = 0; y < BACKGROUND_ROWS; y++)
	{
		xpos = 0;
		for (int x = 0; x < BACKGROUND_COLUMNS; x++)
		{
			bimage_t &bimage = uiStatic.m_SteamBackground[y][x];

			int dx = (int)ceil(xpos * xScale);
			int dy = (int)ceil(ypos * yScale);
			int dw = (int)ceil(bimage.width * xScale);
			int dt = (int)ceil(bimage.height * yScale);

			if (x == 0) dx = 0;
			if (y == 0) dy = 0;

			PIC_Set( bimage.hImage, 255, 255, 255, 255 );
			PIC_Draw( dx, dy, dw, dt );
			xpos += bimage.width;
		}
		ypos += uiStatic.m_SteamBackground[y][0].height;
	}
}
Пример #9
0
/*
=================
UI_Crosshair_Ownerdraw
=================
*/
static void UI_Crosshair_Ownerdraw( void *self )
{
	menuBitmap_s *item = (menuBitmap_s*)self;

	UI_DrawPic(item->generic.x, item->generic.y, item->generic.width, item->generic.height, 0x00FFFFFF, "gfx/vgui/crosshair" );


	int l;
	switch( (int)uiPlayerSetup.crosshairSize.curValue )
	{
	case 1:
		l = 10;
		break;
	case 2:
		l = 20;
		break;
	case 3:
		l = 30;
		break;
	case 0:
		if( ScreenWidth < 640 )
			l = 30;
		else if( ScreenWidth < 1024 )
			l = 20;
		else l = 10;
	}

	l *= ScreenHeight / 768.0f;

	int x = item->generic.x, // xpos
		y = item->generic.y, // ypos
		w = item->generic.width, // width
		h = item->generic.height, // height
		// delta distance
		d = (item->generic.width / 2 - l) * 0.5,
		// alpha
		a = 180,
		// red
		r = g_iCrosshairAvailColors[(int)uiPlayerSetup.crosshairColor.curValue][0],
		// green
		g = g_iCrosshairAvailColors[(int)uiPlayerSetup.crosshairColor.curValue][1],
		// blue
		b = g_iCrosshairAvailColors[(int)uiPlayerSetup.crosshairColor.curValue][2];

	if( uiPlayerSetup.crosshairTranslucent.enabled )
	{
		// verical
		PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a);
		PIC_DrawTrans(x + w / 2, y + d,         1, l );

		PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a);
		PIC_DrawTrans(x + w / 2, y + h / 2 + d, 1, l );

		// horizontal
		PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a);
		PIC_DrawTrans(x + d,         y + h / 2, l, 1 );

		PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a);
		PIC_DrawTrans(x + w / 2 + d, y + h / 2, l, 1 );
	}
	else
	{
		// verical
		PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a);
		PIC_DrawAdditive(x + w / 2, y + d,         1, l );

		PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a);
		PIC_DrawAdditive(x + w / 2, y + h / 2 + d, 1, l );

		// horizontal
		PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a);
		PIC_DrawAdditive(x + d,         y + h / 2, l, 1 );

		PIC_Set(uiPlayerSetup.uiWhite, r, g, b, a);
		PIC_DrawAdditive(x + w / 2 + d, y + h / 2, l, 1 );
	}

#if 0
	// verical
	FillRGBA(x + w / 2, y + d,         1, l, r, g, b, a);
	FillRGBA(x + w / 2, y + h / 2 + d, 1, l, r, g, b, a);

	// horizontal
	FillRGBA(x + d,         y + h / 2, l, 1, r, g, b, a);
	FillRGBA(x + w / 2 + d, y + h / 2, l, 1, r, g, b, a);
#endif
}