static void CG_DrawPlayerHasFlag(rectDef_t *rect, qboolean force2D) { int adj = (force2D) ? 0 : 2; if( cg.predictedPlayerState.powerups[PW_REDFLAG] ) { CG_DrawFlagModel( rect->x + adj, rect->y + adj, rect->w - adj, rect->h - adj, TEAM_RED, force2D); } else if( cg.predictedPlayerState.powerups[PW_BLUEFLAG] ) { CG_DrawFlagModel( rect->x + adj, rect->y + adj, rect->w - adj, rect->h - adj, TEAM_BLUE, force2D); } else if( cg.predictedPlayerState.powerups[PW_NEUTRALFLAG] ) { CG_DrawFlagModel( rect->x + adj, rect->y + adj, rect->w - adj, rect->h - adj, TEAM_FREE, force2D); } }
/* ================= CG_DrawPlayerScore ================= */ static void CG_DrawPlayerScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) { char string[1024]; vec3_t headAngles; playerInfo_t *pi; int iconx, headx; playerState_t *ps; if ( score->playerNum < 0 || score->playerNum >= cgs.maxplayers ) { Com_Printf( "Bad score->playerNum: %i\n", score->playerNum ); return; } pi = &cgs.playerinfo[score->playerNum]; iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2); headx = SB_HEAD_X + (SB_RATING_WIDTH / 2); // draw the handicap or bot skill marker (unless player has flag) if ( pi->powerups & ( 1 << PW_NEUTRALFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_FREE, qfalse ); } else { CG_DrawFlagModel( iconx, y, 16, 16, TEAM_FREE, qfalse ); } } else if ( pi->powerups & ( 1 << PW_REDFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_RED, qfalse ); } else { CG_DrawFlagModel( iconx, y, 16, 16, TEAM_RED, qfalse ); } } else if ( pi->powerups & ( 1 << PW_BLUEFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_BLUE, qfalse ); } else { CG_DrawFlagModel( iconx, y, 16, 16, TEAM_BLUE, qfalse ); } } else { if ( pi->botSkill > 0 && pi->botSkill <= 5 ) { if ( cg_drawIcons.integer ) { if( largeFormat ) { CG_DrawPic( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, cgs.media.botSkillShaders[ pi->botSkill - 1 ] ); } else { CG_DrawPic( iconx, y, 16, 16, cgs.media.botSkillShaders[ pi->botSkill - 1 ] ); } } } else if ( pi->handicap < 100 ) { Com_sprintf( string, sizeof( string ), "%i", pi->handicap ); if ( cgs.gametype == GT_TOURNAMENT ) { CG_DrawString( iconx, y - SMALLCHAR_HEIGHT/2, string, UI_SMALLFONT|UI_NOSCALE, color ); } else { CG_DrawString( iconx, y, string, UI_SMALLFONT|UI_NOSCALE, color ); } } // draw the wins / losses if ( cgs.gametype == GT_TOURNAMENT ) { Com_sprintf( string, sizeof( string ), "%i/%i", pi->wins, pi->losses ); if( pi->handicap < 100 && !pi->botSkill ) { CG_DrawString( iconx, y + SMALLCHAR_HEIGHT/2, string, UI_SMALLFONT|UI_NOSCALE, color ); } else { CG_DrawString( iconx, y, string, UI_SMALLFONT|UI_NOSCALE, color ); } } } // draw the face VectorClear( headAngles ); headAngles[YAW] = 180; if( largeFormat ) { CG_DrawHead( headx, y - ( ICON_SIZE - BIGCHAR_HEIGHT ) / 2, ICON_SIZE, ICON_SIZE, score->playerNum, headAngles ); } else { CG_DrawHead( headx, y, 16, 16, score->playerNum, headAngles ); } #ifdef MISSIONPACK // draw the team task switch ( pi->teamTask ) { case TEAMTASK_OFFENSE: CG_DrawPic( headx + 48, y, 16, 16, cgs.media.assaultShader ); break; case TEAMTASK_DEFENSE: CG_DrawPic( headx + 48, y, 16, 16, cgs.media.defendShader ); break; case TEAMTASK_PATROL: CG_DrawPic( headx + 48, y, 16, 16, cgs.media.patrolShader ); break; case TEAMTASK_FOLLOW: CG_DrawPic( headx + 48, y, 16, 16, cgs.media.followShader ); break; case TEAMTASK_CAMP: CG_DrawPic( headx + 48, y, 16, 16, cgs.media.campShader ); break; case TEAMTASK_RETRIEVE: CG_DrawPic( headx + 48, y, 16, 16, cgs.media.retrieveShader ); break; case TEAMTASK_ESCORT: CG_DrawPic( headx + 48, y, 16, 16, cgs.media.escortShader ); break; default: break; } #endif if (cg.cur_ps) { if (score->playerNum == cg.cur_ps->playerNum) { ps = cg.cur_ps; } else { ps = NULL; } } else { ps = CG_LocalPlayerState(score->playerNum); } // highlight your position if ( ps ) { float hcolor[4]; int rank; localPlayer = qtrue; if ( ps->persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM ) { rank = -1; } else { rank = ps->persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if ( rank == 0 ) { hcolor[0] = 0; hcolor[1] = 0; hcolor[2] = 0.7f; } else if ( rank == 1 ) { hcolor[0] = 0.7f; hcolor[1] = 0; hcolor[2] = 0; } else if ( rank == 2 ) { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0; } else { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0.7f; } hcolor[3] = fade * 0.7; CG_FillRect( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, 640 - SB_SCORELINE_X - BIGCHAR_WIDTH - (SB_RATING_WIDTH / 2), BIGCHAR_HEIGHT+1, hcolor ); } // draw the score line if ( score->ping == -1 ) { Com_sprintf(string, sizeof(string), "connecting"); } else if ( pi->team == TEAM_SPECTATOR ) { Com_sprintf(string, sizeof(string), "SPECT"); } else { Com_sprintf(string, sizeof(string), "%5i", score->score); } CG_DrawString( SB_SCORE_X + (SB_RATING_WIDTH / 2) + 4*BIGCHAR_WIDTH, y, string, UI_RIGHT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color ); if ( score->ping != -1 ) { Com_sprintf(string, sizeof(string), "%4i", score->ping); CG_DrawString( SB_PING_X - (SB_RATING_WIDTH / 2) + 4*BIGCHAR_WIDTH, y, string, UI_RIGHT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color ); Com_sprintf(string, sizeof(string), "%4i", score->time); CG_DrawString( SB_TIME_X - (SB_RATING_WIDTH / 2) + 4*BIGCHAR_WIDTH, y, string, UI_RIGHT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color ); } CG_DrawString( SB_NAME_X - (SB_RATING_WIDTH / 2), y, pi->name, UI_LEFT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color ); // add the "ready" marker for intermission exiting if ( Com_ClientListContains( &cg.readyPlayers, score->playerNum ) ) { CG_DrawString( iconx, y, "READY", UI_LEFT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color ); } }
/* ================= CG_DrawScoreboard ================= */ static void CG_DrawClientScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) { //vec3_t headAngles; clientInfo_t *ci; int iconx, headx; float scale; if ( largeFormat ) { scale = 1.0f; } else { scale = 0.75f; } if ( score->client < 0 || score->client >= cgs.maxclients ) { Com_Printf( "Bad score->client: %i\n", score->client ); return; } ci = &cgs.clientinfo[score->client]; iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2); headx = SB_HEAD_X + (SB_RATING_WIDTH / 2); // draw the handicap or bot skill marker (unless player has flag) if ( ci->powerups & ( 1 << PW_NEUTRALFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_FREE, qfalse ); } else { CG_DrawFlagModel( iconx, y, 16, 16, TEAM_FREE, qfalse ); } } else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_RED, qfalse ); } else { CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_RED, qfalse ); } } else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_BLUE, qfalse ); } else { CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_BLUE, qfalse ); } } else { // draw the wins / losses /* if ( cgs.gametype == GT_TOURNAMENT ) { CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, va("%i/%i", ci->wins, ci->losses ), color ); } */ //rww - in duel, we now show wins/losses in place of "frags". This is because duel now defaults to 1 kill per round. } // highlight your position if ( score->client == cg.snap->ps.clientNum ) { float hcolor[4]; int rank; localClient = qtrue; if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || GT_Team(cgs.gametype) ) { rank = -1; } else { rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if ( rank == 0 ) { hcolor[0] = 0; hcolor[1] = 0; hcolor[2] = 0.7f; } else if ( rank == 1 ) { hcolor[0] = 0.7f; hcolor[1] = 0; hcolor[2] = 0; } else if ( rank == 2 ) { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0; } else { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0.7f; } hcolor[3] = fade * 0.7; CG_FillRect( SB_SCORELINE_X - 5, y + 2, 640 - SB_SCORELINE_X * 2 + 10, largeFormat?SB_NORMAL_HEIGHT:SB_INTER_HEIGHT, hcolor ); } CG_Text_Paint (SB_NAME_X, y, 0.9f * scale, colorWhite, ci->name,0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); if ( ci->team != TEAM_SPECTATOR || cgs.gametype == GT_TOURNAMENT ) { if (cgs.gametype == GT_TOURNAMENT) { CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, colorWhite, va("%i/%i", ci->wins, ci->losses),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } else { CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, colorWhite, va("%i", score->score),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } } CG_Text_Paint (SB_PING_X, y, 1.0f * scale, colorWhite, va("%i", score->ping),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, colorWhite, va("%i", score->time),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); // add the "ready" marker for intermission exiting if ( cg.snap->ps.stats[ STAT_CLIENTS_READY ] & ( 1 << score->client ) ) { CG_Text_Paint (SB_NAME_X - 64, y + 2, 0.7f * scale, colorWhite, CG_GetStripEdString("INGAMETEXT", "READY"),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); } }
/* ======================================================================================================================================= CG_DrawClientScore ======================================================================================================================================= */ static void CG_DrawClientScore(int y, score_t *score, float *color, float fade, qboolean largeFormat) { char string[1024]; vec3_t headAngles; clientInfo_t *ci; int iconx, headx; if (score->client < 0 || score->client >= cgs.maxclients) { Com_Printf("Bad score->client: %i\n", score->client); return; } ci = &cgs.clientinfo[score->client]; iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2); headx = SB_HEAD_X + (SB_RATING_WIDTH / 2); // draw the handicap or bot skill marker (unless player has flag) if (ci->powerups & (1 << PW_NEUTRALFLAG)) { if (largeFormat) { CG_DrawFlagModel(iconx, y - (32 - BIGCHAR_HEIGHT) / 2, 32, 32, TEAM_FREE, qfalse); } else { CG_DrawFlagModel(iconx, y, 16, 16, TEAM_FREE, qfalse); } } else if (ci->powerups & (1 << PW_REDFLAG)) { if (largeFormat) { CG_DrawFlagModel(iconx, y - (32 - BIGCHAR_HEIGHT) / 2, 32, 32, TEAM_RED, qfalse); } else { CG_DrawFlagModel(iconx, y, 16, 16, TEAM_RED, qfalse); } } else if (ci->powerups & (1 << PW_BLUEFLAG)) { if (largeFormat) { CG_DrawFlagModel(iconx, y - (32 - BIGCHAR_HEIGHT) / 2, 32, 32, TEAM_BLUE, qfalse); } else { CG_DrawFlagModel(iconx, y, 16, 16, TEAM_BLUE, qfalse); } } else { if (ci->botSkill > 0 && ci->botSkill <= 5) { if (cg_drawIcons.integer) { if (largeFormat) { CG_DrawPic(iconx, y - (32 - BIGCHAR_HEIGHT) / 2, 32, 32, cgs.media.botSkillShaders[ci->botSkill - 1]); } else { CG_DrawPic(iconx, y, 16, 16, cgs.media.botSkillShaders[ci->botSkill - 1]); } } } else if (ci->handicap < 100) { Com_sprintf(string, sizeof(string), "%i", ci->handicap); if (cgs.gametype == GT_TOURNAMENT) { CG_DrawSmallStringColor(iconx, y - SMALLCHAR_HEIGHT / 2, string, color); } else { CG_DrawSmallStringColor(iconx, y, string, color); } } // draw the wins / losses if (cgs.gametype == GT_TOURNAMENT) { Com_sprintf(string, sizeof(string), "%i/%i", ci->wins, ci->losses); if (ci->handicap < 100 && !ci->botSkill) { CG_DrawSmallStringColor(iconx, y + SMALLCHAR_HEIGHT / 2, string, color); } else { CG_DrawSmallStringColor(iconx, y, string, color); } } } // draw the face VectorClear(headAngles); headAngles[YAW] = 180; if (largeFormat) { CG_DrawHead(headx, y - (ICON_SIZE - BIGCHAR_HEIGHT) / 2, ICON_SIZE, ICON_SIZE, score->client, headAngles); } else { CG_DrawHead(headx, y, 16, 16, score->client, headAngles); } #ifdef MISSIONPACK // draw the team task if (ci->teamTask != TEAMTASK_NONE) { if (ci->teamTask == TEAMTASK_OFFENSE) { CG_DrawPic(headx + 48, y, 16, 16, cgs.media.assaultShader); } else if (ci->teamTask == TEAMTASK_DEFENSE) { CG_DrawPic(headx + 48, y, 16, 16, cgs.media.defendShader); } } #endif // draw the score line if (score->ping == -1) { Com_sprintf(string, sizeof(string), " connecting %s", ci->name); } else if (ci->team == TEAM_SPECTATOR) { Com_sprintf(string, sizeof(string), " SPECT %3i %4i %s", score->ping, score->time, ci->name); } else { Com_sprintf(string, sizeof(string), "%5i %4i %4i %s", score->score, score->ping, score->time, ci->name); } // highlight your position if (score->client == cg.snap->ps.clientNum) { float hcolor[4]; int rank; localClient = qtrue; if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM) { rank = -1; } else { rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if (rank == 0) { hcolor[0] = 0; hcolor[1] = 0; hcolor[2] = 0.7f; } else if (rank == 1) { hcolor[0] = 0.7f; hcolor[1] = 0; hcolor[2] = 0; } else if (rank == 2) { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0; } else { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0.7f; } hcolor[3] = fade * 0.7; CG_FillRect(SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, 640 - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT + 1, hcolor); } CG_DrawBigString(SB_SCORELINE_X + (SB_RATING_WIDTH / 2), y, string, fade); // add the "ready" marker for intermission exiting if (cg.snap->ps.stats[STAT_CLIENTS_READY] & (1 << score->client)) { CG_DrawBigStringColor(iconx, y, "READY", color); } }
static void CG_DrawStatusBarFlag( float x, int team ) { CG_DrawFlagModel( x, 480 - ICON_SIZE, ICON_SIZE*cgs.widthRatioCoef, ICON_SIZE, team, qfalse ); }
/* ======================================================================================================================================= CG_DrawScoreboard ======================================================================================================================================= */ static void CG_DrawClientScore(int x, int y, score_t *score, float *color, float fade) { char string[1024]; vec3_t headAngles; clientInfo_t *ci; if (score->client < 0 || score->client >= cgs.maxclients) { Com_Printf("Bad score->client: %i\n", score->client); return; } ci = &cgs.clientinfo[score->client]; // draw the handicap or bot skill marker if (ci->botSkill > 0 && ci->botSkill <= 5) { CG_DrawPic(0, y - 8, 32, 32, cgs.media.botSkillShaders[ci->botSkill - 1]); } else if (ci->handicap < 100) { Com_sprintf(string, sizeof(string), "%i", ci->handicap); CG_DrawSmallStringColor(8, y, string, color); } // draw the wins / losses if (cgs.gametype == GT_TOURNAMENT) { Com_sprintf(string, sizeof(string), "%i/%i", ci->wins, ci->losses); CG_DrawSmallStringColor(x + SCOREBOARD_WIDTH + 2, y, string, color); } // draw the face VectorClear(headAngles); headAngles[YAW] = 180; CG_DrawHead(x - ICON_SIZE, y - (ICON_SIZE - BIGCHAR_HEIGHT) / 2, ICON_SIZE, ICON_SIZE, score->client, headAngles); if (ci->powerups & (1 << PW_REDFLAG)) { CG_DrawFlagModel(x - ICON_SIZE - ICON_SIZE / 2, y - (ICON_SIZE - BIGCHAR_HEIGHT) / 2, ICON_SIZE, ICON_SIZE, TEAM_RED); } else if (ci->powerups & (1 << PW_BLUEFLAG)) { CG_DrawFlagModel(x - ICON_SIZE - ICON_SIZE / 2, y - (ICON_SIZE - BIGCHAR_HEIGHT) / 2, ICON_SIZE, ICON_SIZE, TEAM_BLUE); } // draw the score line if (score->ping == -1) { Com_sprintf(string, sizeof(string), "connecting %s", ci->name); } else if (ci->team == TEAM_SPECTATOR) { Com_sprintf(string, sizeof(string), "SPECT %4i %4i %s", score->ping, score->time, ci->name); } else { Com_sprintf(string, sizeof(string), "%5i %4i %4i %s", score->score, score->ping, score->time, ci->name); } // highlight your position if (score->client == cg.snap->ps.clientNum) { float hcolor[4]; int rank; if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM) { rank = -1; } else { rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if (rank == 0) { hcolor[0] = 0; hcolor[1] = 0; hcolor[2] = 0.7; } else if (rank == 1) { hcolor[0] = 0.7; hcolor[1] = 0; hcolor[2] = 0; } else if (rank == 2) { hcolor[0] = 0.7; hcolor[1] = 0.7; hcolor[2] = 0; } else { hcolor[0] = 0.7; hcolor[1] = 0.7; hcolor[2] = 0.7; } hcolor[3] = fade * 0.7; CG_FillRect(x - 2, y, SCOREBOARD_WIDTH, BIGCHAR_HEIGHT + 1, hcolor); } CG_DrawBigString(x, y, string, fade); // add the "ready" marker for intermission exiting if (cg.snap->ps.stats[STAT_CLIENTS_READY] & (1 << score->client)) { CG_DrawBigStringColor(0, y, "READY", color); } }
static void CG_DrawClientScore( int y, const score_t *score, const float *color, float fade, qboolean largeFormat ) { char string[1024]; vec3_t headAngles; const clientInfo_t *ci; int iconx, headx; #if 0 Com_Printf("---- CG_DrawClientScore() ------\n"); Com_Printf(" client: %d\n", score->client); Com_Printf(" score: %d\n", score->score); Com_Printf(" ping: %d\n", score->ping); Com_Printf(" time: %d\n", score->time); Com_Printf(" scoreFlags: %d\n", score->scoreFlags); Com_Printf(" powerUps: %d\n", score->powerUps); Com_Printf(" accuracy: %d\n", score->accuracy); // Com_Printf(" ...\n"); Com_Printf(" impressiveCount: %d\n", score->impressiveCount); Com_Printf(" excellentCount: %d\n", score->excellentCount); Com_Printf(" gauntletCount: %d\n", score->gauntletCount); Com_Printf(" defendCount: %d\n", score->defendCount); Com_Printf(" assistCount: %d\n", score->assistCount); Com_Printf(" perfect: %d\n", score->perfect); Com_Printf(" team: %d\n", score->team); #endif if ( score->client < 0 || score->client >= cgs.maxclients ) { Com_Printf( "Bad score->client: %i\n", score->client ); return; } ci = &cgs.clientinfo[score->client]; iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2); headx = SB_HEAD_X + (SB_RATING_WIDTH / 2); // draw the handicap or bot skill marker (unless player has flag) if ( ci->powerups & ( 1 << PW_NEUTRALFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_FREE, qfalse ); } else { CG_DrawFlagModel( iconx, y, 16, 16, TEAM_FREE, qfalse ); } } else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_RED, qfalse ); } else { CG_DrawFlagModel( iconx, y, 16, 16, TEAM_RED, qfalse ); } } else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_BLUE, qfalse ); } else { CG_DrawFlagModel( iconx, y, 16, 16, TEAM_BLUE, qfalse ); } } else { if ( ci->botSkill > 0 && ci->botSkill <= 5 ) { if ( cg_drawIcons.integer ) { if( largeFormat ) { CG_DrawPic( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, cgs.media.botSkillShaders[ ci->botSkill - 1 ] ); } else { CG_DrawPic( iconx, y, 16, 16, cgs.media.botSkillShaders[ ci->botSkill - 1 ] ); } } } else if ( ci->handicap < 100 ) { Com_sprintf( string, sizeof( string ), "%i", ci->handicap ); if ( CG_IsDuelGame(cgs.gametype) ) CG_DrawSmallStringColor( iconx, y - SMALLCHAR_HEIGHT/2, string, color ); else CG_DrawSmallStringColor( iconx, y, string, color ); } // draw the wins / losses if ( CG_IsDuelGame(cgs.gametype) ) { Com_sprintf( string, sizeof( string ), "%i/%i", ci->wins, ci->losses ); if( ci->handicap < 100 && !ci->botSkill ) { CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, string, color ); } else { CG_DrawSmallStringColor( iconx, y, string, color ); } } } // draw the face VectorClear( headAngles ); headAngles[YAW] = 180; if( largeFormat ) { CG_DrawHead( headx, y - ( ICON_SIZE - BIGCHAR_HEIGHT ) / 2, ICON_SIZE, ICON_SIZE, score->client, headAngles, qtrue ); } else { CG_DrawHead( headx, y, 16, 16, score->client, headAngles, qtrue ); } #ifdef MISSIONPACK // draw the team task if ( ci->teamTask != TEAMTASK_NONE ) { if ( ci->teamTask == TEAMTASK_OFFENSE ) { CG_DrawPic( headx + 48, y, 16, 16, cgs.media.assaultShader ); } else if ( ci->teamTask == TEAMTASK_DEFENSE ) { CG_DrawPic( headx + 48, y, 16, 16, cgs.media.defendShader ); } } #endif // draw the score line if ( score->ping == -1 ) { Com_sprintf(string, sizeof(string), " connecting %s", ci->name); //} else if ( ci->team == TEAM_SPECTATOR && cg.numScores > 0) { } else if ( score->team == TEAM_SPECTATOR && cg.numScores > 0) { Com_sprintf(string, sizeof(string), "^3%5i %4i %4i ^7%s", score->score, score->ping, score->time, ci->name); } else if (cg.numScores > 0) { #if 1 Com_sprintf(string, sizeof(string), "%5i %4i %4i %s", score->score, score->ping, score->time, ci->name); #endif #if 0 Com_sprintf(string, sizeof(string), "%5i %4i %4i %i %i %i %i %s %s", score->score, score->ping, score->time, score->alive, score->frags, score->deaths, score->accuracy, weapNames[score->bestWeapon], ci->name); #endif #if 0 Com_sprintf(string, sizeof(string), "%5i %4i %4i %d %s %s", score->score, score->ping, score->time, score->accuracy, weapNames[score->bestWeapon], ci->name); #endif } else if (cg.demoPlayback) { Com_sprintf(string, sizeof(string), " %s", ci->name); } //FIXME wolfcam // highlight your position if ( score->client == cg.snap->ps.clientNum ) { float hcolor[4]; int rank; localClient = qtrue; if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM ) { rank = -1; } else { rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if ( rank == 0 ) { hcolor[0] = 0; hcolor[1] = 0; hcolor[2] = 0.7f; } else if ( rank == 1 ) { hcolor[0] = 0.7f; hcolor[1] = 0; hcolor[2] = 0; } else if ( rank == 2 ) { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0; } else { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0.7f; } hcolor[3] = fade * 0.7; CG_FillRect( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, 640 - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT+1, hcolor ); } CG_DrawBigString( SB_SCORELINE_X + (SB_RATING_WIDTH / 2), y, string, fade ); // add the "ready" marker for intermission exiting if ( cg.snap->ps.stats[ STAT_CLIENTS_READY ] & ( 1 << score->client ) ) { CG_DrawBigStringColor( iconx, y, "READY", color ); } }
/* ================ CG_DrawStatusBarFlag ================ */ static void CG_DrawStatusBarFlag( float x, int team ) { CG_DrawFlagModel( x, 480 - ICON_SIZE, ICON_SIZE, ICON_SIZE, team, false ); }
/* ================= CG_DrawScoreboard ================= */ static void CG_DrawClientScore( int y, score_t *score, vector4 *color, float fade, qboolean largeFormat ) { //vector3 headAngles; clientInfo_t *ci; int iconx = SB_SCORELINE_X - 5;//SB_BOTICON_X + (SB_RATING_WIDTH / 2); float scale = largeFormat ? 1.0f : 0.75f, iconSize = largeFormat ? SB_NORMAL_HEIGHT : SB_INTER_HEIGHT; iconx -= iconSize; if ( score->client < 0 || score->client >= cgs.maxclients ) { Com_Printf( "Bad score->client: %i\n", score->client ); return; } ci = &cgs.clientinfo[score->client]; // draw the handicap or bot skill marker (unless player has flag) if ( ci->powerups & (1<<PW_NEUTRALFLAG) ) { if ( largeFormat ) CG_DrawFlagModel( iconx, y - (32 - BIGCHAR_HEIGHT) / 2, iconSize, iconSize, TEAM_FREE, qfalse ); else CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_FREE, qfalse ); } else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_RED, qfalse ); else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_BLUE, qfalse ); else if ( cgs.gametype == GT_POWERDUEL && (ci->duelTeam == DUELTEAM_LONE || ci->duelTeam == DUELTEAM_DOUBLE) ) { CG_DrawPic( iconx, y, iconSize, iconSize, trap->R_RegisterShaderNoMip( (ci->duelTeam == DUELTEAM_LONE) ? "gfx/mp/pduel_icon_lone" : "gfx/mp/pduel_icon_double" ) ); } else if (cgs.gametype == GT_SIEGE) { //try to draw the shader for this class on the scoreboard if (ci->siegeIndex != -1) { siegeClass_t *scl = &bgSiegeClasses[ci->siegeIndex]; if (scl->classShader) { CG_DrawPic (iconx, y, largeFormat?24:12, largeFormat?24:12, scl->classShader); } } } else if ( ci->modelIcon && cg_scoreboardSkinIcons.integer ) CG_DrawPic( iconx, y, iconSize, iconSize, ci->modelIcon ); // highlight your position if ( score->client == cg.snap->ps.clientNum ) { vector4 hcolor; int rank; localClient = qtrue; if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM ) { rank = -1; } else { rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if ( rank == 0 ) { hcolor.r = 0; hcolor.g = 0; hcolor.b = 0.7f; } else if ( rank == 1 ) { hcolor.r = 0.7f; hcolor.g = 0; hcolor.b = 0; } else if ( rank == 2 ) { hcolor.r = 0.7f; hcolor.g = 0.7f; hcolor.b = 0; } else { hcolor.r = 0.7f; hcolor.g = 0.7f; hcolor.b = 0.7f; } hcolor.a = fade * 0.7; CG_FillRect( SB_SCORELINE_X - 5, y /*+ 2*/, SB_SCORELINE_WIDTH /*- SB_SCORELINE_X * 2 + 10*/, largeFormat?SB_NORMAL_HEIGHT:SB_INTER_HEIGHT, &hcolor ); } CG_Text_Paint (SB_NAME_X, y, 0.9f * scale, &colorWhite, ci->name,0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); if ( score->ping != -1 ) { if ( ci->team != TEAM_SPECTATOR || cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL ) { if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, &colorWhite, va("%i/%i", ci->wins, ci->losses),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } else { if ( Server_Supports( SSF_SCOREBOARD_KD ) ) CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, &colorWhite, va("%i/%i", score->score, score->deaths),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); else CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, &colorWhite, va("%i", score->score),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } } CG_Text_Paint (SB_PING_X, y, 1.0f * scale, &colorWhite, va("%i", score->ping),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, &colorWhite, va("%i", score->time),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } else { CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, &colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_PING_X, y, 1.0f * scale, &colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, &colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } // add the "ready" marker for intermission exiting if ( cg.snap->ps.stats[STAT_CLIENTS_READY] & ( 1 << score->client ) ) { CG_Text_Paint( cg_scoreboardSkinIcons.integer ? 4 : SB_NAME_X - 48, y + 2, 0.7f * scale, &colorWhite, CG_GetStringEdString("MP_INGAME", "READY"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); } else if ( cgs.clientinfo[score->client].botSkill != -1 ) CG_Text_Paint( cg_scoreboardSkinIcons.integer ? 4 : SB_NAME_X - 48, y + 2, 0.7f * scale, &colorWhite, "BOT", 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); else if ( score->team == TEAM_SPECTATOR ) CG_Text_Paint( cg_scoreboardSkinIcons.integer ? 4 : SB_NAME_X - 48, y + 2, 0.7f * scale, &colorWhite, "SPEC", 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); }
/* ================= CG_DrawScoreboard ================= */ static void CG_DrawClientScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) { char string[1024]; vec3_t headAngles; clientInfo_t *ci; int iconx, headx; float scale = 0.35; int h = CG_Text_Height( "Tj", scale, 0 ); //int ty; if ( score->client < 0 || score->client >= cgs.maxclients ) { Com_Printf( "Bad score->client: %i\n", score->client ); return; } color[3] = fade; ci = &cgs.clientinfo[score->client]; iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2); headx = SB_HEAD_X + (SB_RATING_WIDTH / 2); // draw the handicap or bot skill marker (unless player has flag) if ( ci->powerups & ( 1 << PW_NEUTRALFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_FREE, qfalse, SCR_CENTER ); } else { CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_FREE, qfalse, SCR_CENTER ); } } else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_RED, qfalse, SCR_CENTER ); } else { CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_RED, qfalse, SCR_CENTER ); } } else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) { if( largeFormat ) { CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_BLUE, qfalse, SCR_CENTER ); } else { CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_BLUE, qfalse, SCR_CENTER ); } } else { if ( ci->botSkill > 0 && ci->botSkill <= 5 ) { if ( cg_drawIcons.integer ) { if( largeFormat ) { CG_DrawColorPic( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, cgs.media.botSkillShaders[ci->botSkill - 1], SCR_CENTER, color ); } else { CG_DrawColorPic( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, cgs.media.botSkillShaders[ci->botSkill - 1], SCR_CENTER, color ); } } } else if ( ci->handicap < 100 ) { Com_sprintf( string, sizeof( string ), "%i", ci->handicap ); if ( gt[cgs.gametype].duel ) { if ( cg_highResFonts.integer ) { CG_Text_Paint( iconx, y + h + ((float)h/2), scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); } else { CG_DrawSmallStringColor( iconx, y - SMALLCHAR_HEIGHT/2, string, color, SCR_CENTER ); } } else { if ( cg_highResFonts.integer ) { //w = CG_Text_Width(s, scale, 0); h = CG_Text_Height(string, scale, 0); CG_Text_Paint( iconx, y + h, scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); } else { CG_DrawSmallStringColor( iconx, y, string, color, SCR_CENTER ); } } } // draw the wins / losses if ( gt[cgs.gametype].duel ) { Com_sprintf( string, sizeof( string ), "%i/%i", ci->wins, ci->losses ); if ( ci->handicap < 100 && !ci->botSkill ) { if ( cg_highResFonts.integer ) { CG_Text_Paint( iconx, y + h + ((float)h/2), scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); } else { CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, string, color, SCR_CENTER ); } } else { if ( cg_highResFonts.integer ) { CG_Text_Paint( iconx, y + h, scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); } else { CG_DrawSmallStringColor( iconx, y, string, color, SCR_CENTER ); } } } } // draw the face VectorClear( headAngles ); headAngles[YAW] = 180; if ( largeFormat ) { CG_DrawHead( headx, y - SB_LARGE_SPACER*2, ICON_SIZE, ICON_SIZE, score->client, headAngles, SCR_CENTER, color ); } else { CG_DrawHead( headx, y + SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, score->client, headAngles, SCR_CENTER, color ); } // draw the score line // highlight your position if ( score->client == cg.snap->ps.clientNum ) { float hcolor[4]; int rank; localClient = qtrue; if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) { rank = -1; } else { rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if ( rank == 0 ) { hcolor[0] = 0; hcolor[1] = 0; hcolor[2] = 0.7f; } else if ( rank == 1 ) { hcolor[0] = 0.7f; hcolor[1] = 0; hcolor[2] = 0; } else if ( rank == 2 ) { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0; } else { hcolor[0] = 0.4f; hcolor[1] = 0.4f; hcolor[2] = 0.4f; } hcolor[3] = fade * 0.7; /* CG_DrawTeamBackground( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, SCREEN_WIDTH - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT+1, 1, gt[cgs.gametype].teams ? cg.snap->ps.persistant[PERS_TEAM] : hcolor, SCR_CENTER ); */ CG_FillRect( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, SCREEN_WIDTH - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT+2, gt[cgs.gametype].teams ? CG_TeamColorDark(cg.snap->ps.persistant[PERS_TEAM], fade) : hcolor, SCR_CENTER ); } // draw client score strings if ( cg_highResFonts.integer ) { qboolean spec = ci->team == TEAM_SPECTATOR; int w; char *s; // score s = (score->ping == -1) ? "CONN" : spec ? "SPEC" : cg.warmup ? "-" : va("%i", score->score); w = CG_Text_Width( s, scale, 0 ); CG_Text_Paint( SB_SCORE_X + (SB_RATING_WIDTH / 2) + 64-w, y + h, scale, color, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); // ping s = va( "%i", score->ping ); w = CG_Text_Width( s, scale, 0 ); CG_Text_Paint( SB_PING_X - (SB_RATING_WIDTH + BIGCHAR_WIDTH )/2 + 64-w, y + h, scale, color, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); // time s = va( "%i", score->time ); //CG_IntToTime( score->time*1000, qtrue, qfalse ); w = CG_Text_Width( s, scale, 0 ); CG_Text_Paint( SB_TIME_X - (SB_RATING_WIDTH + BIGCHAR_WIDTH )/2 + 64-w, y + h, scale, color, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); // name CG_Text_Paint( SB_NAME_X - (SB_RATING_WIDTH / 2), y + h, scale, color, ci->name, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); } else { if ( score->ping == -1 ) { Com_sprintf(string, sizeof(string), " connecting %s", ci->name); } else if ( ci->team == TEAM_SPECTATOR ) { Com_sprintf(string, sizeof(string), " SPECT %3i %4i %s", score->ping, score->time, ci->name); } else { Com_sprintf(string, sizeof(string), "%5i %4i %4i %s", score->score, score->ping, score->time, ci->name); } CG_DrawBigString( SB_SCORELINE_X + (SB_RATING_WIDTH / 2), y, string, fade, SCR_CENTER ); } // add the "ready" marker for intermission exiting if ( cg.snap->ps.stats[STAT_CLIENTS_READY] & ( 1 << score->client ) ) { if ( cg_highResFonts.integer ) { CG_Text_Paint( iconx, y + h, scale, color, "READY", 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER ); } else { CG_DrawBigStringColor( iconx, y, "READY", color, SCR_CENTER ); } } }