return args;
}
-void Create_Notification_Entity(
+void Create_Notification_Entity(entity notif,
float var_default,
float var_cvar,
int typeId,
int nameid,
- string namestring,
- int strnum,
- int flnum,
- /* MSG_ANNCE */
- float channel,
- string snd,
- float vol,
- float position,
- /* MSG_INFO & MSG_CENTER */
- string args,
- string hudargs,
- string icon,
- float cpid,
- string durcnt,
- string normal,
- string gentle,
- /* MSG_MULTI */
- int anncename,
- int infoname,
- int centername,
- /* MSG_CHOICE */
- float challow_def,
- float challow_var,
- int chtype,
- int optiona,
- int optionb)
+ string namestring)
{
// =====================
// Global Entity Setup
// =====================
- entity notif = new_pure(notification);
- switch(typeId)
- {
- case MSG_ANNCE:
- {
- msg_annce_notifs[nameid - 1] = notif;
- notif.classname = "msg_annce_notification";
- break;
- }
- case MSG_INFO:
- {
- msg_info_notifs[nameid - 1] = notif;
- notif.classname = "msg_info_notification";
- break;
- }
- case MSG_CENTER:
- {
- msg_center_notifs[nameid - 1] = notif;
- notif.classname = "msg_center_notification";
- break;
- }
- case MSG_MULTI:
- {
- msg_multi_notifs[nameid - 1] = notif;
- notif.classname = "msg_multi_notification";
- break;
- }
- case MSG_CHOICE:
- {
- msg_choice_notifs[nameid - 1] = notif;
- notif.classname = "msg_choice_notification";
- break;
- }
-
- default:
- {
- error(sprintf(
- strcat(
- "^1NOTIFICATION WITH IMPROPER TYPE: ",
- "^7net_type = %d, net_name = %s.\n"
- ),
- typeId,
- namestring
- ));
- return; // It's not possible to recover from this one
- }
- }
notif.nent_default = var_default;
notif.nent_enabled = (var_cvar >= 1);
notif.nent_type = typeId;
notif.nent_id = nameid;
notif.nent_name = strzone(namestring);
- string typestring = Get_Notif_TypeName(typeId);
-
// Other pre-notif-setup requisites
notif_error = false;
- // ====================
- // Notification Setup
- // ====================
switch(typeId)
{
- case MSG_ANNCE:
+ case MSG_ANNCE:
+ case MSG_INFO:
+ case MSG_CENTER:
+ case MSG_MULTI:
+ case MSG_CHOICE:
+ break;
+ default:
+ LOG_INFOF(
+ strcat(
+ "^1NOTIFICATION WITH IMPROPER TYPE: ",
+ "^7net_type = %d, net_name = %s.\n"
+ ),
+ typeId,
+ namestring
+ );
+ notif_error = true;
+ break;
+ }
+
+ // now check to see if any errors happened
+ if(notif_error)
+ {
+ notif.nent_enabled = false; // disable the notification so it can't cause trouble
+ notif_global_error = true; // throw the red flag that an error happened on init
+ }
+}
+
+void Create_Notification_Entity_Annce(entity notif,
+ float var_cvar,
+ string namestring,
+ /* MSG_ANNCE */
+ float channel,
+ string snd,
+ float vol,
+ float position)
{
// Set MSG_ANNCE information and handle precaching
#ifdef CSQC
+ int typeId = MSG_ANNCE;
if (!(GENTLE && (var_cvar == 1)))
{
if(snd != "")
}
else
{
+ string typestring = Get_Notif_TypeName(typeId);
LOG_INFOF(
strcat(
"^1NOTIFICATION WITH NO SOUND: ",
notif.nent_enabled = false;
#endif
- break;
}
- case MSG_INFO:
- case MSG_CENTER:
+void Create_Notification_Entity_InfoCenter(entity notif,
+ float var_cvar,
+ string namestring,
+ int strnum,
+ int flnum,
+ /* MSG_INFO & MSG_CENTER */
+ string args,
+ string hudargs,
+ string icon,
+ float cpid,
+ string durcnt,
+ string normal,
+ string gentle)
{
+ int typeId = notif.nent_type;
// Set MSG_INFO and MSG_CENTER string/float counts
notif.nent_stringcount = strnum;
notif.nent_floatcount = flnum;
#else
float should_process_args = true;
#endif
-
+ string typestring = Get_Notif_TypeName(typeId);
if(should_process_args)
{
// ========================
notif_error = true;
}
}
-
- break;
}
- case MSG_MULTI:
+void Create_Notification_Entity_Multi(entity notif,
+ float var_cvar,
+ string namestring,
+ /* MSG_MULTI */
+ int anncename,
+ int infoname,
+ int centername)
{
+ int typeId = MSG_MULTI;
// Set MSG_MULTI string/float counts
if((anncename == NO_MSG) && (infoname == NO_MSG) && (centername == NO_MSG))
{
+ string typestring = Get_Notif_TypeName(typeId);
LOG_INFOF(
strcat(
"^1NOTIFICATION WITH NO SUBCALLS: ",
notif.nent_stringcount = max(infoname_stringcount, centername_stringcount);
notif.nent_floatcount = max(infoname_floatcount, centername_floatcount);
}
-
- break;
}
- case MSG_CHOICE:
+void Create_Notification_Entity_Choice(entity notif,
+ float var_cvar,
+ string namestring,
+ /* MSG_CHOICE */
+ float challow_def,
+ float challow_var,
+ int chtype,
+ int optiona,
+ int optionb)
{
+ int typeId = MSG_CHOICE;
if((chtype == NO_MSG) || (optiona == NO_MSG) || (optionb == NO_MSG))
{
+ string typestring = Get_Notif_TypeName(typeId);
LOG_INFOF(
strcat(
"^1NOTIFICATION IS MISSING CHOICE PARAMS: ",
));
#endif*/
}
- break;
- }
-
- default:
- {
- LOG_INFOF(
- strcat(
- "^1NOTIFICATION WITH IMPROPER TYPE: ",
- "^7net_type = %d, net_name = %s.\n"
- ),
- typeId,
- namestring
- );
- notif_error = true;
- break;
}
- }
-
- // now check to see if any errors happened
- if(notif_error)
- {
- notif.nent_enabled = false; // disable the notification so it can't cause trouble
- notif_global_error = true; // throw the red flag that an error happened on init
- }
-}
// ===============
VARITEM(4, 4, XPD(s1, s2, s3, s4, f1, f2, f3, f4))
void Destroy_All_Notifications();
-void Create_Notification_Entity(
+void Create_Notification_Entity(entity notif,
float var_default,
float var_cvar,
float typeId,
float nameid,
- string namestring,
- int strnum,
- int flnum,
- /* MSG_ANNCE */
- float channel,
- string snd,
- float vol,
- float position,
- /* MSG_INFO & MSG_CENTER */
- string args,
- string hudargs,
- string icon,
- float cpid,
- string durcnt,
- string normal,
- string gentle,
- /* MSG_MULTI */
- float anncename,
- float infoname,
- float centername,
- /* MSG_CHOICE */
- float challow_def,
- float challow_var,
- float chtype,
- float optiona,
- float optionb);
+ string namestring);
+void Create_Notification_Entity_Annce(entity notif,
+ float var_cvar,
+ string namestring,
+ /* MSG_ANNCE */
+ float channel,
+ string snd,
+ float vol,
+ float position);
+
+void Create_Notification_Entity_InfoCenter(entity notif,
+ float var_cvar,
+ string namestring,
+ int strnum,
+ int flnum,
+ /* MSG_INFO & MSG_CENTER */
+ string args,
+ string hudargs,
+ string icon,
+ float cpid,
+ string durcnt,
+ string normal,
+ string gentle);
+
+void Create_Notification_Entity_Multi(entity notif,
+ float var_cvar,
+ string namestring,
+ /* MSG_MULTI */
+ int anncename,
+ int infoname,
+ int centername);
+
+void Create_Notification_Entity_Choice(entity notif,
+ float var_cvar,
+ string namestring,
+ /* MSG_CHOICE */
+ float challow_def,
+ float challow_var,
+ int chtype,
+ int optiona,
+ int optionb);
void Dump_Notifications(float fh, float alsoprint);
// other notification properties
.float msg_choice_choices[NOTIF_CHOICE_MAX]; // set on each player containing MSG_CHOICE choices
+#define ACVNN(name) autocvar_notification_##name
+
// initialization error detection
float notif_error;
float notif_global_error;
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_ANNCE_COUNT) \
CHECK_MAX_COUNT(name, NOTIF_ANNCE_MAX, NOTIF_ANNCE_COUNT, "MSG_ANNCE") \
- Create_Notification_Entity( \
- /* COMMON ======================== */ \
- default, /* var_default */ \
- ACVNN(name), /* var_cvar */ \
- MSG_ANNCE, /* typeId */ \
- name, /* nameid */ \
- strtoupper(#name), /* namestring */ \
- NO_MSG, /* strnum */ \
- NO_MSG, /* flnum */ \
- /* ANNCE ============= */ \
+ entity this = msg_annce_notifs[name - 1] = new_pure(msg_annce_notification); \
+ Create_Notification_Entity (this, default, ACVNN(name), MSG_ANNCE, name, strtoupper(#name)); \
+ Create_Notification_Entity_Annce(this, ACVNN(name), strtoupper(#name), \
channel, /* channel */ \
sound, /* snd */ \
volume, /* vol */ \
- position, /* position */ \
- /* INFO & CENTER == */ \
- "", /* args */ \
- "", /* hudargs */ \
- "", /* icon */ \
- NO_MSG, /* cpid */ \
- "", /* durcnt */ \
- "", /* normal */ \
- "", /* gentle */ \
- /* MULTI ============= */ \
- NO_MSG, /* anncename */ \
- NO_MSG, /* infoname */ \
- NO_MSG, /* centername */ \
- /* MSG_CHOICE ========== */ \
- NO_MSG, /* challow_def */ \
- NO_MSG, /* challow_var */ \
- NO_MSG, /* chtype */ \
- NO_MSG, /* optiona */ \
- NO_MSG); /* optionb */ \
+ position); /* position */ \
} \
ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_INFO_COUNT) \
CHECK_MAX_COUNT(name, NOTIF_INFO_MAX, NOTIF_INFO_COUNT, "MSG_INFO") \
- Create_Notification_Entity( \
- /* COMMON ======================== */ \
- default, /* var_default */ \
- ACVNN(name), /* var_cvar */ \
- MSG_INFO, /* typeId */ \
- name, /* nameid */ \
- strtoupper(#name), /* namestring */ \
- strnum, /* strnum */ \
- flnum, /* flnum */ \
- /* ANNCE =========== */ \
- NO_MSG, /* channel */ \
- "", /* snd */ \
- NO_MSG, /* vol */ \
- NO_MSG, /* position */ \
- /* INFO & CENTER === */ \
+ entity this = msg_info_notifs[name - 1] = new_pure(msg_info_notification); \
+ Create_Notification_Entity (this, default, ACVNN(name), MSG_INFO, name, strtoupper(#name)); \
+ Create_Notification_Entity_InfoCenter(this, ACVNN(name), strtoupper(#name), strnum, flnum, \
args, /* args */ \
hudargs, /* hudargs */ \
icon, /* icon */ \
NO_MSG, /* cpid */ \
"", /* durcnt */ \
normal, /* normal */ \
- gentle, /* gentle */ \
- /* MULTI ============= */ \
- NO_MSG, /* anncename */ \
- NO_MSG, /* infoname */ \
- NO_MSG, /* centername */ \
- /* CHOICE ============== */ \
- NO_MSG, /* challow_def */ \
- NO_MSG, /* challow_var */ \
- NO_MSG, /* chtype */ \
- NO_MSG, /* optiona */ \
- NO_MSG); /* optionb */ \
+ gentle); /* gentle */ \
} \
ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_INFO_COUNT) \
CHECK_MAX_COUNT(name, NOTIF_INFO_MAX, NOTIF_INFO_COUNT, "MSG_INFO") \
- Create_Notification_Entity( \
- /* COMMON ======================== */ \
- default, /* var_default */ \
- ACVNN(name), /* var_cvar */ \
- MSG_INFO, /* typeid */ \
- name, /* nameid */ \
- strtoupper(#name), /* namestring */ \
- strnum, /* strnum */ \
- flnum, /* flnum */ \
- /* ANNCE =========== */ \
- NO_MSG, /* channel */ \
- "", /* snd */ \
- NO_MSG, /* vol */ \
- NO_MSG, /* position */ \
- /* INFO & CENTER === */ \
+ entity this = msg_info_notifs[name - 1] = new_pure(msg_info_notification); \
+ Create_Notification_Entity (this, default, ACVNN(name), MSG_INFO, name, strtoupper(#name)); \
+ Create_Notification_Entity_InfoCenter(this, ACVNN(name), strtoupper(#name), strnum, flnum, \
args, /* args */ \
hudargs, /* hudargs */ \
icon, /* icon */ \
NO_MSG, /* cpid */ \
"", /* durcnt */ \
normal, /* normal */ \
- gentle, /* gentle */ \
- /* MULTI ============= */ \
- NO_MSG, /* anncename */ \
- NO_MSG, /* infoname */ \
- NO_MSG, /* centername */ \
- /* CHOICE ============== */ \
- NO_MSG, /* challow_def */ \
- NO_MSG, /* challow_var */ \
- NO_MSG, /* chtype */ \
- NO_MSG, /* optiona */ \
- NO_MSG); /* optionb */ \
+ gentle); /* gentle */ \
msg_info_notifs[name - 1].nent_iconargs = iconargs; \
} \
ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CENTER_COUNT) \
CHECK_MAX_COUNT(name, NOTIF_CENTER_MAX, NOTIF_CENTER_COUNT, "MSG_CENTER") \
- Create_Notification_Entity( \
- /* COMMON ======================== */ \
- default, /* var_default */ \
- ACVNN(name), /* var_cvar */ \
- MSG_CENTER, /* typeId */ \
- name, /* nameid */ \
- strtoupper(#name), /* namestring */ \
- strnum, /* strnum */ \
- flnum, /* flnum */ \
- /* ANNCE =========== */ \
- NO_MSG, /* channel */ \
- "", /* snd */ \
- NO_MSG, /* vol */ \
- NO_MSG, /* position */ \
- /* INFO & CENTER == */ \
+ entity this = msg_center_notifs[name - 1] = new_pure(msg_center_notification); \
+ Create_Notification_Entity (this, default, ACVNN(name), MSG_CENTER, name, strtoupper(#name)); \
+ Create_Notification_Entity_InfoCenter(this, ACVNN(name), strtoupper(#name), strnum, flnum, \
args, /* args */ \
"", /* hudargs */ \
"", /* icon */ \
cpid, /* cpid */ \
durcnt, /* durcnt */ \
normal, /* normal */ \
- gentle, /* gentle */ \
- /* MULTI ============= */ \
- NO_MSG, /* anncename */ \
- NO_MSG, /* infoname */ \
- NO_MSG, /* centername */ \
- /* CHOICE ============== */ \
- NO_MSG, /* challow_def */ \
- NO_MSG, /* challow_var */ \
- NO_MSG, /* chtype */ \
- NO_MSG, /* optiona */ \
- NO_MSG); /* optionb */ \
+ gentle); /* gentle */ \
} \
ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_MULTI_COUNT) \
CHECK_MAX_COUNT(name, NOTIF_MULTI_MAX, NOTIF_MULTI_COUNT, "MSG_MULTI") \
- Create_Notification_Entity( \
- /* COMMON ======================== */ \
- default, /* var_default */ \
- ACVNN(name), /* var_cvar */ \
- MSG_MULTI, /* typeId */ \
- name, /* nameid */ \
- strtoupper(#name), /* namestring */ \
- NO_MSG, /* strnum */ \
- NO_MSG, /* flnum */ \
- /* ANNCE =========== */ \
- NO_MSG, /* channel */ \
- "", /* snd */ \
- NO_MSG, /* vol */ \
- NO_MSG, /* position */ \
- /* INFO & CENTER == */ \
- "", /* args */ \
- "", /* hudargs */ \
- "", /* icon */ \
- NO_MSG, /* cpid */ \
- "", /* durcnt */ \
- "", /* normal */ \
- "", /* gentle */ \
- /* MULTI ================= */ \
+ entity this = msg_multi_notifs[name - 1] = new_pure(msg_multi_notification); \
+ Create_Notification_Entity (this, default, ACVNN(name), MSG_MULTI, name, strtoupper(#name)); \
+ Create_Notification_Entity_Multi(this, ACVNN(name), strtoupper(#name), \
anncename, /* anncename */ \
infoname, /* infoname */ \
- centername, /* centername */ \
- /* CHOICE ============== */ \
- NO_MSG, /* challow_def */ \
- NO_MSG, /* challow_var */ \
- NO_MSG, /* chtype */ \
- NO_MSG, /* optiona */ \
- NO_MSG); /* optionb */ \
+ centername); /* centername */ \
} \
ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
-#define ACVNN(name) autocvar_notification_##name
-
#define MSG_CHOICE_NOTIF(name, default, challow, chtype, optiona, optionb) \
MSG_CHOICE_NOTIF_(CHOICE_##name, default, challow, chtype, optiona, optionb)
#define MSG_CHOICE_NOTIF_(name, default, challow, chtype, optiona, optionb) \
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CHOICE_COUNT) \
CHECK_MAX_COUNT(name, NOTIF_CHOICE_MAX, NOTIF_CHOICE_COUNT, "MSG_CHOICE") \
- Create_Notification_Entity( \
- /* COMMON ======================== */ \
- default, /* var_default */ \
- ACVNN(name), /* var_cvar */ \
- MSG_CHOICE, /* typeId */ \
- name, /* nameid */ \
- strtoupper(#name), /* namestring */ \
- NO_MSG, /* strnum */ \
- NO_MSG, /* flnum */ \
- /* ANNCE =========== */ \
- NO_MSG, /* channel */ \
- "", /* snd */ \
- NO_MSG, /* vol */ \
- NO_MSG, /* position */ \
- /* INFO & CENTER == */ \
- "", /* args */ \
- "", /* hudargs */ \
- "", /* icon */ \
- NO_MSG, /* cpid */ \
- "", /* durcnt */ \
- "", /* normal */ \
- "", /* gentle */ \
- /* MULTI ============= */ \
- NO_MSG, /* anncename */ \
- NO_MSG, /* infoname */ \
- NO_MSG, /* centername */ \
- /* CHOICE ============================================= */ \
+ entity this = msg_choice_notifs[name - 1] = new_pure(msg_choice_notification); \
+ Create_Notification_Entity (this, default, ACVNN(name), MSG_CHOICE, name, strtoupper(#name)); \
+ Create_Notification_Entity_Choice(this, ACVNN(name), strtoupper(#name), \
challow, /* challow_def */ \
autocvar_notification_##name##_ALLOWED, /* challow_var */ \
chtype, /* chtype */ \