]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Overkill: suppress armour drop warnings
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 11 Dec 2015 09:48:43 +0000 (20:48 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 11 Dec 2015 09:48:43 +0000 (20:48 +1100)
qcsrc/client/main.qc
qcsrc/client/miscfunctions.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/lib/log.qh
qcsrc/lib/spawnfunc.qh
qcsrc/server/autocvars.qh
qcsrc/server/scores.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_items.qc

index 94225889db1897c9696e1e3631d078313a690abf..c6529a070e67920e8648b0ffe04e745c7e011e05 100644 (file)
@@ -167,6 +167,7 @@ void Shutdown()
 .float has_team;
 float SetTeam(entity o, int Team)
 {
+       assert(Team);
        entity tm;
        if(teamplay)
        {
index 673cf00f1bf8bb1666636b34477bd60cef16bc5e..d488dd63b537a9170bbcea295e46ff19033472f7 100644 (file)
@@ -79,6 +79,7 @@ void MoveToLast(entity e)
 
 float RegisterTeam(entity Team)
 {
+       assert(Team.team, eprint(Team));
        entity tm;
        AuditLists();
        for(tm = teams.sort_next; tm; tm = tm.sort_next)
index a4d4213904a3538396ec9758748cfc6c22be7d65..4ad190d258f439bf44e0319c458aa88418711929 100644 (file)
@@ -123,30 +123,30 @@ MUTATOR_HOOKFUNCTION(ok, PlayerDamage_SplitHealthArmor)
 }
 
 MUTATOR_HOOKFUNCTION(ok, PlayerDies)
-{SELFPARAM();
+{
+       SELFPARAM();
        entity targ = ((frag_attacker) ? frag_attacker : frag_target);
 
-       if(IS_MONSTER(self))
+       if(IS_MONSTER(this))
        {
                remove(other); // remove default item
-               other = world;
+               other = NULL;
        }
 
-       setself(new(droppedweapon)); // hax
-       self.ok_item = true;
-       self.noalign = true;
-       self.pickup_anyway = true;
-       this.spawnfunc_checked = true;
-       spawnfunc_item_armor_small(this);
-       self.movetype = MOVETYPE_TOSS;
-       self.gravity = 1;
-       self.reset = SUB_Remove;
-       setorigin(self, frag_target.origin + '0 0 32');
-       self.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500;
-       SUB_SetFade(self, time + 5, 1);
-       setself(this);
-
-       self.ok_lastwep = self.switchweapon;
+       entity e = new(droppedweapon); // hax
+       e.ok_item = true;
+       e.noalign = true;
+       e.pickup_anyway = true;
+       e.spawnfunc_checked = true;
+       spawnfunc_item_armor_small(e);
+       e.movetype = MOVETYPE_TOSS;
+       e.gravity = 1;
+       e.reset = SUB_Remove;
+       setorigin(e, frag_target.origin + '0 0 32');
+       e.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500;
+       SUB_SetFade(e, time + 5, 1);
+
+       this.ok_lastwep = this.switchweapon;
 
        return false;
 }
index 3ac8ed23864c8d787580be8971dcd6ed29266ea7..8a52073396bdedbedd9d15e06cd72ac07f8f9cbf 100644 (file)
 noref int autocvar_developer;
 noref bool autocvar_prvm_backtraceforwarnings;
 
+#ifdef SVQC
+#define bt_cvar_set(cvar, value) builtin_cvar_set(cvar, value)
+#else
+#define bt_cvar_set(cvar, value) cvar_set(cvar, value)
+#endif
+
 #define backtrace(msg) \
        MACRO_BEGIN \
        { \
                int dev = autocvar_developer; \
                bool war = autocvar_prvm_backtraceforwarnings; \
-               cvar_set("developer", "1"); \
-               cvar_set("prvm_backtraceforwarnings", "1"); \
+               bt_cvar_set("developer", "1"); \
+               bt_cvar_set("prvm_backtraceforwarnings", "1"); \
                print("\n--- CUT HERE ---\n", msg, "\n"); \
                _backtrace(); \
                print("\n--- CUT UNTIL HERE ---\n"); \
-               cvar_set("developer", ftos(dev)); \
-               cvar_set("prvm_backtraceforwarnings", ftos(war)); \
+               bt_cvar_set("developer", ftos(dev)); \
+               bt_cvar_set("prvm_backtraceforwarnings", ftos(war)); \
        } MACRO_END
 
 #endif
index 75f56a23d01fbaafb70140067e53088670b5748a..3f9ca0e948a33c1d02ada7ee9f83f19fdfefb1a6 100644 (file)
@@ -28,6 +28,7 @@ noref bool require_spawnfunc_prefix;
        #define _spawnfunc_check(fld) \
                if (fieldname == #fld) continue;
 
+       noref entity __spawnfunc_expect;
        bool __spawnfunc_unreachable_workaround = true;
 
        #define spawnfunc_1(id) spawnfunc_2(id, FIELDS_UNION)
@@ -35,7 +36,16 @@ noref bool require_spawnfunc_prefix;
                void __spawnfunc_##id(entity this); \
                [[accumulate]] void spawnfunc_##id(entity this) \
                { \
-                       this = self; \
+                       if (self == __spawnfunc_expect) \
+                       { \
+                               /* engine call */ \
+                               __spawnfunc_expect = NULL; \
+                               this = self; \
+                       } \
+                       else \
+                       { \
+                               assert(this); \
+                       } \
                        if (!this.sourceLocFile) \
                        { \
                                this.sourceLocFile = __FILE__; \
index e4220f5d0c7f174d39befa55a55bd9f3710cc8b9..9b281a1f7ff475688282caf01f0eba3e2cbf3fc6 100644 (file)
@@ -64,7 +64,6 @@ bool autocvar_bot_debug_goalstack;
 bool autocvar_bot_wander_enable;
 int autocvar_captureleadlimit_override;
 #define autocvar_capturelimit_override cvar("capturelimit_override")
-#define autocvar_developer cvar("developer")
 float autocvar_ekg;
 #define autocvar_fraglimit cvar("fraglimit")
 #define autocvar_fraglimit_override cvar("fraglimit_override")
index 03f3dbba37208d2eed5c5c8cc26fd18e628d3f49..8b740ef88b66e3c3ed88628f93acb07140159200 100644 (file)
@@ -59,7 +59,9 @@ bool TeamScore_SendEntity(entity this, entity to, float sendflags)
        float i, p, longflags;
 
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
-       WriteByte(MSG_ENTITY, self.team - 1);
+       int t = this.team - 1;
+       assert(t, eprint(this));
+       WriteByte(MSG_ENTITY, t);
 
        longflags = 0;
        for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
index 90e9f79384cd3dfc4eaaf8fdddb6fedf4d4b3fe4..1e9d3a766c18bfc784837d09cfe85a5e3ff8f8c3 100644 (file)
@@ -234,6 +234,7 @@ void StartFrame()
 float DoesQ3ARemoveThisEntity();
 void SV_OnEntityPreSpawnFunction()
 {SELFPARAM();
+       __spawnfunc_expect = this;
        if (self)
        if (self.gametypefilter != "")
        if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, self.gametypefilter))
index 8d66501cd38cbb122e09d70ea667e95610d956ce..d78194eb46f8ab0f0fbe855cc280adb23f736489 100644 (file)
@@ -1208,10 +1208,10 @@ void StartItem(entity this, GameItem def)
 
 spawnfunc(item_rockets)
 {
-       if(!self.ammo_rockets)
-               self.ammo_rockets = g_pickup_rockets;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_rockets)
+               this.ammo_rockets = g_pickup_rockets;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
     StartItem(this, ITEM_Rockets);
 }
 
@@ -1219,7 +1219,7 @@ spawnfunc(item_bullets)
 {
        if(!weaponswapping)
        if(autocvar_sv_q3acompat_machineshotgunswap)
-       if(self.classname != "droppedweapon")
+       if(this.classname != "droppedweapon")
        {
                weaponswapping = true;
                spawnfunc_item_shells(this);
@@ -1227,28 +1227,28 @@ spawnfunc(item_bullets)
                return;
        }
 
-       if(!self.ammo_nails)
-               self.ammo_nails = g_pickup_nails;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_nails)
+               this.ammo_nails = g_pickup_nails;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
     StartItem(this, ITEM_Bullets);
 }
 
 spawnfunc(item_cells)
 {
-       if(!self.ammo_cells)
-               self.ammo_cells = g_pickup_cells;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_cells)
+               this.ammo_cells = g_pickup_cells;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Cells);
 }
 
 spawnfunc(item_plasma)
 {
-       if(!self.ammo_plasma)
-               self.ammo_plasma = g_pickup_plasma;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_plasma)
+               this.ammo_plasma = g_pickup_plasma;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Plasma);
 }
 
