]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use think accessors
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 23 May 2016 11:08:11 +0000 (21:08 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 23 May 2016 11:08:11 +0000 (21:08 +1000)
124 files changed:
qcsrc/client/announcer.qc
qcsrc/client/main.qc
qcsrc/client/shownames.qc
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/ent_cs.qc
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc
qcsrc/common/minigames/minigame/pong.qc
qcsrc/common/minigames/minigame/snake.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/overkill.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/physical_items/physical_items.qc
qcsrc/common/mutators/mutator/sandbox/sandbox.qc
qcsrc/common/mutators/mutator/superspec/superspec.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/notifications/all.qc
qcsrc/common/sounds/sound.qh
qcsrc/common/t_items.qc
qcsrc/common/triggers/func/bobbing.qc
qcsrc/common/triggers/func/breakable.qc
qcsrc/common/triggers/func/conveyor.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/pendulum.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/func/vectormamamam.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/platforms.qc
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/trigger/delay.qc
qcsrc/common/triggers/trigger/gamestart.qc
qcsrc/common/triggers/trigger/gravity.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/monoflop.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/multivibrator.qc
qcsrc/common/triggers/trigger/swamp.qc
qcsrc/common/triggers/trigger/viewloc.qc
qcsrc/common/triggers/triggers.qc
qcsrc/common/turrets/checkpoint.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret/flac_weapon.qc
qcsrc/common/turrets/turret/hellion_weapon.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/turrets/turret/phaser_weapon.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/turrets/util.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/lib/defer.qh
qcsrc/lib/net.qh
qcsrc/lib/self.qh
qcsrc/lib/warpzone/common.qc
qcsrc/lib/warpzone/server.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/command/common.qc
qcsrc/server/command/radarmap.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_hook.qc
qcsrc/server/g_lights.qc
qcsrc/server/g_world.qc
qcsrc/server/ipban.qc
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/pathlib/debug.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/path_waypoint.qc
qcsrc/server/portals.qc
qcsrc/server/round_handler.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/steerlib.qc
qcsrc/server/t_quake3.qc
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/weaponsystem.qc

index a7b0e47499595474c6c8e90aae4c40eb3a85887b..656349a0f63688478f99f2a9cb5220cf44c478ec 100644 (file)
@@ -102,7 +102,7 @@ void Announcer_Gamestart()
                        if (!announcer_countdown)
                        {
                                announcer_countdown = new(announcer_countdown);
-                               announcer_countdown.think = Announcer_Countdown;
+                               setthink(announcer_countdown, Announcer_Countdown);
                        }
 
                        if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle
index 4fc67a63d6a4c18916ec1167a70d09a20920badd..1767b8f2bd76c48d95deb6e4a67c885dcbd4faa3 100644 (file)
@@ -337,7 +337,7 @@ void TrueAim_Init();
 void PostInit()
 {
        entity playerchecker = new_pure(playerchecker);
-       playerchecker.think = Playerchecker_Think;
+       setthink(playerchecker, Playerchecker_Think);
        playerchecker.nextthink = time + 0.2;
 
        TrueAim_Init();
index 47e98d6194dee3a391a4fc2e48a43568d5c1d5b9..79acf4fb8a38386e0344b1d55e1219ec9df1261e 100644 (file)
@@ -176,8 +176,8 @@ void Draw_ShowNames_All()
                        continue;
                }
                make_impure(it);
-               assert(entcs.think, eprint(entcs));
-               WITHSELF(entcs, entcs.think());
+               assert(getthink(entcs), eprint(entcs));
+               WITHSELF(entcs, getthink(entcs)());
                if (!entcs.has_origin) continue;
                if (entcs.m_entcs_private)
                {
index 9291a35991fd973b17a92220d69f7d166f168210..c8afaf99068a6886f668d2c55b15b6c25bd83001 100644 (file)
@@ -183,7 +183,7 @@ void DamageEffect(entity this, vector hitorg, float thedamage, int type, int spe
        e.owner = this;
        e.cnt = time + life;
        e.team = _particleeffectnum(effectname);
-       e.think = DamageEffect_Think;
+       setthink(e, DamageEffect_Think);
        e.nextthink = time;
        this.total_damages += 1;
 }
index 1310ff0343b8d98e0b82c1246d493fb4985162eb..64ddc4473586143bca0a9925103bbb0ec6c9f036 100644 (file)
        {
                entity e = player.entcs = new(entcs_sender);
                e.owner = player;
-               e.think = entcs_think;
+               setthink(e, entcs_think);
                e.nextthink = time;
                Net_LinkEntity(e, false, 0, entcs_send);
                if (!IS_REAL_CLIENT(player)) return;
                                make_pure(e);
                        }
                        e.sv_entnum = n;
-                       e.think = entcs_think;
+                       setthink(e, entcs_think);
                        entcs_receiver(n, e);
                }
                else if (this && e != this)
        #undef X
                this.iflags |= IFLAG_ORIGIN;
                InterpolateOrigin_Note(this);
-               WITHSELF(this, this.think());
+               WITHSELF(this, getthink(this)());
                return true;
        }
 
index cc24cfde6449d86b2dbfe13fd7dae679740f4fe4..1ce1af8c8283fa2a442cd789f0413cd26c034d0c 100644 (file)
@@ -175,7 +175,7 @@ void GiveBall(entity plyr, entity ball)
 
        if(autocvar_g_nexball_basketball_delay_hold)
        {
-               ball.think = DropOwner;
+               setthink(ball, DropOwner);
                ball.nextthink = time + autocvar_g_nexball_basketball_delay_hold;
        }
 
@@ -202,7 +202,7 @@ void DropBall(entity ball, vector org, vector vel)
        ball.velocity = vel;
        ball.nb_droptime = time;
        settouch(ball, basketball_touch);
-       ball.think = ResetBall;
+       setthink(ball, ResetBall);
        ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.teamtime);
 
        if(ball.owner.metertime)
@@ -230,7 +230,7 @@ void InitBall()
        else if(this.classname == "nexball_football")
                settouch(this, football_touch);
        this.cnt = 0;
-       this.think = ResetBall;
+       setthink(this, ResetBall);
        this.nextthink = time + autocvar_g_nexball_delay_idle + 3;
        this.teamtime = 0;
        this.pusher = world;
@@ -271,7 +271,7 @@ void ResetBall()
                this.velocity = '0 0 0';
                setorigin(this, this.spawnorigin); // make sure it's positioned correctly anyway
                this.movetype = MOVETYPE_NONE;
-               this.think = InitBall;
+               setthink(this, InitBall);
                this.nextthink = max(time, game_starttime) + autocvar_g_nexball_delay_start;
        }
 }
@@ -427,7 +427,7 @@ void GoalTouch()
        WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
 
        ball.cnt = 1;
-       ball.think = ResetBall;
+       setthink(ball, ResetBall);
        if(ball.classname == "nexball_basketball")
                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);
@@ -556,7 +556,7 @@ void SpawnBall(entity this)
        WaypointSprite_AttachCarrier(WP_NbBall, this, RADARICON_FLAGCARRIER); // the ball's team is not set yet, no rule update needed
 
        this.reset = ball_restart;
-       this.think = InitBall;
+       setthink(this, InitBall);
        this.nextthink = game_starttime + autocvar_g_nexball_delay_start;
 }
 
@@ -793,7 +793,7 @@ void W_Nexball_Attack2()
                entity _ball = self.ballcarried;
                W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
                DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
-               _ball.think = W_Nexball_Think;
+               setthink(_ball, W_Nexball_Think);
                _ball.nextthink = time;
                return;
        }
@@ -816,7 +816,7 @@ void W_Nexball_Attack2()
        W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
        missile.angles = vectoangles(missile.velocity);
        settouch(missile, W_Nexball_Touch);
-       missile.think = SUB_Remove_self;
+       setthink(missile, SUB_Remove_self);
        missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
 
        missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
index 0f138819a30fdc7f9ff15ad014521cb4395b8e2c..38799f2cea4387a4e9533927a804e86351c5db7a 100644 (file)
@@ -423,7 +423,7 @@ void ons_DelayedLinkSetup(entity this)
 
        LOG_DEBUG(strcat(etos(this.goalentity), " linked with ", etos(this.enemy), "\n"));
        this.SendFlags |= 3;
-       this.think = ons_Link_CheckUpdate;
+       setthink(this, ons_Link_CheckUpdate);
        this.nextthink = time;
 }
 
@@ -646,7 +646,7 @@ void ons_ControlPoint_Icon_BuildThink()
        {
                this.health = this.max_health;
                this.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on
-               this.think = ons_ControlPoint_Icon_Think;
+               setthink(this, ons_ControlPoint_Icon_Think);
                sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM);
                this.owner.iscaptured = true;
                this.solid = SOLID_BBOX;
@@ -830,7 +830,7 @@ void ons_ControlPoint_Reset(entity this)
        this.iscaptured = false;
        this.islinked = false;
        this.isshielded = true;
-       this.think = ons_ControlPoint_Think;
+       setthink(this, ons_ControlPoint_Think);
        this.ons_toucher = world;
        this.nextthink = time + ONS_CP_THINKRATE;
        setmodel_fixsize(this, MDL_ONS_CP_PAD1);
@@ -866,7 +866,7 @@ void ons_ControlPoint_Setup(entity cp)
        cp.solid = SOLID_BBOX;
        cp.movetype = MOVETYPE_NONE;
        settouch(cp, ons_ControlPoint_Touch);
-       cp.think = ons_ControlPoint_Think;
+       setthink(cp, ons_ControlPoint_Think);
        cp.nextthink = time + ONS_CP_THINKRATE;
        cp.reset = ons_ControlPoint_Reset;
        cp.colormap = 1024;
@@ -990,7 +990,7 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d
                this.takedamage = DAMAGE_NO; // can't be hurt anymore
                this.event_damage = func_null; // won't do anything if hurt
                this.count = 0; // reset counter
-               this.think = func_null;
+               setthink(this, func_null);
                this.nextthink = 0;
                //this.think(); // do the first explosion now
 
@@ -1052,7 +1052,7 @@ void ons_GeneratorReset(entity this)
        this.islinked = true;
        this.isshielded = true;
        this.event_damage = ons_GeneratorDamage;
-       this.think = ons_GeneratorThink;
+       setthink(this, ons_GeneratorThink);
        this.nextthink = time + GEN_THINKRATE;
 
        Net_LinkEntity(this, false, 0, generator_send);
@@ -1112,7 +1112,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
        gen.bot_attack = true;
        gen.event_damage = ons_GeneratorDamage;
        gen.reset = ons_GeneratorReset;
-       gen.think = ons_GeneratorThink;
+       setthink(gen, ons_GeneratorThink);
        gen.nextthink = time + GEN_THINKRATE;
        gen.iscaptured = true;
        gen.islinked = true;
index 4924287189f1809001f2d445f9c30acaab5505da..be46b285b4357ce2047e24d184a4d26312bce99a 100644 (file)
@@ -35,6 +35,6 @@ bool cpicon_send(entity this, entity to, int sf)
 void onslaught_controlpoint_icon_link(entity e, void() spawnproc)
 {
        Net_LinkEntity(e, true, 0, cpicon_send);
-       e.think         = spawnproc;
+       setthink(e, spawnproc);
        e.nextthink     = time * sys_frametime;
 }
index cf8d234a3a295c4c2dfb0ec4e91eccdfc6a21f23..f0255456fceab1c2908f9a5d072f37a0346e02ef 100644 (file)
@@ -32,6 +32,6 @@ bool generator_send(entity this, entity to, int sf)
 void generator_link(void() spawnproc)
 {SELFPARAM();
        Net_LinkEntity(self, true, 0, generator_send);
-       self.think              = spawnproc;
+       setthink(self, spawnproc);
        self.nextthink  = time;
 }
index 5074dccffd7131d0c693e3b0d8ffba686e7c7b3a..14998989724a728bdb91cdf2959f29f0608121a7 100644 (file)
@@ -47,7 +47,7 @@ void pong_ball_throw(entity ball)
        while ( fabs(sin(angle)) < 0.17 || fabs(cos(angle)) < 0.17 );
        ball.velocity_x = cos(angle)*autocvar_sv_minigames_pong_ball_speed;
        ball.velocity_y = sin(angle)*autocvar_sv_minigames_pong_ball_speed;
-       ball.think = pong_ball_think;
+       setthink(ball, pong_ball_think);
        ball.nextthink = time;
        ball.team = 0;
        ball.SendFlags |= MINIG_SF_UPDATE|PONG_SF_BALLTEAM;
@@ -64,10 +64,10 @@ void pong_ball_reset(entity ball)
 {
        ball.velocity = '0 0 0';
        ball.origin = '0.5 0.5 0';
-       ball.think = SUB_NullThink;
+       setthink(ball, SUB_NullThink);
        ball.team = 0;
        ball.SendFlags |= MINIG_SF_UPDATE|PONG_SF_BALLTEAM;
-       ball.think = pong_ball_throwthink;
+       setthink(ball, pong_ball_throwthink);
        ball.nextthink = time + autocvar_sv_minigames_pong_ball_wait;
 }
 
@@ -256,7 +256,7 @@ entity pong_ai_spawn(entity paddle)
        entity ai = msle_spawn(paddle.owner,"pong_ai");
        ai.minigame_players = ai;
        ai.team = paddle.team;
-       ai.think = pong_ai_think;
+       setthink(ai, pong_ai_think);
        ai.nextthink = time;
        ai.pong_ai_paddle = paddle;
 
@@ -315,7 +315,7 @@ entity pong_paddle_spawn(entity minigame, int pl_team, entity real_player)
        entity paddle = msle_spawn(minigame,"pong_paddle");
        paddle.pong_length = autocvar_sv_minigames_pong_paddle_size;
        paddle.origin = pong_team_to_paddlepos(pl_team);
-       paddle.think = pong_paddle_think;
+       setthink(paddle, pong_paddle_think);
        paddle.nextthink = time;
        paddle.team = pl_team;
        paddle.mins = pong_team_to_box_halfsize(pl_team,-paddle.pong_length,-1/16);
index 56efb2e0972a45eba07e73f49cd41ad80e8d0eb4..95fda671a19f3dec5ceb9cacc38a3871d8c38ec9 100644 (file)
@@ -185,7 +185,7 @@ void minigame_setup_snake(entity minigame, int pteam)
        piece.snake_next = world;
        piece.snake_prev = world;
        piece.snake_last = piece;
-       piece.think = snake_head_think;
+       setthink(piece, snake_head_think);
        piece.snake_delay = autocvar_sv_minigames_snake_delay_initial;
        piece.nextthink = time + 0.1;
        minigame_server_sendflags(piece,MINIG_SF_ALL);
index e746e4394ab501807868f1f7153503b1be3bbcf9..0f3ea814c5468517b20b2b43bba638c273c79dac 100644 (file)
@@ -230,7 +230,7 @@ void M_Mage_Attack_Spike(entity this, vector dir)
 
        entity missile = spawn();
        missile.owner = missile.realowner = this;
-       missile.think = M_Mage_Attack_Spike_Think;
+       setthink(missile, M_Mage_Attack_Spike_Think);
        missile.ltime = time + 7;
        missile.nextthink = time;
        missile.solid = SOLID_BBOX;
index d83026474b2ff25dfa24bb176dad537a055ef232..751d0fff01ff822e72e81baba4ed49c5b449e0b2 100644 (file)
@@ -101,7 +101,7 @@ void M_Shambler_Attack_Lightning_Explode(entity this)
                Damage(head, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
        }
 
-       this.think = SUB_Remove_self;
+       setthink(this, SUB_Remove_self);
        this.nextthink = time + 0.2;
 }
 
@@ -161,7 +161,7 @@ void M_Shambler_Attack_Lightning(entity this)
 
        gren.cnt = time + 5;
        gren.nextthink = time;
