]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove uses of WITHSELF
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 12 Jun 2016 03:35:42 +0000 (13:35 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 12 Jun 2016 03:35:42 +0000 (13:35 +1000)
31 files changed:
qcsrc/client/shownames.qc
qcsrc/common/ent_cs.qc
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/push.qc
qcsrc/common/triggers/func/conveyor.qc
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/trigger/gamestart.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/dpdefs/post.qh
qcsrc/dpdefs/pre.qh
qcsrc/lib/_all.inc
qcsrc/lib/macro.qh
qcsrc/lib/oo.qh
qcsrc/lib/self.qh
qcsrc/lib/spawnfunc.qh
qcsrc/server/cheats.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_tdm.qc
qcsrc/server/sv_main.qc

index e9db990c82d474a07e06ee358dd9f0a99313ece1..6700ba61c7b87cadfee0438093ffdf46a2d5ee7e 100644 (file)
@@ -177,7 +177,7 @@ void Draw_ShowNames_All()
                }
                make_impure(it);
                assert(getthink(entcs), eprint(entcs));
-               WITHSELF(entcs, getthink(entcs)(entcs));
+               getthink(entcs)(entcs);
                if (!entcs.has_origin) continue;
                if (entcs.m_entcs_private)
                {
index 75deb92eaf8a5c448a69c7754ade78af4b82cfd7..cafef4868b540cd274de8d2f253fd113a6d43623 100644 (file)
        #undef X
                this.iflags |= IFLAG_ORIGIN;
                InterpolateOrigin_Note(this);
-               WITHSELF(this, getthink(this)(this));
+               getthink(this)(this);
                return true;
        }
 
index 2a431c721d47bd6171609e98ce13036bd2ebdc8e..6ef9ca5ab66fec9fcd082ff0a5333a69622b894f 100644 (file)
@@ -109,7 +109,7 @@ void nexball_setstatus(entity this)
                        bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n");
                        DropBall(this.ballcarried, this.ballcarried.owner.origin, '0 0 0');
                        entity e = this.ballcarried;
-                       WITHSELF(e, ResetBall(e));
+                       ResetBall(e);
                }
                else
                        this.items |= IT_KEY1;
index 1ae7e83a914f83d21b628a482ce38c8866e5a8dc..945a1de35ec341ee01004535d28969aab3407f0d 100644 (file)
@@ -48,7 +48,7 @@ void monster_dropitem(entity this, entity attacker)
        if(e && e.monster_loot)
        {
                e.noalign = true;
-               WITHSELF(e, e.monster_loot(e));
+               e.monster_loot(e);
                e.gravity = 1;
                e.movetype = MOVETYPE_TOSS;
                e.reset = SUB_Remove;
index cd72bb46b6a7a541eacdde03af3ef874b36e2c6f..15aa8eeb13d617e7560858e86db1b5eb75996660 100644 (file)
@@ -907,7 +907,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
                                {
                                        entity oldother = other;
                                        other = player;
-                                       WITHSELF(it, gettouch(it)(it));
+                                       gettouch(it)(it);
                                        other = oldother;
                                }
                        }
index 89bbf5fae017d1fd176283b1e131ee1c3983d386..dc871d694a80e85450e035c678e281b7fbe7a217 100644 (file)
@@ -389,7 +389,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
         e.cnt = item.cnt;
         e.team = item.team;
         e.spawnfunc_checked = true;
-               WITHSELF(e, spawnfunc_item_minst_cells(e));
+               spawnfunc_item_minst_cells(e);
                return true;
        }
 
index 323286bbe947f43dc450e3ed366b3082e253d50e..2fb75b3f8d9696b8ce644748f5f837d0e19a89f5 100644 (file)
@@ -128,7 +128,7 @@ void ok_DropItem(entity this, entity targ)
        e.noalign = true;
        e.pickup_anyway = true;
        e.spawnfunc_checked = true;
-       WITHSELF(e, spawnfunc_item_armor_small(e));
+       spawnfunc_item_armor_small(e);
        if (!wasfreed(e)) { // might have been blocked by a mutator
         e.movetype = MOVETYPE_TOSS;
         e.gravity = 1;
index ce7d04d1da29975b09c1c7db9cd9c8a92e746163..06ccde2a57fc3db941ef6c61ed3f95a8b5b0d0f6 100644 (file)
@@ -321,7 +321,7 @@ void _Movetype_Impact(entity this, entity oth)  // SV_Impact
        {
                other = oth;
 
-               WITHSELF(this, gettouch(this)(this));
+               gettouch(this)(this);
 
                other = oldother;
        }
@@ -330,7 +330,7 @@ void _Movetype_Impact(entity this, entity oth)  // SV_Impact
        {
                other = this;
 
-               WITHSELF(oth, gettouch(oth)(oth));
+               gettouch(oth)(oth);
 
                other = oldother;
        }
@@ -360,7 +360,7 @@ void _Movetype_LinkEdict_TouchAreaGrid(entity this)  // SV_LinkEdict_TouchAreaGr
                        trace_plane_dist = 0;
                        trace_ent = this;
 
-                       WITHSELF(it, gettouch(it)(it));
+                       gettouch(it)(it);
                }
     });
 
index 276b10476fff83e05b75b625ed4f0d73a46f6117..29ce131064c8183a813b53e5c39710b836c9ec69 100644 (file)
@@ -149,6 +149,6 @@ void _Movetype_Physics_Pusher(entity this, float dt)  // SV_Physics_Pusher
                this.move_nextthink = 0;
                this.move_time = time;
                other = world;
-               WITHSELF(this, this.move_think(this));
+               this.move_think(this);
        }
 }
index e86eefb2c10158c3ae4bfadd7a106bbc0e4eee99..b8980a1561aae5f40f5f013233901ec4e0bb1e34 100644 (file)
@@ -147,7 +147,7 @@ spawnfunc(func_conveyor)
 
 #elif defined(CSQC)
 
-void conveyor_draw(entity this) { WITHSELF(this, conveyor_think(this)); }
+void conveyor_draw(entity this) { conveyor_think(this); }
 
 void conveyor_init(entity this)
 {
index a71267b0cc5d047d59b01d2e30d739e23421250c..51ef002736a32201d391cc9831b9a4f84f06389f 100644 (file)
@@ -145,7 +145,7 @@ void SUB_CalcMove_controller_think (entity this)
                entity own = this.owner;
                SUB_THINK(own, this.think1);
                remove(this);
-               WITHSELF(own, SUB_THUNK(own)(own));
+               SUB_THUNK(own)(own);
        }
 }
 
@@ -236,7 +236,7 @@ void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspe
        this.SUB_NEXTTHINK = this.SUB_LTIME + traveltime;
 
        // invoke controller
-       WITHSELF(controller, getthink(controller)(controller));
+       getthink(controller)(controller);
 }
 
 void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
index a570c2a64454cb42abf8b10b934d057f36d723b6..679d66e733a73b04fd8cea13d3952bb82d4c8897 100644 (file)
@@ -217,7 +217,7 @@ void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, enti
                                value = strcat("target_spawn_helper", value);
                        putentityfieldstring(target_spawn_spawnfunc_field, e, value);
 
-                       WITHSELF(e, e.target_spawn_spawnfunc(e));
+                       e.target_spawn_spawnfunc(e);
 
                        // We called an external function, so we have to re-tokenize msg.
                        n = tokenize_console(msg);
index 6fa27cf1a7ee2ccf56e71fd97a7885ec2173ff3b..efddf8c77f89eb99787af0075e448e1035ad4082 100644 (file)
@@ -10,11 +10,10 @@ void gamestart_use_this(entity this)
        gamestart_use(this, NULL, NULL);
 }
 
