Skip to content

Commit

Permalink
Fixed return state of player entered event
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Nov 12, 2017
1 parent 1088c60 commit 285834a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/g_level.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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))))
Expand All @@ -860,7 +862,6 @@ void G_DoCompleted (void)
}

gamestate = GS_INTERMISSION;
finishstate = mode;
viewactive = false;
automapactive = false;

Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 285834a

Please sign in to comment.