{
switch(net_type)
{
+ case MSG_ANNCE: return "MSG_ANNCE";
case MSG_INFO: return "MSG_INFO";
case MSG_CENTER: return "MSG_CENTER";
case MSG_CENTER_CPID: return "MSG_CENTER_CPID";
{
switch(net_type)
{
+ case MSG_ANNCE: return msg_annce_notifs[net_name - 1];
case MSG_INFO: return msg_info_notifs[net_name - 1];
case MSG_CENTER: return msg_center_notifs[net_name - 1];
case MSG_MULTI: return msg_multi_notifs[net_name - 1];
{ checkargs = sprintf("Improper name: %d!", net_name); } break; }
switch(net_type)
{
+ CHECKARG_TYPENAME(ANNCE)
CHECKARG_TYPENAME(INFO)
CHECKARG_TYPENAME(CENTER)
CHECKARG_TYPENAME(MULTI)
void Destroy_Notification_Entity(entity notif)
{
if(notif.nent_name != "") { strunzone(notif.nent_name); }
+ if(notif.nent_snd != "") { strunzone(notif.nent_snd); }
if(notif.nent_args != "") { strunzone(notif.nent_args); }
if(notif.nent_hudargs != "") { strunzone(notif.nent_hudargs); }
if(notif.nent_icon != "") { strunzone(notif.nent_icon); }
#endif
// kill all real notification entities
+ DESTROY_LOOP(MSG_ANNCE, NOTIF_ANNCE_COUNT)
DESTROY_LOOP(MSG_INFO, NOTIF_INFO_COUNT)
DESTROY_LOOP(MSG_CENTER, NOTIF_CENTER_COUNT)
DESTROY_LOOP(MSG_MULTI, NOTIF_MULTI_COUNT)
float typeid,
float nameid,
string namestring,
+ float anncename,
float infoname,
float centername,
+ float channel,
+ string snd,
+ float vol,
+ float position,
float strnum,
float flnum,
string args,
string typestring = "";
switch(typeid)
{
+ case MSG_ANNCE:
+ {
+ typestring = "MSG_ANNCE";
+ msg_annce_notifs[nameid - 1] = notif;
+ notif.classname = "msg_annce_notification";
+ break;
+ }
case MSG_INFO:
{
typestring = "MSG_INFO";
if(msg_is_multi)
{
// Set MSG_MULTI string/float counts
- if((infoname == NO_MSG) && (centername == NO_MSG))
+ if((anncename == NO_MSG) && (infoname == NO_MSG) && (centername == NO_MSG))
{
print(sprintf(
strcat(
}
else
{
+ // announcements don't actually need any arguments, so lets not even count them.
+ if(anncename != NO_MSG) { notif.nent_msgannce = msg_annce_notifs[anncename - 1]; }
+
float infoname_stringcount = 0, infoname_floatcount = 0;
float centername_stringcount = 0, centername_floatcount = 0;
notif.nent_floatcount = max(infoname_floatcount, centername_floatcount);
}
}
+ else if(typeid == MSG_ANNCE)
+ {
+ // Set MSG_ANNCE information and handle precaching
+ #ifdef CSQC
+ if not(GENTLE && (var_cvar == 1))
+ {
+ if(snd != "")
+ {
+ if(notif.nent_enabled)
+ {
+ precache_sound(sprintf("announcer/%s/%s.wav", autocvar_cl_announcer, snd));
+ notif.nent_channel = channel;
+ notif.nent_snd = strzone(snd);
+ notif.nent_vol = vol;
+ notif.nent_position = position;
+ }
+ }
+ else
+ {
+ print(sprintf(
+ strcat(
+ "^1NOTIFICATION WITH NO SOUND: ",
+ "^7net_type = %s, net_name = %s.\n"
+ ),
+ typestring,
+ namestring
+ ));
+ notif_error = TRUE;
+ }
+ }
+ else { notif.nent_enabled = FALSE; }
+ #else
+ notif.nent_enabled = FALSE;
+ #endif
+ }
else
{
// Set MSG_INFO and MSG_CENTER string/float counts
// This is not necessary, and does not matter if they vary between config versions,
// it is just a semi-helpful tool for those who want to manually change their user settings.
+ NOTIF_WRITE(sprintf("\n// MSG_ANNCE notifications (count = %d):\n", NOTIF_ANNCE_COUNT));
+ for(i = 1; i <= NOTIF_ANNCE_COUNT; ++i)
+ {
+ e = Get_Notif_Ent(MSG_ANNCE, i);
+ if not(e) { backtrace("Dump_Notifications(): Missing notification entity!\n"); return; }
+ NOTIF_WRITE_ENTITY(e.nent_name, e.nent_default, "Notification control cvar: 0 = disabled, 1 = enabled if gentle mode is off, 2 = always enabled)");
+ }
+
NOTIF_WRITE(sprintf("\n// MSG_INFO notifications (count = %d):\n", NOTIF_INFO_COUNT));
for(i = 1; i <= NOTIF_INFO_COUNT; ++i)
{
NOTIF_WRITE(sprintf(
strcat(
"\n// Notification counts (total = %d): ",
- "MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d\n"
+ "MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d\n"
),
(
+ NOTIF_ANNCE_COUNT +
NOTIF_INFO_COUNT +
NOTIF_CENTER_COUNT +
NOTIF_MULTI_COUNT
- ),
+ ),
+ NOTIF_ANNCE_COUNT,
NOTIF_INFO_COUNT,
NOTIF_CENTER_COUNT,
NOTIF_MULTI_COUNT
}
#ifdef CSQC
+ void Local_Notification_sound(
+ float soundchannel, string soundfile,
+ float soundvolume, float soundposition)
+ {
+ if((soundfile != prev_soundfile) || (time >= (prev_soundtime + autocvar_cl_announcer_antispam)))
+ {
+ #ifdef NOTIFICATIONS_DEBUG
+ dprint(sprintf(
+ "Local_Notification_sound(world, %f, '%s', %f, %f);\n",
+ soundchannel,
+ sprintf(
+ "announcer/%s/%s.wav",
+ autocvar_cl_announcer,
+ soundfile
+ ),
+ soundvolume,
+ soundposition
+ ));
+ #endif
+
+ sound(
+ world,
+ soundchannel,
+ sprintf(
+ "announcer/%s/%s.wav",
+ autocvar_cl_announcer,
+ soundfile
+ ),
+ soundvolume,
+ soundposition
+ );
+
+ if(prev_soundfile) { strunzone(prev_soundfile); }
+ prev_soundfile = strzone(soundfile);
+ prev_soundtime = time;
+ }
+ else
+ {
+ #ifdef NOTIFICATIONS_DEBUG
+ dprint(sprintf(
+ "Local_Notification_sound(world, %f, '%s', %f, %f) ^1BLOCKED BY ANTISPAM:^7 prevsnd: '%s', time/prevtime: %f, limit: %f\n",
+ soundchannel,
+ sprintf(
+ "announcer/%s/%s.wav",
+ autocvar_cl_announcer,
+ soundfile
+ ),
+ soundvolume,
+ soundposition,
+ prev_soundfile,
+ (time - prev_soundtime),
+ autocvar_cl_announcer_antispam
+ ));
+ #endif
+ }
+ }
void Local_Notification_HUD_Notify_Push(
string icon, string hudargs,
string s1, string s2, string s3, string s4)
switch(net_type)
{
+ case MSG_ANNCE:
+ {
+ #ifdef CSQC
+ Local_Notification_sound(
+ notif.nent_channel,
+ notif.nent_snd,
+ notif.nent_vol,
+ notif.nent_position
+ );
+ #else
+ backtrace("MSG_ANNCE on server?... Please notify Samual immediately!\n");
+ #endif
+ break;
+ }
+
case MSG_INFO:
{
print(
f1, f2, f3, f4);
}
#ifdef CSQC
+ if(notif.nent_msgannce)
+ if(notif.nent_msgannce.nent_enabled)
+ {
+ Local_Notification_WOVA(
+ MSG_ANNCE,
+ notif.nent_msgannce.nent_id,
+ 0, 0,
+ "", "", "", "",
+ 0, 0, 0, 0);
+ }
if(notif.nent_msgcenter)
if(notif.nent_msgcenter.nent_enabled)
{
"Kill_Notification(%d, '%s', %s, %d);\n",
broadcast,
client.netname,
- Get_Notif_TypeName(net_type),
+ (net_type ? Get_Notif_TypeName(net_type) : "0"),
net_name
));
#endif
{
if(net_type)
{
- if(killed_cpid != NO_CPID)
+ if((killed_cpid != NO_CPID) && (notif.nent_net_type == MSG_CENTER))
{
if(notif.owner.nent_cpid == killed_cpid)
{
Net_LinkEntity(net_notif, FALSE, 0, Net_Write_Notification);
- if(server_is_dedicated && (broadcast == NOTIF_ALL || broadcast == NOTIF_ALL_EXCEPT) && (net_type != MSG_CENTER))
+ if(server_is_dedicated && (broadcast == NOTIF_ALL || broadcast == NOTIF_ALL_EXCEPT) && (net_type != MSG_ANNCE) && (net_type != MSG_CENTER))
{
Local_Notification_WOVA(
net_type, net_name,