shithub: zelda3

Download patch

ref: 2e231162fee12ebe546a06e92cb6f2f4c25931f5
parent: 44514855c603d63fc11d3b864d72feab5e2f9cb6
author: Snesrev <snesrev@protonmail.com>
date: Thu Sep 22 09:46:17 EDT 2022

Crash in inventory screen with secondary item feature (Fixes #106)

--- a/hud.c
+++ b/hud.c
@@ -587,8 +587,9 @@
 }
 
 static void Hud_EquipItemBelow(uint8 *item) {  // 8ddf00
+  int num = *item == 0 ? 1 : (kNewStyleInventory ? 6 : 5);
   do {
-    for (int i = 0; i < (kNewStyleInventory ? 6 : 5); i++)
+    for (int i = 0; i < num; i++)
       Hud_GotoNextItem(item, 1);
   } while (!Hud_DoWeHaveThisItem(*item));
 }