]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/hud_no_joypad_keys' into 'master'
authorMario <zacjardine@y7mail.com>
Wed, 8 Jun 2016 08:33:39 +0000 (08:33 +0000)
committerMario <zacjardine@y7mail.com>
Wed, 8 Jun 2016 08:33:39 +0000 (08:33 +0000)
Don't show joypad keys in the HUD if no joypad has been detected

See merge request !320

178 files changed:
qcsrc/client/announcer.qc
qcsrc/client/autocvars.qh
qcsrc/client/main.qc
qcsrc/client/shownames.qc
qcsrc/client/view.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/nix/nix.qc
qcsrc/common/mutators/mutator/overkill/hmg.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/ewheel.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/machinegun_weapon.qc
qcsrc/common/turrets/turret/phaser_weapon.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/util.qc
qcsrc/common/util.qh
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.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/rifle.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/common/weapons/weapon/vortex.qc
qcsrc/lib/csqcmodel/sv_model.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/lib/warpzone/server.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/havocbot/havocbot.qh
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
qcsrc/server/weapons/weaponsystem.qh

index 656349a0f63688478f99f2a9cb5220cf44c478ec..e5fd7d575f643a7e9c7f940c62f8eec94c2b82a5 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 d797cee330f4c6dbb358aab71d6c9dbf79f0114e..5b42978679d42b0dae2436762150c0c555cdcb5e 100644 (file)
@@ -412,7 +412,6 @@ float autocvar_cl_hitsound_max_pitch = 1.5;
 float autocvar_cl_hitsound_nom_damage = 25;
 float autocvar_cl_hitsound_antispam_time;
 int autocvar_cl_eventchase_death = 1;
-int autocvar_cl_eventchase_nexball = 1;
 vector autocvar_cl_eventchase_generator_viewoffset = '0 0 80';
 float autocvar_cl_eventchase_generator_distance = 400;
 float autocvar_cl_eventchase_distance = 140;
index 09f78d2742038a757f4dff17bf7da2c2e4e9881b..39c30f7d528aefe7cfef76adf106a5dc8fb8990c 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 79acf4fb8a38386e0344b1d55e1219ec9df1261e..e9db990c82d474a07e06ee358dd9f0a99313ece1 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 4696b5ef520f979a310d6c890724f2307ba52552..ae705793450651075782c73e01b308dba010d898 100644 (file)
@@ -741,8 +741,6 @@ bool WantEventchase(entity this)
                        return true;
                if(MUTATOR_CALLHOOK(WantEventchase, this))
                        return true;
-               if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
-                       return true;
                if(autocvar_cl_eventchase_death && (STAT(HEALTH) <= 0))
                {
                        if(autocvar_cl_eventchase_death == 2)
@@ -922,9 +920,8 @@ LABEL(normalcolor)
        return wcross_color;
 }
 
-void HUD_Crosshair()
-{SELFPARAM();
-       entity e = this;
+void HUD_Crosshair(entity this)
+{
        float f, i, j;
        vector v;
        if(!scoreboard_active && !camera_active && intermission != 2 &&
@@ -981,6 +978,7 @@ void HUD_Crosshair()
                string wcross_name = "";
                float wcross_scale, wcross_blur;
 
+        entity e = this; // wtf?
                if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1))
                {
                        e = switchingweapon;
@@ -1307,7 +1305,7 @@ void HUD_Crosshair()
        }
 }
 
-void HUD_Draw()
+void HUD_Draw(entity this)
 {
        if(!intermission)
        if (MUTATOR_CALLHOOK(HUD_Draw_overlay))
@@ -1342,7 +1340,7 @@ void HUD_Draw()
 
        // crosshair goes VERY LAST
        UpdateDamage();
-       HUD_Crosshair();
+       HUD_Crosshair(this);
        HitSound();
 }
 
@@ -1360,7 +1358,8 @@ int lasthud;
 float vh_notice_time;
 void WaypointSprite_Load();
 void CSQC_UpdateView(float w, float h)
