From 1448fd85b05da4bd1123b70f58793804241375b0 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Tue, 5 Mar 2024 11:52:42 +0100 Subject: [PATCH] draw the IDRATE widget exclusively (#1556) Fixes #1533 --- src/hu_lib.c | 4 +++- src/hu_lib.h | 2 ++ src/hu_stuff.c | 8 +++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/hu_lib.c b/src/hu_lib.c index 7b2cde5a..6b974d9a 100644 --- a/src/hu_lib.c +++ b/src/hu_lib.c @@ -262,7 +262,7 @@ static int vert_align_widget(const hu_widget_t *const w, const hu_multiline_t *c } // [FG] centered and Vanilla widgets are always exclusive, // i.e. they don't allow any other widget on the same line - else if (h_align == align_center || m->on) + else if (h_align == align_center || m->exclusive) { if (v_align == align_top) { @@ -509,6 +509,8 @@ void HUlib_init_multiline(hu_multiline_t *m, m->builder = builder; m->built = false; + + m->exclusive = (m->on != NULL); } void HUlib_erase_widget (const hu_widget_t *const w) diff --git a/src/hu_lib.h b/src/hu_lib.h index 742b34f5..9a9763cb 100644 --- a/src/hu_lib.h +++ b/src/hu_lib.h @@ -104,6 +104,8 @@ typedef struct hu_multiline_s void (*builder)(void); boolean built; + boolean exclusive; + } hu_multiline_t; // [FG] configured alignment and coordinates for multilines diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 66592612..2357ed8f 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -164,13 +164,14 @@ static hu_widget_t doom_widgets[MAX_HUDS][MAX_WIDGETS_D] = { static hu_widget_t boom_widgets[MAX_HUDS][MAX_WIDGETS_B] = { { + {&w_rate, align_left, align_top}, {&w_monsec, align_left, align_top}, {&w_sttime, align_left, align_top}, {&w_coord, align_right, align_top}, {&w_fps, align_right, align_top}, - {&w_rate, align_left, align_top}, {NULL} }, { + {&w_rate, align_left, align_top}, {&w_armor, align_left, align_bottom}, {&w_health, align_left, align_bottom}, {&w_ammo, align_left, align_bottom}, @@ -181,9 +182,9 @@ static hu_widget_t boom_widgets[MAX_HUDS][MAX_WIDGETS_B] = { {&w_sttime, align_left, align_bottom}, {&w_coord, align_right, align_top}, {&w_fps, align_right, align_top}, - {&w_rate, align_left, align_top}, {NULL} }, { + {&w_rate, align_left, align_top}, {&w_health, align_right, align_top}, {&w_armor, align_right, align_top}, {&w_ammo, align_right, align_bottom}, @@ -194,7 +195,6 @@ static hu_widget_t boom_widgets[MAX_HUDS][MAX_WIDGETS_B] = { {&w_sttime, align_left, align_bottom}, {&w_coord , align_right, align_top}, {&w_fps, align_right, align_top}, - {&w_rate, align_left, align_top}, {NULL} } }; @@ -671,6 +671,8 @@ void HU_Start(void) HUlib_init_multiline(&w_rate, (voxels_rendering ? 2 : 1), &boom_font, colrngs[hudcolor_xyco], NULL, HU_widget_build_rate); + // [FG] draw the IDRATE widget exclusively + w_rate.exclusive = true; HU_set_centered_message(false);