]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
condense
authordrjaska <drjaska83@gmail.com>
Wed, 21 Feb 2024 02:12:51 +0000 (04:12 +0200)
committerdrjaska <drjaska83@gmail.com>
Wed, 21 Feb 2024 02:28:10 +0000 (04:28 +0200)
qcsrc/common/weapons/weapon/machinegun.qc

index 50efe2d3106127b5c975ec8617ca637f535af03f..4b8a84ef93ceb8b5747d1465b8bf10697ed64fd3 100644 (file)
@@ -110,24 +110,18 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
 
        float spread_acc = actor.(weaponentity).machinegun_spread_accumulation;
 
-       spread_acc = max(spread_acc - ((time - actor.(weaponentity).lastShotTime) * WEP_CVAR(machinegun, spread_decay)), 0);
-
-       if (inversedSpread)
-       {
-               spread_acc = bound(WEP_CVAR(machinegun, spread_max), WEP_CVAR(machinegun, spread_min) - spread_acc, WEP_CVAR(machinegun, spread_min));
-       }
-       else
-       {
-               spread_acc = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + spread_acc, WEP_CVAR(machinegun, spread_max));
-       }
-
-       actor.(weaponentity).lastShotTime = time;
+       float timediff = time - actor.(weaponentity).lastShotTime;
+       spread_acc = bound(spreadSpectrumMin,
+                          spread_acc - (timediff * WEP_CVAR(machinegun, spread_decay)),
+                          spreadSpectrumMax);
 
        if (WEP_CVAR(machinegun, spread_decay) == 0)
        {
                spread_acc = bound(0, (WEP_CVAR(machinegun, spread_add) * actor.(weaponentity).misc_bulletcounter), spreadSpectrumDistance);
        }
 
+       actor.(weaponentity).lastShotTime = time;
+
        // function for reducing mg's damage with no spread and adding damage with
        // heated up barrel or vice versa depending on the values of exposed cvars
        float heatMultiplierApplicationPercent = 1;