-{SELFPARAM();
+{
+    SELFPARAM();
     TC(int, w); TC(int, h);
        entity e;
        float fov;
@@ -2171,7 +2170,7 @@ void CSQC_UpdateView(float w, float h)
 
        scoreboard_active = HUD_WouldDrawScoreboard();
 
-       HUD_Draw();
+       HUD_Draw(this);
 
        if(NextFrameCommand)
        {
index 8763ba2379b99817ef5702ff9be0fe744ccd7d70..6261fa842f987773298274395246d7a32f782739 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 bb954e2eb17640aea3b75c035276c3af1cc16367..8cb4a2aa18ff6dcfff9065b62ad01c2b656919af 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 c8afaf99068a6886f668d2c55b15b6c25bd83001..30a0a0c9e589e5eeec56602a722e1bbbea8f71a1 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;
@@ -418,7 +418,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
                {
                        if(!MUTATOR_CALLHOOK(Weapon_ImpactEffect, hitwep))
-                               hitwep.wr_impacteffect(hitwep);
+                               hitwep.wr_impacteffect(hitwep, this);
                }
        }
 }
index eaf725048990991e6416e11cf2bd0490b611f086..20b050c3a4a633ea225e8e7a2e0f523ce17991f1 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 64ddc4473586143bca0a9925103bbb0ec6c9f036..75deb92eaf8a5c448a69c7754ade78af4b82cfd7 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 0d02e4b538e3f789981118358500052609b3399e..1c72b351f7ff7e4e65b48fd9e5bf599f86c11a40 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 1ce1af8c8283fa2a442cd789f0413cd26c034d0c..426cab70e151aea46122fac85d0896113cf1319e 100644 (file)
@@ -1,6 +1,18 @@
 #include "nexball.qh"
 
 #ifdef IMPLEMENTATION
+#ifdef CSQC
+int autocvar_cl_eventchase_nexball = 1;
+
+REGISTER_MUTATOR(cl_nb, true);
+
+MUTATOR_HOOKFUNCTION(cl_nb, WantEventchase)
+{
+       if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
+               return true;
+       return false;
+}
+#endif
 #ifdef SVQC
 .float metertime = _STAT(NB_METERSTART);
 
@@ -40,9 +52,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,11 +96,11 @@ void ball_restart(entity this)
 {
        if(this.owner)
                DropBall(this, this.owner.origin, '0 0 0');
-       ResetBall();
+       ResetBall(this);
 }
 
-void nexball_setstatus()
-{SELFPARAM();
+void nexball_setstatus(entity this)
+{
        this.items &= ~IT_KEY1;
        if(this.ballcarried)
        {
@@ -96,7 +108,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 +133,8 @@ void relocate_nexball(entity this)
        }
 }
 
-void DropOwner()
-{SELFPARAM();
+void DropOwner(entity this)
+{
        entity ownr;
        ownr = this.owner;
        DropBall(this, ownr.origin, ownr.velocity);
@@ -183,7 +196,7 @@ void GiveBall(entity plyr, entity ball)
        plyr.(weaponentity).m_switchweapon = PS(plyr).m_weapon;
        plyr.weapons = WEPSET(NEXBALL);
        Weapon w = WEP_NEXBALL;
-       WITHSELF(plyr, w.wr_resetplayer(w));
+       WITHSELF(plyr, w.wr_resetplayer(w, plyr));
        PS(plyr).m_switchweapon = WEP_NEXBALL;
        WITHSELF(plyr, W_SwitchWeapon(plyr, WEP_NEXBALL));
 }
@@ -220,8 +233,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 +253,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 +289,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 +335,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 +357,8 @@ void basketball_touch()
        }
 }
 
-void GoalTouch()
-{SELFPARAM();
+void GoalTouch(entity this)
+{
        entity ball;
        float isclient, pscore, otherteam;
        string pname;
@@ -702,8 +715,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,18 +730,18 @@ 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;
-       //self.enemy = world;
+       attacker = this.owner;
+       //this.think = func_null;
+       //this.enemy = world;
 
-       PROJECTILE_TOUCH;
+       PROJECTILE_TOUCH(this);
        if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
                if((ball = other.ballcarried) && !STAT(FROZEN, other) && !IS_DEAD(other) && (IS_PLAYER(attacker)))
                {
-                       other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
+                       other.velocity = other.velocity + normalize(this.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
                        UNSET_ONGROUND(other);
                        if(!attacker.ballcarried)
                        {
@@ -745,22 +758,22 @@ void W_Nexball_Touch()
                                GiveBall(attacker, other.ballcarried);
                        }
                }
-       remove(self);
+       remove(this);
 }
 
-void W_Nexball_Attack(float t)
-{SELFPARAM();
+void W_Nexball_Attack(entity actor, float t)
+{
        entity ball;
        float mul, mi, ma;
-       if(!(ball = self.ballcarried))
+       if(!(ball = actor.ballcarried))
                return;
 
-       W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+       W_SetupShot(actor, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
        tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world);
        if(trace_startsolid)
        {
-               if(self.metertime)
-                       self.metertime = 0; // Shot failed, hide the power meter
+               if(actor.metertime)
+                       actor.metertime = 0; // Shot failed, hide the power meter
                return;
        }
 
@@ -778,7 +791,7 @@ void W_Nexball_Attack(float t)
                mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
        }
 
-       DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
+       DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
 
 
        //TODO: use the speed_up cvar too ??
@@ -786,12 +799,12 @@ void W_Nexball_Attack(float t)
 
 vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
 
-void W_Nexball_Attack2()
-{SELFPARAM();
-       if(self.ballcarried.enemy)
+void W_Nexball_Attack2(entity actor)
+{
+       if(actor.ballcarried.enemy)
        {
-               entity _ball = self.ballcarried;
-               W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+               entity _ball = actor.ballcarried;
+               W_SetupShot(actor, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
                DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
                setthink(_ball, W_Nexball_Think);
                _ball.nextthink = time;
@@ -801,10 +814,10 @@ void W_Nexball_Attack2()
        if(!autocvar_g_nexball_tackling)
                return;
 
-       W_SetupShot(self, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
+       W_SetupShot(actor, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
        entity missile = new(ballstealer);
 
-       missile.owner = self;
+       missile.owner = actor;
 
        missile.movetype = MOVETYPE_FLY;
        PROJECTILE_MAKETRIGGER(missile);
@@ -816,7 +829,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;
@@ -854,38 +867,37 @@ float ball_customize()
 
 METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
 {
-    SELFPARAM();
     TC(BallStealer, thiswep);
     if(fire & 1)
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
             if(autocvar_g_nexball_basketball_meter)
             {
-                if(self.ballcarried && !self.metertime)
-                    self.metertime = time;
+                if(actor.ballcarried && !actor.metertime)
+                    actor.metertime = time;
                 else
                     weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
             }
             else
             {
-                W_Nexball_Attack(-1);
+                W_Nexball_Attack(actor, -1);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
             }
     if(fire & 2)
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
         {
-            W_Nexball_Attack2();
+            W_Nexball_Attack2(actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
         }
 
-    if(!(fire & 1) && self.metertime && self.ballcarried)
+    if(!(fire & 1) && actor.metertime && actor.ballcarried)
     {
-        W_Nexball_Attack(time - self.metertime);
+        W_Nexball_Attack(actor, time - actor.metertime);
         // DropBall or stealing will set metertime back to 0
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
     }
 }
 
-METHOD(BallStealer, wr_setup, void(BallStealer this))
+METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor))
 {
     TC(BallStealer, this);
     //weapon_setup(WEP_PORTO.m_id);
@@ -979,7 +991,7 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
                        {
                                self.weapons = self.(weaponentity).weapons;
                                Weapon w = WEP_NEXBALL;
-                               w.wr_resetplayer(w);
+                               w.wr_resetplayer(w, self);
                                PS(self).m_switchweapon = self.(weaponentity).m_switchweapon;
                                W_SwitchWeapon(self, PS(self).m_switchweapon);
 
@@ -989,7 +1001,7 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
 
        }
 
-       nexball_setstatus();
+       nexball_setstatus(self);
 
        return false;
 }
index 38799f2cea4387a4e9533927a804e86351c5db7a..0870ed6bfa323b0811b504b9d7db39330c9fd19a 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 be46b285b4357ce2047e24d184a4d26312bce99a..aceb3e64eacf9f504a2002d1b47dbde0dbb147cc 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 f0255456fceab1c2908f9a5d072f37a0346e02ef..aeac4e1626d88fa2af7b87cc3bc8611fb59f21cd 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 14998989724a728bdb91cdf2959f29f0608121a7..4bcb8c51446ee77020731131ee95bc2e9bc7ef9e 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 95fda671a19f3dec5ceb9cacc38a3871d8c38ec9..98729092ccd2894c10a172c687439fc69c521457 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 0f3ea814c5468517b20b2b43bba638c273c79dac..5b7bf3a56a512101e07ca5fafcfeb97fc6d633b9 100644 (file)
@@ -160,10 +160,9 @@ 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;
+       PROJECTILE_TOUCH(this);
 
        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 751d0fff01ff822e72e81baba4ed49c5b449e0b2..2e9384dc2adb0c37a78319c1ba6411e53328760f 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();
-       PROJECTILE_TOUCH;
+void M_Shambler_Attack_Lightning_Touch(entity this)
+{
+       PROJECTILE_TOUCH(this);
 
        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 264512069a33b015262b4c7da545777bdf8adf10..b9f9bfc21c2992807c513abaf5cd0c7649720138 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;
+       PROJECTILE_TOUCH(this);
 
        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 87cc5d73f8098fd647a28274a9f822e1c880412a..ae8e8751de182271788f96ed8396065ad85a677c 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;
+       PROJECTILE_TOUCH(this);
 
-       M_Wyvern_Attack_Fireball_Explode();
+       M_Wyvern_Attack_Fireball_Explode(this);
 }
 
 bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
index ffbb06c26258c4f0d3b28d073b6378a81c2a3ef7..ec84bb948f21e8503bf1ea321cbbc03699479d9b 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 f1a0576c7374424ddc52a7fb4dd1f42e3d51c2e0..2e7281bc2c2d1f9b08bdccb6005da9c9b228a923 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 59d8cbd973f9b144d63f527881651499542d9581..f8501fc758e1b8184f67e9ff222beab022d647ac 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 d0d206ab04e6278ac1760c8ce7ef9e07f306520f..c450dc5703d8ba2520a64518701b442c9737bb6a 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 8721cede77625d66443783cad5dd860a10ab0a69..fe33046678fa9fc1d46c47a3bd24132753b64a5a 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 39310c9fd7acaf017447731b5505406b8e9e03c0..4e339cea0ed3397acbe476a9f55742a84a0313f0 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);
 
@@ -724,7 +724,7 @@ void nade_touch()
                return;
        }
 
-       PROJECTILE_TOUCH;
+       PROJECTILE_TOUCH(this);
 
        //setsize(self, '-2 -2 -2', '2 2 2');
        //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 0c18993db0514b574a4759b219c919d2c55bec85..e51003204c54e0a949dfde20d580fa1fcadf1845 100644 (file)
@@ -160,7 +160,7 @@ void NIX_GiveCurrentWeapon()
                else
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
 
-               e.wr_resetplayer(e);
+               e.wr_resetplayer(e, self);
 
                // all weapons must be fully loaded when we spawn
                if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
index ee4c85635ec453d80e5bdfc41157251dc33043fe..419123e10477d5e8983402f2e2a8f73dbe4499af 100644 (file)
@@ -89,7 +89,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
-       W_MachineGun_MuzzleFlash();
+       W_MachineGun_MuzzleFlash(actor);
        W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
 
        if (autocvar_g_casings >= 2) // casing code
@@ -100,9 +100,9 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
 }
 
-METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
+METHOD(HeavyMachineGun, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
     else
@@ -166,9 +166,9 @@ METHOD(HeavyMachineGun, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
+METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
index 6f3c146a3fb8ef8da3f635de25a35e0b47310483..c670879e3788e9c8cceff9e3bff4a49614f15b4c 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 c11ebc8a396ae3dbe041faf7d9ef682108a70c81..b3b8f4248aef2f13070132af15e90dc39327e353 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();
-       if(WarpZone_Projectile_Touch())
-               if(wasfreed(self))
+void W_RocketPropelledChainsaw_Touch (entity this)
+{
+       if(WarpZone_Projectile_Touch(this))
+               if(wasfreed(this))
                        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);
@@ -150,9 +150,9 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
+METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
 }
 
@@ -218,9 +218,9 @@ METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep))
 
 #ifdef CSQC
 
-METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
+METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 12;
     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
index c9ab81b4e42ebc8a85a3c11389261cc12e4641e7..3ef52fec5abe6647a32806ba5844a71d43825c3e 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 9d592f27703bc4dcc1a4e5661a301e0bd70fb70f..b3e9ea15a94c1bd9bf3f39b2473694d577c42006 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 ae10cb5a401ab1a0a36478520330d4ae4c9ece2a..142f9d9ba54dce3d379993b0cbfc794336435896 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 ad2fb846d83602fc6769f4628b7946677732307b..3e82db0b5070220b590070aaf8b8ea823333e5b4 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 66ad9d5458cfe25bb154dfc815e3448f175b7de7..385d9fa749653c59048c3dcf7c2f78991a8a5de6 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 ab448b1847e89fa7bfe96c1a4f3867dbf31054d3..3d3c786297c43cb283cd39f43449b4611c98de7b 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 6ec82ab6627f8f5ac680da6ed16321891e6ca0eb..ce7d04d1da29975b09c1c7db9cd9c8a92e746163 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 7c08c41abc6a8545814f2812252603f7b4df875d..931a0630dbac126485cff3c1372c3fa8959aeb1a 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 b3cfb875da28a318c6585bd1a91df2f8e1ff64ef..276b10476fff83e05b75b625ed4f0d73a46f6117 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 e84c09ef6807b620107636f3d18356e417c98793..90b2758aca3569e841d6cfa185ca2a556847bd2d 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 6ec16667eb88163e414448e18c14fbd3d5fca38d..656d829a93ee26b86bc1acb345db9257bee196a3 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);
@@ -484,8 +484,8 @@ float Item_ItemsTime_UpdateTime(entity e, float t);
 void Item_ItemsTime_SetTime(entity e, float t);
 void Item_ItemsTime_SetTimesForAllPlayers();
 
-void Item_Respawn ()
-{SELFPARAM();
+void Item_Respawn (entity this)
+{
        Item_Show(self, 1);
        // this is ugly...
        if(self.items == ITEM_Strength.m_itemid)
@@ -510,13 +510,13 @@ 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)
                        WaypointSprite_Kill(self.waypointsprite_attached);
-               Item_Respawn();
+               Item_Respawn(self);
        }
        else
        {
@@ -568,14 +568,14 @@ void Item_RespawnCountdown ()
        }
 }
 
-void Item_RespawnThink()
-{SELFPARAM();
+void Item_RespawnThink(entity this)
+{
        self.nextthink = time;
        if(self.origin != self.oldorigin)
                ItemUpdate(self);
 
        if(time >= self.wait)
-               Item_Respawn();
+               Item_Respawn(self);
 }
 
 void Item_ScheduleRespawnIn(entity e, float t)
@@ -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")
@@ -859,7 +858,6 @@ void Item_Reset(entity this)
                        Item_ScheduleInitialRespawn(this);
        }
 }
-void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
 
 void Item_FindTeam(entity this)
 {
@@ -901,8 +899,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 +1026,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)
@@ -1635,7 +1633,7 @@ void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .floa
                e.(regenfield) = max(e.(regenfield), time + regentime);
 }
 float GiveItems(entity e, float beginarg, float endarg)
-{SELFPARAM();
+{
        float got, i, val, op;
        float _switchweapon;
        string cmd;
@@ -1797,7 +1795,7 @@ float GiveItems(entity e, float beginarg, float endarg)
        POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_MEGAHEALTH, SND_Null);
 
        if(e.superweapons_finished <= 0)
-               if(self.weapons & WEPSET_SUPERWEAPONS)
+               if(e.weapons & WEPSET_SUPERWEAPONS)
                        e.superweapons_finished = autocvar_g_balance_superweapons_time;
 
        if(e.strength_finished <= 0)
index ce8307821ca11b0faea0811529e153eb2614661c..5ebc9d7e6234f4e8bd06d1233f0584a91946a254 100644 (file)
@@ -72,9 +72,9 @@ const float ITEM_RESPAWN_TICKS = 10;
 
 void Item_Show (entity e, float mode);
 
-void Item_Respawn ();
+void Item_Respawn (entity this);
 
-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 7039d151ad4a7f524115bf9bbb8047b17420811f..e030632498d2c3f0cfb488135edd51245dedc642 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 e11680b40c75fc87a06fe82100b71e37114b2bd1..246762659aafbfcc7a9b3e1e23614432344af4da 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 0a0547b58726e64c1c5fde2c7aa3e37b661ba943..5584f9ffa167bbb476fbd16ce6804e08ba3c836f 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 6ad2e80d41c33404d7e5535892a2a68963df3635..a4be9fe0538dd1ffad145f2beba54765025de6af 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 e0c62c043d97216e7814fd2de4e258cb6a8dc88e..92afdebecaf4c7c2749149b7704bd1bd88002c2f 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 da88e4dc9b60336d0d7f2c66ca4bdebbe2dc5c35..12008e492d443896506773352d798e0ddbdf569c 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 057fcdca7190f90c484f407c435fa114b009190d..53366aa1054dcde093ec130031ee5a579ce86c60 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 18b72068581d4ca123d056928f11bb83c1a3b7f7..e0108cd8f0f030e0eaaa6124c20f373fa15a349f 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 bcfc6e886ce6c6334bd8f1b52a5125384a255512..e05b2a6fca08927c0e081f9e1e230a70ad1a0c45 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 7f7ec8eb2619e7c40d3a1ceec076f4ac80c26cb5..9cfc01acbf20f6c85488ff24453ac3d7af711f60 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;
@@ -194,20 +194,20 @@ void Draw_PointParticles(entity this)
        vector p;
        vector sz;
        vector o;
-       o = self.origin;
-       sz = self.maxs - self.mins;
-       n = doBGMScript(self);
-       if(self.absolute == 2)
+       o = this.origin;
+       sz = this.maxs - this.mins;
+       n = doBGMScript(this);
+       if(this.absolute == 2)
        {
                if(n >= 0)
-                       n = self.just_toggled ? self.impulse : 0;
+                       n = this.just_toggled ? this.impulse : 0;
                else
-                       n = self.impulse * drawframetime;
+                       n = this.impulse * drawframetime;
        }
        else
        {
-               n *= self.impulse * drawframetime;
-               if(self.just_toggled)
+               n *= this.impulse * drawframetime;
+               if(this.just_toggled)
                        if(n < 1)
                                n = 1;
        }
@@ -216,46 +216,46 @@ void Draw_PointParticles(entity this)
        fail = 0;
        for(i = random(); i <= n && fail <= 64*n; ++i)
        {
-               p = o + self.mins;
+               p = o + this.mins;
                p.x += random() * sz.x;
                p.y += random() * sz.y;
                p.z += random() * sz.z;
-               if(WarpZoneLib_BoxTouchesBrush(p, p, self, world))
+               if(WarpZoneLib_BoxTouchesBrush(p, p, this, world))
                {
-                       if(self.movedir != '0 0 0')
+                       if(this.movedir != '0 0 0')
                        {
-                               traceline(p, p + normalize(self.movedir) * 4096, 0, world);
+                               traceline(p, p + normalize(this.movedir) * 4096, 0, world);
                                p = trace_endpos;
                                int eff_num;
-                               if(self.cnt)
-                                       eff_num = self.cnt;
+                               if(this.cnt)
+                                       eff_num = this.cnt;
                                else
-                                       eff_num = _particleeffectnum(self.mdl);
-                               __pointparticles(eff_num, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count);
+                                       eff_num = _particleeffectnum(this.mdl);
+                               __pointparticles(eff_num, p, trace_plane_normal * vlen(this.movedir) + this.velocity + randomvec() * this.waterlevel, this.count);
                        }
                        else
                        {
                                int eff_num;
-                               if(self.cnt)
-                                       eff_num = self.cnt;
+                               if(this.cnt)
+                                       eff_num = this.cnt;
                                else
-                                       eff_num = _particleeffectnum(self.mdl);
-                               __pointparticles(eff_num, p, self.velocity + randomvec() * self.waterlevel, self.count);
+                                       eff_num = _particleeffectnum(this.mdl);
+                               __pointparticles(eff_num, p, this.velocity + randomvec() * this.waterlevel, this.count);
                        }
-                       if(self.noise != "")
+                       if(this.noise != "")
                        {
-                               setorigin(self, p);
-                               _sound(self, CH_AMBIENT, self.noise, VOL_BASE * self.volume, self.atten);
+                               setorigin(this, p);
+                               _sound(this, CH_AMBIENT, this.noise, VOL_BASE * this.volume, this.atten);
                        }
-                       self.just_toggled = 0;
+                       this.just_toggled = 0;
                }
-               else if(self.absolute)
+               else if(this.absolute)
                {
                        ++fail;
                        --i;
                }
        }
-       setorigin(self, o);
+       setorigin(this, o);
 }
 
 void Ent_PointParticles_Remove(entity this)
index 3f9a88f285e672e38ebdf167477c2522dd89ac82..f34d41e2b02af8737d31d8c7e701de75dbe047e6 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 6c674d47470dd13c8ac0fd73ae9c2810c0d8c2cf..9c73e2b80b561d77235a122c6bd52dd8cdcd9752 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 eb7a5428bc38b2ce0b41719d5886b3a1e6085e5f..b3e931b3a364f66f7e5389a396dc9fdde2aa3111 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 937d68caf155da781f52f8bcac6f04555f2060bf..f0aafc7c40e5d06238324f87b0eb6d14dec518bb 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 d16509596f339d5ef2441e77eeee16edacbd5a1b..7b583f1d3d370545b900505b40167cadb966c2e3 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 9a32e327a23fd324d2a21c34bf0a136c38f65dba..f73da630fd0cd174ec27c04b2a7825931ff76e1d 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 bcc7c057c26ef233ea0aa02c87806ea7fef84ccb..c2be7c72d925ecd12176b44d56ab3423354ae5c2 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 6a844261379a971e3d76da1a371008aac2c3f63a..1ce3ea2e9e842864e7315270fab82622a784af81 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 c6fca4c7ea1169d36ddcf74e5b7e5b83febc5d45..32237200ee9bd93abda850564cb8bf9054800535 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 1884879764f20d0e21f3f75f83cb56a8d5f5a093..ff8b12fda49aa744a7b649e61360b0faf8ac3a04 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 9366678b15c50dd79db5f194dcc3aadfec7d6a57..ef47b0c6c8d00f180394f9f882d6bac61950d80d 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 c9ea32501938ac09f8c23959578150e3e62a6fce..197ea9271be5cb4bb5140f4e1d460635e2117899 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 e5a98b8cb81f052f80b031ff0b28882bc9aa2f54..25d824d7a62f0953dd6f5538a4bd1771cf565fb4 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 8eaf0ec5ef58f554438e7557cf487a78b0c46d56..82199a39311ec56ee18d3acdb2e718818afdb0ed 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 f5feccef0d4b0f4714d79f63a684ff5cf6f59067..d45a82b53c41dc2450710f8bc2d3397ea4fbaadd 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 be2ef03c04dadcb6f6468b4009040e5b35e287f0..cbb2f03279d859bb79b84efd52803ebd771412f3 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 6fd61dc9da7561fb0bd684d30e50f95113267917..4e8bf1809fd24840637abeb5a3aa27e31109bd41 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 b3e6a5b09023d17e1284a91a22d0afdbddceacdf..e90eb1853affc2dc4e51097b1889980af8f07853 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 f9738714e636a75e80fb829fa63186c95eed02ad..018e20884b25938e7d17fba6fc0764948c2aad1d 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 5ebe7017957ea7d94eaca4310f77133b8a43b3c9..435255727e7f4139e83baebe29266bdf8291f827 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 2c17fbb0d1e9cbb339ac5cc5be388d40d88d3471..1a1850537d4f29cd7bdde118395ea007e1d1716d 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 e6e4c4bf90a2fb8339ab6bb82ed2be6a9569b1bb..a6f40be3ea5521a909f7d0df6c649e995e0da39c 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 4c514df2d46a9ab7402ca615926c240ff98ec8c2..3a1cf9530b0c44ceed0c5b797f27ae4e38b5ea62 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 f32a5199f22fd4a9a462d35d229929cca5c494c5..54777b75cb1aa57723aa5d0c4d90c6556bdcaeb7 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 bfd6db1dcc51636e9c01807e73c6c5cd080b899f..d65fe953f39d2de0bd015d6ed74f747e53f5591c 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 572515189e5c8660450c8876dce75a6ed7bb6fa0..d9c6a08126a90672e85be1966b31144faeba8ef2 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 d24e9d74f4d5bc8792e4a86b37d25af8894caf68..2f3b11a7d9f76716d86f2facf36570ca4ae807f5 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 31021868996a0f2d3e3058a323def730b34dd819..0fc168c2cac60c85a1d2035aa89d1ac132085b40 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 138c87e88d568349b3dabb4ca7aaf1b50a09a3c1..769c0edf720bfc241d81a5b817f131bbebf6f7a9 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();
+       PROJECTILE_TOUCH(this);
+       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 622f2360f7d0aec8fd6ad109129a04e98972ffa8..1d492e8164a057cf17f799ef58a773f532461803 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 01dced5f3c403f0ec3af2ad263290d7ba64186c1..4828bf0b34c17b078126affea19477e9d7929014 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 40603cca0defdf6a9aa3e8599a16434f83e3fda3..113431003c93053903b04ae4768616314e6c6ff6 100644 (file)
@@ -54,7 +54,7 @@ void ewheel_move_path()
 
                 if (self.pathgoal.enemy)
                 {
-                    self.pathcurrent = pathlib_astar(self.pathgoal.origin,self.pathgoal.enemy.origin);
+                    self.pathcurrent = pathlib_astar(self, self.pathgoal.origin,self.pathgoal.enemy.origin);
                     self.pathgoal = self.pathgoal.enemy;
                 }
             }
@@ -207,7 +207,7 @@ METHOD(EWheel, tr_setup, void(EWheel this, entity it))
             {
 
 #ifdef EWHEEL_FANCYPATH
-                it.pathcurrent = WALKER_PATH(it.origin,e.origin);
+                it.pathcurrent = WALKER_PATH(it, it.origin, e.origin);
                 it.pathgoal = e;
 #else
                 it.pathcurrent  = e;
index fd7179f162bed8a0f7f0c28136d56647e655b75f..eb8db7358f5820807035b1f445266ba45716d726 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 6fd5bd09147c0f6d1960a51804f661d7119a98d7..2b80607ce7e1b66ee4fe29b985723de419c415d7 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 ca99cca9029890bb9cdb0e3dab319faf18a27439..dffe83c8283d135b220e0cd4509269de57be9458 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 853750f6caf7fd839b3a7d4e50d4d38ec0b23440..34cd32d74279c07a8ebda0744d5cab5e422a1810 100644 (file)
@@ -4,7 +4,7 @@
 
 #ifdef SVQC
 
-void W_MachineGun_MuzzleFlash();
+void W_MachineGun_MuzzleFlash(entity actor);
 SOUND(MachineGunTurretAttack_FIRE, W_Sound("electro_fire"));
 METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -20,7 +20,7 @@ METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .ent
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
         }
         fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
-        W_MachineGun_MuzzleFlash();
+        W_MachineGun_MuzzleFlash(actor);
         setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire");
     }
 }
index 17622fe1db7431f4204dc61fee2e12cf11fced30..1f6d62c95b78bb7fa13a81b8955b00ef4f6b2a05 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 c2cedf0a2e4593a871ad98b333f6b3ee3ee6f29e..fec4060d44f30841b7fe32ca5b6403efce804600 100644 (file)
@@ -63,7 +63,7 @@ const int ANIM_ROAM       = 11;
 .float animflag;
 .float idletime;
 
-#define WALKER_PATH(s,e) pathlib_astar(s,e)
+#define WALKER_PATH(this, s, e) pathlib_astar(this, s, e)
 
 float walker_firecheck()
 {SELFPARAM();
@@ -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);
@@ -317,7 +317,7 @@ void walker_move_path()
 
                 if (self.pathgoal.enemy)
                 {
-                    self.pathcurrent = WALKER_PATH(self.pathgoal.origin,self.pathgoal.enemy.origin);
+                    self.pathcurrent = WALKER_PATH(self, self.pathgoal.origin, self.pathgoal.enemy.origin);
                     self.pathgoal = self.pathgoal.enemy;
                 }
             }