-       gren.think = M_Shambler_Attack_Lightning_Think;
+       setthink(gren, M_Shambler_Attack_Lightning_Think);
        gren.use = M_Shambler_Attack_Lightning_Explode_use;
        settouch(gren, M_Shambler_Attack_Lightning_Touch);
 
index 5f8add4ffd08248b837318f1fd7dfbecae8bfc20..264512069a33b015262b4c7da545777bdf8adf10 100644 (file)
@@ -174,7 +174,7 @@ void M_Spider_Attack_Web(entity this)
        entity proj = new(plasma);
        proj.owner = proj.realowner = this;
        proj.use = M_Spider_Attack_Web_Explode_use;
-       proj.think = adaptor_think2use_hittype_splash;
+       setthink(proj, adaptor_think2use_hittype_splash);
        proj.bot_dodge = true;
        proj.bot_dodgerating = 0;
        proj.nextthink = time + 5;
index 07f51611e1a09ac26d471b09b145539fe3934b7a..87cc5d73f8098fd647a28274a9f822e1c880412a 100644 (file)
@@ -72,7 +72,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity
                missile.velocity = w_shotdir * (autocvar_g_monster_wyvern_attack_fireball_speed);
                missile.avelocity = '300 300 300';
                missile.nextthink = time + 5;
-               missile.think = M_Wyvern_Attack_Fireball_Explode;
+               setthink(missile, M_Wyvern_Attack_Fireball_Explode);
                settouch(missile, M_Wyvern_Attack_Fireball_Touch);
                CSQCProjectile(missile, true, PROJECTILE_FIREMINE, true);
 
index 48e5103616fea170515b29973f0b4e403b143a29..f1a0576c7374424ddc52a7fb4dd1f42e3d51c2e0 100644 (file)
@@ -199,12 +199,12 @@ void Monster_Delay_Action(entity this)
        if(this.cnt > 1)
        {
                this.cnt -= 1;
-               this.think = Monster_Delay_Action_self;
+               setthink(this, Monster_Delay_Action_self);
                this.nextthink = time + this.count;
        }
        else
        {
-               this.think = SUB_Remove_self;
+               setthink(this, SUB_Remove_self);
                this.nextthink = time;
        }
 }
@@ -220,7 +220,7 @@ void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity)
        // deferred attacking, checks if monster is still alive and target is still valid before attacking
        entity e = spawn();
 
-       e.think = Monster_Delay_Action_self;
+       setthink(e, Monster_Delay_Action_self);
        e.nextthink = time + defer_amnt;
        e.count = defer_amnt;
        e.owner = this;
@@ -523,7 +523,7 @@ void Monster_Dead_Fade(entity this)
        if(Monster_Respawn_Check(this))
        {
                this.spawnflags |= MONSTERFLAG_RESPAWNED;
-               this.think = Monster_Respawn;
+               setthink(this, Monster_Respawn);
                this.nextthink = time + this.respawntime;
                this.monster_lifetime = 0;
                this.deadflag = DEAD_RESPAWNING;
@@ -943,7 +943,7 @@ bool Monster_Appear_Check(entity this, int monster_id)
        if(!(this.spawnflags & MONSTERFLAG_APPEAR))
                return false;
 
-       this.think = func_null;
+       setthink(this, func_null);
        this.monsterid = monster_id; // set so this monster is properly registered (otherwise, normal initialization is used)
        this.nextthink = 0;
        this.use = Monster_Appear;
@@ -980,7 +980,7 @@ void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float d
                // number of monsters spawned with mobspawn command
                totalspawned -= 1;
 
-               this.think = SUB_Remove_self;
+               setthink(this, SUB_Remove_self);
                this.nextthink = time + 0.1;
                this.event_damage = func_null;
        }
@@ -988,7 +988,7 @@ void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float d
 
 void Monster_Dead(entity this, entity attacker, float gibbed)
 {
-       this.think = Monster_Dead_Think;
+       setthink(this, Monster_Dead_Think);
        this.nextthink = time;
        this.monster_lifetime = time + 5;
 
@@ -1115,7 +1115,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
                {
                        Violence_GibSplash(this, 1, 0.5, attacker);
 
-                       this.think = SUB_Remove_self;
+                       setthink(this, SUB_Remove_self);
                        this.nextthink = time + 0.1;
                }
        }
@@ -1216,7 +1216,7 @@ void Monster_Anim(entity this)
 
 void Monster_Think()
 {SELFPARAM();
-       this.think = Monster_Think;
+       setthink(this, Monster_Think);
        this.nextthink = this.ticrate;
 
        if(this.monster_lifetime)
@@ -1287,7 +1287,7 @@ bool Monster_Spawn_Setup(entity this)
                }
        }
 
-       this.think = Monster_Think;
+       setthink(this, Monster_Think);
        this.nextthink = time + this.ticrate;
 
        if(MUTATOR_CALLHOOK(MonsterSpawn, this))
index 302eea34edd897118af883ee97392d9373327984..d0d206ab04e6278ac1760c8ce7ef9e07f306520f 100644 (file)
@@ -422,7 +422,7 @@ void buff_Init(entity this)
        this.classname = "item_buff";
        this.solid = SOLID_TRIGGER;
        this.flags = FL_ITEM;
-       this.think = buff_Think;
+       setthink(this, buff_Think);
        settouch(this, buff_Touch);
        this.reset = buff_Reset;
        this.nextthink = time + 0.1;
@@ -546,7 +546,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
                dmgent.dmg = frag_damage * autocvar_g_buffs_vengeance_damage_multiplier;
                dmgent.enemy = frag_attacker;
                dmgent.owner = frag_target;
-               dmgent.think = buff_Vengeance_DelayedDamage;
+               setthink(dmgent, buff_Vengeance_DelayedDamage);
                dmgent.nextthink = time + 0.1;
        }
 
index d9504f82f6b3089f74f83da1a35892e43ae106c9..8721cede77625d66443783cad5dd860a10ab0a69 100644 (file)
@@ -457,11 +457,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, OnEntityPreSpawn)
 
        float r = random();
        if (r < 0.3)
-               e.think = instagib_invisibility;
+               setthink(e, instagib_invisibility);
        else if (r < 0.6)
-               e.think = instagib_extralife;
+               setthink(e, instagib_extralife);
        else
-               e.think = instagib_speed;
+               setthink(e, instagib_speed);
 
        e.nextthink = time + 0.1;
        e.spawnflags = self.spawnflags;
index 96f346164f03c2eb946ed61e57dcec1c4e35957a..39310c9fd7acaf017447731b5505406b8e9e03c0 100644 (file)
@@ -167,7 +167,7 @@ void nade_spawn(entity _nade)
        setattachment(timer, _nade, "");
        timer.colormap = _nade.colormap;
        timer.glowmod = _nade.glowmod;
-       timer.think = nade_timer_think;
+       setthink(timer, nade_timer_think);
        timer.nextthink = time;
        timer.wait = _nade.wait;
        timer.owner = _nade;
@@ -269,7 +269,7 @@ void nade_napalm_ball(entity this)
        proj.scale = 1;//0.5;
        setsize(proj, '-4 -4 -4', '4 4 4');
        setorigin(proj, this.origin);
-       proj.think = napalm_ball_think;
+       setthink(proj, napalm_ball_think);
        proj.nextthink = time;
        proj.damageforcescale = autocvar_g_nades_napalm_ball_damageforcescale;
        proj.effects = EF_LOWPRECISION | EF_FLAME;
@@ -340,7 +340,7 @@ void nade_napalm_boom(entity this)
        fountain.realowner = self.realowner;
        fountain.origin = self.origin;
        setorigin(fountain, fountain.origin);
-       fountain.think = napalm_fountain_think;
+       setthink(fountain, napalm_fountain_think);
        fountain.nextthink = time;
        fountain.ltime = time + autocvar_g_nades_napalm_fountain_lifetime;
        fountain.pushltime = fountain.ltime;
@@ -436,7 +436,7 @@ void nade_ice_boom(entity this)
        fountain.realowner = this.realowner;
        fountain.origin = this.origin;
        setorigin(fountain, fountain.origin);
-       fountain.think = nade_ice_think;
+       setthink(fountain, nade_ice_think);
        fountain.nextthink = time;
        fountain.ltime = time + autocvar_g_nades_ice_freeze_time;
        fountain.pushltime = fountain.wait = fountain.ltime;
@@ -456,7 +456,7 @@ void nade_ice_boom(entity this)
                setattachment(timer, fountain, "");
                timer.colormap = this.colormap;
                timer.glowmod = this.glowmod;
-               timer.think = nade_timer_think;
+               setthink(timer, nade_timer_think);
                timer.nextthink = time;
                timer.wait = fountain.ltime;
                timer.owner = fountain;
@@ -584,7 +584,7 @@ void nade_heal_boom(entity this)
 
        Net_LinkEntity(healer, true, 0, healer_send);
 
-       healer.think = nade_heal_think;
+       setthink(healer, nade_heal_think);
        healer.nextthink = time;
        healer.SendFlags |= 1;
 }
@@ -741,7 +741,7 @@ void nade_touch()
 void nade_beep()
 {SELFPARAM();
        sound(this, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
-       this.think = nade_boom;
+       setthink(this, nade_boom);
        this.nextthink = max(this.wait, time);
 }
 
@@ -796,7 +796,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        {
                sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
                this.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
-               this.think = nade_beep;
+               setthink(this, nade_beep);
        }
 
        this.health -= damage;
@@ -888,7 +888,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
 
        if(_time)
        {
-               _nade.think = nade_boom;
+               setthink(_nade, nade_boom);
                _nade.nextthink = _time;
        }
 
@@ -970,7 +970,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        n.glowmod = player.glowmod;
        n.wait = time + max(0, ntime);
        n.nade_time_primed = time;
-       n.think = nade_beep;
+       setthink(n, nade_beep);
        n.nextthink = max(n.wait - 3, time);
        n.projectiledeathtype = DEATH_NADE.m_id;
 
@@ -981,7 +981,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        fn.colormod = Nades_from(n.nade_type).m_color;
        fn.colormap = player.colormap;
        fn.glowmod = player.glowmod;
-       fn.think = SUB_Remove_self;
+       setthink(fn, SUB_Remove_self);
        fn.nextthink = n.wait;
 
        player.nade = n;
index 45a7e77f3d21a002470f2c2bb84721f4ecb8eec1..6f3c146a3fb8ef8da3f635de25a35e0b47310483 100644 (file)
@@ -287,7 +287,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
                        wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
                        wep.pickup_anyway = true;
                        wep.spawnfunc_checked = true;
-                       wep.think = self_spawnfunc_weapon_hmg;
+                       setthink(wep, self_spawnfunc_weapon_hmg);
                        wep.nextthink = time + 0.1;
                        return true;
                }
@@ -304,7 +304,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
                        wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
                        wep.pickup_anyway = true;
                        wep.spawnfunc_checked = true;
-                       wep.think = self_spawnfunc_weapon_rpc;
+                       setthink(wep, self_spawnfunc_weapon_rpc);
                        wep.nextthink = time + 0.1;
                        return true;
                }
index bf531e3b47b9ce75b26601762a3f805c42d563c9..c11ebc8a396ae3dbe041faf7d9ef682108a70c81 100644 (file)
@@ -134,7 +134,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
 
        settouch(missile, W_RocketPropelledChainsaw_Touch);
 
-       missile.think = W_RocketPropelledChainsaw_Think;
+       setthink(missile, W_RocketPropelledChainsaw_Think);
        missile.cnt = time + WEP_CVAR(rpc, lifetime);
        missile.nextthink = time;
        missile.flags = FL_PROJECTILE;
index bd68f2bcd414872219c6275c504c76e5c5a19cbe..c9ab81b4e42ebc8a85a3c11389261cc12e4641e7 100644 (file)
@@ -116,7 +116,7 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn)
        wep.dphitcontentsmask = self.dphitcontentsmask;
        wep.cnt = (self.owner != world);
 
-       wep.think = physical_item_think;
+       setthink(wep, physical_item_think);
        wep.nextthink = time;
        settouch(wep, physical_item_touch);
        wep.event_damage = physical_item_damage;
index 5ab3ca02b49602846eb976c40bb76e2ebf41d789..9d592f27703bc4dcc1a4e5661a301e0bd70fb70f 100644 (file)
@@ -188,7 +188,7 @@ entity sandbox_ObjectSpawn(float database)
        e.skin = 0;
        e.material = string_null;
        settouch(e, sandbox_ObjectFunction_Touch);
-       e.think = sandbox_ObjectFunction_Think;
+       setthink(e, sandbox_ObjectFunction_Think);
        e.nextthink = time;
        //e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
 
index adcc3b2d709fa666decca029cc0a983cedd4e127..ae10cb5a401ab1a0a36478520330d4ae4c9ece2a 100644 (file)
@@ -398,7 +398,7 @@ MUTATOR_HOOKFUNCTION(superspec, ClientConnect)
 
        entity _hello = spawn();
        _hello.enemy = self;
-       _hello.think = superspec_hello;
+       setthink(_hello, superspec_hello);
        _hello.nextthink = time + 5;
 
        if (!_ISLOCAL)
index 5bbf8c6449977b96a4f289dc503902b097f9d94c..ad2fb846d83602fc6769f4628b7946677732307b 100644 (file)
@@ -1019,7 +1019,7 @@ entity WaypointSprite_Spawn(
         wp.owned_by_field = ownfield;
     }
     wp.fade_rate = maxdistance;
-    wp.think = WaypointSprite_Think;
+    setthink(wp, WaypointSprite_Think);
     wp.nextthink = time;
     wp.model1 = spr.netname;
     wp.customizeentityforclient = WaypointSprite_Customize;
index 267bd9e66d966b0ae5b586b00d6ab815c8d8c262..ab448b1847e89fa7bfe96c1a4f3867dbf31054d3 100644 (file)
@@ -1697,7 +1697,7 @@ void Send_Notification(
                        net_notif.nent_floats[i] = ...((net_notif.nent_stringcount + i), float);
                }
 
-               net_notif.think = Net_Notification_Remove;
+               setthink(net_notif, Net_Notification_Remove);
                net_notif.nextthink = (time > autocvar_notification_lifetime_mapload)
                        ? (time + autocvar_notification_lifetime_runtime)
                        : autocvar_notification_lifetime_mapload;
index a462861f29b8401452b3c1d75becd2a4de24e555..e84c09ef6807b620107636f3d18356e417c98793 100644 (file)
@@ -76,7 +76,7 @@ const float VOL_BASEVOICE = 1.0;
                        auto = true; \
                        __chan = fabs(__chan); \
                        entity tmp = __e = new(csqc_autochannel); \
-                       tmp.think = SUB_Remove_self; \
+                       setthink(tmp, SUB_Remove_self); \
                        tmp.nextthink = time + soundlength(__samp); \
                } \
                vector old_origin = __e.origin; \
index dcbbb95e30802489286574f88270b5413749b0f2..6ec16667eb88163e414448e18c14fbd3d5fca38d 100644 (file)
@@ -503,7 +503,7 @@ void Item_Respawn ()
                Item_ItemsTime_SetTimesForAllPlayers();
        }
 
-       self.think = Item_Think;
+       setthink(self, Item_Think);
        self.nextthink = time;
 
        //Send_Effect(EFFECT_ITEM_RESPAWN, self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
