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); } }
void CG_DrawFireteamsByTeam(panel_button_t *button, team_t t) { float y = button->rect.y; const char *str; int i; if (t != TEAM_AXIS && t != TEAM_ALLIES) { return; } for (i = 0; i < MAX_FIRETEAMS; i++) { if (!cg.fireTeams[i].inuse) { continue; } if (cgs.clientinfo[cg.fireTeams[i].leader].team != t) { continue; } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (cg.fireTeams[i].ident + 1) % 10, bg_fireteamNames[cg.fireTeams[i].ident]); } else { str = va("%c. %s", 'A' + cg.fireTeams[i].ident, bg_fireteamNames[cg.fireTeams[i].ident]); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } }
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 + CG_TimeForBigPopup( cg_pmWaitingListBig->type ) + 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( 640 - 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( 640 - 4 - w, y + 56, 0.22f, 0.24f, colourText, cg_pmWaitingListBig->message, 0, 0, 0, &cgs.media.limboFont2 ); }
/** * @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_DrawPMItems(rectDef_t rect) { vec4_t colour = { 0.f, 0.f, 0.f, 1.f }; vec4_t colourText = { 1.f, 1.f, 1.f, 1.f }; float t; int i, j, size; pmListItem_t *listItem = cg_pmOldList; float y = rect.y; //360; if (cg_drawSmallPopupIcons.integer) { size = PM_ICON_SIZE_SMALL; y += 4; } else { size = PM_ICON_SIZE_NORMAL; } if (cg.snap->ps.persistant[PERS_RESPAWNS_LEFT] >= 0) { y -= 20; } if (!cg_pmWaitingList) { return; } t = cg_pmWaitingList->time + cg_popupTime.integer + cg_popupStayTime.integer; if (cg.time > t) { colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)cg_popupFadeTime.integer); } if (cg_pmWaitingList->shader > 0) { // colorize for (j = 0; j < 3; j++) { colourText[j] = cg_pmWaitingList->color[j]; } trap_R_SetColor(colourText); // draw CG_DrawPic(4, y, size, size, cg_pmWaitingList->shader); // decolorize for (j = 0; j < 3; j++) { colourText[j] = 1.f; } trap_R_SetColor(NULL); } else { size = 0; } CG_Text_Paint_Ext(4 + size + 2, y + 12, 0.2f, 0.2f, colourText, cg_pmWaitingList->message, 0, 0, 0, &cgs.media.limboFont2); for (i = 0; i < 6 && listItem; i++, listItem = listItem->next) { y -= size + 2; t = listItem->time + cg_popupTime.integer + cg_popupStayTime.integer; if (cg.time > t) { colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)cg_popupFadeTime.integer); } else { colourText[3] = colour[3] = 1.f; } if (listItem->shader > 0) { for (j = 0; j < 3; j++) // colorize { colourText[j] = listItem->color[j]; } trap_R_SetColor(colourText); CG_DrawPic(4, y, size, size, listItem->shader); for (j = 0; j < 3; j++) // decolorize { colourText[j] = 1.f; } trap_R_SetColor(NULL); } else { size = 0; } CG_Text_Paint_Ext(rect.x + size + 2, y + 12, 0.2f, 0.2f, colourText, listItem->message, 0, 0, 0, &cgs.media.limboFont2); } }
void CG_DrawPlayerNF(panel_button_t *button, int *pageofs) { float y = button->rect.y; const char *str; int i, x; for (i = 0; i < 8; i++) { x = CG_PlayerNFFromPos(i, pageofs); if (x == -1) { break; } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, cgs.clientinfo[x].name); } else { str = va("%c. %s", 'A' + i, cgs.clientinfo[x].name); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } if (*pageofs) { if (cg_quickMessageAlt.integer) { str = va("%i. %s", (8 + 1) % 10, "Previous"); } else { str = va("%c. %s", 'P', "Previous"); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } if (CG_CountPlayersNF() > (*pageofs + 1) * 8) { if (cg_quickMessageAlt.integer) { str = va("%i. %s", (9 + 1) % 10, "Next"); } else { str = va("%c. %s", 'N', "Next"); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } }
/** * @brief draws infoScreenText in loading bar */ void CG_LoadPanel_LoadingBarText(panel_button_t *button) { CG_Text_Paint_Ext(button->rect.x, button->rect.y, button->font->scalex, button->font->scaley, button->font->colour, cg.infoScreenText, 0, 0, 0, button->font->font); }
/** * @brief CG_DrawPMItems * @param[in] rect * @param[in] style */ void CG_DrawPMItems(rectDef_t rect, int style) { vec4_t colour = { 0.f, 0.f, 0.f, 1.f }; vec4_t colourText = { 1.f, 1.f, 1.f, 1.f }; float t; int i, j, size, w, sizew; pmListItem_t *listItem = cg_pmOldList; float y = rect.y; //360; float fontScale = cg_fontScaleSP.value; if (cg_drawSmallPopupIcons.integer) { size = PM_ICON_SIZE_SMALL; y += 4; } else { size = PM_ICON_SIZE_NORMAL; } if (cg.snap->ps.persistant[PERS_RESPAWNS_LEFT] >= 0) { y -= 20; } if (!cg_pmWaitingList) { return; } t = cg_pmWaitingList->time + cg_popupStayTime.integer; if (cg.time > t) { colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)cg_popupFadeTime.integer); } if (cg_pmWaitingList->shader > 0) { // colorize for (j = 0; j < 3; j++) { colourText[j] = cg_pmWaitingList->color[j]; } trap_R_SetColor(colourText); CG_DrawPic(4, ICON_Y_OFFSET(y), size, size, cg_pmWaitingList->shader); // decolorize for (j = 0; j < 3; j++) { colourText[j] = 1.f; } trap_R_SetColor(NULL); } else { size = -2; } CG_Text_Paint_Ext(size + 6, y + 12, fontScale, fontScale, colourText, cg_pmWaitingList->message, 0, 0, style, &cgs.media.limboFont2); // 4 + size + 2 w = CG_Text_Width_Ext(cg_pmWaitingList->message, fontScale, 0, &cgs.media.limboFont2); sizew = (cg_drawSmallPopupIcons.integer) ? PM_ICON_SIZE_SMALL : PM_ICON_SIZE_NORMAL; if (cg_pmWaitingList->weaponShader > 0) { for (i = 0; i < 3; i++) { colourText[i] = cg_pmWaitingList->color[i]; } trap_R_SetColor(colourText); CG_DrawPic(size + w + 12, ICON_Y_OFFSET(y), sizew * cg_pmWaitingList->scaleShader, sizew, cg_pmWaitingList->weaponShader); // 4 + size + 2 + w + 6 for (i = 0; i < 3; i++) { colourText[i] = 1.f; } trap_R_SetColor(NULL); } else { size = (cg_drawSmallPopupIcons.integer) ? 2 : 8; sizew = 0; } if (cg_pmWaitingList->message2[0]) { CG_Text_Paint_Ext(size + w + sizew * cg_pmWaitingList->scaleShader + 16, y + 12, fontScale, fontScale, colourText, cg_pmWaitingList->message2, 0, 0, style, &cgs.media.limboFont2); // 4 + size + 2 + w + 6 + sizew*... + 4 } for (i = 0; i < 6 && listItem; i++, listItem = listItem->next) { size = (cg_drawSmallPopupIcons.integer) ? PM_ICON_SIZE_SMALL : PM_ICON_SIZE_NORMAL; y -= size + 2; t = listItem->time + cg_popupStayTime.integer; if (cg.time > t) { colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)cg_popupFadeTime.integer); } else { colourText[3] = colour[3] = 1.f; } if (listItem->shader > 0) { // colorize for (j = 0; j < 3; j++) { colourText[j] = listItem->color[j]; } trap_R_SetColor(colourText); CG_DrawPic(4, ICON_Y_OFFSET(y), size, size, listItem->shader); // decolorize for (j = 0; j < 3; j++) { colourText[j] = 1.f; } trap_R_SetColor(NULL); } else { size = -2; } CG_Text_Paint_Ext(rect.x + size + 2, y + 12, fontScale, fontScale, colourText, listItem->message, 0, 0, style, &cgs.media.limboFont2); w = CG_Text_Width_Ext(listItem->message, fontScale, 0, &cgs.media.limboFont2); sizew = (cg_drawSmallPopupIcons.integer) ? PM_ICON_SIZE_SMALL : PM_ICON_SIZE_NORMAL; if (listItem->weaponShader > 0) { for (i = 0; i < 3; i++) { colourText[i] = listItem->color[i]; } trap_R_SetColor(colourText); CG_DrawPic(size + w + 12, ICON_Y_OFFSET(y), sizew * listItem->scaleShader, sizew, listItem->weaponShader); for (i = 0; i < 3; i++) { colourText[i] = 1.f; } trap_R_SetColor(NULL); } else { size = (cg_drawSmallPopupIcons.integer) ? 2 : 8; sizew = 0; } if (listItem->message2[0]) { //size + w + sizew * listItem->scaleShader + 16 CG_Text_Paint_Ext(size + w + sizew * listItem->scaleShader + 16, y + 12, fontScale, fontScale, colourText, listItem->message2, 0, 0, style, &cgs.media.limboFont2); } } }
static int WM_TeamScoreboard( int x, int y, team_t team, float fade, int maxrows ) { vec4_t hcolor; float tempx, tempy; int height, width; int i; int count = 0; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; height = SMALLCHAR_HEIGHT * maxrows; width = INFO_PLAYER_WIDTH + INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH; CG_FillRect( x-5, y-2, width+5, 21, clrUiBack ); CG_FillRect( x-5, y-2, width+5, 21, clrUiBar ); Vector4Set( hcolor, 0, 0, 0, fade ); CG_DrawRect_FixedBorder( x-5, y-2, width+5, 21, 1, colorBlack ); // draw header if( cg_gameType.integer == GT_WOLF_LMS ) { char *s; if ( team == TEAM_AXIS ) { s = va( "%s [%d] (%d %s)", CG_TranslateString( "AXIS" ), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ); s = va( "%s ^3%s", s, cg.teamFirstBlood == TEAM_AXIS ? CG_TranslateString("FIRST BLOOD") : "" ); CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } else if ( team == TEAM_ALLIES ) { s = va( "%s [%d] (%d %s)", CG_TranslateString( "ALLIES" ), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ); s = va( "%s ^3%s", s, cg.teamFirstBlood == TEAM_ALLIES ? CG_TranslateString("FIRST BLOOD") : "" ); CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } } else { if ( team == TEAM_AXIS ) { CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, va( "%s [%d] (%d %s)", CG_TranslateString( "AXIS" ), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ), 0, 0, 0, &cgs.media.limboFont1 ); } else if ( team == TEAM_ALLIES ) { CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, va( "%s [%d] (%d %s)", CG_TranslateString( "ALLIES" ), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ), 0, 0, 0, &cgs.media.limboFont1 ); } } y += SMALLCHAR_HEIGHT + 3; // save off y val tempy = y; // draw color bands for ( i = 0; i <= maxrows; i++ ) { if ( i % 2 == 0 ) VectorSet( hcolor, (80.f/255.f), (80.f/255.f), (80.f/255.f) ); // LIGHT BLUE else VectorSet( hcolor, (0.f/255.f), (0.f/255.f), (0.f/255.f) ); // DARK BLUE hcolor[3] = fade * 0.3; CG_FillRect( x-5, y, width+5, SMALLCHAR_HEIGHT+1, hcolor ); trap_R_SetColor( colorBlack ); CG_DrawTopBottom( x-5, y, width+5, SMALLCHAR_HEIGHT+1, 1 ); trap_R_SetColor( NULL ); y += SMALLCHAR_HEIGHT; } hcolor[3] = 1; y = tempy; tempx = x; CG_FillRect( x-5, y-1, width+5, 18, clrUiBack ); //CG_FillRect( x-5, y-1, width+5, 18, clrUiBar ); trap_R_SetColor( colorBlack ); CG_DrawTopBottom( x-5, y-1, width+5, 18, 1 ); trap_R_SetColor( NULL ); // draw player info headings CG_DrawSmallString( tempx, y, CG_TranslateString( "Name" ), fade ); tempx += INFO_PLAYER_WIDTH; CG_DrawSmallString( tempx, y, CG_TranslateString( "Class" ), fade ); tempx += INFO_CLASS_WIDTH; if( cgs.gametype == GT_WOLF_LMS ) { CG_DrawSmallString( tempx, y, CG_TranslateString( "Score" ), fade ); tempx += INFO_SCORE_WIDTH; } else { CG_DrawSmallString( tempx + 1 * SMALLCHAR_WIDTH, y, CG_TranslateString( "XP" ), fade ); tempx += INFO_XP_WIDTH; } CG_DrawSmallString( tempx, y, CG_TranslateString( "Ping" ), fade ); tempx += INFO_LATENCY_WIDTH; if( cgs.gametype != GT_WOLF_LMS ) { CG_DrawPicST( tempx + 2, y, INFO_LIVES_WIDTH - 4, 16, 0.f, 0.f, 0.5f, 1.f, team == TEAM_ALLIES ? cgs.media.hudAlliedHelmet : cgs.media.hudAxisHelmet ); tempx += INFO_LIVES_WIDTH; } y += SMALLCHAR_HEIGHT; // draw player info VectorSet( hcolor, 1, 1, 1 ); hcolor[3] = fade; cg.teamPlayers[team] = 0; // JPW NERVE for ( i = 0; i < cg.numScores; i++ ) { if ( team != cgs.clientinfo[ cg.scores[i].client ].team ) continue; cg.teamPlayers[team]++; } count = 0; for( i = 0; i < cg.numScores && count < maxrows; i++ ) { if( team != cgs.clientinfo[ cg.scores[i].client ].team ) { continue; } if( cg.teamPlayers[team] > maxrows ) { WM_DrawClientScore_Small( x, y, &cg.scores[i], hcolor, fade ); y += MINICHAR_HEIGHT; } else { WM_DrawClientScore( x, y, &cg.scores[i], hcolor, fade ); y += SMALLCHAR_HEIGHT; } count++; } // draw spectators y += SMALLCHAR_HEIGHT; for ( i = 0; i < cg.numScores; i++ ) { if ( cgs.clientinfo[ cg.scores[i].client ].team != TEAM_SPECTATOR ) continue; if ( team == TEAM_AXIS && ( i % 2 ) ) continue; if ( team == TEAM_ALLIES && ( ( i + 1 ) % 2 ) ) continue; WM_DrawClientScore( x, y, &cg.scores[i], hcolor, fade ); y += SMALLCHAR_HEIGHT; } return y; }
int CG_DrawSpawnPointInfo(int px, int py, int pw, int ph, qboolean draw, mapScissor_t *scissor, int expand) { int i; char buffer[64]; vec2_t point; int e = -1; vec2_t icon_extends; team_t team = CG_LimboPanel_GetRealTeam(); if (cgs.ccFilter & CC_FILTER_SPAWNS) { return -1; } for (i = 1; i < cg.spawnCount; i++) { float changetime = 0; if (cg.spawnTeams_changeTime[i]) { changetime = (cg.time - cg.spawnTeams_changeTime[i]); if (changetime > SPAWN_SIZEUPTIME || changetime < 0) { changetime = cg.spawnTeams_changeTime[i] = 0; } } // added parens around ambiguity if (((cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR) && (cg.spawnTeams[i] != team)) || ((cg.spawnTeams[i] & 256) && !changetime)) { continue; } if (cgs.ccLayers) { if (CG_CurLayerForZ((int)cg.spawnCoords[i][2]) != cgs.ccSelectedLayer) { break; } } if (scissor) { point[0] = ((cg.spawnCoordsUntransformed[i][0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * pw * scissor->zoomFactor; point[1] = ((cg.spawnCoordsUntransformed[i][1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * ph * scissor->zoomFactor; } else { point[0] = px + (((cg.spawnCoordsUntransformed[i][0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * pw); point[1] = py + (((cg.spawnCoordsUntransformed[i][1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * ph); } if (scissor && CG_ScissorPointIsCulled(point, scissor)) { continue; } if (scissor) { point[0] += px - scissor->tl[0]; point[1] += py - scissor->tl[1]; } icon_extends[0] = FLAGSIZE_NORMAL; icon_extends[1] = FLAGSIZE_NORMAL; if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } point[0] -= (icon_extends[0] * (39 / 128.f)); point[1] += (icon_extends[1] * (31 / 128.f)); if (changetime) { if (draw) { float size; if (cg.spawnTeams[i] == team) { size = 20 * (changetime / SPAWN_SIZEUPTIME); } else { size = 20 * (1 - (changetime / SPAWN_SIZEUPTIME)); } if (scissor) { size *= (scissor->zoomFactor / 5.159); } else { size *= cgs.ccZoomFactor; } CG_DrawPic(point[0] - FLAG_LEFTFRAC * size, point[1] - FLAG_TOPFRAC * size, size, size, cgs.media.commandCentreSpawnShader[cg.spawnTeams[i] == TEAM_AXIS ? 0 : 1]); } } else if ((draw && i == expand) || (!expanded && BG_RectContainsPoint(point[0] - FLAGSIZE_NORMAL * 0.5f, point[1] - FLAGSIZE_NORMAL * 0.5f, FLAGSIZE_NORMAL, FLAGSIZE_NORMAL, cgDC.cursorx, cgDC.cursory))) { if (draw) { float size = FLAGSIZE_EXPANDED; if (scissor) { size *= (scissor->zoomFactor / 5.159); } else { size *= cgs.ccZoomFactor; } CG_DrawPic(point[0] - FLAG_LEFTFRAC * size, point[1] - FLAG_TOPFRAC * size, size, size, cgs.media.commandCentreSpawnShader[cg.spawnTeams[i] == TEAM_AXIS ? 0 : 1]); } else { if (!scissor) { float w; Com_sprintf(buffer, sizeof(buffer), "%s (Troops: %i)", cg.spawnPoints[i], cg.spawnPlayerCounts[i]); w = CG_Text_Width_Ext(buffer, 0.2f, 0, &cgs.media.limboFont2); CG_CommandMap_SetHighlightText(buffer, point[0] - (w * 0.5f), point[1] - 8); } e = i; } } else { if (draw) { float size = FLAGSIZE_NORMAL; if (scissor) { size *= (scissor->zoomFactor / 5.159); } else { size *= cgs.ccZoomFactor; } CG_DrawPic(point[0] - FLAG_LEFTFRAC * size, point[1] - FLAG_TOPFRAC * size, size, size, cgs.media.commandCentreSpawnShader[cg.spawnTeams[i] == TEAM_AXIS ? 0 : 1]); if (!scissor) { Com_sprintf(buffer, sizeof(buffer), "(Troops: %i)", cg.spawnPlayerCounts[i]); CG_Text_Paint_Ext(point[0] + FLAGSIZE_NORMAL * 0.25f, point[1], 0.2f, 0.2f, colorWhite, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } } } } return e; }
// 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_DrawPMItems( void ) { vec4_t colour = { 0.f, 0.f, 0.f, 1.f }; vec4_t colourText = { 1.f, 1.f, 1.f, 1.f }; float t; int i, size; pmListItem_t* listItem = cg_pmOldList; int x = cg.hud.cpmtext[0]; int y = cg.hud.cpmtext[1]; float scaleVal; if( cg_drawSmallPopupIcons.integer ) { size = PM_ICON_SIZE_SMALL; y += 4; } else { size = PM_ICON_SIZE_NORMAL; } if( ( cg.hudEditor.showHudEditor || cg.snap->ps.persistant[PERS_RESPAWNS_LEFT] >= 0 ) && cg.hud.livesleft[0] == 4 && cg.hud.livesleft[1] == 360 && cg.hud.cpmtext[0] == 4 && cg.hud.cpmtext[1] == 360 ) { y -= 20; } if( !cg_pmWaitingList || cg.hud.cpmtext[0] < 0 ) { return; } t = cg_pmWaitingList->time + CG_TimeForPopup( cg_pmWaitingList->type ) + PM_WAITTIME; if( cg.time > t ) { colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME); } scaleVal = cg.hud.cpmtext[2]/100.f; trap_R_SetColor( colourText ); CG_DrawPic( x, y, size, size, cg_pmWaitingList->shader ); trap_R_SetColor( NULL ); CG_Text_Paint_Ext( x + size + 2, y + 12, scaleVal, scaleVal, colourText, cg_pmWaitingList->message, 0, 0, 0, &cgs.media.font3 ); for( i = 0; i < 4 && listItem; i++, listItem = listItem->next ) { y -= size + 2; t = listItem->time + CG_TimeForPopup( listItem->type ) + PM_WAITTIME; if( cg.time > t ) { colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME); } else { colourText[3] = colour[3] = 1.f; } trap_R_SetColor( colourText ); CG_DrawPic( x, y, size, size, listItem->shader ); trap_R_SetColor( NULL ); CG_Text_Paint_Ext( x + size + 2, y + 12, scaleVal, scaleVal, colourText, listItem->message, 0, 0, 0, &cgs.media.font3 ); } }
// CHRUKER: b035 - Added absolute maximum rows static int WM_TeamScoreboard(int x, int y, team_t team, float fade, int maxrows, int absmaxrows) { vec4_t hcolor; float tempx, tempy; int height, width; int i; int count = 0; qboolean use_mini_chars = qfalse; // CHRUKER: b035 - Needed to check if using mini chars vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; height = SMALLCHAR_HEIGHT * maxrows; width = INFO_PLAYER_WIDTH + INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH; CG_FillRect(x - 5, y - 2, width + 5, 21, clrUiBack); CG_FillRect(x - 5, y - 2, width + 5, 21, clrUiBar); Vector4Set(hcolor, 0, 0, 0, fade); CG_DrawRect_FixedBorder(x - 5, y - 2, width + 5, 21, 1, colorBlack); // draw header if(cg_gameType.integer == GT_WOLF_LMS) { char *s; if(team == TEAM_AXIS) { s = va("%s [%d] (%d %s)", CG_TranslateString("AXIS"), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS")); s = va("%s ^3%s", s, cg.teamFirstBlood == TEAM_AXIS ? CG_TranslateString("FIRST BLOOD") : ""); CG_Text_Paint_Ext(x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1); } else if(team == TEAM_ALLIES) { s = va("%s [%d] (%d %s)", CG_TranslateString("ALLIES"), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS")); s = va("%s ^3%s", s, cg.teamFirstBlood == TEAM_ALLIES ? CG_TranslateString("FIRST BLOOD") : ""); CG_Text_Paint_Ext(x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1); } } else { if(team == TEAM_AXIS) { CG_Text_Paint_Ext(x, y + 13, 0.25f, 0.25f, tclr, va("%s [%d] (%d %s)", CG_TranslateString("AXIS"), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS")), 0, 0, 0, &cgs.media.limboFont1); } else if(team == TEAM_ALLIES) { CG_Text_Paint_Ext(x, y + 13, 0.25f, 0.25f, tclr, va("%s [%d] (%d %s)", CG_TranslateString("ALLIES"), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS")), 0, 0, 0, &cgs.media.limboFont1); } } y += SMALLCHAR_HEIGHT + 3; tempx = x; // CHRUKER: b076 - Adjusted y coordinate, and changed to use DrawBottom instead of DrawTopBottom CG_FillRect(x - 5, y, width + 5, 18, clrUiBack); trap_R_SetColor(colorBlack); CG_DrawBottom_NoScale(x - 5, y, width + 5, 18, 1); trap_R_SetColor(NULL); // draw player info headings CG_DrawSmallString(tempx, y, CG_TranslateString("Name"), fade); tempx += INFO_PLAYER_WIDTH; CG_DrawSmallString(tempx, y, CG_TranslateString("Class"), fade); tempx += INFO_CLASS_WIDTH; if(cgs.gametype == GT_WOLF_LMS) { CG_DrawSmallString(tempx, y, CG_TranslateString("Score"), fade); tempx += INFO_SCORE_WIDTH; } else { CG_DrawSmallString(tempx + 1 * SMALLCHAR_WIDTH, y, CG_TranslateString("XP"), fade); tempx += INFO_XP_WIDTH; } CG_DrawSmallString(tempx, y, CG_TranslateString("Ping"), fade); tempx += INFO_LATENCY_WIDTH; if(cgs.gametype != GT_WOLF_LMS) { CG_DrawPicST(tempx + 2, y, INFO_LIVES_WIDTH - 4, 16, 0.f, 0.f, 0.5f, 1.f, team == TEAM_ALLIES ? cgs.media.hudAlliedHelmet : cgs.media.hudAxisHelmet); tempx += INFO_LIVES_WIDTH; } // CHRUKER: b076 - The math says char height + 2 * border width (1 pixel) y += SMALLCHAR_HEIGHT + 2; cg.teamPlayers[team] = 0; // JPW NERVE for(i = 0; i < cg.numScores; i++) { if(team != cgs.clientinfo[cg.scores[i].client].team) { continue; } cg.teamPlayers[team]++; } // CHRUKER: b035 - Adjust maxrows if ( cg.teamPlayers[team] > maxrows ) { maxrows = absmaxrows; use_mini_chars = qtrue; } // save off y val tempy = y; // draw color bands for ( i = 0; i < maxrows; i++ ) { if ( i % 2 == 0 ) { VectorSet( hcolor, (80.f/255.f), (80.f/255.f), (80.f/255.f) ); // LIGHT BLUE } else { VectorSet( hcolor, (0.f/255.f), (0.f/255.f), (0.f/255.f) ); // DARK BLUE } hcolor[3] = fade * 0.3; if (use_mini_chars) { // CHRUKER: b076 - Adjusted y height, and changed to DrawBottom instead of DrawTopBottom CG_FillRect( x-5, y, width+5, MINICHAR_HEIGHT, hcolor ); trap_R_SetColor( colorBlack ); CG_DrawBottom_NoScale( x-5, y, width+5, MINICHAR_HEIGHT, 1 ); trap_R_SetColor( NULL ); y += MINICHAR_HEIGHT; } else { // CHRUKER: b076 - Adjusted y height, and changed to DrawBottom instead of DrawTopBottom CG_FillRect( x-5, y, width+5, SMALLCHAR_HEIGHT, hcolor ); trap_R_SetColor( colorBlack ); CG_DrawBottom_NoScale( x-5, y, width+5, SMALLCHAR_HEIGHT, 1 ); trap_R_SetColor( NULL ); y += SMALLCHAR_HEIGHT; } } hcolor[3] = 1; y = tempy; // draw player info VectorSet( hcolor, 1, 1, 1 ); hcolor[3] = fade; count = 0; for(i = 0; i < cg.numScores && count < maxrows; i++) { if(team != cgs.clientinfo[cg.scores[i].client].team) { continue; } // CHRUKER: b035 - Using the flag instead if(use_mini_chars) { WM_DrawClientScore_Small(x, y, &cg.scores[i], hcolor, fade); y += MINICHAR_HEIGHT; } else { WM_DrawClientScore(x, y, &cg.scores[i], hcolor, fade); y += SMALLCHAR_HEIGHT; } count++; } // draw spectators // CHRUKER: b035 - Missing support for mini char height scoreboard background if (use_mini_chars) { y += MINICHAR_HEIGHT; } else { y += SMALLCHAR_HEIGHT; } for(i = 0; i < cg.numScores; i++) { if(cgs.clientinfo[cg.scores[i].client].team != TEAM_SPECTATOR) { continue; } if(team == TEAM_AXIS && (i % 2)) { continue; } if(team == TEAM_ALLIES && ((i + 1) % 2)) { continue; } // CHRUKER: b034 - Missing support for minichars; b035 - Using the flag instead if(use_mini_chars) { WM_DrawClientScore_Small( x, y, &cg.scores[i], hcolor, fade ); y += MINICHAR_HEIGHT; } else { WM_DrawClientScore( x, y, &cg.scores[i], hcolor, fade ); y += SMALLCHAR_HEIGHT; } } return y; }
static int WM_DrawInfoLine(int x, int y, float fade) { int w, defender, winner; const char *s; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; if(cg.snap->ps.pm_type != PM_INTERMISSION) { return y; } w = 360; // CG_DrawPic( 320 - w/2, y, w, INFO_LINE_HEIGHT, trap_R_RegisterShaderNoMip( "ui/assets/mp_line_strip.tga" ) ); s = CG_ConfigString(CS_MULTI_INFO); defender = atoi(Info_ValueForKey(s, "defender")); s = CG_ConfigString(CS_MULTI_MAPWINNER); winner = atoi(Info_ValueForKey(s, "winner")); 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(320 - w / 2, y, w, 20, clrUiBar); CG_DrawRect_FixedBorder(320 - w / 2, y, w, 20, 1, colorBlack); w = CG_Text_Width_Ext(s, 0.25f, 0, &cgs.media.limboFont1); CG_Text_Paint_Ext(320 - w * 0.5f, y + 15, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1); // CG_DrawSmallString( 320 - w/2, ( y + INFO_LINE_HEIGHT / 2 ) - SMALLCHAR_HEIGHT / 2, s, fade ); return y + INFO_LINE_HEIGHT + 6; }
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_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); } } }
int WM_DrawObjectives( int x, int y, int width, float fade ) { const char *s, *str; int tempy, rows; int msec, mins, seconds, tens; // JPW NERVE vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; if ( cg.snap->ps.pm_type == PM_INTERMISSION ) { const char *s, *buf, *shader = NULL, *flagshader = NULL, *nameshader = NULL; // Moved to CG_DrawIntermission /* static int doScreenshot = 0, doDemostop = 0; // OSP - End-of-level autoactions if(!cg.demoPlayback) { if(!cg.latchVictorySound) { if(cg_autoAction.integer & AA_SCREENSHOT) { doScreenshot = cg.time + 1000; } if(cg_autoAction.integer & AA_STATSDUMP) { CG_dumpStats_f(); } if((cg_autoAction.integer & AA_DEMORECORD) && (cgs.gametype == GT_WOLF_STOPWATCH && cgs.currentRound != 1)) { doDemostop = cg.time + 5000; // stats should show up within 5 seconds } } if(doScreenshot > 0 && doScreenshot < cg.time) { CG_autoScreenShot_f(); doScreenshot = 0; } if(doDemostop > 0 && doDemostop < cg.time) { trap_SendConsoleCommand("stoprecord\n"); doDemostop = 0; } } */ rows = 8; y += SMALLCHAR_HEIGHT * ( rows - 1 ); s = CG_ConfigString( CS_MULTI_MAPWINNER ); buf = Info_ValueForKey( s, "winner" ); if ( atoi( buf ) == -1 ) str = "ITS A TIE!"; else if ( atoi( buf ) ) { str = "ALLIES"; // shader = "ui/assets/portraits/allies_win"; flagshader = "ui/assets/portraits/allies_win_flag.tga"; nameshader = "ui/assets/portraits/text_allies.tga"; /* if ( !cg.latchVictorySound ) { cg.latchVictorySound = qtrue; trap_S_StartLocalSound( trap_S_RegisterSound( "sound/music/allies_win.wav", qtrue ), CHAN_LOCAL_SOUND ); // FIXME: stream }*/ } else { str = "AXIS"; // shader = "ui/assets/portraits/axis_win"; flagshader = "ui/assets/portraits/axis_win_flag.tga"; nameshader = "ui/assets/portraits/text_axis.tga"; /* if ( !cg.latchVictorySound ) { cg.latchVictorySound = qtrue; trap_S_StartLocalSound( trap_S_RegisterSound( "sound/music/axis_win.wav", qtrue ), CHAN_LOCAL_SOUND ); // FIXME: stream }*/ } y += SMALLCHAR_HEIGHT * ( ( rows - 2 ) / 2 ); if ( flagshader ) { CG_DrawPic( 100, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) ); CG_DrawPic( 325, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) ); } if ( shader ) CG_DrawPic( 229, 10, 182, 136, trap_R_RegisterShaderNoMip( shader ) ); if ( nameshader ) { CG_DrawPic( 140, 50, 127, 64, trap_R_RegisterShaderNoMip( nameshader ) ); CG_DrawPic( 365, 50, 127, 64, trap_R_RegisterShaderNoMip( "ui/assets/portraits/text_win.tga" ) ); } return y; } // JPW NERVE -- mission time & reinforce time else { tempy = y; rows = 1; CG_FillRect( x-5, y-2, width+5, 21, clrUiBack ); CG_FillRect( x-5, y-2, width+5, 21, clrUiBar ); CG_DrawRect_FixedBorder( x-5, y-2, width+5, 21, 1, colorBlack ); y += SMALLCHAR_HEIGHT * ( rows - 1 ); if( cgs.timelimit > 0.0f ) { 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; } else { mins = tens = seconds = 0; } if( cgs.gamestate != GS_PLAYING ) { s = va("%s %s", CG_TranslateString("MISSION TIME:"), CG_TranslateString("WARMUP")); } else if ( msec < 0 && cgs.timelimit > 0.0f ) { if ( cgs.gamestate == GS_WAITING_FOR_PLAYERS ) s = va( "%s %s", CG_TranslateString( "MISSION TIME:" ), CG_TranslateString( "GAME STOPPED" ) ); else s = va( "%s %s", CG_TranslateString( "MISSION TIME:" ), CG_TranslateString( "SUDDEN DEATH" ) ); } else { s = va( "%s %2.0f:%i%i", CG_TranslateString( "MISSION TIME:" ), (float)mins, tens, seconds ); // float cast to line up with reinforce time } CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); if( cgs.gametype != GT_WOLF_LMS ) { if(cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS || cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES) { msec = CG_CalculateReinfTime( qfalse ) * 1000; } 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( "%s %2.0f:%i%i", CG_TranslateString( "REINFORCE TIME:" ), (float)mins, tens, seconds ); CG_Text_Paint_Ext( 640 - 20 - CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ), y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } } // NERVE - SMF if ( cgs.gametype == GT_WOLF_STOPWATCH ) { int w; s = va( "%s %i", CG_TranslateString( "STOPWATCH ROUND" ), cgs.currentRound + 1 ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } else if( cgs.gametype == GT_WOLF_LMS ) { int w; s = va( "%s %i %s %i-%i", CG_TranslateString( "ROUND" ), cgs.currentRound + 1, CG_TranslateString( "SCORE" ), cg.teamWonRounds[1], cg.teamWonRounds[0] ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } else if( cgs.gametype == GT_WOLF_CAMPAIGN ) { int w; s = va( "MAP %i of %i", cgs.currentCampaignMap + 1, cgs.campaignData.mapCount ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } y += SMALLCHAR_HEIGHT * 2; } // jpw return y; }
void CG_CommandMap_DrawHighlightText(void) { CG_Text_Paint_Ext(cg_highlightTextRect.x, cg_highlightTextRect.y, 0.25f, 0.25f, colorWhite, cg_highlightText, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); *cg_highlightText = '\0'; }
void CG_LimboPanel_WeaponPanel(panel_button_t *button) { weapon_t weap = CG_LimboPanel_GetSelectedWeapon(); int cnt = CG_LimboPanel_WeaponCount(); if (cgs.ccSelectedWeapon2 >= CG_LimboPanel_WeaponCount_ForSlot(0)) { cgs.ccSelectedWeapon2 = CG_LimboPanel_WeaponCount_ForSlot(0) - 1; } if (CG_LimboPanel_GetTeam() == TEAM_SPECTATOR) { vec4_t clr = { 0.f, 0.f, 0.f, 0.4f }; CG_DrawPic(button->rect.x, button->rect.y, button->rect.w, button->rect.h, cgs.media.limboWeaponCard); trap_R_SetColor(clr); CG_DrawPic(button->rect.x, button->rect.y, button->rect.w, button->rect.h, cgs.media.limboWeaponBlendThingy); trap_R_SetColor(NULL); CG_Text_Paint_Ext(button->rect.x + 4, button->rect.y + 12, weaponPanelNameFont.scalex, weaponPanelNameFont.scaley, weaponPanelNameFont.colour, "SPECTATOR", 0, 0, weaponPanelNameFont.style, weaponPanelNameFont.font); return; } if (BG_PanelButtons_GetFocusButton() == button && cnt > 1) { int i, x; rectDef_t rect; memcpy(&rect, &button->rect, sizeof (rect)); CG_LimboPanel_WeaponPanel_DrawWeapon(&rect, weap, qtrue, va("%iof%i", CG_LimboPanel_GetSelectedWeaponNum() + 1, cnt), CG_LimboPanel_RealWeaponIsDisabled(weap)); if (BG_CursorInRect(&rect) && button->data[7] != 0) { SOUND_FOCUS; button->data[7] = 0; } rect.y -= rect.h; // render in expanded mode ^ for (i = 0, x = 1; i < cnt; ++i) { weapon_t cycleWeap = CG_LimboPanel_GetWeaponForNumber(i, cgs.ccSelectedWeaponNumber, qtrue); if (cycleWeap != weap) { CG_LimboPanel_WeaponPanel_DrawWeapon(&rect, cycleWeap, qtrue, va("%iof%i", i + 1, cnt), CG_LimboPanel_RealWeaponIsDisabled(cycleWeap)); if (BG_CursorInRect(&rect) && button->data[7] != x) { SOUND_FOCUS; button->data[7] = x; } rect.y -= rect.h; x++; } } CG_DrawBorder(button->rect.x, button->rect.y - ((cnt - 1) * button->rect.h), button->rect.w, button->rect.h * cnt, qfalse, qfalse); } else { vec4_t clr = { 0.f, 0.f, 0.f, 0.4f }; // render in normal mode CG_LimboPanel_WeaponPanel_DrawWeapon(&button->rect, weap, cnt > 1 ? qtrue : qfalse, va("%iof%i", CG_LimboPanel_GetSelectedWeaponNum() + 1, cnt), CG_LimboPanel_RealWeaponIsDisabled(weap)); if (cnt <= 1 || !BG_CursorInRect(&button->rect)) { vec4_t clr2 = { 1.f, 1.f, 1.f, 0.4f }; trap_R_SetColor(clr2); } CG_DrawPic(button->rect.x + button->rect.w - 20, button->rect.y + 4, 16, 12, cgs.media.limboWeaponCardArrow); trap_R_SetColor(clr); CG_DrawPic(button->rect.x, button->rect.y, button->rect.w, button->rect.h, cgs.media.limboWeaponBlendThingy); trap_R_SetColor(NULL); } }
static void CG_DrawGrid(float x, float y, float w, float h, mapScissor_t *scissor) { vec2_t step; vec2_t dim_x, dim_y; vec4_t line; float xscale, yscale; float grid_x, grid_y; vec2_t dist; vec4_t gridColour; dist[0] = cg.mapcoordsMaxs[0] - cg.mapcoordsMins[0]; dist[1] = cg.mapcoordsMaxs[1] - cg.mapcoordsMins[1]; if (!gridInitDone) { gridStep[0] = 1200.f; gridStep[1] = 1200.f; // ensure minimal grid density while ((cg.mapcoordsMaxs[0] - cg.mapcoordsMins[0]) / gridStep[0] < 7) { gridStep[0] -= 50.f; } while ((cg.mapcoordsMins[1] - cg.mapcoordsMaxs[1]) / gridStep[1] < 7) { gridStep[1] -= 50.f; } gridStartCoord[0] = .5f * ((((cg.mapcoordsMaxs[0] - cg.mapcoordsMins[0]) / gridStep[0]) - ((int)((cg.mapcoordsMaxs[0] - cg.mapcoordsMins[0]) / gridStep[0]))) * gridStep[0]); gridStartCoord[1] = .5f * ((((cg.mapcoordsMins[1] - cg.mapcoordsMaxs[1]) / gridStep[1]) - ((int)((cg.mapcoordsMins[1] - cg.mapcoordsMaxs[1]) / gridStep[1]))) * gridStep[1]); gridInitDone = qtrue; } if (scissor) { dim_x[0] = cg.mapcoordsMins[0]; dim_x[1] = cg.mapcoordsMaxs[0]; dim_y[0] = cg.mapcoordsMaxs[1]; dim_y[1] = cg.mapcoordsMins[1]; // transform xscale = (w * scissor->zoomFactor) / dist[0]; yscale = (h * scissor->zoomFactor) / -dist[1]; dim_x[0] = (dim_x[0] - cg.mapcoordsMins[0]) * xscale; dim_x[1] = (dim_x[1] - cg.mapcoordsMins[0]) * xscale; dim_y[0] = (dim_y[0] - cg.mapcoordsMaxs[1]) * yscale; dim_y[1] = (dim_y[1] - cg.mapcoordsMaxs[1]) * yscale; grid_x = ((gridStartCoord[0] / dist[0]) * w * scissor->zoomFactor) - scissor->tl[0]; grid_y = ((-gridStartCoord[1] / dist[1]) * h * scissor->zoomFactor) - scissor->tl[1]; step[0] = gridStep[0] * xscale; step[1] = gridStep[1] * yscale; // draw Vector4Set(gridColour, clrBrownLine[0], clrBrownLine[1], clrBrownLine[2], .4f); trap_R_SetColor(gridColour); for ( ; grid_x < dim_x[1]; grid_x += step[0]) { if (grid_x < dim_x[0]) { continue; } if (grid_x > w) { break; } if (scissor->circular) { // clip line against circle float xc, yc; line[0] = x + grid_x; xc = line[0] >= x + .5f * w ? line[0] - (x + .5f * w) : (x + .5f * w) - line[0]; yc = SQRTFAST(Square(.5f * w) - Square(xc)); line[1] = y + (.5f * h) - yc; line[2] = 1.f; line[3] = 2 * yc; } else { Vector4Set(line, x + grid_x, y + dim_y[0], 1.f, h); } line[0] *= cgs.screenXScale; line[1] *= cgs.screenYScale; line[3] *= cgs.screenYScale; trap_R_DrawStretchPic(line[0], line[1], line[2], line[3], 0, 0, 0, 1, cgs.media.whiteShader); } for ( ; grid_y < dim_y[1]; grid_y += step[1]) { if (grid_y < dim_y[0]) { continue; } if (grid_y > h) { break; } if (scissor->circular) { // clip line against circle float xc, yc; line[1] = y + grid_y; yc = line[1] >= y + .5f * h ? line[1] - (y + .5f * h) : (y + .5f * h) - line[1]; xc = SQRTFAST(Square(.5f * h) - Square(yc)); line[0] = x + (.5f * w) - xc; line[2] = 2 * xc; line[3] = 1.f; } else { Vector4Set(line, x + dim_x[0], y + grid_y, w, 1); } line[0] *= cgs.screenXScale; line[1] *= cgs.screenYScale; line[2] *= cgs.screenXScale; trap_R_DrawStretchPic(line[0], line[1], line[2], line[3], 0, 0, 0, 1, cgs.media.whiteShader); } trap_R_SetColor(NULL); } else { char coord_char[3], coord_int; float text_width, text_height; vec2_t textOrigin; dim_x[0] = cg.mapcoordsMins[0]; dim_x[1] = cg.mapcoordsMaxs[0]; dim_y[0] = cg.mapcoordsMaxs[1]; dim_y[1] = cg.mapcoordsMins[1]; // transform xscale = w / dist[0]; yscale = h / -dist[1]; dim_x[0] = (dim_x[0] - cg.mapcoordsMins[0]) * xscale; dim_x[1] = (dim_x[1] - cg.mapcoordsMins[0]) * xscale; dim_y[0] = (dim_y[0] - cg.mapcoordsMaxs[1]) * yscale; dim_y[1] = (dim_y[1] - cg.mapcoordsMaxs[1]) * yscale; grid_x = gridStartCoord[0] * xscale; grid_y = gridStartCoord[1] * yscale; step[0] = gridStep[0] * xscale; step[1] = gridStep[1] * yscale; // draw textOrigin[0] = grid_x; textOrigin[1] = grid_y; Vector4Set(gridColour, clrBrownLine[0], clrBrownLine[1], clrBrownLine[2], 1.f); coord_char[1] = '\0'; for (coord_char[0] = ('A' - 1); grid_x < dim_x[1]; grid_x += step[0], coord_char[0]++) { if (coord_char[0] >= 'A') { text_width = CG_Text_Width_Ext(coord_char, 0.2f, 0, &cgs.media.limboFont2); text_height = CG_Text_Height_Ext(coord_char, 0.2f, 0, &cgs.media.limboFont2); CG_Text_Paint_Ext((x + grid_x) - (.5f * step[0]) - (.5f * text_width), y + dim_y[0] + textOrigin[1] + 1.5f * text_height, 0.2f, 0.2f, colorBlack, coord_char, 0, 0, 0, &cgs.media.limboFont2); } trap_R_SetColor(gridColour); Vector4Set(line, x + grid_x, y + dim_y[0], 1, dim_x[1] - dim_x[0]); CG_AdjustFrom640(&line[0], &line[1], &line[2], &line[3]); trap_R_DrawStretchPic(line[0], line[1], line[2], line[3], 0, 0, 0, 1, cgs.media.whiteShader); } for (coord_int = -1; grid_y < dim_y[1]; grid_y += step[1], coord_int++) { if (coord_int >= 0) { Com_sprintf(coord_char, sizeof(coord_char), "%i", coord_int); text_width = CG_Text_Width_Ext("0", 0.2f, 0, &cgs.media.limboFont2); text_height = CG_Text_Height_Ext(coord_char, 0.2f, 0, &cgs.media.limboFont2); CG_Text_Paint_Ext(x + dim_x[0] + textOrigin[0] + .5f * text_width, (y + grid_y) - (.5f * step[1]) + (.5f * text_height), 0.2f, 0.2f, colorBlack, coord_char, 0, 0, 0, &cgs.media.limboFont2); } trap_R_SetColor(gridColour); Vector4Set(line, x + dim_x[0], y + grid_y, dim_y[1] - dim_y[0], 1); CG_AdjustFrom640(&line[0], &line[1], &line[2], &line[3]); trap_R_DrawStretchPic(line[0], line[1], line[2], line[3], 0, 0, 0, 1, cgs.media.whiteShader); } trap_R_SetColor(NULL); } }
void CG_LoadPanel_RenderCampaignTypeText(panel_button_t *button) { CG_Text_Paint_Ext(button->rect.x, button->rect.y, button->font->scalex, button->font->scaley, button->font->colour, va("%s:", CG_LoadPanel_GameTypeName(cgs.gametype)), 0, 0, button->font->style, button->font->font); }
void CG_DrawMapEntity(mapEntityData_t *mEnt, float x, float y, float w, float h, int mEntFilter, mapScissor_t *scissor, qboolean interactive, snapshot_t *snap, int icon_size) { int j = 1; qhandle_t pic; clientInfo_t *ci; bg_playerclass_t *classInfo; centity_t *cent; const char *name; vec4_t c_clr = { 1.f, 1.f, 1.f, 1.f }; vec2_t icon_extends, icon_pos, string_pos = { 0 }; int customimage = 0; oidInfo_t *oidInfo = NULL; switch (mEnt->type) { case ME_PLAYER_DISGUISED: case ME_PLAYER_REVIVE: case ME_PLAYER: ci = &cgs.clientinfo[mEnt->data]; if (!ci->infoValid) { return; } if (ci->team == TEAM_AXIS) { if (mEntFilter & CC_FILTER_AXIS) { return; } } else if (ci->team == TEAM_ALLIES) { if (mEntFilter & CC_FILTER_ALLIES) { return; } } else { return; } cent = &cg_entities[mEnt->data]; if (mEnt->type == ME_PLAYER_DISGUISED && !(cent->currentState.powerups & (1 << PW_OPS_DISGUISED))) { return; } classInfo = CG_PlayerClassForClientinfo(ci, cent); // For these, if availaible, ignore the coordinate data and grab the most up to date pvs data if (cent - cg_entities == cg.clientNum) { if (!scissor) { mEnt->transformed[0] = ((cg.predictedPlayerEntity.lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((cg.predictedPlayerEntity.lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((cg.predictedPlayerEntity.lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((cg.predictedPlayerEntity.lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } mEnt->yaw = cg.predictedPlayerState.viewangles[YAW]; } else if (ci->team == snap->ps.persistant[PERS_TEAM] && cent->currentValid) { if (!scissor) { mEnt->transformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } mEnt->yaw = cent->lerpAngles[YAW]; } else { // only see revivables for own team, duh :) if (mEnt->type == ME_PLAYER_REVIVE) { return; } } // now check to see if the entity is within our clip region if (scissor && CG_ScissorEntIsCulled(mEnt, scissor)) { return; } if (cgs.ccLayers) { if (CG_CurLayerForZ(mEnt->z) != cgs.ccSelectedLayer) { return; } } if (scissor) { icon_pos[0] = mEnt->automapTransformed[0] - scissor->tl[0] + x - (icon_size * (scissor->zoomFactor / 5.159)); icon_pos[1] = mEnt->automapTransformed[1] - scissor->tl[1] + y - (icon_size * (scissor->zoomFactor / 5.159)); } else { icon_pos[0] = x + mEnt->transformed[0] - icon_size; icon_pos[1] = y + mEnt->transformed[1] - icon_size; string_pos[0] = x + mEnt->transformed[0]; string_pos[1] = y + mEnt->transformed[1] + icon_size; } icon_extends[0] = 2 * icon_size; icon_extends[1] = 2 * icon_size; if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } if (mEnt->type == ME_PLAYER_REVIVE) { float msec; vec4_t reviveClr = { 1.f, 1.f, 1.f, 1.f }; if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS) { msec = (cg_redlimbotime.integer - (cg.time % cg_redlimbotime.integer)) / (float)cg_redlimbotime.integer; } else if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES) { msec = (cg_bluelimbotime.integer - (cg.time % cg_bluelimbotime.integer)) / (float)cg_bluelimbotime.integer; } else { msec = 0; } reviveClr[3] = .5f + .5f * ((sin(sqrt(msec) * 25 * 2 * M_PI) + 1) * .5f); trap_R_SetColor(reviveClr); CG_DrawPic(icon_pos[0] + 3, icon_pos[1] + 3, icon_extends[0] - 3, icon_extends[1] - 3, cgs.media.medicIcon); trap_R_SetColor(NULL); } else { if (cg.clientNum == mEnt->data) { if (ci->ccSelected) { trap_R_SetColor(colorRed); } else { trap_R_SetColor(colorYellow); } CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], cgs.media.ccPlayerHighlight); trap_R_SetColor(NULL); if (cg.predictedPlayerEntity.voiceChatSpriteTime > cg.time) { CG_DrawPic(icon_pos[0] + 12, icon_pos[1], icon_extends[0] * 0.5f, icon_extends[1] * 0.5f, cg.predictedPlayerEntity.voiceChatSprite); } } else if (mEnt->type == ME_PLAYER_DISGUISED) { trap_R_SetColor(colorOrange); CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], cgs.media.ccPlayerHighlight); trap_R_SetColor(NULL); } else if (/*!(cgs.ccFilter & CC_FILTER_BUDDIES) &&*/ CG_IsOnSameFireteam(cg.clientNum, mEnt->data)) { if (ci->ccSelected) { trap_R_SetColor(colorRed); } CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], cgs.media.ccPlayerHighlight); trap_R_SetColor(NULL); if (!scissor) { CG_Text_Paint_Ext(string_pos[0], string_pos[1], 0.2f, 0.2f, colorWhite, ci->name, 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } if (cent->voiceChatSpriteTime > cg.time) { CG_DrawPic(icon_pos[0] + 12, icon_pos[1], icon_extends[0] * 0.5f, icon_extends[1] * 0.5f, cent->voiceChatSprite); } } else if (ci->team == snap->ps.persistant[PERS_TEAM]) { if (ci->ccSelected) { trap_R_SetColor(colorRed); CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], cgs.media.ccPlayerHighlight); trap_R_SetColor(NULL); } if (cent->voiceChatSpriteTime > cg.time) { CG_DrawPic(icon_pos[0] + 12, icon_pos[1], icon_extends[0] * 0.5f, icon_extends[1] * 0.5f, cent->voiceChatSprite); } } c_clr[3] = 1.0f; trap_R_SetColor(c_clr); CG_DrawPic(icon_pos[0], icon_pos[1], icon_extends[0], icon_extends[1], classInfo->icon); CG_DrawRotatedPic(icon_pos[0] - 1, icon_pos[1] - 1, icon_extends[0] + 2, icon_extends[1] + 2, classInfo->arrow, (0.5 - (mEnt->yaw - 180.f) / 360.f)); trap_R_SetColor(NULL); } return; case ME_CONSTRUCT: case ME_DESTRUCT: case ME_DESTRUCT_2: case ME_TANK: case ME_TANK_DEAD: case ME_COMMANDMAP_MARKER: cent = NULL; if (mEnt->type == ME_TANK || mEnt->type == ME_TANK_DEAD) { oidInfo = &cgs.oidInfo[mEnt->data]; for (j = 0; j < cg.snap->numEntities; j++) { if (cg.snap->entities[j].eType == ET_OID_TRIGGER && cg.snap->entities[j].teamNum == mEnt->data) { cent = &cg_entities[cg.snap->entities[j].number]; if (!scissor) { mEnt->transformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } break; } } } else if (mEnt->type == ME_CONSTRUCT || mEnt->type == ME_DESTRUCT || mEnt->type == ME_DESTRUCT_2) { cent = &cg_entities[mEnt->data]; oidInfo = &cgs.oidInfo[cent->currentState.modelindex2]; if (!scissor) { mEnt->transformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((cent->lerpOrigin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((cent->lerpOrigin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } } else if (mEnt->type == ME_COMMANDMAP_MARKER) { oidInfo = &cgs.oidInfo[mEnt->data]; if (!scissor) { mEnt->transformed[0] = ((oidInfo->origin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w; mEnt->transformed[1] = ((oidInfo->origin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h; } else { mEnt->automapTransformed[0] = ((oidInfo->origin[0] - cg.mapcoordsMins[0]) * cg.mapcoordsScale[0]) * w * scissor->zoomFactor; mEnt->automapTransformed[1] = ((oidInfo->origin[1] - cg.mapcoordsMins[1]) * cg.mapcoordsScale[1]) * h * scissor->zoomFactor; } } // now check to see if the entity is within our clip region if (scissor && CG_ScissorEntIsCulled(mEnt, scissor)) { return; } if (cgs.ccLayers) { if (CG_CurLayerForZ(mEnt->z) != cgs.ccSelectedLayer) { return; } } if (oidInfo) { customimage = mEnt->team == TEAM_AXIS ? oidInfo->customimageaxis : oidInfo->customimageallies; } if (mEnt->type == ME_CONSTRUCT) { if (mEntFilter & CC_FILTER_CONSTRUCTIONS) { return; } pic = mEnt->team == TEAM_AXIS ? cgs.media.ccConstructIcon[0] : cgs.media.ccConstructIcon[1]; } else if (mEnt->type == ME_TANK) { if (mEntFilter & CC_FILTER_OBJECTIVES) { return; } pic = cgs.media.ccTankIcon; } else if (mEnt->type == ME_TANK_DEAD) { if (mEntFilter & CC_FILTER_OBJECTIVES) { return; } pic = cgs.media.ccTankIcon; trap_R_SetColor(colorRed); } else if (mEnt->type == ME_COMMANDMAP_MARKER) { pic = 0; } else if (mEnt->type == ME_DESTRUCT_2) { pic = 0; } else { if (mEntFilter & CC_FILTER_DESTRUCTIONS) { return; } pic = mEnt->team == TEAM_AXIS ? cgs.media.ccDestructIcon[cent->currentState.effect1Time][0] : cgs.media.ccDestructIcon[cent->currentState.effect1Time][1]; } { int info = 0; if (oidInfo) { info = oidInfo->spawnflags; } if (info & (1 << 4)) { if (mEntFilter & CC_FILTER_OBJECTIVES) { return; } } if (info & (1 << 5)) { if (mEntFilter & CC_FILTER_HACABINETS) { return; } } if (info & (1 << 6)) { if (mEnt->type == ME_DESTRUCT_2) { pic = mEnt->team == TEAM_AXIS ? cgs.media.ccCmdPost[0] : cgs.media.ccCmdPost[1]; } if (mEntFilter & CC_FILTER_CMDPOST) { return; } } } if (customimage) { pic = customimage; } if (scissor) { icon_pos[0] = mEnt->automapTransformed[0] - scissor->tl[0] + x; icon_pos[1] = mEnt->automapTransformed[1] - scissor->tl[1] + y; } else { icon_pos[0] = x + mEnt->transformed[0]; icon_pos[1] = y + mEnt->transformed[1]; } #define CONST_ICON_NORMAL_SIZE 32.f #define CONST_ICON_EXPANDED_SIZE 48.f if (interactive && !expanded && BG_RectContainsPoint(x + mEnt->transformed[0] - (CONST_ICON_NORMAL_SIZE * 0.5f), y + mEnt->transformed[1] - (CONST_ICON_NORMAL_SIZE * 0.5f), CONST_ICON_NORMAL_SIZE, CONST_ICON_NORMAL_SIZE, cgDC.cursorx, cgDC.cursory)) { float w; icon_extends[0] = CONST_ICON_EXPANDED_SIZE; icon_extends[1] = CONST_ICON_EXPANDED_SIZE; if (mEnt->type == ME_TANK_DEAD || mEnt->type == ME_TANK) { icon_extends[1] *= 0.5f; } if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } CG_DrawPic(icon_pos[0] - (icon_extends[0] * 0.5f), icon_pos[1] - (icon_extends[1] * 0.5f), icon_extends[0], icon_extends[1], pic); if (oidInfo) { name = oidInfo->name; } else { name = va("%i", j); } w = CG_Text_Width_Ext(name, 0.2f, 0, &cgs.media.limboFont2); CG_CommandMap_SetHighlightText(name, icon_pos[0] - (w * 0.5f), icon_pos[1] - 8); } else if (interactive && (mEnt->yaw & 0xFF) & (1 << cgs.ccSelectedObjective)) { float scalesize; int time = cg.time % 1400; if (time <= 700) { scalesize = 12 * (time) / 700.f; } else { scalesize = 12 * (1 - ((time - 700) / 700.f)); } icon_extends[0] = CONST_ICON_NORMAL_SIZE + scalesize; icon_extends[1] = CONST_ICON_NORMAL_SIZE + scalesize; if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } if (mEnt->type == ME_TANK_DEAD || mEnt->type == ME_TANK) { icon_extends[1] *= 0.5f; } CG_DrawPic(icon_pos[0] - (icon_extends[0] * 0.5f), icon_pos[1] - (icon_extends[1] * 0.5f), icon_extends[0], icon_extends[1], pic); } else { icon_extends[0] = CONST_ICON_NORMAL_SIZE; icon_extends[1] = CONST_ICON_NORMAL_SIZE; if (mEnt->type == ME_TANK_DEAD || mEnt->type == ME_TANK) { icon_extends[1] *= 0.5f; } if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } CG_DrawPic(icon_pos[0] - (icon_extends[0] * 0.5f), icon_pos[1] - (icon_extends[1] * 0.5f), icon_extends[0], icon_extends[1], pic); } trap_R_SetColor(NULL); return; case ME_LANDMINE: /* if(mEntFilter & CC_FILTER_LANDMINES) { continue; }*/ // now check to see if the entity is within our clip region if (scissor && CG_ScissorEntIsCulled(mEnt, scissor)) { return; } if (cgs.ccLayers) { if (CG_CurLayerForZ(mEnt->z) != cgs.ccSelectedLayer) { return; } } if (mEnt->data == TEAM_AXIS) { pic = cgs.media.commandCentreAxisMineShader; } else // TEAM_ALLIES { pic = cgs.media.commandCentreAlliedMineShader; } c_clr[3] = 1.0f; if (scissor) { icon_pos[0] = mEnt->automapTransformed[0] - scissor->tl[0] + x; icon_pos[1] = mEnt->automapTransformed[1] - scissor->tl[1] + y; } else { icon_pos[0] = x + mEnt->transformed[0]; icon_pos[1] = y + mEnt->transformed[1]; } icon_extends[0] = 12; icon_extends[1] = 12; if (scissor) { icon_extends[0] *= (scissor->zoomFactor / 5.159); icon_extends[1] *= (scissor->zoomFactor / 5.159); } else { icon_extends[0] *= cgs.ccZoomFactor; icon_extends[1] *= cgs.ccZoomFactor; } trap_R_SetColor(c_clr); CG_DrawPic(icon_pos[0] - icon_extends[0] * 0.5f, icon_pos[1] - icon_extends[1] * 0.5f, icon_extends[0], icon_extends[1], pic); trap_R_SetColor(NULL); j++; return; default: return; } }
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_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_Fireteams_MenuText_Draw(panel_button_t *button) { float y = button->rect.y; int i; switch (cgs.ftMenuMode) { case 0: if (cgs.ftMenuPos == -1) { for (i = 0; ftMenuRootStrings[i]; i++) { const char *str; if (i < 5) { if (!CG_FireteamHasClass(i, qtrue)) { continue; } } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, ftMenuRootStrings[i]); } else { str = va("%s. %s", ftMenuRootStringsAlphachars[i], ftMenuRootStrings[i]); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } } else { if (cgs.ftMenuPos < 0 || cgs.ftMenuPos > 4) { return; } else { const char **strings = ftMenuStrings[cgs.ftMenuPos]; for (i = 0; strings[i]; i++) { const char *str; if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, strings[i]); } else { str = va("%s. %s", (ftMenuStringsAlphachars[cgs.ftMenuPos])[i], strings[i]); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } } } break; case 1: if (!CG_IsOnFireteam(cg.clientNum)) { for (i = 0; ftOffMenuList[i]; i++) { const char *str; if (i == 0 && !CG_CountFireteamsByTeam(cgs.clientinfo[cg.clientNum].team)) { continue; } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, ftOffMenuList[i]); } else { str = va("%s. %s", ftOffMenuListAlphachars[i], ftOffMenuList[i]); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } } else { if (!CG_IsFireTeamLeader(cg.clientNum)) { for (i = 0; ftOnMenuList[i]; i++) { const char *str; if (i == 0 && !CG_CountPlayersNF()) { continue; } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, ftOnMenuList[i]); } else { str = va("%s. %s", ftOnMenuListAlphachars[i], ftOnMenuList[i]); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } } else { for (i = 0; ftLeaderMenuList[i]; i++) { const char *str; if (i == 2 && !CG_CountPlayersNF()) { continue; } if ((i == 3 || i == 4) && !CG_CountPlayersSF()) { continue; } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, ftLeaderMenuList[i]); } else { str = va("%s. %s", ftLeaderMenuListAlphachars[i], ftLeaderMenuList[i]); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } } } break; case 2: if (!CG_CountFireteamsByTeam(cgs.clientinfo[cg.clientNum].team) || CG_IsOnFireteam(cg.clientNum)) { cgs.ftMenuMode = 1; break; } CG_DrawFireteamsByTeam(button, cgs.clientinfo[cg.clientNum].team); break; case 3: if (!CG_CountPlayersNF()) { cgs.ftMenuMode = 1; break; } CG_DrawPlayerNF(button, &cgs.ftMenuModeEx); break; case 4: switch (cgs.ftMenuPos) { case 2: if (!CG_CountPlayersNF()) { cgs.ftMenuMode = 1; break; } CG_DrawPlayerNF(button, &cgs.ftMenuModeEx); break; case 3: case 4: if (!CG_CountPlayersSF()) { cgs.ftMenuMode = 1; break; } CG_DrawPlayerSF(button, &cgs.ftMenuModeEx); break; } break; } }
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_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_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); } }
// 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(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); } }