shithub: zelda3

Download patch

ref: 9b608eb53acb868e11d49c6dd356e4dcac920341
parent: d44f55b337b4b6e6e00ef698f656e17655694d24
author: Snesrev <snesrev@protonmail.com>
date: Fri Oct 7 13:53:23 EDT 2022

Cane of Somaria didn't reset a variable when out of magic (#126)

Bug report:
If you use the Cane of Somaria with an empty magic meter,
then quickly switch to the mushroom or magic powder after
the "no magic" prompt, you will automatically sprinkle
magic powder despite pressing no button and having no magic.

--- a/player.c
+++ b/player.c
@@ -3262,8 +3262,11 @@
     int i = 4;
     while (ancilla_type[i] != 0x2c) {
       if (--i < 0) {
-        if (!LinkCheckMagicCost(4))
+        if (!LinkCheckMagicCost(4)) {
+          if (enhanced_features0 & kFeatures0_MiscBugFixes)
+            goto out;
           return;
+        }
         break;
       }
     }
@@ -3289,8 +3292,9 @@
   player_handler_timer = 0;
   link_delay_timer_spin_attack = 0;
   link_debug_value_2 = 0;
-  button_mask_b_y &= ~0x40;
   link_position_mode &= ~8;
+out:
+  button_mask_b_y &= ~0x40;
 }
 
 void LinkItem_CaneOfByrna() {  // 87af3e