mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
let the map title widget align by the WOOFHUD lump (#906)
* let the map title widget align by the WOOFHUD lump * actually add w_title to the w_names[] array
This commit is contained in:
parent
9fd1100d8d
commit
6f85897f8d
@ -82,6 +82,7 @@ void HUlib_clearTextLine(hu_textline_t* t)
|
||||
t->l[0] = 0;
|
||||
t->needsupdate = true;
|
||||
t->width = 0;
|
||||
t->visible = false;
|
||||
}
|
||||
|
||||
//
|
||||
@ -159,6 +160,7 @@ void HUlib_addStringToTextLine(hu_textline_t *l, char *s)
|
||||
w -= 4;
|
||||
|
||||
l->width = w;
|
||||
l->visible = true;
|
||||
}
|
||||
|
||||
//
|
||||
@ -198,7 +200,7 @@ void HUlib_drawTextLineAligned(hu_textline_t *l, align_t align, boolean drawcurs
|
||||
patch_t *const *const f = *l->f;
|
||||
const int font_height = SHORT(f['A'-HU_FONTSTART]->height) + 1;
|
||||
|
||||
if (l->width)
|
||||
if (l->visible)
|
||||
{
|
||||
if (align == align_topleft)
|
||||
{
|
||||
@ -655,7 +657,7 @@ boolean HUlib_keyInIText(hu_itext_t *it, unsigned char ch)
|
||||
void HUlib_drawIText(hu_itext_t *it, align_t align)
|
||||
{
|
||||
hu_textline_t *l = &it->l;
|
||||
if ((l->width = *it->on))
|
||||
if ((l->visible = *it->on))
|
||||
HUlib_drawTextLineAligned(l, align, true); // draw the line w/ cursor
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,7 @@ typedef struct
|
||||
int needsupdate;
|
||||
|
||||
int width;
|
||||
boolean visible;
|
||||
|
||||
} hu_textline_t;
|
||||
|
||||
|
@ -126,7 +126,7 @@ static hu_stext_t w_secret; // [crispy] secret message widget
|
||||
static hu_textline_t w_sttime; // time above status bar
|
||||
|
||||
#define MAX_HUDS 3
|
||||
#define MAX_WIDGETS 10
|
||||
#define MAX_WIDGETS 12
|
||||
|
||||
typedef struct {
|
||||
hu_textline_t *widget;
|
||||
@ -136,12 +136,16 @@ typedef struct {
|
||||
|
||||
static widget_t widgets[MAX_HUDS][MAX_WIDGETS] = {
|
||||
{
|
||||
{&w_title, align_bottomleft},
|
||||
|
||||
{&w_monsec, align_bottomleft},
|
||||
{&w_sttime, align_bottomleft},
|
||||
{&w_coord, align_topright},
|
||||
{&w_fps, align_topright},
|
||||
{NULL}
|
||||
}, {
|
||||
{&w_title, align_bottomleft},
|
||||
|
||||
{&w_armor, align_bottomleft},
|
||||
{&w_health, align_bottomleft},
|
||||
{&w_ammo, align_bottomleft},
|
||||
@ -154,6 +158,8 @@ static widget_t widgets[MAX_HUDS][MAX_WIDGETS] = {
|
||||
{&w_fps, align_topright},
|
||||
{NULL}
|
||||
}, {
|
||||
{&w_title, align_bottomleft},
|
||||
|
||||
{&w_health, align_topright},
|
||||
{&w_armor, align_topright},
|
||||
{&w_ammo, align_bottomright},
|
||||
@ -500,7 +506,7 @@ void HU_ResetWidgets (void)
|
||||
widget->widget->x = widget->x;
|
||||
widget->widget->y = widget->y;
|
||||
}
|
||||
widget->widget->width = 0;
|
||||
widget->widget->visible = false;
|
||||
widget++;
|
||||
}
|
||||
}
|
||||
@ -1361,14 +1367,6 @@ void HU_Drawer(void)
|
||||
// display the interactive buffer for chat entry
|
||||
HUlib_drawIText(&w_chat, align_topleft);
|
||||
|
||||
// draw the automap widgets if automap is displayed
|
||||
|
||||
if (automapactive) // [FG] moved here
|
||||
{
|
||||
// map title
|
||||
HUlib_drawTextLineAligned(&w_title, align_bottomleft, false);
|
||||
}
|
||||
|
||||
if (draw_crispy_hud)
|
||||
{
|
||||
ST_Drawer (false, true);
|
||||
@ -1579,8 +1577,13 @@ void HU_Ticker(void)
|
||||
}
|
||||
}
|
||||
|
||||
// draw the automap widgets if automap is displayed
|
||||
|
||||
if (automapactive)
|
||||
{
|
||||
// map title
|
||||
w_title.visible = true;
|
||||
|
||||
if (map_level_stats)
|
||||
HU_widget_build_monsec();
|
||||
|
||||
@ -1854,15 +1857,16 @@ static const struct {
|
||||
const char *name, *altname;
|
||||
hu_textline_t *const widget;
|
||||
} w_names[] = {
|
||||
{"armor", NULL, &w_armor},
|
||||
{"health", NULL, &w_health},
|
||||
{"ammo", NULL, &w_ammo},
|
||||
{"weapon", "weapons", &w_weapon},
|
||||
{"keys", NULL, &w_keys},
|
||||
{"monsec", "stats", &w_monsec},
|
||||
{"sttime", "time", &w_sttime},
|
||||
{"coord", "coords", &w_coord},
|
||||
{"fps", "rate", &w_fps},
|
||||
{"title", "levelname", &w_title},
|
||||
{"armor", NULL, &w_armor},
|
||||
{"health", NULL, &w_health},
|
||||
{"ammo", NULL, &w_ammo},
|
||||
{"weapon", "weapons", &w_weapon},
|
||||
{"keys", NULL, &w_keys},
|
||||
{"monsec", "stats", &w_monsec},
|
||||
{"sttime", "time", &w_sttime},
|
||||
{"coord", "coords", &w_coord},
|
||||
{"fps", "rate", &w_fps},
|
||||
};
|
||||
|
||||
static boolean HU_AddToWidgets (hu_textline_t *widget, int hud, align_t align, int x, int y)
|
||||
|
Loading…
x
Reference in New Issue
Block a user