diff --git a/src/f_finale.c b/src/f_finale.c index 6ba9132cf..8a6a8ce0c 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -2110,7 +2110,7 @@ static void F_AdvanceToNextPage(void) // close the prompt if either num is invalid if (cutnum == INT32_MAX || scenenum == INT32_MAX) - F_EndTextPrompt(); + F_EndTextPrompt(false, false); else { // 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) promptmo->reactiontime = TICRATE/4; // prevent jumping right away // \todo account freeze realtime for this) // \todo reset frozen realtime? } - promptactive = false; - // \todo net safety, maybe loop all player thinkers? - if (promptpostexectag) + if ((promptwasactive || forceexec) && !noexec && promptpostexectag) { P_MapStart(); 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); } else - F_EndTextPrompt(); // run the post-effects immediately + F_EndTextPrompt(true, false); // run the post-effects immediately } void F_TextPromptDrawer(void) diff --git a/src/f_finale.h b/src/f_finale.h index dfee247fb..8ce7ac22e 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -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_TextPromptDrawer(void); -void F_EndTextPrompt(void); +void F_EndTextPrompt(boolean forceexec, boolean noexec); void F_StartGameEnd(void); void F_StartIntro(void); diff --git a/src/p_setup.c b/src/p_setup.c index eb25c51c8..b2dfedb4e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2753,6 +2753,9 @@ boolean P_SetupLevel(boolean skipprecip) I_UpdateNoVsync(); } + // Close text prompt before freeing the old level + F_EndTextPrompt(false, true); + #ifdef HAVE_BLUA LUA_InvalidateLevel(); #endif diff --git a/src/p_spec.c b/src/p_spec.c index edf9174d6..42153b4bf 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3773,7 +3773,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) //boolean freezethinkers = (line->flags & ML_EFFECT4); if (closetextprompt) - F_EndTextPrompt(); + F_EndTextPrompt(false, false); else F_StartTextPrompt(promptnum, pagenum, mo, runpostexec ? postexectag : 0, blockcontrols, freezerealtime); }