Fixed return state of player entered event

https://forum.zdoom.org/viewtopic.php?t=58433
This commit is contained in:
alexey.lysiuk 2017-11-12 11:03:08 +02:00
parent 1088c60add
commit 285834ae5b

View file

@ -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)
{
E_PlayerEntered(ii, finishstate == FINISH_SameHub);
continue;
}
const bool fromSnapshot = level.FromSnapshot;
E_PlayerEntered(ii, fromSnapshot && finishstate == FINISH_SameHub);
if (fromSnapshot)
{
// 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);
}
}