From 4351cf3e88e1e642ea9f4b3ee119189343f115d4 Mon Sep 17 00:00:00 2001 From: otta8634 Date: Tue, 3 Sep 2024 16:26:45 +0800 Subject: [PATCH] Made strafehud compatible with sv_aircontrol_backwards 1 Only thing that required changes was wturn-related --- qcsrc/client/hud/panel/strafehud.qc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 00e7c70c4..75ca8fbc8 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -142,6 +142,7 @@ void HUD_StrafeHUD() float maxaccel = !autocvar__hud_configure ? maxaccel_phys : 1; float airstopaccel = PHYS_AIRSTOPACCELERATE(strafeplayer); float aircontrol = PHYS_AIRCONTROL(strafeplayer); + bool aircontrol_backwards = PHYS_AIRCONTROL_BACKWARDS(strafeplayer); bool wturn_no_accel = PHYS_AIRACCEL_QW(strafeplayer) == 1 && aircontrol != 0; // if true, W-turning exists and doesn't provide accel // change the range from 0° - 360° to -180° - 180° to match how view_angle represents angles float vel_angle = vectoangles(strafeplayer.velocity).y - (vectoangles(strafeplayer.velocity).y > 180 ? 360 : 0); @@ -637,7 +638,7 @@ void HUD_StrafeHUD() * ... but the proper angle can be drawn too if the player wants (autocvar_hud_panel_strafehud_wturn_proper) * for now this is only enabled if sv_airaccel_qw == 1 && sv_aircontrol == 150, since otherwise W-turning gives acceleration */ - bool wturning = wishangle == 0 && keys_fwd == STRAFEHUD_KEYS_FORWARD; + bool wturning = wishangle == 0 && (keys_fwd == STRAFEHUD_KEYS_FORWARD || (aircontrol_backwards && keys_fwd == STRAFEHUD_KEYS_BACKWARD)); if(autocvar_hud_panel_strafehud_wturn && wturn_no_accel && !immobile) { float wturn_g = 32 * aircontrol * dt; @@ -710,7 +711,7 @@ void HUD_StrafeHUD() if(autocvar_hud_panel_strafehud_wturn && wturn_no_accel && !immobile) { bool wturn_show = autocvar_hud_panel_strafehud_wturn == 3 ? true - : autocvar_hud_panel_strafehud_wturn == 2 ? (fwd && !turn) + : autocvar_hud_panel_strafehud_wturn == 2 ? ((fwd || aircontrol_backwards) && !turn) : autocvar_hud_panel_strafehud_wturn == 0 ? false : wturning; if(wturn_show && real_wturn_bestangle < real_prebestangle && !onground) -- 2.39.2