#include "okshotgun.qh"
#ifdef SVQC
-spawnfunc(weapon_okshotgun) { weapon_defaultspawnfunc(this, WEP_OVERKILL_SHOTGUN); }
-
METHOD(OverkillShotgun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
{
if (vdist(actor.origin - actor.enemy.origin, >, WEP_CVAR_PRI(okshotgun, bot_range)))
{
// Secondary uses it's own refire timer if refire_type is 1.
actor.jump_interval = time + WEP_CVAR_SEC(okshotgun, refire) * W_WeaponRateFactor(actor);
- // Ugly hack to reuse the fire mode of the blaster.
- makevectors(actor.v_angle);
- Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
- actor.(weaponentity).m_weapon = WEP_BLASTER;
- W_Blaster_Attack(
- actor,
- weaponentity,
- WEP_BLASTER.m_id | HITTYPE_SECONDARY,
- WEP_CVAR_SEC(okshotgun, shotangle),
- WEP_CVAR_SEC(okshotgun, damage),
- WEP_CVAR_SEC(okshotgun, edgedamage),
- WEP_CVAR_SEC(okshotgun, radius),
- WEP_CVAR_SEC(okshotgun, force),
- WEP_CVAR_SEC(okshotgun, speed),
- WEP_CVAR_SEC(okshotgun, spread),
- WEP_CVAR_SEC(okshotgun, delay),
- WEP_CVAR_SEC(okshotgun, lifetime)
- );
- actor.(weaponentity).m_weapon = oldwep;
+ BLASTER_SECONDARY_ATTACK(okshotgun, actor, weaponentity);
if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
(actor.(weaponentity).wframe == WFRAME_FIRE2))
{
}
if (fire & 1) // Primary attack
{
- if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okshotgun, animtime)))
+ if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okshotgun, refire)))
{
return;
}
WEP_CVAR_PRI(okshotgun, bullets),
WEP_CVAR_PRI(okshotgun, spread),
WEP_CVAR_PRI(okshotgun, solidpenetration),
- WEP_CVAR_PRI(okshotgun, force));
+ WEP_CVAR_PRI(okshotgun, force),
+ EFFECT_RIFLE_WEAK);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okshotgun, animtime), w_ready);
return;
}
{
return;
}
- // ugly instagib hack to reuse the fire mode of the laser
- makevectors(actor.v_angle);
- Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
- actor.(weaponentity).m_weapon = WEP_BLASTER;
- W_Blaster_Attack(
- actor,
- weaponentity,
- WEP_BLASTER.m_id | HITTYPE_SECONDARY,
- WEP_CVAR_SEC(okshotgun, shotangle),
- WEP_CVAR_SEC(okshotgun, damage),
- WEP_CVAR_SEC(okshotgun, edgedamage),
- WEP_CVAR_SEC(okshotgun, radius),
- WEP_CVAR_SEC(okshotgun, force),
- WEP_CVAR_SEC(okshotgun, speed),
- WEP_CVAR_SEC(okshotgun, spread),
- WEP_CVAR_SEC(okshotgun, delay),
- WEP_CVAR_SEC(okshotgun, lifetime)
- );
- actor.(weaponentity).m_weapon = oldwep;
+ BLASTER_SECONDARY_ATTACK(okshotgun, actor, weaponentity);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okshotgun, animtime), w_ready);
}
}
METHOD(OverkillShotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
{
- float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(okshotgun, ammo);
+ float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okshotgun, ammo);
ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_SHOTGUN.m_id]) >= WEP_CVAR_PRI(okshotgun, ammo);
return ammo_amount;
}
METHOD(OverkillShotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
- if (WEP_CVAR_SEC(okshotgun, ammo) == 0)
- {
- return true;
- }
- float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(okshotgun, ammo);
- ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_SHOTGUN.m_id]) >= WEP_CVAR_SEC(okshotgun, ammo);
- return ammo_amount;
+ return true; // Blaster secondary is unlimited.
}
METHOD(OverkillShotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
METHOD(OverkillShotgun, wr_killmessage, Notification(entity thiswep))
{
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_BLASTER_MURDER;
- else
- return WEAPON_SHOTGUN_MURDER;
+ return WEAPON_OVERKILL_SHOTGUN_MURDER;
}
#endif