Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
all.qh File Reference
Include dependency graph for all.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ACVNN(name, defaultvalue)
#define ACVNNA(name, defaultvalue)
#define APP_NUM(num, prefix)
#define APP_TEAM_NUM(num, prefix)
#define DEFAULT_FILENAME   "notifications_dump.cfg"
#define EIGHT_VARS_TO_VARARGS_VARLIST(stringcount, floatcount)
#define Get_Notif_Name(notif)
 main types/groups of notifications
#define HASH_REPLACE(full_msg, num, attacker_name)
#define KILL_SPREE_LIST
#define MSG_ANNCE_NOTIF(name, defaultvalue, sound, channel, volume, position, queuetime)
#define MSG_ANNCE_NOTIF_(teamnum, name, cvarname, defaultvalue, sound, channel, volume, position, queuetime)
#define MSG_ANNCE_NOTIF_TEAM(teamnum, name, cvarname, defaultvalue, sound, channel, volume, position, queuetime)
#define MSG_CENTER_NOTIF(name, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle)
#define MSG_CENTER_NOTIF_(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle)
#define MSG_CENTER_NOTIF_TEAM(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle)
#define MSG_CHOICE_NOTIF(name, defaultvalue, challow, chtype, optiona, optionb)
#define MSG_CHOICE_NOTIF_(teamnum, name, cvarname, defaultvalue, challow, chtype, optiona, optionb)
#define MSG_CHOICE_NOTIF_TEAM(teamnum, name, cvarname, defaultvalue, challow, chtype, optiona, optionb)
#define MSG_INFO_NOTIF(name, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle)
#define MSG_INFO_NOTIF_(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle)
#define MSG_INFO_NOTIF_TEAM(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle)
#define MSG_MULTI_NOTIF(name, defaultvalue, anncename, infoname, centername)
#define MULTIICON_INFO(name, defaultvalue, strnum, flnum, args, hudargs, iconargs, icon, normal, gentle)
#define MULTIICON_INFO_(name, defaultvalue, strnum, flnum, args, hudargs, iconargs, icon, normal, gentle)
#define NOTIF_ADD_AUTOCVAR(name, defaultvalue)
#define NOTIF_ADD_AUTOCVAR_ALLOWED(name, defaultvalue)
#define NOTIF_ARGUMENT_LIST
#define NOTIF_HIT_MAX(count, funcname)
#define NOTIF_HIT_UNKNOWN(token, funcname)
#define SPREE_ITEM(counta, countb, center, normal, gentle)
#define SPREE_ITEM(counta, countb, center, normal, gentle)

Typedefs

using Notification = entity
 always last

Functions

void Create_Notification_Entity (entity notif, int var_default, int var_cvar, MSG typeId, int teamnum)
void Create_Notification_Entity_Annce (entity notif, int var_cvar, int channel, string snd, float vol, float position, float queuetime)
void Create_Notification_Entity_Choice (entity notif, int var_cvar, int challow_def, int challow_var, MSG chtype, Notification optiona, Notification optionb)
void Create_Notification_Entity_InfoCenter (entity notif, int var_cvar, int strnum, int flnum, string args, string hudargs, string icon, CPID cpid, string durcnt, string normal, string gentle)
void Create_Notification_Entity_Multi (entity notif, int var_cvar, Notification anncename, Notification infoname, Notification centername)
void Destroy_All_Notifications ()
void Dump_Notifications (int fh, bool alsoprint)
 Used to output notifications.cfg file.
 GENERIC_COMMAND (dumpnotifs, "Dump all notifications into " DEFAULT_FILENAME, false)
string Get_Notif_BroadcastName (NOTIF broadcast)
 send to one client and their spectators
string Get_Notif_CvarName (Notification notif)
Notification Get_Notif_Ent (MSG net_type, int net_name)
string Get_Notif_TypeName (MSG net_type)
string hash_replace (string full_msg, int ent_msg_num, string ent_msg, string attacker_name)
 replaces # with attacker_name in ent_msg (if not found attacker_name is appended)
void Kill_Notification (NOTIF broadcast, entity client, MSG net_type, CPID net_name)
void Local_Notification (MSG net_type, Notification net_name,...count)
void Local_Notification_Core (MSG net_type, Notification net_name, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
 glue for networking, forwards to Local_Notification
void Local_Notification_Queue_Process ()
string notif_arg_frag_ping (bool newline, float fping)
string notif_arg_frag_stats (float fhealth, float farmor, float fping)
string notif_arg_item_wepammo (float f1, float f2)
string notif_arg_spree_cen (float spree)
string notif_arg_spree_inf (float type, string input, string player, float spree)
void Notification_GetCvars (entity this, entity store)
 Used by MSG_CHOICE to build list of choices.
 REGISTRY_BEGIN (Notifications)
 REGISTRY_END (Notifications)
void ReplicateVars (bool would_destroy)
void Send_Notification (NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
void Send_Notification_Core (NOTIF broadcast, entity client, MSG net_type, Notification net_name, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
 STATIC_INIT (g_notifications)
 STATIC_INIT (Notifications)
 STATIC_INIT_LATE (Notif_Choices)

Variables

const int ARG_CS = 4
 unique result to CSQC
const int ARG_CS_SV = 3
 enabled on CSQC and SVQC
const int ARG_CS_SV_DC = 2
 enabled on CSQC, SVQC, and durcnt centerprint
const int ARG_CS_SV_HA = 1
 enabled on CSQC, SVQC, and Hudargs
const int ARG_DC = 6
 unique result to durcnt/centerprint
string arg_slot [NOTIF_MAX_ARGS]
const int ARG_SV = 5
 unique result to SVQC
bool autocvar_notification_errors_are_fatal = true
float autocvar_notification_lifetime_mapload = 10
float autocvar_notification_lifetime_runtime = 0.5
bool autocvar_notification_server_allows_location = true
bool autocvar_notification_show_location = false
string autocvar_notification_show_location_string = ""
bool autocvar_notification_show_sprees = true
int autocvar_notification_show_sprees_info = 3
bool autocvar_notification_show_sprees_info_newline = true
bool autocvar_notification_show_sprees_info_specialonly = true
const string BOLD_OPERATOR = "^BOLD"
int cvar_value
IntrusiveList g_notifications
int msg_choice_choices [NOTIF_CHOICE_MAX]
 set on each player containing MSG_CHOICE choices
string nent_args
NOTIF nent_broadcast
int nent_challow_def
int nent_challow_var
int nent_channel
int nent_choice_count = 0
int nent_choice_idx
entity nent_client
CPID nent_cpid
int nent_default
string nent_durcnt
bool nent_enabled
int nent_floatcount
float nent_floats [4]
string nent_hudargs
string nent_icon
string nent_iconargs
entity nent_msgannce
entity nent_msgcenter
entity nent_msginfo
int nent_net_name
MSG nent_net_type
entity nent_optiona
entity nent_optionb
float nent_position
float nent_queuetime
string nent_snd
string nent_string
int nent_stringcount
string nent_strings [4]
int nent_teamnum
MSG nent_type
float nent_vol
const int NOTIF_CHOICE_MAX = 20
bool notif_error
bool notif_global_error
const int NOTIF_MAX_ARGS = 7
const int NOTIF_MAX_DURCNT = 2
const int NOTIF_MAX_HUDARGS = 2
entity notif_queue_entity [NOTIF_QUEUE_MAX]
int notif_queue_length
const int NOTIF_QUEUE_MAX = 10
float notif_queue_next_time
float notif_queue_time [NOTIF_QUEUE_MAX]
MSG notif_queue_type [NOTIF_QUEUE_MAX]
string prev_soundfile
float prev_soundtime

Macro Definition Documentation

◆ ACVNN

#define ACVNN ( name,
defaultvalue )
Value:
autocvar_notification_##name
string name
Definition menu.qh:30

Definition at line 693 of file all.qh.

◆ ACVNNA

#define ACVNNA ( name,
defaultvalue )
Value:
autocvar_notification_##name##_ALLOWED

Definition at line 694 of file all.qh.

◆ APP_NUM

#define APP_NUM ( num,
prefix )
Value:
((num) ? APP_TEAM_NUM(num, prefix) : prefix##_NEUTRAL)
#define APP_TEAM_NUM(num, prefix)
Definition all.qh:88

Definition at line 89 of file all.qh.

Referenced by ctf_CheckFlagReturn(), ctf_Handle_Capture(), ctf_Handle_Drop(), ctf_Handle_Pickup(), ctf_Handle_Retrieve(), and MUTATOR_HOOKFUNCTION().

◆ APP_TEAM_NUM

◆ DEFAULT_FILENAME

#define DEFAULT_FILENAME   "notifications_dump.cfg"

Definition at line 164 of file all.qh.

Referenced by GENERIC_COMMAND(), and GENERIC_COMMAND().

◆ EIGHT_VARS_TO_VARARGS_VARLIST

#define EIGHT_VARS_TO_VARARGS_VARLIST ( stringcount,
floatcount )
Value:
if (stringcount >= 0 && stringcount <= 4 && floatcount >= 0 && floatcount <= 4) \
switch ((floatcount) * 10 + stringcount) \
{ /* tenths: number of floats, units: number of strings */ \
case 1: VARITEM( s1) \
case 2: VARITEM(XPD(s1, s2)) \
case 3: VARITEM(XPD(s1, s2, s3)) \
case 4: VARITEM(XPD(s1, s2, s3, s4)) \
case 10: VARITEM( f1) \
case 11: VARITEM(XPD(s1, f1)) \
case 12: VARITEM(XPD(s1, s2, f1)) \
case 13: VARITEM(XPD(s1, s2, s3, f1)) \
case 14: VARITEM(XPD(s1, s2, s3, s4, f1)) \
case 20: VARITEM(XPD( f1, f2)) \
case 21: VARITEM(XPD(s1, f1, f2)) \
case 22: VARITEM(XPD(s1, s2, f1, f2)) \
case 23: VARITEM(XPD(s1, s2, s3, f1, f2)) \
case 24: VARITEM(XPD(s1, s2, s3, s4, f1, f2)) \
case 30: VARITEM(XPD( f1, f2, f3)) \
case 31: VARITEM(XPD(s1, f1, f2, f3)) \
case 32: VARITEM(XPD(s1, s2, f1, f2, f3)) \
case 33: VARITEM(XPD(s1, s2, s3, f1, f2, f3)) \
case 34: VARITEM(XPD(s1, s2, s3, s4, f1, f2, f3)) \
case 40: VARITEM(XPD( f1, f2, f3, f4)) \
case 41: VARITEM(XPD(s1, f1, f2, f3, f4)) \
case 42: VARITEM(XPD(s1, s2, f1, f2, f3, f4)) \
case 43: VARITEM(XPD(s1, s2, s3, f1, f2, f3, f4)) \
case 44: VARITEM(XPD(s1, s2, s3, s4, f1, f2, f3, f4)) \
}
#define XPD(...)
Definition util.qh:228
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points f2
Definition all.inc:369
spree_inf s1 s2 s3loc s2 s1
Definition all.inc:284
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points s1 s2
Definition all.inc:474
f1
Definition all.inc:566
#define VARITEM(args)

Definition at line 91 of file all.qh.

91#define EIGHT_VARS_TO_VARARGS_VARLIST(stringcount, floatcount) \
92 if (stringcount >= 0 && stringcount <= 4 && floatcount >= 0 && floatcount <= 4) \
93 switch ((floatcount) * 10 + stringcount) \
94 { /* tenths: number of floats, units: number of strings */ \
95 case 1: VARITEM( s1) \
96 case 2: VARITEM(XPD(s1, s2)) \
97 case 3: VARITEM(XPD(s1, s2, s3)) \
98 case 4: VARITEM(XPD(s1, s2, s3, s4)) \
99 case 10: VARITEM( f1) \
100 case 11: VARITEM(XPD(s1, f1)) \
101 case 12: VARITEM(XPD(s1, s2, f1)) \
102 case 13: VARITEM(XPD(s1, s2, s3, f1)) \
103 case 14: VARITEM(XPD(s1, s2, s3, s4, f1)) \
104 case 20: VARITEM(XPD( f1, f2)) \
105 case 21: VARITEM(XPD(s1, f1, f2)) \
106 case 22: VARITEM(XPD(s1, s2, f1, f2)) \
107 case 23: VARITEM(XPD(s1, s2, s3, f1, f2)) \
108 case 24: VARITEM(XPD(s1, s2, s3, s4, f1, f2)) \
109 case 30: VARITEM(XPD( f1, f2, f3)) \
110 case 31: VARITEM(XPD(s1, f1, f2, f3)) \
111 case 32: VARITEM(XPD(s1, s2, f1, f2, f3)) \
112 case 33: VARITEM(XPD(s1, s2, s3, f1, f2, f3)) \
113 case 34: VARITEM(XPD(s1, s2, s3, s4, f1, f2, f3)) \
114 case 40: VARITEM(XPD( f1, f2, f3, f4)) \
115 case 41: VARITEM(XPD(s1, f1, f2, f3, f4)) \
116 case 42: VARITEM(XPD(s1, s2, f1, f2, f3, f4)) \
117 case 43: VARITEM(XPD(s1, s2, s3, f1, f2, f3, f4)) \
118 case 44: VARITEM(XPD(s1, s2, s3, s4, f1, f2, f3, f4)) \
119 }

Referenced by Local_Notification_Core(), and Send_Notification_Core().

◆ Get_Notif_Name

#define Get_Notif_Name ( notif)
Value:
notif.registered_id

main types/groups of notifications

"Global" AND "personal" announcer messages "Global" information messages "Personal" centerprint messages Subcall MSG_INFO and/or MSG_CENTER notifications Choose which subcall wrapper to activate Kill centerprint message

Deprecated

Definition at line 32 of file all.qh.

Referenced by Create_Notification_Entity(), Create_Notification_Entity_Annce(), Create_Notification_Entity_Choice(), Create_Notification_Entity_InfoCenter(), Create_Notification_Entity_Multi(), Get_Notif_CvarName(), Get_Notif_Ent(), Local_Notification(), NET_HANDLE(), Net_Notification_Remove(), and Send_Notification_Core().

◆ HASH_REPLACE

