float channel,
string snd,
float vol,
- float position)
+ float position,
+ float queuetime)
{
// Set MSG_ANNCE information and handle precaching
#ifdef CSQC
notif.nent_snd = strzone(snd);
notif.nent_vol = vol;
notif.nent_position = position;
+ notif.nent_queuetime = queuetime;
}
}
else
#endif
centerprint_Add(ORDINAL(cpid), input, stof(arg_slot[0]), stof(arg_slot[1]));
}
+
+void Local_Notification_Queue_Run(MSG net_type, entity notif)
+{
+ switch (net_type)
+ {
+ case MSG_ANNCE:
+ {
+ Local_Notification_sound(notif.nent_channel, notif.nent_snd, notif.nent_vol, notif.nent_position);
+ break;
+ }
+ }
+}
+
+void Local_Notification_Queue_Add(MSG net_type, entity notif, float queue_time)
+{
+ // Guess length if required
+ if(queue_time == 0)
+ queue_time = soundlength(AnnouncerFilename(notif.nent_snd));
+
+ if(queue_time == -1 || time > notif_queue_next_time) {
+ // Run immediately
+ Local_Notification_Queue_Run(net_type, notif);
+ notif_queue_next_time = time + queue_time;
+ } else {
+ // Put in queue
+ if(notif_queue_length >= NOTIF_QUEUE_MAX) return;
+
+ notif_queue_type[notif_queue_length] = net_type;
+ notif_queue_entity[notif_queue_length] = notif;
+ notif_queue_time[notif_queue_length] = notif_queue_next_time;
+
+ notif_queue_next_time += queue_time;
+ ++notif_queue_length;
+ }
+}
+
+void Local_Notification_Queue_Process()
+{
+ if(!notif_queue_length || notif_queue_time[0] > time)
+ return;
+
+ Local_Notification_Queue_Run(notif_queue_type[0], notif_queue_entity[0]);
+
+ // Shift queue to the left
+ --notif_queue_length;
+ for (int j = 0; j < notif_queue_length; ++j) {
+ notif_queue_type[j] = notif_queue_type[j+1];
+ notif_queue_entity[j] = notif_queue_entity[j+1];
+ notif_queue_time[j] = notif_queue_time[j+1];
+ }
+}
+
#endif
void Local_Notification(MSG net_type, Notification net_name, ...count)
case MSG_ANNCE:
{
#ifdef CSQC
- Local_Notification_sound(notif.nent_channel, notif.nent_snd, notif.nent_vol, notif.nent_position);
+ Local_Notification_Queue_Add(net_type, notif, notif.nent_queuetime);
#else
backtrace("MSG_ANNCE on server?... Please notify Samual immediately!\n");
#endif
found_choice.nent_floatcount,
s1, s2, s3, s4,
f1, f2, f3, f4);
+ break;
}
}
}