From f38060d01b434e8039d9095c7fc0eec7419c8441 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 Feb 2019 15:33:19 +0100 Subject: [PATCH 1/2] - fixed: The static event manager never got a link to the primary level. --- src/events.cpp | 5 +++-- src/events.h | 2 +- src/gamedata/info.cpp | 2 +- src/p_setup.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/events.cpp b/src/events.cpp index 033d647b1..21a4409fb 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -217,7 +217,7 @@ void EventManager::InitHandler(PClass* type) RegisterHandler(handler); } -void EventManager::InitStaticHandlers(bool map) +void EventManager::InitStaticHandlers(FLevelLocals *l, bool map) { // don't initialize map handlers if restoring from savegame. if (savegamerestore) @@ -225,6 +225,7 @@ void EventManager::InitStaticHandlers(bool map) // just make sure Shutdown(); + Level = l; // initialize event handlers from gameinfo for (const FString& typeName : gameinfo.EventHandlers) @@ -241,7 +242,7 @@ void EventManager::InitStaticHandlers(bool map) return; // initialize event handlers from mapinfo - for (const FString& typeName : level.info->EventHandlers) + for (const FString& typeName : Level->info->EventHandlers) { PClass* type = GetHandlerClass(typeName); if (IsStaticType(type)) diff --git a/src/events.h b/src/events.h index b207f924b..79c75023a 100755 --- a/src/events.h +++ b/src/events.h @@ -249,7 +249,7 @@ struct EventManager // check type bool IsStaticType(PClass* type); // init static handlers - void InitStaticHandlers(bool map); + void InitStaticHandlers(FLevelLocals *l, bool map); // shutdown handlers void Shutdown(); diff --git a/src/gamedata/info.cpp b/src/gamedata/info.cpp index f06e56b46..010200a77 100644 --- a/src/gamedata/info.cpp +++ b/src/gamedata/info.cpp @@ -395,7 +395,7 @@ void PClassActor::StaticInit() InitBotStuff(); // reinit GLOBAL static stuff from gameinfo, once classes are loaded. - staticEventManager.InitStaticHandlers(false); + staticEventManager.InitStaticHandlers(primaryLevel, false); } //========================================================================== diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 7ea4d9f15..dddfe2d46 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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 // (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. map->GetChecksum(Level->md5); From 74d34f6171cd28a08eba2a8bc68b16fc9ea1df34 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 Feb 2019 15:39:47 +0100 Subject: [PATCH 2/2] - fixed typo in ExitPic display. It read the EnterPic instead. --- src/wi_stuff.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index e5da62553..c752be66d 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -271,7 +271,7 @@ bool DInterBackground::LoadBackground(bool isenterpic) texture.SetInvalid(); level_info_t * li = FindLevelInfo(wbs->current); - if (li != nullptr) exitpic = li->EnterPic; + if (li != nullptr) exitpic = li->ExitPic; lumpname = exitpic; if (isenterpic)