1 // ================================================
2 // Unified notification system, written by Samual
3 // Last updated: June, 2013
4 // ================================================
6 string Get_Notif_TypeName(float net_type)
10 case MSG_ANNCE: return "MSG_ANNCE";
11 case MSG_INFO: return "MSG_INFO";
12 case MSG_CENTER: return "MSG_CENTER";
13 case MSG_CENTER_CPID: return "MSG_CENTER_CPID";
14 case MSG_MULTI: return "MSG_MULTI";
15 case MSG_CHOICE: return "MSG_CHOICE";
17 backtrace(sprintf("Get_Notif_TypeName(%d): Improper net type!\n", net_type));
21 entity Get_Notif_Ent(float net_type, float net_name)
25 case MSG_ANNCE: return msg_annce_notifs[net_name - 1];
26 case MSG_INFO: return msg_info_notifs[net_name - 1];
27 case MSG_CENTER: return msg_center_notifs[net_name - 1];
28 case MSG_MULTI: return msg_multi_notifs[net_name - 1];
29 case MSG_CHOICE: return msg_choice_notifs[net_name - 1];
31 backtrace(sprintf("Get_Notif_Ent(%d, %d): Improper net type!\n", net_type, net_name));
35 string Notification_CheckArgs_TypeName(float net_type, float net_name)
37 // check supplied type and name for errors
38 string checkargs = "";
39 #define CHECKARG_TYPENAME(type) case MSG_##type##: \
40 { if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
41 { checkargs = sprintf("Improper name: %d!", net_name); } break; }
44 CHECKARG_TYPENAME(ANNCE)
45 CHECKARG_TYPENAME(INFO)
46 CHECKARG_TYPENAME(CENTER)
47 CHECKARG_TYPENAME(MULTI)
48 CHECKARG_TYPENAME(CHOICE)
49 default: { checkargs = sprintf("Improper type: %d!", checkargs, net_type); break; }
51 #undef CHECKARG_TYPENAME
56 string Notification_CheckArgs(
57 float broadcast, entity client,
58 float net_type, float net_name)
60 // check supplied broadcast, target, type, and name for errors
61 string checkargs = Notification_CheckArgs_TypeName(net_type, net_name);
62 if(checkargs != "") { checkargs = strcat(checkargs, " "); }
68 if(IS_NOT_A_CLIENT(client))
69 { checkargs = sprintf("%sNo client provided!", checkargs); }
73 case NOTIF_ALL_EXCEPT:
75 if(IS_NOT_A_CLIENT(client))
76 { checkargs = sprintf("%sException can't be a non-client!", checkargs); }
83 { checkargs = sprintf("%sEntity provided when world was required!", checkargs); }
88 case NOTIF_TEAM_EXCEPT:
90 if not(teamplay) { checkargs = sprintf("%sTeamplay not active!", checkargs); }
91 else if(IS_NOT_A_CLIENT(client))
93 if(broadcast == NOTIF_TEAM) { checkargs = sprintf("%sNo client provided!", checkargs); }
94 else { checkargs = sprintf("%sException can't be a non-client!", checkargs); }
99 default: { checkargs = sprintf("%sImproper broadcast: %d!", checkargs, broadcast); break; }
104 float Notification_ShouldSend(float broadcast, entity to_client, entity other_client)
108 case NOTIF_ONE: // send to one client and their spectator
111 (to_client == other_client)
116 (to_client.enemy == other_client)
121 case NOTIF_ONE_ONLY: // send ONLY to one client
123 if(to_client == other_client) { return TRUE; }
126 case NOTIF_TEAM: // send only to X team and their spectators
129 (to_client.team == other_client.team)
134 (to_client.enemy.team == other_client.team)
139 case NOTIF_TEAM_EXCEPT: // send only to X team and their spectators, except for Y person and their spectators
142 (to_client != other_client)
145 (to_client.team == other_client.team)
151 (to_client.enemy != other_client)
153 (to_client.enemy.team == other_client.team)
160 case NOTIF_ALL: // send to everyone
164 case NOTIF_ALL_EXCEPT: // send to everyone except X person and their spectators
167 (to_client != other_client)
172 (to_client.enemy == other_client)
183 // ===============================
184 // Initialization Core Functions
185 // ===============================
187 // used by restartnotifs command to initialize notifications
188 void Destroy_Notification_Entity(entity notif)
190 if(notif.nent_name != "") { strunzone(notif.nent_name); }
191 if(notif.nent_snd != "") { strunzone(notif.nent_snd); }
192 if(notif.nent_args != "") { strunzone(notif.nent_args); }
193 if(notif.nent_hudargs != "") { strunzone(notif.nent_hudargs); }
194 if(notif.nent_icon != "") { strunzone(notif.nent_icon); }
195 if(notif.nent_durcnt != "") { strunzone(notif.nent_durcnt); }
196 if(notif.nent_string != "") { strunzone(notif.nent_string); }
200 void Destroy_All_Notifications(void)
205 #define DESTROY_LOOP(type,count) \
206 for(i = 1; i <= count; ++i) \
208 notif = Get_Notif_Ent(type, i); \
209 if not(notif) { backtrace("Destroy_All_Notifications(): Missing notification entity!\n"); return; } \
210 Destroy_Notification_Entity(notif); \
213 // kill all networked notifications and centerprints
215 Kill_Notification(NOTIF_ALL, world, 0, 0);
217 reset_centerprint_messages();
220 // kill all real notification entities
221 DESTROY_LOOP(MSG_ANNCE, NOTIF_ANNCE_COUNT)
222 DESTROY_LOOP(MSG_INFO, NOTIF_INFO_COUNT)
223 DESTROY_LOOP(MSG_CENTER, NOTIF_CENTER_COUNT)
224 DESTROY_LOOP(MSG_MULTI, NOTIF_MULTI_COUNT)
225 DESTROY_LOOP(MSG_CHOICE, NOTIF_CHOICE_COUNT)
229 string Process_Notif_Line(
238 if(typeid == MSG_INFO)
240 if((chat && autocvar_notification_allow_chatboxprint)
241 || (autocvar_notification_allow_chatboxprint == 2))
243 // pass 1: add ETX char at beginning of line
244 input = strcat("\{3}", input);
246 // pass 2: add ETX char at end of each new line (so that
247 // messages with multiple lines are put through chatbox too)
248 input = strreplace("\n", "\n\{3}", input);
250 // pass 3: strip trailing ETX char
251 if(substring(input, (strlen(input) - 1), 1) == "\{3}")
252 { input = substring(input, 0, (strlen(input) - 1)); }
257 // done to both MSG_INFO and MSG_CENTER
258 if(substring(input, (strlen(input) - 1), 1) == "\n")
262 "^1TRAILING NEW LINE AT END OF NOTIFICATION: ",
263 "^7net_type = %s, net_name = %s, string = %s.\n"
270 input = substring(input, 1, (strlen(input) - 1));
276 string Process_Notif_Args(
282 string selected, remaining = args;
285 for(;(remaining != "");)
287 selected = car(remaining); remaining = cdr(remaining);
291 case 1: // normal args
293 if(sel_num == NOTIF_MAX_ARGS)
297 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
298 "^7net_type = %s, net_name = %s, max args = %d.\n"
308 switch(strtolower(selected))
310 #define ARG_CASE(prog,selected,result) \
311 #if (prog != ARG_DC) \
312 case selected: { ++sel_num; break; } \
320 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
321 "^7net_type = %s, net_name = %s, args arg = '%s'.\n"
335 if(sel_num == NOTIF_MAX_HUDARGS)
339 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
340 "^7net_type = %s, net_name = %s, max hudargs = %d.\n"
350 switch(strtolower(selected))
352 #define ARG_CASE(prog,selected,result) \
353 #if (prog == ARG_CS_SV_HA) \
354 case selected: { ++sel_num; break; } \
362 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
363 "^7net_type = %s, net_name = %s, hudargs arg = '%s'.\n"
377 if(sel_num == NOTIF_MAX_DURCNT)
381 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: ",
382 "^7net_type = %s, net_name = %s, max durcnt = %d.\n"
392 switch(strtolower(selected))
394 #define ARG_CASE(prog,selected,result) \
395 #if (prog == ARG_CS_SV_DC) || (prog == ARG_DC) \
396 case selected: { ++sel_num; break; } \
402 if(ftos(stof(selected)) != "") { ++sel_num; }
407 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: ",
408 "^7net_type = %s, net_name = %s, durcnt arg = '%s'.\n"
426 void Create_Notification_Entity(
453 // =====================
454 // Global Entity Setup
455 // =====================
456 entity notif = spawn();
457 string typestring = "";
462 msg_annce_notifs[nameid - 1] = notif;
463 notif.classname = "msg_annce_notification";
468 msg_info_notifs[nameid - 1] = notif;
469 notif.classname = "msg_info_notification";
474 msg_center_notifs[nameid - 1] = notif;
475 notif.classname = "msg_center_notification";
480 msg_multi_notifs[nameid - 1] = notif;
481 notif.classname = "msg_multi_notification";
486 msg_choice_notifs[nameid - 1] = notif;
487 notif.classname = "msg_choice_notification";
495 "^1NOTIFICATION WITH IMPROPER TYPE: ",
496 "^7net_type = %d, net_name = %s.\n"
501 return; // It's not possible to recover from this one
504 notif.nent_default = var_default;
505 notif.nent_name = strzone(namestring);
506 notif.nent_type = typeid;
507 notif.nent_id = nameid;
508 notif.nent_enabled = (1 <= var_cvar);
510 typestring = Get_Notif_TypeName(typeid);
512 // Other pre-notif-setup requisites
515 // ====================
516 // Notification Setup
517 // ====================
522 // Set MSG_ANNCE information and handle precaching
524 if not(GENTLE && (var_cvar == 1))
528 if(notif.nent_enabled)
530 precache_sound(sprintf("announcer/%s/%s.wav", autocvar_cl_announcer, snd));
531 notif.nent_channel = channel;
532 notif.nent_snd = strzone(snd);
533 notif.nent_vol = vol;
534 notif.nent_position = position;
541 "^1NOTIFICATION WITH NO SOUND: ",
542 "^7net_type = %s, net_name = %s.\n"
550 else { notif.nent_enabled = FALSE; }
552 notif.nent_enabled = FALSE;
561 // Set MSG_INFO and MSG_CENTER string/float counts
562 notif.nent_stringcount = strnum;
563 notif.nent_floatcount = flnum;
565 // Only initialize arguments if we're either a client or on a dedicated server
567 float should_process_args = server_is_dedicated;
569 float should_process_args = TRUE;
572 if(should_process_args)
574 // ========================
575 // Process Main Arguments
576 // ========================
581 notif.nent_args = strzone(
582 Process_Notif_Args(1, args, typestring, namestring));
584 else if((hudargs == "") && (durcnt ==""))
588 "^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: ",
589 "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d\n"
601 notif.nent_args = strzone(
602 Process_Notif_Args(1, args, typestring, namestring));
606 // =======================================
607 // Process HUD and Centerprint Arguments
608 // Only processed on CSQC, as these
609 // args are only for HUD features.
610 // =======================================
614 notif.nent_hudargs = strzone(
615 Process_Notif_Args(2, hudargs, typestring, namestring));
617 if(icon != "") { notif.nent_icon = strzone(icon); }
622 "^1NOTIFICATION HAS HUDARGS BUT NO ICON: ",
623 "^7net_type = %s, net_name = %s.\n"
635 "^1NOTIFICATION HAS ICON BUT NO HUDARGS: ",
636 "^7net_type = %s, net_name = %s.\n"
646 notif.nent_durcnt = strzone(
647 Process_Notif_Args(3, durcnt, typestring, namestring));
649 if(cpid != NO_MSG) { notif.nent_cpid = cpid; }
654 "^1NOTIFICATION HAS DURCNT BUT NO CPID: ",
655 "^7net_type = %s, net_name = %s.\n"
663 else if(cpid != NO_MSG) { notif.nent_cpid = cpid; }
667 // ======================
668 // Process Notif String
669 // ======================
670 #define SET_NOTIF_STRING(string,stringname) \
671 notif.nent_string = strzone(CCR( \
672 Process_Notif_Line( \
684 if(gentle != "") { SET_NOTIF_STRING(gentle, "GENTLE") }
685 else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL") }
687 else if(normal != "") { SET_NOTIF_STRING(normal, "NORMAL") }
689 #undef SET_NOTIF_STRING
691 // Check to make sure a string was chosen
692 if(notif.nent_string == "")
696 "^1EMPTY NOTIFICATION: ",
697 "^7net_type = %s, net_name = %s.\n"
711 // Set MSG_MULTI string/float counts
712 if((anncename == NO_MSG) && (infoname == NO_MSG) && (centername == NO_MSG))
716 "^1NOTIFICATION WITH NO SUBCALLS: ",
717 "^7net_type = %s, net_name = %s.\n"
726 // announcements don't actually need any arguments, so lets not even count them.
727 if(anncename != NO_MSG) { notif.nent_msgannce = msg_annce_notifs[anncename - 1]; }
729 float infoname_stringcount = 0, infoname_floatcount = 0;
730 float centername_stringcount = 0, centername_floatcount = 0;
732 if(infoname != NO_MSG)
734 notif.nent_msginfo = msg_info_notifs[infoname - 1];
735 infoname_stringcount = notif.nent_msginfo.nent_stringcount;
736 infoname_floatcount = notif.nent_msginfo.nent_floatcount;
739 if(centername != NO_MSG)
741 notif.nent_msgcenter = msg_center_notifs[centername - 1];
742 centername_stringcount = notif.nent_msgcenter.nent_stringcount;
743 centername_floatcount = notif.nent_msgcenter.nent_floatcount;
746 // set the requirements of THIS notification to the totals of its subcalls
747 notif.nent_stringcount = max(infoname_stringcount, centername_stringcount);
748 notif.nent_floatcount = max(infoname_floatcount, centername_floatcount);
756 if((chtype == NO_MSG) || (optiona == NO_MSG) || (optionb == NO_MSG))
760 "^1NOTIFICATION IS MISSING CHOICE PARAMS: ",
761 "^7net_type = %s, net_name = %s.\n"
774 notif.nent_optiona = msg_annce_notifs[optiona - 1];
775 notif.nent_optionb = msg_annce_notifs[optionb - 1];
780 notif.nent_optiona = msg_info_notifs[optiona - 1];
781 notif.nent_optionb = msg_info_notifs[optionb - 1];
786 notif.nent_optiona = msg_center_notifs[optiona - 1];
787 notif.nent_optionb = msg_center_notifs[optionb - 1];
792 notif.nent_optiona = msg_multi_notifs[optiona - 1];
793 notif.nent_optionb = msg_multi_notifs[optionb - 1];
796 case MSG_CHOICE: // should we REALLY allow nested options?...
798 notif.nent_optiona = msg_choice_notifs[optiona - 1];
799 notif.nent_optionb = msg_choice_notifs[optionb - 1];
807 "^1NOTIFICATION WITH IMPROPER TYPE: ",
808 "^7net_type = %d, net_name = %s.\n"
817 notif.nent_challow = challow; // 0: never allowed, 1: allowed in warmup, 2: always allowed
818 notif.nent_stringcount = max(notif.nent_optiona.nent_stringcount, notif.nent_optionb.nent_stringcount);
819 notif.nent_floatcount = max(notif.nent_optiona.nent_floatcount, notif.nent_optionb.nent_floatcount);
820 print(sprintf("INIT NOTIF DEBUG: %d %d\n", notif.nent_stringcount, notif.nent_floatcount));
821 print(sprintf("^ optiona: %s %s : %d %d\n",
822 Get_Notif_TypeName(notif.nent_optiona.nent_type),
823 notif.nent_optiona.nent_name,
824 notif.nent_optiona.nent_stringcount,
825 notif.nent_optiona.nent_floatcount));
830 default: print("DAFUQ?\n"); notif_error = TRUE; break;
833 // now check to see if any errors happened
836 notif.nent_enabled = FALSE; // disable the notification so it can't cause trouble
837 notif_global_error = TRUE; // throw the red flag that an error happened on init
846 // used by MSG_CHOICE to build list of choices
848 void Notification_GetCvars(void)
851 for(i = 0; i <= NOTIF_CHOICE_COUNT; ++i)
853 GetCvars_handleFloat(
856 msg_choice_choices[i],
857 sprintf("notification_%s", msg_choice_notifs[i].nent_name)
861 GetCvars_handleFloat(get_cvars_s, get_cvars_f, FRAG_VERBOSE, "notification_frag_verbose");
865 // used to output notifications.cfg file
866 void Dump_Notifications(float fh, float alsoprint)
868 #define NOTIF_WRITE(a) { \
870 if(alsoprint) { print(a); } }
871 #define NOTIF_WRITE_ENTITY(description) { \
874 "seta notification_%s \"%d\" \"%s\"\n", \
875 e.nent_name, e.nent_default, description \
877 NOTIF_WRITE(notif_msg) }
878 #define NOTIF_WRITE_HARDCODED(cvar,default,description) { \
881 "seta notification_%s \"%s\" \"%s\"\n", \
882 cvar, default, description \
884 NOTIF_WRITE(notif_msg) }
890 // Note: This warning only applies to the notifications.cfg file that is output...
892 // You ARE supposed to manually edit this function to add i.e. hard coded
893 // notification variables for mutators or game modes or such and then
894 // regenerate the notifications.cfg file from the new code.
896 NOTIF_WRITE("// ********************************************** //\n");
897 NOTIF_WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n");
898 NOTIF_WRITE("// ** ** //\n");
899 NOTIF_WRITE("// ** This file is automatically generated ** //\n");
900 NOTIF_WRITE("// ** by code with the command 'dumpnotifs'. ** //\n");
901 NOTIF_WRITE("// ** ** //\n");
902 NOTIF_WRITE("// ** If you add a new notification, please ** //\n");
903 NOTIF_WRITE("// ** regenerate this file with that command ** //\n");
904 NOTIF_WRITE("// ** making sure that the output matches ** //\n");
905 NOTIF_WRITE("// ** with the lists and defaults in code. ** //\n");
906 NOTIF_WRITE("// ** ** //\n");
907 NOTIF_WRITE("// ********************************************** //\n");
909 // These notifications will also append their string as a comment...
910 // This is not necessary, and does not matter if they vary between config versions,
911 // it is just a semi-helpful tool for those who want to manually change their user settings.
913 NOTIF_WRITE(sprintf("\n// MSG_ANNCE notifications (count = %d):\n", NOTIF_ANNCE_COUNT));
914 for(i = 1; i <= NOTIF_ANNCE_COUNT; ++i)
916 e = Get_Notif_Ent(MSG_ANNCE, i);
917 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
920 "Notification control cvar: 0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled)"
924 NOTIF_WRITE(sprintf("\n// MSG_INFO notifications (count = %d):\n", NOTIF_INFO_COUNT));
925 for(i = 1; i <= NOTIF_INFO_COUNT; ++i)
927 e = Get_Notif_Ent(MSG_INFO, i);
928 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
931 "Notification control cvar: 0 = off, 1 = print to console, "
932 "2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
936 NOTIF_WRITE(sprintf("\n// MSG_CENTER notifications (count = %d):\n", NOTIF_CENTER_COUNT));
937 for(i = 1; i <= NOTIF_CENTER_COUNT; ++i)
939 e = Get_Notif_Ent(MSG_CENTER, i);
940 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
943 "Notification control cvar: 0 = off, 1 = centerprint"
947 NOTIF_WRITE(sprintf("\n// MSG_MULTI notifications (count = %d):\n", NOTIF_MULTI_COUNT));
948 for(i = 1; i <= NOTIF_MULTI_COUNT; ++i)
950 e = Get_Notif_Ent(MSG_MULTI, i);
951 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
954 "Notification control cvar: 0 = off, 1 = trigger subcalls"
958 NOTIF_WRITE(sprintf("\n// MSG_CHOICE notifications (count = %d):\n", NOTIF_CHOICE_COUNT));
959 for(i = 1; i <= NOTIF_CHOICE_COUNT; ++i)
961 e = Get_Notif_Ent(MSG_CHOICE, i);
962 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
965 "Notification control cvar: 0 = off, 1 = trigger option A subcall, 2 = trigger option B subcall"
969 // edit these to match whichever cvars are used for specific notification options
970 NOTIF_WRITE("\n// HARD CODED notification variables:\n");
972 NOTIF_WRITE_HARDCODED(
973 "allow_chatboxprint", "1",
974 "Allow notifications to be printed to chat box by setting notification cvar to 2 "
975 "(You can also set this cvar to 2 to force ALL notifications to be printed to the chatbox)"
978 NOTIF_WRITE_HARDCODED(
979 "ctf_capture_verbose", "0",
980 "Show extra information when someone captures a flag"
983 NOTIF_WRITE_HARDCODED(
984 "ctf_pickup_enemy_verbose", "0",
985 "Show extra information if an enemy picks up a flag"
988 NOTIF_WRITE_HARDCODED(
989 "ctf_pickup_team_verbose", "0",
990 "Show extra information if a team mate picks up a flag"
993 NOTIF_WRITE_HARDCODED(
995 "Print extra debug information on all notification function calls "
996 "(Requires -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation)... "
997 "0 = disabled, 1 = dprint, 2 = print"
1000 NOTIF_WRITE_HARDCODED(
1001 "errors_are_fatal", "1",
1002 "If a notification fails upon initialization, cause a Host_Error to stop the program"
1005 NOTIF_WRITE_HARDCODED(
1006 "frag_verbose", "1",
1007 "Show extra information when you frag someone (or when you are fragged"
1010 NOTIF_WRITE_HARDCODED(
1011 "item_centerprinttime", "1.5",
1012 "How long to show item information centerprint messages (like 'You got the Electro' or such)"
1015 NOTIF_WRITE_HARDCODED(
1016 "lifetime_mapload", "10",
1017 "Amount of time that notification entities last immediately at mapload (in seconds) "
1018 "to help prevent notifications from being lost on early init (like gamestart countdown)"
1021 NOTIF_WRITE_HARDCODED(
1022 "lifetime_runtime", "0.5",
1023 "Amount of time that notification entities last on the server during runtime (In seconds)"
1026 NOTIF_WRITE_HARDCODED(
1027 "server_allows_frag_verbose", "1",
1028 "Server side cvar for showing extra information in frag messages... 0 = no extra frag information, "
1029 "1 = frag information only in warmup, 2 = frag information allowed all the time"
1032 NOTIF_WRITE_HARDCODED(
1033 "server_allows_location", "1",
1034 "Server side cvar for allowing death messages to show location information too"
1037 NOTIF_WRITE_HARDCODED(
1038 "show_location", "0",
1039 "Append location information to MSG_INFO death/kill messages"
1042 NOTIF_WRITE_HARDCODED(
1043 "show_location_string", "",
1044 "Replacement string piped into sprintf, "
1045 "so you can do different messages like this: ' at the %s' or ' (near %s)'"
1048 NOTIF_WRITE_HARDCODED(
1050 "Print information about sprees in death/kill messages"
1053 NOTIF_WRITE_HARDCODED(
1054 "show_sprees_center", "1",
1055 "Show spree information in MSG_CENTER messages... "
1056 "0 = off, 1 = target (but only for first victim) and attacker"
1059 NOTIF_WRITE_HARDCODED(
1060 "show_sprees_center_specialonly", "1",
1061 "Don't show spree information in MSG_CENTER messages if it isn't an achievement"
1064 NOTIF_WRITE_HARDCODED(
1065 "show_sprees_info", "3",
1066 "Show spree information in MSG_INFO messages... "
1067 "0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker"
1070 NOTIF_WRITE_HARDCODED(
1071 "show_sprees_info_newline", "1",
1072 "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
1075 NOTIF_WRITE_HARDCODED(
1076 "show_sprees_info_specialonly", "1",
1077 "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement"
1080 NOTIF_WRITE(sprintf(
1082 "\n// Notification counts (total = %d): ",
1083 "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n"
1088 NOTIF_CENTER_COUNT +
1100 #undef NOTIF_WRITE_HARDCODED
1101 #undef NOTIF_WRITE_ENTITY
1106 // ===============================
1107 // Frontend Notification Pushing
1108 // ===============================
1110 #ifdef NOTIFICATIONS_DEBUG
1111 void Debug_Notification(string input)
1113 switch(autocvar_notification_debug)
1115 case 1: { dprint(input); break; }
1116 case 2: { print(input); break; }
1121 string Local_Notification_sprintf(
1122 string input, string args,
1123 string s1, string s2, string s3, string s4,
1124 float f1, float f2, float f3, float f4)
1126 #ifdef NOTIFICATIONS_DEBUG
1127 Debug_Notification(sprintf(
1128 "Local_Notification_sprintf('%s^7', '%s', %s, %s);\n",
1129 MakeConsoleSafe(input),
1131 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1132 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1138 for(sel_num = 0; sel_num < NOTIF_MAX_ARGS; ++sel_num) { arg_slot[sel_num] = ""; }
1142 for(sel_num = 0;(args != "");)
1144 selected = car(args); args = cdr(args);
1145 NOTIF_HIT_MAX(NOTIF_MAX_ARGS, "Local_Notification_sprintf")
1146 switch(strtolower(selected))
1148 #define ARG_CASE(prog,selected,result) \
1150 #if (prog != ARG_SV) && (prog != ARG_DC) \
1151 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
1154 #if (prog != ARG_CS) && (prog != ARG_DC) \
1155 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
1160 default: NOTIF_HIT_UNKNOWN(NOTIF_MAX_ARGS, "Local_Notification_sprintf")
1164 strcat(input, "\n"),
1176 void Local_Notification_sound(
1177 float soundchannel, string soundfile,
1178 float soundvolume, float soundposition)
1180 if((soundfile != prev_soundfile) || (time >= (prev_soundtime + autocvar_cl_announcer_antispam)))
1182 #ifdef NOTIFICATIONS_DEBUG
1183 Debug_Notification(sprintf(
1184 "Local_Notification_sound(world, %f, '%s', %f, %f);\n",
1187 "announcer/%s/%s.wav",
1188 autocvar_cl_announcer,
1200 "announcer/%s/%s.wav",
1201 autocvar_cl_announcer,
1208 if(prev_soundfile) { strunzone(prev_soundfile); }
1209 prev_soundfile = strzone(soundfile);
1210 prev_soundtime = time;
1214 #ifdef NOTIFICATIONS_DEBUG
1215 Debug_Notification(sprintf(
1217 "Local_Notification_sound(world, %f, '%s', %f, %f) ",
1218 "^1BLOCKED BY ANTISPAM:^7 prevsnd: '%s', timediff: %f, limit: %f\n"
1222 "announcer/%s/%s.wav",
1223 autocvar_cl_announcer,
1229 (time - prev_soundtime),
1230 autocvar_cl_announcer_antispam
1236 void Local_Notification_HUD_Notify_Push(
1237 string icon, string hudargs,
1238 string s1, string s2, string s3, string s4)
1242 arg_slot[0] = ""; arg_slot[1] = "";
1244 for(sel_num = 0;(hudargs != "");)
1246 selected = car(hudargs); hudargs = cdr(hudargs);
1247 NOTIF_HIT_MAX(NOTIF_MAX_HUDARGS, "Local_Notification_HUD_Notify_Push")
1248 switch(strtolower(selected))
1250 #define ARG_CASE(prog,selected,result) \
1251 #if (prog == ARG_CS_SV_HA) \
1252 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
1256 default: NOTIF_HIT_UNKNOWN(NOTIF_MAX_HUDARGS, "Local_Notification_HUD_Notify_Push")
1259 #ifdef NOTIFICATIONS_DEBUG
1260 Debug_Notification(sprintf(
1261 "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s);\n",
1264 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1265 MakeConsoleSafe(sprintf("'%s^7', '%s^7'", stof(arg_slot[0]), stof(arg_slot[1])))
1268 HUD_Notify_Push(icon, arg_slot[0], arg_slot[1]);
1271 void Local_Notification_centerprint_generic(
1272 string input, string durcnt,
1273 float cpid, float f1, float f2)
1277 arg_slot[0] = ""; arg_slot[1] = "";
1279 for(sel_num = 0;(durcnt != "");)
1281 selected = car(durcnt); durcnt = cdr(durcnt);
1282 NOTIF_HIT_MAX(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic")
1283 switch(strtolower(selected))
1285 #define ARG_CASE(prog,selected,result) \
1286 #if (prog == ARG_CS_SV_DC) || (prog == ARG_DC) \
1287 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
1293 if(ftos(stof(selected)) != "") { arg_slot[sel_num] = selected; ++sel_num; }
1294 else { NOTIF_HIT_UNKNOWN(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic") }
1299 #ifdef NOTIFICATIONS_DEBUG
1300 Debug_Notification(sprintf(
1301 "Local_Notification_centerprint_generic('%s^7', '%s', %d, %d, %d, %d);\n",
1302 MakeConsoleSafe(input),
1305 stof(arg_slot[0]), stof(arg_slot[1])
1308 centerprint_generic(cpid, input, stof(arg_slot[0]), stof(arg_slot[1]));
1312 void Local_Notification(float net_type, float net_name, ...count)
1314 // check supplied type and name for errors
1315 string checkargs = Notification_CheckArgs_TypeName(net_type, net_name);
1316 if(checkargs != "") { backtrace(sprintf("Incorrect usage of Local_Notification: %s\n", checkargs)); return; }
1318 entity notif = Get_Notif_Ent(net_type, net_name);
1319 if not(notif) { backtrace("Local_Notification: Could not find notification entity!\n"); return; }
1320 if not(notif.nent_enabled)
1322 #ifdef NOTIFICATIONS_DEBUG
1323 Debug_Notification(sprintf(
1324 "Local_Notification(%s, %s): Entity was disabled...\n",
1325 Get_Notif_TypeName(net_type),
1332 if((notif.nent_stringcount + notif.nent_floatcount) > count)
1336 "Not enough arguments for Local_Notification(%s, %s, ...)! ",
1337 "stringcount(%d) + floatcount(%d) > count(%d)\n",
1338 "Check the definition and function call for accuracy...?\n"
1340 Get_Notif_TypeName(net_type), notif.nent_name,
1341 notif.nent_stringcount, notif.nent_floatcount, count
1345 else if((notif.nent_stringcount + notif.nent_floatcount) < count)
1349 "Too many arguments for Local_Notification(%s, %s, ...)! ",
1350 "stringcount(%d) + floatcount(%d) < count(%d)\n",
1351 "Check the definition and function call for accuracy...?\n"
1353 Get_Notif_TypeName(net_type), notif.nent_name,
1354 notif.nent_stringcount, notif.nent_floatcount, count
1359 string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
1360 string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
1361 string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : "");
1362 string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : "");
1363 float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0);
1364 float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0);
1365 float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0);
1366 float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
1368 #ifdef NOTIFICATIONS_DEBUG
1369 Debug_Notification(sprintf(
1370 "Local_Notification(%s, %s, %s, %s);\n",
1371 Get_Notif_TypeName(net_type),
1373 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1374 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1383 Local_Notification_sound(
1390 backtrace("MSG_ANNCE on server?... Please notify Samual immediately!\n");
1398 Local_Notification_sprintf(
1405 if(notif.nent_icon != "")
1407 Local_Notification_HUD_Notify_Push(
1419 Local_Notification_centerprint_generic(
1420 Local_Notification_sprintf(
1434 if(notif.nent_msginfo)
1435 if(notif.nent_msginfo.nent_enabled)
1437 Local_Notification_WOVA(
1439 notif.nent_msginfo.nent_id,
1440 notif.nent_msginfo.nent_stringcount,
1441 notif.nent_msginfo.nent_floatcount,
1446 if(notif.nent_msgannce)
1447 if(notif.nent_msgannce.nent_enabled)
1449 Local_Notification_WOVA(
1451 notif.nent_msgannce.nent_id,
1456 if(notif.nent_msgcenter)
1457 if(notif.nent_msgcenter.nent_enabled)
1459 Local_Notification_WOVA(
1461 notif.nent_msgcenter.nent_id,
1462 notif.nent_msgcenter.nent_stringcount,
1463 notif.nent_msgcenter.nent_floatcount,
1473 entity found_choice;
1475 if(notif.nent_challow && (warmup_stage || (notif.nent_challow == 2)))
1477 switch(cvar_string(sprintf("notification_%s", notif.nent_name)))
1479 case 1: found_choice = notif.nent_optiona; break;
1480 case 2: found_choice = notif.nent_optionb; break;
1481 default: return; // not enabled anyway
1484 else { found_choice = notif.nent_optiona; }
1486 Local_Notification_WOVA(
1487 found_choice.nent_type,
1488 found_choice.nent_id,
1489 found_choice.nent_stringcount,
1490 found_choice.nent_floatcount,
1497 // WOVA = Without Variable Arguments
1498 void Local_Notification_WOVA(
1499 float net_type, float net_name,
1500 float stringcount, float floatcount,
1501 string s1, string s2, string s3, string s4,
1502 float f1, float f2, float f3, float f4)
1504 #define VARITEM(stringc,floatc,args) \
1505 if((stringcount == stringc) && (floatcount == floatc)) \
1506 { Local_Notification(net_type, net_name, args); return; }
1507 EIGHT_VARS_TO_VARARGS_VARLIST
1509 Local_Notification(net_type, net_name); // some notifications don't have any arguments at all
1513 // =========================
1514 // Notification Networking
1515 // =========================
1518 void Read_Notification(float is_new)
1520 float net_type = ReadByte();
1521 float net_name = ReadShort();
1525 if(net_type == MSG_CENTER_CPID)
1527 #ifdef NOTIFICATIONS_DEBUG
1528 Debug_Notification(sprintf(
1529 "Read_Notification(%d) at %f: net_type = %s, net_name = %d\n",
1532 Get_Notif_TypeName(net_type),
1539 if(net_name == 0) { reset_centerprint_messages(); }
1540 else if(net_name != NO_CPID)
1542 // in this case, net_name IS the cpid we want to kill
1543 centerprint_generic(net_name, "", 0, 0);
1548 "Read_Notification(%d) at %f: ^1TRIED TO KILL NO_CPID CENTERPRINT!\n",
1557 notif = Get_Notif_Ent(net_type, net_name);
1558 if not(notif) { backtrace("Read_Notification: Could not find notification entity!\n"); return; }
1560 #ifdef NOTIFICATIONS_DEBUG
1561 Debug_Notification(sprintf(
1562 "Read_Notification(%d) at %f: net_type = %s, net_name = %s\n",
1565 Get_Notif_TypeName(net_type),
1570 string s1 = ((0 < notif.nent_stringcount) ? ReadString() : "");
1571 string s2 = ((1 < notif.nent_stringcount) ? ReadString() : "");
1572 string s3 = ((2 < notif.nent_stringcount) ? ReadString() : "");
1573 string s4 = ((3 < notif.nent_stringcount) ? ReadString() : "");
1574 float f1 = ((0 < notif.nent_floatcount) ? ReadLong() : 0);
1575 float f2 = ((1 < notif.nent_floatcount) ? ReadLong() : 0);
1576 float f3 = ((2 < notif.nent_floatcount) ? ReadLong() : 0);
1577 float f4 = ((3 < notif.nent_floatcount) ? ReadLong() : 0);
1581 Local_Notification_WOVA(
1583 notif.nent_stringcount,
1584 notif.nent_floatcount,
1593 void Net_Notification_Remove()
1595 if not(self) { backtrace(sprintf("Net_Notification_Remove() at %f: Missing self!?\n", time)); return; }
1597 #ifdef NOTIFICATIONS_DEBUG
1598 Debug_Notification(sprintf(
1599 "Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
1601 ((self.nent_net_name == -1) ? "Killed" : "Removed"),
1602 Get_Notif_TypeName(self.nent_net_type),
1603 self.owner.nent_name
1608 for(i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } }
1612 float Net_Write_Notification(entity client, float sf)
1614 if(Notification_ShouldSend(self.nent_broadcast, client, self.nent_client))
1617 WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
1618 WriteByte(MSG_ENTITY, self.nent_net_type);
1619 WriteShort(MSG_ENTITY, self.nent_net_name);
1620 for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); }
1621 for(i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); }
1624 else { return FALSE; }
1627 void Kill_Notification(
1628 float broadcast, entity client,
1629 float net_type, float net_name)
1631 string checkargs = Notification_CheckArgs(broadcast, client, 1, 1);
1632 if(checkargs != "") { backtrace(sprintf("Incorrect usage of Kill_Notification: %s\n", checkargs)); return; }
1634 #ifdef NOTIFICATIONS_DEBUG
1635 Debug_Notification(sprintf(
1636 "Kill_Notification(%d, '%s', %s, %d);\n",
1639 (net_type ? Get_Notif_TypeName(net_type) : "0"),
1644 entity notif, net_notif;
1645 float killed_cpid = NO_CPID;
1651 killed_cpid = 0; // kill ALL centerprints
1659 entity notif = Get_Notif_Ent(net_type, net_name);
1660 if not(notif) { backtrace("Kill_Notification: Could not find notification entity!\n"); return; }
1663 killed_cpid = notif.nent_cpid;
1665 killed_cpid = NO_CPID;
1669 killed_cpid = 0; // kill ALL centerprints
1674 case MSG_CENTER_CPID:
1676 killed_cpid = net_name;
1681 if(killed_cpid != NO_CPID)
1683 net_notif = spawn();
1684 net_notif.classname = "net_kill_notification";
1685 net_notif.nent_broadcast = broadcast;
1686 net_notif.nent_client = client;
1687 net_notif.nent_net_type = MSG_CENTER_CPID;
1688 net_notif.nent_net_name = killed_cpid;
1689 Net_LinkEntity(net_notif, FALSE, autocvar_notification_lifetime_runtime, Net_Write_Notification);
1692 for(notif = world; (notif = find(notif, classname, "net_notification"));)
1696 if((killed_cpid != NO_CPID) && (notif.nent_net_type == MSG_CENTER))
1698 if(notif.owner.nent_cpid == killed_cpid)
1700 notif.nent_net_name = -1;
1701 notif.nextthink = time;
1703 else { continue; } // we ARE looking for a specific CPID, don't kill everything else too
1705 else if(notif.nent_net_type == net_type)
1709 if(notif.nent_net_name == net_name) { notif.nent_net_name = -1; notif.nextthink = time; }
1710 else { continue; } // we ARE looking for a certain net_name, don't kill everything else too
1712 else { notif.nent_net_name = -1; notif.nextthink = time; }
1714 else { continue; } // we ARE looking for a certain net_type, don't kill everything else too
1716 else { notif.nent_net_name = -1; notif.nextthink = time; }
1720 void Send_Notification(
1721 float broadcast, entity client,
1722 float net_type, float net_name,
1725 // check supplied broadcast, target, type, and name for errors
1726 string checkargs = Notification_CheckArgs(broadcast, client, net_type, net_name);
1727 if(checkargs != "") { backtrace(sprintf("Incorrect usage of Send_Notification: %s\n", checkargs)); return; }
1729 // retreive counts for the arguments of this notification
1730 entity notif = Get_Notif_Ent(net_type, net_name);
1731 if not(notif) { backtrace("Send_Notification: Could not find notification entity!\n"); return; }
1733 string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
1734 string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
1735 string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : "");
1736 string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : "");
1737 float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0);
1738 float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0);
1739 float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0);
1740 float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
1742 #ifdef NOTIFICATIONS_DEBUG
1743 Debug_Notification(sprintf(
1744 "Send_Notification(%d, %s, %s, %s, %s);\n",
1746 Get_Notif_TypeName(net_type),
1748 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1749 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1753 if((notif.nent_stringcount + notif.nent_floatcount) > count)
1757 "Not enough arguments for Send_Notification(%d, %s, %s, ...)! ",
1758 "stringcount(%d) + floatcount(%d) > count(%d)\n",
1759 "Check the definition and function call for accuracy...?\n"
1761 broadcast, Get_Notif_TypeName(net_type), notif.nent_name,
1762 notif.nent_stringcount, notif.nent_floatcount, count
1766 else if((notif.nent_stringcount + notif.nent_floatcount) < count)
1770 "Too many arguments for Send_Notification(%d, %s, %s, ...)! ",
1771 "stringcount(%d) + floatcount(%d) < count(%d)\n",
1772 "Check the definition and function call for accuracy...?\n"
1774 broadcast, Get_Notif_TypeName(net_type), notif.nent_name,
1775 notif.nent_stringcount, notif.nent_floatcount, count
1784 broadcast == NOTIF_ALL
1786 broadcast == NOTIF_ALL_EXCEPT
1790 net_type == MSG_ANNCE
1792 net_type == MSG_CENTER
1796 Local_Notification_WOVA(
1798 notif.nent_stringcount,
1799 notif.nent_floatcount,
1804 if(net_type == MSG_CHOICE)
1806 // float verbose_allowed = (autocvar_notification_server_allows_frag_verbose && ((autocvar_notification_server_allows_frag_verbose == 2) || warmup_stage));
1807 // THIS GETS TRICKY... now we have to cycle through each possible player (checking broadcast)nent_challow
1808 // and then do an individual NOTIF_ONE_ONLY recursive call for each one depending on their option...
1809 // It's slow, but it's better than the alternatives:
1810 // 1. Constantly networking all info and letting client decide
1811 // 2. Manually handling each separate call on per-usage basis (See old CTF usage of verbose)
1812 entity found_choice;
1814 #define RECURSE_FROM_CHOICE(ent,action) \
1815 if(notif.nent_challow && (warmup_stage || (notif.nent_challow == 2))) \
1817 switch(ent.msg_choice_choices[net_name]) \
1819 case 1: found_choice = notif.nent_optiona; break; \
1820 case 2: found_choice = notif.nent_optionb; break; \
1824 else { found_choice = notif.nent_optiona; } \
1825 Send_Notification_WOVA( \
1828 found_choice.nent_type, \
1829 found_choice.nent_id, \
1830 found_choice.nent_stringcount, \
1831 found_choice.nent_floatcount, \
1837 case NOTIF_ONE_ONLY: // we can potentially save processing power with this broadcast method
1839 if(IS_REAL_CLIENT(client))
1840 { RECURSE_FROM_CHOICE(client, return) }
1846 FOR_EACH_REALCLIENT(to)
1847 { if(Notification_ShouldSend(broadcast, to, client))
1848 { RECURSE_FROM_CHOICE(to, continue) } }
1855 entity net_notif = spawn();
1856 net_notif.owner = notif;
1857 net_notif.classname = "net_notification";
1858 net_notif.nent_broadcast = broadcast;
1859 net_notif.nent_client = client;
1860 net_notif.nent_net_type = net_type;
1861 net_notif.nent_net_name = net_name;
1862 net_notif.nent_stringcount = notif.nent_stringcount;
1863 net_notif.nent_floatcount = notif.nent_floatcount;
1866 for(i = 0; i < net_notif.nent_stringcount; ++i)
1867 { net_notif.nent_strings[i] = strzone(...(i, string)); }
1868 for(i = 0; i < net_notif.nent_floatcount; ++i)
1869 { net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float); }
1871 net_notif.think = Net_Notification_Remove;
1872 net_notif.nextthink =
1873 ((time > autocvar_notification_lifetime_mapload)
1875 (time + autocvar_notification_lifetime_runtime)
1877 autocvar_notification_lifetime_mapload
1880 Net_LinkEntity(net_notif, FALSE, 0, Net_Write_Notification);
1884 // WOVA = Without Variable Arguments
1885 void Send_Notification_WOVA(
1886 float broadcast, entity client,
1887 float net_type, float net_name,
1888 float stringcount, float floatcount,
1889 string s1, string s2, string s3, string s4,
1890 float f1, float f2, float f3, float f4)
1892 #ifdef NOTIFICATIONS_DEBUG
1893 entity notif = Get_Notif_Ent(net_type, net_name);
1894 Debug_Notification(sprintf(
1895 "Send_Notification_WOVA(%d, %s, %d, %d, %d, %s, %s);\n",
1897 Get_Notif_TypeName(net_type),
1901 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1902 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1906 #define VARITEM(stringc,floatc,args) \
1907 if((stringcount == stringc) && (floatcount == floatc)) \
1908 { Send_Notification(broadcast, client, net_type, net_name, args); return; }
1909 EIGHT_VARS_TO_VARARGS_VARLIST
1911 Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
1914 // WOCOVA = Without Counts Or Variable Arguments
1915 void Send_Notification_WOCOVA(
1916 float broadcast, entity client,
1917 float net_type, float net_name,
1918 string s1, string s2, string s3, string s4,
1919 float f1, float f2, float f3, float f4)
1921 entity notif = Get_Notif_Ent(net_type, net_name);
1923 #ifdef NOTIFICATIONS_DEBUG
1924 Debug_Notification(sprintf(
1925 "Send_Notification_WOCOVA(%d, %s, %s, %s, %s);\n",
1927 Get_Notif_TypeName(net_type),
1929 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1930 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1934 #define VARITEM(stringc,floatc,args) \
1935 if((notif.nent_stringcount == stringc) && (notif.nent_floatcount == floatc)) \
1936 { Send_Notification(broadcast, client, net_type, net_name, args); return; }
1937 EIGHT_VARS_TO_VARARGS_VARLIST
1939 Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
1941 #endif // ifdef SVQC