]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Introduce touch accessors
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 22 May 2016 09:03:42 +0000 (19:03 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 22 May 2016 10:17:11 +0000 (20:17 +1000)
65 files changed:
qcsrc/common/effects/qc/gibs.qc
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/physical_items/physical_items.qc
qcsrc/common/mutators/mutator/sandbox/sandbox.qc
qcsrc/common/t_items.qc
qcsrc/common/triggers/func/button.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/ladder.qc
qcsrc/common/triggers/platforms.qc
qcsrc/common/triggers/teleporters.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/multi.qc
qcsrc/common/triggers/trigger/secret.qc
qcsrc/common/triggers/trigger/swamp.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/targettrigger.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot.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/hook.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/lib/self.qh
qcsrc/lib/warpzone/server.qc
qcsrc/server/g_hook.qc
qcsrc/server/item_key.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/portals.qc
qcsrc/server/race.qc

index bbe3ad934836e41c2ec671dedd2dee05e64335e7..a72536b0591420e9dd68382c7c1feeee6d1da68c 100644 (file)
@@ -144,7 +144,7 @@ void Gib_Draw(entity this)
        if(wasfreed(this))
                return;
 
        if(wasfreed(this))
                return;
 
-       if(this.touch == Gib_Touch) // don't do this for the "chunk" thingie...
+       if(gettouch(this) == Gib_Touch) // don't do this for the "chunk" thingie...
                // TODO somehow make it spray in a direction dependent on this.angles
                __trailparticles(this, _particleeffectnum(strcat(species_prefix(this.cnt), EFFECT_TR_SLIGHTBLOOD.eent_eff_name)), oldorg, this.origin);
        else
                // TODO somehow make it spray in a direction dependent on this.angles
                __trailparticles(this, _particleeffectnum(strcat(species_prefix(this.cnt), EFFECT_TR_SLIGHTBLOOD.eent_eff_name)), oldorg, this.origin);
        else
index 21ebc33b942d01f4048b8fe9cfbe3db4c69e4f18..cc24cfde6449d86b2dbfe13fd7dae679740f4fe4 100644 (file)
@@ -166,7 +166,7 @@ void GiveBall(entity plyr, entity ball)
 
        ball.velocity = '0 0 0';
        ball.movetype = MOVETYPE_NONE;
 
        ball.velocity = '0 0 0';
        ball.movetype = MOVETYPE_NONE;
-       ball.touch = func_null;
+       settouch(ball, func_null);
        ball.effects |= EF_NOSHADOW;
        ball.scale = 1; // scale down.
 
        ball.effects |= EF_NOSHADOW;
        ball.scale = 1; // scale down.
 
@@ -201,7 +201,7 @@ void DropBall(entity ball, vector org, vector vel)
        ball.scale = ball_scale;
        ball.velocity = vel;
        ball.nb_droptime = time;
        ball.scale = ball_scale;
        ball.velocity = vel;
        ball.nb_droptime = time;
-       ball.touch = basketball_touch;
+       settouch(ball, basketball_touch);
        ball.think = ResetBall;
        ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.teamtime);
 
        ball.think = ResetBall;
        ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.teamtime);
 
@@ -226,9 +226,9 @@ void InitBall()
        UNSET_ONGROUND(this);
        this.movetype = MOVETYPE_BOUNCE;
        if(this.classname == "nexball_basketball")
        UNSET_ONGROUND(this);
        this.movetype = MOVETYPE_BOUNCE;
        if(this.classname == "nexball_basketball")
-               this.touch = basketball_touch;
+               settouch(this, basketball_touch);
        else if(this.classname == "nexball_football")
        else if(this.classname == "nexball_football")
-               this.touch = football_touch;
+               settouch(this, football_touch);
        this.cnt = 0;
        this.think = ResetBall;
        this.nextthink = time + autocvar_g_nexball_delay_idle + 3;
        this.cnt = 0;
        this.think = ResetBall;
        this.nextthink = time + autocvar_g_nexball_delay_idle + 3;
@@ -247,7 +247,7 @@ void ResetBall()
                if(time == this.teamtime)
                        bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n");
 
                if(time == this.teamtime)
                        bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n");
 
-               this.touch = func_null;
+               settouch(this, func_null);
                this.movetype = MOVETYPE_NOCLIP;
                this.velocity = '0 0 0'; // just in case?
                if(!this.cnt)
                this.movetype = MOVETYPE_NOCLIP;
                this.velocity = '0 0 0'; // just in case?
                if(!this.cnt)
@@ -429,7 +429,7 @@ void GoalTouch()
        ball.cnt = 1;
        ball.think = ResetBall;
        if(ball.classname == "nexball_basketball")
        ball.cnt = 1;
        ball.think = ResetBall;
        if(ball.classname == "nexball_basketball")
-               ball.touch = football_touch; // better than func_null: football control until the ball gets reset
+               settouch(ball, football_touch); // better than func_null: football control until the ball gets reset
        ball.nextthink = time + autocvar_g_nexball_delay_goal * (self.team != GOAL_OUT);
 }
 
        ball.nextthink = time + autocvar_g_nexball_delay_goal * (self.team != GOAL_OUT);
 }
 
@@ -623,7 +623,7 @@ void SpawnGoal(entity this)
        if(this.noise == "")
                this.noise = "ctf/respawn.wav";
        precache_sound(this.noise);
        if(this.noise == "")
                this.noise = "ctf/respawn.wav";
        precache_sound(this.noise);
-       this.touch = GoalTouch;
+       settouch(this, GoalTouch);
 }
 
 spawnfunc(nexball_redgoal)
 }
 
 spawnfunc(nexball_redgoal)
@@ -815,7 +815,7 @@ void W_Nexball_Attack2()
 
        W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
        missile.angles = vectoangles(missile.velocity);
 
        W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
        missile.angles = vectoangles(missile.velocity);
-       missile.touch = W_Nexball_Touch;
+       settouch(missile, W_Nexball_Touch);
        missile.think = SUB_Remove_self;
        missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
 
        missile.think = SUB_Remove_self;
        missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
 
index b2d0a84d3af40d470138d347922f31bfe2828c75..0f138819a30fdc7f9ff15ad014521cb4395b8e2c 100644 (file)
@@ -208,7 +208,7 @@ void ons_CaptureShield_Spawn(entity generator, bool is_generator)
        shield.team = generator.team;
        shield.colormap = generator.colormap;
        shield.reset = ons_CaptureShield_Reset;
        shield.team = generator.team;
        shield.colormap = generator.colormap;
        shield.reset = ons_CaptureShield_Reset;
-       shield.touch = ons_CaptureShield_Touch;
+       settouch(shield, ons_CaptureShield_Touch);
        shield.customizeentityforclient = ons_CaptureShield_Customize;
        shield.effects = EF_ADDITIVE;
        shield.movetype = MOVETYPE_NOCLIP;
        shield.customizeentityforclient = ons_CaptureShield_Customize;
        shield.effects = EF_ADDITIVE;
        shield.movetype = MOVETYPE_NOCLIP;
@@ -865,7 +865,7 @@ void ons_ControlPoint_Setup(entity cp)
        cp.team = 0;
        cp.solid = SOLID_BBOX;
        cp.movetype = MOVETYPE_NONE;
        cp.team = 0;
        cp.solid = SOLID_BBOX;
        cp.movetype = MOVETYPE_NONE;
-       cp.touch = ons_ControlPoint_Touch;
+       settouch(cp, ons_ControlPoint_Touch);
        cp.think = ons_ControlPoint_Think;
        cp.nextthink = time + ONS_CP_THINKRATE;
        cp.reset = ons_ControlPoint_Reset;
        cp.think = ons_ControlPoint_Think;
        cp.nextthink = time + ONS_CP_THINKRATE;
        cp.reset = ons_ControlPoint_Reset;
@@ -1117,7 +1117,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
        gen.iscaptured = true;
        gen.islinked = true;
        gen.isshielded = true;
        gen.iscaptured = true;
        gen.islinked = true;
        gen.isshielded = true;
-       gen.touch = onslaught_generator_touch;
+       settouch(gen, onslaught_generator_touch);
 
        // appearence
        // model handled by CSQC
 
        // appearence
        // model handled by CSQC
index de7bccb4b2824927a26a216acf56d2508989f401..e746e4394ab501807868f1f7153503b1be3bbcf9 100644 (file)
@@ -241,7 +241,7 @@ void M_Mage_Attack_Spike(entity this, vector dir)
        missile.velocity = dir * 400;
        missile.avelocity = '300 300 300';
        missile.enemy = this.enemy;
        missile.velocity = dir * 400;
        missile.avelocity = '300 300 300';
        missile.enemy = this.enemy;
-       missile.touch = M_Mage_Attack_Spike_Touch;
+       settouch(missile, M_Mage_Attack_Spike_Touch);
 
        this.mage_spike = missile;
 
 
        this.mage_spike = missile;
 
index 97e0d49ba5af3c13c5a5f2f1e22828685b0a1067..d83026474b2ff25dfa24bb176dad537a055ef232 100644 (file)
@@ -163,7 +163,7 @@ void M_Shambler_Attack_Lightning(entity this)
        gren.nextthink = time;
        gren.think = M_Shambler_Attack_Lightning_Think;
        gren.use = M_Shambler_Attack_Lightning_Explode_use;
        gren.nextthink = time;
        gren.think = M_Shambler_Attack_Lightning_Think;
        gren.use = M_Shambler_Attack_Lightning_Explode_use;
-       gren.touch = M_Shambler_Attack_Lightning_Touch;
+       settouch(gren, M_Shambler_Attack_Lightning_Touch);
 
        gren.takedamage = DAMAGE_YES;
        gren.health = 50;
 
        gren.takedamage = DAMAGE_YES;
        gren.health = 50;
index 0b2e3650b4c3cdf23d86008393709646af99614d..5f8add4ffd08248b837318f1fd7dfbecae8bfc20 100644 (file)
@@ -186,7 +186,7 @@ void M_Spider_Attack_Web(entity this)
        //proj.glow_color = 45;
        proj.movetype = MOVETYPE_BOUNCE;
        W_SetupProjVelocity_Explicit(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, false);
        //proj.glow_color = 45;
        proj.movetype = MOVETYPE_BOUNCE;
        W_SetupProjVelocity_Explicit(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, false);
