From a9c3e3c4d295a631d026981c9cece6f31379a6a8 Mon Sep 17 00:00:00 2001 From: Jordy Ruiz Date: Wed, 14 Nov 2018 16:37:09 +0100 Subject: [PATCH] Add menu option to disable background maps. Addresses #1566 --- src/game/client/components/maplayers.cpp | 4 ++++ src/game/client/components/menus_settings.cpp | 12 +++++++++++- src/game/variables.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index 66e3e865e..b2ea616b4 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -32,6 +32,9 @@ CMapLayers::CMapLayers(int t) void CMapLayers::LoadBackgroundMap() { + if(!g_Config.m_ClShowMenuMap) + return; + int HourOfTheDay = time_houroftheday(); char aBuf[128]; str_format(aBuf, sizeof(aBuf), "ui/%s_%s.map", g_Config.m_ClMenuMap, (HourOfTheDay >= 6 && HourOfTheDay < 18) ? "day" : "night"); @@ -366,6 +369,7 @@ void CMapLayers::ConchainBackgroundMap(IConsole::IResult *pResult, void *pUserDa void CMapLayers::OnConsoleInit() { Console()->Chain("cl_menu_map", ConchainBackgroundMap, this); + Console()->Chain("cl_show_menu_map", ConchainBackgroundMap, this); } void CMapLayers::BackgroundMapUpdate() diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index a032044b2..4fef15f17 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -688,7 +689,7 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) RenderTools()->DrawUIRect(&Game, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f); // render client menu background - NumOptions = 3; + NumOptions = 4; if(g_Config.m_ClAutoDemoRecord) NumOptions += 1; if(g_Config.m_ClAutoScreenshot) NumOptions += 1; BackgroundHeight = (float)(NumOptions+1)*ButtonHeight+(float)NumOptions*Spacing; @@ -817,6 +818,15 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) if(DoButton_CheckBox(&s_SkipMainMenu, Localize("Skip the main menu"), g_Config.m_ClSkipStartMenu, &Button)) g_Config.m_ClSkipStartMenu ^= 1; + Client.HSplitTop(Spacing, 0, &Client); + Client.HSplitTop(ButtonHeight, &Button, &Client); + static int s_DisplayAnimatedBackgrounds = 0; + if(DoButton_CheckBox(&s_DisplayAnimatedBackgrounds, Localize("Display animated backgrounds"), g_Config.m_ClShowMenuMap, &Button)) + { + g_Config.m_ClShowMenuMap ^= 1; + m_pClient->m_pMapLayersBackGround->BackgroundMapUpdate(); + } + Client.HSplitTop(Spacing, 0, &Client); Client.HSplitTop(ButtonHeight, &Button, &Client); static int s_AutoDemoRecord = 0; diff --git a/src/game/variables.h b/src/game/variables.h index 40145f0a6..cc06417f2 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -84,6 +84,7 @@ MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG MACRO_CONFIG_INT(GfxNoclip, gfx_noclip, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Disable clipping") MACRO_CONFIG_STR(ClMenuMap, cl_menu_map, 64, "menu", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background map in the menu") +MACRO_CONFIG_INT(ClShowMenuMap, cl_show_menu_map, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Display background map in the menu") MACRO_CONFIG_INT(ClRotationRadius, cl_rotation_radius, 30, 1, 500, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Camera rotation radius") MACRO_CONFIG_INT(ClRotationSpeed, cl_rotation_speed, 40, 1, 120, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Camera rotations in seconds") MACRO_CONFIG_INT(ClCameraSpeed, cl_camera_speed, 50, 1, 100, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Camera speed")