From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Tue, 17 Jan 2023 16:24:51 +0000 (+0100) Subject: strafehud: make slickdetector scan only downwards for slick, scan from steepest to... X-Git-Tag: xonotic-v0.8.6~136^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b0f73da0fbeb8a9532723e3294c351e8636f7dde;p=xonotic%2Fxonotic-data.pk3dir.git strafehud: make slickdetector scan only downwards for slick, scan from steepest to least steep angle, slight refactor --- diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index ae00a559b..514cb5c2e 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -747,28 +747,21 @@ void HUD_StrafeHUD() // traceline into every direction trace_dphitq3surfaceflags = 0; vector traceorigin = strafeplayer.origin + eZ * strafeplayer.mins.z; - for(float i = 0; i < 360 && !slickdetected; i += slicksteps) + for(float i = 0; i < 90 && !slickdetected; i += slicksteps) { vector slickoffset; float slickrotate; slickoffset.z = -cos(i * DEG2RAD) * autocvar_hud_panel_strafehud_slickdetector_range; slickrotate = sin(i * DEG2RAD) * autocvar_hud_panel_strafehud_slickdetector_range; - if(i != 0 && i != 180) - { - for(float j = 0; j < 180 && !slickdetected; j += slicksteps) - { - slickoffset.x = sin(j * DEG2RAD) * slickrotate; - slickoffset.y = cos(j * DEG2RAD) * slickrotate; - traceline(traceorigin, traceorigin + slickoffset, MOVE_NOMONSTERS, strafeplayer); - if((PHYS_FRICTION(strafeplayer) == 0 && trace_fraction < 1) || trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) slickdetected = true; - } - } - else + for(float j = 0; j < 360 && !slickdetected; j += slicksteps) { - slickoffset.x = slickoffset.y = 0; + slickoffset.x = sin(j * DEG2RAD) * slickrotate; + slickoffset.y = cos(j * DEG2RAD) * slickrotate; + traceline(traceorigin, traceorigin + slickoffset, MOVE_NOMONSTERS, strafeplayer); if((PHYS_FRICTION(strafeplayer) == 0 && trace_fraction < 1) || trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) slickdetected = true; + if(i == 0) break; } }