-       proj.touch = M_Spider_Attack_Web_Touch;
+       settouch(proj, M_Spider_Attack_Web_Touch);
        setsize(proj, '-4 -4 -4', '4 4 4');
        proj.takedamage = DAMAGE_NO;
        proj.damageforcescale = 0;
        setsize(proj, '-4 -4 -4', '4 4 4');
        proj.takedamage = DAMAGE_NO;
        proj.damageforcescale = 0;
index c52ce3f99980c4d0754a119acfc614ee9fe666da..07f51611e1a09ac26d471b09b145539fe3934b7a 100644 (file)
@@ -73,7 +73,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity
                missile.avelocity = '300 300 300';
                missile.nextthink = time + 5;
                missile.think = M_Wyvern_Attack_Fireball_Explode;
                missile.avelocity = '300 300 300';
                missile.nextthink = time + 5;
                missile.think = M_Wyvern_Attack_Fireball_Explode;
-               missile.touch = M_Wyvern_Attack_Fireball_Touch;
+               settouch(missile, M_Wyvern_Attack_Fireball_Touch);
                CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
 
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
                CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
 
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
index b28bb8d84eaefa6fbb194bd293b35e48cc992702..ffbb06c26258c4f0d3b28d073b6378a81c2a3ef7 100644 (file)
@@ -87,14 +87,14 @@ void M_Zombie_Attack_Leap_Touch()
                angles_face = vectoangles(self.moveto - self.origin);
                angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force);
                Damage(other, self, self, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face);
                angles_face = vectoangles(self.moveto - self.origin);
                angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force);
                Damage(other, self, self, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face);
-               self.touch = Monster_Touch; // instantly turn it off to stop damage spam
+               settouch(self, Monster_Touch); // instantly turn it off to stop damage spam
                self.state = 0;
        }
 
        if (trace_dphitcontents)
        {
                self.state = 0;
                self.state = 0;
        }
 
        if (trace_dphitcontents)
        {
                self.state = 0;
-               self.touch = Monster_Touch;
+               settouch(self, Monster_Touch);
        }
 }
 
        }
 }
 
