qboolean CG_FireteamHasClass(int classnum, qboolean selectedonly) { fireteamData_t *ft; int i; ft = CG_IsOnFireteam(cg.clientNum); if (!ft) { return qfalse; } for (i = 0; i < MAX_CLIENTS; i++) { if (!cgs.clientinfo[i].infoValid) { continue; } if (ft != CG_IsOnFireteam(i)) { continue; } if (cgs.clientinfo[i].cls != classnum) { continue; } if (selectedonly && !cgs.clientinfo[i].selected) { continue; } return qtrue; } return qfalse; }
// Client, not sorted by rank, on CLIENT'S fireteam clientInfo_t *CG_FireTeamPlayerForPosition(int pos, int max) { int i, cnt = 0; fireteamData_t *f = CG_IsOnFireteam(cg.clientNum); if (!f) { return NULL; } for (i = 0; i < MAX_CLIENTS && cnt < max; i++) { if (cgs.clientinfo[i].infoValid && cgs.clientinfo[cg.clientNum].team == cgs.clientinfo[i].team) { if (!(f == CG_IsOnFireteam(i))) { continue; } if (cnt == pos) { return &cgs.clientinfo[i]; } cnt++; } } return NULL; }
// Client, sorted by rank, on CLIENT'S fireteam clientInfo_t *CG_SortedFireTeamPlayerForPosition(int pos) { int i; int cnt = 0; fireteamData_t *f = CG_IsOnFireteam(cg.clientNum); if (!f) { return NULL; } for (i = 0; i < cgs.maxclients && cnt < MAX_FIRETEAM_MEMBERS; i++) { if (!(f == CG_IsOnFireteam(sortedFireTeamClients[i]))) { return NULL; } if (cnt == pos) { return &cgs.clientinfo[sortedFireTeamClients[i]]; } cnt++; } return NULL; }
// Fireteam that both specified clients are on, if they both are on the same team fireteamData_t *CG_IsOnSameFireteam(int clientNum, int clientNum2) { if (CG_IsOnFireteam(clientNum) == CG_IsOnFireteam(clientNum2)) { return CG_IsOnFireteam(clientNum); } return NULL; }
int CG_CountPlayersSF(void) { int i, cnt = 0; for (i = 0; i < MAX_CLIENTS; i++) { if (i == cg.clientNum) { continue; } if (!cgs.clientinfo[i].infoValid) { continue; } if (cgs.clientinfo[i].team != cgs.clientinfo[cg.clientNum].team) { continue; } if (CG_IsOnFireteam(i) != CG_IsOnFireteam(cg.clientNum)) { continue; } cnt++; } return cnt; }
// Client, sorted by rank, on CLIENT'S fireteam clientInfo_t *CG_SortedFireTeamPlayerForPosition(int pos, int max) { int i, cnt = 0; fireteamData_t *f = CG_IsOnFireteam(cg.clientNum); if (!f) { return NULL; } for (i = 0; i < MAX_CLIENTS && cnt < max; i++) { if (!(f == CG_IsOnFireteam(sortedFireTeamClients[i]))) { return NULL; } if (cnt == pos) { return &cgs.clientinfo[sortedFireTeamClients[i]]; } cnt++; } return NULL; }
int CG_PlayerNFFromPos(int pos, int *pageofs) { int x, i; if (!CG_IsOnFireteam(cg.clientNum)) { *pageofs = 0; return -1; } x = CG_CountPlayersNF(); if (x < ((*pageofs) * 8)) { *pageofs = 0; } x = 0; for (i = 0; i < MAX_CLIENTS; i++) { if (i == cg.clientNum) { continue; } if (!cgs.clientinfo[i].infoValid) { continue; } if (cgs.clientinfo[i].team != cgs.clientinfo[cg.clientNum].team) { continue; } if (CG_IsOnFireteam(i)) { continue; } if (x >= ((*pageofs) * 8) && x < ((*pageofs + 1) * 8)) { int ofs = x - ((*pageofs) * 8); if (pos == ofs) { return i; } } x++; } return -1; }
/* ===================== CG_DrawUpperRight ===================== */ void CG_DrawUpperRight(void) { int y = 152; // 20 + 100 + 32; if (cg_drawFireteamOverlay.integer && CG_IsOnFireteam(cg.clientNum)) { CG_DrawFireTeamOverlay(&activehud->fireteam.location); } if (!(cg.snap->ps.pm_flags & PMF_LIMBO) && (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR) && (cgs.autoMapExpanded || (!cgs.autoMapExpanded && (cg.time - cgs.autoMapExpandTime < 250.f)))) { return; } if (cg_drawRoundTimer.integer) { y = CG_DrawTimer(y); } if (cg_drawFPS.integer) { y = CG_DrawFPS(y); } if (cg_drawSnapshot.integer) { y = CG_DrawSnapshot(y); } }
static void CG_QuickFireteams_f( void ) { if( cg.showFireteamMenu ) { if( cgs.ftMenuMode == 0 ) { CG_EventHandling( CGAME_EVENT_NONE, qfalse ); } else { cgs.ftMenuMode = 0; } } else if( CG_IsOnFireteam( cg.clientNum ) ) { CG_EventHandling( CGAME_EVENT_FIRETEAMMSG, qfalse ); cgs.ftMenuMode = 0; } }
// Fireteam that specified client is leader of, or NULL if none fireteamData_t* CG_IsFireTeamLeader( int clientNum ) { fireteamData_t* f; if(!(f = CG_IsOnFireteam(clientNum))) { return NULL; } if(f->leader != clientNum) { return NULL; } return f ; }
// Client, not on a fireteam, not sorted, but on your team clientInfo_t* CG_ClientInfoForPosition(int pos, int max) { int i, cnt = 0; for(i = 0; i < MAX_CLIENTS && cnt < max; i++) { if(cg.clientNum != i && cgs.clientinfo[i].infoValid && !CG_IsOnFireteam( i ) && cgs.clientinfo[cg.clientNum].team == cgs.clientinfo[i].team ) { if(cnt == pos) { return &cgs.clientinfo[i]; } cnt++; } } return NULL; }
static void CG_SelectBuddy_f( void ) { int pos = atoi( CG_Argv( 1 ) ); int i; clientInfo_t* ci; if( !CG_IsOnFireteam( cg.clientNum ) ) { return; // Gordon: we aren't a leader, so dont allow selection } // Gordon: // 0 - 5 = select that person // -1 = none // -2 = all switch( pos ) { case -1: for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { ci = CG_SortedFireTeamPlayerForPosition( i ); if( !ci ) { return; // there was no-one in this position } ci->selected = qfalse; } return; case -2: for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { ci = CG_SortedFireTeamPlayerForPosition( i ); if(!ci) { return; // there was no-one in this position } ci->selected = qtrue; } return; } if( pos >= MAX_FIRETEAM_MEMBERS || pos < 0) return; ci = CG_SortedFireTeamPlayerForPosition( pos ); if( !ci ) { return; // there was no-one in this position } ci->selected ^= qtrue; }
static void CG_SelectBuddy_f(void) { int pos = atoi(CG_Argv(1)); int i; clientInfo_t *ci; // 0 - 7 = select that person // -1 = none // -2 = all switch (pos) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: if (!CG_IsOnFireteam(cg.clientNum)) { break; // we aren't a leader, so dont allow selection } ci = CG_SortedFireTeamPlayerForPosition(pos); if (!ci) { break; // there was no-one in this position } ci->selected ^= qtrue; break; case -1: if (!CG_IsOnFireteam(cg.clientNum)) { break; // we aren't a leader, so dont allow selection } for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { ci = CG_SortedFireTeamPlayerForPosition(i); if (!ci) { break; // there was no-one in this position } ci->selected = qfalse; } break; case -2: if (!CG_IsOnFireteam(cg.clientNum)) { break; // we aren't a leader, so dont allow selection } for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { ci = CG_SortedFireTeamPlayerForPosition(i); if (!ci) { break; // there was no-one in this position } ci->selected = qtrue; } break; } }
// Parses fireteam servercommand void CG_ParseFireteams() { int i, j; char *s; const char *p; int clnts[2]; qboolean onFireteam2; qboolean isLeader2; // qboolean onFireteam = CG_IsOnFireteam( cg.clientNum ) ? qtrue : qfalse; // qboolean isLeader = CG_IsFireTeamLeader( cg.clientNum ) ? qtrue : qfalse; for (i = 0; i < MAX_CLIENTS; i++) { cgs.clientinfo[i].fireteamData = NULL; } for (i = 0; i < MAX_FIRETEAMS; i++) { char hexbuffer[11] = "0x00000000"; p = CG_ConfigString(CS_FIRETEAMS + i); /* s = Info_ValueForKey(p, "n"); if(!s || !*s) { cg.fireTeams[i].inuse = qfalse; continue; } else { cg.fireTeams[i].inuse = qtrue; }*/ // Q_strncpyz(cg.fireTeams[i].name, s, 32); // CG_Printf("Fireteam: %s\n", cg.fireTeams[i].name); j = atoi(Info_ValueForKey(p, "id")); if (j == -1) { cg.fireTeams[i].inuse = qfalse; continue; } else { cg.fireTeams[i].inuse = qtrue; cg.fireTeams[i].ident = j; } s = Info_ValueForKey(p, "l"); cg.fireTeams[i].leader = atoi(s); s = Info_ValueForKey(p, "c"); Q_strncpyz(hexbuffer + 2, s, 9); sscanf(hexbuffer, "%x", &clnts[1]); Q_strncpyz(hexbuffer + 2, s + 8, 9); sscanf(hexbuffer, "%x", &clnts[0]); for (j = 0; j < MAX_CLIENTS; j++) { if (COM_BitCheck(clnts, j)) { cg.fireTeams[i].joinOrder[j] = qtrue; cgs.clientinfo[j].fireteamData = &cg.fireTeams[i]; // CG_Printf("%s\n", cgs.clientinfo[j].name); } else { cg.fireTeams[i].joinOrder[j] = qfalse; } } } CG_SortClientFireteam(); onFireteam2 = CG_IsOnFireteam(cg.clientNum) ? qtrue : qfalse; isLeader2 = CG_IsFireTeamLeader(cg.clientNum) ? qtrue : qfalse; }
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; } }
// FIXME: add more options to shorten this box void CG_DrawFireTeamOverlay(rectDef_t *rect) { int x = rect->x; int y = rect->y + 1; // +1, jitter it into place in 1024 :) int i; int boxWidth = 106; int bestWidth = -1; char buffer[64]; float h = 16; // 12 + 2 + 2 clientInfo_t *ci = NULL; fireteamData_t *f = NULL; char *locStr[MAX_FIRETEAM_MEMBERS]; int locwidth; int namewidth; vec3_t origin; int curWeap; // assign fireteam data, and early out if not on one if (!(f = CG_IsOnFireteam(cg.clientNum))) { return; } memset(locStr, 0, sizeof(locStr)); // First get name and location width, also store location names for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { ci = CG_SortedFireTeamPlayerForPosition(i); // Make sure it's valid if (!ci) { break; } origin[0] = ci->location[0]; origin[1] = ci->location[1]; locStr[i] = CG_BuildLocationString(ci->clientNum, origin, LOC_FTEAM); if (!locStr[i][1] || !*locStr[i]) { locStr[i] = ""; } locwidth = CG_Text_Width_Ext(locStr[i], 0.2f, 0, &cgs.media.limboFont2); //if ( cg_fixedFTeamSize.integer ) { // namewidth = 102; //} //else { namewidth = CG_Text_Width_Ext(ci->name, 0.2f, 17, &cgs.media.limboFont2); if (ci->health == 0) { namewidth += 7; } //} if ((locwidth + namewidth) > bestWidth) { bestWidth = locwidth + namewidth; } h += 12.f; } boxWidth += bestWidth; CG_DrawRect(x, y, boxWidth, h, 1, borderColor); CG_FillRect(x + 1, y + 1, boxWidth - 2, h - 2, bgColor); x += 2; y += 2; CG_FillRect(x, y, boxWidth - 4, 12, clr1); Com_sprintf(buffer, 64, "Fireteam: %s", bg_fireteamNames[f->ident]); Q_strupr(buffer); CG_Text_Paint_Ext(x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.limboFont1); x += 2; for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { y += FT_BAR_HEIGHT + FT_BAR_YSPACING; x = rect->x + 2; // Grab a pointer to the current player ci = CG_SortedFireTeamPlayerForPosition(i); // Make sure it's valid if (!ci) { break; } // hilight selected players if (ci->selected) { CG_FillRect(x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr3); } else { CG_FillRect(x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr2); } x += 4; // draw class icon in fireteam overlay CG_DrawPic(x, y, 12, 12, cgs.media.skillPics[SkillNumForClass(ci->cls)]); x += 14; // draw the mute-icon in the fireteam overlay.. //if ( ci->muted ) { // CG_DrawPic( x, y, 12, 12, cgs.media.muteIcon ); // x += 14; //} else if // ..or else draw objective icon (if they are carrying one) in fireteam overlay.. if (ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG))) { CG_DrawPic(x, y, 12, 12, cgs.media.objectiveShader); x += 14; } // core: ... or else draw the disguised icon in fireteam overlay.. else if (ci->powerups & (1 << PW_OPS_DISGUISED)) { CG_DrawPic(x, y, 12, 12, ci->team == TEAM_AXIS ? cgs.media.alliedUniformShader : cgs.media.axisUniformShader); x += 14; } // ..otherwise draw rank icon in fireteam overlay //else { // if (ci->rank > 0) CG_DrawPic( x, y, 12, 12, rankicons[ ci->rank ][ ci->team == TEAM_AXIS ? 1 : 0 ][0].shader ); // x += 14; //} // draw the player's name CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->name, 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); // add space //if ( cg_fixedFTeamSize.integer ) // x += 115; //else x += 14 + CG_Text_Width_Ext(ci->name, 0.2f, 17, &cgs.media.limboFont2); // draw the player's weapon icon curWeap = cg_entities[ci->clientNum].currentState.weapon; if (cg_weapons[curWeap].weaponIcon[0]) // jaquboss - do not try to draw nothing { CG_DrawPic(x, y, weaponIconScale(curWeap) * 10, 10, cg_weapons[curWeap].weaponIcon[0]); } else if (cg_weapons[curWeap].weaponIcon[1]) { CG_DrawPic(x, y, weaponIconScale(curWeap) * 10, 10, cg_weapons[curWeap].weaponIcon[1]); } x += 24; if (ci->health > 80) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } else if (ci->health > 0) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, va("%i", ci->health < 0 ? 0 : ci->health), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } else if (ci->health == 0) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, ((cg.time % 500) > 250) ? colorWhite : colorRed, "*", 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); x += 7; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, ((cg.time % 500) > 250) ? colorRed : colorWhite, "0", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); x -= 7; } else { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorRed, "0", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } // Set hard limit on width x += 24; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, locStr[i], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.limboFont2); } }
void CG_DrawFireTeamOverlay(rectDef_t *rect) { int x = rect->x; int y = rect->y + 1; // +1, jitter it into place in 1024 :) float h; clientInfo_t *ci = NULL; char buffer[64]; fireteamData_t *f; 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); } }
qboolean CG_FireteamCheckExecKey(int key, qboolean doaction) { if (key == K_ESCAPE) { return qtrue; } if ((key & K_CHAR_FLAG)) { return qfalse; } key &= ~K_CHAR_FLAG; switch (cgs.ftMenuMode) { case 0: if (cgs.ftMenuPos == -1) { if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { int i = ((key - '0') + 9) % 10; if (i < 5) { if (!CG_FireteamHasClass(i, qtrue)) { return qfalse; } } if (i > 7) { return qfalse; } if (doaction) { if (i < 5) { cgs.ftMenuPos = i; } else if (i == 5) { CG_QuickFireteamMessage_f(); } else { trap_SendClientCommand(va ("vsay_buddy -1 %s %s", CG_BuildSelectedFirteamString(), ftMenuRootStringsMsg[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } } return qtrue; } } else { int i; if (key >= 'a' || key <= 'z') { for (i = 0; ftMenuRootStrings[i]; i++) { if (key == tolower(*ftMenuRootStringsAlphachars[i])) { if (i < 5) { if (!CG_FireteamHasClass(i, qtrue)) { return qfalse; } } if (doaction) { if (i < 5) { cgs.ftMenuPos = i; } else if (i == 5) { CG_QuickFireteamMessage_f(); } else { trap_SendClientCommand(va ("vsay_buddy -1 %s %s", CG_BuildSelectedFirteamString(), ftMenuRootStringsMsg[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } } return qtrue; } } } } } else { if (cgs.ftMenuPos < 0 || cgs.ftMenuPos > 4) { return qfalse; } if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { int i = ((key - '0') + 9) % 10; int x; const char **strings = ftMenuStrings[cgs.ftMenuPos]; for (x = 0; strings[x]; x++) { if (x == i) { if (doaction) { trap_SendClientCommand(va ("vsay_buddy %i %s %s", cgs.ftMenuPos, CG_BuildSelectedFirteamString(), (ftMenuStringsMsg[cgs.ftMenuPos])[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } else { int i; const char **strings = ftMenuStrings[cgs.ftMenuPos]; if (key >= 'a' || key <= 'z') { for (i = 0; strings[i]; i++) { if (key == tolower(*ftMenuStringsAlphachars[cgs.ftMenuPos][i])) { if (doaction) { trap_SendClientCommand(va ("vsay_buddy %i %s %s", cgs.ftMenuPos, CG_BuildSelectedFirteamString(), (ftMenuStringsMsg[cgs.ftMenuPos])[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } } break; case 1: { int i = -1, x; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { const char **strings; if (!CG_IsOnFireteam(cg.clientNum)) { strings = ftOffMenuListAlphachars; } else { if (!CG_IsFireTeamLeader(cg.clientNum)) { strings = ftOnMenuListAlphachars; } else { strings = ftLeaderMenuListAlphachars; } } if (key >= 'a' || key <= 'z') { for (x = 0; strings[x]; x++) { if (key == tolower(*strings[x])) { i = x; break; } } } } if (i == -1) { break; } if (!CG_IsOnFireteam(cg.clientNum)) { if (i >= 2) { break; } if (i == 0 && !CG_CountFireteamsByTeam(cgs.clientinfo[cg.clientNum].team)) { return qfalse; } if (doaction) { if (i == 1) { trap_SendConsoleCommand("fireteam create\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 2; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } else { if (!CG_IsFireTeamLeader(cg.clientNum)) { if (i >= 2) { break; } if (i == 0 && !CG_CountPlayersNF()) { break; } if (doaction) { if (i == 1) { trap_SendConsoleCommand("fireteam leave\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 3; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } else { if (i >= 5) { break; } if (i == 2 && !CG_CountPlayersNF()) { break; } if ((i == 3 || i == 4) && !CG_CountPlayersSF()) { break; } if (doaction) { if (i == 0) { trap_SendConsoleCommand("fireteam disband\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else if (i == 1) { trap_SendConsoleCommand("fireteam leave\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 4; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } } } break; case 2: { int i; for (i = 0; i < MAX_FIRETEAMS; i++) { if (!cg.fireTeams[i].inuse) { continue; } if (cgs.clientinfo[cg.fireTeams[i].leader].team != cgs.clientinfo[cg.clientNum].team) { continue; } if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { if (((key - '0') + 9) % 10 == cg.fireTeams[i].ident) { if (doaction) { trap_SendConsoleCommand(va("fireteam apply %i", i + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } else { if (key >= 'a' || key <= 'z') { if (key - 'a' == cg.fireTeams[i].ident) { if (doaction) { trap_SendConsoleCommand(va("fireteam apply %i", i + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } } break; case 3: { int i = -1, x; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { if (key >= 'a' || key <= 'g') { i = key - 'a'; } if (key == 'n') { i = 9; } if (key == 'p') { i = 0; } } if (i == -1) { break; } if (CG_CountPlayersNF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 0) { cgs.ftMenuModeEx++; } } if (cgs.ftMenuModeEx) { if (i == 9) { cgs.ftMenuModeEx--; } } x = CG_PlayerNFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { trap_SendConsoleCommand(va("fireteam propose %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } break; } break; case 4: { int i = -1, x; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { if (key >= 'a' || key <= 'g') { i = key - 'a'; } if (key == 'n') { i = 9; } if (key == 'p') { i = 8; } } if (i == -1) { break; } switch (cgs.ftMenuPos) { case 2: if (CG_CountPlayersNF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 9) { if (doaction) { cgs.ftMenuModeEx++; } return qtrue; } } if (cgs.ftMenuModeEx) { if (i == 8) { if (doaction) { cgs.ftMenuModeEx--; } return qtrue; } } x = CG_PlayerNFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { trap_SendConsoleCommand(va("fireteam invite %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } break; case 3: case 4: if (CG_CountPlayersSF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 0) { cgs.ftMenuModeEx++; } } if (cgs.ftMenuModeEx) { if (i == 9) { cgs.ftMenuModeEx--; } } x = CG_PlayerSFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { switch (cgs.ftMenuPos) { case 4: trap_SendConsoleCommand(va("fireteam warn %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); break; case 3: trap_SendConsoleCommand(va("fireteam kick %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); break; } } return qtrue; } break; } } break; } return qfalse; }
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); } } }
/** * @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_DrawFireTeamOverlay( rectDef_t* rect ) { int x = rect->x; int y = rect->y + 1; // +1, jitter it into place in 1024 :) int boxWidth = 204; int bestWidth = -1; char *locStr[MAX_FIRETEAM_MEMBERS]; vec2_t loc; float h; clientInfo_t* ci = NULL; char buffer[64]; fireteamData_t* f = NULL; int i; vec4_t clr1 = { .16f, .2f, .17f, .8f }; vec4_t clr2 = { 0.f, 0.f, 0.f, .2f }; vec4_t clr3 = { 0.25f, 0.f, 0.f, 153/255.f }; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; vec4_t bgColor = { 0.0f, 0.0f, 0.0f, 0.6f }; // window vec4_t borderColor = { 0.5f, 0.5f, 0.5f, 0.5f }; // window centity_t* cent; bgColor[3] = cg_fireteamAlpha.value; if(cg.hudEditor.showHudEditor) { //draw a fake fireteam box... CG_DrawFakeFireTeamOverlay(rect); return; } else if(!(f = CG_IsOnFireteam( cg.clientNum ))) { return; } h = 12 + 2 + 2; for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { int locwidth; vec3_t origin; ci = CG_SortedFireTeamPlayerForPosition( i ); if(!ci) { break; } h += FT_BAR_HEIGHT + FT_BAR_YSPACING; loc[0] = ci->location[0]; loc[1] = ci->location[1]; if(cg_locations.integer > 0) { qboolean locValid = qtrue; cent = &cg_entities[ci->clientNum]; // Dens: use lerpOrigin for now origin[0] = cent->lerpOrigin[0]; origin[1] = cent->lerpOrigin[1]; origin[2] = cent->lerpOrigin[2]; locStr[i] = va( "^3%s", CG_GetLocationMsg(origin)); if (!Q_stricmp( locStr[i], "^3Unknown")){ locStr[i] = va( "^3(%s)", BG_GetLocationString( loc )); locValid = qfalse; } if(cg_locations.integer > 1 && locValid) Q_strcat( locStr[i], 64, va(" ^3(%s)", BG_GetLocationString( loc )) ); } else { locStr[i] = va( "^3(%s)", BG_GetLocationString( loc )); } if( !locStr[i][1] || !*locStr[i] ) locStr[i] = " "; locwidth = CG_Text_Width_Ext( locStr[i], 0.2f, 0, &cgs.media.font3 ); if(locwidth > bestWidth) bestWidth = locwidth; } boxWidth += bestWidth; CG_DrawRect( x, y, boxWidth, h, 1, borderColor); CG_FillRect( x + 1, y + 1, boxWidth - 2, h - 2, bgColor); x += 2; y += 2; CG_FillRect( x, y, boxWidth - 4, 12, clr1 ); Com_sprintf( buffer, 64, "Fireteam: %s", bg_fireteamNames[f->ident] ); //sprintf( buffer, "Fireteam: %s", bg_fireteamNames[f->ident] ); Q_strupr( buffer ); CG_Text_Paint_Ext( x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.font1 ); x += 2; //y += 2; for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { y += FT_BAR_HEIGHT + FT_BAR_YSPACING; x = rect->x + 2; ci = CG_SortedFireTeamPlayerForPosition( i ); if(!ci) { break;; } if( ci->selected ) { CG_FillRect( x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr3 ); } else { CG_FillRect( x, y + FT_BAR_YSPACING, boxWidth - 4, FT_BAR_HEIGHT, clr2 ); } x += 4; //draw class if(cg_drawClassIcons.integer & CLASSICON_FIRETEAM){ trap_R_SetColor( colorWhite ); CG_DrawPic(x-2, y+2, FT_BAR_HEIGHT, FT_BAR_HEIGHT, cgs.media.skillPics[BG_ClassSkillForClass( ci->cls )]); trap_R_SetColor( NULL ); }else{ CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorWhite, BG_ClassLetterForNumber( ci->cls ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } x += 10; // quad: draw latched class // pheno: not with an old server, that doesn't send the latched class if( ci->cls != ci->latchClass ) { //draw separator CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, ">", 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 10; //draw class if(cg_drawClassIcons.integer & CLASSICON_FIRETEAM) { trap_R_SetColor( colorYellow ); CG_DrawPic(x - 2, y + 2, FT_BAR_HEIGHT, FT_BAR_HEIGHT, cgs.media.skillPics[BG_ClassSkillForClass(ci->latchClass)]); trap_R_SetColor(NULL); } else { CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, BG_ClassLetterForNumber( ci->latchClass ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } x += 10; } else x += 20; CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->team == TEAM_AXIS ? miniRankNames_Axis[ci->rank] : miniRankNames_Allies[ci->rank], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 22; CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, ci->name, 0, 17, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); x += 90; /* CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.movementAutonomyIcons[0]); x += FT_BAR_HEIGHT; CG_DrawPic(x + 2, y + 2, FT_BAR_HEIGHT - 4, FT_BAR_HEIGHT - 4, cgs.media.weaponAutonomyIcons[0]); x += FT_BAR_HEIGHT; x += 4;*/ /* if( isLeader ) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", i+4), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); }*/ x += 20; if( ci->health > 80 ) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, va("%i", ci->health < 0 ? 0 : ci->health ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } else if( ci->health > 0 ) { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorYellow, va("%i", ci->health < 0 ? 0 : ci->health ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } else { CG_Text_Paint_Ext(x, y + FT_BAR_HEIGHT, .2f, .2f, colorRed, va("0%s", ci->health < 0 ? "" : "*" ), 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } x += 30; CG_Text_Paint_Ext( x, y + FT_BAR_HEIGHT, .2f, .2f, tclr, locStr[i], 0, 0, ITEM_TEXTSTYLE_SHADOWED, &cgs.media.font3 ); } }