]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Darken eliminated player's row instead of showing an icon
authorterencehill <piuntn@gmail.com>
Sun, 23 Nov 2014 19:46:43 +0000 (20:46 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 23 Nov 2014 19:46:43 +0000 (20:46 +0100)
qcsrc/client/scoreboard.qc

index e01300df8365c50011f834a5863723054abdc4d1..c420d28b8fd43f588a4941aff0de3d64a966d616 100644 (file)
@@ -541,10 +541,6 @@ string HUD_GetField(entity pl, float field)
                        {
                                hud_field_icon0 = "gfx/scoreboard/player_ready";
                        }
-                       if(pl.eliminated)
-                       {
-                               hud_field_icon0 = "gfx/scoreboard/player_ready"; // TODO: different icon
-                       }
                        else if(!teamplay)
                        {
                                f = stof(getplayerkeyvalue(pl.sv_entnum, "colors"));
@@ -674,7 +670,7 @@ string HUD_FixScoreboardColumnWidth(float i, string str)
        return str;
 }
 
-void HUD_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_number)
+void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, float pl_number)
 {
        vector tmp, rgb;
        rgb = Team_ColorRGB(pl.team);
@@ -688,18 +684,17 @@ void HUD_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_numb
                rgb_y = autocvar_scoreboard_color_bg_g + 0.5;
                rgb_z = autocvar_scoreboard_color_bg_b + 0.5; }
 
-       // Layout:
-       tmp_x = sbwidth;
-       tmp_y = hud_fontsize_y * 1.25;
-       tmp_z = 0;
-
+       vector h_pos = pos - '1 1 0';
+       vector h_size = item_size + '2 0 0';
        // alternated rows highlighting
        if(is_self)
-               drawfill(pos - '1 1 0', tmp + '2 0 0', rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
+               drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
        else if((scoreboard_highlight) && (!mod(pl_number,2)))
-               drawfill(pos - '1 1 0', tmp + '2 0 0', rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
+               drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
 
+       tmp_x = item_size_x;
        tmp_y = 0;
+       tmp_z = 0;
 
        for(i = 0; i < hud_num_fields; ++i)
        {
@@ -798,6 +793,9 @@ void HUD_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_numb
                        pos_x -= hud_size[i] + hud_fontsize_x;
                }
        }
+
+       if(pl.eliminated)
+               drawfill(h_pos, h_size, '0 0 0', 0.5, DRAWFLAG_NORMAL);
 }
 
 /*
@@ -911,6 +909,10 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
        pos_y += 1.25 * hud_fontsize_y; // skip the header
        pos_y += autocvar_scoreboard_border_thickness;
 
+       // item size
+       tmp_x = sbwidth;
+       tmp_y = hud_fontsize_y * 1.25;
+
        // fill the table and draw the rows
        i = 0;
        if (teamplay)
@@ -918,7 +920,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                {
                        if(pl.team != tm.team)
                                continue;
-                       HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localnum), i);
+                       HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i);
                        pos_y += 1.25 * hud_fontsize_y;
                        ++i;
                }
@@ -927,7 +929,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                {
                        if(pl.team == NUM_SPECTATOR)
                                continue;
-                       HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localnum), i);
+                       HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i);
                        pos_y += 1.25 * hud_fontsize_y;
                        ++i;
                }
@@ -1334,12 +1336,16 @@ void HUD_DrawScoreboard()
        float specs;
        specs = 0;
        tmp = pos;
+       vector item_size;
+       item_size_x = sbwidth;
+       item_size_y = hud_fontsize_y * 1.25;
+       item_size_z = 0;
        for(pl = players.sort_next; pl; pl = pl.sort_next)
        {
                if(pl.team != NUM_SPECTATOR)
                        continue;
                pos_y += 1.25 * hud_fontsize_y;
-               HUD_PrintScoreboardItem(pos, pl, (pl.sv_entnum == player_localnum), specs);
+               HUD_PrintScoreboardItem(pos, item_size, pl, (pl.sv_entnum == player_localnum), specs);
                ++specs;
        }