Example #1
0
/*
================
CG_FillRect

Coordinates are 640*480 virtual values
=================
*/
void CG_FillRect(float x, float y, float width, float height, const float *color)
{
	trap_R_SetColor(color);

	CG_AdjustFrom640(&x, &y, &width, &height);
	trap_R_DrawStretchPic(x, y, width, height, 0, 0, 0, 0, cgs.media.whiteShader);

	trap_R_SetColor(NULL);
}
Example #2
0
/**
 * @brief UI_DrawRect
 * Coordinates are 640*480 virtual values
 */
void UI_DrawRect(float x, float y, float width, float height, const float *color)
{
	trap_R_SetColor(color);

	UI_DrawTopBottom(x, y, width, height);
	UI_DrawSides(x, y, width, height);

	trap_R_SetColor(NULL);
}
Example #3
0
//Gordon: Modified to have configurable drop shadow offset
void CG_DrawStringExt_Shadow(int x, int y, const char *string, const float *setColor,
                             qboolean forceColor, int shadow, int charWidth, int charHeight, int maxChars) {
	vec4_t     color;
	const char *s;
	int        xx;
	int        cnt;

	if (maxChars <= 0) {
		maxChars = 32767; // do them all!

	}
	// draw the drop shadow
	if (shadow) {
		color[0] = color[1] = color[2] = 0;
		color[3] = setColor[3];
		trap_R_SetColor(color);
		s   = string;
		xx  = x;
		cnt = 0;
		while (*s && cnt < maxChars) {
			if (Q_IsColorString(s)) {
				s += 2;
				continue;
			}
			CG_DrawChar2(xx + ((charWidth < 12) ? 1 : 2), y + ((charHeight < 12) ? 1 : 2), charWidth, charHeight, *s);
			cnt++;
			xx += charWidth;
			s++;
		}
	}

	// draw the colored text
	s   = string;
	xx  = x;
	cnt = 0;
	trap_R_SetColor(setColor);
	while (*s && cnt < maxChars) {
		if (Q_IsColorString(s)) {
			if (!forceColor) {
				if (*(s + 1) == COLOR_NULL) {
					memcpy(color, setColor, sizeof (color));
				} else {
					memcpy(color, g_color_table[ColorIndex(*(s + 1))], sizeof (color));
					color[3] = setColor[3];
				}
				trap_R_SetColor(color);
			}
			s += 2;
			continue;
		}
		CG_DrawChar2(xx, y, charWidth, charHeight, *s);
		xx += charWidth;
		cnt++;
		s++;
	}
	trap_R_SetColor(NULL);
}
Example #4
0
/*
=================
Slider_Draw
=================
*/
static void Slider_Draw( menuslider_s *s ) {
	int			x;
	int			y;
	int			style;
	float		*color;
	int			button;
	qboolean	focus;
	
	x =	s->generic.x;
	y = s->generic.y;
	focus = (s->generic.parent->cursor == s->generic.menuPosition);

	if( s->generic.flags & QMF_GRAYED ) {
		color = text_color_disabled;
		style = UI_SMALLFONT;
	}
	else if( focus ) {
		color  = text_color_highlight;
		style = UI_SMALLFONT | UI_PULSE;
	}
	else {
		color = text_color_normal;
		style = UI_SMALLFONT;
	}

	// draw label
	UI_DrawString( x - SMALLCHAR_WIDTH, y, s->generic.name, UI_RIGHT|style, color );

	// draw slider
	trap_R_SetColor( color );
	CG_DrawPic( x + SMALLCHAR_WIDTH, y, 96, 16, sliderBar );
	trap_R_SetColor( NULL );

	// clamp thumb
	if( s->maxvalue > s->minvalue )	{
		s->range = ( s->curvalue - s->minvalue ) / ( float ) ( s->maxvalue - s->minvalue );
		if( s->range < 0 ) {
			s->range = 0;
		}
		else if( s->range > 1) {
			s->range = 1;
		}
	}
	else {
		s->range = 0;
	}

	// draw thumb
	if( style & UI_PULSE) {
		button = sliderButton_1;
	}
	else {
		button = sliderButton_0;
	}

	CG_DrawPic( (int)( x + 2*SMALLCHAR_WIDTH + (SLIDER_RANGE-1)*SMALLCHAR_WIDTH* s->range ) - 2, y - 2, 12, 20, button );
}
Example #5
0
/*
==============
CG_FillRectGradient
==============
*/
void CG_FillRectGradient(float x, float y, float width, float height, const float *color, const float *gradcolor, int gradientType)
{
	trap_R_SetColor(color);

	CG_AdjustFrom640(&x, &y, &width, &height);
	trap_R_DrawStretchPicGradient(x, y, width, height, 0, 0, 0, 0, cgs.media.whiteShader, gradcolor, gradientType);

	trap_R_SetColor(NULL);
}
Example #6
0
/*
================
UI_DrawRect

Coordinates are 640*480 virtual values
=================
*/
void CG_DrawRect(float x, float y, float width, float height, float size, const float *color)
{
	trap_R_SetColor(color);

  CG_DrawTopBottom(x, y, width, height, size);
  CG_DrawSides(x, y, width, height, size);

	trap_R_SetColor(NULL);
}
Example #7
0
void CG_DrawRect_FixedBorder(float x, float y, float width, float height, int border, const float *color)
{
	trap_R_SetColor(color);

	CG_DrawTopBottom_NoScale(x, y, width, height, border);
	CG_DrawSides_NoScale(x, y, width, height, border);

	trap_R_SetColor(NULL);
}
Example #8
0
/**
 * @brief UI_FillRect
 * Coordinates are 640*480 virtual values
 */
