From 79a65d1d054de243ac53152c5a44fcc104641e38 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Wed, 21 Aug 2013 19:23:26 -0400 Subject: [PATCH] Now add some cvar handling and move frag messages to MSG_CHOICE system --- qcsrc/common/notifications.qc | 34 ++++++++++++++------ qcsrc/common/notifications.qh | 2 +- qcsrc/server/g_damage.qc | 59 ++++++++++++++++++++++++----------- 3 files changed, 65 insertions(+), 30 deletions(-) diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index f941dbebc..187e2e480 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -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: diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 02cd56880..ce0c61831 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -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_) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index bd4fe2b8b..7e764ccf5 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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)) -- 2.39.2