Added RenderUnderlay.

- Works exactly like RenderOverlay, but is drawn behind the status bar/huds instead.
This commit is contained in:
Major Cooke 2019-06-22 20:02:35 -05:00 committed by Christoph Oelckers
parent e7e46f8c7c
commit 7b698b4a0e
4 changed files with 26 additions and 0 deletions

View file

@ -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)

View file

@ -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.

View file

@ -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);
}
//---------------------------------------------------------------------------

View file

@ -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) {}