- reimplemented the position display, but changed its position a bit upward.

- activated the RenderOverlay event, now that it can be called from the correct spot, i.e. right after the top level HUD messages are drawn. The system's status output will still be drawn on top of them.
This commit is contained in:
Christoph Oelckers 2017-03-29 23:51:53 +02:00
parent bde73fc530
commit 1dcc017daf
6 changed files with 38 additions and 50 deletions

View file

@ -900,7 +900,6 @@ 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 ();

View file

@ -448,6 +448,12 @@ void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manu
handler->ConsoleProcess(player, name, arg1, arg2, arg3, manual);
}
void E_RenderOverlay(EHudState state)
{
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
handler->RenderOverlay(state);
}
bool E_CheckUiProcessors()
{
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
@ -468,7 +474,6 @@ bool E_CheckRequireMouse()
// normal event loopers (non-special, argument-less)
DEFINE_EVENT_LOOPER(RenderFrame)
DEFINE_EVENT_LOOPER(RenderOverlay)
DEFINE_EVENT_LOOPER(WorldLightning)
DEFINE_EVENT_LOOPER(WorldTick)
DEFINE_EVENT_LOOPER(UiTick)
@ -798,7 +803,7 @@ void DStaticEventHandler::RenderFrame()
}
}
void DStaticEventHandler::RenderOverlay()
void DStaticEventHandler::RenderOverlay(EHudState state)
{
IFVIRTUAL(DStaticEventHandler, RenderOverlay)
{
@ -806,6 +811,7 @@ void DStaticEventHandler::RenderOverlay()
if (func == DStaticEventHandler_RenderOverlay_VMPtr)
return;
FRenderEvent e = E_SetupRenderEvent();
e.HudState = int(state);
VMValue params[2] = { (DStaticEventHandler*)this, &e };
GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr);
}

View file

@ -5,6 +5,7 @@
#include "serializer.h"
#include "d_event.h"
#include "d_gui.h"
#include "sbar.h"
class DStaticEventHandler;
@ -48,7 +49,7 @@ void E_UiTick();
// called on each render frame once.
void E_RenderFrame();
// called after everything's been rendered, but before console/menus
void E_RenderOverlay();
void E_RenderOverlay(EHudState state);
// 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.
@ -141,7 +142,7 @@ public:
//
void RenderFrame();
void RenderOverlay();
void RenderOverlay(EHudState state);
//
void PlayerEntered(int num, bool fromhub);
@ -175,6 +176,7 @@ struct FRenderEvent
DAngle ViewRoll;
double FracTic = 0; // 0..1 value that describes where we are inside the current gametic, render-wise.
AActor* Camera = nullptr;
int HudState;
};
struct FWorldEvent

View file

@ -61,6 +61,7 @@
#include "p_acs.h"
#include "r_data/r_translate.h"
#include "sbarinfo.h"
#include "events.h"
#include "../version.h"
@ -975,7 +976,14 @@ void DBaseStatusBar::Draw (EHudState state)
}
if (idmypos)
{ // Draw current coordinates
{
// Draw current coordinates
IFVIRTUAL(DBaseStatusBar, DrawMyPos)
{
VMValue params[] = { (DObject*)this };
GlobalVMStack.Call(func, params, countof(params), nullptr, 0);
}
V_SetBorderNeedRefresh();
}
if (viewactive)
@ -1150,6 +1158,8 @@ void DBaseStatusBar::DrawTopStuff (EHudState state)
DrawMessages (HUDMSGLayer_OverMap, (state == HUD_StatusBar) ? GetTopOfStatusbar() : SCREENHEIGHT);
}
DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? GetTopOfStatusbar() : SCREENHEIGHT);
E_RenderOverlay(state);
DrawConsistancy ();
DrawWaiting ();
if (ShowLog && MustDrawLog(state)) DrawLog ();

View file

@ -305,7 +305,7 @@ class StaticEventHandler : Object native play version("2.4")
//
//virtual native ui void RenderFrame(RenderEvent e);
//virtual native ui void RenderOverlay(RenderEvent e);
virtual native ui void RenderOverlay(RenderEvent e);
//
virtual native void PlayerEntered(PlayerEvent e);

View file

@ -682,59 +682,30 @@ class BaseStatusBar native ui
virtual void DrawMyPos()
{
/*
int height = SmallFont->GetHeight();
char labels[3] = { 'X', 'Y', 'Z' };
int height = SmallFont.GetHeight();
int i;
int vwidth;
int vheight;
int xpos;
int y;
let scalevec = GetHUDScale();
int scale = int(scalevec.X);
if (active_con_scaletext() == 1)
{
vwidth = SCREENWIDTH;
vheight = SCREENHEIGHT;
xpos = vwidth - 80;
y = SBarTop - height;
}
else if (active_con_scaletext() > 1)
{
vwidth = SCREENWIDTH / active_con_scaletext();
vheight = SCREENHEIGHT / active_con_scaletext();
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
y = SBarTop/4 - height;
}
else
{
vwidth = SCREENWIDTH/2;
vheight = SCREENHEIGHT/2;
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
y = SBarTop/2 - height;
}
vwidth = screen.GetWidth() / scale;
vheight = screen.GetHeight() / scale;
xpos = vwidth - SmallFont.StringWidth("X: -00000")-6;
y = GetTopOfStatusBar() / (3*scale) - height;
if (gameinfo.gametype == GAME_Strife)
{
if (active_con_scaletext() == 1)
y -= height * 4;
else if (active_con_scaletext() > 3)
y -= height;
else
y -= height * 2;
}
Vector3 pos = CPlayer.mo.Pos;
DVector3 pos = CPlayer->mo->Pos();
for (i = 2; i >= 0; y -= height, --i)
for (i = 0; i < 3; y += height, ++i)
{
mysnprintf (line, countof(line), "%c: %d", labels[i], int(pos[i]));
screen->DrawText (SmallFont, CR_GREEN, xpos, y, line,
DTA_KeepRatio, true,
DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight,
TAG_DONE);
V_SetBorderNeedRefresh();
double v = i == 0? pos.X : i == 1? pos.Y : pos.Z;
String line = String.Format("%c: %d", int("X") + i, v);
screen.DrawText (SmallFont, Font.CR_GREEN, xpos, y, line, DTA_KeepRatio, true,
DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight);
}
*/
}
//============================================================================