From 082e72a88391747912ae3c8c0bcd679d290dd4ac Mon Sep 17 00:00:00 2001
From: z411 <z411@omaera.org>
Date: Wed, 9 Mar 2022 07:08:20 -0300
Subject: [PATCH] Added round number in countdown

---
 hud_luma.cfg                          | 2 +-
 qcsrc/client/announcer.qc             | 4 ++--
 qcsrc/client/hud/panel/centerprint.qc | 2 +-
 qcsrc/client/hud/panel/centerprint.qh | 6 +++---
 qcsrc/common/notifications/all.inc    | 2 +-
 qcsrc/common/stats.qh                 | 2 ++
 qcsrc/server/command/vote.qc          | 4 +++-
 qcsrc/server/round_handler.qc         | 5 ++++-
 8 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/hud_luma.cfg b/hud_luma.cfg
index bd0a1d93cd..0dc4fe8d11 100644
--- a/hud_luma.cfg
+++ b/hud_luma.cfg
@@ -275,7 +275,7 @@ seta hud_panel_centerprint_align "0.5"
 seta hud_panel_centerprint_flip "0"
 seta hud_panel_centerprint_fontscale "1.4"
 seta hud_panel_centerprint_fontscale_bold "2"
-seta hud_panel_centerprint_fontscale_bold "2.5"
+seta hud_panel_centerprint_fontscale_title "2.5"
 
 seta hud_panel_minigameboard_pos "0.22 0.15"
 seta hud_panel_minigameboard_size "0.50 0.60"
diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc
index 309d4a603a..9f502c387e 100644
--- a/qcsrc/client/announcer.qc
+++ b/qcsrc/client/announcer.qc
@@ -52,7 +52,7 @@ void Announcer_Countdown(entity this)
 	{
 		if(inround)
 		{
-			Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded);
+			Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded, STAT(ROUND_COUNT));
 			Notification annce_num = Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded);
 			if(annce_num != NULL)
 				Local_Notification(MSG_ANNCE, annce_num);
@@ -112,7 +112,7 @@ void Announcer_Gamestart()
 				centerprint_SetTitle(MapInfo_Type_ToText(gametype));
 
 			if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle
-			if(time > announcer_countdown.nextthink) // don't play it again if countdown was already going
+			if(!warmup_stage && time < STAT(GAMESTARTTIME))
 				Local_Notification(MSG_ANNCE, ANNCE_PREPARE);
 
 			announcer_countdown.nextthink = startTime - floor(startTime - time + 0.5); //synchronize nextthink to startTime
diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc
index c3022b396f..22824a1719 100644
--- a/qcsrc/client/hud/panel/centerprint.qc
+++ b/qcsrc/client/hud/panel/centerprint.qc
@@ -50,7 +50,7 @@ string centerprint_title;
 void centerprint_Add(int new_id, string strMessage, float duration, int countdown_num)
 {
 	TC(int, new_id); TC(int, countdown_num);
-	LOG_INFOF("centerprint_Add: ^2id: %d ^3dur: %d ^5countdown: %d\n'%s'", new_id, duration, countdown_num, strreplace("\n", "^7\\n^7", strMessage));
+	//LOG_INFOF("centerprint_Add: ^2id: %d ^3dur: %d ^5countdown: %d\n'%s'", new_id, duration, countdown_num, strreplace("\n", "^7\\n^7", strMessage));
 	int i, j;
 
 	if(strMessage == "" && new_id == 0)
diff --git a/qcsrc/client/hud/panel/centerprint.qh b/qcsrc/client/hud/panel/centerprint.qh
index ebc12ef59b..4a96d40c1a 100644
--- a/qcsrc/client/hud/panel/centerprint.qh
+++ b/qcsrc/client/hud/panel/centerprint.qh
@@ -14,9 +14,9 @@ float autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha = 0.5;
 float autocvar_hud_panel_centerprint_fade_subsequent_minfontsize = 0.75;
 float autocvar_hud_panel_centerprint_fade_minfontsize = 1;
 bool autocvar_hud_panel_centerprint_flip;
-float autocvar_hud_panel_centerprint_fontscale;
-float autocvar_hud_panel_centerprint_fontscale_bold = 1.4;
-float autocvar_hud_panel_centerprint_fontscale_title = 2;
+float autocvar_hud_panel_centerprint_fontscale = 1.4;
+float autocvar_hud_panel_centerprint_fontscale_bold = 2;
+float autocvar_hud_panel_centerprint_fontscale_title = 2.5;
 bool autocvar_hud_panel_centerprint_dynamichud = true;
 float autocvar_hud_panel_centerprint_time;
 
diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc
index ef68e00a3a..0b2f05a982 100644
--- a/qcsrc/common/notifications/all.inc
+++ b/qcsrc/common/notifications/all.inc
@@ -528,7 +528,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
 
     MSG_CENTER_NOTIF(COUNTDOWN_BEGIN,                   N_ENABLE,    0, 0, "",               CPID_ROUND,             "2 0",  _("^BOLDBegin!"), "")
     MSG_CENTER_NOTIF(COUNTDOWN_GAMESTART,               N_ENABLE,    0, 1, "",               CPID_ROUND,             "1 f1", _("^BGGame starts in\n^BOLD^COUNT"), "")
-    MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTART,              N_ENABLE,    0, 1, "",               CPID_ROUND,             "1 f1", _("^BGRound starts in\n^BOLD^COUNT"), "")
+    MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTART,              N_ENABLE,    0, 2, "f2",               CPID_ROUND,           "1 f1", _("^BGRound %s starts in\n^BOLD^COUNT"), "")
     MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTOP,               N_ENABLE,    0, 0, "",               CPID_ROUND,             "2 0",  _("^F4Round cannot start"), "")
 
     MSG_CENTER_NOTIF(ROUND_TIED,                        N_ENABLE,    0, 0, "",               CPID_ROUND,             "0 0",  _("^BGRound tied"), "")
diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh
index abadaa47de..e221421a3f 100644
--- a/qcsrc/common/stats.qh
+++ b/qcsrc/common/stats.qh
@@ -366,6 +366,7 @@ REGISTER_STAT(Q3COMPAT, int, q3compat)
 #include "physics/movetypes/movetypes.qh"
 float warmup_limit;
 float round_limit;
+int round_count;
 #endif
 
 #ifdef SVQC
@@ -405,6 +406,7 @@ REGISTER_STAT(MOVEVARS_AIRCONTROL, float)
 REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit)
 REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit)
 REGISTER_STAT(WARMUP_TIMELIMIT, float, warmup_limit)
+REGISTER_STAT(ROUND_COUNT, int, round_count)
 REGISTER_STAT(ROUND_TIMELIMIT, float, round_limit)
 #ifdef SVQC
 float autocvar_sv_wallfriction;
diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc
index 7ff8d2a133..727ac66e97 100644
--- a/qcsrc/server/command/vote.qc
+++ b/qcsrc/server/command/vote.qc
@@ -349,8 +349,10 @@ void reset_map(bool dorespawn, bool is_fake_round_start)
 			PlayerStats_GameReport_Reset_All();
 		}
 
-		if (round_handler_IsActive())
+		if (round_handler_IsActive()) {
+			round_count = 0;
 			round_handler_Reset(game_starttime);
+		}
 	}
 
 	if (shuffleteams_on_reset_map)
diff --git a/qcsrc/server/round_handler.qc b/qcsrc/server/round_handler.qc
index b63883dcc8..6b7549bf7d 100644
--- a/qcsrc/server/round_handler.qc
+++ b/qcsrc/server/round_handler.qc
@@ -35,7 +35,10 @@ void round_handler_Think(entity this)
 	{
 		if (this.canRoundStart() && !(autocvar_g_campaign && !campaign_bots_may_start))
 		{
-			if (this.cnt == this.count + 1) round_starttime = time + this.count;
+			if (this.cnt == this.count + 1) {
+				round_starttime = time + this.count;
+				++round_count;
+			}
 			int f = this.cnt - 1;
 			if (f == 0)
 			{
-- 
2.39.5