#define HASH_REPLACE ( full_msg,
num,
attacker_name )
Value:
hash_replace(input, num, s##num, attacker_name)
string hash_replace(string full_msg, int ent_msg_num, string ent_msg, string attacker_name)
replaces # with attacker_name in ent_msg (if not found attacker_name is appended)
Definition all.qh:394

Definition at line 409 of file all.qh.

◆ KILL_SPREE_LIST

#define KILL_SPREE_LIST
Value:
SPREE_ITEM(3, 03, _("TRIPLE FRAG!"), _("%s^K1 made a TRIPLE FRAG!"), _("%s^K1 made a TRIPLE SCORE!")) \
SPREE_ITEM(5, 05, _("RAGE!"), _("%s^K1 unlocked RAGE!"), _("%s^K1 made FIVE SCORES IN A ROW!")) \
SPREE_ITEM(10, 10, _("MASSACRE!"), _("%s^K1 started a MASSACRE!"), _("%s^K1 made TEN SCORES IN A ROW!")) \
SPREE_ITEM(15, 15, _("MAYHEM!"), _("%s^K1 executed MAYHEM!"), _("%s^K1 made FIFTEEN SCORES IN A ROW!")) \
SPREE_ITEM(20, 20, _("BERSERKER!"), _("%s^K1 is a BERSERKER!"), _("%s^K1 made TWENTY SCORES IN A ROW!")) \
SPREE_ITEM(25, 25, _("CARNAGE!"), _("%s^K1 inflicts CARNAGE!"), _("%s^K1 made TWENTY FIVE SCORES IN A ROW!")) \
SPREE_ITEM(30, 30, _("ARMAGEDDON!"), _("%s^K1 unleashes ARMAGEDDON!"), _("%s^K1 made THIRTY SCORES IN A ROW!"))
#define SPREE_ITEM(counta, countb, center, normal, gentle)

Definition at line 487 of file all.qh.

487#define KILL_SPREE_LIST \
488 SPREE_ITEM(3, 03, _("TRIPLE FRAG!"), _("%s^K1 made a TRIPLE FRAG!"), _("%s^K1 made a TRIPLE SCORE!")) \
489 SPREE_ITEM(5, 05, _("RAGE!"), _("%s^K1 unlocked RAGE!"), _("%s^K1 made FIVE SCORES IN A ROW!")) \
490 SPREE_ITEM(10, 10, _("MASSACRE!"), _("%s^K1 started a MASSACRE!"), _("%s^K1 made TEN SCORES IN A ROW!")) \
491 SPREE_ITEM(15, 15, _("MAYHEM!"), _("%s^K1 executed MAYHEM!"), _("%s^K1 made FIFTEEN SCORES IN A ROW!")) \
492 SPREE_ITEM(20, 20, _("BERSERKER!"), _("%s^K1 is a BERSERKER!"), _("%s^K1 made TWENTY SCORES IN A ROW!")) \
493 SPREE_ITEM(25, 25, _("CARNAGE!"), _("%s^K1 inflicts CARNAGE!"), _("%s^K1 made TWENTY FIVE SCORES IN A ROW!")) \
494 SPREE_ITEM(30, 30, _("ARMAGEDDON!"), _("%s^K1 unleashes ARMAGEDDON!"), _("%s^K1 made THIRTY SCORES IN A ROW!"))

Referenced by MUTATOR_HOOKFUNCTION(), notif_arg_spree_cen(), notif_arg_spree_inf(), and Obituary().

◆ MSG_ANNCE_NOTIF

#define MSG_ANNCE_NOTIF ( name,
defaultvalue,
sound,
channel,
volume,
position,
queuetime )
Value:
NOTIF_ADD_AUTOCVAR(ANNCE_##name, defaultvalue) \
MSG_ANNCE_NOTIF_(0, ANNCE_##name, ANNCE_##name, defaultvalue, sound, channel, volume, position, queuetime)
#define NOTIF_ADD_AUTOCVAR(name, defaultvalue)
Definition all.qh:695
#define sound(e, c, s, v, a)
Definition sound.qh:52
float volume
Definition triggers.qh:47

Definition at line 757 of file all.qh.

757#define MSG_ANNCE_NOTIF(name, defaultvalue, sound, channel, volume, position, queuetime) \
758 NOTIF_ADD_AUTOCVAR(ANNCE_##name, defaultvalue) \
759 MSG_ANNCE_NOTIF_(0, ANNCE_##name, ANNCE_##name, defaultvalue, sound, channel, volume, position, queuetime)

◆ MSG_ANNCE_NOTIF_

#define MSG_ANNCE_NOTIF_ ( teamnum,
name,
cvarname,
defaultvalue,
sound,
channel,
volume,
position,
queuetime )
Value:
REGISTER(Notifications, name, m_id, new_pure(msg_annce_notification)) \
{ \
Create_Notification_Entity(this, defaultvalue, ACVNN(cvarname, defaultvalue), MSG_ANNCE, teamnum); \
Create_Notification_Entity_Annce(this, ACVNN(cvarname, defaultvalue), \
channel, /* channel */ \
sound, /* snd */ \
volume, /* vol */ \
position, /* position */ \
queuetime); /* queuetime */ \
}
int m_id
Definition effect.qh:19
#define ACVNN(name, defaultvalue)
Definition all.qh:693
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:66
#define REGISTER(...)
Register a new entity with a registry.
Definition registry.qh:121

Definition at line 761 of file all.qh.

761#define MSG_ANNCE_NOTIF_(teamnum, name, cvarname, defaultvalue, sound, channel, volume, position, queuetime) \
762 REGISTER(Notifications, name, m_id, new_pure(msg_annce_notification)) \
763 { \
764 Create_Notification_Entity(this, defaultvalue, ACVNN(cvarname, defaultvalue), MSG_ANNCE, teamnum); \
765 Create_Notification_Entity_Annce(this, ACVNN(cvarname, defaultvalue), \
766 channel, /* channel */ \
767 sound, /* snd */ \
768 volume, /* vol */ \
769 position, /* position */ \
770 queuetime); /* queuetime */ \
771 }

◆ MSG_ANNCE_NOTIF_TEAM

#define MSG_ANNCE_NOTIF_TEAM ( teamnum,
name,
cvarname,
defaultvalue,
sound,
channel,
volume,
position,
queuetime )
Value:
MSG_ANNCE_NOTIF_(teamnum, ANNCE_##name, ANNCE_##cvarname, defaultvalue, sound, channel, volume, position, queuetime)
#define MSG_ANNCE_NOTIF_(teamnum, name, cvarname, defaultvalue, sound, channel, volume, position, queuetime)
Definition all.qh:761

Definition at line 755 of file all.qh.

755#define MSG_ANNCE_NOTIF_TEAM(teamnum, name, cvarname, defaultvalue, sound, channel, volume, position, queuetime) \
756 MSG_ANNCE_NOTIF_(teamnum, ANNCE_##name, ANNCE_##cvarname, defaultvalue, sound, channel, volume, position, queuetime)

◆ MSG_CENTER_NOTIF

#define MSG_CENTER_NOTIF ( name,
defaultvalue,
strnum,
flnum,
args,
cpid,
durcnt,
normal,
gentle )
Value:
NOTIF_ADD_AUTOCVAR(CENTER_##name, defaultvalue) \
MSG_CENTER_NOTIF_(0, CENTER_##name, CENTER_##name, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle)

Definition at line 816 of file all.qh.

816#define MSG_CENTER_NOTIF(name, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle) \
817 NOTIF_ADD_AUTOCVAR(CENTER_##name, defaultvalue) \
818 MSG_CENTER_NOTIF_(0, CENTER_##name, CENTER_##name, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle)

Referenced by BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), BOLD(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), MSG_CENTER_NOTIF(), strcat(), VERBOSE_MURDER(), VERBOSE_MURDER(), VERBOSE_MURDER(), VERBOSE_MURDER(), VERBOSE_MURDER(), and VERBOSE_MURDER().

◆ MSG_CENTER_NOTIF_

#define MSG_CENTER_NOTIF_ ( teamnum,
name,
cvarname,
defaultvalue,
strnum,
flnum,
args,
cpid,
durcnt,
normal,
gentle )
Value:
REGISTER(Notifications, name, m_id, new_pure(msg_center_notification)) \
{ \
Create_Notification_Entity(this, defaultvalue, ACVNN(cvarname, defaultvalue), MSG_CENTER, teamnum); \
Create_Notification_Entity_InfoCenter(this, ACVNN(cvarname, defaultvalue), strnum, flnum, \
args, /* args */ \
"", /* hudargs */ \
"", /* icon */ \
cpid, /* cpid */ \
durcnt, /* durcnt */ \
normal, /* normal */ \
gentle); /* gentle */ \
}

Definition at line 820 of file all.qh.

820#define MSG_CENTER_NOTIF_(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle) \
821 REGISTER(Notifications, name, m_id, new_pure(msg_center_notification)) \
822 { \
823 Create_Notification_Entity(this, defaultvalue, ACVNN(cvarname, defaultvalue), MSG_CENTER, teamnum); \
824 Create_Notification_Entity_InfoCenter(this, ACVNN(cvarname, defaultvalue), strnum, flnum, \
825 args, /* args */ \
826 "", /* hudargs */ \
827 "", /* icon */ \
828 cpid, /* cpid */ \
829 durcnt, /* durcnt */ \
830 normal, /* normal */ \
831 gentle); /* gentle */ \
832 }

◆ MSG_CENTER_NOTIF_TEAM

#define MSG_CENTER_NOTIF_TEAM ( teamnum,
name,
cvarname,
defaultvalue,
strnum,
flnum,
args,
cpid,
durcnt,
normal,
gentle )
Value:
MSG_CENTER_NOTIF_(teamnum, CENTER_##name, CENTER_##cvarname, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle)
#define MSG_CENTER_NOTIF_(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle)
Definition all.qh:820

Definition at line 814 of file all.qh.

814#define MSG_CENTER_NOTIF_TEAM(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle) \
815 MSG_CENTER_NOTIF_(teamnum, CENTER_##name, CENTER_##cvarname, defaultvalue, strnum, flnum, args, cpid, durcnt, normal, gentle)

◆ MSG_CHOICE_NOTIF

#define MSG_CHOICE_NOTIF ( name,
defaultvalue,
challow,
chtype,
optiona,
optionb )
Value:
NOTIF_ADD_AUTOCVAR(CHOICE_##name, defaultvalue) \
NOTIF_ADD_AUTOCVAR_ALLOWED(CHOICE_##name, challow) \
MSG_CHOICE_NOTIF_(0, CHOICE_##name, CHOICE_##name, defaultvalue, challow, chtype, optiona, optionb)

Definition at line 847 of file all.qh.

847#define MSG_CHOICE_NOTIF(name, defaultvalue, challow, chtype, optiona, optionb) \
848 NOTIF_ADD_AUTOCVAR(CHOICE_##name, defaultvalue) \
849 NOTIF_ADD_AUTOCVAR_ALLOWED(CHOICE_##name, challow) \
850 MSG_CHOICE_NOTIF_(0, CHOICE_##name, CHOICE_##name, defaultvalue, challow, chtype, optiona, optionb)

◆ MSG_CHOICE_NOTIF_

#define MSG_CHOICE_NOTIF_ ( teamnum,
name,
cvarname,
defaultvalue,
challow,
chtype,
optiona,
optionb )
Value:
REGISTER(Notifications, name, m_id, new_pure(msg_choice_notification)) \
{ \
if (!teamnum || teamnum == NUM_TEAM_4) \
Create_Notification_Entity(this, defaultvalue, ACVNN(cvarname, defaultvalue), MSG_CHOICE, teamnum); \
Create_Notification_Entity_Choice(this, ACVNN(cvarname, defaultvalue), \
challow, /* challow_def */ \
ACVNNA(cvarname, challow), /* challow_var */ \
chtype, /* chtype */ \
optiona, /* optiona */ \
optionb); /* optionb */ \
}
#define ACVNNA(name, defaultvalue)
Definition all.qh:694
int nent_choice_idx
Definition all.qh:720
int nent_choice_count
Definition all.qh:719
const int NUM_TEAM_4
Definition teams.qh:16

Definition at line 852 of file all.qh.

852#define MSG_CHOICE_NOTIF_(teamnum, name, cvarname, defaultvalue, challow, chtype, optiona, optionb) \
853 REGISTER(Notifications, name, m_id, new_pure(msg_choice_notification)) \
854 { \
855 this.nent_choice_idx = nent_choice_count; \
856 if (!teamnum || teamnum == NUM_TEAM_4) \
857 ++nent_choice_count; \
858 Create_Notification_Entity(this, defaultvalue, ACVNN(cvarname, defaultvalue), MSG_CHOICE, teamnum); \
859 Create_Notification_Entity_Choice(this, ACVNN(cvarname, defaultvalue), \
860 challow, /* challow_def */ \
861 ACVNNA(cvarname, challow), /* challow_var */ \
862 chtype, /* chtype */ \
863 optiona, /* optiona */ \
864 optionb); /* optionb */ \
865 }

◆ MSG_CHOICE_NOTIF_TEAM

#define MSG_CHOICE_NOTIF_TEAM ( teamnum,
name,
cvarname,
defaultvalue,
challow,
chtype,
optiona,
optionb )
Value:
MSG_CHOICE_NOTIF_(teamnum, CHOICE_##name, CHOICE_##cvarname, defaultvalue, challow, chtype, optiona, optionb)
#define MSG_CHOICE_NOTIF_(teamnum, name, cvarname, defaultvalue, challow, chtype, optiona, optionb)
Definition all.qh:852

Definition at line 845 of file all.qh.

845#define MSG_CHOICE_NOTIF_TEAM(teamnum, name, cvarname, defaultvalue, challow, chtype, optiona, optionb) \
846 MSG_CHOICE_NOTIF_(teamnum, CHOICE_##name, CHOICE_##cvarname, defaultvalue, challow, chtype, optiona, optionb)

◆ MSG_INFO_NOTIF

#define MSG_INFO_NOTIF ( name,
defaultvalue,
strnum,
flnum,
args,
hudargs,
icon,
normal,
gentle )
Value:
NOTIF_ADD_AUTOCVAR(INFO_##name, defaultvalue) \
MSG_INFO_NOTIF_(0, INFO_##name, INFO_##name, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle)

Definition at line 776 of file all.qh.

776#define MSG_INFO_NOTIF(name, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle) \
777 NOTIF_ADD_AUTOCVAR(INFO_##name, defaultvalue) \
778 MSG_INFO_NOTIF_(0, INFO_##name, INFO_##name, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle)

Referenced by MSG_INFO_NOTIF(), MSG_INFO_NOTIF(), and MULTIICON_INFO().

◆ MSG_INFO_NOTIF_

#define MSG_INFO_NOTIF_ ( teamnum,
name,
cvarname,
defaultvalue,
strnum,
flnum,
args,
hudargs,
icon,
normal,
gentle )
Value:
REGISTER(Notifications, name, m_id, new_pure(msg_info_notification)) \
{ \
Create_Notification_Entity(this, defaultvalue, ACVNN(cvarname, defaultvalue), MSG_INFO, teamnum); \
Create_Notification_Entity_InfoCenter(this, ACVNN(cvarname, defaultvalue), strnum, flnum, \
args, /* args */ \
hudargs, /* hudargs */ \
icon, /* icon */ \
CPID_Null, /* cpid */ \
"", /* durcnt */ \
normal, /* normal */ \
gentle); /* gentle */ \
}
s1 s2 s1 s2 FLAG s1 s2 FLAG spree_cen s1 CPID_Null
Definition all.inc:622

Definition at line 780 of file all.qh.

780#define MSG_INFO_NOTIF_(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle) \
781 REGISTER(Notifications, name, m_id, new_pure(msg_info_notification)) \
782 { \
783 Create_Notification_Entity(this, defaultvalue, ACVNN(cvarname, defaultvalue), MSG_INFO, teamnum); \
784 Create_Notification_Entity_InfoCenter(this, ACVNN(cvarname, defaultvalue), strnum, flnum, \
785 args, /* args */ \
786 hudargs, /* hudargs */ \
787 icon, /* icon */ \
788 CPID_Null, /* cpid */ \
789 "", /* durcnt */ \
790 normal, /* normal */ \
791 gentle); /* gentle */ \
792 }

◆ MSG_INFO_NOTIF_TEAM

#define MSG_INFO_NOTIF_TEAM ( teamnum,
name,
cvarname,
defaultvalue,
strnum,
flnum,
args,
hudargs,
icon,
normal,
gentle )
Value:
MSG_INFO_NOTIF_(teamnum, INFO_##name, INFO_##cvarname, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle)
#define MSG_INFO_NOTIF_(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle)
Definition all.qh:780

Definition at line 773 of file all.qh.

773#define MSG_INFO_NOTIF_TEAM(teamnum, name, cvarname, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle) \
774 MSG_INFO_NOTIF_(teamnum, INFO_##name, INFO_##cvarname, defaultvalue, strnum, flnum, args, hudargs, icon, normal, gentle)

◆ MSG_MULTI_NOTIF

#define MSG_MULTI_NOTIF ( name,
defaultvalue,
anncename,
infoname,
centername )
Value:
NOTIF_ADD_AUTOCVAR(name, defaultvalue) \
REGISTER(Notifications, name, m_id, new_pure(msg_multi_notification)) \
{ \
Create_Notification_Entity(this, defaultvalue, ACVNN(name, defaultvalue), MSG_MULTI, 0); \
Create_Notification_Entity_Multi(this, ACVNN(name, defaultvalue), \
anncename, /* anncename */ \
infoname, /* infoname */ \
centername); /* centername */ \
}

Definition at line 834 of file all.qh.

834#define MSG_MULTI_NOTIF(name, defaultvalue, anncename, infoname, centername) \
835 NOTIF_ADD_AUTOCVAR(name, defaultvalue) \
836 REGISTER(Notifications, name, m_id, new_pure(msg_multi_notification)) \
837 { \
838 Create_Notification_Entity(this, defaultvalue, ACVNN(name, defaultvalue), MSG_MULTI, 0); \
839 Create_Notification_Entity_Multi(this, ACVNN(name, defaultvalue), \
840 anncename, /* anncename */ \
841 infoname, /* infoname */ \
842 centername); /* centername */ \
843 }

◆ MULTIICON_INFO

#define MULTIICON_INFO ( name,
defaultvalue,
strnum,
flnum,
args,
hudargs,
iconargs,
icon,
normal,
gentle )
Value:
MULTIICON_INFO_(INFO_##name, defaultvalue, strnum, flnum, args, hudargs, iconargs, icon, normal, gentle)
#define MULTIICON_INFO_(name, defaultvalue, strnum, flnum, args, hudargs, iconargs, icon, normal, gentle)
Definition all.qh:798

Definition at line 795 of file all.qh.

795#define MULTIICON_INFO(name, defaultvalue, strnum, flnum, args, hudargs, iconargs, icon, normal, gentle) \
796 MULTIICON_INFO_(INFO_##name, defaultvalue, strnum, flnum, args, hudargs, iconargs, icon, normal, gentle)

Referenced by MULTIICON_INFO().

◆ MULTIICON_INFO_

#define MULTIICON_INFO_ ( name,
defaultvalue,
strnum,
flnum,
args,
hudargs,
iconargs,
icon,
normal,
gentle )
Value:
NOTIF_ADD_AUTOCVAR(name, defaultvalue) \
REGISTER(Notifications, name, m_id, new_pure(msg_info_notification)) \
{ \
Create_Notification_Entity(this, defaultvalue, ACVNN(name, defaultvalue), MSG_INFO, 0); \
Create_Notification_Entity_InfoCenter(this, ACVNN(name, defaultvalue), strnum, flnum, \
args, /* args */ \
hudargs, /* hudargs */ \
icon, /* icon */ \
CPID_Null, /* cpid */ \
"", /* durcnt */ \
normal, /* normal */ \
gentle); /* gentle */ \
this.nent_iconargs = iconargs; \
}
string nent_iconargs
Definition all.qh:794

Definition at line 798 of file all.qh.

798#define MULTIICON_INFO_(name, defaultvalue, strnum, flnum, args, hudargs, iconargs, icon, normal, gentle) \
799 NOTIF_ADD_AUTOCVAR(name, defaultvalue) \
800 REGISTER(Notifications, name, m_id, new_pure(msg_info_notification)) \
801 { \
802 Create_Notification_Entity(this, defaultvalue, ACVNN(name, defaultvalue), MSG_INFO, 0); \
803 Create_Notification_Entity_InfoCenter(this, ACVNN(name, defaultvalue), strnum, flnum, \
804 args, /* args */ \
805 hudargs, /* hudargs */ \
806 icon, /* icon */ \
807 CPID_Null, /* cpid */ \
808 "", /* durcnt */ \
809 normal, /* normal */ \
810 gentle); /* gentle */ \
811 this.nent_iconargs = iconargs; \
812 }

◆ NOTIF_ADD_AUTOCVAR

#define NOTIF_ADD_AUTOCVAR ( name,
defaultvalue )
Value:
int autocvar_notification_##name = defaultvalue;

Definition at line 695 of file all.qh.

◆ NOTIF_ADD_AUTOCVAR_ALLOWED

#define NOTIF_ADD_AUTOCVAR_ALLOWED ( name,
defaultvalue )
Value:
int autocvar_notification_##name##_ALLOWED = defaultvalue;

Definition at line 696 of file all.qh.

◆ NOTIF_ARGUMENT_LIST

#define NOTIF_ARGUMENT_LIST

Definition at line 424 of file all.qh.

424#define NOTIF_ARGUMENT_LIST \
425 ARG_CASE(ARG_CS_SV_HA, "s1", s1) \
426 ARG_CASE(ARG_CS_SV_HA, "s2", s2) \
427 ARG_CASE(ARG_CS_SV_HA, "s3", s3) \
428 ARG_CASE(ARG_CS_SV_HA, "s4", s4) \
429 ARG_CASE(ARG_CS_SV, "s2loc", ((autocvar_notification_show_location && (s2 != "")) ? sprintf(( ((tmp_s = autocvar_notification_show_location_string) != "") ? tmp_s : _(" (near %s)") ), s2) : "")) \
430 ARG_CASE(ARG_CS_SV, "s3loc", ((autocvar_notification_show_location && (s3 != "")) ? sprintf(( ((tmp_s = autocvar_notification_show_location_string) != "") ? tmp_s : _(" (near %s)") ), s3) : "")) \
431 ARG_CASE(ARG_CS_SV, "s4loc", ((autocvar_notification_show_location && (s4 != "")) ? sprintf(( ((tmp_s = autocvar_notification_show_location_string) != "") ? tmp_s : _(" (near %s)") ), s4) : "")) \
432 ARG_CASE(ARG_CS_SV_DC, "f1", ftos(f1)) \
433 ARG_CASE(ARG_CS_SV_DC, "f2", ftos(f2)) \
434 ARG_CASE(ARG_CS_SV, "f3", ftos(f3)) \
435 ARG_CASE(ARG_CS_SV, "f4", ftos(f4)) \
436 ARG_CASE(ARG_CS_SV, "f1dtime", ftos_decimals(TIME_DECODE(f1), 2)) \
437 ARG_CASE(ARG_CS_SV, "f2dtime", ftos_decimals(TIME_DECODE(f2), 2)) \
438 ARG_CASE(ARG_CS, "f2primsec", (f2 ? _("secondary") : _("primary"))) \
439 ARG_CASE(ARG_CS, "f3primsec", (f3 ? _("secondary") : _("primary"))) \
440 ARG_CASE(ARG_CS, "f1secs", count_seconds(f1)) \
441 ARG_CASE(ARG_CS, "f1points", (f1 == 1 ? _("1 point") : sprintf(_("%d points"), f1))) \
442 ARG_CASE(ARG_CS_SV, "f1ord", count_ordinal(f1)) \
443 ARG_CASE(ARG_CS_SV, "f1time", process_time(2, f1)) \
444 ARG_CASE(ARG_CS_SV_HA, "f1race_time", TIME_ENCODED_TOSTRING(f1, true)) \
445 ARG_CASE(ARG_CS_SV_HA, "f2race_time", TIME_ENCODED_TOSTRING(f2, true)) \
446 ARG_CASE(ARG_CS_SV_HA, "f3race_time", TIME_ENCODED_TOSTRING(f3, true)) \
447 ARG_CASE(ARG_CS_SV, "race_col", CCR((f1 == 1) ? "^F1" : "^F2")) \
448 ARG_CASE(ARG_CS_SV, "race_diff", ((TIME_ENCODED_TOSTRING(fabs(f2 - f3), true) == "0.00") ? "^3[+0.0]" : (f2 > f3) ? sprintf("^1[+%s]", TIME_ENCODED_TOSTRING(f2 - f3, true)) : sprintf("^2[-%s]", TIME_ENCODED_TOSTRING(f3 - f2, true)))) \
449 ARG_CASE(ARG_CS, "pass_key", getcommandkey(_("drop flag"), "+use")) \
450 ARG_CASE(ARG_CS, "nade_key", getcommandkey(_("throw nade"), "dropweapon")) \
451 ARG_CASE(ARG_CS, "join_key", getcommandkey(_("jump"), "+jump")) \
452 ARG_CASE(ARG_CS, "frag_ping", notif_arg_frag_ping(true, f2)) \
453 ARG_CASE(ARG_CS, "frag_stats", notif_arg_frag_stats(f2, f3, f4)) \
454 /*ARG_CASE(ARG_CS, "frag_pos", ((Should_Print_Score_Pos(f1)) ? sprintf("\n^BG%s", Read_Score_Pos(f1)) : ""))*/ \
455 ARG_CASE(ARG_CS, "spree_cen", (autocvar_notification_show_sprees ? notif_arg_spree_cen(f1) : "")) \
456 ARG_CASE(ARG_CS_SV, "spree_inf", (autocvar_notification_show_sprees ? notif_arg_spree_inf(1, input, s2, f2) : "")) \
457 ARG_CASE(ARG_CS_SV, "spree_end", (autocvar_notification_show_sprees ? notif_arg_spree_inf(-1, "", "", f1) : "")) \
458 ARG_CASE(ARG_CS_SV, "spree_lost", (autocvar_notification_show_sprees ? notif_arg_spree_inf(-2, "", "", f1) : "")) \
459 ARG_CASE(ARG_CS_SV, "item_wepname", REGISTRY_GET(Weapons, f1).m_name) \
460 ARG_CASE(ARG_CS_SV, "item_buffname", BUFF_NAME(f1)) \
461 ARG_CASE(ARG_CS_SV, "f3buffname", BUFF_NAME(f3)) \
462 ARG_CASE(ARG_CS_SV, "item_wepammo", (f2 > 0 ? notif_arg_item_wepammo(f1, f2) : "")) \
463 ARG_CASE(ARG_DC, "item_centime", ftos(autocvar_notification_item_centerprinttime)) \
464 ARG_CASE(ARG_SV, "death_team", Team_ColoredFullName(f1)) \
465 ARG_CASE(ARG_CS, "death_team", Team_ColoredFullName(f1 - 1)) \
466 ARG_CASE(ARG_SV, "s3#s2", s3) \
467 ARG_CASE(ARG_SV, "#s2", s2) \
468 ARG_CASE(ARG_CS, "s3#s2", HASH_REPLACE(input, 3, s2)) \
469 ARG_CASE(ARG_CS, "#s2", "") \
470 ARG_CASE(ARG_CS_SV_HA, "minigame1_name",find(NULL, netname, s1).descriptor.message) \
471 ARG_CASE(ARG_CS_SV_HA, "minigame1_d", find(NULL, netname, s1).descriptor.netname)

Referenced by Local_Notification_centerprint_Add(), Local_Notification_HUD_Notify_Push(), Local_Notification_sprintf(), and Process_Notif_Args().

◆ NOTIF_HIT_MAX

#define NOTIF_HIT_MAX ( count,
funcname )
Value:
MACRO_BEGIN \
if (sel_num == count) \
{ \
backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); \
break; \
} \
float count
Definition powerups.qc:22
#define MACRO_END
Definition macro.qh:7

Definition at line 473 of file all.qh.

473#define NOTIF_HIT_MAX(count, funcname) MACRO_BEGIN \
474 if (sel_num == count) \
475 { \
476 backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); \
477 break; \
478 } \
479MACRO_END

Referenced by Local_Notification_centerprint_Add(), Local_Notification_HUD_Notify_Push(), and Local_Notification_sprintf().

◆ NOTIF_HIT_UNKNOWN

#define NOTIF_HIT_UNKNOWN ( token,
funcname )
Value:
{ \
backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); \
break; \
}

Definition at line 481 of file all.qh.

481#define NOTIF_HIT_UNKNOWN(token, funcname) \
482{ \
483 backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); \
484 break; \
485}

Referenced by Local_Notification_centerprint_Add(), Local_Notification_HUD_Notify_Push(), and Local_Notification_sprintf().

◆ SPREE_ITEM [1/2]

#define SPREE_ITEM ( counta,
countb,
center,
normal,
gentle )
Value:
case counta: \
return sprintf(CCR(strcat(normal_or_gentle(normal, gentle), " %s^BG")), \
player, spree_newline);
#define normal_or_gentle(normal, gentle)
Definition util.qh:243
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
string CCR(string input)
color code replace, place inside of sprintf and parse the string
Definition string.qh:214

◆ SPREE_ITEM [2/2]

#define SPREE_ITEM ( counta,
countb,
center,
normal,
gentle )
Value:
case counta: \
return strcat(normal_or_gentle(center, sprintf(_("%d score spree!"), spree)), " ");

Typedef Documentation

◆ Notification

always last

Definition at line 85 of file all.qh.

Function Documentation

◆ Create_Notification_Entity()

void Create_Notification_Entity ( entity notif,
int var_default,
int var_cvar,
MSG typeId,
int teamnum )

Definition at line 342 of file all.qc.

347{
348 // =====================
349 // Global Entity Setup
350 // =====================
351 notif.nent_default = var_default;
352 notif.nent_enabled = (var_cvar >= 1);
353 notif.nent_type = typeId;
354 notif.nent_teamnum = teamnum;
355
356 // Other pre-notif-setup requisites
357 notif_error = false;
358
359 switch (typeId)
360 {
361 case MSG_ANNCE:
362 case MSG_INFO:
363 case MSG_CENTER:
364 case MSG_MULTI:
365 case MSG_CHOICE:
366 break;
367 default:
368 LOG_INFOF(
369 (
370 "^1NOTIFICATION WITH IMPROPER TYPE: "
371 "^7net_type = %d, net_name = %s."
372 ),
373 typeId,
374 Get_Notif_Name(notif)
375 );
376 notif_error = true;
377 break;
378 }
379
380 // now check to see if any errors happened
381 if (notif_error)
382 {
383 notif.nent_enabled = false; // disable the notification so it can't cause trouble
384 notif_global_error = true; // throw the red flag that an error happened on init
385 }
386}
#define LOG_INFOF(...)
Definition log.qh:63
#define Get_Notif_Name(notif)
main types/groups of notifications
Definition all.qh:32
bool notif_error
Definition all.qh:723
bool notif_global_error
Definition all.qh:724

References entity(), Get_Notif_Name, LOG_INFOF, notif_error, and notif_global_error.

◆ Create_Notification_Entity_Annce()

void Create_Notification_Entity_Annce ( entity notif,
int var_cvar,
int channel,
string snd,
float vol,
float position,
float queuetime )

Definition at line 390 of file all.qc.

398{
399 // Set MSG_ANNCE information and handle precaching
400#ifdef CSQC
401 MSG typeId = MSG_ANNCE;
402 if (!(GENTLE && var_cvar == 1))
403 {
404 if (snd != "")
405 {
406 if (notif.nent_enabled)
407 {
409 notif.nent_channel = channel;
410 notif.nent_snd = strzone(snd);
411 notif.nent_vol = vol;
412 notif.nent_position = position;
413 notif.nent_queuetime = queuetime;
414 }
415 }
416 else
417 {
418 LOG_INFOF(
419 (
420 "^1NOTIFICATION WITH NO SOUND: "
421 "^7net_type = %s, net_name = %s."
422 ),
423 Get_Notif_TypeName(typeId),
424 Get_Notif_Name(notif)
425 );
426 notif_error = true;
427 }
428 }
429 else
430 notif.nent_enabled = false;
431#else
432 notif.nent_enabled = false;
433#endif
434}
#define GENTLE
Definition util.qh:238
string precache_sound(string sample)
string strzone(string s)
#define AnnouncerFilename(snd)
Definition all.qc:388
string Get_Notif_TypeName(MSG net_type)
Definition all.qh:34

References AnnouncerFilename, entity(), GENTLE, Get_Notif_Name, Get_Notif_TypeName(), LOG_INFOF, notif_error, precache_sound(), and strzone().

◆ Create_Notification_Entity_Choice()

void Create_Notification_Entity_Choice ( entity notif,
int var_cvar,
int challow_def,
int challow_var,
MSG chtype,
Notification optiona,
Notification optionb )

Definition at line 644 of file all.qc.

652{
653 MSG typeId = MSG_CHOICE;
654 if (chtype == MSG_Null || !optiona || !optionb)
655 {
656 LOG_INFOF(
657 (
658 "^1NOTIFICATION IS MISSING CHOICE PARAMS: "
659 "^7net_type = %s, net_name = %s."
660 ),
661 Get_Notif_TypeName(typeId),
662 Get_Notif_Name(notif)
663 );
664 notif_error = true;
665 }
666 else
667 {
668 notif.nent_optiona = optiona;
669 notif.nent_optionb = optionb;
670 notif.nent_challow_def = challow_def; // 0: never allowed, 1: allowed in warmup, 2: always allowed
671 notif.nent_challow_var = challow_var; // 0: never allowed, 1: allowed in warmup, 2: always allowed
672 notif.nent_stringcount = max(notif.nent_optiona.nent_stringcount, notif.nent_optionb.nent_stringcount);
673 notif.nent_floatcount = max(notif.nent_optiona.nent_floatcount, notif.nent_optionb.nent_floatcount);
674
675 /*
676 #ifdef NOTIFICATIONS_DEBUG
677 Debug_Notification(sprintf(
678 "Create_Notification_Entity(...): MSG_CHOICE: %s\n%s\n%s\n",
679 Get_Notif_Name(notif),
680 sprintf(
681 "^ optiona: %s %s : %d %d",
682 Get_Notif_TypeName(notif.nent_optiona.nent_type),
683 Get_Notif_Name(notif.nent_optiona),
684 notif.nent_optiona.nent_stringcount,
685 notif.nent_optiona.nent_floatcount
686 ),
687 sprintf(
688 "^ optionb: %s %s : %d %d",
689 Get_Notif_TypeName(notif.nent_optionb.nent_type),
690 Get_Notif_Name(notif.nent_optionb),
691 notif.nent_optionb.nent_stringcount,
692 notif.nent_optionb.nent_floatcount
693 )
694 ));
695 #endif
696 */
697 }
698}
float max(float f,...)

References entity(), Get_Notif_Name, Get_Notif_TypeName(), LOG_INFOF, max(), and notif_error.

◆ Create_Notification_Entity_InfoCenter()

void Create_Notification_Entity_InfoCenter ( entity notif,
int var_cvar,
int strnum,
int flnum,
string args,
string hudargs,
string icon,
CPID cpid,
string durcnt,
string normal,
string gentle )

Definition at line 436 of file all.qc.

448{
449 MSG typeId = notif.nent_type;
450 // Set MSG_INFO and MSG_CENTER string/float counts
451 notif.nent_stringcount = strnum;
452 notif.nent_floatcount = flnum;
453
454 // Only initialize arguments if we're either a client or on a dedicated server
455#ifdef SVQC
456 bool should_process_args = autocvar_sv_dedicated;
457#else
458 bool should_process_args = true;
459#endif
460 string namestring = Get_Notif_Name(notif);
461 string typestring = Get_Notif_TypeName(typeId);
462 if (should_process_args)
463 {
464 // ========================
465 // Process Main Arguments
466 // ========================
467 if (strnum + flnum)
468 {
469 if (args != "")
470 notif.nent_args = strzone(
471 Process_Notif_Args(1, args, typestring, namestring));
472 else if (hudargs == "" && durcnt == "")
473 {
474 LOG_INFOF(
475 (
476 "^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: "
477 "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d"
478 ),
479 typestring,
480 namestring,
481 strnum,
482 flnum
483 );
484 notif_error = true;
485 }
486 }
487 else if (args != "")
488 notif.nent_args = strzone(
489 Process_Notif_Args(1, args, typestring, namestring));
490
491
492 // =======================================
493 // Process HUD and Centerprint Arguments
494 // Only processed on CSQC, as these
495 // args are only for HUD features.
496 // =======================================
497 #ifdef CSQC
498 if (hudargs != "")
499 {
500 notif.nent_hudargs = strzone(
501 Process_Notif_Args(2, hudargs, typestring, namestring));
502
503 if (icon != "")
504 notif.nent_icon = strzone(icon);
505 else
506 {
507 LOG_INFOF(
508 (
509 "^1NOTIFICATION HAS HUDARGS BUT NO ICON: "
510 "^7net_type = %s, net_name = %s."
511 ),
512 typestring,
513 namestring
514 );
515 notif_error = true;
516 }
517 }
518 else if (icon != "")
519 {
520 LOG_WARNF(
521 (
522 "^1NOTIFICATION HAS ICON BUT NO HUDARGS: "
523 "^7net_type = %s, net_name = %s.\n"
524 ),
525 typestring,
526 namestring
527 );
528 notif_error = true;
529 }
530
531 if (durcnt != "")
532 {
533 notif.nent_durcnt = strzone(Process_Notif_Args(3, durcnt, typestring, namestring));
534
535 if (cpid == CPID_Null && durcnt != "0 0")
536 {
537 LOG_WARNF(
538 (
539 "Notification has durcnt but no cpid: "
540 "net_type = %s, net_name = %s."
541 ),
542 typestring,
543 namestring
544 );
545 notif_error = true;
546 }
547 }
548 notif.nent_cpid = cpid;
549 #endif // CSQC
550
551 // ======================
552 // Process Notif String
553 // ======================
554 #define SET_NOTIF_STRING(string, stringname) MACRO_BEGIN \
555 notif.nent_string = strzone(CCR( \
556 Process_Notif_Line( \
557 typeId, \
558 (var_cvar > 1), \
559 string, \
560 typestring, \
561 namestring, \
562 stringname \
563 )) \
564 ); \
565 MACRO_END
566
567 if (GENTLE)
568 {
569 if (gentle != "")
570 SET_NOTIF_STRING(gentle, "GENTLE");
571 else if (normal != "")
572 SET_NOTIF_STRING(normal, "NORMAL");
573 }
574 else if (normal != "")
575 SET_NOTIF_STRING(normal, "NORMAL");
576 #undef SET_NOTIF_STRING
577
578 // Check to make sure a string was chosen
579 if (notif.nent_string == "")
580 {
581 LOG_INFOF(
582 (
583 "^1EMPTY NOTIFICATION: "
584 "^7net_type = %s, net_name = %s."
585 ),
586 typestring,
587 namestring
588 );
589 notif_error = true;
590 }
591 }
592}
#define LOG_WARNF(...)
Definition log.qh:59
#define SET_NOTIF_STRING(string, stringname)
string Process_Notif_Args(float arg_type, string args, string notiftype, string notifname)
Definition all.qc:169
bool autocvar_sv_dedicated
Definition world.qh:41

References autocvar_sv_dedicated, CPID_Null, entity(), GENTLE, Get_Notif_Name, Get_Notif_TypeName(), LOG_INFOF, LOG_WARNF, notif_error, Process_Notif_Args(), SET_NOTIF_STRING, and strzone().

◆ Create_Notification_Entity_Multi()

void Create_Notification_Entity_Multi ( entity notif,
int var_cvar,
Notification anncename,
Notification infoname,
Notification centername )

Definition at line 594 of file all.qc.

600{
601 MSG typeId = MSG_MULTI;
602 // Set MSG_MULTI string/float counts
603 if (!anncename && !infoname && !centername)
604 {
605 LOG_INFOF(
606 (
607 "^1NOTIFICATION WITH NO SUBCALLS: "
608 "^7net_type = %s, net_name = %s."
609 ),
610 Get_Notif_TypeName(typeId),
611 Get_Notif_Name(notif)
612 );
613 notif_error = true;
614 }
615 else
616 {
617 // announcements don't actually need any arguments, so lets not even count them.
618 if (anncename)
619 notif.nent_msgannce = anncename;
620
621 int infoname_stringcount = 0, infoname_floatcount = 0;
622 int centername_stringcount = 0, centername_floatcount = 0;
623
624 if (infoname)
625 {
626 notif.nent_msginfo = infoname;
627 infoname_stringcount = notif.nent_msginfo.nent_stringcount;
628 infoname_floatcount = notif.nent_msginfo.nent_floatcount;
629 }
630
631 if (centername)
632 {
633 notif.nent_msgcenter = centername;
634 centername_stringcount = notif.nent_msgcenter.nent_stringcount;
635 centername_floatcount = notif.nent_msgcenter.nent_floatcount;
636 }
637
638 // set the requirements of THIS notification to the totals of its subcalls
639 notif.nent_stringcount = max(infoname_stringcount, centername_stringcount);
640 notif.nent_floatcount = max(infoname_floatcount, centername_floatcount);
641 }
642}

References entity(), Get_Notif_Name, Get_Notif_TypeName(), LOG_INFOF, max(), and notif_error.

◆ Destroy_All_Notifications()

void Destroy_All_Notifications ( )

Definition at line 110 of file all.qc.

111{
112 // kill all networked notifications and centerprints
113#ifdef SVQC
114 Kill_Notification(NOTIF_ALL, NULL, MSG_Null, CPID_Null);
115#else
117#endif
118
119 // kill all real notification entities
120 FOREACH(Notifications, true, Destroy_Notification_Entity(it));
121}
void centerprint_KillAll()
#define FOREACH(list, cond, body)
Definition iter.qh:19
void Kill_Notification(NOTIF broadcast, entity client, MSG net_type, CPID net_cpid)
Definition all.qc:1464
void Destroy_Notification_Entity(entity notif)
Used by restartnotifs command to initialize notifications.
Definition all.qc:99
#define NULL
Definition post.qh:14

References centerprint_KillAll(), CPID_Null, Destroy_Notification_Entity(), FOREACH, Kill_Notification(), and NULL.

Referenced by GenericCommand_restartnotifs().

◆ Dump_Notifications()

void Dump_Notifications ( int fh,
bool alsoprint )

Used to output notifications.cfg file.

Definition at line 722 of file all.qc.

723{
724 #define NOTIF_WRITE(str) write_String_To_File(fh, str, alsoprint)
725
726 #define NOTIF_WRITE_ENTITY(e, description) \
727 NOTIF_WRITE(sprintf( \
728 "seta notification_%s \"%d\" \"%s\"\n", \
729 Get_Notif_CvarName(e), e.nent_default, description \
730 ))
731
732 #define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb) \
733 NOTIF_WRITE(sprintf( \
734 "seta notification_%s \"%d\" \"%s\"\n" \
735 "seta notification_%s_ALLOWED \"%d\" \"%s\"\n", \
736 Get_Notif_CvarName(e), e.nent_default, descriptiona, \
737 Get_Notif_CvarName(e), e.nent_challow_def, descriptionb \
738 ))
739
740 #define NOTIF_WRITE_HARDCODED(cvar, default, description) \
741 NOTIF_WRITE("seta notification_" cvar " \"" default "\" \"" description "\"\n")
742
743 // Note: This warning only applies to the notifications.cfg file that is output...
744 // You ARE supposed to manually edit this function to add i.e. hard coded
745 // notification variables for mutators or gametypes or such and then
746 // regenerate the notifications.cfg file from the new code.
747
749 "// ********************************************** //\n"
750 "// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n"
751 "// ** ** //\n"
752 "// ** This file is automatically generated ** //\n"
753 "// ** by code with the command 'dumpnotifs'. ** //\n"
754 "// ** ** //\n"
755 "// ** If you add a new notification, please ** //\n"
756 "// ** regenerate this file with that command ** //\n"
757 "// ** making sure that the output matches ** //\n"
758 "// ** with the lists and defaults in code. ** //\n"
759 "// ** ** //\n"
760 "// ********************************************** //\n");
761
762 // These notifications will also append their string as a comment...
763 // This is not necessary, and does not matter if they vary between config versions,
764 // it is just a semi-helpful tool for those who want to manually change their user settings.
765
766 int NOTIF_ANNCE_COUNT = 0;
767 int NOTIF_INFO_COUNT = 0;
768 int NOTIF_CENTER_COUNT = 0;
769 int NOTIF_MULTI_COUNT = 0;
770 int NOTIF_CHOICE_COUNT = 0;
771 FOREACH(Notifications, true,
772 {
773 switch (it.nent_type)
774 {
775 case MSG_ANNCE: ++NOTIF_ANNCE_COUNT; break;
776 case MSG_INFO: ++NOTIF_INFO_COUNT; break;
777 case MSG_CENTER: ++NOTIF_CENTER_COUNT; break;
778 case MSG_MULTI: ++NOTIF_MULTI_COUNT; break;
779 case MSG_CHOICE: ++NOTIF_CHOICE_COUNT; break;
780 }
781 });
782
783 NOTIF_WRITE(sprintf("\n// MSG_ANNCE notifications:\n"));
784 FOREACH(Notifications, it.nent_type == MSG_ANNCE && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1),
786 "\\\"0\\\" = disabled, \\\"1\\\" = enabled if gentle mode is off, \\\"2\\\" = always enabled"
787 ));
788
789 NOTIF_WRITE(sprintf("\n// MSG_INFO notifications:\n"));
790 FOREACH(Notifications, it.nent_type == MSG_INFO && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1),
792 "\\\"0\\\" = off, \\\"1\\\" = print to console, "
793 "\\\"2\\\" = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
794 ));
795
796 NOTIF_WRITE(sprintf("\n// MSG_CENTER notifications:\n"));
797 FOREACH(Notifications, it.nent_type == MSG_CENTER && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1),
799 "\\\"0\\\" = off, \\\"1\\\" = centerprint"
800 ));
801
802 NOTIF_WRITE(sprintf("\n// MSG_MULTI notifications:\n"));
803 FOREACH(Notifications, it.nent_type == MSG_MULTI && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1),
805 "enable this multiple notification"
806 ));
807
808 NOTIF_WRITE(sprintf("\n// MSG_CHOICE notifications:\n"));
809 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1),
811 "choice for this notification; \\\"0\\\" = off, \\\"1\\\" = default message, \\\"2\\\" = verbose message",
812 "allow choice for this notification; \\\"0\\\" = off, \\\"1\\\" = only in warmup-stage, \\\"2\\\" = always"
813 ));
814
815 // edit these to match whichever cvars are used for specific notification options
816 NOTIF_WRITE("\n// HARD CODED notification variables:\n");
817
819 "allow_chatboxprint", "1",
820 "allow INFO notifications to be printed to chat box; "
821 "\\\"0\\\" = do not allow, "
822 "\\\"1\\\" = allow only if allowed by individual notification_INFO* cvars, "
823 "\\\"2\\\" = force all INFO notifications to be printed to the chatbox"
824 );
825
827 "debug", "0",
828 "print extra debug information on all notification function calls "
829 "(REQUIRES: -DNOTIFICATIONS_DEBUG flag to be enabled on QCSRC compilation); "
830 "\\\"0\\\" = disabled, \\\"1\\\" = dprint, \\\"2\\\" = print"
831 );
832
834 "errors_are_fatal", "1",
835 "if a notification fails upon initialization, cause a Host_Error to stop the program"
836 );
837
839 "item_centerprinttime", "1.5",
840 "how long to show item information centerprint messages (like 'You got the Electro' or such)"
841 );
842
844 "lifetime_mapload", "10",
845 "amount of time that notification entities last immediately at mapload (in seconds) "
846 "to help prevent notifications from being lost on early init (like gamestart countdown)"
847 );
848
850 "lifetime_runtime", "0.5",
851 "amount of time that notification entities last on the server during runtime (in seconds)"
852 );
853
855 "server_allows_location", "1",
856 "server side cvar for allowing death messages to show location information too"
857 );
858
860 "show_location", "0",
861 "append location information to MSG_INFO death/kill messages"
862 );
863
865 "show_location_string", "",
866 "replacement string piped into sprintf, "
867 "so you can do different messages like ' at the %s' or ' (near %s)'"
868 );
869
871 "show_sprees", "1",
872 "print information about sprees in death/kill messages"
873 );
874
876 "show_sprees_center", "1",
877 "show spree information in MSG_CENTER messages; "
878 "\\\"0\\\" = off, \\\"1\\\" = target (but only for first victim) and attacker"
879 );
880
882 "show_sprees_center_specialonly", "1",
883 "do not show spree information in MSG_CENTER messages if it is not an achievement"
884 );
885
887 "show_sprees_info", "3",
888 "show spree information in MSG_INFO messages; "
889 "\\\"0\\\" = off, \\\"1\\\" = target only, \\\"2\\\" = attacker only, \\\"3\\\" = target and attacker"
890 );
891
893 "show_sprees_info_newline", "1",
894 "show attacker spree information for MSG_INFO messages on a separate line than the death notification itself"
895 );
896
898 "show_sprees_info_specialonly", "1",
899 "do not show attacker spree information in MSG_INFO messages if it is not an achievement"
900 );
901
902 LOG_INFOF("Notification counts (total = %d): "
903 "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n",
904 NOTIF_ANNCE_COUNT + NOTIF_INFO_COUNT + NOTIF_CENTER_COUNT + NOTIF_MULTI_COUNT + NOTIF_CHOICE_COUNT,
905 NOTIF_ANNCE_COUNT,
906 NOTIF_INFO_COUNT,
907 NOTIF_CENTER_COUNT,
908 NOTIF_MULTI_COUNT,
909 NOTIF_CHOICE_COUNT
910 );
911 #undef NOTIF_WRITE_HARDCODED
912 #undef NOTIF_WRITE_ENTITY_CHOICE
913 #undef NOTIF_WRITE_ENTITY
914 #undef NOTIF_WRITE
915}
#define NOTIF_WRITE_ENTITY(e, description)
#define NOTIF_WRITE(str)
#define NOTIF_WRITE_ENTITY_CHOICE(e, descriptiona, descriptionb)
#define NOTIF_WRITE_HARDCODED(cvar, default, description)

