diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 3a96626b7..25bab351e 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -21,6 +21,7 @@ MACRO_CONFIG_INT(ClCpuThrottleInactive, cl_cpu_throttle_inactive, 1, 0, 1, CFGFL MACRO_CONFIG_INT(ClEditor, cl_editor, 0, 0, 1, CFGFLAG_CLIENT, "") MACRO_CONFIG_INT(ClEditorUndo, cl_editorundo, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Undo function in editor") MACRO_CONFIG_INT(ClLoadCountryFlags, cl_load_country_flags, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Load and show country flags") +MACRO_CONFIG_STR(ClSkinFilterString, cl_skin_filter_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Skin filtering string") MACRO_CONFIG_INT(ClAutoDemoRecord, cl_auto_demo_record, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Automatically record demos") MACRO_CONFIG_INT(ClAutoDemoMax, cl_auto_demo_max, 10, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Maximum number of automatically recorded demos (0 = no limit)") diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 27a7370bb..8601fd808 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -487,7 +487,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) QuickExclude.VSplitLeft(5.0f, 0, &QuickExclude); // render quick search { - const char *pLabel = Localize("⚲"); + const char *pLabel = "⚲"; UI()->DoLabelScaled(&QuickSearch, pLabel, 12.0f, -1); float w = TextRender()->TextWidth(0, 12.0f, pLabel, -1); QuickSearch.VSplitLeft(w, 0, &QuickSearch); diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index dd88d7ce2..3552c8381 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -609,7 +609,7 @@ void CMenus::RenderServerControl(CUIRect MainView) { Bottom.VSplitLeft(240.0f, &QuickSearch, &Bottom); QuickSearch.HSplitTop(5.0f, 0, &QuickSearch); - const char *pSearchLabel = Localize("⚲"); + const char *pSearchLabel = "⚲"; UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1); float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1); QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch); diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 021d9df38..5d26c3385 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -342,7 +342,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView) void CMenus::RenderSettingsTee(CUIRect MainView) { - CUIRect Button, Label, Button2, Dummy, DummyLabel; + CUIRect Button, Label, Button2, Dummy, DummyLabel, SkinList, QuickSearch, QuickSearchClearButton; static bool s_InitSkinlist = true; MainView.HSplitTop(10.0f, 0, &MainView); @@ -479,6 +479,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView) // skin selector MainView.HSplitTop(20.0f, 0, &MainView); + MainView.HSplitTop(230.0f, &SkinList, &MainView); static sorted_array s_paSkinList; static float s_ScrollValue = 0.0f; if(s_InitSkinlist) @@ -487,16 +488,22 @@ void CMenus::RenderSettingsTee(CUIRect MainView) for(int i = 0; i < m_pClient->m_pSkins->Num(); ++i) { const CSkins::CSkin *s = m_pClient->m_pSkins->Get(i); + + // filter quick search + if(g_Config.m_ClSkinFilterString[0] != '\0' && !str_find_nocase(s->m_aName, g_Config.m_ClSkinFilterString)) + continue; + // no special skins if((s->m_aName[0] == 'x' && s->m_aName[1] == '_')) continue; + s_paSkinList.add(s); } s_InitSkinlist = false; } int OldSelected = -1; - UiDoListboxStart(&s_InitSkinlist, &MainView, 50.0f, Localize("Skins"), "", s_paSkinList.size(), 4, OldSelected, s_ScrollValue); + UiDoListboxStart(&s_InitSkinlist, &SkinList, 50.0f, Localize("Skins"), "", s_paSkinList.size(), 4, OldSelected, s_ScrollValue); for(int i = 0; i < s_paSkinList.size(); ++i) { const CSkins::CSkin *s = s_paSkinList[i]; @@ -555,6 +562,35 @@ void CMenus::RenderSettingsTee(CUIRect MainView) else m_NeedSendinfo = true; } + + // render quick search + { + MainView.HSplitBottom(ms_ButtonHeight, &MainView, &QuickSearch); + QuickSearch.VSplitLeft(240.0f, &QuickSearch, 0); + QuickSearch.HSplitTop(5.0f, 0, &QuickSearch); + const char *pSearchLabel = "⚲"; + UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1); + float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1); + QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch); + QuickSearch.VSplitLeft(5.0f, 0, &QuickSearch); + QuickSearch.VSplitLeft(QuickSearch.w-15.0f, &QuickSearch, &QuickSearchClearButton); + static float Offset = 0.0f; + if(DoEditBox(&g_Config.m_ClSkinFilterString, &QuickSearch, g_Config.m_ClSkinFilterString, sizeof(g_Config.m_ClSkinFilterString), 14.0f, &Offset, false, CUI::CORNER_L, Localize("Search"))) + s_InitSkinlist = true; + + // clear button + { + static int s_ClearButton = 0; + RenderTools()->DrawUIRect(&QuickSearchClearButton, vec4(1,1,1,0.33f)*ButtonColorMul(&s_ClearButton), CUI::CORNER_R, 3.0f); + UI()->DoLabel(&QuickSearchClearButton, "×", QuickSearchClearButton.h*ms_FontmodHeight, 0); + if(UI()->DoButtonLogic(&s_ClearButton, "×", 0, &QuickSearchClearButton)) + { + g_Config.m_ClSkinFilterString[0] = 0; + UI()->SetActiveItem(&g_Config.m_ClSkinFilterString); + s_InitSkinlist = true; + } + } + } }