]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Apply more restrictions to W-turn angle rendering k9er/strafehud-changes 1353/head
authorotta8634 <k9wolf@pm.me>
Tue, 17 Sep 2024 19:19:31 +0000 (03:19 +0800)
committerotta8634 <k9wolf@pm.me>
Tue, 17 Sep 2024 19:19:31 +0000 (03:19 +0800)
Formula is only valid when sv_aircontrol_power == 2
... and sv_aircontrol_penalty == 0
It's too difficult for me to figure out the formula if otherwise

qcsrc/client/hud/panel/strafehud.qc

index 880e2803406d7d2a4df0acf76f7610d06582ec3c..f40d3f5931e3843e0fb2b8394ab25ee510e3dd86 100644 (file)
@@ -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_formula_valid      = PHYS_AIRCONTROL_PENALTY(strafeplayer) == 0 && PHYS_AIRCONTROL_POWER(strafeplayer) == 2;
                bool   aircontrol_backwards          = PHYS_AIRCONTROL_BACKWARDS(strafeplayer) == 1;
                bool   airaccel_qw                   = PHYS_AIRACCEL_QW(strafeplayer) == 1;
                // change the range from 0° - 360° to -180° - 180° to match how view_angle represents angles
@@ -661,7 +662,8 @@ void HUD_StrafeHUD()
                 * this is only enabled if sv_airaccel_qw == 1 since otherwise W-turning gives acceleration, unless hud_panel_strafehud_wturn_unrestricted == 1
                 */
                bool wturning    = !onground && wishangle == 0 && (keys_fwd == STRAFEHUD_KEYS_FORWARD || (aircontrol_backwards && keys_fwd == STRAFEHUD_KEYS_BACKWARD));
-               bool wturn_check = autocvar_hud_panel_strafehud_wturn && !immobile && aircontrol && (autocvar_hud_panel_strafehud_wturn_unrestricted == 1 || airaccel_qw);
+               bool wturn_valid = aircontrol && aircontrol_formula_valid && (airaccel_qw || autocvar_hud_panel_strafehud_wturn_unrestricted == 1);
+               bool wturn_check = autocvar_hud_panel_strafehud_wturn && !immobile && wturn_valid;
                if(wturn_check)
                {
                        float wturn_a = 32 * aircontrol * dt;