From 1e2f823dc628142f911534570b196e61eb3521f0 Mon Sep 17 00:00:00 2001
From: Samual Lenks <samual@xonotic.org>
Date: Sat, 20 Apr 2013 18:33:56 -0400
Subject: [PATCH] Move more things over to new system

---
 qcsrc/client/announcer.qc      |  2 +-
 qcsrc/common/notifications.qh  |  3 ++-
 qcsrc/server/arena.qc          | 11 +++++------
 qcsrc/server/cl_client.qc      |  5 -----
 qcsrc/server/command/common.qc |  4 ++--
 qcsrc/server/command/vote.qc   |  8 ++++----
 qcsrc/server/defs.qh           |  1 -
 qcsrc/server/g_world.qc        |  6 +++---
 8 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc
index 6074bf89a..9bbbbb967 100644
--- a/qcsrc/client/announcer.qc
+++ b/qcsrc/client/announcer.qc
@@ -27,7 +27,7 @@ void Announcer_Countdown()
 	
 	if(countdown <= 0) // countdown has finished, starttime is now
 	{
-		Local_Notification(MSG_MULTI, MULTI_BEGIN); 
+		Local_Notification(MSG_MULTI, MULTI_COUNTDOWN_BEGIN); 
 		announcer_5min = announcer_1min = FALSE; // reset maptime announcers now as well
 		remove(self);
 		return;
diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh
index 18628e082..c21488d36 100644
--- a/qcsrc/common/notifications.qh
+++ b/qcsrc/common/notifications.qh
@@ -606,7 +606,8 @@ void Send_Notification_WOVA(
 	MSG_MULTI_NOTIF(1, ITEM_WEAPON_NOAMMO,                   NO_MSG,       INFO_ITEM_WEAPON_NOAMMO,                   CENTER_ITEM_WEAPON_NOAMMO) \
 	MSG_MULTI_NOTIF(1, ITEM_WEAPON_PRIMORSEC,                NO_MSG,       INFO_ITEM_WEAPON_PRIMORSEC,                CENTER_ITEM_WEAPON_PRIMORSEC) \
 	MSG_MULTI_NOTIF(1, ITEM_WEAPON_UNAVAILABLE,              NO_MSG,       INFO_ITEM_WEAPON_UNAVAILABLE,              CENTER_ITEM_WEAPON_UNAVAILABLE) \
-	MSG_MULTI_NOTIF(1, MULTI_BEGIN,                          ANNCE_BEGIN,  NO_MSG,                                    CENTER_COUNTDOWN_BEGIN) \
+	MSG_MULTI_NOTIF(1, MULTI_ARENA_BEGIN,                    ANNCE_BEGIN,  NO_MSG,                                    CENTER_ARENA_BEGIN) \
+	MSG_MULTI_NOTIF(1, MULTI_COUNTDOWN_BEGIN,                ANNCE_BEGIN,  NO_MSG,                                    CENTER_COUNTDOWN_BEGIN) \
 	MSG_MULTI_NOTIF(1, WEAPON_ACCORDEON_MURDER,              NO_MSG,       INFO_WEAPON_ACCORDEON_MURDER,              NO_MSG) \
 	MSG_MULTI_NOTIF(1, WEAPON_ACCORDEON_SUICIDE,             NO_MSG,       INFO_WEAPON_ACCORDEON_SUICIDE,             CENTER_DEATH_SELF_GENERIC) \
 	MSG_MULTI_NOTIF(1, WEAPON_CRYLINK_MURDER,                NO_MSG,       INFO_WEAPON_CRYLINK_MURDER,                NO_MSG) \
diff --git a/qcsrc/server/arena.qc b/qcsrc/server/arena.qc
index 8a4a40430..34b81bb62 100644
--- a/qcsrc/server/arena.qc
+++ b/qcsrc/server/arena.qc
@@ -237,13 +237,13 @@ void Arena_Warmup()
 				warmup = time + autocvar_g_ca_warmup;
 			} else {
 				if(f == 5)
-					Announce("prepareforbattle");
+					Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_PREPARE);
 				else if(f == 3)
-					Announce("3");
+					Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_NUM_3);
 				else if(f == 2)
-					Announce("2");
+					Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_NUM_2);
 				else if(f == 1)
-					Announce("1");
+					Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_NUM_1);
 
 				Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ARENA_ROUNDSTART, f);
 			}
