From e816e2e0e068e54d1432fe596e4bf0ef4e1d965d Mon Sep 17 00:00:00 2001 From: def Date: Sun, 14 Dec 2014 17:16:44 +0100 Subject: [PATCH] Clean up menus --- src/game/client/components/menus_settings.cpp | 235 ++++-------------- 1 file changed, 44 insertions(+), 191 deletions(-) diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index da97a96d3..cee7c30c5 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -56,8 +56,8 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) { char aBuf[128]; CUIRect Label, Button, Left, Right, Game, Client, AutoReconnect; - MainView.HSplitTop(180.0f, &Game, &Client); - Client.HSplitTop(180.0f, &Client, &AutoReconnect); + MainView.HSplitTop(160.0f, &Game, &Client); + Client.HSplitTop(160.0f, &Client, &AutoReconnect); // game { @@ -106,12 +106,6 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) if(DoButton_CheckBox(&g_Config.m_ClResetWantedWeaponOnDeath, Localize("Reset wanted weapon on death"), g_Config.m_ClResetWantedWeaponOnDeath, &Button)) g_Config.m_ClResetWantedWeaponOnDeath ^= 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; - // chat messages Right.HSplitTop(5.0f, 0, &Right); Right.HSplitTop(20.0f, &Button, &Right); @@ -126,11 +120,6 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) if(g_Config.m_ClNameplates) { - Right.HSplitTop(2.5f, 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); @@ -191,25 +180,6 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) g_Config.m_ClAutoScreenshotMax = static_cast(DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax/1000.0f)*1000.0f+0.1f); } - Right.HSplitTop(20.0f, &Button, &Right); - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClConfirmDisconnect, Localize("Confirm disconnect from server"), g_Config.m_ClConfirmDisconnect, &Button)) - g_Config.m_ClConfirmDisconnect ^= 1; - - Right.HSplitTop(5.0f, 0, &Right); - Right.HSplitTop(20.0f, &Button, &Right); - if (DoButton_CheckBox(&g_Config.m_ClPrintBroadcasts, Localize("Print broadcasts to console"), g_Config.m_ClPrintBroadcasts, &Button)) - { - g_Config.m_ClPrintBroadcasts ^= 1; - } - - Right.HSplitTop(5.0f, 0, &Right); - Right.HSplitTop(20.0f, &Button, &Right); - if (DoButton_CheckBox(&g_Config.m_ClFriendsIgnoreClan, Localize("Ignore clan tag for friends"), g_Config.m_ClFriendsIgnoreClan, &Button)) - { - g_Config.m_ClFriendsIgnoreClan ^= 1; - } - Left.HSplitTop(20.0f, 0, &Left); Left.HSplitTop(20.0f, &Label, &Left); Button.VSplitRight(20.0f, &Button, 0); @@ -223,72 +193,6 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) Button.HMargin(2.0f, &Button); g_Config.m_ClCpuThrottle= static_cast(DoScrollbarH(&g_Config.m_ClCpuThrottle, &Button, g_Config.m_ClCpuThrottle/100.0f)*100.0f+0.1f); } - - Left.HSplitTop(30.0f, 0, &Left); - Left.HSplitTop(20.0f, &Button, &Left); - if (DoButton_CheckBox(&g_Config.m_ClCpuThrottleInactive, Localize("CPU Throttle when window is inactive"), g_Config.m_ClCpuThrottleInactive, &Button)) - { - g_Config.m_ClCpuThrottleInactive ^= 1; - } - - AutoReconnect.HSplitTop(30.0f, &Label, &AutoReconnect); - - UI()->DoLabelScaled(&Label, Localize("Reconnecting"), 20.0f, -1); - - AutoReconnect.Margin(5.0f, &AutoReconnect); - AutoReconnect.VSplitMid(&Left, &Right); - Left.VSplitRight(5.0f, &Left, 0); - Right.VMargin(5.0f, &Right); - - { - Right.HSplitTop(20.0f, &Button, &Right); - if (DoButton_CheckBox(&g_Config.m_ClReconnectFull, Localize("Reconnect when server is full"), g_Config.m_ClReconnectFull, &Button)) - { - g_Config.m_ClReconnectFull ^= 1; - } - - Left.HSplitTop(20.0f, &Button, &Left); - if (DoButton_CheckBox(&g_Config.m_ClReconnectBan, Localize("Reconnect when you are banned"), g_Config.m_ClReconnectBan, &Button)) - { - g_Config.m_ClReconnectBan ^= 1; - } - - Left.HSplitTop(10.0f, 0, &Left); - Left.HSplitTop(20.0f, &Label, &Left); - Button.VSplitRight(20.0f, &Button, 0); - char aBuf[64]; - if (g_Config.m_ClReconnectBanTimeout == 1) - { - str_format(aBuf, sizeof(aBuf), "%s %i %s", Localize("Wait before try for"), g_Config.m_ClReconnectBanTimeout, Localize("second")); - } - else - { - str_format(aBuf, sizeof(aBuf), "%s %i %s", Localize("Wait before try for"), g_Config.m_ClReconnectBanTimeout, Localize("seconds")); - } - UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1); - Left.HSplitTop(20.0f, &Button, 0); - Button.HMargin(2.0f, &Button); - g_Config.m_ClReconnectBanTimeout = static_cast(DoScrollbarH(&g_Config.m_ClReconnectBanTimeout, &Button, g_Config.m_ClReconnectBanTimeout / 120.0f) * 120.0f); - if (g_Config.m_ClReconnectBanTimeout < 5) - g_Config.m_ClReconnectBanTimeout = 5; - Right.HSplitTop(10.0f, 0, &Right); - Right.HSplitTop(20.0f, &Label, &Right); - Button.VSplitRight(20.0f, &Button, 0); - if (g_Config.m_ClReconnectFullTimeout == 1) - { - str_format(aBuf, sizeof(aBuf), "%s %i %s", Localize("Wait before try for"), g_Config.m_ClReconnectFullTimeout, Localize("second")); - } - else - { - str_format(aBuf, sizeof(aBuf), "%s %i %s", Localize("Wait before try for"), g_Config.m_ClReconnectFullTimeout, Localize("seconds")); - } - UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1); - Right.HSplitTop(20.0f, &Button, 0); - Button.HMargin(2.0f, &Button); - g_Config.m_ClReconnectFullTimeout = static_cast(DoScrollbarH(&g_Config.m_ClReconnectFullTimeout, &Button, g_Config.m_ClReconnectFullTimeout / 120.0f) * 120.0f); - if (g_Config.m_ClReconnectFullTimeout < 1) - g_Config.m_ClReconnectFullTimeout = 1; - } } void CMenus::RenderSettingsPlayer(CUIRect MainView) @@ -1059,7 +963,6 @@ void CMenus::RenderSettingsSound(CUIRect MainView) Button.HMargin(2.0f, &Button); UI()->DoLabelScaled(&Label, Localize("Sound volume"), 14.0f, -1); g_Config.m_SndVolume = (int)(DoScrollbarH(&g_Config.m_SndVolume, &Button, g_Config.m_SndVolume/100.0f)*100.0f); - MainView.HSplitTop(20.0f, 0, &MainView); } // volume slider map sounds @@ -1069,9 +972,8 @@ void CMenus::RenderSettingsSound(CUIRect MainView) MainView.HSplitTop(20.0f, &Button, &MainView); Button.VSplitLeft(190.0f, &Label, &Button); Button.HMargin(2.0f, &Button); - UI()->DoLabelScaled(&Label, Localize("Map Sound volume"), 14.0f, -1); + UI()->DoLabelScaled(&Label, Localize("Map sound volume"), 14.0f, -1); g_Config.m_SndMapSoundVolume = (int)(DoScrollbarH(&g_Config.m_SndMapSoundVolume, &Button, g_Config.m_SndMapSoundVolume/100.0f)*100.0f); - MainView.HSplitTop(20.0f, 0, &MainView); } } @@ -1267,7 +1169,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView) { CUIRect Left, Right, HUD, Messages, Button, Label, Weapon, Laser; - MainView.HSplitTop(130.0f, &HUD, &MainView); + MainView.HSplitTop(150.0f, &HUD, &MainView); HUD.HSplitTop(30.0f, &Label, &HUD); UI()->DoLabelScaled(&Label, Localize("HUD"), 20.0f, -1); @@ -1276,6 +1178,12 @@ void CMenus::RenderSettingsHUD(CUIRect MainView) Left.VSplitRight(5.0f, &Left, 0); Right.VMargin(5.0f, &Right); + // show hud + 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; + + Left.HSplitTop(20.0f, &Button, &Left); if (DoButton_CheckBox(&g_Config.m_ClDDRaceScoreBoard, Localize("Use DDRace Scoreboard"), g_Config.m_ClDDRaceScoreBoard, &Button)) { @@ -1323,7 +1231,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView) { g_Config.m_ClShowVotesAfterVoting ^= 1; } - MainView.HSplitTop(130.0f, &Messages, &MainView); + MainView.HSplitTop(170.0f, &Messages, &MainView); Messages.HSplitTop(30.0f, &Label, &Messages); Label.VSplitMid(&Label, &Button); UI()->DoLabelScaled(&Label, Localize("Messages"), 20.0f, -1); @@ -1703,7 +1611,7 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView) { CUIRect Button, Left, Right, LeftLeft, Demo, Gameplay, Miscellaneous, Label; - MainView.HSplitTop(125.0f, &Demo , &MainView); + MainView.HSplitTop(100.0f, &Demo , &MainView); Demo.HSplitTop(30.0f, &Label, &Demo); UI()->DoLabelScaled(&Label, Localize("Demo"), 20.0f, -1); @@ -1718,43 +1626,28 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView) g_Config.m_ClAutoRaceRecord ^= 1; } - Left.HSplitTop(20.0f, &Button, &Left); - if(DoButton_CheckBox(&g_Config.m_ClDemoName, Localize("Save the player name within the demo"), g_Config.m_ClDemoName, &Button)) - { - g_Config.m_ClDemoName ^= 1; - } - - Left.HSplitTop(20.0f, &Button, &Left); - if(DoButton_CheckBox(&g_Config.m_ClDemoShowSpeed, Localize("Show demo speed on change"), g_Config.m_ClDemoShowSpeed, &Button)) - { - g_Config.m_ClDemoShowSpeed ^= 1; - } - - Left.HSplitTop(20.0f, &Button, &Left); - if(DoButton_CheckBox(&g_Config.m_ClDemoAssumeRace, Localize("Assume race demos (time in scoreboard)"), g_Config.m_ClDemoAssumeRace, &Button)) - { - g_Config.m_ClDemoAssumeRace ^= 1; - } - Right.HSplitTop(20.0f, &Button, &Right); if(DoButton_CheckBox(&g_Config.m_ClRaceGhost, Localize("Ghost"), g_Config.m_ClRaceGhost, &Button)) { g_Config.m_ClRaceGhost ^= 1; } - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClRaceShowGhost, Localize("Show ghost"), g_Config.m_ClRaceShowGhost, &Button)) + if(g_Config.m_ClRaceGhost) { - g_Config.m_ClRaceShowGhost ^= 1; + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClRaceShowGhost, Localize("Show ghost"), g_Config.m_ClRaceShowGhost, &Button)) + { + g_Config.m_ClRaceShowGhost ^= 1; + } + + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClRaceSaveGhost, Localize("Save ghost"), g_Config.m_ClRaceSaveGhost, &Button)) + { + g_Config.m_ClRaceSaveGhost ^= 1; + } } - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClRaceSaveGhost, Localize("Save ghost"), g_Config.m_ClRaceSaveGhost, &Button)) - { - g_Config.m_ClRaceSaveGhost ^= 1; - } - - MainView.HSplitTop(270.0f, &Gameplay , &MainView); + MainView.HSplitTop(250.0f, &Gameplay , &MainView); Gameplay.HSplitTop(30.0f, &Label, &Gameplay); UI()->DoLabelScaled(&Label, Localize("Gameplay"), 20.0f, -1); @@ -1800,46 +1693,29 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView) g_Config.m_ClAntiPing ^= 1; } - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClAntiPingPlayers, Localize("AntiPing (predict other players)"), g_Config.m_ClAntiPingPlayers, &Button)) + if(g_Config.m_ClAntiPing) { - g_Config.m_ClAntiPingPlayers ^= 1; - } + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClAntiPingPlayers, Localize("AntiPing: predict other players"), g_Config.m_ClAntiPingPlayers, &Button)) + { + g_Config.m_ClAntiPingPlayers ^= 1; + } - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClAntiPingWeapons, Localize("AntiPing (predict weapons)"), g_Config.m_ClAntiPingWeapons, &Button)) - { - g_Config.m_ClAntiPingWeapons ^= 1; - } + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClAntiPingWeapons, Localize("AntiPing: predict weapons"), g_Config.m_ClAntiPingWeapons, &Button)) + { + g_Config.m_ClAntiPingWeapons ^= 1; + } - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClAntiPingGrenade, Localize("AntiPing (predict grenade paths)"), g_Config.m_ClAntiPingGrenade, &Button)) - { - g_Config.m_ClAntiPingGrenade ^= 1; + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClAntiPingGrenade, Localize("AntiPing: predict grenade paths"), g_Config.m_ClAntiPingGrenade, &Button)) + { + g_Config.m_ClAntiPingGrenade ^= 1; + } } - - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClUnpredictedShadow, Localize("Show unpredicted shadow tee"), g_Config.m_ClUnpredictedShadow, &Button)) + else { - g_Config.m_ClUnpredictedShadow ^= 1; - } - - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClShowNinja, Localize("Show ninja skin"), g_Config.m_ClShowNinja, &Button)) - { - g_Config.m_ClShowNinja ^= 1; - } - - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClOldGunPosition, Localize("Old gun position"), g_Config.m_ClOldGunPosition, &Button)) - { - g_Config.m_ClOldGunPosition ^= 1; - } - - Left.HSplitTop(20.0f, &Button, &Left); - if(DoButton_CheckBox(&g_Config.m_ClZoomBackgroundLayers, Localize("Zoom background layers"), g_Config.m_ClZoomBackgroundLayers, &Button)) - { - g_Config.m_ClZoomBackgroundLayers ^= 1; + Right.HSplitTop(60.0f, 0, &Right); } Left.HSplitTop(20.0f, &Button, &Left); @@ -1854,7 +1730,7 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView) g_Config.m_ClShowDirection ^= 1; } - Left.HSplitTop(20.0f, &Button, &Left); + Right.HSplitTop(20.0f, &Button, &Right); // Empty space here CUIRect aRects[2]; @@ -1902,18 +1778,6 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView) Left.VSplitRight(5.0f, &Left, 0); Right.VMargin(5.0f, &Right); - Left.HSplitTop(20.0f, &Button, &Left); - if(DoButton_CheckBox(&g_Config.m_ClDDRaceBinds, Localize("Bind free keys with DDRace binds"), g_Config.m_ClDDRaceBinds, &Button)) - { - g_Config.m_ClDDRaceBinds ^= 1; - } - - Right.HSplitTop(20.0f, &Button, &Right); - if(DoButton_CheckBox(&g_Config.m_ClEditorUndo, Localize("Undo function in editor (could be buggy)"), g_Config.m_ClEditorUndo, &Button)) - { - g_Config.m_ClEditorUndo ^= 1; - } - // Auto Update #if !defined(CONF_PLATFORM_MACOSX) && !defined(__ANDROID__) CUIRect HUDItem; @@ -1932,17 +1796,6 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView) } #endif - { - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ConnTimeout); - Right.HSplitTop(20.0f, &Button, &Right); - UI()->DoLabelScaled(&Button, Localize("Timeout (in seconds):"), 14.0f, -1); - Button.VSplitLeft(190.0f, 0, &Button); - static float Offset = 0.0f; - DoEditBox(&g_Config.m_ConnTimeout, &Button, aBuf, sizeof(aBuf), 14.0f, &Offset); - g_Config.m_ConnTimeout = clamp(str_toint(aBuf), 5, 1000); - } - { Right.HSplitTop(20.0f, &Button, &Right); Button.VSplitLeft(190.0f, &Label, &Button);