]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: fix crouch detection in spectate and possibly other spectator bugs
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Fri, 19 Mar 2021 21:44:41 +0000 (22:44 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Fri, 19 Mar 2021 21:44:41 +0000 (22:44 +0100)
qcsrc/client/hud/panel/strafehud.qc

index 43a717af8aed7859aa51f353d8eace9e8c0053c1..6b5386d703d96c6b98f67abee655b788ca3a6263 100644 (file)
@@ -109,7 +109,7 @@ void HUD_StrafeHUD()
         bool   swimming                      = strafeplayer.waterlevel >= WATERLEVEL_SWIMMING;
         bool   spectating                    = entcs_GetSpecState(strafeplayer.sv_entnum) == ENTCS_SPEC_PURE;
         float  speed                         = !autocvar__hud_configure ? vlen(vec2(csqcplayer.velocity)) : 1337; // use local csqcmodel entity for this even when spectating, flickers too much otherwise
-        float  maxspeed_crouch_mod           = IS_DUCKED(strafeplayer) && !swimming ? .5 : 1;
+        float  maxspeed_crouch_mod           = IS_DUCKED(csqcplayer) && !swimming ? .5 : 1;
         float  maxspeed_water_mod            = swimming ? .7 : 1; // very simplified water physics, the hud will not work well (and is not supposed to) while swimming
         float  maxspeed_phys                 = onground ? PHYS_MAXSPEED(strafeplayer) : PHYS_MAXAIRSPEED(strafeplayer);
         float  maxspeed                      = !autocvar__hud_configure ? maxspeed_phys * maxspeed_crouch_mod * maxspeed_water_mod : 320;
@@ -601,7 +601,7 @@ void HUD_StrafeHUD()
             {
                 float slicksteps = 90 / pow(2, bound(0, autocvar_hud_panel_strafehud_slickdetector_granularity, 4));
 
-                slickdetected = IS_ONSLICK(strafeplayer); // don't need to traceline if already touching slick
+                if(islocal) slickdetected = IS_ONSLICK(strafeplayer); // don't need to traceline if already touching slick
 
                 // traceline into every direction
                 trace_dphitq3surfaceflags = 0;
@@ -784,7 +784,7 @@ void HUD_StrafeHUD()
             float jumpheight_min = max(autocvar_hud_panel_strafehud_jumpheight_min, 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 || IS_DEAD(strafeplayer) || spectating)
+            if(jumpspeed_prev <= jumpspeed_current || jumpheight_prev > jumpheight_current || onground || swimming || IS_DEAD(strafeplayer) || spectating)
             {
                 // tries to catch kill and spectate but those are not reliable, should just hook to kill/spectate/teleport and reset jump height there
                 jumprestart = true;