From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Tue, 7 Sep 2021 18:16:39 +0000 (+0200) Subject: strafehud: fix console spam when playing with high accel X-Git-Tag: xonotic-v0.8.6~136^2~38 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fc56bbddeeb17753e0bdb9ec68b69ce90905df8f;p=xonotic%2Fxonotic-data.pk3dir.git strafehud: fix console spam when playing with high accel --- diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index ba1acb5e7..b281d3ed4 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -475,8 +475,8 @@ void HUD_StrafeHUD() } // best angle to strafe at - bestangle = (speed > (movespeed - maxaccel) ? acos((movespeed - maxaccel) / speed) : 0) * RAD2DEG * (direction < 0 ? -1 : 1); - prebestangle = (speed > movespeed ? acos(movespeed / speed) : 0) * RAD2DEG * (direction < 0 ? -1 : 1); + bestangle = (speed > fabs(movespeed - maxaccel) ? acos(fabs(movespeed - maxaccel) / speed) * RAD2DEG * (direction < 0 ? -1 : 1) : 0); + prebestangle = (speed > fabs(movespeed) ? acos(fabs(movespeed) / speed) * RAD2DEG * (direction < 0 ? -1 : 1) : 0); odd_bestangle = -bestangle - wishangle; bestangle -= wishangle; prebestangle -= wishangle; @@ -702,7 +702,7 @@ void HUD_StrafeHUD() drawfill(panel_pos + eX * (indicator_direction ? 0 : panel_size.x - direction_size_horizontal.x) + eY * panel_size.y, direction_size_horizontal, autocvar_hud_panel_strafehud_direction_color, autocvar_hud_panel_strafehud_direction_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } - if(speed < ((movespeed - maxaccel) + antiflicker_speed) && !immobile) + if(speed <= (fabs(movespeed - maxaccel) + antiflicker_speed) && !immobile) { bestangle_anywhere = true; // moving forward should suffice to gain speed }