Implemented RenderOverlay hook that executes directly after level and statusbar

This commit is contained in:
ZZYZX 2017-02-03 13:29:17 +02:00
parent 6a0103a746
commit 0d96517f5f
4 changed files with 21 additions and 0 deletions

View file

@ -900,6 +900,8 @@ void D_Display ()
{ {
NetUpdate (); // send out any new accumulation NetUpdate (); // send out any new accumulation
// normal update // normal update
// draw ZScript UI stuff
E_RenderOverlay();
C_DrawConsole (hw2d); // draw console C_DrawConsole (hw2d); // draw console
M_Drawer (); // menu is drawn even on top of everything M_Drawer (); // menu is drawn even on top of everything
FStat::PrintStat (); FStat::PrintStat ();

View file

@ -411,6 +411,7 @@ bool E_CheckUiProcessors()
// normal event loopers (non-special, argument-less) // normal event loopers (non-special, argument-less)
DEFINE_EVENT_LOOPER(RenderFrame) DEFINE_EVENT_LOOPER(RenderFrame)
DEFINE_EVENT_LOOPER(RenderOverlay)
DEFINE_EVENT_LOOPER(WorldLightning) DEFINE_EVENT_LOOPER(WorldLightning)
DEFINE_EVENT_LOOPER(WorldTick) DEFINE_EVENT_LOOPER(WorldTick)
@ -589,6 +590,7 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLightning)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldTick) DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldTick)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, RenderFrame) DEFINE_EMPTY_HANDLER(DStaticEventHandler, RenderFrame)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, RenderOverlay)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerEntered) DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerEntered)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerRespawned) 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_SetupPlayerEvent()
{ {
static DPlayerEvent* e = nullptr; static DPlayerEvent* e = nullptr;

View file

@ -45,6 +45,8 @@ void E_WorldLightning();
void E_WorldTick(); void E_WorldTick();
// called on each render frame once. // called on each render frame once.
void E_RenderFrame(); 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 // this executes when a player enters the level (once). PlayerEnter+inhub = RETURN
void E_PlayerEntered(int num, bool fromhub); void E_PlayerEntered(int num, bool fromhub);
// this executes when a player respawns. includes resurrect cheat. // this executes when a player respawns. includes resurrect cheat.
@ -125,6 +127,7 @@ public:
// //
void RenderFrame(); void RenderFrame();
void RenderOverlay();
// //
void PlayerEntered(int num, bool fromhub); void PlayerEntered(int num, bool fromhub);

View file

@ -301,6 +301,7 @@ class StaticEventHandler : Object native
// //
virtual native void RenderFrame(RenderEvent e); virtual native void RenderFrame(RenderEvent e);
virtual native void RenderOverlay(RenderEvent e);
// //
virtual native void PlayerEntered(PlayerEvent e); virtual native void PlayerEntered(PlayerEvent e);