case NOTIF_ALL: // send to everyone
{
return TRUE;
- break;
}
case NOTIF_ALL_EXCEPT: // send to everyone except X person and their spectators
{
) { return TRUE; }
break;
}
- default: { return FALSE; }
}
+ return FALSE;
}
#endif
{
// THIS GETS TRICKY... now we have to cycle through each possible player (checking broadcast)
// and then do an individual NOTIF_ONE_ONLY recursive call for each one depending on their option...
- // It's slow, but it's better than the alternatives
+ // It's slow, but it's better than the alternatives:
+ // 1. Constantly networking all info and letting client decide
+ // 2. Manually handling each separate call on per-usage basis (See old CTF usage of verbose)
entity found_choice;
-
+
+ #define RECURSE_FROM_CHOICE(ent,action) \
+ switch(ent.msg_choice_choices[net_name]) \
+ { \
+ case 1: found_choice = notif.nent_choicea; \
+ case 2: found_choice = notif.nent_choiceb; \
+ default: action; \
+ } \
+ Send_Notification_WOVA( \
+ NOTIF_ONE_ONLY, \
+ ent, \
+ found_choice.nent_net_type, \
+ found_choice.nent_net_name, \
+ s1, s2, s3, s4, \
+ f1, f2, f3, f4);
+
switch(broadcast)
{
case NOTIF_ONE_ONLY: // we can potentially save processing power with this broadcast method
{
if(IS_REAL_CLIENT(client))
- {
- switch(client.msg_choice_choices[net_name])
- {
- case 1: found_choice = notif.nent_choicea;
- case 2: found_choice = notif.nent_choiceb;
- default: return; // nothing to do here, client disables this
- }
- Send_Notification_WOVA(
- NOTIF_ONE_ONLY,
- client,
- found_choice.nent_net_type,
- found_choice.nent_net_name,
- s1, s2, s3, s4,
- f1, f2, f3, f4);
- }
+ { RECURSE_FROM_CHOICE(client, return) }
break;
}
-
default:
{
entity to;
FOR_EACH_REALCLIENT(to)
- {
- if(Notification_ShouldSend(broadcast, to, client))
- {
- switch(client.msg_choice_choices[net_name])
- {
- case 1: found_choice = notif.nent_choicea;
- case 2: found_choice = notif.nent_choiceb;
- default: continue; // nothing to do here, client disables this
- }
- Send_Notification_WOVA(
- NOTIF_ONE_ONLY,
- to,
- found_choice.nent_net_type,
- found_choice.nent_net_name,
- s1, s2, s3, s4,
- f1, f2, f3, f4);
- }
- }
+ { if(Notification_ShouldSend(broadcast, to, client))
+ { RECURSE_FROM_CHOICE(to, continue) } }
break;
}
}
// ====================================
#define NOTIF_FIRST 1
-#define NOTIF_MAX 1024 // limit of recursive functions with ACCUMULATE_FUNCTION
+
+// notification limits
+#define NOTIF_ANNCE_MAX 64
+#define NOTIF_INFO_MAX 512
+#define NOTIF_CENTER_MAX 512
+#define NOTIF_MULTI_MAX 256
+#define NOTIF_CHOICE_MAX 64
+#define NOTIF_CPID_MAX 128
// error detection
float notif_error;
float notif_global_error;
// notification entities
-entity msg_annce_notifs[NOTIF_MAX];
-entity msg_info_notifs[NOTIF_MAX];
-entity msg_center_notifs[NOTIF_MAX];
-entity msg_multi_notifs[NOTIF_MAX];
-entity msg_choice_notifs[NOTIF_MAX];
+entity msg_annce_notifs[NOTIF_ANNCE_MAX];
+entity msg_info_notifs[NOTIF_INFO_MAX];
+entity msg_center_notifs[NOTIF_CENTER_MAX];
+entity msg_multi_notifs[NOTIF_MULTI_MAX];
+entity msg_choice_notifs[NOTIF_CHOICE_MAX];
// notification counts
float NOTIF_ANNCE_COUNT;
.float nent_cpid;
.string nent_durcnt;
.string nent_string;
-
-.float nent_msgchtype;
-.string nent_msgopa;
-.string nent_msgopb;
+.entity nent_choicea;
+.entity nent_choiceb;
// networked notification values
.float nent_broadcast;
.string nent_strings[4];
.float nent_floats[4];
+// other notification properties
+.float msg_choice_choices[NOTIF_CHOICE_MAX]; // set on each player containing MSG_CHOICE choices
+
#define MSG_ANNCE_NOTIF(default,name,channel,sound,volume,position) \
NOTIF_ADD_AUTOCVAR(name, default) \
float name; \
void RegisterNotification_##name() \
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_ANNCE_COUNT) \
- CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_ANNCE_COUNT, "notifications") \
+ CHECK_MAX_COUNT(name, NOTIF_ANNCE_MAX, NOTIF_ANNCE_COUNT, "MSG_ANNCE") \
Create_Notification_Entity( \
default, /* var_default */ \
autocvar_notification_##name, /* var_cvar */ \
void RegisterNotification_##name() \
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_INFO_COUNT) \
- CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_INFO_COUNT, "notifications") \
+ CHECK_MAX_COUNT(name, NOTIF_INFO_MAX, NOTIF_INFO_COUNT, "MSG_INFO") \
Create_Notification_Entity( \
default, /* var_default */ \
autocvar_notification_##name, /* var_cvar */ \
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CENTER_COUNT) \
SET_FIELD_COUNT(cpid, NOTIF_FIRST, NOTIF_CPID_COUNT) \
- CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_CENTER_COUNT, "notifications") \
+ CHECK_MAX_COUNT(name, NOTIF_CENTER_MAX, NOTIF_CENTER_COUNT, "MSG_CENTER") \
Create_Notification_Entity( \
default, /* var_default */ \
autocvar_notification_##name, /* var_cvar */ \
void RegisterNotification_##name() \
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_MULTI_COUNT) \
- CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_MULTI_COUNT, "notifications") \
+ CHECK_MAX_COUNT(name, NOTIF_MULTI_MAX, NOTIF_MULTI_COUNT, "MSG_MULTI") \
Create_Notification_Entity( \
default, /* var_default */ \
autocvar_notification_##name, /* var_cvar */ \
void RegisterNotification_##name() \
{ \
SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CHOICE_COUNT) \
- CHECK_MAX_COUNT(name, NOTIF_MAX, NOTIF_CHOICE_COUNT, "notifications") \
+ CHECK_MAX_COUNT(name, NOTIF_CHOICE_MAX, NOTIF_CHOICE_COUNT, "MSG_CHOICE") \
Create_Notification_Entity( \
default, /* var_default */ \
autocvar_notification_##name, /* var_cvar */ \