mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 12:50:44 +00:00
Enable exiting and playing demos from replay hut properly
This commit is contained in:
parent
2fbb0ca5f4
commit
ac0ad5f32b
1 changed files with 37 additions and 5 deletions
38
src/m_menu.c
38
src/m_menu.c
|
@ -340,6 +340,7 @@ static patch_t *addonsp[NUM_EXT+5];
|
|||
static void M_ReplayHut(INT32 choice);
|
||||
static void M_HandleReplayHutList(INT32 choice);
|
||||
static void M_DrawReplayHut(void);
|
||||
static boolean M_QuitReplayHut(void);
|
||||
|
||||
// Drawing functions
|
||||
static void M_DrawGenericMenu(void);
|
||||
|
@ -1598,14 +1599,14 @@ menu_t MISC_AddonsDef =
|
|||
|
||||
menu_t MISC_ReplayHutDef =
|
||||
{
|
||||
"M_REPLAY",
|
||||
NULL,
|
||||
sizeof (MISC_ReplayHutMenu)/sizeof (menuitem_t),
|
||||
&MainDef,
|
||||
NULL,
|
||||
MISC_ReplayHutMenu,
|
||||
M_DrawReplayHut,
|
||||
30, 80,
|
||||
(sizeof (MISC_ReplayHutMenu)/sizeof (menuitem_t)) - 2, // Start on the replay list
|
||||
NULL
|
||||
M_QuitReplayHut
|
||||
};
|
||||
|
||||
menu_t MAPauseDef = PAUSEMENUSTYLE(MAPauseMenu, 40, 72);
|
||||
|
@ -5016,6 +5017,7 @@ menudemo_t *demolist;
|
|||
static INT16 replayOn = 0;
|
||||
static INT16 replayScrollTitle = 0;
|
||||
static INT8 replayScrollDelay = TICRATE, replayScrollDir = 1;
|
||||
static boolean inreplayhut = false;
|
||||
|
||||
static void PrepReplayList(void)
|
||||
{
|
||||
|
@ -5046,8 +5048,12 @@ static void M_ReplayHut(INT32 choice)
|
|||
{
|
||||
(void)choice;
|
||||
|
||||
if (!inreplayhut)
|
||||
{
|
||||
snprintf(menupath, 1024, "%s"PATHSEP"replay"PATHSEP"online"PATHSEP, srb2home);
|
||||
menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath);
|
||||
}
|
||||
inreplayhut = true;
|
||||
|
||||
if (!preparefilemenu(false, true))
|
||||
{
|
||||
|
@ -5088,6 +5094,17 @@ static void M_HandleReplayHutList(INT32 choice)
|
|||
S_StartSound(NULL, sfx_menu1);
|
||||
replayScrollTitle = 0; replayScrollDelay = TICRATE; replayScrollDir = 1;
|
||||
break;
|
||||
|
||||
case KEY_ESCAPE:
|
||||
M_QuitReplayHut();
|
||||
break;
|
||||
|
||||
case KEY_ENTER:
|
||||
M_ClearMenus(false);
|
||||
demo.loadfiles = true; demo.ignorefiles = false; //@TODO prompt
|
||||
|
||||
G_DoPlayDemo(demolist[replayOn].filepath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5292,6 +5309,21 @@ static void M_DrawReplayHut(void)
|
|||
}
|
||||
}
|
||||
|
||||
static boolean M_QuitReplayHut(void)
|
||||
{
|
||||
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
|
||||
menuactive = false;
|
||||
D_StartTitle();
|
||||
|
||||
if (demolist)
|
||||
Z_Free(demolist);
|
||||
demolist = NULL;
|
||||
|
||||
inreplayhut = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void M_PandorasBox(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
|
Loading…
Reference in a new issue