Instead of ignoring blank menutypes in M_IterateMenuTree, ignore them in the MIT_ functions instead.

(I'm doing this because MIT_GetMenuAtLevel appears to actually care about whether menutype is zero or not unlike the others; I don't want to break the code designed around that)
This commit is contained in:
Monster Iestyn 2019-07-15 20:25:57 +01:00
parent d44a8ab78e
commit 5ef4dda9b9
1 changed files with 12 additions and 2 deletions

View File

@ -2247,8 +2247,6 @@ static INT32 M_IterateMenuTree(menutree_iterator itfunc, void *input)
{
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
menutype = (activeMenuId & bitmask) >> (MENUBITS*i);
if (!menutype)
continue;
if (itfunc(menutype, i, &retval, &input, false))
break;
}
@ -2290,6 +2288,9 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
(void)retval;
(void)fromoldest;
if (!menutype) // if there's nothing in this level, do nothing
return false;
if (menupres[menutype].bgcolor >= 0)
{
curbgcolor = menupres[menutype].bgcolor;
@ -2330,6 +2331,9 @@ static boolean MIT_ChangeMusic(UINT32 menutype, INT32 level, INT32 *retval, void
(void)retval;
(void)fromoldest;
if (!menutype) // if there's nothing in this level, do nothing
return false;
if (menupres[menutype].musname[0])
{
S_ChangeMusic(menupres[menutype].musname, menupres[menutype].mustrack, menupres[menutype].muslooping);
@ -2354,6 +2358,9 @@ static boolean MIT_SetCurFadeValue(UINT32 menutype, INT32 level, INT32 *retval,
(void)retval;
(void)fromoldest;
if (!menutype) // if there's nothing in this level, do nothing
return false;
if (menupres[menutype].fadestrength >= 0)
{
curfadevalue = (menupres[menutype].fadestrength % 32);
@ -2370,6 +2377,9 @@ static boolean MIT_SetCurHideTitlePics(UINT32 menutype, INT32 level, INT32 *retv
(void)retval;
(void)fromoldest;
if (!menutype) // if there's nothing in this level, do nothing
return false;
if (menupres[menutype].hidetitlepics >= 0)
{
curhidepics = menupres[menutype].hidetitlepics;