From 0132d3b5e20fb0bd5d5e787b18509fab109b4796 Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Thu, 14 Sep 2023 22:52:14 -0400 Subject: [PATCH] [Difficulty Enhancement] Tree Stick Drops (#3171) * Tree Stick Drops * Removed Unneeded i * formatting blunder * Stick Lottery * Change rand functions --------- Co-authored-by: Garrett Cox --- soh/soh/SohMenuBar.cpp | 2 ++ soh/src/code/z_en_item00.c | 2 +- soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 60370736c..ce2777fcd 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -652,6 +652,8 @@ void DrawEnhancementsMenu() { UIWidgets::PaddedEnhancementCheckbox("Enable Bombchu Drops", "gBombchuDrops", true, false, forceEnableBombchuDrops, forceEnableBombchuDropsText, UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Bombchus will sometimes drop in place of bombs"); + UIWidgets::PaddedEnhancementCheckbox("Trees Drop Sticks", "gTreeStickDrops", true, false); + UIWidgets::Tooltip("Bonking into trees will have a chance to drop up to 3 sticks. Must already have obtained sticks."); UIWidgets::PaddedEnhancementCheckbox("No Heart Drops", "gNoHeartDrops", true, false); UIWidgets::Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series"); UIWidgets::PaddedEnhancementCheckbox("Hyper Bosses", "gHyperBosses", true, false); diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index 9d2b2dd74..fc8bbd669 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -1523,7 +1523,7 @@ s16 func_8001F404(s16 dropId) { if (LINK_IS_ADULT) { if (dropId == ITEM00_SEEDS) { dropId = ITEM00_ARROWS_SMALL; - } else if (dropId == ITEM00_STICK) { + } else if ((dropId == ITEM00_STICK) && !(CVarGetInteger("gTreeStickDrops", 0))) { dropId = ITEM00_RUPEE_GREEN; } } else { diff --git a/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 6f4b496e7..4adb7afe7 100644 --- a/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -322,6 +322,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { Vec3f dropsSpawnPt; s32 i; s32 leavesParams; + s32 numDrops; // Despawn extra trees in a group if out of range if ((this->spawnType == WOOD_SPAWN_SPAWNED) && (this->actor.parent != NULL)) { @@ -351,7 +352,13 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { dropsSpawnPt = this->actor.world.pos; dropsSpawnPt.y += 200.0f; - if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { + if ((this->unk_14C >= 0) && (this->unk_14C < 0x64) && (CVarGetInteger("gTreeStickDrops", 0)) && !(INV_CONTENT(ITEM_STICK) == ITEM_NONE)) { + (numDrops = (Rand_ZeroOne() * 4)); + for (i = 0; i < numDrops; ++i) { + Item_DropCollectible(play, &dropsSpawnPt, ITEM00_STICK); + } + } else { + if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { Item_DropCollectibleRandom(play, &this->actor, &dropsSpawnPt, this->unk_14C << 4); } else { if (this->actor.home.rot.z != 0) { @@ -360,6 +367,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, 0, this->actor.world.rot.y, 0, this->actor.home.rot.z, true); this->actor.home.rot.z = 0; + } } }