From 0b4c340104afa0fd18d3d253f1967b25f09c8871 Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 12 Apr 2023 14:16:47 +0200 Subject: [PATCH] Hud editor: show a "Center line" checkbox in the hud editor menu --- qcsrc/client/hud/hud_config.qc | 2 ++ qcsrc/menu/xonotic/dialog_hudsetup_exit.qc | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/qcsrc/client/hud/hud_config.qc b/qcsrc/client/hud/hud_config.qc index 8bdf0c4b8..726b2e78d 100644 --- a/qcsrc/client/hud/hud_config.qc +++ b/qcsrc/client/hud/hud_config.qc @@ -1133,6 +1133,8 @@ void HUD_Panel_HlCenterLine(float myBorder) for (int i = 0; i < n; ++i) { float xpos_rel = stof(argv(i)); + if (xpos_rel <= 0 || xpos_rel >= 1) + continue; float ofs = fabs(panel_centerpos_x / vid_conwidth - xpos_rel); if (ofs < 0.02) // don't bother showing the center line if it's evident that the panel is not centered { diff --git a/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc b/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc index cf65049ea..6cfcef251 100644 --- a/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc +++ b/qcsrc/menu/xonotic/dialog_hudsetup_exit.qc @@ -118,10 +118,8 @@ void XonoticHUDExitDialog_fill(entity me) e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10))); e.configureXonoticTextSliderValues(e); me.TR(me); - me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Grid settings:"))); - me.TR(me); - me.TDempty(me, 0.2); - me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_configure_grid", _("Snap panels to grid"))); + me.TD(me, 1, 1.4, makeXonoticTextLabel(0, _("Grid settings:"))); + me.TD(me, 1, 2.6, e = makeXonoticCheckBox(0, "hud_configure_grid", _("Snap panels to grid"))); me.TR(me); me.TDempty(me, 0.2); me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Grid size:"))); @@ -140,6 +138,11 @@ void XonoticHUDExitDialog_fill(entity me) e.addValue(e, strzone(sprintf("%.1f%%", i/2)), strzone(ftos(i/200))); e.configureXonoticTextSliderValues(e); setDependent(e, "hud_configure_grid", 1, 1); + me.TR(me); + me.TDempty(me, 0.2); + string vertical_lines_cvarname = "hud_configure_vertical_lines"; + me.TD(me, 1, 3.6, e = makeXonoticCheckBoxEx_T(0.5, 0, vertical_lines_cvarname, _("Center line"), + sprintf(_("Show a vertical centerline to help align panels. It's possible to show more vertical lines by editing %s in the console"), vertical_lines_cvarname))); me.gotoRC(me, me.rows - 1, 0); me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Exit setup"), '0 0 0', "_hud_configure 0", COMMANDBUTTON_CLOSE)); -- 2.39.2