index 0179a251b80f0fa653f670b13400c836b3a0d487..48e5103616fea170515b29973f0b4e403b143a29 100644 (file)
@@ -415,7 +415,7 @@ bool Monster_Attack_Leap(entity this, vector anm, void() touchfunc, vector vel,
 
        if(this.flags & FL_MONSTER)
                this.state = MONSTER_ATTACK_RANGED;
 
        if(this.flags & FL_MONSTER)
                this.state = MONSTER_ATTACK_RANGED;
-       this.touch = touchfunc;
+       settouch(this, touchfunc);
        this.origin_z += 1;
        this.velocity = vel;
        UNSET_ONGROUND(this);
        this.origin_z += 1;
        this.velocity = vel;
        UNSET_ONGROUND(this);
@@ -835,7 +835,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
        if(this.state == MONSTER_ATTACK_RANGED && IS_ONGROUND(this))
        {
                this.state = 0;
        if(this.state == MONSTER_ATTACK_RANGED && IS_ONGROUND(this))
        {
                this.state = 0;
-               this.touch = Monster_Touch;
+               settouch(this, Monster_Touch);
        }
 
        if(this.state && time >= this.attack_finished_single[0])
        }
 
        if(this.state && time >= this.attack_finished_single[0])
@@ -1022,7 +1022,7 @@ void Monster_Dead(entity this, entity attacker, float gibbed)
        this.enemy                      = world;
        this.movetype           = MOVETYPE_TOSS;
        this.moveto                     = this.origin;
        this.enemy                      = world;
        this.movetype           = MOVETYPE_TOSS;
        this.moveto                     = this.origin;
-       this.touch                      = Monster_Touch; // reset incase monster was pouncing
+       settouch(this, Monster_Touch); // reset incase monster was pouncing
        this.reset                      = func_null;
        this.state                      = 0;
        this.attack_finished_single[0] = 0;
        this.reset                      = func_null;
        this.state                      = 0;
        this.attack_finished_single[0] = 0;
@@ -1331,7 +1331,7 @@ bool Monster_Spawn(entity this, int mon_id)
        this.damagedbycontents  = true;
        this.monsterid                  = mon_id;
        this.event_damage               = Monster_Damage;
        this.damagedbycontents  = true;
        this.monsterid                  = mon_id;
        this.event_damage               = Monster_Damage;
-       this.touch                              = Monster_Touch;
+       settouch(this, Monster_Touch);
        this.use                                = Monster_Use;
        this.solid                              = SOLID_BBOX;
        this.movetype                   = MOVETYPE_WALK;
        this.use                                = Monster_Use;
        this.solid                              = SOLID_BBOX;
        this.movetype                   = MOVETYPE_WALK;
index 18841767fc9fa2596c763b06e87d23c63e9ff120..302eea34edd897118af883ee97392d9373327984 100644 (file)
@@ -423,7 +423,7 @@ void buff_Init(entity this)
        this.solid = SOLID_TRIGGER;
        this.flags = FL_ITEM;
        this.think = buff_Think;
        this.solid = SOLID_TRIGGER;
        this.flags = FL_ITEM;
        this.think = buff_Think;
-       this.touch = buff_Touch;
+       settouch(this, buff_Touch);
        this.reset = buff_Reset;
        this.nextthink = time + 0.1;
        this.gravity = 1;
        this.reset = buff_Reset;
        this.nextthink = time + 0.1;
        this.gravity = 1;
@@ -885,12 +885,11 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
 
                        if(boxesoverlap(self.absmin - pickup_size, self.absmax + pickup_size, it.absmin, it.absmax))
                        {
 
                        if(boxesoverlap(self.absmin - pickup_size, self.absmax + pickup_size, it.absmin, it.absmax))
                        {
-                               if(it.touch)
+                               if(gettouch(it))
                                {
                                        entity oldother = other;
                                        other = self;
                                {
                                        entity oldother = other;
                                        other = self;
-                                       WITHSELF(it, it.touch());
-
+                                       WITHSELF(it, gettouch(it)());
                                        other = oldother;
                                }
                        }
                                        other = oldother;
                                }
                        }
index 9be8f96de0022c97a8324591b7f4c05d058fd490..c33ccf05baa8740489451e019827d16a776bbadf 100644 (file)
@@ -575,7 +575,7 @@ void nade_heal_boom(entity this)
        healer.team = this.realowner.team;
        healer.bot_dodge = false;
        healer.solid = SOLID_TRIGGER;
        healer.team = this.realowner.team;
        healer.bot_dodge = false;
        healer.solid = SOLID_TRIGGER;
-       healer.touch = nade_heal_touch;
+       settouch(healer, nade_heal_touch);
 
        setmodel(healer, MDL_NADE_HEAL);
        healer.healer_radius = autocvar_g_nades_nade_radius;
 
        setmodel(healer, MDL_NADE_HEAL);
        healer.healer_radius = autocvar_g_nades_nade_radius;
@@ -859,7 +859,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
        if(set_owner)
                _nade.realowner = e;
 
        if(set_owner)
                _nade.realowner = e;
 
-       _nade.touch = nade_touch;
+       settouch(_nade, nade_touch);
        _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
        _nade.health = autocvar_g_nades_nade_health;
        _nade.max_health = _nade.health;
        _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
        _nade.health = autocvar_g_nades_nade_health;
        _nade.max_health = _nade.health;
index f16b7024dffaf1336b37cce966c8779279637577..bf531e3b47b9ce75b26601762a3f805c42d563c9 100644 (file)
@@ -132,7 +132,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
        setorigin (missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
        W_SetupProjVelocity_Basic(missile, WEP_CVAR(rpc, speed), 0);
 
        setorigin (missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
        W_SetupProjVelocity_Basic(missile, WEP_CVAR(rpc, speed), 0);
 
-       missile.touch = W_RocketPropelledChainsaw_Touch;
+       settouch(missile, W_RocketPropelledChainsaw_Touch);
 
        missile.think = W_RocketPropelledChainsaw_Think;
        missile.cnt = time + WEP_CVAR(rpc, lifetime);
 
        missile.think = W_RocketPropelledChainsaw_Think;
        missile.cnt = time + WEP_CVAR(rpc, lifetime);
index aaad9d47be599b59c91a7c879014d0deb8dc6535..bd68f2bcd414872219c6275c504c76e5c5a19cbe 100644 (file)
@@ -118,7 +118,7 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
 
        wep.think = physical_item_think;
        wep.nextthink = time;
 
        wep.think = physical_item_think;
        wep.nextthink = time;
-       wep.touch = physical_item_touch;
+       settouch(wep, physical_item_touch);
        wep.event_damage = physical_item_damage;
 
        if(!wep.cnt)
        wep.event_damage = physical_item_damage;
 
        if(!wep.cnt)
index 6391e1f8726b4f7ad17cf5d89d7007a65e0950da..5ab3ca02b49602846eb976c40bb76e2ebf41d789 100644 (file)
@@ -187,7 +187,7 @@ entity sandbox_ObjectSpawn(float database)
        e.frame = 0;
        e.skin = 0;
        e.material = string_null;
        e.frame = 0;
        e.skin = 0;
        e.material = string_null;
-       e.touch = sandbox_ObjectFunction_Touch;
+       settouch(e, sandbox_ObjectFunction_Touch);
        e.think = sandbox_ObjectFunction_Think;
        e.nextthink = time;
        //e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
        e.think = sandbox_ObjectFunction_Think;
        e.nextthink = time;
        //e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
index 15cb36c9219088bf507ba41d694eb6d366eb5423..dcbbb95e30802489286574f88270b5413749b0f2 100644 (file)
@@ -1182,7 +1182,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        this.bot_pickupbasevalue = pickupbasevalue;
        this.mdl = this.model ? this.model : strzone(this.item_model_ent.model_str());
        this.netname = itemname;
        this.bot_pickupbasevalue = pickupbasevalue;
        this.mdl = this.model ? this.model : strzone(this.item_model_ent.model_str());
        this.netname = itemname;
-       this.touch = Item_Touch;
+       settouch(this, Item_Touch);
        setmodel(this, MDL_Null); // precision set below
        //this.effects |= EF_LOWPRECISION;
 
        setmodel(this, MDL_Null); // precision set below
        //this.effects |= EF_LOWPRECISION;
 
index ecc1fdf8e631bab2b5d25a074cba602b2cc1f92b..0a0547b58726e64c1c5fde2c7aa3e37b661ba943 100644 (file)
@@ -131,7 +131,7 @@ spawnfunc(func_button)
                this.takedamage = DAMAGE_YES;
        }
        else
                this.takedamage = DAMAGE_YES;
        }
        else
-               this.touch = button_touch;
+               settouch(this, button_touch);
 
        if (!this.speed)
                this.speed = 40;
 
        if (!this.speed)
                this.speed = 40;
index 1b77131e71ef7910ac601107f5e8574932549bab..f28834710dc16a6a2296f92d16a7eb85c1c2fe9f 100644 (file)
@@ -446,7 +446,7 @@ void door_spawnfield(vector fmins, vector fmaxs)
        trigger.solid = SOLID_TRIGGER;
        trigger.owner = self;
 #ifdef SVQC
        trigger.solid = SOLID_TRIGGER;
        trigger.owner = self;
 #ifdef SVQC
-       trigger.touch = door_trigger_touch;
+       settouch(trigger, door_trigger_touch);
 #elif defined(CSQC)
        trigger.trigger_touch = door_trigger_touch;
        trigger.draw = trigger_draw_generic;
 #elif defined(CSQC)
        trigger.trigger_touch = door_trigger_touch;
        trigger.draw = trigger_draw_generic;
@@ -771,7 +771,7 @@ spawnfunc(func_door)
        if (this.items)
                this.wait = -1;
 
        if (this.items)
                this.wait = -1;
 
-       this.touch = door_touch;
+       settouch(this, door_touch);
 
 // LinkDoors can't be done until all of the doors have been spawned, so
 // the sizes can be detected properly.
 
 // LinkDoors can't be done until all of the doors have been spawned, so
 // the sizes can be detected properly.
index ae7918c8287cd4b2acd211ce123a975ad45fb799..77061ecb3e626c6516c2e3d69849fa3909cecff1 100644 (file)
@@ -115,7 +115,7 @@ spawnfunc(func_door_rotating)
        if (this.items)
                this.wait = -1;
 
        if (this.items)
                this.wait = -1;
 
-       this.touch = door_touch;
+       settouch(this, door_touch);
 
 // LinkDoors can't be done until all of the doors have been spawned, so
 // the sizes can be detected properly.
 
 // LinkDoors can't be done until all of the doors have been spawned, so
 // the sizes can be detected properly.
index aa00cd45da6cf7d0001812f403fbe367eb408aa2..f999969556fdbd9d4121211f96853d7a2d1e3524 100644 (file)
@@ -213,7 +213,7 @@ spawnfunc(func_door_secret)
        if (this.noise == "") this.noise = "misc/talk.wav";
        precache_sound(this.noise);
 
        if (this.noise == "") this.noise = "misc/talk.wav";
        precache_sound(this.noise);
 
-       this.touch = secret_touch;
+       settouch(this, secret_touch);
        this.blocked = secret_blocked;
        this.speed = 50;
        this.use = fd_secret_use;
        this.blocked = secret_blocked;
        this.speed = 50;
        this.use = fd_secret_use;
index 570ef3bad23e0c15c9fb844029e7ade4ac571029..a853fb4e246a6c02e958a0961c50217a76e01a4a 100644 (file)
@@ -41,7 +41,7 @@ void func_ladder_link(entity this)
 
 void func_ladder_init(entity this)
 {
 
 void func_ladder_init(entity this)
 {
-       this.touch = func_ladder_touch;
+       settouch(this, func_ladder_touch);
 
        trigger_init(this);
        func_ladder_link(this);
 
        trigger_init(this);
        func_ladder_link(this);
index 710a6db3f573cf44d6eb54c11d397b4aa3bd74eb..ba8a817ef8388f1fe4293c11c0210678f34417b4 100644 (file)
@@ -23,7 +23,7 @@ void plat_spawn_inside_trigger()
        vector tmin, tmax;
 
        trigger = spawn();
        vector tmin, tmax;
 
        trigger = spawn();
-       trigger.touch = plat_center_touch;
+       settouch(trigger, plat_center_touch);
        trigger.movetype = MOVETYPE_NONE;
        trigger.solid = SOLID_TRIGGER;
        trigger.enemy = self;
        trigger.movetype = MOVETYPE_NONE;
        trigger.solid = SOLID_TRIGGER;
        trigger.enemy = self;
index 64fdb4d46b1c655660f2577f033ee673f393971c..68e006c2c097ab0d0b6b852a1b877435146ce72f 100644 (file)
@@ -281,7 +281,7 @@ void teleport_findtarget(entity this)
 
        // now enable touch
 #ifdef SVQC
 
        // now enable touch
 #ifdef SVQC
-       this.touch = Teleport_Touch;
+       settouch(this, Teleport_Touch);
 
        trigger_teleport_link(this);
 #elif defined(CSQC)
 
        trigger_teleport_link(this);
 #elif defined(CSQC)
index 86039d20b45c94c95e9c552609f08810d5812924..f2f8a845f12fd836d849d83875ce9eaac9a16e3c 100644 (file)
@@ -91,7 +91,7 @@ spawnfunc(trigger_gravity)
                return;
 
        EXACTTRIGGER_INIT;
                return;
 
        EXACTTRIGGER_INIT;
-       this.touch = trigger_gravity_touch;
+       settouch(this, trigger_gravity_touch);
        if(this.noise != "")
                precache_sound(this.noise);
 
        if(this.noise != "")
                precache_sound(this.noise);
 
index b58574452209138bea88439532c3e00e68cd3b62..e5a98b8cb81f052f80b031ff0b28882bc9aa2f54 100644 (file)
@@ -30,7 +30,7 @@ spawnfunc(trigger_heal)
        this.active = ACTIVE_ACTIVE;
 
        EXACTTRIGGER_INIT;
        this.active = ACTIVE_ACTIVE;
 
        EXACTTRIGGER_INIT;
-       this.touch = trigger_heal_touch;
+       settouch(this, trigger_heal_touch);
        if (!this.health)
                this.health = 10;
        if (!this.max_health)
        if (!this.health)
                this.health = 10;
        if (!this.max_health)
index efd23a5def458b7770baadfb5f065659bfaa0b7a..8eaf0ec5ef58f554438e7557cf487a78b0c46d56 100644 (file)
@@ -61,7 +61,7 @@ spawnfunc(trigger_hurt)
 {
        EXACTTRIGGER_INIT;
        this.active = ACTIVE_ACTIVE;
 {
        EXACTTRIGGER_INIT;
        this.active = ACTIVE_ACTIVE;
-       this.touch = trigger_hurt_touch;
+       settouch(this, trigger_hurt_touch);
        this.use = trigger_hurt_use;
        this.enemy = world; // I hate you all
        if (!this.dmg)
        this.use = trigger_hurt_use;
        this.enemy = world; // I hate you all
        if (!this.dmg)
index cd98627c82ff39091cd2e9ee8d419a45a6d66cc3..02c253eb78758cebe3f9e0c40eaa98709896915b 100644 (file)
@@ -195,20 +195,20 @@ spawnfunc(trigger_impulse)
                if(!this.strength) this.strength = 2000 * autocvar_g_triggerimpulse_radial_multiplier;
                setorigin(this, this.origin);
                setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius);
                if(!this.strength) this.strength = 2000 * autocvar_g_triggerimpulse_radial_multiplier;
                setorigin(this, this.origin);
                setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius);
-               this.touch = trigger_impulse_touch3;
+               settouch(this, trigger_impulse_touch3);
        }
        else
        {
                if(this.target)
                {
                        if(!this.strength) this.strength = 950 * autocvar_g_triggerimpulse_directional_multiplier;
        }
        else
        {
                if(this.target)
                {
                        if(!this.strength) this.strength = 950 * autocvar_g_triggerimpulse_directional_multiplier;
-                       this.touch = trigger_impulse_touch1;
+                       settouch(this, trigger_impulse_touch1);
                }
                else
                {
                        if(!this.strength) this.strength = 0.9;
                        this.strength = pow(this.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
                }
                else
                {
                        if(!this.strength) this.strength = 0.9;
                        this.strength = pow(this.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
-                       this.touch = trigger_impulse_touch2;
+                       settouch(this, trigger_impulse_touch2);
                }
        }
 
                }
        }
 
index 67fd752207989e7277c176373c5ae1f22a759cd5..f8283b19cc6c85ed93591f0663b01871f67cb8a9 100644 (file)
@@ -262,7 +262,7 @@ void trigger_push_touch()
 
        if (this.spawnflags & PUSH_ONCE)
        {
 
        if (this.spawnflags & PUSH_ONCE)
        {
-               this.touch = func_null;
+               settouch(this, func_null);
                this.think = SUB_Remove_self;
                this.nextthink = time;
        }
                this.think = SUB_Remove_self;
                this.nextthink = time;
        }
@@ -382,7 +382,7 @@ spawnfunc(trigger_push)
 
        this.active = ACTIVE_ACTIVE;
        this.use = trigger_push_use;
 
        this.active = ACTIVE_ACTIVE;
        this.use = trigger_push_use;
-       this.touch = trigger_push_touch;
+       settouch(this, trigger_push_touch);
 
        // normal push setup
        if (!this.speed)
 
        // normal push setup
        if (!this.speed)
index 1ac9a295ae6d8ce40ec7d3477282bdfc23a7253e..e436f2cb1cf1610c63d53b0a617a98cfc2d3be8d 100644 (file)
@@ -156,7 +156,7 @@ spawnfunc(trigger_keylock)
 
        EXACTTRIGGER_INIT;
 
 
        EXACTTRIGGER_INIT;
 
-       this.touch = trigger_keylock_touch;
+       settouch(this, trigger_keylock_touch);
 
        trigger_keylock_link(this);
 }
 
        trigger_keylock_link(this);
 }
index 4e93f805d18a52dbebac839391bd3e0dd38bb095..5edf1dfa542966323582053311fe839568d7b7f1 100644 (file)
@@ -55,7 +55,7 @@ void multi_trigger(entity this)
        else
        {       // we can't just remove (this) here, because this is a touch function
                // called wheil C code is looping through area links...
        else
        {       // we can't just remove (this) here, because this is a touch function
                // called wheil C code is looping through area links...
-               this.touch = func_null;
+               settouch(this, func_null);
        }
 }
 
        }
 }
 