@@ -266,8 +266,7 @@ void Arena_Warmup()
 			else
 				reset_map(TRUE);
 		} else {
-			Announce("begin");
-			Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ARENA_BEGIN); 
+			Send_Notification(NOTIF_ALL, world, MSG_MULTI, MULTI_ARENA_BEGIN);
 		}
 
 		if(g_arena) {
diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc
index 4c7d5c575..5322371f9 100644
--- a/qcsrc/server/cl_client.qc
+++ b/qcsrc/server/cl_client.qc
@@ -6,11 +6,6 @@ void send_CSQC_teamnagger() {
 	WriteByte(MSG_BROADCAST, TE_CSQC_TEAMNAGGER);
 }
 
-void Announce(string snd) {
-	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
-	WriteByte(MSG_BROADCAST, TE_CSQC_ANNOUNCE);
-	WriteString(MSG_BROADCAST, snd);
-}
 
 void AnnounceTo(entity e, string snd) {
 	if (clienttype(e) == CLIENTTYPE_REAL)
diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc
index e95cf4c65..132a0af70 100644
--- a/qcsrc/server/command/common.qc
+++ b/qcsrc/server/command/common.qc
@@ -182,7 +182,7 @@ void timeout_handler_think()
 				Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TIMEOUT_ENDING, timeout_time);
 
 				if(timeout_time == autocvar_sv_timeout_resumetime) // play a warning sound when only <sv_timeout_resumetime> seconds are left
-					Announce("prepareforbattle");
+					Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_PREPARE);
 
 				self.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second
 				timeout_time -= 1; // decrease the time counter
@@ -575,7 +575,7 @@ void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMAN
 					timeout_handler.think = timeout_handler_think;
 					timeout_handler.nextthink = time; // always let the entity think asap
 
-					Announce("timeoutcalled");
+					Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_TIMEOUT);
 				}
 			}
 			else { print_to(caller, "^1Timeouts are not allowed to be called, enable them with sv_timeout 1.\n"); }
diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc
index 329fb9d4e..059a51939 100644
--- a/qcsrc/server/command/vote.qc
+++ b/qcsrc/server/command/vote.qc
@@ -148,21 +148,21 @@ void VoteAccept()
 	if(vote_caller) { vote_caller.vote_waittime = 0; } // people like your votes, you don't need to wait to vote again
 
 	VoteReset();
-	Announce("voteaccept");
+	Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_ACCEPT);
 }
 
 void VoteReject() 
 {
 	bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2's vote for ", vote_called_display, "^2 was rejected\n");
 	VoteReset();
-	Announce("votefail");
+	Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_FAIL);
 }
 
 void VoteTimeout() 
 {
 	bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2's vote for ", vote_called_display, "^2 timed out\n");
 	VoteReset();
-	Announce("votefail");
+	Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_FAIL);
 }
 
 void VoteSpam(float notvoters, float mincount, string result)
@@ -725,7 +725,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
 				}
 				
 				FOR_EACH_REALCLIENT(tmp_player) { ++tmp_playercount; }
-				if(tmp_playercount > 1) { Announce("votecall"); } // don't announce a "vote now" sound if player is alone
+				if(tmp_playercount > 1) { Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_VOTE_CALL); } // don't announce a "vote now" sound if player is alone
 				
 				bprint("\{1}^2* ^3", GetCallerName(vote_caller), "^2 calls a vote for ", vote_called_display, "\n");
 				if(autocvar_sv_eventlog) { GameLogEcho(strcat(":vote:vcall:", ftos(vote_caller.playerid), ":", vote_called_display)); }
diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh
index 668433ce0..13b2dc7a0 100644
--- a/qcsrc/server/defs.qh
+++ b/qcsrc/server/defs.qh
@@ -281,7 +281,6 @@ float default_weapon_alpha;
 .float cvar_cl_allow_uidtracking;
 .string stored_netname;
 
-void Announce(string snd);
 void AnnounceTo(entity e, string snd);
 
 .float version_nagtime;
diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc
index a9b958568..25cd56658 100644
--- a/qcsrc/server/g_world.qc
+++ b/qcsrc/server/g_world.qc
@@ -1961,11 +1961,11 @@ float WinningCondition_Scores(float limit, float leadlimit)
 
 			if (limit)
 			if (leaderfrags == limit - 1)
-				Announce("1fragleft");
+				Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_REMAINING_FRAG_1);
 			else if (leaderfrags == limit - 2)
-				Announce("2fragsleft");
+				Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_REMAINING_FRAG_2);
 			else if (leaderfrags == limit - 3)
-				Announce("3fragsleft");
+				Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_REMAINING_FRAG_3);
 		}
 	}
 
-- 
2.39.5