References FOREACH, LOG_INFOF, NOTIF_WRITE, NOTIF_WRITE_ENTITY, NOTIF_WRITE_ENTITY_CHOICE, NOTIF_WRITE_HARDCODED, and NUM_TEAM_1.

Referenced by GENERIC_COMMAND().

◆ GENERIC_COMMAND()

GENERIC_COMMAND ( dumpnotifs ,
"Dump all notifications into " DEFAULT_FILENAME,
false  )

Definition at line 166 of file all.qh.

167{
168 switch (request)
169 {
171 {
172 #ifdef GAMEQC
173 string filename = argv(1);
174 bool alsoprint = false;
175 if (filename == "")
176 {
177 filename = DEFAULT_FILENAME;
178 alsoprint = false;
179 }
180 else if (filename == "-")
181 {
182 filename = DEFAULT_FILENAME;
183 alsoprint = true;
184 }
185 int fh = fopen(filename, FILE_WRITE);
186 if (fh >= 0)
187 {
188 Dump_Notifications(fh, alsoprint);
189 LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.", filename);
190 fclose(fh);
191 }
192 else
193 LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
194 #else
195 LOG_INFO("Notification dump command only works with cl_cmd and sv_cmd.");
196 #endif
197 return;
198 }
199 default:
201 LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [<filename>]");
202 LOG_HELPF(" Where <filename> is the file to write (default is %s),", DEFAULT_FILENAME);
203 LOG_HELP(" if supplied with '-' output to console as well as default,");
204 LOG_HELP(" if left blank, it will only write to default.");
205 return;
206 }
207}
const int CMD_REQUEST_COMMAND
Definition command.qh:3
const int CMD_REQUEST_USAGE
Definition command.qh:4
const float FILE_WRITE
#define GetProgramCommandPrefix()
Definition generic.qh:25
#define LOG_HELP(...)
Definition log.qh:83
#define LOG_INFO(...)
Definition log.qh:62
#define LOG_HELPF(...)
Definition log.qh:84
void fclose(float fhandle)
float fopen(string filename, float mode)
string argv(float n)
#define DEFAULT_FILENAME
Definition all.qh:164
void Dump_Notifications(int fh, bool alsoprint)
Used to output notifications.cfg file.
Definition all.qc:722

