]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/notifications.qc
Move that shizniz to the .qh file
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / notifications.qc
index fbed3e58987fdb4e70e307edd6eee0bef1bb3c4d..45587607e6d911938817c8f1305b232b7dcdd5a5 100644 (file)
@@ -373,7 +373,7 @@ void Create_Notification_Entity(
                case MSG_ANNCE:
                {
                        typestring = "MSG_ANNCE";
-                       msg_info_notifs[nameid - 1] = notif;
+                       msg_annce_notifs[nameid - 1] = notif;
                        notif.classname = "msg_annce_notification";
                        break;
                }
@@ -471,7 +471,7 @@ void Create_Notification_Entity(
                #ifdef CSQC
                if(snd != "")
                {
-                       precache_sound(sprintf("announcer/%s/%s", autocvar_cl_announcer, 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;
@@ -836,6 +836,62 @@ string Local_Notification_sprintf(
 }
 
 #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)
@@ -982,7 +1038,16 @@ void Local_Notification(float net_type, float net_name, ...count)
        {
                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;
                }
                
@@ -1037,6 +1102,16 @@ void Local_Notification(float net_type, float net_name, ...count)
                                        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)
                        {