vector columnsize = vec2(ranksize + timesize + namesize + hud_fontsize.x, 1.25 * hud_fontsize.y);
int columns = max(1, floor((panel_size.x - 2 * panel_bg_padding) / columnsize.x));
columns = min(columns, RANKINGS_RECEIVED_CNT);
+ int rows = ceil(RANKINGS_RECEIVED_CNT / columns);
// expand name column to fill the entire row
float available_space = (panel_size.x - 2 * panel_bg_padding - columnsize.x * columns) / columns;
namesize += available_space;
columnsize.x += available_space;
- panel_size.y = ceil(RANKINGS_RECEIVED_CNT / columns) * 1.25 * hud_fontsize.y;
+ panel_size.y = rows * 1.25 * hud_fontsize.y;
panel_size.y += panel_bg_padding * 2;
HUD_Panel_DrawBg();
pos.y += 1.25 * hud_fontsize.y;
j++;
- if(j >= ceil(RANKINGS_RECEIVED_CNT / columns))
+ if(j >= rows)
{
column++;
j = 0;
return true;
}
-vector Scoreboard_Spectators_Draw(vector pos, entity tm, string str, vector hud_fontsize) {
+vector Scoreboard_Spectators_Draw(vector pos) {
- entity pl;
+ entity pl, tm;
+ string str = "";
for(pl = players.sort_next; pl; pl = pl.sort_next)
{
// draw scoreboard spectators before accuracy and item stats
if (autocvar_hud_panel_scoreboard_spectators_position == 0) {
- pos = Scoreboard_Spectators_Draw(pos, tm, str, hud_fontsize);
+ pos = Scoreboard_Spectators_Draw(pos);
}
- // draw accuracy and item stats
+ // draw accuracy and item stats
if (Scoreboard_AccuracyStats_WouldDraw(pos.y))
pos = Scoreboard_AccuracyStats_Draw(pos, panel_bg_color, bg_size);
if (Scoreboard_ItemStats_WouldDraw(pos.y))
// draw scoreboard spectators after accuracy and item stats and before rankings
if (autocvar_hud_panel_scoreboard_spectators_position == 1) {
- pos = Scoreboard_Spectators_Draw(pos, tm, str, hud_fontsize);
+ pos = Scoreboard_Spectators_Draw(pos);
}
if(MUTATOR_CALLHOOK(ShowRankings)) {
// draw scoreboard spectators after rankings
if (autocvar_hud_panel_scoreboard_spectators_position == 2) {
- pos = Scoreboard_Spectators_Draw(pos, tm, str, hud_fontsize);
+ pos = Scoreboard_Spectators_Draw(pos);
}
pos = Scoreboard_MapStats_Draw(pos, panel_bg_color, bg_size);
// draw scoreboard spectators after mapstats
if (autocvar_hud_panel_scoreboard_spectators_position == 3) {
- pos = Scoreboard_Spectators_Draw(pos, tm, str, hud_fontsize);
+ pos = Scoreboard_Spectators_Draw(pos);
}