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 4379f52..7e36cab 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 8035fd7..5af2e23 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 f53dbd6..1e4d666 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 cedb98b..51155f2 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 95619a2..44653ae 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 9e9810b..dfa318f 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 defa371..3de5bc9 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 29ac255..aeb75de 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 0ea2f6d..053f0f5 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 d06efdd..6469d17 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 1961214..52d2caf 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 f70108e..b313c49 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 ec9eb76..9849182 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 38eabba..6572221 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 4b3861b..bc43986 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 52a8798..5eb2522 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 36c4cd2..129f4e3 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 2789e12..dd20cf8 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 a9829f6..fe8c20c 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 5c7fd8d..e3edb49 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 bb47951..03a77f0 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 05787ba..2987d0b 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 a5afdac..1a96e23 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 ce12478..ca626dd 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 370ef84..32742d8 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 5e2586c..2b72368 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 fda4366..036d417 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 6c3d4c6..8287643 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 bd0b086..3e9f129 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 70100db..5e10f41 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 4f3356b..b15e847 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 c3891bf..e76545c 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 2cab491..239c3d3 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 08a8ce4..b9395b9 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 1372bd0..76a7a65 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 384c297..3295255 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 339dc49..7a6f255 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 430271d..da4f68d 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 c83f525..1638dc9 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 d349405..3a574b2 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 25f4649..2fb1960 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;