menubehaviourflags_t: Add MBF_NOLOOPENTRIES

Abstracts one previously hardcoded exception to M_NextOpt/M_PrevOpt
This commit is contained in:
toaster 2023-06-07 11:51:15 +01:00
parent e162fffecf
commit c8f74aef2b
3 changed files with 12 additions and 9 deletions

View file

@ -131,8 +131,9 @@ void M_HandlePauseMenuGametype(INT32 choice);
typedef enum
{
MBF_UD_LR_FLIPPED = 1, // flip up-down and left-right axes
MBF_SOUNDLESS = 2, // do not play base menu sounds
MBF_UD_LR_FLIPPED = 1, // flip up-down and left-right axes
MBF_SOUNDLESS = 1<<1, // do not play base menu sounds
MBF_NOLOOPENTRIES = 1<<2, // do not loop M_NextOpt/M_PrevOpt
} menubehaviourflags_t;
struct menuitem_t

View file

@ -159,10 +159,11 @@ boolean M_NextOpt(void)
if (itemOn + 1 > currentMenu->numitems - 1)
{
// Prevent looparound here
// If you're going to add any extra exceptions, DON'T.
// Add a "don't loop" flag to the menu_t struct instead.
if (currentMenu == &MISC_AddonsDef)
if (currentMenu->behaviourflags & MBF_NOLOOPENTRIES)
{
itemOn = oldItemOn;
return false;
}
itemOn = 0;
}
else
@ -186,10 +187,11 @@ boolean M_PrevOpt(void)
if (!itemOn)
{
// Prevent looparound here
// If you're going to add any extra exceptions, DON'T.
// Add a "don't loop" flag to the menu_t struct instead.
if (currentMenu == &MISC_AddonsDef)
if (currentMenu->behaviourflags & MBF_NOLOOPENTRIES)
{
itemOn = oldItemOn;
return false;
}
itemOn = currentMenu->numitems - 1;
}
else

View file

@ -23,7 +23,7 @@ menu_t MISC_AddonsDef = {
MISC_AddonsMenu,
50, 28,
0, 0,
0,
MBF_NOLOOPENTRIES,
"EXTRAS",
0, 0,
M_DrawAddons,