Close text prompt upon level load

This commit is contained in:
mazmazz 2018-11-04 22:22:47 -05:00
parent 96e9b4143a
commit 311cb27818
4 changed files with 13 additions and 9 deletions

View file

@ -2110,7 +2110,7 @@ static void F_AdvanceToNextPage(void)
// close the prompt if either num is invalid // close the prompt if either num is invalid
if (cutnum == INT32_MAX || scenenum == INT32_MAX) if (cutnum == INT32_MAX || scenenum == INT32_MAX)
F_EndTextPrompt(); F_EndTextPrompt(false, false);
else else
{ {
// on page mode, number of tics before allowing boost // on page mode, number of tics before allowing boost
@ -2120,18 +2120,19 @@ static void F_AdvanceToNextPage(void)
} }
} }
void F_EndTextPrompt(void) void F_EndTextPrompt(boolean forceexec, boolean noexec)
{ {
if (promptactive) { boolean promptwasactive = promptactive;
promptactive = false;
if (promptwasactive) {
if (promptmo && promptmo->player && promptblockcontrols) if (promptmo && promptmo->player && promptblockcontrols)
promptmo->reactiontime = TICRATE/4; // prevent jumping right away // \todo account freeze realtime for this) promptmo->reactiontime = TICRATE/4; // prevent jumping right away // \todo account freeze realtime for this)
// \todo reset frozen realtime? // \todo reset frozen realtime?
} }
promptactive = false;
// \todo net safety, maybe loop all player thinkers? // \todo net safety, maybe loop all player thinkers?
if (promptpostexectag) if ((promptwasactive || forceexec) && !noexec && promptpostexectag)
{ {
P_MapStart(); P_MapStart();
P_LinedefExecute(promptpostexectag, promptmo, NULL); P_LinedefExecute(promptpostexectag, promptmo, NULL);
@ -2168,7 +2169,7 @@ void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postex
F_PreparePageText(textprompts[cutnum]->page[scenenum].text); F_PreparePageText(textprompts[cutnum]->page[scenenum].text);
} }
else else
F_EndTextPrompt(); // run the post-effects immediately F_EndTextPrompt(true, false); // run the post-effects immediately
} }
void F_TextPromptDrawer(void) void F_TextPromptDrawer(void)

View file

@ -54,7 +54,7 @@ void F_EndCutScene(void);
void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime); void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime);
void F_TextPromptDrawer(void); void F_TextPromptDrawer(void);
void F_EndTextPrompt(void); void F_EndTextPrompt(boolean forceexec, boolean noexec);
void F_StartGameEnd(void); void F_StartGameEnd(void);
void F_StartIntro(void); void F_StartIntro(void);

View file

@ -2753,6 +2753,9 @@ boolean P_SetupLevel(boolean skipprecip)
I_UpdateNoVsync(); I_UpdateNoVsync();
} }
// Close text prompt before freeing the old level
F_EndTextPrompt(false, true);
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
LUA_InvalidateLevel(); LUA_InvalidateLevel();
#endif #endif

View file

@ -3773,7 +3773,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
//boolean freezethinkers = (line->flags & ML_EFFECT4); //boolean freezethinkers = (line->flags & ML_EFFECT4);
if (closetextprompt) if (closetextprompt)
F_EndTextPrompt(); F_EndTextPrompt(false, false);
else else
F_StartTextPrompt(promptnum, pagenum, mo, runpostexec ? postexectag : 0, blockcontrols, freezerealtime); F_StartTextPrompt(promptnum, pagenum, mo, runpostexec ? postexectag : 0, blockcontrols, freezerealtime);
} }