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.
This commit is contained in:
Malkierian 2024-10-20 23:49:32 -07:00 committed by GitHub
parent b2e99b8ff5
commit 4663bd152a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 17 deletions

View File

@ -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,

View File

@ -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();

View File

@ -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);
}
}

View File

@ -47,4 +47,6 @@ typedef struct EnGb {
/* 0x0388 */ EnGbCagedSoul cagedSouls[4];
} EnGb; // size = 0x0438
void func_80A2FC0C(EnGb* actor, PlayState* play);
#endif