@@ -1256,7 +1256,7 @@ spawnfunc(item_shells)
 {
        if(!weaponswapping)
        if(autocvar_sv_q3acompat_machineshotgunswap)
-       if(self.classname != "droppedweapon")
+       if(this.classname != "droppedweapon")
        {
                weaponswapping = true;
                spawnfunc_item_bullets(this);
@@ -1264,98 +1264,98 @@ spawnfunc(item_shells)
                return;
        }
 
-       if(!self.ammo_shells)
-               self.ammo_shells = g_pickup_shells;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_shells)
+               this.ammo_shells = g_pickup_shells;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_Shells);
 }
 
 spawnfunc(item_armor_small)
 {
-       if(!self.armorvalue)
-               self.armorvalue = g_pickup_armorsmall;
-       if(!self.max_armorvalue)
-               self.max_armorvalue = g_pickup_armorsmall_max;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_armorsmall_anyway;
+       if(!this.armorvalue)
+               this.armorvalue = g_pickup_armorsmall;
+       if(!this.max_armorvalue)
+               this.max_armorvalue = g_pickup_armorsmall_max;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_armorsmall_anyway;
        StartItem(this, ITEM_ArmorSmall);
 }
 
 spawnfunc(item_armor_medium)
 {
-       if(!self.armorvalue)
-               self.armorvalue = g_pickup_armormedium;
-       if(!self.max_armorvalue)
-               self.max_armorvalue = g_pickup_armormedium_max;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_armormedium_anyway;
+       if(!this.armorvalue)
+               this.armorvalue = g_pickup_armormedium;
+       if(!this.max_armorvalue)
+               this.max_armorvalue = g_pickup_armormedium_max;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_armormedium_anyway;
        StartItem(this, ITEM_ArmorMedium);
 }
 
 spawnfunc(item_armor_big)
 {
-       if(!self.armorvalue)
-               self.armorvalue = g_pickup_armorbig;
-       if(!self.max_armorvalue)
-               self.max_armorvalue = g_pickup_armorbig_max;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_armorbig_anyway;
+       if(!this.armorvalue)
+               this.armorvalue = g_pickup_armorbig;
+       if(!this.max_armorvalue)
+               this.max_armorvalue = g_pickup_armorbig_max;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_armorbig_anyway;
        StartItem(this, ITEM_ArmorLarge);
 }
 
 spawnfunc(item_armor_large)
 {
-       if(!self.armorvalue)
-               self.armorvalue = g_pickup_armorlarge;
-       if(!self.max_armorvalue)
-               self.max_armorvalue = g_pickup_armorlarge_max;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_armorlarge_anyway;
+       if(!this.armorvalue)
+               this.armorvalue = g_pickup_armorlarge;
+       if(!this.max_armorvalue)
+               this.max_armorvalue = g_pickup_armorlarge_max;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_armorlarge_anyway;
        StartItem(this, ITEM_ArmorMega);
 }
 
 spawnfunc(item_health_small)
 {
-       if(!self.max_health)
-               self.max_health = g_pickup_healthsmall_max;
-       if(!self.health)
-               self.health = g_pickup_healthsmall;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_healthsmall_anyway;
+       if(!this.max_health)
+               this.max_health = g_pickup_healthsmall_max;
+       if(!this.health)
+               this.health = g_pickup_healthsmall;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_healthsmall_anyway;
        StartItem(this, ITEM_HealthSmall);
 }
 
 spawnfunc(item_health_medium)
 {
-       if(!self.max_health)
-               self.max_health = g_pickup_healthmedium_max;
-       if(!self.health)
-               self.health = g_pickup_healthmedium;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_healthmedium_anyway;
+       if(!this.max_health)
+               this.max_health = g_pickup_healthmedium_max;
+       if(!this.health)
+               this.health = g_pickup_healthmedium;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_healthmedium_anyway;
     StartItem(this, ITEM_HealthMedium);
 }
 
 spawnfunc(item_health_large)
 {
-       if(!self.max_health)
-               self.max_health = g_pickup_healthlarge_max;
-       if(!self.health)
-               self.health = g_pickup_healthlarge;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_healthlarge_anyway;
+       if(!this.max_health)
+               this.max_health = g_pickup_healthlarge_max;
+       if(!this.health)
+               this.health = g_pickup_healthlarge;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_healthlarge_anyway;
        StartItem(this, ITEM_HealthLarge);
 }
 
 spawnfunc(item_health_mega)
 {
-    if(!self.max_health)
-        self.max_health = g_pickup_healthmega_max;
-    if(!self.health)
-        self.health = g_pickup_healthmega;
-    if(!self.pickup_anyway)
-        self.pickup_anyway = g_pickup_healthmega_anyway;
+    if(!this.max_health)
+        this.max_health = g_pickup_healthmega_max;
+    if(!this.health)
+        this.health = g_pickup_healthmega;
+    if(!this.pickup_anyway)
+        this.pickup_anyway = g_pickup_healthmega_anyway;
     StartItem(this, ITEM_HealthMega);
 }
 
