From 060a811f3d8b7aaf8c15b5e450c9975e41a29922 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 25 Jun 2022 23:29:16 +0200 Subject: [PATCH] Cut off long names in the duel centerprint title (same scoreboard limit) --- qcsrc/client/hud/panel/centerprint.qc | 7 ++++--- qcsrc/client/hud/panel/scoreboard.qc | 1 - qcsrc/client/hud/panel/scoreboard.qh | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) 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; -- 2.39.2