// enable to debug melee range
//#define SHOTGUN_MELEEDEBUG
-void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float isprimary, float ammocount, float damage, float bullets, float spread, float solidpenetration, float force, entity bullet_trail_effect)
+void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity,
+ float isprimary, float ammocount, float damage,
+ float falloff_halflife, float falloff_mindist, float falloff_maxdist,
+ float bullets, float spread, float solidpenetration,
+ float force, float falloff_forcehalflife, entity bullet_trail_effect)
{
W_DecreaseAmmo(thiswep, actor, ammocount, weaponentity);
- W_SetupShot(actor, weaponentity, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), damage * bullets, thiswep.m_id);
+ W_SetupShot(actor, weaponentity, true, 5, SND_SHOTGUN_FIRE,
+ ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), damage * bullets, thiswep.m_id);
- // TRICK: do the antilag outside the regular fireBullet function, so it isn't performed unnecessarily on every single bullet!
+ // TRICK: do the antilag outside the regular fireBullet function,
+ // so it isn't performed unnecessarily on every single bullet!
float lag = antilag_getlag(actor);
if(lag && bullets > 0)
antilag_takeback_all(actor, lag);
for(int sc = 0;sc < bullets;sc = sc + 1)
- fireBullet_antilag(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration, damage, 0, force, thiswep.m_id, bullet_trail_effect, false);
+ fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration,
+ damage, falloff_halflife, falloff_mindist, falloff_maxdist, 0, force,
+ falloff_forcehalflife, thiswep.m_id, bullet_trail_effect, false);
if(lag && bullets > 0)
antilag_restore_all(actor);
W_Shotgun_Attack(thiswep, actor, weaponentity, true,
WEP_CVAR_PRI(shotgun, ammo),
WEP_CVAR_PRI(shotgun, damage),
+ WEP_CVAR_PRI(shotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(shotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(shotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(shotgun, bullets),
WEP_CVAR_PRI(shotgun, spread),
WEP_CVAR_PRI(shotgun, solidpenetration),
WEP_CVAR_PRI(shotgun, force),
+ WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife),
EFFECT_BULLET_WEAK); // 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);
}
W_Shotgun_Attack(thiswep, actor, weaponentity, false,
WEP_CVAR_PRI(shotgun, ammo),
WEP_CVAR_PRI(shotgun, damage),
+ WEP_CVAR_PRI(shotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(shotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(shotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(shotgun, bullets),
WEP_CVAR_PRI(shotgun, spread),
WEP_CVAR_PRI(shotgun, solidpenetration),
WEP_CVAR_PRI(shotgun, force),
+ WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife),
EFFECT_BULLET_WEAK);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
}
W_Shotgun_Attack(thiswep, actor, weaponentity, true,
WEP_CVAR_PRI(shotgun, ammo),
WEP_CVAR_PRI(shotgun, damage),
+ WEP_CVAR_PRI(shotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(shotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(shotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(shotgun, bullets),
WEP_CVAR_PRI(shotgun, spread),
WEP_CVAR_PRI(shotgun, solidpenetration),
WEP_CVAR_PRI(shotgun, force),
+ WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife),
EFFECT_BULLET_WEAK);
actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
W_Shotgun_Attack(thiswep, actor, weaponentity, false,
WEP_CVAR_PRI(shotgun, ammo),
WEP_CVAR_PRI(shotgun, damage),
+ WEP_CVAR_PRI(shotgun, damagefalloff_halflife),
+ WEP_CVAR_PRI(shotgun, damagefalloff_mindist),
+ WEP_CVAR_PRI(shotgun, damagefalloff_maxdist),
WEP_CVAR_PRI(shotgun, bullets),
WEP_CVAR_PRI(shotgun, spread),
WEP_CVAR_PRI(shotgun, solidpenetration),
WEP_CVAR_PRI(shotgun, force),
+ WEP_CVAR_PRI(shotgun, damagefalloff_forcehalflife),
EFFECT_BULLET_WEAK);
actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);