);
Weapon thiswep = WEP_DEVASTATOR;
- if(PS(this.realowner).m_weapon == thiswep)
+ .entity weaponentity = this.weaponentity_fld;
+ if(this.realowner.(weaponentity).m_weapon == thiswep)
{
if(this.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
{
this.realowner.cnt = WEP_DEVASTATOR.m_id;
- int slot = 0; // TODO: unhardcode
+ int slot = weaponslot(weaponentity);
ATTACK_FINISHED(this.realowner, slot) = time;
- PS(this.realowner).m_switchweapon = w_getbestweapon(this.realowner);
+ this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner);
}
}
delete(this);
);
Weapon thiswep = WEP_DEVASTATOR;
- if(PS(this.realowner).m_weapon == thiswep)
+ if(this.realowner.(weaponentity).m_weapon == thiswep)
{
if(this.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
this.realowner.cnt = WEP_DEVASTATOR.m_id;
int slot = weaponslot(weaponentity);
ATTACK_FINISHED(this.realowner, slot) = time;
- PS(this.realowner).m_switchweapon = w_getbestweapon(this.realowner);
+ this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner);
}
}
delete(this);
this.velocity = this.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(this.realowner) * frametime, velspeed);
// laser guided, or remote detonation
- if(PS(this.realowner).m_weapon == WEP_DEVASTATOR)
+ .entity weaponentity = this.weaponentity_fld;
+ if(this.realowner.(weaponentity).m_weapon == WEP_DEVASTATOR)
{
- .entity weaponentity = this.weaponentity_fld;
int slot = weaponslot(weaponentity);
if(this == this.realowner.(weaponentity).lastrocket)
void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity)
{
- W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo));
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo), weaponentity);
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
actor.rl_release[slot] = 1;
if(fire & 2)
- if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
+ if(actor.(weaponentity).m_switchweapon == WEP_DEVASTATOR)
{
- entity rock;
bool rockfound = false;
- for(rock = NULL; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
+ IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
{
- if(!rock.rl_detonate_later)
+ if(!it.rl_detonate_later)
{
- rock.rl_detonate_later = true;
+ it.rl_detonate_later = true;
rockfound = true;
}
- }
+ });
if(rockfound)
sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
}
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
actor.rl_release[slot] = 1;
}
-METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor))
+METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
{
#if 0
// don't switch while guiding a missile
return ammo_amount;
#endif
}
-METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor))
+METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
return false;
}