void UI_FillRect(float x, float y, float width, float height, const float *color)
{
	trap_R_SetColor(color);

	UI_AdjustFrom640(&x, &y, &width, &height);
	trap_R_DrawStretchPic(x, y, width, height, 0, 0, 0, 0, uiInfo.uiDC.whiteShader);

	trap_R_SetColor(NULL);
}
Example #9
0
/*
================
CG_DrawRoundedRect

Coordinates are 640*480 virtual values
=================
*/
void CG_DrawRoundedRect( float x, float y, float width, float height, float size, const float *color )
{
  trap_R_SetColor( color );

  CG_DrawTopBottom( x + size * 4, y, width - size * 8, height, size );
  CG_DrawSides( x, y + size * 4, width, height - size * 8, size );
  CG_DrawCorners( x, y, width, height, size * 4, cgDC.Assets.cornerOut );

  trap_R_SetColor( NULL );
}
Example #10
0
/*
=================
UI_DrawString2
=================
*/
static void UI_DrawString2( int x, int y, const char* str, vec4_t color, int charw, int charh, touchData_t *touch )
{
	const char* s;
	char	ch;
	int forceColor = qfalse; //APSFIXME;
	vec4_t	tempcolor;
	float	ax;
	float	ay;
	float	aw;
	float	ah;
	float	frow;
	float	fcol;
	int		width;
	int		height;
	int		nx, ny;

	if (y < -charh)
		// offscreen
		return;

	// draw the colored text
	trap_R_SetColor( color );
	
	nx = ax = x * uis.scale + uis.bias;
	ny = ay = y * uis.scale;
	aw = charw * uis.scale;
	height = ah = charh * uis.scale;

	s = str;
	while ( *s )
	{
		if ( Q_IsColorString( s ) )
		{
			if ( !forceColor )
			{
				memcpy( tempcolor, g_color_table[ColorIndex(s[1])], sizeof( tempcolor ) );
				tempcolor[3] = color[3];
				trap_R_SetColor( tempcolor );
			}
			s += 2;
			continue;
		}

		ch = *s & 255;
		if (ch != ' ')
		{
			frow = (ch>>4)*0.0625;
			fcol = (ch&15)*0.0625;
			trap_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol + 0.0625, frow + 0.0625, uis.charset );
		}

		ax += aw;
		width += aw;
		s++;
	}
