summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authoraMannus <mannusmenting@gmail.com>2022-12-24 04:25:38 +0100
committerGitHub <noreply@github.com>2022-12-23 22:25:38 -0500
commit07bae6b84c6bfe244e6fa47b3a3c6cc86e36964c (patch)
tree3a354c4ea2e248bec587e95512c747971b134eba /soh/src/code
parent6eaf51c2bd8df14cf61221b572e018114e062d2e (diff)
Fix common enemy rando crashes (#2242)
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/z_actor.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c
index c4e89adf7..48ca8d414 100644
--- a/soh/src/code/z_actor.c
+++ b/soh/src/code/z_actor.c
@@ -3326,6 +3326,15 @@ Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play
return NULL;
}
+ // The following enemies break when the parent actor isn't the same as what would happen in authentic gameplay.
+ // As such, don't assign a parent to them at all when spawned with Enemy Randomizer.
+ // Gohma (z_boss_goma.c), the Stalchildren spawner (z_en_encount1.c) and the falling platform spawning Stalfos in
+ // Forest Temple (z_bg_mori_bigst.c) that normally rely on this behaviour are changed when
+ // Enemy Rando is on so they still work properly even without assigning a parent.
+ if (CVar_GetS32("gRandomizedEnemies", 0) && (spawnedActor->id == ACTOR_EN_FLOORMAS || spawnedActor->id == ACTOR_EN_PEEHAT)) {
+ return spawnedActor;
+ }
+
parent->child = spawnedActor;
spawnedActor->parent = parent;