]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Update announcer countdown system with different types, update debugprint
authorSamual Lenks <samual@xonotic.org>
Sat, 24 Aug 2013 22:48:45 +0000 (18:48 -0400)
committerSamual Lenks <samual@xonotic.org>
Sat, 24 Aug 2013 22:48:45 +0000 (18:48 -0400)
qcsrc/client/announcer.qc
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/server/cl_client.qc

index abfb070a717ef4213b80e451a01db3c9df36d713..b53c04da052b048a233054639cbf659480d3cc34 100644 (file)
@@ -28,15 +28,14 @@ void Announcer_Countdown()
        else // countdown is still going
        {
                if(roundstarttime == starttime)
+               {
                        Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded);
+                       Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded));
+               }
                else
-                       Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_GAMESTART, countdown_rounded);
-
-               switch(countdown_rounded)
                {
-                       case 1: Local_Notification(MSG_ANNCE, ANNCE_NUM_1); break;
-                       case 2: Local_Notification(MSG_ANNCE, ANNCE_NUM_2); break;
-                       case 3: Local_Notification(MSG_ANNCE, ANNCE_NUM_3); break;
+                       Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_GAMESTART, countdown_rounded);
+                       Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_GAMESTART, countdown_rounded));
                }
 
                self.nextthink = (starttime - (countdown - 1));
index 70a7fc1e1e8550c92475521ffab9d4292935276d..4ed4a1f6c5f33458158c9532a4c3689f3c3fc1c5 100644 (file)
@@ -1340,23 +1340,80 @@ void Local_Notification_centerprint_generic(
 
 void Local_Notification(float net_type, float net_name, ...count)
 {
+       // check if this should be aborted
+       if(net_name == NOTIF_ABORT)
+       {
+               #ifdef NOTIFICATIONS_DEBUG
+               Debug_Notification(sprintf(
+                       "Local_Notification(%s, %s, ...);\n",
+                       Get_Notif_TypeName(net_type),
+                       "NOTIF_ABORT"
+               ));
+               #endif
+               return;
+       }
+       
        // check supplied type and name for errors
        string checkargs = Notification_CheckArgs_TypeName(net_type, net_name);
-       if(checkargs != "") { backtrace(sprintf("Incorrect usage of Local_Notification: %s\n", checkargs)); return; }
+       if(checkargs != "")
+       {
+               #ifdef NOTIFICATIONS_DEBUG
+               Debug_Notification(sprintf(
+                       "Local_Notification(%s, %d, ...);\n",
+                       Get_Notif_TypeName(net_type),
+                       Get_Notif_Ent(net_type, net_name).nent_name
+               ));
+               #endif
+               backtrace(sprintf("Incorrect usage of Local_Notification: %s\n", checkargs));
+               return;
+       }
 
+       // retreive entity of this notification
        entity notif = Get_Notif_Ent(net_type, net_name);
-       if not(notif) { backtrace("Local_Notification: Could not find notification entity!\n"); return; }
+       if not(notif)
+       {
+               #ifdef NOTIFICATIONS_DEBUG
+               Debug_Notification(sprintf(
+                       "Local_Notification(%s, %d, ...);\n",
+                       Get_Notif_TypeName(net_type),
+                       net_name
+               ));
+               #endif
+               backtrace("Local_Notification: Could not find notification entity!\n");
+               return;
+       }
+
+       // check if the notification is enabled
        if not(notif.nent_enabled)
        {
                #ifdef NOTIFICATIONS_DEBUG
                Debug_Notification(sprintf(
-                       "Local_Notification(%s, %s): Entity was disabled...\n",
+                       "Local_Notification(%s, %s, ...): Entity was disabled...\n",
                        Get_Notif_TypeName(net_type),
                        notif.nent_name
                ));
                #endif
                return;
        }
+
+       string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
+       string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
+       string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : "");
+       string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : "");
+       float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0);
+       float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0);
+       float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0);
+       float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
+
+       #ifdef NOTIFICATIONS_DEBUG
+       Debug_Notification(sprintf(
+               "Local_Notification(%s, %s, %s, %s);\n",
+               Get_Notif_TypeName(net_type),
+               notif.nent_name,
+               MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
+               sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
+       ));
+       #endif
        
        if((notif.nent_stringcount + notif.nent_floatcount) > count)
        {
@@ -1390,25 +1447,6 @@ void Local_Notification(float net_type, float net_name, ...count)
                ));
                return;
        }
