shithub: zelda3

Download patch

ref: a38a0a08f095edb0c24824f679ef7a6cb8b3961e
parent: 97cf3feef012827c71158627fa1fd9413f036c80
author: Snesrev <snesrev@protonmail.com>
date: Sun Sep 18 15:10:29 EDT 2022

Rename a variable

--- a/attract.c
+++ b/attract.c
@@ -995,7 +995,7 @@
 
 void Attract_ControlMapZoom() {  // 8cf783
   for (int i = 223; i >= 0; i--)
-    mode7_hdma_table[i] = kMapMode_Zooms1[i] * timer_for_mode7_zoom >> 8;
+    hdma_table_dynamic[i] = kMapMode_Zooms1[i] * timer_for_mode7_zoom >> 8;
 }
 
 void Attract_BuildBackgrounds() {  // 8cf7e6
--- a/load_gfx.c
+++ b/load_gfx.c
@@ -1252,7 +1252,7 @@
       zelda_snes_dummy_write(HDMAEN, 0);
       HDMAEN_copy = 0;
       for (int i = 0; i < 32 * 7; i++)
-        mode7_hdma_table[i] = 0x778;
+        hdma_table_dynamic[i] = 0x778;
       HDMAEN_copy = 0xc0;
     }
   }
@@ -1490,7 +1490,7 @@
     r4++, r6--;
   }
 
-  memcpy(mode7_hdma_table, hdma_table, 224  * sizeof(uint16));
+  memcpy(hdma_table_dynamic, hdma_table, 224  * sizeof(uint16));
 
   spotlight_var1 += kSpotlight_delta_size[spotlight_var2 >> 1];
 
@@ -1519,7 +1519,7 @@
 
 void IrisSpotlight_ResetTable() {  // 80f427
   for (int i = 0; i < 224; i++)
-    mode7_hdma_table[i] = 0xff00;
+    hdma_table_dynamic[i] = 0xff00;
 }
 
 uint16 IrisSpotlight_CalculateCircleValue(uint8 a) {  // 80f4cc
@@ -1567,7 +1567,7 @@
       else
         a = r12;
       if (r4 < 224)
-        mode7_hdma_table[r4] = (a != 0xffff) ? a : 0xff;
+        hdma_table_dynamic[r4] = (a != 0xffff) ? a : 0xff;
     }
     if (r6 >= spotlight_y_upper) {
       a = 0xff;
@@ -1577,7 +1577,7 @@
       a = r12;
     }
     if (r6 < 224)
-      mode7_hdma_table[r6] = (a != 0xffff) ? a : 0xff;
+      hdma_table_dynamic[r6] = (a != 0xffff) ? a : 0xff;
   } while (r6--, r10 != r4++);
 }
 
@@ -1589,7 +1589,7 @@
 
   int r4 = 0;
   do {
-    mode7_hdma_table[r4] = 0xff00;
+    hdma_table_dynamic[r4] = 0xff00;
   } while (++r4 != spotlight_y_upper);
 
   r12 = r14 - 7 + 8;
@@ -1598,13 +1598,13 @@
 
   do {
     if (r4 >= r10) {
-      mode7_hdma_table[r4] = 0xff;
+      hdma_table_dynamic[r4] = 0xff;
     } else {
       uint16 a = r4;
       do {
         a *= 2;
       } while (a >= 448);
-      mode7_hdma_table[a >> 1] = r12 == 0xffff ? 0xff : r12;
+      hdma_table_dynamic[a >> 1] = r12 == 0xffff ? 0xff : r12;
     }
   } while (++r4 < 225);
 }
--- a/messaging.c
+++ b/messaging.c
@@ -534,7 +534,7 @@
   TMW_copy = TM_copy;
   TSW_copy = TS_copy;
   HDMAEN_copy = 0x80;
-  memset(mode7_hdma_table, 0, 0x1e0);
+  memset(hdma_table_dynamic, 0, 0x1e0);
 }
 
 void DesertPrayer_InitializeIrisHDMA() {  // 87ea06
@@ -578,11 +578,11 @@
     uint8 t7 = (r2 < 256) ? r2 : 255;
     uint16 r6 = t7 << 8 | t6;
     if (k < 224)
-     mode7_hdma_table[k] = (r6 == 0xffff) ? 0xff : r6;
+     hdma_table_dynamic[k] = (r6 == 0xffff) ? 0xff : r6;
     if (sign16(spotlight_y_lower) || (r4 >= spotlight_y_lower && r4 < spotlight_y_upper)) {
       k = BYTE(spotlight_var4) - 2 + r14;
       if (k < 224)
-        mode7_hdma_table[k] = (r6 == 0xffff) ? 0xff : r6;
+        hdma_table_dynamic[k] = (r6 == 0xffff) ? 0xff : r6;
       spotlight_var4++;
     }
     r4++;
--- a/misc.c
+++ b/misc.c
@@ -261,7 +261,7 @@
 static void KillAghanim_Func5() {
   HdmaSetup(0, 0xf2fb, 0x41, 0, (uint8)WH0, 0);
   for (int i = 0; i < 224; i++)
-    mode7_hdma_table[i] = 0xff00;
+    hdma_table_dynamic[i] = 0xff00;
   palette_filter_countdown = 0;
   darkening_or_lightening_screen = 0;
   dialogue_message_index = 0x35;
--- a/overworld.c
+++ b/overworld.c
@@ -345,7 +345,7 @@
 
   uint16 v = BG2HOFS_copy2;
   for (int i = 0; i < 32 * 7; i++)
-    mode7_hdma_table[i] = v;
+    hdma_table_dynamic[i] = v;
   HDMAEN_copy = 0xc0;
 }
 
@@ -356,7 +356,7 @@
 
   int x = 0x1a0 / 2, y = 0x1b0 / 2;
   do {
-    mode7_hdma_table[y] = mode7_hdma_table[y + 2] = mode7_hdma_table[y + 4] = mode7_hdma_table[y + 6] = mode7_hdma_table[x];
+    hdma_table_dynamic[y] = hdma_table_dynamic[y + 2] = hdma_table_dynamic[y + 4] = hdma_table_dynamic[y + 6] = hdma_table_dynamic[x];
     x -= 8, y -= 8;
   } while (y != 0);
   int i = mirror_vars.var0 >> 1;
@@ -382,7 +382,7 @@
     subsubmodule_index++;
     t = 0;
   }