References argv(), CMD_REQUEST_COMMAND, CMD_REQUEST_USAGE, DEFAULT_FILENAME, Dump_Notifications(), fclose(), FILE_WRITE, fopen(), GetProgramCommandPrefix, LOG_HELP, LOG_HELPF, LOG_INFO, and LOG_INFOF.

◆ Get_Notif_BroadcastName()

string Get_Notif_BroadcastName ( NOTIF broadcast)

send to one client and their spectators

send ONLY to one client send only to X team and their spectators send only to X team and their spectators, except for Y person and their spectators send to everyone send to everyone except X person and their spectators

Definition at line 258 of file all.qh.

259{
260 switch (broadcast)
261 {
262 case NOTIF_ONE: return "NOTIF_ONE";
263 case NOTIF_ONE_ONLY: return "NOTIF_ONE_ONLY";
264 case NOTIF_ALL_EXCEPT: return "NOTIF_ALL_EXCEPT";
265 case NOTIF_ALL: return "NOTIF_ALL";
266 case NOTIF_TEAM: return "NOTIF_TEAM";
267 case NOTIF_TEAM_EXCEPT: return "NOTIF_TEAM_EXCEPT";
268 }
269 LOG_WARNF("Get_Notif_BroadcastName(%d): Improper broadcast!", broadcast);
270 return "";
271}

