Skip to content

Commit

Permalink
undo rainbow names
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Dec 8, 2024
1 parent 3da4330 commit c75d6ef
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src/game/client/components/menus_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,18 +346,18 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
MainView.HSplitBottom(5.0f, &MainView, nullptr);
QuickSearch.VSplitLeft(220.0f, &QuickSearch, nullptr);

int RainbowSelectedOld = -1;
int SelectedOld = -1;
static CListBox s_ListBox;
s_ListBox.DoStart(48.0f, vpFilteredFlags.size(), 10, 3, RainbowSelectedOld, &MainView);
s_ListBox.DoStart(48.0f, vpFilteredFlags.size(), 10, 3, SelectedOld, &MainView);

for(size_t i = 0; i < vpFilteredFlags.size(); i++)
{
const CCountryFlags::CCountryFlag *pEntry = vpFilteredFlags[i];

if(pEntry->m_CountryCode == *pCountry)
RainbowSelectedOld = i;
SelectedOld = i;

const CListboxItem Item = s_ListBox.DoNextItem(&pEntry->m_CountryCode, RainbowSelectedOld >= 0 && (size_t)RainbowSelectedOld == i);
const CListboxItem Item = s_ListBox.DoNextItem(&pEntry->m_CountryCode, SelectedOld >= 0 && (size_t)SelectedOld == i);
if(!Item.m_Visible)
continue;

Expand All @@ -377,7 +377,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
}

const int NewSelected = s_ListBox.DoEnd();
if(RainbowSelectedOld != NewSelected)
if(SelectedOld != NewSelected)
{
*pCountry = vpFilteredFlags[NewSelected]->m_CountryCode;
SetNeedSendInfo();
Expand Down Expand Up @@ -778,22 +778,22 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
s_vSkinList.insert(s_vSkinList.end(), s_vSkinListHelper.begin(), s_vSkinListHelper.end());
}

int RainbowSelectedOld = -1;
s_ListBox.DoStart(50.0f, s_vSkinList.size(), 4, 1, RainbowSelectedOld, &MainView);
int SelectedOld = -1;
s_ListBox.DoStart(50.0f, s_vSkinList.size(), 4, 1, SelectedOld, &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)
{
RainbowSelectedOld = i;
SelectedOld = i;
if(m_SkinListScrollToSelected)
{
s_ListBox.ScrollToSelected();
m_SkinListScrollToSelected = false;
}
}

const CListboxItem Item = s_ListBox.DoNextItem(pSkinToBeDraw, RainbowSelectedOld >= 0 && (size_t)RainbowSelectedOld == i);
const CListboxItem Item = s_ListBox.DoNextItem(pSkinToBeDraw, SelectedOld >= 0 && (size_t)SelectedOld == i);
if(!Item.m_Visible)
continue;

Expand Down Expand Up @@ -845,7 +845,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
}

const int NewSelected = s_ListBox.DoEnd();
if(RainbowSelectedOld != NewSelected)
if(SelectedOld != NewSelected)
{
str_copy(pSkinName, s_vSkinList[NewSelected].m_pSkin->GetName(), SkinNameSize);
SetNeedSendInfo();
Expand Down Expand Up @@ -1448,9 +1448,9 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
Ui()->DoLabel(&ModeLabel, aBuf, sc_FontSizeResListHeader, TEXTALIGN_MC);
}

int RainbowSelectedOld = -1;
int SelectedOld = -1;
s_ListBox.SetActive(!Ui()->IsPopupOpen());
s_ListBox.DoStart(sc_RowHeightResList, s_NumNodes, 1, 3, RainbowSelectedOld, &ModeList);
s_ListBox.DoStart(sc_RowHeightResList, s_NumNodes, 1, 3, SelectedOld, &ModeList);

for(int i = 0; i < s_NumNodes; ++i)
{
Expand All @@ -1460,10 +1460,10 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
g_Config.m_GfxScreenHeight == s_aModes[i].m_WindowHeight &&
g_Config.m_GfxScreenRefreshRate == s_aModes[i].m_RefreshRate)
{
RainbowSelectedOld = i;
SelectedOld = i;
}