@@ -116,7 +116,7 @@ void multi_eventdamage(entity this, entity inflictor, entity attacker, float dam
 void multi_reset(entity this)
 {
        if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
 void multi_reset(entity this)
 {
        if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
-               this.touch = multi_touch;
+               settouch(this, multi_touch);
        if (this.max_health)
        {
                this.health = this.max_health;
        if (this.max_health)
        {
                this.health = this.max_health;
@@ -178,7 +178,7 @@ spawnfunc(trigger_multiple)
        {
                if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
                {
        {
                if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
                {
-                       this.touch = multi_touch;
+                       settouch(this, multi_touch);
                        setorigin (this, this.origin);  // make sure it links into the world
                }
        }
                        setorigin (this, this.origin);  // make sure it links into the world
                }
        }
index 5cae4ed4e6460d2e6d0ebd7535a9e48a5eea17aa..e6e4c4bf90a2fb8339ab6bb82ed2be6a9569b1bb 100644 (file)
@@ -80,7 +80,7 @@ spawnfunc(trigger_secret)
        spawnfunc_trigger_once(this);
 
        // take over the touch() function, so we can mark secret as found
        spawnfunc_trigger_once(this);
 
        // take over the touch() function, so we can mark secret as found
-       this.touch = trigger_secret_touch;
+       settouch(this, trigger_secret_touch);
        // ignore triggering;
        this.use = func_null;
 }
        // ignore triggering;
        this.use = func_null;
 }
index 4b66f723f1aeada9bf68eade7a4414341e3d6bee..32999b71adb9c829e57926fb4abb0e92ee2694e6 100644 (file)
@@ -121,7 +121,7 @@ spawnfunc(trigger_swamp)
 {
        // Init stuff
        trigger_init(this);
 {
        // Init stuff
        trigger_init(this);
-       this.touch = swamp_touch;
+       settouch(this, swamp_touch);
 
        // Setup default keys, if missing
        if(this.dmg <= 0)
 
        // Setup default keys, if missing
        if(this.dmg <= 0)
index f8101535e242b6b82b698fb9d9a2eea11815ad32..36283fc814de2d547278f9d7e513983341b98ffc 100644 (file)
@@ -472,7 +472,7 @@ entity turret_projectile(Sound _snd, float _size, float _health, float _death, f
        proj.bot_dodge    = true;
        proj.bot_dodgerating = self.shot_dmg;
        proj.think                = turret_projectile_explode;
        proj.bot_dodge    = true;
        proj.bot_dodgerating = self.shot_dmg;
        proj.think                = turret_projectile_explode;
-       proj.touch                = turret_projectile_touch;
+       settouch(proj, turret_projectile_touch);
        proj.nextthink    = time + 9;
        proj.movetype           = MOVETYPE_FLYMISSILE;
        proj.velocity           = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
        proj.nextthink    = time + 9;
        proj.movetype           = MOVETYPE_FLYMISSILE;
        proj.velocity           = normalize(self.tur_shotdir_updated + randomvec() * self.shot_spread) * self.shot_speed;
index aa1322c4411b7d5d37339afa57e3b95afce5f884..01dced5f3c403f0ec3af2ad263290d7ba64186c1 100644 (file)
@@ -20,5 +20,5 @@ spawnfunc(turret_targettrigger)
 
     WITHSELF(this, InitTrigger());
 
 
     WITHSELF(this, InitTrigger());
 
-    this.touch = turret_targettrigger_touch;
+    settouch(this, turret_targettrigger_touch);
 }
 }
index afe85bf8ce5ca1c177181381762d072a76912c02..b923d0fc30a7e5bb271a078bf62593f69321107d 100644 (file)
@@ -258,7 +258,7 @@ void walker_fire_rocket(vector org)
     rocket.movetype               = MOVETYPE_FLY;
     rocket.velocity               = normalize((v_forward + v_up * 0.5) + (randomvec() * 0.2)) * (autocvar_g_turrets_unit_walker_rocket_speed);
     rocket.angles                       = vectoangles(rocket.velocity);
     rocket.movetype               = MOVETYPE_FLY;
     rocket.velocity               = normalize((v_forward + v_up * 0.5) + (randomvec() * 0.2)) * (autocvar_g_turrets_unit_walker_rocket_speed);
     rocket.angles                       = vectoangles(rocket.velocity);
-    rocket.touch                         = walker_rocket_explode;
+    settouch(rocket, walker_rocket_explode);
     rocket.flags                         = FL_PROJECTILE;
     rocket.solid                         = SOLID_BBOX;
     rocket.max_health           = time + 9;
     rocket.flags                         = FL_PROJECTILE;
     rocket.solid                         = SOLID_BBOX;
     rocket.max_health           = time + 9;
index eac4b67626a0b7f61fe6b97795a4a3c9ba233ad6..bfb735197069f74cd86834a98f0c9a14c3dfb340 100644 (file)
@@ -261,7 +261,7 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
        proj.bot_dodge          = true;
        proj.bot_dodgerating  = _dmg;
        proj.velocity            = _vel;
        proj.bot_dodge          = true;
        proj.bot_dodgerating  = _dmg;
        proj.velocity            = _vel;
-       proj.touch                      = vehicles_projectile_explode;
+       settouch(proj, vehicles_projectile_explode);
        proj.use                          = vehicles_projectile_explode_use;
        proj.owner                      = this;
        proj.realowner          = _owner;
        proj.use                          = vehicles_projectile_explode_use;
        proj.owner                      = this;
        proj.realowner          = _owner;
@@ -327,7 +327,7 @@ entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag,
        {
                _gib.think = vehicles_gib_explode;
                _gib.nextthink = time + random() * _explode;
        {
                _gib.think = vehicles_gib_explode;
                _gib.nextthink = time + random() * _explode;
-               _gib.touch = vehicles_gib_explode;
+               settouch(_gib, vehicles_gib_explode);
        }
        else
        {
        }
        else
        {
@@ -1113,7 +1113,7 @@ void vehicles_spawn()
        self.vehicle_hudmodel.viewmodelforclient = self;
 
        self.owner                              = world;
        self.vehicle_hudmodel.viewmodelforclient = self;
 
        self.owner                              = world;
-       self.touch                              = vehicles_touch;
+       settouch(self, vehicles_touch);
        self.event_damage               = vehicles_damage;
        self.iscreature                 = true;
        self.teleportable               = false; // no teleporting for vehicles, too buggy
        self.event_damage               = vehicles_damage;
        self.iscreature                 = true;
        self.teleportable               = false; // no teleporting for vehicles, too buggy
@@ -1210,7 +1210,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        this.vehicleid                          = info.vehicleid;
        this.PlayerPhysplug                     = info.PlayerPhysplug;
        this.event_damage                       = func_null;
        this.vehicleid                          = info.vehicleid;
        this.PlayerPhysplug                     = info.PlayerPhysplug;
        this.event_damage                       = func_null;
-       this.touch                                      = vehicles_touch;
+       settouch(this, vehicles_touch);
        this.think                                      = vehicles_spawn;
        this.nextthink                          = time;
        this.effects                            = EF_NODRAW;
        this.think                                      = vehicles_spawn;
        this.nextthink                          = time;
        this.effects                            = EF_NODRAW;
index 724d23d74af68ab1a776e0e0dd2b848378a924d6..e61ab440d428eb3decc28a0dec73b539e773c1e4 100644 (file)
@@ -650,7 +650,7 @@ void bumblebee_exit(float eject)
                return;
        }
 
                return;
        }
 
-       self.touch = vehicles_touch;
+       settouch(self, vehicles_touch);
 
        if(!IS_DEAD(self))
        {
 
        if(!IS_DEAD(self))
        {
@@ -730,7 +730,7 @@ METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
 METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
 {
     SELFPARAM();
 METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
 {
     SELFPARAM();
-    self.touch = bumblebee_touch;
+    settouch(self, bumblebee_touch);
     self.nextthink = 0;
     self.movetype = MOVETYPE_BOUNCEMISSILE;
 }
     self.nextthink = 0;
     self.movetype = MOVETYPE_BOUNCEMISSILE;
 }
@@ -751,7 +751,7 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
                entity oldother = other;
                other = e;
                self.phase = 0;
                entity oldother = other;
                other = e;
                self.phase = 0;
-               self.touch();
+               gettouch(self)();
                other = oldother;
                return;
         }
                other = oldother;
                return;
         }
@@ -763,7 +763,7 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
                entity oldother = other;
                other = e;
                self.phase = 0;
                entity oldother = other;
                other = e;
                self.phase = 0;
-               self.touch();
+               gettouch(self)();
                other = oldother;
             return;
         }
                other = oldother;
             return;
         }
@@ -793,9 +793,9 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
     entity _body = vehicle_tossgib(instance, instance, instance.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
 
     if(random() > 0.5)
     entity _body = vehicle_tossgib(instance, instance, instance.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
 
     if(random() > 0.5)
-        _body.touch = bumblebee_blowup;
+        settouch(_body, bumblebee_blowup);
     else
     else
-        _body.touch = func_null;
+        settouch(_body, func_null);
 
     _body.think = bumblebee_diethink;
     _body.nextthink = time;
 
     _body.think = bumblebee_diethink;
     _body.nextthink = time;
@@ -817,7 +817,7 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
     instance.colormod          = '0 0 0';
     instance.avelocity         = '0 0 0';
     instance.velocity          = '0 0 0';
     instance.colormod          = '0 0 0';
     instance.avelocity         = '0 0 0';
     instance.velocity          = '0 0 0';
-    instance.touch                     = func_null;
+    settouch(instance, func_null);
     instance.nextthink                 = 0;
 
     setorigin(instance, instance.pos1);
     instance.nextthink                 = 0;
 
     setorigin(instance, instance.pos1);
index 26221f5edcd2b812dc9f6cd02394b54e384df763..e79cab9ecaf59c8a46f037c3a001ede476d67fa6 100644 (file)
@@ -638,7 +638,7 @@ METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
     instance.wait                      = time;
     instance.delay                     = 2 + time + random() * 3;
     instance.cnt                       = 1 + random() * 2;
     instance.wait                      = time;
     instance.delay                     = 2 + time + random() * 3;
     instance.cnt                       = 1 + random() * 2;
-    instance.touch                     = racer_deadtouch;
+    settouch(instance, racer_deadtouch);
 
     Send_Effect(EFFECT_EXPLOSION_MEDIUM, instance.origin, '0 0 0', 1);
 
 
     Send_Effect(EFFECT_EXPLOSION_MEDIUM, instance.origin, '0 0 0', 1);
 
index d91754024d93b544957ff3c6a404d5da01bc6594..76deddd9df9cfaaf6bca4f6688ad70c2f84ab90b 100644 (file)
@@ -534,7 +534,7 @@ void raptor_blowup()
        self.velocity      = '0 0 0';
 
        setorigin(self, self.pos1);
        self.velocity      = '0 0 0';
 
        setorigin(self, self.pos1);
-       self.touch = func_null;
+       settouch(self, func_null);
        self.nextthink = 0;
 }
 
        self.nextthink = 0;
 }
 
@@ -656,7 +656,7 @@ METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
     instance.avelocity -= '0 0.5 1' * (random() * 400);
 
     instance.colormod = '-0.5 -0.5 -0.5';
     instance.avelocity -= '0 0.5 1' * (random() * 400);
 
     instance.colormod = '-0.5 -0.5 -0.5';
-    instance.touch = raptor_blowup;
+    settouch(instance, raptor_blowup);
 }
 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
 {
 }
 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
 {
index 16b6eb8740ffd1b397ec6a06203432f7aa1b4a1a..14cc7c0ff31f001ee6f31f6dfdaa5cedd24709d9 100644 (file)
@@ -78,7 +78,7 @@ METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weapone
             _flare.event_damage = raptor_flare_damage;
             _flare.health = 20;
             _flare.tur_impacttime = time + autocvar_g_vehicle_raptor_flare_lifetime;
             _flare.event_damage = raptor_flare_damage;
             _flare.health = 20;
             _flare.tur_impacttime = time + autocvar_g_vehicle_raptor_flare_lifetime;
-            _flare.touch = raptor_flare_touch;
+            settouch(_flare, raptor_flare_touch);
         }
         weapon_thinkf(player, weaponentity, WFRAME_FIRE2, 0, w_ready);
     }
         }
         weapon_thinkf(player, weaponentity, WFRAME_FIRE2, 0, w_ready);
     }
