shithub: zelda3

Download patch

ref: 3f52f05e03878801129119c8d08927db6d110a69
parent: 73a7155f7f77816312e2c05ef0559fe520aba6c9
author: Snesrev <snesrev@protonmail.com>
date: Sat Oct 8 23:36:55 EDT 2022

Submodule got overwritten if using staircase when trapdoors opening (#126)

Bug report:
If you use a staircase on the same frame that a door opens,
enemy spawns shift into different rooms and doors start
acting funny until you leave the dungeon or use the mirror.

--- a/dungeon.c
+++ b/dungeon.c
@@ -4284,6 +4284,14 @@
 void Dungeon_HandleRoomTags() {  // 81c2fd
   if (!flag_skip_call_tag_routines) {
     Dungeon_DetectStaircase();
+
+    // Dungeon_DetectStaircase might change the submodule, so avoid
+    // calling the tag routines cause they could also change the submodule,
+    // causing items to spawn in incorrect locations cause link_x/y_coord gets
+    // out of sync if you enter a staircase exactly when a room tag triggers.
+    if (enhanced_features0 & kFeatures0_MiscBugFixes && submodule_index != 0)
+      return;
+
     g_ram[14] = 0;
     kDungTagroutines[dung_hdr_tag[0]](0);
     g_ram[14] = 1;