]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Combine `SELFCALL` and `SELFCALL_DONE` with `WITH`
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 2 Sep 2015 09:44:38 +0000 (19:44 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 2 Sep 2015 09:44:38 +0000 (19:44 +1000)
41 files changed:
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/rubble.qc
qcsrc/client/view.qc
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/monsters/spawn.qc
qcsrc/common/movetypes/movetypes.qc
qcsrc/common/movetypes/push.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/subs.qh
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/util-post.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/csqcmodellib/cl_player.qc
qcsrc/lib/Defer.qh
qcsrc/server/anticheat.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_assault.qc
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/mutators/mutator_instagib.qc
qcsrc/server/mutators/mutator_instagib_items.qc
qcsrc/server/mutators/sandbox.qc
qcsrc/server/race.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/weapons/throwing.qc

index 4379f52c27697fe285677d46af2bb81be4f7d4bb..7e36cabec6ee48cc7ae88127f15e2b81d3785c89 100644 (file)
@@ -423,8 +423,7 @@ void CSQCModel_AutoTagIndex_Apply(void)
                // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
                if(self.tag_entity.classname == "csqcmodel")
                {
-                       SELFCALL(self.tag_entity, CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients)));
-                       SELFCALL_DONE();
+                       WITH(entity, self, self.tag_entity, CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients)));
                }
 
                if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex)
index 8035fd76e127028dc218ef2ec5942a3802992add..5af2e235070f7c5d7b63f2fc3d30353f0f206cfd 100644 (file)
@@ -39,8 +39,7 @@ void RubbleLimit(string cname, float limit, void() deleteproc)
                        break;
 
                // delete this oldest one and search again
-               SELFCALL(oldest, deleteproc());
-               SELFCALL_DONE();
+               WITH(entity, self, oldest, deleteproc());
        }
 }
 
index f53dbd6be9270eb46abb4b1773460431711d6331..1e4d666e9cb64c28f2399fb52ebdb5da05d2cf18 100644 (file)
@@ -1467,8 +1467,7 @@ void CSQC_UpdateView(float w, float h)
         */
 
        for(entity e = NULL; (e = nextent(e)); ) if (e.draw) {
-               SELFCALL(e, e.draw());
-               SELFCALL_DONE();
+               WITH(entity, self, e, e.draw());
        }
 
        addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
@@ -1805,8 +1804,7 @@ void CSQC_UpdateView(float w, float h)
 
        // draw 2D entities
        for (entity e = NULL; (e = nextent(e)); ) if (e.draw2d) {
-               SELFCALL(e, e.draw2d());
-               SELFCALL_DONE();
+               WITH(entity, self, e, e.draw2d());
        }
        Draw_ShowNames_All();
 
index cedb98bd77e1508ad0c24b02b90340237da9ce37..51155f236fffaf0357b4615a3e0123c91cc1cd97 100644 (file)
@@ -107,8 +107,7 @@ void HUD_MinigameMenu_Click(entity menuitem)
 {SELFPARAM();
        if ( menuitem )
        {
-               SELFCALL(menuitem, menuitem.use());
-               SELFCALL_DONE();
+               WITH(entity, self, menuitem, menuitem.use());
        }
 }
 
index 95619a2856e5ee2e8ca7e2c347e062ddc44c7903..44653ae9410436f70860fc5d831ab05e1ccb1548 100644 (file)
@@ -150,8 +150,7 @@ int minigame_addplayer(entity minigame_session, entity player)
 
                if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
                {
-                       SELFCALL(player, PutObserverInServer());
-                       SELFCALL_DONE();
+                       WITH(entity, self, player, PutObserverInServer());
                }
                if ( autocvar_sv_minigames_observer == 2 )
                        player.team_forced = -1;
index 9e9810b4638ae42c5704108fdbbc49a8bde0d1e8..dfa318fe3acd92224dcd5e35367b0fc006eeabdc 100644 (file)
@@ -64,8 +64,7 @@ entity spawnmonster (string monster, float monster_id, entity spawnedby, entity
        }
        
        // Monster_Spawn checks if monster is valid
-       SELFCALL(e, Monster_Spawn(monster_id));
-       SELFCALL_DONE();
+       WITH(entity, self, e, Monster_Spawn(monster_id));
 
        return e;
 }