References Get_Notif_BroadcastName(), LOG_WARNF, and string().

Referenced by Get_Notif_BroadcastName(), Kill_Notification(), and Send_Notification_Core().

◆ Get_Notif_CvarName()

string Get_Notif_CvarName ( Notification notif)

Definition at line 733 of file all.qh.

734{
735 if (!notif.nent_teamnum)
736 return Get_Notif_Name(notif);
737 return substring(Get_Notif_Name(notif), 0, -strlen(Static_Team_ColorName(notif.nent_teamnum)) - 2);
738}
#define strlen
string substring(string s, float start, float length)
string Static_Team_ColorName(int teamid)
Definition teams.qh:103

References Get_Notif_Name, Static_Team_ColorName(), strlen, and substring().

Referenced by Local_Notification(), and Notification_GetCvars().

◆ Get_Notif_Ent()

Notification Get_Notif_Ent ( MSG net_type,
int net_name )

Definition at line 740 of file all.qh.

741{
742 Notification it = REGISTRY_GET(Notifications, net_name);
743 if (it.nent_type != net_type)
744 {
745 LOG_WARNF("Get_Notif_Ent(%s (%d), %s (%d)): Improper net type '%s'!",
746 Get_Notif_TypeName(net_type), net_type,
747 Get_Notif_Name(it), net_name,
748 Get_Notif_TypeName(it.nent_type)
749 );
750 return NULL;
751 }
752 return it;
753}
entity Notification
always last
Definition all.qh:85
#define REGISTRY_GET(id, i)
Definition registry.qh:62

References Get_Notif_Name, Get_Notif_TypeName(), LOG_WARNF, NULL, and REGISTRY_GET.

Referenced by NET_HANDLE().

◆ Get_Notif_TypeName()

string Get_Notif_TypeName ( MSG net_type)

Definition at line 34 of file all.qh.

35{
36 switch (net_type)
37 {
38 case MSG_ANNCE: return "MSG_ANNCE";
39 case MSG_INFO: return "MSG_INFO";
40 case MSG_CENTER: return "MSG_CENTER";
41 case MSG_MULTI: return "MSG_MULTI";
42 case MSG_CHOICE: return "MSG_CHOICE";
43 case MSG_CENTER_KILL: return "MSG_CENTER_KILL";
44 }
45 LOG_WARNF("Get_Notif_TypeName(%d): Improper net type!", ORDINAL(net_type));
46 return "";
47}
#define ORDINAL(it)
Definition enumclass.qh:25

References LOG_WARNF, and ORDINAL.

Referenced by Create_Notification_Entity_Annce(), Create_Notification_Entity_Choice(), Create_Notification_Entity_InfoCenter(), Create_Notification_Entity_Multi(), Get_Notif_Ent(), Kill_Notification(), Local_Notification(), NET_HANDLE(), Net_Notification_Remove(), and Send_Notification_Core().

◆ hash_replace()

string hash_replace ( string full_msg,
int ent_msg_num,
string ent_msg,
string attacker_name )

replaces # with attacker_name in ent_msg (if not found attacker_name is appended)

Definition at line 394 of file all.qh.