-  mode7_hdma_table[0] = mode7_hdma_table[2] = mode7_hdma_table[4] = mode7_hdma_table[6] = t + BG2HOFS_copy2;
+  hdma_table_dynamic[0] = hdma_table_dynamic[2] = hdma_table_dynamic[4] = hdma_table_dynamic[6] = t + BG2HOFS_copy2;
 }
 
 void MirrorWarp_BuildDewavingHDMATable() {  // 80ff2f
@@ -391,11 +391,11 @@
     return;
   int x = 0x1a0 / 2, y = 0x1b0 / 2;
   do {
-    mode7_hdma_table[y] = mode7_hdma_table[y + 2] = mode7_hdma_table[y + 4] = mode7_hdma_table[y + 6] = mode7_hdma_table[x];
+    hdma_table_dynamic[y] = hdma_table_dynamic[y + 2] = hdma_table_dynamic[y + 4] = hdma_table_dynamic[y + 6] = hdma_table_dynamic[x];
     x -= 8, y -= 8;
   } while (y != 0);
 
-  uint16 t = mode7_hdma_table[0xc0] | mode7_hdma_table[0xc8] | mode7_hdma_table[0xd0] | mode7_hdma_table[0xd8];
+  uint16 t = hdma_table_dynamic[0xc0] | hdma_table_dynamic[0xc8] | hdma_table_dynamic[0xd0] | hdma_table_dynamic[0xd8];
   if (t == BG2HOFS_copy2) {
     HDMAEN_copy = 0;
     subsubmodule_index++;
--- a/variables.h
+++ b/variables.h
@@ -804,7 +804,7 @@
 #define bird_travel_y_lo ((uint8*)(g_ram+0x1AD0))
 #define bird_travel_y_hi ((uint8*)(g_ram+0x1AE0))
 #define birdtravel_var1 ((uint8*)(g_ram+0x1AF0))
-#define mode7_hdma_table ((uint16*)(g_ram+0x1B00))
+#define hdma_table_dynamic ((uint16*)(g_ram+0x1B00))
 #define text_msgbox_topleft_copy (*(uint16*)(g_ram+0x1CD0))
 #define text_msgbox_topleft (*(uint16*)(g_ram+0x1CD2))
 #define text_render_state (*(uint8*)(g_ram+0x1CD4))
--- a/zelda_rtl.c
+++ b/zelda_rtl.c
@@ -106,9 +106,9 @@
   case 0xABDDD: return kAttractIndirectHdmaTab;   // mode7
   case 0x2c80c: return kHdmaTableForPrayingScene;
 
-  case 0x1b00: return (uint8 *)mode7_hdma_table;
-  case 0x1be0: return (uint8 *)mode7_hdma_table + 0xe0;
-  case 0x1bf0: return (uint8 *)mode7_hdma_table + 0xf0;
+  case 0x1b00: return (uint8 *)hdma_table_dynamic;
+  case 0x1be0: return (uint8 *)hdma_table_dynamic + 0xe0;
+  case 0x1bf0: return (uint8 *)hdma_table_dynamic + 0xf0;
   case 0xadd27: return (uint8*)kMapMode_Zooms1;
   case 0xade07: return (uint8*)kMapMode_Zooms1 + 0xe0;
   case 0xadee7: return (uint8*)kMapMode_Zooms2;
@@ -198,7 +198,7 @@
     else if (hdma_chans[0].table == kMapModeHdma1)
       PpuSetMode7PerspectiveCorrection(g_zenv.ppu, kMapMode_Zooms2[0], kMapMode_Zooms2[223]);
     else if (hdma_chans[0].table == kAttractIndirectHdmaTab)
-      PpuSetMode7PerspectiveCorrection(g_zenv.ppu, mode7_hdma_table[0], mode7_hdma_table[223]);
+      PpuSetMode7PerspectiveCorrection(g_zenv.ppu, hdma_table_dynamic[0], hdma_table_dynamic[223]);
     else
       PpuSetMode7PerspectiveCorrection(g_zenv.ppu, 0, 0);
   }