diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index c53939e054a..f8e4afccdc8 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -95,6 +95,7 @@ class CMenus : public CComponent void DoJoystickBar(const CUIRect *pRect, float Current, float Tolerance, bool Active); bool m_SkinListNeedsUpdate = false; + bool m_SkinListScrollToSelected = false; int m_DirectionQuadContainerIndex; diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 0e310c81d20..ee6c6be9311 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -459,12 +459,14 @@ void CMenus::RenderSettingsTee(CUIRect MainView) if(DoButton_MenuTab(&s_PlayerTabButton, Localize("Player"), !m_Dummy, &PlayerTab, IGraphics::CORNER_L, nullptr, nullptr, nullptr, nullptr, 4.0f)) { m_Dummy = false; + m_SkinListScrollToSelected = true; } static CButtonContainer s_DummyTabButton; if(DoButton_MenuTab(&s_DummyTabButton, Localize("Dummy"), m_Dummy, &DummyTab, IGraphics::CORNER_R, nullptr, nullptr, nullptr, nullptr, 4.0f)) { m_Dummy = true; + m_SkinListScrollToSelected = true; } if(Client()->State() == IClient::STATE_ONLINE && m_pClient->m_NextChangeInfo && m_pClient->m_NextChangeInfo > Client()->GameTick(g_Config.m_ClDummy)) @@ -611,6 +613,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView) if(Ui()->DoClearableEditBox(&s_SkinInput, &Button, 14.0f)) { SetNeedSendInfo(); + m_SkinListScrollToSelected = true; } // Random skin button @@ -762,7 +765,14 @@ void CMenus::RenderSettingsTee(CUIRect MainView) { const CSkin *pSkinToBeDraw = s_vSkinList[i].m_pSkin; if(str_comp(pSkinToBeDraw->GetName(), pSkinName) == 0) + { OldSelected = i; + if(m_SkinListScrollToSelected) + { + s_ListBox.ScrollToSelected(); + m_SkinListScrollToSelected = false; + } + } const CListboxItem Item = s_ListBox.DoNextItem(pSkinToBeDraw, OldSelected >= 0 && (size_t)OldSelected == i); if(!Item.m_Visible)