1 // ================================================
2 // Unified notification system, written by Samual
3 // Last updated: February, 2013
4 // ================================================
8 string Fill_Notif_Args(string args, string input,
9 string s1, string s2, string s3, string s4,
10 float f1, float f2, float f3, float f4)
12 dprint(sprintf("Fill_Notif_Args('%s', '%s', %s, %s, %s, %s, %d, %d, %d, %d);\n",
13 args, input, s1, s2, s3, s4, f1, f2, f3, f4));
15 string selected, remaining = args;
22 if((remaining != "") && (input != ""))
26 selected = car(remaining); remaining = cdr(remaining);
28 switch(strtolower(selected))
30 #define ADD_ARG_CASE(selected,result) case selected: { arg_slot[sel_num] = result; ++sel_num; break; }
32 ADD_ARG_CASE("s1", s1)
33 ADD_ARG_CASE("s2", s2)
34 ADD_ARG_CASE("s3", s3)
35 ADD_ARG_CASE("s4", s4)
36 ADD_ARG_CASE("f1", ftos(f1))
37 ADD_ARG_CASE("f2", ftos(f2))
38 ADD_ARG_CASE("f3", ftos(f3))
39 ADD_ARG_CASE("f4", ftos(f4))
41 #ifdef CSQC // CSQC replacements
42 ADD_ARG_CASE("pass_key", ((((tmp_s = getcommandkey("pass", "+use")) != "pass") && !(strstrofs(tmp_s, "not bound", 0) >= 0)) ? sprintf(CCR(_(" ^F1(Press %s)")), tmp_s) : ""))
43 ADD_ARG_CASE("frag_ping", ((f2 != BOT_PING) ? sprintf(CCR(_("\n(Ping ^2%d^BG)")), f2) : ""))
44 ADD_ARG_CASE("frag_stats", sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), f1, f2, ((f3 != BOT_PING) ? sprintf(CCR(_(" (Ping ^2%d^BG)")), f3) : "")))
45 //ADD_ARG_CASE("frag_pos", ((Should_Print_Score_Pos(f1)) ? sprintf("\n^BG%s", Read_Score_Pos(f1)) : ""))
46 ADD_ARG_CASE("spree_cen", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : ""))
47 ADD_ARG_CASE("spree_inf", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : ""))
48 ADD_ARG_CASE("spree_end", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", ending their %d frag spree"), _(", ending their %d score spree")), f1) : ""))
49 ADD_ARG_CASE("spree_lost", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", losing their %d frag spree"), _(", losing their %d score spree")), f1) : ""))
50 ADD_ARG_CASE("death_team", Team_ColoredFullName(f1 - 1))
51 ADD_ARG_CASE("weapon_name", ftos(f1)) // weaponorder[f1].netname
53 #else // SVQC replacements
54 ADD_ARG_CASE("spree_inf", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : ""))
55 ADD_ARG_CASE("spree_end", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", ending their %d frag spree"), _(", ending their %d score spree")), f1) : ""))
56 ADD_ARG_CASE("spree_lost", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", losing their %d frag spree"), _(", losing their %d score spree")), f1) : ""))
57 ADD_ARG_CASE("death_team", Team_ColoredFullName(f1))
58 ADD_ARG_CASE("weapon_name", ftos(f1)) // weaponorder[f1].netname
62 default: { print("Hit unknown token in selected string! '", selected, "'\n"); break; }
64 if(sel_num == 7) { print("Hit maximum arguments!\n"); break; }
67 return sprintf(CCR(input), arg_slot[0], arg_slot[1], arg_slot[2], arg_slot[3], arg_slot[4], arg_slot[5], arg_slot[6], arg_slot[7]);
73 // get the actual name of a notification and return it as a string
74 string Get_Field_Value(float field, float net_type, float net_name)
76 #ifdef NOTIFICATIONS_DEBUG
77 dprint(sprintf("Get_Field_Value(%d, %d, %d);\n", field, net_type, net_name));
80 #define GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) switch(field) { \
81 case F_NAME: { return VAR_TO_TEXT(name); } \
82 case F_STRNUM: { return ftos(strnum); } \
83 case F_FLNUM: { return ftos(flnum); } }
85 #define GET_FIELD_VALUE_OUTPUT_PAIR(field,name,infoname,centername,strnum,flnum) switch(field) { \
86 case F_NAME: { return VAR_TO_TEXT(name); } \
87 case F_INFNAME: { return VAR_TO_TEXT(infoname); } \
88 case F_CENNAME: { return VAR_TO_TEXT(centername); } \
89 case F_INFVAL: { return ftos(infoname); } \
90 case F_CENVAL: { return ftos(centername); } \
91 case F_STRNUM: { return ftos(strnum); } \
92 case F_FLNUM: { return ftos(flnum); } }
94 #define CLPSE_GETVALUE(name,arg,earg) \
105 #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) case name: { GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) }
106 NOTIF_SWITCH_LIST(MSG_INFO, net_name, return "")
107 #undef MSG_INFO_NOTIF
112 #define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) case name: { GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) }
113 NOTIF_SWITCH_LIST(MSG_CENTER, net_name, return "")
114 #undef MSG_CENTER_NOTIF
119 #define MSG_WEAPON_NOTIF(name,infoname,centername) case name: { GET_FIELD_VALUE_OUTPUT_PAIR(field,name, \
120 CLPSE_GETVALUE(infoname, infoname, NO_MSG), CLPSE_GETVALUE(centername, centername, NO_MSG), \
121 max(CLPSE_GETVALUE(infoname, stof(Get_Field_Value(F_STRNUM, MSG_INFO, infoname)), 0), CLPSE_GETVALUE(centername, stof(Get_Field_Value(F_STRNUM, MSG_CENTER, centername)), 0)), \
122 max(CLPSE_GETVALUE(infoname, stof(Get_Field_Value(F_FLNUM, MSG_INFO, infoname)), 0), CLPSE_GETVALUE(centername, stof(Get_Field_Value(F_FLNUM, MSG_CENTER, centername)), 0))) }
123 NOTIF_SWITCH_LIST(MSG_WEAPON, net_name, return "")
124 #undef MSG_WEAPON_NOTIF
129 #define MSG_DEATH_NOTIF(name,infoname,centername) case name: { GET_FIELD_VALUE_OUTPUT_PAIR(field,name, \
130 CLPSE_GETVALUE(infoname, infoname, NO_MSG), CLPSE_GETVALUE(centername, centername, NO_MSG), \
131 max(CLPSE_GETVALUE(infoname, stof(Get_Field_Value(F_STRNUM, MSG_INFO, infoname)), 0), CLPSE_GETVALUE(centername, stof(Get_Field_Value(F_STRNUM, MSG_CENTER, centername)), 0)), \
132 max(CLPSE_GETVALUE(infoname, stof(Get_Field_Value(F_FLNUM, MSG_INFO, infoname)), 0), CLPSE_GETVALUE(centername, stof(Get_Field_Value(F_FLNUM, MSG_CENTER, centername)), 0))) }
133 NOTIF_SWITCH_LIST(MSG_DEATH, net_name, return "")
134 #undef MSG_DEATH_NOTIF
139 #undef GET_FIELD_VALUE_OUTPUT
140 #undef GET_FIELD_VALUE_OUTPUT_PAIR
141 #undef CLPSE_GETVALUE
144 #endif // ifndef MENUQC
147 // ===============================
148 // Frontend Notification Pushing
149 // ===============================
151 void Dump_Notifications(float fh, float alsoprint)
153 float MSG_INFO_NOTIFS = 0, MSG_CENTER_NOTIFS = 0, MSG_WEAPON_NOTIFS = 0, MSG_DEATH_NOTIFS = 0;
156 #define NOTIF_WRITE(type,name,text) { \
158 notif_msg = sprintf("seta %s 1 // %s - %s\n", #name, #type, strreplace("\n", "\\n", text)); \
159 fputs(fh, notif_msg); \
160 if(alsoprint) { print(strreplace("^", "^^", notif_msg)); } }
162 #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) NOTIF_WRITE(MSG_INFO, name, normal)
163 MSG_INFO_NOTIFICATIONS
164 #undef MSG_INFO_NOTIF
166 #define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) NOTIF_WRITE(MSG_CENTER, name, normal)
167 MSG_CENTER_NOTIFICATIONS
168 #undef MSG_CENTER_NOTIF
170 #define MSG_WEAPON_NOTIF(name,infoname,centername) NOTIF_WRITE(MSG_WEAPON, name, \
171 sprintf("infoname: %s, centername: %s", VAR_TO_TEXT(infoname), VAR_TO_TEXT(centername)))
172 MSG_WEAPON_NOTIFICATIONS
173 #undef MSG_WEAPON_NOTIF
175 #define MSG_DEATH_NOTIF(name,infoname,centername) NOTIF_WRITE(MSG_DEATH, name, \
176 sprintf("infoname: %s, centername: %s", VAR_TO_TEXT(infoname), VAR_TO_TEXT(centername)))
177 MSG_DEATH_NOTIFICATIONS
178 #undef MSG_DEATH_NOTIF
180 print(sprintf("Notification counts: MSG_INFO = %d, MSG_CENTER = %d, MSG_WEAPON = %d, MSG_DEATH = %d\n",
181 MSG_INFO_NOTIFS, MSG_CENTER_NOTIFS, MSG_WEAPON_NOTIFS, MSG_DEATH_NOTIFS));
189 void HUD_Notify_Push(string icon, string attacker, string victim)
194 if (kn_index == -1) { kn_index = KN_MAX_ENTRIES-1; }
195 killnotify_times[kn_index] = time;
198 if(killnotify_icon[kn_index]) { strunzone(killnotify_icon[kn_index]); }
199 killnotify_icon[kn_index] = strzone(icon);
202 if(killnotify_attackers[kn_index]) { strunzone(killnotify_attackers[kn_index]); }
203 killnotify_attackers[kn_index] = strzone(attacker);
206 if(killnotify_victims[kn_index]) { strunzone(killnotify_victims[kn_index]); }
207 killnotify_victims[kn_index] = strzone(victim);
212 void Local_Notification(float net_type, float net_name, ...count)
214 // check supplied type and name for errors
215 #ifdef NOTIFICATIONS_DEBUG
217 #define CHECKARG_TYPENAME(type) case MSG_##type##: \
218 { if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
219 { checkargs = sprintf("Improper name: %d!", net_name); } break; }
221 string checkargs = "";
224 CHECKARG_TYPENAME(INFO)
225 CHECKARG_TYPENAME(CENTER)
226 CHECKARG_TYPENAME(WEAPON)
227 CHECKARG_TYPENAME(DEATH)
229 default: { checkargs = sprintf("Improper type: %d!", checkargs, net_type); break; }
231 #undef CHECKARG_TYPENAME
233 if(checkargs != "") { backtrace(sprintf("Incorrect usage of Local_Notification: %s\n", checkargs)); return; }
237 float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
238 float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
240 string s1 = ((0 < stringcount) ? ...(0, string) : NO_STR_ARG);
241 string s2 = ((1 < stringcount) ? ...(1, string) : NO_STR_ARG);
242 string s3 = ((2 < stringcount) ? ...(2, string) : NO_STR_ARG);
243 string s4 = ((3 < stringcount) ? ...(3, string) : NO_STR_ARG);
244 float f1 = ((stringcount < count) ? ...(stringcount, float) : NO_FL_ARG);
245 float f2 = (((stringcount + 1) < count) ? ...((stringcount + 1), float) : NO_FL_ARG);
246 float f3 = (((stringcount + 2) < count) ? ...((stringcount + 2), float) : NO_FL_ARG);
247 float f4 = (((stringcount + 3) < count) ? ...((stringcount + 3), float) : NO_FL_ARG);
249 #ifdef NOTIFICATIONS_DEBUG
251 dprint(sprintf("Local_Notification(%d, %s, %s, %s, %s, %s, %d, %d, %d, %d);\n",
252 net_type, Get_Field_Value(F_NAME, net_type, net_name),
253 s1, s2, s3, s4, f1, f2, f3, f4));
255 if((stringcount + floatcount) > count)
256 { backtrace(sprintf("Not enough arguments for Local_Notification! stringcount(%d) + floatcount(%d) > count(%d) \
257 \nCheck the notification definition and function call for accuracy...?\n", stringcount, floatcount, count)); return; }
258 else if((stringcount + floatcount) < count)
259 { backtrace(sprintf("Too many arguments for Local_Notification! stringcount(%d) + floatcount(%d) < count(%d) \
260 \nCheck the notification definition and function call for accuracy...?\n", stringcount, floatcount, count)); return; }
269 #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) \
270 case name: { CHECK_AUTOCVAR(name) \
272 print(sprintf(CCR(normal_or_gentle(normal, gentle)), args)); \
274 if(icon != "") { HUD_Notify_Push(icon, hudargs); } \
278 NOTIF_SWITCH_LIST(MSG_INFO, net_name, return)
280 #undef MSG_INFO_NOTIF
286 #define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) \
287 case name: { CHECK_AUTOCVAR(name) \
289 centerprint_generic(HANDLE_CPID(cpid), sprintf(CCR(normal_or_gentle(normal, gentle)), args), durcnt); \
292 NOTIF_SWITCH_LIST(MSG_CENTER, net_name, return)
294 #undef MSG_CENTER_NOTIF
300 #define MSG_WEAPON_NOTIF(name,infoname,centername) \
301 case name: { CHECK_AUTOCVAR(name) \
303 #if infoname != NO_MSG \
304 Local_Notification_Without_VarArgs(MSG_INFO, infoname, \
305 stof(Get_Field_Value(F_STRNUM, MSG_INFO, infoname)), \
306 stof(Get_Field_Value(F_FLNUM, MSG_INFO, infoname)), \
307 s1, s2, s3, s4, f1, f2, f3, f4); \
310 #if centername != NO_MSG \
311 Local_Notification_Without_VarArgs(MSG_CENTER, centername, \
312 stof(Get_Field_Value(F_STRNUM, MSG_CENTER, centername)), \
313 stof(Get_Field_Value(F_FLNUM, MSG_CENTER, centername)), \
314 s1, s2, s3, s4, f1, f2, f3, f4); \
319 NOTIF_SWITCH_LIST(MSG_WEAPON, net_name, return)
321 #undef MSG_WEAPON_NOTIF
326 #define MSG_DEATH_NOTIF(name,infoname,centername) \
327 case name: { CHECK_AUTOCVAR(name) \
329 #if infoname != NO_MSG \
330 Local_Notification_Without_VarArgs(MSG_INFO, infoname, \
331 stof(Get_Field_Value(F_STRNUM, MSG_INFO, infoname)), \
332 stof(Get_Field_Value(F_FLNUM, MSG_INFO, infoname)), \
333 s1, s2, s3, s4, f1, f2, f3, f4); \
336 #if centername != NO_MSG \
337 Local_Notification_Without_VarArgs(MSG_CENTER, centername, \
338 stof(Get_Field_Value(F_STRNUM, MSG_CENTER, centername)), \
339 stof(Get_Field_Value(F_FLNUM, MSG_CENTER, centername)), \
340 s1, s2, s3, s4, f1, f2, f3, f4); \
345 NOTIF_SWITCH_LIST(MSG_DEATH, net_name, return)
347 #undef MSG_DEATH_NOTIF
353 void Local_Notification_Without_VarArgs(float net_type, float net_name,
354 float stringcount, float floatcount,
355 string s1, string s2, string s3, string s4,
356 float f1, float f2, float f3, float f4)
358 #define VARITEM(stringc,floatc,args) if((stringcount == stringc) && (floatcount == floatc)) { Local_Notification(net_type, net_name, args); return; }
359 EIGHT_VARS_TO_VARARGS_VARLIST
362 Local_Notification(net_type, net_name); // some notifications don't have any arguments at all
366 // =========================
367 // Notification Networking
368 // =========================
371 void Read_Notification(float is_new)
373 float net_type = ReadByte();
374 float net_name = ReadShort();
376 float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
377 float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
379 string s1 = ((stringcount >= 1) ? ReadString() : NO_STR_ARG);
380 string s2 = ((stringcount >= 2) ? ReadString() : NO_STR_ARG);
381 string s3 = ((stringcount >= 3) ? ReadString() : NO_STR_ARG);
382 string s4 = ((stringcount == 4) ? ReadString() : NO_STR_ARG);
383 float f1 = ((floatcount >= 1) ? ReadLong() : NO_FL_ARG);
384 float f2 = ((floatcount >= 2) ? ReadLong() : NO_FL_ARG);
385 float f3 = ((floatcount >= 3) ? ReadLong() : NO_FL_ARG);
386 float f4 = ((floatcount == 4) ? ReadLong() : NO_FL_ARG);
388 #ifdef NOTIFICATIONS_DEBUG
389 dprint(sprintf("Read_Notification(%d) at %d: net_name = %s.\n", is_new, time, Get_Field_Value(F_NAME, net_type, net_name)));
392 if(is_new) { Local_Notification_Without_VarArgs(net_type, net_name, stringcount, floatcount, s1, s2, s3, s4, f1, f2, f3, f4); }
397 void Notification_Remove()
400 for(i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } }
404 float Write_Notification(entity client, float sf)
406 float i, send = FALSE;
408 switch(self.nent_broadcast)
410 case NOTIF_ONE: { if((client == self.nent_client) || (client.classname == STR_SPECTATOR && client.enemy == self.nent_client)) { send = TRUE; } break; }
411 case NOTIF_ONE_ONLY: { if(client == self.nent_client) { send = TRUE; } break; }
412 case NOTIF_TEAM: { if((client.team == self.nent_client.team) || (client.classname == STR_SPECTATOR && client.enemy.team == self.nent_client.team)) { send = TRUE; } break; }
413 case NOTIF_TEAM_EXCEPT: { if(((client != self.nent_client) && (client.team == self.nent_client.team) && !(client.classname == STR_SPECTATOR && client.enemy == self.nent_client))) { send = TRUE; } break; }
414 case NOTIF_ANY: { send = TRUE; break; }
415 case NOTIF_ANY_EXCEPT: { if((client != self.nent_client) && !(client.classname == STR_SPECTATOR && client.enemy == self.nent_client)) { send = TRUE; } break; }
416 default: { send = FALSE; break; }
421 WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
422 WriteByte(MSG_ENTITY, self.nent_net_type);
423 WriteShort(MSG_ENTITY, self.nent_net_name);
424 for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); }
425 for(i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); }
431 void Send_Notification(float broadcast, entity client,
432 float net_type, float net_name, ...count)
434 // check supplied broadcast, target, type, and name for errors
435 #ifdef NOTIFICATIONS_DEBUG
437 #define CHECKARG_TYPENAME(type) case MSG_##type##: \
438 { if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
439 { checkargs = sprintf("Improper name: %d!", net_name); } break; }
441 string checkargs = "";
444 CHECKARG_TYPENAME(INFO)
445 CHECKARG_TYPENAME(CENTER)
446 CHECKARG_TYPENAME(WEAPON)
447 CHECKARG_TYPENAME(DEATH)
449 default: { checkargs = sprintf("Improper type: %d!", checkargs, net_type); break; }
451 #undef CHECKARG_TYPENAME
453 if(checkargs != "") { checkargs = strcat(checkargs, " "); }
457 case NOTIF_ONE_ONLY: { if(clienttype(client) == CLIENTTYPE_NOTACLIENT) { checkargs = sprintf("%sNo client provided!", checkargs); } break; }
458 case NOTIF_ANY_EXCEPT: { if(clienttype(client) == CLIENTTYPE_NOTACLIENT) { checkargs = sprintf("%sException can't be a non-client!", checkargs); } break; }
459 case NOTIF_ANY: { if(client) { checkargs = sprintf("%sEntity provided when world was required!", checkargs); } break; }
462 case NOTIF_TEAM_EXCEPT:
464 if not(teamplay) { checkargs = sprintf("%sTeamplay not active!", checkargs); }
465 else if(clienttype(client) == CLIENTTYPE_NOTACLIENT)
467 if(broadcast == NOTIF_TEAM) { checkargs = sprintf("%sNo client provided!", checkargs); }
468 else { checkargs = sprintf("%sException can't be a non-client!", checkargs); }
473 default: { checkargs = sprintf("%sImproper broadcast: %d!", checkargs, broadcast); break; }
476 if(checkargs != "") { backtrace(sprintf("Incorrect usage of Send_Notification: %s\n", checkargs)); return; }
480 // retreive counts for the arguments of this notification
481 float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
482 float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
484 #ifdef NOTIFICATIONS_DEBUG
486 dprint(sprintf("Send_Notification(%d, %d, %s, stringcount: %d, floatcount: %d, varargs: %d);\n",
487 broadcast, net_type, Get_Field_Value(F_NAME, net_type, net_name), stringcount, floatcount, count));
489 if((stringcount + floatcount) > count)
490 { backtrace(sprintf("Not enough arguments for Send_Notification! stringcount(%d) + floatcount(%d) > count(%d) \
491 \nCheck the notification definition and function call for accuracy...?\n", stringcount, floatcount, count)); return; }
492 else if((stringcount + floatcount) < count)
493 { backtrace(sprintf("Too many arguments for Send_Notification! stringcount(%d) + floatcount(%d) < count(%d) \
494 \nCheck the notification definition and function call for accuracy...?\n", stringcount, floatcount, count)); return; }
498 entity notif = spawn();
499 notif.nent_broadcast = broadcast;
500 notif.nent_client = client;
501 notif.nent_net_type = net_type;
502 notif.nent_net_name = net_name;
503 notif.nent_stringcount = stringcount;
504 notif.nent_floatcount = floatcount;
508 for(i = 0; i < stringcount; ++i) { notif.nent_strings[i] = strzone(...(i, string)); }
509 for(i = 0; i < floatcount; ++i) { notif.nent_floats[i] = ...((stringcount + i), float); }
511 notif.think = Notification_Remove;
512 notif.nextthink = (time + 0.5);
514 Net_LinkEntity(notif, FALSE, 0, Write_Notification);
516 if((!server_is_local) && (broadcast == NOTIF_ANY || broadcast == NOTIF_ANY_EXCEPT) && (net_type != MSG_CENTER))
517 { Local_Notification_Without_VarArgs(net_type, net_name, stringcount, floatcount,
518 IFSTR(0), IFSTR(1), IFSTR(2), IFSTR(3), IFFL(0), IFFL(1), IFFL(2), IFFL(3)); }
521 void Send_Notification_Without_VarArgs(float broadcast, entity client,
522 float net_type, float net_name,
523 float stringcount, float floatcount,
524 string s1, string s2, string s3, string s4,
525 float f1, float f2, float f3, float f4)
527 #define VARITEM(stringc,floatc,args) if((stringcount == stringc) && (floatcount == floatc)) { Send_Notification(broadcast, client, net_type, net_name, args); return; }
528 EIGHT_VARS_TO_VARARGS_VARLIST
531 Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
534 void Send_Notification_Legacy_Wrapper(float broadcast, entity client,
535 float net_type, float net_name,
536 string s1, string s2,
537 float f1, float f2, float f3)
539 float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
540 float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
541 Send_Notification_Without_VarArgs(broadcast, client, net_type, net_name, stringcount, floatcount, s1, s2, NO_STR_ARG, NO_STR_ARG, f1, f2, f3, NO_FL_ARG);
545 // =============================
546 // LEGACY NOTIFICATION SYSTEMS
547 // =============================
549 void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, float countdown_num)
551 if ((clienttype(e) == CLIENTTYPE_REAL) && (e.flags & FL_CLIENT))
554 WRITESPECTATABLE_MSG_ONE({
555 WriteByte(MSG_ONE, SVC_TEMPENTITY);
556 WriteByte(MSG_ONE, TE_CSQC_CENTERPRINT_GENERIC);
557 WriteByte(MSG_ONE, id);
558 WriteString(MSG_ONE, s);
559 if (id != 0 && s != "")
561 WriteByte(MSG_ONE, duration);
562 WriteByte(MSG_ONE, countdown_num);
567 void Send_CSQC_Centerprint_Generic_Expire(entity e, float id)
569 Send_CSQC_Centerprint_Generic(e, id, "", 1, 0);
572 #endif // ifndef MENUQC