@@ -583,7 +583,7 @@ void Item_ScheduleRespawnIn(entity e, float t)
        // if the respawn time is longer than 10 seconds, show a waypoint, otherwise, just respawn normally
        if ((Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS) && (t - ITEM_RESPAWN_TICKS) > 0)
        {
-               e.think = Item_RespawnCountdown;
+               setthink(e, Item_RespawnCountdown);
                e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
                e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS;
                e.count = 0;
@@ -593,7 +593,7 @@ void Item_ScheduleRespawnIn(entity e, float t)
        }
        else
        {
-               e.think = Item_RespawnThink;
+               setthink(e, Item_RespawnThink);
                e.nextthink = time;
                e.scheduledrespawntime = time + t;
                e.wait = time + t;
@@ -849,7 +849,7 @@ void Item_Reset(entity this)
 
        if (this.classname != "droppedweapon")
        {
-               this.think = Item_Think;
+               setthink(this, Item_Think);
                this.nextthink = time;
 
                if (this.waypointsprite_attached)
@@ -1082,7 +1082,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                this.movetype = MOVETYPE_TOSS;
 
                // Savage: remove thrown items after a certain period of time ("garbage collection")
-               this.think = RemoveItem;
+               setthink(this, RemoveItem);
                this.nextthink = time + 20;
 
                this.takedamage = DAMAGE_YES;
index 0dcba018e7cbc20cce96703967ea03cde6b66dfb..7039d151ad4a7f524115bf9bbb8047b17420811f 100644 (file)
@@ -72,7 +72,7 @@ spawnfunc(func_bobbing)
        controller = new(func_bobbing_controller);
        controller.owner = this;
        controller.nextthink = time + 1;
-       controller.think = func_bobbing_controller_think;
+       setthink(controller, func_bobbing_controller_think);
        this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
        this.SUB_THINK = SUB_NullThink;
 
index 82e5291606847ab64e531a171726296d05c9facb..e11680b40c75fc87a06fe82100b71e37114b2bd1 100644 (file)
@@ -221,7 +221,7 @@ void func_breakable_destroy(entity this, entity actor, entity trigger)
 
        if(this.respawntime)
        {
-               this.think = func_breakable_restore_self;
+               setthink(this, func_breakable_restore_self);
                this.nextthink = time + this.respawntime + crandom() * this.respawntimejitter;
        }
 
@@ -271,7 +271,7 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
                // do not explode NOW but in the NEXT FRAME!
                // because recursive calls to RadiusDamage are not allowed
                this.nextthink = time;
-               this.think = func_breakable_destroy_self;
+               setthink(this, func_breakable_destroy_self);
        }
 }
 
index dd7c129d62b2626ac4be1a98403639de3eb320c0..6ad2e80d41c33404d7e5535892a2a68963df3635 100644 (file)
@@ -112,7 +112,7 @@ void conveyor_init(entity this)
 {
        if (!this.speed) this.speed = 200;
        this.movedir *= this.speed;
-       this.think = conveyor_think;
+       setthink(this, conveyor_think);
        this.nextthink = time;
        IFTARGETED
        {
index 77061ecb3e626c6516c2e3d69849fa3909cecff1..504005e362733e18de841000c848af1ef7b76c4d 100644 (file)
@@ -32,7 +32,7 @@ void door_rotating_reset(entity this)
        this.angles = this.pos1;
        this.avelocity = '0 0 0';
        this.state = STATE_BOTTOM;
-       this.think = func_null;
+       setthink(this, func_null);
        this.nextthink = 0;
 }
 
index f999969556fdbd9d4121211f96853d7a2d1e3524..da88e4dc9b60336d0d7f2c66ca4bdebbe2dc5c35 100644 (file)
@@ -72,7 +72,7 @@ void fd_secret_damage(entity this, entity inflictor, entity attacker, float dama
 void fd_secret_move1()
 {SELFPARAM();
        self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
-       self.think = fd_secret_move2;
+       setthink(self, fd_secret_move2);
        if (self.noise3 != "")
                _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
 }
@@ -93,7 +93,7 @@ void fd_secret_move3()
        if (!(self.spawnflags & SECRET_OPEN_ONCE))
        {
                self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
-               self.think = fd_secret_move4;
+               setthink(self, fd_secret_move4);
        }
 }
 
@@ -109,7 +109,7 @@ void fd_secret_move4()
 void fd_secret_move5()
 {SELFPARAM();
        self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
-       self.think = fd_secret_move6;
+       setthink(self, fd_secret_move6);
        if (self.noise3 != "")
                _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
 }
@@ -175,7 +175,7 @@ void secret_reset(entity this)
                this.takedamage = DAMAGE_YES;
        }
        setorigin(this, this.oldorigin);
-       this.think = func_null;
+       setthink(this, func_null);
        this.SUB_NEXTTHINK = 0;
 }
 
index a793b3e7b7bed44e2a1284d6ca5d7dcaa1999616..057fcdca7190f90c484f407c435fa114b009190d 100644 (file)
@@ -76,7 +76,7 @@ spawnfunc(func_fourier)
        controller = new(func_fourier_controller);
        controller.owner = this;
        controller.nextthink = time + 1;
-       controller.think = func_fourier_controller_think;
+       setthink(controller, func_fourier_controller_think);
        this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
        this.SUB_THINK = SUB_NullThink; // for PushMove
 
index e59881ddc3ebf2a7b773274f348964f8f52c82bf..bcfc6e886ce6c6334bd8f1b52a5125384a255512 100644 (file)
@@ -65,7 +65,7 @@ spawnfunc(func_pendulum)
        controller = new(func_pendulum_controller);
        controller.owner = this;
        controller.nextthink = time + 1;
-       controller.think = func_pendulum_controller_think;
+       setthink(controller, func_pendulum_controller_think);
        this.nextthink = this.SUB_LTIME + 999999999;
        this.SUB_THINK = SUB_NullThink; // for PushMove
 
index fa77082b2c426091a6eb6acc3dc36ca99d93843b..7f7ec8eb2619e7c40d3a1ceec076f4ac80c26cb5 100644 (file)
@@ -143,7 +143,7 @@ spawnfunc(func_pointparticles)
        }
        else
                this.state = 1;
-       this.think = pointparticles_think;
+       setthink(this, pointparticles_think);
        this.nextthink = time;
 }
 
index 139145e5bbb06e735f265e7766eda43fc1d5bda1..eb7a5428bc38b2ce0b41719d5886b3a1e6085e5f 100644 (file)
@@ -94,7 +94,7 @@ void func_vectormamamam_findtarget(entity this)
        controller = new(func_vectormamamam_controller);
        controller.owner = this;
        controller.nextthink = time + 1;
-       controller.think = func_vectormamamam_controller_think;
+       setthink(controller, func_vectormamamam_controller_think);
 }
 
 spawnfunc(func_vectormamamam)
index 3d09282d5e95f8ac390b70705a7ad8fbf467f2dd..937d68caf155da781f52f8bcac6f04555f2060bf 100644 (file)
@@ -232,7 +232,7 @@ spawnfunc(misc_laser)
        if(!this.scale) this.scale = 1;
        if(!this.modelscale) this.modelscale = 1;
        else if(this.modelscale < 0) this.modelscale = 0;
-       this.think = misc_laser_think;
+       setthink(this, misc_laser_think);
        this.nextthink = time;
        InitializeEntity(this, misc_laser_init, INITPRIO_FINDTARGET);
 
index 51c2ac8cc823c89eb6ee669b83ce053c3f80eac4..d16509596f339d5ef2441e77eeee16edacbd5a1b 100644 (file)
@@ -128,7 +128,7 @@ void plat_outside_touch()
 void plat_trigger_use(entity this, entity actor, entity trigger)
 {
 #ifdef SVQC
-       if (this.think)
+       if (getthink(this))
                return;         // already activated
 #elif defined(CSQC)
        if(this.move_think)
index 99dc5217d274f64a2b30d875e4661d0bb8e76ba5..bcc7c057c26ef233ea0aa02c87806ea7fef84ccb 100644 (file)
@@ -228,7 +228,7 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float
        controller.finaldest = (tdest + '0 0 0.125'); // where do we want to end? Offset to overshoot a bit.
        controller.animstate_starttime = time;
        controller.animstate_endtime = time + traveltime;
-       controller.think = SUB_CalcMove_controller_think;
+       setthink(controller, SUB_CalcMove_controller_think);
        controller.think1 = self.SUB_THINK;
 
        // the thinking is now done by the controller
@@ -236,7 +236,7 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float
        self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
 
        // invoke controller
-       WITHSELF(controller, controller.think());
+       WITHSELF(controller, getthink(controller)());
 }
 
 void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
index b67d47d321418b19576fd6c3e6ec0b19b34787cc..c6fca4c7ea1169d36ddcf74e5b7e5b83febc5d45 100644 (file)
@@ -320,7 +320,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
        setorigin(this, this.origin);
        setsize(this, this.mins, this.maxs);
        this.cnt = 1;
-       this.think = Ent_TriggerMusic_Think;
+       setthink(this, Ent_TriggerMusic_Think);
        this.nextthink = time;
        return true;
 }
index 3dec82acedc65dbc29475bbebcb6788a255ea0ce..d6742fed3298c03f70882ee07871ed566a54beb5 100644 (file)
@@ -1,13 +1,13 @@
 #ifdef SVQC
 void delay_use(entity this, entity actor, entity trigger)
 {
-   this.think = SUB_UseTargets_self;
+   setthink(this, SUB_UseTargets_self);
    this.nextthink = this.wait;
 }
 
 void delay_reset(entity this)
 {
-       this.think = func_null;
+       setthink(this, func_null);
        this.nextthink = 0;
 }
 
index 5f3206a2af5bb470b16c388e306381e0b8aa8aae..b042d01e06ba04d81089e980686c88171fa377be 100644 (file)
@@ -18,7 +18,7 @@ spawnfunc(trigger_gamestart)
 
        if(this.wait)
        {
-               this.think = adaptor_think2use;
+               setthink(this, adaptor_think2use);
                this.nextthink = game_starttime + this.wait;
        }
        else
index f2f8a845f12fd836d849d83875ce9eaac9a16e3c..c9ea32501938ac09f8c23959578150e3e62a6fce 100644 (file)
@@ -69,7 +69,7 @@ void trigger_gravity_touch()
                other.trigger_gravity_check.enemy = self;
                other.trigger_gravity_check.owner = other;
                other.trigger_gravity_check.gravity = other.gravity;
-               other.trigger_gravity_check.think = trigger_gravity_check_think;
+               setthink(other.trigger_gravity_check, trigger_gravity_check_think);
                other.trigger_gravity_check.nextthink = time;
                other.trigger_gravity_check.count = 2;
                if(other.gravity)
index c578622e001a8b832abff3b54ee8b0a0ce639335..be2ef03c04dadcb6f6468b4009040e5b35e287f0 100644 (file)
@@ -263,7 +263,7 @@ void trigger_push_touch()
        if (this.spawnflags & PUSH_ONCE)
        {
                settouch(this, func_null);
-               this.think = SUB_Remove_self;
+               setthink(this, SUB_Remove_self);
                this.nextthink = time;
        }
 #endif
index 994d498c11e8b0a43056979fccd29ee5430542e7..f9738714e636a75e80fb829fa63186c95eed02ad 100644 (file)
@@ -41,7 +41,7 @@ spawnfunc(trigger_monoflop)
                this.use = monoflop_fixed_use;
        else
                this.use = monoflop_use;
-       this.think = monoflop_think;
+       setthink(this, monoflop_think);
        this.state = 0;
        this.reset = monoflop_reset;
 }
index 5edf1dfa542966323582053311fe839568d7b7f1..5ebe7017957ea7d94eaca4310f77133b8a43b3c9 100644 (file)
@@ -45,7 +45,7 @@ void multi_trigger(entity this)
 
        if (this.wait > 0)
        {
-               this.think = multi_wait;
+               setthink(this, multi_wait);
                this.nextthink = time + this.wait;
        }
        else if (this.wait == 0)
@@ -123,7 +123,7 @@ void multi_reset(entity this)
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
        }
-       this.think = func_null;
+       setthink(this, func_null);
        this.nextthink = 0;
        this.team = this.team_saved;
 }
index 8d3b6b5d5f150fd0060218056baef979281ae57f..2c17fbb0d1e9cbb339ac5cc5be388d40d88d3471 100644 (file)
@@ -68,7 +68,7 @@ spawnfunc(trigger_multivibrator)
 
        this.state = 0;
        this.use = multivibrator_toggle;
-       this.think = multivibrator_send_think;
+       setthink(this, multivibrator_send_think);
        this.nextthink = max(1, time);
 
        IFTARGETED
index a09c69f7088eaad47c36f7c1ddcbed27c7abb850..4c514df2d46a9ab7402ca615926c240ff98ec8c2 100644 (file)
@@ -76,7 +76,7 @@ void swamp_touch()
                //centerprint(other,"Entering swamp!\n");
                other.swampslug = spawn();
                other.swampslug.health = 2;
-               other.swampslug.think = swampslug_think;
+               setthink(other.swampslug, swampslug_think);
                other.swampslug.nextthink = time;
                other.swampslug.owner = other;
                other.swampslug.dmg = self.dmg;
index 7003f38891f1d1a0adafe16927a895f9124e189f..bfd6db1dcc51636e9c01807e73c6c5cd080b899f 100644 (file)
@@ -78,7 +78,7 @@ void viewloc_init(entity this)
 
        Net_LinkEntity(this, false, 0, trigger_viewloc_send);
 
-       this.think = viewloc_think;
+       setthink(this, viewloc_think);
        this.nextthink = time;
 }
 
@@ -159,7 +159,7 @@ NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew)
        this.cnt = point1;
        this.count = point2;
 
-       this.think = trigger_viewloc_updatelink;
+       setthink(this, trigger_viewloc_updatelink);
        this.nextthink = time + 1; // we need to delay this or else
 
        this.classname = "trigger_viewlocation";
index 617fcd40268006bf7a0297289ec764ee42cf7601..572515189e5c8660450c8876dce75a6ed7bb6fa0 100644 (file)
@@ -193,7 +193,7 @@ void SUB_UseTargets(entity this, entity actor, entity trigger)
        // create a temp object to fire at a later time
                entity t = new(DelayedUse);
                t.nextthink = time + this.delay;
-               t.think = DelayThink;
+               setthink(t, DelayThink);
                t.enemy = actor;
                t.message = this.message;
                t.killtarget = this.killtarget;
index 669414c570a6215b0945ec4cf59003bf909b262f..d24e9d74f4d5bc8792e4a86b37d25af8894caf68 100644 (file)
@@ -70,7 +70,7 @@ void turret_checkpoint_init()
 spawnfunc(turret_checkpoint)
 {
     setorigin(this,this.origin);
-    this.think = turret_checkpoint_init;
+    setthink(this, turret_checkpoint_init);
     this.nextthink = time + 0.2;
 }
 
index 36283fc814de2d547278f9d7e513983341b98ffc..138c87e88d568349b3dabb4ca7aaf1b50a09a3c1 100644 (file)
@@ -168,7 +168,7 @@ void turret_hide()
 {SELFPARAM();
        self.effects   |= EF_NODRAW;
        self.nextthink = time + self.respawntime - 0.2;
-       self.think       = turret_respawn;
+       setthink(self, turret_respawn);
 }
 
 void turret_die()
@@ -201,7 +201,7 @@ void turret_die()
                // Setup respawn
                self.SendFlags    |= TNSF_STATUS;
                self.nextthink   = time + 0.2;
-               self.think               = turret_hide;
+               setthink(self, turret_hide);
 
                tur.tr_death(tur, self);
        }
@@ -245,7 +245,7 @@ void turret_damage(entity this, entity inflictor, entity attacker, float damage,
                this.tur_head.event_damage = func_null;
                this.takedamage                  = DAMAGE_NO;
                this.nextthink = time;
-               this.think = turret_die;
+               setthink(this, turret_die);
        }
 
        this.SendFlags  |= TNSF_STATUS;
@@ -272,7 +272,7 @@ void turret_respawn()
        self.ammo                                       = self.ammo_max;
 
        self.nextthink = time + self.ticrate;
-       self.think       = turret_think;
+       setthink(self, turret_think);
 
        self.SendFlags = TNSF_FULL_UPDATE;
 