@@ -617,7 +617,7 @@ METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
         else
         {
 #ifdef WALKER_FANCYPATHING
-            it.pathcurrent = WALKER_PATH(it.origin, e.origin);
+            it.pathcurrent = WALKER_PATH(it, it.origin, e.origin);
             it.pathgoal = e;
 #else
             it.pathcurrent = e;
index ec643fcb5885cac7d20ccd0cfe0cf16b93b6ea80..52110137253b224511204353637be62d99d7d36c 100644 (file)
@@ -57,22 +57,25 @@ string wordwrap(string s, float l)
 
 #ifndef MENUQC
 #ifndef CSQC
+entity _wordwrap_buffer_sprint_ent;
 void wordwrap_buffer_sprint(string s)
-{SELFPARAM();
+{
        wordwrap_buffer = strcat(wordwrap_buffer, s);
        if(s == "\n")
        {
-               sprint(self, wordwrap_buffer);
+               sprint(_wordwrap_buffer_sprint_ent, wordwrap_buffer);
                wordwrap_buffer = "";
        }
 }
 
-void wordwrap_sprint(string s, float l)
-{SELFPARAM();
+void wordwrap_sprint(entity to, string s, float l)
+{
        wordwrap_buffer = "";
+       _wordwrap_buffer_sprint_ent = to;
        wordwrap_cb(s, l, wordwrap_buffer_sprint);
+       _wordwrap_buffer_sprint_ent = NULL;
        if(wordwrap_buffer != "")
-               sprint(self, strcat(wordwrap_buffer, "\n"));
+               sprint(to, strcat(wordwrap_buffer, "\n"));
        wordwrap_buffer = "";
        return;
 }
index 066033a175a1791a2ce05326b223de57db40d4ae..fa17a06a328af4414350a1a9a29632f5114cd34b 100644 (file)
@@ -11,7 +11,7 @@ vector real_origin(entity ent);
 string wordwrap(string s, float l);
 #ifndef MENUQC
 #ifndef CSQC
-void wordwrap_sprint(string s, float l);
+void wordwrap_sprint(entity to, string s, float l);
 #endif
 #endif
 void wordwrap_cb(string s, float l, void(string) callback);
index 2fb60210fe7698e646a59f6fede5fde83900179c..6f1d2d91842857a3ff07a26ca8a212a16a154d68 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)
@@ -224,7 +224,7 @@ void vehicles_projectile_explode()
                        return;
        }
 
-       PROJECTILE_TOUCH;
+       PROJECTILE_TOUCH(this);
 
        self.event_damage = func_null;
        RadiusDamage (self, self.realowner, self.shot_dmg, 0, self.shot_radius, self, world, self.shot_force, self.totalfrags, other);
@@ -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 72a70cf41e32a25f89db60c8c171530610709625..945c0964f4f5c8ab54a0f871d0ec3058b63a4002 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 6eb064af30055c7561a27c69a4f0a3e8426353c0..bcbe5be702cc799a2437dc6def3a8826fb446e4e 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 5718d41250d9e084ecd057f20166f37e693efafc..f15b8cfb8a74ddfe092069e651355dbd0bc5dc27 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 e62f033331c6f6adc2aa112b2831073336a21b0f..3a2401989fb381b3d9b089d3824b030c9cc74678 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 8eabe1cdd4b410f0ed3112d616e980cd5bbc17cd..fc439734c0f78fbf71db2805d6f0ced5227f318d 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,18 +94,18 @@ void raptor_bomblet_boom()
     remove(self);
 }
 
-void raptor_bomblet_touch()
-{SELFPARAM();
+void raptor_bomblet_touch(entity this)
+{
     if(other == self.owner)
         return;
 
-    PROJECTILE_TOUCH;
+    PROJECTILE_TOUCH(this);
     setthink(self, raptor_bomblet_boom);
     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 e60b263a6458c3e8aad219ca3932c3e129a390ef..1b27587398d00c89507efd6e67cec59ebd32e3a3 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 405a2ac8d17afe31b32821fe794de265deefe773..ae8c6c6f982ed156f10d2234773080eedb824d22 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 4354cc415fd056ffc75d22d99e0708c3417a15d4..b86b77fadf4ffc0cb14de612227121f3433c2635 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 c76a88399daff322c5b789dbc81f6b26c7cd03ca..99ff42367fe14bbb38e330f2143425e055ea9676 100644 (file)
@@ -85,7 +85,7 @@ CLASS(Weapon, Object)
     ATTRIB(Weapon, m_pickup, entity, NULL);
 
     /** (SERVER) setup weapon data */
-    METHOD(Weapon, wr_setup, void(Weapon this)) {}
+    METHOD(Weapon, wr_setup, void(Weapon this, entity actor)) {}
     /** (SERVER) logic to run every frame */
     METHOD(Weapon, wr_think, void(Weapon this, entity actor, .entity weaponentity, int fire)) {}
     /** (SERVER) checks ammo for weapon primary */
@@ -93,7 +93,7 @@ CLASS(Weapon, Object)
     /** (SERVER) checks ammo for weapon second */
     METHOD(Weapon, wr_checkammo2, bool(Weapon this, entity actor)) {return false;}
     /** (SERVER) runs bot aiming code for this weapon */
-    METHOD(Weapon, wr_aim, void(Weapon this)) {}
+    METHOD(Weapon, wr_aim, void(Weapon this, entity actor)) {}
     /** (BOTH)   precaches models/sounds used by this weapon, also sets up weapon properties */
     METHOD(Weapon, wr_init, void(Weapon this)) {}
     /** (SERVER) notification number for suicide message (may inspect w_deathtype for details) */
@@ -103,13 +103,13 @@ CLASS(Weapon, Object)
     /** (SERVER) handles reloading for weapon */
     METHOD(Weapon, wr_reload, void(Weapon this, entity actor, .entity weaponentity)) {}
     /** (SERVER) clears fields that the weapon may use */
-    METHOD(Weapon, wr_resetplayer, void(Weapon this)) {}
+    METHOD(Weapon, wr_resetplayer, void(Weapon this, entity actor)) {}
     /** (CLIENT) impact effect for weapon explosion */
-    METHOD(Weapon, wr_impacteffect, void(Weapon this)) {}
+    METHOD(Weapon, wr_impacteffect, void(Weapon this, entity actor)) {}
     /** (SERVER) called whenever a player dies */
-    METHOD(Weapon, wr_playerdeath, void(Weapon this)) {}
+    METHOD(Weapon, wr_playerdeath, void(Weapon this, entity actor)) {}
     /** (SERVER) logic to run when weapon is lost */
-    METHOD(Weapon, wr_gonethink, void(Weapon this)) {}
+    METHOD(Weapon, wr_gonethink, void(Weapon this, entity actor)) {}
     /** (ALL)    dump weapon cvars to config in data directory (see: sv_cmd dumpweapons) */
     METHOD(Weapon, wr_config, void(Weapon this)) {}
     /** (CLIENT) weapon specific zoom reticle */
@@ -120,9 +120,9 @@ CLASS(Weapon, Object)
     /** (CLIENT) weapon specific glow */
     METHOD(Weapon, wr_glow, vector(Weapon this)) { return '0 0 0'; }
     /** (SERVER) the weapon is dropped */
-    METHOD(Weapon, wr_drop, void(Weapon this)) {}
+    METHOD(Weapon, wr_drop, void(Weapon this, entity actor)) {}
     /** (SERVER) a weapon is picked up */
-    METHOD(Weapon, wr_pickup, void(Weapon this)) {}
+    METHOD(Weapon, wr_pickup, void(Weapon this, entity actor)) {}
     /** (SERVER) update cvar based properties */
     METHOD(Weapon, wr_update, void(Weapon this)) {}
        METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) {
index 46efc1fae8e7456827fd1f0f31ede46f32a74892..5df635f77d997af1a6a866fb2e2d929dc3cdc12c 100644 (file)
@@ -231,8 +231,8 @@ void Arc_Player_SetHeat(entity player)
        //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
 }
 
-void W_Arc_Bolt_Explode()
-{SELFPARAM();
+void W_Arc_Bolt_Explode(entity this)
+{
        self.event_damage = func_null;
        RadiusDamage(self, self.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), world, world, WEP_CVAR(arc, bolt_force), self.projectiledeathtype, other);
 
@@ -241,7 +241,7 @@ void W_Arc_Bolt_Explode()
 
 void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Arc_Bolt_Explode());
+       WITHSELF(this, W_Arc_Bolt_Explode(this));
 }
 
 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -259,14 +259,15 @@ 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();
-       PROJECTILE_TOUCH;
+void W_Arc_Bolt_Touch(entity this)
+{
+       PROJECTILE_TOUCH(this);
        self.use(this, NULL, NULL);
 }
 
-void W_Arc_Attack_Bolt(Weapon thiswep)
-{SELFPARAM();
+void W_Arc_Attack_Bolt(Weapon thiswep, entity actor)
+{
+    entity this = actor;
        entity missile;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo));
@@ -307,8 +308,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);
@@ -674,8 +675,8 @@ void W_Arc_Beam_Think()
        self.nextthink = time;
 }
 
-void W_Arc_Beam(float burst)
-{SELFPARAM();
+void W_Arc_Beam(float burst, entity actor)
+{entity this = actor;
 
        // only play fire sound if 1 sec has passed since player let go the fire button
        if(time - self.beam_prev > 1)
@@ -691,11 +692,10 @@ 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()
-{SELFPARAM();
+void Arc_Smoke(entity actor)
+{entity this = actor;
        makevectors(self.v_angle);
        W_SetupShot_Range(self,true,0,SND_Null,0,0,0);
 
@@ -730,9 +730,9 @@ void Arc_Smoke()
        }
 }
 
-METHOD(Arc, wr_aim, void(entity thiswep))
+METHOD(Arc, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(WEP_CVAR(arc, beam_botaimspeed))
     {
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
@@ -757,7 +757,7 @@ METHOD(Arc, wr_aim, void(entity thiswep))
 METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
     Arc_Player_SetHeat(actor);
-    Arc_Smoke();
+    Arc_Smoke(actor);
 
     bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
 
@@ -779,7 +779,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
             {
-                W_Arc_Beam(boolean(beam_fire2));
+                W_Arc_Beam(boolean(beam_fire2), actor);
 
                 if(!actor.arc_BUTTON_ATCK_prev)
                 {
@@ -795,7 +795,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
         {
-            W_Arc_Attack_Bolt(thiswep);
+            W_Arc_Attack_Bolt(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
         }
     }
@@ -853,17 +853,17 @@ METHOD(Arc, wr_killmessage, Notification(entity thiswep))
     else
         return WEAPON_ARC_MURDER;
 }
-METHOD(Arc, wr_drop, void(entity thiswep))
+METHOD(Arc, wr_drop, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     weapon_dropevent_item.arc_overheat = self.arc_overheat;
     weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
     self.arc_overheat = 0;
     self.arc_cooldown = 0;
 }
-METHOD(Arc, wr_pickup, void(entity thiswep))
+METHOD(Arc, wr_pickup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if ( !client_hasweapon(self, thiswep, false, false) &&
         weapon_dropevent_item.arc_overheat > time )
     {
@@ -875,9 +875,9 @@ METHOD(Arc, wr_pickup, void(entity thiswep))
 #ifdef CSQC
 bool autocvar_cl_arcbeam_teamcolor = true;
 
-METHOD(Arc, wr_impacteffect, void(entity thiswep))
+METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(w_deathtype & HITTYPE_SECONDARY)
     {
         vector org2;
index 08b5e3472cbbdea214fdae16fcffe5b88560d8b2..394d50c6946c76007c9f70fff3d60da78c1b94ba 100644 (file)
@@ -56,9 +56,9 @@ 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();
-       PROJECTILE_TOUCH;
+void W_Blaster_Touch(entity this)
+{
+       PROJECTILE_TOUCH(this);
 
        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,13 +146,13 @@ void W_Blaster_Attack(
 
        if (time >= missile.nextthink)
        {
-               WITHSELF(missile, getthink(missile)());
+               WITHSELF(missile, getthink(missile)(missile));
        }
 }
 
-METHOD(Blaster, wr_aim, void(entity thiswep))
+METHOD(Blaster, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(WEP_CVAR(blaster, secondary))
     {
         if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
@@ -223,9 +223,9 @@ METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponenti
     }
 }
 
-METHOD(Blaster, wr_setup, void(entity thiswep))
+METHOD(Blaster, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.ammo_field = ammo_none;
 }
 
@@ -252,9 +252,9 @@ METHOD(Blaster, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Blaster, wr_impacteffect, void(entity thiswep))
+METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
index 0d704da2463637701c4a696262c3f8b74bca4acf..a582f9843bf7047d884aa77fa9bbd6f773c99616 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,12 +293,12 @@ 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);
-       PROJECTILE_TOUCH;
+       PROJECTILE_TOUCH(this);
 
        float a;
        a = bound(0, 1 - (time - self.fade_time) * self.fade_rate, 1);
@@ -338,14 +338,14 @@ 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);
 }
 
-void W_Crylink_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Crylink_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
        float counter, shots;
        entity proj, prevproj, firstproj;
        vector s;
@@ -452,8 +452,8 @@ void W_Crylink_Attack(Weapon thiswep)
        }
 }
 
-void W_Crylink_Attack2(Weapon thiswep)
-{SELFPARAM();
+void W_Crylink_Attack2(Weapon thiswep, entity actor)
+{entity this = actor;
        float counter, shots;
        entity proj, prevproj, firstproj;
        vector s;
@@ -567,9 +567,9 @@ void W_Crylink_Attack2(Weapon thiswep)
        }
 }
 
-METHOD(Crylink, wr_aim, void(entity thiswep))
+METHOD(Crylink, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(random() < 0.10)
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
     else
@@ -586,7 +586,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit
         if(actor.crylink_waitrelease != 1)
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
         {
-            W_Crylink_Attack(thiswep);
+            W_Crylink_Attack(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
         }
     }
@@ -596,7 +596,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit
         if(actor.crylink_waitrelease != 2)
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
         {
-            W_Crylink_Attack2(thiswep);
+            W_Crylink_Attack2(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
         }
     }
@@ -653,8 +653,7 @@ METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor))
 }
 METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD);
+    W_Reload(actor, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD);
 }
 METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -666,9 +665,9 @@ METHOD(Crylink, wr_killmessage, Notification(entity thiswep))
 }
 #endif
 #ifdef CSQC
