#if defined(CSQC)
+ #include "../client/announcer.qh"
#elif defined(MENUQC)
#elif defined(SVQC)
- #include "../dpdefs/progsdefs.qh"
- #include "../dpdefs/dpextensions.qh"
#include "constants.qh"
#include "teams.qh"
#include "../server/autocvars.qh"
#include "../server/constants.qh"
#include "../server/defs.qh"
#include "notifications.qh"
- #include "../server/mutators/mutators_include.qh"
+ #include "../server/mutators/all.qh"
#endif
// ================================================
{
// check supplied type and name for errors
string checkargs = "";
- #define CHECKARG_TYPENAME(type) case MSG_##type##: \
+ #define CHECKARG_TYPENAME(type) case MSG_##type: \
{ if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
{ checkargs = sprintf("Improper name: %d!", net_name); } break; }
switch(net_type)
remove(notif);
}
-void Destroy_All_Notifications(void)
+void Destroy_All_Notifications()
{
entity notif;
int i;
- #define DESTROY_LOOP(type,count) do { \
+ #define DESTROY_LOOP(type,count) MACRO_BEGIN { \
for(i = 1; i <= count; ++i) \
{ \
notif = Get_Notif_Ent(type, i); \
if (!notif) { backtrace("Destroy_All_Notifications(): Missing notification entity!\n"); return; } \
Destroy_Notification_Entity(notif); \
} \
- } while(0)
+ } MACRO_END
// kill all networked notifications and centerprints
#ifdef SVQC
// Global Entity Setup
// =====================
entity notif = spawn();
+ make_pure(notif);
switch(typeId)
{
case MSG_ANNCE:
{
if(notif.nent_enabled)
{
- precache_sound(sprintf("announcer/%s/%s.wav", autocvar_cl_announcer, snd));
+ precache_sound(sprintf("announcer/%s/%s.wav", AnnouncerOption(), snd));
notif.nent_channel = channel;
notif.nent_snd = strzone(snd);
notif.nent_vol = vol;
// ======================
// Process Notif String
// ======================
- #define SET_NOTIF_STRING(string,stringname) do { \
+ #define SET_NOTIF_STRING(string,stringname) MACRO_BEGIN { \
notif.nent_string = strzone(CCR( \
Process_Notif_Line( \
typeId, \
stringname \
)) \
); \
- } while(0)
+ } MACRO_END
if(GENTLE)
{
// used by MSG_CHOICE to build list of choices
#ifdef SVQC
-void Notification_GetCvars(void)
+void Notification_GetCvars()
{
for(int i = 0; i <= NOTIF_CHOICE_COUNT; ++i)
{
soundchannel,
sprintf(
"announcer/%s/%s.wav",
- autocvar_cl_announcer,
+ AnnouncerOption(),
soundfile
),
soundvolume,
));
#endif
- sound(
+ _sound(
world,
soundchannel,
sprintf(
"announcer/%s/%s.wav",
- autocvar_cl_announcer,
+ AnnouncerOption(),
soundfile
),
soundvolume,
soundchannel,
sprintf(
"announcer/%s/%s.wav",
- autocvar_cl_announcer,
+ AnnouncerOption(),
soundfile
),
soundvolume,
case MSG_INFO:
{
- LOG_INFO(
+ print(
Local_Notification_sprintf(
notif.nent_string,
notif.nent_args,
// Notification Networking
// =========================
+REGISTER_NET_LINKED(ENT_CLIENT_NOTIFICATION)
+
#ifdef CSQC
-void Read_Notification(float is_new)
+NET_HANDLE(ENT_CLIENT_NOTIFICATION, bool is_new)
{
int net_type = ReadByte();
int net_name = ReadShort();
+ return = true;
entity notif;
#ifdef SVQC
void Net_Notification_Remove()
-{
+{SELFPARAM();
if (!self) { backtrace(sprintf("Net_Notification_Remove() at %f: Missing self!?\n", time)); return; }
#ifdef NOTIFICATIONS_DEBUG
remove(self);
}
-float Net_Write_Notification(entity client, int sf)
+bool Net_Write_Notification(entity this, entity client, int sf)
{
if(Notification_ShouldSend(self.nent_broadcast, client, self.nent_client))
{
- WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
+ WriteHeader(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
WriteByte(MSG_ENTITY, self.nent_net_type);
WriteShort(MSG_ENTITY, self.nent_net_name);
for(int i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); }
if(killed_cpid != NO_CPID)
{
- net_notif = spawn();
- net_notif.classname = "net_kill_notification";
+ net_notif = new(net_kill_notification);
+ make_pure(net_notif);
net_notif.nent_broadcast = broadcast;
net_notif.nent_client = client;
net_notif.nent_net_type = MSG_CENTER_CPID;
// 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) do { \
+ #define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN { \
if(notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) \
{ \
switch(ent.msg_choice_choices[net_name - 1]) \
found_choice.nent_floatcount, \
s1, s2, s3, s4, \
f1, f2, f3, f4); \
- } while(0)
+ } MACRO_END
switch(broadcast)
{
}
else
{
- entity net_notif = spawn();
+ entity net_notif = new(net_notification);
+ make_pure(net_notif);
net_notif.owner = notif;
- net_notif.classname = "net_notification";
net_notif.nent_broadcast = broadcast;
net_notif.nent_client = client;
net_notif.nent_net_type = net_type;