From: terencehill Date: Sun, 4 Sep 2016 22:19:13 +0000 (+0200) Subject: Scoreboard: limit height rather than number of rows, it best adapts to different... X-Git-Tag: xonotic-v0.8.2~600^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d95154e1c0e178a63502bd40de6ee4786151caff;p=xonotic%2Fxonotic-data.pk3dir.git Scoreboard: limit height rather than number of rows, it best adapts to different screens resolutions --- diff --git a/_hud_common.cfg b/_hud_common.cfg index fa1b90b7c..20e188f87 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -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 diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 7d14e9a95..d546c19eb 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -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)