From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sun, 5 Jul 2020 17:57:49 +0000 (+0200) Subject: strafehud: minor bug fixes X-Git-Tag: xonotic-v0.8.5~738^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ad4b8cf7bc76d90f78eb34e568fa518c4ad48bf6;p=xonotic%2Fxonotic-data.pk3dir.git strafehud: minor bug fixes --- diff --git a/_hud_common.cfg b/_hud_common.cfg index 88f9af892..21d771f67 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -158,7 +158,7 @@ seta hud_panel_strafehud_slickdetector_height "0.125" "height of the slick detec seta hud_panel_strafehud_timeout_air "0.1" "time after take off before changing to air strafe physics when not jumping (visually more consistent hud while on slick downwards ramps)" seta hud_panel_strafehud_timeout_ground "0.03333333" "time after landing before changing to non-air strafe physics (visually more consistent hud while strafe turning when touching the floor after every hop)" seta hud_panel_strafehud_timeout_turn "0.1" "time after releasing the strafe keys before changing mode (visually more consistent hud while switching between left/right strafe turning)" -seta hud_panel_strafehud_timeout_direction "0.5" "time it takes until direction changes (forward or backward movement) are applied" +seta hud_panel_strafehud_timeout_direction "0.5" "time it takes until direction changes (forward or backward movement) are applied (set to zero if you intend to sideways strafe)" seta hud_panel_strafehud_antiflicker_angle "0.01" "how many degrees from 0° to 180° the hud ignores if it could cause visual disturbances otherwise (and to counter rounding errors)" seta hud_panel_strafehud_antiflicker_speed "0.0001" "how many qu/s the hud ignores if it could cause visual disturbances otherwise (and to counter rounding errors)" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 753ff24d9..2f6517c62 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -328,7 +328,7 @@ float autocvar_hud_panel_strafehud_range = 0; int autocvar_hud_panel_strafehud_style = 1; vector autocvar_hud_panel_strafehud_bar_neutral_color = '1 1 1'; float autocvar_hud_panel_strafehud_bar_neutral_alpha = 0.3; -vector autocvar_hud_panel_strafehud_bar_accel_color = '0 1 1'; +vector autocvar_hud_panel_strafehud_bar_accel_color = '0 1 0'; float autocvar_hud_panel_strafehud_bar_accel_alpha = 0.3; vector autocvar_hud_panel_strafehud_bar_overturn_color = '1 0 1'; float autocvar_hud_panel_strafehud_bar_overturn_alpha = 0.3; diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index d71318e7c..15c7d0d14 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -102,7 +102,7 @@ void HUD_StrafeHUD() float maxspeed_phys = onground ? PHYS_MAXSPEED(strafeplayer) : PHYS_MAXAIRSPEED(strafeplayer); float maxspeed = !autocvar__hud_configure ? maxspeed_phys * maxspeed_crouch_mod * maxspeed_water_mod : 320; float vel_angle = vectoangles(strafeplayer.velocity).y; - float view_angle = view_angles.y + 180; + float view_angle = PHYS_INPUT_ANGLES(strafeplayer).y + 180; float angle; vector movement = PHYS_INPUT_MOVEVALUES(strafeplayer); int keys = STAT(PRESSED_KEYS); @@ -382,6 +382,7 @@ void HUD_StrafeHUD() } else // simulate turning for HUD setup { + fwd = true; if(autocvar__hud_panel_strafehud_demo && ((time - demo_time) >= .025)) { demo_time = time; @@ -561,7 +562,6 @@ void HUD_StrafeHUD() if(autocvar_hud_panel_strafehud_slickdetector_range > 0 && autocvar_hud_panel_strafehud_slickdetector_alpha > 0 && slickdetector_height > 0 && panel_size.x > 0) // dunno if slick detection works in spectate { float slicksteps = 90 / pow(2, bound(0, autocvar_hud_panel_strafehud_slickdetector_granularity, 4)); - vector slickoffset; bool slickdetected = false; slickdetected = IS_ONSLICK(strafeplayer); // don't need to traceline if already touching slick @@ -570,6 +570,7 @@ void HUD_StrafeHUD() trace_dphitq3surfaceflags = 0; for(float i = 0; i < 360 && !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; @@ -592,7 +593,7 @@ void HUD_StrafeHUD() } } - // if one traceline hit a slick surface + // if a traceline hit a slick surface if(slickdetected) { vector slickdetector_size = panel_size; @@ -639,7 +640,7 @@ void HUD_StrafeHUD() if(fabs(moveangle) > 90) { strafe_ratio = -((fabs(moveangle) - 90) / 90); - if(strafe_ratio < -1) strafe_ratio = -1 - strafe_ratio%1; + if(strafe_ratio < -1) strafe_ratio = -2 - strafe_ratio; } else {