-METHOD(Crylink, wr_impacteffect, void(entity thiswep))
+METHOD(Crylink, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 2;
     if(w_deathtype & HITTYPE_SECONDARY)
index 1966509e6eb5aab8dfa298224f165cfe7b72a633..772b9ea6294c616d38aed6aa346de49ee4440e74 100644 (file)
@@ -72,8 +72,8 @@ spawnfunc(weapon_rocketlauncher) { spawnfunc_weapon_devastator(this); }
 
 .entity lastrocket;
 
-void W_Devastator_Unregister()
-{SELFPARAM();
+void W_Devastator_Unregister(entity this)
+{
        if(self.realowner && self.realowner.lastrocket == self)
        {
                self.realowner.lastrocket = world;
@@ -81,9 +81,9 @@ void W_Devastator_Unregister()
        }
 }
 
-void W_Devastator_Explode()
-{SELFPARAM();
-       W_Devastator_Unregister();
+void W_Devastator_Explode(entity this)
+{
+       W_Devastator_Unregister(self);
 
        if(other.takedamage == DAMAGE_AIM)
                if(IS_PLAYER(other))
@@ -123,9 +123,9 @@ void W_Devastator_Explode()
        remove(self);
 }
 
-void W_Devastator_DoRemoteExplode(.entity weaponentity)
-{SELFPARAM();
-       W_Devastator_Unregister();
+void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity)
+{
+       W_Devastator_Unregister(self);
 
        self.event_damage = func_null;
        self.takedamage = DAMAGE_NO;
@@ -204,8 +204,8 @@ void W_Devastator_DoRemoteExplode(.entity weaponentity)
        remove(self);
 }
 
-void W_Devastator_RemoteExplode(.entity weaponentity)
-{SELFPARAM();
+void W_Devastator_RemoteExplode(entity this, .entity weaponentity)
+{
        if(!IS_DEAD(self.realowner))
        if(self.realowner.lastrocket)
        {
@@ -214,7 +214,7 @@ void W_Devastator_RemoteExplode(.entity weaponentity)
                        : (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device
                )
                {
-                       W_Devastator_DoRemoteExplode(weaponentity);
+                       W_Devastator_DoRemoteExplode(self, weaponentity);
                }
        }
 }
@@ -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;
        }
 
@@ -313,23 +313,23 @@ void W_Devastator_Think()
 
                .entity weaponentity = weaponentities[0]; // TODO: unhardcode
                if(self.rl_detonate_later)
-                       W_Devastator_RemoteExplode(weaponentity);
+                       W_Devastator_RemoteExplode(self, weaponentity);
        }
 
        if(self.csqcprojectile_clientanimate == 0)
                UpdateCSQCProjectile(self);
 }
 
-void W_Devastator_Touch()
-{SELFPARAM();
-       if(WarpZone_Projectile_Touch())
+void W_Devastator_Touch(entity this)
+{
+       if(WarpZone_Projectile_Touch(this))
        {
-               if(wasfreed(self))
-                       W_Devastator_Unregister();
+               if(wasfreed(this))
+                       W_Devastator_Unregister(this);
                return;
        }
-       W_Devastator_Unregister();
-       W_Devastator_Explode();
+       W_Devastator_Unregister(this);
+       W_Devastator_Explode(this);
 }
 
 void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -347,8 +347,8 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d
                W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode);
 }
 
-void W_Devastator_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Devastator_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
        entity missile;
        entity flash;
 
@@ -405,8 +405,9 @@ void W_Devastator_Attack(Weapon thiswep)
 }
 
 #if 0
-METHOD(Devastator, wr_aim, void(entity thiswep))
+METHOD(Devastator, wr_aim, void(entity thiswep, entity actor))
 {
+    entity this = actor;
     // aim and decide to fire if appropriate
     PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
     if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
@@ -432,9 +433,9 @@ METHOD(Devastator, wr_aim, void(entity thiswep))
     }
 }
 #else
-METHOD(Devastator, wr_aim, void(entity thiswep))
+METHOD(Devastator, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     // aim and decide to fire if appropriate
     PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
     if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
@@ -530,7 +531,7 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen
             if(actor.rl_release || WEP_CVAR(devastator, guidestop))
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
             {
-                W_Devastator_Attack(thiswep);
+                W_Devastator_Attack(thiswep, actor);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
                 actor.rl_release = 0;
             }
@@ -556,9 +557,9 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen
         }
     }
 }
-METHOD(Devastator, wr_setup, void(entity thiswep))
+METHOD(Devastator, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.rl_release = 1;
 }
 METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor))
@@ -601,16 +602,15 @@ METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     return false;
 }
-METHOD(Devastator, wr_resetplayer, void(entity thiswep))
+METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
     self.rl_release = 0;
 }
 METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, WEP_CVAR(devastator, ammo), SND_RELOAD);
+    W_Reload(actor, WEP_CVAR(devastator, ammo), SND_RELOAD);
 }
 METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -627,9 +627,9 @@ METHOD(Devastator, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Devastator, wr_impacteffect, void(entity thiswep))
+METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 12;
     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
index 84bef35b2779dbff132289a8ff84ad62f5e4c9b6..64a5e06aa0621f0dd826f943cd0eec7018bfa217 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;
@@ -144,8 +144,8 @@ void W_Electro_ExplodeCombo()
        remove(self);
 }
 
-void W_Electro_Explode()
-{SELFPARAM();
+void W_Electro_Explode(entity this)
+{
        if(other.takedamage == DAMAGE_AIM)
                if(IS_PLAYER(other))
                        if(DIFF_TEAM(self.realowner, other))
@@ -193,17 +193,17 @@ void W_Electro_Explode()
 
 void W_Electro_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Electro_Explode());
+       WITHSELF(this, W_Electro_Explode(this));
 }
 
-void W_Electro_TouchExplode()
+void W_Electro_TouchExplode(entity this)
 {
-       PROJECTILE_TOUCH;
-       W_Electro_Explode();
+       PROJECTILE_TOUCH(this);
+       W_Electro_Explode(this);
 }
 
-void W_Electro_Bolt_Think()
-{SELFPARAM();
+void W_Electro_Bolt_Think(entity this)
+{
        if(time >= self.ltime)
        {
                this.use(this, NULL, NULL);
@@ -254,8 +254,8 @@ void W_Electro_Bolt_Think()
        else { self.nextthink = self.ltime; }
 }
 
-void W_Electro_Attack_Bolt(Weapon thiswep)
-{SELFPARAM();
+void W_Electro_Attack_Bolt(Weapon thiswep, entity actor)
+{entity this = actor;
        entity proj;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(electro, ammo));
@@ -298,11 +298,11 @@ void W_Electro_Attack_Bolt(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, proj);
 }
 
-void W_Electro_Orb_Touch()
-{SELFPARAM();
-       PROJECTILE_TOUCH;
+void W_Electro_Orb_Touch(entity this)
+{
+       PROJECTILE_TOUCH(this);
        if(other.takedamage == DAMAGE_AIM)
-               { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(); } }
+               { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(self); } }
        else
        {
                //UpdateCSQCProjectile(self);
@@ -353,8 +353,8 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float
        }
 }
 
-void W_Electro_Attack_Orb(Weapon thiswep)
-{SELFPARAM();
+void W_Electro_Attack_Orb(Weapon thiswep, entity actor)
+{entity this = actor;
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(electro, ammo));
 
        W_SetupShot_ProjectileSize(
@@ -414,12 +414,12 @@ void W_Electro_Attack_Orb(Weapon thiswep)
 }
 
 void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
-{SELFPARAM();
+{entity this = actor;
        if(self.electro_count > 1)
        if(PHYS_INPUT_BUTTON_ATCK2(self))
        if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1))
        {
-               W_Electro_Attack_Orb(WEP_ELECTRO);
+               W_Electro_Attack_Orb(WEP_ELECTRO, actor);
                self.electro_count -= 1;
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
                return;
@@ -430,9 +430,9 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
 
 .float bot_secondary_electromooth;
 
-METHOD(Electro, wr_aim, void(entity thiswep))
+METHOD(Electro, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
     if(self.bot_secondary_electromooth == 0)
@@ -480,7 +480,7 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
         {
-                W_Electro_Attack_Bolt(thiswep);
+                W_Electro_Attack_Bolt(thiswep, actor);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
         }
     }
@@ -489,7 +489,7 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit
         if(time >= actor.electro_secondarytime)
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
         {
-            W_Electro_Attack_Orb(thiswep);
+            W_Electro_Attack_Orb(thiswep, actor);
             actor.electro_count = WEP_CVAR_SEC(electro, count);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
             actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
@@ -517,15 +517,14 @@ METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor))
     }
     return ammo_amount;
 }
-METHOD(Electro, wr_resetplayer, void(entity thiswep))
+METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.electro_secondarytime = time;
 }
 METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);
+    W_Reload(actor, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);
 }
 METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -552,9 +551,9 @@ METHOD(Electro, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Electro, wr_impacteffect, void(entity thiswep))
+METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 6;
     if(w_deathtype & HITTYPE_SECONDARY)
index de468896f1bf26b4500871c02a06fa0f5f4141de..3ee23e8f5f7a66f16682c004056b88e3a03635f3 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,17 +114,17 @@ 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();
+       PROJECTILE_TOUCH(this);
+       W_Fireball_Explode(this);
 }
 
-void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime)
-{SELFPARAM();
+void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float edgedamage, float burntime)
+{
        entity e;
        float d;
        vector p;
@@ -157,17 +157,17 @@ 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;
        }
 
-       W_Fireball_LaserPlay(0.1, WEP_CVAR_PRI(fireball, laserradius), WEP_CVAR_PRI(fireball, laserdamage), WEP_CVAR_PRI(fireball, laseredgedamage), WEP_CVAR_PRI(fireball, laserburntime));
+       W_Fireball_LaserPlay(self, 0.1, WEP_CVAR_PRI(fireball, laserradius), WEP_CVAR_PRI(fireball, laserdamage), WEP_CVAR_PRI(fireball, laseredgedamage), WEP_CVAR_PRI(fireball, laserburntime));
 
        self.nextthink = time + 0.1;
 }
@@ -188,8 +188,8 @@ void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float dam
        }
 }
 
-void W_Fireball_Attack1()
-{SELFPARAM();
+void W_Fireball_Attack1(entity actor)
+{entity this = actor;
        entity proj;
 
        W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
@@ -226,46 +226,46 @@ void W_Fireball_Attack1()
        MUTATOR_CALLHOOK(EditProjectile, self, proj);
 }
 
-void W_Fireball_AttackEffect(float i, vector f_diff)
-{SELFPARAM();
-       W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0);
+void W_Fireball_AttackEffect(entity actor, float i, vector f_diff)
+{
+       W_SetupShot_ProjectileSize(actor, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0);
        w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
        Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 }
 
 void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       W_Fireball_Attack1();
+       W_Fireball_Attack1(actor);
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), w_ready);
 }
 
 void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       W_Fireball_AttackEffect(0, '+1.25 +3.75 0');
+       W_Fireball_AttackEffect(actor, 0, '+1.25 +3.75 0');
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame4);
 }
 
 void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       W_Fireball_AttackEffect(0, '-1.25 +3.75 0');
+       W_Fireball_AttackEffect(actor, 0, '-1.25 +3.75 0');
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame3);
 }
 
 void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       W_Fireball_AttackEffect(1, '+1.25 -3.75 0');
+       W_Fireball_AttackEffect(actor, 1, '+1.25 -3.75 0');
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame2);
 }
 
 void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, .entity weaponentity, int fire)
-{SELFPARAM();
-       W_Fireball_AttackEffect(0, '-1.25 -3.75 0');
-       sound(self, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
+{
+       W_Fireball_AttackEffect(actor, 0, '-1.25 -3.75 0');
+       sound(actor, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
        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);
@@ -285,14 +285,14 @@ void W_Fireball_Firemine_Think()
                        self.cnt = 0;
        }
 
-       W_Fireball_LaserPlay(0.1, WEP_CVAR_SEC(fireball, laserradius), WEP_CVAR_SEC(fireball, laserdamage), WEP_CVAR_SEC(fireball, laseredgedamage), WEP_CVAR_SEC(fireball, laserburntime));
+       W_Fireball_LaserPlay(self, 0.1, WEP_CVAR_SEC(fireball, laserradius), WEP_CVAR_SEC(fireball, laserdamage), WEP_CVAR_SEC(fireball, laseredgedamage), WEP_CVAR_SEC(fireball, laserburntime));
 
        self.nextthink = time + 0.1;
 }
 
-void W_Fireball_Firemine_Touch()
-{SELFPARAM();
-       PROJECTILE_TOUCH;
+void W_Fireball_Firemine_Touch(entity this)
+{
+       PROJECTILE_TOUCH(this);
        if(other.takedamage == DAMAGE_AIM)
        if(Fire_AddDamage(other, self.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), self.projectiledeathtype) >= 0)
        {
@@ -302,8 +302,8 @@ void W_Fireball_Firemine_Touch()
        self.projectiledeathtype |= HITTYPE_BOUNCE;
 }
 
-void W_Fireball_Attack2()
-{SELFPARAM();
+void W_Fireball_Attack2(entity actor)
+{entity this = actor;
        entity proj;
        vector f_diff;
        float c;
@@ -356,9 +356,9 @@ void W_Fireball_Attack2()
        MUTATOR_CALLHOOK(EditProjectile, self, proj);
 }
 
-METHOD(Fireball, wr_aim, void(entity thiswep))
+METHOD(Fireball, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     PHYS_INPUT_BUTTON_ATCK(self) = false;
     PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(self.bot_primary_fireballmooth == 0)
@@ -393,14 +393,14 @@ METHOD(Fireball, wr_think, void(entity thiswep, entity actor, .entity weaponenti
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire)))
         {
-            W_Fireball_Attack2();
+            W_Fireball_Attack2(actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
         }
     }
 }
-METHOD(Fireball, wr_setup, void(entity thiswep))
+METHOD(Fireball, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.ammo_field = ammo_none;
 }
 METHOD(Fireball, wr_checkammo1, bool(entity thiswep, entity actor))
@@ -411,9 +411,9 @@ METHOD(Fireball, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     return true; // fireball has infinite ammo
 }
-METHOD(Fireball, wr_resetplayer, void(entity thiswep))
+METHOD(Fireball, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.fireball_primarytime = time;
 }
 METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep))
@@ -434,9 +434,9 @@ METHOD(Fireball, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Fireball, wr_impacteffect, void(entity thiswep))
+METHOD(Fireball, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     if(w_deathtype & HITTYPE_SECONDARY)
     {
index 35622949c08d0cdcd6ef14522fd7bfcd4cedb5aa..577d4cf4e2671b562e8843601ce55a620e793609 100644 (file)
@@ -63,8 +63,8 @@ spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(this, WEP_HAGAR); }
 
 // NO bounce protection, as bounces are limited!
 
-void W_Hagar_Explode()
-{SELFPARAM();
+void W_Hagar_Explode(entity this)
+{
        self.event_damage = func_null;
        RadiusDamage(self, self.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), world, world, WEP_CVAR_PRI(hagar, force), self.projectiledeathtype, other);
 
@@ -73,11 +73,11 @@ void W_Hagar_Explode()
 
 void W_Hagar_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Hagar_Explode());
+       WITHSELF(this, W_Hagar_Explode(this));
 }
 
-void W_Hagar_Explode2()
-{SELFPARAM();
+void W_Hagar_Explode2(entity this)
+{
        self.event_damage = func_null;
        RadiusDamage(self, self.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), world, world, WEP_CVAR_SEC(hagar, force), self.projectiledeathtype, other);
 
@@ -86,7 +86,7 @@ void W_Hagar_Explode2()
 
 void W_Hagar_Explode2_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Hagar_Explode2());
+       WITHSELF(this, W_Hagar_Explode2(this));
 }
 
 void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -113,15 +113,15 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage
                W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
-void W_Hagar_Touch()
-{SELFPARAM();
-       PROJECTILE_TOUCH;
+void W_Hagar_Touch(entity this)
+{
+       PROJECTILE_TOUCH(this);
        this.use(this, NULL, NULL);
 }
 
-void W_Hagar_Touch2()
-{SELFPARAM();
-       PROJECTILE_TOUCH;
+void W_Hagar_Touch2(entity this)
+{
+       PROJECTILE_TOUCH(this);
 
        if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
                this.use(this, NULL, NULL);
@@ -134,8 +134,8 @@ void W_Hagar_Touch2()
        }
 }
 
-void W_Hagar_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Hagar_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
        entity missile;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hagar, ammo));
@@ -176,8 +176,8 @@ void W_Hagar_Attack(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-void W_Hagar_Attack2(Weapon thiswep)
-{SELFPARAM();
+void W_Hagar_Attack2(Weapon thiswep, entity actor)
+{entity this = actor;
        entity missile;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo));
@@ -220,8 +220,8 @@ void W_Hagar_Attack2(Weapon thiswep)
 }
 
 .float hagar_loadstep, hagar_loadblock, hagar_loadbeep, hagar_warning;
