Ingame aspect ratio, a.k.a 5:4 ingame support while UI is normal resolution

This commit is contained in:
Jupeyy 2024-02-06 18:10:03 +01:00
parent 38be4b5745
commit ea2076a615
2 changed files with 4 additions and 0 deletions

View file

@ -151,6 +151,7 @@ MACRO_CONFIG_INT(UiCloseWindowAfterChangingSetting, ui_close_window_after_changi
MACRO_CONFIG_INT(UiUnreadNews, ui_unread_news, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Whether there is unread news")
MACRO_CONFIG_INT(GfxNoclip, gfx_noclip, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Disable clipping")
MACRO_CONFIG_INT(GfxIngameAspectRatio, gfx_ingame_aspect_ratio, 0, 0, 10000, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Ingame aspect ratio (normalized float by 1000)")
// dummy
MACRO_CONFIG_STR(ClDummyName, dummy_name, 16, "", CFGFLAG_SAVE | CFGFLAG_CLIENT | CFGFLAG_INSENSITIVE, "Name of the dummy")

View file

@ -373,6 +373,9 @@ void CRenderTools::CalcScreenParams(float Aspect, float Zoom, float *pWidth, flo
const float WMax = 1500;
const float HMax = 1050;
if(g_Config.m_GfxIngameAspectRatio != 0)
Aspect = g_Config.m_GfxIngameAspectRatio / 1000.0f;
const float f = std::sqrt(Amount) / std::sqrt(Aspect);
*pWidth = f * Aspect;
*pHeight = f;