21 string Notification_CheckArgs(
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);
80 bool Notification_ShouldSend(NOTIF broadcast,
entity to_client,
entity other_client)
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)
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." 251 switch(strtolower(selected))
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." 302 switch(strtolower(selected))
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." 353 switch(strtolower(selected))
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) 457 MSG typeId = MSG_ANNCE;
458 if (!(GENTLE && (var_cvar == 1)))
462 if(notif.nent_enabled)
465 notif.nent_channel = channel;
467 notif.nent_vol = vol;
468 notif.nent_position = position;
476 "^1NOTIFICATION WITH NO SOUND: " 477 "^7net_type = %s, net_name = %s." 485 else { notif.nent_enabled =
false; }
487 notif.nent_enabled =
false;
506 MSG typeId = notif.nent_type;
508 notif.nent_stringcount = strnum;
509 notif.nent_floatcount = flnum;
515 float should_process_args =
true;
518 if(should_process_args)
530 else if((hudargs ==
"") && (durcnt ==
""))
534 "^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: " 535 "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d" 563 if(icon !=
"") { notif.nent_icon =
strzone(icon); }
568 "^1NOTIFICATION HAS HUDARGS BUT NO ICON: " 569 "^7net_type = %s, net_name = %s." 581 "^1NOTIFICATION HAS ICON BUT NO HUDARGS: " 582 "^7net_type = %s, net_name = %s.\n" 594 if (cpid ==
CPID_Null && durcnt !=
"0 0")
598 "Notification has durcnt but no cpid: " 599 "net_type = %s, net_name = %s." 607 notif.nent_cpid = cpid;
614 #define SET_NOTIF_STRING(string,stringname) MACRO_BEGIN \ 615 notif.nent_string = strzone(CCR( \ 616 Process_Notif_Line( \ 633 #undef SET_NOTIF_STRING 636 if(notif.nent_string ==
"")
640 "^1EMPTY NOTIFICATION: " 641 "^7net_type = %s, net_name = %s." 659 MSG typeId = MSG_MULTI;
661 if (!anncename && !infoname && !centername)
666 "^1NOTIFICATION WITH NO SUBCALLS: " 667 "^7net_type = %s, net_name = %s." 677 if (anncename) { notif.nent_msgannce = anncename; }
679 float infoname_stringcount = 0, infoname_floatcount = 0;
680 float centername_stringcount = 0, centername_floatcount = 0;
684 notif.nent_msginfo = infoname;
685 infoname_stringcount = notif.nent_msginfo.nent_stringcount;
686 infoname_floatcount = notif.nent_msginfo.nent_floatcount;
691 notif.nent_msgcenter = centername;
692 centername_stringcount = notif.nent_msgcenter.nent_stringcount;
693 centername_floatcount = notif.nent_msgcenter.nent_floatcount;
697 notif.nent_stringcount =
max(infoname_stringcount, centername_stringcount);
698 notif.nent_floatcount =
max(infoname_floatcount, centername_floatcount);
712 MSG typeId = MSG_CHOICE;
713 if (chtype == MSG_Null || !optiona || !optionb)
718 "^1NOTIFICATION IS MISSING CHOICE PARAMS: " 719 "^7net_type = %s, net_name = %s." 728 notif.nent_optiona = optiona;
729 notif.nent_optionb = optionb;
730 notif.nent_challow_def = challow_def;
731 notif.nent_challow_var = challow_var;
732 notif.nent_stringcount =
max(notif.nent_optiona.nent_stringcount, notif.nent_optionb.nent_stringcount);
733 notif.nent_floatcount =
max(notif.nent_optiona.nent_floatcount, notif.nent_optionb.nent_floatcount);
767 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
768 GetCvars_handleFloat(
773 msg_choice_choices[it.nent_choice_idx],
774 sprintf(
"notification_%s", Get_Notif_CvarName(it))
783 #define NOTIF_WRITE(str) write_String_To_File(fh, str, alsoprint) 785 #define NOTIF_WRITE_ENTITY(e, description) \ 786 NOTIF_WRITE(sprintf( \ 787 "seta notification_%s \"%d\" \"%s\"\n", \ 788 Get_Notif_CvarName(e), e.nent_default, description \ 791 #define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb) \ 792 NOTIF_WRITE(sprintf( \ 793 "seta notification_%s \"%d\" \"%s\"\n" \ 794 "seta notification_%s_ALLOWED \"%d\" \"%s\"\n", \ 795 Get_Notif_CvarName(e), e.nent_default, descriptiona, \ 796 Get_Notif_CvarName(e), e.nent_challow_def, descriptionb \ 799 #define NOTIF_WRITE_HARDCODED(cvar, default, description) \ 800 NOTIF_WRITE("seta notification_" cvar " \"" default "\" \"" description "\"\n") 808 "// ********************************************** //\n" 809 "// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n" 811 "// ** This file is automatically generated ** //\n" 812 "// ** by code with the command 'dumpnotifs'. ** //\n" 814 "// ** If you add a new notification, please ** //\n" 815 "// ** regenerate this file with that command ** //\n" 816 "// ** making sure that the output matches ** //\n" 817 "// ** with the lists and defaults in code. ** //\n" 819 "// ********************************************** //\n");
825 int NOTIF_ANNCE_COUNT = 0;
826 int NOTIF_INFO_COUNT = 0;
827 int NOTIF_CENTER_COUNT = 0;
828 int NOTIF_MULTI_COUNT = 0;
829 int NOTIF_CHOICE_COUNT = 0;
831 switch (it.nent_type)
833 case MSG_ANNCE: ++NOTIF_ANNCE_COUNT; break;
834 case MSG_INFO: ++NOTIF_INFO_COUNT; break;
835 case MSG_CENTER: ++NOTIF_CENTER_COUNT; break;
836 case MSG_MULTI: ++NOTIF_MULTI_COUNT; break;
837 case MSG_CHOICE: ++NOTIF_CHOICE_COUNT; break;
841 NOTIF_WRITE(sprintf(
"\n// MSG_ANNCE notifications (count = %d):\n", NOTIF_ANNCE_COUNT));
842 FOREACH(Notifications, it.nent_type == MSG_ANNCE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
843 NOTIF_WRITE_ENTITY(it,
844 "0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled" 848 NOTIF_WRITE(sprintf(
"\n// MSG_INFO notifications (count = %d):\n", NOTIF_INFO_COUNT));
849 FOREACH(Notifications, it.nent_type == MSG_INFO && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
850 NOTIF_WRITE_ENTITY(it,
851 "0 = off, 1 = print to console, " 852 "2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" 856 NOTIF_WRITE(sprintf(
"\n// MSG_CENTER notifications (count = %d):\n", NOTIF_CENTER_COUNT));
857 FOREACH(Notifications, it.nent_type == MSG_CENTER && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
858 NOTIF_WRITE_ENTITY(it,
859 "0 = off, 1 = centerprint" 863 NOTIF_WRITE(sprintf(
"\n// MSG_MULTI notifications (count = %d):\n", NOTIF_MULTI_COUNT));
864 FOREACH(Notifications, it.nent_type == MSG_MULTI && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
865 NOTIF_WRITE_ENTITY(it,
866 "Enable this multiple notification" 870 NOTIF_WRITE(sprintf(
"\n// MSG_CHOICE notifications (count = %d):\n", NOTIF_CHOICE_COUNT));
871 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum ==
NUM_TEAM_1), {
872 NOTIF_WRITE_ENTITY_CHOICE(it,
873 "Choice for this notification 0 = off, 1 = default message, 2 = verbose message",
874 "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" 879 NOTIF_WRITE(
"\n// HARD CODED notification variables:\n");
882 "allow_chatboxprint",
"1",
883 "Allow INFO notifications to be printed to chat box " 885 "1 = allow only if allowed by individual notification_INFO* cvars, " 886 "2 = force all INFO notifications to be printed to the chatbox" 891 "Print extra debug information on all notification function calls " 892 "(Requires -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation)... " 893 "0 = disabled, 1 = dprint, 2 = print" 897 "errors_are_fatal",
"1",
898 "If a notification fails upon initialization, cause a Host_Error to stop the program" 902 "item_centerprinttime",
"1.5",
903 "How long to show item information centerprint messages (like 'You got the Electro' or such)" 907 "lifetime_mapload",
"10",
908 "Amount of time that notification entities last immediately at mapload (in seconds) " 909 "to help prevent notifications from being lost on early init (like gamestart countdown)" 913 "lifetime_runtime",
"0.5",
914 "Amount of time that notification entities last on the server during runtime (In seconds)" 918 "server_allows_location",
"1",
919 "Server side cvar for allowing death messages to show location information too" 923 "show_location",
"0",
924 "Append location information to MSG_INFO death/kill messages" 928 "show_location_string",
"",
929 "Replacement string piped into sprintf, " 930 "so you can do different messages like this: ' at the %s' or ' (near %s)'" 935 "Print information about sprees in death/kill messages" 939 "show_sprees_center",
"1",
940 "Show spree information in MSG_CENTER messages... " 941 "0 = off, 1 = target (but only for first victim) and attacker" 945 "show_sprees_center_specialonly",
"1",
946 "Don't show spree information in MSG_CENTER messages if it isn't an achievement" 950 "show_sprees_info",
"3",
951 "Show spree information in MSG_INFO messages... " 952 "0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker" 956 "show_sprees_info_newline",
"1",
957 "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself" 961 "show_sprees_info_specialonly",
"1",
962 "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement" 967 "\n// Notification counts (total = %d): " 968 "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n" 983 #undef NOTIF_WRITE_HARDCODED 984 #undef NOTIF_WRITE_ENTITY 994 string input,
string args,
995 string s1,
string s2,
string s3,
string s4,
996 int f1,
float f2,
float f3,
float f4)
998 #ifdef NOTIFICATIONS_DEBUG 999 Debug_Notification(sprintf(
1000 "Local_Notification_sprintf('%s^7', '%s', %s, %s);\n",
1003 MakeConsoleSafe(sprintf(
"'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1004 sprintf(
"%d, %d, %d, %d", f1, f2, f3, f4)
1010 for (
int sel_num = 0; (args !=
""); )
1012 string selected =
car(args); args =
cdr(args);
1013 NOTIF_HIT_MAX(NOTIF_MAX_ARGS,
"Local_Notification_sprintf");
1015 switch (strtolower(selected))
1017 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: arg_slot[sel_num++] = result; break; 1018 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: arg_slot[sel_num++] = result; break; 1019 #define ARG_CASE_ARG_CS_SV(selected, result) case selected: arg_slot[sel_num++] = result; break; 1021 #define ARG_CASE_ARG_CS(selected, result) case selected: arg_slot[sel_num++] = result; break; 1022 #define ARG_CASE_ARG_SV(selected, result) 1024 #define ARG_CASE_ARG_CS(selected, result) 1025 #define ARG_CASE_ARG_SV(selected, result) case selected: arg_slot[sel_num++] = result; break; 1027 #define ARG_CASE_ARG_DC(selected, result) 1028 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result) 1031 #undef ARG_CASE_ARG_DC 1032 #undef ARG_CASE_ARG_SV 1033 #undef ARG_CASE_ARG_CS 1034 #undef ARG_CASE_ARG_CS_SV 1035 #undef ARG_CASE_ARG_CS_SV_DC 1036 #undef ARG_CASE_ARG_CS_SV_HA 1053 void Local_Notification_sound(
int soundchannel,
string soundfile,
float soundvolume,
float soundposition)
1057 #ifdef NOTIFICATIONS_DEBUG 1058 Debug_Notification(sprintf(
1059 "Local_Notification_sound(%f, '%s', %f, %f);\n",
1069 strcpy(prev_soundfile, soundfile);
1070 prev_soundtime =
time;
1074 #ifdef NOTIFICATIONS_DEBUG 1075 Debug_Notification(sprintf(
1077 "Local_Notification_sound(%f, '%s', %f, %f) " 1078 "^1BLOCKED BY ANTISPAM:^7 prevsnd: '%s', timediff: %f, limit: %f\n" 1085 (
time - prev_soundtime),
1092 void Local_Notification_HUD_Notify_Push(
1093 string icon,
string hudargs,
1094 string s1,
string s2,
string s3,
string s4,
1095 float f1,
float f2,
float f3,
float f4)
1099 for (
int sel_num = 0; (hudargs !=
""); )
1101 string selected =
car(hudargs); hudargs =
cdr(hudargs);
1103 switch (strtolower(selected))
1105 #define ARG_CASE_ARG_CS_SV_HA(selected, result) case selected: arg_slot[sel_num++] = result; break; 1106 #define ARG_CASE_ARG_CS_SV_DC(selected, result) 1107 #define ARG_CASE_ARG_CS_SV(selected, result) 1108 #define ARG_CASE_ARG_CS(selected, result) 1109 #define ARG_CASE_ARG_SV(selected, result) 1110 #define ARG_CASE_ARG_DC(selected, result) 1111 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected, result) 1114 #undef ARG_CASE_ARG_DC 1115 #undef ARG_CASE_ARG_SV 1116 #undef ARG_CASE_ARG_CS 1117 #undef ARG_CASE_ARG_CS_SV 1118 #undef ARG_CASE_ARG_CS_SV_DC 1119 #undef ARG_CASE_ARG_CS_SV_HA 1123 #ifdef NOTIFICATIONS_DEBUG 1124 Debug_Notification(sprintf(
1125 "Local_Notification_HUD_Notify_Push('%s^7', '%s', %s, %s, %s);\n",
1128 MakeConsoleSafe(sprintf(
"'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1129 sprintf(
"%d, %d, %d, %d", f1, f2, f3, f4),
1136 void Local_Notification_centerprint_Add(
1137 string input,
string durcnt,
1138 CPID cpid,
float f1,
float f2)
1142 for (
int sel_num = 0; (durcnt !=
""); )
1144 string selected =
car(durcnt); durcnt =
cdr(durcnt);
1146 switch (strtolower(selected))
1148 #define ARG_CASE_ARG_CS_SV_HA(selected, result) 1149 #define ARG_CASE_ARG_CS_SV_DC(selected, result) case selected: arg_slot[sel_num++] = result; break; 1150 #define ARG_CASE_ARG_CS_SV(selected, result) 1151 #define ARG_CASE_ARG_CS(selected, result) 1152 #define ARG_CASE_ARG_SV(selected, result) 1153 #define ARG_CASE_ARG_DC(selected, result) case selected: arg_slot[sel_num++] = result; break; 1154 #define ARG_CASE(prog, selected, result) ARG_CASE_##prog(selected,result) 1157 #undef ARG_CASE_ARG_DC 1158 #undef ARG_CASE_ARG_SV 1159 #undef ARG_CASE_ARG_CS 1160 #undef ARG_CASE_ARG_CS_SV 1161 #undef ARG_CASE_ARG_CS_SV_DC 1162 #undef ARG_CASE_ARG_CS_SV_HA 1171 #ifdef NOTIFICATIONS_DEBUG 1172 Debug_Notification(sprintf(
1173 "Local_Notification_centerprint_Add('%s^7', '%s', %d, %d, %d, %d);\n",
1191 #ifdef NOTIFICATIONS_DEBUG 1192 Debug_Notification(sprintf(
1193 "Local_Notification(%s, NULL, ...);\n",
1197 LOG_WARNF(
"Incorrect usage of Local_Notification: %s",
"Null notification");
1202 if (!notif.nent_enabled)
1204 #ifdef NOTIFICATIONS_DEBUG 1205 Debug_Notification(sprintf(
1206 "Local_Notification(%s, %s, ...): Entity was disabled...\n",
1214 string s1 = CCR((notif.nent_stringcount > 0) ? ...(0,
string) :
"");
1215 string s2 = CCR((notif.nent_stringcount > 1) ? ...(1,
string) :
"");
1216 string s3 = CCR((notif.nent_stringcount > 2) ? ...(2,
string) :
"");
1217 string s4 = CCR((notif.nent_stringcount > 3) ? ...(3,
string) :
"");
1218 float f1 = ((notif.nent_floatcount > 0) ? ...((notif.nent_stringcount + 0),
float) : 0);
1219 float f2 = ((notif.nent_floatcount > 1) ? ...((notif.nent_stringcount + 1),
float) : 0);
1220 float f3 = ((notif.nent_floatcount > 2) ? ...((notif.nent_stringcount + 2),
float) : 0);
1221 float f4 = ((notif.nent_floatcount > 3) ? ...((notif.nent_stringcount + 3),
float) : 0);
1223 #ifdef NOTIFICATIONS_DEBUG 1224 Debug_Notification(sprintf(
1225 "Local_Notification(%s, %s, %s, %s);\n",
1228 MakeConsoleSafe(sprintf(
"'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1229 sprintf(
"%d, %d, %d, %d", f1, f2, f3, f4)
1233 if ((notif.nent_stringcount + notif.nent_floatcount) !=
count)
1237 "Arguments mismatch for Local_Notification(%s, %s, ...)! " 1238 "stringcount(%d) + floatcount(%d) != count(%d)\n" 1239 "Check the definition and function call for accuracy...?\n" 1243 notif.nent_stringcount,
1244 notif.nent_floatcount,
1255 Local_Notification_sound(notif.nent_channel, notif.nent_snd, notif.nent_vol, notif.nent_position);
1257 backtrace(
"MSG_ANNCE on server?... Please notify Samual immediately!\n");
1272 if (notif.nent_icon !=
"")
1274 if (notif.nent_iconargs !=
"")
1277 notif.nent_icon,notif.nent_iconargs,
1278 s1, s2, s3, s4, f1, f2, f3, f4);
1282 Local_Notification_HUD_Notify_Push(
1295 Local_Notification_centerprint_Add(
1310 if (notif.nent_msginfo && notif.nent_msginfo.nent_enabled)
1315 notif.nent_msginfo.nent_stringcount,
1316 notif.nent_msginfo.nent_floatcount,
1321 if (notif.nent_msgannce && notif.nent_msgannce.nent_enabled)
1325 notif.nent_msgannce,
1330 if (notif.nent_msgcenter && notif.nent_msgcenter.nent_enabled)
1334 notif.nent_msgcenter,
1335 notif.nent_msgcenter.nent_stringcount,
1336 notif.nent_msgcenter.nent_floatcount,
1346 entity found_choice = notif.nent_optiona;
1347 if (notif.nent_challow_var && (
warmup_stage || (notif.nent_challow_var == 2))) {
1351 case 2: found_choice = notif.nent_optionb;
break;
1357 found_choice.nent_type,
1359 found_choice.nent_stringcount,
1360 found_choice.nent_floatcount,
1370 float stringcount,
float floatcount,
1371 string s1,
string s2,
string s3,
string s4,
1372 float f1,
float f2,
float f3,
float f4)
1374 #define VARITEM(stringc, floatc, args) \ 1375 if ((stringcount == stringc) && (floatcount == floatc)) \ 1376 { Local_Notification(net_type, net_name, args); return; } 1391 NET_HANDLE(ENT_CLIENT_NOTIFICATION,
bool is_new)
1394 MSG net_type =
ENUMCAST(MSG, ReadByte());
1395 int net_name = ReadShort();
1398 if (net_type == MSG_CENTER_KILL)
1400 if (!is_new)
return;
1402 #ifdef NOTIFICATIONS_DEBUG 1403 Debug_Notification(sprintf(
1404 "Read_Notification(%d) at %f: net_type = %s, cpid = %d\n",
1411 int _net_name = net_name;
1412 CPID net_name =
ENUMCAST(CPID, _net_name);
1423 #ifdef NOTIFICATIONS_DEBUG 1424 Debug_Notification(sprintf(
1425 "Read_Notification(%d) at %f: net_type = %s, net_name = %s (%d)\n",
1429 notif.registered_id,
1435 backtrace(
"Read_Notification: Could not find notification entity!\n");
1439 string s1 = ((notif.nent_stringcount > 0) ?
ReadString() :
"");
1440 string s2 = ((notif.nent_stringcount > 1) ?
ReadString() :
"");
1441 string s3 = ((notif.nent_stringcount > 2) ?
ReadString() :
"");
1442 string s4 = ((notif.nent_stringcount > 3) ?
ReadString() :
"");
1443 float f1 = ((notif.nent_floatcount > 0) ? ReadLong() : 0);
1444 float f2 = ((notif.nent_floatcount > 1) ? ReadLong() : 0);
1445 float f3 = ((notif.nent_floatcount > 2) ? ReadLong() : 0);
1446 float f4 = ((notif.nent_floatcount > 3) ? ReadLong() : 0);
1448 if (!is_new)
return;
1451 notif.nent_stringcount,
1452 notif.nent_floatcount,
1459 void Net_Notification_Remove(
entity this)
1461 #ifdef NOTIFICATIONS_DEBUG 1462 Debug_Notification(sprintf(
1463 "Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
1467 this.
owner.nent_name
1474 bool Net_Write_Notification(
entity this,
entity client,
int sf)
1476 if (!Notification_ShouldSend(this.nent_broadcast, client, this.
nent_client))
return false;
1477 WriteHeader(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
1485 void Kill_Notification(
1486 NOTIF broadcast,
entity client,
1492 #ifdef NOTIFICATIONS_DEBUG 1493 Debug_Notification(sprintf(
1494 "Kill_Notification(%s, '%s', %s, %d);\n",
1495 Get_Notif_BroadcastName(broadcast),
1502 string checkargs = Notification_CheckArgs(broadcast, client);
1503 if (checkargs !=
"") {
LOG_WARNF(
"Incorrect usage of Kill_Notification: %s", checkargs);
return; }
1506 net_notif.nent_broadcast = broadcast;
1507 net_notif.nent_client = client;
1508 net_notif.nent_net_type = MSG_CENTER_KILL;
1509 net_notif.nent_net_name =
ORDINAL(net_cpid);
1510 Net_LinkEntity(net_notif,
false, autocvar_notification_lifetime_runtime, Net_Write_Notification);
1513 (it.owner.nent_type == net_type || net_type == MSG_Null) && (it.owner.nent_cpid == net_cpid || net_cpid ==
CPID_Null),
1515 it.nent_net_name = -1;
1516 it.nextthink = time;
1521 void Send_Notification(
1522 NOTIF broadcast,
entity client,
1526 if (broadcast == NOTIF_ONE_ONLY && !
IS_REAL_CLIENT(client))
return;
1528 string parms = sprintf(
"%s, '%s', %s, %s",
1529 Get_Notif_BroadcastName(broadcast),
1532 net_name.registered_id
1534 #ifdef NOTIFICATIONS_DEBUG 1535 Debug_Notification(sprintf(
"Send_Notification(%s, ...%d);\n", parms,
count));
1540 LOG_WARN(
"Send_Notification: Could not find notification entity!");
1545 string checkargs = Notification_CheckArgs(broadcast, client);
1546 if (!net_name) { checkargs = sprintf(
"No notification provided! %s", checkargs); }
1547 if (checkargs !=
"")
1549 LOG_WARNF(
"Incorrect usage of Send_Notification: %s", checkargs);
1553 string s1 = ((0 < notif.nent_stringcount) ? ...(0,
string) :
"");
1554 string s2 = ((1 < notif.nent_stringcount) ? ...(1,
string) :
"");
1555 string s3 = ((2 < notif.nent_stringcount) ? ...(2,
string) :
"");
1556 string s4 = ((3 < notif.nent_stringcount) ? ...(3,
string) :
"");
1557 float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0),
float) : 0);
1558 float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1),
float) : 0);
1559 float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2),
float) : 0);
1560 float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3),
float) : 0);
1562 #ifdef NOTIFICATIONS_DEBUG 1563 Debug_Notification(sprintf(
1564 "Send_Notification(%s, %s, %s);\n",
1566 MakeConsoleSafe(sprintf(
"'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1567 sprintf(
"%d, %d, %d, %d", f1, f2, f3, f4)
1571 if ((notif.nent_stringcount + notif.nent_floatcount) !=
count)
1574 "Argument mismatch for Send_Notification(%s, ...)! " 1575 "stringcount(%d) + floatcount(%d) != count(%d)\n" 1576 "Check the definition and function call for accuracy...?\n",
1578 notif.nent_stringcount,
1579 notif.nent_floatcount,
1586 && (broadcast == NOTIF_ALL || broadcast == NOTIF_ALL_EXCEPT)
1587 && !(net_type == MSG_ANNCE || net_type == MSG_CENTER)
1592 notif.nent_stringcount,
1593 notif.nent_floatcount,
1598 if (net_type == MSG_CHOICE)
1607 #define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN \ 1608 if (notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) { \ 1609 switch (CS_CVAR(ent).msg_choice_choices[net_name.nent_choice_idx]) \ 1611 case 1: found_choice = notif.nent_optiona; break; \ 1612 case 2: found_choice = notif.nent_optionb; break; \ 1616 found_choice = notif.nent_optiona; \ 1618 Send_Notification_WOVA( \ 1621 found_choice.nent_type, \ 1623 found_choice.nent_stringcount, \ 1624 found_choice.nent_floatcount, \ 1631 case NOTIF_ONE_ONLY:
1634 RECURSE_FROM_CHOICE(client,
return);
1641 RECURSE_FROM_CHOICE(it,
continue);
1650 IL_PUSH(g_notifications, net_notif);
1651 net_notif.owner = notif;
1652 net_notif.nent_broadcast = broadcast;
1653 net_notif.nent_client = client;
1654 net_notif.nent_net_type = net_type;
1655 net_notif.nent_net_name = notif.m_id;
1656 net_notif.nent_stringcount = notif.nent_stringcount;
1657 net_notif.nent_floatcount = notif.nent_floatcount;
1659 for (
int i = 0; i < net_notif.nent_stringcount; ++i) {
1660 net_notif.nent_strings[i] =
strzone(...(i,
string));
1662 for (
int i = 0; i < net_notif.nent_floatcount; ++i) {
1663 net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i),
float);
1666 setthink(net_notif, Net_Notification_Remove);
1667 net_notif.nextthink = (
time > autocvar_notification_lifetime_mapload)
1668 ? (
time + autocvar_notification_lifetime_runtime)
1669 : autocvar_notification_lifetime_mapload;
1671 Net_LinkEntity(net_notif,
false, 0, Net_Write_Notification);
1676 void Send_Notification_WOVA(
1677 NOTIF broadcast,
entity client,
1679 float stringcount,
float floatcount,
1680 string s1,
string s2,
string s3,
string s4,
1681 float f1,
float f2,
float f3,
float f4)
1683 #ifdef NOTIFICATIONS_DEBUG 1685 Debug_Notification(sprintf(
1686 "Send_Notification_WOVA(%s, %d, %d, %s, %s);\n",
1689 Get_Notif_BroadcastName(broadcast),
1696 MakeConsoleSafe(sprintf(
"'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1697 sprintf(
"%d, %d, %d, %d", f1, f2, f3, f4)
1701 #define VARITEM(stringc, floatc, args) \ 1702 if ((stringcount == stringc) && (floatcount == floatc)) \ 1703 { Send_Notification(broadcast, client, net_type, net_name, args); return; } 1706 Send_Notification(broadcast, client, net_type, net_name);
1710 void Send_Notification_WOCOVA(
1711 NOTIF broadcast,
entity client,
1713 string s1,
string s2,
string s3,
string s4,
1714 float f1,
float f2,
float f3,
float f4)
1718 #ifdef NOTIFICATIONS_DEBUG 1719 Debug_Notification(sprintf(
1720 "Send_Notification_WOCOVA(%s, %s, %s);\n",
1723 Get_Notif_BroadcastName(broadcast),
1728 MakeConsoleSafe(sprintf(
"'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1729 sprintf(
"%d, %d, %d, %d", f1, f2, f3, f4)
1733 #define VARITEM(stringc, floatc, args) \ 1734 if ((notif.nent_stringcount == stringc) && (notif.nent_floatcount == floatc)) \ 1735 { Send_Notification(broadcast, client, net_type, net_name, args); return; } 1738 Send_Notification(broadcast, client, net_type, net_name);
1740 #endif // ifdef SVQC
#define IL_EACH(this, cond, body)
void Dump_Notifications(int fh, bool alsoprint)
used to output notifications.cfg file
#define REGISTER_NET_LINKED(id)
#define NOTIF_ARGUMENT_LIST
spree_inf s1 s2 s3loc s2 s1
#define NOTIF_HIT_UNKNOWN(token, funcname)
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 s2loc s1 s2 f1 f1points s1 s2
void centerprint_Kill(int id)
const float NOTIF_MAX_HUDARGS
float(entity, float) PlayerPhysplug
Notification Get_Notif_Ent(MSG net_type, int net_name)
#define FOREACH_CLIENT(cond, body)
ERASEABLE string cdr(string s)
returns all but first word
ERASEABLE string MakeConsoleSafe(string input)
escape the string to make it safe for consoles
#define NET_HANDLE(id, param)
const float NOTIF_MAX_ARGS
void Create_Notification_Entity_Choice(entity notif, float var_cvar, string namestring, float challow_def, float challow_var, MSG chtype, Notification optiona, Notification optionb)
#define NOTIF_HIT_MAX(count, funcname)
const float NOTIF_MAX_DURCNT
ERASEABLE string car(string s)
returns first word
void Create_Notification_Entity(entity notif, float var_default, float var_cvar, MSG typeId, string namestring, int teamnum)
float autocvar_notification_allow_chatboxprint
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1
#define IS_REAL_CLIENT(v)
string Local_Notification_sprintf(string input, string args, string s1, string s2, string s3, string s4, int f1, float f2, float f3, float f4)
float autocvar_cl_announcer_antispam
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)
void Destroy_Notification_Entity(entity notif)
#define SET_NOTIF_STRING(string, stringname)
string Get_Notif_TypeName(MSG net_type)
main types/groups of notifications
string Process_Notif_Line(MSG typeId, bool chat, string input, string notiftype, string notifname, string stringtype)
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 s2loc s1 s2 f1 f1points f2
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
void Destroy_All_Notifications()
#define NOTIF_WRITE_HARDCODED(cvar, default, description)
#define AnnouncerFilename(snd)
#define IS_NOT_A_CLIENT(v)
was: (clienttype(v) == CLIENTTYPE_NOTACLIENT)
string Process_Notif_Args(float arg_type, string args, string notiftype, string notifname)
string Get_Notif_CvarName(Notification notif)
void Create_Notification_Entity_Annce(entity notif, float var_cvar, string namestring, float channel, string snd, float vol, float position)
entity Notification
always last
#define _sound(e, c, s, v, a)
void centerprint_Add(int new_id, string strMessage, float duration, int countdown_num)
#define EIGHT_VARS_TO_VARARGS_VARLIST
#define new_pure(class)
purely logical entities (.origin doesn't work)
void Create_Notification_Entity_Multi(entity notif, float var_cvar, string namestring, Notification anncename, Notification infoname, Notification centername)
void HUD_Notify_Push(string icon, string attacker, string victim)
void Local_Notification(MSG net_type, Notification net_name,...count)
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 centerprint_KillAll()
string arg_slot[NOTIF_MAX_ARGS]
#define FOREACH(list, cond, body)