From f2bd45dbd911e651a860b98736d204701cbe92f9 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 31 Dec 2023 19:44:05 -0800 Subject: [PATCH] k_menu: replace IT_WHITESTRING -> IT_LINKTEXT, draw arrow like IT_SUBMENU --- src/k_menu.h | 2 +- src/k_menudraw.c | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/k_menu.h b/src/k_menu.h index d9e0cec81..f94b1d7e6 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -44,7 +44,7 @@ extern "C" { #define IT_NOTHING 0 // space #define IT_PATCH 16 // a patch or a string with big font #define IT_STRING 32 // little string (spaced with 10) -#define IT_WHITESTRING 48 // little string in white +#define IT_LINKTEXT 48 // draw an arrow beside, like IT_SUBMENU #define IT_DYBIGSPACE 64 // same as noting #define IT_DYLITLSPACE (16+64) // little space #define IT_STRING2 (32+64) // a simple string diff --git a/src/k_menudraw.c b/src/k_menudraw.c index a1294daf6..bf8663b61 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -1070,7 +1070,6 @@ void M_DrawGenericMenu(void) break; #endif case IT_STRING: - case IT_WHITESTRING: if (currentMenu->menuitems[i].mvar1) y = currentMenu->y+currentMenu->menuitems[i].mvar1; if (i == itemOn) @@ -4267,6 +4266,19 @@ static void M_DrawOptionsBoxTerm(INT32 x, INT32 top, INT32 bottom) V_DrawFill(px, bottom + 3, BASEVIDWIDTH - (2 * px), 2, 31); } +static void M_DrawLinkArrow(INT32 x, INT32 y, INT32 i) +{ + UINT8 ch = currentMenu->menuitems[i].text[0]; + + V_DrawMenuString( + x + (i == itemOn ? 1 + skullAnimCounter/5 : 0), + y - 1, + // Use color of first character in text label + i == itemOn ? highlightflags : (((max(ch, 0x80) - 0x80) & 15) << V_CHARCOLORSHIFT), + "\x1D" + ); +} + void M_DrawGenericOptions(void) { INT32 x = currentMenu->x - M_EaseWithTransition(Easing_Linear, 5 * 48), y = currentMenu->y, w, i, cursory = -100; @@ -4386,7 +4398,7 @@ box_found: break; #endif case IT_STRING: - case IT_WHITESTRING: { + case IT_LINKTEXT: { if (opening) { if ((currentMenu->menuitems[i].status & IT_TYPE) == IT_CVAR && @@ -4398,34 +4410,26 @@ box_found: break; } - INT32 px = x + ((currentMenu->menuitems[i].status & IT_TYPE) == IT_SUBMENU ? 8 : 0); + INT32 px = x + ((currentMenu->menuitems[i].status & IT_TYPE) == IT_SUBMENU + || (currentMenu->menuitems[i].status & IT_DISPLAY) == IT_LINKTEXT ? 8 : 0); if (i == itemOn) cursory = y; - if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING) - { - if (i == itemOn) - V_DrawMenuString(px + 1, y, highlightflags, currentMenu->menuitems[i].text); - else - V_DrawMenuString(px, y, 0, currentMenu->menuitems[i].text); - } + if (i == itemOn) + V_DrawMenuString(px + 1, y, highlightflags, currentMenu->menuitems[i].text); else - V_DrawMenuString(px, y, highlightflags, currentMenu->menuitems[i].text); + V_DrawMenuString(px, y, 0, currentMenu->menuitems[i].text); + + if ((currentMenu->menuitems[i].status & IT_DISPLAY) == IT_LINKTEXT) + M_DrawLinkArrow(x, y, i); // Cvar specific handling switch (currentMenu->menuitems[i].status & IT_TYPE) { case IT_SUBMENU: { - UINT8 ch = currentMenu->menuitems[i].text[0]; - - V_DrawMenuString( - x + (i == itemOn ? 1 + skullAnimCounter/5 : 0), - y - 1, - // Use color of first character in text label - i == itemOn ? highlightflags : (((max(ch, 0x80) - 0x80) & 15) << V_CHARCOLORSHIFT), - "\x1D" - ); + if ((currentMenu->menuitems[i].status & IT_DISPLAY) != IT_LINKTEXT) + M_DrawLinkArrow(x, y, i); break; }