From b746484da3bf6d432c77972c943cf5f9ee6dadf5 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 6 May 2020 07:37:09 -0400 Subject: [PATCH] - make screen border flat scale up --- src/common/2d/v_2ddrawer.cpp | 10 ++++++---- src/common/2d/v_draw.cpp | 13 ++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/common/2d/v_2ddrawer.cpp b/src/common/2d/v_2ddrawer.cpp index 7b161c06af..d101ee5208 100644 --- a/src/common/2d/v_2ddrawer.cpp +++ b/src/common/2d/v_2ddrawer.cpp @@ -755,10 +755,12 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu case -1: // classic flat scaling float ar = 4.f / 3.f / (float)ActiveRatio((float)screen->GetWidth(), (float)screen->GetHeight()); - fU1 = 0.f; - fV1 = 0.f; - fU2 = 320.f / (float)src->GetDisplayWidth() * fs / ar; - fV2 = 200.f / (float)src->GetDisplayHeight() * fs; + float sw = 320.f / (float)screen->GetWidth() / ar; + float sh = 200.f / (float)screen->GetHeight(); + fU1 = float(left) / (float)src->GetDisplayWidth() * fs * sw; + fV1 = float(top) / (float)src->GetDisplayHeight() * fs * sh; + fU2 = float(right) / (float)src->GetDisplayWidth() * fs * sw; + fV2 = float(bottom) / (float)src->GetDisplayHeight() * fs * sh; break; } dg.mVertIndex = (int)mVertices.Reserve(4); diff --git a/src/common/2d/v_draw.cpp b/src/common/2d/v_draw.cpp index bc04333e0c..2c64dba922 100644 --- a/src/common/2d/v_draw.cpp +++ b/src/common/2d/v_draw.cpp @@ -43,6 +43,7 @@ EXTERN_CVAR(Int, vid_aspect) EXTERN_CVAR(Int, uiscale) +CVAR(Bool, ui_screenborder_classic_scaling, true, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) // Helper for ActiveRatio and CheckRatio. Returns the forced ratio type, or -1 if none. int ActiveFakeRatio(int width, int height) @@ -1161,10 +1162,11 @@ void FillBorder (F2DDrawer *drawer, FGameTexture *img) if (img != NULL) { - drawer->AddFlatFill(0, 0, Width, bordtop, img); // Top - drawer->AddFlatFill(0, bordtop, bordleft, Height - bordbottom, img); // Left - drawer->AddFlatFill(Width - bordright, bordtop, Width, Height - bordbottom, img); // Right - drawer->AddFlatFill(0, Height - bordbottom, Width, Height, img); // Bottom + int filltype = (ui_screenborder_classic_scaling) ? -1 : 0; + drawer->AddFlatFill(0, 0, Width, bordtop, img, filltype); // Top + drawer->AddFlatFill(0, bordtop, bordleft, Height - bordbottom, img, filltype); // Left + drawer->AddFlatFill(Width - bordright, bordtop, Width, Height - bordbottom, img, filltype); // Right + drawer->AddFlatFill(0, Height - bordbottom, Width, Height, img, filltype); // Bottom } else { @@ -1351,9 +1353,10 @@ DEFINE_ACTION_FUNCTION(_Screen, Dim) void DrawBorder (F2DDrawer *drawer, FTextureID picnum, int x1, int y1, int x2, int y2) { + int filltype = (ui_screenborder_classic_scaling) ? -1 : 0; if (picnum.isValid()) { - drawer->AddFlatFill (x1, y1, x2, y2, TexMan.GetGameTexture(picnum, false)); + drawer->AddFlatFill (x1, y1, x2, y2, TexMan.GetGameTexture(picnum, false), filltype); } else {