const CListboxItem Item = s_ListBox.DoNextItem(&s_aModes[i], RainbowSelectedOld == i);
const CListboxItem Item = s_ListBox.DoNextItem(&s_aModes[i], SelectedOld == i);
if(!Item.m_Visible)
continue;

Expand All @@ -1473,7 +1473,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
}

const int NewSelected = s_ListBox.DoEnd();
if(RainbowSelectedOld != NewSelected)
if(SelectedOld != 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;
Expand Down Expand Up @@ -1660,7 +1660,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 RainbowSelectedOldBackend = -1;
int SelectedOldBackend = -1;
uint32_t CurCounter = 0;
for(uint32_t i = 0; i < BACKEND_TYPE_COUNT; ++i)
{
Expand All @@ -1675,7 +1675,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)
{
RainbowSelectedOldBackend = CurCounter;
SelectedOldBackend = CurCounter;
}

s_vBackendInfos[CurCounter] = Info;
Expand All @@ -1684,7 +1684,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
}
}

if(RainbowSelectedOldBackend != -1)
if(SelectedOldBackend != -1)
{
// no custom selected
BackendCount -= 1;
Expand All @@ -1695,31 +1695,31 @@ 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();
RainbowSelectedOldBackend = CurCounter;
SelectedOldBackend = CurCounter;

s_vBackendInfos[CurCounter].m_pBackendName = "custom";
s_vBackendInfos[CurCounter].m_Major = g_Config.m_GfxGLMajor;
s_vBackendInfos[CurCounter].m_Minor = g_Config.m_GfxGLMinor;
s_vBackendInfos[CurCounter].m_Patch = g_Config.m_GfxGLPatch;
}

static int s_RainbowSelectedOldBackend = -1;
if(s_RainbowSelectedOldBackend == -1)
s_RainbowSelectedOldBackend = RainbowSelectedOldBackend;
static int s_SelectedOldBackend = -1;
if(s_SelectedOldBackend == -1)
s_SelectedOldBackend = SelectedOldBackend;

static CUi::SDropDownState s_BackendDropDownState;
static CScrollRegion s_BackendDropDownScrollRegion;
s_BackendDropDownState.m_SelectionPopupContext.m_pScrollRegion = &s_BackendDropDownScrollRegion;
const int NewBackend = Ui()->DoDropDown(&BackendDropDown, RainbowSelectedOldBackend, s_vpBackendIdNamesCStr.data(), BackendCount, s_BackendDropDownState);
if(RainbowSelectedOldBackend != NewBackend)
const int NewBackend = Ui()->DoDropDown(&BackendDropDown, SelectedOldBackend, s_vpBackendIdNamesCStr.data(), BackendCount, s_BackendDropDownState);
if(SelectedOldBackend != NewBackend)
{
str_copy(g_Config.m_GfxBackend, s_vBackendInfos[NewBackend].m_pBackendName);
g_Config.m_GfxGLMajor = s_vBackendInfos[NewBackend].m_Major;
g_Config.m_GfxGLMinor = s_vBackendInfos[NewBackend].m_Minor;
g_Config.m_GfxGLPatch = s_vBackendInfos[NewBackend].m_Patch;

CheckSettings = true;
s_GfxBackendChanged = s_RainbowSelectedOldBackend != NewBackend;
s_GfxBackendChanged = s_SelectedOldBackend != NewBackend;
}
}

Expand Down Expand Up @@ -1902,7 +1902,7 @@ bool CMenus::RenderLanguageSelection(CUIRect MainView)
}
}

const int RainbowSelectedOld = s_SelectedLanguage;
const int SelectedOld = s_SelectedLanguage;

s_ListBox.DoStart(24.0f, g_Localization.Languages().size(), 1, 3, s_SelectedLanguage, &MainView);

Expand All @@ -1923,7 +1923,7 @@ bool CMenus::RenderLanguageSelection(CUIRect MainView)

s_SelectedLanguage = s_ListBox.DoEnd();

if(RainbowSelectedOld != s_SelectedLanguage)
if(SelectedOld != s_SelectedLanguage)
{
str_copy(g_Config.m_ClLanguagefile, g_Localization.Languages()[s_SelectedLanguage].m_FileName.c_str());
GameClient()->OnLanguageChange();
Expand Down

0 comments on commit c75d6ef

Please sign in to comment.