shithub: zelda3

Download patch

ref: a363cda13240b649fdd3b983e94897775dd8c92f
parent: 6741153a8cf32a967c3873e7279832406079a7af
author: Snesrev <[email protected]>
date: Tue Sep 20 21:33:42 EDT 2022

Rename variables

--- a/ancilla.c
+++ b/ancilla.c
@@ -4627,7 +4627,7 @@
 
   uint8 flags = 2;
   if (submodule_index == 0) {
-    if (eq_selected_y_item != 13) {
+    if (current_item_y != 13) {
 kill_me:
       link_disable_sprite_damage = 0;
       ancilla_type[k] = 0;
@@ -6553,7 +6553,7 @@
     Ancilla_SetXY(k, link_x_coord + kMagicPower_X[j], link_y_coord + kMagicPower_Y[j]);
     Ancilla_CheckTileCollision(k);
     byte_7E0333 = ancilla_tile_attr[k];
-    if (eq_selected_y_item_copy == 9) {
+    if (current_item_active == 9) {
       ancilla_type[k] = 0;
       return;
     }
@@ -7111,7 +7111,7 @@
   tagalong_event_flags = 0;
   byte_7E02F3 = 0;
   flag_for_boomerang_in_place = 0;
-  byte_7E03FC = 0;
+  is_archer_or_shovel_game = 0;
   link_disable_sprite_damage = 0;
   byte_7E03FD = 0;
   link_electrocute_on_touch = 0;
--- a/hud.c
+++ b/hud.c
@@ -647,7 +647,7 @@
     link_item_bottle_index = hud_cur_item - kHudItem_Bottle1 + 1;
 
   assert(hud_cur_item < 25);
-  eq_selected_y_item = kNewStyleInventory ? kHudItemToItemNew[hud_cur_item] : kHudItemToItemOrg[hud_cur_item];
+  current_item_y = kNewStyleInventory ? kHudItemToItemNew[hud_cur_item] : kHudItemToItemOrg[hud_cur_item];
 }
 
 void Hud_CloseMenu() {  // 8ddfba
@@ -660,7 +660,7 @@
   main_module_index = saved_module_for_menu;
   if (submodule_index)
     Hud_RestoreTorchBackground();
-  if (eq_selected_y_item != 5 && eq_selected_y_item != 6) {
+  if (current_item_y != 5 && current_item_y != 6) {
     eq_debug_variable = 2;
     link_debug_value_1 = 0;
   } else {
--- a/player.c
+++ b/player.c
@@ -1932,11 +1932,11 @@
   if (button_b_frames && button_b_frames < 9)
     return;
 
-  if (link_is_bunny_mirror && (eq_selected_y_item != 11 && eq_selected_y_item != 20))
+  if (link_is_bunny_mirror && (current_item_y != 11 && current_item_y != 20))
     return;
 
-  if (byte_7E03FC && !link_is_bunny_mirror) {
-    if (byte_7E03FC == 2)
+  if (is_archer_or_shovel_game && !link_is_bunny_mirror) {
+    if (is_archer_or_shovel_game == 2)
       LinkItem_Bow();
     else
       LinkItem_Shovel();
@@ -1943,20 +1943,20 @@
     return;
   }
 
-  if (eq_selected_y_item != eq_selected_y_item_copy) {
-    if (eq_selected_y_item_copy == 8 && (link_item_flute & 2))
+  if (current_item_y != current_item_active) {
+    if (current_item_active == 8 && (link_item_flute & 2))
       button_mask_b_y &= ~0x40;
-    if (eq_selected_y_item_copy == 19 && link_cape_mode)
+    if (current_item_active == 19 && link_cape_mode)
       Link_ForceUnequipCape();
   }
 
   if ((link_item_in_hand | link_position_mode) == 0)
-    eq_selected_y_item_copy = eq_selected_y_item;
+    current_item_active = current_item_y;
 
-  if (eq_selected_y_item_copy == 5 || eq_selected_y_item_copy == 6)
-    eq_selected_rod = eq_selected_y_item_copy - 5 + 1;
+  if (current_item_active == 5 || current_item_active == 6)
+    eq_selected_rod = current_item_active - 5 + 1;
 
-  switch (eq_selected_y_item_copy) {
+  switch (current_item_active) {
   case 0:
     break;
   case 1: LinkItem_Bombs(); break;
@@ -2525,7 +2525,7 @@
       Ancilla_Sfx2_Near(5);
     } else {
       AncillaAdd_ShovelDirt(23, 0); // shovel dirt
-      if (byte_7E03FC)
+      if (is_archer_or_shovel_game)
         DiggingGameGuy_AttemptPrizeSpawn();
       Ancilla_Sfx2_Near(18);
     }
@@ -3219,8 +3219,8 @@
 }
 
 void Player_CheckHandleCapeStuff() {  // 87ae8f
-  if (link_cape_mode && eq_selected_y_item_copy == 19) {
-    if (eq_selected_y_item_copy == eq_selected_y_item) {
+  if (link_cape_mode && current_item_active == 19) {
+    if (current_item_active == current_item_y) {
       if (--cape_decrement_counter)
         return;
       cape_decrement_counter = kCapeDepletionTimers[link_magic_consumption];
@@ -6152,7 +6152,7 @@
   link_is_bunny_mirror = 0;
   BYTE(link_timer_tempbunny) = 0;
   link_need_for_poof_for_transform = 0;
-  byte_7E03FC = 0;
+  is_archer_or_shovel_game = 0;
   link_need_for_pullforrupees_sprite = 0;
   BYTE(bit9_of_xcoord) = 0;
   link_something_with_hookshot = 0;
--- a/player_oam.c
+++ b/player_oam.c
@@ -980,7 +980,7 @@
       assert(link_state_bits == 0);
       oam_pal = kPlayerOam_Rod[eq_selected_rod - 1] << 8;
     }
-    if ((link_position_mode & 8) && eq_selected_y_item == 13)
+    if ((link_position_mode & 8) && current_item_y == 13)
       oam_pal = 0x400;  // cane of byrna
 
     int oam_pos = ((scratch_0_var ? kSwordStuff_oam_index_ptrs_1 : kSwordStuff_oam_index_ptrs_0)[r4loc] + sort_sprites_offset_into_oam_buffer)>>2;
--- a/sprite.c
+++ b/sprite.c
@@ -3712,7 +3712,7 @@
   flag_block_link_menu = 0;
   byte_7E0FFD = 0;
   byte_7E0FC6 = 0;
-  byte_7E03FC = 0;
+  is_archer_or_shovel_game = 0;
   for (int k = 7; k >= 0; k--)
     overlord_type[k] = 0;
   for (int k = 29; k >= 0; k--)
--- a/sprite_main.c
+++ b/sprite_main.c
@@ -13664,7 +13664,7 @@
 }
 
 void Sprite_InitializeSecondaryItemMinigame(int what) {  // 8ffd86
-  byte_7E03FC = what;
+  is_archer_or_shovel_game = what;
   Link_ResetProperties_C();
   for (int k = 4; k >= 0; k--) {
     if (ancilla_type[k] == 0x30 || ancilla_type[k] == 0x31) {
@@ -19471,7 +19471,7 @@
       return;
     music_control = 9;
     sprite_ai_state[k]++;
-    byte_7E03FC = 0;
+    is_archer_or_shovel_game = 0;
     dialogue_message_index = 0x18a;
     Sprite_ShowMessageMinimal();
     super_bomb_indicator_unk2 = 254;
--- a/variables.h
+++ b/variables.h
@@ -263,8 +263,8 @@
 #define player_handler_timer (*(uint8*)(g_ram+0x300))
 #define link_item_in_hand (*(uint8*)(g_ram+0x301))
 #define fallhole_var1 (*(uint8*)(g_ram+0x302))
-#define eq_selected_y_item (*(uint8*)(g_ram+0x303))
-#define eq_selected_y_item_copy (*(uint8*)(g_ram+0x304))
+#define current_item_y (*(uint8*)(g_ram+0x303))
+#define current_item_active (*(uint8*)(g_ram+0x304))
 #define debug_var2 (*(uint8*)(g_ram+0x305))
 #define unused_2 (*(uint8*)(g_ram+0x306))
 #define eq_selected_rod (*(uint8*)(g_ram+0x307))
@@ -388,7 +388,7 @@
 #define link_need_for_pullforrupees_sprite (*(uint8*)(g_ram+0x3F8))
 #define hookshot_var1 (*(uint8*)(g_ram+0x3F9))
 #define bit9_of_xcoord (*(uint16*)(g_ram+0x3FA))
-#define byte_7E03FC (*(uint8*)(g_ram+0x3FC))
+#define is_archer_or_shovel_game (*(uint8*)(g_ram+0x3FC))
 #define byte_7E03FD (*(uint8*)(g_ram+0x3FD))
 #define dung_door_opened (*(uint16*)(g_ram+0x400))
 #define dung_savegame_state_bits (*(uint16*)(g_ram+0x402))