-void W_Hagar_Attack2_Load_Release(.entity weaponentity)
-{SELFPARAM();
+void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
+{entity this = actor;
        // time to release the rockets we've loaded
 
        entity missile;
@@ -299,8 +299,8 @@ void W_Hagar_Attack2_Load_Release(.entity weaponentity)
        self.hagar_load = 0;
 }
 
-void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
-{SELFPARAM();
+void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
+{entity this = actor;
        // loadable hagar secondary attack, must always run each frame
 
        if(time < game_starttime)
@@ -388,7 +388,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                if(!PHYS_INPUT_BUTTON_ATCK2(self) || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
                {
                        self.(weaponentity).state = WS_READY;
-                       W_Hagar_Attack2_Load_Release(weaponentity);
+                       W_Hagar_Attack2_Load_Release(self, weaponentity);
                }
        }
        else
@@ -423,7 +423,7 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int
                return;
        }
 
-       W_Hagar_Attack(thiswep);
+       W_Hagar_Attack(thiswep, actor);
 
        int slot = weaponslot(weaponentity);
        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor();
@@ -437,9 +437,9 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int
        weapon_thinkf(actor, weaponentity, theframe, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto);
 }
 
-METHOD(Hagar, wr_aim, void(entity thiswep))
+METHOD(Hagar, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(random()>0.15)
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
     else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
@@ -451,7 +451,7 @@ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
     loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
 
     if(loadable_secondary)
-        W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
+        W_Hagar_Attack2_Load(thiswep, actor, weaponentity); // must always run each frame
     if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
         thiswep.wr_reload(thiswep, actor, weaponentity);
     }
@@ -464,25 +464,24 @@ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
         {
-            W_Hagar_Attack2(thiswep);
+            W_Hagar_Attack2(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
         }
     }
 }
-METHOD(Hagar, wr_gonethink, void(entity thiswep))
+METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
     // we lost the weapon and want to prepare switching away
-    if(self.hagar_load)
+    if(actor.hagar_load)
     {
         .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-        self.(weaponentity).state = WS_READY;
-        W_Hagar_Attack2_Load_Release(weaponentity);
+        actor.(weaponentity).state = WS_READY;
+        W_Hagar_Attack2_Load_Release(actor, weaponentity);
     }
 }
-METHOD(Hagar, wr_setup, void(entity thiswep))
+METHOD(Hagar, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.hagar_loadblock = false;
 
     if(self.hagar_load)
@@ -503,22 +502,21 @@ METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor))
     ammo_amount += actor.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
     return ammo_amount;
 }
-METHOD(Hagar, wr_resetplayer, void(entity thiswep))
+METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.hagar_load = 0;
 }
-METHOD(Hagar, wr_playerdeath, void(entity thiswep))
+METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
     .entity weaponentity = weaponentities[0]; // TODO: unhardcode
     // if we have any rockets loaded when we die, release them
-    if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
-        W_Hagar_Attack2_Load_Release(weaponentity);
+    if(actor.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
+        W_Hagar_Attack2_Load_Release(actor, weaponentity);
 }
 METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
+    entity this = actor;
     if(!self.hagar_load) // require releasing loaded rockets first
         W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD);
 }
@@ -537,9 +535,9 @@ METHOD(Hagar, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Hagar, wr_impacteffect, void(entity thiswep))
+METHOD(Hagar, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
index ae005572015f4ee5c0765bb6818ed35ee575663e..3fa50ff0445565e0543a1dee20225326ecba2a7c 100644 (file)
@@ -54,11 +54,11 @@ 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;
+       PROJECTILE_TOUCH(this);
 
        self.event_damage = func_null;
 
@@ -69,8 +69,8 @@ void W_HLAC_Touch()
        remove(self);
 }
 
-void W_HLAC_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_HLAC_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
        entity missile;
     float spread;
 
@@ -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);
 
@@ -117,8 +117,8 @@ void W_HLAC_Attack(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-void W_HLAC_Attack2()
-{SELFPARAM();
+void W_HLAC_Attack2(entity actor)
+{entity this = actor;
        entity missile;
     float spread;
 
@@ -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);
 
@@ -181,7 +181,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
 
                int slot = weaponslot(weaponentity);
                ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
-               W_HLAC_Attack(WEP_HLAC);
+               W_HLAC_Attack(WEP_HLAC, actor);
                actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
        }
@@ -191,14 +191,14 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
        }
 }
 
-void W_HLAC_Attack2_Frame(Weapon thiswep)
-{SELFPARAM();
+void W_HLAC_Attack2_Frame(Weapon thiswep, entity actor)
+{entity this = actor;
     float i;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hlac, ammo));
 
     for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
-        W_HLAC_Attack2();
+        W_HLAC_Attack2(actor);
 
        if(!autocvar_g_norecoil)
        {
@@ -207,9 +207,9 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
        }
 }
 
-METHOD(HLAC, wr_aim, void(entity thiswep))
+METHOD(HLAC, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
 }
 METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
@@ -221,7 +221,7 @@ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
         {
             actor.misc_bulletcounter = 0;
-            W_HLAC_Attack(thiswep);
+            W_HLAC_Attack(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
         }
     }
@@ -230,7 +230,7 @@ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
         {
-            W_HLAC_Attack2_Frame(thiswep);
+            W_HLAC_Attack2_Frame(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
         }
     }
@@ -249,8 +249,7 @@ METHOD(HLAC, wr_checkammo2, bool(entity thiswep, entity actor))
 }
 METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD);
+    W_Reload(actor, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD);
 }
 METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -264,9 +263,9 @@ METHOD(HLAC, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(HLAC, wr_impacteffect, void(entity thiswep))
+METHOD(HLAC, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
index adb1781f60d9537fd0dd8c3077b0f5a7cdc208f6..7c4aabfe71e2b280e106bb4759cd893b81bf270d 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,9 +137,9 @@ 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();
-       PROJECTILE_TOUCH;
+void W_Hook_Touch2(entity this)
+{
+       PROJECTILE_TOUCH(this);
        this.use(this, NULL, NULL);
 }
 
@@ -277,9 +277,9 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
         actor.hook_state &= ~HOOK_REMOVING;
     }
 }
-METHOD(Hook, wr_setup, void(entity thiswep))
+METHOD(Hook, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
 }
 METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor))
@@ -295,9 +295,9 @@ METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor))
     // infinite ammo for now
     return true; // actor.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
 }
-METHOD(Hook, wr_resetplayer, void(entity thiswep))
+METHOD(Hook, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     RemoveGrapplingHook(self);
     self.hook_time = 0;
     self.hook_refire = time;
@@ -310,9 +310,9 @@ METHOD(Hook, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Hook, wr_impacteffect, void(entity thiswep))
+METHOD(Hook, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
index e39adb4e5e79c1e5c7a57fca00add72f6a40d24a..10a8c40a181dbcaa5bdb95723e9efc56a778b2f6 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;
@@ -88,8 +88,8 @@ void W_MachineGun_MuzzleFlash_Think()
 
 }
 
-void W_MachineGun_MuzzleFlash()
-{SELFPARAM();
+void W_MachineGun_MuzzleFlash(entity actor)
+{entity this = actor;
        if(self.muzzle_flash == world)
                self.muzzle_flash = spawn();
 
@@ -106,8 +106,8 @@ void W_MachineGun_MuzzleFlash()
        self.muzzle_flash.owner = self.muzzle_flash.realowner = self;
 }
 
-void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity)
-{SELFPARAM();
+void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity)
+{entity this = actor;
        W_SetupShot(self, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
        if(!autocvar_g_norecoil)
        {
@@ -125,7 +125,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity)
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
-       W_MachineGun_MuzzleFlash();
+       W_MachineGun_MuzzleFlash(self);
        W_AttachToShotorg(self, self.muzzle_flash, '5 0 0');
 
        // casing code
@@ -156,7 +156,7 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentit
                        return;
                }
                actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
-               W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity);
+               W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, actor, weaponentity);
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
        }
        else
@@ -198,7 +198,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
-       W_MachineGun_MuzzleFlash();
+       W_MachineGun_MuzzleFlash(actor);
        W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
 
        if(autocvar_g_casings >= 2) // casing code
@@ -222,7 +222,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
-       W_MachineGun_MuzzleFlash();
+       W_MachineGun_MuzzleFlash(actor);
        W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
 
        if(autocvar_g_casings >= 2) // casing code
@@ -242,9 +242,9 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
 
 }
 
-METHOD(MachineGun, wr_aim, void(entity thiswep))
+METHOD(MachineGun, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
     else
@@ -288,7 +288,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
         {
             actor.misc_bulletcounter = 1;
-            W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished
+            W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, actor, weaponentity); // sets attack_finished
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
         }
 
@@ -296,7 +296,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
         {
             actor.misc_bulletcounter = 1;
-            W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished
+            W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, actor, weaponentity); // sets attack_finished
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
         }
     }
@@ -337,8 +337,7 @@ METHOD(MachineGun, wr_checkammo2, bool(entity thiswep, entity actor))
 }
 METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD);
+    W_Reload(actor, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD);
 }
 METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -355,9 +354,9 @@ METHOD(MachineGun, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
+METHOD(MachineGun, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
index f8c3c6ca93298ded90dd9b0dd331b24f8353795f..bc7f8eb39efbe6be32be3d9cb757bf355af3c402 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;
@@ -63,8 +63,8 @@ void W_MineLayer_Think();
 #ifdef SVQC
 spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(this, WEP_MINE_LAYER); }
 
-void W_MineLayer_Stick(entity to)
-{SELFPARAM();
+void W_MineLayer_Stick(entity this, entity to)
+{
        spamsound(self, CH_SHOTS, SND(MINE_STICK), VOL_BASE, ATTN_NORM);
 
        // in order for mines to face properly when sticking to the ground, they must be a server side entity rather than a csqc projectile
@@ -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))
@@ -138,8 +138,8 @@ void W_MineLayer_Explode()
        remove(self);
 }
 
-void W_MineLayer_DoRemoteExplode()
-{SELFPARAM();
+void W_MineLayer_DoRemoteExplode(entity this)
+{
        self.event_damage = func_null;
        self.takedamage = DAMAGE_NO;
 
@@ -164,20 +164,20 @@ void W_MineLayer_DoRemoteExplode()
        remove(self);
 }
 
-void W_MineLayer_RemoteExplode()
-{SELFPARAM();
+void W_MineLayer_RemoteExplode(entity this)
+{
        if(!IS_DEAD(self.realowner))
                if((self.spawnshieldtime >= 0)
                        ? (time >= self.spawnshieldtime) // timer
                        : (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(minelayer, remote_radius))) // safety device
                )
                {
-                       W_MineLayer_DoRemoteExplode();
+                       W_MineLayer_DoRemoteExplode(self);
                }
 }
 
-void W_MineLayer_ProximityExplode()
-{SELFPARAM();
+void W_MineLayer_ProximityExplode(entity this)
+{
        // make sure no friend is in the mine's radius. If there is any, explosion is delayed until he's at a safe distance
        if(WEP_CVAR(minelayer, protection) && self.mine_explodeanyway == 0)
        {
@@ -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;
        }
 
@@ -257,7 +257,7 @@ void W_MineLayer_Think()
        // explode if it's time to
        if(self.mine_time && time >= self.mine_time)
        {
-               W_MineLayer_ProximityExplode();
+               W_MineLayer_ProximityExplode(self);
                return;
        }
 
@@ -265,15 +265,15 @@ void W_MineLayer_Think()
        if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
        if(!IS_DEAD(self.realowner))
        if(self.minelayer_detonate)
-               W_MineLayer_RemoteExplode();
+               W_MineLayer_RemoteExplode(self);
 }
 
-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?
 
-       if(WarpZone_Projectile_Touch())
+       if(WarpZone_Projectile_Touch(self))
        {
                if(wasfreed(self))
                        self.realowner.minelayer_mines -= 1;
@@ -287,7 +287,7 @@ void W_MineLayer_Touch()
        }
        else
        {
-               W_MineLayer_Stick(other);
+               W_MineLayer_Stick(self, other);
        }
 }
 
@@ -308,8 +308,8 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da
                W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode);
 }
 
-void W_MineLayer_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_MineLayer_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
        entity mine;
        entity flash;
 
@@ -401,9 +401,9 @@ float W_MineLayer_PlacedMines(entity this, float detonate)
        return minfound;
 }
 
-METHOD(MineLayer, wr_aim, void(entity thiswep))
+METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     // aim and decide to fire if appropriate
     if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
         PHYS_INPUT_BUTTON_ATCK(self) = false;
@@ -513,7 +513,7 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
         {
-            W_MineLayer_Attack(thiswep);
+            W_MineLayer_Attack(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
         }
     }
@@ -543,15 +543,13 @@ METHOD(MineLayer, wr_checkammo2, bool(entity thiswep, entity actor))
     else
         return false;
 }
-METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
+METHOD(MineLayer, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    self.minelayer_mines = 0;
+    actor.minelayer_mines = 0;
 }
 METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, WEP_CVAR(minelayer, ammo), SND_RELOAD);
+    W_Reload(actor, WEP_CVAR(minelayer, ammo), SND_RELOAD);
 }
 METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -565,9 +563,9 @@ METHOD(MineLayer, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
+METHOD(MineLayer, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 12;
     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
index b264fab0033c32824738c5b26e18b3165b652504..843eaa86bca170f6a9de49ba011c52cc05b792f4 100644 (file)
@@ -64,8 +64,8 @@ REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar));
 spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(this, WEP_MORTAR); }
 spawnfunc(weapon_grenadelauncher) { spawnfunc_weapon_mortar(this); }
 
-void W_Mortar_Grenade_Explode()
-{SELFPARAM();
+void W_Mortar_Grenade_Explode(entity this)
+{
        if(other.takedamage == DAMAGE_AIM)
                if(IS_PLAYER(other))
                        if(DIFF_TEAM(self.realowner, other))
@@ -86,11 +86,11 @@ void W_Mortar_Grenade_Explode()
 
 void W_Mortar_Grenade_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Mortar_Grenade_Explode());
+       WITHSELF(this, W_Mortar_Grenade_Explode(this));
 }
 
-void W_Mortar_Grenade_Explode2()
-{SELFPARAM();
+void W_Mortar_Grenade_Explode2(entity this)
+{
        if(other.takedamage == DAMAGE_AIM)
                if(IS_PLAYER(other))
                        if(DIFF_TEAM(self.realowner, other))
@@ -111,7 +111,7 @@ void W_Mortar_Grenade_Explode2()
 
 void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Mortar_Grenade_Explode2());
+       WITHSELF(this, W_Mortar_Grenade_Explode2(this));
 }
 
 void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -128,23 +128,23 @@ 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)
        {
                other = world;
                self.projectiledeathtype |= HITTYPE_BOUNCE;
-               W_Mortar_Grenade_Explode();
+               W_Mortar_Grenade_Explode(self);
                return;
        }
        if(self.gl_detonate_later && self.gl_bouncecnt >= WEP_CVAR_PRI(mortar, remote_minbouncecnt))
-               W_Mortar_Grenade_Explode();
+               W_Mortar_Grenade_Explode(self);
 }
 
-void W_Mortar_Grenade_Touch1()
-{SELFPARAM();
-       PROJECTILE_TOUCH;
+void W_Mortar_Grenade_Touch1(entity this)
+{
+       PROJECTILE_TOUCH(this);
        if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
        {
                this.use(this, NULL, NULL);
@@ -174,9 +174,9 @@ void W_Mortar_Grenade_Touch1()
        }
 }
 
-void W_Mortar_Grenade_Touch2()
-{SELFPARAM();
-       PROJECTILE_TOUCH;
+void W_Mortar_Grenade_Touch2(entity this)
+{
+       PROJECTILE_TOUCH(this);
        if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
        {
                this.use(this, NULL, NULL);
@@ -210,8 +210,8 @@ void W_Mortar_Grenade_Touch2()
        }
 }
 
-void W_Mortar_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Mortar_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
        entity gren;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(mortar, ammo));
@@ -258,8 +258,8 @@ void W_Mortar_Attack(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, gren);
 }
 
-void W_Mortar_Attack2(Weapon thiswep)
-{SELFPARAM();
+void W_Mortar_Attack2(Weapon thiswep, entity actor)
+{entity this = actor;
        entity gren;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(mortar, ammo));
@@ -307,9 +307,9 @@ void W_Mortar_Attack2(Weapon thiswep)
 
 .float bot_secondary_grenademooth;
 
-METHOD(Mortar, wr_aim, void(entity thiswep))
+METHOD(Mortar, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     PHYS_INPUT_BUTTON_ATCK(self) = false;
     PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
@@ -353,7 +353,7 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
         {
-            W_Mortar_Attack(thiswep);
+            W_Mortar_Attack(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
         }
     }
@@ -376,7 +376,7 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         }
         else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire)))
         {
-            W_Mortar_Attack2(thiswep);
+            W_Mortar_Attack2(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
         }
     }
@@ -395,8 +395,7 @@ METHOD(Mortar, wr_checkammo2, bool(entity thiswep, entity actor))
 }
 METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO
