mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 19:38:06 -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->l[0] = 0;
|
||||||
t->needsupdate = true;
|
t->needsupdate = true;
|
||||||
t->width = 0;
|
t->width = 0;
|
||||||
|
t->visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -159,6 +160,7 @@ void HUlib_addStringToTextLine(hu_textline_t *l, char *s)
|
|||||||
w -= 4;
|
w -= 4;
|
||||||
|
|
||||||
l->width = w;
|
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;
|
patch_t *const *const f = *l->f;
|
||||||
const int font_height = SHORT(f['A'-HU_FONTSTART]->height) + 1;
|
const int font_height = SHORT(f['A'-HU_FONTSTART]->height) + 1;
|
||||||
|
|
||||||
if (l->width)
|
if (l->visible)
|
||||||
{
|
{
|
||||||
if (align == align_topleft)
|
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)
|
void HUlib_drawIText(hu_itext_t *it, align_t align)
|
||||||
{
|
{
|
||||||
hu_textline_t *l = &it->l;
|
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
|
HUlib_drawTextLineAligned(l, align, true); // draw the line w/ cursor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ typedef struct
|
|||||||
int needsupdate;
|
int needsupdate;
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
|
boolean visible;
|
||||||
|
|
||||||
} hu_textline_t;
|
} 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
|
static hu_textline_t w_sttime; // time above status bar
|
||||||
|
|
||||||
#define MAX_HUDS 3
|
#define MAX_HUDS 3
|
||||||
#define MAX_WIDGETS 10
|
#define MAX_WIDGETS 12
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
hu_textline_t *widget;
|
hu_textline_t *widget;
|
||||||
@ -136,12 +136,16 @@ typedef struct {
|
|||||||
|
|
||||||
static widget_t widgets[MAX_HUDS][MAX_WIDGETS] = {
|
static widget_t widgets[MAX_HUDS][MAX_WIDGETS] = {
|
||||||
{
|
{
|
||||||
|
{&w_title, align_bottomleft},
|
||||||
|
|
||||||
{&w_monsec, align_bottomleft},
|
{&w_monsec, align_bottomleft},
|
||||||
{&w_sttime, align_bottomleft},
|
{&w_sttime, align_bottomleft},
|
||||||
{&w_coord, align_topright},
|
{&w_coord, align_topright},
|
||||||
{&w_fps, align_topright},
|
{&w_fps, align_topright},
|
||||||
{NULL}
|
{NULL}
|
||||||
}, {
|
}, {
|
||||||
|
{&w_title, align_bottomleft},
|
||||||
|
|
||||||
{&w_armor, align_bottomleft},
|
{&w_armor, align_bottomleft},
|
||||||
{&w_health, align_bottomleft},
|
{&w_health, align_bottomleft},
|
||||||
{&w_ammo, align_bottomleft},
|
{&w_ammo, align_bottomleft},
|
||||||
@ -154,6 +158,8 @@ static widget_t widgets[MAX_HUDS][MAX_WIDGETS] = {
|
|||||||
{&w_fps, align_topright},
|
{&w_fps, align_topright},
|
||||||
{NULL}
|
{NULL}
|
||||||
}, {
|
}, {
|
||||||
|
{&w_title, align_bottomleft},
|
||||||
|
|
||||||
{&w_health, align_topright},
|
{&w_health, align_topright},
|
||||||
{&w_armor, align_topright},
|
{&w_armor, align_topright},
|
||||||
{&w_ammo, align_bottomright},
|
{&w_ammo, align_bottomright},
|
||||||
@ -500,7 +506,7 @@ void HU_ResetWidgets (void)
|
|||||||
widget->widget->x = widget->x;
|
widget->widget->x = widget->x;
|
||||||
widget->widget->y = widget->y;
|
widget->widget->y = widget->y;
|
||||||
}
|
}
|
||||||
widget->widget->width = 0;
|
widget->widget->visible = false;
|
||||||
widget++;
|
widget++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1361,14 +1367,6 @@ void HU_Drawer(void)
|
|||||||
// display the interactive buffer for chat entry
|
// display the interactive buffer for chat entry
|
||||||
HUlib_drawIText(&w_chat, align_topleft);
|
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)
|
if (draw_crispy_hud)
|
||||||
{
|
{
|
||||||
ST_Drawer (false, true);
|
ST_Drawer (false, true);
|
||||||
@ -1579,8 +1577,13 @@ void HU_Ticker(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// draw the automap widgets if automap is displayed
|
||||||
|
|
||||||
if (automapactive)
|
if (automapactive)
|
||||||
{
|
{
|
||||||
|
// map title
|
||||||
|
w_title.visible = true;
|
||||||
|
|
||||||
if (map_level_stats)
|
if (map_level_stats)
|
||||||
HU_widget_build_monsec();
|
HU_widget_build_monsec();
|
||||||
|
|
||||||
@ -1854,15 +1857,16 @@ static const struct {
|
|||||||
const char *name, *altname;
|
const char *name, *altname;
|
||||||
hu_textline_t *const widget;
|
hu_textline_t *const widget;
|
||||||
} w_names[] = {
|
} w_names[] = {
|
||||||
{"armor", NULL, &w_armor},
|
{"title", "levelname", &w_title},
|
||||||
{"health", NULL, &w_health},
|
{"armor", NULL, &w_armor},
|
||||||
{"ammo", NULL, &w_ammo},
|
{"health", NULL, &w_health},
|
||||||
{"weapon", "weapons", &w_weapon},
|
{"ammo", NULL, &w_ammo},
|
||||||
{"keys", NULL, &w_keys},
|
{"weapon", "weapons", &w_weapon},
|
||||||
{"monsec", "stats", &w_monsec},
|
{"keys", NULL, &w_keys},
|
||||||
{"sttime", "time", &w_sttime},
|
{"monsec", "stats", &w_monsec},
|
||||||
{"coord", "coords", &w_coord},
|
{"sttime", "time", &w_sttime},
|
||||||
{"fps", "rate", &w_fps},
|
{"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)
|
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