-#ifndef TURRET_HK_WEAPON_H
-#define TURRET_HK_WEAPON_H
-
-CLASS(HunterKillerAttack, PortoLaunch)
-/* flags */ ATTRIB(HunterKillerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(HunterKillerAttack, impulse, int, 9);
-/* refname */ ATTRIB(HunterKillerAttack, netname, string, "turret_hk");
-/* wepname */ ATTRIB(HunterKillerAttack, m_name, string, _("Hunter-Killer"));
-ENDCLASS(HunterKillerAttack)
-REGISTER_WEAPON(HK, NEW(HunterKillerAttack));
-
-#endif
+#include "hk_weapon.qh"
#ifdef IMPLEMENTATION
float autocvar_g_turrets_unit_hk_shot_speed_turnrate;
void turret_hk_missile_think();
-METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+SOUND(HunterKillerAttack_FIRE, W_Sound("electro_fire"));
+METHOD(HunterKillerAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
bool isPlayer = IS_PLAYER(actor);
- if (fire1)
- if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(electro, refire))) {
+ if (fire & 1)
+ if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_HunterKillerAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
- weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
- entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HK, PROJECTILE_ROCKET, FALSE, FALSE);
+ entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false);
te_explosion (missile.origin);
missile.think = turret_hk_missile_think;
//if (self.cnt < time)
// turret_hk_missile_explode();
- if (self.enemy.deadflag != DEAD_NO)
+ if (IS_DEAD(self.enemy))
self.enemy = world;
// Pick the closest valid target.
if (!self.enemy)
self.enemy = e;
else
- if (vlen(self.origin - e.origin) < vlen(self.origin - self.enemy.origin))
+ if (vlen2(self.origin - e.origin) < vlen2(self.origin - self.enemy.origin))
self.enemy = e;
}
e = e.chain;
if (self.owner.target_select_playerbias < 0)
return 0;
- if (e_target.deadflag != DEAD_NO)
+ if (IS_DEAD(e_target))
return 0;
}