From ea2076a615284132aa32de061b0fe42ff6a74ed9 Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Tue, 6 Feb 2024 18:10:03 +0100 Subject: [PATCH] Ingame aspect ratio, a.k.a 5:4 ingame support while UI is normal resolution --- src/engine/shared/config_variables.h | 1 + src/game/client/render.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 79b5c1deb..579cd63be 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -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") diff --git a/src/game/client/render.cpp b/src/game/client/render.cpp index 998cfec4e..a474e2638 100644 --- a/src/game/client/render.cpp +++ b/src/game/client/render.cpp @@ -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;