]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/notifications.qc
Merge remote-tracking branch 'origin/master' into samual/notification_rewrite
[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 // get the actual name of a notification and return it as a string
8 string Get_Field_Value(float field, float net_type, float net_name)
9 {
10         //dprint("Get_Field_Value(", ftos(field), ", ", ftos(net_type), ", ", ftos(net_name), ");\n");
11         
12         #define GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) switch(field) { \
13                         case F_NAME: { return VAR_TO_TEXT(name); } \
14                         case F_STRNUM: { return ftos(strnum); } \
15                         case F_FLNUM: { return ftos(flnum); } }
16
17         #define GET_FIELD_VALUE_OUTPUT_PAIR(field,name,infoname,centername,strnum,flnum) switch(field) { \
18                         case F_NAME: { return VAR_TO_TEXT(name); } \
19                         case F_INFNAME: { return VAR_TO_TEXT(infoname); } \
20                         case F_CENNAME: { return VAR_TO_TEXT(centername); } \
21                         case F_INFVAL: { return ftos(infoname); } \
22                         case F_CENVAL: { return ftos(centername); } \
23                         case F_STRNUM: { return ftos(strnum); } \
24                         case F_FLNUM: { return ftos(flnum); } }
25
26         #define CLPSE_GETVALUE(name,arg,earg) \
27                 #if name != NO_MSG \
28                         arg \
29                 #else \
30                         earg \
31                 #endif
32
33         switch(net_type)
34         {
35                 case MSG_INFO:
36                 {
37                         #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) case name: { GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) }
38                         NOTIF_SWITCH_LIST(MSG_INFO, net_name, return "")
39                         #undef MSG_INFO_NOTIF
40                         break;
41                 }
42                 case MSG_CENTER:
43                 {
44                         #define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) case name: { GET_FIELD_VALUE_OUTPUT(field,name,strnum,flnum) }
45                         NOTIF_SWITCH_LIST(MSG_CENTER, net_name, return "")
46                         #undef MSG_CENTER_NOTIF
47                         break;
48                 }
49                 case MSG_WEAPON:
50                 {
51                         #define MSG_WEAPON_NOTIF(name,infoname,centername) case name: { GET_FIELD_VALUE_OUTPUT_PAIR(field,name, \
52                                 CLPSE_GETVALUE(infoname, infoname, NO_MSG), CLPSE_GETVALUE(centername, centername, NO_MSG), \
53                                 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)), \
54                                 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))) }
55                         NOTIF_SWITCH_LIST(MSG_WEAPON, net_name, return "")
56                         #undef MSG_WEAPON_NOTIF
57                         break;
58                 }
59                 case MSG_DEATH:
60                 {
61                         #define MSG_DEATH_NOTIF(name,infoname,centername) case name: { GET_FIELD_VALUE_OUTPUT_PAIR(field,name, \
62                                 CLPSE_GETVALUE(infoname, infoname, NO_MSG), CLPSE_GETVALUE(centername, centername, NO_MSG), \
63                                 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)), \
64                                 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))) }
65                         NOTIF_SWITCH_LIST(MSG_DEATH, net_name, return "")
66                         #undef MSG_DEATH_NOTIF
67                         break;
68                 }
69         }
70
71         #undef GET_FIELD_VALUE_OUTPUT
72         #undef GET_FIELD_VALUE_OUTPUT_PAIR
73         #undef CLPSE_GETVALUE
74         return "";
75 }
76 #endif // ifndef MENUQC
77
78
79 // ===============================
80 //  Frontend Notification Pushing
81 // ===============================
82
83 void Dump_Notifications(float fh, float alsoprint)
84 {
85         float MSG_INFO_NOTIFS = 0, MSG_CENTER_NOTIFS = 0, MSG_WEAPON_NOTIFS = 0, MSG_DEATH_NOTIFS = 0;
86         string notif_msg;
87
88         #define NOTIF_WRITE(type,name,text) notif_msg = sprintf("seta %s 1 // %s - %s\n", name, type, strreplace("\n", "\\n", text)); fputs(fh, notif_msg); if(alsoprint) { print(strreplace("^", "^^", notif_msg)); }
89         #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) { ++MSG_INFO_NOTIFS; NOTIF_WRITE("MSG_INFO", VAR_TO_TEXT(name), normal) }
90         #define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) { ++MSG_CENTER_NOTIFS; NOTIF_WRITE("MSG_CENTER", VAR_TO_TEXT(name), normal) }
91         #define MSG_WEAPON_NOTIF(name,infoname,centername) { ++MSG_WEAPON_NOTIFS; NOTIF_WRITE("MSG_WEAPON", VAR_TO_TEXT(name),sprintf("infoname: %s, centername: %s", VAR_TO_TEXT(infoname), VAR_TO_TEXT(centername))) }
92         #define MSG_DEATH_NOTIF(name,infoname,centername) { ++MSG_DEATH_NOTIFS; NOTIF_WRITE("MSG_DEATH", VAR_TO_TEXT(name), sprintf("infoname: %s, centername: %s", VAR_TO_TEXT(infoname), VAR_TO_TEXT(centername))) }
93         MSG_INFO_NOTIFICATIONS
94         MSG_CENTER_NOTIFICATIONS
95         MSG_WEAPON_NOTIFICATIONS
96         MSG_DEATH_NOTIFICATIONS
97         #undef NOTIF_WRITE
98         #undef MSG_INFO_NOTIF
99         #undef MSG_CENTER_NOTIF
100         #undef MSG_WEAPON_NOTIF
101         #undef MSG_DEATH_NOTIF
102         
103         print(sprintf("Notification counts: MSG_INFO = %d, MSG_CENTER = %d, MSG_WEAPON = %d, MSG_DEATH = %d\n", MSG_INFO_NOTIFS, MSG_CENTER_NOTIFS, MSG_WEAPON_NOTIFS, MSG_DEATH_NOTIFS));
104         return;
105 }
106
107 #ifndef MENUQC
108 #ifdef CSQC
109 void HUD_Notify_Push(string icon, string attacker, string victim)
110 {
111         if(icon != "")
112         {
113                 --kn_index;
114                 if (kn_index == -1) { kn_index = KN_MAX_ENTRIES-1; }
115                 killnotify_times[kn_index] = time;
116
117                 // icon
118                 if(killnotify_icon[kn_index]) { strunzone(killnotify_icon[kn_index]); }
119                 killnotify_icon[kn_index] = strzone(icon);
120
121                 // attacker
122                 if(killnotify_attackers[kn_index]) { strunzone(killnotify_attackers[kn_index]); }
123                 killnotify_attackers[kn_index] = strzone(attacker);
124
125                 // victim
126                 if(killnotify_victims[kn_index]) { strunzone(killnotify_victims[kn_index]); }
127                 killnotify_victims[kn_index] = strzone(victim);
128         }
129 }
130 #endif // ifdef CSQC
131
132 void Local_Notification(float net_type, float net_name, ...count)
133 {
134         if(net_type && net_name)
135         {
136                 float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
137                 float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
138
139                 string s1 = ((0 < stringcount) ? ...(0, string) : NO_STR_ARG);
140                 string s2 = ((1 < stringcount) ? ...(1, string) : NO_STR_ARG);
141                 string s3 = ((2 < stringcount) ? ...(2, string) : NO_STR_ARG);
142                 string s4 = ((3 < stringcount) ? ...(3, string) : NO_STR_ARG);
143                 float f1 = ((stringcount < count) ? ...(stringcount, float) : NO_FL_ARG);
144                 float f2 = (((stringcount + 1) < count) ? ...((stringcount + 1), float) : NO_FL_ARG);
145                 float f3 = (((stringcount + 2) < count) ? ...((stringcount + 2), float) : NO_FL_ARG);
146                 float f4 = (((stringcount + 3) < count) ? ...((stringcount + 3), float) : NO_FL_ARG);
147                 
148                 dprint("Local_Notification(", ftos(net_type), ", ", Get_Field_Value(F_NAME, net_type, net_name), strcat(", ", s1, ", ", s2, ", ", s3, ", ", s4, ", "), strcat(ftos(f1), strcat(", ", ftos(f2), ", ", ftos(f3), ", ", ftos(f4), ");\n")));
149                 dprint("  ^--: stringcount: ", ftos(stringcount), ", floatcount: ", ftos(floatcount), ".\n");
150
151                 if((stringcount + floatcount) > count) { backtrace(strcat("Not enough arguments for Local_Notification! ", strcat("stringcount(", ftos(stringcount), ") + floatcount(", ftos(floatcount), ")"), " > count(", ftos(count), ").\nCheck the notification definition and the function call for accuracy...?\n")); return; }
152                 else if((stringcount + floatcount) < count) { backtrace(strcat("Too many arguments for Local_Notification! ", strcat("stringcount(", ftos(stringcount), ") + floatcount(", ftos(floatcount), ")"), " < count(", ftos(count), ").\nCheck the notification definition and the function call for accuracy...?\n")); return; }
153
154                 switch(net_type)
155                 {
156                         case MSG_INFO:
157                         {
158                                 #define MSG_INFO_NOTIF(name,strnum,flnum,args,hudargs,icon,normal,gentle) \
159                                         case name: { CHECK_AUTOCVAR(name) \
160                                         { \
161                                                 print(sprintf(CCR(normal_or_gentle(normal, gentle)), args)); \
162                                                 #ifdef CSQC \
163                                                         if(icon != "") { HUD_Notify_Push(icon, hudargs); } \
164                                                 #endif \
165                                         } return; }
166                                         
167                                 NOTIF_SWITCH_LIST(MSG_INFO, net_name, return)
168                                 
169                                 #undef MSG_INFO_NOTIF
170                                 break;
171                         }
172                         #ifdef CSQC
173                         case MSG_CENTER:
174                         {
175                                 #define MSG_CENTER_NOTIF(name,strnum,flnum,args,cpid,durcnt,normal,gentle) \
176                                         case name: { CHECK_AUTOCVAR(name) \
177                                         { \
178                                                 centerprint_generic(HANDLE_CPID(cpid), sprintf(CCR(normal_or_gentle(normal, gentle)), args), durcnt); \
179                                         } return; }
180
181                                 NOTIF_SWITCH_LIST(MSG_CENTER, net_name, return)
182                                 
183                                 #undef MSG_CENTER_NOTIF
184                                 break;
185                         }
186                         #endif
187                         case MSG_WEAPON:
188                         {
189                                 #define MSG_WEAPON_NOTIF(name,infoname,centername) \
190                                         case name: { CHECK_AUTOCVAR(name) \
191                                         { \
192                                                 #if infoname != NO_MSG \
193                                                         Local_Notification_Without_VarArgs(MSG_INFO, infoname, \
194                                                                 stof(Get_Field_Value(F_STRNUM, MSG_INFO, infoname)), \
195                                                                 stof(Get_Field_Value(F_FLNUM, MSG_INFO, infoname)), \
196                                                                 s1, s2, s3, s4, f1, f2, f3, f4); \
197                                                 #endif \
198                                                 #ifdef CSQC \
199                                                         #if centername != NO_MSG \
200                                                                 Local_Notification_Without_VarArgs(MSG_CENTER, centername, \
201                                                                         stof(Get_Field_Value(F_STRNUM, MSG_CENTER, centername)), \
202                                                                         stof(Get_Field_Value(F_FLNUM, MSG_CENTER, centername)), \
203                                                                         s1, s2, s3, s4, f1, f2, f3, f4); \
204                                                         #endif \
205                                                 #endif \
206                                         } return; }
207
208                                 NOTIF_SWITCH_LIST(MSG_WEAPON, net_name, return)
209                                 
210                                 #undef MSG_WEAPON_NOTIF
211                                 break;
212                         }
213                         case MSG_DEATH:
214                         {
215                                 #define MSG_DEATH_NOTIF(name,infoname,centername) \
216                                         case name: { CHECK_AUTOCVAR(name) \
217                                         { \
218                                                 #if infoname != NO_MSG \
219                                                         Local_Notification_Without_VarArgs(MSG_INFO, infoname, \
220                                                                 stof(Get_Field_Value(F_STRNUM, MSG_INFO, infoname)), \
221                                                                 stof(Get_Field_Value(F_FLNUM, MSG_INFO, infoname)), \
222                                                                 s1, s2, s3, s4, f1, f2, f3, f4); \
223                                                 #endif \
224                                                 #ifdef CSQC \
225                                                         #if centername != NO_MSG \
226                                                                 Local_Notification_Without_VarArgs(MSG_CENTER, centername, \
227                                                                         stof(Get_Field_Value(F_STRNUM, MSG_CENTER, centername)), \
228                                                                         stof(Get_Field_Value(F_FLNUM, MSG_CENTER, centername)), \
229                                                                         s1, s2, s3, s4, f1, f2, f3, f4); \
230                                                         #endif \
231                                                 #endif \
232                                         } return; } 
233
234                                 NOTIF_SWITCH_LIST(MSG_DEATH, net_name, return)
235                                 
236                                 #undef MSG_DEATH_NOTIF
237                                 break;
238                         }
239                 }
240         }
241         else { backtrace("Incorrect usage of Local_Notification!\n"); }
242 }
243
244 void Local_Notification_Without_VarArgs(float net_type, float net_name, float stringcount, float floatcount, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
245 {
246         #define VARITEM(stringc,floatc,args) if((stringcount == stringc) && (floatcount == floatc)) { Local_Notification(net_type, net_name, args); return; }
247         EIGHT_VARS_TO_VARARGS_VARLIST
248         #undef VARITEM
249
250         Local_Notification(net_type, net_name); // some notifications don't have any arguments at all
251 }
252
253
254 // =========================
255 //  Notification Networking
256 // =========================
257
258 #ifdef CSQC
259 void Read_Notification(float is_new)
260 {
261         float net_type = ReadByte();
262         float net_name = ReadShort();
263
264         float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
265         float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
266
267         string s1 = ((stringcount >= 1) ? ReadString() : NO_STR_ARG);
268         string s2 = ((stringcount >= 2) ? ReadString() : NO_STR_ARG);
269         string s3 = ((stringcount >= 3) ? ReadString() : NO_STR_ARG);
270         string s4 = ((stringcount == 4) ? ReadString() : NO_STR_ARG);
271         float f1 = ((floatcount >= 1) ? ReadLong() : NO_FL_ARG);
272         float f2 = ((floatcount >= 2) ? ReadLong() : NO_FL_ARG);
273         float f3 = ((floatcount >= 3) ? ReadLong() : NO_FL_ARG);
274         float f4 = ((floatcount == 4) ? ReadLong() : NO_FL_ARG);
275
276         dprint("Read_Notification(", ftos(is_new), ") at ", ftos(time), ": net_name = ", Get_Field_Value(F_NAME, net_type, net_name), ".\n");
277
278         if(is_new) { Local_Notification_Without_VarArgs(net_type, net_name, stringcount, floatcount, s1, s2, s3, s4, f1, f2, f3, f4); }
279 }
280 #endif
281
282 #ifdef SVQC
283 void Notification_Remove()
284 {
285         float i;
286         for(i = 0; i < 4; ++i) { if(self.nent_strings[i]) { strunzone(self.nent_strings[i]); } }
287         remove(self);
288 }
289
290 float Write_Notification(entity client, float sf)
291 {
292         float i, send = FALSE;
293         
294         switch(self.nent_broadcast)
295         {
296                 case NOTIF_ONE: { if((client == self.nent_client) || (client.classname == STR_SPECTATOR && client.enemy == self.nent_client)) { send = TRUE; } break; }
297                 case NOTIF_ONE_ONLY: { if(client == self.nent_client) { send = TRUE; } break; }
298                 case NOTIF_TEAM: { if((client.team == self.nent_client.team) || (client.classname == STR_SPECTATOR && client.enemy.team == self.nent_client.team)) { send = TRUE; } break; }
299                 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; }
300                 case NOTIF_ANY: { send = TRUE; break; }
301                 case NOTIF_ANY_EXCEPT: { if((client != self.nent_client) && !(client.classname == STR_SPECTATOR && client.enemy == self.nent_client)) { send = TRUE; } break; }
302                 default: { send = FALSE; break; }
303         }
304
305         if(send)
306         {               
307                 WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
308                 WriteByte(MSG_ENTITY, self.nent_net_type);
309                 WriteShort(MSG_ENTITY, self.nent_net_name);
310                 for(i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); } 
311                 for(i = 0; i < self.nent_floatcount; ++i) { WriteLong(MSG_ENTITY, self.nent_floats[i]); }
312         }
313
314         return send; 
315 }
316
317 string Send_Notification_CheckTarget(float broadcast, entity client)
318 {
319         switch(broadcast)
320         {
321                 case NOTIF_ONE:
322                 case NOTIF_ONE_ONLY:
323                 {
324                         if(clienttype(client) == CLIENTTYPE_NOTACLIENT) { return "No client provided!"; }
325                         else { return ""; }
326                 }
327                 
328                 case NOTIF_TEAM:
329                 case NOTIF_TEAM_EXCEPT:
330                 {
331                         if not(teamplay) { return "Teamplay not active!"; }
332                         else if(clienttype(client) == CLIENTTYPE_NOTACLIENT) { return "No client provided!"; }
333                         else if((broadcast == NOTIF_TEAM_EXCEPT) && (clienttype(client) == CLIENTTYPE_NOTACLIENT)) { return "Exception can't be a non-client!"; }
334                         else { return ""; }
335                 }
336                 
337                 case NOTIF_ANY_EXCEPT:
338                 {
339                         if(clienttype(client) == CLIENTTYPE_NOTACLIENT) { return "Exception can't be a non-client!"; }
340                         else { return ""; }
341                 }
342
343                 case NOTIF_ANY:
344                 {
345                         if(client) { return "Entity provided when world was required!"; }
346                         else { return ""; }
347                 }
348         }
349
350         return strcat("Improper broadcast type: ", ftos(broadcast), "!");
351 }
352
353 void Send_Notification(float broadcast, entity client, float net_type, float net_name, ...count)
354 {
355         string checktarget = Send_Notification_CheckTarget(broadcast, client);
356         
357         if((checktarget == "") && net_type && net_name)
358         {
359                 float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
360                 float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
361                 float i;
362
363                 dprint("Send_Notification(", ftos(broadcast), ", ", ftos(net_type), ", ", Get_Field_Value(F_NAME, net_type, net_name), strcat(", ", ftos(count), ");\n"));
364                 dprint("  ^--: stringcount: ", ftos(stringcount), ", floatcount: ", ftos(floatcount), ".\n");
365
366                 if((stringcount + floatcount) > count) { backtrace(strcat("Not enough arguments for Send_Notification! ", strcat("stringcount(", ftos(stringcount), ") + floatcount(", ftos(floatcount), "),"), " > count(", ftos(count), ").\nCheck the notification definition and the function call for accuracy...?\n")); return; }
367                 else if((stringcount + floatcount) < count) { backtrace(strcat("Too many arguments for Send_Notification! ", strcat("stringcount(", ftos(stringcount), ") + floatcount(", ftos(floatcount), "),"), " < count(", ftos(count), ").\nCheck the notification definition and the function call for accuracy...?\n")); return; }
368
369                 entity notif = spawn();
370                 notif.nent_broadcast = broadcast;
371                 notif.nent_client = client;
372                 notif.nent_net_type = net_type;
373                 notif.nent_net_name = net_name;
374                 notif.nent_stringcount = stringcount;
375                 notif.nent_floatcount = floatcount; 
376                 for(i = 0; i < stringcount; ++i) { notif.nent_strings[i] = strzone(...(i, string)); }
377                 for(i = 0; i < floatcount; ++i) { notif.nent_floats[i] = ...((stringcount + i), float); }
378                 
379                 notif.think = Notification_Remove;
380                 notif.nextthink = (time + 0.5); 
381
382                 Net_LinkEntity(notif, FALSE, 0, Write_Notification);
383
384                 if((!server_is_local) && (broadcast == NOTIF_ANY || broadcast == NOTIF_ANY_EXCEPT) && (net_type != MSG_CENTER))
385                 {
386                         Local_Notification_Without_VarArgs(net_type, net_name, stringcount, floatcount, IFSTR(0), IFSTR(1), IFSTR(2), IFSTR(3), IFFL(0), IFFL(1), IFFL(2), IFFL(3));
387                 }
388         }
389         else { backtrace(strcat("Incorrect usage of Send_Notification: ", checktarget, "\n")); }
390 }
391
392 void Send_Notification_Without_VarArgs(float broadcast, entity client, float net_type, float net_name, float stringcount, float floatcount, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
393 {               
394         #define VARITEM(stringc,floatc,args) if((stringcount == stringc) && (floatcount == floatc)) { Send_Notification(broadcast, client, net_type, net_name, args); return; }
395         EIGHT_VARS_TO_VARARGS_VARLIST
396         #undef VARITEM
397
398         Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
399 }
400
401 void Send_Notification_Legacy_Wrapper(float broadcast, entity client, float net_type, float net_name, string s1, string s2, float f1, float f2, float f3)
402 {
403         float stringcount = stof(Get_Field_Value(F_STRNUM, net_type, net_name));
404         float floatcount = stof(Get_Field_Value(F_FLNUM, net_type, net_name));
405         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);
406 }
407
408
409 // =============================
410 //  LEGACY NOTIFICATION SYSTEMS
411 // =============================
412
413 void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, float countdown_num)
414 {
415         if ((clienttype(e) == CLIENTTYPE_REAL) && (e.flags & FL_CLIENT))
416         {
417                 msg_entity = e;
418                 WRITESPECTATABLE_MSG_ONE({
419                         WriteByte(MSG_ONE, SVC_TEMPENTITY);
420                         WriteByte(MSG_ONE, TE_CSQC_CENTERPRINT_GENERIC);
421                         WriteByte(MSG_ONE, id);
422                         WriteString(MSG_ONE, s);
423                         if (id != 0 && s != "")
424                         {
425                                 WriteByte(MSG_ONE, duration);
426                                 WriteByte(MSG_ONE, countdown_num);
427                         }
428                 });
429         }
430 }
431 void Send_CSQC_Centerprint_Generic_Expire(entity e, float id)
432 {
433         Send_CSQC_Centerprint_Generic(e, id, "", 1, 0);
434 }
435 #endif // ifdef SVQC
436 #endif // ifndef MENUQC