Skip to content
Permalink
Browse files

Added RenderUnderlay.

- Works exactly like RenderOverlay, but is drawn behind the status bar/huds instead.
  • Loading branch information...
MajorCooke authored and coelckers committed Jun 23, 2019
1 parent e7e46f8 commit 7b698b4a0e0be2ba8c7bb1a4a70bd4f1c2f80633
Showing with 26 additions and 0 deletions.
  1. +21 −0 src/events.cpp
  2. +3 −0 src/events.h
  3. +1 −0 src/g_statusbar/shared_sbar.cpp
  4. +1 −0 wadsrc/static/zscript/events.zs
@@ -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)
@@ -91,6 +91,7 @@ class DStaticEventHandler : public DObject // make it a part of normal GC proces
//
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.
@@ -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);
}

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

0 comments on commit 7b698b4

Please sign in to comment.
You can’t perform that action at this time.