static void CG_ParseScores( void ) { int i=0, scoreIndex=0, powerups=0, readScores=0; int scoreOffset = GetScoreOffset(); if ( Server_Supports( SSF_SCOREBOARD_LARGE ) ) readScores = Com_Clampi( 0, MAX_CLIENTS, atoi( CG_Argv( 1 ) ) ); else readScores = Com_Clampi( 0, MAX_CLIENT_SCORE_SEND, atoi( CG_Argv( 1 ) ) ); cg.numScores = readScores; cg.teamScores[0] = atoi( CG_Argv( 2 ) ); cg.teamScores[1] = atoi( CG_Argv( 3 ) ); memset( cg.scores, 0, sizeof( cg.scores ) ); for ( i=0, scoreIndex=0; i<readScores; i++ ) { cg.scores[scoreIndex].client = atoi( CG_Argv( i * scoreOffset + 4 ) ); if ( cg.scores[scoreIndex].client < 0 || cg.scores[scoreIndex].client >= MAX_CLIENTS ) continue; cg.scores[scoreIndex].score = atoi( CG_Argv( i * scoreOffset + 5 ) ); cg.scores[scoreIndex].ping = atoi( CG_Argv( i * scoreOffset + 6 ) ); cg.scores[scoreIndex].time = atoi( CG_Argv( i * scoreOffset + 7 ) ); cg.scores[scoreIndex].scoreFlags = atoi( CG_Argv( i * scoreOffset + 8 ) ); powerups = atoi( CG_Argv( i * scoreOffset + 9 ) ); cg.scores[scoreIndex].accuracy = atoi( CG_Argv( i * scoreOffset + 10 ) ); cg.scores[scoreIndex].impressiveCount = atoi( CG_Argv( i * scoreOffset + 11 ) ); cg.scores[scoreIndex].excellentCount = atoi( CG_Argv( i * scoreOffset + 12 ) ); cg.scores[scoreIndex].guantletCount = atoi( CG_Argv( i * scoreOffset + 13 ) ); cg.scores[scoreIndex].defendCount = atoi( CG_Argv( i * scoreOffset + 14 ) ); cg.scores[scoreIndex].assistCount = atoi( CG_Argv( i * scoreOffset + 15 ) ); cg.scores[scoreIndex].perfect = atoi( CG_Argv( i * scoreOffset + 16 ) ); cg.scores[scoreIndex].captures = atoi( CG_Argv( i * scoreOffset + 17 ) ); if ( Server_Supports( SSF_SCOREBOARD_KD ) ) cg.scores[scoreIndex].deaths = atoi( CG_Argv( i * scoreOffset + 18 ) ); cgs.clientinfo[ cg.scores[scoreIndex].client ].score = cg.scores[scoreIndex].score; cgs.clientinfo[ cg.scores[scoreIndex].client ].powerups = powerups; cg.scores[scoreIndex].team = cgs.clientinfo[ cg.scores[scoreIndex].client ].team; scoreIndex++; } CG_SetScoreSelection( NULL ); }
static int GetScoreOffset( void ) { return Server_Supports( SSF_SCOREBOARD_KD ) ? 15 : 14; }
/* ================= 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 ); }