From 593a8ee6ec799df0b4dc3a2a48e2ab8808f5a304 Mon Sep 17 00:00:00 2001 From: oy Date: Fri, 1 Apr 2011 19:36:44 +0200 Subject: [PATCH] improved settings menu. Closes #564 --- data/languages/bosnian.txt | 3 + data/languages/czech.txt | 3 + data/languages/dutch.txt | 3 + data/languages/finnish.txt | 3 + data/languages/french.txt | 3 + data/languages/german.txt | 3 + data/languages/italian.txt | 3 + data/languages/polish.txt | 3 + data/languages/portuguese.txt | 3 + data/languages/romanian.txt | 3 + data/languages/russian.txt | 3 + data/languages/serbian.txt | 3 + data/languages/spanish.txt | 3 + data/languages/swedish.txt | 3 + data/languages/ukrainian.txt | 3 + src/game/client/components/menus.h | 3 +- src/game/client/components/menus_settings.cpp | 283 ++++++++++++-------------- 17 files changed, 176 insertions(+), 155 deletions(-) diff --git a/data/languages/bosnian.txt b/data/languages/bosnian.txt index e2002ed0..0871b809 100644 --- a/data/languages/bosnian.txt +++ b/data/languages/bosnian.txt @@ -531,6 +531,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/czech.txt b/data/languages/czech.txt index 3832af1e..82cada4c 100644 --- a/data/languages/czech.txt +++ b/data/languages/czech.txt @@ -480,6 +480,9 @@ Change settings Clan == +Client +== + Connection Problems... == diff --git a/data/languages/dutch.txt b/data/languages/dutch.txt index 1f21267d..7f51bbdd 100644 --- a/data/languages/dutch.txt +++ b/data/languages/dutch.txt @@ -555,6 +555,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/finnish.txt b/data/languages/finnish.txt index a8d16ce2..d94c41ca 100644 --- a/data/languages/finnish.txt +++ b/data/languages/finnish.txt @@ -504,6 +504,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/french.txt b/data/languages/french.txt index a230657f..f9c40910 100644 --- a/data/languages/french.txt +++ b/data/languages/french.txt @@ -543,6 +543,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/german.txt b/data/languages/german.txt index 5d3a4699..158092fa 100644 --- a/data/languages/german.txt +++ b/data/languages/german.txt @@ -555,6 +555,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/italian.txt b/data/languages/italian.txt index eb7b9271..2b83aa15 100644 --- a/data/languages/italian.txt +++ b/data/languages/italian.txt @@ -537,6 +537,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/polish.txt b/data/languages/polish.txt index a95a7dcf..2ba8c896 100644 --- a/data/languages/polish.txt +++ b/data/languages/polish.txt @@ -507,6 +507,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt index dbab95b7..8feaa3db 100644 --- a/data/languages/portuguese.txt +++ b/data/languages/portuguese.txt @@ -501,6 +501,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/romanian.txt b/data/languages/romanian.txt index 3393b4d2..2b4c2da1 100644 --- a/data/languages/romanian.txt +++ b/data/languages/romanian.txt @@ -555,6 +555,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/russian.txt b/data/languages/russian.txt index 53b27a4c..2b67f872 100644 --- a/data/languages/russian.txt +++ b/data/languages/russian.txt @@ -510,6 +510,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/serbian.txt b/data/languages/serbian.txt index 92268dce..30e9718c 100644 --- a/data/languages/serbian.txt +++ b/data/languages/serbian.txt @@ -504,6 +504,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/spanish.txt b/data/languages/spanish.txt index 843c950a..16e58537 100644 --- a/data/languages/spanish.txt +++ b/data/languages/spanish.txt @@ -555,6 +555,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/data/languages/swedish.txt b/data/languages/swedish.txt index 2c221ecc..cf2fcb25 100644 --- a/data/languages/swedish.txt +++ b/data/languages/swedish.txt @@ -474,6 +474,9 @@ Change settings Clan == +Client +== + Connection Problems... == diff --git a/data/languages/ukrainian.txt b/data/languages/ukrainian.txt index a66a2745..4c7c54db 100644 --- a/data/languages/ukrainian.txt +++ b/data/languages/ukrainian.txt @@ -525,6 +525,9 @@ Change settings Clan == +Client +== + Count players only == diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 06d53411..3c712f5d 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -232,10 +232,9 @@ class CMenus : public CComponent // found in menus_settings.cpp void RenderLanguageSelection(CUIRect MainView); - void RenderSPPage0(CUIRect MainView); - void RenderSPPage1(CUIRect MainView); void RenderSettingsGeneral(CUIRect MainView); void RenderSettingsPlayer(CUIRect MainView); + void RenderSettingsTee(CUIRect MainView); void RenderSettingsControls(CUIRect MainView); void RenderSettingsGraphics(CUIRect MainView); void RenderSettingsSound(CUIRect MainView); diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index cca7779f..e100cf2a 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -48,50 +48,132 @@ bool CMenusKeyBinder::OnInput(IInput::CEvent Event) return false; } -void CMenus::RenderSettingsPlayer(CUIRect MainView) +void CMenus::RenderSettingsGeneral(CUIRect MainView) { - // page menu - CUIRect PageMenu, Button; - MainView.HSplitBottom(50.0f, &MainView, &PageMenu); - PageMenu.HSplitTop(10.0f, 0, &PageMenu); - RenderTools()->DrawUIRect(&PageMenu, vec4(1.0f, 1.0f, 1.0f,0.25f), CUI::CORNER_ALL, 10.0f); - PageMenu.Margin(10.0f, &PageMenu); + char aBuf[128]; + CUIRect Label, Button, Left, Right, Game, Client; + MainView.HSplitTop(150.0f, &Game, &Client); - PageMenu.VSplitLeft(50.0f, 0, &PageMenu); - PageMenu.VSplitLeft(120.0f, &Button, &PageMenu); - static int s_PrevButton = 0; - if(DoButton_PageMenu(&s_PrevButton, Localize("Prev"), 0, m_SettingPlayerPage>0, &Button, CUI::CORNER_L)) + // game { - if(m_SettingPlayerPage > 0) - --m_SettingPlayerPage; + // headline + Game.HSplitTop(30.0f, &Label, &Game); + UI()->DoLabelScaled(&Label, Localize("Game"), 20.0f, -1); + Game.Margin(5.0f, &Game); + Game.VSplitMid(&Left, &Right); + Left.VSplitRight(5.0f, &Left, 0); + Right.VMargin(5.0f, &Right); + + // dynamic camera + Left.HSplitTop(20.0f, &Button, &Left); + static int s_DynamicCameraButton = 0; + if(DoButton_CheckBox(&s_DynamicCameraButton, Localize("Dynamic Camera"), g_Config.m_ClMouseDeadzone != 0, &Button)) + { + if(g_Config.m_ClMouseDeadzone) + { + g_Config.m_ClMouseFollowfactor = 0; + g_Config.m_ClMouseMaxDistance = 400; + g_Config.m_ClMouseDeadzone = 0; + } + else + { + g_Config.m_ClMouseFollowfactor = 60; + g_Config.m_ClMouseMaxDistance = 1000; + g_Config.m_ClMouseDeadzone = 300; + } + } + + // weapon pickup + Left.HSplitTop(5.0f, 0, &Left); + Left.HSplitTop(20.0f, &Button, &Left); + if(DoButton_CheckBox(&g_Config.m_ClAutoswitchWeapons, Localize("Switch weapon on pickup"), g_Config.m_ClAutoswitchWeapons, &Button)) + g_Config.m_ClAutoswitchWeapons ^= 1; + + // show hud + Left.HSplitTop(5.0f, 0, &Left); + Left.HSplitTop(20.0f, &Button, &Left); + if(DoButton_CheckBox(&g_Config.m_ClShowhud, Localize("Show ingame HUD"), g_Config.m_ClShowhud, &Button)) + g_Config.m_ClShowhud ^= 1; + + // name plates + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClNameplates, Localize("Show name plates"), g_Config.m_ClNameplates, &Button)) + g_Config.m_ClNameplates ^= 1; + + if(g_Config.m_ClNameplates) + { + Right.HSplitTop(2.5f, 0, &Right); + Right.VSplitLeft(30.0f, 0, &Right); + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClNameplatesAlways, Localize("Always show name plates"), g_Config.m_ClNameplatesAlways, &Button)) + g_Config.m_ClNameplatesAlways ^= 1; + + Right.HSplitTop(2.5f, 0, &Right); + Right.HSplitTop(20.0f, &Label, &Right); + Right.HSplitTop(20.0f, &Button, &Right); + str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Name plates size"), g_Config.m_ClNameplatesSize); + UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1); + Button.HMargin(2.0f, &Button); + g_Config.m_ClNameplatesSize = (int)(DoScrollbarH(&g_Config.m_ClNameplatesSize, &Button, g_Config.m_ClNameplatesSize/100.0f)*100.0f+0.1f); + + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClNameplatesTeamcolors, Localize("Use team colors for name plates"), g_Config.m_ClNameplatesTeamcolors, &Button)) + g_Config.m_ClNameplatesTeamcolors ^= 1; + } } - - PageMenu.VSplitRight(50.0f, &PageMenu, 0); - PageMenu.VSplitRight(120.0f, &PageMenu, &Button); - static int s_NextButton = 0; - if(DoButton_PageMenu(&s_NextButton, Localize("Next"), 0, m_SettingPlayerPage<1, &Button, CUI::CORNER_R)) + + // client { - if(m_SettingPlayerPage < 1) - ++m_SettingPlayerPage; - } - - RenderTools()->DrawUIRect(&PageMenu, vec4(1.0f, 1.0f, 1.0f, 0.5f), 0, 10.0f); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), Localize("Page %d of %d"), m_SettingPlayerPage+1, 2); - UI()->DoLabelScaled(&PageMenu, aBuf, PageMenu.h*ms_FontmodHeight, 0); + // headline + Client.HSplitTop(30.0f, &Label, &Client); + UI()->DoLabelScaled(&Label, Localize("Client"), 20.0f, -1); + Client.Margin(5.0f, &Client); + Client.VSplitMid(&Left, &Right); + Left.VSplitRight(5.0f, &Left, 0); + Right.VMargin(5.0f, &Right); - // actual settings player page - RenderTools()->DrawUIRect(&MainView, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 10.0f); - MainView.Margin(10.0f, &MainView); - if(m_SettingPlayerPage == 0) - RenderSPPage0(MainView); - else if(m_SettingPlayerPage == 1) - RenderSPPage1(MainView); + // auto demo settings + { + Left.HSplitTop(20.0f, &Button, &Left); + if(DoButton_CheckBox(&g_Config.m_ClAutoDemoRecord, Localize("Automatically record demos"), g_Config.m_ClAutoDemoRecord, &Button)) + g_Config.m_ClAutoDemoRecord ^= 1; + + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClAutoScreenshot, Localize("Automatically take game over screenshot"), g_Config.m_ClAutoScreenshot, &Button)) + g_Config.m_ClAutoScreenshot ^= 1; + + Left.HSplitTop(10.0f, 0, &Left); + Left.VSplitLeft(20.0f, 0, &Left); + Left.HSplitTop(20.0f, &Label, &Left); + Button.VSplitRight(20.0f, &Button, 0); + char aBuf[64]; + if(g_Config.m_ClAutoDemoMax) + str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max demos"), g_Config.m_ClAutoDemoMax); + else + str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max demos"), Localize("no limit")); + UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1); + Left.HSplitTop(20.0f, &Button, 0); + Button.HMargin(2.0f, &Button); + g_Config.m_ClAutoDemoMax = static_cast(DoScrollbarH(&g_Config.m_ClAutoDemoMax, &Button, g_Config.m_ClAutoDemoMax/1000.0f)*1000.0f+0.1f); + + Right.HSplitTop(10.0f, 0, &Right); + Right.VSplitLeft(20.0f, 0, &Right); + Right.HSplitTop(20.0f, &Label, &Right); + Button.VSplitRight(20.0f, &Button, 0); + if(g_Config.m_ClAutoScreenshotMax) + str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoScreenshotMax); + else + str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), Localize("no limit")); + UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1); + Right.HSplitTop(20.0f, &Button, 0); + Button.HMargin(2.0f, &Button); + g_Config.m_ClAutoScreenshotMax = static_cast(DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax/1000.0f)*1000.0f+0.1f); + } + } } -void CMenus::RenderSPPage0(CUIRect MainView) +void CMenus::RenderSettingsPlayer(CUIRect MainView) { - // settings player page 0 CUIRect Button, Label; MainView.HSplitTop(10.0f, 0, &MainView); @@ -119,10 +201,9 @@ void CMenus::RenderSPPage0(CUIRect MainView) // country flag selector MainView.HSplitTop(20.0f, 0, &MainView); - MainView.HSplitTop(200.0f, &Button, &MainView); static float s_ScrollValue = 0.0f; int OldSelected = -1; - UiDoListboxStart(&s_ScrollValue, &Button, 50.0f, Localize("Country"), "", m_pClient->m_pCountryFlags->Num(), 6, OldSelected, s_ScrollValue); + UiDoListboxStart(&s_ScrollValue, &MainView, 50.0f, Localize("Country"), "", m_pClient->m_pCountryFlags->Num(), 6, OldSelected, s_ScrollValue); for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i) { @@ -155,74 +236,10 @@ void CMenus::RenderSPPage0(CUIRect MainView) g_Config.m_PlayerCountry = m_pClient->m_pCountryFlags->Get(NewSelected)->m_CountryCode; m_NeedSendinfo = true; } - - CUIRect Left, Right; - MainView.HSplitTop(20.0f, 0, &MainView); - MainView.VSplitMid(&Left, &Right); - Left.VSplitRight(5.0f, &Left, 0); - Right.VMargin(5.0f, &Right); - - // dynamic camera - Left.HSplitTop(20.0f, &Button, &Left); - static int s_DynamicCameraButton = 0; - if(DoButton_CheckBox(&s_DynamicCameraButton, Localize("Dynamic Camera"), g_Config.m_ClMouseDeadzone != 0, &Button)) - { - if(g_Config.m_ClMouseDeadzone) - { - g_Config.m_ClMouseFollowfactor = 0; - g_Config.m_ClMouseMaxDistance = 400; - g_Config.m_ClMouseDeadzone = 0; - } - else - { - g_Config.m_ClMouseFollowfactor = 60; - g_Config.m_ClMouseMaxDistance = 1000; - g_Config.m_ClMouseDeadzone = 300; - } - } - - // weapon pickup - Left.HSplitTop(5.0f, 0, &Left); - Left.HSplitTop(20.0f, &Button, &Left); - if(DoButton_CheckBox(&g_Config.m_ClAutoswitchWeapons, Localize("Switch weapon on pickup"), g_Config.m_ClAutoswitchWeapons, &Button)) - g_Config.m_ClAutoswitchWeapons ^= 1; - - // show hud - Left.HSplitTop(5.0f, 0, &Left); - Left.HSplitTop(20.0f, &Button, &Left); - if(DoButton_CheckBox(&g_Config.m_ClShowhud, Localize("Show ingame HUD"), g_Config.m_ClShowhud, &Button)) - g_Config.m_ClShowhud ^= 1; - - // name plates - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClNameplates, Localize("Show name plates"), g_Config.m_ClNameplates, &Button)) - g_Config.m_ClNameplates ^= 1; - - if(g_Config.m_ClNameplates) - { - Right.HSplitTop(2.5f, 0, &Right); - Right.VSplitLeft(30.0f, 0, &Right); - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClNameplatesAlways, Localize("Always show name plates"), g_Config.m_ClNameplatesAlways, &Button)) - g_Config.m_ClNameplatesAlways ^= 1; - - Right.HSplitTop(2.5f, 0, &Right); - Right.HSplitTop(20.0f, &Label, &Right); - Right.HSplitTop(20.0f, &Button, &Right); - str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Name plates size"), g_Config.m_ClNameplatesSize); - UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1); - Button.HMargin(2.0f, &Button); - g_Config.m_ClNameplatesSize = (int)(DoScrollbarH(&g_Config.m_ClNameplatesSize, &Button, g_Config.m_ClNameplatesSize/100.0f)*100.0f+0.1f); - - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClNameplatesTeamcolors, Localize("Use team colors for name plates"), g_Config.m_ClNameplatesTeamcolors, &Button)) - g_Config.m_ClNameplatesTeamcolors ^= 1; - } } -void CMenus::RenderSPPage1(CUIRect MainView) +void CMenus::RenderSettingsTee(CUIRect MainView) { - // settings player page 1 CUIRect Button, Label; MainView.HSplitTop(10.0f, 0, &MainView); @@ -391,6 +408,7 @@ void CMenus::RenderSPPage1(CUIRect MainView) } } + typedef void (*pfnAssignFuncCallback)(CConfiguration *pConfig, int Value); typedef struct @@ -863,53 +881,6 @@ void CMenus::RenderLanguageSelection(CUIRect MainView) } } -void CMenus::RenderSettingsGeneral(CUIRect MainView) -{ - CUIRect List, Button, Label, Left, Right; - MainView.HSplitBottom(10.0f, &MainView, 0); - MainView.HSplitBottom(70.0f, &MainView, &Left); - Left.VSplitMid(&Left, &Right); - MainView.HSplitBottom(20.0f, &List, &MainView); - - // auto demo settings - { - Left.HSplitTop(20.0f, &Button, &Left); - if(DoButton_CheckBox(&g_Config.m_ClAutoDemoRecord, Localize("Automatically record demos"), g_Config.m_ClAutoDemoRecord, &Button)) - g_Config.m_ClAutoDemoRecord ^= 1; - - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClAutoScreenshot, Localize("Automatically take game over screenshot"), g_Config.m_ClAutoScreenshot, &Button)) - g_Config.m_ClAutoScreenshot ^= 1; - - Left.HSplitTop(10.0f, 0, &Left); - Left.VSplitLeft(20.0f, 0, &Left); - Left.HSplitTop(20.0f, &Label, &Button); - Button.VSplitRight(20.0f, &Button, 0); - char aBuf[64]; - if(g_Config.m_ClAutoDemoMax) - str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max demos"), g_Config.m_ClAutoDemoMax); - else - str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max demos"), Localize("no limit")); - UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1); - Button.HMargin(2.0f, &Button); - g_Config.m_ClAutoDemoMax = static_cast(DoScrollbarH(&g_Config.m_ClAutoDemoMax, &Button, g_Config.m_ClAutoDemoMax/1000.0f)*1000.0f+0.1f); - - Right.HSplitTop(10.0f, 0, &Right); - Right.VSplitLeft(20.0f, 0, &Right); - Right.HSplitTop(20.0f, &Label, &Button); - Button.VSplitRight(20.0f, &Button, 0); - if(g_Config.m_ClAutoScreenshotMax) - str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoScreenshotMax); - else - str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), Localize("no limit")); - UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1); - Button.HMargin(2.0f, &Button); - g_Config.m_ClAutoScreenshotMax = static_cast(DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax/1000.0f)*1000.0f+0.1f); - } - - RenderLanguageSelection(List); -} - void CMenus::RenderSettings(CUIRect MainView) { static int s_SettingsPage = 0; @@ -927,8 +898,10 @@ void CMenus::RenderSettings(CUIRect MainView) CUIRect Button; const char *aTabs[] = { + Localize("Language"), Localize("General"), Localize("Player"), + ("Tee"), Localize("Controls"), Localize("Graphics"), Localize("Sound")}; @@ -946,14 +919,18 @@ void CMenus::RenderSettings(CUIRect MainView) MainView.Margin(10.0f, &MainView); if(s_SettingsPage == 0) - RenderSettingsGeneral(MainView); + RenderLanguageSelection(MainView); else if(s_SettingsPage == 1) - RenderSettingsPlayer(MainView); + RenderSettingsGeneral(MainView); else if(s_SettingsPage == 2) - RenderSettingsControls(MainView); + RenderSettingsPlayer(MainView); else if(s_SettingsPage == 3) - RenderSettingsGraphics(MainView); + RenderSettingsTee(MainView); else if(s_SettingsPage == 4) + RenderSettingsControls(MainView); + else if(s_SettingsPage == 5) + RenderSettingsGraphics(MainView); + else if(s_SettingsPage == 6) RenderSettingsSound(MainView); if(m_NeedRestartGraphics || m_NeedRestartSound) -- 2.11.4.GIT