22 NOTIF broadcast,
entity client)
31 return "No client provided!";
36 case NOTIF_ALL_EXCEPT:
39 return "Exception can't be a non-client!";
47 return "Entity provided when NULL was required!";
55 return "Teamplay not active!";
56 }
else if (!client.team) {
62 case NOTIF_TEAM_EXCEPT:
65 return "Teamplay not active!";
67 return "Exception can't be a non-client!";
74 return sprintf(
"Improper broadcast: %d!", broadcast);
89 (to_client == other_client)
91 (
IS_SPEC(to_client) && (to_client.enemy == other_client))
94 return (to_client == other_client);
97 (to_client.team == other_client.team)
102 (to_client.enemy.team == other_client.team)
105 case NOTIF_TEAM_EXCEPT:
107 (to_client != other_client)
110 (to_client.team == other_client.team)
116 (to_client.enemy != other_client)
118 (to_client.enemy.team == other_client.team)
125 case NOTIF_ALL_EXCEPT:
127 (to_client != other_client)
132 (to_client.enemy == other_client)
149 if (notif.nent_name !=
"")
strunzone(notif.nent_name);
150 if (notif.nent_snd !=
"")
strunzone(notif.nent_snd);
151 if (notif.nent_args !=
"")
strunzone(notif.nent_args);
152 if (notif.nent_hudargs !=
"")
strunzone(notif.nent_hudargs);
153 if (notif.nent_icon !=
"")
strunzone(notif.nent_icon);
154 if (notif.nent_durcnt !=
"")
strunzone(notif.nent_durcnt);
155 if (notif.nent_string !=
"")
strunzone(notif.nent_string);
181 if(typeId == MSG_INFO)
183 if((chat && autocvar_notification_allow_chatboxprint)
184 || (autocvar_notification_allow_chatboxprint == 2))
187 input =
strcat(
"\{3}", input);
191 input = strreplace(
"\n",
"\n\{3}", input);
205 "^1TRAILING NEW LINE AT END OF NOTIFICATION: "
206 "^7net_type = %s, net_name = %s, string = %s."
225 string selected, remaining = args;
228 for (;(remaining !=
"");)
230 selected =
car(remaining); remaining =
cdr(remaining);
240 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
241 "^7net_type = %s, net_name = %s, max args = %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) case selected: ++sel_num; break;
255 #define ARG_CASE_ARG_CS_SV(selected,result) case selected: ++sel_num; break;
256 #define ARG_CASE_ARG_CS(selected,result) case selected: ++sel_num; break;
257 #define ARG_CASE_ARG_SV(selected,result) case selected: ++sel_num; break;
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
272 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
273 "^7net_type = %s, net_name = %s, args arg = '%s'."
291 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
292 "^7net_type = %s, net_name = %s, max hudargs = %d."
304 #define ARG_CASE_ARG_CS_SV_HA(selected,result) case selected: ++sel_num; break;
305 #define ARG_CASE_ARG_CS_SV_DC(selected,result)
306 #define ARG_CASE_ARG_CS_SV(selected,result)
307 #define ARG_CASE_ARG_CS(selected,result)
308 #define ARG_CASE_ARG_SV(selected,result)
309 #define ARG_CASE_ARG_DC(selected,result)
310 #define ARG_CASE(prog,selected,result) ARG_CASE_##prog(selected,result)
313 #undef ARG_CASE_ARG_DC
314 #undef ARG_CASE_ARG_SV
315 #undef ARG_CASE_ARG_CS
316 #undef ARG_CASE_ARG_CS_SV
317 #undef ARG_CASE_ARG_CS_SV_DC
318 #undef ARG_CASE_ARG_CS_SV_HA
323 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
324 "^7net_type = %s, net_name = %s, hudargs arg = '%s'."
342 "^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
343 "^7net_type = %s, net_name = %s, max durcnt = %d."
355 #define ARG_CASE_ARG_CS_SV_HA(selected,result)
356 #define ARG_CASE_ARG_CS_SV_DC(selected,result) case selected: ++sel_num; break;
357 #define ARG_CASE_ARG_CS_SV(selected,result)
358 #define ARG_CASE_ARG_CS(selected,result)
359 #define ARG_CASE_ARG_SV(selected,result)
360 #define ARG_CASE_ARG_DC(selected,result) case selected: ++sel_num; break;
361 #define ARG_CASE(prog,selected,result) ARG_CASE_##prog(selected,result)
364 #undef ARG_CASE_ARG_DC
365 #undef ARG_CASE_ARG_SV
366 #undef ARG_CASE_ARG_CS
367 #undef ARG_CASE_ARG_CS_SV
368 #undef ARG_CASE_ARG_CS_SV_DC
369 #undef ARG_CASE_ARG_CS_SV_HA
372 if(
ftos(
stof(selected)) !=
"") { ++sel_num; }
377 "^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
378 "^7net_type = %s, net_name = %s, durcnt arg = '%s'."
406 notif.nent_default = var_default;
407 notif.nent_enabled = (var_cvar >= 1);
408 notif.nent_type = typeId;
409 notif.nent_name =
strzone(namestring);
410 notif.nent_teamnum = teamnum;
426 "^1NOTIFICATION WITH IMPROPER TYPE: "
427 "^7net_type = %d, net_name = %s."
439 notif.nent_enabled =
false;
444#define AnnouncerFilename(snd) sprintf("announcer/%s/%s.wav", AnnouncerOption(), snd)
458 MSG typeId = MSG_ANNCE;
459 if (!(
GENTLE && (var_cvar == 1)))
463 if(notif.nent_enabled)
466 notif.nent_channel = channel;
468 notif.nent_vol = vol;
469 notif.nent_position = position;
470 notif.nent_queuetime = queuetime;
478 "^1NOTIFICATION WITH NO SOUND: "
479 "^7net_type = %s, net_name = %s."
487 else { notif.nent_enabled =
false; }
489 notif.nent_enabled =
false;
508 MSG typeId = notif.nent_type;
510 notif.nent_stringcount = strnum;
511 notif.nent_floatcount = flnum;
517 float should_process_args =
true;
520 if(should_process_args)
532 else if((hudargs ==
"") && (durcnt ==
""))
536 "^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: "
537 "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d"
565 if(icon !=
"") { notif.nent_icon =
strzone(icon); }
570 "^1NOTIFICATION HAS HUDARGS BUT NO ICON: "
571 "^7net_type = %s, net_name = %s."
583 "^1NOTIFICATION HAS ICON BUT NO HUDARGS: "
584 "^7net_type = %s, net_name = %s.\n"
596 if (cpid ==
CPID_Null && durcnt !=
"0 0")
600 "Notification has durcnt but no cpid: "
601 "net_type = %s, net_name = %s."
609 notif.nent_cpid = cpid;
616 #define SET_NOTIF_STRING(string,stringname) MACRO_BEGIN \
617 notif.nent_string = strzone(CCR( \
618 Process_Notif_Line( \
635 #undef SET_NOTIF_STRING
638 if(notif.nent_string ==
"")
642 "^1EMPTY NOTIFICATION: "
643 "^7net_type = %s, net_name = %s."
661 MSG typeId = MSG_MULTI;
663 if (!anncename && !infoname && !centername)
668 "^1NOTIFICATION WITH NO SUBCALLS: "
669 "^7net_type = %s, net_name = %s."
679 if (anncename) { notif.nent_msgannce = anncename; }
681 float infoname_stringcount = 0, infoname_floatcount = 0;
682 float centername_stringcount = 0, centername_floatcount = 0;
686 notif.nent_msginfo = infoname;
687 infoname_stringcount = notif.nent_msginfo.nent_stringcount;
688 infoname_floatcount = notif.nent_msginfo.nent_floatcount;
693 notif.nent_msgcenter = centername;
694 centername_stringcount = notif.nent_msgcenter.nent_stringcount;
695 centername_floatcount = notif.nent_msgcenter.nent_floatcount;
699 notif.nent_stringcount =
max(infoname_stringcount, centername_stringcount);
700 notif.nent_floatcount =
max(infoname_floatcount, centername_floatcount);
714 MSG typeId = MSG_CHOICE;
715 if (chtype == MSG_Null || !optiona || !optionb)
720 "^1NOTIFICATION IS MISSING CHOICE PARAMS: "
721 "^7net_type = %s, net_name = %s."
730 notif.nent_optiona = optiona;
731 notif.nent_optionb = optionb;
732 notif.nent_challow_def = challow_def;
733 notif.nent_challow_var = challow_var;
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);
769 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
770 GetCvars_handleFloat(
775 msg_choice_choices[it.nent_choice_idx],
776 sprintf(
"notification_%s", Get_Notif_CvarName(it))
785 #define NOTIF_WRITE(str) write_String_To_File(fh, str, alsoprint)
787 #define NOTIF_WRITE_ENTITY(e, description) \
788 NOTIF_WRITE(sprintf( \
789 "seta notification_%s \"%d\" \"%s\"\n", \
790 Get_Notif_CvarName(e), e.nent_default, description \
793 #define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb) \
794 NOTIF_WRITE(sprintf( \
795 "seta notification_%s \"%d\" \"%s\"\n" \
796 "seta notification_%s_ALLOWED \"%d\" \"%s\"\n", \
797 Get_Notif_CvarName(e), e.nent_default, descriptiona, \
798 Get_Notif_CvarName(e), e.nent_challow_def, descriptionb \
801 #define NOTIF_WRITE_HARDCODED(cvar, default, description) \
802 NOTIF_WRITE("seta notification_" cvar " \"" default "\" \"" description "\"\n")
810 "// ********************************************** //\n"
811 "// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n"
813 "// ** This file is automatically generated ** //\n"
814 "// ** by code with the command 'dumpnotifs'. ** //\n"
816 "// ** If you add a new notification, please ** //\n"
817 "// ** regenerate this file with that command ** //\n"
818 "// ** making sure that the output matches ** //\n"
819 "// ** with the lists and defaults in code. ** //\n"
821 "// ********************************************** //\n");
827 int NOTIF_ANNCE_COUNT = 0;
828 int NOTIF_INFO_COUNT = 0;
829 int NOTIF_CENTER_COUNT = 0;
830 int NOTIF_MULTI_COUNT = 0;
831 int NOTIF_CHOICE_COUNT = 0;
833 switch (it.nent_type)
835 case MSG_ANNCE: ++NOTIF_ANNCE_COUNT;
break;
836 case MSG_INFO: ++NOTIF_INFO_COUNT;
break;
837 case MSG_CENTER: ++NOTIF_CENTER_COUNT;
break;
838 case MSG_MULTI: ++NOTIF_MULTI_COUNT;
break;
839 case MSG_CHOICE: ++NOTIF_CHOICE_COUNT;
break;
843 NOTIF_WRITE(sprintf(
"\n// MSG_ANNCE notifications:\n"));
844 FOREACH(Notifications, it.nent_type == MSG_ANNCE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
845 NOTIF_WRITE_ENTITY(it,
846 "\\\"0\\\" = disabled, \\\"1\\\" = enabled if gentle mode is off, \\\"2\\\" = always enabled"
850 NOTIF_WRITE(sprintf(
"\n// MSG_INFO notifications:\n"));
851 FOREACH(Notifications, it.nent_type == MSG_INFO && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
852 NOTIF_WRITE_ENTITY(it,
853 "\\\"0\\\" = off, \\\"1\\\" = print to console, "
854 "\\\"2\\\" = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
858 NOTIF_WRITE(sprintf(
"\n// MSG_CENTER notifications:\n"));
859 FOREACH(Notifications, it.nent_type == MSG_CENTER && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
860 NOTIF_WRITE_ENTITY(it,
861 "\\\"0\\\" = off, \\\"1\\\" = centerprint"
865 NOTIF_WRITE(sprintf(
"\n// MSG_MULTI notifications:\n"));
866 FOREACH(Notifications, it.nent_type == MSG_MULTI && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
867 NOTIF_WRITE_ENTITY(it,
868 "enable this multiple notification"
872 NOTIF_WRITE(sprintf(
"\n// MSG_CHOICE notifications:\n"));
873 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
874 NOTIF_WRITE_ENTITY_CHOICE(it,
875 "choice for this notification; \\\"0\\\" = off, \\\"1\\\" = default message, \\\"2\\\" = verbose message",
876 "allow choice for this notification; \\\"0\\\" = off, \\\"1\\\" = only in warmup-stage, \\\"2\\\" = always"
881 NOTIF_WRITE(
"\n// HARD CODED notification variables:\n");
884 "allow_chatboxprint",
"1",
885 "allow INFO notifications to be printed to chat box; "
886 "\\\"0\\\" = do not allow, "
887 "\\\"1\\\" = allow only if allowed by individual notification_INFO* cvars, "
888 "\\\"2\\\" = force all INFO notifications to be printed to the chatbox"
893 "print extra debug information on all notification function calls "
894 "(REQUIRES: -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation); "
895 "\\\"0\\\" = disabled, \\\"1\\\" = dprint, \\\"2\\\" = print"
899 "errors_are_fatal",
"1",
900 "if a notification fails upon initialization, cause a Host_Error to stop the program"
904 "item_centerprinttime",
"1.5",
905 "how long to show item information centerprint messages (like 'You got the Electro' or such)"
909 "lifetime_mapload",
"10",
910 "amount of time that notification entities last immediately at mapload (in seconds) "
911 "to help prevent notifications from being lost on early init (like gamestart countdown)"
915 "lifetime_runtime",
"0.5",
916 "amount of time that notification entities last on the server during runtime (in seconds)"
920 "server_allows_location",
"1",
921 "server side cvar for allowing death messages to show location information too"
925 "show_location",
"0",
926 "append location information to MSG_INFO death/kill messages"
930 "show_location_string",
"",
931 "replacement string piped into sprintf, "
932 "so you can do different messages like ' at the %s' or ' (near %s)'"
937 "print information about sprees in death/kill messages"
941 "show_sprees_center",
"1",
942 "show spree information in MSG_CENTER messages; "
943 "\\\"0\\\" = off, \\\"1\\\" = target (but only for first victim) and attacker"
947 "show_sprees_center_specialonly",
"1",
948 "do not show spree information in MSG_CENTER messages if it is not an achievement"
952 "show_sprees_info",
"3",
953 "show spree information in MSG_INFO messages; "
954 "\\\"0\\\" = off, \\\"1\\\" = target only, \\\"2\\\" = attacker only, \\\"3\\\" = target and attacker"
958 "show_sprees_info_newline",
"1",
959 "show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
963 "show_sprees_info_specialonly",
"1",
964 "do not show attacker spree information in MSG_INFO messages if it is not an achievement"
967 LOG_INFOF(
"Notification counts (total = %d): "
968 "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n",
982 #undef NOTIF_WRITE_HARDCODED
983 #undef NOTIF_WRITE_ENTITY
993 string input,
string args,
994 string s1,
string s2,
string s3,
string s4,
995 int f1,
float f2,
float f3,
float f4)
997 #ifdef NOTIFICATIONS_DEBUG
998 Debug_Notification(sprintf(
999 "Local_Notification_sprintf('%s^7', '%s', %s, %s);\n",
1003 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
1009 for (
int sel_num = 0; (args !=
""); )
1011 string selected =
car(args); args =
cdr(args);
1016 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: arg_slot[sel_num++] = result; break;
1017 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: arg_slot[sel_num++] = result; break;
1018 #define ARG_CASE_ARG_CS_SV(selected, result) case selected: arg_slot[sel_num++] = result; break;
1020 #define ARG_CASE_ARG_CS(selected, result) case selected: arg_slot[sel_num++] = result; break;
1021 #define ARG_CASE_ARG_SV(selected, result)
1023 #define ARG_CASE_ARG_CS(selected, result)
1024 #define ARG_CASE_ARG_SV(selected, result) case selected: arg_slot[sel_num++] = result; break;
1026 #define ARG_CASE_ARG_DC(selected, result)
1027 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
1030 #undef ARG_CASE_ARG_DC
1031 #undef ARG_CASE_ARG_SV
1032 #undef ARG_CASE_ARG_CS
1033 #undef ARG_CASE_ARG_CS_SV
1034 #undef ARG_CASE_ARG_CS_SV_DC
1035 #undef ARG_CASE_ARG_CS_SV_HA
1056 #ifdef NOTIFICATIONS_DEBUG
1057 Debug_Notification(sprintf(
1058 "Local_Notification_sound(%f, '%s', %f, %f);\n",
1073 #ifdef NOTIFICATIONS_DEBUG
1074 Debug_Notification(sprintf(
1076 "Local_Notification_sound(%f, '%s', %f, %f) "
1077 "^1BLOCKED BY ANTISPAM:^7 prevsnd: '%s', timediff: %f, limit: %f\n"
1092 string icon,
string hudargs,
1093 string s1,
string s2,
string s3,
string s4,
1094 float f1,
float f2,
float f3,
float f4)
1098 for (
int sel_num = 0; (hudargs !=
""); )
1100 string selected =
car(hudargs); hudargs =
cdr(hudargs);
1104 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: arg_slot[sel_num++] = result; break;
1105 #define ARG_CASE_ARG_CS_SV_DC(selected, result)
1106 #define ARG_CASE_ARG_CS_SV(selected, result)
1107 #define ARG_CASE_ARG_CS(selected, result)
1108 #define ARG_CASE_ARG_SV(selected, result)
1109 #define ARG_CASE_ARG_DC(selected, result)
1110 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result)
1113 #undef ARG_CASE_ARG_DC
1114 #undef ARG_CASE_ARG_SV
1115 #undef ARG_CASE_ARG_CS
1116 #undef ARG_CASE_ARG_CS_SV
1117 #undef ARG_CASE_ARG_CS_SV_DC
1118 #undef ARG_CASE_ARG_CS_SV_HA
1122 #ifdef NOTIFICATIONS_DEBUG
1123 Debug_Notification(sprintf(
1124 "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s, %s);\n",
1128 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4),
1136 string input,
string durcnt,
1137 CPID cpid,
float f1,
float f2)
1141 for (
int sel_num = 0; (durcnt !=
""); )
1143 string selected =
car(durcnt); durcnt =
cdr(durcnt);
1147 #define ARG_CASE_ARG_CS_SV_HA(selected, result)
1148 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: arg_slot[sel_num++] = result; break;
1149 #define ARG_CASE_ARG_CS_SV(selected, result)
1150 #define ARG_CASE_ARG_CS(selected, result)
1151 #define ARG_CASE_ARG_SV(selected, result)
1152 #define ARG_CASE_ARG_DC(selected, result) case selected: arg_slot[sel_num++] = result; break;
1153 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected,result)
1156 #undef ARG_CASE_ARG_DC
1157 #undef ARG_CASE_ARG_SV
1158 #undef ARG_CASE_ARG_CS
1159 #undef ARG_CASE_ARG_CS_SV
1160 #undef ARG_CASE_ARG_CS_SV_DC
1161 #undef ARG_CASE_ARG_CS_SV_HA
1170 #ifdef NOTIFICATIONS_DEBUG
1171 Debug_Notification(sprintf(
1172 "Local_Notification_centerprint_Add('%s^7', '%s', %d, %d, %d, %d);\n",
1242 #ifdef NOTIFICATIONS_DEBUG
1243 Debug_Notification(sprintf(
1244 "Local_Notification(%s, NULL, ...);\n",
1248 LOG_WARNF(
"Incorrect usage of Local_Notification: %s",
"Null notification");
1253 if (!notif.nent_enabled)
1255 #ifdef NOTIFICATIONS_DEBUG
1256 Debug_Notification(sprintf(
1257 "Local_Notification(%s, %s, ...): Entity was disabled...\n",
1265 string s1 = (notif.nent_stringcount > 0) ? ...(0,
string) :
"";
1266 string s2 = (notif.nent_stringcount > 1) ? ...(1,
string) :
"";
1267 string s3 = (notif.nent_stringcount > 2) ? ...(2,
string) :
"";
1268 string s4 = (notif.nent_stringcount > 3) ? ...(3,
string) :
"";
1269 float f1 = ((notif.nent_floatcount > 0) ? ...((notif.nent_stringcount + 0),
float) : 0);
1270 float f2 = ((notif.nent_floatcount > 1) ? ...((notif.nent_stringcount + 1),
float) : 0);
1271 float f3 = ((notif.nent_floatcount > 2) ? ...((notif.nent_stringcount + 2),
float) : 0);
1272 float f4 = ((notif.nent_floatcount > 3) ? ...((notif.nent_stringcount + 3),
float) : 0);
1274 #ifdef NOTIFICATIONS_DEBUG
1275 Debug_Notification(sprintf(
1276 "Local_Notification(%s, %s, %s, %s);\n",
1280 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
1284 if ((notif.nent_stringcount + notif.nent_floatcount) !=
count)
1288 "Arguments mismatch for Local_Notification(%s, %s, ...)! "
1289 "stringcount(%d) + floatcount(%d) != count(%d)\n"
1290 "Check the definition and function call for accuracy...?\n"
1294 notif.nent_stringcount,
1295 notif.nent_floatcount,
1308 backtrace(
"MSG_ANNCE on server?... Please notify Samual immediately!\n");
1323 if (notif.nent_icon !=
"")
1325 if (notif.nent_iconargs !=
"")
1328 notif.nent_icon,notif.nent_iconargs,
1361 if (notif.nent_msginfo && notif.nent_msginfo.nent_enabled)
1366 notif.nent_msginfo.nent_stringcount,
1367 notif.nent_msginfo.nent_floatcount,
1372 if (notif.nent_msgannce && notif.nent_msgannce.nent_enabled)
1376 notif.nent_msgannce,
1381 if (notif.nent_msgcenter && notif.nent_msgcenter.nent_enabled)
1385 notif.nent_msgcenter,
1386 notif.nent_msgcenter.nent_stringcount,
1387 notif.nent_msgcenter.nent_floatcount,
1397 entity found_choice = notif.nent_optiona;
1398 if (notif.nent_challow_var && (
warmup_stage || (notif.nent_challow_var == 2))) {
1402 case 2: found_choice = notif.nent_optionb;
break;
1408 found_choice.nent_type,
1410 found_choice.nent_stringcount,
1411 found_choice.nent_floatcount,
1422 float stringcount,
float floatcount,
1423 string s1,
string s2,
string s3,
string s4,
1424 float f1,
float f2,
float f3,
float f4)
1426 #define VARITEM(stringc, floatc, args) \
1427 if ((stringcount == stringc) && (floatcount == floatc)) \
1428 { Local_Notification(net_type, net_name, args); return; }
1447 int net_name = ReadShort();
1450 if (net_type == MSG_CENTER_KILL)
1452 if (!is_new)
return;
1454 #ifdef NOTIFICATIONS_DEBUG
1455 Debug_Notification(sprintf(
1456 "Read_Notification(%d) at %f: net_type = %s, cpid = %d\n",
1463 int _net_name = net_name;
1464 CPID net_name =
ENUMCAST(CPID, _net_name);
1475 #ifdef NOTIFICATIONS_DEBUG
1476 Debug_Notification(sprintf(
1477 "Read_Notification(%d) at %f: net_type = %s, net_name = %s (%d)\n",
1481 notif.registered_id,
1487 backtrace(
"Read_Notification: Could not find notification entity!\n");
1491 string s1 = ((notif.nent_stringcount > 0) ?
ReadString() :
"");
1492 string s2 = ((notif.nent_stringcount > 1) ?
ReadString() :
"");
1493 string s3 = ((notif.nent_stringcount > 2) ?
ReadString() :
"");
1494 string s4 = ((notif.nent_stringcount > 3) ?
ReadString() :
"");
1495 float f1 = ((notif.nent_floatcount > 0) ? ReadLong() : 0);
1496 float f2 = ((notif.nent_floatcount > 1) ? ReadLong() : 0);
1497 float f3 = ((notif.nent_floatcount > 2) ? ReadLong() : 0);
1498 float f4 = ((notif.nent_floatcount > 3) ? ReadLong() : 0);
1500 if (!is_new)
return;
1503 notif.nent_stringcount,
1504 notif.nent_floatcount,
1513 #ifdef NOTIFICATIONS_DEBUG
1514 Debug_Notification(sprintf(
1515 "Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
1519 this.
owner.nent_name
1538 NOTIF broadcast,
entity client,
1544 #ifdef NOTIFICATIONS_DEBUG
1545 Debug_Notification(sprintf(
1546 "Kill_Notification(%s, '%s', %s, %d);\n",
1555 if (checkargs !=
"") {
LOG_WARNF(
"Incorrect usage of Kill_Notification: %s", checkargs);
return; }
1558 net_notif.nent_broadcast = broadcast;
1559 net_notif.nent_client = client;
1560 net_notif.nent_net_type = MSG_CENTER_KILL;
1561 net_notif.nent_net_name =
ORDINAL(net_cpid);
1565 (it.owner.nent_type == net_type || net_type == MSG_Null) && (it.owner.nent_cpid == net_cpid || net_cpid ==
CPID_Null),
1567 it.nent_net_name = -1;
1568 it.nextthink = time;
1574 NOTIF broadcast,
entity client,
1578 if (broadcast == NOTIF_ONE_ONLY && !
IS_REAL_CLIENT(client))
return;
1580 string parms = sprintf(
"%s, '%s', %s, %s",
1584 net_name.registered_id
1586 #ifdef NOTIFICATIONS_DEBUG
1587 Debug_Notification(sprintf(
"Send_Notification(%s, ...%d);\n", parms,
count));
1592 LOG_WARN(
"Send_Notification: Could not find notification entity!");
1598 if (!net_name) { checkargs = sprintf(
"No notification provided! %s", checkargs); }
1599 if (checkargs !=
"")
1601 LOG_WARNF(
"Incorrect usage of Send_Notification: %s", checkargs);
1605 string s1 = ((0 < notif.nent_stringcount) ? ...(0,
string) :
"");
1606 string s2 = ((1 < notif.nent_stringcount) ? ...(1,
string) :
"");
1607 string s3 = ((2 < notif.nent_stringcount) ? ...(2,
string) :
"");
1608 string s4 = ((3 < notif.nent_stringcount) ? ...(3,
string) :
"");
1609 float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0),
float) : 0);
1610 float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1),
float) : 0);
1611 float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2),
float) : 0);
1612 float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3),
float) : 0);
1614 #ifdef NOTIFICATIONS_DEBUG
1615 Debug_Notification(sprintf(
1616 "Send_Notification(%s, %s, %s);\n",
1619 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
1623 if ((notif.nent_stringcount + notif.nent_floatcount) !=
count)
1626 "Argument mismatch for Send_Notification(%s, ...)! "
1627 "stringcount(%d) + floatcount(%d) != count(%d)\n"
1628 "Check the definition and function call for accuracy...?\n",
1630 notif.nent_stringcount,
1631 notif.nent_floatcount,
1638 && (broadcast == NOTIF_ALL || broadcast == NOTIF_ALL_EXCEPT)
1639 && !(net_type == MSG_ANNCE || net_type == MSG_CENTER)
1644 notif.nent_stringcount,
1645 notif.nent_floatcount,
1650 if (net_type == MSG_CHOICE)
1659 #define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN \
1660 if (notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) { \
1661 switch (CS_CVAR(ent).msg_choice_choices[net_name.nent_choice_idx]) \
1663 case 1: found_choice = notif.nent_optiona; break; \
1664 case 2: found_choice = notif.nent_optionb; break; \
1668 found_choice = notif.nent_optiona; \
1670 Send_Notification_WOVA( \
1673 found_choice.nent_type, \
1675 found_choice.nent_stringcount, \
1676 found_choice.nent_floatcount, \
1683 case NOTIF_ONE_ONLY:
1703 net_notif.owner = notif;
1704 net_notif.nent_broadcast = broadcast;
1705 net_notif.nent_client = client;
1706 net_notif.nent_net_type = net_type;
1707 net_notif.nent_net_name = notif.m_id;
1708 net_notif.nent_stringcount = notif.nent_stringcount;
1709 net_notif.nent_floatcount = notif.nent_floatcount;
1711 for (
int i = 0; i < net_notif.nent_stringcount; ++i) {
1712 net_notif.nent_strings[i] =
strzone(...(i,
string));
1714 for (
int i = 0; i < net_notif.nent_floatcount; ++i) {
1715 net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i),
float);
1729 NOTIF broadcast,
entity client,
1731 float stringcount,
float floatcount,
1732 string s1,
string s2,
string s3,
string s4,
1733 float f1,
float f2,
float f3,
float f4)
1735 #ifdef NOTIFICATIONS_DEBUG
1737 Debug_Notification(sprintf(
1738 "Send_Notification_WOVA(%s, %d, %d, %s, %s);\n",
1749 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
1753 #define VARITEM(stringc, floatc, args) \
1754 if ((stringcount == stringc) && (floatcount == floatc)) \
1755 { Send_Notification(broadcast, client, net_type, net_name, args); return; }
1763 NOTIF broadcast,
entity client,
1765 string s1,
string s2,
string s3,
string s4,
1766 float f1,
float f2,
float f3,
float f4)
1770 #ifdef NOTIFICATIONS_DEBUG
1771 Debug_Notification(sprintf(
1772 "Send_Notification_WOCOVA(%s, %s, %s);\n",
1781 sprintf(
"%d, %d, %d, %d",
f1,
f2, f3, f4)
1785 #define VARITEM(stringc, floatc, args) \
1786 if ((notif.nent_stringcount == stringc) && (notif.nent_floatcount == floatc)) \
1787 { Send_Notification(broadcast, client, net_type, net_name, args); return; }
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
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 Create_Notification_Entity_InfoCenter(entity notif, float var_cvar, string namestring, 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)
void Create_Notification_Entity_Annce(entity notif, float var_cvar, string namestring, float channel, string snd, float vol, float position, float queuetime)
#define AnnouncerFilename(snd)
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 Create_Notification_Entity_Multi(entity notif, float var_cvar, string namestring, Notification anncename, Notification infoname, Notification centername)
void Destroy_Notification_Entity(entity notif)
void Local_Notification(MSG net_type, Notification net_name,...count)
bool Net_Write_Notification(entity this, entity client, int sf)
void Net_Notification_Remove(entity this)
void Local_Notification_Queue_Add(MSG net_type, entity notif, float queue_time)
void Create_Notification_Entity_Choice(entity notif, float var_cvar, string namestring, float challow_def, float challow_var, MSG chtype, Notification optiona, Notification optionb)
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)
void Send_Notification_WOCOVA(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)
#define SET_NOTIF_STRING(string, stringname)
string Process_Notif_Args(float arg_type, string args, string notiftype, string notifname)
void Create_Notification_Entity(entity notif, float var_default, float var_cvar, MSG typeId, string namestring, int teamnum)
void Local_Notification_Queue_Process()
void Local_Notification_WOVA(MSG net_type, Notification net_name, float stringcount, float floatcount, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
glue for networking, forwards to Local_Notification
void Destroy_All_Notifications()
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)
void Send_Notification_WOVA(NOTIF broadcast, entity client, MSG net_type, Notification net_name, float stringcount, float floatcount, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
string Notification_CheckArgs(NOTIF broadcast, entity client)
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)
string arg_slot[NOTIF_MAX_ARGS]
float notif_queue_next_time
entity notif_queue_entity[NOTIF_QUEUE_MAX]
const float NOTIF_MAX_HUDARGS
const float NOTIF_MAX_DURCNT
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
string Get_Notif_BroadcastName(NOTIF broadcast)
send to one client and their spectators
entity Notification
always last
string Get_Notif_TypeName(MSG net_type)
main types/groups of notifications
#define NOTIF_HIT_UNKNOWN(token, funcname)
float notif_queue_time[NOTIF_QUEUE_MAX]
#define NOTIF_HIT_MAX(count, funcname)
const float NOTIF_MAX_ARGS
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