]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: make sure not to draw stuff too far outside of the panel area, otherwise...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Thu, 2 Jul 2020 02:54:37 +0000 (04:54 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Thu, 2 Jul 2020 02:55:22 +0000 (04:55 +0200)
qcsrc/client/hud/panel/strafehud.qc

index 653d6e47a9c7129e0d15818a4d34943e6392f345..1698eaca7a09b3b03fa811ba9e95442e8b8242ae 100644 (file)
@@ -114,6 +114,7 @@ void HUD_StrafeHUD()
         float  antiflicker_angle             = bound(0, autocvar_hud_panel_strafehud_antiflicker_angle, 180);
         float  antiflicker_speed             = max(0, autocvar_hud_panel_strafehud_antiflicker_speed);
         float  minspeed;
+        float  shift_offset                  = 0;
         bool   straight_overturn             = false;
         float  hudangle;
         float  neutral_offset;
@@ -478,7 +479,7 @@ void HUD_StrafeHUD()
             accelzone_right_offset = 0;
             accelzone_left_offset = overturn_offset + overturn_width;
             neutral_width = 360/hudangle * panel_size.x - accelzone_width*2 - overturn_width;
-            neutral_offset = accelzone_left_offset + accelzone_width;
+            neutral_offset = direction < 0 ? accelzone_left_offset + accelzone_width : -neutral_width;
 
             // remove switch indicator width from offset
             if(direction < 0)
@@ -493,7 +494,6 @@ void HUD_StrafeHUD()
             }
 
             // shift hud if operating in view angle centered mode
-            float shift_offset = 0;
             if(mode == 0)
             {
                 shift_offset = -currentangle_offset;
@@ -502,7 +502,7 @@ void HUD_StrafeHUD()
                 odd_bestangle_offset += shift_offset;
                 switch_odd_bestangle_offset += shift_offset;
             }
-
+            if(direction < 0) shift_offset += -360/hudangle * panel_size.x;
             // calculate how far off-center the strafe zones currently are
             shift_offset += (panel_size.x + neutral_width)/2 - wishangle/hudangle * panel_size.x;
             // shift strafe zones into correct place