Example #11
0
/*
=============
CG_DrawDir

Draw dot marking the direction to an enemy
=============
*/
static void CG_DrawDir( rectDef_t *rect, vec3_t origin, vec4_t colour )
{
	vec3_t        drawOrigin;
	vec3_t        noZOrigin;
	vec3_t        normal, antinormal, normalDiff;
	vec3_t        view, noZview;
	vec3_t        up = { 0.0f, 0.0f,   1.0f };
	vec3_t        top = { 0.0f, -1.0f,  0.0f };
	float         angle;
	playerState_t *ps = &cg.snap->ps;

	if ( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
	{
		if ( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
		{
			VectorSet( normal, 0.0f, 0.0f, -1.0f );
		}
		else
		{
			VectorCopy( ps->grapplePoint, normal );
		}
	}
	else
	{
		VectorSet( normal, 0.0f, 0.0f, 1.0f );
	}

	AngleVectors( entityPositions.vangles, view, NULL, NULL );

	ProjectPointOnPlane( noZOrigin, origin, normal );
	ProjectPointOnPlane( noZview, view, normal );
	VectorNormalize( noZOrigin );
	VectorNormalize( noZview );

	//calculate the angle between the images of the blip and the view
	angle = RAD2DEG( acos( DotProduct( noZOrigin, noZview ) ) );
	CrossProduct( noZOrigin, noZview, antinormal );
	VectorNormalize( antinormal );

	//decide which way to rotate
	VectorSubtract( normal, antinormal, normalDiff );

	if ( VectorLength( normalDiff ) < 1.0f )
	{
		angle = 360.0f - angle;
	}

	RotatePointAroundVector( drawOrigin, up, top, angle );

	trap_R_SetColor( colour );
	CG_DrawPic( rect->x + ( rect->w / 2 ) - ( BLIPX2 / 2 ) - drawOrigin[ 0 ] * ( rect->w / 2 ),
	            rect->y + ( rect->h / 2 ) - ( BLIPY2 / 2 ) + drawOrigin[ 1 ] * ( rect->h / 2 ),
	            BLIPX2, BLIPY2, cgs.media.scannerBlipShader );
	trap_R_SetColor( NULL );
}
Example #12
0
/*
================
CG_FillRoundedRect

Coordinates are 640*480 virtual values
=================
*/
void CG_FillRoundedRect( float x, float y, float width, float height, float size, const float *color )
{
  CG_FillRect( x, y + size * 3, width, height - size * 6, color );

  trap_R_SetColor( color );

  CG_DrawTopBottom( x + size * 3, y, width - size * 6, height, size * 3 );
  CG_DrawCorners( x - size, y - size, width + size * 2, height + size * 2, size * 4, cgDC.Assets.cornerIn );

  trap_R_SetColor( NULL );
}
Example #13
0
void CG_DrawPMItems( void ) {
	vec4_t colour = { 0.f, 0.f, 0.f, 1.f };
	vec4_t colourText = { 1.f, 1.f, 1.f, 1.f };
	float t;
	int i, size;
	pmListItem_t* listItem = cg_pmOldList;
	float y = 360;
	
	if (!tj_drawCPM.integer)
		return;

	if( cg_drawSmallPopupIcons.integer ) {
		size = PM_ICON_SIZE_SMALL;

		y += 4;
	} else {
		size = PM_ICON_SIZE_NORMAL;
	}

	if( cg.snap->ps.persistant[PERS_RESPAWNS_LEFT] >= 0 ) {
		y -= 20;
	}

	if( !cg_pmWaitingList ) {
		return;
	}

	t = cg_pmWaitingList->time + CG_TimeForPopup( cg_pmWaitingList->type ) + PM_WAITTIME;
	if( cg.time > t ) {
		colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME);
	}

	trap_R_SetColor( colourText );
	CG_DrawPic( 4, y, size, size, cg_pmWaitingList->shader );
	trap_R_SetColor( NULL );
	CG_Text_Paint_Ext( 4 + size + 2, y + 12, 0.2f, 0.2f, colourText, cg_pmWaitingList->message, 0, 0, 0, &cgs.media.limboFont2 );

	for( i = 0; i < 4 && listItem; i++, listItem = listItem->next ) {
		y -= size + 2;

		t = listItem->time + CG_TimeForPopup( listItem->type ) + PM_WAITTIME;
		if( cg.time > t ) {
			colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME);
		} else {
			colourText[3] = colour[3] = 1.f;
		}

		trap_R_SetColor( colourText );
		CG_DrawPic( 4, y, size, size, listItem->shader );
		trap_R_SetColor( NULL );
		CG_Text_Paint_Ext( 4 + size + 2, y + 12, 0.2f, 0.2f, colourText, listItem->message, 0, 0, 0, &cgs.media.limboFont2 );
	}
}
Example #14
0
/*
=============
CG_DrawBlips

Draw blips and stalks for the human scanner
=============
*/
static void CG_DrawBlips( rectDef_t *rect, vec3_t origin, vec4_t colour )
{
	vec3_t drawOrigin;
	vec3_t up = { 0, 0, 1 };
	float  alphaMod = 1.0f;
	float  timeFractionSinceRefresh = 1.0f -
	                                  ( ( float )( cg.time - entityPositions.lastUpdateTime ) /
	                                    ( float ) HUMAN_SCANNER_UPDATE_PERIOD );
	vec4_t localColour;

	Vector4Copy( colour, localColour );

	RotatePointAroundVector( drawOrigin, up, origin, -entityPositions.vangles[ 1 ] - 90 );
	drawOrigin[ 0 ] /= ( 2 * HELMET_RANGE / rect->w );
	drawOrigin[ 1 ] /= ( 2 * HELMET_RANGE / rect->h );
	drawOrigin[ 2 ] /= ( 2 * HELMET_RANGE / rect->w );

	alphaMod = FAR_ALPHA +
	           ( ( drawOrigin[ 1 ] + ( rect->h / 2.0f ) ) / rect->h ) * ( NEAR_ALPHA - FAR_ALPHA );

	localColour[ 3 ] *= alphaMod;
	localColour[ 3 ] *= ( 0.5f + ( timeFractionSinceRefresh * 0.5f ) );

	if ( localColour[ 3 ] > 1.0f )
	{
		localColour[ 3 ] = 1.0f;
	}
	else if ( localColour[ 3 ] < 0.0f )
	{
		localColour[ 3 ] = 0.0f;
	}

	trap_R_SetColor( localColour );

	if ( drawOrigin[ 2 ] > 0 )
	{
		CG_DrawPic( rect->x + ( rect->w / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ],
		            rect->y + ( rect->h / 2 ) + drawOrigin[ 1 ] - drawOrigin[ 2 ],
		            STALKWIDTH, drawOrigin[ 2 ], cgs.media.scannerLineShader );
	}
	else
	{
		CG_DrawPic( rect->x + ( rect->w / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ],
		            rect->y + ( rect->h / 2 ) + drawOrigin[ 1 ],
		            STALKWIDTH, -drawOrigin[ 2 ], cgs.media.scannerLineShader );
	}

	CG_DrawPic( rect->x + ( rect->w / 2 ) - ( BLIPX / 2 ) - drawOrigin[ 0 ],
	            rect->y + ( rect->h / 2 ) - ( BLIPY / 2 ) + drawOrigin[ 1 ] - drawOrigin[ 2 ],
	            BLIPX, BLIPY, cgs.media.scannerBlipShader );
	trap_R_SetColor( NULL );
}
Example #15
0
/*
================
UI_DrawRect

Coordinates are 640*480 virtual values
=================
*/
void CG_DrawRect( float x, float y, float width, float height, float size, const float *color ) {
	vec4_t hudAlphaColor;

	Vector4Copy( color, hudAlphaColor );
	hudAlphaColor[3] *= cg_hudAlpha.value;

	trap_R_SetColor( hudAlphaColor );

	CG_DrawTopBottom( x, y, width, height, size );
	CG_DrawSides( x, y, width, height, size );

	trap_R_SetColor( NULL );
}
Example #16
0
static void
UI_DrawProportionalString2(int x, int y, const char* str, Vec4 color,
			   float sizeScale,
			   Handle charset)
{
	const char * s;
	unsigned char ch;
	float	ax;
	float	ay;
	float	aw;
	float	ah;
	float	frow;
	float	fcol;
	float	fwidth;
	float	fheight;

	/* draw the colored text */
	trap_R_SetColor(color);

	ax = x * cgs.screenXScale + cgs.screenXBias;
	ay = y * cgs.screenYScale;

	s = str;
	while(*s){
		ch = *s & 127;
		if(ch == ' ')
			aw = (float)PROP_SPACE_WIDTH * cgs.screenXScale *
			     sizeScale;
		else if(propMap[ch][2] != -1){
			fcol = (float)propMap[ch][0] / 256.0f;
			frow = (float)propMap[ch][1] / 256.0f;
			fwidth	= (float)propMap[ch][2] / 256.0f;
			fheight = (float)PROP_HEIGHT / 256.0f;
			aw	= (float)propMap[ch][2] * cgs.screenXScale *
				  sizeScale;
			ah = (float)PROP_HEIGHT * cgs.screenYScale *
			     sizeScale;
			trap_R_DrawStretchPic(ax, ay, aw, ah, fcol, frow, fcol+
				fwidth, frow+fheight,
				charset);
		}else
			aw = 0;

		ax +=
			(aw + (float)PROP_GAP_WIDTH * cgs.screenXScale *
			 sizeScale);
		s++;
	}

	trap_R_SetColor(NULL);
}
static void CG_DrawBottomRightHUD ( menuDef_t *menuHUD, centity_t *cent, vec4_t opacity )
{
	itemDef_t *focusItem;
	if (!menuHUD)
	{
	    return;
	}

	focusItem = Menu_FindItemByName(menuHUD, "framebg");
	if (focusItem)
	{
		vec4_t tmp;
		MAKERGBA(tmp,0,0,0, cg.jkg_HUDOpacity);
		trap_R_SetColor( tmp );	
		CG_DrawPic( 
			focusItem->window.rect.x, 
			focusItem->window.rect.y, 
			focusItem->window.rect.w, 
			focusItem->window.rect.h, 
			cgs.media.whiteShader 
			);			
	}

	// Draw the bars (temp)
	
	CG_DrawJetpackCloak(menuHUD);
	
	focusItem = Menu_FindItemByName(menuHUD, "frame");
	if (focusItem)
	{
		trap_R_SetColor(opacity);
		CG_DrawPic( 
			focusItem->window.rect.x, 
			focusItem->window.rect.y, 
			focusItem->window.rect.w, 
			focusItem->window.rect.h, 
			focusItem->window.background 
			);			
	}

	// Draw ammo tics or saber style
	if ( cent->currentState.weapon == WP_SABER )
	{
		CG_DrawSaberStyle(cent,menuHUD);
	}
	else
	{
		CG_DrawAmmo(cent,menuHUD);
	}
}
Example #18
0
static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset, touchData_t *touch )
{
	const char* s;
	unsigned char	ch; // bk001204 - unsigned
	float	ax;
	float	ay;
	float	aw = 0; // bk001204 - init
	float	ah;
	float	frow;
	float	fcol;
	float	fwidth;
	float	fheight;
	int		height;
	int		width;
	int     nx, ny;

	// draw the colored text
	trap_R_SetColor( color );
	
	nx = ax = x * uis.scale + uis.bias;
	ny = ay = y * uis.scale;
	height = (float)propMap[20][2] * uis.scale * sizeScale;
	
	s = str;
	while ( *s )
	{
		ch = *s & 127;
		if ( ch == ' ' ) {
			aw = (float)PROP_SPACE_WIDTH * uis.scale * sizeScale;
		}
		else if ( propMap[ch][2] != -1 ) {
			fcol = (float)propMap[ch][0] / 256.0f;
			frow = (float)propMap[ch][1] / 256.0f;
			fwidth = (float)propMap[ch][2] / 256.0f;
			fheight = (float)PROP_HEIGHT / 256.0f;
			aw = (float)propMap[ch][2] * uis.scale * sizeScale;
			ah = (float)PROP_HEIGHT * uis.scale * sizeScale;
			trap_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol+fwidth, frow+fheight, charset );
		}

		ax += (aw + (float)PROP_GAP_WIDTH * uis.scale * sizeScale);
		width += (aw + (float)PROP_GAP_WIDTH * uis.scale * sizeScale);
		s++;
	}		

	trap_R_SetColor( NULL );
	
	UI_DrawTouch( touch );
}
void FlagCaptureBar(void)
{
	const int numticks = 50, tickwidth = 1, tickheight = 3;
	const int tickpadx = 2, tickpady = 2;
	const int capwidth = 2;
	const int barwidth = numticks*tickwidth+tickpadx*2+capwidth*2;
	const int barleft = ((1202-barwidth)/2);
	const int barheight = tickheight + tickpady*2;
	const int bartop = 173-barheight;
	const int capleft = barleft+tickpadx;
	const int tickleft = capleft+capwidth, ticktop = bartop+tickpady;
	float percentage = 0.0f;

	if (cg.captureFlagPercent <= 0)
		return;

	percentage = cg.captureFlagPercent/2;

	trap_R_SetColor( colorWhite );
	// Draw background
	CG_DrawPic(barleft, bartop, barwidth, barheight, cgs.media.loadBarLEDSurround);

	// Draw left cap (backwards)
	CG_DrawPic(tickleft, ticktop, -capwidth, tickheight, cgs.media.loadBarLEDCap);

	// Draw bar
	CG_DrawPic(tickleft, ticktop, tickwidth*percentage, tickheight, cgs.media.loadBarLED);

	// Draw right cap
	CG_DrawPic(tickleft+tickwidth*percentage, ticktop, capwidth, tickheight, cgs.media.loadBarLEDCap);
}
Example #20
0
/*
==================
CG_DrawLine

Dzikie CGaz 3rd party function

@author Nico
==================
*/
void CG_DrawLine(float x1, float y1, float x2, float y2, vec4_t color) {
	float len, stepx, stepy;
	float i;

	trap_R_SetColor(color);
	len   = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
	len   = sqrt(len);
	stepx = (x2 - x1) / len;
	stepy = (y2 - y1) / len;
	for (i = 0; i < len; ++i) {
		CG_PutPixel(x1, y1);
		x1 += stepx;
		y1 += stepy;
	}
	trap_R_SetColor(NULL);
}
Example #21
0
/*
===================
CG_LoadBar
===================
*/
void CG_LoadBar(void)
{
	trap_R_SetColor( colorTable[CT_WHITE] );

	int glowHeight = (cg->loadLCARSStage / 9.0f) * 147;
	int glowTop = (280 + 147) - glowHeight;

	// Draw glow:
	CG_DrawPic(280, glowTop, 73, glowHeight, cgs.media.loadTick);

	// Draw saber:
	CG_DrawPic(280, 265, 73, 147, cgs.media.levelLoad);
/*
	const int numticks = 9, tickwidth = 40, tickheight = 8;
	const int tickpadx = 20, tickpady = 12;
	const int capwidth = 8;
	const int barwidth = numticks*tickwidth+tickpadx*2+capwidth*2, barleft = ((640-barwidth)/2);
	const int barheight = tickheight + tickpady*2, bartop = 480-barheight;
	const int capleft = barleft+tickpadx, tickleft = capleft+capwidth, ticktop = bartop+tickpady;

	trap_R_SetColor( colorWhite );
	// Draw background
	CG_DrawPic(barleft, bartop, barwidth, barheight, cgs.media.loadBarLEDSurround);

	// Draw left cap (backwards)
	CG_DrawPic(tickleft, ticktop, -capwidth, tickheight, cgs.media.loadBarLEDCap);

	// Draw bar
	CG_DrawPic(tickleft, ticktop, tickwidth*cg->loadLCARSStage, tickheight, cgs.media.loadBarLED);

	// Draw right cap
	CG_DrawPic(tickleft+tickwidth*cg->loadLCARSStage, ticktop, capwidth, tickheight, cgs.media.loadBarLEDCap);
*/
}
Example #22
0
void CG_LimboPanel_WeaponPanel_DrawWeapon(rectDef_t *rect, weapon_t weap, qboolean highlight, const char *ofTxt, qboolean disabled) {
	weaponType_t *wt    = WM_FindWeaponTypeForWeapon(weap);
	qhandle_t    shader = cgs.media.limboWeaponCard;
	int          width  = CG_Text_Width_Ext(ofTxt, 0.2f, 0, &cgs.media.limboFont2);
	float        x      = rect->x + rect->w - width - 4;
	vec4_t       clr;

	if (!wt) {
		return;
	}

	CG_DrawPic(rect->x, rect->y, rect->w, rect->h, shader);
	if (wt->desc) {
		if (highlight && BG_CursorInRect(rect)) {
			Vector4Copy(weaponPanelNameFont.colour, clr);
			clr[3] *= 1.5;
			CG_Text_Paint_Ext(rect->x + 4, rect->y + 12, weaponPanelNameFont.scalex, weaponPanelNameFont.scaley, clr, wt->desc, 0, 0, weaponPanelNameFont.style, weaponPanelNameFont.font);
		} else {
			CG_Text_Paint_Ext(rect->x + 4, rect->y + 12, weaponPanelNameFont.scalex, weaponPanelNameFont.scaley, weaponPanelNameFont.colour, wt->desc, 0, 0, weaponPanelNameFont.style, weaponPanelNameFont.font);
		}
	}

	{
		float x2, y2, w, h, s0, s1, t0, t1;

		trap_R_SetColor(NULL);

		x2 = rect->x;
		y2 = rect->y + (rect->h * 0.25f);

		CG_LimboPanel_GetWeaponCardIconData(weap, &shader, &w, &h, &s0, &t0, &s1, &t1);

		w *= rect->w;
		h *= rect->h * 0.75f;

		CG_DrawPicST(x2, y2, w, h, s0, t0, s1, t1, shader);

		if (disabled) {
			vec4_t clr = { 1.f, 1.f, 1.f, 0.6f };

			trap_R_SetColor(clr);
			CG_DrawPic(x2, y2 + 4 + (h - 16) * 0.5f, w, 16, cgs.media.limboWeaponCardOOS);
			trap_R_SetColor(NULL);
		}
	}
	CG_Text_Paint_Ext(x, rect->y + rect->h - 2, 0.2f, 0.2f, colorBlack, ofTxt, 0, 0, 0, &cgs.media.limboFont2);
}
Example #23
0
/*
==================
CG_DrawStringExt

Draws a multi-colored string with a drop shadow, optionally forcing
to a fixed color.

Coordinates are at 640 by 480 virtual resolution
==================
*/
void CG_DrawStringExt( int x, int y, const char *string, const float *setColor, 
		qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars )
{
	vec4_t		color;
	const char	*s;
	int			xx;

	// draw the drop shadow
	if (shadow) {
		color[0] = color[1] = color[2] = 0;
		color[3] = setColor[3];
		trap_R_SetColor( color );
		s = string;
		xx = x;
		while ( *s ) {
			if ( Q_IsColorString( s ) ) {
				s += 2;
				continue;
			}
			CG_DrawChar( xx + 2, y + 2, charWidth, charHeight, *s );
			xx += charWidth;
			s++;
		}
	}

	// draw the colored text
	s = string;
	xx = x;
	trap_R_SetColor( setColor );
	while ( *s ) {
		if ( Q_IsColorString( s ) ) {
			if ( !forceColor ) {
				memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) );
				color[3] = setColor[3];
				trap_R_SetColor( color );
			}
			s += 2;
			continue;
		}
		CG_DrawChar( xx, y, charWidth, charHeight, *s );
		xx += charWidth;
		s++;
	}
	trap_R_SetColor( NULL );
}
Example #24
0
/*
=================
UI_DrawBannerString
=================
*/
static void UI_DrawBannerString2(int x, int y, const char *str, vec4_t color)
{
	const char     *s;
	unsigned char   ch;
	float           ax;
	float           ay;
	float           aw;
	float           ah;
	float           frow;
	float           fcol;
	float           fwidth;
	float           fheight;

	// draw the colored text
	trap_R_SetColor(color);

	ax = x * cgs.screenXScale + cgs.screenXBias;
	ay = y * cgs.screenYScale;

	s = str;
	while(*s)
	{
		ch = *s & 127;
		if(ch == ' ')
		{
			ax += ((float)PROPB_SPACE_WIDTH + (float)PROPB_GAP_WIDTH) * cgs.screenXScale;
		}
		else if(ch >= 'A' && ch <= 'Z')
		{
			ch -= 'A';
			fcol = (float)propMapB[ch][0] / 256.0f;
			frow = (float)propMapB[ch][1] / 256.0f;
			fwidth = (float)propMapB[ch][2] / 256.0f;
			fheight = (float)PROPB_HEIGHT / 256.0f;
			aw = (float)propMapB[ch][2] * cgs.screenXScale;
			ah = (float)PROPB_HEIGHT *cgs.screenYScale;

			trap_R_DrawStretchPic(ax, ay, aw, ah, fcol, frow, fcol + fwidth, frow + fheight, cgs.media.charsetPropB);
			ax += (aw + (float)PROPB_GAP_WIDTH * cgs.screenXScale);
		}
		s++;
	}

	trap_R_SetColor(NULL);
}
Example #25
0
/*
================
CG_FillAngleYaw (taken from iodfengine)

modified by @suburb
=================
*/
void CG_FillAngleYaw(float start, float end, float viewangle, float y, float height, int fov, const float *color) {
	float x, width, fovscale;

	fovscale = tan(DEG2RAD(fov / 2));
	x        = CG_WideX(SCREEN_WIDTH) / 2 + tan(DEG2RAD(viewangle + start)) / fovscale * CG_WideX(SCREEN_WIDTH) / 2;
	width    = fabs(CG_WideX(SCREEN_WIDTH) * (tan(DEG2RAD(viewangle + end)) - tan(DEG2RAD(viewangle + start))) / (fovscale * 2)) + 1;
	if (etr_drawVelocitySnapping.integer == 2) {
		width /= 2;
		if (cg.predictedPlayerState.stats[STAT_USERCMD_MOVE] & UMOVE_RIGHT) {
			x += width; // invert white bars if moving to the right
		}
	}

	trap_R_SetColor(color);
	CG_AdjustFrom640(&x, &y, &width, &height);
	trap_R_DrawStretchPic(x, y, width, height, 0, 0, 0, 0, cgs.media.whiteShader);
	trap_R_SetColor(NULL);
}
Example #26
0
/*
================
CG_DrawRect

Coordinates are 640*480 virtual values
=================
*/
void CG_DrawRect( float x, float y, float width, float height, float size, const Color::Color& color )
{
	trap_R_SetColor( color );

	CG_DrawTopBottom( x, y, width, height, size );
	CG_DrawSides( x, y, width, height, size );

	trap_R_ClearColor();
}
Example #27
0
/*
================
CG_DrawFadePic

Coordinates are 640*480 virtual values
=================
*/
void CG_DrawFadePic( float x, float y, float width, float height, vec4_t fcolor,
                     vec4_t tcolor, float amount, qhandle_t hShader )
{
	vec4_t finalcolor;
	float  inverse;

	inverse = 100 - amount;

	CG_AdjustFrom640( &x, &y, &width, &height );

	finalcolor[ 0 ] = ( ( inverse * fcolor[ 0 ] ) + ( amount * tcolor[ 0 ] ) ) / 100;
	finalcolor[ 1 ] = ( ( inverse * fcolor[ 1 ] ) + ( amount * tcolor[ 1 ] ) ) / 100;
	finalcolor[ 2 ] = ( ( inverse * fcolor[ 2 ] ) + ( amount * tcolor[ 2 ] ) ) / 100;
	finalcolor[ 3 ] = ( ( inverse * fcolor[ 3 ] ) + ( amount * tcolor[ 3 ] ) ) / 100;

	trap_R_SetColor( finalcolor );
	trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
	trap_R_SetColor( NULL );
}
Example #28
0
// Draw the stars spent on the current force power
void UI_DrawForceStars(rectDef_t *rect, float scale, vec4_t color, int textStyle, int forceindex, int val, int min, int max) 
{
	int	i,pad = 4;
	int	xPos,width = 16;
	int starcolor;

	if (val < min || val > max) 
	{
		val = min;
	}

	if (1)	// if (val)
	{
		xPos = rect->x;

		for (i=FORCE_LEVEL_1;i<=max;i++)
		{
			starcolor = bgForcePowerCost[forceindex][i];

			if (uiForcePowersDisabled[forceindex])
			{
				vec4_t grColor = {0.2f, 0.2f, 0.2f, 1.0f};
				trap_R_SetColor(grColor);
			}

			if (val >= i)
			{	// Draw a star.
				UI_DrawHandlePic( xPos, rect->y+6, width, width, uiForceStarShaders[starcolor][1] );
			}
			else
			{	// Draw a circle.
				UI_DrawHandlePic( xPos, rect->y+6, width, width, uiForceStarShaders[starcolor][0] );
			}

			if (uiForcePowersDisabled[forceindex])
			{
				trap_R_SetColor(NULL);
			}

			xPos += width + pad;
		}
	}
}
Example #29
0
/*
================
CG_DrawTeamBackground

================
*/
void CG_DrawTeamBackground( int x, int y, int w, int h, float alpha, int team )
{
	vec4_t		hcolor;

	hcolor[3] = alpha;
	if ( team == TEAM_RED ) {
		hcolor[0] = 1;
		hcolor[1] = 0;
		hcolor[2] = 0;
	} else if ( team == TEAM_BLUE ) {
		hcolor[0] = 0;
		hcolor[1] = 0;
		hcolor[2] = 1;
	} else {
		return;
	}
	trap_R_SetColor( hcolor );
	trap_R_SetColor( NULL );
}
Example #30
0
/* Draw country flags
 *
 * @source: ETpub
 */
static qboolean WM_ETrun_drawCountryFlag(float x, float y,  unsigned int countryCode) {
	float alpha[4];
    float flag_step = 32;
    unsigned int flag_sd = 512;

    if (countryCode < 255) {
        float x1 = (float)((countryCode * (unsigned int)flag_step) % flag_sd);
        float y1 = (float)(floor((countryCode * flag_step) / flag_sd) * flag_step);
        float x2 = x1 + flag_step;
        float y2 = y1 + flag_step;
        alpha[0] = alpha[1] = alpha[2] = alpha[3]= 1.0;

        trap_R_SetColor(alpha);
		CG_DrawPicST(x - 8, y - 19, flag_step, flag_step, x1 / flag_sd, y1 / flag_sd, x2 / flag_sd , y2 / flag_sd, cgs.media.worldFlags);
        trap_R_SetColor(NULL);
        return qtrue;
	}
	return qfalse;
}