- export common formulae to functions instead of copy-pasting them

- screen bevel now enlarges also when screenblocks <= 11

- make intermission and status bar scaling game-specific in the config

- add scaling customization for classic ui flat scaling

- make screen border flat scale up

- inter_classic_scaling now defaults to true
- fixed: last commit I accidentally left hardcoded testing values and did not change them back to check for the texture's original size

- implement cvar 'inter_classic_scaling' to render the intermission flat as if it were 320x200
This commit is contained in:
Rachael Alexanderson 2020-05-06 00:04:05 -04:00
commit 6e3ec96250
5 changed files with 107 additions and 24 deletions

View file

@ -37,12 +37,15 @@
#include "vm.h"
#include "c_cvars.h"
#include "v_draw.h"
#include "v_video.h"
#include "fcolormap.h"
static F2DDrawer drawer;
F2DDrawer* twod = &drawer;
EXTERN_CVAR(Float, transsouls)
CVAR(Float, classic_scaling_factor, 1.0, CVAR_ARCHIVE)
CVAR(Float, classic_scaling_pixelaspect, 1.2, CVAR_ARCHIVE)
IMPLEMENT_CLASS(DShape2DTransform, false, false)
@ -677,6 +680,19 @@ void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, unsigne
//
//==========================================================================
float F2DDrawer::GetClassicFlatScalarWidth()
{
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;
return sw;
}
float F2DDrawer::GetClassicFlatScalarHeight()
{
float sh = 240.f / classic_scaling_pixelaspect * classic_scaling_factor / (float)screen->GetHeight();
return sh;
}
void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin, double flatscale)
{
float fU1, fU2, fV1, fV2;
@ -692,6 +708,10 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu
float fs = 1.f / float(flatscale);
bool flipc = false;
float sw = GetClassicFlatScalarWidth();
float sh = GetClassicFlatScalarHeight();
switch (local_origin)
{
case 0:
@ -752,6 +772,19 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu
fV1 = float(right - left) / (float)src->GetDisplayHeight() * fs;
break;
case -1: // classic flat scaling
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];