1 // =====================
3 // =====================
4 // main types/groups of notifications
5 #define MSG_INFO 1 // information messages (sent to console)
6 #define MSG_NOTIFY 2 // events to be sent to the notification panel
7 #define MSG_CENTER 3 // centerprint messages
8 #define MSG_WEAPON 4 // weapon messages (like "You got the Nex", sent to weapon notify panel)
10 // collapse multiple arguments into one argument
11 #define CLPS3(arg1,arg2,arg3) arg1, arg2, arg3
12 #define CLPS2(arg1,arg2) arg1, arg2
15 // ===================
17 // ===================
18 // List of all notifications (including identifiers and display information)
19 // Format: name, number, args, special, normal, gentle
21 // Name of notification
22 // ID number of notification
23 // Arguments for sprintf(string, args), if no args needed then use ""
25 // MSG_INFO: NULL/FLOAT: leave as FALSE
26 // MSG_NOTIFY: STRING: icon string name for the hud notify panel, "" if no icon is used
27 // MSG_CENTER: FLOAT: centerprint ID number (CPID_*), FALSE if no CPID is needed
28 // MSG_WEAPON: NULL/FLOAT: leave as FALSE
29 // Normal message (string for sprintf when gentle messages are NOT enabled)
30 // Gentle message (string for sprintf when gentle messages ARE enabled)
32 // Messages have ^FG1, ^FG2, and ^BG in them-- these are replaced
33 // with colors according to the cvars the user has chosen.
34 // ^FG1 = highest priority, "primary"
35 // ^FG2 = next highest priority, "secondary"
36 // ^BG = less important information, "tertiary"
38 #define MSG_INFO_NOTIFICATIONS \
39 NOTIFICATION(DEATH_MARBLES_LOST, 1, CLPS3(s1, s2, s3), "notify_death", _("^FG1%s^BG lost their marbles against ^FG1%s^BG using the ^FG2%s^BG\n"), "") \
42 #define MSG_NOTIFY_NOTIFICATIONS \
43 NOTIFICATION(DEATH_MARBLES_LOST2, 1, CLPS3(s1, s2, s3), "notify_death", _("^FG1%s^BG lost their marbles against ^FG1%s^BG using the ^FG2%s^BG\n"), "") \
46 #define MSG_CENTER_NOTIFICATIONS \
47 NOTIFICATION(CENTER_CTF_CAPTURESHIELD_SHIELDED, 1, "", CPID_CTF_CAPTURESHIELD, _("^BGYou are now ^FG1shielded^BG from the flag\n^BGfor ^FG2too many unsuccessful attempts^BG to capture.\n\n^BGMake some defensive scores before trying again."), "") \
48 NOTIFICATION(CENTER_CTF_CAPTURESHIELD_FREE, 2, "", CPID_CTF_CAPTURESHIELD, _("^BGYou are now free.\n\n^BGFeel free to ^FG2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \
49 NOTIFICATION(CENTER_CTF_PASS, 10, CLPS2(s1, s2, s3), CPID_CTF_CAPTURESHIELD, _("^BG%s passed the ^FG1%s^BG to %s"), "") \
50 NOTIFICATION(CENTER_CTF_PASS_SENT, 11, CLPS2(s1, s2), CPID_CTF_CAPTURESHIELD, _("^BGYou passed the ^FG1%s^BG to %s"), "") \
51 NOTIFICATION(CENTER_CTF_PASS_RECEIVED, 12, CLPS2(s1, s2), CPID_CTF_CAPTURESHIELD, _("^BGYou received the ^FG1%s^BG from %s"), "") \
54 #define MSG_WEAPON_NOTIFICATIONS \
55 NOTIFICATION(DEATH_MARBLES_LOST3, 1, CLPS3(s1, s2, s3), "notify_death", _("^FG1%s^BG lost their marbles against ^FG1%s^BG using the ^FG2%s^BG\n"), "") \
58 // declare notifications
59 #define NOTIFICATION(name,num,args,special,normal,gentle) float name = num;
60 MSG_INFO_NOTIFICATIONS
61 MSG_NOTIFY_NOTIFICATIONS
62 MSG_CENTER_NOTIFICATIONS
63 MSG_WEAPON_NOTIFICATIONS
68 void readnotificationorwhatever()
78 //#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname
79 //#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement)
80 //#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0
82 void Send_Notification(float type, entity client, float id, string s, float duration, float countdown_num)
84 if ((clienttype(client) == CLIENTTYPE_REAL) && (client.flags & FL_CLIENT))
87 WRITESPECTATABLE_MSG_ONE({
88 WriteByte(MSG_ONE, SVC_TEMPENTITY);
89 //WriteByte(MSG_ONE, TE_CSQC_NOTIFICATION);
90 WriteByte(MSG_ONE, id);
91 WriteString(MSG_ONE, s);
92 if (id != 0 && s != "")
94 WriteByte(MSG_ONE, duration);
95 WriteByte(MSG_ONE, countdown_num);