draw the IDRATE widget exclusively (#1556)

Fixes #1533
This commit is contained in:
Fabian Greffrath 2024-03-05 11:52:42 +01:00 committed by GitHub
parent ec4770585e
commit 1448fd85b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View File

@ -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, // [FG] centered and Vanilla widgets are always exclusive,
// i.e. they don't allow any other widget on the same line // 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) if (v_align == align_top)
{ {
@ -509,6 +509,8 @@ void HUlib_init_multiline(hu_multiline_t *m,
m->builder = builder; m->builder = builder;
m->built = false; m->built = false;
m->exclusive = (m->on != NULL);
} }
void HUlib_erase_widget (const hu_widget_t *const w) void HUlib_erase_widget (const hu_widget_t *const w)

View File

@ -104,6 +104,8 @@ typedef struct hu_multiline_s
void (*builder)(void); void (*builder)(void);
boolean built; boolean built;
boolean exclusive;
} hu_multiline_t; } hu_multiline_t;
// [FG] configured alignment and coordinates for multilines // [FG] configured alignment and coordinates for multilines

View File

@ -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] = { static hu_widget_t boom_widgets[MAX_HUDS][MAX_WIDGETS_B] = {
{ {
{&w_rate, align_left, align_top},
{&w_monsec, align_left, align_top}, {&w_monsec, align_left, align_top},
{&w_sttime, align_left, align_top}, {&w_sttime, align_left, align_top},
{&w_coord, align_right, align_top}, {&w_coord, align_right, align_top},
{&w_fps, align_right, align_top}, {&w_fps, align_right, align_top},
{&w_rate, align_left, align_top},
{NULL} {NULL}
}, { }, {
{&w_rate, align_left, align_top},
{&w_armor, align_left, align_bottom}, {&w_armor, align_left, align_bottom},
{&w_health, align_left, align_bottom}, {&w_health, align_left, align_bottom},
{&w_ammo, 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_sttime, align_left, align_bottom},
{&w_coord, align_right, align_top}, {&w_coord, align_right, align_top},
{&w_fps, align_right, align_top}, {&w_fps, align_right, align_top},
{&w_rate, align_left, align_top},
{NULL} {NULL}
}, { }, {
{&w_rate, align_left, align_top},
{&w_health, align_right, align_top}, {&w_health, align_right, align_top},
{&w_armor, align_right, align_top}, {&w_armor, align_right, align_top},
{&w_ammo, align_right, align_bottom}, {&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_sttime, align_left, align_bottom},
{&w_coord , align_right, align_top}, {&w_coord , align_right, align_top},
{&w_fps, align_right, align_top}, {&w_fps, align_right, align_top},
{&w_rate, align_left, align_top},
{NULL} {NULL}
} }
}; };
@ -671,6 +671,8 @@ void HU_Start(void)
HUlib_init_multiline(&w_rate, (voxels_rendering ? 2 : 1), HUlib_init_multiline(&w_rate, (voxels_rendering ? 2 : 1),
&boom_font, colrngs[hudcolor_xyco], &boom_font, colrngs[hudcolor_xyco],
NULL, HU_widget_build_rate); NULL, HU_widget_build_rate);
// [FG] draw the IDRATE widget exclusively
w_rate.exclusive = true;
HU_set_centered_message(false); HU_set_centered_message(false);