diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 0a9e4d1ce..1220c9aed 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -147,6 +147,8 @@ namespace GameMenuBar { CVar_SetS32("gFastChests", 0); // Chest size & texture matches contents CVar_SetS32("gChestSizeAndTextureMatchesContents", 0); + // Chest size & texture matches contents only with agony + CVar_SetS32("gChestSizeDependsStoneOfAgony", 0); // Fast Drops CVar_SetS32("gFastDrops", 0); // Better Owl @@ -776,7 +778,6 @@ namespace GameMenuBar { UIWidgets::Tooltip("Kick open every chest"); UIWidgets::PaddedText("Chest size & texture matches contents", true, false); const char* chestSizeAndTextureMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only"}; - UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 4, 0); UIWidgets::Tooltip( "Chest sizes and textures are changed to help identify the item inside.\n" " - Major items: Large gold chests\n" @@ -786,6 +787,15 @@ namespace GameMenuBar { " - Boss keys: Vanilla size and texture\n" " - Skulltula Tokens: Small skulltula chest\n" ); + if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 4, 0)) { + if (CVar_GetS32("gChestSizeAndTextureMatchesContents", 0) == 0) { + CVar_SetS32("gChestSizeDependsStoneOfAgony", 0); + } + } + if (CVar_GetS32("gChestSizeAndTextureMatchesContents", 0) > 0) { + UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false); + UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony."); + } UIWidgets::PaddedEnhancementCheckbox("Skip Pickup Messages", "gFastDrops", true, false); UIWidgets::Tooltip("Skip pickup messages for new consumable items and bottle swipes"); UIWidgets::PaddedEnhancementCheckbox("Ask to Equip New Items", "gAskToEquip", true, false); @@ -1289,11 +1299,13 @@ namespace GameMenuBar { } UIWidgets::EnhancementCheckbox("Disable LOD", "gDisableLOD"); UIWidgets::Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance"); - UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance", true, false); + if (UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance", true, false)) { + if (CVar_GetS32("gDisableDrawDistance", 0) == 0) { + CVar_SetS32("gDisableKokiriDrawDistance", 0); + } + } UIWidgets::Tooltip("Turns off the objects draw distance, making objects being visible from a longer range"); - if (CVar_GetS32("gDisableDrawDistance", 0) == 0) { - CVar_SetS32("gDisableKokiriDrawDistance", 0); - } else if (CVar_GetS32("gDisableDrawDistance", 0) == 1) { + if (CVar_GetS32("gDisableDrawDistance", 0) == 1) { UIWidgets::PaddedEnhancementCheckbox("Kokiri Draw Distance", "gDisableKokiriDrawDistance", true, false); UIWidgets::Tooltip("The Kokiri are mystical beings that fade into view when approached\nEnabling this will remove their draw distance"); } diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index 93f67e5b8..c394b0a2b 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -227,7 +227,8 @@ namespace UIWidgets { } } - void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue) { + bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue) { + bool changed = false; if (FirstTimeValue <= 0) { FirstTimeValue = 0; } @@ -240,12 +241,14 @@ namespace UIWidgets { if (ImGui::Selectable(ComboArray[i], i == selected)) { CVar_SetS32(name, i); selected = i; + changed = true; SohImGui::RequestCvarSaveOnNextTick(); } } } ImGui::EndCombo(); } + return changed; } void PaddedText(const char* text, bool padTop, bool padBottom) { diff --git a/soh/soh/UIWidgets.hpp b/soh/soh/UIWidgets.hpp index fa25c727e..015761aa2 100644 --- a/soh/soh/UIWidgets.hpp +++ b/soh/soh/UIWidgets.hpp @@ -36,7 +36,7 @@ namespace UIWidgets { bool EnhancementCheckbox(const char* text, const char* cvarName, bool disabled = false, const char* disabledTooltipText = "", CheckboxGraphics disabledGraphic = CheckboxGraphics::Cross); bool PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "", CheckboxGraphics disabledGraphic = CheckboxGraphics::Cross); void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector& items, int defaultValue = 0); - void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue); + bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue); void PaddedText(const char* text, bool padTop = true, bool padBottom = true); void EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false); void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool padTop = true, bool padBottom = true); diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index b81313878..734f3af7e 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -619,9 +619,11 @@ void EnBox_Update(Actor* thisx, PlayState* play) { void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { EnBox_CreateExtraChestTextures(); int cvar = CVar_GetS32("gChestSizeAndTextureMatchesContents", 0); + int agonyCVar = CVar_GetS32("gChestSizeDependsStoneOfAgony", 0); + int stoneCheck = CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY); GetItemCategory getItemCategory; - if (play->sceneNum != SCENE_TAKARAYA && cvar > 0) { + if (play->sceneNum != SCENE_TAKARAYA && cvar > 0 && ((agonyCVar > 0 && stoneCheck) | agonyCVar == 0)) { getItemCategory = this->getItemEntry.getItemCategory; // If they don't have bombchu's yet consider the bombchu item major if (this->getItemEntry.gid == GID_BOMBCHU && INV_CONTENT(ITEM_BOMBCHU) != ITEM_BOMBCHU) { @@ -637,7 +639,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { } } - if (play->sceneNum != SCENE_TAKARAYA && (cvar == 1 || cvar == 3)) { + if (play->sceneNum != SCENE_TAKARAYA && (cvar == 1 || cvar == 3) && ((agonyCVar > 0 && stoneCheck) | agonyCVar == 0)) { switch (getItemCategory) { case ITEM_CATEGORY_JUNK: case ITEM_CATEGORY_SMALL_KEY: @@ -665,7 +667,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { } } - if (play->sceneNum != SCENE_TAKARAYA && (cvar == 1 || cvar == 2)) { + if (play->sceneNum != SCENE_TAKARAYA && (cvar == 1 || cvar == 2) && ((agonyCVar > 0 && stoneCheck) | agonyCVar == 0)) { switch (getItemCategory) { case ITEM_CATEGORY_MAJOR: this->boxBodyDL = gGoldTreasureChestChestFrontDL;