mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 14:22:13 +00:00
- fixed handling of PlayerEntered event.
This was done in P_SpawnPlayer where it would be called not only on voodoo dolls but also on temporary player pawns. The second case was attempted to avoid, but this would break intra-hub travels to unvisited levels. Moved the handling to G_DoLoadLevel for all cases where we have a clear and unambiguous situation with all players being set up and no voodoo dolls that might trigger an event.
This commit is contained in:
parent
555f339924
commit
43c5fa93f9
2 changed files with 18 additions and 21 deletions
|
@ -125,6 +125,7 @@ int starttime;
|
|||
extern FString BackupSaveName;
|
||||
|
||||
bool savegamerestore;
|
||||
int finishstate;
|
||||
|
||||
extern int mousex, mousey;
|
||||
extern bool sendpause, sendsave, sendturn180, SendLand;
|
||||
|
@ -160,6 +161,7 @@ void G_DeferedInitNew (FGameStartup *gs)
|
|||
d_skill = gs->Skill;
|
||||
CheckWarpTransMap (d_mapname, true);
|
||||
gameaction = ga_newgame2;
|
||||
finishstate = FINISH_NoHub;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -897,6 +899,7 @@ void G_DoCompleted (void)
|
|||
}
|
||||
|
||||
gamestate = GS_INTERMISSION;
|
||||
finishstate = mode;
|
||||
viewactive = false;
|
||||
automapactive = false;
|
||||
|
||||
|
@ -1068,11 +1071,24 @@ void G_DoLoadLevel (int position, bool autosave)
|
|||
// For each player, if they are viewing through a player, make sure it is themselves.
|
||||
for (int ii = 0; ii < MAXPLAYERS; ++ii)
|
||||
{
|
||||
if (playeringame[ii] && (players[ii].camera == NULL || players[ii].camera->player != NULL))
|
||||
if (playeringame[ii])
|
||||
{
|
||||
players[ii].camera = players[ii].mo;
|
||||
if (players[ii].camera == NULL || players[ii].camera->player != NULL)
|
||||
{
|
||||
players[ii].camera = players[ii].mo;
|
||||
}
|
||||
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.
|
||||
if (level.FromSnapshot) FBehavior::StaticStartTypedScripts(SCRIPT_Return, players[ii].mo, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (level.FromSnapshot)
|
||||
{
|
||||
// [Nash] run REOPEN scripts upon map re-entry
|
||||
FBehavior::StaticStartTypedScripts(SCRIPT_Reopen, NULL, false);
|
||||
}
|
||||
|
||||
StatusBar->AttachToPlayer (&players[consoleplayer]);
|
||||
// unsafe world load
|
||||
E_WorldLoadedUnsafe();
|
||||
|
@ -1354,22 +1370,6 @@ void G_FinishTravel ()
|
|||
pawns[pawnsnum++] = pawn;
|
||||
}
|
||||
|
||||
// [ZZ] fire the reopen hook.
|
||||
// if level is loaded from snapshot, and we don't have savegamerestore, this means we returned from a hub.
|
||||
if (level.FromSnapshot)
|
||||
{
|
||||
// [Nash] run REOPEN scripts upon map re-entry
|
||||
FBehavior::StaticStartTypedScripts(SCRIPT_Reopen, NULL, false);
|
||||
|
||||
for (int i = 0; i < pawnsnum; i++)
|
||||
{
|
||||
// [ZZ] fire the enter hook.
|
||||
E_PlayerEntered(int(pawns[i]->player - players), true);
|
||||
//
|
||||
FBehavior::StaticStartTypedScripts(SCRIPT_Return, pawns[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
bglobal.FinishTravel ();
|
||||
|
||||
// make sure that, after travelling has completed, no travelling thinkers are left.
|
||||
|
|
|
@ -5511,9 +5511,6 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
{
|
||||
if (state == PST_ENTER || (state == PST_LIVE && !savegamerestore))
|
||||
{
|
||||
// [ZZ] fire non-hub ENTER event
|
||||
// level.time is a hack to make sure that we don't call it on dummy player initialization during hub return.
|
||||
if (!level.time) E_PlayerEntered(int(p - players), false);
|
||||
FBehavior::StaticStartTypedScripts (SCRIPT_Enter, p->mo, true);
|
||||
}
|
||||
else if (state == PST_REBORN)
|
||||
|
|
Loading…
Reference in a new issue