diff --git a/src/d_main.cpp b/src/d_main.cpp index 97f200597..82189c72a 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -760,15 +760,15 @@ 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(); + if (!automapactive || viewactive) + { + StatusBar->RefreshViewBorder (); + } if (hud_althud && viewheight == SCREENHEIGHT && screenblocks > 10) { StatusBar->DrawBottomStuff (HUD_AltHud); diff --git a/src/dobjgc.h b/src/dobjgc.h index 100d27e4d..a7b804b80 100644 --- a/src/dobjgc.h +++ b/src/dobjgc.h @@ -183,7 +183,7 @@ public: T operator=(std::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); diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h index 963c97597..d07292b6b 100644 --- a/src/g_statusbar/sbar.h +++ b/src/g_statusbar/sbar.h @@ -453,6 +453,7 @@ public: void RefreshBackground () const; + void RefreshViewBorder (); private: DObject *AltHud = nullptr; diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 3d81095ba..f9ccf7978 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -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) { diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 3857f5e4f..aed0be31a 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -254,7 +254,7 @@ sector_t *FGLRenderer::RenderView(player_t* player) bool saved_niv = NoInterpolateView; NoInterpolateView = false; // prepare all camera textures that have been used in the last frame - auto Level = player->mo->__GetLevel(); + auto Level = &level; gl_RenderState.CheckTimer(Level->ShaderStartTime); Level->canvasTextureInfo.UpdateAll([&](AActor *camera, FCanvasTexture *camtex, double fov) { diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 442705e71..8030ba4c7 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -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 // diff --git a/src/v_video.h b/src/v_video.h index 337cc501d..58b9e7fa8 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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]);