]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add patch from Juhu/strafehud-fixes branch: "strafehud: update the strafehud hud...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Wed, 18 Jan 2023 14:22:45 +0000 (15:22 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Wed, 18 Jan 2023 14:22:45 +0000 (15:22 +0100)
_hud_common.cfg
qcsrc/client/hud/panel/strafehud.qc
qcsrc/client/hud/panel/strafehud.qh
qcsrc/menu/xonotic/dialog_hudpanel_strafehud.qc

index 6439c6662273f7d61cdb917a96e98b1a7bad65b5..c914ef4c311ab59de54da8ddcb100e639422bf0d 100644 (file)
@@ -175,23 +175,28 @@ seta hud_panel_strafehud_angle_arrow_size "0.5" "size of the arrow (relative to
 seta hud_panel_strafehud_bestangle "1" "set to \"1\" to enable a ghost angle indicator showing the best angle to gain maximum acceleration"
 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"
 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_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"
-seta hud_panel_strafehud_direction_alpha "0" "opacity of the direction caps which indicate the direction the player is currently strafing towards"
+seta hud_panel_strafehud_direction_alpha "1" "opacity of the direction caps which indicate the direction the player is currently strafing towards"
 seta hud_panel_strafehud_direction_width "0.25" "stroke width of the direction caps which indicate the direction the player is currently strafing towards (relative to the panel height)"
 seta hud_panel_strafehud_direction_length "0.02" "length of the horizontal component of the direction caps which indicate the direction the player is currently strafing towards (relative to the panel width)"
-seta hud_panel_strafehud_slickdetector_range "200" "range of the slick detector in qu, \"0\" to disable"
+seta hud_panel_strafehud_slickdetector "1" "set to \"1\" to enable the slick detector which notifies you if there is slick near you"
+seta hud_panel_strafehud_slickdetector_range "200" "range of the slick detector in qu"
 seta hud_panel_strafehud_slickdetector_granularity "1" "value from 0 to 4 which defines how exact the search for slick should be, higher values may yield better results but require more computation"
 seta hud_panel_strafehud_slickdetector_color "0 1 1" "color of the slick detector indicator"
 seta hud_panel_strafehud_slickdetector_alpha "0.5" "opacity of the slick detector indicator"
 seta hud_panel_strafehud_slickdetector_height "0.125" "height of the slick detector indicator (relative to the panel height)"
-seta hud_panel_strafehud_startspeed_fade "4" "fade time (in seconds) of the start speed text or \"0\" to disable"
+seta hud_panel_strafehud_startspeed "1" "set to \"1\" to enable the start speed indicator which shows you the speed you had while passing the start trigger of a race map"
+seta hud_panel_strafehud_startspeed_fade "4" "fade time (in seconds) of the start speed text"
 seta hud_panel_strafehud_startspeed_color "1 0.75 0" "color of the start speed text"
 seta hud_panel_strafehud_startspeed_size "1.5" "size of the start speed text (relative to the panel height)"
-seta hud_panel_strafehud_jumpheight_fade "0" "fade time (in seconds) of the jump height text or \"0\" to disable"
+seta hud_panel_strafehud_jumpheight "0" "set to \"1\" to enable the jump height indicator which tells you how high you jumped"
+seta hud_panel_strafehud_jumpheight_fade "4" "fade time (in seconds) of the jump height text"
 seta hud_panel_strafehud_jumpheight_min "50" "minimum jump height to display in the selected unit"
 seta hud_panel_strafehud_jumpheight_color "0 1 0.75" "color of the jump height text"
 seta hud_panel_strafehud_jumpheight_size "1.5" "size of the jump height text (relative to the panel height)"
index c4e156457ac56fd4c07ff73206d299efbff34424..544632413f06d8204a8ed8ebba1de3bf2592124a 100644 (file)
@@ -722,7 +722,7 @@ void HUD_StrafeHUD()
             // draw neutral zone
             HUD_Panel_DrawStrafeHUD(neutral_offset, neutral_width, hidden_width, autocvar_hud_panel_strafehud_bar_neutral_color, autocvar_hud_panel_strafehud_bar_neutral_alpha * panel_fg_alpha, autocvar_hud_panel_strafehud_style, STRAFEHUD_GRADIENT_NONE);
 
