summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--soh/soh/Enhancements/mods.cpp34
-rw-r--r--soh/soh/SohMenuBar.cpp3
2 files changed, 37 insertions, 0 deletions
diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp
index c0bbb3806..008536257 100644
--- a/soh/soh/Enhancements/mods.cpp
+++ b/soh/soh/Enhancements/mods.cpp
@@ -1038,6 +1038,39 @@ void RegisterRandomizerSheikSpawn() {
});
}
+void RegisterRandomizedEnemySizes() {
+ GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) {
+ // Randomized Enemy Sizes
+ Player* player = GET_PLAYER(gPlayState);
+ Actor* actor = static_cast<Actor*>(refActor);
+
+ // Only apply to enemies and bosses. Exclude the wobbly platforms in Jabu because they need to act like platforms.
+ if (!CVarGetInteger("gRandomizedEnemySizes", 0) || (actor->category != ACTORCAT_ENEMY && actor->category != ACTORCAT_BOSS) || actor->id == ACTOR_EN_BROB) {
+ return;
+ }
+
+ float randomNumber;
+ float randomScale;
+
+ uint8_t bigActor = rand() % 2;
+
+ // Big actor. Dodongo and Volvagia are always smaller because they're impossible when bigger.
+ if (bigActor && actor->id != ACTOR_BOSS_DODONGO && actor->id != ACTOR_BOSS_FD &&
+ actor->id != ACTOR_BOSS_FD2) {
+ randomNumber = rand() % 200;
+ // Between 100% and 300% size.
+ randomScale = 1.0f + (randomNumber / 100);
+ // Small actor
+ } else {
+ randomNumber = rand() % 90;
+ // Between 10% and 100% size.
+ randomScale = 0.1f + (randomNumber / 100);
+ }
+
+ Actor_SetScale(actor, actor->scale.z * randomScale);
+ });
+}
+
void InitMods() {
RegisterTTS();
RegisterInfiniteMoney();
@@ -1065,5 +1098,6 @@ void InitMods() {
RegisterEnemyDefeatCounts();
RegisterAltTrapTypes();
RegisterRandomizerSheikSpawn();
+ RegisterRandomizedEnemySizes();
NameTag_RegisterHooks();
}
diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp
index 2a52006a4..dd202d02a 100644
--- a/soh/soh/SohMenuBar.cpp
+++ b/soh/soh/SohMenuBar.cpp
@@ -1115,6 +1115,9 @@ void DrawEnhancementsMenu() {
"- Random (Seeded): Enemies are randomized based on the current randomizer seed/file\n"
);
+ UIWidgets::PaddedEnhancementCheckbox("Randomized Enemy Sizes", "gRandomizedEnemySizes", true, false);
+ UIWidgets::Tooltip("Enemies and Bosses spawn with random sizes.");
+
UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false);
UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and "
"press the C-Buttons to use items and mess with Player 1!");