From e0d4a2ecd88c8fb76b81a82ebc9afea39ad9ebfc Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:45:52 +0100 Subject: [PATCH] Fix vanilla --- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index a0b8af52d..2fb9623dd 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -315,12 +315,28 @@ void KaleidoScope_HandleItemCycleExtras(PlayState* play, u8 slot, bool canCycle, } } +bool CanMaskSelect() { + if (IS_RANDO) { + return CVarGetInteger(CVAR_ENHANCEMENT("MaskSelect"), 0) /* || Randomizer_GetSettingValue(RSK_SHUFFLE_CHILD_TRADE) */; + } + + // only allow mask select when: + // the shop is open: + // * zelda's letter check: Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) + // * kak gate check: Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD) + // and the mask quest is complete: Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE) + return CVarGetInteger(CVAR_ENHANCEMENT("MaskSelect"), 0) && + Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE) && + Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) && + Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD); +} + void KaleidoScope_HandleItemCycles(PlayState* play) { //handle the mask select KaleidoScope_HandleItemCycleExtras( play, SLOT_TRADE_CHILD, - CVarGetInteger(CVAR_ENHANCEMENT("MaskSelect"), 0) /* || Randomizer_GetSettingValue(RSK_SHUFFLE_CHILD_TRADE) */, + CanMaskSelect(), IS_RANDO ? Randomizer_GetPrevChildTradeItem() : ( @@ -374,7 +390,7 @@ void KaleidoScope_DrawItemCycles(PlayState* play) { KaleidoScope_DrawItemCycleExtras( play, SLOT_TRADE_CHILD, - CVarGetInteger(CVAR_ENHANCEMENT("MaskSelect"), 0) /* || Randomizer_GetSettingValue(RSK_SHUFFLE_CHILD_TRADE) */, + CanMaskSelect(), IS_RANDO ? Randomizer_GetPrevChildTradeItem() : (