Exemplo n.º 1
0
void CG_DrawPMItemsBig(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;
	float  y = 270;
	float  w;

	if (!cg_pmWaitingListBig)
	{
		return;
	}

	t = cg_pmWaitingListBig->time + PM_BIGPOPUP_TIME + PM_WAITTIME_BIG;
	if (cg.time > t)
	{
		colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME_BIG);
	}

	trap_R_SetColor(colourText);
	CG_DrawPic(Ccg_WideX(SCREEN_WIDTH) - 56, y, 48, 48, cg_pmWaitingListBig->shader);
	trap_R_SetColor(NULL);


	w = CG_Text_Width_Ext(cg_pmWaitingListBig->message, 0.22f, 0, &cgs.media.limboFont2);
	CG_Text_Paint_Ext(Ccg_WideX(SCREEN_WIDTH) - 4 - w, y + 56, 0.22f, 0.24f, colourText, cg_pmWaitingListBig->message, 0, 0, 0, &cgs.media.limboFont2);
}
Exemplo n.º 2
0
/*
=================
CG_DrawTimer
=================
*/
static float CG_DrawTimer(float y)
{
	char   *s;
	int    w, w2;
	vec4_t color = { 0.625f, 0.625f, 0.6f, 1.0f };
	int    tens;
	char   *rt = (cgs.gametype != GT_WOLF_LMS && (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR || cg.snap->ps.pm_flags & PMF_FOLLOW) && cg_drawReinforcementTime.integer > 0) ?
	             va("^F%d%s", CG_CalculateReinfTime(qfalse), ((cgs.timelimit <= 0.0f) ? "" : " ")) : "";
	int x;
	int msec    = (cgs.timelimit * 60.f * 1000.f) - (cg.time - cgs.levelStartTime);
	int seconds = msec / 1000;
	int mins    = seconds / 60;

	seconds -= mins * 60;
	tens     = seconds / 10;
	seconds -= tens * 10;

	if (cgs.gamestate != GS_PLAYING)
	{
		s        = va("^7%s", CG_TranslateString("WARMUP")); // don't draw reinforcement time in warmup mode // ^*
		color[3] = fabs(sin(cg.time * 0.002));
	}
	else if (msec < 0 && cgs.timelimit > 0.0f)
	{
		s        = "^N0:00";
		color[3] = fabs(sin(cg.time * 0.002));
	}
	else
	{
		if (cgs.timelimit <= 0.0f)
		{
			s = va("%s", rt);
		}
		else
		{
			s = va("%s^7%i:%i%i", rt, mins, tens, seconds);  // ^*
		}

		color[3] = 1.f;
	}

	// spawntimer
	seconds = msec / 1000;
	if (cg_spawnTimer_set.integer != -1 && cg_spawnTimer_period.integer > 0)
	{
		s = va("^1%d %s", cg_spawnTimer_period.integer + (seconds - cg_spawnTimer_set.integer) % cg_spawnTimer_period.integer, s);
	}
	// end spawntimer

	w  = CG_Text_Width_Ext(s, 0.19f, 0, &cgs.media.limboFont1);
	w2 = (UPPERRIGHT_W > w) ? UPPERRIGHT_W : w;

	x = Ccg_WideX(UPPERRIGHT_X) - w2 - 2;
	CG_FillRect(x, y, w2 + 5, 12 + 2, HUD_Background);
	CG_DrawRect_FixedBorder(x, y, w2 + 5, 12 + 2, 1, HUD_Border);
	CG_Text_Paint_Ext(x + ((w2 - w) / 2) + 2, y + 11, 0.19f, 0.19f, color, s, 0, 0, 0, &cgs.media.limboFont1);


	return y + 12 + 4;
}
Exemplo n.º 3
0
/*
==================
CG_DrawSnapshot
==================
*/
static float CG_DrawSnapshot(float y)
{
	char *s = va("t:%i sn:%i cmd:%i", cg.snap->serverTime, cg.latestSnapshotNum, cgs.serverCommandSequence);
	int  w  = CG_Text_Width_Ext(s, 0.19f, 0, &cgs.media.limboFont1);
	int  w2 = (UPPERRIGHT_W > w) ? UPPERRIGHT_W : w;
	int  x  = Ccg_WideX(UPPERRIGHT_X) - w2 - 2;

	CG_FillRect(x, y, w2 + 5, 12 + 2, HUD_Background);
	CG_DrawRect_FixedBorder(x, y, w2 + 5, 12 + 2, 1, HUD_Border);
	CG_Text_Paint_Ext(x + ((w2 - w) / 2) + 2, y + 11, 0.19f, 0.19f, HUD_Text, s, 0, 0, 0, &cgs.media.limboFont1);
	return y + 12 + 4;
}
Exemplo n.º 4
0
void CG_setDefaultHudValues(hudStucture_t *hud)
{
	// the Default hud
	hud->hudnumber       = 0;
	hud->compas          = CG_getComponent((Ccg_WideX(640) - 100 - 20 - 16), 16, 100 + 32, 100 + 32, qtrue, STYLE_NORMAL);
	hud->staminabar      = CG_getComponent(4, 480 - 92, 12, 72, qtrue, STYLE_NORMAL);
	hud->healthbar       = CG_getComponent(24, 480 - 92, 12, 72, qtrue, STYLE_NORMAL);
	hud->weaponchargebar = CG_getComponent(Ccg_WideX(640) - 16, 480 - 92, 12, 72, qtrue, STYLE_NORMAL);
	hud->healthtext      = CG_getComponent(SKILLS_X - 28, 480 - 4, 0, 0, qtrue, STYLE_NORMAL);
	hud->xptext          = CG_getComponent(SKILLS_X + 28, 480 - 4, 0, 0, qtrue, STYLE_NORMAL);
	hud->statsdisplay    = CG_getComponent(SKILL_ICON_X, 0, 0, 0, qtrue, STYLE_NORMAL);
	hud->weaponicon      = CG_getComponent((Ccg_WideX(640) - 82), (480 - 56), 60, 32, qtrue, STYLE_NORMAL);
	hud->weaponammo      = CG_getComponent(Ccg_WideX(640) - 22, 480 - 1 * (16 + 2) + 12 - 4, 0, 0, qtrue, STYLE_NORMAL);
	hud->fireteam        = CG_getComponent(10, 10, 100, 100, qtrue, STYLE_NORMAL);
	hud->popupmessages   = CG_getComponent(4, 360, 72, 72, qtrue, STYLE_NORMAL);
	hud->powerups        = CG_getComponent(Ccg_WideX(640) - 40, 480 - 140, 36, 36, qtrue, STYLE_NORMAL);
	hud->hudhead         = CG_getComponent(44, 480 - 92, 62, 80, qtrue, STYLE_NORMAL);
	hud->cursorhint      = CG_getComponent(.5f * SCREEN_WIDTH - .5f * 48, 260, 48, 48, qtrue, STYLE_NORMAL);
	hud->weaponstability = CG_getComponent(50, 208, 10, 64, qtrue, STYLE_NORMAL);
	hud->livesleft       = CG_getComponent(0, 0, 0, 0, qtrue, STYLE_NORMAL);
}
Exemplo n.º 5
0
void CG_demoTimescaleDraw(void)
{
	if (cg.demoPlayback && cgs.timescaleUpdate > cg.time && demo_drawTimeScale.integer != 0)
	{
		vec4_t bgColor = { 0.0f, 0.0f, 0.0f, 0.6f };
		vec4_t bdColor = { 0.5f, 0.5f, 0.5f, 0.5f };

		char *s = va("^7Time Scale: ^3%.1fx", cg_timescale.value);
		int  h  = CG_Text_Height_Ext("A", cg_fontScaleSP.value, 0, &cgs.media.limboFont2);
		int  w  = CG_Text_Width_Ext(s, cg_fontScaleSP.value, 0, &cgs.media.limboFont2);
		int  x  = Ccg_WideX(SCREEN_WIDTH) - w - 108;

		CG_FillRect(x, SCREEN_HEIGHT - 21, w + 7, h * 2.5, bgColor);
		CG_DrawRect(x, SCREEN_HEIGHT - 21, w + 7, h * 2.5, 1, bdColor);
		CG_Text_Paint_Ext(x + 3, SCREEN_HEIGHT - 10, cg_fontScaleSP.value, cg_fontScaleSP.value, colorWhite, s, 0, 0, 0, &cgs.media.limboFont2);
	}
}
Exemplo n.º 6
0
static qboolean CG_RectParse(int handle, rectDef_t *r)
{
	float x = 0;

	if (PC_Float_Parse(handle, &x))
	{
		r->x = Ccg_WideX(x);
		if (PC_Float_Parse(handle, &r->y))
		{
			if (PC_Float_Parse(handle, &r->w))
			{
				if (PC_Float_Parse(handle, &r->h))
				{
					return qtrue;
				}
			}
		}
	}
	return qfalse;
}
Exemplo n.º 7
0
/**
 * @brief Draw FireTeam overlay
 */
