]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move flag capture verbosity to MSG_CHOICE, plus fix some various things
authorSamual Lenks <samual@xonotic.org>
Fri, 23 Aug 2013 23:24:56 +0000 (19:24 -0400)
committerSamual Lenks <samual@xonotic.org>
Fri, 23 Aug 2013 23:24:56 +0000 (19:24 -0400)
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qh

index dbfe88258a042edb2852ccdac28e9717e5fe231a..4683d1b2d838f9321be66b2268d8ee7572c7094e 100644 (file)
@@ -104,14 +104,16 @@ string Notification_CheckArgs(
                }
                
                case NOTIF_TEAM:
+               {
+                       if not(teamplay) { checkargs = sprintf("%sTeamplay not active!", checkargs); }
+                       else if not(client.team) { checkargs = sprintf("%sNo team provided!", checkargs); }
+                       break;
+               }
+               
                case NOTIF_TEAM_EXCEPT:
                {
                        if not(teamplay) { checkargs = sprintf("%sTeamplay not active!", checkargs); }
-                       else if(IS_NOT_A_CLIENT(client))
-                       {
-                               if(broadcast == NOTIF_TEAM) { checkargs = sprintf("%sNo client provided!", checkargs); }
-                               else { checkargs = sprintf("%sException can't be a non-client!", checkargs); }
-                       }
+                       else if(IS_NOT_A_CLIENT(client)) { checkargs = sprintf("%sException can't be a non-client!", checkargs); }
                        break;
                }
                
