entity announcer_countdown;
-void Announcer_Countdown()
+void Announcer_Countdown(entity this)
{
- SELFPARAM();
float starttime = STAT(GAMESTARTTIME);
float roundstarttime = STAT(ROUNDSTARTTIME);
if(roundstarttime == -1)
return false;
}
-void Playerchecker_Think()
+void Playerchecker_Think(entity this)
{
- SELFPARAM();
int i;
entity e;
for(i = 0; i < maxclients; ++i)
}
make_impure(it);
assert(getthink(entcs), eprint(entcs));
- WITHSELF(entcs, getthink(entcs)());
+ WITHSELF(entcs, getthink(entcs)(entcs));
if (!entcs.has_origin) continue;
if (entcs.m_entcs_private)
{
this.move_movetype = MOVETYPE_NONE;
}
-void SUB_Stop_self()
-{
- SELFPARAM();
- SUB_Stop(this);
-}
-
void Projectile_ResetTrail(entity this, vector to)
{
this.trail_oldorigin = to;
this.mins = '0 0 0';
this.maxs = '0 0 0';
this.colormod = '0 0 0';
- settouch(this, SUB_Stop_self);
+ settouch(this, SUB_Stop);
this.move_movetype = MOVETYPE_TOSS;
this.alphamod = 1;
return Sounds_from(SND_CASINGS1.m_id + floor(prandom() * 3));
}
-void Casing_Touch()
-{SELFPARAM();
+void Casing_Touch(entity this)
+{
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{
Casing_Delete(self);
.int state;
.bool isplayermodel;
-void DamageEffect_Think()
-{SELFPARAM();
+void DamageEffect_Think(entity this)
+{
// if particle distribution is enabled, slow ticrate by total number of damages
if(autocvar_cl_damageeffect_distribute)
this.nextthink = time + autocvar_cl_damageeffect_ticrate * this.owner.total_damages;
__pointparticles(ef, org, randomvec() * explosionspeed, howmany / 50);
}
-void SUB_RemoveOnNoImpact()
+void SUB_RemoveOnNoImpact(entity this)
{
- SELFPARAM();
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
Gib_Delete(self);
}
-void Gib_Touch()
-{SELFPARAM();
+void Gib_Touch(entity this)
+{
// TODO maybe bounce of walls, make more gibs, etc.
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
return _entcs_send(this, to, sf, MSG_ENTITY);
}
- void entcs_think()
+ void entcs_think(entity this)
{
- SELFPARAM();
this.nextthink = time + 0.033333333333; // TODO: increase this to like 0.15 once the client can do smoothing
entity o = this.owner;
int i = 1;
if (e != this) remove(e);
}
- void entcs_think()
+ void entcs_think(entity this)
{
- SELFPARAM();
entity e = CSQCModel_server2csqc(this.sv_entnum);
if (e == NULL)
{
#undef X
this.iflags |= IFLAG_ORIGIN;
InterpolateOrigin_Note(this);
- WITHSELF(this, getthink(this)());
+ WITHSELF(this, getthink(this)(this));
return true;
}
bool entcs_send(entity this, entity to, int sf);
- void entcs_think();
+ void entcs_think(entity this);
void entcs_attach(entity e);
float autocvar_g_balance_nexball_secondary_refire;
float autocvar_g_balance_nexball_secondary_speed;
-void basketball_touch();
-void football_touch();
-void ResetBall();
+void basketball_touch(entity this);
+void football_touch(entity this);
+void ResetBall(entity this);
const int NBM_NONE = 0;
const int NBM_FOOTBALL = 2;
const int NBM_BASKETBALL = 4;
{
if(this.owner)
DropBall(this, this.owner.origin, '0 0 0');
- ResetBall();
+ ResetBall(this);
}
void nexball_setstatus()
{
bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n");
DropBall(this.ballcarried, this.ballcarried.owner.origin, '0 0 0');
- WITHSELF(this.ballcarried, ResetBall());
+ entity e = this.ballcarried;
+ WITHSELF(e, ResetBall(e));
}
else
this.items |= IT_KEY1;
}
}
-void DropOwner()
-{SELFPARAM();
+void DropOwner(entity this)
+{
entity ownr;
ownr = this.owner;
DropBall(this, ownr.origin, ownr.velocity);
ball.owner = world;
}
-void InitBall()
-{SELFPARAM();
+void InitBall(entity this)
+{
if(gameover) return;
UNSET_ONGROUND(this);
this.movetype = MOVETYPE_BOUNCE;
LogNB("init", world);
}
-void ResetBall()
-{SELFPARAM();
+void ResetBall(entity this)
+{
if(this.cnt < 2) // step 1
{
if(time == this.teamtime)
}
}
-void football_touch()
-{SELFPARAM();
+void football_touch(entity this)
+{
if(other.solid == SOLID_BSP)
{
if(time > self.lastground + 0.1)
self.avelocity = -250 * v_forward; // maybe there is a way to make it look better?
}
-void basketball_touch()
-{SELFPARAM();
+void basketball_touch(entity this)
+{
if(other.ballcarried)
{
- football_touch();
+ football_touch(this);
return;
}
if(!self.cnt && IS_PLAYER(other) && !STAT(FROZEN, other) && !IS_DEAD(other) && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect))
}
}
-void GoalTouch()
-{SELFPARAM();
+void GoalTouch(entity this)
+{
entity ball;
float isclient, pscore, otherteam;
string pname;
//=======================//
-void W_Nexball_Think()
-{SELFPARAM();
+void W_Nexball_Think(entity this)
+{
//dprint("W_Nexball_Think\n");
//vector new_dir = steerlib_arrive(this.enemy.origin, 2500);
vector new_dir = normalize(this.enemy.origin + '0 0 50' - this.origin);
this.nextthink = time;
}
-void W_Nexball_Touch()
-{SELFPARAM();
+void W_Nexball_Touch(entity this)
+{
entity ball, attacker;
attacker = self.owner;
//self.think = func_null;
W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
missile.angles = vectoangles(missile.velocity);
settouch(missile, W_Nexball_Touch);
- setthink(missile, SUB_Remove_self);
+ setthink(missile, SUB_Remove);
missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
return true;
}
-void ons_CaptureShield_Touch()
-{SELFPARAM();
+void ons_CaptureShield_Touch(entity this)
+{
if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, other.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; }
if(!IS_PLAYER(other)) { return; }
if(SAME_TEAM(other, self)) { return; }
return true;
}
-void ons_Link_CheckUpdate()
-{SELFPARAM();
+void ons_Link_CheckUpdate(entity this)
+{
// TODO check if the two sides have moved (currently they won't move anyway)
float cc = 0, cc1 = 0, cc2 = 0;
this.SendFlags |= CPSF_STATUS;
}
-void ons_ControlPoint_Icon_Think()
-{SELFPARAM();
+void ons_ControlPoint_Icon_Think(entity this)
+{
this.nextthink = time + ONS_CP_THINKRATE;
if(autocvar_g_onslaught_cp_proxydecap)
}
}
-void ons_ControlPoint_Icon_BuildThink()
-{SELFPARAM();
+void ons_ControlPoint_Icon_BuildThink(entity this)
+{
int a;
this.nextthink = time + ONS_CP_THINKRATE;
Send_Effect(EFFECT_RAGE, this.origin + 10 * randomvec(), '0 0 -1', 1);
}
-void onslaught_controlpoint_icon_link(entity e, void() spawnproc);
+void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc);
void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
{
}
}
-void ons_ControlPoint_Touch()
-{SELFPARAM();
+void ons_ControlPoint_Touch(entity this)
+{
entity toucher = other;
int attackable;
onslaught_updatelinks();
}
-void ons_ControlPoint_Think()
-{SELFPARAM();
+void ons_ControlPoint_Think(entity this)
+{
self.nextthink = time + ONS_CP_THINKRATE;
CSQCMODEL_AUTOUPDATE(self);
}
this.SendFlags |= GSF_STATUS;
}
-void ons_GeneratorThink()
-{SELFPARAM();
+void ons_GeneratorThink(entity this)
+{
this.nextthink = time + GEN_THINKRATE;
if (!gameover)
{
}
-void onslaught_generator_touch()
-{SELFPARAM();
+void onslaught_generator_touch(entity this)
+{
if ( IS_PLAYER(other) )
if ( SAME_TEAM(self,other) )
if ( self.iscaptured )
}
if(self.team != self.tur_head.team)
- turret_respawn();
+ turret_respawn(self);
return false;
}
return true;
}
-void onslaught_controlpoint_icon_link(entity e, void() spawnproc)
+void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc)
{
Net_LinkEntity(e, true, 0, cpicon_send);
setthink(e, spawnproc);
return true;
}
-void generator_link(void() spawnproc)
+void generator_link(void(entity this) spawnproc)
{SELFPARAM();
Net_LinkEntity(self, true, 0, generator_send);
setthink(self, spawnproc);
float autocvar_sv_minigames_pong_ai_thinkspeed;
float autocvar_sv_minigames_pong_ai_tolerance;
-void pong_ball_think();
+void pong_ball_think(entity this);
// Throws a ball in a random direction and sets the think function
void pong_ball_throw(entity ball)
}
// Think equivalent of pong_ball_throw, used to delay throws
-void pong_ball_throwthink()
-{SELFPARAM();
+void pong_ball_throwthink(entity this)
+{
pong_ball_throw(self);
}
}
// Moves the ball around
-void pong_ball_think()
-{SELFPARAM();
+void pong_ball_think(entity this)
+{
float think_speed = autocvar_sys_ticrate;
this.nextthink = time + think_speed;
}
// AI action
-void pong_ai_think()
-{SELFPARAM();
+void pong_ai_think(entity this)
+{
float think_speed = autocvar_sv_minigames_pong_ai_thinkspeed;
this.nextthink = time + think_speed;
}
// Moves the paddle
-void pong_paddle_think()
-{SELFPARAM();
+void pong_paddle_think(entity this)
+{
float think_speed = autocvar_sys_ticrate;
this.nextthink = time + think_speed;
}
void snake_move_head(entity minigame, entity head);
-void snake_head_think()
+void snake_head_think(entity this)
{
- SELFPARAM();
entity minigame = this.owner;
if(minigame.minigame_flags & SNAKE_TURN_MOVE)
remove (this);
}
-void M_Mage_Attack_Spike_Touch()
+void M_Mage_Attack_Spike_Touch(entity this)
{
- SELFPARAM();
PROJECTILE_TOUCH;
M_Mage_Attack_Spike_Explode(self);
.float wait;
// copied from W_Seeker_Think
-void M_Mage_Attack_Spike_Think()
-{SELFPARAM();
+void M_Mage_Attack_Spike_Think(entity this)
+{
if (time > this.ltime || (this.enemy && this.enemy.health <= 0) || this.owner.health <= 0) {
this.projectiledeathtype |= HITTYPE_SPLASH;
M_Mage_Attack_Spike_Explode(this);
Damage(head, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
}
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time + 0.2;
}
W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
}
-void M_Shambler_Attack_Lightning_Touch()
-{SELFPARAM();
+void M_Shambler_Attack_Lightning_Touch(entity this)
+{
PROJECTILE_TOUCH;
self.use(this, NULL, NULL);
}
-void M_Shambler_Attack_Lightning_Think()
-{SELFPARAM();
+void M_Shambler_Attack_Lightning_Think(entity this)
+{
this.nextthink = time;
if (time > this.cnt)
{
WITHSELF(this, M_Spider_Attack_Web_Explode());
}
-void M_Spider_Attack_Web_Touch()
+void M_Spider_Attack_Web_Touch(entity this)
{
PROJECTILE_TOUCH;
M_Spider_Attack_Web_Explode();
}
-void adaptor_think2use_hittype_splash();
+void adaptor_think2use_hittype_splash(entity this);
void M_Spider_Attack_Web(entity this)
{
float autocvar_g_monster_wyvern_attack_fireball_radius;
float autocvar_g_monster_wyvern_attack_fireball_speed;
-void M_Wyvern_Attack_Fireball_Explode();
-void M_Wyvern_Attack_Fireball_Touch();
+void M_Wyvern_Attack_Fireball_Explode(entity this);
+void M_Wyvern_Attack_Fireball_Touch(entity this);
SOUND(WyvernAttack_FIRE, W_Sound("electro_fire"));
METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire))
const float wyvern_anim_death = 4;
*/
-void M_Wyvern_Attack_Fireball_Explode()
+void M_Wyvern_Attack_Fireball_Explode(entity this)
{
- SELFPARAM();
Send_Effect(EFFECT_FIREBALL_EXPLODE, this.origin, '0 0 0', 1);
entity own = this.realowner;
remove(this);
}
-void M_Wyvern_Attack_Fireball_Touch()
+void M_Wyvern_Attack_Fireball_Touch(entity this)
{
PROJECTILE_TOUCH;
- M_Wyvern_Attack_Fireball_Explode();
+ M_Wyvern_Attack_Fireball_Explode(this);
}
bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
.vector moveto;
-void M_Zombie_Attack_Leap_Touch()
-{SELFPARAM();
+void M_Zombie_Attack_Leap_Touch(entity this)
+{
if (self.health <= 0)
return;
}
.void(entity) monster_delayedfunc;
-void Monster_Delay_Action_self();
void Monster_Delay_Action(entity this)
{
if(Monster_ValidTarget(this.owner, this.owner.enemy)) { this.monster_delayedfunc(this.owner); }
if(this.cnt > 1)
{
this.cnt -= 1;
- setthink(this, Monster_Delay_Action_self);
+ setthink(this, Monster_Delay_Action);
this.nextthink = time + this.count;
}
else
{
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time;
}
}
-void Monster_Delay_Action_self()
-{
- SELFPARAM();
- Monster_Delay_Action(this);
-}
-
void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
{
// deferred attacking, checks if monster is still alive and target is still valid before attacking
entity e = spawn();
- setthink(e, Monster_Delay_Action_self);
+ setthink(e, Monster_Delay_Action);
e.nextthink = time + defer_amnt;
e.count = defer_amnt;
e.owner = this;
return true;
}
-bool Monster_Attack_Leap(entity this, vector anm, void() touchfunc, vector vel, float animtime)
+bool Monster_Attack_Leap(entity this, vector anm, void(entity this) touchfunc, vector vel, float animtime)
{
if(!Monster_Attack_Leap_Check(this, vel))
return false;
mon.mr_anim(mon, this);
}
-void Monster_Touch()
-{SELFPARAM();
+void Monster_Touch(entity this)
+{
if(other == world) { return; }
if(other.monster_attack)
return true;
}
-void Monster_Respawn() { SELFPARAM(); Monster_Spawn(this, this.monsterid); }
+void Monster_Respawn(entity this) { Monster_Spawn(this, this.monsterid); }
void Monster_Dead_Fade(entity this)
{
remove(this);
}
-void Monster_Dead_Think()
-{SELFPARAM();
+void Monster_Dead_Think(entity this)
+{
this.nextthink = time + this.ticrate;
if(this.monster_lifetime != 0)
// number of monsters spawned with mobspawn command
totalspawned -= 1;
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time + 0.1;
this.event_damage = func_null;
}
{
Violence_GibSplash(this, 1, 0.5, attacker);
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time + 0.1;
}
}
*/
}
-void Monster_Think()
-{SELFPARAM();
+void Monster_Think(entity this)
+{
setthink(this, Monster_Think);
this.nextthink = this.ticrate;
void monster_setupcolors(entity this);
-void Monster_Touch();
+void Monster_Touch(entity this);
void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff);
float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop);
-bool Monster_Attack_Leap(entity this, vector anm, void() touchfunc, vector vel, float animtime);
+bool Monster_Attack_Leap(entity this, vector anm, void(entity this) touchfunc, vector vel, float animtime);
entity Monster_FindTarget(entity this);
sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
}
-void buff_Touch()
-{SELFPARAM();
+void buff_Touch(entity this)
+{
if(gameover) { return; }
if(ITEM_TOUCH_NEEDKILL())
ent.buffs = RandomSelection_chosen_float;
}
-void buff_Think()
-{SELFPARAM();
+void buff_Think(entity this)
+{
if(this.buffs != this.oldbuffs)
{
entity buff = buff_FirstFromFlags(this.buffs);
buff_Init(ent);
}
-void buff_Vengeance_DelayedDamage()
-{SELFPARAM();
+void buff_Vengeance_DelayedDamage(entity this)
+{
if(this.enemy)
Damage(this.enemy, this.owner, this.owner, this.dmg, DEATH_BUFF.m_id, this.enemy.origin, '0 0 0');
{
entity oldother = other;
other = self;
- WITHSELF(it, gettouch(it)());
+ WITHSELF(it, gettouch(it)(it));
other = oldother;
}
}
StartItem(this, ITEM_VaporizerCells);
}
-void instagib_invisibility()
-{SELFPARAM();
+void instagib_invisibility(entity this)
+{
this.strength_finished = autocvar_g_balance_powerup_strength_time;
StartItem(this, ITEM_Invisibility);
}
-void instagib_extralife()
-{SELFPARAM();
+void instagib_extralife(entity this)
+{
StartItem(this, ITEM_ExtraLife);
}
-void instagib_speed()
-{SELFPARAM();
+void instagib_speed(entity this)
+{
this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
StartItem(this, ITEM_Speed);
}
.entity nade_spawnloc;
-void nade_timer_think()
-{SELFPARAM();
+void nade_timer_think(entity this)
+{
this.skin = 8 - (this.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10);
this.nextthink = time;
if(!this.owner || wasfreed(this.owner))
}
-void napalm_ball_think()
-{SELFPARAM();
+void napalm_ball_think(entity this)
+{
if(round_handler_IsActive())
if(!round_handler_IsRoundStarted())
{
}
-void napalm_fountain_think()
-{SELFPARAM();
+void napalm_fountain_think(entity this)
+{
if(round_handler_IsActive())
if(!round_handler_IsRoundStarted())
Drop_Special_Items(frost_target);
}
-void nade_ice_think()
-{SELFPARAM();
+void nade_ice_think(entity this)
+{
if(round_handler_IsActive())
if(!round_handler_IsRoundStarted())
this.realowner.nade_spawnloc = spawnloc;
}
-void nade_heal_think()
-{SELFPARAM();
+void nade_heal_think(entity this)
+{
if(time >= self.ltime)
{
remove(self);
self.nade_show_particles = 0;
}
-void nade_heal_touch()
-{SELFPARAM();
+void nade_heal_touch(entity this)
+{
float maxhealth;
float health_factor;
if(IS_PLAYER(other) || IS_MONSTER(other))
e.monster_skill = MONSTER_SKILL_INSANE;
}
-void nade_boom()
-{SELFPARAM();
+void nade_boom(entity this)
+{
entity expef = NULL;
bool nade_blast = true;
}
bool CanThrowNade(entity this);
-void nade_touch()
-{SELFPARAM();
+void nade_touch(entity this)
+{
if(other)
UpdateCSQCProjectile(self);
}
self.enemy = other;
- nade_boom();
+ nade_boom(self);
}
-void nade_beep()
-{SELFPARAM();
+void nade_beep(entity this)
+{
sound(this, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
setthink(this, nade_boom);
this.nextthink = max(this.wait, time);
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
this.takedamage = DAMAGE_NO;
- WITHSELF(this, nade_boom());
+ WITHSELF(this, nade_boom(this));
return;
}
fn.colormod = Nades_from(n.nade_type).m_color;
fn.colormap = player.colormap;
fn.glowmod = player.glowmod;
- setthink(fn, SUB_Remove_self);
+ setthink(fn, SUB_Remove);
fn.nextthink = n.wait;
player.nade = n;
return false;
}
-void self_spawnfunc_weapon_hmg() { SELFPARAM(); spawnfunc_weapon_hmg(this); }
-void self_spawnfunc_weapon_rpc() { SELFPARAM(); spawnfunc_weapon_rpc(this); }
+void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); }
+void self_spawnfunc_weapon_rpc(entity this) { spawnfunc_weapon_rpc(this); }
MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
{SELFPARAM();
#ifdef SVQC
spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(this, WEP_RPC); }
-void W_RocketPropelledChainsaw_Explode()
-{SELFPARAM();
+void W_RocketPropelledChainsaw_Explode(entity this)
+{
self.event_damage = func_null;
self.takedamage = DAMAGE_NO;
remove (self);
}
-void W_RocketPropelledChainsaw_Touch ()
-{SELFPARAM();
+void W_RocketPropelledChainsaw_Touch (entity this)
+{
if(WarpZone_Projectile_Touch())
if(wasfreed(self))
return;
- W_RocketPropelledChainsaw_Explode();
+ W_RocketPropelledChainsaw_Explode(this);
}
void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
W_PrepareExplosionByDamage(this, attacker, W_RocketPropelledChainsaw_Explode);
}
-void W_RocketPropelledChainsaw_Think()
-{SELFPARAM();
+void W_RocketPropelledChainsaw_Think(entity this)
+{
if(self.cnt <= time)
{
remove(self);
.vector spawn_origin, spawn_angles;
-void physical_item_think()
-{SELFPARAM();
+void physical_item_think(entity this)
+{
self.nextthink = time;
self.alpha = self.owner.alpha; // apply fading and ghosting
remove(self); // the real item is gone, remove this
}
-void physical_item_touch()
-{SELFPARAM();
+void physical_item_touch(entity this)
+{
if(!self.cnt) // not for dropped items
if (ITEM_TOUCH_NEEDKILL())
{
.string material;
.float touch_timer;
-void sandbox_ObjectFunction_Touch()
-{SELFPARAM();
+void sandbox_ObjectFunction_Touch(entity this)
+{
// apply material impact effects
if(!self.material)
Send_Effect_(strcat("impact_", self.material), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10
}
-void sandbox_ObjectFunction_Think()
-{SELFPARAM();
+void sandbox_ObjectFunction_Think(entity this)
+{
// decide if and how this object can be grabbed
if(autocvar_g_sandbox_readonly)
self.grab = 0; // no grabbing
return 0;
}
-void superspec_hello()
-{SELFPARAM();
+void superspec_hello(entity this)
+{
if(self.enemy.crypto_idfp == "")
Send_Notification(NOTIF_ONE_ONLY, self.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID);
}
}
-void WaypointSprite_Think()
-{SELFPARAM();
+void WaypointSprite_Think(entity this)
+{
bool doremove = false;
if (self.fade_time && time >= self.teleport_time)
void WaypointSprite_Disown(entity wp, float fadetime);
-void WaypointSprite_Think();
+void WaypointSprite_Think(entity this);
bool WaypointSprite_visible_for_player(entity this, entity player, entity view);
#endif
#ifdef SVQC
-void Net_Notification_Remove()
+void Net_Notification_Remove(entity this)
{
- SELFPARAM();
#ifdef NOTIFICATIONS_DEBUG
Debug_Notification(sprintf(
"Net_Notification_Remove() at %f: %s '%s - %s' notification\n",
{
other = oth;
- WITHSELF(this, gettouch(this)());
+ WITHSELF(this, gettouch(this)(this));
other = oldother;
}
{
other = this;
- WITHSELF(oth, gettouch(oth)());
+ WITHSELF(oth, gettouch(oth)(oth));
other = oldother;
}
trace_plane_dist = 0;
trace_ent = this;
- WITHSELF(it, gettouch(it)());
+ WITHSELF(it, gettouch(it)(it));
}
});
#define UNSET_ONGROUND(s) ((s).flags &= ~FL_ONGROUND)
.float move_ltime;
-.void()move_think;
+.void(entity this) move_think;
.float move_nextthink;
.void()move_blocked;
this.move_nextthink = 0;
this.move_time = time;
other = world;
- WITHSELF(this, this.move_think());
+ WITHSELF(this, this.move_think(this));
}
}
auto = true; \
__chan = fabs(__chan); \
entity tmp = __e = new(csqc_autochannel); \
- setthink(tmp, SUB_Remove_self); \
+ setthink(tmp, SUB_Remove); \
tmp.nextthink = time + soundlength(__samp); \
} \
vector old_origin = __e.origin; \
e.SendFlags |= ISF_STATUS;
}
-void Item_Think()
-{SELFPARAM();
+void Item_Think(entity this)
+{
self.nextthink = time;
if(self.origin != self.oldorigin)
ItemUpdate(self);
Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
}
-void Item_RespawnCountdown ()
-{SELFPARAM();
+void Item_RespawnCountdown (entity this)
+{
if(self.count >= ITEM_RESPAWN_TICKS)
{
if(self.waypointsprite_attached)
}
}
-void Item_RespawnThink()
-{SELFPARAM();
+void Item_RespawnThink(entity this)
+{
self.nextthink = time;
if(self.origin != self.oldorigin)
ItemUpdate(self);
return 1;
}
-void Item_Touch()
+void Item_Touch(entity this)
{
- SELFPARAM();
// remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
if (this.classname == "droppedweapon")
}
// Savage: used for item garbage-collection
-void RemoveItem()
-{SELFPARAM();
+void RemoveItem(entity this)
+{
if(wasfreed(self) || !self) { return; }
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
remove(self);
void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
- WITHSELF(this, RemoveItem());
+ WITHSELF(this, RemoveItem(this));
}
void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
void Item_Respawn ();
-void Item_RespawnCountdown ();
+void Item_RespawnCountdown(entity this);
void Item_ScheduleRespawnIn(entity e, float t);
void Item_ScheduleRespawn(entity e);
float Item_GiveTo(entity item, entity player);
-void Item_Touch();
+void Item_Touch(entity this);
void Item_Reset(entity this);
#ifdef SVQC
.float height;
-void func_bobbing_controller_think()
-{SELFPARAM();
+void func_bobbing_controller_think(entity this)
+{
vector v;
self.nextthink = time + 0.1;
controller.nextthink = time + 1;
setthink(controller, func_bobbing_controller_think);
this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
- this.SUB_THINK = SUB_NullThink;
+ SUB_THINK(this, SUB_NullThink);
// Savage: Reduce bandwith, critical on e.g. nexdm02
this.effects |= EF_LOWPRECISION;
CSQCMODEL_AUTOUPDATE(this);
}
-void func_breakable_restore_self()
-{SELFPARAM();
+void func_breakable_restore_self(entity this)
+{
func_breakable_restore(this, NULL, NULL);
}
this.message = oldmsg;
}
-void func_breakable_destroy_self()
-{SELFPARAM();
+void func_breakable_destroy_self(entity this)
+{
func_breakable_destroy(this, NULL, NULL);
}
#ifdef SVQC
// button and multiple button
-void() button_wait;
-void() button_return;
+void button_wait(entity this);
+void button_return(entity this);
-void button_wait()
-{SELFPARAM();
+void button_wait(entity this)
+{
self.state = STATE_TOP;
self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
- self.SUB_THINK = button_return;
+ SUB_THINK(self, button_return);
SUB_UseTargets(self, self.enemy, NULL);
self.frame = 1; // use alternate textures
}
-void button_done()
-{SELFPARAM();
+void button_done(entity this)
+{
self.state = STATE_BOTTOM;
}
-void button_return()
-{SELFPARAM();
+void button_return(entity this)
+{
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, button_done);
self.frame = 0; // use normal textures
WITHSELF(this, button_fire());
}
-void button_touch()
-{SELFPARAM();
+void button_touch(entity this)
+{
if (!other)
return;
if (!other.iscreature)
REGISTER_NET_LINKED(ENT_CLIENT_CONVEYOR)
-void conveyor_think()
-{SELFPARAM();
+void conveyor_think(entity this)
+{
#ifdef CSQC
// TODO: check if this is what is causing the glitchiness when switching between them
float dt = time - self.move_time;
#elif defined(CSQC)
-void conveyor_draw(entity this) { WITHSELF(this, conveyor_think()); }
+void conveyor_draw(entity this) { WITHSELF(this, conveyor_think(this)); }
void conveyor_init(entity this)
{
=============================================================================
*/
-void() door_go_down;
+void door_go_down(entity this);
void() door_go_up;
-void() door_rotating_go_down;
+void door_rotating_go_down(entity this);
void() door_rotating_go_up;
void door_blocked()
else
if (self.classname == "door")
{
- door_go_down ();
+ door_go_down (self);
} else
{
- door_rotating_go_down ();
+ door_rotating_go_down (self);
}
}
}
}
}
-void door_hit_top()
-{SELFPARAM();
+void door_hit_top(entity this)
+{
if (self.noise1 != "")
_sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_TOP;
return; // don't come down automatically
if (self.classname == "door")
{
- self.SUB_THINK = door_go_down;
+ SUB_THINK(self, door_go_down);
} else
{
- self.SUB_THINK = door_rotating_go_down;
+ SUB_THINK(self, door_rotating_go_down);
}
self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
}
-void door_hit_bottom()
-{SELFPARAM();
+void door_hit_bottom(entity this)
+{
if (self.noise1 != "")
_sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_BOTTOM;
}
-void door_go_down()
-{SELFPARAM();
+void door_go_down(entity this)
+{
if (self.noise2 != "")
_sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
if (self.max_health)
entity e = this;
do {
if (e.classname == "door") {
- WITHSELF(e, door_go_down());
+ WITHSELF(e, door_go_down(e));
} else {
- WITHSELF(e, door_rotating_go_down());
+ WITHSELF(e, door_rotating_go_down(e));
}
e = e.enemy;
} while ((e != this) && (e != NULL));
================
*/
-void door_touch()
-{SELFPARAM();
+void door_touch(entity this)
+{
if (!IS_PLAYER(other))
return;
if (self.owner.door_finished > time)
if (self.state == STATE_DOWN)
door_rotating_go_up ();
else
- door_rotating_go_down ();
+ door_rotating_go_down (self);
}
}
#ifdef SVQC
}
}
-void door_rotating_hit_top()
-{SELFPARAM();
+void door_rotating_hit_top(entity this)
+{
if (self.noise1 != "")
_sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_TOP;
if (self.spawnflags & DOOR_TOGGLE)
return; // don't come down automatically
- self.SUB_THINK = door_rotating_go_down;
+ SUB_THINK(self, door_rotating_go_down);
self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
}
-void door_rotating_hit_bottom()
-{SELFPARAM();
+void door_rotating_hit_bottom(entity this)
+{
if (self.noise1 != "")
_sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating
self.state = STATE_BOTTOM;
}
-void door_rotating_go_down()
-{SELFPARAM();
+void door_rotating_go_down(entity this)
+{
if (self.noise2 != "")
_sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
if (self.max_health)
=========================================
*/
-void door_trigger_touch()
-{SELFPARAM();
+void door_trigger_touch(entity this)
+{
if (other.health < 1)
#ifdef SVQC
if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !IS_DEAD(other)))
SUB_SETORIGIN(this, this.pos1);
this.SUB_VELOCITY = '0 0 0';
this.state = STATE_BOTTOM;
- this.SUB_THINK = func_null;
+ SUB_THINK(this, func_null);
this.SUB_NEXTTHINK = 0;
#ifdef SVQC
#ifdef SVQC
-void() fd_secret_move1;
-void() fd_secret_move2;
-void() fd_secret_move3;
-void() fd_secret_move4;
-void() fd_secret_move5;
-void() fd_secret_move6;
-void() fd_secret_done;
+void fd_secret_move1(entity this);
+void fd_secret_move2(entity this);
+void fd_secret_move3(entity this);
+void fd_secret_move4(entity this);
+void fd_secret_move5(entity this);
+void fd_secret_move6(entity this);
+void fd_secret_done(entity this);
const float SECRET_OPEN_ONCE = 1; // stays open
const float SECRET_1ST_LEFT = 2; // 1st move is left of arrow
}
// Wait after first movement...
-void fd_secret_move1()
-{SELFPARAM();
+void fd_secret_move1(entity this)
+{
self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
setthink(self, fd_secret_move2);
if (self.noise3 != "")
}
// Start moving sideways w/sound...
-void fd_secret_move2()
-{SELFPARAM();
+void fd_secret_move2(entity this)
+{
if (self.noise2 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
SUB_CalcMove(self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3);
}
// Wait here until time to go back...
-void fd_secret_move3()
-{SELFPARAM();
+void fd_secret_move3(entity this)
+{
if (self.noise3 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
if (!(self.spawnflags & SECRET_OPEN_ONCE))
}
// Move backward...
-void fd_secret_move4()
-{SELFPARAM();
+void fd_secret_move4(entity this)
+{
if (self.noise2 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5);
}
// Wait 1 second...
-void fd_secret_move5()
-{SELFPARAM();
+void fd_secret_move5(entity this)
+{
self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
setthink(self, fd_secret_move6);
if (self.noise3 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
}
-void fd_secret_move6()
-{SELFPARAM();
+void fd_secret_move6(entity this)
+{
if (self.noise2 != "")
_sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
SUB_CalcMove(self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done);
}
-void fd_secret_done()
-{SELFPARAM();
+void fd_secret_done(entity this)
+{
if (self.spawnflags&SECRET_YES_SHOOT)
{
self.health = 10000;
Prints messages
================
*/
-void secret_touch()
-{SELFPARAM();
+void secret_touch(entity this)
+{
if (!other.iscreature)
return;
if (self.door_finished > time)
dmgtime: See above.
*/
-void func_fourier_controller_think()
-{SELFPARAM();
+void func_fourier_controller_think(entity this)
+{
vector v;
float n, i, t;
controller.nextthink = time + 1;
setthink(controller, func_fourier_controller_think);
this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
- this.SUB_THINK = SUB_NullThink; // for PushMove
+ SUB_THINK(this, SUB_NullThink); // for PushMove
// Savage: Reduce bandwith, critical on e.g. nexdm02
this.effects |= EF_LOWPRECISION;
REGISTER_NET_LINKED(ENT_CLIENT_LADDER)
-void func_ladder_touch()
-{SELFPARAM();
+void func_ladder_touch(entity this)
+{
#ifdef SVQC
if (!other.iscreature)
return;
#ifdef SVQC
.float freq;
-void func_pendulum_controller_think()
-{SELFPARAM();
+void func_pendulum_controller_think(entity this)
+{
float v;
self.nextthink = time + 0.1;
controller.nextthink = time + 1;
setthink(controller, func_pendulum_controller_think);
this.nextthink = this.SUB_LTIME + 999999999;
- this.SUB_THINK = SUB_NullThink; // for PushMove
+ SUB_THINK(this, SUB_NullThink); // for PushMove
//this.effects |= EF_LOWPRECISION;
this.SendFlags |= 2;
}
-void pointparticles_think()
-{SELFPARAM();
+void pointparticles_think(entity this)
+{
if(self.origin != self.oldorigin)
{
self.SendFlags |= 4;
// wait for targets to spawn
this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
- this.SUB_THINK = SUB_NullThink; // for PushMove
+ SUB_THINK(this, SUB_NullThink); // for PushMove
// TODO make a reset function for this one
}
.float train_wait_turning;
-void() train_next;
+void train_next(entity this);
#ifdef SVQC
void train_use(entity this, entity actor, entity trigger);
#endif
-void train_wait()
-{SELFPARAM();
+void train_wait(entity this)
+{
SUB_UseTargets(this.enemy, NULL, NULL);
self.enemy = world;
if(tg.spawnflags & 4)
{
self.use = train_use;
- self.SUB_THINK = func_null;
+ SUB_THINK(self, func_null);
self.SUB_NEXTTHINK = 0;
}
else
if(self.wait < 0 || self.train_wait_turning) // no waiting or we already waited while turning
{
self.train_wait_turning = false;
- train_next();
+ train_next(self);
}
else
{
- self.SUB_THINK = train_next;
+ SUB_THINK(self, train_next);
self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
}
}
-void train_next()
-{SELFPARAM();
+void train_next(entity this)
+{
entity targ, cp = world;
vector cp_org = '0 0 0';
void train_use(entity this, entity actor, entity trigger)
{
this.SUB_NEXTTHINK = this.SUB_LTIME + 1;
- this.SUB_THINK = train_next;
+ SUB_THINK(this, train_next);
this.use = func_null; // not again
}
if(!(self.spawnflags & 4))
{
self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
- self.SUB_THINK = train_next;
+ SUB_THINK(self, train_next);
}
train_link();
// but we will need these
//this.move_nextthink = this.move_ltime + 0.1;
//this.move_think = train_next;
- WITHSELF(this, train_next());
+ WITHSELF(this, train_next(this));
this.move_movetype = MOVETYPE_PUSH;
this.move_origin = this.origin;
return v;
}
-void func_vectormamamam_controller_think()
-{SELFPARAM();
+void func_vectormamamam_controller_think(entity this)
+{
self.nextthink = time + 0.1;
if(self.owner.active != ACTIVE_ACTIVE)
// wait for targets to spawn
this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999;
- this.SUB_THINK = SUB_NullThink; // for PushMove
+ SUB_THINK(this, SUB_NullThink); // for PushMove
// Savage: Reduce bandwith, critical on e.g. nexdm02
this.effects |= EF_LOWPRECISION;
}
.entity pusher;
-void misc_laser_think()
-{SELFPARAM();
+void misc_laser_think(entity this)
+{
vector o;
entity hitent;
vector hitloc;
objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
}
-void plat_hit_top()
-{SELFPARAM();
+void plat_hit_top(entity this)
+{
_sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = 1;
- self.SUB_THINK = plat_go_down;
+ SUB_THINK(self, plat_go_down);
self.SUB_NEXTTHINK = self.SUB_LTIME + 3;
}
-void plat_hit_bottom()
-{SELFPARAM();
+void plat_hit_bottom(entity this)
+{
_sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = 2;
}
-void plat_go_down()
-{SELFPARAM();
+void plat_go_down(entity this)
+{
_sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
self.state = 3;
SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
}
-void plat_center_touch()
-{SELFPARAM();
+void plat_center_touch(entity this)
+{
#ifdef SVQC
if (!other.iscreature)
return;
self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1;
}
-void plat_outside_touch()
-{SELFPARAM();
+void plat_outside_touch(entity this)
+{
#ifdef SVQC
if (!other.iscreature)
return;
return;
#endif
- if (self.enemy.state == 1)
- WITHSELF(self.enemy, plat_go_down());
+ if (self.enemy.state == 1) {
+ entity e = self.enemy;
+ WITHSELF(e, plat_go_down(e));
+ }
}
void plat_trigger_use(entity this, entity actor, entity trigger)
if(this.move_think)
return;
#endif
- WITHSELF(this, plat_go_down());
+ WITHSELF(this, plat_go_down(this));
}
#endif
if (self.state == 4)
- plat_go_down ();
+ plat_go_down (self);
else if (self.state == 3)
plat_go_up ();
// when in other states, then the plat_crush event came delayed after
this.use = func_null;
if (this.state != 4)
objerror ("plat_use: not in up state");
- WITHSELF(this, plat_go_down());
+ WITHSELF(this, plat_go_down(this));
}
.string sound1, sound2;
.float dmgtime2;
-void() plat_center_touch;
-void() plat_outside_touch;
+void plat_center_touch(entity this);
+void plat_outside_touch(entity this);
void plat_trigger_use(entity this, entity actor, entity trigger);
void() plat_go_up;
-void() plat_go_down;
+void plat_go_down(entity this);
void() plat_crush;
const float PLAT_LOW_TRIGGER = 1;
-void SUB_NullThink() { }
+void SUB_NullThink(entity this) { }
-void() SUB_CalcMoveDone;
-void() SUB_CalcAngleMoveDone;
+void SUB_CalcMoveDone(entity this);
+void SUB_CalcAngleMoveDone(entity this);
/*
==================
}
}
-void SUB_SetFade_Think ()
-{SELFPARAM();
+void SUB_SetFade_Think (entity this)
+{
if(this.alpha == 0)
this.alpha = 1;
- this.SUB_THINK = SUB_SetFade_Think;
+ SUB_THINK(this, SUB_SetFade_Think);
this.SUB_NEXTTHINK = time;
this.alpha -= frametime * this.fade_rate;
if (this.alpha < 0.01)
void SUB_SetFade (entity ent, float when, float fading_time)
{
ent.fade_rate = 1/fading_time;
- ent.SUB_THINK = SUB_SetFade_Think;
+ SUB_THINK(ent, SUB_SetFade_Think);
ent.SUB_NEXTTHINK = when;
}
self.SUB_ORIGIN traveling at speed
===============
*/
-void SUB_CalcMoveDone ()
-{SELFPARAM();
+void SUB_CalcMoveDone(entity this)
+{
// After moving, set origin to exact final destination
SUB_SETORIGIN (self, self.finaldest);
self.SUB_VELOCITY = '0 0 0';
self.SUB_NEXTTHINK = -1;
if (self.think1)
- self.think1 ();
+ self.think1 (self);
}
.float platmovetype_turn;
-void SUB_CalcMove_controller_think ()
-{SELFPARAM();
+void SUB_CalcMove_controller_think (entity this)
+{
float traveltime;
float phasepos;
float nexttick;
{
// derivative: delta + 2 * delta2 (e.g. for angle positioning)
entity own = self.owner;
- own.SUB_THINK = self.think1;
+ SUB_THINK(own, self.think1);
remove(self);
- WITHSELF(own, own.SUB_THINK());
+ WITHSELF(own, SUB_THUNK(own)(own));
}
}
float TSPEED_END = 2;
// TODO average too?
-void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func)
+void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
{SELFPARAM();
float traveltime;
entity controller;
self.think1 = func;
self.finaldest = tdest;
- self.SUB_THINK = SUB_CalcMoveDone;
+ SUB_THINK(self, SUB_CalcMoveDone);
switch(tspeedtype)
{
controller.animstate_starttime = time;
controller.animstate_endtime = time + traveltime;
setthink(controller, SUB_CalcMove_controller_think);
- controller.think1 = self.SUB_THINK;
+ controller.think1 = SUB_THUNK(self);
// the thinking is now done by the controller
- self.SUB_THINK = SUB_NullThink; // for PushMove
+ SUB_THINK(self, SUB_NullThink); // for PushMove
self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
// invoke controller
- WITHSELF(controller, getthink(controller)());
+ WITHSELF(controller, getthink(controller)(controller));
}
-void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
+void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void(entity this) func)
{SELFPARAM();
vector delta;
float traveltime;
self.think1 = func;
self.finaldest = tdest;
- self.SUB_THINK = SUB_CalcMoveDone;
+ SUB_THINK(self, SUB_CalcMoveDone);
if (tdest == self.SUB_ORIGIN)
{
SUB_CalcMove_Bezier((self.SUB_ORIGIN + tdest) * 0.5, tdest, tspeedtype, tspeed, func);
}
-void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
+void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
{
WITHSELF(ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
}
The calling function should make sure self.SUB_THINK is valid
===============
*/
-void SUB_CalcAngleMoveDone ()
-{SELFPARAM();
+void SUB_CalcAngleMoveDone(entity this)
+{
// After rotating, set angle to exact final angle
self.angles = self.finalangle;
self.SUB_AVELOCITY = '0 0 0';
self.SUB_NEXTTHINK = -1;
if (self.think1)
- self.think1 ();
+ self.think1 (self);
}
// FIXME: I fixed this function only for rotation around the main axes
-void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func)
+void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void(entity this) func)
{SELFPARAM();
vector delta;
float traveltime;
self.think1 = func;
self.finalangle = destangle;
- self.SUB_THINK = SUB_CalcAngleMoveDone;
+ SUB_THINK(self, SUB_CalcAngleMoveDone);
if (traveltime < 0.1)
{
self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
}
-void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
+void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func)
{
WITHSELF(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
}
#define SUB_ORIGIN origin
#define SUB_SETORIGIN(s,v) setorigin((s), (v))
#define SUB_NEXTTHINK nextthink
- #define SUB_THINK think
+ #define SUB_THINK(e, f) setthink(e, f)
+ #define SUB_THUNK(e) getthink(e)
#define SUB_LTIME ltime
#define SUB_FLAGS flags
#define SUB_AVELOCITY move_avelocity
#define SUB_ORIGIN move_origin
#define SUB_NEXTTHINK move_nextthink
- #define SUB_THINK move_think
+ #define SUB_THINK(e, f) ((e).move_think = (f))
+ #define SUB_THUNK(e) ((e).move_think)
#define SUB_LTIME move_ltime
#define SUB_FLAGS move_flags
void SUB_VanishOrRemove (entity ent);
.vector finaldest, finalangle; //plat.qc stuff
-.void() think1;
+.void(entity this) think1;
.float state;
.float t_length, t_width;
}
}
-void Ent_TriggerMusic_Think()
-{SELFPARAM();
+void Ent_TriggerMusic_Think(entity this)
+{
if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world))
{
music_trigger = self;
void Net_TargetMusic();
-void Ent_TriggerMusic_Think();
+void Ent_TriggerMusic_Think(entity this);
void Ent_TriggerMusic_Remove();
entity Simple_TeleportPlayer(entity teleporter, entity player);
-void Teleport_Touch ();
+void Teleport_Touch (entity this);
void teleport_findtarget(entity this);
backtrace("Removing a trigger_gravity_check with no valid owner");
own.trigger_gravity_check = world;
}
-void trigger_gravity_check_think()
-{SELFPARAM();
+void trigger_gravity_check_think(entity this)
+{
// This spawns when a player enters the gravity zone and checks if he left.
// Each frame, self.count is set to 2 by trigger_gravity_touch() and decreased by 1 here.
// It the player has left the gravity trigger, this will be allowed to reach 0 and indicate that.
this.state = !this.state;
}
-void trigger_gravity_touch()
-{SELFPARAM();
+void trigger_gravity_touch(entity this)
+{
float g;
if(self.state != true)
#ifdef SVQC
.float triggerhealtime;
-void trigger_heal_touch()
-{SELFPARAM();
+void trigger_heal_touch(entity this)
+{
if (self.active != ACTIVE_ACTIVE)
return;
}
.float triggerhurttime;
-void trigger_hurt_touch()
-{SELFPARAM();
+void trigger_hurt_touch(entity this)
+{
if (self.active != ACTIVE_ACTIVE)
return;
// targeted (directional) mode
-void trigger_impulse_touch1()
-{SELFPARAM();
+void trigger_impulse_touch1(entity this)
+{
entity targ;
float pushdeltatime;
float str;
}
// Directionless (accelerator/decelerator) mode
-void trigger_impulse_touch2()
-{SELFPARAM();
+void trigger_impulse_touch2(entity this)
+{
float pushdeltatime;
if (self.active != ACTIVE_ACTIVE)
}
// Spherical (gravity/repulsor) mode
-void trigger_impulse_touch3()
-{SELFPARAM();
+void trigger_impulse_touch3(entity this)
+{
float pushdeltatime;
float str;
return sdir * vs + '0 0 1' * vz;
}
-void trigger_push_touch()
-{SELFPARAM();
+void trigger_push_touch(entity this)
+{
if (this.active == ACTIVE_NOT)
return;
if (this.spawnflags & PUSH_ONCE)
{
settouch(this, func_null);
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time;
}
#endif
vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
-void trigger_push_touch();
+void trigger_push_touch(entity this);
.vector dest;
void trigger_push_findtarget(entity this);
remove(t);
}
-void trigger_keylock_touch()
-{SELFPARAM();
+void trigger_keylock_touch(entity this)
+{
bool key_used = false;
bool started_delay = false;
SUB_UseTargets(this, actor, trigger);
}
-void monoflop_think()
-{SELFPARAM();
+void monoflop_think(entity this)
+{
this.state = 0;
SUB_UseTargets(this, this.enemy, NULL);
}
#ifdef SVQC
// the wait time has passed, so set back up for another activation
-void multi_wait()
-{SELFPARAM();
+void multi_wait(entity this)
+{
if (this.max_health)
{
this.health = this.max_health;
}
else if (this.wait == 0)
{
- WITHSELF(this, multi_wait()); // waiting finished
+ WITHSELF(this, multi_wait(this)); // waiting finished
}
else
{ // we can't just remove (this) here, because this is a touch function
multi_trigger(this);
}
-void multi_touch()
-{SELFPARAM();
+void multi_touch(entity this)
+{
if(!(self.spawnflags & 2))
if(!other.iscreature)
return;
this.nextthink = cyclestart + this.wait + this.respawntime + 0.01;
}
-void multivibrator_send_think()
-{SELFPARAM();
+void multivibrator_send_think(entity this)
+{
multivibrator_send(this);
}
/**
* A secret has been found (maybe :P)
*/
-void trigger_secret_touch()
-{SELFPARAM();
+void trigger_secret_touch(entity this)
+{
// only a player can trigger this
if (!IS_PLAYER(other))
return;
self.message = "";
// handle normal trigger features
- multi_touch();
+ multi_touch(self);
remove(self);
}
#ifdef SVQC
spawnfunc(trigger_swamp);
#endif
-void swamp_touch();
-void swampslug_think();
+void swamp_touch(entity this);
+void swampslug_think(entity this);
/*
*
* I do it this way becuz there is no "untouch" event.
*/
-void swampslug_think()
-{SELFPARAM();
+void swampslug_think(entity this)
+{
//Slowly kill the slug
self.health = self.health - 1;
self.nextthink = time + self.swamp_interval;
}
-void swamp_touch()
-{SELFPARAM();
+void swamp_touch(entity this)
+{
// If whatever thats touching the swamp is not a player
// or if its a dead player, just dont care abt it.
if(!IS_PLAYER(other) || IS_DEAD(other))
}
#endif
-void Teleport_Touch ()
-{SELFPARAM();
+void Teleport_Touch (entity this)
+{
if (self.active != ACTIVE_ACTIVE)
return;
#ifdef SVQC
-void viewloc_think()
-{SELFPARAM();
+void viewloc_think(entity this)
+{
entity e;
// we abuse this method, rather than using normal .touch, because touch isn't reliable with multiple clients inside the same trigger, and can't "untouch" entities
#elif defined(CSQC)
-void trigger_viewloc_updatelink()
-{SELFPARAM();
+void trigger_viewloc_updatelink(entity this)
+{
self.enemy = findfloat(world, entnum, self.cnt);
self.goalentity = findfloat(world, entnum, self.count);
}
void SUB_UseTargets(entity this, entity actor, entity trigger);
-void DelayThink()
-{SELFPARAM();
+void DelayThink(entity this)
+{
SUB_UseTargets (this, this.enemy, NULL);
remove(this);
}
RandomSelection_chosen_ent.use(RandomSelection_chosen_ent, actor, this);
}
-void SUB_UseTargets_self()
-{SELFPARAM();
+void SUB_UseTargets_self(entity this)
+{
SUB_UseTargets(this, NULL, NULL);
}
If the checkpoint chain in not looped, the unit will go "Roaming" when the last point is reached.
*/
//float tc_acum;
-void turret_checkpoint_init()
-{SELFPARAM();
+void turret_checkpoint_init(entity this)
+{
traceline(self.origin + '0 0 16', self.origin - '0 0 1024', MOVE_WORLDONLY, self);
setorigin(self, trace_endpos + '0 0 32');
return gib;
}
-void turret_die()
-{SELFPARAM();
+void turret_die(entity this)
+{
sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
if (!autocvar_cl_nogibs)
_tmp = ReadByte();
if(_tmp == 0 && this.health != 0)
- turret_die();
+ turret_die(this);
else if(this.health && this.health != _tmp)
this.helpme = servertime + 10;
}
// Generic damage handling
-void turret_hide()
-{SELFPARAM();
+void turret_hide(entity this)
+{
self.effects |= EF_NODRAW;
self.nextthink = time + self.respawntime - 0.2;
setthink(self, turret_respawn);
}
-void turret_die()
-{SELFPARAM();
+void turret_die(entity this)
+{
self.deadflag = DEAD_DEAD;
self.tur_head.deadflag = self.deadflag;
this.SendFlags |= TNSF_STATUS;
}
-void() turret_think;
-void turret_respawn()
-{SELFPARAM();
+void turret_think(entity this);
+void turret_respawn(entity this)
+{
// Make sure all parts belong to the same team since
// this function doubles as "teamchange" function.
self.tur_head.team = self.team;
}
}
-void turret_projectile_explode()
-{SELFPARAM();
+void turret_projectile_explode(entity this)
+{
self.takedamage = DAMAGE_NO;
self.event_damage = func_null;
remove(self);
}
-void turret_projectile_touch()
+void turret_projectile_touch(entity this)
{
PROJECTILE_TOUCH;
- turret_projectile_explode();
+ turret_projectile_explode(this);
}
void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
#endif
}
-void turret_think()
-{SELFPARAM();
+void turret_think(entity this)
+{
self.nextthink = time + self.ticrate;
MUTATOR_CALLHOOK(TurretThink, self);
self.tur_head.effects = EF_NODRAW;
}
-void turrets_manager_think()
+void turrets_manager_think(entity this)
{
- SELFPARAM();
this.nextthink = time + 1;
if (autocvar_g_turrets_reloadcvars == 1)
#endif
turret_link();
- turret_respawn();
+ turret_respawn(self);
turret_tag_fire_update();
tur.tr_setup(tur, self);
#define SV_TURRETS_H
entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
-void turret_projectile_explode();
+void turret_projectile_explode(entity this);
float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
float turret_firecheck();
entity turret_select_target();
.float track_accel_rotate;
.float track_blendrate;
-void() turret_respawn;
+void turret_respawn(entity this);
/// updates aim org, shot org, shot dir and enemy org for selected turret
void turret_do_updates(entity e_turret);
spawnfunc(turret_targettrigger);
-void turret_targettrigger_touch();
+void turret_targettrigger_touch(entity this);
-void turret_targettrigger_touch()
-{SELFPARAM();
+void turret_targettrigger_touch(entity this)
+{
if (this.cnt > time) return;
FOREACH_ENTITY_STRING_ORDERED(targetname, this.target, {
if (!(it.turret_flags & TUR_FLAG_RECIEVETARGETS)) continue;
#ifdef SVQC
-void turret_flac_projectile_think_explode();
+void turret_flac_projectile_think_explode(entity this);
SOUND(FlacAttack_FIRE, W_Sound("electro_fire"));
METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
bool isPlayer = IS_PLAYER(actor);
}
}
-void turret_flac_projectile_think_explode()
+void turret_flac_projectile_think_explode(entity this)
{
- SELFPARAM();
if(self.enemy != world)
if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 3))
setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
float autocvar_g_turrets_unit_hellion_shot_speed_gain;
float autocvar_g_turrets_unit_hellion_shot_speed_max;
-void turret_hellion_missile_think();
+void turret_hellion_missile_think(entity this);
SOUND(HellionAttack_FIRE, W_Sound("electro_fire"));
METHOD(HellionAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
bool isPlayer = IS_PLAYER(actor);
}
}
-void turret_hellion_missile_think()
-{SELFPARAM();
+void turret_hellion_missile_think(entity this)
+{
vector olddir,newdir;
vector pre_pos;
float itime;
olddir = normalize(self.velocity);
if(self.max_health < time)
- turret_projectile_explode();
+ turret_projectile_explode(self);
// Enemy dead? just keep on the current heading then.
if ((self.enemy == world) || (IS_DEAD(self.enemy)))
self.angles = vectoangles(self.velocity);
if(vdist(self.origin - self.owner.origin, >, (self.owner.shot_radius * 5)))
- turret_projectile_explode();
+ turret_projectile_explode(self);
// Accelerate
self.velocity = olddir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
// Enemy in range?
if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 0.2))
- turret_projectile_explode();
+ turret_projectile_explode(self);
// Predict enemy position
itime = vlen(self.enemy.origin - self.origin) / vlen(self.velocity);
float autocvar_g_turrets_unit_hk_shot_speed_max;
float autocvar_g_turrets_unit_hk_shot_speed_turnrate;
-void turret_hk_missile_think();
+void turret_hk_missile_think(entity this);
SOUND(HunterKillerAttack_FIRE, W_Sound("electro_fire"));
METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
}
bool hk_is_valid_target(entity e_target);
-void turret_hk_missile_think()
-{SELFPARAM();
+void turret_hk_missile_think(entity this)
+{
vector vu, vd, vf, vl, vr, ve; // Vector (direction)
float fu, fd, ff, fl, fr, fe; // Fraction to solid
vector olddir,wishdir,newdir; // Final direction
// Close enougth to do decent damage?
if ( edist <= (self.owner.shot_radius * 0.25) )
{
- turret_projectile_explode();
+ turret_projectile_explode(self);
return;
}
#ifdef IMPLEMENTATION
#ifdef SVQC
-void beam_think();
+void beam_think(entity this);
.int fireflag;
SOUND(PhaserTurretAttack_FIRE, W_Sound("electro_fire"));
}
}
-void beam_think()
-{SELFPARAM();
+void beam_think(entity this)
+{
if ((time > self.cnt) || (IS_DEAD(self.owner)))
{
self.owner.attack_finished_single[0] = time + self.owner.shot_refire;
turrets_setframe(ANIM_NO, false);
self.animflag = self.frame;
}
-void walker_rocket_explode()
-{SELFPARAM();
+void walker_rocket_explode(entity this)
+{
RadiusDamage (self, self.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), self, world, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, world);
remove (self);
}
}
#define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
-void walker_rocket_loop();
-void walker_rocket_think()
-{SELFPARAM();
+void walker_rocket_loop(entity this);
+void walker_rocket_think(entity this)
+{
vector newdir;
float edist;
float itime;
if (self.shot_dmg != 1337 && random() < 0.01)
{
- walker_rocket_loop();
+ walker_rocket_loop(self);
return;
}
WALKER_ROCKET_MOVE;
}
-void walker_rocket_loop3()
-{SELFPARAM();
+void walker_rocket_loop3(entity this)
+{
vector newdir;
self.nextthink = time;
self.angles = vectoangles(self.velocity);
}
-void walker_rocket_loop2()
-{SELFPARAM();
+void walker_rocket_loop2(entity this)
+{
vector newdir;
self.nextthink = time;
WALKER_ROCKET_MOVE;
}
-void walker_rocket_loop()
-{SELFPARAM();
+void walker_rocket_loop(entity this)
+{
self.nextthink = time;
self.tur_shotorg = self.origin + '0 0 300';
setthink(self, walker_rocket_loop2);
}
}
-void vehicles_projectile_explode()
-{SELFPARAM();
+void vehicles_projectile_explode(entity this)
+{
if(self.owner && other != world)
{
if(other == self.owner.vehicle)
void vehicles_projectile_explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, vehicles_projectile_explode());
+ WITHSELF(this, vehicles_projectile_explode(this));
}
entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
proj.use = vehicles_projectile_explode_use;
proj.owner = this;
proj.realowner = _owner;
- setthink(proj, SUB_Remove_self);
+ setthink(proj, SUB_Remove);
proj.nextthink = time + 30;
if(_health)
return proj;
}
-void vehicles_gib_explode()
-{SELFPARAM();
+void vehicles_gib_explode(entity this)
+{
sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
Send_Effect(EFFECT_EXPLOSION_SMALL, self.wp00.origin + '0 0 64', '0 0 0', 1);
remove(self);
}
-void vehicles_gib_think()
-{SELFPARAM();
+void vehicles_gib_think(entity this)
+{
self.alpha -= 0.1;
if(self.cnt >= time)
remove(self);
if(ret.wp00 == veh)
{
ret.classname = "";
- setthink(ret, SUB_Remove_self);
+ setthink(ret, SUB_Remove);
ret.nextthink = time + 0.1;
if(ret.waypointsprite_attached)
}
}
-void vehicles_spawn();
-void vehicles_return()
-{SELFPARAM();
+void vehicles_spawn(entity this);
+void vehicles_return(entity this)
+{
Send_Effect(EFFECT_TELEPORT, self.wp00.origin + '0 0 64', '0 0 0', 1);
setthink(self.wp00, vehicles_spawn);
remove(self);
}
-void vehicles_showwp_goaway()
-{SELFPARAM();
+void vehicles_showwp_goaway(entity this)
+{
if(self.waypointsprite_attached)
WaypointSprite_Kill(self.waypointsprite_attached);
}
-void vehicles_showwp()
-{SELFPARAM();
+void vehicles_showwp(entity this)
+{
vector rgb;
entity ent = this;
}
}
-void shieldhit_think()
-{SELFPARAM();
+void shieldhit_think(entity this)
+{
self.alpha -= 0.1;
if (self.alpha <= 0)
{
vehicles_exit_running = false;
}
-void vehicles_touch()
-{SELFPARAM();
+void vehicles_touch(entity this)
+{
if(MUTATOR_CALLHOOK(VehicleTouch, self, other))
return;
antilag_clear(pl, CS(pl));
}
-void vehicles_think()
-{SELFPARAM();
+void vehicles_think(entity this)
+{
self.nextthink = time;
if(self.owner)
}
// initialization
-void vehicles_spawn()
-{SELFPARAM();
+void vehicles_spawn(entity this)
+{
LOG_TRACE("Spawning vehicle: ", self.classname, "\n");
// disown & reset
return true;
}
-void bumblebee_touch()
-{SELFPARAM();
+void bumblebee_touch(entity this)
+{
if(autocvar_g_vehicles_enter) { return; }
if(self.gunner1 != world && self.gunner2 != world)
{
- vehicles_touch();
+ vehicles_touch(self);
return;
}
return;
}
- vehicles_touch();
+ vehicles_touch(self);
}
void bumblebee_regen(entity this)
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
}
-void bumblebee_land()
-{SELFPARAM();
+void bumblebee_land(entity this)
+{
float hgt;
hgt = raptor_altitude(512);
self.owner = world;
}
-void bumblebee_blowup()
-{SELFPARAM();
+void bumblebee_blowup(entity this)
+{
RadiusDamage(self, self.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage,
autocvar_g_vehicle_bumblebee_blowup_edgedamage,
autocvar_g_vehicle_bumblebee_blowup_radius, self, world,
remove(self);
}
-void bumblebee_diethink()
-{SELFPARAM();
+void bumblebee_diethink(entity this)
+{
if(time >= self.wait)
setthink(self, bumblebee_blowup);
entity oldother = other;
other = e;
self.phase = 0;
- gettouch(self)();
+ gettouch(self)(self);
other = oldother;
return;
}
entity oldother = other;
other = e;
self.phase = 0;
- gettouch(self)();
+ gettouch(self)(self);
other = oldother;
return;
}
this.velocity = vehic.velocity;
}
-void racer_think()
-{SELFPARAM();
+void racer_think(entity this)
+{
this.nextthink = time + autocvar_g_vehicle_racer_thinkrate;
tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NOMONSTERS, this);
setorigin(self, self.pos1);
}
-void racer_blowup_think()
-{SELFPARAM();
+void racer_blowup_think(entity this)
+{
self.nextthink = time;
if(time >= self.delay)
CSQCMODEL_AUTOUPDATE(self);
}
-void racer_deadtouch()
-{SELFPARAM();
+void racer_deadtouch(entity this)
+{
self.avelocity_x *= 0.7;
self.cnt -= 1;
if(self.cnt <= 0)
return isPlayer || veh.vehicle_energy >= autocvar_g_vehicle_racer_cannon_cost;
}
-void racer_rocket_tracker();
-void racer_rocket_groundhugger();
+void racer_rocket_tracker(entity this);
+void racer_rocket_groundhugger(entity this);
void racer_fire_rocket(entity player, vector org, vector dir, entity trg)
{
setthink(rocket, racer_rocket_groundhugger);
}
-void racer_rocket_tracker()
-{SELFPARAM();
+void racer_rocket_tracker(entity this)
+{
vector olddir, newdir;
float oldvel, newvel;
return;
}
-void racer_rocket_groundhugger()
-{SELFPARAM();
+void racer_rocket_groundhugger(entity this)
+{
vector olddir, newdir;
float oldvel, newvel;
return vlen(self.origin - trace_endpos);
}
-void raptor_land()
-{SELFPARAM();
+void raptor_land(entity this)
+{
float hgt;
hgt = raptor_altitude(512);
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
}
-void raptor_blowup()
-{SELFPARAM();
+void raptor_blowup(entity this)
+{
self.deadflag = DEAD_DEAD;
self.vehicle_exit(VHEF_NORMAL);
RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH.m_id, world);
self.nextthink = 0;
}
-void raptor_diethink()
-{SELFPARAM();
+void raptor_diethink(entity this)
+{
if(time >= self.wait)
setthink(self, raptor_blowup);
// If we dont do this ever now and then, the raptors rotors
// stop working, presumably due to angle overflow. cute.
-void raptor_rotor_anglefix()
-{SELFPARAM();
+void raptor_rotor_anglefix(entity this)
+{
self.gun1.angles_y = anglemods(self.gun1.angles_y);
self.gun2.angles_y = anglemods(self.gun2.angles_y);
self.nextthink = time + 15;
}
}
-void raptor_flare_think();
+void raptor_flare_think(entity this);
void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
-void raptor_flare_touch();
+void raptor_flare_touch(entity this);
METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
bool isPlayer = IS_PLAYER(actor);
}
-void raptor_bomblet_boom()
-{SELFPARAM();
+void raptor_bomblet_boom(entity this)
+{
RadiusDamage (self, self.realowner, autocvar_g_vehicle_raptor_bomblet_damage,
autocvar_g_vehicle_raptor_bomblet_edgedamage,
autocvar_g_vehicle_raptor_bomblet_radius, world, world,
remove(self);
}
-void raptor_bomblet_touch()
-{SELFPARAM();
+void raptor_bomblet_touch(entity this)
+{
if(other == self.owner)
return;
self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay;
}
-void raptor_bomb_burst()
-{SELFPARAM();
+void raptor_bomb_burst(entity this)
+{
if(self.cnt > time)
if(autocvar_g_vehicle_raptor_bomblet_alt)
{
CSQCProjectile(bomb_2, true, PROJECTILE_RAPTORBOMB, true);
}
-void raptor_flare_touch()
-{SELFPARAM();
+void raptor_flare_touch(entity this)
+{
remove(self);
}
remove(this);
}
-void raptor_flare_think()
-{SELFPARAM();
+void raptor_flare_think(entity this)
+{
self.nextthink = time + 0.1;
entity _missile = findchainentity(enemy, self.owner);
while(_missile)
self.owner = world;
}
-void spiderbot_headfade()
-{SELFPARAM();
+void spiderbot_headfade(entity this)
+{
setthink(self, spiderbot_headfade);
self.nextthink = self.fade_time;
self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
}
}
-void spiderbot_blowup()
-{SELFPARAM();
+void spiderbot_blowup(entity this)
+{
if(self.cnt > time)
{
if(random() < 0.1)
UpdateCSQCProjectile(self);
}
-void spiderbot_rocket_unguided()
-{SELFPARAM();
+void spiderbot_rocket_unguided(entity this)
+{
vector newdir, olddir;
self.nextthink = time;
self.use(self, NULL, NULL);
}
-void spiderbot_rocket_guided()
-{SELFPARAM();
+void spiderbot_rocket_guided(entity this)
+{
vector newdir, olddir;
self.nextthink = time;
if (f) f(it, chan);
});
}
-void W_PROP_think()
+void W_PROP_think(entity this)
{
W_PROP_reload(MSG_ALL, NULL);
}
STATIC_INIT_LATE(W_PROP_reloader)
{
entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
- WITHSELF(e, (setthink(e, W_PROP_think))());
+ WITHSELF(e, (setthink(e, W_PROP_think))(e));
}
#endif
W_PrepareExplosionByDamage(this, attacker, getthink(this));
}
-void W_Arc_Bolt_Touch()
-{SELFPARAM();
+void W_Arc_Bolt_Touch(entity this)
+{
PROJECTILE_TOUCH;
self.use(this, NULL, NULL);
}
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
-void W_Arc_Beam_Think()
-{SELFPARAM();
+void W_Arc_Beam_Think(entity this)
+{
if(self != self.owner.arc_beam)
{
remove(self);
beam.beam_bursting = burst;
Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
- WITHSELF(beam, getthink(beam)());
+ WITHSELF(beam, getthink(beam)(beam));
}
void Arc_Smoke()
spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); }
spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
-void W_Blaster_Touch()
-{SELFPARAM();
+void W_Blaster_Touch(entity this)
+{
PROJECTILE_TOUCH;
self.event_damage = func_null;
remove(self);
}
-void W_Blaster_Think()
-{SELFPARAM();
+void W_Blaster_Think(entity this)
+{
this.movetype = MOVETYPE_FLY;
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time + this.blaster_lifetime;
CSQCProjectile(this, true, PROJECTILE_BLASTER, true);
}
if (time >= missile.nextthink)
{
- WITHSELF(missile, getthink(missile)());
+ WITHSELF(missile, getthink(missile)(missile));
}
}
return targ_origin;
}
-void W_Crylink_LinkJoinEffect_Think()
-{SELFPARAM();
+void W_Crylink_LinkJoinEffect_Think(entity this)
+{
// is there at least 2 projectiles very close?
entity e, p;
float n;
}
// NO bounce protection, as bounces are limited!
-void W_Crylink_Touch()
-{SELFPARAM();
+void W_Crylink_Touch(entity this)
+{
float finalhit;
float f;
float isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
// CSQCProjectile(proj, true, PROJECTILE_CRYLINK, true);
}
-void W_Crylink_Fadethink()
-{SELFPARAM();
+void W_Crylink_Fadethink(entity this)
+{
W_Crylink_Dequeue(self);
remove(self);
}
}
}
-void W_Devastator_Explode()
-{SELFPARAM();
+void W_Devastator_Explode(entity this)
+{
W_Devastator_Unregister();
if(other.takedamage == DAMAGE_AIM)
// normalize(thisdir + goaldir)
// normalize(0)
-void W_Devastator_Think()
-{SELFPARAM();
+void W_Devastator_Think(entity this)
+{
vector desireddir, olddir, newdir, desiredorigin, goal;
float velspeed, f;
self.nextthink = time;
{
other = world;
self.projectiledeathtype |= HITTYPE_BOUNCE;
- W_Devastator_Explode();
+ W_Devastator_Explode(self);
return;
}
UpdateCSQCProjectile(self);
}
-void W_Devastator_Touch()
-{SELFPARAM();
+void W_Devastator_Touch(entity this)
+{
if(WarpZone_Projectile_Touch())
{
if(wasfreed(self))
return;
}
W_Devastator_Unregister();
- W_Devastator_Explode();
+ W_Devastator_Explode(this);
}
void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
#ifdef SVQC
.float electro_count;
.float electro_secondarytime;
-void W_Electro_ExplodeCombo();
+void W_Electro_ExplodeCombo(entity this);
#endif
#endif
#ifdef IMPLEMENTATION
}
}
-void W_Electro_ExplodeCombo()
-{SELFPARAM();
+void W_Electro_ExplodeCombo(entity this)
+{
W_Electro_TriggerCombo(self.origin, WEP_CVAR(electro, combo_comboradius), self.realowner);
self.event_damage = func_null;
WITHSELF(this, W_Electro_Explode());
}
-void W_Electro_TouchExplode()
+void W_Electro_TouchExplode(entity this)
{
PROJECTILE_TOUCH;
W_Electro_Explode();
}
-void W_Electro_Bolt_Think()
-{SELFPARAM();
+void W_Electro_Bolt_Think(entity this)
+{
if(time >= self.ltime)
{
this.use(this, NULL, NULL);
MUTATOR_CALLHOOK(EditProjectile, self, proj);
}
-void W_Electro_Orb_Touch()
-{SELFPARAM();
+void W_Electro_Orb_Touch(entity this)
+{
PROJECTILE_TOUCH;
if(other.takedamage == DAMAGE_AIM)
{ if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(); } }
#ifdef SVQC
spawnfunc(weapon_fireball) { weapon_defaultspawnfunc(this, WEP_FIREBALL); }
-void W_Fireball_Explode()
-{SELFPARAM();
+void W_Fireball_Explode(entity this)
+{
entity e;
float dist;
float points;
void W_Fireball_Explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Fireball_Explode());
+ WITHSELF(this, W_Fireball_Explode(this));
}
-void W_Fireball_TouchExplode()
+void W_Fireball_TouchExplode(entity this)
{
PROJECTILE_TOUCH;
- W_Fireball_Explode();
+ W_Fireball_Explode(this);
}
void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime)
}
}
-void W_Fireball_Think()
-{SELFPARAM();
+void W_Fireball_Think(entity this)
+{
if(time > self.pushltime)
{
self.cnt = 1;
self.projectiledeathtype |= HITTYPE_SPLASH;
- W_Fireball_Explode();
+ W_Fireball_Explode(this);
return;
}
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1);
}
-void W_Fireball_Firemine_Think()
-{SELFPARAM();
+void W_Fireball_Firemine_Think(entity this)
+{
if(time > self.pushltime)
{
remove(self);
self.nextthink = time + 0.1;
}
-void W_Fireball_Firemine_Touch()
-{SELFPARAM();
+void W_Fireball_Firemine_Touch(entity this)
+{
PROJECTILE_TOUCH;
if(other.takedamage == DAMAGE_AIM)
if(Fire_AddDamage(other, self.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), self.projectiledeathtype) >= 0)
W_PrepareExplosionByDamage(this, attacker, getthink(this));
}
-void W_Hagar_Touch()
-{SELFPARAM();
+void W_Hagar_Touch(entity this)
+{
PROJECTILE_TOUCH;
this.use(this, NULL, NULL);
}
-void W_Hagar_Touch2()
-{SELFPARAM();
+void W_Hagar_Touch2(entity this)
+{
PROJECTILE_TOUCH;
if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
#ifdef SVQC
spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); }
-void W_HLAC_Touch()
-{SELFPARAM();
+void W_HLAC_Touch(entity this)
+{
float isprimary;
PROJECTILE_TOUCH;
//missile.angles = vectoangles(missile.velocity); // csqc
settouch(missile, W_HLAC_Touch);
- setthink(missile, SUB_Remove_self);
+ setthink(missile, SUB_Remove);
missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
//missile.angles = vectoangles(missile.velocity); // csqc
settouch(missile, W_HLAC_Touch);
- setthink(missile, SUB_Remove_self);
+ setthink(missile, SUB_Remove);
missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
spawnfunc(weapon_hook) { weapon_defaultspawnfunc(this, WEP_HOOK); }
-void W_Hook_ExplodeThink()
-{SELFPARAM();
+void W_Hook_ExplodeThink(entity this)
+{
float dt, dmg_remaining_next, f;
dt = time - self.teleport_time;
remove(self);
}
-void W_Hook_Explode2()
-{SELFPARAM();
+void W_Hook_Explode2(entity this)
+{
self.event_damage = func_null;
settouch(self, func_null);
self.effects |= EF_NODRAW;
void W_Hook_Explode2_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Hook_Explode2());
+ WITHSELF(this, W_Hook_Explode2(this));
}
void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
W_PrepareExplosionByDamage(this, this.realowner, W_Hook_Explode2);
}
-void W_Hook_Touch2()
-{SELFPARAM();
+void W_Hook_Touch2(entity this)
+{
PROJECTILE_TOUCH;
this.use(this, NULL, NULL);
}
}
spawnfunc(weapon_uzi) { spawnfunc_weapon_machinegun(this); }
-void W_MachineGun_MuzzleFlash_Think()
-{SELFPARAM();
+void W_MachineGun_MuzzleFlash_Think(entity this)
+{
this.frame += 2;
this.scale *= 0.5;
this.alpha -= 0.25;
if(this.alpha <= 0)
{
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time;
this.realowner.muzzle_flash = world;
return;
REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
#ifdef SVQC
-void W_MineLayer_Think();
+void W_MineLayer_Think(entity this);
.float minelayer_detonate, mine_explodeanyway;
.float mine_time;
.vector mine_orientation;
SetMovetypeFollow(newmine, to);
}
-void W_MineLayer_Explode()
-{SELFPARAM();
+void W_MineLayer_Explode(entity this)
+{
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
}
self.mine_time = 0;
- W_MineLayer_Explode();
+ W_MineLayer_Explode(self);
}
int W_MineLayer_Count(entity e)
return minecount;
}
-void W_MineLayer_Think()
-{SELFPARAM();
+void W_MineLayer_Think(entity this)
+{
entity head;
self.nextthink = time;
{
other = world;
self.projectiledeathtype |= HITTYPE_BOUNCE;
- W_MineLayer_Explode();
+ W_MineLayer_Explode(self);
return;
}
W_MineLayer_RemoteExplode();
}
-void W_MineLayer_Touch()
-{SELFPARAM();
+void W_MineLayer_Touch(entity this)
+{
if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
return; // we're already a stuck mine, why do we get called? TODO does this even happen?
W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
}
-void W_Mortar_Grenade_Think1()
-{SELFPARAM();
+void W_Mortar_Grenade_Think1(entity this)
+{
self.nextthink = time;
if(time > self.cnt)
{
W_Mortar_Grenade_Explode();
}
-void W_Mortar_Grenade_Touch1()
-{SELFPARAM();
+void W_Mortar_Grenade_Touch1(entity this)
+{
PROJECTILE_TOUCH;
if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
}
}
-void W_Mortar_Grenade_Touch2()
-{SELFPARAM();
+void W_Mortar_Grenade_Touch2(entity this)
+{
PROJECTILE_TOUCH;
if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
}
}
-void W_Porto_Think()
-{SELFPARAM();
+void W_Porto_Think(entity this)
+{
trace_plane_normal = '0 0 0';
if(self.realowner.playerid != self.playerid)
remove(self);
W_Porto_Fail(0);
}
-void W_Porto_Touch()
-{SELFPARAM();
+void W_Porto_Touch(entity this)
+{
vector norm;
// do not use PROJECTILE_TOUCH here
// ============================
// Begin: Missile functions, these are general functions to be manipulated by other code
// ============================
-void W_Seeker_Missile_Explode()
-{SELFPARAM();
+void W_Seeker_Missile_Explode(entity this)
+{
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), self.projectiledeathtype, other);
remove(self);
}
-void W_Seeker_Missile_Touch()
+void W_Seeker_Missile_Touch(entity this)
{
PROJECTILE_TOUCH;
- W_Seeker_Missile_Explode();
+ W_Seeker_Missile_Explode(this);
}
-void W_Seeker_Missile_Think()
-{SELFPARAM();
+void W_Seeker_Missile_Think(entity this)
+{
entity e;
vector desireddir, olddir, newdir, eorg;
float turnrate;
if(time > self.cnt)
{
self.projectiledeathtype |= HITTYPE_SPLASH;
- W_Seeker_Missile_Explode();
+ W_Seeker_Missile_Explode(self);
}
spd = vlen(self.velocity);
{
if(self.autoswitch <= time)
{
- W_Seeker_Missile_Explode();
+ W_Seeker_Missile_Explode(self);
self.autoswitch = 0;
}
}
// ============================
// Begin: FLAC, close range attack meant for defeating rockets which are coming at you.
// ============================
-void W_Seeker_Flac_Explode()
-{SELFPARAM();
+void W_Seeker_Flac_Explode(entity this)
+{
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), world, world, WEP_CVAR(seeker, flac_force), self.projectiledeathtype, other);
void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Seeker_Flac_Explode());
+ WITHSELF(this, W_Seeker_Flac_Explode(this));
}
void W_Seeker_Flac_Touch()
{
+ SELFPARAM();
PROJECTILE_TOUCH;
- W_Seeker_Flac_Explode();
+ W_Seeker_Flac_Explode(this);
}
void W_Seeker_Fire_Flac(Weapon thiswep)
W_Seeker_Fire_Missile(WEP_SEEKER, '0 0 0', closest_target);
}
-void W_Seeker_Vollycontroller_Think() // TODO: Merge this with W_Seeker_Attack
-{SELFPARAM();
+void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seeker_Attack
+{
float c;
entity oldenemy;
this.cnt = this.cnt - 1;
own.enemy = oldenemy;
}
-void W_Seeker_Tracker_Think()
-{SELFPARAM();
+void W_Seeker_Tracker_Think(entity this)
+{
// commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
if((IS_DEAD(self.realowner)) || (IS_DEAD(self.tag_target)) || (PS(self.realowner).m_switchweapon != WEP_SEEKER)
|| (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
W_Seeker_Tag_Explode(this);
}
-void W_Seeker_Tag_Touch()
-{SELFPARAM();
+void W_Seeker_Tag_Touch(entity this)
+{
vector dir;
vector org2;
entity e;
missile.bot_dodge = true;
missile.bot_dodgerating = 50;
settouch(missile, W_Seeker_Tag_Touch);
- setthink(missile, SUB_Remove_self);
+ setthink(missile, SUB_Remove);
missile.nextthink = time + WEP_CVAR(seeker, tag_lifetime);
missile.movetype = MOVETYPE_FLY;
missile.solid = SOLID_BBOX;
vector shockwave_hit_force[MAX_SHOCKWAVE_HITS];
// MELEE ATTACK MODE
-void W_Shockwave_Melee_Think()
-{SELFPARAM();
+void W_Shockwave_Melee_Think(entity this)
+{
// declarations
float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
entity target_victim;
// muzzle flash for 1st person view
flash = spawn();
setmodel(flash, MDL_SHOTGUN_MUZZLEFLASH); // precision set below
- setthink(flash, SUB_Remove_self);
+ setthink(flash, SUB_Remove);
flash.nextthink = time + 0.06;
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
W_AttachToShotorg(self, flash, '5 0 0');
.float swing_prev;
.entity swing_alreadyhit;
-void W_Shotgun_Melee_Think()
-{SELFPARAM();
+void W_Shotgun_Melee_Think(entity this)
+{
// declarations
float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
entity target_victim;
return true;
}
-void W_Tuba_NoteThink()
-{SELFPARAM();
+void W_Tuba_NoteThink(entity this)
+{
float dist_mult;
float vol0, vol1;
vector dir0, dir1;
}
}
-void Ent_TubaNote_Think()
-{SELFPARAM();
+void Ent_TubaNote_Think(entity this)
+{
float f = autocvar_g_balance_tuba_fadetime;
if (f > 0) {
this.tuba_volume -= frametime * this.tuba_volume_initial / f;
this.enemy = NULL;
}
-void Ent_TubaNote_StopSound_self() { SELFPARAM(); Ent_TubaNote_StopSound(self); }
-
NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
{
bool upd = false;
}
}
- setthink(this, Ent_TubaNote_StopSound_self);
+ setthink(this, Ent_TubaNote_StopSound);
this.entremove = Ent_TubaNote_StopSound;
setthink(this.enemy, Ent_TubaNote_Think);
this.enemy.nextthink = time + 10;
NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
{
Net_Accept(vortex_beam);
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
this.draw = VaporizerBeam_Draw;
this.drawmask = MASK_NORMAL;
WITHSELF(this, W_RocketMinsta_Laser_Explode());
}
-void W_RocketMinsta_Laser_Touch ()
-{SELFPARAM();
+void W_RocketMinsta_Laser_Touch (entity this)
+{
PROJECTILE_TOUCH;
//W_RocketMinsta_Laser_Explode ();
RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
remove(this);
}
- /** Remove self */
- void SUB_Remove_self()
- {
- SELFPARAM();
- remove(this);
- }
-
- void defer_think()
+ void defer_think(entity this)
{
- SELFPARAM();
- setthink(this, SUB_Remove_self);
+ setthink(this, SUB_Remove);
this.nextthink = time;
this.defer_func(this.owner);
}
if (dt)
{
e.nextthink = time + dt;
- setthink(e, SUB_Remove_self);
+ setthink(e, SUB_Remove);
}
}
(0, (e).__##T)
SELFWRAP(think, void, (entity this), (this))
-#define setthink(e, f) _SELFWRAP_SET(think, e, f)
-#define getthink(e) _SELFWRAP_GET(think, e)
+#define setthink(e, f) SELFWRAP_SET(think, e, f)
+#define getthink(e) SELFWRAP_GET(think, e)
SELFWRAP(touch, void, (entity this), (this))
-#define settouch(e, f) _SELFWRAP_SET(touch, e, f)
-#define gettouch(e) _SELFWRAP_GET(touch, e)
+#define settouch(e, f) SELFWRAP_SET(touch, e, f)
+#define gettouch(e) SELFWRAP_GET(touch, e)
SELFWRAP(predraw, void, (entity this), (this))
#define setpredraw(e, f) SELFWRAP_SET(predraw, e, f)
#ifndef MENUQC
-void adaptor_think2touch() { SELFPARAM(); WITH(entity, other, NULL, gettouch(this)()); }
-void adaptor_think2use() { SELFPARAM(); if (this.use) this.use(this, NULL, NULL); }
+void adaptor_think2touch(entity this) { WITH(entity, other, NULL, gettouch(this)(this)); }
+void adaptor_think2use(entity this) { if (this.use) this.use(this, NULL, NULL); }
#endif
this.drawmask = MASK_NORMAL;
}
-void WarpZone_Touch ();
+void WarpZone_Touch (entity this);
NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
{
warpzone_warpzones_exist = 1;
}
.entity WarpZone_refsys;
-void WarpZone_RefSys_GC()
-{SELFPARAM();
+void WarpZone_RefSys_GC(entity this)
+{
// garbage collect unused reference systems
this.nextthink = time + 1;
if(this.owner.WarpZone_refsys != this)
ts.SendEntity3 = WarpZone_Teleported_Send;
ts.SendFlags = 0xFFFFFF;
ts.drawonlytoclient = player;
- setthink(ts, SUB_Remove_self);
+ setthink(ts, SUB_Remove);
ts.nextthink = time + 1;
ts.owner = player;
ts.enemy = wz;
return 1;
}
-void WarpZone_Touch ()
-{SELFPARAM();
+void WarpZone_Touch (entity this)
+{
if(other.classname == "trigger_warpzone")
return;
this.enemy.aiment = this;
}
-void WarpZoneCamera_Think()
-{SELFPARAM();
+void WarpZoneCamera_Think(entity this)
+{
if(this.warpzone_save_origin != this.origin
|| this.warpzone_save_angles != this.angles
|| this.warpzone_save_eorigin != this.enemy.origin
}
}
-void WarpZone_Think();
+void WarpZone_Think(entity this);
void WarpZone_InitStep_FinalizeTransform(entity this)
{
if(!this.enemy || this.enemy.enemy != this)
WarpZone_InitStep_FinalizeTransform(e);
}
-void WarpZone_Think()
-{SELFPARAM();
+void WarpZone_Think(entity this)
+{
if(this.warpzone_save_origin != this.origin
|| this.warpzone_save_angles != this.angles
|| this.warpzone_save_eorigin != this.enemy.origin
// relink this spawnfunc_waypoint
// (precompile a list of all reachable waypoints from this spawnfunc_waypoint)
// (SLOW!)
-void waypoint_think()
-{SELFPARAM();
+void waypoint_think(entity this)
+{
entity e;
vector sv, sm1, sm2, ev, em1, em2, dv;
spawnfunc(waypoint);
void waypoint_addlink(entity from, entity to);
-void waypoint_think();
+void waypoint_think(entity this);
void waypoint_clearlinks(entity wp);
void waypoint_schedulerelink(entity wp);
END_CHEAT_FUNCTION();
}
-void DragBox_Think();
+void DragBox_Think(entity this);
float drag_lastcnt;
float CheatCommand(entity this, int argc)
{
}
}
-void DragBox_Think()
-{SELFPARAM();
+void DragBox_Think(entity this)
+{
if(this.aiment && this.enemy)
{
this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
WriteCoord(channel, autocvar_g_trueaim_minrange);
}
-void ClientInit_CheckUpdate()
-{SELFPARAM();
+void ClientInit_CheckUpdate(entity this)
+{
this.nextthink = time;
if(this.count != autocvar_g_balance_armor_blockpercent)
{
setthink(e, ClientInit_CheckUpdate);
Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
- WITHSELF(e, ClientInit_CheckUpdate());
+ WITHSELF(e, ClientInit_CheckUpdate(e));
}
/*
// now I am sure the player IS dead
}
-void KillIndicator_Think()
-{SELFPARAM();
+void KillIndicator_Think(entity this)
+{
if (gameover)
{
this.owner.killindicator = world;
if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false);
}
-void ChatBubbleThink()
-{SELFPARAM();
+void ChatBubbleThink(entity this)
+{
this.nextthink = time;
if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
{
MUTATOR_CALLHOOK(DropSpecialItems, player);
}
-void CopyBody_Think()
-{SELFPARAM();
+void CopyBody_Think(entity this)
+{
if(this.CopyBody_nextthink && time > this.CopyBody_nextthink)
{
- this.CopyBody_think();
+ this.CopyBody_think(this);
if(wasfreed(this))
return;
this.CopyBody_nextthink = this.nextthink;
.float istypefrag;
.float CopyBody_nextthink;
-.void() CopyBody_think;
-void CopyBody_Think();
+.void(entity this) CopyBody_think;
+void CopyBody_Think(entity this);
void CopyBody(entity this, float keepvelocity);
void player_setupanimsformodel();
remove(self);
}
-void timeout_handler_think()
+void timeout_handler_think(entity this)
{
- SELFPARAM();
switch (timeout_status)
{
case TIMEOUT_ACTIVE:
.vector lastV_angle; // used when pausing the game in order to force the player to keep his old view angle fixed
// allow functions to be used in other code like g_world.qc and teamplay.qc
-void timeout_handler_think();
+void timeout_handler_think(entity this);
// used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
void CommonCommand_macro_write_aliases(float fh);
// used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
void timeout_handler_reset();
-void timeout_handler_think();
+void timeout_handler_think(entity this);
// ===================================================
// Common commands used in both sv_cmd.qc and cmd.qc
remove(radarmapper);
radarmapper = world;
}
-void RadarMap_Think()
+void RadarMap_Think(entity this)
{
- SELFPARAM();
// rough map entity
// cnt: current line
// size: pixel width/height
// =====================================================
// used by GameCommand_make_mapinfo()
-void make_mapinfo_Think()
+void make_mapinfo_Think(entity this)
{
- SELFPARAM();
if (MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 1))
{
LOG_INFO("Done rebuiling mapinfos.\n");
}
// Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown is set)
-void ReadyRestart_think()
+void ReadyRestart_think(entity this)
{
- SELFPARAM();
restart_mapalreadyrestarted = true;
reset_map(true);
Score_ClearAll();
if(targ.killcount) { targ.killcount = 0; }
}
-void Ice_Think()
-{SELFPARAM();
+void Ice_Think(entity this)
+{
if(!STAT(FROZEN, self.owner) || self.owner.iceblock != self)
{
remove(self);
targ.iceblock = ice;
targ.revival_time = 0;
- WITHSELF(ice, Ice_Think());
+ WITHSELF(ice, Ice_Think(ice));
RemoveGrapplingHook(targ);
farcent.origin = hitloc;
farcent.forcetype = FORCETYPE_FORCEATPOS;
farcent.nextthink = time + 0.1;
- setthink(farcent, SUB_Remove_self);
+ setthink(farcent, SUB_Remove);
}
else
{
e.effects &= ~EF_FLAME;
}
-void fireburner_think()
-{SELFPARAM();
+void fireburner_think(entity this)
+{
// for players, this is done in the regular loop
if(wasfreed(self.owner))
{
void Obituary(entity attacker, entity inflictor, entity targ, int deathtype);
-void Ice_Think();
+void Ice_Think(entity this);
void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypoint);
.float fire_hitsound;
.entity fire_burner;
-void fireburner_think();
+void fireburner_think(entity this);
float Fire_IsBurning(entity e);
void Fire_ApplyDamage(entity e);
void Fire_ApplyEffect(entity e);
-
-void fireburner_think();
remove(this);
}
-void GrapplingHookThink();
+void GrapplingHookThink(entity this);
void GrapplingHook_Stop()
{SELFPARAM();
Send_Effect(EFFECT_HOOK_IMPACT, self.origin, '0 0 0', 1);
int autocvar_g_grappling_hook_tarzan;
-void GrapplingHookThink()
-{SELFPARAM();
+void GrapplingHookThink(entity this)
+{
float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch;
vector dir, org, end, v0, dv, v, myorg, vs;
if(self.realowner.hook != self) // how did that happen?
}
}
-void GrapplingHookTouch ()
-{SELFPARAM();
+void GrapplingHookTouch (entity this)
+{
if(other.movetype == MOVETYPE_FOLLOW)
return;
PROJECTILE_TOUCH;
#include "g_lights.qh"
-void train_next();
+void train_next(entity this);
const float LOOP = 1;
"NOSHADOW" will not cast shadows in realtime lighting mode
"FOLLOW" will follow the entity which "targetname" matches "target"
*/
-void dynlight_think()
+void dynlight_think(entity this)
{
- SELFPARAM();
if(!self.owner)
remove(self);
#pragma once
-void SUB_NullThink();
+void SUB_NullThink(entity this);
-void() SUB_CalcMoveDone;
-void() SUB_CalcAngleMoveDone;
+void SUB_CalcMoveDone(entity this);
+void SUB_CalcAngleMoveDone(entity this);
spawnfunc(info_null);
*/
void SUB_VanishOrRemove (entity ent);
-void SUB_SetFade_Think ();
+void SUB_SetFade_Think (entity this);
/*
==================
self.origin traveling at speed
===============
*/
-void SUB_CalcMoveDone ();
+void SUB_CalcMoveDone(entity this);
.float platmovetype_turn;
-void SUB_CalcMove_controller_think ();
+void SUB_CalcMove_controller_think (entity this);
void SUB_CalcMove_controller_setbezier (entity controller, vector org, vector control, vector dest);
void SUB_CalcMove_controller_setlinear (entity controller, vector org, vector dest);
-void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func);
+void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
-void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func);
+void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void(entity this) func);
-void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func);
+void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func);
/*
=============
The calling function should make sure self.think is valid
===============
*/
-void SUB_CalcAngleMoveDone ();
+void SUB_CalcAngleMoveDone (entity this);
// FIXME: I fixed this function only for rotation around the main axes
-void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func);
+void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void(entity this) func);
-void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func);
+void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func);
/*
==================
.float latency_cnt;
.float latency_time;
entity pingplreport;
-void PingPLReport_Think()
-{SELFPARAM();
+void PingPLReport_Think(entity this)
+{
float delta;
entity e;
}
}
-void GotoFirstMap()
-{SELFPARAM();
+void GotoFirstMap(entity this)
+{
float n;
if(autocvar__sv_init)
{
WriteShort(MSG_ENTITY, this.cnt);
return true;
}
-void RandomSeed_Think()
-{SELFPARAM();
+void RandomSeed_Think(entity this)
+{
this.cnt = bound(0, floor(random() * 65536), 65535);
this.nextthink = time + 5;
setthink(randomseed, RandomSeed_Think);
Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
- WITHSELF(randomseed, getthink(randomseed)()); // sets random seed and nextthink
+ WITHSELF(randomseed, getthink(randomseed)(randomseed)); // sets random seed and nextthink
}
spawnfunc(__init_dedicated_server)
}
}
-void OnlineBanList_Think()
-{SELFPARAM();
+void OnlineBanList_Think(entity this)
+{
float argc;
string uri;
float i, n;
/**
* Key touch handler.
*/
-void item_key_touch()
-{SELFPARAM();
+void item_key_touch(entity this)
+{
if (!IS_PLAYER(other))
return;
-void adaptor_think2use_hittype_splash() // for timed projectile detonation
-{SELFPARAM();
+void adaptor_think2use_hittype_splash(entity this) // for timed projectile detonation
+{
if(!(IS_ONGROUND(this))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
this.projectiledeathtype |= HITTYPE_SPLASH;
- WITHSELF(this, adaptor_think2use());
+ WITHSELF(this, adaptor_think2use(this));
}
// deferred dropping
void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
-void adaptor_think2use();
-
#define IS_DEAD(s) ((s).deadflag != DEAD_NO)
it.team = NUM_TEAM_1;
// Dubbles as teamchange
- WITHSELF(it, turret_respawn());
+ WITHSELF(it, turret_respawn(it));
));
}
void assault_roundstart_use_this(entity this)
assault_roundstart_use(this, NULL, NULL);
}
-void assault_wall_think()
-{SELFPARAM();
+void assault_wall_think(entity this)
+{
if(self.enemy.health < 0)
{
self.model = "";
// trigger new round
// reset objectives, toggle spawnpoints, reset triggers, ...
void vehicles_clearreturn(entity veh);
-void vehicles_spawn();
+void vehicles_spawn(entity this);
void assault_new_round()
{SELFPARAM();
//bprint("ASSAULT: new round\n");
FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA(
vehicles_clearreturn(it);
- WITHSELF(it, vehicles_spawn());
+ WITHSELF(it, vehicles_spawn(it));
));
// up round counter
return true;
}
-void ctf_CaptureShield_Touch()
-{SELFPARAM();
+void ctf_CaptureShield_Touch(entity this)
+{
if(!other.ctf_captureshielded) { return; }
if(CTF_SAMETEAM(self, other)) { return; }
}
}
-void ctf_FlagThink()
-{SELFPARAM();
+void ctf_FlagThink(entity this)
+{
// declarations
entity tmp_entity;
ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13')
ENDCLASS(Flag)
Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); }
-void ctf_FlagTouch() { SELFPARAM(); ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
+void ctf_FlagTouch(entity this) { ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
// flag constants // for most of these, there is just one question to be asked: WHYYYYY?
GameLogEcho(strcat(":cts:", mode, ":", ((actor != world) ? (strcat(":", ftos(actor.playerid))) : "")));
}
-void KillIndicator_Think();
+void KillIndicator_Think(entity this);
void CTS_ClientKill(entity e) // silent version of ClientKill, used when player finishes a CTS run. Useful to prevent cheating by running back to the start line and starting out with more speed
{
e.killindicator = spawn();
self.frame = 0;
}
-void dompointthink()
-{SELFPARAM();
+void dompointthink(entity this)
+{
float fragamt;
self.nextthink = time + 0.1;
}
}
-void dompointtouch()
-{SELFPARAM();
+void dompointtouch(entity this)
+{
entity head;
if (!IS_PLAYER(other))
return;
dompoint_captured();
}
-void dom_controlpoint_setup(entity this);
-void dom_controlpoint_setup_self() { SELFPARAM(); dom_controlpoint_setup(this); }
void dom_controlpoint_setup(entity this)
{
entity head;
remove(this);
return;
}
- setthink(this, dom_controlpoint_setup_self);
+ setthink(this, dom_controlpoint_setup);
this.nextthink = time + 0.1;
this.reset = dom_controlpoint_setup;
//eprint(e);
}
-void self_spawnfunc_dom_controlpoint() { SELFPARAM(); spawnfunc_dom_controlpoint(self); }
void dom_spawnpoint(vector org)
{
entity e = spawn();
e.classname = "dom_controlpoint";
- setthink(e, self_spawnfunc_dom_controlpoint);
+ setthink(e, spawnfunc_dom_controlpoint);
e.nextthink = time;
setorigin(e, org);
spawnfunc_dom_controlpoint(e);
monster = spawnmonster("", mon, world, world, e.origin, false, false, 2);
else return;
- setthink(e, SUB_Remove_self);
+ setthink(e, SUB_Remove);
e.nextthink = time + 0.1;
}
else
GameLogEcho(strcat(":ka:", mode, ((actor != world) ? (strcat(":", ftos(actor.playerid))) : "")));
}
-void ka_TouchEvent();
+void ka_TouchEvent(entity this);
void ka_RespawnBall(entity this);
-void ka_RespawnBall_self() { SELFPARAM(); ka_RespawnBall(this); }
void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
{
if(gameover) { return; }
self.angles = '0 0 0';
self.effects = autocvar_g_keepawayball_effects;
settouch(self, ka_TouchEvent);
- setthink(self, ka_RespawnBall_self);
+ setthink(self, ka_RespawnBall);
self.nextthink = time + autocvar_g_keepawayball_respawntime;
Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
sound(self, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
}
-void ka_TimeScoring()
-{SELFPARAM();
+void ka_TimeScoring(entity this)
+{
if(self.owner.ballcarried)
{ // add points for holding the ball after a certain amount of time
if(autocvar_g_keepaway_score_timepoints)
}
}
-void ka_TouchEvent() // runs any time that the ball comes in contact with something
-{SELFPARAM();
+void ka_TouchEvent(entity this) // runs any time that the ball comes in contact with something
+{
if(gameover) { return; }
if(!self) { return; }
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
ball.movetype = MOVETYPE_BOUNCE;
ball.wait = time + 1;
settouch(ball, ka_TouchEvent);
- setthink(ball, ka_RespawnBall_self);
+ setthink(ball, ka_RespawnBall);
ball.nextthink = time + autocvar_g_keepawayball_respawntime;
ball.takedamage = DAMAGE_YES;
ball.effects &= ~EF_NODRAW;
if(time < game_starttime)
{
- setthink(this, ka_RespawnBall_self);
+ setthink(this, ka_RespawnBall);
settouch(this, func_null);
this.nextthink = game_starttime;
}
kh_controller.nextthink = time; // force
}
void kh_WaitForPlayers();
-void kh_Controller_Think() // called a lot
-{SELFPARAM();
+void kh_Controller_Think(entity this) // called a lot
+{
if(intermission_running)
return;
if(self.cnt > 0)
kh_Key_AssignTo(key, player); // this also updates .kh_state
}
-void kh_Key_Touch() // runs many, many times when a key has been dropped and can be picked up
-{SELFPARAM();
+void kh_Key_Touch(entity this) // runs many, many times when a key has been dropped and can be picked up
+{
if(intermission_running)
return;
kh_FinishRound();
}
-void kh_Key_Think() // runs all the time
-{SELFPARAM();
+void kh_Key_Think(entity this) // runs all the time
+{
if(intermission_running)
return;
return true;
}
-void lms_extralife()
-{SELFPARAM();
+void lms_extralife(entity this)
+{
StartItem(this, ITEM_ExtraLife);
}
self.nextthink = time + 1;
}
-void __showpath2_think()
-{SELFPARAM();
+void __showpath2_think(entity this)
+{
#ifdef TURRET_DEBUG
mark_info(self.origin,1);
#endif
s = spawn();
s.alpha = 0.25;
- setthink(s, SUB_Remove_self);
+ setthink(s, SUB_Remove);
s.nextthink = _lifetime;
s.scale = pathlib_gridsize / 512.001;
s.solid = SOLID_NOT;
e = spawn();
e.alpha = 0.25;
- setthink(e, SUB_Remove_self);
+ setthink(e, SUB_Remove);
e.nextthink = _lifetime;
e.scale = pathlib_gridsize / 512;
e.solid = SOLID_NOT;
e = findchainentity(owner, start);
while(e)
{
- setthink(e, SUB_Remove_self);
+ setthink(e, SUB_Remove);
e.nextthink = time;
e = e.chain;
}
void dumpnode(entity n)
{
n.is_path_node = false;
- setthink(n, SUB_Remove_self);
+ setthink(n, SUB_Remove);
n.nextthink = time;
}
node = spawn();
- setthink(node, SUB_Remove_self);
+ setthink(node, SUB_Remove);
node.nextthink = time + PATHLIB_NODEEXPIRE;
node.is_path_node = true;
node.owner = openlist;
return end;
}
-void a_think()
-{SELFPARAM();
+void a_think(entity this)
+{
te_lightning1(this,this.origin, this.pos1);
if(this.cnt < time)
remove(this);
return world;
}
-void plas_think()
-{SELFPARAM();
+void plas_think(entity this)
+{
pathlib_waypointpath_step();
if(pathlib_foundgoal)
return;
#endif
}
-void Portal_Touch()
-{SELFPARAM();
+void Portal_Touch(entity this)
+{
vector g;
#ifdef PORTALS_ARE_NOT_SOLID
other.effects += EF_BLUE - EF_RED;
}
-void Portal_Think();
+void Portal_Think(entity this);
void Portal_MakeBrokenPortal(entity portal)
{
portal.skin = 2;
Portal_TeleportPlayer(this, e);
}
-void Portal_Think()
-{SELFPARAM();
+void Portal_Think(entity this)
+{
entity o;
vector g;
Portal_ClearAll_PortalsOnly(own);
W_Porto_Remove(own);
}
-void Portal_RemoveLater_Think()
-{SELFPARAM();
+void Portal_RemoveLater_Think(entity this)
+{
Portal_Remove(this, this.cnt);
}
void Portal_RemoveLater(entity portal, float kill)
}
}
-void checkpoint_touch()
-{SELFPARAM();
+void checkpoint_touch(entity this)
+{
EXACTTRIGGER_TOUCH;
checkpoint_passed(this, other);
}
}
}
-void penalty_touch()
-{SELFPARAM();
+void penalty_touch(entity this)
+{
EXACTTRIGGER_TOUCH;
if(other.race_lastpenalty != this)
{
#include "command/vote.qh"
#include "../common/util.qh"
-void round_handler_Think()
+void round_handler_Think(entity this)
{
- SELFPARAM();
-
if (time < game_starttime)
{
round_handler_Reset(game_starttime);
// NOTE: this is only needed because if round_handler spawns at time 1
// gamestarttime isn't initialized yet
-void round_handler_FirstThink()
+void round_handler_FirstThink(entity this)
{
- SELFPARAM();
round_starttime = max(time, game_starttime) + this.count;
setthink(this, round_handler_Think);
this.nextthink = max(time, game_starttime);
}
.vector spawnpoint_prevorigin;
-void spawnpoint_think()
+void spawnpoint_think(entity this)
{
- SELFPARAM();
this.nextthink = time + 0.1;
if(this.origin != this.spawnpoint_prevorigin)
{
else if (targ.classname == "item_health_mega")
this.health = 200;
//remove(targ); // removing ents in init functions causes havoc, workaround:
- setthink(targ, SUB_Remove_self);
+ setthink(targ, SUB_Remove);
targ.nextthink = time;
}
this.spawnflags = 2;
return true; // if none of these return, then allow damage anyway.
}
-void W_PrepareExplosionByDamage(entity this, entity attacker, void() explode)
+void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
{
this.takedamage = DAMAGE_NO;
this.event_damage = func_null;
.float prevstrengthsoundattempt;
void W_PlayStrengthSound(entity player);
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception);
-void W_PrepareExplosionByDamage(entity this, entity attacker, void() explode);
+void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode);
#include <common/weapons/all.qh>
#include <common/state.qh>
-void thrown_wep_think()
-{SELFPARAM();
+void thrown_wep_think(entity this)
+{
this.nextthink = time;
if(this.oldorigin != this.origin)
{
#pragma once
.float savenextthink;
-void thrown_wep_think();
+void thrown_wep_think(entity this);
// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
..entity weaponentity_fld;
.float m_alpha;
-void CL_Weaponentity_Think()
+void CL_Weaponentity_Think(entity this)
{
- SELFPARAM();
this.nextthink = time;
if (intermission_running) this.frame = this.anim_idle.x;
.entity weaponentity = this.weaponentity_fld;
}
}
-void CL_ExteriorWeaponentity_Think()
+void CL_ExteriorWeaponentity_Think(entity this)
{
- SELFPARAM();
this.nextthink = time;
if (this.owner.exteriorweaponentity != this)
{