]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: update the strafehud hud editor and add a dedicated cvar to disable option...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Wed, 18 Jan 2023 14:00:33 +0000 (15:00 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Wed, 18 Jan 2023 14:00:47 +0000 (15:00 +0100)
_hud_common.cfg
qcsrc/client/hud/panel/strafehud.qc
qcsrc/client/hud/panel/strafehud.qh
qcsrc/menu/xonotic/dialog_hudpanel_strafehud.qc

index 0089d5063b74c032f1145f48c9a0e474c293f587..ed53ab3ec37a9ce61f45fab82eabf5305a07a86b 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 e12e17a1882ab76c2b90bab57a099940250eeaa4..620a22ff0f9bfd8fd5180600fd3472aa6c075923 100644 (file)
@@ -701,7 +701,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;
@@ -733,7 +733,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;
@@ -779,7 +779,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
@@ -915,13 +915,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
@@ -948,13 +951,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 4d466ae9ab0b070766e1515358312dd6a7f8d115..2287598e6220aae724abdaa5889c59d16b0fe06d 100644 (file)
@@ -30,23 +30,28 @@ float autocvar_hud_panel_strafehud_angle_arrow_size = 0.5;
 bool autocvar_hud_panel_strafehud_bestangle = true;
 vector autocvar_hud_panel_strafehud_bestangle_color = '1 1 1';
 float autocvar_hud_panel_strafehud_bestangle_alpha = 0.5;
+bool autocvar_hud_panel_strafehud_switch = true;
 float autocvar_hud_panel_strafehud_switch_minspeed = -1;
 vector autocvar_hud_panel_strafehud_switch_color = '1 1 0';
 float autocvar_hud_panel_strafehud_switch_alpha = 1;
 float autocvar_hud_panel_strafehud_switch_width = 0.003;
+bool autocvar_hud_panel_strafehud_direction = false;
 vector autocvar_hud_panel_strafehud_direction_color = '0 0.5 1';
-float autocvar_hud_panel_strafehud_direction_alpha = 0;
+float autocvar_hud_panel_strafehud_direction_alpha = 1;
 float autocvar_hud_panel_strafehud_direction_width = 0.25;
 float autocvar_hud_panel_strafehud_direction_length = 0.02;
+bool autocvar_hud_panel_strafehud_slickdetector = true;
 float autocvar_hud_panel_strafehud_slickdetector_range = 200;
 int autocvar_hud_panel_strafehud_slickdetector_granularity = 1;
 vector autocvar_hud_panel_strafehud_slickdetector_color = '0 1 1';
 float autocvar_hud_panel_strafehud_slickdetector_alpha = 0.5;
 float autocvar_hud_panel_strafehud_slickdetector_height = 0.125;
+bool autocvar_hud_panel_strafehud_startspeed = true;
 float autocvar_hud_panel_strafehud_startspeed_fade = 4;
 vector autocvar_hud_panel_strafehud_startspeed_color = '1 0.75 0';
 float autocvar_hud_panel_strafehud_startspeed_size = 1.5;
-float autocvar_hud_panel_strafehud_jumpheight_fade = 0;
+bool autocvar_hud_panel_strafehud_jumpheight = false;
+float autocvar_hud_panel_strafehud_jumpheight_fade = 4;
 float autocvar_hud_panel_strafehud_jumpheight_min = 50;
 vector autocvar_hud_panel_strafehud_jumpheight_color = '0 1 0.75';
 float autocvar_hud_panel_strafehud_jumpheight_size = 1.5;
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")));
 }