Skip to content

Commit

Permalink
Ingame aspect ratio, a.k.a 5:4 ingame support while UI is normal reso…
Browse files Browse the repository at this point in the history
…lution
  • Loading branch information
Jupeyy committed Feb 6, 2024
1 parent 38be4b5 commit ea2076a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/engine/shared/config_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions src/game/client/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ea2076a

Please sign in to comment.