Add menu option to disable background maps. Addresses #1566

This commit is contained in:
Jordy Ruiz 2018-11-14 16:37:09 +01:00
parent ab8b363a56
commit a9c3e3c4d2
3 changed files with 16 additions and 1 deletions

View file

@ -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()

View file

@ -14,6 +14,7 @@
#include <generated/protocol.h>
#include <generated/client_data.h>
#include <game/client/components/maplayers.h>
#include <game/client/components/sounds.h>
#include <game/client/ui.h>
#include <game/client/render.h>
@ -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;

View file

@ -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")