index defa3718f044022d43dc951ebf7b1b9397ce2825..3de5bc9e3da82c7a6631ecaa95290b3138261258 100644 (file)
@@ -337,8 +337,7 @@ void _Movetype_Impact(entity oth)  // SV_Impact
        {
                other = self;
 
-               SELFCALL(oth, oth.move_touch());
-               SELFCALL_DONE();
+               WITH(entity, self, oth, oth.move_touch());
 
                other = oldother;
        }
index 29ac255d60004d95508260be9b4b6347a83c340f..aeb75ded3053773acb45263e9fb46fe86636079b 100644 (file)
@@ -93,15 +93,16 @@ void _Movetype_PushMove(float dt)  // SV_PushMove
                        if (check.move_movetype == 32)  // MOVETYPE_PHYSICS
                        {
                                check.move_origin = check.move_origin + move;
-                               SELFCALL(check, _Movetype_LinkEdict(true));
-                               SELFCALL_DONE();
+                               WITH(entity, self, check, _Movetype_LinkEdict(true));
                                continue;
                        }
 
                        // try moving the contacted entity
                        self.solid = SOLID_NOT;
-                       bool flag = SELFCALL(check, _Movetype_PushEntity(move, true));
-                       SELFCALL_DONE();
+                       bool flag;
+                       WITH(entity, self, check, {
+                               flag = _Movetype_PushEntity(move, true);
+                       });
                        if (!flag)
                        {
                                // entity "check" got teleported
index 0ea2f6dfe28756a2aee3eebe17485d6032d25724..053f0f5f669111264279bd9978756cf276fb92ea 100644 (file)
@@ -273,8 +273,7 @@ void door_use()
 
        if (self.owner)
        {
-               SELFCALL(self.owner, door_fire());
-               SELFCALL_DONE();
+               WITH(entity, self, self.owner, door_fire());
        }
 }
 
@@ -295,8 +294,7 @@ void door_damage(entity inflictor, entity attacker, float damage, int deathtype,
        {
                self.owner.health = self.owner.max_health;
                self.owner.takedamage = DAMAGE_NO;      // wil be reset upon return
-               SELFCALL(self.owner, door_use());
-               SELFCALL_DONE();
+               WITH(entity, self, self.owner, door_use());
        }
 }
 
index d06efdd9437fbfaced138e0f5a83f8a22646dff5..6469d17e6045b5d87d9a225b7db4cc83d894c0c6 100644 (file)
@@ -2,8 +2,7 @@
 void() train_next;
 void train_wait()
 {SELFPARAM();
-       SELFCALL(self.enemy, SUB_UseTargets());
-       SELFCALL_DONE();
+       WITH(entity, self, self.enemy, SUB_UseTargets());
        self.enemy = world;
 
        // if turning is enabled, the train will turn toward the next point while waiting
index 19612143060961d5f06f4c48d6b05e3aa166eb07..52d2caf65aada325c89e45404952dc4dde407b90 100644 (file)
@@ -98,8 +98,7 @@ void misc_laser_think()
                                self.count = 1;
 
                                activator = self.enemy.pusher;
-                               SELFCALL(self.enemy, SUB_UseTargets());
-                               SELFCALL_DONE();
+                               WITH(entity, self, self.enemy, SUB_UseTargets());
                        }
                }
                else
@@ -109,8 +108,7 @@ void misc_laser_think()
                                self.count = 0;
 
                                activator = self.enemy.pusher;
-                               SELFCALL(self.enemy, SUB_UseTargets());
-                               SELFCALL_DONE();
+                               WITH(entity, self, self.enemy, SUB_UseTargets());
                        }
                }
        }
