- Ensure the viewport's aspect ratio is factored into the HUD's aspect ratio.

* Fixes #617.
This commit is contained in:
Mitchell Richters 2023-01-02 18:52:19 +11:00
parent 64c9ad73a7
commit bd472acc16

View file

@ -47,6 +47,7 @@
#include "v_text.h" #include "v_text.h"
#include "vm.h" #include "vm.h"
#include "i_interface.h" #include "i_interface.h"
#include "r_videoscale.h"
FGameTexture* CrosshairImage; FGameTexture* CrosshairImage;
static int CrosshairNum; static int CrosshairNum;
@ -366,9 +367,11 @@ void DStatusBarCore::SetScale()
double screenaspect = w / double(h); double screenaspect = w / double(h);
double aspectscale = 1.0; double aspectscale = 1.0;
double ViewportAspect = ViewportPixelAspect();
if ((horz == 320 && vert == 200) || (horz == 640 && vert == 400)) if ((horz == 320 && vert == 200) || (horz == 640 && vert == 400))
{ {
refaspect = 1.333; refaspect = (4. / 3.);
if (!hud_aspectscale) aspectscale = 1 / 1.2; if (!hud_aspectscale) aspectscale = 1 / 1.2;
} }
@ -383,9 +386,9 @@ void DStatusBarCore::SetScale()
refw = h * refaspect; refw = h * refaspect;
} }
refw *= hud_scalefactor; refw *= hud_scalefactor;
refh *= hud_scalefactor * aspectscale; refh *= hud_scalefactor * aspectscale / ViewportAspect;
int sby = vert - int(RelTop * hud_scalefactor * aspectscale); int sby = vert - int(RelTop * hud_scalefactor * aspectscale / ViewportAspect);
// Use full pixels for destination size. // Use full pixels for destination size.
ST_X = xs_CRoundToInt((w - refw) / 2); ST_X = xs_CRoundToInt((w - refw) / 2);