From 6a2aa370f08cbbd72fc9820450c53dd8dd117237 Mon Sep 17 00:00:00 2001 From: GabsPuNs Date: Sat, 16 May 2026 14:25:28 -0400 Subject: [PATCH] Add missing funcs to MultiList --- Minecraft.Client/Common/UI/UIControl_List.h | 5 ++ .../Common/UI/UIControl_MultiList.cpp | 89 ++++++++++++++++--- .../Common/UI/UIControl_MultiList.h | 8 +- Minecraft.Client/Common/UI/UIControl_list.cpp | 13 ++- .../UI/UIScene_SettingsGraphicsMenu.cpp | 8 +- 5 files changed, 104 insertions(+), 19 deletions(-) diff --git a/Minecraft.Client/Common/UI/UIControl_List.h b/Minecraft.Client/Common/UI/UIControl_List.h index ac536871..59523251 100644 --- a/Minecraft.Client/Common/UI/UIControl_List.h +++ b/Minecraft.Client/Common/UI/UIControl_List.h @@ -4,6 +4,9 @@ class UIControl_List : public UIControl_Base { +private: + std::vector m_list; + protected: IggyName m_removeAllItemsFunc, m_funcHighlightItem, m_funcRemoveItem, m_funcCanTouchFocus, m_funcSetTouchFocus, m_funcCanTouchTrigger, m_funcEnableItem, m_funcSetItemLabel, m_funcGetItemLabel; @@ -37,4 +40,6 @@ public: bool CanTouchTrigger(S32 iX, S32 iY); void addElement(eUIControlType type, int index); + + int getListIndex(int id); }; diff --git a/Minecraft.Client/Common/UI/UIControl_MultiList.cpp b/Minecraft.Client/Common/UI/UIControl_MultiList.cpp index 9daa0260..47b096dc 100644 --- a/Minecraft.Client/Common/UI/UIControl_MultiList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_MultiList.cpp @@ -31,7 +31,6 @@ void UIControl_MultiList::AddNewLabel(UIString label) m_label = label; IggyDataValue result; - IggyDataValue value[1]; IggyStringUTF16 stringVal; stringVal.string = (IggyUTF16*)label.c_str(); @@ -47,7 +46,6 @@ void UIControl_MultiList::AddNewLabel(UIString label) void UIControl_MultiList::AddNewButton(UIString label, int id) { IggyDataValue result; - IggyDataValue value[2]; IggyStringUTF16 stringVal; stringVal.string = (IggyUTF16*)label.c_str(); @@ -94,7 +92,6 @@ void UIControl_MultiList::AddNewSlider(UIString label, int id, int min, int max, m_current = current; IggyDataValue result; - IggyDataValue value[5]; value[0].type = IGGY_DATATYPE_string_UTF16; @@ -142,23 +139,95 @@ void UIControl_MultiList::AddNewTextInput(UIString label, int id) } void UIControl_MultiList::IsCheckbox(UIString label, int id, bool checked) -{ -} - -void UIControl_MultiList::SetCheckbox(UIString label, int id, bool checked) { //return UIControl_List::istype(a1, 2, a2); } -void UIControl_MultiList::GetCheckbox(UIString label, int id, bool checked) +void UIControl_MultiList::SetCheckboxValue(int id, bool checked, bool applyImmediately) { +/* + if (applyImmediately) + { +*/ + int listIndex = UIControl_List::getListIndex(id); + + IggyDataValue result; + IggyDataValue value[2]; + + value[0].type = IGGY_DATATYPE_number; + value[0].number = listIndex; + + value[1].type = IGGY_DATATYPE_boolean; + value[1].boolval = checked; + + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetCheckBox, 2, value); +/* + } + else + { + UIControl_List::GenericPendingUpdate* update = new UIControl_List::GenericPendingUpdate(); + + update->id = id; + update->control = this; + update->checked = checked; + + m_pendingUpdates.push_back(update); + } +*/ } -void UIControl_MultiList::SetSliderValue(UIString label, int id, bool checked) +bool UIControl_MultiList::GetCheckboxValue(int index) { + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_number; + value[0].number = UIControl_List::getListIndex(index); + + IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetCheckBox, 1, value); + return result.boolval == 1; } -void UIControl_MultiList::GetSliderValue(UIString label, int id, bool checked) +void UIControl_MultiList::SetSliderValue(int index, int value2, bool applyImmediately) { +/* + if (applyImmediately) + { +*/ + int listIndex = UIControl_List::getListIndex(index); + + IggyDataValue result; + IggyDataValue value[2]; + + value[0].type = IGGY_DATATYPE_number; + value[0].number = listIndex; + + value[1].type = IGGY_DATATYPE_number; + value[1].number = value2; + + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetSliderValue, 2, value); +/* + } + else + { + UIControl_List::GenericPendingUpdate* update = new UIControl_List::GenericPendingUpdate(); + + update->itemIndex = index; + update->control = this; + update->value2 = value2; + + m_pendingUpdates.push_back(update); + } +*/ } +int UIControl_MultiList::GetSliderValue(int index) +{ + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_number; + value[0].number = UIControl_List::getListIndex(index); + + IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetSliderValue, 1, value); + + return result.number; +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_MultiList.h b/Minecraft.Client/Common/UI/UIControl_MultiList.h index 988a3d84..214d94d2 100644 --- a/Minecraft.Client/Common/UI/UIControl_MultiList.h +++ b/Minecraft.Client/Common/UI/UIControl_MultiList.h @@ -25,8 +25,8 @@ public: void AddNewSlider(UIString label, int id, int min, int max, int current); void AddNewTextInput(UIString label, int id); void IsCheckbox(UIString label, int id, bool checked); - void SetCheckbox(UIString label, int id, bool checked); - void GetCheckbox(UIString label, int id, bool checked); - void SetSliderValue(UIString label, int id, bool checked); - void GetSliderValue(UIString label, int id, bool checked); + void SetCheckboxValue(int id, bool checked, bool applyImmediately); + bool GetCheckboxValue(int index); + void SetSliderValue(int index, int value2, bool applyImmediately); + int GetSliderValue(int index); }; diff --git a/Minecraft.Client/Common/UI/UIControl_list.cpp b/Minecraft.Client/Common/UI/UIControl_list.cpp index 2bc992a9..a4e8e256 100644 --- a/Minecraft.Client/Common/UI/UIControl_list.cpp +++ b/Minecraft.Client/Common/UI/UIControl_list.cpp @@ -135,6 +135,17 @@ void UIControl_List::addElement(eUIControlType type, int index) //m_elementCount++; - UIControl::setControlType(type); + //UIControl::setControlType(type); //m_elements.push_back(index); +} + +int UIControl_List::getListIndex(int id) +{ + for (auto it = m_list.begin(); it != m_list.end(); ++it) + { + if (*it == id) + return std::distance(m_list.begin(), it); + } + + return -1; } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index 68e06cf2..565d7eed 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -43,7 +43,7 @@ int UIScene_SettingsGraphicsMenu::m_iGraphicsModeTitleSettingA[4]= int UIScene_SettingsGraphicsMenu::LevelToDistance(int level) { - static const int table[5] = {2,4,8,16,32}; + static const int table[4] = {2,4,8,16}; if(level < 0) level = 0; if(level > 4) level = 4; return table[level]; @@ -51,7 +51,7 @@ int UIScene_SettingsGraphicsMenu::LevelToDistance(int level) int UIScene_SettingsGraphicsMenu::DistanceToLevel(int dist) { - static const int table[5] = {2,4,8,16,32}; + static const int table[4] = {2,4,8,16}; for(int i = 0; i < 5; i++){ if(table[i] == dist) return i; @@ -99,7 +99,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD m_qualityOptionsList.AddNewCheckbox(app.GetString(IDS_CHECKBOX_RENDER_BEDROCKFOG),eControl_BedrockFog,(app.GetGameSettings(m_iPad,eGameSetting_BedrockFog)!=0)); int currentGraphics = app.GetGameSettings(m_iPad, eGameSetting_GraphicsMode); - swprintf(TempString, 256, L"%ls %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_GraphicsMode)])); + swprintf(TempString, 256, L"%ls: %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_GraphicsMode)])); m_qualityOptionsList.AddNewSlider(TempString, eControl_GraphicsMode, 0, 3, currentGraphics); /* @@ -318,7 +318,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal app.SetGameSettings(m_iPad, eGameSetting_GraphicsMode, value); - swprintf(TempString, 256, L"%ls %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[value])); + swprintf(TempString, 256, L"%ls: %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[value])); m_sliderGraphicsMode.setLabel(TempString); }