diff --git a/src/events.cpp b/src/events.cpp index 935249d86..bb91ca8b0 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -491,6 +491,14 @@ void EventManager::RenderOverlay(EHudState state) handler->RenderOverlay(state); } +void EventManager::RenderUnderlay(EHudState state) +{ + if (ShouldCallStatic(false)) staticEventManager.RenderUnderlay(state); + + for (DStaticEventHandler* handler = FirstEventHandler; handler; handler = handler->next) + handler->RenderUnderlay(state); +} + bool EventManager::CheckUiProcessors() { if (ShouldCallStatic(false)) @@ -960,6 +968,19 @@ void DStaticEventHandler::RenderOverlay(EHudState state) } } +void DStaticEventHandler::RenderUnderlay(EHudState state) +{ + IFVIRTUAL(DStaticEventHandler, RenderUnderlay) + { + // don't create excessive DObjects if not going to be processed anyway + if (isEmpty(func)) return; + FRenderEvent e = owner->SetupRenderEvent(); + e.HudState = int(state); + VMValue params[2] = { (DStaticEventHandler*)this, &e }; + VMCall(func, params, 2, nullptr, 0); + } +} + void DStaticEventHandler::PlayerEntered(int num, bool fromhub) { IFVIRTUAL(DStaticEventHandler, PlayerEntered) diff --git a/src/events.h b/src/events.h index a2c5e67aa..52bf9ac21 100755 --- a/src/events.h +++ b/src/events.h @@ -91,6 +91,7 @@ public: // void RenderFrame(); void RenderOverlay(EHudState state); + void RenderUnderlay(EHudState state); // void PlayerEntered(int num, bool fromhub); @@ -289,6 +290,8 @@ struct EventManager void RenderFrame(); // called after everything's been rendered, but before console/menus void RenderOverlay(EHudState state); + // called after everything's been rendered, but before console/menus/huds + void RenderUnderlay(EHudState state); // this executes when a player enters the level (once). PlayerEnter+inhub = RETURN void PlayerEntered(int num, bool fromhub); // this executes when a player respawns. includes resurrect cheat. diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index a9dbf43e8..7bd1f48b1 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -1297,6 +1297,7 @@ void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone, b void DBaseStatusBar::DrawBottomStuff (EHudState state) { DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? GetTopOfStatusbar() : SCREENHEIGHT); + primaryLevel->localEventManager->RenderUnderlay(state); } //--------------------------------------------------------------------------- diff --git a/wadsrc/static/zscript/events.zs b/wadsrc/static/zscript/events.zs index 19f29c202..f79f8635b 100644 --- a/wadsrc/static/zscript/events.zs +++ b/wadsrc/static/zscript/events.zs @@ -336,6 +336,7 @@ class StaticEventHandler : Object native play version("2.4") // //virtual ui void RenderFrame(RenderEvent e) {} virtual ui void RenderOverlay(RenderEvent e) {} + virtual ui void RenderUnderlay(RenderEvent e) {} // virtual void PlayerEntered(PlayerEvent e) {}