-            if(speed >= minspeed && bestangle_width > 0 && autocvar_hud_panel_strafehud_switch_alpha > 0) // only draw indicators if minspeed is reached
+            if(autocvar_hud_panel_strafehud_switch && speed >= minspeed && bestangle_width > 0 && autocvar_hud_panel_strafehud_switch_alpha > 0) // only draw indicators if minspeed is reached
             {
                 // draw the switch indicator(s)
                 float offset = !odd_angles ? bestangle_offset : odd_bestangle_offset;
@@ -754,7 +754,7 @@ void HUD_StrafeHUD()
         if(!autocvar_hud_panel_strafehud_uncapped)
              slickdetector_height = min(slickdetector_height, 1);
         slickdetector_height *= panel_size.y;
-        if(autocvar_hud_panel_strafehud_slickdetector_range > 0 && autocvar_hud_panel_strafehud_slickdetector_alpha > 0 && slickdetector_height > 0 && panel_size.x > 0)
+        if(autocvar_hud_panel_strafehud_slickdetector && autocvar_hud_panel_strafehud_slickdetector_range > 0 && autocvar_hud_panel_strafehud_slickdetector_alpha > 0 && slickdetector_height > 0 && panel_size.x > 0)
         {
             float slicksteps = max(autocvar_hud_panel_strafehud_slickdetector_granularity, 0);
             bool slickdetected = false;
@@ -800,7 +800,7 @@ void HUD_StrafeHUD()
             }
         }
 
-        if(direction != STRAFEHUD_DIRECTION_NONE && direction_size_vertical.x > 0 && autocvar_hud_panel_strafehud_direction_alpha * panel_fg_alpha > 0)
+        if(autocvar_hud_panel_strafehud_direction && direction != STRAFEHUD_DIRECTION_NONE && direction_size_vertical.x > 0 && autocvar_hud_panel_strafehud_direction_alpha * panel_fg_alpha > 0)
         {
             bool indicator_direction = direction == STRAFEHUD_DIRECTION_LEFT;
             // invert left/right when strafing backwards or when strafing towards the opposite side indicated by the direction variable
@@ -984,13 +984,16 @@ void HUD_StrafeHUD()
                 }
             }
 
-            float startspeed_height = autocvar_hud_panel_strafehud_startspeed_size * panel_size.y;
-            string startspeed_text = ftos_decimals(startspeed * speed_conversion_factor, 2);
-            if(autocvar_hud_panel_strafehud_unit_show)
-                startspeed_text = strcat(startspeed_text, GetSpeedUnit(autocvar_hud_panel_strafehud_unit));
+            if(autocvar_hud_panel_strafehud_startspeed)
+            {
+                float startspeed_height = autocvar_hud_panel_strafehud_startspeed_size * panel_size.y;
+                string startspeed_text = ftos_decimals(startspeed * speed_conversion_factor, 2);
+                if(autocvar_hud_panel_strafehud_unit_show)
+                    startspeed_text = strcat(startspeed_text, GetSpeedUnit(autocvar_hud_panel_strafehud_unit));
 
-            if(StrafeHUD_drawTextIndicator(startspeed_text, startspeed_height, autocvar_hud_panel_strafehud_startspeed_color, autocvar_hud_panel_strafehud_startspeed_fade, starttime, text_offset_bottom, STRAFEHUD_TEXT_BOTTOM))
-                text_offset_bottom += startspeed_height;
+                if(StrafeHUD_drawTextIndicator(startspeed_text, startspeed_height, autocvar_hud_panel_strafehud_startspeed_color, autocvar_hud_panel_strafehud_startspeed_fade, starttime, text_offset_bottom, STRAFEHUD_TEXT_BOTTOM))
+                    text_offset_bottom += startspeed_height;
+            }
         }
 
         // show height achieved by a single jump
@@ -1017,13 +1020,16 @@ void HUD_StrafeHUD()
                 }
             }
 
-            float jumpheight_height = autocvar_hud_panel_strafehud_jumpheight_size * panel_size.y;
-            string jumpheight_text = ftos_decimals(jumpheight * length_conversion_factor, length_decimals);
-            if(autocvar_hud_panel_strafehud_unit_show)
-                jumpheight_text = strcat(jumpheight_text, GetLengthUnit(autocvar_hud_panel_strafehud_unit));
+            if(autocvar_hud_panel_strafehud_jumpheight)
+            {
+                float jumpheight_height = autocvar_hud_panel_strafehud_jumpheight_size * panel_size.y;
+                string jumpheight_text = ftos_decimals(jumpheight * length_conversion_factor, length_decimals);
+                if(autocvar_hud_panel_strafehud_unit_show)
+                    jumpheight_text = strcat(jumpheight_text, GetLengthUnit(autocvar_hud_panel_strafehud_unit));
 
-            if(StrafeHUD_drawTextIndicator(jumpheight_text, jumpheight_height, autocvar_hud_panel_strafehud_jumpheight_color, autocvar_hud_panel_strafehud_jumpheight_fade, jumptime, text_offset_top, STRAFEHUD_TEXT_TOP))
-                text_offset_top += jumpheight_height;
+                if(StrafeHUD_drawTextIndicator(jumpheight_text, jumpheight_height, autocvar_hud_panel_strafehud_jumpheight_color, autocvar_hud_panel_strafehud_jumpheight_fade, jumptime, text_offset_top, STRAFEHUD_TEXT_TOP))
+                    text_offset_top += jumpheight_height;
+            }
         }
 
         draw_endBoldFont();