@@ -129,7 +129,7 @@ void raptor_bomb_burst()
         setorigin(bomblet, self.origin);
 
         bomblet.movetype       = MOVETYPE_TOSS;
         setorigin(bomblet, self.origin);
 
         bomblet.movetype       = MOVETYPE_TOSS;
-        bomblet.touch     = raptor_bomblet_touch;
+        settouch(bomblet, raptor_bomblet_touch);
         bomblet.think     = raptor_bomblet_boom;
         bomblet.nextthink   = time + 5;
         bomblet.owner     = self.owner;
         bomblet.think     = raptor_bomblet_boom;
         bomblet.nextthink   = time + 5;
         bomblet.owner     = self.owner;
@@ -157,7 +157,8 @@ void raptor_bombdrop()
 
     bomb_1.movetype     = bomb_2.movetype   = MOVETYPE_BOUNCE;
     bomb_1.velocity     = bomb_2.velocity   = self.velocity;
 
     bomb_1.movetype     = bomb_2.movetype   = MOVETYPE_BOUNCE;
     bomb_1.velocity     = bomb_2.velocity   = self.velocity;
-    bomb_1.touch               = bomb_2.touch    = raptor_bomb_burst;
+    settouch(bomb_1, raptor_bomb_burst);
+    settouch(bomb_2, raptor_bomb_burst);
     bomb_1.think               = bomb_2.think    = raptor_bomb_burst;
     bomb_1.cnt           = bomb_2.cnt          = time + 10;
 
     bomb_1.think               = bomb_2.think    = raptor_bomb_burst;
     bomb_1.cnt           = bomb_2.cnt          = time + 10;
 
index 57f1310c4b8cf618f21b8f12b2f2ba39aa13e7a4..864c302d1db7aabfb9d75289a2f722a8b2c69a17 100644 (file)
@@ -571,7 +571,7 @@ METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
     instance.health                            = 0;
     instance.event_damage              = func_null;
     instance.takedamage                        = DAMAGE_NO;
     instance.health                            = 0;
     instance.event_damage              = func_null;
     instance.takedamage                        = DAMAGE_NO;
-    instance.touch                             = func_null;
+    settouch(instance, func_null);
     instance.cnt                               = 3.4 + time + random() * 2;
     instance.think                             = spiderbot_blowup;
     instance.nextthink                 = time;
     instance.cnt                               = 3.4 + time + random() * 2;
     instance.think                             = spiderbot_blowup;
     instance.nextthink                 = time;
index d8effdeb80953eed8bbb4af41c166600cc56fa53..a033d2ab0f4fae1fc645753ea86f16b8f5dde4fe 100644 (file)
@@ -286,7 +286,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep)
        missile.event_damage = W_Arc_Bolt_Damage;
        missile.damagedbycontents = true;
 
        missile.event_damage = W_Arc_Bolt_Damage;
        missile.damagedbycontents = true;
 
-       missile.touch = W_Arc_Bolt_Touch;
+       settouch(missile, W_Arc_Bolt_Touch);
        missile.use = W_Arc_Bolt_Explode_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
        missile.use = W_Arc_Bolt_Explode_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
index 24d532934d38ceaec6f2c409b3113cf2299b5d3b..56465e5c8809b62146e684779d1e1c3676a2a130 100644 (file)
@@ -135,7 +135,7 @@ void W_Blaster_Attack(
        //missile.glow_color = 250; // 244, 250
        //missile.glow_size = 120;
 
        //missile.glow_color = 250; // 244, 250
        //missile.glow_size = 120;
 
-       missile.touch = W_Blaster_Touch;
+       settouch(missile, W_Blaster_Touch);
        missile.flags = FL_PROJECTILE;
        missile.missile_flags = MIF_SPLASH;
        missile.projectiledeathtype = atk_deathtype;
        missile.flags = FL_PROJECTILE;
        missile.missile_flags = MIF_SPLASH;
        missile.projectiledeathtype = atk_deathtype;
index b4229926434d4a07ff13cb9952810bcafb6ebabe..fa7b825846a59388a5553bdc4b02827535ae2fa0 100644 (file)
@@ -414,7 +414,7 @@ void W_Crylink_Attack(Weapon thiswep)
                }
                s = s * WEP_CVAR_PRI(crylink, spread) * g_weaponspreadfactor;
                W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false);
                }
                s = s * WEP_CVAR_PRI(crylink, spread) * g_weaponspreadfactor;
                W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false);
-               proj.touch = W_Crylink_Touch;
+               settouch(proj, W_Crylink_Touch);
 
                proj.think = W_Crylink_Fadethink;
                if(counter == 0)
 
                proj.think = W_Crylink_Fadethink;
                if(counter == 0)
@@ -530,7 +530,7 @@ void W_Crylink_Attack2(Weapon thiswep)
                }
 
                W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false);
                }
 
                W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false);
-               proj.touch = W_Crylink_Touch;
+               settouch(proj, W_Crylink_Touch);
                proj.think = W_Crylink_Fadethink;
                if(counter == (shots - 1) / 2)
                {
                proj.think = W_Crylink_Fadethink;
                if(counter == (shots - 1) / 2)
                {
index 4e7b5cf1009fe0d5b0c0706f5b61c22f49298585..8c59a7938ac09db9341fae2b7e0085e3eb2e04a1 100644 (file)
@@ -384,7 +384,7 @@ void W_Devastator_Attack(Weapon thiswep)
        W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0);
        missile.angles = vectoangles(missile.velocity);
 
        W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0);
        missile.angles = vectoangles(missile.velocity);
 
-       missile.touch = W_Devastator_Touch;
+       settouch(missile, W_Devastator_Touch);
        missile.think = W_Devastator_Think;
        missile.nextthink = time;
        missile.cnt = time + WEP_CVAR(devastator, lifetime);
        missile.think = W_Devastator_Think;
        missile.nextthink = time;
        missile.cnt = time + WEP_CVAR(devastator, lifetime);
index b977ddb910970eede1b8b9d88515f966f8ac0a92..9e13fe2fa07f3d356d2dd3e4ebe0b6c46bbeea97 100644 (file)
@@ -288,7 +288,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep)
        proj.movetype = MOVETYPE_FLY;
        W_SetupProjVelocity_PRI(proj, electro);
        proj.angles = vectoangles(proj.velocity);
        proj.movetype = MOVETYPE_FLY;
        W_SetupProjVelocity_PRI(proj, electro);
        proj.angles = vectoangles(proj.velocity);
-       proj.touch = W_Electro_TouchExplode;
+       settouch(proj, W_Electro_TouchExplode);
        setsize(proj, '0 0 -3', '0 0 -3');
        proj.flags = FL_PROJECTILE;
        proj.missile_flags = MIF_SPLASH;
        setsize(proj, '0 0 -3', '0 0 -3');
        proj.flags = FL_PROJECTILE;
        proj.missile_flags = MIF_SPLASH;
@@ -387,7 +387,7 @@ void W_Electro_Attack_Orb(Weapon thiswep)
        //proj.glow_color = 45;
        proj.movetype = MOVETYPE_BOUNCE;
        W_SetupProjVelocity_UP_SEC(proj, electro);
        //proj.glow_color = 45;
        proj.movetype = MOVETYPE_BOUNCE;
        W_SetupProjVelocity_UP_SEC(proj, electro);
-       proj.touch = W_Electro_Orb_Touch;
+       settouch(proj, W_Electro_Orb_Touch);
        setsize(proj, '0 0 -4', '0 0 -4');
        proj.takedamage = DAMAGE_YES;
        proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale);
        setsize(proj, '0 0 -4', '0 0 -4');
        proj.takedamage = DAMAGE_YES;
        proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale);
