From 6aa94a9b8ed2a6e0ed5c13d44d17dc926c90088b Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 2 Jan 2023 18:52:19 +1100 Subject: [PATCH] - Ensure the viewport's aspect ratio is factored into the HUD's aspect ratio. * Fixes #617. --- source/common/statusbar/base_sbar.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/common/statusbar/base_sbar.cpp b/source/common/statusbar/base_sbar.cpp index e7cab98d2..b1fb2d79a 100644 --- a/source/common/statusbar/base_sbar.cpp +++ b/source/common/statusbar/base_sbar.cpp @@ -47,6 +47,7 @@ #include "v_text.h" #include "vm.h" #include "i_interface.h" +#include "r_videoscale.h" FGameTexture* CrosshairImage; static int CrosshairNum; @@ -367,9 +368,11 @@ void DStatusBarCore::SetScale() double screenaspect = w / double(h); double aspectscale = 1.0; + double ViewportAspect = ViewportPixelAspect(); + if ((horz == 320 && vert == 200) || (horz == 640 && vert == 400)) { - refaspect = 1.333; + refaspect = (4. / 3.); if (!hud_aspectscale) aspectscale = 1 / 1.2; } @@ -384,9 +387,9 @@ void DStatusBarCore::SetScale() refw = h * refaspect; } 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. ST_X = xs_CRoundToInt((w - refw) / 2);