From d6c512904bee3563dd559682febc8c8a16ba98cc Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Wed, 3 Apr 2024 21:11:13 -0400 Subject: [PATCH] vb target in woods (#95) * do some target in woods VB stuff * skip deku scrub hopping out animation * replace a couple IS_RANDOs * cleanup --- .../game-interactor/GameInteractor.h | 2 + .../Enhancements/randomizer/hook_handlers.cpp | 1 + .../Enhancements/timesaver_hook_handlers.cpp | 8 ++++ .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c | 3 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 40 ++++++++----------- 5 files changed, 29 insertions(+), 25 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 478f82712..c61a82760 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -290,6 +290,8 @@ typedef enum { GI_VB_GIVE_ITEM_FROM_MAN_ON_ROOF, // Opt: *EnSyatekiMan GI_VB_GIVE_ITEM_FROM_SHOOTING_GALLERY, + // Opt: *EnExItem + GI_VB_GIVE_ITEM_FROM_TARGET_IN_WOODS, GI_VB_GIVE_ITEM_FAIRY_OCARINA, GI_VB_GIVE_ITEM_WEIRD_EGG, diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 35031690e..ea3755a69 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -767,6 +767,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void case GI_VB_TRADE_TIMER_EYEDROPS: case GI_VB_TRADE_TIMER_FROG: case GI_VB_ANJU_SET_OBTAINED_TRADE_ITEM: + case GI_VB_GIVE_ITEM_FROM_TARGET_IN_WOODS: case GI_VB_GIVE_ITEM_FROM_GORON: case GI_VB_GIVE_ITEM_FROM_LAB_DIVE: case GI_VB_GIVE_ITEM_FROM_SKULL_KID_SARIAS_SONG: diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 02decd7ba..8e733b427 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -296,6 +296,14 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* *should = false; break; } + case ACTOR_EN_EX_ITEM: { + *should = false; + break; + } + case ACTOR_EN_DNT_NOMAL: { + *should = false; + break; + } case ACTOR_EN_TA: case ACTOR_DOOR_SHUTTER: case ACTOR_BG_ICE_SHUTTER: diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index f96c93695..102a904cf 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/soh/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -12,6 +12,7 @@ #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "objects/object_hintnuts/object_hintnuts.h" #include "vt.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED) @@ -252,7 +253,7 @@ void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play) { if (!LINK_IS_ADULT && !Flags_GetItemGetInf(ITEMGETINF_1D)) { this->hitCounter++; if (this->hitCounter >= 3) { - if(IS_RANDO) { + if (!GameInteractor_Should(GI_VB_PLAY_ONEPOINT_ACTOR_CS, true, &this->actor)) { this->actionFunc = EnDntNomal_TargetGivePrize; } else { OnePointCutscene_Init(play, 4140, -99, &this->actor, MAIN_CAM); diff --git a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index 03b343527..32f50d9e1 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "vt.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED) @@ -376,7 +377,7 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, -0x4000, 5, 0x1000, 0); } - if (!IS_RANDO && this->timer != 0) { + if (GameInteractor_Should(GI_VB_PLAY_ONEPOINT_ACTOR_CS, true, &this->actor) && this->timer != 0) { if (this->prizeRotateTimer != 0) { tmpf1 = play->view.lookAt.x - play->view.eye.x; tmpf2 = play->view.lookAt.y - 10.0f - play->view.eye.y; @@ -396,50 +397,41 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play) { this->actor.world.pos.z += (tmpf3 / tmpf4) * 5.0f; } } else { - GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE; s32 getItemId; this->actor.draw = NULL; Player_SetCsActionWithHaltedActors(play, NULL, 7); this->actor.parent = NULL; - if (IS_RANDO) { + + if (!GameInteractor_Should(GI_VB_PLAY_ONEPOINT_ACTOR_CS, true, &this->actor)) { GET_PLAYER(play)->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD); - getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TARGET_IN_WOODS, GI_BULLET_BAG_50); - getItemId = getItemEntry.getItemId; - } else { - if (CUR_UPG_VALUE(UPG_BULLET_BAG) == 1) { - getItemId = GI_BULLET_BAG_40; - } else { - getItemId = GI_BULLET_BAG_50; - } } - if (!IS_RANDO || getItemEntry.getItemId == GI_NONE) { - Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f); + if (CUR_UPG_VALUE(UPG_BULLET_BAG) == 1) { + getItemId = GI_BULLET_BAG_40; } else { - GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f); + getItemId = GI_BULLET_BAG_50; } + + if (GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_TARGET_IN_WOODS, true, &this->actor)) { + Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f); + } + this->actionFunc = EnExItem_TargetPrizeGive; } } void EnExItem_TargetPrizeGive(EnExItem* this, PlayState* play) { - if (Actor_HasParent(&this->actor, play)) { + if (Actor_HasParent(&this->actor, play) || !GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_TARGET_IN_WOODS, true, &this->actor)) { this->actionFunc = EnExItem_TargetPrizeFinish; } else { - if (!IS_RANDO) { - s32 getItemId = (CUR_UPG_VALUE(UPG_BULLET_BAG) == 2) ? GI_BULLET_BAG_50 : GI_BULLET_BAG_40; - Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f); - } else { - GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TARGET_IN_WOODS, GI_BULLET_BAG_50); - GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f); - } - + s32 getItemId = (CUR_UPG_VALUE(UPG_BULLET_BAG) == 2) ? GI_BULLET_BAG_50 : GI_BULLET_BAG_40; + Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f); } } void EnExItem_TargetPrizeFinish(EnExItem* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { + if (!GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_TARGET_IN_WOODS, true, &this->actor) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // "Successful completion" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); Flags_SetItemGetInf(ITEMGETINF_1D);