28 return "No client provided!";
31 case NOTIF_ALL_EXCEPT:
33 return "Exception can't be a non-client!";
38 return "Entity provided when NULL was required!";
43 return "Teamplay not active!";
44 else if (!client.team)
49 case NOTIF_TEAM_EXCEPT:
51 return "Teamplay not active!";
53 return "Exception can't be a non-client!";
57 return sprintf(
"Improper broadcast: %d!", broadcast);
70 return (to_client == other_client
71 || (
IS_SPEC(to_client) && to_client.enemy == other_client));
73 return (to_client == other_client);
75 return (to_client.team == other_client.team
76 || (
IS_SPEC(to_client) && to_client.enemy.team == other_client.team));
77 case NOTIF_TEAM_EXCEPT:
78 return (to_client != other_client
80 to_client.team == other_client.team
81 || (
IS_SPEC(to_client) && to_client.enemy != other_client && to_client.enemy.team == other_client.team)
85 case NOTIF_ALL_EXCEPT:
86 return (to_client != other_client
87 && !(
IS_SPEC(to_client) && to_client.enemy == other_client));
101 if (notif.nent_snd !=
"")
strunzone(notif.nent_snd);
102 if (notif.nent_args !=
"")
strunzone(notif.nent_args);
103 if (notif.nent_hudargs !=
"")
strunzone(notif.nent_hudargs);
104 if (notif.nent_icon !=
"")
strunzone(notif.nent_icon);
105 if (notif.nent_durcnt !=
"")
strunzone(notif.nent_durcnt);
106 if (notif.nent_string !=
"")
strunzone(notif.nent_string);
132 if (typeId == MSG_INFO)
134 if ((chat && autocvar_notification_allow_chatboxprint)
135 || autocvar_notification_allow_chatboxprint == 2)
138 input =
strcat(
"\{3}", input);
142 input = strreplace(
"\n",
"\n\{3}", input);
156 "^1TRAILING NEW LINE AT END OF NOTIFICATION: "
157 "^7net_type = %s, net_name = %s, string = %s."
178 for (
string remaining = args; remaining !=
""; )
180 selected =
car(remaining);
181 remaining =
cdr(remaining);
191 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
192 "^7net_type = %s, net_name = %s, max args = %d."
204 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: ++sel_num; break;
205 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: ++sel_num; break;
206 #define ARG_CASE_ARG_CS_SV(selected, result) case selected: ++sel_num; break;
207 #define ARG_CASE_ARG_CS(selected, result) case selected: ++sel_num; break;
208 #define ARG_CASE_ARG_SV(selected, result) case selected: ++sel_num; break;
209 #define ARG_CASE_ARG_DC(selected ,result)
210 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
213 #undef ARG_CASE_ARG_DC
214 #undef ARG_CASE_ARG_SV
215 #undef ARG_CASE_ARG_CS
216 #undef ARG_CASE_ARG_CS_SV
217 #undef ARG_CASE_ARG_CS_SV_DC
218 #undef ARG_CASE_ARG_CS_SV_HA
222 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
223 "^7net_type = %s, net_name = %s, args arg = '%s'."
240 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
241 "^7net_type = %s, net_name = %s, max hudargs = %d."
253 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: ++sel_num; break;
254 #define ARG_CASE_ARG_CS_SV_DC(selected, result)
255 #define ARG_CASE_ARG_CS_SV(selected, result)
256 #define ARG_CASE_ARG_CS(selected, result)
257 #define ARG_CASE_ARG_SV(selected, result)
258 #define ARG_CASE_ARG_DC(selected, result)
259 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
262 #undef ARG_CASE_ARG_DC
263 #undef ARG_CASE_ARG_SV
264 #undef ARG_CASE_ARG_CS
265 #undef ARG_CASE_ARG_CS_SV
266 #undef ARG_CASE_ARG_CS_SV_DC
267 #undef ARG_CASE_ARG_CS_SV_HA
271 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
272 "^7net_type = %s, net_name = %s, hudargs arg = '%s'."
289 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
290 "^7net_type = %s, net_name = %s, max durcnt = %d."
302 #define ARG_CASE_ARG_CS_SV_HA(selected, result)
303 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: ++sel_num; break;
304 #define ARG_CASE_ARG_CS_SV(selected, result)
305 #define ARG_CASE_ARG_CS(selected, result)
306 #define ARG_CASE_ARG_SV(selected, result)
307 #define ARG_CASE_ARG_DC(selected, result) case selected: ++sel_num; break;
308 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
311 #undef ARG_CASE_ARG_DC
312 #undef ARG_CASE_ARG_SV
313 #undef ARG_CASE_ARG_CS
314 #undef ARG_CASE_ARG_CS_SV
315 #undef ARG_CASE_ARG_CS_SV_DC
316 #undef ARG_CASE_ARG_CS_SV_HA
324 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
325 "^7net_type = %s, net_name = %s, durcnt arg = '%s'."
351 notif.nent_default = var_default;
352 notif.nent_enabled = (var_cvar >= 1);
353 notif.nent_type = typeId;
354 notif.nent_teamnum = teamnum;
370 "^1NOTIFICATION WITH IMPROPER TYPE: "
371 "^7net_type = %d, net_name = %s."
383 notif.nent_enabled =
false;
388#define AnnouncerFilename(snd) sprintf("announcer/%s/%s.wav", AnnouncerOption(), snd)
401 MSG typeId = MSG_ANNCE;
402 if (!(
GENTLE && var_cvar == 1))
406 if (notif.nent_enabled)
409 notif.nent_channel = channel;
411 notif.nent_vol = vol;
412 notif.nent_position = position;
413 notif.nent_queuetime = queuetime;
420 "^1NOTIFICATION WITH NO SOUND: "
421 "^7net_type = %s, net_name = %s."
430 notif.nent_enabled =
false;
432 notif.nent_enabled =
false;
449 MSG typeId = notif.nent_type;
451 notif.nent_stringcount = strnum;
452 notif.nent_floatcount = flnum;
458 bool should_process_args =
true;
462 if (should_process_args)
472 else if (hudargs ==
"" && durcnt ==
"")
476 "^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: "
477 "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d"
504 notif.nent_icon =
strzone(icon);
509 "^1NOTIFICATION HAS HUDARGS BUT NO ICON: "
510 "^7net_type = %s, net_name = %s."
522 "^1NOTIFICATION HAS ICON BUT NO HUDARGS: "
523 "^7net_type = %s, net_name = %s.\n"
535 if (cpid ==
CPID_Null && durcnt !=
"0 0")
539 "Notification has durcnt but no cpid: "
540 "net_type = %s, net_name = %s."
548 notif.nent_cpid = cpid;
554 #define SET_NOTIF_STRING(string, stringname) MACRO_BEGIN \
555 notif.nent_string = strzone(CCR( \
556 Process_Notif_Line( \
571 else if (normal !=
"")
574 else if (normal !=
"")
576 #undef SET_NOTIF_STRING
579 if (notif.nent_string ==
"")
583 "^1EMPTY NOTIFICATION: "
584 "^7net_type = %s, net_name = %s."
601 MSG typeId = MSG_MULTI;
603 if (!anncename && !infoname && !centername)
607 "^1NOTIFICATION WITH NO SUBCALLS: "
608 "^7net_type = %s, net_name = %s."
619 notif.nent_msgannce = anncename;
621 int infoname_stringcount = 0, infoname_floatcount = 0;
622 int centername_stringcount = 0, centername_floatcount = 0;
626 notif.nent_msginfo = infoname;
627 infoname_stringcount = notif.nent_msginfo.nent_stringcount;
628 infoname_floatcount = notif.nent_msginfo.nent_floatcount;
633 notif.nent_msgcenter = centername;
634 centername_stringcount = notif.nent_msgcenter.nent_stringcount;
635 centername_floatcount = notif.nent_msgcenter.nent_floatcount;
639 notif.nent_stringcount =
max(infoname_stringcount, centername_stringcount);
640 notif.nent_floatcount =
max(infoname_floatcount, centername_floatcount);
653 MSG typeId = MSG_CHOICE;
654 if (chtype == MSG_Null || !optiona || !optionb)
658 "^1NOTIFICATION IS MISSING CHOICE PARAMS: "
659 "^7net_type = %s, net_name = %s."
668 notif.nent_optiona = optiona;
669 notif.nent_optionb = optionb;
670 notif.nent_challow_def = challow_def;
671 notif.nent_challow_var = challow_var;
672 notif.nent_stringcount =
max(notif.nent_optiona.nent_stringcount, notif.nent_optionb.nent_stringcount);
673 notif.nent_floatcount =
max(notif.nent_optiona.nent_floatcount, notif.nent_optionb.nent_floatcount);
709 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1),
724 #define NOTIF_WRITE(str) write_String_To_File(fh, str, alsoprint)
726 #define NOTIF_WRITE_ENTITY(e, description) \
727 NOTIF_WRITE(sprintf( \
728 "seta notification_%s \"%d\" \"%s\"\n", \
729 Get_Notif_CvarName(e), e.nent_default, description \
732 #define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb) \
733 NOTIF_WRITE(sprintf( \
734 "seta notification_%s \"%d\" \"%s\"\n" \
735 "seta notification_%s_ALLOWED \"%d\" \"%s\"\n", \
736 Get_Notif_CvarName(e), e.nent_default, descriptiona, \
737 Get_Notif_CvarName(e), e.nent_challow_def, descriptionb \
740 #define NOTIF_WRITE_HARDCODED(cvar, default, description) \
741 NOTIF_WRITE("seta notification_" cvar " \"" default "\" \"" description "\"\n")
749 "// ********************************************** //\n"
750 "// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n"
752 "// ** This file is automatically generated ** //\n"
753 "// ** by code with the command 'dumpnotifs'. ** //\n"
755 "// ** If you add a new notification, please ** //\n"
756 "// ** regenerate this file with that command ** //\n"
757 "// ** making sure that the output matches ** //\n"
758 "// ** with the lists and defaults in code. ** //\n"
760 "// ********************************************** //\n");
766 int NOTIF_ANNCE_COUNT = 0;
767 int NOTIF_INFO_COUNT = 0;
768 int NOTIF_CENTER_COUNT = 0;
769 int NOTIF_MULTI_COUNT = 0;
770 int NOTIF_CHOICE_COUNT = 0;
773 switch (it.nent_type)
775 case MSG_ANNCE: ++NOTIF_ANNCE_COUNT;
break;
776 case MSG_INFO: ++NOTIF_INFO_COUNT;
break;
777 case MSG_CENTER: ++NOTIF_CENTER_COUNT;
break;
778 case MSG_MULTI: ++NOTIF_MULTI_COUNT;
break;
779 case MSG_CHOICE: ++NOTIF_CHOICE_COUNT;
break;
783 NOTIF_WRITE(sprintf(
"\n// MSG_ANNCE notifications:\n"));
784 FOREACH(Notifications, it.nent_type == MSG_ANNCE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1),
786 "\\\"0\\\" = disabled, \\\"1\\\" = enabled if gentle mode is off, \\\"2\\\" = always enabled"
789 NOTIF_WRITE(sprintf(
"\n// MSG_INFO notifications:\n"));
790 FOREACH(Notifications, it.nent_type == MSG_INFO && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1),
792 "\\\"0\\\" = off, \\\"1\\\" = print to console, "
793 "\\\"2\\\" = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
796 NOTIF_WRITE(sprintf(
"\n// MSG_CENTER notifications:\n"));
797 FOREACH(Notifications, it.nent_type == MSG_CENTER && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1),
799 "\\\"0\\\" = off, \\\"1\\\" = centerprint"
802 NOTIF_WRITE(sprintf(
"\n// MSG_MULTI notifications:\n"));
803 FOREACH(Notifications, it.nent_type == MSG_MULTI && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1),
805 "enable this multiple notification"
808 NOTIF_WRITE(sprintf(
"\n// MSG_CHOICE notifications:\n"));
809 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1),
811 "choice for this notification; \\\"0\\\" = off, \\\"1\\\" = default message, \\\"2\\\" = verbose message",
812 "allow choice for this notification; \\\"0\\\" = off, \\\"1\\\" = only in warmup-stage, \\\"2\\\" = always"
816 NOTIF_WRITE(
"\n// HARD CODED notification variables:\n");
819 "allow_chatboxprint",
"1",
820 "allow INFO notifications to be printed to chat box; "
821 "\\\"0\\\" = do not allow, "
822 "\\\"1\\\" = allow only if allowed by individual notification_INFO* cvars, "
823 "\\\"2\\\" = force all INFO notifications to be printed to the chatbox"
828 "print extra debug information on all notification function calls "
829 "(REQUIRES: -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation); "
830 "\\\"0\\\" = disabled, \\\"1\\\" = dprint, \\\"2\\\" = print"
834 "errors_are_fatal",
"1",
835 "if a notification fails upon initialization, cause a Host_Error to stop the program"
839 "item_centerprinttime",
"1.5",
840 "how long to show item information centerprint messages (like 'You got the Electro' or such)"
844 "lifetime_mapload",
"10",
845 "amount of time that notification entities last immediately at mapload (in seconds) "
846 "to help prevent notifications from being lost on early init (like gamestart countdown)"
850 "lifetime_runtime",
"0.5",
851 "amount of time that notification entities last on the server during runtime (in seconds)"
855 "server_allows_location",
"1",
856 "server side cvar for allowing death messages to show location information too"
860 "show_location",
"0",
861 "append location information to MSG_INFO death/kill messages"
865 "show_location_string",
"",
866 "replacement string piped into sprintf, "
867 "so you can do different messages like ' at the %s' or ' (near %s)'"
872 "print information about sprees in death/kill messages"
876 "show_sprees_center",
"1",
877 "show spree information in MSG_CENTER messages; "
878 "\\\"0\\\" = off, \\\"1\\\" = target (but only for first victim) and attacker"
882 "show_sprees_center_specialonly",
"1",
883 "do not show spree information in MSG_CENTER messages if it is not an achievement"
887 "show_sprees_info",
"3",
888 "show spree information in MSG_INFO messages; "
889 "\\\"0\\\" = off, \\\"1\\\" = target only, \\\"2\\\" = attacker only, \\\"3\\\" = target and attacker"
893 "show_sprees_info_newline",
"1",
894 "show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
898 "show_sprees_info_specialonly",
"1",
899 "do not show attacker spree information in MSG_INFO messages if it is not an achievement"
902 LOG_INFOF(
"Notification counts (total = %d): "
903 "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n",
904 NOTIF_ANNCE_COUNT + NOTIF_INFO_COUNT + NOTIF_CENTER_COUNT + NOTIF_MULTI_COUNT + NOTIF_CHOICE_COUNT,
911 #undef NOTIF_WRITE_HARDCODED
912 #undef NOTIF_WRITE_ENTITY_CHOICE
913 #undef NOTIF_WRITE_ENTITY
923 string input,
string args,
924 string s1,
string s2,
string s3,
string s4,
925 int f1,
float f2,
float f3,
float f4)
927#ifdef NOTIFICATIONS_DEBUG
928 Debug_Notification(sprintf(
929 "Local_Notification_sprintf('%s^7', '%s', %s, %s);\n",
933 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
940 for (
int sel_num = 0; args !=
""; )
942 string selected =
car(args);
948 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: arg_slot[sel_num++] = result; break;
949 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: arg_slot[sel_num++] = result; break;
950 #define ARG_CASE_ARG_CS_SV(selected, result) case selected: arg_slot[sel_num++] = result; break;
952 #define ARG_CASE_ARG_CS(selected, result) case selected: arg_slot[sel_num++] = result; break;
953 #define ARG_CASE_ARG_SV(selected, result)
955 #define ARG_CASE_ARG_CS(selected, result)
956 #define ARG_CASE_ARG_SV(selected, result) case selected: arg_slot[sel_num++] = result; break;
958 #define ARG_CASE_ARG_DC(selected, result)
959 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
962 #undef ARG_CASE_ARG_DC
963 #undef ARG_CASE_ARG_SV
964 #undef ARG_CASE_ARG_CS
965 #undef ARG_CASE_ARG_CS_SV
966 #undef ARG_CASE_ARG_CS_SV_DC
967 #undef ARG_CASE_ARG_CS_SV_HA
989 #ifdef NOTIFICATIONS_DEBUG
990 Debug_Notification(sprintf(
991 "Local_Notification_sound(%f, '%s', %f, %f);\n",
1004#ifdef NOTIFICATIONS_DEBUG
1006 Debug_Notification(sprintf(
1008 "Local_Notification_sound(%f, '%s', %f, %f) "
1009 "^1BLOCKED BY ANTISPAM:^7 prevsnd: '%s', timediff: %f, limit: %f\n"
1023 string icon,
string hudargs,
1024 string s1,
string s2,
string s3,
string s4,
1025 float f1,
float f2,
float f3,
float f4)
1030 for (
int sel_num = 0; hudargs !=
""; )
1032 string selected =
car(hudargs);
1033 hudargs =
cdr(hudargs);
1037 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: arg_slot[sel_num++] = result; break;
1038 #define ARG_CASE_ARG_CS_SV_DC(selected, result)
1039 #define ARG_CASE_ARG_CS_SV(selected, result)
1040 #define ARG_CASE_ARG_CS(selected, result)
1041 #define ARG_CASE_ARG_SV(selected, result)
1042 #define ARG_CASE_ARG_DC(selected, result)
1043 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
1046 #undef ARG_CASE_ARG_DC
1047 #undef ARG_CASE_ARG_SV
1048 #undef ARG_CASE_ARG_CS
1049 #undef ARG_CASE_ARG_CS_SV
1050 #undef ARG_CASE_ARG_CS_SV_DC
1051 #undef ARG_CASE_ARG_CS_SV_HA
1056#ifdef NOTIFICATIONS_DEBUG
1057 Debug_Notification(sprintf(
1058 "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s, %s);\n",
1062 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4),
1070 string input,
string durcnt,
1071 CPID cpid,
float f1,
float f2)
1076 for (
int sel_num = 0; durcnt !=
""; )
1078 string selected =
car(durcnt);
1079 durcnt =
cdr(durcnt);
1083 #define ARG_CASE_ARG_CS_SV_HA(selected, result)
1084 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: arg_slot[sel_num++] = result; break;
1085 #define ARG_CASE_ARG_CS_SV(selected, result)
1086 #define ARG_CASE_ARG_CS(selected, result)
1087 #define ARG_CASE_ARG_SV(selected, result)
1088 #define ARG_CASE_ARG_DC(selected, result) case selected: arg_slot[sel_num++] = result; break;
1089 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
1092 #undef ARG_CASE_ARG_DC
1093 #undef ARG_CASE_ARG_SV
1094 #undef ARG_CASE_ARG_CS
1095 #undef ARG_CASE_ARG_CS_SV
1096 #undef ARG_CASE_ARG_CS_SV_DC
1097 #undef ARG_CASE_ARG_CS_SV_HA
1108#ifdef NOTIFICATIONS_DEBUG
1109 Debug_Notification(sprintf(
1110 "Local_Notification_centerprint_Add('%s^7', '%s', %d, %d, %d, %d);\n",
1134 if (queue_time == 0)
1182 #ifdef NOTIFICATIONS_DEBUG
1183 Debug_Notification(sprintf(
1184 "Local_Notification(%s, NULL, ...);\n",
1188 LOG_WARNF(
"Incorrect usage of Local_Notification: %s",
"Null notification");
1193 if (!notif.nent_enabled)
1195 #ifdef NOTIFICATIONS_DEBUG
1196 Debug_Notification(sprintf(
1197 "Local_Notification(%s, %s, ...): Entity was disabled...\n",
1205 string s1 = (notif.nent_stringcount > 0) ? ...(0,
string) :
"";
1206 string s2 = (notif.nent_stringcount > 1) ? ...(1,
string) :
"";
1207 string s3 = (notif.nent_stringcount > 2) ? ...(2,
string) :
"";
1208 string s4 = (notif.nent_stringcount > 3) ? ...(3,
string) :
"";
1209 float f1 = ((notif.nent_floatcount > 0) ? ...((notif.nent_stringcount + 0),
float) : 0);
1210 float f2 = ((notif.nent_floatcount > 1) ? ...((notif.nent_stringcount + 1),
float) : 0);
1211 float f3 = ((notif.nent_floatcount > 2) ? ...((notif.nent_stringcount + 2),
float) : 0);
1212 float f4 = ((notif.nent_floatcount > 3) ? ...((notif.nent_stringcount + 3),
float) : 0);
1214#ifdef NOTIFICATIONS_DEBUG
1215 Debug_Notification(sprintf(
1216 "Local_Notification(%s, %s, %s, %s);\n",
1220 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
1224 if (notif.nent_stringcount + notif.nent_floatcount !=
count)
1228 "Arguments mismatch for Local_Notification(%s, %s, ...)! "
1229 "stringcount(%d) + floatcount(%d) != count(%d)\n"
1230 "Check the definition and function call for accuracy...?\n"
1234 notif.nent_stringcount,
1235 notif.nent_floatcount,
1248 backtrace(
"MSG_ANNCE on server?... Please notify Samual immediately!\n");
1263 if (notif.nent_icon !=
"")
1265 if (notif.nent_iconargs !=
"")
1268 notif.nent_icon, notif.nent_iconargs,
1298 if (notif.nent_msginfo && notif.nent_msginfo.nent_enabled)
1307 if (notif.nent_msgannce && notif.nent_msgannce.nent_enabled)
1309 if (notif.nent_msgcenter && notif.nent_msgcenter.nent_enabled)
1313 notif.nent_msgcenter,
1322 entity found_choice = notif.nent_optiona;
1323 if (notif.nent_challow_var && (
warmup_stage || notif.nent_challow_var == 2))
1327 case 2: found_choice = notif.nent_optionb;
break;
1332 found_choice.nent_type,
1343 string s1,
string s2,
string s3,
string s4,
1344 float f1,
float f2,
float f3,
float f4)
1346 #define VARITEM(args) \
1348 Local_Notification(net_type, net_name, args); \
1369 int net_name = ReadShort();
1372 if (net_type == MSG_CENTER_KILL)
1377 #ifdef NOTIFICATIONS_DEBUG
1378 Debug_Notification(sprintf(
1379 "Read_Notification(%d) at %f: net_type = %s, cpid = %d\n",
1386 int _net_name = net_name;
1387 CPID net_name =
ENUMCAST(CPID, _net_name);
1397#ifdef NOTIFICATIONS_DEBUG
1398 Debug_Notification(sprintf(
1399 "Read_Notification(%d) at %f: net_type = %s, net_name = %s (%d)\n",
1410 backtrace(
"Read_Notification: Could not find notification entity!\n");
1414 string s1 = (notif.nent_stringcount > 0 ?
ReadString() :
"");
1415 string s2 = (notif.nent_stringcount > 1 ?
ReadString() :
"");
1416 string s3 = (notif.nent_stringcount > 2 ?
ReadString() :
"");
1417 string s4 = (notif.nent_stringcount > 3 ?
ReadString() :
"");
1418 float f1 = (notif.nent_floatcount > 0 ? ReadLong() : 0);
1419 float f2 = (notif.nent_floatcount > 1 ? ReadLong() : 0);
1420 float f3 = (notif.nent_floatcount > 2 ? ReadLong() : 0);
1421 float f4 = (notif.nent_floatcount > 3 ? ReadLong() : 0);
1435 #ifdef NOTIFICATIONS_DEBUG
1436 Debug_Notification(sprintf(
1437 "Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
1465 NOTIF broadcast,
entity client,
1469#ifdef NOTIFICATIONS_DEBUG
1470 Debug_Notification(sprintf(
1471 "Kill_Notification(%s, '%s', %s, %d);\n",
1480 if (checkargs !=
"")
1482 LOG_WARNF(
"Incorrect usage of Kill_Notification: %s", checkargs);
1487 net_notif.nent_broadcast = broadcast;
1488 net_notif.nent_client = client;
1489 net_notif.nent_net_type = MSG_CENTER_KILL;
1490 net_notif.nent_net_name =
ORDINAL(net_cpid);
1495 it.nent_net_name = -1;
1496 it.nextthink = time;
1501 NOTIF broadcast,
entity client,
1511 #define NOTIF_INFO() sprintf("%s, '%s', %s, %s", \
1512 Get_Notif_BroadcastName(broadcast), \
1514 Get_Notif_TypeName(net_type), \
1515 Get_Notif_Name(net_name))
1517#ifdef NOTIFICATIONS_DEBUG
1518 Debug_Notification(sprintf(
"Send_Notification(%s, ...%d);\n",
NOTIF_INFO(),
count));
1523 LOG_WARN(
"Send_Notification: Could not find notification entity!");
1530 checkargs = sprintf(
"No notification provided! %s", checkargs);
1531 if (checkargs !=
"")
1533 LOG_WARNF(
"Incorrect usage of Send_Notification: %s", checkargs);
1537 string s1 = (0 < notif.nent_stringcount ? ...(0,
string) :
"");
1538 string s2 = (1 < notif.nent_stringcount ? ...(1,
string) :
"");
1539 string s3 = (2 < notif.nent_stringcount ? ...(2,
string) :
"");
1540 string s4 = (3 < notif.nent_stringcount ? ...(3,
string) :
"");
1541 float f1 = (0 < notif.nent_floatcount ? ...((notif.nent_stringcount + 0),
float) : 0);
1542 float f2 = (1 < notif.nent_floatcount ? ...((notif.nent_stringcount + 1),
float) : 0);
1543 float f3 = (2 < notif.nent_floatcount ? ...((notif.nent_stringcount + 2),
float) : 0);
1544 float f4 = (3 < notif.nent_floatcount ? ...((notif.nent_stringcount + 3),
float) : 0);
1546#ifdef NOTIFICATIONS_DEBUG
1547 Debug_Notification(sprintf(
1548 "Send_Notification(%s, %s, %s);\n",
1551 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
1555 if (notif.nent_stringcount + notif.nent_floatcount !=
count)
1558 "Argument mismatch for Send_Notification(%s, ...)! "
1559 "stringcount(%d) + floatcount(%d) != count(%d)\n"
1560 "Check the definition and function call for accuracy...?\n",
1562 notif.nent_stringcount,
1563 notif.nent_floatcount,
1570 && (broadcast == NOTIF_ALL || broadcast == NOTIF_ALL_EXCEPT)
1571 && !(net_type == MSG_ANNCE || net_type == MSG_CENTER))
1577 if (net_type == MSG_CHOICE)
1586 #define RECURSE_FROM_CHOICE(ent, action) MACRO_BEGIN \
1587 if (notif.nent_challow_var && (warmup_stage || notif.nent_challow_var == 2)) \
1588 switch (CS_CVAR(ent).msg_choice_choices[net_name.nent_choice_idx]) \
1590 case 1: found_choice = notif.nent_optiona; break; \
1591 case 2: found_choice = notif.nent_optionb; break; \
1595 found_choice = notif.nent_optiona; \
1596 Send_Notification_Core( \
1599 found_choice.nent_type, \
1607 case NOTIF_ONE_ONLY:
1623 net_notif.owner = notif;
1624 net_notif.nent_broadcast = broadcast;
1625 net_notif.nent_client = client;
1626 net_notif.nent_net_type = net_type;
1627 net_notif.nent_net_name = notif.m_id;
1628 net_notif.nent_stringcount = notif.nent_stringcount;
1629 net_notif.nent_floatcount = notif.nent_floatcount;
1631 for (
int i = 0; i < net_notif.nent_stringcount; ++i)
1632 net_notif.nent_strings[i] =
strzone(...(i,
string));
1633 for (
int i = 0; i < net_notif.nent_floatcount; ++i)
1634 net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i),
float);
1647 NOTIF broadcast,
entity client,
1649 string s1,
string s2,
string s3,
string s4,
1650 float f1,
float f2,
float f3,
float f4)
1652#ifdef NOTIFICATIONS_DEBUG
1654 Debug_Notification(sprintf(
1655 "Send_Notification_Core(%s, %s, %s);\n",
1664 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
1668 #define VARITEM(args) \
1670 Send_Notification(broadcast, client, net_type, net_name, args); \
1680#undef EIGHT_VARS_TO_VARARGS_VARLIST
1682#undef NOTIF_ARGUMENT_LIST
1684#undef NOTIF_HIT_UNKNOWN
float autocvar_cl_announcer_antispam
void centerprint_KillAll()
void centerprint_Add(int new_id, string strMessage, float duration, int countdown_num)
void centerprint_Kill(int id)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
var float(entity ent) nudgeoutofsolid_OrFallback
#define IS_NOT_A_CLIENT(s)
string strtolower(string s)
ERASEABLE string MakeConsoleSafe(string input)
Escape the string to make it safe for consoles.
WriteString(chan, ent.netname)
WriteByte(chan, ent.angles.y/DEC_FACTOR)
void GetCvars_handleFloat(entity this, entity store, string thisname, float f,.float field, string name)
void HUD_Notify_Push(string icon, string attacker, string victim)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
#define FOREACH(list, cond, body)
#define NET_HANDLE(id, param)
#define WriteHeader(to, id)
#define REGISTER_NET_LINKED(id)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points f2
spree_inf s1 s2 s3loc s2 s1
s1 s2 s1 s2 FLAG s1 s2 FLAG spree_cen s1 CPID_Null
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points s1 s2
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void Local_Notification_centerprint_Add(string input, string durcnt, CPID cpid, float f1, float f2)
void Local_Notification_Core(MSG net_type, Notification net_name, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
glue for networking, forwards to Local_Notification
void Create_Notification_Entity_InfoCenter(entity notif, int var_cvar, int strnum, int flnum, string args, string hudargs, string icon, CPID cpid, string durcnt, string normal, string gentle)
string Process_Notif_Line(MSG typeId, bool chat, string input, string notiftype, string notifname, string stringtype)
#define AnnouncerFilename(snd)
void Send_Notification_Core(NOTIF broadcast, entity client, MSG net_type, Notification net_name, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
void Kill_Notification(NOTIF broadcast, entity client, MSG net_type, CPID net_cpid)
void Destroy_Notification_Entity(entity notif)
Used by restartnotifs command to initialize notifications.
#define NOTIF_WRITE_ENTITY(e, description)
void Local_Notification(MSG net_type, Notification net_name,...count)
bool Net_Write_Notification(entity this, entity client, int sf)
void Create_Notification_Entity_Multi(entity notif, int var_cvar, Notification anncename, Notification infoname, Notification centername)
void Net_Notification_Remove(entity this)
void Local_Notification_Queue_Add(MSG net_type, entity notif, float queue_time)
bool Notification_ShouldSend(NOTIF broadcast, entity to_client, entity other_client)
#define RECURSE_FROM_CHOICE(ent, action)
void Local_Notification_Queue_Run(MSG net_type, entity notif)
#define SET_NOTIF_STRING(string, stringname)
string Process_Notif_Args(float arg_type, string args, string notiftype, string notifname)
void Create_Notification_Entity_Choice(entity notif, int var_cvar, int challow_def, int challow_var, MSG chtype, Notification optiona, Notification optionb)
void Create_Notification_Entity_Annce(entity notif, int var_cvar, int channel, string snd, float vol, float position, float queuetime)
void Create_Notification_Entity(entity notif, int var_default, int var_cvar, MSG typeId, int teamnum)
void Local_Notification_Queue_Process()
void Destroy_All_Notifications()
#define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb)
void Local_Notification_HUD_Notify_Push(string icon, string hudargs, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
string Notification_CheckArgs(NOTIF broadcast, entity client)
Checks supplied broadcast and target for errors.
string Local_Notification_sprintf(string input, string args, string s1, string s2, string s3, string s4, int f1, float f2, float f3, float f4)
#define NOTIF_WRITE_HARDCODED(cvar, default, description)
void Local_Notification_sound(int soundchannel, string soundfile, float soundvolume, float soundposition)
void Dump_Notifications(int fh, bool alsoprint)
Used to output notifications.cfg file.
void Notification_GetCvars(entity this, entity store)
Used by MSG_CHOICE to build list of choices.
const int NOTIF_MAX_HUDARGS
#define Get_Notif_Name(notif)
main types/groups of notifications
const int NOTIF_MAX_DURCNT
int msg_choice_choices[NOTIF_CHOICE_MAX]
set on each player containing MSG_CHOICE choices
string arg_slot[NOTIF_MAX_ARGS]
float notif_queue_next_time
entity notif_queue_entity[NOTIF_QUEUE_MAX]
IntrusiveList g_notifications
float autocvar_notification_lifetime_mapload
Notification Get_Notif_Ent(MSG net_type, int net_name)
const int NOTIF_QUEUE_MAX
MSG notif_queue_type[NOTIF_QUEUE_MAX]
float autocvar_notification_lifetime_runtime
#define EIGHT_VARS_TO_VARARGS_VARLIST(stringcount, floatcount)
string Get_Notif_BroadcastName(NOTIF broadcast)
send to one client and their spectators
entity Notification
always last
string Get_Notif_TypeName(MSG net_type)
#define NOTIF_HIT_UNKNOWN(token, funcname)
float notif_queue_time[NOTIF_QUEUE_MAX]
#define NOTIF_HIT_MAX(count, funcname)
string Get_Notif_CvarName(Notification notif)
#define NOTIF_ARGUMENT_LIST
#define make_pure(e)
direct use is
#define new_pure(class)
purely logical entities (not linked to the area grid)
#define _sound(e, c, s, v, a)
ERASEABLE string car(string s)
Returns first word.
ERASEABLE string cdr(string s)
Returns all but first word.
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
bool autocvar_sv_dedicated