]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/notifications.qh
#include this
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / notifications.qh
index e414ef25d6ce936f4bc8d211ef2d0cdf3c1600c1..b905f67061ec282c21038e7e6850bb9305bfb537 100644 (file)
@@ -1,3 +1,85 @@
+#ifndef NOTIFICATIONS_H
+#define NOTIFICATIONS_H
+
+#if defined(CSQC)
+    #include "util-pre.qh"
+    #include "../client/sys-pre.qh"
+    #include "../dpdefs/csprogsdefs.qc"
+    #include "../client/sys-post.qh"
+    #include "../client/Defs.qc"
+    #include "../dpdefs/keycodes.qc"
+    #include "constants.qh"
+    #include "stats.qh"
+    #include "../warpzonelib/anglestransform.qh"
+    #include "../warpzonelib/mathlib.qh"
+    #include "../warpzonelib/common.qh"
+    #include "../warpzonelib/client.qh"
+    #include "playerstats.qh"
+    #include "teams.qh"
+    #include "util.qh"
+    #include "nades.qh"
+    #include "buffs.qh"
+    #include "test.qh"
+    #include "counting.qh"
+    #include "weapons/weapons.qh"
+    #include "mapinfo.qh"
+    #include "command/markup.qh"
+    #include "command/rpn.qh"
+    #include "command/generic.qh"
+    #include "command/shared_defs.qh"
+    #include "urllib.qh"
+    #include "animdecide.qh"
+    #include "../client/command/cl_cmd.qh"
+    #include "monsters/monsters.qh"
+    #include "../client/autocvars.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "util-pre.qh"
+    #include "../server/sys-pre.qh"
+    #include "../dpdefs/progsdefs.qc"
+    #include "../dpdefs/dpextensions.qc"
+    #include "../server/sys-post.qh"
+    #include "../warpzonelib/anglestransform.qh"
+    #include "../warpzonelib/mathlib.qh"
+    #include "../warpzonelib/common.qh"
+    #include "../warpzonelib/util_server.qh"
+    #include "../warpzonelib/server.qh"
+    #include "constants.qh"
+    #include "stats.qh"
+    #include "teams.qh"
+    #include "util.qh"
+    #include "nades.qh"
+    #include "buffs.qh"
+    #include "test.qh"
+    #include "counting.qh"
+    #include "urllib.qh"
+    #include "command/markup.qh"
+    #include "command/rpn.qh"
+    #include "command/generic.qh"
+    #include "command/shared_defs.qh"
+    #include "net_notice.qh"
+    #include "animdecide.qh"
+    #include "monsters/monsters.qh"
+    #include "monsters/sv_monsters.qh"
+    #include "monsters/spawn.qh"
+    #include "weapons/config.qh"
+    #include "weapons/weapons.qh"
+    #include "../server/weapons/accuracy.qh"
+    #include "../server/weapons/common.qh"
+    #include "../server/weapons/csqcprojectile.qh"
+    #include "../server/weapons/hitplot.qh"
+    #include "../server/weapons/selection.qh"
+    #include "../server/weapons/spawning.qh"
+    #include "../server/weapons/throwing.qh"
+    #include "../server/weapons/tracing.qh"
+    #include "../server/weapons/weaponstats.qh"
+    #include "../server/weapons/weaponsystem.qh"
+    #include "../server/t_items.qh"
+    #include "../server/autocvars.qh"
+    #include "../server/constants.qh"
+    #include "../server/defs.qh"
+#endif
+
 // ================================================
 //  Unified notification system, written by Samual
 //  Last updated: March, 2013
