]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: properly prevent jump height being carried over after respawn
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 6 Jul 2020 01:27:47 +0000 (03:27 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 6 Jul 2020 01:27:47 +0000 (03:27 +0200)
qcsrc/client/hud/panel/strafehud.qc

index 8e0ebfdbf64b2d0ae3e51f1376b7e84ebd6b6ecc..30322a2fc76009fc7fe2c74eae1788148edeaf5e 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <client/autocvars.qh>
 #include <client/miscfunctions.qh>
+#include <client/resources.qh>
 #include <common/animdecide.qh>
 #include <common/ent_cs.qh>
 #include <common/mapinfo.qh>
@@ -659,8 +660,13 @@ void HUD_StrafeHUD()
             float jumpheight_min = max(autocvar_hud_panel_strafehud_jumpheight_min * length_conversion_factor, 0);
             float jumpheight_current = strafeplayer.origin.z;
             float jumpspeed_current = strafeplayer.velocity.z;
-            if(jumpspeed_prev <= jumpspeed_current || jumpheight_prev > jumpheight_current || IS_ONGROUND(strafeplayer) || swimming)
+            if(jumpspeed_prev <= jumpspeed_current || jumpheight_prev > jumpheight_current || IS_ONGROUND(strafeplayer) || swimming || IS_DEAD(strafeplayer))
             {
+                if(IS_DEAD(strafeplayer))
+                {
+                    jumpheight_prev = jumpheight_current;
+                    jumpspeed_prev = jumpspeed_current;
+                }
                 jumprestart = true;
             }
             else
@@ -669,9 +675,6 @@ void HUD_StrafeHUD()
                 {
                     jumprestart = false;
                     jumpheight = 0;
-                    // this reduces accuracy a little bit but prevents all kind of bugs from carryover values at connect or when dying
-                    jumpheight_prev = jumpheight_current;
-                    jumpspeed_prev = jumpspeed_current;
                 }
                 else
                 {