// or any time you change default values or add/edit/remove a special cvar.
#define NOTIF_VERSION 1
+#define NOTIF_FIRST 1
+#define NOTIF_MAX 1024 // limit of recursive functions with ACCUMULATE_FUNCTION
+
#define NO_MSG -12345
// ping of bots defined for extra frag message notification information
VARITEM(3, 4, XPD(s1, s2, s3, f1, f2, f3, f4)) \
VARITEM(4, 4, XPD(s1, s2, s3, s4, f1, f2, f3, f4))
-#define ARG_BOTH 1
-#define ARG_TRIPLE 2 // also included with hudargs
-#define ARG_CSQC 3
-#define ARG_SVQC 4
-
-#define NOTIF_MAX_ARGS 7
-#define NOTIF_MAX_HUDARGS 2
-
-#define NOTIF_HIT_MAX(count,funcname) if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; }
-#define NOTIF_HIT_UNKNOWN(token,funcname) default: { backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); break; }
-
-#define NOTIF_ARGUMENT_LIST \
- ARG_CASE(ARG_TRIPLE, "s1", s1) \
- ARG_CASE(ARG_TRIPLE, "s2", s2) \
- ARG_CASE(ARG_TRIPLE, "s3", s3) \
- ARG_CASE(ARG_TRIPLE, "s4", s4) \
- ARG_CASE(ARG_BOTH, "f1", ftos(f1)) \
- ARG_CASE(ARG_BOTH, "f2", ftos(f2)) \
- ARG_CASE(ARG_BOTH, "f3", ftos(f3)) \
- ARG_CASE(ARG_BOTH, "f4", ftos(f4)) \
- ARG_CASE(ARG_BOTH, "f1p2dec", ftos_decimals(f1/100, 2)) \
- ARG_CASE(ARG_BOTH, "f2p2dec", ftos_decimals(f2/100, 2)) \
- ARG_CASE(ARG_CSQC, "pass_key", ((((tmp_s = getcommandkey("pass", "+use")) != "pass") && !(strstrofs(tmp_s, "not bound", 0) >= 0)) ? sprintf(CCR(_(" ^F1(Press %s)")), tmp_s) : "")) \
- ARG_CASE(ARG_CSQC, "frag_ping", ((f2 != BOT_PING) ? sprintf(CCR(_("\n(Ping ^2%d^BG)")), f2) : "")) \
- ARG_CASE(ARG_CSQC, "frag_stats", sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), f1, f2, ((f3 != BOT_PING) ? sprintf(CCR(_(" (Ping ^2%d^BG)")), f3) : ""))) \
- /*ARG_CASE(ARG_CSQC, "frag_pos", ((Should_Print_Score_Pos(f1)) ? sprintf("\n^BG%s", Read_Score_Pos(f1)) : ""))*/ \
- ARG_CASE(ARG_CSQC, "spree_cen", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : "")) \
- ARG_CASE(ARG_CSQC, "spree_inf", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : "")) \
- ARG_CASE(ARG_CSQC, "spree_end", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", ending their %d frag spree"), _(", ending their %d score spree")), f1) : "")) \
- ARG_CASE(ARG_CSQC, "spree_lost", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", losing their %d frag spree"), _(", losing their %d score spree")), f1) : "")) \
- ARG_CASE(ARG_CSQC, "death_team", Team_ColoredFullName(f1 - 1)) \
- ARG_CASE(ARG_CSQC, "weapon_name", ftos(f1)) \
- ARG_CASE(ARG_SVQC, "spree_inf", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : "")) \
- ARG_CASE(ARG_SVQC, "spree_end", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", ending their %d frag spree"), _(", ending their %d score spree")), f1) : "")) \
- ARG_CASE(ARG_SVQC, "spree_lost", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", losing their %d frag spree"), _(", losing their %d score spree")), f1) : "")) \
- ARG_CASE(ARG_SVQC, "death_team", Team_ColoredFullName(f1)) \
- ARG_CASE(ARG_SVQC, "weapon_name", ftos(f1))
-
-entity Get_Notif_Ent(float net_type, float net_name);
-
-string arg_slot[NOTIF_MAX_ARGS];
-
void Dump_Notifications(float fh, float alsoprint);
void Local_Notification(float net_type, float net_name, ...count);
MSG_INFO_NOTIF(1, INFO_DEATH_SELF_TURRET_MLRS, 1, 1, "s1 spree_end", "s1", "notify_death", _("^BG%s^K1 got turned into smoldering gibs by an MLRS turret%s\n"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_SELF_TURRET_PLASMA, 1, 1, "s1 spree_end", "s1", "notify_death", _("^BG%s^K1 got served some superheated plasma from a turret%s\n"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_SELF_TURRET_PHASER, 1, 1, "s1 spree_end", "s1", "notify_death", _("^BG%s^K1 was phased out by a turret%s\n"), "") \
- MSG_INFO_NOTIF(1, INFO_DEATH_SELF_TURRET_TESLA, 1, 1, "s1 spree_end", "s1", "notify_death", _("^BG%s^K1 was electrocuted by a Tesla turret%s\n"), "") \
+ MSG_INFO_NOTIF(1, INFO_DEATH_SELF_TURRET_TESLA, 1, 1, "s1 spree_end", "s1", "notify_death", _("^BG%s^K1 was electrocuted by a Tesla turret%s\n"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_TELEFRAG, 2, 1, "s1 s2 spree_end", "s2 s1", "notify_telefrag", _("^BG%s^K1 was telefragged by ^BG%s^K1%s\n"), _("^F1%s^K1 tried to occupy ^BG%s^K1's teleport destination space\n")) \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_FALL, 2, 1, "s1 s2 spree_end", "s2 s1", "notify_fall", _("^BG%s^K1 was grounded by ^BG%s^K1%s\n"), "") \
MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_DROWN, 2, 1, "s1 s2 spree_end", "s2 s1", "notify_water", _("^BG%s^K1 was drowned by ^BG%s^K1%s\n"), "") \
MSG_INFO_NOTIF(1, INFO_QUIT_KICK_IDLING, 1, 0, "s1", "s1", "", _("^BG%s^F3 was kicked for idling\n"), "") \
MSG_INFO_NOTIF(1, INFO_QUIT_KICK_SPECTATING, 0, 0, "", "", "", _("^F2You were kicked from the server because you are a spectator and spectators aren't allowed at the moment.\n"), "") \
MSG_INFO_NOTIF(1, INFO_QUIT_SPECTATE, 1, 0, "s1", "s1", "", _("^BG%s^F3 is now spectating\n"), "") \
- MSG_INFO_NOTIF(1, INFO_RACE_FAIL, 2, 0, "s1 s2", "s1", "race_newfail", "", "") \
- MSG_INFO_NOTIF(1, INFO_RACE_NEW_RECORD, 2, 0, "s1 s2", "s1", "race_newrecordserver", "", "") \
- MSG_INFO_NOTIF(1, INFO_RACE_NEW_TIME, 2, 0, "s1 s2", "s1", "race_newtime", "", "") \
- MSG_INFO_NOTIF(1, INFO_RACE_NEW_RANK, 2, 0, "s1 s2", "s1", "race_newrankyellow", "", "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_FAIL, 2, 0, "s1 s2", "s1", "race_newfail", "TODO\n", "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_NEW_RECORD, 2, 0, "s1 s2", "s1", "race_newrecordserver", "TODO\n", "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_NEW_TIME, 2, 0, "s1 s2", "s1", "race_newtime", "TODO\n", "") \
+ MSG_INFO_NOTIF(1, INFO_RACE_NEW_RANK, 2, 0, "s1 s2", "s1", "race_newrankyellow", "TODO\n", "") \
MULTITEAM_INFO(1, INFO_SCORES_, 4, 0, 0, "", "", "", _("^TC^TT ^BGteam scores!\n"), "") \
MSG_INFO_NOTIF(1, INFO_SPECTATE_WARNING, 0, 1, "f1", "", "", _("^F2You have to become a player within the next %s seconds, otherwise you will be kicked, because spectating isn't allowed at this time!\n"), "") \
MSG_INFO_NOTIF(1, INFO_SUPERWEAPON_BROKEN, 0, 0, "", "", "", _("^F2Superweapons have broken down\n"), "") \
// Initialization/Create Declarations
// ====================================
-#define NOTIF_FIRST 1
-#define NOTIF_MAX 1024 // limit of recursive functions with ACCUMULATE_FUNCTION
+#define ARG_DOUBLE 1
+#define ARG_TRIPLE 2 // also included with hudargs
+#define ARG_CSQC 3
+#define ARG_SVQC 4
+
+#define NOTIF_MAX_ARGS 7
+#define NOTIF_MAX_HUDARGS 2
+
+#define NOTIF_HIT_MAX(count,funcname) if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; }
+#define NOTIF_HIT_UNKNOWN(token,funcname) default: { backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); break; }
+
+#define NOTIF_ARGUMENT_LIST \
+ ARG_CASE(ARG_TRIPLE, "s1", s1) \
+ ARG_CASE(ARG_TRIPLE, "s2", s2) \
+ ARG_CASE(ARG_TRIPLE, "s3", s3) \
+ ARG_CASE(ARG_TRIPLE, "s4", s4) \
+ ARG_CASE(ARG_DOUBLE, "f1", ftos(f1)) \
+ ARG_CASE(ARG_DOUBLE, "f2", ftos(f2)) \
+ ARG_CASE(ARG_DOUBLE, "f3", ftos(f3)) \
+ ARG_CASE(ARG_DOUBLE, "f4", ftos(f4)) \
+ ARG_CASE(ARG_DOUBLE, "f1p2dec", ftos_decimals(f1/100, 2)) \
+ ARG_CASE(ARG_DOUBLE, "f2p2dec", ftos_decimals(f2/100, 2)) \
+ ARG_CASE(ARG_CSQC, "pass_key", ((((tmp_s = getcommandkey("pass", "+use")) != "pass") && !(strstrofs(tmp_s, "not bound", 0) >= 0)) ? sprintf(CCR(_(" ^F1(Press %s)")), tmp_s) : "")) \
+ ARG_CASE(ARG_CSQC, "frag_ping", ((f2 != BOT_PING) ? sprintf(CCR(_("\n(Ping ^2%d^BG)")), f2) : "")) \
+ ARG_CASE(ARG_CSQC, "frag_stats", sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), f1, f2, ((f3 != BOT_PING) ? sprintf(CCR(_(" (Ping ^2%d^BG)")), f3) : ""))) \
+ ARG_CASE(ARG_CSQC, "spree_cen", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : "")) \
+ ARG_CASE(ARG_CSQC, "spree_inf", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : "")) \
+ ARG_CASE(ARG_CSQC, "spree_end", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", ending their %d frag spree"), _(", ending their %d score spree")), f1) : "")) \
+ ARG_CASE(ARG_CSQC, "spree_lost", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", losing their %d frag spree"), _(", losing their %d score spree")), f1) : "")) \
+ ARG_CASE(ARG_CSQC, "death_team", Team_ColoredFullName(f1 - 1)) \
+ ARG_CASE(ARG_CSQC, "weapon_name", ftos(f1)) \
+ ARG_CASE(ARG_SVQC, "spree_inf", (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d frag spree! "), _("%d score spree! ")), f1) : "")) \
+ ARG_CASE(ARG_SVQC, "spree_end", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", ending their %d frag spree"), _(", ending their %d score spree")), f1) : "")) \
+ ARG_CASE(ARG_SVQC, "spree_lost", ((f1 >= 3) ? sprintf(normal_or_gentle(_(", losing their %d frag spree"), _(", losing their %d score spree")), f1) : "")) \
+ ARG_CASE(ARG_SVQC, "death_team", Team_ColoredFullName(f1)) \
+ ARG_CASE(ARG_SVQC, "weapon_name", ftos(f1))
+
+string arg_slot[NOTIF_MAX_ARGS];
+
var float notif_error = FALSE; // an error has occurred in this specific notification
var float notif_global_error = FALSE; // an error has occurred in the notification system
}
return input;
}
+
string Process_Notif_Args(float is_hudargs, string args, string notiftype, string notifname)
{
string selected, remaining = args;
switch(strtolower(selected))
{
- #define ARG_CASE(prog,selected,result) case selected: { ++sel_num; break; }
+ #define ARG_CASE(prog,selected,result) \
+ #if (prog == ARG_TRIPLE) \
+ case selected: { ++sel_num; break; } \
+ #else \
+ case selected: { if(!is_hudargs) { ++sel_num; break; } } \
+ #endif
NOTIF_ARGUMENT_LIST
#undef ARG_CASE
default:
return args;
}
-#define ADD_AUTOCVAR(name,default) var float autocvar_notification_##name = default;
#define CREATE_NOTIF_ENTITY(default,type,name,infoname,centername,strnum,flnum,args,hudargs,icon,cpid,durcnt,normal,gentle,check_newline,subcalls) \
notif_error = FALSE; \
notif.nent_enabled = FALSE; \
notif_global_error = TRUE; \
}
-
+
+#define ADD_AUTOCVAR(name,default) var float autocvar_notification_##name = default;
+
#define MSG_INFO_NOTIF(default,name,strnum,flnum,args,hudargs,icon,normal,gentle) \
ADD_AUTOCVAR(name, default) \
float name; \
} \
ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
+var float autocvar_notification_errors_are_fatal = TRUE;
+void RegisterNotifications_Done()
+{
+ if(notif_global_error && autocvar_notification_errors_are_fatal)
+ {
+ // shit happened- stop the loading of the program
+ error("Notification initialization failed!");
+ }
+}
+
// NOW we actually activate the declarations
MSG_INFO_NOTIFICATIONS
MSG_CENTER_NOTIFICATIONS
MSG_WEAPON_NOTIFICATIONS
MSG_DEATH_NOTIFICATIONS
-//ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_Done)
+ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done)
#undef MSG_INFO_NOTIF
#undef MSG_CENTER_NOTIF
#undef MSG_WEAPON_NOTIF