- screen bevel now enlarges also when screenblocks <= 11

This commit is contained in:
Rachael Alexanderson 2020-05-06 10:48:49 -04:00
parent 4ab6aeb770
commit 872e9b252f
2 changed files with 76 additions and 21 deletions

View file

@ -695,6 +695,11 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu
float fs = 1.f / float(flatscale);
bool flipc = false;
float ar = 4.f / 3.f / (float)ActiveRatio((float)screen->GetWidth(), (float)screen->GetHeight());
float sw = 320.f * classic_scaling_factor / (float)screen->GetWidth() / ar;
float sh = 240.f / classic_scaling_pixelaspect * classic_scaling_factor / (float)screen->GetHeight();
switch (local_origin)
{
case 0:
@ -756,14 +761,18 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu
break;
case -1: // classic flat scaling
float ar = 4.f / 3.f / (float)ActiveRatio((float)screen->GetWidth(), (float)screen->GetHeight());
float sw = 320.f * classic_scaling_factor / (float)screen->GetWidth() / ar;
float sh = 240.f / classic_scaling_pixelaspect * classic_scaling_factor / (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;
case -2: // classic scaling for screen bevel
fU1 = 0;
fV1 = 0;
fU2 = float(right - left) / (float)src->GetDisplayWidth() * fs * sw;
fV2 = float(bottom - top) / (float)src->GetDisplayHeight() * fs * sh;
break;
}
dg.mVertIndex = (int)mVertices.Reserve(4);
auto ptr = &mVertices[dg.mVertIndex];

View file

@ -89,6 +89,10 @@ EXTERN_CVAR (Bool, noisedebug)
EXTERN_CVAR (Int, con_scaletext)
EXTERN_CVAR(Bool, vid_fps)
EXTERN_CVAR(Bool, inter_subtitles)
EXTERN_CVAR(Float, classic_scaling_factor)
EXTERN_CVAR(Float, classic_scaling_pixelaspect)
EXTERN_CVAR(Bool, ui_screenborder_classic_scaling)
CVAR(Int, hud_scale, 0, CVAR_ARCHIVE);
CVAR(Bool, log_vgafont, false, CVAR_ARCHIVE)
@ -162,23 +166,54 @@ void V_DrawFrame(F2DDrawer* drawer, int left, int top, int width, int height)
int right = left + width;
int bottom = top + height;
// Draw top and bottom sides.
p = TexMan.GetGameTextureByName(border->t);
drawer->AddFlatFill(left, top - (int)p->GetDisplayHeight(), right, top, p, true);
p = TexMan.GetGameTextureByName(border->b);
drawer->AddFlatFill(left, bottom, right, bottom + (int)p->GetDisplayHeight(), p, true);
float ar = 4.f / 3.f / (float)ActiveRatio((float)screen->GetWidth(), (float)screen->GetHeight());
float sw = 320.f * classic_scaling_factor / (float)screen->GetWidth() / ar;
float sh = 240.f / classic_scaling_pixelaspect * classic_scaling_factor / (float)screen->GetHeight();
// Draw left and right sides.
p = TexMan.GetGameTextureByName(border->l);
drawer->AddFlatFill(left - (int)p->GetDisplayWidth(), top, left, bottom, p, true);
p = TexMan.GetGameTextureByName(border->r);
drawer->AddFlatFill(right, top, right + (int)p->GetDisplayWidth(), bottom, p, true);
if (!ui_screenborder_classic_scaling)
{
// Draw top and bottom sides.
p = TexMan.GetGameTextureByName(border->t);
drawer->AddFlatFill(left, top - (int)p->GetDisplayHeight(), right, top, p, true);
p = TexMan.GetGameTextureByName(border->b);
drawer->AddFlatFill(left, bottom, right, bottom + (int)p->GetDisplayHeight(), p, true);
// Draw beveled corners.
DrawTexture(drawer, TexMan.GetGameTextureByName(border->tl), left - offset, top - offset, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->tr), left + width, top - offset, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->bl), left - offset, top + height, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->br), left + width, top + height, TAG_DONE);
// Draw left and right sides.
p = TexMan.GetGameTextureByName(border->l);
drawer->AddFlatFill(left - (int)p->GetDisplayWidth(), top, left, bottom, p, true);
p = TexMan.GetGameTextureByName(border->r);
drawer->AddFlatFill(right, top, right + (int)p->GetDisplayWidth(), bottom, p, true);
// Draw beveled corners.
DrawTexture(drawer, TexMan.GetGameTextureByName(border->tl), left - offset, top - offset, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->tr), left + width, top - offset, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->bl), left - offset, top + height, TAG_DONE);
DrawTexture(drawer, TexMan.GetGameTextureByName(border->br), left + width, top + height, TAG_DONE);
}
else
{
// Draw top and bottom sides.
p = TexMan.GetGameTextureByName(border->t);
drawer->AddFlatFill(left, top - (int)(p->GetDisplayHeight() / sh), right, top, p, -2);
p = TexMan.GetGameTextureByName(border->b);
drawer->AddFlatFill(left, bottom, right, bottom + (int)(p->GetDisplayHeight() / sh), p, -2);
// Draw left and right sides.
p = TexMan.GetGameTextureByName(border->l);
drawer->AddFlatFill(left - (int)(p->GetDisplayWidth() / sw), top, left, bottom, p, -2);
p = TexMan.GetGameTextureByName(border->r);
drawer->AddFlatFill(right, top, right + (int)(p->GetDisplayWidth() / sw), bottom, p, -2);
// Draw beveled corners.
p = TexMan.GetGameTextureByName(border->tl);
drawer->AddFlatFill(left - (int)(p->GetDisplayWidth() / sw), top - (int)(p->GetDisplayHeight() / sh), left, top, p, -2);
p = TexMan.GetGameTextureByName(border->tr);
drawer->AddFlatFill(right, top - (int)(p->GetDisplayHeight() / sh), right + (int)(p->GetDisplayWidth() / sw), top, p, -2);
p = TexMan.GetGameTextureByName(border->bl);
drawer->AddFlatFill(left - (int)(p->GetDisplayWidth() / sw), bottom, left, bottom + (int)(p->GetDisplayHeight() / sh), p, -2);
p = TexMan.GetGameTextureByName(border->br);
drawer->AddFlatFill(right, bottom, right + (int)(p->GetDisplayWidth() / sw), bottom + (int)(p->GetDisplayHeight() / sh), p, -2);
}
}
DEFINE_ACTION_FUNCTION(_Screen, DrawFrame)
@ -1038,6 +1073,8 @@ void DBaseStatusBar::RefreshBackground () const
auto tex = GetBorderTexture(primaryLevel);
float sh = 240.f / classic_scaling_pixelaspect * classic_scaling_factor / (float)screen->GetHeight();
if(!CompleteBorder)
{
if(y < twod->GetHeight())
@ -1070,9 +1107,18 @@ void DBaseStatusBar::RefreshBackground () const
FGameTexture *p = TexMan.GetGameTextureByName(gameinfo.Border.b);
if (p != NULL)
{
int h = int(0.5 + p->GetDisplayHeight());
twod->AddFlatFill(0, y, x, y + h, p, true);
twod->AddFlatFill(x2, y, twod->GetWidth(), y + h, p, true);
if (!ui_screenborder_classic_scaling)
{
int h = int(0.5 + p->GetDisplayHeight());
twod->AddFlatFill(0, y, x, y + h, p, true);
twod->AddFlatFill(x2, y, twod->GetWidth(), y + h, p, true);
}
else
{
int h = (int)((0.5f + p->GetDisplayHeight()) / sh);
twod->AddFlatFill(0, y, x, y + h, p, -2);
twod->AddFlatFill(x2, y, twod->GetWidth(), y + h, p, -2);
}
}
}
}