From: terencehill Date: Sat, 25 Jun 2022 21:29:16 +0000 (+0200) Subject: Cut off long names in the duel centerprint title (same scoreboard limit) X-Git-Tag: xonotic-v0.8.6~437^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=060a811f3d8b7aaf8c15b5e450c9975e41a29922;p=xonotic%2Fxonotic-data.pk3dir.git Cut off long names in the duel centerprint title (same scoreboard limit) --- diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 4cadf462f..0358bed83 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -153,9 +153,10 @@ void centerprint_KillAll() void centerprint_SetDuelTitle(string left, string right, string div) { - strcpy(centerprint_title_left, left); - strcpy(centerprint_title_right, right); - centerprint_SetTitle(sprintf("^BG%s^BG %s %s", left, div, right)); + float namesize = autocvar_hud_panel_scoreboard_namesize * hud_fontsize.x; + strcpy(centerprint_title_left, textShortenToWidth(left, namesize, hud_fontsize, stringwidth_colors)); + strcpy(centerprint_title_right, textShortenToWidth(right, namesize, hud_fontsize, stringwidth_colors)); + centerprint_SetTitle(sprintf("^BG%s^BG %s %s", centerprint_title_left, div, centerprint_title_right)); } void centerprint_SetTitle(string title) diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 01df92c4b..99dbfece7 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -80,7 +80,6 @@ float autocvar_hud_panel_scoreboard_table_highlight_alpha = 0.2; float autocvar_hud_panel_scoreboard_table_highlight_alpha_self = 0.4; float autocvar_hud_panel_scoreboard_table_highlight_alpha_eliminated = 0.6; float autocvar_hud_panel_scoreboard_bg_teams_color_team = 0; -float autocvar_hud_panel_scoreboard_namesize = 15; float autocvar_hud_panel_scoreboard_team_size_position = 0; float autocvar_hud_panel_scoreboard_spectators_position = 1; diff --git a/qcsrc/client/hud/panel/scoreboard.qh b/qcsrc/client/hud/panel/scoreboard.qh index cd43b341e..2989b54b0 100644 --- a/qcsrc/client/hud/panel/scoreboard.qh +++ b/qcsrc/client/hud/panel/scoreboard.qh @@ -3,6 +3,7 @@ bool autocvar_cl_deathscoreboard; string autocvar_scoreboard_columns; +float autocvar_hud_panel_scoreboard_namesize = 15; bool scoreboard_showscores;