From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Mon, 6 Jul 2020 01:47:29 +0000 (+0200) Subject: strafehud: also check whether the player went into spectate to prevent retention... X-Git-Tag: xonotic-v0.8.5~738^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e0c248fe33c8f9c25cd01513ce8e61dc7cc4a62f;p=xonotic%2Fxonotic-data.pk3dir.git strafehud: also check whether the player went into spectate to prevent retention of some values which cause incorrect jump height detection --- diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 30322a2fc..da17d96e3 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -105,6 +105,7 @@ void HUD_StrafeHUD() bool onground = islocal ? IS_ONGROUND(strafeplayer) : !(strafeplayer.anim_implicit_state & ANIMIMPLICITSTATE_INAIR); bool strafekeys; 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_water_mod = swimming ? .7 : 1; // very simplified water physics, the hud will not work well (and is not supposed to) while swimming @@ -660,9 +661,9 @@ 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 || IS_DEAD(strafeplayer)) + if(jumpspeed_prev <= jumpspeed_current || jumpheight_prev > jumpheight_current || IS_ONGROUND(strafeplayer) || swimming || IS_DEAD(strafeplayer) || spectating) { - if(IS_DEAD(strafeplayer)) + if(IS_DEAD(strafeplayer) || spectating) { jumpheight_prev = jumpheight_current; jumpspeed_prev = jumpspeed_current;