void CG_DrawFireTeamOverlay(rectDef_t *rect)
{
	int            x = rect->x;
	int            y = rect->y + 1;             // +1, jitter it into place
	int            i, locwidth, namewidth, puwidth, lineX;
	int            boxWidth      = 90;
	int            bestNameWidth = -1;
	int            bestLocWidth  = -1;
	char           buffer[64];
	float          h   = 16;                    // 12 + 2 + 2
	clientInfo_t   *ci = NULL;
	fireteamData_t *f  = NULL;
	char           *locStr[MAX_FIRETEAM_MEMBERS];
	vec3_t         origin;

	int curWeap;

	// assign fireteam data, and early out if not on one
	if (!(f = CG_IsOnFireteam(cg.clientNum)))
	{
		return;
	}

	memset(locStr, 0, sizeof(char *) * MAX_FIRETEAM_MEMBERS);

	// First get name and location width, also store location names
	for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)
	{
		ci = CG_SortedFireTeamPlayerForPosition(i);

		// Make sure it's valid
		if (!ci)
		{
			break;
		}

		if (cg_locations.integer & LOC_FTEAM)
		{
			origin[0] = ci->location[0];
			origin[1] = ci->location[1];
			origin[2] = ci->location[2];

			locStr[i] = CG_BuildLocationString(ci->clientNum, origin, LOC_FTEAM);

			if (!locStr[i][1] || !*locStr[i])
			{
				locStr[i] = "";
			}

			locwidth = CG_Text_Width_Ext(locStr[i], 0.2f, 0, FONT_TEXT);
		}
		else
		{
			locwidth = 0;
		}

		namewidth = CG_Text_Width_Ext(ci->name, 0.2f, 0, FONT_TEXT);

		if (ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG) | (1 << PW_OPS_DISGUISED)))
		{
			namewidth += 14;
		}

		if (namewidth > bestNameWidth)
		{
			bestNameWidth = namewidth;
		}

		if (locwidth > bestLocWidth)
		{
			bestLocWidth = locwidth;
		}

		h += 12.f;
	}

	boxWidth += bestLocWidth + bestNameWidth;

	if (cg_fireteamLatchedClass.integer)
	{
		boxWidth += 28;
	}

	if ((Ccg_WideX(640) - MIN_BORDER_DISTANCE) < (x + boxWidth))
	{
		x = x - ((x + boxWidth) - Ccg_WideX(640)) - MIN_BORDER_DISTANCE;
	}
	else if (x < MIN_BORDER_DISTANCE)
	{
		x = MIN_BORDER_DISTANCE;
	}

	CG_FillRect(x, y, boxWidth, h, FT_bg2);
	CG_DrawRect(x, y, boxWidth, h, 1, FT_border);

	x += 1;
	y += 1;

	CG_FillRect(x, y, boxWidth - 2, 12, FT_bg);

	if (f->priv)
	{
		Com_sprintf(buffer, 64, CG_TranslateString("Private Fireteam: %s"), bg_fireteamNames[f->ident]);
	}
	else
	{
		Com_sprintf(buffer, 64, CG_TranslateString("Fireteam: %s"), bg_fireteamNames[f->ident]);
	}

	Q_strupr(buffer);
	CG_Text_Paint_Ext(x + 4, y + FT_BAR_HEIGHT, .19f, .19f, FT_text, buffer, 0, 0, 0, FONT_HEADER);

	lineX = x;
	for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)
	{
		x  = lineX;
		y += FT_BAR_HEIGHT + FT_BAR_YSPACING;
		// grab a pointer to the current player
		ci = CG_SortedFireTeamPlayerForPosition(i);

		// make sure it's valid
		if (!ci)
		{
			break;
		}

		// hilight selected players
		if (ci->selected)
		{
			CG_FillRect(x, y + FT_BAR_YSPACING, boxWidth - 2, FT_BAR_HEIGHT, FT_select);
		}
		else
		{
			CG_FillRect(x, y + FT_BAR_YSPACING, boxWidth - 2, FT_BAR_HEIGHT, FT_noselect);
		}

		x += 4;

		// draw class icon in fireteam overlay
		CG_DrawPic(x, y + 2, 12, 12, cgs.media.skillPics[SkillNumForClass(ci->cls)]);
		x += 14;

		if (cg_fireteamLatchedClass.integer && ci->cls != ci->latchedcls)
		{
			// draw the yellow arrow
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, FT_text, "^3->", 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);
			x += 14;
			// draw latched class icon in fireteam overlay
			CG_DrawPic(x, y + 2, 12, 12, cgs.media.skillPics[SkillNumForClass(ci->latchedcls)]);
			x += 14;
		}
		else if (cg_fireteamLatchedClass.integer)
		{
			x += 28;
		}
		// draw the mute-icon in the fireteam overlay..
		//if ( ci->muted ) {
		//	CG_DrawPic( x, y, 12, 12, cgs.media.muteIcon );
		//	x += 14;
		//} else if

		// draw objective icon (if they are carrying one) in fireteam overlay
		if (ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG)))
		{
			CG_DrawPic(x, y + 2, 12, 12, cgs.media.objectiveShader);
			x      += 14;
			puwidth = 14;
		}
		// or else draw the disguised icon in fireteam overlay
		else if (ci->powerups & (1 << PW_OPS_DISGUISED))
		{
			CG_DrawPic(x, y + 2, 12, 12, ci->team == TEAM_AXIS ? cgs.media.alliedUniformShader : cgs.media.axisUniformShader);
			x      += 14;
			puwidth = 14;
		}
		// otherwise draw rank icon in fireteam overlay
		else
		{
			//if (ci->rank > 0) CG_DrawPic( x, y, 12, 12, rankicons[ ci->rank ][  ci->team == TEAM_AXIS ? 1 : 0 ][0].shader );
			//x += 14;
			puwidth = 0;
		}

		// draw the player's name
		CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorWhite, ci->name, 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);

		// add space
		x += 14 + bestNameWidth - puwidth;

		// draw the player's weapon icon
		if (cg.predictedPlayerEntity.currentState.eFlags & EF_MOUNTEDTANK)
		{
			if (cg_entities[cg_entities[cg_entities[cg.snap->ps.clientNum].tagParent].tankparent].currentState.density & 8)
			{
				curWeap = WP_MOBILE_BROWNING;
			}
			else
			{
				curWeap = WP_MOBILE_MG42;
			}
		}
		else if ((cg.predictedPlayerEntity.currentState.eFlags & EF_MG42_ACTIVE) || (cg.predictedPlayerEntity.currentState.eFlags & EF_AAGUN_ACTIVE))
		{
			curWeap = WP_MOBILE_MG42;
		}
		else
		{
			curWeap = cg_entities[ci->clientNum].currentState.weapon;
		}

		// note: WP_NONE is excluded
		if (IS_VALID_WEAPON(curWeap) && cg_weapons[curWeap].weaponIcon[0])     // do not try to draw nothing
		{
			CG_DrawPic(x, y + 2, cg_weapons[curWeap].weaponIconScale * 10, 10, cg_weapons[curWeap].weaponIcon[0]);
		}
		else if (IS_VALID_WEAPON(curWeap) && cg_weapons[curWeap].weaponIcon[1])
		{
			CG_DrawPic(x, y + 2, cg_weapons[curWeap].weaponIconScale * 10, 10, cg_weapons[curWeap].weaponIcon[1]);
		}

		x += 24;

		if (ci->health >= 100)
		{
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorGreen, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);
			x += 12;
		}
		else if (ci->health >= 10)
		{
			x += 6;
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, ci->health > 80 ? colorGreen : colorYellow, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);
			x += 6;
		}
		else if (ci->health > 0)
		{
			x += 12;
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorRed, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);
		}
		else if (ci->health == 0)
		{
			x += 6;
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, ((cg.time % 500) > 250)  ? colorWhite : colorRed, "*", 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);
			x += 6;
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, ((cg.time % 500) > 250)  ? colorRed : colorWhite, "0", 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);
		}
		else
		{
			x += 12;
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorRed, "0", 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);
		}
		// set hard limit on width
		x += 12;
		if (cg_locations.integer & LOC_FTEAM)
		{
			CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, FT_text, locStr[i], 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT);
		}
	}
}
Exemplo n.º 8
0
void CG_ObjectivesDraw()
{
	const char *cs;
	char       color[3];

	if (cgs.objectives.show == SHOW_OFF)
	{
		return;
	}
	else
	{
		int    i, status, x = Ccg_WideX(SCREEN_WIDTH) + OBJ_X - OBJ_W, y = SCREEN_HEIGHT, h;
		int    lines = 0, count = 0;
		char   temp[1024], *s, *p;
		vec4_t bgColor          = COLOR_BG;     // window
		vec4_t borderColor      = COLOR_BORDER; // window
		vec4_t bgColorTitle     = COLOR_BG_TITLE;   // titlebar
		vec4_t borderColorTitle = COLOR_BORDER_TITLE;   // titlebar

		// Main header
		int          hStyle   = 0;
		float        hScale   = 0.19f;
		float        hScaleY  = 0.19f;
		fontHelper_t *hFont   = FONT_HEADER;
		vec4_t       hdrColor = COLOR_TEXT;       // text

		// Text settings
		int          tStyle   = ITEM_TEXTSTYLE_SHADOWED;
		int          tSpacing = 9;      // Should derive from CG_Text_Height_Ext
		float        tScale   = 0.19f;
		fontHelper_t *tFont   = FONT_TEXT;
		vec4_t       tColor   = COLOR_TEXT; // text

		float diff = cgs.objectives.fadeTime - cg.time;

		if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_SPECTATOR)
		{
			Q_strncpyz(temp, cg.objMapDescription_Neutral, sizeof(temp));
			while ((s = strchr(temp, '*')))
			{
				*s = '\n';
			}
			CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 8, sizeof(temp), FONT_TEXT);
			p = temp;
			while (*p)
			{
				if (*p == '\n')
				{
					*p++ = '\0';
					lines++;
				}
				else
				{
					p++;
				}
			}
			if (temp[0])
			{
				count++;
			}

			Q_strncpyz(temp, cg.objMapDescription_Allied, sizeof(temp));
			while ((s = strchr(temp, '*')))
			{
				*s = '\n';
			}
			CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 28, sizeof(temp), FONT_TEXT);
			p = temp;
			while (*p)
			{
				if (*p == '\n')
				{
					*p++ = '\0';
					lines++;
				}
				else
				{
					p++;
				}
			}
			if (temp[0])
			{
				lines += 1; // Allied
				count++;
			}

			Q_strncpyz(temp, cg.objMapDescription_Axis, sizeof(temp));
			while ((s = strchr(temp, '*')))
			{
				*s = '\n';
			}
			CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 28, sizeof(temp), FONT_TEXT);
			p = temp;
			while (*p)
			{
				if (*p == '\n')
				{
					*p++ = '\0';
					lines++;
				}
				else
				{
					p++;
				}
			}
			if (temp[0])
			{
				lines += 1; // Axis
				count++;
			}
		}
		else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES)
		{
			for (i = 0; i < MAX_OBJECTIVES && cg.objDescription_Allied[i][0] ; i++)
			{
				Q_strncpyz(temp, cg.objDescription_Allied[i], sizeof(temp));
				// no double newlines as they make the pop up look really bad
				while ((s = strstr(temp, "**")))
				{
					*s = ' ';
				}
				while ((s = strchr(temp, '*')))
				{
					*s = '\n';
				}
				CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 28, sizeof(temp), FONT_TEXT);
				p = temp;
				while (*p)
				{
					if (*p == '\n')
					{
						*p++ = '\0';
						lines++;
					}
					else
					{
						p++;
					}
				}
				if (temp[0])
				{
					count++;
				}
			}
		}
		else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS)
		{
			for (i = 0; i < MAX_OBJECTIVES && cg.objDescription_Axis[i][0] ; i++)
			{
				Q_strncpyz(temp, cg.objDescription_Axis[i], sizeof(temp));
				while ((s = strstr(temp, "**")))
				{
					*s = ' ';
				}
				while ((s = strchr(temp, '*')))
				{
					*s = '\n';
				}
				CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 28, sizeof(temp), FONT_TEXT);
				p = temp;
				while (*p)
				{
					if (*p == '\n')
					{
						*p++ = '\0';
						lines++;
					}
					else
					{
						p++;
					}
				}
				if (temp[0])
				{
					count++;
				}
			}
		}

		// FIXME: Should compute this beforehand
		h = 2 + tSpacing + 2 +                                  // Header
		    1 +
		    tSpacing * (((lines + count - 1) > 0) ? (lines + count - 1) : 1) +
		    1 + 2;

		// Fade-in effects
		if (diff > 0.0f)
		{
			float scale = (diff / STATS_FADE_TIME);

			if (cgs.objectives.show == SHOW_ON)
			{
				scale = 1.0f - scale;
			}

			bgColor[3]          *= scale;
			bgColorTitle[3]     *= scale;
			borderColor[3]      *= scale;
			borderColorTitle[3] *= scale;
			hdrColor[3]         *= scale;
			tColor[3]           *= scale;

			y += (TS_Y - h) * scale;

		}
		else if (cgs.objectives.show == SHOW_SHUTDOWN)
		{
			cgs.objectives.show = SHOW_OFF;
			return;
		}
		else
		{
			y += TS_Y - h;
		}

		CG_FillRect(x, y, OBJ_W, h, bgColor);
		CG_DrawRect(x, y, OBJ_W, h, 1, borderColor);

		y += 1;

		// Header
		CG_FillRect(x + 1, y, OBJ_W - 2, tSpacing + 4, bgColorTitle);
		CG_DrawRect(x + 1, y, OBJ_W - 2, tSpacing + 4, 1, borderColorTitle);

		y += tSpacing;
		CG_Text_Paint_Ext(x + 4, y, hScale, hScaleY, hdrColor, CG_TranslateString("OBJECTIVES"), 0.0f, 0, hStyle, hFont);

		y += 4;

		if (!count)
		{
			y += tSpacing;
			CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, "Unable to load objectives", 0.0f, 0, tStyle, tFont);
			return;
		}

		cs = CG_ConfigString(CS_MULTI_OBJECTIVE);

		if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_SPECTATOR)
		{
			Q_strncpyz(temp, cg.objMapDescription_Neutral, sizeof(temp));
			while ((s = strchr(temp, '*')))
			{
				*s = '\n';
			}
			CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 8, sizeof(temp), FONT_TEXT);
			s = p = temp;
			while (*p)
			{
				if (*p == '\n')
				{
					*p++ = '\0';
					y   += tSpacing;
					CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, s, 0.0f, 0, tStyle, tFont);
					s = p;
				}
				else
				{
					p++;
				}
			}
			if (temp[0] && count > 0)
			{
				count--;
				y += tSpacing;
			}

			Q_strncpyz(temp, cg.objMapDescription_Allied, sizeof(temp));
			while ((s = strchr(temp, '*')))
			{
				*s = '\n';
			}
			CG_DrawPic(x + 4, y + 2, 18, 12, cgs.media.alliedFlag);
			CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 26, sizeof(temp), FONT_TEXT);
			y += tSpacing;
			CG_Text_Paint_Ext(x + 26, y, tScale, tScale, tColor, "^4Allies", 0.0f, 0, tStyle, tFont);
			s = p = temp;
			while (*p)
			{
				if (*p == '\n')
				{
					*p++ = '\0';
					y   += tSpacing;
					CG_Text_Paint_Ext(x + 26, y, tScale, tScale, tColor, s, 0.0f, 0, tStyle, tFont);
					s = p;
				}
				else
				{
					p++;
				}
			}
			if (temp[0] && count > 0)
			{
				count--;
				y += tSpacing;
			}

			Q_strncpyz(temp, cg.objMapDescription_Axis, sizeof(temp));
			while ((s = strchr(temp, '*')))
			{
				*s = '\n';
			}
			CG_DrawPic(x + 4, y + 2, 18, 12, cgs.media.axisFlag);
			CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 26, sizeof(temp), FONT_TEXT);
			y += tSpacing;
			CG_Text_Paint_Ext(x + 26, y, tScale, tScale, tColor, "^1Axis", 0.0f, 0, tStyle, tFont);
			s = p = temp;
			while (*p)
			{
				if (*p == '\n')
				{
					*p++ = '\0';
					y   += tSpacing;
					CG_Text_Paint_Ext(x + 26, y, tScale, tScale, tColor, s, 0.0f, 0, tStyle, tFont);
					s = p;
				}
				else
				{
					p++;
				}
			}
			if (temp[0] && count > 0)
			{
				count--;
				y += tSpacing;
			}
		}
		else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES)
		{
			for (i = 0; i < MAX_OBJECTIVES && cg.objDescription_Allied[i][0] ; i++)
			{
				Q_strncpyz(temp, cg.objDescription_Allied[i], sizeof(temp));
				while ((s = strstr(temp, "**")))
				{
					*s = ' ';
				}
				while ((s = strchr(temp, '*')))
				{
					*s = '\n';
				}
				CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 26, sizeof(temp), FONT_TEXT);

				color[0] = '\0';
				status   = atoi(Info_ValueForKey(cs, va("a%i", i + 1)));
				if (status == 1)
				{
					CG_DrawPic(x + 4, y + 3, 18, 12, cgs.media.alliedFlag);
					Q_strncpyz(color, "^2", sizeof(color));
				}
				else if (status == 2)
				{
					CG_DrawPic(x + 4, y + 3, 18, 12, cgs.media.axisFlag);
					Q_strncpyz(color, "^1", sizeof(color));
				}

				s = p = temp;
				while (*p)
				{
					if (*p == '\n')
					{
						*p++ = '\0';
						y   += tSpacing;
						CG_Text_Paint_Ext(x + 26, y, tScale, tScale, tColor, va("%s%s", color[0] ? color : "", s), 0.0f, 0, tStyle, tFont);
						s = p;
					}
					else
					{
						p++;
					}
				}
				if (temp[0] && count > 0)
				{
					count--;
					y += tSpacing;
				}
			}
		}
		else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS)
		{
			for (i = 0; i < MAX_OBJECTIVES && cg.objDescription_Axis[i][0] ; i++)
			{
				Q_strncpyz(temp, cg.objDescription_Axis[i], sizeof(temp));
				while ((s = strstr(temp, "**")))
				{
					*s = ' ';
				}
				while ((s = strchr(temp, '*')))
				{
					*s = '\n';
				}
				CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 26, sizeof(temp), FONT_TEXT);

				color[0] = '\0';
				status   = atoi(Info_ValueForKey(cs, va("x%i", i + 1)));
				if (status == 1)
				{
					CG_DrawPic(x + 4, y + 3, 18, 12, cgs.media.axisFlag);
					Q_strncpyz(color, "^2", sizeof(color));
				}
				else if (status == 2)
				{
					CG_DrawPic(x + 4, y + 3, 18, 12, cgs.media.alliedFlag);
					Q_strncpyz(color, "^1", sizeof(color));
				}

				s = p = temp;
				while (*p)
				{
					if (*p == '\n')
					{
						*p++ = '\0';
						y   += tSpacing;
						CG_Text_Paint_Ext(x + 26, y, tScale, tScale, tColor, va("%s%s", color[0] ? color : "", s), 0.0f, 0, tStyle, tFont);
						s = p;
					}
					else
					{
						p++;
					}
				}
				if (temp[0] && count > 0)
				{
					count--;
					y += tSpacing;
				}
			}
		}
	}
}
Exemplo n.º 9
0
void CG_TopShotsDraw(void)
{
	if (cgs.topshots.show == SHOW_OFF)
	{
		return;
	}
	else
	{
		int            x                = Ccg_WideX(SCREEN_WIDTH) + TS_X - TS_W, y = SCREEN_HEIGHT, h;
		topshotStats_t *ts              = &cgs.topshots;
		vec4_t         bgColor          = COLOR_BG; // window
		vec4_t         borderColor      = COLOR_BORDER; // window
		vec4_t         bgColorTitle     = COLOR_BG_TITLE; // titlebar
		vec4_t         borderColorTitle = COLOR_BORDER_TITLE; // titlebar

		// Main header
		int          hStyle  = 0;
		float        hScale  = 0.19f;
		float        hScaleY = 0.19f;
		fontHelper_t *hFont  = FONT_HEADER;

		// Sub header
		int          hStyle2  = 0;
		float        hScale2  = 0.16f;
		float        hScaleY2 = 0.20f;
		fontHelper_t *hFont2  = FONT_SUBHEADER;
		vec4_t       hdrColor = COLOR_TEXT;       // text

		// Text settings
		int          tStyle   = ITEM_TEXTSTYLE_SHADOWED;
		int          tSpacing = 9;      // Should derive from CG_Text_Height_Ext
		float        tScale   = 0.19f;
		fontHelper_t *tFont   = FONT_TEXT;
		vec4_t       tColor   = COLOR_TEXT; // text

		float diff = cgs.topshots.fadeTime - cg.time;


		// FIXME: Should compute this beforehand
		h = 2 + tSpacing + 2 +                                  // Header
		    2 + 2 + tSpacing + 2 +                          // Stats columns
		    1 +                                             // Stats + extra
		    tSpacing * ((ts->cWeapons > 0) ? ts->cWeapons : 1) +
		    1;

		// Fade-in effects
		if (diff > 0.0f)
		{
			float scale = (diff / STATS_FADE_TIME);

			if (cgs.topshots.show == SHOW_ON)
			{
				scale = 1.0f - scale;
			}

			bgColor[3]          *= scale;
			bgColorTitle[3]     *= scale;
			borderColor[3]      *= scale;
			borderColorTitle[3] *= scale;
			hdrColor[3]         *= scale;
			tColor[3]           *= scale;

			y += (TS_Y - h) * scale;

		}
		else if (cgs.topshots.show == SHOW_SHUTDOWN)
		{
			cgs.topshots.show = SHOW_OFF;
			return;
		}
		else
		{
			y += TS_Y - h;
		}

		CG_FillRect(x, y, TS_W, h, bgColor);
		CG_DrawRect(x, y, TS_W, h, 1, borderColor);

		y += 1;

		// Header
		CG_FillRect(x + 1, y, TS_W - 2, tSpacing + 4, bgColorTitle);
		CG_DrawRect(x + 1, y, TS_W - 2, tSpacing + 4, 1, borderColorTitle);

		y += tSpacing;
		CG_Text_Paint_Ext(x + 4, y, hScale, hScaleY, hdrColor, CG_TranslateString("\"TOPSHOT\" ACCURACIES"), 0.0f, 0, hStyle, hFont);
		y += 4;

		// Weapon stats
		y += 2;
		CG_FillRect(x + 1, y, TS_W - 2, tSpacing + 3, bgColorTitle);
		CG_DrawRect(x + 1, y, TS_W - 2, tSpacing + 3, 1, borderColorTitle);

		x += 4;
		y += 1 + tSpacing;
		CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Weapon"), 0.0f, 0, hStyle2, hFont2);
		x += 60;
		CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Accuracy"), 0.0f, 0, hStyle2, hFont2);
		x += 53;
		CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Hits / Shots"), 0.0f, 0, hStyle2, hFont2);
		x += 62;
		CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Kills"), 0.0f, 0, hStyle2, hFont2);
		x += 32;
		CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Player"), 0.0f, 0, hStyle2, hFont2);

		x  = Ccg_WideX(SCREEN_WIDTH) + TS_X - TS_W + 4;
		y += 1;

		if (ts->cWeapons == 0)
		{
			y += tSpacing;
			CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, CG_TranslateString("No qualifying weapon info available."), 0.0f, 0, tStyle, tFont);
		}
		else
		{
			int i;

			for (i = 0; i < ts->cWeapons; i++)
			{
				y += tSpacing;
				CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, ts->strWS[i], 0.0f, 0, tStyle, tFont);
			}
		}
	}
}
Exemplo n.º 10
0
void CG_GameStatsDraw(void)
{
	if (cgs.gamestats.show == SHOW_OFF)
	{
		return;

	}
	else
	{
		int         i, x = (Ccg_WideX(SCREEN_WIDTH) / 2) - (GS_W / 2), y = GS_Y, h;
		gameStats_t *gs = &cgs.gamestats;

		vec4_t bgColor     = COLOR_BG;      // window
		vec4_t borderColor = COLOR_BORDER;  // window

		vec4_t bgColorTitle     = COLOR_BG_TITLE;       // titlebar
		vec4_t borderColorTitle = COLOR_BORDER_TITLE;   // titlebar

		// Main header
		int          hStyle  = 0;
		float        hScale  = 0.19f;
		float        hScaleY = 0.19f;
		fontHelper_t *hFont  = FONT_HEADER;

		// Sub header
		int          hStyle2  = 0;
		float        hScale2  = 0.16f;
		float        hScaleY2 = 0.20f;
		fontHelper_t *hFont2  = FONT_SUBHEADER;
		vec4_t       hdrColor = COLOR_TEXT;    // text

		// Text settings
		int          tStyle   = ITEM_TEXTSTYLE_SHADOWED;
		int          tSpacing = 9;      // Should derive from CG_Text_Height_Ext
		float        tScale   = 0.19f;
		fontHelper_t *tFont   = FONT_TEXT;
		vec4_t       tColor   = COLOR_TEXT; // text

		float diff = cgs.gamestats.fadeTime - cg.time;


		// FIXME: Should compute this beforehand
		h = 2 + tSpacing + 2 +                              // Header
		    2 + 2 + tSpacing + 2 +                          // Stats columns
		    1 +                                             // Stats + extra
		    tSpacing * ((gs->cWeapons > 0) ? gs->cWeapons : 1) +
		    tSpacing * ((gs->fHasStats) ? 7 : 0) +
		    ((cgs.gametype == GT_WOLF_LMS) ? 0 :
		     (
		         4 + 2 * tSpacing +                                 // Rank/XP/Skill Rating
		         1 + tSpacing +
		         4 + 2 * tSpacing +                                 // Skill columns
		         1 +                                                // Skillz
		         tSpacing * ((gs->cSkills > 0) ? gs->cSkills : 1)
		     )
		    ) +
		    2;

		// Fade-in effects
		if (diff > 0.0f)
		{
			float scale = (diff / STATS_FADE_TIME);

			if (cgs.gamestats.show == SHOW_ON)
			{
				scale = 1.0f - scale;
			}

			bgColor[3]          *= scale;
			bgColorTitle[3]     *= scale;
			borderColor[3]      *= scale;
			borderColorTitle[3] *= scale;
			hdrColor[3]         *= scale;
			tColor[3]           *= scale;

			y -= h * (1.0f - scale);

		}
		else if (cgs.gamestats.show == SHOW_SHUTDOWN)
		{
			cgs.gamestats.show = SHOW_OFF;
			return;
		}

		CG_FillRect(x, y, GS_W, h, bgColor);
		CG_DrawRect(x, y, GS_W, h, 1, borderColor);

		y += 1;

		// Header
		CG_FillRect(x + 1, y, GS_W - 2, tSpacing + 4, bgColorTitle);
		CG_DrawRect(x + 1, y, GS_W - 2, tSpacing + 4, 1, borderColorTitle);

		y += tSpacing;
		CG_Text_Paint_Ext(x + 4, y, hScale, hScaleY, hdrColor, CG_TranslateString("PLAYER STATS"), 0.0f, 0, hStyle, hFont);
		y += 3;

		y += 2;

		// Weapon stats
		y += 2;
		CG_FillRect(x + 1, y, GS_W - 2, tSpacing + 3, bgColorTitle);
		CG_DrawRect(x + 1, y, GS_W - 2, tSpacing + 3, 1, borderColorTitle);

		y += 1 + tSpacing;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Weapon"), 0.0f, 0, hStyle2, hFont2);
		x += 66;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Accuracy"), 0.0f, 0, hStyle2, hFont2);
		x += 53;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Hits / Shots"), 0.0f, 0, hStyle2, hFont2);
		x += 62;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Kills"), 0.0f, 0, hStyle2, hFont2);
		x += 29;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Deaths"), 0.0f, 0, hStyle2, hFont2);
		x += 40;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Headshots"), 0.0f, 0, hStyle2, hFont2);

		x  = (Ccg_WideX(SCREEN_WIDTH) / 2) - (GS_W / 2);
		y += 2;

		y += 1;
		if (gs->cWeapons == 0)
		{
			y += tSpacing;
			CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, CG_TranslateString("No weapon info available."), 0.0f, 0, tStyle, tFont);
		}
		else
		{
			for (i = 0; i < gs->cWeapons; i++)
			{
				y += tSpacing;
				CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, gs->strWS[i], 0.0f, 0, tStyle, tFont);
			}

			if (gs->fHasStats)
			{
				y += tSpacing;
				for (i = 0; i < 6; i++)
				{
					y += tSpacing;
					CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, gs->strExtra[i], 0.0f, 0, tStyle, tFont);
				}
			}
		}


		// No rank/xp/skill info for LMS
		if (cgs.gametype == GT_WOLF_LMS)
		{
			return;
		}

		// Rank/XP info
		y += tSpacing;
		y += 2;
		CG_FillRect(x + 1, y, GS_W - 2, tSpacing + 3, bgColorTitle);
		CG_DrawRect(x + 1, y, GS_W - 2, tSpacing + 3, 1, borderColorTitle);

		y += 1 + tSpacing;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Rank"), 0.0f, 0, hStyle2, hFont2);
		x += 122;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, "XP", 0.0f, 0, hStyle2, hFont2);
