From 07089be2e0782788fe5484a2834cb2366d658c06 Mon Sep 17 00:00:00 2001 From: fokkonaut <35420825+fokkonaut@users.noreply.github.com> Date: Fri, 19 Jul 2019 01:53:27 +0200 Subject: [PATCH 1/3] Restart required message when changing Show console --- src/game/client/components/menus.h | 1 + src/game/client/components/menus_settings.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 1109c5cbf..089943c9b 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -127,6 +127,7 @@ class CMenus : public CComponent static float ms_FontmodHeight; // for settings + bool m_NeedRestartGeneral; bool m_NeedRestartSkins; bool m_NeedRestartGraphics; bool m_NeedRestartSound; diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 52e6cfa8b..c4bee382f 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -69,6 +69,9 @@ bool CMenusKeyBinder::OnInput(IInput::CEvent Event) void CMenus::RenderSettingsGeneral(CUIRect MainView) { char aBuf[128]; + bool CheckSettings = false; + static int s_ClShowConsole = g_Config.m_ClShowConsole; + CUIRect Label, Button, Left, Right, Game, Client, AutoReconnect; MainView.HSplitTop(180.0f, &Game, &Client); Client.HSplitTop(160.0f, &Client, &AutoReconnect); @@ -213,7 +216,18 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) Left.HSplitTop(20.0f, 0, &Left); Left.HSplitTop(20.0f, &Button, &Left); if(DoButton_CheckBox(&g_Config.m_ClShowConsole, Localize("Show console window"), g_Config.m_ClShowConsole, &Button)) + { g_Config.m_ClShowConsole ^= 1; + CheckSettings = true; + } + + if (CheckSettings) + { + if (s_ClShowConsole == g_Config.m_ClShowConsole) + m_NeedRestartGeneral = false; + else + m_NeedRestartGeneral = true; + } #endif // auto statboard screenshot @@ -1417,7 +1431,7 @@ void CMenus::RenderSettings(CUIRect MainView) UI()->DoLabelScaled(&RestartWarning, Localize("DDNet Client needs to be restarted to complete update!"), 14.0f, -1); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); } - else if(m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound || m_NeedRestartDDNet) + else if(m_NeedRestartGeneral || m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound || m_NeedRestartDDNet) UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, -1); } From 78f52629e4cdff046f4aabb8912927d2ba43d5cb Mon Sep 17 00:00:00 2001 From: fokkonaut <35420825+fokkonaut@users.noreply.github.com> Date: Fri, 19 Jul 2019 01:58:49 +0200 Subject: [PATCH 2/3] fix build --- src/engine/shared/config_variables.h | 2 ++ src/game/client/components/menus_settings.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 01c0c1db8..e7a8d527b 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -348,7 +348,9 @@ MACRO_CONFIG_STR(ClTimeoutCode, cl_timeout_code, 64, "", CFGFLAG_SAVE|CFGFLAG_CL MACRO_CONFIG_STR(ClDummyTimeoutCode, cl_dummy_timeout_code, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Dummy Timeout code to use") MACRO_CONFIG_STR(ClTimeoutSeed, cl_timeout_seed, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Timeout seed") MACRO_CONFIG_STR(ClInputFifo, cl_input_fifo, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fifo file to use as input for client console") +#if defined(CONF_FAMILY_WINDOWS) MACRO_CONFIG_INT(ClShowConsole, cl_show_console, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Show console window (Windows only)") +#endif MACRO_CONFIG_INT(InpJoystick, inp_joystick, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use a joystick as input") MACRO_CONFIG_INT(ClConfigVersion, cl_config_version, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "The config version. Helps newer clients fix bugs with older configs.") diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index c4bee382f..9ee30176f 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -68,10 +68,12 @@ bool CMenusKeyBinder::OnInput(IInput::CEvent Event) void CMenus::RenderSettingsGeneral(CUIRect MainView) { - char aBuf[128]; +#if defined(CONF_FAMILY_WINDOWS) bool CheckSettings = false; static int s_ClShowConsole = g_Config.m_ClShowConsole; +#endif + char aBuf[128]; CUIRect Label, Button, Left, Right, Game, Client, AutoReconnect; MainView.HSplitTop(180.0f, &Game, &Client); Client.HSplitTop(160.0f, &Client, &AutoReconnect); From 3edaf4b8cdcc05497f67bcdd04c5c17e3301fe1c Mon Sep 17 00:00:00 2001 From: fokkonaut <35420825+fokkonaut@users.noreply.github.com> Date: Fri, 19 Jul 2019 02:06:33 +0200 Subject: [PATCH 3/3] Style fixes --- src/game/client/components/menus_settings.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 9ee30176f..bf22f8f37 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -223,13 +223,8 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) CheckSettings = true; } - if (CheckSettings) - { - if (s_ClShowConsole == g_Config.m_ClShowConsole) - m_NeedRestartGeneral = false; - else - m_NeedRestartGeneral = true; - } + if(CheckSettings) + m_NeedRestartGeneral = s_ClShowConsole != g_Config.m_ClShowConsole; #endif // auto statboard screenshot @@ -2173,12 +2168,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView) } if(CheckSettings) - { - if(s_InpMouseOld == g_Config.m_InpMouseOld) - m_NeedRestartDDNet = false; - else - m_NeedRestartDDNet = true; - } + m_NeedRestartDDNet = s_InpMouseOld != g_Config.m_InpMouseOld; CUIRect aRects[2]; Left.HSplitTop(5.0f, &Button, &Left);