Remove SELFPARAM() from .think and .touch 322/head
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 24 May 2016 12:01:49 +0000 (22:01 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 24 May 2016 12:01:49 +0000 (22:01 +1000)
162 files changed:
qcsrc/client/announcer.qc
qcsrc/client/main.qc
qcsrc/client/shownames.qc
qcsrc/client/weapons/projectile.qc
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/effects/qc/gibs.qc
qcsrc/common/ent_cs.qc
qcsrc/common/ent_cs.qh
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc
qcsrc/common/minigames/minigame/pong.qc
qcsrc/common/minigames/minigame/snake.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/monsters/sv_monsters.qh
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/physical_items/physical_items.qc
qcsrc/common/mutators/mutator/sandbox/sandbox.qc
qcsrc/common/mutators/mutator/superspec/superspec.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
qcsrc/common/notifications/all.qc
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/movetypes.qh
qcsrc/common/physics/movetypes/push.qc
qcsrc/common/sounds/sound.qh
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/triggers/func/bobbing.qc
qcsrc/common/triggers/func/breakable.qc
qcsrc/common/triggers/func/button.qc
qcsrc/common/triggers/func/conveyor.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/func/fourier.qc
qcsrc/common/triggers/func/ladder.qc
qcsrc/common/triggers/func/pendulum.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/func/rotating.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/func/vectormamamam.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/platforms.qc
qcsrc/common/triggers/platforms.qh
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/subs.qh
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/target/music.qh
qcsrc/common/triggers/teleporters.qh
qcsrc/common/triggers/trigger/gravity.qc
qcsrc/common/triggers/trigger/heal.qc
qcsrc/common/triggers/trigger/hurt.qc
qcsrc/common/triggers/trigger/impulse.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh
qcsrc/common/triggers/trigger/keylock.qc
qcsrc/common/triggers/trigger/monoflop.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/multivibrator.qc
qcsrc/common/triggers/trigger/secret.qc
qcsrc/common/triggers/trigger/swamp.qc
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/common/triggers/trigger/viewloc.qc
qcsrc/common/triggers/triggers.qc
qcsrc/common/turrets/checkpoint.qc
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/sv_turrets.qh
qcsrc/common/turrets/targettrigger.qc
qcsrc/common/turrets/turret/flac_weapon.qc
qcsrc/common/turrets/turret/hellion_weapon.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/turrets/turret/phaser_weapon.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/lib/defer.qh
qcsrc/lib/net.qh
qcsrc/lib/self.qh
qcsrc/lib/warpzone/client.qc
qcsrc/lib/warpzone/common.qc
qcsrc/lib/warpzone/server.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/bot/waypoints.qh
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/cl_player.qh
qcsrc/server/command/common.qc
qcsrc/server/command/common.qh
qcsrc/server/command/radarmap.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_lights.qc
qcsrc/server/g_subs.qh
qcsrc/server/g_world.qc
qcsrc/server/ipban.qc
qcsrc/server/item_key.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qh
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/pathlib/debug.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/path_waypoint.qc
qcsrc/server/portals.qc
qcsrc/server/race.qc
qcsrc/server/round_handler.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/t_quake3.qc
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/common.qh
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/throwing.qh
qcsrc/server/weapons/weaponsystem.qc

index 656349a..e5fd7d5 100644 (file)
@@ -17,9 +17,8 @@ string AnnouncerOption()
 
 entity announcer_countdown;
 
-void Announcer_Countdown()
+void Announcer_Countdown(entity this)
 {
-       SELFPARAM();
        float starttime = STAT(GAMESTARTTIME);
        float roundstarttime = STAT(ROUNDSTARTTIME);
        if(roundstarttime == -1)
index 1767b8f..2baa971 100644 (file)
@@ -290,9 +290,8 @@ float SetTeam(entity o, int Team)
        return false;
 }
 
-void Playerchecker_Think()
+void Playerchecker_Think(entity this)
 {
-       SELFPARAM();
     int i;
        entity e;
        for(i = 0; i < maxclients; ++i)
index 79acf4f..e9db990 100644 (file)
@@ -177,7 +177,7 @@ void Draw_ShowNames_All()
                }
                make_impure(it);
                assert(getthink(entcs), eprint(entcs));
-               WITHSELF(entcs, getthink(entcs)());
+               WITHSELF(entcs, getthink(entcs)(entcs));
                if (!entcs.has_origin) continue;
                if (entcs.m_entcs_private)
                {
index 8763ba2..6261fa8 100644 (file)
@@ -22,12 +22,6 @@ void SUB_Stop(entity this)
        this.move_movetype = MOVETYPE_NONE;
 }
 
-void SUB_Stop_self()
-{
-       SELFPARAM();
-       SUB_Stop(this);
-}
-
 void Projectile_ResetTrail(entity this, vector to)
 {
        this.trail_oldorigin = to;
@@ -337,7 +331,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                this.mins = '0 0 0';
                this.maxs = '0 0 0';
                this.colormod = '0 0 0';
-               settouch(this, SUB_Stop_self);
+               settouch(this, SUB_Stop);
                this.move_movetype = MOVETYPE_TOSS;
                this.alphamod = 1;
 
index bb954e2..8cb4a2a 100644 (file)
@@ -83,8 +83,8 @@ Sound SND_CASINGS_RANDOM() {
     return Sounds_from(SND_CASINGS1.m_id + floor(prandom() * 3));
 }
 
-void Casing_Touch()
-{SELFPARAM();
+void Casing_Touch(entity this)
+{
     if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
     {
         Casing_Delete(self);
index c8afaf9..3d67392 100644 (file)
@@ -69,8 +69,8 @@ void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad
 .int state;
 .bool isplayermodel;
 
-void DamageEffect_Think()
-{SELFPARAM();
+void DamageEffect_Think(entity this)
+{
        // if particle distribution is enabled, slow ticrate by total number of damages
        if(autocvar_cl_damageeffect_distribute)
                this.nextthink = time + autocvar_cl_damageeffect_ticrate * this.owner.total_damages;
index eaf7250..20b050c 100644 (file)
@@ -111,15 +111,14 @@ void new_te_bloodshower (int ef, vector org, float explosionspeed, int howmany)
                __pointparticles(ef, org, randomvec() * explosionspeed, howmany / 50);
 }
 
-void SUB_RemoveOnNoImpact()
+void SUB_RemoveOnNoImpact(entity this)
 {
-    SELFPARAM();
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
                Gib_Delete(self);
 }
 
-void Gib_Touch()
-{SELFPARAM();
+void Gib_Touch(entity this)
+{
        // TODO maybe bounce of walls, make more gibs, etc.
 
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
index 64ddc44..75deb92 100644 (file)
@@ -83,9 +83,8 @@
                return _entcs_send(this, to, sf, MSG_ENTITY);
        }
 
-       void entcs_think()
+       void entcs_think(entity this)
        {
-               SELFPARAM();
                this.nextthink = time + 0.033333333333;  // TODO: increase this to like 0.15 once the client can do smoothing
                entity o = this.owner;
                int i = 1;
                if (e != this) remove(e);
        }
 
-       void entcs_think()
+       void entcs_think(entity this)
        {
-               SELFPARAM();
                entity e = CSQCModel_server2csqc(this.sv_entnum);
                if (e == NULL)
                {
        #undef X
                this.iflags |= IFLAG_ORIGIN;
                InterpolateOrigin_Note(this);
-               WITHSELF(this, getthink(this)());
+               WITHSELF(this, getthink(this)(this));
                return true;
        }
 
index 0d02e4b..1c72b35 100644 (file)
@@ -26,7 +26,7 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
 
        bool entcs_send(entity this, entity to, int sf);
 
-       void entcs_think();
+       void entcs_think(entity this);
 
        void entcs_attach(entity e);
 
index 1ce1af8..5063071 100644 (file)
@@ -40,9 +40,9 @@ float autocvar_g_balance_nexball_secondary_lifetime;
 float autocvar_g_balance_nexball_secondary_refire;
 float autocvar_g_balance_nexball_secondary_speed;
 
-void basketball_touch();
-void football_touch();
-void ResetBall();
+void basketball_touch(entity this);
+void football_touch(entity this);
+void ResetBall(entity this);
 const int NBM_NONE = 0;
 const int NBM_FOOTBALL = 2;
 const int NBM_BASKETBALL = 4;
@@ -84,7 +84,7 @@ void ball_restart(entity this)
 {
        if(this.owner)
                DropBall(this, this.owner.origin, '0 0 0');
-       ResetBall();
+       ResetBall(this);
 }
 
 void nexball_setstatus()
@@ -96,7 +96,8 @@ void nexball_setstatus()
                {
                        bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n");
                        DropBall(this.ballcarried, this.ballcarried.owner.origin, '0 0 0');
-                       WITHSELF(this.ballcarried, ResetBall());
+                       entity e = this.ballcarried;
+                       WITHSELF(e, ResetBall(e));
                }
                else
                        this.items |= IT_KEY1;
@@ -120,8 +121,8 @@ void relocate_nexball(entity this)
        }
 }
 
-void DropOwner()
-{SELFPARAM();
+void DropOwner(entity this)
+{
        entity ownr;
        ownr = this.owner;
        DropBall(this, ownr.origin, ownr.velocity);
@@ -220,8 +221,8 @@ void DropBall(entity ball, vector org, vector vel)
        ball.owner = world;
 }
 
-void InitBall()
-{SELFPARAM();
+void InitBall(entity this)
+{
        if(gameover) return;
        UNSET_ONGROUND(this);
        this.movetype = MOVETYPE_BOUNCE;
@@ -240,8 +241,8 @@ void InitBall()
        LogNB("init", world);
 }
 
-void ResetBall()
-{SELFPARAM();
+void ResetBall(entity this)
+{
        if(this.cnt < 2)        // step 1
        {
                if(time == this.teamtime)
@@ -276,8 +277,8 @@ void ResetBall()
        }
 }
 
-void football_touch()
-{SELFPARAM();
+void football_touch(entity this)
+{
        if(other.solid == SOLID_BSP)
        {
                if(time > self.lastground + 0.1)
@@ -322,11 +323,11 @@ void football_touch()
        self.avelocity = -250 * v_forward;  // maybe there is a way to make it look better?
 }
 
-void basketball_touch()
-{SELFPARAM();
+void basketball_touch(entity this)
+{
        if(other.ballcarried)
        {
-               football_touch();
+               football_touch(this);
                return;
        }
        if(!self.cnt && IS_PLAYER(other) && !STAT(FROZEN, other) && !IS_DEAD(other) && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect))
@@ -344,8 +345,8 @@ void basketball_touch()
        }
 }
 
-void GoalTouch()
-{SELFPARAM();
+void GoalTouch(entity this)
+{
        entity ball;
        float isclient, pscore, otherteam;
        string pname;
@@ -702,8 +703,8 @@ spawnfunc(ball_bound)
 //=======================//
 
 
-void W_Nexball_Think()
-{SELFPARAM();
+void W_Nexball_Think(entity this)
+{
        //dprint("W_Nexball_Think\n");
        //vector new_dir = steerlib_arrive(this.enemy.origin, 2500);
        vector new_dir = normalize(this.enemy.origin + '0 0 50' - this.origin);
@@ -717,8 +718,8 @@ void W_Nexball_Think()
        this.nextthink = time;
 }
 
-void W_Nexball_Touch()
-{SELFPARAM();
+void W_Nexball_Touch(entity this)
+{
        entity ball, attacker;
        attacker = self.owner;
        //self.think = func_null;
@@ -816,7 +817,7 @@ void W_Nexball_Attack2()
        W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
        missile.angles = vectoangles(missile.velocity);
        settouch(missile, W_Nexball_Touch);
-       setthink(missile, SUB_Remove_self);
+       setthink(missile, SUB_Remove);
        missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
 
        missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
index 38799f2..0870ed6 100644 (file)
@@ -172,8 +172,8 @@ bool ons_CaptureShield_Customize()
        return true;
 }
 
-void ons_CaptureShield_Touch()
-{SELFPARAM();
+void ons_CaptureShield_Touch(entity this)
+{
        if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, other.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; }
        if(!IS_PLAYER(other)) { return; }
        if(SAME_TEAM(other, self)) { return; }
@@ -395,8 +395,8 @@ bool ons_Link_Send(entity this, entity to, int sendflags)
        return true;
 }
 
-void ons_Link_CheckUpdate()
-{SELFPARAM();
+void ons_Link_CheckUpdate(entity this)
+{
        // TODO check if the two sides have moved (currently they won't move anyway)
        float cc = 0, cc1 = 0, cc2 = 0;
 
@@ -559,8 +559,8 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
        this.SendFlags |= CPSF_STATUS;
 }
 
-void ons_ControlPoint_Icon_Think()
-{SELFPARAM();
+void ons_ControlPoint_Icon_Think(entity this)
+{
        this.nextthink = time + ONS_CP_THINKRATE;
 
        if(autocvar_g_onslaught_cp_proxydecap)
@@ -627,8 +627,8 @@ void ons_ControlPoint_Icon_Think()
        }
 }
 
-void ons_ControlPoint_Icon_BuildThink()
-{SELFPARAM();
+void ons_ControlPoint_Icon_BuildThink(entity this)
+{
        int a;
 
        this.nextthink = time + ONS_CP_THINKRATE;
@@ -681,7 +681,7 @@ void ons_ControlPoint_Icon_BuildThink()
                Send_Effect(EFFECT_RAGE, this.origin + 10 * randomvec(), '0 0 -1', 1);
 }
 
-void onslaught_controlpoint_icon_link(entity e, void() spawnproc);
+void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc);
 
 void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
 {
@@ -776,8 +776,8 @@ void ons_ControlPoint_UpdateSprite(entity e)
        }
 }
 
-void ons_ControlPoint_Touch()
-{SELFPARAM();
+void ons_ControlPoint_Touch(entity this)
+{
        entity toucher = other;
        int attackable;
 
@@ -813,8 +813,8 @@ void ons_ControlPoint_Touch()
        onslaught_updatelinks();
 }
 
-void ons_ControlPoint_Think()
-{SELFPARAM();
+void ons_ControlPoint_Think(entity this)
+{
        self.nextthink = time + ONS_CP_THINKRATE;
        CSQCMODEL_AUTOUPDATE(self);
 }
@@ -1021,8 +1021,8 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d
        this.SendFlags |= GSF_STATUS;
 }
 
-void ons_GeneratorThink()
-{SELFPARAM();
+void ons_GeneratorThink(entity this)
+{
        this.nextthink = time + GEN_THINKRATE;
        if (!gameover)
        {
@@ -1083,8 +1083,8 @@ void ons_DelayedGeneratorSetup(entity this)
 }
 
 
-void onslaught_generator_touch()
-{SELFPARAM();
+void onslaught_generator_touch(entity this)
+{
        if ( IS_PLAYER(other) )
        if ( SAME_TEAM(self,other) )
        if ( self.iscaptured )
@@ -2156,7 +2156,7 @@ MUTATOR_HOOKFUNCTION(ons, TurretThink)
        }
 
        if(self.team != self.tur_head.team)
-               turret_respawn();
+               turret_respawn(self);
 
        return false;
 }
index be46b28..aceb3e6 100644 (file)
@@ -32,7 +32,7 @@ bool cpicon_send(entity this, entity to, int sf)
        return true;
 }
 
-void onslaught_controlpoint_icon_link(entity e, void() spawnproc)
+void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc)
 {
        Net_LinkEntity(e, true, 0, cpicon_send);
        setthink(e, spawnproc);
index f025545..aeac4e1 100644 (file)
@@ -29,7 +29,7 @@ bool generator_send(entity this, entity to, int sf)
        return true;
 }
 
-void generator_link(void() spawnproc)
+void generator_link(void(entity this) spawnproc)
 {SELFPARAM();
        Net_LinkEntity(self, true, 0, generator_send);
        setthink(self, spawnproc);
index 1499898..4bcb8c5 100644 (file)
@@ -36,7 +36,7 @@ float autocvar_sv_minigames_pong_ball_number;
 float autocvar_sv_minigames_pong_ai_thinkspeed;
 float autocvar_sv_minigames_pong_ai_tolerance;
 
-void pong_ball_think();
+void pong_ball_think(entity this);
 
 // Throws a ball in a random direction and sets the think function
 void pong_ball_throw(entity ball)
@@ -54,8 +54,8 @@ void pong_ball_throw(entity ball)
 }
 
 // Think equivalent of pong_ball_throw, used to delay throws
-void pong_ball_throwthink()
-{SELFPARAM();
+void pong_ball_throwthink(entity this)
+{
        pong_ball_throw(self);
 }
 
@@ -145,8 +145,8 @@ bool pong_goal(entity ball, int pteam)
 }
 
 // Moves the ball around
-void pong_ball_think()
-{SELFPARAM();
+void pong_ball_think(entity this)
+{
        float think_speed = autocvar_sys_ticrate;
        this.nextthink = time + think_speed;
 
@@ -201,8 +201,8 @@ void pong_ball_think()
 }
 
 // AI action
-void pong_ai_think()
-{SELFPARAM();
+void pong_ai_think(entity this)
+{
        float think_speed = autocvar_sv_minigames_pong_ai_thinkspeed;
        this.nextthink = time + think_speed;
 
@@ -266,8 +266,8 @@ entity pong_ai_spawn(entity paddle)
 }
 
 // Moves the paddle
-void pong_paddle_think()
-{SELFPARAM();
+void pong_paddle_think(entity this)
+{
        float think_speed = autocvar_sys_ticrate;
        this.nextthink = time + think_speed;
 
index 95fda67..9872909 100644 (file)
@@ -153,9 +153,8 @@ void snake_check_winner(entity minigame)
 }
 
 void snake_move_head(entity minigame, entity head);
-void snake_head_think()
+void snake_head_think(entity this)
 {
-    SELFPARAM();
        entity minigame = this.owner;
 
        if(minigame.minigame_flags & SNAKE_TURN_MOVE)
index 0f3ea81..50e9061 100644 (file)
@@ -160,9 +160,8 @@ void M_Mage_Attack_Spike_Explode(entity this)
        remove (this);
 }
 
-void M_Mage_Attack_Spike_Touch()
+void M_Mage_Attack_Spike_Touch(entity this)
 {
-    SELFPARAM();
        PROJECTILE_TOUCH;
 
        M_Mage_Attack_Spike_Explode(self);
@@ -171,8 +170,8 @@ void M_Mage_Attack_Spike_Touch()
 .float wait;
 
 // copied from W_Seeker_Think
-void M_Mage_Attack_Spike_Think()
-{SELFPARAM();
+void M_Mage_Attack_Spike_Think(entity this)
+{
        if (time > this.ltime || (this.enemy && this.enemy.health <= 0) || this.owner.health <= 0) {
                this.projectiledeathtype |= HITTYPE_SPLASH;
                M_Mage_Attack_Spike_Explode(this);
index 751d0ff..c2e1388 100644 (file)
@@ -101,7 +101,7 @@ void M_Shambler_Attack_Lightning_Explode(entity this)
                Damage(head, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
        }
 
-       setthink(this, SUB_Remove_self);
+       setthink(this, SUB_Remove);
        this.nextthink = time + 0.2;
 }
 
@@ -124,15 +124,15 @@ void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity at
                W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
 }
 
-void M_Shambler_Attack_Lightning_Touch()
-{SELFPARAM();
+void M_Shambler_Attack_Lightning_Touch(entity this)
+{
        PROJECTILE_TOUCH;
 
        self.use(this, NULL, NULL);
 }
 
-void M_Shambler_Attack_Lightning_Think()
-{SELFPARAM();
+void M_Shambler_Attack_Lightning_Think(entity this)
+{
        this.nextthink = time;
        if (time > this.cnt)
        {
index 2645120..281accb 100644 (file)
@@ -156,14 +156,14 @@ void M_Spider_Attack_Web_Explode_use(entity this, entity actor, entity trigger)
        WITHSELF(this, M_Spider_Attack_Web_Explode());
 }
 
-void M_Spider_Attack_Web_Touch()
+void M_Spider_Attack_Web_Touch(entity this)
 {
        PROJECTILE_TOUCH;
 
        M_Spider_Attack_Web_Explode();
 }
 
-void adaptor_think2use_hittype_splash();
+void adaptor_think2use_hittype_splash(entity this);
 
 void M_Spider_Attack_Web(entity this)
 {
index 87cc5d7..a0e6705 100644 (file)
@@ -45,8 +45,8 @@ float autocvar_g_monster_wyvern_attack_fireball_force;
 float autocvar_g_monster_wyvern_attack_fireball_radius;
 float autocvar_g_monster_wyvern_attack_fireball_speed;
 
-void M_Wyvern_Attack_Fireball_Explode();
-void M_Wyvern_Attack_Fireball_Touch();
+void M_Wyvern_Attack_Fireball_Explode(entity this);
+void M_Wyvern_Attack_Fireball_Touch(entity this);
 
 SOUND(WyvernAttack_FIRE, W_Sound("electro_fire"));
 METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire))
@@ -99,9 +99,8 @@ const float wyvern_anim_pain  = 3;
 const float wyvern_anim_death  = 4;
 */
 
-void M_Wyvern_Attack_Fireball_Explode()
+void M_Wyvern_Attack_Fireball_Explode(entity this)
 {
-       SELFPARAM();
        Send_Effect(EFFECT_FIREBALL_EXPLODE, this.origin, '0 0 0', 1);
 
        entity own = this.realowner;
@@ -117,11 +116,11 @@ void M_Wyvern_Attack_Fireball_Explode()
        remove(this);
 }
 
-void M_Wyvern_Attack_Fireball_Touch()
+void M_Wyvern_Attack_Fireball_Touch(entity this)
 {
        PROJECTILE_TOUCH;
 
-       M_Wyvern_Attack_Fireball_Explode();
+       M_Wyvern_Attack_Fireball_Explode(this);
 }
 
 bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
index ffbb06c..ec84bb9 100644 (file)
@@ -75,8 +75,8 @@ const float zombie_anim_spawn                         = 30;
 
 .vector moveto;
 
-void M_Zombie_Attack_Leap_Touch()
-{SELFPARAM();
+void M_Zombie_Attack_Leap_Touch(entity this)
+{
        if (self.health <= 0)
                return;
 
index f1a0576..2e7281b 100644 (file)
@@ -191,7 +191,6 @@ void monster_changeteam(entity ent, float newteam)
 }
 
 .void(entity) monster_delayedfunc;
-void Monster_Delay_Action_self();
 void Monster_Delay_Action(entity this)
 {
        if(Monster_ValidTarget(this.owner, this.owner.enemy)) { this.monster_delayedfunc(this.owner); }
@@ -199,28 +198,22 @@ void Monster_Delay_Action(entity this)
        if(this.cnt > 1)
        {
                this.cnt -= 1;
-               setthink(this, Monster_Delay_Action_self);
+               setthink(this, Monster_Delay_Action);
                this.nextthink = time + this.count;
        }
        else
        {
-               setthink(this, SUB_Remove_self);
+               setthink(this, SUB_Remove);
                this.nextthink = time;
        }
 }
 
-void Monster_Delay_Action_self()
-{
-    SELFPARAM();
-       Monster_Delay_Action(this);
-}
-
 void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
 {
        // deferred attacking, checks if monster is still alive and target is still valid before attacking
        entity e = spawn();
 
-       setthink(e, Monster_Delay_Action_self);
+       setthink(e, Monster_Delay_Action);
        e.nextthink = time + defer_amnt;
        e.count = defer_amnt;
        e.owner = this;
@@ -401,7 +394,7 @@ bool Monster_Attack_Leap_Check(entity this, vector vel)
        return true;
 }
 
-bool Monster_Attack_Leap(entity this, vector anm, void() touchfunc, vector vel, float animtime)
+bool Monster_Attack_Leap(entity this, vector anm, void(entity this) touchfunc, vector vel, float animtime)
 {
        if(!Monster_Attack_Leap_Check(this, vel))
                return false;
@@ -473,8 +466,8 @@ void Monster_UpdateModel(entity this)
        mon.mr_anim(mon, this);
 }
 
-void Monster_Touch()
-{SELFPARAM();
+void Monster_Touch(entity this)
+{
        if(other == world) { return; }
 
        if(other.monster_attack)
@@ -516,7 +509,7 @@ bool Monster_Respawn_Check(entity this)
        return true;
 }
 
-void Monster_Respawn() { SELFPARAM(); Monster_Spawn(this, this.monsterid); }
+void Monster_Respawn(entity this) { Monster_Spawn(this, this.monsterid); }
 
 void Monster_Dead_Fade(entity this)
 {
@@ -919,8 +912,8 @@ void Monster_Remove(entity this)
        remove(this);
 }
 
-void Monster_Dead_Think()
-{SELFPARAM();
+void Monster_Dead_Think(entity this)
+{
        this.nextthink = time + this.ticrate;
 
        if(this.monster_lifetime != 0)
@@ -980,7 +973,7 @@ void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float d
                // number of monsters spawned with mobspawn command
                totalspawned -= 1;
 
-               setthink(this, SUB_Remove_self);
+               setthink(this, SUB_Remove);
                this.nextthink = time + 0.1;
                this.event_damage = func_null;
        }
@@ -1115,7 +1108,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
                {
                        Violence_GibSplash(this, 1, 0.5, attacker);
 
-                       setthink(this, SUB_Remove_self);
+                       setthink(this, SUB_Remove);
                        this.nextthink = time + 0.1;
                }
        }
@@ -1214,8 +1207,8 @@ void Monster_Anim(entity this)
        */
 }
 
-void Monster_Think()
-{SELFPARAM();
+void Monster_Think(entity this)
+{
        setthink(this, Monster_Think);
        this.nextthink = this.ticrate;
 
index 59d8cbd..f8501fc 100644 (file)
@@ -77,7 +77,7 @@ bool Monster_Spawn(entity this, int mon_id);
 
 void monster_setupcolors(entity this);
 
-void Monster_Touch();
+void Monster_Touch(entity this);
 
 void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff);
 
@@ -85,7 +85,7 @@ void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity)
 
 float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop);
 
-bool Monster_Attack_Leap(entity this, vector anm, void() touchfunc, vector vel, float animtime);
+bool Monster_Attack_Leap(entity this, vector anm, void(entity this) touchfunc, vector vel, float animtime);
 
 entity Monster_FindTarget(entity this);
 
index d0d206a..c450dc5 100644 (file)
@@ -222,8 +222,8 @@ void buff_Respawn(entity this)
        sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 }
 
-void buff_Touch()
-{SELFPARAM();
+void buff_Touch(entity this)
+{
        if(gameover) { return; }
 
        if(ITEM_TOUCH_NEEDKILL())
@@ -298,8 +298,8 @@ void buff_NewType(entity ent, float cb)
        ent.buffs = RandomSelection_chosen_float;
 }
 
-void buff_Think()
-{SELFPARAM();
+void buff_Think(entity this)
+{
        if(this.buffs != this.oldbuffs)
        {
                entity buff = buff_FirstFromFlags(this.buffs);
@@ -474,8 +474,8 @@ void buff_SpawnReplacement(entity ent, entity old)
        buff_Init(ent);
 }
 
-void buff_Vengeance_DelayedDamage()
-{SELFPARAM();
+void buff_Vengeance_DelayedDamage(entity this)
+{
        if(this.enemy)
                Damage(this.enemy, this.owner, this.owner, this.dmg, DEATH_BUFF.m_id, this.enemy.origin, '0 0 0');
 
@@ -889,7 +889,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
                                {
                                        entity oldother = other;
                                        other = self;
-                                       WITHSELF(it, gettouch(it)());
+                                       WITHSELF(it, gettouch(it)(it));
                                        other = oldother;
                                }
                        }
index 8721ced..fe33046 100644 (file)
@@ -29,19 +29,19 @@ spawnfunc(item_minst_cells)
        StartItem(this, ITEM_VaporizerCells);
 }
 
-void instagib_invisibility()
-{SELFPARAM();
+void instagib_invisibility(entity this)
+{
        this.strength_finished = autocvar_g_balance_powerup_strength_time;
        StartItem(this, ITEM_Invisibility);
 }
 
-void instagib_extralife()
-{SELFPARAM();
+void instagib_extralife(entity this)
+{
        StartItem(this, ITEM_ExtraLife);
 }
 
-void instagib_speed()
-{SELFPARAM();
+void instagib_speed(entity this)
+{
        this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
        StartItem(this, ITEM_Speed);
 }
index 39310c9..a6a2f72 100644 (file)
@@ -147,8 +147,8 @@ REGISTER_MUTATOR(nades, cvar("g_nades"));
 
 .entity nade_spawnloc;
 
-void nade_timer_think()
-{SELFPARAM();
+void nade_timer_think(entity this)
+{
        this.skin = 8 - (this.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10);
        this.nextthink = time;
        if(!this.owner || wasfreed(this.owner))
@@ -216,8 +216,8 @@ void napalm_damage(entity this, float dist, float damage, float edgedamage, floa
 }
 
 
-void napalm_ball_think()
-{SELFPARAM();
+void napalm_ball_think(entity this)
+{
        if(round_handler_IsActive())
        if(!round_handler_IsRoundStarted())
        {
@@ -289,8 +289,8 @@ void nade_napalm_ball(entity this)
 }
 
 
-void napalm_fountain_think()
-{SELFPARAM();
+void napalm_fountain_think(entity this)
+{
 
        if(round_handler_IsActive())
        if(!round_handler_IsRoundStarted())
@@ -363,8 +363,8 @@ void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time)
        Drop_Special_Items(frost_target);
 }
 
-void nade_ice_think()
-{SELFPARAM();
+void nade_ice_think(entity this)
+{
 
        if(round_handler_IsActive())
        if(!round_handler_IsRoundStarted())
@@ -502,8 +502,8 @@ void nade_spawn_boom(entity this)
        this.realowner.nade_spawnloc = spawnloc;
 }
 
-void nade_heal_think()
-{SELFPARAM();
+void nade_heal_think(entity this)
+{
        if(time >= self.ltime)
        {
                remove(self);
@@ -521,8 +521,8 @@ void nade_heal_think()
                self.nade_show_particles = 0;
 }
 
-void nade_heal_touch()
-{SELFPARAM();
+void nade_heal_touch(entity this)
+{
        float maxhealth;
        float health_factor;
        if(IS_PLAYER(other) || IS_MONSTER(other))
@@ -598,8 +598,8 @@ void nade_monster_boom(entity this)
        e.monster_skill = MONSTER_SKILL_INSANE;
 }
 
-void nade_boom()
-{SELFPARAM();
+void nade_boom(entity this)
+{
        entity expef = NULL;
        bool nade_blast = true;
 
@@ -688,8 +688,8 @@ void nade_pickup(entity this, entity thenade)
 }
 
 bool CanThrowNade(entity this);
-void nade_touch()
-{SELFPARAM();
+void nade_touch(entity this)
+{
        if(other)
                UpdateCSQCProjectile(self);
 
@@ -735,11 +735,11 @@ void nade_touch()
        }
 
        self.enemy = other;
-       nade_boom();
+       nade_boom(self);
 }
 
-void nade_beep()
-{SELFPARAM();
+void nade_beep(entity this)
+{
        sound(this, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
        setthink(this, nade_boom);
        this.nextthink = max(this.wait, time);
@@ -750,7 +750,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
                this.takedamage = DAMAGE_NO;
-               WITHSELF(this, nade_boom());
+               WITHSELF(this, nade_boom(this));
                return;
        }
 
@@ -981,7 +981,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        fn.colormod = Nades_from(n.nade_type).m_color;
        fn.colormap = player.colormap;
        fn.glowmod = player.glowmod;
-       setthink(fn, SUB_Remove_self);
+       setthink(fn, SUB_Remove);
        fn.nextthink = n.wait;
 
        player.nade = n;
index 6f3c146..c670879 100644 (file)
@@ -267,8 +267,8 @@ MUTATOR_HOOKFUNCTION(ok, PlayerSpawn)
        return false;
 }
 
-void self_spawnfunc_weapon_hmg() { SELFPARAM(); spawnfunc_weapon_hmg(this); }
-void self_spawnfunc_weapon_rpc() { SELFPARAM(); spawnfunc_weapon_rpc(this); }
+void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); }
+void self_spawnfunc_weapon_rpc(entity this) { spawnfunc_weapon_rpc(this); }
 
 MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
 {SELFPARAM();
index c11ebc8..860e37b 100644 (file)
@@ -50,8 +50,8 @@ REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw));
 #ifdef SVQC
 spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(this, WEP_RPC); }
 
-void W_RocketPropelledChainsaw_Explode()
-{SELFPARAM();
+void W_RocketPropelledChainsaw_Explode(entity this)
+{
        self.event_damage = func_null;
        self.takedamage = DAMAGE_NO;
 
@@ -60,13 +60,13 @@ void W_RocketPropelledChainsaw_Explode()
        remove (self);
 }
 
-void W_RocketPropelledChainsaw_Touch ()
-{SELFPARAM();
+void W_RocketPropelledChainsaw_Touch (entity this)
+{
        if(WarpZone_Projectile_Touch())
                if(wasfreed(self))
                        return;
 
-       W_RocketPropelledChainsaw_Explode();
+       W_RocketPropelledChainsaw_Explode(this);
 }
 
 void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -83,8 +83,8 @@ void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity atta
                W_PrepareExplosionByDamage(this, attacker, W_RocketPropelledChainsaw_Explode);
 }
 
-void W_RocketPropelledChainsaw_Think()
-{SELFPARAM();
+void W_RocketPropelledChainsaw_Think(entity this)
+{
        if(self.cnt <= time)
        {
                remove(self);
index c9ab81b..3ef52fe 100644 (file)
@@ -31,8 +31,8 @@ REGISTER_MUTATOR(physical_items, cvar("g_physical_items"))
 
 .vector spawn_origin, spawn_angles;
 
-void physical_item_think()
-{SELFPARAM();
+void physical_item_think(entity this)
+{
        self.nextthink = time;
 
        self.alpha = self.owner.alpha; // apply fading and ghosting
@@ -68,8 +68,8 @@ void physical_item_think()
                remove(self); // the real item is gone, remove this
 }
 
-void physical_item_touch()
-{SELFPARAM();
+void physical_item_touch(entity this)
+{
        if(!self.cnt) // not for dropped items
        if (ITEM_TOUCH_NEEDKILL())
        {
index 9d592f2..b3e9ea1 100644 (file)
@@ -46,8 +46,8 @@ float object_count;
 .string material;
 
 .float touch_timer;
-void sandbox_ObjectFunction_Touch()
-{SELFPARAM();
+void sandbox_ObjectFunction_Touch(entity this)
+{
        // apply material impact effects
 
        if(!self.material)
@@ -71,8 +71,8 @@ void sandbox_ObjectFunction_Touch()
        Send_Effect_(strcat("impact_", self.material), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10
 }
 
-void sandbox_ObjectFunction_Think()
-{SELFPARAM();
+void sandbox_ObjectFunction_Think(entity this)
+{
        // decide if and how this object can be grabbed
        if(autocvar_g_sandbox_readonly)
                self.grab = 0; // no grabbing
index ae10cb5..142f9d9 100644 (file)
@@ -377,8 +377,8 @@ MUTATOR_HOOKFUNCTION(superspec, BuildMutatorsPrettyString)
        return 0;
 }
 
-void superspec_hello()
-{SELFPARAM();
+void superspec_hello(entity this)
+{
        if(self.enemy.crypto_idfp == "")
                Send_Notification(NOTIF_ONE_ONLY, self.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID);
 
index ad2fb84..3e82db0 100644 (file)
@@ -903,8 +903,8 @@ void WaypointSprite_Disown(entity wp, float fadetime)
     }
 }
 
-void WaypointSprite_Think()
-{SELFPARAM();
+void WaypointSprite_Think(entity this)
+{
     bool doremove = false;
 
     if (self.fade_time && time >= self.teleport_time)
index 66ad9d5..385d9fa 100644 (file)
@@ -160,7 +160,7 @@ void WaypointSprite_Kill(entity wp);
 
 void WaypointSprite_Disown(entity wp, float fadetime);
 
-void WaypointSprite_Think();
+void WaypointSprite_Think(entity this);
 
 bool WaypointSprite_visible_for_player(entity this, entity player, entity view);
 
index ab448b1..3d3c786 100644 (file)
@@ -1478,9 +1478,8 @@ NET_HANDLE(ENT_CLIENT_NOTIFICATION, bool is_new)
 #endif
 
 #ifdef SVQC
-void Net_Notification_Remove()
+void Net_Notification_Remove(entity this)
 {
-       SELFPARAM();
        #ifdef NOTIFICATIONS_DEBUG
        Debug_Notification(sprintf(
                "Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
index 6ec82ab..ce7d04d 100644 (file)
@@ -321,7 +321,7 @@ void _Movetype_Impact(entity this, entity oth)  // SV_Impact
        {
                other = oth;
 
-               WITHSELF(this, gettouch(this)());
+               WITHSELF(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)());
+               WITHSELF(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)());
+                       WITHSELF(it, gettouch(it)(it));
                }
     });
 
index 7c08c41..931a063 100644 (file)
@@ -6,7 +6,7 @@
 #define UNSET_ONGROUND(s)                   ((s).flags &= ~FL_ONGROUND)
 
 .float move_ltime;
-.void()move_think;
+.void(entity this) move_think;
 .float move_nextthink;
 .void()move_blocked;
 
index b3cfb87..276b104 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());
+               WITHSELF(this, this.move_think(this));
        }
 }
index e84c09e..90b2758 100644 (file)
@@ -76,7 +76,7 @@ const float VOL_BASEVOICE = 1.0;
                        auto = true; \
                        __chan = fabs(__chan); \
                        entity tmp = __e = new(csqc_autochannel); \
-                       setthink(tmp, SUB_Remove_self); \
+                       setthink(tmp, SUB_Remove); \
                        tmp.nextthink = time + soundlength(__samp); \
                } \
                vector old_origin = __e.origin; \
index 6ec1666..60ee6c8 100644 (file)
@@ -471,8 +471,8 @@ void Item_Show (entity e, float mode)
        e.SendFlags |= ISF_STATUS;
 }
 
-void Item_Think()
-{SELFPARAM();
+void Item_Think(entity this)
+{
        self.nextthink = time;
        if(self.origin != self.oldorigin)
                ItemUpdate(self);
@@ -510,8 +510,8 @@ void Item_Respawn ()
        Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
 }
 
-void Item_RespawnCountdown ()
-{SELFPARAM();
+void Item_RespawnCountdown (entity this)
+{
        if(self.count >= ITEM_RESPAWN_TICKS)
        {
                if(self.waypointsprite_attached)
@@ -568,8 +568,8 @@ void Item_RespawnCountdown ()
        }
 }
 
-void Item_RespawnThink()
-{SELFPARAM();
+void Item_RespawnThink(entity this)
+{
        self.nextthink = time;
        if(self.origin != self.oldorigin)
                ItemUpdate(self);
@@ -761,9 +761,8 @@ LABEL(skip)
        return 1;
 }
 
-void Item_Touch()
+void Item_Touch(entity this)
 {
-       SELFPARAM();
 
        // remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
        if (this.classname == "droppedweapon")
@@ -901,8 +900,8 @@ void Item_FindTeam(entity this)
 }
 
 // Savage: used for item garbage-collection
-void RemoveItem()
-{SELFPARAM();
+void RemoveItem(entity this)
+{
        if(wasfreed(self) || !self) { return; }
        Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
        remove(self);
@@ -1028,7 +1027,7 @@ float commodity_pickupevalfunc(entity player, entity item)
 void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
-               WITHSELF(this, RemoveItem());
+               WITHSELF(this, RemoveItem(this));
 }
 
 void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
index ce83078..3ba0a0d 100644 (file)
@@ -74,7 +74,7 @@ void Item_Show (entity e, float mode);
 
 void Item_Respawn ();
 
-void Item_RespawnCountdown ();
+void Item_RespawnCountdown(entity this);
 void Item_ScheduleRespawnIn(entity e, float t);
 
 void Item_ScheduleRespawn(entity e);
@@ -88,7 +88,7 @@ float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax
 
 float Item_GiveTo(entity item, entity player);
 
-void Item_Touch();
+void Item_Touch(entity this);
 
 void Item_Reset(entity this);
 
index 7039d15..e030632 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef SVQC
 .float height;
-void func_bobbing_controller_think()
-{SELFPARAM();
+void func_bobbing_controller_think(entity this)
+{
        vector v;
        self.nextthink = time + 0.1;
 
@@ -74,7 +74,7 @@ spawnfunc(func_bobbing)
        controller.nextthink = time + 1;
        setthink(controller, func_bobbing_controller_think);
        this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
-       this.SUB_THINK = SUB_NullThink;
+       SUB_THINK(this, SUB_NullThink);
 
        // Savage: Reduce bandwith, critical on e.g. nexdm02
        this.effects |= EF_LOWPRECISION;
index e11680b..2467626 100644 (file)
@@ -189,8 +189,8 @@ void func_breakable_restore(entity this, entity actor, entity trigger)
        CSQCMODEL_AUTOUPDATE(this);
 }
 
-void func_breakable_restore_self()
-{SELFPARAM();
+void func_breakable_restore_self(entity this)
+{
        func_breakable_restore(this, NULL, NULL);
 }
 
@@ -231,8 +231,8 @@ void func_breakable_destroy(entity this, entity actor, entity trigger)
        this.message = oldmsg;
 }
 
-void func_breakable_destroy_self()
-{SELFPARAM();
+void func_breakable_destroy_self(entity this)
+{
        func_breakable_destroy(this, NULL, NULL);
 }
 
index 0a0547b..5584f9f 100644 (file)
@@ -1,25 +1,25 @@
 #ifdef SVQC
 // button and multiple button
 
-void() button_wait;
-void() button_return;
+void button_wait(entity this);
+void button_return(entity this);
 
-void button_wait()
-{SELFPARAM();
+void button_wait(entity this)
+{
        self.state = STATE_TOP;
        self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
-       self.SUB_THINK = button_return;
+       SUB_THINK(self, button_return);
        SUB_UseTargets(self, self.enemy, NULL);
        self.frame = 1;                 // use alternate textures
 }
 
-void button_done()
-{SELFPARAM();
+void button_done(entity this)
+{
        self.state = STATE_BOTTOM;
 }
 
-void button_return()
-{SELFPARAM();
+void button_return(entity this)
+{
        self.state = STATE_DOWN;
        SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, button_done);
        self.frame = 0;                 // use normal textures
@@ -68,8 +68,8 @@ void button_use(entity this, entity actor, entity trigger)
        WITHSELF(this, button_fire());
 }
 
-void button_touch()
-{SELFPARAM();
+void button_touch(entity this)
+{
        if (!other)
                return;
        if (!other.iscreature)
index 6ad2e80..a4be9fe 100644 (file)
@@ -1,7 +1,7 @@
 REGISTER_NET_LINKED(ENT_CLIENT_CONVEYOR)
 
-void conveyor_think()
-{SELFPARAM();
+void conveyor_think(entity this)
+{
 #ifdef CSQC
        // TODO: check if this is what is causing the glitchiness when switching between them
        float dt = time - self.move_time;
@@ -147,7 +147,7 @@ spawnfunc(func_conveyor)
 
 #elif defined(CSQC)
 
-void conveyor_draw(entity this) { WITHSELF(this, conveyor_think()); }
+void conveyor_draw(entity this) { WITHSELF(this, conveyor_think(this)); }
 
 void conveyor_init(entity this)
 {
index e0c62c0..92afdeb 100644 (file)
@@ -20,9 +20,9 @@ THINK FUNCTIONS
 =============================================================================
 */
 
-void() door_go_down;
+void door_go_down(entity this);
 void() door_go_up;
-void() door_rotating_go_down;
+void door_rotating_go_down(entity this);
 void() door_rotating_go_up;
 
 void door_blocked()
@@ -66,10 +66,10 @@ void door_blocked()
                                else
                        if (self.classname == "door")
                        {
-                               door_go_down ();
+                               door_go_down (self);
                        } else
                        {
-                               door_rotating_go_down ();
+                               door_rotating_go_down (self);
                        }
                        }
                }
@@ -84,8 +84,8 @@ void door_blocked()
        }
 }
 
-void door_hit_top()
-{SELFPARAM();
+void door_hit_top(entity this)
+{
        if (self.noise1 != "")
                _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = STATE_TOP;
@@ -93,23 +93,23 @@ void door_hit_top()
                return;         // don't come down automatically
        if (self.classname == "door")
        {
-               self.SUB_THINK = door_go_down;
+               SUB_THINK(self, door_go_down);
        } else
        {
-               self.SUB_THINK = door_rotating_go_down;
+               SUB_THINK(self, door_rotating_go_down);
        }
        self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
 }
 
-void door_hit_bottom()
-{SELFPARAM();
+void door_hit_bottom(entity this)
+{
        if (self.noise1 != "")
                _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = STATE_BOTTOM;
 }
 
-void door_go_down()
-{SELFPARAM();
+void door_go_down(entity this)
+{
        if (self.noise2 != "")
                _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
        if (self.max_health)
@@ -218,9 +218,9 @@ void door_fire(entity this, entity actor, entity trigger)
                        entity e = this;
                        do {
                                if (e.classname == "door") {
-                                       WITHSELF(e, door_go_down());
+                                       WITHSELF(e, door_go_down(e));
                                } else {
-                                       WITHSELF(e, door_rotating_go_down());
+                                       WITHSELF(e, door_rotating_go_down(e));
                                }
                                e = e.enemy;
                        } while ((e != this) && (e != NULL));
@@ -289,8 +289,8 @@ Prints messages
 ================
 */
 
-void door_touch()
-{SELFPARAM();
+void door_touch(entity this)
+{
        if (!IS_PLAYER(other))
                return;
        if (self.owner.door_finished > time)
@@ -332,7 +332,7 @@ void door_generic_plat_blocked()
                                if (self.state == STATE_DOWN)
                                        door_rotating_go_up ();
                                else
-                                       door_rotating_go_down ();
+                                       door_rotating_go_down (self);
                        }
                }
 #ifdef SVQC
@@ -346,19 +346,19 @@ void door_generic_plat_blocked()
        }
 }
 
-void door_rotating_hit_top()
-{SELFPARAM();
+void door_rotating_hit_top(entity this)
+{
        if (self.noise1 != "")
                _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = STATE_TOP;
        if (self.spawnflags & DOOR_TOGGLE)
                return;         // don't come down automatically
-       self.SUB_THINK = door_rotating_go_down;
+       SUB_THINK(self, door_rotating_go_down);
        self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
 }
 
-void door_rotating_hit_bottom()
-{SELFPARAM();
+void door_rotating_hit_bottom(entity this)
+{
        if (self.noise1 != "")
                _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating
@@ -369,8 +369,8 @@ void door_rotating_hit_bottom()
        self.state = STATE_BOTTOM;
 }
 
-void door_rotating_go_down()
-{SELFPARAM();
+void door_rotating_go_down(entity this)
+{
        if (self.noise2 != "")
                _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
        if (self.max_health)
@@ -414,8 +414,8 @@ Spawned if a door lacks a real activator
 =========================================
 */
 
-void door_trigger_touch()
-{SELFPARAM();
+void door_trigger_touch(entity this)
+{
        if (other.health < 1)
 #ifdef SVQC
                if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !IS_DEAD(other)))
@@ -688,7 +688,7 @@ void door_reset(entity this)
        SUB_SETORIGIN(this, this.pos1);
        this.SUB_VELOCITY = '0 0 0';
        this.state = STATE_BOTTOM;
-       this.SUB_THINK = func_null;
+       SUB_THINK(this, func_null);
        this.SUB_NEXTTHINK = 0;
 
 #ifdef SVQC
index da88e4d..12008e4 100644 (file)
@@ -1,11 +1,11 @@
 #ifdef SVQC
-void() fd_secret_move1;
-void() fd_secret_move2;
-void() fd_secret_move3;
-void() fd_secret_move4;
-void() fd_secret_move5;
-void() fd_secret_move6;
-void() fd_secret_done;
+void fd_secret_move1(entity this);
+void fd_secret_move2(entity this);
+void fd_secret_move3(entity this);
+void fd_secret_move4(entity this);
+void fd_secret_move5(entity this);
+void fd_secret_move6(entity this);
+void fd_secret_done(entity this);
 
 const float SECRET_OPEN_ONCE = 1;              // stays open
 const float SECRET_1ST_LEFT = 2;               // 1st move is left of arrow
@@ -69,8 +69,8 @@ void fd_secret_damage(entity this, entity inflictor, entity attacker, float dama
 }
 
 // Wait after first movement...
-void fd_secret_move1()
-{SELFPARAM();
+void fd_secret_move1(entity this)
+{
        self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
        setthink(self, fd_secret_move2);
        if (self.noise3 != "")
@@ -78,16 +78,16 @@ void fd_secret_move1()
 }
 
 // Start moving sideways w/sound...
-void fd_secret_move2()
-{SELFPARAM();
+void fd_secret_move2(entity this)
+{
        if (self.noise2 != "")
                _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
        SUB_CalcMove(self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3);
 }
 
 // Wait here until time to go back...
-void fd_secret_move3()
-{SELFPARAM();
+void fd_secret_move3(entity this)
+{
        if (self.noise3 != "")
                _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
        if (!(self.spawnflags & SECRET_OPEN_ONCE))
@@ -98,31 +98,31 @@ void fd_secret_move3()
 }
 
 // Move backward...
-void fd_secret_move4()
-{SELFPARAM();
+void fd_secret_move4(entity this)
+{
        if (self.noise2 != "")
                _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
        SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5);
 }
 
 // Wait 1 second...
-void fd_secret_move5()
-{SELFPARAM();
+void fd_secret_move5(entity this)
+{
        self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
        setthink(self, fd_secret_move6);
        if (self.noise3 != "")
                _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
 }
 
-void fd_secret_move6()
-{SELFPARAM();
+void fd_secret_move6(entity this)
+{
        if (self.noise2 != "")
                _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
        SUB_CalcMove(self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done);
 }
 
-void fd_secret_done()
-{SELFPARAM();
+void fd_secret_done(entity this)
+{
        if (self.spawnflags&SECRET_YES_SHOOT)
        {
                self.health = 10000;
@@ -150,8 +150,8 @@ secret_touch
 Prints messages
 ================
 */
-void secret_touch()
-{SELFPARAM();
+void secret_touch(entity this)
+{
        if (!other.iscreature)
                return;
        if (self.door_finished > time)
index 057fcdc..53366aa 100644 (file)
@@ -10,8 +10,8 @@ dmg: Do this mutch dmg every .dmgtime intervall when blocked
 dmgtime: See above.
 */
 
-void func_fourier_controller_think()
-{SELFPARAM();
+void func_fourier_controller_think(entity this)
+{
        vector v;
        float n, i, t;
 
@@ -78,7 +78,7 @@ spawnfunc(func_fourier)
        controller.nextthink = time + 1;
        setthink(controller, func_fourier_controller_think);
        this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
-       this.SUB_THINK = SUB_NullThink; // for PushMove
+       SUB_THINK(this, SUB_NullThink); // for PushMove
 
        // Savage: Reduce bandwith, critical on e.g. nexdm02
        this.effects |= EF_LOWPRECISION;
index 18b7206..e0108cd 100644 (file)
@@ -1,7 +1,7 @@
 REGISTER_NET_LINKED(ENT_CLIENT_LADDER)
 
-void func_ladder_touch()
-{SELFPARAM();
+void func_ladder_touch(entity this)
+{
 #ifdef SVQC
        if (!other.iscreature)
                return;
index bcfc6e8..e05b2a6 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef SVQC
 .float freq;
-void func_pendulum_controller_think()
-{SELFPARAM();
+void func_pendulum_controller_think(entity this)
+{
        float v;
        self.nextthink = time + 0.1;
 
@@ -67,7 +67,7 @@ spawnfunc(func_pendulum)
        controller.nextthink = time + 1;
        setthink(controller, func_pendulum_controller_think);
        this.nextthink = this.SUB_LTIME + 999999999;
-       this.SUB_THINK = SUB_NullThink; // for PushMove
+       SUB_THINK(this, SUB_NullThink); // for PushMove
 
        //this.effects |= EF_LOWPRECISION;
 
index 7f7ec8e..a2502da 100644 (file)
@@ -93,8 +93,8 @@ void pointparticles_use(entity this, entity actor, entity trigger)
        this.SendFlags |= 2;
 }
 
-void pointparticles_think()
-{SELFPARAM();
+void pointparticles_think(entity this)
+{
        if(self.origin != self.oldorigin)
        {
                self.SendFlags |= 4;
index 3f9a88f..f34d41e 100644 (file)
@@ -69,7 +69,7 @@ spawnfunc(func_rotating)
 
        // wait for targets to spawn
        this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
-       this.SUB_THINK = SUB_NullThink; // for PushMove
+       SUB_THINK(this, SUB_NullThink); // for PushMove
 
        // TODO make a reset function for this one
 }
index 6c674d4..9c73e2b 100644 (file)
@@ -1,10 +1,10 @@
 .float train_wait_turning;
-void() train_next;
+void train_next(entity this);
 #ifdef SVQC
 void train_use(entity this, entity actor, entity trigger);
 #endif
-void train_wait()
-{SELFPARAM();
+void train_wait(entity this)
+{
        SUB_UseTargets(this.enemy, NULL, NULL);
        self.enemy = world;
 
@@ -44,7 +44,7 @@ void train_wait()
        if(tg.spawnflags & 4)
        {
                self.use = train_use;
-               self.SUB_THINK = func_null;
+               SUB_THINK(self, func_null);
                self.SUB_NEXTTHINK = 0;
        }
        else
@@ -52,17 +52,17 @@ void train_wait()
             if(self.wait < 0 || self.train_wait_turning) // no waiting or we already waited while turning
        {
                self.train_wait_turning = false;
-               train_next();
+               train_next(self);
        }
        else
        {
-               self.SUB_THINK = train_next;
+               SUB_THINK(self, train_next);
                self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
        }
 }
 
-void train_next()
-{SELFPARAM();
+void train_next(entity this)
+{
        entity targ, cp = world;
        vector cp_org = '0 0 0';
 
@@ -179,7 +179,7 @@ void train_link()
 void train_use(entity this, entity actor, entity trigger)
 {
        this.SUB_NEXTTHINK = this.SUB_LTIME + 1;
-       this.SUB_THINK = train_next;
+       SUB_THINK(this, train_next);
        this.use = func_null; // not again
 }
 
@@ -195,7 +195,7 @@ void func_train_find(entity this)
        if(!(self.spawnflags & 4))
        {
                self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
-               self.SUB_THINK = train_next;
+               SUB_THINK(self, train_next);
        }
 
        train_link();
@@ -324,7 +324,7 @@ NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew)
                // but we will need these
                //this.move_nextthink = this.move_ltime + 0.1;
                //this.move_think = train_next;
-               WITHSELF(this, train_next());
+               WITHSELF(this, train_next(this));
 
                this.move_movetype = MOVETYPE_PUSH;
                this.move_origin = this.origin;
index eb7a542..b3e931b 100644 (file)
@@ -57,8 +57,8 @@ vector func_vectormamamam_origin(entity o, float t)
        return v;
 }
 
-void func_vectormamamam_controller_think()
-{SELFPARAM();
+void func_vectormamamam_controller_think(entity this)
+{
        self.nextthink = time + 0.1;
 
        if(self.owner.active != ACTIVE_ACTIVE)
@@ -146,7 +146,7 @@ spawnfunc(func_vectormamamam)
 
        // wait for targets to spawn
        this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
-       this.SUB_THINK = SUB_NullThink; // for PushMove
+       SUB_THINK(this, SUB_NullThink); // for PushMove
 
        // Savage: Reduce bandwith, critical on e.g. nexdm02
        this.effects |= EF_LOWPRECISION;
index 937d68c..f0aafc7 100644 (file)
@@ -56,8 +56,8 @@ void misc_laser_init(entity this)
 }
 
 .entity pusher;
-void misc_laser_think()
-{SELFPARAM();
+void misc_laser_think(entity this)
+{
        vector o;
        entity hitent;
        vector hitloc;
index d165095..7b583f1 100644 (file)
@@ -58,23 +58,23 @@ void plat_spawn_inside_trigger()
        objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
 }
 
-void plat_hit_top()
-{SELFPARAM();
+void plat_hit_top(entity this)
+{
        _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = 1;
 
-       self.SUB_THINK = plat_go_down;
+       SUB_THINK(self, plat_go_down);
        self.SUB_NEXTTHINK = self.SUB_LTIME + 3;
 }
 
-void plat_hit_bottom()
-{SELFPARAM();
+void plat_hit_bottom(entity this)
+{
        _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = 2;
 }
 
-void plat_go_down()
-{SELFPARAM();
+void plat_go_down(entity this)
+{
        _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
        self.state = 3;
        SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
@@ -87,8 +87,8 @@ void plat_go_up()
        SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
 }
 
-void plat_center_touch()
-{SELFPARAM();
+void plat_center_touch(entity this)
+{
 #ifdef SVQC
        if (!other.iscreature)
                return;
@@ -108,8 +108,8 @@ void plat_center_touch()
                self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1;
 }
 
-void plat_outside_touch()
-{SELFPARAM();
+void plat_outside_touch(entity this)
+{
 #ifdef SVQC
        if (!other.iscreature)
                return;
@@ -121,8 +121,10 @@ void plat_outside_touch()
                return;
 #endif
 
-       if (self.enemy.state == 1)
-               WITHSELF(self.enemy, plat_go_down());
+       if (self.enemy.state == 1) {
+           entity e = self.enemy;
+               WITHSELF(e, plat_go_down(e));
+    }
 }
 
 void plat_trigger_use(entity this, entity actor, entity trigger)
@@ -134,7 +136,7 @@ void plat_trigger_use(entity this, entity actor, entity trigger)
        if(this.move_think)
                return;
 #endif
-       WITHSELF(this, plat_go_down());
+       WITHSELF(this, plat_go_down(this));
 }
 
 
@@ -159,7 +161,7 @@ void plat_crush()
 #endif
 
                if (self.state == 4)
-                       plat_go_down ();
+                       plat_go_down (self);
                else if (self.state == 3)
                        plat_go_up ();
        // when in other states, then the plat_crush event came delayed after
@@ -173,7 +175,7 @@ void plat_use(entity this, entity actor, entity trigger)
        this.use = func_null;
        if (this.state != 4)
                objerror ("plat_use: not in up state");
-       WITHSELF(this, plat_go_down());
+       WITHSELF(this, plat_go_down(this));
 }
 
 .string sound1, sound2;
index 9a32e32..f73da63 100644 (file)
@@ -3,11 +3,11 @@
 
 .float dmgtime2;
 
-void() plat_center_touch;
-void() plat_outside_touch;
+void plat_center_touch(entity this);
+void plat_outside_touch(entity this);
 void plat_trigger_use(entity this, entity actor, entity trigger);
 void() plat_go_up;
-void() plat_go_down;
+void plat_go_down(entity this);
 void() plat_crush;
 const float PLAT_LOW_TRIGGER = 1;
 
index bcc7c05..c2be7c7 100644 (file)
@@ -1,7 +1,7 @@
-void SUB_NullThink() { }
+void SUB_NullThink(entity this) { }
 
-void()  SUB_CalcMoveDone;
-void() SUB_CalcAngleMoveDone;
+void SUB_CalcMoveDone(entity this);
+void SUB_CalcAngleMoveDone(entity this);
 
 /*
 ==================
@@ -44,11 +44,11 @@ void SUB_VanishOrRemove (entity ent)
        }
 }
 
-void SUB_SetFade_Think ()
-{SELFPARAM();
+void SUB_SetFade_Think (entity this)
+{
        if(this.alpha == 0)
                this.alpha = 1;
-       this.SUB_THINK = SUB_SetFade_Think;
+       SUB_THINK(this, SUB_SetFade_Think);
        this.SUB_NEXTTHINK = time;
        this.alpha -= frametime * this.fade_rate;
        if (this.alpha < 0.01)
@@ -67,7 +67,7 @@ Fade 'ent' out when time >= 'when'
 void SUB_SetFade (entity ent, float when, float fading_time)
 {
        ent.fade_rate = 1/fading_time;
-       ent.SUB_THINK = SUB_SetFade_Think;
+       SUB_THINK(ent, SUB_SetFade_Think);
        ent.SUB_NEXTTHINK = when;
 }
 
@@ -79,20 +79,20 @@ calculate self.SUB_VELOCITY and self.SUB_NEXTTHINK to reach dest from
 self.SUB_ORIGIN traveling at speed
 ===============
 */
-void SUB_CalcMoveDone ()
-{SELFPARAM();
+void SUB_CalcMoveDone(entity this)
+{
        // After moving, set origin to exact final destination
 
        SUB_SETORIGIN (self, self.finaldest);
        self.SUB_VELOCITY = '0 0 0';
        self.SUB_NEXTTHINK = -1;
        if (self.think1)
-               self.think1 ();
+               self.think1 (self);
 }
 
 .float platmovetype_turn;
-void SUB_CalcMove_controller_think ()
-{SELFPARAM();
+void SUB_CalcMove_controller_think (entity this)
+{
        float traveltime;
        float phasepos;
        float nexttick;
@@ -143,9 +143,9 @@ void SUB_CalcMove_controller_think ()
        {
                // derivative: delta + 2 * delta2 (e.g. for angle positioning)
                entity own = self.owner;
-               own.SUB_THINK = self.think1;
+               SUB_THINK(own, self.think1);
                remove(self);
-               WITHSELF(own, own.SUB_THINK());
+               WITHSELF(own, SUB_THUNK(own)(own));
        }
 }
 
@@ -183,7 +183,7 @@ float TSPEED_START = 1;
 float TSPEED_END = 2;
 // TODO average too?
 
-void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func)
+void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
 {SELFPARAM();
        float   traveltime;
        entity controller;
@@ -193,7 +193,7 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float
 
        self.think1 = func;
        self.finaldest = tdest;
-       self.SUB_THINK = SUB_CalcMoveDone;
+       SUB_THINK(self, SUB_CalcMoveDone);
 
        switch(tspeedtype)
        {
@@ -229,17 +229,17 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float
        controller.animstate_starttime = time;
        controller.animstate_endtime = time + traveltime;
        setthink(controller, SUB_CalcMove_controller_think);
-       controller.think1 = self.SUB_THINK;
+       controller.think1 = SUB_THUNK(self);
 
        // the thinking is now done by the controller
-       self.SUB_THINK = SUB_NullThink; // for PushMove
+       SUB_THINK(self, SUB_NullThink); // for PushMove
        self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
 
        // invoke controller
-       WITHSELF(controller, getthink(controller)());
+       WITHSELF(controller, getthink(controller)(controller));
 }
 
-void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
+void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void(entity this) func)
 {SELFPARAM();
        vector  delta;
        float   traveltime;
@@ -249,7 +249,7 @@ void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
 
        self.think1 = func;
        self.finaldest = tdest;
-       self.SUB_THINK = SUB_CalcMoveDone;
+       SUB_THINK(self, SUB_CalcMoveDone);
 
        if (tdest == self.SUB_ORIGIN)
        {
@@ -288,7 +288,7 @@ void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
        SUB_CalcMove_Bezier((self.SUB_ORIGIN + tdest) * 0.5, tdest, tspeedtype, tspeed, func);
 }
 
-void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
+void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
 {
        WITHSELF(ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
 }
@@ -303,18 +303,18 @@ self.angles rotating
 The calling function should make sure self.SUB_THINK is valid
 ===============
 */
-void SUB_CalcAngleMoveDone ()
-{SELFPARAM();
+void SUB_CalcAngleMoveDone(entity this)
+{
        // After rotating, set angle to exact final angle
        self.angles = self.finalangle;
        self.SUB_AVELOCITY = '0 0 0';
        self.SUB_NEXTTHINK = -1;
        if (self.think1)
-               self.think1 ();
+               self.think1 (self);
 }
 
 // FIXME: I fixed this function only for rotation around the main axes
-void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func)
+void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void(entity this) func)
 {SELFPARAM();
        vector  delta;
        float   traveltime;
@@ -343,7 +343,7 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void()
 
        self.think1 = func;
        self.finalangle = destangle;
-       self.SUB_THINK = SUB_CalcAngleMoveDone;
+       SUB_THINK(self, SUB_CalcAngleMoveDone);
 
        if (traveltime < 0.1)
        {
@@ -356,7 +356,7 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void()
        self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
 }
 
-void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
+void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func)
 {
        WITHSELF(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
 }
index 6a84426..1ce3ea2 100644 (file)
@@ -9,7 +9,8 @@
        #define SUB_ORIGIN                      origin
        #define SUB_SETORIGIN(s,v)      setorigin((s), (v))
        #define SUB_NEXTTHINK           nextthink
-       #define SUB_THINK                       think
+       #define SUB_THINK(e, f)     setthink(e, f)
+       #define SUB_THUNK(e)        getthink(e)
        #define SUB_LTIME                       ltime
        #define SUB_FLAGS                       flags
 
@@ -22,7 +23,8 @@
        #define SUB_AVELOCITY   move_avelocity
        #define SUB_ORIGIN              move_origin
        #define SUB_NEXTTHINK   move_nextthink
-       #define SUB_THINK               move_think
+       #define SUB_THINK(e, f) ((e).move_think = (f))
+       #define SUB_THUNK(e)    ((e).move_think)
        #define SUB_LTIME               move_ltime
        #define SUB_FLAGS               move_flags
 
@@ -41,7 +43,7 @@ void SUB_SetFade (entity ent, float when, float fading_time);
 void SUB_VanishOrRemove (entity ent);
 
 .vector                finaldest, finalangle;          //plat.qc stuff
-.void()                think1;
+.void(entity this) think1;
 .float state;
 .float         t_length, t_width;
 
index c6fca4c..3223720 100644 (file)
@@ -252,8 +252,8 @@ void Net_TargetMusic()
        }
 }
 
-void Ent_TriggerMusic_Think()
-{SELFPARAM();
+void Ent_TriggerMusic_Think(entity this)
+{
        if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world))
        {
                music_trigger = self;
index 1884879..ff8b12f 100644 (file)
@@ -18,7 +18,7 @@ void TargetMusic_Advance();
 
 void Net_TargetMusic();
 
-void Ent_TriggerMusic_Think();
+void Ent_TriggerMusic_Think(entity this);
 
 void Ent_TriggerMusic_Remove();
 
index 9366678..ef47b0c 100644 (file)
@@ -17,7 +17,7 @@ const float TELEPORT_SIMPLE = 2; // only do teleport, nothing special
 
 entity Simple_TeleportPlayer(entity teleporter, entity player);
 
-void Teleport_Touch ();
+void Teleport_Touch (entity this);
 
 void teleport_findtarget(entity this);
 
index c9ea325..197ea92 100644 (file)
@@ -12,8 +12,8 @@ void trigger_gravity_remove(entity own)
                backtrace("Removing a trigger_gravity_check with no valid owner");
        own.trigger_gravity_check = world;
 }
-void trigger_gravity_check_think()
-{SELFPARAM();
+void trigger_gravity_check_think(entity this)
+{
        // This spawns when a player enters the gravity zone and checks if he left.
        // Each frame, self.count is set to 2 by trigger_gravity_touch() and decreased by 1 here.
        // It the player has left the gravity trigger, this will be allowed to reach 0 and indicate that.
@@ -37,8 +37,8 @@ void trigger_gravity_use(entity this, entity actor, entity trigger)
        this.state = !this.state;
 }
 
-void trigger_gravity_touch()
-{SELFPARAM();
+void trigger_gravity_touch(entity this)
+{
        float g;
 
        if(self.state != true)
index e5a98b8..25d824d 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef SVQC
 .float triggerhealtime;
-void trigger_heal_touch()
-{SELFPARAM();
+void trigger_heal_touch(entity this)
+{
        if (self.active != ACTIVE_ACTIVE)
                return;
 
index 8eaf0ec..82199a3 100644 (file)
@@ -8,8 +8,8 @@ void trigger_hurt_use(entity this, entity actor, entity trigger)
 }
 
 .float triggerhurttime;
-void trigger_hurt_touch()
-{SELFPARAM();
+void trigger_hurt_touch(entity this)
+{
        if (self.active != ACTIVE_ACTIVE)
                return;
 
index f5fecce..d45a82b 100644 (file)
@@ -1,6 +1,6 @@
 // targeted (directional) mode
-void trigger_impulse_touch1()
-{SELFPARAM();
+void trigger_impulse_touch1(entity this)
+{
        entity targ;
        float pushdeltatime;
        float str;
@@ -74,8 +74,8 @@ void trigger_impulse_touch1()
 }
 
 // Directionless (accelerator/decelerator) mode
-void trigger_impulse_touch2()
-{SELFPARAM();
+void trigger_impulse_touch2(entity this)
+{
        float pushdeltatime;
 
        if (self.active != ACTIVE_ACTIVE)
@@ -102,8 +102,8 @@ void trigger_impulse_touch2()
 }
 
 // Spherical (gravity/repulsor) mode
-void trigger_impulse_touch3()
-{SELFPARAM();
+void trigger_impulse_touch3(entity this)
+{
        float pushdeltatime;
        float str;
 
index be2ef03..cbb2f03 100644 (file)
@@ -129,8 +129,8 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
        return sdir * vs + '0 0 1' * vz;
 }
 
-void trigger_push_touch()
-{SELFPARAM();
+void trigger_push_touch(entity this)
+{
        if (this.active == ACTIVE_NOT)
                return;
 
@@ -263,7 +263,7 @@ void trigger_push_touch()
        if (this.spawnflags & PUSH_ONCE)
        {
                settouch(this, func_null);
-               setthink(this, SUB_Remove_self);
+               setthink(this, SUB_Remove);
                this.nextthink = time;
        }
 #endif
index 6fd61dc..4e8bf18 100644 (file)
@@ -35,7 +35,7 @@ void trigger_push_use(entity this, entity actor, entity trigger);
 
 vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
 
-void trigger_push_touch();
+void trigger_push_touch(entity this);
 
 .vector dest;
 void trigger_push_findtarget(entity this);
index b3e6a5b..e90eb18 100644 (file)
@@ -18,8 +18,8 @@ void trigger_keylock_kill(string s)
                remove(t);
 }
 
-void trigger_keylock_touch()
-{SELFPARAM();
+void trigger_keylock_touch(entity this)
+{
        bool key_used = false;
        bool started_delay = false;
 
index f973871..018e208 100644 (file)
@@ -21,8 +21,8 @@ void monoflop_fixed_use(entity this, entity actor, entity trigger)
        SUB_UseTargets(this, actor, trigger);
 }
 
-void monoflop_think()
-{SELFPARAM();
+void monoflop_think(entity this)
+{
        this.state = 0;
        SUB_UseTargets(this, this.enemy, NULL);
 }
index 5ebe701..4352557 100644 (file)
@@ -2,8 +2,8 @@
 
 #ifdef SVQC
 // the wait time has passed, so set back up for another activation
-void multi_wait()
-{SELFPARAM();
+void multi_wait(entity this)
+{
        if (this.max_health)
        {
                this.health = this.max_health;
@@ -50,7 +50,7 @@ void multi_trigger(entity this)
        }
        else if (this.wait == 0)
        {
-               WITHSELF(this, multi_wait()); // waiting finished
+               WITHSELF(this, multi_wait(this)); // waiting finished
        }
        else
        {       // we can't just remove (this) here, because this is a touch function
@@ -66,8 +66,8 @@ void multi_use(entity this, entity actor, entity trigger)
        multi_trigger(this);
 }
 
-void multi_touch()
-{SELFPARAM();
+void multi_touch(entity this)
+{
        if(!(self.spawnflags & 2))
        if(!other.iscreature)
                        return;
index 2c17fbb..1a18505 100644 (file)
@@ -18,8 +18,8 @@ void multivibrator_send(entity this)
                this.nextthink = cyclestart + this.wait + this.respawntime + 0.01;
 }
 
-void multivibrator_send_think()
-{SELFPARAM();
+void multivibrator_send_think(entity this)
+{
        multivibrator_send(this);
 }
 
index e6e4c4b..a6f40be 100644 (file)
@@ -17,8 +17,8 @@ void secrets_setstatus()
 /**
  * A secret has been found (maybe :P)
  */
-void trigger_secret_touch()
-{SELFPARAM();
+void trigger_secret_touch(entity this)
+{
        // only a player can trigger this
        if (!IS_PLAYER(other))
                return;
@@ -33,7 +33,7 @@ void trigger_secret_touch()
        self.message = "";
 
        // handle normal trigger features
-       multi_touch();
+       multi_touch(self);
        remove(self);
 }
 
index 4c514df..3a1cf95 100644 (file)
@@ -22,8 +22,8 @@
 #ifdef SVQC
 spawnfunc(trigger_swamp);
 #endif
-void swamp_touch();
-void swampslug_think();
+void swamp_touch(entity this);
+void swampslug_think(entity this);
 
 
 /*
@@ -36,8 +36,8 @@ void swampslug_think();
 *
 * I do it this way becuz there is no "untouch" event.
 */
-void swampslug_think()
-{SELFPARAM();
+void swampslug_think(entity this)
+{
        //Slowly kill the slug
        self.health = self.health - 1;
 
@@ -60,8 +60,8 @@ void swampslug_think()
        self.nextthink = time + self.swamp_interval;
 }
 
-void swamp_touch()
-{SELFPARAM();
+void swamp_touch(entity this)
+{
        // If whatever thats touching the swamp is not a player
        // or if its a dead player, just dont care abt it.
        if(!IS_PLAYER(other) || IS_DEAD(other))
index f32a519..54777b7 100644 (file)
@@ -11,8 +11,8 @@ void trigger_teleport_use(entity this, entity actor, entity trigger)
 }
 #endif
 
-void Teleport_Touch ()
-{SELFPARAM();
+void Teleport_Touch (entity this)
+{
        if (self.active != ACTIVE_ACTIVE)
                return;
 
index bfd6db1..d65fe95 100644 (file)
@@ -10,8 +10,8 @@ REGISTER_NET_LINKED(ENT_CLIENT_VIEWLOC_TRIGGER)
 
 #ifdef SVQC
 
-void viewloc_think()
-{SELFPARAM();
+void viewloc_think(entity this)
+{
        entity e;
 
        // we abuse this method, rather than using normal .touch, because touch isn't reliable with multiple clients inside the same trigger, and can't "untouch" entities
@@ -134,8 +134,8 @@ spawnfunc(target_viewlocation) { spawnfunc_target_viewlocation_start(this); }
 
 #elif defined(CSQC)
 
-void trigger_viewloc_updatelink()
-{SELFPARAM();
+void trigger_viewloc_updatelink(entity this)
+{
        self.enemy = findfloat(world, entnum, self.cnt);
        self.goalentity = findfloat(world, entnum, self.count);
 }
index 5725151..d9c6a08 100644 (file)
@@ -2,8 +2,8 @@ void SUB_DontUseTargets(entity this, entity actor, entity trigger) { }
 
 void SUB_UseTargets(entity this, entity actor, entity trigger);
 
-void DelayThink()
-{SELFPARAM();
+void DelayThink(entity this)
+{
        SUB_UseTargets (this, this.enemy, NULL);
        remove(this);
 }
@@ -276,7 +276,7 @@ void SUB_UseTargets(entity this, entity actor, entity trigger)
                RandomSelection_chosen_ent.use(RandomSelection_chosen_ent, actor, this);
 }
 
-void SUB_UseTargets_self()
-{SELFPARAM();
+void SUB_UseTargets_self(entity this)
+{
        SUB_UseTargets(this, NULL, NULL);
 }
index d24e9d7..2f3b11a 100644 (file)
@@ -51,8 +51,8 @@ If a loop is of targets are formed, any unit entering this loop will patrol it i
 If the checkpoint chain in not looped, the unit will go "Roaming" when the last point is reached.
 */
 //float tc_acum;
-void turret_checkpoint_init()
-{SELFPARAM();
+void turret_checkpoint_init(entity this)
+{
     traceline(self.origin + '0 0 16', self.origin - '0 0 1024', MOVE_WORLDONLY, self);
     setorigin(self, trace_endpos + '0 0 32');
 
index 3102186..0fc168c 100644 (file)
@@ -313,8 +313,8 @@ entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, flo
        return gib;
 }
 
-void turret_die()
-{SELFPARAM();
+void turret_die(entity this)
+{
        sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
        pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
        if (!autocvar_cl_nogibs)
@@ -432,7 +432,7 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew)
 
                _tmp = ReadByte();
                if(_tmp == 0 && this.health != 0)
-                       turret_die();
+                       turret_die(this);
                else if(this.health && this.health != _tmp)
                        this.helpme = servertime + 10;
 
index 138c87e..66b3f3d 100644 (file)
@@ -164,15 +164,15 @@ float turret_targetscore_generic(entity _turret, entity _target)
 }
 
 // Generic damage handling
-void turret_hide()
-{SELFPARAM();
+void turret_hide(entity this)
+{
        self.effects   |= EF_NODRAW;
        self.nextthink = time + self.respawntime - 0.2;
        setthink(self, turret_respawn);
 }
 
-void turret_die()
-{SELFPARAM();
+void turret_die(entity this)
+{
        self.deadflag             = DEAD_DEAD;
        self.tur_head.deadflag = self.deadflag;
 
@@ -251,9 +251,9 @@ void turret_damage(entity this, entity inflictor, entity attacker, float damage,
        this.SendFlags  |= TNSF_STATUS;
 }
 
-void() turret_think;
-void turret_respawn()
-{SELFPARAM();
+void turret_think(entity this);
+void turret_respawn(entity this)
+{
        // Make sure all parts belong to the same team since
        // this function doubles as "teamchange" function.
        self.tur_head.team      = self.team;
@@ -427,8 +427,8 @@ void load_unit_settings(entity ent, bool is_reload)
        }
 }
 
-void turret_projectile_explode()
-{SELFPARAM();
+void turret_projectile_explode(entity this)
+{
 
        self.takedamage = DAMAGE_NO;
        self.event_damage = func_null;
@@ -443,10 +443,10 @@ void turret_projectile_explode()
        remove(self);
 }
 
-void turret_projectile_touch()
+void turret_projectile_touch(entity this)
 {
        PROJECTILE_TOUCH;
-       turret_projectile_explode();
+       turret_projectile_explode(this);
 }
 
 void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
@@ -1011,8 +1011,8 @@ void turret_fire()
 #endif
 }
 
-void turret_think()
-{SELFPARAM();
+void turret_think(entity this)
+{
        self.nextthink = time + self.ticrate;
 
        MUTATOR_CALLHOOK(TurretThink, self);
@@ -1194,9 +1194,8 @@ void turret_link()
        self.tur_head.effects = EF_NODRAW;
 }
 
-void turrets_manager_think()
+void turrets_manager_think(entity this)
 {
-       SELFPARAM();
        this.nextthink = time + 1;
 
        if (autocvar_g_turrets_reloadcvars == 1)
@@ -1380,7 +1379,7 @@ float turret_initialize(Turret tur)
 #endif
 
        turret_link();
-       turret_respawn();
+       turret_respawn(self);
        turret_tag_fire_update();
 
        tur.tr_setup(tur, self);
index 622f236..1d492e8 100644 (file)
@@ -2,7 +2,7 @@
 #define SV_TURRETS_H
 
 entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
-void turret_projectile_explode();
+void turret_projectile_explode(entity this);
 float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
 float turret_firecheck();
 entity turret_select_target();
@@ -77,7 +77,7 @@ const float TFL_TRACKTYPE_FLUIDINERTIA = 3; // simulated inertia ("wobbly" mode)
 .float track_accel_rotate;
 .float track_blendrate;
 
-void() turret_respawn;
+void turret_respawn(entity this);
 
 /// updates aim org, shot org, shot dir and enemy org for selected turret
 void turret_do_updates(entity e_turret);
index 01dced5..4828bf0 100644 (file)
@@ -1,8 +1,8 @@
 spawnfunc(turret_targettrigger);
-void turret_targettrigger_touch();
+void turret_targettrigger_touch(entity this);
 
-void turret_targettrigger_touch()
-{SELFPARAM();
+void turret_targettrigger_touch(entity this)
+{
     if (this.cnt > time) return;
     FOREACH_ENTITY_STRING_ORDERED(targetname, this.target, {
         if (!(it.turret_flags & TUR_FLAG_RECIEVETARGETS)) continue;
index fd7179f..eb8db73 100644 (file)
@@ -4,7 +4,7 @@
 
 #ifdef SVQC
 
-void turret_flac_projectile_think_explode();
+void turret_flac_projectile_think_explode(entity this);
 SOUND(FlacAttack_FIRE, W_Sound("electro_fire"));
 METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
@@ -36,9 +36,8 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen
     }
 }
 
-void turret_flac_projectile_think_explode()
+void turret_flac_projectile_think_explode(entity this)
 {
-    SELFPARAM();
     if(self.enemy != world)
     if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 3))
         setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
index 6fd5bd0..2b80607 100644 (file)
@@ -7,7 +7,7 @@
 float autocvar_g_turrets_unit_hellion_shot_speed_gain;
 float autocvar_g_turrets_unit_hellion_shot_speed_max;
 
-void turret_hellion_missile_think();
+void turret_hellion_missile_think(entity this);
 SOUND(HellionAttack_FIRE, W_Sound("electro_fire"));
 METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
@@ -41,8 +41,8 @@ METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weapo
     }
 }
 
-void turret_hellion_missile_think()
-{SELFPARAM();
+void turret_hellion_missile_think(entity this)
+{
     vector olddir,newdir;
     vector pre_pos;
     float itime;
@@ -52,7 +52,7 @@ void turret_hellion_missile_think()
     olddir = normalize(self.velocity);
 
     if(self.max_health < time)
-        turret_projectile_explode();
+        turret_projectile_explode(self);
 
     // Enemy dead? just keep on the current heading then.
     if ((self.enemy == world) || (IS_DEAD(self.enemy)))
@@ -65,7 +65,7 @@ void turret_hellion_missile_think()
         self.angles = vectoangles(self.velocity);
 
         if(vdist(self.origin - self.owner.origin, >, (self.owner.shot_radius * 5)))
-            turret_projectile_explode();
+            turret_projectile_explode(self);
 
         // Accelerate
         self.velocity = olddir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
@@ -77,7 +77,7 @@ void turret_hellion_missile_think()
 
     // Enemy in range?
     if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 0.2))
-        turret_projectile_explode();
+        turret_projectile_explode(self);
 
     // Predict enemy position
     itime = vlen(self.enemy.origin - self.origin) / vlen(self.velocity);
index ca99cca..dffe83c 100644 (file)
@@ -11,7 +11,7 @@ float autocvar_g_turrets_unit_hk_shot_speed_decel;
 float autocvar_g_turrets_unit_hk_shot_speed_max;
 float autocvar_g_turrets_unit_hk_shot_speed_turnrate;
 
-void turret_hk_missile_think();
+void turret_hk_missile_think(entity this);
 SOUND(HunterKillerAttack_FIRE, W_Sound("electro_fire"));
 METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -45,8 +45,8 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity
 }
 
 bool hk_is_valid_target(entity e_target);
-void turret_hk_missile_think()
-{SELFPARAM();
+void turret_hk_missile_think(entity this)
+{
     vector vu, vd, vf, vl, vr, ve;  // Vector (direction)
     float  fu, fd, ff, fl, fr, fe;  // Fraction to solid
     vector olddir,wishdir,newdir;   // Final direction
@@ -95,7 +95,7 @@ void turret_hk_missile_think()
         // Close enougth to do decent damage?
         if ( edist <= (self.owner.shot_radius * 0.25) )
         {
-            turret_projectile_explode();
+            turret_projectile_explode(self);
             return;
         }
 
index 17622fe..1f6d62c 100644 (file)
@@ -3,7 +3,7 @@
 #ifdef IMPLEMENTATION
 
 #ifdef SVQC
-void beam_think();
+void beam_think(entity this);
 
 .int fireflag;
 SOUND(PhaserTurretAttack_FIRE, W_Sound("electro_fire"));
@@ -52,8 +52,8 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
     }
 }
 
-void beam_think()
-{SELFPARAM();
+void beam_think(entity this)
+{
     if ((time > self.cnt) || (IS_DEAD(self.owner)))
     {
         self.owner.attack_finished_single[0] = time + self.owner.shot_refire;
index c2cedf0..de7d282 100644 (file)
@@ -97,8 +97,8 @@ void walker_setnoanim(entity this)
     turrets_setframe(ANIM_NO, false);
     self.animflag = self.frame;
 }
-void walker_rocket_explode()
-{SELFPARAM();
+void walker_rocket_explode(entity this)
+{
     RadiusDamage (self, self.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), self, world, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, world);
     remove (self);
 }
@@ -113,9 +113,9 @@ void walker_rocket_damage(entity this, entity inflictor, entity attacker, float
 }
 
 #define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
-void walker_rocket_loop();
-void walker_rocket_think()
-{SELFPARAM();
+void walker_rocket_loop(entity this);
+void walker_rocket_think(entity this)
+{
     vector newdir;
     float edist;
     float itime;
@@ -148,7 +148,7 @@ void walker_rocket_think()
 
     if (self.shot_dmg != 1337 && random() < 0.01)
     {
-        walker_rocket_loop();
+        walker_rocket_loop(self);
         return;
     }
 
@@ -169,8 +169,8 @@ void walker_rocket_think()
     WALKER_ROCKET_MOVE;
 }
 
-void walker_rocket_loop3()
-{SELFPARAM();
+void walker_rocket_loop3(entity this)
+{
     vector newdir;
     self.nextthink = time;
 
@@ -192,8 +192,8 @@ void walker_rocket_loop3()
     self.angles = vectoangles(self.velocity);
 }
 
-void walker_rocket_loop2()
-{SELFPARAM();
+void walker_rocket_loop2(entity this)
+{
     vector newdir;
 
     self.nextthink = time;
@@ -215,8 +215,8 @@ void walker_rocket_loop2()
     WALKER_ROCKET_MOVE;
 }
 
-void walker_rocket_loop()
-{SELFPARAM();
+void walker_rocket_loop(entity this)
+{
     self.nextthink = time;
     self.tur_shotorg = self.origin + '0 0 300';
     setthink(self, walker_rocket_loop2);
index 2fb6021..19b71a0 100644 (file)
@@ -213,8 +213,8 @@ void vehicles_projectile_damage(entity this, entity inflictor, entity attacker,
        }
 }
 
-void vehicles_projectile_explode()
-{SELFPARAM();
+void vehicles_projectile_explode(entity this)
+{
        if(self.owner && other != world)
        {
                if(other == self.owner.vehicle)
@@ -234,7 +234,7 @@ void vehicles_projectile_explode()
 
 void vehicles_projectile_explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, vehicles_projectile_explode());
+       WITHSELF(this, vehicles_projectile_explode(this));
 }
 
 entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
@@ -265,7 +265,7 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
        proj.use                          = vehicles_projectile_explode_use;
        proj.owner                      = this;
        proj.realowner          = _owner;
-       setthink(proj, SUB_Remove_self);
+       setthink(proj, SUB_Remove);
        proj.nextthink          = time + 30;
 
        if(_health)
@@ -290,16 +290,16 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
        return proj;
 }
 
-void vehicles_gib_explode()
-{SELFPARAM();
+void vehicles_gib_explode(entity this)
+{
        sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
        Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
        Send_Effect(EFFECT_EXPLOSION_SMALL, self.wp00.origin + '0 0 64', '0 0 0', 1);
        remove(self);
 }
 
-void vehicles_gib_think()
-{SELFPARAM();
+void vehicles_gib_think(entity this)
+{
        self.alpha -= 0.1;
        if(self.cnt >= time)
                remove(self);
@@ -442,7 +442,7 @@ void vehicles_clearreturn(entity veh)
                if(ret.wp00 == veh)
                {
                        ret.classname   = "";
-                       setthink(ret, SUB_Remove_self);
+                       setthink(ret, SUB_Remove);
                        ret.nextthink   = time + 0.1;
 
                        if(ret.waypointsprite_attached)
@@ -453,9 +453,9 @@ void vehicles_clearreturn(entity veh)
        }
 }
 
-void vehicles_spawn();
-void vehicles_return()
-{SELFPARAM();
+void vehicles_spawn(entity this);
+void vehicles_return(entity this)
+{
        Send_Effect(EFFECT_TELEPORT, self.wp00.origin + '0 0 64', '0 0 0', 1);
 
        setthink(self.wp00, vehicles_spawn);
@@ -467,8 +467,8 @@ void vehicles_return()
        remove(self);
 }
 
-void vehicles_showwp_goaway()
-{SELFPARAM();
+void vehicles_showwp_goaway(entity this)
+{
        if(self.waypointsprite_attached)
                WaypointSprite_Kill(self.waypointsprite_attached);
 
@@ -476,8 +476,8 @@ void vehicles_showwp_goaway()
 
 }
 
-void vehicles_showwp()
-{SELFPARAM();
+void vehicles_showwp(entity this)
+{
        vector rgb;
 
        entity ent = this;
@@ -585,8 +585,8 @@ void vehicles_regen(entity this, float timer, .float regen_field, float field_ma
        }
 }
 
-void shieldhit_think()
-{SELFPARAM();
+void shieldhit_think(entity this)
+{
        self.alpha -= 0.1;
        if (self.alpha <= 0)
        {
@@ -901,8 +901,8 @@ void vehicles_exit(bool eject)
        vehicles_exit_running = false;
 }
 
-void vehicles_touch()
-{SELFPARAM();
+void vehicles_touch(entity this)
+{
        if(MUTATOR_CALLHOOK(VehicleTouch, self, other))
                return;
 
@@ -1089,8 +1089,8 @@ void vehicles_enter(entity pl, entity veh)
        antilag_clear(pl, CS(pl));
 }
 
-void vehicles_think()
-{SELFPARAM();
+void vehicles_think(entity this)
+{
        self.nextthink = time;
 
        if(self.owner)
@@ -1105,8 +1105,8 @@ void vehicles_think()
 }
 
 // initialization
-void vehicles_spawn()
-{SELFPARAM();
+void vehicles_spawn(entity this)
+{
        LOG_TRACE("Spawning vehicle: ", self.classname, "\n");
 
        // disown & reset
index 72a70cf..945c096 100644 (file)
@@ -369,13 +369,13 @@ bool vehicles_valid_pilot()
        return true;
 }
 
-void bumblebee_touch()
-{SELFPARAM();
+void bumblebee_touch(entity this)
+{
        if(autocvar_g_vehicles_enter) { return; }
 
        if(self.gunner1 != world && self.gunner2 != world)
        {
-               vehicles_touch();
+               vehicles_touch(self);
                return;
        }
 
@@ -388,7 +388,7 @@ void bumblebee_touch()
                        return;
        }
 
-       vehicles_touch();
+       vehicles_touch(self);
 }
 
 void bumblebee_regen(entity this)
@@ -625,8 +625,8 @@ bool bumblebee_pilot_frame(entity this)
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 }
 
-void bumblebee_land()
-{SELFPARAM();
+void bumblebee_land(entity this)
+{
        float hgt;
 
        hgt = raptor_altitude(512);
@@ -685,8 +685,8 @@ void bumblebee_exit(float eject)
        self.owner = world;
 }
 
-void bumblebee_blowup()
-{SELFPARAM();
+void bumblebee_blowup(entity this)
+{
        RadiusDamage(self, self.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage,
                                 autocvar_g_vehicle_bumblebee_blowup_edgedamage,
                                 autocvar_g_vehicle_bumblebee_blowup_radius, self, world,
@@ -702,8 +702,8 @@ void bumblebee_blowup()
        remove(self);
 }
 
-void bumblebee_diethink()
-{SELFPARAM();
+void bumblebee_diethink(entity this)
+{
        if(time >= self.wait)
                setthink(self, bumblebee_blowup);
 
@@ -751,7 +751,7 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
                entity oldother = other;
                other = e;
                self.phase = 0;
-               gettouch(self)();
+               gettouch(self)(self);
                other = oldother;
                return;
         }
@@ -763,7 +763,7 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
                entity oldother = other;
                other = e;
                self.phase = 0;
-               gettouch(self)();
+               gettouch(self)(self);
                other = oldother;
             return;
         }
index 6eb064a..bcbe5be 100644 (file)
@@ -403,8 +403,8 @@ bool racer_frame(entity this)
        this.velocity = vehic.velocity;
 }
 
-void racer_think()
-{SELFPARAM();
+void racer_think(entity this)
+{
        this.nextthink = time + autocvar_g_vehicle_racer_thinkrate;
 
        tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NOMONSTERS, this);
@@ -501,8 +501,8 @@ void racer_blowup()
        setorigin(self, self.pos1);
 }
 
-void racer_blowup_think()
-{SELFPARAM();
+void racer_blowup_think(entity this)
+{
        self.nextthink = time;
 
        if(time >= self.delay)
@@ -511,8 +511,8 @@ void racer_blowup_think()
        CSQCMODEL_AUTOUPDATE(self);
 }
 
-void racer_deadtouch()
-{SELFPARAM();
+void racer_deadtouch(entity this)
+{
        self.avelocity_x *= 0.7;
        self.cnt -= 1;
        if(self.cnt <= 0)
index 5718d41..f15b8cf 100644 (file)
@@ -42,8 +42,8 @@ METHOD(RacerAttack, wr_checkammo1, bool(RacerAttack thiswep, entity actor))
     return isPlayer || veh.vehicle_energy >= autocvar_g_vehicle_racer_cannon_cost;
 }
 
-void racer_rocket_tracker();
-void racer_rocket_groundhugger();
+void racer_rocket_tracker(entity this);
+void racer_rocket_groundhugger(entity this);
 
 void racer_fire_rocket(entity player, vector org, vector dir, entity trg)
 {
@@ -64,8 +64,8 @@ void racer_fire_rocket(entity player, vector org, vector dir, entity trg)
         setthink(rocket, racer_rocket_groundhugger);
 }
 
-void racer_rocket_tracker()
-{SELFPARAM();
+void racer_rocket_tracker(entity this)
+{
     vector olddir, newdir;
     float oldvel, newvel;
 
@@ -116,8 +116,8 @@ void racer_rocket_tracker()
     return;
 }
 
-void racer_rocket_groundhugger()
-{SELFPARAM();
+void racer_rocket_groundhugger(entity this)
+{
     vector olddir, newdir;
     float oldvel, newvel;
 
index e62f033..3a24019 100644 (file)
@@ -83,8 +83,8 @@ float raptor_altitude(float amax)
        return vlen(self.origin - trace_endpos);
 }
 
-void raptor_land()
-{SELFPARAM();
+void raptor_land(entity this)
+{
        float hgt;
 
        hgt = raptor_altitude(512);
@@ -520,8 +520,8 @@ bool raptor_takeoff(entity this)
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
 }
 
-void raptor_blowup()
-{SELFPARAM();
+void raptor_blowup(entity this)
+{
        self.deadflag   = DEAD_DEAD;
        self.vehicle_exit(VHEF_NORMAL);
        RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH.m_id, world);
@@ -538,8 +538,8 @@ void raptor_blowup()
        self.nextthink = 0;
 }
 
-void raptor_diethink()
-{SELFPARAM();
+void raptor_diethink(entity this)
+{
        if(time >= self.wait)
                setthink(self, raptor_blowup);
 
@@ -555,8 +555,8 @@ void raptor_diethink()
 
 // If we dont do this ever now and then, the raptors rotors
 // stop working, presumably due to angle overflow. cute.
-void raptor_rotor_anglefix()
-{SELFPARAM();
+void raptor_rotor_anglefix(entity this)
+{
        self.gun1.angles_y = anglemods(self.gun1.angles_y);
        self.gun2.angles_y = anglemods(self.gun2.angles_y);
        self.nextthink = time + 15;
index 8eabe1c..c2c266f 100644 (file)
@@ -51,9 +51,9 @@ METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponen
     }
 }
 
-void raptor_flare_think();
+void raptor_flare_think(entity this);
 void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
-void raptor_flare_touch();
+void raptor_flare_touch(entity this);
 
 METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
     bool isPlayer = IS_PLAYER(actor);
@@ -85,8 +85,8 @@ METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weapone
 }
 
 
-void raptor_bomblet_boom()
-{SELFPARAM();
+void raptor_bomblet_boom(entity this)
+{
     RadiusDamage (self, self.realowner, autocvar_g_vehicle_raptor_bomblet_damage,
                                     autocvar_g_vehicle_raptor_bomblet_edgedamage,
                                     autocvar_g_vehicle_raptor_bomblet_radius, world, world,
@@ -94,8 +94,8 @@ void raptor_bomblet_boom()
     remove(self);
 }
 
-void raptor_bomblet_touch()
-{SELFPARAM();
+void raptor_bomblet_touch(entity this)
+{
     if(other == self.owner)
         return;
 
@@ -104,8 +104,8 @@ void raptor_bomblet_touch()
     self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay;
 }
 
-void raptor_bomb_burst()
-{SELFPARAM();
+void raptor_bomb_burst(entity this)
+{
     if(self.cnt > time)
     if(autocvar_g_vehicle_raptor_bomblet_alt)
     {
@@ -180,8 +180,8 @@ void raptor_bombdrop()
     CSQCProjectile(bomb_2, true, PROJECTILE_RAPTORBOMB, true);
 }
 
-void raptor_flare_touch()
-{SELFPARAM();
+void raptor_flare_touch(entity this)
+{
     remove(self);
 }
 
@@ -192,8 +192,8 @@ void raptor_flare_damage(entity this, entity inflictor, entity attacker, float d
         remove(this);
 }
 
-void raptor_flare_think()
-{SELFPARAM();
+void raptor_flare_think(entity this)
+{
     self.nextthink = time + 0.1;
     entity _missile = findchainentity(enemy, self.owner);
     while(_missile)
index e60b263..1b27587 100644 (file)
@@ -392,8 +392,8 @@ void spiderbot_exit(float eject)
        self.owner = world;
 }
 
-void spiderbot_headfade()
-{SELFPARAM();
+void spiderbot_headfade(entity this)
+{
        setthink(self, spiderbot_headfade);
        self.nextthink = self.fade_time;
        self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
@@ -409,8 +409,8 @@ void spiderbot_headfade()
        }
 }
 
-void spiderbot_blowup()
-{SELFPARAM();
+void spiderbot_blowup(entity this)
+{
        if(self.cnt > time)
        {
                if(random() < 0.1)
index 405a2ac..ae8c6c6 100644 (file)
@@ -10,8 +10,8 @@ void spiderbot_rocket_artillery()
     UpdateCSQCProjectile(self);
 }
 
-void spiderbot_rocket_unguided()
-{SELFPARAM();
+void spiderbot_rocket_unguided(entity this)
+{
     vector newdir, olddir;
 
     self.nextthink  = time;
@@ -26,8 +26,8 @@ void spiderbot_rocket_unguided()
         self.use(self, NULL, NULL);
 }
 
-void spiderbot_rocket_guided()
-{SELFPARAM();
+void spiderbot_rocket_guided(entity this)
+{
     vector newdir, olddir;
 
     self.nextthink  = time;
index 4354cc4..b86b77f 100644 (file)
@@ -107,14 +107,14 @@ void W_PROP_reload(int chan, entity to)
         if (f) f(it, chan);
     });
 }
-void W_PROP_think()
+void W_PROP_think(entity this)
 {
     W_PROP_reload(MSG_ALL, NULL);
 }
 STATIC_INIT_LATE(W_PROP_reloader)
 {
     entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
-    WITHSELF(e, (setthink(e, W_PROP_think))());
+    WITHSELF(e, (setthink(e, W_PROP_think))(e));
 }
 #endif
 
index 46efc1f..462bf0a 100644 (file)
@@ -259,8 +259,8 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam
                W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
-void W_Arc_Bolt_Touch()
-{SELFPARAM();
+void W_Arc_Bolt_Touch(entity this)
+{
        PROJECTILE_TOUCH;
        self.use(this, NULL, NULL);
 }
@@ -307,8 +307,8 @@ void W_Arc_Attack_Bolt(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-void W_Arc_Beam_Think()
-{SELFPARAM();
+void W_Arc_Beam_Think(entity this)
+{
        if(self != self.owner.arc_beam)
        {
                remove(self);
@@ -691,7 +691,7 @@ void W_Arc_Beam(float burst)
        beam.beam_bursting = burst;
        Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
-       WITHSELF(beam, getthink(beam)());
+       WITHSELF(beam, getthink(beam)(beam));
 }
 
 void Arc_Smoke()
index 08b5e34..4da4f82 100644 (file)
@@ -56,8 +56,8 @@ REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); }
 spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
 
-void W_Blaster_Touch()
-{SELFPARAM();
+void W_Blaster_Touch(entity this)
+{
        PROJECTILE_TOUCH;
 
        self.event_damage = func_null;
@@ -78,10 +78,10 @@ void W_Blaster_Touch()
        remove(self);
 }
 
-void W_Blaster_Think()
-{SELFPARAM();
+void W_Blaster_Think(entity this)
+{
        this.movetype = MOVETYPE_FLY;
-       setthink(this, SUB_Remove_self);
+       setthink(this, SUB_Remove);
        this.nextthink = time + this.blaster_lifetime;
        CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
 }
@@ -146,7 +146,7 @@ void W_Blaster_Attack(
 
        if (time >= missile.nextthink)
        {
-               WITHSELF(missile, getthink(missile)());
+               WITHSELF(missile, getthink(missile)(missile));
        }
 }
 
index 0d704da..7c9ae5e 100644 (file)
@@ -228,8 +228,8 @@ vector W_Crylink_LinkJoin(entity e, float jspeed)
        return targ_origin;
 }
 
-void W_Crylink_LinkJoinEffect_Think()
-{SELFPARAM();
+void W_Crylink_LinkJoinEffect_Think(entity this)
+{
        // is there at least 2 projectiles very close?
        entity e, p;
        float n;
@@ -293,8 +293,8 @@ float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad)
 }
 
 // NO bounce protection, as bounces are limited!
-void W_Crylink_Touch()
-{SELFPARAM();
+void W_Crylink_Touch(entity this)
+{
        float finalhit;
        float f;
        float isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
@@ -338,8 +338,8 @@ void W_Crylink_Touch()
        //      CSQCProjectile(proj, true, PROJECTILE_CRYLINK, true);
 }
 
-void W_Crylink_Fadethink()
-{SELFPARAM();
+void W_Crylink_Fadethink(entity this)
+{
        W_Crylink_Dequeue(self);
        remove(self);
 }
index 1966509..1c79e2f 100644 (file)
@@ -81,8 +81,8 @@ void W_Devastator_Unregister()
        }
 }
 
-void W_Devastator_Explode()
-{SELFPARAM();
+void W_Devastator_Explode(entity this)
+{
        W_Devastator_Unregister();
 
        if(other.takedamage == DAMAGE_AIM)
@@ -252,8 +252,8 @@ vector W_Devastator_SteerTo(vector thisdir, vector goaldir, float maxturn_cos)
 //   normalize(thisdir + goaldir)
 //   normalize(0)
 
-void W_Devastator_Think()
-{SELFPARAM();
+void W_Devastator_Think(entity this)
+{
        vector desireddir, olddir, newdir, desiredorigin, goal;
        float velspeed, f;
        self.nextthink = time;
@@ -261,7 +261,7 @@ void W_Devastator_Think()
        {
                other = world;
                self.projectiledeathtype |= HITTYPE_BOUNCE;
-               W_Devastator_Explode();
+               W_Devastator_Explode(self);
                return;
        }
 
@@ -320,8 +320,8 @@ void W_Devastator_Think()
                UpdateCSQCProjectile(self);
 }
 
-void W_Devastator_Touch()
-{SELFPARAM();
+void W_Devastator_Touch(entity this)
+{
        if(WarpZone_Projectile_Touch())
        {
                if(wasfreed(self))
@@ -329,7 +329,7 @@ void W_Devastator_Touch()
                return;
        }
        W_Devastator_Unregister();
-       W_Devastator_Explode();
+       W_Devastator_Explode(this);
 }
 
 void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
index 84bef35..3771162 100644 (file)
@@ -68,7 +68,7 @@ REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
 #ifdef SVQC
 .float electro_count;
 .float electro_secondarytime;
-void W_Electro_ExplodeCombo();
+void W_Electro_ExplodeCombo(entity this);
 #endif
 #endif
 #ifdef IMPLEMENTATION
@@ -122,8 +122,8 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own)
        }
 }
 
-void W_Electro_ExplodeCombo()
-{SELFPARAM();
+void W_Electro_ExplodeCombo(entity this)
+{
        W_Electro_TriggerCombo(self.origin, WEP_CVAR(electro, combo_comboradius), self.realowner);
 
        self.event_damage = func_null;
@@ -196,14 +196,14 @@ void W_Electro_Explode_use(entity this, entity actor, entity trigger)
        WITHSELF(this, W_Electro_Explode());
 }
 
-void W_Electro_TouchExplode()
+void W_Electro_TouchExplode(entity this)
 {
        PROJECTILE_TOUCH;
        W_Electro_Explode();
 }
 
-void W_Electro_Bolt_Think()
-{SELFPARAM();
+void W_Electro_Bolt_Think(entity this)
+{
        if(time >= self.ltime)
        {
                this.use(this, NULL, NULL);
@@ -298,8 +298,8 @@ void W_Electro_Attack_Bolt(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, proj);
 }
 
-void W_Electro_Orb_Touch()
-{SELFPARAM();
+void W_Electro_Orb_Touch(entity this)
+{
        PROJECTILE_TOUCH;
        if(other.takedamage == DAMAGE_AIM)
                { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(); } }
index de46889..9aa1d4b 100644 (file)
@@ -62,8 +62,8 @@ REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball));
 #ifdef SVQC
 spawnfunc(weapon_fireball) { weapon_defaultspawnfunc(this, WEP_FIREBALL); }
 
-void W_Fireball_Explode()
-{SELFPARAM();
+void W_Fireball_Explode(entity this)
+{
        entity e;
        float dist;
        float points;
@@ -114,13 +114,13 @@ void W_Fireball_Explode()
 
 void W_Fireball_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Fireball_Explode());
+       WITHSELF(this, W_Fireball_Explode(this));
 }
 
-void W_Fireball_TouchExplode()
+void W_Fireball_TouchExplode(entity this)
 {
        PROJECTILE_TOUCH;
-       W_Fireball_Explode();
+       W_Fireball_Explode(this);
 }
 
 void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime)
@@ -157,13 +157,13 @@ void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage,
        }
 }
 
-void W_Fireball_Think()
-{SELFPARAM();
+void W_Fireball_Think(entity this)
+{
        if(time > self.pushltime)
        {
                self.cnt = 1;
                self.projectiledeathtype |= HITTYPE_SPLASH;
-               W_Fireball_Explode();
+               W_Fireball_Explode(this);
                return;
        }
 
@@ -264,8 +264,8 @@ void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, .entity weaponentit
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1);
 }
 
-void W_Fireball_Firemine_Think()
-{SELFPARAM();
+void W_Fireball_Firemine_Think(entity this)
+{
        if(time > self.pushltime)
        {
                remove(self);
@@ -290,8 +290,8 @@ void W_Fireball_Firemine_Think()
        self.nextthink = time + 0.1;
 }
 
-void W_Fireball_Firemine_Touch()
-{SELFPARAM();
+void W_Fireball_Firemine_Touch(entity this)
+{
        PROJECTILE_TOUCH;
        if(other.takedamage == DAMAGE_AIM)
        if(Fire_AddDamage(other, self.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), self.projectiledeathtype) >= 0)
index 3562294..d37063a 100644 (file)
@@ -113,14 +113,14 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage
                W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
-void W_Hagar_Touch()
-{SELFPARAM();
+void W_Hagar_Touch(entity this)
+{
        PROJECTILE_TOUCH;
        this.use(this, NULL, NULL);
 }
 
-void W_Hagar_Touch2()
-{SELFPARAM();
+void W_Hagar_Touch2(entity this)
+{
        PROJECTILE_TOUCH;
 
        if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
index ae00557..dbcb04d 100644 (file)
@@ -54,8 +54,8 @@ REGISTER_WEAPON(HLAC, hlac, NEW(HLAC));
 #ifdef SVQC
 spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); }
 
-void W_HLAC_Touch()
-{SELFPARAM();
+void W_HLAC_Touch(entity this)
+{
        float isprimary;
 
        PROJECTILE_TOUCH;
@@ -105,7 +105,7 @@ void W_HLAC_Attack(Weapon thiswep)
        //missile.angles = vectoangles(missile.velocity); // csqc
 
        settouch(missile, W_HLAC_Touch);
-       setthink(missile, SUB_Remove_self);
+       setthink(missile, SUB_Remove);
 
     missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
 
@@ -147,7 +147,7 @@ void W_HLAC_Attack2()
        //missile.angles = vectoangles(missile.velocity); // csqc
 
        settouch(missile, W_HLAC_Touch);
-       setthink(missile, SUB_Remove_self);
+       setthink(missile, SUB_Remove);
 
     missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
 
index adb1781..c452975 100644 (file)
@@ -79,8 +79,8 @@ OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(Offhand
 
 spawnfunc(weapon_hook) { weapon_defaultspawnfunc(this, WEP_HOOK); }
 
-void W_Hook_ExplodeThink()
-{SELFPARAM();
+void W_Hook_ExplodeThink(entity this)
+{
        float dt, dmg_remaining_next, f;
 
        dt = time - self.teleport_time;
@@ -99,8 +99,8 @@ void W_Hook_ExplodeThink()
                remove(self);
 }
 
-void W_Hook_Explode2()
-{SELFPARAM();
+void W_Hook_Explode2(entity this)
+{
        self.event_damage = func_null;
        settouch(self, func_null);
        self.effects |= EF_NODRAW;
@@ -120,7 +120,7 @@ void W_Hook_Explode2()
 
 void W_Hook_Explode2_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Hook_Explode2());
+       WITHSELF(this, W_Hook_Explode2(this));
 }
 
 void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -137,8 +137,8 @@ void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage,
                W_PrepareExplosionByDamage(this, this.realowner, W_Hook_Explode2);
 }
 
-void W_Hook_Touch2()
-{SELFPARAM();
+void W_Hook_Touch2(entity this)
+{
        PROJECTILE_TOUCH;
        this.use(this, NULL, NULL);
 }
index e39adb4..18934a6 100644 (file)
@@ -71,8 +71,8 @@ spawnfunc(weapon_machinegun)
 }
 spawnfunc(weapon_uzi) { spawnfunc_weapon_machinegun(this); }
 
-void W_MachineGun_MuzzleFlash_Think()
-{SELFPARAM();
+void W_MachineGun_MuzzleFlash_Think(entity this)
+{
        this.frame += 2;
        this.scale *= 0.5;
        this.alpha -= 0.25;
@@ -80,7 +80,7 @@ void W_MachineGun_MuzzleFlash_Think()
 
        if(this.alpha <= 0)
        {
-               setthink(this, SUB_Remove_self);
+               setthink(this, SUB_Remove);
                this.nextthink = time;
                this.realowner.muzzle_flash = world;
                return;
index f8c3c6c..66c6d02 100644 (file)
@@ -53,7 +53,7 @@ ENDCLASS(MineLayer)
 REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
 
 #ifdef SVQC
-void W_MineLayer_Think();
+void W_MineLayer_Think(entity this);
 .float minelayer_detonate, mine_explodeanyway;
 .float mine_time;
 .vector mine_orientation;
@@ -108,8 +108,8 @@ void W_MineLayer_Stick(entity to)
                SetMovetypeFollow(newmine, to);
 }
 
-void W_MineLayer_Explode()
-{SELFPARAM();
+void W_MineLayer_Explode(entity this)
+{
        if(other.takedamage == DAMAGE_AIM)
                if(IS_PLAYER(other))
                        if(DIFF_TEAM(self.realowner, other))
@@ -192,7 +192,7 @@ void W_MineLayer_ProximityExplode()
        }
 
        self.mine_time = 0;
-       W_MineLayer_Explode();
+       W_MineLayer_Explode(self);
 }
 
 int W_MineLayer_Count(entity e)
@@ -205,8 +205,8 @@ int W_MineLayer_Count(entity e)
        return minecount;
 }
 
-void W_MineLayer_Think()
-{SELFPARAM();
+void W_MineLayer_Think(entity this)
+{
        entity head;
 
        self.nextthink = time;
@@ -236,7 +236,7 @@ void W_MineLayer_Think()
        {
                other = world;
                self.projectiledeathtype |= HITTYPE_BOUNCE;
-               W_MineLayer_Explode();
+               W_MineLayer_Explode(self);
                return;
        }
 
@@ -268,8 +268,8 @@ void W_MineLayer_Think()
                W_MineLayer_RemoteExplode();
 }
 
-void W_MineLayer_Touch()
-{SELFPARAM();
+void W_MineLayer_Touch(entity this)
+{
        if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
                return; // we're already a stuck mine, why do we get called? TODO does this even happen?
 
index b264fab..5fa2447 100644 (file)
@@ -128,8 +128,8 @@ void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, flo
                W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
 }
 
-void W_Mortar_Grenade_Think1()
-{SELFPARAM();
+void W_Mortar_Grenade_Think1(entity this)
+{
        self.nextthink = time;
        if(time > self.cnt)
        {
@@ -142,8 +142,8 @@ void W_Mortar_Grenade_Think1()
                W_Mortar_Grenade_Explode();
 }
 
-void W_Mortar_Grenade_Touch1()
-{SELFPARAM();
+void W_Mortar_Grenade_Touch1(entity this)
+{
        PROJECTILE_TOUCH;
        if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
        {
@@ -174,8 +174,8 @@ void W_Mortar_Grenade_Touch1()
        }
 }
 
-void W_Mortar_Grenade_Touch2()
-{SELFPARAM();
+void W_Mortar_Grenade_Touch2(entity this)
+{
        PROJECTILE_TOUCH;
        if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
        {
index bef792c..d1bd519 100644 (file)
@@ -109,8 +109,8 @@ void W_Porto_Remove(entity p)
        }
 }
 
-void W_Porto_Think()
-{SELFPARAM();
+void W_Porto_Think(entity this)
+{
        trace_plane_normal = '0 0 0';
        if(self.realowner.playerid != self.playerid)
                remove(self);
@@ -118,8 +118,8 @@ void W_Porto_Think()
                W_Porto_Fail(0);
 }
 
-void W_Porto_Touch()
-{SELFPARAM();
+void W_Porto_Touch(entity this)
+{
        vector norm;
 
        // do not use PROJECTILE_TOUCH here
index 2e98fdb..d1a9368 100644 (file)
@@ -94,23 +94,23 @@ spawnfunc(weapon_seeker) { weapon_defaultspawnfunc(this, WEP_SEEKER); }
 // ============================
 // Begin: Missile functions, these are general functions to be manipulated by other code
 // ============================
-void W_Seeker_Missile_Explode()
-{SELFPARAM();
+void W_Seeker_Missile_Explode(entity this)
+{
        self.event_damage = func_null;
        RadiusDamage(self, self.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), self.projectiledeathtype, other);
 
        remove(self);
 }
 
-void W_Seeker_Missile_Touch()
+void W_Seeker_Missile_Touch(entity this)
 {
        PROJECTILE_TOUCH;
 
-       W_Seeker_Missile_Explode();
+       W_Seeker_Missile_Explode(this);
 }
 
-void W_Seeker_Missile_Think()
-{SELFPARAM();
+void W_Seeker_Missile_Think(entity this)
+{
        entity e;
        vector desireddir, olddir, newdir, eorg;
        float turnrate;
@@ -120,7 +120,7 @@ void W_Seeker_Missile_Think()
        if(time > self.cnt)
        {
                self.projectiledeathtype |= HITTYPE_SPLASH;
-               W_Seeker_Missile_Explode();
+               W_Seeker_Missile_Explode(self);
        }
 
        spd = vlen(self.velocity);
@@ -178,7 +178,7 @@ void W_Seeker_Missile_Think()
                        {
                                if(self.autoswitch <= time)
                                {
-                                       W_Seeker_Missile_Explode();
+                                       W_Seeker_Missile_Explode(self);
                                        self.autoswitch = 0;
                                }
                        }
@@ -304,8 +304,8 @@ void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target)
 // ============================
 // Begin: FLAC, close range attack meant for defeating rockets which are coming at you.
 // ============================
-void W_Seeker_Flac_Explode()
-{SELFPARAM();
+void W_Seeker_Flac_Explode(entity this)
+{
        self.event_damage = func_null;
 
        RadiusDamage(self, self.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), world, world, WEP_CVAR(seeker, flac_force), self.projectiledeathtype, other);
@@ -315,14 +315,15 @@ void W_Seeker_Flac_Explode()
 
 void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Seeker_Flac_Explode());
+       WITHSELF(this, W_Seeker_Flac_Explode(this));
 }
 
 void W_Seeker_Flac_Touch()
 {
+    SELFPARAM();
        PROJECTILE_TOUCH;
 
-       W_Seeker_Flac_Explode();
+       W_Seeker_Flac_Explode(this);
 }
 
 void W_Seeker_Fire_Flac(Weapon thiswep)
@@ -419,8 +420,8 @@ void W_Seeker_Attack()
        W_Seeker_Fire_Missile(WEP_SEEKER, '0 0 0', closest_target);
 }
 
-void W_Seeker_Vollycontroller_Think() // TODO: Merge this with W_Seeker_Attack
-{SELFPARAM();
+void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seeker_Attack
+{
        float c;
        entity oldenemy;
        this.cnt = this.cnt - 1;
@@ -460,8 +461,8 @@ void W_Seeker_Vollycontroller_Think() // TODO: Merge this with W_Seeker_Attack
        own.enemy = oldenemy;
 }
 
-void W_Seeker_Tracker_Think()
-{SELFPARAM();
+void W_Seeker_Tracker_Think(entity this)
+{
        // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
        if((IS_DEAD(self.realowner)) || (IS_DEAD(self.tag_target)) || (PS(self.realowner).m_switchweapon != WEP_SEEKER)
        || (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
@@ -499,8 +500,8 @@ void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float d
                W_Seeker_Tag_Explode(this);
 }
 
-void W_Seeker_Tag_Touch()
-{SELFPARAM();
+void W_Seeker_Tag_Touch(entity this)
+{
        vector dir;
        vector org2;
        entity e;
@@ -573,7 +574,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
        missile.bot_dodge       = true;
        missile.bot_dodgerating = 50;
        settouch(missile, W_Seeker_Tag_Touch);
-       setthink(missile, SUB_Remove_self);
+       setthink(missile, SUB_Remove);
        missile.nextthink       = time + WEP_CVAR(seeker, tag_lifetime);
        missile.movetype        = MOVETYPE_FLY;
        missile.solid           = SOLID_BBOX;
index 3b6266f..47d33fc 100644 (file)
@@ -112,8 +112,8 @@ float shockwave_hit_damage[MAX_SHOCKWAVE_HITS];
 vector shockwave_hit_force[MAX_SHOCKWAVE_HITS];
 
 // MELEE ATTACK MODE
-void W_Shockwave_Melee_Think()
-{SELFPARAM();
+void W_Shockwave_Melee_Think(entity this)
+{
        // declarations
        float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
        entity target_victim;
index 361f70a..1cf1fe0 100644 (file)
@@ -79,7 +79,7 @@ void W_Shotgun_Attack(Weapon thiswep, float isprimary)
        // muzzle flash for 1st person view
        flash = spawn();
        setmodel(flash, MDL_SHOTGUN_MUZZLEFLASH); // precision set below
-       setthink(flash, SUB_Remove_self);
+       setthink(flash, SUB_Remove);
        flash.nextthink = time + 0.06;
        flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
        W_AttachToShotorg(self, flash, '5 0 0');
@@ -87,8 +87,8 @@ void W_Shotgun_Attack(Weapon thiswep, float isprimary)
 
 .float swing_prev;
 .entity swing_alreadyhit;
-void W_Shotgun_Melee_Think()
-{SELFPARAM();
+void W_Shotgun_Melee_Think(entity this)
+{
        // declarations
        float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
        entity target_victim;
index 3f1aca6..1c0a5bb 100644 (file)
@@ -274,8 +274,8 @@ bool W_Tuba_NoteSendEntity(entity this, entity to, int sf)
        return true;
 }
 
-void W_Tuba_NoteThink()
-{SELFPARAM();
+void W_Tuba_NoteThink(entity this)
+{
        float dist_mult;
        float vol0, vol1;
        vector dir0, dir1;
@@ -552,8 +552,8 @@ void tubasound(entity e, bool restart)
        }
 }
 
-void Ent_TubaNote_Think()
-{SELFPARAM();
+void Ent_TubaNote_Think(entity this)
+{
        float f = autocvar_g_balance_tuba_fadetime;
        if (f > 0) {
                this.tuba_volume -= frametime * this.tuba_volume_initial / f;
@@ -588,8 +588,6 @@ void Ent_TubaNote_StopSound(entity this)
        this.enemy = NULL;
 }
 
-void Ent_TubaNote_StopSound_self() { SELFPARAM(); Ent_TubaNote_StopSound(self); }
-
 NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
 {
        bool upd = false;
@@ -631,7 +629,7 @@ NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
                }
        }
 
-       setthink(this, Ent_TubaNote_StopSound_self);
+       setthink(this, Ent_TubaNote_StopSound);
        this.entremove = Ent_TubaNote_StopSound;
        setthink(this.enemy, Ent_TubaNote_Think);
        this.enemy.nextthink = time + 10;
index 320f0e4..d0125ed 100644 (file)
@@ -137,7 +137,7 @@ void VaporizerBeam_Draw(entity this)
 NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
 {
        Net_Accept(vortex_beam);
-       setthink(this, SUB_Remove_self);
+       setthink(this, SUB_Remove);
        this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
        this.draw = VaporizerBeam_Draw;
        this.drawmask = MASK_NORMAL;
@@ -232,8 +232,8 @@ void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
        WITHSELF(this, W_RocketMinsta_Laser_Explode());
 }
 
-void W_RocketMinsta_Laser_Touch ()
-{SELFPARAM();
+void W_RocketMinsta_Laser_Touch (entity this)
+{
        PROJECTILE_TOUCH;
        //W_RocketMinsta_Laser_Explode ();
        RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
index d56895d..d4a2508 100644 (file)
                remove(this);
        }
 
-       /** Remove self */
-       void SUB_Remove_self()
-       {
-               SELFPARAM();
-               remove(this);
-       }
-
-       void defer_think()
+       void defer_think(entity this)
        {
-               SELFPARAM();
-               setthink(this, SUB_Remove_self);
+               setthink(this, SUB_Remove);
                this.nextthink = time;
                this.defer_func(this.owner);
        }
index 49f778a..f0a9cc2 100644 (file)
@@ -124,7 +124,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                if (dt)
                {
                        e.nextthink = time + dt;
-                       setthink(e, SUB_Remove_self);
+                       setthink(e, SUB_Remove);
                }
        }
 
index da85a2a..50196a0 100644 (file)
@@ -62,17 +62,17 @@ noref entity _selftemp;
     (0, (e).__##T)
 
 SELFWRAP(think, void, (entity this), (this))
-#define setthink(e, f) _SELFWRAP_SET(think, e, f)
-#define getthink(e) _SELFWRAP_GET(think, e)
+#define setthink(e, f) SELFWRAP_SET(think, e, f)
+#define getthink(e) SELFWRAP_GET(think, e)
 
 SELFWRAP(touch, void, (entity this), (this))
-#define settouch(e, f) _SELFWRAP_SET(touch, e, f)
-#define gettouch(e) _SELFWRAP_GET(touch, e)
+#define settouch(e, f) SELFWRAP_SET(touch, e, f)
+#define gettouch(e) SELFWRAP_GET(touch, e)
 
 SELFWRAP(predraw, void, (entity this), (this))
 #define setpredraw(e, f) SELFWRAP_SET(predraw, e, f)
 
 #ifndef MENUQC
-void adaptor_think2touch() { SELFPARAM(); WITH(entity, other, NULL, gettouch(this)()); }
-void adaptor_think2use() { SELFPARAM(); if (this.use) this.use(this, NULL, NULL); }
+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 6467dad..04f0378 100644 (file)
@@ -25,7 +25,7 @@ void WarpZone_Fade_PreDraw(entity this)
                this.drawmask = MASK_NORMAL;
 }
 
-void WarpZone_Touch ();
+void WarpZone_Touch (entity this);
 NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
 {
        warpzone_warpzones_exist = 1;
index d3d7250..5967c1b 100644 (file)
@@ -667,8 +667,8 @@ entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
 }
 
 .entity WarpZone_refsys;
-void WarpZone_RefSys_GC()
-{SELFPARAM();
+void WarpZone_RefSys_GC(entity this)
+{
        // garbage collect unused reference systems
        this.nextthink = time + 1;
        if(this.owner.WarpZone_refsys != this)
index 9bc3946..c8a241f 100644 (file)
@@ -173,7 +173,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
                ts.SendEntity3 = WarpZone_Teleported_Send;
                ts.SendFlags = 0xFFFFFF;
                ts.drawonlytoclient = player;
-               setthink(ts, SUB_Remove_self);
+               setthink(ts, SUB_Remove);
                ts.nextthink = time + 1;
                ts.owner = player;
                ts.enemy = wz;
@@ -190,8 +190,8 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
        return 1;
 }
 
-void WarpZone_Touch ()
-{SELFPARAM();
+void WarpZone_Touch (entity this)
+{
        if(other.classname == "trigger_warpzone")
                return;
 
@@ -543,8 +543,8 @@ void WarpZonePosition_InitStep_FindTarget(entity this)
        this.enemy.aiment = this;
 }
 
-void WarpZoneCamera_Think()
-{SELFPARAM();
+void WarpZoneCamera_Think(entity this)
+{
        if(this.warpzone_save_origin != this.origin
        || this.warpzone_save_angles != this.angles
        || this.warpzone_save_eorigin != this.enemy.origin
@@ -708,7 +708,7 @@ void WarpZone_InitStep_FindTarget(entity this)
        }
 }
 
-void WarpZone_Think();
+void WarpZone_Think(entity this);
 void WarpZone_InitStep_FinalizeTransform(entity this)
 {
        if(!this.enemy || this.enemy.enemy != this)
@@ -817,8 +817,8 @@ void WarpZones_Reconnect()
                WarpZone_InitStep_FinalizeTransform(e);
 }
 
-void WarpZone_Think()
-{SELFPARAM();
+void WarpZone_Think(entity this)
+{
        if(this.warpzone_save_origin != this.origin
        || this.warpzone_save_angles != this.angles
        || this.warpzone_save_eorigin != this.enemy.origin
index 2f0b425..ef8451e 100644 (file)
@@ -163,8 +163,8 @@ void waypoint_addlink(entity from, entity to)
 // relink this spawnfunc_waypoint
 // (precompile a list of all reachable waypoints from this spawnfunc_waypoint)
 // (SLOW!)
-void waypoint_think()
-{SELFPARAM();
+void waypoint_think(entity this)
+{
        entity e;
        vector sv, sm1, sm2, ev, em1, em2, dv;
 
index a031555..23c0fa6 100644 (file)
@@ -39,7 +39,7 @@ float botframe_cachedwaypointlinks;
 
 spawnfunc(waypoint);
 void waypoint_addlink(entity from, entity to);
-void waypoint_think();
+void waypoint_think(entity this);
 void waypoint_clearlinks(entity wp);
 void waypoint_schedulerelink(entity wp);
 
index 55440ca..b9928f0 100644 (file)
@@ -284,7 +284,7 @@ float CheatImpulse(entity this, int imp)
        END_CHEAT_FUNCTION();
 }
 
-void DragBox_Think();
+void DragBox_Think(entity this);
 float drag_lastcnt;
 float CheatCommand(entity this, int argc)
 {
@@ -1040,8 +1040,8 @@ void Drag_MoveDrag(entity from, entity to)
        }
 }
 
-void DragBox_Think()
-{SELFPARAM();
+void DragBox_Think(entity this)
+{
        if(this.aiment && this.enemy)
        {
                this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
index 4dd0c2f..e9fbdbd 100644 (file)
@@ -696,8 +696,8 @@ void ClientInit_misc(entity this)
        WriteCoord(channel, autocvar_g_trueaim_minrange);
 }
 
-void ClientInit_CheckUpdate()
-{SELFPARAM();
+void ClientInit_CheckUpdate(entity this)
+{
        this.nextthink = time;
        if(this.count != autocvar_g_balance_armor_blockpercent)
        {
@@ -712,7 +712,7 @@ void ClientInit_Spawn()
        setthink(e, ClientInit_CheckUpdate);
        Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
 
-       WITHSELF(e, ClientInit_CheckUpdate());
+       WITHSELF(e, ClientInit_CheckUpdate(e));
 }
 
 /*
@@ -810,8 +810,8 @@ void ClientKill_Now()
 
        // now I am sure the player IS dead
 }
-void KillIndicator_Think()
-{SELFPARAM();
+void KillIndicator_Think(entity this)
+{
        if (gameover)
        {
                this.owner.killindicator = world;
@@ -1222,8 +1222,8 @@ void ClientDisconnect()
        if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false);
 }
 
-void ChatBubbleThink()
-{SELFPARAM();
+void ChatBubbleThink(entity this)
+{
        this.nextthink = time;
        if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
        {
index 5722934..b1ca519 100644 (file)
@@ -37,11 +37,11 @@ void Drop_Special_Items(entity player)
        MUTATOR_CALLHOOK(DropSpecialItems, player);
 }
 
-void CopyBody_Think()
-{SELFPARAM();
+void CopyBody_Think(entity this)
+{
        if(this.CopyBody_nextthink && time > this.CopyBody_nextthink)
        {
-               this.CopyBody_think();
+               this.CopyBody_think(this);
                if(wasfreed(this))
                        return;
                this.CopyBody_nextthink = this.nextthink;
index 22c595f..16637fe 100644 (file)
@@ -5,8 +5,8 @@
 .float istypefrag;
 
 .float CopyBody_nextthink;
-.void() CopyBody_think;
-void CopyBody_Think();
+.void(entity this) CopyBody_think;
+void CopyBody_Think(entity this);
 void CopyBody(entity this, float keepvelocity);
 
 void player_setupanimsformodel();
index a798f28..5bacd0d 100644 (file)
@@ -193,9 +193,8 @@ void timeout_handler_reset()
        remove(self);
 }
 
-void timeout_handler_think()
+void timeout_handler_think(entity this)
 {
-       SELFPARAM();
        switch (timeout_status)
        {
                case TIMEOUT_ACTIVE:
index b79a570..a45d913 100644 (file)
@@ -55,7 +55,7 @@ float timeout_status;    // (values: 0, 1, 2) contains whether a timeout is not
 .vector lastV_angle;     // used when pausing the game in order to force the player to keep his old view angle fixed
 
 // allow functions to be used in other code like g_world.qc and teamplay.qc
-void timeout_handler_think();
+void timeout_handler_think(entity this);
 
 // used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
 void CommonCommand_macro_write_aliases(float fh);
@@ -100,7 +100,7 @@ void print_to(entity to, string input);
 // used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
 void timeout_handler_reset();
 
-void timeout_handler_think();
+void timeout_handler_think(entity this);
 
 // ===================================================
 //  Common commands used in both sv_cmd.qc and cmd.qc
index 138657b..616727c 100644 (file)
@@ -210,9 +210,8 @@ void RadarMap_Next()
        remove(radarmapper);
        radarmapper = world;
 }
-void RadarMap_Think()
+void RadarMap_Think(entity this)
 {
-       SELFPARAM();
        // rough map entity
        //   cnt: current line
        //   size: pixel width/height
index bc530b9..f056f0f 100644 (file)
@@ -39,9 +39,8 @@ void PutObserverInServer();
 // =====================================================
 
 //  used by GameCommand_make_mapinfo()
-void make_mapinfo_Think()
+void make_mapinfo_Think(entity this)
 {
-       SELFPARAM();
        if (MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 1))
        {
                LOG_INFO("Done rebuiling mapinfos.\n");
index 15d27a3..982e55c 100644 (file)
@@ -387,9 +387,8 @@ void reset_map(bool dorespawn)
 }
 
 // Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown is set)
-void ReadyRestart_think()
+void ReadyRestart_think(entity this)
 {
-       SELFPARAM();
        restart_mapalreadyrestarted = true;
        reset_map(true);
        Score_ClearAll();
index 6081b5b..730dad6 100644 (file)
@@ -501,8 +501,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
        if(targ.killcount) { targ.killcount = 0; }
 }
 
-void Ice_Think()
-{SELFPARAM();
+void Ice_Think(entity this)
+{
        if(!STAT(FROZEN, self.owner) || self.owner.iceblock != self)
        {
                remove(self);
@@ -541,7 +541,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
        targ.iceblock = ice;
        targ.revival_time = 0;
 
-       WITHSELF(ice, Ice_Think());
+       WITHSELF(ice, Ice_Think(ice));
 
        RemoveGrapplingHook(targ);
 
@@ -850,7 +850,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                        farcent.origin = hitloc;
                        farcent.forcetype = FORCETYPE_FORCEATPOS;
                        farcent.nextthink = time + 0.1;
-                       setthink(farcent, SUB_Remove_self);
+                       setthink(farcent, SUB_Remove);
                }
                else
                {
@@ -1251,8 +1251,8 @@ void Fire_ApplyEffect(entity e)
                e.effects &= ~EF_FLAME;
 }
 
-void fireburner_think()
-{SELFPARAM();
+void fireburner_think(entity this)
+{
        // for players, this is done in the regular loop
        if(wasfreed(self.owner))
        {
index ca5c45b..e2c5ea2 100644 (file)
@@ -80,7 +80,7 @@ float Obituary_WeaponDeath(
 
 void Obituary(entity attacker, entity inflictor, entity targ, int deathtype);
 
-void Ice_Think();
+void Ice_Think(entity this);
 
 void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypoint);
 
@@ -106,7 +106,7 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e
 .float fire_hitsound;
 .entity fire_burner;
 
-void fireburner_think();
+void fireburner_think(entity this);
 
 float Fire_IsBurning(entity e);
 
@@ -115,5 +115,3 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt);
 void Fire_ApplyDamage(entity e);
 
 void Fire_ApplyEffect(entity e);
-
-void fireburner_think();
index 34719e2..3be5e66 100644 (file)
@@ -90,7 +90,7 @@ void GrapplingHookReset(entity this)
                remove(this);
 }
 
-void GrapplingHookThink();
+void GrapplingHookThink(entity this);
 void GrapplingHook_Stop()
 {SELFPARAM();
        Send_Effect(EFFECT_HOOK_IMPACT, self.origin, '0 0 0', 1);
@@ -134,8 +134,8 @@ bool GrapplingHookSend(entity this, entity to, int sf)
 
 int autocvar_g_grappling_hook_tarzan;
 
-void GrapplingHookThink()
-{SELFPARAM();
+void GrapplingHookThink(entity this)
+{
        float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch;
        vector dir, org, end, v0, dv, v, myorg, vs;
        if(self.realowner.hook != self) // how did that happen?
@@ -301,8 +301,8 @@ void GrapplingHookThink()
        }
 }
 
-void GrapplingHookTouch ()
-{SELFPARAM();
+void GrapplingHookTouch (entity this)
+{
        if(other.movetype == MOVETYPE_FOLLOW)
                return;
        PROJECTILE_TOUCH;
index b8237fa..796af16 100644 (file)
@@ -1,6 +1,6 @@
 #include "g_lights.qh"
 
-void train_next();
+void train_next(entity this);
 
 const float LOOP = 1;
 
@@ -34,9 +34,8 @@ flags:
 "NOSHADOW" will not cast shadows in realtime lighting mode
 "FOLLOW" will follow the entity which "targetname" matches "target"
 */
-void dynlight_think()
+void dynlight_think(entity this)
 {
-    SELFPARAM();
        if(!self.owner)
                remove(self);
 
index b469074..1b785c2 100644 (file)
@@ -1,9 +1,9 @@
 #pragma once
 
-void SUB_NullThink();
+void SUB_NullThink(entity this);
 
-void()  SUB_CalcMoveDone;
-void() SUB_CalcAngleMoveDone;
+void SUB_CalcMoveDone(entity this);
+void SUB_CalcAngleMoveDone(entity this);
 
 spawnfunc(info_null);
 
@@ -26,7 +26,7 @@ Makes client invisible or removes non-client
 */
 void SUB_VanishOrRemove (entity ent);
 
-void SUB_SetFade_Think ();
+void SUB_SetFade_Think (entity this);
 
 /*
 ==================
@@ -45,20 +45,20 @@ calculate self.velocity and self.nextthink to reach dest from
 self.origin traveling at speed
 ===============
 */
-void SUB_CalcMoveDone ();
+void SUB_CalcMoveDone(entity this);
 
 .float platmovetype_turn;
-void SUB_CalcMove_controller_think ();
+void SUB_CalcMove_controller_think (entity this);
 
 void SUB_CalcMove_controller_setbezier (entity controller, vector org, vector control, vector dest);
 
 void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector dest);
 
-void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func);
+void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
 
-void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func);
+void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void(entity this) func);
 
-void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func);
+void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
 
 /*
 =============
@@ -70,12 +70,12 @@ self.angles rotating
 The calling function should make sure self.think is valid
 ===============
 */
-void SUB_CalcAngleMoveDone ();
+void SUB_CalcAngleMoveDone (entity this);
 
 // FIXME: I fixed this function only for rotation around the main axes
-void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func);
+void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void(entity this) func);
 
-void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func);
+void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func);
 
 /*
 ==================
index f55b4f7..9d67d33 100644 (file)
@@ -41,8 +41,8 @@ const float LATENCY_THINKRATE = 10;
 .float latency_cnt;
 .float latency_time;
 entity pingplreport;
-void PingPLReport_Think()
-{SELFPARAM();
+void PingPLReport_Think(entity this)
+{
        float delta;
        entity e;
 
@@ -104,8 +104,8 @@ void SetDefaultAlpha()
        }
 }
 
-void GotoFirstMap()
-{SELFPARAM();
+void GotoFirstMap(entity this)
+{
        float n;
        if(autocvar__sv_init)
        {
@@ -515,8 +515,8 @@ bool RandomSeed_Send(entity this, entity to, int sf)
        WriteShort(MSG_ENTITY, this.cnt);
        return true;
 }
-void RandomSeed_Think()
-{SELFPARAM();
+void RandomSeed_Think(entity this)
+{
        this.cnt = bound(0, floor(random() * 65536), 65535);
        this.nextthink = time + 5;
 
@@ -528,7 +528,7 @@ void RandomSeed_Spawn()
        setthink(randomseed, RandomSeed_Think);
        Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
 
-       WITHSELF(randomseed, getthink(randomseed)()); // sets random seed and nextthink
+       WITHSELF(randomseed, getthink(randomseed)(randomseed)); // sets random seed and nextthink
 }
 
 spawnfunc(__init_dedicated_server)
index ec84545..5de4c56 100644 (file)
@@ -196,8 +196,8 @@ LABEL(skip)
        }
 }
 
-void OnlineBanList_Think()
-{SELFPARAM();
+void OnlineBanList_Think(entity this)
+{
        float argc;
        string uri;
        float i, n;
index ca4d8cf..bf38937 100644 (file)
@@ -68,8 +68,8 @@ item_key
 /**
  * Key touch handler.
  */
-void item_key_touch()
-{SELFPARAM();
+void item_key_touch(entity this)
+{
        if (!IS_PLAYER(other))
                return;
 
index 5802a5b..3a918c2 100644 (file)
@@ -960,11 +960,11 @@ void EliminatedPlayers_Init(float(entity) isEliminated_func)
 
 
 
-void adaptor_think2use_hittype_splash() // for timed projectile detonation
-{SELFPARAM();
+void adaptor_think2use_hittype_splash(entity this) // for timed projectile detonation
+{
        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());
+       WITHSELF(this, adaptor_think2use(this));
 }
 
 // deferred dropping
index 2e947f2..634d3fb 100644 (file)
@@ -116,8 +116,6 @@ void WarpZone_crosshair_trace(entity pl);
 
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
 
-void adaptor_think2use();
-
 #define IS_DEAD(s) ((s).deadflag != DEAD_NO)
 
 
index f22ba7b..47544da 100644 (file)
@@ -225,7 +225,7 @@ void assault_roundstart_use(entity this, entity actor, entity trigger)
                        it.team = NUM_TEAM_1;
 
                // Dubbles as teamchange
-               WITHSELF(it, turret_respawn());
+               WITHSELF(it, turret_respawn(it));
        ));
 }
 void assault_roundstart_use_this(entity this)
@@ -238,8 +238,8 @@ void assault_roundstart_use_self()
     assault_roundstart_use(this, NULL, NULL);
 }
 
-void assault_wall_think()
-{SELFPARAM();
+void assault_wall_think(entity this)
+{
        if(self.enemy.health < 0)
        {
                self.model = "";
@@ -257,7 +257,7 @@ void assault_wall_think()
 // trigger new round
 // reset objectives, toggle spawnpoints, reset triggers, ...
 void vehicles_clearreturn(entity veh);
-void vehicles_spawn();
+void vehicles_spawn(entity this);
 void assault_new_round()
 {SELFPARAM();
        //bprint("ASSAULT: new round\n");
@@ -267,7 +267,7 @@ void assault_new_round()
 
     FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA(
         vehicles_clearreturn(it);
-        WITHSELF(it, vehicles_spawn());
+        WITHSELF(it, vehicles_spawn(it));
     ));
 
        // up round counter
index 4f449a1..bb949a4 100644 (file)
@@ -286,8 +286,8 @@ bool ctf_CaptureShield_Customize()
        return true;
 }
 
-void ctf_CaptureShield_Touch()
-{SELFPARAM();
+void ctf_CaptureShield_Touch(entity this)
+{
        if(!other.ctf_captureshielded) { return; }
        if(CTF_SAMETEAM(self, other)) { return; }
 
@@ -851,8 +851,8 @@ void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage
        }
 }
 
-void ctf_FlagThink()
-{SELFPARAM();
+void ctf_FlagThink(entity this)
+{
        // declarations
        entity tmp_entity;
 
index c44dfc3..95e0bcd 100644 (file)
@@ -20,7 +20,7 @@ CLASS(Flag, Pickup)
     ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13')
 ENDCLASS(Flag)
 Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); }
-void ctf_FlagTouch() { SELFPARAM(); ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
+void ctf_FlagTouch(entity this) { ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
 
 // flag constants // for most of these, there is just one question to be asked: WHYYYYY?
 
index ecf3cb0..1584933 100644 (file)
@@ -96,7 +96,7 @@ void cts_EventLog(string mode, entity actor) // use an alias for easy changing a
                GameLogEcho(strcat(":cts:", mode, ":", ((actor != world) ? (strcat(":", ftos(actor.playerid))) : "")));
 }
 
-void KillIndicator_Think();
+void KillIndicator_Think(entity this);
 void CTS_ClientKill(entity e) // silent version of ClientKill, used when player finishes a CTS run. Useful to prevent cheating by running back to the start line and starting out with more speed
 {
     e.killindicator = spawn();
index 7bed67b..5514ed2 100644 (file)
@@ -207,8 +207,8 @@ void AnimateDomPoint()
                self.frame = 0;
 }
 
-void dompointthink()
-{SELFPARAM();
+void dompointthink(entity this)
+{
        float fragamt;
 
        self.nextthink = time + 0.1;
@@ -251,8 +251,8 @@ void dompointthink()
        }
 }
 
-void dompointtouch()
-{SELFPARAM();
+void dompointtouch(entity this)
+{
        entity head;
        if (!IS_PLAYER(other))
                return;
@@ -306,8 +306,6 @@ void dompointtouch()
        dompoint_captured();
 }
 
-void dom_controlpoint_setup(entity this);
-void dom_controlpoint_setup_self() { SELFPARAM(); dom_controlpoint_setup(this); }
 void dom_controlpoint_setup(entity this)
 {
        entity head;
@@ -540,7 +538,7 @@ spawnfunc(dom_controlpoint)
                remove(this);
                return;
        }
-       setthink(this, dom_controlpoint_setup_self);
+       setthink(this, dom_controlpoint_setup);
        this.nextthink = time + 0.1;
        this.reset = dom_controlpoint_setup;
 
@@ -652,12 +650,11 @@ void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float p
        //eprint(e);
 }
 
-void self_spawnfunc_dom_controlpoint() { SELFPARAM(); spawnfunc_dom_controlpoint(self); }
 void dom_spawnpoint(vector org)
 {
        entity e = spawn();
        e.classname = "dom_controlpoint";
-       setthink(e, self_spawnfunc_dom_controlpoint);
+       setthink(e, spawnfunc_dom_controlpoint);
        e.nextthink = time;
        setorigin(e, org);
        spawnfunc_dom_controlpoint(e);
index 418e563..d3e4046 100644 (file)
@@ -141,7 +141,7 @@ void invasion_SpawnChosenMonster(float mon)
                        monster = spawnmonster("", mon, world, world, e.origin, false, false, 2);
                else return;
 
-               setthink(e, SUB_Remove_self);
+               setthink(e, SUB_Remove);
                e.nextthink = time + 0.1;
        }
        else
index 0d46dca..22ae10f 100644 (file)
@@ -81,9 +81,8 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an
                GameLogEcho(strcat(":ka:", mode, ((actor != world) ? (strcat(":", ftos(actor.playerid))) : "")));
 }
 
-void ka_TouchEvent();
+void ka_TouchEvent(entity this);
 void ka_RespawnBall(entity this);
-void ka_RespawnBall_self() { SELFPARAM(); ka_RespawnBall(this); }
 void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
 {
        if(gameover) { return; }
@@ -102,7 +101,7 @@ void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
        self.angles = '0 0 0';
        self.effects = autocvar_g_keepawayball_effects;
        settouch(self, ka_TouchEvent);
-       setthink(self, ka_RespawnBall_self);
+       setthink(self, ka_RespawnBall);
        self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
        Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
@@ -114,8 +113,8 @@ void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
        sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 }
 
-void ka_TimeScoring()
-{SELFPARAM();
+void ka_TimeScoring(entity this)
+{
        if(self.owner.ballcarried)
        { // add points for holding the ball after a certain amount of time
                if(autocvar_g_keepaway_score_timepoints)
@@ -126,8 +125,8 @@ void ka_TimeScoring()
        }
 }
 
-void ka_TouchEvent() // runs any time that the ball comes in contact with something
-{SELFPARAM();
+void ka_TouchEvent(entity this) // runs any time that the ball comes in contact with something
+{
        if(gameover) { return; }
        if(!self) { return; }
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
@@ -195,7 +194,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        ball.movetype = MOVETYPE_BOUNCE;
        ball.wait = time + 1;
        settouch(ball, ka_TouchEvent);
-       setthink(ball, ka_RespawnBall_self);
+       setthink(ball, ka_RespawnBall);
        ball.nextthink = time + autocvar_g_keepawayball_respawntime;
        ball.takedamage = DAMAGE_YES;
        ball.effects &= ~EF_NODRAW;
@@ -232,7 +231,7 @@ void ka_Reset(entity this)
 
        if(time < game_starttime)
        {
-               setthink(this, ka_RespawnBall_self);
+               setthink(this, ka_RespawnBall);
                settouch(this, func_null);
                this.nextthink = game_starttime;
        }
index 6552d3c..4d65abf 100644 (file)
@@ -215,8 +215,8 @@ void kh_Controller_SetThink(float t, kh_Think_t func)  // runs occasionaly
                kh_controller.nextthink = time; // force
 }
 void kh_WaitForPlayers();
-void kh_Controller_Think()  // called a lot
-{SELFPARAM();
+void kh_Controller_Think(entity this)  // called a lot
+{
        if(intermission_running)
                return;
        if(self.cnt > 0)
@@ -505,8 +505,8 @@ void kh_Key_Collect(entity key, entity player)  //a player picks up a dropped ke
        kh_Key_AssignTo(key, player); // this also updates .kh_state
 }
 
-void kh_Key_Touch()  // runs many, many times when a key has been dropped and can be picked up
-{SELFPARAM();
+void kh_Key_Touch(entity this)  // runs many, many times when a key has been dropped and can be picked up
+{
        if(intermission_running)
                return;
 
@@ -726,8 +726,8 @@ void kh_LoserTeam(float teem, entity lostkey)  // runs when a player pushes a fl
        kh_FinishRound();
 }
 
-void kh_Key_Think()  // runs all the time
-{SELFPARAM();
+void kh_Key_Think(entity this)  // runs all the time
+{
        if(intermission_running)
                return;
 
index f45fc84..98eb9cd 100644 (file)
@@ -298,8 +298,8 @@ MUTATOR_HOOKFUNCTION(lms, FilterItem)
        return true;
 }
 
-void lms_extralife()
-{SELFPARAM();
+void lms_extralife(entity this)
+{
        StartItem(this, ITEM_ExtraLife);
 }
 
index fff4b60..15a845c 100644 (file)
@@ -29,8 +29,8 @@ void path_dbg_think()
     self.nextthink = time + 1;
 }
 
-void __showpath2_think()
-{SELFPARAM();
+void __showpath2_think(entity this)
+{
     #ifdef TURRET_DEBUG
        mark_info(self.origin,1);
        #endif
@@ -82,7 +82,7 @@ void pathlib_showsquare(vector where,float goodsquare,float _lifetime)
 
     s           = spawn();
     s.alpha     = 0.25;
-    setthink(s, SUB_Remove_self);
+    setthink(s, SUB_Remove);
     s.nextthink = _lifetime;
     s.scale     = pathlib_gridsize / 512.001;
     s.solid     = SOLID_NOT;
@@ -107,7 +107,7 @@ void pathlib_showedge(vector where,float _lifetime,float rot)
 
     e           = spawn();
     e.alpha     = 0.25;
-    setthink(e, SUB_Remove_self);
+    setthink(e, SUB_Remove);
     e.nextthink = _lifetime;
     e.scale     = pathlib_gridsize / 512;
     e.solid     = SOLID_NOT;
index cb38136..b3ae090 100644 (file)
@@ -11,7 +11,7 @@ void pathlib_deletepath(entity start)
     e = findchainentity(owner, start);
     while(e)
     {
-        setthink(e, SUB_Remove_self);
+        setthink(e, SUB_Remove);
         e.nextthink = time;
         e = e.chain;
     }
@@ -23,7 +23,7 @@ const float PATHLIB_NODEEXPIRE = 20;
 void dumpnode(entity n)
 {
     n.is_path_node = false;
-    setthink(n, SUB_Remove_self);
+    setthink(n, SUB_Remove);
     n.nextthink    = time;
 }
 
@@ -49,7 +49,7 @@ entity pathlib_mknode(vector where,entity parent)
 
     node = spawn();
 
-    setthink(node, SUB_Remove_self);
+    setthink(node, SUB_Remove);
     node.nextthink    = time + PATHLIB_NODEEXPIRE;
     node.is_path_node = true;
     node.owner        = openlist;
index 2188702..52d0005 100644 (file)
@@ -73,8 +73,8 @@ vector pathlib_flynode(entity this, vector start, vector end, float doedge)
     return end;
 }
 
-void a_think()
-{SELFPARAM();
+void a_think(entity this)
+{
     te_lightning1(this,this.origin, this.pos1);
     if(this.cnt < time)
         remove(this);
index e96de83..f86c270 100644 (file)
@@ -234,8 +234,8 @@ entity pathlib_waypointpath_step()
 
     return world;
 }
-void plas_think()
-{SELFPARAM();
+void plas_think(entity this)
+{
     pathlib_waypointpath_step();
     if(pathlib_foundgoal)
         return;
index 01f578a..f0728b7 100644 (file)
@@ -249,8 +249,8 @@ float Portal_WillHitPlane(vector eorg, vector emins, vector emaxs, vector evel,
 #endif
 }
 
-void Portal_Touch()
-{SELFPARAM();
+void Portal_Touch(entity this)
+{
        vector g;
 
 #ifdef PORTALS_ARE_NOT_SOLID
@@ -322,7 +322,7 @@ void Portal_Touch()
                                other.effects += EF_BLUE - EF_RED;
 }
 
-void Portal_Think();
+void Portal_Think(entity this);
 void Portal_MakeBrokenPortal(entity portal)
 {
        portal.skin = 2;
@@ -452,8 +452,8 @@ void Portal_Think_TryTeleportPlayer(entity this, entity e, vector g)
                Portal_TeleportPlayer(this, e);
 }
 
-void Portal_Think()
-{SELFPARAM();
+void Portal_Think(entity this)
+{
        entity o;
        vector g;
 
@@ -574,8 +574,8 @@ void Portal_ClearAll(entity own)
        Portal_ClearAll_PortalsOnly(own);
        W_Porto_Remove(own);
 }
-void Portal_RemoveLater_Think()
-{SELFPARAM();
+void Portal_RemoveLater_Think(entity this)
+{
        Portal_Remove(this, this.cnt);
 }
 void Portal_RemoveLater(entity portal, float kill)
index 67e9d73..3d4bb78 100644 (file)
@@ -698,8 +698,8 @@ void checkpoint_passed(entity this, entity player)
        }
 }
 
-void checkpoint_touch()
-{SELFPARAM();
+void checkpoint_touch(entity this)
+{
        EXACTTRIGGER_TOUCH;
        checkpoint_passed(this, other);
 }
@@ -1093,8 +1093,8 @@ void race_ImposePenaltyTime(entity pl, float penalty, string reason)
        }
 }
 
-void penalty_touch()
-{SELFPARAM();
+void penalty_touch(entity this)
+{
        EXACTTRIGGER_TOUCH;
        if(other.race_lastpenalty != this)
        {
index 8810ff0..ad0fcaa 100644 (file)
@@ -3,10 +3,8 @@
 #include "command/vote.qh"
 #include "../common/util.qh"
 
-void round_handler_Think()
+void round_handler_Think(entity this)
 {
-       SELFPARAM();
-
        if (time < game_starttime)
        {
                round_handler_Reset(game_starttime);
@@ -76,9 +74,8 @@ void round_handler_Init(float the_delay, float the_count, float the_round_timeli
 
 // NOTE: this is only needed because if round_handler spawns at time 1
 // gamestarttime isn't initialized yet
-void round_handler_FirstThink()
+void round_handler_FirstThink(entity this)
 {
-       SELFPARAM();
        round_starttime = max(time, game_starttime) + this.count;
        setthink(this, round_handler_Think);
        this.nextthink = max(time, game_starttime);
index d725654..69c1360 100644 (file)
@@ -47,9 +47,8 @@ bool SpawnEvent_Send(entity this, entity to, int sf)
 }
 
 .vector spawnpoint_prevorigin;
-void spawnpoint_think()
+void spawnpoint_think(entity this)
 {
-    SELFPARAM();
        this.nextthink = time + 0.1;
        if(this.origin != this.spawnpoint_prevorigin)
        {
index 921da4f..4caadee 100644 (file)
@@ -129,7 +129,7 @@ void target_give_init(entity this)
                else if (targ.classname == "item_health_mega")
                        this.health = 200;
                //remove(targ); // removing ents in init functions causes havoc, workaround:
-        setthink(targ, SUB_Remove_self);
+        setthink(targ, SUB_Remove);
         targ.nextthink = time;
        }
        this.spawnflags = 2;
index 272a91f..954f825 100644 (file)
@@ -73,7 +73,7 @@ float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype,
        return true; // if none of these return, then allow damage anyway.
 }
 
-void W_PrepareExplosionByDamage(entity this, entity attacker, void() explode)
+void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
 {
        this.takedamage = DAMAGE_NO;
        this.event_damage = func_null;
index 2ab8ea5..363941b 100644 (file)
@@ -5,4 +5,4 @@ void W_GiveWeapon (entity e, float wep);
 .float prevstrengthsoundattempt;
 void W_PlayStrengthSound(entity player);
 float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception);
-void W_PrepareExplosionByDamage(entity this, entity attacker, void() explode);
+void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode);
index f1977c8..fe59b5b 100644 (file)
@@ -12,8 +12,8 @@
 #include <common/weapons/all.qh>
 #include <common/state.qh>
 
-void thrown_wep_think()
-{SELFPARAM();
+void thrown_wep_think(entity this)
+{
        this.nextthink = time;
        if(this.oldorigin != this.origin)
        {
index b0482da..5a27025 100644 (file)
@@ -1,7 +1,7 @@
 #pragma once
 
 .float savenextthink;
-void thrown_wep_think();
+void thrown_wep_think(entity this);
 
 // returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
 string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
index 0e7f399..97e008c 100644 (file)
@@ -62,9 +62,8 @@ vector CL_Weapon_GetShotOrg(int wpn)
 ..entity weaponentity_fld;
 .float m_alpha;
 
-void CL_Weaponentity_Think()
+void CL_Weaponentity_Think(entity this)
 {
-       SELFPARAM();
        this.nextthink = time;
        if (intermission_running) this.frame = this.anim_idle.x;
        .entity weaponentity = this.weaponentity_fld;
@@ -107,9 +106,8 @@ void CL_Weaponentity_Think()
        }
 }
 
-void CL_ExteriorWeaponentity_Think()
+void CL_ExteriorWeaponentity_Think(entity this)
 {
-       SELFPARAM();
        this.nextthink = time;
        if (this.owner.exteriorweaponentity != this)
        {