@@ -471,7 +471,7 @@ entity turret_projectile(Sound _snd, float _size, float _health, float _death, f
        proj.realowner    = self;
        proj.bot_dodge    = true;
        proj.bot_dodgerating = self.shot_dmg;
-       proj.think                = turret_projectile_explode;
+       setthink(proj, turret_projectile_explode);
        settouch(proj, turret_projectile_touch);
        proj.nextthink    = time + 9;
        proj.movetype           = MOVETYPE_FLYMISSILE;
@@ -1189,7 +1189,7 @@ void turret_use(entity this, entity actor, entity trigger)
 void turret_link()
 {SELFPARAM();
        Net_LinkEntity(self, true, 0, turret_send);
-       self.think       = turret_think;
+       setthink(self, turret_think);
        self.nextthink = time;
        self.tur_head.effects = EF_NODRAW;
 }
@@ -1256,7 +1256,7 @@ float turret_initialize(Turret tur)
        if(!e)
        {
                e = new(turret_manager);
-               e.think = turrets_manager_think;
+               setthink(e, turrets_manager_think);
                e.nextthink = time + 2;
        }
 
index 175fa7617ffdc24812da3130256d2fc7561dadfe..fd7179f162bed8a0f7f0c28136d56647e655b75f 100644 (file)
@@ -24,7 +24,7 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen
 
         entity proj = turret_projectile(SND_HAGAR_FIRE, 5, 0, DEATH_TURRET_FLAC.m_id, PROJECTILE_HAGAR, true, true);
         proj.missile_flags = MIF_SPLASH | MIF_PROXY;
-        proj.think       = turret_flac_projectile_think_explode;
+        setthink(proj, turret_flac_projectile_think_explode);
         proj.nextthink  = time + actor.tur_impacttime + (random() * 0.01 - random() * 0.01);
         Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
 
index 7df79c8c7e03d41f1c1fc214047b51b8abac9674..6fd5bd09147c0f6d1960a51804f661d7119a98d7 100644 (file)
@@ -31,7 +31,7 @@ METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weapo
 
         entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HELLION.m_id, PROJECTILE_ROCKET, false, false);
         te_explosion (missile.origin);
-        missile.think          = turret_hellion_missile_think;
+        setthink(missile, turret_hellion_missile_think);
         missile.nextthink      = time;
         missile.flags          = FL_PROJECTILE;
         missile.max_health   = time + 9;
@@ -98,7 +98,7 @@ void turret_hellion_missile_think()
     self.velocity = newdir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
 
     if (itime < 0.05)
-        self.think = turret_projectile_explode;
+        setthink(self, turret_projectile_explode);
 
     UpdateCSQCProjectile(self);
 }
index 319a579cf2bac4d537e4d2c497f329f75bd2d409..ca99cca9029890bb9cdb0e3dab319faf18a27439 100644 (file)
@@ -29,7 +29,7 @@ METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity
         entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false);
         te_explosion (missile.origin);
 
-        missile.think = turret_hk_missile_think;
+        setthink(missile, turret_hk_missile_think);
         missile.nextthink = time + 0.25;
         missile.movetype = MOVETYPE_BOUNCEMISSILE;
         missile.velocity = actor.tur_shotdir_updated * (actor.shot_speed * 0.75);
index 3adc6c6898557c37c19ec2d5ee599c45394a7e89..17622fe1db7431f4204dc61fee2e12cf11fced30 100644 (file)
@@ -26,7 +26,7 @@ METHOD(PhaserTurretAttack, wr_think, void(entity thiswep, entity actor, .entity
         setmodel(beam, MDL_TUR_PHASER_BEAM);
         beam.effects = EF_LOWPRECISION;
         beam.solid = SOLID_NOT;
-        beam.think = beam_think;
+        setthink(beam, beam_think);
         beam.cnt = time + actor.shot_speed;
         beam.shot_spread = time + 2;
         beam.nextthink = time;
index b923d0fc30a7e5bb271a078bf62593f69321107d..c2cedf0a2e4593a871ad98b333f6b3ee3ee6f29e 100644 (file)
@@ -141,7 +141,7 @@ void walker_rocket_think()
 
     if (self.max_health < time)
     {
-        self.think       = walker_rocket_explode;
+        setthink(self, walker_rocket_explode);
         self.nextthink  = time;
         return;
     }
@@ -176,13 +176,13 @@ void walker_rocket_loop3()
 
     if (self.max_health < time)
     {
-        self.think = walker_rocket_explode;
+        setthink(self, walker_rocket_explode);
         return;
     }
 
     if(vdist(self.origin - self.tur_shotorg, <, 100))
     {
-        self.think = walker_rocket_think;
+        setthink(self, walker_rocket_think);
         return;
     }
 
@@ -200,14 +200,14 @@ void walker_rocket_loop2()
 
     if (self.max_health < time)
     {
-        self.think = walker_rocket_explode;
+        setthink(self, walker_rocket_explode);
         return;
     }
 
     if(vdist(self.origin - self.tur_shotorg, <, 100))
     {
         self.tur_shotorg = self.origin - '0 0 200';
-        self.think = walker_rocket_loop3;
+        setthink(self, walker_rocket_loop3);
         return;
     }
 
@@ -219,7 +219,7 @@ void walker_rocket_loop()
 {SELFPARAM();
     self.nextthink = time;
     self.tur_shotorg = self.origin + '0 0 300';
-    self.think = walker_rocket_loop2;
+    setthink(self, walker_rocket_loop2);
     self.shot_dmg = 1337;
 }
 
@@ -248,9 +248,9 @@ void walker_fire_rocket(vector org)
     rocket.enemy                         = self.enemy;
 
     if (random() < 0.01)
-        rocket.think             = walker_rocket_loop;
+        setthink(rocket, walker_rocket_loop);
     else
-        rocket.think             = walker_rocket_think;
+        setthink(rocket, walker_rocket_think);
 
     rocket.event_damage           = walker_rocket_damage;
 
index 749bff94106d0b53439563802c0dc35b7be9b5bb..0344d149230461e0ca97b3db210de93bf7441e3a 100644 (file)
@@ -98,7 +98,7 @@ void marker_think()
        if(self.cnt)
        if(self.cnt < time)
        {
-               self.think = SUB_Remove;
+               setthink(self, SUB_Remove);
                self.nextthink = time;
                return;
        }
@@ -116,7 +116,7 @@ void mark_error(vector where,float lifetime)
        setmodel(err, MDL_MARKER);
        setorigin(err,where);
        err.movetype = MOVETYPE_NONE;
-       err.think = marker_think;
+       setthink(err, marker_think);
        err.nextthink = time;
        err.skin = 0;
        if(lifetime)
@@ -129,7 +129,7 @@ void mark_info(vector where,float lifetime)
        setmodel(err, MDL_MARKER);
        setorigin(err,where);
        err.movetype = MOVETYPE_NONE;
-       err.think = marker_think;
+       setthink(err, marker_think);
        err.nextthink = time;
        err.skin = 1;
        if(lifetime)
@@ -142,7 +142,7 @@ entity mark_misc(vector where,float lifetime)
        setmodel(err, MDL_MARKER);
        setorigin(err,where);
        err.movetype = MOVETYPE_NONE;
-       err.think = marker_think;
+       setthink(err, marker_think);
        err.nextthink = time;
        err.skin = 3;
        if(lifetime)
index bfb735197069f74cd86834a98f0c9a14c3dfb340..2fb60210fe7698e646a59f6fede5fde83900179c 100644 (file)
@@ -208,7 +208,7 @@ void vehicles_projectile_damage(entity this, entity inflictor, entity attacker,
        {
                this.takedamage = DAMAGE_NO;
                this.event_damage = func_null;
-               this.think = adaptor_think2use;
+               setthink(this, adaptor_think2use);
                this.nextthink = time;
        }
 }
@@ -265,7 +265,7 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
        proj.use                          = vehicles_projectile_explode_use;
        proj.owner                      = this;
        proj.realowner          = _owner;
-       proj.think                      = SUB_Remove_self;
+       setthink(proj, SUB_Remove_self);
        proj.nextthink          = time + 30;
 
        if(_health)
@@ -325,14 +325,14 @@ entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag,
 
        if(_explode)
        {
-               _gib.think = vehicles_gib_explode;
+               setthink(_gib, vehicles_gib_explode);
                _gib.nextthink = time + random() * _explode;
                settouch(_gib, vehicles_gib_explode);
        }
        else
        {
                _gib.cnt = time + _maxtime;
-               _gib.think = vehicles_gib_think;
+               setthink(_gib, vehicles_gib_think);
                _gib.nextthink = time + _maxtime - 1;
                _gib.alpha = 1;
        }
@@ -442,7 +442,7 @@ void vehicles_clearreturn(entity veh)
                if(ret.wp00 == veh)
                {
                        ret.classname   = "";
-                       ret.think          = SUB_Remove_self;
+                       setthink(ret, SUB_Remove_self);
                        ret.nextthink   = time + 0.1;
 
                        if(ret.waypointsprite_attached)
@@ -458,7 +458,7 @@ void vehicles_return()
 {SELFPARAM();
        Send_Effect(EFFECT_TELEPORT, self.wp00.origin + '0 0 64', '0 0 0', 1);
 
-       self.wp00.think  = vehicles_spawn;
+       setthink(self.wp00, vehicles_spawn);
        self.wp00.nextthink = time;
 
        if(self.waypointsprite_attached)
@@ -484,12 +484,12 @@ void vehicles_showwp()
 
        if(ent.cnt)
        {
-               ent.think = vehicles_return;
+               setthink(ent, vehicles_return);
                ent.nextthink = ent.cnt;
        }
        else
        {
-               ent.think         = vehicles_return;
+               setthink(ent, vehicles_return);
                ent.nextthink  = time + 1;
 
                ent = spawn();
@@ -499,7 +499,7 @@ void vehicles_showwp()
                setorigin(ent, this.wp00.pos1);
 
                ent.nextthink = time + 5;
-               ent.think = vehicles_showwp_goaway;
+               setthink(ent, vehicles_showwp_goaway);
        }
 
        if(teamplay && ent.team)
@@ -526,7 +526,7 @@ void vehicles_setreturn(entity veh)
        ret = new(vehicle_return);
        ret.wp00           = veh;
        ret.team                = veh.team;
-       ret.think          = vehicles_showwp;
+       setthink(ret, vehicles_showwp);
 
        if(IS_DEAD(veh))
        {
@@ -559,7 +559,7 @@ void vehicle_use(entity this, entity actor, entity trigger)
                LOG_TRACE("Respawning vehicle: ", this.netname, "\n");
                if(this.effects & EF_NODRAW)
                {
-                       this.think = vehicles_spawn;
+                       setthink(this, vehicles_spawn);
                        this.nextthink = time + 3;
                }
                else
@@ -665,7 +665,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
                        setattachment(this.vehicle_shieldent, this, "");
                        setorigin(this.vehicle_shieldent, real_origin(this) - this.origin);
                        this.vehicle_shieldent.scale       = 256 / vlen(this.maxs - this.mins);
-                       this.vehicle_shieldent.think       = shieldhit_think;
+                       setthink(this.vehicle_shieldent, shieldhit_think);
                }
 
                this.vehicle_shieldent.colormod = '1 1 1';
@@ -1126,7 +1126,7 @@ void vehicles_spawn()
        self.flags                              = FL_NOTARGET;
        self.avelocity                  = '0 0 0';
        self.velocity                   = '0 0 0';
-       self.think                              = vehicles_think;
+       setthink(self, vehicles_think);
        self.nextthink                  = time;
 
        // Reset locking
@@ -1211,7 +1211,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        this.PlayerPhysplug                     = info.PlayerPhysplug;
        this.event_damage                       = func_null;
        settouch(this, vehicles_touch);
-       this.think                                      = vehicles_spawn;
+       setthink(this, vehicles_spawn);
        this.nextthink                          = time;
        this.effects                            = EF_NODRAW;
        this.dphitcontentsmask          = DPCONTENTS_BODY | DPCONTENTS_SOLID;
index e61ab440d428eb3decc28a0dec73b539e773c1e4..72a70cf41e32a25f89db60c8c171530610709625 100644 (file)
@@ -635,7 +635,7 @@ void bumblebee_land()
        self.angles_z *= 0.95;
 
        if(hgt < 16)
-               self.think      = vehicles_think;
+               setthink(self, vehicles_think);
 
        self.nextthink = time;
 
@@ -654,7 +654,7 @@ void bumblebee_exit(float eject)
 
        if(!IS_DEAD(self))
        {
-               self.think = bumblebee_land;
+               setthink(self, bumblebee_land);
                self.nextthink  = time;
        }
 
@@ -705,7 +705,7 @@ void bumblebee_blowup()
 void bumblebee_diethink()
 {SELFPARAM();
        if(time >= self.wait)
-               self.think = bumblebee_blowup;
+               setthink(self, bumblebee_blowup);
 
        if(random() < 0.1)
        {
@@ -797,7 +797,7 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
     else
         settouch(_body, func_null);
 
-    _body.think = bumblebee_diethink;
+    setthink(_body, bumblebee_diethink);
     _body.nextthink = time;
     _body.wait = time + 2 + (random() * 8);
     _body.owner = instance;
@@ -834,7 +834,7 @@ METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
         setattachment(self.vehicle_shieldent, self, "");
         setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
         self.vehicle_shieldent.scale       = 512 / vlen(self.maxs - self.mins);
-        self.vehicle_shieldent.think       = shieldhit_think;
+        setthink(self.vehicle_shieldent, shieldhit_think);
         self.vehicle_shieldent.alpha = -1;
         self.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW;
 
index e79cab9ecaf59c8a46f037c3a001ede476d67fa6..6eb064af30055c7561a27c69a4f0a3e8426353c0 100644 (file)
@@ -437,7 +437,7 @@ void racer_exit(float eject)
 {SELFPARAM();
        vector spot;
 
-       self.think        = racer_think;
+       setthink(self, racer_think);
        self.nextthink  = time;
        self.movetype   = MOVETYPE_BOUNCE;
        sound (self.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM);
@@ -489,7 +489,7 @@ void racer_blowup()
                                        DEATH_VH_WAKI_DEATH.m_id, world);
 
        self.nextthink  = time + autocvar_g_vehicle_racer_respawntime;
-       self.think        = vehicles_spawn;
+       setthink(self, vehicles_spawn);
        self.movetype   = MOVETYPE_NONE;
        self.effects    = EF_NODRAW;
        self.solid = SOLID_NOT;
@@ -605,7 +605,7 @@ METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
         self.mass                         = 900;
     }
 
-    self.think           = racer_think;
+    setthink(self, racer_think);
     self.nextthink       = time;
     self.vehicle_health = autocvar_g_vehicle_racer_health;
     self.vehicle_shield = autocvar_g_vehicle_racer_shield;
@@ -651,7 +651,7 @@ METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
     instance.velocity += '0 0 700';
     instance.colormod = '-0.5 -0.5 -0.5';
 
-    instance.think = racer_blowup_think;
+    setthink(instance, racer_blowup_think);
     instance.nextthink = time;
 #endif
 }
index 33d11c1c641f773891c66222ffe09f89bc89ec18..5718d41250d9e084ecd057f20166f37e693efafc 100644 (file)
@@ -59,9 +59,9 @@ void racer_fire_rocket(entity player, vector org, vector dir, entity trg)
     rocket.cnt                   = time + 15;
 
     if(trg)
-        rocket.think                   = racer_rocket_tracker;
+        setthink(rocket, racer_rocket_tracker);
     else
-        rocket.think                   = racer_rocket_groundhugger;
+        setthink(rocket, racer_rocket_groundhugger);
 }
 
 void racer_rocket_tracker()
@@ -101,7 +101,7 @@ void racer_rocket_tracker()
     {
         //bprint("Target lost!\n");
         //dprint("OF:", ftos(vlen(newdir - v_forward)), "\n");
-        self.think = racer_rocket_groundhugger;
+        setthink(self, racer_rocket_groundhugger);
         return;
     }
 
index 76deddd9df9cfaaf6bca4f6688ad70c2f84ab90b..e62f033331c6f6adc2aa112b2831073336a21b0f 100644 (file)
@@ -102,7 +102,7 @@ void raptor_land()
        if(hgt < 16)
        {
                self.movetype = MOVETYPE_TOSS;
-               self.think      = vehicles_think;
+               setthink(self, vehicles_think);
                self.frame      = 0;
        }
 
@@ -118,7 +118,7 @@ void raptor_exit(float eject)
 
        if(!IS_DEAD(self))
        {
-               self.think        = raptor_land;
+               setthink(self, raptor_land);
                self.nextthink  = time;
        }
 
@@ -541,7 +541,7 @@ void raptor_blowup()
 void raptor_diethink()
 {SELFPARAM();
        if(time >= self.wait)
-               self.think = raptor_blowup;
+               setthink(self, raptor_blowup);
 
        if(random() < 0.05)
        {
@@ -644,7 +644,7 @@ METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
     instance.takedamage                        = DAMAGE_NO;
     instance.deadflag                  = DEAD_DYING;
     instance.movetype                  = MOVETYPE_BOUNCE;
-    instance.think                             = raptor_diethink;
+    setthink(instance, raptor_diethink);
     instance.nextthink                 = time;
     instance.wait                              = time + 5 + (random() * 5);
 
@@ -724,7 +724,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
         self.bomb1.gun2 = spinner;
 
         // Sigh.
-        self.bomb1.think = raptor_rotor_anglefix;
+        setthink(self.bomb1, raptor_rotor_anglefix);
         self.bomb1.nextthink = time;
 
         self.mass                         = 1 ;
index 14cc7c0ff31f001ee6f31f6dfdaa5cedd24709d9..8eabe1cdd4b410f0ed3112d616e980cd5bbc17cd 100644 (file)
@@ -70,7 +70,7 @@ METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weapone
             _flare.movetype = MOVETYPE_TOSS;
             _flare.gravity = 0.15;
             _flare.velocity = 0.25 * actor.velocity + (v_forward + randomvec() * 0.25)* -500;
-            _flare.think = raptor_flare_think;
+            setthink(_flare, raptor_flare_think);
             _flare.nextthink = time;
             _flare.owner = veh ? veh : player;
             _flare.solid = SOLID_CORPSE;
@@ -100,7 +100,7 @@ void raptor_bomblet_touch()
         return;
 
     PROJECTILE_TOUCH;
-    self.think = raptor_bomblet_boom;
+    setthink(self, raptor_bomblet_boom);
     self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay;
 }
 
@@ -130,7 +130,7 @@ void raptor_bomb_burst()
 
         bomblet.movetype       = MOVETYPE_TOSS;
         settouch(bomblet, raptor_bomblet_touch);
-        bomblet.think     = raptor_bomblet_boom;
+        setthink(bomblet, raptor_bomblet_boom);
         bomblet.nextthink   = time + 5;
         bomblet.owner     = self.owner;
         bomblet.realowner   = self.realowner;
@@ -159,7 +159,8 @@ void raptor_bombdrop()
     bomb_1.velocity     = bomb_2.velocity   = self.velocity;
     settouch(bomb_1, raptor_bomb_burst);
     settouch(bomb_2, raptor_bomb_burst);
-    bomb_1.think               = bomb_2.think    = raptor_bomb_burst;
+    setthink(bomb_1, raptor_bomb_burst);
+    setthink(bomb_2, raptor_bomb_burst);
     bomb_1.cnt           = bomb_2.cnt          = time + 10;
 
     if(autocvar_g_vehicle_raptor_bomblet_alt)
index 864c302d1db7aabfb9d75289a2f722a8b2c69a17..e60b263a6458c3e8aad219ca3932c3e129a390ef 100644 (file)
@@ -351,7 +351,7 @@ void spiderbot_exit(float eject)
                e = e.chain;
        }
 
-       self.think = vehicles_think;
+       setthink(self, vehicles_think);
        self.nextthink = time;
        self.frame = 5;
        self.movetype = MOVETYPE_WALK;
@@ -394,7 +394,7 @@ void spiderbot_exit(float eject)
 
 void spiderbot_headfade()
 {SELFPARAM();
-       self.think = spiderbot_headfade;
+       setthink(self, spiderbot_headfade);
        self.nextthink = self.fade_time;
        self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
 
@@ -451,7 +451,7 @@ void spiderbot_blowup()
        h.cnt = time + (3.5 * random());
        h.fade_rate = 1 / min(self.respawntime, 10);
        h.fade_time = time;
-       h.think = spiderbot_headfade;
+       setthink(h, spiderbot_headfade);
        h.nextthink = time;
 
        org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint01"));
@@ -573,7 +573,7 @@ METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
     instance.takedamage                        = DAMAGE_NO;
     settouch(instance, func_null);
     instance.cnt                               = 3.4 + time + random() * 2;
-    instance.think                             = spiderbot_blowup;
+    setthink(instance, spiderbot_blowup);
     instance.nextthink                 = time;
     instance.deadflag                  = DEAD_DYING;
     instance.frame                             = 5;
index dd209676d49dce7f7206b02c9c286ddc145dc139..405a2ac8d17afe31b32821fe794de265deefe773 100644 (file)
@@ -33,7 +33,7 @@ void spiderbot_rocket_guided()
     self.nextthink  = time;
 
     if(!self.realowner.vehicle)
-        self.think = spiderbot_rocket_unguided;
+        setthink(self, spiderbot_rocket_unguided);
 
     crosshair_trace(self.realowner);
     olddir = normalize(self.velocity);
@@ -56,10 +56,10 @@ void spiderbot_guide_release(entity this)
     crosshair_trace(this.owner);
     while(rkt)
     {
-        if(rkt.think == spiderbot_rocket_guided)
+        if(getthink(rkt) == spiderbot_rocket_guided)
         {
             rkt.pos1 = trace_endpos;
-            rkt.think = spiderbot_rocket_unguided;
+            setthink(rkt, spiderbot_rocket_unguided);
         }
         rkt = rkt.chain;
     }
@@ -196,7 +196,7 @@ void spiderbot_rocket_do(entity this)
             float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos);
             _dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ;
             rocket.nextthink  = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed);
-            rocket.think        = vehicles_projectile_explode;
+            setthink(rocket, vehicles_projectile_explode);
 
             if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1)
                 this.wait = -10;
@@ -209,7 +209,7 @@ void spiderbot_rocket_do(entity this)
             crosshair_trace(this.owner);
             rocket.pos1           = trace_endpos;
             rocket.nextthink  = time;
-            rocket.think         = spiderbot_rocket_guided;
+            setthink(rocket, spiderbot_rocket_guided);
 
 
         break;
index 95b7225cc680c95350b49fe92d32deb31143e045..4354cc415fd056ffc75d22d99e0708c3417a15d4 100644 (file)
@@ -114,7 +114,7 @@ void W_PROP_think()
 STATIC_INIT_LATE(W_PROP_reloader)
 {
     entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
-    WITHSELF(e, (e.think = W_PROP_think)());
+    WITHSELF(e, (setthink(e, W_PROP_think))());
 }
 #endif
 
index a033d2ab0f4fae1fc645753ea86f16b8f5dde4fe..46efc1fae8e7456827fd1f0f31ede46f32a74892 100644 (file)
@@ -256,7 +256,7 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               W_PrepareExplosionByDamage(this, attacker, this.think);
+               W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
 void W_Arc_Bolt_Touch()
@@ -288,7 +288,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep)
 
        settouch(missile, W_Arc_Bolt_Touch);
        missile.use = W_Arc_Bolt_Explode_use;