395{
396 int s_ofs = 0;
397 while (--ent_msg_num >= 0)
398 s_ofs += strstrofs(full_msg, "%s", s_ofs);
399 string col = find_last_color_code(substring(full_msg, 0, s_ofs));
400
401 int hash_ofs = strstrofs(ent_msg, "#", 0);
402 if (hash_ofs < 0)
403 ent_msg = strcat(ent_msg, " ", CCR("^BG"), attacker_name, col);
404 else
405 ent_msg = strreplace("#", strcat(CCR("^BG"), attacker_name, col), ent_msg);
406 return ent_msg;
407}
string find_last_color_code(string s)
Definition util.qc:954
#define strstrofs

References CCR(), find_last_color_code(), strcat(), strstrofs, and substring().

◆ Kill_Notification()

void Kill_Notification ( NOTIF broadcast,
entity client,
MSG net_type,
CPID net_name )
Parameters
net_namemessage group, MSG_Null for all cpid group, CPID_Null for all

Definition at line 1464 of file all.qc.

1468{
1469#ifdef NOTIFICATIONS_DEBUG
1470 Debug_Notification(sprintf(
1471 "Kill_Notification(%s, '%s', %s, %d);\n",
1472 Get_Notif_BroadcastName(broadcast),
1473 client.netname,
1474 (net_type ? Get_Notif_TypeName(net_type) : "0"),
1475 net_cpid
1476 ));
1477#endif
1478
1479 string checkargs = Notification_CheckArgs(broadcast, client);
1480 if (checkargs != "")
1481 {
1482 LOG_WARNF("Incorrect usage of Kill_Notification: %s", checkargs);
1483 return;
1484 }
1485
1486 entity net_notif = new_pure(net_kill_notification);
1487 net_notif.nent_broadcast = broadcast;
1488 net_notif.nent_client = client;
1489 net_notif.nent_net_type = MSG_CENTER_KILL;
1490 net_notif.nent_net_name = ORDINAL(net_cpid);
1492
1493 IL_EACH(g_notifications, (it.owner.nent_type == net_type || net_type == MSG_Null) && (it.owner.nent_cpid == net_cpid || net_cpid == CPID_Null),
1494 {
1495 it.nent_net_name = -1;
1496 it.nextthink = time;
1497 });
1498}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define IL_EACH(this, cond, body)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:167
bool Net_Write_Notification(entity this, entity client, int sf)
Definition all.qc:1449
string Notification_CheckArgs(NOTIF broadcast, entity client)
Checks supplied broadcast and target for errors.
Definition all.qc:21
IntrusiveList g_notifications
Definition all.qh:235
float autocvar_notification_lifetime_runtime
Definition all.qh:302
string Get_Notif_BroadcastName(NOTIF broadcast)
send to one client and their spectators
Definition all.qh:258

References autocvar_notification_lifetime_runtime, CPID_Null, entity(), g_notifications, Get_Notif_BroadcastName(), Get_Notif_TypeName(), IL_EACH, LOG_WARNF, Net_LinkEntity(), Net_Write_Notification(), new_pure, Notification_CheckArgs(), and ORDINAL.

Referenced by ClientCommand_selectteam(), ClientCommand_spectate(), CommonCommand_timein(), Destroy_All_Notifications(), instagib_stop_countdown(), kh_EnableTrackingDevice(), kh_StartRound(), MUTATOR_HOOKFUNCTION(), NextLevel(), Remove_Countdown(), SetPlayerTeam(), timeout_handler_think(), toss_nade(), and vehicles_exit().

◆ Local_Notification()

void Local_Notification ( MSG net_type,
Notification net_name,
... )

Definition at line 1176 of file all.qc.

1177{
1178 // retreive entity of this notification
1179 entity notif = net_name;
1180 if (!notif)
1181 {
1182 #ifdef NOTIFICATIONS_DEBUG
1183 Debug_Notification(sprintf(
1184 "Local_Notification(%s, NULL, ...);\n",
1185 Get_Notif_TypeName(net_type)
1186 ));
1187 #endif
1188 LOG_WARNF("Incorrect usage of Local_Notification: %s", "Null notification");
1189 return;
1190 }
1191
1192 // check if the notification is enabled
1193 if (!notif.nent_enabled)
1194 {
1195 #ifdef NOTIFICATIONS_DEBUG
1196 Debug_Notification(sprintf(
1197 "Local_Notification(%s, %s, ...): Entity was disabled...\n",
1198 Get_Notif_TypeName(net_type),
1199 Get_Notif_Name(notif)
1200 ));
1201 #endif
1202 return;
1203 }
1204
1205 string s1 = (notif.nent_stringcount > 0) ? ...(0, string) : "";
1206 string s2 = (notif.nent_stringcount > 1) ? ...(1, string) : "";
1207 string s3 = (notif.nent_stringcount > 2) ? ...(2, string) : "";
1208 string s4 = (notif.nent_stringcount > 3) ? ...(3, string) : "";
1209 float f1 = ((notif.nent_floatcount > 0) ? ...((notif.nent_stringcount + 0), float) : 0);
1210 float f2 = ((notif.nent_floatcount > 1) ? ...((notif.nent_stringcount + 1), float) : 0);
1211 float f3 = ((notif.nent_floatcount > 2) ? ...((notif.nent_stringcount + 2), float) : 0);
1212 float f4 = ((notif.nent_floatcount > 3) ? ...((notif.nent_stringcount + 3), float) : 0);
1213
1214#ifdef NOTIFICATIONS_DEBUG
1215 Debug_Notification(sprintf(
1216 "Local_Notification(%s, %s, %s, %s);\n",
1217 Get_Notif_TypeName(net_type),
1218 Get_Notif_Name(notif),
1219 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1220 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1221 ));
1222#endif
1223
1224 if (notif.nent_stringcount + notif.nent_floatcount != count)
1225 {
1226 backtrace(sprintf(
1227 (
1228 "Arguments mismatch for Local_Notification(%s, %s, ...)! "
1229 "stringcount(%d) + floatcount(%d) != count(%d)\n"
1230 "Check the definition and function call for accuracy...?\n"
1231 ),
1232 Get_Notif_TypeName(net_type),
1233 Get_Notif_Name(notif),
1234 notif.nent_stringcount,
1235 notif.nent_floatcount,
1236 count
1237 ));
1238 return;
1239 }
1240
1241 switch (net_type)
1242 {
1243 case MSG_ANNCE:
1244 {
1245 #ifdef CSQC
1246 Local_Notification_Queue_Add(net_type, notif, notif.nent_queuetime);
1247 #else
1248 backtrace("MSG_ANNCE on server?... Please notify Samual immediately!\n");
1249 #endif
1250 break;
1251 }
1252
1253 case MSG_INFO:
1254 {
1255 print(
1257 notif.nent_string,
1258 notif.nent_args,
1259 s1, s2, s3, s4,
1260 f1, f2, f3, f4)
1261 );
1262 #ifdef CSQC
1263 if (notif.nent_icon != "")
1264 {
1265 if (notif.nent_iconargs != "")
1266 {
1267 string s = Local_Notification_sprintf(
1268 notif.nent_icon, notif.nent_iconargs,
1269 s1, s2, s3, s4, f1, f2, f3, f4);
1270 // remove the trailing newline
1271 notif.nent_icon = strzone(substring(s, 0, -1));
1272 }
1274 notif.nent_icon,
1275 notif.nent_hudargs,
1276 s1, s2, s3, s4,
1277 f1, f2, f3, f4);
1278 }
1279 #endif
1280 break;
1281 }
1282
1283 #ifdef CSQC
1284 case MSG_CENTER:
1287 notif.nent_string,
1288 notif.nent_args,
1289 s1, s2, s3, s4,
1290 f1, f2, f3, f4),
1291 notif.nent_durcnt,
1292 notif.nent_cpid,
1293 f1, f2);
1294 break;
1295 #endif
1296
1297 case MSG_MULTI:
1298 if (notif.nent_msginfo && notif.nent_msginfo.nent_enabled)
1299 {
1301 MSG_INFO,
1302 notif.nent_msginfo,
1303 s1, s2, s3, s4,
1304 f1, f2, f3, f4);
1305 }
1306 #ifdef CSQC
1307 if (notif.nent_msgannce && notif.nent_msgannce.nent_enabled)
1308 Local_Notification(MSG_ANNCE, notif.nent_msgannce); // empty float and string args
1309 if (notif.nent_msgcenter && notif.nent_msgcenter.nent_enabled)
1310 {
1312 MSG_CENTER,
1313 notif.nent_msgcenter,
1314 s1, s2, s3, s4,
1315 f1, f2, f3, f4);
1316 }
1317 #endif
1318 break;
1319
1320 case MSG_CHOICE:
1321 {
1322 entity found_choice = notif.nent_optiona;
1323 if (notif.nent_challow_var && (warmup_stage || notif.nent_challow_var == 2))
1324 switch (cvar(sprintf("notification_%s", Get_Notif_CvarName(notif))))
1325 {
1326 case 1: break;
1327 case 2: found_choice = notif.nent_optionb; break;
1328 default: return; // not enabled anyway
1329 }
1330
1332 found_choice.nent_type,
1333 found_choice,
1334 s1, s2, s3, s4,
1335 f1, f2, f3, f4);
1336 break;
1337 }
1338 }
1339}
var float(entity ent) nudgeoutofsolid_OrFallback
bool warmup_stage
Definition main.qh:120
ERASEABLE string MakeConsoleSafe(string input)
Escape the string to make it safe for consoles.
Definition cvar.qh:24
#define backtrace(msg)
Definition log.qh:96
float cvar(string name)
void print(string text,...)
void Local_Notification_centerprint_Add(string input, string durcnt, CPID cpid, float f1, float f2)
Definition all.qc:1069
void Local_Notification_Core(MSG net_type, Notification net_name, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
glue for networking, forwards to Local_Notification
Definition all.qc:1341
void Local_Notification(MSG net_type, Notification net_name,...count)
Definition all.qc:1176
void Local_Notification_Queue_Add(MSG net_type, entity notif, float queue_time)
Definition all.qc:1131
void Local_Notification_HUD_Notify_Push(string icon, string hudargs, string s1, string s2, string s3, string s4, float f1, float f2, float f3, float f4)
Definition all.qc:1022
string Local_Notification_sprintf(string input, string args, string s1, string s2, string s3, string s4, int f1, float f2, float f3, float f4)
Definition all.qc:922
string Get_Notif_CvarName(Notification notif)
Definition all.qh:733

References backtrace, count, cvar(), entity(), f1, f2, float(), Get_Notif_CvarName(), Get_Notif_Name, Get_Notif_TypeName(), Local_Notification(), Local_Notification_centerprint_Add(), Local_Notification_Core(), Local_Notification_HUD_Notify_Push(), Local_Notification_Queue_Add(), Local_Notification_sprintf(), LOG_WARNF, MakeConsoleSafe(), print(), s1, s2, strzone(), substring(), and warmup_stage.

Referenced by Announcer_Countdown(), Announcer_Gamestart(), Local_Notification(), Local_Notification_Core(), and NET_HANDLE().

◆ Local_Notification_Core()

void Local_Notification_Core ( MSG net_type,
Notification net_name,
string s1,
string s2,
string s3,
string s4,
float f1,
float f2,
float f3,
float f4 )

glue for networking, forwards to Local_Notification

Definition at line 1341 of file all.qc.

1345{
1346 #define VARITEM(args) \
1347 { \
1348 Local_Notification(net_type, net_name, args); \
1349 return; \
1350 }
1351 EIGHT_VARS_TO_VARARGS_VARLIST(net_name.nent_stringcount, net_name.nent_floatcount)
1352 #undef VARITEM
1353 Local_Notification(net_type, net_name); // some notifications don't have any arguments at all
1354}
#define EIGHT_VARS_TO_VARARGS_VARLIST(stringcount, floatcount)
Definition all.qh:91

References EIGHT_VARS_TO_VARARGS_VARLIST, f1, f2, Local_Notification(), s1, and s2.

Referenced by Local_Notification(), NET_HANDLE(), and Send_Notification().

◆ Local_Notification_Queue_Process()

void Local_Notification_Queue_Process ( )

Definition at line 1158 of file all.qc.

1159{
1161 return;
1162
1164
1165 // Shift queue to the left
1167 for (int j = 0; j < notif_queue_length; ++j)
1168 {
1172 }
1173}
float time
void Local_Notification_Queue_Run(MSG net_type, entity notif)
Definition all.qc:1121
entity notif_queue_entity[NOTIF_QUEUE_MAX]
Definition all.qh:384
MSG notif_queue_type[NOTIF_QUEUE_MAX]
Definition all.qh:385
float notif_queue_time[NOTIF_QUEUE_MAX]
Definition all.qh:386
int notif_queue_length
Definition all.qh:389

References Local_Notification_Queue_Run(), notif_queue_entity, notif_queue_length, notif_queue_time, notif_queue_type, and time.

Referenced by HUD_Draw().

◆ notif_arg_frag_ping()

string notif_arg_frag_ping ( bool newline,
float fping )

Definition at line 497 of file all.qh.

498{
499 string s = newline ? "\n" : " ";
500 if (fping < 0)
501 return sprintf(CCR(_("%s(^F1Bot^BG)")), s);
502 else
503 return sprintf(CCR(_("%s(Ping ^F1%d^BG)")), s, fping);
504}

References CCR().

Referenced by notif_arg_frag_stats().

◆ notif_arg_frag_stats()

string notif_arg_frag_stats ( float fhealth,
float farmor,
float fping )

Definition at line 506 of file all.qh.

507{
508 string s = notif_arg_frag_ping(false, fping);
509 if (fhealth > 1)
510 return sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), fhealth, farmor, s);
511 else
512 return sprintf(CCR(_("\n(^F4Dead^BG)%s")), s);
513}
string notif_arg_frag_ping(bool newline, float fping)
Definition all.qh:497

References CCR(), and notif_arg_frag_ping().

◆ notif_arg_item_wepammo()

string notif_arg_item_wepammo ( float f1,
float f2 )

Definition at line 633 of file all.qh.

634{
636 if (wep.ammo_type == RES_NONE)
637 return ""; // doesn't use ammo
638 // example for translators: You dropped the Vortex with 5 cells
639 return sprintf(_(" with %d %s"), f2, strtolower(wep.ammo_type.m_name));
640}
string m_name
Definition resources.qh:31
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:42
Resource ammo_type
M: ammotype : main ammo type.
Definition weapon.qh:56
string strtolower(string s)
Weapons
Definition guide.qh:113

References Weapon::ammo_type, f1, f2, Resource::m_name, REGISTRY_GET, strtolower(), and Weapons.

