shithub: zelda3

Download patch

ref: 39c5060cbe8fcf7a5d48c62573ca22e81ab0d91d
parent: 3a080d6bb30e702458d09c21abe19af808fbdc26
author: Snesrev <[email protected]>
date: Fri Oct 7 20:51:09 EDT 2022

Fix so super bomb won't return to the player on screen change (#126)

Bug report:
A ticking super bomb will cancel and teleport back to you
as a follower if you do any of these at count 0:
(1) change screen via walking, mirror, or bird travel
(2) fill all ancillary slots
(3) die with a bottled faerie.

--- a/ancilla.c
+++ b/ancilla.c
@@ -5377,7 +5377,10 @@
   }
   if (ancilla_item_to_link[k] == 3 && ancilla_arr3[k] == 1) {
     Bomb_CheckForDestructibles(Ancilla_GetX(k), Ancilla_GetY(k), 0); // r14?
-    follower_indicator = 0;
+
+    // Changed so this is reset elsewhere
+    if (!(enhanced_features0 & kFeatures0_MiscBugFixes))
+      follower_indicator = 0;
   }
 }
 
@@ -6086,7 +6089,7 @@
   Player_TileDetectNearby();
 }
 
-void AncillaAdd_SuperBombExplosion(uint8 a, uint8 y) {  // 898df9
+int AncillaAdd_SuperBombExplosion(uint8 a, uint8 y) {  // 898df9
   int k = Ancilla_AddAncilla(a, y);
   if (k >= 0) {
     ancilla_R[k] = 0;
@@ -6100,6 +6103,7 @@
     int x = tagalong_x_lo[j] | tagalong_x_hi[j] << 8;
     Ancilla_SetXY(k, x + 8, y + 16);
   }
+  return k;
 }
 
 void ConfigureRevivalAncillae() {  // 898e4e
--- a/ancilla.h
+++ b/ancilla.h
@@ -219,7 +219,7 @@
 void AncillaAdd_ExplodingWeatherVane(uint8 a, uint8 y);
 void AncillaAdd_CutsceneDuck(uint8 a, uint8 y);
 void AncillaAdd_SomariaPlatformPoof(int k);
-void AncillaAdd_SuperBombExplosion(uint8 a, uint8 y);
+int AncillaAdd_SuperBombExplosion(uint8 a, uint8 y);
 void ConfigureRevivalAncillae();
 void AncillaAdd_LampFlame(uint8 a, uint8 y);
 void AncillaAdd_MSCutscene(uint8 a, uint8 y);
--- a/tagalong.c
+++ b/tagalong.c
@@ -426,8 +426,23 @@
     Tagalong_Draw();
   } else {
     if (follower_indicator == 13 && !player_is_indoors && !super_bomb_indicator_unk2) {
-      AncillaAdd_SuperBombExplosion(0x3a, 0);
-      follower_dropped = 0;
+      // Fixed so we wait a little bit if we can't spawn the ancilla
+      if (AncillaAdd_SuperBombExplosion(0x3a, 0) >= 0) {
+        follower_dropped = 0;
+
+        // A ticking super bomb will cancel and teleport back to you as a follower if you do
+        // any of these at count 0: (1) change screen via walking, mirror, or bird travel
+        // (2) fill all ancillary slots
+        // (3) die with a bottled faerie.
+        // Fixed this by clearing the follower indicator here, instead of in the ancilla
+        // bomb code.
+        if (enhanced_features0 & kFeatures0_MiscBugFixes) {
+          follower_indicator = 0;
+          return;
+        }
+      } else {
+        super_bomb_indicator_unk1 = 1;
+      }
     }
     Follower_DoLayers();
   }
@@ -650,8 +665,11 @@
   if (pal == 7 && overworld_palette_swap_flag)
     pal = 0;
 
-  if (follower_indicator == 13 && super_bomb_indicator_unk2 == 1)
-    pal = (frame_counter & 7);
+  if (follower_indicator == 13) {
+    // Display colorful superbomb palette also on frame 0.
+    if (enhanced_features0 & kFeatures0_MiscBugFixes ? (super_bomb_indicator_unk2 <= 1) : (super_bomb_indicator_unk2 == 1))
+     pal = (frame_counter & 7);
+  }
 
   const TagalongSprXY *sprd = kTagalongDraw_SprXY + frame + (kTagalongDraw_Offs[follower_indicator] >> 3);
   const TagalongDmaFlags *sprf = kTagalongDmaAndFlags + frame;