.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();
+void W_Devastator_Touch(entity this)
+{
if(WarpZone_Projectile_Touch())
{
if(wasfreed(self))
- W_Devastator_Unregister();
+ W_Devastator_Unregister(self);
return;
}
- W_Devastator_Unregister();
- W_Devastator_Explode();
+ W_Devastator_Unregister(self);
+ 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;
W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0);
missile.angles = vectoangles(missile.velocity);
- missile.touch = W_Devastator_Touch;
- missile.think = W_Devastator_Think;
+ settouch(missile, W_Devastator_Touch);
+ setthink(missile, W_Devastator_Think);
missile.nextthink = time;
missile.cnt = time + WEP_CVAR(devastator, lifetime);
missile.flags = FL_PROJECTILE;
}
#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))
+METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor))
{
- SELFPARAM();
#if 0
// don't switch while guiding a missile
- if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
+ if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_DEVASTATOR)
{
ammo_amount = false;
if(WEP_CVAR(devastator, reload_ammo))
{
- if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
+ if(actor.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && actor.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
ammo_amount = true;
}
- else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
+ else if(actor.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
ammo_amount = true;
return !ammo_amount;
}
#endif
#if 0
- if(self.rl_release == 0)
+ if(actor.rl_release == 0)
{
- LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
+ LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
return true;
}
else
{
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
- ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
- LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+ ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+ ammo_amount += actor.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+ LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
return ammo_amount;
}
#else
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
- ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
+ float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
+ ammo_amount += actor.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
return ammo_amount;
#endif
}
-METHOD(Devastator, wr_checkammo2, bool(entity thiswep))
+METHOD(Devastator, wr_checkammo2, 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);