-       missile.think = adaptor_think2use_hittype_splash;
+       setthink(missile, adaptor_think2use_hittype_splash);
        missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
        PROJECTILE_MAKETRIGGER(missile);
        missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY;
@@ -683,7 +683,7 @@ void W_Arc_Beam(float burst)
 
        entity beam = self.arc_beam = new(W_Arc_Beam);
        beam.solid = SOLID_NOT;
-       beam.think = W_Arc_Beam_Think;
+       setthink(beam, W_Arc_Beam_Think);
        beam.owner = self;
        beam.movetype = MOVETYPE_NONE;
        beam.bot_dodge = true;
@@ -691,7 +691,7 @@ void W_Arc_Beam(float burst)
        beam.beam_bursting = burst;
        Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
-       WITHSELF(beam, beam.think());
+       WITHSELF(beam, getthink(beam)());
 }
 
 void Arc_Smoke()
index 56465e5c8809b62146e684779d1e1c3676a2a130..08b5e3472cbbdea214fdae16fcffe5b88560d8b2 100644 (file)
@@ -81,7 +81,7 @@ void W_Blaster_Touch()
 void W_Blaster_Think()
 {SELFPARAM();
        this.movetype = MOVETYPE_FLY;
-       this.think = SUB_Remove_self;
+       setthink(this, SUB_Remove_self);
        this.nextthink = time + this.blaster_lifetime;
        CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
 }
@@ -139,14 +139,14 @@ void W_Blaster_Attack(
        missile.flags = FL_PROJECTILE;
        missile.missile_flags = MIF_SPLASH;
        missile.projectiledeathtype = atk_deathtype;
-       missile.think = W_Blaster_Think;
+       setthink(missile, W_Blaster_Think);
        missile.nextthink = time + atk_delay;
 
        MUTATOR_CALLHOOK(EditProjectile, actor, missile);
 
        if (time >= missile.nextthink)
        {
-               WITHSELF(missile, missile.think());
+               WITHSELF(missile, getthink(missile)());
        }
 }
 
index fa7b825846a59388a5553bdc4b02827535ae2fa0..0d704da2463637701c4a696262c3f8b74bca4acf 100644 (file)
@@ -416,7 +416,7 @@ void W_Crylink_Attack(Weapon thiswep)
                W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false);
                settouch(proj, W_Crylink_Touch);
 
-               proj.think = W_Crylink_Fadethink;
+               setthink(proj, W_Crylink_Fadethink);
                if(counter == 0)
                {
                        proj.fade_time = time + WEP_CVAR_PRI(crylink, middle_lifetime);
@@ -531,7 +531,7 @@ void W_Crylink_Attack2(Weapon thiswep)
 
                W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false);
                settouch(proj, W_Crylink_Touch);
-               proj.think = W_Crylink_Fadethink;
+               setthink(proj, W_Crylink_Fadethink);
                if(counter == (shots - 1) / 2)
                {
                        proj.fade_time = time + WEP_CVAR_SEC(crylink, middle_lifetime);
@@ -615,7 +615,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit
                 pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
 
                 linkjoineffect = new(linkjoineffect);
-                linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
+                setthink(linkjoineffect, W_Crylink_LinkJoinEffect_Think);
                 linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
                 linkjoineffect.owner = actor;
                 setorigin(linkjoineffect, pos);
index 8c59a7938ac09db9341fae2b7e0085e3eb2e04a1..1966509e6eb5aab8dfa298224f165cfe7b72a633 100644 (file)
@@ -385,7 +385,7 @@ void W_Devastator_Attack(Weapon thiswep)
        missile.angles = vectoangles(missile.velocity);
 
        settouch(missile, W_Devastator_Touch);
-       missile.think = W_Devastator_Think;
+       setthink(missile, W_Devastator_Think);
        missile.nextthink = time;
        missile.cnt = time + WEP_CVAR(devastator, lifetime);
        missile.flags = FL_PROJECTILE;
index 9e13fe2fa07f3d356d2dd3e4ebe0b6c46bbeea97..84bef35b2779dbff132289a8ff84ad62f5e4c9b6 100644 (file)
@@ -104,7 +104,7 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own)
                        e.classname = "electro_orb_chain";
 
                        // now set the next one to trigger as well
-                       e.think = W_Electro_ExplodeCombo;
+                       setthink(e, W_Electro_ExplodeCombo);
 
                        // delay combo chains, looks cooler
                        e.nextthink =
@@ -226,7 +226,7 @@ void W_Electro_Bolt_Think()
                                e.classname = "electro_orb_chain";
 
                                // now set the next one to trigger as well
-                               e.think = W_Electro_ExplodeCombo;
+                               setthink(e, W_Electro_ExplodeCombo);
 
                                // delay combo chains, looks cooler
                                e.nextthink =
@@ -278,7 +278,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep)
        proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_PRI(electro, damage);
        proj.use = W_Electro_Explode_use;
-       proj.think = W_Electro_Bolt_Think;
+       setthink(proj, W_Electro_Bolt_Think);
        proj.nextthink = time;
        proj.ltime = time + WEP_CVAR_PRI(electro, lifetime);
        PROJECTILE_MAKETRIGGER(proj);
@@ -332,7 +332,7 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float
                        // change owner to whoever caused the combo explosion
                        this.realowner = inflictor.realowner;
                        this.classname = "electro_orb_chain";
-                       this.think = W_Electro_ExplodeCombo;
+                       setthink(this, W_Electro_ExplodeCombo);
                        this.nextthink = time +
                                (
                                        // bound the length, inflictor may be in a galaxy far far away (warpzones)
@@ -348,7 +348,7 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float
                else
                {
                        this.use = W_Electro_Explode_use;
-                       this.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
+                       setthink(this, adaptor_think2use); // not _hittype_splash, as this runs "immediately"
                }
        }
 }
@@ -375,7 +375,7 @@ void W_Electro_Attack_Orb(Weapon thiswep)
        entity proj = new(electro_orb);
        proj.owner = proj.realowner = self;
        proj.use = W_Electro_Explode_use;
-       proj.think = adaptor_think2use_hittype_splash;
+       setthink(proj, adaptor_think2use_hittype_splash);
        proj.bot_dodge = true;
        proj.bot_dodgerating = WEP_CVAR_SEC(electro, damage);
        proj.nextthink = time + WEP_CVAR_SEC(electro, lifetime);
index a180ede56463f150045c2491da7423e8b943a31a..de468896f1bf26b4500871c02a06fa0f5f4141de 100644 (file)
@@ -202,7 +202,7 @@ void W_Fireball_Attack1()
        proj.bot_dodgerating = WEP_CVAR_PRI(fireball, damage);
        proj.pushltime = time + WEP_CVAR_PRI(fireball, lifetime);
        proj.use = W_Fireball_Explode_use;
-       proj.think = W_Fireball_Think;
+       setthink(proj, W_Fireball_Think);
        proj.nextthink = time;
        proj.health = WEP_CVAR_PRI(fireball, health);
        proj.team = self.team;
@@ -341,7 +341,7 @@ void W_Fireball_Attack2()
        PROJECTILE_MAKETRIGGER(proj);
        setsize(proj, '-4 -4 -4', '4 4 4');
        setorigin(proj, w_shotorg);
-       proj.think = W_Fireball_Firemine_Think;
+       setthink(proj, W_Fireball_Firemine_Think);
        proj.nextthink = time;
        proj.damageforcescale = WEP_CVAR_SEC(fireball, damageforcescale);
        proj.pushltime = time + WEP_CVAR_SEC(fireball, lifetime);
index de576e6096ee6b0181fa7e1ad207e56a199b6575..35622949c08d0cdcd6ef14522fd7bfcd4cedb5aa 100644 (file)
@@ -110,7 +110,7 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               W_PrepareExplosionByDamage(this, attacker, this.think);
+               W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
 void W_Hagar_Touch()
@@ -157,7 +157,7 @@ void W_Hagar_Attack(Weapon thiswep)
 
        settouch(missile, W_Hagar_Touch);
        missile.use = W_Hagar_Explode_use;
-       missile.think = adaptor_think2use_hittype_splash;
+       setthink(missile, adaptor_think2use_hittype_splash);
        missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
        PROJECTILE_MAKETRIGGER(missile);
        missile.projectiledeathtype = WEP_HAGAR.m_id;
@@ -200,7 +200,7 @@ void W_Hagar_Attack2(Weapon thiswep)
        settouch(missile, W_Hagar_Touch2);
        missile.cnt = 0;
        missile.use = W_Hagar_Explode2_use;
-       missile.think = adaptor_think2use_hittype_splash;
+       setthink(missile, adaptor_think2use_hittype_splash);
        missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
        PROJECTILE_MAKETRIGGER(missile);
        missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
