]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/notifications.qc
Cleanup/fix a lot of things, now notifications work! :D
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / notifications.qc
1 // ================================================
2 //  Unified notification system, written by Samual
3 //  Last updated: February, 2013
4 // ================================================
5
6 #ifndef MENUQC
7 entity Get_Notif_Ent(float net_type, float net_name)
8 {
9         switch(net_type)
10         {
11                 case MSG_INFO: return msg_info_notifs[net_name - 1];
12                 case MSG_CENTER: return msg_center_notifs[net_name - 1];
13                 case MSG_WEAPON: return msg_weapon_notifs[net_name - 1];
14                 case MSG_DEATH: return msg_death_notifs[net_name - 1];
15         }
16         backtrace(sprintf("Get_Notif_Ent(%d, %d): Improper net type!\n", net_type, net_name));
17         return world;
18 }
19
20 string Get_Notif_Name(float net_type, float net_name)
21 {
22         entity e = Get_Notif_Ent(net_type, net_name);
23         if(e) { return e.nent_name; }
24         backtrace(sprintf("Get_Notif_Name(%d, %d): Could not find entity!\n", net_type, net_name));
25         return "";
26 }
27
28 float Get_Notif_Infval(float net_type, float net_name)
29 {
30         entity e = Get_Notif_Ent(net_type, net_name);
31         if(e) { return e.nent_infoname; }
32         backtrace(sprintf("Get_Notif_Infval(%d, %d): Could not find entity!\n", net_type, net_name));
33         return NO_MSG;
34 }
35
36 float Get_Notif_Cenval(float net_type, float net_name)
37 {
38         entity e = Get_Notif_Ent(net_type, net_name);
39         if(e) { return e.nent_centername; }
40         backtrace(sprintf("Get_Notif_Cenval(%d, %d): Could not find entity!\n", net_type, net_name));
41         return NO_MSG;
42 }
43
44 float Get_Notif_Strnum(float net_type, float net_name)
45 {
46         entity e = Get_Notif_Ent(net_type, net_name);
47         if(e) { return e.nent_stringcount; }
48         backtrace(sprintf("Get_Notif_Strnum(%d, %d): Could not find entity!\n", net_type, net_name));
49         return NO_MSG;
50 }
51
52 float Get_Notif_Flnum(float net_type, float net_name)
53 {
54         entity e = Get_Notif_Ent(net_type, net_name);
55         if(e) { return e.nent_floatcount; }
56         backtrace(sprintf("Get_Notif_Flnum(%d, %d): Could not find entity!\n", net_type, net_name));
57         return NO_MSG;
58 }
59 #endif // ifndef MENUQC
60
61
62 // ===============================
63 //  Frontend Notification Pushing
64 // ===============================
65
66 void Dump_Notifications(float fh, float alsoprint)
67 {
68         float MSG_INFO_NOTIFS = 0, MSG_CENTER_NOTIFS = 0, MSG_WEAPON_NOTIFS = 0, MSG_DEATH_NOTIFS = 0;
69
70         #define NOTIF_WRITE(type,name,text) { \
71                 ++##type##_NOTIFS; \
72                 notif_msg = sprintf("seta %s 1 // %s - %s\n", name, #type, strreplace("\n", "\\n", text)); \
73                 fputs(fh, notif_msg); \
74                 if(alsoprint) { print(strreplace("^", "^^", notif_msg)); } }
75
76         #ifndef MENUQC
77         string notif_msg;
78         float i;
79         entity e;
80
81         for(i = 0; i < NOTIF_INFO_COUNT; ++i) {
82                 e = Get_Notif_Ent(MSG_INFO, i);
83                 NOTIF_WRITE(MSG_INFO, e.nent_name, e.nent_string); }
84                 
85         for(i = 0; i < NOTIF_CENTER_COUNT; ++i) {
86                 e = Get_Notif_Ent(MSG_CENTER, i);
87                 NOTIF_WRITE(MSG_CENTER, e.nent_name, e.nent_string); }
88         
89         for(i = 0; i < NOTIF_WEAPON_COUNT; ++i) {
90                 e = Get_Notif_Ent(MSG_WEAPON, i);
91                 NOTIF_WRITE(MSG_WEAPON, e.nent_name, sprintf("infoname: %s, centername: %s",
92                         Get_Notif_Name(MSG_INFO, Get_Notif_Infval(MSG_WEAPON, i)),
93                         Get_Notif_Name(MSG_CENTER, Get_Notif_Cenval(MSG_WEAPON, i)) ) ); }
94                 
95         for(i = 0; i < NOTIF_DEATH_COUNT; ++i) {
96                 e = Get_Notif_Ent(MSG_DEATH, i);
97                 NOTIF_WRITE(MSG_DEATH, e.nent_name, sprintf("infoname: %s, centername: %s",
98                         Get_Notif_Name(MSG_INFO, Get_Notif_Infval(MSG_DEATH, i)),
99                         Get_Notif_Name(MSG_CENTER, Get_Notif_Cenval(MSG_DEATH, i)) ) ); }
100                 
101         #endif
102
103         print(sprintf("Notification counts: MSG_INFO = %d, MSG_CENTER = %d, MSG_WEAPON = %d, MSG_DEATH = %d\n",
104                 MSG_INFO_NOTIFS, MSG_CENTER_NOTIFS, MSG_WEAPON_NOTIFS, MSG_DEATH_NOTIFS));
105         
106         return;
107         #undef NOTIF_WRITE
108 }
109
110 #ifndef MENUQC
111 string Local_Notification_sprintf(string input, string args, 
112         string s1, string s2, string s3, string s4,
113         float f1, float f2, float f3, float f4)
114 {
115         #ifdef NOTIFICATIONS_DEBUG
116         dprint(sprintf("Local_Notification_sprintf('%s^7', '%s', %s, %s);\n",
117                 strreplace("\n", "\\n", input), args,
118                 sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4),
119                 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)));
120         #endif
121         
122         string selected, remaining = args;
123         float sel_num = 0;
124
125         #ifdef CSQC
126         string tmp_s;
127         #endif
128
129         arg_slot[0] = ""; arg_slot[1] = ""; arg_slot[2] = ""; arg_slot[3] = ""; arg_slot[4] = ""; arg_slot[5] = ""; arg_slot[6] = "";
130         
131         if((remaining != "") && (input != ""))
132         {
133                 for(;remaining;)
134                 {
135                         selected = car(remaining); remaining = cdr(remaining);
136
137                         switch(strtolower(selected))
138                         {
139                                 #define ARG_CASE(prog,selected,result) \
140                                         #ifdef CSQC \
141                                         #if (prog == ARG_BOTH) || (prog == ARG_CSQC) \
142                                                 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
143                                         #endif \
144                                         #else \
145                                         #if (prog == ARG_BOTH) || (prog == ARG_SVQC) \
146                                                 case selected: { arg_slot[sel_num] = result; ++sel_num; break; } \
147                                         #endif \
148                                         #endif
149
150                                 NOTIF_ARGUMENT_LIST
151                                 #undef ARG_CASE
152                                 default: { backtrace(sprintf("Hit unknown token in selected string! '%s'\n", selected)); break; }
153                         }
154                         if((sel_num+1) > 7) { backtrace("Hit maximum arguments!\n"); break; }
155                 }
156
157                 return sprintf(input, arg_slot[0], arg_slot[1], arg_slot[2], arg_slot[3], arg_slot[4], arg_slot[5], arg_slot[6]);
158         }
159
160         return "";
161 }
162
163 #ifdef CSQC
164 void Local_Notification_HUD_Notify_Push(string icon, string hudargs, string s1, string s2)
165 {
166         string selected, remaining = hudargs;
167         float sel_num = 0;
168
169         arg_slot[0] = ""; arg_slot[1] = "";
170         
171         if(remaining != "")
172         {
173                 for(;remaining;)
174                 {
175                         selected = car(remaining); remaining = cdr(remaining);
176
177                         switch(strtolower(selected))
178                         {
179                                 #define ARG_CASE(selected,result) case selected: { arg_slot[sel_num] = result; ++sel_num; break; }
180                                 ARG_CASE("s1", s1)
181                                 ARG_CASE("s2", s2)
182                                 #undef ARG_CASE
183                                 default: { backtrace(sprintf("Hit unknown token in selected string! '%s'\n", selected)); break; }
184                         }
185                         if((sel_num+1) > 2) { backtrace("Hit maximum arguments!\n"); break; }
186                 }
187         }
188
189         HUD_Notify_Push(icon, arg_slot[0], arg_slot[1]);
190 }
191 #endif
192
193 void Local_Notification(float net_type, float net_name, ...count)
194 {
195         // check supplied type and name for errors
196         #define CHECKARG_TYPENAME(type) case MSG_##type##: \
197                 { if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
198                 { checkargs = sprintf("Improper name: %d!", net_name); } break; }
199         string checkargs = "";
200         switch(net_type)
201         {
202                 CHECKARG_TYPENAME(INFO)
203                 CHECKARG_TYPENAME(CENTER)
204                 CHECKARG_TYPENAME(WEAPON)
205                 CHECKARG_TYPENAME(DEATH)
206                 default: { checkargs = sprintf("Improper type: %d!", checkargs, net_type); break; }
207         }
208         #undef CHECKARG_TYPENAME
209         if(checkargs != "") { backtrace(sprintf("Incorrect usage of Local_Notification: %s\n", checkargs)); return; }
210
211         entity notif = Get_Notif_Ent(net_type, net_name);
212         if not(notif) { backtrace("Local_Notification: Could not find notification entity! (This wasn't caught by usage check?...)\n"); return; }
213         if not(notif.nent_enabled) { print("entity notification was disabled...\n"); return; }
214
215         if((notif.nent_stringcount + notif.nent_floatcount) > count)
216                 { backtrace(sprintf(strcat("Not enough arguments for Local_Notification! stringcount(%d) + floatcount(%d) > count(%d)\n", 
217                 "Check the notification definition and function call for accuracy...?\n"), notif.nent_stringcount, notif.nent_floatcount, count)); return; }
218         else if((notif.nent_stringcount + notif.nent_floatcount) < count)
219                 { backtrace(sprintf(strcat("Too many arguments for Local_Notification! stringcount(%d) + floatcount(%d) < count(%d)\n",
220                 "Check the notification definition and function call for accuracy...?\n"), notif.nent_stringcount, notif.nent_floatcount, count)); return; }
221
222         string s1 = ((0 < notif.nent_stringcount) ? ...(0, string) : "");
223         string s2 = ((1 < notif.nent_stringcount) ? ...(1, string) : "");
224         string s3 = ((2 < notif.nent_stringcount) ? ...(2, string) : "");
225         string s4 = ((3 < notif.nent_stringcount) ? ...(3, string) : "");
226         float f1 = ((notif.nent_stringcount < count) ? ...(notif.nent_stringcount, float) : NO_FL_ARG);
227         float f2 = (((notif.nent_stringcount + 1) < count) ? ...((notif.nent_stringcount + 1), float) : NO_FL_ARG);
228         float f3 = (((notif.nent_stringcount + 2) < count) ? ...((notif.nent_stringcount + 2), float) : NO_FL_ARG);
229         float f4 = (((notif.nent_stringcount + 3) < count) ? ...((notif.nent_stringcount + 3), float) : NO_FL_ARG);
230
231         #ifdef NOTIFICATIONS_DEBUG
232         dprint(sprintf("Local_Notification(%d, %s, %s, %s);\n",
233                 net_type, notif.nent_name,
234                 sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4),
235                 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)));
236         #endif
237         
238         switch(net_type)
239         {
240                 case MSG_INFO:
241                 {
242                         print(Local_Notification_sprintf(notif.nent_string, notif.nent_args, 
243                                 s1, s2, s3, s4, f1, f2, f3, f4));
244                         #ifdef CSQC 
245                         if(notif.nent_icon != "") { Local_Notification_HUD_Notify_Push(notif.nent_icon, notif.nent_hudargs, s1, s2); } 
246                         #endif 
247                         break;
248                 }
249                 
250                 #ifdef CSQC
251                 case MSG_CENTER:
252                 {
253                         centerprint_generic(notif.nent_cpid,
254                                 Local_Notification_sprintf(notif.nent_string, notif.nent_args, 
255                                 s1, s2, s3, s4, f1, f2, f3, f4), 0, 0);
256                         break;
257                 }
258                 #endif
259                 
260                 case MSG_WEAPON:
261                 case MSG_DEATH:
262                 {
263                         if(notif.nent_infoname)
264                         if(msg_info_notifs[notif.nent_infoname - 1].nent_enabled)
265                         {
266                                 Local_Notification_Without_VarArgs(MSG_INFO, notif.nent_infoname, 
267                                         Get_Notif_Strnum(MSG_INFO, notif.nent_infoname), 
268                                         Get_Notif_Flnum(MSG_INFO, notif.nent_infoname), 
269                                         s1, s2, s3, s4, f1, f2, f3, f4);
270                         }
271                         #ifdef CSQC
272                         if(notif.nent_centername)
273                         if(msg_center_notifs[notif.nent_centername - 1].nent_enabled)
274                         {
275                                 Local_Notification_Without_VarArgs(MSG_CENTER, notif.nent_centername, 
276                                         Get_Notif_Strnum(MSG_CENTER, notif.nent_centername), 
277                                         Get_Notif_Flnum(MSG_CENTER, notif.nent_centername), 
278                                         s1, s2, s3, s4, f1, f2, f3, f4); 
279                         }
280                         #endif
281                         break;
282                 }
283         }
284 }
285
286 void Local_Notification_Without_VarArgs(float net_type, float net_name,
287         float stringcount, float floatcount,
288         string s1, string s2, string s3, string s4,
289         float f1, float f2, float f3, float f4)
290 {
291         #define VARITEM(stringc,floatc,args) if((stringcount == stringc) && (floatcount == floatc)) { Local_Notification(net_type, net_name, args); return; }
292         EIGHT_VARS_TO_VARARGS_VARLIST
293         #undef VARITEM
294
295         Local_Notification(net_type, net_name); // some notifications don't have any arguments at all
296 }
297
298
299 // =========================
300 //  Notification Networking
301 // =========================
302
303 #ifdef CSQC
304 void Read_Notification(float is_new)
305 {
306         float net_type = ReadByte();
307         float net_name = ReadShort();
308
309         entity notif = Get_Notif_Ent(net_type, net_name);
310         if not(notif) { print("Read_Notification: Could not find notification entity!\n"); return; }
311         if not(notif.nent_enabled) { print("Read_Notification: Entity was disabled but networked anyway?!?...\n"); return; }
312
313         string s1 = ((0 < notif.nent_stringcount) ? ReadString() : "");
314         string s2 = ((1 < notif.nent_stringcount) ? ReadString() : "");
315         string s3 = ((2 < notif.nent_stringcount) ? ReadString() : "");
316         string s4 = ((3 < notif.nent_stringcount) ? ReadString() : "");
317         float f1 = ((0 < notif.nent_floatcount) ? ReadLong() : NO_FL_ARG);
318         float f2 = ((1 < notif.nent_floatcount) ? ReadLong() : NO_FL_ARG);
319         float f3 = ((2 < notif.nent_floatcount) ? ReadLong() : NO_FL_ARG);
320         float f4 = ((3 < notif.nent_floatcount) ? ReadLong() : NO_FL_ARG);
321
322         #ifdef NOTIFICATIONS_DEBUG
323         dprint(sprintf("Read_Notification(%d) at %f: net_name = %s.\n", is_new, time, notif.nent_name));
324         #endif
325         
326         if(is_new) { Local_Notification_Without_VarArgs(net_type, net_name, notif.nent_stringcount, notif.nent_floatcount, s1, s2, s3, s4, f1, f2, f3, f4); }
327 }
328 #endif
329
330 #ifdef SVQC
331 void Notification_Remove()
332 {
333         float i;
334         for(i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } }
335         remove(self);
336 }
337
338 float Write_Notification(entity client, float sf)
339 {
340         float i, send = FALSE;
341         
342         switch(self.nent_broadcast)
343         {
344                 case NOTIF_ONE: { if((client == self.nent_client) || (client.classname == STR_SPECTATOR && client.enemy == self.nent_client)) { send = TRUE; } break; }
345                 case NOTIF_ONE_ONLY: { if(client == self.nent_client) { send = TRUE; } break; }
346                 case NOTIF_TEAM: { if((client.team == self.nent_client.team) || (client.classname == STR_SPECTATOR && client.enemy.team == self.nent_client.team)) { send = TRUE; } break; }
347                 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; }
348                 case NOTIF_ANY: { send = TRUE; break; }
349                 case NOTIF_ANY_EXCEPT: { if((client != self.nent_client) && !(client.classname == STR_SPECTATOR && client.enemy == self.nent_client)) { send = TRUE; } break; }
350                 default: { send = FALSE; break; }
351         }
352
353         if(send)
354         {               
355                 WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
356                 WriteByte(MSG_ENTITY, self.nent_net_type);
357                 WriteShort(MSG_ENTITY, self.nent_net_name);
358                 for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); } 
359                 for(i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); }
360         }
361
362         return send; 
363 }
364
365 void Send_Notification(float broadcast, entity client,
366         float net_type, float net_name, ...count)
367 {
368         // check supplied broadcast, target, type, and name for errors
369         #define CHECKARG_TYPENAME(type) case MSG_##type##: \
370                 { if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
371                 { checkargs = sprintf("Improper name: %d!", net_name); } break; }
372         string checkargs = "";
373         switch(net_type)
374         {
375                 CHECKARG_TYPENAME(INFO)
376                 CHECKARG_TYPENAME(CENTER)
377                 CHECKARG_TYPENAME(WEAPON)
378                 CHECKARG_TYPENAME(DEATH)
379                 default: { checkargs = sprintf("Improper type: %d!", checkargs, net_type); break; }
380         }
381         #undef CHECKARG_TYPENAME
382         if(checkargs != "") { checkargs = strcat(checkargs, " "); }
383         switch(broadcast)
384         {
385                 case NOTIF_ONE:
386                 case NOTIF_ONE_ONLY: { if(clienttype(client) == CLIENTTYPE_NOTACLIENT) { checkargs = sprintf("%sNo client provided!", checkargs); } break; }
387                 case NOTIF_ANY_EXCEPT: { if(clienttype(client) == CLIENTTYPE_NOTACLIENT) { checkargs = sprintf("%sException can't be a non-client!", checkargs); } break; }
388                 case NOTIF_ANY: { if(client) { checkargs = sprintf("%sEntity provided when world was required!", checkargs); } break; }
389                 case NOTIF_TEAM:
390                 case NOTIF_TEAM_EXCEPT:
391                 {
392                         if not(teamplay) { checkargs = sprintf("%sTeamplay not active!", checkargs); }
393                         else if(clienttype(client) == CLIENTTYPE_NOTACLIENT)
394                         {
395                                 if(broadcast == NOTIF_TEAM) { checkargs = sprintf("%sNo client provided!", checkargs); }
396                                 else { checkargs = sprintf("%sException can't be a non-client!", checkargs); }
397                         }
398                         break;
399                 }
400                 default: { checkargs = sprintf("%sImproper broadcast: %d!", checkargs, broadcast); break; }
401         }
402         if(checkargs != "") { backtrace(sprintf("Incorrect usage of Send_Notification: %s\n", checkargs)); return; }
403
404         // retreive counts for the arguments of this notification
405         entity notif = Get_Notif_Ent(net_type, net_name);
406         if not(notif) { backtrace("Send_Notification: Could not find notification entity! (This wasn't caught by usage check?...)\n"); return; }
407         if not(notif.nent_enabled) { print("Send_Notification: Entity was disabled...\n"); return; }
408
409         if((notif.nent_stringcount + notif.nent_floatcount) > count)
410                 { backtrace(sprintf(strcat("Not enough arguments for Send_Notification! stringcount(%d) + floatcount(%d) > count(%d)\n", 
411                 "Check the notification definition and function call for accuracy...?\n"), notif.nent_stringcount, notif.nent_floatcount, count)); return; }
412         else if((notif.nent_stringcount + notif.nent_floatcount) < count)
413                 { backtrace(sprintf(strcat("Too many arguments for Send_Notification! stringcount(%d) + floatcount(%d) < count(%d)\n",
414                 "Check the notification definition and function call for accuracy...?\n"), notif.nent_stringcount, notif.nent_floatcount, count)); return; }
415
416         #ifdef NOTIFICATIONS_DEBUG
417         dprint(sprintf("Send_Notification(%d, %d, %s, stringcount: %d, floatcount: %d, varargs: %d);\n",
418                 broadcast, net_type, notif.nent_name, notif.nent_stringcount, notif.nent_floatcount, count));
419         #endif
420
421         entity net_notif = spawn();
422         net_notif.nent_broadcast = broadcast;
423         net_notif.nent_client = client;
424         net_notif.nent_net_type = net_type;
425         net_notif.nent_net_name = net_name;
426         net_notif.nent_stringcount = notif.nent_stringcount;
427         net_notif.nent_floatcount = notif.nent_floatcount;
428         
429         float i;
430         
431         for(i = 0; i < net_notif.nent_stringcount; ++i) { net_notif.nent_strings[i] = strzone(...(i, string)); }
432         for(i = 0; i < net_notif.nent_floatcount; ++i) { net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float); }
433         
434         net_notif.think = Notification_Remove;
435         net_notif.nextthink = (time + 0.5); 
436
437         Net_LinkEntity(net_notif, FALSE, 0, Write_Notification);
438
439         if((!server_is_local) && (broadcast == NOTIF_ANY || broadcast == NOTIF_ANY_EXCEPT) && (net_type != MSG_CENTER))
440                 { Local_Notification_Without_VarArgs(net_type, net_name, notif.nent_stringcount, notif.nent_floatcount,
441                         IFSTR(0), IFSTR(1), IFSTR(2), IFSTR(3), IFFL(0), IFFL(1), IFFL(2), IFFL(3)); }
442 }
443
444 void Send_Notification_Without_VarArgs(float broadcast, entity client,
445         float net_type, float net_name,
446         float stringcount, float floatcount,
447         string s1, string s2, string s3, string s4,
448         float f1, float f2, float f3, float f4)
449 {               
450         #define VARITEM(stringc,floatc,args) if((stringcount == stringc) && (floatcount == floatc)) { Send_Notification(broadcast, client, net_type, net_name, args); return; }
451         EIGHT_VARS_TO_VARARGS_VARLIST
452         #undef VARITEM
453
454         Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
455 }
456
457 void Send_Notification_Legacy_Wrapper(float broadcast, entity client,
458         float net_type, float net_name,
459         string s1, string s2,
460         float f1, float f2, float f3)
461 {
462         float stringcount = Get_Notif_Strnum(net_type, net_name);
463         float floatcount = Get_Notif_Flnum(net_type, net_name);
464         Send_Notification_Without_VarArgs(broadcast, client, net_type, net_name, stringcount, floatcount, s1, s2, "", "", f1, f2, f3, NO_FL_ARG);
465 }
466
467
468 // =============================
469 //  LEGACY NOTIFICATION SYSTEMS
470 // =============================
471
472 void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, float countdown_num)
473 {
474         if ((clienttype(e) == CLIENTTYPE_REAL) && (e.flags & FL_CLIENT))
475         {
476                 msg_entity = e;
477                 WRITESPECTATABLE_MSG_ONE({
478                         WriteByte(MSG_ONE, SVC_TEMPENTITY);
479                         WriteByte(MSG_ONE, TE_CSQC_CENTERPRINT_GENERIC);
480                         WriteByte(MSG_ONE, id);
481                         WriteString(MSG_ONE, s);
482                         if (id != 0 && s != "")
483                         {
484                                 WriteByte(MSG_ONE, duration);
485                                 WriteByte(MSG_ONE, countdown_num);
486                         }
487                 });
488         }
489 }
490 void Send_CSQC_Centerprint_Generic_Expire(entity e, float id)
491 {
492         Send_CSQC_Centerprint_Generic(e, id, "", 1, 0);
493 }
494 #endif // ifdef SVQC
495 #endif // ifndef MENUQC