float centername,
float channel,
string snd,
- float volume,
+ float vol,
float position,
float strnum,
float flnum,
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(snd != "")
+ {
+ 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;
+ #endif
+ }
else
{
// Set MSG_INFO and MSG_CENTER string/float counts
}
#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)
{
case MSG_ANNCE:
{
- print("blah blah\n");
+ #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;
}
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)
{