index f70108e88fab5c4d2347221a40d71e30172b6410..b313c49996046e1dec57d08169a891a44fdff6c9 100644 (file)
@@ -294,8 +294,7 @@ void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
 
 void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
 {SELFPARAM();
-       SELFCALL(ent, SUB_CalcMove (tdest, tspeedtype, tspeed, func));
-       SELFCALL_DONE();
+       WITH(entity, self, ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
 }
 
 /*
@@ -363,6 +362,5 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void()
 
 void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
 {SELFPARAM();
-       SELFCALL(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
-       SELFCALL_DONE();
+       WITH(entity, self, ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
 }
index ec9eb7607da9ce11bdf4aaccd90296f4a53c8287..98491820f215da9636d2ce8cd72e7bbffc2e7aaa 100644 (file)
@@ -29,8 +29,7 @@
        void SUB_SETORIGIN(entity s, vector v)
        {SELFPARAM();
                s.move_origin = v;
-               SELFCALL(s, _Movetype_LinkEdict(true));
-               SELFCALL_DONE();
+               WITH(entity, self, s, _Movetype_LinkEdict(true));
        }
 
 #endif
index 38eabbab333da033bc0c5fda7cbfd1975f48bd92..6572221f75a9e008d6c7668e2ff15758a0fb32a7 100644 (file)
@@ -222,8 +222,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                        oldactivator = activator;
 
                        activator = act;
-                       SELFCALL(e, e.target_spawn_spawnfunc());
-                       SELFCALL_DONE();
+                       WITH(entity, self, e, e.target_spawn_spawnfunc());
                        activator = oldactivator;
 
                        // We called an external function, so we have to re-tokenize msg.
index 4b3861b3529a1252fabb73151505f25b44b6680d..bc4398601920968c61cfd7fd9d25f879569461bc 100644 (file)
@@ -229,8 +229,7 @@ void WarpZone_PostTeleportPlayer_Callback(entity pl)
        Reset_ArcBeam(pl, v_forward);
        UpdateCSQCProjectileAfterTeleport(pl);
        {
-               SELFCALL(pl, anticheat_fixangle());
-               SELFCALL_DONE();
+               WITH(entity, self, pl, anticheat_fixangle());
        }
        // "disown" projectiles after teleport
        if(pl.owner)
index 52a8798cd2e2e00b14522dda3d7f9244b43b4d03..5eb25221821def3f73fb5b13d22994f3fb337cd8 100644 (file)
@@ -219,8 +219,7 @@ void trigger_push_touch()
        if(self.enemy.target)
        {
                activator = other;
-               SELFCALL(self.enemy, SUB_UseTargets());
-               SELFCALL_DONE();
+               WITH(entity, self, self.enemy, SUB_UseTargets());
        }
 
        if (other.flags & FL_PROJECTILE)
index 36c4cd22dda731c2e8562d023d05bbaeecc03599..129f4e387cbab7ca43b3e9ec93e3fca1b0ff4973 100644 (file)
@@ -44,8 +44,7 @@ void Teleport_Touch (void)
        SUB_UseTargets();
        if (!self.target) self.target = s;
 
-       SELFCALL(e, SUB_UseTargets());
-       SELFCALL_DONE();
+       WITH(entity, self, e, SUB_UseTargets());
 }
 
 void spawnfunc_trigger_teleport()
index 2789e12358bf57a7997632ea36680e5f1701ef89..dd20cf8f5da131de57e761e7d8f04129ebc90684 100644 (file)
@@ -3,13 +3,18 @@
 
 [[alias("self")]] entity __self;
 
+#define WITH(type, name, value, block) do { \
+    type __with_save = (name); \
+    name = (value); \
+    LAMBDA(block) \
+    name = __with_save; \
+} while (0)
+
 // Step 1: auto oldself
 #if 1
 #define SELFPARAM() noref entity this = __self
 #define setself(s) (__self = s)
 #define self __self
-#define SELFCALL(s, f) (__self = s, f)
-#define SELFCALL_DONE() (__self = this)
 #endif
 
 // Step 2: check SELFPARAM() is present for functions that use self
@@ -17,8 +22,6 @@
 #define SELFPARAM() [[alias("__self")]] noref entity this = __self
 #define setself(s) (__self = s)
 #define self this
-#define SELFCALL(s, f) (this = s, f)
-#define SELFCALL_DONE() (this = this)
 #endif
 
 // Step 3: const self
 entity setself(entity e) { return self = e; }
 entity getself() { return self; }
 #define self getself()
-#define SELFCALL(s, f) (__self = s, f)
-#define SELFCALL_DONE() (__self = this)
 #endif
 
 // Step 4: enable when possible
 #if 0
 #define SELFPARAM() noref const entity this = __self
 #define self this
-#define SELFCALL(s, f) (__self = s, f)
-#define SELFCALL_DONE() (__self = this)
 #endif
 
 #define spawn() new(entity)
index a9829f6129a8ed2da7b51334f9831f52109986d8..fe8c20c7a240367ac85d9064b92b0ab0b380ab90 100644 (file)
@@ -592,8 +592,7 @@ void W_Arc_Beam(float burst)
        beam.beam_bursting = burst;
        Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
-       SELFCALL(beam, beam.think());
-       SELFCALL_DONE();
+       WITH(entity, self, beam, beam.think());
 }
 
 void Arc_Smoke()
index 5c7fd8dfcd49dc1dffd61f25c8ad16c57ca16467..e3edb492eba64b9c5d0e5f057b7f96cccfd18824 100644 (file)
@@ -141,8 +141,7 @@ void W_Blaster_Attack(
 
        if(time >= missile.nextthink)
        {
-               SELFCALL(missile, missile.think());
-               SELFCALL_DONE();
+               WITH(entity, self, missile, missile.think());
        }
 }
 bool W_Blaster(int request)
index bb4795145c212ca4dde529483744647552e37d2b..03a77f0cb9c06302731352a9e4d0a3cc069297b0 100644 (file)
@@ -95,8 +95,7 @@ void W_Porto_Remove(entity p)
 {SELFPARAM();
        if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
        {
-               SELFCALL(p.porto_current, W_Porto_Fail(1));
-               SELFCALL_DONE();
+               WITH(entity, self, p.porto_current, W_Porto_Fail(1));
        }
 }
 
index 05787ba58777650a2522782586f6900e7df64fa3..2987d0b81697c8496d064b9f77410559b7ec6def 100644 (file)
@@ -336,8 +336,7 @@ void W_Tuba_NoteOn(float hittype)
        {
                if(self.tuba_note.cnt != n || self.tuba_note.tuba_instrument != self.tuba_instrument)
                {
-                       SELFCALL(self.tuba_note, W_Tuba_NoteOff());
-                       SELFCALL_DONE();
+                       WITH(entity, self, self.tuba_note, W_Tuba_NoteOff());
                }
        }
 
@@ -404,8 +403,7 @@ bool W_Tuba(int req)
                        {
                                if(!self.BUTTON_ATCK && !self.BUTTON_ATCK2)
                                {
-                                       SELFCALL(self.tuba_note, W_Tuba_NoteOff());
-                                       SELFCALL_DONE();
+                                       WITH(entity, self, self.tuba_note, W_Tuba_NoteOff());
                                }
                        }
 
index a5afdac8f74ef100205cf94b0ca2ed6a7e13efd8..1a96e23dd6d6c0e1fbe77ff4744e541fa3b4ffbf 100644 (file)
@@ -300,14 +300,12 @@ void CSQCPlayer_SetCamera()
                setself(this);
        }
 
-       entity view;
-       view = CSQCModel_server2csqc(player_localentnum);
+       entity view = CSQCModel_server2csqc(player_localentnum);
 
        if(view && view != csqcplayer)
        {
-               SELFCALL(view, InterpolateOrigin_Do());
-               self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
-               SELFCALL_DONE();
+               WITH(entity, self, view, InterpolateOrigin_Do());
+               view.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
        }
 
        if(view)
index ce12478b57cb8832a12abb4b842eaae3232726c8..ca626dd7bd0654c738551b197657223b5493cf91 100644 (file)
@@ -24,8 +24,7 @@ void defer_think()
 {SELFPARAM();
     self.think     = SUB_Remove;
     self.nextthink = time;
-    SELFCALL(self.owner, self.use());
-    SELFCALL_DONE();
+    WITH(entity, self, self.owner, self.use());
 }
 
 /*
index 370ef844e8263bf7840153ad51d80a654b7f6653..32742d82d9555e41330fa559acbee64314a1b7f3 100644 (file)
@@ -237,8 +237,7 @@ void anticheat_endframe()
        entity e;
        FOR_EACH_CLIENT(e)
                if (e.fixangle) {
-                       SELFCALL(e, anticheat_fixangle());
-                       SELFCALL_DONE();
+                       WITH(entity, self, e, anticheat_fixangle());
                }
        anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
 }
index 5e2586cd60598f5c93977aa53786c1897425e20d..2b72368fa56f3a4fcfca3f02fb9f821a81cd2bfd 100644 (file)
@@ -372,8 +372,7 @@ float CheatCommand(float argc)
                                                e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
                                                e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
                                        }
-                                       SELFCALL(e, spawnfunc_func_breakable());
-                                       SELFCALL_DONE();
+                                       WITH(entity, self, e, spawnfunc_func_breakable());
                                        // now, is it valid?
                                        if(f == 0)
                                        {
index fda43661c3f97daca227bad8bbe61d902fbaa6d0..036d417d54d1aed75ae01d45444d1767e24adad1 100644 (file)
@@ -631,8 +631,7 @@ void PutClientInServer()
                string s = spot.target;
                spot.target = string_null;
                activator = self;
-               SELFCALL(spot, SUB_UseTargets());
-               SELFCALL_DONE();
+               WITH(entity, self, spot, SUB_UseTargets());
                activator = world;
                spot.target = s;
 
@@ -736,8 +735,7 @@ void ClientInit_Spawn()
        e.think = ClientInit_CheckUpdate;
        Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
 
-       SELFCALL(e, ClientInit_CheckUpdate());
-       SELFCALL_DONE();
+       WITH(entity, self, e, ClientInit_CheckUpdate());
 }
 
 /*
@@ -847,8 +845,7 @@ void KillIndicator_Think()
 
        if(self.cnt <= 0)
        {
-               SELFCALL(self.owner, ClientKill_Now());
-               SELFCALL_DONE();
+               WITH(entity, self, self.owner, ClientKill_Now());
                return;
        }
     else if(g_cts && self.health == 1) // health == 1 means that it's silent
@@ -1261,8 +1258,7 @@ void ClientConnect (void)
                sv_notice_join();
 
        for (entity e = world; (e = findfloat(e, init_for_player_needed, 1)); ) {
-               SELFCALL(e, e.init_for_player(this));
-               SELFCALL_DONE();
+               WITH(entity, self, e, e.init_for_player(this));
        }
 
        MUTATOR_CALLHOOK(ClientConnect, self);
index 6c3d4c669df079183de55a82f90c63a904e5d06c..8287643b9959a7ad59d131bf786d6ce0c5a4042f 100644 (file)
@@ -209,8 +209,7 @@ void GameCommand_allspec(float request, float argc)
                        {
                                if (client.caplayer)
                                        client.caplayer = 0;
-                               SELFCALL(client, PutObserverInServer());
-                               SELFCALL_DONE();
+                               WITH(entity, self, client, PutObserverInServer());
                                ++i;
                        }
                        if(i) { bprint(strcat("Successfully forced all (", ftos(i), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n")); }
@@ -240,8 +239,7 @@ void GameCommand_anticheat(float request, float argc)
 
                        if(accepted > 0)
                        {
-                               SELFCALL(client, anticheat_report());
-                               SELFCALL_DONE();
+                               WITH(entity, self, client, anticheat_report());
                                return;
                        }
                        else
@@ -1041,8 +1039,7 @@ void GameCommand_moveplayer(float request, float argc)
                                                {
                                                        if (client.caplayer)
                                                                client.caplayer = 0;
-                                                       SELFCALL(client, PutObserverInServer());
-                                                       SELFCALL_DONE();
+                                                       WITH(entity, self, client, PutObserverInServer());
 
                                                        successful = strcat(successful, (successful ? ", " : ""), client.netname);
                                                }
@@ -1194,8 +1191,7 @@ void GameCommand_playerdemo(float request, float argc)
                                                        return;
                                                }
 
-                                               SELFCALL(client, playerdemo_open_read(argv(next_token)));
-                                               SELFCALL_DONE();
+                                               WITH(entity, self, client, playerdemo_open_read(argv(next_token)));
                                                return;
                                        }
 
@@ -1210,8 +1206,7 @@ void GameCommand_playerdemo(float request, float argc)
                                                        return;
                                                }
 
-                                               SELFCALL(client, playerdemo_open_write(argv(next_token)));
-                                               SELFCALL_DONE();
+                                               WITH(entity, self, client, playerdemo_open_write(argv(next_token)));
                                                return;
                                        }
 
index bd0b086574247860f2daf822082c93cc31ecb419..3e9f129622c61ac64dcccc4d2f96a1cdc16547dd 100644 (file)
@@ -392,8 +392,7 @@ void reset_map(float dorespawn)
        FOR_EACH_PLAYER(e)
        if(e.frozen)
        {
-               SELFCALL(e, Unfreeze(self));
-               SELFCALL_DONE();
+               WITH(entity, self, e, Unfreeze(self));
        }
 
        // Moving the player reset code here since the player-reset depends
index 70100db991cb6512b72dada67d18d539cff3e172..5e10f41a041e97633aa490e49de3c4094e84acd7 100644 (file)
@@ -576,8 +576,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
        targ.iceblock = ice;
        targ.revival_time = 0;
 
-       SELFCALL(ice, Ice_Think());
-       SELFCALL_DONE();
+       WITH(entity, self, ice, Ice_Think());
 
        RemoveGrapplingHook(targ);
 
index 4f3356b65f5aab455b58e95ece3312f3ca0f57ca..b15e847c59be00694a36cc89acc2d8406f7566b8 100644 (file)
@@ -531,8 +531,7 @@ void RandomSeed_Spawn()
        randomseed.think = RandomSeed_Think;
        Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
 
-       SELFCALL(randomseed, randomseed.think()); // sets random seed and nextthink
-       SELFCALL_DONE();
+       WITH(entity, self, randomseed, randomseed.think()); // sets random seed and nextthink
 }
 
 void spawnfunc___init_dedicated_server(void)
@@ -1724,8 +1723,7 @@ float WinningCondition_Assault()
                        }
                        else
                        {
-                               SELFCALL(ent, assault_new_round());
-                               SELFCALL_DONE();
+                               WITH(entity, self, ent, assault_new_round());
                        }
                }
        }
index c3891bf241de4e2c546dfbb86313ea34b0b5653a..e76545c73e769073c9e5f7593a58237c1b42871d 100644 (file)
@@ -1196,8 +1196,7 @@ void InitializeEntitiesRun()
         //dprint("Delayed initialization: ", e.classname, "\n");
         if (func)
         {
-               SELFCALL(e, func());
-            SELFCALL_DONE();
+               WITH(entity, self, e, func());
         }
         else
         {
@@ -1213,8 +1212,7 @@ void UncustomizeEntitiesRun()
 {SELFPARAM();
     for (entity e = NULL; (e = findfloat(e, uncustomizeentityforclient_set, 1)); )
     {
-        SELFCALL(e, e.uncustomizeentityforclient());
-        SELFCALL_DONE();
+        WITH(entity, self, e, e.uncustomizeentityforclient());
     }
 }
 void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer)
index 2cab4918ddc5805541fc57be23f07d9a2398f968..239c3d3b4bf262da7ab8ba7d1cc2120930505f1c 100644 (file)
@@ -17,8 +17,7 @@ void assault_objective_use()
        {
                if (e.classname == "target_objective_decrease")
                {
-                       SELFCALL(e, target_objective_decrease_activate());
-                       SELFCALL_DONE();
+                       WITH(entity, self, e, target_objective_decrease_activate());
                }
        }
 
@@ -178,8 +177,7 @@ void assault_roundstart_use()
                        ent.team = NUM_TEAM_1;
 
                // Dubbles as teamchange
-               SELFCALL(ent, turret_respawn());
-               SELFCALL_DONE();
+               WITH(entity, self, ent, turret_respawn());
        }
 }
 
@@ -213,8 +211,7 @@ void assault_new_round()
     {
         if(e.vehicle)
         {
-               SELFCALL(e, vehicles_exit(VHEF_RELEASE));
-            SELFCALL_DONE();
+               WITH(entity, self, e, vehicles_exit(VHEF_RELEASE));
         }
     }
 
index 08a8ce4b6b7e302ec4f7c8e0eb66cc6f6ff0b9c7..b9395b913a2ad018feeca4540da7dc7adebb513d 100644 (file)
@@ -41,8 +41,7 @@ MUTATOR_HOOKFUNCTION(lms_ResetPlayers)
        FOR_EACH_CLIENT(e)
        if(IS_PLAYER(e))
        {
-               SELFCALL(e, PlayerScore_Add(e, SP_LMS_LIVES, LMS_NewPlayerLives()));
-               SELFCALL_DONE();
+               WITH(entity, self, e, PlayerScore_Add(e, SP_LMS_LIVES, LMS_NewPlayerLives()));
        }
 
        return false;
index 1372bd09d9d62276ad732ebb6d2f666ed50bb87b..76a7a65d57b7f97954a20e92280d96254b90f87c 100644 (file)
@@ -1701,8 +1701,7 @@ MUTATOR_HOOKFUNCTION(ons_ResetMap)
        {
                e.ons_roundlost = false;
                e.ons_deathloc = '0 0 0';
-               SELFCALL(e, PutClientInServer());
-               SELFCALL_DONE();
+               WITH(entity, self, e, PutClientInServer());
        }
        return false;
 }
index 384c297808aa29ea61d34f8bd5ed0fd57bb06ea7..3295255de23cfde95c48004ed72d4bf894b9e159 100644 (file)
@@ -345,8 +345,7 @@ MUTATOR_HOOKFUNCTION(instagib_FilterItem)
                e.noalign = self.noalign;
         e.cnt = self.cnt;
         e.team = self.team;
-               SELFCALL(e, spawnfunc_item_minst_cells());
-               SELFCALL_DONE();
+               WITH(entity, self, e, spawnfunc_item_minst_cells());
                return true;
        }
 
index 339dc49aa5365f0e5f672fa520d1458acafffc79..7a6f255efe3dc051f6f4d131a5bbc362f8add97a 100644 (file)
@@ -1,8 +1,5 @@
 #include "../../common/items/item.qh"
 
-#define WITH(it) this.m_##it;
-#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
-
 float instagib_respawntime_ammo = 45;
 float instagib_respawntimejitter_ammo = 0;
 GETTER(float, instagib_respawntime_ammo)
@@ -31,6 +28,3 @@ REGISTER_ITEM(ExtraLife, Powerup) {
     this.m_botvalue             =   BOT_PICKUP_RATING_HIGH;
 #endif
 }
-
-#undef WITH
-#undef CONFIGURE
index 430271d80df059113ca1cb8e3ba81e126201830c..da4f68d58eea020a6468cebc589a88d126a76ad3 100644 (file)
@@ -178,8 +178,7 @@ entity sandbox_ObjectSpawn(float database)
                e.angles_y = self.v_angle.y;
        }
 
-       SELFCALL(e, CSQCMODEL_AUTOINIT(e));
-       SELFCALL_DONE();
+       WITH(entity, self, e, CSQCMODEL_AUTOINIT(e));
 
        object_count += 1;
        return e;
index c83f5252fe4c4a99e67c099d0f5c0ee0b0f30b79..1638dc9855d6bc012cc48490a5cbbb0afbc684d3 100644 (file)
@@ -1087,8 +1087,7 @@ void race_ClearRecords()
        FOR_EACH_CLIENT(e)
        {
                float p = e.race_place;
-               SELFCALL(e, race_PreparePlayer());
-               SELFCALL_DONE();
+               WITH(entity, self, e, race_PreparePlayer());
                e.race_place = p;
        }
 }
index d349405bdcc1668274b95b0069fdff479399de20..3a574b28b2bfead37bf5a6eb73380f6f5af382ca 100644 (file)
@@ -258,8 +258,9 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck)
                        ++found;
                        if(ent.spawn_evalfunc)
                        {
-                               spawn_score = SELFCALL(ent, ent.spawn_evalfunc(this, spot, spawn_score));
-                               SELFCALL_DONE();
+                               WITH(entity, self, ent, {
+                                       spawn_score = ent.spawn_evalfunc(this, spot, spawn_score);
+                               });
                                if(spawn_score.x < 0)
                                        return spawn_score;
                        }
index 25f4649140c2aa15a6e7f0af40baaee2b2c31783..2fb19609eaf71685cc33a15d7d9ca700fb870cc2 100644 (file)
@@ -74,8 +74,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                }
        }
 
-       SELFCALL(wep, weapon_defaultspawnfunc(wpn));
-       SELFCALL_DONE();
+       WITH(entity, self, wep, weapon_defaultspawnfunc(wpn));
        if(startitem_failed)
                return string_null;
        wep.glowmod = own.weaponentity_glowmod;