◆ notif_arg_spree_cen()

string notif_arg_spree_cen ( float spree)

Definition at line 515 of file all.qh.

516{
517 // 0 = off, 1 = target (but only for first victim) and attacker
518 if (autocvar_notification_show_sprees_center)
519 {
520 if (spree > 1)
521 {
522 #define SPREE_ITEM(counta, countb, center, normal, gentle) \
523 case counta: \
524 return strcat(normal_or_gentle(center, sprintf(_("%d score spree!"), spree)), " ");
525
526 switch (spree)
527 {
529 default:
530 if (!autocvar_notification_show_sprees_center_specialonly)
531 return sprintf(
533 _("%d frag spree!"),
534 _("%d score spree!")
535 ), " "),
536 spree);
537 else
538 return ""; // don't show spree information if it isn't an achievement
539 }
540 #undef SPREE_ITEM
541 }
542 else if (spree == -1) // first blood
543 return strcat(normal_or_gentle(_("First blood!"), _("First score!")), " ");
544 else if (spree == -2) // first victim
545 return strcat(normal_or_gentle(_("First victim!"), _("First casualty!")), " ");
546 }
547 return "";
548}
#define KILL_SPREE_LIST
Definition all.qh:487

References KILL_SPREE_LIST, normal_or_gentle, and strcat().

◆ notif_arg_spree_inf()

string notif_arg_spree_inf ( float type,
string input,
string player,
float spree )

Definition at line 551 of file all.qh.

552{
553 switch (type)
554 {
555 case 1: // attacker kill spree
556 {
557 // 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker
558 // this conditional (& 2) is true for 2 and 3
560 {
561 #ifdef CSQC
563 ? ((substring(input, 0, 1) == "\{3}") ? "\n\{3}" : "\n")
564 : "";
565 #else
567 ? "\n"
568 : "";
569 #endif
570
571 if (spree > 1)
572 {
573 #define SPREE_ITEM(counta, countb, center, normal, gentle) \
574 case counta: \
575 return sprintf(CCR(strcat(normal_or_gentle(normal, gentle), " %s^BG")), \
576 player, spree_newline);
577
578 switch (spree)
579 {
581 default:
583 return sprintf(
585 _("%s^K1 has %d frags in a row!"),
586 _("%s^K1 made %d scores in a row!")
587 ), " %s^BG")),
588 player,
589 spree,
590 spree_newline
591 );
592 else
593 return ""; // don't show spree information if it isn't an achievement
594 }
595 #undef SPREE_ITEM
596 }
597 else if (spree == -1) // firstblood
598 return sprintf(
600 _("%s^K1 drew first blood!"),
601 _("%s^K1 got the first score!")
602 ), " %s^BG")),
603 player,
604 spree_newline
605 );
606 }
607 break;
608 }
609
610 case -1: // kill spree ended
611 if (spree > 1 && (autocvar_notification_show_sprees_info & 1))
612 return sprintf(normal_or_gentle(
613 _(", ending their %d frag spree"),
614 _(", ending their %d score spree")
615 ),
616 spree
617 );
618 break;
619
620 case -2: // kill spree lost
621 if (spree > 1 && (autocvar_notification_show_sprees_info & 1))
622 return sprintf(normal_or_gentle(
623 _(", losing their %d frag spree"),
624 _(", losing their %d score spree")
625 ),
626 spree
627 );
628 break;
629 }
630 return "";
631}
int autocvar_notification_show_sprees_info
Definition all.qh:297
bool autocvar_notification_show_sprees_info_specialonly
Definition all.qh:299
bool autocvar_notification_show_sprees_info_newline
Definition all.qh:298

References autocvar_notification_show_sprees_info, autocvar_notification_show_sprees_info_newline, autocvar_notification_show_sprees_info_specialonly, CCR(), KILL_SPREE_LIST, normal_or_gentle, strcat(), and substring().

◆ Notification_GetCvars()

void Notification_GetCvars ( entity this,
entity store )

Used by MSG_CHOICE to build list of choices.

Definition at line 707 of file all.qc.

708{
709 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1),
711 this,
712 store,
715 msg_choice_choices[it.nent_choice_idx],
716 sprintf("notification_%s", Get_Notif_CvarName(it))
717 ));
718}
void GetCvars_handleFloat(entity this, entity store, string thisname, float f,.float field, string name)
int msg_choice_choices[NOTIF_CHOICE_MAX]
set on each player containing MSG_CHOICE choices
Definition all.qh:721
float get_cvars_f
Definition events.qh:346
string get_cvars_s
Definition events.qh:347

References entity(), FOREACH, get_cvars_f, get_cvars_s, Get_Notif_CvarName(), GetCvars_handleFloat(), msg_choice_choices, and NUM_TEAM_1.

Referenced by GetCvars().

◆ REGISTRY_BEGIN()

REGISTRY_BEGIN ( Notifications )

Definition at line 867 of file all.qh.

868{
869 notif_global_error = false;
870}

References notif_global_error.

◆ REGISTRY_END()

REGISTRY_END ( Notifications )

Definition at line 872 of file all.qh.

873{
875 return;
876 // shit happened... stop the loading of the program now if this is unacceptable
878 LOG_FATAL("Notification initialization failed! Read above and fix the errors!");
879 else
880 LOG_SEVERE("Notification initialization failed! Read above and fix the errors!");
881}
#define LOG_SEVERE(...)
Definition log.qh:54
#define LOG_FATAL(...)
Definition log.qh:50
bool autocvar_notification_errors_are_fatal
Definition all.qh:300

References autocvar_notification_errors_are_fatal, LOG_FATAL, LOG_SEVERE, and notif_global_error.

◆ ReplicateVars()

void ReplicateVars ( bool would_destroy)

Definition at line 885 of file all.qh.

886{
887 if (!would_destroy)
888 FOREACH(Notifications, it.nent_type == MSG_CHOICE && (!it.nent_teamnum || it.nent_teamnum == NUM_TEAM_1),
889 {
890 string cvarname = strcat("notification_", Get_Notif_CvarName(it));
891 // NOTE: REPLICATE_SIMPLE can return;
892 REPLICATE_SIMPLE(it.cvar_value, cvarname);
893 });
894}

References FOREACH, and NUM_TEAM_1.

Referenced by CSQC_UpdateView(), GetCvars(), and Shutdown().

◆ Send_Notification()

void Send_Notification ( NOTIF broadcast,
entity client,
MSG net_type,
Notification net_name,
... )

Definition at line 1500 of file all.qc.

1504{
1505 if (broadcast == NOTIF_ONE_ONLY && !IS_REAL_CLIENT(client))
1506 return;
1507 entity notif = net_name;
1508
1509 // this is a macro to avoid defining a string that would never be used normally
1510 // (only if NOTIFICATIONS_DEBUG is on or in a warning message)
1511 #define NOTIF_INFO() sprintf("%s, '%s', %s, %s", \
1512 Get_Notif_BroadcastName(broadcast), \
1513 client.classname, \
1514 Get_Notif_TypeName(net_type), \
1515 Get_Notif_Name(net_name))
1516
1517#ifdef NOTIFICATIONS_DEBUG
1518 Debug_Notification(sprintf("Send_Notification(%s, ...%d);\n", NOTIF_INFO(), count));
1519#endif
1520
1521 if (!notif)
1522 {
1523 LOG_WARN("Send_Notification: Could not find notification entity!");
1524 return;
1525 }
1526
1527 // check supplied broadcast, target, type, and name for errors
1528 string checkargs = Notification_CheckArgs(broadcast, client);
1529 if (!net_name)
1530 checkargs = sprintf("No notification provided! %s", checkargs);
1531 if (checkargs != "")
1532 {
1533 LOG_WARNF("Incorrect usage of Send_Notification: %s", checkargs);
1534 return;
1535 }
1536
1537 string s1 = (0 < notif.nent_stringcount ? ...(0, string) : "");
1538 string s2 = (1 < notif.nent_stringcount ? ...(1, string) : "");
1539 string s3 = (2 < notif.nent_stringcount ? ...(2, string) : "");
1540 string s4 = (3 < notif.nent_stringcount ? ...(3, string) : "");
1541 float f1 = (0 < notif.nent_floatcount ? ...((notif.nent_stringcount + 0), float) : 0);
1542 float f2 = (1 < notif.nent_floatcount ? ...((notif.nent_stringcount + 1), float) : 0);
1543 float f3 = (2 < notif.nent_floatcount ? ...((notif.nent_stringcount + 2), float) : 0);
1544 float f4 = (3 < notif.nent_floatcount ? ...((notif.nent_stringcount + 3), float) : 0);
1545
1546#ifdef NOTIFICATIONS_DEBUG
1547 Debug_Notification(sprintf(
1548 "Send_Notification(%s, %s, %s);\n",
1549 NOTIF_INFO(),
1550 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1551 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1552 ));
1553#endif
1554
1555 if (notif.nent_stringcount + notif.nent_floatcount != count)
1556 {
1557 LOG_WARNF(
1558 "Argument mismatch for Send_Notification(%s, ...)! "
1559 "stringcount(%d) + floatcount(%d) != count(%d)\n"
1560 "Check the definition and function call for accuracy...?\n",
1561 NOTIF_INFO(),
1562 notif.nent_stringcount,
1563 notif.nent_floatcount,
1564 count
1565 );
1566 return;
1567 }
1568
1570 && (broadcast == NOTIF_ALL || broadcast == NOTIF_ALL_EXCEPT)
1571 && !(net_type == MSG_ANNCE || net_type == MSG_CENTER))
1573 net_type, net_name,
1574 s1, s2, s3, s4,
1575 f1, f2, f3, f4);
1576
1577 if (net_type == MSG_CHOICE)
1578 {
1579 // THIS GETS TRICKY... now we have to cycle through each possible player (checking broadcast)
1580 // and then do an individual NOTIF_ONE_ONLY recursive call for each one depending on their option...
1581 // It's slow, but it's better than the alternatives:
1582 // 1. Constantly networking all info and letting client decide
1583 // 2. Manually handling each separate call on per-usage basis (See old CTF usage of verbose)
1584 entity found_choice;
1585
1586 #define RECURSE_FROM_CHOICE(ent, action) MACRO_BEGIN \
1587 if (notif.nent_challow_var && (warmup_stage || notif.nent_challow_var == 2)) \
1588 switch (CS_CVAR(ent).msg_choice_choices[net_name.nent_choice_idx]) \
1589 { \
1590 case 1: found_choice = notif.nent_optiona; break; \
1591 case 2: found_choice = notif.nent_optionb; break; \
1592 default: action; \
1593 } \
1594 else \
1595 found_choice = notif.nent_optiona; \
1596 Send_Notification_Core( \
1597 NOTIF_ONE_ONLY, \
1598 ent, \
1599 found_choice.nent_type, \
1600 found_choice, \
1601 s1, s2, s3, s4, \
1602 f1, f2, f3, f4); \
1603 MACRO_END
1604
1605 switch (broadcast)
1606 {
1607 case NOTIF_ONE_ONLY: // we can potentially save processing power with this broadcast method
1608 if (IS_REAL_CLIENT(client))
1609 RECURSE_FROM_CHOICE(client, return);
1610 break;
1611 default:
1612 {
1613 FOREACH_CLIENT(Notification_ShouldSend(broadcast, it, client),
1614 RECURSE_FROM_CHOICE(it, continue));
1615 break;
1616 }
1617 }
1618 }
1619 else
1620 {
1621 entity net_notif = new_pure(net_notification);
1622 IL_PUSH(g_notifications, net_notif);
1623 net_notif.owner = notif;
1624 net_notif.nent_broadcast = broadcast;
1625 net_notif.nent_client = client;
1626 net_notif.nent_net_type = net_type;
1627 net_notif.nent_net_name = notif.m_id;
1628 net_notif.nent_stringcount = notif.nent_stringcount;
1629 net_notif.nent_floatcount = notif.nent_floatcount;
1630
1631 for (int i = 0; i < net_notif.nent_stringcount; ++i)
1632 net_notif.nent_strings[i] = strzone(...(i, string));
1633 for (int i = 0; i < net_notif.nent_floatcount; ++i)
1634 net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float);
1635
1637 net_notif.nextthink = (time > autocvar_notification_lifetime_mapload)
1640
1641 Net_LinkEntity(net_notif, false, 0, Net_Write_Notification);
1642 }
1643 #undef NOTIF_INFO
1644}
string() ReadString_Raw
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define LOG_WARN(...)
Definition log.qh:58
void Net_Notification_Remove(entity this)
Definition all.qc:1433
bool Notification_ShouldSend(NOTIF broadcast, entity to_client, entity other_client)
Definition all.qc:62
#define RECURSE_FROM_CHOICE(ent, action)
#define NOTIF_INFO()
float autocvar_notification_lifetime_mapload
Definition all.qh:303
#define setthink(e, f)
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52

References autocvar_notification_lifetime_mapload, autocvar_notification_lifetime_runtime, autocvar_sv_dedicated, count, entity(), f1, f2, float(), FOREACH_CLIENT, g_notifications, IL_PUSH(), IS_REAL_CLIENT, Local_Notification_Core(), LOG_WARN, LOG_WARNF, MakeConsoleSafe(), Net_LinkEntity(), Net_Notification_Remove(), Net_Write_Notification(), new_pure, NOTIF_INFO, Notification_CheckArgs(), Notification_ShouldSend(), RECURSE_FROM_CHOICE, s1, s2, setthink, string(), strzone(), and time.