-void self_spawnfunc_trigger_gamestart(entity this);
 spawnfunc(trigger_gamestart)
 {
        this.use = gamestart_use;
-       this.reset2 = self_spawnfunc_trigger_gamestart;
+       this.reset2 = spawnfunc_trigger_gamestart;
 
        if(this.wait)
        {
@@ -24,6 +23,5 @@ spawnfunc(trigger_gamestart)
        else
                InitializeEntity(this, gamestart_use_this, INITPRIO_FINDTARGET);
 }
-void self_spawnfunc_trigger_gamestart(entity this) { WITHSELF(this, spawnfunc_trigger_gamestart(this)); }
 
 #endif
index 9dbf5825ff20f96f09d0834ed3a0e577894e2806..18dd356df77c336e567ad87cc549532ea06b83ed 100644 (file)
@@ -391,7 +391,7 @@ bool raptor_frame(entity this)
        if (wep1.wr_checkammo1(wep1, vehic))
        {
            .entity weaponentity = weaponentities[0];
-               WITHSELF(vehic, wep1.wr_think(wep1, vehic, weaponentity, 1));
+               wep1.wr_think(wep1, vehic, weaponentity, 1);
        }
 
        if(vehic.vehicle_flags  & VHF_SHIELDREGEN)
index b86b77fadf4ffc0cb14de612227121f3433c2635..dd691a6921ca8ab2b9d619ee61df8731515189d5 100644 (file)
@@ -114,7 +114,8 @@ void W_PROP_think(entity this)
 STATIC_INIT_LATE(W_PROP_reloader)
 {
     entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
-    WITHSELF(e, (setthink(e, W_PROP_think))(e));
+    setthink(e, W_PROP_think);
+    W_PROP_think(e);
 }
 #endif
 
index 4908a7ee5c94116443007d0cf35f1b31a0e59d35..b7d471f5a3ab96831e61427a050aab8f9196824d 100644 (file)
@@ -691,7 +691,7 @@ void W_Arc_Beam(float burst, entity actor)
        beam.beam_bursting = burst;
        Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
-       WITHSELF(beam, getthink(beam)(beam));
+       getthink(beam)(beam);
 }
 void Arc_Smoke(entity actor)
 {
index 59cb4618bc1cf130cc098b8fcd5b391a69b0602d..ca305f7ba7c4191914f81c8a65ae33c9dc68286d 100644 (file)
@@ -146,7 +146,7 @@ void W_Blaster_Attack(
 
        if (time >= missile.nextthink)
        {
-               WITHSELF(missile, getthink(missile)(missile));
+               getthink(missile)(missile);
        }
 }
 
index fe465e5933420d7ad602226df27e80c878528202..db8752d2bb8075d2f9611c3c776830c6d682540d 100644 (file)
@@ -1,3 +1,16 @@
 #pragma once
 
+#undef ChangeYaw
+#undef checkclient
+#undef droptofloor
+#undef error
+#undef movetogoal
 #undef objerror
+#undef walkmove
+
+#ifdef MENUQC
+       #define NULL (0, null_entity)
+       #define world NULL
+#else
+       #define NULL (0, world)
+#endif
index f63f0aa830d0cbc04cdfda8d8081d64a55fc10ac..b24d0120a49e56a0bee597379b3522e454013949 100644 (file)
@@ -1,3 +1,9 @@
 #pragma once
 
+#define ChangeYaw builtin_ChangeYaw
+#define checkclient builtin_checkclient
+#define droptofloor builtin_droptofloor
+#define error builtin_error
+#define movetogoal builtin_movetogoal
 #define objerror builtin_objerror
+#define walkmove builtin_walkmove
index 23b55cb69de3a31bf4729adeb4765af660472890..03b943625832c472670d76169a58a8ba32195684 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <dpdefs/post.qh>
 
+#include "self.qh"
+
 #define USING(name, T) typedef T name
 
 #include "bool.qh"
@@ -94,7 +96,6 @@ void    isnt_bool(   float this) { print(ftos(this)); }
 #include "registry.qh"
 #include "registry_net.qh"
 #include "replicate.qh"
-#include "self.qh"
 #include "sortlist.qc"
 #include "sort.qh"
 #include "spawnfunc.qh"
index 809708d7439e57fc3870b47714422a653a54667c..dff3710a5f3d04a7c114ba1b5c9f612ece4737d8 100644 (file)
@@ -1,7 +1,7 @@
 #pragma once
 
 #if 1
-    void voidfunc() { error("voidfunc"); }
+    void voidfunc() { }
     #define MACRO_BEGIN if (1) {
     #define MACRO_END } else voidfunc()
 #else
index fd6ca20365000cc0fa7553e57b560823452eec24..3708552d5968c5d5bcfb1c976bd56cae9779fa63 100644 (file)
@@ -4,13 +4,6 @@
 #include "nil.qh"
 #include "static.qh"
 
-#ifdef MENUQC
-       #define NULL (0, null_entity)
-       #define world NULL
-#else
-       #define NULL (0, world)
-#endif
-
 .vector origin;
 .bool pure_data;
 /** @deprecated use new_pure or NEW(class) */
index 4af4b8ab024388ad1db5f0b067b7fee533e0a4e8..37f0c50d21297a79a0b133e879e39ebd4aaa1baa 100644 (file)
@@ -87,19 +87,21 @@ SELFWRAP(camera_transform, vector, (vector org, vector ang), (entity this, vecto
 SELFWRAP(SendEntity, bool, (entity to, int sendflags), (entity this, entity to, int sendflags), (this, to, sendflags))
 #define setSendEntity(e, f) SELFWRAP_SET(SendEntity, e, f)
 
-#ifdef SVQC
-void make_safe_for_remove(entity this);
+#define ChangeYaw(e, ...) (__self = (e), builtin_ChangeYaw(__VA_ARGS__))
+#define checkclient(e, ...) (__self = (e), builtin_checkclient(__VA_ARGS__))
+#ifndef SVQC
+    #define droptofloor(e, ...) (__self = (e), builtin_droptofloor(__VA_ARGS__))
 #endif
-
-void objerror(entity this, string s)
-{
-#ifdef SVQC
-    make_safe_for_remove(this);
+#define error(...) (__self = (NULL), builtin_error(__VA_ARGS__))
+#define movetogoal(e, ...) (__self = (e), builtin_movetogoal(__VA_ARGS__))
+#ifndef SVQC
+    #define objerror(e, ...) (__self = (e), builtin_objerror(__VA_ARGS__))
+#else
+    void make_safe_for_remove(entity this);
+    #define objerror(e, ...) (__self = (e), make_safe_for_remove(__self), builtin_objerror(__VA_ARGS__))
 #endif
-    WITHSELF(this, builtin_objerror(s));
-}
+#define walkmove(e, ...) (__self = (e), builtin_walkmove(__VA_ARGS__))
 
 #ifndef MENUQC
-void adaptor_think2touch(entity this) { WITH(entity, other, NULL, gettouch(this)(this)); }
 void adaptor_think2use(entity this) { if (this.use) this.use(this, NULL, NULL); }
 #endif
index 22047bbc9daac0d285478015cbecbcf14ceb6303..0463979c1a3fb855c3245360ffcb3be7f4387a6a 100644 (file)
@@ -27,6 +27,7 @@ noref bool require_spawnfunc_prefix;
        #define _spawnfunc_check(fld) \
                if (fieldname == #fld) continue;
 
+       noref bool __spawnfunc_expecting;
        noref entity __spawnfunc_expect;
        bool __spawnfunc_unreachable_workaround = true;
 
@@ -35,11 +36,12 @@ noref bool require_spawnfunc_prefix;
                void __spawnfunc_##id(entity this); \
                [[accumulate]] void spawnfunc_##id(entity this) \
                { \
-                       if (__self == __spawnfunc_expect) \
+                       if (__spawnfunc_expecting) \
                        { \
                                /* engine call */ \
+                               __spawnfunc_expecting = false; \
+                               this = __spawnfunc_expect; \
                                __spawnfunc_expect = NULL; \
-                               this = __self; \
                        } \
                        else \
                        { \
index e92a6082a77d2486c562cd7e03604558ed363714..987a86db4f128f6a841b396847bb449961a6278c 100644 (file)
@@ -357,7 +357,7 @@ float CheatCommand(entity this, int argc)
                                                e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
                                                e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
                                        }
-                                       WITHSELF(e, spawnfunc_func_breakable(e));
+                                       spawnfunc_func_breakable(e);
                                        // now, is it valid?
                                        if(f == 0)
                                        {
index b1482999d1e73c71646f63f441e1bbb011d2cd9e..d02caa390fedecbae1c2fbf6cfcd2604cfea2068 100644 (file)
@@ -340,7 +340,7 @@ void reset_map(bool dorespawn)
        FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
                if (it.reset)
                {
-                       WITHSELF(it, it.reset(it)); // needs WITHSELF, as some spawnfuncs are set to .reset
+                       it.reset(it);
                        continue;
                }
                if (it.team_saved) it.team = it.team_saved;
index 8e2f74c7209c150eac17a1e9b74aa5b72205e841..7cb5f69803fb097918f2e7382e64cc91a572df7c 100644 (file)
@@ -528,7 +528,7 @@ void RandomSeed_Spawn()
        setthink(randomseed, RandomSeed_Think);
        Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
 
-       WITHSELF(randomseed, getthink(randomseed)(randomseed)); // sets random seed and nextthink
+       getthink(randomseed)(randomseed); // sets random seed and nextthink
 }
 
 spawnfunc(__init_dedicated_server)
@@ -1562,7 +1562,7 @@ void NextLevel()
                        bprint(it.netname, " ^7wins.\n");
        ));
 
-       WITHSELF(NULL, target_music_kill());
+       target_music_kill();
 
        if(autocvar_g_campaign)
                CampaignPreIntermission();
index d4c4bb7e5661faed97d57bae933e715b31f1d641..c150d38a83e67b6296e8800db07ea28a69b98312 100644 (file)
@@ -903,7 +903,7 @@ void InitializeEntitiesRun()
         //dprint("Delayed initialization: ", e.classname, "\n");
         if (func)
         {
-               WITHSELF(e, func(e));
+               func(e);
         }
         else
         {
@@ -957,7 +957,7 @@ void adaptor_think2use_hittype_splash(entity this) // for timed projectile deton
 {
        if(!(IS_ONGROUND(this))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
                this.projectiledeathtype |= HITTYPE_SPLASH;
-       WITHSELF(this, adaptor_think2use(this));
+       adaptor_think2use(this);
 }
 
 // deferred dropping
@@ -1033,7 +1033,7 @@ bool SUB_NoImpactCheck(entity this, entity toucher)
        {
                //dprint("A hit happened with zero hit contents... DEBUG THIS, this should never happen for projectiles! Projectile will self-destruct.\n");
                LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", etof(this), this.classname, vtos(this.origin));
-               WITHSELF(this, checkclient());
+               checkclient(this);
        }
     if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
         return true;
index b827f10eaeab295201970fa34297e5115dfce578..ade9cfa3b6c7897184fdab0b52c219e580f1c2f2 100644 (file)
@@ -2563,7 +2563,7 @@ void ctf_SpawnTeam (string teamname, int teamcolor)
        this.netname = teamname;
        this.cnt = teamcolor;
        this.spawnfunc_checked = true;
-       WITHSELF(this, spawnfunc_ctf_team(this));
+       spawnfunc_ctf_team(this);
 }
 
 void ctf_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
index 2eeaafa3063e908ecef2ed8772196531b00f230f..d245721cb8dc5dcf9f19221cc05876fe291ed6ee 100644 (file)
@@ -64,7 +64,7 @@ void tdm_SpawnTeam (string teamname, float teamcolor)
        this.netname = teamname;
        this.cnt = teamcolor;
        this.spawnfunc_checked = true;
-       WITHSELF(this, spawnfunc_tdm_team(this));
+       spawnfunc_tdm_team(this);
 }
 
 void tdm_DelayedInit(entity this)
index e1bf5c0be25236206f696f2a6c81ee81011f3a75..c842dac3f97de50252980274b8c5feab71d23c97 100644 (file)
@@ -239,12 +239,14 @@ void StartFrame()
 bool DoesQ3ARemoveThisEntity(entity this);
 void SV_OnEntityPreSpawnFunction()
 {ENGINE_EVENT();
+       __spawnfunc_expecting = true;
        __spawnfunc_expect = this;
        if (this)
        if (this.gametypefilter != "")
        if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, this.gametypefilter))
        {
                remove(this);
+               __spawnfunc_expecting = false;
                return;
        }
        if(this.cvarfilter != "")
@@ -353,6 +355,7 @@ LABEL(cvar_fail)
                {
                        //print("cvarfilter fail\n");
                        remove(this);
+                       __spawnfunc_expecting = false;
                        return;
                }
        }
@@ -360,6 +363,7 @@ LABEL(cvar_fail)
        if(DoesQ3ARemoveThisEntity(this))
        {
                remove(this);
+               __spawnfunc_expecting = false;
                return;
        }
 
@@ -387,6 +391,7 @@ LABEL(cvar_fail)
        if(MUTATOR_CALLHOOK(OnEntityPreSpawn, this))
        {
                remove(this);
+               __spawnfunc_expecting = false;
                return;
        }
 }