From 5e36f52f2a8a3c1d5cfdc14adf1f140b42de78f6 Mon Sep 17 00:00:00 2001 From: Caladius Date: Fri, 29 Nov 2024 00:10:16 -0500 Subject: [PATCH] Heart Spawner --- soh/soh/Enhancements/mods.cpp | 16 ++++++++++++++++ soh/soh/Enhancements/mods.h | 1 + soh/soh/SohMenuBar.cpp | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 0c11c79b2f8..0a03beba08d 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -1398,6 +1398,21 @@ void RegisterRandomizerCompasses() { PatchCompasses(); }); } +// Called in SoHMenuBar.cpp Line 1700 +void RegisterHeartSpawner() { + if (!gPlayState) { + return; + } + + Player* player = GET_PLAYER(gPlayState); + + Vec3f_ positional = player->actor.world.pos; + positional.y = player->actor.world.pos.y + 100.0f; // Change the 100.0f to make its start spawn higher + EnItem00* actor = Item_DropCollectible(gPlayState, &positional, ITEM00_HEART_PIECE); // Change this to be your spawned item + actor->actor.speedXZ = Rand_CenteredFloat(5.0f) + 8.0f; // Speed it spawns at, higher = farther from link +} + + void InitMods() { BossRush_RegisterHooks(); @@ -1442,4 +1457,5 @@ void InitMods() { RegisterHurtContainerModeHandler(); RegisterPauseMenuHooks(); RandoKaleido_RegisterHooks(); + RegisterHeartSpawner(); } diff --git a/soh/soh/Enhancements/mods.h b/soh/soh/Enhancements/mods.h index 9305222502a..d46fa85168c 100644 --- a/soh/soh/Enhancements/mods.h +++ b/soh/soh/Enhancements/mods.h @@ -18,6 +18,7 @@ void UpdateHyperBossesState(); void InitMods(); void UpdatePatchHand(); void SwitchAge(); +void RegisterHeartSpawner(); #ifdef __cplusplus } diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index a133a8ef995..4fbaaaf7b8f 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1695,6 +1695,13 @@ void DrawEnhancementsMenu() { mTimeSplitWindow->ToggleVisibility(); } } + + ImGui::Separator(); + // Change Button Name if desired, RegisterHeartSpawner() needs to be called for your event. + if (ImGui::Button("Spawn Heart Piece")) { + RegisterHeartSpawner(); + } + ImGui::PopStyleVar(3); ImGui::PopStyleColor(1);