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: // Misc menus:
#define numaddonsshown 4 #define numaddonsshown 4
void M_Addons(INT32 choice); void M_Addons(INT32 choice);
boolean M_AddonsRefresh(void); void M_AddonsRefresh(void);
void M_HandleAddons(INT32 choice); void M_HandleAddons(INT32 choice);
char *M_AddonsHeaderPath(void); char *M_AddonsHeaderPath(void);

View file

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

View file

@ -4284,13 +4284,6 @@ void M_DrawAddons(void)
V_DrawFixedPatch(0, 0, FRACUNIT, 0, bg, NULL); 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()) if (Playing())
V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems."); V_DrawCenteredString(BASEVIDWIDTH/2, 5, warningflags, "Adding files mid-game may cause problems.");
else else

View file

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