@@ -1368,20 +1368,20 @@ spawnfunc(item_health100) { spawnfunc_item_health_mega(this); }
 
 spawnfunc(item_strength)
 {
-               if(!self.strength_finished)
-                       self.strength_finished = autocvar_g_balance_powerup_strength_time;
+               if(!this.strength_finished)
+                       this.strength_finished = autocvar_g_balance_powerup_strength_time;
                StartItem(this, ITEM_Strength);
 }
 
 spawnfunc(item_invincible)
 {
-               if(!self.invincible_finished)
-                       self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+               if(!this.invincible_finished)
+                       this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
                StartItem(this, ITEM_Shield);
 }
 
 // compatibility:
-spawnfunc(item_quad) { self.classname = "item_strength";spawnfunc_item_strength(this);}
+spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength(this);}
 
 void target_items_use()
 {SELFPARAM();
@@ -1530,10 +1530,10 @@ spawnfunc(target_items)
 
 spawnfunc(item_fuel)
 {
-       if(!self.ammo_fuel)
-               self.ammo_fuel = g_pickup_fuel;
-       if(!self.pickup_anyway)
-               self.pickup_anyway = g_pickup_ammo_anyway;
+       if(!this.ammo_fuel)
+               this.ammo_fuel = g_pickup_fuel;
+       if(!this.pickup_anyway)
+               this.pickup_anyway = g_pickup_ammo_anyway;
        StartItem(this, ITEM_JetpackFuel);
 }
 
@@ -1549,8 +1549,8 @@ spawnfunc(item_fuel_regen)
 
 spawnfunc(item_jetpack)
 {
-       if(!self.ammo_fuel)
-               self.ammo_fuel = g_pickup_fuel_jetpack;
+       if(!this.ammo_fuel)
+               this.ammo_fuel = g_pickup_fuel_jetpack;
        if(start_items & ITEM_Jetpack.m_itemid)
        {
                spawnfunc_item_fuel(this);