ACS_RunPlayerEnterScript: If betweenmaps, defer until P_PostLoadLevel

Guarantees that the ENTER script actually consistently runs, since previously it was happening before ACS scope invalidation
This commit is contained in:
toaster 2024-03-30 15:56:44 +00:00
parent 193c85a418
commit e9205e19d6
2 changed files with 12 additions and 11 deletions

View file

@ -2519,9 +2519,9 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
}
}
if (p->spectator == false)
if (p->spectator == false && !betweenmaps)
{
if (betweenmaps || enteredGame == true)
if (enteredGame == true)
{
ACS_RunPlayerEnterScript(p);
}
@ -2530,15 +2530,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
ACS_RunPlayerRespawnScript(p);
}
}
if (betweenmaps)
return;
if (leveltime < starttime)
return;
if (exiting)
return;
}
//

View file

@ -8892,6 +8892,16 @@ void P_PostLoadLevel(void)
ACS_RunLevelStartScripts();
LUA_HookInt(gamemap, HOOK(MapLoad));
UINT8 i;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
if (players[i].spectator)
continue;
ACS_RunPlayerEnterScript(&players[i]);
}
P_MapEnd();
// We're now done loading the level.