+    W_Reload(actor, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO
 }
 METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -416,9 +415,9 @@ METHOD(Mortar, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Mortar, wr_impacteffect, void(entity thiswep))
+METHOD(Mortar, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 12;
     pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
index bef792cc533227edf82e95c705c3afb377aeb88c..ac9f759fc75954fd3988ae334ffeafcb03775f2c 100644 (file)
@@ -53,8 +53,8 @@ MUTATOR_HOOKFUNCTION(porto_ticker, SV_StartFrame) {
        FOREACH_CLIENT(IS_PLAYER(it), it.porto_forbidden = max(0, it.porto_forbidden - 1));
 }
 
-void W_Porto_Success()
-{SELFPARAM();
+void W_Porto_Success(entity this)
+{
        if(self.realowner == world)
        {
                objerror("Cannot succeed successfully: no owner\n");
@@ -66,60 +66,60 @@ void W_Porto_Success()
 }
 
 string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
-void W_Porto_Fail(float failhard)
-{SELFPARAM();
-       if(self.realowner == world)
+void W_Porto_Fail(entity this, float failhard)
+{
+       if(this.realowner == world)
        {
                objerror("Cannot fail successfully: no owner\n");
                return;
        }
 
        // no portals here!
-       if(self.cnt < 0)
+       if(this.cnt < 0)
        {
-               Portal_ClearWithID(self.realowner, self.portal_id);
+               Portal_ClearWithID(this.realowner, this.portal_id);
        }
 
-       self.realowner.porto_current = world;
+       this.realowner.porto_current = world;
 
-       if(self.cnt < 0 && !failhard && self.realowner.playerid == self.playerid && !IS_DEAD(self.realowner) && !(self.realowner.weapons & WEPSET(PORTO)))
+       if(this.cnt < 0 && !failhard && this.realowner.playerid == this.playerid && !IS_DEAD(this.realowner) && !(this.realowner.weapons & WEPSET(PORTO)))
        {
-               setsize(self, '-16 -16 0', '16 16 32');
-               setorigin(self, self.origin + trace_plane_normal);
-               if(move_out_of_solid(self))
+               setsize(this, '-16 -16 0', '16 16 32');
+               setorigin(this, this.origin + trace_plane_normal);
+               if(move_out_of_solid(this))
                {
-                       self.flags = FL_ITEM;
-                       self.velocity = trigger_push_calculatevelocity(self.origin, self.realowner, 128);
-                       tracetoss(self, self);
-                       if(vdist(trace_endpos - self.realowner.origin, <, 128))
+                       this.flags = FL_ITEM;
+                       this.velocity = trigger_push_calculatevelocity(this.origin, this.realowner, 128);
+                       tracetoss(this, this);
+                       if(vdist(trace_endpos - this.realowner.origin, <, 128))
                        {
-                               W_ThrowNewWeapon(self.realowner, WEP_PORTO.m_id, 0, self.origin, self.velocity);
-                               Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_FAILED);
+                               W_ThrowNewWeapon(this.realowner, WEP_PORTO.m_id, 0, this.origin, this.velocity);
+                               Send_Notification(NOTIF_ONE, this.realowner, MSG_CENTER, CENTER_PORTO_FAILED);
                        }
                }
        }
-       remove(self);
+       remove(this);
 }
 
 void W_Porto_Remove(entity p)
 {
        if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
        {
-               WITHSELF(p.porto_current, W_Porto_Fail(1));
+               WITHSELF(p.porto_current, W_Porto_Fail(p.porto_current, 1));
        }
 }
 
-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);
        else
-               W_Porto_Fail(0);
+               W_Porto_Fail(self, 0);
 }
 
-void W_Porto_Touch()
-{SELFPARAM();
+void W_Porto_Touch(entity this)
+{
        vector norm;
 
        // do not use PROJECTILE_TOUCH here
@@ -155,7 +155,7 @@ void W_Porto_Touch()
        else if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
        {
                sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
-               W_Porto_Fail(0);
+               W_Porto_Fail(self, 0);
                if(self.cnt < 0)
                        Portal_ClearAll_PortalsOnly(self.realowner);
        }
@@ -167,13 +167,13 @@ void W_Porto_Touch()
                        sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM);
                        trace_plane_normal = norm;
                        Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN);
-                       W_Porto_Success();
+                       W_Porto_Success(self);
                }
                else
                {
                        sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
                        trace_plane_normal = norm;
-                       W_Porto_Fail(0);
+                       W_Porto_Fail(self, 0);
                }
        }
        else if(self.cnt == 1)
@@ -184,13 +184,13 @@ void W_Porto_Touch()
                        sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM);
                        trace_plane_normal = norm;
                        Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT);
-                       W_Porto_Success();
+                       W_Porto_Success(self);
                }
                else
                {
                        sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
                        trace_plane_normal = norm;
-                       W_Porto_Fail(0);
+                       W_Porto_Fail(self, 0);
                }
        }
        else if(self.effects & EF_RED)
@@ -210,7 +210,7 @@ void W_Porto_Touch()
                        sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
                        trace_plane_normal = norm;
                        Portal_ClearAll_PortalsOnly(self.realowner);
-                       W_Porto_Fail(0);
+                       W_Porto_Fail(self, 0);
                }
        }
        else
@@ -222,26 +222,26 @@ void W_Porto_Touch()
                                sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM);
                                trace_plane_normal = norm;
                                Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT);
-                               W_Porto_Success();
+                               W_Porto_Success(self);
                        }
                        else
                        {
                                sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
                                Portal_ClearAll_PortalsOnly(self.realowner);
-                               W_Porto_Fail(0);
+                               W_Porto_Fail(self, 0);
                        }
                }
                else
                {
                        sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
                        Portal_ClearAll_PortalsOnly(self.realowner);
-                       W_Porto_Fail(0);
+                       W_Porto_Fail(self, 0);
                }
        }
 }
 
-void W_Porto_Attack(float type)
-{SELFPARAM();
+void W_Porto_Attack(entity actor, float type)
+{entity this = actor;
        entity gren;
 
        W_SetupShot(self, false, 4, SND_PORTO_FIRE, CH_WEAPON_A, 0);
@@ -292,9 +292,9 @@ void W_Porto_Attack(float type)
        MUTATOR_CALLHOOK(EditProjectile, self, gren);
 }
 
-METHOD(PortoLaunch, wr_aim, void(entity thiswep))
+METHOD(PortoLaunch, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     PHYS_INPUT_BUTTON_ATCK(self) = false;
     PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(!WEP_CVAR(porto, secondary))
@@ -310,7 +310,7 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone
         if(!actor.porto_forbidden)
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
         {
-            W_Porto_Attack(0);
+            W_Porto_Attack(actor, 0);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
         }
 
@@ -319,7 +319,7 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone
         if(!actor.porto_forbidden)
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire)))
         {
-            W_Porto_Attack(1);
+            W_Porto_Attack(actor, 1);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
         }
     }
@@ -352,7 +352,7 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone
         if(!actor.porto_forbidden)
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
         {
-            W_Porto_Attack(-1);
+            W_Porto_Attack(actor, -1);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
         }
     }
@@ -367,19 +367,19 @@ METHOD(PortoLaunch, wr_checkammo2, bool(entity thiswep, entity this))
     // always allow infinite ammo
     return true;
 }
-METHOD(PortoLaunch, wr_setup, void(entity thiswep))
+METHOD(PortoLaunch, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.ammo_field = ammo_none;
 }
-METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep))
+METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.porto_current = world;
 }
 #endif
 #ifdef CSQC
-METHOD(PortoLaunch, wr_impacteffect, void(entity this)) {
+METHOD(PortoLaunch, wr_impacteffect, void(entity this, entity actor)) {
     LOG_WARNING("Since when does Porto send DamageInfo?\n");
 }
 #endif
index e11bdd85b78b5d8356ba430f7c3ef63cc5e64856..7381172aacf48bdfd0bf19e95638bf08280ab0ac 100644 (file)
@@ -56,8 +56,8 @@ spawnfunc(weapon_rifle) { weapon_defaultspawnfunc(this, WEP_RIFLE); }
 spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); }
 spawnfunc(weapon_sniperrifle) { spawnfunc_weapon_rifle(this); }
 
-void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound)
-{SELFPARAM();
+void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound, entity actor)
+{entity this = actor;
        float i;
 
        W_DecreaseAmmo(thiswep, self, pAmmo);
@@ -79,17 +79,17 @@ void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pFor
                SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
 }
 
-void W_Rifle_Attack()
+void W_Rifle_Attack(entity actor)
 {
-       W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE);
+       W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE, actor);
 }
 
-void W_Rifle_Attack2()
+void W_Rifle_Attack2(entity actor)
 {
-       W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2);
+       W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2, actor);
 }
 
-.void() rifle_bullethail_attackfunc;
+.void(entity actor) rifle_bullethail_attackfunc;
 .WFRAME rifle_bullethail_frame;
 .float rifle_bullethail_animtime;
 .float rifle_bullethail_refire;
@@ -107,7 +107,7 @@ void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponent
                PS(actor).m_switchweapon = sw;
        if(r)
        {
-               actor.rifle_bullethail_attackfunc();
+               actor.rifle_bullethail_attackfunc(actor);
                weapon_thinkf(actor, weaponentity, actor.rifle_bullethail_frame, actor.rifle_bullethail_animtime, W_Rifle_BulletHail_Continue);
        }
        else
@@ -116,10 +116,10 @@ void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponent
        }
 }
 
-void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFRAME fr, float animtime, float refire)
-{SELFPARAM();
+void W_Rifle_BulletHail(entity actor, .entity weaponentity, float mode, void(entity actor) AttackFunc, WFRAME fr, float animtime, float refire)
+{entity this = actor;
        // if we get here, we have at least one bullet to fire
-       AttackFunc();
+       AttackFunc(actor);
        if(mode)
        {
                // continue hail
@@ -138,9 +138,9 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
 
 .float bot_secondary_riflemooth;
 
-METHOD(Rifle, wr_aim, void(entity thiswep))
+METHOD(Rifle, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     PHYS_INPUT_BUTTON_ATCK(self) = false;
     PHYS_INPUT_BUTTON_ATCK2(self) = false;
     if(vdist(self.origin - self.enemy.origin, >, 1000))
@@ -174,7 +174,7 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
         if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
         {
             weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
-            W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+            W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
             actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
         }
         if(fire & 2)
@@ -189,7 +189,7 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
                     if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
                     {
                         weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
-                        W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+                        W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
                         actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
                     }
                 }
@@ -209,15 +209,14 @@ METHOD(Rifle, wr_checkammo2, bool(entity thiswep, entity actor))
     ammo_amount += actor.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
     return ammo_amount;
 }
-METHOD(Rifle, wr_resetplayer, void(entity thiswep))
+METHOD(Rifle, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
 }
 METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD);
+    W_Reload(actor, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD);
 }
 METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -244,9 +243,9 @@ METHOD(Rifle, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Rifle, wr_impacteffect, void(entity thiswep))
+METHOD(Rifle, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
index 2e98fdbe3c8d0f8337e60a003d9e741e464b6454..0852555510eba9eef9b71b98dd546fffad1314cd 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;
+       PROJECTILE_TOUCH(this);
 
-       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;
                                }
                        }
@@ -248,8 +248,8 @@ void W_Seeker_Missile_Animate()
 }
 */
 
-void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target)
-{SELFPARAM();
+void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, vector f_diff, entity m_target)
+{entity this = actor;
        entity missile;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, missile_ammo));
@@ -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,18 +315,11 @@ void W_Seeker_Flac_Explode()
 
 void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Seeker_Flac_Explode());
-}
-
-void W_Seeker_Flac_Touch()
-{
-       PROJECTILE_TOUCH;
-
-       W_Seeker_Flac_Explode();
+       WITHSELF(this, W_Seeker_Flac_Explode(this));
 }
 
-void W_Seeker_Fire_Flac(Weapon thiswep)
-{SELFPARAM();
+void W_Seeker_Fire_Flac(Weapon thiswep, entity actor)
+{entity this = actor;
        entity missile;
        vector f_diff;
        float c;
@@ -396,8 +389,8 @@ entity W_Seeker_Tagged_Info(entity isowner, entity istarget)
        return world;
 }
 
-void W_Seeker_Attack()
-{SELFPARAM();
+void W_Seeker_Attack(entity actor)
+{entity this = actor;
        entity tracker, closest_target;
 
        closest_target = world;
@@ -416,11 +409,11 @@ void W_Seeker_Attack()
        if((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target)))
                closest_target = world;
 
-       W_Seeker_Fire_Missile(WEP_SEEKER, '0 0 0', closest_target);
+       W_Seeker_Fire_Missile(WEP_SEEKER, actor, '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;
@@ -443,25 +436,25 @@ void W_Seeker_Vollycontroller_Think() // TODO: Merge this with W_Seeker_Attack
        switch(c)
        {
                case 0:
-                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 -3.75 0', own.enemy));
+                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '-1.25 -3.75 0', own.enemy));
                        break;
                case 1:
-                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 -3.75 0', own.enemy));
+                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '+1.25 -3.75 0', own.enemy));
                        break;
                case 2:
-                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 +3.75 0', own.enemy));
+                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '-1.25 +3.75 0', own.enemy));
                        break;
                case 3:
                default:
-                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 +3.75 0', own.enemy));
+                       WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '+1.25 +3.75 0', own.enemy));
                        break;
        }
 
        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,13 +492,13 @@ 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;
 
-       PROJECTILE_TOUCH;
+       PROJECTILE_TOUCH(this);
 
        dir     = normalize(self.realowner.origin - self.origin);
        org2    = findbetterlocation(self.origin, 8);
@@ -561,8 +554,8 @@ void W_Seeker_Tag_Touch()
        return;
 }
 
-void W_Seeker_Fire_Tag(Weapon thiswep)
-{SELFPARAM();
+void W_Seeker_Fire_Tag(Weapon thiswep, entity actor)
+{entity this = actor;
        entity missile;
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, tag_ammo));
 
@@ -573,7 +566,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;
@@ -602,9 +595,9 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
 // Begin: Genereal weapon functions
 // ============================
 
-METHOD(Seeker, wr_aim, void(entity thiswep))
+METHOD(Seeker, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(WEP_CVAR(seeker, type) == 1)
         if(W_Seeker_Tagged_Info(self, self.enemy) != world)
             PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
@@ -623,7 +616,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire)))
             {
-                W_Seeker_Attack();
+                W_Seeker_Attack(actor);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
             }
         }
@@ -631,7 +624,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
             {
-                W_Seeker_Fire_Tag(thiswep);
+                W_Seeker_Fire_Tag(thiswep, actor);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
             }
         }
@@ -643,7 +636,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
             {
-                W_Seeker_Fire_Tag(thiswep);
+                W_Seeker_Fire_Tag(thiswep, actor);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
             }
         }
@@ -651,7 +644,7 @@ METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire)))
             {
-                W_Seeker_Fire_Flac(thiswep);
+                W_Seeker_Fire_Flac(thiswep, actor);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
             }
         }
@@ -689,8 +682,7 @@ METHOD(Seeker, wr_checkammo2, bool(entity thiswep, entity actor))
 }
 METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD);
+    W_Reload(actor, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD);
 }
 METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -707,9 +699,9 @@ METHOD(Seeker, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Seeker, wr_impacteffect, void(entity thiswep))
+METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2;
     org2 = w_org + w_backoff * 6;
     if(w_deathtype & HITTYPE_BOUNCE)
index 3b6266f6ed6af510079d64153327d2012085c0de..a39e7697b96dcb07c6127f3d86d9cd665bee4636 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;
@@ -276,11 +276,12 @@ float W_Shockwave_Attack_CheckSpread(
 }
 
 float W_Shockwave_Attack_IsVisible(
+       entity actor,
        entity head,
        vector nearest_on_line,
        vector sw_shotorg,
        vector attack_endpos)