@@ -258,7 +258,7 @@ void W_Hagar_Attack2_Load_Release(.entity weaponentity)
 
                settouch(missile, W_Hagar_Touch); // not bouncy
                missile.use = W_Hagar_Explode2_use;
-               missile.think = adaptor_think2use_hittype_splash;
+               setthink(missile, adaptor_think2use_hittype_splash);
                missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
                PROJECTILE_MAKETRIGGER(missile);
                missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
index 1fd9e08321a79460d48c43725299ba104838b2bf..ae005572015f4ee5c0765bb6818ed35ee575663e 100644 (file)
@@ -105,7 +105,7 @@ void W_HLAC_Attack(Weapon thiswep)
        //missile.angles = vectoangles(missile.velocity); // csqc
 
        settouch(missile, W_HLAC_Touch);
-       missile.think = SUB_Remove_self;
+       setthink(missile, SUB_Remove_self);
 
     missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
 
@@ -147,7 +147,7 @@ void W_HLAC_Attack2()
        //missile.angles = vectoangles(missile.velocity); // csqc
 
        settouch(missile, W_HLAC_Touch);
-       missile.think = SUB_Remove_self;
+       setthink(missile, SUB_Remove_self);
 
     missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
 
index 77e0e1973d4b20469a14c8e03a810bd7c85ce903..adb1781f60d9537fd0dd8c3077b0f5a7cdc208f6 100644 (file)
@@ -105,7 +105,7 @@ void W_Hook_Explode2()
        settouch(self, func_null);
        self.effects |= EF_NODRAW;
 
-       self.think = W_Hook_ExplodeThink;
+       setthink(self, W_Hook_ExplodeThink);
        self.nextthink = time;
        self.dmg = WEP_CVAR_SEC(hook, damage);
        self.dmg_edge = WEP_CVAR_SEC(hook, edgedamage);
@@ -159,7 +159,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor)
        setsize(gren, '0 0 0', '0 0 0');
 
        gren.nextthink = time + WEP_CVAR_SEC(hook, lifetime);
-       gren.think = adaptor_think2use_hittype_splash;
+       setthink(gren, adaptor_think2use_hittype_splash);
        gren.use = W_Hook_Explode2_use;
        settouch(gren, W_Hook_Touch2);
 
index 8b16c273b94c79452b344ce1da99717ccb81ec62..e39adb4e5e79c1e5c7a57fca00add72f6a40d24a 100644 (file)
@@ -80,7 +80,7 @@ void W_MachineGun_MuzzleFlash_Think()
 
        if(this.alpha <= 0)
        {
-               this.think = SUB_Remove_self;
+               setthink(this, SUB_Remove_self);
                this.nextthink = time;
                this.realowner.muzzle_flash = world;
                return;
@@ -97,7 +97,7 @@ void W_MachineGun_MuzzleFlash()
        setmodel(self.muzzle_flash, MDL_MACHINEGUN_MUZZLEFLASH); // precision set below
 
        self.muzzle_flash.scale = 0.75;
-       self.muzzle_flash.think = W_MachineGun_MuzzleFlash_Think;
+       setthink(self.muzzle_flash, W_MachineGun_MuzzleFlash_Think);
        self.muzzle_flash.nextthink = time + 0.02;
        self.muzzle_flash.frame = 2;
        self.muzzle_flash.alpha = 0.75;
index f397e9e99b93f5ddc4a2e0575170f77639675a1e..f8c3c6ca93298ded90dd9b0dd331b24f8353795f 100644 (file)
@@ -97,7 +97,7 @@ void W_MineLayer_Stick(entity to)
        newmine.mine_time = self.mine_time;
 
        settouch(newmine, func_null);
-       newmine.think = W_MineLayer_Think;
+       setthink(newmine, W_MineLayer_Think);
        newmine.nextthink = time;
        newmine.cnt = self.cnt;
        newmine.flags = self.flags;
@@ -356,7 +356,7 @@ void W_MineLayer_Attack(Weapon thiswep)
        mine.angles = vectoangles(mine.velocity);
 
        settouch(mine, W_MineLayer_Touch);
-       mine.think = W_MineLayer_Think;
+       setthink(mine, W_MineLayer_Think);
        mine.nextthink = time;
        mine.cnt = (WEP_CVAR(minelayer, lifetime) - WEP_CVAR(minelayer, lifetime_countdown));
        mine.flags = FL_PROJECTILE;
index 0fc5dd9bd266dd58ad9d419e86f136a7bca03a7f..b264fab0033c32824738c5b26e18b3165b652504 100644 (file)
@@ -235,7 +235,7 @@ void W_Mortar_Attack(Weapon thiswep)
 
        gren.cnt = time + WEP_CVAR_PRI(mortar, lifetime);
        gren.nextthink = time;
-       gren.think = W_Mortar_Grenade_Think1;
+       setthink(gren, W_Mortar_Grenade_Think1);
        gren.use = W_Mortar_Grenade_Explode_use;
        settouch(gren, W_Mortar_Grenade_Touch1);
 
@@ -282,7 +282,7 @@ void W_Mortar_Attack2(Weapon thiswep)
        setsize(gren, '-3 -3 -3', '3 3 3');
 
        gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime);
-       gren.think = adaptor_think2use_hittype_splash;
+       setthink(gren, adaptor_think2use_hittype_splash);
        gren.use = W_Mortar_Grenade_Explode2_use;
        settouch(gren, W_Mortar_Grenade_Touch2);
 
index 867dd286c799855c7848834198f4f126ef530018..bef792cc533227edf82e95c705c3afb377aeb88c 100644 (file)
@@ -265,7 +265,7 @@ void W_Porto_Attack(float type)
        setsize(gren, '0 0 0', '0 0 0');
 
        gren.nextthink = time + WEP_CVAR_BOTH(porto, (type <= 0), lifetime);
-       gren.think = W_Porto_Think;
+       setthink(gren, W_Porto_Think);
        settouch(gren, W_Porto_Touch);
 
        if(self.items & ITEM_Strength.m_itemid)
index 448c4363ab076fa7f1fc9d55462fa70e8cb0bf66..2e98fdbe3c8d0f8337e60a003d9e741e464b6454 100644 (file)
@@ -266,7 +266,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target)
        missile.bot_dodge       = true;
        missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage);
 
-       missile.think           = W_Seeker_Missile_Think;
+       setthink(missile, W_Seeker_Missile_Think);
        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");
@@ -361,7 +361,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep)
        missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
        settouch(missile, W_Seeker_Flac_Explode);
        missile.use                     = W_Seeker_Flac_Explode_use;
-       missile.think                   = adaptor_think2use_hittype_splash;
+       setthink(missile, adaptor_think2use_hittype_splash);
        missile.nextthink               = time + WEP_CVAR(seeker, flac_lifetime) + WEP_CVAR(seeker, flac_lifetime_rand);
        missile.solid                   = SOLID_BBOX;
        missile.movetype                = MOVETYPE_FLY;
@@ -539,12 +539,12 @@ void W_Seeker_Tag_Touch()
                        {
                                e.tag_target  = other;
                                e.tag_time    = time;
-                               e.think       = W_Seeker_Tracker_Think;
+                               setthink(e, W_Seeker_Tracker_Think);
                        }
                        else
                        {
                                e.enemy     = other;
-                               e.think     = W_Seeker_Vollycontroller_Think;
+                               setthink(e, W_Seeker_Vollycontroller_Think);
                        }
 
                        e.nextthink   = time;
@@ -573,7 +573,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
        missile.bot_dodge       = true;
        missile.bot_dodgerating = 50;
        settouch(missile, W_Seeker_Tag_Touch);
-       missile.think           = SUB_Remove_self;
+       setthink(missile, SUB_Remove_self);
        missile.nextthink       = time + WEP_CVAR(seeker, tag_lifetime);
        missile.movetype        = MOVETYPE_FLY;
        missile.solid           = SOLID_BBOX;
index 64264de593a103140f7b9c1cbb15abe0130fbd15..3b6266f6ed6af510079d64153327d2012085c0de 100644 (file)
@@ -241,7 +241,7 @@ void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int f
 
        entity meleetemp = new_pure(meleetemp);
        meleetemp.owner = meleetemp.realowner = actor;
-       meleetemp.think = W_Shockwave_Melee_Think;
+       setthink(meleetemp, W_Shockwave_Melee_Think);
        meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
        W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
 }
index 568b1fe6bac6cab27a583819a07165c3628002a2..361f70a84365345d48291b5bf358aaeda6b0b152 100644 (file)
@@ -79,7 +79,7 @@ void W_Shotgun_Attack(Weapon thiswep, float isprimary)
        // muzzle flash for 1st person view
        flash = spawn();
        setmodel(flash, MDL_SHOTGUN_MUZZLEFLASH); // precision set below
-       flash.think = SUB_Remove_self;
+       setthink(flash, SUB_Remove_self);
        flash.nextthink = time + 0.06;
        flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
        W_AttachToShotorg(self, flash, '5 0 0');
@@ -190,7 +190,7 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int f
 
        entity meleetemp = new_pure(meleetemp);
        meleetemp.realowner = actor;
-       meleetemp.think = W_Shotgun_Melee_Think;
+       setthink(meleetemp, W_Shotgun_Melee_Think);
        meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor();
        W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
 }
index abd38708411255157cb92a9f32fca9b1c22edc8e..3f1aca6661fd73dcdb6ca20947a971eebf995060 100644 (file)
@@ -338,7 +338,7 @@ void W_Tuba_NoteOn(float hittype)
                self.tuba_note.owner = self.tuba_note.realowner = self;
                self.tuba_note.cnt = n;
                self.tuba_note.tuba_instrument = self.tuba_instrument;
-               self.tuba_note.think = W_Tuba_NoteThink;
+               setthink(self.tuba_note, W_Tuba_NoteThink);
                self.tuba_note.nextthink = time;
                self.tuba_note.spawnshieldtime = time;
                Net_LinkEntity(self.tuba_note, false, 0, W_Tuba_NoteSendEntity);
@@ -631,9 +631,9 @@ NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
                }
        }
 
-       this.think = Ent_TubaNote_StopSound_self;
+       setthink(this, Ent_TubaNote_StopSound_self);
        this.entremove = Ent_TubaNote_StopSound;
-       this.enemy.think = Ent_TubaNote_Think;
+       setthink(this.enemy, Ent_TubaNote_Think);
        this.enemy.nextthink = time + 10;
 
        if (upd) {
index beba679956196ec75bcb8df0d55fc7cc6cc4a9ee..320f0e46c9a3a61e173f3d1be17280bac8137d7b 100644 (file)
@@ -137,7 +137,7 @@ void VaporizerBeam_Draw(entity this)
 NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
 {
        Net_Accept(vortex_beam);
-       this.think = SUB_Remove_self;
+       setthink(this, SUB_Remove_self);
        this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
        this.draw = VaporizerBeam_Draw;
        this.drawmask = MASK_NORMAL;
@@ -264,7 +264,7 @@ void W_RocketMinsta_Attack2()
         proj.bot_dodge = true;
         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
         proj.use = W_RocketMinsta_Laser_Explode_use;
-        proj.think = adaptor_think2use_hittype_splash;
+        setthink(proj, adaptor_think2use_hittype_splash);
         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
         PROJECTILE_MAKETRIGGER(proj);
         proj.projectiledeathtype = WEP_ELECTRO.m_id;
@@ -316,7 +316,7 @@ void W_RocketMinsta_Attack3 ()
         proj.bot_dodge = true;
         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
         proj.use = W_RocketMinsta_Laser_Explode_use;
-        proj.think = adaptor_think2use_hittype_splash;
+        setthink(proj, adaptor_think2use_hittype_splash);
         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
         PROJECTILE_MAKETRIGGER(proj);
         proj.projectiledeathtype = WEP_ELECTRO.m_id;
index 24764ae1585038b96257e139e857f7f30417dae5..d56895dcae4e4ab76f7c6947690e5a6bcf6db872 100644 (file)
@@ -7,8 +7,6 @@
 
        entityclass(Defer);
        class(Defer).entity owner;
-       class(Defer).void() think;
-       class(Defer).float nextthink;
        class(Defer).void(entity) defer_func;
 
        /** Remove self */
@@ -27,7 +25,7 @@
        void defer_think()
        {
                SELFPARAM();
-               this.think     = SUB_Remove_self;
+               setthink(this, SUB_Remove_self);
                this.nextthink = time;
                this.defer_func(this.owner);
        }
@@ -41,7 +39,7 @@
                entity e    = new_pure(deferred);
                e.owner     = this;
                e.defer_func = func;
-               e.think     = defer_think;
+               setthink(e, defer_think);
                e.nextthink = time + fdelay;
        }
 
index 03e5c9dd8941d6a1143effdf28ce3290638f9333..49f778a5259de4acc197591f3ffc66c35884a1f7 100644 (file)
@@ -124,7 +124,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                if (dt)
                {
                        e.nextthink = time + dt;
-                       e.think = SUB_Remove_self;
+                       setthink(e, SUB_Remove_self);
                }
        }
 
index 6b7201dcfeb6fb7873d48828ea39e174c8b3581a..da85a2adc9e20d8f1366cc213c45ef928578eab8 100644 (file)
@@ -62,7 +62,8 @@ noref entity _selftemp;
     (0, (e).__##T)
 
 SELFWRAP(think, void, (entity this), (this))
-#define setthink(e, f) SELFWRAP_SET(think, e, f)
+#define setthink(e, f) _SELFWRAP_SET(think, e, f)
+#define getthink(e) _SELFWRAP_GET(think, e)
 
 SELFWRAP(touch, void, (entity this), (this))
 #define settouch(e, f) _SELFWRAP_SET(touch, e, f)
index 832e32e01d6144e6bc453a894c67a5e490504272..d3d7250e856974977f6501d1550d1256eb81afc0 100644 (file)
@@ -680,7 +680,7 @@ void WarpZone_RefSys_CheckCreate(entity me)
        {
                me.WarpZone_refsys = new(warpzone_refsys);
                me.WarpZone_refsys.owner = me;
-               me.WarpZone_refsys.think = WarpZone_RefSys_GC;
+               setthink(me.WarpZone_refsys, WarpZone_RefSys_GC);
                me.WarpZone_refsys.nextthink = time + 1;
                WarpZone_Accumulator_Clear(me.WarpZone_refsys);
        }
index ddaa41657907c285f919ccd3cad6f8f6dabf17d8..9bc39463e1b9881731c4412c8be8274c520ab45c 100644 (file)
@@ -173,7 +173,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
                ts.SendEntity3 = WarpZone_Teleported_Send;
                ts.SendFlags = 0xFFFFFF;
                ts.drawonlytoclient = player;
-               ts.think = SUB_Remove_self;
+               setthink(ts, SUB_Remove_self);
                ts.nextthink = time + 1;
                ts.owner = player;
                ts.enemy = wz;
@@ -582,7 +582,7 @@ void WarpZoneCamera_InitStep_FindTarget(entity this)
        this.SendFlags = 0xFFFFFF;
        if(this.spawnflags & 1)
        {
-               this.think = WarpZoneCamera_Think;
+               setthink(this, WarpZoneCamera_Think);
                this.nextthink = time;
        }
        else
@@ -723,7 +723,7 @@ void WarpZone_InitStep_FinalizeTransform(entity this)
        this.SendFlags = 0xFFFFFF;
        if(this.spawnflags & 1)
        {
-               this.think = WarpZone_Think;
+               setthink(this, WarpZone_Think);
                this.nextthink = time;
        }
        else
index bba6a1b9e2a7084b1fb9a1ad06a2a975c57b7596..2f0b425399560f77a4df0efe89d322a5a874cc7f 100644 (file)
@@ -289,7 +289,7 @@ void waypoint_schedulerelink(entity wp)
        if (!(wp.wpflags & WAYPOINTFLAG_NORELINK))
                waypoint_clearlinks(wp);
        // schedule an actual relink on next frame
-       wp.think = waypoint_think;
+       setthink(wp, waypoint_think);
        wp.nextthink = time;
        wp.effects = EF_LOWPRECISION;
 }
