static bool onslick_last = false;
if(onground)
{
- if(PHYS_FRICTION(strafeplayer) == 0)
- {
- onslick = true;
- }
- else // do not use IS_ONSLICK(), it only works for the local player and only if client prediction is enabled
- {
- trace_dphitq3surfaceflags = 0;
- tracebox(strafeplayer.origin, strafeplayer.mins, strafeplayer.maxs, strafeplayer.origin - '0 0 1', MOVE_NOMONSTERS, strafeplayer);
- onslick = trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK;
- }
- real_onslick = onslick;
+ // do not use IS_ONSLICK(), it only works for the local player and only if client prediction is enabled
+ trace_dphitq3surfaceflags = 0;
+ tracebox(strafeplayer.origin, strafeplayer.mins, strafeplayer.maxs, strafeplayer.origin - '0 0 1', MOVE_NOMONSTERS, strafeplayer);
+ real_onslick = onslick = trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK;
onground_lasttime = time;
onslick_last = onslick;
float text_offset_top;
float text_offset_bottom;
- text_offset_top = text_offset_bottom = StrafeHUD_DrawSlickDetector(strafeplayer, real_onslick);
+ bool all_slick = PHYS_FRICTION(strafeplayer) == 0;
+ text_offset_top = text_offset_bottom = StrafeHUD_DrawSlickDetector(strafeplayer, all_slick && real_onground ? true : real_onslick);
if(autocvar_hud_panel_strafehud_direction)
StrafeHUD_DrawDirectionIndicator(direction, opposite_direction, fwd);
// slick detector
// scans for slick in every direction downwards from the player's feet
// may cause performance issues on slower machines
-float StrafeHUD_DrawSlickDetector(entity e, bool onslick)
+float StrafeHUD_DrawSlickDetector(entity e, bool already_detected)
{
float slickdetector_height = bound(0, autocvar_hud_panel_strafehud_slickdetector_height, 1);
slickdetector_height *= panel_size.y;
slicksteps = 90 * DEG2RAD / 2 ** slicksteps;
// don't need to traceline if already touching slick
- slickdetected = onslick;
+ slickdetected = already_detected;
// coordinates at the bottom center of the player bbox
vector traceorigin = e.origin + eZ * e.mins.z;