seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
-seta hud_panel_centerprint_fontscale_bold "1.4"
-seta hud_panel_centerprint_fontscale_title "1.8"
+seta hud_panel_centerprint_fontscale_bold "1.2"
+seta hud_panel_centerprint_fontscale_title "1.3"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
-seta hud_panel_centerprint_fontscale_bold "1.4"
-seta hud_panel_centerprint_fontscale_title "1.8"
+seta hud_panel_centerprint_fontscale_bold "1.2"
+seta hud_panel_centerprint_fontscale_title "1.3"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
-seta hud_panel_centerprint_fontscale_bold "1.4"
-seta hud_panel_centerprint_fontscale_title "1.8"
+seta hud_panel_centerprint_fontscale_bold "1.2"
+seta hud_panel_centerprint_fontscale_title "1.3"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
-seta hud_panel_centerprint_fontscale_bold "1.4"
-seta hud_panel_centerprint_fontscale_title "1.8"
+seta hud_panel_centerprint_fontscale_bold "1.2"
+seta hud_panel_centerprint_fontscale_title "1.3"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
-seta hud_panel_centerprint_fontscale_bold "1.4"
-seta hud_panel_centerprint_fontscale_title "1.8"
+seta hud_panel_centerprint_fontscale_bold "1.2"
+seta hud_panel_centerprint_fontscale_title "1.3"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
-seta hud_panel_centerprint_fontscale_bold "1.4"
-seta hud_panel_centerprint_fontscale_title "1.8"
+seta hud_panel_centerprint_fontscale_bold "1.2"
+seta hud_panel_centerprint_fontscale_title "1.3"
seta hud_panel_minigameboard_pos "0.22 0.15"
seta hud_panel_minigameboard_size "0.50 0.60"
#include <client/draw.qh>
#include <client/hud/panel/centerprint.qh>
+#include <client/hud/panel/scoreboard.qh>
#include <client/mutators/_mod.qh>
#include <common/notifications/all.qh>
#include <common/stats.qh>
entity announcer_countdown;
+/**
+ * Displays duel title; updates it if the players in-game have changed.
+ */
+string prev_pl1_name;
+string prev_pl2_name;
+void Announcer_Duel()
+{
+ Scoreboard_UpdatePlayerTeams();
+
+ entity pl1 = players.sort_next;
+ entity pl2 = pl1.sort_next;
+ string pl1_name = (pl1 && pl1.team != NUM_SPECTATOR ? entcs_GetName(pl1.sv_entnum) : "???");
+ string pl2_name = (pl2 && pl2.team != NUM_SPECTATOR ? entcs_GetName(pl2.sv_entnum) : "???");
+
+ if(pl1_name == prev_pl1_name && pl2_name == prev_pl2_name)
+ return; // Players haven't changed, stop here
+
+ strcpy(prev_pl1_name, pl1_name);
+ strcpy(prev_pl2_name, pl2_name);
+
+ // There are new duelers, update title
+ float offset = stringwidth(pl2_name, true, hud_fontsize) - stringwidth(pl1_name, true, hud_fontsize) - 1;
+ centerprint_SetTitle(sprintf("^BG%s^BG %s %s", pl1_name, _("vs"), pl2_name), offset / 2);
+}
+
+void Announcer_ClearTitle()
+{
+ strfree(prev_pl1_name);
+ strfree(prev_pl2_name);
+ centerprint_ClearTitle();
+}
+
+bool prev_inround;
void Announcer_Countdown(entity this)
{
float starttime = STAT(GAMESTARTTIME);
Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTOP);
delete(this);
announcer_countdown = NULL;
- centerprint_ClearTitle();
+ Announcer_ClearTitle();
return;
}
Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN);
delete(this);
announcer_countdown = NULL;
- centerprint_ClearTitle();
+ Announcer_ClearTitle();
return;
}
else // countdown is still going
{
if(inround)
{
+ if(!prev_inround) Announcer_ClearTitle(); // clear title if we just started the match
Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, STAT(ROUNDS_PLAYED) + 1, countdown_rounded);
Notification annce_num = Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded);
if(annce_num != NULL)
this.nextthink = (starttime - (countdown - 1));
}
}
+
+ prev_inround = inround;
}
/**
return;
}
+ if(announcer_countdown && gametype.m_1v1)
+ Announcer_Duel();
+
if(previous_game_starttime != startTime)
{
if(time < startTime)
if(!warmup_stage && time < STAT(GAMESTARTTIME))
{
if (gametype.m_1v1)
- {
- entity pl1 = players.sort_next;
- entity pl2 = pl1.sort_next;
- string pl1_name = (pl1 && pl1.team != NUM_SPECTATOR ? entcs_GetName(pl1.sv_entnum) : "???");
- string pl2_name = (pl2 && pl2.team != NUM_SPECTATOR ? entcs_GetName(pl2.sv_entnum) : "???");
-
- float offset = stringwidth(pl2_name, true, hud_fontsize) - stringwidth(pl1_name, true, hud_fontsize) - 1;
- centerprint_SetTitle(sprintf("^BG%s^BG%s%s", pl1_name, _(" vs "), pl2_name), offset / 2); // Show duelers in 1v1 game mode
- }
+ Announcer_Duel();
else
centerprint_SetTitle(strcat("^BG", MapInfo_Type_ToText(gametype)), 0); // Show game type as title
const int CENTERPRINT_MAX_MSGS = 10;
const int CENTERPRINT_MAX_ENTRIES = 50;
-const float CENTERPRINT_BASE_SIZE = 1.4;
-const float CENTERPRINT_SPACING = 0.5;
+const float CENTERPRINT_BASE_SIZE = 1.3;
+const float CENTERPRINT_SPACING = 0.3;
const float CENTERPRINT_TITLE_SPACING = 0.35;
int cpm_index;
string centerprint_messages[CENTERPRINT_MAX_MSGS];
j = 0;
if (new_id && new_id == centerprint_msgID[j])
{
- if (strMessage == "" && centerprint_messages[j] != "" && centerprint_countdown_num[j] == 0)
+ if (strMessage == "" && centerprint_messages[j] != "")
{
// fade out the current msg (duration and countdown_num are ignored)
+ centerprint_start_time[j] = 0;
centerprint_time[j] = min(5, autocvar_hud_panel_centerprint_fade_out);
centerprint_expire_time[j] = -1; // don't use the variable time here!
return;
void centerprint_SetTitle(string title, float offset)
{
if(title != centerprint_title) {
- if(centerprint_title)
- strfree(centerprint_title);
-
- centerprint_title = strzone(CCR(title));
+ strcpy(centerprint_title, CCR(title));
centerprint_title_offset = offset;
}
}
}
if (centerprint_expire_time[j] <= time)
{
- if (centerprint_countdown_num[j] && centerprint_time[j] > 0)
+ if (centerprint_countdown_num[j] && centerprint_time[j] > 0 && centerprint_start_time[j])
{
centerprint_countdown_num[j] = centerprint_countdown_num[j] - 1;
if (centerprint_countdown_num[j] == 0)
float fade_in_time = autocvar_hud_panel_centerprint_fade_in;
float fade_out_time = autocvar_hud_panel_centerprint_fade_out;
- if (centerprint_countdown_num[j]) {
+ if (centerprint_countdown_num[j] && centerprint_start_time[j]) {
fade_in_time = 0;
fade_out_time = 0;
}
return;
}
- if (!scoreboard_fade_alpha) // the scoreboard too calls Scoreboard_UpdatePlayerTeams
- Scoreboard_UpdatePlayerTeams();
+ Scoreboard_UpdatePlayerTeams();
if (team_count)
{
// show team scores in the first line
//float lastpnum;
void Scoreboard_UpdatePlayerTeams()
{
+ static float update_time;
+ if (time <= update_time)
+ return;
+ update_time = time;
+
entity pl, tmp;
//int num = 0;
for(pl = players.sort_next; pl; pl = pl.sort_next)