Skip to content

Commit

Permalink
Heart Spawner
Browse files Browse the repository at this point in the history
  • Loading branch information
Caladius committed Nov 29, 2024
1 parent a92c08d commit 5e36f52
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions soh/soh/Enhancements/mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -1442,4 +1457,5 @@ void InitMods() {
RegisterHurtContainerModeHandler();
RegisterPauseMenuHooks();
RandoKaleido_RegisterHooks();
RegisterHeartSpawner();
}
1 change: 1 addition & 0 deletions soh/soh/Enhancements/mods.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ void UpdateHyperBossesState();
void InitMods();
void UpdatePatchHand();
void SwitchAge();
void RegisterHeartSpawner();

#ifdef __cplusplus
}
Expand Down
7 changes: 7 additions & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 5e36f52

Please sign in to comment.