1 // ================================================
2 // Unified notification system, written by Samual
3 // Last updated: February, 2013
4 // ================================================
6 string Get_Notif_TypeName(float net_type)
10 case MSG_INFO: return "MSG_INFO";
11 case MSG_CENTER: return "MSG_CENTER";
12 case MSG_WEAPON: return "MSG_WEAPON";
13 case MSG_DEATH: return "MSG_DEATH";
15 backtrace(sprintf("Get_Notif_TypeName(%d): Improper net type!\n", net_type));
19 entity Get_Notif_Ent(float net_type, float net_name)
23 case MSG_INFO: return msg_info_notifs[net_name - 1];
24 case MSG_CENTER: return msg_center_notifs[net_name - 1];
25 case MSG_WEAPON: return msg_weapon_notifs[net_name - 1];
26 case MSG_DEATH: return msg_death_notifs[net_name - 1];
28 backtrace(sprintf("Get_Notif_Ent(%d, %d): Improper net type!\n", net_type, net_name));
33 // ===============================
34 // Frontend Notification Pushing
35 // ===============================
37 void Dump_Notifications(float fh, float alsoprint)
39 #define NOTIF_WRITE(a) { \
41 if(alsoprint) { print(a); } }
42 #define NOTIF_WRITE_SETA(name,default,text) { \
45 "seta notification_%s %d \"notif string: %s^7\"\n", \
46 name, default, strreplace("\{3}", "", strreplace("\n", "\\n", text)) \
48 NOTIF_WRITE(notif_msg) }
54 // Note: This warning only applies to the notifications.cfg file that is output...
56 // You ARE supposed to manually edit this function to add i.e. hard coded
57 // notification variables for mutators or game modes or such and then
58 // regenerate the notifications.cfg file from the new code.
60 NOTIF_WRITE("// ********************************************** //\n");
61 NOTIF_WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n");
62 NOTIF_WRITE("// ** ** //\n");
63 NOTIF_WRITE("// ** This file is automatically generated ** //\n");
64 NOTIF_WRITE("// ** by code with the command 'dumpnotifs'. ** //\n");
65 NOTIF_WRITE("// ** ** //\n");
66 NOTIF_WRITE("// ** If you add a new notification, please ** //\n");
67 NOTIF_WRITE("// ** regenerate this file with that command ** //\n");
68 NOTIF_WRITE("// ** making sure that the output matches ** //\n");
69 NOTIF_WRITE("// ** with the lists and defaults in code. ** //\n");
70 NOTIF_WRITE("// ** ** //\n");
71 NOTIF_WRITE("// ********************************************** //\n");
73 // These notifications will also append their string as a comment...
74 // This is not necessary, and does not matter if they vary between config versions,
75 // it is just a semi-helpful tool for those who want to manually change their user settings.
77 NOTIF_WRITE(sprintf("\n// MSG_INFO notifications (count = %d):\n", NOTIF_INFO_COUNT));
78 for(i = 1; i <= NOTIF_INFO_COUNT; ++i)
80 e = Get_Notif_Ent(MSG_INFO, i);
81 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
82 NOTIF_WRITE_SETA(e.nent_name, e.nent_default, e.nent_string);
85 NOTIF_WRITE(sprintf("\n// MSG_CENTER notifications (count = %d):\n", NOTIF_CENTER_COUNT));
86 for(i = 1; i <= NOTIF_CENTER_COUNT; ++i)
88 e = Get_Notif_Ent(MSG_CENTER, i);
89 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
90 NOTIF_WRITE_SETA(e.nent_name, e.nent_default, e.nent_string);
93 NOTIF_WRITE(sprintf("\n// MSG_WEAPON notifications (count = %d):\n", NOTIF_WEAPON_COUNT));
94 for(i = 1; i <= NOTIF_WEAPON_COUNT; ++i)
96 e = Get_Notif_Ent(MSG_WEAPON, i);
97 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
98 NOTIF_WRITE_SETA(e.nent_name, e.nent_default, sprintf("infoname: %s, centername: %s",
99 e.nent_msginfo.nent_name, e.nent_msgcenter.nent_name));
102 NOTIF_WRITE(sprintf("\n// MSG_DEATH notifications (count = %d):\n", NOTIF_DEATH_COUNT));
103 for(i = 1; i <= NOTIF_DEATH_COUNT; ++i)
105 e = Get_Notif_Ent(MSG_DEATH, i);
106 if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
107 NOTIF_WRITE_SETA(e.nent_name, e.nent_default, sprintf("infoname: %s, centername: %s",
108 e.nent_msginfo.nent_name, e.nent_msgcenter.nent_name));
111 // edit these to match whichever cvars are used for specific notification options
112 NOTIF_WRITE("\n// HARD CODED notification variables:\n");
113 NOTIF_WRITE("seta notification_allow_chatboxprint 1 \"Allow notifications to be printed to chat box by setting notification cvar to 2 (You can also set this cvar to 2 to force ALL notifications to be printed to the chatbox)\"\n");
114 NOTIF_WRITE("seta notification_show_location 0 \"Append location information to MSG_INFO death/kill messages\"\n");
115 NOTIF_WRITE("seta notification_show_location_string \"\" \"Replacement string piped into sprintf, so you can do different messages like this: ' at the %s' or ' (near %s)'\"\n");
116 NOTIF_WRITE("seta notification_show_sprees 1 \"Print information about sprees in death/kill messages\"\n");
117 NOTIF_WRITE("seta notification_show_sprees_center 1 \"Show spree information in MSG_CENTER messages... 0 = off, 1 = target (but only for first victim) and attacker\"\n");
118 NOTIF_WRITE("seta notification_show_sprees_center_specialonly 1 \"Don't show spree information in MSG_CENTER messages if it isn't an achievement\"\n");
119 NOTIF_WRITE("seta notification_show_sprees_info 3 \"Show spree information in MSG_INFO messages... 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker\"\n");
120 NOTIF_WRITE("seta notification_show_sprees_info_newline 0 \"Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself\"\n");
121 NOTIF_WRITE("seta notification_show_sprees_info_specialonly 1 \"Don't show attacker spree information in MSG_INFO messages if it isn't an achievement\"\n");
122 NOTIF_WRITE("seta notification_errors_are_fatal 1 \"If a notification fails upon initialization, cause a Host_Error to stop the program\"\n");
123 NOTIF_WRITE("seta notification_ctf_pickup_team_verbose 1 \"Show extra information if a team mate picks up a flag\"\n");
124 NOTIF_WRITE("seta notification_ctf_pickup_enemy_verbose 1 \"Show extra information if an enemy picks up a flag\"\n");
125 NOTIF_WRITE("seta notification_ctf_capture_verbose 1 \"Show extra information when someone captures a flag\"\n");
126 NOTIF_WRITE("seta notification_frag_verbose 1 \"Show extra information when you frag someone (or when you are fragged\"\n");
128 NOTIF_WRITE(sprintf("\n// Notification counts (total = %d): MSG_INFO = %d, MSG_CENTER = %d, MSG_WEAPON = %d, MSG_DEATH = %d\n",
129 (NOTIF_INFO_COUNT + NOTIF_CENTER_COUNT + NOTIF_WEAPON_COUNT + NOTIF_DEATH_COUNT),
130 NOTIF_INFO_COUNT, NOTIF_CENTER_COUNT, NOTIF_WEAPON_COUNT, NOTIF_DEATH_COUNT));
133 #undef NOTIF_WRITE_SETA
138 void Notification_GetCvars()
140 GetCvars_handleFloat(get_cvars_s, get_cvars_f, FRAG_VERBOSE, "notification_frag_verbose");
144 string Local_Notification_sprintf(string input, string args,
145 string s1, string s2, string s3, string s4,
146 float f1, float f2, float f3, float f4)
148 #ifdef NOTIFICATIONS_DEBUG
150 sprintf("Local_Notification_sprintf('%s^7', '%s', %s, %s);\n",
151 strreplace("\n", "\\n", input),
153 sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4),
154 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
161 for(sel_num = 0; sel_num < NOTIF_MAX_ARGS; ++sel_num) { arg_slot[sel_num] = ""; }
165 for(sel_num = 0;(args != "");)
167 selected = car(args); args = cdr(args);
168 NOTIF_HIT_MAX(NOTIF_MAX_ARGS, "Local_Notification_sprintf")
169 switch(strtolower(selected))
171 #define ARG_CASE(prog,selected,result) \
173 #if (prog != ARG_SV) \
174 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
177 #if (prog != ARG_CS) \
178 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
183 default: NOTIF_HIT_UNKNOWN(NOTIF_MAX_ARGS, "Local_Notification_sprintf")
186 return sprintf(input, arg_slot[0], arg_slot[1], arg_slot[2], arg_slot[3], arg_slot[4], arg_slot[5], arg_slot[6]);
190 void Local_Notification_HUD_Notify_Push(string icon, string hudargs, string s1, string s2, string s3, string s4)
194 arg_slot[0] = ""; arg_slot[1] = "";
196 for(sel_num = 0;(hudargs != "");)
198 selected = car(hudargs); hudargs = cdr(hudargs);
199 NOTIF_HIT_MAX(NOTIF_MAX_HUDARGS, "Local_Notification_HUD_Notify_Push")
200 switch(strtolower(selected))
202 #define ARG_CASE(prog,selected,result) \
203 #if (prog == ARG_CS_SV_HA) \
204 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
208 default: NOTIF_HIT_UNKNOWN(NOTIF_MAX_HUDARGS, "Local_Notification_HUD_Notify_Push")
211 HUD_Notify_Push(icon, arg_slot[0], arg_slot[1]);
214 void Local_Notification_centerprint_generic(string input, string durcnt, float cpid, float f1, float f2)
218 arg_slot[0] = ""; arg_slot[1] = "";
220 for(sel_num = 0;(durcnt != "");)
222 selected = car(durcnt); durcnt = cdr(durcnt);
223 NOTIF_HIT_MAX(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic")
224 switch(strtolower(selected))
226 #define ARG_CASE(prog,selected,result) \
227 #if (prog == ARG_CS_SV_DC) \
228 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
234 if(ftos(stof(selected)) != "") { arg_slot[sel_num] = selected; ++sel_num; }
235 else { NOTIF_HIT_UNKNOWN(NOTIF_MAX_DURCNT, "Local_Notification_centerprint_generic") }
240 centerprint_generic(cpid, input, stof(arg_slot[0]), stof(arg_slot[1]));
244 void Local_Notification(float net_type, float net_name, ...count)
246 // check supplied type and name for errors
247 string checkargs = "";
248 #define CHECKARG_TYPENAME(type) case MSG_##type##: \
249 { if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
250 { checkargs = sprintf("Improper name: %d!", net_name); } break; }
253 CHECKARG_TYPENAME(INFO)
254 CHECKARG_TYPENAME(CENTER)
255 CHECKARG_TYPENAME(WEAPON)
256 CHECKARG_TYPENAME(DEATH)
257 default: { checkargs = sprintf("Improper type: %d!", checkargs, net_type); break; }
259 #undef CHECKARG_TYPENAME
260 if(checkargs != "") { backtrace(sprintf("Incorrect usage of Local_Notification: %s\n", checkargs)); return; }
262 entity notif = Get_Notif_Ent(net_type, net_name);
263 if not(notif) { backtrace("Local_Notification: Could not find notification entity!\n"); return; }
264 if not(notif.nent_enabled) { print("Local_Notification: Entity was disabled...\n"); return; }
266 if((notif.nent_stringcount + notif.nent_floatcount) > count)
270 "Not enough arguments for Local_Notification(%d, %s, ...)! ",
271 "stringcount(%d) + floatcount(%d) > count(%d)\n",
272 "Check the definition and function call for accuracy...?\n"
274 net_type, notif.nent_name, notif.nent_stringcount, notif.nent_floatcount, count));
277 else if((notif.nent_stringcount + notif.nent_floatcount) < count)
281 "Too many arguments for Local_Notification(%d, %s, ...)! ",
282 "stringcount(%d) + floatcount(%d) < count(%d)\n",
283 "Check the definition and function call for accuracy...?\n"
285 net_type, notif.nent_name, notif.nent_stringcount, notif.nent_floatcount, count));
289 string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
290 string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
291 string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : "");
292 string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : "");
293 float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0);
294 float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0);
295 float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0);
296 float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
298 #ifdef NOTIFICATIONS_DEBUG
300 sprintf("Local_Notification(%d, %s, %s, %s);\n",
303 sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4),
304 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
314 Local_Notification_sprintf(
321 if(notif.nent_icon != "")
323 Local_Notification_HUD_Notify_Push(
335 Local_Notification_centerprint_generic(
336 Local_Notification_sprintf(
351 if(notif.nent_msginfo)
352 if(notif.nent_msginfo.nent_enabled)
354 Local_Notification_WOVA(
356 notif.nent_msginfo.nent_id,
357 notif.nent_msginfo.nent_stringcount,
358 notif.nent_msginfo.nent_floatcount,
363 if(notif.nent_msgcenter)
364 if(notif.nent_msgcenter.nent_enabled)
366 Local_Notification_WOVA(
368 notif.nent_msgcenter.nent_id,
369 notif.nent_msgcenter.nent_stringcount,
370 notif.nent_msgcenter.nent_floatcount,
380 // WOVA = Without Variable Arguments
381 void Local_Notification_WOVA(float net_type, float net_name,
382 float stringcount, float floatcount,
383 string s1, string s2, string s3, string s4,
384 float f1, float f2, float f3, float f4)
386 #define VARITEM(stringc,floatc,args) \
387 if((stringcount == stringc) && (floatcount == floatc)) \
388 { Local_Notification(net_type, net_name, args); return; }
389 EIGHT_VARS_TO_VARARGS_VARLIST
391 Local_Notification(net_type, net_name); // some notifications don't have any arguments at all
395 // =========================
396 // Notification Networking
397 // =========================
400 void Read_Notification(float is_new)
402 float net_type = ReadByte();
403 float net_name = ReadShort();
405 if(net_type == (-1 * MSG_CENTER))
411 print("clearing all centerprints\n");
412 reset_centerprint_messages();
416 entity notif = Get_Notif_Ent(net_type, net_name);
417 if not(notif) { print("Read_Notification: Could not find notification entity!\n"); return; }
418 centerprint_generic(notif.nent_cpid, "", 0, 0);
424 entity notif = Get_Notif_Ent(net_type, net_name);
425 if not(notif) { print("Read_Notification: Could not find notification entity!\n"); return; }
427 string s1 = ((0 < notif.nent_stringcount) ? ReadString() : "");
428 string s2 = ((1 < notif.nent_stringcount) ? ReadString() : "");
429 string s3 = ((2 < notif.nent_stringcount) ? ReadString() : "");
430 string s4 = ((3 < notif.nent_stringcount) ? ReadString() : "");
431 float f1 = ((0 < notif.nent_floatcount) ? ReadLong() : 0);
432 float f2 = ((1 < notif.nent_floatcount) ? ReadLong() : 0);
433 float f3 = ((2 < notif.nent_floatcount) ? ReadLong() : 0);
434 float f4 = ((3 < notif.nent_floatcount) ? ReadLong() : 0);
436 #ifdef NOTIFICATIONS_DEBUG
437 dprint(sprintf("Read_Notification(%d) at %f: net_name = %s.\n", is_new, time, notif.nent_name));
442 Local_Notification_WOVA(
444 notif.nent_stringcount,
445 notif.nent_floatcount,
453 void Net_Notification_Remove()
456 for(i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } }
460 float Net_Write_Notification(entity client, float sf)
462 float i, send = FALSE;
464 switch(self.nent_broadcast)
466 case NOTIF_ONE: // send to one client and their spectator
469 (client == self.nent_client)
472 (client.classname == STR_SPECTATOR)
474 (client.enemy == self.nent_client)
479 case NOTIF_ONE_ONLY: // send ONLY to one client
481 if(client == self.nent_client) { send = TRUE; }
484 case NOTIF_TEAM: // send only to X team and their spectators
487 (client.team == self.nent_client.team)
490 (client.classname == STR_SPECTATOR)
492 (client.enemy.team == self.nent_client.team)
497 case NOTIF_TEAM_EXCEPT: // send only to X team and their spectators, except for Y person and their spectators
500 (client != self.nent_client)
503 (client.team == self.nent_client.team)
506 (client.classname == STR_SPECTATOR)
509 (client.enemy != self.nent_client)
511 (client.enemy.team == self.nent_client.team)
518 case NOTIF_ANY: // send to everyone
523 case NOTIF_ANY_EXCEPT: // send to everyone except X person and their spectators
526 (client != self.nent_client)
529 (client.classname == STR_SPECTATOR)
531 (client.enemy == self.nent_client)
536 default: { send = FALSE; break; }
541 WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
542 WriteByte(MSG_ENTITY, self.nent_net_type);
543 WriteShort(MSG_ENTITY, self.nent_net_name);
544 for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); }
545 for(i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); }
551 void Kill_Notification(float broadcast, entity client, float net_type, float net_name)
555 // if this is a centerprint, we must tell the client
556 // to kill the cpid in the centerprint queue
557 if(net_type == MSG_CENTER)
559 notif = Get_Notif_Ent(net_type, net_name);
560 if not(notif) { backtrace("Kill_Notification: Could not find notification entity!\n"); return; }
563 notif.classname = "net_kill_notification";
564 notif.nent_broadcast = broadcast;
565 notif.nent_client = client;
566 notif.nent_net_type = (-1 * MSG_CENTER);
567 notif.nent_net_name = net_name;
568 Net_LinkEntity(notif, FALSE, 0.5, Net_Write_Notification);
571 for(notif = world; (notif = find(notif, classname, sprintf("net_%s", strtolower(Get_Notif_TypeName(net_type)))));)
573 // now kill the old send notification entity
574 print(sprintf("killed '%s'\n", notif.classname));
579 void Send_Notification(float broadcast, entity client,
580 float net_type, float net_name, ...count)
582 // check supplied broadcast, target, type, and name for errors
583 string checkargs = "";
584 #define CHECKARG_TYPENAME(type) case MSG_##type##: \
585 { if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
586 { checkargs = sprintf("Improper name: %d!", net_name); } break; }
589 CHECKARG_TYPENAME(INFO)
590 CHECKARG_TYPENAME(CENTER)
591 CHECKARG_TYPENAME(WEAPON)
592 CHECKARG_TYPENAME(DEATH)
593 default: { checkargs = sprintf("Improper type: %d!", checkargs, net_type); break; }
595 #undef CHECKARG_TYPENAME
596 if(checkargs != "") { checkargs = strcat(checkargs, " "); }
602 if(IS_NOT_A_CLIENT(client))
603 { checkargs = sprintf("%sNo client provided!", checkargs); }
607 case NOTIF_ANY_EXCEPT:
609 if(IS_NOT_A_CLIENT(client))
610 { checkargs = sprintf("%sException can't be a non-client!", checkargs); }
617 { checkargs = sprintf("%sEntity provided when world was required!", checkargs); }
622 case NOTIF_TEAM_EXCEPT:
624 if not(teamplay) { checkargs = sprintf("%sTeamplay not active!", checkargs); }
625 else if(IS_NOT_A_CLIENT(client))
627 if(broadcast == NOTIF_TEAM) { checkargs = sprintf("%sNo client provided!", checkargs); }
628 else { checkargs = sprintf("%sException can't be a non-client!", checkargs); }
633 default: { checkargs = sprintf("%sImproper broadcast: %d!", checkargs, broadcast); break; }
635 if(checkargs != "") { backtrace(sprintf("Incorrect usage of Send_Notification: %s\n", checkargs)); return; }
637 // retreive counts for the arguments of this notification
638 entity notif = Get_Notif_Ent(net_type, net_name);
639 if not(notif) { backtrace("Send_Notification: Could not find notification entity!\n"); return; }
641 if((notif.nent_stringcount + notif.nent_floatcount) > count)
645 "Not enough arguments for Send_Notification(%d, %d, %s, ...)! ",
646 "stringcount(%d) + floatcount(%d) > count(%d)\n",
647 "Check the definition and function call for accuracy...?\n"
649 broadcast, net_type, notif.nent_name, notif.nent_stringcount, notif.nent_floatcount, count));
652 else if((notif.nent_stringcount + notif.nent_floatcount) < count)
656 "Too many arguments for Send_Notification(%d, %d, %s, ...)! ",
657 "stringcount(%d) + floatcount(%d) < count(%d)\n",
658 "Check the definition and function call for accuracy...?\n"
660 broadcast, net_type, notif.nent_name, notif.nent_stringcount, notif.nent_floatcount, count));
664 #ifdef NOTIFICATIONS_DEBUG
665 string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
666 string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
667 string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : "");
668 string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : "");
669 float f1 = ((0 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 0), float) : 0);
670 float f2 = ((1 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 1), float) : 0);
671 float f3 = ((2 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 2), float) : 0);
672 float f4 = ((3 < notif.nent_floatcount) ? ...((notif.nent_stringcount + 3), float) : 0);
674 sprintf("Send_Notification(%d, %d, %s, %s, %s - %d %d);\n",
678 sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4),
679 sprintf("%d, %d, %d, %d", f1, f2, f3, f4),
680 notif.nent_stringcount, notif.nent_floatcount
685 entity net_notif = spawn();
686 net_notif.classname = sprintf("net_%s", strtolower(Get_Notif_TypeName(net_type)));
687 net_notif.nent_broadcast = broadcast;
688 net_notif.nent_client = client;
689 net_notif.nent_net_type = net_type;
690 net_notif.nent_net_name = net_name;
691 net_notif.nent_stringcount = notif.nent_stringcount;
692 net_notif.nent_floatcount = notif.nent_floatcount;
695 for(i = 0; i < net_notif.nent_stringcount; ++i) { net_notif.nent_strings[i] = strzone(...(i, string)); }
696 for(i = 0; i < net_notif.nent_floatcount; ++i) { net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float); }
698 net_notif.think = Net_Notification_Remove;
699 net_notif.nextthink = (time + 0.5);
701 Net_LinkEntity(net_notif, FALSE, 0, Net_Write_Notification);
703 if(server_is_dedicated && (broadcast == NOTIF_ANY || broadcast == NOTIF_ANY_EXCEPT) && (net_type != MSG_CENTER))
705 Local_Notification_WOVA(
707 notif.nent_stringcount,
708 notif.nent_floatcount,
709 IFSTR(0), IFSTR(1), IFSTR(2), IFSTR(3),
710 IFFL(0), IFFL(1), IFFL(2), IFFL(3));
714 // WOVA = Without Variable Arguments
715 void Send_Notification_WOVA(float broadcast, entity client,
716 float net_type, float net_name,
717 string s1, string s2, string s3, string s4,
718 float f1, float f2, float f3, float f4)
720 entity notif = Get_Notif_Ent(net_type, net_name);
722 #ifdef NOTIFICATIONS_DEBUG
724 sprintf("Send_Notification_WOVA(%d, %d, %s, %s, %s - %d %d);\n",
728 sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4),
729 sprintf("%d, %d, %d, %d", f1, f2, f3, f4),
730 notif.nent_stringcount, notif.nent_floatcount
735 #define VARITEM(stringc,floatc,args) \
736 if((notif.nent_stringcount == stringc) && (notif.nent_floatcount == floatc)) \
737 { Send_Notification(broadcast, client, net_type, net_name, args); return; }
738 EIGHT_VARS_TO_VARARGS_VARLIST
740 Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
744 // =============================
745 // LEGACY NOTIFICATION SYSTEMS
746 // =============================
748 void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, float countdown_num)
750 if ((clienttype(e) == CLIENTTYPE_REAL) && (e.flags & FL_CLIENT))
753 WRITESPECTATABLE_MSG_ONE({
754 WriteByte(MSG_ONE, SVC_TEMPENTITY);
755 WriteByte(MSG_ONE, TE_CSQC_CENTERPRINT_GENERIC);
756 WriteByte(MSG_ONE, id);
757 WriteString(MSG_ONE, s);
758 if (id != 0 && s != "")
760 WriteByte(MSG_ONE, duration);
761 WriteByte(MSG_ONE, countdown_num);