index 245a05ff3c5afae4dcd3a3748120930e74e7502d..a180ede56463f150045c2491da7423e8b943a31a 100644 (file)
@@ -216,7 +216,7 @@ void W_Fireball_Attack1()
        proj.movetype = MOVETYPE_FLY;
        W_SetupProjVelocity_PRI(proj, fireball);
        proj.angles = vectoangles(proj.velocity);
        proj.movetype = MOVETYPE_FLY;
        W_SetupProjVelocity_PRI(proj, fireball);
        proj.angles = vectoangles(proj.velocity);
-       proj.touch = W_Fireball_TouchExplode;
+       settouch(proj, W_Fireball_TouchExplode);
        setsize(proj, '-16 -16 -16', '16 16 16');
        proj.flags = FL_PROJECTILE;
     proj.missile_flags = MIF_SPLASH | MIF_PROXY;
        setsize(proj, '-16 -16 -16', '16 16 16');
        proj.flags = FL_PROJECTILE;
     proj.missile_flags = MIF_SPLASH | MIF_PROXY;
@@ -337,7 +337,7 @@ void W_Fireball_Attack2()
        proj.bot_dodgerating = WEP_CVAR_SEC(fireball, damage);
        proj.movetype = MOVETYPE_BOUNCE;
        proj.projectiledeathtype = WEP_FIREBALL.m_id | HITTYPE_SECONDARY;
        proj.bot_dodgerating = WEP_CVAR_SEC(fireball, damage);
        proj.movetype = MOVETYPE_BOUNCE;
        proj.projectiledeathtype = WEP_FIREBALL.m_id | HITTYPE_SECONDARY;
-       proj.touch = W_Fireball_Firemine_Touch;
+       settouch(proj, W_Fireball_Firemine_Touch);
        PROJECTILE_MAKETRIGGER(proj);
        setsize(proj, '-4 -4 -4', '4 4 4');
        setorigin(proj, w_shotorg);
        PROJECTILE_MAKETRIGGER(proj);
        setsize(proj, '-4 -4 -4', '4 4 4');
        setorigin(proj, w_shotorg);
index 54539f7272248f91c037387d3fa376a81ea5655d..de576e6096ee6b0181fa7e1ad207e56a199b6575 100644 (file)
@@ -155,7 +155,7 @@ void W_Hagar_Attack(Weapon thiswep)
        missile.event_damage = W_Hagar_Damage;
        missile.damagedbycontents = true;
 
        missile.event_damage = W_Hagar_Damage;
        missile.damagedbycontents = true;
 
-       missile.touch = W_Hagar_Touch;
+       settouch(missile, W_Hagar_Touch);
        missile.use = W_Hagar_Explode_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
        missile.use = W_Hagar_Explode_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
@@ -197,7 +197,7 @@ void W_Hagar_Attack2(Weapon thiswep)
        missile.event_damage = W_Hagar_Damage;
        missile.damagedbycontents = true;
 
        missile.event_damage = W_Hagar_Damage;
        missile.damagedbycontents = true;
 
-       missile.touch = W_Hagar_Touch2;
+       settouch(missile, W_Hagar_Touch2);
        missile.cnt = 0;
        missile.use = W_Hagar_Explode2_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.cnt = 0;
        missile.use = W_Hagar_Explode2_use;
        missile.think = adaptor_think2use_hittype_splash;
@@ -256,7 +256,7 @@ void W_Hagar_Attack2_Load_Release(.entity weaponentity)
                missile.event_damage = W_Hagar_Damage;
                missile.damagedbycontents = true;
 
                missile.event_damage = W_Hagar_Damage;
                missile.damagedbycontents = true;
 
-               missile.touch = W_Hagar_Touch; // not bouncy
+               settouch(missile, W_Hagar_Touch); // not bouncy
                missile.use = W_Hagar_Explode2_use;
                missile.think = adaptor_think2use_hittype_splash;
                missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
                missile.use = W_Hagar_Explode2_use;
                missile.think = adaptor_think2use_hittype_splash;
                missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
index 932f3d17da42f6830c169fbda0b7952bcd1b95a9..1fd9e08321a79460d48c43725299ba104838b2bf 100644 (file)
@@ -104,7 +104,7 @@ void W_HLAC_Attack(Weapon thiswep)
        W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(hlac, speed), spread);
        //missile.angles = vectoangles(missile.velocity); // csqc
 
        W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(hlac, speed), spread);
        //missile.angles = vectoangles(missile.velocity); // csqc
 
-       missile.touch = W_HLAC_Touch;
+       settouch(missile, W_HLAC_Touch);
        missile.think = SUB_Remove_self;
 
     missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
        missile.think = SUB_Remove_self;
 
     missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
@@ -146,7 +146,7 @@ void W_HLAC_Attack2()
        W_SetupProjVelocity_Basic(missile, WEP_CVAR_SEC(hlac, speed), spread);
        //missile.angles = vectoangles(missile.velocity); // csqc
 
        W_SetupProjVelocity_Basic(missile, WEP_CVAR_SEC(hlac, speed), spread);
        //missile.angles = vectoangles(missile.velocity); // csqc
 
-       missile.touch = W_HLAC_Touch;
+       settouch(missile, W_HLAC_Touch);
        missile.think = SUB_Remove_self;
 
     missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
        missile.think = SUB_Remove_self;
 
     missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
index 206223d011889e967253bcdc69abc308781a0cc5..77e0e1973d4b20469a14c8e03a810bd7c85ce903 100644 (file)
@@ -102,7 +102,7 @@ void W_Hook_ExplodeThink()
 void W_Hook_Explode2()
 {SELFPARAM();
        self.event_damage = func_null;
 void W_Hook_Explode2()
 {SELFPARAM();
        self.event_damage = func_null;
-       self.touch = func_null;
+       settouch(self, func_null);
        self.effects |= EF_NODRAW;
 
        self.think = W_Hook_ExplodeThink;
        self.effects |= EF_NODRAW;
 
        self.think = W_Hook_ExplodeThink;
@@ -161,7 +161,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
        gren.nextthink = time + WEP_CVAR_SEC(hook, lifetime);
        gren.think = adaptor_think2use_hittype_splash;
        gren.use = W_Hook_Explode2_use;
        gren.nextthink = time + WEP_CVAR_SEC(hook, lifetime);
        gren.think = adaptor_think2use_hittype_splash;
        gren.use = W_Hook_Explode2_use;
-       gren.touch = W_Hook_Touch2;
+       settouch(gren, W_Hook_Touch2);
 
        gren.takedamage = DAMAGE_YES;
        gren.health = WEP_CVAR_SEC(hook, health);
 
        gren.takedamage = DAMAGE_YES;
        gren.health = WEP_CVAR_SEC(hook, health);
index 960e1d4a7547c6155f51dcf718a7734af7448e2d..f397e9e99b93f5ddc4a2e0575170f77639675a1e 100644 (file)
@@ -96,7 +96,7 @@ void W_MineLayer_Stick(entity to)
 
        newmine.mine_time = self.mine_time;
 
 
        newmine.mine_time = self.mine_time;
 
-       newmine.touch = func_null;
+       settouch(newmine, func_null);
        newmine.think = W_MineLayer_Think;
        newmine.nextthink = time;
        newmine.cnt = self.cnt;
        newmine.think = W_MineLayer_Think;
        newmine.nextthink = time;
        newmine.cnt = self.cnt;
@@ -355,7 +355,7 @@ void W_MineLayer_Attack(Weapon thiswep)
        W_SetupProjVelocity_Basic(mine, WEP_CVAR(minelayer, speed), 0);
        mine.angles = vectoangles(mine.velocity);
 
        W_SetupProjVelocity_Basic(mine, WEP_CVAR(minelayer, speed), 0);
        mine.angles = vectoangles(mine.velocity);
 
-       mine.touch = W_MineLayer_Touch;
+       settouch(mine, W_MineLayer_Touch);
        mine.think = W_MineLayer_Think;
        mine.nextthink = time;
        mine.cnt = (WEP_CVAR(minelayer, lifetime) - WEP_CVAR(minelayer, lifetime_countdown));
        mine.think = W_MineLayer_Think;
        mine.nextthink = time;
        mine.cnt = (WEP_CVAR(minelayer, lifetime) - WEP_CVAR(minelayer, lifetime_countdown));
index 1e1c924e6d6fa94e3d334ccf53b35ef1ed4d58d2..0fc5dd9bd266dd58ad9d419e86f136a7bca03a7f 100644 (file)
@@ -237,7 +237,7 @@ void W_Mortar_Attack(Weapon thiswep)
        gren.nextthink = time;
        gren.think = W_Mortar_Grenade_Think1;
        gren.use = W_Mortar_Grenade_Explode_use;
        gren.nextthink = time;
        gren.think = W_Mortar_Grenade_Think1;
        gren.use = W_Mortar_Grenade_Explode_use;
-       gren.touch = W_Mortar_Grenade_Touch1;
+       settouch(gren, W_Mortar_Grenade_Touch1);
 
        gren.takedamage = DAMAGE_YES;
        gren.health = WEP_CVAR_PRI(mortar, health);
 
        gren.takedamage = DAMAGE_YES;
        gren.health = WEP_CVAR_PRI(mortar, health);
@@ -284,7 +284,7 @@ void W_Mortar_Attack2(Weapon thiswep)
        gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime);
        gren.think = adaptor_think2use_hittype_splash;
        gren.use = W_Mortar_Grenade_Explode2_use;
        gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime);
        gren.think = adaptor_think2use_hittype_splash;
        gren.use = W_Mortar_Grenade_Explode2_use;
-       gren.touch = W_Mortar_Grenade_Touch2;
+       settouch(gren, W_Mortar_Grenade_Touch2);
 
        gren.takedamage = DAMAGE_YES;
        gren.health = WEP_CVAR_SEC(mortar, health);
 
        gren.takedamage = DAMAGE_YES;
        gren.health = WEP_CVAR_SEC(mortar, health);
index 60d2a8b70a778425de4503357cdc9898bf6a4e93..867dd286c799855c7848834198f4f126ef530018 100644 (file)
@@ -266,7 +266,7 @@ void W_Porto_Attack(float type)
 
        gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime);
        gren.think = W_Porto_Think;
 
        gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime);
        gren.think = W_Porto_Think;