#ifdef FEATURE_RATING
		if (cgs.skillRating)
		{
			x += 100;
			CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, "Skill Rating", 0.0f, 0, hStyle2, hFont2);
		}
#endif

		x  = (Ccg_WideX(SCREEN_WIDTH) / 2) - (GS_W / 2);
		y += 1;
		y += tSpacing;
		CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, gs->strRank, 0.0f, 0, tStyle, tFont);

		// Skill info
		y += tSpacing;
		y += 2;
		CG_FillRect(x + 1, y, GS_W - 2, tSpacing + 3, bgColorTitle);
		CG_DrawRect(x + 1, y, GS_W - 2, tSpacing + 3, 1, borderColorTitle);

		y += 1 + tSpacing;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Skills"), 0.0f, 0, hStyle2, hFont2);
		x += 84;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Level"), 0.0f, 0, hStyle2, hFont2);
		x += 76;
		CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("XP / Next Level"), 0.0f, 0, hStyle2, hFont2);
		if (cgs.gametype == GT_WOLF_CAMPAIGN)
		{
			x += 108;
			CG_Text_Paint_Ext(x + 4, y, hScale2, hScaleY2, hdrColor, CG_TranslateString("Medals"), 0.0f, 0, hStyle2, hFont2);
		}

		x  = (Ccg_WideX(SCREEN_WIDTH) / 2) - (GS_W / 2);
		y += 1;

		if (gs->cSkills == 0)
		{
			y += tSpacing;
			CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, CG_TranslateString("No skills acquired!"), 0.0f, 0, tStyle, tFont);
		}
		else
		{
			for (i = 0; i < gs->cSkills; i++)
			{
				y += tSpacing;
				CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, gs->strSkillz[i], 0.0f, 0, tStyle, tFont);
			}

		}
	}
}
Exemplo n.º 11
0
void CG_DemoHelpDraw(void)
{
	if (cg.demohelpWindow == SHOW_OFF)
	{
		return;
	}
	else
	{
		const char *help[] =
		{
			"^7TAB       ^3scores",
			"^7F1-F5     ^3avidemo record",
			"^7F11-F12   ^3screenshot",
			NULL,
			"^7KP_DOWN   ^3slow down (--)",
			"^7KP_LEFT   ^3slow down (-)",
			"^7KP_UP     ^3speed up (++)",
			"^7KP_RIGHT  ^3speed up (+)",
			"^7SPACE     ^3normal speed",
			NULL,
			"^7ENTER     ^3External view",
			"^7LFT/RGHT  ^3Change angle",
			"^7UP/DOWN   ^3Move in/out"
		};

#ifdef FEATURE_MULTIVIEW
		const char *mvhelp[] =
		{
			NULL,
			"^7MOUSE1    ^3Select/move view",
			"^7MOUSE2    ^3Swap w/main view",
			"^7MOUSE3    ^3Toggle on/off",
			"^7SHIFT     ^3Hold to resize",
			"^7KP_PGUP   ^3Enable a view",
			"^7KP_PGDN   ^3Close a view"
		};
#endif

		int i, x, y = SCREEN_HEIGHT, w, h;

		vec4_t bgColor     = COLOR_BG;              // window
		vec4_t borderColor = COLOR_BORDER;          // window

		vec4_t bgColorTitle     = COLOR_BG_TITLE;       // titlebar
		vec4_t borderColorTitle = COLOR_BORDER_TITLE;   // titlebar

		// Main header
		int          hStyle   = 0;
		float        hScale   = 0.19f;
		float        hScaleY  = 0.19f;
		fontHelper_t *hFont   = FONT_HEADER;
		vec4_t       hdrColor = COLOR_TEXT;  // text

		// Text settings
		int          tStyle   = ITEM_TEXTSTYLE_SHADOWED;
		int          tSpacing = 9;      // Should derive from CG_Text_Height_Ext
		float        tScale   = 0.19f;
		fontHelper_t *tFont   = FONT_TEXT;
		vec4_t       tColor   = COLOR_TEXT; // text

		float diff = cg.fadeTime - trap_Milliseconds();

		// FIXME: Should compute this beforehand
		w = DH_W + (
#ifdef FEATURE_MULTIVIEW
		    (cg.mvTotalClients > 1) ? 12 :
#endif
		    0);
		x = Ccg_WideX(SCREEN_WIDTH) + 3 * DH_X - w;
		h = tSpacing + 9 +
		    tSpacing * (2 +
#ifdef FEATURE_MULTIVIEW
		                ((cg.mvTotalClients > 1) ? ARRAY_LEN(mvhelp) : ARRAY_LEN(help))
#else
		                ARRAY_LEN(help)
#endif
		                );

		// Fade-in effects
		if (diff > 0.0f)
		{
			float scale = (diff / STATS_FADE_TIME);

			if (cg.demohelpWindow == SHOW_ON)
			{
				scale = 1.0f - scale;
			}

			bgColor[3]          *= scale;
			bgColorTitle[3]     *= scale;
			borderColor[3]      *= scale;
			borderColorTitle[3] *= scale;
			hdrColor[3]         *= scale;
			tColor[3]           *= scale;

			y += (DH_Y - h) * scale;

		}
		else if (cg.demohelpWindow == SHOW_SHUTDOWN)
		{
			cg.demohelpWindow = SHOW_OFF;
			return;
		}
		else
		{
			y += DH_Y - h;
		}

		if (cg.legacyClient && cg.demoinfo)
		{
			CG_DrawDemoControls(x, y - 62, w, borderColor, bgColor, tSpacing, bgColorTitle, borderColorTitle, hScale, hScaleY, hdrColor, hStyle, hFont);
			y += 10;
		}

		CG_FillRect(x, y, w, h, bgColor);
		CG_DrawRect(x, y, w, h, 1, borderColor);

		y += 1;

		// Header
		CG_FillRect(x + 1, y, w - 2, tSpacing + 4, bgColorTitle);
		CG_DrawRect(x + 1, y, w - 2, tSpacing + 4, 1, borderColorTitle);

		x += 4;
		y += tSpacing;

		CG_Text_Paint_Ext(x, y, hScale, hScaleY, hdrColor, CG_TranslateString("DEMO CONTROLS"), 0.0f, 0, hStyle, hFont);

		y += 3;

		// Control info
		for (i = 0; i < ARRAY_LEN(help); i++)
		{
			y += tSpacing;
			if (help[i] != NULL)
			{
				CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, (char *)help[i], 0.0f, 0, tStyle, tFont);
			}
		}

#if FEATURE_MULTIVIEW
		if (cg.mvTotalClients > 1)
		{
			for (i = 0; i < ARRAY_LEN(mvhelp); i++)
			{
				y += tSpacing;
				if (mvhelp[i] != NULL)
				{
					CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, (char *)mvhelp[i], 0.0f, 0, tStyle, tFont);
				}
			}
		}
#endif

		y += tSpacing * 2;
		CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, CG_TranslateString("^7BACKSPACE ^3help on/off"), 0.0f, 0, tStyle, tFont);
	}
}
Exemplo n.º 12
0
static int WM_DrawInfoLine(int x, int y, float fade)
{
	int        w, defender, winner;
	const char *s;

	if (cg.snap->ps.pm_type != PM_INTERMISSION)
	{
		return y;
	}

	w = 360;

	s        = CG_ConfigString(CS_MULTI_INFO);
	defender = atoi(Info_ValueForKey(s, "d")); // defender

	s      = CG_ConfigString(CS_MULTI_MAPWINNER);
	winner = atoi(Info_ValueForKey(s, "w"));

	if (cgs.currentRound)
	{
		// first round
		s = va(CG_TranslateString("CLOCK IS NOW SET TO %s!"), WM_TimeToString(cgs.nextTimeLimit * 60.f * 1000.f));
	}
	else
	{
		// second round
		if (!defender)
		{
			if (winner != defender)
			{
				s = "ALLIES SUCCESSFULLY BEAT THE CLOCK!";
			}
			else
			{
				s = "ALLIES COULDN'T BEAT THE CLOCK!";
			}
		}
		else
		{
			if (winner != defender)
			{
				s = "AXIS SUCCESSFULLY BEAT THE CLOCK!";
			}
			else
			{
				s = "AXIS COULDN'T BEAT THE CLOCK!";
			}
		}

		s = CG_TranslateString(s);
	}

	CG_FillRect(Ccg_WideX(320) - w / 2, y, w, 20, clrUiBar);
	CG_DrawRect_FixedBorder(Ccg_WideX(320) - w / 2, y, w, 20, 1, colorBlack);

	w = CG_Text_Width_Ext(s, 0.25f, 0, &cgs.media.limboFont1);

	CG_Text_Paint_Ext(Ccg_WideX(320) - w * 0.5f, y + 15, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1);

	return y + INFO_LINE_HEIGHT + 6;
}
Exemplo n.º 13
0
void CG_Hud_Setup(void)
{
	hudStucture_t hud1;
	hudStucture_t hud2;

	// Hud0 aka the Default hud
	CG_setDefaultHudValues(&hud0);
	activehud = &hud0;
	CG_addHudToList(hud0);

	// Hud1
	hud1.hudnumber       = 1;
	hud1.compas          = CG_getComponent(44, 480 - 75, 72, 72, qtrue, STYLE_NORMAL);
	hud1.staminabar      = CG_getComponent(4, 388, 12, 72, qtrue, STYLE_NORMAL);
	hud1.healthbar       = CG_getComponent((Ccg_WideX(640) - 36), 388, 12, 72, qtrue, STYLE_NORMAL);
	hud1.weaponchargebar = CG_getComponent((Ccg_WideX(640) - 16), 388, 12, 72, qtrue, STYLE_NORMAL);
	hud1.healthtext      = CG_getComponent(Ccg_WideX(640) - 60, 480 - 65, 0, 0, qtrue, STYLE_NORMAL);
	hud1.xptext          = CG_getComponent(28, 480 - 4, 0, 0, qtrue, STYLE_NORMAL);
	hud1.statsdisplay    = CG_getComponent(24, 480 - 95, 0, 0, qtrue, STYLE_SIMPLE);
	hud1.weaponicon      = CG_getComponent((Ccg_WideX(640) - 82 - 20), (480 - 56), 60, 32, qtrue, STYLE_NORMAL);
	hud1.weaponammo      = CG_getComponent(Ccg_WideX(640) - 22 - 20, 480 - 1 * (16 + 2) + 12 - 4, 0, 0, qtrue, STYLE_NORMAL);
	hud1.fireteam        = CG_getComponent((Ccg_WideX(640) - 240), 10, 100, 100, qtrue, STYLE_NORMAL);
	hud1.popupmessages   = CG_getComponent(4, 100, 72, 72, qtrue, STYLE_NORMAL);
	hud1.powerups        = CG_getComponent(Ccg_WideX(640) - 40, 480 - 140, 36, 36, qtrue, STYLE_NORMAL);
	hud1.hudhead         = CG_getComponent(44, 480 - 92, 62, 80, qfalse, STYLE_NORMAL);
	hud1.cursorhint      = CG_getComponent(.5f * SCREEN_WIDTH - .5f * 48, 260, 48, 48, qtrue, STYLE_NORMAL);
	hud1.weaponstability = CG_getComponent(50, 208, 10, 64, qtrue, STYLE_NORMAL);
	hud1.livesleft       = CG_getComponent(0, 0, 0, 0, qtrue, STYLE_NORMAL);
	CG_addHudToList(hud1);

	// Hud2
	hud2.hudnumber       = 2;
	hud2.compas          = CG_getComponent(64, 480 - 75, 72, 72, qtrue, STYLE_NORMAL);
	hud2.staminabar      = CG_getComponent(4, 388, 12, 72, qtrue, STYLE_NORMAL);
	hud2.healthbar       = CG_getComponent(24, 388, 12, 72, qtrue, STYLE_NORMAL);
	hud2.weaponchargebar = CG_getComponent((Ccg_WideX(640) - 16), 388, 12, 72, qtrue, STYLE_NORMAL);
	hud2.healthtext      = CG_getComponent(65, 480 - 4, 0, 0, qtrue, STYLE_NORMAL);
	hud2.xptext          = CG_getComponent(120, 480 - 4, 0, 0, qtrue, STYLE_NORMAL);
	hud2.statsdisplay    = CG_getComponent(44, 480 - 95, 0, 0, qtrue, STYLE_SIMPLE);
	hud2.weaponicon      = CG_getComponent((Ccg_WideX(640) - 82), (480 - 56), 60, 32, qtrue, STYLE_NORMAL);
	hud2.weaponammo      = CG_getComponent(Ccg_WideX(640) - 22, 480 - 1 * (16 + 2) + 12 - 4, 0, 0, qtrue, STYLE_NORMAL);
	hud2.fireteam        = CG_getComponent((Ccg_WideX(640) - 240), 10, 100, 100, qtrue, STYLE_NORMAL);
	hud2.popupmessages   = CG_getComponent(4, 100, 72, 72, qtrue, STYLE_NORMAL);
	hud2.powerups        = CG_getComponent(Ccg_WideX(640) - 40, 480 - 140, 36, 36, qtrue, STYLE_NORMAL);
	hud2.hudhead         = CG_getComponent(44, 480 - 92, 62, 80, qfalse, STYLE_NORMAL);
	hud2.cursorhint      = CG_getComponent(.5f * SCREEN_WIDTH - .5f * 48, 260, 48, 48, qtrue, STYLE_NORMAL);
	hud2.weaponstability = CG_getComponent(50, 208, 10, 64, qtrue, STYLE_NORMAL);
	hud2.livesleft       = CG_getComponent(0, 0, 0, 0, qtrue, STYLE_NORMAL);
	CG_addHudToList(hud2);

	// Read the hud files
	CG_ReadHudScripts();
}
Exemplo n.º 14
0
static float CG_DrawFPS(float y)
{
	static int previousTimes[MAX_FPS_FRAMES];
	static int previous;
	static int index;
	static int oldSamples;
	char       *s;
	int        t         = trap_Milliseconds(); // don't use serverTime, because that will be drifting to correct for internet lag changes, timescales, timedemos, etc
	int        frameTime = t - previous;
	int        x, w, w2;
	int        samples = cg_drawFPS.integer;

	previous = t;

	if (samples < 4)
	{
		samples = 4;
	}
	if (samples > MAX_FPS_FRAMES)
	{
		samples = MAX_FPS_FRAMES;
	}
	if (samples != oldSamples)
	{
		index = 0;
	}

	oldSamples                     = samples;
	previousTimes[index % samples] = frameTime;
	index++;

	if (index > samples)
	{
		int i, fps;
		// average multiple frames together to smooth changes out a bit
		int total = 0;

		for (i = 0 ; i < samples ; ++i)
		{
			total += previousTimes[i];
		}

		total = total ? total : 1;

		fps = 1000 * samples / total;

		s = va("%i FPS", fps);
	}
	else
	{
		s = "estimating";
	}

	w  = CG_Text_Width_Ext(s, 0.19f, 0, &cgs.media.limboFont1);
	w2 = (UPPERRIGHT_W > w) ? UPPERRIGHT_W : w;

	x = (int)(Ccg_WideX(UPPERRIGHT_X)) - w2 - 2;
	CG_FillRect(x, y, w2 + 5, 12 + 2, HUD_Background);
	CG_DrawRect_FixedBorder(x, y, w2 + 5, 12 + 2, 1, HUD_Border);
	CG_Text_Paint_Ext(x + ((w2 - w) / 2) + 2, y + 11, 0.19f, 0.19f, HUD_Text, s, 0, 0, 0, &cgs.media.limboFont1);

	return y + 12 + 4;
}
Exemplo n.º 15
0
static void CG_CompasMoveLocation(float *basex, float *basey, qboolean animationout)
{
	float x    = *basex;
	float y    = *basey;
	float cent = activehud->compas.location.w / 2;
	x += cent;
	y += cent;

	if (x < Ccg_WideX(320))
	{
		if (y < 240)
		{
			if (x < y)
			{
				//move left
				CG_CompasMoveLocationCalc(basex, qfalse, animationout);
			}
			else
			{
				//move up
				CG_CompasMoveLocationCalc(basey, qfalse, animationout);
			}
		}
		else
		{
			if (x < (480 - y))
			{
				//move left
				CG_CompasMoveLocationCalc(basex, qfalse, animationout);
			}
			else
			{
				//move down
				CG_CompasMoveLocationCalc(basey, qtrue, animationout);
			}
		}
	}
	else
	{
		if (y < 240)
		{
			if ((Ccg_WideX(640) - x) < y)
			{
				//move right
				CG_CompasMoveLocationCalc(basex, qtrue, animationout);
			}
			else
			{
				//move up
				CG_CompasMoveLocationCalc(basey, qfalse, animationout);
			}
		}
		else
		{
			if ((Ccg_WideX(640) - x) < (480 - y))
			{
				//move right
				CG_CompasMoveLocationCalc(basex, qtrue, animationout);
			}
			else
			{
				//move down
				CG_CompasMoveLocationCalc(basey, qtrue, animationout);
			}
		}
	}
}
Exemplo n.º 16
0
void CG_DrawExpandedAutoMap(void)
{
	float b_x, b_y, b_w, b_h;
	float s1, t1, s2, t2;
	float x = Ccg_WideX(SCREEN_WIDTH) + 10.f;
	float y = 20.f;
	float w = CC_2D_W;
	float h = CC_2D_H;

	if (cgs.autoMapExpanded)
	{
		if (cg.time - cgs.autoMapExpandTime < 250.f)
		{
			x -= ((cg.time - cgs.autoMapExpandTime) / 250.f) * (w + 30.f);
		}
		else
		{
			x = Ccg_WideX(SCREEN_WIDTH) - w - 20.f;
		}
	}
	else
	{
		if (cg.time - cgs.autoMapExpandTime < 250.f)
		{
			x = (Ccg_WideX(SCREEN_WIDTH) - w - 20.f) + ((cg.time - cgs.autoMapExpandTime) / 250.f) * (w + 30.f);
		}
		else
		{
			return;
		}
	}

	CG_DrawMap(x, y, w, h, cgs.ccFilter, NULL, qfalse, .7f, qfalse);

	// Draw the border

	// top left
	s1  = 0;
	t1  = 0;
	s2  = 1;
	t2  = 1;
	b_x = x - 8;
	b_y = y - 8;
	b_w = 8;
	b_h = 8;
	CG_AdjustFrom640(&b_x, &b_y, &b_w, &b_h);
	trap_R_DrawStretchPic(b_x, b_y, b_w, b_h, s1, t1, s2, t2, cgs.media.commandCentreAutomapCornerShader);

	// top
	s2  = w / 256.f;
	b_x = x;
	b_y = y - 8;
	b_w = w;
	b_h = 8;
	CG_AdjustFrom640(&b_x, &b_y, &b_w, &b_h);
	trap_R_DrawStretchPic(b_x, b_y, b_w, b_h, s1, t1, s2, t2, cgs.media.commandCentreAutomapBorderShader);

	// top right
	s1  = 1;
	t1  = 0;
	s2  = 0;
	t2  = 1;
	b_x = x + w;
	b_y = y - 8;
	b_w = 8;
	b_h = 8;
	CG_AdjustFrom640(&b_x, &b_y, &b_w, &b_h);
	trap_R_DrawStretchPic(b_x, b_y, b_w, b_h, s1, t1, s2, t2, cgs.media.commandCentreAutomapCornerShader);

	// right
	s1  = 1;
	t1  = h / 256.f;
	s2  = 0;
	t2  = 0;
	b_x = x + w;
	b_y = y;
	b_w = 8;
	b_h = h;
	CG_AdjustFrom640(&b_x, &b_y, &b_w, &b_h);
	trap_R_DrawStretchPic(b_x, b_y, b_w, b_h, s1, t1, s2, t2, cgs.media.commandCentreAutomapBorder2Shader);

	// bottom right
	s1  = 1;
	t1  = 1;
	s2  = 0;
	t2  = 0;
	b_x = x + w;
	b_y = y + h;
	b_w = 8;
	b_h = 8;
	CG_AdjustFrom640(&b_x, &b_y, &b_w, &b_h);
	trap_R_DrawStretchPic(b_x, b_y, b_w, b_h, s1, t1, s2, t2, cgs.media.commandCentreAutomapCornerShader);

	// bottom
	s1  = w / 256.f;
	b_x = x;
	b_y = y + h;
	b_w = w;
	b_h = 8;
	CG_AdjustFrom640(&b_x, &b_y, &b_w, &b_h);
	trap_R_DrawStretchPic(b_x, b_y, b_w, b_h, s1, t1, s2, t2, cgs.media.commandCentreAutomapBorderShader);

	// bottom left
	s1  = 0;
	t1  = 1;
	s2  = 1;
	t2  = 0;
	b_x = x - 8;
	b_y = y + h;
	b_w = 8;
	b_h = 8;
	CG_AdjustFrom640(&b_x, &b_y, &b_w, &b_h);
	trap_R_DrawStretchPic(b_x, b_y, b_w, b_h, s1, t1, s2, t2, cgs.media.commandCentreAutomapCornerShader);

	// left
	s1  = 0;
	t1  = 0;
	s2  = 1;
	t2  = h / 256.f;
	b_x = x - 8;
	b_y = y;
	b_w = 8;
	b_h = h;
	CG_AdjustFrom640(&b_x, &b_y, &b_w, &b_h);
	trap_R_DrawStretchPic(b_x, b_y, b_w, b_h, s1, t1, s2, t2, cgs.media.commandCentreAutomapBorder2Shader);
}