]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Scoreboard: limit height rather than number of rows, it best adapts to different...
authorterencehill <piuntn@gmail.com>
Sun, 4 Sep 2016 22:19:13 +0000 (00:19 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 4 Sep 2016 22:19:13 +0000 (00:19 +0200)
_hud_common.cfg
qcsrc/client/hud/panel/scoreboard.qc

index fa1b90b7c7ce6bae41f401846da054ea8b074f04..20e188f8750808de84aa5f936dc4bfab36e0202a 100644 (file)
@@ -108,10 +108,8 @@ seta hud_panel_infomessages_group_time 6 "number of seconds a message of a group
 seta hud_panel_infomessages_group_fadetime 0.4 "group message fade in/out time"
 
 seta hud_panel_scoreboard_namesize "15" "size limit of player names and relative column (multiplied by fontsize)"
-seta hud_panel_scoreboard_maxrows 1 "limit number of rows displayed in the scoreboard; other players are listed in the last row"
-seta hud_panel_scoreboard_maxrows_players 20 "max number of rows in non-team games"
-seta hud_panel_scoreboard_maxrows_teamplayers 9 "max number of rows in the team table"
-seta hud_panel_scoreboard_others_showscore 1 "show scores of other players in the last row"
+seta hud_panel_scoreboard_maxheight 0.5 "max height of the scoreboard; a few players that wouldn't fit into the scoreboard are listed in the last row"
+seta hud_panel_scoreboard_others_showscore 1 "show scores of players listed in the last row when the scoreboard reaches the max height"
 seta hud_panel_scoreboard_spectators_showping 1 "show ping of spectators"
 
 // hud panel aliases
index 7d14e9a95f448ab9224ef318ac184e00cf130dcd..d546c19eb292d0e2e453272e47180b4f268ff925 100644 (file)
@@ -58,9 +58,7 @@ bool autocvar_hud_panel_scoreboard_accuracy_nocolors = false;
 
 bool autocvar_hud_panel_scoreboard_dynamichud = false;
 
-bool autocvar_hud_panel_scoreboard_maxrows = true;
-int autocvar_hud_panel_scoreboard_maxrows_players = 20;
-int autocvar_hud_panel_scoreboard_maxrows_teamplayers = 9;
+bool autocvar_hud_panel_scoreboard_maxheight = 0.5;
 bool autocvar_hud_panel_scoreboard_others_showscore = true;
 bool autocvar_hud_panel_scoreboard_spectators_showping = true;
 
@@ -973,12 +971,12 @@ vector Scoreboard_DrawOthers(vector item_pos, vector rgb, int this_team, entity
 vector Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
 {
        int max_players = 999;
-       if(autocvar_hud_panel_scoreboard_maxrows)
+       if(autocvar_hud_panel_scoreboard_maxheight > 0)
        {
+               max_players = autocvar_hud_panel_scoreboard_maxheight * vid_conheight;
                if(teamplay)
-                       max_players = autocvar_hud_panel_scoreboard_maxrows_teamplayers;
-               else
-                       max_players = autocvar_hud_panel_scoreboard_maxrows_players;
+                       max_players = (max_players - hud_fontsize.y * 1.25 - panel_bg_padding * 2) / 2;
+               max_players = floor(max_players / (hud_fontsize.y * 1.25));
                if(max_players <= 1)
                        max_players = 1;
                if(max_players == tm.team_size)