-       gren.touch = W_Porto_Touch;
+       settouch(gren, W_Porto_Touch);
 
        if(self.items & ITEM_Strength.m_itemid)
                W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0);
 
        if(self.items & ITEM_Strength.m_itemid)
                W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0);
index ce0aacd2d518af22550a913fe61819991ddbe55d..448c4363ab076fa7f1fc9d55462fa70e8cb0bf66 100644 (file)
@@ -267,7 +267,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target)
        missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage);
 
        missile.think           = W_Seeker_Missile_Think;
        missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage);
 
        missile.think           = W_Seeker_Missile_Think;
-       missile.touch           = W_Seeker_Missile_Touch;
+       settouch(missile, W_Seeker_Missile_Touch);
        missile.event_damage    = W_Seeker_Missile_Damage;
        missile.nextthink       = time;// + 0.2;// + cvar("g_balance_seeker_missile_activate_delay");
        missile.cnt             = time + WEP_CVAR(seeker, missile_lifetime);
        missile.event_damage    = W_Seeker_Missile_Damage;
        missile.nextthink       = time;// + 0.2;// + cvar("g_balance_seeker_missile_activate_delay");
        missile.cnt             = time + WEP_CVAR(seeker, missile_lifetime);
@@ -359,7 +359,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep)
        missile.owner                   = missile.realowner = self;
        missile.bot_dodge               = true;
        missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
        missile.owner                   = missile.realowner = self;
        missile.bot_dodge               = true;
        missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
-       missile.touch                   = W_Seeker_Flac_Explode;
+       settouch(missile, W_Seeker_Flac_Explode);
        missile.use                     = W_Seeker_Flac_Explode_use;
        missile.think                   = adaptor_think2use_hittype_splash;
        missile.nextthink               = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand);
        missile.use                     = W_Seeker_Flac_Explode_use;
        missile.think                   = adaptor_think2use_hittype_splash;
        missile.nextthink               = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand);
@@ -572,7 +572,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
        missile.owner           = missile.realowner = self;
        missile.bot_dodge       = true;
        missile.bot_dodgerating = 50;
        missile.owner           = missile.realowner = self;
        missile.bot_dodge       = true;
        missile.bot_dodgerating = 50;
-       missile.touch           = W_Seeker_Tag_Touch;
+       settouch(missile, W_Seeker_Tag_Touch);
        missile.think           = SUB_Remove_self;
        missile.nextthink       = time + WEP_CVAR(seeker, tag_lifetime);
        missile.movetype        = MOVETYPE_FLY;
        missile.think           = SUB_Remove_self;
        missile.nextthink       = time + WEP_CVAR(seeker, tag_lifetime);
        missile.movetype        = MOVETYPE_FLY;
index cd05a8682b92fb30a6870c024c8afa4622febe9a..beba679956196ec75bcb8df0d55fc7cc6cc4a9ee 100644 (file)
@@ -282,7 +282,7 @@ void W_RocketMinsta_Attack2()
                proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
                proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
         proj.angles = vectoangles(proj.velocity);
                proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
                proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
         proj.angles = vectoangles(proj.velocity);
-        proj.touch = W_RocketMinsta_Laser_Touch;
+        settouch(proj, W_RocketMinsta_Laser_Touch);
         setsize(proj, '0 0 -3', '0 0 -3');
         proj.flags = FL_PROJECTILE;
         proj.missile_flags = MIF_SPLASH;
         setsize(proj, '0 0 -3', '0 0 -3');
         proj.flags = FL_PROJECTILE;
         proj.missile_flags = MIF_SPLASH;
@@ -332,7 +332,7 @@ void W_RocketMinsta_Attack3 ()
                proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
                proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
         proj.angles = vectoangles(proj.velocity);
                proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
                proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
         proj.angles = vectoangles(proj.velocity);
-        proj.touch = W_RocketMinsta_Laser_Touch;
+        settouch(proj, W_RocketMinsta_Laser_Touch);
         setsize(proj, '0 0 -3', '0 0 -3');
         proj.flags = FL_PROJECTILE;
         proj.missile_flags = MIF_SPLASH;
         setsize(proj, '0 0 -3', '0 0 -3');
         proj.flags = FL_PROJECTILE;
         proj.missile_flags = MIF_SPLASH;
index ecb1d6fe563242f07583b5cb725842cfc8ea9272..6b7201dcfeb6fb7873d48828ea39e174c8b3581a 100644 (file)
     #define WITHSELF(value, block) block
 #endif
 
     #define WITHSELF(value, block) block
 #endif
 