index 5eaa93dbbb526befbb909f0022acc1225b09a287..303d97d935f2178c58234f5a0f4fc2b0a48681c5 100644 (file)
@@ -30,23 +30,28 @@ AUTOCVAR_SAVE(hud_panel_strafehud_angle_arrow_size, float, 0.5, "size of the arr
 AUTOCVAR_SAVE(hud_panel_strafehud_bestangle, bool, true, "set to \"1\" to enable a ghost angle indicator showing the best angle to gain maximum acceleration");
 AUTOCVAR_SAVE(hud_panel_strafehud_bestangle_color, vector, '1 1 1', "color of the indicator showing the best angle to gain maximum acceleration");
 AUTOCVAR_SAVE(hud_panel_strafehud_bestangle_alpha, float, 0.5, "opacity of the indicator showing the best angle to gain maximum acceleration");
+AUTOCVAR_SAVE(hud_panel_strafehud_switch, bool, true, "set to \"1\" to enable the switch indicator showing the angle to move to when switching sides");
 AUTOCVAR_SAVE(hud_panel_strafehud_switch_minspeed, float, -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)");
 AUTOCVAR_SAVE(hud_panel_strafehud_switch_color, vector, '1 1 0', "color of the switch indicator");
 AUTOCVAR_SAVE(hud_panel_strafehud_switch_alpha, float, 1, "opacity of the switch indicator");
 AUTOCVAR_SAVE(hud_panel_strafehud_switch_width, float, 0.003, "width of the strafe angle indicator(s) (relative to the strafe bar width)");
+AUTOCVAR_SAVE(hud_panel_strafehud_direction, bool, false, "set to \"1\" to enable the direction caps to see in which direction you are currently strafing");
 AUTOCVAR_SAVE(hud_panel_strafehud_direction_color, vector, '0 0.5 1', "color of the direction caps which indicate the direction the player is currently strafing towards");
-AUTOCVAR_SAVE(hud_panel_strafehud_direction_alpha, float, 0, "opacity of the direction caps which indicate the direction the player is currently strafing towards");
+AUTOCVAR_SAVE(hud_panel_strafehud_direction_alpha, float, 1, "opacity of the direction caps which indicate the direction the player is currently strafing towards");
 AUTOCVAR_SAVE(hud_panel_strafehud_direction_width, float, 0.25, "stroke width of the direction caps which indicate the direction the player is currently strafing towards (relative to the panel height)");
 AUTOCVAR_SAVE(hud_panel_strafehud_direction_length, float, 0.02, "length of the horizontal component of the direction caps which indicate the direction the player is currently strafing towards (relative to the panel width)");
-AUTOCVAR_SAVE(hud_panel_strafehud_slickdetector_range, float, 200, "range of the slick detector in qu, \"0\" to disable");
+AUTOCVAR_SAVE(hud_panel_strafehud_slickdetector, bool, true, "set to \"1\" to enable the slick detector which notifies you if there is slick near you");
+AUTOCVAR_SAVE(hud_panel_strafehud_slickdetector_range, float, 200, "range of the slick detector in qu");
 AUTOCVAR_SAVE(hud_panel_strafehud_slickdetector_granularity, int, 1, "value from 0 to 4 which defines how exact the search for slick should be, higher values may yield better results but require more computation");
 AUTOCVAR_SAVE(hud_panel_strafehud_slickdetector_color, vector, '0 1 1', "color of the slick detector indicator");
 AUTOCVAR_SAVE(hud_panel_strafehud_slickdetector_alpha, float, 0.5, "opacity of the slick detector indicator");
 AUTOCVAR_SAVE(hud_panel_strafehud_slickdetector_height, float, 0.125, "height of the slick detector indicator (relative to the panel height)");
-AUTOCVAR_SAVE(hud_panel_strafehud_startspeed_fade, float, 4, "fade time (in seconds) of the start speed text or \"0\" to disable");
+AUTOCVAR_SAVE(hud_panel_strafehud_startspeed, bool, true, "set to \"1\" to enable the start speed indicator which shows you the speed you had while passing the start trigger of a race map");
+AUTOCVAR_SAVE(hud_panel_strafehud_startspeed_fade, float, 4, "fade time (in seconds) of the start speed text");
 AUTOCVAR_SAVE(hud_panel_strafehud_startspeed_color, vector, '1 0.75 0', "color of the start speed text");
 AUTOCVAR_SAVE(hud_panel_strafehud_startspeed_size, float, 1.5, "size of the start speed text (relative to the panel height)");
-AUTOCVAR_SAVE(hud_panel_strafehud_jumpheight_fade, float, 0, "fade time (in seconds) of the jump height text or \"0\" to disable");
+AUTOCVAR_SAVE(hud_panel_strafehud_jumpheight, bool, false, "set to \"1\" to enable the jump height indicator which tells you how high you jumped");
+AUTOCVAR_SAVE(hud_panel_strafehud_jumpheight_fade, float, 4, "fade time (in seconds) of the jump height text");
 AUTOCVAR_SAVE(hud_panel_strafehud_jumpheight_min, float, 50, "minimum jump height to display in the selected unit");
 AUTOCVAR_SAVE(hud_panel_strafehud_jumpheight_color, vector, '0 1 0.75', "color of the jump height text");
 AUTOCVAR_SAVE(hud_panel_strafehud_jumpheight_size, float, 1.5, "size of the jump height text (relative to the panel height)");
index cf4c0065f6012d8717047300381a12f98f76b848..c94bef7630e297cc1d0d62d9eb3140f00a655716 100644 (file)
@@ -24,7 +24,7 @@ void StrafeHUD_ColorReset(entity btn, entity me)
     cvar_set("hud_panel_strafehud_angle_neutral_color", cvar_defstring("hud_panel_strafehud_angle_neutral_color"));
     cvar_set("hud_panel_strafehud_angle_overturn_color", cvar_defstring("hud_panel_strafehud_angle_overturn_color"));
     cvar_set("hud_panel_strafehud_switch_color", cvar_defstring("hud_panel_strafehud_switch_color"));
-    cvar_set("hud_panel_strafehud_direction_color", cvar_defstring("hud_panel_strafehud_direction_color"));
+    cvar_set("hud_panel_strafehud_bestangle_color", cvar_defstring("hud_panel_strafehud_bestangle_color"));
 }
 
 void XonoticHUDStrafeHUDDialog_fill(entity me)
