diff --git a/src/d_main.cpp b/src/d_main.cpp index 5b091a6ac..2a4b44dec 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -900,6 +900,8 @@ void D_Display () { NetUpdate (); // send out any new accumulation // normal update + // draw ZScript UI stuff + E_RenderOverlay(); C_DrawConsole (hw2d); // draw console M_Drawer (); // menu is drawn even on top of everything FStat::PrintStat (); diff --git a/src/events.cpp b/src/events.cpp index 040165c88..b169cee01 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -411,6 +411,7 @@ bool E_CheckUiProcessors() // normal event loopers (non-special, argument-less) DEFINE_EVENT_LOOPER(RenderFrame) +DEFINE_EVENT_LOOPER(RenderOverlay) DEFINE_EVENT_LOOPER(WorldLightning) DEFINE_EVENT_LOOPER(WorldTick) @@ -589,6 +590,7 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLightning) DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldTick) DEFINE_EMPTY_HANDLER(DStaticEventHandler, RenderFrame) +DEFINE_EMPTY_HANDLER(DStaticEventHandler, RenderOverlay) DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerEntered) DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerRespawned) @@ -798,6 +800,19 @@ void DStaticEventHandler::RenderFrame() } } +void DStaticEventHandler::RenderOverlay() +{ + IFVIRTUAL(DStaticEventHandler, RenderOverlay) + { + // don't create excessive DObjects if not going to be processed anyway + if (func == DStaticEventHandler_RenderOverlay_VMPtr) + return; + DRenderEvent* e = E_SetupRenderEvent(); + VMValue params[2] = { (DStaticEventHandler*)this, e }; + GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr); + } +} + static DPlayerEvent* E_SetupPlayerEvent() { static DPlayerEvent* e = nullptr; diff --git a/src/events.h b/src/events.h index 408a2a152..a116782c2 100755 --- a/src/events.h +++ b/src/events.h @@ -45,6 +45,8 @@ void E_WorldLightning(); void E_WorldTick(); // called on each render frame once. void E_RenderFrame(); +// called after everything's been rendered, but before console/menus +void E_RenderOverlay(); // this executes when a player enters the level (once). PlayerEnter+inhub = RETURN void E_PlayerEntered(int num, bool fromhub); // this executes when a player respawns. includes resurrect cheat. @@ -125,6 +127,7 @@ public: // void RenderFrame(); + void RenderOverlay(); // void PlayerEntered(int num, bool fromhub); diff --git a/wadsrc/static/zscript/events.txt b/wadsrc/static/zscript/events.txt index bbbe06534..f96d6e6dc 100755 --- a/wadsrc/static/zscript/events.txt +++ b/wadsrc/static/zscript/events.txt @@ -301,6 +301,7 @@ class StaticEventHandler : Object native // virtual native void RenderFrame(RenderEvent e); + virtual native void RenderOverlay(RenderEvent e); // virtual native void PlayerEntered(PlayerEvent e);