diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index ca44cf59c..6225cb1b5 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -365,6 +365,8 @@ typedef enum { VB_GIVE_ITEM_FROM_THAWING_KING_ZORA, // Opt: *EnGo2 VB_GIVE_ITEM_FROM_GORON, + // Opt: *EnGb + VB_GIVE_ITEM_FROM_POE_COLLECTOR, // Opt: *EnJs VB_CHECK_RANDO_PRICE_OF_CARPET_SALESMAN, VB_GIVE_ITEM_FROM_CARPET_SALESMAN, diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index aefb5775f..bedfa5091 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -19,6 +19,7 @@ extern "C" { #include "src/overlays/actors/ovl_En_Cow/z_en_cow.h" #include "src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h" #include "src/overlays/actors/ovl_En_Dns/z_en_dns.h" +#include "src/overlays/actors/ovl_En_Gb/z_en_gb.h" #include "src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h" #include "src/overlays/actors/ovl_En_Ko/z_en_ko.h" #include "src/overlays/actors/ovl_En_Mk/z_en_mk.h" @@ -904,6 +905,16 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l *should = false; break; } + case VB_GIVE_ITEM_FROM_POE_COLLECTOR: { + EnGb* enGb = va_arg(args, EnGb*); + if (!Flags_GetRandomizerInf(RAND_INF_10_BIG_POES)) { + Flags_SetRandomizerInf(RAND_INF_10_BIG_POES); + enGb->dyna.actor.parent = NULL; + enGb->actionFunc = func_80A2FC0C; + *should = false; + } + break; + } case VB_CHECK_RANDO_PRICE_OF_CARPET_SALESMAN: { if (EnJs_RandoCanGetCarpetMerchantItem()){ *should = gSaveContext.rupees < OTRGlobals::Instance->gRandoContext->GetItemLocation(RC_WASTELAND_BOMBCHU_SALESMAN)->GetPrice(); diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c index fb37cf0af..8fd732aeb 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -7,6 +7,7 @@ #include "z_en_gb.h" #include "objects/object_ps/object_ps.h" #include "soh/frame_interpolation.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) @@ -337,10 +338,7 @@ void func_80A2FA50(EnGb* this, PlayState* play) { Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE); Rupees_ChangeBy(50); HIGH_SCORE(HS_POE_POINTS) += 100; - if ( - (!IS_RANDO && HIGH_SCORE(HS_POE_POINTS) != 1000) || - (IS_RANDO && (HIGH_SCORE(HS_POE_POINTS) != 1000 || Flags_GetRandomizerInf(RAND_INF_10_BIG_POES))) - ) { + if (HIGH_SCORE(HS_POE_POINTS) != 1000) { if (HIGH_SCORE(HS_POE_POINTS) > 1100) { HIGH_SCORE(HS_POE_POINTS) = 1100; } @@ -348,7 +346,6 @@ void func_80A2FA50(EnGb* this, PlayState* play) { } else { Player* player = GET_PLAYER(play); - Flags_SetRandomizerInf(RAND_INF_10_BIG_POES); player->exchangeItemId = EXCH_ITEM_NONE; this->textId = 0x70F8; Message_ContinueTextbox(play, this->textId); @@ -359,13 +356,10 @@ void func_80A2FA50(EnGb* this, PlayState* play) { void func_80A2FB40(EnGb* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { - if (!IS_RANDO) { + if (GameInteractor_Should(VB_GIVE_ITEM_FROM_POE_COLLECTOR, true, this)) { Actor_OfferGetItem(&this->dyna.actor, play, GI_BOTTLE, 100.0f, 10.0f); - } else { - GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_10_BIG_POES, GI_BOTTLE); - GiveItemEntryFromActor(&this->dyna.actor, play, getItemEntry, 100.0f, 10.0f); + this->actionFunc = func_80A2FBB0; } - this->actionFunc = func_80A2FBB0; } } @@ -373,13 +367,9 @@ void func_80A2FBB0(EnGb* this, PlayState* play) { if (Actor_HasParent(&this->dyna.actor, play)) { this->dyna.actor.parent = NULL; this->actionFunc = func_80A2FC0C; - } else { - if (!IS_RANDO) { - Actor_OfferGetItem(&this->dyna.actor, play, GI_BOTTLE, 100.0f, 10.0f); - } else { - GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_10_BIG_POES, GI_BOTTLE); - GiveItemEntryFromActor(&this->dyna.actor, play, getItemEntry, 100.0f, 10.0f); - } + } + else { + Actor_OfferGetItem(&this->dyna.actor, play, GI_BOTTLE, 100.0f, 10.0f); } } diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h index 261b51797..6df73808e 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -47,4 +47,6 @@ typedef struct EnGb { /* 0x0388 */ EnGbCagedSoul cagedSouls[4]; } EnGb; // size = 0x0438 +void func_80A2FC0C(EnGb* actor, PlayState* play); + #endif