]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: minor bug fixes
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 5 Jul 2020 17:57:49 +0000 (19:57 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 5 Jul 2020 17:57:49 +0000 (19:57 +0200)
_hud_common.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud/panel/strafehud.qc

index 88f9af8923193fe0f23e8d047c391cf0c4a48899..21d771f67bdd3b6d2fc4e5b7696e3885066de4da 100644 (file)
@@ -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)"
 
index 753ff24d90f6731e7de922d4120563111f17b804..2f6517c62b3a3477f36ededa28572f4f377b3b7f 100644 (file)
@@ -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;
index d71318e7c1987ea50e8c0a3eafdbe35138ff5512..15c7d0d14096e40a1525a1a2dab04c8f40cabc35 100644 (file)
@@ -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
             {