Cut off long names in the duel centerprint title (same scoreboard limit)
authorterencehill <piuntn@gmail.com>
Sat, 25 Jun 2022 21:29:16 +0000 (23:29 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 25 Jun 2022 21:29:16 +0000 (23:29 +0200)
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/scoreboard.qh

index 4cadf462f21bdd7edb498a8a2c60df63b676c219..0358bed839012cd6b65d94fb5c83cbe35a634874 100644 (file)
@@ -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)
index 01df92c4b4d14e8a08bdb6f931ad5a60d79a76eb..99dbfece70e019f905a0f8d6fd02513abbff8aaa 100644 (file)
@@ -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;
 
index cd43b341ec78ab041ab7a04db67b1135decb7a64..2989b54b0108572c014040f3a2975bd21c3edc2c 100644 (file)
@@ -3,6 +3,7 @@
 
 bool autocvar_cl_deathscoreboard;
 string autocvar_scoreboard_columns;
+float autocvar_hud_panel_scoreboard_namesize = 15;
 
 bool scoreboard_showscores;