2 #include "../client/announcer.qh"
5 #include "constants.qh"
7 #include "../server/autocvars.qh"
8 #include "../server/constants.qh"
9 #include "../server/defs.qh"
10 #include "notifications.qh"
11 #include <server/mutators/all.qh>
14 // ================================================
15 // Unified notification system, written by Samual
16 // Last updated: August, 2013
17 // ================================================
20 string Notification_CheckArgs(
21 NOTIF broadcast, entity client,
22 Notification net_name)
24 // check supplied broadcast, target, type, and name for errors
25 string checkargs = "";
26 if (!net_name) { checkargs = "No notification provided! "; }
32 if (IS_NOT_A_CLIENT(client)) {
33 checkargs = sprintf("%sNo client provided!", checkargs);
38 case NOTIF_ALL_EXCEPT:
40 if (IS_NOT_A_CLIENT(client)) {
41 checkargs = sprintf("%sException can't be a non-client!", checkargs);
49 checkargs = sprintf("%sEntity provided when world was required!", checkargs);
57 checkargs = sprintf("%sTeamplay not active!", checkargs);
58 } else if (!client.team) {
59 // checkargs = sprintf("%sNo team provided!", checkargs);
64 case NOTIF_TEAM_EXCEPT:
67 checkargs = sprintf("%sTeamplay not active!", checkargs);
68 } else if (IS_NOT_A_CLIENT(client)) {
69 checkargs = sprintf("%sException can't be a non-client!", checkargs);
76 checkargs = sprintf("%sImproper broadcast: %d!", checkargs, broadcast);
83 bool Notification_ShouldSend(NOTIF broadcast, entity to_client, entity other_client)
89 (to_client == other_client)
94 (to_client.enemy == other_client)
98 return (to_client == other_client);
101 (to_client.team == other_client.team)
106 (to_client.enemy.team == other_client.team)
109 case NOTIF_TEAM_EXCEPT:
111 (to_client != other_client)
114 (to_client.team == other_client.team)
120 (to_client.enemy != other_client)
122 (to_client.enemy.team == other_client.team)
129 case NOTIF_ALL_EXCEPT:
131 (to_client != other_client)
136 (to_client.enemy == other_client)
146 // ===============================
147 // Initialization Core Functions
148 // ===============================
150 // used by restartnotifs command to initialize notifications
151 void Destroy_Notification_Entity(entity notif)
153 if (notif.nent_name != "") strunzone(notif.nent_name);
154 if (notif.nent_snd != "") strunzone(notif.nent_snd);
155 if (notif.nent_args != "") strunzone(notif.nent_args);
156 if (notif.nent_hudargs != "") strunzone(notif.nent_hudargs);
157 if (notif.nent_icon != "") strunzone(notif.nent_icon);
158 if (notif.nent_durcnt != "") strunzone(notif.nent_durcnt);
159 if (notif.nent_string != "") strunzone(notif.nent_string);
163 void Destroy_All_Notifications()
165 // kill all networked notifications and centerprints
167 Kill_Notification(NOTIF_ALL, NULL, MSG_Null, 0);
169 reset_centerprint_messages();
172 // kill all real notification entities
173 FOREACH(Notifications, true, { Destroy_Notification_Entity(it); });
176 string Process_Notif_Line(
185 if(typeId == MSG_INFO)
187 if((chat && autocvar_notification_allow_chatboxprint)
188 || (autocvar_notification_allow_chatboxprint == 2))
190 // pass 1: add ETX char at beginning of line
191 input = strcat("\{3}", input);
193 // pass 2: add ETX char at end of each new line (so that
194 // messages with multiple lines are put through chatbox too)
195 input = strreplace("\n", "\n\{3}", input);
197 // pass 3: strip trailing ETX char
198 if(substring(input, (strlen(input) - 1), 1) == "\{3}")
199 { input = substring(input, 0, (strlen(input) - 1)); }
204 // done to both MSG_INFO and MSG_CENTER
205 if(substring(input, (strlen(input) - 1), 1) == "\n")
209 "^1TRAILING NEW LINE AT END OF NOTIFICATION: "
210 "^7net_type = %s, net_name = %s, string = %s.\n"
217 input = substring(input, 1, (strlen(input) - 1));
223 string Process_Notif_Args(
229 string selected, remaining = args;
232 for (;(remaining != "");)
234 selected = car(remaining); remaining = cdr(remaining);
238 case 1: // normal args
240 if(sel_num == NOTIF_MAX_ARGS)
244 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
245 "^7net_type = %s, net_name = %s, max args = %d.\n"
255 switch(strtolower(selected))
257 #define ARG_CASE_ARG_CS_SV_HA(selected,result) case selected: { ++sel_num; break; }
258 #define ARG_CASE_ARG_CS_SV_DC(selected,result) case selected: { ++sel_num; break; }
259 #define ARG_CASE_ARG_CS_SV(selected,result) case selected: { ++sel_num; break; }
260 #define ARG_CASE_ARG_CS(selected,result) case selected: { ++sel_num; break; }
261 #define ARG_CASE_ARG_SV(selected,result) case selected: { ++sel_num; break; }
262 #define ARG_CASE_ARG_DC(selected,result)
263 #define ARG_CASE(prog,selected,result) ARG_CASE_##prog(selected,result)
266 #undef ARG_CASE_ARG_DC
267 #undef ARG_CASE_ARG_SV
268 #undef ARG_CASE_ARG_CS
269 #undef ARG_CASE_ARG_CS_SV
270 #undef ARG_CASE_ARG_CS_SV_DC
271 #undef ARG_CASE_ARG_CS_SV_HA
276 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
277 "^7net_type = %s, net_name = %s, args arg = '%s'.\n"
291 if(sel_num == NOTIF_MAX_HUDARGS)
295 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
296 "^7net_type = %s, net_name = %s, max hudargs = %d.\n"
306 switch(strtolower(selected))
308 #define ARG_CASE_ARG_CS_SV_HA(selected,result) case selected: { ++sel_num; break; }
309 #define ARG_CASE_ARG_CS_SV_DC(selected,result)
310 #define ARG_CASE_ARG_CS_SV(selected,result)
311 #define ARG_CASE_ARG_CS(selected,result)
312 #define ARG_CASE_ARG_SV(selected,result)
313 #define ARG_CASE_ARG_DC(selected,result)
314 #define ARG_CASE(prog,selected,result) ARG_CASE_##prog(selected,result)
317 #undef ARG_CASE_ARG_DC
318 #undef ARG_CASE_ARG_SV
319 #undef ARG_CASE_ARG_CS
320 #undef ARG_CASE_ARG_CS_SV
321 #undef ARG_CASE_ARG_CS_SV_DC
322 #undef ARG_CASE_ARG_CS_SV_HA
327 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
328 "^7net_type = %s, net_name = %s, hudargs arg = '%s'.\n"
342 if(sel_num == NOTIF_MAX_DURCNT)
346 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
347 "^7net_type = %s, net_name = %s, max durcnt = %d.\n"
357 switch(strtolower(selected))
359 #define ARG_CASE_ARG_CS_SV_HA(selected,result)
360 #define ARG_CASE_ARG_CS_SV_DC(selected,result) case selected: { ++sel_num; break; }
361 #define ARG_CASE_ARG_CS_SV(selected,result)
362 #define ARG_CASE_ARG_CS(selected,result)
363 #define ARG_CASE_ARG_SV(selected,result)
364 #define ARG_CASE_ARG_DC(selected,result) case selected: { ++sel_num; break; }
365 #define ARG_CASE(prog,selected,result) ARG_CASE_##prog(selected,result)
368 #undef ARG_CASE_ARG_DC
369 #undef ARG_CASE_ARG_SV
370 #undef ARG_CASE_ARG_CS
371 #undef ARG_CASE_ARG_CS_SV
372 #undef ARG_CASE_ARG_CS_SV_DC
373 #undef ARG_CASE_ARG_CS_SV_HA
376 if(ftos(stof(selected)) != "") { ++sel_num; }
381 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
382 "^7net_type = %s, net_name = %s, durcnt arg = '%s'.\n"
400 void Create_Notification_Entity(entity notif,
406 // =====================
407 // Global Entity Setup
408 // =====================
409 notif.nent_default = var_default;
410 notif.nent_enabled = (var_cvar >= 1);
411 notif.nent_type = typeId;
412 notif.nent_name = strzone(namestring);
414 // Other pre-notif-setup requisites
428 "^1NOTIFICATION WITH IMPROPER TYPE: "
429 "^7net_type = %d, net_name = %s.\n"
438 // now check to see if any errors happened
441 notif.nent_enabled = false; // disable the notification so it can't cause trouble
442 notif_global_error = true; // throw the red flag that an error happened on init
446 void Create_Notification_Entity_Annce(entity notif,
455 // Set MSG_ANNCE information and handle precaching
457 MSG typeId = MSG_ANNCE;
458 if (!(GENTLE && (var_cvar == 1)))
462 if(notif.nent_enabled)
464 precache_sound(sprintf("announcer/%s/%s.wav", AnnouncerOption(), snd));
465 notif.nent_channel = channel;
466 notif.nent_snd = strzone(snd);
467 notif.nent_vol = vol;
468 notif.nent_position = position;
473 string typestring = Get_Notif_TypeName(typeId);
476 "^1NOTIFICATION WITH NO SOUND: "
477 "^7net_type = %s, net_name = %s.\n"
485 else { notif.nent_enabled = false; }
487 notif.nent_enabled = false;
492 void Create_Notification_Entity_InfoCenter(entity notif,
497 /* MSG_INFO & MSG_CENTER */
506 MSG typeId = notif.nent_type;
507 // Set MSG_INFO and MSG_CENTER string/float counts
508 notif.nent_stringcount = strnum;
509 notif.nent_floatcount = flnum;
511 // Only initialize arguments if we're either a client or on a dedicated server
513 float should_process_args = server_is_dedicated;
515 float should_process_args = true;
517 string typestring = Get_Notif_TypeName(typeId);
518 if(should_process_args)
520 // ========================
521 // Process Main Arguments
522 // ========================
527 notif.nent_args = strzone(
528 Process_Notif_Args(1, args, typestring, namestring));
530 else if((hudargs == "") && (durcnt ==""))
534 "^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: "
535 "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d\n"
547 notif.nent_args = strzone(
548 Process_Notif_Args(1, args, typestring, namestring));
552 // =======================================
553 // Process HUD and Centerprint Arguments
554 // Only processed on CSQC, as these
555 // args are only for HUD features.
556 // =======================================
560 notif.nent_hudargs = strzone(
561 Process_Notif_Args(2, hudargs, typestring, namestring));
563 if(icon != "") { notif.nent_icon = strzone(icon); }
568 "^1NOTIFICATION HAS HUDARGS BUT NO ICON: "
569 "^7net_type = %s, net_name = %s.\n"
581 "^1NOTIFICATION HAS ICON BUT NO HUDARGS: "
582 "^7net_type = %s, net_name = %s.\n"
592 notif.nent_durcnt = strzone(
593 Process_Notif_Args(3, durcnt, typestring, namestring));
595 if(cpid != NO_MSG_) { notif.nent_cpid = cpid; }
600 "^1NOTIFICATION HAS DURCNT BUT NO CPID: "
601 "^7net_type = %s, net_name = %s.\n"
609 else if(cpid != NO_MSG_) { notif.nent_cpid = cpid; }
613 // ======================
614 // Process Notif String
615 // ======================
616 #define SET_NOTIF_STRING(string,stringname) MACRO_BEGIN { \
617 notif.nent_string = strzone(CCR( \
618 Process_Notif_Line( \
631 if(gentle != "") { SET_NOTIF_STRING(gentle, "GENTLE"); }
632 else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL"); }
634 else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL"); }
635 #undef SET_NOTIF_STRING
637 // Check to make sure a string was chosen
638 if(notif.nent_string == "")
642 "^1EMPTY NOTIFICATION: "
643 "^7net_type = %s, net_name = %s.\n"
653 void Create_Notification_Entity_Multi(entity notif,
657 Notification anncename,
658 Notification infoname,
659 Notification centername)
661 MSG typeId = MSG_MULTI;
662 // Set MSG_MULTI string/float counts
663 if((anncename == NO_MSG) && (infoname == NO_MSG) && (centername == NO_MSG))
665 string typestring = Get_Notif_TypeName(typeId);
668 "^1NOTIFICATION WITH NO SUBCALLS: "
669 "^7net_type = %s, net_name = %s.\n"
678 // announcements don't actually need any arguments, so lets not even count them.
679 if(anncename != NO_MSG) { notif.nent_msgannce = anncename; }
681 float infoname_stringcount = 0, infoname_floatcount = 0;
682 float centername_stringcount = 0, centername_floatcount = 0;
684 if(infoname != NO_MSG)
686 notif.nent_msginfo = infoname;
687 infoname_stringcount = notif.nent_msginfo.nent_stringcount;
688 infoname_floatcount = notif.nent_msginfo.nent_floatcount;
691 if(centername != NO_MSG)
693 notif.nent_msgcenter = centername;
694 centername_stringcount = notif.nent_msgcenter.nent_stringcount;
695 centername_floatcount = notif.nent_msgcenter.nent_floatcount;
698 // set the requirements of THIS notification to the totals of its subcalls
699 notif.nent_stringcount = max(infoname_stringcount, centername_stringcount);
700 notif.nent_floatcount = max(infoname_floatcount, centername_floatcount);
704 void Create_Notification_Entity_Choice(entity notif,
711 Notification optiona,
712 Notification optionb)
714 MSG typeId = MSG_CHOICE;
715 if((chtype == MSG_Null) || (optiona == NO_MSG) || (optionb == NO_MSG))
717 string typestring = Get_Notif_TypeName(typeId);
720 "^1NOTIFICATION IS MISSING CHOICE PARAMS: "
721 "^7net_type = %s, net_name = %s.\n"
730 notif.nent_optiona = optiona;
731 notif.nent_optionb = optionb;
732 notif.nent_challow_def = challow_def; // 0: never allowed, 1: allowed in warmup, 2: always allowed
733 notif.nent_challow_var = challow_var; // 0: never allowed, 1: allowed in warmup, 2: always allowed
734 notif.nent_stringcount = max(notif.nent_optiona.nent_stringcount, notif.nent_optionb.nent_stringcount);
735 notif.nent_floatcount = max(notif.nent_optiona.nent_floatcount, notif.nent_optionb.nent_floatcount);
737 /*#ifdef NOTIFICATIONS_DEBUG
738 Debug_Notification(sprintf(
739 "Create_Notification_Entity(...): MSG_CHOICE: %s\n%s\n%s\n",
742 "^ optiona: %s %s : %d %d",
743 Get_Notif_TypeName(notif.nent_optiona.nent_type),
744 notif.nent_optiona.nent_name,
745 notif.nent_optiona.nent_stringcount,
746 notif.nent_optiona.nent_floatcount
749 "^ optionb: %s %s : %d %d",
750 Get_Notif_TypeName(notif.nent_optionb.nent_type),
751 notif.nent_optionb.nent_name,
752 notif.nent_optionb.nent_stringcount,
753 notif.nent_optionb.nent_floatcount
765 // used by MSG_CHOICE to build list of choices
767 void Notification_GetCvars()
770 FOREACH(Notifications, it.nent_type == MSG_CHOICE, {
771 GetCvars_handleFloat(
774 msg_choice_choices[idx++],
775 sprintf("notification_%s", it.nent_name)
781 /** used to output notifications.cfg file */
782 void Dump_Notifications(int fh, bool alsoprint)
784 #define NOTIF_WRITE(a) MACRO_BEGIN { \
786 if (alsoprint) LOG_INFO(a); \
789 #define NOTIF_WRITE_ENTITY(e, description) MACRO_BEGIN { \
790 string notif_msg = sprintf( \
791 "seta notification_%s \"%d\" \"%s\"\n", \
792 e.nent_name, e.nent_default, description \
794 NOTIF_WRITE(notif_msg); \
797 #define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb) MACRO_BEGIN { \
798 string notif_msg = sprintf( \
799 "seta notification_%s \"%d\" \"%s\"\n" \
800 "seta notification_%s_ALLOWED \"%d\" \"%s\"\n", \
801 e.nent_name, e.nent_default, descriptiona, \
802 e.nent_name, e.nent_challow_def, descriptionb \
804 NOTIF_WRITE(notif_msg); \
807 #define NOTIF_WRITE_HARDCODED(cvar, default, description) MACRO_BEGIN { \
808 string notif_msg = sprintf( \
809 "seta notification_%s \"%s\" \"%s\"\n", \
810 cvar, default, description \
812 NOTIF_WRITE(notif_msg); \
815 // Note: This warning only applies to the notifications.cfg file that is output...
816 // You ARE supposed to manually edit this function to add i.e. hard coded
817 // notification variables for mutators or game modes or such and then
818 // regenerate the notifications.cfg file from the new code.
820 NOTIF_WRITE("// ********************************************** //\n");
821 NOTIF_WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n");
822 NOTIF_WRITE("// ** ** //\n");
823 NOTIF_WRITE("// ** This file is automatically generated ** //\n");
824 NOTIF_WRITE("// ** by code with the command 'dumpnotifs'. ** //\n");
825 NOTIF_WRITE("// ** ** //\n");
826 NOTIF_WRITE("// ** If you add a new notification, please ** //\n");
827 NOTIF_WRITE("// ** regenerate this file with that command ** //\n");
828 NOTIF_WRITE("// ** making sure that the output matches ** //\n");
829 NOTIF_WRITE("// ** with the lists and defaults in code. ** //\n");
830 NOTIF_WRITE("// ** ** //\n");
831 NOTIF_WRITE("// ********************************************** //\n");
833 // These notifications will also append their string as a comment...
834 // This is not necessary, and does not matter if they vary between config versions,
835 // it is just a semi-helpful tool for those who want to manually change their user settings.
837 int NOTIF_ANNCE_COUNT = 0; FOREACH(Notifications, it.nent_type == MSG_ANNCE, { ++NOTIF_ANNCE_COUNT; });
838 NOTIF_WRITE(sprintf("\n// MSG_ANNCE notifications (count = %d):\n", NOTIF_ANNCE_COUNT));
839 FOREACH(Notifications, it.nent_type == MSG_ANNCE, {
840 NOTIF_WRITE_ENTITY(it,
841 "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled"
845 int NOTIF_INFO_COUNT = 0; FOREACH(Notifications, it.nent_type == MSG_INFO, { ++NOTIF_INFO_COUNT; });
846 NOTIF_WRITE(sprintf("\n// MSG_INFO notifications (count = %d):\n", NOTIF_INFO_COUNT));
847 FOREACH(Notifications, it.nent_type == MSG_INFO, {
848 NOTIF_WRITE_ENTITY(it,
849 "0 = off, 1 = print to console, "
850 "2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
854 int NOTIF_CENTER_COUNT = 0; FOREACH(Notifications, it.nent_type == MSG_CENTER, { ++NOTIF_CENTER_COUNT; });
855 NOTIF_WRITE(sprintf("\n// MSG_CENTER notifications (count = %d):\n", NOTIF_CENTER_COUNT));
856 FOREACH(Notifications, it.nent_type == MSG_CENTER, {
857 NOTIF_WRITE_ENTITY(it,
858 "0 = off, 1 = centerprint"
862 int NOTIF_MULTI_COUNT = 0; FOREACH(Notifications, it.nent_type == MSG_MULTI, { ++NOTIF_MULTI_COUNT; });
863 NOTIF_WRITE(sprintf("\n// MSG_MULTI notifications (count = %d):\n", NOTIF_MULTI_COUNT));
864 FOREACH(Notifications, it.nent_type == MSG_MULTI, {
865 NOTIF_WRITE_ENTITY(it,
866 "Enable this multiple notification"
870 int NOTIF_CHOICE_COUNT = 0; FOREACH(Notifications, it.nent_type == MSG_CHOICE, { ++NOTIF_CHOICE_COUNT; });
871 NOTIF_WRITE(sprintf("\n// MSG_CHOICE notifications (count = %d):\n", NOTIF_CHOICE_COUNT));
872 FOREACH(Notifications, it.nent_type == MSG_CHOICE, {
873 NOTIF_WRITE_ENTITY_CHOICE(it,
874 "Choice for this notification 0 = off, 1 = default message, 2 = verbose message",
875 "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always"
879 // edit these to match whichever cvars are used for specific notification options
880 NOTIF_WRITE("\n// HARD CODED notification variables:\n");
882 NOTIF_WRITE_HARDCODED(
883 "allow_chatboxprint", "1",
884 "Allow INFO notifications to be printed to chat box"
886 "1 = allow only if allowed by individual notification_INFO* cvars, "
887 "2 = force all INFO notifications to be printed to the chatbox"
890 NOTIF_WRITE_HARDCODED(
892 "Print extra debug information on all notification function calls "
893 "(Requires -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation)... "
894 "0 = disabled, 1 = dprint, 2 = print"
897 NOTIF_WRITE_HARDCODED(
898 "errors_are_fatal", "1",
899 "If a notification fails upon initialization, cause a Host_Error to stop the program"
902 NOTIF_WRITE_HARDCODED(
903 "item_centerprinttime", "1.5",
904 "How long to show item information centerprint messages (like 'You got the Electro' or such)"
907 NOTIF_WRITE_HARDCODED(
908 "lifetime_mapload", "10",
909 "Amount of time that notification entities last immediately at mapload (in seconds) "
910 "to help prevent notifications from being lost on early init (like gamestart countdown)"
913 NOTIF_WRITE_HARDCODED(
914 "lifetime_runtime", "0.5",
915 "Amount of time that notification entities last on the server during runtime (In seconds)"
918 NOTIF_WRITE_HARDCODED(
919 "server_allows_location", "1",
920 "Server side cvar for allowing death messages to show location information too"
923 NOTIF_WRITE_HARDCODED(
924 "show_location", "0",
925 "Append location information to MSG_INFO death/kill messages"
928 NOTIF_WRITE_HARDCODED(
929 "show_location_string", "",
930 "Replacement string piped into sprintf, "
931 "so you can do different messages like this: ' at the %s' or ' (near %s)'"
934 NOTIF_WRITE_HARDCODED(
936 "Print information about sprees in death/kill messages"
939 NOTIF_WRITE_HARDCODED(
940 "show_sprees_center", "1",
941 "Show spree information in MSG_CENTER messages... "
942 "0 = off, 1 = target (but only for first victim) and attacker"
945 NOTIF_WRITE_HARDCODED(
946 "show_sprees_center_specialonly", "1",
947 "Don't show spree information in MSG_CENTER messages if it isn't an achievement"
950 NOTIF_WRITE_HARDCODED(
951 "show_sprees_info", "3",
952 "Show spree information in MSG_INFO messages... "
953 "0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker"
956 NOTIF_WRITE_HARDCODED(
957 "show_sprees_info_newline", "1",
958 "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
961 NOTIF_WRITE_HARDCODED(
962 "show_sprees_info_specialonly", "1",
963 "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement"
968 "\n// Notification counts (total = %d): "
969 "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n"
984 #undef NOTIF_WRITE_HARDCODED
985 #undef NOTIF_WRITE_ENTITY
990 // ===============================
991 // Frontend Notification Pushing
992 // ===============================
994 string Local_Notification_sprintf(
995 string input, string args,
996 string s1, string s2, string s3, string s4,
997 int f1, float f2, float f3, float f4)
999 #ifdef NOTIFICATIONS_DEBUG
1000 Debug_Notification(sprintf(
1001 "Local_Notification_sprintf('%s^7', '%s', %s, %s);\n",
1002 MakeConsoleSafe(input),
1004 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1005 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1009 for (int sel_num = 0; sel_num < NOTIF_MAX_ARGS; ++sel_num) { arg_slot[sel_num] = ""; }
1011 for (int sel_num = 0; (args != ""); )
1013 string selected = car(args); args = cdr(args);
1014 NOTIF_HIT_MAX(NOTIF_MAX_ARGS, "Local_Notification_sprintf");
1015 string tmp_s; // used by NOTIF_ARGUMENT_LIST
1016 switch (strtolower(selected))
1018 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: { arg_slot[sel_num++] = result; break; }
1019 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: { arg_slot[sel_num++] = result; break; }
1020 #define ARG_CASE_ARG_CS_SV(selected, result) case selected: { arg_slot[sel_num++] = result; break; }
1022 #define ARG_CASE_ARG_CS(selected, result) case selected: { arg_slot[sel_num++] = result; break; }
1023 #define ARG_CASE_ARG_SV(selected, result)
1025 #define ARG_CASE_ARG_CS(selected, result)
1026 #define ARG_CASE_ARG_SV(selected, result) case selected: { arg_slot[sel_num++] = result; break; }
1028 #define ARG_CASE_ARG_DC(selected, result)
1029 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
1032 #undef ARG_CASE_ARG_DC
1033 #undef ARG_CASE_ARG_SV
1034 #undef ARG_CASE_ARG_CS
1035 #undef ARG_CASE_ARG_CS_SV
1036 #undef ARG_CASE_ARG_CS_SV_DC
1037 #undef ARG_CASE_ARG_CS_SV_HA
1038 default: NOTIF_HIT_UNKNOWN(NOTIF_MAX_ARGS, "Local_Notification_sprintf")
1042 strcat(input, "\n"),
1054 void Local_Notification_sound(
1055 int soundchannel, string soundfile,
1056 float soundvolume, float soundposition)
1058 if ((soundfile != prev_soundfile) || (time >= (prev_soundtime + autocvar_cl_announcer_antispam)))
1060 #ifdef NOTIFICATIONS_DEBUG
1061 Debug_Notification(sprintf(
1062 "Local_Notification_sound(%f, '%s', %f, %f);\n",
1065 "announcer/%s/%s.wav",
1078 "announcer/%s/%s.wav",
1086 if (prev_soundfile) strunzone(prev_soundfile);
1087 prev_soundfile = strzone(soundfile);
1088 prev_soundtime = time;
1092 #ifdef NOTIFICATIONS_DEBUG
1093 Debug_Notification(sprintf(
1095 "Local_Notification_sound(world, %f, '%s', %f, %f) "
1096 "^1BLOCKED BY ANTISPAM:^7 prevsnd: '%s', timediff: %f, limit: %f\n"
1100 "announcer/%s/%s.wav",
1107 (time - prev_soundtime),
1108 autocvar_cl_announcer_antispam
1114 void Local_Notification_HUD_Notify_Push(
1115 string icon, string hudargs,
1116 string s1, string s2, string s3, string s4,
1117 float f1, float f2, float f3, float f4)
1119 arg_slot[0] = ""; arg_slot[1] = "";
1121 for (int sel_num = 0; (hudargs != ""); )
1123 string selected = car(hudargs); hudargs = cdr(hudargs);
1124 NOTIF_HIT_MAX(NOTIF_MAX_HUDARGS, "Local_Notification_HUD_Notify_Push");
1125 switch (strtolower(selected))
1127 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: { arg_slot[sel_num++] = result; break; }
1128 #define ARG_CASE_ARG_CS_SV_DC(selected, result)
1129 #define ARG_CASE_ARG_CS_SV(selected, result)
1130 #define ARG_CASE_ARG_CS(selected, result)
1131 #define ARG_CASE_ARG_SV(selected, result)
1132 #define ARG_CASE_ARG_DC(selected, result)
1133 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
1136 #undef ARG_CASE_ARG_DC
1137 #undef ARG_CASE_ARG_SV
1138 #undef ARG_CASE_ARG_CS
1139 #undef ARG_CASE_ARG_CS_SV
1140 #undef ARG_CASE_ARG_CS_SV_DC
1141 #undef ARG_CASE_ARG_CS_SV_HA
1142 default: NOTIF_HIT_UNKNOWN(NOTIF_MAX_HUDARGS, "Local_Notification_HUD_Notify_Push")
1145 #ifdef NOTIFICATIONS_DEBUG
1146 Debug_Notification(sprintf(
1147 "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s, %s);\n",
1150 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1151 sprintf("%d, %d, %d, %d", f1, f2, f3, f4),
1152 MakeConsoleSafe(sprintf("'%s^7', '%s^7'", stof(arg_slot[0]), stof(arg_slot[1])))
1155 HUD_Notify_Push(icon, arg_slot[0], arg_slot[1]);
1158 void Local_Notification_centerprint_generic(
1159 string input, string durcnt,
1160 int cpid, float f1, float f2)
1162 arg_slot[0] = ""; arg_slot[1] = "";
1164 for (int sel_num = 0; (durcnt != ""); )
1166 string selected = car(durcnt); durcnt = cdr(durcnt);
1167 NOTIF_HIT_MAX(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic");
1168 switch (strtolower(selected))
1170 #define ARG_CASE_ARG_CS_SV_HA(selected, result)
1171 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: { arg_slot[sel_num++] = result; break; }
1172 #define ARG_CASE_ARG_CS_SV(selected, result)
1173 #define ARG_CASE_ARG_CS(selected, result)
1174 #define ARG_CASE_ARG_SV(selected, result)
1175 #define ARG_CASE_ARG_DC(selected, result) case selected: { arg_slot[sel_num++] = result; break; }
1176 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected,result)
1179 #undef ARG_CASE_ARG_DC
1180 #undef ARG_CASE_ARG_SV
1181 #undef ARG_CASE_ARG_CS
1182 #undef ARG_CASE_ARG_CS_SV
1183 #undef ARG_CASE_ARG_CS_SV_DC
1184 #undef ARG_CASE_ARG_CS_SV_HA
1187 if (/* wtf */ ftos(stof(selected)) != "") { arg_slot[sel_num++] = selected; }
1188 else { NOTIF_HIT_UNKNOWN(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic") }
1193 #ifdef NOTIFICATIONS_DEBUG
1194 Debug_Notification(sprintf(
1195 "Local_Notification_centerprint_generic('%s^7', '%s', %d, %d, %d, %d);\n",
1196 MakeConsoleSafe(input),
1203 centerprint_generic(cpid, input, stof(arg_slot[0]), stof(arg_slot[1]));
1207 void Local_Notification(MSG net_type, Notification net_name, ...count)
1209 // check if this should be aborted
1210 if (net_name == NOTIF_ABORT)
1212 #ifdef NOTIFICATIONS_DEBUG
1213 Debug_Notification(sprintf(
1214 "Local_Notification(%s, %s, ...);\n",
1215 Get_Notif_TypeName(net_type),
1222 // retreive entity of this notification
1223 entity notif = net_name;
1226 #ifdef NOTIFICATIONS_DEBUG
1227 Debug_Notification(sprintf(
1228 "Local_Notification(%s, %d, ...);\n",
1229 Get_Notif_TypeName(net_type),
1233 backtrace(sprintf("Incorrect usage of Local_Notification: %s\n", "Null notification"));
1237 // check if the notification is enabled
1238 if (!notif.nent_enabled)
1240 #ifdef NOTIFICATIONS_DEBUG
1241 Debug_Notification(sprintf(
1242 "Local_Notification(%s, %s, ...): Entity was disabled...\n",
1243 Get_Notif_TypeName(net_type),
1250 string s1 = ((notif.nent_stringcount > 0) ? ...(0, string) : "");
1251 string s2 = ((notif.nent_stringcount > 1) ? ...(1, string) : "");
1252 string s3 = ((notif.nent_stringcount > 2) ? ...(2, string) : "");
1253 string s4 = ((notif.nent_stringcount > 3) ? ...(3, string) : "");
1254 float f1 = ((notif.nent_floatcount > 0) ? ...((notif.nent_stringcount + 0), float) : 0);
1255 float f2 = ((notif.nent_floatcount > 1) ? ...((notif.nent_stringcount + 1), float) : 0);
1256 float f3 = ((notif.nent_floatcount > 2) ? ...((notif.nent_stringcount + 2), float) : 0);
1257 float f4 = ((notif.nent_floatcount > 3) ? ...((notif.nent_stringcount + 3), float) : 0);
1259 #ifdef NOTIFICATIONS_DEBUG
1260 Debug_Notification(sprintf(
1261 "Local_Notification(%s, %s, %s, %s);\n",
1262 Get_Notif_TypeName(net_type),
1264 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1265 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1269 if ((notif.nent_stringcount + notif.nent_floatcount) != count)
1273 "Arguments mismatch for Local_Notification(%s, %s, ...)! "
1274 "stringcount(%d) + floatcount(%d) != count(%d)\n"
1275 "Check the definition and function call for accuracy...?\n"
1277 Get_Notif_TypeName(net_type),
1279 notif.nent_stringcount,
1280 notif.nent_floatcount,
1291 Local_Notification_sound(
1298 backtrace("MSG_ANNCE on server?... Please notify Samual immediately!\n");
1306 Local_Notification_sprintf(
1313 if (notif.nent_icon != "")
1315 if (notif.nent_iconargs != "")
1317 string s = Local_Notification_sprintf(
1318 notif.nent_icon,notif.nent_iconargs,
1319 s1, s2, s3, s4, f1, f2, f3, f4);
1320 // remove the trailing newline
1321 notif.nent_icon = strzone(substring(s, 0, -1));
1323 Local_Notification_HUD_Notify_Push(
1336 Local_Notification_centerprint_generic(
1337 Local_Notification_sprintf(
1351 if (notif.nent_msginfo && notif.nent_msginfo.nent_enabled)
1353 Local_Notification_WOVA(
1356 notif.nent_msginfo.nent_stringcount,
1357 notif.nent_msginfo.nent_floatcount,
1362 if (notif.nent_msgannce && notif.nent_msgannce.nent_enabled)
1364 Local_Notification_WOVA(
1366 notif.nent_msgannce,
1371 if (notif.nent_msgcenter && notif.nent_msgcenter.nent_enabled)
1373 Local_Notification_WOVA(
1375 notif.nent_msgcenter,
1376 notif.nent_msgcenter.nent_stringcount,
1377 notif.nent_msgcenter.nent_floatcount,
1387 entity found_choice = notif.nent_optiona;
1388 if (notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) {
1389 switch (cvar(sprintf("notification_%s", notif.nent_name)))
1392 case 2: found_choice = notif.nent_optionb; break;
1393 default: return; // not enabled anyway
1397 Local_Notification_WOVA(
1398 found_choice.nent_type,
1400 found_choice.nent_stringcount,
1401 found_choice.nent_floatcount,
1408 // WOVA = Without Variable Arguments
1409 void Local_Notification_WOVA(
1410 MSG net_type, Notification net_name,
1411 float stringcount, float floatcount,
1412 string s1, string s2, string s3, string s4,
1413 float f1, float f2, float f3, float f4)
1415 #define VARITEM(stringc, floatc, args) \
1416 if ((stringcount == stringc) && (floatcount == floatc)) \
1417 { Local_Notification(net_type, net_name, args); return; }
1418 EIGHT_VARS_TO_VARARGS_VARLIST
1420 Local_Notification(net_type, net_name); // some notifications don't have any arguments at all
1424 // =========================
1425 // Notification Networking
1426 // =========================
1428 /** networked as a linked entity to give newly connecting clients some notification context */
1429 REGISTER_NET_LINKED(ENT_CLIENT_NOTIFICATION)
1432 NET_HANDLE(ENT_CLIENT_NOTIFICATION, bool is_new)
1435 MSG net_type = ENUMCAST(MSG, ReadByte());
1436 int net_name = ReadShort();
1437 Notification notif = Get_Notif_Ent(net_type, net_name);
1439 #ifdef NOTIFICATIONS_DEBUG
1440 Debug_Notification(sprintf(
1441 "Read_Notification(%d) at %f: net_type = %s, net_name = %s (%d)\n",
1444 Get_Notif_TypeName(net_type),
1445 notif.registered_id,
1450 if (net_type == MSG_CENTER_CPID)
1454 if (!is_new) return;
1455 if (net_name == NO_CPID) {
1457 "Read_Notification(%d) at %f: ^1TRIED TO KILL NO_CPID CENTERPRINT!\n",
1463 if (net_name == 0) {
1465 reset_centerprint_messages();
1469 centerprint_generic(net_name, "", 0, 0);
1476 backtrace("Read_Notification: Could not find notification entity!\n");
1480 string s1 = ((notif.nent_stringcount > 0) ? ReadString() : "");
1481 string s2 = ((notif.nent_stringcount > 1) ? ReadString() : "");
1482 string s3 = ((notif.nent_stringcount > 2) ? ReadString() : "");
1483 string s4 = ((notif.nent_stringcount > 3) ? ReadString() : "");
1484 float f1 = ((notif.nent_floatcount > 0) ? ReadLong() : 0);
1485 float f2 = ((notif.nent_floatcount > 1) ? ReadLong() : 0);
1486 float f3 = ((notif.nent_floatcount > 2) ? ReadLong() : 0);
1487 float f4 = ((notif.nent_floatcount > 3) ? ReadLong() : 0);
1491 if (!is_new) return;
1492 Local_Notification_WOVA(
1494 notif.nent_stringcount,
1495 notif.nent_floatcount,
1504 void Net_Notification_Remove()
1507 #ifdef NOTIFICATIONS_DEBUG
1508 Debug_Notification(sprintf(
1509 "Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
1511 ((this.nent_net_name == -1) ? "Killed" : "Removed"),
1512 Get_Notif_TypeName(this.nent_net_type),
1513 this.owner.nent_name
1516 for (int i = 0; i < this.nent_stringcount; ++i) { if (this.nent_strings[i]) strunzone(this.nent_strings[i]); }
1520 bool Net_Write_Notification(entity this, entity client, int sf)
1522 if (!Notification_ShouldSend(this.nent_broadcast, client, this.nent_client)) return false;
1523 WriteHeader(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
1524 WriteByte(MSG_ENTITY, ORDINAL(this.nent_net_type));
1525 WriteShort(MSG_ENTITY, this.nent_net_name);
1526 for (int i = 0; i < this.nent_stringcount; ++i) { WriteString(MSG_ENTITY, this.nent_strings[i]); }
1527 for (int i = 0; i < this.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, this.nent_floats[i]); }
1531 void Kill_Notification(
1532 NOTIF broadcast, entity client,
1533 /** primary group */
1535 /** secondary group */
1538 #ifdef NOTIFICATIONS_DEBUG
1539 Debug_Notification(sprintf(
1540 "Kill_Notification(%s, '%s', %s, %d);\n",
1541 Get_Notif_BroadcastName(broadcast),
1543 (net_type ? Get_Notif_TypeName(net_type) : "0"),
1548 string checkargs = Notification_CheckArgs(broadcast, client, NO_MSG);
1549 if (checkargs != "") { backtrace(sprintf("Incorrect usage of Kill_Notification: %s\n", checkargs)); return; }
1552 float killed_cpid = NO_CPID;
1558 killed_cpid = 0; // kill ALL centerprints
1566 entity notif = Get_Notif_Ent(net_type, net_name);
1567 if (!notif) { backtrace("Kill_Notification: Could not find notification entity!\n"); return; }
1570 killed_cpid = notif.nent_cpid;
1572 killed_cpid = NO_CPID;
1576 killed_cpid = 0; // kill ALL centerprints
1581 case MSG_CENTER_CPID:
1583 killed_cpid = net_name;
1588 if (killed_cpid != NO_CPID)
1590 net_notif = new(net_kill_notification);
1591 make_pure(net_notif);
1592 net_notif.nent_broadcast = broadcast;
1593 net_notif.nent_client = client;
1594 net_notif.nent_net_type = MSG_CENTER_CPID;
1595 net_notif.nent_net_name = killed_cpid;
1596 Net_LinkEntity(net_notif, false, autocvar_notification_lifetime_runtime, Net_Write_Notification);
1599 FOREACH_ENTITY_CLASS("net_notification", true,
1603 if ((killed_cpid != NO_CPID) && (it.nent_net_type == MSG_CENTER))
1605 if(it.owner.nent_cpid == killed_cpid)
1607 it.nent_net_name = -1;
1608 it.nextthink = time;
1610 else { continue; } // we ARE looking for a specific CPID, don't kill everything else too
1612 else if (it.nent_net_type == net_type)
1616 if (it.nent_net_name == net_name) { it.nent_net_name = -1; it.nextthink = time; }
1617 else { continue; } // we ARE looking for a certain net_name, don't kill everything else too
1619 else { it.nent_net_name = -1; it.nextthink = time; }
1621 else { continue; } // we ARE looking for a certain net_type, don't kill everything else too
1623 else { it.nent_net_name = -1; it.nextthink = time; }
1627 void Send_Notification(
1628 NOTIF broadcast, entity client,
1629 MSG net_type, Notification net_name,
1632 entity notif = net_name;
1633 string parms = sprintf("%s, '%s', %s, %s",
1634 Get_Notif_BroadcastName(broadcast),
1636 Get_Notif_TypeName(net_type),
1637 net_name.registered_id
1639 #ifdef NOTIFICATIONS_DEBUG
1640 Debug_Notification(sprintf("Send_Notification(%s, ...%d);\n", parms, count));
1642 // check if this should be aborted
1643 if (net_name == NOTIF_ABORT) return;
1647 LOG_WARNING("Send_Notification: Could not find notification entity!");
1651 // check supplied broadcast, target, type, and name for errors
1652 string checkargs = Notification_CheckArgs(broadcast, client, net_name);
1653 if (checkargs != "")
1655 LOG_WARNINGF("Incorrect usage of Send_Notification: %s", checkargs);
1659 string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
1660 string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
1661 string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : "");
1662 string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : "");
1663 float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0);
1664 float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0);
1665 float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0);
1666 float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
1668 #ifdef NOTIFICATIONS_DEBUG
1669 Debug_Notification(sprintf(
1670 "Send_Notification(%s, %s, %s);\n",
1672 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1673 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1677 if ((notif.nent_stringcount + notif.nent_floatcount) != count)
1680 "Argument mismatch for Send_Notification(%s, ...)! "
1681 "stringcount(%d) + floatcount(%d) != count(%d)\n"
1682 "Check the definition and function call for accuracy...?\n",
1684 notif.nent_stringcount,
1685 notif.nent_floatcount,
1695 broadcast == NOTIF_ALL
1697 broadcast == NOTIF_ALL_EXCEPT
1701 net_type == MSG_ANNCE
1703 net_type == MSG_CENTER
1707 Local_Notification_WOVA(
1709 notif.nent_stringcount,
1710 notif.nent_floatcount,
1715 if (net_type == MSG_CHOICE)
1717 // THIS GETS TRICKY... now we have to cycle through each possible player (checking broadcast)
1718 // and then do an individual NOTIF_ONE_ONLY recursive call for each one depending on their option...
1719 // It's slow, but it's better than the alternatives:
1720 // 1. Constantly networking all info and letting client decide
1721 // 2. Manually handling each separate call on per-usage basis (See old CTF usage of verbose)
1722 entity found_choice;
1724 #define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN { \
1725 if (notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) { \
1726 switch (ent.msg_choice_choices[net_name.nent_choice_idx]) \
1728 case 1: found_choice = notif.nent_optiona; break; \
1729 case 2: found_choice = notif.nent_optionb; break; \
1733 found_choice = notif.nent_optiona; \
1735 Send_Notification_WOVA( \
1738 found_choice.nent_type, \
1740 found_choice.nent_stringcount, \
1741 found_choice.nent_floatcount, \
1748 case NOTIF_ONE_ONLY: // we can potentially save processing power with this broadcast method
1750 if (IS_REAL_CLIENT(client)) {
1751 RECURSE_FROM_CHOICE(client, return);
1757 FOREACH_CLIENT(IS_REAL_CLIENT(it) && Notification_ShouldSend(broadcast, it, client), {
1758 RECURSE_FROM_CHOICE(it, continue);
1766 entity net_notif = new(net_notification);
1767 make_pure(net_notif);
1768 net_notif.owner = notif;
1769 net_notif.nent_broadcast = broadcast;
1770 net_notif.nent_client = client;
1771 net_notif.nent_net_type = net_type;
1772 net_notif.nent_net_name = notif.m_id;
1773 net_notif.nent_stringcount = notif.nent_stringcount;
1774 net_notif.nent_floatcount = notif.nent_floatcount;
1776 for (int i = 0; i < net_notif.nent_stringcount; ++i) {
1777 net_notif.nent_strings[i] = strzone(...(i, string));
1779 for (int i = 0; i < net_notif.nent_floatcount; ++i) {
1780 net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float);
1783 net_notif.think = Net_Notification_Remove;
1784 net_notif.nextthink = (time > autocvar_notification_lifetime_mapload)
1785 ? (time + autocvar_notification_lifetime_runtime)
1786 : autocvar_notification_lifetime_mapload;
1788 Net_LinkEntity(net_notif, false, 0, Net_Write_Notification);
1792 // WOVA = Without Variable Arguments
1793 void Send_Notification_WOVA(
1794 NOTIF broadcast, entity client,
1795 MSG net_type, Notification net_name,
1796 float stringcount, float floatcount,
1797 string s1, string s2, string s3, string s4,
1798 float f1, float f2, float f3, float f4)
1800 #ifdef NOTIFICATIONS_DEBUG
1801 entity notif = net_name;
1802 Debug_Notification(sprintf(
1803 "Send_Notification_WOVA(%s, %d, %d, %s, %s);\n",
1806 Get_Notif_BroadcastName(broadcast),
1808 Get_Notif_TypeName(net_type),
1813 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1814 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1818 #define VARITEM(stringc, floatc, args) \
1819 if ((stringcount == stringc) && (floatcount == floatc)) \
1820 { Send_Notification(broadcast, client, net_type, net_name, args); return; }
1821 EIGHT_VARS_TO_VARARGS_VARLIST
1823 Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
1826 // WOCOVA = Without Counts Or Variable Arguments
1827 void Send_Notification_WOCOVA(
1828 NOTIF broadcast, entity client,
1829 MSG net_type, Notification net_name,
1830 string s1, string s2, string s3, string s4,
1831 float f1, float f2, float f3, float f4)
1833 entity notif = net_name;
1835 #ifdef NOTIFICATIONS_DEBUG
1836 Debug_Notification(sprintf(
1837 "Send_Notification_WOCOVA(%s, %s, %s);\n",
1840 Get_Notif_BroadcastName(broadcast),
1842 Get_Notif_TypeName(net_type),
1845 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1846 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1850 #define VARITEM(stringc, floatc, args) \
1851 if ((notif.nent_stringcount == stringc) && (notif.nent_floatcount == floatc)) \
1852 { Send_Notification(broadcast, client, net_type, net_name, args); return; }
1853 EIGHT_VARS_TO_VARARGS_VARLIST
1855 Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
1857 #endif // ifdef SVQC