shithub: zelda3

Download patch

ref: d9ec4b11e473a9202a28b127a5fd8105d022ef71
parent: aedf48a7b5fcd87b6ecffe8c28c4716b6b5b7017
author: Snesrev <[email protected]>
date: Thu Sep 29 17:47:00 EDT 2022

Bow icon in hud didn't show the right status

--- a/hud.c
+++ b/hud.c
@@ -1296,15 +1296,6 @@
 
 static void Hud_UpdateItemBox() {  // 8dfafd
   // Update r
-  if (link_item_bow) {
-    if (link_item_bow >= 3) {
-      hud_tile_indices_buffer[HUDXY(15, 0)] = 0x2486;
-      hud_tile_indices_buffer[HUDXY(16, 0)] = 0x2487;
-      link_item_bow = link_num_arrows ? 4 : 3;
-    } else {
-      link_item_bow = link_num_arrows ? 2 : 1;
-    }
-  }
   if (hud_cur_item)
     Hud_DrawItem(&hud_tile_indices_buffer[HUDXY(5, 1)], Hud_GetIconForItem(hud_cur_item));
 }
@@ -1369,6 +1360,16 @@
   uint16 *dst = &hud_tile_indices_buffer[HUDXY(8, 0)];
   memcpy(dst + HUDXY(0, 0), kHudInventoryBg +  0 + inv_offs, 12 * sizeof(uint16));
   memcpy(dst + HUDXY(0, 1), kHudInventoryBg + 13 + inv_offs, 12 * sizeof(uint16));
+
+  if (link_item_bow) {
+    if (link_item_bow >= 3) {
+      hud_tile_indices_buffer[HUDXY(15, 0)] = 0x2486;
+      hud_tile_indices_buffer[HUDXY(16, 0)] = 0x2487;
+      link_item_bow = link_num_arrows ? 4 : 3;
+    } else {
+      link_item_bow = link_num_arrows ? 2 : 1;
+    }
+  }
 
   // Offset everything if we have many coins?
   int base_tile = base_tiles[link_rupees_actual == MaxRupees()];
--- a/zelda_cpu_infra.c
+++ b/zelda_cpu_infra.c
@@ -546,6 +546,9 @@
   for (int i = 0; i < countof(ancilla_arr25_Uses); i++) PatchRomWord(rom, ancilla_arr25_Uses[i] + 1, 0x3c2, 0x746);
   static const int ancilla_arr22_Uses[] = { 0x9816e, 0xffde0, 0xffde7 };
   for (int i = 0; i < countof(ancilla_arr22_Uses); i++) PatchRomWord(rom, ancilla_arr22_Uses[i] + 1, 0x3e1, 0x74b);
+
+  PatchRomWord(rom, 0xddfac + 1, 0xfa85, 0xfa70); // call Hud_Rebuild instead of Hud_UpdateOnly
+
 }