]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Now add some cvar handling and move frag messages to MSG_CHOICE system
authorSamual Lenks <samual@xonotic.org>
Wed, 21 Aug 2013 23:23:26 +0000 (19:23 -0400)
committerSamual Lenks <samual@xonotic.org>
Wed, 21 Aug 2013 23:23:26 +0000 (19:23 -0400)
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/server/g_damage.qc

index f941dbebc871c8eac1047032f3b5505a7bb7ae3d..187e2e4807e98b53f1ff79163979298ed3961378 100644 (file)
@@ -829,10 +829,30 @@ void Create_Notification_Entity(
 }
 
 
-// =========================================
-//  Cvar Handling With 'dumpnotifs' Command
-// =========================================
+// ===============
+//  Cvar Handling
+// ===============
 
+// used by MSG_CHOICE to build list of choices
+#ifdef SVQC
+void Notification_GetCvars(void)
+{
+       float i;
+       for(i = 0; i <= NOTIF_CHOICE_COUNT; ++i)
+       {
+               GetCvars_handleFloat(
+                       get_cvars_s,
+                       get_cvars_f,
+                       msg_choice_choices[i],
+                       sprintf("notification_%s", msg_choice_notifs[i].nent_name)
+               );
+       }
+
+       GetCvars_handleFloat(get_cvars_s, get_cvars_f, FRAG_VERBOSE, "notification_frag_verbose");
+}
+#endif
+
+// used to output notifications.cfg file
 void Dump_Notifications(float fh, float alsoprint)
 {
        #define NOTIF_WRITE(a) { \
@@ -1072,13 +1092,6 @@ void Dump_Notifications(float fh, float alsoprint)
        #undef NOTIF_WRITE
 }
 
-#ifdef SVQC
-void Notification_GetCvars()
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, FRAG_VERBOSE, "notification_frag_verbose");
-}
-#endif
-
 
 // ===============================
 //  Frontend Notification Pushing
@@ -1765,6 +1778,7 @@ void Send_Notification(
 
        if(net_type == MSG_CHOICE)
        {
+               // float verbose_allowed = (autocvar_notification_server_allows_frag_verbose && ((autocvar_notification_server_allows_frag_verbose == 2) || inWarmupStage));
                // THIS GETS TRICKY... now we have to cycle through each possible player (checking broadcast)
                // and then do an individual NOTIF_ONE_ONLY recursive call for each one depending on their option...
                // It's slow, but it's better than the alternatives:
index 02cd5688071fde3c962d3bc5a73d75d90a4e063b..ce0c618319d938ba4889e4470e751ba54d878cf2 100644 (file)
@@ -718,7 +718,7 @@ void Send_Notification_WOVA(
        MSG_CHOICE_NOTIF(1, CHOICE_FRAG,          MSG_CENTER,  CENTER_DEATH_MURDER_FRAG,         CENTER_DEATH_MURDER_FRAG_VERBOSE) \
        MSG_CHOICE_NOTIF(1, CHOICE_FRAGGED,       MSG_CENTER,  CENTER_DEATH_MURDER_FRAGGED,      CENTER_DEATH_MURDER_FRAGGED_VERBOSE) \
        MSG_CHOICE_NOTIF(1, CHOICE_TYPEFRAG,      MSG_CENTER,  CENTER_DEATH_MURDER_TYPEFRAG,     CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE) \
-       MSG_CHOICE_NOTIF(1, CHOICE_TYPERFRAGGED,  MSG_CENTER,  CENTER_DEATH_MURDER_TYPEFRAGGED,  CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE)
+       MSG_CHOICE_NOTIF(1, CHOICE_TYPEFRAGGED,   MSG_CENTER,  CENTER_DEATH_MURDER_TYPEFRAGGED,  CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE)
        //MSG_CHOICE_NOTIF(2, CHOICE_)
 
 
index bd4fe2b8b07a143b9c9009b70b8ab36283e1bacb..7e764ccf5a3b7389a33e927d8047ddfd25c64a7e 100644 (file)
@@ -462,30 +462,51 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
                                kill_count_to_target = 0;
                        }
 
-                       float verbose_allowed = (autocvar_notification_server_allows_frag_verbose && ((autocvar_notification_server_allows_frag_verbose == 2) || inWarmupStage));
                        if(targ.istypefrag)
                        {
-                               if(attacker.FRAG_VERBOSE && verbose_allowed)
-                                       Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping));
-                               else
-                                       Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG, targ.netname, kill_count_to_attacker);
-
-                               if(targ.FRAG_VERBOSE && verbose_allowed)
-                                       Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping));
-                               else
-                                       Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED, attacker.netname, kill_count_to_target);
+                               Send_Notification(
+                                       NOTIF_ONE,
+                                       attacker,
+                                       MSG_CHOICE,
+                                       CHOICE_TYPEFRAG,
+                                       targ.netname,
+                                       kill_count_to_attacker,
+                                       (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping)
+                               );
+                               Send_Notification(
+                                       NOTIF_ONE,
+                                       targ,
+                                       MSG_CHOICE,
+                                       CHOICE_TYPEFRAGGED,
+                                       attacker.netname,
+                                       kill_count_to_target,
+                                       attacker.health,
+                                       attacker.armorvalue,
+                                       (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping)
+                               );
                        }
                        else
                        {
-                               if(attacker.FRAG_VERBOSE && verbose_allowed)
-                                       Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_FRAG_VERBOSE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping));
-                               else
-                                       Send_Notification(NOTIF_ONE, attacker, MSG_CENTER, CENTER_DEATH_MURDER_FRAG, targ.netname, kill_count_to_attacker);
-
-                               if(targ.FRAG_VERBOSE && verbose_allowed)
-                                       Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED_VERBOSE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping));
-                               else
-                                       Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED, attacker.netname, kill_count_to_target);
+                               Send_Notification(
+                                       NOTIF_ONE,
+                                       attacker,
+                                       MSG_CHOICE,
+                                       CHOICE_FRAG,
+                                       targ.netname,
+                                       kill_count_to_attacker,
+                                       (IS_BOT_CLIENT(targ) ? NO_MSG : targ.ping)
+                               );
+                               Send_Notification(
+                                       NOTIF_ONE,
+                                       targ,
+                                       MSG_CHOICE,
+                                       CHOICE_FRAGGED,
+                                       attacker.netname,
+                                       kill_count_to_target,
+                                       attacker.health,
+                                       attacker.armorvalue,
+                                       (IS_BOT_CLIENT(attacker) ? NO_MSG : attacker.ping)
+                               );
                        }
 
                        if not(Obituary_WeaponDeath(targ, TRUE, deathtype, targ.netname, attacker.netname, deathlocation, targ.killcount, kill_count_to_attacker))