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, "", xCPID_CTF_CAPTURESHIELD, _("^BGYou are now ^FG1shielded^BG from the flag\n^BGfor ^FG2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \
48 NOTIFICATION(CENTER_CTF_CAPTURESHIELD_FREE, 2, "", xCPID_CTF_CAPTURESHIELD, _("^BGYou are now free.\n^BGFeel free to ^FG2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \
49 NOTIFICATION(CENTER_CTF_EVENT_RETURN, 11, s1, CPID_CTF_LOWPRIO, _("^BGYou returned the ^FG1%s"), "") \
50 NOTIFICATION(CENTER_CTF_EVENT_CAPTURE, 11, s1, FALSE, _("^BGYou captured the ^FG1%s"), "") \
51 NOTIFICATION(CENTER_CTF_EVENT_PASS, 10, CLPS2(s1, s2, s3), CPID_CTF_PASS, _("^BG%s passed the ^FG1%s^BG to %s"), "") \
52 NOTIFICATION(CENTER_CTF_EVENT_PASS_SENT, 11, CLPS2(s1, s2), CPID_CTF_PASS, _("^BGYou passed the ^FG1%s^BG to %s"), "") \
53 NOTIFICATION(CENTER_CTF_EVENT_PASS_RECEIVED, 12, CLPS2(s1, s2), CPID_CTF_PASS, _("^BGYou received the ^FG1%s^BG from %s"), "") \
56 #define MSG_WEAPON_NOTIFICATIONS \
57 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"), "") \
60 // declare notifications
61 #define NOTIFICATION(name,num,args,special,normal,gentle) float name = num;
62 MSG_INFO_NOTIFICATIONS
63 MSG_NOTIFY_NOTIFICATIONS
64 MSG_CENTER_NOTIFICATIONS
65 MSG_WEAPON_NOTIFICATIONS
70 // declare centerprint priorities
71 #define NOTIFICATION(name,num,args,special,normal,gentle) float special = num;
72 MSG_CENTER_NOTIFICATIONS
75 void readnotificationorwhatever()
85 //#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
86 //#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement)
87 //#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0
89 void Send_Notification(float type, entity client, float id, string s, float duration, float countdown_num)
91 if ((clienttype(client) == CLIENTTYPE_REAL) && (client.flags & FL_CLIENT))
94 WRITESPECTATABLE_MSG_ONE({
95 WriteByte(MSG_ONE, SVC_TEMPENTITY);
96 //WriteByte(MSG_ONE, TE_CSQC_NOTIFICATION);
97 WriteByte(MSG_ONE, id);
98 WriteString(MSG_ONE, s);
99 if (id != 0 && s != "")
101 WriteByte(MSG_ONE, duration);
102 WriteByte(MSG_ONE, countdown_num);