@@ -934,32 +1016,32 @@ void Send_Notification_WOCOVA(
 // MAKE SURE THIS IS ALWAYS SYNCHRONIZED WITH THE DUMP
 // NOTIFICATIONS FUNCTION IN THE .QC FILE!
 
-#define NOTIF_ADD_AUTOCVAR(name,default) var float autocvar_notification_##name = default;
+#define NOTIF_ADD_AUTOCVAR(name,default) float autocvar_notification_##name = default;
 
-var float autocvar_notification_show_location = FALSE;
-var string autocvar_notification_show_location_string = ""; //_(" at the %s");
-var float autocvar_notification_show_sprees = TRUE;
-var float autocvar_notification_show_sprees_info = 3; // 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker
-var float autocvar_notification_show_sprees_info_newline = TRUE;
-var float autocvar_notification_show_sprees_info_specialonly = TRUE;
-var float autocvar_notification_errors_are_fatal = TRUE;
-var float autocvar_notification_lifetime_runtime = 0.5;
-var float autocvar_notification_lifetime_mapload = 10;
-var float autocvar_notification_debug = FALSE;
+float autocvar_notification_show_location = false;
+string autocvar_notification_show_location_string = ""; //_(" at the %s");
+float autocvar_notification_show_sprees = true;
+float autocvar_notification_show_sprees_info = 3; // 0 = off, 1 = target only, 2 = attacker only, 3 = target and attacker
+float autocvar_notification_show_sprees_info_newline = true;
+float autocvar_notification_show_sprees_info_specialonly = true;
+float autocvar_notification_errors_are_fatal = true;
+float autocvar_notification_lifetime_runtime = 0.5;
+float autocvar_notification_lifetime_mapload = 10;
+float autocvar_notification_debug = false;
 
 #ifdef SVQC
 .float FRAG_VERBOSE;
 void Notification_GetCvars(void);
-var float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes
+float autocvar_notification_server_allows_location = 1; // 0 = no, 1 = yes
 #else
-var float autocvar_notification_item_centerprinttime = 1.5;
+float autocvar_notification_item_centerprinttime = 1.5;
 
 // 0 = no, 1 = yes, 2 = forced on for all MSG_INFO notifs
 // DISABLED IN CODE, BUT ENABLED IN CONFIG FOR COMPATIBILITY WITH OLD CLIENTS
-var float autocvar_notification_allow_chatboxprint = 0;
+float autocvar_notification_allow_chatboxprint = 0;
 
-var float autocvar_notification_show_sprees_center = TRUE;
-var float autocvar_notification_show_sprees_center_specialonly = TRUE;
+float autocvar_notification_show_sprees_center = true;
+float autocvar_notification_show_sprees_center_specialonly = true;
 #endif
 
 
@@ -1054,7 +1136,7 @@ const float ARG_DC = 6; // unique result to durcnt/centerprint
     ARG_CASE(ARG_CS_SV,     "race_diff",     ((f2 > f3) ? sprintf(CCR("^1[+%s]"), mmssss(f2 - f3)) : sprintf(CCR("^2[-%s]"), mmssss(f3 - f2)))) \
     ARG_CASE(ARG_CS,        "missing_teams", notif_arg_missing_teams(f1)) \
     ARG_CASE(ARG_CS,        "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_CS,        "frag_ping",     notif_arg_frag_ping(TRUE, f2)) \
+    ARG_CASE(ARG_CS,        "frag_ping",     notif_arg_frag_ping(true, f2)) \
     ARG_CASE(ARG_CS,        "frag_stats",    notif_arg_frag_stats(f2, f3, f4)) \
     /*ARG_CASE(ARG_CS,      "frag_pos",      ((Should_Print_Score_Pos(f1)) ? sprintf("\n^BG%s", Read_Score_Pos(f1)) : ""))*/ \
     ARG_CASE(ARG_CS,        "spree_cen",     (autocvar_notification_show_sprees ? notif_arg_spree_cen(f1) : "")) \
@@ -1068,7 +1150,9 @@ const float ARG_DC = 6; // unique result to durcnt/centerprint
     ARG_CASE(ARG_SV,        "death_team",    Team_ColoredFullName(f1)) \
     ARG_CASE(ARG_CS,        "death_team",    Team_ColoredFullName(f1 - 1))
 
-#define NOTIF_HIT_MAX(count,funcname) if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; }
+#define NOTIF_HIT_MAX(count,funcname) do { \
+    if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; } \
+} while(0)
 #define NOTIF_HIT_UNKNOWN(token,funcname) { backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); break; }
 
 #define KILL_SPREE_LIST \
