From 58da008afee39022a54dc4600ba4673101820076 Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Tue, 5 May 2020 12:03:29 +0200 Subject: [PATCH] added an option to put the hud angle in the middle during hud configure --- _hud_common.cfg | 1 + qcsrc/client/autocvars.qh | 1 + qcsrc/client/hud/panel/strafehud.qc | 23 +++++++++++++------ .../menu/xonotic/dialog_hudpanel_strafehud.qc | 21 +++++++++-------- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index a3273761b..a31bebd81 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -123,6 +123,7 @@ seta hud_panel_scoreboard_accuracy_showdelay_minpos 0.75 "delay displaying the a seta hud_panel_scoreboard_team_size_position 0 "where to show the team size (0 = do not show, 1 = left of scoreboard, 2 = right of scoreboard), will move team scores to the other side if necessary" seta _hud_panel_strafehud_demo "0" "HUD changes angle during configure" +seta _hud_panel_strafehud_center "0" "puts the angle indicator in the center during HUD configure" seta hud_panel_strafehud_bar_alpha ".2" "opacity of the strafe meter" seta hud_panel_strafehud_bar_color "1 1 1" "color of the strafe meter" seta hud_panel_strafehud_indicator_color "0 1 0" "color of the strafe angle indicator" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 706cd3305..49f519f94 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -322,6 +322,7 @@ bool autocvar_hud_panel_score; bool autocvar_hud_panel_score_rankings; bool autocvar_hud_panel_strafehud; bool autocvar__hud_panel_strafehud_demo; +bool autocvar__hud_panel_strafehud_center; float autocvar_hud_panel_strafehud_bar_alpha; vector autocvar_hud_panel_strafehud_bar_color; vector autocvar_hud_panel_strafehud_indicator_color; diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 0ad0c29a2..3f553c351 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -300,17 +300,26 @@ void HUD_StrafeHUD() } else // simulate turning for HUD setup { - if(autocvar__hud_panel_strafehud_demo && ((time - strafehud_demo_time) >= .025)) + if(autocvar__hud_panel_strafehud_center) { - strafehud_demo_time = time; - strafehud_demo_angle += 1 * strafehud_demo_direction; - if(fabs(strafehud_demo_angle) >= 55) + strafehud_angle = strafehud_demo_angle = 0; + strafehud_demo_time = 0; + strafehud_wishangle = 0; + } + else + { + if(autocvar__hud_panel_strafehud_demo && ((time - strafehud_demo_time) >= .025)) { - strafehud_demo_direction = -strafehud_demo_direction; + strafehud_demo_time = time; + strafehud_demo_angle += strafehud_demo_direction; + if(fabs(strafehud_demo_angle) >= 55) + { + strafehud_demo_direction = -strafehud_demo_direction; + } } + strafehud_angle = strafehud_demo_angle; + strafehud_wishangle = 45 * (strafehud_demo_angle > 0 ? 1 : -1); } - strafehud_angle = strafehud_demo_angle; - strafehud_wishangle = 45 * (strafehud_demo_angle > 0 ? 1 : -1); } if (autocvar_v_flipped) diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_strafehud.qc b/qcsrc/menu/xonotic/dialog_hudpanel_strafehud.qc index 3c8ec9ab4..cc68fade3 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_strafehud.qc +++ b/qcsrc/menu/xonotic/dialog_hudpanel_strafehud.qc @@ -35,10 +35,18 @@ void XonoticHUDStrafeHUDDialog_fill(entity me) me.TR(me); me.TD(me, 1, 1.2, e = makeXonoticCheckBoxString("1", "0", "_hud_panel_strafehud_demo", _("Demo mode"))); - me.TDempty(me, 0.4); + setDependentStringNotEqual(e, "_hud_panel_strafehud_center", "1"); + me.TDempty(me, 0.4); me.TD(me, 1, 0.6, e = makeXonoticTextLabel(0, _("Range:"))); me.TD(me, 1, 1.8, e = makeXonoticSlider(0, 360, 5, "hud_panel_strafehud_angle")); + me.TR(me); + me.TD(me, 1, 1.2, e = makeXonoticCheckBoxString("1", "0", "_hud_panel_strafehud_center", _("Center angle"))); + + me.TDempty(me, 0.9); + me.TD(me, 1, 1.9, e = makeXonoticButton(_("Reset colors"), '0 0 0')); + e.onClick = StrafeHUD_ColorReset; + e.onClickEntity = me; me.TR(me); me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Strafe bar:"))); @@ -77,17 +85,12 @@ void XonoticHUDStrafeHUDDialog_fill(entity me) me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Active:"))); me.TDempty(me, 0.1); me.TD(me, 1, 0.9, e = makeXonoticTextLabel(0, _("Inactive:"))); - - me.TDempty(me, 0.1); - me.TD(me, 2, 1.9, e = makeXonoticColorpickerString("hud_panel_strafehud_direction_color", "hud_panel_strafehud_direction_color")); me.TR(me); me.TDempty(me, 0.1); me.TD(me, 2, 0.9, e = makeXonoticColorpickerString("hud_panel_strafehud_indicator_color", "hud_panel_strafehud_indicator_color")); me.TDempty(me, 0.1); me.TD(me, 2, 0.9, e = makeXonoticColorpickerString("hud_panel_strafehud_indicator_switch_color", "hud_panel_strafehud_indicator_switch_color")); - me.TR(me); - me.TDempty(me, 2.1); - me.TD(me, 1, 1.9, e = makeXonoticButton(_("Reset colors"), '0 0 0')); - e.onClick = StrafeHUD_ColorReset; - e.onClickEntity = me; + + me.TDempty(me, 0.1); + me.TD(me, 2, 1.9, e = makeXonoticColorpickerString("hud_panel_strafehud_direction_color", "hud_panel_strafehud_direction_color")); } -- 2.39.2