mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-22 20:11:14 +00:00
- implemented basics for virtual HUD size and moved some code out of D_Display
This doesn't work fully yet.
This commit is contained in:
parent
8c9d7dd131
commit
70a09538c5
9 changed files with 128 additions and 84 deletions
125
src/d_main.cpp
125
src/d_main.cpp
|
@ -146,7 +146,6 @@ EXTERN_CVAR (Float, m_pitch)
|
|||
EXTERN_CVAR (Float, m_yaw)
|
||||
EXTERN_CVAR (Bool, invertmouse)
|
||||
EXTERN_CVAR (Bool, lookstrafe)
|
||||
EXTERN_CVAR (Int, screenblocks)
|
||||
EXTERN_CVAR (Bool, sv_cheats)
|
||||
EXTERN_CVAR (Bool, sv_unlimited_pickup)
|
||||
EXTERN_CVAR (Bool, I_FriendlyWindowTitle)
|
||||
|
@ -208,7 +207,6 @@ CVAR (Bool, autoloadlights, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALC
|
|||
CVAR (Bool, r_debug_disable_vis_filter, false, 0)
|
||||
|
||||
bool wantToRestart;
|
||||
bool DrawFSHUD; // [RH] Draw fullscreen HUD?
|
||||
TArray<FString> allwads;
|
||||
bool devparm; // started game with -devparm
|
||||
const char *D_DrawIcon; // [RH] Patch name of icon to draw on next refresh
|
||||
|
@ -382,6 +380,49 @@ void D_Render(std::function<void()> action, bool interpolate)
|
|||
}
|
||||
}
|
||||
|
||||
void D_DrawOverlays()
|
||||
{
|
||||
// draw pause pic
|
||||
if ((paused || pauseext) && menuactive == MENU_Off)
|
||||
{
|
||||
FTexture *tex;
|
||||
int x;
|
||||
FString pstring = GStrings("TXT_BY");
|
||||
|
||||
tex = TexMan.GetTextureByName(gameinfo.PauseSign, true);
|
||||
x = (screen->GetUIWidth() - tex->GetDisplayWidth() * CleanXfac)/2 +
|
||||
tex->GetDisplayLeftOffset() * CleanXfac;
|
||||
screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE);
|
||||
if (paused && multiplayer)
|
||||
{
|
||||
pstring << ' ' << players[paused - 1].userinfo.GetName();
|
||||
screen->DrawText(SmallFont, CR_RED,
|
||||
(screen->GetUIWidth() - SmallFont->StringWidth(pstring)*CleanXfac) / 2,
|
||||
(tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
// [RH] Draw icon, if any
|
||||
if (D_DrawIcon)
|
||||
{
|
||||
FTextureID picnum = TexMan.CheckForTexture (D_DrawIcon, ETextureType::MiscPatch);
|
||||
|
||||
D_DrawIcon = NULL;
|
||||
if (picnum.isValid())
|
||||
{
|
||||
FTexture *tex = TexMan.GetTexture(picnum);
|
||||
screen->DrawTexture (tex, 160 - tex->GetDisplayWidth()/2, 100 - tex->GetDisplayHeight()/2,
|
||||
DTA_320x200, true, TAG_DONE);
|
||||
}
|
||||
NoWipe = 10;
|
||||
}
|
||||
|
||||
if (snd_drawoutput)
|
||||
{
|
||||
GSnd->DrawWaveDebug(snd_drawoutput);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CVAR dmflags
|
||||
|
@ -779,41 +820,7 @@ void D_Display ()
|
|||
{
|
||||
primaryLevel->automap->Drawer ((hud_althud && viewheight == screen->GetScreenHeight()) ? viewheight : StatusBar->GetTopOfStatusbar());
|
||||
}
|
||||
|
||||
// for timing the statusbar code.
|
||||
//cycle_t stb;
|
||||
//stb.Reset();
|
||||
//stb.Clock();
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
StatusBar->RefreshViewBorder ();
|
||||
}
|
||||
if (hud_althud && viewheight == screen->GetScreenHeight() && screenblocks > 10)
|
||||
{
|
||||
StatusBar->DrawBottomStuff (HUD_AltHud);
|
||||
if (DrawFSHUD || automapactive) StatusBar->DrawAltHUD();
|
||||
if (players[consoleplayer].camera && players[consoleplayer].camera->player && !automapactive)
|
||||
{
|
||||
StatusBar->DrawCrosshair();
|
||||
}
|
||||
StatusBar->CallDraw (HUD_AltHud, vp.TicFrac);
|
||||
StatusBar->DrawTopStuff (HUD_AltHud);
|
||||
}
|
||||
else if (viewheight == screen->GetScreenHeight() && viewactive && screenblocks > 10)
|
||||
{
|
||||
EHudState state = DrawFSHUD ? HUD_Fullscreen : HUD_None;
|
||||
StatusBar->DrawBottomStuff (state);
|
||||
StatusBar->CallDraw (state, vp.TicFrac);
|
||||
StatusBar->DrawTopStuff (state);
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusBar->DrawBottomStuff (HUD_StatusBar);
|
||||
StatusBar->CallDraw (HUD_StatusBar, vp.TicFrac);
|
||||
StatusBar->DrawTopStuff (HUD_StatusBar);
|
||||
}
|
||||
//stb.Unclock();
|
||||
//Printf("Stbar = %f\n", stb.TimeMS());
|
||||
StatusBar->DrawAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -821,7 +828,6 @@ void D_Display ()
|
|||
switch (gamestate)
|
||||
{
|
||||
case GS_FULLCONSOLE:
|
||||
screen->Begin2D();
|
||||
C_DrawConsole ();
|
||||
M_Drawer ();
|
||||
screen->End2DAndUpdate ();
|
||||
|
@ -844,46 +850,7 @@ void D_Display ()
|
|||
}
|
||||
}
|
||||
CT_Drawer ();
|
||||
|
||||
// draw pause pic
|
||||
if ((paused || pauseext) && menuactive == MENU_Off)
|
||||
{
|
||||
FTexture *tex;
|
||||
int x;
|
||||
FString pstring = GStrings("TXT_BY");
|
||||
|
||||
tex = TexMan.GetTextureByName(gameinfo.PauseSign, true);
|
||||
x = (screen->GetUIWidth() - tex->GetDisplayWidth() * CleanXfac)/2 +
|
||||
tex->GetDisplayLeftOffset() * CleanXfac;
|
||||
screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE);
|
||||
if (paused && multiplayer)
|
||||
{
|
||||
pstring << ' ' << players[paused - 1].userinfo.GetName();
|
||||
screen->DrawText(SmallFont, CR_RED,
|
||||
(screen->GetUIWidth() - SmallFont->StringWidth(pstring)*CleanXfac) / 2,
|
||||
(tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
// [RH] Draw icon, if any
|
||||
if (D_DrawIcon)
|
||||
{
|
||||
FTextureID picnum = TexMan.CheckForTexture (D_DrawIcon, ETextureType::MiscPatch);
|
||||
|
||||
D_DrawIcon = NULL;
|
||||
if (picnum.isValid())
|
||||
{
|
||||
FTexture *tex = TexMan.GetTexture(picnum);
|
||||
screen->DrawTexture (tex, 160 - tex->GetDisplayWidth()/2, 100 - tex->GetDisplayHeight()/2,
|
||||
DTA_320x200, true, TAG_DONE);
|
||||
}
|
||||
NoWipe = 10;
|
||||
}
|
||||
|
||||
if (snd_drawoutput)
|
||||
{
|
||||
GSnd->DrawWaveDebug(snd_drawoutput);
|
||||
}
|
||||
D_DrawOverlays();
|
||||
|
||||
if (!wipe || NoWipe < 0 || wipe_type == wipe_None)
|
||||
{
|
||||
|
@ -990,7 +957,7 @@ void D_DoomLoop ()
|
|||
{
|
||||
try
|
||||
{
|
||||
// frame syncronous IO operations
|
||||
// frame synchronous IO operations
|
||||
if (gametic > lasttic)
|
||||
{
|
||||
lasttic = gametic;
|
||||
|
|
|
@ -449,6 +449,8 @@ public:
|
|||
return SBarTop;
|
||||
}
|
||||
|
||||
void DrawAll();
|
||||
|
||||
//protected:
|
||||
void DrawPowerups ();
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ enum
|
|||
};
|
||||
|
||||
EXTERN_CVAR(Int, fraglimit)
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
EXTERN_CVAR(Bool, vid_fps)
|
||||
|
||||
class DSBarInfo;
|
||||
|
|
|
@ -84,12 +84,17 @@ EXTERN_CVAR (Bool, am_showtotaltime)
|
|||
EXTERN_CVAR (Bool, noisedebug)
|
||||
EXTERN_CVAR (Int, con_scaletext)
|
||||
EXTERN_CVAR(Bool, vid_fps)
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
EXTERN_CVAR(Bool, hud_althud)
|
||||
|
||||
CVAR(Int, hud_scale, 0, CVAR_ARCHIVE);
|
||||
|
||||
|
||||
DBaseStatusBar *StatusBar;
|
||||
|
||||
extern int setblocks;
|
||||
extern bool DrawFSHUD; // [RH] Draw fullscreen HUD?
|
||||
|
||||
|
||||
FTexture *CrosshairImage;
|
||||
static int CrosshairNum;
|
||||
|
@ -743,6 +748,52 @@ void DBaseStatusBar::DetachAllMessages ()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC DrawAll
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DBaseStatusBar::DrawAll()
|
||||
{
|
||||
// for timing the statusbar code.
|
||||
//cycle_t stb;
|
||||
//stb.Reset();
|
||||
//stb.Clock();
|
||||
auto &vp = r_viewpoint;
|
||||
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
RefreshViewBorder ();
|
||||
}
|
||||
if (hud_althud && viewheight == screen->GetScreenHeight() && screenblocks > 10)
|
||||
{
|
||||
DrawBottomStuff (HUD_AltHud);
|
||||
if (DrawFSHUD || automapactive) DrawAltHUD();
|
||||
if (players[consoleplayer].camera && players[consoleplayer].camera->player && !automapactive)
|
||||
{
|
||||
DrawCrosshair();
|
||||
}
|
||||
CallDraw (HUD_AltHud, vp.TicFrac);
|
||||
DrawTopStuff (HUD_AltHud);
|
||||
}
|
||||
else if (viewheight == screen->GetScreenHeight() && viewactive && screenblocks > 10)
|
||||
{
|
||||
EHudState state = DrawFSHUD ? HUD_Fullscreen : HUD_None;
|
||||
DrawBottomStuff (state);
|
||||
CallDraw (state, vp.TicFrac);
|
||||
DrawTopStuff (state);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawBottomStuff (HUD_StatusBar);
|
||||
CallDraw (HUD_StatusBar, vp.TicFrac);
|
||||
DrawTopStuff (HUD_StatusBar);
|
||||
}
|
||||
//stb.Unclock();
|
||||
//Printf("Stbar = %f\n", stb.TimeMS());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC ShowPlayerName
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||
|
||||
extern bool DrawFSHUD; // [RH] Defined in d_main.cpp
|
||||
bool DrawFSHUD;
|
||||
EXTERN_CVAR (Bool, cl_capfps)
|
||||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
#include "r_data/models/models.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
|
||||
extern bool NoInterpolateView;
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
CVAR(String, r_viewsize, "", CVAR_NOSET)
|
||||
|
||||
EXTERN_CVAR(Float, r_visibility);
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
|
|
@ -56,6 +56,10 @@
|
|||
CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE);
|
||||
CVAR(Bool, vid_fps, false, 0)
|
||||
CVAR(Int, vid_showpalette, 0, 0)
|
||||
CUSTOM_CVAR(Int, hud_virtualheight, -1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self > 0 && self < 480) self = 480;
|
||||
}
|
||||
|
||||
EXTERN_CVAR(Bool, ticker)
|
||||
EXTERN_CVAR(Float, vid_brightness)
|
||||
|
@ -114,6 +118,28 @@ void DFrameBuffer::SetSize(int width, int height)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::UpdateVirtualSize()
|
||||
{
|
||||
if (hud_virtualheight < 0)
|
||||
{
|
||||
UIWidth = ScreenWidth;
|
||||
UIHeight = ScreenHeight;
|
||||
m2DDrawer.SetVirtualScale(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIHeight = hud_virtualheight;
|
||||
UIWidth = Scale(ScreenWidth, UIHeight, ScreenHeight);
|
||||
m2DDrawer.SetVirtualScale(double(ScreenHeight) / UIHeight);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::DrawPaletteTester(int paletteno)
|
||||
{
|
||||
int blocksize = screen->GetUIHeight() / 50;
|
||||
|
|
|
@ -450,9 +450,10 @@ public:
|
|||
virtual IIndexBuffer *CreateIndexBuffer() { return nullptr; }
|
||||
virtual IDataBuffer *CreateDataBuffer(int bindingpoint, bool ssbo) { return nullptr; }
|
||||
bool BuffersArePersistent() { return !!(hwcaps & RFL_BUFFER_STORAGE); }
|
||||
void UpdateVirtualSize();
|
||||
|
||||
// Begin/End 2D drawing operations.
|
||||
void Begin2D() { isIn2D = true; }
|
||||
void Begin2D() { isIn2D = true; UpdateVirtualSize(); }
|
||||
void End2D() { isIn2D = false; }
|
||||
|
||||
void End2DAndUpdate()
|
||||
|
|
Loading…
Reference in a new issue