]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add patch from Juhu/strafehud-fixes branch: "strafehud: add angle indicator styles...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Thu, 18 Mar 2021 14:25:45 +0000 (15:25 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Thu, 18 Mar 2021 14:25:45 +0000 (15:25 +0100)
_hud_common.cfg
qcsrc/client/hud/panel/strafehud.qc
qcsrc/client/hud/panel/strafehud.qh

index a62837f5f8b4f0881871938eb9246a8aaa534eb8..e99fb52348246c720b4b0235978911e9d12bdb00 100644 (file)
@@ -145,12 +145,17 @@ seta hud_panel_strafehud_bar_accel_color "0 1 0" "color of the strafe meter acce
 seta hud_panel_strafehud_bar_accel_alpha "0.3" "opacity of the strafe meter acceleration zone"
 seta hud_panel_strafehud_bar_overturn_color "1 0 1" "color of the strafe meter overturn zone"
 seta hud_panel_strafehud_bar_overturn_alpha "0.3" "opacity of the strafe meter overturn zone"
+seta hud_panel_strafehud_angle_style "2" "set the angle indicator style: 0 = solid line, 1 = dashed line, 2 = none"
+seta hud_panel_strafehud_angle_dashes "4" "determines the amount of dashes if the angle indicator uses a dashed line"
 seta hud_panel_strafehud_angle_alpha "0.8" "opacity of the indicator showing the player's current angle"
 seta hud_panel_strafehud_angle_height "1.5" "height of the indicator showing the player's current angle (relative to the panel height)"
 seta hud_panel_strafehud_angle_width "0.005" "width of the indicator showing the player's current angle (relative to the panel width)"
 seta hud_panel_strafehud_angle_neutral_color "1 1 0" "color of the indicator showing the player's current angle if the player's angle is within the neutral zone"
 seta hud_panel_strafehud_angle_accel_color "0 1 1" "color of the indicator showing the player's current angle if the player's angle is within the acceleration zone"
 seta hud_panel_strafehud_angle_overturn_color "1 0 1" "color of the indicator showing the player's current angle if the player's angle is within the overturn zone"
+seta hud_panel_strafehud_angle_arrow "1" "set the angle indicators arrow style: 0 = none, 1 = top, 2 = bottom, 3 = both"
+seta hud_panel_strafehud_angle_arrow_height "0.5" "height of the arrow (relative to the panel height)"
+seta hud_panel_strafehud_angle_arrow_width "0.03" "width of the arrow (relative to the panel width)"
 seta hud_panel_strafehud_switch_minspeed "-1" "minimum speed in qu/s at which switch indicators which are used to aid changing strafe direction will be shown (uses physics maxspeed + antiflicker speed if negative)"
 seta hud_panel_strafehud_switch_active_color "0 1 0" "color of the switch indicator on the current side"
 seta hud_panel_strafehud_switch_active_alpha "1" "opacity of the switch indicator on the current side"
index 1d86963e6d3f2955caa97da50061067c50e001db..6cf82e70147e5dfdf0b79e90f40c3615b060ccc4 100644 (file)
@@ -804,7 +804,40 @@ void HUD_StrafeHUD()
 
         if(currentangle_size.x > 0 && currentangle_size.y > 0 && autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha > 0)
         {
-            drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2) + eX * (currentangle_offset - currentangle_size.x/2), currentangle_size, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+            switch(autocvar_hud_panel_strafehud_angle_style)
+            {
+                case 0:
+                    drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2) + eX * (currentangle_offset - currentangle_size.x/2), currentangle_size, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                    break;
+                case 1:
+                    vector line_size = currentangle_size;
+                    line_size.y = currentangle_size.y / (bound(2, autocvar_hud_panel_strafehud_angle_dashes, 100)*2-1);
+                    for(float i = 0; i < currentangle_size.y; i += line_size.y*2)
+                    {
+                        if(i + line_size.y*2 >= currentangle_size.y) line_size.y = currentangle_size.y - i;
+                        drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2 - i) + eX * (currentangle_offset - line_size.x/2), line_size, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                    }
+                    break;
+                case 2:
+                default:
+            }
+
+            if(autocvar_hud_panel_strafehud_angle_arrow > 0)
+            {
+                vector arrow_size = currentangle_size;
+                arrow_size.x = max(panel_size.x * autocvar_hud_panel_strafehud_angle_arrow_width, 1);
+                arrow_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_arrow_height, 1), 1);
+                vector arrow_fragment = '0 0.25 0';
+
+                for(float i = arrow_size.y; i > 0; i -= arrow_fragment.y)
+                {
+                    arrow_fragment.x = arrow_size.x * (i/arrow_size.y);
+                    if(autocvar_hud_panel_strafehud_angle_arrow == 1 || autocvar_hud_panel_strafehud_angle_arrow >= 3)
+                        drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2 + i) + eX * (currentangle_offset - arrow_fragment.x/2), arrow_fragment, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                    if(autocvar_hud_panel_strafehud_angle_arrow >= 2)
+                        drawfill(panel_pos + eY * (-(currentangle_size.y - panel_size.y) / 2 + currentangle_size.y + i - arrow_fragment.y) + eX * (currentangle_offset - arrow_fragment.x/2), arrow_fragment, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                }
+            }
         }
     }
 }
