summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalkierian <malkierian@gmail.com>2024-10-20 23:49:32 -0700
committerGitHub <noreply@github.com>2024-10-20 23:49:32 -0700
commit4663bd152af155da0f3f922f5c751dce0bd2a8dd (patch)
tree6e64b3d2a57e4f48806867e7192edf7cb5d14591
parentb2e99b8ff5f17b70dac2d880087b6af7cada18bb (diff)
VBify poe collector giving for rando. (#4458)
* VBify poe collector giving for rando. * Forgot an include. * Further refinement so all the action happens in the handler. Virtual full restoration of vanilla code flow. * Restored 1000 point messages before rando item give. * Cleanup redundant GI Should call.
-rw-r--r--soh/soh/Enhancements/game-interactor/GameInteractor.h2
-rw-r--r--soh/soh/Enhancements/randomizer/hook_handlers.cpp11
-rw-r--r--soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c24
-rw-r--r--soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h2
4 files changed, 22 insertions, 17 deletions
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