Merge remote-tracking branch 'origin/new_level_refactor' into HEAD

This commit is contained in:
Rachael Alexanderson 2019-02-06 10:30:27 -05:00
commit 4f0850b098
5 changed files with 7 additions and 6 deletions

View File

@ -217,7 +217,7 @@ void EventManager::InitHandler(PClass* type)
RegisterHandler(handler); RegisterHandler(handler);
} }
void EventManager::InitStaticHandlers(bool map) void EventManager::InitStaticHandlers(FLevelLocals *l, bool map)
{ {
// don't initialize map handlers if restoring from savegame. // don't initialize map handlers if restoring from savegame.
if (savegamerestore) if (savegamerestore)
@ -225,6 +225,7 @@ void EventManager::InitStaticHandlers(bool map)
// just make sure // just make sure
Shutdown(); Shutdown();
Level = l;
// initialize event handlers from gameinfo // initialize event handlers from gameinfo
for (const FString& typeName : gameinfo.EventHandlers) for (const FString& typeName : gameinfo.EventHandlers)
@ -241,7 +242,7 @@ void EventManager::InitStaticHandlers(bool map)
return; return;
// initialize event handlers from mapinfo // initialize event handlers from mapinfo
for (const FString& typeName : level.info->EventHandlers) for (const FString& typeName : Level->info->EventHandlers)
{ {
PClass* type = GetHandlerClass(typeName); PClass* type = GetHandlerClass(typeName);
if (IsStaticType(type)) if (IsStaticType(type))

View File

@ -249,7 +249,7 @@ struct EventManager
// check type // check type
bool IsStaticType(PClass* type); bool IsStaticType(PClass* type);
// init static handlers // init static handlers
void InitStaticHandlers(bool map); void InitStaticHandlers(FLevelLocals *l, bool map);
// shutdown handlers // shutdown handlers
void Shutdown(); void Shutdown();

View File

@ -395,7 +395,7 @@ void PClassActor::StaticInit()
InitBotStuff(); InitBotStuff();
// reinit GLOBAL static stuff from gameinfo, once classes are loaded. // reinit GLOBAL static stuff from gameinfo, once classes are loaded.
staticEventManager.InitStaticHandlers(false); staticEventManager.InitStaticHandlers(primaryLevel, false);
} }
//========================================================================== //==========================================================================

View File

@ -423,7 +423,7 @@ void P_SetupLevel(FLevelLocals *Level, int position, bool newGame)
// [ZZ] init per-map static handlers. we need to call this before everything is set up because otherwise scripts don't receive PlayerEntered event // [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) // (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)
Level->localEventManager->InitStaticHandlers(true); Level->localEventManager->InitStaticHandlers(Level, true);
// generate a checksum for the level, to be included and checked with savegames. // generate a checksum for the level, to be included and checked with savegames.
map->GetChecksum(Level->md5); map->GetChecksum(Level->md5);

View File

@ -271,7 +271,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
texture.SetInvalid(); texture.SetInvalid();
level_info_t * li = FindLevelInfo(wbs->current); level_info_t * li = FindLevelInfo(wbs->current);
if (li != nullptr) exitpic = li->EnterPic; if (li != nullptr) exitpic = li->ExitPic;
lumpname = exitpic; lumpname = exitpic;
if (isenterpic) if (isenterpic)