From 8ab987f9e08dee8bcbbd7db6c86a1c9941964c09 Mon Sep 17 00:00:00 2001 From: otta8634 Date: Sat, 7 Sep 2024 13:02:06 +0800 Subject: [PATCH] Final cleanup, and rename "CPMA turning" to sidestrafing in strafehud Quake1 has A/D turning too, while W-turning is the only thing specific to CPMA physics, so it makes more sense for A/D turning to be called sidestrafing --- _hud_common.cfg | 10 +++++----- qcsrc/client/hud/panel/strafehud.qc | 25 +++++++++++++++---------- qcsrc/client/hud/panel/strafehud.qh | 4 ++-- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index 2feffaa54..8ff313715 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -168,7 +168,7 @@ seta hud_panel_scoreboard_itemstats_showdelay_minpos 0.75 "delay displaying the seta _hud_panel_strafehud_demo "0" "strafehud changes angle during configure" seta hud_panel_strafehud_mode "0" "strafehud mode which controls whether the strafehud is centered at \"0\" = view angle, \"1\" = velocity angle" seta hud_panel_strafehud_range "90" "the angle range up to 360 degrees displayed on the strafehud, \"0\" = dynamic (chooses the minimum range required to still see the whole area needed for accelerating)" -seta hud_panel_strafehud_range_cpma "90" "the angle range up to 360 degrees displayed on the strafehud when CPMA turning, \"0\" = dynamic (chooses the minimum range required to still see the whole area needed for accelerating)" +seta hud_panel_strafehud_range_sidestrafe "-1" "the angle range up to 360 degrees displayed on the strafehud when side strafing, \"0\" = dynamic (chooses the minimum range required to still see the whole area needed for accelerating), \"-1\" = same as the normal range" seta hud_panel_strafehud_style "2" "\"0\" = no styling, \"1\" = progress bar style for the strafe bar, \"2\" = gradient for the strafe bar" seta hud_panel_strafehud_unit_show "1" "show units" seta hud_panel_strafehud_uncapped "0" "set to \"1\" to remove some safety restrictions, useful to set thinner indicator lines down to 1px or for trying out higher values for some performance degrading operations (warning: elements may turn invisible if too thin, other configurations may crash your game or look horribly ugly)" @@ -194,19 +194,19 @@ seta hud_panel_strafehud_angle_accel_color "0 1 1" "color of the indicator showi seta hud_panel_strafehud_angle_overturn_color "1 0 1" "color of the indicator showing the player's current angle if it is within the overturn zone" seta hud_panel_strafehud_angle_arrow "1" "set the angle indicator's arrow style: 0 = none, 1 = top, 2 = bottom, 3 = both" seta hud_panel_strafehud_angle_arrow_size "0.5" "size of the arrow (relative to the panel height)" -seta hud_panel_strafehud_bestangle "1" "set to \"1\" to enable a ghost angle indicator showing the best angle to gain maximum acceleration, 2 = only when CPMA turning" +seta hud_panel_strafehud_bestangle "1" "set to \"1\" to enable a ghost angle indicator showing the best angle to gain maximum acceleration, 2 = only when side strafing" seta hud_panel_strafehud_bestangle_color "1 1 1" "color of the indicator showing the best angle to gain maximum acceleration" seta hud_panel_strafehud_bestangle_alpha "0.5" "opacity of the indicator showing the best angle to gain maximum acceleration" -seta hud_panel_strafehud_switch "1" "set to \"1\" to enable the switch indicator showing the angle to move to when switching sides, 2 = show the normal switch indicators when W-turning, 3 = also while CPMA turning" +seta hud_panel_strafehud_switch "1" "set to \"1\" to enable the switch indicator showing the angle to move to when switching sides, 2 = show the normal switch indicators when W-turning, 3 = also while side strafing" seta hud_panel_strafehud_switch_minspeed "-1" "minimum speed in qu/s at which switch indicator(s) which are used to aid changing strafe direction will be shown (set to -1 for dynamic minspeed)" seta hud_panel_strafehud_switch_color "1 1 0" "color of the switch indicator" seta hud_panel_strafehud_switch_alpha "1" "opacity of the switch indicator" seta hud_panel_strafehud_switch_width "0.003" "width of the strafe angle indicator(s) (relative to the strafe bar width)" -seta hud_panel_strafehud_wturn "1" "enable the W-turn indicators showing the angle to rotate your velocity as fast as possible, 1 = only if W-turning, 2 = also while strafing normally, 3 = also while CPMA turning" +seta hud_panel_strafehud_wturn "1" "enable the W-turn indicators showing the angle to rotate your velocity as fast as possible, 1 = only if W-turning, 2 = also while strafing normally, 3 = also while side strafing" seta hud_panel_strafehud_wturn_color "0 1 1" "color of the W-turn indicators" seta hud_panel_strafehud_wturn_alpha "1" "opacity of the W-turn indicators" seta hud_panel_strafehud_wturn_width "0.003" "width of the W-turn indicators (relative to the strafe bar width)" -seta hud_panel_strafehud_wturn_proper "0" "use the proper formula to calculate W-turn indicators (warning: loses accuracy at high speeds)" +seta hud_panel_strafehud_wturn_trueness "0" "use the proper formula to calculate W-turn indicators (warning: loses accuracy at high speeds)" seta hud_panel_strafehud_wturn_unrestricted "0" "set to \"1\" to enable the W-turn indicators even when W-turning gives acceleration (warning: not completely accurate)" seta hud_panel_strafehud_direction "0" "set to \"1\" to enable the direction caps to see in which direction you are currently strafing" seta hud_panel_strafehud_direction_color "0 0.5 1" "color of the direction caps which indicate the direction the player is currently strafing towards" diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 3f7963362..4e01409e9 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -362,7 +362,7 @@ void HUD_StrafeHUD() wishangle = 0; // wraps at 180° } - float real_wishangle = fabs(wishangle); // unmodified by CPMA turning + float real_wishangle = fabs(wishangle); // unmodified by side strafing code strafekeys = real_wishangle > 45; // detect air strafe turning @@ -379,7 +379,7 @@ void HUD_StrafeHUD() else if(turn_expired) turn = false; - if(turn) // CPMA turning (A/D, not W-turning) + if(turn) // side strafing (A/D) { if(strafekeys) { @@ -411,13 +411,18 @@ void HUD_StrafeHUD() range_minangle *= 2; // multiply to accommodate for both sides of the hud float range_normal = autocvar_hud_panel_strafehud_range; - float range_cpma = autocvar_hud_panel_strafehud_range_cpma; + float range_side = autocvar_hud_panel_strafehud_range_sidestrafe; + float range_used; if(range_normal == 0) range_normal = autocvar__hud_configure ? 90 : range_minangle; // use minimum angle required if dynamically setting hud angle - if(range_cpma == 0) - range_cpma = autocvar__hud_configure ? 90 : range_minangle; // ... - - float range_used = GeomLerp(range_normal, strafity, range_cpma); + if(range_side == -1) // use the normal range + range_used = range_normal; + else + { + if(range_side == 0) + range_side = autocvar__hud_configure ? 90 : range_minangle; + range_used = GeomLerp(range_normal, strafity, range_side); + } hudangle = bound(0, fabs(range_used), 360); // limit HUD range to 360 degrees, higher values don't make sense maxaccel *= dt * movespeed; @@ -649,7 +654,7 @@ void HUD_StrafeHUD() * furthermore, this function quite rapidly approaches its asymptote of ~35.26, e.g. being ~0.68 away when at only speed=600 * this asymptote is independent of whether the player is crouching or has haste, although they must be airborne * thus, the best option is to just draw the asymptote (acos(sqrt(2/3))), - * ... but the proper angle can be drawn too if the player wants (autocvar_hud_panel_strafehud_wturn_proper) + * ... but the proper angle can be drawn too if the player wants (autocvar_hud_panel_strafehud_wturn_trueness 1) * for now this is only enabled if sv_airaccel_qw == 1 && sv_aircontrol == 150, since otherwise W-turning gives acceleration */ bool wturning = !onground && wishangle == 0 && (keys_fwd == STRAFEHUD_KEYS_FORWARD || (aircontrol_backwards && keys_fwd == STRAFEHUD_KEYS_BACKWARD)); @@ -658,14 +663,14 @@ void HUD_StrafeHUD() { float wturn_a = 32 * aircontrol * dt; float wturn_V = 1 - (wturn_a * wturn_a) / (speed * speed); - if(autocvar_hud_panel_strafehud_wturn_proper == 1 && wturn_a > 1 && wturn_V < 1 && wturn_V > -1) + if(autocvar_hud_panel_strafehud_wturn_trueness && wturn_a > 1 && wturn_V < 1 && wturn_V > -1) wturn_bestangle = acos(-speed / wturn_a * (cos((acos(wturn_V) + M_PI * 2) / 3) * 2 + 1)) * RAD2DEG; else wturn_bestangle = acos(sqrt(2 / 3)) * RAD2DEG; real_wturn_bestangle = wturn_bestangle; } - // draw the switch indicators as if strafing normally, while W-turning or CPMA turning + // draw the switch indicators as if strafing normally, while W-turning or side strafing draw_normal = ((autocvar_hud_panel_strafehud_switch >= 2 && wturning) || (autocvar_hud_panel_strafehud_switch == 3 && turn)); if(draw_normal) { diff --git a/qcsrc/client/hud/panel/strafehud.qh b/qcsrc/client/hud/panel/strafehud.qh index c624f69a6..bdc5bd761 100644 --- a/qcsrc/client/hud/panel/strafehud.qh +++ b/qcsrc/client/hud/panel/strafehud.qh @@ -6,7 +6,7 @@ bool autocvar__hud_panel_strafehud_demo = false; bool autocvar_hud_panel_strafehud_dynamichud = true; int autocvar_hud_panel_strafehud_mode = 0; float autocvar_hud_panel_strafehud_range = 90; -float autocvar_hud_panel_strafehud_range_cpma = 90; +float autocvar_hud_panel_strafehud_range_sidestrafe = -1; int autocvar_hud_panel_strafehud_style = 2; bool autocvar_hud_panel_strafehud_unit_show = true; bool autocvar_hud_panel_strafehud_uncapped = false; @@ -44,7 +44,7 @@ int autocvar_hud_panel_strafehud_wturn = 1; vector autocvar_hud_panel_strafehud_wturn_color = '0 1 1'; float autocvar_hud_panel_strafehud_wturn_alpha = 1; float autocvar_hud_panel_strafehud_wturn_width = 0.003; -bool autocvar_hud_panel_strafehud_wturn_proper = false; +bool autocvar_hud_panel_strafehud_wturn_trueness = false; bool autocvar_hud_panel_strafehud_wturn_unrestricted = false; bool autocvar_hud_panel_strafehud_direction = false; vector autocvar_hud_panel_strafehud_direction_color = '0 0.5 1'; -- 2.39.2