Referenced by bot_spawn(), buff_Touch(), CA_CheckWinner(), ca_LastPlayerForTeam_Notify(), CheckPlayerJump(), CheckRules_World(), ClientCommand_minigame(), ClientCommand_selectteam(), ClientCommand_spectate(), ClientConnect(), ClientDisconnect(), ClientKill_Now_TeamChange(), ClientKill_TeamChange(), CommonCommand_timeout(), counter_use(), ctf_CaptureRecord(), ctf_CaptureShield_Touch(), ctf_CaptureShield_Update(), ctf_CheckFlagReturn(), ctf_CheckStalemate(), ctf_FlagcarrierWaypoints(), ctf_Handle_Capture(), ctf_Handle_Drop(), ctf_Handle_Pickup(), ctf_Handle_Retrieve(), ctf_Handle_Return(), Domination_CheckWinner(), dompoint_captured(), door_check_keys(), fireBullet_falloff(), FireRailgunBullet(), frag_centermessage_override(), freezetag_CheckWinner(), freezetag_LastPlayerForTeam_Notify(), GameCommand_cointoss(), GameCommand_lockteams(), GameCommand_unlockteams(), InitiateOvertime(), instagib_ammocheck(), instagib_countdown(), Invasion_CheckWinner(), invite_minigame(), Item_GiveTo(), joinAllowed(), ka_DropEvent(), ka_TouchEvent(), kh_FinishRound(), kh_Key_Collect(), kh_Key_DropAll(), kh_Key_DropOne(), kh_Key_Spawn(), kh_Key_Think(), kh_LoserTeam(), kh_StartRound(), kh_WaitForPlayers(), kh_WinnerTeam(), KillIndicator_Think(), lms_AddPlayer(), lms_RemovePlayer(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), nades_GiveBonus(), nexball_setstatus(), NIX_GiveCurrentWeapon(), nJoinAllowed(), Obituary(), ObserverOrSpectatorThink(), ons_CaptureShield_Touch(), ons_ControlPoint_Icon_BuildThink(), ons_ControlPoint_Icon_Damage(), ons_ControlPoint_Touch(), ons_GeneratorDamage(), ons_GeneratorThink(), Onslaught_CheckWinner(), onslaught_generator_touch(), player_powerups(), PlayerFrame(), Portal_TeleportPlayer(), PutObserverInServer(), PutPlayerInServer(), race_AbandonRaceCheck(), race_SendTime(), race_setTime(), ReadyCount(), ReadyRestart_force(), Remove_Countdown(), ResetBall(), Say(), Send_Notification_Core(), SetPlayerTeam(), ShowRespawnCountdown(), superspec_hello(), Surv_CheckWinner(), surv_LastPlayerForTeam_Notify(), Surv_RoundStart(), SV_ParseClientCommand(), TeamBalance_RemoveExcessPlayers(), timeout_handler_think(), tka_DropEvent(), tka_TouchEvent(), trigger_keylock_touch(), vehicles_enter(), VoteAccept(), VoteCommand_abstain(), VoteCommand_call(), VoteCommand_no(), VoteCommand_yes(), VoteReject(), VoteTimeout(), W_Devastator_Explode(), W_Electro_Explode(), W_MineLayer_Attack(), W_MineLayer_Explode(), W_Mortar_Grenade_Explode(), W_Mortar_Grenade_Explode2(), W_OverkillNex_Attack(), W_Porto_Fail(), W_Porto_Touch(), W_RocketMinsta_Laser_Explode(), W_ThrowWeapon(), W_Vaporizer_Attack(), W_Vortex_Attack(), weapon_prepareattack_checkammo(), WinningCondition_Assault(), and WinningCondition_Scores().

◆ Send_Notification_Core()

void Send_Notification_Core ( NOTIF broadcast,
entity client,
MSG net_type,
Notification net_name,
string s1,
string s2,
string s3,
string s4,
float f1,
float f2,
float f3,
float f4 )

Definition at line 1646 of file all.qc.

1651{
1652#ifdef NOTIFICATIONS_DEBUG
1653 entity notif = net_name;
1654 Debug_Notification(sprintf(
1655 "Send_Notification_Core(%s, %s, %s);\n",
1656 sprintf(
1657 "%s, '%s', %s, %s",
1658 Get_Notif_BroadcastName(broadcast),
1659 client.classname,
1660 Get_Notif_TypeName(net_type),
1661 Get_Notif_Name(notif)
1662 ),
1663 MakeConsoleSafe(sprintf("'%s^7', '%s^7', '%s^7', '%s^7'", s1, s2, s3, s4)),
1664 sprintf("%d, %d, %d, %d", f1, f2, f3, f4)
1665 ));
1666#endif
1667
1668 #define VARITEM(args) \
1669 { \
1670 Send_Notification(broadcast, client, net_type, net_name, args); \
1671 return; \
1672 }
1673 EIGHT_VARS_TO_VARARGS_VARLIST(net_name.nent_stringcount, net_name.nent_floatcount)
1674 #undef VARITEM
1675 Send_Notification(broadcast, client, net_type, net_name); // some notifications don't have any arguments at all
1676}
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1500

References EIGHT_VARS_TO_VARARGS_VARLIST, entity(), f1, f2, Get_Notif_BroadcastName(), Get_Notif_Name, Get_Notif_TypeName(), MakeConsoleSafe(), s1, s2, and Send_Notification().

Referenced by Obituary_SpecialDeath(), and Obituary_WeaponDeath().

◆ STATIC_INIT() [1/2]

STATIC_INIT ( g_notifications )

Definition at line 236 of file all.qh.

237{
239}
#define IL_NEW()

References g_notifications, and IL_NEW.

◆ STATIC_INIT() [2/2]

STATIC_INIT ( Notifications )

Definition at line 710 of file all.qh.

711{
712 FOREACH(Notifications, true, it.m_id = i);
713}

References FOREACH, and STATIC_INIT.

◆ STATIC_INIT_LATE()

STATIC_INIT_LATE ( Notif_Choices )

Definition at line 726 of file all.qh.

727{
729 LOG_FATALF("Too many MSG_CHOICE notifications (%d), hit NOTIF_CHOICE_MAX (%d) limit",
731}
#define LOG_FATALF(...)
Definition log.qh:51
const int NOTIF_CHOICE_MAX
Definition all.qh:716

References LOG_FATALF, nent_choice_count, NOTIF_CHOICE_MAX, and STATIC_INIT_LATE.

Variable Documentation

◆ ARG_CS

const int ARG_CS = 4

unique result to CSQC

Definition at line 417 of file all.qh.

◆ ARG_CS_SV

const int ARG_CS_SV = 3

enabled on CSQC and SVQC

Definition at line 416 of file all.qh.

◆ ARG_CS_SV_DC

const int ARG_CS_SV_DC = 2

enabled on CSQC, SVQC, and durcnt centerprint

Definition at line 415 of file all.qh.

◆ ARG_CS_SV_HA

const int ARG_CS_SV_HA = 1

enabled on CSQC, SVQC, and Hudargs

Definition at line 414 of file all.qh.

◆ ARG_DC

const int ARG_DC = 6

unique result to durcnt/centerprint

Definition at line 419 of file all.qh.

◆ arg_slot

◆ ARG_SV

const int ARG_SV = 5

unique result to SVQC

Definition at line 418 of file all.qh.

◆ autocvar_notification_errors_are_fatal

bool autocvar_notification_errors_are_fatal = true

Definition at line 300 of file all.qh.

Referenced by REGISTRY_END().

◆ autocvar_notification_lifetime_mapload

float autocvar_notification_lifetime_mapload = 10

Definition at line 303 of file all.qh.

Referenced by Send_Notification().

◆ autocvar_notification_lifetime_runtime

float autocvar_notification_lifetime_runtime = 0.5

Definition at line 302 of file all.qh.

Referenced by Kill_Notification(), and Send_Notification().

◆ autocvar_notification_server_allows_location

bool autocvar_notification_server_allows_location = true

Definition at line 308 of file all.qh.

Referenced by Obituary().

◆ autocvar_notification_show_location

bool autocvar_notification_show_location = false

Definition at line 294 of file all.qh.

◆ autocvar_notification_show_location_string

string autocvar_notification_show_location_string = ""

Definition at line 295 of file all.qh.

◆ autocvar_notification_show_sprees

bool autocvar_notification_show_sprees = true

Definition at line 296 of file all.qh.

◆ autocvar_notification_show_sprees_info

int autocvar_notification_show_sprees_info = 3

Definition at line 297 of file all.qh.

Referenced by notif_arg_spree_inf().

◆ autocvar_notification_show_sprees_info_newline

bool autocvar_notification_show_sprees_info_newline = true

Definition at line 298 of file all.qh.

Referenced by notif_arg_spree_inf().

◆ autocvar_notification_show_sprees_info_specialonly

bool autocvar_notification_show_sprees_info_specialonly = true

Definition at line 299 of file all.qh.

Referenced by notif_arg_spree_inf().

◆ BOLD_OPERATOR

const string BOLD_OPERATOR = "^BOLD"

Definition at line 13 of file all.qh.

Referenced by HUD_CenterPrint().

◆ cvar_value

int cvar_value

Definition at line 884 of file all.qh.

◆ g_notifications

IntrusiveList g_notifications

Definition at line 235 of file all.qh.

Referenced by Kill_Notification(), Send_Notification(), and STATIC_INIT().

◆ msg_choice_choices

int msg_choice_choices[NOTIF_CHOICE_MAX]

set on each player containing MSG_CHOICE choices

Definition at line 721 of file all.qh.

Referenced by Notification_GetCvars().

◆ nent_args

string nent_args

Definition at line 663 of file all.qh.

◆ nent_broadcast

NOTIF nent_broadcast

Definition at line 683 of file all.qh.

Referenced by Net_Write_Notification().

◆ nent_challow_def

int nent_challow_def

Definition at line 676 of file all.qh.

◆ nent_challow_var

int nent_challow_var

Definition at line 677 of file all.qh.

◆ nent_channel

int nent_channel

Definition at line 656 of file all.qh.

◆ nent_choice_count

int nent_choice_count = 0

Definition at line 719 of file all.qh.

Referenced by STATIC_INIT_LATE().

◆ nent_choice_idx

int nent_choice_idx

Definition at line 720 of file all.qh.

◆ nent_client

entity nent_client

Definition at line 685 of file all.qh.

Referenced by Net_Write_Notification().

◆ nent_cpid

CPID nent_cpid

Definition at line 666 of file all.qh.

◆ nent_default

int nent_default

Definition at line 648 of file all.qh.

◆ nent_durcnt

string nent_durcnt

Definition at line 667 of file all.qh.

◆ nent_enabled

bool nent_enabled

Definition at line 649 of file all.qh.

◆ nent_floatcount

int nent_floatcount

Definition at line 652 of file all.qh.

Referenced by Net_Write_Notification().

◆ nent_floats

float nent_floats[4]

Definition at line 689 of file all.qh.

Referenced by Net_Write_Notification().

◆ nent_hudargs

string nent_hudargs

Definition at line 664 of file all.qh.

◆ nent_icon

string nent_icon

Definition at line 665 of file all.qh.

◆ nent_iconargs

string nent_iconargs

Definition at line 794 of file all.qh.

◆ nent_msgannce

entity nent_msgannce

Definition at line 671 of file all.qh.

◆ nent_msgcenter

entity nent_msgcenter

Definition at line 673 of file all.qh.

◆ nent_msginfo

entity nent_msginfo

Definition at line 672 of file all.qh.

◆ nent_net_name

int nent_net_name

Definition at line 687 of file all.qh.

Referenced by Net_Notification_Remove(), and Net_Write_Notification().

◆ nent_net_type

MSG nent_net_type

Definition at line 686 of file all.qh.

Referenced by Net_Notification_Remove(), and Net_Write_Notification().

◆ nent_optiona

entity nent_optiona

Definition at line 678 of file all.qh.

◆ nent_optionb

entity nent_optionb

Definition at line 679 of file all.qh.

◆ nent_position

float nent_position

Definition at line 659 of file all.qh.

◆ nent_queuetime

float nent_queuetime

Definition at line 660 of file all.qh.

◆ nent_snd

string nent_snd

Definition at line 657 of file all.qh.

◆ nent_string

string nent_string

Definition at line 668 of file all.qh.

◆ nent_stringcount

int nent_stringcount

Definition at line 651 of file all.qh.

Referenced by Net_Notification_Remove(), and Net_Write_Notification().

◆ nent_strings

string nent_strings[4]

Definition at line 688 of file all.qh.

Referenced by Net_Notification_Remove(), and Net_Write_Notification().

◆ nent_teamnum

int nent_teamnum

Definition at line 653 of file all.qh.

◆ nent_type

MSG nent_type

Definition at line 650 of file all.qh.

◆ nent_vol

float nent_vol

Definition at line 658 of file all.qh.

◆ NOTIF_CHOICE_MAX

const int NOTIF_CHOICE_MAX = 20

Definition at line 716 of file all.qh.

Referenced by STATIC_INIT_LATE().

◆ notif_error

◆ notif_global_error

bool notif_global_error

Definition at line 724 of file all.qh.

Referenced by Create_Notification_Entity(), REGISTRY_BEGIN(), and REGISTRY_END().

◆ NOTIF_MAX_ARGS

const int NOTIF_MAX_ARGS = 7

Definition at line 378 of file all.qh.

Referenced by Local_Notification_sprintf(), and Process_Notif_Args().

◆ NOTIF_MAX_DURCNT

const int NOTIF_MAX_DURCNT = 2

Definition at line 380 of file all.qh.

Referenced by Local_Notification_centerprint_Add(), and Process_Notif_Args().

◆ NOTIF_MAX_HUDARGS

const int NOTIF_MAX_HUDARGS = 2

Definition at line 379 of file all.qh.

Referenced by Local_Notification_HUD_Notify_Push(), and Process_Notif_Args().

◆ notif_queue_entity

entity notif_queue_entity[NOTIF_QUEUE_MAX]

Definition at line 384 of file all.qh.

Referenced by Local_Notification_Queue_Add(), and Local_Notification_Queue_Process().

◆ notif_queue_length

int notif_queue_length

Definition at line 389 of file all.qh.

Referenced by Local_Notification_Queue_Add(), and Local_Notification_Queue_Process().

◆ NOTIF_QUEUE_MAX

const int NOTIF_QUEUE_MAX = 10

Definition at line 383 of file all.qh.

Referenced by Local_Notification_Queue_Add().

◆ notif_queue_next_time

float notif_queue_next_time

Definition at line 388 of file all.qh.

Referenced by Local_Notification_Queue_Add().

◆ notif_queue_time

float notif_queue_time[NOTIF_QUEUE_MAX]

Definition at line 386 of file all.qh.

Referenced by Local_Notification_Queue_Add(), and Local_Notification_Queue_Process().

◆ notif_queue_type

MSG notif_queue_type[NOTIF_QUEUE_MAX]

Definition at line 385 of file all.qh.

Referenced by Local_Notification_Queue_Add(), and Local_Notification_Queue_Process().

◆ prev_soundfile

string prev_soundfile

Definition at line 230 of file all.qh.

Referenced by Local_Notification_sound().

◆ prev_soundtime

float prev_soundtime

Definition at line 231 of file all.qh.

Referenced by Local_Notification_sound().