Merge branch 'master' into TimePath/global_self
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 5 Sep 2015 02:07:13 +0000 (12:07 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 5 Sep 2015 02:07:13 +0000 (12:07 +1000)
# Conflicts:
# qcsrc/server/mutators/mutator_instagib.qc
# qcsrc/server/mutators/mutator_instagib_items.qc

256 files changed:
qcsrc/client/announcer.qc
qcsrc/client/command/cl_cmd.qc
qcsrc/client/controlpoint.qc
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/damage.qc
qcsrc/client/generator.qc
qcsrc/client/gibs.qc
qcsrc/client/hook.qc
qcsrc/client/hud.qc
qcsrc/client/main.qc
qcsrc/client/modeleffects.qc
qcsrc/client/mutators/events.qh
qcsrc/client/player_skeleton.qc
qcsrc/client/rubble.qc
qcsrc/client/scoreboard.qc
qcsrc/client/teamradar.qc
qcsrc/client/tuba.qc
qcsrc/client/view.qc
qcsrc/client/wall.qc
qcsrc/client/weapons/projectile.qc
qcsrc/common/buffs.qh
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/effects.qc
qcsrc/common/items/inventory.qh
qcsrc/common/minigames/cl_minigames.qc
qcsrc/common/minigames/cl_minigames_hud.qc
qcsrc/common/minigames/minigame/nmm.qc
qcsrc/common/minigames/minigame/pong.qc
qcsrc/common/minigames/sv_minigames.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/spawn.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/movetypes/follow.qc
qcsrc/common/movetypes/movetypes.qc
qcsrc/common/movetypes/push.qc
qcsrc/common/movetypes/step.qc
qcsrc/common/movetypes/toss.qc
qcsrc/common/movetypes/walk.qc
qcsrc/common/mutators/mutator/casings.qc
qcsrc/common/mutators/mutator/damagetext.qc
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/nades.qc
qcsrc/common/net_notice.qc
qcsrc/common/notifications.qc
qcsrc/common/physics.qc
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_rotating.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/plat.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/func/rainsnow.qc
qcsrc/common/triggers/func/rotating.qc
qcsrc/common/triggers/func/stardust.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/func/vectormamamam.qc
qcsrc/common/triggers/misc/corner.qc
qcsrc/common/triggers/misc/follow.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/misc/teleport_dest.qc
qcsrc/common/triggers/platforms.qc
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/subs.qh
qcsrc/common/triggers/target/changelevel.qc
qcsrc/common/triggers/target/location.qc
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/target/spawn.qc
qcsrc/common/triggers/target/speaker.qc
qcsrc/common/triggers/target/voicescript.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/trigger/counter.qc
qcsrc/common/triggers/trigger/delay.qc
qcsrc/common/triggers/trigger/disablerelay.qc
qcsrc/common/triggers/trigger/flipflop.qc
qcsrc/common/triggers/trigger/gamestart.qc
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/keylock.qc
qcsrc/common/triggers/trigger/magicear.qc
qcsrc/common/triggers/trigger/monoflop.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/multivibrator.qc
qcsrc/common/triggers/trigger/relay.qc
qcsrc/common/triggers/trigger/relay_activators.qc
qcsrc/common/triggers/trigger/relay_if.qc
qcsrc/common/triggers/trigger/relay_teamcheck.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/targettrigger.qc
qcsrc/common/turrets/unit/ewheel.qc
qcsrc/common/turrets/unit/flac.qc
qcsrc/common/turrets/unit/fusionreactor.qc
qcsrc/common/turrets/unit/hellion.qc
qcsrc/common/turrets/unit/hk.qc
qcsrc/common/turrets/unit/machinegun.qc
qcsrc/common/turrets/unit/mlrs.qc
qcsrc/common/turrets/unit/phaser.qc
qcsrc/common/turrets/unit/plasma.qc
qcsrc/common/turrets/unit/plasma_dual.qc
qcsrc/common/turrets/unit/tesla.qc
qcsrc/common/turrets/unit/walker.qc
qcsrc/common/turrets/util.qc
qcsrc/common/util-post.qh
qcsrc/common/util.qc
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/unit/bumblebee.qc
qcsrc/common/vehicles/unit/racer.qc
qcsrc/common/vehicles/unit/raptor.qc
qcsrc/common/vehicles/unit/spiderbot.qc
qcsrc/common/viewloc.qc
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/hmg.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/rpc.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/csqcmodellib/cl_model.qc
qcsrc/csqcmodellib/cl_player.qc
qcsrc/csqcmodellib/interpolate.qc
qcsrc/csqcmodellib/sv_model.qc
qcsrc/csqcmodellib/sv_model.qh
qcsrc/lib/Defer.qh
qcsrc/lib/Log.qh
qcsrc/server/anticheat.qc
qcsrc/server/bot/aim.qc
qcsrc/server/bot/bot.qc
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/havocbot/role_keyhunt.qc
qcsrc/server/bot/havocbot/roles.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/scripting.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/cl_player.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/radarmap.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/controlpoint.qc
qcsrc/server/ent_cs.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_hook.qc
qcsrc/server/g_models.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_violence.qc
qcsrc/server/g_world.qc
qcsrc/server/generator.qc
qcsrc/server/ipban.qc
qcsrc/server/item_key.qc
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/movelib.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_assault.qc
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_cts.qc
qcsrc/server/mutators/gamemode_domination.qc
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/mutators/gamemode_invasion.qc
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/mutators/gamemode_race.qc
qcsrc/server/mutators/gamemode_tdm.qc
qcsrc/server/mutators/mutator_bloodloss.qc
qcsrc/server/mutators/mutator_buffs.qc
qcsrc/server/mutators/mutator_campcheck.qc
qcsrc/server/mutators/mutator_dodging.qc
qcsrc/server/mutators/mutator_instagib.qc
qcsrc/server/mutators/mutator_melee_only.qc
qcsrc/server/mutators/mutator_midair.qc
qcsrc/server/mutators/mutator_multijump.qc
qcsrc/server/mutators/mutator_nades.qc
qcsrc/server/mutators/mutator_new_toys.qc
qcsrc/server/mutators/mutator_nix.qc
qcsrc/server/mutators/mutator_overkill.qc
qcsrc/server/mutators/mutator_physical_items.qc
qcsrc/server/mutators/mutator_pinata.qc
qcsrc/server/mutators/mutator_spawn_near_teammate.qc
qcsrc/server/mutators/mutator_superspec.qc
qcsrc/server/mutators/mutator_touchexplode.qc
qcsrc/server/mutators/mutator_vampirehook.qc
qcsrc/server/mutators/sandbox.qc
qcsrc/server/pathlib/debug.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/path_waypoint.qc
qcsrc/server/pathlib/utility.qc
qcsrc/server/playerdemo.qc
qcsrc/server/portals.qc
qcsrc/server/race.qc
qcsrc/server/round_handler.qc
qcsrc/server/scores.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/steerlib.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_items.qc
qcsrc/server/t_quake.qc
qcsrc/server/t_quake3.qc
qcsrc/server/teamplay.qc
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/csqcprojectile.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh
qcsrc/warpzonelib/client.qc
qcsrc/warpzonelib/common.qc
qcsrc/warpzonelib/server.qc
qcsrc/warpzonelib/util_server.qc

index 19e51cedc6b98f2611c274476fba9cc0430300d2..8f477171cec19286cf96efafc40b5517f97fdfe4 100644 (file)
@@ -8,7 +8,7 @@
 bool announcer_1min;
 bool announcer_5min;
 void Announcer_Countdown()
-{
+{SELFPARAM();
        float starttime = getstatf(STAT_GAMESTARTTIME);
        float roundstarttime = getstatf(STAT_ROUNDSTARTTIME);
        if(roundstarttime == -1)
index 2d6093868cc1ea496e5822880e0c69f5900c4f00..8b0a33e6c2c77a951e038cc0c20b4db167dccd02 100644 (file)
@@ -21,7 +21,7 @@
 #include "../../common/command/generic.qh"
 
 void DrawDebugModel()
-{
+{SELFPARAM();
        if(time - floor(time) > 0.5)
        {
                PolyDrawModel(self);
index 3b8901cf37695abafb9873d6daf55fd561c14a0b..83ee0316bdbda31b3cda8ac612b3d1577743004b 100644 (file)
@@ -35,7 +35,7 @@ void cpicon_precache()
 }
 
 void cpicon_draw()
-{
+{SELFPARAM();
        if(time < self.move_time) { return; }
 
        if(self.cp_bob_dmg_z > 0)
@@ -99,7 +99,7 @@ void cpicon_draw()
 }
 
 void cpicon_damage(float hp)
-{
+{SELFPARAM();
        if(!self.iscaptured) { return; }
 
        if(hp < self.max_health * 0.25)
@@ -121,7 +121,7 @@ void cpicon_damage(float hp)
 }
 
 void cpicon_construct()
-{
+{SELFPARAM();
        self.netname = "Control Point Icon";
 
        setmodel(self, "models/onslaught/controlpoint_icon.md3");
@@ -155,7 +155,7 @@ void cpicon_construct()
 
 .vector glowmod;
 void cpicon_changeteam()
-{
+{SELFPARAM();
        if(self.team)
        {
                self.glowmod = Team_ColorRGB(self.team - 1);
@@ -171,7 +171,7 @@ void cpicon_changeteam()
 }
 
 void ent_cpicon()
-{
+{SELFPARAM();
        int sf = ReadByte();
 
        if(sf & CPSF_SETUP)
index d8c44d660c022dc49d5cf5f481fd4aedfde2bc94..7e36cabec6ee48cc7ae88127f15e2b81d3785c89 100644 (file)
@@ -31,7 +31,7 @@ void CSQCModel_Hook_PreDraw(bool isplayer);
 .int lodmodelindex1;
 .int lodmodelindex2;
 void CSQCPlayer_LOD_Apply(void)
-{
+{SELFPARAM();
        // LOD model loading
        if(self.lodmodelindex0 != self.modelindex)
        {
@@ -120,14 +120,14 @@ int forceplayermodels_goodmodelindex;
 .vector old_glowmod;
 
 void CSQCPlayer_ModelAppearance_PreUpdate(void)
-{
+{SELFPARAM();
        self.model = self.forceplayermodels_savemodel;
        self.modelindex = self.forceplayermodels_savemodelindex;
        self.skin = self.forceplayermodels_saveskin;
        self.colormap = self.forceplayermodels_savecolormap;
 }
 void CSQCPlayer_ModelAppearance_PostUpdate(void)
-{
+{SELFPARAM();
        self.forceplayermodels_savemodel = self.model;
        self.forceplayermodels_savemodelindex = self.modelindex;
        self.forceplayermodels_saveskin = self.skin;
@@ -142,7 +142,7 @@ void CSQCPlayer_ModelAppearance_PostUpdate(void)
        }
 }
 void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
-{
+{SELFPARAM();
        // FORCEMODEL
        // which one is ALWAYS good?
        if (!forceplayermodels_goodmodel)
@@ -325,7 +325,7 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
 
 #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
 void CSQCPlayer_FallbackFrame_PreUpdate(void)
-{
+{SELFPARAM();
        self.frame = self.csqcmodel_saveframe;
        self.frame2 = self.csqcmodel_saveframe2;
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
@@ -334,7 +334,7 @@ void CSQCPlayer_FallbackFrame_PreUpdate(void)
 #endif
 }
 void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
-{
+{SELFPARAM();
        self.csqcmodel_saveframe = self.frame;
        self.csqcmodel_saveframe2 = self.frame2;
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
@@ -360,11 +360,11 @@ void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
        self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
 }
 void CSQCPlayer_AnimDecide_PostUpdate(bool isnew)
-{
+{SELFPARAM();
        self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
 }
 int CSQCPlayer_FallbackFrame(int f)
-{
+{SELFPARAM();
        if(frameduration(self.modelindex, f) > 0)
                return f; // goooooood
        if(frameduration(self.modelindex, 1) <= 0)
@@ -384,7 +384,7 @@ int CSQCPlayer_FallbackFrame(int f)
        return f;
 }
 void CSQCPlayer_FallbackFrame_Apply(void)
-{
+{SELFPARAM();
        self.frame = CSQCPlayer_FallbackFrame(self.frame);
        self.frame2 = CSQCPlayer_FallbackFrame(self.frame2);
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
@@ -398,7 +398,7 @@ void CSQCPlayer_FallbackFrame_Apply(void)
 .int tag_entity_lastmodelindex;
 .int tag_index;
 void CSQCModel_AutoTagIndex_Apply(void)
-{
+{SELFPARAM();
        if(self.tag_entity && wasfreed(self.tag_entity))
                self.tag_entity = world;
 
@@ -423,10 +423,7 @@ void CSQCModel_AutoTagIndex_Apply(void)
                // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
                if(self.tag_entity.classname == "csqcmodel")
                {
-                       entity oldself = self;
-                       self = self.tag_entity;
-                       CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients));
-                       self = oldself;
+                       WITH(entity, self, self.tag_entity, CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients)));
                }
 
                if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex)
@@ -499,13 +496,13 @@ const int MF_TRACER3 = 128; // purple trail
 .int csqcmodel_effects;
 .int csqcmodel_modelflags;
 void CSQCModel_Effects_PreUpdate(void)
-{
+{SELFPARAM();
        self.effects = self.csqcmodel_effects;
        self.modelflags = self.csqcmodel_modelflags;
 }
 void Reset_ArcBeam(void);
 void CSQCModel_Effects_PostUpdate(void)
-{
+{SELFPARAM();
        if (self == csqcplayer) {
                if (self.csqcmodel_teleported) {
                        Reset_ArcBeam();
@@ -520,7 +517,7 @@ void CSQCModel_Effects_PostUpdate(void)
 }
 .int snd_looping;
 void CSQCModel_Effects_Apply(void)
-{
+{SELFPARAM();
        int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
 
        self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
@@ -625,7 +622,7 @@ void CSQCPlayer_Precache()
 .int anim_saveframe2time;
 .int anim_prev_pmove_flags;
 void CSQCModel_Hook_PreDraw(bool isplayer)
-{
+{SELFPARAM();
        if(self.csqcmodel_predraw_run == framecount)
                return;
        self.csqcmodel_predraw_run = framecount;
@@ -724,7 +721,7 @@ void CSQCModel_Hook_PreDraw(bool isplayer)
 }
 
 void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer)
-{
+{SELFPARAM();
        // interpolate v_angle
        self.iflags |= IFLAG_V_ANGLE_X;
        // revert to values from server
@@ -738,7 +735,7 @@ void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer)
 }
 
 void CSQCModel_Hook_PostUpdate(bool isnew, bool isplayer, bool islocalplayer)
-{
+{SELFPARAM();
        // is it a player model? (shared state)
        self.isplayermodel = (substring(self.model, 0, 14) == "models/player/" || substring(self.model, 0, 17) == "models/ok_player/" || (substring(self.model, 0, 16) == "models/monsters/" && (self.entnum >= 1 && self.entnum <= maxclients)));
 
index 32d236fba4db7a23194ec99e26cc08b38e331e65..ec03281163fccdc569b5a258f57658876e99a3db 100644 (file)
@@ -20,7 +20,7 @@
 .bool isplayermodel;
 
 void DamageEffect_Think()
-{
+{SELFPARAM();
        // if particle distribution is enabled, slow ticrate by total number of damages
        if(autocvar_cl_damageeffect_distribute)
                self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages;
@@ -53,7 +53,7 @@ void DamageEffect_Think()
 }
 
 void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
-{
+{SELFPARAM();
        // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
 
        int nearestbone = 0;
@@ -125,14 +125,11 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
 }
 
 void Ent_DamageInfo(float isNew)
-{
+{SELFPARAM();
        float thedamage, rad, edge, thisdmg;
        bool hitplayer = false;
        int species, forcemul;
        vector force, thisforce;
-       entity oldself;
-
-       oldself = self;
 
        w_deathtype = ReadShort();
        w_issilent = (w_deathtype & 0x8000);
@@ -159,8 +156,9 @@ void Ent_DamageInfo(float isNew)
        else
                forcemul = 1;
 
-       for(self = findradius(w_org, rad + MAX_DAMAGEEXTRARADIUS); self; self = self.chain)
+       for(entity e = findradius(w_org, rad + MAX_DAMAGEEXTRARADIUS); e; e = e.chain)
        {
+               setself(e);
                // attached ents suck
                if(self.tag_entity)
                        continue;
@@ -211,8 +209,7 @@ void Ent_DamageInfo(float isNew)
                if(self.isplayermodel)
                        hitplayer = true; // this impact damaged a player
        }
-
-       self = oldself;
+       setself(this);
 
        if(DEATH_ISVEHICLE(w_deathtype))
        {
index 80ccc441bcf01cf0188f4be4cf7b0bd9a7d4205e..710ed01f5b6c513b8bf1d4f3cfd0bf276d994ca1 100644 (file)
@@ -32,7 +32,7 @@ void generator_precache()
 }
 
 void ons_generator_ray_draw()
-{
+{SELFPARAM();
        if(time < self.move_time)
                return;
 
@@ -71,7 +71,7 @@ void ons_generator_ray_spawn(vector org)
 }
 
 void generator_draw()
-{
+{SELFPARAM();
        if(time < self.move_time)
                return;
 
@@ -144,7 +144,7 @@ void generator_draw()
 }
 
 void generator_damage(float hp)
-{
+{SELFPARAM();
        if(hp <= 0)
                setmodel(self, "models/onslaught/generator_dead.md3");
        else if(hp < self.max_health * 0.10)
@@ -172,7 +172,7 @@ void generator_damage(float hp)
 }
 
 void generator_construct()
-{
+{SELFPARAM();
        self.netname = "Generator";
        self.classname = "onslaught_generator";
 
@@ -192,7 +192,7 @@ void generator_construct()
 
 .vector glowmod;
 void generator_changeteam()
-{
+{SELFPARAM();
        if(self.team)
        {
                self.glowmod = Team_ColorRGB(self.team - 1);
@@ -208,7 +208,7 @@ void generator_changeteam()
 }
 
 void ent_generator()
-{
+{SELFPARAM();
        int sf = ReadByte();
 
        if(sf & GSF_SETUP)
index b59cd4ff3d50c4d4b80a1722e3a02953ec9bb9ee..3c46ea9288179b5d79b61115f014762d375b7c76 100644 (file)
@@ -13,7 +13,7 @@
 .float gravity;
 
 void Gib_Delete()
-{
+{SELFPARAM();
        remove(self);
 }
 
@@ -75,7 +75,7 @@ void SUB_RemoveOnNoImpact()
 }
 
 void Gib_Touch()
-{
+{SELFPARAM();
        // TODO maybe bounce of walls, make more gibs, etc.
 
        if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
@@ -92,7 +92,7 @@ void Gib_Touch()
 }
 
 void Gib_Draw()
-{
+{SELFPARAM();
        vector oldorg;
        oldorg = self.origin;
 
@@ -164,7 +164,7 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector
 }
 
 void Ent_GibSplash(bool isNew)
-{
+{SELFPARAM();
        int amount, type, specnum;
        vector org, vel;
        string specstr;
index a30ab73c16e357a3972d923c87a43aa5a6623bc4..781681cf73b9b95abc0096dc7f6c3ecaeb867d20 100644 (file)
@@ -32,7 +32,7 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end)
 
 class(Hook) .float teleport_time;
 void Draw_GrapplingHook()
-{
+{SELFPARAM();
        vector a, b, atrans;
        string tex;
        vector rgb;
@@ -167,12 +167,12 @@ void Draw_GrapplingHook()
 }
 
 void Remove_GrapplingHook()
-{
+{SELFPARAM();
        sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
 }
 
 void Ent_ReadHook(float bIsNew, float type)
-{
+{SELFPARAM();
        self.HookType = type;
 
        int sf = ReadByte();
index eb50ebc094090437a069d5a7fcc87ae368b583b0..9a0f87b944a56dfe49d3ce222976c748e6efa0ca 100644 (file)
@@ -352,7 +352,7 @@ int weaponorder_cmp(int i, int j, entity pass)
 }
 
 void HUD_Weapons(void)
-{
+{SELFPARAM();
        // declarations
        WepSet weapons_stat = WepSet_GetFromStat();
        int i;
@@ -413,7 +413,7 @@ void HUD_Weapons(void)
                weapon_cnt = 0;
                for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                {
-                       self = get_weaponinfo(i);
+                       setself(get_weaponinfo(i));
                        if(self.impulse >= 0)
                        {
                                weaponorder[weapon_cnt] = self;
@@ -673,7 +673,7 @@ void HUD_Weapons(void)
        for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
        {
                // retrieve information about the current weapon to be drawn
-               self = weaponorder[i];
+               setself(weaponorder[i]);
                weapon_id = self.impulse;
                isCurrent = (self.weapon == switchweapon);
 
index 31e0256d3062d8cdf802b027c46156356c1c6a8d..3603fab1e1042983929507f6ba6c208702230704 100644 (file)
@@ -304,7 +304,7 @@ float SetTeam(entity o, int Team)
 }
 
 void Playerchecker_Think()
-{
+{SELFPARAM();
     int i;
        entity e;
        for(i = 0; i < maxclients; ++i)
@@ -398,11 +398,11 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 // BEGIN OPTIONAL CSQC FUNCTIONS
 
 void Ent_RemoveEntCS()
-{
+{SELFPARAM();
        entcs_receiver[self.sv_entnum] = world;
 }
 void Ent_ReadEntCS()
-{
+{SELFPARAM();
     int sf;
        InterpolateOrigin_Undo();
 
@@ -438,7 +438,7 @@ void Ent_ReadEntCS()
 void Ent_Remove();
 
 void Ent_RemovePlayerScore()
-{
+{SELFPARAM();
        if(self.owner) {
                SetTeam(self.owner, -1);
                self.owner.gotscores = 0;
@@ -449,7 +449,7 @@ void Ent_RemovePlayerScore()
 }
 
 void Ent_ReadPlayerScore()
-{
+{SELFPARAM();
        int i, n;
        bool isNew;
        entity o;
@@ -507,7 +507,7 @@ void Ent_ReadPlayerScore()
 }
 
 void Ent_ReadTeamScore()
-{
+{SELFPARAM();
        int i;
        entity o;
 
@@ -699,12 +699,12 @@ void Ent_ReadAccuracy(void)
 }
 
 void Spawn_Draw(void)
-{
+{SELFPARAM();
        pointparticles(self.cnt, self.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
 }
 
 void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
-{
+{SELFPARAM();
        float teamnum = (ReadByte() - 1);
        vector spn_origin;
        spn_origin.x = ReadShort();
@@ -750,7 +750,7 @@ void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
 }
 
 void Ent_ReadSpawnEvent(float is_new)
-{
+{SELFPARAM();
        // If entnum is 0, ONLY do the local spawn actions
        // this way the server can disable the sending of
        // spawn origin or such to clients if wanted.
@@ -806,7 +806,7 @@ void Ent_RadarLink();
 void Ent_Init();
 void Ent_ScoresInfo();
 void CSQC_Ent_Update(float bIsNewEntity)
-{
+{SELFPARAM();
        float t;
        float savetime;
        t = ReadByte();
@@ -924,7 +924,7 @@ void CSQC_Ent_Update(float bIsNewEntity)
 // used when an entity changes its type. For an entity that someone interacts
 // with others, make sure it can no longer do so.
 void Ent_Remove()
-{
+{SELFPARAM();
        if(self.entremove)
                self.entremove();
 
@@ -948,7 +948,7 @@ void Ent_Remove()
 }
 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed.  Essentially call remove(self) as well.
 void CSQC_Ent_Remove()
-{
+{SELFPARAM();
        if(autocvar_developer_csqcentities)
                LOG_INFOF("CSQC_Ent_Remove() with self=%i self.entnum=%d self.enttype=%d\n", self, self.entnum, self.enttype);
 
@@ -1011,7 +1011,7 @@ void Fog_Force()
 
 void Gamemode_Init();
 void Ent_ScoresInfo()
-{
+{SELFPARAM();
     int i;
        self.classname = "ent_client_scores_info";
        gametype = ReadInt24_t();
@@ -1035,7 +1035,7 @@ void Ent_ScoresInfo()
 }
 
 void Ent_Init()
-{
+{SELFPARAM();
        self.classname = "ent_client_init";
 
        nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
index c44fbe4dca452dfe702d72e96135a04212284a78..fa7044fc29e4a7db03026565310335b71e5bee81 100644 (file)
@@ -6,7 +6,7 @@
 .float alpha;
 
 void ModelEffect_Draw()
-{
+{SELFPARAM();
        self.angles = self.angles + frametime * self.avelocity;
        setorigin(self, self.origin + frametime * self.velocity);
        self.scale = self.scale1 + (self.scale2 - self.scale1) * (time - self.teleport_time) / (self.lifetime + self.fadetime - self.teleport_time);
@@ -25,7 +25,7 @@ void ModelEffect_Draw()
 }
 
 void Ent_ModelEffect(bool isNew)
-{
+{SELFPARAM();
        self.classname = "modeleffect_spawner";
 
        int f = ReadByte();
index fe2e3fd33ffb6f915b06e160b171d88927ffd116..a79e0b4712eef8ade9c5573967e5833a61629128 100644 (file)
@@ -64,13 +64,13 @@ MUTATOR_HOOKABLE(CSQC_Ent_Update, EV_CSQC_Ent_Update);
 
 /** Called when a projectile is linked with CSQC */
 #define EV_Ent_Projectile(i, o) \
-    /** entity id */ i(entity, self) \
+    /** entity id */ i(entity, __self) \
     /**/
 MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
 
 /** Called when a projectile's properties are being modified */
 #define EV_EditProjectile(i, o) \
-    /** entity id */ i(entity, self) \
+    /** entity id */ i(entity, __self) \
     /**/
 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
 
@@ -79,25 +79,25 @@ MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS);
 
 /** Called when updating the attached tags index */
 #define EV_TagIndex_Update(i, o) \
-    /** entity id */ i(entity, self) \
+    /** entity id */ i(entity, __self) \
     /**/
 MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update);
 
 /** Called when setting the attached tags */
 #define EV_TagIndex_Apply(i, o) \
-    /** entity id */ i(entity, self) \
+    /** entity id */ i(entity, __self) \
     /**/
 MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply);
 
 /** Called when setting up skeleton bones */
 #define EV_Skeleton_CheckBones(i, o) \
-    /** entity id */ i(entity, self) \
+    /** entity id */ i(entity, __self) \
     /**/
 MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones);
 
 /** Called when setting up bones from the loaded model */
 #define EV_Skeleton_CheckModel(i, o) \
-    /** entity id */ i(entity, self) \
+    /** entity id */ i(entity, __self) \
     /**/
 MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel);
 
@@ -125,7 +125,7 @@ MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
 
 /** Called checking if 3rd person mode should be forced on */
 #define EV_WantEventchase(i, o) \
-    /** entity id */ i(entity, self) \
+    /** entity id */ i(entity, __self) \
     /**/
 MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
 
index 00f9543717f39c5f19c5c6e09cd7667d2f99e620..584a1978015222c3e4604cec92bb2b2666706e29 100644 (file)
@@ -107,7 +107,7 @@ void free_skeleton_from_frames(entity e)
 }
 
 void skeleton_from_frames(entity e, float is_dead)
-{
+{SELFPARAM();
        float m = e.modelindex;
        if(!e.skeletonindex)
        {
index 4e32c0c45490fc9451c17504c5bafb7483368701..5af2e235070f7c5d7b63f2fc3d30353f0f206cfd 100644 (file)
@@ -3,15 +3,12 @@
 // LordHavoc: rewrote this file, it was really bad code
 
 void RubbleLimit(string cname, float limit, void() deleteproc)
-{
+{SELFPARAM();
        entity e;
        entity oldest;
-       entity oldself;
        float c;
        float oldesttime;
 
-       oldself = self;
-
        // remove rubble of the same type if it's at the limit
        // remove multiple rubble if the limit has been decreased
        while(1)
@@ -42,9 +39,7 @@ void RubbleLimit(string cname, float limit, void() deleteproc)
                        break;
 
                // delete this oldest one and search again
-               self = oldest;
-               deleteproc();
-               self = oldself;
+               WITH(entity, self, oldest, deleteproc());
        }
 }
 
index da5a7b2a771ab9cdb85a5101be323089fb21d9f7..407c087470ab8dfde6f9d21db71fed1169ba8ff8 100644 (file)
@@ -975,7 +975,7 @@ float HUD_WouldDrawScoreboard() {
 
 float average_accuracy;
 vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
-{
+{SELFPARAM();
        WepSet weapons_stat = WepSet_GetFromStat();
        WepSet weapons_inmap = WepSet_GetFromStat_InMap();
        float initial_posx = pos.x;
@@ -984,7 +984,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        int disownedcnt = 0;
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
-               self = get_weaponinfo(i);
+               setself(get_weaponinfo(i));
                if(!self.weapon)
                        continue;
 
@@ -1052,7 +1052,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        int column;
        for(i = WEP_FIRST, column = 0; i <= WEP_LAST; ++i)
        {
-               self = get_weaponinfo(i);
+               setself(get_weaponinfo(i));
                if (!self.weapon)
                        continue;
                weapon_stats = weapon_accuracy[i-WEP_FIRST];
index ab6129e782cd214de6e72b33d7731b6ef7960962..8eaf7e4c2206fe7d000e3d5f6b9aef87421fb966 100644 (file)
@@ -202,7 +202,7 @@ void teamradar_loadcvars()
 // radar links
 
 void Ent_RadarLink()
-{
+{SELFPARAM();
        int sendflags = ReadByte();
 
        InterpolateOrigin_Undo();
index b95dd99e324773ab5f437e5ddcc7a5fe446aae48..1acfbd7eb7b1aee14fc43e40dd8507bfe7379fe2 100644 (file)
@@ -70,7 +70,7 @@ void tubasound(entity e, bool restart)
 }
 
 void Ent_TubaNote_Think()
-{
+{SELFPARAM();
        float f = autocvar_g_balance_tuba_fadetime;
        if (f > 0) {
                self.tuba_volume -= frametime * self.tuba_volume_initial / f;
@@ -91,7 +91,7 @@ void Ent_TubaNote_Think()
 }
 
 void Ent_TubaNote_UpdateSound()
-{
+{SELFPARAM();
        self.enemy.tuba_volume = bound(0, VOL_BASE * autocvar_g_balance_tuba_volume, 1);
        self.enemy.tuba_volume_initial = self.enemy.tuba_volume;
        self.enemy.note = self.note;
@@ -100,13 +100,13 @@ void Ent_TubaNote_UpdateSound()
 }
 
 void Ent_TubaNote_StopSound()
-{
+{SELFPARAM();
        self.enemy.nextthink = time;
        self.enemy = world;
 }
 
 void Ent_TubaNote(bool isNew)
-{
+{SELFPARAM();
        bool upd = false;
        int f = ReadByte();
        if (f & 1) {
index 701eb9f1e7419bb5328bcdd6e0651bd94b86e1c0..1e4d666e9cb64c28f2399fb52ebdb5da05d2cf18 100644 (file)
@@ -427,7 +427,7 @@ vector liquidcolor_prev;
 float eventchase_current_distance;
 float eventchase_running;
 bool WantEventchase()
-{
+{SELFPARAM();
        if(autocvar_cl_orthoview)
                return false;
        if(intermission)
@@ -533,7 +533,7 @@ void UpdateHitsound()
 }
 
 void UpdateCrosshair()
-{
+{SELFPARAM();
        static float rainbow_last_flicker;
     static vector rainbow_prev_color;
        entity e = self;
@@ -1022,7 +1022,7 @@ int lasthud;
 float vh_notice_time;
 void WaypointSprite_Load();
 void CSQC_UpdateView(float w, float h)
-{
+{SELFPARAM();
        entity e;
        float fov;
        float f;
@@ -1466,11 +1466,9 @@ void CSQC_UpdateView(float w, float h)
           mousepos = mousepos*0.5 + getmousepos();
         */
 
-       e = self;
-       for(self = world; (self = nextent(self)); )
-               if(self.draw)
-                       self.draw();
-       self = e;
+       for(entity e = NULL; (e = nextent(e)); ) if (e.draw) {
+               WITH(entity, self, e, e.draw());
+       }
 
        addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
        renderscene();
@@ -1805,11 +1803,9 @@ void CSQC_UpdateView(float w, float h)
          } else */
 
        // draw 2D entities
-       e = self;
-       for(self = world; (self = nextent(self)); )
-               if(self.draw2d)
-                       self.draw2d();
-       self = e;
+       for (entity e = NULL; (e = nextent(e)); ) if (e.draw2d) {
+               WITH(entity, self, e, e.draw2d());
+       }
        Draw_ShowNames_All();
 
        scoreboard_active = HUD_WouldDrawScoreboard();
index 92c142435636a8113f973e486f3ec8ec406a084b..7d79f7756500dad7b06478bd6104b64ee816a51c 100644 (file)
@@ -12,7 +12,7 @@
 .vector movedir;
 
 void Ent_Wall_PreDraw()
-{
+{SELFPARAM();
        if (self.inactive)
        {
                self.alpha = 0;
@@ -52,7 +52,7 @@ void Ent_Wall_PreDraw()
 }
 
 void Ent_Wall_Draw()
-{
+{SELFPARAM();
        float f;
        var .vector fld;
 
@@ -110,14 +110,14 @@ void Ent_Wall_Draw()
 }
 
 void Ent_Wall_Remove()
-{
+{SELFPARAM();
        if(self.bgmscript)
                strunzone(self.bgmscript);
        self.bgmscript = string_null;
 }
 
 void Ent_Wall()
-{
+{SELFPARAM();
        int f;
        var .vector fld;
 
index 668228b649828dae983f200969d209a477b633d0..7f13ab5dfe5455c31baa259cfe9a5feb8bd88510 100644 (file)
 .vector colormod;
 
 void SUB_Stop()
-{
+{SELFPARAM();
        self.move_velocity = self.move_avelocity = '0 0 0';
        self.move_movetype = MOVETYPE_NONE;
 }
 
 void Projectile_ResetTrail(vector to)
-{
+{SELFPARAM();
        self.trail_oldorigin = to;
        self.trail_oldtime = time;
 }
 
 void Projectile_DrawTrail(vector to)
-{
+{SELFPARAM();
        vector from;
        float t0;
 
@@ -52,7 +52,7 @@ void Projectile_DrawTrail(vector to)
 }
 
 void Projectile_Draw()
-{
+{SELFPARAM();
        vector rot;
        vector trailorigin;
        int f;
@@ -166,7 +166,7 @@ void Projectile_Draw()
 }
 
 void loopsound(entity e, int ch, string samp, float vol, float attn)
-{
+{SELFPARAM();
        if(self.silent)
                return;
 
@@ -175,7 +175,7 @@ void loopsound(entity e, int ch, string samp, float vol, float attn)
 }
 
 void Ent_RemoveProjectile()
-{
+{SELFPARAM();
        if(self.count & 0x80)
        {
                tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.05, MOVE_NORMAL, self);
@@ -184,7 +184,7 @@ void Ent_RemoveProjectile()
 }
 
 void Ent_Projectile()
-{
+{SELFPARAM();
        int f;
 
        // projectile properties:
index f1ef589eedffdf8616a5302614019dce2582fb34..eeaba7371d94ed86394f3a34ea49eaa981f932fc 100644 (file)
@@ -146,6 +146,7 @@ void buff_Init(entity ent);
 void buff_Init_Compat(entity ent, entity replacement);
 
 #define BUFF_SPAWNFUNC(e, b, t) void spawnfunc_item_buff_##e() { \
+       SELFPARAM(); \
        self.buffs = b.m_itemid; \
        self.team = t; \
        buff_Init(self); \
@@ -156,7 +157,7 @@ void buff_Init_Compat(entity ent, entity replacement);
                BUFF_SPAWNFUNC(e##_team2,   b,  NUM_TEAM_2) \
                BUFF_SPAWNFUNC(e##_team3,   b,  NUM_TEAM_3) \
                BUFF_SPAWNFUNC(e##_team4,   b,  NUM_TEAM_4)
-#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { buff_Init_Compat(self, r); }
+#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { SELFPARAM(); buff_Init_Compat(self, r); }
 
 BUFF_SPAWNFUNCS(resistance,            BUFF_RESISTANCE)
 BUFF_SPAWNFUNCS(ammo,                  BUFF_AMMO)
index e11604aae3da6b8e2847cb05891bc8c5e40b815d..d356ff76d072d7b4c8a670f4ef6118197801687f 100644 (file)
@@ -86,8 +86,8 @@
 //vector PL_CROUCH_VIEW_OFS  = ...;
 
 #ifdef SVQC
-# define CSQCMODEL_AUTOINIT() CSQCModel_LinkEntity()
-# define CSQCMODEL_AUTOUPDATE() CSQCModel_CheckUpdate()
+# define CSQCMODEL_AUTOINIT(e) CSQCModel_LinkEntity(e)
+# define CSQCMODEL_AUTOUPDATE(e) CSQCModel_CheckUpdate(e)
 #endif
 
 #define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE
index e1707021ea2f8231f46ad0a3c993b221a04bb9fb..242145f0bac3abc6bedde2b6cd3933ae78e6521e 100644 (file)
@@ -39,7 +39,7 @@ void Read_Effect(bool is_new)
 
 #ifdef SVQC
 bool Net_Write_Effect(entity client, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_EFFECT);
 #if EFFECTS_COUNT >= 255
        WriteShort(MSG_ENTITY, self.m_id);
index 9b4013405d6740e7db8b23ac5a463a2bcc0e6e51..2ec8837d48e16d527114973be62f1c75b5e3c516 100644 (file)
@@ -41,7 +41,7 @@ void Inventory_Write(Inventory data)
 
 #ifdef SVQC
 bool Inventory_Send(entity to, int sf)
-{
+{SELFPARAM();
     WriteByte(MSG_ENTITY, ENT_CLIENT_INVENTORY);
     entity e = self.owner;
     if (IS_SPEC(e)) e = e.enemy;
index 3a1cc86744c16f9ea93f40c0a3ce22801cd874d6..83150d7d262df73076e607e5b45ad43fc9499eab 100644 (file)
@@ -88,7 +88,7 @@ string minigame_texture(string name)
 #define MSLE_CLEAN_Vector2D(x)
 
 #define MSLE(Name,Fields) \
-       void msle_entremove_##Name() { strunzone(self.netname); Fields }
+       void msle_entremove_##Name() { SELFPARAM(); strunzone(self.netname); Fields }
 MINIGAME_SIMPLELINKED_ENTITIES
 #undef MSLE
 #undef FIELD
@@ -127,7 +127,7 @@ void deactivate_minigame()
 }
 
 void minigame_entremove()
-{
+{SELFPARAM();
        if ( self == active_minigame )
                deactivate_minigame();
 }
@@ -169,7 +169,7 @@ void activate_minigame(entity minigame)
 }
 
 void minigame_player_entremove()
-{
+{SELFPARAM();
        if ( self.owner == active_minigame && self.minigame_playerslot == player_localentnum )
                deactivate_minigame();
 }
@@ -190,7 +190,7 @@ string ReadString_Zoned() { return strzone(ReadString_Raw()); }
                Fields \
        }
 void minigame_read_owner()
-{
+{SELFPARAM();
        string owner_name = ReadString_Raw();
        self.owner = world;
        do
@@ -200,7 +200,7 @@ void minigame_read_owner()
                LOG_TRACE("Got a minigame entity without a minigame!\n");
 }
 void ent_read_minigame()
-{
+{SELFPARAM();
        float sf = ReadByte();
        if ( sf & MINIG_SF_CREATE )
        {
index b7b7df128a501174a4faf43a220b3826d449e9b8..51155f236fffaf0357b4615a3e0123c91cc1cd97 100644 (file)
@@ -104,13 +104,10 @@ entity HUD_MinigameMenu_activeitem;
 
 // Click the given item
 void HUD_MinigameMenu_Click(entity menuitem)
-{
+{SELFPARAM();
        if ( menuitem )
        {
-               entity e = self;
-               self = menuitem;
-               menuitem.use();
-               self = e;
+               WITH(entity, self, menuitem, menuitem.use());
        }
 }
 
@@ -167,14 +164,14 @@ entity HUD_MinigameMenu_SpawnSubEntry(string s, void() click, entity parent)
 
 // Click action for Create sub-entries
 void HUD_MinigameMenu_ClickCreate_Entry()
-{
+{SELFPARAM();
        minigame_cmd("create ",self.netname);
 }
 
 // Helper click action for collapsible entries
 // returns true when you have to create the sub-entries
 bool HUD_MinigameMenu_Click_ExpandCollapse()
-{
+{SELFPARAM();
        entity e;
        if ( self.flags & 2 )
        {
@@ -211,7 +208,7 @@ bool HUD_MinigameMenu_Click_ExpandCollapse()
 
 // Click action for the Create menu
 void HUD_MinigameMenu_ClickCreate()
-{
+{SELFPARAM();
        if ( HUD_MinigameMenu_Click_ExpandCollapse() )
        {
                entity e;
@@ -231,14 +228,14 @@ void HUD_MinigameMenu_ClickCreate()
 
 // Click action for Join sub-entries
 void HUD_MinigameMenu_ClickJoin_Entry()
-{
+{SELFPARAM();
        minigame_cmd("join ",self.netname);
        HUD_MinigameMenu_EraseEntry(self);
 }
 
 // Click action for the Join menu
 void HUD_MinigameMenu_ClickJoin()
-{
+{SELFPARAM();
        if ( HUD_MinigameMenu_Click_ExpandCollapse() )
        {
                entity e = world;
@@ -274,13 +271,13 @@ void HUD_MinigameMenu_ClickQuit()
 
 // Click action for Invite sub-entries
 void HUD_MinigameMenu_ClickInvite_Entry()
-{
+{SELFPARAM();
        minigame_cmd("invite #",self.netname);
 }
 
 // Click action for the Invite menu
 void HUD_MinigameMenu_ClickInvite()
-{
+{SELFPARAM();
        if ( HUD_MinigameMenu_Click_ExpandCollapse() )
        {
                entity e;
@@ -304,7 +301,7 @@ void HUD_MinigameMenu_ClickInvite()
 }
 
 void HUD_MinigameMenu_ClickCustomEntry()
-{
+{SELFPARAM();
        if ( active_minigame )
                active_minigame.minigame_event(active_minigame,"menu_click",self.netname);
 }
@@ -321,7 +318,7 @@ void HUD_MinigameMenu_CustomEntry(entity parent, string menumessage, string even
 
 // Click action for the Current Game menu
 void HUD_MinigameMenu_ClickCurrentGame()
-{
+{SELFPARAM();
        if ( HUD_MinigameMenu_Click_ExpandCollapse() )
        {
                HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnSubEntry(
index b7ad467b8c2728ec128d8835c23157007540121f..5b9dd1ffe6df79dee9c7c50087a619cd847fe943 100644 (file)
@@ -617,7 +617,7 @@ string nmm_turn_to_string(int turnflags)
 
 // Required function, handle client events
 int nmm_client_event(entity minigame, string event, ...)
-{
+{SELFPARAM();
        if ( event == "activate" )
        {
                nmm_fromtile = world;
index 6aca04cf95f4675f90e318b02af6c479080d0e9f..0049fc93f984980199ac8beec899f40a08c7f82e 100644 (file)
@@ -53,7 +53,7 @@ void pong_ball_throw(entity ball)
 
 // Think equivalent of pong_ball_throw, used to delay throws
 void pong_ball_throwthink()
-{
+{SELFPARAM();
        pong_ball_throw(self);
 }
 
@@ -144,7 +144,7 @@ bool pong_goal(entity ball, int pteam)
 
 // Moves the ball around
 void pong_ball_think()
-{
+{SELFPARAM();
        float think_speed = autocvar_sys_ticrate;
        self.nextthink = time + think_speed;
        
@@ -200,7 +200,7 @@ void pong_ball_think()
 
 // AI action
 void pong_ai_think()
-{
+{SELFPARAM();
        float think_speed = autocvar_sv_minigames_pong_ai_thinkspeed;
        self.nextthink = time + think_speed;
        
@@ -265,7 +265,7 @@ entity pong_ai_spawn(entity paddle)
 
 // Moves the paddle
 void pong_paddle_think()
-{
+{SELFPARAM();
        float think_speed = autocvar_sys_ticrate;
        self.nextthink = time + think_speed;
 
index feb4b02944874bc692c0672b90881d6dee8094b9..44653ae9410436f70860fc5d831ab05e1ccb1548 100644 (file)
@@ -61,7 +61,7 @@ void minigame_rmplayer(entity minigame_session, entity player)
 // Send an entity to a client
 // only use on minigame entities or entities with a minigame owner
 bool minigame_SendEntity(entity to, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_MINIGAME);
        WriteByte(MSG_ENTITY, sf);
        
@@ -115,7 +115,7 @@ void minigame_resend(entity minigame)
 }
 
 bool minigame_CheckSend()
-{
+{SELFPARAM();
        entity e;
        for ( e = self.owner.minigame_players; e != world; e = e.list_next )
                if ( e.minigame_players == other )
@@ -124,7 +124,7 @@ bool minigame_CheckSend()
 }
 
 int minigame_addplayer(entity minigame_session, entity player)
-{
+{SELFPARAM();
        if ( player.active_minigame )
        {
                if ( player.active_minigame == minigame_session )
@@ -150,10 +150,7 @@ int minigame_addplayer(entity minigame_session, entity player)
 
                if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
                {
-                       entity e = self;
-                       self = player;
-                       PutObserverInServer();
-                       self = e;
+                       WITH(entity, self, player, PutObserverInServer());
                }
                if ( autocvar_sv_minigames_observer == 2 )
                        player.team_forced = -1;
@@ -317,7 +314,7 @@ entity minigame_find_player(entity client)
 }
 
 bool MinigameImpulse(int imp)
-{
+{SELFPARAM();
        entity e = minigame_find_player(self);
        if ( imp && self.active_minigame && e )
        {
@@ -329,7 +326,7 @@ bool MinigameImpulse(int imp)
 
 
 void ClientCommand_minigame(int request, int argc, string command)
-{
+{SELFPARAM();
        if ( !autocvar_sv_minigames )
        {
                sprint(self,"Minigames are not enabled!\n");
index 8f92d693a6e614fbf2422f36722a8484b84d9b06..8e26b9c1f348a2c575e17b97626b7b3300a6186e 100644 (file)
@@ -62,7 +62,7 @@ void() M_Mage_Defend_Shield;
 .float mage_shield_time;
 
 float M_Mage_Defend_Heal_Check(entity e)
-{
+{SELFPARAM();
        if(e == world)
                return false;
        if(e.health <= 0)
@@ -88,7 +88,7 @@ float M_Mage_Defend_Heal_Check(entity e)
 }
 
 void M_Mage_Attack_Spike_Explode()
-{
+{SELFPARAM();
        self.event_damage = func_null;
 
        sound(self, CH_SHOTS, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM);
@@ -110,7 +110,7 @@ void M_Mage_Attack_Spike_Touch()
 
 // copied from W_Seeker_Think
 void M_Mage_Attack_Spike_Think()
-{
+{SELFPARAM();
        entity e;
        vector desireddir, olddir, newdir, eorg;
        float turnrate;
@@ -173,7 +173,7 @@ void M_Mage_Attack_Spike_Think()
 }
 
 void M_Mage_Attack_Spike()
-{
+{SELFPARAM();
        entity missile;
        vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
 
@@ -200,7 +200,7 @@ void M_Mage_Attack_Spike()
 }
 
 void M_Mage_Defend_Heal()
-{
+{SELFPARAM();
        entity head;
        float washealed = false;
 
@@ -257,7 +257,7 @@ void M_Mage_Defend_Heal()
 }
 
 void M_Mage_Attack_Push()
-{
+{SELFPARAM();
        sound(self, CH_SHOTS, W_Sound("tagexp1"), 1, ATTEN_NORM);
        RadiusDamage (self, self, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE, self.enemy);
        Send_Effect(EFFECT_TE_EXPLOSION, self.origin, '0 0 0', 1);
@@ -267,7 +267,7 @@ void M_Mage_Attack_Push()
 }
 
 void M_Mage_Attack_Teleport()
-{
+{SELFPARAM();
        if(vlen(self.enemy.origin - self.origin) >= 500)
                return;
 
@@ -284,13 +284,13 @@ void M_Mage_Attack_Teleport()
 }
 
 void M_Mage_Defend_Shield_Remove()
-{
+{SELFPARAM();
        self.effects &= ~(EF_ADDITIVE | EF_BLUE);
        self.armorvalue = autocvar_g_monsters_armor_blockpercent;
 }
 
 void M_Mage_Defend_Shield()
-{
+{SELFPARAM();
        self.effects |= (EF_ADDITIVE | EF_BLUE);
        self.mage_shield_delay = time + (autocvar_g_monster_mage_shield_delay);
        self.armorvalue = (autocvar_g_monster_mage_shield_blockpercent);
@@ -301,7 +301,7 @@ void M_Mage_Defend_Shield()
 }
 
 float M_Mage_Attack(float attack_type)
-{
+{SELFPARAM();
        switch(attack_type)
        {
                case MONSTER_ATTACK_MELEE:
@@ -348,7 +348,7 @@ void spawnfunc_monster_mage() { Monster_Spawn(MON_MAGE.monsterid); }
 #endif // SVQC
 
 bool M_Mage(int req)
-{
+{SELFPARAM();
        switch(req)
        {
                #ifdef SVQC
index 4640fe945bcf33f6e9ea8744bdf0d79303334d2f..0a77342f62289f44df5bae349a1a7e5f66456a11 100644 (file)
@@ -47,7 +47,7 @@ const float shambler_anim_death               = 8;
 .float shambler_lastattack; // delay attacks separately
 
 void M_Shambler_Attack_Smash()
-{
+{SELFPARAM();
        makevectors(self.angles);
        Send_Effect(EFFECT_EXPLOSION_MEDIUM, (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs.z), '0 0 0', 1);
        sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM);
@@ -61,7 +61,7 @@ void M_Shambler_Attack_Smash()
 }
 
 void M_Shambler_Attack_Swing()
-{
+{SELFPARAM();
        float r = (random() < 0.5);
        if(r && Monster_Attack_Melee(self.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((r) ? self.anim_melee2 : self.anim_melee3), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, true))
        {
@@ -72,7 +72,7 @@ void M_Shambler_Attack_Swing()
 }
 
 void M_Shambler_Attack_Lightning_Explode()
-{
+{SELFPARAM();
        entity head;
 
        sound(self, CH_SHOTS, W_Sound("electro_impact"), VOL_BASE, ATTEN_NORM);
@@ -99,7 +99,7 @@ void M_Shambler_Attack_Lightning_Explode()
 }
 
 void M_Shambler_Attack_Lightning_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
        if (self.health <= 0)
                return;
 
@@ -113,14 +113,14 @@ void M_Shambler_Attack_Lightning_Damage(entity inflictor, entity attacker, float
 }
 
 void M_Shambler_Attack_Lightning_Touch()
-{
+{SELFPARAM();
        PROJECTILE_TOUCH;
 
        self.use ();
 }
 
 void M_Shambler_Attack_Lightning_Think()
-{
+{SELFPARAM();
        self.nextthink = time;
        if (time > self.cnt)
        {
@@ -131,7 +131,7 @@ void M_Shambler_Attack_Lightning_Think()
 }
 
 void M_Shambler_Attack_Lightning()
-{
+{SELFPARAM();
        entity gren;
 
        monster_makevectors(self.enemy);
@@ -169,7 +169,7 @@ void M_Shambler_Attack_Lightning()
 }
 
 float M_Shambler_Attack(float attack_type)
-{
+{SELFPARAM();
        switch(attack_type)
        {
                case MONSTER_ATTACK_MELEE:
@@ -215,7 +215,7 @@ void spawnfunc_monster_shambler() { Monster_Spawn(MON_SHAMBLER.monsterid); }
 #endif // SVQC
 
 bool M_Shambler(int req)
-{
+{SELFPARAM();
        switch(req)
        {
                #ifdef SVQC
index 0179c66b9add72b73c2a165e64fbd0f4e9fd996d..7c9d31b2f717f3078dd7d9fed34dbc091f910a13 100644 (file)
@@ -38,7 +38,7 @@ const float spider_anim_attack2               = 3;
 .float spider_web_delay;
 
 void M_Spider_Attack_Web_Explode()
-{
+{SELFPARAM();
        entity e;
        if(self)
        {
@@ -60,7 +60,7 @@ void M_Spider_Attack_Web_Touch()
 }
 
 void M_Spider_Attack_Web()
-{
+{SELFPARAM();
        monster_makevectors(self.enemy);
 
        sound(self, CH_SHOTS, W_Sound("electro_fire2"), VOL_BASE, ATTEN_NORM);
@@ -98,7 +98,7 @@ void M_Spider_Attack_Web()
 }
 
 bool M_Spider_Attack(int attack_type)
-{
+{SELFPARAM();
        switch(attack_type)
        {
                case MONSTER_ATTACK_MELEE:
@@ -128,7 +128,7 @@ void spawnfunc_monster_spider() { Monster_Spawn(MON_SPIDER.monsterid); }
 #endif // SVQC
 
 bool M_Spider(int req)
-{
+{SELFPARAM();
        switch(req)
        {
                #ifdef SVQC
index 9bdc4c63afa57ed7bd000df7894ace290844d187..f1160fb52e70886fb7abcd4a6897be7bd80ea0f3 100644 (file)
@@ -37,7 +37,7 @@ const float wyvern_anim_death = 4;
 */
 
 void M_Wyvern_Attack_Fireball_Explode()
-{
+{SELFPARAM();
        entity e;
        if(self)
        {
@@ -60,7 +60,7 @@ void M_Wyvern_Attack_Fireball_Touch()
 }
 
 void M_Wyvern_Attack_Fireball()
-{
+{SELFPARAM();
        entity missile = spawn();
        vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
 
@@ -83,7 +83,7 @@ void M_Wyvern_Attack_Fireball()
 }
 
 float M_Wyvern_Attack(float attack_type)
-{
+{SELFPARAM();
        switch(attack_type)
        {
                case MONSTER_ATTACK_MELEE:
@@ -105,7 +105,7 @@ void spawnfunc_monster_wyvern() { Monster_Spawn(MON_WYVERN.monsterid); }
 #endif // SVQC
 
 bool M_Wyvern(int req)
-{
+{SELFPARAM();
        switch(req)
        {
                #ifdef SVQC
index 780cf74b381dadb7fc5db70ee4f45bef5fa63e11..fe7c384ca96c2dfc9dcc8f6e7f15b9d8be12116a 100644 (file)
@@ -63,7 +63,7 @@ const float zombie_anim_spawn                         = 30;
 */
 
 void M_Zombie_Attack_Leap_Touch()
-{
+{SELFPARAM();
        if (self.health <= 0)
                return;
 
@@ -86,7 +86,7 @@ void M_Zombie_Attack_Leap_Touch()
 }
 
 void M_Zombie_Defend_Block_End()
-{
+{SELFPARAM();
        if(self.health <= 0)
                return;
 
@@ -95,7 +95,7 @@ void M_Zombie_Defend_Block_End()
 }
 
 float M_Zombie_Defend_Block()
-{
+{SELFPARAM();
        self.armorvalue = 0.9;
        self.state = MONSTER_ATTACK_MELEE; // freeze monster
        self.attack_finished_single = time + 2.1;
@@ -108,7 +108,7 @@ float M_Zombie_Defend_Block()
 }
 
 float M_Zombie_Attack(float attack_type)
-{
+{SELFPARAM();
        switch(attack_type)
        {
                case MONSTER_ATTACK_MELEE:
@@ -142,7 +142,7 @@ void spawnfunc_monster_zombie() { Monster_Spawn(MON_ZOMBIE.monsterid); }
 #endif // SVQC
 
 bool M_Zombie(int req)
-{
+{SELFPARAM();
        switch(req)
        {
                #ifdef SVQC
index 4a84f943584499708acab79e9a387ab8909f7dc5..dfa318fe3acd92224dcd5e35367b0fc006eeabdc 100644 (file)
@@ -10,7 +10,7 @@
     #include "../../server/defs.qh"
 #endif
 entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag)
-{
+{SELFPARAM();
        float i;
        entity e = spawn();
 
@@ -64,10 +64,7 @@ entity spawnmonster (string monster, float monster_id, entity spawnedby, entity
        }
        
        // Monster_Spawn checks if monster is valid
-       entity oldself = self;
-       self = e;
-       Monster_Spawn(monster_id);
-       self = oldself;
+       WITH(entity, self, e, Monster_Spawn(monster_id));
 
        return e;
 }
index d0b39828d1acbcf1da0b7ff5706ae558ab0d066b..d4e1691f0ce1a1dd5ba73880bb9c709f7bedb7cf 100644 (file)
 #endif
 
 void monsters_setstatus()
-{
+{SELFPARAM();
        self.stat_monsters_total = monsters_total;
        self.stat_monsters_killed = monsters_killed;
 }
 
 void monster_dropitem()
-{
+{SELFPARAM();
        if(!self.candrop || !self.monster_loot)
                return;
 
        vector org = self.origin + ((self.mins + self.maxs) * 0.5);
-       entity e = spawn(), oldself = self;
+       entity e = spawn();
 
        e.monster_loot = self.monster_loot;
 
@@ -47,7 +47,7 @@ void monster_dropitem()
 
        if(e && e.monster_loot)
        {
-               self = e;
+               setself(e);
                e.noalign = true;
                e.monster_loot();
                e.gravity = 1;
@@ -58,12 +58,12 @@ void monster_dropitem()
                e.item_spawnshieldtime = time + 0.7;
                e.classname = "droppedweapon"; // use weapon handling to remove it on touch
                SUB_SetFade(e, time + autocvar_g_monsters_drop_time, 1);
-               self = oldself;
+               setself(this);
        }
 }
 
 void monster_makevectors(entity e)
-{
+{SELFPARAM();
        if(IS_MONSTER(self))
        {
                vector v;
@@ -81,7 +81,7 @@ void monster_makevectors(entity e)
 // ===============
 
 bool Monster_ValidTarget(entity mon, entity player)
-{
+{SELFPARAM();
        // ensure we're not checking nonexistent monster/target
        if(!mon || !player) { return false; }
 
@@ -196,9 +196,9 @@ void monster_changeteam(entity ent, float newteam)
 }
 
 void Monster_Delay_Action()
-{
+{SELFPARAM();
        entity oldself = self;
-       self = self.owner;
+       setself(self.owner);
        if(Monster_ValidTarget(self, self.enemy)) { oldself.use(); }
 
        if(oldself.cnt > 0)
@@ -215,7 +215,7 @@ void Monster_Delay_Action()
 }
 
 void Monster_Delay(float repeat_count, float repeat_defer, float defer_amnt, void() func)
-{
+{SELFPARAM();
        // deferred attacking, checks if monster is still alive and target is still valid before attacking
        entity e = spawn();
 
@@ -266,7 +266,7 @@ void Monster_Sound_Precache(string f)
 }
 
 void Monster_Sounds_Precache()
-{
+{SELFPARAM();
        string m = (get_monsterinfo(self.monsterid)).model;
        float globhandle, n, i;
        string f;
@@ -285,7 +285,7 @@ void Monster_Sounds_Precache()
 }
 
 void Monster_Sounds_Clear()
-{
+{SELFPARAM();
 #define _MSOUND(m) if(self.monstersound_##m) { strunzone(self.monstersound_##m); self.monstersound_##m = string_null; }
        ALLMONSTERSOUNDS
 #undef _MSOUND
@@ -305,7 +305,7 @@ void Monster_Sounds_Clear()
 }
 
 bool Monster_Sounds_Load(string f, int first)
-{
+{SELFPARAM();
        float fh;
        string s;
        var .string field;
@@ -332,7 +332,7 @@ bool Monster_Sounds_Load(string f, int first)
 
 .int skin_for_monstersound;
 void Monster_Sounds_Update()
-{
+{SELFPARAM();
        if(self.skin == self.skin_for_monstersound) { return; }
 
        self.skin_for_monstersound = self.skin;
@@ -342,7 +342,7 @@ void Monster_Sounds_Update()
 }
 
 void Monster_Sound(.string samplefield, float sound_delay, float delaytoo, float chan)
-{
+{SELFPARAM();
        if(!autocvar_g_monsters_sounds) { return; }
 
        if(delaytoo)
@@ -359,7 +359,7 @@ void Monster_Sound(.string samplefield, float sound_delay, float delaytoo, float
 // =======================
 
 float Monster_Attack_Melee(entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop)
-{
+{SELFPARAM();
        if(dostop && (self.flags & FL_MONSTER)) { self.state = MONSTER_ATTACK_MELEE; }
 
        setanim(self, anim, false, true, false);
@@ -380,7 +380,7 @@ float Monster_Attack_Melee(entity targ, float damg, vector anim, float er, float
 }
 
 float Monster_Attack_Leap_Check(vector vel)
-{
+{SELFPARAM();
        if(self.state && (self.flags & FL_MONSTER))
                return false; // already attacking
        if(!(self.flags & FL_ONGROUND))
@@ -402,7 +402,7 @@ float Monster_Attack_Leap_Check(vector vel)
 }
 
 bool Monster_Attack_Leap(vector anm, void() touchfunc, vector vel, float animtime)
-{
+{SELFPARAM();
        if(!Monster_Attack_Leap_Check(vel))
                return false;
 
@@ -457,7 +457,7 @@ void Monster_Attack_Check(entity e, entity targ)
 // ======================
 
 void Monster_UpdateModel()
-{
+{SELFPARAM();
        // assume some defaults
        /*self.anim_idle   = animfixfps(self, '0 1 0.01', '0 0 0');
        self.anim_walk   = animfixfps(self, '1 1 0.01', '0 0 0');
@@ -475,7 +475,7 @@ void Monster_UpdateModel()
 }
 
 void Monster_Touch()
-{
+{SELFPARAM();
        if(other == world) { return; }
 
        if(other.monster_attack)
@@ -486,7 +486,7 @@ void Monster_Touch()
 }
 
 void Monster_Miniboss_Check()
-{
+{SELFPARAM();
        if(MUTATOR_CALLHOOK(MonsterCheckBossFlag))
                return;
 
@@ -503,7 +503,7 @@ void Monster_Miniboss_Check()
 }
 
 bool Monster_Respawn_Check()
-{
+{SELFPARAM();
        if(self.deadflag == DEAD_DEAD) // don't call when monster isn't dead
        if(MUTATOR_CALLHOOK(MonsterRespawn, self))
                return true; // enabled by a mutator
@@ -517,10 +517,10 @@ bool Monster_Respawn_Check()
        return true;
 }
 
-void Monster_Respawn() { Monster_Spawn(self.monsterid); }
+void Monster_Respawn() { SELFPARAM(); Monster_Spawn(self.monsterid); }
 
 void Monster_Dead_Fade()
-{
+{SELFPARAM();
        if(Monster_Respawn_Check())
        {
                self.spawnflags |= MONSTERFLAG_RESPAWNED;
@@ -550,12 +550,12 @@ void Monster_Dead_Fade()
 }
 
 void Monster_Use()
-{
+{SELFPARAM();
        if(Monster_ValidTarget(self, activator)) { self.enemy = activator; }
 }
 
 vector Monster_Move_Target(entity targ)
-{
+{SELFPARAM();
        // enemy is always preferred target
        if(self.enemy)
        {
@@ -664,7 +664,7 @@ vector Monster_Move_Target(entity targ)
 }
 
 void Monster_CalculateVelocity(entity mon, vector to, vector from, float turnrate, float movespeed)
-{
+{SELFPARAM();
        float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis
        float initial_height = 0; //min(50, (targ_distance * tanh(20)));
        float current_height = (initial_height * min(1, (self.pass_distance) ? (current_distance / self.pass_distance) : current_distance));
@@ -698,7 +698,7 @@ void Monster_CalculateVelocity(entity mon, vector to, vector from, float turnrat
 }
 
 void Monster_Move(float runspeed, float walkspeed, float stpspeed)
-{
+{SELFPARAM();
        if(self.target2) { self.goalentity = find(world, targetname, self.target2); }
 
        entity targ;
@@ -924,7 +924,7 @@ void Monster_Remove(entity mon)
 }
 
 void Monster_Dead_Think()
-{
+{SELFPARAM();
        self.nextthink = time + self.ticrate;
 
        if(self.monster_lifetime != 0)
@@ -936,7 +936,7 @@ void Monster_Dead_Think()
 }
 
 void Monster_Appear()
-{
+{SELFPARAM();
        self.enemy = activator;
        self.spawnflags &= ~MONSTERFLAG_APPEAR; // otherwise, we get an endless loop
        Monster_Spawn(self.monsterid);
@@ -957,7 +957,7 @@ float Monster_Appear_Check(entity ent, float monster_id)
 }
 
 void Monster_Reset()
-{
+{SELFPARAM();
        setorigin(self, self.pos1);
        self.angles = self.pos2;
 
@@ -972,7 +972,7 @@ void Monster_Reset()
 }
 
 void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
        self.health -= damage;
 
        Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
@@ -991,7 +991,7 @@ void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int de
 }
 
 void Monster_Dead(entity attacker, float gibbed)
-{
+{SELFPARAM();
        self.think = Monster_Dead_Think;
        self.nextthink = time;
        self.monster_lifetime = time + 5;
@@ -1044,7 +1044,7 @@ void Monster_Dead(entity attacker, float gibbed)
 }
 
 void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
        if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL)
                return;
 
@@ -1128,7 +1128,7 @@ void Monster_Damage(entity inflictor, entity attacker, float damage, int deathty
 
 // don't check for enemies, just keep walking in a straight line
 void Monster_Move_2D(float mspeed, float allow_jumpoff)
-{
+{SELFPARAM();
        if(gameover || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || self.draggedby != world || time < game_starttime || (autocvar_g_campaign && !campaign_bots_may_start) || time < self.spawn_time)
        {
                mspeed = 0;
@@ -1183,7 +1183,7 @@ void Monster_Move_2D(float mspeed, float allow_jumpoff)
 }
 
 void Monster_Anim()
-{
+{SELFPARAM();
        int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
        if(self.deadflag)
        {
@@ -1220,7 +1220,7 @@ void Monster_Anim()
 }
 
 void Monster_Think()
-{
+{SELFPARAM();
        self.think = Monster_Think;
        self.nextthink = self.ticrate;
 
@@ -1236,11 +1236,11 @@ void Monster_Think()
 
        Monster_Anim();
 
-       CSQCMODEL_AUTOUPDATE();
+       CSQCMODEL_AUTOUPDATE(self);
 }
 
 float Monster_Spawn_Setup()
-{
+{SELFPARAM();
        MON_ACTION(self.monsterid, MR_SETUP);
 
        // ensure some basic needs are met
@@ -1300,7 +1300,7 @@ float Monster_Spawn_Setup()
 }
 
 bool Monster_Spawn(int mon_id)
-{
+{SELFPARAM();
        // setup the basic required properties for a monster
        entity mon = get_monsterinfo(mon_id);
        if(!mon.monsterid) { return false; } // invalid monster
@@ -1400,7 +1400,7 @@ bool Monster_Spawn(int mon_id)
        if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
                monster_setupcolors(self);
 
-       CSQCMODEL_AUTOINIT();
+       CSQCMODEL_AUTOINIT(self);
 
        return true;
 }
index 6cf28d6f1724bf6d1342c487cb10b6fe2848c973..b636772687ebdc66113ffec3ad69fdabe7995082 100644 (file)
@@ -1,5 +1,5 @@
 void _Movetype_Physics_Follow() // SV_Physics_Follow
-{
+{SELFPARAM();
        entity e = self.move_aiment; // TODO: networking?
 
        // LordHavoc: implemented rotation on MOVETYPE_FOLLOW objects
index ac2f9034ea7c7e47e5d782b8d0b183d5d49dd010..cfa6346dc44178904f2003208d28e4a63198bb1e 100644 (file)
@@ -33,7 +33,7 @@ void _Movetype_WallFriction(vector stepnormal)  // SV_WallFriction
 
 vector planes[MAX_CLIP_PLANES];
 int _Movetype_FlyMove(float dt, bool applygravity, vector stepnormal, float stepheight) // SV_FlyMove
-{
+{SELFPARAM();
        int blocked = 0, bumpcount;
        int i, j, numplanes = 0;
        float time_left = dt, grav = 0;
@@ -317,8 +317,7 @@ void _Movetype_CheckWaterTransition(entity ent)  // SV_CheckWaterTransition
 }
 
 void _Movetype_Impact(entity oth)  // SV_Impact
-{
-       entity oldself = self;
+{SELFPARAM();
        entity oldother = other;
 
        if(self.move_touch)
@@ -333,26 +332,23 @@ void _Movetype_Impact(entity oth)  // SV_Impact
        if(oth.move_touch)
        {
                other = self;
-               self = oth;
 
-               self.move_touch();
+               WITH(entity, self, oth, oth.move_touch());
 
-               self = oldself;
                other = oldother;
        }
 }
 
 void _Movetype_LinkEdict_TouchAreaGrid()  // SV_LinkEdict_TouchAreaGrid
-{
-       entity oldself = self;
+{SELFPARAM();
        entity oldother = other;
 
        for (entity e = findradius(0.5 * (self.absmin + self.absmax), 0.5 * vlen(self.absmax - self.absmin)); e; e = e.chain)
        {
-               if(e.move_touch && boxesoverlap(e.absmin, e.absmax, oldself.absmin, oldself.absmax))
+               if(e.move_touch && boxesoverlap(e.absmin, e.absmax, this.absmin, this.absmax))
                {
-                       self = e;
-                       other = oldself;
+                       setself(e);
+                       other = this;
 
                        trace_allsolid = false;
                        trace_startsolid = false;
@@ -362,18 +358,18 @@ void _Movetype_LinkEdict_TouchAreaGrid()  // SV_LinkEdict_TouchAreaGrid
                        trace_endpos = e.origin;
                        trace_plane_normal = '0 0 1';
                        trace_plane_dist = 0;
-                       trace_ent = oldself;
+                       trace_ent = this;
 
                        e.move_touch();
                }
        }
 
        other = oldother;
-       self = oldself;
+       setself(this);
 }
 
 void _Movetype_LinkEdict(bool touch_triggers)  // SV_LinkEdict
-{
+{SELFPARAM();
        vector mi, ma;
        if(self.solid == SOLID_BSP)
        {
@@ -416,7 +412,7 @@ void _Movetype_LinkEdict(bool touch_triggers)  // SV_LinkEdict
 }
 
 bool _Movetype_TestEntityPosition(vector ofs)  // SV_TestEntityPosition
-{
+{SELFPARAM();
 //     vector org = self.move_origin + ofs;
 
        int cont = self.dphitcontentsmask;
@@ -433,7 +429,7 @@ bool _Movetype_TestEntityPosition(vector ofs)  // SV_TestEntityPosition
 }
 
 bool _Movetype_UnstickEntity()  // SV_UnstickEntity
-{
+{SELFPARAM();
        if(!_Movetype_TestEntityPosition('0 0 0')) return true;
        if(!_Movetype_TestEntityPosition('-1 0 0')) goto success;
        if(!_Movetype_TestEntityPosition('1 0 0')) goto success;
@@ -470,7 +466,7 @@ vector _Movetype_ClipVelocity(vector vel, vector norm, float f)  // SV_ClipVeloc
 }
 
 void _Movetype_PushEntityTrace(vector push)
-{
+{SELFPARAM();
        vector end = self.move_origin + push;
        int type;
        if(self.move_nomonsters)
@@ -486,7 +482,7 @@ void _Movetype_PushEntityTrace(vector push)
 }
 
 float _Movetype_PushEntity(vector push, bool failonstartsolid)  // SV_PushEntity
-{
+{SELFPARAM();
        _Movetype_PushEntityTrace(push);
 
        if(trace_startsolid && failonstartsolid)
@@ -560,7 +556,7 @@ void makevectors_matrix(vector myangles)  // AngleVectorsFLU
 }
 
 void _Movetype_Physics_Frame(float movedt)
-{
+{SELFPARAM();
        self.move_didgravity = -1;
        switch (self.move_movetype)
        {
@@ -596,7 +592,7 @@ void _Movetype_Physics_Frame(float movedt)
 }
 
 void Movetype_Physics_NoMatchServer()  // optimized
-{
+{SELFPARAM();
        float movedt = time - self.move_time;
        self.move_time = time;
 
@@ -616,7 +612,7 @@ void Movetype_Physics_MatchServer(bool sloppy)
 }
 
 void Movetype_Physics_MatchTicrate(float tr, bool sloppy)  // SV_Physics_Entity
-{
+{SELFPARAM();
        if(tr <= 0)
        {
                Movetype_Physics_NoMatchServer();
index 954033edbe9f59256914958a0963b2fd29f6b90b..aeb75ded3053773acb45263e9fb46fe86636079b 100644 (file)
@@ -1,5 +1,5 @@
 void _Movetype_PushMove(float dt)  // SV_PushMove
-{
+{SELFPARAM();
        if (self.move_velocity == '0 0 0' && self.move_avelocity == '0 0 0')
        {
                self.move_ltime += dt;
@@ -93,26 +93,23 @@ void _Movetype_PushMove(float dt)  // SV_PushMove
                        if (check.move_movetype == 32)  // MOVETYPE_PHYSICS
                        {
                                check.move_origin = check.move_origin + move;
-                               entity oldself = self;
-                               self = check;
-                               _Movetype_LinkEdict(true);
-                               self = oldself;
+                               WITH(entity, self, check, _Movetype_LinkEdict(true));
                                continue;
                        }
 
                        // try moving the contacted entity
                        self.solid = SOLID_NOT;
-                       entity oldself = self;
-                       self = check;
-                       if (!_Movetype_PushEntity(move, true))
+                       bool flag;
+                       WITH(entity, self, check, {
+                               flag = _Movetype_PushEntity(move, true);
+                       });
+                       if (!flag)
                        {
-                               self = oldself;
                                // entity "check" got teleported
                                check.move_angles_y += trace_fraction * moveangle.y;
                                self.solid = savesolid;
                                continue;  // pushed enough
                        }
-                       self = oldself;
                        // FIXME: turn players specially
                        check.move_angles_y += trace_fraction * moveangle.y;
                        self.solid = savesolid;
@@ -131,7 +128,7 @@ void _Movetype_PushMove(float dt)  // SV_PushMove
 }
 
 void _Movetype_Physics_Pusher(float dt)  // SV_Physics_Pusher
-{
+{SELFPARAM();
        float oldltime = self.move_ltime;
        float thinktime = self.move_nextthink;
        float movetime;
index 822bf093511606dc3faacd664f9984c07ae746d2..f4884ba27a23a5137af32c369dade827dc06d282 100644 (file)
@@ -1,5 +1,5 @@
 void _Movetype_Physics_Step(float dt) // SV_Physics_Step
-{
+{SELFPARAM();
        if(self.move_flags & FL_ONGROUND)
        {
                if(self.velocity_z >= (1.0 / 32.0) && UPWARD_VELOCITY_CLEARS_ONGROUND)
index 6ed0407eb30f80c2776e34551191d636efe37da3..32ce9ca31223f4afd2b42c00259ec2fce1e3f214 100644 (file)
@@ -1,7 +1,7 @@
 #include "../physics.qh"
 
 void _Movetype_Physics_Toss(float dt)  // SV_Physics_Toss
-{
+{SELFPARAM();
        if (self.move_flags & FL_ONGROUND)
        {
                if (self.move_velocity.z >= 1 / 32)
index bd01be4e747fdf2f5b47079aeee6db5715ff0ec7..0f18a47bfc6ee4bcc487f464ddd6eeb625e615ef 100644 (file)
@@ -1,5 +1,5 @@
 void _Movetype_Physics_Walk(float dt)  // SV_WalkMove
-{
+{SELFPARAM();
        vector stepnormal = '0 0 0';
 
        // if frametime is 0 (due to client sending the same timestamp twice), don't move
index a9a86f81f1984e331a60ccc541b5f89c9af4de4d..e93ed49a4b8775beb4fdaec8b4a069dba769655e 100644 (file)
@@ -9,7 +9,7 @@ REGISTER_MUTATOR(casings, true);
 
 #ifdef SVQC
 void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner)
-{
+{SELFPARAM();
     vector org = self.origin + self.view_ofs + self.weaponentity.spawnorigin.x * v_forward - self.weaponentity.spawnorigin.y * v_right + self.weaponentity.spawnorigin.z * v_up;
 
     if (!sound_allowed(MSG_BROADCAST, casingowner))
@@ -36,12 +36,12 @@ class(Casing) .int state;
 class(Casing) .float cnt;
 
 void Casing_Delete()
-{
+{SELFPARAM();
     remove(self);
 }
 
 void Casing_Draw()
-{
+{SELFPARAM();
     if (self.move_flags & FL_ONGROUND)
     {
         self.move_angles_x = 0;
@@ -64,7 +64,7 @@ void Casing_Draw()
 }
 
 void Casing_Touch()
-{
+{SELFPARAM();
     if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
     {
         Casing_Delete();
@@ -100,7 +100,7 @@ void Casing_Touch()
 }
 
 void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce)
-{
+{SELFPARAM();
     if (thisforce.z < 0)
         thisforce.z = 0;
     self.move_velocity = self.move_velocity + thisforce + '0 0 100';
index eec2d356b01b72ca3f9ef6509b2e026a872a0227..8d21f17057a1da4baf5770f618d73f720fb0bccb 100644 (file)
@@ -25,7 +25,7 @@ CLASS(DamageText, Object)
     ATTRIB(DamageText, time_prev, float, time)
 
     void DamageText_draw() {
-        entity this = self;
+        SELFPARAM();
         float dt = time - this.time_prev;
         this.time_prev = time;
         setorigin(this, this.origin + dt * this.velocity);
index c3a025080d39315274a0676db7812d682001fc47..d7ca5a3351585f82148d90d6457d184ff13f3b8c 100644 (file)
@@ -149,24 +149,28 @@ float Item_ItemsTime_UpdateTime(entity e, float t)
     return t;
 }
 
-MUTATOR_HOOKFUNCTION(itemstime, reset_map_global) {
+MUTATOR_HOOKFUNCTION(itemstime, reset_map_global)
+{SELFPARAM();
     Item_ItemsTime_ResetTimes();
     // ALL the times need to be reset before .reset()ing each item
     // since Item_Reset schedules respawn of superweapons and powerups
-    for (self = world; (self = nextent(self)); )
-    if (IS_NOT_A_CLIENT(self))
+    for (entity e = NULL; (e = nextent(e)); )
+    if (IS_NOT_A_CLIENT(e))
     {
+        setself(e);
         if (self.reset)
             Item_ItemsTime_SetTime(self, 0);
     }
     Item_ItemsTime_SetTimesForAllPlayers();
 }
 
-MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver) {
+MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver)
+{SELFPARAM();
     Item_ItemsTime_SetTimesForPlayer(self);
 }
 
-MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn) {
+MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn)
+{SELFPARAM();
     if (warmup_stage) return;
     Item_ItemsTime_ResetTimesForPlayer(self);
 }
index c9858830b670f94c58ac002516713f6f477ae6e2..2015acb5f8cda0d73408d9794465873fbf1b5aa6 100644 (file)
@@ -5,7 +5,7 @@ REGISTER_MUTATOR(waypointsprites, true);
 #ifdef SVQC
 /** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
 float WaypointSprite_SendEntity(entity to, float sendflags)
-{
+{SELFPARAM();
     WriteMutator(MSG_ENTITY, waypointsprites);
 
     sendflags = sendflags & 0x7F;
@@ -118,7 +118,7 @@ MUTATOR_HOOKFUNCTION(waypointsprites, CSQC_Ent_Update) {
 }
 
 void Ent_RemoveWaypointSprite()
-{
+{SELFPARAM();
     if (self.netname) strunzone(self.netname);
     if (self.netname2) strunzone(self.netname2);
     if (self.netname3) strunzone(self.netname3);
@@ -126,7 +126,7 @@ void Ent_RemoveWaypointSprite()
 
 /** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
 void Ent_WaypointSprite()
-{
+{SELFPARAM();
     int sendflags = ReadByte();
     self.wp_extra = ReadByte();
 
@@ -232,7 +232,7 @@ void Ent_WaypointSprite()
 
 #ifdef CSQC
 float spritelookupblinkvalue(string s)
-{
+{SELFPARAM();
     if (s == WP_Weapon.netname) {
         if (get_weaponinfo(self.wp_extra).spawnflags & WEP_FLAG_SUPERWEAPON)
             return 2;
@@ -243,7 +243,7 @@ float spritelookupblinkvalue(string s)
 }
 
 vector spritelookupcolor(string s, vector def)
-{
+{SELFPARAM();
     if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).wpcolor;
     if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_color;
     if (s == WP_Buff.netname) return BUFFS[self.wp_extra].m_color;
@@ -251,7 +251,7 @@ vector spritelookupcolor(string s, vector def)
 }
 
 string spritelookuptext(string s)
-{
+{SELFPARAM();
     if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
     if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).message;
     if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_waypoint;
@@ -456,7 +456,7 @@ vector fixrgbexcess(vector rgb)
 }
 
 void Draw_WaypointSprite()
-{
+{SELFPARAM();
     if (self.lifetime)
         self.alpha = pow(bound(0, (self.fadetime - time) / self.lifetime, 1), waypointsprite_timealphaexponent);
     else
@@ -912,7 +912,7 @@ void WaypointSprite_Disown(entity wp, float fadetime)
 }
 
 void WaypointSprite_Think()
-{
+{SELFPARAM();
     bool doremove = false;
 
     if (self.fade_time && time >= self.teleport_time)
@@ -930,7 +930,7 @@ void WaypointSprite_Think()
 }
 
 float WaypointSprite_visible_for_player(entity e)
-{
+{SELFPARAM();
     // personal waypoints
     if (self.enemy && self.enemy != e)
         return false;
@@ -972,7 +972,7 @@ float WaypointSprite_isteammate(entity e, entity e2)
 }
 
 float WaypointSprite_Customize()
-{
+{SELFPARAM();
     // this is not in SendEntity because it shall run every frame, not just every update
 
     // make spectators see what the player would see
@@ -987,7 +987,7 @@ float WaypointSprite_Customize()
 float WaypointSprite_SendEntity(entity to, float sendflags);
 
 void WaypointSprite_Reset()
-{
+{SELFPARAM();
     // if a WP wants to time out, let it time out immediately; other WPs ought to be reset/killed by their owners
 
     if (self.fade_time) // there was there before: || g_keyhunt, do we really need this?
@@ -1056,7 +1056,7 @@ entity WaypointSprite_DeployFixed(
     vector ofs,
     float icon // initial icon
 )
-{
+{SELFPARAM();
     float t;
     if (teamplay)
         t = self.team;
@@ -1075,7 +1075,7 @@ entity WaypointSprite_DeployPersonal(
     vector ofs,
     float icon // initial icon
 )
-{
+{SELFPARAM();
     return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, false, icon);
 }
 
@@ -1084,7 +1084,7 @@ entity WaypointSprite_Attach(
     float limited_range,
     float icon // initial icon
 )
-{
+{SELFPARAM();
     float t;
     if (self.waypointsprite_attachedforcarrier)
         return world; // can't attach to FC
@@ -1122,25 +1122,25 @@ void WaypointSprite_DetachCarrier(entity carrier)
 }
 
 void WaypointSprite_ClearPersonal()
-{
+{SELFPARAM();
     WaypointSprite_Kill(self.waypointsprite_deployed_personal);
 }
 
 void WaypointSprite_ClearOwned()
-{
+{SELFPARAM();
     WaypointSprite_Kill(self.waypointsprite_deployed_fixed);
     WaypointSprite_Kill(self.waypointsprite_deployed_personal);
     WaypointSprite_Kill(self.waypointsprite_attached);
 }
 
 void WaypointSprite_PlayerDead()
-{
+{SELFPARAM();
     WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime);
     WaypointSprite_DetachCarrier(self);
 }
 
 void WaypointSprite_PlayerGone()
-{
+{SELFPARAM();
     WaypointSprite_Disown(self.waypointsprite_deployed_fixed, waypointsprite_deadlifetime);
     WaypointSprite_Kill(self.waypointsprite_deployed_personal);
     WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime);
index f9ddb8e99153d0f60b06cea63ba491589d35a3c8..08f579b275e3c16477dc7c3155be9e088a518e9c 100644 (file)
@@ -17,7 +17,7 @@
 
 #ifdef SVQC
 float healer_send(entity to, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_HEALING_ORB);
        WriteByte(MSG_ENTITY, sf);
 
@@ -41,7 +41,7 @@ float healer_send(entity to, int sf)
 #ifdef CSQC
 .float ltime;
 void healer_draw()
-{
+{SELFPARAM();
        float dt = time - self.move_time;
        self.move_time = time;
        if(dt <= 0)
@@ -53,7 +53,7 @@ void healer_draw()
 }
 
 void healer_setup()
-{
+{SELFPARAM();
        setmodel(self, "models/ctf/shield.md3");
 
        setorigin(self, self.origin);
@@ -75,7 +75,7 @@ void healer_setup()
 }
 
 void ent_healer()
-{
+{SELFPARAM();
        int sf = ReadByte();
 
        if(sf & TNSF_SETUP)
index fb9958b08fcbd186fd151b65afb89462d442a357..f748f9903825ad96ec0073a99af653e533717278 100644 (file)
@@ -2,7 +2,7 @@
 
 #ifdef SVQC
 void sv_notice_join_think()
-{
+{SELFPARAM();
     //NextLevel();
     float argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
     if(argc > 0)
@@ -15,7 +15,7 @@ void sv_notice_join_think()
 }
 
 void sv_notice_join()
-{
+{SELFPARAM();
     // to-do: make sv_join_notices support per-entry times
     if(autocvar_sv_join_notices == "")
         return;
index 5145e5340cff8f3a78748bb88c1d107e90ac8e08..b040a536894fd62eb4d147d6dedb6648e18826ca 100644 (file)
@@ -1756,7 +1756,7 @@ void Read_Notification(float is_new)
 
 #ifdef SVQC
 void Net_Notification_Remove()
-{
+{SELFPARAM();
        if (!self) { backtrace(sprintf("Net_Notification_Remove() at %f: Missing self!?\n", time)); return; }
 
        #ifdef NOTIFICATIONS_DEBUG
@@ -1774,7 +1774,7 @@ void Net_Notification_Remove()
 }
 
 float Net_Write_Notification(entity client, int sf)
-{
+{SELFPARAM();
        if(Notification_ShouldSend(self.nent_broadcast, client, self.nent_client))
        {
                WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
index b53696b987b18ad7604406bde27eac5763560db3..b3db77143b375f4bdb315e22a1a3c0d057aecd38 100644 (file)
@@ -116,7 +116,7 @@ void Physics_AddStats()
 }
 
 void Physics_UpdateStats(float maxspd_mod)
-{
+{SELFPARAM();
        // blah
        self.stat_pl_view_ofs = PL_VIEW_OFS;
        self.stat_pl_crouch_view_ofs = PL_CROUCH_VIEW_OFS;
@@ -222,7 +222,7 @@ vector unstick_offsets[unstick_count] =
 };
 
 void PM_ClientMovement_Unstick()
-{
+{SELFPARAM();
        float i;
        for (i = 0; i < unstick_count; i++)
        {
@@ -237,7 +237,7 @@ void PM_ClientMovement_Unstick()
 }
 
 void PM_ClientMovement_UpdateStatus(bool ground)
-{
+{SELFPARAM();
        // make sure player is not stuck
        PM_ClientMovement_Unstick();
 
@@ -308,7 +308,7 @@ void PM_ClientMovement_UpdateStatus(bool ground)
 }
 
 void PM_ClientMovement_Move()
-{
+{SELFPARAM();
 #ifdef CSQC
        int bump;
        float t;
@@ -397,7 +397,7 @@ void PM_ClientMovement_Move()
 }
 
 void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
-{
+{SELFPARAM();
        float k = 32 * (2 * IsMoveInDirection(self.movement, 0) - 1);
        if (k <= 0)
                return;
@@ -434,7 +434,7 @@ float AdjustAirAccelQW(float accelqw, float factor)
 //   prvm_globalset server speedclamp_mode 1
 //     (or 2)
 void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float stretchfactor, float sidefric, float speedlimit)
-{
+{SELFPARAM();
        float speedclamp = stretchfactor > 0 ? stretchfactor
        : accelqw < 0 ? 1 // full clamping, no stretch
        : -1; // no clamping
@@ -498,7 +498,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
 }
 
 void PM_AirAccelerate(vector wishdir, float wishspeed)
-{
+{SELFPARAM();
        if (wishspeed == 0)
                return;
 
@@ -541,7 +541,7 @@ returns true if handled
 =============
 */
 bool PlayerJump (void)
-{
+{SELFPARAM();
        if (PHYS_FROZEN(self))
                return true; // no jumping in freezetag when frozen
 
@@ -657,7 +657,7 @@ bool PlayerJump (void)
 }
 
 void CheckWaterJump()
-{
+{SELFPARAM();
 // check for a jump-out-of-water
        makevectors(self.v_angle);
        vector start = self.origin;
@@ -697,7 +697,7 @@ void CheckWaterJump()
 // Hack: shouldn't need to know about this
 .float multijump_count;
 void CheckPlayerJump()
-{
+{SELFPARAM();
 #ifdef SVQC
        float was_flying = ITEMS_STAT(self) & IT_USING_JETPACK;
 #endif
@@ -757,7 +757,7 @@ float racecar_angle(float forward, float down)
 }
 
 void RaceCarPhysics()
-{
+{SELFPARAM();
 #ifdef SVQC
        // using this move type for "big rigs"
        // the engine does not push the entity!
@@ -977,7 +977,7 @@ void SpecialCommand()
 }
 
 void PM_check_race_movetime(void)
-{
+{SELFPARAM();
 #ifdef SVQC
        self.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
        float f = floor(self.race_movetime_frac);
@@ -988,7 +988,7 @@ void PM_check_race_movetime(void)
 }
 
 float PM_check_specialcommand(float buttons)
-{
+{SELFPARAM();
 #ifdef SVQC
        string c;
        if (!buttons)
@@ -1025,7 +1025,7 @@ float PM_check_specialcommand(float buttons)
 }
 
 void PM_check_nickspam(void)
-{
+{SELFPARAM();
 #ifdef SVQC
        if (time >= self.nickspamtime)
                return;
@@ -1047,7 +1047,7 @@ void PM_check_nickspam(void)
 }
 
 void PM_check_punch()
-{
+{SELFPARAM();
 #ifdef SVQC
        if (self.punchangle != '0 0 0')
        {
@@ -1070,7 +1070,7 @@ void PM_check_punch()
 }
 
 void PM_check_spider(void)
-{
+{SELFPARAM();
 #ifdef SVQC
        if (time >= self.spider_slowness)
                return;
@@ -1083,7 +1083,7 @@ void PM_check_spider(void)
 
 // predict frozen movement, as frozen players CAN move in some cases
 void PM_check_frozen(void)
-{
+{SELFPARAM();
        if (!PHYS_FROZEN(self))
                return;
        if (PHYS_DODGING_FROZEN
@@ -1110,7 +1110,7 @@ void PM_check_frozen(void)
 }
 
 void PM_check_hitground()
-{
+{SELFPARAM();
 #ifdef SVQC
        if (IS_ONGROUND(self))
        if (IS_PLAYER(self)) // no fall sounds for observers thank you very much
@@ -1137,7 +1137,7 @@ void PM_check_hitground()
 }
 
 void PM_check_blocked(void)
-{
+{SELFPARAM();
 #ifdef SVQC
        if (!self.player_blocked)
                return;
@@ -1151,7 +1151,7 @@ float speedaward_lastsent;
 float speedaward_lastupdate;
 #endif
 void PM_check_race(void)
-{
+{SELFPARAM();
 #ifdef SVQC
        if(!(g_cts || g_race))
                return;
@@ -1181,7 +1181,7 @@ void PM_check_race(void)
 }
 
 void PM_check_vortex(void)
-{
+{SELFPARAM();
 #ifdef SVQC
        // WEAPONTODO
        float xyspeed = vlen(vec2(self.velocity));
@@ -1197,7 +1197,7 @@ void PM_check_vortex(void)
 }
 
 void PM_fly(float maxspd_mod)
-{
+{SELFPARAM();
        // noclipping or flying
        UNSET_ONGROUND(self);
 
@@ -1218,7 +1218,7 @@ void PM_fly(float maxspd_mod)
 }
 
 void PM_swim(float maxspd_mod)
-{
+{SELFPARAM();
        // swimming
        UNSET_ONGROUND(self);
 
@@ -1301,7 +1301,7 @@ void PM_swim(float maxspd_mod)
 }
 
 void PM_ladder(float maxspd_mod)
-{
+{SELFPARAM();
        // on a spawnfunc_func_ladder or swimming in spawnfunc_func_water
        UNSET_ONGROUND(self);
 
@@ -1354,7 +1354,7 @@ void PM_ladder(float maxspd_mod)
 }
 
 void PM_jetpack(float maxspd_mod)
-{
+{SELFPARAM();
        //makevectors(self.v_angle.y * '0 1 0');
        makevectors(self.v_angle);
        vector wishvel = v_forward * self.movement_x
@@ -1470,7 +1470,7 @@ void PM_jetpack(float maxspd_mod)
 }
 
 void PM_walk(float buttons_prev, float maxspd_mod)
-{
+{SELFPARAM();
        if (!WAS_ONGROUND(self))
        {
 #ifdef SVQC
@@ -1555,7 +1555,7 @@ void PM_walk(float buttons_prev, float maxspd_mod)
 }
 
 void PM_air(float buttons_prev, float maxspd_mod)
-{
+{SELFPARAM();
        makevectors(self.v_angle.y * '0 1 0');
        vector wishvel = v_forward * self.movement.x
                                        + v_right * self.movement.y;
@@ -1641,7 +1641,7 @@ bool IsFlying(entity a)
 }
 
 void PM_Main()
-{
+{SELFPARAM();
        int buttons = PHYS_INPUT_BUTTON_MASK(self);
 #ifdef CSQC
        self.items = getstati(STAT_ITEMS, 0, 24);
@@ -1923,7 +1923,7 @@ void SV_PlayerPhysics(void)
 #elif defined(CSQC)
 void CSQC_ClientMovement_PlayerMove_Frame(void)
 #endif
-{
+{SELFPARAM();
        PM_Main();
 
 #ifdef CSQC
index 9fb2f56c9d7ee322c457dfbd25699f8c61350e02..298043bb573ae1b07e410ea3d3d8bac9c613cb20 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef SVQC
 .float height;
 void func_bobbing_controller_think()
-{
+{SELFPARAM();
        vector v;
        self.nextthink = time + 0.1;
 
@@ -29,7 +29,7 @@ dmg : Do this mutch dmg every .dmgtime intervall when blocked
 dmgtime : See above.
 */
 void spawnfunc_func_bobbing()
-{
+{SELFPARAM();
        entity controller;
        if (self.noise != "")
        {
index b70d8b600938f5e8ac1fc253aad1083310c00806..d705f842fba17a692b59995763c67e517de685fe 100644 (file)
@@ -50,7 +50,7 @@ void func_breakable_damage(entity inflictor, entity attacker, float damage, int
 // - basically func_assault_destructible for general gameplay use
 //
 void LaunchDebris (string debrisname, vector force)
-{
+{SELFPARAM();
        entity dbr = spawn();
        setorigin(dbr, self.absmin
                   + '1 0 0' * random() * (self.absmax.x - self.absmin.x)
@@ -78,7 +78,7 @@ void LaunchDebris (string debrisname, vector force)
 }
 
 void func_breakable_colormod()
-{
+{SELFPARAM();
        float h;
        if (!(self.spawnflags & 2))
                return;
@@ -90,11 +90,11 @@ void func_breakable_colormod()
        else
                self.colormod = '1 1 1';
 
-       CSQCMODEL_AUTOUPDATE();
+       CSQCMODEL_AUTOUPDATE(self);
 }
 
 void func_breakable_look_destroyed()
-{
+{SELFPARAM();
        float floorZ;
 
        if(self.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first
@@ -112,26 +112,26 @@ void func_breakable_look_destroyed()
                self.effects &= ~EF_NODRAW;
        }
 
-       CSQCMODEL_AUTOUPDATE();
+       CSQCMODEL_AUTOUPDATE(self);
 
        self.solid = SOLID_NOT;
 }
 
 void func_breakable_look_restore()
-{
+{SELFPARAM();
        setmodel(self, self.mdl);
        self.effects &= ~EF_NODRAW;
 
        if(self.mdl_dead != "") // only do this if we use mdl_dead, to behave better with misc_follow
                setorigin(self, self.dropped_origin);
 
-       CSQCMODEL_AUTOUPDATE();
+       CSQCMODEL_AUTOUPDATE(self);
 
        self.solid = SOLID_BSP;
 }
 
 void func_breakable_behave_destroyed()
-{
+{SELFPARAM();
        self.health = self.max_health;
        self.takedamage = DAMAGE_NO;
        self.bot_attack = false;
@@ -145,7 +145,7 @@ void func_breakable_behave_destroyed()
 }
 
 void func_breakable_behave_restore()
-{
+{SELFPARAM();
        self.health = self.max_health;
        if(self.sprite)
        {
@@ -166,7 +166,7 @@ void func_breakable_behave_restore()
 }
 
 void func_breakable_init_for_player(entity player)
-{
+{SELFPARAM();
        if (self.noise1 && self.state == 0 && clienttype(player) == CLIENTTYPE_REAL)
        {
                msg_entity = player;
@@ -175,23 +175,24 @@ void func_breakable_init_for_player(entity player)
 }
 
 void func_breakable_destroyed()
-{
+{SELFPARAM();
        func_breakable_look_destroyed();
        func_breakable_behave_destroyed();
 
-       CSQCMODEL_AUTOUPDATE();
+       CSQCMODEL_AUTOUPDATE(self);
 }
 
 void func_breakable_restore()
-{
+{SELFPARAM();
        func_breakable_look_restore();
        func_breakable_behave_restore();
 
-       CSQCMODEL_AUTOUPDATE();
+       CSQCMODEL_AUTOUPDATE(self);
 }
 
 vector debrisforce; // global, set before calling this
-void func_breakable_destroy() {
+void func_breakable_destroy()
+{SELFPARAM();
        float n, i;
        string oldmsg;
 
@@ -227,7 +228,7 @@ void func_breakable_destroy() {
 }
 
 void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
        if(self.state == 1)
                return;
        if(self.spawnflags & DOOR_NOSPLASH)
@@ -253,7 +254,7 @@ void func_breakable_damage(entity inflictor, entity attacker, float damage, int
 }
 
 void func_breakable_reset()
-{
+{SELFPARAM();
        self.team = self.team_saved;
        func_breakable_look_restore();
        if(self.spawnflags & 1)
@@ -261,12 +262,12 @@ void func_breakable_reset()
        else
                func_breakable_behave_restore();
 
-       CSQCMODEL_AUTOUPDATE();
+       CSQCMODEL_AUTOUPDATE(self);
 }
 
 // destructible walls that can be used to trigger target_objective_decrease
 void spawnfunc_func_breakable()
-{
+{SELFPARAM();
        float n, i;
        if(!self.health)
                self.health = 100;
@@ -330,7 +331,7 @@ void spawnfunc_func_breakable()
        self.init_for_player_needed = 1;
        self.init_for_player = func_breakable_init_for_player;
 
-       CSQCMODEL_AUTOINIT();
+       CSQCMODEL_AUTOINIT(self);
 }
 
 // for use in maps with a "model" key set
index bb8875b4221ace9b5bd83c25fac38d3fc3be7b27..228b3f810aa5c3b62b91a8508cbd9a545ddcfcf4 100644 (file)
@@ -5,7 +5,7 @@ void() button_wait;
 void() button_return;
 
 void button_wait()
-{
+{SELFPARAM();
        self.state = STATE_TOP;
        self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
        self.SUB_THINK = button_return;
@@ -15,12 +15,12 @@ void button_wait()
 }
 
 void button_done()
-{
+{SELFPARAM();
        self.state = STATE_BOTTOM;
 }
 
 void button_return()
-{
+{SELFPARAM();
        self.state = STATE_DOWN;
        SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, button_done);
        self.frame = 0;                 // use normal textures
@@ -36,7 +36,7 @@ void button_blocked()
 
 
 void button_fire()
-{
+{SELFPARAM();
        self.health = self.max_health;
        self.takedamage = DAMAGE_NO;    // will be reset upon return
 
@@ -51,7 +51,7 @@ void button_fire()
 }
 
 void button_reset()
-{
+{SELFPARAM();
        self.health = self.max_health;
        setorigin(self, self.pos1);
        self.frame = 0;                 // use normal textures
@@ -61,7 +61,7 @@ void button_reset()
 }
 
 void button_use()
-{
+{SELFPARAM();
        if(self.active != ACTIVE_ACTIVE)
                return;
 
@@ -70,7 +70,7 @@ void button_use()
 }
 
 void button_touch()
-{
+{SELFPARAM();
        if (!other)
                return;
        if (!other.iscreature)
@@ -84,7 +84,7 @@ void button_touch()
 }
 
 void button_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
        if(self.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
@@ -113,7 +113,7 @@ When a button is touched, it moves some distance in the direction of it's angle,
 3) in-out
 */
 void spawnfunc_func_button()
-{
+{SELFPARAM();
        SetMovedir ();
 
        if (!InitMovingBrushTrigger())
index 6ed01b0c59c91f7e47ee88f45b97b2d47e91de7a..4f5a7d6ea591f50b5ffbbf9bca9a3cb6874874a1 100644 (file)
@@ -1,5 +1,5 @@
 void conveyor_think()
-{
+{SELFPARAM();
 #ifdef CSQC
        // TODO: check if this is what is causing the glitchiness when switching between them
        float dt = time - self.move_time;
@@ -57,21 +57,21 @@ void conveyor_think()
 #ifdef SVQC
 
 void conveyor_use()
-{
+{SELFPARAM();
        self.state = !self.state;
 
        self.SendFlags |= 2;
 }
 
 void conveyor_reset()
-{
+{SELFPARAM();
        self.state = (self.spawnflags & 1);
 
        self.SendFlags |= 2;
 }
 
 bool conveyor_send(entity to, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_CONVEYOR);
        WriteByte(MSG_ENTITY, sf);
 
@@ -107,7 +107,7 @@ bool conveyor_send(entity to, int sf)
 }
 
 void conveyor_init()
-{
+{SELFPARAM();
        if (!self.speed)
                self.speed = 200;
        self.movedir = self.movedir * self.speed;
@@ -137,7 +137,7 @@ void spawnfunc_trigger_conveyor()
 }
 
 void spawnfunc_func_conveyor()
-{
+{SELFPARAM();
        SetMovedir();
        InitMovingBrushTrigger();
        self.movetype = MOVETYPE_NONE;
@@ -147,7 +147,7 @@ void spawnfunc_func_conveyor()
 #elif defined(CSQC)
 
 void conveyor_init()
-{
+{SELFPARAM();
        self.draw = conveyor_think;
        self.drawmask = MASK_NORMAL;
 
@@ -159,7 +159,7 @@ void conveyor_init()
 }
 
 void ent_conveyor()
-{
+{SELFPARAM();
        float sf = ReadByte();
 
        if(sf & 1)
index 4c56815d2ffc3488a089a23c27ab56b26d6176a8..053f0f5f669111264279bd9978756cf276fb92ea 100644 (file)
@@ -26,7 +26,7 @@ void() door_rotating_go_down;
 void() door_rotating_go_up;
 
 void door_blocked()
-{
+{SELFPARAM();
        if((self.spawnflags & 8)
 #ifdef SVQC
                && (other.takedamage != DAMAGE_NO)
@@ -85,7 +85,7 @@ void door_blocked()
 }
 
 void door_hit_top()
-{
+{SELFPARAM();
        if (self.noise1 != "")
                sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = STATE_TOP;
@@ -102,14 +102,14 @@ void door_hit_top()
 }
 
 void door_hit_bottom()
-{
+{SELFPARAM();
        if (self.noise1 != "")
                sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = STATE_BOTTOM;
 }
 
 void door_go_down()
-{
+{SELFPARAM();
        if (self.noise2 != "")
                sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
        if (self.max_health)
@@ -123,7 +123,7 @@ void door_go_down()
 }
 
 void door_go_up()
-{
+{SELFPARAM();
        if (self.state == STATE_UP)
                return;         // already going up
 
@@ -155,7 +155,7 @@ ACTIVATION FUNCTIONS
 */
 
 float door_check_keys(void)
-{
+{SELFPARAM();
        local entity door;
 
 
@@ -212,15 +212,12 @@ float door_check_keys(void)
 }
 
 void door_fire()
-{
-       entity  oself;
+{SELFPARAM();
        entity  starte;
 
        if (self.owner != self)
                objerror ("door_fire: self.owner != self");
 
-       oself = self;
-
        if (self.spawnflags & DOOR_TOGGLE)
        {
                if (self.state == STATE_UP || self.state == STATE_TOP)
@@ -236,9 +233,9 @@ void door_fire()
                                {
                                        door_rotating_go_down ();
                                }
-                               self = self.enemy;
+                               setself(self.enemy);
                        } while ( (self != starte) && (self != world) );
-                       self = oself;
+                       setself(this);
                        return;
                }
        }
@@ -265,29 +262,23 @@ void door_fire()
                                door_rotating_go_up ();
                        }
                }
-               self = self.enemy;
+               setself(self.enemy);
        } while ( (self != starte) && (self != world) );
-       self = oself;
+       setself(this);
 }
 
 void door_use()
-{
-       entity oself;
-
+{SELFPARAM();
        //dprint("door_use (model: ");dprint(self.model);dprint(")\n");
 
        if (self.owner)
        {
-               oself = self;
-               self = self.owner;
-               door_fire ();
-               self = oself;
+               WITH(entity, self, self.owner, door_fire());
        }
 }
 
 void door_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
-       entity oself;
+{SELFPARAM();
        if(self.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
@@ -301,12 +292,9 @@ void door_damage(entity inflictor, entity attacker, float damage, int deathtype,
 
        if (self.health <= 0)
        {
-               oself = self;
-               self = self.owner;
-               self.health = self.max_health;
-               self.takedamage = DAMAGE_NO;    // wil be reset upon return
-               door_use ();
-               self = oself;
+               self.owner.health = self.owner.max_health;
+               self.owner.takedamage = DAMAGE_NO;      // wil be reset upon return
+               WITH(entity, self, self.owner, door_use());
        }
 }
 
@@ -320,7 +308,7 @@ Prints messages
 */
 
 void door_touch()
-{
+{SELFPARAM();
        if (!IS_PLAYER(other))
                return;
        if (self.owner.attack_finished_single > time)
@@ -339,7 +327,7 @@ void door_touch()
 }
 
 void door_generic_plat_blocked()
-{
+{SELFPARAM();
 
        if((self.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
 #ifdef SVQC
@@ -377,7 +365,7 @@ void door_generic_plat_blocked()
 }
 
 void door_rotating_hit_top()
-{
+{SELFPARAM();
        if (self.noise1 != "")
                sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = STATE_TOP;
@@ -388,7 +376,7 @@ void door_rotating_hit_top()
 }
 
 void door_rotating_hit_bottom()
-{
+{SELFPARAM();
        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
@@ -400,7 +388,7 @@ void door_rotating_hit_bottom()
 }
 
 void door_rotating_go_down()
-{
+{SELFPARAM();
        if (self.noise2 != "")
                sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
        if (self.max_health)
@@ -414,7 +402,7 @@ void door_rotating_go_down()
 }
 
 void door_rotating_go_up()
-{
+{SELFPARAM();
        if (self.state == STATE_UP)
                return;         // already going up
 
@@ -445,7 +433,7 @@ Spawned if a door lacks a real activator
 */
 
 void door_trigger_touch()
-{
+{SELFPARAM();
        if (other.health < 1)
 #ifdef SVQC
                if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !PHYS_DEAD(other)))
@@ -465,12 +453,12 @@ void door_trigger_touch()
 
        activator = other;
 
-       self = self.owner;
+       setself(self.owner);
        door_use ();
 }
 
 void spawn_field(vector fmins, vector fmaxs)
-{
+{SELFPARAM();
        entity  trigger;
        vector  t1 = fmins, t2 = fmaxs;
 
@@ -500,7 +488,7 @@ LinkDoors
 */
 
 entity LinkDoors_nextent(entity cur, entity near, entity pass)
-{
+{SELFPARAM();
        while((cur = find(cur, classname, self.classname)) && ((cur.spawnflags & 4) || cur.enemy))
        {
        }
@@ -524,7 +512,7 @@ bool LinkDoors_isconnected(entity e1, entity e2, entity pass)
 void door_link();
 #endif
 void LinkDoors()
-{
+{SELFPARAM();
        entity  t;
        vector  cmins, cmaxs;
 
@@ -647,7 +635,7 @@ FIXME: only one sound set available at the time being
 */
 
 float door_send(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_DOOR);
        WriteByte(MSG_ENTITY, sf);
 
@@ -709,7 +697,7 @@ void door_link()
 #endif
 
 void door_init_startopen()
-{
+{SELFPARAM();
        SUB_SETORIGIN(self, self.pos2);
        self.pos2 = self.pos1;
        self.pos1 = self.origin;
@@ -720,7 +708,7 @@ void door_init_startopen()
 }
 
 void door_reset()
-{
+{SELFPARAM();
        SUB_SETORIGIN(self, self.pos1);
        self.SUB_VELOCITY = '0 0 0';
        self.state = STATE_BOTTOM;
@@ -736,7 +724,7 @@ void door_reset()
 
 // spawnflags require key (for now only func_door)
 void spawnfunc_func_door()
-{
+{SELFPARAM();
        // Quake 1 keys compatibility
        if (self.spawnflags & SPAWNFLAGS_GOLD_KEY)
                self.itemkeys |= ITEM_KEY_BIT(0);
@@ -815,7 +803,7 @@ void door_draw()
 }
 
 void ent_door()
-{
+{SELFPARAM();
        float sf = ReadByte();
 
        if(sf & SF_TRIGGER_INIT)
index bdf05a00936b48e2fe3c12d8b5c8f54c29c25094..fbe579c1361805da9d34027a20040c9df64f59aa 100644 (file)
@@ -28,7 +28,7 @@ FIXME: only one sound set available at the time being
 */
 
 void door_rotating_reset()
-{
+{SELFPARAM();
        self.angles = self.pos1;
        self.avelocity = '0 0 0';
        self.state = STATE_BOTTOM;
@@ -37,7 +37,7 @@ void door_rotating_reset()
 }
 
 void door_rotating_init_startopen()
-{
+{SELFPARAM();
        self.angles = self.movedir;
        self.pos2 = '0 0 0';
        self.pos1 = self.movedir;
@@ -45,7 +45,7 @@ void door_rotating_init_startopen()
 
 
 void spawnfunc_func_door_rotating()
-{
+{SELFPARAM();
 
        //if (!self.deathtype) // map makers can override this
        //      self.deathtype = " got in the way";
index a0a44bbb92d417dcad7a46b4f63c9bf4475bbc9f..b793228784822068ec579e1b29924c95c5c5a789 100644 (file)
@@ -14,7 +14,7 @@ const float SECRET_NO_SHOOT = 8;              // only opened by trigger
 const float SECRET_YES_SHOOT = 16;     // shootable even if targeted
 
 void fd_secret_use()
-{
+{SELFPARAM();
        float temp;
        string message_save;
 
@@ -70,7 +70,7 @@ void fd_secret_damage(entity inflictor, entity attacker, float damage, int death
 
 // Wait after first movement...
 void fd_secret_move1()
-{
+{SELFPARAM();
        self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
        self.think = fd_secret_move2;
        if (self.noise3 != "")
@@ -79,7 +79,7 @@ void fd_secret_move1()
 
 // Start moving sideways w/sound...
 void fd_secret_move2()
-{
+{SELFPARAM();
        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);
@@ -87,7 +87,7 @@ void fd_secret_move2()
 
 // Wait here until time to go back...
 void fd_secret_move3()
-{
+{SELFPARAM();
        if (self.noise3 != "")
                sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
        if (!(self.spawnflags & SECRET_OPEN_ONCE))
@@ -99,7 +99,7 @@ void fd_secret_move3()
 
 // Move backward...
 void fd_secret_move4()
-{
+{SELFPARAM();
        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);
@@ -107,7 +107,7 @@ void fd_secret_move4()
 
 // Wait 1 second...
 void fd_secret_move5()
-{
+{SELFPARAM();
        self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
        self.think = fd_secret_move6;
        if (self.noise3 != "")
@@ -115,14 +115,14 @@ void fd_secret_move5()
 }
 
 void fd_secret_move6()
-{
+{SELFPARAM();
        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();
        if (self.spawnflags&SECRET_YES_SHOOT)
        {
                self.health = 10000;
@@ -134,7 +134,7 @@ void fd_secret_done()
 }
 
 void secret_blocked()
-{
+{SELFPARAM();
        if (time < self.attack_finished_single)
                return;
        self.attack_finished_single = time + 0.5;
@@ -149,7 +149,7 @@ Prints messages
 ================
 */
 void secret_touch()
-{
+{SELFPARAM();
        if (!other.iscreature)
                return;
        if (self.attack_finished_single > time)
@@ -166,7 +166,7 @@ void secret_touch()
 }
 
 void secret_reset()
-{
+{SELFPARAM();
        if (self.spawnflags&SECRET_YES_SHOOT)
        {
                self.health = 10000;
@@ -195,7 +195,7 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
 */
 
 void spawnfunc_func_door_secret()
-{
+{SELFPARAM();
        /*if (!self.deathtype) // map makers can override this
                self.deathtype = " got in the way";*/
 
index 19dceef25307b68d623ee388fd255cb21401fb35..552fffe5a11deae6142a74b2e82a71bd0a4fe72c 100644 (file)
@@ -11,7 +11,7 @@ dmgtime: See above.
 */
 
 void func_fourier_controller_think()
-{
+{SELFPARAM();
        vector v;
        float n, i, t;
 
@@ -40,7 +40,7 @@ void func_fourier_controller_think()
 }
 
 void spawnfunc_func_fourier()
-{
+{SELFPARAM();
        entity controller;
        if (self.noise != "")
        {
index 5a96b9bb6e68f05f02162e3f2a64e353946064f2..fc3d47210e7e3c76d4d43b42e50da36202d7484b 100644 (file)
@@ -1,5 +1,5 @@
 void func_ladder_touch()
-{
+{SELFPARAM();
 #ifdef SVQC
        if (!other.iscreature)
                return;
@@ -19,7 +19,7 @@ void func_ladder_touch()
 
 #ifdef SVQC
 float func_ladder_send(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
 
        WriteString(MSG_ENTITY, self.classname);
@@ -40,7 +40,7 @@ void func_ladder_link()
 }
 
 void spawnfunc_func_ladder()
-{
+{SELFPARAM();
        self.mdl = self.model;
        EXACTTRIGGER_INIT;
        self.touch = func_ladder_touch;
@@ -49,7 +49,7 @@ void spawnfunc_func_ladder()
 }
 
 void spawnfunc_func_water()
-{
+{SELFPARAM();
        self.mdl = self.model;
        EXACTTRIGGER_INIT;
        self.touch = func_ladder_touch;
@@ -61,7 +61,7 @@ void spawnfunc_func_water()
 .float speed;
 
 void ent_func_ladder()
-{
+{SELFPARAM();
        self.classname = strzone(ReadString());
        self.skin = ReadByte();
        self.speed = ReadByte();
index 7d3eff7c9f474a25b62975a0602e05367039598a..b23541e03a479986afea7255282f5e0290b07103 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef SVQC
 .float freq;
 void func_pendulum_controller_think()
-{
+{SELFPARAM();
        float v;
        self.nextthink = time + 0.1;
 
@@ -22,7 +22,7 @@ void func_pendulum_controller_think()
 }
 
 void spawnfunc_func_pendulum()
-{
+{SELFPARAM();
        entity controller;
        if (self.noise != "")
        {
index d36b1c6a372daa44c8c8f3f970e87b74f6ba83ef..8fc95bf48bd2ebdc0d7ea7a62554ab86cf395c7a 100644 (file)
@@ -8,7 +8,7 @@ void plat_delayedinit()
 }
 
 float plat_send(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT);
        WriteByte(MSG_ENTITY, sf);
 
@@ -60,7 +60,7 @@ void plat_link()
 }
 
 void spawnfunc_func_plat()
-{
+{SELFPARAM();
        if (self.sounds == 0)
                self.sounds = 2;
 
@@ -134,7 +134,7 @@ void plat_draw()
 }
 
 void ent_plat()
-{
+{SELFPARAM();
        float sf = ReadByte();
 
        if(sf & SF_TRIGGER_INIT)
index 654db0f72ae1ba4cf979572e93718a7a5af7f692..f303ca9f2bfefa88f94cc49d611d88759128fca8 100644 (file)
@@ -6,7 +6,7 @@
 // NOTE: also contains func_sparks
 
 float pointparticles_SendEntity(entity to, float fl)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES);
 
        // optional features to save space
@@ -89,13 +89,13 @@ float pointparticles_SendEntity(entity to, float fl)
 }
 
 void pointparticles_use()
-{
+{SELFPARAM();
        self.state = !self.state;
        self.SendFlags |= 2;
 }
 
 void pointparticles_think()
-{
+{SELFPARAM();
        if(self.origin != self.oldorigin)
        {
                self.SendFlags |= 4;
@@ -105,7 +105,7 @@ void pointparticles_think()
 }
 
 void pointparticles_reset()
-{
+{SELFPARAM();
        if(self.spawnflags & 1)
                self.state = 1;
        else
@@ -113,7 +113,7 @@ void pointparticles_reset()
 }
 
 void spawnfunc_func_pointparticles()
-{
+{SELFPARAM();
        if(self.model != "")
                setmodel(self, self.model);
        if(self.noise != "")
@@ -158,7 +158,7 @@ void spawnfunc_func_pointparticles()
 }
 
 void spawnfunc_func_sparks()
-{
+{SELFPARAM();
        // self.cnt is the amount of sparks that one burst will spawn
        if(self.cnt < 1) {
                self.cnt = 25.0; // nice default value
@@ -184,7 +184,7 @@ void spawnfunc_func_sparks()
 #elif defined(CSQC)
 
 void Draw_PointParticles()
-{
+{SELFPARAM();
        float n, i, fail;
        vector p;
        vector sz;
@@ -244,7 +244,7 @@ void Draw_PointParticles()
 }
 
 void Ent_PointParticles_Remove()
-{
+{SELFPARAM();
        if(self.noise)
                strunzone(self.noise);
        self.noise = string_null;
@@ -254,7 +254,7 @@ void Ent_PointParticles_Remove()
 }
 
 void Ent_PointParticles()
-{
+{SELFPARAM();
        float i;
        vector v;
        int f = ReadByte();
index deb5ee58bfd94e3598ffad20c21444111e6dfe7b..8c00f9ce21fc2c8c828fdee03e66370fd22b1cdb 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 float rainsnow_SendEntity(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
        WriteByte(MSG_ENTITY, self.state);
        WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x);
@@ -27,7 +27,7 @@ Keys:
  adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
 */
 void spawnfunc_func_rain()
-{
+{SELFPARAM();
        self.dest = self.velocity;
        self.velocity = '0 0 0';
        if (!self.dest)
@@ -65,7 +65,7 @@ Keys:
  adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
 */
 void spawnfunc_func_snow()
-{
+{SELFPARAM();
        self.dest = self.velocity;
        self.velocity = '0 0 0';
        if (!self.dest)
@@ -91,17 +91,17 @@ void spawnfunc_func_snow()
 }
 #elif defined(CSQC)
 void Draw_Rain()
-{
+{SELFPARAM();
     te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
 }
 
 void Draw_Snow()
-{
+{SELFPARAM();
     te_particlesnow(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
 }
 
 void Ent_RainOrSnow()
-{
+{SELFPARAM();
        self.impulse = ReadByte(); // Rain, Snow, or Whatever
        self.origin_x = ReadCoord();
        self.origin_y = ReadCoord();
index 93d4a30cedaa14ee2de8078890f9e29a8cc025d3..2e3c7851a8f9090f926aa4d0cdc804e479d0a4b6 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 void func_rotating_setactive(float astate)
-{
+{SELFPARAM();
 
        if (astate == ACTIVE_TOGGLE)
        {
@@ -27,7 +27,7 @@ dmgtime : See above.
 */
 
 void spawnfunc_func_rotating()
-{
+{SELFPARAM();
        if (self.noise != "")
        {
                precache_sound(self.noise);
index 30c406f61e46d94f10640757ab691d351128ff2f..0c329cdb273eeb0e8166d41c36032ff436c774e0 100644 (file)
@@ -1,8 +1,8 @@
 #ifdef SVQC
 void spawnfunc_func_stardust()
-{
+{SELFPARAM();
        self.effects = EF_STARDUST;
 
-       CSQCMODEL_AUTOINIT();
+       CSQCMODEL_AUTOINIT(self);
 }
 #endif
index 0de3489381fa2dba5b27b8b6f58fed55f44a1f55..6469d17e6045b5d87d9a225b7db4cc83d894c0c6 100644 (file)
@@ -1,12 +1,8 @@
 .float train_wait_turning;
 void() train_next;
 void train_wait()
-{
-       entity oldself;
-       oldself = self;
-       self = self.enemy;
-       SUB_UseTargets();
-       self = oldself;
+{SELFPARAM();
+       WITH(entity, self, self.enemy, SUB_UseTargets());
        self.enemy = world;
 
        // if turning is enabled, the train will turn toward the next point while waiting
@@ -53,7 +49,7 @@ void train_wait()
 }
 
 void train_next()
-{
+{SELFPARAM();
        entity targ, cp = world;
        vector cp_org = '0 0 0';
 
@@ -107,7 +103,7 @@ void train_next()
 
 #ifdef SVQC
 float train_send(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_TRAIN);
        WriteByte(MSG_ENTITY, sf);
 
@@ -166,7 +162,7 @@ void train_link()
 }
 
 void func_train_find()
-{
+{SELFPARAM();
        entity targ;
        targ = find(world, targetname, self.target);
        self.target = targ.target;
@@ -188,7 +184,7 @@ target : targetname of first spawnfunc_path_corner (starts here)
 */
 #ifdef SVQC
 void spawnfunc_func_train()
-{
+{SELFPARAM();
        if (self.noise != "")
                precache_sound(self.noise);
 
@@ -236,7 +232,7 @@ void train_draw()
 }
 
 void ent_train()
-{
+{SELFPARAM();
        float sf = ReadByte();
 
        if(sf & SF_TRIGGER_INIT)
index 521ac8780e73300df8099ee7208b8e8035296690..32355004bed1d33ba21648cbf62f2196ecaa0d99 100644 (file)
@@ -58,7 +58,7 @@ vector func_vectormamamam_origin(entity o, float t)
 }
 
 void func_vectormamamam_controller_think()
-{
+{SELFPARAM();
        self.nextthink = time + 0.1;
 
        if(self.owner.active != ACTIVE_ACTIVE)
@@ -72,7 +72,7 @@ void func_vectormamamam_controller_think()
 }
 
 void func_vectormamamam_findtarget()
-{
+{SELFPARAM();
        if(self.target != "")
                self.wp00 = find(world, targetname, self.target);
 
@@ -99,7 +99,7 @@ void func_vectormamamam_findtarget()
 }
 
 void spawnfunc_func_vectormamamam()
-{
+{SELFPARAM();
        if (self.noise != "")
        {
                precache_sound(self.noise);
index 4294eac2aad6f2f577e5a46cb63d2548557b5f6d..390fd2c79c2949871b0e66a6b1aed731b098e922 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 bool corner_send(entity to, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_CORNER);
 
        WriteString(MSG_ENTITY, self.platmovetype);
@@ -27,7 +27,7 @@ void corner_link()
 }
 
 void spawnfunc_path_corner()
-{
+{SELFPARAM();
        // setup values for overriding train movement
        // if a second value does not exist, both start and end speeds are the single value specified
        set_platmovetype(self, self.platmovetype);
@@ -37,7 +37,7 @@ void spawnfunc_path_corner()
 #elif defined(CSQC)
 
 void corner_remove()
-{
+{SELFPARAM();
        if(self.target) { strunzone(self.target); }
        self.target = string_null;
 
@@ -58,7 +58,7 @@ void corner_remove()
 }
 
 void ent_corner()
-{
+{SELFPARAM();
        self.platmovetype = strzone(ReadString());
 
        self.origin_x = ReadCoord();
index bfeb865c1df47187ecd458688c297af5da7a3a28..02c9dcc277c740dd41852ce16d69338cce7bd161 100644 (file)
@@ -2,7 +2,7 @@
 
 #ifdef SVQC
 void follow_init()
-{
+{SELFPARAM();
        entity src, dst;
        src = world;
        dst = world;
@@ -63,7 +63,7 @@ void follow_init()
 }
 
 void spawnfunc_misc_follow()
-{
+{SELFPARAM();
        InitializeEntity(self, follow_init, INITPRIO_FINDTARGET);
 }
 #endif
index a7fb07815356973eee23bdee3c88a0878f312434..52d2caf65aada325c89e45404952dc4dde407b90 100644 (file)
@@ -11,7 +11,7 @@
 #ifdef SVQC
 .float modelscale;
 void misc_laser_aim()
-{
+{SELFPARAM();
        vector a;
        if(self.enemy)
        {
@@ -50,16 +50,15 @@ void misc_laser_aim()
 }
 
 void misc_laser_init()
-{
+{SELFPARAM();
        if(self.target != "")
                self.enemy = find(world, targetname, self.target);
 }
 
 .entity pusher;
 void misc_laser_think()
-{
+{SELFPARAM();
        vector o;
-       entity oldself;
        entity hitent;
        vector hitloc;
 
@@ -98,11 +97,8 @@ void misc_laser_think()
                        {
                                self.count = 1;
 
-                               oldself = self;
-                               self = self.enemy;
-                               activator = self.pusher;
-                               SUB_UseTargets();
-                               self = oldself;
+                               activator = self.enemy.pusher;
+                               WITH(entity, self, self.enemy, SUB_UseTargets());
                        }
                }
                else
@@ -111,11 +107,8 @@ void misc_laser_think()
                        {
                                self.count = 0;
 
-                               oldself = self;
-                               self = self.enemy;
-                               activator = self.pusher;
-                               SUB_UseTargets();
-                               self = oldself;
+                               activator = self.enemy.pusher;
+                               WITH(entity, self, self.enemy, SUB_UseTargets());
                        }
                }
        }
@@ -131,7 +124,7 @@ void misc_laser_think()
 }
 
 float laser_SendEntity(entity to, float fl)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_LASER);
        fl = fl - (fl & 0xF0); // use that bit to indicate finite length laser
        if(self.spawnflags & 2)
@@ -196,14 +189,14 @@ Keys:
  damage per second (-1 for a laser that kills immediately)
 */
 void laser_use()
-{
+{SELFPARAM();
        self.state = !self.state;
        self.SendFlags |= 4;
        misc_laser_aim();
 }
 
 void laser_reset()
-{
+{SELFPARAM();
        if(self.spawnflags & 1)
                self.state = 1;
        else
@@ -211,7 +204,7 @@ void laser_reset()
 }
 
 void spawnfunc_misc_laser()
-{
+{SELFPARAM();
        if(self.mdl)
        {
                if(self.mdl == "none")
@@ -280,7 +273,7 @@ class(Laser) .float scale; // scaling factor of the thickness
 class(Laser) .float modelscale; // scaling factor of the dlight
 
 void Draw_Laser()
-{
+{SELFPARAM();
        if(!self.state)
                return;
        InterpolateOrigin_Do();
@@ -331,7 +324,7 @@ void Draw_Laser()
 }
 
 void Ent_Laser()
-{
+{SELFPARAM();
        InterpolateOrigin_Undo();
 
        // 30 bytes, or 13 bytes for just moving
index b80ce827d7dbf54da3b263764fbe1748e12747e4..a3c9783537bb9632d691def050eeedb8bf8fa220 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef SVQC
 
 void spawnfunc_info_teleport_destination (void)
-{
+{SELFPARAM();
        self.classname = "info_teleport_destination";
 
        self.mangle = self.angles;
index b837d7c5a8788c43d36d019e08919dfe4d9966e4..b4f387470c64bea1c3e1e47fd17dbab141293e7d 100644 (file)
@@ -1,5 +1,5 @@
 void generic_plat_blocked()
-{
+{SELFPARAM();
 #ifdef SVQC
        if(self.dmg && other.takedamage != DAMAGE_NO)
        {
@@ -17,7 +17,7 @@ void generic_plat_blocked()
 }
 
 void plat_spawn_inside_trigger()
-{
+{SELFPARAM();
        entity trigger;
        vector tmin, tmax;
 
@@ -64,7 +64,7 @@ void plat_spawn_inside_trigger()
 }
 
 void plat_hit_top()
-{
+{SELFPARAM();
        sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = 1;
 
@@ -73,27 +73,27 @@ void plat_hit_top()
 }
 
 void plat_hit_bottom()
-{
+{SELFPARAM();
        sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
        self.state = 2;
 }
 
 void plat_go_down()
-{
+{SELFPARAM();
        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);
 }
 
 void plat_go_up()
-{
+{SELFPARAM();
        sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
        self.state = 4;
        SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
 }
 
 void plat_center_touch()
-{
+{SELFPARAM();
 #ifdef SVQC
        if (!other.iscreature)
                return;
@@ -107,7 +107,7 @@ void plat_center_touch()
                return;
 #endif
 
-       self = self.enemy;
+       setself(self.enemy);
        if (self.state == 2)
                plat_go_up ();
        else if (self.state == 1)
@@ -115,7 +115,7 @@ void plat_center_touch()
 }
 
 void plat_outside_touch()
-{
+{SELFPARAM();
 #ifdef SVQC
        if (!other.iscreature)
                return;
@@ -127,13 +127,13 @@ void plat_outside_touch()
                return;
 #endif
 
-       self = self.enemy;
+       setself(self.enemy);
        if (self.state == 1)
                plat_go_down ();
 }
 
 void plat_trigger_use()
-{
+{SELFPARAM();
 #ifdef SVQC
        if (self.think)
                return;         // already activated
@@ -146,7 +146,7 @@ void plat_trigger_use()
 
 
 void plat_crush()
-{
+{SELFPARAM();
        if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
        { // KIll Kill Kill!!
 #ifdef SVQC
@@ -176,7 +176,7 @@ void plat_crush()
 }
 
 void plat_use()
-{
+{SELFPARAM();
        self.use = func_null;
        if (self.state != 4)
                objerror ("plat_use: not in up state");
@@ -186,7 +186,7 @@ void plat_use()
 .string sound1, sound2;
 
 void plat_reset()
-{
+{SELFPARAM();
        IFTARGETED
        {
                setorigin (self, self.pos1);
index fa7c1c5e451b28f67a41eab1068c8d8c49cfa35f..b313c49996046e1dec57d08169a891a44fdff6c9 100644 (file)
@@ -13,7 +13,7 @@ Applies some friction to self
 */
 .float friction;
 void SUB_Friction (void)
-{
+{SELFPARAM();
        self.SUB_NEXTTHINK = time;
        if(self.SUB_FLAGS & FL_ONGROUND)
                self.SUB_VELOCITY = self.SUB_VELOCITY * (1 - frametime * self.friction);
@@ -46,7 +46,7 @@ void SUB_VanishOrRemove (entity ent)
 }
 
 void SUB_SetFade_Think (void)
-{
+{SELFPARAM();
        if(self.alpha == 0)
                self.alpha = 1;
        self.SUB_THINK = SUB_SetFade_Think;
@@ -81,7 +81,7 @@ self.SUB_ORIGIN traveling at speed
 ===============
 */
 void SUB_CalcMoveDone (void)
-{
+{SELFPARAM();
        // After moving, set origin to exact final destination
 
        SUB_SETORIGIN (self, self.finaldest);
@@ -93,7 +93,7 @@ void SUB_CalcMoveDone (void)
 
 .float platmovetype_turn;
 void SUB_CalcMove_controller_think (void)
-{
+{SELFPARAM();
        entity oldself;
        float traveltime;
        float phasepos;
@@ -144,7 +144,7 @@ void SUB_CalcMove_controller_think (void)
                // derivative: delta + 2 * delta2 (e.g. for angle positioning)
                oldself = self;
                self.owner.SUB_THINK = self.think1;
-               self = self.owner;
+               setself(self.owner);
                remove(oldself);
                self.SUB_THINK();
        }
@@ -185,7 +185,7 @@ float TSPEED_END = 2;
 // TODO average too?
 
 void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func)
-{
+{SELFPARAM();
        float   traveltime;
        entity controller;
 
@@ -238,13 +238,13 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float
        self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
 
        // invoke controller
-       self = controller;
+       setself(controller);
        self.think();
-       self = self.owner;
+       setself(self.owner);
 }
 
 void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
-{
+{SELFPARAM();
        vector  delta;
        float   traveltime;
 
@@ -293,15 +293,8 @@ void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
 }
 
 void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
-{
-       entity  oldself;
-
-       oldself = self;
-       self = ent;
-
-       SUB_CalcMove (tdest, tspeedtype, tspeed, func);
-
-       self = oldself;
+{SELFPARAM();
+       WITH(entity, self, ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
 }
 
 /*
@@ -315,7 +308,7 @@ The calling function should make sure self.SUB_THINK is valid
 ===============
 */
 void SUB_CalcAngleMoveDone (void)
-{
+{SELFPARAM();
        // After rotating, set angle to exact final angle
        self.angles = self.finalangle;
        self.SUB_AVELOCITY = '0 0 0';
@@ -326,7 +319,7 @@ void SUB_CalcAngleMoveDone (void)
 
 // FIXME: I fixed this function only for rotation around the main axes
 void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func)
-{
+{SELFPARAM();
        vector  delta;
        float   traveltime;
 
@@ -368,13 +361,6 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void()
 }
 
 void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
-{
-       entity  oldself;
-
-       oldself = self;
-       self = ent;
-
-       SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func);
-
-       self = oldself;
+{SELFPARAM();
+       WITH(entity, self, ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
 }
index ea8ef3057425b28b9e260785a314da659bfbad7a..98491820f215da9636d2ce8cd72e7bbffc2e7aaa 100644 (file)
        #define SUB_FLAGS               move_flags
 
        void SUB_SETORIGIN(entity s, vector v)
-       {
+       {SELFPARAM();
                s.move_origin = v;
-               entity oldself = self;
-               self = s;
-               _Movetype_LinkEdict(true);
-               self = oldself;
+               WITH(entity, self, s, _Movetype_LinkEdict(true));
        }
 
 #endif
index 8e5c31bfea8a43ec01ea5b1ac53c4d0933e8cf0a..8dc694e621e918e8e5a8049736f608f02da3950b 100644 (file)
@@ -4,7 +4,7 @@
 
 
 void spawnfunc_target_changelevel_use()
-{
+{SELFPARAM();
        if(self.spawnflags & 2)
        {
                // simply don't react if a non-player triggers it
@@ -36,7 +36,7 @@ void spawnfunc_target_changelevel_use()
 }
 
 void spawnfunc_target_changelevel()
-{
+{SELFPARAM();
        self.use = spawnfunc_target_changelevel_use;
 
        if(!self.count) { self.count = 0.7; }
index 1430cabd81ee3364a9998ff3721aca30a7a47627..554032ee60cc7221b129b36e7b880aaca60cc60a 100644 (file)
@@ -1,13 +1,13 @@
 #ifdef SVQC
 void spawnfunc_target_location()
-{
+{SELFPARAM();
     self.classname = "target_location";
     // location name in netname
     // eventually support: count, teamgame selectors, line of sight?
 }
 
 void spawnfunc_info_location()
-{
+{SELFPARAM();
     self.classname = "target_location";
     self.message = self.netname;
 }
index b3a5a24330763d13152eb088cecb0dfd9ff445df..488ed0999b094cbcbeb015452b09d58728d065bb 100644 (file)
@@ -19,7 +19,7 @@
 // when triggered, the music is overridden for activator until lifetime (or forever, if lifetime is 0)
 // when targetname is not set, THIS ONE is default
 void target_music_sendto(float to, float is)
-{
+{SELFPARAM();
        WriteByte(to, SVC_TEMPENTITY);
        WriteByte(to, TE_CSQC_TARGET_MUSIC);
        WriteShort(to, num_for_edict(self));
@@ -30,7 +30,7 @@ void target_music_sendto(float to, float is)
        WriteString(to, self.noise);
 }
 void target_music_reset()
-{
+{SELFPARAM();
        if(self.targetname == "")
                target_music_sendto(MSG_ALL, 1);
 }
@@ -47,7 +47,7 @@ void target_music_use()
        FOR_EACH_SPEC(head) if(head.enemy == activator) { msg_entity = head; target_music_sendto(MSG_ONE, 1); }
 }
 void spawnfunc_target_music()
-{
+{SELFPARAM();
        self.use = target_music_use;
        self.reset = target_music_reset;
        if(!self.volume)
@@ -58,9 +58,10 @@ void spawnfunc_target_music()
                target_music_sendto(MSG_INIT, 0);
 }
 void TargetMusic_RestoreGame()
-{
-       for(self = world; (self = find(self, classname, "target_music")); )
+{SELFPARAM();
+       for(entity e = world; (e = find(e, classname, "target_music")); )
        {
+               setself(e);
                if(self.targetname == "")
                        target_music_sendto(MSG_INIT, 1);
                else
@@ -76,7 +77,7 @@ void TargetMusic_RestoreGame()
 //   1 = START_OFF
 // when triggered, it is disabled/enabled for everyone
 float trigger_music_SendEntity(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC);
        sf &= ~0x80;
        if(self.cnt)
@@ -115,17 +116,17 @@ float trigger_music_SendEntity(entity to, float sf)
        return 1;
 }
 void trigger_music_reset()
-{
+{SELFPARAM();
        self.cnt = !(self.spawnflags & 1);
        self.SendFlags |= 0x80;
 }
 void trigger_music_use()
-{
+{SELFPARAM();
        self.cnt = !self.cnt;
        self.SendFlags |= 0x80;
 }
 void spawnfunc_trigger_music()
-{
+{SELFPARAM();
        if(self.model != "")
                setmodel(self, self.model);
        if(!self.volume)
@@ -255,7 +256,7 @@ void Net_TargetMusic()
 }
 
 void Ent_TriggerMusic_Think()
-{
+{SELFPARAM();
        if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world))
        {
                music_trigger = self;
@@ -264,14 +265,14 @@ void Ent_TriggerMusic_Think()
 }
 
 void Ent_TriggerMusic_Remove()
-{
+{SELFPARAM();
        if(self.noise)
                strunzone(self.noise);
        self.noise = string_null;
 }
 
 void Ent_ReadTriggerMusic()
-{
+{SELFPARAM();
        int f = ReadByte();
        if(f & 4)
        {
index da7aeda71e9c628055b7223b9299eb9ba87d0625..6572221f75a9e008d6c7668e2ff15758a0fb32a7 100644 (file)
@@ -23,22 +23,21 @@ float target_spawn_spawnfunc_field;
 float target_spawn_count;
 
 void target_spawn_helper_setmodel()
-{
+{SELFPARAM();
        setmodel(self, self.model);
 }
 
 void target_spawn_helper_setsize()
-{
+{SELFPARAM();
        setsize(self, self.mins, self.maxs);
 }
 
 void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act)
-{
+{SELFPARAM();
        float i, n, valuefieldpos;
        string key, value, valuefield, valueoffset, valueoffsetrandom;
        entity valueent;
        vector data, data2;
-       entity oldself;
        entity oldactivator;
 
        n = tokenize_console(msg);
@@ -220,15 +219,10 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                                value = strcat("target_spawn_helper", value);
                        putentityfieldstring(target_spawn_spawnfunc_field, e, value);
 
-                       oldself = self;
                        oldactivator = activator;
 
-                       self = e;
                        activator = act;
-
-                       self.target_spawn_spawnfunc();
-
-                       self = oldself;
+                       WITH(entity, self, e, e.target_spawn_spawnfunc());
                        activator = oldactivator;
 
                        // We called an external function, so we have to re-tokenize msg.
@@ -244,7 +238,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
 }
 
 void target_spawn_useon(entity e)
-{
+{SELFPARAM();
        self.target_spawn_activator = activator;
        target_spawn_edit_entity(
                e,
@@ -258,7 +252,7 @@ void target_spawn_useon(entity e)
 }
 
 float target_spawn_cancreate()
-{
+{SELFPARAM();
        float c;
        entity e;
 
@@ -277,7 +271,7 @@ float target_spawn_cancreate()
 }
 
 void target_spawn_use()
-{
+{SELFPARAM();
        entity e;
 
        if(self.target == "")
@@ -304,7 +298,7 @@ void target_spawn_use()
 }
 
 void target_spawn_spawnfirst()
-{
+{SELFPARAM();
        activator = self.target_spawn_activator;
        if(self.spawnflags & 2)
                target_spawn_use();
@@ -339,7 +333,7 @@ void initialize_field_db()
 }
 
 void spawnfunc_target_spawn()
-{
+{SELFPARAM();
        initialize_field_db();
        self.use = target_spawn_use;
        self.message = strzone(strreplace("'", "\"", self.message));
index 7be8b91b4c2920cabe64093d1500ed0360cae748..058ffd52639950f15cdff70fa12586880c6a3661 100644 (file)
@@ -2,7 +2,7 @@
 // TODO add a way to do looped sounds with sound(); then complete this entity
 void target_speaker_use_off();
 void target_speaker_use_activator()
-{
+{SELFPARAM();
        if (!IS_REAL_CLIENT(activator))
                return;
        string snd;
@@ -31,7 +31,7 @@ void target_speaker_use_activator()
        soundto(MSG_ONE, self, CH_TRIGGER, snd, VOL_BASE * self.volume, self.atten);
 }
 void target_speaker_use_on()
-{
+{SELFPARAM();
        string snd;
        if(substring(self.noise, 0, 1) == "*")
        {
@@ -59,12 +59,12 @@ void target_speaker_use_on()
                self.use = target_speaker_use_off;
 }
 void target_speaker_use_off()
-{
+{SELFPARAM();
        sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASE * self.volume, self.atten);
        self.use = target_speaker_use_on;
 }
 void target_speaker_reset()
-{
+{SELFPARAM();
        if(self.spawnflags & 1) // LOOPED_ON
        {
                if(self.use == target_speaker_use_on)
@@ -78,7 +78,7 @@ void target_speaker_reset()
 }
 
 void spawnfunc_target_speaker()
-{
+{SELFPARAM();
        // TODO: "*" prefix to sound file name
        // TODO: wait and random (just, HOW? random is not a field)
        if(self.noise)
index c173d80eefe6867261105b427a509ea850ba2c51..35d84da8df64de4a95e82f2debc9847bec413764 100644 (file)
@@ -10,7 +10,7 @@ void target_voicescript_clear(entity pl)
 }
 
 void target_voicescript_use()
-{
+{SELFPARAM();
        if(activator.voicescript != self)
        {
                activator.voicescript = self;
@@ -74,7 +74,7 @@ void target_voicescript_next(entity pl)
 }
 
 void spawnfunc_target_voicescript()
-{
+{SELFPARAM();
        // netname: directory of the sound files
        // message: list of "sound file" duration "sound file" duration, a *, and again a list
        //          foo1 4.1 foo2 4.0 foo3 -3.1 * fool1 1.1 fool2 7.1 fool3 9.1 fool4 3.7
index 3421311691863f31a23274c4bf73a02fe8af7372..bc4398601920968c61cfd7fd9d25f879569461bc 100644 (file)
@@ -63,7 +63,7 @@ void spawn_tdeath(vector v0, entity e, vector v)
 }
 
 void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
-{
+{SELFPARAM();
        entity telefragger;
        vector from;
 
@@ -179,7 +179,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
 }
 
 void teleport_findtarget (void)
-{
+{SELFPARAM();
        entity e;
        float n;
 
@@ -224,15 +224,12 @@ entity Teleport_Find(vector mi, vector ma)
 }
 
 void WarpZone_PostTeleportPlayer_Callback(entity pl)
-{
+{SELFPARAM();
        makevectors(pl.angles);
        Reset_ArcBeam(pl, v_forward);
        UpdateCSQCProjectileAfterTeleport(pl);
        {
-               entity oldself = self;
-               self = pl;
-               anticheat_fixangle();
-               self = oldself;
+               WITH(entity, self, pl, anticheat_fixangle());
        }
        // "disown" projectiles after teleport
        if(pl.owner)
index bf1d9b2da76f672c4f554ed9d262e3cb1624cbd1..9eb7eb072bb3f2fa61d0048a12c127f8e7c34b2b 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 void counter_use()
-{
+{SELFPARAM();
        self.count -= 1;
        if (self.count < 0)
                return;
@@ -24,7 +24,7 @@ void counter_use()
 }
 
 void counter_reset()
-{
+{SELFPARAM();
        self.count = self.cnt;
        multi_reset();
 }
@@ -37,7 +37,7 @@ If nomessage is not set, t will print "1 more.. " etc when triggered and "sequen
 After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
 */
 void spawnfunc_trigger_counter()
-{
+{SELFPARAM();
        self.wait = -1;
        if (!self.count)
                self.count = 2;
index b01efe3bba0737df4059022ad5390e5ca0866235..a3e08e4d81f9f522a17008b82ee21e1a787c43aa 100644 (file)
@@ -1,18 +1,18 @@
 #ifdef SVQC
 void delay_use()
-{
+{SELFPARAM();
     self.think = SUB_UseTargets;
    self.nextthink = self.wait;
 }
 
 void delay_reset()
-{
+{SELFPARAM();
        self.think = func_null;
        self.nextthink = 0;
 }
 
 void spawnfunc_trigger_delay()
-{
+{SELFPARAM();
     if(!self.wait)
         self.wait = 1;
 
index 2a0432c97827790b3a6a0a483f4e86a830a26851..4545df19575afe5e4c17015c7feedc258e1908b7 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 void trigger_disablerelay_use()
-{
+{SELFPARAM();
        entity e;
 
        float a, b;
@@ -25,7 +25,7 @@ void trigger_disablerelay_use()
 }
 
 void spawnfunc_trigger_disablerelay()
-{
+{SELFPARAM();
        self.use = trigger_disablerelay_use;
 }
 #endif
index 12d8a5940a245a7b6f55a11626df815803c1b39c..b5a2eb8b292d2120abe5dfc798ebd0b81b567c04 100644 (file)
@@ -3,14 +3,14 @@
 "Flip-flop" trigger gate... lets only every second trigger event through
 */
 void flipflop_use()
-{
+{SELFPARAM();
     self.state = !self.state;
     if(self.state)
         SUB_UseTargets();
 }
 
 void spawnfunc_trigger_flipflop()
-{
+{SELFPARAM();
     if(self.spawnflags & 1)
         self.state = 1;
     self.use = flipflop_use;
index 3ad419d22fc287388949f7a5c0ba2842a13d4216..1b72780e51c9f5cec6245a8dac5e456856153913 100644 (file)
@@ -1,13 +1,13 @@
 #ifdef SVQC
 void gamestart_use()
-{
+{SELFPARAM();
        activator = self;
        SUB_UseTargets();
        remove(self);
 }
 
 void spawnfunc_trigger_gamestart()
-{
+{SELFPARAM();
        self.use = gamestart_use;
        self.reset2 = spawnfunc_trigger_gamestart;
 
index a709a1f2a7cb22d91a132a20707193baec3ccbaf..659a336901e26665bb0ce56e14e1ee04327a252f 100644 (file)
@@ -13,7 +13,7 @@ void trigger_gravity_remove(entity own)
        own.trigger_gravity_check = world;
 }
 void trigger_gravity_check_think()
-{
+{SELFPARAM();
        // 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.
@@ -33,12 +33,12 @@ void trigger_gravity_check_think()
 }
 
 void trigger_gravity_use()
-{
+{SELFPARAM();
        self.state = !self.state;
 }
 
 void trigger_gravity_touch()
-{
+{SELFPARAM();
        float g;
 
        if(self.state != true)
@@ -86,7 +86,7 @@ void trigger_gravity_touch()
 }
 
 void spawnfunc_trigger_gravity()
-{
+{SELFPARAM();
        if(self.gravity == 1)
                return;
 
index 6d68610b5cf8ddb5afb7c2101a0b3ffacdb83f5b..323a4a160d2fb64cf36523fdfd58f3a624259219 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef SVQC
 .float triggerhealtime;
 void trigger_heal_touch()
-{
+{SELFPARAM();
        if (self.active != ACTIVE_ACTIVE)
                return;
 
@@ -26,7 +26,7 @@ void trigger_heal_touch()
 }
 
 void spawnfunc_trigger_heal()
-{
+{SELFPARAM();
        self.active = ACTIVE_ACTIVE;
 
        EXACTTRIGGER_INIT;
index 3a15a77ff4d4c3ff69fb1813c3d25886378684a6..7a12011931497bb4c141cecb0c7e7f1152aa1c5e 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 void trigger_hurt_use()
-{
+{SELFPARAM();
        if(IS_PLAYER(activator))
                self.enemy = activator;
        else
@@ -9,7 +9,7 @@ void trigger_hurt_use()
 
 .float triggerhurttime;
 void trigger_hurt_touch()
-{
+{SELFPARAM();
        if (self.active != ACTIVE_ACTIVE)
                return;
 
@@ -58,7 +58,7 @@ defalt dmg = 5
 entity trigger_hurt_last;
 entity trigger_hurt_first;
 void spawnfunc_trigger_hurt()
-{
+{SELFPARAM();
        EXACTTRIGGER_INIT;
        self.active = ACTIVE_ACTIVE;
        self.touch = trigger_hurt_touch;
index 7b8ebcfde91e67627c4ca76b6494441d87fc59a5..2b3bb5729a1461dae21a775b71a87f64ae9e0189 100644 (file)
@@ -1,6 +1,6 @@
 // targeted (directional) mode
 void trigger_impulse_touch1()
-{
+{SELFPARAM();
        entity targ;
        float pushdeltatime;
        float str;
@@ -54,7 +54,7 @@ void trigger_impulse_touch1()
 
 // Directionless (accelerator/decelerator) mode
 void trigger_impulse_touch2()
-{
+{SELFPARAM();
        float pushdeltatime;
 
        if (self.active != ACTIVE_ACTIVE)
@@ -79,7 +79,7 @@ void trigger_impulse_touch2()
 
 // Spherical (gravity/repulsor) mode
 void trigger_impulse_touch3()
-{
+{SELFPARAM();
        float pushdeltatime;
        float str;
 
@@ -132,7 +132,7 @@ in directional and sperical mode. For damper/accelerator mode this is not nesses
 */
 #ifdef SVQC
 bool trigger_impulse_send(entity to, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE);
 
        WriteCoord(MSG_ENTITY, self.radius);
@@ -151,7 +151,7 @@ void trigger_impulse_link()
 }
 
 void spawnfunc_trigger_impulse()
-{
+{SELFPARAM();
        self.active = ACTIVE_ACTIVE;
 
        EXACTTRIGGER_INIT;
@@ -181,7 +181,7 @@ void spawnfunc_trigger_impulse()
 }
 #elif defined(CSQC)
 void ent_trigger_impulse()
-{
+{SELFPARAM();
        self.radius = ReadCoord();
        self.strength = ReadCoord();
        self.falloff = ReadByte();
index 47f08d3acb321a0a50a2404d8d0cd2a34c519eb1..5eb25221821def3f73fb5b13d22994f3fb337cd8 100644 (file)
@@ -5,7 +5,7 @@
 #include "../../movetypes/movetypes.qh"
 
 void trigger_push_use()
-{
+{SELFPARAM();
        if(teamplay)
        {
                self.team = activator.team;
@@ -128,7 +128,7 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
 }
 
 void trigger_push_touch()
-{
+{SELFPARAM();
        if (self.active == ACTIVE_NOT)
                return;
 
@@ -218,12 +218,8 @@ void trigger_push_touch()
 
        if(self.enemy.target)
        {
-               entity oldself;
-               oldself = self;
                activator = other;
-               self = self.enemy;
-               SUB_UseTargets();
-               self = oldself;
+               WITH(entity, self, self.enemy, SUB_UseTargets());
        }
 
        if (other.flags & FL_PROJECTILE)
@@ -257,7 +253,7 @@ void trigger_push_link();
 void trigger_push_updatelink();
 #endif
 void trigger_push_findtarget()
-{
+{SELFPARAM();
        entity t;
        vector org;
 
@@ -321,7 +317,7 @@ void trigger_push_findtarget()
 
 #ifdef SVQC
 float trigger_push_send(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
        WriteByte(MSG_ENTITY, sf);
 
@@ -345,7 +341,7 @@ float trigger_push_send(entity to, float sf)
 }
 
 void trigger_push_updatelink()
-{
+{SELFPARAM();
        self.SendFlags |= 1;
 }
 
@@ -368,7 +364,7 @@ void trigger_push_link()
  *   movedir: if target is not set, this * speed * 10 is the velocity to be reached.
  */
 void spawnfunc_trigger_push()
-{
+{SELFPARAM();
        SetMovedir ();
 
        EXACTTRIGGER_INIT;
@@ -392,7 +388,7 @@ void spawnfunc_trigger_push()
 
 
 float target_push_send(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH);
 
        WriteByte(MSG_ENTITY, self.cnt);
@@ -405,7 +401,7 @@ float target_push_send(entity to, float sf)
 }
 
 void target_push_link()
-{
+{SELFPARAM();
        Net_LinkEntity(self, false, 0, target_push_send);
        self.SendFlags |= 1; // update
 }
@@ -419,7 +415,7 @@ void spawnfunc_target_position() { target_push_link(); }
 #ifdef CSQC
 
 void ent_trigger_push()
-{
+{SELFPARAM();
        float sf = ReadByte();
 
        if(sf & 1)
@@ -449,7 +445,7 @@ void ent_trigger_push()
 }
 
 void target_push_remove()
-{
+{SELFPARAM();
        if(self.classname)
                strunzone(self.classname);
        self.classname = string_null;
@@ -460,7 +456,7 @@ void target_push_remove()
 }
 
 void ent_target_push()
-{
+{SELFPARAM();
        self.classname = "push_target";
        self.cnt = ReadByte();
        self.targetname = strzone(ReadString());
index ec27d4b77fb9348363153f8ca81214e4867c695f..17313f0aa85de43dda806660633a4055dcf10a73 100644 (file)
@@ -2,8 +2,7 @@
  * trigger given targets
  */
 void trigger_keylock_trigger(string s)
-{
-       entity stemp = self;
+{SELFPARAM();
        entity otemp = other;
        entity atemp = activator;
 
@@ -11,13 +10,13 @@ void trigger_keylock_trigger(string s)
        for(t = world; (t = find(t, targetname, s)); )
                if(t.use)
                {
-                       self = t;
-                       other = stemp;
+                       setself(t);
+                       other = this;
                        activator = atemp;
                        self.use();
                }
 
-       self = stemp;
+       setself(this);
        other = otemp;
        activator = atemp;
 }
@@ -33,7 +32,7 @@ void trigger_keylock_kill(string s)
 }
 
 void trigger_keylock_touch()
-{
+{SELFPARAM();
        bool key_used = false;
        bool started_delay = false;
 
@@ -97,7 +96,7 @@ void trigger_keylock_touch()
 
 #ifdef SVQC
 bool trigger_keylock_send(entity to, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_KEYLOCK);
 
        WriteInt24_t(MSG_ENTITY, self.itemkeys);
@@ -134,7 +133,7 @@ If spawned without any key specified in itemkeys, this trigger will display an e
 message2 and noise2 will be resent to the player every 2 seconds while he is in the trigger zone.
 */
 void spawnfunc_trigger_keylock(void)
-{
+{SELFPARAM();
        if(!self.itemkeys) { remove(self); return; }
 
        // set unlocked message
@@ -176,7 +175,7 @@ void spawnfunc_trigger_keylock(void)
 }
 #elif defined(CSQC)
 void keylock_remove()
-{
+{SELFPARAM();
        if(self.target) { strunzone(self.target); }
        self.target = string_null;
 
@@ -197,7 +196,7 @@ void keylock_remove()
 }
 
 void ent_keylock()
-{
+{SELFPARAM();
        self.itemkeys = ReadInt24_t();
        self.height = ReadByte();
 
index f14b75c3124b983856400b620faf2af7dbc517ce..0c8a7d359decbc8299181ea208087fea26761c82 100644 (file)
@@ -2,10 +2,9 @@
 float magicear_matched;
 float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo);
 string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin)
-{
+{SELFPARAM();
        float domatch, dotrigger, matchstart, l;
        string s, msg;
-       entity oldself;
        string savemessage;
 
        magicear_matched = false;
@@ -29,14 +28,13 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
 
                if(dotrigger)
                {
-                       oldself = self;
                        activator = source;
-                       self = ear;
+                       setself(ear);
                        savemessage = self.message;
                        self.message = string_null;
                        SUB_UseTargets();
                        self.message = savemessage;
-                       self = oldself;
+                       setself(this);
                }
 
                if(ear.netname != "")
@@ -120,14 +118,13 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
 
        if(dotrigger)
        {
-               oldself = self;
                activator = source;
-               self = ear;
+               setself(ear);
                savemessage = self.message;
                self.message = string_null;
                SUB_UseTargets();
                self.message = savemessage;
-               self = oldself;
+               setself(this);
        }
 
        if(ear.spawnflags & 16)
@@ -166,7 +163,7 @@ string trigger_magicear_processmessage_forallears(entity source, float teamsay,
 }
 
 void spawnfunc_trigger_magicear()
-{
+{SELFPARAM();
        self.enemy = magicears;
        magicears = self;
 
index 45ce761e035d85a5b344828e26170458b1b514c5..5129ce35cdf11d20dfd2b567ca2b6f1efbb9d26c 100644 (file)
@@ -3,7 +3,7 @@
 "Mono-flop" trigger gate... turns one trigger event into one "on" and one "off" event, separated by a delay of "wait"
 */
 void monoflop_use()
-{
+{SELFPARAM();
        self.nextthink = time + self.wait;
        self.enemy = activator;
        if(self.state)
@@ -12,7 +12,7 @@ void monoflop_use()
        SUB_UseTargets();
 }
 void monoflop_fixed_use()
-{
+{SELFPARAM();
        if(self.state)
                return;
        self.nextthink = time + self.wait;
@@ -22,20 +22,20 @@ void monoflop_fixed_use()
 }
 
 void monoflop_think()
-{
+{SELFPARAM();
        self.state = 0;
        activator = self.enemy;
        SUB_UseTargets();
 }
 
 void monoflop_reset()
-{
+{SELFPARAM();
        self.state = 0;
        self.nextthink = 0;
 }
 
 void spawnfunc_trigger_monoflop()
-{
+{SELFPARAM();
        if(!self.wait)
                self.wait = 1;
        if(self.spawnflags & 1)
index 0e9a02016ca4fd7109561683785891a32e227444..007e6da2f5e980cfc89a807b338e907edeeba296 100644 (file)
@@ -3,7 +3,7 @@
 #ifdef SVQC
 // the wait time has passed, so set back up for another activation
 void multi_wait()
-{
+{SELFPARAM();
        if (self.max_health)
        {
                self.health = self.max_health;
@@ -17,7 +17,7 @@ void multi_wait()
 // self.enemy should be set to the activator so it can be held through a delay
 // so wait for the delay time before firing
 void multi_trigger()
-{
+{SELFPARAM();
        if (self.nextthink > time)
        {
                return;         // allready been triggered
@@ -58,14 +58,14 @@ void multi_trigger()
 }
 
 void multi_use()
-{
+{SELFPARAM();
        self.goalentity = other;
        self.enemy = activator;
        multi_trigger();
 }
 
 void multi_touch()
-{
+{SELFPARAM();
        if(!(self.spawnflags & 2))
        if(!other.iscreature)
                        return;
@@ -96,7 +96,7 @@ void multi_touch()
 }
 
 void multi_eventdamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
        if (!self.takedamage)
                return;
        if(self.spawnflags & DOOR_NOSPLASH)
@@ -112,7 +112,7 @@ void multi_eventdamage (entity inflictor, entity attacker, float damage, int dea
 }
 
 void multi_reset()
-{
+{SELFPARAM();
        if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
                self.touch = multi_touch;
        if (self.max_health)
@@ -140,7 +140,7 @@ sounds
 set "message" to text string
 */
 void spawnfunc_trigger_multiple()
-{
+{SELFPARAM();
        self.reset = multi_reset;
        if (self.sounds == 1)
        {
@@ -203,7 +203,7 @@ sounds
 set "message" to text string
 */
 void spawnfunc_trigger_once()
-{
+{SELFPARAM();
        self.wait = -1;
        spawnfunc_trigger_multiple();
 }
index 02a258e87f13a92a942f70f5c2427129f4457928..d9c6c2e60c582fd18fce1ea67234e5af840cb074 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 void multivibrator_send()
-{
+{SELFPARAM();
        float newstate;
        float cyclestart;
 
@@ -20,7 +20,7 @@ void multivibrator_send()
 }
 
 void multivibrator_toggle()
-{
+{SELFPARAM();
        if(self.nextthink == 0)
        {
                multivibrator_send();
@@ -37,7 +37,7 @@ void multivibrator_toggle()
 }
 
 void multivibrator_reset()
-{
+{SELFPARAM();
        if(!(self.spawnflags & 1))
                self.nextthink = 0; // wait for a trigger event
        else
@@ -56,7 +56,7 @@ respawntime: "off" cycle time (default: same as wait)
 START_ON: assume it is already turned on (when targeted)
 */
 void spawnfunc_trigger_multivibrator()
-{
+{SELFPARAM();
        if(!self.wait)
                self.wait = 1;
        if(!self.respawntime)
index e037028aee59990cc514a8f374805ed5c30a0977..20962cd495d9de4cc3ce25eb4a30e396db6e16f3 100644 (file)
@@ -3,7 +3,7 @@
 This fixed size trigger cannot be touched, it can only be fired by other events.  It can contain killtargets, targets, delays, and messages.
 */
 void spawnfunc_trigger_relay()
-{
+{SELFPARAM();
        self.use = SUB_UseTargets;
        self.reset = spawnfunc_trigger_relay; // this spawnfunc resets fully
 }
index 83c0103d09fe4ad2a2d61eaad361e49c48ac0e98..b765151fd123faa685786bb3f3f66b1b4730ecab 100644 (file)
@@ -1,44 +1,40 @@
 #ifdef SVQC
 void relay_activators_use()
-{
-       entity trg, os;
-
-       os = self;
-
-       for(trg = world; (trg = find(trg, targetname, os.target)); )
+{SELFPARAM();
+       for(entity trg = world; (trg = find(trg, targetname, this.target)); )
        {
-               self = trg;
+               setself(trg);
                if (trg.setactive)
-                       trg.setactive(os.cnt);
+                       trg.setactive(this.cnt);
                else
                {
                        //bprint("Not using setactive\n");
-                       if(os.cnt == ACTIVE_TOGGLE)
+                       if(this.cnt == ACTIVE_TOGGLE)
                                if(trg.active == ACTIVE_ACTIVE)
                                        trg.active = ACTIVE_NOT;
                                else
                                        trg.active = ACTIVE_ACTIVE;
                        else
-                               trg.active = os.cnt;
+                               trg.active = this.cnt;
                }
        }
-       self = os;
+       setself(this);
 }
 
 void spawnfunc_relay_activate()
-{
+{SELFPARAM();
        self.cnt = ACTIVE_ACTIVE;
        self.use = relay_activators_use;
 }
 
 void spawnfunc_relay_deactivate()
-{
+{SELFPARAM();
        self.cnt = ACTIVE_NOT;
        self.use = relay_activators_use;
 }
 
 void spawnfunc_relay_activatetoggle()
-{
+{SELFPARAM();
        self.cnt = ACTIVE_TOGGLE;
        self.use = relay_activators_use;
 }
index ade56c1e8b48fe4ec78b3515668980ffd21f191f..cadd95e5840abd319b53af727505d19a05cc9cc4 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 void trigger_relay_if_use()
-{
+{SELFPARAM();
        float n;
        n = self.count;
 
@@ -14,7 +14,7 @@ void trigger_relay_if_use()
 }
 
 void spawnfunc_trigger_relay_if()
-{
+{SELFPARAM();
        self.use = trigger_relay_if_use;
 }
 #endif
index 8a77cef0515afe654cf5621dc90e9ed80ac2b268..f93287a920f4ad2c5a5187d17a03fad951e4b361 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 void trigger_relay_teamcheck_use()
-{
+{SELFPARAM();
        if(activator.team)
        {
                if(self.spawnflags & 2)
@@ -22,12 +22,12 @@ void trigger_relay_teamcheck_use()
 }
 
 void trigger_relay_teamcheck_reset()
-{
+{SELFPARAM();
        self.team = self.team_saved;
 }
 
 void spawnfunc_trigger_relay_teamcheck()
-{
+{SELFPARAM();
        self.team_saved = self.team;
        self.use = trigger_relay_teamcheck_use;
        self.reset = trigger_relay_teamcheck_reset;
index b93ab03d0a4ded5fcb90f76e2cef41c1963bb195..27347d9e83ea1e63d2138446e1e4b4031329cc4a 100644 (file)
@@ -9,7 +9,8 @@
 
 #ifdef SVQC
 
-void secrets_setstatus() {
+void secrets_setstatus()
+{SELFPARAM();
        self.stat_secrets_total = secrets_total;
        self.stat_secrets_found = secrets_found;
 }
@@ -17,7 +18,8 @@ void secrets_setstatus() {
 /**
  * A secret has been found (maybe :P)
  */
-void trigger_secret_touch() {
+void trigger_secret_touch()
+{SELFPARAM();
        // only a player can trigger this
        if (!IS_PLAYER(other))
                return;
@@ -49,7 +51,8 @@ killtarget: remove all entities with this targetname when triggered
 You should create a common/trigger textured brush covering the entrance to a secret room/area.
 Trigger secret can only be trigger by a player's touch and can not be a target itself.
 */
-void spawnfunc_trigger_secret() {
+void spawnfunc_trigger_secret()
+{SELFPARAM();
        // FIXME: should it be disabled in most modes?
 
        // update secrets count
index b99332b984533c9853a79b0618c859e4c5a78eff..b9a4acd1a411934b3a90500afdff44dbeafd77c5 100644 (file)
@@ -38,7 +38,7 @@ void swampslug_think();
 * I do it this way becuz there is no "untouch" event.
 */
 void swampslug_think(void)
-{
+{SELFPARAM();
        //Slowly kill the slug
        self.health = self.health - 1;
 
@@ -62,7 +62,7 @@ void swampslug_think(void)
 }
 
 void swamp_touch(void)
-{
+{SELFPARAM();
        // 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) || PHYS_DEAD(other))
@@ -95,7 +95,7 @@ void swamp_touch(void)
 
 #ifdef SVQC
 float swamp_send(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
 
        WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here
@@ -108,7 +108,7 @@ float swamp_send(entity to, float sf)
 }
 
 void swamp_link()
-{
+{SELFPARAM();
        Net_LinkEntity(self, false, 0, func_ladder_send);
 }
 
@@ -117,7 +117,7 @@ Players gettin into the swamp will
 get slowd down and damaged
 */
 void spawnfunc_trigger_swamp(void)
-{
+{SELFPARAM();
        // Init stuff
        EXACTTRIGGER_INIT;
        self.touch = swamp_touch;
@@ -136,7 +136,7 @@ void spawnfunc_trigger_swamp(void)
 #elif defined(CSQC)
 
 void ent_swamp()
-{
+{SELFPARAM();
        self.dmg = ReadByte();
        self.swamp_slowdown = ReadByte();
        self.swamp_interval = ReadByte();
index d983cf3aec1d23842ef0f5367e268f4b86fa3fb9..129f4e387cbab7ca43b3e9ec93e3fca1b0ff4973 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 void trigger_teleport_use()
-{
+{SELFPARAM();
        if(teamplay)
                self.team = activator.team;
 #ifdef SVQC
@@ -9,8 +9,7 @@ void trigger_teleport_use()
 }
 
 void Teleport_Touch (void)
-{
-       entity oldself;
+{SELFPARAM();
        string s;
 
        if (self.active != ACTIVE_ACTIVE)
@@ -38,22 +37,18 @@ void Teleport_Touch (void)
        if(IS_PLAYER(other))
                RemoveGrapplingHook(other);
 
-       entity e;
-       e = Simple_TeleportPlayer(self, other);
+       entity e = Simple_TeleportPlayer(self, other);
 
        activator = other;
        s = self.target; self.target = string_null;
        SUB_UseTargets();
        if (!self.target) self.target = s;
 
-       oldself = self;
-       self = e;
-       SUB_UseTargets();
-       self = oldself;
+       WITH(entity, self, e, SUB_UseTargets());
 }
 
 void spawnfunc_trigger_teleport()
-{
+{SELFPARAM();
        self.angles = '0 0 0';
 
        EXACTTRIGGER_INIT;
index 62c37a0f49630664ccbe8a7209b58f2082abd4ff..de2d3aac287ef32783b120cd57a28ea49f0211aa 100644 (file)
@@ -9,7 +9,7 @@
 #ifdef SVQC
 
 void viewloc_think()
-{
+{SELFPARAM();
        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
@@ -39,7 +39,7 @@ void viewloc_think()
 }
 
 bool trigger_viewloc_send(entity to, int sf)
-{
+{SELFPARAM();
        // CSQC doesn't need to know our origin (yet), as we're only available for referencing
        WriteByte(MSG_ENTITY, ENT_CLIENT_VIEWLOC_TRIGGER);
 
@@ -54,7 +54,7 @@ bool trigger_viewloc_send(entity to, int sf)
 }
 
 void viewloc_init()
-{
+{SELFPARAM();
        entity e;
        for(e = world; (e = find(e, targetname, self.target)); )
                if(e.classname == "target_viewlocation_start")
@@ -81,7 +81,7 @@ void viewloc_init()
 }
 
 void spawnfunc_trigger_viewlocation()
-{
+{SELFPARAM();
        // we won't check target2 here yet, as it may not even need to exist
        if(self.target == "") { LOG_INFO("^1FAIL!\n"); remove(self); return; }
 
@@ -90,7 +90,7 @@ void spawnfunc_trigger_viewlocation()
 }
 
 bool viewloc_send(entity to, int sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_VIEWLOC);
 
        WriteByte(MSG_ENTITY, self.cnt);
@@ -108,20 +108,20 @@ bool viewloc_send(entity to, int sf)
 
 .float angle;
 void viewloc_link()
-{
+{SELFPARAM();
        if(self.angle)
                self.angles_y = self.angle;
        Net_LinkEntity(self, false, 0, viewloc_send);
 }
 
 void spawnfunc_target_viewlocation_start()
-{
+{SELFPARAM();
        self.classname = "target_viewlocation_start";
        self.cnt = 1;
        viewloc_link();
 }
 void spawnfunc_target_viewlocation_end()
-{
+{SELFPARAM();
        self.classname = "target_viewlocation_end";
        self.cnt = 2;
        viewloc_link();
@@ -133,13 +133,13 @@ void spawnfunc_target_viewlocation() { spawnfunc_target_viewlocation_start(); }
 #elif defined(CSQC)
 
 void trigger_viewloc_updatelink()
-{
+{SELFPARAM();
        self.enemy = findfloat(world, entnum, self.cnt);
        self.goalentity = findfloat(world, entnum, self.count);
 }
 
 void ent_viewloc_trigger()
-{
+{SELFPARAM();
        float point1 = ReadShort();
        float point2 = ReadShort();
 
@@ -162,7 +162,7 @@ void ent_viewloc_trigger()
 }
 
 void ent_viewloc()
-{
+{SELFPARAM();
        self.cnt = ReadByte();
 
        self.origin_x = ReadCoord();
index 1e7715a91b58a70ef8472f980ea8a9a094c16214..a44c688ed9544fb16c2e27647a8dd952807a39e3 100644 (file)
@@ -3,7 +3,7 @@ void SUB_DontUseTargets() { }
 void() SUB_UseTargets;
 
 void DelayThink()
-{
+{SELFPARAM();
        activator = self.enemy;
        SUB_UseTargets ();
        remove(self);
@@ -22,7 +22,7 @@ void FixSize(entity e)
 
 #ifdef SVQC
 void trigger_common_write(bool withtarget)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, self.warpzone_isboxy);
        WriteByte(MSG_ENTITY, self.scale);
 
@@ -59,7 +59,7 @@ void trigger_common_write(bool withtarget)
 #elif defined(CSQC)
 
 void trigger_common_read(bool withtarget)
-{
+{SELFPARAM();
        self.warpzone_isboxy = ReadByte();
        self.scale = ReadByte();
 
@@ -96,7 +96,7 @@ void trigger_common_read(bool withtarget)
 }
 
 void trigger_remove_generic()
-{
+{SELFPARAM();
        if(self.target) { strunzone(self.target); }
        self.target = string_null;
 
@@ -137,8 +137,8 @@ match (string)self.target and call their .use function
 ==============================
 */
 void SUB_UseTargets()
-{
-       entity t, stemp, otemp, act;
+{SELFPARAM();
+       entity t, otemp, act;
        string s;
        float i;
 
@@ -191,10 +191,9 @@ void SUB_UseTargets()
 // fire targets
 //
        act = activator;
-       stemp = self;
        otemp = other;
 
-       if(stemp.target_random)
+       if(this.target_random)
                RandomSelection_Init();
 
        for(i = 0; i < 4; ++i)
@@ -202,10 +201,10 @@ void SUB_UseTargets()
                switch(i)
                {
                        default:
-                       case 0: s = stemp.target; break;
-                       case 1: s = stemp.target2; break;
-                       case 2: s = stemp.target3; break;
-                       case 3: s = stemp.target4; break;
+                       case 0: s = this.target; break;
+                       case 1: s = this.target2; break;
+                       case 2: s = this.target3; break;
+                       case 3: s = this.target4; break;
                }
                if (s != "")
                {
@@ -215,7 +214,7 @@ void SUB_UseTargets()
                        for(t = world; (t = find(t, targetname, s)); )
                        if(t.use)
                        {
-                               if(stemp.target_random)
+                               if(this.target_random)
                                {
                                        RandomSelection_Add(t, 0, string_null, 1, 0);
                                }
@@ -223,8 +222,8 @@ void SUB_UseTargets()
                                {
                             &