Fixes for menus:

* add gamestate != GS_TIMEATTACK checks to prevent Record Attack or NiGHTS Mode losing their backgrounds
* increase bgname to 9 to include the extra NULL byte? (is this a good idea actually)
* make M_IterateMenuTree ignore menu levels without a menutype value
This commit is contained in:
Monster Iestyn 2019-07-14 21:58:48 +01:00
parent 5c54022a89
commit f6842a80b4
4 changed files with 8 additions and 6 deletions

View file

@ -67,7 +67,7 @@ static INT32 menuanimtimer; // Title screen: background animation timing
mobj_t *titlemapcameraref = NULL; mobj_t *titlemapcameraref = NULL;
// menu presentation state // menu presentation state
char curbgname[8]; char curbgname[9];
SINT8 curfadevalue; SINT8 curfadevalue;
boolean curhidepics; boolean curhidepics;
INT32 curbgcolor; INT32 curbgcolor;

View file

@ -84,7 +84,7 @@ typedef enum
extern UINT8 titlemapinaction; extern UINT8 titlemapinaction;
extern mobj_t *titlemapcameraref; extern mobj_t *titlemapcameraref;
extern char curbgname[8]; extern char curbgname[9];
extern SINT8 curfadevalue; extern SINT8 curfadevalue;
extern boolean curhidepics; extern boolean curhidepics;
extern INT32 curbgcolor; extern INT32 curbgcolor;

View file

@ -2247,6 +2247,8 @@ static INT32 M_IterateMenuTree(menutree_iterator itfunc, void *input)
{ {
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
menutype = (activeMenuId & bitmask) >> (MENUBITS*i); menutype = (activeMenuId & bitmask) >> (MENUBITS*i);
if (!menutype)
continue;
if (itfunc(menutype, i, &retval, &input, false)) if (itfunc(menutype, i, &retval, &input, false))
break; break;
} }
@ -2300,7 +2302,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed; curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed;
return true; return true;
} }
else if (menupres[menutype].bghide && titlemapinaction) // hide the background else if (gamestate != GS_TIMEATTACK && menupres[menutype].bghide && titlemapinaction) // hide the background
{ {
curbghide = true; curbghide = true;
return true; return true;
@ -2309,7 +2311,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
{ {
if (M_GetYoungestChildMenu() == MN_SP_PLAYER || !defaultname || !defaultname[0]) if (M_GetYoungestChildMenu() == MN_SP_PLAYER || !defaultname || !defaultname[0])
curbgcolor = 31; curbgcolor = 31;
else if (titlemapinaction) // hide the background by default in titlemap else if (gamestate != GS_TIMEATTACK && titlemapinaction) // hide the background by default in titlemap
curbghide = true; curbghide = true;
else else
{ {
@ -2469,7 +2471,7 @@ static void M_HandleMenuPresState(menu_t *newMenu)
curbgcolor = -1; curbgcolor = -1;
curbgxspeed = titlescrollxspeed; curbgxspeed = titlescrollxspeed;
curbgyspeed = titlescrollyspeed; curbgyspeed = titlescrollyspeed;
curbghide = true; curbghide = (gamestate != GS_TIMEATTACK); // show in time attack, hide in other menus
// don't do the below during the in-game menus // don't do the below during the in-game menus
if (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) if (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK)

View file

@ -123,7 +123,7 @@ typedef enum
typedef struct typedef struct
{ {
char bgname[8]; // name for background gfx lump; lays over titlemap if this is set char bgname[9]; // name for background gfx lump; lays over titlemap if this is set
SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting
INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting
INT32 titlescrollyspeed; // y scroll INT32 titlescrollyspeed; // y scroll