index ac984ed7518ad86927d98e61b24d748b58adf9bb..d057d953a94ad913e77d622c3475973b8cfdacd8 100644 (file)
@@ -15,12 +15,17 @@ AUTOCVAR_SAVE(hud_panel_strafehud_bar_accel_color, vector, '0 1 0', "color of th
 AUTOCVAR_SAVE(hud_panel_strafehud_bar_accel_alpha, float, 0.3, "opacity of the strafe meter acceleration zone");
 AUTOCVAR_SAVE(hud_panel_strafehud_bar_overturn_color, vector, '1 0 1', "color of the strafe meter overturn zone");
 AUTOCVAR_SAVE(hud_panel_strafehud_bar_overturn_alpha, float, 0.3, "opacity of the strafe meter overturn zone");
+AUTOCVAR_SAVE(hud_panel_strafehud_angle_style, int, 2, "set the angle indicator style: 0 = solid line, 1 = dashed line, 2 = none");
+AUTOCVAR_SAVE(hud_panel_strafehud_angle_dashes, int, 4, "determines the amount of dashes if the angle indicator uses a dashed line");
 AUTOCVAR_SAVE(hud_panel_strafehud_angle_alpha, float, 0.8, "opacity of the indicator showing the player's current angle");
 AUTOCVAR_SAVE(hud_panel_strafehud_angle_height, float, 1.5, "height of the indicator showing the player's current angle (relative to the panel height)");
 AUTOCVAR_SAVE(hud_panel_strafehud_angle_width, float, 0.005, "width of the indicator showing the player's current angle (relative to the panel width)");
 AUTOCVAR_SAVE(hud_panel_strafehud_angle_neutral_color, vector, '1 1 0', "color of the indicator showing the player's current angle if the player's angle is within the neutral zone");
 AUTOCVAR_SAVE(hud_panel_strafehud_angle_accel_color, vector, '0 1 1', "color of the indicator showing the player's current angle if the player's angle is within the acceleration zone");
 AUTOCVAR_SAVE(hud_panel_strafehud_angle_overturn_color, vector, '1 0 1', "color of the indicator showing the player's current angle if the player's angle is within the overturn zone");
+AUTOCVAR_SAVE(hud_panel_strafehud_angle_arrow, int, 1, "set the angle indicators arrow style: 0 = none, 1 = top, 2 = bottom, 3 = both");
+AUTOCVAR_SAVE(hud_panel_strafehud_angle_arrow_height, float, 0.5, "height of the arrow (relative to the panel height)");
+AUTOCVAR_SAVE(hud_panel_strafehud_angle_arrow_width, float, 0.03, "width of the arrow (relative to the panel width)");
 AUTOCVAR_SAVE(hud_panel_strafehud_switch_minspeed, float, -1, "minimum speed in qu/s at which switch indicators which are used to aid changing strafe direction will be shown (uses physics maxspeed + antiflicker speed if negative)");
 AUTOCVAR_SAVE(hud_panel_strafehud_switch_active_color, vector, '0 1 0', "color of the switch indicator on the current side");
 AUTOCVAR_SAVE(hud_panel_strafehud_switch_active_alpha, float, 1, "opacity of the switch indicator on the current side");