From 3ffdbe608af6daf3a29e2d472245ee326cebc2e3 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 28 Apr 2011 18:11:07 +0200 Subject: [PATCH] Rankings in hud configure mode: Show players scores with the team color, fix list starting from Player 2 and show the current number of teams --- qcsrc/client/hud.qc | 20 ++++++++++---------- qcsrc/client/teamplay.qc | 11 +++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 5277d3629..fd6ead540 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2590,8 +2590,9 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count) const vector fontsize = '0.9 0.9 0' * height; pos_y += height * (1 - 0.9) / 2; - vector rgb; + vector rgb, score_color; rgb = '1 1 1'; + score_color = '1 1 1'; const float name_size = mySize_x*0.75; const float highlight_alpha = 0.2; @@ -2630,13 +2631,15 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count) } else { - s = sprintf(_("Player %d"), i+1); + s = sprintf(_("Player %d"), i + 1 - first_pl); score -= 3; } + if (team_count) + score_color = GetTeamRGB(ColorByTeam(mod(i + 2, team_count))) * 0.8; s = textShortenToWidth(s, name_size, fontsize, stringwidth_colors); drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring(pos + eX * mySize_x*0.79, ftos(score), fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring(pos + eX * mySize_x*0.79, ftos(score), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL); pos_y += height; } return; @@ -2686,9 +2689,11 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count) me_printed = 1; drawfill(pos - eY * (height * (1 - 0.9) / 2), eX * mySize_x + eY * height, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } + if (team_count) + score_color = GetTeamRGB(pl.team) * 0.8; s = textShortenToWidth(GetPlayerName(pl.sv_entnum), name_size, fontsize, stringwidth_colors); drawcolorcodedstring(pos + eX * (name_size - stringwidth(s, TRUE, fontsize)), s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); - drawstring(pos + eX * mySize_x*0.79, ftos(pl.(scores[ps_primary])), fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring(pos + eX * mySize_x*0.79, ftos(pl.(scores[ps_primary])), fontsize, score_color, panel_fg_alpha, DRAWFLAG_NORMAL); pos_y += height; } } @@ -2801,13 +2806,8 @@ void HUD_Score(void) vector score_pos, score_size; //for scores other than myteam if (spectatee_status == -1 || autocvar_hud_panel_score_rankings) { - if (autocvar__hud_configure) - scores_count = 4; - else for(tm = teams.sort_next; tm; tm = tm.sort_next) { - if(tm.team == COLOR_SPECTATOR) - continue; + for(tm = teams.sort_next; tm, tm.team != COLOR_SPECTATOR; tm = tm.sort_next) ++scores_count; - } if (autocvar_hud_panel_score_rankings) { HUD_Score_Rankings(pos, mySize, me, scores_count); diff --git a/qcsrc/client/teamplay.qc b/qcsrc/client/teamplay.qc index 0c52f29d0..bc705153a 100644 --- a/qcsrc/client/teamplay.qc +++ b/qcsrc/client/teamplay.qc @@ -9,6 +9,17 @@ float TeamByColor(float color) default: return 0; } } +float ColorByTeam(float i) +{ + switch(i) + { + case 0: return COLOR_TEAM1; + case 1: return COLOR_TEAM2; + case 2: return COLOR_TEAM3; + case 3: return COLOR_TEAM4; + default: return COLOR_TEAM1; + } +} float GetPlayerColorForce(float i) { -- 2.39.2