From 3d5b9966b68a3d7f6aa9115d871f6a2750104de4 Mon Sep 17 00:00:00 2001 From: SollyBunny Date: Wed, 20 Nov 2024 22:19:03 +0000 Subject: [PATCH] Formatting --- src/engine/client.h | 8 +- src/engine/client/client.h | 2 +- src/engine/shared/config.cpp | 10 +- src/game/client/components/binds.cpp | 2 +- src/game/client/components/bindwheel.h | 6 +- src/game/client/components/controls.cpp | 6 +- src/game/client/components/hud.cpp | 31 +- src/game/client/components/maplayers.h | 1 - src/game/client/components/menus.h | 1 + src/game/client/components/menus_settings.cpp | 1013 +++++++---------- src/game/client/components/players.cpp | 23 +- src/game/client/components/skinprofiles.h | 2 +- src/game/client/components/tater.cpp | 2 +- src/game/client/components/verify.cpp | 2 +- src/game/client/gameclient.cpp | 22 +- src/game/client/gameclient.h | 19 +- src/game/client/render_map.cpp | 23 +- src/game/server/entities/character.cpp | 44 +- src/game/tater_variables.h | 4 +- 19 files changed, 516 insertions(+), 705 deletions(-) diff --git a/src/engine/client.h b/src/engine/client.h index 8b9192fdb64..e65c5a03fcf 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -57,9 +57,9 @@ class IClient : public IInterface }; /** - * More precise state for @see STATE_LOADING - * Sets what is actually happening in the client right now - */ + * More precise state for @see STATE_LOADING + * Sets what is actually happening in the client right now + */ enum ELoadingStateDetail { LOADING_STATE_DETAIL_INITIAL, @@ -268,7 +268,7 @@ class IClient : public IInterface virtual IGraphics::CTextureHandle GetDebugFont() const = 0; // TODO: remove this function - //DDRace + // DDRace virtual const char *GetCurrentMap() const = 0; virtual const char *GetCurrentMapPath() const = 0; diff --git a/src/engine/client/client.h b/src/engine/client/client.h index 247e35a3fb9..ea95d99ddcf 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -507,7 +507,7 @@ class CClient : public IClient, public CDemoPlayer::IListener IFriends *Foes() override { return &m_Foes; } - void GetSmoothFreezeTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override; + void GetSmoothFreezeTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override; void GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float MixAmount) override; void AddWarning(const SWarning &Warning) override; diff --git a/src/engine/shared/config.cpp b/src/engine/shared/config.cpp index 22ddaa534bf..f92f1ad0af0 100644 --- a/src/engine/shared/config.cpp +++ b/src/engine/shared/config.cpp @@ -302,7 +302,7 @@ void CConfigManager::Init() { \ const size_t HelpSize = (size_t)str_length(Desc) + 32; \ char *pHelp = static_cast(m_ConfigHeap.Allocate(HelpSize)); \ - const bool Alpha = ((Flags)&CFGFLAG_COLALPHA) != 0; \ + const bool Alpha = ((Flags) & CFGFLAG_COLALPHA) != 0; \ str_format(pHelp, HelpSize, "%s (default: $%0*X)", Desc, Alpha ? 8 : 6, color_cast(ColorHSLA(Def, Alpha)).Pack(Alpha)); \ AddVariable(m_ConfigHeap.Allocate(m_pConsole, #ScriptName, SConfigVariable::VAR_COLOR, Flags, pHelp, &g_Config.m_##Name, Def)); \ } @@ -455,19 +455,19 @@ bool CConfigManager::TSave() char aEscapeBuf[1024 * 2]; #define MACRO_CONFIG_INT(Name, ScriptName, def, min, max, flags, desc) \ - if((flags)&CFGFLAG_SAVE && g_Config.m_##Name != def) \ + if((flags) & CFGFLAG_SAVE && g_Config.m_##Name != def) \ { \ str_format(aLineBuf, sizeof(aLineBuf), "%s %i", #ScriptName, g_Config.m_##Name); \ WriteLine(aLineBuf); \ } #define MACRO_CONFIG_COL(Name, ScriptName, def, flags, desc) \ - if((flags)&CFGFLAG_SAVE && g_Config.m_##Name != def) \ + if((flags) & CFGFLAG_SAVE && g_Config.m_##Name != def) \ { \ str_format(aLineBuf, sizeof(aLineBuf), "%s %u", #ScriptName, g_Config.m_##Name); \ WriteLine(aLineBuf); \ } #define MACRO_CONFIG_STR(Name, ScriptName, len, def, flags, desc) \ - if((flags)&CFGFLAG_SAVE && str_comp(g_Config.m_##Name, def) != 0) \ + if((flags) & CFGFLAG_SAVE && str_comp(g_Config.m_##Name, def) != 0) \ { \ EscapeParam(aEscapeBuf, g_Config.m_##Name, sizeof(aEscapeBuf)); \ str_format(aLineBuf, sizeof(aLineBuf), "%s \"%s\"", #ScriptName, aEscapeBuf); \ @@ -485,7 +485,6 @@ bool CConfigManager::TSave() Callback.m_pfnFunc(this, Callback.m_pUserData); } - if(io_sync(m_ConfigFile) != 0) { m_Failed = true; @@ -522,7 +521,6 @@ void CConfigManager::RegisterTCallback(SAVECALLBACKFUNC pfnFunc, void *pUserData m_vTCallbacks.emplace_back(pfnFunc, pUserData); } - void CConfigManager::WriteLine(const char *pLine) { if(!m_ConfigFile || diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index 088ae9f134c..cb7a979ce51 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -274,7 +274,7 @@ void CBinds::SetDefaults() Bind(KEY_MOUSE_1, "+fire"); Bind(KEY_MOUSE_2, "+hook"); Bind(KEY_LSHIFT, "+emote"); - Bind(KEY_Q, "+bindwheel"); + Bind(KEY_Q, "+bindwheel"); Bind(KEY_RETURN, "+show_chat; chat all"); Bind(KEY_RIGHT, "spectate_next"); Bind(KEY_LEFT, "spectate_previous"); diff --git a/src/game/client/components/bindwheel.h b/src/game/client/components/bindwheel.h index 2bf78ce0aa9..f9e6e93ac5b 100644 --- a/src/game/client/components/bindwheel.h +++ b/src/game/client/components/bindwheel.h @@ -10,7 +10,7 @@ class IConfigManager; class CBindWheel : public CComponent { - void DrawCircle(float x, float y, float r, int Segments); + void DrawCircle(float x, float y, float r, int Segments); bool m_WasActive; bool m_Active; @@ -30,7 +30,6 @@ class CBindWheel : public CComponent }; SClientBindWheel m_BindWheelList[NUM_BINDWHEEL]; - CBindWheel(); virtual int Sizeof() const override { return sizeof(*this); } @@ -40,10 +39,9 @@ class CBindWheel : public CComponent virtual void OnRelease() override; virtual bool OnCursorMove(float x, float y, IInput::ECursorType CursorType) override; static void ConchainBindwheel(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); - + void updateBinds(int Bindpos, char *Description, char *Command); void Binwheel(int Bind); - }; #endif diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index 6be1bbf9226..a60dc10a19d 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -497,9 +497,5 @@ bool CControls::CheckNewInput() m_FastInput = TestInput; - if (NewInput) - { - return true; - } - return false; + return NewInput; } diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 6e80c07d2f4..72c074bed8c 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -265,10 +265,7 @@ void CHud::RenderScoreHud() if(GameFlags & GAMEFLAG_FLAGS) { - int BlinkTimer = (m_pClient->m_aFlagDropTick[t] != 0 && - (Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_aFlagDropTick[t]) / Client()->GameTickSpeed() >= 25) ? - 10 : - 20; + int BlinkTimer = (m_pClient->m_aFlagDropTick[t] != 0 && (Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_aFlagDropTick[t]) / Client()->GameTickSpeed() >= 25) ? 10 : 20; if(aFlagCarrier[t] == FLAG_ATSTAND || (aFlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick(g_Config.m_ClDummy) / BlinkTimer) & 1))) { // draw flag @@ -304,7 +301,6 @@ void CHud::RenderScoreHud() CTeeRenderInfo TeeInfo = m_pClient->m_aClients[Id].m_RenderInfo; TeeInfo.m_Size = ScoreSingleBoxHeight; - const CAnimState *pIdleState = CAnimState::GetIdle(); vec2 OffsetToMid; CRenderTools::GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid); @@ -618,7 +614,7 @@ void CHud::RenderTextInfo() } } - //render team in freeze text and last notify + // render team in freeze text and last notify if((g_Config.m_ClShowFrozenText > 0 || g_Config.m_ClShowFrozenHud > 0 || g_Config.m_ClNotifyWhenLast) && GameClient()->m_GameInfo.m_EntitiesDDRace) { int NumInTeam = 0; @@ -640,30 +636,30 @@ void CHud::RenderTextInfo() } } - //Notify when last + // Notify when last if(g_Config.m_ClNotifyWhenLast) { if(NumInTeam > 1 && NumInTeam - NumFrozen == 1) { - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s", g_Config.m_ClNotifyWhenLastText); - TextRender()->TextColor(color_cast(ColorHSLA(g_Config.m_ClNotifyWhenLastColor))); - TextRender()->Text(170, 4, 14, aBuf, -1.0f); - TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); + const float Size = 11.0f; + CUIRect BoundingBox{m_Width / 4.0f - m_Width / 8.0f, 2.0f, m_Width / 4.0f, Size}; + TextRender()->TextColor(color_cast(ColorHSLA(g_Config.m_ClNotifyWhenLastColor))); + Ui()->DoLabel(&BoundingBox, g_Config.m_ClNotifyWhenLastText, Size, TEXTALIGN_CENTER); + TextRender()->TextColor(TextRender()->DefaultTextColor()); } } - //Show freeze text + // Show freeze text char aBuf[64]; if(g_Config.m_ClShowFrozenText == 1) str_format(aBuf, sizeof(aBuf), "%d / %d", NumInTeam - NumFrozen, NumInTeam); else if(g_Config.m_ClShowFrozenText == 2) str_format(aBuf, sizeof(aBuf), "%d / %d", NumFrozen, NumInTeam); if(g_Config.m_ClShowFrozenText > 0) - TextRender()->Text(m_Width / 2 - TextRender()->TextWidth(10, aBuf, -1, -1.0f) / 2, 12, 10, aBuf, -1.0f); + TextRender()->Text(m_Width / 2.0f - TextRender()->TextWidth(10.f, aBuf) / 2.0f, 12.0f, 10.0f, aBuf); - //str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_PrevPredicted.m_FreezeEnd); - //str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ClWhatsMyPing); - //TextRender()->Text(0, m_Width / 2 - TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f) / 2, 20, 10, aBuf, -1.0f); + // str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientId].m_PrevPredicted.m_FreezeEnd); + // str_format(aBuf, sizeof(aBuf), "%d", g_Config.m_ClWhatsMyPing); + // TextRender()->Text(0, m_Width / 2 - TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f) / 2, 20, 10, aBuf, -1.0f); if(g_Config.m_ClShowFrozenHud > 0 && !m_pClient->m_Scoreboard.Active() && !(LocalTeamID == 0 && g_Config.m_ClFrozenHudTeamOnly)) { @@ -676,7 +672,6 @@ void CHud::RenderTextInfo() FreezeInfo.m_ColorBody = ColorRGBA(1, 1, 1); FreezeInfo.m_ColorFeet = ColorRGBA(1, 1, 1); FreezeInfo.m_CustomColoredSkin = false; - float progressiveOffset = 0.0f; float TeeSize = g_Config.m_ClFrozenHudTeeSize; diff --git a/src/game/client/components/maplayers.h b/src/game/client/components/maplayers.h index 6aa408df1f9..f1bce1e280e 100644 --- a/src/game/client/components/maplayers.h +++ b/src/game/client/components/maplayers.h @@ -135,7 +135,6 @@ class CMapLayers : public CComponent public: bool m_OnlineOnly; - enum { TYPE_BACKGROUND = 0, diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 0f5cd6bf6f3..a7193c9c9da 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -499,6 +499,7 @@ class CMenus : public CComponent void PopupConfirmSwitchServer(); void RenderServerbrowserFilters(CUIRect View); void ResetServerbrowserFilters(); + void OpenTClientDiscord(); void RenderServerbrowserDDNetFilter(CUIRect View, IFilterList &Filter, float ItemHeight, int MaxItems, int ItemsPerRow, diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 7098e7e6332..99d20e0b601 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -346,18 +346,18 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView) MainView.HSplitBottom(5.0f, &MainView, nullptr); QuickSearch.VSplitLeft(220.0f, &QuickSearch, nullptr); - int OldSelected = -1; + int RainbowSelectedOld = -1; static CListBox s_ListBox; - s_ListBox.DoStart(48.0f, vpFilteredFlags.size(), 10, 3, OldSelected, &MainView); + s_ListBox.DoStart(48.0f, vpFilteredFlags.size(), 10, 3, RainbowSelectedOld, &MainView); for(size_t i = 0; i < vpFilteredFlags.size(); i++) { const CCountryFlags::CCountryFlag *pEntry = vpFilteredFlags[i]; if(pEntry->m_CountryCode == *pCountry) - OldSelected = i; + RainbowSelectedOld = i; - const CListboxItem Item = s_ListBox.DoNextItem(&pEntry->m_CountryCode, OldSelected >= 0 && (size_t)OldSelected == i); + const CListboxItem Item = s_ListBox.DoNextItem(&pEntry->m_CountryCode, RainbowSelectedOld >= 0 && (size_t)RainbowSelectedOld == i); if(!Item.m_Visible) continue; @@ -377,7 +377,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView) } const int NewSelected = s_ListBox.DoEnd(); - if(OldSelected != NewSelected) + if(RainbowSelectedOld != NewSelected) { *pCountry = vpFilteredFlags[NewSelected]->m_CountryCode; SetNeedSendInfo(); @@ -641,7 +641,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView) static CButtonContainer s_RandomizeColors; if(*pUseCustomColor) { - //RandomColorsButton.VSplitLeft(120.0f, &RandomColorsButton, 0); + // RandomColorsButton.VSplitLeft(120.0f, &RandomColorsButton, 0); if(DoButton_Menu(&s_RandomizeColors, "Random Colors", 0, &RandomColorsButton, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, vec4(0, 0, 0, 0.5f))) { if(m_Dummy) @@ -786,14 +786,14 @@ void CMenus::RenderSettingsTee(CUIRect MainView) m_SkinListNeedsUpdate = false; } - int OldSelected = -1; - s_ListBox.DoStart(50.0f, s_vSkinList.size(), 4, 1, OldSelected, &MainView); + int RainbowSelectedOld = -1; + s_ListBox.DoStart(50.0f, s_vSkinList.size(), 4, 1, RainbowSelectedOld, &MainView); for(size_t i = 0; i < s_vSkinList.size(); ++i) { const CSkin *pSkinToBeDraw = s_vSkinList[i].m_pSkin; if(str_comp(pSkinToBeDraw->GetName(), pSkinName) == 0) { - OldSelected = i; + RainbowSelectedOld = i; if(m_SkinListScrollToSelected) { s_ListBox.ScrollToSelected(); @@ -801,7 +801,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView) } } - const CListboxItem Item = s_ListBox.DoNextItem(pSkinToBeDraw, OldSelected >= 0 && (size_t)OldSelected == i); + const CListboxItem Item = s_ListBox.DoNextItem(pSkinToBeDraw, RainbowSelectedOld >= 0 && (size_t)RainbowSelectedOld == i); if(!Item.m_Visible) continue; @@ -853,7 +853,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView) } const int NewSelected = s_ListBox.DoEnd(); - if(OldSelected != NewSelected) + if(RainbowSelectedOld != NewSelected) { str_copy(pSkinName, s_vSkinList[NewSelected].m_pSkin->GetName(), SkinNameSize); SetNeedSendInfo(); @@ -1456,9 +1456,9 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) Ui()->DoLabel(&ModeLabel, aBuf, sc_FontSizeResListHeader, TEXTALIGN_MC); } - int OldSelected = -1; + int RainbowSelectedOld = -1; s_ListBox.SetActive(!Ui()->IsPopupOpen()); - s_ListBox.DoStart(sc_RowHeightResList, s_NumNodes, 1, 3, OldSelected, &ModeList); + s_ListBox.DoStart(sc_RowHeightResList, s_NumNodes, 1, 3, RainbowSelectedOld, &ModeList); for(int i = 0; i < s_NumNodes; ++i) { @@ -1468,10 +1468,10 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) g_Config.m_GfxScreenHeight == s_aModes[i].m_WindowHeight && g_Config.m_GfxScreenRefreshRate == s_aModes[i].m_RefreshRate) { - OldSelected = i; + RainbowSelectedOld = i; } - const CListboxItem Item = s_ListBox.DoNextItem(&s_aModes[i], OldSelected == i); + const CListboxItem Item = s_ListBox.DoNextItem(&s_aModes[i], RainbowSelectedOld == i); if(!Item.m_Visible) continue; @@ -1481,7 +1481,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) } const int NewSelected = s_ListBox.DoEnd(); - if(OldSelected != NewSelected) + if(RainbowSelectedOld != NewSelected) { const int Depth = s_aModes[NewSelected].m_Red + s_aModes[NewSelected].m_Green + s_aModes[NewSelected].m_Blue > 16 ? 24 : 16; g_Config.m_GfxColorDepth = Depth; @@ -1668,7 +1668,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) return str_comp_nocase(CheckInfo.m_pBackendName, CConfig::ms_pGfxBackend) == 0 && CheckInfo.m_Major == CConfig::ms_GfxGLMajor && CheckInfo.m_Minor == CConfig::ms_GfxGLMinor && CheckInfo.m_Patch == CConfig::ms_GfxGLPatch; }; - int OldSelectedBackend = -1; + int RainbowSelectedOldBackend = -1; uint32_t CurCounter = 0; for(uint32_t i = 0; i < BACKEND_TYPE_COUNT; ++i) { @@ -1683,7 +1683,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) s_vpBackendIdNamesCStr[CurCounter] = s_vBackendIdNames[CurCounter].c_str(); if(str_comp_nocase(Info.m_pBackendName, g_Config.m_GfxBackend) == 0 && g_Config.m_GfxGLMajor == Info.m_Major && g_Config.m_GfxGLMinor == Info.m_Minor && g_Config.m_GfxGLPatch == Info.m_Patch) { - OldSelectedBackend = CurCounter; + RainbowSelectedOldBackend = CurCounter; } s_vBackendInfos[CurCounter] = Info; @@ -1692,7 +1692,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) } } - if(OldSelectedBackend != -1) + if(RainbowSelectedOldBackend != -1) { // no custom selected BackendCount -= 1; @@ -1703,7 +1703,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) str_format(aTmpBackendName, sizeof(aTmpBackendName), "%s (%s %d.%d.%d)", Localize("custom"), g_Config.m_GfxBackend, g_Config.m_GfxGLMajor, g_Config.m_GfxGLMinor, g_Config.m_GfxGLPatch); s_vBackendIdNames[CurCounter] = aTmpBackendName; s_vpBackendIdNamesCStr[CurCounter] = s_vBackendIdNames[CurCounter].c_str(); - OldSelectedBackend = CurCounter; + RainbowSelectedOldBackend = CurCounter; s_vBackendInfos[CurCounter].m_pBackendName = "custom"; s_vBackendInfos[CurCounter].m_Major = g_Config.m_GfxGLMajor; @@ -1711,15 +1711,15 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) s_vBackendInfos[CurCounter].m_Patch = g_Config.m_GfxGLPatch; } - static int s_OldSelectedBackend = -1; - if(s_OldSelectedBackend == -1) - s_OldSelectedBackend = OldSelectedBackend; + static int s_RainbowSelectedOldBackend = -1; + if(s_RainbowSelectedOldBackend == -1) + s_RainbowSelectedOldBackend = RainbowSelectedOldBackend; static CUi::SDropDownState s_BackendDropDownState; static CScrollRegion s_BackendDropDownScrollRegion; s_BackendDropDownState.m_SelectionPopupContext.m_pScrollRegion = &s_BackendDropDownScrollRegion; - const int NewBackend = Ui()->DoDropDown(&BackendDropDown, OldSelectedBackend, s_vpBackendIdNamesCStr.data(), BackendCount, s_BackendDropDownState); - if(OldSelectedBackend != NewBackend) + const int NewBackend = Ui()->DoDropDown(&BackendDropDown, RainbowSelectedOldBackend, s_vpBackendIdNamesCStr.data(), BackendCount, s_BackendDropDownState); + if(RainbowSelectedOldBackend != NewBackend) { str_copy(g_Config.m_GfxBackend, s_vBackendInfos[NewBackend].m_pBackendName); g_Config.m_GfxGLMajor = s_vBackendInfos[NewBackend].m_Major; @@ -1727,7 +1727,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) g_Config.m_GfxGLPatch = s_vBackendInfos[NewBackend].m_Patch; CheckSettings = true; - s_GfxBackendChanged = s_OldSelectedBackend != NewBackend; + s_GfxBackendChanged = s_RainbowSelectedOldBackend != NewBackend; } } @@ -1910,7 +1910,7 @@ bool CMenus::RenderLanguageSelection(CUIRect MainView) } } - const int OldSelected = s_SelectedLanguage; + const int RainbowSelectedOld = s_SelectedLanguage; s_ListBox.DoStart(24.0f, g_Localization.Languages().size(), 1, 3, s_SelectedLanguage, &MainView); @@ -1931,7 +1931,7 @@ bool CMenus::RenderLanguageSelection(CUIRect MainView) s_SelectedLanguage = s_ListBox.DoEnd(); - if(OldSelected != s_SelectedLanguage) + if(RainbowSelectedOld != s_SelectedLanguage) { str_copy(g_Config.m_ClLanguagefile, g_Localization.Languages()[s_SelectedLanguage].m_FileName.c_str()); GameClient()->OnLanguageChange(); @@ -1969,8 +1969,8 @@ void CMenus::RenderSettings(CUIRect MainView) Localize("Sound"), Localize("DDNet"), Localize("Assets"), - ("TClient"), - ("Profiles")}; + Localize("TClient"), + Localize("Profiles")}; static CButtonContainer s_aTabButtons[SETTINGS_LENGTH]; @@ -3212,570 +3212,397 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView) } } +void CMenus::OpenTClientDiscord() +{ + if(!open_link("https://discord.gg/fBvhH93Bt6")) + PopupWarning(Localize("Open TClient Discord"), Localize("Failed to open the TClient Discord in your browser"), Localize("Aww"), std::chrono::nanoseconds(0)); +} + enum { - TCLIENT_TAB_PAGE1 = 0, - TCLIENT_TAB_PAGE2 = 1, - TCLIENT_TAB_BINDWHEEL = 2, - NUMBER_OF_TCLIENT_TABS = 3, + TCLIENT_TAB_SETTINGS = 0, + TCLIENT_TAB_BINDWHEEL = 1, + TCLIENT_TAB_DISCORD = 2, + NUMBER_OF_TCLIENT_TABS = 3 }; void CMenus::RenderSettingsTClient(CUIRect MainView) { static int s_CurCustomTab = 0; - CUIRect Column, Section, Page1Tab, Page2Tab, Page3Tab, LabelTop; + const float LineSize = 20.0f; + const float ColorPickerLineSize = 25.0f; + const float HeadlineFontSize = 20.0f; + const float HeadlineHeight = 30.0f; + const float MarginSmall = 5.0f; + const float MarginBetweenViews = 20.0f; - MainView.HMargin(-15.0f, &MainView); + const float ColorPickerLabelSize = 13.0f; + const float ColorPickerLineSpacing = 5.0f; - MainView.HSplitTop(20, &LabelTop, &MainView); - float TabsW = LabelTop.w; - LabelTop.VSplitLeft(TabsW / NUMBER_OF_TCLIENT_TABS, &Page1Tab, &Page2Tab); - Page2Tab.VSplitLeft(TabsW / NUMBER_OF_TCLIENT_TABS, &Page2Tab, &Page3Tab); + CUIRect TabBar, Column, LeftView, RightView, Button, Label; + MainView.HSplitTop(LineSize, &TabBar, &MainView); + const float TabWidth = TabBar.w / NUMBER_OF_TCLIENT_TABS; static CButtonContainer s_aPageTabs[NUMBER_OF_TCLIENT_TABS] = {}; - if(DoButton_MenuTab(&s_aPageTabs[TCLIENT_TAB_PAGE1], Localize("Page 1"), s_CurCustomTab == TCLIENT_TAB_PAGE1, &Page1Tab, 5, NULL, NULL, NULL, NULL, 4)) - s_CurCustomTab = TCLIENT_TAB_PAGE1; - if(DoButton_MenuTab(&s_aPageTabs[TCLIENT_TAB_PAGE2], Localize("Page 2"), s_CurCustomTab == TCLIENT_TAB_PAGE2, &Page2Tab, 0, NULL, NULL, NULL, NULL, 4)) - s_CurCustomTab = TCLIENT_TAB_PAGE2; - if(DoButton_MenuTab(&s_aPageTabs[TCLIENT_TAB_BINDWHEEL], Localize("BindWheel"), s_CurCustomTab == TCLIENT_TAB_BINDWHEEL, &Page3Tab, 10, NULL, NULL, NULL, NULL, 4)) - s_CurCustomTab = TCLIENT_TAB_BINDWHEEL; + const char *apTabNames[] = { + Localize("Settings"), + Localize("Bindwheel"), + Localize("Discord")}; + + for(int Tab = 0; Tab < NUMBER_OF_TCLIENT_TABS; ++Tab) + { + TabBar.VSplitLeft(TabWidth, &Button, &TabBar); + const int Corners = Tab == 0 ? IGraphics::CORNER_L : Tab == NUMBER_OF_TCLIENT_TABS - 1 ? IGraphics::CORNER_R : IGraphics::CORNER_NONE; + if(DoButton_MenuTab(&s_aPageTabs[Tab], apTabNames[Tab], s_CurCustomTab == Tab, &Button, Corners, nullptr, nullptr, nullptr, nullptr, 4.0f)) + { + if(Tab == TCLIENT_TAB_DISCORD) + PopupConfirm(Localize("Open TClient Discord"), Localize("Click open to open the TClient Discord invite in your browser"), Localize("Open"), Localize("Cancel"), &CMenus::OpenTClientDiscord); + else + s_CurCustomTab = Tab; + break; + } + } - const float LineMargin = 20.0f; + MainView.HSplitTop(10.0f, nullptr, &MainView); - // MainView.HSplitTop(10.0f, 0x0, &MainView); - if(s_CurCustomTab == TCLIENT_TAB_PAGE1) + if(s_CurCustomTab == TCLIENT_TAB_SETTINGS) { - MainView.VSplitLeft(MainView.w * 0.5, &MainView, &Column); + static CScrollRegion s_ScrollRegion; + vec2 ScrollOffset(0.0f, 0.0f); + CScrollRegionParams ScrollParams; + ScrollParams.m_ScrollUnit = 120.0f; + ScrollParams.m_Flags = CScrollRegionParams::FLAG_CONTENT_STATIC_WIDTH; + ScrollParams.m_ScrollbarMargin = 5.0f; + s_ScrollRegion.Begin(&MainView, &ScrollOffset, &ScrollParams); + MainView.y += ScrollOffset.y; - MainView.HSplitTop(30.0f, &Section, &MainView); - Ui()->DoLabel(&Section, ("Frozen Tee Display"), 20.0f, TEXTALIGN_LEFT); - MainView.VSplitLeft(5.0f, 0x0, &MainView); - MainView.HSplitTop(5.0f, 0x0, &MainView); + MainView.VSplitLeft(5.0f, nullptr, &MainView); // Padding for scrollbar + MainView.VSplitMid(&LeftView, &RightView, MarginBetweenViews); - // ***** FROZEN TEE HUD ***** // + // ***** LeftView ***** // - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowFrozenHud, ("Show frozen tee display"), &g_Config.m_ClShowFrozenHud, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowFrozenHudSkins, ("Use skins instead of ninja tees"), &g_Config.m_ClShowFrozenHudSkins, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFrozenHudTeamOnly, ("Only show after joining a team"), &g_Config.m_ClFrozenHudTeamOnly, &MainView, LineMargin); - { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(140.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i", "Max Rows", g_Config.m_ClFrozenMaxRows); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClFrozenMaxRows = (int)(Ui()->DoScrollbarH(&g_Config.m_ClFrozenMaxRows, &Button, (g_Config.m_ClFrozenMaxRows - 1) / 5.0f) * 5.0f) + 1; - } - { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(140.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i", "Tee Size", g_Config.m_ClFrozenHudTeeSize); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClFrozenHudTeeSize = (int)(Ui()->DoScrollbarH(&g_Config.m_ClFrozenHudTeeSize, &Button, (g_Config.m_ClFrozenHudTeeSize - 8) / 19.0f) * 19.0f) + 8; - } + LeftView.HSplitTop(MarginSmall, nullptr, &LeftView); + LeftView.HSplitTop(HeadlineHeight, &Label, &LeftView); + Ui()->DoLabel(&Label, Localize("Frozen Tee Display"), HeadlineFontSize, TEXTALIGN_ML); + LeftView.HSplitTop(MarginSmall, nullptr, &LeftView); + + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowFrozenHud, Localize("Show frozen tee display"), &g_Config.m_ClShowFrozenHud, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowFrozenHudSkins, Localize("Use skins instead of ninja tees"), &g_Config.m_ClShowFrozenHudSkins, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFrozenHudTeamOnly, Localize("Only show after joining a team"), &g_Config.m_ClFrozenHudTeamOnly, &LeftView, LineSize); + + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClFrozenMaxRows, &g_Config.m_ClFrozenMaxRows, &Button, Localize("Max Rows"), 1, 6); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClFrozenMaxRows, &g_Config.m_ClFrozenMaxRows, &Button, Localize("Max Columns"), 8, 27); { CUIRect CheckBoxRect, CheckBoxRect2; - MainView.HSplitTop(LineMargin, &CheckBoxRect, &MainView); - CheckBoxRect.VSplitMid(&CheckBoxRect, &CheckBoxRect2); + LeftView.HSplitTop(LineSize, &CheckBoxRect, &LeftView); + LeftView.HSplitTop(LineSize, &CheckBoxRect2, &LeftView); if(DoButton_CheckBox(&g_Config.m_ClShowFrozenText, Localize("Tees Left Alive Text"), g_Config.m_ClShowFrozenText >= 1, &CheckBoxRect)) - { g_Config.m_ClShowFrozenText = g_Config.m_ClShowFrozenText >= 1 ? 0 : 1; - } + if(g_Config.m_ClShowFrozenText) { static int s_CountFrozenText = 0; if(DoButton_CheckBox(&s_CountFrozenText, Localize("Count Frozen Tees"), g_Config.m_ClShowFrozenText == 2, &CheckBoxRect2)) - { g_Config.m_ClShowFrozenText = g_Config.m_ClShowFrozenText != 2 ? 2 : 1; - } } } - MainView.HSplitTop(5.0f, 0x0, &MainView); - - // ***** MISCELLANEOUS ***** // - MainView.VSplitLeft(-5.0f, 0x0, &MainView); - MainView.HSplitTop(30.0f, &Section, &MainView); - Ui()->DoLabel(&Section, ("Miscellaneous"), 20.0f, TEXTALIGN_LEFT); - MainView.VSplitLeft(5.0f, 0x0, &MainView); - MainView.HSplitTop(5.0f, 0x0, &MainView); + LeftView.HSplitTop(MarginSmall, nullptr, &LeftView); + LeftView.HSplitTop(HeadlineHeight, &Label, &LeftView); + Ui()->DoLabel(&Label, Localize("Player Indicator"), HeadlineFontSize, TEXTALIGN_ML); + LeftView.HSplitTop(MarginSmall, nullptr, &LeftView); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRunOnJoinConsole, ("Run cl_run_on_join as console command"), &g_Config.m_ClRunOnJoinConsole, &MainView, LineMargin); - if(g_Config.m_ClRunOnJoinConsole) + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClPlayerIndicator, Localize("Show any enabled Indicators"), &g_Config.m_ClPlayerIndicator, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClPlayerIndicatorFreeze, Localize("Show only freeze Players"), &g_Config.m_ClPlayerIndicatorFreeze, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClIndicatorTeamOnly, Localize("Only show after joining a team"), &g_Config.m_ClIndicatorTeamOnly, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClIndicatorTees, Localize("Render tiny tees instead of circles"), &g_Config.m_ClIndicatorTees, &LeftView, LineSize); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClIndicatorRadius, &g_Config.m_ClIndicatorRadius, &Button, Localize("Indicator size"), 1, 16); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClIndicatorOpacity, &g_Config.m_ClIndicatorOpacity, &Button, Localize("Indicator opacity"), 0, 100); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClIndicatorVariableDistance, Localize("Change indicator offset based on distance to other tees"), &g_Config.m_ClIndicatorVariableDistance, &LeftView, LineSize); + if(g_Config.m_ClIndicatorVariableDistance) { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(150.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %ims", "Delay", g_Config.m_ClRunOnJoinDelay * 20); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - int Delay = (int)(Ui()->DoScrollbarH(&g_Config.m_ClRunOnJoinDelay, &Button, (g_Config.m_ClRunOnJoinDelay - 7) / 93.0f) * 93.0f) + 7; - if(Delay < 100 || g_Config.m_ClRunOnJoinDelay <= 100) - { - g_Config.m_ClRunOnJoinDelay = Delay; - } + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClIndicatorOffset, &g_Config.m_ClIndicatorOffset, &Button, Localize("Indicator min offset"), 16, 200); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClIndicatorOffsetMax, &g_Config.m_ClIndicatorOffsetMax, &Button, Localize("Indicator max offset"), 16, 200); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + int Value = g_Config.m_ClIndicatorMaxDistance * 50; + Ui()->DoScrollbarOption(&g_Config.m_ClIndicatorMaxDistance, &Value, &Button, Localize("Indicator max distance"), 500, 7000); + g_Config.m_ClIndicatorMaxDistance = Value / 50; } - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFreezeUpdateFix, ("Update tee skin faster after being frozen"), &g_Config.m_ClFreezeUpdateFix, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowCenterLines, ("Show screen center"), &g_Config.m_ClShowCenterLines, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClPingNameCircle, ("Show ping colored circle before names"), &g_Config.m_ClPingNameCircle, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClWhiteFeet, ("Render all custom colored feet as white feet skin"), &g_Config.m_ClWhiteFeet, &MainView, LineMargin); - if(g_Config.m_ClWhiteFeet) + else { - CUIRect FeetBox; - MainView.HSplitTop(18, &FeetBox, &MainView); - FeetBox.VSplitMid(&FeetBox, 0); - static CLineInput s_WhiteFeet(g_Config.m_ClWhiteFeetSkin, sizeof(g_Config.m_ClWhiteFeetSkin)); - s_WhiteFeet.SetEmptyText("x_ninja"); - Ui()->DoEditBox(&s_WhiteFeet, &FeetBox, 12.0f); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClIndicatorOffset, &g_Config.m_ClIndicatorOffset, &Button, Localize("Indicator offset"), 16, 200); + LeftView.HSplitTop(LineSize * 2, nullptr, &LeftView); } + static CButtonContainer IndicatorAliveColorID, IndicatorDeadColorID, IndicatorSavedColorID; + DoLine_ColorPicker(&IndicatorAliveColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator alive color"), &g_Config.m_ClIndicatorAlive, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&IndicatorDeadColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator dead color"), &g_Config.m_ClIndicatorFreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&IndicatorSavedColorID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &LeftView, Localize("Indicator save color"), &g_Config.m_ClIndicatorSaved, ColorRGBA(0.0f, 0.0f, 0.0f), false); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClMiniDebug, ("Show Position and angle (Mini debug)"), &g_Config.m_ClMiniDebug, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClNotifyWhenLast, ("Show when you are last"), &g_Config.m_ClNotifyWhenLast, &MainView, LineMargin); - if(g_Config.m_ClNotifyWhenLast) - { - // create a text box for notification text - CUIRect Button; - static CButtonContainer NotifyWhenLastTextID; - MainView.HSplitTop(5.0f, 0, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - - Button.VSplitLeft(150.0f, &Button, 0); - - static CLineInput s_LastInput(g_Config.m_ClNotifyWhenLastText, sizeof(g_Config.m_ClNotifyWhenLastText)); - s_LastInput.SetEmptyText(Localize("Last!")); - - Ui()->DoEditBox(&s_LastInput, &Button, 12.0f); - MainView.HSplitTop(20.0f, &Section, &MainView); - DoLine_ColorPicker(&NotifyWhenLastTextID, 22.0f, 13.0f, 14.0f, &Section, ("Notification Color"), &g_Config.m_ClNotifyWhenLastColor, ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f), false); - } - CUIRect ButtonVerify, EnableVerifySection; - MainView.HSplitTop(LineMargin, &EnableVerifySection, &MainView); - EnableVerifySection.VSplitMid(&EnableVerifySection, &ButtonVerify); + LeftView.HSplitTop(MarginSmall, nullptr, &LeftView); + LeftView.HSplitTop(HeadlineHeight, &Label, &LeftView); + Ui()->DoLabel(&Label, Localize("Anti Latency Tools"), HeadlineFontSize, TEXTALIGN_ML); + LeftView.HSplitTop(MarginSmall, nullptr, &LeftView); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClAutoVerify, ("Auto Verify"), &g_Config.m_ClAutoVerify, &EnableVerifySection, LineMargin); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClPredictionMargin, &g_Config.m_ClPredictionMargin, &Button, Localize("Prediction Margin"), 10, 25, &CUi::ms_LinearScrollbarScale, 0, "ms"); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRemoveAnti, Localize("Remove prediction & antiping in freeze"), &g_Config.m_ClRemoveAnti, &LeftView, LineSize); + if(g_Config.m_ClRemoveAnti) { - static CButtonContainer s_VerifyButton; - if(DoButton_Menu(&s_VerifyButton, Localize("Manual Verify"), 0, &ButtonVerify, 0, IGraphics::CORNER_ALL)) - { - if(!open_link("https://ger10.ddnet.org/")) - { - dbg_msg("menus", "couldn't open link"); - } - } + static int ValueUnfreezeLagTicks, ValueUnfreezeLagDelayTicks; + ValueUnfreezeLagTicks = g_Config.m_ClUnfreezeLagTicks * 20; + ValueUnfreezeLagDelayTicks = g_Config.m_ClUnfreezeLagDelayTicks * 20; + if(ValueUnfreezeLagDelayTicks < ValueUnfreezeLagTicks) + ValueUnfreezeLagDelayTicks = ValueUnfreezeLagTicks; + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClUnfreezeLagTicks, &ValueUnfreezeLagTicks, &Button, Localize("Amount"), 100, 300, &CUi::ms_LinearScrollbarScale, 0, "ms"); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + Ui()->DoScrollbarOption(&g_Config.m_ClUnfreezeLagDelayTicks, &ValueUnfreezeLagDelayTicks, &Button, Localize("Delay"), 100, 3000, &CUi::ms_LinearScrollbarScale, 0, "ms"); + g_Config.m_ClUnfreezeLagTicks = ValueUnfreezeLagTicks / 20; + g_Config.m_ClUnfreezeLagDelayTicks = ValueUnfreezeLagDelayTicks / 20; } + else + LeftView.HSplitTop(LineSize * 2, nullptr, &LeftView); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClUnpredOthersInFreeze, Localize("Dont predict other players if you are frozen"), &g_Config.m_ClUnpredOthersInFreeze, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClPredMarginInFreeze, Localize("Adjust your prediction margin while frozen"), &g_Config.m_ClPredMarginInFreeze, &LeftView, LineSize); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + if(g_Config.m_ClPredMarginInFreeze) + Ui()->DoScrollbarOption(&g_Config.m_ClPredMarginInFreezeAmount, &g_Config.m_ClPredMarginInFreezeAmount, &Button, Localize("Frozen Margin"), 0, 100, &CUi::ms_LinearScrollbarScale, 0, "ms"); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderCursorSpec, ("Show your cursor when in free spectate"), &g_Config.m_ClRenderCursorSpec, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowSkinName, ("Show skin names in nameplate"), &g_Config.m_ClShowSkinName, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFreezeStars, ("Freeze Stars"), &g_Config.m_ClFreezeStars, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClColorFreeze, ("Color Frozen Tee Skins"), &g_Config.m_ClColorFreeze, &MainView, LineMargin); - - //{ - // CUIRect Button, Label; - // MainView.HSplitTop(20.0f, &Button, &MainView); - // Button.VSplitLeft(150.0f, &Label, &Button); - // char aBuf[64]; - // str_format(aBuf, sizeof(aBuf), "%s: %i ", "Hook Line Width", g_Config.m_ClHookCollSize); - // Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - // g_Config.m_ClHookCollSize = (int)(Ui()->DoScrollbarH(&g_Config.m_ClHookCollSize, &Button, g_Config.m_ClHookCollSize / 20.0f) * 20.0f); - //} - - MainView.HSplitTop(10.0f, 0x0, &MainView); - - // ***** OUTLINES ***** // - - MainView = Column; - - MainView.HSplitTop(30.0f, &Section, &MainView); - Ui()->DoLabel(&Section, Localize("Tile Outlines"), 20.0f, TEXTALIGN_LEFT); - MainView.VSplitLeft(5.0f, 0x0, &MainView); - MainView.HSplitTop(5.0f, 0x0, &MainView); + // ***** RightView ***** // - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutline, ("Show any enabled outlines"), &g_Config.m_ClOutline, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineEntities, ("Only show outlines in entities"), &g_Config.m_ClOutlineEntities, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineFreeze, ("Outline freeze & deep"), &g_Config.m_ClOutlineFreeze, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineSolid, ("Outline walls"), &g_Config.m_ClOutlineSolid, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineTele, ("Outline teleporter"), &g_Config.m_ClOutlineTele, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineUnFreeze, ("Outline unfreeze & undeep"), &g_Config.m_ClOutlineUnFreeze, &MainView, LineMargin); + RightView.HSplitTop(HeadlineHeight, &Label, &RightView); + Ui()->DoLabel(&Label, Localize("Tile Outlines"), HeadlineFontSize, TEXTALIGN_ML); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); - { - CUIRect Button, Label; - MainView.HSplitTop(5.0f, &Button, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(150.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Outline Width", g_Config.m_ClOutlineWidth); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClOutlineWidth = (int)(Ui()->DoScrollbarH(&g_Config.m_ClOutlineWidth, &Button, (g_Config.m_ClOutlineWidth - 1) / 15.0f) * 15.0f) + 1; - } - { - CUIRect Button, Label; - MainView.HSplitTop(5.0f, &Button, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(150.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Outline Alpha", g_Config.m_ClOutlineAlpha); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClOutlineAlpha = (int)(Ui()->DoScrollbarH(&g_Config.m_ClOutlineAlpha, &Button, (g_Config.m_ClOutlineAlpha) / 100.0f) * 100.0f); - } - { - CUIRect Button, Label; - MainView.HSplitTop(5.0f, &Button, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(185.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Outline Alpha (walls)", g_Config.m_ClOutlineAlphaSolid); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClOutlineAlphaSolid = (int)(Ui()->DoScrollbarH(&g_Config.m_ClOutlineAlphaSolid, &Button, (g_Config.m_ClOutlineAlphaSolid) / 100.0f) * 100.0f); - } + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutline, Localize("Show any enabled outlines"), &g_Config.m_ClOutline, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineEntities, Localize("Only show outlines in entities"), &g_Config.m_ClOutlineEntities, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineFreeze, Localize("Outline freeze & deep"), &g_Config.m_ClOutlineFreeze, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineSolid, Localize("Outline walls"), &g_Config.m_ClOutlineSolid, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineTele, Localize("Outline teleporter"), &g_Config.m_ClOutlineTele, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOutlineUnFreeze, Localize("Outline unfreeze & undeep"), &g_Config.m_ClOutlineUnFreeze, &RightView, LineSize); + RightView.HSplitTop(LineSize, &Button, &RightView); + Ui()->DoScrollbarOption(&g_Config.m_ClOutlineWidth, &g_Config.m_ClOutlineWidth, &Button, Localize("Outline Width"), 1, 16); + RightView.HSplitTop(LineSize, &Button, &RightView); + Ui()->DoScrollbarOption(&g_Config.m_ClOutlineAlpha, &g_Config.m_ClOutlineAlpha, &Button, Localize("Outline Alpha"), 0, 100); + RightView.HSplitTop(LineSize, &Button, &RightView); + Ui()->DoScrollbarOption(&g_Config.m_ClOutlineAlphaSolid, &g_Config.m_ClOutlineAlphaSolid, &Button, Localize("Outline Alpha (walls)"), 0, 100); static CButtonContainer OutlineColorFreezeID, OutlineColorSolidID, OutlineColorTeleID, OutlineColorUnfreezeID; + DoLine_ColorPicker(&OutlineColorFreezeID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Freeze Outline Color"), &g_Config.m_ClOutlineColorFreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&OutlineColorSolidID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Walls Outline Color"), &g_Config.m_ClOutlineColorSolid, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&OutlineColorTeleID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Teleporter Outline Color"), &g_Config.m_ClOutlineColorTele, ColorRGBA(0.0f, 0.0f, 0.0f), false); + DoLine_ColorPicker(&OutlineColorUnfreezeID, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &RightView, Localize("Unfreeze Outline Color"), &g_Config.m_ClOutlineColorUnfreeze, ColorRGBA(0.0f, 0.0f, 0.0f), false); - MainView.HSplitTop(5.0f, 0x0, &MainView); - MainView.VSplitLeft(-5.0f, 0x0, &MainView); - - MainView.HSplitTop(25.0f, &Section, &MainView); - DoLine_ColorPicker(&OutlineColorFreezeID, 25.0f, 13.0f, 5.0f, &Section, ("Freeze Outline Color"), &g_Config.m_ClOutlineColorFreeze, ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f), false); - - MainView.HSplitTop(25.0f, &Section, &MainView); - DoLine_ColorPicker(&OutlineColorSolidID, 25.0f, 13.0f, 5.0f, &Section, ("Walls Outline Color"), &g_Config.m_ClOutlineColorSolid, ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f), false); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); + RightView.HSplitTop(HeadlineHeight, &Label, &RightView); + Ui()->DoLabel(&Label, Localize("Input"), HeadlineFontSize, TEXTALIGN_ML); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); - MainView.HSplitTop(25.0f, &Section, &MainView); - DoLine_ColorPicker(&OutlineColorTeleID, 25.0f, 13.0f, 5.0f, &Section, ("Teleporter Outline Color"), &g_Config.m_ClOutlineColorTele, ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f), false); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFastInput, Localize("Fast Inputs (-20ms visual input delay)"), &g_Config.m_ClFastInput, &RightView, LineSize); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); + if(g_Config.m_ClFastInput) + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFastInputOthers, Localize("Extra tick other tees (increases other tees visual latency, \nmakes dragging slightly easier when using fast input)"), &g_Config.m_ClFastInputOthers, &RightView, LineSize); + else + RightView.HSplitTop(LineSize, nullptr, &RightView); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOldMouseZoom, Localize("Old Mouse Precision (fixes precision at low zoom levels, \nbreaks /tc, /telecursor while zoomed)"), &g_Config.m_ClOldMouseZoom, &RightView, LineSize); - MainView.HSplitTop(25.0f, &Section, &MainView); - DoLine_ColorPicker(&OutlineColorUnfreezeID, 25.0f, 13.0f, 5.0f, &Section, ("Unfreeze Outline Color"), &g_Config.m_ClOutlineColorUnfreeze, ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f), false); - - MainView.HSplitTop(5.0f, 0x0, &MainView); - MainView.HSplitTop(30.0f, &Section, &MainView); - Ui()->DoLabel(&Section, Localize("Input"), 20.0f, TEXTALIGN_LEFT); - MainView.VSplitLeft(5.0f, 0x0, &MainView); - MainView.HSplitTop(5.0f, 0x0, &MainView); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); + RightView.HSplitTop(HeadlineHeight, &Label, &RightView); + Ui()->DoLabel(&Label, Localize("Ghost Tools"), HeadlineFontSize, TEXTALIGN_ML); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFastInput, ("Fast Inputs (-20ms visual input delay)"), &g_Config.m_ClFastInput, &MainView, LineMargin); - if(g_Config.m_ClFastInput) - { - MainView.HSplitTop(10.0f, 0x0, &MainView); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFastInputOthers, ("Extra tick other tees (increases other tees visual latency, \nmakes dragging slightly easier when using fast input)"), &g_Config.m_ClFastInputOthers, &MainView, LineMargin); - } - MainView.HSplitTop(15.0f, 0x0, &MainView); - MainView.HSplitTop(10.0f, 0x0, &MainView); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClOldMouseZoom, ("Old Mouse Precision (fixes precision at low zoom levels, \nbreaks /tc, /telecursor while zoomed)"), &g_Config.m_ClOldMouseZoom, &MainView, LineMargin); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowOthersGhosts, Localize("Show unpredicted ghosts for other players"), &g_Config.m_ClShowOthersGhosts, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClSwapGhosts, Localize("Swap ghosts and normal players"), &g_Config.m_ClSwapGhosts, &RightView, LineSize); + RightView.HSplitTop(LineSize, &Button, &RightView); + Ui()->DoScrollbarOption(&g_Config.m_ClPredGhostsAlpha, &g_Config.m_ClPredGhostsAlpha, &Button, Localize("Predicted Alpha"), 0, 100, &CUi::ms_LinearScrollbarScale, 0, "%"); + RightView.HSplitTop(LineSize, &Button, &RightView); + Ui()->DoScrollbarOption(&g_Config.m_ClUnpredGhostsAlpha, &g_Config.m_ClUnpredGhostsAlpha, &Button, Localize("Unpredicted Alpha"), 0, 100, &CUi::ms_LinearScrollbarScale, 0, "%"); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClHideFrozenGhosts, Localize("Hide ghosts of frozen players"), &g_Config.m_ClHideFrozenGhosts, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderGhostAsCircle, Localize("Render ghosts as circles"), &g_Config.m_ClRenderGhostAsCircle, &RightView, LineSize); + static CKeyInfo Key = CKeyInfo{"Toggle Ghosts Key", "toggle tc_show_others_ghosts 0 1", 0, 0}; + Key.m_ModifierCombination = Key.m_KeyId = 0; + for(int Mod = 0; Mod < CBinds::MODIFIER_COMBINATION_COUNT; Mod++) { - CUIRect Button; - CUIRect ExtMenu; - MainView.VSplitLeft(0, 0, &ExtMenu); - ExtMenu.VSplitRight(130.0f, 0, &ExtMenu); - ExtMenu.HSplitBottom(25.0f, &ExtMenu, &Button); - static CButtonContainer s_DiscordButton; - if(DoButton_Menu(&s_DiscordButton, Localize("Discord"), 0, &Button, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, vec4(0.0f, 0.0f, 0.0f, 0.5f))) + for(int KeyId = 0; KeyId < KEY_LAST; KeyId++) { - if(!open_link("https://discord.gg/fBvhH93Bt6")) + const char *pBind = m_pClient->m_Binds.Get(KeyId, Mod); + if(!pBind[0]) + continue; + + if(str_comp(pBind, Key.m_pCommand) == 0) { - dbg_msg("menus", "couldn't open link"); + Key.m_KeyId = KeyId; + Key.m_ModifierCombination = Mod; + break; } } } - } - // ***** PAGE 2 ***** // - - if(s_CurCustomTab == TCLIENT_TAB_PAGE2) - { - MainView.VSplitLeft(MainView.w * 0.5, &MainView, &Column); - - MainView.HSplitTop(30.0f, &Section, &MainView); - Ui()->DoLabel(&Section, ("Player Indicator"), 20.0f, TEXTALIGN_LEFT); - MainView.VSplitLeft(5.0f, 0x0, &MainView); - MainView.HSplitTop(5.0f, 0x0, &MainView); - - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClPlayerIndicator, ("Show any enabled Indicators"), &g_Config.m_ClPlayerIndicator, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClPlayerIndicatorFreeze, ("Show only freeze Players"), &g_Config.m_ClPlayerIndicatorFreeze, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClIndicatorTeamOnly, ("Only show after joining a team"), &g_Config.m_ClIndicatorTeamOnly, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClIndicatorTees, ("Render tiny tees instead of circles"), &g_Config.m_ClIndicatorTees, &MainView, LineMargin); - - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClIndicatorVariableDistance, ("Change indicator offset based on distance to other tees"), &g_Config.m_ClIndicatorVariableDistance, &MainView, LineMargin); - - static CButtonContainer IndicatorAliveColorID, IndicatorDeadColorID, IndicatorSavedColorID; - - MainView.HSplitTop(5.0f, 0x0, &MainView); - MainView.VSplitLeft(-5.0f, 0x0, &MainView); - - MainView.HSplitTop(25.0f, &Section, &MainView); - DoLine_ColorPicker(&IndicatorAliveColorID, 25.0f, 13.0f, 5.0f, &Section, ("Indicator alive color"), &g_Config.m_ClIndicatorAlive, ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f), false); - - MainView.HSplitTop(25.0f, &Section, &MainView); - DoLine_ColorPicker(&IndicatorDeadColorID, 25.0f, 13.0f, 5.0f, &Section, ("Indicator dead color"), &g_Config.m_ClIndicatorFreeze, ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f), false); - MainView.HSplitTop(25.0f, &Section, &MainView); - DoLine_ColorPicker(&IndicatorSavedColorID, 25.0f, 13.0f, 5.0f, &Section, ("Indicator save color"), &g_Config.m_ClIndicatorSaved, ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f), false); - - { - CUIRect Button, Label; - MainView.HSplitTop(5.0f, &Button, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(150.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Indicator size", g_Config.m_ClIndicatorRadius); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClIndicatorRadius = (int)(Ui()->DoScrollbarH(&g_Config.m_ClIndicatorRadius, &Button, (g_Config.m_ClIndicatorRadius - 1) / 15.0f) * 15.0f) + 1; - } - { - CUIRect Button, Label; - MainView.HSplitTop(5.0f, &Button, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(150.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Indicator opacity", g_Config.m_ClIndicatorOpacity); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClIndicatorOpacity = (int)(Ui()->DoScrollbarH(&g_Config.m_ClIndicatorOpacity, &Button, (g_Config.m_ClIndicatorOpacity) / 100.0f) * 100.0f); - } - { - CUIRect Button, Label; - MainView.HSplitTop(5.0f, &Button, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(150.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Indicator offset", g_Config.m_ClIndicatorOffset); - if(g_Config.m_ClIndicatorVariableDistance) - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Min offset", g_Config.m_ClIndicatorOffset); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClIndicatorOffset = (int)(Ui()->DoScrollbarH(&g_Config.m_ClIndicatorOffset, &Button, (g_Config.m_ClIndicatorOffset - 16) / 184.0f) * 184.0f) + 16; - } - if(g_Config.m_ClIndicatorVariableDistance) - { - CUIRect Button, Label; - MainView.HSplitTop(5.0f, &Button, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(150.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Max offset", g_Config.m_ClIndicatorOffsetMax); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClIndicatorOffsetMax = (int)(Ui()->DoScrollbarH(&g_Config.m_ClIndicatorOffsetMax, &Button, (g_Config.m_ClIndicatorOffsetMax - 16) / 184.0f) * 184.0f) + 16; - } - if(g_Config.m_ClIndicatorVariableDistance) + CUIRect KeyButton, KeyLabel; + RightView.HSplitTop(LineSize, &KeyButton, &RightView); + KeyButton.VSplitMid(&KeyLabel, &KeyButton); + char aBuf[64]; + str_format(aBuf, sizeof(aBuf), "%s:", Localize(Key.m_pName)); + Ui()->DoLabel(&KeyLabel, aBuf, 12.0f, TEXTALIGN_ML); + int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination; + int NewId = DoKeyReader(&Key, &KeyButton, OldId, OldModifierCombination, &NewModifierCombination); + if(NewId != OldId || NewModifierCombination != OldModifierCombination) { - CUIRect Button, Label; - MainView.HSplitTop(5.0f, &Button, &MainView); - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(150.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i ", "Max distance", g_Config.m_ClIndicatorMaxDistance); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - int NewValue = (g_Config.m_ClIndicatorMaxDistance) / 50.0f; - NewValue = (int)(Ui()->DoScrollbarH(&g_Config.m_ClIndicatorMaxDistance, &Button, (NewValue - 10) / 130.0f) * 130.0f) + 10; - g_Config.m_ClIndicatorMaxDistance = NewValue * 50; + if(OldId != 0 || NewId == 0) + m_pClient->m_Binds.Bind(OldId, "", false, OldModifierCombination); + if(NewId != 0) + m_pClient->m_Binds.Bind(NewId, Key.m_pCommand, false, NewModifierCombination); } - MainView.HSplitTop(10.0f, 0x0, &MainView); - - MainView = Column; - - MainView.HSplitTop(30.0f, &Section, &MainView); - Ui()->DoLabel(&Section, Localize("Miscellaneous 2.0"), 20.0f, TEXTALIGN_LEFT); - MainView.VSplitLeft(5.0f, 0x0, &MainView); - MainView.HSplitTop(5.0f, 0x0, &MainView); - - // checkbox for hiding nameplates - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderNameplateSpec, ("Hide nameplates in spec"), &g_Config.m_ClRenderNameplateSpec, &MainView, LineMargin); - - // create dropdown for rainbow modes + RightView.HSplitTop(MarginSmall, nullptr, &RightView); + RightView.HSplitTop(HeadlineHeight, &Label, &RightView); + Ui()->DoLabel(&Label, Localize("Rainbow"), HeadlineFontSize, TEXTALIGN_ML); + RightView.HSplitTop(MarginSmall, nullptr, &RightView); static std::vector s_DropDownNames = {Localize("Rainbow"), Localize("Pulse"), Localize("Black")}; - static CUi::SDropDownState s_RainbowDropDownState; static CScrollRegion s_RainbowDropDownScrollRegion; s_RainbowDropDownState.m_SelectionPopupContext.m_pScrollRegion = &s_RainbowDropDownScrollRegion; - - int OldSelected = g_Config.m_ClRainbowMode - 1; - - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRainbow, ("Rainbow"), &g_Config.m_ClRainbow, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRainbowOthers, ("Rainbow Others"), &g_Config.m_ClRainbowOthers, &MainView, LineMargin); + int RainbowSelectedOld = g_Config.m_ClRainbowMode - 1; + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRainbow, Localize("Rainbow"), &g_Config.m_ClRainbow, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRainbowOthers, Localize("Rainbow Others"), &g_Config.m_ClRainbowOthers, &RightView, LineSize); CUIRect DropDownRect; - MainView.HSplitTop(20.0f, &DropDownRect, &MainView); - - const int NewRainbowMode = Ui()->DoDropDown(&DropDownRect, OldSelected, s_DropDownNames.data(), s_DropDownNames.size(), s_RainbowDropDownState); - - if(OldSelected != NewRainbowMode) + RightView.HSplitTop(LineSize, &DropDownRect, &RightView); + const int RainbowSelectedNew = Ui()->DoDropDown(&DropDownRect, RainbowSelectedOld, s_DropDownNames.data(), s_DropDownNames.size(), s_RainbowDropDownState); + if(RainbowSelectedOld != RainbowSelectedNew) { - g_Config.m_ClRainbowMode = NewRainbowMode + 1; - OldSelected = NewRainbowMode; + g_Config.m_ClRainbowMode = RainbowSelectedNew + 1; + RainbowSelectedOld = RainbowSelectedNew; dbg_msg("rainbow", "rainbow mode changed to %d", g_Config.m_ClRainbowMode); } - // ***** ANTI LATENCY ***** // - MainView.HSplitTop(10.0f, 0, &MainView); + // ***** Miscellaneous ***** // - MainView.HSplitTop(30.0f, &Section, &MainView); - Ui()->DoLabel(&Section, ("Anti Latency Tools"), 20.0f, TEXTALIGN_LEFT); - MainView.VSplitLeft(15.0f, 0, &MainView); + // A bit jank, but it works + MainView.y = maximum(LeftView.y, RightView.y) + MarginSmall; - MainView.HSplitTop(5.0f, 0, &MainView); - { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(165.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %ims", "Prediction Margin", g_Config.m_ClPredictionMargin); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - int PredictionMargin = (int)(Ui()->DoScrollbarH(&g_Config.m_ClPredictionMargin, &Button, (g_Config.m_ClPredictionMargin - 10) / 15.0f) * 15.0f) + 10; - if((PredictionMargin < 25 || g_Config.m_ClPredictionMargin <= 25) && g_Config.m_ClPredictionMargin >= 10) - { - g_Config.m_ClPredictionMargin = PredictionMargin; - } - } - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRemoveAnti, ("Remove prediction & antiping in freeze"), &g_Config.m_ClRemoveAnti, &MainView, LineMargin); - if(g_Config.m_ClRemoveAnti) - { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(115.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %ims", "Delay", g_Config.m_ClUnfreezeLagDelayTicks * 20); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClUnfreezeLagDelayTicks = (int)(Ui()->DoScrollbarH(&g_Config.m_ClUnfreezeLagDelayTicks, &Button, (g_Config.m_ClUnfreezeLagDelayTicks) / 150.0f) * 150.0f); - g_Config.m_ClUnfreezeLagDelayTicks = std::max(g_Config.m_ClUnfreezeLagDelayTicks, g_Config.m_ClUnfreezeLagTicks); - } - if(g_Config.m_ClRemoveAnti) - { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(200.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %ims", "Amount", g_Config.m_ClUnfreezeLagTicks * 20); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClUnfreezeLagTicks = (int)(Ui()->DoScrollbarH(&g_Config.m_ClUnfreezeLagTicks, &Button, (g_Config.m_ClUnfreezeLagTicks) / 15.0f) * 15.0f); - } - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClUnpredOthersInFreeze, ("Dont predict other players if you are frozen"), &g_Config.m_ClUnpredOthersInFreeze, &MainView, LineMargin); - - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClPredMarginInFreeze, ("Adjust your prediction margin while frozen"), &g_Config.m_ClPredMarginInFreeze, &MainView, LineMargin); - if(g_Config.m_ClPredMarginInFreeze) - { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(125.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %ims", "Frozen Margin", g_Config.m_ClPredMarginInFreezeAmount); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClPredMarginInFreezeAmount = (int)(Ui()->DoScrollbarH(&g_Config.m_ClPredMarginInFreezeAmount, &Button, (g_Config.m_ClPredMarginInFreezeAmount) / 100.0f) * 100.0f); - } + MainView.HSplitTop(HeadlineHeight, &Label, &MainView); + Ui()->DoLabel(&Label, Localize("Miscellaneous"), HeadlineFontSize, TEXTALIGN_MIDDLE); + MainView.HSplitTop(MarginSmall, nullptr, &MainView); + MainView.VSplitMid(&LeftView, &RightView, MarginBetweenViews); - //MainView.HSplitTop(10.0f, 0, &MainView); - MainView.HSplitTop(30.0f, &Section, &MainView); - Ui()->DoLabel(&Section, ("Ghost Tools"), 18, TEXTALIGN_LEFT); + // ***** Miscellaneous Left ***** // - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowOthersGhosts, ("Show unpredicted ghosts for other players"), &g_Config.m_ClShowOthersGhosts, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClSwapGhosts, ("Swap ghosts and normal players"), &g_Config.m_ClSwapGhosts, &MainView, LineMargin); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRunOnJoinConsole, Localize("Run cl_run_on_join as console command"), &g_Config.m_ClRunOnJoinConsole, &LeftView, LineSize); + LeftView.HSplitTop(LineSize, &Button, &LeftView); + if(g_Config.m_ClRunOnJoinConsole) { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(200.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i%%", "Predicted Alpha", g_Config.m_ClPredGhostsAlpha); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClPredGhostsAlpha = (int)(Ui()->DoScrollbarH(&g_Config.m_ClPredGhostsAlpha, &Button, (g_Config.m_ClPredGhostsAlpha) / 100.0f) * 100.0f); - } + static int Value; + Value = g_Config.m_ClRunOnJoinDelay * 20; + Ui()->DoScrollbarOption(&g_Config.m_ClRunOnJoinDelay, &Value, &Button, Localize("Delay"), 140, 2000, &CUi::ms_LinearScrollbarScale, 0, "ms"); + Value /= 20; + // Only set if the scroll value or already set is under psuedo-max of 100 (200ms) + if(Value < 100 || g_Config.m_ClRunOnJoinDelay < 100) + g_Config.m_ClRunOnJoinDelay = Value; + } + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFreezeUpdateFix, Localize("Update tee skin faster after being frozen"), &g_Config.m_ClFreezeUpdateFix, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowCenterLines, Localize("Show screen center"), &g_Config.m_ClShowCenterLines, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClPingNameCircle, Localize("Show ping colored circle before names"), &g_Config.m_ClPingNameCircle, &LeftView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClMiniDebug, Localize("Show Position and angle (Mini debug)"), &g_Config.m_ClMiniDebug, &LeftView, LineSize); + + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClNotifyWhenLast, Localize("Show when you are the last alive"), &g_Config.m_ClNotifyWhenLast, &LeftView, LineSize); + CUIRect NotificationConfig; + LeftView.HSplitTop(LineSize, &NotificationConfig, &LeftView); + if(g_Config.m_ClNotifyWhenLast) { - CUIRect Button, Label; - MainView.HSplitTop(20.0f, &Button, &MainView); - Button.VSplitLeft(200.0f, &Label, &Button); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s: %i%%", "Unpredicted Alpha", g_Config.m_ClUnpredGhostsAlpha); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); - g_Config.m_ClUnpredGhostsAlpha = (int)(Ui()->DoScrollbarH(&g_Config.m_ClUnpredGhostsAlpha, &Button, (g_Config.m_ClUnpredGhostsAlpha) / 100.0f) * 100.0f); + NotificationConfig.VSplitMid(&Button, &NotificationConfig); + static CLineInput s_LastInput(g_Config.m_ClNotifyWhenLastText, sizeof(g_Config.m_ClNotifyWhenLastText)); + s_LastInput.SetEmptyText(Localize("Last Alive!")); + Ui()->DoEditBox(&s_LastInput, &Button, 12.0f); + static CButtonContainer s_ClientNotifyWhenLastColor; + DoLine_ColorPicker(&s_ClientNotifyWhenLastColor, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &NotificationConfig, "", &g_Config.m_ClNotifyWhenLastColor, ColorRGBA(1.0f, 1.0f, 1.0f), false); } - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClHideFrozenGhosts, ("Hide ghosts of frozen players"), &g_Config.m_ClHideFrozenGhosts, &MainView, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderGhostAsCircle, ("Render ghosts as circles"), &g_Config.m_ClRenderGhostAsCircle, &MainView, LineMargin); - CKeyInfo Key = CKeyInfo{"Toggle Ghosts Key", "toggle tc_show_others_ghosts 0 1", 0, 0}; - for(int Mod = 0; Mod < CBinds::MODIFIER_COMBINATION_COUNT; Mod++) - { - for(int KeyId = 0; KeyId < KEY_LAST; KeyId++) - { - const char *pBind = m_pClient->m_Binds.Get(KeyId, Mod); - if(!pBind[0]) - continue; + // ***** Miscellaneous Right ***** // - if(str_comp(pBind, Key.m_pCommand) == 0) - { - Key.m_KeyId = KeyId; - Key.m_ModifierCombination = Mod; - break; - } - } + CUIRect ButtonVerify, EnableVerifySection; + RightView.HSplitTop(LineSize, &EnableVerifySection, &RightView); + EnableVerifySection.VSplitMid(&EnableVerifySection, &ButtonVerify); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClAutoVerify, Localize("Auto Verify"), &g_Config.m_ClAutoVerify, &EnableVerifySection, LineSize); + static CButtonContainer s_VerifyButton; + if(DoButton_Menu(&s_VerifyButton, Localize("Manual Verify"), 0, &ButtonVerify, 0, IGraphics::CORNER_ALL)) + { + if(!open_link("https://ger10.ddnet.org/")) + dbg_msg("menus", "couldn't open link"); } - CUIRect Button, KeyLabel; - MainView.HSplitTop(20.0f, &MainView, &Button); - Button.HSplitTop(20.0f, &Button, 0); - Button.VSplitLeft(120.0f, &KeyLabel, &Button); - Button.VSplitLeft(100, &Button, 0); - char aBuf[64]; - str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_pName)); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClHammerRotatesWithCursor, Localize("Make hammer rotate with cursor"), &g_Config.m_ClHammerRotatesWithCursor, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderNameplateSpec, Localize("Hide nameplates in spec"), &g_Config.m_ClRenderNameplateSpec, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClRenderCursorSpec, Localize("Show your cursor when in free spectate"), &g_Config.m_ClRenderCursorSpec, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowSkinName, Localize("Show skin names in nameplate"), &g_Config.m_ClShowSkinName, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClFreezeStars, Localize("Freeze Stars"), &g_Config.m_ClFreezeStars, &RightView, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClColorFreeze, Localize("Color Frozen Tee Skins"), &g_Config.m_ClColorFreeze, &RightView, LineSize); - Ui()->DoLabel(&KeyLabel, aBuf, 20.0f, TEXTALIGN_LEFT); - int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination; - int NewId = DoKeyReader((void *)&Key.m_pName, &Button, OldId, OldModifierCombination, &NewModifierCombination); - if(NewId != OldId || NewModifierCombination != OldModifierCombination) + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClWhiteFeet, Localize("Render all custom colored feet as white feet skin"), &g_Config.m_ClWhiteFeet, &RightView, LineSize); + CUIRect FeetBox; + RightView.HSplitTop(LineSize, &FeetBox, &RightView); + if(g_Config.m_ClWhiteFeet) { - if(OldId != 0 || NewId == 0) - m_pClient->m_Binds.Bind(OldId, "", false, OldModifierCombination); - if(NewId != 0) - m_pClient->m_Binds.Bind(NewId, Key.m_pCommand, false, NewModifierCombination); + FeetBox.VSplitMid(&FeetBox, nullptr); + static CLineInput s_WhiteFeet(g_Config.m_ClWhiteFeetSkin, sizeof(g_Config.m_ClWhiteFeetSkin)); + s_WhiteFeet.SetEmptyText("x_ninja"); + Ui()->DoEditBox(&s_WhiteFeet, &FeetBox, 12.0f); } - + // Scroll + CUIRect ScrollRegion; + ScrollRegion.x = MainView.x; + ScrollRegion.y = maximum(LeftView.y, RightView.y) + MarginSmall; + ScrollRegion.w = MainView.w; + ScrollRegion.h = 0.0f; + s_ScrollRegion.AddRect(ScrollRegion); + s_ScrollRegion.End(); } if(s_CurCustomTab == TCLIENT_TAB_BINDWHEEL) { + CUIRect Section; CUIRect Screen = *Ui()->Screen(); - MainView.VSplitLeft(MainView.w * 0.5, &MainView, &Column); + MainView.VSplitLeft(MainView.w * 0.5f, &MainView, &Column); CUIRect LeftColumn = MainView; MainView.HSplitTop(30.0f, &Section, &MainView); CUIRect buttons[NUM_BINDWHEEL]; char pD[NUM_BINDWHEEL][MAX_BINDWHEEL_DESC]; char pC[NUM_BINDWHEEL][MAX_BINDWHEEL_CMD]; - CUIRect Label; + + const float Radius = 190.0f; + vec2 Pos{Screen.w / 2.0f - 55.0f, Screen.h / 2.0f}; // Draw Circle Graphics()->TextureClear(); Graphics()->QuadsBegin(); - Graphics()->SetColor(0, 0, 0, 0.3f); - Graphics()->DrawCircle(Screen.w / 2 - 55.0f, Screen.h / 2, 190.0f, 64); + Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.3f); + Graphics()->DrawCircle(Pos.x, Pos.y, Radius, 64); Graphics()->QuadsEnd(); - Graphics()->WrapClamp(); for(int i = 0; i < NUM_BINDWHEEL; i++) { float Angle = 2 * pi * i / NUM_BINDWHEEL; - float margin = 120.0f; - - if(Angle > pi) - { - Angle -= 2 * pi; - } - - int orgAngle = 2 * pi * i / NUM_BINDWHEEL; - if(((orgAngle >= 0 && orgAngle < 2)) || ((orgAngle >= 4 && orgAngle < 6))) - { - margin = 170.0f; - } - float Size = 12.0f; - - float NudgeX = margin * cosf(Angle); - float NudgeY = 150.0f * sinf(Angle); - - char aBuf[MAX_BINDWHEEL_DESC]; - str_format(aBuf, sizeof(aBuf), "%s", GameClient()->m_Bindwheel.m_BindWheelList[i].description); - TextRender()->Text(Screen.w / 2 - 100.0f + NudgeX, Screen.h / 2 + NudgeY, Size, aBuf, -1.0f); + const char *pText = GameClient()->m_Bindwheel.m_BindWheelList[i].description; + const STextBoundingBox BoundingBox = TextRender()->TextBoundingBox(Size, pText); + vec2 TextPos; + TextPos.x = Pos.x + Radius * cosf(Angle) * 0.75f - BoundingBox.m_W / 2.0f; + TextPos.y = Pos.y + Radius * sinf(Angle) * 0.75f - BoundingBox.m_H / 2.0f; + TextRender()->Text(TextPos.x, TextPos.y, Size, pText); } - Graphics()->WrapNormal(); static CLineInput s_BindWheelDesc[NUM_BINDWHEEL]; static CLineInput s_BindWheelCmd[NUM_BINDWHEEL]; @@ -3785,10 +3612,10 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) if(i == NUM_BINDWHEEL / 2) { MainView = Column; - MainView.VSplitRight(500, 0, &MainView); + MainView.VSplitRight(500.0f, nullptr, &MainView); - MainView.HSplitTop(30.0f, &Section, &MainView); - MainView.VSplitLeft(MainView.w * 0.5, 0, &MainView); + MainView.HSplitTop(LineSize, &Section, &MainView); + MainView.VSplitLeft(MainView.w * 0.5f, nullptr, &MainView); } str_format(pD[i], sizeof(pD[i]), "%s", GameClient()->m_Bindwheel.m_BindWheelList[i].description); @@ -3796,13 +3623,13 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) str_format(pC[i], sizeof(pC[i]), "%s", GameClient()->m_Bindwheel.m_BindWheelList[i].command); // Description - MainView.HSplitTop(15.0f, 0, &MainView); - MainView.HSplitTop(20.0f, &buttons[i], &MainView); + MainView.HSplitTop(15.0f, nullptr, &MainView); + MainView.HSplitTop(LineSize, &buttons[i], &MainView); buttons[i].VSplitLeft(80.0f, &Label, &buttons[i]); - buttons[i].VSplitLeft(150.0f, &buttons[i], 0); + buttons[i].VSplitLeft(150.0f, &buttons[i], nullptr); char aBuf[MAX_BINDWHEEL_CMD]; str_format(aBuf, sizeof(aBuf), "%s %d:", Localize("Description"), i + 1); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); + Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_ML); s_BindWheelDesc[i].SetBuffer(GameClient()->m_Bindwheel.m_BindWheelList[i].description, sizeof(GameClient()->m_Bindwheel.m_BindWheelList[i].description)); s_BindWheelDesc[i].SetEmptyText(Localize("Description")); @@ -3810,12 +3637,12 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) Ui()->DoEditBox(&s_BindWheelDesc[i], &buttons[i], 14.0f); // Command - MainView.HSplitTop(5.0f, 0, &MainView); - MainView.HSplitTop(20.0f, &buttons[i], &MainView); + MainView.HSplitTop(MarginSmall, nullptr, &MainView); + MainView.HSplitTop(LineSize, &buttons[i], &MainView); buttons[i].VSplitLeft(80.0f, &Label, &buttons[i]); - buttons[i].VSplitLeft(150.0f, &buttons[i], 0); + buttons[i].VSplitLeft(150.0f, &buttons[i], nullptr); str_format(aBuf, sizeof(aBuf), "%s %d:", Localize("Command"), i + 1); - Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT); + Ui()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_ML); s_BindWheelCmd[i].SetBuffer(GameClient()->m_Bindwheel.m_BindWheelList[i].command, sizeof(GameClient()->m_Bindwheel.m_BindWheelList[i].command)); s_BindWheelCmd[i].SetEmptyText(Localize("Command")); @@ -3843,15 +3670,15 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) } } - CUIRect Button, KeyLabel; - LeftColumn.HSplitBottom(20.0f, &LeftColumn, 0); - LeftColumn.HSplitBottom(20.0f, &LeftColumn, &Button); + CUIRect KeyLabel; + LeftColumn.HSplitBottom(LineSize, &LeftColumn, nullptr); + LeftColumn.HSplitBottom(LineSize, &LeftColumn, &Button); Button.VSplitLeft(120.0f, &KeyLabel, &Button); - Button.VSplitLeft(100, &Button, 0); + Button.VSplitLeft(100.0f, &Button, nullptr); char aBuf[64]; str_format(aBuf, sizeof(aBuf), "%s:", Localize((const char *)Key.m_pName)); - Ui()->DoLabel(&KeyLabel, aBuf, 13.0f, TEXTALIGN_LEFT); + Ui()->DoLabel(&KeyLabel, aBuf, 14.0f, TEXTALIGN_ML); int OldId = Key.m_KeyId, OldModifierCombination = Key.m_ModifierCombination, NewModifierCombination; int NewId = DoKeyReader((void *)&Key.m_pName, &Button, OldId, OldModifierCombination, &NewModifierCombination); if(NewId != OldId || NewModifierCombination != OldModifierCombination) @@ -3861,10 +3688,10 @@ void CMenus::RenderSettingsTClient(CUIRect MainView) if(NewId != 0) m_pClient->m_Binds.Bind(NewId, Key.m_pCommand, false, NewModifierCombination); } - LeftColumn.HSplitBottom(10.0f, &LeftColumn, 0); - LeftColumn.HSplitBottom(LineMargin, &LeftColumn, &Button); + LeftColumn.HSplitBottom(10.0f, &LeftColumn, nullptr); + LeftColumn.HSplitBottom(LineSize, &LeftColumn, &Button); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClResetBindWheelMouse, ("Reset position of mouse when opening bindwheel"), &g_Config.m_ClResetBindWheelMouse, &Button, LineMargin); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClResetBindWheelMouse, Localize("Reset position of mouse when opening bindwheel"), &g_Config.m_ClResetBindWheelMouse, &Button, LineSize); } } @@ -3873,7 +3700,10 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) CUIRect Label, LabelMid, Section, LabelRight; static int SelectedProfile = -1; - const float LineMargin = 22.0f; + const float LineSize = 20.0f; + const float MarginSmall = 5.0f; + const float FontSize = 14.0f; + char *pSkinName = g_Config.m_ClPlayerSkin; int *pUseCustomColor = &g_Config.m_ClPlayerUseCustomColor; unsigned *pColorBody = &g_Config.m_ClPlayerColorBody; @@ -3908,43 +3738,43 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) OwnSkinInfo.m_Size = 50.0f; //======YOUR PROFILE====== - MainView.HSplitTop(10.0f, &Label, &MainView); char aTempBuf[256]; str_format(aTempBuf, sizeof(aTempBuf), "%s:", Localize("Your profile")); - Ui()->DoLabel(&Label, aTempBuf, 14.0f, TEXTALIGN_LEFT); + MainView.HSplitTop(LineSize, &Label, &MainView); + Ui()->DoLabel(&Label, aTempBuf, FontSize, TEXTALIGN_ML); + MainView.HSplitTop(MarginSmall, nullptr, &MainView); MainView.HSplitTop(50.0f, &Label, &MainView); Label.VSplitLeft(250.0f, &Label, &LabelMid); const CAnimState *pIdleState = CAnimState::GetIdle(); vec2 OffsetToMid; RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &OwnSkinInfo, OffsetToMid); - vec2 TeeRenderPos(Label.x + 20.0f, Label.y + Label.h / 2.0f + OffsetToMid.y); + vec2 TeeRenderPos(Label.x + LineSize, Label.y + Label.h / 2.0f + OffsetToMid.y); int Emote = m_Dummy ? g_Config.m_ClDummyDefaultEyes : g_Config.m_ClPlayerDefaultEyes; - RenderTools()->RenderTee(pIdleState, &OwnSkinInfo, Emote, vec2(1, 0), TeeRenderPos); + RenderTools()->RenderTee(pIdleState, &OwnSkinInfo, Emote, vec2(1.0f, 0.0f), TeeRenderPos); char aName[64]; char aClan[64]; - str_format(aName, sizeof(aName), ("%s"), m_Dummy ? g_Config.m_ClDummyName : g_Config.m_PlayerName); - str_format(aClan, sizeof(aClan), ("%s"), m_Dummy ? g_Config.m_ClDummyClan : g_Config.m_PlayerClan); + str_format(aName, sizeof(aName), "%s", m_Dummy ? g_Config.m_ClDummyName : g_Config.m_PlayerName); + str_format(aClan, sizeof(aClan), "%s", m_Dummy ? g_Config.m_ClDummyClan : g_Config.m_PlayerClan); CUIRect FlagRect; - Label.VSplitLeft(90.0, &FlagRect, &Label); - Label.HMargin(-5.0f, &Label); - Label.HSplitTop(25.0f, &Section, &Label); + Label.VSplitLeft(90.0f, &FlagRect, &Label); - str_format(aTempBuf, sizeof(aTempBuf), ("Name: %s"), aName); - Ui()->DoLabel(&Section, aTempBuf, 15.0f, TEXTALIGN_LEFT); + Label.HSplitTop(LineSize, &Section, &Label); + str_format(aTempBuf, sizeof(aTempBuf), Localize("Name: %s"), aName); + Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); - Label.HSplitTop(20.0f, &Section, &Label); - str_format(aTempBuf, sizeof(aTempBuf), ("Clan: %s"), aClan); - Ui()->DoLabel(&Section, aTempBuf, 15.0f, TEXTALIGN_LEFT); + Label.HSplitTop(LineSize, &Section, &Label); + str_format(aTempBuf, sizeof(aTempBuf), Localize("Clan: %s"), aClan); + Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); - Label.HSplitTop(20.0f, &Section, &Label); - str_format(aTempBuf, sizeof(aTempBuf), ("Skin: %s"), pSkinName); - Ui()->DoLabel(&Section, aTempBuf, 15.0f, TEXTALIGN_LEFT); + Label.HSplitTop(LineSize, &Section, &Label); + str_format(aTempBuf, sizeof(aTempBuf), Localize("Skin: %s"), pSkinName); + Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); - FlagRect.VSplitRight(50, 0, &FlagRect); - FlagRect.HSplitBottom(25, 0, &FlagRect); + FlagRect.VSplitRight(50.f, nullptr, &FlagRect); + FlagRect.HSplitBottom(25.f, nullptr, &FlagRect); FlagRect.y -= 10.0f; ColorRGBA Color(1.0f, 1.0f, 1.0f, 1.0f); m_pClient->m_CountryFlags.Render(m_Dummy ? g_Config.m_ClDummyCountry : g_Config.m_PlayerCountry, Color, FlagRect.x, FlagRect.y, FlagRect.w, FlagRect.h); @@ -3960,13 +3790,13 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) if(SelectedProfile != -1 && SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) { CProfile LoadProfile = GameClient()->m_SkinProfiles.m_Profiles[SelectedProfile]; - MainView.HSplitTop(20.0f, 0, &MainView); + MainView.HSplitTop(LineSize, nullptr, &MainView); MainView.HSplitTop(10.0f, &Label, &MainView); - str_format(aTempBuf, sizeof(aTempBuf), "%s:", ("After Load")); - Ui()->DoLabel(&Label, aTempBuf, 14.0f, TEXTALIGN_LEFT); + str_format(aTempBuf, sizeof(aTempBuf), "%s:", Localize("After Load")); + Ui()->DoLabel(&Label, aTempBuf, FontSize, TEXTALIGN_ML); MainView.HSplitTop(50.0f, &Label, &MainView); - Label.VSplitLeft(250.0f, &Label, 0); + Label.VSplitLeft(250.0f, &Label, nullptr); if(doSkin && strlen(LoadProfile.SkinName) != 0) { @@ -3982,60 +3812,59 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) } RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &OwnSkinInfo, OffsetToMid); - TeeRenderPos = vec2(Label.x + 20.0f, Label.y + Label.h / 2.0f + OffsetToMid.y); + TeeRenderPos = vec2(Label.x + LineSize, Label.y + Label.h / 2.0f + OffsetToMid.y); int LoadEmote = Emote; if(doEmote && LoadProfile.Emote != -1) LoadEmote = LoadProfile.Emote; RenderTools()->RenderTee(pIdleState, &OwnSkinInfo, LoadEmote, vec2(1, 0), TeeRenderPos); if(doName && strlen(LoadProfile.Name) != 0) - str_format(aName, sizeof(aName), ("%s"), LoadProfile.Name); + str_format(aName, sizeof(aName), "%s", LoadProfile.Name); if(doClan && strlen(LoadProfile.Clan) != 0) - str_format(aClan, sizeof(aClan), ("%s"), LoadProfile.Clan); + str_format(aClan, sizeof(aClan), "%s", LoadProfile.Clan); - Label.VSplitLeft(90.0, &FlagRect, &Label); - Label.HMargin(-5.0f, &Label); - Label.HSplitTop(25.0f, &Section, &Label); + Label.VSplitLeft(90.0f, &FlagRect, &Label); - str_format(aTempBuf, sizeof(aTempBuf), ("Name: %s"), aName); - Ui()->DoLabel(&Section, aTempBuf, 15.0f, TEXTALIGN_LEFT); + Label.HSplitTop(LineSize, &Section, &Label); + str_format(aTempBuf, sizeof(aTempBuf), Localize("Name: %s"), aName); + Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); - Label.HSplitTop(20.0f, &Section, &Label); - str_format(aTempBuf, sizeof(aTempBuf), ("Clan: %s"), aClan); - Ui()->DoLabel(&Section, aTempBuf, 15.0f, TEXTALIGN_LEFT); + Label.HSplitTop(LineSize, &Section, &Label); + str_format(aTempBuf, sizeof(aTempBuf), Localize("Clan: %s"), aClan); + Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); - Label.HSplitTop(20.0f, &Section, &Label); - str_format(aTempBuf, sizeof(aTempBuf), ("Skin: %s"), (doSkin && strlen(LoadProfile.SkinName) != 0) ? LoadProfile.SkinName : pSkinName); - Ui()->DoLabel(&Section, aTempBuf, 15.0f, TEXTALIGN_LEFT); + Label.HSplitTop(LineSize, &Section, &Label); + str_format(aTempBuf, sizeof(aTempBuf), Localize("Skin: %s"), (doSkin && strlen(LoadProfile.SkinName) != 0) ? LoadProfile.SkinName : pSkinName); + Ui()->DoLabel(&Section, aTempBuf, FontSize, TEXTALIGN_ML); - FlagRect.VSplitRight(50, 0, &FlagRect); - FlagRect.HSplitBottom(25, 0, &FlagRect); + FlagRect.VSplitRight(50.f, nullptr, &FlagRect); + FlagRect.HSplitBottom(25.f, nullptr, &FlagRect); FlagRect.y -= 10.0f; int RenderFlag = m_Dummy ? g_Config.m_ClDummyCountry : g_Config.m_PlayerCountry; if(doFlag && LoadProfile.CountryFlag != -2) RenderFlag = LoadProfile.CountryFlag; m_pClient->m_CountryFlags.Render(RenderFlag, Color, FlagRect.x, FlagRect.y, FlagRect.w, FlagRect.h); - str_format(aName, sizeof(aName), ("%s"), m_Dummy ? g_Config.m_ClDummyName : g_Config.m_PlayerName); - str_format(aClan, sizeof(aClan), ("%s"), m_Dummy ? g_Config.m_ClDummyClan : g_Config.m_PlayerClan); + str_format(aName, sizeof(aName), "%s", m_Dummy ? g_Config.m_ClDummyName : g_Config.m_PlayerName); + str_format(aClan, sizeof(aClan), "%s", m_Dummy ? g_Config.m_ClDummyClan : g_Config.m_PlayerClan); } else { - MainView.HSplitTop(80.0f, 0, &MainView); + MainView.HSplitTop(80.0f, nullptr, &MainView); } //===BUTTONS AND CHECK BOX=== CUIRect DummyCheck, CustomCheck; - MainView.HSplitTop(30, &DummyCheck, 0); - DummyCheck.HSplitTop(13, 0, &DummyCheck); + MainView.HSplitTop(30.0f, &DummyCheck, nullptr); + DummyCheck.HSplitTop(13.0f, nullptr, &DummyCheck); - DummyCheck.VSplitLeft(100, &DummyCheck, &CustomCheck); - CustomCheck.VSplitLeft(150, &CustomCheck, 0); + DummyCheck.VSplitLeft(100.0f, &DummyCheck, &CustomCheck); + CustomCheck.VSplitLeft(150.0f, &CustomCheck, nullptr); - DoButton_CheckBoxAutoVMarginAndSet(&m_Dummy, Localize("Dummy"), (int *)&m_Dummy, &DummyCheck, LineMargin); + DoButton_CheckBoxAutoVMarginAndSet(&m_Dummy, Localize("Dummy"), (int *)&m_Dummy, &DummyCheck, LineSize); static int s_CustomColorID = 0; - CustomCheck.HSplitTop(LineMargin, &CustomCheck, 0); + CustomCheck.HSplitTop(LineSize, &CustomCheck, nullptr); if(DoButton_CheckBox(&s_CustomColorID, Localize("Custom colors"), *pUseCustomColor, &CustomCheck)) { @@ -4043,23 +3872,23 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) SetNeedSendInfo(); } - LabelMid.VSplitLeft(20.0f, 0, &LabelMid); + LabelMid.VSplitLeft(20.0f, nullptr, &LabelMid); LabelMid.VSplitLeft(160.0f, &LabelMid, &LabelRight); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileSkin, ("Save/Load Skin"), &g_Config.m_ClApplyProfileSkin, &LabelMid, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileColors, ("Save/Load Colors"), &g_Config.m_ClApplyProfileColors, &LabelMid, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileEmote, ("Save/Load Emote"), &g_Config.m_ClApplyProfileEmote, &LabelMid, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileName, ("Save/Load Name"), &g_Config.m_ClApplyProfileName, &LabelMid, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileClan, ("Save/Load Clan"), &g_Config.m_ClApplyProfileClan, &LabelMid, LineMargin); - DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileFlag, ("Save/Load Flag"), &g_Config.m_ClApplyProfileFlag, &LabelMid, LineMargin); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileSkin, Localize("Save/Load Skin"), &g_Config.m_ClApplyProfileSkin, &LabelMid, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileColors, Localize("Save/Load Colors"), &g_Config.m_ClApplyProfileColors, &LabelMid, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileEmote, Localize("Save/Load Emote"), &g_Config.m_ClApplyProfileEmote, &LabelMid, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileName, Localize("Save/Load Name"), &g_Config.m_ClApplyProfileName, &LabelMid, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileClan, Localize("Save/Load Clan"), &g_Config.m_ClApplyProfileClan, &LabelMid, LineSize); + DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClApplyProfileFlag, Localize("Save/Load Flag"), &g_Config.m_ClApplyProfileFlag, &LabelMid, LineSize); CUIRect Button; - LabelRight.VSplitLeft(150.0f, &LabelRight, 0); + LabelRight.VSplitLeft(150.0f, &LabelRight, nullptr); LabelRight.HSplitTop(30.0f, &Button, &LabelRight); static CButtonContainer s_LoadButton; - if(DoButton_Menu(&s_LoadButton, Localize("Load"), 0, &Button, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, vec4(0.0f, 0.0f, 0.0f, 0.5f))) + if(DoButton_Menu(&s_LoadButton, Localize("Load"), 0, &Button)) { if(SelectedProfile != -1 && SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) { @@ -4103,11 +3932,11 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) } SetNeedSendInfo(); } - LabelRight.HSplitTop(5.0f, 0, &LabelRight); + LabelRight.HSplitTop(5.0f, nullptr, &LabelRight); LabelRight.HSplitTop(30.0f, &Button, &LabelRight); static CButtonContainer s_SaveButton; - if(DoButton_Menu(&s_SaveButton, Localize("Save"), 0, &Button, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, vec4(0.0f, 0.0f, 0.0f, 0.5f))) + if(DoButton_Menu(&s_SaveButton, Localize("Save"), 0, &Button)) { GameClient()->m_SkinProfiles.AddProfile( doColors ? *pColorBody : -1, @@ -4119,17 +3948,17 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) doClan ? aClan : ""); GameClient()->m_SkinProfiles.SaveProfiles(); } - LabelRight.HSplitTop(5.0f, 0, &LabelRight); + LabelRight.HSplitTop(5.0f, nullptr, &LabelRight); static int s_AllowDelete; - DoButton_CheckBoxAutoVMarginAndSet(&s_AllowDelete, ("Enable Deleting"), &s_AllowDelete, &LabelRight, LineMargin); - LabelRight.HSplitTop(5.0f, 0, &LabelRight); + DoButton_CheckBoxAutoVMarginAndSet(&s_AllowDelete, Localizable("Enable Deleting"), &s_AllowDelete, &LabelRight, LineSize); + LabelRight.HSplitTop(5.0f, nullptr, &LabelRight); if(s_AllowDelete) { LabelRight.HSplitTop(28.0f, &Button, &LabelRight); static CButtonContainer s_DeleteButton; - if(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &Button, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, vec4(0.0f, 0.0f, 0.0f, 0.5f))) + if(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &Button)) { if(SelectedProfile != -1 && SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) { @@ -4137,11 +3966,11 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) GameClient()->m_SkinProfiles.SaveProfiles(); } } - LabelRight.HSplitTop(5.0f, 0, &LabelRight); + LabelRight.HSplitTop(5.0f, nullptr, &LabelRight); LabelRight.HSplitTop(28.0f, &Button, &LabelRight); static CButtonContainer s_OverrideButton; - if(DoButton_Menu(&s_OverrideButton, Localize("Override"), 0, &Button, 0, IGraphics::CORNER_ALL, 5.0f, 0.0f, vec4(0.0f, 0.0f, 0.0f, 0.5f))) + if(DoButton_Menu(&s_OverrideButton, Localize("Override"), 0, &Button)) { if(SelectedProfile != -1 && SelectedProfile < (int)GameClient()->m_SkinProfiles.m_Profiles.size()) { @@ -4159,9 +3988,11 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) } //---RENDER THE SELECTOR--- + CUIRect FileButton; CUIRect SelectorRect; - MainView.HSplitTop(50, 0, &SelectorRect); - SelectorRect.HSplitBottom(15.0, &SelectorRect, 0); + MainView.HSplitTop(50.0f, nullptr, &SelectorRect); + SelectorRect.HSplitBottom(LineSize, &SelectorRect, &FileButton); + SelectorRect.HSplitBottom(MarginSmall, &SelectorRect, nullptr); std::vector *pProfileList = &GameClient()->m_SkinProfiles.m_Profiles; static CListBox s_ListBox; @@ -4206,21 +4037,21 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &Info, OffsetToMid); int RenderEmote = CurrentProfile.Emote == -1 ? Emote : CurrentProfile.Emote; - TeeRenderPos = vec2(Item.m_Rect.x + 30, Item.m_Rect.y + Item.m_Rect.h / 2 + OffsetToMid.y); + TeeRenderPos = vec2(Item.m_Rect.x + 30.0f, Item.m_Rect.y + Item.m_Rect.h / 2.0f + OffsetToMid.y); - Item.m_Rect.VSplitLeft(60.0f, 0, &Item.m_Rect); + Item.m_Rect.VSplitLeft(60.0f, nullptr, &Item.m_Rect); CUIRect PlayerRect, ClanRect, FeetColorSquare, BodyColorSquare; - Item.m_Rect.VSplitLeft(60.0f, 0, &BodyColorSquare); //Delete this maybe + Item.m_Rect.VSplitLeft(60.0f, nullptr, &BodyColorSquare); // Delete this maybe - Item.m_Rect.VSplitRight(60.0, &BodyColorSquare, &FlagRect); - BodyColorSquare.x -= 11.0; - BodyColorSquare.VSplitLeft(10, &BodyColorSquare, 0); + Item.m_Rect.VSplitRight(60.0f, &BodyColorSquare, &FlagRect); + BodyColorSquare.x -= 11.0f; + BodyColorSquare.VSplitLeft(10.0f, &BodyColorSquare, nullptr); BodyColorSquare.HSplitMid(&BodyColorSquare, &FeetColorSquare); - BodyColorSquare.HSplitMid(0, &BodyColorSquare); - FeetColorSquare.HSplitMid(&FeetColorSquare, 0); - FlagRect.HSplitBottom(10.0, &FlagRect, 0); - FlagRect.HSplitTop(10.0, 0, &FlagRect); + BodyColorSquare.HSplitMid(nullptr, &BodyColorSquare); + FeetColorSquare.HSplitMid(&FeetColorSquare, nullptr); + FlagRect.HSplitBottom(10.0f, &FlagRect, nullptr); + FlagRect.HSplitTop(10.0f, nullptr, &FlagRect); Item.m_Rect.HSplitMid(&PlayerRect, &ClanRect); @@ -4250,14 +4081,15 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) if(strlen(CurrentProfile.Name) == 0 && strlen(CurrentProfile.Clan) == 0) { PlayerRect = Item.m_Rect; - Ui()->DoLabel(&PlayerRect, CurrentProfile.SkinName, 12.0f, TEXTALIGN_LEFT, Props); + PlayerRect.y += MarginSmall; + Ui()->DoLabel(&PlayerRect, CurrentProfile.SkinName, FontSize, TEXTALIGN_ML, Props); } else { - Ui()->DoLabel(&PlayerRect, CurrentProfile.Name, 12.0f, TEXTALIGN_LEFT, Props); - Item.m_Rect.HSplitTop(20.0f, 0, &Item.m_Rect); + Ui()->DoLabel(&PlayerRect, CurrentProfile.Name, FontSize, TEXTALIGN_ML, Props); + Item.m_Rect.HSplitTop(LineSize, nullptr, &Item.m_Rect); Props.m_MaxWidth = Item.m_Rect.w; - Ui()->DoLabel(&ClanRect, CurrentProfile.Clan, 12.0f, TEXTALIGN_LEFT, Props); + Ui()->DoLabel(&ClanRect, CurrentProfile.Clan, FontSize, TEXTALIGN_ML, Props); } } } @@ -4268,10 +4100,7 @@ void CMenus::RenderSettingsProfiles(CUIRect MainView) SelectedProfile = NewSelected; } static CButtonContainer s_ProfilesFile; - CUIRect FileButton; - MainView.HSplitBottom(25.0, 0, &FileButton); - FileButton.y += 15.0; - FileButton.VSplitLeft(130.0, &FileButton, 0); + FileButton.VSplitLeft(130.0f, &FileButton, nullptr); if(DoButton_Menu(&s_ProfilesFile, Localize("Profiles file"), 0, &FileButton)) { Storage()->GetCompletePath(IStorage::TYPE_SAVE, PROFILES_FILE, aTempBuf, sizeof(aTempBuf)); diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index b2145e240e4..e34309e05c1 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -439,7 +439,7 @@ void CPlayers::RenderPlayer( bool Local = m_pClient->m_Snap.m_LocalClientId == ClientId; bool OtherTeam = m_pClient->IsOtherTeam(ClientId); - //float Alpha = (OtherTeam || ClientId < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f; + // float Alpha = (OtherTeam || ClientId < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f; bool Spec = m_pClient->m_Snap.m_SpecInfo.m_Active; float Alpha = 1.0f; @@ -608,16 +608,20 @@ void CPlayers::RenderPlayer( if(IsSit) WeaponPosition.y += 3.0f; - // if active and attack is under way, bash stuffs - if(!Inactive || LastAttackTime < m_pClient->m_aTuning[g_Config.m_ClDummy].GetWeaponFireDelay(Player.m_Weapon)) + // set rotation + float QuadsRotation = -pi / 2; + QuadsRotation += State.GetAttach()->m_Angle * (Direction.x < 0 ? -1 : 1) * pi * 2; + if(g_Config.m_ClHammerRotatesWithCursor) { + QuadsRotation += Angle; if(Direction.x < 0) - Graphics()->QuadsSetRotation(-pi / 2 - State.GetAttach()->m_Angle * pi * 2); - else - Graphics()->QuadsSetRotation(-pi / 2 + State.GetAttach()->m_Angle * pi * 2); + QuadsRotation += pi; } - else - Graphics()->QuadsSetRotation(Direction.x < 0 ? 100.0f : 500.0f); + else if(Inactive && LastAttackTime > m_pClient->m_aTuning[g_Config.m_ClDummy].GetWeaponFireDelay(Player.m_Weapon)) + { + QuadsRotation = Direction.x < 0 ? 100.0f : 500.0f; + } + Graphics()->QuadsSetRotation(QuadsRotation); Graphics()->RenderQuadContainerAsSprite(m_WeaponEmoteQuadContainerIndex, QuadOffset, WeaponPosition.x, WeaponPosition.y); } @@ -880,7 +884,6 @@ void CPlayers::RenderPlayerGhost( if(!OtherTeam && FrozenSwappingHide) Alpha = 1.0f; - // set size RenderInfo.m_Size = 64.0f; @@ -1409,7 +1412,7 @@ void CPlayers::OnRender() bool Spec = m_pClient->m_Snap.m_SpecInfo.m_Active; - //If we are frozen and hiding frozen ghosts and not swapping render only the regular player + // If we are frozen and hiding frozen ghosts and not swapping render only the regular player if(RenderGhost && g_Config.m_ClShowOthersGhosts && !Spec && Client()->State() != IClient::STATE_DEMOPLAYBACK) RenderPlayerGhost(&m_pClient->m_aClients[ClientId].m_RenderPrev, &m_pClient->m_aClients[ClientId].m_RenderCur, &aRenderInfo[ClientId], ClientId); diff --git a/src/game/client/components/skinprofiles.h b/src/game/client/components/skinprofiles.h index bee7dc6835b..ac4bdb54c81 100644 --- a/src/game/client/components/skinprofiles.h +++ b/src/game/client/components/skinprofiles.h @@ -45,4 +45,4 @@ class CSkinProfiles : public CComponent virtual int Sizeof() const override { return sizeof(*this); } virtual void OnInit() override; }; -#endif \ No newline at end of file +#endif diff --git a/src/game/client/components/tater.cpp b/src/game/client/components/tater.cpp index d34953add27..a40fd9fa0f0 100644 --- a/src/game/client/components/tater.cpp +++ b/src/game/client/components/tater.cpp @@ -152,4 +152,4 @@ void CTater::RandomFlag(void *pUserData) // set the flag code as number g_Config.m_PlayerCountry = pFlag->m_CountryCode; -} \ No newline at end of file +} diff --git a/src/game/client/components/verify.cpp b/src/game/client/components/verify.cpp index 41fe426efec..973d3c6e76e 100644 --- a/src/game/client/components/verify.cpp +++ b/src/game/client/components/verify.cpp @@ -49,4 +49,4 @@ void CVerify::OnRender() } return; } -} \ No newline at end of file +} diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 349dceb47e5..0b0524773a4 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -2267,7 +2267,7 @@ void CGameClient::OnPredict() { m_PredictedChar = pLocalChar->GetCore(); } - if(Tick == FinalTick - std::max(g_Config.m_ClFastInput - g_Config.m_ClFastInputOthers, 0)) + if(Tick == FinalTick - std::max(g_Config.m_ClFastInput - g_Config.m_ClFastInputOthers, 0)) { for(int i = 0; i < MAX_CLIENTS; i++) if(CCharacter *pChar = m_PredictedWorld.GetCharacterById(i)) @@ -2325,10 +2325,8 @@ void CGameClient::OnPredict() // Remove other tees to reduce lag and because they aren't really important in this case for(int i = 0; i < MAX_CLIENTS; i++) if(i != m_Snap.m_LocalClientId) - if (CCharacter* pDelChar = m_ExtraPredictedWorld.GetCharacterById(i)) + if(CCharacter *pDelChar = m_ExtraPredictedWorld.GetCharacterById(i)) pDelChar->Destroy(); - - CCharacter *pExtraChar = m_ExtraPredictedWorld.GetCharacterById(m_Snap.m_LocalClientId); if(pExtraChar) @@ -2351,7 +2349,7 @@ void CGameClient::OnPredict() m_ExtraPredictedWorld.m_GameTick++; m_ExtraPredictedWorld.Tick(); } - else + else { pExtraChar->m_AliveAccumulation = std::max(pExtraChar->m_AliveAccumulation, 1); pExtraChar->m_AliveAccumulation = std::min(pExtraChar->m_AliveAccumulation + 1, g_Config.m_ClUnfreezeLagDelayTicks); @@ -3288,7 +3286,7 @@ vec2 CGameClient::GetSmoothPos(int ClientId) Client()->GetSmoothTick(&SmoothTick, &SmoothIntra, MixAmount); if(ClientId != m_Snap.m_LocalClientId && !g_Config.m_ClFastInputOthers && g_Config.m_ClFastInput) - SmoothTick -= 1; + SmoothTick -= 1; if(SmoothTick > 0 && m_aClients[ClientId].m_aPredTick[(SmoothTick - 1) % 200] >= Client()->PrevGameTick(g_Config.m_ClDummy) && m_aClients[ClientId].m_aPredTick[SmoothTick % 200] <= Client()->PredGameTick(g_Config.m_ClDummy)) Pos[i] = mix(m_aClients[ClientId].m_aPredPos[(SmoothTick - 1) % 200][i], m_aClients[ClientId].m_aPredPos[SmoothTick % 200][i], SmoothIntra); @@ -3306,8 +3304,8 @@ vec2 CGameClient::GetFreezePos(int ClientId) for(int i = 0; i < 2; i++) { - //int64_t Len = clamp(m_aClients[ClientId].m_aSmoothLen[i], (int64_t)1, time_freq()); - //int64_t TimePassed = Now - m_aClients[ClientId].m_aSmoothStart[i]; + // int64_t Len = clamp(m_aClients[ClientId].m_aSmoothLen[i], (int64_t)1, time_freq()); + // int64_t TimePassed = Now - m_aClients[ClientId].m_aSmoothStart[i]; float MixAmount = 0.0f; int SmoothTick; float SmoothIntra; @@ -3327,17 +3325,11 @@ vec2 CGameClient::GetFreezePos(int ClientId) AdjustTicks = std::min(FreezeTime, AdjustTicks); } if(g_Config.m_ClRemoveAnti && pChar && AdjustTicks > 0 && FreezeTime > 0) - { MixAmount = mix(0.0f, 1.0f, 1.0f - AdjustTicks / (float)DelayTicks); - } - //else if(AdjustTicks == 0 && ClientId != m_Snap.m_LocalClientId) - //{ + // else if(AdjustTicks == 0 && ClientId != m_Snap.m_LocalClientId) // MixAmount = 1.f - std::pow(1.f - TimePassed / (float)Len, 1.2f); - //} else // our tee when not frozen - { MixAmount = 1.f; - } Client()->GetSmoothFreezeTick(&SmoothTick, &SmoothIntra, MixAmount); diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index fcff3078c2d..a6f42a439db 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -25,6 +25,7 @@ // components #include "components/background.h" #include "components/binds.h" +#include "components/bindwheel.h" #include "components/broadcast.h" #include "components/camera.h" #include "components/chat.h" @@ -48,25 +49,23 @@ #include "components/menus.h" #include "components/motd.h" #include "components/nameplates.h" +#include "components/outlines.h" #include "components/particles.h" #include "components/player_indicator.h" -#include "components/verify.h" -#include "components/bindwheel.h" -#include "components/tater.h" -#include "components/outlines.h" #include "components/players.h" #include "components/race_demo.h" #include "components/rainbow.h" #include "components/scoreboard.h" +#include "components/skinprofiles.h" #include "components/skins.h" #include "components/skins7.h" #include "components/sounds.h" #include "components/spectator.h" #include "components/statboard.h" +#include "components/tater.h" #include "components/tooltips.h" +#include "components/verify.h" #include "components/voting.h" -#include "components/skinprofiles.h" - class CGameInfo { @@ -154,11 +153,11 @@ class CGameClient : public IGameClient CStatboard m_Statboard; CSounds m_Sounds; CEmoticon m_Emoticon; - CBindWheel m_Bindwheel; - CTater m_Tater; + CBindWheel m_Bindwheel; + CTater m_Tater; CDamageInd m_DamageInd; CVoting m_Voting; - CVerify m_Verify; + CVerify m_Verify; CSpectator m_Spectator; CPlayers m_Players; @@ -177,7 +176,7 @@ class CGameClient : public IGameClient CMapSounds m_MapSounds; CRaceDemo m_RaceDemo; - CRainbow m_Rainbow; + CRainbow m_Rainbow; CGhost m_Ghost; CTooltips m_Tooltips; diff --git a/src/game/client/render_map.cpp b/src/game/client/render_map.cpp index dbcef3100fe..a162613666a 100644 --- a/src/game/client/render_map.cpp +++ b/src/game/client/render_map.cpp @@ -667,7 +667,7 @@ void CRenderTools::RenderTilemap(CTile *pTiles, int w, int h, float Scale, Color Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1); } -int ClampedIndex(int x, int y, int w, int h) +int ClampedIndex(int x, int y, int w, int h) { x = std::clamp(x, 0, w - 1); y = std::clamp(y, 0, h - 1); @@ -686,7 +686,7 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca int MaxScale = 12; if(EndX - StartX > Graphics()->ScreenWidth() / MaxScale || EndY - StartY > Graphics()->ScreenHeight() / MaxScale) { - int EdgeX = (EndX - StartX)-(Graphics()->ScreenWidth() / MaxScale); + int EdgeX = (EndX - StartX) - (Graphics()->ScreenWidth() / MaxScale); StartX += EdgeX / 2; EndX -= EdgeX / 2; int EdgeY = (EndY - StartY) - (Graphics()->ScreenHeight() / MaxScale); @@ -696,7 +696,8 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca Graphics()->TextureClear(); Graphics()->QuadsBegin(); ColorRGBA col = ColorRGBA(0.0f, 0.0f, 0.0f, 1.0f); - if (TileType == TILE_FREEZE) { + if(TileType == TILE_FREEZE) + { col = color_cast(ColorHSLA(g_Config.m_ClOutlineColorFreeze)); } else if(TileType == TILE_SOLID) @@ -722,7 +723,7 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca bool IsUnFreeze = Index == TILE_UNFREEZE || Index == TILE_DUNFREEZE; bool IsSolid = Index == TILE_SOLID || Index == TILE_NOHOOK; - if(!(IsSolid || IsFreeze || IsUnFreeze)) //Not an tile we care about + if(!(IsSolid || IsFreeze || IsUnFreeze)) // Not an tile we care about continue; if(IsSolid && !(TileType == TILE_SOLID)) continue; @@ -736,7 +737,7 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca if(IsFreeze && TileType == TILE_FREEZE) { int IndexN; - + IndexN = pTiles[ClampedIndex(mx - 1, my - 1, w, h)].m_Index; Neighbors[0] = IndexN == TILE_AIR || IndexN == TILE_UNFREEZE || IndexN == TILE_DUNFREEZE; IndexN = pTiles[ClampedIndex(mx - 0, my - 1, w, h)].m_Index; @@ -795,11 +796,10 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca Neighbors[7] = IndexN != TILE_UNFREEZE && IndexN != TILE_DUNFREEZE; } - float Size = (float)g_Config.m_ClOutlineWidth; int NumQuads = 0; - //Do lonely corners first + // Do lonely corners first if(Neighbors[0] && !Neighbors[1] && !Neighbors[3]) { Array[NumQuads] = IGraphics::CQuadItem(mx * Scale, my * Scale, Size, Size); @@ -820,19 +820,19 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca Array[NumQuads] = IGraphics::CQuadItem(mx * Scale + Scale - Size, my * Scale + Scale - Size, Size, Size); NumQuads++; } - //Top + // Top if(Neighbors[1]) { Array[NumQuads] = IGraphics::CQuadItem(mx * Scale, my * Scale, Scale, Size); NumQuads++; } - //Bottom + // Bottom if(Neighbors[6]) { Array[NumQuads] = IGraphics::CQuadItem(mx * Scale, my * Scale + Scale - Size, Scale, Size); NumQuads++; } - //Left + // Left if(Neighbors[3]) { if(!Neighbors[1] && !Neighbors[6]) @@ -845,7 +845,7 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca Array[NumQuads] = IGraphics::CQuadItem(mx * Scale, my * Scale + Size, Size, Scale - Size * 2.0f); NumQuads++; } - //Right + // Right if(Neighbors[4]) { if(!Neighbors[1] && !Neighbors[6]) @@ -859,7 +859,6 @@ void CRenderTools::RenderGameTileOutlines(CTile *pTiles, int w, int h, float Sca NumQuads++; } - Graphics()->QuadsDrawTL(Array, NumQuads); } Graphics()->QuadsEnd(); diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 00ccfadc6df..6cf0e3d488a 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -503,7 +503,7 @@ void CCharacter::FireWeapon() { auto *pTarget = static_cast(apEnts[i]); - //if ((pTarget == this) || Collision()->IntersectLine(ProjStartPos, pTarget->m_Pos, NULL, NULL)) + // if ((pTarget == this) || Collision()->IntersectLine(ProjStartPos, pTarget->m_Pos, NULL, NULL)) if((pTarget == this || (pTarget->IsAlive() && !CanCollide(pTarget->GetPlayer()->GetCid())))) continue; @@ -553,15 +553,15 @@ void CCharacter::FireWeapon() new CProjectile( GameWorld(), - WEAPON_GUN, //Type - m_pPlayer->GetCid(), //Owner - ProjStartPos, //Pos - Direction, //Dir - Lifetime, //Span - false, //Freeze - false, //Explosive - -1, //SoundImpact - MouseTarget //InitDir + WEAPON_GUN, // Type + m_pPlayer->GetCid(), // Owner + ProjStartPos, // Pos + Direction, // Dir + Lifetime, // Span + false, // Freeze + false, // Explosive + -1, // SoundImpact + MouseTarget // InitDir ); GameServer()->CreateSound(m_Pos, SOUND_GUN_FIRE, TeamMask()); // NOLINT(clang-analyzer-unix.Malloc) @@ -584,14 +584,14 @@ void CCharacter::FireWeapon() new CProjectile( GameWorld(), - WEAPON_GRENADE, //Type - m_pPlayer->GetCid(), //Owner - ProjStartPos, //Pos - Direction, //Dir - Lifetime, //Span - false, //Freeze - true, //Explosive - SOUND_GRENADE_EXPLODE, //SoundImpact + WEAPON_GRENADE, // Type + m_pPlayer->GetCid(), // Owner + ProjStartPos, // Pos + Direction, // Dir + Lifetime, // Span + false, // Freeze + true, // Explosive + SOUND_GRENADE_EXPLODE, // SoundImpact MouseTarget // MouseTarget ); @@ -634,7 +634,7 @@ void CCharacter::FireWeapon() void CCharacter::HandleWeapons() { - //ninja + // ninja HandleNinja(); HandleJetpack(); @@ -825,7 +825,7 @@ void CCharacter::TickDeferred() m_ReckoningCore.Quantize(); } - //lastsentcore + // lastsentcore vec2 StartPos = m_Core.m_Pos; vec2 StartVel = m_Core.m_Vel; bool StuckBefore = Collision()->TestBox(m_Core.m_Pos, CCharacterCore::PhysicalSizeVec2()); @@ -1019,7 +1019,7 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon) return true; } -//TODO: Move the emote stuff to a function +// TODO: Move the emote stuff to a function void CCharacter::SnapCharacter(int SnappingClient, int Id) { int SnappingClientVersion = GameServer()->GetClientVersion(SnappingClient); @@ -1492,7 +1492,7 @@ void CCharacter::SetTimeCheckpoint(int TimeCheckpoint) void CCharacter::HandleTiles(int Index) { int MapIndex = Index; - //int PureMapIndex = Collision()->GetPureMapIndex(m_Pos); + // int PureMapIndex = Collision()->GetPureMapIndex(m_Pos); m_TileIndex = Collision()->GetTileIndex(MapIndex); m_TileFIndex = Collision()->GetFTileIndex(MapIndex); m_MoveRestrictions = Collision()->GetMoveRestrictions(IsSwitchActiveCb, this, m_Pos, 18.0f, MapIndex); diff --git a/src/game/tater_variables.h b/src/game/tater_variables.h index 2b7021872c1..266ed0bc98e 100644 --- a/src/game/tater_variables.h +++ b/src/game/tater_variables.h @@ -24,6 +24,8 @@ MACRO_CONFIG_INT(ClSpecmenuID, tc_spec_menu_ID, 0, 0, 1, CFGFLAG_CLIENT | CFGFLA MACRO_CONFIG_INT(ClLimitMouseToScreen, tc_limit_mouse_to_screen, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Limit mouse to screen boundries") +MACRO_CONFIG_INT(ClHammerRotatesWithCursor, tc_hammer_rotates_with_cursor, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Allow your hammer to rotate like other weapons") + // Anti Latency Tools MACRO_CONFIG_INT(ClFreezeUpdateFix, tc_freeze_update_fix, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Will change your skin faster when you enter freeze. ") MACRO_CONFIG_INT(ClRemoveAnti, tc_remove_anti, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Removes some amount of antiping & player prediction in freeze") @@ -127,4 +129,4 @@ MACRO_CONFIG_INT(ClRainbowOthers, tc_rainbow_others, 0, 0, 1, CFGFLAG_CLIENT | C MACRO_CONFIG_INT(ClRainbowMode, tc_rainbow_mode, 1, 1, 4, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Rainbow mode (1: rainbow, 2: pulse, 3: darkness)") // AAAAAAA -MACRO_CONFIG_INT(ClAmIFrozen, EEEfrz, 0, 0, 1, CFGFLAG_CLIENT, "") \ No newline at end of file +MACRO_CONFIG_INT(ClAmIFrozen, EEEfrz, 0, 0, 1, CFGFLAG_CLIENT, "")