index cc1d6cb7d43f0780fe288af3097a611b8ce19e2d..55440ca8c0be2615903fcc7039a96dad8d32bd1f 100644 (file)
@@ -391,7 +391,7 @@ float CheatCommand(entity this, int argc)
                case "dragbox_spawn": {
                        IS_CHEAT(this, 0, argc, 0);
                        entity e = new(dragbox_box);
-                       e.think = DragBox_Think;
+                       setthink(e, DragBox_Think);
                        e.nextthink = time;
                        e.solid = -1; // black
                        setmodel(e, MDL_Null); // network it
@@ -441,7 +441,7 @@ float CheatCommand(entity this, int argc)
                case "dragpoint_spawn": {
                        IS_CHEAT(this, 0, argc, 0);
                        entity e = new(dragpoint);
-                       e.think = DragBox_Think;
+                       setthink(e, DragBox_Think);
                        e.nextthink = time;
                        e.solid = 0; // nothing special
                        setmodel(e, MDL_MARKER);
index 7ba3ed5359ccb0f0997d0e50e7bcdc08d026c76b..4dd0c2f767e459b86093a1cf57e97f361ffd53b7 100644 (file)
@@ -294,7 +294,7 @@ void PutObserverInServer()
        this.superweapons_finished = 0;
        this.pushltime = 0;
        this.istypefrag = 0;
-       this.think = func_null;
+       setthink(this, func_null);
        this.nextthink = 0;
        this.hook_time = 0;
        this.deadflag = DEAD_NO;
@@ -547,7 +547,7 @@ void PutClientInServer()
                this.pain_frame = 0;
                this.pain_finished = 0;
                this.pushltime = 0;
-               this.think = func_null; // players have no think function
+               setthink(this, func_null); // players have no think function
                this.nextthink = 0;
                this.dmg_team = 0;
                this.ballistics_density = autocvar_g_ballistics_density_player;
@@ -709,7 +709,7 @@ void ClientInit_CheckUpdate()
 void ClientInit_Spawn()
 {
        entity e = new_pure(clientinit);
-       e.think = ClientInit_CheckUpdate;
+       setthink(e, ClientInit_CheckUpdate);
        Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
 
        WITHSELF(e, ClientInit_CheckUpdate());
@@ -891,7 +891,7 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                        this.killindicator.scale = 0.5;
                        setattachment(this.killindicator, this, "");
                        setorigin(this.killindicator, '0 0 52');
-                       this.killindicator.think = KillIndicator_Think;
+                       setthink(this.killindicator, KillIndicator_Think);
                        this.killindicator.nextthink = starttime + (this.lip) * 0.05;
                        clientkilltime = max(clientkilltime, this.killindicator.nextthink + 0.05);
                        this.killindicator.cnt = ceil(killtime);
@@ -907,7 +907,7 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                                e.killindicator.scale = 0.5;
                                setattachment(e.killindicator, e, "");
                                setorigin(e.killindicator, '0 0 52');
-                               e.killindicator.think = KillIndicator_Think;
+                               setthink(e.killindicator, KillIndicator_Think);
                                e.killindicator.nextthink = starttime + (e.lip) * 0.05;
                                clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05);
                                e.killindicator.cnt = ceil(killtime);
@@ -1258,7 +1258,7 @@ void UpdateChatBubble()
                this.chatbubbleentity = new(chatbubbleentity);
                this.chatbubbleentity.owner = this;
                this.chatbubbleentity.exteriormodeltoclient = this;
-               this.chatbubbleentity.think = ChatBubbleThink;
+               setthink(this.chatbubbleentity, ChatBubbleThink);
                this.chatbubbleentity.nextthink = time;
                setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
                //setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
index 8aaf68cda69dac1753364cfe1e84cd07c10129c3..5722934f8e93afd4ebc366c3991879a06d600ad3 100644 (file)
@@ -45,8 +45,8 @@ void CopyBody_Think()
                if(wasfreed(this))
                        return;
                this.CopyBody_nextthink = this.nextthink;
-               this.CopyBody_think = this.think;
-               this.think = CopyBody_Think;
+               this.CopyBody_think = getthink(this);
+               setthink(this, CopyBody_Think);
        }
        CSQCMODEL_AUTOUPDATE(this);
        this.nextthink = time;
@@ -118,9 +118,9 @@ void CopyBody(entity this, float keepvelocity)
 
        CSQCMODEL_AUTOINIT(clone);
        clone.CopyBody_nextthink = this.nextthink;
-       clone.CopyBody_think = this.think;
+       clone.CopyBody_think = getthink(this);
        clone.nextthink = time;
-       clone.think = CopyBody_Think;
+       setthink(clone, CopyBody_Think);
        // "bake" the current animation frame for clones (they don't get clientside animation)
        animdecide_load_if_needed(clone);
        animdecide_setframes(clone, false, frame, frame1time, frame2, frame2time);
@@ -622,10 +622,10 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                // set up to fade out later
                SUB_SetFade (this, time + 6 + random (), 1);
                // reset body think wrapper broken by SUB_SetFade
-               if(this.classname == "body" && this.think != CopyBody_Think) {
-                       this.CopyBody_think = this.think;
+               if(this.classname == "body" && getthink(this) != CopyBody_Think) {
+                       this.CopyBody_think = getthink(this);
                        this.CopyBody_nextthink = this.nextthink;
-                       this.think = CopyBody_Think;
+                       setthink(this, CopyBody_Think);
                        this.nextthink = time;
                }
 
index 14965d8c73be1189f3c0abb44675cd0af0ffcedc..a798f286644588d8057d98ab83ef0c8e291a740f 100644 (file)
@@ -740,7 +740,7 @@ void CommonCommand_timeout(float request, entity caller)  // DEAR GOD THIS COMMA
                                        timeout_leadtime = autocvar_sv_timeout_leadtime;
 
                                        timeout_handler = spawn();
-                                       timeout_handler.think = timeout_handler_think;
+                                       setthink(timeout_handler, timeout_handler_think);
                                        timeout_handler.nextthink = time;  // always let the entity think asap
 
                                        Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_TIMEOUT);
index 5105a5b19cc42d715cd37d382e86975b5c44e938..138657b885efb99452da05c75b5ebb316bc85d44 100644 (file)
@@ -374,7 +374,7 @@ float RadarMap_Make(float argc)
        if (!radarmapper)
        {
                radarmapper = new(radarmapper);
-               radarmapper.think = RadarMap_Think;
+               setthink(radarmapper, RadarMap_Think);
                radarmapper.nextthink = time;
                radarmapper.count = 8;  // default to the --trace method, as it is faster now
                radarmapper.ltime = 1;
index 3cea4fcc7cf4b43708dbeb5b86a5a3c21e143e81..bc530b9bce44fa6d4b27e40a148d6b9c97c18d12 100644 (file)
@@ -50,7 +50,7 @@ void make_mapinfo_Think()
        }
        else
        {
-               self.think = make_mapinfo_Think;
+               setthink(self, make_mapinfo_Think);
                self.nextthink = time;
        }
 }
@@ -969,7 +969,7 @@ void GameCommand_make_mapinfo(float request)
                        entity tmp_entity;
 
                        tmp_entity = new(make_mapinfo);
-                       tmp_entity.think = make_mapinfo_Think;
+                       setthink(tmp_entity, make_mapinfo_Think);
                        tmp_entity.nextthink = time;
                        MapInfo_Enumerate();
                        return;
index c07d570485d27078385e421bb6b16aa9ac1aa5f2..15d27a3ee4dabc3528a769062d32be456c13ceb2 100644 (file)
@@ -439,7 +439,7 @@ void ReadyRestart_force()
        if (autocvar_sv_ready_restart_after_countdown)
        {
                entity restart_timer = new_pure(restart_timer);
-               restart_timer.think = ReadyRestart_think;
+               setthink(restart_timer, ReadyRestart_think);
                restart_timer.nextthink = game_starttime;
        }
 
index 0c76214c8744f1cdf592574599e9db1585776c27..6081b5ba986c8fe949795250bb7ded4a12fa9591 100644 (file)
@@ -531,7 +531,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
        entity ice = new(ice);
        ice.owner = targ;
        ice.scale = targ.scale;
-       ice.think = Ice_Think;
+       setthink(ice, Ice_Think);
        ice.nextthink = time;
        ice.frame = floor(random() * 21); // ice model has 20 different looking frames
        setmodel(ice, MDL_ICE);
@@ -850,7 +850,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                        farcent.origin = hitloc;
                        farcent.forcetype = FORCETYPE_FORCEATPOS;
                        farcent.nextthink = time + 0.1;
-                       farcent.think = SUB_Remove_self;
+                       setthink(farcent, SUB_Remove_self);
                }
                else
                {
@@ -1092,7 +1092,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
                {
                        // print("adding a fire burner to ", e.classname, "\n");
                        e.fire_burner = new(fireburner);
-                       e.fire_burner.think = fireburner_think;
+                       setthink(e.fire_burner, fireburner_think);
                        e.fire_burner.nextthink = time;
                        e.fire_burner.owner = e;
                }
index 774e143e1e32ca293e9e70c5cbc0510576731e61..34719e2f49d1d89ee150b1f3c9fef7fbfdbc84b7 100644 (file)
@@ -97,7 +97,7 @@ void GrapplingHook_Stop()
        sound (self, CH_SHOTS, SND_HOOK_IMPACT, VOL_BASE, ATTEN_NORM);
 
        self.state = 1;
-       self.think = GrapplingHookThink;
+       setthink(self, GrapplingHookThink);
        self.nextthink = time;
        settouch(self, func_null);
        self.velocity = '0 0 0';
@@ -386,7 +386,7 @@ void FireGrapplingHook ()
        //missile.glow_color = 250; // 244, 250
        //missile.glow_size = 120;
        settouch(missile, GrapplingHookTouch);
-       missile.think = GrapplingHookThink;
+       setthink(missile, GrapplingHookThink);
        missile.nextthink = time;
 
        missile.effects = /*EF_FULLBRIGHT | EF_ADDITIVE |*/ EF_LOWPRECISION;
index 2b1d12b9494df4d86591989f1c6c8112df2052b0..b8237fa6da196778bad5a2ee8ddd91439ea73b51 100644 (file)
@@ -55,7 +55,7 @@ void dynlight_find_aiment(entity this)
        self.punchangle = targ.angles;
        self.view_ofs = self.origin - targ.origin;
        self.v_angle = self.angles - targ.angles;
-       self.think = dynlight_think;
+       setthink(self, dynlight_think);
        self.nextthink = time + 0.1;
 }
 void dynlight_find_path(entity this)
@@ -67,7 +67,7 @@ void dynlight_find_path(entity this)
        targ = find(world, targetname, self.target);
        self.target = targ.target;
        setorigin (self, targ.origin);
-       self.think = train_next;
+       setthink(self, train_next);
        self.nextthink = time + 0.1;
 }
 void dynlight_find_target(entity this)
@@ -79,7 +79,7 @@ void dynlight_find_target(entity this)
        targ = find(world, targetname, self.target);
        setattachment(self, targ, self.dtagname);
        self.owner = targ;
-       self.think = dynlight_think;
+       setthink(self, dynlight_think);
        self.nextthink = time + 0.1;
 }
 void dynlight_use(entity this, entity actor, entity trigger)
index 91f8ec5014a82eb4c1b450d0414ff3ca735fbed9..f55b4f71926619c735db8927627c9215c3e1139b 100644 (file)
@@ -82,7 +82,7 @@ void PingPLReport_Think()
 void PingPLReport_Spawn()
 {
        pingplreport = new_pure(pingplreport);
-       pingplreport.think = PingPLReport_Think;
+       setthink(pingplreport, PingPLReport_Think);
        pingplreport.nextthink = time;
 }
 
@@ -525,10 +525,10 @@ void RandomSeed_Think()
 void RandomSeed_Spawn()
 {
        randomseed = new_pure(randomseed);
-       randomseed.think = RandomSeed_Think;
+       setthink(randomseed, RandomSeed_Think);
        Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
 
-       WITHSELF(randomseed, randomseed.think()); // sets random seed and nextthink
+       WITHSELF(randomseed, getthink(randomseed)()); // sets random seed and nextthink
 }
 
 spawnfunc(__init_dedicated_server)
@@ -543,7 +543,7 @@ spawnfunc(__init_dedicated_server)
        remove = remove_unsafely;
 
        entity e = spawn();
-       e.think = GotoFirstMap;
+       setthink(e, GotoFirstMap);
        e.nextthink = time; // this is usually 1 at this point
 
        e = new(info_player_deathmatch);  // safeguard against player joining
index d129d994f4db575187797ec149ab315626cba43b..ec845454a951714885dbf5768bc6e6a4703f02c3 100644 (file)
@@ -319,7 +319,7 @@ void Ban_LoadBans()
        }
 
        entity e = new(bansyncer);
-       e.think = OnlineBanList_Think;
+       setthink(e, OnlineBanList_Think);
        e.nextthink = time + 1;
 }
 
index b1d3857b4ba8692966038826ce473ae501b4dbde..f22ba7bd9c8c8be7f589e46986b801d28602c3d6 100644 (file)
@@ -401,7 +401,7 @@ spawnfunc(func_assault_wall)
        this.mdl = this.model;
        _setmodel(this, this.mdl);
        this.solid = SOLID_BSP;
-       this.think = assault_wall_think;
+       setthink(this, assault_wall_think);
        this.nextthink = time;
        InitializeEntity(this, assault_setenemytoobjective, INITPRIO_FINDTARGET);
 }
index 0b354425a4f3df6679797f5d981536f938b28dd2..4f449a1923448fa662e18abf5075e7e266beb507 100644 (file)
@@ -1212,7 +1212,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
        flag.mangle = flag.angles;
        flag.reset = ctf_Reset;
        settouch(flag, ctf_FlagTouch);
-       flag.think = ctf_FlagThink;
+       setthink(flag, ctf_FlagThink);
        flag.nextthink = time + FLAG_THINKRATE;
        flag.ctf_status = FLAG_BASE;
 
index b669553dbef3f432f5ab36247598d23e88793786..ecf3cb0c13d9585fa5e04f5d05750dc9663aafb9 100644 (file)
@@ -101,7 +101,7 @@ void CTS_ClientKill(entity e) // silent version of ClientKill, used when player
 {
     e.killindicator = spawn();
     e.killindicator.owner = e;
-    e.killindicator.think = KillIndicator_Think;
+    setthink(e.killindicator, KillIndicator_Think);
     e.killindicator.nextthink = time + (e.lip) * 0.05;
     e.killindicator.cnt = ceil(autocvar_g_cts_finish_kill_delay);
     e.killindicator.health = 1; // this is used to indicate that it should be silent
index 49623a36e9a8a9dc9c3b2e2d95b2acc379d44cc8..7bed67bc9679341c07cd464261efd76863f901a4 100644 (file)
@@ -350,7 +350,7 @@ void dom_controlpoint_setup(entity this)
        if(!self.t_length)
                self.t_length = 239; // maximum frame
 
-       self.think = dompointthink;
+       setthink(self, dompointthink);
        self.nextthink = time;
        settouch(self, dompointtouch);
        self.solid = SOLID_TRIGGER;
@@ -540,7 +540,7 @@ spawnfunc(dom_controlpoint)
                remove(this);
                return;
        }
-       this.think = dom_controlpoint_setup_self;
+       setthink(this, dom_controlpoint_setup_self);
        this.nextthink = time + 0.1;
        this.reset = dom_controlpoint_setup;
 
