entity announcer_countdown;
-void Announcer_Countdown()
+void Announcer_Countdown(entity this)
{
- SELFPARAM();
float starttime = STAT(GAMESTARTTIME);
float roundstarttime = STAT(ROUNDSTARTTIME);
if(roundstarttime == -1)
float autocvar_cl_hitsound_nom_damage = 25;
float autocvar_cl_hitsound_antispam_time;
int autocvar_cl_eventchase_death = 1;
-int autocvar_cl_eventchase_nexball = 1;
vector autocvar_cl_eventchase_generator_viewoffset = '0 0 80';
float autocvar_cl_eventchase_generator_distance = 400;
float autocvar_cl_eventchase_distance = 140;
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)
{
return true;
if(MUTATOR_CALLHOOK(WantEventchase, this))
return true;
- if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
- return true;
if(autocvar_cl_eventchase_death && (STAT(HEALTH) <= 0))
{
if(autocvar_cl_eventchase_death == 2)
return wcross_color;
}
-void HUD_Crosshair()
-{SELFPARAM();
- entity e = this;
+void HUD_Crosshair(entity this)
+{
float f, i, j;
vector v;
if(!scoreboard_active && !camera_active && intermission != 2 &&
string wcross_name = "";
float wcross_scale, wcross_blur;
+ entity e = this; // wtf?
if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1))
{
e = switchingweapon;
}
}
-void HUD_Draw()
+void HUD_Draw(entity this)
{
if(!intermission)
if (MUTATOR_CALLHOOK(HUD_Draw_overlay))
// crosshair goes VERY LAST
UpdateDamage();
- HUD_Crosshair();
+ HUD_Crosshair(this);
HitSound();
}
float vh_notice_time;
void WaypointSprite_Load();
void CSQC_UpdateView(float w, float h)
-{SELFPARAM();
+{
+ SELFPARAM();
TC(int, w); TC(int, h);
entity e;
float fov;
scoreboard_active = HUD_WouldDrawScoreboard();
- HUD_Draw();
+ HUD_Draw(this);
if(NextFrameCommand)
{
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;
if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
{
if(!MUTATOR_CALLHOOK(Weapon_ImpactEffect, hitwep))
- hitwep.wr_impacteffect(hitwep);
+ hitwep.wr_impacteffect(hitwep, this);
}
}
}
__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);
#include "nexball.qh"
#ifdef IMPLEMENTATION
+#ifdef CSQC
+int autocvar_cl_eventchase_nexball = 1;
+
+REGISTER_MUTATOR(cl_nb, true);
+
+MUTATOR_HOOKFUNCTION(cl_nb, WantEventchase)
+{
+ if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
+ return true;
+ return false;
+}
+#endif
#ifdef SVQC
.float metertime = _STAT(NB_METERSTART);
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()
-{SELFPARAM();
+void nexball_setstatus(entity this)
+{
this.items &= ~IT_KEY1;
if(this.ballcarried)
{
{
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);
plyr.(weaponentity).m_switchweapon = PS(plyr).m_weapon;
plyr.weapons = WEPSET(NEXBALL);
Weapon w = WEP_NEXBALL;
- WITHSELF(plyr, w.wr_resetplayer(w));
+ WITHSELF(plyr, w.wr_resetplayer(w, plyr));
PS(plyr).m_switchweapon = WEP_NEXBALL;
WITHSELF(plyr, W_SwitchWeapon(plyr, WEP_NEXBALL));
}
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;
- //self.enemy = world;
+ attacker = this.owner;
+ //this.think = func_null;
+ //this.enemy = world;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
if((ball = other.ballcarried) && !STAT(FROZEN, other) && !IS_DEAD(other) && (IS_PLAYER(attacker)))
{
- other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
+ other.velocity = other.velocity + normalize(this.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
UNSET_ONGROUND(other);
if(!attacker.ballcarried)
{
GiveBall(attacker, other.ballcarried);
}
}
- remove(self);
+ remove(this);
}
-void W_Nexball_Attack(float t)
-{SELFPARAM();
+void W_Nexball_Attack(entity actor, float t)
+{
entity ball;
float mul, mi, ma;
- if(!(ball = self.ballcarried))
+ if(!(ball = actor.ballcarried))
return;
- W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+ W_SetupShot(actor, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world);
if(trace_startsolid)
{
- if(self.metertime)
- self.metertime = 0; // Shot failed, hide the power meter
+ if(actor.metertime)
+ actor.metertime = 0; // Shot failed, hide the power meter
return;
}
mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
}
- DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
+ DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
//TODO: use the speed_up cvar too ??
vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
-void W_Nexball_Attack2()
-{SELFPARAM();
- if(self.ballcarried.enemy)
+void W_Nexball_Attack2(entity actor)
+{
+ if(actor.ballcarried.enemy)
{
- entity _ball = self.ballcarried;
- W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+ entity _ball = actor.ballcarried;
+ W_SetupShot(actor, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
setthink(_ball, W_Nexball_Think);
_ball.nextthink = time;
if(!autocvar_g_nexball_tackling)
return;
- W_SetupShot(self, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
+ W_SetupShot(actor, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
entity missile = new(ballstealer);
- missile.owner = self;
+ missile.owner = actor;
missile.movetype = MOVETYPE_FLY;
PROJECTILE_MAKETRIGGER(missile);
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;
METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
{
- SELFPARAM();
TC(BallStealer, thiswep);
if(fire & 1)
if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
if(autocvar_g_nexball_basketball_meter)
{
- if(self.ballcarried && !self.metertime)
- self.metertime = time;
+ if(actor.ballcarried && !actor.metertime)
+ actor.metertime = time;
else
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
else
{
- W_Nexball_Attack(-1);
+ W_Nexball_Attack(actor, -1);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
if(fire & 2)
if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
{
- W_Nexball_Attack2();
+ W_Nexball_Attack2(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
}
- if(!(fire & 1) && self.metertime && self.ballcarried)
+ if(!(fire & 1) && actor.metertime && actor.ballcarried)
{
- W_Nexball_Attack(time - self.metertime);
+ W_Nexball_Attack(actor, time - actor.metertime);
// DropBall or stealing will set metertime back to 0
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
}
-METHOD(BallStealer, wr_setup, void(BallStealer this))
+METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor))
{
TC(BallStealer, this);
//weapon_setup(WEP_PORTO.m_id);
{
self.weapons = self.(weaponentity).weapons;
Weapon w = WEP_NEXBALL;
- w.wr_resetplayer(w);
+ w.wr_resetplayer(w, self);
PS(self).m_switchweapon = self.(weaponentity).m_switchweapon;
W_SwitchWeapon(self, PS(self).m_switchweapon);
}
- nexball_setstatus();
+ nexball_setstatus(self);
return false;
}
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;
+ PROJECTILE_TOUCH(this);
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();
- PROJECTILE_TOUCH;
+void M_Shambler_Attack_Lightning_Touch(entity this)
+{
+ PROJECTILE_TOUCH(this);
self.use(this, NULL, NULL);
}
-void M_Shambler_Attack_Lightning_Think()
-{SELFPARAM();
+void M_Shambler_Attack_Lightning_Think(entity this)
+{
this.nextthink = time;
if (time > this.cnt)
{
WITHSELF(this, M_Spider_Attack_Web_Explode());
}
-void M_Spider_Attack_Web_Touch()
+void M_Spider_Attack_Web_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
M_Spider_Attack_Web_Explode();
}
-void adaptor_think2use_hittype_splash();
+void adaptor_think2use_hittype_splash(entity this);
void M_Spider_Attack_Web(entity this)
{
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;
+ PROJECTILE_TOUCH(this);
- M_Wyvern_Attack_Fireball_Explode();
+ M_Wyvern_Attack_Fireball_Explode(this);
}
bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
.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);
return;
}
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
//setsize(self, '-2 -2 -2', '2 2 2');
//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;
else
Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_NIX_NEWWEAPON, nix_weapon);
- e.wr_resetplayer(e);
+ e.wr_resetplayer(e, self);
// all weapons must be fully loaded when we spawn
if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
- W_MachineGun_MuzzleFlash();
+ W_MachineGun_MuzzleFlash(actor);
W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
if (autocvar_g_casings >= 2) // casing code
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
}
-METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
+METHOD(HeavyMachineGun, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
else
#endif
#ifdef CSQC
-METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
+METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
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();
- if(WarpZone_Projectile_Touch())
- if(wasfreed(self))
+void W_RocketPropelledChainsaw_Touch (entity this)
+{
+ if(WarpZone_Projectile_Touch(this))
+ if(wasfreed(this))
return;
- W_RocketPropelledChainsaw_Explode();
+ W_RocketPropelledChainsaw_Explode(this);
}
void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
W_PrepareExplosionByDamage(this, attacker, W_RocketPropelledChainsaw_Explode);
}
-void W_RocketPropelledChainsaw_Think()
-{SELFPARAM();
+void W_RocketPropelledChainsaw_Think(entity this)
+{
if(self.cnt <= time)
{
remove(self);
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
-METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
+METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
}
#ifdef CSQC
-METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
+METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
.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);
void Item_ItemsTime_SetTime(entity e, float t);
void Item_ItemsTime_SetTimesForAllPlayers();
-void Item_Respawn ()
-{SELFPARAM();
+void Item_Respawn (entity this)
+{
Item_Show(self, 1);
// this is ugly...
if(self.items == ITEM_Strength.m_itemid)
Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
}
-void Item_RespawnCountdown ()
-{SELFPARAM();
+void Item_RespawnCountdown (entity this)
+{
if(self.count >= ITEM_RESPAWN_TICKS)
{
if(self.waypointsprite_attached)
WaypointSprite_Kill(self.waypointsprite_attached);
- Item_Respawn();
+ Item_Respawn(self);
}
else
{
}
}
-void Item_RespawnThink()
-{SELFPARAM();
+void Item_RespawnThink(entity this)
+{
self.nextthink = time;
if(self.origin != self.oldorigin)
ItemUpdate(self);
if(time >= self.wait)
- Item_Respawn();
+ Item_Respawn(self);
}
void Item_ScheduleRespawnIn(entity e, float t)
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")
Item_ScheduleInitialRespawn(this);
}
}
-void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
void Item_FindTeam(entity this)
{
}
// Savage: used for item garbage-collection
-void RemoveItem()
-{SELFPARAM();
+void RemoveItem(entity this)
+{
if(wasfreed(self) || !self) { return; }
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
remove(self);
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)
e.(regenfield) = max(e.(regenfield), time + regentime);
}
float GiveItems(entity e, float beginarg, float endarg)
-{SELFPARAM();
+{
float got, i, val, op;
float _switchweapon;
string cmd;
POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_MEGAHEALTH, SND_Null);
if(e.superweapons_finished <= 0)
- if(self.weapons & WEPSET_SUPERWEAPONS)
+ if(e.weapons & WEPSET_SUPERWEAPONS)
e.superweapons_finished = autocvar_g_balance_superweapons_time;
if(e.strength_finished <= 0)
void Item_Show (entity e, float mode);
-void Item_Respawn ();
+void Item_Respawn (entity this);
-void Item_RespawnCountdown ();
+void Item_RespawnCountdown(entity this);
void Item_ScheduleRespawnIn(entity e, float t);
void Item_ScheduleRespawn(entity e);
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;
vector p;
vector sz;
vector o;
- o = self.origin;
- sz = self.maxs - self.mins;
- n = doBGMScript(self);
- if(self.absolute == 2)
+ o = this.origin;
+ sz = this.maxs - this.mins;
+ n = doBGMScript(this);
+ if(this.absolute == 2)
{
if(n >= 0)
- n = self.just_toggled ? self.impulse : 0;
+ n = this.just_toggled ? this.impulse : 0;
else
- n = self.impulse * drawframetime;
+ n = this.impulse * drawframetime;
}
else
{
- n *= self.impulse * drawframetime;
- if(self.just_toggled)
+ n *= this.impulse * drawframetime;
+ if(this.just_toggled)
if(n < 1)
n = 1;
}
fail = 0;
for(i = random(); i <= n && fail <= 64*n; ++i)
{
- p = o + self.mins;
+ p = o + this.mins;
p.x += random() * sz.x;
p.y += random() * sz.y;
p.z += random() * sz.z;
- if(WarpZoneLib_BoxTouchesBrush(p, p, self, world))
+ if(WarpZoneLib_BoxTouchesBrush(p, p, this, world))
{
- if(self.movedir != '0 0 0')
+ if(this.movedir != '0 0 0')
{
- traceline(p, p + normalize(self.movedir) * 4096, 0, world);
+ traceline(p, p + normalize(this.movedir) * 4096, 0, world);
p = trace_endpos;
int eff_num;
- if(self.cnt)
- eff_num = self.cnt;
+ if(this.cnt)
+ eff_num = this.cnt;
else
- eff_num = _particleeffectnum(self.mdl);
- __pointparticles(eff_num, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count);
+ eff_num = _particleeffectnum(this.mdl);
+ __pointparticles(eff_num, p, trace_plane_normal * vlen(this.movedir) + this.velocity + randomvec() * this.waterlevel, this.count);
}
else
{
int eff_num;
- if(self.cnt)
- eff_num = self.cnt;
+ if(this.cnt)
+ eff_num = this.cnt;
else
- eff_num = _particleeffectnum(self.mdl);
- __pointparticles(eff_num, p, self.velocity + randomvec() * self.waterlevel, self.count);
+ eff_num = _particleeffectnum(this.mdl);
+ __pointparticles(eff_num, p, this.velocity + randomvec() * this.waterlevel, this.count);
}
- if(self.noise != "")
+ if(this.noise != "")
{
- setorigin(self, p);
- _sound(self, CH_AMBIENT, self.noise, VOL_BASE * self.volume, self.atten);
+ setorigin(this, p);
+ _sound(this, CH_AMBIENT, this.noise, VOL_BASE * this.volume, this.atten);
}
- self.just_toggled = 0;
+ this.just_toggled = 0;
}
- else if(self.absolute)
+ else if(this.absolute)
{
++fail;
--i;
}
}
- setorigin(self, o);
+ setorigin(this, o);
}
void Ent_PointParticles_Remove(entity this)
// 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();
+ PROJECTILE_TOUCH(this);
+ turret_projectile_explode(this);
}
void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
#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;
if (self.pathgoal.enemy)
{
- self.pathcurrent = pathlib_astar(self.pathgoal.origin,self.pathgoal.enemy.origin);
+ self.pathcurrent = pathlib_astar(self, self.pathgoal.origin,self.pathgoal.enemy.origin);
self.pathgoal = self.pathgoal.enemy;
}
}
{
#ifdef EWHEEL_FANCYPATH
- it.pathcurrent = WALKER_PATH(it.origin,e.origin);
+ it.pathcurrent = WALKER_PATH(it, it.origin, e.origin);
it.pathgoal = e;
#else
it.pathcurrent = e;
#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 SVQC
-void W_MachineGun_MuzzleFlash();
+void W_MachineGun_MuzzleFlash(entity actor);
SOUND(MachineGunTurretAttack_FIRE, W_Sound("electro_fire"));
METHOD(MachineGunTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
}
fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
- W_MachineGun_MuzzleFlash();
+ W_MachineGun_MuzzleFlash(actor);
setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire");
}
}
#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;
.float animflag;
.float idletime;
-#define WALKER_PATH(s,e) pathlib_astar(s,e)
+#define WALKER_PATH(this, s, e) pathlib_astar(this, s, e)
float walker_firecheck()
{SELFPARAM();
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);
if (self.pathgoal.enemy)
{
- self.pathcurrent = WALKER_PATH(self.pathgoal.origin,self.pathgoal.enemy.origin);
+ self.pathcurrent = WALKER_PATH(self, self.pathgoal.origin, self.pathgoal.enemy.origin);
self.pathgoal = self.pathgoal.enemy;
}
}
else
{
#ifdef WALKER_FANCYPATHING
- it.pathcurrent = WALKER_PATH(it.origin, e.origin);
+ it.pathcurrent = WALKER_PATH(it, it.origin, e.origin);
it.pathgoal = e;
#else
it.pathcurrent = e;
#ifndef MENUQC
#ifndef CSQC
+entity _wordwrap_buffer_sprint_ent;
void wordwrap_buffer_sprint(string s)
-{SELFPARAM();
+{
wordwrap_buffer = strcat(wordwrap_buffer, s);
if(s == "\n")
{
- sprint(self, wordwrap_buffer);
+ sprint(_wordwrap_buffer_sprint_ent, wordwrap_buffer);
wordwrap_buffer = "";
}
}
-void wordwrap_sprint(string s, float l)
-{SELFPARAM();
+void wordwrap_sprint(entity to, string s, float l)
+{
wordwrap_buffer = "";
+ _wordwrap_buffer_sprint_ent = to;
wordwrap_cb(s, l, wordwrap_buffer_sprint);
+ _wordwrap_buffer_sprint_ent = NULL;
if(wordwrap_buffer != "")
- sprint(self, strcat(wordwrap_buffer, "\n"));
+ sprint(to, strcat(wordwrap_buffer, "\n"));
wordwrap_buffer = "";
return;
}
string wordwrap(string s, float l);
#ifndef MENUQC
#ifndef CSQC
-void wordwrap_sprint(string s, float l);
+void wordwrap_sprint(entity to, string s, float l);
#endif
#endif
void wordwrap_cb(string s, float l, void(string) callback);
}
}
-void vehicles_projectile_explode()
-{SELFPARAM();
+void vehicles_projectile_explode(entity this)
+{
if(self.owner && other != world)
{
if(other == self.owner.vehicle)
return;
}
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
self.event_damage = func_null;
RadiusDamage (self, self.realowner, self.shot_dmg, 0, self.shot_radius, self, world, self.shot_force, self.totalfrags, other);
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;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
setthink(self, raptor_bomblet_boom);
self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay;
}
-void raptor_bomb_burst()
-{SELFPARAM();
+void raptor_bomb_burst(entity this)
+{
if(self.cnt > time)
if(autocvar_g_vehicle_raptor_bomblet_alt)
{
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
ATTRIB(Weapon, m_pickup, entity, NULL);
/** (SERVER) setup weapon data */
- METHOD(Weapon, wr_setup, void(Weapon this)) {}
+ METHOD(Weapon, wr_setup, void(Weapon this, entity actor)) {}
/** (SERVER) logic to run every frame */
METHOD(Weapon, wr_think, void(Weapon this, entity actor, .entity weaponentity, int fire)) {}
/** (SERVER) checks ammo for weapon primary */
/** (SERVER) checks ammo for weapon second */
METHOD(Weapon, wr_checkammo2, bool(Weapon this, entity actor)) {return false;}
/** (SERVER) runs bot aiming code for this weapon */
- METHOD(Weapon, wr_aim, void(Weapon this)) {}
+ METHOD(Weapon, wr_aim, void(Weapon this, entity actor)) {}
/** (BOTH) precaches models/sounds used by this weapon, also sets up weapon properties */
METHOD(Weapon, wr_init, void(Weapon this)) {}
/** (SERVER) notification number for suicide message (may inspect w_deathtype for details) */
/** (SERVER) handles reloading for weapon */
METHOD(Weapon, wr_reload, void(Weapon this, entity actor, .entity weaponentity)) {}
/** (SERVER) clears fields that the weapon may use */
- METHOD(Weapon, wr_resetplayer, void(Weapon this)) {}
+ METHOD(Weapon, wr_resetplayer, void(Weapon this, entity actor)) {}
/** (CLIENT) impact effect for weapon explosion */
- METHOD(Weapon, wr_impacteffect, void(Weapon this)) {}
+ METHOD(Weapon, wr_impacteffect, void(Weapon this, entity actor)) {}
/** (SERVER) called whenever a player dies */
- METHOD(Weapon, wr_playerdeath, void(Weapon this)) {}
+ METHOD(Weapon, wr_playerdeath, void(Weapon this, entity actor)) {}
/** (SERVER) logic to run when weapon is lost */
- METHOD(Weapon, wr_gonethink, void(Weapon this)) {}
+ METHOD(Weapon, wr_gonethink, void(Weapon this, entity actor)) {}
/** (ALL) dump weapon cvars to config in data directory (see: sv_cmd dumpweapons) */
METHOD(Weapon, wr_config, void(Weapon this)) {}
/** (CLIENT) weapon specific zoom reticle */
/** (CLIENT) weapon specific glow */
METHOD(Weapon, wr_glow, vector(Weapon this)) { return '0 0 0'; }
/** (SERVER) the weapon is dropped */
- METHOD(Weapon, wr_drop, void(Weapon this)) {}
+ METHOD(Weapon, wr_drop, void(Weapon this, entity actor)) {}
/** (SERVER) a weapon is picked up */
- METHOD(Weapon, wr_pickup, void(Weapon this)) {}
+ METHOD(Weapon, wr_pickup, void(Weapon this, entity actor)) {}
/** (SERVER) update cvar based properties */
METHOD(Weapon, wr_update, void(Weapon this)) {}
METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) {
//dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
}
-void W_Arc_Bolt_Explode()
-{SELFPARAM();
+void W_Arc_Bolt_Explode(entity this)
+{
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), world, world, WEP_CVAR(arc, bolt_force), self.projectiledeathtype, other);
void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Arc_Bolt_Explode());
+ WITHSELF(this, W_Arc_Bolt_Explode(this));
}
void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
W_PrepareExplosionByDamage(this, attacker, getthink(this));
}
-void W_Arc_Bolt_Touch()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_Arc_Bolt_Touch(entity this)
+{
+ PROJECTILE_TOUCH(this);
self.use(this, NULL, NULL);
}
-void W_Arc_Attack_Bolt(Weapon thiswep)
-{SELFPARAM();
+void W_Arc_Attack_Bolt(Weapon thiswep, entity actor)
+{
+ entity this = actor;
entity missile;
W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo));
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);
self.nextthink = time;
}
-void W_Arc_Beam(float burst)
-{SELFPARAM();
+void W_Arc_Beam(float burst, entity actor)
+{entity this = actor;
// only play fire sound if 1 sec has passed since player let go the fire button
if(time - self.beam_prev > 1)
beam.beam_bursting = burst;
Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
- WITHSELF(beam, getthink(beam)());
+ WITHSELF(beam, getthink(beam)(beam));
}
-
-void Arc_Smoke()
-{SELFPARAM();
+void Arc_Smoke(entity actor)
+{entity this = actor;
makevectors(self.v_angle);
W_SetupShot_Range(self,true,0,SND_Null,0,0,0);
}
}
-METHOD(Arc, wr_aim, void(entity thiswep))
+METHOD(Arc, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(WEP_CVAR(arc, beam_botaimspeed))
{
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
Arc_Player_SetHeat(actor);
- Arc_Smoke();
+ Arc_Smoke(actor);
bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
{
if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
{
- W_Arc_Beam(boolean(beam_fire2));
+ W_Arc_Beam(boolean(beam_fire2), actor);
if(!actor.arc_BUTTON_ATCK_prev)
{
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
{
- W_Arc_Attack_Bolt(thiswep);
+ W_Arc_Attack_Bolt(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
}
}
else
return WEAPON_ARC_MURDER;
}
-METHOD(Arc, wr_drop, void(entity thiswep))
+METHOD(Arc, wr_drop, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
weapon_dropevent_item.arc_overheat = self.arc_overheat;
weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
self.arc_overheat = 0;
self.arc_cooldown = 0;
}
-METHOD(Arc, wr_pickup, void(entity thiswep))
+METHOD(Arc, wr_pickup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if ( !client_hasweapon(self, thiswep, false, false) &&
weapon_dropevent_item.arc_overheat > time )
{
#ifdef CSQC
bool autocvar_cl_arcbeam_teamcolor = true;
-METHOD(Arc, wr_impacteffect, void(entity thiswep))
+METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(w_deathtype & HITTYPE_SECONDARY)
{
vector org2;
spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); }
spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
-void W_Blaster_Touch()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_Blaster_Touch(entity this)
+{
+ PROJECTILE_TOUCH(this);
self.event_damage = func_null;
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));
}
}
-METHOD(Blaster, wr_aim, void(entity thiswep))
+METHOD(Blaster, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(WEP_CVAR(blaster, secondary))
{
if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
}
}
-METHOD(Blaster, wr_setup, void(entity thiswep))
+METHOD(Blaster, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.ammo_field = ammo_none;
}
#endif
#ifdef CSQC
-METHOD(Blaster, wr_impacteffect, void(entity thiswep))
+METHOD(Blaster, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
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);
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
float a;
a = bound(0, 1 - (time - self.fade_time) * self.fade_rate, 1);
// CSQCProjectile(proj, true, PROJECTILE_CRYLINK, true);
}
-void W_Crylink_Fadethink()
-{SELFPARAM();
+void W_Crylink_Fadethink(entity this)
+{
W_Crylink_Dequeue(self);
remove(self);
}
-void W_Crylink_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Crylink_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
float counter, shots;
entity proj, prevproj, firstproj;
vector s;
}
}
-void W_Crylink_Attack2(Weapon thiswep)
-{SELFPARAM();
+void W_Crylink_Attack2(Weapon thiswep, entity actor)
+{entity this = actor;
float counter, shots;
entity proj, prevproj, firstproj;
vector s;
}
}
-METHOD(Crylink, wr_aim, void(entity thiswep))
+METHOD(Crylink, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(random() < 0.10)
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
else
if(actor.crylink_waitrelease != 1)
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
{
- W_Crylink_Attack(thiswep);
+ W_Crylink_Attack(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
}
}
if(actor.crylink_waitrelease != 2)
if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
{
- W_Crylink_Attack2(thiswep);
+ W_Crylink_Attack2(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
}
}
}
METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD);
+ W_Reload(actor, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD);
}
METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep))
{
}
#endif
#ifdef CSQC
-METHOD(Crylink, wr_impacteffect, void(entity thiswep))
+METHOD(Crylink, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 2;
if(w_deathtype & HITTYPE_SECONDARY)
.entity lastrocket;
-void W_Devastator_Unregister()
-{SELFPARAM();
+void W_Devastator_Unregister(entity this)
+{
if(self.realowner && self.realowner.lastrocket == self)
{
self.realowner.lastrocket = world;
}
}
-void W_Devastator_Explode()
-{SELFPARAM();
- W_Devastator_Unregister();
+void W_Devastator_Explode(entity this)
+{
+ W_Devastator_Unregister(self);
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
remove(self);
}
-void W_Devastator_DoRemoteExplode(.entity weaponentity)
-{SELFPARAM();
- W_Devastator_Unregister();
+void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity)
+{
+ W_Devastator_Unregister(self);
self.event_damage = func_null;
self.takedamage = DAMAGE_NO;
remove(self);
}
-void W_Devastator_RemoteExplode(.entity weaponentity)
-{SELFPARAM();
+void W_Devastator_RemoteExplode(entity this, .entity weaponentity)
+{
if(!IS_DEAD(self.realowner))
if(self.realowner.lastrocket)
{
: (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device
)
{
- W_Devastator_DoRemoteExplode(weaponentity);
+ W_Devastator_DoRemoteExplode(self, weaponentity);
}
}
}
// 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;
}
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
if(self.rl_detonate_later)
- W_Devastator_RemoteExplode(weaponentity);
+ W_Devastator_RemoteExplode(self, weaponentity);
}
if(self.csqcprojectile_clientanimate == 0)
UpdateCSQCProjectile(self);
}
-void W_Devastator_Touch()
-{SELFPARAM();
- if(WarpZone_Projectile_Touch())
+void W_Devastator_Touch(entity this)
+{
+ if(WarpZone_Projectile_Touch(this))
{
- if(wasfreed(self))
- W_Devastator_Unregister();
+ if(wasfreed(this))
+ W_Devastator_Unregister(this);
return;
}
- W_Devastator_Unregister();
- W_Devastator_Explode();
+ W_Devastator_Unregister(this);
+ W_Devastator_Explode(this);
}
void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode);
}
-void W_Devastator_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Devastator_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
entity missile;
entity flash;
}
#if 0
-METHOD(Devastator, wr_aim, void(entity thiswep))
+METHOD(Devastator, wr_aim, void(entity thiswep, entity actor))
{
+ entity this = actor;
// aim and decide to fire if appropriate
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
}
}
#else
-METHOD(Devastator, wr_aim, void(entity thiswep))
+METHOD(Devastator, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
// aim and decide to fire if appropriate
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
if(actor.rl_release || WEP_CVAR(devastator, guidestop))
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
{
- W_Devastator_Attack(thiswep);
+ W_Devastator_Attack(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
actor.rl_release = 0;
}
}
}
}
-METHOD(Devastator, wr_setup, void(entity thiswep))
+METHOD(Devastator, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.rl_release = 1;
}
METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor))
{
return false;
}
-METHOD(Devastator, wr_resetplayer, void(entity thiswep))
+METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
self.rl_release = 0;
}
METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, WEP_CVAR(devastator, ammo), SND_RELOAD);
+ W_Reload(actor, WEP_CVAR(devastator, ammo), SND_RELOAD);
}
METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(Devastator, wr_impacteffect, void(entity thiswep))
+METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
#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;
remove(self);
}
-void W_Electro_Explode()
-{SELFPARAM();
+void W_Electro_Explode(entity this)
+{
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
void W_Electro_Explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Electro_Explode());
+ WITHSELF(this, W_Electro_Explode(this));
}
-void W_Electro_TouchExplode()
+void W_Electro_TouchExplode(entity this)
{
- PROJECTILE_TOUCH;
- W_Electro_Explode();
+ PROJECTILE_TOUCH(this);
+ W_Electro_Explode(this);
}
-void W_Electro_Bolt_Think()
-{SELFPARAM();
+void W_Electro_Bolt_Think(entity this)
+{
if(time >= self.ltime)
{
this.use(this, NULL, NULL);
else { self.nextthink = self.ltime; }
}
-void W_Electro_Attack_Bolt(Weapon thiswep)
-{SELFPARAM();
+void W_Electro_Attack_Bolt(Weapon thiswep, entity actor)
+{entity this = actor;
entity proj;
W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(electro, ammo));
MUTATOR_CALLHOOK(EditProjectile, self, proj);
}
-void W_Electro_Orb_Touch()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_Electro_Orb_Touch(entity this)
+{
+ PROJECTILE_TOUCH(this);
if(other.takedamage == DAMAGE_AIM)
- { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(); } }
+ { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(self); } }
else
{
//UpdateCSQCProjectile(self);
}
}
-void W_Electro_Attack_Orb(Weapon thiswep)
-{SELFPARAM();
+void W_Electro_Attack_Orb(Weapon thiswep, entity actor)
+{entity this = actor;
W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(electro, ammo));
W_SetupShot_ProjectileSize(
}
void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
-{SELFPARAM();
+{entity this = actor;
if(self.electro_count > 1)
if(PHYS_INPUT_BUTTON_ATCK2(self))
if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1))
{
- W_Electro_Attack_Orb(WEP_ELECTRO);
+ W_Electro_Attack_Orb(WEP_ELECTRO, actor);
self.electro_count -= 1;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
return;
.float bot_secondary_electromooth;
-METHOD(Electro, wr_aim, void(entity thiswep))
+METHOD(Electro, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
if(self.bot_secondary_electromooth == 0)
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
{
- W_Electro_Attack_Bolt(thiswep);
+ W_Electro_Attack_Bolt(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
}
if(time >= actor.electro_secondarytime)
if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
{
- W_Electro_Attack_Orb(thiswep);
+ W_Electro_Attack_Orb(thiswep, actor);
actor.electro_count = WEP_CVAR_SEC(electro, count);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
}
return ammo_amount;
}
-METHOD(Electro, wr_resetplayer, void(entity thiswep))
+METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.electro_secondarytime = time;
}
METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);
+ W_Reload(actor, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);
}
METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(Electro, wr_impacteffect, void(entity thiswep))
+METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 6;
if(w_deathtype & HITTYPE_SECONDARY)
#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();
+ PROJECTILE_TOUCH(this);
+ W_Fireball_Explode(this);
}
-void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime)
-{SELFPARAM();
+void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float edgedamage, float burntime)
+{
entity e;
float d;
vector p;
}
}
-void W_Fireball_Think()
-{SELFPARAM();
+void W_Fireball_Think(entity this)
+{
if(time > self.pushltime)
{
self.cnt = 1;
self.projectiledeathtype |= HITTYPE_SPLASH;
- W_Fireball_Explode();
+ W_Fireball_Explode(this);
return;
}
- W_Fireball_LaserPlay(0.1, WEP_CVAR_PRI(fireball, laserradius), WEP_CVAR_PRI(fireball, laserdamage), WEP_CVAR_PRI(fireball, laseredgedamage), WEP_CVAR_PRI(fireball, laserburntime));
+ W_Fireball_LaserPlay(self, 0.1, WEP_CVAR_PRI(fireball, laserradius), WEP_CVAR_PRI(fireball, laserdamage), WEP_CVAR_PRI(fireball, laseredgedamage), WEP_CVAR_PRI(fireball, laserburntime));
self.nextthink = time + 0.1;
}
}
}
-void W_Fireball_Attack1()
-{SELFPARAM();
+void W_Fireball_Attack1(entity actor)
+{entity this = actor;
entity proj;
W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
MUTATOR_CALLHOOK(EditProjectile, self, proj);
}
-void W_Fireball_AttackEffect(float i, vector f_diff)
-{SELFPARAM();
- W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0);
+void W_Fireball_AttackEffect(entity actor, float i, vector f_diff)
+{
+ W_SetupShot_ProjectileSize(actor, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0);
w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
}
void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- W_Fireball_Attack1();
+ W_Fireball_Attack1(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), w_ready);
}
void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- W_Fireball_AttackEffect(0, '+1.25 +3.75 0');
+ W_Fireball_AttackEffect(actor, 0, '+1.25 +3.75 0');
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame4);
}
void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- W_Fireball_AttackEffect(0, '-1.25 +3.75 0');
+ W_Fireball_AttackEffect(actor, 0, '-1.25 +3.75 0');
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame3);
}
void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- W_Fireball_AttackEffect(1, '+1.25 -3.75 0');
+ W_Fireball_AttackEffect(actor, 1, '+1.25 -3.75 0');
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame2);
}
void W_Fireball_Attack1_Frame0(Weapon thiswep, entity actor, .entity weaponentity, int fire)
-{SELFPARAM();
- W_Fireball_AttackEffect(0, '-1.25 -3.75 0');
- sound(self, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
+{
+ W_Fireball_AttackEffect(actor, 0, '-1.25 -3.75 0');
+ sound(actor, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1);
}
-void W_Fireball_Firemine_Think()
-{SELFPARAM();
+void W_Fireball_Firemine_Think(entity this)
+{
if(time > self.pushltime)
{
remove(self);
self.cnt = 0;
}
- W_Fireball_LaserPlay(0.1, WEP_CVAR_SEC(fireball, laserradius), WEP_CVAR_SEC(fireball, laserdamage), WEP_CVAR_SEC(fireball, laseredgedamage), WEP_CVAR_SEC(fireball, laserburntime));
+ W_Fireball_LaserPlay(self, 0.1, WEP_CVAR_SEC(fireball, laserradius), WEP_CVAR_SEC(fireball, laserdamage), WEP_CVAR_SEC(fireball, laseredgedamage), WEP_CVAR_SEC(fireball, laserburntime));
self.nextthink = time + 0.1;
}
-void W_Fireball_Firemine_Touch()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_Fireball_Firemine_Touch(entity this)
+{
+ PROJECTILE_TOUCH(this);
if(other.takedamage == DAMAGE_AIM)
if(Fire_AddDamage(other, self.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), self.projectiledeathtype) >= 0)
{
self.projectiledeathtype |= HITTYPE_BOUNCE;
}
-void W_Fireball_Attack2()
-{SELFPARAM();
+void W_Fireball_Attack2(entity actor)
+{entity this = actor;
entity proj;
vector f_diff;
float c;
MUTATOR_CALLHOOK(EditProjectile, self, proj);
}
-METHOD(Fireball, wr_aim, void(entity thiswep))
+METHOD(Fireball, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
PHYS_INPUT_BUTTON_ATCK(self) = false;
PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(self.bot_primary_fireballmooth == 0)
{
if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(fireball, refire)))
{
- W_Fireball_Attack2();
+ W_Fireball_Attack2(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(fireball, animtime), w_ready);
}
}
}
-METHOD(Fireball, wr_setup, void(entity thiswep))
+METHOD(Fireball, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.ammo_field = ammo_none;
}
METHOD(Fireball, wr_checkammo1, bool(entity thiswep, entity actor))
{
return true; // fireball has infinite ammo
}
-METHOD(Fireball, wr_resetplayer, void(entity thiswep))
+METHOD(Fireball, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.fireball_primarytime = time;
}
METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep))
#endif
#ifdef CSQC
-METHOD(Fireball, wr_impacteffect, void(entity thiswep))
+METHOD(Fireball, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
if(w_deathtype & HITTYPE_SECONDARY)
{
// NO bounce protection, as bounces are limited!
-void W_Hagar_Explode()
-{SELFPARAM();
+void W_Hagar_Explode(entity this)
+{
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), world, world, WEP_CVAR_PRI(hagar, force), self.projectiledeathtype, other);
void W_Hagar_Explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Hagar_Explode());
+ WITHSELF(this, W_Hagar_Explode(this));
}
-void W_Hagar_Explode2()
-{SELFPARAM();
+void W_Hagar_Explode2(entity this)
+{
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), world, world, WEP_CVAR_SEC(hagar, force), self.projectiledeathtype, other);
void W_Hagar_Explode2_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Hagar_Explode2());
+ WITHSELF(this, W_Hagar_Explode2(this));
}
void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
W_PrepareExplosionByDamage(this, attacker, getthink(this));
}
-void W_Hagar_Touch()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_Hagar_Touch(entity this)
+{
+ PROJECTILE_TOUCH(this);
this.use(this, NULL, NULL);
}
-void W_Hagar_Touch2()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_Hagar_Touch2(entity this)
+{
+ PROJECTILE_TOUCH(this);
if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
this.use(this, NULL, NULL);
}
}
-void W_Hagar_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Hagar_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
entity missile;
W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hagar, ammo));
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
-void W_Hagar_Attack2(Weapon thiswep)
-{SELFPARAM();
+void W_Hagar_Attack2(Weapon thiswep, entity actor)
+{entity this = actor;
entity missile;
W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo));
}
.float hagar_loadstep, hagar_loadblock, hagar_loadbeep, hagar_warning;
-void W_Hagar_Attack2_Load_Release(.entity weaponentity)
-{SELFPARAM();
+void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
+{entity this = actor;
// time to release the rockets we've loaded
entity missile;
self.hagar_load = 0;
}
-void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
-{SELFPARAM();
+void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
+{entity this = actor;
// loadable hagar secondary attack, must always run each frame
if(time < game_starttime)
if(!PHYS_INPUT_BUTTON_ATCK2(self) || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
{
self.(weaponentity).state = WS_READY;
- W_Hagar_Attack2_Load_Release(weaponentity);
+ W_Hagar_Attack2_Load_Release(self, weaponentity);
}
}
else
return;
}
- W_Hagar_Attack(thiswep);
+ W_Hagar_Attack(thiswep, actor);
int slot = weaponslot(weaponentity);
ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor();
weapon_thinkf(actor, weaponentity, theframe, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto);
}
-METHOD(Hagar, wr_aim, void(entity thiswep))
+METHOD(Hagar, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(random()>0.15)
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
if(loadable_secondary)
- W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
+ W_Hagar_Attack2_Load(thiswep, actor, weaponentity); // must always run each frame
if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
thiswep.wr_reload(thiswep, actor, weaponentity);
}
{
if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
{
- W_Hagar_Attack2(thiswep);
+ W_Hagar_Attack2(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
}
}
}
-METHOD(Hagar, wr_gonethink, void(entity thiswep))
+METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor))
{
- SELFPARAM();
// we lost the weapon and want to prepare switching away
- if(self.hagar_load)
+ if(actor.hagar_load)
{
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
- self.(weaponentity).state = WS_READY;
- W_Hagar_Attack2_Load_Release(weaponentity);
+ actor.(weaponentity).state = WS_READY;
+ W_Hagar_Attack2_Load_Release(actor, weaponentity);
}
}
-METHOD(Hagar, wr_setup, void(entity thiswep))
+METHOD(Hagar, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.hagar_loadblock = false;
if(self.hagar_load)
ammo_amount += actor.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
return ammo_amount;
}
-METHOD(Hagar, wr_resetplayer, void(entity thiswep))
+METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.hagar_load = 0;
}
-METHOD(Hagar, wr_playerdeath, void(entity thiswep))
+METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor))
{
- SELFPARAM();
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
// if we have any rockets loaded when we die, release them
- if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
- W_Hagar_Attack2_Load_Release(weaponentity);
+ if(actor.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
+ W_Hagar_Attack2_Load_Release(actor, weaponentity);
}
METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
+ entity this = actor;
if(!self.hagar_load) // require releasing loaded rockets first
W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD);
}
#endif
#ifdef CSQC
-METHOD(Hagar, wr_impacteffect, void(entity thiswep))
+METHOD(Hagar, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
#ifdef SVQC
spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); }
-void W_HLAC_Touch()
-{SELFPARAM();
+void W_HLAC_Touch(entity this)
+{
float isprimary;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
self.event_damage = func_null;
remove(self);
}
-void W_HLAC_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_HLAC_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
entity missile;
float spread;
//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);
MUTATOR_CALLHOOK(EditProjectile, self, missile);
}
-void W_HLAC_Attack2()
-{SELFPARAM();
+void W_HLAC_Attack2(entity actor)
+{entity this = actor;
entity missile;
float spread;
//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);
int slot = weaponslot(weaponentity);
ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
- W_HLAC_Attack(WEP_HLAC);
+ W_HLAC_Attack(WEP_HLAC, actor);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
}
}
}
-void W_HLAC_Attack2_Frame(Weapon thiswep)
-{SELFPARAM();
+void W_HLAC_Attack2_Frame(Weapon thiswep, entity actor)
+{entity this = actor;
float i;
W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hlac, ammo));
for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
- W_HLAC_Attack2();
+ W_HLAC_Attack2(actor);
if(!autocvar_g_norecoil)
{
}
}
-METHOD(HLAC, wr_aim, void(entity thiswep))
+METHOD(HLAC, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
}
METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
{
actor.misc_bulletcounter = 0;
- W_HLAC_Attack(thiswep);
+ W_HLAC_Attack(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
}
}
{
if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
{
- W_HLAC_Attack2_Frame(thiswep);
+ W_HLAC_Attack2_Frame(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
}
}
}
METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD);
+ W_Reload(actor, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD);
}
METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(HLAC, wr_impacteffect, void(entity thiswep))
+METHOD(HLAC, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
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();
- PROJECTILE_TOUCH;
+void W_Hook_Touch2(entity this)
+{
+ PROJECTILE_TOUCH(this);
this.use(this, NULL, NULL);
}
actor.hook_state &= ~HOOK_REMOVING;
}
}
-METHOD(Hook, wr_setup, void(entity thiswep))
+METHOD(Hook, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
}
METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor))
// infinite ammo for now
return true; // actor.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
}
-METHOD(Hook, wr_resetplayer, void(entity thiswep))
+METHOD(Hook, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
RemoveGrapplingHook(self);
self.hook_time = 0;
self.hook_refire = time;
#endif
#ifdef CSQC
-METHOD(Hook, wr_impacteffect, void(entity thiswep))
+METHOD(Hook, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
}
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;
}
-void W_MachineGun_MuzzleFlash()
-{SELFPARAM();
+void W_MachineGun_MuzzleFlash(entity actor)
+{entity this = actor;
if(self.muzzle_flash == world)
self.muzzle_flash = spawn();
self.muzzle_flash.owner = self.muzzle_flash.realowner = self;
}
-void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity)
-{SELFPARAM();
+void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity)
+{entity this = actor;
W_SetupShot(self, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
if(!autocvar_g_norecoil)
{
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
- W_MachineGun_MuzzleFlash();
+ W_MachineGun_MuzzleFlash(self);
W_AttachToShotorg(self, self.muzzle_flash, '5 0 0');
// casing code
return;
}
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
- W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity);
+ W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, actor, weaponentity);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
}
else
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
- W_MachineGun_MuzzleFlash();
+ W_MachineGun_MuzzleFlash(actor);
W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
if(autocvar_g_casings >= 2) // casing code
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
- W_MachineGun_MuzzleFlash();
+ W_MachineGun_MuzzleFlash(actor);
W_AttachToShotorg(actor, actor.muzzle_flash, '5 0 0');
if(autocvar_g_casings >= 2) // casing code
}
-METHOD(MachineGun, wr_aim, void(entity thiswep))
+METHOD(MachineGun, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
else
if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
{
actor.misc_bulletcounter = 1;
- W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, weaponentity); // sets attack_finished
+ W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, actor, weaponentity); // sets attack_finished
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
}
if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
{
actor.misc_bulletcounter = 1;
- W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, weaponentity); // sets attack_finished
+ W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, actor, weaponentity); // sets attack_finished
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
}
}
}
METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD);
+ W_Reload(actor, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD);
}
METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
+METHOD(MachineGun, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
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;
#ifdef SVQC
spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(this, WEP_MINE_LAYER); }
-void W_MineLayer_Stick(entity to)
-{SELFPARAM();
+void W_MineLayer_Stick(entity this, entity to)
+{
spamsound(self, CH_SHOTS, SND(MINE_STICK), VOL_BASE, ATTN_NORM);
// in order for mines to face properly when sticking to the ground, they must be a server side entity rather than a csqc projectile
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))
remove(self);
}
-void W_MineLayer_DoRemoteExplode()
-{SELFPARAM();
+void W_MineLayer_DoRemoteExplode(entity this)
+{
self.event_damage = func_null;
self.takedamage = DAMAGE_NO;
remove(self);
}
-void W_MineLayer_RemoteExplode()
-{SELFPARAM();
+void W_MineLayer_RemoteExplode(entity this)
+{
if(!IS_DEAD(self.realowner))
if((self.spawnshieldtime >= 0)
? (time >= self.spawnshieldtime) // timer
: (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(minelayer, remote_radius))) // safety device
)
{
- W_MineLayer_DoRemoteExplode();
+ W_MineLayer_DoRemoteExplode(self);
}
}
-void W_MineLayer_ProximityExplode()
-{SELFPARAM();
+void W_MineLayer_ProximityExplode(entity this)
+{
// make sure no friend is in the mine's radius. If there is any, explosion is delayed until he's at a safe distance
if(WEP_CVAR(minelayer, protection) && self.mine_explodeanyway == 0)
{
}
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;
}
// explode if it's time to
if(self.mine_time && time >= self.mine_time)
{
- W_MineLayer_ProximityExplode();
+ W_MineLayer_ProximityExplode(self);
return;
}
if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
if(!IS_DEAD(self.realowner))
if(self.minelayer_detonate)
- W_MineLayer_RemoteExplode();
+ W_MineLayer_RemoteExplode(self);
}
-void W_MineLayer_Touch()
-{SELFPARAM();
+void W_MineLayer_Touch(entity this)
+{
if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
return; // we're already a stuck mine, why do we get called? TODO does this even happen?
- if(WarpZone_Projectile_Touch())
+ if(WarpZone_Projectile_Touch(self))
{
if(wasfreed(self))
self.realowner.minelayer_mines -= 1;
}
else
{
- W_MineLayer_Stick(other);
+ W_MineLayer_Stick(self, other);
}
}
W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode);
}
-void W_MineLayer_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_MineLayer_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
entity mine;
entity flash;
return minfound;
}
-METHOD(MineLayer, wr_aim, void(entity thiswep))
+METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
// aim and decide to fire if appropriate
if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
PHYS_INPUT_BUTTON_ATCK(self) = false;
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(minelayer, refire)))
{
- W_MineLayer_Attack(thiswep);
+ W_MineLayer_Attack(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
}
}
else
return false;
}
-METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
+METHOD(MineLayer, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
- self.minelayer_mines = 0;
+ actor.minelayer_mines = 0;
}
METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, WEP_CVAR(minelayer, ammo), SND_RELOAD);
+ W_Reload(actor, WEP_CVAR(minelayer, ammo), SND_RELOAD);
}
METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
+METHOD(MineLayer, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(this, WEP_MORTAR); }
spawnfunc(weapon_grenadelauncher) { spawnfunc_weapon_mortar(this); }
-void W_Mortar_Grenade_Explode()
-{SELFPARAM();
+void W_Mortar_Grenade_Explode(entity this)
+{
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
void W_Mortar_Grenade_Explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Mortar_Grenade_Explode());
+ WITHSELF(this, W_Mortar_Grenade_Explode(this));
}
-void W_Mortar_Grenade_Explode2()
-{SELFPARAM();
+void W_Mortar_Grenade_Explode2(entity this)
+{
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_Mortar_Grenade_Explode2());
+ WITHSELF(this, W_Mortar_Grenade_Explode2(this));
}
void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
}
-void W_Mortar_Grenade_Think1()
-{SELFPARAM();
+void W_Mortar_Grenade_Think1(entity this)
+{
self.nextthink = time;
if(time > self.cnt)
{
other = world;
self.projectiledeathtype |= HITTYPE_BOUNCE;
- W_Mortar_Grenade_Explode();
+ W_Mortar_Grenade_Explode(self);
return;
}
if(self.gl_detonate_later && self.gl_bouncecnt >= WEP_CVAR_PRI(mortar, remote_minbouncecnt))
- W_Mortar_Grenade_Explode();
+ W_Mortar_Grenade_Explode(self);
}
-void W_Mortar_Grenade_Touch1()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_Mortar_Grenade_Touch1(entity this)
+{
+ PROJECTILE_TOUCH(this);
if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
this.use(this, NULL, NULL);
}
}
-void W_Mortar_Grenade_Touch2()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_Mortar_Grenade_Touch2(entity this)
+{
+ PROJECTILE_TOUCH(this);
if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
this.use(this, NULL, NULL);
}
}
-void W_Mortar_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Mortar_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
entity gren;
W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(mortar, ammo));
MUTATOR_CALLHOOK(EditProjectile, self, gren);
}
-void W_Mortar_Attack2(Weapon thiswep)
-{SELFPARAM();
+void W_Mortar_Attack2(Weapon thiswep, entity actor)
+{entity this = actor;
entity gren;
W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(mortar, ammo));
.float bot_secondary_grenademooth;
-METHOD(Mortar, wr_aim, void(entity thiswep))
+METHOD(Mortar, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
PHYS_INPUT_BUTTON_ATCK(self) = false;
PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
{
- W_Mortar_Attack(thiswep);
+ W_Mortar_Attack(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(mortar, animtime), w_ready);
}
}
}
else if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(mortar, refire)))
{
- W_Mortar_Attack2(thiswep);
+ W_Mortar_Attack2(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(mortar, animtime), w_ready);
}
}
}
METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO
+ W_Reload(actor, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO
}
METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(Mortar, wr_impacteffect, void(entity thiswep))
+METHOD(Mortar, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
FOREACH_CLIENT(IS_PLAYER(it), it.porto_forbidden = max(0, it.porto_forbidden - 1));
}
-void W_Porto_Success()
-{SELFPARAM();
+void W_Porto_Success(entity this)
+{
if(self.realowner == world)
{
objerror("Cannot succeed successfully: no owner\n");
}
string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
-void W_Porto_Fail(float failhard)
-{SELFPARAM();
- if(self.realowner == world)
+void W_Porto_Fail(entity this, float failhard)
+{
+ if(this.realowner == world)
{
objerror("Cannot fail successfully: no owner\n");
return;
}
// no portals here!
- if(self.cnt < 0)
+ if(this.cnt < 0)
{
- Portal_ClearWithID(self.realowner, self.portal_id);
+ Portal_ClearWithID(this.realowner, this.portal_id);
}
- self.realowner.porto_current = world;
+ this.realowner.porto_current = world;
- if(self.cnt < 0 && !failhard && self.realowner.playerid == self.playerid && !IS_DEAD(self.realowner) && !(self.realowner.weapons & WEPSET(PORTO)))
+ if(this.cnt < 0 && !failhard && this.realowner.playerid == this.playerid && !IS_DEAD(this.realowner) && !(this.realowner.weapons & WEPSET(PORTO)))
{
- setsize(self, '-16 -16 0', '16 16 32');
- setorigin(self, self.origin + trace_plane_normal);
- if(move_out_of_solid(self))
+ setsize(this, '-16 -16 0', '16 16 32');
+ setorigin(this, this.origin + trace_plane_normal);
+ if(move_out_of_solid(this))
{
- self.flags = FL_ITEM;
- self.velocity = trigger_push_calculatevelocity(self.origin, self.realowner, 128);
- tracetoss(self, self);
- if(vdist(trace_endpos - self.realowner.origin, <, 128))
+ this.flags = FL_ITEM;
+ this.velocity = trigger_push_calculatevelocity(this.origin, this.realowner, 128);
+ tracetoss(this, this);
+ if(vdist(trace_endpos - this.realowner.origin, <, 128))
{
- W_ThrowNewWeapon(self.realowner, WEP_PORTO.m_id, 0, self.origin, self.velocity);
- Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_FAILED);
+ W_ThrowNewWeapon(this.realowner, WEP_PORTO.m_id, 0, this.origin, this.velocity);
+ Send_Notification(NOTIF_ONE, this.realowner, MSG_CENTER, CENTER_PORTO_FAILED);
}
}
}
- remove(self);
+ remove(this);
}
void W_Porto_Remove(entity p)
{
if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
{
- WITHSELF(p.porto_current, W_Porto_Fail(1));
+ WITHSELF(p.porto_current, W_Porto_Fail(p.porto_current, 1));
}
}
-void W_Porto_Think()
-{SELFPARAM();
+void W_Porto_Think(entity this)
+{
trace_plane_normal = '0 0 0';
if(self.realowner.playerid != self.playerid)
remove(self);
else
- W_Porto_Fail(0);
+ W_Porto_Fail(self, 0);
}
-void W_Porto_Touch()
-{SELFPARAM();
+void W_Porto_Touch(entity this)
+{
vector norm;
// do not use PROJECTILE_TOUCH here
else if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{
sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
- W_Porto_Fail(0);
+ W_Porto_Fail(self, 0);
if(self.cnt < 0)
Portal_ClearAll_PortalsOnly(self.realowner);
}
sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN);
- W_Porto_Success();
+ W_Porto_Success(self);
}
else
{
sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
- W_Porto_Fail(0);
+ W_Porto_Fail(self, 0);
}
}
else if(self.cnt == 1)
sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT);
- W_Porto_Success();
+ W_Porto_Success(self);
}
else
{
sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
- W_Porto_Fail(0);
+ W_Porto_Fail(self, 0);
}
}
else if(self.effects & EF_RED)
sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
Portal_ClearAll_PortalsOnly(self.realowner);
- W_Porto_Fail(0);
+ W_Porto_Fail(self, 0);
}
}
else
sound(self, CH_SHOTS, SND_PORTO_CREATE, VOL_BASE, ATTEN_NORM);
trace_plane_normal = norm;
Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT);
- W_Porto_Success();
+ W_Porto_Success(self);
}
else
{
sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
Portal_ClearAll_PortalsOnly(self.realowner);
- W_Porto_Fail(0);
+ W_Porto_Fail(self, 0);
}
}
else
{
sound(self, CH_SHOTS, SND_PORTO_UNSUPPORTED, VOL_BASE, ATTEN_NORM);
Portal_ClearAll_PortalsOnly(self.realowner);
- W_Porto_Fail(0);
+ W_Porto_Fail(self, 0);
}
}
}
-void W_Porto_Attack(float type)
-{SELFPARAM();
+void W_Porto_Attack(entity actor, float type)
+{entity this = actor;
entity gren;
W_SetupShot(self, false, 4, SND_PORTO_FIRE, CH_WEAPON_A, 0);
MUTATOR_CALLHOOK(EditProjectile, self, gren);
}
-METHOD(PortoLaunch, wr_aim, void(entity thiswep))
+METHOD(PortoLaunch, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
PHYS_INPUT_BUTTON_ATCK(self) = false;
PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(!WEP_CVAR(porto, secondary))
if(!actor.porto_forbidden)
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
{
- W_Porto_Attack(0);
+ W_Porto_Attack(actor, 0);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
}
if(!actor.porto_forbidden)
if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(porto, refire)))
{
- W_Porto_Attack(1);
+ W_Porto_Attack(actor, 1);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(porto, animtime), w_ready);
}
}
if(!actor.porto_forbidden)
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(porto, refire)))
{
- W_Porto_Attack(-1);
+ W_Porto_Attack(actor, -1);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(porto, animtime), w_ready);
}
}
// always allow infinite ammo
return true;
}
-METHOD(PortoLaunch, wr_setup, void(entity thiswep))
+METHOD(PortoLaunch, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.ammo_field = ammo_none;
}
-METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep))
+METHOD(PortoLaunch, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.porto_current = world;
}
#endif
#ifdef CSQC
-METHOD(PortoLaunch, wr_impacteffect, void(entity this)) {
+METHOD(PortoLaunch, wr_impacteffect, void(entity this, entity actor)) {
LOG_WARNING("Since when does Porto send DamageInfo?\n");
}
#endif
spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); }
spawnfunc(weapon_sniperrifle) { spawnfunc_weapon_rifle(this); }
-void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound)
-{SELFPARAM();
+void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound, entity actor)
+{entity this = actor;
float i;
W_DecreaseAmmo(thiswep, self, pAmmo);
SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
}
-void W_Rifle_Attack()
+void W_Rifle_Attack(entity actor)
{
- W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE);
+ W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE, actor);
}
-void W_Rifle_Attack2()
+void W_Rifle_Attack2(entity actor)
{
- W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2);
+ W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2, actor);
}
-.void() rifle_bullethail_attackfunc;
+.void(entity actor) rifle_bullethail_attackfunc;
.WFRAME rifle_bullethail_frame;
.float rifle_bullethail_animtime;
.float rifle_bullethail_refire;
PS(actor).m_switchweapon = sw;
if(r)
{
- actor.rifle_bullethail_attackfunc();
+ actor.rifle_bullethail_attackfunc(actor);
weapon_thinkf(actor, weaponentity, actor.rifle_bullethail_frame, actor.rifle_bullethail_animtime, W_Rifle_BulletHail_Continue);
}
else
}
}
-void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFRAME fr, float animtime, float refire)
-{SELFPARAM();
+void W_Rifle_BulletHail(entity actor, .entity weaponentity, float mode, void(entity actor) AttackFunc, WFRAME fr, float animtime, float refire)
+{entity this = actor;
// if we get here, we have at least one bullet to fire
- AttackFunc();
+ AttackFunc(actor);
if(mode)
{
// continue hail
.float bot_secondary_riflemooth;
-METHOD(Rifle, wr_aim, void(entity thiswep))
+METHOD(Rifle, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
PHYS_INPUT_BUTTON_ATCK(self) = false;
PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(vdist(self.origin - self.enemy.origin, >, 1000))
if(time >= actor.rifle_accumulator + WEP_CVAR_PRI(rifle, burstcost))
{
weapon_prepareattack_do(actor, weaponentity, false, WEP_CVAR_PRI(rifle, refire));
- W_Rifle_BulletHail(weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+ W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_PRI(rifle, bullethail), W_Rifle_Attack, WFRAME_FIRE1, WEP_CVAR_PRI(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
actor.rifle_accumulator += WEP_CVAR_PRI(rifle, burstcost);
}
if(fire & 2)
if(time >= actor.rifle_accumulator + WEP_CVAR_SEC(rifle, burstcost))
{
weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire));
- W_Rifle_BulletHail(weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
+ W_Rifle_BulletHail(actor, weaponentity, WEP_CVAR_SEC(rifle, bullethail), W_Rifle_Attack2, WFRAME_FIRE2, WEP_CVAR_SEC(rifle, animtime), WEP_CVAR_PRI(rifle, refire));
actor.rifle_accumulator += WEP_CVAR_SEC(rifle, burstcost);
}
}
ammo_amount += actor.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
return ammo_amount;
}
-METHOD(Rifle, wr_resetplayer, void(entity thiswep))
+METHOD(Rifle, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
}
METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD);
+ W_Reload(actor, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD);
}
METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(Rifle, wr_impacteffect, void(entity thiswep))
+METHOD(Rifle, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
// ============================
// Begin: Missile functions, these are general functions to be manipulated by other code
// ============================
-void W_Seeker_Missile_Explode()
-{SELFPARAM();
+void W_Seeker_Missile_Explode(entity this)
+{
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), self.projectiledeathtype, other);
remove(self);
}
-void W_Seeker_Missile_Touch()
+void W_Seeker_Missile_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
- W_Seeker_Missile_Explode();
+ W_Seeker_Missile_Explode(this);
}
-void W_Seeker_Missile_Think()
-{SELFPARAM();
+void W_Seeker_Missile_Think(entity this)
+{
entity e;
vector desireddir, olddir, newdir, eorg;
float turnrate;
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;
}
}
}
*/
-void W_Seeker_Fire_Missile(Weapon thiswep, vector f_diff, entity m_target)
-{SELFPARAM();
+void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, vector f_diff, entity m_target)
+{entity this = actor;
entity missile;
W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, missile_ammo));
// ============================
// 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());
-}
-
-void W_Seeker_Flac_Touch()
-{
- PROJECTILE_TOUCH;
-
- W_Seeker_Flac_Explode();
+ WITHSELF(this, W_Seeker_Flac_Explode(this));
}
-void W_Seeker_Fire_Flac(Weapon thiswep)
-{SELFPARAM();
+void W_Seeker_Fire_Flac(Weapon thiswep, entity actor)
+{entity this = actor;
entity missile;
vector f_diff;
float c;
return world;
}
-void W_Seeker_Attack()
-{SELFPARAM();
+void W_Seeker_Attack(entity actor)
+{entity this = actor;
entity tracker, closest_target;
closest_target = world;
if((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target)))
closest_target = world;
- W_Seeker_Fire_Missile(WEP_SEEKER, '0 0 0', closest_target);
+ W_Seeker_Fire_Missile(WEP_SEEKER, actor, '0 0 0', closest_target);
}
-void W_Seeker_Vollycontroller_Think() // TODO: Merge this with W_Seeker_Attack
-{SELFPARAM();
+void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seeker_Attack
+{
float c;
entity oldenemy;
this.cnt = this.cnt - 1;
switch(c)
{
case 0:
- WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 -3.75 0', own.enemy));
+ WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '-1.25 -3.75 0', own.enemy));
break;
case 1:
- WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 -3.75 0', own.enemy));
+ WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '+1.25 -3.75 0', own.enemy));
break;
case 2:
- WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '-1.25 +3.75 0', own.enemy));
+ WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '-1.25 +3.75 0', own.enemy));
break;
case 3:
default:
- WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, '+1.25 +3.75 0', own.enemy));
+ WITHSELF(own, W_Seeker_Fire_Missile(WEP_SEEKER, own, '+1.25 +3.75 0', own.enemy));
break;
}
own.enemy = oldenemy;
}
-void W_Seeker_Tracker_Think()
-{SELFPARAM();
+void W_Seeker_Tracker_Think(entity this)
+{
// commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
if((IS_DEAD(self.realowner)) || (IS_DEAD(self.tag_target)) || (PS(self.realowner).m_switchweapon != WEP_SEEKER)
|| (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
W_Seeker_Tag_Explode(this);
}
-void W_Seeker_Tag_Touch()
-{SELFPARAM();
+void W_Seeker_Tag_Touch(entity this)
+{
vector dir;
vector org2;
entity e;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
dir = normalize(self.realowner.origin - self.origin);
org2 = findbetterlocation(self.origin, 8);
return;
}
-void W_Seeker_Fire_Tag(Weapon thiswep)
-{SELFPARAM();
+void W_Seeker_Fire_Tag(Weapon thiswep, entity actor)
+{entity this = actor;
entity missile;
W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, tag_ammo));
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;
// Begin: Genereal weapon functions
// ============================
-METHOD(Seeker, wr_aim, void(entity thiswep))
+METHOD(Seeker, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(WEP_CVAR(seeker, type) == 1)
if(W_Seeker_Tagged_Info(self, self.enemy) != world)
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, missile_refire)))
{
- W_Seeker_Attack();
+ W_Seeker_Attack(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, missile_animtime), w_ready);
}
}
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
{
- W_Seeker_Fire_Tag(thiswep);
+ W_Seeker_Fire_Tag(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
}
}
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, tag_refire)))
{
- W_Seeker_Fire_Tag(thiswep);
+ W_Seeker_Fire_Tag(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, tag_animtime), w_ready);
}
}
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(seeker, flac_refire)))
{
- W_Seeker_Fire_Flac(thiswep);
+ W_Seeker_Fire_Flac(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(seeker, flac_animtime), w_ready);
}
}
}
METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD);
+ W_Reload(actor, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD);
}
METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(Seeker, wr_impacteffect, void(entity thiswep))
+METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2;
org2 = w_org + w_backoff * 6;
if(w_deathtype & HITTYPE_BOUNCE)
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;
}
float W_Shockwave_Attack_IsVisible(
+ entity actor,
entity head,
vector nearest_on_line,
vector sw_shotorg,
vector attack_endpos)
-{SELFPARAM();
+{entity this = actor;
vector nearest_to_attacker = head.WarpZone_findradius_nearest;
vector center = (head.origin + (head.mins + head.maxs) * 0.5);
vector corner;
return true;
}
-void W_Shockwave_Send()
-{SELFPARAM();
+void W_Shockwave_Send(entity actor)
+{
WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
WriteCoord(MSG_BROADCAST, w_shotorg.x);
WriteCoord(MSG_BROADCAST, w_shotorg.y);
WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
- WriteByte(MSG_BROADCAST, etof(self));
+ WriteByte(MSG_BROADCAST, etof(actor));
}
-void W_Shockwave_Attack()
-{SELFPARAM();
+void W_Shockwave_Attack(entity actor)
+{entity this = actor;
// declarations
float multiplier, multiplier_from_accuracy, multiplier_from_distance;
float final_damage;
//entity transform = WarpZone_trace_transform;
// do the firing effect now
- W_Shockwave_Send();
+ W_Shockwave_Send(self);
Damage_DamageInfo(
attack_hitpos,
WEP_CVAR(shockwave, blast_splash_damage),
vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance))
- && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
+ && (W_Shockwave_Attack_IsVisible(self, head, nearest_on_line, w_shotorg, attack_endpos)))
{
// calculate importance of distance and accuracy for this attack
multiplier_from_accuracy = (1 -
}
}
-METHOD(Shockwave, wr_aim, void(entity thiswep))
+METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
{ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); }
else
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
{
- W_Shockwave_Attack();
+ W_Shockwave_Attack(actor);
actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
}
shockwave.sw_time = time;
}
-METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
+METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
{
// handled by Net_ReadShockwaveParticle
//vector org2;
#ifdef SVQC
spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(this, WEP_SHOTGUN); }
-void W_Shotgun_Attack(Weapon thiswep, float isprimary)
-{SELFPARAM();
+void W_Shotgun_Attack(Weapon thiswep, entity actor, float isprimary)
+{entity this = actor;
float sc;
entity flash;
// 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;
}
sound(actor, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound
- W_Shotgun_Attack(WEP_SHOTGUN, true); // actually is secondary, but we trick the last shot into playing full reload sound
+ W_Shotgun_Attack(WEP_SHOTGUN, actor, true); // actually is secondary, but we trick the last shot into playing full reload sound
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
}
void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire)
return;
}
- W_Shotgun_Attack(WEP_SHOTGUN, false);
+ W_Shotgun_Attack(WEP_SHOTGUN, actor, false);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
}
.float shotgun_primarytime;
-METHOD(Shotgun, wr_aim, void(entity thiswep))
+METHOD(Shotgun, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false);
else
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, animtime)))
{
- W_Shotgun_Attack(thiswep, true);
+ W_Shotgun_Attack(thiswep, actor, true);
actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
}
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
{
- W_Shotgun_Attack(thiswep, false);
+ W_Shotgun_Attack(thiswep, actor, false);
actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
}
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
}
}
-METHOD(Shotgun, wr_setup, void(entity thiswep))
+METHOD(Shotgun, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.ammo_field = ammo_none;
}
METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor))
}
METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO
+ W_Reload(actor, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO
}
METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep))
{
#ifdef CSQC
.float prevric;
-METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
+METHOD(Shotgun, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
if(!w_issilent && time - self.prevric > 0.25)
return true;
}
-void W_Tuba_NoteThink()
-{SELFPARAM();
+void W_Tuba_NoteThink(entity this)
+{
float dist_mult;
float vol0, vol1;
vector dir0, dir1;
});
}
-void W_Tuba_NoteOn(float hittype)
-{SELFPARAM();
+void W_Tuba_NoteOn(entity actor, float hittype)
+{entity this = actor;
vector o;
float n;
#endif
#ifdef SVQC
-METHOD(Tuba, wr_aim, void(Tuba this))
+METHOD(Tuba, wr_aim, void(Tuba this, entity actor))
{
- entity actor = self;
// bots cannot play the Tuba well yet
// I think they should start with the recorder first
if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius)))
if (fire & 1)
if (weapon_prepareattack(this, actor, weaponentity, false, WEP_CVAR(tuba, refire)))
{
- W_Tuba_NoteOn(0);
+ W_Tuba_NoteOn(actor, 0);
weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
}
if (fire & 2)
if (weapon_prepareattack(this, actor, weaponentity, true, WEP_CVAR(tuba, refire)))
{
- W_Tuba_NoteOn(HITTYPE_SECONDARY);
+ W_Tuba_NoteOn(actor, HITTYPE_SECONDARY);
weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
}
if (actor.tuba_note)
}
}
-METHOD(Tuba, wr_setup, void(Tuba this))
+METHOD(Tuba, wr_setup, void(Tuba this, entity actor))
{
- entity actor = self;
actor.ammo_field = ammo_none;
actor.tuba_instrument = 0;
}
}
}
-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;
spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
-void W_RocketMinsta_Explosion(vector loc)
-{SELFPARAM();
+void W_RocketMinsta_Explosion(entity actor, vector loc)
+{entity this = actor;
if(accuracy_canbegooddamage(self))
accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
entity dmgent = spawn();
remove(dmgent);
}
-void W_Vaporizer_Attack(Weapon thiswep)
-{SELFPARAM();
+void W_Vaporizer_Attack(Weapon thiswep, entity actor)
+{entity this = actor;
bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
if(autocvar_g_rm)
if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
- W_RocketMinsta_Explosion(trace_endpos);
+ W_RocketMinsta_Explosion(self, trace_endpos);
W_DecreaseAmmo(thiswep, self, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
}
-void W_RocketMinsta_Laser_Explode ()
-{SELFPARAM();
+void W_RocketMinsta_Laser_Explode (entity this)
+{
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, W_RocketMinsta_Laser_Explode());
+ WITHSELF(this, W_RocketMinsta_Laser_Explode(this));
}
-void W_RocketMinsta_Laser_Touch ()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_RocketMinsta_Laser_Touch (entity this)
+{
+ PROJECTILE_TOUCH(this);
//W_RocketMinsta_Laser_Explode ();
RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
remove(self);
}
-void W_RocketMinsta_Attack2()
-{SELFPARAM();
+void W_RocketMinsta_Attack2(entity actor)
+{entity this = actor;
makevectors(self.v_angle);
entity proj;
}
}
-void W_RocketMinsta_Attack3 ()
-{SELFPARAM();
+void W_RocketMinsta_Attack3 (entity actor)
+{entity this = actor;
makevectors(self.v_angle);
entity proj;
}
}
-METHOD(Vaporizer, wr_aim, void(entity thiswep))
+METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(self.(thiswep.ammo_field) > 0)
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 1, false);
else
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
{
- W_Vaporizer_Attack(thiswep);
+ W_Vaporizer_Attack(thiswep, actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
}
}
actor.jump_interval = time + autocvar_g_rm_laser_refire;
actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
damage_goodhits = 0;
- W_RocketMinsta_Attack2();
+ W_RocketMinsta_Attack2(actor);
}
else if(rapid && actor.jump_interval2 <= time && actor.held_down)
{
actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
damage_goodhits = 0;
- W_RocketMinsta_Attack3();
+ W_RocketMinsta_Attack3(actor);
//weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
}
}
else
actor.held_down = false;
}
-METHOD(Vaporizer, wr_setup, void(entity thiswep))
+METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.ammo_field = (thiswep.ammo_field);
self.vaporizer_lasthit = 0;
}
ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
return ammo_amount;
}
-METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
+METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
self.vaporizer_lasthit = 0;
}
METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
float used_ammo;
if(WEP_CVAR_SEC(vaporizer, ammo))
else
used_ammo = vaporizer_ammo;
- W_Reload(self, used_ammo, SND_RELOAD);
+ W_Reload(actor, used_ammo, SND_RELOAD);
}
METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
+METHOD(Vaporizer, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2 = w_org + w_backoff * 6;
if(w_deathtype & HITTYPE_SECONDARY)
{
}
}
-void W_Vortex_Attack(Weapon thiswep, float issecondary)
-{SELFPARAM();
+void W_Vortex_Attack(Weapon thiswep, entity actor, float issecondary)
+{entity this = actor;
float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage);
.float vortex_chargepool_pauseregen_finished;
-METHOD(Vortex, wr_aim, void(entity thiswep))
+METHOD(Vortex, wr_aim, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if(bot_aim(self, 1000000, 0, 1, false))
PHYS_INPUT_BUTTON_ATCK(self) = true;
else
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vortex, refire)))
{
- W_Vortex_Attack(thiswep, 0);
+ W_Vortex_Attack(thiswep, actor, 0);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vortex, animtime), w_ready);
}
}
{
if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(vortex, refire)))
{
- W_Vortex_Attack(thiswep, 1);
+ W_Vortex_Attack(thiswep, actor, 1);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(vortex, animtime), w_ready);
}
}
}
}
}
-METHOD(Vortex, wr_setup, void(entity thiswep))
+METHOD(Vortex, wr_setup, void(entity thiswep, entity actor))
{
- SELFPARAM();
- self.vortex_lasthit = 0;
+ actor.vortex_lasthit = 0;
}
METHOD(Vortex, wr_checkammo1, bool(entity thiswep, entity actor))
{
return false; // zoom is not a fire mode
}
}
-METHOD(Vortex, wr_resetplayer, void(entity thiswep))
+METHOD(Vortex, wr_resetplayer, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
if (WEP_CVAR(vortex, charge)) {
if (WEP_CVAR_SEC(vortex, chargepool)) {
self.vortex_chargepool_ammo = 1;
}
METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- SELFPARAM();
- W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD);
+ W_Reload(actor, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD);
}
METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep))
{
#endif
#ifdef CSQC
-METHOD(Vortex, wr_impacteffect, void(entity thiswep))
+METHOD(Vortex, wr_impacteffect, void(entity thiswep, entity actor))
{
- SELFPARAM();
+ entity this = actor;
vector org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
if(!w_issilent)
// generic CSQC model code
-bool CSQCModel_Send(entity to, int sf)
+bool CSQCModel_Send(entity this, entity to, int sf)
{
- SELFPARAM();
// some nice flags for CSQCMODEL_IF
noref bool isplayer = IS_CLIENT(this);
noref bool islocalplayer = (this == to);
void CSQCModel_LinkEntity(entity e)
{
- e.SendEntity = CSQCModel_Send;
+ e.SendEntity = SendEntity_self;
+ e.SendEntity3 = CSQCModel_Send;
e.SendFlags = 0xFFFFFF;
CSQCModel_CheckUpdate(e);
}
void CSQCModel_UnlinkEntity(entity e)
{
e.SendEntity = func_null;
+ e.SendEntity3 = func_null;
}
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;
#ifdef WARPZONELIB_KEEPDEBUG
float WarpZone_CheckProjectileImpact(entity player)
-{SELFPARAM();
+{
vector o0, v0;
.vector orgvec, velvec;
#endif
#endif
-float WarpZone_Projectile_Touch()
-{SELFPARAM();
+float WarpZone_Projectile_Touch(entity this)
+{
if(other.classname == "trigger_warpzone")
return true;
save_ent = trace_ent;
save_inopen = trace_inopen;
save_inwater = trace_inwater;
- float f;
- if((f = WarpZone_CheckProjectileImpact(this)) != 0)
- return (f > 0);
+ float f = WarpZone_CheckProjectileImpact(this);
+ if (f) return (f > 0);
trace_dpstartcontents = save_dpstartcontents;
trace_dphitcontents = save_dphitcontents;
trace_dphitq3surfaceflags = save_dphitq3surfaceflags;
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
#ifdef SVQC
void WarpZone_StartFrame();
-float WarpZone_Projectile_Touch();
+float WarpZone_Projectile_Touch(entity this);
// THESE must be defined by calling QC code:
void WarpZone_PostTeleportPlayer_Callback(entity pl);
if(this.weapons)
{
Weapon w = PS(this).m_weapon;
- w.wr_aim(w);
+ w.wr_aim(w, this);
if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
{
PHYS_INPUT_BUTTON_ATCK(this) = false;
this.aistatus |= AI_STATUS_DANGER_AHEAD;
}
- dodge = havocbot_dodge();
+ dodge = havocbot_dodge(this);
dodge = dodge * bound(0,0.5+(skill+this.bot_dodgeskill)*0.1,1);
evadelava = evadelava * bound(1,3-(skill+this.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
traceline(this.origin, ( ( this.enemy.absmin + this.enemy.absmax ) * 0.5 ), true, world);
havocbot_chooserole(this);
}
-vector havocbot_dodge()
+vector havocbot_dodge(entity this)
{
// LordHavoc: disabled because this is too expensive
return '0 0 0';
#if 0
-SELFPARAM();
entity head;
vector dodge, v, n;
float danger, bestdanger, vl, d;
float havocbot_moveto(entity this, vector pos);
float havocbot_moveto_refresh_route(entity this);
-vector havocbot_dodge();
+vector havocbot_dodge(entity this);
.void(entity this) havocbot_role;
.void(entity this) havocbot_previous_role;
// 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;
// reset fields the weapons may use
FOREACH(Weapons, true, LAMBDA(
- it.wr_resetplayer(it);
+ it.wr_resetplayer(it, this);
// reload all reloadable weapons
if (it.spawnflags & WEP_FLAG_RELOADABLE) {
this.weapon_load[it.m_id] = it.reloading_ammo;
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)
{
=============
*/
.float usekeypressed;
-void() nexball_setstatus;
.float last_vehiclecheck;
.int items_added;
void PlayerPreThink ()
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;
excess = frag_damage;
Weapon wep = PS(this).m_weapon;
- WITHSELF(this, wep.wr_playerdeath(wep));
+ WITHSELF(this, wep.wr_playerdeath(wep, this));
RemoveGrapplingHook(this);
// reset fields the weapons may use just in case
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- WITHSELF(this, it.wr_resetplayer(it));
+ WITHSELF(this, it.wr_resetplayer(it, this));
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
.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();
// ==========================================
// used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
-void timeout_handler_reset()
+void timeout_handler_reset(entity this)
{
- SELFPARAM();
- timeout_caller = world;
+ timeout_caller = NULL;
timeout_time = 0;
timeout_leadtime = 0;
- remove(self);
+ remove(this);
}
-void timeout_handler_think()
+void timeout_handler_think(entity this)
{
- SELFPARAM();
switch (timeout_status)
{
case TIMEOUT_ACTIVE:
it.fixangle = false;
));
- timeout_handler_reset();
+ timeout_handler_reset(this);
}
return;
case TIMEOUT_INACTIVE:
default:
{
- timeout_handler_reset();
+ timeout_handler_reset(this);
return;
}
}
{
string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
- if (command) wordwrap_sprint(command, 1000);
+ if (command) wordwrap_sprint(caller, command, 1000);
else print_to(caller, "ERROR: unsupported info command");
return; // never fall through to usage
.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_reset(entity this);
-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;
+ PROJECTILE_TOUCH(this);
GrapplingHook_Stop();
#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)
#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id))
-#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
+#define PROJECTILE_TOUCH(this) MACRO_BEGIN if (WarpZone_Projectile_Touch(this)) return; MACRO_END
#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
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);
}
}
}
-void path_dbg_think()
-{SELFPARAM();
- pathlib_showpath(self);
- self.nextthink = time + 1;
+void path_dbg_think(entity this)
+{
+ pathlib_showpath(this);
+ this.nextthink = time + 1;
}
-void __showpath2_think()
-{SELFPARAM();
+void __showpath2_think(entity this)
+{
#ifdef TURRET_DEBUG
mark_info(self.origin,1);
#endif
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 path;
}
-entity pathlib_astar(vector from,vector to)
-{SELFPARAM();
+entity pathlib_astar(entity this, vector from,vector to)
+{
entity path, start, end, open, n, ln;
float ptime, ftime, ctime;
pathlib_movecost_waterfactor = 25000000;
pathlib_foundgoal = 0;
- movenode_boxmax = self.maxs * 1.1;
- movenode_boxmin = self.mins * 1.1;
+ movenode_boxmax = this.maxs * 1.1;
+ movenode_boxmin = this.mins * 1.1;
movenode_stepsize = pathlib_gridsize * 0.25;
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)
race_SendNextCheckpoint(msg_entity.enemy, 1);
}
-void W_Porto_Fail(float failhard);
+void W_Porto_Fail(entity this, float failhard);
float race_readTime(string map, float pos)
{
{
// do not allow portalling through checkpoints
trace_plane_normal = normalize(-1 * player.velocity);
- WITHSELF(player, W_Porto_Fail(0));
+ W_Porto_Fail(player, 0);
return;
}
{
oldmsg = this.message;
this.message = "";
- SUB_UseTargets(this, player, player); // TODO: should we be using other for the trigger here?
+ SUB_UseTargets(this, player, player);
this.message = oldmsg;
}
}
}
-void checkpoint_touch()
-{SELFPARAM();
+void checkpoint_touch(entity this)
+{
EXACTTRIGGER_TOUCH;
checkpoint_passed(this, other);
}
if(trigger.classname == "info_player_deathmatch") // a spawn, a spawn
return;
- other = actor;
- checkpoint_passed(this, other);
+ checkpoint_passed(this, actor);
}
bool race_waypointsprite_visible_for_player(entity this, entity player, entity view)
}
}
-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)
{
actor.weaponname = newwep.mdl;
actor.bulletcounter = 0;
actor.ammo_field = newwep.ammo_field;
- newwep.wr_setup(newwep);
+ newwep.wr_setup(newwep, actor);
this.state = WS_RAISE;
// set our clip load to the load of the weapon we switched to, if it's reloadable
}
else if (e)
{
- e.wr_gonethink(e);
+ e.wr_gonethink(e, actor);
}
}
actor.clip_load = actor.(weapon_load[PS(actor).m_weapon.m_id]) = -1;
}
-void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item)
+void W_DropEvent(.void(Weapon, entity actor) event, entity player, float weapon_type, entity weapon_item)
{
Weapon w = Weapons_from(weapon_type);
weapon_dropevent_item = weapon_item;
- WITHSELF(player, w.event(w));
+ WITHSELF(player, w.event(w, player));
}
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use);
-void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item);
+void W_DropEvent(.void(Weapon, entity actor) event, entity player, float weapon_type, entity weapon_item);
void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound);