Addons menu refactor part 1

- Move M_AddonsRefresh out of M_DrawAddons - death to a HORRIBLE hack
- Use it as the tickroutine for the addons menu instead
- Behaves as before, possibly more consistent
This commit is contained in:
toaster 2022-09-03 16:23:16 +01:00
parent 139def0d3d
commit 8312f12d6c
4 changed files with 12 additions and 19 deletions

View file

@ -963,7 +963,7 @@ void M_ReplayHut(INT32 choice);
// Misc menus:
#define numaddonsshown 4
void M_Addons(INT32 choice);
boolean M_AddonsRefresh(void);
void M_AddonsRefresh(void);
void M_HandleAddons(INT32 choice);
char *M_AddonsHeaderPath(void);

View file

@ -1742,7 +1742,7 @@ menu_t MISC_AddonsDef = {
0, 0,
0, 0,
M_DrawAddons,
NULL,
M_AddonsRefresh,
NULL,
NULL,
NULL

View file

@ -4284,13 +4284,6 @@ void M_DrawAddons(void)
V_DrawFixedPatch(0, 0, FRACUNIT, 0, bg, NULL);
}
// hack - need to refresh at end of frame to handle addfile...
if (refreshdirmenu & M_AddonsRefresh())
{
M_DrawMessageMenu();
return;
}
if (Playing())
V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems.");
else

View file

@ -6321,8 +6321,8 @@ static void M_AddonsClearName(INT32 choice)
M_StopMessage(choice);
}
// returns whether to do message draw
boolean M_AddonsRefresh(void)
// Handles messages for addon errors.
void M_AddonsRefresh(void)
{
if ((refreshdirmenu & REFRESHDIR_NORMAL) && !preparefilemenu(true, false))
{
@ -6331,7 +6331,7 @@ boolean M_AddonsRefresh(void)
{
CLEARNAME;
}
return true;
return;// true;
}
#ifdef DEVELOP
@ -6368,23 +6368,23 @@ boolean M_AddonsRefresh(void)
if (message)
{
M_StartMessage(message,FUNCPTRCAST(M_AddonsClearName),MM_YESNO);
return true;
return;// true;
}
S_StartSound(NULL, sfx_s221);
CLEARNAME;
}
return false;
return;// false;
}
static void M_AddonExec(INT32 ch)
{
if (ch == MA_NO)
return;
S_StartSound(NULL, sfx_zoom);
COM_BufAddText(va("exec \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
if (ch == MA_YES)
{
S_StartSound(NULL, sfx_zoom);
COM_BufAddText(va("exec \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
}
}
#define len menusearch[0]