ref: 29789bd2b1096d5c363c41d0f6eaa0266bffe9a6
parent: d3c0956455d1545759e2124606196189c7ab3ce6
author: Snesrev <[email protected]>
date: Thu Sep 29 21:42:43 EDT 2022
Remove g_ram[0xc8]
--- a/dungeon.c
+++ b/dungeon.c
@@ -5877,7 +5877,7 @@
uint8 rv;
- uint16 r16 = g_ram[0xc8];
+ uint16 r16 = some_menu_ctr;
t = GetRandomNumber();
if (BYTE(dungeon_room_index) == 0) {
@@ -5901,7 +5901,7 @@
}
rv = kDungeon_MinigameChestPrizes1[t];
}
- g_ram[0xc8] = t;
+ some_menu_ctr = t;
nmi_load_bg_from_vram = 1;
sound_effect_2 = 14;
return rv;
--- a/messaging.c
+++ b/messaging.c
@@ -738,7 +738,7 @@
bg1_x_offset = 0;
bg1_y_offset = 0;
mapbak_CGWSEL = WORD(CGWSEL_copy);
- g_ram[0xc8] = 32;
+ some_menu_ctr = 32;
hud_floor_changed_timer = 0;
Hud_FloorIndicator();
flag_update_hud_in_nmi++;
@@ -747,7 +747,7 @@
}
void GameOver_DelayBeforeIris() { // 89f33b
- if (--g_ram[0xc8])
+ if (--some_menu_ctr)
return;
Death_InitializeGameOverLetters();
IrisSpotlight_close();
@@ -787,7 +787,7 @@
TM_copy = 20;
TS_copy = 0;
CGADSUB_copy = 32;
- g_ram[0xc8] = 64;
+ some_menu_ctr = 64;
BYTE(palette_filter_countdown) = 0;
BYTE(darkening_or_lightening_screen) = 0;
Death_PrepFaint();
@@ -794,8 +794,8 @@
}
void GameOver_SplatAndFade() { // 89f3de
- if (g_ram[0xc8]) {
- g_ram[0xc8]--;
+ if (some_menu_ctr) {
+ some_menu_ctr--;
return;
}
PaletteFilter_RestoreBGSubstractiveStrict();
@@ -809,7 +809,7 @@
for (int i = 0; i != 4; i++) {
if (link_bottle_info[i] == 6) {
link_bottle_info[i] = 2;
- g_ram[0xc8] = 12;
+ some_menu_ctr = 12;
load_chr_halfslot_even_odd = 15;
Graphics_LoadChrHalfSlot();
load_chr_halfslot_even_odd = 0;
@@ -825,7 +825,7 @@
}
void Death_Func6() { // 89f458
- g_ram[0xc8] = 12;
+ some_menu_ctr = 12;
load_chr_halfslot_even_odd = 15;
Graphics_LoadChrHalfSlot();
load_chr_halfslot_even_odd = 0;
@@ -854,7 +854,7 @@
RenderText();
submodule_index = bak2 + 1;
main_module_index = bak1;
- g_ram[0xc8] = 2;
+ some_menu_ctr = 2;
music_control = 11;
}
@@ -866,8 +866,8 @@
if (filtered_joypad_H & 0x20)
goto do_inc;
- if (!--g_ram[0xc8]) {
- g_ram[0xc8] = 1;
+ if (!--some_menu_ctr) {
+ some_menu_ctr = 1;
if (joypad1H_last & 12) {
if (joypad1H_last & 4) {
do_inc:
@@ -877,7 +877,7 @@
if (sign8(--subsubmodule_index))
subsubmodule_index = 2;
}
- g_ram[0xc8] = 12;
+ some_menu_ctr = 12;
sound_effect_2 = 32;
}
}
@@ -1052,7 +1052,7 @@
WorldMap_Brighten();
break;
case 4:
- g_ram[0xc8] = 0x10;
+ some_menu_ctr = 0x10;
overworld_map_state++;
break;
case 5:
@@ -1078,13 +1078,13 @@
void FluteMenu_HandleSelection() { // 8ab78b
PointU8 pt;
- if (g_ram[0xc8] == 0) {
+ if (some_menu_ctr == 0) {
if ((joypad1L_last | joypad1H_last) & 0xc0) {
overworld_map_state++;
return;
}
} else {
- g_ram[0xc8]--;
+ some_menu_ctr--;
}
if (filtered_joypad_H & 10) {
birdtravel_var1[0]--;
--- a/overworld.c
+++ b/overworld.c
@@ -68,8 +68,8 @@
static const uint8 kSpExit_PalBg[16] = { 0xa, 0xa, 0xa, 0xa, 2, 2, 2, 0xa, 2, 2, 0xa, 2, 2, 2, 2, 0xa };
static const uint8 kSpExit_PalSpr[16] = { 1, 8, 8, 8, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 2 };
#endif
-#define turtlerock_ctr (g_ram[0xc8])
-#define ganonentrance_ctr (g_ram[0xc8])
+#define turtlerock_ctr (some_menu_ctr)
+#define ganonentrance_ctr (some_menu_ctr)
static PlayerHandlerFunc *const kOverworld_EntranceSequence[5] = {
&Overworld_AnimateEntrance_PoD,
&Overworld_AnimateEntrance_Skull,
--- a/variables.h
+++ b/variables.h
@@ -127,6 +127,7 @@
#define dung_load_ptr_bank (*(uint8*)(g_ram+0xB9))
#define dung_load_ptr_offs (*(uint16*)(g_ram+0xBA))
#define tmp1 (*(uint16*)(g_ram+0xBD))
+#define some_menu_ctr (*(uint8*)(g_ram+0xc8))
#define dung_line_ptrs_row3 (*(uint16*)(g_ram+0xDA))
#define dung_line_ptrs_row4 (*(uint16*)(g_ram+0xDD))
#define BG1HOFS_copy2 (*(uint16*)(g_ram+0xE0))