Fix tmthing crash in EndTextPrompt when loading an invalid prompt on level start

This commit is contained in:
mazmazz 2018-11-09 22:06:53 -05:00
parent b8897db308
commit ae4c1e0e82

View file

@ -2125,7 +2125,8 @@ void F_EndTextPrompt(boolean forceexec, boolean noexec)
boolean promptwasactive = promptactive; boolean promptwasactive = promptactive;
promptactive = false; promptactive = false;
if (promptwasactive) { 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?
@ -2133,11 +2134,16 @@ void F_EndTextPrompt(boolean forceexec, boolean noexec)
// \todo net safety, maybe loop all player thinkers? // \todo net safety, maybe loop all player thinkers?
if ((promptwasactive || forceexec) && !noexec && promptpostexectag) if ((promptwasactive || forceexec) && !noexec && promptpostexectag)
{
if (tmthing) // edge case where starting an invalid prompt immediately on level load will make P_MapStart fail
P_LinedefExecute(promptpostexectag, promptmo, NULL);
else
{ {
P_MapStart(); P_MapStart();
P_LinedefExecute(promptpostexectag, promptmo, NULL); P_LinedefExecute(promptpostexectag, promptmo, NULL);
P_MapEnd(); P_MapEnd();
} }
}
} }
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)
@ -2326,6 +2332,4 @@ void F_TextPromptTicker(void)
!F_WriteText()) !F_WriteText())
timetonext = !promptblockcontrols; // never show the chevron if we can't toggle pages timetonext = !promptblockcontrols; // never show the chevron if we can't toggle pages
} }
} }