@@ -1758,11 +1760,37 @@ void Send_Notification(
 {
        // check supplied broadcast, target, type, and name for errors
        string checkargs = Notification_CheckArgs(broadcast, client, net_type, net_name);
-       if(checkargs != "") { backtrace(sprintf("Incorrect usage of Send_Notification: %s\n", checkargs)); return; }
+       if(checkargs != "")
+       {
+               #ifdef NOTIFICATIONS_DEBUG
+               Debug_Notification(sprintf(
+                       "Send_Notification(%s, '%s', %s, %d, ...);\n",
+                       Get_Notif_BroadcastName(broadcast),
+                       client.classname,
+                       Get_Notif_TypeName(net_type),
+                       Get_Notif_Ent(net_type, net_name).nent_name
+               ));
+               #endif
+               backtrace(sprintf("Incorrect usage of Send_Notification: %s\n", checkargs));
+               return;
+       }
 
        // retreive counts for the arguments of this notification
        entity notif = Get_Notif_Ent(net_type, net_name);
-       if not(notif) { backtrace("Send_Notification: Could not find notification entity!\n"); return; }
+       if not(notif)
+       {
+               #ifdef NOTIFICATIONS_DEBUG
+               Debug_Notification(sprintf(
+                       "Send_Notification(%s, '%s', %s, %d, ...);\n",
+                       Get_Notif_BroadcastName(broadcast),
+                       client.classname,
+                       Get_Notif_TypeName(net_type),
+                       net_name
+               ));
+               #endif
+               backtrace("Send_Notification: Could not find notification entity!\n");
+               return;
+       }
 
        string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
        string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
@@ -1775,8 +1803,9 @@ void Send_Notification(
 
        #ifdef NOTIFICATIONS_DEBUG
        Debug_Notification(sprintf(
-               "Send_Notification(%s, %s, %s, %s, %s);\n",
+               "Send_Notification(%s, '%s', %s, %s, %s, %s);\n",
                Get_Notif_BroadcastName(broadcast),
+               client.classname,
                Get_Notif_TypeName(net_type),
                notif.nent_name,
                MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
@@ -1788,11 +1817,12 @@ void Send_Notification(
        {
                backtrace(sprintf(
                        strcat(
-                               "Not enough arguments for Send_Notification(%s, %s, %s, ...)! ",
+                               "Not enough arguments for Send_Notification(%s, '%s', %s, %s, ...)! ",
                                "stringcount(%d) + floatcount(%d) > count(%d)\n", 
                                "Check the definition and function call for accuracy...?\n"
                        ),
                        Get_Notif_BroadcastName(broadcast),
+                       client.classname,
                        Get_Notif_TypeName(net_type), notif.nent_name,
                        notif.nent_stringcount, notif.nent_floatcount, count
                ));
@@ -1802,11 +1832,12 @@ void Send_Notification(
        {
                backtrace(sprintf(
                        strcat(
-                               "Too many arguments for Send_Notification(%s, %s, %s, ...)! ",
+                               "Too many arguments for Send_Notification(%s, '%s', %s, %s, ...)! ",
                                "stringcount(%d) + floatcount(%d) < count(%d)\n",
                                "Check the definition and function call for accuracy...?\n"
                        ),
                        Get_Notif_BroadcastName(broadcast),
+                       client.classname,
                        Get_Notif_TypeName(net_type), notif.nent_name,
                        notif.nent_stringcount, notif.nent_floatcount, count
                ));
@@ -1927,8 +1958,9 @@ void Send_Notification_WOVA(
        #ifdef NOTIFICATIONS_DEBUG
        entity notif = Get_Notif_Ent(net_type, net_name);
        Debug_Notification(sprintf(
-               "Send_Notification_WOVA(%s, %s, %d, %d, %d, %s, %s);\n",
+               "Send_Notification_WOVA(%s, '%s', %s, %s, %d, %d, %s, %s);\n",
                Get_Notif_BroadcastName(broadcast),
+               client.classname,
                Get_Notif_TypeName(net_type),
                notif.nent_name,
                stringcount,
@@ -1957,8 +1989,9 @@ void Send_Notification_WOCOVA(
        
        #ifdef NOTIFICATIONS_DEBUG
        Debug_Notification(sprintf(
-               "Send_Notification_WOCOVA(%s, %s, %s, %s, %s);\n",
+               "Send_Notification_WOCOVA(%s, '%s', %s, %s, %s, %s);\n",
                Get_Notif_BroadcastName(broadcast),
+               client.classname,
                Get_Notif_TypeName(net_type),
                notif.nent_name,
                MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
index e4ac3e26f0773063e9af9916186b49bb6fab026b..31b65888aa061c54f47e0fc1650282e569bd1b05 100644 (file)
@@ -737,12 +737,15 @@ void Send_Notification_WOCOVA(
                MSG_CHOICE_NOTIF(default, challow, prefix##PINK, chtype, optiona##PINK, optionb##PINK) \
        #endif
 #define MSG_CHOICE_NOTIFICATIONS \
-       MSG_CHOICE_NOTIF(1, 2, CHOICE_CTF_PICKUP_TEAM,   MSG_CENTER,  CENTER_CTF_PICKUP_TEAM,           CENTER_CTF_PICKUP_TEAM_VERBOSE) \
-       MSG_CHOICE_NOTIF(1, 2, CHOICE_CTF_PICKUP_ENEMY,  MSG_CENTER,  CENTER_CTF_PICKUP_ENEMY,          CENTER_CTF_PICKUP_ENEMY_VERBOSE) \
-       MSG_CHOICE_NOTIF(1, 1, CHOICE_FRAG,              MSG_CENTER,  CENTER_DEATH_MURDER_FRAG,         CENTER_DEATH_MURDER_FRAG_VERBOSE) \
-       MSG_CHOICE_NOTIF(1, 1, CHOICE_FRAGGED,           MSG_CENTER,  CENTER_DEATH_MURDER_FRAGGED,      CENTER_DEATH_MURDER_FRAGGED_VERBOSE) \
-       MSG_CHOICE_NOTIF(1, 1, CHOICE_TYPEFRAG,          MSG_CENTER,  CENTER_DEATH_MURDER_TYPEFRAG,     CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE) \
-       MSG_CHOICE_NOTIF(1, 1, CHOICE_TYPEFRAGGED,       MSG_CENTER,  CENTER_DEATH_MURDER_TYPEFRAGGED,  CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE)
+       MULTITEAM_CHOICE(1, 2, CHOICE_CTF_CAPTURE_BROKEN_, 2,    MSG_INFO,    INFO_CTF_CAPTURE_,                INFO_CTF_CAPTURE_BROKEN_) \
+       MULTITEAM_CHOICE(1, 2, CHOICE_CTF_CAPTURE_TIME_, 2,      MSG_INFO,    INFO_CTF_CAPTURE_,                INFO_CTF_CAPTURE_TIME_) \
+       MULTITEAM_CHOICE(1, 2, CHOICE_CTF_CAPTURE_UNBROKEN_, 2,  MSG_INFO,    INFO_CTF_CAPTURE_,                INFO_CTF_CAPTURE_UNBROKEN_) \
+       MSG_CHOICE_NOTIF(1, 2, CHOICE_CTF_PICKUP_TEAM,           MSG_CENTER,  CENTER_CTF_PICKUP_TEAM,           CENTER_CTF_PICKUP_TEAM_VERBOSE) \
+       MSG_CHOICE_NOTIF(1, 2, CHOICE_CTF_PICKUP_ENEMY,          MSG_CENTER,  CENTER_CTF_PICKUP_ENEMY,          CENTER_CTF_PICKUP_ENEMY_VERBOSE) \
+       MSG_CHOICE_NOTIF(1, 1, CHOICE_FRAG,                      MSG_CENTER,  CENTER_DEATH_MURDER_FRAG,         CENTER_DEATH_MURDER_FRAG_VERBOSE) \
+       MSG_CHOICE_NOTIF(1, 1, CHOICE_FRAGGED,                   MSG_CENTER,  CENTER_DEATH_MURDER_FRAGGED,      CENTER_DEATH_MURDER_FRAGGED_VERBOSE) \
+       MSG_CHOICE_NOTIF(1, 1, CHOICE_TYPEFRAG,                  MSG_CENTER,  CENTER_DEATH_MURDER_TYPEFRAG,     CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE) \
+       MSG_CHOICE_NOTIF(1, 1, CHOICE_TYPEFRAGGED,               MSG_CENTER,  CENTER_DEATH_MURDER_TYPEFRAGGED,  CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE)
        //MSG_CHOICE_NOTIF(2, CHOICE_)
 
 
@@ -1100,7 +1103,7 @@ float NOTIF_CPID_COUNT;
 #define NOTIF_INFO_MAX    256
 #define NOTIF_CENTER_MAX  256
 #define NOTIF_MULTI_MAX   128
-#define NOTIF_CHOICE_MAX  8
+#define NOTIF_CHOICE_MAX  16
 #define NOTIF_CPID_MAX    256 // should match NOTIF_CENTER_MAX
 
 // notification entities
index 2daadd4f7e1a30fe1999ad153cf38e5aba6b26c1..e4b3a04e35da6fc90578092009b4c8f4391b378a 100644 (file)
@@ -22,34 +22,14 @@ void ctf_EventLog(string mode, float flagteam, entity actor) // use an alias for
 
 void ctf_CaptureRecord(entity flag, entity player)
 {
-       entity tmp_entity;
        float cap_record = ctf_captimerecord;
        float cap_time = (time - flag.ctf_pickuptime);
        string refername = db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"));
        
        // notify about shit
-       FOR_EACH_REALCLIENT(tmp_entity)
-       {
-               if(tmp_entity.CAPTURE_VERBOSE)
-               {
-                       if(!ctf_captimerecord) { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
-                       else if(cap_time < cap_record) { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
-                       else { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
-               }
-               else { Send_Notification(NOTIF_ONE_ONLY, tmp_entity, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_), player.netname); }
-       }
-
-       // the previous notification broadcast is only sent to real clients, this will notify server log too
-       if(server_is_dedicated)
-       {
-               if(autocvar_notification_ctf_capture_verbose)
-               {
-                       if(!ctf_captimerecord) { Local_Notification(MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
-                       else if(cap_time < cap_record) { Local_Notification(MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
-                       else { Local_Notification(MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
-               }
-               else { Local_Notification(MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_), player.netname); }
-       }
+       if(!ctf_captimerecord) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_2(flag, CHOICE_CTF_CAPTURE_TIME_), player.netname, (cap_time * 100)); }
+       else if(cap_time < cap_record) { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_2(flag, CHOICE_CTF_CAPTURE_BROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
+       else { Send_Notification(NOTIF_ALL, world, MSG_CHOICE, APP_TEAM_ENT_2(flag, CHOICE_CTF_CAPTURE_UNBROKEN_), player.netname, refername, (cap_time * 100), (cap_record * 100)); }
        
        // write that shit in the database
        if((!ctf_captimerecord) || (cap_time < cap_record))
@@ -500,10 +480,13 @@ void ctf_Handle_Pickup(entity flag, entity player, float pickuptype)
 
        // messages and sounds
        Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_PICKUP_), player.netname);
+       
        Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PICKUP_));
        if(ctf_stalemate) { Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER); }
-       Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CENTER, CHOICE_CTF_PICKUP_TEAM, Team_ColorCode(player.team), player.netname);
-       Send_Notification(NOTIF_TEAM, flag, MSG_CENTER, CHOICE_CTF_PICKUP_ENEMY, Team_ColorCode(player.team), player.netname);
+       
+       Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, CHOICE_CTF_PICKUP_TEAM, Team_ColorCode(player.team), player.netname);
+       Send_Notification(NOTIF_TEAM, flag, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY, Team_ColorCode(player.team), player.netname);
+       
        sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTN_NONE);
        
        // scoring
@@ -2001,12 +1984,6 @@ MUTATOR_HOOKFUNCTION(ctf_BotRoles)
        return TRUE;
 }
 
-MUTATOR_HOOKFUNCTION(ctf_GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, CAPTURE_VERBOSE, "notification_ctf_capture_verbose");
-       return TRUE;
-}
-
 
 // ==========
 // Spawnfuncs
@@ -2191,7 +2168,6 @@ MUTATOR_DEFINITION(gamemode_ctf)
        MUTATOR_HOOK(VehicleExit, ctf_VehicleExit, CBC_ORDER_ANY);
        MUTATOR_HOOK(AbortSpeedrun, ctf_AbortSpeedrun, CBC_ORDER_ANY);
        MUTATOR_HOOK(HavocBot_ChooseRule, ctf_BotRoles, CBC_ORDER_ANY);
-       MUTATOR_HOOK(GetCvars, ctf_GetCvars, CBC_ORDER_ANY);
        
        MUTATOR_ONADD
        {
index d03582389e5ffe5cdd246c3be61dce84e11e0129..58699208e502280984a37c070ff332d066ab8b2f 100644 (file)
@@ -131,8 +131,4 @@ vector havocbot_ctf_middlepoint;
 float havocbot_ctf_middlepoint_radius;
 
 void havocbot_role_ctf_setrole(entity bot, float role);
-
-// client notification stuff
-.float CAPTURE_VERBOSE;
 #endif
-var float autocvar_notification_ctf_capture_verbose = FALSE;