From: drjaska Date: Thu, 24 Oct 2024 05:32:00 +0000 (+0300) Subject: Allow for reversed spread, inaccurate to accurate X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9bebee983c49ed3640aa4f17b445bfe3a0690118;p=xonotic%2Fxonotic-data.pk3dir.git Allow for reversed spread, inaccurate to accurate --- diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 0f32850e6..103d50b5b 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -13,7 +13,7 @@ void MachineGun_Update_Spread(entity actor, .entity weaponentity) // time based spread decay if (WEP_CVAR(WEP_MACHINEGUN, spread_decay)) { - float spreadSpectrumDistance = WEP_CVAR(WEP_MACHINEGUN, spread_max) - WEP_CVAR(WEP_MACHINEGUN, spread_min); + float spreadSpectrumDistance = fabs(WEP_CVAR(WEP_MACHINEGUN, spread_max) - WEP_CVAR(WEP_MACHINEGUN, spread_min)); float timediff = time - actor.(weaponentity).spreadUpdateTime; spread_accum = bound(0, spread_accum - (timediff * WEP_CVAR(WEP_MACHINEGUN, spread_decay)), @@ -138,7 +138,11 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity float spread_accum = actor.(weaponentity).machinegun_spread_accumulation; - float spread_accuracy = WEP_CVAR(WEP_MACHINEGUN, spread_min) + spread_accum; + float spread_accuracy; + if (WEP_CVAR(WEP_MACHINEGUN, spread_min) < WEP_CVAR(WEP_MACHINEGUN, spread_max)) + spread_accuracy = WEP_CVAR(WEP_MACHINEGUN, spread_min) + spread_accum; + else // inverted + spread_accuracy = WEP_CVAR(WEP_MACHINEGUN, spread_min) - spread_accum; fireBullet_falloff(actor, weaponentity, w_shotorg, w_shotdir, spread_accuracy,