@@ -657,7 +657,7 @@ void dom_spawnpoint(vector org)
 {
        entity e = spawn();
        e.classname = "dom_controlpoint";
-       e.think = self_spawnfunc_dom_controlpoint;
+       setthink(e, self_spawnfunc_dom_controlpoint);
        e.nextthink = time;
        setorigin(e, org);
        spawnfunc_dom_controlpoint(e);
index 42592dda7a3e4f060e6b6058bda631de0adfd2af..418e5638dcb64eaed4dbe5b74fd4689da973aa62 100644 (file)
@@ -141,7 +141,7 @@ void invasion_SpawnChosenMonster(float mon)
                        monster = spawnmonster("", mon, world, world, e.origin, false, false, 2);
                else return;
 
-               e.think = SUB_Remove_self;
+               setthink(e, SUB_Remove_self);
                e.nextthink = time + 0.1;
        }
        else
index b6d3ca3c0ca2d6f8f58fabec4ef683b1c3cf49f6..0d46dcaa472868f4a7a86590515ca5b106c4043e 100644 (file)
@@ -82,6 +82,8 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an
 }
 
 void ka_TouchEvent();
+void ka_RespawnBall(entity this);
+void ka_RespawnBall_self() { SELFPARAM(); ka_RespawnBall(this); }
 void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
 {
        if(gameover) { return; }
@@ -100,7 +102,7 @@ void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
        self.angles = '0 0 0';
        self.effects = autocvar_g_keepawayball_effects;
        settouch(self, ka_TouchEvent);
-       setthink(self, ka_RespawnBall);
+       setthink(self, ka_RespawnBall_self);
        self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
        Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
@@ -154,7 +156,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
        self.movetype = MOVETYPE_NONE;
        self.effects |= EF_NODRAW;
        settouch(self, func_null);
-       self.think = ka_TimeScoring;
+       setthink(self, ka_TimeScoring);
        self.nextthink = time + autocvar_g_keepaway_score_timeinterval;
        self.takedamage = DAMAGE_NO;
 
@@ -193,7 +195,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
        ball.movetype = MOVETYPE_BOUNCE;
        ball.wait = time + 1;
        settouch(ball, ka_TouchEvent);
-       setthink(ball, ka_RespawnBall);
+       setthink(ball, ka_RespawnBall_self);
        ball.nextthink = time + autocvar_g_keepawayball_respawntime;
        ball.takedamage = DAMAGE_YES;
        ball.effects &= ~EF_NODRAW;
@@ -230,7 +232,7 @@ void ka_Reset(entity this)
 
        if(time < game_starttime)
        {
-               setthink(this, ka_RespawnBall);
+               setthink(this, ka_RespawnBall_self);
                settouch(this, func_null);
                this.nextthink = game_starttime;
        }
index 8886753aab53351e872be82c2ff7fde1407a92de..6552d3c4a2386bccf3f4aa2997061e7ec77f317d 100644 (file)
@@ -220,7 +220,7 @@ void kh_Controller_Think()  // called a lot
        if(intermission_running)
                return;
        if(self.cnt > 0)
-       { if(self.think != kh_WaitForPlayers) { self.cnt -= 1; } }
+       { if(getthink(self) != kh_WaitForPlayers) { self.cnt -= 1; } }
        else if(self.cnt == 0)
        {
                self.cnt -= 1;
@@ -793,7 +793,7 @@ void kh_Key_Spawn(entity initial_owner, float _angle, float i)  // runs every ti
        key.count = i;
        key.classname = STR_ITEM_KH_KEY;
        settouch(key, kh_Key_Touch);
-       key.think = kh_Key_Think;
+       setthink(key, kh_Key_Think);
        key.nextthink = time;
        key.items = IT_KEY1 | IT_KEY2;
        key.cnt = _angle;
@@ -1058,7 +1058,7 @@ void kh_Initialize()  // sets up th KH environment
 
        // make a KH entity for controlling the game
        kh_controller = spawn();
-       kh_controller.think = kh_Controller_Think;
+       setthink(kh_controller, kh_Controller_Think);
        kh_Controller_SetThink(0, kh_WaitForPlayers);
 
        setmodel(kh_controller, MDL_KH_KEY);
index 22850d8b8be9221dbae26169b3a2bed7a2632539..f45fc84cce2affe1a968378c012301281265f2ad 100644 (file)
@@ -312,7 +312,7 @@ MUTATOR_HOOKFUNCTION(lms, OnEntityPreSpawn)
        if (self.classname != "item_health_mega") return false;
 
        entity e = spawn();
-       e.think = lms_extralife;
+       setthink(e, lms_extralife);
 
        e.nextthink = time + 0.1;
        e.spawnflags = self.spawnflags;
index 16f31e6efb691d56ec288327da5b6b5844fa867f..fff4b606c65e2a718b84f26aa65674228fd74dea 100644 (file)
@@ -36,19 +36,19 @@ void __showpath2_think()
        #endif
     if(self.path_next)
     {
-        self.path_next.think     = __showpath2_think;
+        setthink(self.path_next, __showpath2_think);
         self.path_next.nextthink = time + 0.15;
     }
     else
     {
-        self.owner.think     = __showpath2_think;
+        setthink(self.owner, __showpath2_think);
         self.owner.nextthink = time + 0.15;
     }
 }
 
 void pathlib_showpath2(entity path)
 {
-    path.think     = __showpath2_think;
+    setthink(path, __showpath2_think);
     path.nextthink = time;
 }
 
@@ -82,7 +82,7 @@ void pathlib_showsquare(vector where,float goodsquare,float _lifetime)
 
     s           = spawn();
     s.alpha     = 0.25;
-    s.think     = SUB_Remove_self;
+    setthink(s, SUB_Remove_self);
     s.nextthink = _lifetime;
     s.scale     = pathlib_gridsize / 512.001;
     s.solid     = SOLID_NOT;
@@ -107,7 +107,7 @@ void pathlib_showedge(vector where,float _lifetime,float rot)
 
     e           = spawn();
     e.alpha     = 0.25;
-    e.think     = SUB_Remove_self;
+    setthink(e, SUB_Remove_self);
     e.nextthink = _lifetime;
     e.scale     = pathlib_gridsize / 512;
     e.solid     = SOLID_NOT;
index de63f22ce8e0c4d98a095420f52aed71368ec980..cb38136cb0058b1d4e67d97bb2f4c1f02733edb3 100644 (file)
@@ -11,7 +11,7 @@ void pathlib_deletepath(entity start)
     e = findchainentity(owner, start);
     while(e)
     {
-        e.think = SUB_Remove_self;
+        setthink(e, SUB_Remove_self);
         e.nextthink = time;
         e = e.chain;
     }
@@ -23,7 +23,7 @@ const float PATHLIB_NODEEXPIRE = 20;
 void dumpnode(entity n)
 {
     n.is_path_node = false;
-    n.think        = SUB_Remove_self;
+    setthink(n, SUB_Remove_self);
     n.nextthink    = time;
 }
 
@@ -49,7 +49,7 @@ entity pathlib_mknode(vector where,entity parent)
 
     node = spawn();
 
-    node.think        = SUB_Remove_self;
+    setthink(node, SUB_Remove_self);
     node.nextthink    = time + PATHLIB_NODEEXPIRE;
     node.is_path_node = true;
     node.owner        = openlist;
index decc36d9f8b14fb9ba7337803daef3a3c315fabc..2188702f96d961a80c973ec76cf77ed2f5305c6a 100644 (file)
@@ -102,7 +102,7 @@ vector pathlib_walknode(entity this, vector start, vector end, float doedge)
     {
         entity a;
         a = spawn();
-        a.think = a_think;
+        setthink(a, a_think);
         a.nextthink = time;
         setorigin(a,start + movenode_stepup);
         a.pos1 = trace_endpos;
index 655482f346183ffd274366a272d7b5c734e8c9ab..e96de83283e50cbd2e92628ffcf85898c54030a8 100644 (file)
@@ -246,6 +246,6 @@ void pathlib_waypointpath_autostep()
 {
     entity n;
     n = spawn();
-    n.think = plas_think;
+    setthink(n, plas_think);
     n.nextthink = time + 0.1;
 }
index c6d31ecbb5966751df0ff689466ad6485d6c89bc..01f578a82345ffb72a94251fe059f00e2a646a68 100644 (file)
@@ -328,7 +328,7 @@ void Portal_MakeBrokenPortal(entity portal)
        portal.skin = 2;
        portal.solid = SOLID_NOT;
        settouch(portal, func_null);
-       portal.think = func_null;
+       setthink(portal, func_null);
        portal.effects = 0;
        portal.nextthink = 0;
        portal.takedamage = DAMAGE_NO;
@@ -339,7 +339,7 @@ void Portal_MakeWaitingPortal(entity portal)
        portal.skin = 2;
        portal.solid = SOLID_NOT;
        settouch(portal, func_null);
-       portal.think = func_null;
+       setthink(portal, func_null);
        portal.effects = EF_ADDITIVE;
        portal.nextthink = 0;
        portal.takedamage = DAMAGE_YES;
@@ -350,7 +350,7 @@ void Portal_MakeInPortal(entity portal)
        portal.skin = 0;
        portal.solid = SOLID_NOT; // this is done when connecting them!
        settouch(portal, Portal_Touch);
-       portal.think = Portal_Think;
+       setthink(portal, Portal_Think);
        portal.effects = EF_RED;
        portal.nextthink = time;
        portal.takedamage = DAMAGE_NO;
@@ -361,7 +361,7 @@ void Portal_MakeOutPortal(entity portal)
        portal.skin = 1;
        portal.solid = SOLID_NOT;
        settouch(portal, func_null);
-       portal.think = func_null;
+       setthink(portal, func_null);
        portal.effects = EF_STARDUST | EF_BLUE;
        portal.nextthink = 0;
        portal.takedamage = DAMAGE_YES;
@@ -582,7 +582,7 @@ void Portal_RemoveLater(entity portal, float kill)
 {
        Portal_MakeBrokenPortal(portal);
        portal.cnt = kill;
-       portal.think = Portal_RemoveLater_Think;
+       setthink(portal, Portal_RemoveLater_Think);
        portal.nextthink = time;
 }
 void Portal_ClearAllLater_PortalsOnly(entity own)
@@ -629,7 +629,7 @@ entity Portal_Spawn(entity own, vector org, vector ang)
        portal.mangle = ang;
        portal.angles = ang;
        portal.angles_x = -portal.angles.x; // is a bmodel
-       portal.think = Portal_Think;
+       setthink(portal, Portal_Think);
        portal.nextthink = 0;
        portal.portal_activatetime = time + 0.1;
        portal.takedamage = DAMAGE_AIM;
index 8fb1a787be1904edee99e5e3bd93831fb7f7194d..8810ff02701585bfc536895408b91116b72b2ad5 100644 (file)
@@ -80,7 +80,7 @@ void round_handler_FirstThink()
 {
        SELFPARAM();
        round_starttime = max(time, game_starttime) + this.count;
-       this.think = round_handler_Think;
+       setthink(this, round_handler_Think);
        this.nextthink = max(time, game_starttime);
 }
 
@@ -93,7 +93,7 @@ void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, v
        }
        entity this = round_handler = new(round_handler);
 
-       this.think = round_handler_FirstThink;
+       setthink(this, round_handler_FirstThink);
        this.canRoundStart = canRoundStart_func;
        this.canRoundEnd = canRoundEnd_func;
        this.roundStart = roundStart_func;
index e7268a88f36c5ed50a3aa47a1b7afeba2532005d..d725654b3ac2c781188ce93c5f7e448f7531a718 100644 (file)
@@ -103,7 +103,7 @@ void relocate_spawnpoint(entity this)
     }
 
     this.use = spawnpoint_use;
-    this.think = spawnpoint_think;
+    setthink(this, spawnpoint_think);
     this.nextthink = time + 0.5 + random() * 2; // shouldn't need it for a little second
     this.team_saved = this.team;
     if (!this.cnt)
index 0389efa37c47337f5236f6d3feebfcf09ed107cd..b68432cb19f2482d4e327bdc59cbf4e74820c927 100644 (file)
@@ -500,7 +500,7 @@ void flocker_die(entity this)
     this.owner = world;
 
     this.nextthink = time;
-    this.think = SUB_Remove;
+    setthink(this, SUB_Remove);
 }
 
 
@@ -553,7 +553,7 @@ void spawn_flocker(entity this)
 
     flocker.flock_id   = this.flock_id;
     flocker.owner      = this;
-    flocker.think      = flocker_think;
+    setthink(flocker, flocker_think);
     flocker.nextthink  = time + random() * 5;
     PROJECTILE_MAKETRIGGER(flocker);
     flocker.movetype   = MOVETYPE_BOUNCEMISSILE;
@@ -639,7 +639,7 @@ spawnfunc(flockerspawn)
     if(!this.delay)    this.delay = 0.25;
     if(!this.flock_id) this.flock_id = globflockcnt;
 
-    this.think     = flockerspawn_think;
+    setthink(this, flockerspawn_think);
     this.nextthink = time + 0.25;
 
     this.enemy = new(FLock Hunter);
@@ -651,7 +651,7 @@ spawnfunc(flockerspawn)
     this.enemy.effects   = EF_LOWPRECISION;
     this.enemy.movetype  = MOVETYPE_BOUNCEMISSILE;
     PROJECTILE_MAKETRIGGER(this.enemy);
-    this.enemy.think     = flocker_hunter_think;
+    setthink(this.enemy, flocker_hunter_think);
     this.enemy.nextthink = time + 10;
     this.enemy.flock_id  = this.flock_id;
     this.enemy.owner     = this;
index c1bf96cd8805566f9360ead5dc91eba64835546d..921da4f3a28f0b37ce52db585d9fbce10eae97f4 100644 (file)
@@ -129,7 +129,7 @@ void target_give_init(entity this)
                else if (targ.classname == "item_health_mega")
                        this.health = 200;
                //remove(targ); // removing ents in init functions causes havoc, workaround:
-        targ.think = SUB_Remove_self;
+        setthink(targ, SUB_Remove_self);
         targ.nextthink = time;
        }
        this.spawnflags = 2;
index 4a06e16661027b650be469a327af68badd70b93d..272a91ff7350655619892fa1d9620e664510064e 100644 (file)
@@ -89,5 +89,5 @@ void W_PrepareExplosionByDamage(entity this, entity attacker, void() explode)
        // do not explode NOW but in the NEXT FRAME!
        // because recursive calls to RadiusDamage are not allowed
        this.nextthink = time;
-       this.think = explode;
+       setthink(this, explode);
 }
index b05405de4006b54d7c161d9dadb3f921a2f50205..f1977c8f0c0ddf3ddb958900d8a5dbc1cda2a5e9 100644 (file)
@@ -80,7 +80,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
        if(startitem_failed)
                return string_null;
        wep.glowmod = weaponentity_glowmod(info, own.clientcolors);
-       wep.think = thrown_wep_think;
+       setthink(wep, thrown_wep_think);
        wep.savenextthink = wep.nextthink;
        wep.nextthink = min(wep.nextthink, time + 0.5);
        wep.pickup_anyway = true; // these are ALWAYS pickable
index b7c81925f4d9a2407c1a85ea1cd8d9fd5d3c923b..0e7f399d01346bb1a2125a63d4bd5d613bb0cd42 100644 (file)
@@ -168,7 +168,7 @@ void CL_SpawnWeaponentity(entity actor, .entity weaponentity)
        setmodel(view, MDL_Null);  // precision set when changed
        setorigin(view, '0 0 0');
        view.weaponentity_fld = weaponentity;
-       view.think = CL_Weaponentity_Think;
+       setthink(view, CL_Weaponentity_Think);
        view.nextthink = time;
        view.viewmodelforclient = actor;
        view.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
@@ -179,7 +179,7 @@ void CL_SpawnWeaponentity(entity actor, .entity weaponentity)
                exterior.solid = SOLID_NOT;
                exterior.owner = actor;
                setorigin(exterior, '0 0 0');
-               exterior.think = CL_ExteriorWeaponentity_Think;
+               setthink(exterior, CL_ExteriorWeaponentity_Think);
                exterior.nextthink = time;
 
                CSQCMODEL_AUTOINIT(exterior);