-{SELFPARAM();
+{entity this = actor;
        vector nearest_to_attacker = head.WarpZone_findradius_nearest;
        vector center = (head.origin + (head.mins + head.maxs) * 0.5);
        vector corner;
@@ -339,8 +340,8 @@ float W_Shockwave_Attack_CheckHit(
        return true;
 }
 
-void W_Shockwave_Send()
-{SELFPARAM();
+void W_Shockwave_Send(entity actor)
+{
        WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
        WriteCoord(MSG_BROADCAST, w_shotorg.x);
        WriteCoord(MSG_BROADCAST, w_shotorg.y);
@@ -351,11 +352,11 @@ void W_Shockwave_Send()
        WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
        WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
        WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
-       WriteByte(MSG_BROADCAST, etof(self));
+       WriteByte(MSG_BROADCAST, etof(actor));
 }
 
-void W_Shockwave_Attack()
-{SELFPARAM();
+void W_Shockwave_Attack(entity actor)
+{entity this = actor;
        // declarations
        float multiplier, multiplier_from_accuracy, multiplier_from_distance;
        float final_damage;
@@ -374,7 +375,7 @@ void W_Shockwave_Attack()
        //entity transform = WarpZone_trace_transform;
 
        // do the firing effect now
-       W_Shockwave_Send();
+       W_Shockwave_Send(self);
        Damage_DamageInfo(
                attack_hitpos,
                WEP_CVAR(shockwave, blast_splash_damage),
@@ -570,7 +571,7 @@ void W_Shockwave_Attack()
                        vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
 
                        if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance))
-                               && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
+                               && (W_Shockwave_Attack_IsVisible(self, head, nearest_on_line, w_shotorg, attack_endpos)))
                        {
                                // calculate importance of distance and accuracy for this attack
                                multiplier_from_accuracy = (1 -
@@ -671,9 +672,9 @@ void W_Shockwave_Attack()
        }
 }
 
-METHOD(Shockwave, wr_aim, void(entity thiswep))
+METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
         { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); }
     else
@@ -687,7 +688,7 @@ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponent
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
             {
-                W_Shockwave_Attack();
+                W_Shockwave_Attack(actor);
                 actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
             }
@@ -853,7 +854,7 @@ void Net_ReadShockwaveParticle()
        shockwave.sw_time = time;
 }
 
-METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
+METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
 {
     // handled by Net_ReadShockwaveParticle
     //vector org2;
index 361f70a84365345d48291b5bf358aaeda6b0b152..2440ea42ede70009ce04de04918cf0f539a50ce3 100644 (file)
@@ -58,8 +58,8 @@ REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
 #ifdef SVQC
 spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(this, WEP_SHOTGUN); }
 
-void W_Shotgun_Attack(Weapon thiswep, float isprimary)
-{SELFPARAM();
+void W_Shotgun_Attack(Weapon thiswep, entity actor, float isprimary)
+{entity this = actor;
        float   sc;
        entity flash;
 
@@ -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;
@@ -207,7 +207,7 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity
        }
 
        sound(actor, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound
-       W_Shotgun_Attack(WEP_SHOTGUN, true); // actually is secondary, but we trick the last shot into playing full reload sound
+       W_Shotgun_Attack(WEP_SHOTGUN, actor, true); // actually is secondary, but we trick the last shot into playing full reload sound
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
 }
 void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire)
@@ -220,15 +220,15 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
                return;
        }
 
-       W_Shotgun_Attack(WEP_SHOTGUN, false);
+       W_Shotgun_Attack(WEP_SHOTGUN, actor, false);
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
 }
 
 .float shotgun_primarytime;
 
-METHOD(Shotgun, wr_aim, void(entity thiswep))
+METHOD(Shotgun, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
         PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false);
     else
@@ -251,7 +251,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
             {
                 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
                 {
-                    W_Shotgun_Attack(thiswep, true);
+                    W_Shotgun_Attack(thiswep, actor, true);
                     actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
                     weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
                 }
@@ -263,7 +263,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
             {
                 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
                 {
-                    W_Shotgun_Attack(thiswep, false);
+                    W_Shotgun_Attack(thiswep, actor, false);
                     actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
                     weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
                 }
@@ -280,9 +280,9 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
     }
 }
-METHOD(Shotgun, wr_setup, void(entity thiswep))
+METHOD(Shotgun, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.ammo_field = ammo_none;
 }
 METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor))
@@ -310,8 +310,7 @@ METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor))
 }
 METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO
+    W_Reload(actor, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO
 }
 METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -329,9 +328,9 @@ METHOD(Shotgun, wr_killmessage, Notification(entity thiswep))
 #ifdef CSQC
 .float prevric;
 
-METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
+METHOD(Shotgun, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2 = w_org + w_backoff * 2;
     pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
     if(!w_issilent && time - self.prevric > 0.25)
index 3f1aca6661fd73dcdb6ca20947a971eebf995060..3dd1c26289f3a74e6c5c5190a04c051c06306a97 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;
@@ -309,8 +309,8 @@ void W_Tuba_NoteThink()
        });
 }
 
-void W_Tuba_NoteOn(float hittype)
-{SELFPARAM();
+void W_Tuba_NoteOn(entity actor, float hittype)
+{entity this = actor;
        vector o;
        float n;
 
@@ -359,9 +359,8 @@ void W_Tuba_NoteOn(float hittype)
 #endif
 
 #ifdef SVQC
-METHOD(Tuba, wr_aim, void(Tuba this))
+METHOD(Tuba, wr_aim, void(Tuba this, entity actor))
 {
-       entity actor = self;
        // bots cannot play the Tuba well yet
        // I think they should start with the recorder first
        if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius)))
@@ -378,13 +377,13 @@ METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int f
        if (fire & 1)
        if (weapon_prepareattack(this, actor, weaponentity, false, WEP_CVAR(tuba, refire)))
        {
-               W_Tuba_NoteOn(0);
+               W_Tuba_NoteOn(actor, 0);
                weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
        }
        if (fire & 2)
        if (weapon_prepareattack(this, actor, weaponentity, true, WEP_CVAR(tuba, refire)))
        {
-               W_Tuba_NoteOn(HITTYPE_SECONDARY);
+               W_Tuba_NoteOn(actor, HITTYPE_SECONDARY);
                weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
        }
        if (actor.tuba_note)
@@ -396,9 +395,8 @@ METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int f
        }
 }
 
-METHOD(Tuba, wr_setup, void(Tuba this))
+METHOD(Tuba, wr_setup, void(Tuba this, entity actor))
 {
-       entity actor = self;
        actor.ammo_field = ammo_none;
        actor.tuba_instrument = 0;
 }
@@ -552,8 +550,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 +586,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 +627,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 320f0e46c9a3a61e173f3d1be17280bac8137d7b..c4672e727c53a05a19c945308291801aecb8518f 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;
@@ -167,8 +167,8 @@ NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
 spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
 spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
 
-void W_RocketMinsta_Explosion(vector loc)
-{SELFPARAM();
+void W_RocketMinsta_Explosion(entity actor, vector loc)
+{entity this = actor;
        if(accuracy_canbegooddamage(self))
                accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
        entity dmgent = spawn();
@@ -178,8 +178,8 @@ void W_RocketMinsta_Explosion(vector loc)
        remove(dmgent);
 }
 
-void W_Vaporizer_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Vaporizer_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
        bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
        float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
 
@@ -207,13 +207,13 @@ void W_Vaporizer_Attack(Weapon thiswep)
 
        if(autocvar_g_rm)
        if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
-               W_RocketMinsta_Explosion(trace_endpos);
+               W_RocketMinsta_Explosion(self, trace_endpos);
 
        W_DecreaseAmmo(thiswep, self, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
 }
 
-void W_RocketMinsta_Laser_Explode ()
-{SELFPARAM();
+void W_RocketMinsta_Laser_Explode (entity this)
+{
        if(other.takedamage == DAMAGE_AIM)
                if(IS_PLAYER(other))
                        if(DIFF_TEAM(self.realowner, other))
@@ -229,19 +229,19 @@ void W_RocketMinsta_Laser_Explode ()
 
 void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_RocketMinsta_Laser_Explode());
+       WITHSELF(this, W_RocketMinsta_Laser_Explode(this));
 }
 
-void W_RocketMinsta_Laser_Touch ()
-{SELFPARAM();
-       PROJECTILE_TOUCH;
+void W_RocketMinsta_Laser_Touch (entity this)
+{
+       PROJECTILE_TOUCH(this);
        //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);
        remove(self);
 }
 
-void W_RocketMinsta_Attack2()
-{SELFPARAM();
+void W_RocketMinsta_Attack2(entity actor)
+{entity this = actor;
        makevectors(self.v_angle);
 
        entity proj;
@@ -294,8 +294,8 @@ void W_RocketMinsta_Attack2()
     }
 }
 
-void W_RocketMinsta_Attack3 ()
-{SELFPARAM();
+void W_RocketMinsta_Attack3 (entity actor)
+{entity this = actor;
        makevectors(self.v_angle);
 
        entity proj;
@@ -344,9 +344,9 @@ void W_RocketMinsta_Attack3 ()
     }
 }
 
-METHOD(Vaporizer, wr_aim, void(entity thiswep))
+METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(self.(thiswep.ammo_field) > 0)
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 1, false);
     else
@@ -365,7 +365,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
         {
-            W_Vaporizer_Attack(thiswep);
+            W_Vaporizer_Attack(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
         }
     }
@@ -381,13 +381,13 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
                 actor.jump_interval = time + autocvar_g_rm_laser_refire;
                 actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
                 damage_goodhits = 0;
-                W_RocketMinsta_Attack2();
+                W_RocketMinsta_Attack2(actor);
             }
             else if(rapid && actor.jump_interval2 <= time && actor.held_down)
             {
                 actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
                 damage_goodhits = 0;
-                W_RocketMinsta_Attack3();
+                W_RocketMinsta_Attack3(actor);
                 //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
             }
         }
@@ -426,9 +426,9 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     else
         actor.held_down = false;
 }
-METHOD(Vaporizer, wr_setup, void(entity thiswep))
+METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.ammo_field = (thiswep.ammo_field);
     self.vaporizer_lasthit = 0;
 }
@@ -447,14 +447,13 @@ METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor))
     ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
     return ammo_amount;
 }
-METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
+METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     self.vaporizer_lasthit = 0;
 }
 METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
     float used_ammo;
     if(WEP_CVAR_SEC(vaporizer, ammo))
@@ -462,7 +461,7 @@ METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponen
     else
         used_ammo = vaporizer_ammo;
 
-    W_Reload(self, used_ammo, SND_RELOAD);
+    W_Reload(actor, used_ammo, SND_RELOAD);
 }
 METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -476,9 +475,9 @@ METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
+METHOD(Vaporizer, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2 = w_org + w_backoff * 6;
     if(w_deathtype & HITTYPE_SECONDARY)
     {
index d0d0025ec28c73e01953ed529b0223e4a87853eb..6459ad7a8da2a5b41eaacfdad0ee2737651950fc 100644 (file)
@@ -155,8 +155,8 @@ MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys)
        }
 }
 
-void W_Vortex_Attack(Weapon thiswep, float issecondary)
-{SELFPARAM();
+void W_Vortex_Attack(Weapon thiswep, entity actor, float issecondary)
+{entity this = actor;
        float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
 
        mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage);
@@ -210,9 +210,9 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
 
 .float vortex_chargepool_pauseregen_finished;
 
-METHOD(Vortex, wr_aim, void(entity thiswep))
+METHOD(Vortex, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(bot_aim(self, 1000000, 0, 1, false))
         PHYS_INPUT_BUTTON_ATCK(self) = true;
     else
@@ -242,7 +242,7 @@ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
             {
-                W_Vortex_Attack(thiswep, 0);
+                W_Vortex_Attack(thiswep, actor, 0);
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
             }
         }
@@ -314,17 +314,16 @@ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity
             {
                 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
                 {
-                    W_Vortex_Attack(thiswep, 1);
+                    W_Vortex_Attack(thiswep, actor, 1);
                     weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
                 }
             }
         }
     }
 }
-METHOD(Vortex, wr_setup, void(entity thiswep))
+METHOD(Vortex, wr_setup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
-    self.vortex_lasthit = 0;
+    actor.vortex_lasthit = 0;
 }
 METHOD(Vortex, wr_checkammo1, bool(entity thiswep, entity actor))
 {
@@ -346,9 +345,9 @@ METHOD(Vortex, wr_checkammo2, bool(entity thiswep, entity actor))
         return false; // zoom is not a fire mode
     }
 }
