mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Shrink the MenuFont_t struct.
git-svn-id: https://svn.eduke32.com/eduke32@6195 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
8e73029ecc
commit
f2b7650305
2 changed files with 52 additions and 53 deletions
|
@ -170,15 +170,15 @@ they effectively stand in for curly braces as struct initializers.
|
||||||
|
|
||||||
// common font types
|
// common font types
|
||||||
// tilenums are set after namesdyn runs
|
// tilenums are set after namesdyn runs
|
||||||
static MenuFont_t MF_Null = { -1, 10, 0, 0, 0, 0, 0, 0, 0 };
|
static MenuFont_t MF_Null = { { 0, 0 }, { 0, 0 }, 0, -1, 10, 0, 0 };
|
||||||
static MenuFont_t MF_Redfont = { -1, 10, 0, 1, 5<<16, 15<<16, 0<<16, 0<<16, TEXT_BIGALPHANUM | TEXT_UPPERCASE };
|
static MenuFont_t MF_Redfont = { { 5<<16, 15<<16 }, { 0, 0 }, TEXT_BIGALPHANUM | TEXT_UPPERCASE, -1, 10, 0, 1 };
|
||||||
static MenuFont_t MF_RedfontBlue = { -1, 10, 1, 1, 5<<16, 15<<16, 0<<16, 0<<16, TEXT_BIGALPHANUM | TEXT_UPPERCASE };
|
static MenuFont_t MF_RedfontBlue = { { 5<<16, 15<<16 }, { 0, 0 }, TEXT_BIGALPHANUM | TEXT_UPPERCASE, -1, 10, 1, 1 };
|
||||||
static MenuFont_t MF_RedfontGreen = { -1, 10, 8, 1, 5<<16, 15<<16, 0<<16, 0<<16, TEXT_BIGALPHANUM | TEXT_UPPERCASE };
|
static MenuFont_t MF_RedfontGreen = { { 5<<16, 15<<16 }, { 0, 0 }, TEXT_BIGALPHANUM | TEXT_UPPERCASE, -1, 10, 8, 1 };
|
||||||
static MenuFont_t MF_Bluefont = { -1, 10, 0, 16, 5<<16, 7<<16, -(1<<16), 0<<16, 0 };
|
static MenuFont_t MF_Bluefont = { { 5<<16, 7<<16 }, { -(1<<16), 0 }, 0, -1, 10, 0, 16 };
|
||||||
static MenuFont_t MF_BluefontRed = { -1, 10, 10, 16, 5<<16, 7<<16, -(1<<16), 0<<16, 0 };
|
static MenuFont_t MF_BluefontRed = { { 5<<16, 7<<16 }, { -(1<<16), 0 }, 0, -1, 10, 10, 16 };
|
||||||
static MenuFont_t MF_Minifont = { -1, 10, 0, 16, 4<<16, 5<<16, 1<<16, 1<<16, 0 };
|
static MenuFont_t MF_Minifont = { { 4<<16, 5<<16 }, { 1<<16, 1<<16 }, 0, -1, 10, 0, 16 };
|
||||||
static MenuFont_t MF_MinifontRed = { -1, 16, 21, 16, 4<<16, 5<<16, 1<<16, 1<<16, 0 };
|
static MenuFont_t MF_MinifontRed = { { 4<<16, 5<<16 }, { 1<<16, 1<<16 }, 0, -1, 16, 21, 16 };
|
||||||
static MenuFont_t MF_MinifontDarkGray = { -1, 10, 13, 16, 4<<16, 5<<16, 1<<16, 1<<16, 0 };
|
static MenuFont_t MF_MinifontDarkGray = { { 4<<16, 5<<16 }, { 1<<16, 1<<16 }, 0, -1, 10, 13, 16 };
|
||||||
|
|
||||||
|
|
||||||
static MenuMenuFormat_t MMF_Top_Main = { { MENU_MARGIN_CENTER<<16, 55<<16, }, -(170<<16) };
|
static MenuMenuFormat_t MMF_Top_Main = { { MENU_MARGIN_CENTER<<16, 55<<16, }, -(170<<16) };
|
||||||
|
@ -1419,7 +1419,7 @@ void Menu_Init(void)
|
||||||
MF_Redfont.tilenum = MF_RedfontBlue.tilenum = MF_RedfontGreen.tilenum = BIGALPHANUM;
|
MF_Redfont.tilenum = MF_RedfontBlue.tilenum = MF_RedfontGreen.tilenum = BIGALPHANUM;
|
||||||
MF_Bluefont.tilenum = MF_BluefontRed.tilenum = STARTALPHANUM;
|
MF_Bluefont.tilenum = MF_BluefontRed.tilenum = STARTALPHANUM;
|
||||||
if (NAM_WW2GI)
|
if (NAM_WW2GI)
|
||||||
mgametext_xbetween = MF_Bluefont.xbetween = MF_BluefontRed.xbetween = 0;
|
mgametext_xbetween = MF_Bluefont.between.x = MF_BluefontRed.between.x = 0;
|
||||||
MF_Minifont.tilenum = MF_MinifontRed.tilenum = MF_MinifontDarkGray.tilenum = MINIFONT;
|
MF_Minifont.tilenum = MF_MinifontRed.tilenum = MF_MinifontDarkGray.tilenum = MINIFONT;
|
||||||
if (!minitext_lowercase)
|
if (!minitext_lowercase)
|
||||||
{
|
{
|
||||||
|
@ -3805,7 +3805,7 @@ static FORCE_INLINE void rotatesprite_ybounds(int32_t sx, int32_t sy, int32_t z,
|
||||||
|
|
||||||
static vec2_t Menu_Text(int32_t x, int32_t y, const MenuFont_t *font, const char *t, uint8_t status, int32_t ydim_upper, int32_t ydim_lower)
|
static vec2_t Menu_Text(int32_t x, int32_t y, const MenuFont_t *font, const char *t, uint8_t status, int32_t ydim_upper, int32_t ydim_lower)
|
||||||
{
|
{
|
||||||
int32_t s, p, ybetween = font->ybetween;
|
int32_t s, p, ybetween = font->between.y;
|
||||||
int32_t f = font->textflags;
|
int32_t f = font->textflags;
|
||||||
if (status & MT_XCenter)
|
if (status & MT_XCenter)
|
||||||
f |= TEXT_XCENTER;
|
f |= TEXT_XCENTER;
|
||||||
|
@ -3814,14 +3814,14 @@ static vec2_t Menu_Text(int32_t x, int32_t y, const MenuFont_t *font, const char
|
||||||
if (status & MT_YCenter)
|
if (status & MT_YCenter)
|
||||||
{
|
{
|
||||||
f |= TEXT_YCENTER | TEXT_YOFFSETZERO;
|
f |= TEXT_YCENTER | TEXT_YOFFSETZERO;
|
||||||
ybetween = font->yline; // <^ the battle against 'Q'
|
ybetween = font->emptychar.y; // <^ the battle against 'Q'
|
||||||
}
|
}
|
||||||
if (status & MT_Literal)
|
if (status & MT_Literal)
|
||||||
f |= TEXT_LITERALESCAPE;
|
f |= TEXT_LITERALESCAPE;
|
||||||
|
|
||||||
Menu_ShadePal(font, status, &s, &p);
|
Menu_ShadePal(font, status, &s, &p);
|
||||||
|
|
||||||
return G_ScreenText(font->tilenum, x, y, 65536, 0, 0, t, s, p, 2|8|16|ROTATESPRITE_FULL16, 0, font->xspace, font->yline, font->xbetween, ybetween, f, 0, ydim_upper, xdim-1, ydim_lower);
|
return G_ScreenText(font->tilenum, x, y, 65536, 0, 0, t, s, p, 2|8|16|ROTATESPRITE_FULL16, 0, font->emptychar.x, font->emptychar.y, font->between.x, ybetween, f, 0, ydim_upper, xdim-1, ydim_lower);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -3831,7 +3831,7 @@ static vec2_t Menu_TextSize(int32_t x, int32_t y, const MenuFont_t *font, const
|
||||||
if (status & MT_Literal)
|
if (status & MT_Literal)
|
||||||
f |= TEXT_LITERALESCAPE;
|
f |= TEXT_LITERALESCAPE;
|
||||||
|
|
||||||
return G_ScreenTextSize(font->tilenum, x, y, 65536, 0, t, 2|8|16|ROTATESPRITE_FULL16, font->xspace, font->yline, font->xbetween, font->ybetween, f, 0, 0, xdim-1, ydim-1);
|
return G_ScreenTextSize(font->tilenum, x, y, 65536, 0, t, 2|8|16|ROTATESPRITE_FULL16, font->emptychar.x, font->emptychar.y, font->between.x, font->between.y, f, 0, 0, xdim-1, ydim-1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3977,8 +3977,8 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
|
|
||||||
++numvalidentries;
|
++numvalidentries;
|
||||||
|
|
||||||
// assumes height == font->yline!
|
// assumes height == font->emptychar.y!
|
||||||
totalheight += entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->yline;
|
totalheight += entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->emptychar.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
calculatedentryspacing = (klabs(menu->format->bottomcutoff) - menu->format->pos.y - totalheight) / (numvalidentries > 1 ? numvalidentries - 1 : 1);
|
calculatedentryspacing = (klabs(menu->format->bottomcutoff) - menu->format->pos.y - totalheight) / (numvalidentries > 1 ? numvalidentries - 1 : 1);
|
||||||
|
@ -3992,7 +3992,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int32_t const height = entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->yline;
|
int32_t const height = entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->emptychar.y;
|
||||||
|
|
||||||
y += height;
|
y += height;
|
||||||
totalHeight = y;
|
totalHeight = y;
|
||||||
|
@ -4031,12 +4031,12 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
if (entry->format->width == 0)
|
if (entry->format->width == 0)
|
||||||
status |= MT_XCenter;
|
status |= MT_XCenter;
|
||||||
|
|
||||||
const int32_t dodraw = entry->type != Spacer && 0 <= y - menu->scrollPos + entry->font->yline && y - menu->scrollPos <= klabs(menu->format->bottomcutoff) - menu->format->pos.y;
|
const int32_t dodraw = entry->type != Spacer && 0 <= y - menu->scrollPos + entry->font->emptychar.y && y - menu->scrollPos <= klabs(menu->format->bottomcutoff) - menu->format->pos.y;
|
||||||
|
|
||||||
if (dodraw)
|
if (dodraw)
|
||||||
textsize = Menu_Text(origin.x + x, origin.y + y_upper + y - menu->scrollPos, entry->font, entry->name, status, ydim_upper, ydim_lower);
|
textsize = Menu_Text(origin.x + x, origin.y + y_upper + y - menu->scrollPos, entry->font, entry->name, status, ydim_upper, ydim_lower);
|
||||||
|
|
||||||
height = entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->yline; // max(textsize.y, entry->font->yline); // bluefont Q ruins this
|
height = entry->type == Spacer ? ((MenuSpacer_t*)entry->entry)->height : entry->font->emptychar.y; // max(textsize.y, entry->font->emptychar.y); // bluefont Q ruins this
|
||||||
|
|
||||||
if (entry->format->width < 0)
|
if (entry->format->width < 0)
|
||||||
status |= MT_XRight;
|
status |= MT_XRight;
|
||||||
|
@ -4088,7 +4088,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->yline))
|
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->emptychar.y))
|
||||||
{
|
{
|
||||||
menu->currentEntry = e;
|
menu->currentEntry = e;
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
|
@ -4133,7 +4133,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->yline))
|
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->emptychar.y))
|
||||||
{
|
{
|
||||||
menu->currentEntry = e;
|
menu->currentEntry = e;
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
|
@ -4176,14 +4176,14 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Menu_MouseOutsideBounds(&m_mousepos, columnx[1], mousey, column1textsize.x, object->font->yline))
|
if (!Menu_MouseOutsideBounds(&m_mousepos, columnx[1], mousey, column1textsize.x, object->font->emptychar.y))
|
||||||
{
|
{
|
||||||
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, columnx[1], mousey, column1textsize.x, object->font->yline)))
|
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, columnx[1], mousey, column1textsize.x, object->font->emptychar.y)))
|
||||||
{
|
{
|
||||||
menu->currentColumn = 1;
|
menu->currentColumn = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[1], mousey, column1textsize.x, object->font->yline))
|
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[1], mousey, column1textsize.x, object->font->emptychar.y))
|
||||||
{
|
{
|
||||||
menu->currentEntry = e;
|
menu->currentEntry = e;
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
|
@ -4199,14 +4199,14 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
m_mousecaught = 1;
|
m_mousecaught = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!Menu_MouseOutsideBounds(&m_mousepos, columnx[0], mousey, column0textsize.x, object->font->yline))
|
else if (!Menu_MouseOutsideBounds(&m_mousepos, columnx[0], mousey, column0textsize.x, object->font->emptychar.y))
|
||||||
{
|
{
|
||||||
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, columnx[0], mousey, column0textsize.x, object->font->yline)))
|
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, columnx[0], mousey, column0textsize.x, object->font->emptychar.y)))
|
||||||
{
|
{
|
||||||
menu->currentColumn = 0;
|
menu->currentColumn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[0], mousey, column0textsize.x, object->font->yline))
|
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[0], mousey, column0textsize.x, object->font->emptychar.y))
|
||||||
{
|
{
|
||||||
menu->currentEntry = e;
|
menu->currentEntry = e;
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
|
@ -4522,14 +4522,14 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
if (entry == currentry && object->editfield != NULL)
|
if (entry == currentry && object->editfield != NULL)
|
||||||
{
|
{
|
||||||
dim = Menu_Text(origin.x + stringx, stringy, object->font, object->editfield, status | MT_Literal, ydim_upper, ydim_lower);
|
dim = Menu_Text(origin.x + stringx, stringy, object->font, object->editfield, status | MT_Literal, ydim_upper, ydim_lower);
|
||||||
h = max(dim.y, entry->font->yline);
|
h = max(dim.y, entry->font->emptychar.y);
|
||||||
|
|
||||||
rotatesprite_ybounds(origin.x + x + dim.x + (1<<16) + scale(tilesiz[SPINNINGNUKEICON].x<<15, h, tilesiz[SPINNINGNUKEICON].y<<16), stringy, scale(65536, h, tilesiz[SPINNINGNUKEICON].y<<16), 0, SPINNINGNUKEICON+(((totalclock>>3))%7), cursorShade, 0, 10, ydim_upper, ydim_lower);
|
rotatesprite_ybounds(origin.x + x + dim.x + (1<<16) + scale(tilesiz[SPINNINGNUKEICON].x<<15, h, tilesiz[SPINNINGNUKEICON].y<<16), stringy, scale(65536, h, tilesiz[SPINNINGNUKEICON].y<<16), 0, SPINNINGNUKEICON+(((totalclock>>3))%7), cursorShade, 0, 10, ydim_upper, ydim_lower);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dim = Menu_Text(origin.x + stringx, stringy, object->font, object->variable, status, ydim_upper, ydim_lower);
|
dim = Menu_Text(origin.x + stringx, stringy, object->font, object->variable, status, ydim_upper, ydim_lower);
|
||||||
h = max(dim.y, entry->font->yline);
|
h = max(dim.y, entry->font->emptychar.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->format->width > 0)
|
if (entry->format->width > 0)
|
||||||
|
@ -4601,14 +4601,14 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
|
||||||
const int32_t y_lower = object->options->menuFormat->bottomcutoff;
|
const int32_t y_lower = object->options->menuFormat->bottomcutoff;
|
||||||
int32_t calculatedentryspacing = object->options->entryFormat->marginBottom;
|
int32_t calculatedentryspacing = object->options->entryFormat->marginBottom;
|
||||||
|
|
||||||
// assumes height == font->yline!
|
// assumes height == font->emptychar.y!
|
||||||
if (calculatedentryspacing < 0)
|
if (calculatedentryspacing < 0)
|
||||||
calculatedentryspacing = (-calculatedentryspacing - object->options->font->yline) / (object->options->numOptions - 1) - object->options->font->yline;
|
calculatedentryspacing = (-calculatedentryspacing - object->options->font->emptychar.y) / (object->options->numOptions - 1) - object->options->font->emptychar.y;
|
||||||
|
|
||||||
int32_t totalHeight = 0;
|
int32_t totalHeight = 0;
|
||||||
for (e = 0; e < object->options->numOptions; ++e)
|
for (e = 0; e < object->options->numOptions; ++e)
|
||||||
{
|
{
|
||||||
int32_t const height = object->options->font->yline;
|
int32_t const height = object->options->font->emptychar.y;
|
||||||
|
|
||||||
y += height;
|
y += height;
|
||||||
totalHeight = y;
|
totalHeight = y;
|
||||||
|
@ -4641,12 +4641,12 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
|
||||||
if (object->options->entryFormat->width == 0)
|
if (object->options->entryFormat->width == 0)
|
||||||
status |= MT_XCenter;
|
status |= MT_XCenter;
|
||||||
|
|
||||||
const int32_t dodraw = 0 <= y - object->options->scrollPos + object->options->font->yline && y - object->options->scrollPos <= object->options->menuFormat->bottomcutoff - object->options->menuFormat->pos.y;
|
const int32_t dodraw = 0 <= y - object->options->scrollPos + object->options->font->emptychar.y && y - object->options->scrollPos <= object->options->menuFormat->bottomcutoff - object->options->menuFormat->pos.y;
|
||||||
|
|
||||||
if (dodraw)
|
if (dodraw)
|
||||||
textsize = Menu_Text(origin.x + x, origin.y + y_upper + y - object->options->scrollPos, object->options->font, object->options->optionNames[e], status, ydim_upper, ydim_lower);
|
textsize = Menu_Text(origin.x + x, origin.y + y_upper + y - object->options->scrollPos, object->options->font, object->options->optionNames[e], status, ydim_upper, ydim_lower);
|
||||||
|
|
||||||
height = object->options->font->yline; // max(textsize.y, object->options->font->yline);
|
height = object->options->font->emptychar.y; // max(textsize.y, object->options->font->emptychar.y);
|
||||||
|
|
||||||
if (object->options->entryFormat->width < 0)
|
if (object->options->entryFormat->width < 0)
|
||||||
status |= MT_XRight;
|
status |= MT_XRight;
|
||||||
|
@ -4669,14 +4669,14 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
|
||||||
const int32_t mousey = origin.y + y_upper + y - object->options->scrollPos;
|
const int32_t mousey = origin.y + y_upper + y - object->options->scrollPos;
|
||||||
const int32_t mousewidth = object->options->entryFormat->width == 0 ? textsize.x : klabs(object->options->entryFormat->width);
|
const int32_t mousewidth = object->options->entryFormat->width == 0 ? textsize.x : klabs(object->options->entryFormat->width);
|
||||||
|
|
||||||
if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, object->options->font->yline)))
|
if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, object->options->font->emptychar.y)))
|
||||||
{
|
{
|
||||||
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, mousex, mousey, mousewidth, object->options->font->yline)))
|
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, mousex, mousey, mousewidth, object->options->font->emptychar.y)))
|
||||||
{
|
{
|
||||||
object->options->currentEntry = e;
|
object->options->currentEntry = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, object->options->font->yline))
|
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, object->options->font->emptychar.y))
|
||||||
{
|
{
|
||||||
object->options->currentEntry = e;
|
object->options->currentEntry = e;
|
||||||
|
|
||||||
|
@ -4886,7 +4886,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
||||||
int32_t totalHeight = 0;
|
int32_t totalHeight = 0;
|
||||||
for (dir = object->findhigh[i]->usera; dir; dir = dir->next)
|
for (dir = object->findhigh[i]->usera; dir; dir = dir->next)
|
||||||
{
|
{
|
||||||
y += object->font[i]->yline;
|
y += object->font[i]->emptychar.y;
|
||||||
totalHeight = y;
|
totalHeight = y;
|
||||||
y += object->marginBottom[i];
|
y += object->marginBottom[i];
|
||||||
}
|
}
|
||||||
|
@ -4915,16 +4915,16 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
||||||
const int32_t thisx = object->format[i]->pos.x;
|
const int32_t thisx = object->format[i]->pos.x;
|
||||||
const int32_t thisy = y - object->scrollPos[i];
|
const int32_t thisy = y - object->scrollPos[i];
|
||||||
|
|
||||||
if (0 <= thisy + object->font[i]->yline && thisy <= klabs(object->format[i]->bottomcutoff) - object->format[i]->pos.y)
|
if (0 <= thisy + object->font[i]->emptychar.y && thisy <= klabs(object->format[i]->bottomcutoff) - object->format[i]->pos.y)
|
||||||
{
|
{
|
||||||
const int32_t mousex = origin.x + thisx;
|
const int32_t mousex = origin.x + thisx;
|
||||||
const int32_t mousey = origin.y + y_upper + thisy;
|
const int32_t mousey = origin.y + y_upper + thisy;
|
||||||
|
|
||||||
vec2_t textdim = Menu_Text(mousex, mousey, object->font[i], tempbuf, status, ydim_upper, ydim_lower);
|
vec2_t textdim = Menu_Text(mousex, mousey, object->font[i], tempbuf, status, ydim_upper, ydim_lower);
|
||||||
|
|
||||||
if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, textdim.x, object->font[i]->yline)))
|
if (MOUSEACTIVECONDITIONAL(cm == m_currentMenu && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, textdim.x, object->font[i]->emptychar.y)))
|
||||||
{
|
{
|
||||||
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, mousex, mousey, textdim.x, object->font[i]->yline)))
|
if (MOUSEWATCHPOINTCONDITIONAL(Menu_MouseOutsideBounds(&m_prevmousepos, mousex, mousey, textdim.x, object->font[i]->emptychar.y)))
|
||||||
{
|
{
|
||||||
object->findhigh[i] = dir;
|
object->findhigh[i] = dir;
|
||||||
object->currentList = i;
|
object->currentList = i;
|
||||||
|
@ -4932,7 +4932,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
||||||
Menu_RunInput_FileSelect_MovementVerify(object);
|
Menu_RunInput_FileSelect_MovementVerify(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->yline))
|
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->emptychar.y))
|
||||||
{
|
{
|
||||||
object->findhigh[i] = dir;
|
object->findhigh[i] = dir;
|
||||||
object->currentList = i;
|
object->currentList = i;
|
||||||
|
@ -4945,7 +4945,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
y += object->font[i]->yline + object->marginBottom[i];
|
y += object->font[i]->emptychar.y + object->marginBottom[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu_RunScrollbar(cm, object->format[i], y_upper + totalHeight, &object->scrollPos[i], MenuFileSelect_scrollbar_rightedge[i], origin);
|
Menu_RunScrollbar(cm, object->format[i], y_upper + totalHeight, &object->scrollPos[i], MenuFileSelect_scrollbar_rightedge[i], origin);
|
||||||
|
@ -5114,10 +5114,10 @@ static void Menu_RunInput_EntryLink_Activate(MenuEntry_t *entry)
|
||||||
static void Menu_RunInput_EntryOptionList_MovementVerify(MenuOption_t *object)
|
static void Menu_RunInput_EntryOptionList_MovementVerify(MenuOption_t *object)
|
||||||
{
|
{
|
||||||
const int32_t listytop = object->options->menuFormat->pos.y;
|
const int32_t listytop = object->options->menuFormat->pos.y;
|
||||||
// assumes height == font->yline!
|
// assumes height == font->emptychar.y!
|
||||||
const int32_t unitheight = object->options->entryFormat->marginBottom < 0 ? (-object->options->entryFormat->marginBottom - object->options->font->yline) / object->options->numOptions : (object->options->font->yline + object->options->entryFormat->marginBottom);
|
const int32_t unitheight = object->options->entryFormat->marginBottom < 0 ? (-object->options->entryFormat->marginBottom - object->options->font->emptychar.y) / object->options->numOptions : (object->options->font->emptychar.y + object->options->entryFormat->marginBottom);
|
||||||
const int32_t ytop = listytop + object->options->currentEntry * unitheight;
|
const int32_t ytop = listytop + object->options->currentEntry * unitheight;
|
||||||
const int32_t ybottom = ytop + object->options->font->yline;
|
const int32_t ybottom = ytop + object->options->font->emptychar.y;
|
||||||
|
|
||||||
if (ybottom - object->options->scrollPos > object->options->menuFormat->bottomcutoff)
|
if (ybottom - object->options->scrollPos > object->options->menuFormat->bottomcutoff)
|
||||||
object->options->scrollPos = ybottom - object->options->menuFormat->bottomcutoff;
|
object->options->scrollPos = ybottom - object->options->menuFormat->bottomcutoff;
|
||||||
|
@ -5431,8 +5431,8 @@ static void Menu_RunInput_FileSelect_MovementVerify(MenuFileSelect_t *object)
|
||||||
{
|
{
|
||||||
const int32_t listytop = object->format[object->currentList]->pos.y;
|
const int32_t listytop = object->format[object->currentList]->pos.y;
|
||||||
const int32_t listybottom = klabs(object->format[object->currentList]->bottomcutoff);
|
const int32_t listybottom = klabs(object->format[object->currentList]->bottomcutoff);
|
||||||
const int32_t ytop = listytop + object->findhigh[object->currentList]->type * (object->font[object->currentList]->yline + object->marginBottom[object->currentList]);
|
const int32_t ytop = listytop + object->findhigh[object->currentList]->type * (object->font[object->currentList]->emptychar.y + object->marginBottom[object->currentList]);
|
||||||
const int32_t ybottom = ytop + object->font[object->currentList]->yline;
|
const int32_t ybottom = ytop + object->font[object->currentList]->emptychar.y;
|
||||||
|
|
||||||
if (ybottom - object->scrollPos[object->currentList] > listybottom)
|
if (ybottom - object->scrollPos[object->currentList] > listybottom)
|
||||||
object->scrollPos[object->currentList] = ybottom - listybottom;
|
object->scrollPos[object->currentList] = ybottom - listybottom;
|
||||||
|
|
|
@ -119,12 +119,11 @@ typedef enum MenuAnimationType_t
|
||||||
// a subset of screentext parameters, restricted because menus require accessibility
|
// a subset of screentext parameters, restricted because menus require accessibility
|
||||||
typedef struct MenuFont_t
|
typedef struct MenuFont_t
|
||||||
{
|
{
|
||||||
int32_t tilenum;
|
vec2_t emptychar, between;
|
||||||
int32_t shade_deselected; // selected entries are mandated to glow
|
|
||||||
int32_t pal, pal_disabled;
|
|
||||||
int32_t xspace, yline;
|
|
||||||
int32_t xbetween, ybetween;
|
|
||||||
int32_t textflags;
|
int32_t textflags;
|
||||||
|
int16_t tilenum;
|
||||||
|
int8_t shade_deselected; // selected entries are mandated to glow
|
||||||
|
uint8_t pal, pal_disabled;
|
||||||
} MenuFont_t;
|
} MenuFont_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue