void GameStatsDraw() { #define GS_X 166 #define GS_Y 10 #define GS_W 308 // Color/font #define COLOR_BG { 0.0f, 0.0f, 0.0f, 0.6f } #define COLOR_BORDER { 0.5f, 0.5f, 0.5f, 0.5f } #define COLOR_BG_TITLE { 0.16, 0.2f, 0.17f, 0.8f } #define COLOR_BG_VIEW { 0.16, 0.2f, 0.17f, 0.8f } #define COLOR_BORDER_TITLE { 0.1f, 0.1f, 0.1f, 0.2f } #define COLOR_BORDER_VIEW { 0.2f, 0.2f, 0.2f, 0.4f } #define COLOR_HDR { 0.6f, 0.6f, 0.6f, 1.0f } #define COLOR_HDR2 { 0.6f, 0.6f, 0.4f, 1.0f } #define COLOR_TEXT { 0.625f, 0.625f, 0.6f, 1.0f } #define FONT_HEADER &cgs.media.limboFont1 #define FONT_SUBHEADER &cgs.media.limboFont1_lo #define FONT_TEXT &cgs.media.limboFont2 vec4_t color_bg = COLOR_BG_VIEW; vec4_t color_border = COLOR_BORDER_VIEW; vec4_t color_hdr = COLOR_HDR2; vec4_t color_name = COLOR_TEXT; #define VD_X 4 #define VD_Y 78 #define VD_SCALE_X_HDR 0.25f #define VD_SCALE_Y_HDR 0.30f #define VD_SCALE_X_NAME 0.30f #define VD_SCALE_Y_NAME 0.30f 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; } drawRect(GS_X, y, GS_W, h,borderColor ,1); drawFillRect(GS_X, y, GS_W, h, bgColor); // Header drawFillRect(GS_X, y, GS_W, tSpacing+4, bgColorTitle); drawRect(GS_X, y, GS_W, tSpacing+4, borderColorTitle,1); y += 1; y += tSpacing; eth_CG_Text_Paint_Ext(x, y, hScale, hScaleY, hdrColor, "PLAYER STATS", 0.0f, 0, hStyle, hFont); y += 3; y += 2; // Weapon stats y += 2; drawFillRect(GS_X, y, GS_W, tSpacing + 3, bgColorTitle); drawRect(GS_X, y, GS_W, tSpacing + 3,borderColorTitle, 1); y += 1 + tSpacing; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Weapon", 0.0f, 0, hStyle2, hFont2); x += 66; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Accuracy", 0.0f, 0, hStyle2, hFont2); x += 53; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Hits / Shots", 0.0f, 0, hStyle2, hFont2); x += 62; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Kills", 0.0f, 0, hStyle2, hFont2); x += 29; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Deaths", 0.0f, 0, hStyle2, hFont2); x += 40; eth_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; eth_CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, "No weapon info available.", 0.0f, 0, tStyle, tFont); } else { for(i=0; icWeapons; i++) { y += tSpacing; eth_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; eth_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; drawFillRect(GS_X, y, GS_W, tSpacing + 3, bgColorTitle); drawRect(GS_X, y, GS_W, tSpacing + 3,borderColorTitle,1); y += 1 + tSpacing; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Rank", 0.0f, 0, hStyle2, hFont2); x += 82; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "XP", 0.0f, 0, hStyle2, hFont2); x = GS_X + 4; y += 1; y += tSpacing; eth_CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, gs->strRank, 0.0f, 0, tStyle, tFont); // Skill info y += tSpacing; y += 2; drawFillRect(GS_X, y, GS_W, tSpacing + 3, bgColorTitle); drawRect(GS_X, y, GS_W, tSpacing + 3,borderColorTitle,1); y += 1 + tSpacing; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Skills", 0.0f, 0, hStyle2, hFont2); x += 84; eth_CG_Text_Paint_Ext(x, y, hScale2, hScaleY2, hdrColor, "Level", 0.0f, 0, hStyle2, hFont2); x += 40; eth_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; eth_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; eth_CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, "No skills acquired!", 0.0f, 0, tStyle, tFont); } else { for(i=0; icSkills; i++) { y += tSpacing; eth_CG_Text_Paint_Ext(x, y, tScale, tScale, tColor, gs->strSkillz[i], 0.0f, 0, tStyle, tFont); } } } }