IT_PAIR for when you want to define both sides of a menu item

This commit is contained in:
James R 2019-12-30 21:40:13 -08:00
parent e8db39229c
commit 38492073fa
2 changed files with 19 additions and 7 deletions

View file

@ -2973,7 +2973,7 @@ static void M_NextOpt(void)
itemOn = 0;
else
itemOn++;
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE);
} while (oldItemOn != itemOn && ( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ));
}
static void M_PrevOpt(void)
@ -2985,7 +2985,7 @@ static void M_PrevOpt(void)
itemOn = currentMenu->numitems - 1;
else
itemOn--;
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE);
} while (oldItemOn != itemOn && ( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ));
}
// lock out further input in a tic when important buttons are pressed
@ -3619,11 +3619,11 @@ void M_SetupNextMenu(menu_t *menudef)
// the curent item can be disabled,
// this code go up until an enabled item found
if ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE)
if (( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ))
{
for (i = 0; i < currentMenu->numitems; i++)
{
if ((currentMenu->menuitems[i].status & IT_TYPE) != IT_SPACE)
if (!( (currentMenu->menuitems[i].status & IT_TYPE) & IT_SPACE ))
{
itemOn = i;
break;
@ -4306,7 +4306,18 @@ static void M_DrawGenericScrollMenu(void)
}
break;
case IT_TRANSTEXT:
V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);
switch (currentMenu->menuitems[i].status & IT_TYPE)
{
case IT_PAIR:
V_DrawString(x, y,
V_TRANSLUCENT, currentMenu->menuitems[i].patch);
V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
V_TRANSLUCENT, currentMenu->menuitems[i].text);
break;
default:
V_DrawString(x, y,
V_TRANSLUCENT, currentMenu->menuitems[i].text);
}
break;
case IT_QUESTIONMARKS:
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));

View file

@ -222,13 +222,14 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
// flags for items in the menu
// menu handle (what we do when key is pressed
#define IT_TYPE 14 // (2+4+8)
#define IT_TYPE 15 // (1+2+4+8)
#define IT_CALL 0 // call the function
#define IT_SPACE 1 // no handling
#define IT_ARROWS 2 // call function with 0 for left arrow and 1 for right arrow in param
#define IT_KEYHANDLER 4 // call with the key in param
#define IT_SUBMENU 6 // go to sub menu
#define IT_CVAR 8 // handle as a cvar
#define IT_SPACE 10 // no handling
#define IT_PAIR 11 // no handling, define both sides of text
#define IT_MSGHANDLER 12 // same as key but with event and sometime can handle y/n key (special for message)
#define IT_DISPLAY (48+64+128) // 16+32+64+128