-
-       string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
-       string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
-       string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : "");
-       string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : "");
-       float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0);
-       float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0);
-       float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0);
-       float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
-
-       #ifdef NOTIFICATIONS_DEBUG
-       Debug_Notification(sprintf(
-               "Local_Notification(%s, %s, %s, %s);\n",
-               Get_Notif_TypeName(net_type),
-               notif.nent_name,
-               MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
-               sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
-       ));
-       #endif
        
        switch(net_type)
        {
@@ -1663,9 +1701,6 @@ void Kill_Notification(
        float broadcast, entity client,
        float net_type, float net_name)
 {
-       string checkargs = Notification_CheckArgs(broadcast, client, 1, 1);
-       if(checkargs != "") { backtrace(sprintf("Incorrect usage of Kill_Notification: %s\n", checkargs)); return; }
-
        #ifdef NOTIFICATIONS_DEBUG
        Debug_Notification(sprintf(
                "Kill_Notification(%s, '%s', %s, %d);\n",
@@ -1675,6 +1710,9 @@ void Kill_Notification(
                net_name
        ));
        #endif
+       
+       string checkargs = Notification_CheckArgs(broadcast, client, 1, 1);
+       if(checkargs != "") { backtrace(sprintf("Incorrect usage of Kill_Notification: %s\n", checkargs)); return; }
 
        entity notif, net_notif;
        float killed_cpid = NO_CPID;
@@ -1757,13 +1795,28 @@ void Send_Notification(
        float net_type, float net_name,
        ...count)
 {
+       // check if this should be aborted
+       if(net_name == NOTIF_ABORT)
+       {
+               #ifdef NOTIFICATIONS_DEBUG
+               Debug_Notification(sprintf(
+                       "Send_Notification(%s, '%s', %s, %s, ...);\n",
+                       Get_Notif_BroadcastName(broadcast),
+                       client.classname,
+                       Get_Notif_TypeName(net_type),
+                       "NOTIF_ABORT"
+               ));
+               #endif
+               return;
+       }
+       
        // check supplied broadcast, target, type, and name for errors
        string checkargs = Notification_CheckArgs(broadcast, client, net_type, net_name);
        if(checkargs != "")
        {
                #ifdef NOTIFICATIONS_DEBUG
                Debug_Notification(sprintf(
-                       "Send_Notification(%s, '%s', %s, %d, ...);\n",
+                       "Send_Notification(%s, '%s', %s, %s, ...);\n",
                        Get_Notif_BroadcastName(broadcast),
                        client.classname,
                        Get_Notif_TypeName(net_type),
@@ -1774,7 +1827,7 @@ void Send_Notification(
                return;
        }
 
-       // retreive counts for the arguments of this notification
+       // retreive entity of this notification
        entity notif = Get_Notif_Ent(net_type, net_name);
        if not(notif)
        {
index 31b65888aa061c54f47e0fc1650282e569bd1b05..3d2d4969186bea4cdf04099d0a1fe26e07d34ffa 100644 (file)
@@ -11,7 +11,9 @@
 #define MSG_MULTI 5 // Subcall MSG_INFO and/or MSG_CENTER notifications
 #define MSG_CHOICE 6 // Choose which subcall wrapper to activate
 
-#define NO_MSG -12345 
+// negative confirmations
+#define NO_MSG       -12345  // allows various things to know when no information is added
+#define NOTIF_ABORT  -1234   // allows Send_Notification to safely abort sending
 
 #define EIGHT_VARS_TO_VARARGS_VARLIST \
        VARITEM(1, 0, s1) \
@@ -257,6 +259,56 @@ void Send_Notification_WOCOVA(
        MSG_ANNCE_NOTIF(2, ANNCE_NUM_8,                     CH_INFO, "8",                 VOL_BASEVOICE, ATTN_NONE) \
        MSG_ANNCE_NOTIF(2, ANNCE_NUM_9,                     CH_INFO, "9",                 VOL_BASEVOICE, ATTN_NONE) \
        MSG_ANNCE_NOTIF(2, ANNCE_NUM_10,                    CH_INFO, "10",                VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(2, ANNCE_NUM_GAMESTART_1,           CH_INFO, "1",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(2, ANNCE_NUM_GAMESTART_2,           CH_INFO, "2",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(2, ANNCE_NUM_GAMESTART_3,           CH_INFO, "3",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(2, ANNCE_NUM_GAMESTART_4,           CH_INFO, "4",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(2, ANNCE_NUM_GAMESTART_5,           CH_INFO, "5",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_GAMESTART_6,           CH_INFO, "6",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_GAMESTART_7,           CH_INFO, "7",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_GAMESTART_8,           CH_INFO, "8",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_GAMESTART_9,           CH_INFO, "9",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_GAMESTART_10,          CH_INFO, "10",                VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_1,                CH_INFO, "1",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_2,                CH_INFO, "2",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_3,                CH_INFO, "3",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_4,                CH_INFO, "4",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_5,                CH_INFO, "5",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_6,                CH_INFO, "6",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_7,                CH_INFO, "7",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_8,                CH_INFO, "8",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_9,                CH_INFO, "9",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_IDLE_10,               CH_INFO, "10",                VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_1,                CH_INFO, "1",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_2,                CH_INFO, "2",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_3,                CH_INFO, "3",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_4,                CH_INFO, "4",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_5,                CH_INFO, "5",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_6,                CH_INFO, "6",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_7,                CH_INFO, "7",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_8,                CH_INFO, "8",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_9,                CH_INFO, "9",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_KILL_10,               CH_INFO, "10",                VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_1,             CH_INFO, "1",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_2,             CH_INFO, "2",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_3,             CH_INFO, "3",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_4,             CH_INFO, "4",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_5,             CH_INFO, "5",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_6,             CH_INFO, "6",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_7,             CH_INFO, "7",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_8,             CH_INFO, "8",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_9,             CH_INFO, "9",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_RESPAWN_10,            CH_INFO, "10",                VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(2, ANNCE_NUM_ROUNDSTART_1,          CH_INFO, "1",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(2, ANNCE_NUM_ROUNDSTART_2,          CH_INFO, "2",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(2, ANNCE_NUM_ROUNDSTART_3,          CH_INFO, "3",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_ROUNDSTART_4,          CH_INFO, "4",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_ROUNDSTART_5,          CH_INFO, "5",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_ROUNDSTART_6,          CH_INFO, "6",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_ROUNDSTART_7,          CH_INFO, "7",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_ROUNDSTART_8,          CH_INFO, "8",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_ROUNDSTART_9,          CH_INFO, "9",                 VOL_BASEVOICE, ATTN_NONE) \
+       MSG_ANNCE_NOTIF(0, ANNCE_NUM_ROUNDSTART_10,         CH_INFO, "10",                VOL_BASEVOICE, ATTN_NONE) \
        MSG_ANNCE_NOTIF(2, ANNCE_PREPARE,                   CH_INFO, "prepareforbattle",  VOL_BASEVOICE, ATTN_NONE) \
        MSG_ANNCE_NOTIF(1, ANNCE_REMAINING_FRAG_1,          CH_INFO, "1fragleft",         VOL_BASEVOICE, ATTN_NONE) \
        MSG_ANNCE_NOTIF(1, ANNCE_REMAINING_FRAG_2,          CH_INFO, "2fragsleft",        VOL_BASEVOICE, ATTN_NONE) \
@@ -1099,7 +1151,7 @@ float NOTIF_CHOICE_COUNT;
 float NOTIF_CPID_COUNT;
 
 // notification limits -- INCREASE AS NECESSARY
-#define NOTIF_ANNCE_MAX   64
+#define NOTIF_ANNCE_MAX   200
 #define NOTIF_INFO_MAX    256
 #define NOTIF_CENTER_MAX  256
 #define NOTIF_MULTI_MAX   128
index 7fa2f576a64649cce85982cf908b5b4b0ae2a229..667e150cd1e71cf0051ebe707b93f55ad5ad65f3 100644 (file)
@@ -2588,21 +2588,113 @@ void dedicated_print(string input) // print(), but only print if the server is n
 #endif
 
 #ifndef MENUQC
-float Announcer_PickNumber(float num)
-{
-       switch(num)
-       {
-               case 10: num = ANNCE_NUM_10; break;
-               case 9:  num = ANNCE_NUM_9;  break;
-               case 8:  num = ANNCE_NUM_8;  break;
-               case 7:  num = ANNCE_NUM_7;  break;
-               case 6:  num = ANNCE_NUM_6;  break;
-               case 5:  num = ANNCE_NUM_5;  break;
-               case 4:  num = ANNCE_NUM_4;  break;
-               case 3:  num = ANNCE_NUM_3;  break;
-               case 2:  num = ANNCE_NUM_2;  break;
-               case 1:  num = ANNCE_NUM_1;  break;
-       }
-       return num;
+float Announcer_PickNumber(float type, float num)
+{
+       switch(type)
+       {
+               case CNT_GAMESTART:
+               {
+                       switch(num)
+                       {
+                               case 10: return ANNCE_NUM_GAMESTART_10;
+                               case 9:  return ANNCE_NUM_GAMESTART_9; 
+                               case 8:  return ANNCE_NUM_GAMESTART_8; 
+                               case 7:  return ANNCE_NUM_GAMESTART_7; 
+                               case 6:  return ANNCE_NUM_GAMESTART_6; 
+                               case 5:  return ANNCE_NUM_GAMESTART_5; 
+                               case 4:  return ANNCE_NUM_GAMESTART_4; 
+                               case 3:  return ANNCE_NUM_GAMESTART_3; 
+                               case 2:  return ANNCE_NUM_GAMESTART_2; 
+                               case 1:  return ANNCE_NUM_GAMESTART_1; 
+                       }
+                       break;
+               }
+               case CNT_IDLE:
+               {
+                       switch(num)
+                       {
+                               case 10: return ANNCE_NUM_IDLE_10;
+                               case 9:  return ANNCE_NUM_IDLE_9; 
+                               case 8:  return ANNCE_NUM_IDLE_8; 
+                               case 7:  return ANNCE_NUM_IDLE_7; 
+                               case 6:  return ANNCE_NUM_IDLE_6; 
+                               case 5:  return ANNCE_NUM_IDLE_5; 
+                               case 4:  return ANNCE_NUM_IDLE_4; 
+                               case 3:  return ANNCE_NUM_IDLE_3; 
+                               case 2:  return ANNCE_NUM_IDLE_2; 
+                               case 1:  return ANNCE_NUM_IDLE_1; 
+                       }
+                       break;
+               }
+               case CNT_KILL:
+               {
+                       switch(num)
+                       {
+                               case 10: return ANNCE_NUM_KILL_10;
+                               case 9:  return ANNCE_NUM_KILL_9; 
+                               case 8:  return ANNCE_NUM_KILL_8; 
+                               case 7:  return ANNCE_NUM_KILL_7; 
+                               case 6:  return ANNCE_NUM_KILL_6; 
+                               case 5:  return ANNCE_NUM_KILL_5; 
+                               case 4:  return ANNCE_NUM_KILL_4; 
+                               case 3:  return ANNCE_NUM_KILL_3; 
+                               case 2:  return ANNCE_NUM_KILL_2; 
+                               case 1:  return ANNCE_NUM_KILL_1; 
+                       }
+                       break;
+               }
+               case CNT_RESPAWN:
+               {
+                       switch(num)
+                       {
+                               case 10: return ANNCE_NUM_RESPAWN_10;
+                               case 9:  return ANNCE_NUM_RESPAWN_9; 
+                               case 8:  return ANNCE_NUM_RESPAWN_8; 
+                               case 7:  return ANNCE_NUM_RESPAWN_7; 
+                               case 6:  return ANNCE_NUM_RESPAWN_6; 
+                               case 5:  return ANNCE_NUM_RESPAWN_5; 
+                               case 4:  return ANNCE_NUM_RESPAWN_4; 
+                               case 3:  return ANNCE_NUM_RESPAWN_3; 
+                               case 2:  return ANNCE_NUM_RESPAWN_2; 
+                               case 1:  return ANNCE_NUM_RESPAWN_1; 
+                       }
+                       break;
+               }
+               case CNT_ROUNDSTART:
+               {
+                       switch(num)
+                       {
+                               case 10: return ANNCE_NUM_ROUNDSTART_10;
+                               case 9:  return ANNCE_NUM_ROUNDSTART_9; 
+                               case 8:  return ANNCE_NUM_ROUNDSTART_8; 
+                               case 7:  return ANNCE_NUM_ROUNDSTART_7; 
+                               case 6:  return ANNCE_NUM_ROUNDSTART_6; 
+                               case 5:  return ANNCE_NUM_ROUNDSTART_5; 
+                               case 4:  return ANNCE_NUM_ROUNDSTART_4; 
+                               case 3:  return ANNCE_NUM_ROUNDSTART_3; 
+                               case 2:  return ANNCE_NUM_ROUNDSTART_2; 
+                               case 1:  return ANNCE_NUM_ROUNDSTART_1; 
+                       }
+                       break;
+               }
+               default:
+               {
+                       switch(num)
+                       {
+                               case 10: return ANNCE_NUM_10;
+                               case 9:  return ANNCE_NUM_9; 
+                               case 8:  return ANNCE_NUM_8; 
+                               case 7:  return ANNCE_NUM_7; 
+                               case 6:  return ANNCE_NUM_6; 
+                               case 5:  return ANNCE_NUM_5; 
+                               case 4:  return ANNCE_NUM_4; 
+                               case 3:  return ANNCE_NUM_3; 
+                               case 2:  return ANNCE_NUM_2; 
+                               case 1:  return ANNCE_NUM_1; 
+                       }
+                       break;
+               }
+       }
+       return NOTIF_ABORT; // abort sending if none of these numbers were right
 }
 #endif
index e9bd01cfa4d34fdacb55dc1c16cd1a92b94ef1cd..96a8b680595581b649d05c7eed4767d4d4943e2e 100644 (file)
@@ -404,5 +404,11 @@ void dedicated_print(string input);
 #endif
 
 #ifndef MENUQC
-float Announcer_PickNumber(float num);
+#define CNT_NORMAL 1
+#define CNT_GAMESTART 2
+#define CNT_IDLE 3
+#define CNT_KILL 4
+#define CNT_RESPAWN 5
+#define CNT_ROUNDSTART 6
+float Announcer_PickNumber(float type, float num);
 #endif
index 90a7eeed8a51c564afaf1a8a352c63000c5ef9c8..479dea7599407b803bed7b34b3afd2a07d7032bc 100644 (file)
@@ -811,7 +811,7 @@ void KillIndicator_Think()
                if(IS_REAL_CLIENT(self.owner))
                {
                        if(self.cnt <= 10)
-                               { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(self.cnt)); }
+                               { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, self.cnt)); }
                }
                self.nextthink = time + 1;
                self.cnt -= 1;
@@ -1910,7 +1910,7 @@ void ShowRespawnCountdown()
                {
                        self.respawn_countdown = number - 1;
                        if(ceil(self.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
-                               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(number)); 
+                               { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
                }
        }
 }
@@ -2541,7 +2541,7 @@ void PlayerPostThink (void)
                        else if(timeleft <= 10)
                        {
                                if(timeleft != self.idlekick_lasttimeleft)
-                                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(timeleft));
+                                       { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft)); }
                                self.idlekick_lasttimeleft = timeleft;
                        }
                }