-METHOD(Vortex, wr_resetplayer, void(entity thiswep))
+METHOD(Vortex, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if (WEP_CVAR(vortex, charge)) {
         if (WEP_CVAR_SEC(vortex, chargepool)) {
             self.vortex_chargepool_ammo = 1;
@@ -359,8 +358,7 @@ METHOD(Vortex, wr_resetplayer, void(entity thiswep))
 }
 METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    SELFPARAM();
-    W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD);
+    W_Reload(actor, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD);
 }
 METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep))
 {
@@ -374,9 +372,9 @@ METHOD(Vortex, wr_killmessage, Notification(entity thiswep))
 #endif
 #ifdef CSQC
 
-METHOD(Vortex, wr_impacteffect, void(entity thiswep))
+METHOD(Vortex, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     vector org2 = w_org + w_backoff * 6;
     pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
     if(!w_issilent)
index dc2e4021fbc405283e1de904b13b9546ebbc648a..b02df19e0015a25a0f96df60d8abe5a3f5984976 100644 (file)
@@ -30,9 +30,8 @@
 
 // generic CSQC model code
 
-bool CSQCModel_Send(entity to, int sf)
+bool CSQCModel_Send(entity this, entity to, int sf)
 {
-    SELFPARAM();
        // some nice flags for CSQCMODEL_IF
        noref bool isplayer = IS_CLIENT(this);
        noref bool islocalplayer = (this == to);
@@ -122,7 +121,8 @@ void CSQCModel_CheckUpdate(entity e)
 
 void CSQCModel_LinkEntity(entity e)
 {
-       e.SendEntity = CSQCModel_Send;
+       e.SendEntity = SendEntity_self;
+       e.SendEntity3 = CSQCModel_Send;
        e.SendFlags = 0xFFFFFF;
        CSQCModel_CheckUpdate(e);
 }
@@ -130,4 +130,5 @@ void CSQCModel_LinkEntity(entity e)
 void CSQCModel_UnlinkEntity(entity e)
 {
        e.SendEntity = func_null;
+       e.SendEntity3 = func_null;
 }
index d56895dcae4e4ab76f7c6947690e5a6bcf6db872..d4a25089fc5a2bf88eddee18ccb51a91e6e85830 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 49f778a5259de4acc197591f3ffc66c35884a1f7..f0a9cc282dc4d24d28a7abb3d8b9097af3f0a982 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 da85a2adc9e20d8f1366cc213c45ef928578eab8..50196a03a97d4f614725faa16113d3fdcbc207ab 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 6467dad35a4d57b4fcebe762166b70216ef2fbec..04f037826ee2c7cd351378ed8cf2ee83a0f6d52b 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 d3d7250e856974977f6501d1550d1256eb81afc0..5967c1ba1a9d564db61f3bf52a6137ee9616387a 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 9bc39463e1b9881731c4412c8be8274c520ab45c..0fb8dd235ff99033e04148fa9662ff9764ee43cc 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;
 
@@ -363,7 +363,7 @@ bool WarpZone_Camera_Send(entity this, entity to, int sendflags)
 
 #ifdef WARPZONELIB_KEEPDEBUG
 float WarpZone_CheckProjectileImpact(entity player)
-{SELFPARAM();
+{
        vector o0, v0;
 
        .vector orgvec, velvec;
@@ -435,8 +435,8 @@ float WarpZone_CheckProjectileImpact(entity player)
 #endif
 #endif
 
-float WarpZone_Projectile_Touch()
-{SELFPARAM();
+float WarpZone_Projectile_Touch(entity this)
+{
        if(other.classname == "trigger_warpzone")
                return true;
 
@@ -479,9 +479,8 @@ float WarpZone_Projectile_Touch()
                save_ent = trace_ent;
                save_inopen = trace_inopen;
                save_inwater = trace_inwater;
-               float f;
-               if((f = WarpZone_CheckProjectileImpact(this)) != 0)
-                       return (f > 0);
+               float f = WarpZone_CheckProjectileImpact(this);
+               if (f) return (f > 0);
                trace_dpstartcontents = save_dpstartcontents;
                trace_dphitcontents = save_dphitcontents;
                trace_dphitq3surfaceflags = save_dphitq3surfaceflags;
@@ -543,8 +542,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 +707,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 +816,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 db0ba59cc0c812f76a74290b110c2a6471ec13aa..c6c7b9840c9c86dee6b67093a1e38f6e8cd87189 100644 (file)
@@ -3,7 +3,7 @@
 
 #ifdef SVQC
 void WarpZone_StartFrame();
-float WarpZone_Projectile_Touch();
+float WarpZone_Projectile_Touch(entity this);
 
 // THESE must be defined by calling QC code:
 void WarpZone_PostTeleportPlayer_Callback(entity pl);
index 3163c21f5cac9cf748bca14c2d089dc9a820d223..0d59fa6e4251f1fad85259692af0062e519113d1 100644 (file)
@@ -107,7 +107,7 @@ void havocbot_ai(entity this)
                if(this.weapons)
                {
                        Weapon w = PS(this).m_weapon;
-                       w.wr_aim(w);
+                       w.wr_aim(w, this);
                        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
                        {
                                PHYS_INPUT_BUTTON_ATCK(this) = false;
@@ -807,7 +807,7 @@ void havocbot_movetogoal(entity this)
                                this.aistatus |= AI_STATUS_DANGER_AHEAD;
                }
 
-               dodge = havocbot_dodge();
+               dodge = havocbot_dodge(this);
                dodge = dodge * bound(0,0.5+(skill+this.bot_dodgeskill)*0.1,1);
                evadelava = evadelava * bound(1,3-(skill+this.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
                traceline(this.origin, ( ( this.enemy.absmin + this.enemy.absmax ) * 0.5 ), true, world);
@@ -1268,12 +1268,11 @@ void havocbot_setupbot(entity this)
        havocbot_chooserole(this);
 }
 
-vector havocbot_dodge()
+vector havocbot_dodge(entity this)
 {
        // LordHavoc: disabled because this is too expensive
        return '0 0 0';
 #if 0
-SELFPARAM();
        entity head;
        vector dodge, v, n;
        float danger, bestdanger, vl, d;
index 36b4c33fd9b5a3bdcfdf5645c97afda9c915821d..4a391b6e7ceb9682a2df64023aa98751e88974d1 100644 (file)
@@ -47,7 +47,7 @@ float havocbot_resetgoal(entity this);
 float havocbot_moveto(entity this, vector pos);
 float havocbot_moveto_refresh_route(entity this);
 
-vector havocbot_dodge();
+vector havocbot_dodge(entity this);
 
 .void(entity this) havocbot_role;
 .void(entity this) havocbot_previous_role;
index 2f0b425399560f77a4df0efe89d322a5a874cc7f..ef8451efac92beea85914831f58ae0ad8a9433eb 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 a03155544f6688722ef8e3f462ae50f4531226a2..23c0fa63c3b66a4c168a7bbb5cd12b55fc55c77a 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 55440ca8c0be2615903fcc7039a96dad8d32bd1f..b9928f0b91213da871dbd68baacb0c3c7dd5f46f 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 4dd0c2f767e459b86093a1cf57e97f361ffd53b7..1b40046c6ca709b2fb0ec108c53c04e767e4addc 100644 (file)
@@ -619,7 +619,7 @@ void PutClientInServer()
 
                // reset fields the weapons may use
                FOREACH(Weapons, true, LAMBDA(
-                       it.wr_resetplayer(it);
+                       it.wr_resetplayer(it, this);
                        // reload all reloadable weapons
                        if (it.spawnflags & WEP_FLAG_RELOADABLE) {
                                this.weapon_load[it.m_id] = it.reloading_ammo;
@@ -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)
        {
@@ -2064,7 +2064,6 @@ Called every frame for each client before the physics are run
 =============
 */
 .float usekeypressed;
-void() nexball_setstatus;
 .float last_vehiclecheck;
 .int items_added;
 void PlayerPreThink ()
index 5722934f8e93afd4ebc366c3991879a06d600ad3..85044c27409c948609d42a47f7aec70d0983816c 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;
@@ -556,7 +556,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                excess = frag_damage;
 
                Weapon wep = PS(this).m_weapon;
-               WITHSELF(this, wep.wr_playerdeath(wep));
+               WITHSELF(this, wep.wr_playerdeath(wep, this));
 
                RemoveGrapplingHook(this);
 
@@ -637,7 +637,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
                // reset fields the weapons may use just in case
                FOREACH(Weapons, it != WEP_Null, LAMBDA(
-                       WITHSELF(this, it.wr_resetplayer(it));
+                       WITHSELF(this, it.wr_resetplayer(it, this));
                        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                        {
                                ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
index 22c595f66d3cd9ca4a59ce2e507e0d9f65dc2524..16637fe327415e86ff4f5205322008cf55451ec1 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 a798f286644588d8057d98ab83ef0c8e291a740f..14f7439a4fcc35f3971acb942f9a75e9121dc809 100644 (file)
@@ -183,19 +183,17 @@ 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_reset(entity this)
 {
-       SELFPARAM();
-       timeout_caller = world;
+       timeout_caller = NULL;
        timeout_time = 0;
        timeout_leadtime = 0;
 
-       remove(self);
+       remove(this);
 }
 
-void timeout_handler_think()
+void timeout_handler_think(entity this)
 {
-       SELFPARAM();
        switch (timeout_status)
        {
                case TIMEOUT_ACTIVE:
@@ -222,7 +220,7 @@ void timeout_handler_think()
                                        it.fixangle = false;
                                ));
 
-                               timeout_handler_reset();
+                               timeout_handler_reset(this);
                        }
 
                        return;
@@ -266,7 +264,7 @@ void timeout_handler_think()
                case TIMEOUT_INACTIVE:
                default:
                {
-                       timeout_handler_reset();
+                       timeout_handler_reset(this);
                        return;
                }
        }
@@ -473,7 +471,7 @@ void CommonCommand_info(float request, entity caller, float argc)
                {
                        string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
 
-                       if (command) wordwrap_sprint(command, 1000);
+                       if (command) wordwrap_sprint(caller, command, 1000);
                        else print_to(caller, "ERROR: unsupported info command");
 
                        return;  // never fall through to usage
index b79a570209ff46f7c0f2a10f73634443034cc0d3..63b1c708f21f1bdea6a7fe441988bc2dd57e97bd 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);
@@ -98,9 +98,9 @@ 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_reset(entity this);
 
-void timeout_handler_think();
+void timeout_handler_think(entity this);
 
 // ===================================================
 //  Common commands used in both sv_cmd.qc and cmd.qc
index 138657b885efb99452da05c75b5ebb316bc85d44..616727c5d66b5ad1acb63b46b5eee79f1e69f2ae 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 bc530b9bce44fa6d4b27e40a148d6b9c97c18d12..f056f0ff2f64533954fff7a98651c6b4fc52ec27 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 15d27a3ee4dabc3528a769062d32be456c13ceb2..982e55c9619ac9578d03c421421bfc5dc873aa58 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 6081b5ba986c8fe949795250bb7ded4a12fa9591..730dad620b2d8818eec2ad8ba7a8bd00eeebd504 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 ca5c45b9efd3c01282d965cd812abd15b64c8cb2..e2c5ea2b35d7a3f665df6a222cb9535e599c1c98 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 34719e2f49d1d89ee150b1f3c9fef7fbfdbc84b7..1b5e22bee56ed4e0ccd44c6f86847be5f46557b9 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,11 +301,11 @@ void GrapplingHookThink()
        }
 }
 
-void GrapplingHookTouch ()
-{SELFPARAM();
+void GrapplingHookTouch (entity this)
+{
        if(other.movetype == MOVETYPE_FOLLOW)
                return;
-       PROJECTILE_TOUCH;
+       PROJECTILE_TOUCH(this);
 
        GrapplingHook_Stop();
 
index b8237fa6da196778bad5a2ee8ddd91439ea73b51..796af16b13e5efe2a1a0307d32a0dc34d1cf3102 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 b46907433df87332ec95bc6b31180d6c119b5f06..1b785c2f284b6f59232519cbc2c0d87301a52447 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 f55b4f71926619c735db8927627c9215c3e1139b..9d67d334669faa4802778388bd797d63206479ab 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 ec845454a951714885dbf5768bc6e6a4703f02c3..5de4c56a7e796260d04e69b812ba8f8ffc2320e9 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 ca4d8cf0895e692d86658c58468cfc87b3ff05c5..bf389377f726e8fdf0b907d71883a7d7fd7b0dc0 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 5802a5b97e981cac2c008c76bd0f27259e7c335d..3a918c27307763e07b213a42fb84c8a06b942d98 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 2e947f29db24ca9bae03343c332df2c69c97a2a2..2d52916b1736141a58c67b814882029f7c95494c 100644 (file)
@@ -116,15 +116,13 @@ 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)
 
 
 #define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
 #define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id))
 
-#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
+#define PROJECTILE_TOUCH(this) MACRO_BEGIN if (WarpZone_Projectile_Touch(this)) return; MACRO_END
 
 #define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
 
index f22ba7bd9c8c8be7f589e46986b801d28602c3d6..47544dacde8a9a4365179e9fdf33306c2c4eea1c 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 4f449a1923448fa662e18abf5075e7e266beb507..bb949a49de9869fe87609336f36825dd23cf1f5b 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 c44dfc3743783e2062d77eb2ab370fae1b240099..95e0bcd424ded55bc032f93b0706baf02eb4f882 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 ecf3cb0c13d9585fa5e04f5d05750dc9663aafb9..1584933063e2386780479cc319f9252fcaed254c 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 7bed67bc9679341c07cd464261efd76863f901a4..5514ed201b8c01eb1992f0b658725b87b90b4823 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 418e5638dcb64eaed4dbe5b74fd4689da973aa62..d3e40465c1376323c526c52193c83b8ecee32445 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 0d46dcaa472868f4a7a86590515ca5b106c4043e..22ae10f7c46810c17120a9ef73ba3b72ea61ca8e 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 6552d3c4a2386bccf3f4aa2997061e7ec77f317d..4d65abf9e0b7a98ae7793cea950dc123750fc5dc 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 f45fc84cce2affe1a968378c012301281265f2ad..98eb9cdcf301fcc1b64c63578d69fc2a51d9235b 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 fff4b606c65e2a718b84f26aa65674228fd74dea..09b81724ec1168ac49046317fb873c9c18e06f85 100644 (file)
@@ -23,14 +23,14 @@ void pathlib_showpath(entity start)
     }
 }
 
-void path_dbg_think()
-{SELFPARAM();
-    pathlib_showpath(self);
-    self.nextthink = time + 1;
+void path_dbg_think(entity this)
+{
+    pathlib_showpath(this);
+    this.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 cb38136cb0058b1d4e67d97bb2f4c1f02733edb3..c033f3f52a6c4f9955becffb46ba20d4aed9e5a6 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;
@@ -379,8 +379,8 @@ entity path_build(entity next, vector where, entity prev, entity start)
     return path;
 }
 
-entity pathlib_astar(vector from,vector to)
-{SELFPARAM();
+entity pathlib_astar(entity this, vector from,vector to)
+{
     entity path, start, end, open, n, ln;
     float ptime, ftime, ctime;
 
@@ -442,8 +442,8 @@ entity pathlib_astar(vector from,vector to)
     pathlib_movecost_waterfactor = 25000000;
     pathlib_foundgoal      = 0;
 
-    movenode_boxmax   = self.maxs * 1.1;
-    movenode_boxmin   = self.mins * 1.1;
+    movenode_boxmax   = this.maxs * 1.1;
+    movenode_boxmin   = this.mins * 1.1;
 
     movenode_stepsize = pathlib_gridsize * 0.25;
 
index 2188702f96d961a80c973ec76cf77ed2f5305c6a..52d0005a1efb583aa51887f2da9605918f7e5954 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 e96de83283e50cbd2e92628ffcf85898c54030a8..f86c270b04b3e32ad6ff14294190983f7e7ca699 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 01f578a82345ffb72a94251fe059f00e2a646a68..f0728b720084d011d909ce684835f2fb1c5aacd8 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 67e9d73eecb6ba5e3e9b283634b4ee3ec75f31df..6fc5cf712a1cdd572d091781a74f5228ac34a0f0 100644 (file)
@@ -22,7 +22,7 @@ void race_InitSpectator()
                        race_SendNextCheckpoint(msg_entity.enemy, 1);
 }
 
-void W_Porto_Fail(float failhard);
+void W_Porto_Fail(entity this, float failhard);
 
 float race_readTime(string map, float pos)
 {
@@ -570,7 +570,7 @@ void checkpoint_passed(entity this, entity player)
        {
                // do not allow portalling through checkpoints
                trace_plane_normal = normalize(-1 * player.velocity);
-               WITHSELF(player, W_Porto_Fail(0));
+               W_Porto_Fail(player, 0);
                return;
        }
 
@@ -581,7 +581,7 @@ void checkpoint_passed(entity this, entity player)
        {
                oldmsg = this.message;
                this.message = "";
-               SUB_UseTargets(this, player, player); // TODO: should we be using other for the trigger here?
+               SUB_UseTargets(this, player, player);
                this.message = oldmsg;
        }
 
@@ -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);
 }
@@ -709,8 +709,7 @@ void checkpoint_use(entity this, entity actor, entity trigger)
        if(trigger.classname == "info_player_deathmatch") // a spawn, a spawn
                return;
 
-       other = actor;
-       checkpoint_passed(this, other);
+       checkpoint_passed(this, actor);
 }
 
 bool race_waypointsprite_visible_for_player(entity this, entity player, entity view)
@@ -1093,8 +1092,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 8810ff02701585bfc536895408b91116b72b2ad5..ad0fcaae66278f5a93a47b76f76603874e6deda2 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 d725654b3ac2c781188ce93c5f7e448f7531a718..69c1360851f2c41e9d694a3790a4552e784847ba 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 921da4f3a28f0b37ce52db585d9fbce10eae97f4..4caadee23834008b4ca124baeffe25baf7859296 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 272a91ff7350655619892fa1d9620e664510064e..954f82564fb9a5e17a8ee49924987c3c45e22a00 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 2ab8ea5acca6832f9eda13b257ff006cf0f8cbee..363941b3a71210d24917f897f37c92c52f254d5b 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 f1977c8f0c0ddf3ddb958900d8a5dbc1cda2a5e9..fe59b5bfbbc3a5f45a494021ad41960df96ac41f 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 b0482da9193bd34cb84b18e1d8a65dff74ef7db6..5a27025bc8bfcd146ed19a9a52eed1600ed66f75 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 0e7f399d01346bb1a2125a63d4bd5d613bb0cd42..d5a89b3a1e5b84088276fe94d2e5c9153660a766 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)
        {
@@ -471,7 +469,7 @@ void W_WeaponFrame(Player actor)
                                actor.weaponname = newwep.mdl;
                                actor.bulletcounter = 0;
                                actor.ammo_field = newwep.ammo_field;
-                               newwep.wr_setup(newwep);
+                               newwep.wr_setup(newwep, actor);
                                this.state = WS_RAISE;
 
                                // set our clip load to the load of the weapon we switched to, if it's reloadable
@@ -566,7 +564,7 @@ void W_WeaponFrame(Player actor)
                        }
                        else if (e)
                        {
-                               e.wr_gonethink(e);
+                               e.wr_gonethink(e, actor);
                        }
                }
 
@@ -766,9 +764,9 @@ void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound)
        actor.clip_load = actor.(weapon_load[PS(actor).m_weapon.m_id]) = -1;
 }
 
-void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item)
+void W_DropEvent(.void(Weapon, entity actor) event, entity player, float weapon_type, entity weapon_item)
 {
        Weapon w = Weapons_from(weapon_type);
        weapon_dropevent_item = weapon_item;
-       WITHSELF(player, w.event(w));
+       WITHSELF(player, w.event(w, player));
 }
index 74d120150fc788e917a591beeb98e2c1f7655818..a43a40c2f95d0567d73d932f647b0315abcfe877 100644 (file)
@@ -14,7 +14,7 @@ void W_AttachToShotorg(entity actor, entity flash, vector offset);
 
 void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use);
 
-void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item);
+void W_DropEvent(.void(Weapon, entity actor) event, entity player, float weapon_type, entity weapon_item);
 
 void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound);