qboolean CG_ViewingDraw() { if ( cg.mvTotalClients < 1 ) { return( qfalse ); } else { int w, wTag; int tSpacing = 15; // Should derive from CG_Text_Height_Ext int pID = cg.mvCurrentMainview->mvInfo & MV_PID; char *viewInfo = "Viewing:"; wTag = CG_Text_Width_Ext( viewInfo, VD_SCALE_X_HDR, 0, FONT_HEADER ); w = wTag + 3 + CG_Text_Width_Ext( cgs.clientinfo[pID].name, VD_SCALE_X_NAME, 0, FONT_TEXT ); CG_DrawRect( VD_X - 2, VD_Y, w + 7, tSpacing + 4, 1, color_border ); CG_FillRect( VD_X - 2, VD_Y, w + 7, tSpacing + 4, color_bg ); CG_Text_Paint_Ext( VD_X, VD_Y + tSpacing, // x, y VD_SCALE_X_HDR, VD_SCALE_Y_HDR, // scale_x, scale_y color_hdr, viewInfo, 0.0f, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_HEADER ); CG_Text_Paint_Ext( VD_X + wTag + 5, VD_Y + tSpacing, // x, y VD_SCALE_X_NAME, VD_SCALE_Y_NAME, // scale_x, scale_y color_name, cgs.clientinfo[pID].name, 0.0f, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_TEXT ); return( qtrue ); } }
//actually do camera fade void CGCam_DoFade(void) { if(client_camera.fade_color[0] != 0 || client_camera.fade_color[1] != 0 || client_camera.fade_color[2] != 0 || client_camera.fade_color[3] != 0) { CG_DrawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_WIDTH*SCREEN_HEIGHT, client_camera.fade_color); } }
void CG_DrawDemoControls(int x, int y, int w, vec4_t borderColor, vec4_t bgColor, int tSpacing, vec4_t bgColorTitle, vec4_t borderColorTitle, float hScale, float hScaleY, vec4_t hdrColor, int hStyle, fontHelper_t *hFont) { static panel_button_text_t demoControlTxt; int i; demoControlTxt.scalex = hScale; demoControlTxt.scaley = hScaleY; Vector4Copy(hdrColor, demoControlTxt.colour); demoControlTxt.style = ITEM_ALIGN_CENTER; demoControlTxt.align = 0; demoControlTxt.font = hFont; CG_FillRect(x, y, w, 50, bgColor); CG_DrawRect(x, y, w, 50, 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); CG_Text_Paint_Ext(x + 4, y + tSpacing, hScale, hScaleY, hdrColor, CG_TranslateString("DEMO STATUS"), 0.0f, 0, hStyle, hFont); for (i = 0; i < 4; i++) { if (i) { RectangleSet(demoControlButtons[i]->rect, (x + (i * (w / 4)) - 15), y + 30, 30, 15); } else { RectangleSet(demoControlButtons[i]->rect, x + 2, y + 15, w - 4, 12); } demoControlButtons[i]->font = &demoControlTxt; } BG_PanelButtonsRender(demoControlButtons); if (cg.time < cgs.cursorUpdate) { // render cursor trap_R_SetColor(NULL); CG_DrawPic(cgDC.cursorx, cgDC.cursory, 32, 32, cgs.media.cursorIcon); } }
void CG_demoTimescaleDraw( void ) { if ( cg.demoPlayback && cgs.timescaleUpdate > cg.time && demo_drawTimeScale.integer != 0 ) { char *s = va( "^3TimeScale: ^7%.1f", cg_timescale.value ); int w = CG_DrawStrlen( s ) * SMALLCHAR_WIDTH; CG_FillRect( 42 - 2, 400, w + 5, SMALLCHAR_HEIGHT + 3, colorDkGreen ); CG_DrawRect( 42 - 2, 400, w + 5, SMALLCHAR_HEIGHT + 3, 1, colorMdYellow ); CG_DrawStringExt( 42, 400, s, colorWhite, qfalse, qtrue, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 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); } }
void CG_DemoControlButtonRender(panel_button_t *button) { if (button->data[0]) { CG_FillRect(button->rect.x, button->rect.y, button->rect.w, button->rect.h, color_bg_title); CG_DrawRect(button->rect.x, button->rect.y, button->rect.w, button->rect.h, 1, color_border); //BG_PanelButtonsRender_Text(button); CG_Text_Paint_Ext(button->rect.x + button->rect.w * 0.4f, button->rect.y + button->rect.h * 0.7f, button->font->scalex, button->font->scaley, button->font->colour, button->text, 0.0f, 0, button->font->style, button->font->font); } else { float demoStatus = ((float)(cg.time - cg.demoinfo->firstTime)) / (cg.demoinfo->lastTime - cg.demoinfo->firstTime); vec4_t barColor; Vector4Copy(colorGreen, barColor); barColor[3] = button->font->colour[3]; //borderColor CG_FilledBar(button->rect.x, button->rect.y, button->rect.w, button->rect.h, barColor, NULL, color_border1, demoStatus, BAR_BG); } }
// FIXME: add more options to shorten this box void CG_DrawFireTeamOverlay(rectDef_t *rect) { int x = rect->x; int y = rect->y + 1; // +1, jitter it into place in 1024 :) int i; int boxWidth = 106; int bestWidth = -1; char buffer[64]; float h = 16; // 12 + 2 + 2 clientInfo_t *ci = NULL; fireteamData_t *f = NULL; char *locStr[MAX_FIRETEAM_MEMBERS]; int locwidth; int namewidth; 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(locStr)); // 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; } origin[0] = ci->location[0]; origin[1] = ci->location[1]; 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, &cgs.media.limboFont2); //if ( cg_fixedFTeamSize.integer ) { // namewidth = 102; //} //else { namewidth = CG_Text_Width_Ext(ci->name, 0.2f, 17, &cgs.media.limboFont2); if (ci->health == 0) { namewidth += 7; } //} if ((locwidth + namewidth) > bestWidth) { bestWidth = locwidth + namewidth; } h += 12.f; } boxWidth += bestWidth; CG_DrawRect(x, y, boxWidth, h, 1, borderColor); CG_FillRect(x + 1, y + 1, boxWidth - 2, h - 2, bgColor); x += 2; y += 2; CG_FillRect(x, y, boxWidth - 4, 12, clr1); Com_sprintf(buffer, 64, "Fireteam: %s", bg_fireteamNames[f->ident]); Q_strupr(buffer); CG_Text_Paint_Ext(x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.limboFont1); x += 2; for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { y += FT_BAR_HEIGHT + FT_BAR_YSPACING; x = rect->x + 2; // 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 - 4, FT_BAR_HEIGHT, clr3); } else { CG_FillRect(x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr2); } x += 4; // draw class icon in fireteam overlay CG_DrawPic(x, y, 12, 12, cgs.media.skillPics[SkillNumForClass(ci->cls)]); x += 14; // draw the mute-icon in the fireteam overlay.. //if ( ci->muted ) { // CG_DrawPic( x, y, 12, 12, cgs.media.muteIcon ); // x += 14; //} else if // ..or else draw objective icon (if they are carrying one) in fireteam overlay.. if (ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG))) { CG_DrawPic(x, y, 12, 12, cgs.media.objectiveShader); x += 14; } // core: ... or else draw the disguised icon in fireteam overlay.. else if (ci->powerups & (1 << PW_OPS_DISGUISED)) { CG_DrawPic(x, y, 12, 12, ci->team == TEAM_AXIS ? cgs.media.alliedUniformShader : cgs.media.axisUniformShader); x += 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; //} // draw the player's name CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->name, 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); // add space //if ( cg_fixedFTeamSize.integer ) // x += 115; //else x += 14 + CG_Text_Width_Ext(ci->name, 0.2f, 17, &cgs.media.limboFont2); // draw the player's weapon icon curWeap = cg_entities[ci->clientNum].currentState.weapon; if (cg_weapons[curWeap].weaponIcon[0]) // jaquboss - do not try to draw nothing { CG_DrawPic(x, y, weaponIconScale(curWeap) * 10, 10, cg_weapons[curWeap].weaponIcon[0]); } else if (cg_weapons[curWeap].weaponIcon[1]) { CG_DrawPic(x, y, weaponIconScale(curWeap) * 10, 10, cg_weapons[curWeap].weaponIcon[1]); } x += 24; if (ci->health > 80) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } else if (ci->health > 0) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } else if (ci->health == 0) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, ((cg.time % 500) > 250) ? colorWhite : colorRed, "*", 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); x += 7; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, ((cg.time % 500) > 250) ? colorRed : colorWhite, "0", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); x -= 7; } else { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorRed, "0", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } // Set hard limit on width x += 24; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, locStr[i], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } }
void CG_DrawFireTeamOverlay(rectDef_t *rect) { int x = rect->x; int y = rect->y + 1; // +1, jitter it into place in 1024 :) float h; clientInfo_t *ci = NULL; char buffer[64]; fireteamData_t *f = NULL; int i; vec4_t clr1 = { .16f, .2f, .17f, .8f }; vec4_t clr2 = { 0.f, 0.f, 0.f, .2f }; vec4_t clr3 = { 0.25f, 0.f, 0.f, 153 / 255.f }; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; vec4_t bgColor = { 0.0f, 0.0f, 0.0f, 0.6f }; // window vec4_t borderColor = { 0.5f, 0.5f, 0.5f, 0.5f }; // window if (!(f = CG_IsOnFireteam(cg.clientNum))) { return; } h = 12 + 2 + 2; for (i = 0; i < 6; i++) { ci = CG_SortedFireTeamPlayerForPosition(i, 6); if (!ci) { break;; } h += FT_BAR_HEIGHT + FT_BAR_YSPACING; } CG_DrawRect(x, y, 204, h, 1, borderColor); CG_FillRect(x + 1, y + 1, 204 - 2, h - 2, bgColor); x += 2; y += 2; CG_FillRect(x, y, 204 - 4, 12, clr1); sprintf(buffer, "Fireteam: %s", bg_fireteamNames[f->ident]); Q_strupr(buffer); CG_Text_Paint_Ext(x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.limboFont1); x += 2; //y += 2; for (i = 0; i < 6; i++) { y += FT_BAR_HEIGHT + FT_BAR_YSPACING; x = rect->x + 2; ci = CG_SortedFireTeamPlayerForPosition(i, 6); if (!ci) { break;; } if (ci->selected) { CG_FillRect(x, y + FT_BAR_YSPACING, 204 - 4, FT_BAR_HEIGHT, clr3); } else { CG_FillRect(x, y + FT_BAR_YSPACING, 204 - 4, FT_BAR_HEIGHT, clr2); } x += 4; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, BG_ClassLetterForNumber(ci->cls), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); x += 10; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->team == TEAM_AXIS ? miniRankNames_Axis[ci->rank] : miniRankNames_Allies[ci->rank], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); x += 22; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->name, 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); x += 90; /* CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.movementAutonomyIcons[0]); x += FT_BAR_HEIGHT; CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.weaponAutonomyIcons[0]); x += FT_BAR_HEIGHT; x += 4;*/ /* if( isLeader ) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", i+4), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2 ); }*/ x += 20; if (ci->health > 80) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } else if (ci->health > 0) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } else { 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, &cgs.media.limboFont2); } //x += 20; { vec2_t loc; char *s; loc[0] = ci->location[0]; loc[1] = ci->location[1]; s = va("^3(%s)", BG_GetLocationString(loc)); x = rect->x + (204 - 4 - CG_Text_Width_Ext(s, .2f, 0, &cgs.media.limboFont2)); CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("^3(%s)", BG_GetLocationString(loc)), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } } }
void CG_DrawFireTeamOverlay(rectDef_t *rect) { int x = rect->x; int y = rect->y + 1; // +1, jitter it into place in 1024 :) float h; clientInfo_t *ci = NULL; char buffer[64]; fireteamData_t *f; int i; vec4_t clr1 = { .16f, .2f, .17f, .8f }; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; vec4_t bgColor = { 0.0f, 0.0f, 0.0f, 0.5f }; // window vec4_t borderColor = { 0.5f, 0.5f, 0.5f, 0.5f }; // window f = CG_IsOnFireteam(cg.clientNum); if (!f) { return; } h = 12 + 2 + 2; for (i = 0; i < 6; i++) { ci = CG_SortedFireTeamPlayerForPosition(i, 6); if (!ci) { break; } h += FT_BAR_HEIGHT + FT_BAR_YSPACING; } CG_DrawRect(x, y, FT_WIDTH, h, 1, borderColor); CG_FillRect(x + 1, y + 1, FT_WIDTH - 2, h - 2, bgColor); x += 2; y += 2; CG_FillRect(x, y, FT_WIDTH - 4, 12, clr1); // Nico, show if it's a private or public FT if (f->priv) { sprintf(buffer, "FT %s (Priv)", bg_fireteamNames[f->ident]); } else { sprintf(buffer, "FT %s", bg_fireteamNames[f->ident]); } Q_strupr(buffer); CG_Text_Paint_Ext(x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.limboFont1); x += 2; for (i = 0; i < 6; i++) { y += FT_BAR_HEIGHT + FT_BAR_YSPACING; x = rect->x + 2; ci = CG_SortedFireTeamPlayerForPosition(i, 6); if (!ci) { break; } x += 4; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->name, 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } }
/* ======================================================================================================================================= WM_ScoreboardOverlay ======================================================================================================================================= */ int WM_ScoreboardOverlay(int x, int y, float fade) { vec4_t hcolor; int width; char *s; // JPW NERVE int msec, mins, seconds, tens; // JPW NERVE width = INFO_PLAYER_WIDTH + INFO_LATENCY_WIDTH + INFO_SCORE_WIDTH + 25; VectorSet(hcolor, 0, 0, 0); hcolor[3] = 0.7 * fade; // draw background CG_FillRect(x - 12, y, width, 400, hcolor); // draw title frame VectorSet(hcolor, 0.0039, 0.0039, 0.2461); hcolor[3] = 1 * fade; CG_FillRect(x - 12, y, width, 30, hcolor); CG_DrawRect(x - 12, y, width, 400, 2, hcolor); if (cg.snap->ps.pm_type == PM_INTERMISSION) { const char *s, *buf; s = CG_ConfigString(CS_MULTI_INFO); buf = Info_ValueForKey(s, "winner"); if (atoi(buf)) { CG_DrawSmallString(x - 12 + 5, y, "ALLIES WIN!", fade); } else { CG_DrawSmallString(x - 12 + 5, y, "AXIS WIN!", fade); } } // mission time & reinforce time else { msec = (cgs.timelimit * 60.f * 1000.f) - (cg.time - cgs.levelStartTime); seconds = msec / 1000; mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; s = va("Mission time: %2.0f:%i%i", (float)mins, tens, seconds); // float cast to line up with reinforce time CG_DrawSmallString(x - 7, y, s, fade); if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_RED) { msec = cg_redlimbotime.integer - (cg.time % cg_redlimbotime.integer); } else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_BLUE) { msec = cg_bluelimbotime.integer - (cg.time % cg_bluelimbotime.integer); } else { // no team(spectator mode) msec = 0; } if (msec) { seconds = msec / 1000; mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; s = va("Reinforce time: %2.0f:%i%i", (float)mins, tens, seconds); CG_DrawSmallString(x - 7, y + 16, s, fade); } } // CG_DrawSmallString(x - 12 + 5, y, "Wolfenstein Multiplayer", fade); // old one y = WM_DrawObjectives(x, y, width, fade); y += 5; // draw field names CG_DrawSmallString(x, y, "Players", fade); x += INFO_PLAYER_WIDTH; CG_DrawSmallString(x, y, "Score", fade); x += INFO_SCORE_WIDTH; CG_DrawSmallString(x, y, "Latency", fade); y += 20; return y; }
void CG_TopShotsDraw(void) { if (cgs.topshots.show == SHOW_OFF) { return; } else { int x = 640 + TS_X - TS_W, y = 480, 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 = ITEM_TEXTSTYLE_SHADOWED; float hScale = 0.16f; float hScaleY = 0.21f; fontInfo_t *hFont = FONT_HEADER; // Sub header int hStyle2 = 0; float hScale2 = 0.16f; float hScaleY2 = 0.20f; fontInfo_t *hFont2 = FONT_SUBHEADER; vec4_t hdrColor = COLOR_HDR; // text vec4_t hdrColor2 = COLOR_HDR2; // text // Text settings int tStyle = ITEM_TEXTSTYLE_SHADOWED; int tSpacing = 9; // Should derive from CG_Text_Height_Ext float tScale = 0.19f; fontInfo_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; hdrColor2[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_DrawRect(x, y, TS_W, h, 1, borderColor); CG_FillRect(x, y, TS_W, h, bgColor); // Header CG_FillRect(x, y, TS_W, tSpacing + 4, bgColorTitle); CG_DrawRect(x, y, TS_W, tSpacing + 4, 1, borderColorTitle); y += 1; y += tSpacing; CG_Text_Paint_Ext(x + 4, y, hScale, hScaleY, hdrColor, "\"TOPSHOT\" ACCURACIES", 0.0f, 0, hStyle, hFont); y += 4; // Weapon stats y += 2; CG_FillRect(x, y, TS_W, tSpacing + 3, bgColorTitle); CG_DrawRect(x, y, TS_W, tSpacing + 3, 1, borderColorTitle); x += 4; y += 1 + tSpacing; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Weapon", 0.0f, 0, hStyle2, hFont2); x += 60; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Accuracy", 0.0f, 0, hStyle2, hFont2); x += 53; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Hits / Shots", 0.0f, 0, hStyle2, hFont2); x += 62; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Kills", 0.0f, 0, hStyle2, hFont2); x += 32; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Player", 0.0f, 0, hStyle2, hFont2); x = 640 + TS_X - TS_W + 4; y += 1; if (ts->cWeapons == 0) { y += tSpacing; CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, "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); } } } }
void CG_GameStatsDraw(void) { if (cgs.gamestats.show == SHOW_OFF) { return; } else { int i, x = GS_X + 4, 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 = ITEM_TEXTSTYLE_SHADOWED; float hScale = 0.16f; float hScaleY = 0.21f; fontInfo_t *hFont = FONT_HEADER; // Sub header int hStyle2 = 0; float hScale2 = 0.16f; float hScaleY2 = 0.20f; fontInfo_t *hFont2 = FONT_SUBHEADER; vec4_t hdrColor = COLOR_HDR; // text //vec4_t hdrColor2 = COLOR_HDR2; // text // Text settings int tStyle = ITEM_TEXTSTYLE_SHADOWED; int tSpacing = 9; // Should derive from CG_Text_Height_Ext float tScale = 0.19f; fontInfo_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) ? 3 : 0) + ((cgs.gametype == GT_WOLF_LMS) ? 0 : ( 4 + 2 * tSpacing + // Rank/XP 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_DrawRect(GS_X, y, GS_W, h, 1, borderColor); CG_FillRect(GS_X, y, GS_W, h, bgColor); // Header CG_FillRect(GS_X, y, GS_W, tSpacing + 4, bgColorTitle); CG_DrawRect(GS_X, y, GS_W, tSpacing + 4, 1, borderColorTitle); y += 1; y += tSpacing; CG_Text_Paint_Ext(x, y, hScale, hScaleY, hdrColor, "PLAYER STATS", 0.0f, 0, hStyle, hFont); y += 3; y += 2; // Weapon stats y += 2; CG_FillRect(GS_X, y, GS_W, tSpacing + 3, bgColorTitle); CG_DrawRect(GS_X, y, GS_W, tSpacing + 3, 1, borderColorTitle); y += 1 + tSpacing; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Weapon", 0.0f, 0, hStyle2, hFont2); x += 66; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Accuracy", 0.0f, 0, hStyle2, hFont2); x += 53; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Hits / Shots", 0.0f, 0, hStyle2, hFont2); x += 62; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Kills", 0.0f, 0, hStyle2, hFont2); x += 29; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Deaths", 0.0f, 0, hStyle2, hFont2); x += 40; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Headshots", 0.0f, 0, hStyle2, hFont2); x = GS_X + 4; y += 2; y += 1; if (gs->cWeapons == 0) { y += tSpacing; CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, "No weapon info available.", 0.0f, 0, tStyle, tFont); } else { for (i = 0; i < gs->cWeapons; i++) { y += tSpacing; CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, gs->strWS[i], 0.0f, 0, tStyle, tFont); } if (gs->fHasStats) { y += tSpacing; for (i = 0; i < 2; i++) { y += tSpacing; CG_Text_Paint_Ext(x, 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(GS_X, y, GS_W, tSpacing + 3, bgColorTitle); CG_DrawRect(GS_X, y, GS_W, tSpacing + 3, 1, borderColorTitle); y += 1 + tSpacing; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Rank", 0.0f, 0, hStyle2, hFont2); x += 82; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "XP", 0.0f, 0, hStyle2, hFont2); x = GS_X + 4; y += 1; y += tSpacing; CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, gs->strRank, 0.0f, 0, tStyle, tFont); // Skill info y += tSpacing; y += 2; CG_FillRect(GS_X, y, GS_W, tSpacing + 3, bgColorTitle); CG_DrawRect(GS_X, y, GS_W, tSpacing + 3, 1, borderColorTitle); y += 1 + tSpacing; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Skills", 0.0f, 0, hStyle2, hFont2); x += 84; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Level", 0.0f, 0, hStyle2, hFont2); x += 40; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "XP / Next Level", 0.0f, 0, hStyle2, hFont2); if (cgs.gametype == GT_WOLF_CAMPAIGN) { x += 86; CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Medals", 0.0f, 0, hStyle2, hFont2); } x = GS_X + 4; y += 1; if (gs->cSkills == 0) { y += tSpacing; CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, "No skills acquired!", 0.0f, 0, tStyle, tFont); } else { for (i = 0; i < gs->cSkills; i++) { y += tSpacing; CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, gs->strSkillz[i], 0.0f, 0, tStyle, tFont); } } } }
void CG_SpecHelpDraw(void) { if (cg.spechelpWindow == SHOW_OFF) { return; } else { const helpType_t help[] = { { "+zoom", "hold for pointer" }, { "+attack", "window move/resize" }, { "+sprint", "hold to resize" }, { "weapnext", "window on/off" }, { "weapprev", "swap w/main view" }, { NULL, NULL }, { "weapalt", "swingcam toggle" }, { "spechelp", "help on/off" } }; int i, x, y = 480, w, h; int len, maxlen = 0; char format[MAX_STRING_TOKENS], buf[MAX_STRING_TOKENS]; char *lines[16]; 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 = ITEM_TEXTSTYLE_SHADOWED; float hScale = 0.16f; float hScaleY = 0.21f; fontInfo_t *hFont = FONT_HEADER; vec4_t hdrColor2 = COLOR_HDR2; // text // Text settings int tStyle = ITEM_TEXTSTYLE_SHADOWED; int tSpacing = 9; // Should derive from CG_Text_Height_Ext float tScale = 0.19f; fontInfo_t *tFont = FONT_TEXT; vec4_t tColor = COLOR_TEXT; // text float diff = cg.fadeTime - trap_Milliseconds(); // FIXME: Should compute all this stuff beforehand // Compute required width for (i = 0; i < sizeof(help) / sizeof(helpType_t); i++) { if (help[i].cmd != NULL) { len = strlen(CG_getBindKeyName(help[i].cmd, buf, sizeof(buf))); if (len > maxlen) { maxlen = len; } } } Q_strncpyz(format, va("^2%%%ds ^N%%s", maxlen), sizeof(format)); for (i = 0, maxlen = 0; i < sizeof(help) / sizeof(helpType_t); i++) { if (help[i].cmd != NULL) { lines[i] = va(format, CG_getBindKeyName(help[i].cmd, buf, sizeof(buf)), help[i].info); len = CG_Text_Width_Ext(lines[i], tScale, 0, FONT_TEXT); if (len > maxlen) { maxlen = len; } } else { lines[i] = NULL; } } w = maxlen + 8; x = SH_X; y = SH_Y; h = 2 + tSpacing + 2 + // Header 2 + 1 + tSpacing * (sizeof(help) / sizeof(helpType_t)) + 2; // Fade-in effects if (diff > 0.0f) { float scale = (diff / STATS_FADE_TIME); if (cg.spechelpWindow == SHOW_ON) { scale = 1.0f - scale; } bgColor[3] *= scale; bgColorTitle[3] *= scale; borderColor[3] *= scale; borderColorTitle[3] *= scale; hdrColor2[3] *= scale; tColor[3] *= scale; x -= w * (1.0f - scale); } else if (cg.spechelpWindow == SHOW_SHUTDOWN) { cg.spechelpWindow = SHOW_OFF; return; } CG_DrawRect(x, y, w, h, 1, borderColor); CG_FillRect(x, y, w, h, bgColor); // Header CG_FillRect(x, y, w, tSpacing + 4, bgColorTitle); CG_DrawRect(x, y, w, tSpacing + 4, 1, borderColorTitle); x += 4; y += 1; y += tSpacing; CG_Text_Paint_Ext(x, y, hScale, hScaleY, hdrColor2, "SPECTATOR CONTROLS", 0.0f, 0, hStyle, hFont); y += 3; // Control info for (i = 0; i < sizeof(help) / sizeof(helpType_t); i++) { y += tSpacing; if (lines[i] != NULL) { CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, lines[i], 0.0f, 0, tStyle, tFont); } } } }
void CG_DrawFireTeamOverlay( rectDef_t* rect ) { int x = rect->x; int y = rect->y + 1; // +1, jitter it into place in 1024 :) int boxWidth = 204; int bestWidth = -1; char *locStr[MAX_FIRETEAM_MEMBERS]; vec2_t loc; float h; clientInfo_t* ci = NULL; char buffer[64]; fireteamData_t* f = NULL; int i; vec4_t clr1 = { .16f, .2f, .17f, .8f }; vec4_t clr2 = { 0.f, 0.f, 0.f, .2f }; vec4_t clr3 = { 0.25f, 0.f, 0.f, 153/255.f }; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; vec4_t bgColor = { 0.0f, 0.0f, 0.0f, 0.6f }; // window vec4_t borderColor = { 0.5f, 0.5f, 0.5f, 0.5f }; // window centity_t* cent; bgColor[3] = cg_fireteamAlpha.value; if(cg.hudEditor.showHudEditor) { //draw a fake fireteam box... CG_DrawFakeFireTeamOverlay(rect); return; } else if(!(f = CG_IsOnFireteam( cg.clientNum ))) { return; } h = 12 + 2 + 2; for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { int locwidth; vec3_t origin; ci = CG_SortedFireTeamPlayerForPosition( i ); if(!ci) { break; } h += FT_BAR_HEIGHT + FT_BAR_YSPACING; loc[0] = ci->location[0]; loc[1] = ci->location[1]; if(cg_locations.integer > 0) { qboolean locValid = qtrue; cent = &cg_entities[ci->clientNum]; // Dens: use lerpOrigin for now origin[0] = cent->lerpOrigin[0]; origin[1] = cent->lerpOrigin[1]; origin[2] = cent->lerpOrigin[2]; locStr[i] = va( "^3%s", CG_GetLocationMsg(origin)); if (!Q_stricmp( locStr[i], "^3Unknown")){ locStr[i] = va( "^3(%s)", BG_GetLocationString( loc )); locValid = qfalse; } if(cg_locations.integer > 1 && locValid) Q_strcat( locStr[i], 64, va(" ^3(%s)", BG_GetLocationString( loc )) ); } else { locStr[i] = va( "^3(%s)", BG_GetLocationString( loc )); } if( !locStr[i][1] || !*locStr[i] ) locStr[i] = " "; locwidth = CG_Text_Width_Ext( locStr[i], 0.2f, 0, &cgs.media.font3 ); if(locwidth > bestWidth) bestWidth = locwidth; } boxWidth += bestWidth; CG_DrawRect( x, y, boxWidth, h, 1, borderColor); CG_FillRect( x + 1, y + 1, boxWidth - 2, h - 2, bgColor); x += 2; y += 2; CG_FillRect( x, y, boxWidth - 4, 12, clr1 ); Com_sprintf( buffer, 64, "Fireteam: %s", bg_fireteamNames[f->ident] ); //sprintf( buffer, "Fireteam: %s", bg_fireteamNames[f->ident] ); Q_strupr( buffer ); CG_Text_Paint_Ext( x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.font1 ); x += 2; //y += 2; for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { y += FT_BAR_HEIGHT + FT_BAR_YSPACING; x = rect->x + 2; ci = CG_SortedFireTeamPlayerForPosition( i ); if(!ci) { break;; } if( ci->selected ) { CG_FillRect( x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr3 ); } else { CG_FillRect( x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr2 ); } x += 4; //draw class if(cg_drawClassIcons.integer & CLASSICON_FIRETEAM){ trap_R_SetColor( colorWhite ); CG_DrawPic(x-2, y+2, FT_BAR_HEIGHT, FT_BAR_HEIGHT, cgs.media.skillPics[BG_ClassSkillForClass( ci->cls )]); trap_R_SetColor( NULL ); }else{ CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorWhite, BG_ClassLetterForNumber( ci->cls ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } x += 10; // quad: draw latched class // pheno: not with an old server, that doesn't send the latched class if( ci->cls != ci->latchClass ) { //draw separator CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, ">", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 10; //draw class if(cg_drawClassIcons.integer & CLASSICON_FIRETEAM) { trap_R_SetColor( colorYellow ); CG_DrawPic(x - 2, y + 2, FT_BAR_HEIGHT, FT_BAR_HEIGHT, cgs.media.skillPics[BG_ClassSkillForClass(ci->latchClass)]); trap_R_SetColor(NULL); } else { CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, BG_ClassLetterForNumber( ci->latchClass ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } x += 10; } else x += 20; CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->team == TEAM_AXIS ? miniRankNames_Axis[ci->rank] : miniRankNames_Allies[ci->rank], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 22; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->name, 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 90; /* CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.movementAutonomyIcons[0]); x += FT_BAR_HEIGHT; CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.weaponAutonomyIcons[0]); x += FT_BAR_HEIGHT; x += 4;*/ /* if( isLeader ) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", i+4), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); }*/ x += 20; if( ci->health > 80 ) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", ci->health < 0 ? 0 : ci->health ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } else if( ci->health > 0 ) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, va("%i", ci->health < 0 ? 0 : ci->health ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } else { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorRed, va("0%s", ci->health < 0 ? "" : "*" ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } x += 30; CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, locStr[i], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } }
// Main window-drawing handler void CG_windowDraw(void) { int h, x, y, i, j, milli, t_offset, tmp; cg_window_t *w; qboolean fCleanup = qfalse; // Gordon: FIXME, the limbomenu var no longer exists qboolean fAllowMV = (cg.snap != NULL && cg.snap->ps.pm_type != PM_INTERMISSION /*&& !cg.limboMenu*/); vec4_t *bg; vec4_t textColor, borderColor, bgColor; if(cg.winHandler.numActiveWindows == 0) { // Draw these for demoplayback no matter what CG_demoAviFPSDraw(); CG_demoTimescaleDraw(); return; } milli = trap_Milliseconds(); memcpy(textColor, colorWhite, sizeof(vec4_t)); // Mouse cursor position for MV highlighting (offset for cursor pointer position) // Also allow for swingcam toggling if(cg.mvTotalClients > 0 && fAllowMV) { CG_cursorUpdate(); } for(i=0; i<cg.winHandler.numActiveWindows; i++) { w = &cg.winHandler.window[cg.winHandler.activeWindows[i]]; if(!w->inuse || w->state == WSTATE_OFF) { fCleanup = qtrue; continue; } // Multiview rendering has its own handling if(w->effects & WFX_MULTIVIEW) { if(w != cg.mvCurrentMainview && fAllowMV) CG_mvDraw(w); continue; } if(w->effects & WFX_TEXTSIZING) { CG_windowNormalizeOnText(w); w->effects &= ~WFX_TEXTSIZING; } bg = ((w->effects & WFX_FLASH) && (milli % w->flashPeriod) > w->flashMidpoint) ? &w->colorBackground2 : &w->colorBackground; h = w->h; x = w->x; y = w->y; t_offset = milli - w->time; textColor[3] = 1.0f; memcpy(&borderColor, w->colorBorder, sizeof(vec4_t)); memcpy(&bgColor, bg, sizeof(vec4_t)); // TODO: Add in support for ALL scrolling effects if(w->state == WSTATE_START) { tmp = w->targetTime - t_offset; if(w->effects & WFX_SCROLLUP) { if(tmp > 0) { y += (480 - y) * tmp / w->targetTime;//(100 * tmp / w->targetTime) / 100; } else { w->state = WSTATE_COMPLETE; } w->curY = y; } if(w->effects & WFX_FADEIN) { if(tmp > 0) textColor[3] = (float)((float)t_offset / (float)w->targetTime); else w->state = WSTATE_COMPLETE; } } else if(w->state == WSTATE_SHUTDOWN) { tmp = w->targetTime - t_offset; if(w->effects & WFX_SCROLLUP) { if(tmp > 0) y = w->curY + (480 - w->y) * t_offset / w->targetTime;//(100 * t_offset / w->targetTime) / 100; if(tmp < 0 || y >= 480) { w->state = WSTATE_OFF; fCleanup = qtrue; continue; } } if(w->effects & WFX_FADEIN) { if(tmp > 0) { textColor[3] -= (float)((float)t_offset / (float)w->targetTime); } else { textColor[3] = 0.0f; w->state = WSTATE_OFF; } } } borderColor[3] *= textColor[3]; bgColor[3] *= textColor[3]; CG_FillRect(x, y, w->w, h, bgColor); CG_DrawRect(x, y, w->w, h, 1, borderColor); x += 5; y -= (w->effects & WFX_TRUETYPE) ? 3 : 0; for(j=w->lineCount-1; j>=0; j--) { if(w->effects & WFX_TRUETYPE) { // CG_Text_Paint(x, y + h, w->fontScale, textColor, (char*)w->lineText[j], 0.0f, 0, 0); CG_Text_Paint_Ext(x, y + h, w->fontScaleX, w->fontScaleY, textColor, (char*)w->lineText[j], 0.0f, 0, 0, &cgs.media.limboFont2); } h -= (w->lineHeight[j] + 3); if(!(w->effects & WFX_TRUETYPE)) { CG_DrawStringExt2(x, y + h, (char*)w->lineText[j], textColor, qfalse, qtrue, w->fontWidth, w->fontHeight, 0); } } } // Wedge in MV info overlay if(cg.mvTotalClients > 0 && fAllowMV) CG_mvOverlayDisplay(); // Extra rate info CG_demoAviFPSDraw(); CG_demoTimescaleDraw(); // Mouse cursor lays on top of everything if(cg.mvTotalClients > 0 && cg.time < cgs.cursorUpdate && fAllowMV) { //CG_DrawPic(cgs.cursorX - CURSOR_OFFSETX, cgs.cursorY - CURSOR_OFFSETY, 32, 32, cgs.media.cursor); CG_DrawPic( cgDC.cursorx, cgDC.cursory, 32, 32, cgs.media.cursorIcon ); } if(fCleanup) { CG_windowCleanup(); } }
void CG_DemoHelpDraw() { const char *help[] = { "^nTAB ^mscores", "^nF1-F5 ^mavidemo record", "^nF11-F12 ^mscreenshot", NULL, "^nKP_DOWN ^mslow down (--)", "^nKP_LEFT ^mslow down (-)", "^nKP_UP ^mspeed up (++)", "^nKP_RIGHT ^mspeed up (+)", "^nSPACE ^mnormal speed", NULL, "^nENTER ^mExternal view", "^nLFT/RGHT ^mChange angle", "^nUP/DOWN ^mMove in/out" }; int i, x, y = 480, 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 = ITEM_TEXTSTYLE_SHADOWED; float hScale = 0.16f; float hScaleY = 0.21f; fontInfo_t *hFont = FONT_HEADER; vec4_t hdrColor2 = COLOR_HDR2; // text // Text settings int tStyle = ITEM_TEXTSTYLE_SHADOWED; int tSpacing = 9; // Should derive from CG_Text_Height_Ext float tScale = 0.19f; fontInfo_t *tFont = FONT_TEXT; vec4_t tColor = COLOR_TEXT; // text float diff = cg.fadeTime - trap_Milliseconds(); if (cg.demohelpWindow == SHOW_OFF) { return; } // FIXME: Should compute this beforehand w = DH_W; x = 640 + DH_X - w; h = 2 + tSpacing + 2 + // Header 2 + 1 + tSpacing * (2 + (sizeof (help)) / sizeof (char *)) + 2; // 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; hdrColor2[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; } CG_DrawRect(x, y, w, h, 1, borderColor); CG_FillRect(x, y, w, h, bgColor); // Header CG_FillRect(x, y, w, tSpacing + 4, bgColorTitle); CG_DrawRect(x, y, w, tSpacing + 4, 1, borderColorTitle); x += 4; y += 1; y += tSpacing; CG_Text_Paint_Ext(x, y, hScale, hScaleY, hdrColor2, "DEMO CONTROLS", 0.0f, 0, hStyle, hFont); y += 3; // Control info for (i = 0; i < (int)(sizeof (help) / sizeof (char *)); ++i) { y += tSpacing; if (help[i] != NULL) { CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, (char *)help[i], 0.0f, 0, tStyle, tFont); } } y += tSpacing * 2; CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, "^nBACKSPACE ^mhelp on/off", 0.0f, 0, tStyle, tFont); }
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; } } } } }
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); } }
// Main window-drawing handler void CG_windowDraw(void) { int h, x, y, i, j, milli, t_offset, tmp; cg_window_t *w; qboolean fCleanup = qfalse; // Gordon: FIXME, the limbomenu var no longer exists vec4_t *bg; vec4_t textColor, borderColor, bgColor; if (cg.winHandler.numActiveWindows == 0) { // Draw these for demoplayback no matter what CG_demoAviFPSDraw(); CG_demoTimescaleDraw(); return; } milli = trap_Milliseconds(); memcpy(textColor, colorWhite, sizeof (vec4_t)); // Mouse cursor position for MV highlighting (offset for cursor pointer position) // Also allow for swingcam toggling for (i = 0; i < cg.winHandler.numActiveWindows; ++i) { w = &cg.winHandler.window[cg.winHandler.activeWindows[i]]; if (!w->inuse || w->state == WSTATE_OFF) { fCleanup = qtrue; continue; } if (w->effects & WFX_TEXTSIZING) { CG_windowNormalizeOnText(w); w->effects &= ~WFX_TEXTSIZING; } bg = ((w->effects & WFX_FLASH) && (milli % w->flashPeriod) > w->flashMidpoint) ? &w->colorBackground2 : &w->colorBackground; h = w->h; x = w->x; y = w->y; t_offset = milli - w->time; textColor[3] = 1.0f; memcpy(&borderColor, w->colorBorder, sizeof (vec4_t)); memcpy(&bgColor, bg, sizeof (vec4_t)); // TODO: Add in support for ALL scrolling effects if (w->state == WSTATE_START) { tmp = w->targetTime - t_offset; if (w->effects & WFX_SCROLLUP) { if (tmp > 0) { y += (480 - y) * tmp / w->targetTime; } else { w->state = WSTATE_COMPLETE; } w->curY = y; } if (w->effects & WFX_FADEIN) { if (tmp > 0) { textColor[3] = (float)((float)t_offset / (float)w->targetTime); } else { w->state = WSTATE_COMPLETE; } } } else if (w->state == WSTATE_SHUTDOWN) { tmp = w->targetTime - t_offset; if (w->effects & WFX_SCROLLUP) { if (tmp > 0) { y = w->curY + (480 - w->y) * t_offset / w->targetTime; } if (tmp < 0 || y >= 480) { w->state = WSTATE_OFF; fCleanup = qtrue; continue; } } if (w->effects & WFX_FADEIN) { if (tmp > 0) { textColor[3] -= (float)((float)t_offset / (float)w->targetTime); } else { textColor[3] = 0.0f; w->state = WSTATE_OFF; } } } borderColor[3] *= textColor[3]; bgColor[3] *= textColor[3]; CG_FillRect(x, y, w->w, h, bgColor); CG_DrawRect(x, y, w->w, h, 1, borderColor); x += 5; y -= (w->effects & WFX_TRUETYPE) ? 3 : 0; for (j = w->lineCount - 1; j >= 0; --j) { if (w->effects & WFX_TRUETYPE) { CG_Text_Paint_Ext(x, y + h, w->fontScaleX, w->fontScaleY, textColor, (char *)w->lineText[j], 0.0f, 0, 0, &cgs.media.limboFont2); } h -= (w->lineHeight[j] + 3); if (!(w->effects & WFX_TRUETYPE)) { CG_DrawStringExt2(x, y + h, (char *)w->lineText[j], textColor, qfalse, qtrue, w->fontWidth, w->fontHeight, 0); } } } // Extra rate info CG_demoAviFPSDraw(); CG_demoTimescaleDraw(); if (fCleanup) { CG_windowCleanup(); } }
void UI_DisplayContextCG::drawRect( float x, float y, float w, float h, float size, const vec4_t color ) { CG_DrawRect( x, y, w, h, size, color ); }
/** * @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); } } }
void CG_DrawRectDc (float x, float y, float w, float h, float size, const vec4_t color, int widescreen, rectDef_t menuRect) { wsset(); CG_DrawRect(x, y, w, h, size, color); wsoff(); }
/* ================= Menu_Draw ================= */ void Menu_Draw( menuframework_s *menu ) { int i; menucommon_s *itemptr; // draw menu for (i=0; i<menu->nitems; i++) { itemptr = (menucommon_s*)menu->items[i]; if (itemptr->flags & QMF_HIDDEN) continue; if (itemptr->ownerdraw) { // total subclassing, owner draws everything itemptr->ownerdraw( itemptr ); } else { switch (itemptr->type) { case MTYPE_RADIOBUTTON: RadioButton_Draw( (menuradiobutton_s*)itemptr ); break; case MTYPE_FIELD: MenuField_Draw( (menufield_s*)itemptr ); break; case MTYPE_SLIDER: Slider_Draw( (menuslider_s*)itemptr ); break; case MTYPE_SPINCONTROL: SpinControl_Draw( (menulist_s*)itemptr ); break; case MTYPE_ACTION: Action_Draw( (menuaction_s*)itemptr ); break; case MTYPE_BITMAP: Bitmap_Draw( (menubitmap_s*)itemptr ); break; case MTYPE_TEXT: Text_Draw( (menutext_s*)itemptr ); break; case MTYPE_SCROLLLIST: ScrollList_Draw( (menulist_s*)itemptr ); break; case MTYPE_PTEXT: PText_Draw( (menutext_s*)itemptr ); break; case MTYPE_BTEXT: BText_Draw( (menutext_s*)itemptr ); break; default: trap_Error( va("Menu_Draw: unknown type %d", itemptr->type) ); } } if( uis.debug ) { int x; int y; int w; int h; if( !( itemptr->flags & QMF_INACTIVE ) ) { x = itemptr->left; y = itemptr->top; w = itemptr->right - itemptr->left + 1; h = itemptr->bottom - itemptr->top + 1; if (itemptr->flags & QMF_HASMOUSEFOCUS) { CG_DrawRect(x, y, w, h, 1, colorYellow ); } else { CG_DrawRect(x, y, w, h, 1, colorWhite ); } } } } itemptr = Menu_ItemAtCursor( menu ); if ( itemptr && itemptr->statusbar) itemptr->statusbar( ( void * ) itemptr ); }
void CG_DrawFakeFireTeamOverlay( rectDef_t* rect ) { int x = rect->x; int y = rect->y + 1; // +1, jitter it into place in 1024 :) float h; char buffer[64]; int i; vec4_t clr1 = { .16f, .2f, .17f, .8f }; vec4_t clr2 = { 0.f, 0.f, 0.f, .2f }; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; vec4_t bgColor = { 0.0f, 0.0f, 0.0f, 0.6f }; // window vec4_t borderColor = { 0.5f, 0.5f, 0.5f, 0.5f }; // window bgColor[3] = cg_fireteamAlpha.value; h = 12 + 2 + 2; for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { h += FT_BAR_HEIGHT + FT_BAR_YSPACING; } CG_DrawRect( x, y, FT_WIDTH, h, 1, borderColor); CG_FillRect( x + 1, y + 1, FT_WIDTH - 2, h - 2, bgColor); x += 2; y += 2; CG_FillRect( x, y, FT_WIDTH - 4, 12, clr1 ); Com_sprintf( buffer, 64, "Fireteam: %s", "Sample" ); //sprintf( buffer, "Fireteam: %s", "Sample" ); Q_strupr( buffer ); CG_Text_Paint_Ext( x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.font1 ); x += 2; for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { y += FT_BAR_HEIGHT + FT_BAR_YSPACING; x = rect->x + 2; CG_FillRect( x, y + FT_BAR_YSPACING, FT_WIDTH - 4, FT_BAR_HEIGHT, clr2 ); x += 4; CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, "S", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 10; CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, "S", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 22; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, "Sample", 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 90; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, "100", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); { char *s; s = va( "^3(%s)", "X,Y"); x = rect->x + ( FT_WIDTH - 4 - CG_Text_Width_Ext( s, .2f, 0, &cgs.media.font3 ) ); CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va( "^3(%s)", "X,Y" ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } } }