mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Moved E_InitStaticHandlers(true) a bit higher in the initialization so that local scripts receive PlayerEntered properly
This commit is contained in:
parent
490159f6df
commit
27c5e21a1d
3 changed files with 11 additions and 2 deletions
|
@ -197,6 +197,8 @@ void E_InitStaticHandlers(bool map)
|
|||
|
||||
if (map) // don't initialize map handlers if restoring from savegame.
|
||||
{
|
||||
Printf("Initializing map handlers\n");
|
||||
|
||||
// delete old handlers if any.
|
||||
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
||||
{
|
||||
|
@ -211,6 +213,7 @@ void E_InitStaticHandlers(bool map)
|
|||
PClass* type = PClass::FindClass(typestring);
|
||||
if (!type || E_IsStaticType(type)) // don't init the really global stuff here.
|
||||
continue;
|
||||
Printf("global -> %s\n", typestring.GetChars());
|
||||
E_InitStaticHandler(type, typestring, false);
|
||||
}
|
||||
|
||||
|
@ -218,6 +221,7 @@ void E_InitStaticHandlers(bool map)
|
|||
{
|
||||
FString typestring = level.info->EventHandlers[i];
|
||||
PClass* type = PClass::FindClass(typestring);
|
||||
Printf("level -> %s\n", typestring.GetChars());
|
||||
E_InitStaticHandler(type, typestring, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1021,6 +1021,7 @@ void G_DoLoadLevel (int position, bool autosave)
|
|||
}
|
||||
|
||||
level.maptime = 0;
|
||||
|
||||
P_SetupLevel (level.MapName, position);
|
||||
|
||||
AM_LevelInit();
|
||||
|
@ -1062,6 +1063,7 @@ void G_DoLoadLevel (int position, bool autosave)
|
|||
}
|
||||
|
||||
level.starttime = gametic;
|
||||
|
||||
G_UnSnapshotLevel (!savegamerestore); // [RH] Restore the state of the level.
|
||||
G_FinishTravel ();
|
||||
// For each player, if they are viewing through a player, make sure it is themselves.
|
||||
|
@ -1073,8 +1075,6 @@ void G_DoLoadLevel (int position, bool autosave)
|
|||
}
|
||||
}
|
||||
StatusBar->AttachToPlayer (&players[consoleplayer]);
|
||||
// [ZZ] init per-map static handlers
|
||||
E_InitStaticHandlers(true);
|
||||
// unsafe world load
|
||||
E_WorldLoadedUnsafe();
|
||||
// regular world load (savegames are handled internally)
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
#ifndef NO_EDATA
|
||||
#include "edata.h"
|
||||
#endif
|
||||
#include "events.h"
|
||||
|
||||
#include "fragglescript/t_fs.h"
|
||||
|
||||
|
@ -3627,6 +3628,10 @@ void P_SetupLevel (const char *lumpname, int position)
|
|||
I_Error("Unable to open map '%s'\n", lumpname);
|
||||
}
|
||||
|
||||
// [ZZ] init per-map static handlers. we need to call this before everything is set up because otherwise scripts don't receive PlayerEntered event
|
||||
// (which happens at god-knows-what stage in this function, but definitely not the last part, because otherwise it'd work to put E_InitStaticHandlers before the player spawning)
|
||||
E_InitStaticHandlers(true);
|
||||
|
||||
// generate a checksum for the level, to be included and checked with savegames.
|
||||
map->GetChecksum(level.md5);
|
||||
// find map num
|
||||
|
|
Loading…
Reference in a new issue