@@ -1092,9 +1176,9 @@ string notif_arg_frag_ping(float newline, float fping)
 string notif_arg_frag_stats(float fhealth, float farmor, float fping)
 {
     if (!(fhealth < 1))
-        return sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), fhealth, farmor, notif_arg_frag_ping(FALSE, fping));
+        return sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), fhealth, farmor, notif_arg_frag_ping(false, fping));
     else
-        return sprintf(CCR(_("\n(^F4Dead^BG)%s")), notif_arg_frag_ping(FALSE, fping));
+        return sprintf(CCR(_("\n(^F4Dead^BG)%s")), notif_arg_frag_ping(false, fping));
 }
 
 string notif_arg_missing_teams(float f1)
@@ -1269,6 +1353,38 @@ string notif_arg_spree_inf(float type, string input, string player, float spree)
 //  Initialization/Create Declarations
 // ====================================
 
+enum {
+    NO_CPID
+,   CPID_ASSAULT_ROLE
+,   CPID_ROUND
+,   CPID_CAMPCHECK
+,   CPID_CTF_CAPSHIELD
+,   CPID_CTF_LOWPRIO
+,   CPID_CTF_PASS
+,   CPID_STALEMATE
+,   CPID_NADES
+,   CPID_IDLING
+,   CPID_ITEM
+,   CPID_PREVENT_JOIN
+,   CPID_KEEPAWAY
+,   CPID_KEEPAWAY_WARN
+,   CPID_KEYHUNT
+,   CPID_KEYHUNT_OTHER
+,   CPID_LMS
+,   CPID_MISSING_TEAMS
+,   CPID_MISSING_PLAYERS
+,   CPID_INSTAGIB_FINDAMMO
+,   CPID_MOTD
+,   CPID_NIX
+,   CPID_ONSLAUGHT
+,   CPID_OVERTIME
+,   CPID_POWERUP
+,   CPID_RACE_FINISHLAP
+,   CPID_TEAMCHANGE
+,   CPID_TIMEOUT
+// always last
+,   NOTIF_CPID_COUNT
+};
 // notification counts
 const float NOTIF_FIRST = 1;
 float NOTIF_ANNCE_COUNT;
@@ -1276,7 +1392,6 @@ float NOTIF_INFO_COUNT;
 float NOTIF_CENTER_COUNT;
 float NOTIF_MULTI_COUNT;
 float NOTIF_CHOICE_COUNT;
-float NOTIF_CPID_COUNT;
 
 // notification limits -- INCREASE AS NECESSARY
 const float NOTIF_ANNCE_MAX   = 100;
@@ -1428,11 +1543,9 @@ float notif_global_error;
 #define MSG_CENTER_NOTIF(default,name,strnum,flnum,args,cpid,durcnt,normal,gentle) \
     NOTIF_ADD_AUTOCVAR(name, default) \
     float name; \
-    float cpid; \
     void RegisterNotification_##name() \
     { \
         SET_FIELD_COUNT(name, NOTIF_FIRST, NOTIF_CENTER_COUNT) \
-        SET_FIELD_COUNT(cpid, NOTIF_FIRST, NOTIF_CPID_COUNT) \
         CHECK_MAX_COUNT(name, NOTIF_CENTER_MAX, NOTIF_CENTER_COUNT, "MSG_CENTER") \
         Create_Notification_Entity( \
             /* COMMON ======================== */ \
@@ -1558,7 +1671,7 @@ float notif_global_error;
 
 void RegisterNotifications_First()
 {
-    notif_global_error = FALSE;
+    notif_global_error = false;
 
     #ifdef SVQC
     #define dedi (server_is_dedicated ? "a dedicated " : "")
@@ -1577,7 +1690,7 @@ void RegisterNotifications_First()
         #else
         if(autocvar_notification_version_mismatch_server_error)
         #endif
-            notif_global_error = TRUE;
+            notif_global_error = true;
 
         printf("^1NOTIFICATION VERSION MISMATCH: ^7program = %s, config = %d, code = %d.\n",
             PROGNAME, autocvar_notification_version, NOTIF_VERSION);
@@ -1612,3 +1725,4 @@ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done);
 #undef MSG_CHOICE_NOTIF
 
 #undef NOTIF_ADD_AUTOCVAR
+#endif
\ No newline at end of file