mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
Moved high level parts of view border drawing to status bar.
This commit is contained in:
parent
5577143b6f
commit
56fd068126
6 changed files with 73 additions and 69 deletions
|
@ -760,16 +760,16 @@ void D_Display ()
|
|||
{
|
||||
AM_Drawer (hud_althud? viewheight : StatusBar->GetTopOfStatusbar());
|
||||
}
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
screen->RefreshViewBorder ();
|
||||
}
|
||||
|
||||
// for timing the statusbar code.
|
||||
//cycle_t stb;
|
||||
//stb.Reset();
|
||||
//stb.Clock();
|
||||
StatusBar->SetLevel(&level);
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
StatusBar->RefreshViewBorder ();
|
||||
}
|
||||
if (hud_althud && viewheight == SCREENHEIGHT && screenblocks > 10)
|
||||
{
|
||||
StatusBar->DrawBottomStuff (HUD_AltHud);
|
||||
|
|
12
src/dobjgc.h
12
src/dobjgc.h
|
@ -183,7 +183,7 @@ public:
|
|||
T operator=(nullptr_t nul)
|
||||
{
|
||||
o = nullptr;
|
||||
return nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// To allow NULL, too.
|
||||
|
@ -191,9 +191,17 @@ public:
|
|||
{
|
||||
assert(val == 0);
|
||||
o = nullptr;
|
||||
return nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// To allow NULL, too. In Clang NULL is a long.
|
||||
T operator=(const long val)
|
||||
{
|
||||
assert(val == 0);
|
||||
o = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator T() throw()
|
||||
{
|
||||
return GC::ReadBarrier(pp);
|
||||
|
|
|
@ -455,6 +455,7 @@ public:
|
|||
|
||||
|
||||
void RefreshBackground () const;
|
||||
void RefreshViewBorder ();
|
||||
|
||||
private:
|
||||
DObject *AltHud = nullptr;
|
||||
|
|
|
@ -436,7 +436,7 @@ void DBaseStatusBar::OnDestroy ()
|
|||
msg->Destroy();
|
||||
msg = next;
|
||||
}
|
||||
Messages[i] = NULL;
|
||||
Messages[i] = nullptr;
|
||||
}
|
||||
if (AltHud) AltHud->Destroy();
|
||||
Super::OnDestroy();
|
||||
|
@ -708,7 +708,7 @@ DHUDMessageBase *DBaseStatusBar::DetachMessage (DHUDMessageBase *msg)
|
|||
if (probe != NULL)
|
||||
{
|
||||
*prev = probe->Next;
|
||||
probe->Next = NULL;
|
||||
probe->Next = nullptr;
|
||||
return probe;
|
||||
}
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ DHUDMessageBase *DBaseStatusBar::DetachMessage (uint32_t id)
|
|||
if (probe != NULL)
|
||||
{
|
||||
*prev = probe->Next;
|
||||
probe->Next = NULL;
|
||||
probe->Next = nullptr;
|
||||
return probe;
|
||||
}
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ void DBaseStatusBar::DetachAllMessages ()
|
|||
{
|
||||
DHUDMessageBase *probe = Messages[i];
|
||||
|
||||
Messages[i] = NULL;
|
||||
Messages[i] = nullptr;
|
||||
while (probe != NULL)
|
||||
{
|
||||
DHUDMessageBase *next = probe->Next;
|
||||
|
@ -774,6 +774,49 @@ void DBaseStatusBar::ShowPlayerName ()
|
|||
1.5f, 0.92f, 0, 0, color, 2.f, 0.35f), MAKE_ID('P','N','A','M'));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static FTextureID GetBorderTexture(FLevelLocals *Level)
|
||||
{
|
||||
if (Level != nullptr && Level->info != nullptr && Level->info->BorderTexture.Len() != 0)
|
||||
{
|
||||
auto picnum = TexMan.CheckForTexture (Level->info->BorderTexture, ETextureType::Flat);
|
||||
if (picnum.isValid()) return picnum;
|
||||
}
|
||||
return TexMan.CheckForTexture (gameinfo.BorderFlat, ETextureType::Flat);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_RefreshViewBorder
|
||||
//
|
||||
// Draws the border around the player view, if needed.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DBaseStatusBar::RefreshViewBorder ()
|
||||
{
|
||||
if (setblocks < 10)
|
||||
{
|
||||
int Width = screen->GetWidth();
|
||||
if (viewwidth == Width)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto tex = GetBorderTexture(Level);
|
||||
screen->DrawBorder (tex, 0, 0, Width, viewwindowy);
|
||||
screen->DrawBorder (tex, 0, viewwindowy, viewwindowx, viewheight + viewwindowy);
|
||||
screen->DrawBorder (tex, viewwindowx + viewwidth, viewwindowy, Width, viewheight + viewwindowy);
|
||||
screen->DrawBorder (tex, 0, viewwindowy + viewheight, Width, StatusBar->GetTopOfStatusbar());
|
||||
|
||||
screen->DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RefreshBackground
|
||||
|
@ -787,13 +830,17 @@ void DBaseStatusBar::RefreshBackground () const
|
|||
float ratio = ActiveRatio (SCREENWIDTH, SCREENHEIGHT);
|
||||
x = ST_X;
|
||||
y = SBarTop;
|
||||
|
||||
if (x == 0 && y == SCREENHEIGHT) return;
|
||||
|
||||
auto tex = GetBorderTexture(Level);
|
||||
|
||||
if(!CompleteBorder)
|
||||
{
|
||||
if(y < SCREENHEIGHT)
|
||||
{
|
||||
screen->DrawBorder (x+1, y, SCREENWIDTH, y+1);
|
||||
screen->DrawBorder (x+1, SCREENHEIGHT-1, SCREENWIDTH, SCREENHEIGHT);
|
||||
screen->DrawBorder (tex, x+1, y, SCREENWIDTH, y+1);
|
||||
screen->DrawBorder (tex, x+1, SCREENHEIGHT-1, SCREENWIDTH, SCREENHEIGHT);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -812,8 +859,8 @@ void DBaseStatusBar::RefreshBackground () const
|
|||
x2 = SCREENWIDTH;
|
||||
}
|
||||
|
||||
screen->DrawBorder (0, y, x+1, SCREENHEIGHT);
|
||||
screen->DrawBorder (x2-1, y, SCREENWIDTH, SCREENHEIGHT);
|
||||
screen->DrawBorder (tex, 0, y, x+1, SCREENHEIGHT);
|
||||
screen->DrawBorder (tex, x2-1, y, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
if (setblocks >= 10)
|
||||
{
|
||||
|
|
|
@ -1339,19 +1339,8 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawFrame)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::DrawBorder (int x1, int y1, int x2, int y2)
|
||||
void DFrameBuffer::DrawBorder (FTextureID picnum, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
FTextureID picnum;
|
||||
|
||||
if (level.info != NULL && level.info->BorderTexture.Len() != 0)
|
||||
{
|
||||
picnum = TexMan.CheckForTexture (level.info->BorderTexture, ETextureType::Flat);
|
||||
}
|
||||
else
|
||||
{
|
||||
picnum = TexMan.CheckForTexture (gameinfo.BorderFlat, ETextureType::Flat);
|
||||
}
|
||||
|
||||
if (picnum.isValid())
|
||||
{
|
||||
FlatFill (x1, y1, x2, y2, TexMan.GetTexture(picnum, false));
|
||||
|
@ -1362,46 +1351,7 @@ void DFrameBuffer::DrawBorder (int x1, int y1, int x2, int y2)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_DrawViewBorder
|
||||
//
|
||||
// Draws the border around the view for different size windows
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::DrawViewBorder (void)
|
||||
{
|
||||
if (viewwidth == Width)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawBorder (0, 0, Width, viewwindowy);
|
||||
DrawBorder (0, viewwindowy, viewwindowx, viewheight + viewwindowy);
|
||||
DrawBorder (viewwindowx + viewwidth, viewwindowy, Width, viewheight + viewwindowy);
|
||||
DrawBorder (0, viewwindowy + viewheight, Width, StatusBar->GetTopOfStatusbar());
|
||||
|
||||
DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_RefreshViewBorder
|
||||
//
|
||||
// Draws the border around the player view, if needed.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::RefreshViewBorder ()
|
||||
{
|
||||
if (setblocks < 10)
|
||||
{
|
||||
DrawViewBorder();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
///==========================================================================
|
||||
//
|
||||
// Draws a blend over the entire view
|
||||
//
|
||||
|
|
|
@ -538,9 +538,7 @@ public:
|
|||
void DrawChar(FFont *font, int normalcolor, double x, double y, int character, VMVa_List &args);
|
||||
|
||||
void DrawFrame(int left, int top, int width, int height);
|
||||
void DrawBorder(int x1, int y1, int x2, int y2);
|
||||
void DrawViewBorder();
|
||||
void RefreshViewBorder();
|
||||
void DrawBorder(FTextureID, int x1, int y1, int x2, int y2);
|
||||
|
||||
// Calculate gamma table
|
||||
void CalcGamma(float gamma, uint8_t gammalookup[256]);
|
||||
|
|
Loading…
Reference in a new issue