-#define SELFWRAP(T, R) \
-    [[alias(#T)]] .R() __##T; \
-    .R(entity this) self##T; \
-    R T##_self() { SELFPARAM(); return this.self##T(this); }
+#define SELFWRAP(T, R, args, forward) \
+    .R() T; \
+    .R() __##T = T; \
+    .R args self##T; \
+    R T##_self() { SELFPARAM(); return this.self##T forward; }
 
 noref entity _selftemp;
 #define SELFWRAP_SET(T, e, f) \
 
 noref entity _selftemp;
 #define SELFWRAP_SET(T, e, f) \
-    (_selftemp = (e), _selftemp.__##T = T##_self, _selftemp.self##T = f)
+    (_selftemp = (e), _selftemp.__##T = ((f) ? T##_self : func_null), _selftemp.self##T = (f))
+#define SELFWRAP_GET(T, e) \
+    (0, (e).self##T)
+#define _SELFWRAP_SET(T, e, f) \
+    ((e).__##T = (f))
+#define _SELFWRAP_GET(T, e) \
+    (0, (e).__##T)
 
 
-SELFWRAP(think, void)
+SELFWRAP(think, void, (entity this), (this))
 #define setthink(e, f) SELFWRAP_SET(think, e, f)
 
 #define setthink(e, f) SELFWRAP_SET(think, e, f)
 
-SELFWRAP(touch, void)
-#define settouch(e, f) SELFWRAP_SET(touch, e, f)
+SELFWRAP(touch, void, (entity this), (this))
+#define settouch(e, f) _SELFWRAP_SET(touch, e, f)
+#define gettouch(e) _SELFWRAP_GET(touch, e)
 
 
-SELFWRAP(predraw, void)
+SELFWRAP(predraw, void, (entity this), (this))
 #define setpredraw(e, f) SELFWRAP_SET(predraw, e, f)
 #define setpredraw(e, f) SELFWRAP_SET(predraw, e, f)
+
+#ifndef MENUQC
+void adaptor_think2touch() { SELFPARAM(); WITH(entity, other, NULL, gettouch(this)()); }
+void adaptor_think2use() { SELFPARAM(); if (this.use) this.use(this, NULL, NULL); }
+#endif
index 97abe0e6d14f4e9c9f833d5ad504d71463e6e902..ddaa41657907c285f919ccd3cad6f8f6dabf17d8 100644 (file)
@@ -719,7 +719,7 @@ void WarpZone_InitStep_FinalizeTransform(entity this)
 
        warpzone_warpzones_exist = 1;
        WarpZone_SetUp(this, this.warpzone_origin, this.warpzone_angles, this.enemy.warpzone_origin, this.enemy.warpzone_angles);
 
        warpzone_warpzones_exist = 1;
        WarpZone_SetUp(this, this.warpzone_origin, this.warpzone_angles, this.enemy.warpzone_origin, this.enemy.warpzone_angles);
-       this.touch = WarpZone_Touch;
+       settouch(this, WarpZone_Touch);
        this.SendFlags = 0xFFFFFF;
        if(this.spawnflags & 1)
        {
        this.SendFlags = 0xFFFFFF;
        if(this.spawnflags & 1)
        {
index 86fb14b29c997be7a56166fd57958a43b274c59f..774e143e1e32ca293e9e70c5cbc0510576731e61 100644 (file)
@@ -99,7 +99,7 @@ void GrapplingHook_Stop()
        self.state = 1;
        self.think = GrapplingHookThink;
        self.nextthink = time;
        self.state = 1;
        self.think = GrapplingHookThink;
        self.nextthink = time;
-       self.touch = func_null;
+       settouch(self, func_null);
        self.velocity = '0 0 0';
        self.movetype = MOVETYPE_NONE;
        self.hook_length = -1;
        self.velocity = '0 0 0';
        self.movetype = MOVETYPE_NONE;
        self.hook_length = -1;
@@ -385,7 +385,7 @@ void FireGrapplingHook ()
        missile.angles = vectoangles (missile.velocity);
        //missile.glow_color = 250; // 244, 250
        //missile.glow_size = 120;
        missile.angles = vectoangles (missile.velocity);
        //missile.glow_color = 250; // 244, 250
        //missile.glow_size = 120;
-       missile.touch = GrapplingHookTouch;
+       settouch(missile, GrapplingHookTouch);
        missile.think = GrapplingHookThink;
        missile.nextthink = time;
 
        missile.think = GrapplingHookThink;
        missile.nextthink = time;
 
index c129127c3ce05e262c1dd01fb21d1b252fb5a637..ca4d8cf0895e692d86658c58468cfc87b3ff05c5 100644 (file)
@@ -122,7 +122,7 @@ void spawn_item_key(entity this)
                WITHSELF(this, droptofloor());
        }
 
                WITHSELF(this, droptofloor());
        }
 
-       this.touch = item_key_touch;
+       settouch(this, item_key_touch);
 };
 
 
 };
 
 
index 95ec703dbd873ebfe51dfe838bf7bfbb533e4b60..5802a5b97e981cac2c008c76bd0f27259e7c335d 100644 (file)
@@ -958,20 +958,7 @@ void EliminatedPlayers_Init(float(entity) isEliminated_func)
 }
 
 
 }
 
 
-void adaptor_think2touch()
-{SELFPARAM();
-    entity o;
-    o = other;
-    other = world;
-    self.touch();
-    other = o;
-}
 
 
-void adaptor_think2use()
-{SELFPARAM();
-       if(this.use)
-       this.use(this, NULL, NULL);
-}
 
 void adaptor_think2use_hittype_splash() // for timed projectile detonation
 {SELFPARAM();
 
 void adaptor_think2use_hittype_splash() // for timed projectile detonation
 {SELFPARAM();
index cbefd4c73ff05d7fa4a57b615f5f657099ca68ff..0b354425a4f3df6679797f5d981536f938b28dd2 100644 (file)
@@ -304,7 +304,7 @@ void ctf_CaptureShield_Spawn(entity flag)
 
        shield.enemy = self;
        shield.team = self.team;
 
        shield.enemy = self;
        shield.team = self.team;
-       shield.touch = ctf_CaptureShield_Touch;
+       settouch(shield, ctf_CaptureShield_Touch);
        shield.customizeentityforclient = ctf_CaptureShield_Customize;
        shield.effects = EF_ADDITIVE;
        shield.movetype = MOVETYPE_NOCLIP;
        shield.customizeentityforclient = ctf_CaptureShield_Customize;
        shield.effects = EF_ADDITIVE;
        shield.movetype = MOVETYPE_NOCLIP;
@@ -1211,7 +1211,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
        flag.velocity = '0 0 0';
        flag.mangle = flag.angles;
        flag.reset = ctf_Reset;
        flag.velocity = '0 0 0';
        flag.mangle = flag.angles;
        flag.reset = ctf_Reset;
-       flag.touch = ctf_FlagTouch;
+       settouch(flag, ctf_FlagTouch);
        flag.think = ctf_FlagThink;
        flag.nextthink = time + FLAG_THINKRATE;
        flag.ctf_status = FLAG_BASE;
        flag.think = ctf_FlagThink;
        flag.nextthink = time + FLAG_THINKRATE;
        flag.ctf_status = FLAG_BASE;
index 8db6de10c2a0f7977f35d1e313f764d574ac4edc..49623a36e9a8a9dc9c3b2e2d95b2acc379d44cc8 100644 (file)
@@ -352,7 +352,7 @@ void dom_controlpoint_setup(entity this)
 
        self.think = dompointthink;
        self.nextthink = time;
 
        self.think = dompointthink;
        self.nextthink = time;
-       self.touch = dompointtouch;
+       settouch(self, dompointtouch);
        self.solid = SOLID_TRIGGER;
        self.flags = FL_ITEM;
        setsize(self, '-32 -32 -32', '32 32 32');
        self.solid = SOLID_TRIGGER;
        self.flags = FL_ITEM;
        setsize(self, '-32 -32 -32', '32 32 32');
index 4bed375b42d554e5816e01fb01c40b36dcd4ef47..b6d3ca3c0ca2d6f8f58fabec4ef683b1c3cf49f6 100644 (file)
@@ -99,7 +99,7 @@ void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
        self.velocity = '0 0 200';
        self.angles = '0 0 0';
        self.effects = autocvar_g_keepawayball_effects;
        self.velocity = '0 0 200';
        self.angles = '0 0 0';
        self.effects = autocvar_g_keepawayball_effects;
-       self.touch = ka_TouchEvent;
+       settouch(self, ka_TouchEvent);
        setthink(self, ka_RespawnBall);
        self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
        setthink(self, ka_RespawnBall);
        self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
@@ -153,7 +153,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
        self.velocity = '0 0 0';
        self.movetype = MOVETYPE_NONE;
        self.effects |= EF_NODRAW;
        self.velocity = '0 0 0';
        self.movetype = MOVETYPE_NONE;
        self.effects |= EF_NODRAW;
-       self.touch = func_null;
+       settouch(self, func_null);
        self.think = ka_TimeScoring;
        self.nextthink = time + autocvar_g_keepaway_score_timeinterval;
        self.takedamage = DAMAGE_NO;
        self.think = ka_TimeScoring;
        self.nextthink = time + autocvar_g_keepaway_score_timeinterval;
        self.takedamage = DAMAGE_NO;
@@ -192,7 +192,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        setattachment(ball, world, "");
        ball.movetype = MOVETYPE_BOUNCE;
        ball.wait = time + 1;
        setattachment(ball, world, "");
        ball.movetype = MOVETYPE_BOUNCE;
        ball.wait = time + 1;
-       ball.touch = ka_TouchEvent;
+       settouch(ball, ka_TouchEvent);
        setthink(ball, ka_RespawnBall);
        ball.nextthink = time + autocvar_g_keepawayball_respawntime;
        ball.takedamage = DAMAGE_YES;
        setthink(ball, ka_RespawnBall);
        ball.nextthink = time + autocvar_g_keepawayball_respawntime;
        ball.takedamage = DAMAGE_YES;
@@ -231,7 +231,7 @@ void ka_Reset(entity this)
        if(time < game_starttime)
        {
                setthink(this, ka_RespawnBall);
        if(time < game_starttime)
        {
                setthink(this, ka_RespawnBall);
-               this.touch = func_null;
+               settouch(this, func_null);
                this.nextthink = game_starttime;
        }
        else
                this.nextthink = game_starttime;
        }
        else
@@ -478,7 +478,7 @@ void ka_SpawnBall() // loads various values for the ball, runs only once at star
        e.flags = FL_ITEM;
        e.pushable = true;
        e.reset = ka_Reset;
        e.flags = FL_ITEM;
        e.pushable = true;
        e.reset = ka_Reset;
-       e.touch = ka_TouchEvent;
+       settouch(e, ka_TouchEvent);
        e.owner = world;
        ka_ball = e;
 
        e.owner = world;
        ka_ball = e;
 
index e2b9d013d33f2e9522e7eb3ee26536bcffc8574e..8886753aab53351e872be82c2ff7fde1407a92de 100644 (file)
@@ -792,7 +792,7 @@ void kh_Key_Spawn(entity initial_owner, float _angle, float i)  // runs every ti
        entity key = spawn();
        key.count = i;
        key.classname = STR_ITEM_KH_KEY;
        entity key = spawn();
        key.count = i;
        key.classname = STR_ITEM_KH_KEY;
-       key.touch = kh_Key_Touch;
+       settouch(key, kh_Key_Touch);
        key.think = kh_Key_Think;
        key.nextthink = time;
        key.items = IT_KEY1 | IT_KEY2;
        key.think = kh_Key_Think;
        key.nextthink = time;
        key.items = IT_KEY1 | IT_KEY2;
index b6f1576d266cdcd29b6982d0d2accb9694751648..c6d31ecbb5966751df0ff689466ad6485d6c89bc 100644 (file)
@@ -327,7 +327,7 @@ void Portal_MakeBrokenPortal(entity portal)
 {
        portal.skin = 2;
        portal.solid = SOLID_NOT;
 {
        portal.skin = 2;
        portal.solid = SOLID_NOT;
-       portal.touch = func_null;
+       settouch(portal, func_null);
        portal.think = func_null;
        portal.effects = 0;
        portal.nextthink = 0;
        portal.think = func_null;
        portal.effects = 0;
        portal.nextthink = 0;
@@ -338,7 +338,7 @@ void Portal_MakeWaitingPortal(entity portal)
 {
        portal.skin = 2;
        portal.solid = SOLID_NOT;
 {
        portal.skin = 2;
        portal.solid = SOLID_NOT;
-       portal.touch = func_null;
+       settouch(portal, func_null);
        portal.think = func_null;
        portal.effects = EF_ADDITIVE;
        portal.nextthink = 0;
        portal.think = func_null;
        portal.effects = EF_ADDITIVE;
        portal.nextthink = 0;
@@ -349,7 +349,7 @@ void Portal_MakeInPortal(entity portal)
 {
        portal.skin = 0;
        portal.solid = SOLID_NOT; // this is done when connecting them!
 {
        portal.skin = 0;
        portal.solid = SOLID_NOT; // this is done when connecting them!
-       portal.touch = Portal_Touch;
+       settouch(portal, Portal_Touch);
        portal.think = Portal_Think;
        portal.effects = EF_RED;
        portal.nextthink = time;
        portal.think = Portal_Think;
        portal.effects = EF_RED;
        portal.nextthink = time;
@@ -360,7 +360,7 @@ void Portal_MakeOutPortal(entity portal)
 {
        portal.skin = 1;
        portal.solid = SOLID_NOT;
 {
        portal.skin = 1;
        portal.solid = SOLID_NOT;
-       portal.touch = func_null;
+       settouch(portal, func_null);
        portal.think = func_null;
        portal.effects = EF_STARDUST | EF_BLUE;
        portal.nextthink = 0;
        portal.think = func_null;
        portal.effects = EF_STARDUST | EF_BLUE;
        portal.nextthink = 0;
index f2315035f7d5764e5f60f91fb45e62e30a10ac53..67e9d73eecb6ba5e3e9b283634b4ee3ec75f31df 100644 (file)
@@ -912,7 +912,7 @@ spawnfunc(trigger_race_checkpoint)
 
        this.use = checkpoint_use;
        if (!(this.spawnflags & 1))
 
        this.use = checkpoint_use;
        if (!(this.spawnflags & 1))
-               this.touch = checkpoint_touch;
+               settouch(this, checkpoint_touch);
 
        o = (this.absmin + this.absmax) * 0.5;
        tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
 
        o = (this.absmin + this.absmax) * 0.5;
        tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
@@ -961,7 +961,7 @@ spawnfunc(target_checkpoint) // defrag entity
 
        this.use = checkpoint_use;
        if (!(this.spawnflags & 1))
 
        this.use = checkpoint_use;
        if (!(this.spawnflags & 1))
-               this.touch = checkpoint_touch;
+               settouch(this, checkpoint_touch);
 
        o = (this.absmin + this.absmax) * 0.5;
        tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
 
        o = (this.absmin + this.absmax) * 0.5;
        tracebox(o, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), o - '0 0 1' * (o.z - this.absmin.z), MOVE_NORMAL, this);
@@ -1117,7 +1117,7 @@ spawnfunc(trigger_race_penalty)
 
        this.use = penalty_use;
        if (!(this.spawnflags & 1))
 
        this.use = penalty_use;
        if (!(this.spawnflags & 1))
-               this.touch = penalty_touch;
+               settouch(this, penalty_touch);
 
        if (this.race_penalty_reason == "")
                this.race_penalty_reason = "missing a checkpoint";
 
        if (this.race_penalty_reason == "")
                this.race_penalty_reason = "missing a checkpoint";