From 01d217acb5477bd2d37778e286a64d5f60c9c3e1 Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Sun, 26 Apr 2026 04:12:09 -0700 Subject: [PATCH] patch flight by fowl top chest to not always start closed --- include/d/actor/d_a_tbox2.h | 3 ++ src/d/actor/d_a_tbox2.cpp | 39 +++++++++++++++++++ .../generator/data/actor_patches.yaml | 23 +++++++++++ 3 files changed, 65 insertions(+) diff --git a/include/d/actor/d_a_tbox2.h b/include/d/actor/d_a_tbox2.h index 3f176ade5e..0d3dee274f 100644 --- a/include/d/actor/d_a_tbox2.h +++ b/include/d/actor/d_a_tbox2.h @@ -64,6 +64,9 @@ public: virtual int Delete(); virtual BOOL checkSmallTbox() { return true; } +#if TARGET_PC + u8 getTboxNo() { return fopAcM_GetParamBit(this, 16, 8);} +#endif u8 getModelType() { return fopAcM_GetParamBit(this, 8, 4); } u8 getItemNo() { return fopAcM_GetParamBit(this, 0, 8); } diff --git a/src/d/actor/d_a_tbox2.cpp b/src/d/actor/d_a_tbox2.cpp index f2ac844bce..56df7b09ec 100644 --- a/src/d/actor/d_a_tbox2.cpp +++ b/src/d/actor/d_a_tbox2.cpp @@ -10,6 +10,8 @@ #include "d/actor/d_a_midna.h" #include +#include "dusk/randomizer/game/verify_item_functions.h" + void daTbox2_c::initBaseMtx() { mpModel->setBaseScale(scale); setBaseMtx(); @@ -67,6 +69,24 @@ static dCcD_SrcCyl l_cyl_src = { }; int daTbox2_c::Create() { +#if TARGET_PC + // If the flag for this box is set, open it + u8 tboxId = getTboxNo(); + if (tboxId != 0xFF && dComIfGs_isTbox(tboxId)) { + // Set the action for not allowing the player to open it + init_actionWait(); + // Set the animation frame to open + mpBck->setFrame(mpBck->getEndFrame()); + // Set collision to open + if (mpBgW != NULL) { + dComIfG_Bgsp().Release(mpBgW); + } + + if (mBoxBgW != NULL) { + dComIfG_Bgsp().Regist(mBoxBgW, this); + } + } else +#endif init_actionOpenWait(); initBaseMtx(); fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); @@ -138,6 +158,19 @@ int daTbox2_c::create1st() { fopAcM_ct(this, daTbox2_c); mModelType = getModelType(); +#if TARGET_PC + if (randomizer_IsActive()) { + // Get the override item for this chest + auto stage = dComIfGp_getStartStageName(); + u8 tboxId = getTboxNo(); + u8 itemId = randomizer_GetContext().mTreasureChestOverrides[stage][tboxId]; + // Set the item in the params + u32 params = fopAcM_GetParam(this); + params &= 0xFFFFFF00; + params |= verifyProgressiveItem(itemId); + fopAcM_SetParam(this, params); + } +#endif int phase_state = dComIfG_resLoad(&mPhase, l_arcName); if (phase_state == cPhs_COMPLEATE_e) { u32 heap_size; @@ -375,6 +408,12 @@ int daTbox2_c::setGetDemoItem() { if (mReturnRupee) { partner_id = fopAcM_createItemForPresentDemo(¤t.pos, item_no, 1, -1, -1, NULL, NULL); } else { +#if TARGET_PC + u8 tboxId = getTboxNo(); + if (tboxId != 0xFF) { + dComIfGs_onTbox(tboxId); + } +#endif partner_id = fopAcM_createItemForTrBoxDemo(¤t.pos, item_no, -1, -1, NULL, NULL); } diff --git a/src/dusk/randomizer/generator/data/actor_patches.yaml b/src/dusk/randomizer/generator/data/actor_patches.yaml index 06de7d654c..b21a7d38f0 100644 --- a/src/dusk/randomizer/generator/data/actor_patches.yaml +++ b/src/dusk/randomizer/generator/data/actor_patches.yaml @@ -160,6 +160,29 @@ F_SP113: - 0 - 2 +# Lake Hylia +F_SP115: + # Room 0 - Main Lake + 0: + # Chest at the top of isle of riches + - name: tboxEL1 + parameters: 0x00000106 + position: + x: -102523.015625 + y: -16646.677734375 + z: 43291.4296875 + angle: + x: 0x0000 + y: 0xA16D + z: 0x0000 + patch: # Give it a unique tbox id + parameters: 0x00190106 + layers: + - 1 + - 2 + - 3 + - 4 + # Sacred Grove F_SP117: # Room 1 - Pedestal of Time