From 285834ae5b66eb66723a8b430ef65997cf1c7ba6 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 12 Nov 2017 11:03:08 +0200 Subject: [PATCH] Fixed return state of player entered event https://forum.zdoom.org/viewtopic.php?t=58433 --- src/g_level.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index d5044942ef1..701d35b5316 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -128,7 +128,7 @@ int starttime; extern FString BackupSaveName; bool savegamerestore; -int finishstate; +int finishstate = FINISH_NoHub; extern int mousex, mousey; extern bool sendpause, sendsave, sendturn180, SendLand; @@ -851,6 +851,8 @@ void G_DoCompleted (void) level.maptime = 0; } + finishstate = mode; + if (!deathmatch && ((level.flags & LEVEL_NOINTERMISSION) || ((nextcluster == thiscluster) && (thiscluster->flags & CLUSTER_HUB) && !(thiscluster->flags & CLUSTER_ALLOWINTERMISSION)))) @@ -860,7 +862,6 @@ void G_DoCompleted (void) } gamestate = GS_INTERMISSION; - finishstate = mode; viewactive = false; automapactive = false; @@ -1038,12 +1039,20 @@ void G_DoLoadLevel (int position, bool autosave) { players[ii].camera = players[ii].mo; } - if (!savegamerestore) + + if (savegamerestore) + { + continue; + } + + const bool fromSnapshot = level.FromSnapshot; + E_PlayerEntered(ii, fromSnapshot && finishstate == FINISH_SameHub); + + if (fromSnapshot) { - E_PlayerEntered(ii, finishstate == FINISH_SameHub); + // ENTER scripts are being handled when the player gets spawned, this cannot be changed due to its effect on voodoo dolls. + FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true); } - // ENTER scripts are being handled when the player gets spawned, this cannot be changed due to its effect on voodoo dolls. - if (level.FromSnapshot && !savegamerestore) FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true); } }