@@ -120,22 +120,26 @@ void XonoticHUDStrafeHUDDialog_fill(entity me)
 
         me.TD(me, 1, 1.9, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_strafehud_angle_alpha"));
     me.TR(me);
-        me.TD(me, 1, 1.9, e = makeXonoticTextLabel(0, _("Switch indicators:")));
+        me.TD(me, 1, 1.9, e = makeXonoticTextLabel(0, _("Switch indicator:")));
 
         me.TDempty(me, 0.2);
 
-        me.TD(me, 1, 1.9, e = makeXonoticTextLabel(0, _("Direction caps:")));
+        me.TD(me, 1, 1.9, e = makeXonoticTextLabel(0, _("Best angle indicator:")));
     me.TR(me);
         me.TD(me, 2, 1.9, e = makeXonoticColorpickerString("hud_panel_strafehud_switch_color", "hud_panel_strafehud_switch_color"));
 
         me.TDempty(me, 0.2);
 
-        me.TD(me, 2, 1.9, e = makeXonoticColorpickerString("hud_panel_strafehud_direction_color", "hud_panel_strafehud_direction_color"));
+        me.TD(me, 2, 1.9, e = makeXonoticColorpickerString("hud_panel_strafehud_bestangle_color", "hud_panel_strafehud_bestangle_color"));
     me.TR(me);
     me.TR(me);
-        me.TD(me, 1, 1.9, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_strafehud_switch_alpha"));
+        me.TD(me, 1, 0.9, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_strafehud_switch_alpha"));
+        me.TDempty(me, 0.1);
+        me.TD(me, 1, 0.9, e = makeXonoticCheckBoxString("1", "0", "hud_panel_strafehud_switch", _("Enable")));
 
         me.TDempty(me, 0.2);
 
-        me.TD(me, 1, 1.9, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_strafehud_direction_alpha"));
+        me.TD(me, 1, 0.9, e = makeXonoticSlider(0, 1, 0.1, "hud_panel_strafehud_bestangle_alpha"));
+        me.TDempty(me, 0.1);
+        me.TD(me, 1, 0.9, e = makeXonoticCheckBoxString("1", "0", "hud_panel_strafehud_bestangle", _("Enable")));
 }