From b3ae9a90ccc5e10b339574cf41b92e92d95c0424 Mon Sep 17 00:00:00 2001 From: Snesrev Date: Sun, 18 Jun 2023 06:37:00 +0200 Subject: [PATCH] Clean up --- smb1/smb1_00.c | 10 +- smb1/smb1_01.c | 12 +- smb1/smb1_02.c | 8 +- smb1/smb1_08.c | 8 +- smb1/smb1_cpu_infra.c | 4 + smb1/smb1_spc_player.c | 63 +- smbll/smbll_00.c | 10 +- smbll/smbll_01.c | 12 +- smbll/smbll_02.c | 8 +- smbll/smbll_08.c | 8 +- smbll/smbll_cpu_infra.c | 3 + src/common_cpu_infra.c | 18 + src/common_cpu_infra.h | 2 + src/common_rtl.c | 243 +++- src/common_rtl.h | 38 +- src/consts.h | 1734 +----------------------- src/funcs.h | 414 +++--- src/main.c | 4 +- src/smw.vcxproj | 5 +- src/smw_00.c | 2448 +++++++++++++++------------------- src/smw_01.c | 2266 +++++++++++++++++-------------- src/smw_02.c | 2805 ++++++++++++++++++++++----------------- src/smw_03.c | 1638 +++++++++++++---------- src/smw_04.c | 1719 ++++++++++++------------ src/smw_05.c | 874 ++++++------ src/smw_07.c | 10 + src/smw_0c.c | 817 ++++++------ src/smw_0d.c | 1616 +++++++++++----------- src/smw_cpu_infra.c | 95 +- src/smw_rtl.c | 8 + src/smw_rtl.h | 12 + src/smw_spc_player.c | 58 +- src/smw_spc_player.h | 1 + src/snes/cpu.c | 19 +- src/snes/snes.c | 2 +- src/snes/snes_regs.h | 3 + src/types.h | 8 +- src/variables.h | 171 ++- 38 files changed, 8353 insertions(+), 8821 deletions(-) diff --git a/smb1/smb1_00.c b/smb1/smb1_00.c index 7ac22c7..e3cf60d 100644 --- a/smb1/smb1_00.c +++ b/smb1/smb1_00.c @@ -1623,17 +1623,17 @@ void UploadStripeImage() { WriteReg(A1B1, 0); R6_ = 0; v0 = 0; - for (i = *IndirPtr(&R0_, 0); i >= 0; i = *IndirPtr(&R0_, v0)) { + for (i = *IndirPtr((LongPtr *)&R0_, 0); i >= 0; i = *IndirPtr((LongPtr *)&R0_, v0)) { R4_ = i; v2 = v0 + 1; - R3_ = *IndirPtr(&R0_, v2++); - v3 = *IndirPtr(&R0_, v2) & 0x80; + R3_ = *IndirPtr((LongPtr *)&R0_, v2++); + v3 = *IndirPtr((LongPtr *)&R0_, v2) & 0x80; R7_ = 4 * v3 + __CFSHL__(v3, 1); - R5_ = *IndirPtr(&R0_, v2) & 0x40; + R5_ = *IndirPtr((LongPtr *)&R0_, v2) & 0x40; WriteReg(DMAP1, (R5_ >> 3) | 1); WriteReg(BBAD1, 0x18u); WriteRegWord(VMADDL, *(uint16 *)&R3_); - v4 = IndirPtr(&R0_, v2); + v4 = IndirPtr((LongPtr *)&R0_, v2); LOBYTE(v5) = HIBYTE(*(uint16 *)v4); HIBYTE(v5) = *(uint16 *)v4; v6 = (v5 & 0x3FFF) + 1; diff --git a/smb1/smb1_01.c b/smb1/smb1_01.c index 3ab517b..3eed229 100644 --- a/smb1/smb1_01.c +++ b/smb1/smb1_01.c @@ -646,7 +646,7 @@ void SpawnCastleTilesWithPriority() { v0 = *(uint16 *)&vram_buffer1_offset; v1 = 0; do { - v2 = IndirPtr(&tempF3, v1); + v2 = IndirPtr((LongPtr *)&tempF3, v1); v3 = *(uint16 *)v2; *(uint16 *)&vram_buffer1[v0 + 1] = *(uint16 *)v2; v1 += 2; @@ -765,7 +765,7 @@ void DecodeAreaData_Sub2_New(uint16 j) { tempF3 = area_data_ptr.addr; tempF4 = area_data_ptr.addr >> 8; tempF5 = area_data_ptr.bank; - v1 = *IndirPtr(&tempF3, (j + 2)) & 0x7F; + v1 = *IndirPtr((LongPtr *)&tempF3, (j + 2)) & 0x7F; R0_ = *((uint8 *)kDATA_048E43 + v1); R1_ = *((uint8 *)kDATA_048E43 + v1 + 1); v2 = object_index; @@ -1014,8 +1014,8 @@ uint8 CODE_0491C0(uint8 k) { uint16 v1; // di v1 = area_obj_offset_buffer[(uint16)(2 * k) >> 1] + 1; - R7_ = *IndirPtr(&tempF3, v1) >> 4; - return *IndirPtr(&tempF3, v1) & 0xF; + R7_ = *IndirPtr((LongPtr *)&tempF3, v1) >> 4; + return *IndirPtr((LongPtr *)&tempF3, v1) & 0xF; } uint8 CODE_0491DD() { @@ -1385,7 +1385,7 @@ PairU16 CODE_049724(uint8 k, uint8 j) { *(uint16 *)&R4_ = 1; *(uint16 *)&R0_ = 16; do { - palette_mirror[k >> 1] = *(uint16 *)IndirPtr(&R2_, j); + palette_mirror[k >> 1] = *(uint16 *)IndirPtr((LongPtr *)&R2_, j); j += 2; k += 2; --*(uint16 *)&R0_; @@ -1429,7 +1429,7 @@ void CODE_04973C() { tempF7 = *((uint8 *)kDATA_04B683 + (uint16)(*(uint16 *)&tempF8 + 1)) & 0x3F; while (1) { uint16 t = g_ram[0xf3] | g_ram[0xf4] << 8; - IndirWriteByte(&tempF3, v2, tempF7); + IndirWriteByte((LongPtr *)&tempF3, v2, tempF7); if (!tempF6 || (v2 & 0xF0) == 0xD0) break; LOBYTE(v1) = v2 + 16; diff --git a/smb1/smb1_02.c b/smb1/smb1_02.c index 42e9666..42dd473 100644 --- a/smb1/smb1_02.c +++ b/smb1/smb1_02.c @@ -1112,12 +1112,12 @@ void GenerateLayer2Map16() { v3 = *(uint16 *)&tempE4; v4 = 8 * (uint8)v2; v5 = *(uint16 *)&tempE4 >> 1; - layer2_map16_table[v5] = *(uint16 *)IndirPtr(&R0_, v4); + layer2_map16_table[v5] = *(uint16 *)IndirPtr((LongPtr *)&R0_, v4); v4 += 2; - layer2_map16_table[v5 + 1] = *(uint16 *)IndirPtr(&R0_, v4); + layer2_map16_table[v5 + 1] = *(uint16 *)IndirPtr((LongPtr *)&R0_, v4); v4 += 2; - layer2_map16_table[v5 + 32] = *(uint16 *)IndirPtr(&R0_, v4); - layer2_map16_table[v5 + 33] = *(uint16 *)IndirPtr(&R0_, v4 + 2); + layer2_map16_table[v5 + 32] = *(uint16 *)IndirPtr((LongPtr *)&R0_, v4); + layer2_map16_table[v5 + 33] = *(uint16 *)IndirPtr((LongPtr *)&R0_, v4 + 2); v1 = v6 + 1; if ((v1 & 0xF) == 0) v3 += 64; v0 = v3 + 4; diff --git a/smb1/smb1_08.c b/smb1/smb1_08.c index 1b5406e..7919353 100644 --- a/smb1/smb1_08.c +++ b/smb1/smb1_08.c @@ -59,10 +59,10 @@ void HandleSPCUploads_Main() { LOBYTE(v1) = -52; while (1) { v13 = v1; - v9 = IndirPtr(&R0_, v0); + v9 = IndirPtr((LongPtr *)&R0_, v0); v10 = v0 + 2; v4 = *(uint16 *)v9; - v11 = *(uint16 *)IndirPtr(&R0_, v10); + v11 = *(uint16 *)IndirPtr((LongPtr *)&R0_, v10); v12 = v10 + 2; WriteRegWord(APUI02, v11); WriteReg(APUI01, v4 != 0); @@ -71,14 +71,14 @@ void HandleSPCUploads_Main() { ; if (Unreachable()) break; - v2 = IndirPtr(&R0_, v12); + v2 = IndirPtr((LongPtr *)&R0_, v12); v0 = v12 + 1; HIBYTE(v1) = *v2; for (LOBYTE(v1) = 0;; LOBYTE(v1) = v1 + 1) { WriteRegWord(APUI00, v1); if (!--v4) break; - v3 = IndirPtr(&R0_, v0++); + v3 = IndirPtr((LongPtr *)&R0_, v0++); HIBYTE(v1) = *v3; while ((uint8)v1 != ReadReg(APUI00)) ; diff --git a/smb1/smb1_cpu_infra.c b/smb1/smb1_cpu_infra.c index e7a5f12..15c91c8 100644 --- a/smb1/smb1_cpu_infra.c +++ b/smb1/smb1_cpu_infra.c @@ -155,6 +155,9 @@ void Smb1RunOneFrameOfGame(void) { } } +static void Smb1DrawPpuFrame(void) { + +} const RtlGameInfo kSmb1GameInfo = { "smb1", @@ -164,5 +167,6 @@ const RtlGameInfo kSmb1GameInfo = { &Smb1CpuInitialize, &Smb1RunOneFrameOfGame, &Smb1RunOneFrameOfGame_Emulated, + &Smb1DrawPpuFrame, &Smb1FixSnapshotForCompare, }; diff --git a/smb1/smb1_spc_player.c b/smb1/smb1_spc_player.c index f692f69..c775773 100644 --- a/smb1/smb1_spc_player.c +++ b/smb1/smb1_spc_player.c @@ -69,7 +69,6 @@ typedef struct SmasSpcPlayer { SpcPlayer base; DspRegWriteHistory *reg_write_history; uint8 new_value_from_snes[4]; - uint8 port_to_snes_a[4]; uint8 last_value_from_snes[4]; uint8 var_c; uint8 last_written_edl; // TODO:persist @@ -202,7 +201,7 @@ static const MemMap kChannel_Maps[] = { }; static const MemMapSized kSpcPlayer_Maps[] = { {offsetof(SmasSpcPlayer, new_value_from_snes), 0x0, 4}, -{offsetof(SmasSpcPlayer, port_to_snes_a), 0x4, 4}, +{offsetof(SmasSpcPlayer, base.port_to_snes), 0x4, 4}, {offsetof(SmasSpcPlayer, last_value_from_snes), 0x8, 4}, {offsetof(SmasSpcPlayer, var_c), 0xc, 1}, {offsetof(SmasSpcPlayer, counter_sf0d), 0xd, 1}, @@ -431,7 +430,7 @@ static void Spc_Loop_Part2(SmasSpcPlayer *p, uint8 ticks) { ReadPortFromSnes(p, 2); return; } - if (p->port_to_snes_a[2]) { + if (p->base.port_to_snes[2]) { Channel *c = p->channel; for (p->cur_chan_bit = 1; p->cur_chan_bit != 0; p->cur_chan_bit <<= 1, c++) { if (HIBYTE(c->pattern_cur_ptr)) @@ -574,7 +573,7 @@ static void Port2_HandleMusic(SmasSpcPlayer *p) { if (a == 0) { handle_cmd_00: - if (p->var_3F8 != 0 || p->port_to_snes_a[2] == 0) + if (p->var_3F8 != 0 || p->base.port_to_snes[2] == 0) return; if (p->pause_music_ctr != 0 && --p->pause_music_ctr == 0) goto HandleCmd_0xf0_PauseMusic; @@ -696,7 +695,7 @@ static void Port2_HandleMusic(SmasSpcPlayer *p) { goto handle_cmd_00; } else if (a == 0xf0) HandleCmd_0xf0_PauseMusic: { p->key_OFF = p->is_chan_on ^ 0xff; - p->port_to_snes_a[2] = 0; + p->base.port_to_snes[2] = 0; p->port_to_snes_b[2] = 0; p->cur_chan_bit = 0; } else if (a == 0xf3) { @@ -720,10 +719,10 @@ static void Port2_HandleMusic(SmasSpcPlayer *p) { } p->pause_music_ctr = 0; p->some_volume_flag = 0; - p->port_to_snes_a[2] = a; + p->base.port_to_snes[2] = a; t = WORD(p->ram[0xc000 + (a - 1) * 2]); if ((t >> 8) == 0) { - p->port_to_snes_a[2] = 0; + p->base.port_to_snes[2] = 0; return; } p->music_ptr_toplevel = t; @@ -925,14 +924,14 @@ static void SmasSpcPlayer_Upload(SpcPlayer *p_in, const uint8_t *data) { } while (--numbytes); } p->pause_music_ctr = 0; - p->port_to_snes_a[0] = 0; - p->port_to_snes_a[1] = 0; - p->port_to_snes_a[3] = 0; + p->base.port_to_snes[0] = 0; + p->base.port_to_snes[1] = 0; + p->base.port_to_snes[3] = 0; p->enable_some_randomstuff = 0; p->is_chan_on = 0; p->extra_tempo = 0; if (!p->var_3F8) - p->port_to_snes_a[2] = 0; + p->base.port_to_snes[2] = 0; memset(p->base.input_ports, 0, sizeof(p->base.input_ports)); memset(p->last_value_from_snes, 0, sizeof(p->last_value_from_snes)); memset(p->new_value_from_snes, 0, sizeof(p->new_value_from_snes)); @@ -1131,11 +1130,11 @@ static void HandleEffect(SmasSpcPlayer *p, Channel *c, uint8 effect) { } static void Sfx_TerminateSfx4(SmasSpcPlayer *p) { - if (p->port_to_snes_a[0] == 17) { + if (p->base.port_to_snes[0] == 17) { p->var_3F8 = 0xff; Dsp_Write(p, KOF, 0xff); } - p->port_to_snes_a[0] = 0; + p->base.port_to_snes[0] = 0; p->port_to_snes_b[0] = 0; p->is_chan_on &= ~0x10; if (p->echo_channels & 0x10) { @@ -1158,7 +1157,7 @@ static void Port0_HandleCmd(SmasSpcPlayer *p) { } if (p->new_value_from_snes[0] == 0x43 || p->new_value_from_snes[0] == 0x12 || p->new_value_from_snes[0] == 0x11 || - p->port_to_snes_a[0] != 0x11 && p->port_to_snes_a[0] != 0x1d) { + p->base.port_to_snes[0] != 0x11 && p->base.port_to_snes[0] != 0x1d) { if (p->new_value_from_snes[0] == 0x7f) { p->extra_tempo = 10; @@ -1172,13 +1171,13 @@ static void Port0_HandleCmd(SmasSpcPlayer *p) { } if (p->var_c) goto label_b; - if (!p->port_to_snes_a[0]) + if (!p->base.port_to_snes[0]) return; goto label_c; label_a: - p->port_to_snes_a[0] = cmd; - if (p->var_3F8 && p->port_to_snes_a[0] == 18) + p->base.port_to_snes[0] = cmd; + if (p->var_3F8 && p->base.port_to_snes[0] == 18) p->var_3F8 = 0; p->var_c = 2; Dsp_Write(p, KOF, 0x10); @@ -1188,7 +1187,7 @@ static void Port0_HandleCmd(SmasSpcPlayer *p) { p->channel[4].pitch_slide_length = 0; p->channel[4].fine_tunea = 0; p->channel[4].channel_transpositionb = 0; - if (p->port_to_snes_a[0] == 0x3b || p->port_to_snes_a[0] == 0x43) { + if (p->base.port_to_snes[0] == 0x3b || p->base.port_to_snes[0] == 0x43) { p->reg_EON &= ~0x10; Dsp_Write(p, EON, p->reg_EON); } @@ -1251,7 +1250,7 @@ static void Port0_HandleCmd(SmasSpcPlayer *p) { goto note_continue; } else if (cmd == 0xff) { is_ff: - p->sfx_sound_ptr_cur = WORD(p->ram[0x17D8 + (p->port_to_snes_a[0] - 1) * 2]); + p->sfx_sound_ptr_cur = WORD(p->ram[0x17D8 + (p->base.port_to_snes[0] - 1) * 2]); } else { PlayNote(p, &p->channel[4], cmd); Write_KeyOn(p, 0x10); @@ -1273,7 +1272,7 @@ static void Port0_HandleCmd(SmasSpcPlayer *p) { } static void Sfx_TerminateSfx6(SmasSpcPlayer *p) { - p->port_to_snes_a[3] = 0; + p->base.port_to_snes[3] = 0; p->port_to_snes_b[3] = 0; p->is_chan_on &= ~0x40; p->reg_NON = 0; @@ -1293,18 +1292,18 @@ static void Port3_HandleCmd(SmasSpcPlayer *p) { p->new_value_from_snes[3] &= 0x7f; } - if (p->port_to_snes_a[3] == 29 || - (p->new_value_from_snes[3] != 5 && p->port_to_snes_a[3] == 5) || + if (p->base.port_to_snes[3] == 29 || + (p->new_value_from_snes[3] != 5 && p->base.port_to_snes[3] == 5) || p->new_value_from_snes[3] == 0) { if (p->port3_timeout) goto label_b; - if (p->port_to_snes_a[3]) + if (p->base.port_to_snes[3]) goto label_c; return; } - p->port_to_snes_a[3] = p->new_value_from_snes[3]; + p->base.port_to_snes[3] = p->new_value_from_snes[3]; p->port3_timeout = 2; Dsp_Write(p, KOF, 0x40); p->is_chan_on |= 0x40; @@ -1317,7 +1316,7 @@ static void Port3_HandleCmd(SmasSpcPlayer *p) { label_b: if (--p->port3_timeout) return; - p->port3_cur_ptr = WORD(p->ram[0x173c + (p->port_to_snes_a[3] - 1) * 2]); + p->port3_cur_ptr = WORD(p->ram[0x173c + (p->base.port_to_snes[3] - 1) * 2]); goto lbl_begin; @@ -1490,7 +1489,7 @@ static void Port1_HandleCmd(SmasSpcPlayer *p) { p->new_value_from_snes[1] &= 0xf; if (p->new_value_from_snes[1] == 1) { - p->port_to_snes_a[1] = 1; + p->base.port_to_snes[1] = 1; p->chan7_timer = 4; Dsp_Write(p, KOF, 0x80); p->is_chan_on |= 0x80; @@ -1498,8 +1497,8 @@ static void Port1_HandleCmd(SmasSpcPlayer *p) { p->channel[7].pitch_slide_length = 0; p->channel[7].fine_tunea = 0; p->channel[7].channel_transpositionb = 0; - } else if (p->port_to_snes_a[1] != 1 && p->new_value_from_snes[1] == 4) { - p->port_to_snes_a[1] = 4; + } else if (p->base.port_to_snes[1] != 1 && p->new_value_from_snes[1] == 4) { + p->base.port_to_snes[1] = 4; p->chan7_timer = 2; Dsp_Write(p, KOF, 0x80); p->is_chan_on |= 0x80; @@ -1507,7 +1506,7 @@ static void Port1_HandleCmd(SmasSpcPlayer *p) { p->channel[7].pitch_slide_length = 0; p->channel[7].channel_transpositionb = 0; p->channel[7].fine_tunea = 0; - } else if (p->port_to_snes_a[1] == 1) { + } else if (p->base.port_to_snes[1] == 1) { if (p->chan7_timer) { if (--p->chan7_timer) return; @@ -1527,7 +1526,7 @@ static void Port1_HandleCmd(SmasSpcPlayer *p) { ComputePitchAdd(&p->channel[7], 0xb9); } } else { - p->port_to_snes_a[1] = 0; + p->base.port_to_snes[1] = 0; p->is_chan_on &= ~0x80; p->channel[7].pitch_slide_length = 0; p->channel[7].channel_transpositionb = p->channel[7].channel_transpositiona; @@ -1545,7 +1544,7 @@ static void Port1_HandleCmd(SmasSpcPlayer *p) { p->cur_chan_bit = 0; WritePitch(p, &p->channel[7], p->channel[7].pitch); } - } else if (p->port_to_snes_a[1] == 4) { + } else if (p->base.port_to_snes[1] == 4) { Chan7_Func1605(p); } } @@ -1569,7 +1568,7 @@ static void Chan7_Func1605(SmasSpcPlayer *p) { Dsp_Write(p, V7VOLR, 20); Write_KeyOn(p, 0x80); } else { - p->port_to_snes_a[1] = 0; + p->base.port_to_snes[1] = 0; p->is_chan_on &= ~0x80; p->channel[7].pitch_slide_length = 0; p->channel[7].channel_transpositionb = p->channel[7].channel_transpositiona; diff --git a/smbll/smbll_00.c b/smbll/smbll_00.c index 438a84e..07eced2 100644 --- a/smbll/smbll_00.c +++ b/smbll/smbll_00.c @@ -1594,17 +1594,17 @@ void Smbll_UploadStripeImage() { R6_ = 0; v0 = 0; - for (i = *IndirPtr(&R0_, 0); i >= 0; i = *IndirPtr(&R0_, v0)) { + for (i = *IndirPtr((LongPtr *)&R0_, 0); i >= 0; i = *IndirPtr((LongPtr *)&R0_, v0)) { R4_ = i; v2 = v0 + 1; - R3_ = *IndirPtr(&R0_, v2++); - v3 = *IndirPtr(&R0_, v2) & 0x80; + R3_ = *IndirPtr((LongPtr *)&R0_, v2++); + v3 = *IndirPtr((LongPtr *)&R0_, v2) & 0x80; R7_ = 4 * v3 + __CFSHL__(v3, 1); - R5_ = *IndirPtr(&R0_, v2) & 0x40; + R5_ = *IndirPtr((LongPtr *)&R0_, v2) & 0x40; WriteReg(DMAP1, (R5_ >> 3) | 1); WriteReg(BBAD1, 0x18u); WriteRegWord(VMADDL, *(uint16 *)&R3_); - v4 = IndirPtr(&R0_, v2); + v4 = IndirPtr((LongPtr *)&R0_, v2); LOBYTE(v5) = HIBYTE(*(uint16 *)v4); HIBYTE(v5) = *(uint16 *)v4; v6 = (v5 & 0x3FFF) + 1; diff --git a/smbll/smbll_01.c b/smbll/smbll_01.c index 5153a45..5d71d85 100644 --- a/smbll/smbll_01.c +++ b/smbll/smbll_01.c @@ -401,7 +401,7 @@ void Smbll_SpawnCastleTilesWithPriority() { v0 = *(uint16 *)vram_buffer1; v1 = 0; do { - v2 = IndirPtr(&tempF3, v1); + v2 = IndirPtr((LongPtr *)&tempF3, v1); v3 = *(uint16 *)v2; *(uint16 *)&vram_buffer1[v0 + 2] = *(uint16 *)v2; v1 += 2; @@ -544,7 +544,7 @@ void Smbll_DecodeAreaData_Sub2_New(uint16 j) { tempF4 = HIBYTE(addr); tempF3 = addr; tempF5 = area_data_ptr.bank; - v3 = IndirPtr(&tempF3, j + 2); + v3 = IndirPtr((LongPtr *)&tempF3, j + 2); v4 = *v3 & 0x7F; v5 = (int)(uint8)v4 >> 1; R0_ = *((uint8 *)koff_188C1 + (*v3 & 0x7F)); @@ -848,8 +848,8 @@ uint8 Smbll_CODE_0491C0(uint8 k) { uint16 v1; // di v1 = area_obj_offset_buffer[(uint16)(2 * k) >> 1] + 1; - R7_ = *IndirPtr(&tempF3, v1) >> 4; - return *IndirPtr(&tempF3, v1) & 0xF; + R7_ = *IndirPtr((LongPtr *)&tempF3, v1) >> 4; + return *IndirPtr((LongPtr *)&tempF3, v1) & 0xF; } uint8 Smbll_CODE_0491DD() { @@ -1199,7 +1199,7 @@ PairU16 Smbll_CODE_049724(uint8 k, uint8 j) { *(uint16 *)&R4_ = 1; *(uint16 *)&R0_ = 16; do { - palette_mirror[k >> 1] = *(uint16 *)IndirPtr(&R2_, j); + palette_mirror[k >> 1] = *(uint16 *)IndirPtr((LongPtr *)&R2_, j); j += 2; k += 2; --*(uint16 *)&R0_; @@ -1242,7 +1242,7 @@ void Smbll_CODE_04973C() { *(uint16 *)&tempF6 = v3; tempF7 = *((uint8 *)kword_1B4BA + (uint16)(*(uint16 *)&tempF8 + 1)) & 0x3F; while (1) { - IndirWriteByte(&tempF3, v2, tempF7); + IndirWriteByte((LongPtr *)&tempF3, v2, tempF7); if (!tempF6 || (v2 & 0xF0) == 0xD0) break; LOBYTE(v1) = v2 + 16; diff --git a/smbll/smbll_02.c b/smbll/smbll_02.c index cacd90b..55011db 100644 --- a/smbll/smbll_02.c +++ b/smbll/smbll_02.c @@ -1103,12 +1103,12 @@ void Smbll_GenerateLayer2Map16() { v3 = *(uint16 *)&tempE4; v4 = 8 * (uint8)v2; v5 = *(uint16 *)&tempE4 >> 1; - layer2_map16_table[v5] = *(uint16 *)IndirPtr(&R0_, v4); + layer2_map16_table[v5] = *(uint16 *)IndirPtr((LongPtr *)&R0_, v4); v4 += 2; - layer2_map16_table[v5 + 1] = *(uint16 *)IndirPtr(&R0_, v4); + layer2_map16_table[v5 + 1] = *(uint16 *)IndirPtr((LongPtr *)&R0_, v4); v4 += 2; - layer2_map16_table[v5 + 32] = *(uint16 *)IndirPtr(&R0_, v4); - layer2_map16_table[v5 + 33] = *(uint16 *)IndirPtr(&R0_, v4 + 2); + layer2_map16_table[v5 + 32] = *(uint16 *)IndirPtr((LongPtr *)&R0_, v4); + layer2_map16_table[v5 + 33] = *(uint16 *)IndirPtr((LongPtr *)&R0_, v4 + 2); v1 = v6 + 1; if ((((uint8)v6 + 1) & 0xF) == 0) v3 += 64; diff --git a/smbll/smbll_08.c b/smbll/smbll_08.c index 0894a8d..58e8e19 100644 --- a/smbll/smbll_08.c +++ b/smbll/smbll_08.c @@ -58,10 +58,10 @@ void Smbll_HandleSPCUploads_Main() { LOBYTE(v1) = -52; while (1) { v13 = v1; - v9 = IndirPtr(&R0_, v0); + v9 = IndirPtr((LongPtr *)&R0_, v0); v10 = v0 + 2; v4 = *(uint16 *)v9; - v11 = *(uint16 *)IndirPtr(&R0_, v10); + v11 = *(uint16 *)IndirPtr((LongPtr *)&R0_, v10); v12 = v10 + 2; WriteRegWord(APUI02, v11); WriteReg(APUI01, v4 != 0); @@ -70,14 +70,14 @@ void Smbll_HandleSPCUploads_Main() { ; if (Unreachable()) break; - v2 = IndirPtr(&R0_, v12); + v2 = IndirPtr((LongPtr *)&R0_, v12); v0 = v12 + 1; HIBYTE(v1) = *v2; for (LOBYTE(v1) = 0;; LOBYTE(v1) = v1 + 1) { WriteRegWord(APUI00, v1); if (!--v4) break; - v3 = IndirPtr(&R0_, v0++); + v3 = IndirPtr((LongPtr *)&R0_, v0++); HIBYTE(v1) = *v3; while ((uint8)v1 != ReadReg(APUI00)) ; diff --git a/smbll/smbll_cpu_infra.c b/smbll/smbll_cpu_infra.c index 81599c3..749f976 100644 --- a/smbll/smbll_cpu_infra.c +++ b/smbll/smbll_cpu_infra.c @@ -154,7 +154,9 @@ void SmbllRunOneFrameOfGame(void) { } } +static void SmbllDrawPpuFrame(void) { +} const RtlGameInfo kSmbllGameInfo = { "smbll", kGameID_SMBLL, @@ -163,5 +165,6 @@ const RtlGameInfo kSmbllGameInfo = { &SmbllCpuInitialize, &SmbllRunOneFrameOfGame, &SmbllRunOneFrameOfGame_Emulated, + &SmbllDrawPpuFrame, &SmbllFixSnapshotForCompare, }; diff --git a/src/common_cpu_infra.c b/src/common_cpu_infra.c index da7f846..a7962ce 100644 --- a/src/common_cpu_infra.c +++ b/src/common_cpu_infra.c @@ -186,6 +186,19 @@ static void VerifySnapshotsEq(Snapshot *b, Snapshot *a, Snapshot *prev) { } } + if (memcmp(b->cgram, a->cgram, sizeof(uint16) * 0x100)) { + fprintf(stderr, "@%d: VRAM cgram compare failed (mine != theirs, prev):\n", snes_frame_counter); + for (size_t i = 0, j = 0; i < 0x100; i++) { + if (a->cgram[i] != b->cgram[i]) { + fprintf(stderr, "0x%.6X: %.4X != %.4X (%.4X)\n", (int)i, b->cgram[i], a->cgram[i], prev->cgram[i]); + g_fail = true; + if (++j >= 16) + break; + } + } + } + + #endif } @@ -200,6 +213,7 @@ static void MakeSnapshot(Snapshot *s) { memcpy(s->sram, g_snes->cart->ram, g_snes->cart->ramSize); memcpy(s->vram, g_snes->ppu->vram, sizeof(uint16) * 0x8000); memcpy(s->oam, g_snes->ppu->oam, sizeof(uint16) * 0x120); + memcpy(s->cgram, g_snes->ppu->cgram, sizeof(uint16) * 0x100); } static void MakeMySnapshot(Snapshot *s) { @@ -207,6 +221,7 @@ static void MakeMySnapshot(Snapshot *s) { memcpy(s->sram, g_snes->cart->ram, g_snes->cart->ramSize); memcpy(s->vram, g_snes->ppu->vram, sizeof(uint16) * 0x8000); memcpy(s->oam, g_snes->ppu->oam, sizeof(uint16) * 0x120); + memcpy(s->cgram, g_snes->ppu->cgram, sizeof(uint16) * 0x100); } static void RestoreSnapshot(Snapshot *s) { @@ -220,6 +235,7 @@ static void RestoreSnapshot(Snapshot *s) { memcpy(g_snes->cart->ram, s->sram, g_snes->cart->ramSize); memcpy(g_snes->ppu->vram, s->vram, sizeof(uint16) * 0x8000); memcpy(g_snes->ppu->oam, s->oam, sizeof(uint16) * 0x120); + memcpy(g_snes->ppu->cgram, s->cgram, sizeof(uint16) * 0x100); } static bool loadRom(const char *name, Snes *snes) { @@ -344,11 +360,13 @@ static void RtlRunFrameCompare(uint16 input, int run_what) { if (g_runmode == RM_THEIRS) { g_use_my_apu_code = false; + g_snes->ppu = g_snes->snes_ppu; g_snes->runningWhichVersion = 1; g_rtl_game_info->run_frame_emulated(); g_snes->runningWhichVersion = 0; } else if (g_runmode == RM_MINE) { g_use_my_apu_code = true; + g_snes->ppu = g_snes->snes_ppu; g_snes->runningWhichVersion = 2; g_rtl_game_info->run_frame(); g_snes->runningWhichVersion = 0; diff --git a/src/common_cpu_infra.h b/src/common_cpu_infra.h index 2a0edb1..97330c5 100644 --- a/src/common_cpu_infra.h +++ b/src/common_cpu_infra.h @@ -30,6 +30,7 @@ typedef struct RtlGameInfo { CpuInfraInitializeFunc *initialize; RunOneFrameOfGameFunc *run_frame; RunOneFrameOfGameFunc *run_frame_emulated; + RunOneFrameOfGameFunc *draw_ppu_frame; FixSnapshotForCompareFunc *fix_snapshot_for_compare; } RtlGameInfo; @@ -44,6 +45,7 @@ typedef struct Snapshot { uint8 sram[0x2000]; uint16 oam[0x120]; + uint16 cgram[0x100]; } Snapshot; extern const RtlGameInfo kSmwGameInfo; diff --git a/src/common_rtl.c b/src/common_rtl.c index bbc34a7..a05b23b 100644 --- a/src/common_rtl.c +++ b/src/common_rtl.c @@ -9,7 +9,10 @@ struct StateRecorder; static void RtlSaveMusicStateToRam_Locked(); static void RtlRestoreMusicAfterLoad_Locked(bool is_reset); +static uint8 RtlApuReadReg(int reg); + void SmwSavePlaythroughSnapshot(); +void SmwLoadNextPlaybackSnapshot(); uint8 g_ram[0x20000]; uint8 *g_sram; @@ -18,6 +21,7 @@ const uint8 *g_rom; bool g_is_uploading_apu; bool g_did_finish_level_hook; uint8 game_id; +bool g_playback_mode; static uint8 *g_rtl_memory_ptr; static RunFrameFunc *g_rtl_runframe; @@ -392,11 +396,6 @@ void RtlStopReplay(void) { StateRecorder_StopReplay(&state_recorder); } -enum { - // Version was bumped to 1 after I fixed bug #1 - kCurrentBugFixCounter = 1, -}; - bool RtlRunFrame(int inputs) { if (g_did_finish_level_hook) { if (game_id == kGameID_SMW && !state_recorder.replay_mode && g_config.save_playthrough) { @@ -404,6 +403,8 @@ bool RtlRunFrame(int inputs) { RtlClearKeyLog(); } g_did_finish_level_hook = false; + if (g_playback_mode) + SmwLoadNextPlaybackSnapshot(); } // Avoid up/down and left/right from being pressed at the same time @@ -422,6 +423,17 @@ bool RtlRunFrame(int inputs) { inputs = state_recorder.last_inputs; } StateRecorder_Record(&state_recorder, inputs); + + if (game_id == kGameID_SMW) { + // This is whether APUI02 is true or false, this is used by the ancilla code. + uint8 apui02 = RtlApuReadReg(2); + if (apui02 != g_ram[kSmwRam_APUI02]) { + g_ram[kSmwRam_APUI02] = apui02; + StateRecorder_RecordPatchByte(&state_recorder, kSmwRam_APUI02, &apui02, 1); + } + } + + } g_rtl_runframe(inputs, 0); @@ -441,12 +453,48 @@ void RtlSaveSnapshot(const char *filename, bool saving_with_bug) { fclose(f); } +static void RtlLoadFromFile(FILE *f, bool replay) { + RtlApuLock(); + + Ppu *ppu = g_snes->ppu; + g_snes->ppu = g_snes->snes_ppu; + + StateRecorder_Load(&state_recorder, f, replay); + ppu_copy(g_snes->my_ppu, g_snes->ppu); + + g_snes->ppu = ppu; + RtlApuUnlock(); + RtlSynchronizeWholeState(); +} + static const char *const kBugSaves[] = { -"smb1-bug-1685653215", + "playthrough/1_1", }; + +static int g_playback_ctr = ( 89 - 1) * 2; // 49 +void SmwLoadNextPlaybackSnapshot() { + char name[128]; + for (int i = 0; i < 100; i++) { + g_playback_ctr++; + sprintf(name, "saves/playthrough/%d_%d.sav", g_playback_ctr >> 1, (g_playback_ctr & 1) + 1); + FILE *f = fopen(name, "rb"); + if (f) { + printf("Playthrough %s\n", name); + RtlLoadFromFile(f, true); + fclose(f); + return; + } + } +} + void RtlSaveLoad(int cmd, int slot) { char name[128]; + if (cmd == kSaveLoad_Replay && slot == 256) { + g_playback_mode = 1; + SmwLoadNextPlaybackSnapshot(); + return; + } if (slot >= 256) { int i = slot - 256; if (cmd == kSaveLoad_Save || i >= sizeof(kBugSaves) / sizeof(kBugSaves[0])) @@ -461,23 +509,19 @@ void RtlSaveLoad(int cmd, int slot) { printf("*** %s slot %d: %s\n", cmd == kSaveLoad_Save ? "Saving" : cmd == kSaveLoad_Load ? "Loading" : "Replaying", slot, name); if (cmd != kSaveLoad_Save) { - FILE *f = fopen(name, "rb"); if (f == NULL) { printf("Failed fopen: %s\n", name); return; } - RtlApuLock(); - StateRecorder_Load(&state_recorder, f, cmd == kSaveLoad_Replay); - ppu_copy(g_snes->my_ppu, g_snes->ppu); - RtlApuUnlock(); - RtlSynchronizeWholeState(); + RtlLoadFromFile(f, cmd == kSaveLoad_Replay); fclose(f); } else { RtlSaveSnapshot(name, false); } } + void MemCpy(void *dst, const void *src, int size) { memcpy(dst, src, size); } @@ -548,7 +592,7 @@ void WriteRegWord(uint16 reg, uint16 value) { WriteReg(reg + 1, value >> 8); } -uint8 *IndirPtr(void *ptr, uint16 offs) { +uint8 *IndirPtr(LongPtr *ptr, uint16 offs) { uint32 a = (*(uint32 *)ptr & 0xffffff) + offs; if ((a >> 16) >= 0x7e && (a >> 16) <= 0x7f || (a & 0xffff) < 0x2000) { return &g_ram[a & 0x1ffff]; @@ -557,12 +601,12 @@ uint8 *IndirPtr(void *ptr, uint16 offs) { } } -void IndirWriteWord(void *ptr, uint16 offs, uint16 value) { +void IndirWriteWord(LongPtr *ptr, uint16 offs, uint16 value) { uint8 *p = IndirPtr(ptr, offs); WORD(*p) = value; } -void IndirWriteByte(void *ptr, uint16 offs, uint8 value) { +void IndirWriteByte(LongPtr *ptr, uint16 offs, uint8 value) { uint8 *p = IndirPtr(ptr, offs); p[0] = value; } @@ -604,7 +648,7 @@ void RtlSetUploadingApu(bool uploading) { RtlApuUnlock(); } -void RtlApuWrite(uint32 adr, uint8 val) { +void RtlApuWrite(uint16 adr, uint8 val) { assert(adr >= APUI00 && adr <= APUI03); if (g_is_uploading_apu) { @@ -685,6 +729,12 @@ void RtlApuReset() { RtlApuUnlock(); } +static uint8 RtlApuReadReg(int reg) { + if (g_use_my_apu_code) + return g_spc_player->port_to_snes[reg]; + return g_snes->apu->outPorts[reg]; +} + void RtlRestoreMusicAfterLoad_Locked(bool is_reset) { if (g_use_my_apu_code) { memcpy(g_spc_player->ram, g_snes->apu->ram, 65536); @@ -764,3 +814,164 @@ void RtlWriteSram(void) { } } + + +void SmwCopyToVram(uint16 vram_addr, const uint8 *src, int n) { + for (size_t i = 0; i < (n >> 1); i++) + g_snes->ppu->vram[vram_addr + i] = WORD(src[i * 2]); +} + +void SmwCopyToVramPitch32(uint16 vram_addr, const uint8 *src, int n) { + for (size_t i = 0; i < (n >> 1); i++) + g_snes->ppu->vram[vram_addr + i * 32] = WORD(src[i * 2]); +} + +void SmwCopyToVramLow(uint16 vram_addr, const uint8 *src, int n) { + for (size_t i = 0; i < n; i++) + g_snes->ppu->vram[vram_addr + i] = (g_snes->ppu->vram[vram_addr + i] & 0xff00) | src[i]; +} + +void RtlUpdatePalette(const uint16 *src, int dst, int n) { + for(int i = 0; i < n; i++) + g_snes->ppu->cgram[dst + i] = src[i]; +} + +void SmwClearVram(uint16 vram_addr, uint16 value, int n) { + for (int i = 0; i < n; i++) + g_snes->ppu->vram[vram_addr + i] = value; +} + +uint16 *RtlGetVramAddr() { + return g_snes->ppu->vram; +} + +void RtlPpuWrite(uint16 addr, uint8 value) { + assert((addr & 0xff00) == 0x2100); + ppu_write(g_snes->ppu, addr, value); +} + +void RtlPpuWriteTwice(uint16 addr, uint16 value) { + RtlPpuWrite(addr, value); + RtlPpuWrite(addr, value >> 8); +} + +void RtlHdmaSetup(uint8 which, uint8 transfer_unit, uint8 reg, uint32 addr, uint8 indirect_bank) { + Dma *dma = g_snes->dma; + dma_write(dma, DMAP0 + which * 16, transfer_unit); + dma_write(dma, BBAD0 + which * 16, reg); + dma_write(dma, A1T0L + which * 16, addr); + dma_write(dma, A1T0H + which * 16, addr >> 8); + dma_write(dma, A1B0 + which * 16, addr >> 16); + dma_write(dma, DAS00 + which * 16, indirect_bank); +} + +void RtlEnableVirq(int line) { + g_snes->vIrqEnabled = line >= 0; + if (line >= 0) + g_snes->vTimer = line; +} + +static const uint8 kSetupHDMAWindowingEffects_DATA_00927C[] = { 0xF0,0xA0, 4,0xF0,0x80, 5, 0 }; +static const uint8 *SimpleHdma_GetPtr(uint32 p) { + if (game_id == kGameID_SMW) { + switch (p) { + case 0x927c: return kSetupHDMAWindowingEffects_DATA_00927C; + } + if (p < 0x2000) + return g_ram + p; + } + printf("SimpleHdma_GetPtr: bad addr 0x%x\n", p); + return NULL; +} + +void SimpleHdma_Init(SimpleHdma *c, DmaChannel *dc) { + if (!dc->hdmaActive) { + c->table = 0; + return; + } + c->table = SimpleHdma_GetPtr(dc->aAdr | dc->aBank << 16); + c->rep_count = 0; + c->mode = dc->mode | dc->indirect << 6; + c->ppu_addr = dc->bAdr; + c->indir_bank = dc->indBank; +} + +void SimpleHdma_DoLine(SimpleHdma *c) { + static const uint8 bAdrOffsets[8][4] = { + {0, 0, 0, 0}, + {0, 1, 0, 1}, + {0, 0, 0, 0}, + {0, 0, 1, 1}, + {0, 1, 2, 3}, + {0, 1, 0, 1}, + {0, 0, 0, 0}, + {0, 0, 1, 1} + }; + static const uint8 transferLength[8] = { + 1, 2, 2, 4, 4, 4, 2, 4 + }; + + if (c->table == NULL) + return; + bool do_transfer = false; + if ((c->rep_count & 0x7f) == 0) { + c->rep_count = *c->table++; + if (c->rep_count == 0) { + c->table = NULL; + return; + } + if(c->mode & 0x40) { + c->indir_ptr = SimpleHdma_GetPtr(c->indir_bank << 16 | c->table[0] | c->table[1] * 256); + c->table += 2; + } + do_transfer = true; + } + if(do_transfer || c->rep_count & 0x80) { + for(int j = 0, j_end = transferLength[c->mode & 7]; j < j_end; j++) { + uint8 v = c->mode & 0x40 ? *c->indir_ptr++ : *c->table++; + RtlPpuWrite(0x2100 + c->ppu_addr + bAdrOffsets[c->mode & 7][j], v); + } + } + c->rep_count--; +} + + +void LoadStripeImage_UploadToVRAM(const uint8 *pp) { // 00871e + while (1) { + if ((*pp & 0x80) != 0) + break; + uint16 vram_addr = pp[0] << 8 | pp[1]; + uint8 vmain = __CFSHL__(pp[2], 1); + uint8 fixed_addr = (uint8)(pp[2] & 0x40) >> 3; + uint16 num = (swap16(WORD(pp[2])) & 0x3FFF) + 1; + uint16 *dst = g_snes->ppu->vram + vram_addr; + pp += 4; + + if (fixed_addr) { + uint16 src_data = WORD(*pp); + int ctr = (num + 1) >> 1; + if (vmain) { + for (int i = 0; i < ctr; i++) + dst[i * 32] = src_data; + } else { + // uhm...? + uint8 *dst_b = (uint8 *)dst; + for (int i = 0; i < num; i++) + dst_b[i + ((i & 1) << 1)] = src_data; + for (int i = 0; i < num; i += 2) + dst_b[i + 1] = src_data >> 8; + } + pp += 2; + } else { + uint16 *src = (uint16 *)pp; + if (vmain) { + for (int i = 0; i < (num >> 1); i++) + dst[i * 32] = src[i]; + } else { + for (int i = 0; i < (num >> 1); i++) + dst[i] = src[i]; + } + pp += num; + } + } +} diff --git a/src/common_rtl.h b/src/common_rtl.h index 6d29fe7..0aaa366 100644 --- a/src/common_rtl.h +++ b/src/common_rtl.h @@ -10,6 +10,29 @@ enum { kGameID_SMBLL = 3, }; +enum { + // Version was bumped to 1 after I fixed bug #1 + kCurrentBugFixCounter = 1, + + kSmwRam_APUI02 = 0x18c5, +}; + +typedef struct SimpleHdma { + const uint8 *table; + const uint8 *indir_ptr; + uint8 rep_count; + uint8 mode; + uint8 ppu_addr; + uint8 indir_bank; +} SimpleHdma; + +typedef struct DmaChannel DmaChannel; + +void SimpleHdma_Init(SimpleHdma *c, DmaChannel *dc); +void SimpleHdma_DoLine(SimpleHdma *c); +void RtlHdmaSetup(uint8 which, uint8 transfer_unit, uint8 reg, uint32 addr, uint8 indirect_bank); + + extern uint8 g_ram[0x20000]; extern uint8 *g_sram; extern int g_sram_size; @@ -61,7 +84,6 @@ static inline const uint8 *RomPtr_0E(uint16_t addr) { return RomPtr(0x0e0000 | a static inline const uint8 *RomPtr_0F(uint16_t addr) { return RomPtr(0x0f0000 | addr); } static inline const uint8 *RomPtrWithBank(uint8 bank, uint16_t addr) { return RomPtr((bank << 16) | addr); } -extern void RtlApuWrite(uint32 adr, uint8 val); uint16 Mult8x8(uint8 a, uint8 b); uint16 SnesDivide(uint16 a, uint8 b); uint16 SnesModulus(uint16 a, uint8 b); @@ -71,9 +93,9 @@ void WriteReg(uint16 reg, uint8 value); void WriteRegWord(uint16 reg, uint16 value); uint16 ReadRegWord(uint16 reg); uint8 ReadReg(uint16 reg); -uint8_t *IndirPtr(void *ptr, uint16 offs); -void IndirWriteWord(void *ptr, uint16 offs, uint16 value); -void IndirWriteByte(void *ptr, uint16 offs, uint8 value); +uint8_t *IndirPtr(LongPtr *ptr, uint16 offs); +void IndirWriteWord(LongPtr *ptr, uint16 offs, uint16 value); +void IndirWriteByte(LongPtr *ptr, uint16 offs, uint8 value); typedef void RunFrameFunc(uint16 input, int run_what); @@ -104,6 +126,14 @@ void RtlReadSram(); void RtlWriteSram(); void RtlSaveSnapshot(const char *filename, bool saving_with_bug); +void RtlUpdatePalette(const uint16 *src, int dst, int n); +uint16 *RtlGetVramAddr(); +void RtlPpuWrite(uint16 addr, uint8 value); +void RtlPpuWriteTwice(uint16 addr, uint16 value); +void RtlApuWrite(uint16 adr, uint8 val); +void RtlEnableVirq(int line); + + enum { kJoypadL_A = 0x80, kJoypadL_X = 0x40, diff --git a/src/consts.h b/src/consts.h index 24302fe..f736ac1 100644 --- a/src/consts.h +++ b/src/consts.h @@ -1,1469 +1,59 @@ -#define kCompressOAMTileSizeBuffer_DATA_008475 ((uint8*)RomFixedPtr(0x8475)) +#include "types.h" #define kLoadStripeImage_StripeImagePtrs ((LongPtr*)RomFixedPtr(0x84D0)) -#define kClearLayer3Tilemap_PARAMS_008649 ((uint8*)RomFixedPtr(0x8649)) -#define kUploadLevelLayer1And2Tilemaps_PARAMS_008A16 ((uint8*)RomFixedPtr(0x8A16)) -#define kUploadLevelLayer1And2Tilemaps_PARAMS_008A1D ((uint8*)RomFixedPtr(0x8A1D)) -#define kUploadLevelLayer1And2Tilemaps_PARAMS_008A24 ((uint8*)RomFixedPtr(0x8A24)) -#define kUploadLevelLayer1And2Tilemaps_PARAMS_008A2B ((uint8*)RomFixedPtr(0x8A2B)) -#define kUploadLevelLayer1And2Tilemaps_PARAMS_008A32 ((uint8*)RomFixedPtr(0x8A32)) -#define kUploadLevelLayer1And2Tilemaps_PARAMS_008A39 ((uint8*)RomFixedPtr(0x8A39)) -#define kUploadLevelLayer1And2Tilemaps_PARAMS_008A40 ((uint8*)RomFixedPtr(0x8A40)) -#define kUploadLevelLayer1And2Tilemaps_PARAMS_008A47 ((uint8*)RomFixedPtr(0x8A47)) -#define kManipulateMode7Image_DATA_008AB4 ((uint16*)RomFixedPtr(0x8AB4)) -#define kManipulateMode7Image_DATA_008ABC ((uint16*)RomFixedPtr(0x8ABC)) +#define kChangeNetDoorTiles_DATA_00C32E ((LongPtr*)RomFixedPtr(0xC32E)) #define kManipulateMode7Image_DATA_008B57 ((uint16*)RomFixedPtr(0x8B57)) -#define kStatusBarTilemap_SecondRow ((uint8*)RomFixedPtr(0x8C89)) -#define kInitializeStatusBarTilemap_PARAMS_008D90 ((uint8*)RomFixedPtr(0x8D90)) -#define kInitializeStatusBarTilemap_PARAMS_008D97 ((uint8*)RomFixedPtr(0x8D97)) -#define kInitializeStatusBarTilemap_PARAMS_008D9E ((uint8*)RomFixedPtr(0x8D9E)) -#define kInitializeStatusBarTilemap_PARAMS_008DA5 ((uint8*)RomFixedPtr(0x8DA5)) -#define kUploadStatusBarTilemap_PARAMS_StBr1 ((uint8*)RomFixedPtr(0x8DE7)) -#define kUploadStatusBarTilemap_PARAMS_StBr2 ((uint8*)RomFixedPtr(0x8DEE)) -#define kUpdateStatusBarCounters_DATA_008DF5 ((uint8*)RomFixedPtr(0x8DF5)) -#define kUpdateStatusBarCounters_ItemBoxItemTile ((uint8*)RomFixedPtr(0x8DFA)) -#define kUpdateStatusBarCounters_StarPaletteFrames ((uint8*)RomFixedPtr(0x8DFE)) -#define kUpdateStatusBarCounters_ItemBoxItemProperties ((uint8*)RomFixedPtr(0x8E02)) -#define kUpdateStatusBarCounters_BonusStarCounterNumberTiles ((uint8*)RomFixedPtr(0x8E06)) -#define kUpdateStatusBarCounters_DATA_008FFA ((uint16*)RomFixedPtr(0x8FFA)) -#define kDrawLoadingLetters_TileData ((uint8*)RomFixedPtr(0x90D1)) -#define kDrawLoadingLetters_TileData_BottomTiles ((uint8*)RomFixedPtr(0x9105)) -#define kDrawLoadingLetters_TileData_TopProp ((uint8*)RomFixedPtr(0x9139)) -#define kDrawLoadingLetters_TileData_BottomProp ((uint8*)RomFixedPtr(0x916A)) -#define kUpdateEntirePalette_PARAMS_009249 ((uint8*)RomFixedPtr(0x9249)) -#define kSetupHDMAWindowingEffects_PARAMS_009277 ((uint8*)RomFixedPtr(0x9277)) -#define kSetEnemyRollcallParallaxHDMA_PARAMS_009313 ((uint8*)RomFixedPtr(0x9313)) -#define kSetEnemyRollcallParallaxHDMA_PARAMS_009318 ((uint8*)RomFixedPtr(0x9318)) -#define kSetEnemyRollcallParallaxHDMA_PARAMS_00931D ((uint8*)RomFixedPtr(0x931D)) -#define kGameMode00_LoadNintendoPresents_XDisp ((uint8*)RomFixedPtr(0x9389)) -#define kGameMode00_LoadNintendoPresents_Tiles ((uint8*)RomFixedPtr(0x938D)) -#define kGameMode19_Cutscene_SkyColorSetting ((uint8*)RomFixedPtr(0x9451)) -#define kGameMode19_Cutscene_BGPaletteSetting ((uint8*)RomFixedPtr(0x9459)) -#define kGameMode19_Cutscene_BGToUse ((uint8*)RomFixedPtr(0x9461)) -#define kUploadMode7KoopaBossesAndLavaAnimation_VRAMAddressToUpload ((uint16*)RomFixedPtr(0x9891)) -#define kHandleMenuCursor_DATA_009AC8 ((uint8*)RomFixedPtr(0x9AC8)) -#define kGameMode09_EraseFile_DATA_009B17 ((uint8*)RomFixedPtr(0x9B17)) -#define kGameMode07_TitleScreenDemo_ItrCntrlrSqnc ((uint8*)RomFixedPtr(0x9C1F)) -#define kSaveFileLocations_Hi ((uint8*)RomFixedPtr(0x9CCB)) -#define kSaveFileLocations_Lo ((uint8*)RomFixedPtr(0x9CCE)) -#define kHandleMenuCursor_DATA_009E6A ((uint16*)RomFixedPtr(0x9E6A)) -#define kHandleMenuCursor_DATA_009E74 ((uint16*)RomFixedPtr(0x9E74)) -#define kHandleMenuCursor_DATA_009E7E ((uint8*)RomFixedPtr(0x9E7E)) -#define kInitializeSaveData_InitialLevelFlags ((uint16*)RomFixedPtr(0x9EE0)) -#define kInitializeSaveData_InitialOWPlayerPos ((uint8*)RomFixedPtr(0x9EF0)) -#define kGameModeXX_FadeInOrOut_DATA_009F2F ((uint8*)RomFixedPtr(0x9F2F)) -#define kGameModeXX_FadeInOrOut_DATA_009F31 ((uint8*)RomFixedPtr(0x9F31)) -#define kGameModeXX_FadeInOrOut_DATA_009F33 ((uint8*)RomFixedPtr(0x9F33)) -#define kInitializeLevelLayer3_DATA_009F88 ((uint8*)RomFixedPtr(0x9F88)) -#define kGameMode0C_LoadOverworld_DATA_00A06B ((uint16*)RomFixedPtr(0xA06B)) -#define kGameMode0C_LoadOverworld_DATA_00A079 ((uint16*)RomFixedPtr(0xA079)) -#define kGameMode14_InLevel_GrndShakeDispYLo ((uint8*)RomFixedPtr(0xA1CE)) -#define kGameMode14_InLevel_GrndShakeDispYHi ((uint8*)RomFixedPtr(0xA1D2)) #define kUpdatePaletteFromIndexedTable_DATA_00A47F ((uint8*)RomFixedPtr(0xA47F)) -#define kUploadOverworldLayer1And2Tilemaps_DATA_00A521 ((uint8*)RomFixedPtr(0xA521)) -#define kUploadOverworldLayer1And2Tilemaps_DATA_00A525 ((uint8*)RomFixedPtr(0xA525)) -#define kUploadOverworldLayer1And2Tilemaps_PARAMS_00A586 ((uint8*)RomFixedPtr(0xA586)) -#define kUploadOverworldLayer1And2Tilemaps_PARAMS_00A58D ((uint8*)RomFixedPtr(0xA58D)) -#define kInitializeLevelRAM_DATA_00A60D ((uint8*)RomFixedPtr(0xA60D)) -#define kInitializeLevelRAM_DATA_00A611 ((uint16*)RomFixedPtr(0xA611)) -#define kInitializeLevelRAM_DATA_00A61D ((uint8*)RomFixedPtr(0xA61D)) -#define kInitializeLevelRAM_DATA_00A625 ((uint8*)RomFixedPtr(0xA625)) -#define kUploadGraphicsFiles_SpriteGFXList ((uint8*)RomFixedPtr(0xA8C3)) -#define kUploadGraphicsFiles_FGAndBGGFXList ((uint8*)RomFixedPtr(0xA92B)) -#define kUploadGraphicsFiles_DATA_00A9D2 ((uint8*)RomFixedPtr(0xA9D2)) -#define kUploadGraphicsFiles_DATA_00A9D6 ((uint8*)RomFixedPtr(0xA9D6)) -#define kBufferPalettesRoutines_DATA_00ABD3 ((uint8*)RomFixedPtr(0xABD3)) -#define kBufferPalettesRoutines_DATA_00ABDF ((uint16*)RomFixedPtr(0xABDF)) -#define kBufferPalettesRoutines_DATA_00AD1E ((uint8*)RomFixedPtr(0xAD1E)) -#define kUpdatePaletteFromIndexedTable_DATA_00AE41 ((uint8*)RomFixedPtr(0xAE41)) -#define kUpdatePaletteFromIndexedTable_DATA_00AE44 ((uint8*)RomFixedPtr(0xAE44)) -#define kHandlePaletteFades_DATA_00AE65 ((uint16*)RomFixedPtr(0xAE65)) -#define kHandlePaletteFades_DATA_00AE6B ((uint16*)RomFixedPtr(0xAE6B)) -#define kHandlePaletteFades_DATA_00AE71 ((uint16*)RomFixedPtr(0xAE71)) -#define kHandlePaletteFades_DATA_00AE77 ((uint16*)RomFixedPtr(0xAE77)) -#define kHandlePaletteFades_DATA_00AEF7 ((uint16*)RomFixedPtr(0xAEF7)) -#define kGlobalPalettes_Sky (*(uint16*)RomFixedPtr(0xB0A0)) -#define kGlobalPalettes_BowserEnd ((uint16*)RomFixedPtr(0xB3C0)) -#define kGlobalPalettes_B3CC ((uint16*)RomFixedPtr(0xB3CC)) -#define kGlobalPalettes_BowserLightningFlash ((uint16*)RomFixedPtr(0xB5DE)) -#define kGlobalPalettes_Flashing ((uint16*)RomFixedPtr(0xB60C)) -#define kGlobalPalettes_Layer3Smasher ((uint16*)RomFixedPtr(0xB66C)) -#define kGlobalPalettes_Bowser ((uint16*)RomFixedPtr(0xB69E)) -#define kGlobalPalettes_EndingLuigi ((uint16*)RomFixedPtr(0xB70E)) -#define kGlobalPalettes_EndingMario ((uint16*)RomFixedPtr(0xB71A)) -#define kGlobalPalettes_EndingToadstool ((uint16*)RomFixedPtr(0xB726)) -#define kGraphicsDecompressionRoutines_GraphicsPtrLo ((uint8*)RomFixedPtr(0xB992)) -#define kGraphicsDecompressionRoutines_GraphicsPtrHi ((uint8*)RomFixedPtr(0xB9C4)) -#define kGraphicsDecompressionRoutines_GraphicsPtrBank ((uint8*)RomFixedPtr(0xB9F6)) -#define kLevelDataLayoutTables_EightBitLo ((uint8*)RomFixedPtr(0xBA60)) -#define kLevelDataLayoutTables_EightBitLo_Horizontal_L2 ((uint8*)RomFixedPtr(0xBA70)) -#define kLevelDataLayoutTables_EightBitLo_Vertical ((uint8*)RomFixedPtr(0xBA80)) -#define kLevelDataLayoutTables_EightBitLo_Vertical_L2 ((uint8*)RomFixedPtr(0xBA8E)) -#define kLevelDataLayoutTables_EightBitHi ((uint8*)RomFixedPtr(0xBA9C)) -#define kLevelDataLayoutTables_EightBitHi_Horizontal_L2 ((uint8*)RomFixedPtr(0xBAAC)) -#define kLevelDataLayoutTables_EightBitHi_Vertical ((uint8*)RomFixedPtr(0xBABC)) -#define kLevelDataLayoutTables_EightBitHi_Vertical_L2 ((uint8*)RomFixedPtr(0xBACA)) -#define kLevelDataLayoutTables_Layer1LoPtrs ((uint16*)RomFixedPtr(0xBDA8)) -#define kLevelDataLayoutTables_Layer2LoPtrs ((uint16*)RomFixedPtr(0xBDE8)) -#define kLevelDataLayoutTables_Layer1HiPtrs ((uint16*)RomFixedPtr(0xBE28)) -#define kLevelDataLayoutTables_Layer2HiPtrs ((uint16*)RomFixedPtr(0xBE68)) -#define kLevelDataLayoutTables_LoTablePtrs ((uint16*)RomFixedPtr(0xBEA8)) -#define kLevelDataLayoutTables_HiTablePtrs ((uint16*)RomFixedPtr(0xBEAC)) -#define kSetItemMemoryBit_DATA_00BFFF ((uint16*)RomFixedPtr(0xBFFF)) -#define kSetItemMemoryBit_DATA_00C005 ((uint8*)RomFixedPtr(0xC005)) -#define kGenericPage00Tile_Map16Page00TileLo ((uint8*)RomFixedPtr(0xC06B)) -#define kGenericPage01Tile_Map16Page01TileLo ((uint8*)RomFixedPtr(0xC0B2)) -#define kChangeNetDoorTiles_DATA_00C32E ((LongPtr*)RomFixedPtr(0xC32E)) -#define kGameMode14_InLevel_DATA_00C470 ((uint8*)RomFixedPtr(0xC470)) -#define kGameMode14_InLevel_DATA_00C474 ((uint8*)RomFixedPtr(0xC474)) -#define kGameMode14_InLevel_DATA_00C478 ((uint8*)RomFixedPtr(0xC478)) -#define kPlayerState0C_CastleDestructionMoves_DATA_00C5E1 ((uint8*)RomFixedPtr(0xC5E1)) -#define kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData (*(uint8*)RomFixedPtr(0xC5E8)) -#define kPlayerState0C_CastleDestructionMoves_DATA_00C5E9 ((uint8*)RomFixedPtr(0xC5E9)) -#define kPlayerState0C_CastleDestructionMoves_UNK_00C6DF (*(uint8*)RomFixedPtr(0xC6DF)) -#define kPlayerState08_WarpToYoshiWingsBonus_DATA_00C7F9 ((uint16*)RomFixedPtr(0xC7F9)) -#define kPlayerState0A_NoYoshiCutscene_DATA_00C848 ((uint8*)RomFixedPtr(0xC848)) -#define kPlayerState00_LevelsThatTriggerCutscenes ((uint8*)RomFixedPtr(0xC9A7)) -#define kPlayerState00_FreeMovementDebugPlayerSpeed ((uint8*)RomFixedPtr(0xCC5C)) -#define kPlayerState_OnYoshiAnimations ((uint8*)RomFixedPtr(0xCDA9)) -#define kSetPlayerPose_DATA_00CE79 ((uint8*)RomFixedPtr(0xCE79)) -#define kSetPlayerPose_DATA_00CE7F ((uint8*)RomFixedPtr(0xCE7F)) -#define kSetPlayerPose_DATA_00CE99 ((uint8*)RomFixedPtr(0xCE99)) -#define kSetPlayerPose_DATA_00CEA1 ((uint8*)RomFixedPtr(0xCEA1)) -#define kSetPlayerPose_DATA_00CEA9 ((uint8*)RomFixedPtr(0xCEA9)) -#define kInitializeCapeSwingOrNetPunch_DATA_00D034 ((uint16*)RomFixedPtr(0xD034)) -#define kInitializeCapeSwingOrNetPunch_DATA_00D03C ((uint16*)RomFixedPtr(0xD03C)) -#define kPlayerStateXX_PowerupAnims_GrowingAniImgs ((uint8*)RomFixedPtr(0xD11D)) -#define kPlayerStateXX_EnterPipe_PipeXSpeed ((uint8*)RomFixedPtr(0xD18D)) -#define kPlayerStateXX_EnterPipe_PipeYSpeed ((uint8*)RomFixedPtr(0xD18F)) -#define kPlayerStateXX_EnterPipe_HIDEPIPESETS ((uint8*)RomFixedPtr(0xD193)) -#define kPlayerStateXX_EnterPipe_PipeCntrBoundryX ((uint8*)RomFixedPtr(0xD1FF)) -#define kPlayerStateXX_EnterPipe_PipeCntringSpeed ((uint8*)RomFixedPtr(0xD201)) -#define kHandlePlayerPhysics_JumpHeightTable ((uint8*)RomFixedPtr(0xD2BD)) -#define kHandlePlayerPhysics_DATA_00D2CD ((uint16*)RomFixedPtr(0xD2CD)) -#define kHandlePlayerPhysics_DATA_00D309 ((uint16*)RomFixedPtr(0xD309)) -#define kHandlePlayerPhysics_MarioAccel ((uint16*)RomFixedPtr(0xD345)) -#define kHandlePlayerPhysics_DATA_00D43D ((uint16*)RomFixedPtr(0xD43D)) -#define kHandlePlayerPhysics_DATA_00D535 ((uint8*)RomFixedPtr(0xD535)) -#define kHandlePlayerPhysics_DATA_00D5C9 ((uint16*)RomFixedPtr(0xD5C9)) -#define kHandlePlayerPhysics_DATA_00D5EB ((uint8*)RomFixedPtr(0xD5EB)) -#define kHandlePlayerPhysics_DATA_00D5EE ((uint8*)RomFixedPtr(0xD5EE)) -#define kHandlePlayerPhysics_DATA_00D5F0 ((uint8*)RomFixedPtr(0xD5F0)) -#define kHandlePlayerPhysics_DATA_00D7A5 ((uint8*)RomFixedPtr(0xD7A5)) -#define kHandlePlayerPhysics_DATA_00D7AF ((uint8*)RomFixedPtr(0xD7AF)) -#define kHandlePlayerPhysics_DATA_00D7B9 ((uint8*)RomFixedPtr(0xD7B9)) -#define kHandlePlayerPhysics_DATA_00D7C8 ((uint8*)RomFixedPtr(0xD7C8)) -#define kHandlePlayerPhysics_CapeSpeed ((uint8*)RomFixedPtr(0xD7CF)) -#define kHandlePlayerPhysics_DATA_00D7D4 ((uint8*)RomFixedPtr(0xD7D4)) -#define kHandlePlayerPhysics_DATA_00D7D9 ((uint8*)RomFixedPtr(0xD7D9)) -#define kHandlePlayerPhysics_SwimPoses ((uint8*)RomFixedPtr(0xD980)) -#define kHandlePlayerPhysics_SwimYSpeed ((uint8*)RomFixedPtr(0xD984)) -#define kHandlePlayerPhysics_ClimbingSpeed ((uint8*)RomFixedPtr(0xDAB7)) -#define kHandlePlayerPhysics_JumpFromVineYSpeed ((uint8*)RomFixedPtr(0xDABB)) -#define kHandlePlayerPhysics_DATA_00DABD ((uint8*)RomFixedPtr(0xDABD)) -#define kHandlePlayerPhysics_SwingOnNetDoorPoses ((uint8*)RomFixedPtr(0xDACD)) -#define kHandlePlayerPhysics_ClimbingPoses ((uint8*)RomFixedPtr(0xDADB)) -#define kHandlePlayerPhysics_NetPunchingPoses ((uint8*)RomFixedPtr(0xDADD)) -#define kHandlePlayerPhysics_DATA_00DADF ((uint8*)RomFixedPtr(0xDADF)) -#define kHandlePlayerPhysics_DATA_00DAF1 ((uint16*)RomFixedPtr(0xDAF1)) -#define kSetPlayerPose_WalkingPoseCount ((uint8*)RomFixedPtr(0xDC78)) -#define kSetPlayerPose_AnimationSpeedTable ((uint8*)RomFixedPtr(0xDC7C)) -#define kPlayerGFXRt_PlayerXYDispIndexIndex ((uint8*)RomFixedPtr(0xDCEC)) -#define kPlayerGFXRt_PlayerXYDispIndex ((uint8*)RomFixedPtr(0xDD32)) + +#define kLevelTileAnimations_FrameData ((uint16*)RomFixedPtr(0x5B999)) + #define kPlayerGFXRt_XDisp ((uint16*)RomFixedPtr(0xDD4E)) #define kPlayerGFXRt_YDisp ((uint16*)RomFixedPtr(0xDE32)) -#define kPlayerGFXRt_PowerupTilesetIndex ((uint8*)RomFixedPtr(0xDF16)) -#define kPlayerGFXRt_TilesIndex ((uint8*)RomFixedPtr(0xDF1A)) -#define kPlayerGFXRt_Tiles ((uint8*)RomFixedPtr(0xDFDA)) -#define kPlayerGFXRt_HeadTilePointerIndex ((uint8*)RomFixedPtr(0xE00C)) -#define kPlayerGFXRt_BodyTilePointerIndex ((uint8*)RomFixedPtr(0xE0CC)) -#define kPlayerGFXRt_TileXFlip ((uint8*)RomFixedPtr(0xE18C)) -#define kPlayerGFXRt_DATA_00E18E ((uint8*)RomFixedPtr(0xE18E)) -#define kPlayerGFXRt_DATA_00E1D4 ((uint8*)RomFixedPtr(0xE1D4)) -#define kPlayerGFXRt_CapeXYDispIndex ((uint8*)RomFixedPtr(0xE21A)) -#define kPlayerGFXRt_CapeTilePointerIndex ((uint8*)RomFixedPtr(0xE23A)) -#define kPlayerGFXRt_DATA_00E266 ((uint8*)RomFixedPtr(0xE266)) -#define kPlayerGFXRt_DATA_00E292 ((uint8*)RomFixedPtr(0xE292)) -#define kPlayerGFXRt_PalettePointers ((uint16*)RomFixedPtr(0xE2A2)) -#define kPlayerGFXRt_PlayerStartingOAMIndex ((uint8*)RomFixedPtr(0xE2B2)) -#define kPlayerGFXRt_CapeStartingOAMIndex ((uint8*)RomFixedPtr(0xE2B6)) -#define kPlayerGFXRt_TilePriority ((uint8*)RomFixedPtr(0xE2BA)) -#define kSlopeDataTables_Player ((uint8*)RomFixedPtr(0xE4B9)) -#define kSlopeDataTables_Player_StationaryYSpeed ((uint8*)RomFixedPtr(0xE4DA)) -#define kSlopeDataTables_Player_TowardsPeakYSpeed ((uint8*)RomFixedPtr(0xE4FB)) -#define kSlopeDataTables_Player_SnapToSlopeDistance ((uint8*)RomFixedPtr(0xE51C)) -#define kSlopeDataTables_SlopeType ((uint8*)RomFixedPtr(0xE53D)) -#define kSlopeDataTables_ShapeOfSlope ((uint8*)RomFixedPtr(0xE632)) -#define kGetPlayerLevelCollisionMap16ID_DATA_00E832 ((uint16*)RomFixedPtr(0xE832)) -#define kGetPlayerLevelCollisionMap16ID_DATA_00E89C ((uint16*)RomFixedPtr(0xE89C)) -#define kRunPlayerBlockCode_UnknownData00E8A4 ((uint16*)RomFixedPtr(0xE8A4)) -#define kHandlePlayerLevelColl_DATA_00E90A ((uint8*)RomFixedPtr(0xE90A)) -#define kHandlePlayerLevelColl_DATA_00E90D ((uint8*)RomFixedPtr(0xE90D)) -#define kHandlePlayerLevelColl_DATA_00E911 ((uint8*)RomFixedPtr(0xE911)) -#define kHandlePlayerLevelColl_DATA_00E913 ((uint16*)RomFixedPtr(0xE913)) -#define kHandlePlayerLevelColl_DATA_00E91F ((uint16*)RomFixedPtr(0xE91F)) -#define kRunPlayerBlockCode_DATA_00EAB9 ((uint8*)RomFixedPtr(0xEAB9)) -#define kRunPlayerBlockCode_DATA_00EABB ((uint8*)RomFixedPtr(0xEABB)) -#define kRunPlayerBlockCode_DATA_00EABD ((uint16*)RomFixedPtr(0xEABD)) -#define kRunPlayerBlockCode_WaterSlopeMap16Numbers ((uint8*)RomFixedPtr(0xEAC1)) -#define kCheckIfBlockWasHit_DATA_00F05C ((uint8*)RomFixedPtr(0xF05C)) -#define kCheckIfBlockWasHit_DATA_00F080 ((uint8*)RomFixedPtr(0xF080)) -#define kCheckIfBlockWasHit_DATA_00F0A4 ((uint8*)RomFixedPtr(0xF0A4)) -#define kCheckIfBlockWasHit_DATA_00F0C8 ((uint8*)RomFixedPtr(0xF0C8)) -#define kCheckIfBlockWasHit_DATA_00F0EC ((uint8*)RomFixedPtr(0xF0EC)) -#define kCheckIfBlockWasHit_DATA_00F0F8 ((uint8*)RomFixedPtr(0xF0F8)) -#define kCheckIfBlockWasHit_DATA_00F100 ((uint8*)RomFixedPtr(0xF100)) -#define kRunPlayerBlockCode_DATA_00F3E3 ((uint8*)RomFixedPtr(0xF3E3)) -#define kRunPlayerBlockCode_PIPE_BUTTONS ((uint8*)RomFixedPtr(0xF3E5)) -#define kHandleStandardLevelCameraScroll_DATA_00F69F ((uint16*)RomFixedPtr(0xF69F)) -#define kHandleStandardLevelCameraScroll_DATA_00F6A3 ((uint16*)RomFixedPtr(0xF6A3)) -#define kHandleStandardLevelCameraScroll_DATA_00F6A7 ((uint16*)RomFixedPtr(0xF6A7)) -#define kHandleStandardLevelCameraScroll_DATA_00F6AD ((uint16*)RomFixedPtr(0xF6AD)) -#define kHandleStandardLevelCameraScroll_DATA_00F6B3 ((uint16*)RomFixedPtr(0xF6B3)) -#define kHandleStandardLevelCameraScroll_DATA_00F6BF ((uint16*)RomFixedPtr(0xF6BF)) -#define kHandleStandardLevelCameraScroll_DATA_00F6CB ((uint16*)RomFixedPtr(0xF6CB)) -#define kHandleStandardLevelCameraScroll_DATA_00F6CF ((uint16*)RomFixedPtr(0xF6CF)) -#define kPlayerState00_DATA_00F8DF ((uint8*)RomFixedPtr(0xF8DF)) -#define kPlayerState00_DATA_00F8E8 ((uint16*)RomFixedPtr(0xF8E8)) -#define kSpr07B_GoalTape_DATA_00FADF ((uint8*)RomFixedPtr(0xFADF)) -#define kSpr07B_GoalTape_DATA_00FAFB ((uint8*)RomFixedPtr(0xFAFB)) -#define kSprStatus06_GoalCoins_SmokeTiles ((uint8*)RomFixedPtr(0xFBA4)) -#define kSpawnPlayerBreathBubble_xlo ((uint8*)RomFixedPtr(0xFD24)) -#define kSpawnPlayerWaterSplashAndBubbles_YLo ((uint8*)RomFixedPtr(0xFD9D)) -#define kSpawnPlayerWaterSplashAndBubbles_YHi ((uint8*)RomFixedPtr(0xFDA1)) -#define kSpawnPlayerWaterSplashAndBubbles_Bubble_YLo ((uint8*)RomFixedPtr(0xFE0E)) -#define kSpawnPlayerWaterSplashAndBubbles_Bubble_XLo ((uint8*)RomFixedPtr(0xFE12)) -#define kSpawnPlayerFireball_InitialXSpeed ((uint8*)RomFixedPtr(0xFE94)) -#define kSpawnPlayerFireball_xlo ((uint8*)RomFixedPtr(0xFE96)) -#define kSpawnPlayerFireball_xhi ((uint8*)RomFixedPtr(0xFE9C)) -#define kSpawnPlayerFireball_ylo ((uint8*)RomFixedPtr(0xFEA2)) -#define kSprXXX_LineGuided_DATA_018000 ((uint8*)RomFixedPtr(0x18000)) -#define kSpr02C_YoshiEgg_Init_EggPalette ((uint8*)RomFixedPtr(0x18335)) -#define kSprXXX_ReflectingEnemy_Init_InitYSpeed ((uint8*)RomFixedPtr(0x1834C)) -#define kSpr04C_ExplodingBlock_Init_ExplodingBlkSpr ((uint8*)RomFixedPtr(0x183A0)) -#define kSpr08F_ScalePlatform_Init_ScalePlatWidth ((uint8*)RomFixedPtr(0x183B3)) -#define kSprXXX_WallFollowers_Init_DATA_0183EF ((uint8*)RomFixedPtr(0x183EF)) -#define kSpr03E_PSwitch_Init_PSwitchPal ((uint8*)RomFixedPtr(0x18466)) -#define kSpr095_ClappinChuck_Init_DATA_018526 ((uint8*)RomFixedPtr(0x18526)) -#define kSprXXX_Generic_Spr0to13SpeedX ((uint8*)RomFixedPtr(0x188EC)) -#define kSprXXX_Generic_Spr0to13Prop ((uint8*)RomFixedPtr(0x188F0)) -#define kSprXXX_Generic_DATA_018CBA ((uint8*)RomFixedPtr(0x18CBA)) -#define kSprXXX_Generic_DATA_018CBC ((uint8*)RomFixedPtr(0x18CBC)) -#define kSpr010_ParaGoomba_WingXDisp ((uint8*)RomFixedPtr(0x18DC7)) -#define kSpr010_ParaGoomba_WingYDisp ((uint8*)RomFixedPtr(0x18DD7)) -#define kSpr010_ParaGoomba_WingProp ((uint8*)RomFixedPtr(0x18DDF)) -#define kSpr010_ParaGoomba_WingTiles ((uint8*)RomFixedPtr(0x18DE1)) -#define kSpr010_ParaGoomba_WingTileSize ((uint8*)RomFixedPtr(0x18DE5)) -#define kSprXXX_RegularPiranhaPlant_YSpeed ((uint8*)RomFixedPtr(0x18E6E)) -#define kSprXXX_RegularPiranhaPlant_PhaseTimers ((uint8*)RomFixedPtr(0x18E72)) -#define kSpr01C_BulletBill_Prop ((uint8*)RomFixedPtr(0x18FC7)) -#define kSpr01C_BulletBill_AnimationFrame ((uint8*)RomFixedPtr(0x18FCF)) -#define kSpr01C_BulletBill_XSpeed ((uint8*)RomFixedPtr(0x18FD7)) -#define kSpr01C_BulletBill_YSpeed ((uint8*)RomFixedPtr(0x18FDF)) -#define kHandleNormalSpriteGravity_MaxYSpeed ((uint8*)RomFixedPtr(0x1902E)) -#define kHandleNormalSpriteGravity_YAcceleration ((uint8*)RomFixedPtr(0x19030)) -#define kHandleNormalSpriteLevelColl_SpriteObjClippingX ((uint8*)RomFixedPtr(0x190BA)) -#define kHandleNormalSpriteLevelColl_SpriteObjClippingY ((uint8*)RomFixedPtr(0x190F7)) -#define kHandleNormalSpriteLevelColl_DATA_019134 ((uint8*)RomFixedPtr(0x19134)) -#define kHandleNormalSpriteLevelColl_DATA_019284 ((uint8*)RomFixedPtr(0x19284)) -#define kHandleNormalSpriteLevelColl_DATA_019286 ((uint8*)RomFixedPtr(0x19286)) -#define kHandleNormalSpriteLevelColl_DATA_0192C5 ((uint8*)RomFixedPtr(0x192C5)) -#define kHandleNormalSpriteLevelColl_DATA_0192C7 ((uint8*)RomFixedPtr(0x192C7)) -#define kSprStatus09_Stunned_SpriteKoopasSpawn ((uint8*)RomFixedPtr(0x1961C)) -#define kSprStatus09_Stunned_DATA_0197AD ((uint8*)RomFixedPtr(0x197AD)) -#define kMakeStunnedSpriteBounceOrSlowDownOnGround_DATA_0197AF ((uint8*)RomFixedPtr(0x197AF)) -#define kSprStatus0A_Kicked_XSpeed ((uint8*)RomFixedPtr(0x198A7)) -#define kKickedShellGFXRt_ShellAniTiles ((uint8*)RomFixedPtr(0x19A22)) -#define kKickedShellGFXRt_Prop ((uint8*)RomFixedPtr(0x19A26)) -#define kSprStatus04_SpinJumpKill_SmokeTiles ((uint8*)RomFixedPtr(0x19A4E)) -#define kGenericSpriteOAMData_Tiles ((uint16*)RomFixedPtr(0x19B83)) -#define kGenericSpriteOAMData_TilesOffset ((uint8*)RomFixedPtr(0x19C7F)) -#define kGenericSpriteOAMData_XDisp ((uint8*)RomFixedPtr(0x19CD3)) -#define kGenericSpriteOAMData_YDisp ((uint8*)RomFixedPtr(0x19CD7)) -#define kGenericSpriteOAMData_Prop ((uint8*)RomFixedPtr(0x19CDB)) -#define kDrawWingTiles_XDispLo ((uint8*)RomFixedPtr(0x19E10)) -#define kDrawWingTiles_XDispHi ((uint8*)RomFixedPtr(0x19E14)) -#define kDrawWingTiles_YDisp ((uint8*)RomFixedPtr(0x19E18)) -#define kDrawWingTiles_Tiles ((uint8*)RomFixedPtr(0x19E1C)) -#define kDrawWingTiles_Prop ((uint8*)RomFixedPtr(0x19E20)) -#define kDrawWingTiles_TileSize ((uint8*)RomFixedPtr(0x19E24)) -#define kSprStatus0B_Carried_CarriedSpriteXOffsetLo ((uint8*)RomFixedPtr(0x19F5B)) -#define kSprStatus0B_Carried_CarriedSpriteXOffsetHi ((uint8*)RomFixedPtr(0x19F61)) -#define kSprStatus0B_Carried_PlacedSpriteInitialXPosLo ((uint8*)RomFixedPtr(0x19F67)) -#define kSprStatus0B_Carried_PlacedSpriteInitialXPosHi ((uint8*)RomFixedPtr(0x19F69)) -#define kSprStatus0B_Carried_ShellXSpeed ((uint8*)RomFixedPtr(0x19F6B)) -#define kSprStatus0B_Carried_PlacedSpriteInitiaXSpeed ((uint8*)RomFixedPtr(0x19F99)) -#define kProcessStunnedNormalSprite_StunnedBabyYoshi_DATA_01A35A ((uint8*)RomFixedPtr(0x1A35A)) -#define kGetDrawInfo_DATA_01A361 ((uint8*)RomFixedPtr(0x1A361)) -#define kGetDrawInfo_DATA_01A363 ((uint8*)RomFixedPtr(0x1A363)) -#define kCheckNormalSpriteToNormalSpriteColl_DATA_01A40B ((uint8*)RomFixedPtr(0x1A40B)) -#define kStompSoundTable_Bank01 ((uint8*)RomFixedPtr(0x1A61E)) -#define kCheckNormalSpriteToNormalSpriteColl_DATA_01A6D7 ((uint8*)RomFixedPtr(0x1A6D7)) -#define kCheckNormalSpriteToNormalSpriteColl_DATA_01A778 ((uint8*)RomFixedPtr(0x1A778)) -#define kCheckNormalSpriteToNormalSpriteColl_DATA_01A77A ((uint8*)RomFixedPtr(0x1A77A)) -#define kGenericSpriteToSpawnTable ((uint8*)RomFixedPtr(0x1A7C9)) -#define kCheckPlayerToNormalSpriteColl_DATA_01A839 ((uint8*)RomFixedPtr(0x1A839)) -#define kCheckPlayerToNormalSpriteColl_DATA_01AB2D ((uint16*)RomFixedPtr(0x1AB2D)) -#define kSubOffscreen_Bank01_SpriteOffScreen1_Lo ((uint8*)RomFixedPtr(0x1AC0D)) -#define kSubOffscreen_Bank01_SpriteOffScreen1_Hi ((uint8*)RomFixedPtr(0x1AC0F)) -#define kSubOffscreen_Bank01_SpriteOffScreen2_Lo ((uint8*)RomFixedPtr(0x1AC11)) -#define kSubOffscreen_Bank01_SpriteOffScreen2_Hi ((uint8*)RomFixedPtr(0x1AC19)) -#define kSpr083_LeftFlyingBlock_Acceleration ((uint8*)RomFixedPtr(0x1AD68)) -#define kSpr083_LeftFlyingBlock_MaxYSpeed ((uint8*)RomFixedPtr(0x1AD6A)) -#define kSpr083_LeftFlyingBlock_MaxXSpeed ((uint8*)RomFixedPtr(0x1AD6C)) -#define kSpr083_LeftFlyingBlock_DATA_01AE7F ((uint8*)RomFixedPtr(0x1AE7F)) -#define kSpr083_LeftFlyingBlock_DATA_01AE88 ((uint8*)RomFixedPtr(0x1AE88)) -#define kSpr026_Thwomp_XDisp ((uint8*)RomFixedPtr(0x1AF40)) -#define kSpr026_Thwomp_YDisp ((uint8*)RomFixedPtr(0x1AF45)) -#define kSpr026_Thwomp_Tiles ((uint8*)RomFixedPtr(0x1AF4A)) -#define kSpr026_Thwomp_Prop ((uint8*)RomFixedPtr(0x1AF4F)) -#define kSpr017_GeneratorCheepCheep_Init_InitXSpeed ((uint8*)RomFixedPtr(0x1B012)) -#define kSprXXX_FixedMovementCheepCheep_SwimmingXSpeed ((uint8*)RomFixedPtr(0x1B01D)) -#define kSprXXX_FixedMovementCheepCheep_SwimmingYSpeed ((uint8*)RomFixedPtr(0x1B01F)) -#define kSprXXX_FixedMovementCheepCheep_KickedXSpeed ((uint8*)RomFixedPtr(0x1B023)) -#define kSprXXX_FixedMovementCheepCheep_FloppingYSpeed ((uint8*)RomFixedPtr(0x1B025)) -#define kSprXXX_FixedMovementCheepCheep_FloppingXSpeed ((uint8*)RomFixedPtr(0x1B029)) -#define kSprXXX_FixedMovementCheepCheep_DATA_01B031 ((uint8*)RomFixedPtr(0x1B031)) -#define kSpr018_SurfaceJumpingCheepCheep_YSpeed ((uint8*)RomFixedPtr(0x1B1B1)) -#define kSprXXX_BuoyantPlatformsAndMine_Init_InitialXSpeed ((uint8*)RomFixedPtr(0x1B212)) -#define kSpr055_HorizontalCheckerboardPlatform_DATA_01B268 ((uint8*)RomFixedPtr(0x1B268)) -#define kSpr055_HorizontalCheckerboardPlatform_DATA_01B26A ((uint8*)RomFixedPtr(0x1B26A)) -#define kNormalSpritePlatformGFXRt_DATA_01B2C3 ((uint8*)RomFixedPtr(0x1B2C3)) -#define kNormalSpritePlatformGFXRt_DiagPlatTiles ((uint8*)RomFixedPtr(0x1B383)) -#define kSolidSpriteBlock_DATA_01B4F9 ((uint8*)RomFixedPtr(0x1B4F9)) -#define kSolidSpriteBlock_DATA_01B4FF ((uint8*)RomFixedPtr(0x1B4FF)) -#define kSprXXX_BuoyantPlatformsAndMine_SpikeBallXDisp ((uint8*)RomFixedPtr(0x1B65A)) -#define kSprXXX_BuoyantPlatformsAndMine_SpikeBallYDisp ((uint8*)RomFixedPtr(0x1B65E)) -#define kSprXXX_BuoyantPlatformsAndMine_SpikeBallProp ((uint8*)RomFixedPtr(0x1B662)) -#define kSprXXX_TurnBlockBridge_BlkBridgeLength ((uint8*)RomFixedPtr(0x1B69F)) -#define kSprXXX_TurnBlockBridge_TurnBlkBridgeSpeed ((uint8*)RomFixedPtr(0x1B6A1)) -#define kSprXXX_TurnBlockBridge_BlkBridgeTiming ((uint8*)RomFixedPtr(0x1B6A3)) -#define kSprXXX_NetKoopas_Init_InitXSpeed ((uint8*)RomFixedPtr(0x1B93C)) -#define kSprXXX_NetKoopas_DATA_01B969 ((uint8*)RomFixedPtr(0x1B969)) -#define kSprXXX_NetKoopas_DATA_01B973 ((uint8*)RomFixedPtr(0x1B973)) -#define kSprXXX_NetKoopas_DATA_01B97D ((uint8*)RomFixedPtr(0x1B97D)) -#define kSpr054_ClimbingNetDoor_XDisp ((uint8*)RomFixedPtr(0x1BA97)) -#define kSpr054_ClimbingNetDoor_AnimationFrame ((uint8*)RomFixedPtr(0x1BAA7)) -#define kSpr054_ClimbingNetDoor_Tiles ((uint8*)RomFixedPtr(0x1BAB7)) -#define kSpr020_Magic_Palettes ((uint8*)RomFixedPtr(0x1BC34)) -#define kSpr020_Magic_Disp ((uint8*)RomFixedPtr(0x1BCE0)) -#define kSpr01F_MagiKoopa_DATA_01BE69 ((uint8*)RomFixedPtr(0x1BE69)) -#define kSpr01F_MagiKoopa_WandXDisp ((uint8*)RomFixedPtr(0x1BE6C)) -#define kSpr07B_GoalTape_YSpeed ((uint8*)RomFixedPtr(0x1C0A5)) -#define kSprXXX_FlyingItems_YAcceleration ((uint8*)RomFixedPtr(0x1C1EE)) -#define kSprXXX_FlyingItems_MaxYSpeed ((uint8*)RomFixedPtr(0x1C1F0)) -#define kSprXXX_PowerUps_ChangingItemSprite ((uint8*)RomFixedPtr(0x1C313)) -#define kSprXXX_PowerUps_EatenBerryGfxProp ((uint8*)RomFixedPtr(0x1C345)) -#define kSprXXX_PowerUps_ItemBoxSprite ((uint8*)RomFixedPtr(0x1C510)) -#define kSprXXX_PowerUps_GivePowerPtrIndex ((uint8*)RomFixedPtr(0x1C524)) -#define kPowerUpAndItemGFXRt_PowerUpTiles ((uint8*)RomFixedPtr(0x1C609)) -#define kPowerUpAndItemGFXRt_StarPalValues ((uint8*)RomFixedPtr(0x1C616)) -#define kPowerUpAndItemGFXRt_DrawCoinSprite_Tiles ((uint8*)RomFixedPtr(0x1C66D)) -#define kSpr077_Feather_XAccelerarion ((uint8*)RomFixedPtr(0x1C6E6)) -#define kSpr077_Feather_MaxXSpeed ((uint8*)RomFixedPtr(0x1C6E8)) -#define kSpr077_Feather_YSpeed ((uint8*)RomFixedPtr(0x1C6EA)) -#define kSpr05F_BrownChainedPlatform_PlatformXDisp ((uint8*)RomFixedPtr(0x1C9B7)) -#define kSpr05F_BrownChainedPlatform_PlatformTiles ((uint8*)RomFixedPtr(0x1C9BB)) -#define kSpr05F_BrownChainedPlatform_DATA_01C9D6 ((uint8*)RomFixedPtr(0x1C9D6)) -#define kSpr05F_BrownChainedPlatform_DATA_01C9D8 ((uint8*)RomFixedPtr(0x1C9D8)) -#define kSpr029_KoopaKids_Init_DATA_01CD92 ((uint8*)RomFixedPtr(0x1CD92)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CD99 ((uint8*)RomFixedPtr(0x1CD99)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CD9C ((uint8*)RomFixedPtr(0x1CD9C)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CDA5 ((uint8*)RomFixedPtr(0x1CDA5)) -#define kSpr029_KoopaKid_MortonRoyLudwig_LudwigMaxXSpeed ((uint8*)RomFixedPtr(0x1CEAE)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CEB0 ((uint8*)RomFixedPtr(0x1CEB0)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CEB4 ((uint8*)RomFixedPtr(0x1CEB4)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D057 ((uint8*)RomFixedPtr(0x1D057)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D0BE ((uint8*)RomFixedPtr(0x1D0BE)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D0DE ((uint8*)RomFixedPtr(0x1D0DE)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D122 ((uint8*)RomFixedPtr(0x1D122)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D12E ((uint8*)RomFixedPtr(0x1D12E)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D13E ((uint8*)RomFixedPtr(0x1D13E)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D142 ((uint8*)RomFixedPtr(0x1D142)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D239 ((uint8*)RomFixedPtr(0x1D239)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D23B ((uint8*)RomFixedPtr(0x1D23B)) -#define kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D23D ((uint8*)RomFixedPtr(0x1D23D)) -#define kSpr034_LudwigFireball_OAMIndexes ((uint8*)RomFixedPtr(0x1D439)) -#define kSpr034_LudwigFireball_XDisp ((uint8*)RomFixedPtr(0x1D442)) -#define kSpr034_LudwigFireball_Tiles ((uint8*)RomFixedPtr(0x1D446)) -#define kSpr034_LudwigFireball_Prop ((uint8*)RomFixedPtr(0x1D44A)) -#define kSprXXX_ParachutingEnemy_DATA_01D4E7 ((uint8*)RomFixedPtr(0x1D4E7)) -#define kSprXXX_ParachutingEnemy_DATA_01D4E9 ((uint8*)RomFixedPtr(0x1D4E9)) -#define kSprXXX_ParachutingEnemy_DATA_01D4EB ((uint8*)RomFixedPtr(0x1D4EB)) -#define kSprXXX_ParachutingEnemy_DATA_01D55E ((uint8*)RomFixedPtr(0x1D55E)) -#define kSprXXX_ParachutingEnemy_DATA_01D56E ((uint8*)RomFixedPtr(0x1D56E)) -#define kSprXXX_ParachutingEnemy_DATA_01D57E ((uint8*)RomFixedPtr(0x1D57E)) -#define kSprXXX_ParachutingEnemy_DATA_01D58E ((uint8*)RomFixedPtr(0x1D58E)) -#define kSprXXX_ParachutingEnemy_DATA_01D59E ((uint8*)RomFixedPtr(0x1D59E)) -#define kSprXXX_ParachutingEnemy_DATA_01D5AE ((uint8*)RomFixedPtr(0x1D5AE)) -#define kSprXXX_ParachutingEnemy_DATA_01D5B0 ((uint8*)RomFixedPtr(0x1D5B0)) -#define kSprXXX_LineGuided_DATA_01D717 ((uint8*)RomFixedPtr(0x1D717)) -#define kSprXXX_LineGuided_DATA_01D7E1 ((uint8*)RomFixedPtr(0x1D7E1)) -#define kSprXXX_LineGuided_DATA_01D7E5 ((uint8*)RomFixedPtr(0x1D7E5)) -#define kSprXXX_LineGuided_DATA_01D7E9 ((uint8*)RomFixedPtr(0x1D7E9)) -#define kSprXXX_LineGuided_DATA_01D7ED ((uint8*)RomFixedPtr(0x1D7ED)) -#define kSpr0B4_NonLineGuideGrinder_XSpeed ((uint8*)RomFixedPtr(0x1DB5A)) -#define kSpr0B4_NonLineGuideGrinder_XDisp ((uint8*)RomFixedPtr(0x1DB96)) -#define kSpr0B4_NonLineGuideGrinder_YDisp ((uint8*)RomFixedPtr(0x1DB9A)) -#define kSpr0B4_NonLineGuideGrinder_Prop ((uint8*)RomFixedPtr(0x1DB9E)) -#define kSprXXX_LineGuided_DATA_01DC09 ((uint8*)RomFixedPtr(0x1DC09)) -#define kSprXXX_LineGuided_DATA_01DC3B ((uint8*)RomFixedPtr(0x1DC3B)) -#define kSprXXX_LineGuided_DATA_01DC3F ((uint8*)RomFixedPtr(0x1DC3F)) -#define kSprXXX_LineGuided_DATA_01DC43 ((uint8*)RomFixedPtr(0x1DC43)) -#define kSprXXX_LineGuided_RopeMotorTiles ((uint8*)RomFixedPtr(0x1DC47)) -#define kSprXXX_LineGuided_LineGuideRopeTiles ((uint8*)RomFixedPtr(0x1DC4B)) -#define kSprXXX_LineGuided_DATA_01DCD1 ((uint8*)RomFixedPtr(0x1DCD1)) -#define kSprXXX_LineGuided_DATA_01DCF1 ((uint8*)RomFixedPtr(0x1DCF1)) -#define kSprXXX_LineGuided_DATA_01DD11 ((uint8*)RomFixedPtr(0x1DD11)) -#define kSprXXX_LineGuided_DATA_01DD51 ((uint8*)RomFixedPtr(0x1DD51)) -#define kSpr082_BonusGame_Init_DATA_01DD90 ((uint8*)RomFixedPtr(0x1DD90)) -#define kSpr082_BonusGame_Init_DATA_01DD99 ((uint8*)RomFixedPtr(0x1DD99)) -#define kSpr082_BonusGame_Init_DATA_01DDA2 ((uint8*)RomFixedPtr(0x1DDA2)) -#define kSpr082_BonusGame_DATA_01DE11 ((uint8*)RomFixedPtr(0x1DE11)) -#define kSpr082_BonusGame_DATA_01DE15 ((uint8*)RomFixedPtr(0x1DE15)) -#define kSpr082_BonusGame_DATA_01DE19 ((uint8*)RomFixedPtr(0x1DE19)) -#define kSpr082_BonusGame_DATA_01DE1D ((uint8*)RomFixedPtr(0x1DE1D)) -#define kSpr082_BonusGame_DATA_01DE21 ((uint8*)RomFixedPtr(0x1DE21)) -#define kSpr082_BonusGame_DATA_01DEE3 ((uint8*)RomFixedPtr(0x1DEE3)) -#define kSpr082_BonusGame_DATA_01DF07 ((uint8*)RomFixedPtr(0x1DF07)) -#define kSpr082_BonusGame_DATA_01DF10 ((uint8*)RomFixedPtr(0x1DF10)) -#define kSpr082_BonusGame_DATA_01DFC1 ((uint8*)RomFixedPtr(0x1DFC1)) -#define kSpr033_Podoboo_DATA_01E07B ((uint8*)RomFixedPtr(0x1E07B)) -#define kSpr033_Podoboo_DATA_01E091 ((uint8*)RomFixedPtr(0x1E091)) -#define kSpr033_Podoboo_BowserFlameTiles ((uint8*)RomFixedPtr(0x1E190)) -#define kSpr033_Podoboo_BowserFlameProp ((uint8*)RomFixedPtr(0x1E194)) -#define kSprXXX_SmallMontyMole_DATA_01E35F ((uint8*)RomFixedPtr(0x1E35F)) -#define kSprXXX_SmallMontyMole_DATA_01E361 ((uint8*)RomFixedPtr(0x1E361)) -#define kSprXXX_SmallMontyMole_NoFollowXSpeed ((uint8*)RomFixedPtr(0x1E38F)) -#define kSprXXX_SmallMontyMole_FollowMaxXSpeed ((uint8*)RomFixedPtr(0x1E391)) -#define kSpr030_ThrowingDryBones_XSpeed ((uint8*)RomFixedPtr(0x1E41F)) -#define kSpr030_ThrowingDryBones_DATA_01E43C ((uint8*)RomFixedPtr(0x1E43C)) -#define kSpr02F_PortableSpringboard_AnimationFrames ((uint8*)RomFixedPtr(0x1E611)) -#define kSpr02F_PortableSpringboard_PlayerYDisp ((uint8*)RomFixedPtr(0x1E61A)) -#define kSpr02F_PortableSpringboard_YDispOffset ((uint8*)RomFixedPtr(0x1E6FD)) -#define kSpr087_LakituCloud_XDisp ((uint8*)RomFixedPtr(0x1E76F)) -#define kSpr087_LakituCloud_YDisp ((uint8*)RomFixedPtr(0x1E77F)) -#define kSpr087_LakituCloud_CloudYPosOffset ((uint8*)RomFixedPtr(0x1E793)) -#define kSpr087_LakituCloud_EvaporatingCloudTiles ((uint8*)RomFixedPtr(0x1E985)) -#define kSpr087_LakituCloud_MaxLakituXSpeed ((uint8*)RomFixedPtr(0x1E989)) -#define kSpr087_LakituCloud_MaxLakituYSpeed ((uint8*)RomFixedPtr(0x1E98B)) -#define kMakeLakituThrowSpiny_InitialXSpeed ((uint8*)RomFixedPtr(0x1EA17)) -#define kGenericNormalSpriteAccelerationTable ((uint8*)RomFixedPtr(0x1EBB4)) -#define kSpr035_Yoshi_PanicXSpeed ((uint8*)RomFixedPtr(0x1EBBE)) -#define kSpr035_Yoshi_DismountXSpeed ((uint8*)RomFixedPtr(0x1EBC0)) -#define kSpr035_Yoshi_GrowingAniSequence ((uint8*)RomFixedPtr(0x1EBC2)) -#define kSpr035_Yoshi_YoshiEggInitialXSpeed ((uint8*)RomFixedPtr(0x1EC5B)) -#define kSpr035_Yoshi_YoshiEggInitialXOffsetLo ((uint8*)RomFixedPtr(0x1EC5D)) -#define kSpr035_Yoshi_YoshiEggInitialXOffsetHi ((uint8*)RomFixedPtr(0x1EC5F)) -#define kSpr035_Yoshi_DATA_01EDE2 ((uint8*)RomFixedPtr(0x1EDE2)) -#define kSpr035_Yoshi_DATA_01EDE4 ((uint8*)RomFixedPtr(0x1EDE4)) -#define kSpr035_Yoshi_YoshiWalkFrames ((uint8*)RomFixedPtr(0x1EDEE)) -#define kSpr035_Yoshi_YoshiPositionX ((uint8*)RomFixedPtr(0x1EDF1)) -#define kSpr035_Yoshi_DATA_01EDF3 ((uint8*)RomFixedPtr(0x1EDF3)) -#define kSpr035_Yoshi_DATA_01EDF5 ((uint8*)RomFixedPtr(0x1EDF5)) -#define kSpr035_Yoshi_YoshiHeadTiles ((uint8*)RomFixedPtr(0x1EDF9)) -#define kSpr035_Yoshi_YoshiBodyTiles ((uint8*)RomFixedPtr(0x1EE06)) -#define kSpr035_Yoshi_YoshiHeadXDisp ((uint8*)RomFixedPtr(0x1EE13)) -#define kSpr035_Yoshi_DATA_01EE2D ((uint8*)RomFixedPtr(0x1EE2D)) -#define kSpr035_Yoshi_YoshiPositionY ((uint8*)RomFixedPtr(0x1EE47)) -#define kSpr035_Yoshi_YoshiHeadYDisp ((uint8*)RomFixedPtr(0x1EE54)) -#define kSpr035_Yoshi_YoshiShellAbility ((uint8*)RomFixedPtr(0x1F137)) -#define kSpr035_Yoshi_YoshiAbilityIndex ((uint8*)RomFixedPtr(0x1F145)) -#define kSpr035_Yoshi_YoshiFireballInitialXSpeed ((uint8*)RomFixedPtr(0x1F2D9)) -#define kSpr035_Yoshi_YoshiFireballInitialYSpeed ((uint8*)RomFixedPtr(0x1F2DC)) -#define kSpr035_Yoshi_SpatOutSpriteXSpeed ((uint8*)RomFixedPtr(0x1F301)) -#define kSpr035_Yoshi_DATA_01F305 ((uint8*)RomFixedPtr(0x1F305)) -#define kSpr035_Yoshi_DATA_01F307 ((uint8*)RomFixedPtr(0x1F307)) -#define kSpr035_Yoshi_DATA_01F3D9 ((uint8*)RomFixedPtr(0x1F3D9)) -#define kSpr035_Yoshi_DATA_01F60A ((uint8*)RomFixedPtr(0x1F60A)) -#define kSpr035_Yoshi_DATA_01F61A ((uint8*)RomFixedPtr(0x1F61A)) -#define kSpr02C_YoshiEgg_DATA_01F75C ((uint8*)RomFixedPtr(0x1F75C)) -#define kSpr02C_YoshiEgg_YoshiEggTiles ((uint8*)RomFixedPtr(0x1F760)) -#define kSpr02C_YoshiEgg_EggShellInitialYPosLo ((uint8*)RomFixedPtr(0x1F82D)) -#define kSpr02C_YoshiEgg_EggShellInitialXPosLo ((uint8*)RomFixedPtr(0x1F831)) -#define kSpr02C_YoshiEgg_EggShellInitialYSpeed ((uint8*)RomFixedPtr(0x1F835)) -#define kSpr02C_YoshiEgg_EggShellInitialXSpeed ((uint8*)RomFixedPtr(0x1F839)) -#define kSprXXX_Eeries_Init_XSpeed ((uint8*)RomFixedPtr(0x1F88C)) -#define kSprXXX_Eeries_YSpeed ((uint8*)RomFixedPtr(0x1F88E)) -#define kSprXXX_NonBossBoos_MaxSpeed ((uint8*)RomFixedPtr(0x1F8CF)) -#define kSprXXX_NonBossBoos_DATA_01F8D1 ((uint8*)RomFixedPtr(0x1F8D1)) -#define kSprXXX_NonBossBoos_BooBlockTiles ((uint8*)RomFixedPtr(0x1FA37)) -#define kSprXXX_NonBossBoos_BooBlockProp ((uint8*)RomFixedPtr(0x1FA3A)) -#define kSpr0A7_IggyBall_XFlip ((uint8*)RomFixedPtr(0x1FA4C)) -#define kSpr0A7_IggyBall_Tiles ((uint8*)RomFixedPtr(0x1FA4E)) -#define kSpr0A7_IggyBall_Prop ((uint8*)RomFixedPtr(0x1FA52)) -#define kSpr0A7_IggyBall_XSpeed ((uint8*)RomFixedPtr(0x1FA56)) -#define kSpr029_KoopaKid_IggyLarry_HurtXSpeed ((uint8*)RomFixedPtr(0x1FAD5)) -#define kSpr029_KoopaKid_IggyLarry_WalkingAnimationFrames ((uint8*)RomFixedPtr(0x1FAE5)) -#define kSpr029_KoopaKid_IggyLarry_ThrowingAnimationFrames ((uint8*)RomFixedPtr(0x1FD95)) -#define kSpr029_KoopaKid_IggyLarry_BallXDisp ((uint8*)RomFixedPtr(0x1FDA5)) -#define kSpr029_KoopaKid_IggyLarry_XDisp ((uint8*)RomFixedPtr(0x1FDF3)) -#define kSpr029_KoopaKid_IggyLarry_YDisp ((uint8*)RomFixedPtr(0x1FE53)) -#define kSpr029_KoopaKid_IggyLarry_Tiles ((uint8*)RomFixedPtr(0x1FE83)) -#define kSpr029_KoopaKid_IggyLarry_IggyTiles ((uint8*)RomFixedPtr(0x1FEB3)) -#define kSpr029_KoopaKid_IggyLarry_TileSize ((uint16*)RomFixedPtr(0x1FEB6)) -#define kSpr029_KoopaKid_IggyLarry_InShellTiles ((uint8*)RomFixedPtr(0x1FF53)) -#define kSpr029_KoopaKid_IggyLarry_InShellProp ((uint8*)RomFixedPtr(0x1FF57)) -#define kBobOmbExplosion_BombExplosionX ((uint8*)RomFixedPtr(0x28072)) -#define kBobOmbExplosion_BombExplosionY ((uint8*)RomFixedPtr(0x2807C)) -#define kGameMode14_InLevel_DATA_028178 ((uint8*)RomFixedPtr(0x28178)) -#define kGameMode14_InLevel_DATA_0281CF ((uint8*)RomFixedPtr(0x281CF)) -#define kGameMode14_InLevel_DATA_028226 ((uint8*)RomFixedPtr(0x28226)) -#define kGameMode14_InLevel_DATA_0283C8 ((uint8*)RomFixedPtr(0x283C8)) -#define kGameMode14_InLevel_DATA_0283CC ((uint8*)RomFixedPtr(0x283CC)) -#define kSpawnLavaSplash_InitialXSpeed ((uint8*)RomFixedPtr(0x28510)) -#define kSpawnLavaSplash_InitialYSpeed ((uint8*)RomFixedPtr(0x28518)) -#define kSpawnLavaSplash_InitialAnimationFrameCounter ((uint8*)RomFixedPtr(0x28520)) -#define kSpawnBounceSprite_BlockBounceYSpeed ((uint8*)RomFixedPtr(0x2873A)) -#define kSpawnBounceSprite_BlockBounceXSpeed ((uint8*)RomFixedPtr(0x2873E)) -#define kSpawnBrickPieces_ylo ((uint8*)RomFixedPtr(0x28742)) -#define kSpawnBrickPieces_xlo ((uint8*)RomFixedPtr(0x28746)) -#define kSpawnBrickPieces_InitialYSpeed ((uint8*)RomFixedPtr(0x2874A)) -#define kSpawnBrickPieces_InitialXSpeed ((uint8*)RomFixedPtr(0x2874E)) -#define kSpawnBounceSprite_BlockBounce ((uint8*)RomFixedPtr(0x28789)) -#define kSpawnBounceSprite_DATA_0288A1 ((uint8*)RomFixedPtr(0x288A1)) -#define kSpawnBounceSprite_SpriteInBlock ((uint8*)RomFixedPtr(0x288A3)) -#define kSpawnBounceSprite_StatusOfSprInBlk ((uint8*)RomFixedPtr(0x288C5)) -#define kSpawnBounceSprite_DATA_0288D6 ((uint8*)RomFixedPtr(0x288D6)) -#define kSpawnBounceSprite_DATA_0288D9 ((uint8*)RomFixedPtr(0x288D9)) -#define kSpawnBounceSprite_DATA_028A42 ((uint8*)RomFixedPtr(0x28A42)) -#define kGameMode14_InLevel_DATA_028AA9 ((uint8*)RomFixedPtr(0x28AA9)) -#define kMinorExtendedSpriteOAMIndexes ((uint8*)RomFixedPtr(0x28B78)) -#define kMExtSpr01_BrickPiece_Tiles ((uint8*)RomFixedPtr(0x28B84)) -#define kMExtSpr01_BrickPiece_Flip ((uint8*)RomFixedPtr(0x28B8C)) -#define kSpr035_Yoshi_DATA_028C09 ((uint8*)RomFixedPtr(0x28C09)) -#define kSpr035_Yoshi_DATA_028C0B ((uint8*)RomFixedPtr(0x28C0B)) -#define kSpr035_Yoshi_DATA_028C0D ((uint8*)RomFixedPtr(0x28C0D)) -#define kMExtSpr0B_UnusedYoshiSmoke_Tiles ((uint8*)RomFixedPtr(0x28C6A)) -#define kMExtSpr0A_BooStream_Tiles ((uint8*)RomFixedPtr(0x28CB8)) -#define kMExtSpr07_WaterSplash_Tiles ((uint8*)RomFixedPtr(0x28D42)) -#define kMExtSpr06_RipVanFishZ_Tiles ((uint8*)RomFixedPtr(0x28DD7)) -#define kMExtSpr02_SmallStar_Tiles ((uint8*)RomFixedPtr(0x28ECC)) -#define kMExtSpr04_PodobooFire_Tiles ((uint8*)RomFixedPtr(0x28F2B)) -#define kBounceSpr07_SpinningTurnBlock_YAcceleration ((uint8*)RomFixedPtr(0x29072)) -#define kBounceSpr01_TurnBlock_YAcceleration ((uint8*)RomFixedPtr(0x290CE)) -#define kBounceSpr01_TurnBlock_XAcceleration ((uint8*)RomFixedPtr(0x290D2)) -#define kBounceSpr01_TurnBlock_DATA_0290D6 ((uint8*)RomFixedPtr(0x290D6)) -#define kBounceSpr01_TurnBlock_DATA_0290DA ((uint8*)RomFixedPtr(0x290DA)) -#define kBounceSpriteGFXRt_OAMIndex ((uint8*)RomFixedPtr(0x291ED)) -#define kBounceSpriteGFXRt_Tiles ((uint8*)RomFixedPtr(0x291F1)) -#define kCheckPlayerAttackToNormalSpriteColl_DATA_029392 ((uint8*)RomFixedPtr(0x29392)) -#define kHandleCapeLevelColl_DATA_02953C ((uint8*)RomFixedPtr(0x2953C)) -#define kHandleCapeLevelColl_DATA_02953E ((uint8*)RomFixedPtr(0x2953E)) -#define kCheckPlayerAttackToNormalSpriteColl_DATA_029657 ((uint8*)RomFixedPtr(0x29657)) -#define kCheckPlayerAttackToNormalSpriteColl_DATA_029658 ((uint8*)RomFixedPtr(0x29659)) -#define kCheckPlayerAttackToNormalSpriteColl_DATA_02965A ((uint8*)RomFixedPtr(0x2965B)) -#define kCheckPlayerAttackToNormalSpriteColl_DATA_02965C ((uint8*)RomFixedPtr(0x2965D)) -#define kCheckPlayerAttackToNormalSpriteColl_DATA_02965E ((uint8*)RomFixedPtr(0x2965F)) -#define kCheckPlayerAttackToNormalSpriteColl_DATA_029660 ((uint8*)RomFixedPtr(0x29661)) -#define kSmokeSpriteOAMIndexes_One ((uint8*)RomFixedPtr(0x296B8)) -#define kSmokeSpriteOAMIndexes_Two ((uint8*)RomFixedPtr(0x296BC)) -#define kSmokeSpr01_PuffOfSmoke_Tiles ((uint8*)RomFixedPtr(0x296D8)) -#define kSmokeSpr05_Glitter_DATA_0298C2 ((uint8*)RomFixedPtr(0x298C2)) -#define kSmokeSpr05_Glitter_DATA_0298C6 ((uint8*)RomFixedPtr(0x298C6)) -#define kSmokeSpr03_TurnAroundSmoke_Tiles ((uint8*)RomFixedPtr(0x29922)) -#define kProcessSpinningCoinSprites_DATA_0299E9 ((uint8*)RomFixedPtr(0x299E9)) -#define kProcessSpinningCoinSprites_RollingCoinTiles ((uint8*)RomFixedPtr(0x29A6E)) -#define kSpawnYoshiStompSmoke_InitialXLo ((uint8*)RomFixedPtr(0x29BDE)) -#define kSpawnYoshiStompSmoke_InitialXHi ((uint8*)RomFixedPtr(0x29BE0)) -#define kSpawnYoshiStompSmoke_InitialXSpeed ((uint8*)RomFixedPtr(0x29BE2)) -#define kExtSpr0F_SmokeTrail_Tiles ((uint8*)RomFixedPtr(0x29C33)) -#define kExtSpr10_SpinJumpStars_DATA_029CB0 ((uint8*)RomFixedPtr(0x29CB0)) -#define kExtSpr09_Unused_DATA_029D5E ((uint8*)RomFixedPtr(0x29D5E)) -#define kExtSpr09_Unused_XDisp ((uint8*)RomFixedPtr(0x29D6E)) -#define kExtSpr09_Unused_YDisp ((uint8*)RomFixedPtr(0x29D7A)) -#define kExtSpr09_Unused_Tiles ((uint8*)RomFixedPtr(0x29D86)) -#define kExtSpr09_Unused_Prop ((uint8*)RomFixedPtr(0x29D92)) -#define kExtSpr09_Unused_TileSize ((uint8*)RomFixedPtr(0x29D95)) -#define kExtSpr08_LauncherArm_YSpeed ((uint8*)RomFixedPtr(0x29E36)) -#define kExtSpr07_LavaSplash_Tiles ((uint8*)RomFixedPtr(0x29E82)) -#define kExtSpr12_BreathBubble_XDisp ((uint8*)RomFixedPtr(0x29EEA)) -#define kExtSpr05_MarioFireball_DATA_029F99 ((uint8*)RomFixedPtr(0x29F99)) -#define kExtSpr05_MarioFireball_DATA_029FA2 ((uint8*)RomFixedPtr(0x29FA2)) -#define kCheckPlayerFireballToNormalSpriteColl_FireKillXSpeed ((uint8*)RomFixedPtr(0x2A151)) -#define kExtendedSpriteOAMIndexes ((uint8*)RomFixedPtr(0x2A153)) -#define kGenericExtendedSpriteGFXRt_FireballTiles ((uint8*)RomFixedPtr(0x2A15B)) -#define kGenericExtendedSpriteGFXRt_DATA_02A15F ((uint8*)RomFixedPtr(0x2A15F)) -#define kExtSpr02_ReznorFireball_Tiles ((uint8*)RomFixedPtr(0x2A163)) -#define kExtSpr02_ReznorFireball_Prop ((uint8*)RomFixedPtr(0x2A167)) -#define kExtSpr03_FlameRemnant_Tiles ((uint8*)RomFixedPtr(0x2A217)) -#define kExtSpr04_Hammer_Tiles ((uint8*)RomFixedPtr(0x2A2DF)) -#define kExtSpr04_Hammer_Prop ((uint8*)RomFixedPtr(0x2A2E7)) -#define kExtSpr01_SmokePuff_Tiles ((uint8*)RomFixedPtr(0x2A347)) -#define kExtSpr01_SmokePuff_Prop ((uint8*)RomFixedPtr(0x2A34B)) -#define kCheckMarioToExtendedSpriteColl_YoshiXSpeed ((uint8*)RomFixedPtr(0x2A4B3)) -#define kGetExtendedSpriteClipping_DATA_02A4E9 ((uint8*)RomFixedPtr(0x2A4E9)) -#define kGetExtendedSpriteClipping_DATA_02A4F5 ((uint8*)RomFixedPtr(0x2A4F5)) -#define kGetExtendedSpriteClipping_DATA_02A501 ((uint8*)RomFixedPtr(0x2A501)) -#define kGetExtendedSpriteClipping_DATA_02A50D ((uint8*)RomFixedPtr(0x2A50D)) -#define kParseLevelSpriteList_SpriteSlotMax ((uint8*)RomFixedPtr(0x2A773)) -#define kParseLevelSpriteList_SpriteSlotMax1 ((uint8*)RomFixedPtr(0x2A786)) -#define kParseLevelSpriteList_SpriteSlotMax2 ((uint8*)RomFixedPtr(0x2A799)) -#define kParseLevelSpriteList_SpriteSlotStart ((uint8*)RomFixedPtr(0x2A7AC)) -#define kParseLevelSpriteList_SpriteSlotStart1 ((uint8*)RomFixedPtr(0x2A7BF)) -#define kParseLevelSpriteList_ReservedSprite1 ((uint8*)RomFixedPtr(0x2A7D2)) -#define kParseLevelSpriteList_ReservedSprite2 ((uint8*)RomFixedPtr(0x2A7E4)) -#define kParseLevelSpriteList_DATA_02A7F6 ((uint8*)RomFixedPtr(0x2A7F6)) -#define kParseLevelSpriteList_DATA_02A7F9 ((uint8*)RomFixedPtr(0x2A7F9)) -#define kSpr0E5_LoadReappearingBoo_DATA_02AA0B ((uint8*)RomFixedPtr(0x2AA0B)) -#define kSpr0E5_LoadReappearingBoo_DATA_02AA1F ((uint8*)RomFixedPtr(0x2AA1F)) -#define kSpr0E6_LoadCandleFlames_xlo ((uint8*)RomFixedPtr(0x2AA68)) -#define kProcessScoreSprites_LeftTiles ((uint8*)RomFixedPtr(0x2AD4C)) -#define kProcessScoreSprites_RightTiles ((uint8*)RomFixedPtr(0x2AD62)) -#define kProcessScoreSprites_PointMultiplierLo ((uint8*)RomFixedPtr(0x2AD78)) -#define kProcessScoreSprites_PointMultiplierHi ((uint8*)RomFixedPtr(0x2AD89)) -#define kProcessScoreSprites_UpdateSpeedFrameIndex ((uint8*)RomFixedPtr(0x2AD9A)) -#define kProcessScoreSprites_OAMIndex ((uint8*)RomFixedPtr(0x2AD9E)) -#define kProcessScoreSprites_CoinsToGive ((uint8*)RomFixedPtr(0x2ADDD)) -#define kProcessScoreSprites_TwoUp3UpProp ((uint8*)RomFixedPtr(0x2ADE2)) -#define kSpr0E0_Load3Platforms_InitialAngleLo ((uint8*)RomFixedPtr(0x2AF2D)) -#define kSpr0E0_Load3Platforms_InitialAngleHi ((uint8*)RomFixedPtr(0x2AF30)) -#define kSpr0DE_Load5Eeries_xlo ((uint8*)RomFixedPtr(0x2AF87)) -#define kSpr0DE_Load5Eeries_xhi ((uint8*)RomFixedPtr(0x2AF8C)) -#define kSpr0DE_Load5Eeries_InitialYSpeed ((uint8*)RomFixedPtr(0x2AF91)) -#define kSpr0DE_Load5Eeries_InitialVerticalDirection ((uint8*)RomFixedPtr(0x2AF96)) -#define kSpr0DE_Load5Eeries_InitialXSpeed ((uint8*)RomFixedPtr(0x2AF9B)) -#define kGenSpr0C_GenerateSurroundingBullets_DATA_02B0C9 ((uint8*)RomFixedPtr(0x2B0C9)) -#define kGenSpr0C_GenerateSurroundingBullets_DATA_02B0CB ((uint8*)RomFixedPtr(0x2B0CB)) -#define kGenSpr0C_GenerateSurroundingBullets_InitialXLo ((uint8*)RomFixedPtr(0x2B0FA)) -#define kGenSpr0C_GenerateSurroundingBullets_InitialYLo ((uint8*)RomFixedPtr(0x2B103)) -#define kGenSpr0C_GenerateSurroundingBullets_InitialFiringDirection ((uint8*)RomFixedPtr(0x2B10C)) -#define kGenSpr07_GenerateFish_DATA_02B153 ((uint8*)RomFixedPtr(0x2B153)) -#define kGenSpr07_GenerateFish_DATA_02B157 ((uint8*)RomFixedPtr(0x2B157)) -#define kGenSpr09_GenerateSuperKoopa_InitialXLo ((uint8*)RomFixedPtr(0x2B1B8)) -#define kGenSpr09_GenerateSuperKoopa_InitialXHi ((uint8*)RomFixedPtr(0x2B1BA)) -#define kGenSpr0A_GenerateBubbles_DATA_02B25A ((uint8*)RomFixedPtr(0x2B25A)) -#define kGenSprXX_GenerateDolphins_InitialXLo ((uint8*)RomFixedPtr(0x2B25E)) -#define kGenSprXX_GenerateDolphins_InitialYSpeed ((uint8*)RomFixedPtr(0x2B264)) -#define kGenSpr01_GenerateEerie_InitialXLo ((uint8*)RomFixedPtr(0x2B2D0)) -#define kGenSpr01_GenerateEerie_InitialXHi ((uint8*)RomFixedPtr(0x2B2D2)) -#define kGenSpr01_GenerateEerie_InitialXSpeed ((uint8*)RomFixedPtr(0x2B2D4)) -#define kGenSprXX_GenerateParachuteEnemies_SpriteToSpawn ((uint8*)RomFixedPtr(0x2B31F)) -#define kGenSprXX_GenerateParachuteEnemies_InitialXSpeed ((uint8*)RomFixedPtr(0x2B325)) -#define kShooterSpr02_TorpedoShooter_InitialXSpeed ((uint8*)RomFixedPtr(0x2B464)) -#define kShooterSpr01_BulletBillShooter_ShooterSmokeDispX ((uint8*)RomFixedPtr(0x2B4E9)) -#define kSpr070_Pokey_PokeyClipIndex ((uint8*)RomFixedPtr(0x2B630)) -#define kSpr070_Pokey_DATA_02B653 ((uint8*)RomFixedPtr(0x2B653)) -#define kSpr070_Pokey_DATA_02B657 ((uint8*)RomFixedPtr(0x2B657)) -#define kSpr070_Pokey_DATA_02B65B ((uint8*)RomFixedPtr(0x2B65B)) -#define kSpr070_Pokey_XDisp ((uint8*)RomFixedPtr(0x2B65F)) -#define kSpr070_Pokey_XSpeed ((uint8*)RomFixedPtr(0x2B663)) -#define kSpr070_Pokey_DATA_02B665 ((uint8*)RomFixedPtr(0x2B665)) -#define kSpr070_Pokey_PokeyUnsetBit ((uint8*)RomFixedPtr(0x2B824)) -#define kSpr070_Pokey_DATA_02B829 ((uint8*)RomFixedPtr(0x2B829)) -#define kSpr044_TorpedoTed_MaxSpeed ((uint8*)RomFixedPtr(0x2B8B8)) -#define kSpr044_TorpedoTed_Acceleration ((uint8*)RomFixedPtr(0x2B8BA)) -#define kSpr044_TorpedoTed_XDisp ((uint8*)RomFixedPtr(0x2B8F0)) -#define kSpr044_TorpedoTed_Prop ((uint8*)RomFixedPtr(0x2B8F5)) -#define kSpr044_TorpedoTed_DATA_02B94E ((uint8*)RomFixedPtr(0x2B94E)) -#define kSpr044_TorpedoTed_DATA_02B950 ((uint8*)RomFixedPtr(0x2B950)) -#define kSpr035_Yoshi_DATA_02BB0B ((uint8*)RomFixedPtr(0x2BB0B)) -#define kSpr035_Yoshi_DATA_02BB0F ((uint8*)RomFixedPtr(0x2BB0F)) -#define kSpr035_Yoshi_DATA_02BB13 ((uint8*)RomFixedPtr(0x2BB13)) -#define kSpr035_Yoshi_Tiles ((uint8*)RomFixedPtr(0x2BB17)) -#define kSpr035_Yoshi_Prop ((uint8*)RomFixedPtr(0x2BB1B)) -#define kSpr035_Yoshi_TileSize ((uint8*)RomFixedPtr(0x2BB1F)) -#define kSprXXX_Dolphins_XAcceleration ((uint8*)RomFixedPtr(0x2BB88)) -#define kSprXXX_Dolphins_MaxXSpeed ((uint8*)RomFixedPtr(0x2BB8E)) -#define kSprXXX_Dolphins_Tiles1 ((uint8*)RomFixedPtr(0x2BC0E)) -#define kSprXXX_Dolphins_Tiles2 ((uint8*)RomFixedPtr(0x2BC10)) -#define kSprXXX_Dolphins_Tiles3 ((uint8*)RomFixedPtr(0x2BC12)) -#define kSprXXX_WallFollowers_XSpeed ((uint8*)RomFixedPtr(0x2BC8F)) -#define kSprXXX_WallFollowers_YSpeed ((uint8*)RomFixedPtr(0x2BC97)) -#define kSprXXX_WallFollowers_DATA_02BC9F ((uint8*)RomFixedPtr(0x2BC9F)) -#define kSprXXX_WallFollowers_DATA_02BCA7 ((uint8*)RomFixedPtr(0x2BCA7)) -#define kSprXXX_WallFollowers_DATA_02BCAF ((uint8*)RomFixedPtr(0x2BCAF)) -#define kSprXXX_WallFollowers_SpikeTopAnimationFramesOffset ((uint8*)RomFixedPtr(0x2BCB7)) -#define kSprXXX_WallFollowers_SpikeTopDirection ((uint8*)RomFixedPtr(0x2BCC7)) -#define kSprXXX_WallFollowers_UrchinAnimationFrames ((uint8*)RomFixedPtr(0x2BCD7)) -#define kSprXXX_WallFollowers_FuzzyProp ((uint8*)RomFixedPtr(0x2BE4C)) -#define kSprXXX_WallFollowers_HotheadXDisp ((uint8*)RomFixedPtr(0x2BE8D)) -#define kSprXXX_WallFollowers_HotheadYDisp ((uint8*)RomFixedPtr(0x2BE91)) -#define kSprXXX_WallFollowers_HotheadTiles ((uint8*)RomFixedPtr(0x2BE95)) -#define kSprXXX_WallFollowers_HotheadProp ((uint8*)RomFixedPtr(0x2BE9D)) -#define kSprXXX_WallFollowers_HotheadEyesXDisp ((uint8*)RomFixedPtr(0x2BEA5)) -#define kSprXXX_WallFollowers_HotheadEyesYDisp ((uint8*)RomFixedPtr(0x2BEAD)) -#define kSprXXX_WallFollowers_UrchinXDisp ((uint8*)RomFixedPtr(0x2BF49)) -#define kSprXXX_WallFollowers_UrchinYDisp ((uint8*)RomFixedPtr(0x2BF4E)) -#define kSprXXX_WallFollowers_UrchinProp ((uint8*)RomFixedPtr(0x2BF53)) -#define kSprXXX_WallFollowers_UrchinTiles ((uint8*)RomFixedPtr(0x2BF58)) -#define kSpr03D_RipVanFish_MaxSpeed ((uint8*)RomFixedPtr(0x2BFC8)) -#define kSpr03D_RipVanFish_Acceleration ((uint8*)RomFixedPtr(0x2BFCA)) -#define kSpr091_CharginChuck_DATA_02C132 ((uint8*)RomFixedPtr(0x2C132)) -#define kSpr091_CharginChuck_DATA_02C136 ((uint8*)RomFixedPtr(0x2C136)) -#define kSpr091_CharginChuck_DigginChuckRockInitialXPosLo ((uint8*)RomFixedPtr(0x2C194)) -#define kSpr091_CharginChuck_DigginChuckRockInitialXPosHi ((uint8*)RomFixedPtr(0x2C196)) -#define kSpr091_CharginChuck_DigginChuckRockInitialXSpeed ((uint8*)RomFixedPtr(0x2C198)) -#define kSpr091_CharginChuck_DATA_02C1F3 ((uint8*)RomFixedPtr(0x2C1F3)) -#define kSpr091_CharginChuck_DATA_02C213 ((uint8*)RomFixedPtr(0x2C213)) -#define kSpr091_CharginChuck_MaxYSpeed ((uint8*)RomFixedPtr(0x2C228)) -#define kSpr091_CharginChuck_YAcceleration ((uint8*)RomFixedPtr(0x2C22A)) -#define kSpr091_CharginChuck_DATA_02C373 ((uint8*)RomFixedPtr(0x2C373)) -#define kSpr091_CharginChuck_DATA_02C3B3 ((uint8*)RomFixedPtr(0x2C3B3)) -#define kSpr091_CharginChuck_DATA_02C3B7 ((uint8*)RomFixedPtr(0x2C3B7)) -#define kSpr091_CharginChuck_DATA_02C3BB ((uint8*)RomFixedPtr(0x2C3BB)) -#define kSpr091_CharginChuck_BaseballInitialXPosLo ((uint8*)RomFixedPtr(0x2C460)) -#define kSpr091_CharginChuck_BaseballInitialXPosHi ((uint8*)RomFixedPtr(0x2C462)) -#define kSpr091_CharginChuck_BaseballInitialXSpeed ((uint8*)RomFixedPtr(0x2C464)) -#define kSpr091_CharginChuck_DATA_02C4B5 ((uint8*)RomFixedPtr(0x2C4B5)) -#define kSpr091_CharginChuck_SplittingInitialXSpeed ((uint8*)RomFixedPtr(0x2C57E)) -#define kSpr091_CharginChuck_JumpingInitialXSpeed ((uint8*)RomFixedPtr(0x2C580)) -#define kSpr091_CharginChuck_DATA_02C62E ((uint8*)RomFixedPtr(0x2C62E)) -#define kSpr091_CharginChuck_DATA_02C639 ((uint8*)RomFixedPtr(0x2C639)) -#define kSpr091_CharginChuck_DATA_02C666 ((uint8*)RomFixedPtr(0x2C666)) -#define kSpr091_CharginChuck_ChargingXSpeed ((uint8*)RomFixedPtr(0x2C69F)) -#define kSpr091_CharginChuck_DATA_02C6A3 ((uint8*)RomFixedPtr(0x2C6A3)) -#define kSpr091_CharginChuck_DATA_02C73D ((uint8*)RomFixedPtr(0x2C73D)) -#define kSpr091_CharginChuck_HurtAnimationFrameCounter ((uint8*)RomFixedPtr(0x2C743)) -#define kSpr091_CharginChuck_StompKnockbackXSpeed ((uint8*)RomFixedPtr(0x2C79B)) -#define kSpr091_CharginChuck_HeadXDisp ((uint8*)RomFixedPtr(0x2C830)) -#define kSpr091_CharginChuck_HeadYDisp ((uint8*)RomFixedPtr(0x2C84A)) -#define kSpr091_CharginChuck_HeadOAMIndexOffset ((uint8*)RomFixedPtr(0x2C864)) -#define kSpr091_CharginChuck_HeadTiles ((uint8*)RomFixedPtr(0x2C87E)) -#define kSpr091_CharginChuck_HeadProp ((uint8*)RomFixedPtr(0x2C885)) -#define kSpr091_CharginChuck_BodyXDisp1 ((uint8*)RomFixedPtr(0x2C909)) -#define kSpr091_CharginChuck_BodyXDisp2 ((uint8*)RomFixedPtr(0x2C93D)) -#define kSpr091_CharginChuck_BodyYDisp1 ((uint8*)RomFixedPtr(0x2C971)) -#define kSpr091_CharginChuck_BodyTiles1 ((uint8*)RomFixedPtr(0x2C98B)) -#define kSpr091_CharginChuck_BodyTiles2 ((uint8*)RomFixedPtr(0x2C9A5)) -#define kSpr091_CharginChuck_BodyProp1 ((uint8*)RomFixedPtr(0x2C9BF)) -#define kSpr091_CharginChuck_BodyProp2 ((uint8*)RomFixedPtr(0x2C9D9)) -#define kSpr091_CharginChuck_BodyTileSize1 ((uint8*)RomFixedPtr(0x2C9F3)) -#define kSpr091_CharginChuck_BodyOAMIndexOffset ((uint8*)RomFixedPtr(0x2CA0D)) -#define kSpr091_CharginChuck_JumpinChuckLeftHandXDisp ((uint8*)RomFixedPtr(0x2CA93)) -#define kSpr091_CharginChuck_JumpinChuckRightHandXDisp ((uint8*)RomFixedPtr(0x2CA95)) -#define kSpr091_CharginChuck_JumpinChuckHandTiles ((uint8*)RomFixedPtr(0x2CA97)) -#define kSpr091_CharginChuck_JumpinChuckHandsYDisp ((uint8*)RomFixedPtr(0x2CA99)) -#define kSpr091_CharginChuck_JumpinChuckHandTileSize ((uint8*)RomFixedPtr(0x2CA9B)) -#define kSpr091_CharginChuck_CharginShoulderProp ((uint8*)RomFixedPtr(0x2CAFA)) -#define kSpr091_CharginChuck_BaseballXDisp ((uint8*)RomFixedPtr(0x2CB41)) -#define kSpr091_CharginChuck_BaseballYDisp ((uint8*)RomFixedPtr(0x2CB4D)) -#define kSpr091_CharginChuck_DigginChuckXDisp ((uint8*)RomFixedPtr(0x2CB90)) -#define kSpr091_CharginChuck_DigginChuckProp ((uint8*)RomFixedPtr(0x2CB96)) -#define kSpr091_CharginChuck_DigginChuckYDisp ((uint8*)RomFixedPtr(0x2CB98)) -#define kSpr091_CharginChuck_DigginChuckTiles ((uint8*)RomFixedPtr(0x2CB9B)) -#define kSpr091_CharginChuck_DigginChuckTileSize ((uint8*)RomFixedPtr(0x2CB9E)) -#define kSpr088_WingedCage_XDisp ((uint8*)RomFixedPtr(0x2CCB1)) -#define kSpr088_WingedCage_YDisp ((uint8*)RomFixedPtr(0x2CCB5)) -#define kSpr060_FlatPalaceSwitch_XDisp ((uint8*)RomFixedPtr(0x2CD35)) -#define kSpr060_FlatPalaceSwitch_YDisp ((uint8*)RomFixedPtr(0x2CD3D)) -#define kSpr060_FlatPalaceSwitch_Tile ((uint8*)RomFixedPtr(0x2CD45)) -#define kSpr060_FlatPalaceSwitch_Prop ((uint8*)RomFixedPtr(0x2CD4D)) -#define kSpr060_FlatPalaceSwitch_Palette ((uint8*)RomFixedPtr(0x2CD55)) -#define kSprXXX_WallSpringboard_HighBouncePlayerYSpeed ((uint8*)RomFixedPtr(0x2CDFF)) -#define kSprXXX_WallSpringboard_AutoBouncePlayerYSpeed ((uint8*)RomFixedPtr(0x2CE07)) -#define kSprXXX_WallSpringboard_XDisp ((uint8*)RomFixedPtr(0x2CE90)) -#define kSprXXX_WallSpringboard_YDisp ((uint8*)RomFixedPtr(0x2CEB8)) -#define kSprXXX_WallSpringboard_MaxAngle ((uint8*)RomFixedPtr(0x2CFFE)) -#define kSubOffscreen_Bank02 ((uint8*)RomFixedPtr(0x2D003)) -#define kSubOffscreen_Bank02_DATA_02D005 ((uint8*)RomFixedPtr(0x2D005)) -#define kSubOffscreen_Bank02_DATA_02D007 ((uint8*)RomFixedPtr(0x2D007)) -#define kSubOffscreen_Bank02_DATA_02D00F ((uint8*)RomFixedPtr(0x2D00F)) -#define kSpr035_Yoshi_DATA_02D0D0 ((uint8*)RomFixedPtr(0x2D0D0)) -#define kSpr035_Yoshi_DATA_02D0D2 ((uint8*)RomFixedPtr(0x2D0D2)) -#define kSpr035_Yoshi_DATA_02D1F1 ((uint8*)RomFixedPtr(0x2D1F1)) -#define kHandleHeldPBalloonAndInLakituCloudMovement_XAcceleration ((uint8*)RomFixedPtr(0x2D210)) -#define kHandleHeldPBalloonAndInLakituCloudMovement_MaxXSpeed ((uint8*)RomFixedPtr(0x2D212)) -#define kGetDrawInfo_DATA_02D374 ((uint8*)RomFixedPtr(0x2D374)) -#define kGetDrawInfo_DATA_02D376 ((uint8*)RomFixedPtr(0x2D376)) -#define kSpr086_Wiggler_StompSounds ((uint8*)RomFixedPtr(0x2D580)) -#define kSpr09F_BanzaiBill_XDisp ((uint8*)RomFixedPtr(0x2D5A4)) -#define kSpr09F_BanzaiBill_YDisp ((uint8*)RomFixedPtr(0x2D5B4)) -#define kSpr09F_BanzaiBill_Tiles ((uint8*)RomFixedPtr(0x2D5C4)) -#define kSpr09F_BanzaiBill_Prop ((uint8*)RomFixedPtr(0x2D5D4)) -#define kSpr0A3_GreyChainedPlatform_DoNothing6Times ((uint8*)RomFixedPtr(0x2D800)) -#define kSpr0A3_GreyChainedPlatform_DATA_02D807 ((uint8*)RomFixedPtr(0x2D807)) -#define kSpr0A3_GreyChainedPlatform_DATA_02D80B ((uint8*)RomFixedPtr(0x2D80B)) -#define kSpr0A3_GreyChainedPlatform_DATA_02D80F ((uint8*)RomFixedPtr(0x2D80F)) -#define kSpr0A3_GreyChainedPlatform_DATA_02D840 ((uint8*)RomFixedPtr(0x2D840)) -#define kSpr0A3_GreyChainedPlatform_WoodPlatformTiles ((uint8*)RomFixedPtr(0x2D844)) -#define kSpr09D_BubbleWithSprite_BubbleSprTiles1 ((uint8*)RomFixedPtr(0x2D8A1)) -#define kSpr09D_BubbleWithSprite_BubbleSprTiles2 ((uint8*)RomFixedPtr(0x2D8A5)) -#define kSpr09D_BubbleWithSprite_BubbleSprGfxProp1 ((uint8*)RomFixedPtr(0x2D8A9)) -#define kSpr09D_BubbleWithSprite_BubbleSprGfxProp2 ((uint8*)RomFixedPtr(0x2D8B5)) -#define kSpr09D_BubbleWithSprite_BubbleSprGfxProp3 ((uint8*)RomFixedPtr(0x2D8B7)) -#define kSpr09D_BubbleWithSprite_BubbleSprGfxProp4 ((uint8*)RomFixedPtr(0x2D8B9)) -#define kSpr09D_BubbleWithSprite_BubbleSprites ((uint8*)RomFixedPtr(0x2D9A1)) -#define kSpr09D_BubbleWithSprite_XDisp ((uint8*)RomFixedPtr(0x2D9A5)) -#define kSpr09D_BubbleWithSprite_YDisp ((uint8*)RomFixedPtr(0x2D9B4)) -#define kSpr09D_BubbleWithSprite_Tiles ((uint8*)RomFixedPtr(0x2D9C3)) -#define kSpr09D_BubbleWithSprite_Prop ((uint8*)RomFixedPtr(0x2D9C8)) -#define kSpr09D_BubbleWithSprite_TileSize ((uint8*)RomFixedPtr(0x2D9CD)) -#define kSpr09D_BubbleWithSprite_DATA_02D9D2 ((uint8*)RomFixedPtr(0x2D9D2)) -#define kSpr09B_HammerBro_HammerFreq ((uint8*)RomFixedPtr(0x2DA67)) -#define kSpr09B_HammerBro_XDisp ((uint8*)RomFixedPtr(0x2DAE9)) -#define kSpr09B_HammerBro_YDisp ((uint8*)RomFixedPtr(0x2DAED)) -#define kSpr09B_HammerBro_Tiles ((uint8*)RomFixedPtr(0x2DAF1)) -#define kSpr09B_HammerBro_TileSize ((uint8*)RomFixedPtr(0x2DAF9)) -#define kSpr09C_HammerBroPlatform_XAcceleration ((uint8*)RomFixedPtr(0x2DB54)) -#define kSpr09C_HammerBroPlatform_MaxXSpeed ((uint8*)RomFixedPtr(0x2DB56)) -#define kSpr09C_HammerBroPlatform_YAcceleration ((uint8*)RomFixedPtr(0x2DB58)) -#define kSpr09C_HammerBroPlatform_MaxYSpeed ((uint8*)RomFixedPtr(0x2DB5A)) -#define kSpr09C_HammerBroPlatform_XDisp ((uint8*)RomFixedPtr(0x2DC0F)) -#define kSpr09C_HammerBroPlatform_YDisp ((uint8*)RomFixedPtr(0x2DC17)) -#define kSpr09C_HammerBroPlatform_Tiles ((uint8*)RomFixedPtr(0x2DC1F)) -#define kSpr09C_HammerBroPlatform_Prop ((uint8*)RomFixedPtr(0x2DC27)) -#define kSpr09C_HammerBroPlatform_TileSize ((uint8*)RomFixedPtr(0x2DC2F)) -#define kSpr09C_HammerBroPlatform_BounceYDisp ((uint8*)RomFixedPtr(0x2DC37)) -#define kSpr09A_SumoBro_XSpeed ((uint8*)RomFixedPtr(0x2DD0C)) -#define kSpr09A_SumoBro_XDisp ((uint8*)RomFixedPtr(0x2DDC6)) -#define kSpr09A_SumoBro_YDisp ((uint8*)RomFixedPtr(0x2DDF6)) -#define kSpr09A_SumoBro_Tiles ((uint8*)RomFixedPtr(0x2DE0E)) -#define kSpr09A_SumoBro_TileSize ((uint8*)RomFixedPtr(0x2DE26)) -#define kSpr02B_SumoLightning_FireInitialXPosLo ((uint8*)RomFixedPtr(0x2DF22)) -#define kSpr02B_SumoLightning_FireInitialXPosHi ((uint8*)RomFixedPtr(0x2DF27)) -#define kSpr099_VolcanoLotus_Tiles ((uint8*)RomFixedPtr(0x2E008)) -#define kSpr099_VolcanoLotus_FireInitialXSpeed ((uint8*)RomFixedPtr(0x2E071)) -#define kSpr099_VolcanoLotus_FireInitialYSpeed ((uint8*)RomFixedPtr(0x2E075)) -#define kSpr045_DirectionalCoins_XSpeed ((uint8*)RomFixedPtr(0x2E1F9)) -#define kSpr045_DirectionalCoins_YSpeed ((uint8*)RomFixedPtr(0x2E1FD)) -#define kSpr045_DirectionalCoins_DATA_02E201 ((uint8*)RomFixedPtr(0x2E201)) -#define kSpr045_DirectionalCoins_DATA_02E211 ((uint8*)RomFixedPtr(0x2E211)) -#define kSpr090_GreenGasBubble_XSpeed ((uint8*)RomFixedPtr(0x2E30B)) -#define kSpr090_GreenGasBubble_Acceleration ((uint8*)RomFixedPtr(0x2E30D)) -#define kSpr090_GreenGasBubble_MaxYSpeed ((uint8*)RomFixedPtr(0x2E30F)) -#define kSpr090_GreenGasBubble_DATA_02E352 ((uint8*)RomFixedPtr(0x2E352)) -#define kSpr090_GreenGasBubble_DATA_02E362 ((uint8*)RomFixedPtr(0x2E362)) -#define kSpr090_GreenGasBubble_Tiles ((uint8*)RomFixedPtr(0x2E372)) -#define kSpr090_GreenGasBubble_Prop ((uint8*)RomFixedPtr(0x2E382)) -#define kSpr090_GreenGasBubble_DATA_02E392 ((uint8*)RomFixedPtr(0x2E392)) -#define kSpr090_GreenGasBubble_DATA_02E3A2 ((uint8*)RomFixedPtr(0x2E3A2)) -#define kSpr090_GreenGasBubble_DATA_02E3A6 ((uint8*)RomFixedPtr(0x2E3A6)) -#define kSpr08F_ScalePlatform_MushrmScaleTiles ((uint8*)RomFixedPtr(0x2E520)) -#define kSpr052_MovingLedgeHole_XDisp ((uint8*)RomFixedPtr(0x2E666)) -#define kSpr052_MovingLedgeHole_Tiles ((uint8*)RomFixedPtr(0x2E66A)) -#define kSpr052_MovingLedgeHole_Prop ((uint8*)RomFixedPtr(0x2E66E)) -#define kSpr047_SwimmingAndJumpingCheepCheep_XSpeed ((uint8*)RomFixedPtr(0x2E74C)) -#define kSpr049_ShiftingPipe_YSpeed ((uint8*)RomFixedPtr(0x2E835)) -#define kSpr049_ShiftingPipe_DATA_02E839 ((uint8*)RomFixedPtr(0x2E839)) -#define kSpr049_ShiftingPipe_LeftTileToSpawn ((uint8*)RomFixedPtr(0x2E83D)) -#define kSpr049_ShiftingPipe_RightTileToSpawn ((uint8*)RomFixedPtr(0x2E841)) -#define kSpr04B_PipeLakitu_HeadTiles ((uint8*)RomFixedPtr(0x2E9E6)) -#define kSpr04B_PipeLakitu_BodyTiles ((uint8*)RomFixedPtr(0x2E9E9)) -#define kSprXXX_SuperKoopas_NonGroundedKoopaXSpeed ((uint8*)RomFixedPtr(0x2EB2F)) -#define kSprXXX_SuperKoopas_MaxXSpeed ((uint8*)RomFixedPtr(0x2EB89)) -#define kSprXXX_SuperKoopas_XAcceleration ((uint8*)RomFixedPtr(0x2EB8B)) -#define kSprXXX_SuperKoopas_XDisp ((uint8*)RomFixedPtr(0x2EC06)) -#define kSprXXX_SuperKoopas_YDisp ((uint8*)RomFixedPtr(0x2EC4E)) -#define kSprXXX_SuperKoopas_Tiles ((uint8*)RomFixedPtr(0x2EC72)) -#define kSprXXX_SuperKoopas_Prop ((uint8*)RomFixedPtr(0x2EC96)) -#define kSprXXX_SuperKoopas_TileSize ((uint8*)RomFixedPtr(0x2ECBA)) -#define kSprXXX_SuperKoopas_DATA_02ED39 ((uint8*)RomFixedPtr(0x2ED39)) -#define kSpr061_SkullRaft_Init_XPosOffset ((uint8*)RomFixedPtr(0x2ED7F)) -#define kSpr06A_CoinGameCloud_Acceleration ((uint8*)RomFixedPtr(0x2EEB1)) -#define kSpr06A_CoinGameCloud_MaxYSpeed ((uint8*)RomFixedPtr(0x2EEB3)) -#define kSpr086_Wiggler_Init_WigglerSegmentTablePointerLo ((uint8*)RomFixedPtr(0x2EFEA)) -#define kSpr086_Wiggler_Init_WigglerSegmentTablePointerHi ((uint8*)RomFixedPtr(0x2EFEE)) -#define kSpr086_Wiggler_XSpeed ((uint8*)RomFixedPtr(0x2F031)) -#define kSpr086_Wiggler_DATA_02F103 ((uint8*)RomFixedPtr(0x2F103)) -#define kSpr086_Wiggler_WigglerYDisp ((uint8*)RomFixedPtr(0x2F108)) -#define kSpr086_Wiggler_WigglerTiles ((uint8*)RomFixedPtr(0x2F10C)) -#define kSpr086_Wiggler_FlowerXDisp ((uint8*)RomFixedPtr(0x2F2D3)) -#define kSpr086_Wiggler_EyeXDisp ((uint8*)RomFixedPtr(0x2F2D5)) -#define kSpr08A_Bird_DATA_02F33C ((uint8*)RomFixedPtr(0x2F33C)) -#define kSpr08A_Bird_XSpeed ((uint8*)RomFixedPtr(0x2F340)) -#define kSpr08A_Bird_Tiles ((uint8*)RomFixedPtr(0x2F3DB)) -#define kSpr08A_Bird_Direction ((uint8*)RomFixedPtr(0x2F3E0)) -#define kSpr08A_Bird_Palette ((uint8*)RomFixedPtr(0x2F3E2)) -#define kSpr08A_Bird_BirdOAMIndex ((uint8*)RomFixedPtr(0x2F3E6)) -#define kSpr08B_FireplaceSmoke_DATA_02F463 ((uint8*)RomFixedPtr(0x2F463)) -#define kSpr08C_SideExitAndFireplace_TopTile ((uint8*)RomFixedPtr(0x2F4E7)) -#define kSpr08C_SideExitAndFireplace_BottomTile ((uint8*)RomFixedPtr(0x2F4E9)) -#define kSpr08D_GhostHouseDoor_DATA_02F59E ((uint8*)RomFixedPtr(0x2F59E)) -#define kSpr08D_GhostHouseDoor_DATA_02F5A8 ((uint8*)RomFixedPtr(0x2F5A8)) -#define kSpr08D_GhostHouseDoor_YDisp ((uint8*)RomFixedPtr(0x2F5B2)) -#define kSpr08D_GhostHouseDoor_Tile ((uint8*)RomFixedPtr(0x2F5BC)) -#define kSpr08D_GhostHouseDoor_Prop ((uint8*)RomFixedPtr(0x2F5C6)) -#define kDrawNoYoshiSign_XDisp ((uint8*)RomFixedPtr(0x2F619)) -#define kDrawNoYoshiSign_YDisp ((uint8*)RomFixedPtr(0x2F621)) -#define kDrawNoYoshiSign_Tiles ((uint8*)RomFixedPtr(0x2F629)) -#define kDrawNoYoshiSign_Prop ((uint8*)RomFixedPtr(0x2F631)) -#define kDrawBigCastleGate_XDisp ((uint8*)RomFixedPtr(0x2F6A0)) -#define kDrawBigCastleGate_YDisp ((uint8*)RomFixedPtr(0x2F6AC)) -#define kDrawGhostHouseEntranceDoor_XDisp ((uint8*)RomFixedPtr(0x2F6F1)) -#define kDrawGhostHouseEntranceDoor_YDisp ((uint8*)RomFixedPtr(0x2F711)) -#define kDrawGhostHouseEntranceDoor_Prop ((uint8*)RomFixedPtr(0x2F719)) -#define kDrawGhostHouseEntranceDoor_Tiles ((uint8*)RomFixedPtr(0x2F721)) -#define kDrawGhostHouseEntranceDoor_OAMIndexes ((uint8*)RomFixedPtr(0x2F741)) -#define kDrawGhostHouseEntranceDoor_AnimationFrame ((uint8*)RomFixedPtr(0x2F749)) -#define kClusterSpr07_ReappearingBoo_DATA_02F837 ((uint8*)RomFixedPtr(0x2F837)) -#define kClusterSpr07_ReappearingBoo_DATA_02F839 ((uint8*)RomFixedPtr(0x2F839)) -#define kClusterSpr06_SumoBroFlame_DATA_02F8FC ((uint8*)RomFixedPtr(0x2F8FC)) -#define kClusterSpr06_SumoBroFlame_Tiles ((uint8*)RomFixedPtr(0x2F904)) -#define kClusterSpr06_SumoBroFlame_DATA_02F90C ((uint8*)RomFixedPtr(0x2F90C)) -#define kClusterSpr06_SumoBroFlame_DATA_02F9AA ((uint8*)RomFixedPtr(0x2F9AA)) -#define kClusterSpr05_CandleFlame_DATA_02FA02 ((uint8*)RomFixedPtr(0x2FA02)) -#define kClusterSpr05_CandleFlame_OAMIndex ((uint8*)RomFixedPtr(0x2FA0A)) -#define kClusterSpr05_CandleFlame_Tiles ((uint8*)RomFixedPtr(0x2FA0E)) -#define kClusterSpr05_CandleFlame_Prop ((uint8*)RomFixedPtr(0x2FA12)) -#define kClusterSpr04_BooRing_DATA_02FA84 ((uint16*)RomFixedPtr(0x2FA84)) -#define kClusterSpr03_BooCeiling_DATA_02FBBB ((uint8*)RomFixedPtr(0x2FBBB)) -#define kClusterSpr03_BooCeiling_DATA_02FBBD ((uint8*)RomFixedPtr(0x2FBBD)) -#define kClusterSpr03_BooCeiling_BooCeilingTiles ((uint8*)RomFixedPtr(0x2FBBF)) -#define kClusterSpr03_BooCeiling_BatCeilingTiles ((uint8*)RomFixedPtr(0x2FDB8)) -#define kClusterSpriteOAMIndexes ((uint8*)RomFixedPtr(0x2FF50)) -#define kClusterSpr01_1up_OAMIndex ((uint8*)RomFixedPtr(0x2FF64)) -#define kSpr0AB_Rex_StompSounds ((uint8*)RomFixedPtr(0x38000)) -#define kSpr01B_Football_DATA_038007 ((uint8*)RomFixedPtr(0x38007)) -#define kSpr01B_Football_DATA_03800E ((uint8*)RomFixedPtr(0x3800E)) -#define kSpr0C5_BigBooBoss_XAcceleration ((uint8*)RomFixedPtr(0x380FA)) -#define kSpr0C5_BigBooBoss_MaxXSpeed ((uint8*)RomFixedPtr(0x380FC)) -#define kSpr0C5_BigBooBoss_MaxYSpeed ((uint8*)RomFixedPtr(0x380FE)) -#define kSpr0C5_BigBooBoss_YAcceleration ((uint8*)RomFixedPtr(0x38100)) -#define kSpr0C5_BigBooBoss_DATA_038102 ((uint8*)RomFixedPtr(0x38102)) -#define kNormalSpriteBooGFXRt_BigBooXDisp ((uint8*)RomFixedPtr(0x38280)) -#define kNormalSpriteBooGFXRt_BigBooYDisp ((uint8*)RomFixedPtr(0x382D0)) -#define kNormalSpriteBooGFXRt_BigBooTiles ((uint8*)RomFixedPtr(0x382F8)) -#define kNormalSpriteBooGFXRt_BigBooProp ((uint8*)RomFixedPtr(0x38348)) -#define kSpr0C4_GreyFallingPlatform_XDisp ((uint8*)RomFixedPtr(0x3848A)) -#define kSpr0C4_GreyFallingPlatform_Tiles ((uint8*)RomFixedPtr(0x3848E)) -#define kSpr0C2_Blurp_MaxYSpeed ((uint8*)RomFixedPtr(0x384C4)) -#define kSpr0C2_Blurp_XSpeed ((uint8*)RomFixedPtr(0x384C6)) -#define kSpr0C2_Blurp_YAcceleration ((uint8*)RomFixedPtr(0x384C8)) -#define kSpr0C3_PorcuPuffer_PorcuPuffAccel ((uint8*)RomFixedPtr(0x3852B)) -#define kSpr0C3_PorcuPuffer_PorcuPuffMaxSpeed ((uint8*)RomFixedPtr(0x3852D)) -#define kSpr0C3_PorcuPuffer_PocruPufferDispX ((uint8*)RomFixedPtr(0x38587)) -#define kSpr0C3_PorcuPuffer_PocruPufferDispY ((uint8*)RomFixedPtr(0x3858F)) -#define kSpr0C3_PorcuPuffer_PocruPufferTiles ((uint8*)RomFixedPtr(0x38593)) -#define kSpr0C3_PorcuPuffer_PocruPufferGfxProp ((uint8*)RomFixedPtr(0x3859B)) -#define kSpr0C1_WingedPlatform_FlyingBlockSpeedY ((uint8*)RomFixedPtr(0x385F4)) -#define kSpr0C1_WingedPlatform_XDisp ((uint8*)RomFixedPtr(0x38676)) -#define kSpr0C1_WingedPlatform_YDisp ((uint8*)RomFixedPtr(0x38680)) -#define kSpr0C1_WingedPlatform_Tiles ((uint8*)RomFixedPtr(0x3868A)) -#define kSpr0C1_WingedPlatform_Prop ((uint8*)RomFixedPtr(0x38694)) -#define kSpr0C1_WingedPlatform_TileSize ((uint8*)RomFixedPtr(0x3869E)) -#define kSpr0C0_SinkingLavaPlatform_LavaPlatTiles ((uint8*)RomFixedPtr(0x38734)) -#define kSpr0C0_SinkingLavaPlatform_DATA_038737 ((uint8*)RomFixedPtr(0x38737)) -#define kSpr0BF_MegaMole_MegaMoleSpeed ((uint8*)RomFixedPtr(0x3876E)) -#define kSpr0BF_MegaMole_TileDispX ((uint8*)RomFixedPtr(0x3882B)) -#define kSpr0BF_MegaMole_TileDispY ((uint8*)RomFixedPtr(0x38833)) -#define kSpr0BF_MegaMole_Tiles ((uint8*)RomFixedPtr(0x38837)) -#define kSpr0BE_Swooper_Tiles ((uint8*)RomFixedPtr(0x388A0)) -#define kSpr0BE_Swooper_MaxXSpeed ((uint8*)RomFixedPtr(0x388E0)) -#define kSpr0BE_Swooper_XAcceleration ((uint8*)RomFixedPtr(0x388E2)) -#define kSpr0BD_SlidingNakedBlueKoopa_MaxXSpeed ((uint8*)RomFixedPtr(0x38954)) -#define kSpr0BD_SlidingNakedBlueKoopa_XAcceleration ((uint8*)RomFixedPtr(0x38956)) -#define kSpr0BC_BowserStatue_XSpeed ((uint8*)RomFixedPtr(0x38ABF)) -#define kSpr0BC_BowserStatue_FireSpawnXDispXLo ((uint8*)RomFixedPtr(0x38AC7)) -#define kSpr0BC_BowserStatue_FireSpawnXDispXHi ((uint8*)RomFixedPtr(0x38AC9)) -#define kSpr0BC_BowserStatue_XDisp ((uint8*)RomFixedPtr(0x38B25)) -#define kSpr0BC_BowserStatue_YDisp ((uint8*)RomFixedPtr(0x38B2B)) -#define kSpr0BC_BowserStatue_Tiles ((uint8*)RomFixedPtr(0x38B2E)) -#define kSpr0BC_BowserStatue_TileSize ((uint8*)RomFixedPtr(0x38B34)) -#define kSpr0BC_BowserStatue_Prop ((uint8*)RomFixedPtr(0x38B37)) -#define kSpr0B7_CarrotTopLiftUpperRight_DATA_038BAA ((uint8*)RomFixedPtr(0x38BAA)) -#define kSpr0B7_CarrotTopLiftUpperRight_DATA_038C2A ((uint8*)RomFixedPtr(0x38C2A)) -#define kSpr0B7_CarrotTopLiftUpperRight_XDisp ((uint8*)RomFixedPtr(0x38D0C)) -#define kSpr0B7_CarrotTopLiftUpperRight_YDisp ((uint8*)RomFixedPtr(0x38D12)) -#define kSpr0B7_CarrotTopLiftUpperRight_Tiles ((uint8*)RomFixedPtr(0x38D18)) -#define kSpr0B7_CarrotTopLiftUpperRight_Prop ((uint8*)RomFixedPtr(0x38D1E)) -#define kSpr0B9_MessageBox_DATA_038D66 ((uint8*)RomFixedPtr(0x38D66)) -#define kSpr0BA_TimedPlatform_XDisp ((uint8*)RomFixedPtr(0x38DFF)) -#define kSpr0BA_TimedPlatform_YDisp ((uint8*)RomFixedPtr(0x38E02)) -#define kSpr0BA_TimedPlatform_PlatformTiles ((uint8*)RomFixedPtr(0x38E05)) -#define kSpr0BA_TimedPlatform_Prop ((uint8*)RomFixedPtr(0x38E08)) -#define kSpr0BA_TimedPlatform_TileSize ((uint8*)RomFixedPtr(0x38E0B)) -#define kSpr0BA_TimedPlatform_NumberTiles ((uint8*)RomFixedPtr(0x38E0E)) -#define kSpr0BB_MovingCastleStone_XSpeed ((uint8*)RomFixedPtr(0x38E71)) -#define kSpr0BB_MovingCastleStone_MovementTiming ((uint8*)RomFixedPtr(0x38E75)) -#define kSpr0BB_MovingCastleStone_XDisp ((uint8*)RomFixedPtr(0x38EA8)) -#define kSpr0BB_MovingCastleStone_YDisp ((uint8*)RomFixedPtr(0x38EAC)) -#define kSpr0BB_MovingCastleStone_Tiles ((uint8*)RomFixedPtr(0x38EB0)) -#define kSpr0B3_BowserStatueFire_XSpeed ((uint8*)RomFixedPtr(0x38EEA)) -#define kSpr0B3_BowserStatueFire_XDisp ((uint8*)RomFixedPtr(0x38F07)) -#define kSpr0B3_BowserStatueFire_Tiles ((uint8*)RomFixedPtr(0x38F0B)) -#define kSpr0B3_BowserStatueFire_Prop ((uint8*)RomFixedPtr(0x38F13)) -#define kSprXXX_ReflectingEnemy_BooStreamTiles ((uint8*)RomFixedPtr(0x38F6D)) -#define kSpr0AE_FishinBoo_XAcceleration ((uint8*)RomFixedPtr(0x3905D)) -#define kSpr0AE_FishinBoo_MaxXSpeed ((uint8*)RomFixedPtr(0x3905F)) -#define kSpr0AE_FishinBoo_YAcceleration ((uint8*)RomFixedPtr(0x39061)) -#define kSpr0AE_FishinBoo_MaxYSpeed ((uint8*)RomFixedPtr(0x39063)) -#define kSpr0AE_FishinBoo_DATA_0390EB ((uint8*)RomFixedPtr(0x390EB)) -#define kSpr0AE_FishinBoo_DATA_0390EF ((uint8*)RomFixedPtr(0x390EF)) -#define kSpr0AE_FishinBoo_XDisp ((uint8*)RomFixedPtr(0x3912E)) -#define kSpr0AE_FishinBoo_YDisp ((uint8*)RomFixedPtr(0x39156)) -#define kSpr0AE_FishinBoo_Tiles1 ((uint8*)RomFixedPtr(0x39160)) -#define kSpr0AE_FishinBoo_Prop ((uint8*)RomFixedPtr(0x3916A)) -#define kSpr0AE_FishinBoo_Tiles2 ((uint8*)RomFixedPtr(0x39174)) -#define kSpr0AE_FishinBoo_DATA_039178 ((uint8*)RomFixedPtr(0x39178)) -#define kSpr0AE_FishinBoo_DATA_03917C ((uint8*)RomFixedPtr(0x3917C)) -#define kSpr0B1_CreateEatBlock_XSpeed ((uint8*)RomFixedPtr(0x3926F)) -#define kSpr0B1_CreateEatBlock_YSpeed ((uint8*)RomFixedPtr(0x39274)) -#define kSpr0B1_CreateEatBlock_DATA_039279 ((uint8*)RomFixedPtr(0x39279)) -#define kSpr0B1_CreateEatBlock_SubmapMovementData ((uint8*)RomFixedPtr(0x393A4)) -#define kSpr0B1_CreateEatBlock_MainMapMovementData ((uint8*)RomFixedPtr(0x393EF)) -#define kSpr0AC_DownFirstWoodenSpike_DATA_039484 ((uint8*)RomFixedPtr(0x39484)) -#define kSpr0AC_DownFirstWoodenSpike_DATA_039486 ((uint8*)RomFixedPtr(0x39486)) -#define kSpr0AC_DownFirstWoodenSpike_YDisp ((uint8*)RomFixedPtr(0x394B1)) -#define kSpr0AC_DownFirstWoodenSpike_Tiles ((uint8*)RomFixedPtr(0x394BB)) -#define kSpr0AC_DownFirstWoodenSpike_Prop ((uint8*)RomFixedPtr(0x394C5)) -#define kSpr0AB_Rex_XSpeed ((uint8*)RomFixedPtr(0x39513)) -#define kSpr0AB_Rex_RexKilledSpeed ((uint8*)RomFixedPtr(0x39625)) -#define kSpr0AB_Rex_XDisp ((uint8*)RomFixedPtr(0x3964C)) -#define kSpr0AB_Rex_YDisp ((uint8*)RomFixedPtr(0x39664)) -#define kSpr0AB_Rex_Tiles ((uint8*)RomFixedPtr(0x39670)) -#define kSpr0AB_Rex_Prop ((uint8*)RomFixedPtr(0x3967C)) -#define kSpr0AA_Fishbone_MaxXSpeed ((uint8*)RomFixedPtr(0x3972B)) -#define kSpr0AA_Fishbone_XAcceleration ((uint8*)RomFixedPtr(0x3972D)) -#define kSpr0AA_Fishbone_XDisp ((uint8*)RomFixedPtr(0x3977E)) -#define kSpr0AA_Fishbone_YDisp ((uint8*)RomFixedPtr(0x39782)) -#define kSpr0AA_Fishbone_Prop ((uint8*)RomFixedPtr(0x39784)) -#define kSpr0AA_Fishbone_TailTiles ((uint8*)RomFixedPtr(0x39788)) -#define kSpr0A9_Reznor_ReznorStartPosLo ((uint8*)RomFixedPtr(0x39886)) -#define kSpr0A9_Reznor_ReznorStartPosHi ((uint8*)RomFixedPtr(0x3988A)) -#define kSpr0A9_Reznor_ReboundSpeedX ((uint8*)RomFixedPtr(0x3988E)) -#define kSpr0A9_Reznor_XDisp ((uint8*)RomFixedPtr(0x39B51)) -#define kSpr0A9_Reznor_YDisp ((uint8*)RomFixedPtr(0x39B59)) -#define kSpr0A9_Reznor_Tiles ((uint8*)RomFixedPtr(0x39B5D)) -#define kSpr0A9_Reznor_Prop ((uint8*)RomFixedPtr(0x39B69)) -#define kSpr0A9_Reznor_PlatformYDisp ((uint8*)RomFixedPtr(0x39BE3)) -#define kSpr06F_DinoTorch_DATA_039C6E ((uint8*)RomFixedPtr(0x39C6E)) -#define kSpr06F_DinoTorch_DATA_039C71 ((uint8*)RomFixedPtr(0x39C71)) -#define kSpr06F_DinoTorch_XSpeed ((uint8*)RomFixedPtr(0x39CA4)) -#define kSpr06F_DinoTorch_DinoFlameTable ((uint8*)RomFixedPtr(0x39D01)) -#define kSpr06F_DinoTorch_DinoFlame1 ((uint8*)RomFixedPtr(0x39D9E)) -#define kSpr06F_DinoTorch_DinoFlame2 ((uint8*)RomFixedPtr(0x39DA2)) -#define kSpr06F_DinoTorch_DinoFlame3 ((uint8*)RomFixedPtr(0x39DA6)) -#define kSpr06F_DinoTorch_DinoFlame4 ((uint8*)RomFixedPtr(0x39DAA)) -#define kSpr06F_DinoTorch_DinoFlame5 ((uint8*)RomFixedPtr(0x39DAE)) -#define kSpr06F_DinoTorch_DinoFlame6 ((uint8*)RomFixedPtr(0x39DB2)) -#define kSpr06F_DinoTorch_DinoTorchXDisp ((uint8*)RomFixedPtr(0x39DFE)) -#define kSpr06F_DinoTorch_DinoTorchYDisp ((uint8*)RomFixedPtr(0x39E08)) -#define kSpr06F_DinoTorch_DinoFlameTiles ((uint8*)RomFixedPtr(0x39E12)) -#define kSpr06F_DinoTorch_DinoTorchProp ((uint8*)RomFixedPtr(0x39E1C)) -#define kSpr06F_DinoTorch_DinoTorchTiles ((uint8*)RomFixedPtr(0x39E21)) -#define kSpr06F_DinoTorch_DinoRhinoXDisp ((uint8*)RomFixedPtr(0x39E25)) -#define kSpr06F_DinoTorch_DinoRhinoProp ((uint8*)RomFixedPtr(0x39E2D)) -#define kSpr06F_DinoTorch_DinoRhinoYDisp ((uint8*)RomFixedPtr(0x39E35)) -#define kSpr06F_DinoTorch_DinoRhinoTiles ((uint8*)RomFixedPtr(0x39E39)) -#define kSpr06F_DinoTorch_DinoTilesWritten ((uint8*)RomFixedPtr(0x39F32)) -#define kSpr0A8_Blargg_XSpeed ((uint8*)RomFixedPtr(0x39FED)) -#define kSpr0A8_Blargg_XDisp ((uint8*)RomFixedPtr(0x3A082)) -#define kSpr0A8_Blargg_YDisp ((uint8*)RomFixedPtr(0x3A08C)) -#define kSpr0A8_Blargg_Tiles ((uint8*)RomFixedPtr(0x3A091)) -#define kSpr0A8_Blargg_Prop ((uint8*)RomFixedPtr(0x3A09B)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A265 ((uint8*)RomFixedPtr(0x3A265)) -#define kSpr0A0_ActivateBowserBattle_SmokeXDisp ((uint8*)RomFixedPtr(0x3A341)) -#define kSpr0A0_ActivateBowserBattle_SmokeYDisp ((uint8*)RomFixedPtr(0x3A389)) -#define kSpr0A0_ActivateBowserBattle_SmokeProp ((uint8*)RomFixedPtr(0x3A3D1)) -#define kSpr0A0_ActivateBowserBattle_SmokeTiles ((uint8*)RomFixedPtr(0x3A3D9)) -#define kSpr0A0_ActivateBowserBattle_DuckingAnimationFrames ((uint8*)RomFixedPtr(0x3A437)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A490 ((uint8*)RomFixedPtr(0x3A490)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A492 ((uint8*)RomFixedPtr(0x3A492)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A494 ((uint8*)RomFixedPtr(0x3A494)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A496 ((uint8*)RomFixedPtr(0x3A496)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A498 ((uint8*)RomFixedPtr(0x3A498)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A4EB ((uint8*)RomFixedPtr(0x3A4EB)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A52D ((uint8*)RomFixedPtr(0x3A52D)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A56D ((uint8*)RomFixedPtr(0x3A56D)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A64D ((uint8*)RomFixedPtr(0x3A64D)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A6F0 ((uint8*)RomFixedPtr(0x3A6F0)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A71F ((uint8*)RomFixedPtr(0x3A71F)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A721 ((uint8*)RomFixedPtr(0x3A721)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A723 ((uint8*)RomFixedPtr(0x3A723)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A725 ((uint8*)RomFixedPtr(0x3A725)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A727 ((uint8*)RomFixedPtr(0x3A727)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A729 ((uint8*)RomFixedPtr(0x3A729)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A72B ((uint8*)RomFixedPtr(0x3A72B)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A72D ((uint8*)RomFixedPtr(0x3A72D)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A72F ((uint8*)RomFixedPtr(0x3A72F)) -#define kSpr0A0_ActivateBowserBattle_RainingFireSounds ((uint8*)RomFixedPtr(0x3A841)) -#define kSpr0A0_ActivateBowserBattle_DATA_03A8BE ((uint8*)RomFixedPtr(0x3A8BE)) -#define kSpr07C_PrincessPeach_PeachXDisp ((uint8*)RomFixedPtr(0x3A92E)) -#define kSpr07C_PrincessPeach_PeachYDisp ((uint8*)RomFixedPtr(0x3A97E)) -#define kSpr07C_PrincessPeach_PeachTiles ((uint8*)RomFixedPtr(0x3A9CE)) -#define kSpr07C_PrincessPeach_PeachProp ((uint8*)RomFixedPtr(0x3AA1E)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AB15 ((uint8*)RomFixedPtr(0x3AB15)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AB17 ((uint8*)RomFixedPtr(0x3AB17)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AB19 ((uint8*)RomFixedPtr(0x3AB19)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AB1B ((uint8*)RomFixedPtr(0x3AB1B)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AB62 ((uint8*)RomFixedPtr(0x3AB62)) -#define kSpr07C_PrincessPeach_BlushYDisp ((uint8*)RomFixedPtr(0x3AC93)) -#define kSpr07C_PrincessPeach_BlushTiles ((uint8*)RomFixedPtr(0x3AC95)) -#define kSpr07C_PrincessPeach_XSpeed ((uint8*)RomFixedPtr(0x3ADD9)) -#define kSpr07C_PrincessPeach_DATA_03AE5B ((uint8*)RomFixedPtr(0x3AE5B)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AF34 ((uint8*)RomFixedPtr(0x3AF34)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AF3C ((uint8*)RomFixedPtr(0x3AF3C)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AF44 ((uint8*)RomFixedPtr(0x3AF44)) -#define kSpr0A0_ActivateBowserBattle_DATA_03AF4C ((uint8*)RomFixedPtr(0x3AF4C)) -#define kSpr0A0_ActivateBowserBattle_DATA_03B013 ((uint8*)RomFixedPtr(0x3B013)) -#define kSpr0A0_ActivateBowserBattle_DATA_03B015 ((uint8*)RomFixedPtr(0x3B015)) -#define kSpr0A0_ActivateBowserBattle_DATA_03B017 ((uint8*)RomFixedPtr(0x3B017)) -#define kSpr0A0_ActivateBowserBattle_DATA_03B074 ((uint8*)RomFixedPtr(0x3B074)) -#define kSpr0A0_ActivateBowserBattle_DATA_03B076 ((uint8*)RomFixedPtr(0x3B076)) -#define kSpr0A1_BowserBowlingBall_XSpeed ((uint8*)RomFixedPtr(0x3B161)) -#define kSpr0A1_BowserBowlingBall_XDisp ((uint8*)RomFixedPtr(0x3B1D5)) -#define kSpr0A1_BowserBowlingBall_YDisp ((uint8*)RomFixedPtr(0x3B1E1)) -#define kSpr0A1_BowserBowlingBall_Tiles ((uint8*)RomFixedPtr(0x3B1ED)) -#define kSpr0A1_BowserBowlingBall_Prop ((uint8*)RomFixedPtr(0x3B1F9)) -#define kSpr0A1_BowserBowlingBall_TileSize ((uint8*)RomFixedPtr(0x3B205)) -#define kSpr0A1_BowserBowlingBall_XDisp2 ((uint8*)RomFixedPtr(0x3B211)) -#define kSpr0A1_BowserBowlingBall_YDisp2 ((uint8*)RomFixedPtr(0x3B219)) -#define kSpr0A2_MechaKoopa_XSpeed ((uint8*)RomFixedPtr(0x3B2A7)) -#define kSpr0A2_MechaKoopa_MechakoopaXDisp ((uint8*)RomFixedPtr(0x3B30F)) -#define kSpr0A2_MechaKoopa_MechakoopaYDisp ((uint8*)RomFixedPtr(0x3B317)) -#define kSpr0A2_MechaKoopa_MechakoopaTiles ((uint8*)RomFixedPtr(0x3B32F)) -#define kSpr0A2_MechaKoopa_MechakoopaProp ((uint8*)RomFixedPtr(0x3B347)) -#define kSpr0A2_MechaKoopa_MechakoopaTileSize ((uint8*)RomFixedPtr(0x3B34F)) -#define kSpr0A2_MechaKoopa_MechakoopaPalette ((uint8*)RomFixedPtr(0x3B353)) -#define kSpr0A2_MechaKoopa_KeyXDisp ((uint8*)RomFixedPtr(0x3B3EF)) -#define kSpr0A2_MechaKoopa_KeyProp ((uint8*)RomFixedPtr(0x3B3F1)) -#define kSpr0A2_MechaKoopa_KeyTiles ((uint8*)RomFixedPtr(0x3B3F3)) -#define kSpr0A0_ActivateBowserBattle_ItemBoxXPos ((uint8*)RomFixedPtr(0x3B443)) -#define kSpr0A0_ActivateBowserBattle_ItemBoxYPos ((uint8*)RomFixedPtr(0x3B447)) -#define kSpr0A0_ActivateBowserBattle_ItemBoxProp ((uint8*)RomFixedPtr(0x3B44B)) -#define kSpr0A0_ActivateBowserBattle_RoofXPos ((uint8*)RomFixedPtr(0x3B48C)) -#define kSpr0A0_ActivateBowserBattle_RoofYPos ((uint8*)RomFixedPtr(0x3B49C)) -#define kStandardSpriteToSpriteCollisionChecks_SprClippingDispX ((uint8*)RomFixedPtr(0x3B56C)) -#define kStandardSpriteToSpriteCollisionChecks_SprClippingWidth ((uint8*)RomFixedPtr(0x3B5A8)) -#define kStandardSpriteToSpriteCollisionChecks_SprClippingDispY ((uint8*)RomFixedPtr(0x3B5E4)) -#define kStandardSpriteToSpriteCollisionChecks_SprClippingHeight ((uint8*)RomFixedPtr(0x3B620)) -#define kStandardSpriteToSpriteCollisionChecks_MarioClipDispY ((uint8*)RomFixedPtr(0x3B65C)) -#define kStandardSpriteToSpriteCollisionChecks_MarioClippingHeight ((uint8*)RomFixedPtr(0x3B660)) -#define kGetDrawInfo_DATA_03B75C ((uint8*)RomFixedPtr(0x3B75C)) -#define kGetDrawInfo_DATA_03B75E ((uint8*)RomFixedPtr(0x3B75E)) -#define kSpr0A1_BowserBowlingBall_BounceYSpeed ((uint8*)RomFixedPtr(0x3B7D2)) -#define kSubOffscreen_Bank03 ((uint8*)RomFixedPtr(0x3B83B)) -#define kSubOffscreen_Bank03_DATA_03B83D ((uint8*)RomFixedPtr(0x3B83D)) -#define kSubOffscreen_Bank03_DATA_03B83F ((uint8*)RomFixedPtr(0x3B83F)) -#define kSubOffscreen_Bank03_DATA_03B847 ((uint8*)RomFixedPtr(0x3B847)) -#define kSpr01F_MagiKoopa_MagiKoopaFadePalettes ((uint16*)RomFixedPtr(0x3B902)) -#define kBooFadePalettes_Fade07 ((uint16*)RomFixedPtr(0x3B982)) -#define kCheckIfBabyYoshiCanEatNormalSprite_ChangingItemSpriteType ((uint8*)RomFixedPtr(0x3C02B)) -#define kGameMode14_InLevel_DATA_03C0B2 ((uint8*)RomFixedPtr(0x3C0B2)) -#define kGameMode14_InLevel_DATA_03C0B6 ((uint8*)RomFixedPtr(0x3C0B6)) -#define kGameMode14_InLevel_IggyPlatSpeed ((uint8*)RomFixedPtr(0x3C112)) -#define kGameMode14_InLevel_DATA_03C116 ((uint8*)RomFixedPtr(0x3C116)) -#define kGameMode14_InLevel_IggyPlatBounds ((uint8*)RomFixedPtr(0x3C11A)) -#define kSpr035_Yoshi_YoshiThroatXDisp ((uint8*)RomFixedPtr(0x3C176)) -#define kSpr035_Yoshi_YoshiThroatYDisp ((uint8*)RomFixedPtr(0x3C19E)) -#define kHandleNormalSpriteLevelColl_DATA_03C1C6 ((uint8*)RomFixedPtr(0x3C1C6)) -#define kHandleNormalSpriteLevelColl_DATA_03C1C8 ((uint8*)RomFixedPtr(0x3C1C8)) -#define kSpr0C8_LightSwitch_DATA_03C1EC ((uint8*)RomFixedPtr(0x3C1EC)) -#define kSprXXX_LineGuided_MotorTiles ((uint8*)RomFixedPtr(0x3C25B)) -#define kSprXXX_LineGuided_YDisp ((uint8*)RomFixedPtr(0x3C25F)) -#define kSprXXX_LineGuided_Prop ((uint8*)RomFixedPtr(0x3C261)) -#define kSpr051_Ninji_YSpeed ((uint8*)RomFixedPtr(0x3C348)) -#define kSpr030_ThrowingDryBones_DryBonesTileXDisp ((uint8*)RomFixedPtr(0x3C3B3)) -#define kSpr030_ThrowingDryBones_DryBonesGfxProp ((uint8*)RomFixedPtr(0x3C3BF)) -#define kSpr030_ThrowingDryBones_DryBonesTileYDisp ((uint8*)RomFixedPtr(0x3C3C5)) -#define kSpr030_ThrowingDryBones_DryBonesTiles ((uint8*)RomFixedPtr(0x3C3CE)) -#define kSpr030_ThrowingDryBones_DATA_03C3D7 ((uint8*)RomFixedPtr(0x3C3D7)) -#define kSpr0C6_Spotlight_DATA_03C48F ((uint8*)RomFixedPtr(0x3C48F)) -#define kSpr0C6_Spotlight_DATA_03C491 ((uint8*)RomFixedPtr(0x3C491)) -#define kSpr0C6_Spotlight_Tiles ((uint8*)RomFixedPtr(0x3C493)) -#define kSpr0C6_Spotlight_Prop ((uint8*)RomFixedPtr(0x3C49C)) -#define kSpr0C6_Spotlight_DATA_03C4D8 ((uint8*)RomFixedPtr(0x3C4D8)) -#define kSpr0C6_Spotlight_DATA_03C4DA ((uint8*)RomFixedPtr(0x3C4DA)) -#define kSpr07A_Fireworks_DATA_03C626 ((uint8*)RomFixedPtr(0x3C626)) -#define kSpr07A_Fireworks_DATA_03C67A ((uint8*)RomFixedPtr(0x3C67A)) -#define kSpr07A_Fireworks_DATA_03C6CE ((uint8*)RomFixedPtr(0x3C6CE)) -#define kSpr07A_Fireworks_DATA_03C722 ((uint8*)RomFixedPtr(0x3C722)) -#define kSpr07C_PrincessPeach_InitialXLo ((uint8*)RomFixedPtr(0x3C776)) -#define kSpr07A_Fireworks_FireworkSounds ((uint8*)RomFixedPtr(0x3C77A)) -#define kSpr07A_Fireworks_FireworkSounds_WhistleCh3 ((uint8*)RomFixedPtr(0x3C77E)) -#define kSpr07A_Fireworks_FireworkSounds_BangCh1 ((uint8*)RomFixedPtr(0x3C782)) -#define kSpr07A_Fireworks_FireworkSounds_BangCh3 ((uint8*)RomFixedPtr(0x3C786)) -#define kSpr07C_PrincessPeach_DATA_03C78A ((uint8*)RomFixedPtr(0x3C78A)) -#define kSpr07C_PrincessPeach_DATA_03C78E ((uint8*)RomFixedPtr(0x3C78E)) -#define kSpr07C_PrincessPeach_DATA_03C792 ((uint8*)RomFixedPtr(0x3C792)) -#define kSpr07A_Fireworks_YSpeed ((uint8*)RomFixedPtr(0x3C824)) -#define kSpr07A_Fireworks_DATA_03C83D ((uint8*)RomFixedPtr(0x3C83D)) -#define kSpr07A_Fireworks_DATA_03C841 ((uint8*)RomFixedPtr(0x3C841)) -#define kSpr07A_Fireworks_DATA_03C889 ((uint8*)RomFixedPtr(0x3C889)) -#define kSpr07A_Fireworks_DATA_03C8F1 ((uint8*)RomFixedPtr(0x3C8F1)) -#define kSpr07A_Fireworks_DATA_03C969 ((uint8*)RomFixedPtr(0x3C969)) -#define kSpr07A_Fireworks_DATA_03C9B9 ((uint8*)RomFixedPtr(0x3C9B9)) -#define kSpr07A_Fireworks_DATA_03C9E1 ((uint8*)RomFixedPtr(0x3C9E1)) -#define kSpawnFootball_xlo ((uint8*)RomFixedPtr(0x3CBAD)) -#define kSpawnFootball_xhi ((uint8*)RomFixedPtr(0x3CBAF)) -#define kSpawnFootball_InitialXSpeed ((uint8*)RomFixedPtr(0x3CBB1)) -#define kSpr029_KoopaKid_WendyLemmy_SpawningXPos ((uint8*)RomFixedPtr(0x3CC38)) -#define kSpr029_KoopaKid_WendyLemmy_LemmySpawningYPos ((uint8*)RomFixedPtr(0x3CC40)) -#define kSpr029_KoopaKid_WendyLemmy_DATA_03CC48 ((uint8*)RomFixedPtr(0x3CC48)) -#define kSpr029_KoopaKid_WendyLemmy_DATA_03CC51 ((uint8*)RomFixedPtr(0x3CC51)) -#define kSpr029_KoopaKid_WendyLemmy_SpawningPositionIndexes ((uint8*)RomFixedPtr(0x3CC5A)) -#define kSpr029_KoopaKid_WendyLemmy_DummyIDs ((uint8*)RomFixedPtr(0x3CCE0)) -#define kSpr029_KoopaKid_WendyLemmy_LemmyAndWendyAnimationFrames ((uint8*)RomFixedPtr(0x3CD37)) -#define kSpr029_KoopaKid_WendyLemmy_DummyHurtFrames ((uint8*)RomFixedPtr(0x3CE56)) -#define kSpr029_KoopaKid_WendyLemmy_LemmyXDisp ((uint8*)RomFixedPtr(0x3CEF2)) -#define kSpr029_KoopaKid_WendyLemmy_WendyXDisp ((uint8*)RomFixedPtr(0x3CF7C)) -#define kSpr029_KoopaKid_WendyLemmy_LemmyYDisp ((uint8*)RomFixedPtr(0x3D006)) -#define kSpr029_KoopaKid_WendyLemmy_WendyYDisp ((uint8*)RomFixedPtr(0x3D090)) -#define kSpr029_KoopaKid_WendyLemmy_LemmyTiles ((uint8*)RomFixedPtr(0x3D11A)) -#define kSpr029_KoopaKid_WendyLemmy_WendyTiles ((uint8*)RomFixedPtr(0x3D1A4)) -#define kSpr029_KoopaKid_WendyLemmy_LemmyProp ((uint8*)RomFixedPtr(0x3D22E)) -#define kSpr029_KoopaKid_WendyLemmy_WendyProp ((uint8*)RomFixedPtr(0x3D2B8)) -#define kSpr029_KoopaKid_WendyLemmy_LemmyTileSize ((uint8*)RomFixedPtr(0x3D342)) -#define kSpr029_KoopaKid_WendyLemmy_WendyTileSize ((uint8*)RomFixedPtr(0x3D3CC)) -#define kSpr029_KoopaKid_WendyLemmy_NumberOfTilesToDrawForLemmy ((uint8*)RomFixedPtr(0x3D456)) -#define kSpr029_KoopaKid_WendyLemmy_NumberOfTilesToDrawForWendy ((uint8*)RomFixedPtr(0x3D46D)) -#define kSpr07C_PrincessPeach_MessageData ((uint16*)RomFixedPtr(0x3D524)) -#define kSpr0A9_Reznor_DATA_03D700 ((uint8*)RomFixedPtr(0x3D700)) -#define kGameMode12_PrepareLevel_DATA_03D8EC ((uint16*)RomFixedPtr(0x3D8EC)) -#define kInitializeMode7TilemapsAndPalettes_TilemapData ((uint8*)RomFixedPtr(0x3D9DE)) -#define kInitializeMode7TilemapsAndPalettes_PalPtrLo ((uint8*)RomFixedPtr(0x3DD6E)) -#define kInitializeMode7TilemapsAndPalettes_PalPtrHi ((uint8*)RomFixedPtr(0x3DD73)) -#define kInitializeMode7TilemapsAndPalettes_GFXFile ((uint8*)RomFixedPtr(0x3DD78)) -#define kInitializeMode7TilemapsAndPalettes_DATA_03DE4E ((uint8*)RomFixedPtr(0x3DE4E)) -#define kUpdateMode7SpriteAnimations_DATA_03DEBB ((uint16*)RomFixedPtr(0x3DEBB)) -#define kUpdateMode7SpriteAnimations_DATA_03DEBF ((uint16*)RomFixedPtr(0x3DEBF)) -#define kUpdateMode7SpriteAnimations_DATA_03DEC7 ((uint16*)RomFixedPtr(0x3DEC7)) -#define kUpdateMode7SpriteAnimations_DATA_03DECF ((uint16*)RomFixedPtr(0x3DECF)) -#define kUpdateMode7SpriteAnimations_DATA_03DED7 ((uint16*)RomFixedPtr(0x3DED7)) -#define kSpr0A0_ActivateBowserBattle_BowserPaletteTableIndex ((uint8*)RomFixedPtr(0x3DFC4)) -#define kOwTileAnimations_WaterTileNumbers ((uint16*)RomFixedPtr(0x48000)) -#define kOwTileAnimations_TileNumbers ((uint16*)RomFixedPtr(0x48006)) -#define kGameMode0E_ShowOverworld_DATA_048211 ((uint16*)RomFixedPtr(0x48211)) -#define kGameMode0E_ShowOverworld_DATA_048221 ((uint16*)RomFixedPtr(0x48221)) -#define kGameMode0E_ShowOverworld_DATA_048231 ((uint8*)RomFixedPtr(0x48231)) -#define kHandleOverworldStarPipeWarp_DATA_048431 ((uint16*)RomFixedPtr(0x48431)) -#define kHandleOverworldStarPipeWarp_DATA_048467 ((uint16*)RomFixedPtr(0x48467)) -#define kHandleOverworldStarPipeWarp_DATA_04849D ((uint16*)RomFixedPtr(0x4849D)) -#define kHandleOverworldStarPipeWarp_DATA_0484D3 ((uint16*)RomFixedPtr(0x484D3)) -#define kDrawOverworldPlayer_PlayerTilesAndProp ((uint16*)RomFixedPtr(0x487CB)) -#define kDrawOverworldPlayer_StarWarpAnimationOffset ((uint8*)RomFixedPtr(0x4894B)) + +#define kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData ((uint8*)RomFixedPtr(0xC5E8)) + +extern const uint8 kSlopeDataTables_SlopeType[33]; + +extern const uint8 kLevelDataLayoutTables_EightBitLo_Horizontal[32]; +extern const uint8 kLevelDataLayoutTables_EightBitLo_Vertical[28]; +extern const uint8 kLevelDataLayoutTables_EightBitHi_Horizontal[32]; +extern const uint8 kLevelDataLayoutTables_EightBitHi_Vertical[28]; + +extern const uint16 kGlobalPalettes_BowserLightningFlash[11]; +extern const uint16 kGlobalPalettes_Bowser[56]; + +extern const uint8 kGameModeXX_FadeInOrOut_DATA_009F2F[2]; +extern const uint8 kGameModeXX_FadeInOrOut_DATA_009F31[2]; +extern const uint8 kGameModeXX_FadeInOrOut_DATA_009F33[2]; + +extern const uint16 kLevelDataLayoutTables_LoTablePtrs[2]; +extern const uint16 kLevelDataLayoutTables_HiTablePtrs[2]; + +extern const uint16 kGlobalPalettes_Sky[8]; +extern const uint8 kGameMode19_Cutscene_SkyColorSetting[8]; + +extern const uint8 kGenericSpriteToSpawnTable[19]; +extern const uint16 kSpr01F_MagiKoopa_MagiKoopaFadePalettes[64]; + #define kDrawOverworldPlayer_PlayerRidingYoshiTilesAndProp ((uint8*)RomFixedPtr(0x489DE)) -#define kDrawOverworldPlayer_PlayerAndYoshiXDisp ((uint8*)RomFixedPtr(0x48B5E)) -#define kDrawOverworldPlayer_PlayerAndYoshiYDisp ((uint8*)RomFixedPtr(0x48C1E)) -#define kDrawOverworldPlayer_YoshiPalette ((uint16*)RomFixedPtr(0x48CDE)) -#define kGameMode0C_LoadOverworld_DATA_048D74 ((uint16*)RomFixedPtr(0x48D74)) -#define kGameMode0C_LoadOverworld_DATA_048D8A ((uint8*)RomFixedPtr(0x48D8A)) -#define kGameMode0C_LoadOverworld_KoopaKidTeleportXPos ((uint16*)RomFixedPtr(0x48E49)) -#define kGameMode0C_LoadOverworld_KoopaKidTeleportYPos ((uint16*)RomFixedPtr(0x48E4F)) -#define kOverworldProcess02_HandleLevelBeaten_DATA_048F7F ((uint8*)RomFixedPtr(0x48F7F)) -#define kSharedOverworldPathTables_DATA_049058 ((uint16*)RomFixedPtr(0x49058)) -#define kSharedOverworldPathTables_DATA_049060 ((uint8*)RomFixedPtr(0x49060)) -#define kSharedOverworldPathTables_DATA_049064 ((uint16*)RomFixedPtr(0x49064)) -#define kSharedOverworldPathTables_NoAutoMoveLevels ((uint16*)RomFixedPtr(0x4906C)) -#define kSharedOverworldPathTables_HardCodedOWPaths_LevelNums ((uint8*)RomFixedPtr(0x49078)) -#define kSharedOverworldPathTables_DATA_049082 (*(uint16*)RomFixedPtr(0x49082)) -#define kSharedOverworldPathTables_DATA_049084 (*(uint16*)RomFixedPtr(0x49084)) -#define kSharedOverworldPathTables_HardCodedOWPaths_Layer1Tiles ((uint8*)RomFixedPtr(0x49086)) -#define kSharedOverworldPathTables_HardCodedOWPaths_MovementDirection ((uint8*)RomFixedPtr(0x490CA)) -#define kSharedOverworldPathTables_HardCodedOWPaths_Layer1AndMovementTableIndex ((uint8*)RomFixedPtr(0x4910E)) -#define kOverworldProcess04_PlayerIsMoving_OWPlayerPathSpeedOffset ((uint8*)RomFixedPtr(0x49414)) -#define kOverworldProcess04_PlayerIsMoving_MaxOverworlCameraPosition ((uint16*)RomFixedPtr(0x49416)) -#define kOverworldProcess04_PlayerIsMoving_MaxOverworlCameraPosition_RightAndBottom ((uint16*)RomFixedPtr(0x4941A)) -#define kBitTable_Bank04 ((uint16*)RomFixedPtr(0x4941E)) -#define kOverworldProcess04_PlayerIsMoving_DATA_049426 ((uint16*)RomFixedPtr(0x49426)) -#define kOverworldProcess04_PlayerIsMoving_DATA_049430 ((uint16*)RomFixedPtr(0x49430)) -#define kOverworldProcess04_PlayerIsMoving_DATA_04944E ((uint8*)RomFixedPtr(0x4944E)) + +extern const uint8 kOverworldLightningAndRandomCloudSpawning_DATA_04F700[8]; +extern const uint8 kOverworldLightningAndRandomCloudSpawning_DATA_04F6F8[8]; +#define kDrawOverworldPlayer_PlayerTilesAndProp ((uint16*)RomFixedPtr(0x487CB)) +#define kLevelNames ((uint16*)RomFixedPtr(0x4A0FC)) + #define kHandleOverworldPathExits_DATA_049964 ((OwExits*)RomFixedPtr(0x49964)) #define kHandleOverworldPathExits_DATA_0499AA ((OwExits*)RomFixedPtr(0x499AA)) -#define kHandleOverworldPathExits_DATA_0499F0 ((uint8*)RomFixedPtr(0x499F0)) -#define kHandleOverworldPathExits_DATA_049A0C ((uint16*)RomFixedPtr(0x49A0C)) -#define kUpdateLevelName_LevelNameStrings ((uint8*)RomFixedPtr(0x49AC5)) -#define kUpdateLevelName_DATA_049C91 ((uint16*)RomFixedPtr(0x49C91)) -#define kUpdateLevelName_DATA_049CCF ((uint16*)RomFixedPtr(0x49CCF)) -#define kUpdateLevelName_DATA_049CED ((uint16*)RomFixedPtr(0x49CED)) -#define kSharedOverworldPathTables_DATA_049EA7 ((uint16*)RomFixedPtr(0x49EA7)) -#define kSharedOverworldPathTables_DATA_049F49 ((uint16*)RomFixedPtr(0x49F49)) -#define kSharedOverworldPathTables_DATA_049FEB ((uint8*)RomFixedPtr(0x49FEB)) -#define kSharedOverworldPathTables_DATA_04A03C ((uint8*)RomFixedPtr(0x4A03C)) -#define kSharedOverworldPathTables_DATA_04A054 ((uint16*)RomFixedPtr(0x4A054)) -#define kSharedOverworldPathTables_DATA_04A084 ((uint16*)RomFixedPtr(0x4A084)) -#define kSharedOverworldPathTables_DATA_04A0E4 ((uint8*)RomFixedPtr(0x4A0E4)) -#define kLevelNames ((uint16*)RomFixedPtr(0x4A0FC)) -#define kLoadOverworldLayer1AndEvents_DATA_04D678 ((uint8*)RomFixedPtr(0x4D678)) -#define kChangingLayer1OverworldTiles_Layer1TileLocation ((uint16*)RomFixedPtr(0x4D85D)) -#define kOwEventProcess01_DestroyTileAnimation_DATA_04D93D ((uint16*)RomFixedPtr(0x4D93D)) -#define kChangingLayer1OverworldTiles_TilesThatChange ((uint8*)RomFixedPtr(0x4DA1D)) -#define kChangingLayer1OverworldTiles_TilesToBecome ((uint8*)RomFixedPtr(0x4DA33)) -#define kInitializeOverworldTilemaps_PARAMS_04DAB3 ((uint8*)RomFixedPtr(0x4DAB3)) -#define kSubmapSwitchProcess00_InitializeWindowHDMA_DATA_04DB08 ((uint16*)RomFixedPtr(0x4DB08)) -#define kSubmapSwitchProcess00_InitializeWindowHDMA_DATA_04DB0C ((uint8*)RomFixedPtr(0x4DB0C)) -#define kSubmapSwitchProcess00_InitializeWindowHDMA_DATA_04DB10 ((uint16*)RomFixedPtr(0x4DB10)) -#define kSubmapSwitchProcess00_InitializeWindowHDMA_DATA_04DB14 ((uint8*)RomFixedPtr(0x4DB14)) -#define kSubmapSwitchProcess07_EndSubmapSwitch_DATA_04DBC8 ((uint8*)RomFixedPtr(0x4DBC8)) -#define kLoadOverworldLayer1AndEvents_DATA_04DC02 ((uint8*)RomFixedPtr(0x4DC02)) -#define kLayer2EventData_TileEntries ((uint16*)RomFixedPtr(0x4DD8D)) -#define kLayer2EventData_Ptrs ((uint16*)RomFixedPtr(0x4E359)) -#define kBitTable_DATA_04E44B ((uint8*)RomFixedPtr(0x4E44B)) -#define kOwEventProcess01_DestroyTileAnimation_DATA_04E587 ((uint16*)RomFixedPtr(0x4E587)) -#define kCheckIfDestroyTileEventIsActive_DATA_04E5A7 ((uint8*)RomFixedPtr(0x4E5A7)) -#define kCheckIfDestroyTileEventIsActive_DATA_04E5AC ((uint8*)RomFixedPtr(0x4E5AC)) -#define kCheckIfDestroyTileEventIsActive_DATA_04E5B1 ((uint8*)RomFixedPtr(0x4E5B1)) -#define kCheckIfDestroyTileEventIsActive_DATA_04E5B6 ((uint16*)RomFixedPtr(0x4E5B6)) -#define kCheckIfDestroyTileEventIsActive_EventNums ((uint8*)RomFixedPtr(0x4E5D6)) -#define kOwEventProcess00_CheckIfEventShouldRun_DATA_04E5E6 ((uint16*)RomFixedPtr(0x4E5E6)) -#define kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles ((uint8*)RomFixedPtr(0x4E8E4)) -#define kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TileLayer ((uint8*)RomFixedPtr(0x4E910)) -#define kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TilemapLocation ((uint16*)RomFixedPtr(0x4E93C)) -#define kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TileNum ((uint16*)RomFixedPtr(0x4E994)) -#define kOwEventProcess01_DestroyTileAnimation_DATA_04EB56 ((uint8*)RomFixedPtr(0x4EB56)) -#define kOwEventProcess01_DestroyTileAnimation_DATA_04EB82 ((uint8*)RomFixedPtr(0x4EB82)) -#define kOwEventProcess01_DestroyTileAnimation_DATA_04EBAE ((uint8*)RomFixedPtr(0x4EBAE)) -#define kOwEventProcess01_DestroyTileAnimation_DATA_04EBDA ((uint8*)RomFixedPtr(0x4EBDA)) -#define kOwEventProcess01_DestroyTileAnimation_DATA_04EBE1 ((uint8*)RomFixedPtr(0x4EBE1)) -#define kDrawFlyingSwitchBlocks_XSpeed ((uint8*)RomFixedPtr(0x4F280)) -#define kDrawFlyingSwitchBlocks_YSpeed ((uint8*)RomFixedPtr(0x4F288)) -#define kOwPrompt02_ExpandPromptWindow_DATA_04F411 ((uint8*)RomFixedPtr(0x4F411)) -#define kOwPrompt02_ExpandPromptWindow_DATA_04F413 ((uint8*)RomFixedPtr(0x4F413)) -#define kLifeExchangeText_Mario ((uint8*)RomFixedPtr(0x4F4B2)) -#define kOwPrompt03_OverworldLifeExchanger_DATA_04F503 ((uint16*)RomFixedPtr(0x4F503)) -#define kOwPrompt03_OverworldLifeExchanger_DATA_04F507 ((uint16*)RomFixedPtr(0x4F507)) -#define kOwPrompt03_OverworldLifeExchanger_DATA_04F50B ((uint16*)RomFixedPtr(0x4F50B)) -#define kOwPrompt03_OverworldLifeExchanger_DATA_04F50F ((uint16*)RomFixedPtr(0x4F50F)) -#define kLoadOverworldSprites_SpriteSlotData ((SpriteSlotData*)RomFixedPtr(0x4F625)) -#define kLoadOverworldSprites_SubmapBooXPosOffset ((uint8*)RomFixedPtr(0x4F666)) -#define kLoadOverworldSprites_SubmapBooYPosOffset ((uint8*)RomFixedPtr(0x4F66C)) -#define kLoadOverworldSprites_UNK_04F672 ((uint8*)RomFixedPtr(0x4F672)) -#define kOverworldLightningAndRandomCloudSpawning_DATA_04F6D0 ((uint8*)RomFixedPtr(0x4F6D0)) -#define kOverworldLightningAndRandomCloudSpawning_DATA_04F6D8 ((uint16*)RomFixedPtr(0x4F6D8)) -#define kOverworldLightningAndRandomCloudSpawning_DATA_04F6E8 ((uint16*)RomFixedPtr(0x4F6E8)) -#define kOverworldLightningAndRandomCloudSpawning_DATA_04F6F8 ((uint8*)RomFixedPtr(0x4F6F8)) -#define kOverworldLightningAndRandomCloudSpawning_DATA_04F700 ((uint8*)RomFixedPtr(0x4F700)) #define kOverworldLightningAndRandomCloudSpawning ((uint8*)RomFixedPtr(0x4F708)) -#define kCheckIfXIsAllowedOnYSubmap_DisableSpriteOnXSubmapFlags ((uint8*)RomFixedPtr(0x4F829)) -#define kSetOverworldSpriteFrameIndex_DATA_04F833 ((uint8*)RomFixedPtr(0x4F833)) -#define kOverworldSpriteOAMIndexes ((uint8*)RomFixedPtr(0x4F843)) -#define kCheckIfXIsAllowedOnYSubmap_ANDTable ((uint8*)RomFixedPtr(0x4F875)) -#define kOWSpr01_Lakitu_DATA_04F8A6 ((uint8*)RomFixedPtr(0x4F8A6)) -#define kOWSpr01_Lakitu_DATA_04F8AE ((uint8*)RomFixedPtr(0x4F8AE)) -#define kOWSpr01_Lakitu_DATA_04F8B6 ((uint8*)RomFixedPtr(0x4F8B6)) -#define kOWSpr01_Lakitu_DATA_04F8BE ((uint8*)RomFixedPtr(0x4F8BE)) -#define kOWSpr01_Lakitu_Acceleration ((uint8*)RomFixedPtr(0x4F8C6)) -#define kOWSpr01_Lakitu_XYSpeedCap ((uint8*)RomFixedPtr(0x4F8C8)) -#define kOWSpr01_Lakitu_ZSpeedCap ((uint8*)RomFixedPtr(0x4F8CA)) -#define kOWSpr02_BlueBird_DATA_04F9A8 ((uint8*)RomFixedPtr(0x4F9A8)) -#define kOWSpr02_BlueBird_DATA_04F9AC ((uint8*)RomFixedPtr(0x4F9AC)) -#define kOWSpr02_BlueBird_DATA_04F9B0 ((uint8*)RomFixedPtr(0x4F9B0)) -#define kOWSpr02_BlueBird_DATA_04F9B4 ((uint8*)RomFixedPtr(0x4F9B4)) -#define kOWSpr03_CheepCheep_DATA_04FA2E ((uint8*)RomFixedPtr(0x4FA2E)) -#define kOWSpr03_CheepCheep_DATA_04FA31 ((uint8*)RomFixedPtr(0x4FA31)) -#define kOWSpr03_CheepCheep_DATA_04FA34 ((uint8*)RomFixedPtr(0x4FA34)) -#define kOWSpr03_CheepCheep_DATA_04FA37 ((uint8*)RomFixedPtr(0x4FA37)) -#define kOWSpr03_CheepCheep_DATA_04FA3A ((uint8*)RomFixedPtr(0x4FA3A)) -#define kOWSpr06_KoopaKid_DATA_04FB85 ((uint8*)RomFixedPtr(0x4FB85)) -#define kOWSpr06_KoopaKid_InitialXLo ((uint8*)RomFixedPtr(0x4FB88)) -#define kOWSpr06_KoopaKid_InitialXHi ((uint8*)RomFixedPtr(0x4FB8B)) -#define kOWSpr06_KoopaKid_InitialYLo ((uint8*)RomFixedPtr(0x4FB8E)) -#define kOWSpr06_KoopaKid_InitialYHi ((uint8*)RomFixedPtr(0x4FB91)) -#define kOWSpr06_KoopaKid_byte_4FB94 ((uint8*)RomFixedPtr(0x4FB94)) -#define kOWSpr06_KoopaKid_byte_4FB96 ((uint8*)RomFixedPtr(0x4FB96)) -#define kOWSpr07_Smoke_DATA_04FC1E ((uint16*)RomFixedPtr(0x4FC1E)) -#define kOWSpr07_Smoke_DATA_04FC22 ((uint16*)RomFixedPtr(0x4FC22)) -#define kOWSpr07_Smoke_DATA_04FC26 ((uint8*)RomFixedPtr(0x4FC26)) -#define kOWSpr07_Smoke_DATA_04FC36 ((uint8*)RomFixedPtr(0x4FC36)) -#define kOWSpr09_Bowser_DATA_04FD0A ((uint8*)RomFixedPtr(0x4FD0A)) -#define kOWSpr09_Bowser_DATA_04FD10 ((uint8*)RomFixedPtr(0x4FD10)) -#define kOWSpr09_Bowser_DATA_04FD1A ((uint8*)RomFixedPtr(0x4FD1A)) -#define kOWSpr09_Bowser_DATA_04FD22 ((uint8*)RomFixedPtr(0x4FD22)) -#define kDrawOverworldSpriteShadow_LeftTileXDisp ((uint8*)RomFixedPtr(0x4FDE0)) -#define kDrawOverworldSpriteShadow_RightTileXDisp ((uint8*)RomFixedPtr(0x4FDF0)) -#define kInitializeMap16Pointers_TilesetMap16Ptrs ((uint16*)RomFixedPtr(0x58000)) -#define kLoadLevelHeader_VerticalTable ((uint8*)RomFixedPtr(0x58417)) -#define kLoadLevelHeader_LevMainScrnTbl ((uint8*)RomFixedPtr(0x58437)) -#define kLoadLevelHeader_LevSubScrnTbl ((uint8*)RomFixedPtr(0x58457)) -#define kLoadLevelHeader_LevCGADSUBtable ((uint8*)RomFixedPtr(0x58477)) -#define kLoadLevelHeader_SpecialLevTable ((uint8*)RomFixedPtr(0x58497)) -#define kLoadLevelHeader_LevXYPPCCCTtbl ((uint8*)RomFixedPtr(0x584B7)) -#define kLoadLevelHeader_TimerTable ((uint8*)RomFixedPtr(0x584D7)) -#define kLoadLevelHeader_LevelMusicTable ((uint8*)RomFixedPtr(0x584DB)) -#define kCalculateRowOrColumnOfTilemapToUpdate_PipeMap16Ptrs ((uint16*)RomFixedPtr(0x58776)) + #define kInitializeLevelLayer3_Layer3ImagePtrs ((LongPtr*)RomFixedPtr(0x59000)) -#define kDisplayMessage_DATA_05A580 ((uint16*)RomFixedPtr(0x5A580)) -#define kDisplayMessage_DATA_05A590 ((uint8*)RomFixedPtr(0x5A590)) -#define kDisplayMessage_DATA_05A5A7 ((uint16*)RomFixedPtr(0x5A5A7)) + +extern const uint8 kBitTable_Bank05[8]; #define kDisplayMessage_DATA_05A5D9 ((uint8*)RomFixedPtr(0x5A5D9)) -#define kDisplayMessage_DATA_05B106 ((uint8*)RomFixedPtr(0x5B106)) -#define kDisplayMessage_DATA_05B108 ((uint8*)RomFixedPtr(0x5B108)) -#define kDisplayMessage_DATA_05B10A ((uint8*)RomFixedPtr(0x5B10A)) -#define kDisplayMessage_SwitchBlockTileAndProperties ((uint16*)RomFixedPtr(0x5B29B)) -#define kDisplayMessage_SwitchBlockXAndYDisp ((uint8*)RomFixedPtr(0x5B2DB)) -#define kBitTable_Bank05 ((uint8*)RomFixedPtr(0x5B35B)) -#define kFileSelectText_EraseFile ((uint8*)RomFixedPtr(0x5B6FE)) #define kLevelTileAnimations_DATA_05B93B ((LevelTileAnimations*)RomFixedPtr(0x5B93B)) -#define kLevelTileAnimations_DATA_05B96B ((uint8*)RomFixedPtr(0x5B96B)) -#define kLevelTileAnimations_DATA_05B97D ((uint8*)RomFixedPtr(0x5B97D)) -#define kLevelTileAnimations_DATA_05B98B ((uint8*)RomFixedPtr(0x5B98B)) -#define kLevelTileAnimations_FrameData ((uint16*)RomFixedPtr(0x5B999)) -#define kLevelTileAnimations_FrameData_Local1_Frame5 ((uint16*)RomFixedPtr(0x5BA39)) -#define kSpr0F3_RegularAutoScroll_DATA_05BFFD ((uint16*)RomFixedPtr(0x5BFFD)) -#define kSpr0F3_RegularAutoScroll_MaxXSpeed ((uint16*)RomFixedPtr(0x5C001)) -#define kScrollLayer3_TideYAcceleration ((uint8*)RomFixedPtr(0x5C406)) -#define kScrollLayer3_TideMaxYSpeed ((uint8*)RomFixedPtr(0x5C408)) -#define kScrollLayer3_TideMaxYPos ((uint8*)RomFixedPtr(0x5C40A)) -#define kLayer2SpecialScrolling0B_Layer2OnOffControlled_DATA_05C71B ((uint16*)RomFixedPtr(0x5C71B)) -#define kLayer2SpecialScrolling0B_Layer2OnOffControlled_DATA_05C71F ((uint16*)RomFixedPtr(0x5C71F)) -#define kLayer2SpecialScrolling0B_Layer2OnOffControlled_DATA_05C723 ((uint16*)RomFixedPtr(0x5C723)) -#define kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C7F0 ((uint16*)RomFixedPtr(0x5C7F0)) -#define kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C7FC ((uint16*)RomFixedPtr(0x5C7FC)) -#define kSpr0F5_Layer2ScrollWhenTouched_DATA_05C808 ((uint8*)RomFixedPtr(0x5C808)) -#define kSpr0F5_Layer2ScrollWhenTouched_DATA_05C80B ((uint8*)RomFixedPtr(0x5C80B)) -#define kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C80E (*(uint16*)RomFixedPtr(0x5C80E)) -#define kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C810 ((uint16*)RomFixedPtr(0x5C810)) -#define kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C814 ((uint16*)RomFixedPtr(0x5C814)) -#define kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C818 ((uint16*)RomFixedPtr(0x5C818)) -#define kLayer2SpecialScrolling02_Layer2Smash_DATA_05C880 ((uint16*)RomFixedPtr(0x5C880)) -#define kLayer2SpecialScrolling02_Layer2Smash_DATA_05C8A4 ((uint16*)RomFixedPtr(0x5C8A4)) -#define kLayer2SpecialScrolling02_Layer2Smash_DATA_05C8C8 ((uint16*)RomFixedPtr(0x5C8C8)) -#define kLayer2SpecialScrolling02_Layer2Smash_DATA_05C8FE ((uint16*)RomFixedPtr(0x5C8FE)) -#define kLayer2SpecialScrolling02_Layer2Smash_DATA_05C934 ((uint8*)RomFixedPtr(0x5C934)) -#define kSpr0E9_Layer2Smash_DATA_05C94F ((uint8*)RomFixedPtr(0x5C94F)) -#define kSpr0E9_Layer2Smash_DATA_05C952 ((uint8*)RomFixedPtr(0x5C952)) -#define kSpr0E7_SpecialAutoScroll_L1AndL2ScrollID ((uint8*)RomFixedPtr(0x5C9D1)) -#define kSpr0E7_SpecialAutoScroll_L1AndL2ScrollTypeIndex ((uint8*)RomFixedPtr(0x5C9DB)) -#define kMostlyUnusedScrollSpriteRoutine_UNK_05C9E5 ((uint16*)RomFixedPtr(0x5C9E5)) -#define kSpr0EB_UnusedSprite_DATA_05CA08 ((uint16*)RomFixedPtr(0x5CA08)) -#define kSpr0EB_UnusedSprite_DATA_05CA0C ((uint16*)RomFixedPtr(0x5CA0C)) -#define kSpr0EB_UnusedSprite_DATA_05CA10 ((uint16*)RomFixedPtr(0x5CA10)) -#define kSpr0F1_UnusedSprite_DATA_05CA16 ((uint16*)RomFixedPtr(0x5CA16)) -#define kSpr0F1_UnusedSprite_DATA_05CA1E ((uint16*)RomFixedPtr(0x5CA1E)) -#define kSpr0F1_UnusedSprite_DATA_05CA26 ((uint16*)RomFixedPtr(0x5CA26)) -#define kSpr0EF_Layer2ScrollSOrL_DATA_05CA3E ((uint16*)RomFixedPtr(0x5CA3E)) -#define kSpr0EF_Layer2ScrollSOrL_DATA_05CA42 ((uint16*)RomFixedPtr(0x5CA42)) -#define kSpr0EF_Layer2ScrollSOrL_DATA_05CA46 (*(uint16*)RomFixedPtr(0x5CA46)) -#define kSpr0EA_Layer2Scroll_DATA_05CA48 ((uint16*)RomFixedPtr(0x5CA48)) -#define kSpr0EA_Layer2Scroll_DATA_05CA52 ((uint16*)RomFixedPtr(0x5CA52)) -#define kSpr0EA_Layer2Scroll_DirectionToStartMoving ((uint16*)RomFixedPtr(0x5CA5C)) -#define kSpr0E7_SpecialAutoScroll_DATA_05CA61 ((uint8*)RomFixedPtr(0x5CA61)) -#define kSpr0E7_SpecialAutoScroll_DATA_05CA68 ((uint8*)RomFixedPtr(0x5CA68)) -#define kLayer1SpecialScrolling01_VariableScroll_DATA_05CA6F ((uint8*)RomFixedPtr(0x5CA6F)) -#define kLayer1SpecialScrolling01_VariableScroll_DATA_05CABF ((uint8*)RomFixedPtr(0x5CABF)) -#define kLayer1SpecialScrolling01_VariableScroll_DATA_05CB0F ((uint8*)RomFixedPtr(0x5CB0F)) -#define kLayer1SpecialScrolling01_VariableScroll_DATA_05CB5F ((uint8*)RomFixedPtr(0x5CB5F)) -#define kUnusedScrollSpriteRoutine_DATA_05CB7B ((uint16*)RomFixedPtr(0x5CB7B)) -#define kLayer2SpecialScrolling04_Unused_DATA_05CB9B ((uint16*)RomFixedPtr(0x5CB9B)) -#define kLayer2SpecialScrolling0A_Unused_DATA_05CBA3 ((uint16*)RomFixedPtr(0x5CBA3)) -#define kScrollLayer3_DATA_05CBBB ((uint16*)RomFixedPtr(0x5CBBB)) -#define kSharedScrollSpriteTables_DATA_05CBC3 ((uint16*)RomFixedPtr(0x5CBC3)) -#define kSharedScrollSpriteTables_UNK_05CBC7 ((uint8*)RomFixedPtr(0x5CBC7)) -#define kLayer2SpecialScrolling04_Unused_DATA_05CBE3 ((uint8*)RomFixedPtr(0x5CBE3)) -#define kLayer2SpecialScrolling0A_Unused_DATA_05CBE5 ((uint8*)RomFixedPtr(0x5CBE5)) -#define kScrollLayer3_DATA_05CBEB ((uint8*)RomFixedPtr(0x5CBEB)) -#define kSharedScrollSpriteTables_DATA_05CBED ((uint8*)RomFixedPtr(0x5CBED)) -#define kSharedScrollSpriteTables_DATA_05CBF1 ((uint8*)RomFixedPtr(0x5CBF1)) -#define kSharedScrollSpriteTables_DATA_05CBF5 ((uint8*)RomFixedPtr(0x5CBF5)) -#define kCourseClearText_Mario ((uint8*)RomFixedPtr(0x5CC16)) -#define kCourseClearText_Luigi ((uint8*)RomFixedPtr(0x5CC61)) -#define kGotBonusStarsText_Bonus ((uint8*)RomFixedPtr(0x5CD3F)) -#define kDisplayCourseClearTextBonusStars_DATA_05CD62 ((uint8*)RomFixedPtr(0x5CD62)) -#define kAdjustTimeBonusDisplay_DATA_05CDE9 ((uint16*)RomFixedPtr(0x5CDE9)) -#define kCalculateTimeBonusDigits_DATA_05CE3A ((uint16*)RomFixedPtr(0x5CE3A)) -#define kCalculateTimeBonusDigits_DATA_05CE42 ((uint8*)RomFixedPtr(0x5CE42)) -#define kNoBonusStarsText_Stars ((uint16*)RomFixedPtr(0x5CEA3)) -#define kGiveTimeBonusAndBonusStars_DATA_05CEC2 ((uint8*)RomFixedPtr(0x5CEC2)) -#define kGiveTimeBonusAndBonusStars_DATA_05CEC6 ((uint8*)RomFixedPtr(0x5CEC6)) #define kSpecifySublevelToLoad_DATA_05D608 ((uint8*)RomFixedPtr(0x5D608)) -#define kSpecifySublevelToLoad_DATA_05D708 ((uint8*)RomFixedPtr(0x5D708)) -#define kSpecifySublevelToLoad_DATA_05D70C ((uint8*)RomFixedPtr(0x5D70C)) -#define kSpecifySublevelToLoad_L2VertScrollSettings ((uint8*)RomFixedPtr(0x5D710)) -#define kSpecifySublevelToLoad_L2HorzScrollSettings ((uint8*)RomFixedPtr(0x5D720)) -#define kSpecifySublevelToLoad_DATA_05D730 ((uint8*)RomFixedPtr(0x5D730)) -#define kSpecifySublevelToLoad_DATA_05D740 ((uint8*)RomFixedPtr(0x5D740)) -#define kSpecifySublevelToLoad_DATA_05D750 ((uint8*)RomFixedPtr(0x5D750)) -#define kSpecifySublevelToLoad_DATA_05D758 ((uint8*)RomFixedPtr(0x5D758)) -#define kSpecifySublevelToLoad_LevelEntranceTileset ((uint8*)RomFixedPtr(0x5D760)) #define kSpecifySublevelToLoad_LevelEntranceLayer1 ((LongPtr*)RomFixedPtr(0x5D766)) -#define kSpecifySublevelToLoad_LevelEntranceLayer2 (*(LongPtr*)RomFixedPtr(0x5D778)) -#define kSpecifySublevelToLoad_LevelEntranceLayer3 ((uint8*)RomFixedPtr(0x5D78A)) -#define kSpecifySublevelToLoad_LevelEntranceYPos ((uint8*)RomFixedPtr(0x5D790)) -#define kSpecifySublevelToLoad_Layer1Ptrs ((uint16*)RomFixedPtr(0x5DB08)) -#define kSpecifySublevelToLoad_SpritePtrs ((uint16*)RomFixedPtr(0x5DB1A)) -#define kSpecifySublevelToLoad_Layer2Ptrs ((uint16*)RomFixedPtr(0x5DB2C)) -#define kSpecifySublevelToLoad_BonusLevelSublevelsLo ((uint8*)RomFixedPtr(0x5DBA9)) -#define kLoadOverworldLifeCounter_DATA_05DBC9 ((uint8*)RomFixedPtr(0x5DBC9)) +#define kSpecifySublevelToLoad_LevelEntranceLayer2 ((LongPtr*)RomFixedPtr(0x5D778)) + #define kSpecifySublevelToLoad_Layer1DataPtrs ((LongPtr*)RomFixedPtr(0x5E000)) #define kSpecifySublevelToLoad_Layer2DataPtrs ((LongPtr*)RomFixedPtr(0x5E600)) #define kSpecifySublevelToLoad_SpriteDataPtrs ((uint16*)RomFixedPtr(0x5EC00)) @@ -1475,243 +65,11 @@ #define kSpecifySublevelToLoad_DATA_05FA00 ((uint8*)RomFixedPtr(0x5FA00)) #define kSpecifySublevelToLoad_DATA_05FC00 ((uint8*)RomFixedPtr(0x5FC00)) #define kSpecifySublevelToLoad_DATA_05FE00 ((uint8*)RomFixedPtr(0x5FE00)) -#define kProcessNormalSpritesSpriteOAMIndexes ((uint8*)RomFixedPtr(0x7F000)) -#define kProcessNormalSprites_DATA_07F0B4 ((uint8*)RomFixedPtr(0x7F0B4)) -#define kSpr07B_GoalTape_DATA_07F0C8 ((uint8*)RomFixedPtr(0x7F0C8)) -#define kSpr07B_GoalTape_DATA_07F134 ((uint8*)RomFixedPtr(0x7F134)) -#define kSpr07B_GoalTape_DATA_07F1A0 ((uint8*)RomFixedPtr(0x7F1A0)) -#define kSpr07B_GoalTape_BonusStarsEarned ((uint8*)RomFixedPtr(0x7F1AA)) -#define kSpr07B_GoalTape_DATA_07F24E ((uint8*)RomFixedPtr(0x7F24E)) -#define kInitializeNormalSpriteRAMTables_Sprite1656Vals ((uint8*)RomFixedPtr(0x7F26C)) -#define kInitializeNormalSpriteRAMTables_Sprite1662Vals ((uint8*)RomFixedPtr(0x7F335)) -#define kInitializeNormalSpriteRAMTables_Sprite166EVals ((uint8*)RomFixedPtr(0x7F3FE)) -#define kInitializeNormalSpriteRAMTables_Sprite167AVals ((uint8*)RomFixedPtr(0x7F4C7)) -#define kInitializeNormalSpriteRAMTables_Sprite1686Vals ((uint8*)RomFixedPtr(0x7F590)) -#define kInitializeNormalSpriteRAMTables_Sprite190FVals ((uint8*)RomFixedPtr(0x7F659)) + +extern const uint8 kInitializeNormalSpriteRAMTables_Sprite190FVals[201]; + #define kCircleCoordinates ((uint16*)RomFixedPtr(0x7F7DB)) -#define kLineGuideSpeedTable_PtrsLo ((uint8*)RomFixedPtr(0x7FBF3)) -#define kLineGuideSpeedTable_PtrsHi ((uint8*)RomFixedPtr(0x7FC13)) -#define kSpawnSpinJumpStars_InitialXSpeed ((uint8*)RomFixedPtr(0x7FC33)) -#define kSpawnSpinJumpStars_InitialYSpeed ((uint8*)RomFixedPtr(0x7FC37)) #define kOverworldLayer2EventTilemap_Tiles ((uint8*)RomFixedPtr(0xC8000)) -#define kBufferCreditsBackgrounds_Layer2Pointers ((uint16*)RomFixedPtr(0xC93C1)) -#define kBufferCreditsBackgrounds_TilePageModifier ((uint16*)RomFixedPtr(0xC93CF)) -#define kUpdateCreditsBackground_PARAMS_0C9559 ((uint8*)RomFixedPtr(0xC9559)) -#define kUpdateCreditsBackground_PARAMS_0C9560 ((uint8*)RomFixedPtr(0xC9560)) #define kGameMode1B_EndingCinema_Tilemaps ((uint8*)RomFixedPtr(0xC95C7)) #define kGameMode1B_EndingCinema_RowPointers ((uint16*)RomFixedPtr(0xC9D18)) -#define kGameMode1B_EndingCinema_DATA_0C9EAC ((uint8*)RomFixedPtr(0xC9EAC)) -#define kGameMode1B_EndingCinema_BackgroundChangeHeight ((uint16*)RomFixedPtr(0xC9F5C)) -#define kGameMode1B_EndingCinema_PeachOnYoshiOffset ((uint8*)RomFixedPtr(0xC9FE7)) -#define kInitializeCreditsEggPositions_InitialXPos ((uint8*)RomFixedPtr(0xCA043)) -#define kInitializeCreditsEggPositions_InitialYPos ((uint8*)RomFixedPtr(0xCA04A)) -#define kGameMode1D_LoadYoshisHouse_Tiles ((uint8*)RomFixedPtr(0xCA08F)) -#define kGameMode1D_LoadYoshisHouse_Prop ((uint8*)RomFixedPtr(0xCA0B9)) -#define kDrawEndingThankYou_Tiles ((uint8*)RomFixedPtr(0xCA136)) -#define kProcessCheeringYoshis_DATA_0CA30D ((uint8*)RomFixedPtr(0xCA30D)) -#define kProcessCheeringYoshis_DATA_0CA311 ((uint8*)RomFixedPtr(0xCA311)) -#define kGameMode1D_LoadYoshisHouse_EggInitialXPos ((uint8*)RomFixedPtr(0xCA3B4)) -#define kGameMode1D_LoadYoshisHouse_EggInitialYPos ((uint8*)RomFixedPtr(0xCA3BB)) -#define kGameMode1D_LoadYoshisHouse_EggYSpeed ((uint8*)RomFixedPtr(0xCA3C2)) -#define kYoshisWatchInExcitementDuringEnding_DATA_0CA439 ((uint8*)RomFixedPtr(0xCA439)) -#define kHatchYoshiEggsDuringEnding_DATA_0CA524 ((uint8*)RomFixedPtr(0xCA524)) -#define kHatchYoshiEggsDuringEnding_DATA_0CA52B ((uint8*)RomFixedPtr(0xCA52B)) -#define kHatchYoshiEggsDuringEnding_DATA_0CA5D2 ((uint8*)RomFixedPtr(0xCA5D2)) -#define kHatchYoshiEggsDuringEnding_DATA_0CA5D6 ((uint8*)RomFixedPtr(0xCA5D6)) -#define kHatchYoshiEggsDuringEnding_DATA_0CA5DA ((uint8*)RomFixedPtr(0xCA5DA)) -#define kDrawCreditsPeachRedAndYellowYoshi_DATA_0CA7B9 ((uint16*)RomFixedPtr(0xCA7B9)) -#define kDrawCreditsPeachRedAndYellowYoshi_DATA_0CA7ED ((uint16*)RomFixedPtr(0xCA7ED)) -#define kDrawEndingBabyYoshis_BabyYoshiProp ((uint8*)RomFixedPtr(0xCA8D8)) -#define kDrawLeaningEndingYoshis_DATA_0CA93A ((uint16*)RomFixedPtr(0xCA93A)) -#define kDrawLeaningEndingYoshis_DATA_0CA952 ((uint16*)RomFixedPtr(0xCA952)) -#define kDrawLeaningEndingYoshis_DATA_0CA96A ((uint16*)RomFixedPtr(0xCA96A)) -#define kDrawLeaningEndingYoshis_DATA_0CA982 ((uint16*)RomFixedPtr(0xCA982)) -#define kDrawLeaningEndingYoshis_DATA_0CA99A ((uint8*)RomFixedPtr(0xCA99A)) -#define kDrawCameraFacingEndingYoshis_Tiles ((uint8*)RomFixedPtr(0xCAA0B)) -#define kDrawCameraFacingEndingYoshis_Prop ((uint8*)RomFixedPtr(0xCAA11)) -#define kDrawingTheEndMarioLuigiAndPeach_TileData ((uint8*)RomFixedPtr(0xCAA53)) -#define kCreditsFadeOut_DATA_0CAB1B ((uint8*)RomFixedPtr(0xCAB1B)) -#define kCreditsFadeOut_DATA_0CAB1D ((uint8*)RomFixedPtr(0xCAB1D)) -#define kCreditsFadeOut_BGPaletteIndex ((uint8*)RomFixedPtr(0xCAB9C)) -#define kCreditsFadeOut_SkyColorSetting ((uint8*)RomFixedPtr(0xCABA4)) -#define kCreditsFadeOut_BGPaletteSetting ((uint8*)RomFixedPtr(0xCABAB)) -#define kGetLayer1And2PointersForEnemyRollcall_Layer1Ptrs ((uint16*)RomFixedPtr(0xCAD58)) -#define kGetLayer1And2PointersForEnemyRollcall_Layer2Ptrs ((uint16*)RomFixedPtr(0xCAD72)) -#define kInitializeEnemyRollcallLayerPositions_DATA_0CADB5 ((uint8*)RomFixedPtr(0xCADB5)) -#define kInitializeEnemyRollcallLayerPositions_InitialLayer2YPos ((uint16*)RomFixedPtr(0xCADC2)) -#define kInitializeEnemyRollcallLayerPositions_SpecialWorldEnemyNamePtrs ((uint16*)RomFixedPtr(0xCADDC)) -#define kGameMode25_ShowEnemyRollcallScreen_TileData ((uint8*)RomFixedPtr(0xCAF11)) -#define kGameMode25_ShowEnemyRollcallScreen_EnemyRollcallSpriteDataPtrs ((uint16*)RomFixedPtr(0xCB5A2)) -#define kDrawThankYouSpeechBubble_TileData ((uint8*)RomFixedPtr(0xCCA83)) -#define kDrawCastleDestructionCastleDoor_Tiles ((uint8*)RomFixedPtr(0xCCB7C)) -#define kHandleTNTExplosion_DATA_0CCC49 ((uint8*)RomFixedPtr(0xCCC49)) -#define kHandleTNTExplosion_DATA_0CCC4D ((uint16*)RomFixedPtr(0xCCC4D)) -#define kHandleTNTExplosion_DATA_0CCC9F ((uint8*)RomFixedPtr(0xCCC9F)) -#define kHandleTNTExplosion_DATA_0CCCB1 ((uint8*)RomFixedPtr(0xCCCB1)) -#define kHandleCastleLiftoff_CastleDustTiles ((uint8*)RomFixedPtr(0xCCE40)) -#define kHandleCastleLiftoff_RocketFlameTiles ((uint8*)RomFixedPtr(0xCCEA3)) -#define kHandleCastleLiftoff_RocketFlameProp ((uint8*)RomFixedPtr(0xCCEA7)) -#define kHandleFarawayCastleRocket_DATA_0CCED4 ((uint8*)RomFixedPtr(0xCCED4)) -#define kHandleFarawayCastleRocket_DATA_0CCEDB ((uint8*)RomFixedPtr(0xCCEDB)) -#define kHandleFarawayCastleRocket_Tiles ((uint8*)RomFixedPtr(0xCCF3B)) -#define kHandleFarawayCastleRocket_Prop ((uint8*)RomFixedPtr(0xCCF42)) -#define kHandleDudTNTExplosion_TilesAndProp ((uint8*)RomFixedPtr(0xCCF9F)) -#define kDrawCutsceneContactEffect_Tiles ((uint8*)RomFixedPtr(0xCD061)) -#define kDrawCutsceneContactEffect_Prop ((uint8*)RomFixedPtr(0xCD065)) -#define kHandleCastleCrumblingDown_RubbleTiles ((uint8*)RomFixedPtr(0xCD1A7)) -#define kProcessMop_DATA_0CD1F0 ((uint8*)RomFixedPtr(0xCD1F0)) -#define kProcessMop_DATA_0CD1FD ((uint16*)RomFixedPtr(0xCD1FD)) -#define kSpawnHammerDebris_YSpeed ((uint8*)RomFixedPtr(0xCD386)) -#define kSpawnHammerDebris_XSpeed ((uint8*)RomFixedPtr(0xCD396)) -#define kProcessHammerDebris_DATA_0CD423 ((uint8*)RomFixedPtr(0xCD423)) -#define kDrawQuestionMark_YDisp ((uint8*)RomFixedPtr(0xCD464)) -#define kDrawQuestionMark_XDisp ((uint8*)RomFixedPtr(0xCD484)) -#define kDrawPlayerCough_Tiles ((uint8*)RomFixedPtr(0xCD4F4)) -#define kDrawWoodHammer_HammerSwingPlayerPoses ((uint8*)RomFixedPtr(0xCD5D9)) -#define kDrawWoodHammer_Tiles ((uint8*)RomFixedPtr(0xCD5E9)) -#define kDrawWoodHammer_Prop ((uint8*)RomFixedPtr(0xCD5FC)) -#define kDrawWoodHammer_XDisp ((uint8*)RomFixedPtr(0xCD60F)) -#define kDrawWoodHammer_YDisp ((uint8*)RomFixedPtr(0xCD635)) -#define kProcessMop_DATA_0CD6C4 ((uint8*)RomFixedPtr(0xCD6C4)) -#define kProcessMop_DATA_0CD6CA ((uint8*)RomFixedPtr(0xCD6CA)) -#define kProcessMop_DATA_0CD6D0 ((uint8*)RomFixedPtr(0xCD6D0)) -#define kProcessMop_DATA_0CD6D3 ((uint8*)RomFixedPtr(0xCD6D3)) -#define kProcessMop_Tiles ((uint8*)RomFixedPtr(0xCD6D6)) -#define kProcessMop_DATA_0CD6D9 ((uint8*)RomFixedPtr(0xCD6D9)) -#define kProcessMop_DATA_0CD6E0 ((uint8*)RomFixedPtr(0xCD6E0)) -#define kProcessMop_DATA_0CD6E5 ((uint8*)RomFixedPtr(0xCD6E5)) -#define kCarryEggAwayFromCastle_DATA_0CD7EB ((uint8*)RomFixedPtr(0xCD7EB)) -#define kCarryEggAwayFromCastle_DATA_0CD7ED ((uint8*)RomFixedPtr(0xCD7ED)) -#define kCarryEggAwayFromCastle_YDisp ((uint8*)RomFixedPtr(0xCD7F3)) -#define kExtObjXX_Generic1TileObject_Tiles ((uint8*)RomFixedPtr(0xDA548)) -#define kExtObj42_TopLeftSlope_LeftTiles ((uint8*)RomFixedPtr(0xDA652)) -#define kExtObj42_TopLeftSlope_RightTiles ((uint8*)RomFixedPtr(0xDA654)) -#define kExtObjXX_PurpleTriangle_TriangleTiles ((uint8*)RomFixedPtr(0xDA671)) -#define kExtObj47_Door_TopTiles ((uint8*)RomFixedPtr(0xDA6CD)) -#define kExtObj47_Door_BottomTiles ((uint8*)RomFixedPtr(0xDA6CF)) -#define kExtObjXX_LargeBush_BigBushTiles ((uint8*)RomFixedPtr(0xDA6EE)) -#define kExtObjXX_LargeBush_SmallBushTiles ((uint8*)RomFixedPtr(0xDA748)) -#define kExtObj4A_ClimbingNetDoor_Tiles ((uint8*)RomFixedPtr(0xDA7B1)) -#define kExtObj86_GoalSign_Tiles ((uint8*)RomFixedPtr(0xDA7E3)) -#define kExtObj91_VerticalLevelSteepLeftSlope_TopTiles ((uint8*)RomFixedPtr(0xDA809)) -#define kExtObj91_VerticalLevelSteepLeftSlope_BottomTiles ((uint8*)RomFixedPtr(0xDA80B)) -#define kExtObj93_VerticalLevelNormalLeftSlope_TopLeftTiles ((uint8*)RomFixedPtr(0xDA83E)) -#define kExtObj93_VerticalLevelNormalLeftSlope_TopRightTiles ((uint8*)RomFixedPtr(0xDA840)) -#define kExtObj93_VerticalLevelNormalLeftSlope_BottomLeftTiles ((uint8*)RomFixedPtr(0xDA842)) -#define kExtObj93_VerticalLevelNormalLeftSlope_BottomRightTiles ((uint8*)RomFixedPtr(0xDA844)) -#define kExtObj95_VerticalLevelVerySteepLeftSlope_TopTiles ((uint8*)RomFixedPtr(0xDA877)) -#define kExtObj95_VerticalLevelVerySteepLeftSlope_MiddleTiles ((uint8*)RomFixedPtr(0xDA879)) -#define kExtObj95_VerticalLevelVerySteepLeftSlope_BottomTiles ((uint8*)RomFixedPtr(0xDA87B)) -#define kBitTable_Bank0D ((uint8*)RomFixedPtr(0xDA8A6)) -#define kBank0DItemMemoryIndexes_Lo ((uint8*)RomFixedPtr(0xDA8AE)) -#define kBank0DItemMemoryIndexes_Hi ((uint8*)RomFixedPtr(0xDA8B1)) -#define kStdObjXX_Generic1RepeatedTileObject_Tiles ((uint8*)RomFixedPtr(0xDA8B4)) -#define kStdObj0F_VerticalPipes_TopLeftPipeEndTiles ((uint8*)RomFixedPtr(0xDAA12)) -#define kStdObj0F_VerticalPipes_TopRightPipeEndTiles ((uint8*)RomFixedPtr(0xDAA17)) -#define kStdObj0F_VerticalPipes_BottomLeftPipeEndTiles ((uint8*)RomFixedPtr(0xDAA1C)) -#define kStdObj0F_VerticalPipes_BottomRightPipeEndTiles ((uint8*)RomFixedPtr(0xDAA21)) -#define kStdObj10_HorizontalPipes_EndTiles ((uint8*)RomFixedPtr(0xDAAA4)) -#define kStdObj10_HorizontalPipes_ShaftTiles ((uint8*)RomFixedPtr(0xDAAAC)) -#define kFillInSlopeTileAir_DATA_0DABF7 ((uint8*)RomFixedPtr(0xDABF7)) -#define kFillInSlopeTileAir_DATA_0DABFA ((uint8*)RomFixedPtr(0xDABFA)) -#define kStdObj13_GroundEdgesAndVine_TopTiles ((uint8*)RomFixedPtr(0xDB039)) -#define kStdObj13_GroundEdgesAndVine_MiddleTiles1 ((uint8*)RomFixedPtr(0xDB048)) -#define kStdObj13_GroundEdgesAndVine_MiddleTiles2 ((uint8*)RomFixedPtr(0xDB057)) -#define kStdObj13_GroundEdgesAndVine_BottomTiles ((uint8*)RomFixedPtr(0xDB066)) -#define kStdObj13_GroundEdgesAndVine_DATA_0DB0F0 ((uint8*)RomFixedPtr(0xDB0F0)) -#define kStdObj13_GroundEdgesAndVine_DATA_0DB102 ((uint8*)RomFixedPtr(0xDB102)) -#define kStdObj13_GroundEdgesAndVine_DATA_0DB15C ((uint8*)RomFixedPtr(0xDB15C)) -#define kStdObj13_GroundEdgesAndVine_DATA_0DB17A ((uint8*)RomFixedPtr(0xDB17A)) -#define kStdObj15_MidwayAndGoalPoint_TopMidwayTiles ((uint8*)RomFixedPtr(0xDB212)) -#define kStdObj15_MidwayAndGoalPoint_MiddleMidwayTiles ((uint8*)RomFixedPtr(0xDB215)) -#define kStdObj15_MidwayAndGoalPoint_BottomMidwayTiles ((uint8*)RomFixedPtr(0xDB218)) -#define kStdObj15_MidwayAndGoalPoint_TopGoalTiles ((uint8*)RomFixedPtr(0xDB21B)) -#define kStdObj15_MidwayAndGoalPoint_MiddleGoalTiles ((uint8*)RomFixedPtr(0xDB21E)) -#define kStdObj15_MidwayAndGoalPoint_BottomGoalTiles ((uint8*)RomFixedPtr(0xDB221)) -#define kStdObj17_RopeAndCloudLine_Tiles ((uint8*)RomFixedPtr(0xDB3BB)) -#define kStdObj18_WaterWithAnimatedSurface_TopTiles ((uint8*)RomFixedPtr(0xDB3DB)) -#define kStdObj18_WaterWithAnimatedSurface_BottomTiles ((uint8*)RomFixedPtr(0xDB3DF)) -#define kStdObj1C_DonutBridge_Tiles ((uint8*)RomFixedPtr(0xDB42B)) -#define kStdObj1E_ClimbingNetWithSideEdge_SideTiles ((uint8*)RomFixedPtr(0xDB49C)) -#define kStdObj1E_ClimbingNetWithSideEdge_TopCornerTiles ((uint8*)RomFixedPtr(0xDB4D5)) -#define kStdObj1E_ClimbingNetWithSideEdge_TopInnerCornerTiles ((uint8*)RomFixedPtr(0xDB4D7)) -#define kStdObj1E_ClimbingNetWithSideEdge_BottomCornerTiles ((uint8*)RomFixedPtr(0xDB4FA)) -#define kStdObj1E_ClimbingNetWithSideEdge_BottomInnerCornerTiles ((uint8*)RomFixedPtr(0xDB4FC)) -#define kExtObj68_CloudFringeBottomAndRightEdge_Tiles ((uint8*)RomFixedPtr(0xDB569)) -#define kExtObj8E_YellowSwitchBlock_ActiveTiles ((uint8*)RomFixedPtr(0xDB587)) -#define kExtObj8E_YellowSwitchBlock_InactiveTiles ((uint8*)RomFixedPtr(0xDB589)) -#define kGrassObj3F_SmallBushes_LeftTiles ((uint8*)RomFixedPtr(0xDB5A8)) -#define kGrassObj3F_SmallBushes_MiddleTiles ((uint8*)RomFixedPtr(0xDB5AD)) -#define kGrassObj3F_SmallBushes_RightTiles ((uint8*)RomFixedPtr(0xDB5B2)) -#define kGrassObj3C_ArchLedge_Tiles ((uint8*)RomFixedPtr(0xDB5E8)) -#define kGrassObj3D_TopCloudFridge_Tiles ((uint8*)RomFixedPtr(0xDB6C1)) -#define kExtObj88_RightTreeBranch_Tiles ((uint8*)RomFixedPtr(0xDB6E1)) -#define kGrassObj3E_SideCloudFridges_TopTiles ((uint8*)RomFixedPtr(0xDB6F5)) -#define kGrassObj3E_SideCloudFridges_BottomTiles ((uint8*)RomFixedPtr(0xDB6FD)) -#define kGrassObj39_RightFacingDiagonalPipe_Tiles ((uint8*)RomFixedPtr(0xDB72F)) -#define kGrassObj32_BlueSwitchBlocks_InactiveTiles ((uint8*)RomFixedPtr(0xDB91A)) -#define kGrassObj32_BlueSwitchBlocks_ActiveTiles ((uint8*)RomFixedPtr(0xDB91C)) -#define kGrassObj37_SmallTreeTrunk_TopTiles ((uint8*)RomFixedPtr(0xDB962)) -#define kGrassObj37_SmallTreeTrunk_BottomTiles ((uint8*)RomFixedPtr(0xDB964)) -#define kGrassObj34_ForestGroundEdges_TopTiles ((uint8*)RomFixedPtr(0xDBA44)) -#define kGrassObj34_ForestGroundEdges_BottomTiles ((uint8*)RomFixedPtr(0xDBA48)) -#define kGrassObj33_ForestTreeTop_Tiles ((uint8*)RomFixedPtr(0xDBA7C)) -#define kExtObj4B_ConveyorEndTile1_Tiles ((uint8*)RomFixedPtr(0xDC257)) -#define kExtObj84_CastleEntrance_Tiles ((uint8*)RomFixedPtr(0xDC26B)) -#define kExtObj90_LargeBossDoor_Tiles ((uint8*)RomFixedPtr(0xDC318)) -#define kCastleObj3D_Escalator_ConveyorTiles ((uint8*)RomFixedPtr(0xDC350)) -#define kCastleObj3D_Escalator_ConveyorCornerTiles ((uint8*)RomFixedPtr(0xDC354)) -#define kCastleObj3E_HorizontalLineOfSpikes_Tiles ((uint8*)RomFixedPtr(0xDC42C)) -#define kCastleObj3F_VerticalLineOfSpikes_Tiles ((uint8*)RomFixedPtr(0xDC44C)) -#define kCastleObj3C_StoneBlock_LeftTiles ((uint8*)RomFixedPtr(0xDC46F)) -#define kCastleObj3C_StoneBlock_MiddleTiles ((uint8*)RomFixedPtr(0xDC472)) -#define kCastleObj3C_StoneBlock_RightTiles ((uint8*)RomFixedPtr(0xDC475)) -#define kExtObjXX_LineGuideQuarterLargeCircle_Tiles ((uint8*)RomFixedPtr(0xDCE57)) -#define kExtObjXX_LineGuideQuarterSmallCircle_Tiles ((uint8*)RomFixedPtr(0xDCE90)) -#define kExtObj55_HorizontalLineGuideEnd_Tiles ((uint8*)RomFixedPtr(0xDCEBE)) -#define kExtObj56_VerticalLineGuideEnd_Tiles ((uint8*)RomFixedPtr(0xDCED8)) -#define kRopeObj36_HorizontalConveyorRope_Tiles ((uint8*)RomFixedPtr(0xDCEF0)) -#define kCastleObj37_HorizontalLineGuide_Tiles ((uint8*)RomFixedPtr(0xDCF10)) -#define kCastleObj38_VerticalLineGuide_Tiles ((uint8*)RomFixedPtr(0xDCF30)) -#define kRopeObj35_ColumnWithPlantOnTop_LeftPlantTiles ((uint8*)RomFixedPtr(0xDD1CB)) -#define kRopeObj35_ColumnWithPlantOnTop_RightPlantTiles ((uint8*)RomFixedPtr(0xDD1CF)) -#define kRopeObj35_ColumnWithPlantOnTop_ColumnTiles ((uint8*)RomFixedPtr(0xDD1D3)) -#define kRopeObj32_LogBridge_Tiles ((uint8*)RomFixedPtr(0xDD24C)) -#define kExtObj75_CanvasTile1_Tiles ((uint8*)RomFixedPtr(0xDDA61)) -#define kExtObj7C_BitOfCanvas1_TopTiles ((uint8*)RomFixedPtr(0xDDA7A)) -#define kExtObj7C_BitOfCanvas1_BottomTiles ((uint8*)RomFixedPtr(0xDDA7D)) -#define kExtObj7F_TorpedoLauncher_Tiles ((uint8*)RomFixedPtr(0xDDA9E)) -#define kUndergroundObj38_RightLavaEdge_TopTiles ((uint8*)RomFixedPtr(0xDDAC4)) -#define kUndergroundObj38_RightLavaEdge_MiddleTiles ((uint8*)RomFixedPtr(0xDDAC6)) -#define kUndergroundObj3E_CeilingEdges_TopTiles ((uint8*)RomFixedPtr(0xDDD26)) -#define kUndergroundObj3E_CeilingEdges_BottomTiles ((uint8*)RomFixedPtr(0xDDD2A)) -#define kUndergroundObj37_LargeCanvas_CanvasTiles ((uint8*)RomFixedPtr(0xDDEDC)) -#define kUndergroundObj37_LargeCanvas_CanvasPosLo ((uint8*)RomFixedPtr(0xDDEEA)) -#define kUndergroundObj37_LargeCanvas_CanvasPosHi ((uint8*)RomFixedPtr(0xDDEF2)) -#define kUndergroundObj37_LargeCanvas_ScreenPosLo ((uint16*)RomFixedPtr(0xDDEFA)) -#define kUndergroundObj37_LargeCanvas_ScreenPosHi ((uint16*)RomFixedPtr(0xDDF1A)) -#define kExtObj71_Canvas1_Tiles ((uint8*)RomFixedPtr(0xDE05E)) -#define kExtObj71_Canvas1_TileIndex ((uint8*)RomFixedPtr(0xDE0AA)) -#define kUndergroundObj36_4SidedGround_LeftTiles ((uint8*)RomFixedPtr(0xDE12C)) -#define kUndergroundObj36_4SidedGround_MiddleTiles ((uint8*)RomFixedPtr(0xDE12F)) -#define kUndergroundObj36_4SidedGround_RightTiles ((uint8*)RomFixedPtr(0xDE132)) -#define kExtObj57_SwitchPalaceBottomRightInnerCorner_Tiles ((uint8*)RomFixedPtr(0xDE957)) -#define kExtObj61_GhostHouseClock_Tiles ((uint8*)RomFixedPtr(0xDE98F)) -#define kExtObj64_TopRightCobweb_Tiles ((uint16*)RomFixedPtr(0xDE9E1)) -#define kExtObj66_GhostHouseTopRightToBottomLeftBeam2_Tiles ((uint16*)RomFixedPtr(0xDEA1E)) -#define kExtObj49_GhostHouseExit_Tiles ((uint16*)RomFixedPtr(0xDEA71)) -#define kExtObj80_GhostHouseEntrance_Tiles ((uint16*)RomFixedPtr(0xDEADE)) -#define kExtObj85_YoshisHouse_Tiles ((uint16*)RomFixedPtr(0xDEB93)) -#define kExtObj81_Seaweed_Tiles ((uint8*)RomFixedPtr(0xDEC66)) -#define kExtObj8A_GreenSwitchPalaceSwitch_Tiles ((uint16*)RomFixedPtr(0xDEC7E)) -#define kGhostObj35_BrickBackground_Tiles ((uint8*)RomFixedPtr(0xDECC6)) -#define kGhostObj37_HorizontalBackgroundLogAndRailing_LeftTiles ((uint8*)RomFixedPtr(0xDED09)) -#define kGhostObj37_HorizontalBackgroundLogAndRailing_MiddleTiles ((uint8*)RomFixedPtr(0xDED0C)) -#define kGhostObj37_HorizontalBackgroundLogAndRailing_RightTiles ((uint8*)RomFixedPtr(0xDED0F)) -#define kGhostObj39_VerticalBackgroundLog_TopTiles ((uint8*)RomFixedPtr(0xDED65)) -#define kGhostObj39_VerticalBackgroundLog_BottomTiles ((uint8*)RomFixedPtr(0xDED68)) -#define kGhostObj3A_SolidBrickWallAndVerticalLineOfSpikes_Tiles ((uint8*)RomFixedPtr(0xDED95)) -#define kGhostObj31_WoodCrate_LeftEdgeTiles ((uint8*)RomFixedPtr(0xDEFA2)) -#define kGhostObj31_WoodCrate_MiddleTiles ((uint8*)RomFixedPtr(0xDEFA4)) -#define kGhostObj31_WoodCrate_RightEdgeTiles ((uint8*)RomFixedPtr(0xDEFA6)) -#define kGhostObj2E_HorizontalLineOfSpikes_Tiles (*(uint8*)RomFixedPtr(0xDF06B)) + diff --git a/src/funcs.h b/src/funcs.h index f7b1694..e7813a0 100644 --- a/src/funcs.h +++ b/src/funcs.h @@ -1,4 +1,31 @@ -#include "types.h" +#include "smw_rtl.h" + +typedef struct CollInfo { + uint8 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; +} CollInfo; + +typedef struct HdmaPtrs { + uint16 r4, r6; +} HdmaPtrs; + +typedef struct PairU8 { + uint16 first, second; +} PairU8; + + +typedef struct CalcTiltPlatformArgs { + uint16 temp14b0; + uint16 temp14b2; + uint16 temp14bc; + uint16 temp14bf; +} CalcTiltPlatformArgs; + +typedef struct CheckPlatformCollRet { + PointU16 pt; + bool retval; + bool out_of_bounds; +} CheckPlatformCollRet; + // Bank 0 PairU16 BufferFileSelectText_009DB5(uint8 k); PairU16 GetPlayerLevelCollisionMap16ID_Entry2(uint8 k); @@ -7,32 +34,30 @@ PairU16 GetPlayerLevelCollisionMap16ID_WallRun(uint8 k); PairU16 HexToDec(uint8 a); PairU16 OwPrompt03_OverworldLifeExchanger_00974C(uint8 a); uint8 CheckWaterSlope(uint8 a); -uint8 CheckWhatSlopeSpriteIsOn(uint8 a); +uint8 CheckWhatSlopeSpriteIsOn(uint8 a, uint8 r10, uint8 r12, uint8 *r8_slope_type); uint8 GameMode07_TitleScreenDemo_009CBE(void); uint8 GraphicsDecompressionRoutines_ReadByte(void); uint8 HandleMenuCursor_Main_ReturnsTwice(uint8 j); -uint16 ManipulateMode7Image_008B2B(uint16 k); +uint16 ManipulateMode7Image_008B2B(uint16 k, uint8 r0); uint8 ModifyMap16IDForSpecialBlocks(uint8 a); -uint8 PlayerGFXRt_00E45D(uint8 j); -uint8 PlayerState00_00F9A8(void); -uint8 PlayerState00_00F9BC(void); +uint8 PlayerGFXRt_00E45D(uint8 j, uint8 r4, uint8 r5, uint8 r6); uint8 RunPlayerBlockCode_00F3E9(uint8 a, uint8 j); uint8 RunPlayerBlockCode_00F43F(void); uint8 RunPlayerBlockCode_00F443(void); -uint8 UpdateHDMAWindowBuffer_00CC14(uint16 j); +PairU8 UpdateHDMAWindowBuffer_00CC14(uint16 j, HdmaPtrs hptr, uint8 r1); uint8 sub_F40A(uint8 k, uint8 j, uint8 a); -void BufferFileSelectText_Entry3(uint8 k); +void BufferFileSelectText_Entry3(uint8 k, uint8 r5); void BufferFileSelectText(void); void BufferLoadingLetterTiles(void); void BufferPalettesRoutines_IggyLarryPlatform(void); void BufferPalettesRoutines_Levels(void); -void BufferPalettesRoutines_LoadColorInVerticalStrip(uint16 k); -void BufferPalettesRoutines_LoadColors(void); +void BufferPalettesRoutines_LoadColorInVerticalStrip(uint16 k, uint16 r4); +void BufferPalettesRoutines_LoadColors(uint16 r0, uint16 r4, uint16 r6, uint16 r8); void BufferPalettesRoutines_Overworld(void); void BufferPalettesRoutines_Overworld(void); void BufferPalettesRoutines_ReznorAndMode7KoopaBosses(void); void BufferPalettesRoutines_TitleScreen(void); -void ChangeNetDoorTiles(void); +void ChangeNetDoorTiles(GenTileArgs *gta); void CheckPowerUpSpecificPlayerAttacks(void); void CheckIfBlockWasHit_Entry3(uint8 a, uint8 j); void CheckIfBlockWasHit(uint8 a, uint8 j); @@ -51,19 +76,15 @@ void DamagePlayer_PitFall(void); void DamagePlayer_SetHurtAnimationTimer(uint8 a); void DisplayingContinueEnd(uint8 a); void DisplayingContinueEnd(uint8 a); -void DrawLoadingLetters_Draw(uint8 k, uint8 j); +uint16 DrawLoadingLetters_Draw(uint8 k, uint8 j, uint16 r0w); void DrawLoadingLetters(void); -void EraseLargeSwitch(void); -void EraseYoshiCoin(void); +void EraseLargeSwitch(GenTileArgs *gta); +void EraseYoshiCoin(GenTileArgs *gta); void FileSelectColorMath(uint16 a, uint8 j); void GameMode00_LoadNintendoPresents_0093CA(void); void GameMode00_LoadNintendoPresents_0093EA(uint8 k, uint8 j); -void GameMode00_LoadNintendoPresents_0093F4(void); void GameMode00_LoadNintendoPresents(void); -void GameMode00_LoadNintendoPresents_Mode04Finish(void); -void GameMode01_ShowNintendoPresents_009417(void); void GameMode01_ShowNintendoPresents(void); -void GameMode01_ShowNintendoPresents_Return00941A(void); void GameMode04_PrepareTitleScreen(void); void GameMode06_CircleEffect_009440(uint8 a); void GameMode06_CircleEffect_009443(void); @@ -84,7 +105,7 @@ void GameMode10_BufferLevelLoadMessage(void); void GameMode11_LoadSublevel_0096CF(uint8 j, uint8 a); void GameMode11_LoadSublevel_00A796(void); void GameMode11_LoadSublevel_GameMode03Entry(void); -void GameMode11_LoadSublevel_SA1Pack_OptimizeThisRoutine1(void); +void GameMode11_LoadSublevel_0096D5(void); void GameMode12_PrepareLevel_00919B(void); void GameMode12_PrepareLevel_009860(void); void GameMode12_PrepareLevel_009A1F(uint8 k); @@ -120,18 +141,17 @@ void GameModeXX_FadeInOrOut_MosaicFade(void); void Gamemode_9_A_Common(void); void GenerateTile_00BFBC(void); void GenerateTile(void); -void GenericPage01Tile_00C0FB(uint16 j); -void GenericPage01Tile(void); +void GenericPage01Tile_00C0FB(GenTileArgs *gta, uint16 j); +void GenericPage01Tile(GenTileArgs *gta); void GenericPage01Tile_Return00C1AB(void); -void GenericPage01Tile_SetItemMemory(void); -void GraphicsDecompressionRoutines_BeginDecompression(void); +void GenericPage01Tile_SetItemMemory(GenTileArgs *gta); +void GraphicsDecompressTo(uint8 *pdst); void GraphicsDecompressionRoutines_DecompressGFX32And33(void); -void GraphicsDecompressionRoutines(uint8 j); +const uint8 *GraphicsDecompress(uint8 j); void HandleMenuCursor_009E82(uint8 j); void HandleMenuCursor_009ED4(uint8 k); -void HandlePaletteFades_00AF35(void); -void HandlePaletteFades_00AFA3(uint8 a); -void HandlePaletteFades_00AFC0(uint16 a); +void HandlePaletteFades_00AF35(bool run_code_at_end); +uint16 HandlePaletteFades_00AFC0(uint16 a, uint16 r2, uint16 r12, uint16 r14); void HandlePaletteFades(void); void HandlePlayerLevelColl_00E98C(void); void HandlePlayerLevelColl_00E9C8(uint8 j, uint8 cr); @@ -154,14 +174,14 @@ void HandlePlayerPhysics_Swimming(void); void HandlePlayerPhysics_UpdatePMeter(void); uint8 HandlePlayerPhysics_UpdatePMeterEx(uint8 j); void HandleSPCUploads_008134(void); -void HandleSPCUploads_StrtSPCMscUpld(void); +void HandleSPCUploads_StrtSPCMscUpld(const uint8 *p); void HandleSPCUploads_UploadCreditsMusicBank(void); -void HandleSPCUploads_UploadDataToSPC(void); +void HandleSPCUploads_UploadDataToSPC(const uint8 *p); void HandleSPCUploads_UploadOverworldMusicBank(void); void HandleSPCUploads_UploadSPCEngine(void); void HandleSPCUploads_UploadSamples(void); void HandleStandardLevelCameraScroll_00F7F4(uint16 a); -void HandleStandardLevelCameraScroll_00F8AB(void); +uint16 HandleStandardLevelCameraScroll_00F8AB(uint16 r2w); void HandleStandardLevelCameraScroll(void); void IncrementSublevelsEnteredAndPrepareToLoadSublevel(void); void InitAndMainLoop_ProcessGameMode(void); @@ -178,11 +198,11 @@ void InitializeStatusBarTilemap(void); void LoadSaveBufferData(void); void LoadStripeImage(void); void LoadStripeImage(void); -void LoadStripeImage_UploadToVRAM(uint8 a); -void ManipulateMode7Image_008AE8(void); +void LoadStripeImage_UploadToVRAM(const uint8 *pp); +void ManipulateMode7Image_008AE8(uint8 r0); void ManipulateMode7Image(void); void OwEventProcess04_FadeInLayer2Tile_00B006(uint8 a); -void PlayerGFXRt_00F636(void); +void PlayerGFXRt_00F636(uint8 r10, uint8 r11, uint8 r12, uint8 r13); void PlayerDraw(void); void PlayerState00_00B03E(void); void PlayerState00_00C95B(void); @@ -200,7 +220,7 @@ void PlayerState00_00CD8B(void); void PlayerState00_00CD8F(void); void PlayerState00_00CD95(uint8 j); void PlayerState00_00F8F2(void); -void PlayerState00_00F9C9(void); +void PlayerState00_00F9C9(uint16 temp14b4, uint16 temp14b6, PointU16 pt); void PlayerState00_CheckPlayerPitFall(void); void PlayerState00_HandleEndOfLevel(void); void PlayerState00_HandleLRScrolling(void); @@ -289,23 +309,23 @@ void UnusedAddToWarpPipeTimerRoutine(void); void UnusedYoshiRelatedRoutine(void); void UpdateCurrentPlayerPositionRAM(void); void UpdateEntirePalette(void); -void UpdateHDMAWindowBuffer_IrisInOnPlayerEntry(uint8 a); -void UpdateHDMAWindowBuffer_KeyholeEntry(uint8 a); -void UpdateHDMAWindowBuffer_SetCircleHDMAPointer(void); +void UpdateHDMAWindowBuffer_IrisInOnPlayerEntry(uint8 a, HdmaPtrs hptr); +void UpdateHDMAWindowBuffer_KeyholeEntry(HdmaPtrs hptr, uint8 r0, uint8 r1); +HdmaPtrs UpdateHDMAWindowBuffer_SetCircleHDMAPointer(void); void UpdatePaletteFromIndexedTable_00AE47(void); void UpdatePaletteFromIndexedTable(void); void UpdatePlayerSpritePosition(void); -void UpdateStatusBarCounters_009051(uint8 k, uint8 j); +void UpdateStatusBarCounters_009051(uint8 k, uint8 j, uint16 r2w); void UpdateStatusBarCounters_DrawItemBoxItem(void); -void UpdateStatusBarCounters_Loop2(uint8 k, uint8 j); +void UpdateStatusBarCounters_Loop2(uint8 k, uint8, uint16 r0w, uint16 r2w); void UpdateStatusBarCounters(void); void UploadBigLayer3LettersToVRAM(void); -void ConvertGFX27IntoNormallFormat(void); +void ConvertGFX27IntoNormallFormat(uint16 *dst); void UploadGraphicsFiles_Layer3(void); void UploadGraphicsFiles(void); -void UploadGraphicsFiles_UploadGFXFile(uint8 j); +void UploadGraphicsFiles_UploadGFXFile(uint16 dst_addr, uint8 j); void UploadLevelExAnimationData(void); -void UploadLevelAnimations_RedFlash(uint8 a); +void UploadLevelAnimations_RedFlash(uint8 a, uint8 r0); void UploadLevelAnimations_YellowFlash(uint8 a); void UploadLevelLayer1And2Tilemaps(void); void UploadLoadingLettersTiles(void); @@ -317,8 +337,8 @@ void UploadPlayerGFX(void); void UploadStatusBarTilemap(void); void sub_9291(uint16 k); void sub_9F4C(uint8 j); -void sub_C074(void); -void sub_C077(void); +void sub_C074(GenTileArgs *gta); +void sub_C077(GenTileArgs *gta); // Bank 1 uint8 CheckAvailableExtendedSpriteSlot(uint8 k); @@ -329,41 +349,46 @@ uint8 CheckPlayerToNormalSpriteCollision(uint8 k); uint8 CheckPlayerToNormalSpriteColl_ProcessInteract(uint8 k); uint8 CheckPlayerToNormalSpriteColl_ReturnNoContact(void); uint8 CheckPlayerToNormalSpriteColl_ReturnNoContact2(void); -uint8 CheckTiltingPlatformCollision(void); +CheckPlatformCollRet CheckTiltingPlatformCollision(uint16 temp14b4, uint16 temp14b6); uint8 CheckIfNormalSpriteOffScreen(uint8 k); uint8 CheckNormalSpriteLevelColl_Ceiling(uint8 k); uint8 CheckNormalSpriteLevelColl_Floor(uint8 k); uint8 CheckNormalSpriteLevelColl_Wall(uint8 k); uint8 CheckPlayerPositionRelativeToSprite_Bank01_X(uint8 k); uint8 CheckPlayerPositionRelativeToSprite_Bank01_Y(uint8 k); -uint8 FinishOAMWrite_01B844(void); -uint8 GetDrawInfo_Bank01_ReturnsTwice(uint8 k); +uint8 FinishOAMWrite_01B844(uint16 r4w); +typedef struct GetDrawInfoRes { + uint8 idx; + uint8 x, y; +} GetDrawInfoRes; + +GetDrawInfoRes GetDrawInfo_Bank01_ReturnsTwice(uint8 k); uint8 GetRand(void); uint8 GetRand_01AD07(uint8 j); -uint8 HandleNormalSpriteLevelColl_019441(uint8 k, uint8 j); -uint8 HandleNormalSpriteLevelColl_01944D(uint8 k, uint8 j); -uint8 HandleNormalSpriteLevelColl_019523(uint8 k); +uint8 HandleNormalSpriteLevelColl_019441(uint8 k, uint8 j, PointU16 *pt_out); +uint8 HandleNormalSpriteLevelColl_01944D(uint8 k, uint8 j, PointU16 *pt_out); +uint8 HandleNormalSpriteLevelColl_019523(uint16 r5); uint8 SolidSpriteBlock_Entry2(uint8 k); uint8 SolidSpriteBlock(uint8 k); uint8 Spr029_KoopaKid_MortonRoyLudwig_01D0C0(uint8 k); uint8 Spr04C_ExplodingBlock_Init(uint8 k); void Spr04C_ExplodingBlock_Init_MainV(uint8 k); -uint8 Spr05F_BrownChainedPlatform_01C9BF(void); -uint8 Spr05F_BrownChainedPlatform_01CA9C(uint8 k); -uint8 Spr0A7_IggyBall_CheckTiltingPlatformCollision(uint8 k); +uint8 Spr05F_BrownChainedPlatform_01C9BF(uint16 r9); +uint8 Spr05F_BrownChainedPlatform_01CA9C(uint8 k, PointU16 pt); +CheckPlatformCollRet Spr0A7_IggyBall_CheckTiltingPlatformCollision(uint8 k); uint8 SprXXX_Generic_Init_MakeSpriteFacePlayer(uint8 k); void SprXXX_Generic_Init_MakeSpriteFacePlayerV(uint8 k); -uint8 SprXXX_LineGuided_01D94D(void); +uint8 SprXXX_LineGuided_01D94D(uint16 r0w, uint16 r2w); uint8 SprXXX_SmallMontyMole_01E3EF_ReturnsTwice(uint8 k); -uint8 SprXXX_TurnBlockBridge_01B8FF(uint8 k); +uint8 SprXXX_TurnBlockBridge_01B8FF(uint8 k, uint16 R0, uint16 r2); uint8 sub_1B505(uint8 k); uint8 sub_1EC50(void); -void AimTowardsPlayer_Bank01(uint8 k, uint8 a); +PointU8 AimTowardsPlayer_Bank01(uint8 k, uint8 a); void BoostMarioSpeed(void); void BreakThrowBlock(uint8 k); void BreakThrowBlock_MontyMoleEntry(uint8 k, uint8 j); -void CalculateCircleCoordinatesForTiltingPlaform_01CC28(void); -void CalculateCircleCoordinatesForTiltingPlaform(void); +uint32 CalculateCircleCoordinatesForTiltingPlaform_01CC28(uint16 R0_W_, uint16 R2_W_); +PointU16 CalculateCircleCoordinatesForTiltingPlaform(CalcTiltPlatformArgs inp); void ChangeNormalSpriteDirection_CheckIfTouchingWall(uint8 k); void ChangeNormalSpriteDirection_FlipXSpeedAndDirection(uint8 k); void ChangeNormalSpriteDirection(uint8 k); @@ -384,16 +409,16 @@ void CheckTiltingPlatformColl_01CCC7(void); void CheckTiltingPlatformColl_Return01CCEA(void); void CheckTiltingPlatformColl_Return01CCEB(void); void DrawWingTiles_019E35(uint8 k, uint8 j); -void DrawWingTiles_019E37(uint8 k); +void DrawWingTiles_019E37(uint8 k, uint8 r2); void DrawWingTiles(uint8 k); void DrawWingTiles_ParaKoopaEntry(uint8 k); void FinishOAMWrite(uint8 k, uint8 j, uint8 a); void FinishOAMWrite(uint8 k, uint8 j, uint8 a); -void GenericGFXRtDraw1Tile16x16_019F0F(uint8 k); +void GenericGFXRtDraw1Tile16x16_019F0F(uint8 k, uint8 r4); void GenericGFXRtDraw1Tile16x16(uint8 k); void GenericGFXRtDraw1Tile16x16_Sub(uint8 k, uint8 a); void GenericGFXRtDraw1Tile16x16(uint8 k); -void GenericGFXRtDraw2Tiles16x16sStacked_019DA9(uint8 k, uint8 j); +void GenericGFXRtDraw2Tiles16x16sStacked_019DA9(uint8 k, uint8 j, uint8 r0); void GenericGFXRtDraw2Tiles16x16sStacked_Sub(uint8 k); void GenericGFXRtDraw2Tiles16x16sStacked_UpsideDown(uint8 k); void GenericGFXRtDraw4Tiles8x8Square_Entry1(uint8 k, uint8 a, uint8 j); @@ -407,9 +432,9 @@ void HandleNormalSpriteLevelColl_019211(uint8 k); void HandleNormalSpriteLevelColl_01928E(uint8 k, uint8 a); void HandleNormalSpriteLevelColl_0192C9(uint8 k); void HandleNormalSpriteLevelColl_019330(uint8 k); -void HandleNormalSpriteLevelColl_01933B(uint8 k, uint8 a); -void HandleNormalSpriteLevelColl_019425(uint8 k); -void HandleNormalSpriteLevelColl_019435(uint8 k); +void HandleNormalSpriteLevelColl_01933B(uint8 k, uint8 a, uint8 r10, uint8 r12, uint8 r15); +void HandleNormalSpriteLevelColl_019425(uint8 k, uint16 xpos_r10w, uint16 ypos_r12w, uint8 r15); +void HandleNormalSpriteLevelColl_019435(uint8 k, uint8 r15); void HandleNormalSpriteLevelCollision(uint8 k); void HandleNormalSpriteLevelCollision(uint8 k); void KickHelplessSprite(uint8 k); @@ -449,7 +474,7 @@ void SetXSpeedBasedOnNormalSpriteFacingDirection(uint8 k); void SpawnContactEffectFromAbove(uint8 k); void SpawnContactEffectFromSide(uint8 k); void SpawnContactEffectFromSide_NoKickSound(uint8 k); -void SpawnNormalSpriteTurnAroundSmoke_Entry2(uint8 k); +void SpawnNormalSpriteTurnAroundSmoke_Entry2(uint8 k, uint8 r0, uint8 r1); void SpawnNormalSpriteTurnAroundSmoke(uint8 k); void SpawnSparkles_GoalSphereEntry(uint8 k, uint8 a); void SpawnSparklesSpriteEntry(uint8 k); @@ -498,12 +523,12 @@ void Spr026_Thwomp(uint8 k); void Spr026_Thwomp_Rising(uint8 k); void Spr026_Thwomp_Waiting(uint8 k); void Spr027_Thwimp(uint8 k); -void Spr029_KoopaKid_IggyLarry_01FC62(uint8 k); -void Spr029_KoopaKid_IggyLarry_01FD50(uint8 k); -void Spr029_KoopaKid_IggyLarry_Draw(uint8 k); -void Spr029_KoopaKid_IggyLarry_InShellDraw(uint8 k); +void Spr029_KoopaKid_IggyLarry_01FC62(uint8 k, PointU16 pt); +PointU16 Spr029_KoopaKid_IggyLarry_01FD50(uint8 k); +void Spr029_KoopaKid_IggyLarry_Draw(uint8 k, PointU16 pt); +void Spr029_KoopaKid_IggyLarry_InShellDraw(uint8 k, PointU16 pt); void Spr029_KoopaKid_IggyLarry(uint8 k); -void Spr029_KoopaKid_IggyLarry_ThrowBall(uint8 k); +void Spr029_KoopaKid_IggyLarry_ThrowBall(uint8 k, PointU16 pt); void Spr029_KoopaKid_MortonRoyLudwig_01D309(uint8 k); void Spr029_KoopaKid_MortonRoyLudwig_01CE1E(uint8 k); void Spr029_KoopaKid_MortonRoyLudwig_01CE3E(uint8 k); @@ -512,7 +537,7 @@ void Spr029_KoopaKid_MortonRoyLudwig_01D059(uint8 k); void Spr029_KoopaKid_MortonRoyLudwig_01D2A8(uint8 k); void Spr029_KoopaKid_MortonRoyLudwig_01D351(uint8 k); void Spr029_KoopaKid_MortonRoyLudwig_01D3B1(uint8 k); -void Spr029_KoopaKid_MortonRoyLudwig_01D40B(uint8 k); +void Spr029_KoopaKid_MortonRoyLudwig_01D40B(uint8 k, CollInfo *ci); void Spr029_KoopaKid_MortonRoyLudwig_GetDrawInfo(uint8 k); void Spr029_KoopaKid_MortonRoyLudwig(uint8 k); void Spr029_KoopaKid_MortonRoyLudwig_ProcessLudwigsAttacks(uint8 k); @@ -539,13 +564,13 @@ void Spr035_Yoshi_Init(uint8 k); void Spr035_Yoshi_Init_Return(uint8 k); void Spr035_Yoshi_01EDCC(uint8 k); void Spr035_Yoshi_01EDCE(uint8 k, uint8 j); -void Spr035_Yoshi_01EF18(uint8 k); +uint8 Spr035_Yoshi_01EF18(uint8 k); void Spr035_Yoshi_01F0A2(uint8 k); -void Spr035_Yoshi_01F295(uint8 k); +void Spr035_Yoshi_01F295(uint8 k, uint8 r0); void Spr035_Yoshi_01F2DF(uint8 j); void Spr035_Yoshi_01F309(void); -void Spr035_Yoshi_01F3FE(uint8 k); -void Spr035_Yoshi_01F4B2(uint8 k); +uint8 Spr035_Yoshi_01F3FE(uint8 k); +void Spr035_Yoshi_01F4B2(uint8 k, uint8 r13); void Spr035_Yoshi_01F622(uint8 k); void Spr035_Yoshi_01F668(uint8 k, uint8 j); void Spr035_Yoshi_01F6CD(uint8 j); @@ -557,7 +582,7 @@ void Spr035_Yoshi_MouthState01_ExtendTongue(uint8 k); void Spr035_Yoshi_MouthState02_RetractTongue(uint8 k); void Spr035_Yoshi_MouthState03_Spitting(uint8 k); void Spr035_Yoshi_Return01F3FD(void); -void Spr035_Yoshi_TryEatSprite(uint8 k, uint8 j); +void Spr035_Yoshi_TryEatSprite(uint8 k, uint8 j, CollInfo *ci); void Spr03D_RipVanFish(uint8 k); void Spr03E_PSwitch_Init(uint8 k); void Spr03E_PSwitch(uint8 k); @@ -575,13 +600,13 @@ void Spr04C_ExplodingBlock(uint8 k); void Spr04E_LedgeMontyMole(uint8 k); void Spr052_MovingLedgeHole_Init(uint8 k); void Spr054_ClimbingNetDoor_Init(uint8 k); -void Spr054_ClimbingNetDoor_01BC1D(void); +void Spr054_ClimbingNetDoor_01BC1D(CollInfo *ci); void Spr054_ClimbingNetDoor(uint8 k); void Spr057_VerticalCheckerboardPlatform_Init(uint8 k); void Spr058_VerticalRockPlatform(uint8 k); void Spr05F_BrownChainedPlatform_Init(uint8 k); void Spr05F_BrownChainedPlatform_01C9E2(uint8 k); -void Spr05F_BrownChainedPlatform_01CACB(uint8 k); +CalcTiltPlatformArgs Spr05F_BrownChainedPlatform_01CACB(uint8 k); void Spr05F_BrownChainedPlatform(uint8 k); void Spr05F_BrownChainedPlatform_UpdateAngle(uint8 k); void Spr060_FlatPalaceSwitch_Init(uint8 k); @@ -781,8 +806,8 @@ void SprXXX_SmallMontyMole_State02_PopOutOfGround(uint8 k); void SprXXX_SmallMontyMole_State03_Walking(uint8 k); void SprXXX_TurnBlockBridge_01B6B2(uint8 k); void SprXXX_TurnBlockBridge_01B6E7(uint8 k); -void SprXXX_TurnBlockBridge_01B852(uint8 k); -void SprXXX_TurnBlockBridge_Draw(uint8 k); +void SprXXX_TurnBlockBridge_01B852(uint8 k, uint16 t); +uint16 SprXXX_TurnBlockBridge_Draw(uint8 k); void SprXXX_TurnBlockBridge_HorizontalAndVerticalTurnBlockBridgeEntry(uint8 k); void SprXXX_TurnBlockBridge_HorizontalTurnBlockBridgeEntry(uint8 k); void SprXXX_TurnBlockBridge_Return01B851(void); @@ -797,7 +822,7 @@ void SprXXX_WallSpringboard(uint8 k); void StunnedShellGFXRt_01980F(uint8 k, uint8 a); void StunnedShellDraw(uint8 k); void SubOffscreen_Bank01_01AC2D(uint8 k, uint8 a); -void SubOffscreen_Bank01_01AC33(uint8 k); +void SubOffscreen_Bank01_01AC33(uint8 k, uint8 r3); void SubOffscreen_Bank01_Entry1(uint8 k); void SubOffscreen_Bank01_Entry2(uint8 k); void SubOffscreen_Bank01_Entry3(uint8 k); @@ -810,7 +835,7 @@ void sub_1A64A(uint8 k, uint8 j); void sub_1A685(uint8 k, uint8 j); void sub_1A72E(uint8 k, uint8 j); void sub_1C9DA(uint8 k); -void sub_1C9EC(uint8 k); +void sub_1C9EC(uint8 k, PointU16 pt); void sub_1D31E(uint8 k); void sub_1D334(uint8 k); void sub_1F8E1(uint8 k, uint8 a); @@ -819,22 +844,26 @@ void sub_1F8E1(uint8 k, uint8 a); uint8 CheckAvailableScoreSpriteSlot(void); uint8 CheckPlayerPositionRelativeToSprite_Bank23_X(uint8 k); uint8 CheckPlayerPositionRelativeToSprite_Bank23_Y(uint8 k); -uint8 CheckPlayerPositionRelativeToSprite_Y_R15(uint8 k); uint8 ExtSpr04_Hammer_ThrownBoneEntry(uint8 k); -uint8 FindFreeNormalSpriteSlot_02A9E6(void); +uint8 FindFreeNormalSpriteSlot_02A9E6(uint8 r14); uint8 FindFreeNormalSpriteSlot_HighPriority(void); uint8 FindFreeNormalSpriteSlot_LowPriority(void); -uint8 FindFreeNormalSpriteSlot_02A9E6(void); -uint8 GetDrawInfo_Bank23_ReturnsTwice(uint8 k); +uint8 FindFreeNormalSpriteSlot_02A9E6(uint8 r14); +GetDrawInfoRes GetDrawInfo_Bank23_ReturnsTwice(uint8 k); uint8 GrabThrowBlockBlock(void); -uint8 HandleExtendedSpriteLevelColl_02A611(uint8 k); -uint8 HandleExtendedSpriteLevelCollision(uint8 k); + +typedef struct ExtCollOut { + uint8 r10, r11, r12, r13; +} ExtCollOut; + +uint8 HandleExtendedSpriteLevelColl_02A611(uint8 k, uint8 r15, ExtCollOut *out); +uint8 HandleExtendedSpriteLevelCollision(uint8 k, ExtCollOut *out); uint8 InitializeBlockPunchAttack(void); uint8 Spr08F_ScalePlatform_02E524(uint8 k, uint8 j); uint8 Spr0A3_GreyChainedPlatform_02D870(uint8 k, uint8 a); uint8 UpdateNormalSpritePosition_X(uint8 k); uint8 UpdateNormalSpritePosition_Y(uint8 k); -void AimTowardsPlayer_Bank23(uint8 k, uint8 a); +PointU8 AimTowardsPlayer_Bank23(uint8 k, uint8 a); void BobOmbExplosion_ExplodeKillSpr(uint8 k, uint8 j); void BobOmbExplosion_ExplodeSprites(uint8 k); void BobOmbExplosion(uint8 k); @@ -842,17 +871,17 @@ void BobOmbExplosion(uint8 k); void BounceSpr01_TurnBlock(uint8 k); void BounceSpr07_SpinningTurnBlock(uint8 k); void BounceSpriteDraw(uint8 k); -void CheckBerryTileCollisionWithYoshiTongue(void); +void CheckBerryTileCollisionWithYoshiTongue(CollInfo *ci); void CheckMarioToExtendedSpriteColl_02A469(uint8 k); void CheckMarioToExtendedSpriteColl_02A4DE(uint8 k); void CheckMarioToExtendedSpriteColl_LoseYoshi(void); void CheckMarioToExtendedSpriteCollision(uint8 k); -void CheckPlayerAttackToNormalSpriteColl_029404(uint8 k); -void CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry(void); -void CheckPlayerAttackToNormalSpriteColl_GetBounceSpriteClipping(uint8 j); -void CheckPlayerAttackToNormalSpriteColl_GetCapeSwingOrNetPunchClipping(void); +void CheckPlayerAttackToNormalSpriteColl_029404(uint8 k, uint8 r14); +void CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry(uint8 r14); +void CheckPlayerAttackToNormalSpriteColl_GetBounceSpriteClipping(uint8 j, CollInfo *ci); +void CheckPlayerAttackToNormalSpriteColl_GetCapeSwingOrNetPunchClipping(CollInfo *ci); void CheckPlayerAttackToNormalSpriteCollision(uint8 k); -void CheckPlayerFireballToNormalSpriteColl_GetPlayerFireballClipping(uint8 j); +void CheckPlayerFireballToNormalSpriteColl_GetPlayerFireballClipping(uint8 j, CollInfo *ci); void CheckPlayerFireballToNormalSpriteCollision(uint8 k); void CheckPlayerToEnemyClusterSpriteCollision(uint8 k); void CheckPlayerToNormalSpriteColl_02B9D9(uint8 j); @@ -876,7 +905,7 @@ void ClusterSpr06_SumoBroFlame_02F9F5(void); void ClusterSpr06_SumoBroFlame_CheckPlayerContact(uint8 k); void ClusterSpr06_SumoBroFlame(uint8 k); void ClusterSpr07_ReappearingBoo(uint8 k); -void DrawBigCastleGate_DrawBigCastleGate(void); +void DrawBigCastleGate_DrawBigCastleGate(uint8 r0); void DrawBigCastleGate(void); void DrawGhostHouseEntranceDoor(void); void DrawGhostHouseEntranceDoor(void); @@ -896,7 +925,7 @@ void ExtSpr07_LavaSplash(uint8 k); void EraseExtSprite(uint8 k); void ExtSpr08_LauncherArm(uint8 k); void ExtSpr09_Unused(uint8 k); -void ExtSpr0A_CloudCoin_029D45(uint8 j); +void ExtSpr0A_CloudCoin_029D45(uint8 j, uint8 r1); void ExtSpr0A_CloudCoin_029D36(uint8 j, uint8 a); void ExtSpr0A_CloudCoin(uint8 k); void ExtSpr0C_VolcanoLotusFire(uint8 k); @@ -909,7 +938,7 @@ void GameMode14_InLevel_Bank02(void); void GameMode14_InLevel_02827D(void); void GameMode14_InLevel_0283CE(void); void GameMode14_InLevel_0283F8(uint8 k); -void GameMode14_InLevel_028439(uint8 k); +void GameMode14_InLevel_028439(uint8 k, uint8 xpos); void GenSpr01_GenerateEerie(void); void GenSpr02_GenParachuteEnemy(void); void GenSpr07_GenerateFish(void); @@ -917,21 +946,21 @@ void GenSpr08_TurnOffRespawningSprite(void); void GenSpr09_GenerateSuperKoopa(void); void GenSpr0A_GenerateBubbles(void); void GenSpr0B_GenerateBullet(void); -void GenSpr0C_GenerateSurroundingBullets(void); +void GenSpr0C_GenerateSurroundingBullets(uint8 r13); void GenSpr0D_GenerateDiagnalBullets(void); void GenSpr0E_GenerateFire(void); void GenSpr0F_TurnOffGenerator(void); void GenSprXX_GenerateDolphins(void); -void GenericExtendedSpriteGFXRt_FireballEntry(uint8 k, uint8 j); -void GenericExtendedSpriteDraw(uint8 k); +uint8 GenericExtendedSpriteGFXRt_FireballEntry(uint8 k, uint8 j); +uint8 GenericExtendedSpriteDraw(uint8 k); void GetBounceSpriteLevelCollisionMap16ID_029356(uint8 k); void GetBounceSpriteLevelCollisionMap16ID(uint8 k); -void GetExtendedSpriteClipping(uint8 k); +void GetExtendedSpriteClipping(uint8 k, CollInfo *ci); void GivePoints_02ACEF(uint8 k, uint8 a); void GivePoints_Entry2(uint8 j, uint8 a); void GivePoints(uint8 k, uint8 a); void HandleCapeInteraction(void); -void HandleCapeLevelColl_029540(void); +void HandleCapeLevelColl_029540(uint8 r15); void HandleCapeLevelCollision(void); void HandleCapeToExtendedSpriteCollision(void); void HandleHeldPBalloonAndInLakituCloudMovement(uint8 k); @@ -948,7 +977,7 @@ void MExtSpr0A_BooStream(uint8 k); void MExtSpr0B_UnusedYoshiSmoke(uint8 k); void MExtSpr_Delete(uint8 k); void ParseLevelSpriteList_Entry2(void); -void ParseLevelSpriteList_LoadSpriteLoopStrt(uint8 k, uint8 j); +void ParseLevelSpriteList_LoadSpriteLoopStrt(uint8 k, uint8 j, uint16 r0w); void ParseLevelSpriteList(void); void ProcessBounceAndSmokeSprites_BounceSprites(uint8 k); void ProcessBounceAndSmokeSprites(void); @@ -987,8 +1016,8 @@ void EraseSmokeSprite(uint8 k); void SmokeSpr02_ContactEffect(uint8 k); void SmokeSpr03_TurnAroundSmoke(uint8 k); void SmokeSpr05_Glitter(uint8 k); -void SpawnBounceSprite_02887D(void); -void SpawnBounceSprite(void); +void SpawnBounceSprite_02887D(uint8 r5); +void SpawnBounceSprite(uint8 r4, uint8 r5, uint8 r6, uint8 r7); void SpawnBounceSprite_SpawnSpinningCoins(void); void SpawnBrickPieces(uint8 a); void SpawnLavaSplash(uint8 k); @@ -999,20 +1028,20 @@ void SpawnMusicNoteOrZ_02C0DB(uint8 k, uint8 a); void SpawnMusicNoteOrZ_MusicNote(uint8 k); void SpawnMusicNoteOrZ_Z(uint8 k); void SpawnSmokePuff(void); -void SpawnSparkles(void); +void SpawnSparkles(uint8 r0, uint8 r2); void SpawnSparkles_PlayerEntry(void); void SpawnWaterSplash_0284C2(uint8 k, uint8 a); -void SpawnWaterSplash_0284D8(uint8 k); +void SpawnWaterSplash_0284D8(uint8 k, uint8 r0, uint8 r2); void SpawnWaterSplash(uint8 k); void SpawnWaterSplash_VerticalCheepCheepEntry(uint8 k); void SpawnYoshiStompSmoke(void); -void SpawnYoshiStompSmoke_SpawnFirstSmoke(void); +void SpawnYoshiStompSmoke_SpawnFirstSmoke(uint8 r0); void Spr01E_Lakitu(uint8 k); void Spr01E_Lakitu_LakituFishingLineDraw(uint8 k); void Spr02B_SumoLightning(uint8 k); void Spr02B_SumoLightning_02DF2C(uint8 k); void Spr033_Podoboo_SpawnPodobooFire(uint8 k); -void Spr035_Yoshi_028BC0(uint8 k); +void Spr035_Yoshi_028BC0(uint8 k, uint8 r0); void Spr035_Yoshi_02D0E6(uint8 k); void Spr035_Yoshi_ChangeBerryIntoBushTile(void); void Spr035_Yoshi_CheckBerryTileCollisionWithAdultYoshiMouth(uint8 k); @@ -1051,9 +1080,8 @@ void Spr06A_CoinGameCloud(uint8 k); void Spr070_Pokey(uint8 k); void Spr070_Pokey_Bank02SpriteEntry(uint8 k, uint8 j, uint8 a); void Spr070_Pokey_02B7AC(uint8 k); -void Spr070_Pokey_02B82E(uint8 k); -void Spr070_Pokey_RemovePokeySegment(uint8 k, uint8 a); -void Spr070_Pokey_RemovePokeySgmntRt(uint8 k, uint8 a); +void Spr070_Pokey_02B82E(uint8 k, uint8 r13); +uint8 Spr070_Pokey_RemovePokeySegment(uint8 k, uint8 a); void Spr070_Pokey_Sub(uint8 k); void Spr086_Wiggler_Init(uint8 k); void Spr086_Wiggler_Init_GetWigglerSegmentPosIndex(uint8 k); @@ -1091,10 +1119,10 @@ void Spr091_CharginChuck_02C579(uint8 k); void Spr091_CharginChuck_02C5BC(uint8 k); void Spr091_CharginChuck_02C602(uint8 k); void Spr091_CharginChuck_02C628(uint8 k); -void Spr091_CharginChuck_DrawBody(void); -void Spr091_CharginChuck_DrawDigginChuckExtraTiles(uint8 k); -void Spr091_CharginChuck_DrawExtraTiles(uint8 k); -void Spr091_CharginChuck_DrawHead(uint8 k); +void Spr091_CharginChuck_DrawBody(uint8 k, PointU8 pt); +void Spr091_CharginChuck_DrawDigginChuckExtraTiles(uint8 k, PointU8 pt); +void Spr091_CharginChuck_DrawExtraTiles(uint8 k, PointU8 pt); +PointU8 Spr091_CharginChuck_DrawHead(uint8 k, PointU8 pt); void Spr091_CharginChuck_Draw(uint8 k); void Spr091_CharginChuck_ProcessPlayerInteraction(uint8 k); void Spr091_CharginChuck_Return02CBFC(void); @@ -1130,19 +1158,19 @@ void Spr09E_BallNChain_Sub(uint8 k); void Spr09E_BallNChain(uint8 k); void Spr09F_BanzaiBill_Draw(uint8 k); void Spr09F_BanzaiBill_Sub(uint8 k); -void Spr0A3_GreyChainedPlatform_02D813(uint8 k); -void Spr0A3_GreyChainedPlatform_02D848(uint8 k); -void Spr0DE_Load5Eeries(uint8 k); -void Spr0E0_Load3Platforms(void); -void Spr0E1_LoadBooCeiling(uint8 k, uint8 a); +PointU8 Spr0A3_GreyChainedPlatform_02D813(uint8 k); +PointU8 Spr0A3_GreyChainedPlatform_02D848(uint8 k); +void Spr0DE_Load5Eeries(uint8 k, uint16 r0w, uint8 r2, uint8 r3); +void Spr0E0_Load3Platforms(uint16 r0w, uint8 r2, uint8 r3); +void Spr0E1_LoadBooCeiling(uint8 k, uint8 a, uint16 r0w, uint8 r2, uint8 r3); void SprXXX_Dolphins(uint8 k); void SprXXX_Dolphins_Draw(uint8 k); void SprXXX_JumpingPiranhaPlant_02E17F(uint8 k); void SprXXX_JumpingPiranhaPlant_02E1C0(uint8 k, uint8 a); void Spr04F_JumpingPiranhaPlant(uint8 k); -void SprXXX_LoadShooter(uint8 k, uint8 j, uint8 a); +void SprXXX_LoadShooter(uint8 k, uint8 j, uint8 a, uint16 r0w); void SprXXX_SuperKoopas_02EB3D(uint8 k, uint8 j); -void SprXXX_SuperKoopas_02EBB5(uint8 k); +void SprXXX_SuperKoopas_02EBB5(uint8 k, uint8 r0); void SprXXX_SuperKoopas_02EBCA(uint8 k); void SprXXX_SuperKoopas_02EBF8(uint8 k); void SprXXX_SuperKoopas_Draw(uint8 k); @@ -1154,12 +1182,12 @@ void Spr0A5_Sparky(uint8 k); void SprXXX_WallFollowers_SparkyDraw(uint8 k); void SprXXX_WallFollowers_UrchinDraw(uint8 k); void SprXXX_WallSpringboard_Draw(uint8 k); -void SprXXX_WallSpringboard_HandlePlayerCollision(uint8 k, uint8 j); +void SprXXX_WallSpringboard_HandlePlayerCollision(uint8 k, uint8 j, uint8 r2); void SprXXX_WallSpringboard_Return02CDFE(uint8 k); void SprXXX_WallSpringboard_State01_PlayerIsOnTop(uint8 k); void SprXXX_WallSpringboard_State02_Rebound(uint8 k); void SprXXX_WallSpringboard(uint8 k); -void SubOffscreen_Bank02_02D027(uint8 k); +void SubOffscreen_Bank02_02D027(uint8 k, uint8 r3); void SubOffscreen_Bank02_Entry1(uint8 k); void SubOffscreen_Bank02_Entry2(uint8 k); void SubOffscreen_Bank02_Entry3(uint8 k); @@ -1175,27 +1203,27 @@ void UpdateExtendedSpritePosition_Y(uint8 k); void UpdateMinorExtendedSpritePosition_X(uint8 k); void UpdateMinorExtendedSpritePosition_Y(uint8 k); void YoshiStompRoutine(void); -void sub_284A6(uint8 k, uint8 a); +void sub_284A6(uint8 k, uint8 a, uint8 r0, uint8 r2); void sub_2D091(uint8 k); void sub_2DFD0(uint8 k, uint8 a); void sub_2E980(uint8 k, uint8 a); // Bank 3 -uint8 InitializeMode7TilemapsAndPalettes_03DE39(uint8 k, uint8 j); -uint8 InitializeMode7TilemapsAndPalettes_03DE3C(uint8 k, uint8 j); +uint8 InitializeMode7TilemapsAndPalettes_03DE39(uint8 k, uint8 j, const uint8 *p0); +uint8 InitializeMode7TilemapsAndPalettes_03DE3C(uint8 k, uint8 j, const uint8 *p0); uint8 Spr07C_PrincessPeach_03ADCC(uint8 k); uint8 Spr0A0_ActivateBowserBattle_ReturnsTwice_03A5AD(uint8 k); uint8 Spr0A0_ActivateBowserBattle_ReturnsTwice_03A661(uint8 k); -uint8 StandardSpriteToSpriteCollisionChecks_CheckContact(void); +uint8 StandardSpriteToSpriteCollisionChecks_CheckContact(CollInfo *ci); void DespawnNonBossSprites(void); void FadingBooPaletteAnimation(void); -void GameMode12_PrepareLevel_03D991(void); +void GameMode12_PrepareLevel_03D991(const uint8 *p5, uint16 r0w); void GameMode12_PrepareLevel_UploadTiltingPlatformTilemap(void); void GameMode14_InLevel_03C0C6(void); void GameMode14_InLevel_03C11E(void); void HandleNormalSpriteLevelColl_03C1CA(uint8 k); void InitializeMode7TilemapsAndPalettes_BufferReznorWallTilemap(void); -void InitializeMode7TilemapsAndPalettes_BufferTilemap(void); +const uint8 *InitializeMode7TilemapsAndPalettes_BufferTilemap(uint16 **dstp, const uint8 *p0); void InitializeMode7TilemapsAndPalettes(uint8 k); void NormalSpriteBooDraw(uint8 k); void SpawnFootball(uint8 k); @@ -1220,7 +1248,7 @@ void Spr030_ThrowingDryBones_SpawnDryBonesBone(uint8 k); void Spr051_Ninji(uint8 k); void Spr054_ClimbingNetDoor_UpdateClimbingNetDoorTiles(uint8 k, uint8 a); void Spr06F_DinoTorch(uint8 k); -void Spr06F_DinoTorch_DinoFlameClipping(uint8 k); +void Spr06F_DinoTorch_DinoFlameClipping(uint8 k, CollInfo *ci); void Spr06F_DinoTorch_DinoSetGfxFrame(uint8 k); void Spr06F_DinoTorch_Draw(uint8 k); void Spr06F_DinoTorch_Return039F37(void); @@ -1240,8 +1268,8 @@ void Spr07C_PrincessPeach_DisplayPeachRescueMessage(void); void Spr07C_PrincessPeach_FadeText(uint8 k); void Spr07C_PrincessPeach_Fireworks(uint8 k); void Spr07C_PrincessPeach_FloatingDown(uint8 k); -void Spr07C_PrincessPeach_GFXRt_DrawHELP(uint8 k, uint8 j); -void Spr07C_PrincessPeach_GFXRt_DrawPeach(uint8 k, uint8 j); +void Spr07C_PrincessPeach_GFXRt_DrawHELP(uint8 k, uint8 j, uint8 r2, uint8 r3); +void Spr07C_PrincessPeach_GFXRt_DrawPeach(uint8 k, uint8 j, PointU8 pt, uint8 r3); void Spr07C_PrincessPeach_KissBro(uint8 k); void Spr07C_PrincessPeach_StandByBro(uint8 k); void Spr07C_PrincessPeach_WaitAfterFall(uint8 k); @@ -1257,7 +1285,7 @@ void Spr0A0_ActivateBowserBattle_03A8D6(uint8 k); void Spr0A0_ActivateBowserBattle_03AC63(uint8 k); void Spr0A0_ActivateBowserBattle_03AF59(uint8 k); void Spr0A0_ActivateBowserBattle_03B019(uint8 k); -void Spr0A0_ActivateBowserBattle_03B020(uint8 k); +void Spr0A0_ActivateBowserBattle_03B020(uint8 k, uint8 r2); void Spr0A0_ActivateBowserBattle_03B078(uint8 k); void Spr0A0_ActivateBowserBattle_03B0D2(uint8 k); void Spr0A0_ActivateBowserBattle_03B0D6(uint8 k); @@ -1317,7 +1345,7 @@ void Spr0B1_CreateEatBlock_GenTileFromSpr1(uint8 k, uint8 a); void Spr0B2_FallingSpike(uint8 k); void Spr0B3_BowserStatueFire(uint8 k); void Spr0B3_BowserStatueFire_Draw(uint8 k); -void Spr0B7_CarrotTopLiftUpperRight_038CE4(uint8 k); +void Spr0B7_CarrotTopLiftUpperRight_038CE4(uint8 k, CollInfo *ci); void Spr0B7_CarrotTopLiftUpperRight_Draw(uint8 k); void Spr0B8_CarrotTopLiftUpperLeft(uint8 k); void Spr0B9_MessageBox(uint8 k); @@ -1368,10 +1396,10 @@ void SprXXX_ReflectingEnemy_ReflectingBooBuddiesEntry(uint8 k); void SprXXX_ReflectingEnemy_ReflectingPodobooEntry(uint8 k); void SprXXX_ReflectingEnemy_ReflectingPodobooDraw(uint8 k); void SprXXX_ReflectingEnemy_SpawnTrailingBoo(uint8 k); -void StandardSpriteToSpriteCollisionChecks_GetMarioClipping(void); -void StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(uint8 k); -void StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(uint8 k); -void SubOffscreen_Bank03_03B85F(uint8 k); +void StandardSpriteToSpriteCollisionChecks_GetMarioClipping(CollInfo *ci); +void StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(uint8 k, CollInfo *ci); +void StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(uint8 k, CollInfo *ci); +void SubOffscreen_Bank03_03B85F(uint8 k, uint8 r3); void SubOffscreen_Bank03_Entry1(uint8 k); void SubOffscreen_Bank03_Entry4(uint8 k); void TriggerHidden1up(void); @@ -1380,51 +1408,56 @@ void UpdateMode7SpriteAnimations(uint8 k); void sub_3CDDA(uint8 k, uint8 a); // Bank 4 -uint16 CalculateOverworldPlayerPosition(uint8 k); +uint16 CalculateOverworldPlayerPosition(uint8 k, uint16 r0w, uint16 r2w); uint16 LoadOverworldLayer1AndEvents_InitializedOverworldLayer1Tilemap(uint16 k, uint8 a); -void AddZPositionToTempYPos(uint8 k); uint8 CheckPlayerToOverworldSpriteCollision(uint8 k); uint8 CheckIfXIsAllowedOnYSubmap_Lightning(uint8 a); uint8 CheckIfXIsAllowedOnYSubmap_Sprites(uint8 k); -uint8 DrawFlyingSwitchBlocks_04F39C(uint8 k, uint8 j); -uint8 DrawOverworldPlayer_DrawCurrentPlayer(uint8 k, uint8 j); -uint8 DrawOverworldSpriteShadow_04FE45(uint8 j, uint8 a); +uint16 DrawFlyingSwitchBlocks_04F39C(uint8 k, uint8 j); +uint8 DrawOverworldPlayer_DrawCurrentPlayer(uint8 k, uint8 j, PointU8 pt, uint8 tmp8c, uint16 r4w, uint8 r6); +uint8 DrawOverworldSpriteShadow_04FE45(uint8 j, uint8 a, PointU16 pt, uint8 r4, uint8 r5); bool HandleOverworldStarPipeWarp_GetIndex(void); -uint8 OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(uint8 j, uint16 a); -uint8 OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(uint8 j, uint16 a, uint8 cr); +uint8 OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(uint8 j, uint16 a, PointU16 pt); +uint8 OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(uint8 j, uint16 a, uint8 cr, PointU16 pt); uint8 SetOverworldSpriteFrameIndex(uint8 k); -void BufferEventTileToLayer2Tilemap_Buffer2x2Tile(uint16 k, uint16 j); -void BufferEventTileToLayer2Tilemap_Buffer6x6Tile(uint16 k, uint16 j); -void BufferEventTileToLayer2Tilemap_Entry2(uint16 k, uint16 j); +void BufferEventTileToLayer2Tilemap_Buffer2x2Tile(uint16 k, uint16 j, uint16 r4, const uint8 *r6, const uint8 *r9); +void BufferEventTileToLayer2Tilemap_Buffer6x6Tile(uint16 k, uint16 j, uint16 r4, const uint8 *r6, const uint8 *r9); +void BufferEventTileToLayer2Tilemap_Entry2(uint16 k, uint16 j, uint16 r4); void BufferEventTileToLayer2Tilemap(void); -uint16 BufferEventTileToStripeImageTable_Buffer2x2Tile(void); -uint16 BufferEventTileToStripeImageTable_Buffer6x6Tile(void); -void BufferOverworldLayer2Tilemap(uint16 k, uint16 j); -void CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(uint8 k); +uint16 BufferEventTileToStripeImageTable_Buffer2x2Tile(uint16 r0w, uint16 r2w, uint16 r10, const uint8 *r12); +uint16 BufferEventTileToStripeImageTable_Buffer6x6Tile(uint16 r0w, uint16 r2w, uint16 r10, const uint8 *r12); +void BufferOverworldLayer2Tilemap(uint16 k, uint16 j, uint16 r14w, const uint8 *p0); +typedef struct OwHvPos { + uint16 r0; + uint16 r2; + uint16 r6; + uint16 r8; +} OwHvPos; +OwHvPos CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(uint8 k); uint16 CheckIfDestroyTileEventIsActive(uint8 a); void DisplayOwPrompt(uint8 a); void DrawFlyingSwitchBlocks(void); -void DrawOverworldPlayer_DrawHalo(uint16 k); +void DrawOverworldPlayer_DrawHalo(uint16 k, uint16 r4, PointU8 pt); void DrawOverworldPlayer(void); void DrawOverworldSpriteShadow(uint8 k, uint8 cr); void GameMode0C_LoadOverworld_048D91(void); void GameMode0C_LoadOverworld_048E55(void); void GameMode0E_ShowOverworld_Bank04(void); void GameMode0E_ShowOverworld_UpdateMainMapFreeScrollingPosition(uint8 k, uint8 a); -void GetOverworldSpriteOnScreenPosition(uint8 k); -void GetOverworldSpriteOnScreenPosition_Y(uint8 k, uint8 j); -void GetXAndYDispOfCurrentEventTileSprite(void); +PointU16 GetOverworldSpriteOnScreenPosition(uint8 k); +uint16 GetOverworldSpriteOnScreenPosition_Y(uint8 k, uint8 j); +PointU8 GetXAndYDispOfCurrentEventTileSprite(void); void HandleCurrentOverworldProcess(void); void HandleOverworldPathExits(void); void HandleOverworldPathExits_SetLayerPositions(void); void HandleOverworldStarPipeWarp_SetPlayerDestination(void); void InitializeOverworldTilemaps(void); void LoadOverworldLayer1AndEvents_04D7F2(void); -void LoadOverworldLayer1AndEvents_04DA49(void); +void LoadOverworldLayer1AndEvents_04DA49(uint8 r15); void LoadOverworldLayer1AndEvents(void); void LoadOverworldLayer2AndEventsTilemaps_04DD40(void); -void LoadOverworldLayer2AndEventsTilemaps_04DD57(uint16 k, uint16 j); -void LoadOverworldLayer2AndEventsTilemaps_04E453(void); +void LoadOverworldLayer2AndEventsTilemaps_04DD57(uint16 k, uint16 j, const uint8 *p2); +void LoadOverworldLayer2AndEventsTilemaps_04E453(uint8 r15); void LoadOverworldLayer2AndEventsTilemaps(void); void LoadOverworldLayer2AndEventsTilemaps_Sub(void); void LoadOverworldSprites(void); @@ -1435,22 +1468,22 @@ void OWSpr02_BlueBird(uint8 k); void OWSpr03_CheepCheep_04FA7D(uint8 k); void OWSpr03_CheepCheep_04FA83(uint8 k); void OWSpr03_CheepCheep(uint8 k); -uint8 OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(uint8 k, uint16 a); +uint8 OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(uint8 k, uint16 a, PointU16 pt); void OWSpr04_PiranhaPlant(uint8 k); -void OWSpr05_Cloud_04FB77(uint8 a); -void OWSpr05_Cloud_04FB7A(uint16 a); -void OWSpr05_Cloud_04FB7B(uint16 a, uint8 cr); +void OWSpr05_Cloud_04FB77(uint8 a, PointU16 pt); +void OWSpr05_Cloud_04FB7A(uint16 a, PointU16 pt); +void OWSpr05_Cloud_04FB7B(uint16 a, uint8 cr, PointU16 pt); void OWSpr05_Cloud(uint8 k); void OWSpr06_KoopaKid(uint8 k); void OWSpr07_Smoke(uint8 k); void OWSpr08_BowserSign(uint8 k); void OWSpr09_Bowser_04FD55(uint8 k, uint8 j); void OWSpr09_Bowser(uint8 k); -void OWSpr0A_Boo_04FDD2(uint8 k, uint8 a); +void OWSpr0A_Boo_04FDD2(uint8 k, uint8 a, uint8 r0); void OWSpr0A_Boo(uint8 k); void OwEventProcess00_CheckIfEventShouldRun(void); void OwEventProcess01_DestroyTileAnimation_04ED83(void); -void OwEventProcess01_DestroyTileAnimation_04EDE6(uint16 k, uint16 j); +void OwEventProcess01_DestroyTileAnimation_04EDE6(uint16 k, uint16 j, uint16 r0w, const uint8 *p); void OwEventProcess01_DestroyTileAnimation_04EEAA(void); void OwEventProcess02_SetEventTileIndexes(void); void OwEventProcess03_GetLayer2Tile_04EA62(void); @@ -1484,7 +1517,7 @@ void OwPrompt02_ExpandPromptWindow(void); void OwPrompt03_OverworldLifeExchanger_04F60E(uint8 k, uint8 j, uint8 a); void OwPrompt03_OverworldLifeExchanger(void); void OwPrompt07_DisplayingSavePrompt(void); -void OwTileAnimations_0480B9(uint16 k); +void OwTileAnimations_0480B9(uint16 k, const uint8 *p0); void OwTileAnimations_048172(uint8 k); void OwTileAnimations(void); void OwTileAnimations_ShiftWaterTiles(void); @@ -1494,8 +1527,8 @@ void SubmapSwitchProcess05_UpdatePalette(void); void SubmapSwitchProcess06_EndWindowHDMA(void); void SubmapSwitchProcess07_EndSubmapSwitch(void); void UnlockOverworldPathBasedOnExit(void); -uint16 UpdateLevelName_049D7F(uint16 j, uint16 k); -void UpdateLevelName(void); +uint16 UpdateLevelName_049D7F(uint16 j, uint16 k, uint16 r2w); +void UpdateLevelName(uint16 r0w); void UpdateOverworldSpritePosition(uint8 k); void UpdateOverworldSpritePosition_X(uint8 k); void UpdateSaveBuffer(void); @@ -1506,9 +1539,9 @@ void sub_485A7(void); uint16 InitializeLevelData_Hi(uint16 k, uint8 a); uint16 InitializeLevelData_Lo(uint16 k, uint8 a); uint8 UnusedOverworldEventPassedCheck(uint8 j); -void AdjustTimeBonusDisplay(uint8 k, uint8 j); +void AdjustTimeBonusDisplay(uint8 k, uint8 j, uint16 R0_W_, uint16 r2w); void BeginLoadingLevelData(void); -void BufferBGTilemap(void); +void BufferBGTilemap(uint8 *r13); void BufferScrollingTiles_Layer1_Main(void); void BufferScrollingTiles_Layer1_Init(void); void BufferScrollingTiles_Layer1(void); @@ -1521,7 +1554,7 @@ void BufferScrollingTiles_Layer2(void); void BufferScrollingTiles_Layer2_NoScroll(void); void BufferScrollingTiles_Layer2_VerticalLevel(void); void CalculateRowOrColumnOfTilemapToUpdate(void); -void CalculateTimeBonusDigits(void); +uint16 CalculateTimeBonusDigits(void); void CheckIfLevelTilemapsNeedScrollUpdate(void); void DisplayCourseClearTextBonusStars(void); void DisplayMessage_DrawSwitchBlocks(uint8 k); @@ -1606,7 +1639,7 @@ void UpdateLayerPositionWithScrollSprite(uint8 k); void sub_5B165(uint8 a); // Bank 7 -uint8 Spr07B_GoalTape_07F200(uint8 k, uint8 j); +uint8 Spr07B_GoalTape_07F200(uint8 k, uint8 j, uint16 R2, uint16 r4); void InitializeNormalSpriteRAMTables_ClearTables(uint8 k); void InitializeNormalSpriteRAMTables(uint8 k); void InitializeNormalSpriteRAMTables_PropertyTables(uint8 k); @@ -1617,8 +1650,8 @@ void Spr07B_GoalTape_BonusStarNumbersDraw(uint8 k); void Spr07B_GoalTape_GiveBonusStars(uint8 k); // Bank C -void BufferCreditsBackgrounds_0C944C(void); -void BufferCreditsBackgrounds_0C94C0(void); +void BufferCreditsBackgrounds_0C944C(uint16 r13w, const uint8 *src); +void BufferCreditsBackgrounds_0C94C0(uint16 mask); void BufferCreditsBackgrounds(void); void CarryEggAwayFromCastle(void); void CheckIfPlayerCanEndCastleDestructionCutscene(void); @@ -1630,22 +1663,22 @@ void CreditsFadeOut(void); void CreditsFadeOut(void); void DelayTNTExplosionUntilPlayerComesBy(void); void DisplayCastleDestructionText(void); -void DrawCameraFacingEndingYoshis_BlueYoshi(uint8 k, uint8 j); -void DrawCastleDestructionCastleDoor_Entry3(uint8 k); +void DrawCameraFacingEndingYoshis_BlueYoshi(uint8 k, uint8 j, uint8 r14, uint8 r0, uint8 r2); +void DrawCastleDestructionCastleDoor_Entry3(uint8, uint8 r0, uint8 r1, uint8 r2); void DrawCastleDestructionCastleDoor(void); -void DrawCreditsPeachRedAndYellowYoshi_Peach(uint8 k, uint8 j); +void DrawCreditsPeachRedAndYellowYoshi_Peach(uint8 k, uint8 j, uint16 r0w, uint8 r2); void DrawCutsceneContactEffect(void); -void DrawEndingBabyYoshis(void); -void DrawEndingThankYou_0CA183(uint8 k, uint8 j); -void DrawEndingThankYou_Entry2(uint8 k, uint8 j); +void DrawEndingBabyYoshis(uint8 r2); +uint8 DrawEndingThankYou_0CA183(uint8 k, uint8 j, uint16 r8, uint16 r0w, uint16 r2); +void DrawEndingThankYou_Entry2(uint8 k, uint8 j, uint16 r0w, uint16 r4, uint16 r8); void DrawEndingThankYou(void); -void DrawLeaningEndingYoshis(uint8 k, uint8 j); +void DrawLeaningEndingYoshis(uint8 k, uint8 j, uint8 r0, uint8 r2); void DrawPlayerCough_MortonCutscene(void); void DrawPlayerCough_RoyCutscene(void); void DrawQuestionMark(void); void DrawTNTFuseBox(void); void DrawThankYouSpeechBubble(void); -void DrawWhiteFlag(uint8 k); +void DrawWhiteFlag(uint8 k, uint8 r0); void DrawWoodHammer(void); void DrawingTheEndMarioLuigiAndPeach(void); void EveryoneCheeringDuringEnding(void); @@ -1660,7 +1693,7 @@ void GameMode19_Cutscene_RoyCutscene(void); void GameMode19_Cutscene_WendyCutscene(void); void GameMode1B_EndingCinema_Bank0C(void); void GameMode1B_EndingCinema_BufferNextRowOfCredits(void); -void GameMode1B_EndingCinema_0C9FCB(uint8 k); +uint16 GameMode1B_EndingCinema_0C9FCB(uint8 k); void GameMode1B_EndingCinema_Sub(void); void GameMode1D_LoadYoshisHouse_Bank0C(void); void GameMode1D_LoadYoshisHouse_0CA1D4(void); @@ -1701,7 +1734,7 @@ void InitializeFarawayCastleRocket(void); void InitializeTNTExplosion(void); void KickCastleAway(void); void KickedCastleCreatesQuake(void); -void MakeCreditsEggsBounce(void); +void MakeCreditsEggsBounce(uint8 r14); void PlayerDropkicksAndStompsCastle(void); void ProcessCheeringYoshis(void); void ProcessHammerDebris(void); @@ -1872,6 +1905,7 @@ void RopeObj3E_HorizontalLog(uint8 k); void RopeObj3F_VerticalLog(uint8 k); void SetMap16HighByteForCurrentObject_Page00(uint8 j); void SetMap16HighByteForCurrentObject_Page01(uint8 j); +void SetMap16LowByte(uint16 j, uint8 a); void StdObj05_Coins(uint8 k); void StdObj0F_VerticalPipes(uint8 k); void StdObj10_HorizontalPipes(uint8 k); @@ -1899,15 +1933,15 @@ void StdObj1E_ClimbingNetWithSideEdge_0DB4FE(uint8 k, uint8 j, uint8 a); void StdObj1E_ClimbingNetWithSideEdge(uint8 k); void StdObj1F_SkinnyVerticalPipeBoneLog(uint8 k); void StdObj20_SkinnyHorizontalPipeBoneLog(uint8 k); -void StdObj21_WideScaleGroundLedge_0DB1E3(uint8 k); +void StdObj21_WideScaleGroundLedge_0DB1E3(uint8 k, uint8 r0, uint8 r2); void StdObj21_WideScaleGroundLedge(uint8 k); void StdObj21_WideScaleGroundLedge_StandardLedgeEntry(uint8 k); void StdObjXX_Generic1RepeatedTileObject_IcyTurnBlockEntry(uint8 k); void UndergroundObj36_4SidedGround(uint8 k); void UndergroundObj37_LargeCanvas(uint8 k); -void UndergroundObj38_RightLavaEdge_0DDAE8(uint8 k, uint8 j, uint8 a); +void UndergroundObj38_RightLavaEdge_0DDAE8(uint8 k, uint8 j, uint8 a, uint8 r0); void UndergroundObj38_RightLavaEdge(uint8 k); -void UndergroundObj39_SlopedCaveLava_0DDBA4(uint8 j); +void UndergroundObj39_SlopedCaveLava_0DDBA4(uint8 j, uint8 r0, uint8 r2); void UndergroundObj39_SlopedCaveLava(uint8 k); void UndergroundObj39_SlopedCaveLavaLeftSlope(void); void UndergroundObj39_SlopedCaveLavaRightSlope(void); diff --git a/src/main.c b/src/main.c index 7bc4608..f3441af 100644 --- a/src/main.c +++ b/src/main.c @@ -41,7 +41,7 @@ void OpenGLRenderer_Create(struct RendererFuncs *funcs); bool g_debug_flag; bool g_want_dump_memmap_flags; bool g_new_ppu = true; -bool g_other_image; +bool g_other_image = false; struct SpcPlayer *g_spc_player; static uint32_t button_state; @@ -157,6 +157,8 @@ static SDL_HitTestResult HitTestCallback(SDL_Window *win, const SDL_Point *pt, v } void RtlDrawPpuFrame(uint8 *pixel_buffer, size_t pitch, uint32 render_flags) { + g_rtl_game_info->draw_ppu_frame(); + uint8 *ppu_pixels = g_other_image ? g_my_pixels : g_pixels; for (size_t y = 0, y_end = g_snes_height; y < y_end; y++) memcpy((uint8 *)pixel_buffer + y * pitch, ppu_pixels + y * 256 * 4, 256 * 4); diff --git a/src/smw.vcxproj b/src/smw.vcxproj index 4db3b3e..e4bad1a 100644 --- a/src/smw.vcxproj +++ b/src/smw.vcxproj @@ -1,4 +1,4 @@ - + @@ -38,7 +38,7 @@ Application true - v143 + v142 Application @@ -131,6 +131,7 @@ $(CoreLibraryDependencies);%(AdditionalDependencies) + DebugFastLink diff --git a/src/smw_00.c b/src/smw_00.c index fadf99a..5a9f31c 100644 --- a/src/smw_00.c +++ b/src/smw_00.c @@ -21,7 +21,7 @@ static FuncV *const kInitAndMainLoop_GameModePtrs[42] = { &GameMode0E_ShowOverworld, &GameModeXX_FadeInOrOut_MosaicFade, &GameMode10_BufferLevelLoadMessage, - &GameMode11_LoadSublevel_SA1Pack_OptimizeThisRoutine1, + &GameMode11_LoadSublevel_0096D5, &GameMode12_PrepareLevel, &GameModeXX_FadeInOrOut_MosaicFade, &GameMode14_InLevel, @@ -47,7 +47,9 @@ static FuncV *const kInitAndMainLoop_GameModePtrs[42] = { &GameMode28_ShowTheEnd, &GameMode29_DoNothingOnTheEndScreen, }; -static FuncV *const kGenerateTile_TileGenerationPtr[27] = { + +typedef void TileGenFunc(GenTileArgs *gta); +static TileGenFunc *const kGenerateTile_TileGenerationPtr[27] = { &sub_C074, &sub_C077, &sub_C077, @@ -93,15 +95,246 @@ static FuncV *const kGameMode14_InLevel_PlayerStatePtrs[14] = { &GameMode14_InLevel_Return00C592, }; +static const uint8 kCompressOAMTileSizeBuffer_DATA_008475[31] = { 0x0, 0x0, 0x8, 0x0, 0x10, 0x0, 0x18, 0x0, 0x20, 0x0, 0x28, 0x0, 0x30, 0x0, 0x38, 0x0, 0x40, 0x0, 0x48, 0x0, 0x50, 0x0, 0x58, 0x0, 0x60, 0x0, 0x68, 0x0, 0x70, 0x0, 0x78, }; +static const uint8 kClearLayer3Tilemap_PARAMS_008649[7] = { 0x8, 0x18, 0x0, 0x0, 0x0, 0x0, 0x10, }; +static const uint8 kUploadLevelLayer1And2Tilemaps_PARAMS_008A16[7] = { 0x1, 0x18, 0xe6, 0x1b, 0x0, 0x40, 0x0, }; +static const uint8 kUploadLevelLayer1And2Tilemaps_PARAMS_008A1D[7] = { 0x1, 0x18, 0x26, 0x1c, 0x0, 0x2c, 0x0, }; +static const uint8 kUploadLevelLayer1And2Tilemaps_PARAMS_008A24[7] = { 0x1, 0x18, 0x66, 0x1c, 0x0, 0x40, 0x0, }; +static const uint8 kUploadLevelLayer1And2Tilemaps_PARAMS_008A2B[7] = { 0x1, 0x18, 0xa6, 0x1c, 0x0, 0x2c, 0x0, }; +static const uint8 kUploadLevelLayer1And2Tilemaps_PARAMS_008A32[7] = { 0x1, 0x18, 0xe8, 0x1c, 0x0, 0x40, 0x0, }; +static const uint8 kUploadLevelLayer1And2Tilemaps_PARAMS_008A39[5] = { 0x1, 0x18, 0x28, 0x1d, 0x0, }; +static const uint8 kUploadLevelLayer1And2Tilemaps_PARAMS_008A40[7] = { 0x1, 0x18, 0x68, 0x1d, 0x0, 0x40, 0x0, }; +static const uint8 kUploadLevelLayer1And2Tilemaps_PARAMS_008A47[5] = { 0x1, 0x18, 0xa8, 0x1d, 0x0, }; +static const uint16 kManipulateMode7Image_DATA_008AB4[4] = { 0x0, 0xfe, 0x0, 0xfe, }; +static const uint16 kManipulateMode7Image_DATA_008ABC[4] = { 0x0, 0x2, 0x0, 0x2, }; +static const uint8 kStatusBarTilemap_SecondRow[118] = { 0x30, 0x28, 0x31, 0x28, 0x32, 0x28, 0x33, 0x28, 0x34, 0x28, 0xfc, 0x38, 0xfc, 0x3c, 0xfc, 0x3c, 0xfc, 0x3c, 0xfc, 0x3c, 0xfc, 0x38, 0xfc, 0x38, 0x4a, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x4a, 0x78, 0xfc, 0x38, 0x3d, 0x3c, 0x3e, 0x3c, 0x3f, 0x3c, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x2e, 0x3c, 0x26, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x0, 0x38, 0x26, 0x38, 0xfc, 0x38, 0x0, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x64, 0x28, 0x26, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x4a, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x4a, 0x78, 0xfc, 0x38, 0xfe, 0x3c, 0xfe, 0x3c, 0x0, 0x3c, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x0, 0x38, 0x3a, 0xb8, 0x3b, 0xb8, 0x3b, 0xb8, 0x3a, 0xf8, }; +static const uint8 kInitializeStatusBarTilemap_PARAMS_008D90[7] = { 0x1, 0x18, 0x81, 0x8c, 0x0, 0x8, 0x0, }; +static const uint8 kInitializeStatusBarTilemap_PARAMS_008D97[7] = { 0x1, 0x18, 0x89, 0x8c, 0x0, 0x38, 0x0, }; +static const uint8 kInitializeStatusBarTilemap_PARAMS_008D9E[7] = { 0x1, 0x18, 0xc1, 0x8c, 0x0, 0x36, 0x0, }; +static const uint8 kInitializeStatusBarTilemap_PARAMS_008DA5[7] = { 0x1, 0x18, 0xf7, 0x8c, 0x0, 0x8, 0x0, }; +static const uint8 kUploadStatusBarTilemap_PARAMS_StBr1[7] = { 0x0, 0x18, 0xf9, 0xe, 0x0, 0x1c, 0x0, }; +static const uint8 kUploadStatusBarTilemap_PARAMS_StBr2[7] = { 0x0, 0x18, 0x15, 0xf, 0x0, 0x1b, 0x0, }; +static const uint8 kUpdateStatusBarCounters_DATA_008DF5[5] = { 0x40, 0x41, 0x42, 0x43, 0x44, }; +static const uint8 kUpdateStatusBarCounters_ItemBoxItemTile[4] = { 0x24, 0x26, 0x48, 0xe, }; +static const uint8 kUpdateStatusBarCounters_StarPaletteFrames[4] = { 0x0, 0x2, 0x4, 0x2, }; +static const uint8 kUpdateStatusBarCounters_ItemBoxItemProperties[4] = { 0x8, 0xa, 0x0, 0x4, }; +static const uint8 kUpdateStatusBarCounters_BonusStarCounterNumberTiles[20] = { 0xb7, 0xc3, 0xb8, 0xb9, 0xba, 0xbb, 0xba, 0xbf, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc3, 0xc1, 0xb9, 0xc2, 0xc4, 0xb7, 0xc5, }; +static const uint16 kUpdateStatusBarCounters_DATA_008FFA[12] = { 0x1, 0x86a0, 0x0, 0x2710, 0x0, 0x3e8, 0x0, 0x64, 0x0, 0xa, 0x0, 0x1, }; +static const uint8 kDrawLoadingLetters_TileData[52] = { 0x0, 0xff, 0x4d, 0x4c, 0x3, 0x4d, 0x5d, 0xff, 0x3, 0x0, 0x4c, 0x3, 0x4, 0x15, 0x0, 0x2, 0x0, 0x4a, 0x4e, 0xff, 0x4c, 0x4b, 0x4a, 0x3, 0x5f, 0x5, 0x4, 0x3, 0x2, 0x0, 0xff, 0x1, 0x4a, 0x5f, 0x5, 0x4, 0x0, 0x4d, 0x5d, 0x3, 0x2, 0x1, 0x0, 0xff, 0x5b, 0x14, 0x5f, 0x1, 0x5e, 0xff, 0xff, 0xff, }; +static const uint8 kDrawLoadingLetters_TileData_BottomTiles[52] = { 0x10, 0xff, 0x0, 0x5c, 0x13, 0x0, 0x5d, 0xff, 0x3, 0x0, 0x5c, 0x13, 0x14, 0x15, 0x0, 0x12, 0x0, 0x3, 0x5e, 0xff, 0x5c, 0x4b, 0x5a, 0x3, 0x5f, 0x5, 0x14, 0x13, 0x12, 0x10, 0xff, 0x11, 0x3, 0x5f, 0x5, 0x14, 0x0, 0x0, 0x5d, 0x3, 0x12, 0x11, 0x10, 0xff, 0x5b, 0x1, 0x5f, 0x1, 0x5e, 0xff, 0xff, 0xff, }; +// oob +static const uint8 kDrawLoadingLetters_TileData_TopProp[52] = { 0x34, 0x0, 0x34, 0x34, 0x34, 0x34, 0x30, 0x0, 0x34, 0x34, 0x34, 0x34, 0x74, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x0, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x0, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0,0xB4 }; +static const uint8 kDrawLoadingLetters_TileData_BottomProp[52] = { 0x34, 0x0, 0xb4, 0x34, 0x34, 0xb4, 0xf0, 0x0, 0xb4, 0xb4, 0x34, 0x34, 0x74, 0xb4, 0xb4, 0x34, 0xb4, 0xb4, 0x34, 0x0, 0x34, 0xb4, 0x34, 0xb4, 0xb4, 0xb4, 0x34, 0x34, 0x34, 0x34, 0x0, 0x34, 0xb4, 0xb4, 0xb4, 0x34, 0xb4, 0xb4, 0xb4, 0xb4, 0x34, 0x34, 0x34, 0x34, 0xf4, 0xb4, 0xf4, 0xb4, 0xb4, 0xa5, 0x71, 0xc9 }; + +static const uint8 kUpdateEntirePalette_PARAMS_009249[7] = { 0x0, 0x22, 0x3, 0x7, 0x0, 0x0, 0x2, }; +static const uint8 kGameMode00_LoadNintendoPresents_XDisp[4] = { 0x60, 0x70, 0x80, 0x90, }; +static const uint8 kGameMode00_LoadNintendoPresents_Tiles[4] = { 0x2, 0x4, 0x6, 0x8, }; +const uint8 kGameMode19_Cutscene_SkyColorSetting[8] = { 0x2, 0x0, 0x4, 0x1, 0x0, 0x6, 0x4, 0x3, }; +static const uint8 kGameMode19_Cutscene_BGPaletteSetting[8] = { 0x6, 0x5, 0x6, 0x3, 0x3, 0x6, 0x6, 0x3, }; +static const uint8 kGameMode19_Cutscene_BGToUse[7] = { 0xff, 0xff, 0xc9, 0xf, 0xff, 0xcc, 0xc9, }; +static const uint16 kUploadMode7KoopaBossesAndLavaAnimation_VRAMAddressToUpload[12] = { 0x129e, 0x121e, 0x119e, 0x111e, 0x161e, 0x159e, 0x151e, 0x149e, 0x141e, 0x139e, 0x131e, 0x169e, }; +static const uint8 kHandleMenuCursor_DATA_009AC8[3] = { 0x1, 0xff, 0xff, }; +static const uint8 kGameMode09_EraseFile_DATA_009B17[3] = { 0x4, 0x2, 0x1, }; +// todo: oob +static const uint8 kGameMode07_TitleScreenDemo_ItrCntrlrSqnc[70] = { 0x41, 0xf, 0xc1, 0x30, 0x0, 0x10, 0x42, 0x20, 0x41, 0x70, 0x81, 0x11, 0x0, 0x80, 0x82, 0xc, 0x0, 0x30, 0xc1, 0x30, 0x41, 0x60, 0xc1, 0x10, 0x0, 0x40, 0x1, 0x30, 0xe1, 0x1, 0x0, 0x60, 0x41, 0x4e, 0x80, 0x10, 0x0, 0x30, 0x41, 0x58, 0x0, 0x20, 0x60, 0x1, 0x0, 0x30, 0x60, 0x1, 0x0, 0x30, 0x60, 0x1, 0x0, 0x30, 0x60, 0x1, 0x0, 0x30, 0x60, 0x1, 0x0, 0x30, 0x41, 0x1a, 0xc1, 0x30, 0x0, 0x30, 0xff, 0x20 }; +static const uint8 kSaveFileLocations_Hi[3] = { 0x0, 0x0, 0x1, }; +static const uint8 kSaveFileLocations_Lo[3] = { 0x0, 0x8f, 0x1e, }; +static const uint16 kHandleMenuCursor_DATA_009E6A[5] = { 0x2, 0x4, 0x2, 0x2, 0x4, }; +static const uint16 kHandleMenuCursor_DATA_009E74[5] = { 0x51cb, 0x51e8, 0x5208, 0x51c4, 0x51e5, }; +static const uint8 kHandleMenuCursor_DATA_009E7E[4] = { 0x1, 0x2, 0x4, 0x8, }; +static const uint16 kInitializeSaveData_InitialLevelFlags[8] = { 0x328, 0x14d, 0x152, 0x153, 0x85b, 0x25c, 0x457, 0x130, }; +static const uint8 kInitializeSaveData_InitialOWPlayerPos[22] = { 0x1, 0x1, 0x2, 0x0, 0x2, 0x0, 0x68, 0x0, 0x78, 0x0, 0x68, 0x0, 0x78, 0x0, 0x6, 0x0, 0x7, 0x0, 0x6, 0x0, 0x7, 0x0, }; +const uint8 kGameModeXX_FadeInOrOut_DATA_009F2F[2] = { 0x1, 0xff, }; +const uint8 kGameModeXX_FadeInOrOut_DATA_009F31[2] = { 0xf0, 0x10, }; +const uint8 kGameModeXX_FadeInOrOut_DATA_009F33[2] = { 0xf, 0x0, }; +static const uint8 kInitializeLevelLayer3_DATA_009F88[48] = { 0x1, 0x2, 0xc0, 0x1, 0x80, 0x81, 0x1, 0x2, 0xc0, 0x1, 0x2, 0x81, 0x1, 0x2, 0x80, 0x1, 0x2, 0x81, 0x1, 0x2, 0x81, 0x1, 0x2, 0xc0, 0x1, 0x2, 0xc0, 0x1, 0x2, 0x81, 0x1, 0x2, 0x80, 0x1, 0x2, 0x80, 0x1, 0x2, 0x80, 0x1, 0x2, 0x81, 0x1, 0x2, 0x81, 0x1, 0x2, 0x80, }; +static const uint16 kGameMode0C_LoadOverworld_DATA_00A06B[7] = { 0x0, 0xffef, 0xffef, 0xffef, 0xf0, 0xf0, 0xf0, }; +static const uint16 kGameMode0C_LoadOverworld_DATA_00A079[7] = { 0x0, 0xffd8, 0x80, 0x128, 0xffd8, 0x80, 0x128, }; +static const uint8 kGameMode14_InLevel_GrndShakeDispYLo[4] = { 0xfe, 0x0, 0x2, 0x0, }; +static const uint8 kGameMode14_InLevel_GrndShakeDispYHi[4] = { 0xff, 0x0, 0x0, 0x0, }; +static const uint8 kUploadOverworldLayer1And2Tilemaps_DATA_00A521[4] = { 0x0, 0x4, 0x8, 0xc, }; +static const uint8 kUploadOverworldLayer1And2Tilemaps_DATA_00A525[4] = { 0x0, 0x8, 0x10, 0x18, }; +static const uint8 kUploadOverworldLayer1And2Tilemaps_PARAMS_00A586[7] = { 0x1, 0x18, 0x0, 0x40, 0x7f, 0x0, 0x8, }; +static const uint8 kUploadOverworldLayer1And2Tilemaps_PARAMS_00A58D[7] = { 0x1, 0x18, 0x0, 0xe4, 0x7e, 0x0, 0x8, }; +static const uint8 kInitializeLevelRAM_DATA_00A60D[4] = { 0x0, 0x1, 0x1, 0x1, }; +static const uint16 kInitializeLevelRAM_DATA_00A611[4] = { 0xd, 0xfff3, 0xfffe, 0xfffe, }; +static const uint16 kInitializeLevelRAM_DATA_00A619[4] = { 0x0, 0x0, 0xa, 0 }; +static const uint8 kInitializeLevelRAM_DATA_00A621[4] = { 0x1A,0x1A, 0xA, 0xA, }; +static const uint8 kInitializeLevelRAM_DATA_00A625[16] = { 0x0, 0x80, 0x40, 0x0, 0x1, 0x2, 0x40, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, }; +static const uint8 kUploadGraphicsFiles_SpriteGFXList[104] = { 0x0, 0x1, 0x13, 0x2, 0x0, 0x1, 0x12, 0x3, 0x0, 0x1, 0x13, 0x5, 0x0, 0x1, 0x13, 0x4, 0x0, 0x1, 0x13, 0x6, 0x0, 0x1, 0x13, 0x9, 0x0, 0x1, 0x13, 0x4, 0x0, 0x1, 0x6, 0x11, 0x0, 0x1, 0x13, 0x20, 0x0, 0x1, 0x13, 0xf, 0x0, 0x1, 0x13, 0x23, 0x0, 0x1, 0xd, 0x14, 0x0, 0x1, 0x24, 0xe, 0x0, 0x1, 0xa, 0x22, 0x0, 0x1, 0x13, 0xe, 0x0, 0x1, 0x13, 0x14, 0x0, 0x0, 0x0, 0x8, 0x10, 0xf, 0x1c, 0x1d, 0x0, 0x1, 0x24, 0x22, 0x0, 0x1, 0x25, 0x22, 0x0, 0x22, 0x13, 0x2d, 0x0, 0x1, 0xf, 0x22, 0x0, 0x26, 0x2e, 0x22, 0x21, 0xb, 0x25, 0xa, 0x0, 0xd, 0x24, 0x22, 0x2c, 0x30, 0x2d, 0xe, }; +static const uint8 kUploadGraphicsFiles_FGAndBGGFXList[104] = { 0x14, 0x17, 0x19, 0x15, 0x14, 0x17, 0x1b, 0x18, 0x14, 0x17, 0x1b, 0x16, 0x14, 0x17, 0xc, 0x1a, 0x14, 0x17, 0x1b, 0x8, 0x14, 0x17, 0xc, 0x7, 0x14, 0x17, 0xc, 0x16, 0x14, 0x17, 0x1b, 0x15, 0x14, 0x17, 0x19, 0x16, 0x14, 0x17, 0xd, 0x1a, 0x14, 0x17, 0x1b, 0x8, 0x14, 0x17, 0x1b, 0x18, 0x14, 0x17, 0x19, 0x1f, 0x14, 0x17, 0xd, 0x7, 0x14, 0x17, 0x19, 0x1a, 0x14, 0x17, 0x14, 0x14, 0xe, 0xf, 0x17, 0x17, 0x1c, 0x1d, 0x8, 0x1e, 0x1c, 0x1d, 0x8, 0x1e, 0x1c, 0x1d, 0x8, 0x1e, 0x1c, 0x1d, 0x8, 0x1e, 0x1c, 0x1d, 0x8, 0x1e, 0x1c, 0x1d, 0x8, 0x1e, 0x1c, 0x1d, 0x8, 0x1e, 0x14, 0x17, 0x19, 0x2c, 0x19, 0x17, 0x1b, 0x18, }; +static const uint8 kUploadGraphicsFiles_DATA_00A9D2[4] = { 0x78, 0x70, 0x68, 0x60, }; +static const uint8 kUploadGraphicsFiles_DATA_00A9D6[4] = { 0x18, 0x10, 0x8, 0x0, }; +static const uint8 kBufferPalettesRoutines_DATA_00ABD3[12] = { 0x0, 0x18, 0x30, 0x48, 0x60, 0x78, 0x90, 0xa8, 0x0, 0x14, 0x28, 0x3c, }; +static const uint16 kBufferPalettesRoutines_DATA_00ABDF[7] = { 0x0, 0x38, 0x70, 0xa8, 0xe0, 0x118, 0x150, }; +static const uint8 kBufferPalettesRoutines_DATA_00AD1E[7] = { 0x1, 0x0, 0x3, 0x4, 0x3, 0x5, 0x2, }; +static const uint8 kUpdatePaletteFromIndexedTable_DATA_00AE41[3] = { 0x0, 0x5, 0xa, }; +static const uint8 kUpdatePaletteFromIndexedTable_DATA_00AE44[3] = { 0x20, 0x40, 0x80, }; +static const uint16 kHandlePaletteFades_DATA_00AE65[3] = { 0x1f, 0x3e0, 0x7c00, }; +static const uint16 kHandlePaletteFades_DATA_00AE6B[3] = { 0xffff, 0xffe0, 0xfc00, }; +static const uint16 kHandlePaletteFades_DATA_00AE71[3] = { 0x1, 0x20, 0x400, }; +static const uint16 kHandlePaletteFades_DATA_00AE77[64] = { 0x0, 0x0, 0x1, 0x0, 0x8000, 0x8000, 0x8020, 0x400, 0x8080, 0x8080, 0x8208, 0x1040, 0x8420, 0x8420, 0x8844, 0x2210, 0x8888, 0x8888, 0x9122, 0x4488, 0x9248, 0x9248, 0xa492, 0x4924, 0xa4a4, 0xa4a4, 0xa949, 0x5294, 0xaaaa, 0x5294, 0xaaaa, 0x5554, 0xaaaa, 0xaaaa, 0xd5aa, 0xaaaa, 0xd5aa, 0xd5aa, 0xd6b5, 0xad6a, 0xdada, 0xdada, 0xdb6d, 0xb6da, 0xedb6, 0xedb6, 0xeedd, 0xbb76, 0xeeee, 0xeeee, 0xf7bb, 0xddee, 0xfbde, 0xfbde, 0xfdf7, 0xefbe, 0xfefe, 0xfefe, 0xffdf, 0xfbfe, 0xfffe, 0xfffe, 0xffff, 0xfffe, }; +static const uint16 kHandlePaletteFades_DATA_00AEF7[16] = { 0x8000, 0x4000, 0x2000, 0x1000, 0x800, 0x400, 0x200, 0x100, 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1, }; +const uint16 kGlobalPalettes_Sky[8] = { 0x5b9f, 0x6ffb, 0x5d80, 0x0, 0x1d22, 0x24c3, 0x7393, 0x7fff, }; +static const uint16 kGlobalPalettes_BowserEnd[6] = { 0x0, 0x63fb, 0x30c, 0x20b, 0x1535, 0x1a5f, }; +static const uint16 kGlobalPalettes_B3CC[6] = { 0x0, 0x3434, 0x443a, 0x659f, 0x116, 0x27f, }; +const uint16 kGlobalPalettes_BowserLightningFlash[11] = { 0x0, 0x2ce7, 0x3d6b, 0x4def, 0x5e73, 0x6ef7, 0x7fff,0x7393, 0, 0x3FF,0x573B }; +static const uint16 kGlobalPalettes_Flashing[16] = { 0x2df, 0x35f, 0x27ff, 0x5fff, 0x73ff, 0x5fff, 0x27ff, 0x35f, 0x1bf, 0x1f, 0x1b, 0x18, 0x18, 0x1b, 0x1f, 0x1bf, }; +static const uint16 kGlobalPalettes_Layer3Smasher[4] = { 0x7393, 0x0, 0xd71, 0x1e9b, }; +const uint16 kGlobalPalettes_Bowser[56] = { 0x7fff, 0x18c0, 0x63fb, 0x30c, 0x20b, 0x1535, 0x1a5f, 0x779b, 0x1860, 0x5b97, 0x2a8, 0x1a7, 0xcd1, 0x11fb, 0x6f37, 0x1800, 0x5333, 0x245, 0x143, 0x46e, 0x997, 0x66d3, 0x1000, 0x4acf, 0x1e1, 0xe0, 0xa, 0x133, 0x5e6f, 0x0, 0x426b, 0x180, 0x80, 0x6, 0xcf, 0x560b, 0x0, 0x3a07, 0x120, 0x20, 0x2, 0x6b, 0x4da7, 0x0, 0x31a3, 0xc0, 0x0, 0x0, 0x7, 0x4543, 0x0, 0x2940, 0x60, 0x0, 0x0, 0x3, }; +static const uint16 kGlobalPalettes_EndingLuigi[6] = { 0x44c4, 0x320, 0x4adf, 0x200, 0x13b, 0x4e08, }; +static const uint16 kGlobalPalettes_EndingMario[6] = { 0x44c4, 0x391f, 0x4adf, 0x2874, 0x13f, 0x4e08, }; +static const uint16 kGlobalPalettes_EndingToadstool[6] = { 0x28d2, 0x551e, 0x635f, 0x7b1f, 0x1fb, 0x2de, }; + +static const uint32 kGraphicsPtrs[50] = { + 0x8d9f9, 0x8e231, 0x8ecbb, 0x8f552, 0x8ff7d, 0x98963, 0x9936c, 0x99d10, 0x9a657, 0x9afa1, 0x9ba15, 0x9c39c, 0x9cd63, 0x9d5d2, 0x9ddcb, 0x9e6e5, 0x9ef1e, 0x9f7af, 0x9ffbd, 0xa8910, 0xa9348, 0xa9ae8, 0xaa374, 0xaa9b4, 0xab2ad, 0xabbe4, 0xac380, 0xacc66, 0xad47e, 0xadc88, 0xae67f, 0xaee43, 0xaf6a1, 0xaff65, 0xb88cd, 0xb91ca, 0xb9ae5, 0xba3b5, 0xbae21, 0xbb744, 0xbc06c, 0xbc6a3, 0xbcb7b, 0xbd0f0, 0xbd7b9, 0xbe006, 0xbe936, 0xbf185, 0xbf3bb, 0xbf800 +}; + +const uint8 kLevelDataLayoutTables_EightBitLo_Horizontal[32] = { 0x0, 0xb0, 0x60, 0x10, 0xc0, 0x70, 0x20, 0xd0, 0x80, 0x30, 0xe0, 0x90, 0x40, 0xf0, 0xa0, 0x50, +0x0, 0xb0, 0x60, 0x10, 0xc0, 0x70, 0x20, 0xd0, 0x80, 0x30, 0xe0, 0x90, 0x40, 0xf0, 0xa0, 0x50,}; +const uint8 kLevelDataLayoutTables_EightBitLo_Vertical[28] = { + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +}; +const uint8 kLevelDataLayoutTables_EightBitHi_Horizontal[32] = { 0xc8, 0xc9, 0xcb, 0xcd, 0xce, 0xd0, 0xd2, 0xd3, 0xd5, 0xd7, 0xd8, 0xda, 0xdc, 0xdd, 0xdf, 0xe1, +0xe3, 0xe4, 0xe6, 0xe8, 0xe9, 0xeb, 0xed, 0xee, 0xf0, 0xf2, 0xf3, 0xf5, 0xf7, 0xf8, 0xfa, 0xfc,}; +const uint8 kLevelDataLayoutTables_EightBitHi_Vertical[28] = { 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, 0xe0, 0xe2, +0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe,}; +const uint16 kLevelDataLayoutTables_LoTablePtrs[2] = { 0xbda8, 0xbde8, }; +const uint16 kLevelDataLayoutTables_HiTablePtrs[2] = { 0xbe28, 0xbe68, }; +static const uint16 kSetItemMemoryBit_DATA_00BFFF[3] = { 0x0, 0x80, 0x100, }; +static const uint8 kSetItemMemoryBit_DATA_00C005[8] = { 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1, }; +static const uint8 kGenericPage00Tile_Map16Page00TileLo[9] = { 0x25, 0x25, 0x25, 0x6, 0x49, 0x48, 0x2b, 0xa2, 0xc6, }; +static const uint8 kGenericPage01Tile_Map16Page01TileLo[15] = { 0x52, 0x1b, 0x23, 0x1e, 0x32, 0x13, 0x15, 0x16, 0x2b, 0x2c, 0x12, 0x68, 0x69, 0x32, 0x5e, }; +static const uint8 kGameMode14_InLevel_DATA_00C470[4] = { 0x90, 0x0, 0x90, 0x0, }; +static const uint8 kGameMode14_InLevel_DATA_00C474[4] = { 0x4, 0xfc, 0x4, 0xfc, }; +static const uint8 kGameMode14_InLevel_DATA_00C478[6] = { 0x30, 0x33, 0x33, 0x30, 0x1, 0x0, }; +static const uint8 kPlayerState0C_CastleDestructionMoves_DATA_00C5E1[8] = { 0x10, 0x30, 0x31, 0x32, 0x33, 0x34, 0xe, 0x26}; +static const uint8 kPlayerState0C_CastleDestructionMoves_DATA_00C5E9[16] = { 0x11, 0x2, 0x48, 0x0, 0x60, 0x1, 0x9, 0x80, 0x8, 0x0, 0x20, 0x4, 0x60, 0x0, 0x1, 0xff, }; +static const uint8 kPlayerState0C_CastleDestructionMoves_UNK_00C6DF[8] = { 0x1, 0x0, 0x10, 0xa0, 0x84, 0x50, 0xbc, 0xd8, }; +static const uint16 kPlayerState08_WarpToYoshiWingsBonus_DATA_00C7F9[2] = { 0xffc0, 0xa0, }; +static const uint8 kPlayerState0A_NoYoshiCutscene_DATA_00C848[40] = { 0x1, 0x5f, 0x0, 0x30, 0x8, 0x30, 0x0, 0x20, 0x40, 0x1, 0x0, 0x30, 0x1, 0x80, 0xff, 0x1, 0x3f, 0x0, 0x30, 0x20, 0x1, 0x80, 0x6, 0x0, 0x3a, 0x1, 0x38, 0x0, 0x30, 0x8, 0x30, 0x0, 0x20, 0x40, 0x1, 0x0, 0x30, 0x1, 0x80, 0xff, }; +static const uint8 kPlayerState00_LevelsThatTriggerCutscenes[8] = { 0x25, 0x7, 0x40, 0xe, 0x20, 0x1a, 0x34, 0x32, }; +static const uint8 kPlayerState00_FreeMovementDebugPlayerSpeed[12] = { 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x6, 0x0, 0xfe, 0xff, 0xfa, 0xff, }; +static const uint8 kPlayerState_OnYoshiAnimations[4] = { 0x20, 0x21, 0x27, 0x28, }; +static const uint8 kSetPlayerPose_DATA_00CE79[6] = { 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, }; +static const uint8 kSetPlayerPose_DATA_00CE7F[26] = { 0x2c, 0x2c, 0x2c, 0x2b, 0x2b, 0x2c, 0x2c, 0x2b, 0x2b, 0x2c, 0x2d, 0x2a, 0x2a, 0x2d, 0x2d, 0x2a, 0x2a, 0x2d, 0x2d, 0x2a, 0x2a, 0x2d, 0x2e, 0x2a, 0x2a, 0x2e, }; +static const uint8 kSetPlayerPose_DATA_00CE99[8] = { 0x0, 0x0, 0x25, 0x44, 0x0, 0x0, 0xf, 0x45, }; +static const uint8 kSetPlayerPose_DATA_00CEA1[8] = { 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, }; +static const uint8 kSetPlayerPose_DATA_00CEA9[8] = { 0x2, 0x7, 0x6, 0x9, 0x2, 0x7, 0x6, 0x9, }; +static const uint16 kInitializeCapeSwingOrNetPunch_DATA_00D034[4] = { 0xc, 0xfff4, 0x8, 0xfff8, }; +static const uint16 kInitializeCapeSwingOrNetPunch_DATA_00D03C[4] = { 0x10, 0x10, 0x2, 0x2, }; +static const uint8 kPlayerStateXX_PowerupAnims_GrowingAniImgs[12] = { 0x0, 0x3d, 0x0, 0x3d, 0x0, 0x3d, 0x46, 0x3d, 0x46, 0x3d, 0x46, 0x3d, }; +static const uint8 kPlayerStateXX_EnterPipe_PipeXSpeed[2] = { 0xf8, 0x8, }; +static const uint8 kPlayerStateXX_EnterPipe_PipeYSpeed[4] = { 0x0, 0x0, 0xf0, 0x10, }; +static const uint8 kPlayerStateXX_EnterPipe_HIDEPIPESETS[4] = { 0x0, 0x63, 0x1c, 0x0, }; +static const uint8 kPlayerStateXX_EnterPipe_PipeCntrBoundryX[2] = { 0xa, 0x6, }; +static const uint8 kPlayerStateXX_EnterPipe_PipeCntringSpeed[2] = { 0xff, 0x1, }; +static const uint8 kHandlePlayerPhysics_JumpHeightTable[16] = { 0xb0, 0xb6, 0xae, 0xb4, 0xab, 0xb2, 0xa9, 0xb0, 0xa6, 0xae, 0xa4, 0xab, 0xa1, 0xa9, 0x9f, 0xa6, }; +static const uint16 kHandlePlayerPhysics_DATA_00D2CD[30] = { 0xff00, 0x100, 0xff00, 0x100, 0xff00, 0x100, 0xfe80, 0xc0, 0xff40, 0x180, 0xfe00, 0x40, 0xffc0, 0x200, 0xfe00, 0x40, 0xfe00, 0x40, 0xffc0, 0x200, 0xffc0, 0x200, 0xfc00, 0xff00, 0x100, 0x400, 0xff00, 0x100, 0xff00, 0x100, }; +static const uint16 kHandlePlayerPhysics_DATA_00D309[30] = { 0xffe0, 0x20, 0xffe0, 0x20, 0xffe0, 0x20, 0xffc0, 0x20, 0xffe0, 0x40, 0xff80, 0x20, 0xffe0, 0x80, 0xff80, 0x20, 0xff80, 0x20, 0xffe0, 0x80, 0xffe0, 0x80, 0xfe00, 0xff80, 0x80, 0x200, 0xff00, 0x100, 0xff00, 0x100, }; +static const uint16 kHandlePlayerPhysics_MarioAccel[124] = { 0xfe80, 0xfe80, 0x180, 0x180, 0xfe80, 0xfe80, 0x180, 0x180, 0xfe80, 0xfe80, 0x180, 0x180, 0xfe80, 0xfe80, 0x140, 0x140, 0xfec0, 0xfec0, 0x180, 0x180, 0xfe80, 0xfe80, 0x100, 0x100, 0xff00, 0xff00, 0x180, 0x180, 0xfe80, 0xfe80, 0x100, 0x100, 0xfe80, 0xfe80, 0x100, 0x100, 0xff00, 0xff00, 0x180, 0x180, 0xff00, 0xff00, 0x180, 0x180, 0xfc00, 0xfc00, 0xfd00, 0xfd00, 0x300, 0x300, 0x400, 0x400, 0xfc00, 0xfc00, 0x600, 0x600, 0xfa00, 0xfa00, 0x400, 0x400, 0xff80, 0x80, 0xff00, 0x100, 0xfe80, 0x180, 0xfe80, 0xfe80, 0x180, 0x180, 0xfe80, 0x280, 0xfd80, 0xfb00, 0x280, 0x500, 0xfd80, 0xfb00, 0x280, 0x500, 0xfd80, 0xfb00, 0x280, 0x500, 0xfd40, 0xfa80, 0x240, 0x480, 0xfdc0, 0xfb80, 0x2c0, 0x580, 0xfd00, 0xfa00, 0x200, 0x400, 0xfe00, 0xfc00, 0x300, 0x600, 0xfd00, 0xfa00, 0x200, 0x400, 0xfd00, 0xfa00, 0x200, 0x400, 0xfe00, 0xfc00, 0x300, 0x600, 0xfe00, 0xfc00, 0x300, 0x600, 0xfd00, 0xfa00, 0xfd00, 0xfa00, 0x300, 0x600, 0x300, 0x600, }; +static const uint16 kHandlePlayerPhysics_DATA_00D43D[124] = { 0xff80, 0xfe80, 0x80, 0x180, 0xff80, 0xfe80, 0x80, 0x180, 0xff80, 0xfe80, 0x80, 0x180, 0xfe80, 0xfe80, 0x80, 0x140, 0xff80, 0xfec0, 0x180, 0x180, 0xfe80, 0xfe80, 0x80, 0x100, 0xff80, 0xff00, 0x180, 0x180, 0xfe80, 0xfe80, 0x80, 0x100, 0xfe80, 0xfe80, 0x80, 0x100, 0xff80, 0xff00, 0x180, 0x180, 0xff80, 0xff00, 0x180, 0x180, 0xfc00, 0xfc00, 0xfe00, 0xfd00, 0x300, 0x300, 0x400, 0x400, 0xfc00, 0xfc00, 0x80, 0x80, 0xff80, 0xff80, 0x400, 0x400, 0xff80, 0x80, 0xff00, 0x100, 0xfe80, 0x180, 0xfe80, 0xfe80, 0x180, 0x180, 0xfe80, 0x280, 0xffc0, 0xfd80, 0x40, 0x280, 0xffc0, 0xfd80, 0x40, 0x280, 0xffc0, 0xfd80, 0x40, 0x280, 0xff80, 0xfd40, 0x40, 0x240, 0xffc0, 0xfdc0, 0x80, 0x2c0, 0xfd00, 0xfd00, 0x40, 0x200, 0xffc0, 0xfe00, 0x300, 0x300, 0xfd00, 0xfd00, 0x40, 0x200, 0xfd00, 0xfd00, 0x40, 0x200, 0xffc0, 0xfe00, 0x300, 0x300, 0xffc0, 0xfe00, 0x300, 0x300, 0xfd00, 0xfd00, 0xfd00, 0xfd00, 0x300, 0x300, 0x300, 0x300, }; +static const uint8 kHandlePlayerPhysics_DATA_00D535[148] = { 0xec, 0x14, 0xdc, 0x24, 0xdc, 0x24, 0xd0, 0x30, 0xec, 0x14, 0xdc, 0x24, 0xdc, 0x24, 0xd0, 0x30, 0xec, 0x14, 0xdc, 0x24, 0xdc, 0x24, 0xd0, 0x30, 0xe8, 0x12, 0xdc, 0x20, 0xdc, 0x20, 0xd0, 0x2c, 0xee, 0x18, 0xe0, 0x24, 0xe0, 0x24, 0xd4, 0x30, 0xdc, 0x10, 0xdc, 0x1c, 0xdc, 0x1c, 0xd0, 0x28, 0xf0, 0x24, 0xe4, 0x24, 0xe4, 0x24, 0xd8, 0x30, 0xdc, 0x10, 0xdc, 0x1c, 0xdc, 0x1c, 0xd0, 0x28, 0xdc, 0x10, 0xdc, 0x1c, 0xdc, 0x1c, 0xd0, 0x28, 0xf0, 0x24, 0xe4, 0x24, 0xe4, 0x24, 0xd8, 0x30, 0xf0, 0x24, 0xe4, 0x24, 0xe4, 0x24, 0xd8, 0x30, 0xdc, 0xf0, 0xdc, 0xf8, 0xdc, 0xf8, 0xd0, 0xfc, 0x10, 0x24, 0x8, 0x24, 0x8, 0x24, 0x4, 0x30, 0xd0, 0x8, 0xd0, 0x8, 0xd0, 0x8, 0xd0, 0x8, 0xf8, 0x30, 0xf8, 0x30, 0xf8, 0x30, 0xf8, 0x30, 0xf8, 0x8, 0xf0, 0x10, 0xf4, 0x4, 0xe8, 0x8, 0xf0, 0x10, 0xe0, 0x20, 0xec, 0xc, 0xd8, 0x18, 0xd8, 0x28, 0xd4, 0x2c, 0xd0, 0x30, 0xd0, 0xd0, 0x30, 0x30, 0xe0, 0x20, }; +static const uint16 kHandlePlayerPhysics_DATA_00D5C9[17] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0xf000, 0x1000, 0x0, 0x0, 0x0, 0x0, 0xe000, 0x2000, 0x0, 0x0, 0xf000, 0xf800, }; +static const uint8 kHandlePlayerPhysics_DATA_00D5EB[3] = { 0xff, 0xff, 0x2, }; +static const uint8 kHandlePlayerPhysics_DATA_00D5EE[2] = { 0x68, 0x70, }; +static const uint8 kHandlePlayerPhysics_DATA_00D5F0[2] = { 0x1c, 0xc, }; +static const uint8 kHandlePlayerPhysics_DATA_00D7A5[10] = { 0x6, 0x3, 0x4, 0x10, 0xf4, 0x1, 0x3, 0x4, 0x5, 0x6, }; +static const uint8 kHandlePlayerPhysics_DATA_00D7AF[10] = { 0x40, 0x40, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, }; +static const uint8 kHandlePlayerPhysics_DATA_00D7B9[15] = { 0x10, 0xc8, 0xe0, 0x2, 0x3, 0x3, 0x4, 0x3, 0x2, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kHandlePlayerPhysics_DATA_00D7C8[7] = { 0x1, 0x10, 0x30, 0x30, 0x38, 0x38, 0x40, }; +static const uint8 kHandlePlayerPhysics_CapeSpeed[5] = { 0xff, 0x1, 0x1, 0xff, 0xff, }; +static const uint8 kHandlePlayerPhysics_DATA_00D7D4[5] = { 0x1, 0x6, 0x3, 0x1, 0x0, }; +static const uint8 kHandlePlayerPhysics_DATA_00D7D9[11] = { 0x0, 0x0, 0x0, 0xf8, 0xf8, 0xf8, 0xf4, 0xf0, 0xc8, 0x2, 0x1, }; +static const uint8 kHandlePlayerPhysics_SwimPoses[4] = { 0x16, 0x1a, 0x1a, 0x18, }; +static const uint8 kHandlePlayerPhysics_SwimYSpeed[4] = { 0xe8, 0xf8, 0xd0, 0xd0, }; +static const uint8 kHandlePlayerPhysics_ClimbingSpeed[4] = { 0x10, 0x8, 0xf0, 0xf8, }; +static const uint8 kHandlePlayerPhysics_JumpFromVineYSpeed[2] = { 0xb0, 0xf0, }; +static const uint8 kHandlePlayerPhysics_DATA_00DABD[16] = { 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, }; +static const uint8 kHandlePlayerPhysics_SwingOnNetDoorPoses[14] = { 0x22, 0x15, 0x22, 0x15, 0x21, 0x1f, 0x20, 0x20, 0x20, 0x20, 0x1f, 0x21, 0x1f, 0x21, }; +static const uint8 kHandlePlayerPhysics_ClimbingPoses[2] = { 0x15, 0x22, }; +static const uint8 kHandlePlayerPhysics_NetPunchingPoses[2] = { 0x1e, 0x23, }; +static const uint8 kHandlePlayerPhysics_DATA_00DADF[18] = { 0x10, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, }; +static const uint16 kHandlePlayerPhysics_DATA_00DAF1[18] = { 0x120, 0x140, 0x12a, 0x12a, 0x130, 0x133, 0x132, 0x134, 0x136, 0x138, 0x13a, 0x13b, 0x145, 0x145, 0x145, 0x145, 0x145, 0x145, }; +static const uint8 kSetPlayerPose_WalkingPoseCount[4] = { 0x1, 0x2, 0x2, 0x2, }; +static const uint8 kSetPlayerPose_AnimationSpeedTable[112] = { 0xa, 0x8, 0x6, 0x4, 0x3, 0x2, 0x1, 0x1, 0xa, 0x8, 0x6, 0x4, 0x3, 0x2, 0x1, 0x1, 0xa, 0x8, 0x6, 0x4, 0x3, 0x2, 0x1, 0x1, 0x8, 0x6, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x8, 0x6, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x5, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x5, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x5, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x5, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x5, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x5, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x4, 0x3, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, }; +static const uint8 kPlayerGFXRt_PlayerXYDispIndexIndex[70] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0xe, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xc, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, }; +static const uint8 kPlayerGFXRt_PlayerXYDispIndex[28] = { 0x0, 0x8, 0x10, 0x14, 0x18, 0x1e, 0x24, 0x24, 0x28, 0x30, 0x38, 0x3e, 0x44, 0x4a, 0x50, 0x54, 0x58, 0x58, 0x5c, 0x60, 0x64, 0x68, 0x6c, 0x70, 0x74, 0x78, 0x7c, 0x80, }; +static const uint8 kPlayerGFXRt_PowerupTilesetIndex[4] = { 0x0, 0x46, 0x83, 0x46, }; +static const uint8 kPlayerGFXRt_Tiles[50] = { 0x0, 0x2, 0x80, 0x80, 0x0, 0x2, 0xc, 0x80, 0x0, 0x2, 0x1a, 0x1b, 0x0, 0x2, 0xd, 0x80, 0x0, 0x2, 0x22, 0x23, 0x0, 0x2, 0x32, 0x33, 0x0, 0x2, 0xa, 0xb, 0x0, 0x2, 0x30, 0x31, 0x0, 0x2, 0x20, 0x21, 0x0, 0x2, 0x7e, 0x80, 0x0, 0x2, 0x2, 0x80, 0x4, 0x7f, 0x4a, 0x5b, 0x4B, 0x5A }; +static const uint8 kPlayerGFXRt_TilesIndex[192] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0xc, 0xc, 0xc, 0x0, 0x0, 0x10, 0x10, 0x14, 0x14, 0x18, 0x18, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x24, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0xc, 0xc, 0xc, 0x0, 0x0, 0x10, 0x10, 0x14, 0x14, 0x18, 0x18, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x0, 0x24, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kPlayerGFXRt_HeadTilePointerIndex[192] = { 0x50, 0x50, 0x50, 0x9, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x9, 0x2b, 0x50, 0x2d, 0x50, 0xd5, 0x2e, 0xc4, 0xc4, 0xc4, 0xd6, 0xb6, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0xc5, 0xd7, 0x2a, 0xe0, 0x50, 0xd5, 0x29, 0x2c, 0xb6, 0xd6, 0x28, 0xe0, 0xe0, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0x5c, 0x5c, 0x50, 0x5a, 0xb6, 0x50, 0x28, 0x28, 0xc5, 0xd7, 0x28, 0x70, 0xc5, 0x70, 0x1c, 0x93, 0xc5, 0xc5, 0xb, 0x85, 0x90, 0x84, 0x70, 0x70, 0x70, 0xa0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0xa0, 0x74, 0x70, 0x80, 0x70, 0x84, 0x17, 0xa4, 0xa4, 0xa4, 0xb3, 0xb0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0xe2, 0x72, 0xf, 0x61, 0x70, 0x63, 0x82, 0xc7, 0x90, 0xb3, 0xd4, 0xa5, 0xc0, 0x8, 0x54, 0xc, 0xe, 0x1b, 0x51, 0x49, 0x4a, 0x48, 0x4b, 0x4c, 0x5d, 0x5e, 0x5f, 0xe3, 0x90, 0x5f, 0x5f, 0xc5, 0x70, 0x70, 0x70, 0xa0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0xa0, 0x74, 0x70, 0x80, 0x70, 0x84, 0x17, 0xa4, 0xa4, 0xa4, 0xb3, 0xb0, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0xe2, 0x72, 0xf, 0x61, 0x70, 0x63, 0x82, 0xc7, 0x90, 0xb3, 0xd4, 0xa5, 0xc0, 0x8, 0x64, 0xc, 0xe, 0x1b, 0x51, 0x49, 0x4a, 0x48, 0x4b, 0x4c, 0x5d, 0x5e, 0x5f, 0xe3, 0x90, 0x5f, 0x5f, 0xc5, }; +static const uint8 kPlayerGFXRt_BodyTilePointerIndex[192] = { 0x71, 0x60, 0x60, 0x19, 0x94, 0x96, 0x96, 0xa2, 0x97, 0x97, 0x18, 0x3b, 0xb4, 0x3d, 0xa7, 0xe5, 0x2f, 0xd3, 0xc3, 0xc3, 0xf6, 0xd0, 0xb1, 0x81, 0xb2, 0x86, 0xb4, 0x87, 0xa6, 0xd1, 0xf7, 0x3a, 0xf0, 0xf4, 0xf5, 0x39, 0x3c, 0xc6, 0xe6, 0x38, 0xf1, 0xf0, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0x6c, 0x4d, 0x71, 0x6a, 0x6b, 0x60, 0x38, 0xf1, 0x5b, 0x69, 0xf1, 0xf1, 0x4e, 0xe1, 0x1d, 0xa3, 0xc5, 0xc5, 0x1a, 0x95, 0x10, 0x7, 0x2, 0x1, 0x0, 0x2, 0x14, 0x13, 0x12, 0x30, 0x27, 0x26, 0x30, 0x3, 0x15, 0x4, 0x31, 0x7, 0xe7, 0x25, 0x24, 0x23, 0x62, 0x36, 0x33, 0x91, 0x34, 0x92, 0x35, 0xa1, 0x32, 0xf2, 0x73, 0x1f, 0xc0, 0xc1, 0xc2, 0x83, 0xd2, 0x10, 0xb7, 0xe4, 0xb5, 0x61, 0xa, 0x55, 0xd, 0x75, 0x77, 0x1e, 0x59, 0x59, 0x58, 0x2, 0x2, 0x6d, 0x6e, 0x6f, 0xf3, 0x68, 0x6f, 0x6f, 0x6, 0x2, 0x1, 0x0, 0x2, 0x14, 0x13, 0x12, 0x30, 0x27, 0x26, 0x30, 0x3, 0x15, 0x4, 0x31, 0x7, 0xe7, 0x25, 0x24, 0x23, 0x62, 0x36, 0x33, 0x91, 0x34, 0x92, 0x35, 0xa1, 0x32, 0xf2, 0x73, 0x1f, 0xc0, 0xc1, 0xc2, 0x83, 0xd2, 0x10, 0xb7, 0xe4, 0xb5, 0x61, 0xa, 0x55, 0xd, 0x75, 0x77, 0x1e, 0x59, 0x59, 0x58, 0x2, 0x2, 0x6d, 0x6e, 0x6f, 0xf3, 0x68, 0x6f, 0x6f, 0x6, }; +static const uint8 kPlayerGFXRt_TileXFlip[2] = { 0x0, 0x40, }; +static const uint8 kPlayerGFXRt_DATA_00E18E[70] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0x0, 0x10, 0x13, 0x22, 0x25, 0x28, 0x0, 0x16, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x19, 0x1c, 0x4, 0x1f, 0x10, 0x10, 0x0, 0x16, 0x10, 0x6, 0x4, 0x8, 0x2b, 0x30, 0x35, 0x3a, 0x3f, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x16, 0x16, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x4, 0x0, }; +// todo: oob +static const uint8 kPlayerGFXRt_DATA_00E1D4[72] = { 0x6, 0x0, 0x6, 0x0, 0x86, 0x2, 0x6, 0x3, 0x6, 0x1, 0x6, 0xce, 0x6, 0x6, 0x40, 0x0, 0x6, 0x2c, 0x6, 0x6, 0x44, 0xe, 0x86, 0x2c, 0x6, 0x86, 0x2c, 0xa, 0x86, 0x84, 0x8, 0x6, 0xa, 0x2, 0x6, 0xac, 0x10, 0x6, 0xcc, 0x10, 0x6, 0xae, 0x10, 0x0, 0x8c, 0x14, 0x80, 0x2e, 0x0, 0xca, 0x16, 0x91, 0x2f, 0x0, 0x8e, 0x18, 0x81, 0x30, 0x0, 0xeb, 0x1a, 0x90, 0x31, 0x4, 0xed, 0x1c, 0x82, 0x6, 0x92, 0x1e, 0x84,0x86, }; +static const uint8 kPlayerGFXRt_CapeXYDispIndex[32] = { 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xb0, 0xb6, 0xbc, 0xc2, 0xc8, 0xce, 0xd4, 0xda, 0xde, 0xe2, 0xe2, }; +static const uint8 kPlayerGFXRt_CapeTilePointerIndex[44] = { 0xa, 0xa, 0x84, 0xa, 0x88, 0x88, 0x88, 0x88, 0x8a, 0x8a, 0x8a, 0x8a, 0x44, 0x44, 0x44, 0x44, 0x42, 0x42, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40, 0x22, 0x22, 0x22, 0x22, 0xa4, 0xa4, 0xa4, 0xa4, 0xa6, 0xa6, 0xa6, 0xa6, 0x86, 0x86, 0x86, 0x86, 0x6e, 0x6e, 0x6e, 0x6e, }; +static const uint8 kPlayerGFXRt_DATA_00E266[44] = { 0x2, 0x2, 0x2, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x12, 0x4, 0x4, 0x4, 0x12, 0x4, 0x4, 0x4, 0x12, 0x4, 0x4, 0x4, 0x12, 0x4, 0x4, }; +static const uint8 kPlayerGFXRt_DATA_00E292[16] = { 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x4, 0x8, 0x8, 0x8, 0x8, }; +static const uint16 kPlayerGFXRt_PalettePointers[8] = { 0xb2c8, 0xb2dc, 0xb2c8, 0xb2dc, 0xb2c8, 0xb2dc, 0xb2f0, 0xb304, }; +static const uint8 kPlayerGFXRt_PlayerStartingOAMIndex[4] = { 0x10, 0xd4, 0x10, 0xe8, }; +static const uint8 kPlayerGFXRt_CapeStartingOAMIndex[4] = { 0x8, 0xcc, 0x8, 0xe0, }; +static const uint8 kPlayerGFXRt_TilePriority[3] = { 0x10, 0x10, 0x30, }; +static const uint8 kSlopeDataTables_Player[33] = { 0x8, 0x8, 0x8, 0x8, 0x10, 0x10, 0x10, 0x10, 0x18, 0x18, 0x20, 0x20, 0x28, 0x30, 0x8, 0x10, 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38, 0x50, 0x48, 0x40, 0x58, 0x58, 0x60, 0x60, 0x0, }; +static const uint8 kSlopeDataTables_Player_StationaryYSpeed[33] = { 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x30, 0x30, 0x40, 0x30, 0x30, 0x30, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x30, 0x30, 0x30, 0x30, 0x40, 0x40, 0x40, 0x40, 0x0, }; +static const uint8 kSlopeDataTables_Player_TowardsPeakYSpeed[33] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xec, 0xec, 0xee, 0xee, 0xda, 0xda, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xda, 0xda, 0xda, 0xda, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSlopeDataTables_Player_SnapToSlopeDistance[33] = { 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb, 0xb, 0xb, 0xb, 0x14, 0x14, 0x14, 0x14, 0x6, }; +const uint8 kSlopeDataTables_SlopeType[33] = { 0xff, 0xff, 0xff, 0xff, 0x1, 0x1, 0x1, 0x1, 0xfe, 0xfe, 0x2, 0x2, 0xfd, 0x3, 0xfd, 0x3, 0xfd, 0x3, 0xfd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0xf8, 0xf8, 0xfc, 0xfc, 0x4, 0x4, 0x0, }; +static const uint8 kSlopeDataTables_ShapeOfSlope[512] = { 0xf, 0xf, 0xf, 0xf, 0xe, 0xe, 0xe, 0xe, 0xd, 0xd, 0xd, 0xd, 0xc, 0xc, 0xc, 0xc, 0xb, 0xb, 0xb, 0xb, 0xa, 0xa, 0xa, 0xa, 0x9, 0x9, 0x9, 0x9, 0x8, 0x8, 0x8, 0x8, 0x7, 0x7, 0x7, 0x7, 0x6, 0x6, 0x6, 0x6, 0x5, 0x5, 0x5, 0x5, 0x4, 0x4, 0x4, 0x4, 0x3, 0x3, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x2, 0x3, 0x3, 0x3, 0x3, 0x4, 0x4, 0x4, 0x4, 0x5, 0x5, 0x5, 0x5, 0x6, 0x6, 0x6, 0x6, 0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb, 0xc, 0xc, 0xc, 0xc, 0xd, 0xd, 0xd, 0xd, 0xe, 0xe, 0xe, 0xe, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xe, 0xe, 0xd, 0xd, 0xc, 0xc, 0xb, 0xb, 0xa, 0xa, 0x9, 0x9, 0x8, 0x8, 0x7, 0x7, 0x6, 0x6, 0x5, 0x5, 0x4, 0x4, 0x3, 0x3, 0x2, 0x2, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x2, 0x2, 0x3, 0x3, 0x4, 0x4, 0x5, 0x5, 0x6, 0x6, 0x7, 0x7, 0x8, 0x8, 0x9, 0x9, 0xa, 0xa, 0xb, 0xb, 0xc, 0xc, 0xd, 0xd, 0xe, 0xe, 0xf, 0xf, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x8, 0x6, 0x4, 0x3, 0x2, 0x2, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x2, 0x2, 0x3, 0x4, 0x6, 0x8, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfd, 0xfd, 0xfc, 0xfc, 0xfb, 0xfb, 0xfa, 0xfa, 0xf9, 0xf9, 0xf8, 0xf8, 0xf7, 0xf7, 0xf6, 0xf6, 0xf5, 0xf5, 0xf4, 0xf4, 0xf3, 0xf3, 0xf2, 0xf2, 0xf1, 0xf1, 0xf0, 0xf0, 0xf0, 0xf0, 0xf1, 0xf1, 0xf2, 0xf2, 0xf3, 0xf3, 0xf4, 0xf4, 0xf5, 0xf5, 0xf6, 0xf6, 0xf7, 0xf7, 0xf8, 0xf8, 0xf9, 0xf9, 0xfa, 0xfa, 0xfb, 0xfb, 0xfc, 0xfc, 0xfd, 0xfd, 0xfe, 0xfe, 0xff, 0xff, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xe, 0xc, 0xa, 0x8, 0x6, 0x4, 0x2, 0x0, 0xe, 0xc, 0xa, 0x8, 0x6, 0x4, 0x2, 0x0, 0xfe, 0xfc, 0xfa, 0xf8, 0xf6, 0xf4, 0xf2, 0xf0, 0x0, 0x2, 0x4, 0x6, 0x8, 0xa, 0xc, 0xe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe, 0x0, 0x2, 0x4, 0x6, 0x8, 0xa, 0xc, 0xe, }; +static const uint16 kGetPlayerLevelCollisionMap16ID_DATA_00E832[54] = { 0x8, 0xe, 0xe, 0x8, 0x5, 0xb, 0x8, 0x2, 0x2, 0x8, 0xb, 0x5, 0x8, 0xe, 0xe, 0x8, 0x5, 0xb, 0x8, 0x2, 0x2, 0x8, 0xb, 0x5, 0x8, 0xe, 0xe, 0x8, 0x5, 0xb, 0x8, 0x2, 0x2, 0x8, 0xb, 0x5, 0x8, 0xe, 0xe, 0x8, 0x5, 0xb, 0x8, 0x2, 0x2, 0x8, 0xb, 0x5, 0x10, 0x20, 0x7, 0x0, 0xfff0, 0x8, }; +// todo: buffer read overflow +static const uint16 kGetPlayerLevelCollisionMap16ID_DATA_00E89C[54] = { 0x18, 0x1a, 0x16, 0x10, 0x20, 0x20, 0x18, 0x1a, 0x16, 0x10, 0x20, 0x20, 0x12, 0x1a, 0xf, 0x8, 0x20, 0x20, 0x12, 0x1a, 0xf, 0x8, 0x20, 0x20, 0x1d, 0x28, 0x19, 0x13, 0x30, 0x30, 0x1d, 0x28, 0x19, 0x13, 0x30, 0x30, 0x1a, 0x28, 0x16, 0x10, 0x30, 0x30, 0x1a, 0x28, 0x16, 0x10, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,}; +static const uint8 kHandlePlayerLevelColl_DATA_00E90A[3] = { 0x1, 0x2, 0x11, }; +static const uint8 kHandlePlayerLevelColl_DATA_00E90D[4] = { 0xff, 0xff, 0x1, 0x0, }; +static const uint8 kHandlePlayerLevelColl_DATA_00E911[2] = { 0x2, 0xd, }; +static const uint16 kHandlePlayerLevelColl_DATA_00E913[6] = { 0x1, 0xffff, 0x1, 0x1, 0xffff, 0xffff, }; +static const uint16 kHandlePlayerLevelColl_DATA_00E91F[6] = { 0x0, 0x0, 0xffff, 0x1, 0xffff, 0x1, }; +static const uint8 kRunPlayerBlockCode_DATA_00EAB9[2] = { 0xde, 0x23, }; +static const uint8 kRunPlayerBlockCode_DATA_00EABB[2] = { 0x20, 0xe0, }; +static const uint16 kRunPlayerBlockCode_DATA_00EABD[2] = { 0x8, 0xfff8, }; +static const uint8 kRunPlayerBlockCode_WaterSlopeMap16Numbers[26] = { 0x71, 0x72, 0x76, 0x77, 0x7b, 0x7c, 0x81, 0x86, 0x8a, 0x8b, 0x8f, 0x90, 0x94, 0x95, 0x99, 0x9a, 0x9e, 0x9f, 0xa3, 0xa4, 0xa8, 0xa9, 0xad, 0xae, 0xb2, 0xb3, }; +static const uint8 kCheckIfBlockWasHit_DATA_00F05C[36] = { 0x1, 0x5, 0x1, 0x2, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x3, 0x3, 0x4, 0x2, 0x2, 0x2, 0x1, 0x1, 0x7, 0x11, 0x10, }; +static const uint8 kCheckIfBlockWasHit_DATA_00F080[36] = { 0x80, 0x0, 0x0, 0x1e, 0x0, 0x0, 0x5, 0x9, 0x6, 0x81, 0xe, 0xc, 0x14, 0x0, 0x5, 0x9, 0x6, 0x7, 0xe, 0xc, 0x16, 0x18, 0x1a, 0x1a, 0x0, 0x9, 0x0, 0x0, 0xff, 0xc, 0xa, 0x0, 0x0, 0x0, 0x8, 0x2, }; +static const uint8 kCheckIfBlockWasHit_DATA_00F0A4[36] = { 0xc, 0x8, 0xc, 0x8, 0xc, 0xf, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x3, 0x3, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x4, 0x8, 0x8, }; +static const uint8 kCheckIfBlockWasHit_DATA_00F0C8[36] = { 0xe, 0x13, 0xe, 0xd, 0xe, 0x10, 0xd, 0xd, 0xd, 0xd, 0xa, 0xd, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xb, 0xd, 0xd, 0x16, 0xd, 0xd, 0xd, 0x11, 0x11, 0x12, 0xd, 0xd, 0xd, 0xe, 0xf, 0xc, 0xd, 0xd, }; +static const uint8 kCheckIfBlockWasHit_DATA_00F0EC[12] = { 0x8, 0x1, 0x2, 0x4, 0xed, 0xf6, 0x0, 0x7d, 0xbe, 0x0, 0x6f, 0xb7, }; +static const uint8 kCheckIfBlockWasHit_DATA_00F0F8[8] = { 0x40, 0x50, 0x0, 0x70, 0x80, 0x0, 0xa0, 0xb0, }; +static const uint8 kCheckIfBlockWasHit_DATA_00F100[32] = { 0x5, 0x9, 0x6, 0x5, 0x9, 0x6, 0x5, 0x9, 0x6, 0x5, 0x9, 0x6, 0x5, 0x9, 0x6, 0x5, 0x7, 0xa, 0x10, 0x7, 0xa, 0x10, 0x7, 0xa, 0x10, 0x7, 0xa, 0x10, 0x7, 0xa, 0x10, 0x7, }; +static const uint8 kRunPlayerBlockCode_DATA_00F3E3[2] = { 0xa, 0xff, }; +static const uint8 kRunPlayerBlockCode_PIPE_BUTTONS[4] = { 0x2, 0x1, 0x8, 0x4, }; +static const uint16 kHandleStandardLevelCameraScroll_DATA_00F69F[2] = { 0x64, 0x7c, }; +static const uint16 kHandleStandardLevelCameraScroll_DATA_00F6A3[2] = { 0x0, 0xffff, }; +static const uint16 kHandleStandardLevelCameraScroll_DATA_00F6A7[3] = { 0xfffd, 0x5, 0xfffa, }; +static const uint16 kHandleStandardLevelCameraScroll_DATA_00F6AD[3] = { 0x0, 0x0, 0xc0, }; +static const uint16 kHandleStandardLevelCameraScroll_DATA_00F6B3[6] = { 0x90, 0x60, 0x0, 0x0, 0x0, 0x0, }; +static const uint16 kHandleStandardLevelCameraScroll_DATA_00F6BF[6] = { 0x0, 0xfffe, 0x2, 0x0, -2, 2 }; +static const uint16 kHandleStandardLevelCameraScroll_DATA_00F6CB[8] = { 0x0, 0x20, 0xd0, 0x0, 0x20, 0xd0, 1, -1 }; +static const uint8 kPlayerState00_DATA_00F8DF[9] = { 0xc, 0xc, 0x8, 0x0, 0x20, 0x4, 0xa, 0xd, 0xd, }; +static const uint16 kPlayerState00_DATA_00F8E8[5] = { 0x2a, 0x2a, 0x12, 0x0, 0xffed, }; +static const uint8 kSpr07B_GoalTape_DATA_00FADF[28] = { 0x74, 0x74, 0x77, 0x75, 0x76, 0xe0, 0xf0, 0x74, 0x74, 0x77, 0x75, 0x76, 0xe0, 0xf1, 0xf0, 0xf0, 0xf0, 0xf0, 0xf1, 0xe0, 0xf2, 0xe0, 0xe0, 0xe0, 0xe0, 0xf1, 0xe0, 0xe4, }; +static const uint8 kSpr07B_GoalTape_DATA_00FAFB[5] = { 0xff, 0x74, 0x75, 0x76, 0x77, }; +static const uint8 kSprStatus06_GoalCoins_SmokeTiles[4] = { 0x66, 0x64, 0x62, 0x60, }; +static const uint8 kSpawnPlayerBreathBubble_xlo[2] = { 0x2, 0xa, }; +static const uint8 kSpawnPlayerWaterSplashAndBubbles_YLo[4] = { 0x8, 0xfc, 0x10, 0x4, }; +static const uint8 kSpawnPlayerWaterSplashAndBubbles_YHi[4] = { 0x0, 0xff, 0x0, 0x0, }; +static const uint8 kSpawnPlayerWaterSplashAndBubbles_Bubble_YLo[4] = { 0x10, 0x16, 0x13, 0x1c, }; +static const uint8 kSpawnPlayerWaterSplashAndBubbles_Bubble_XLo[4] = { 0x0, 0x4, 0xa, 0x7, }; +static const uint8 kSpawnPlayerFireball_InitialXSpeed[2] = { 0xfd, 0x3, }; +static const uint8 kSpawnPlayerFireball_xlo[6] = { 0x0, 0x8, 0xf8, 0x10, 0xf8, 0x10, }; +static const uint8 kSpawnPlayerFireball_xhi[6] = { 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, }; +static const uint8 kSpawnPlayerFireball_ylo[6] = { 0x8, 0x8, 0xc, 0xc, 0x14, 0x14, }; + void SmwVectorReset() { - WriteReg(NMITIMEN, 0); - WriteReg(HDMAEN, 0); - WriteReg(MDMAEN, 0); - WriteReg(APUI00, 0); - WriteReg(APUI01, 0); - WriteReg(APUI02, 0); - WriteReg(APUI03, 0); - WriteReg(INIDISP, 0x80); +// xWriteReg(NMITIMEN, 0); +// xWriteReg(HDMAEN, 0); + RtlApuWrite(APUI00, 0); + RtlApuWrite(APUI01, 0); + RtlApuWrite(APUI02, 0); + RtlApuWrite(APUI03, 0); + RtlPpuWrite(INIDISP, 0x80); *(uint16 *)reset_sprites_y_function_in_ram = 0xf0a9; uint16 v0 = 381; int16 v1 = 0x3fd; @@ -118,7 +351,7 @@ void SmwVectorReset() { InitializeFirst8KBOfRAM(); HandleSPCUploads_UploadSamples(); SetupHDMAWindowingEffects(); - WriteReg(OBSEL, 3); + RtlPpuWrite(OBSEL, 3); ++waiting_for_vblank; } @@ -135,35 +368,26 @@ void ResetSpritesFunc(int wh) { } void HandleSPCUploads_UploadSPCEngine() { // 0080e8 - R0_ = 0; - R1_ = 0x80; - R2_ = 14; - HandleSPCUploads_UploadDataToSPC(); + HandleSPCUploads_UploadDataToSPC(RomPtr(0xe8000)); } -void HandleSPCUploads_UploadDataToSPC() { // 0080f7 +void HandleSPCUploads_UploadDataToSPC(const uint8 *p) { // 0080f7 if (g_use_my_apu_code) - RtlApuUpload(RomPtr(load24(R0_))); + RtlApuUpload(p); } void HandleSPCUploads_UploadSamples() { // 0080fd - R0_ = 0; - R1_ = 0x80; - R2_ = 15; - HandleSPCUploads_StrtSPCMscUpld(); + HandleSPCUploads_StrtSPCMscUpld(RomPtr(0xf8000)); } void HandleSPCUploads_UploadOverworldMusicBank() { // 00810e - R0_ = -79; - R1_ = -104; - R2_ = 14; - HandleSPCUploads_StrtSPCMscUpld(); + HandleSPCUploads_StrtSPCMscUpld(RomPtr(0xe98b1)); } -void HandleSPCUploads_StrtSPCMscUpld() { // 00811d - HandleSPCUploads_UploadDataToSPC(); +void HandleSPCUploads_StrtSPCMscUpld(const uint8 *p) { // 00811d + HandleSPCUploads_UploadDataToSPC(p); for (uint8 i = 3; (i & 0x80) == 0; --i) { - WriteReg((SnesRegs)(i + APUI00), 0); + RtlApuWrite((SnesRegs)(i + APUI00), 0); *(&io_sound_ch1 + i) = 0; *(&unusedram_7e1dfd + i) = 0; } @@ -172,101 +396,65 @@ void HandleSPCUploads_StrtSPCMscUpld() { // 00811d void HandleSPCUploads_008134() { // 008134 if (flag_active_bonus_game || misc_intro_level_flag == 0xE9 || !(flag_show_player_start | (uint8)(counter_sublevels_entered | misc_intro_level_flag))) { - R0_ = -42; - R1_ = -82; - R2_ = 14; - HandleSPCUploads_StrtSPCMscUpld(); + HandleSPCUploads_StrtSPCMscUpld(RomPtr(0xeaed6)); } } void HandleSPCUploads_UploadCreditsMusicBank() { // 008159 - R0_ = 0; - R1_ = -28; - R2_ = 3; - HandleSPCUploads_StrtSPCMscUpld(); + HandleSPCUploads_StrtSPCMscUpld(RomPtr(0x3e400)); } void SmwVectorNMI() { - uint8 v2; - uint8 v3; - ReadReg(RDNMI); + int trigger_line = -1; uint8 v0 = io_music_ch1; - if (io_music_ch1 || ReadReg(APUI02) == io_copy_of_music_ch1) { - WriteReg(APUI02, v0); + if (io_music_ch1 || g_ram[kSmwRam_APUI02] == io_copy_of_music_ch1) { + RtlApuWrite(APUI02, v0); io_copy_of_music_ch1 = v0; io_music_ch1 = 0; } - WriteReg(APUI00, io_sound_ch1); - WriteReg(APUI01, io_sound_ch2); - WriteReg(APUI03, io_sound_ch3); + RtlApuWrite(APUI00, io_sound_ch1); + RtlApuWrite(APUI01, io_sound_ch2); + RtlApuWrite(APUI03, io_sound_ch3); io_sound_ch1 = 0; io_sound_ch2 = 0; io_sound_ch3 = 0; - WriteReg(INIDISP, 0x80); - WriteReg(HDMAEN, 0); - WriteReg(W12SEL, mirror_bg1_and2_window_mask_settings); - WriteReg(W34SEL, mirror_bg3_and4_window_mask_settings); - WriteReg(WOBJSEL, mirror_object_and_color_window_settings); - WriteReg(CGWSEL, mirror_color_math_initial_settings); + RtlPpuWrite(W12SEL, mirror_bg1_and2_window_mask_settings); + RtlPpuWrite(W34SEL, mirror_bg3_and4_window_mask_settings); + RtlPpuWrite(WOBJSEL, mirror_object_and_color_window_settings); + RtlPpuWrite(CGWSEL, mirror_color_math_initial_settings); if ((misc_nmito_use_flag & 0x80) == 0) { - WriteReg(CGADSUB, mirror_color_math_select_and_enable & 0xFB); - WriteReg(BGMODE, 9); + RtlPpuWrite(CGADSUB, mirror_color_math_select_and_enable & 0xFB); + RtlPpuWrite(BGMODE, 9); if (waiting_for_vblank) { - if (misc_nmito_use_flag >> 1) { + if (misc_nmito_use_flag & ~1) { LABEL_25: - v2 = 0x81; if (misc_currently_active_boss_end_cutscene == 8) { - WriteReg(INIDISP, mirror_screen_display_register); - WriteReg(HDMAEN, mirror_hdmaenable); - WriteReg(NMITIMEN, 0x81); - WriteReg(BG3HOFS, mirror_layer3_xpos); - WriteReg(BG3HOFS, HIBYTE(mirror_layer3_xpos)); - WriteReg(BG3VOFS, mirror_layer3_ypos); - WriteReg(BG3VOFS, HIBYTE(mirror_layer3_ypos)); - WriteReg(BGMODE, mirror_bgmode_and_tile_size_setting); - WriteReg(CGADSUB, mirror_color_math_select_and_enable); - return; + RtlPpuWriteTwice(BG3HOFS, mirror_layer3_xpos); + RtlPpuWriteTwice(BG3VOFS, mirror_layer3_ypos); + RtlPpuWrite(BGMODE, mirror_bgmode_and_tile_size_setting); + RtlPpuWrite(CGADSUB, mirror_color_math_select_and_enable); + goto exit_routine; } goto LABEL_29; } goto LABEL_24; } - ++waiting_for_vblank; + waiting_for_vblank = 1; UpdatePaletteFromIndexedTable(); - if (misc_nmito_use_flag >> 1) { + if (misc_nmito_use_flag & ~1) { if (pointer_current_overworld_process == 10 && (uint8)(ow_submap_switch_process - 2) < 4) { UploadOverworldLayer1And2Tilemaps(ow_submap_switch_process - 2); LABEL_23: PollJoypadInputs(); LABEL_24: - WriteReg(BG1HOFS, mirror_current_layer1_xpos); - WriteReg(BG1HOFS, HIBYTE(mirror_current_layer1_xpos)); - uint16 voffs1; - voffs1 = shaking_layer1_disp_y + mirror_current_layer1_ypos; - WriteReg(BG1VOFS, voffs1); - WriteReg(BG1VOFS, voffs1 >> 8); - WriteReg(BG2HOFS, mirror_current_layer2_xpos); - WriteReg(BG2HOFS, HIBYTE(mirror_current_layer2_xpos)); - WriteReg(BG2VOFS, mirror_current_layer2_ypos); - WriteReg(BG2VOFS, HIBYTE(mirror_current_layer2_ypos)); + RtlPpuWriteTwice(BG1HOFS, mirror_current_layer1_xpos); + RtlPpuWriteTwice(BG1VOFS, shaking_layer1_disp_y + mirror_current_layer1_ypos); + RtlPpuWriteTwice(BG2HOFS, mirror_current_layer2_xpos); + RtlPpuWriteTwice(BG2VOFS, mirror_current_layer2_ypos); if (misc_nmito_use_flag) goto LABEL_25; - v3 = 36; -LABEL_28: - ReadReg(TIMEUP); - WriteReg(VTIMEL, v3); - WriteReg(VTIMEH, 0); - flag_irqto_use = 0; - v2 = 0xa1; -LABEL_29: - WriteReg(NMITIMEN, v2); - WriteReg(BG3HOFS, 0); - WriteReg(BG3HOFS, 0); - WriteReg(BG3VOFS, 0); - WriteReg(BG3VOFS, 0); - WriteReg(INIDISP, mirror_screen_display_register); - WriteReg(HDMAEN, mirror_hdmaenable); - return; + trigger_line = 36; + goto LABEL_28_EnableVtimeL; } UploadOverworldExAnimationData(); UploadPlayerGFX(); @@ -313,94 +501,68 @@ void SmwVectorNMI() { UploadOAMBuffer(); PollJoypadInputs(); } - WriteReg(BGMODE, 9); - uint16 m7x = mirror_m7_center_xpos + 0x80; - WriteReg(M7X, m7x); - WriteReg(M7X, m7x >> 8); - uint16 m7y = mirror_m7_center_ypos + 0x80; - WriteReg(M7Y, m7y); - WriteReg(M7Y, m7y >> 8); - WriteReg(M7A, mirror_m7_matrix_alo); - WriteReg(M7A, mirror_m7_matrix_ahi); - WriteReg(M7B, mirror_m7_matrix_blo); - WriteReg(M7B, mirror_m7_matrix_bhi); - WriteReg(M7C, mirror_m7_matrix_clo); - WriteReg(M7C, mirror_m7_matrix_chi); - WriteReg(M7D, mirror_m7_matrix_dlo); - WriteReg(M7D, mirror_m7_matrix_dhi); + RtlPpuWrite(BGMODE, 9); + RtlPpuWriteTwice(M7X, mirror_m7_center_xpos + 0x80); + RtlPpuWriteTwice(M7Y, mirror_m7_center_ypos + 0x80); + RtlPpuWriteTwice(M7A, WORD(mirror_m7_matrix_alo)); + RtlPpuWriteTwice(M7B, WORD(mirror_m7_matrix_blo)); + RtlPpuWriteTwice(M7C, WORD(mirror_m7_matrix_clo)); + RtlPpuWriteTwice(M7D, WORD(mirror_m7_matrix_dlo)); SetMode7PPUPointersAndLayer1Scroll(); if (!(misc_nmito_use_flag & 1)) { - v3 = 36; + trigger_line = 36; if ((misc_nmito_use_flag & 0x40) != 0 && kPlayerState00_DATA_00F8E8[misc_currently_active_boss] == 42) { - v3 = 45; + trigger_line = 45; } - goto LABEL_28; + LABEL_28_EnableVtimeL: + flag_irqto_use = 0; + LABEL_29: + RtlPpuWriteTwice(BG3HOFS, 0); + RtlPpuWriteTwice(BG3VOFS, 0); + } else { + RtlPpuWrite(BGMODE, 7); + RtlPpuWriteTwice(BG1HOFS, mirror_m7_xpos); + RtlPpuWriteTwice(BG1VOFS, mirror_m7_ypos); } - WriteReg(INIDISP, mirror_screen_display_register); - WriteReg(HDMAEN, mirror_hdmaenable); - WriteReg(NMITIMEN, 0x81); - WriteReg(BGMODE, 7); - WriteReg(BG1HOFS, mirror_m7_xpos); - WriteReg(BG1HOFS, HIBYTE(mirror_m7_xpos)); - WriteReg(BG1VOFS, mirror_m7_ypos); - WriteReg(BG1VOFS, HIBYTE(mirror_m7_ypos)); +exit_routine: + RtlPpuWrite(INIDISP, mirror_screen_display_register); + RtlEnableVirq(trigger_line); +// xWriteReg(HDMAEN, mirror_hdmaenable); } void SmwVectorIRQ() { - if ((ReadReg(TIMEUP) & 0x80) == 0) - return; - uint8 v0 = 0x81; + int trigger_line = -1; if ((misc_nmito_use_flag & 0x80) != 0) { if ((misc_nmito_use_flag & 0x40) != 0) { if (flag_irqto_use) { - WriteReg(NMITIMEN, 0x81); SetMode7PPUPointersAndLayer1Scroll(); goto LABEL_4; } - ++flag_irqto_use; - ReadReg(TIMEUP); - WriteReg(VTIMEL, -82 - shaking_layer1_disp_y); - WriteReg(VTIMEH, 0); - v0 = 0xA1; + flag_irqto_use = 1; + trigger_line = (-82 - shaking_layer1_disp_y) & 0xff; } if (!timer_end_level || timer_level_end_fade < 0x40) { - WriteReg(NMITIMEN, v0); - WriteReg(BGMODE, 7); - WriteReg(BG1HOFS, mirror_m7_xpos); - WriteReg(BG1HOFS, HIBYTE(mirror_m7_xpos)); - WriteReg(BG1VOFS, mirror_m7_ypos); - WriteReg(BG1VOFS, HIBYTE(mirror_m7_ypos)); - return; + RtlPpuWrite(BGMODE, 7); + RtlPpuWriteTwice(BG1HOFS, mirror_m7_xpos); + RtlPpuWriteTwice(BG1VOFS, mirror_m7_ypos); + goto out; } } - WriteReg(NMITIMEN, 0x81); - WriteReg(BG3HOFS, mirror_layer3_xpos); - WriteReg(BG3HOFS, HIBYTE(mirror_layer3_xpos)); - WriteReg(BG3VOFS, mirror_layer3_ypos); - WriteReg(BG3VOFS, HIBYTE(mirror_layer3_ypos)); + RtlPpuWriteTwice(BG3HOFS, mirror_layer3_xpos); + RtlPpuWriteTwice(BG3VOFS, mirror_layer3_ypos); LABEL_4: - WriteReg(BGMODE, mirror_bgmode_and_tile_size_setting); - WriteReg(CGADSUB, mirror_color_math_select_and_enable); + RtlPpuWrite(BGMODE, mirror_bgmode_and_tile_size_setting); + RtlPpuWrite(CGADSUB, mirror_color_math_select_and_enable); +out: + RtlEnableVirq(trigger_line); } void SetMode7PPUPointersAndLayer1Scroll() { // 008416 - WriteReg(BG1SC, 0x59); - WriteReg(BG12NBA, 7); - WriteReg(BG1HOFS, mirror_current_layer1_xpos); - WriteReg(BG1HOFS, HIBYTE(mirror_current_layer1_xpos)); - WriteReg(BG1VOFS, shaking_layer1_disp_y + mirror_current_layer1_ypos); - WriteReg(BG1VOFS, HIBYTE(mirror_current_layer1_ypos)); -} - -void UploadOAMBuffer() { // 008449 - WriteReg(DMAP0, 0); - WriteRegWord(OAMADDL, 0); - WriteRegWord(BBAD0, 4); - WriteRegWord(A1T0H, 2); - WriteRegWord(DAS0L, 0x220); - WriteReg(MDMAEN, 1); - WriteReg(OAMADDH, 0x80); - WriteReg(OAMADDL, mirror_oamaddress_lo); + RtlPpuWrite(BG1SC, 0x59); + RtlPpuWrite(BG12NBA, 7); + RtlPpuWriteTwice(BG1HOFS, mirror_current_layer1_xpos); + RtlPpuWrite(BG1VOFS, shaking_layer1_disp_y + mirror_current_layer1_ypos); + RtlPpuWrite(BG1VOFS, HIBYTE(mirror_current_layer1_ypos)); } void CompressOamEntExt() { // 008494 @@ -416,10 +578,9 @@ void CompressOamEntExt() { // 008494 } void LoadStripeImage() { // 0085d2 - R0_ = *((uint8 *)&kLoadStripeImage_StripeImagePtrs[0].addr + graphics_stripe_image_to_upload); - R1_ = *((uint8 *)&kLoadStripeImage_StripeImagePtrs[0].addr + graphics_stripe_image_to_upload + 1); - R2_ = *(&kLoadStripeImage_StripeImagePtrs[0].bank + graphics_stripe_image_to_upload); - LoadStripeImage_UploadToVRAM(R2_); +// printf("M: upl stripe %d\n", graphics_stripe_image_to_upload); + LongPtr p0 = *(LongPtr *)((uint8 *)&kLoadStripeImage_StripeImagePtrs[0].addr + graphics_stripe_image_to_upload); + LoadStripeImage_UploadToVRAM(IndirPtr(&p0, 0)); if (!graphics_stripe_image_to_upload) { LOBYTE(stripe_image_upload) = graphics_stripe_image_to_upload; HIBYTE(stripe_image_upload) = graphics_stripe_image_to_upload; @@ -430,21 +591,7 @@ void LoadStripeImage() { // 0085d2 void ClearLayer3Tilemap() { // 0085fa TurnOffIO(); - R0_ = -4; - WriteReg(VMAIN, 0); - WriteReg(VMADDL, 0); - WriteReg(VMADDH, 0x50); - for (uint8 i = 6; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + 0x4310), kClearLayer3Tilemap_PARAMS_008649[i]); - WriteReg(MDMAEN, 2); - R0_ = 56; - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0); - WriteReg(VMADDH, 0x50); - for (uint8 j = 6; (j & 0x80) == 0; --j) - WriteReg((SnesRegs)(j + 0x4310), kClearLayer3Tilemap_PARAMS_008649[j]); - WriteReg(BBAD1, 0x19); - WriteReg(MDMAEN, 2); + SmwClearVram(0x5000, 0x38fc, 0x1000); mirror_oamaddress_lo = 0; ResetSpritesFunc(0); UploadOAMBuffer(); @@ -478,157 +625,33 @@ void GameMode14_InLevel_0086C7() { // 0086c7 ResetSpritesFunc(100); } -void LoadStripeImage_UploadToVRAM(uint8 a) { // 00871e - int16 v5; - - WriteReg(A1B1, a); - uint16 v1 = 0; - while (1) { - uint8 *v2 = IndirPtr(&R0_, v1); - if ((*v2 & 0x80) != 0) - break; - R4_ = *v2; - v1 = v1 + 1; - R3_ = *IndirPtr(&R0_, v1++); - R7_ = __CFSHL__(*IndirPtr(&R0_, v1), 1); - WriteReg(BBAD1, 0x18); - R5_ = (uint8)(*IndirPtr(&R0_, v1) & 0x40) >> 3; - R6_ = 0; - WriteReg(DMAP1, R5_ | 1); - WriteRegWord(VMADDL, *(uint16 *)&R3_); - uint8 *v4 = IndirPtr(&R0_W, v1); - LOBYTE(v5) = HIBYTE(*(uint16 *)v4); - HIBYTE(v5) = *(uint16 *)v4; - uint16 v6 = (v5 & 0x3FFF) + 1; - v1 = v1 + 2; - WriteRegWord(A1T1L, R0_W + v1); - WriteRegWord(DAS1L, v6); - if (*(uint16 *)&R5_) { - WriteReg(VMAIN, R7_); - WriteReg(MDMAEN, 2); - WriteReg(BBAD1, 0x19); - WriteRegWord(VMADDL, *(uint16 *)&R3_); - WriteRegWord(A1T1L, R0_W + v1 + 1); - WriteRegWord(DAS1L, v6); - v6 = 2; - } - *(uint16 *)&R3_ = v6; - v1 = v6 + v1; - WriteReg(VMAIN, R7_ | 0x80); - WriteReg(MDMAEN, 2); - } -} void UploadLevelLayer1And2Tilemaps() { // 0087ad if ((uint8)blocks_layer1_vramupload_address) { if ((misc_level_layout_flags & 1) != 0) { - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, HIBYTE(blocks_layer1_vramupload_address)); - WriteReg(VMADDH, blocks_layer1_vramupload_address); - for (uint8 i = 6; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A16[i]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, HIBYTE(blocks_layer1_vramupload_address)); - WriteReg(VMADDH, blocks_layer1_vramupload_address + 4); - for (uint8 j = 6; (j & 0x80) == 0; --j) - WriteReg((SnesRegs)(j + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A1D[j]); - WriteReg(DAS1L, 0x40); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, HIBYTE(blocks_layer1_vramupload_address) + 32); - WriteReg(VMADDH, blocks_layer1_vramupload_address); - for (uint8 k = 6; (k & 0x80) == 0; --k) - WriteReg((SnesRegs)(k + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A24[k]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, HIBYTE(blocks_layer1_vramupload_address) + 32); - WriteReg(VMADDH, blocks_layer1_vramupload_address + 4); - for (uint8 m = 6; (m & 0x80) == 0; --m) - WriteReg((SnesRegs)(m + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A2B[m]); - WriteReg(DAS1L, 0x40); - WriteReg(MDMAEN, 2); + SmwCopyToVram(swap16(blocks_layer1_vramupload_address), g_ram + 0x1be6, 0x40); + SmwCopyToVram(swap16(blocks_layer1_vramupload_address) + 0x400, g_ram + 0x1c26, 0x40); + SmwCopyToVram(swap16(blocks_layer1_vramupload_address) + 0x20, g_ram + 0x1c66, 0x40); + SmwCopyToVram(swap16(blocks_layer1_vramupload_address) + 0x420, g_ram + 0x1cA6, 0x40); } else { - WriteReg(VMAIN, 0x81); - WriteReg(VMADDL, HIBYTE(blocks_layer1_vramupload_address)); - WriteReg(VMADDH, blocks_layer1_vramupload_address); - for (uint8 n = 6; (n & 0x80) == 0; --n) - WriteReg((SnesRegs)(n + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A16[n]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x81); - WriteReg(VMADDL, HIBYTE(blocks_layer1_vramupload_address)); - WriteReg(VMADDH, blocks_layer1_vramupload_address + 8); - for (uint8 ii = 6; (ii & 0x80) == 0; --ii) - WriteReg((SnesRegs)(ii + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A1D[ii]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x81); - WriteReg(VMADDL, HIBYTE(blocks_layer1_vramupload_address) + 1); - WriteReg(VMADDH, blocks_layer1_vramupload_address); - for (uint8 jj = 6; (jj & 0x80) == 0; --jj) - WriteReg((SnesRegs)(jj + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A24[jj]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x81); - WriteReg(VMADDL, HIBYTE(blocks_layer1_vramupload_address) + 1); - WriteReg(VMADDH, blocks_layer1_vramupload_address + 8); - for (uint8 kk = 6; (kk & 0x80) == 0; --kk) - WriteReg((SnesRegs)(kk + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A2B[kk]); - WriteReg(MDMAEN, 2); + SmwCopyToVramPitch32(swap16(blocks_layer1_vramupload_address), g_ram + 0x1be6, 0x40); + SmwCopyToVramPitch32(swap16(blocks_layer1_vramupload_address) + 0x800, g_ram + 0x1c26, 0x2c); + SmwCopyToVramPitch32(swap16(blocks_layer1_vramupload_address) + 1, g_ram + 0x1c66, 0x40); + SmwCopyToVramPitch32(swap16(blocks_layer1_vramupload_address) + 0x801, g_ram + 0x1cA6, 0x2c); } } LOBYTE(blocks_layer1_vramupload_address) = 0; if ((uint8)blocks_layer2_vramupload_address) { if ((misc_level_layout_flags & 2) != 0) { - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, HIBYTE(blocks_layer2_vramupload_address)); - WriteReg(VMADDH, blocks_layer2_vramupload_address); - for (uint8 mm = 6; (mm & 0x80) == 0; --mm) - WriteReg((SnesRegs)(mm + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A32[mm]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, HIBYTE(blocks_layer2_vramupload_address)); - WriteReg(VMADDH, blocks_layer2_vramupload_address + 4); - for (uint8 nn = 6; (nn & 0x80) == 0; --nn) - WriteReg((SnesRegs)(nn + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A39[nn]); - WriteReg(DAS1L, 0x40); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, HIBYTE(blocks_layer2_vramupload_address) + 32); - WriteReg(VMADDH, blocks_layer2_vramupload_address); - for (uint8 i1 = 6; (i1 & 0x80) == 0; --i1) - WriteReg((SnesRegs)(i1 + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A40[i1]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, HIBYTE(blocks_layer2_vramupload_address) + 32); - WriteReg(VMADDH, blocks_layer2_vramupload_address + 4); - for (uint8 i2 = 6; (i2 & 0x80) == 0; --i2) - WriteReg((SnesRegs)(i2 + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A47[i2]); - WriteReg(DAS1L, 0x40); - WriteReg(MDMAEN, 2); + SmwCopyToVram(swap16(blocks_layer2_vramupload_address), g_ram + 0x1ce8, 0x40); + SmwCopyToVram(swap16(blocks_layer2_vramupload_address) + 0x400, g_ram + 0x1d28, 0x40); + SmwCopyToVram(swap16(blocks_layer2_vramupload_address) + 0x20, g_ram + 0x1d68, 0x40); + SmwCopyToVram(swap16(blocks_layer2_vramupload_address) + 0x420, g_ram + 0x1da8, 0x40); } else { - WriteReg(VMAIN, 0x81); - WriteReg(VMADDL, HIBYTE(blocks_layer2_vramupload_address)); - WriteReg(VMADDH, blocks_layer2_vramupload_address); - for (uint8 i3 = 6; (i3 & 0x80) == 0; --i3) - WriteReg((SnesRegs)(i3 + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A32[i3]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x81); - WriteReg(VMADDL, HIBYTE(blocks_layer2_vramupload_address)); - WriteReg(VMADDH, blocks_layer2_vramupload_address + 8); - for (uint8 i4 = 6; (i4 & 0x80) == 0; --i4) - WriteReg((SnesRegs)(i4 + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A39[i4]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x81); - WriteReg(VMADDL, HIBYTE(blocks_layer2_vramupload_address) + 1); - WriteReg(VMADDH, blocks_layer2_vramupload_address); - for (uint8 i5 = 6; (i5 & 0x80) == 0; --i5) - WriteReg((SnesRegs)(i5 + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A40[i5]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x81); - WriteReg(VMADDL, HIBYTE(blocks_layer2_vramupload_address) + 1); - WriteReg(VMADDH, blocks_layer2_vramupload_address + 8); - for (uint8 i6 = 6; (i6 & 0x80) == 0; --i6) - WriteReg((SnesRegs)(i6 + 0x4310), kUploadLevelLayer1And2Tilemaps_PARAMS_008A47[i6]); - WriteReg(MDMAEN, 2); + SmwCopyToVramPitch32(swap16(blocks_layer2_vramupload_address), g_ram + 0x1ce8, 0x40); + SmwCopyToVramPitch32(swap16(blocks_layer2_vramupload_address) + 0x800, g_ram + 0x1d28, 0x2c); + SmwCopyToVramPitch32(swap16(blocks_layer2_vramupload_address) + 1, g_ram + 0x1d68, 0x40); + SmwCopyToVramPitch32(swap16(blocks_layer2_vramupload_address) + 0x801, g_ram + 0x1dA8, 0x2c); } } LOBYTE(blocks_layer2_vramupload_address) = 0; @@ -637,7 +660,7 @@ void UploadLevelLayer1And2Tilemaps() { // 0087ad void InitializeFirst8KBOfRAM() { // 008a4e uint16 v0 = 0x1ffe; do { - *(uint16 *)((int8 *)&R0_W + v0) = 0; + WORD(g_ram[v0]) = 0; do v0 -= 2; while ((int16)(v0 - 511) < 0 && (int16)(v0 - 256) >= 0); @@ -648,87 +671,62 @@ void InitializeFirst8KBOfRAM() { // 008a4e } void SetStandardPPUSettings() { // 008a79 - WriteReg(SETINI, 0); - WriteReg(MOSAIC, 0); - WriteReg(BG1SC, 0x23); - WriteReg(BG2SC, 0x33); - WriteReg(BG3SC, 0x53); - WriteReg(BG12NBA, 0); - WriteReg(BG34NBA, 4); + RtlPpuWrite(SETINI, 0); + RtlPpuWrite(MOSAIC, 0); + RtlPpuWrite(BG1SC, 0x23); + RtlPpuWrite(BG2SC, 0x33); + RtlPpuWrite(BG3SC, 0x53); + RtlPpuWrite(BG12NBA, 0); + RtlPpuWrite(BG34NBA, 4); mirror_bg1_and2_window_mask_settings = 0; mirror_bg3_and4_window_mask_settings = 0; mirror_object_and_color_window_settings = 0; - WriteReg(WBGLOG, 0); - WriteReg(WOBJLOG, 0); - WriteReg(TMW, 0); - WriteReg(TSW, 0); + RtlPpuWrite(WBGLOG, 0); + RtlPpuWrite(WOBJLOG, 0); + RtlPpuWrite(TMW, 0); + RtlPpuWrite(TSW, 0); mirror_color_math_initial_settings = 2; - WriteReg(M7SEL, 0x80); + RtlPpuWrite(M7SEL, 0x80); } void ManipulateMode7Image() { // 008acd - R0_ = HIBYTE(misc_m7_angle); - ManipulateMode7Image_008AE8(); - R0_W = misc_m7_angle; + uint8 r0 = HIBYTE(misc_m7_angle); + ManipulateMode7Image_008AE8(r0); + r0 = misc_m7_angle; *(uint16 *)&mirror_m7_matrix_dlo = *(uint16 *)&mirror_m7_matrix_alo; *(uint16 *)&mirror_m7_matrix_clo = -*(uint16 *)&mirror_m7_matrix_blo; - ManipulateMode7Image_008AE8(); + ManipulateMode7Image_008AE8(r0); } -void ManipulateMode7Image_008AE8() { // 008ae8 +void ManipulateMode7Image_008AE8(uint8 r0) { // 008ae8 uint16 v0 = 2 * ((misc_m7_rotation >> 7) & 3); int16 v2 = kManipulateMode7Image_DATA_008ABC[v0 >> 1] + (kManipulateMode7Image_DATA_008AB4[v0 >> 1] ^ (uint8)(2 * misc_m7_rotation)); int16 v1 = v2; - v2 = ManipulateMode7Image_008B2B(v2); + v2 = ManipulateMode7Image_008B2B(v2, r0); if (v0 >= 4) v2 = -v2; *(uint16 *)&mirror_m7_matrix_blo = v2; int16 v3 = ((v1 ^ 0xFE) + 2) & 0x1FF; - v3 = ManipulateMode7Image_008B2B(v3); + v3 = ManipulateMode7Image_008B2B(v3, r0); if ((uint16)(v0 - 2) < 4) v3 = -v3; *(uint16 *)&mirror_m7_matrix_alo = v3; } -uint16 ManipulateMode7Image_008B2B(uint16 k) { // 008b2b - uint16 v2; - +uint16 ManipulateMode7Image_008B2B(uint16 k, uint8 r0) { // 008b2b uint8 v1 = *((uint8 *)kManipulateMode7Image_DATA_008B57 + k + 1); if (v1) - v1 = R0_; - R1_ = v1; - WriteReg(WRMPYA, *((uint8 *)kManipulateMode7Image_DATA_008B57 + k)); - WriteReg(WRMPYB, R0_); - HIBYTE(v2) = R1_ + ReadReg(RDMPYH); - LOBYTE(v2) = ReadReg(RDMPYL); + v1 = r0; + uint8 r1 = v1; + uint16 v2 = (r1 << 8) + Mult8x8(*((uint8 *)kManipulateMode7Image_DATA_008B57 + k), r0); return v2 >> 5; } void InitializeStatusBarTilemap() { // 008cff - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0x2E); - WriteReg(VMADDH, 0x50); - for (uint8 i = 6; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + 0x4310), kInitializeStatusBarTilemap_PARAMS_008D90[i]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0x42); - WriteReg(VMADDH, 0x50); - for (uint8 j = 6; (j & 0x80) == 0; --j) - WriteReg((SnesRegs)(j + 0x4310), kInitializeStatusBarTilemap_PARAMS_008D97[j]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0x63); - WriteReg(VMADDH, 0x50); - for (uint8 k = 6; (k & 0x80) == 0; --k) - WriteReg((SnesRegs)(k + 0x4310), kInitializeStatusBarTilemap_PARAMS_008D9E[k]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0x8E); - WriteReg(VMADDH, 0x50); - for (uint8 m = 6; (m & 0x80) == 0; --m) - WriteReg((SnesRegs)(m + 0x4310), kInitializeStatusBarTilemap_PARAMS_008DA5[m]); - WriteReg(MDMAEN, 2); + SmwCopyToVram(0x502e, RomPtr_00(0x8c81), 8); + SmwCopyToVram(0x5042, RomPtr_00(0x8c89), 0x38); + SmwCopyToVram(0x5063, RomPtr_00(0x8cc1), 0x36); + SmwCopyToVram(0x508e, RomPtr_00(0x8cf7), 8); int8 v4 = 54; uint8 v5 = 108; do { @@ -740,18 +738,8 @@ void InitializeStatusBarTilemap() { // 008cff } void UploadStatusBarTilemap() { // 008dac - WriteReg(VMAIN, 0); - WriteReg(VMADDL, 0x42); - WriteReg(VMADDH, 0x50); - for (uint8 i = 6; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + 0x4310), kUploadStatusBarTilemap_PARAMS_StBr1[i]); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0); - WriteReg(VMADDL, 0x63); - WriteReg(VMADDH, 0x50); - for (uint8 j = 6; (j & 0x80) == 0; --j) - WriteReg((SnesRegs)(j + 0x4310), kUploadStatusBarTilemap_PARAMS_StBr2[j]); - WriteReg(MDMAEN, 2); + SmwCopyToVramLow(0x5042, g_ram + 0xef9, 0x1c); + SmwCopyToVramLow(0x5063, g_ram + 0xf15, 0x1b); } void UpdateStatusBarCounters() { // 008e1a @@ -779,30 +767,21 @@ void UpdateStatusBarCounters() { // 008e1a misc_status_bar_tilemap[v2++ + 28] = -4; } for (uint8 k = 3; (k & 0x80) == 0; k -= 3) { - R0_ = *(&player_mario_score_hi + k); - R1_ = 0; - if (__PAIR32__(R0_W, *(uint16 *)(&player_mario_score_lo + k)) >= 0xF423F) { + uint16 r0w = *(&player_mario_score_hi + k); + if (__PAIR32__(r0w, *(uint16 *)(&player_mario_score_lo + k)) >= 0xF423F) { *(&player_mario_score_hi + k) = 15; *(&player_mario_score_mid + k) = 66; *(&player_mario_score_lo + k) = 63; } } - R0_ = player_mario_score_hi; - R1_ = 0; - R3_ = player_mario_score_mid; - R2_ = player_mario_score_lo; - UpdateStatusBarCounters_Loop2(0x14, 0); + UpdateStatusBarCounters_Loop2(0x14, 0, player_mario_score_hi, PAIR16(player_mario_score_mid, player_mario_score_lo)); for (uint8 m = 0; m != 6; ++m) { if (misc_status_bar_tilemap[m + 48]) break; misc_status_bar_tilemap[m + 48] = -4; } if (player_current_character) { - R0_ = player_luigi_score_hi; - R1_ = 0; - R3_ = player_luigi_score_mid; - R2_ = player_luigi_score_lo; - UpdateStatusBarCounters_Loop2(0x14, 0); + UpdateStatusBarCounters_Loop2(0x14, 0, player_luigi_score_hi, PAIR16(player_luigi_score_mid, player_luigi_score_lo)); for (uint8 n = 0; n != 6; ++n) { if (misc_status_bar_tilemap[n + 48]) break; @@ -834,11 +813,10 @@ void UpdateStatusBarCounters() { // 008e1a v10 = -4; misc_status_bar_tilemap[27] = v9.first; misc_status_bar_tilemap[26] = v10; - R0_ = 0; - R1_ = 0; - R3_ = 0; - R2_ = *(&player_mario_bonus_stars + player_current_character); - UpdateStatusBarCounters_009051(9, 0x10); +// r0 = 0; +// r1 = 0; + uint16 r2w = *(&player_mario_bonus_stars + player_current_character); + UpdateStatusBarCounters_009051(9, 0x10, r2w); uint8 ii; for (ii = 0; ii != 1; ++ii) { if (misc_status_bar_tilemap[ii + 37]) @@ -859,28 +837,28 @@ void UpdateStatusBarCounters() { // 008e1a uint8 v14 = counter_yoshi_coins_to_display; if (counter_yoshi_coins_to_display >= 5) v14 = 0; - R0_ = v14 - 1; + uint8 r0 = v14 - 1; for (uint8 kk = 0; kk != 4; ++kk) { uint8 v16 = -4; - if ((R0_ & 0x80) == 0) + if ((r0 & 0x80) == 0) v16 = 46; misc_status_bar_tilemap[kk + 6] = v16; - --R0_; + --r0; } } -void UpdateStatusBarCounters_Loop2(uint8 k, uint8 j) { // 009012 +void UpdateStatusBarCounters_Loop2(uint8 k, uint8 j, uint16 r0w, uint16 r2w) { // 009012 do { for (misc_status_bar_tilemap[k + 28] = 0;; ++misc_status_bar_tilemap[k + 28]) { int v2 = j >> 1; - bool v3 = R2_W >= kUpdateStatusBarCounters_DATA_008FFA[v2 + 1]; - R6_W = R2_W - kUpdateStatusBarCounters_DATA_008FFA[v2 + 1]; + bool v3 = r2w >= kUpdateStatusBarCounters_DATA_008FFA[v2 + 1]; + uint16 r6 = r2w - kUpdateStatusBarCounters_DATA_008FFA[v2 + 1]; uint16 v4 = !v3 + kUpdateStatusBarCounters_DATA_008FFA[v2]; - R4_W = R0_W - v4; - if (R0_W < v4) + uint16 r4 = r0w - v4; + if (r0w < v4) break; - R2_W = R6_W; - R0_W = R4_W; + r2w = r6; + r0w = r4; } ++k; j += 4; @@ -896,15 +874,15 @@ PairU16 HexToDec(uint8 a) { // 009045 return MakePairU16_AX(a, v1); } -void UpdateStatusBarCounters_009051(uint8 k, uint8 j) { // 009051 +void UpdateStatusBarCounters_009051(uint8 k, uint8 j, uint16 r2w) { // 009051 do { for (misc_status_bar_tilemap[k + 28] = 0;; ++misc_status_bar_tilemap[k + 28]) { int v2 = j >> 1; - bool v3 = R2_W >= kUpdateStatusBarCounters_DATA_008FFA[v2 + 1]; - R6_W = R2_W - kUpdateStatusBarCounters_DATA_008FFA[v2 + 1]; + bool v3 = r2w >= kUpdateStatusBarCounters_DATA_008FFA[v2 + 1]; + uint16 r6 = r2w - kUpdateStatusBarCounters_DATA_008FFA[v2 + 1]; if (!v3) break; - R2_W = R6_W; + r2w = r6; } ++k; j += 4; @@ -918,16 +896,16 @@ void UpdateStatusBarCounters_DrawItemBoxItem() { // 009079 if (misc_nmito_use_flag != 0xC1) get_OamEnt(oam_buf, 0)->ypos = -16; } - R1_ = v0; + uint8 r1 = v0; if (player_current_item_box) { - R0_ = kUpdateStatusBarCounters_ItemBoxItemProperties[player_current_item_box - 1]; + uint8 r0 = kUpdateStatusBarCounters_ItemBoxItemProperties[player_current_item_box - 1]; if (player_current_item_box == 3) - R0_ = kUpdateStatusBarCounters_StarPaletteFrames[(counter_global_frames >> 1) & 3]; - uint8 v1 = R1_; - OamEnt *oam = get_OamEnt(oam_buf, R1_); + r0 = kUpdateStatusBarCounters_StarPaletteFrames[(counter_global_frames >> 1) & 3]; + uint8 v1 = r1; + OamEnt *oam = get_OamEnt(oam_buf, r1); oam->xpos = 120; oam->ypos = 15; - oam->flags = R0_ | 0x30; + oam->flags = r0 | 0x30; oam->charnum = kUpdateStatusBarCounters_ItemBoxItemTile[player_current_item_box - 1]; sprites_oamtile_size_buffer[v1 >> 2] = 2; } @@ -952,11 +930,10 @@ void DrawLoadingLetters() { // 0091b1 v0 = 38; v1 = -92; } - R0_ = v1; - R1_ = 0; + uint16 r0w = v1; uint8 v2 = 112; do { - DrawLoadingLetters_Draw(v0++, v2); + r0w = DrawLoadingLetters_Draw(v0++, v2, r0w); if (v0 == 8 && player_current_character) v0 = 14; v2 -= 8; @@ -964,20 +941,16 @@ void DrawLoadingLetters() { // 0091b1 CompressOamEntExt(); } -void DrawLoadingLetters_Draw(uint8 k, uint8 j) { // 0091e9 +uint16 DrawLoadingLetters_Draw(uint8 k, uint8 j, uint16 r0w) { // 0091e9 OamEnt *oam = get_OamEnt(oam_buf, j); oam[66].flags = kDrawLoadingLetters_TileData_TopProp[k]; oam[67].flags = kDrawLoadingLetters_TileData_BottomProp[k]; - uint8 v3 = R0_; - oam[66].xpos = R0_; - oam[67].xpos = v3; - R0_ = v3 - 8; - if (v3 < 8) - --R1_; + oam[66].xpos = r0w; + oam[67].xpos = r0w; + r0w -= 8; uint8 v4 = j >> 2; - uint8 v5 = R1_ & 1; - sprites_oamtile_size_buffer[v4 + 66] = R1_ & 1; - sprites_oamtile_size_buffer[v4 + 67] = v5; + sprites_oamtile_size_buffer[v4 + 66] = (r0w >> 8) & 1; + sprites_oamtile_size_buffer[v4 + 67] = (r0w >> 8) & 1; int8 v6 = kDrawLoadingLetters_TileData[k]; if (v6 >= 0) { OamEnt *v7 = get_OamEnt(oam_buf, j); @@ -986,20 +959,16 @@ void DrawLoadingLetters_Draw(uint8 k, uint8 j) { // 0091e9 v7[66].ypos = 104; v7[67].ypos = 112; } + return r0w; } void UpdateEntirePalette() { // 00922f palettes_palette_mirror[0] = 0; - WriteReg(CGADD, 0); - for (uint8 i = 6; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + DMAP2), kUpdateEntirePalette_PARAMS_009249[i]); - WriteReg(MDMAEN, 4); + RtlUpdatePalette(palettes_palette_mirror, 0, 0x100); } void SetupHDMAWindowingEffects() { // 009250 - for (uint8 i = 4; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + DMAP7), kSetupHDMAWindowingEffects_PARAMS_009277[i]); - WriteReg(DAS70, 0); + RtlHdmaSetup(7, 0x41, 0x26, 0x927c, 0); SetupHDMAWindowingEffects_EndHDMA(); } @@ -1033,6 +1002,7 @@ void SetupHDMAWindowingEffects_0092A8() { // 0092a8 sub_9291(0x198); } + void SetEnemyRollcallParallaxHDMA_Init() { // 0092b2 misc_hdmawindow_effect_table[0] = 88; misc_hdmawindow_effect_table[10] = 88; @@ -1040,15 +1010,10 @@ void SetEnemyRollcallParallaxHDMA_Init() { // 0092b2 misc_hdmawindow_effect_table[9] = 0; misc_hdmawindow_effect_table[19] = 0; misc_hdmawindow_effect_table[29] = 0; - for (uint8 i = 4; (i & 0x80) == 0; --i) { - WriteReg((SnesRegs)(i + 0x4350), kSetEnemyRollcallParallaxHDMA_PARAMS_009313[i]); - WriteReg((SnesRegs)(i + 0x4360), kSetEnemyRollcallParallaxHDMA_PARAMS_009318[i]); - WriteReg((SnesRegs)(i + 0x4370), kSetEnemyRollcallParallaxHDMA_PARAMS_00931D[i]); - } - WriteReg(DAS50, 0); - WriteReg(DAS60, 0); - WriteReg(DAS70, 0); - mirror_hdmaenable = -32; + RtlHdmaSetup(5, 0x2, 0xd, 0x4a0, 0); + RtlHdmaSetup(6, 0x2, 0xf, 0x4aa, 0); + RtlHdmaSetup(7, 0x2, 0x11, 0x4b4, 0); + mirror_hdmaenable = 0xE0; SetEnemyRollcallParallaxHDMA(); } @@ -1070,9 +1035,9 @@ void InitAndMainLoop_ProcessGameMode() { // 009322 } void TurnOffIO() { // 00937d - WriteReg(NMITIMEN, 0); - WriteReg(HDMAEN, 0); - WriteReg(INIDISP, 0x80); +// WriteReg(NMITIMEN, 0); +// WriteReg(HDMAEN, 0); + RtlPpuWrite(INIDISP, 0x80); } void GameMode00_LoadNintendoPresents() { // 009391 @@ -1108,42 +1073,25 @@ void GameMode00_LoadNintendoPresents_0093CA() { // 0093ca void GameMode00_LoadNintendoPresents_0093EA(uint8 k, uint8 j) { // 0093ea misc_nmito_use_flag = 1; SetVisibleLayers(0x20, k, j); - GameMode00_LoadNintendoPresents_0093F4(); -} - -void GameMode00_LoadNintendoPresents_0093F4() { // 0093f4 ++misc_game_mode; - GameMode00_LoadNintendoPresents_Mode04Finish(); -} - -void GameMode00_LoadNintendoPresents_Mode04Finish() { // 0093f7 - WriteReg(NMITIMEN, 0x81); } void SetVisibleLayers(uint8 a, uint8 k, uint8 j) { // 0093fd - WriteReg(CGADSUB, a); + RtlPpuWrite(CGADSUB, a); mirror_color_math_select_and_enable = a; - WriteReg(TM, k); - WriteReg(TS, j); - WriteReg(TMW, 0); - WriteReg(TSW, 0); + RtlPpuWrite(TM, k); + RtlPpuWrite(TS, j); + RtlPpuWrite(TMW, 0); + RtlPpuWrite(TSW, 0); } void GameMode01_ShowNintendoPresents() { // 00940f if (!--timer_title_screen_input_timer) { GraphicsDecompressionRoutines_DecompressGFX32And33(); - GameMode01_ShowNintendoPresents_009417(); + ++misc_game_mode; } } -void GameMode01_ShowNintendoPresents_009417() { // 009417 - ++misc_game_mode; -} - -void GameMode01_ShowNintendoPresents_Return00941A() { // 00941a - ; -} - void GameMode06_CircleEffect() { // 00941b CheckWhichControllersArePluggedIn(); if (GameMode07_TitleScreenDemo_009CBE()) { @@ -1155,7 +1103,7 @@ void GameMode06_CircleEffect() { // 00941b if ((uint8)(timer_hdmawindow_scaling_factor + 4) < 0xF0) GameMode06_CircleEffect_009440(timer_hdmawindow_scaling_factor + 4); else - GameMode01_ShowNintendoPresents_009417(); + ++misc_game_mode; } } @@ -1165,10 +1113,9 @@ void GameMode06_CircleEffect_009440(uint8 a) { // 009440 } void GameMode06_CircleEffect_009443() { // 009443 - UpdateHDMAWindowBuffer_SetCircleHDMAPointer(); - R0_ = 0x80; - R1_ = 112; - UpdateHDMAWindowBuffer_KeyholeEntry(0x70); + uint8 r0 = 0x80; + uint8 r1 = 112; + UpdateHDMAWindowBuffer_KeyholeEntry(UpdateHDMAWindowBuffer_SetCircleHDMAPointer(), r0, r1); } void GameMode19_Cutscene() { // 009468 @@ -1234,17 +1181,9 @@ void GameMode19_Cutscene_GameMode1BEntry() { // 0094fd } void UploadBigLayer3LettersToVRAM() { // 00955e - GraphicsDecompressionRoutines(0x2F); - WriteReg(VMAIN, 0x80); - WriteRegWord(VMADDL, 0x4600); - int16 v0 = 512; - do { - uint8 *v1 = IndirPtr(&R0_W, 0); - WriteRegWord(VMDATAL, *(uint16 *)v1); - ++R0_W; - ++R0_W; - --v0; - } while (v0); + const uint8 *p0 = GraphicsDecompress(0x2F); + const uint8 *v1 = &p0[0]; + SmwCopyToVram(0x4600, v1, 512 * 2); } void GameMode1D_LoadYoshisHouse() { // 009583 @@ -1358,7 +1297,6 @@ void GameMode10_BufferLevelLoadMessage() { // 00968e } void GameMode11_LoadSublevel_GameMode03Entry() { // 0096ae - WriteReg(NMITIMEN, 0); InitializeFirst8KBOfRAM(); for (int8 i = 7; i >= 0; --i) misc_currently_loaded_sprite_graphics_files[(uint8)i] = -1; @@ -1372,11 +1310,10 @@ void GameMode11_LoadSublevel_GameMode03Entry() { // 0096ae void GameMode11_LoadSublevel_0096CF(uint8 j, uint8 a) { // 0096cf misc_intro_level_flag = a; ow_players_map[0] = j; - GameMode11_LoadSublevel_SA1Pack_OptimizeThisRoutine1(); + GameMode11_LoadSublevel_0096D5(); } -void GameMode11_LoadSublevel_SA1Pack_OptimizeThisRoutine1() { // 0096d5 - WriteReg(NMITIMEN, 0); +void GameMode11_LoadSublevel_0096D5() { // 0096d5 DamagePlayer_DisableButtons(); if (!counter_sublevels_entered && flag_show_player_start) LoadOverworldLayer1AndEvents(); @@ -1409,7 +1346,6 @@ void GameMode11_LoadSublevel_SA1Pack_OptimizeThisRoutine1() { // 0096d5 mirror_screen_display_register = 0; misc_mosaic_direction = 0; ++misc_game_mode; - GameMode00_LoadNintendoPresents_Mode04Finish(); } PairU16 OwPrompt03_OverworldLifeExchanger_00974C(uint8 a) { // 00974c @@ -1434,7 +1370,7 @@ void GameMode17_ShowDeathMessage() { // 009759 if (((players_lives[1] | players_lives[0]) & 0x80) != 0) { for (uint8 i = 12; (i & 0x80) == 0; --i) { flag_collected5_yoshi_coins[i] = 0; - *(&R6_ + i) = 0; + g_ram[6 + i] = 0; flag_collected_moons[i] = 0; } ++flag_show_continue_and_end; @@ -1444,16 +1380,13 @@ void GameMode17_ShowDeathMessage() { // 009759 return; } timer_display_death_message_animation = v0; - R0_ = v0 - 96; - R1_ = 2 * R1_ + (v0 >= 0x60); + uint16 r0w = v0 + 0xa0; uint8 v2 = misc_death_message_to_display; uint8 v3 = 72; do { - if (v3 == 40) { - R0_ = 120 - timer_display_death_message_animation; - R1_ = (2 * (120 - timer_display_death_message_animation) + (timer_display_death_message_animation <= 0x78)) ^ 1; - } - DrawLoadingLetters_Draw(v2++, v3); + if (v3 == 40) + r0w = 120 - timer_display_death_message_animation; + DrawLoadingLetters_Draw(v2++, v3, r0w); v3 -= 8; } while (v3); CompressOamEntExt(); @@ -1468,7 +1401,7 @@ void GameMode12_PrepareLevel_PrepareMode7Level() { // 0097bc misc_m7_angle = 0x2020; LOBYTE(shaking_layer1_disp_y) = 0; ClearLayer3Tilemap(); - misc_level_tileset_setting = -1; + misc_level_tileset_setting = 0xff; GameMode12_PrepareLevel_UploadTiltingPlatformTilemap(); if ((misc_nmito_use_flag & 0x40) == 0) { BufferPalettesRoutines_IggyLarryPlatform(); @@ -1505,9 +1438,9 @@ void GameMode12_PrepareLevel_PrepareMode7Level() { // 0097bc LABEL_9: graphics_level_sprite_graphics_setting = v0; UploadGraphicsFiles(); - WriteReg(TMW, 0x11); - WriteReg(TS, 0); - WriteReg(TSW, 0); + RtlPpuWrite(TMW, 0x11); + RtlPpuWrite(TS, 0); + RtlPpuWrite(TSW, 0); mirror_bg1_and2_window_mask_settings = 2; mirror_object_and_color_window_settings = 50; mirror_color_math_initial_settings = 32; @@ -1545,13 +1478,7 @@ void UploadMode7KoopaBossesAndLavaAnimation() { // 0098a9 int8 v0 = misc_nmito_use_flag & 1; if (!(misc_nmito_use_flag & 1)) { uint8 v1 = (counter_local_frames >> 2) & 6; - WriteReg(VMAIN, 0x80); - WriteRegWord(DMAP2, 0x1801); - WriteRegWord(VMADDL, 0x7800); - WriteRegWord(A1T2L, kLevelTileAnimations_FrameData_Local1_Frame5[v1 >> 1]); - WriteReg(A1B2, 0x7E); - WriteRegWord(DAS2L, 0x80); - WriteReg(MDMAEN, 4); + SmwCopyToVram(0x7800, g_ram + kLevelTileAnimations_FrameData[(v1 + 0xa0) >> 1], 0x80); v0 = 0; } uint16 v2 = 4; @@ -1560,18 +1487,12 @@ void UploadMode7KoopaBossesAndLavaAnimation() { // 0098a9 v2 = 8; v3 = 22; } - R0_W = v2; - R2_W = 0xc680; - WriteRegWord(VMAIN, 0); - WriteRegWord(DMAP2, 0x1800); - WriteReg(A1B2, 0x7E); + uint16 r0w = v2; + uint16 r2w = 0xc680; do { - WriteRegWord(VMADDL, kUploadMode7KoopaBossesAndLavaAnimation_VRAMAddressToUpload[v3 >> 1]); - uint16 v4 = R2_W; - WriteRegWord(A1T2L, R2_W); - R2_W = R0_W + v4; - WriteRegWord(DAS2L, R0_W); - WriteReg(MDMAEN, 4); + SmwCopyToVramLow(kUploadMode7KoopaBossesAndLavaAnimation_VRAMAddressToUpload[v3 >> 1], + g_ram + r2w, r0w); + r2w += r0w; v3 -= 2; } while ((v3 & 0x80) == 0); } @@ -1602,7 +1523,7 @@ void GameMode12_PrepareLevel_PrepareNonIggyLarryRoom() { // 009925 v3 = 0xfb80; if (v4 == 18) v3 = 800; - R0_W = v3; + uint16 r0w = v3; uint16 v5 = 0; int16 v6 = 0xc05a; do { @@ -1615,7 +1536,7 @@ void GameMode12_PrepareLevel_PrepareNonIggyLarryRoom() { // 009925 LOBYTE(v7) = HIBYTE(v7); HIBYTE(v7) = v9; *(uint16 *)&stripe_image_upload_data[v5 + 132] = v7; - v10 = __PAIR16__(v7, v9) - R0_W; + v10 = __PAIR16__(v7, v9) - r0w; int8 v11 = v10; LOBYTE(v10) = HIBYTE(v10); HIBYTE(v10) = v11; @@ -1708,7 +1629,6 @@ void GameMode04_PrepareTitleScreen() { // 009a8b mirror_color_math_initial_settings = 18; GameMode06_CircleEffect_009443(); timer_title_screen_input_timer = 16; - GameMode00_LoadNintendoPresents_Mode04Finish(); } uint8 HandleMenuCursor_Main_ReturnsTwice(uint8 j) { // 009ad0 @@ -1726,8 +1646,8 @@ uint8 HandleMenuCursor_Main_ReturnsTwice(uint8 j) { // 009ad0 counter_blinking_cursor_frame = 0; uint8 v2 = misc_blinking_cursor_pos + kHandleMenuCursor_DATA_009AC8[(what >> 2) - 1]; if ((int8)v2 < 0) - v2 = temp8a - 1; - if (v2 >= temp8a) + v2 = player_collision_var8a - 1; + if (v2 >= player_collision_var8a) misc_blinking_cursor_pos = 0; else misc_blinking_cursor_pos = v2; @@ -1769,8 +1689,7 @@ void GameMode09_EraseFile() { // 009b1a } else { misc_blinking_cursor_pos = v0; misc_which_file_to_erase |= kGameMode09_EraseFile_DATA_009B17[v0]; - R5_ = misc_which_file_to_erase; - BufferFileSelectText_Entry3(0); + BufferFileSelectText_Entry3(0, misc_which_file_to_erase); } } } @@ -1819,13 +1738,13 @@ void SaveGame() { // 009bc9 uint16 v0 = PAIR16(kSaveFileLocations_Hi[misc_current_save_file], kSaveFileLocations_Lo[misc_current_save_file]); for (int k = v0; ; k += 288) { uint16 j = 0; - WORD(temp8a) = 0; + uint16 sum = 0; do { uint8 v3 = ow_save_buffer[j]; g_sram[k++] = v3; - WORD(temp8a) += v3; + sum += v3; } while (++j < 0x8D); - WORD(g_sram[k]) = 0x5a5a - *(uint16 *)&temp8a; + WORD(g_sram[k]) = 0x5a5a - sum; if (k >= 0x1ad) break; } @@ -1869,12 +1788,12 @@ void GameMode07_TitleScreenDemo_FadeOutToTitleScreen() { // 009c89 void GameMode07_TitleScreenDemo_InitializeFileSelect() { // 009c9f ResetSpritesFunc(0); - WriteReg(TM, 4); - WriteReg(TS, 0x13); - + RtlPpuWrite(TM, 4); + RtlPpuWrite(TS, 0x13); + // Ensure the black thing goes away at the intro - WriteReg(WH0, 0); - WriteReg(WH1, 0xff); + RtlPpuWrite(WH0, 0); + RtlPpuWrite(WH1, 0xff); mirror_hdmaenable = 0; GameMode07_TitleScreenDemo_InitializeSaveData(); @@ -1884,7 +1803,7 @@ void GameMode07_TitleScreenDemo_InitializeSaveData() { // 009cb0 misc_intro_level_flag = -23; InitializeSaveData(); BufferFileSelectText(); - GameMode01_ShowNintendoPresents_009417(); + ++misc_game_mode; } uint8 GameMode07_TitleScreenDemo_009CBE() { // 009cbe @@ -1905,8 +1824,7 @@ void GameMode08_FileSelect() { // 009cd1 ++*(uint16 *)&misc_game_mode; if (v0 == 3) { misc_which_file_to_erase = 0; - R5_ = 0; - BufferFileSelectText_Entry3(0); + BufferFileSelectText_Entry3(0, 0); } else { misc_current_save_file = v0; PairU16 v1 = BufferFileSelectText_009DB5(v0); @@ -1915,11 +1833,11 @@ void GameMode08_FileSelect() { // 009cd1 if (first != 0xffff) { uint16 v6 = first; misc_intro_level_flag = 0; - R0_ = -113; + uint8 r0 = -113; do { g_sram[second++] = g_sram[first++]; - --R0_; - } while (R0_); + --r0; + } while (r0); uint16 v4 = v6; for (uint16 i = 0; i < 0x8D; ++i) ow_save_buffer[i] = g_sram[v4++]; @@ -1942,11 +1860,12 @@ void FileSelectColorMath(uint16 a, uint8 j) { // 009d30 } void BufferFileSelectText() { // 009d38 - R5_ = 0; - BufferFileSelectText_Entry3(0xCB); + BufferFileSelectText_Entry3(0xCB, 0); } -void BufferFileSelectText_Entry3(uint8 k) { // 009d3c +#define kFileSelectText_EraseFile ((uint8*)RomFixedPtr(0x5B6FE)) + +void BufferFileSelectText_Entry3(uint8 k, uint8 r5) { // 009d3c uint16 kk = k; int16 v1 = k; @@ -1954,12 +1873,11 @@ void BufferFileSelectText_Entry3(uint8 k) { // 009d3c stripe_image_upload_data[i] = kFileSelectText_EraseFile[kk]; kk = kk + 1; } - R0_ = -124; + uint8 r0 = -124; uint8 v3 = 2; do { - R4_ = v3; - int8 v4 = R5_ & 1; - R5_ >>= 1; + int8 v4 = r5 & 1; + r5 >>= 1; if (!v4) { uint16 first = BufferFileSelectText_009DB5(v3).first; if (first != 0xffff) { @@ -1972,8 +1890,8 @@ void BufferFileSelectText_Entry3(uint8 k) { // 009d3c second = -121; v7 = -120; } - uint8 v9 = R0_; - stripe_image_upload_data[R0_ + 4] = v7; + uint8 v9 = r0; + stripe_image_upload_data[r0 + 4] = v7; if (!second) second = -4; stripe_image_upload_data[v9 + 2] = second; @@ -1987,9 +1905,8 @@ void BufferFileSelectText_Entry3(uint8 k) { // 009d3c } while (v10); } } - R0_ -= 36; - v3 = R4_ - 1; - } while ((int8)(R4_ - 1) >= 0); + r0 -= 36; + } while ((int8)--v3 >= 0); } PairU16 BufferFileSelectText_009DB5(uint8 k) { // 009db5 @@ -2002,13 +1919,13 @@ PairU16 BufferFileSelectText_009DB5(uint8 k) { // 009db5 for (;;) { uint16 v9 = v2; uint16 v8 = i; - WORD(temp8a) = *(uint16 *)&g_sram[v2 + 141]; + uint16 sum = WORD(g_sram[v2 + 141]); uint16 v4 = 141; do { - WORD(temp8a) += g_sram[v2++]; + sum += g_sram[v2++]; } while (--v4); - if (WORD(temp8a) == 0x5A5A) + if (sum == 0x5A5A) return MakePairU16(v9, v8); if (v9 >= 428) return MakePairU16(v9 == 428 ? v9 : 0xffff, v8); @@ -2065,37 +1982,29 @@ void GameMode0A_PlayerSelect_009E62() { // 009e62 } void HandleMenuCursor_009E82(uint8 j) { // 009e82 - int16 v5; - uint8 v1 = kHandleMenuCursor_DATA_009E7E[misc_blinking_cursor_pos]; if (((counter_blinking_cursor_frame ^ 0x1F) & 0x18) == 0) v1 = 0; - R0_ = v1; + uint8 r0w = v1; uint8 v2 = stripe_image_upload; int v3 = j >> 1; - *(uint16 *)&temp8a = kHandleMenuCursor_DATA_009E6A[v3]; - R2_W = *(uint16 *)&temp8a; + *(uint16 *)&player_collision_var8a = kHandleMenuCursor_DATA_009E6A[v3]; + uint16 r2w = *(uint16 *)&player_collision_var8a; uint16 v4 = kHandleMenuCursor_DATA_009E74[v3]; do { - int8 v6 = v4; - LOBYTE(v5) = HIBYTE(v4); - HIBYTE(v5) = v6; - *(uint16 *)&stripe_image_upload_data[v2] = v5; - int8 v7 = v5; - LOBYTE(v5) = v6; - HIBYTE(v5) = v7; - uint16 v10 = v5 + 64; - *(uint16 *)&stripe_image_upload_data[v2 + 2] = 256; + WORD(stripe_image_upload_data[v2]) = swap16(v4); + uint16 v10 = v4 + 64; + WORD(stripe_image_upload_data[v2 + 2]) = 256; int16 v8 = 0x38fc; - int8 v9 = R0_W & 1; - R0_W >>= 1; + int8 v9 = r0w & 1; + r0w >>= 1; if (v9) v8 = 0x3d2e; - *(uint16 *)&stripe_image_upload_data[v2 + 4] = v8; + WORD(stripe_image_upload_data[v2 + 4]) = v8; v4 = v10; v2 += 6; - --R2_W; - } while (R2_W); + --r2w; + } while (r2w); HandleMenuCursor_009ED4(v2); } @@ -2146,7 +2055,7 @@ void GameModeXX_FadeInOrOut_GMMosaic() { // 009f5b } void GameModeXX_FadeInOrOut_009F66() { // 009f66 - WriteReg(MOSAIC, mirror_mosaic_size_and_bgenable | 3); + RtlPpuWrite(MOSAIC, mirror_mosaic_size_and_bgenable | 3); } void GameModeXX_FadeInOrOut() { // 009f6f @@ -2167,11 +2076,12 @@ void GameMode28_ShowTheEnd() { // 009f7c } } + void InitializeLevelLayer3() { // 009fb8 uint8 v4; - R0_ = 3 * misc_level_tileset_setting; + uint8 r0 = 3 * misc_level_tileset_setting; if (misc_level_layer3_settings) { - uint8 v0 = R0_ + misc_level_layer3_settings - 1; + uint8 v0 = r0 + misc_level_layer3_settings - 1; int8 v1 = kInitializeLevelLayer3_DATA_009F88[v0]; if (v1 >= 0) { flag_layer3_tide_level = kInitializeLevelLayer3_DATA_009F88[v0]; @@ -2201,12 +2111,8 @@ void InitializeLevelLayer3() { // 009fb8 mirror_color_math_select_and_enable &= ~4; LABEL_16: if (misc_level_layer3_settings) { - R1_ = R0_ + misc_level_layer3_settings - 1; - uint8 v6 = R1_; - R0_ = *((uint8 *)&kInitializeLevelLayer3_Layer3ImagePtrs[0].addr + (uint8)(3 * R1_)); - R1_ = *((uint8 *)&kInitializeLevelLayer3_Layer3ImagePtrs[0].addr + (uint8)(3 * R1_) + 1); - R2_ = kInitializeLevelLayer3_Layer3ImagePtrs[v6].bank; - LoadStripeImage_UploadToVRAM(R2_); + uint8 v6 = r0 + misc_level_layer3_settings - 1; + LoadStripeImage_UploadToVRAM(IndirPtr(&kInitializeLevelLayer3_Layer3ImagePtrs[v6], 0)); } } @@ -2232,7 +2138,6 @@ void GameMode0C_LoadOverworld() { // 00a087 ow_players_map[0] = 0; mirror_mosaic_size_and_bgenable = -16; misc_game_mode = 16; - GameMode00_LoadNintendoPresents_Mode04Finish(); return; } ClearLayer3Tilemap(); @@ -2257,7 +2162,7 @@ void GameMode0C_LoadOverworld() { // 00a087 LoadSaveBufferData(); if (!counter_events_triggered) { GameMode07_TitleScreenDemo_FadeOutToTitleScreen(); - GameMode00_LoadNintendoPresents_0093F4(); + ++misc_game_mode; return; } LoadOverworldLayer2AndEventsTilemaps(); @@ -2268,8 +2173,8 @@ void GameMode0C_LoadOverworld() { // 00a087 v3 = 23; } SetVisibleLayers(v2, v3, 2); - WriteReg(TMW, v3); - WriteReg(TSW, 2); + RtlPpuWrite(TMW, v3); + RtlPpuWrite(TSW, 2); LoadOverworldLayer1AndEvents(); int v4 = (uint8)(2 * ow_players_map[player_current_character]) >> 1; mirror_current_layer1_xpos = kGameMode0C_LoadOverworld_DATA_00A06B[v4]; @@ -2277,7 +2182,7 @@ void GameMode0C_LoadOverworld() { // 00a087 mirror_current_layer1_ypos = kGameMode0C_LoadOverworld_DATA_00A079[v4]; mirror_current_layer2_ypos = mirror_current_layer1_ypos; UploadGraphicsFiles(); - GraphicsDecompressionRoutines(0x14); + GraphicsDecompress(0x14); BufferPalettesRoutines_Overworld(); UpdateEntirePalette(); graphics_stripe_image_to_upload = 6; @@ -2297,7 +2202,7 @@ void GameMode0C_LoadOverworld() { // 00a087 misc_hdmawindow_effect_table[i + 1] = -1; } SetupHDMAWindowingEffects_0092A0(); - GameMode00_LoadNintendoPresents_0093F4(); + ++misc_game_mode; } void LoadSaveBufferData() { // 00a195 @@ -2397,100 +2302,59 @@ void UpdateCurrentPlayerPositionRAM() { // 00a2f3 void UploadPlayerGFX() { // 00a300 if (player_number_of_tiles_to_update) { - WriteReg(CGADD, 0x86); - WriteRegWord(DMAP2, 0x2200); - WriteRegWord(A1T2L, pointer_player_palette); - WriteReg(A1B2, 0); - WriteRegWord(DAS2L, 0x14); - WriteReg(MDMAEN, 4); - } - WriteReg(VMAIN, 0x80); - WriteRegWord(DMAP2, 0x1801); - WriteRegWord(VMADDL, 0x67F0); - WriteRegWord(A1T2L, graphics_dynamic_sprite_tile7 ? graphics_dynamic_sprite_tile7 : 0x2000); - WriteReg(A1B2, 0x7E); - WriteRegWord(DAS2L, 0x20); - WriteReg(MDMAEN, 4); - WriteRegWord(VMADDL, 0x6000); + RtlUpdatePalette((uint16*)RomPtr_00(pointer_player_palette), 0x86, 10); + } + SmwCopyToVram(0x67f0, g_ram + (graphics_dynamic_sprite_tile7 ? graphics_dynamic_sprite_tile7 : 0x2000), 0x20); + uint8 v0 = 0; do { uint16 t = *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[v0]; - WriteRegWord(A1T2L, t ? t : 0x2000); // bugfix to make predictable behavior - WriteRegWord(DAS2L, 0x40); - WriteReg(MDMAEN, 4); + SmwCopyToVram(0x6000 + v0 * 0x10, g_ram + (t ? t : 0x2000), 0x40); v0 += 2; } while (v0 < player_number_of_tiles_to_update); - WriteRegWord(VMADDL, 0x6100); + uint8 v1 = 0; do { uint16 t = *(uint16 *)&graphics_dynamic_sprite_pointers_bottom_lo[v1]; - WriteRegWord(A1T2L, t ? t : 0x2000); // bugfix to make predictable behavior - WriteRegWord(DAS2L, 0x40); - WriteReg(MDMAEN, 4); + // bugfix to make predictable behavior + SmwCopyToVram(0x6100 + v1 * 0x10, g_ram + (t ? t : 0x2000), 0x40); v1 += 2; } while (v1 < player_number_of_tiles_to_update); } void UploadLevelExAnimationData() { // 00a390 - WriteReg(VMAIN, 0x80); - WriteRegWord(DMAP2, 0x1801); - WriteReg(A1B2, 0x7E); - if (graphics_tile_anim_vramaddress3) { - WriteRegWord(VMADDL, graphics_tile_anim_vramaddress3); - WriteRegWord(A1T2L, graphics_tile_anim_source_address3); - WriteRegWord(DAS2L, 0x80); - WriteReg(MDMAEN, 4); - } - if (graphics_tile_anim_vramaddress2) { - WriteRegWord(VMADDL, graphics_tile_anim_vramaddress2); - WriteRegWord(A1T2L, graphics_tile_anim_source_address2); - WriteRegWord(DAS2L, 0x80); - WriteReg(MDMAEN, 4); - } + if (graphics_tile_anim_vramaddress3) + SmwCopyToVram(graphics_tile_anim_vramaddress3, g_ram + graphics_tile_anim_source_address3, 0x80); + if (graphics_tile_anim_vramaddress2) + SmwCopyToVram(graphics_tile_anim_vramaddress2, g_ram + graphics_tile_anim_source_address2, 0x80); uint16 v0 = graphics_tile_anim_vramaddress1; if (graphics_tile_anim_vramaddress1) { - WriteRegWord(VMADDL, graphics_tile_anim_vramaddress1); - WriteRegWord(A1T2L, graphics_tile_anim_source_address1); if (v0 == 0x800) { - WriteRegWord(DAS2L, 0x40); - WriteReg(MDMAEN, 4); - WriteRegWord(VMADDL, 0x900); - WriteRegWord(A1T2L, graphics_tile_anim_source_address1 + 64); - WriteRegWord(DAS2L, 0x40); + SmwCopyToVram(graphics_tile_anim_vramaddress1, g_ram + graphics_tile_anim_source_address1, 0x40); + SmwCopyToVram(0x900, g_ram + graphics_tile_anim_source_address1 + 64, 0x40); } else { - WriteRegWord(DAS2L, 0x80); + SmwCopyToVram(graphics_tile_anim_vramaddress1, g_ram + graphics_tile_anim_source_address1, 0x80); } - WriteReg(MDMAEN, 4); } UploadLevelAnimations_YellowFlash(0x64); } void UploadLevelAnimations_YellowFlash(uint8 a) { // 00a41c - R0_ = 0; - UploadLevelAnimations_RedFlash(a); + UploadLevelAnimations_RedFlash(a, 0); } -void UploadLevelAnimations_RedFlash(uint8 a) { // 00a41e - WriteReg(CGADD, a); - uint8 v1 = R0_ + ((uint8)(counter_local_frames & 0x1C) >> 1); - WriteReg(CGDATA, *((uint8 *)kGlobalPalettes_Flashing + v1)); - WriteReg(CGDATA, *((uint8 *)kGlobalPalettes_Flashing + v1 + 1)); +void UploadLevelAnimations_RedFlash(uint8 a, uint8 r0) { // 00a41e + RtlPpuWrite(CGADD, a); + uint8 v1 = r0 + ((uint8)(counter_local_frames & 0x1C) >> 1); + RtlPpuWrite(CGDATA, *((uint8 *)kGlobalPalettes_Flashing + v1)); + RtlPpuWrite(CGDATA, *((uint8 *)kGlobalPalettes_Flashing + v1 + 1)); } void RestoreSP1AfterMarioStart() { // 00a436 if (flag_restoresp1_tiles_after_mario_start) { flag_restoresp1_tiles_after_mario_start = 0; - WriteReg(VMAIN, 0x80); - WriteRegWord(VMADDL, 0x64A0); - WriteRegWord(DMAP2, 0x1801); - WriteRegWord(A1T2L, 0xBF6); - WriteReg(A1B2, 0); - WriteRegWord(DAS2L, 0xC0); - WriteReg(MDMAEN, 4); - WriteRegWord(VMADDL, 0x65A0); - WriteRegWord(A1T2L, 0xCB6); - WriteRegWord(DAS2L, 0xC0); - WriteReg(MDMAEN, 4); + SmwCopyToVram(0x64a0, g_ram + 0xbf6, 0xc0); + SmwCopyToVram(0x65a0, g_ram + 0xcb6, 0xc0); } } @@ -2501,27 +2365,14 @@ void UpdatePaletteFromIndexedTable() { // 00a488 return; uint16 v0 = kUpdatePaletteFromIndexedTable_DATA_00A47F[palettes_palette_upload_table_index + 2]; - R2_ = v0; - R1_ = 0; - R0_ = 0; - R4_ = 0; + LongPtr p0 = { .bank = v0, .addr = 0 }; v1 = WORD(kUpdatePaletteFromIndexedTable_DATA_00A47F[palettes_palette_upload_table_index]); uint16 v2 = v1; - while (1) { - uint8 v3 = *IndirPtr(&R0_, v2); - if (!v3) - break; - WriteRegWord(A1B2, v0); - WriteReg(DAS2L, v3); - R3_ = v3; - WriteReg(DAS2H, 0); - uint16 v4 = v2 + 1; - uint8 *v5 = IndirPtr(&R0_, v4); - WriteReg(CGADD, *v5); - WriteRegWord(DMAP2, 0x2200); - WriteRegWord(A1T2L, ++v4); - v2 = *(uint16 *)&R3_ + v4; - WriteReg(MDMAEN, 4); + uint8 *p = IndirPtr(&p0, v2); + int n; + while ((n = p[0]) != 0) { + RtlUpdatePalette((uint16 *)(p + 2), p[1], n >> 1); + p += 2 + n; } UpdatePaletteFromIndexedTable_00AE47(); if (!palettes_palette_upload_table_index) { @@ -2532,37 +2383,20 @@ void UpdatePaletteFromIndexedTable() { // 00a488 } void UploadOverworldExAnimationData() { // 00a4e3 - WriteReg(VMAIN, 0x80); - WriteRegWord(VMADDL, 0x750); - WriteRegWord(DMAP2, 0x1801); - WriteRegWord(A1T2L, 0xAF6); - WriteReg(A1B2, 0); - WriteRegWord(DAS2L, 0x160); - WriteReg(MDMAEN, 4); + SmwCopyToVram(0x750, g_ram + 0xaf6, 0x160); if (pointer_current_overworld_process != 10) { UploadLevelAnimations_YellowFlash(0x6D); - R0_ = 16; - UploadLevelAnimations_RedFlash(0x7D); + UploadLevelAnimations_RedFlash(0x7D, 16); } } void UploadOverworldLayer1And2Tilemaps(uint8 j) { // 00a529 - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0); - WriteReg(VMADDH, kUploadOverworldLayer1And2Tilemaps_DATA_00A521[j] + 48); - for (uint8 i = 6; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + 0x4310), kUploadOverworldLayer1And2Tilemaps_PARAMS_00A586[i]); - if (ow_players_map[(uint8)player_current_characterx4 >> 2]) - WriteReg(A1T1H, 0x60); - uint8 Reg = ReadReg(A1T1H); - WriteReg(A1T1H, kUploadOverworldLayer1And2Tilemaps_DATA_00A525[j] + Reg); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0); - WriteReg(VMADDH, kUploadOverworldLayer1And2Tilemaps_DATA_00A521[j] + 32); - for (uint8 k = 6; (k & 0x80) == 0; --k) - WriteReg((SnesRegs)(k + 0x4310), kUploadOverworldLayer1And2Tilemaps_PARAMS_00A58D[k]); - WriteReg(MDMAEN, 2); + uint32 ram = ow_players_map[(uint8)player_current_characterx4 >> 2] ? 0x16000 : 0x14000; + ram += kUploadOverworldLayer1And2Tilemaps_DATA_00A525[j] << 8; + SmwCopyToVram( + (kUploadOverworldLayer1And2Tilemaps_DATA_00A521[j] + 48) << 8, + g_ram + ram, 0x800); + SmwCopyToVram((kUploadOverworldLayer1And2Tilemaps_DATA_00A521[j] + 32) << 8, g_ram + 0xe400, 0x800); } void GameMode12_PrepareLevel() { // 00a59c @@ -2592,7 +2426,7 @@ void GameMode12_PrepareLevel() { // 00a59c palettes_copy_of_background_color = palettes_background_color; GameMode12_PrepareLevel_00919B(); CompressOamEntExt(); - GameMode00_LoadNintendoPresents_0093F4(); + ++misc_game_mode; } void InitializeLevelTileAnimations() { // 00a5f9 @@ -2605,11 +2439,12 @@ void InitializeLevelTileAnimations() { // 00a5f9 } void InitializeLevelRAM() { // 00a635 + int8 v0 = 0; if (spr45_directional_coins_despawn_timer | timer_silver_pswitch | timer_blue_pswitch) goto LABEL_4; if (!timer_star_power) goto LABEL_6; - int8 v0 = misc_music_register_backup; + v0 = misc_music_register_backup; if ((misc_music_register_backup & 0x80) != 0) LABEL_4: v0 = misc_music_register_backup & 0x7F; @@ -2627,7 +2462,7 @@ void InitializeLevelRAM() { // 00a635 blocks_give_life_in_bonus_flags_row1; uint8 v1 = 35; do - *(&ptr_hi_map16_data_bank + v1--) = 0; + *(&ptr_hi_map16_data.bank + v1--) = 0; while (v1); uint8 v2 = 55; do @@ -2680,8 +2515,8 @@ void InitializeLevelRAM_00A6CC(uint8 j) { // 00a6cc flag_sprites_locked = 0; if (timer_end_level_via_keyhole) { misc_music_register_backup |= 0x7F; - temp1436 = player_xpos | 4; - temp1438 = player_ypos + 16; + LOBYTE(player_on_tilting_platform_xpos) = player_xpos | 4; + LOBYTE(player_on_tilting_platform_ypos) = player_ypos + 16; } if (in_yoshi_wings_bonus_area) { player_current_state = 8; @@ -2707,7 +2542,7 @@ void InitializeLevelRAM_00A6CC(uint8 j) { // 00a6cc } player_pipe_action = v1 + 3; yoshi_in_pipe = ((uint8)(v1 + 3) >> 1) - 1; - player_facing_direction = kInitializeLevelRAM_DATA_00A60D[(uint8)(v1 + 3) - 4]; + player_facing_direction = kInitializeLevelRAM_DATA_00A60D[v1 - 1]; uint8 v3 = 5; if ((uint8)(v1 + 3) < 6 || (LOBYTE(player_xpos) = player_xpos | 8, v3 = 6, v4 = 30, (uint8)(v1 + 3) >= 7) && (v4 = 15, player_current_power_up)) { @@ -2716,9 +2551,9 @@ void InitializeLevelRAM_00A6CC(uint8 j) { // 00a6cc player_yspeed = v4; InitializeLevelRAM_00A6C7(v3, v4); if (player_riding_yoshi_flag) { - player_timer_pipe_warping += kInitializeLevelRAM_DATA_00A61D[player_pipe_action]; - player_xpos += *(uint16 *)&kInitializeLevelRAM_DATA_00A60D[(uint8)(2 * player_pipe_action) - 4]; - player_ypos += kInitializeLevelRAM_DATA_00A611[player_pipe_action]; + player_timer_pipe_warping += kInitializeLevelRAM_DATA_00A621[player_pipe_action - 4]; + player_xpos += kInitializeLevelRAM_DATA_00A611[player_pipe_action - 4]; + player_ypos += kInitializeLevelRAM_DATA_00A619[player_pipe_action - 4]; } } @@ -2739,177 +2574,136 @@ void GameMode11_LoadSublevel_00A796() { // 00a796 } void UploadLoadingLettersTiles() { // 00a7c2 - WriteReg(VMAIN, 0x80); - WriteRegWord(VMADDL, 0x6000); - WriteRegWord(DMAP2, 0x1801); - WriteRegWord(A1T2L, 0x977B); - WriteReg(A1B2, 0x7F); - WriteRegWord(DAS2L, 0xC0); - WriteReg(MDMAEN, 4); - WriteRegWord(VMADDL, 0x6100); - WriteRegWord(A1T2L, 0x983B); - WriteRegWord(DAS2L, 0xC0); - WriteReg(MDMAEN, 4); - WriteRegWord(VMADDL, 0x64A0); - WriteRegWord(A1T2L, 0x98FB); - WriteRegWord(DAS2L, 0xC0); - WriteReg(MDMAEN, 4); - WriteRegWord(VMADDL, 0x65A0); - WriteRegWord(A1T2L, 0x99BB); - WriteRegWord(DAS2L, 0xC0); - WriteReg(MDMAEN, 4); + SmwCopyToVram(0x6000, g_ram + 0x1977b, 0xc0); + SmwCopyToVram(0x6100, g_ram + 0x1983B, 0xc0); + SmwCopyToVram(0x64a0, g_ram + 0x198fB, 0xc0); + SmwCopyToVram(0x65a0, g_ram + 0x199bb, 0xc0); } void BufferLoadingLetterTiles() { // 00a82d - GraphicsDecompressionRoutines(0xF); + const uint8 *p0 = GraphicsDecompress(0xF); if (flag_active_bonus_game) - R0_W += 48; + p0 += 48; uint16 v0 = 0; do { int16 v1 = 8; do { - *(uint16 *)&graphics_decompressed_loading_letters[v0] = *(uint16 *)IndirPtr(&R0_W, 0); + *(uint16 *)&graphics_decompressed_loading_letters[v0] = WORD(*p0); v0 += 2; - ++R0_W; - ++R0_W; + p0 += 2; --v1; } while (v1); int16 v2 = 8; do { - *(uint16 *)&graphics_decompressed_loading_letters[v0] = *IndirPtr(&R0_W, 0); + *(uint16 *)&graphics_decompressed_loading_letters[v0] = p0[0]; v0 += 2; - ++R0_W; + p0 += 1; --v2; } while (v2); } while (v0 < 0x300); - GraphicsDecompressionRoutines(0); - R0_W = 0xb3f0; - *(uint16 *)&R1_ = 0x7eb3; + GraphicsDecompress(0); + p0 = g_ram + 0xb3f0; uint16 v3 = 0; do { int16 v4 = 8; do { - decompressed_gfx_plus_256[v3 >> 1] = *(uint16 *)IndirPtr(&R0_W, 0); + decompressed_gfx_plus_256[v3 >> 1] = WORD(p0[0]); v3 += 2; - ++R0_W; - ++R0_W; + p0 += 2; --v4; } while (v4); int16 v5 = 8; do { - decompressed_gfx_plus_256[v3 >> 1] = *IndirPtr(&R0_W, 0); + decompressed_gfx_plus_256[v3 >> 1] = p0[0]; v3 += 2; - ++R0_W; + p0 += 1; --v5; } while (v5); if (v3 == 192) - R0_W = 0xb570; + p0 = &g_ram[0xb570]; } while (v3 < 0x180); flag_upload_load_screen_letters_tovram = 1; flag_restoresp1_tiles_after_mario_start = 1; } void UploadGraphicsFiles_Layer3() { // 00a993 - WriteReg(VMADDL, 0); - WriteReg(VMADDH, 0x40); - R15_ = 3; - R14_ = 40; - do { - GraphicsDecompressionRoutines(R14_); - int16 v0 = 0x3ff; - uint16 v1 = 0; - do { - uint8 *v2 = IndirPtr(&R0_W, v1); - WriteRegWord(VMDATAL, *(uint16 *)v2); - v1 += 2; - --v0; - } while (v0 >= 0); - ++R14_; - --R15_; - } while ((R15_ & 0x80) == 0); - WriteReg(VMADDL, 0); - WriteReg(VMADDH, 0x60); - UploadGraphicsFiles_UploadGFXFile(0); + for(int i = 0; i < 4; i++) { + const uint8 *p0 = GraphicsDecompress(40 + i); + SmwCopyToVram(0x4000 + i * 0x400, p0, 0x800); + } + UploadGraphicsFiles_UploadGFXFile(0x6000, 0); } void UploadGraphicsFiles() { // 00a9da - WriteReg(VMAIN, 0x80); + uint8 arr[4]; int8 v0 = 3; uint8 v1 = 4 * graphics_level_sprite_graphics_setting; do - *(&R4_ + (uint8)v0--) = kUploadGraphicsFiles_SpriteGFXList[v1++]; + arr[v0--] = kUploadGraphicsFiles_SpriteGFXList[v1++]; while (v0 >= 0); - R15_ = 3; + uint8 r15 = 3; do { - uint8 v2 = R15_; - WriteReg(VMADDL, 0); - WriteReg(VMADDH, kUploadGraphicsFiles_DATA_00A9D2[v2]); - if (misc_currently_loaded_sprite_graphics_files[v2] != *(&R4_ + v2)) - UploadGraphicsFiles_UploadGFXFile(*(&R4_ + v2)); - --R15_; - } while ((R15_ & 0x80) == 0); + uint8 v2 = r15; + uint16 vmaddl = kUploadGraphicsFiles_DATA_00A9D2[v2] << 8; + if (misc_currently_loaded_sprite_graphics_files[v2] != arr[v2]) + UploadGraphicsFiles_UploadGFXFile(vmaddl, arr[v2]); + --r15; + } while ((r15 & 0x80) == 0); for (uint8 i = 3; (i & 0x80) == 0; --i) - misc_currently_loaded_sprite_graphics_files[i] = *(&R4_ + i); + misc_currently_loaded_sprite_graphics_files[i] = arr[i]; if (misc_level_tileset_setting >= 0xFE) { if (misc_level_tileset_setting != 0xFE) - ConvertGFX27IntoNormallFormat(); + ConvertGFX27IntoNormallFormat(RtlGetVramAddr()); for (int8 j = 3; j >= 0; --j) misc_currently_loaded_sprite_graphics_files[(uint8)j + 4] = 0x80; } else { int8 v4 = 3; uint8 v5 = 4 * misc_level_tileset_setting; do - *(&R4_ + (uint8)v4--) = kUploadGraphicsFiles_FGAndBGGFXList[v5++]; + arr[v4--] = kUploadGraphicsFiles_FGAndBGGFXList[v5++]; while (v4 >= 0); - R15_ = 3; + r15 = 3; do { - uint8 v6 = R15_; - WriteReg(VMADDL, 0); - WriteReg(VMADDH, kUploadGraphicsFiles_DATA_00A9D6[v6]); - if (misc_currently_loaded_sprite_graphics_files[v6 + 4] != *(&R4_ + v6)) - UploadGraphicsFiles_UploadGFXFile(*(&R4_ + v6)); - --R15_; - } while ((R15_ & 0x80) == 0); + uint8 v6 = r15; + uint16 vmaddl = kUploadGraphicsFiles_DATA_00A9D6[v6] << 8; + if (misc_currently_loaded_sprite_graphics_files[v6 + 4] != arr[v6]) + UploadGraphicsFiles_UploadGFXFile(vmaddl, arr[v6]); + --r15; + } while ((r15 & 0x80) == 0); for (uint8 k = 3; (k & 0x80) == 0; --k) - misc_currently_loaded_sprite_graphics_files[k + 4] = *(&R4_ + k); + misc_currently_loaded_sprite_graphics_files[k + 4] = arr[k]; } } -void UploadGraphicsFiles_UploadGFXFile(uint8 j) { // 00aa6b +void UploadGraphicsFiles_UploadGFXFile(uint16 dst_addr, uint8 j) { // 00aa6b uint16 v4; - int16 v8; uint16 v11; - int16 v15; + uint16 *dst = RtlGetVramAddr() + dst_addr; - GraphicsDecompressionRoutines(j); + const uint8 *p0 = GraphicsDecompress(j); if (j == 1 && (ow_level_tile_settings[73] & 0x80) != 0) { - GraphicsDecompressionRoutines(0x31); + p0 = GraphicsDecompress(0x31); j = 1; } + if (misc_level_tileset_setting >= 0x11 && j == 8 || j == 30) { - R10_W = -256; + uint16 r10w = -256; for (int8 i = 127; i >= 0; --i) { for (int8 k = 7; k >= 0; --k) { - v11 = *(uint16 *)IndirPtr(&R0_W, 0); - WriteRegWord(VMDATAL, v11); - int8 v12 = v11; - LOBYTE(v11) = HIBYTE(v11); - HIBYTE(v11) = v12; - *(uint16 *)&graphics_3_bppto4_bppbuffer[(uint8)k] = *(uint16 *)IndirPtr(&R0_W, 0) | v11; - ++R0_W; - ++R0_W; + v11 = WORD(*p0); + *dst++ = v11; + *(uint16 *)&graphics_3_bppto4_bppbuffer[(uint8)k] = WORD(p0[0]) | swap16(v11); + p0 += 2; } for (int8 m = 7; m >= 0; --m) { - R12_W = *IndirPtr(&R0_W, 0); - uint8 *v14 = IndirPtr(&R0_W, 0); - LOBYTE(v15) = HIBYTE(*(uint16 *)v14); - HIBYTE(v15) = *(uint16 *)v14; - WriteRegWord(VMDATAL, R12_W | R10_W & (*(uint16 *)&graphics_3_bppto4_bppbuffer[(uint8)m] | v15)); - ++R0_W; + const uint8 *v14 = p0; + uint16 r12w = *v14; + *dst++ = r12w | r10w & (*(uint16 *)&graphics_3_bppto4_bppbuffer[(uint8)m] | swap16(*(uint16 *)v14)); + p0 += 1; } } } else { - R10_W = 0; + uint16 r10w = 0; int16 v1 = -1; if (j != 1 && j != 23) v1 = 0; @@ -2917,176 +2711,104 @@ void UploadGraphicsFiles_UploadGFXFile(uint8 j) { // 00aa6b for (int8 n = 127; n >= 0; --n) { if (*(uint16 *)flag_alter3_bppto4_bppconversion) { if ((uint8)n >= 0x7E || (uint8)n >= 0x6E && (uint8)n < 0x70) - R10_W = -256; + r10w = -256; else - R10_W = 0; + r10w = 0; } for (int8 ii = 7; ii >= 0; --ii) { - v4 = *(uint16 *)IndirPtr(&R0_W, 0); - WriteRegWord(VMDATAL, v4); - int8 v5 = v4; - LOBYTE(v4) = HIBYTE(v4); - HIBYTE(v4) = v5; - *(uint16 *)&graphics_3_bppto4_bppbuffer[(uint8)ii] = *(uint16 *)IndirPtr(&R0_W, 0) | v4; - ++R0_W; - ++R0_W; + v4 = WORD(*p0); + *dst++ = v4; + *(uint16 *)&graphics_3_bppto4_bppbuffer[(uint8)ii] = WORD(p0[0]) | swap16(v4); + p0 += 2; } for (int8 jj = 7; jj >= 0; --jj) { - R12_W = *IndirPtr(&R0_W, 0); - uint8 *v7 = IndirPtr(&R0_W, 0); - LOBYTE(v8) = HIBYTE(*(uint16 *)v7); - HIBYTE(v8) = *(uint16 *)v7; - WriteRegWord(VMDATAL, R12_W | R10_W & (*(uint16 *)&graphics_3_bppto4_bppbuffer[(uint8)jj] | v8)); - ++R0_W; + uint16 r12w = p0[0]; + const uint8 *v7 = p0; + *dst++ = r12w | r10w & (*(uint16 *)&graphics_3_bppto4_bppbuffer[(uint8)jj] | swap16(*(uint16 *)v7)); + ++p0; } } } } -void ConvertGFX27IntoNormallFormat() { // 00ab42 - GraphicsDecompressionRoutines(0x27); - uint8 *p = IndirPtr(&R0_, 0); +void ConvertGFX27IntoNormallFormat(uint16 *dst) { // 00ab42 + const uint8 *p = GraphicsDecompress(0x27); for (int i = 0x3ff; i >= 0; --i) { uint32 d = p[0] << 16 | p[1] << 8 | p[2]; - WriteReg(VMDATAH, (d >> 21) & 7); - WriteReg(VMDATAH, (d >> 18) & 7); - WriteReg(VMDATAH, (d >> 15) & 7); - WriteReg(VMDATAH, (d >> 12) & 7); - WriteReg(VMDATAH, (d >> 9) & 7); - WriteReg(VMDATAH, (d >> 6) & 7); - WriteReg(VMDATAH, (d >> 3) & 7); - WriteReg(VMDATAH, (d >> 0) & 7); + HIBYTE(*dst++) = (d >> 21) & 7; + HIBYTE(*dst++) = (d >> 18) & 7; + HIBYTE(*dst++) = (d >> 15) & 7; + HIBYTE(*dst++) = (d >> 12) & 7; + HIBYTE(*dst++) = (d >> 9) & 7; + HIBYTE(*dst++) = (d >> 6) & 7; + HIBYTE(*dst++) = (d >> 3) & 7; + HIBYTE(*dst++) = (d >> 0) & 7; p += 3; } int v11 = 0x2000; do { - WriteReg(VMDATAH, 0); + HIBYTE(*dst++) = 0; } while (--v11); } void BufferPalettesRoutines_Levels() { // 00abed - R4_W = 0x7fdd; - BufferPalettesRoutines_LoadColorInVerticalStrip(2); - R4_W = 0x7FFF; - BufferPalettesRoutines_LoadColorInVerticalStrip(0x102); - R0_W = 0xb170; - R4_W = 16; - R6_W = 7; - R8_W = 1; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb250; - R4_W = 132; - R6_W = 5; - R8_W = 9; - BufferPalettesRoutines_LoadColors(); - palettes_background_color = *(uint16 *)((int8 *)&kGlobalPalettes_Sky + (uint16)(2 * (misc_background_color_setting & 0xF))); - R0_W = 0xb190; - R0_W = kBufferPalettesRoutines_DATA_00ABD3[misc_fgpalette_setting & 0xF] + 0xb190; - R4_W = 68; - R6_W = 5; - R8_W = 1; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb318; - R0_W = kBufferPalettesRoutines_DATA_00ABD3[misc_sprite_palette_setting & 0xF] + 0xb318; - R4_W = 452; - R6_W = 5; - R8_W = 1; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb0b0; - R0_W = kBufferPalettesRoutines_DATA_00ABD3[misc_bgpalette_setting & 0xF] + 0xb0b0; - R4_W = 4; - R6_W = 5; - R8_W = 1; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb674; - R4_W = 82; - R6_W = 6; - R8_W = 2; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb674; - R4_W = 306; - R6_W = 6; - R8_W = 2; - BufferPalettesRoutines_LoadColors(); -} - -void BufferPalettesRoutines_LoadColorInVerticalStrip(uint16 k) { // 00aced + BufferPalettesRoutines_LoadColorInVerticalStrip(2, 0x7fdd); + BufferPalettesRoutines_LoadColorInVerticalStrip(0x102, 0x7FFF); + BufferPalettesRoutines_LoadColors(0xb170, 16, 7, 1); + BufferPalettesRoutines_LoadColors(0xb250, 132, 5, 9); + palettes_background_color = kGlobalPalettes_Sky[misc_background_color_setting & 0xF]; + uint16 r0w = kBufferPalettesRoutines_DATA_00ABD3[misc_fgpalette_setting & 0xF] + 0xb190; + BufferPalettesRoutines_LoadColors(r0w, 68, 5, 1); + r0w = kBufferPalettesRoutines_DATA_00ABD3[misc_sprite_palette_setting & 0xF] + 0xb318; + BufferPalettesRoutines_LoadColors(r0w, 452, 5, 1); + r0w = kBufferPalettesRoutines_DATA_00ABD3[misc_bgpalette_setting & 0xF] + 0xb0b0; + BufferPalettesRoutines_LoadColors(r0w, 4, 5, 1); + BufferPalettesRoutines_LoadColors(0xb674, 82, 6, 2); + BufferPalettesRoutines_LoadColors(0xb674, 306, 6, 2); +} + +void BufferPalettesRoutines_LoadColorInVerticalStrip(uint16 k, uint16 r4) { // 00aced for (int16 i = 7; i >= 0; --i) { - palettes_palette_mirror[k >> 1] = R4_W; + palettes_palette_mirror[k >> 1] = r4; k += 32; } } -void BufferPalettesRoutines_LoadColors() { // 00acff +void BufferPalettesRoutines_LoadColors(uint16 r0, uint16 r4, uint16 r6, uint16 r8) { // 00acff do { - uint16 v0 = R4_W; - int16 v1 = R6_W; + uint16 v0 = r4; + int16 v1 = r6; do { - palettes_palette_mirror[v0 >> 1] = *(uint16 *)RomPtr_00(R0_W); - ++R0_W; - ++R0_W; + palettes_palette_mirror[v0 >> 1] = *(uint16 *)RomPtr_00(r0); + r0 += 2; v0 += 2; - --v1; - } while (v1 >= 0); - R4_W += 32; - --R8_W; - } while ((R8_W & 0x8000) == 0); + } while (--v1 >= 0); + r4 += 32; + } while ((--r8 & 0x8000) == 0); } void BufferPalettesRoutines_Overworld() { // 00ad25 uint16 v0 = 0xb3d8; if (*(int16 *)&ow_level_tile_settings[72] < 0) v0 = 0xb732; - R0_W = v0; - R0_W = v0 + kBufferPalettesRoutines_DATA_00ABDF + uint16 r0w = v0 + kBufferPalettesRoutines_DATA_00ABDF [(uint16)(2 * kBufferPalettesRoutines_DATA_00AD1E[(uint16)((misc_level_tileset_setting & 0xF) - 1)]) >> 1]; - R4_W = 130; - R6_W = 6; - R8_W = 3; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb528; - R4_W = 82; - R6_W = 6; - R8_W = 5; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb57c; - R4_W = 258; - R6_W = 6; - R8_W = 7; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb5ec; - R4_W = 16; - R6_W = 7; - R8_W = 1; - BufferPalettesRoutines_LoadColors(); + BufferPalettesRoutines_LoadColors(r0w, 130, 6, 3); + BufferPalettesRoutines_LoadColors(0xb528, 82, 6, 5); + BufferPalettesRoutines_LoadColors(0xb57c, 258, 6, 7); + BufferPalettesRoutines_LoadColors(0xb5ec, 16, 7, 1); } void BufferPalettesRoutines_TitleScreen() { // 00ada6 - R0_W = 0xb63c; - R4_W = 16; - R6_W = 7; - R8_W = 0; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb62c; - R4_W = 48; - R6_W = 7; - R8_W = 0; - BufferPalettesRoutines_LoadColors(); + BufferPalettesRoutines_LoadColors(0xb63c, 16, 7, 0); + BufferPalettesRoutines_LoadColors(0xb62c, 48, 7, 0); } void BufferPalettesRoutines_IggyLarryPlatform() { // 00add9 BufferPalettesRoutines_Levels(); palettes_background_color = 23; - R0_W = 0xb170; - R4_W = 16; - R6_W = 7; - R8_W = 1; - BufferPalettesRoutines_LoadColors(); - R0_W = 0xb65c; - R4_W = 0; - R6_W = 7; - R8_W = 0; - BufferPalettesRoutines_LoadColors(); + BufferPalettesRoutines_LoadColors(0xb170, 16, 7, 1); + BufferPalettesRoutines_LoadColors(0xb65c, 0, 7, 0); } void BufferPalettesRoutines_ReznorAndMode7KoopaBosses() { // 00ae15 @@ -3094,11 +2816,7 @@ void BufferPalettesRoutines_ReznorAndMode7KoopaBosses() { // 00ae15 misc_fgpalette_setting = 7; BufferPalettesRoutines_Levels(); palettes_background_color = 23; - R0_W = 0xb5f4; - R4_W = 24; - R6_W = 3; - R8_W = 0; - BufferPalettesRoutines_LoadColors(); + BufferPalettesRoutines_LoadColors(0xb5f4, 24, 3, 0); } void UpdatePaletteFromIndexedTable_00AE47() { // 00ae47 @@ -3107,7 +2825,7 @@ void UpdatePaletteFromIndexedTable_00AE47() { // 00ae47 uint8 v2 = kUpdatePaletteFromIndexedTable_DATA_00AE41[i]; while ((--v2 & 0x80) == 0) v1 >>= 1; - WriteReg(COLDATA, kUpdatePaletteFromIndexedTable_DATA_00AE44[i] | v1 & 0x1F); + RtlPpuWrite(COLDATA, kUpdatePaletteFromIndexedTable_DATA_00AE44[i] | v1 & 0x1F); } } @@ -3123,75 +2841,92 @@ void HandlePaletteFades() { // 00af17 mirror_bgmode_and_tile_size_setting = 9; ProcessLevelEndRoutines(); } - HandlePaletteFades_00AF35(); + HandlePaletteFades_00AF35(false); } -void HandlePaletteFades_00AF35() { // 00af35 +void HandlePaletteFades_00AF35(bool run_code_at_end) { // 00af35 if ((counter_global_frames & 3) == 0 && timer_level_end_fade < 0x40) { - HandlePaletteFades_00AFA3(timer_level_end_fade); + uint8 a = timer_level_end_fade; + timer_level_end_fade = a + 2; + uint8 r12 = (a >> 4) & 2; + uint16 r14 = kHandlePaletteFades_DATA_00AEF7[(a & 0x1E) >> 1]; + uint16 r2w; + palettes_copy_of_palette_mirror[0] = 510; for (uint16 i = 238; (i & 0x8000) == 0; i -= 18) { - R0_W = 7; + uint16 r0w = 7; do { int v1 = i >> 1; - R2_W = palettes_copy_of_palette_mirror[v1]; - HandlePaletteFades_00AFC0(palettes_palette_mirror[v1]); - palettes_copy_of_palette_mirror[v1] = R4_W; + r2w = palettes_copy_of_palette_mirror[v1]; + palettes_copy_of_palette_mirror[v1] = HandlePaletteFades_00AFC0(palettes_palette_mirror[v1], r2w, r12, r14); i -= 2; - --R0_W; - } while (R0_W); + } while (--r0w); } for (uint16 j = 4; (j & 0x8000) == 0; j -= 2) { int v3 = j >> 1; - R2_W = palettes_copy_of_palette_mirror[v3 + 13]; - HandlePaletteFades_00AFC0(palettes_palette_mirror[v3 + 13]); - palettes_copy_of_palette_mirror[v3 + 13] = R4_W; + r2w = palettes_copy_of_palette_mirror[v3 + 13]; + palettes_copy_of_palette_mirror[v3 + 13] = HandlePaletteFades_00AFC0(palettes_palette_mirror[v3 + 13], r2w, r12, r14); } - R2_W = palettes_background_color; - HandlePaletteFades_00AFC0(palettes_copy_of_background_color); - palettes_background_color = R4_W; + r2w = palettes_background_color; + palettes_background_color = HandlePaletteFades_00AFC0(palettes_copy_of_background_color, r2w, r12, r14); LOBYTE(palettes_copy_of_palette_mirror[128]) = 0; palettes_palette_upload_table_index = 3; - } -} -void HandlePaletteFades_00AFA3(uint8 a) { // 00afa3 - timer_level_end_fade = a + 2; - R12_W = (a >> 4) & 2; - R14_W = kHandlePaletteFades_DATA_00AEF7[(uint8)(a & 0x1E) >> 1]; + if (run_code_at_end) { + const uint8 *p0 = RomPtr_00(pointer_player_palette); + for (uint16 i = 20; (i & 0x8000) == 0; i -= 2) + palettes_copy_of_palette_mirror[(i >> 1) + 134] = WORD(p0[i]); + palettes_copy_of_palette_mirror[128] = 0x81ee; + for (uint16 j = 206; (j & 0x8000) == 0; j -= 18) { + uint16 r0w = 7; + do { + int v2 = j >> 1; + r2w = palettes_copy_of_palette_mirror[v2 + 144]; + palettes_copy_of_palette_mirror[v2 + 144] = HandlePaletteFades_00AFC0(palettes_palette_mirror[v2 + 144], r2w, r12, r14); + j -= 2; + } while (--r0w); + } + unused_byte_7E0AF5 = 0; + } + } } -void HandlePaletteFades_00AFC0(uint16 a) { // 00afc0 - R10_W = a; - R6_W = 4 * (a & 0x1F); - R8_W = (a & 0x3E0) >> 3; - R10_W = R11_ & 0x7C; - R4_W = 0; +uint16 HandlePaletteFades_00AFC0(uint16 a, uint16 r2w, uint16 r12, uint16 r14) { // 00afc0 + uint16 arr[3] = { + 4 * (a & 0x1F), + (a & 0x3E0) >> 3, + (a >> 8) & 0x7C + }; + uint16 r4w = 0; for (uint16 i = 4; (i & 0x8000) == 0; i -= 2) { - uint16 t = R12_W | *(uint16 *)((uint8 *)&R6_W + i); - uint16 v2 = R14_W & kHandlePaletteFades_DATA_00AE77[t >> 1]; + uint16 t = r12 | arr[i >> 1]; + uint16 v2 = r14 & kHandlePaletteFades_DATA_00AE77[t >> 1]; if (v2) { int v3 = i >> 1; v2 = kHandlePaletteFades_DATA_00AE6B[v3]; if (*(int8 *)&palettes_level_end_color_fade_direction < 0) v2 = kHandlePaletteFades_DATA_00AE71[v3]; } - R4_W |= kHandlePaletteFades_DATA_00AE65[i >> 1] & (uint16)(R2_W + v2); + r4w |= kHandlePaletteFades_DATA_00AE65[i >> 1] & (uint16)(r2w + v2); } + return r4w; } void OwEventProcess04_FadeInLayer2Tile_00B006(uint8 a) { // 00b006 - HandlePaletteFades_00AFA3(a); + timer_level_end_fade = a + 2; + uint8 r12 = (a >> 4) & 2; + uint16 r14 = kHandlePaletteFades_DATA_00AEF7[(a & 0x1E) >> 1]; + for (uint16 i = 110; (i & 0x8000) == 0; i -= 16) { int16 v2 = 8; int16 v4; do { int v3 = i >> 1; - R2_W = palettes_copy_of_palette_mirror[v3 + 1]; + uint16 r2w = palettes_copy_of_palette_mirror[v3 + 1]; v4 = v2; - HandlePaletteFades_00AFC0(palettes_palette_mirror[v3 + 64]); - palettes_copy_of_palette_mirror[v3 + 1] = R4_W; - palettes_copy_of_palette_mirror[v3 + 58] = palettes_palette_mirror[v3 + 64] - R4_W; + uint16 r4 = HandlePaletteFades_00AFC0(palettes_palette_mirror[v3 + 64], r2w, r12, r14); + palettes_copy_of_palette_mirror[v3 + 1] = r4; + palettes_copy_of_palette_mirror[v3 + 58] = palettes_palette_mirror[v3 + 64] - r4; i -= 2; --v2; } while (v4 != 1); @@ -3199,209 +2934,176 @@ void OwEventProcess04_FadeInLayer2Tile_00B006(uint8 a) { // 00b006 } void PlayerState00_00B03E() { // 00b03e - HandlePaletteFades_00AF35(); - if (palettes_palette_upload_table_index == 3) { - R2_ = 0; - R0_W = pointer_player_palette; - for (uint16 i = 20; (i & 0x8000) == 0; i -= 2) - palettes_copy_of_palette_mirror[(i >> 1) + 134] = *(uint16 *)IndirPtr(&R0_W, i); - palettes_copy_of_palette_mirror[128] = 0x81ee; - for (uint16 j = 206; (j & 0x8000) == 0; j -= 18) { - R0_W = 7; - do { - int v2 = j >> 1; - R2_W = palettes_copy_of_palette_mirror[v2 + 144]; - HandlePaletteFades_00AFC0(palettes_palette_mirror[v2 + 144]); - palettes_copy_of_palette_mirror[v2 + 144] = R4_W; - j -= 2; - --R0_W; - } while (R0_W); - } - unused_byte_7E0AF5 = 0; - } + HandlePaletteFades_00AF35(true); } void GraphicsDecompressionRoutines_DecompressGFX32And33() { // 00b888 - *(uint16 *)&temp8a = 0xbfc0; - temp8c = 8; - R0_W = 0x2000; - R2_ = 126; - GraphicsDecompressionRoutines_BeginDecompression(); - temp8f = 126; - *(uint16 *)&temp8d = 0xacfe; + decomp_src = (LongPtr){ .bank = 8, .addr = 0xbfc0 }; + GraphicsDecompressTo(g_ram + 0x2000); + uint8 *t8d = g_ram + 0xacfe; int16 v0 = 0x23ff; LABEL_2:; int16 v1 = 8; do { - IndirWriteWord(&temp8d, 0, graphics_decompressedgfx32[(uint16)v0--]); - --*(uint16 *)&temp8d; - --*(uint16 *)&temp8d; - --v1; - } while (v1); + WORD(t8d[0]) = graphics_decompressedgfx32[(uint16)v0--]; + t8d -= 2; + } while (--v1); int16 v2 = 8; while (1) { uint16 v3 = v0 - 1; - IndirWriteWord(&temp8d, 0, *(uint16 *)&graphics_decompressedgfx32[v3]); + WORD(t8d[0]) = *(uint16 *)&graphics_decompressedgfx32[v3]; v0 = v3 - 1; if (v0 < 0) break; - --*(uint16 *)&temp8d; - --*(uint16 *)&temp8d; + t8d -= 2; if (!--v2) goto LABEL_2; } - *(uint16 *)&temp8a = 0x8000; - GraphicsDecompressionRoutines_BeginDecompression(); + decomp_src.addr = 0x8000; + GraphicsDecompressTo(g_ram + 0x2000); } -void GraphicsDecompressionRoutines_BeginDecompression() { // 00b8de +void GraphicsDecompressTo(uint8 *pdst) { // 00b8de int16 v3; uint16 v17; int8 v20; uint16 v0 = 0; while (1) { - uint8 Byte = GraphicsDecompressionRoutines_ReadByte(); - if (Byte == 0xFF) + uint8 tag = GraphicsDecompressionRoutines_ReadByte(); + if (tag == 0xFF) break; - temp8f = Byte; - int8 v2 = Byte & 0xE0; + int8 v2 = tag & 0xE0; if (v2 == -32) { - v20 = (8 * temp8f) & 0xE0; - HIBYTE(v3) = temp8f & 3; + v20 = (8 * tag) & 0xE0; + HIBYTE(v3) = tag & 3; LOBYTE(v3) = GraphicsDecompressionRoutines_ReadByte(); } else { v20 = v2; - v3 = temp8f & 0x1F; + v3 = tag & 0x1F; } - *(uint16 *)&temp8d = v3 + 1; + uint16 len = v3 + 1; if (v20) { if (v20 < 0) { HIBYTE(v17) = GraphicsDecompressionRoutines_ReadByte(); LOBYTE(v17) = GraphicsDecompressionRoutines_ReadByte(); uint16 v18 = v17; do { - uint8 *v19 = IndirPtr(&R0_, v18); - IndirWriteByte(&R0_, v0++, *v19); + pdst[v0++] = pdst[v18]; ++v18; - --*(uint16 *)&temp8d; - } while (*(uint16 *)&temp8d); + --len; + } while (len); } else if ((v20 & 0x40) != 0) { if (((2 * v20) & 0x40) != 0) { uint8 v4 = GraphicsDecompressionRoutines_ReadByte(); - int16 v5 = *(uint16 *)&temp8d; + int16 v5 = len; do { - IndirWriteByte(&R0_, v0++, v4++); + pdst[v0++] = v4++; --v5; } while (v5); } else { uint8 v9 = GraphicsDecompressionRoutines_ReadByte(); uint8 v10 = GraphicsDecompressionRoutines_ReadByte(); - int16 v11 = *(uint16 *)&temp8d; + int16 v11 = len; do { uint8 v14 = v10; uint8 v12 = v9; uint8 v13 = v14; - IndirWriteByte(&R0_, v0++, v12); + pdst[v0++] = v12; int16 v15 = v11 - 1; if (!v15) break; uint8 v16 = v12; v10 = v13; v9 = v16; - IndirWriteByte(&R0_, v0++, v10); + pdst[v0++] = v10; v11 = v15 - 1; } while (v11); } } else { uint8 v7 = GraphicsDecompressionRoutines_ReadByte(); - int16 v8 = *(uint16 *)&temp8d; + int16 v8 = len; do { - IndirWriteByte(&R0_, v0++, v7); + pdst[v0++] = v7; --v8; } while (v8); } } else { do { uint8 v6 = GraphicsDecompressionRoutines_ReadByte(); - IndirWriteByte(&R0_, v0++, v6); - --*(uint16 *)&temp8d; - } while (*(uint16 *)&temp8d); + pdst[v0++] = v6; + --len; + } while (len); } } } uint8 GraphicsDecompressionRoutines_ReadByte() { // 00b983 - uint8 result = *IndirPtr(&temp8a, 0); - int16 v1 = *(uint16 *)&temp8a + 1; - if (*(uint16 *)&temp8a == 0xFFFF) { + uint8 result = *IndirPtr(&decomp_src, 0); + int16 v1 = decomp_src.addr + 1; + if (decomp_src.addr == 0xFFFF) { v1 = 0x8000; - ++temp8c; + decomp_src.bank++; } - *(uint16 *)&temp8a = v1; + decomp_src.addr = v1; return result; } -void GraphicsDecompressionRoutines(uint8 j) { // 00ba28 - temp8a = kGraphicsDecompressionRoutines_GraphicsPtrLo[j]; - temp8b = kGraphicsDecompressionRoutines_GraphicsPtrHi[j]; - temp8c = kGraphicsDecompressionRoutines_GraphicsPtrBank[j]; - R0_ = 0; - R1_ = -83; - R2_ = 126; - GraphicsDecompressionRoutines_BeginDecompression(); +const uint8 *GraphicsDecompress(uint8 j) { // 00ba28 + uint32 p = kGraphicsPtrs[j]; + decomp_src = (LongPtr) { + .bank = p >> 16, + .addr = p & 0xffff, + }; + GraphicsDecompressTo(g_ram + 0xad00); + return g_ram + 0xad00; } void GenerateTile() { // 00beb0 uint16 v0; if (blocks_map16_to_generate) { - R12_W = blocks_xpos; - R14_W = blocks_ypos; + GenTileArgs gta; + + gta.r12 = blocks_xpos; + gta.r14 = blocks_ypos; HIBYTE(v0) = 0; - R9_ = misc_level_layout_flags; + uint8 r9 = misc_level_layout_flags; if ((uint8)misc_current_layer_being_processed) - R9_ >>= 1; - uint16 v1 = R14_W; - if ((R9_ & 1) != 0) { - R0_ = HIBYTE(blocks_xpos); + r9 >>= 1; + uint16 v1 = gta.r14; + if ((r9 & 1) != 0) { + uint8 r0 = HIBYTE(blocks_xpos); HIBYTE(blocks_xpos) = HIBYTE(blocks_ypos); - HIBYTE(blocks_ypos) = R0_; - v1 = R12_W; + HIBYTE(blocks_ypos) = r0; + v1 = gta.r12; } if (v1 < 0x200) { - v0 = 2 * misc_current_layer_being_processed; - uint16 v2 = v0; - WORD(temp65) = WORD(*((uint8 *)kLevelDataLayoutTables_LoTablePtrs + v0)); - temp67 = 0; - v0 = 2 * misc_level_mode_setting; - R4_ = *IndirPtr(&temp65, v0); - R5_ = *IndirPtr(&temp65, v0 + 1); - R6_ = 0; - R7_ = HIBYTE(blocks_xpos); - ptr_hi_map16_data = ptr_lo_map16_data = *(uint16*)IndirPtr(&R4_, 3 * HIBYTE(blocks_xpos)); - ptr_lo_map16_data_bank = 126; - ptr_hi_map16_data_bank = 127; + uint16 *p0 = (uint16 *)RomPtr(kLevelDataLayoutTables_LoTablePtrs[misc_current_layer_being_processed]); + const uint8 *rp = RomPtr(p0[misc_level_mode_setting]); + ptr_hi_map16_data.addr = ptr_lo_map16_data.addr = *(uint16*)(rp + 3 * HIBYTE(blocks_xpos)); + ptr_lo_map16_data.bank = 126; + ptr_hi_map16_data.bank = 127; // @25: Write to 0x6 = 0x25: 0xbf67: r18=0x4100: r20=0xc19e: a = 0x25, x = 0x0, y = 0xd, c = 0, r4 = 24, r5 = 40, r6 = 25, r9=1, blocks_ypos = 482/15e uint8 v3, v4; - if ((R9_ & 1) != 0) { + if ((r9 & 1) != 0) { v3 = HIBYTE(blocks_ypos) & 1; v4 = HIBYTE(blocks_xpos) & 1; } else { v3 = HIBYTE(blocks_xpos) & 1; v4 = HIBYTE(blocks_ypos); } - R4_ = (4 * (2 * v4 + v3)) | 0x20; - if (v2) - R4_ += 16; + uint8 r4 = (4 * (2 * v4 + v3)) | 0x20; + if (misc_current_layer_being_processed) + r4 += 16; bool v6 = __CFSHL__(blocks_ypos & 0xF0, 1); - R5_ = 4 * (blocks_ypos & 0xF0) + v6; + uint8 r5 = 4 * (blocks_ypos & 0xF0) + v6; // todo: understand this - R6_ = R4_ | (2 * (4 * (blocks_ypos & 0xF0) + v6) + __CFSHL__(2 * (blocks_ypos & 0xF0), 1)) & 3; - R4_ = (blocks_xpos & 0xF0) >> 3; - R7_ = R4_ | R5_ & 0xC0; + gta.r6 = r4 | (2 * (4 * (blocks_ypos & 0xF0) + v6) + __CFSHL__(2 * (blocks_ypos & 0xF0), 1)) & 3; + r4 = (blocks_xpos & 0xF0) >> 3; + gta.r7 = r4 | r5 & 0xC0; uint16 v7, v8; - if ((R9_ & 1) != 0) { + if ((r9 & 1) != 0) { v7 = mirror_current_layer1_xpos; v8 = mirror_current_layer1_ypos - 128; if (misc_current_layer_being_processed) { @@ -3416,79 +3118,74 @@ void GenerateTile() { // 00beb0 v8 = mirror_current_layer2_ypos - 128; } } - R8_W = v7; - R10_W = v8; - GenerateTile_00BFBC(); + gta.r8 = v7; +// r10w = v8; + gta.r10 = v8; + kGenerateTile_TileGenerationPtr[blocks_map16_to_generate - 1](>a); } } } -void GenerateTile_00BFBC() { // 00bfbc - kGenerateTile_TileGenerationPtr[(uint8)(blocks_map16_to_generate - 1)](); -} - void SetItemMemoryBit() { // 00c00d - R4_W = (uint16)(blocks_xpos & 0xFF00) >> 6; - R4_W |= (uint8)(blocks_xpos & 0x80) >> 7; + uint16 r4 = (uint16)(blocks_xpos & 0xFF00) >> 6; + r4 |= (uint8)(blocks_xpos & 0x80) >> 7; if ((blocks_ypos & 0x100) != 0) - R4_W |= 2; - R4_W += kSetItemMemoryBit_DATA_00BFFF[(uint16)(2 * (misc_item_memory_setting & 0xF)) >> 1]; - misc_item_memory_bits[R4_W] |= kSetItemMemoryBit_DATA_00C005[(uint8)(blocks_xpos & 0x70) >> 4]; + r4 |= 2; + r4 += kSetItemMemoryBit_DATA_00BFFF[(uint16)(2 * (misc_item_memory_setting & 0xF)) >> 1]; + misc_item_memory_bits[r4] |= kSetItemMemoryBit_DATA_00C005[(uint8)(blocks_xpos & 0x70) >> 4]; } -void sub_C074() { // 00c074 +void sub_C074(GenTileArgs *gta) { // 00c074 SetItemMemoryBit(); - sub_C077(); + sub_C077(gta); } -void sub_C077() { // 00c077 - R4_W = blocks_ypos & 0x1F0; +void sub_C077(GenTileArgs *gta) { // 00c077 uint16 v0 = blocks_ypos & 0x1F0 | ((uint8)blocks_xpos >> 4); uint16 v1 = blocks_map16_to_generate; uint8 *v2 = IndirPtr(&ptr_hi_map16_data, v0); - IndirWriteByte(&ptr_hi_map16_data, v0, *v2 & 0xFE); + *v2 &= 0xFE; uint8 v3 = kGenericPage00Tile_Map16Page00TileLo[v1]; - IndirWriteByte(&ptr_lo_map16_data, v0, v3); - GenericPage01Tile_00C0FB(2 * v3); + SetMap16LowByte(v0, v3); + GenericPage01Tile_00C0FB(gta, 2 * v3); } -void GenericPage01Tile_SetItemMemory() { // 00c0c1 +void GenericPage01Tile_SetItemMemory(GenTileArgs *gta) { // 00c0c1 SetItemMemoryBit(); - GenericPage01Tile(); + GenericPage01Tile(gta); } -void GenericPage01Tile() { // 00c0c4 - R4_W = blocks_ypos & 0x1F0; +void GenericPage01Tile(GenTileArgs *gta) { // 00c0c4 uint16 v0 = blocks_ypos & 0x1F0 | ((uint8)blocks_xpos >> 4); uint16 v1 = (uint8)(blocks_map16_to_generate - 9); uint8 *v2 = IndirPtr(&ptr_hi_map16_data, v0); - IndirWriteByte(&ptr_hi_map16_data, v0, *v2 | 1); + *v2 |= 1; uint8 v3 = kGenericPage01Tile_Map16Page01TileLo[v1]; - IndirWriteByte(&ptr_lo_map16_data, v0, v3); - GenericPage01Tile_00C0FB(2 * (v3 | 0x100)); + SetMap16LowByte(v0, v3); + GenericPage01Tile_00C0FB(gta, 2 * (v3 | 0x100)); } -void GenericPage01Tile_00C0FB(uint16 j) { // 00c0fb - R0_W = *(uint16 *)&misc_level_layout_flags; +void GenericPage01Tile_00C0FB(GenTileArgs *gta, uint16 j) { // 00c0fb + uint16 r0w = *(uint16 *)&misc_level_layout_flags; if (misc_current_layer_being_processed) - R0_W >>= 1; - if ((R0_W & 1) == 0) { - uint16 v1 = R8_W & 0xFFF0; - if ((R8_W & 0x8000) == 0) { - if (v1 == R12_W) + r0w >>= 1; + if ((r0w & 1) == 0) { + uint16 v1 = gta->r8 & 0xFFF0; + if ((gta->r8 & 0x8000) == 0) { + if (v1 == gta->r12) goto LABEL_15; - if (v1 >= R12_W) + if (v1 >= gta->r12) return; } uint16 v2 = v1 + 512; - if (v2 == R12_W || v2 < R12_W) + if (v2 <= gta->r12) return; LABEL_15:; uint16 v5 = stripe_image_upload; - uint8 v6 = R6_; + uint8 v6 = gta->r6; stripe_image_upload_data[v5] = v6; stripe_image_upload_data[v5 + 8] = v6; - uint8 v8 = R7_; + uint8 v8 = gta->r7; stripe_image_upload_data[v5 + 1] = v8; stripe_image_upload_data[v5 + 9] = v8 + 32; stripe_image_upload_data[v5 + 2] = 0; @@ -3496,145 +3193,132 @@ LABEL_15:; stripe_image_upload_data[v5 + 3] = 3; stripe_image_upload_data[v5 + 11] = 3; stripe_image_upload_data[v5 + 16] = -1; - R6_ = 13; - R4_W = pointer_map16_tiles[j >> 1]; - *(uint16 *)&stripe_image_upload_data[v5 + 4] = *(uint16 *)IndirPtr(&R4_W, 0); - *(uint16 *)&stripe_image_upload_data[v5 + 12] = *(uint16 *)IndirPtr(&R4_W, 2); - *(uint16 *)&stripe_image_upload_data[v5 + 6] = *(uint16 *)IndirPtr(&R4_W, 4); - *(uint16 *)&stripe_image_upload_data[v5 + 14] = *(uint16 *)IndirPtr(&R4_W, 6); + const uint8 *rp = RomPtr(0xd0000 + pointer_map16_tiles[j >> 1]); + *(uint16 *)&stripe_image_upload_data[v5 + 4] = WORD(rp[0]); + *(uint16 *)&stripe_image_upload_data[v5 + 12] = WORD(rp[2]); + *(uint16 *)&stripe_image_upload_data[v5 + 6] = WORD(rp[4]); + *(uint16 *)&stripe_image_upload_data[v5 + 14] = WORD(rp[6]); stripe_image_upload = v5 + 16; return; } - uint16 v3 = R10_W & 0xFFF0; - if ((R10_W & 0x8000) == 0) { - if (v3 == R14_W) + uint16 v3 = gta->r10 & 0xFFF0; + if ((gta->r10 & 0x8000) == 0) { + if (v3 == gta->r14) goto LABEL_15; - if (v3 >= R14_W) + if (v3 >= gta->r14) return; } uint16 v4 = v3 + 512; - if (v4 != R14_W && v4 >= R14_W) + if (v4 > gta->r14) goto LABEL_15; } -void GenericPage01Tile_Return00C1AB() { // 00c1ab - ; -} - -void EraseYoshiCoin() { // 00c1ac +void EraseYoshiCoin(GenTileArgs *gta) { // 00c1ac SetItemMemoryBit(); - R4_W = blocks_ypos & 0x1F0; uint16 v0 = blocks_ypos & 0x1F0 | ((uint8)blocks_xpos >> 4); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x25); - IndirWriteByte(&ptr_lo_map16_data, v0 + 16, 0x25); - R0_W = *(uint16 *)&misc_level_layout_flags; + SetMap16LowByte(v0, 0x25); + SetMap16LowByte(v0 + 16, 0x25); + uint16 r0w = *(uint16 *)&misc_level_layout_flags; if (misc_current_layer_being_processed) - R0_W >>= 1; - if ((R0_W & 1) == 0) { - uint16 v1 = R8_W & 0xFFF0; - if ((R8_W & 0x8000) != 0) + r0w >>= 1; + if ((r0w & 1) == 0) { + uint16 v1 = gta->r8 & 0xFFF0; + if ((gta->r8 & 0x8000) != 0) goto LABEL_7; - if (v1 != R12_W) { - if (v1 >= R12_W) + if (v1 != gta->r12) { + if (v1 >= gta->r12) return; LABEL_7: - if ((uint16)(v1 + 512) <= R12_W) + if ((uint16)(v1 + 512) <= gta->r12) return; } LABEL_14:; uint16 v4 = stripe_image_upload; - uint8 v5 = R6_; + uint8 v5 = gta->r6; int v6 = stripe_image_upload; - stripe_image_upload_data[stripe_image_upload] = R6_; + stripe_image_upload_data[stripe_image_upload] = v5; stripe_image_upload_data[v6 + 12] = v5; - uint8 v7 = R7_; - stripe_image_upload_data[v4 + 1] = R7_; + uint8 v7 = gta->r7; + stripe_image_upload_data[v4 + 1] = v7; stripe_image_upload_data[v4 + 13] = v7 + 1; stripe_image_upload_data[v4 + 2] = 0x80; stripe_image_upload_data[v4 + 14] = 0x80; stripe_image_upload_data[v4 + 3] = 7; stripe_image_upload_data[v4 + 15] = 7; stripe_image_upload_data[v4 + 24] = -1; - R6_ = 13; - R4_W = pointer_map16_tiles[37]; - uint8 *v8 = IndirPtr(&R4_W, 0); - int16 v9 = *(uint16 *)v8; - *(uint16 *)&stripe_image_upload_data[v4 + 4] = *(uint16 *)v8; + g_ram[6] = 13; + const uint8 *rp = RomPtr(0xd0000 + pointer_map16_tiles[37]); + int16 v9 = *(uint16 *)(rp + 0); + *(uint16 *)&stripe_image_upload_data[v4 + 4] = v9; *(uint16 *)&stripe_image_upload_data[v4 + 8] = v9; - uint8 *v10 = IndirPtr(&R4_W, 2); - int16 v11 = *(uint16 *)v10; - *(uint16 *)&stripe_image_upload_data[v4 + 16] = *(uint16 *)v10; + int16 v11 = *(uint16 *)(rp + 2); + *(uint16 *)&stripe_image_upload_data[v4 + 16] = v11; *(uint16 *)&stripe_image_upload_data[v4 + 20] = v11; - uint8 *v12 = IndirPtr(&R4_W, 4); - int16 v13 = *(uint16 *)v12; - *(uint16 *)&stripe_image_upload_data[v4 + 6] = *(uint16 *)v12; + int16 v13 = *(uint16 *)(rp + 4); + *(uint16 *)&stripe_image_upload_data[v4 + 6] = v13; *(uint16 *)&stripe_image_upload_data[v4 + 10] = v13; - uint8 *v14 = IndirPtr(&R4_W, 6); - int16 v15 = *(uint16 *)v14; - *(uint16 *)&stripe_image_upload_data[v4 + 18] = *(uint16 *)v14; + int16 v15 = *(uint16 *)(rp + 6); + *(uint16 *)&stripe_image_upload_data[v4 + 18] = v15; *(uint16 *)&stripe_image_upload_data[v4 + 22] = v15; stripe_image_upload = v4 + 24; return; } - uint16 v2 = R10_W & 0xFFF0; - if ((R10_W & 0x8000) == 0) { - if (v2 == R14_W) + uint16 v2 = gta->r10 & 0xFFF0; + if ((gta->r10 & 0x8000) == 0) { + if (v2 == gta->r14) goto LABEL_14; - if (v2 >= R14_W) + if (v2 >= gta->r14) return; } uint16 v3 = v2 + 512; - if (v3 != R14_W && v3 >= R14_W) + if (v3 > gta->r14) goto LABEL_14; } -void ChangeNetDoorTiles() { // 00c334 - ++R7_; - AddHiLo(&R6_, &R7_, 32); - R0_ = blocks_map16_to_generate - 25; - R4_ = *(&kChangeNetDoorTiles_DATA_00C32E[0].bank + (3 * (blocks_map16_to_generate - 25))); - R2_W = *(uint16 *)((int8 *)&kChangeNetDoorTiles_DATA_00C32E[0].addr + (3 * (blocks_map16_to_generate - 25))); +void ChangeNetDoorTiles(GenTileArgs *gta) { // 00c334 + ++gta->r7; + AddHiLo(>a->r6, >a->r7, 32); + const uint8 *p2 = IndirPtr(&kChangeNetDoorTiles_DATA_00C32E[blocks_map16_to_generate - 25], 0); uint16 v1 = stripe_image_upload; for (int16 i = 5; i >= 0; --i) { - stripe_image_upload_data[v1] = R6_; - stripe_image_upload_data[v1 + 1] = R7_; + stripe_image_upload_data[v1] = gta->r6; + stripe_image_upload_data[v1 + 1] = gta->r7; stripe_image_upload_data[v1 + 2] = 0; stripe_image_upload_data[v1 + 3] = 11; - AddHiLo(&R6_, &R7_, 32); + AddHiLo(>a->r6, >a->r7, 32); v1 += 16; } uint16 v3 = stripe_image_upload; uint16 v4 = 0; do { - R0_W = 5; + uint16 r0w = 5; do { - *(uint16 *)&stripe_image_upload_data[v3 + 4] = *(uint16 *)IndirPtr(&R2_W, v4); + *(uint16 *)&stripe_image_upload_data[v3 + 4] = WORD(p2[v4]); v4 += 2; v3 += 2; - } while ((--R0_W & 0x8000) == 0); + } while ((--r0w & 0x8000) == 0); v3 += 4; } while (v4 != 72); *(uint16 *)&stripe_image_upload_data[v3] = 255; stripe_image_upload += 96; } -void EraseLargeSwitch() { // 00c3d1 - R4_W = blocks_ypos & 0x1F0; +void EraseLargeSwitch(GenTileArgs *gta) { // 00c3d1 uint16 v0 = blocks_ypos & 0x1F0 | ((uint8)blocks_xpos >> 4); uint16 v1 = stripe_image_upload; - IndirWriteByte(&ptr_lo_map16_data, v0++, 0x25); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x25); + SetMap16LowByte(v0++, 0x25); + SetMap16LowByte(v0, 0x25); v0 += 16; - IndirWriteByte(&ptr_lo_map16_data, v0, 0x25); - IndirWriteByte(&ptr_lo_map16_data, v0 - 1, 0x25); + SetMap16LowByte(v0, 0x25); + SetMap16LowByte(v0 - 1, 0x25); for (int16 i = 3; i >= 0; --i) { - stripe_image_upload_data[v1] = R6_; - stripe_image_upload_data[v1 + 1] = R7_; + stripe_image_upload_data[v1] = gta->r6; + stripe_image_upload_data[v1 + 1] = gta->r7; stripe_image_upload_data[v1 + 2] = 64; stripe_image_upload_data[v1 + 3] = 6; *(uint16 *)&stripe_image_upload_data[v1 + 4] = 0x18f8; v1 += 6; - AddHiLo(&R6_, &R7_, 32); + AddHiLo(>a->r6, >a->r7, 32); } stripe_image_upload_data[v1] = -1; stripe_image_upload = v1; @@ -3667,11 +3351,9 @@ void GameMode14_InLevel_00C47E() { // 00c47e mirror_bg3_and4_window_mask_settings = 2; mirror_object_and_color_window_settings = kGameMode14_InLevel_DATA_00C478[flag_keyhole_anim_phase]; mirror_color_math_initial_settings = 18; - R4_W = 0xCB93; - R6_W = 0; - R0_ = temp1436 - mirror_current_layer1_xpos + 4; - R1_ = temp1438 - mirror_current_layer1_ypos + 16; - UpdateHDMAWindowBuffer_KeyholeEntry(temp1438 - mirror_current_layer1_ypos + 16); + uint8 r0 = player_on_tilting_platform_xpos - mirror_current_layer1_xpos + 4; + uint8 r1 = player_on_tilting_platform_ypos - mirror_current_layer1_ypos + 16; + UpdateHDMAWindowBuffer_KeyholeEntry((HdmaPtrs) {.r4 = 0xcb93, .r6 = 0}, r0, r1); } } LABEL_11: @@ -3782,16 +3464,16 @@ void PlayerState0C_CastleDestructionMoves() { // 00c6e7 } } LABEL_15:; - uint8 v3 = *(&kPlayerState0C_CastleDestructionMoves_UNK_00C6DF + misc_currently_active_boss_end_cutscene) + temp8f; + uint8 v3 = *(kPlayerState0C_CastleDestructionMoves_UNK_00C6DF + misc_currently_active_boss_end_cutscene) + temp8f; if (!player_timer_pipe_warping) { temp8f += 2; v3 += 2; - player_timer_pipe_warping = kPlayerState0C_CastleDestructionMoves_DATA_00C5E9[v3]; - if (*(&kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData + v3) == 45) + player_timer_pipe_warping = kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData[v3 + 1]; + if (*(kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData + v3) == 45) io_sound_ch1 = 30; } - if (*(&kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData + v3) != 0xFF) { - uint8 v10 = *(&kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData + v3); + if (*(kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData + v3) != 0xFF) { + uint8 v10 = *(kPlayerState0C_CastleDestructionMoves_CastleDestructionMovementData + v3); if ((v10 & 0x10) != 0) DrawQuestionMark(); if ((v10 & 0x20) != 0) { @@ -4061,8 +3743,7 @@ void PlayerState00_00CA3E() { // 00ca3e void PlayerState00_00CA44() { // 00ca44 if (timer_hdmawindow_scaling_factor) { - UpdateHDMAWindowBuffer_SetCircleHDMAPointer(); - UpdateHDMAWindowBuffer_IrisInOnPlayerEntry(0xFC); + UpdateHDMAWindowBuffer_IrisInOnPlayerEntry(0xFC, UpdateHDMAWindowBuffer_SetCircleHDMAPointer()); mirror_bg1_and2_window_mask_settings = 51; mirror_object_and_color_window_settings = 51; mirror_bg3_and4_window_mask_settings = 3; @@ -4070,25 +3751,24 @@ void PlayerState00_00CA44() { // 00ca44 } } -void UpdateHDMAWindowBuffer_SetCircleHDMAPointer() { // 00ca61 - R4_W = 0xcb12; - R6_W = 0xcb12; +HdmaPtrs UpdateHDMAWindowBuffer_SetCircleHDMAPointer() { // 00ca61 + return (HdmaPtrs) { .r4 = 0xcb12, .r6 = 0xcb12 }; } -void UpdateHDMAWindowBuffer_IrisInOnPlayerEntry(uint8 a) { // 00ca6d +void UpdateHDMAWindowBuffer_IrisInOnPlayerEntry(uint8 a, HdmaPtrs hptr) { // 00ca6d timer_hdmawindow_scaling_factor += a; - R0_ = player_on_screen_pos_x + 8; + uint8 r0 = player_on_screen_pos_x + 8; uint8 v1 = player_current_power_up ? 16 : 24; - R1_ = player_on_screen_pos_y + v1; - if (R1_ == 255 || R1_ == 0) - R1_ = 1; - UpdateHDMAWindowBuffer_KeyholeEntry(R1_); + uint8 r1 = player_on_screen_pos_y + v1; + if (r1 == 255 || r1 == 0) + r1 = 1; + UpdateHDMAWindowBuffer_KeyholeEntry(hptr, r0, r1); } -void UpdateHDMAWindowBuffer_KeyholeEntry(uint8 a) { // 00ca88 - uint16 v1 = 2 * (2 * a - 1); +void UpdateHDMAWindowBuffer_KeyholeEntry(HdmaPtrs hptr, uint8 r0, uint8 r1) { // 00ca88 + uint16 v1 = 2 * (2 * r1 - 1); uint16 v2 = 0; - while (R1_ >= timer_hdmawindow_scaling_factor) { + while (r1 >= timer_hdmawindow_scaling_factor) { if (v2 < 0x1E0) { misc_hdmawindow_effect_table[v2] = 255; misc_hdmawindow_effect_table[v2 + 1] = 0; @@ -4099,20 +3779,20 @@ void UpdateHDMAWindowBuffer_KeyholeEntry(uint8 a) { // 00ca88 } v2 += 2; v1 -= 2; - if (!R1_) + if (!r1) goto LABEL_21; - --R1_; + --r1; } do { - UpdateHDMAWindowBuffer_00CC14(v1); + PairU8 pair = UpdateHDMAWindowBuffer_00CC14(v1, hptr, r1); if (v2 < 0x1e0) { - misc_hdmawindow_effect_table[v2 + 1] = R0_ + R2_ < 255 ? R0_ + R2_ : 255; - misc_hdmawindow_effect_table[v2] = R0_ >= R2_ ? R0_ - R2_ : 0; + misc_hdmawindow_effect_table[v2 + 1] = r0 + pair.first < 255 ? r0 + pair.first : 255; + misc_hdmawindow_effect_table[v2] = r0 >= pair.first ? r0 - pair.first : 0; } if (v1 < 0x1E0) { - if (R7_) { - misc_hdmawindow_effect_table[v1 + 1] = R0_ + R3_ < 255 ? R0_ + R3_ : 255; - misc_hdmawindow_effect_table[v1] = R0_ >= R3_ ? R0_ - R3_ : 0; + if (hptr.r6 >= 256) { + misc_hdmawindow_effect_table[v1 + 1] = r0 + pair.second < 255 ? r0 + pair.second : 255; + misc_hdmawindow_effect_table[v1] = r0 >= pair.second ? r0 - pair.second : 0; } else { misc_hdmawindow_effect_table[v1 + 1] = 0; misc_hdmawindow_effect_table[v1] = 255; @@ -4120,21 +3800,21 @@ void UpdateHDMAWindowBuffer_KeyholeEntry(uint8 a) { // 00ca88 } v2 += 2; v1 -= 2; - if (!R1_) + if (!r1) break; - } while (--R1_); + } while (--r1); LABEL_21: mirror_hdmaenable = 0x80; } -uint8 UpdateHDMAWindowBuffer_00CC14(uint16 j) { // 00cc14 - uint16 v1 = SnesDivide(R1_ << 8, timer_hdmawindow_scaling_factor) >> 1; - uint8 t = R6_W ? RomPtr_00(R6_W)[v1] : 0; - R3_ = (t * timer_hdmawindow_scaling_factor) >> 8; - const uint8 *v3 = RomPtr_00(R4_W); +PairU8 UpdateHDMAWindowBuffer_00CC14(uint16 j, HdmaPtrs hptr, uint8 r1) { // 00cc14 + uint16 v1 = SnesDivide(r1 << 8, timer_hdmawindow_scaling_factor) >> 1; + uint8 t = hptr.r6 ? RomPtr_00(hptr.r6)[v1] : 0; + uint8 r3 = (t * timer_hdmawindow_scaling_factor) >> 8; + const uint8 *v3 = RomPtr_00(hptr.r4); uint8 result = (v3[v1] * timer_hdmawindow_scaling_factor) >> 8; - R2_ = result; - return result; + uint8 r2 = result; + return (PairU8) { .first = r2, .second = r3 }; } void PlayerState00() { // 00cc68 @@ -4165,14 +3845,12 @@ void PlayerState00_00CCE0() { // 00cce0 if ((misc_nmito_use_flag & 0x40) != 0 || player_in_air_flag) { UpdatePlayerSpritePosition(); } else { - player_xpos = *(uint16 *)&temp1436; - player_ypos = *(uint16 *)&temp1438; + player_xpos = player_on_tilting_platform_xpos; + player_ypos = player_on_tilting_platform_ypos; UpdatePlayerSpritePosition(); - *(uint16 *)&temp1436 = player_xpos; - *(uint16 *)&temp14b4 = player_xpos; - *(uint16 *)&temp1438 = player_ypos & 0xFFF0; - *(uint16 *)&temp14b6 = player_ypos & 0xFFF0; - PlayerState00_00F9C9(); + player_on_tilting_platform_xpos = player_xpos; + player_on_tilting_platform_ypos = player_ypos & 0xFFF0; + PlayerState00_00F9C9(player_on_tilting_platform_xpos, player_on_tilting_platform_ypos, (PointU16) {.x = 0, .y = 0}); } PlayerState00_00F8F2(); PlayerState00_00CD36(); @@ -4198,11 +3876,11 @@ void PlayerState00_00CD39() { // 00cd39 PlayerState00_00CD95(timer_inflate_from_pballoon); } else { if (flag_player_climb_on_air) - temp8b = 31; - if (player_climbing_flag || !(player_riding_yoshi_flag | player_carrying_something_flag2) && (temp8b & 0x1B) == 27 && + player_collision_var8b = 31; + if (player_climbing_flag || !(player_riding_yoshi_flag | player_carrying_something_flag2) && (player_collision_var8b & 0x1B) == 27 && (io_controller_hold1 & 0xC) != 0 && - (player_in_air_flag || (io_controller_hold1 & 8) != 0 || (temp8b & 4) != 0)) { - player_climbing_flag = temp8b; + (player_in_air_flag || (io_controller_hold1 & 8) != 0 || (player_collision_var8b & 4) != 0)) { + player_climbing_flag = player_collision_var8b; HandlePlayerPhysics_Climbing(); } else if (player_swimming_flag) { HandlePlayerPhysics_Swimming(); @@ -4691,6 +4369,7 @@ void PlayerState07_ShootOutOfPipe() { // 00d287 void HandlePlayerPhysics() { // 00d5f2 uint8 v4; + uint8 r1 = 0; if (!player_in_air_flag) { player_ducking_flag = 0; if (!player_sliding_on_ground && (io_controller_hold1 & 4) != 0) { @@ -4767,7 +4446,7 @@ void HandlePlayerPhysics() { // 00d5f2 } } LABEL_40: - R1_ = io_controller_hold1 & 1; + r1 = io_controller_hold1 & 1; v4 = player_slope_player_is_on1 | (4 * v3); if (player_xspeed && ((*((uint8 *)kHandlePlayerPhysics_MarioAccel + v4 + 1) ^ player_xspeed) & 0x80) != 0 && !timer_player_slides_when_turing) { @@ -4782,7 +4461,7 @@ void HandlePlayerPhysics() { // 00d5f2 if (v3 != player_facing_direction && (io_controller_press1 & 0x80) == 0) goto LABEL_27; player_slope_player_is_on1 = kHandlePlayerPhysics_DATA_00D5EE[player_facing_direction]; - R1_ = io_controller_hold1 & 1; + r1 = io_controller_hold1 & 1; v4 = player_slope_player_is_on1 | (4 * v3); LABEL_46:; uint8 v5 = 0; @@ -4805,7 +4484,7 @@ LABEL_46:; goto LABEL_53; LABEL_54: v5 = HandlePlayerPhysics_UpdatePMeterEx(v5); - HandlePlayerPhysics_00D742(v4, R1_ | player_slope_player_is_on1 | (2 * v5)); + HandlePlayerPhysics_00D742(v4, r1 | player_slope_player_is_on1 | (2 * v5)); } void HandlePlayerPhysics_00D742(uint8 k, uint8 j) { // 00d742 @@ -5043,7 +4722,6 @@ LABEL_7:; LABEL_33: v3 = 120; LABEL_34: - R0_ = v3; player_facing_direction = v4 & 1; uint8 v7 = 4 * (v4 & 1); uint8 v8 = v3 | v4 & 1; @@ -5169,26 +4847,26 @@ void HandlePlayerPhysics_Climbing() { // 00db17 player_current_pose = kHandlePlayerPhysics_ClimbingPoses[v8]; if ((io_controller_hold1 & 3) != 0) { int8 v10 = (uint8)(io_controller_hold1 & 3) >> 1; - if ((temp8b & 0x18) == 24) + if ((player_collision_var8b & 0x18) == 24) goto LABEL_25; if ((player_climbing_flag & 0x80) == 0) goto LABEL_29; - if (v10 != temp8c) + if (v10 != player_collision_var8c) LABEL_25: player_xspeed = kHandlePlayerPhysics_ClimbingSpeed[(uint8)(player_swimming_flag | (2 * v10))]; } uint8 v11 = io_controller_hold1 & 0xC; if ((io_controller_hold1 & 0xC) != 0) { if ((io_controller_hold1 & 8) == 0) { - int8 v12 = temp8b & 1; - temp8b >>= 1; + int8 v12 = player_collision_var8b & 1; + player_collision_var8b >>= 1; if (!v12) goto LABEL_29; goto LABEL_31; } v9 += 2; - v11 = temp8b & 2; - if ((temp8b & 2) != 0) { + v11 = player_collision_var8b & 2; + if ((player_collision_var8b & 2) != 0) { LABEL_31: if ((player_climbing_flag & 0x80) == 0) player_xspeed = 0; @@ -5204,7 +4882,7 @@ void HandlePlayerPhysics_Climbing() { // 00db17 } void UpdatePlayerSpritePosition() { // 00dc2d - temp8a = player_yspeed; + uint8 tmp8a = player_yspeed; if (player_wall_walk_status) { uint8 v0 = player_xspeed; player_yspeed = (player_wall_walk_status & 1) ? -v0 : v0; @@ -5216,7 +4894,7 @@ void UpdatePlayerSpritePosition() { // 00dc2d uint16 ty = player_sub_ypos + (uint8)(player_yspeed * 16); player_sub_ypos = ty; player_ypos += ((int8)player_yspeed >> 4) + (ty >> 8); - player_yspeed = temp8a; + player_yspeed = tmp8a; } void PlayerDraw() { // 00e2bd @@ -5277,16 +4955,16 @@ void PlayerDraw() { // 00e2bd uint8 v12 = -56; if (v5 == 67) v12 = -24; - R4_ = v12; + uint8 r4 = v12; if (v5 == 41 && !player_current_power_up) v5 = 32; - R5_ = kPlayerGFXRt_PlayerXYDispIndex[player_facing_direction | kPlayerGFXRt_PlayerXYDispIndexIndex[v5]]; + uint8 r5 = kPlayerGFXRt_PlayerXYDispIndex[player_facing_direction | kPlayerGFXRt_PlayerXYDispIndexIndex[v5]]; uint8 v13 = player_current_pose; if (player_current_pose < 0x3D) - v13 = kPlayerGFXRt_PowerupTilesetIndex[player_current_power_up] + (player_current_pose >= 0x3D) + player_current_pose; - R6_ = kPlayerGFXRt_TilesIndex[v13]; - R10_ = kPlayerGFXRt_HeadTilePointerIndex[v13]; - R11_ = kPlayerGFXRt_BodyTilePointerIndex[v13]; + v13 = kPlayerGFXRt_PowerupTilesetIndex[player_current_power_up] + player_current_pose; + uint8 r6 = kPlayerGFXRt_TilesIndex[v13]; + uint8 r10 = kPlayerGFXRt_HeadTilePointerIndex[v13]; + uint8 r11 = kPlayerGFXRt_BodyTilePointerIndex[v13]; uint8 v14 = sprites_tile_priority; if (player_current_layer_priority) v14 = kPlayerGFXRt_TilePriority[player_current_layer_priority - 1]; @@ -5299,51 +4977,52 @@ void PlayerDraw() { // 00e2bd oam[68].flags = v16; oam[62].flags = v16; oam[63].flags = v16; - if (R4_ == 0xE8) + if (r4 == 0xE8) v16 ^= 0x40; oam[66].flags = v16; - uint8 v18 = PlayerGFXRt_00E45D(v15); - uint8 v19 = PlayerGFXRt_00E45D(v18); - uint8 v20 = PlayerGFXRt_00E45D(v19); - uint8 v21 = PlayerGFXRt_00E45D(v20); + uint8 v18 = PlayerGFXRt_00E45D(v15, r4 & 0x80, r5 + 0, r6 + 0); + uint8 v19 = PlayerGFXRt_00E45D(v18, r4 & 0x40, r5 + 2, r6 + 1); + uint8 v20 = PlayerGFXRt_00E45D(v19, r4 & 0x20, r5 + 4, r6 + 2); + uint8 v21 = PlayerGFXRt_00E45D(v20, r4 & 0x10, r5 + 6, r6 + 3); + + uint8 r12 = 0, r13 = 0; if (player_current_power_up == 2) { uint8 j = v21; - R6_ = 44; uint8 v22 = kPlayerGFXRt_DATA_00E18E[player_current_pose]; - R13_ = kPlayerGFXRt_DATA_00E1D4[v22 + 3]; - R14_ = kPlayerGFXRt_DATA_00E1D4[v22 + 4]; - R12_ = kPlayerGFXRt_DATA_00E1D4[v22 + 1]; + r13 = kPlayerGFXRt_DATA_00E1D4[v22 + 3]; + uint8 r14 = kPlayerGFXRt_DATA_00E1D4[v22 + 4]; + r12 = kPlayerGFXRt_DATA_00E1D4[v22 + 1]; uint8 v24; - if (R12_ >= 4) { + if (r12 >= 4) { v24 = kPlayerGFXRt_DATA_00E1D4[v22 + 2]; } else { - uint8 v23 = R12_ | (4 * player_cape_image); - R12_ = kPlayerGFXRt_CapeTilePointerIndex[v23]; + uint8 v23 = r12 | (4 * player_cape_image); + r12 = kPlayerGFXRt_CapeTilePointerIndex[v23]; v24 = kPlayerGFXRt_DATA_00E266[v23]; } - R5_ = kPlayerGFXRt_CapeXYDispIndex[player_facing_direction | v24]; + r5 = kPlayerGFXRt_CapeXYDispIndex[player_facing_direction | v24]; player_hide_player_tile_flags |= kPlayerGFXRt_DATA_00E1D4[v22]; + uint8 r6 = 44; if (!(kPlayerGFXRt_DATA_00E1D4[v22] & 0x80)) - PlayerGFXRt_00E45D(j); - uint8 v25 = PlayerGFXRt_00E45D(kPlayerGFXRt_CapeStartingOAMIndex[player_current_layer_priority]); - R6_ = R14_; - PlayerGFXRt_00E45D(v25); + PlayerGFXRt_00E45D(j, r4 & 0x08, r5, r6++), r5 += 2, r4 <<= 1; + uint8 v25 = PlayerGFXRt_00E45D(kPlayerGFXRt_CapeStartingOAMIndex[player_current_layer_priority], r4 & 0x08, r5, r6++); + PlayerGFXRt_00E45D(v25, r4 & 0x04, r5 + 2, r14); } - PlayerGFXRt_00F636(); + PlayerGFXRt_00F636(r10, r11, r12, r13); } } -uint8 PlayerGFXRt_00E45D(uint8 j) { // 00e45d +uint8 PlayerGFXRt_00E45D(uint8 j, uint8 r4, uint8 r5, uint8 r6) { // 00e45d bool xflag = true; bool v1 = player_hide_player_tile_flags & 1; player_hide_player_tile_flags >>= 1; if (!v1) { - int8 v2 = kPlayerGFXRt_Tiles[R6_]; + int8 v2 = kPlayerGFXRt_Tiles[r6]; if (v2 >= 0) { OamEnt *oam = get_OamEnt(oam_buf, j); oam[64].charnum = v2; - int v4 = R5_ >> 1; + int v4 = r5 >> 1; uint16 v5 = kPlayerGFXRt_YDisp[v4] + player_on_screen_pos_y; if ((uint16)(v5 + 0x10) < 0x100) { oam[64].ypos = v5; @@ -5357,11 +5036,7 @@ uint8 PlayerGFXRt_00E45D(uint8 j) { // 00e45d xflag = false; } } - bool v7 = __CFSHL__(R4_, 1); - R4_ *= 2; - sprites_oamtile_size_buffer[(j >> 2) + 64] = (2 * v7 + xflag) & 3; - R5_ += 2; - ++R6_; + sprites_oamtile_size_buffer[(j >> 2) + 64] = (2 * (r4 != 0) + xflag) & 3; return j + 4; } @@ -5418,9 +5093,9 @@ void HandlePlayerLevelColl_00E9C8(uint8 j, uint8 sign) { // 00e9c8 if (sign) { if (!flag_layer1_horiz_scroll_level_setting) { player_blocked_flags |= 0x80; - R0_ = get_PointU16(l1_l2_scroll_spr_speed, 0)->x >> 4; - if (((kHandlePlayerLevelColl_DATA_00E90D[j + 1] ^ (R0_ - player_xspeed)) & 0x80) == 0) { - player_xspeed = R0_; + uint8 r0 = get_PointU16(l1_l2_scroll_spr_speed, 0)->x >> 4; + if (((kHandlePlayerLevelColl_DATA_00E90D[j + 1] ^ (r0 - player_xspeed)) & 0x80) == 0) { + player_xspeed = r0; player_sub_xpos = get_PointU16(l1_l2_scroll_spr_sub_pos, 0)->x; } } @@ -5453,7 +5128,7 @@ void HandlePlayerLevelColl_00EA0D() { // 00ea0d } void HandlePlayerLevelColl_00EA34() { // 00ea34 - if (player_current_layer_priority == 1 && !temp8b) + if (player_current_layer_priority == 1 && !player_collision_var8b) player_current_layer_priority = 0; player_can_jump_out_of_water = 0; if (flag_underwater_level) { @@ -5461,15 +5136,15 @@ void HandlePlayerLevelColl_00EA34() { // 00ea34 SpawnPlayerBreathBubble(); return; } - int8 v0 = temp8a & 1; - temp8a >>= 1; + int8 v0 = player_collision_var8a & 1; + player_collision_var8a >>= 1; if (!v0) { player_swimming_flag = 0; return; } if (!player_swimming_flag && (player_yspeed & 0x80) == 0) { - v0 = temp8a & 1; - temp8a >>= 1; + v0 = player_collision_var8a & 1; + player_collision_var8a >>= 1; if (!v0) return; SpawnPlayerWaterSplashAndBubbles(); @@ -5478,8 +5153,8 @@ void HandlePlayerLevelColl_00EA34() { // 00ea34 SpawnPlayerBreathBubble(); return; } - v0 = temp8a & 1; - temp8a >>= 1; + v0 = player_collision_var8a & 1; + player_collision_var8a >>= 1; if (v0) { player_swimming_flag = 1; SpawnPlayerBreathBubble(); @@ -5513,8 +5188,8 @@ void ResetPlayerLevelCollisionRAM() { // 00eaa6 player_blocked_flags = 0; player_slope_player_is_on1 = 0; player_slope_player_is_on2 = 0; - temp8a = 0; - temp8b = 0; + player_collision_var8a = 0; + player_collision_var8b = 0; sprites_layer2_is_touched_flag = 0; } @@ -5585,10 +5260,10 @@ void RunPlayerBlockCode_EB77() { // 00eb77 player_xpos_in_block = ((player_xpos & 0xF) + 8) & 0xF; player_hdir_block_touched = 0; if ((player_xpos & 0xF) >= 8) { - v0 += ((player_xpos & 0xF) >= 8) + 11; + v0 += 12; ++player_hdir_block_touched; } - player_vdir_push_out_of_block = (*((uint8 *)kRunPlayerBlockCode_UnknownData00E8A4 + v0) + player_ypos_in_block) & 0xF; + player_vdir_push_out_of_block = (*((uint8 *)kGetPlayerLevelCollisionMap16ID_DATA_00E89C + v0 + 6) + player_ypos_in_block) & 0xF; PairU16 wr = GetPlayerLevelCollisionMap16ID_WallRun(v0 += 2); int8 v2 = wr.first; v3 = wr.second; @@ -5632,7 +5307,7 @@ void RunPlayerBlockCode_EB77() { // 00eb77 goto LABEL_42; } if (CheckWaterSlope(v3) & 1) - temp8a |= 1; + player_collision_var8a |= 1; } LABEL_30:; PairU16 v5 = GetPlayerLevelCollisionMap16ID_WallRun(v0 += 2); @@ -6030,14 +5705,15 @@ void CheckIfBlockWasHit(uint8 a, uint8 j) { // 00f160 } void CheckIfBlockWasHit_Entry3(uint8 a, uint8 j) { // 00f17f + uint8 r4, r5; uint8 v3; int8 v5; if ((kCheckIfBlockWasHit_DATA_00F0A4[a] & kCheckIfBlockWasHit_DATA_00F0EC[j]) == 0) - goto LABEL_20; - R6_ = j; - R7_ = kCheckIfBlockWasHit_DATA_00F0C8[a]; - R4_ = kCheckIfBlockWasHit_DATA_00F05C[a]; + return; + uint8 r6 = j; + uint8 r7 = kCheckIfBlockWasHit_DATA_00F0C8[a]; + r4 = kCheckIfBlockWasHit_DATA_00F05C[a]; int8 v2 = kCheckIfBlockWasHit_DATA_00F080[a]; if (v2 >= 0) goto LABEL_9; @@ -6063,10 +5739,10 @@ void CheckIfBlockWasHit_Entry3(uint8 a, uint8 j) { // 00f17f LABEL_14: v3 = 6; LABEL_15: - R5_ = v3; + r5 = v3; if (v3 == 5) { v3 = 22; - R7_ = 22; + r7 = 22; } blocks_xpos &= ~0xf; blocks_ypos &= ~0xf; @@ -6077,11 +5753,11 @@ void CheckIfBlockWasHit_Entry3(uint8 a, uint8 j) { // 00f17f int8 v8 = *(&timer_inflate_from_pballoon + v6); *(&timer_inflate_from_pballoon + v6) = v7; if (v7 == 0xFF) { - R5_ = 5; + r5 = 5; LABEL_23: - R7_ = 23; + r7 = 23; LABEL_19: - SpawnBounceSprite(); + SpawnBounceSprite(r4, r5, r6, r7); goto LABEL_20; } if (!flag_prevent_coin_bonus_game_replay) { @@ -6090,8 +5766,8 @@ void CheckIfBlockWasHit_Entry3(uint8 a, uint8 j) { // 00f17f goto LABEL_23; } io_sound_ch3 = 42; - R5_ = 0; - SpawnBounceSprite(); + r5 = 0; + SpawnBounceSprite(r4, r5, r6, r7); int8 v10 = 7; uint8 v11 = *(&timer_inflate_from_pballoon + v6); do { @@ -6137,7 +5813,7 @@ void RunPlayerBlockCode_00F28C(uint8 j) { // 00f28c void RunPlayerBlockCode_00F2C2(uint8 j, uint8 a) { // 00f2c2 if (j < 6) - temp8a |= a; + player_collision_var8a |= a; else RunPlayerBlockCode_00F2C9(j, a); } @@ -6162,8 +5838,8 @@ void RunPlayerBlockCode_00F2C9(uint8 j, uint8 a) { // 00f2c9 } if (a == 1) a = 25; - temp8b |= a; - temp8c = player_hdir_block_touched; + player_collision_var8b |= a; + player_collision_var8c = player_hdir_block_touched; } } @@ -6273,22 +5949,23 @@ uint8 RunPlayerBlockCode_00F443() { // 00f443 PairU16 GetPlayerLevelCollisionMap16ID_WallRun(uint8 k) { // 00f44d uint8 v1 = k; // moved incr to outside blocks_xpos = kGetPlayerLevelCollisionMap16ID_DATA_00E832[(v1 >> 1) - 1] + player_xpos; - blocks_ypos = kGetPlayerLevelCollisionMap16ID_DATA_00E89C[v1 >> 1] + player_ypos; + blocks_ypos = kGetPlayerLevelCollisionMap16ID_DATA_00E89C[(v1 >> 1) - 1] + player_ypos; return GetPlayerLevelCollisionMap16ID_Entry2(v1); } PairU16 GetPlayerLevelCollisionMap16ID_Entry2(uint8 k) { // 00f465 + uint16 r0w; misc_color_of_palace_switch_pressed2 = 0; if ((temp8e & 0x80) != 0) { if (temp8e & 0x7f) { if (HIBYTE(blocks_xpos) >= 2 || HIBYTE(blocks_ypos) >= 0xE) return MakePairU16_AY(0, 0x25); - R0_W = PAIR16(kLevelDataLayoutTables_EightBitHi_Vertical_L2[HIBYTE(blocks_ypos)], kLevelDataLayoutTables_EightBitLo_Vertical_L2[HIBYTE(blocks_ypos)]) + + r0w = PAIR16(kLevelDataLayoutTables_EightBitHi_Vertical[HIBYTE(blocks_ypos) + 14], kLevelDataLayoutTables_EightBitLo_Vertical[HIBYTE(blocks_ypos) + 14]) + (blocks_ypos & 0xF0 | ((uint8)blocks_xpos >> 4) | HIBYTE(blocks_xpos) << 8); } else if (blocks_ypos < 0x1B0) { if (HIBYTE(blocks_xpos) >= 0x10) return MakePairU16_AY(0, 0x25); - R0_W = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal_L2[HIBYTE(blocks_xpos)], kLevelDataLayoutTables_EightBitLo_Horizontal_L2[HIBYTE(blocks_xpos)]) + + r0w = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[HIBYTE(blocks_xpos) + 16], kLevelDataLayoutTables_EightBitLo_Horizontal[HIBYTE(blocks_xpos) + 16]) + (blocks_ypos & 0xF0 | ((uint8)blocks_xpos >> 4) | HIBYTE(blocks_ypos) << 8); } else { return MakePairU16_AY(0, 0x25); @@ -6297,20 +5974,17 @@ PairU16 GetPlayerLevelCollisionMap16ID_Entry2(uint8 k) { // 00f465 if (temp8e) { if (HIBYTE(blocks_xpos) >= 2 || HIBYTE(blocks_ypos) >= misc_screens_in_lvl) return MakePairU16_AY(0, 0x25); - R0_W = PAIR16(kLevelDataLayoutTables_EightBitHi_Vertical[HIBYTE(blocks_ypos)], kLevelDataLayoutTables_EightBitLo_Vertical[HIBYTE(blocks_ypos)]) + + r0w = PAIR16(kLevelDataLayoutTables_EightBitHi_Vertical[HIBYTE(blocks_ypos)], kLevelDataLayoutTables_EightBitLo_Vertical[HIBYTE(blocks_ypos)]) + (blocks_ypos & 0xF0 | ((uint8)blocks_xpos >> 4) | HIBYTE(blocks_xpos) << 8); } else { if (blocks_ypos >= 0x1B0 || HIBYTE(blocks_xpos) >= misc_screens_in_lvl) return MakePairU16_AY(0, 0x25); - R0_W = PAIR16(kLevelDataLayoutTables_EightBitHi[HIBYTE(blocks_xpos)], kLevelDataLayoutTables_EightBitLo[HIBYTE(blocks_xpos)]) + + r0w = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[HIBYTE(blocks_xpos)], kLevelDataLayoutTables_EightBitLo_Horizontal[HIBYTE(blocks_xpos)]) + (blocks_ypos & 0xF0 | ((uint8)blocks_xpos >> 4) | HIBYTE(blocks_ypos) << 8); } } - R2_ = 126; - blocks_currently_processed_map16_tile_lo = *IndirPtr(&R0_, 0); - ++R2_; - uint8 *v6 = IndirPtr(&R0_, 0); - uint8 v7 = ModifyMap16IDForSpecialBlocks(*v6); + blocks_currently_processed_map16_tile_lo = g_ram[r0w]; + uint8 v7 = ModifyMap16IDForSpecialBlocks(g_ram[0x10000 + r0w]); return MakePairU16_AY(v7, blocks_currently_processed_map16_tile_lo); } @@ -6412,20 +6086,20 @@ void DamagePlayer_DisableButtons() { // 00f62d io_controller_press2 = 0; } -void PlayerGFXRt_00F636() { // 00f636 - uint16 t = (R10_ & 0xf7) << 6 | ((R10_ & 0x8) ? 0x4000 : 0); +void PlayerGFXRt_00F636(uint8 r10, uint8 r11, uint8 r12, uint8 r13) { // 00f636 + uint16 t = (r10 & 0xf7) << 6 | ((r10 & 0x8) ? 0x4000 : 0); *(uint16 *)graphics_dynamic_sprite_pointers_top_lo = t + 0x2000; *(uint16 *)graphics_dynamic_sprite_pointers_bottom_lo = t + 0x2200; - t = (R11_ & 0xf7) << 6 | ((R11_ & 0x8) ? 0x4000 : 0); + t = (r11 & 0xf7) << 6 | ((r11 & 0x8) ? 0x4000 : 0); *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[2] = t + 0x2000; *(uint16 *)&graphics_dynamic_sprite_pointers_bottom_lo[2] = t + 0x2200; - t = 32 * R12_; + t = 32 * r12; *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[4] = t + 0x2000; *(uint16 *)&graphics_dynamic_sprite_pointers_bottom_lo[4] = t + 0x2200; - graphics_dynamic_sprite_tile7 = 32 * R13_ + 0x2000; + graphics_dynamic_sprite_tile7 = 32 * r13 + 0x2000; player_number_of_tiles_to_update = 10; } @@ -6441,13 +6115,13 @@ void HandleStandardLevelCameraScroll() { // 00f6db HandleStandardLevelCameraScroll_00F7F4((camera_last_screen_vert - 1) << 8); if (flag_layer1_horiz_scroll_level_setting) { uint8 v7 = 0; - R0_W = player_xpos - mirror_current_layer1_xpos; - if ((int16)(player_xpos - mirror_current_layer1_xpos - player_relative_position_needed_to_scroll_screen) >= 0) + uint16 r0w = player_xpos - mirror_current_layer1_xpos; + if ((int16)(r0w - player_relative_position_needed_to_scroll_screen) >= 0) v7 = 2; - R2_W = player_xpos - mirror_current_layer1_xpos - camera_pos_for_scroll[v7 >> 1]; - if (((kHandleStandardLevelCameraScroll_DATA_00F6A3[v7 >> 1] ^ R2_W) & 0x8000) != 0) { - HandleStandardLevelCameraScroll_00F8AB(); - uint16 v8 = mirror_current_layer1_xpos + R2_W; + uint16 r2w = player_xpos - mirror_current_layer1_xpos - camera_pos_for_scroll[v7 >> 1]; + if (((kHandleStandardLevelCameraScroll_DATA_00F6A3[v7 >> 1] ^ r2w) & 0x8000) != 0) { + r2w = HandleStandardLevelCameraScroll_00F8AB(r2w); + uint16 v8 = mirror_current_layer1_xpos + r2w; if ((int16)v8 < 0) v8 = 0; if (!sign16(v8 - 257)) @@ -6458,17 +6132,17 @@ void HandleStandardLevelCameraScroll() { // 00f6db } else { HandleStandardLevelCameraScroll_00F7F4(0xC0); if (flag_layer1_horiz_scroll_level_setting) { - R0_W = player_xpos - mirror_current_layer1_xpos; - uint8 v1 = ((int16)(R0_W - player_relative_position_needed_to_scroll_screen) < 0) ? 0 : 2; + uint16 r0w = player_xpos - mirror_current_layer1_xpos; + uint8 v1 = ((int16)(r0w - player_relative_position_needed_to_scroll_screen) < 0) ? 0 : 2; camera_layer1_scrolling_direction = v1; camera_layer2_scrolling_direction = v1; - int16 v2 = R0_W - camera_pos_for_scroll[v1 >> 1]; + int16 v2 = r0w - camera_pos_for_scroll[v1 >> 1]; if (v2) { - R2_W = player_xpos - mirror_current_layer1_xpos - camera_pos_for_scroll[v1 >> 1]; + uint16 r2w = player_xpos - mirror_current_layer1_xpos - camera_pos_for_scroll[v1 >> 1]; if (((kHandleStandardLevelCameraScroll_DATA_00F6A3[v1 >> 1] ^ v2) & 0x8000) != 0) { - HandleStandardLevelCameraScroll_00F8AB(); - uint16 v3 = mirror_current_layer1_xpos + R2_W; - if ((int16)(mirror_current_layer1_xpos + R2_W) < 0) + r2w = HandleStandardLevelCameraScroll_00F8AB(r2w); + uint16 v3 = mirror_current_layer1_xpos + r2w; + if ((int16)(mirror_current_layer1_xpos + r2w) < 0) v3 = 0; mirror_current_layer1_xpos = v3; int16 v5 = (camera_last_screen_horiz - 1) << 8; @@ -6502,20 +6176,20 @@ void HandleStandardLevelCameraScroll() { // 00f6db void HandleStandardLevelCameraScroll_00F7F4(uint16 a) { // 00f7f4 if (flag_layer1_vert_scroll_level_setting) { - R4_W = a; + uint16 r4w = a; uint8 v1 = 0; - R0_W = player_ypos - mirror_current_layer1_ypos; + uint16 r0w = player_ypos - mirror_current_layer1_ypos; if (!sign16(player_ypos - mirror_current_layer1_ypos - 112)) v1 = 2; camera_layer1_scrolling_direction = v1; camera_layer2_scrolling_direction = v1; int v2 = v1 >> 1; - R2_W = player_ypos - mirror_current_layer1_ypos - kHandleStandardLevelCameraScroll_DATA_00F69F[v2]; - if (((kHandleStandardLevelCameraScroll_DATA_00F6A3[v2] ^ R2_W) & 0x8000) == 0) { + uint16 r2w = player_ypos - mirror_current_layer1_ypos - kHandleStandardLevelCameraScroll_DATA_00F69F[v2]; + if (((kHandleStandardLevelCameraScroll_DATA_00F6A3[v2] ^ r2w) & 0x8000) == 0) { v1 = 2; - R2_W = 0; + r2w = 0; } - if ((R2_W & 0x8000) != 0) { + if ((r2w & 0x8000) != 0) { uint8 v3 = player_wall_walk_status; if (player_wall_walk_status < 6) v3 = camera_bounce_off_spring_flag | flag_player_in_lakitus_cloud | timer_inflate_from_pballoon | player_climbing_flag | @@ -6536,7 +6210,7 @@ void HandleStandardLevelCameraScroll_00F7F4(uint16 a) { // 00f7f4 flag_scroll_up_to_player = 0; } int v5 = v1 >> 1; - uint16 v6 = R2_W; + uint16 v6 = r2w; uint16 t = (v6 - kHandleStandardLevelCameraScroll_DATA_00F6A7[v5]) ^ kHandleStandardLevelCameraScroll_DATA_00F6A7[v5]; if (!sign16(t)) v6 = kHandleStandardLevelCameraScroll_DATA_00F6A7[v5]; @@ -6544,28 +6218,29 @@ void HandleStandardLevelCameraScroll_00F7F4(uint16 a) { // 00f7f4 if ((int16)(v7 - kHandleStandardLevelCameraScroll_DATA_00F6AD[v5]) < 0) v7 = kHandleStandardLevelCameraScroll_DATA_00F6AD[v5]; mirror_current_layer1_ypos = v7; - if (sign16(R4_W - v7)) { - mirror_current_layer1_ypos = R4_W; + if (sign16(r4w - v7)) { + mirror_current_layer1_ypos = r4w; *(uint16 *)&flag_enable_vert_scroll = 0; } } } -void HandleStandardLevelCameraScroll_00F8AB() { // 00f8ab +uint16 HandleStandardLevelCameraScroll_00F8AB(uint16 r2w) { // 00f8ab if (!flag_lrscroll_flag) { uint8 v0 = 8; int v1 = player_facing_directionx2 >> 1; if ((int16)(player_relative_position_needed_to_scroll_screen - kHandleStandardLevelCameraScroll_DATA_00F6B3[v1]) < 0) v0 = 10; int v2 = v0 >> 1; - if (((R2_W ^ kHandleStandardLevelCameraScroll_DATA_00F6BF[v2]) & 0x8000) != 0 && - ((R2_W ^ kHandleStandardLevelCameraScroll_DATA_00F6BF[v1]) & 0x8000) != 0) { - if (kHandleStandardLevelCameraScroll_DATA_00F6CF[v2] + R2_W) { - R2_W += kHandleStandardLevelCameraScroll_DATA_00F6CF[v2]; + if (((r2w ^ kHandleStandardLevelCameraScroll_DATA_00F6BF[v2]) & 0x8000) != 0 && + ((r2w ^ kHandleStandardLevelCameraScroll_DATA_00F6BF[v1]) & 0x8000) != 0) { + if ((uint16)(kHandleStandardLevelCameraScroll_DATA_00F6CB[v2 + 2] + r2w)) { + r2w += kHandleStandardLevelCameraScroll_DATA_00F6CB[v2 + 2]; camera_lrscroll_move_flag = v0; } } } + return r2w; } void PlayerState00_00F8F2() { // 00f8f2 @@ -6582,21 +6257,19 @@ void PlayerState00_00F8F2() { // 00f8f2 uint8 v1 = 0; int16 t = spr_table160e[9] + 1 - player_xpos; if (t > 0) { - R0_W = spr_table1534[9]; - t = player_xpos + 15 - R0_W; + t = player_xpos + 15 - spr_table1534[9]; v1 = 1; } HandlePlayerLevelColl_00E9C8(v1, t < 0); } } else { if (!(player_yspeed & 0x80)) { - if (PlayerState00_00F9A8()) { + CheckPlatformCollRet cpcr = CheckTiltingPlatformCollision(player_xpos + 8, player_ypos + 32); + if (cpcr.retval) { if (player_in_air_flag) { - *(uint16 *)&temp14b4 = temp14b8; - *(uint16 *)&temp1436 = temp14b8; - *(uint16 *)&temp14b6 = temp14ba & 0xF0; - *(uint16 *)&temp1438 = temp14ba & 0xF0; - PlayerState00_00F9C9(); + player_on_tilting_platform_xpos = cpcr.pt.x & 0xff; + player_on_tilting_platform_ypos = cpcr.pt.y & 0xf0; + PlayerState00_00F9C9(player_on_tilting_platform_xpos, player_on_tilting_platform_ypos, cpcr.pt); } uint8 v2 = kPlayerState00_DATA_00F8DF[(uint8)(misc_m7_rotation + 72) >> 4]; temp8e = 0x80; @@ -6611,35 +6284,26 @@ void PlayerState00_00F8F2() { // 00f8f2 } } -uint8 PlayerState00_00F9A8() { // 00f9a8 - *(uint16 *)&temp14b4 = player_xpos + 8; - *(uint16 *)&temp14b6 = player_ypos + 32; - return PlayerState00_00F9BC(); -} - -uint8 PlayerState00_00F9BC() { // 00f9bc - return CheckTiltingPlatformCollision(); -} - -void PlayerState00_00F9C9() { // 00f9c9 +void PlayerState00_00F9C9(uint16 temp14b4, uint16 temp14b6, PointU16 pt) { // 00f9c9 uint16 v0 = misc_m7_rotation; misc_m7_rotation = -misc_m7_rotation; - PlayerState00_00F9BC(); + CheckPlatformCollRet ret = CheckTiltingPlatformCollision(temp14b4, temp14b6); + if (ret.out_of_bounds) + ret.pt = pt; misc_m7_rotation = v0; - player_xpos = temp14b8 - 8; - player_ypos = temp14ba - 32; + player_xpos = (uint8)ret.pt.x - 8; + player_ypos = (uint8)ret.pt.y - 32; } -uint8 CheckWhatSlopeSpriteIsOn(uint8 a) { // 00fa19 - R5_ = 50; - R6_ = -26; - R7_ = 0; - R8_ = *IndirPtr(&ptr_slope_steepness, (uint8)(a - 110)); - R1_ = 16 * R8_; - if (__CFSHL__(8 * R8_, 1)) - ++R6_; - R0_ = R12_ & 0xF; - return R1_ | R10_ & 0xF; +uint8 CheckWhatSlopeSpriteIsOn(uint8 a, uint8 r10, uint8 r12, uint8 *slope_type) { // 00fa19 + R5_slopeptr.addr = 0xe632; + R5_slopeptr.bank = 0; + uint8 r8 = *IndirPtr(&ptr_slope_steepness, (uint8)(a - 110)); + *slope_type = r8; + uint8 r1 = 16 * r8; + if (__CFSHL__(8 * r8, 1)) + ++g_ram[6]; + return r1 | r10 & 0xF; } void RunPlayerBlockCode_SpawnFlatPalaceSwitch() { // 00fa45 @@ -6696,16 +6360,16 @@ void Spr07B_GoalTape_LvlEndPowerUp(uint8 j) { // 00fb00 uint8 v3 = kSpr07B_GoalTape_DATA_00FADF[v1]; if (v3 == kSpr07B_GoalTape_DATA_00FAFB[player_current_item_box]) v3 = 120; - R15_ = 0; + uint8 r15 = 0; if (v3 >= 0xE0) { - R15_ = v3 & 0xF; + r15 = v3 & 0xF; v3 = 120; } spr_spriteid[j] = v3; if (v3 == 118) ++unusedram_got_invincible_star_from_goal; InitializeNormalSpriteRAMTables(j); - spr_table1594[j] = R15_; + spr_table1594[j] = r15; spr_current_status[j] = 12; spr_yspeed[j] = -48; spr_xspeed[j] = 5; diff --git a/src/smw_01.c b/src/smw_01.c index 75c1c8d..13401bb 100644 --- a/src/smw_01.c +++ b/src/smw_01.c @@ -468,6 +468,275 @@ void (*kSpr029_KoopaKids_KoopaKidPtrs[7])(uint8 k) = { &Spr029_KoopaKid_WendyLemmy, }; +static const uint8 kSprXXX_LineGuided_DATA_018000[8] = { 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1, }; +static const uint8 kSpr02C_YoshiEgg_Init_EggPalette[4] = { 0x9, 0x7, 0x5, 0x7, }; +static const uint8 kSprXXX_ReflectingEnemy_Init_InitYSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr04C_ExplodingBlock_Init_ExplodingBlkSpr[4] = { 0x15, 0xf, 0x0, 0x4, }; +static const uint8 kSpr08F_ScalePlatform_Init_ScalePlatWidth[2] = { 0x80, 0x40, }; +static const uint8 kSprXXX_WallFollowers_Init_DATA_0183EF[3] = { 0x8, 0x0, 0x8, }; +static const uint8 kSpr03E_PSwitch_Init_PSwitchPal[2] = { 0x6, 0x2, }; +static const uint8 kSpr095_ClappinChuck_Init_DATA_018526[2] = { 0x0, 0x4, }; +static const uint8 kSprXXX_Generic_Spr0to13SpeedX[4] = { 0x8, 0xf8, 0xc, 0xf4, }; +static const uint8 kSprXXX_Generic_Spr0to13Prop[20] = { 0x0, 0x2, 0x3, 0xd, 0x40, 0x42, 0x43, 0x45, 0x50, 0x50, 0x50, 0x5c, 0xdd, 0x5, 0x0, 0x20, 0x20, 0x0, 0x0, 0x0, }; +static const uint8 kSprXXX_Generic_DATA_018CBA[2] = { 0xff, 0x1, }; +static const uint8 kSprXXX_Generic_DATA_018CBC[2] = { 0xf0, 0x10, }; +static const uint8 kSpr010_ParaGoomba_WingXDisp[16] = { 0xf7, 0xb, 0xf6, 0xd, 0xfd, 0xc, 0xfc, 0xd, 0xb, 0xf5, 0xa, 0xf3, 0xb, 0xfc, 0xc, 0xfb, }; +static const uint8 kSpr010_ParaGoomba_WingYDisp[8] = { 0xf7, 0xf7, 0xf8, 0xf8, 0x1, 0x1, 0x2, 0x2, }; +static const uint8 kSpr010_ParaGoomba_WingProp[2] = { 0x46, 0x6, }; +static const uint8 kSpr010_ParaGoomba_WingTiles[4] = { 0xc6, 0xc6, 0x5d, 0x5d, }; +static const uint8 kSpr010_ParaGoomba_WingTileSize[4] = { 0x2, 0x2, 0x0, 0x0, }; +static const uint8 kSprXXX_RegularPiranhaPlant_YSpeed[4] = { 0x0, 0xf0, 0x0, 0x10, }; +static const uint8 kSprXXX_RegularPiranhaPlant_PhaseTimers[4] = { 0x20, 0x30, 0x20, 0x30, }; +static const uint8 kSpr01C_BulletBill_Prop[8] = { 0x42, 0x2, 0x3, 0x83, 0x3, 0x43, 0x3, 0x43, }; +static const uint8 kSpr01C_BulletBill_AnimationFrame[8] = { 0x0, 0x0, 0x1, 0x1, 0x2, 0x3, 0x3, 0x2, }; +static const uint8 kSpr01C_BulletBill_XSpeed[8] = { 0x20, 0xe0, 0x0, 0x0, 0x18, 0x18, 0xe8, 0xe8, }; +static const uint8 kSpr01C_BulletBill_YSpeed[8] = { 0x0, 0x0, 0xe0, 0x20, 0xe8, 0x18, 0x18, 0xe8, }; +static const uint8 kHandleNormalSpriteGravity_MaxYSpeed[2] = { 0x40, 0x10, }; +static const uint8 kHandleNormalSpriteGravity_YAcceleration[2] = { 0x3, 0x1, }; +static const uint8 kHandleNormalSpriteLevelColl_SpriteObjClippingX[61] = { 0xe, 0x2, 0x8, 0x8, 0xe, 0x2, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0xe, 0x2, 0x8, 0x8, 0x10, 0x0, 0x8, 0x8, 0xd, 0x2, 0x8, 0x8, 0x7, 0x0, 0x4, 0x4, 0x1f, 0x1, 0x10, 0x10, 0xf, 0x0, 0x8, 0x8, 0x10, 0x0, 0x8, 0x8, 0xd, 0x2, 0x8, 0x8, 0xe, 0x2, 0x8, 0x8, 0xd, 0x2, 0x8, 0x8, 0x10, 0x0, 0x8, 0x8, 0x1f, 0x0, 0x10, 0x10, 0x8, }; +static const uint8 kHandleNormalSpriteLevelColl_SpriteObjClippingY[61] = { 0x8, 0x8, 0x10, 0x2, 0x12, 0x12, 0x20, 0x2, 0x7, 0x7, 0x7, 0x7, 0x10, 0x10, 0x20, 0xb, 0x12, 0x12, 0x20, 0x2, 0x18, 0x18, 0x20, 0x10, 0x4, 0x4, 0x8, 0x0, 0x10, 0x10, 0x1f, 0x1, 0x8, 0x8, 0xf, 0x0, 0x8, 0x8, 0x10, 0x0, 0x48, 0x48, 0x50, 0x42, 0x4, 0x4, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0x10, 0x0, 0x8, 0x8, 0x10, 0x0, 0x4, }; +static const uint8 kHandleNormalSpriteLevelColl_DATA_019134[4] = { 0x1, 0x2, 0x4, 0x8, }; +static const uint8 kHandleNormalSpriteLevelColl_DATA_019284[2] = { 0xfc, 0x4, }; +static const uint8 kHandleNormalSpriteLevelColl_DATA_019286[2] = { 0xff, 0x0, }; +static const uint8 kHandleNormalSpriteLevelColl_DATA_0192C5[2] = { 0x1, 0xff, }; +static const uint8 kHandleNormalSpriteLevelColl_DATA_0192C7[2] = { 0x0, 0xff, }; +static const uint8 kSprStatus09_Stunned_SpriteKoopasSpawn[8] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x3, }; +static const uint8 kSprStatus09_Stunned_DATA_0197AD[2] = { 0xc0, 0x40, }; +static const uint8 kMakeStunnedSpriteBounceOrSlowDownOnGround_DATA_0197AF[38] = { 0x0, 0x0, 0x0, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xe8, 0xe8, 0xe8, 0xe8, 0x0, 0x0, 0x0, 0x0, 0xfe, 0xfc, 0xf8, 0xec, 0xec, 0xec, 0xe8, 0xe4, 0xe0, 0xdc, 0xd8, 0xd4, 0xd0, 0xcc, 0xc8, }; +static const uint8 kSprStatus0A_Kicked_XSpeed[2] = { 0xe0, 0x20, }; +static const uint8 kKickedShellGFXRt_ShellAniTiles[4] = { 0x6, 0x7, 0x8, 0x7, }; +static const uint8 kKickedShellGFXRt_Prop[4] = { 0x0, 0x0, 0x0, 0x40, }; +static const uint8 kSprStatus04_SpinJumpKill_SmokeTiles[4] = { 0x64, 0x62, 0x60, 0x62, }; +static const uint16 kGenericSpriteOAMData_Tiles[126] = { 0xa082, 0xa282, 0xa484, 0x8a8c, 0xc88e, 0xcaca, 0xccce, 0x4e86, 0xe2e0, 0xcee2, 0xe0e4, 0xa3e0, 0xb3a3, 0xe9b3, 0xf9e8, 0xe8f8, 0xf8e9, 0xe2f9, 0xaae6, 0xa8a8, 0xa2aa, 0xb2a2, 0xc3b2, 0xd3c2, 0xc2d2, 0xd2c3, 0xe2d3, 0xcae6, 0xcacc, 0xceac, 0xceae, 0x8383, 0xc4c4, 0x8383, 0xc5c5, 0xa68a, 0xa6a4, 0x80a8, 0x8082, 0x8484, 0x8484, 0x9494, 0x9494, 0xb0a0, 0xd0a0, 0x8082, 0x82, 0x0, 0x8486, 0xec88, 0xa88c, 0x8eaa, 0xaeac, 0xec8e, 0xceee, 0xa8ee, 0x40ee, 0xa040, 0xa0c0, 0xa4c0, 0xa4c4, 0xa0c4, 0xa0c0, 0x40c0, 0x2707, 0x294c, 0x2b4e, 0xa082, 0xa484, 0x6967, 0xce88, 0xae8e, 0xa2a2, 0xb2b2, 0x4000, 0x4244, 0x422c, 0x2828, 0x2828, 0x4c4c, 0x4c4c, 0x8383, 0x6f6f, 0xbcac, 0xa6ac, 0xaa8c, 0x8486, 0xecdc, 0xeede, 0x606, 0x1616, 0x707, 0x1717, 0x1616, 0x606, 0x1717, 0x707, 0x8684, 0x0, 0xe00, 0x242a, 0x602, 0x200a, 0x2822, 0x2e26, 0x4240, 0x40c, 0x6a2b, 0x88ed, 0xa88c, 0xaa8e, 0x8cae, 0xa888, 0xacae, 0x8e8c, 0xeece, 0xc6c4, 0x8482, 0x8c86, 0xcece, 0x8988, 0xcece, 0x8889, 0xcef3, 0xcef3, 0xa9a7, }; +static const uint8 kGenericSpriteOAMData_TilesOffset[84] = { 0x9, 0x9, 0x10, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x37, 0x0, 0x25, 0x25, 0x5a, 0x0, 0x4b, 0x4e, 0x8a, 0x8a, 0x8a, 0x8a, 0x56, 0x3a, 0x46, 0x47, 0x69, 0x6b, 0x73, 0x0, 0x0, 0x80, 0x80, 0x80, 0x80, 0x8e, 0x90, 0x0, 0x0, 0x3a, 0xf6, 0x94, 0x95, 0x63, 0x9a, 0xa6, 0xaa, 0xae, 0xb2, 0xc2, 0xc4, 0xd5, 0xd9, 0xd7, 0xd7, 0xe6, 0xe6, 0xe6, 0xe2, 0x99, 0x17, 0x29, 0xe6, 0xe6, 0xe6, 0x0, 0xe8, 0x0, 0x8a, 0xe8, 0x0, 0xed, 0xea, 0x7f, 0xea, 0xea, 0x3a, 0x3a, 0xfa, 0x71, 0x7f, }; +static const uint8 kGenericSpriteOAMData_XDisp[4] = { 0x0, 0x8, 0x0, 0x8, }; +static const uint8 kGenericSpriteOAMData_YDisp[4] = { 0x0, 0x0, 0x8, 0x8, }; +static const uint8 kGenericSpriteOAMData_Prop[24] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x40, 0x0, 0x40, 0x80, 0xc0, 0x40, 0x40, 0x0, 0x0, 0x40, 0x0, 0xc0, 0x80, 0x40, 0x40, 0x40, 0x40, }; +static const uint8 kDrawWingTiles_XDispLo[4] = { 0xff, 0xf7, 0x9, 0x9, }; +static const uint8 kDrawWingTiles_XDispHi[4] = { 0xff, 0xff, 0x0, 0x0, }; +static const uint8 kDrawWingTiles_YDisp[4] = { 0xfc, 0xf4, 0xfc, 0xf4, }; +static const uint8 kDrawWingTiles_Tiles[4] = { 0x5d, 0xc6, 0x5d, 0xc6, }; +static const uint8 kDrawWingTiles_Prop[4] = { 0x46, 0x46, 0x6, 0x6, }; +static const uint8 kDrawWingTiles_TileSize[4] = { 0x0, 0x2, 0x0, 0x2, }; +static const uint8 kSprStatus0B_Carried_CarriedSpriteXOffsetLo[6] = { 0xb, 0xf5, 0x4, 0xfc, 0x4, 0x0, }; +static const uint8 kSprStatus0B_Carried_CarriedSpriteXOffsetHi[6] = { 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, }; +static const uint8 kSprStatus0B_Carried_PlacedSpriteInitialXPosLo[2] = { 0xf3, 0xd, }; +static const uint8 kSprStatus0B_Carried_PlacedSpriteInitialXPosHi[2] = { 0xff, 0x0, }; +static const uint8 kSprStatus0B_Carried_ShellXSpeed[4] = { 0xd2, 0x2e, 0xcc, 0x34, }; +static const uint8 kSprStatus0B_Carried_PlacedSpriteInitiaXSpeed[2] = { 0xfc, 0x4, }; +static const uint8 kProcessStunnedNormalSprite_StunnedBabyYoshi_DATA_01A35A[7] = { 0x0, 0x3, 0x2, 0x2, 0x1, 0x1, 0x1, }; +static const uint8 kGetDrawInfo_DATA_01A361[2] = { 0x10, 0x20, }; +static const uint8 kGetDrawInfo_DATA_01A363[2] = { 0x1, 0x2, }; +static const uint8 kCheckNormalSpriteToNormalSpriteColl_DATA_01A40B[2] = { 0x2, 0xa, }; +static const uint8 kStompSoundTable_Bank01[7] = { 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, }; +static const uint8 kCheckNormalSpriteToNormalSpriteColl_DATA_01A6D7[2] = { 0x30, 0xd0, }; +static const uint8 kCheckNormalSpriteToNormalSpriteColl_DATA_01A778[2] = { 0x10, 0xf0, }; +static const uint8 kCheckNormalSpriteToNormalSpriteColl_DATA_01A77A[2] = { 0x0, 0xff, }; +const uint8 kGenericSpriteToSpawnTable[19] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x4, 0x4, 0x5, 0x5, 0x7, 0x0, 0x0, 0xf, 0xf, 0xf, 0xd, }; +static const uint8 kCheckPlayerToNormalSpriteColl_DATA_01A839[2] = { 0xf0, 0x10, }; +static const uint16 kCheckPlayerToNormalSpriteColl_DATA_01AB2D[2] = { 0x1, 0xffff, }; +static const uint8 kSubOffscreen_Bank01_SpriteOffScreen1_Lo[2] = { 0x40, 0xb0, }; +static const uint8 kSubOffscreen_Bank01_SpriteOffScreen1_Hi[2] = { 0x1, 0xff, }; +static const uint8 kSubOffscreen_Bank01_SpriteOffScreen2_Lo[8] = { 0x30, 0xc0, 0xa0, 0xc0, 0xa0, 0xf0, 0x60, 0x90, }; +static const uint8 kSubOffscreen_Bank01_SpriteOffScreen2_Hi[8] = { 0x1, 0xff, 0x1, 0xff, 0x1, 0xff, 0x1, 0xff, }; +static const uint8 kSpr083_LeftFlyingBlock_Acceleration[2] = { 0xff, 0x1, }; +static const uint8 kSpr083_LeftFlyingBlock_MaxYSpeed[2] = { 0xf4, 0xc, }; +static const uint8 kSpr083_LeftFlyingBlock_MaxXSpeed[2] = { 0xf0, 0x10, }; +static const uint8 kSpr083_LeftFlyingBlock_DATA_01AE7F[9] = { 0x0, 0x3, 0x5, 0x7, 0x8, 0x8, 0x7, 0x5, 0x3, }; +static const uint8 kSpr083_LeftFlyingBlock_DATA_01AE88[8] = { 0x6, 0x2, 0x4, 0x5, 0x6, 0x1, 0x1, 0x5, }; +static const uint8 kSpr026_Thwomp_XDisp[5] = { 0xfc, 0x4, 0xfc, 0x4, 0x0, }; +static const uint8 kSpr026_Thwomp_YDisp[5] = { 0x0, 0x0, 0x10, 0x10, 0x8, }; +static const uint8 kSpr026_Thwomp_Tiles[5] = { 0x8e, 0x8e, 0xae, 0xae, 0xc8, }; +static const uint8 kSpr026_Thwomp_Prop[5] = { 0x3, 0x43, 0x3, 0x43, 0x3, }; +static const uint8 kSpr017_GeneratorCheepCheep_Init_InitXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSprXXX_FixedMovementCheepCheep_SwimmingXSpeed[2] = { 0x8, 0xf8, }; +static const uint8 kSprXXX_FixedMovementCheepCheep_SwimmingYSpeed[4] = { 0x0, 0x0, 0x8, 0xf8, }; +static const uint8 kSprXXX_FixedMovementCheepCheep_KickedXSpeed[2] = { 0xf0, 0x10, }; +static const uint8 kSprXXX_FixedMovementCheepCheep_FloppingYSpeed[4] = { 0xe0, 0xe8, 0xd0, 0xd8, }; +static const uint8 kSprXXX_FixedMovementCheepCheep_FloppingXSpeed[8] = { 0x8, 0xf8, 0x10, 0xf0, 0x4, 0xfc, 0x14, 0xec, }; +static const uint8 kSprXXX_FixedMovementCheepCheep_DATA_01B031[2] = { 0x3, 0xc, }; +static const uint8 kSpr018_SurfaceJumpingCheepCheep_YSpeed[3] = { 0xd0, 0xd0, 0xb0, }; +static const uint8 kSprXXX_BuoyantPlatformsAndMine_Init_InitialXSpeed[4] = { 0x8, 0xf8, 0x10, 0xf0, }; +static const uint8 kSpr055_HorizontalCheckerboardPlatform_DATA_01B268[2] = { 0xff, 0x1, }; +static const uint8 kSpr055_HorizontalCheckerboardPlatform_DATA_01B26A[2] = { 0xf0, 0x10, }; +static const uint8 kNormalSpritePlatformGFXRt_DATA_01B2C3[14] = { 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kNormalSpritePlatformGFXRt_DiagPlatTiles[9] = { 0xcb, 0xe4, 0xcc, 0xe5, 0xcc, 0xe5, 0xcc, 0xe4, 0xcb, }; +static const uint8 kSolidSpriteBlock_DATA_01B4F9[6] = { 0xe, 0xf1, 0x10, 0xe0, 0x1f, 0xf1, }; +static const uint8 kSolidSpriteBlock_DATA_01B4FF[6] = { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, }; +static const uint8 kSprXXX_BuoyantPlatformsAndMine_SpikeBallXDisp[4] = { 0xf8, 0x8, 0xf8, 0x8, }; +static const uint8 kSprXXX_BuoyantPlatformsAndMine_SpikeBallYDisp[4] = { 0xf8, 0xf8, 0x8, 0x8, }; +static const uint8 kSprXXX_BuoyantPlatformsAndMine_SpikeBallProp[4] = { 0x31, 0x71, 0xa1, 0xf1, }; +static const uint8 kSprXXX_TurnBlockBridge_BlkBridgeLength[2] = { 0x20, 0x0, }; +static const uint8 kSprXXX_TurnBlockBridge_TurnBlkBridgeSpeed[2] = { 0x1, 0xff, }; +static const uint8 kSprXXX_TurnBlockBridge_BlkBridgeTiming[2] = { 0x40, 0x40, }; +static const uint8 kSprXXX_NetKoopas_Init_InitXSpeed[2] = { 0x8, 0xf8, }; +static const uint8 kSprXXX_NetKoopas_DATA_01B969[10] = { 0x2, 0x2, 0x3, 0x4, 0x3, 0x2, 0x2, 0x2, 0x1, 0x2, }; +static const uint8 kSprXXX_NetKoopas_DATA_01B973[10] = { 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, }; +static const uint8 kSprXXX_NetKoopas_DATA_01B97D[2] = { 0x3, 0xc, }; +static const uint8 kSpr054_ClimbingNetDoor_XDisp[16] = { 0x0, 0x1, 0x2, 0x4, 0x6, 0x9, 0xc, 0xd, 0x14, 0xd, 0xc, 0x9, 0x6, 0x4, 0x2, 0x1, }; +static const uint8 kSpr054_ClimbingNetDoor_AnimationFrame[16] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr054_ClimbingNetDoor_Tiles[21] = { 0x0, 0x10, 0x0, 0x0, 0x10, 0x0, 0x1, 0x11, 0x1, 0x5, 0x15, 0x5, 0x5, 0x15, 0x5, 0x0, 0x0, 0x0, 0x3, 0x13, 0x3, }; +static const uint8 kSpr020_Magic_Palettes[4] = { 0x5, 0x7, 0x9, 0xb, }; +static const uint8 kSpr020_Magic_Disp[16] = { 0x0, 0x1, 0x2, 0x5, 0x8, 0xb, 0xe, 0xf, 0x10, 0xf, 0xe, 0xb, 0x8, 0x5, 0x2, 0x1, }; +static const uint8 kSpr01F_MagiKoopa_DATA_01BE69[3] = { 0x4, 0x2, 0x0, }; +static const uint8 kSpr01F_MagiKoopa_WandXDisp[2] = { 0x10, 0xf8, }; +static const uint8 kSpr07B_GoalTape_YSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSprXXX_FlyingItems_YAcceleration[2] = { 0xff, 0x1, }; +static const uint8 kSprXXX_FlyingItems_MaxYSpeed[2] = { 0xf0, 0x10, }; +static const uint8 kSprXXX_PowerUps_ChangingItemSprite[4] = { 0x74, 0x75, 0x77, 0x76, }; +static const uint8 kSprXXX_PowerUps_EatenBerryGfxProp[4] = { 0x2, 0x2, 0x4, 0x6, }; +static const uint8 kSprXXX_PowerUps_ItemBoxSprite[20] = { 0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x4, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x4, 0x2, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSprXXX_PowerUps_GivePowerPtrIndex[20] = { 0x0, 0x1, 0x1, 0x1, 0x4, 0x4, 0x4, 0x1, 0x2, 0x2, 0x2, 0x2, 0x3, 0x3, 0x1, 0x3, 0x5, 0x5, 0x5, 0x5, }; +static const uint8 kPowerUpAndItemGFXRt_PowerUpTiles[13] = { 0x24, 0x26, 0x48, 0xe, 0x24, 0x0, 0x0, 0x0, 0x0, 0xe4, 0xe8, 0x24, 0xec, }; +static const uint8 kPowerUpAndItemGFXRt_StarPalValues[4] = { 0x0, 0x4, 0x8, 0x4, }; +static const uint8 kPowerUpAndItemGFXRt_DrawCoinSprite_Tiles[3] = { 0xea, 0xfa, 0xea, }; +static const uint8 kSpr077_Feather_XAccelerarion[2] = { 0x2, 0xfe, }; +static const uint8 kSpr077_Feather_MaxXSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr077_Feather_YSpeed[3] = { 0xa, 0xf6, 0x8, }; +static const uint8 kSpr05F_BrownChainedPlatform_PlatformXDisp[4] = { 0xe0, 0xf0, 0x0, 0x10, }; +static const uint8 kSpr05F_BrownChainedPlatform_PlatformTiles[4] = { 0x60, 0x61, 0x61, 0x62, }; +static const uint8 kSpr05F_BrownChainedPlatform_DATA_01C9D6[2] = { 0x1, 0xff, }; +static const uint8 kSpr05F_BrownChainedPlatform_DATA_01C9D8[2] = { 0x40, 0xc0, }; +static const uint8 kSpr029_KoopaKids_Init_DATA_01CD92[3] = { 0x1, 0x1, 0x0, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CD99[3] = { 0x0, 0x9, 0x12, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CD9C[9] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CDA5[2] = { 0x0, 0x80, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_LudwigMaxXSpeed[2] = { 0x30, 0xd0, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CEB0[4] = { 0x1b, 0x1c, 0x1d, 0x1b, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CEB4[2] = { 0x14, 0xec, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D057[2] = { 0xff, 0xf1, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D0BE[2] = { 0x20, 0xe0, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D0DE[56] = { 0x80, 0x83, 0x85, 0x88, 0x8a, 0x8b, 0x8d, 0x8f, 0x90, 0x91, 0x91, 0x92, 0x92, 0x93, 0x93, 0x94, 0x94, 0x95, 0x95, 0x96, 0x96, 0x97, 0x97, 0x98, 0x98, 0x98, 0x99, 0x99, 0x9a, 0x9a, 0x9b, 0x9b, 0x9c, 0x9c, 0x9c, 0x9c, 0x9d, 0x9d, 0x9d, 0x9d, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D122[12] = { 0xf0, 0x0, 0x10, 0x0, 0xf0, 0x0, 0x10, 0x0, 0xe8, 0x0, 0x18, 0x0, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D12E[16] = { 0x0, 0xf0, 0x0, 0x10, 0x0, 0xf0, 0x0, 0x10, 0x0, 0xe8, 0x0, 0x18, 0x26, 0x26, 0xd8, 0xd8, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D13E[4] = { 0x90, 0x30, 0x30, 0x90, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D142[4] = { 0x0, 0x1, 0x2, 0x1, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D239[2] = { 0xfc, 0x4, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D23B[2] = { 0xff, 0x0, }; +static const uint8 kSpr029_KoopaKid_MortonRoyLudwig_DATA_01D23D[2] = { 0xff, 0x1, }; +static const uint8 kSpr034_LudwigFireball_OAMIndexes[5] = { 0xa8, 0xb0, 0xb8, 0xc0, 0xc8, }; +static const uint8 kSpr034_LudwigFireball_XDisp[4] = { 0x0, 0xf0, 0x0, 0x10, }; +static const uint8 kSpr034_LudwigFireball_Tiles[4] = { 0x4a, 0x4c, 0x6a, 0x6c, }; +static const uint8 kSpr034_LudwigFireball_Prop[4] = { 0x45, 0x45, 0x5, 0x5, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D4E7[2] = { 0x1, 0xff, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D4E9[2] = { 0xf, 0x0, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D4EB[16] = { 0x0, 0x2, 0x4, 0x6, 0x8, 0xa, 0xc, 0xe, 0xe, 0xc, 0xa, 0x8, 0x6, 0x4, 0x2, 0x0, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D55E[16] = { 0xd, 0xd, 0xd, 0xd, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xd, 0xd, 0xd, 0xd, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D56E[16] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D57E[16] = { 0xf8, 0xf8, 0xfa, 0xfa, 0xfc, 0xfc, 0xfe, 0xfe, 0x2, 0x2, 0x4, 0x4, 0x6, 0x6, 0x8, 0x8, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D58E[16] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D59E[16] = { 0xe, 0xe, 0xf, 0xf, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf, 0xf, 0xe, 0xe, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D5AE[2] = { 0xf, 0xd, }; +static const uint8 kSprXXX_ParachutingEnemy_DATA_01D5B0[3] = { 0x1, 0x5, 0x0, }; +static const uint8 kSprXXX_LineGuided_DATA_01D717[2] = { 0xf8, 0x0, }; +static const uint8 kSprXXX_LineGuided_DATA_01D7E1[4] = { 0xfc, 0x4, 0xfc, 0x4, }; +static const uint8 kSprXXX_LineGuided_DATA_01D7E5[4] = { 0xff, 0x0, 0xff, 0x0, }; +static const uint8 kSprXXX_LineGuided_DATA_01D7E9[4] = { 0xfc, 0xfc, 0x4, 0x4, }; +static const uint8 kSprXXX_LineGuided_DATA_01D7ED[4] = { 0xff, 0xff, 0x0, 0x0, }; +static const uint8 kSpr0B4_NonLineGuideGrinder_XSpeed[2] = { 0x18, 0xe8, }; +static const uint8 kSpr0B4_NonLineGuideGrinder_XDisp[4] = { 0xf8, 0x8, 0xf8, 0x8, }; +static const uint8 kSpr0B4_NonLineGuideGrinder_YDisp[4] = { 0x0, 0x0, 0x10, 0x10, }; +static const uint8 kSpr0B4_NonLineGuideGrinder_Prop[4] = { 0x3, 0x43, 0x83, 0xc3, }; +static const uint8 kSprXXX_LineGuided_DATA_01DC09[2] = { 0x5, 0x45, }; +static const uint8 kSprXXX_LineGuided_DATA_01DC3B[4] = { 0xf0, 0x0, 0xf0, 0x0, }; +static const uint8 kSprXXX_LineGuided_DATA_01DC3F[4] = { 0xf0, 0xf0, 0x0, 0x0, }; +static const uint8 kSprXXX_LineGuided_DATA_01DC43[4] = { 0x33, 0x73, 0xb3, 0xf3, }; +static const uint8 kSprXXX_LineGuided_RopeMotorTiles[4] = { 0xc0, 0xc2, 0xe0, 0xc2, }; +static const uint8 kSprXXX_LineGuided_LineGuideRopeTiles[9] = { 0xc0, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, }; +static const uint8 kSprXXX_LineGuided_DATA_01DCD1[32] = { 0x15, 0x15, 0x15, 0x15, 0xc, 0x10, 0x10, 0x10, 0x10, 0xc, 0xc, 0x10, 0x10, 0x10, 0x10, 0xc, 0x15, 0x15, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x15, 0x15, }; +static const uint8 kSprXXX_LineGuided_DATA_01DCF1[32] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, 0x0, 0x0, 0x0, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x1, 0x2, 0x0, 0x0, 0x0, 0x0, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSprXXX_LineGuided_DATA_01DD11[64] = { 0x0, 0x10, 0x0, 0xf0, 0xf4, 0xfc, 0xf0, 0x10, 0x4, 0xc, 0xc, 0x0, 0x10, 0xf0, 0xfc, 0xf4, 0xf0, 0x10, 0xf0, 0x10, 0xf0, 0x10, 0xf8, 0xf8, 0x8, 0x8, 0x10, 0x10, 0x0, 0x0, 0xf0, 0x10, 0x10, 0x0, 0xf0, 0xf0, 0xc, 0x4, 0x10, 0xf0, 0x0, 0xf4, 0xf4, 0xfc, 0xf0, 0x10, 0x0, 0xc, 0x10, 0xf0, 0x10, 0x0, 0x10, 0xf0, 0x8, 0x8, 0xf8, 0xf8, 0xf0, 0xf0, 0x0, 0x0, 0x10, 0xf0, }; +static const uint8 kSprXXX_LineGuided_DATA_01DD51[64] = { 0x10, 0x0, 0x10, 0x0, 0xc, 0x10, 0x4, 0x0, 0x10, 0xc, 0xc, 0x10, 0x4, 0x0, 0x10, 0xc, 0x10, 0x10, 0x8, 0x8, 0x8, 0x8, 0x10, 0x10, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x0, 0xf0, 0x0, 0xf0, 0xf4, 0xf0, 0x0, 0xfc, 0xf0, 0xf4, 0xf4, 0xf0, 0x0, 0xfc, 0xf0, 0xf4, 0xf0, 0xf0, 0xf8, 0xf8, 0xf8, 0xf8, 0xf0, 0xf0, 0xf0, 0xf0, 0x0, 0x0, 0xf0, 0xf0, 0xf0, 0xf0 }; +static const uint8 kSpr082_BonusGame_Init_DATA_01DD90[9] = { 0x50, 0x78, 0xa0, 0xa0, 0xa0, 0x78, 0x50, 0x50, 0x78, }; +static const uint8 kSpr082_BonusGame_Init_DATA_01DD99[9] = { 0xf0, 0xf0, 0xf0, 0x18, 0x40, 0x40, 0x40, 0x18, 0x18, }; +static const uint8 kSpr082_BonusGame_Init_DATA_01DDA2[9] = { 0x3, 0x0, 0x0, 0x1, 0x1, 0x2, 0x2, 0x3, 0xff, }; +static const uint8 kSpr082_BonusGame_DATA_01DE11[4] = { 0x10, 0x0, 0xf0, 0x0, }; +static const uint8 kSpr082_BonusGame_DATA_01DE15[4] = { 0x0, 0x10, 0x0, 0xf0, }; +static const uint8 kSpr082_BonusGame_DATA_01DE19[4] = { 0xa0, 0xa0, 0x50, 0x50, }; +static const uint8 kSpr082_BonusGame_DATA_01DE1D[4] = { 0xf0, 0x40, 0x40, 0xf0, }; +static const uint8 kSpr082_BonusGame_DATA_01DE21[9] = { 0x1, 0x1, 0x1, 0x4, 0x4, 0x4, 0x7, 0x7, 0x7, }; +static const uint8 kSpr082_BonusGame_DATA_01DEE3[36] = { 0x58, 0x59, 0x83, 0x83, 0x48, 0x49, 0x58, 0x59, 0x83, 0x83, 0x48, 0x49, 0x34, 0x35, 0x83, 0x83, 0x24, 0x25, 0x34, 0x35, 0x83, 0x83, 0x24, 0x25, 0x36, 0x37, 0x83, 0x83, 0x26, 0x27, 0x36, 0x37, 0x83, 0x83, 0x26, 0x27, }; +static const uint8 kSpr082_BonusGame_DATA_01DF07[9] = { 0x4, 0x4, 0x4, 0x8, 0x8, 0x8, 0xa, 0xa, 0xa, }; +static const uint8 kSpr082_BonusGame_DATA_01DF10[9] = { 0x0, 0x3, 0x5, 0x7, 0x8, 0x8, 0x7, 0x5, 0x3, }; +static const uint8 kSpr082_BonusGame_DATA_01DFC1[24] = { 0x0, 0x1, 0x2, 0x2, 0x3, 0x4, 0x4, 0x5, 0x6, 0x6, 0x7, 0x0, 0x0, 0x8, 0x4, 0x2, 0x8, 0x6, 0x3, 0x8, 0x7, 0x1, 0x8, 0x5, }; +static const uint8 kSpr033_Podoboo_DATA_01E07B[22] = { 0xf0, 0xdc, 0xd0, 0xc8, 0xc0, 0xb8, 0xb2, 0xac, 0xa6, 0xa0, 0x9a, 0x96, 0x92, 0x8c, 0x88, 0x84, 0x80, 0x4, 0x8, 0xc, 0x10, 0x14, }; +static const uint8 kSpr033_Podoboo_DATA_01E091[2] = { 0x70, 0x20, }; +static const uint8 kSpr033_Podoboo_BowserFlameTiles[4] = { 0x2a, 0x2c, 0x2a, 0x2c, }; +static const uint8 kSpr033_Podoboo_BowserFlameProp[4] = { 0x5, 0x5, 0x45, 0x45, }; +static const uint8 kSprXXX_SmallMontyMole_DATA_01E35F[2] = { 0x1, 0x2, }; +static const uint8 kSprXXX_SmallMontyMole_DATA_01E361[2] = { 0x0, 0x5, }; +static const uint8 kSprXXX_SmallMontyMole_NoFollowXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSprXXX_SmallMontyMole_FollowMaxXSpeed[2] = { 0x18, 0xe8, }; +static const uint8 kSpr030_ThrowingDryBones_XSpeed[2] = { 0x8, 0xf8, }; +static const uint8 kSpr030_ThrowingDryBones_DATA_01E43C[2] = { 0x8, 0xf8, }; +static const uint8 kSpr02F_PortableSpringboard_AnimationFrames[9] = { 0x0, 0x1, 0x2, 0x2, 0x2, 0x1, 0x1, 0x0, 0x0, }; +static const uint8 kSpr02F_PortableSpringboard_PlayerYDisp[9] = { 0x1e, 0x1b, 0x18, 0x18, 0x18, 0x1a, 0x1c, 0x1d, 0x1e, }; +static const uint8 kSpr02F_PortableSpringboard_YDispOffset[3] = { 0x0, 0x2, 0x0, }; +static const uint8 kSpr087_LakituCloud_XDisp[16] = { 0xfc, 0x4, 0xfe, 0x2, 0xfb, 0x5, 0xfd, 0x3, 0xfa, 0x6, 0xfc, 0x4, 0xfb, 0x5, 0xfd, 0x3, }; +static const uint8 kSpr087_LakituCloud_YDisp[20] = { 0x0, 0xff, 0x3, 0x4, 0xff, 0xfe, 0x4, 0x3, 0xfe, 0xff, 0x3, 0x3, 0xff, 0x0, 0x3, 0x3, 0xf8, 0xfc, 0x0, 0x4, }; +static const uint8 kSpr087_LakituCloud_CloudYPosOffset[17] = { 0xe, 0xf, 0x10, 0x11, 0x12, 0x11, 0x10, 0xf, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, }; +static const uint8 kSpr087_LakituCloud_EvaporatingCloudTiles[4] = { 0x66, 0x64, 0x62, 0x60, }; +static const uint8 kSpr087_LakituCloud_MaxLakituXSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr087_LakituCloud_MaxLakituYSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kMakeLakituThrowSpiny_InitialXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kGenericNormalSpriteAccelerationTable[2] = { 0x1, 0xff, }; +static const uint8 kSpr035_Yoshi_PanicXSpeed[2] = { 0xe8, 0x18, }; +static const uint8 kSpr035_Yoshi_DismountXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr035_Yoshi_GrowingAniSequence[8] = { 0xc, 0xb, 0xc, 0xb, 0xa, 0xb, 0xa, 0xb, }; +static const uint8 kSpr035_Yoshi_YoshiEggInitialXSpeed[2] = { 0xf0, 0x10, }; +static const uint8 kSpr035_Yoshi_YoshiEggInitialXOffsetLo[2] = { 0xfa, 0x6, }; +static const uint8 kSpr035_Yoshi_YoshiEggInitialXOffsetHi[2] = { 0xff, 0x0, }; +static const uint8 kSpr035_Yoshi_DATA_01EDE2[2] = { 0x4, 0x10, }; +static const uint8 kSpr035_Yoshi_DATA_01EDE4[10] = { 0x6, 0x5, 0x5, 0x5, 0xa, 0x5, 0x5, 0xa, 0xa, 0xb, }; +static const uint8 kSpr035_Yoshi_YoshiWalkFrames[3] = { 0x2, 0x1, 0x0, }; +static const uint8 kSpr035_Yoshi_YoshiPositionX[2] = { 0x2, 0xfe, }; +static const uint8 kSpr035_Yoshi_DATA_01EDF3[2] = { 0x0, 0xff, }; +// oob +static const uint8 kSpr035_Yoshi_DATA_01EDF5[5] = { 0x3, 0x2, 0x1, 0x0, 0x0 }; +static const uint8 kSpr035_Yoshi_YoshiHeadTiles[13] = { 0x0, 0x1, 0x2, 0x3, 0x2, 0x10, 0x4, 0x5, 0x0, 0x0, 0xff, 0xff, 0x0, }; +static const uint8 kSpr035_Yoshi_YoshiBodyTiles[13] = { 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0x6, 0xc, 0xa, 0xd, 0xe, 0xf, 0xc, }; +static const uint8 kSpr035_Yoshi_YoshiHeadXDisp[26] = { 0xa, 0x9, 0xa, 0x6, 0xa, 0xa, 0xa, 0x10, 0xa, 0xa, 0x0, 0x0, 0xa, 0xf6, 0xf7, 0xf6, 0xfa, 0xf6, 0xf6, 0xf6, 0xf0, 0xf6, 0xf6, 0x0, 0x0, 0xf6, }; +static const uint8 kSpr035_Yoshi_DATA_01EE2D[26] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0xff, }; +static const uint8 kSpr035_Yoshi_YoshiPositionY[13] = { 0x0, 0x1, 0x1, 0x0, 0x4, 0x0, 0x0, 0x4, 0x3, 0x3, 0x0, 0x0, 0x4, }; +static const uint8 kSpr035_Yoshi_YoshiHeadYDisp[13] = { 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x5, }; +static const uint8 kSpr035_Yoshi_YoshiShellAbility[14] = { 0x0, 0x0, 0x1, 0x2, 0x0, 0x0, 0x1, 0x2, 0x1, 0x1, 0x1, 0x3, 0x2, 0x2, }; +static const uint8 kSpr035_Yoshi_YoshiAbilityIndex[6] = { 0x3, 0x2, 0x2, 0x3, 0x1, 0x0, }; +static const uint8 kSpr035_Yoshi_YoshiFireballInitialXSpeed[3] = { 0x28, 0x24, 0x24, }; +static const uint8 kSpr035_Yoshi_YoshiFireballInitialYSpeed[3] = { 0x0, 0xf8, 0x8, }; +static const uint8 kSpr035_Yoshi_SpatOutSpriteXSpeed[4] = { 0x30, 0xd0, 0x10, 0xf0, }; +static const uint8 kSpr035_Yoshi_DATA_01F305[2] = { 0x10, 0xf0, }; +static const uint8 kSpr035_Yoshi_DATA_01F307[2] = { 0x0, 0xff, }; +static const uint8 kSpr035_Yoshi_DATA_01F3D9[2] = { 0x0, 0x4, }; +static const uint8 kSpr035_Yoshi_DATA_01F60A[16] = { 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf0, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x18, }; +static const uint8 kSpr035_Yoshi_DATA_01F61A[8] = { 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x13, }; +static const uint8 kSpr02C_YoshiEgg_DATA_01F75C[4] = { 0x0, 0x1, 0x1, 0x1, }; +static const uint8 kSpr02C_YoshiEgg_YoshiEggTiles[4] = { 0x62, 0x2, 0x2, 0x0, }; +static const uint8 kSpr02C_YoshiEgg_EggShellInitialYPosLo[4] = { 0x0, 0x0, 0x8, 0x8, }; +static const uint8 kSpr02C_YoshiEgg_EggShellInitialXPosLo[4] = { 0x0, 0x8, 0x0, 0x8, }; +static const uint8 kSpr02C_YoshiEgg_EggShellInitialYSpeed[4] = { 0xe8, 0xe8, 0xf4, 0xf4, }; +static const uint8 kSpr02C_YoshiEgg_EggShellInitialXSpeed[4] = { 0xfa, 0x6, 0xfd, 0x3, }; +static const uint8 kSprXXX_Eeries_Init_XSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSprXXX_Eeries_YSpeed[2] = { 0x18, 0xe8, }; +static const uint8 kSprXXX_NonBossBoos_MaxSpeed[2] = { 0x8, 0xf8, }; +static const uint8 kSprXXX_NonBossBoos_DATA_01F8D1[4] = { 0x1, 0x2, 0x2, 0x1, }; +static const uint8 kSprXXX_NonBossBoos_BooBlockTiles[3] = { 0x8c, 0xc8, 0xca, }; +static const uint8 kSprXXX_NonBossBoos_BooBlockProp[3] = { 0xe, 0x2, 0x2, }; +static const uint8 kSpr0A7_IggyBall_XFlip[2] = { 0x40, 0x0, }; +static const uint8 kSpr0A7_IggyBall_Tiles[4] = { 0x4a, 0x4c, 0x4a, 0x4c, }; +static const uint8 kSpr0A7_IggyBall_Prop[4] = { 0x35, 0x35, 0xf5, 0xf5, }; +static const uint8 kSpr0A7_IggyBall_XSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_HurtXSpeed[16] = { 0x0, 0xfc, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf4, 0xf0, 0xf0, 0xec, 0xec, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_WalkingAnimationFrames[16] = { 0x0, 0x1, 0x2, 0x0, 0x1, 0x2, 0x0, 0x1, 0x2, 0x0, 0x1, 0x2, 0x0, 0x1, 0x2, 0x1, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_ThrowingAnimationFrames[16] = { 0x4, 0xb, 0xb, 0xb, 0xb, 0xa, 0xa, 0x9, 0x9, 0x8, 0x8, 0x7, 0x4, 0x5, 0x5, 0x5, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_BallXDisp[2] = { 0x8, 0xf8, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_XDisp[96] = { 0xf7, 0xff, 0x0, 0xf8, 0xf7, 0xff, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0xf8, 0xfb, 0x3, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0xf8, 0xfa, 0x2, 0x0, 0xf8, 0x0, 0x0, 0xf8, 0x0, 0x0, 0xf8, 0x0, 0xf8, 0x0, 0x0, 0x0, 0x0, 0xfb, 0xf8, 0x0, 0xf8, 0xf4, 0xf8, 0x0, 0xf8, 0x0, 0xf8, 0x0, 0xf8, 0x9, 0x9, 0x0, 0x10, 0x9, 0x9, 0x0, 0x10, 0x8, 0x8, 0x0, 0x10, 0x5, 0x5, 0x0, 0x10, 0x8, 0x8, 0x0, 0x10, 0x6, 0x6, 0x0, 0x10, 0x0, 0x8, 0x8, 0x8, 0x0, 0x10, 0x0, 0x10, 0x0, 0x8, 0x0, 0x8, 0x5, 0x10, 0x0, 0x10, 0xc, 0x10, 0x0, 0x10, 0x0, 0x10, 0x0, 0x10, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_YDisp[48] = { 0xfa, 0xf2, 0x0, 0x9, 0xf9, 0xf1, 0x0, 0x8, 0xf8, 0xf0, 0x0, 0x8, 0xfe, 0xf6, 0x0, 0x8, 0xfc, 0xf4, 0x0, 0x8, 0xff, 0xf7, 0x0, 0x8, 0x0, 0xf0, 0xf8, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0xf9, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x8, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_Tiles[48] = { 0x0, 0xc, 0x2, 0xa, 0x0, 0xc, 0x22, 0xa, 0x0, 0xc, 0x20, 0xa, 0x0, 0xc, 0x20, 0xa, 0x0, 0xc, 0x20, 0xa, 0x0, 0xc, 0x20, 0xa, 0x24, 0x1c, 0x4, 0x1c, 0xe, 0xd, 0xe, 0xd, 0xe, 0x1d, 0xe, 0x1d, 0x4a, 0xd, 0xe, 0xd, 0x4a, 0xd, 0xe, 0xd, 0x20, 0xa, 0x20, 0xa, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_IggyTiles[3] = { 0x6, 0x2, 0x8, }; +static const uint16 kSpr029_KoopaKid_IggyLarry_TileSize[3] = { 0x2, 0x2, 0x3b37 }; +static const uint8 kSpr029_KoopaKid_IggyLarry_InShellTiles[4] = { 0x2c, 0x2e, 0x2c, 0x2e, }; +static const uint8 kSpr029_KoopaKid_IggyLarry_InShellProp[4] = { 0x0, 0x0, 0x40, 0x0, }; + uint8 CheckNormalSpriteLevelColl_Wall(uint8 k) { // 018008 return spr_table1588[k] & 3; } @@ -483,14 +752,12 @@ uint8 CheckNormalSpriteLevelColl_Ceiling(uint8 k) { // 018014 void SpawnNormalSpriteTurnAroundSmoke(uint8 k) { // 01804e if (spr_table1588[k]) { if (!(flag_ice_level | counter_global_frames & 3)) { - R0_ = 4; - R1_ = 10; - SpawnNormalSpriteTurnAroundSmoke_Entry2(k); + SpawnNormalSpriteTurnAroundSmoke_Entry2(k, 4, 10); } } } -void SpawnNormalSpriteTurnAroundSmoke_Entry2(uint8 k) { // 018063 +void SpawnNormalSpriteTurnAroundSmoke_Entry2(uint8 k, uint8 r0, uint8 r1) { // 018063 if (!CheckIfNormalSpriteOffScreen(k)) { uint8 j = 3; while (smoke_spr_spriteid[j]) { @@ -498,8 +765,8 @@ void SpawnNormalSpriteTurnAroundSmoke_Entry2(uint8 k) { // 018063 return; } smoke_spr_spriteid[j] = 3; - smoke_spr_xpos_lo[j] = R0_ + spr_xpos_lo[k]; - smoke_spr_ypos_lo[j] = R1_ + spr_ypos_lo[k]; + smoke_spr_xpos_lo[j] = r0 + spr_xpos_lo[k]; + smoke_spr_ypos_lo[j] = r1 + spr_ypos_lo[k]; smoke_spr_timer[j] = 19; } } @@ -528,6 +795,9 @@ uint8 CheckIfNormalSpriteOffScreen(uint8 k) { // 0180cb return spr_yoffscreen_flag[k] | spr_xoffscreen_flag[k]; } +static const uint8 kProcessNormalSpritesSpriteOAMIndexes[180] = { 0x30, 0x44, 0x58, 0x6c, 0x80, 0x94, 0xa8, 0xbc, 0xd0, 0xe4, 0x28, 0x2c, 0x80, 0x94, 0xa8, 0xbc, 0xd0, 0xe4, 0x30, 0x58, 0x0, 0x0, 0x28, 0x2c, 0x30, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb4, 0x0, 0x0, 0x28, 0x2c, 0x30, 0x54, 0x78, 0x8c, 0xa0, 0xb4, 0xc8, 0xdc, 0xf0, 0xf8, 0x28, 0x2c, 0x30, 0x74, 0x88, 0x9c, 0xb0, 0xc4, 0xd8, 0xec, 0xf8, 0xfc, 0x28, 0x2c, 0x30, 0x84, 0xd8, 0xe0, 0xe8, 0xf0, 0xf8, 0x0, 0x0, 0x0, 0x28, 0x2c, 0x0, 0x60, 0x74, 0x88, 0x9c, 0xb0, 0xc4, 0x0, 0x0, 0x0, 0x28, 0x2c, 0x30, 0x44, 0x58, 0x6c, 0x80, 0x94, 0xa8, 0x0, 0x0, 0x0, 0x28, 0x2c, 0xa0, 0x30, 0x34, 0x38, 0x3c, 0x40, 0x44, 0x48, 0x4c, 0x50, 0x28, 0x2c, 0x30, 0x48, 0x60, 0x78, 0x8c, 0xa0, 0xb4, 0xc8, 0xdc, 0x0, 0x28, 0x2c, 0x58, 0xac, 0xc0, 0xd4, 0xe8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28, 0x2c, 0x58, 0x6c, 0x80, 0x94, 0xa8, 0xbc, 0xd0, 0xe4, 0x0, 0x0, 0x28, 0x2c, 0x30, 0x74, 0xb8, 0xc4, 0xd0, 0xdc, 0xe8, 0xf4, 0x0, 0x0, 0x28, 0x2c, 0x30, 0x48, 0x60, 0x78, 0x90, 0xa8, 0xc0, 0xd8, 0x0, 0x0, 0x28, 0x2c, 0x30, 0x44, 0x58, 0x5c, 0x60, 0x64, 0x68, 0x6c, 0x70, 0x0, 0x28, 0x2c, }; +static const uint8 kProcessNormalSprites_DATA_07F0B4[20] = { 0x0, 0xc, 0x18, 0x24, 0x30, 0x3c, 0x0, 0x48, 0x54, 0x60, 0x6c, 0x78, 0x84, 0x90, 0x9c, 0x0, 0xa8, 0xc, 0x0, 0xb4, }; + void ProcessNormalSprites_GetNormalSpriteOAMIndexAndDecrementTimers(uint8 k) { // 0180d2 spr_oamindex[k] = kProcessNormalSpritesSpriteOAMIndexes[(uint8)(kProcessNormalSprites_DATA_07F0B4[sprites_sprite_memory_setting] + k)]; @@ -939,12 +1209,13 @@ void SprXXX_Generic_JumpOverKickedObject(uint8 k) { // 018898 uint8 v1 = 9; while (1) { if (spr_current_status[v1] == 10) { - SetHiLo(&R8_, &R0_, GetSprXPos(v1) - 26); - R2_ = 68; - SetHiLo(&R9_, &R1_, GetSprYPos(v1)); - R3_ = 16; - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + SetHiLo(&ci.r8, &ci.r0, GetSprXPos(v1) - 26); + ci.r2 = 68; + SetHiLo(&ci.r9, &ci.r1, GetSprYPos(v1)); + ci.r3 = 16; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (CheckNormalSpriteLevelColl_Floor(k)) break; } @@ -1045,12 +1316,12 @@ void SprXXX_Generic_018952(uint8 k) { // 018952 } if (!CheckNormalSpriteLevelColl_Floor(k)) goto LABEL_43; - R0_ = flag_ice_level ? 1 : 2; + uint8 r0 = flag_ice_level ? 1 : 2; uint8 v10 = spr_xspeed[v8]; if (v10 >= 2) { if ((int8)(v10 - 2) < 0) - v10 += 2 * R0_; - uint8 v11 = v10 - R0_; + v10 += 2 * r0; + uint8 v11 = v10 - r0; spr_xspeed[v8] = v11; spr_xspeed[k] = v11; SpawnNormalSpriteTurnAroundSmoke(k); @@ -1074,9 +1345,10 @@ void SprXXX_Generic_018952(uint8 k) { // 018952 } else if (spr_decrementing_table1558[k] == 1) { uint8 v13 = spr_table1594[k]; if (spr_current_status[v13] >= 8 && (spr_yspeed[v13] & 0x80) == 0 && spr_spriteid[v13] != 33) { - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(v13); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(v13, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { SubOffscreen_Bank01_EraseSprite(k); uint8 v14 = spr_table1594[k]; spr_decrementing_table1558[v14] = 16; @@ -1095,12 +1367,12 @@ void SprXXX_Generic_018952(uint8 k) { // 018952 uint8 v4 = 2; if (flag_ice_level) v4 = 1; - R0_ = v4; + uint8 r0 = v4; uint8 v5 = spr_xspeed[k]; if (v5 >= 2) { if ((int8)(v5 - 2) < 0) - v5 += R0_ + R0_; - spr_xspeed[k] = v5 - R0_; + v5 += r0 + r0; + spr_xspeed[k] = v5 - r0; SpawnNormalSpriteTurnAroundSmoke(k); LABEL_23: spr_table1570[k] = 0; @@ -1361,27 +1633,29 @@ void SetXSpeedBasedOnNormalSpriteFacingDirection(uint8 k) { // 018dbb } void Spr010_ParaGoomba_GoombaWingDraw(uint8 k) { // 018de9 - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R5_ = spr_table1602[k] + ((spr_table1570[k] >> 2) & 2); - R2_ = 2 * R5_; - R4_ = spr_table157c[k]; + uint8 r5 = spr_table1602[k] + ((spr_table1570[k] >> 2) & 2); + uint8 r2 = 2 * r5; + uint8 r4 = spr_table157c[k]; uint8 v1 = spr_oamindex[k]; for (int8 i = 1; i >= 0; i--) { - R3_ = i; - uint8 v3 = R2_ + i; - uint8 v8 = R2_ + i; - if (!R4_) + uint8 r3 = i; + uint8 v3 = r2 + i; + uint8 v8 = r2 + i; + if (!r4) v3 += 8; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = kSpr010_ParaGoomba_WingXDisp[v3] + R0_; - oam[64].ypos = kSpr010_ParaGoomba_WingYDisp[v8] + R1_; - int v5 = R5_; - oam[64].charnum = kSpr010_ParaGoomba_WingTiles[R5_]; + oam[64].xpos = kSpr010_ParaGoomba_WingXDisp[v3] + drt.x; + oam[64].ypos = kSpr010_ParaGoomba_WingYDisp[v8] + drt.y; + int v5 = r5; + oam[64].charnum = kSpr010_ParaGoomba_WingTiles[r5]; sprites_oamtile_size_buffer[(v1 >> 2) + 64] = kSpr010_ParaGoomba_WingTileSize[v5]; - uint8 v6 = R3_; - uint8 v7 = kSpr010_ParaGoomba_WingProp[R3_]; - if (!(R4_ & 1)) + uint8 v6 = r3; + uint8 v7 = kSpr010_ParaGoomba_WingProp[r3]; + if (!(r4 & 1)) v7 ^= 0x40; get_OamEnt(oam_buf, v1)[64].flags = sprites_tile_priority | v7; v1 += 8; @@ -1415,10 +1689,10 @@ void Spr01A_ClassicPiranhaPlant(uint8 k) { // 018e76 spr_yspeed[k] = v2; UpdateNormalSpritePosition_Y(k); } else { - R0_ = spr_table00c2[k] & 3; - if (R0_ || (CheckPlayerPositionRelativeToSprite_Bank01_X(k), spr_table1594[k] = 1, (uint8)(R15_ + 0x1b) >= 0x37)) { + uint8 r0 = spr_table00c2[k] & 3; + if (r0 || (CheckPlayerPositionRelativeToSprite_Bank01_X(k), spr_table1594[k] = 1, (uint8)(player_current_xpos - GetSprXPos(k) + 0x1b) >= 0x37)) { spr_table1594[k] = 0; - spr_decrementing_table1540[k] = kSprXXX_RegularPiranhaPlant_PhaseTimers[R0_]; + spr_decrementing_table1540[k] = kSprXXX_RegularPiranhaPlant_PhaseTimers[r0]; ++spr_table00c2[k]; } } @@ -1596,6 +1870,7 @@ void HandleNormalSpriteLevelCollision(uint8 k) { // 019140 void HandleNormalSpriteLevelColl_019211(uint8 k) { // 019211 uint8 v3; + PointU16 pt; if (sprites_sprite_buoyancy_settings) { uint8 v1 = flag_underwater_level; @@ -1604,7 +1879,7 @@ void HandleNormalSpriteLevelColl_019211(uint8 k) { // 019211 spr_table164a[k] = v1; goto LABEL_14; } - if (HandleNormalSpriteLevelColl_01944D(k, 0x3C)) { + if (HandleNormalSpriteLevelColl_01944D(k, 0x3C, &pt)) { if (blocks_currently_processed_map16_tile_lo < 0x6E) goto LABEL_14; int8 v2 = CheckWaterSlope(blocks_currently_processed_map16_tile_lo) & 1; @@ -1621,8 +1896,10 @@ LABEL_8:; v1 = spr_table164a[k] | 1; if (v4 == 4) { int8 v6 = spr_table164a[k] | 1; - if (spr_spriteid[k] == 53 || (spr_property_bits167a[k] & 2) == 0) - HandleNormalSpriteLevelColl_019330(k); + if (spr_spriteid[k] == 53 || (spr_property_bits167a[k] & 2) == 0) { + spr_current_status[k] = 5; + spr_decrementing_table1558[k] = 64; + } v1 = v6 | 0x80; } goto LABEL_13; @@ -1643,12 +1920,13 @@ LABEL_8:; } void HandleNormalSpriteLevelColl_01928E(uint8 k, uint8 a) { // 01928e - a &= 1; + uint8 r15 = a & 1; + PointU16 pt; - sprites_map16_tile_touched_horiz_hi = HandleNormalSpriteLevelColl_019441(k, a); + sprites_map16_tile_touched_horiz_hi = HandleNormalSpriteLevelColl_019441(k, r15, &pt); if (sprites_map16_tile_touched_horiz_hi) { if (blocks_currently_processed_map16_tile_lo >= 0x11 && blocks_currently_processed_map16_tile_lo < 0x6E) { - HandleNormalSpriteLevelColl_019425(k); + HandleNormalSpriteLevelColl_019425(k, pt.x, pt.y, r15); blocks_copy_of_currently_processed_map16_tile_lo2 = blocks_currently_processed_map16_tile_lo; if (misc_scratch7e185e) spr_table1588[k] |= 0x40; @@ -1658,24 +1936,26 @@ void HandleNormalSpriteLevelColl_01928E(uint8 k, uint8 a) { // 01928e } void HandleNormalSpriteLevelColl_0192C9(uint8 k) { // 0192c9 - uint8 v1 = ((spr_yspeed[k] & 0x80) != 0) ? 3 : 2; - sprites_map16_tile_being_touched_vertically_hi = HandleNormalSpriteLevelColl_019441(k, v1); + PointU16 pt; + uint8 r15 = ((spr_yspeed[k] & 0x80) != 0) ? 3 : 2; + sprites_map16_tile_being_touched_vertically_hi = HandleNormalSpriteLevelColl_019441(k, r15, &pt); sprites_map16_tile_touched_vert_lo = blocks_currently_processed_map16_tile_lo; if (sprites_map16_tile_being_touched_vertically_hi) { uint8 v2 = blocks_currently_processed_map16_tile_lo; - if (v1 == 2) { + if (r15 == 2) { if (blocks_currently_processed_map16_tile_lo >= 0x59 && blocks_currently_processed_map16_tile_lo < 0x5C && (misc_level_tileset_setting == 14 || misc_level_tileset_setting == 3) && (spr_spriteid[k] == 53 || (v2 = spr_property_bits167a[k] & 2) == 0)) { - HandleNormalSpriteLevelColl_019330(k); + spr_current_status[k] = 5; + spr_decrementing_table1558[k] = 64; } else { - HandleNormalSpriteLevelColl_01933B(k, v2); + HandleNormalSpriteLevelColl_01933B(k, v2, pt.x, pt.y, r15); } } else if (blocks_currently_processed_map16_tile_lo >= 0x11 && (blocks_currently_processed_map16_tile_lo < 0x6E || blocks_currently_processed_map16_tile_lo >= blocks_lowest_number_solid_map16_tile_for_sprites && blocks_currently_processed_map16_tile_lo < blocks_highest_number_solid_map16_tile_for_sprites)) { - HandleNormalSpriteLevelColl_019425(k); + HandleNormalSpriteLevelColl_019425(k, pt.x, pt.y, r15); blocks_copy_of_currently_processed_map16_tile_lo1 = blocks_currently_processed_map16_tile_lo; if (misc_scratch7e185e) spr_table1588[k] |= 0x20; @@ -1683,25 +1963,21 @@ void HandleNormalSpriteLevelColl_0192C9(uint8 k) { // 0192c9 } } -void HandleNormalSpriteLevelColl_019330(uint8 k) { // 019330 - spr_current_status[k] = 5; - spr_decrementing_table1558[k] = 64; -} - -void HandleNormalSpriteLevelColl_01933B(uint8 k, uint8 a) { // 01933b +void HandleNormalSpriteLevelColl_01933B(uint8 k, uint8 a, uint8 r10, uint8 r12, uint8 r15) { // 01933b if (a < 0x11) { - if ((R12_ & 0xF) >= 5) + if ((r12 & 0xF) >= 5) return; } else if (a >= 0x6E) { if (a >= 0xD8) goto LABEL_18; - uint8 v2 = CheckWhatSlopeSpriteIsOn(a); - uint8 *v3 = IndirPtr(&R5_, v2); + uint8 r8_slope_type; + uint8 v2 = CheckWhatSlopeSpriteIsOn(a, r10, r12, &r8_slope_type); + uint8 *v3 = IndirPtr(&R5_slopeptr, v2); if (*v3 == 16) return; if (*v3 >= 0x10) { LABEL_18: - if ((R12_ & 0xF) < 5) { + if ((r12 & 0xF) < 5) { uint8 v6 = spr_current_status[k]; if (v6 != 2 && v6 != 5 && v6 != 11) { AddSprYPos(k, -1); @@ -1710,11 +1986,11 @@ void HandleNormalSpriteLevelColl_01933B(uint8 k, uint8 a) { // 01933b } return; } - uint8 v4 = R0_; - if (R0_ < 0xC && v4 < *IndirPtr(&R5_, v2)) + uint8 v4 = r12 & 0xf; + if (v4 < 0xC && v4 < *v3) return; - sprites_distance_to_snap_down_to_nearest_tile = *IndirPtr(&R5_, v2); - uint8 v5 = kSlopeDataTables_SlopeType[R8_]; + sprites_distance_to_snap_down_to_nearest_tile = *v3; + uint8 v5 = kSlopeDataTables_SlopeType[r8_slope_type]; spr_slope_surface_its_on[k] = v5; if (v5 == 4 || v5 == 0xFC) { if (((spr_xspeed[k] ^ v5) & 0x80) != 0 && spr_xspeed[k]) @@ -1724,7 +2000,7 @@ void HandleNormalSpriteLevelColl_01933B(uint8 k, uint8 a) { // 01933b } if ((spr_property_bits1686[k] & 4) != 0) { LABEL_35: - HandleNormalSpriteLevelColl_019435(k); + spr_table1588[k] |= kHandleNormalSpriteLevelColl_DATA_019134[r15]; if (misc_scratch7e185e) spr_table1588[k] |= 0x80; return; @@ -1743,39 +2019,33 @@ void HandleNormalSpriteLevelColl_01933B(uint8 k, uint8 a) { // 01933b } } -void HandleNormalSpriteLevelColl_019425(uint8 k) { // 019425 - blocks_xpos = __PAIR16__(R11_, R10_); - blocks_ypos = __PAIR16__(R13_, R12_); - HandleNormalSpriteLevelColl_019435(k); -} - -void HandleNormalSpriteLevelColl_019435(uint8 k) { // 019435 - spr_table1588[k] |= kHandleNormalSpriteLevelColl_DATA_019134[R15_]; +void HandleNormalSpriteLevelColl_019425(uint8 k, uint16 xpos_r10w, uint16 ypos_r12w, uint8 r15) { // 019425 + blocks_xpos = xpos_r10w; + blocks_ypos = ypos_r12w; + spr_table1588[k] |= kHandleNormalSpriteLevelColl_DATA_019134[r15]; } -uint8 HandleNormalSpriteLevelColl_019441(uint8 k, uint8 j) { // 019441 - R15_ = j; - return HandleNormalSpriteLevelColl_01944D(k, j + 4 * (spr_property_bits1656[k] & 0xF)); +uint8 HandleNormalSpriteLevelColl_019441(uint8 k, uint8 j, PointU16 *pt_out) { // 019441 + return HandleNormalSpriteLevelColl_01944D(k, j + 4 * (spr_property_bits1656[k] & 0xF), pt_out); } -uint8 HandleNormalSpriteLevelColl_01944D(uint8 k, uint8 j) { // 01944d +uint8 HandleNormalSpriteLevelColl_01944D(uint8 k, uint8 j, PointU16 *pt_out) { // 01944d if ((misc_level_layout_flags & (uint8)(misc_scratch7e185e + 1)) != 0) { uint16 ypos = GetSprYPos(k) + kHandleNormalSpriteLevelColl_SpriteObjClippingY[j]; - R12_ = ypos; - R0_ = ypos & 0xF0; + pt_out->y = ypos; + uint8 r0 = ypos & 0xF0; if ((ypos >> 8) < misc_screens_in_lvl) { - R13_ = (ypos >> 8); - R10_W = GetSprXPos(k) + kHandleNormalSpriteLevelColl_SpriteObjClippingX[j]; - if (R11_ < 2) { - R0_ |= R10_ >> 4; - uint8 v4 = kLevelDataLayoutTables_EightBitLo_Vertical[R13_]; - uint8 v5 = kLevelDataLayoutTables_EightBitHi_Vertical[R13_]; + uint8 r13 = (ypos >> 8); + pt_out->x = GetSprXPos(k) + kHandleNormalSpriteLevelColl_SpriteObjClippingX[j]; + if ((pt_out->x >> 8) < 2) { + r0 |= (uint8)pt_out->x >> 4; + uint8 v4 = kLevelDataLayoutTables_EightBitLo_Vertical[r13]; + uint8 v5 = kLevelDataLayoutTables_EightBitHi_Vertical[r13]; if (misc_scratch7e185e) { - v4 = kLevelDataLayoutTables_EightBitLo_Vertical_L2[R13_]; - v5 = kLevelDataLayoutTables_EightBitHi_Vertical_L2[R13_]; + v4 = kLevelDataLayoutTables_EightBitLo_Vertical[r13 + 14]; + v5 = kLevelDataLayoutTables_EightBitHi_Vertical[r13 + 14]; } - R5_W = PAIR16(R11_, R0_) + PAIR16(v5, v4); - return HandleNormalSpriteLevelColl_019523(R13_); + return HandleNormalSpriteLevelColl_019523(PAIR16(pt_out->x >> 8, r0) + PAIR16(v5, v4)); } } LABEL_9: @@ -1783,27 +2053,25 @@ uint8 HandleNormalSpriteLevelColl_01944D(uint8 k, uint8 j) { // 01944d sprites_distance_to_snap_down_to_nearest_tile = 0; return 0; } - R12_W = GetSprYPos(k) + kHandleNormalSpriteLevelColl_SpriteObjClippingY[j]; - if (R12_W >= 0x1B0) + uint16 r12w = GetSprYPos(k) + kHandleNormalSpriteLevelColl_SpriteObjClippingY[j]; + pt_out->y = r12w; + if (r12w >= 0x1B0) goto LABEL_9; - R10_W = GetSprXPos(k) + kHandleNormalSpriteLevelColl_SpriteObjClippingX[j]; - if ((int8)R11_ < 0 || (uint8)R11_ >= misc_screens_in_lvl) + pt_out->x = GetSprXPos(k) + kHandleNormalSpriteLevelColl_SpriteObjClippingX[j]; + int xx = pt_out->x >> 8; + if ((int8)xx < 0 || (uint8)xx >= misc_screens_in_lvl) goto LABEL_9; - R0_ = (R12_ & 0xF0) | (R10_ >> 4); - uint16 v10 = PAIR16(kLevelDataLayoutTables_EightBitHi[R11_], kLevelDataLayoutTables_EightBitLo[R11_]); + uint8 r0 = (r12w & 0xF0) | ((uint8)pt_out->x >> 4); + uint16 v10 = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[xx], kLevelDataLayoutTables_EightBitLo_Horizontal[xx]); if (misc_scratch7e185e) { - v10 = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal_L2[R11_], kLevelDataLayoutTables_EightBitLo_Horizontal_L2[R11_]); + v10 = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[xx + 16], kLevelDataLayoutTables_EightBitLo_Horizontal[xx + 16]); } - R5_W = PAIR16(R13_, R0_) + v10; - return HandleNormalSpriteLevelColl_019523(R11_); + return HandleNormalSpriteLevelColl_019523(PAIR16(r12w >> 8, r0) + v10); } -uint8 HandleNormalSpriteLevelColl_019523(uint8 k) { // 019523 - R7_ = 126; - blocks_currently_processed_map16_tile_lo = *IndirPtr(&R5_, 0); - ++R7_; - uint8 *v1 = IndirPtr(&R5_, 0); - return ModifyMap16IDForSpecialBlocks(*v1); +uint8 HandleNormalSpriteLevelColl_019523(uint16 r5) { // 019523 + blocks_currently_processed_map16_tile_lo = g_ram[r5]; + return ModifyMap16IDForSpecialBlocks(g_ram[r5+0x10000]); } void SprStatus09_Stunned(uint8 k) { // 01953c @@ -1927,11 +2195,11 @@ void SprStatus09_Stunned_019624(uint8 k) { // 019624 if (v7 == 1) { uint8 v9 = CheckPlayerPositionRelativeToSprite_Bank01_X(k); uint8 v10 = kSprStatus09_Stunned_DATA_0197AD[v9]; - R0_ = v9; + uint8 r0 = v9; spr_xspeed[j] = v10; - uint8 v11 = R0_ ^ 1; - spr_table157c[j] = R0_ ^ 1; - R1_ = v11; + uint8 v11 = r0 ^ 1; + spr_table157c[j] = r0 ^ 1; + uint8 r1 = v11; spr_decrementing_table154c[j] = 16; spr_table1528[j] = 16; if (spr_spriteid[k] == 7) { @@ -1946,7 +2214,7 @@ void SprStatus09_Stunned_019624(uint8 k) { // 019624 SetSprYPos(v12, GetSprYPos(k)); InitializeNormalSpriteRAMTables(v12); spr_yspeed[v12] = -48; - spr_table157c[v12] = R1_; + spr_table157c[v12] = r1; spr_decrementing_table154c[v12] = 32; } } else { @@ -2023,12 +2291,12 @@ LABEL_8:; oam[66].xpos = xpos; } if (spr_spriteid[k] != 17 && !CheckIfNormalSpriteOffScreen(k)) { - R0_ = __CFSHL__(spr_table15f6[k], 1) ? 0 : 8; + uint8 r0 = __CFSHL__(spr_table15f6[k], 1) ? 0 : 8; OamEnt *v9 = get_OamEnt(oam_buf, v3); uint8 v10 = v9[66].xpos + 2; v9[64].xpos = v10; v9[65].xpos = v10 + 4; - uint8 v11 = R0_ + v9[66].ypos; + uint8 v11 = r0 + v9[66].ypos; v9[64].ypos = v11; v9[65].ypos = v11; uint8 v17 = v3; @@ -2099,7 +2367,7 @@ void SprStatus0A_Kicked(uint8 k) { // 019913 uint8 v1 = spr_slope_surface_its_on[k]; HandleNormalSpriteGravity(k); if (v1) { - R0_ = v1; + uint8 r0 = v1; if (!spr_table164a[k] && v1 != spr_slope_surface_its_on[k] && ((spr_xspeed[k] ^ v1) & 0x80) == 0) { spr_yspeed[k] = -8; LABEL_17: @@ -2300,13 +2568,13 @@ LABEL_10:; uint8 v3 = 0; if (j != 28) v3 = 0x80; - R0_ = v3; + uint8 r0 = v3; uint8 v4 = sprites_tile_priority; uint8 v6 = sprites_tile_priority; if (spr_table1632[k]) v4 = 16; sprites_tile_priority = v4; - GenericGFXRtDraw1Tile16x16_Sub(k, R0_); + GenericGFXRtDraw1Tile16x16_Sub(k, r0); sprites_tile_priority = v6; } @@ -2315,36 +2583,35 @@ void GenericGFXRtDraw4Tiles8x8Square(uint8 k, uint8 a) { // 019cf3 } void GenericGFXRtDraw4Tiles8x8Square_Entry1(uint8 k, uint8 a, uint8 j) { // 019cf5 - R5_ = a; - R15_ = j; - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + uint8 r5 = a; + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R1_ += R15_; - R2_ = kGenericSpriteOAMData_TilesOffset[spr_spriteid[k]] + __CFSHL__(2 * spr_table1602[k], 1) + 4 * spr_table1602[k]; - R3_ = sprites_tile_priority | spr_table15f6[k]; + drt.y += j; + uint8 r2 = kGenericSpriteOAMData_TilesOffset[spr_spriteid[k]] + __CFSHL__(2 * spr_table1602[k], 1) + 4 * spr_table1602[k]; + uint8 r3 = sprites_tile_priority | spr_table15f6[k]; uint8 v3 = spr_oamindex[k]; - R4_ = 3; + uint8 r4 = 3; do { - uint8 v4 = R4_; + uint8 v4 = r4; OamEnt *oam = get_OamEnt(oam_buf, v3); - oam[64].xpos = kGenericSpriteOAMData_XDisp[R4_] + R0_; - oam[64].ypos = kGenericSpriteOAMData_YDisp[v4] + R1_; - oam[64].charnum = *((uint8 *)kGenericSpriteOAMData_Tiles + (uint8)(R4_ + R2_)); - oam[64].flags = R3_ | kGenericSpriteOAMData_Prop[(uint8)(R4_ + __CFSHL__(2 * R5_, 1) + 4 * R5_)]; + oam[64].xpos = kGenericSpriteOAMData_XDisp[r4] + drt.x; + oam[64].ypos = kGenericSpriteOAMData_YDisp[v4] + drt.y; + oam[64].charnum = *((uint8 *)kGenericSpriteOAMData_Tiles + (uint8)(r4 + r2)); + oam[64].flags = r3 | kGenericSpriteOAMData_Prop[(uint8)(r4 + 4 * r5)]; v3 += 4; - --R4_; - } while ((R4_ & 0x80) == 0); + } while ((--r4 & 0x80) == 0); FinishOAMWrite(k, 0, 3); } void GenericGFXRtDraw2Tiles16x16sStacked_Sub(uint8 k) { // 019d67 - uint8 drt; + GetDrawInfoRes drt; if ((spr_table15f6[k] & 0x80) == 0) { - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_table157c[k]; - uint8 v2 = drt; + uint8 r2 = spr_table157c[k]; + uint8 v2 = drt.idx; uint8 v3 = spr_spriteid[k]; if (v3 < 0xF) v2 += (v3 >= 0xF) + 4; @@ -2354,19 +2621,18 @@ void GenericGFXRtDraw2Tiles16x16sStacked_Sub(uint8 k) { // 019d67 oam[64].charnum = *((uint8 *)kGenericSpriteOAMData_Tiles + v5); oam[65].charnum = *((uint8 *)kGenericSpriteOAMData_Tiles + v5 + 1); uint8 v7 = spr_current_slotid; - uint8 v8 = R1_; - oam[64].ypos = R1_; - oam[65].ypos = v8 + 16; - GenericGFXRtDraw2Tiles16x16sStacked_019DA9(v7, v4); + oam[64].ypos = drt.y; + oam[65].ypos = drt.y + 16; + GenericGFXRtDraw2Tiles16x16sStacked_019DA9(v7, v4, drt.x); } else { GenericGFXRtDraw2Tiles16x16sStacked_UpsideDown(k); } } -void GenericGFXRtDraw2Tiles16x16sStacked_019DA9(uint8 k, uint8 j) { // 019da9 - uint8 v2 = R0_; +void GenericGFXRtDraw2Tiles16x16sStacked_019DA9(uint8 k, uint8 j, uint8 r0) { // 019da9 + uint8 v2 = r0; OamEnt *oam = get_OamEnt(oam_buf, j); - oam[64].xpos = R0_; + oam[64].xpos = r0; oam[65].xpos = v2; uint8 v4 = sprites_tile_priority | spr_table15f6[k]; if (!(spr_table157c[k] & 1)) @@ -2381,20 +2647,19 @@ void GenericGFXRtDraw2Tiles16x16sStacked_019DA9(uint8 k, uint8 j) { // 019da9 } void GenericGFXRtDraw2Tiles16x16sStacked_UpsideDown(uint8 k) { // 019dd9 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_table157c[k]; + uint8 r2 = spr_table157c[k]; uint8 v2 = kGenericSpriteOAMData_TilesOffset[spr_spriteid[k]] + 2 * spr_table1602[k]; - OamEnt *oam = get_OamEnt(oam_buf, (uint8)(drt + 8)); + OamEnt *oam = get_OamEnt(oam_buf, (uint8)(drt.idx + 8)); oam[65].charnum = *((uint8 *)kGenericSpriteOAMData_Tiles + v2); oam[64].charnum = *((uint8 *)kGenericSpriteOAMData_Tiles + v2 + 1); uint8 v4 = spr_current_slotid; - uint8 v5 = R1_; - oam[64].ypos = R1_; - oam[65].ypos = v5 + 16; - GenericGFXRtDraw2Tiles16x16sStacked_019DA9(v4, drt + 8); + oam[64].ypos = drt.y; + oam[65].ypos = drt.y + 16; + GenericGFXRtDraw2Tiles16x16sStacked_019DA9(v4, drt.idx + 8, drt.x); } void DrawWingTiles_ParaKoopaEntry(uint8 k) { // 019e28 @@ -2405,23 +2670,22 @@ void DrawWingTiles_ParaKoopaEntry(uint8 k) { // 019e28 } void DrawWingTiles_019E35(uint8 k, uint8 j) { // 019e35 - R2_ = j; - DrawWingTiles_019E37(k); + uint8 r2 = j; + DrawWingTiles_019E37(k, r2); } -void DrawWingTiles_019E37(uint8 k) { // 019e37 +void DrawWingTiles_019E37(uint8 k, uint8 r2) { // 019e37 if (!spr_yoffscreen_flag[k]) { - SetHiLo(&R4_, &R0_, GetSprXPos(k)); - R1_ = spr_ypos_lo[k]; + uint16 xpos = GetSprXPos(k); + uint8 r1 = spr_ypos_lo[k]; uint8 v1 = spr_oamindex[k]; - uint8 v2 = R2_ + 2 * spr_table157c[k]; - uint16 t = PAIR16(R4_, R0_) + PAIR16(kDrawWingTiles_XDispHi[v2], kDrawWingTiles_XDispLo[v2]); - R0_ = t; + uint8 v2 = r2 + 2 * spr_table157c[k]; + uint16 t = xpos + PAIR16(kDrawWingTiles_XDispHi[v2], kDrawWingTiles_XDispLo[v2]); OamEnt *oam = get_OamEnt(oam_buf, v1); uint16 t2 = t - mirror_current_layer1_xpos; oam[64].xpos = t2; if (t2 < 256) { - oam[64].ypos = kDrawWingTiles_YDisp[v2] + R1_ - mirror_current_layer1_ypos; + oam[64].ypos = kDrawWingTiles_YDisp[v2] + r1 - mirror_current_layer1_ypos; oam[64].charnum = kDrawWingTiles_Tiles[v2]; oam[64].flags = kDrawWingTiles_Prop[v2] | sprites_tile_priority; sprites_oamtile_size_buffer[(v1 >> 2) + 64] = kDrawWingTiles_TileSize[v2]; @@ -2436,11 +2700,12 @@ void DrawWingTiles(uint8 k) { // 019e95 uint8 v2 = spr_table157c[k]; spr_oamindex[k] = v3 + 4; spr_table157c[k] = 0; - DrawWingTiles_019E35(k, (spr_table1570[k] & 8) != 0); + uint8 r2 = (spr_table1570[k] & 8) != 0; + DrawWingTiles_019E35(k, r2); AddSprXPos(k, 4); spr_oamindex[k] += 4; spr_table157c[k] = 1; - DrawWingTiles_019E37(k); + DrawWingTiles_019E37(k, r2); spr_table157c[k] = v2; spr_oamindex[k] = v3; SetSprXPos(k, old_x); @@ -2448,30 +2713,32 @@ void DrawWingTiles(uint8 k) { // 019e95 } void GenericGFXRtDraw1Tile16x16_Sub(uint8 k, uint8 a) { // 019f09 - R4_ = a; - GenericGFXRtDraw1Tile16x16_019F0F(k); + GenericGFXRtDraw1Tile16x16_019F0F(k, a); } void GenericGFXRtDraw1Tile16x16(uint8 k) { // 019f0d - R4_ = 0; - GenericGFXRtDraw1Tile16x16_019F0F(k); + GenericGFXRtDraw1Tile16x16_019F0F(k, 0); } -void GenericGFXRtDraw1Tile16x16_019F0F(uint8 k) { // 019f0f - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) +void GenericGFXRtDraw1Tile16x16_019F0F(uint8 k, uint8 r4) { // 019f0f + GetDrawInfoRes drt; + + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_table157c[k]; + uint8 r2 = spr_table157c[k]; uint8 v1 = spr_oamindex[k]; OamEnt *oam = get_OamEnt(oam_buf, v1); + uint8 fixt = spr_spriteid[k]; + fixt = (fixt >= 84) ? 0 : fixt; oam[64].charnum = - *((uint8 *)kGenericSpriteOAMData_Tiles + (uint8)(kGenericSpriteOAMData_TilesOffset[spr_spriteid[k]] + spr_table1602[k])); + *((uint8 *)kGenericSpriteOAMData_Tiles + (uint8)(kGenericSpriteOAMData_TilesOffset[fixt] + spr_table1602[k])); uint8 v3 = spr_current_slotid; - oam[64].xpos = R0_; - oam[64].ypos = R1_; + oam[64].xpos = drt.x; + oam[64].ypos = drt.y; uint8 a = spr_table15f6[v3]; if (!(spr_table157c[k] & 1)) a ^= 0x40; - oam[64].flags = sprites_tile_priority | R4_ | a; + oam[64].flags = sprites_tile_priority | r4 | a; v1 >>= 2; sprites_oamtile_size_buffer[v1 + 64] = spr_xoffscreen_flag[v3] | 2; GenericGFXRtMoveTileOffscreenVertically(v3, v1); @@ -2564,7 +2831,6 @@ LABEL_29:; uint8 v7 = player_facing_direction + (player_riding_yoshi_flag ? 2 : 0); spr_xspeed[k] = kSprStatus0B_Carried_ShellXSpeed[v7]; if (((player_xspeed ^ spr_xspeed[k]) & 0x80) == 0) { - R0_ = 2 * player_xspeed; uint8 v9 = __CFSHL__(player_xspeed, 1) ? 0x80 : 0; spr_xspeed[k] = kSprStatus0B_Carried_ShellXSpeed[v7] + (player_xspeed >> 1) + v9; } @@ -2680,9 +2946,11 @@ void ProcessStunnedNormalSprite(uint8 k) { // 01a187 ProcessStunnedNormalSprite_StunnedBabyYoshi_01A34F(k); return; } - SetHiLo(&R8_, &R0_, GetSprXPos(k) + 8); - SetHiLo(&R9_, &R1_, GetSprYPos(k) + 8); - CheckBerryTileCollisionWithYoshiTongue(); + CollInfo ci; + SetHiLo(&ci.r8, &ci.r0, GetSprXPos(k) + 8); + SetHiLo(&ci.r9, &ci.r1, GetSprYPos(k) + 8); + + CheckBerryTileCollisionWithYoshiTongue(&ci); CheckIfBabyYoshiCanEatNormalSprite2(k); uint8 v7 = spr_decrementing_table163e[k]; if (!v7) { @@ -2765,17 +3033,17 @@ void ProcessStunnedNormalSprite_StunnedBabyYoshi_01A34F(uint8 k) { // 01a34f SetBabyYoshiDynamicGraphicsPointer(k); } -uint8 GetDrawInfo_Bank01_ReturnsTwice(uint8 k) { // 01a365 +GetDrawInfoRes GetDrawInfo_Bank01_ReturnsTwice(uint8 k) { // 01a365 spr_yoffscreen_flag[k] = 0; spr_xoffscreen_flag[k] = (uint16)(GetSprXPos(k) - mirror_current_layer1_xpos) >= 256; - R0_ = spr_xpos_lo[k] - mirror_current_layer1_xpos; - R1_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; + uint8 r0 = spr_xpos_lo[k] - mirror_current_layer1_xpos; + uint8 r1 = spr_ypos_lo[k] - mirror_current_layer1_ypos; uint16 tx = GetSprXPos(k) + 0x40 - mirror_current_layer1_xpos; spr_table15c4[k] = (tx >= 0x180); if (tx >= 0x180) { - return 0xff; + return (GetDrawInfoRes) { .idx = 0xff, .x = r0, .y = r1 }; } else { uint8 v2 = (spr_current_status[k] != 9 && (spr_property_bits190f[k] & 0x20) != 0) ? 1 : 0; do { @@ -2783,7 +3051,7 @@ uint8 GetDrawInfo_Bank01_ReturnsTwice(uint8 k) { // 01a365 if (ty >= 256) spr_yoffscreen_flag[k] |= kGetDrawInfo_DATA_01A363[v2]; } while ((--v2 & 0x80) == 0); - return spr_oamindex[k]; + return (GetDrawInfoRes) { .idx = spr_oamindex[k], .x = r0, .y = r1 }; } } @@ -2808,12 +3076,12 @@ void CheckNormalSpriteToNormalSpriteCollision(uint8 j) { // 01a40d spr_table1632[j] == (spr_table1632[k] | spr_table15d0[k] | spr_decrementing_table1564[j] | spr_decrementing_table1564[k] | (spr_property_bits1686[j] | spr_property_bits1686[k]) & 8)) { sprites_second_tracked_sprite_index = k; - R0_W = GetSprXPos(k); - R2_W = GetSprXPos(j); - if ((uint16)(R0_W - R2_W + 16) < 0x20) { - R0_W = GetSprYPos(k) + kCheckNormalSpriteToNormalSpriteColl_DATA_01A40B[(spr_property_bits1662[k] & 0xF) != 0]; - R2_W = GetSprYPos(j) + kCheckNormalSpriteToNormalSpriteColl_DATA_01A40B[(spr_property_bits1662[j] & 0xF) != 0]; - if ((uint16)(R0_W - R2_W + 12) < 0x18) + uint16 r0w = GetSprXPos(k); + uint16 r2w = GetSprXPos(j); + if ((uint16)(r0w - r2w + 16) < 0x20) { + r0w = GetSprYPos(k) + kCheckNormalSpriteToNormalSpriteColl_DATA_01A40B[(spr_property_bits1662[k] & 0xF) != 0]; + r2w = GetSprYPos(j) + kCheckNormalSpriteToNormalSpriteColl_DATA_01A40B[(spr_property_bits1662[j] & 0xF) != 0]; + if ((uint16)(r0w - r2w + 12) < 0x18) CheckNormalSpriteToNormalSpriteColl_01A4BA(k, j); } } @@ -2875,18 +3143,18 @@ void CheckNormalSpriteToNormalSpriteColl_01A4BA(uint8 k, uint8 j) { // 01a4ba } return; } -LABEL_41: - R0_ = GetSprXPos(k) >= GetSprXPos(j); +LABEL_41:; + uint8 r0 = GetSprXPos(k) >= GetSprXPos(j); if ((spr_property_bits1686[j] & 0x10) == 0) { uint8 v7 = spr_current_slotid; uint8 ka = spr_table157c[v7]; - spr_table157c[v7] = R0_; + spr_table157c[v7] = r0; if (ka != spr_table157c[v7] && !spr_decrementing_table15ac[v7]) spr_decrementing_table15ac[v7] = 8; } if ((spr_property_bits1686[k] & 0x10) == 0) { uint8 kb = spr_table157c[k]; - spr_table157c[k] = R0_ ^ 1; + spr_table157c[k] = r0 ^ 1; if (kb != spr_table157c[k] && !spr_decrementing_table15ac[k]) spr_decrementing_table15ac[k] = 8; } @@ -2995,14 +3263,14 @@ void sub_1A685(uint8 k, uint8 j) { // 01a685 } void CheckNormalSpriteToNormalSpriteColl_01A6D9(uint8 k, uint8 j) { // 01a6d9 - R0_ = j; + uint8 r0 = j; if (CheckNormalSpriteLevelColl_Floor(k) && (spr_table1588[j] & 4) != 0 && (spr_property_bits1656[k] & 0x40) != 0 && !(spr_decrementing_table1558[k] | spr_decrementing_table1558[j])) { - R2_ = 0; + uint16 r2 = 0; int8 v2 = spr_xpos_lo[k] - spr_xpos_lo[j]; if (v2 >= 0) - ++R2_; - if ((uint8)(v2 + 8) >= 0x10 && spr_table157c[k] == R2_) { + ++r2; + if ((uint8)(v2 + 8) >= 0x10 && spr_table157c[k] == r2) { if (spr_spriteid[k] == 2) { spr_decrementing_table163e[k] = 32; spr_decrementing_table1558[k] = 32; @@ -3048,11 +3316,9 @@ uint8 CheckNormalSpriteToNormalSpriteColl_01A77C_ReturnsTwice(uint8 k, uint8 j) if (spr_spriteid[k] == 2 && !spr_table187b[j]) { uint8 v2 = spr_table157c[k]; if (v2 != spr_table157c[j]) { - R1_ = j; if (!spr_table1534[k]) { spr_table1528[k] = 0; spr_decrementing_table163e[k] = 0; - R0_ = v2; SetSprXPos(j, GetSprXPos(k) + PAIR16(kCheckNormalSpriteToNormalSpriteColl_DATA_01A77A[v2], kCheckNormalSpriteToNormalSpriteColl_DATA_01A778[v2])); spr_table160e[k] = j; spr_table1534[k] = 1; @@ -3075,11 +3341,9 @@ uint8 CheckPlayerToNormalSpriteColl_ReturnNoContact() { // 01a7f5 } uint8 CheckPlayerToNormalSpriteColl_ProcessInteract(uint8 k) { // 01a7f7 - CheckPlayerPositionRelativeToSprite_Bank01_X(k); - if ((uint8)(R15_ + 80) >= 0xA0) + if ((uint8)(player_current_xpos - GetSprXPos(k) + 80) >= 0xA0) return 0; - CheckPlayerPositionRelativeToSprite_Bank01_Y(k); - if ((uint8)(R14_ + 96) >= 0xC0) + if ((uint8)(player_current_ypos - GetSprYPos(k) + 96) >= 0xC0) return 0; else return CheckPlayerToNormalSpriteColl_01A80F(k); @@ -3087,6 +3351,7 @@ uint8 CheckPlayerToNormalSpriteColl_ProcessInteract(uint8 k) { // 01a7f7 uint8 CheckPlayerToNormalSpriteColl_01A80F(uint8 k) { // 01a80f uint8 v8; + CollInfo ci; if (player_current_state) return 0; @@ -3095,9 +3360,9 @@ uint8 CheckPlayerToNormalSpriteColl_01A80F(uint8 k) { // 01a80f v2 = spr_table1632[k] ^ player_current_layer_priority; if (v2) return 0; - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (!StandardSpriteToSpriteCollisionChecks_CheckContact()) + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (!StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) return 0; if ((spr_property_bits167a[k] & 0x80) != 0) return 1; @@ -3111,11 +3376,8 @@ uint8 CheckPlayerToNormalSpriteColl_01A80F(uint8 k) { // 01a80f CheckPlayerToNormalSpriteColl_01AA42(k); return 0; } - R1_ = 20; - R0_ = 2 * R0_ + (R5_ >= 0x14); - uint8 v3 = R0_ & 1; - R0_ >>= 1; - if ((int8)(R11_ - !v3 - (((uint8)(R5_ - 20) < (uint8)player_current_ypos) + HIBYTE(player_current_ypos))) < 0 || + uint8 v3 = (ci.r5 >= 0x14); + if ((int8)(ci.r11 - !v3 - (((uint8)(ci.r5 - 20) < (uint8)player_current_ypos) + HIBYTE(player_current_ypos))) < 0 || (player_yspeed & 0x80) != 0 && (spr_property_bits190f[k] & 0x10) == 0 && !counter_consecutive_enemies_stomped || CheckNormalSpriteLevelColl_Floor(k) && !player_in_air_flag) { LABEL_27: @@ -3185,7 +3447,7 @@ LABEL_62:; CheckPlayerToNormalSpriteColl_SetStunnedTimer(k); else CheckPlayerToNormalSpriteColl_01AA0B(k); - printf("Unknown return value in carry!\n"); +// printf("Unknown return value in carry!\n"); return 0; } spr_current_status[k] = 2; @@ -3208,9 +3470,9 @@ LABEL_62:; v8 = 2; } spr_spriteid[k] = v8; - R15_ = spr_table15f6[k] & 0xE; + uint8 r15 = spr_table15f6[k] & 0xE; InitializeNormalSpriteRAMTables_YXPPCCCTAndPropertyTables(k); - spr_table15f6[k] = R15_ | spr_table15f6[k] & 0xF1; + spr_table15f6[k] = r15 | spr_table15f6[k] & 0xF1; spr_yspeed[k] = 0; uint8 v9 = spr_spriteid[k]; if (v9 == 2) @@ -3312,8 +3574,8 @@ void CheckPlayerToNormalSpriteColl_01AA42(uint8 k) { // 01aa42 player_yspeed = 0; player_in_air_flag = 0; ++misc_player_on_solid_sprite; - R0_ = player_riding_yoshi_flag ? 47 : 31; - player_ypos = GetSprYPos(k) - R0_; + uint8 r0 = player_riding_yoshi_flag ? 47 : 31; + player_ypos = GetSprYPos(k) - r0; if (spr_spriteid[k] == 62) { spr_property_bits167a[k] &= ~0x80; io_sound_ch1 = 11; @@ -3391,7 +3653,6 @@ void SpawnContactEffectFromAbove(uint8 k) { // 01ab99 } void SubOffscreen_Bank01_Entry4(uint8 k) { // 01ac21 - R3_ = 6; SubOffscreen_Bank01_01AC2D(k, 6); } @@ -3404,16 +3665,14 @@ void SubOffscreen_Bank01_Entry2(uint8 k) { // 01ac2b } void SubOffscreen_Bank01_01AC2D(uint8 k, uint8 a) { // 01ac2d - R3_ = a; - SubOffscreen_Bank01_01AC33(k); + SubOffscreen_Bank01_01AC33(k, a); } void SubOffscreen_Bank01_Entry1(uint8 k) { // 01ac31 - R3_ = 0; - SubOffscreen_Bank01_01AC33(k); + SubOffscreen_Bank01_01AC33(k, 0); } -void SubOffscreen_Bank01_01AC33(uint8 k) { // 01ac33 +void SubOffscreen_Bank01_01AC33(uint8 k, uint8 r3) { // 01ac33 if (CheckIfNormalSpriteOffScreen(k)) { if ((misc_level_layout_flags & 1) != 0) { if ((spr_property_bits167a[k] & 4) == 0 && !(counter_global_frames & 1)) { @@ -3424,8 +3683,8 @@ void SubOffscreen_Bank01_01AC33(uint8 k) { // 01ac33 if (!v4 || spr_spriteid[k] != 34 && spr_spriteid[k] != 36) { uint16 t = PAIR16(kSubOffscreen_Bank01_SpriteOffScreen1_Hi[v4], kSubOffscreen_Bank01_SpriteOffScreen1_Lo[v4]) + mirror_current_layer1_ypos - GetSprYPos(k); - R0_ = (t >> 8) ^ (v4 ? 0x80 : 0); - if ((R0_ & 0x80) != 0) + uint8 r0 = (t >> 8) ^ (v4 ? 0x80 : 0); + if ((r0 & 0x80) != 0) SubOffscreen_Bank01_EraseSprite(k); } } @@ -3435,11 +3694,11 @@ void SubOffscreen_Bank01_01AC33(uint8 k) { // 01ac33 if (!sign8((y >> 8) - 2)) { SubOffscreen_Bank01_EraseSprite(k); } else if ((spr_property_bits167a[k] & 4) == 0) { - uint8 v4 = R3_ | counter_global_frames & 1; + uint8 v4 = r3 | counter_global_frames & 1; uint16 t = PAIR16(kSubOffscreen_Bank01_SpriteOffScreen2_Hi[v4], kSubOffscreen_Bank01_SpriteOffScreen2_Lo[v4]) + mirror_current_layer1_xpos - GetSprXPos(k); - R0_ = (t >> 8) ^ (v4 & 1 ? 0x80 : 0); - if ((R0_ & 0x80) != 0) + uint8 r0 = (t >> 8) ^ (v4 & 1 ? 0x80 : 0); + if ((r0 & 0x80) != 0) SubOffscreen_Bank01_EraseSprite(k); } } @@ -3476,13 +3735,13 @@ uint8 GetRand_01AD07(uint8 j) { // 01ad07 uint8 CheckPlayerPositionRelativeToSprite_Bank01_X(uint8 k) { // 01ad30 int t = player_current_xpos - GetSprXPos(k); - R15_ = t; +// r15 = t; return sign16(t) != 0; } uint8 CheckPlayerPositionRelativeToSprite_Bank01_Y(uint8 k) { // 01ad42 int t = player_current_ypos - GetSprYPos(k); - R14_ = t; +// r14 = t; return sign16(t) != 0; } @@ -3540,8 +3799,8 @@ void Spr083_LeftFlyingBlock(uint8 k) { // 01ad6e uint8 v7 = spr_table151c[k]; if (!player_current_power_up) v7 += 4; - R5_ = kSpr083_LeftFlyingBlock_DATA_01AE88[v7]; - SpawnBounceSprite_02887D(); + uint8 r5 = kSpr083_LeftFlyingBlock_DATA_01AE88[v7]; + SpawnBounceSprite_02887D(r5); uint8 v8 = misc_scratch7e185e; int v9 = misc_scratch7e185e; spr_table1528[misc_scratch7e185e] = 1; @@ -3549,9 +3808,9 @@ void Spr083_LeftFlyingBlock(uint8 k) { // 01ad6e spr_table00c2[v8] = -1; v6 = v12; } - R0_ = kSpr083_LeftFlyingBlock_DATA_01AE7F[v6 >> 1]; + uint8 r0 = kSpr083_LeftFlyingBlock_DATA_01AE7F[v6 >> 1]; OamEnt *v10 = get_OamEnt(oam_buf, spr_oamindex[k]); - v10[64].ypos -= R0_; + v10[64].ypos -= r0; v10[64].charnum = spr_table00c2[k] ? 46 : 42; } @@ -3586,10 +3845,11 @@ void Spr026_Thwomp_Waiting(uint8 k) { // 01aec3 goto LABEL_6; if (!spr_xoffscreen_flag[k]) { spr_table157c[k] = CheckPlayerPositionRelativeToSprite_Bank01_X(k); + int xx = player_current_xpos - GetSprXPos(k); spr_table1528[k] = 0; - if ((uint8)(R15_ + 64) < 0x80) + if ((uint8)(xx + 64) < 0x80) spr_table1528[k] = 1; - if ((uint8)(R15_ + 36) < 0x50) { + if ((uint8)(xx + 36) < 0x50) { LABEL_6: spr_table1528[k] = 2; ++spr_table00c2[k]; @@ -3625,27 +3885,27 @@ void Spr026_Thwomp_Rising(uint8 k) { // 01af24 } void Spr026_Thwomp_Draw(uint8 k) { // 01af54 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_table1528[k]; + uint8 r2 = spr_table1528[k]; uint8 v2 = 3; - if (R2_) + if (r2) v2 = 4; do { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr026_Thwomp_XDisp[v2] + R0_; - oam[64].ypos = kSpr026_Thwomp_YDisp[v2] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr026_Thwomp_XDisp[v2] + drt.x; + oam[64].ypos = kSpr026_Thwomp_YDisp[v2] + drt.y; oam[64].flags = sprites_tile_priority | kSpr026_Thwomp_Prop[v2]; uint8 v4 = kSpr026_Thwomp_Tiles[v2]; if (v2 == 4) { - if (R2_ == 2) + if (r2 == 2) v4 = -54; v2 = 4; } oam[64].charnum = v4; - drt += 4; + drt.idx += 4; } while ((--v2 & 0x80) == 0); NormalSpritePlatformGFXRt_01B37E(k, 4); } @@ -3757,8 +4017,8 @@ void Spr016_VerticalCheepCheep(uint8 k) { // 01b033 } void SprXXX_FixedMovementCheepCheep_01B10A(uint8 k) { // 01b10a - R0_ = (spr_table1602[k] >> 1) ^ 1; - spr_table15f6[k] = R0_ | spr_table15f6[k] & 0xFE; + uint8 r0 = (spr_table1602[k] >> 1) ^ 1; + spr_table15f6[k] = r0 | spr_table15f6[k] & 0xFE; GenericGFXRtDraw1Tile16x16(k); SubOffscreen_Bank01_Entry1(k); spr_table15f6[k] >>= 1; @@ -3784,11 +4044,11 @@ void SpawnSparkles_GoalSphereEntry(uint8 k, uint8 a) { // 01b152 if (!(flag_sprites_locked | (uint8)(spr_yoffscreen_flag[k] | a))) { int8 v3 = (GetRand() & 0xF) - 4; uint16 x = GetSprXPos(k) + v3; - R2_ = x; + uint8 r2 = x; if ((uint16)(x - mirror_current_layer1_xpos) < 256) { uint8 v5 = (misc_random_byte2 & 0xF) - 2; // not signed? - R0_W = GetSprYPos(k) + v5; - SpawnSparkles(); + uint16 r0w = GetSprYPos(k) + v5; + SpawnSparkles(r0w, r2); } } } @@ -3921,35 +4181,35 @@ void Spr058_VerticalRockPlatform(uint8 k) { // 01b26c } void NormalSpritePlatformDraw(uint8 k) { // 01b2d1 - uint8 drt; + GetDrawInfoRes drt; if (kNormalSpritePlatformGFXRt_DATA_01B2C3[(uint8)(spr_spriteid[k] - 85)]) { - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R0_ = spr_spriteid[k] == 94; - uint8 v1 = drt; + uint8 r0 = spr_spriteid[k] == 94; + uint8 v1 = drt.idx; int8 v2 = spr_ypos_lo[k] - mirror_current_layer1_ypos; - OamEnt *oam = get_OamEnt(oam_buf, drt); + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); oam[64].ypos = v2; oam[66].ypos = v2; oam[68].ypos = v2; - if (R0_) { + if (r0) { oam[70].ypos = v2; oam[72].ypos = v2; } int8 v4 = v2 + 16; oam[65].ypos = v4; oam[67].ypos = v4; - if (R0_) { + if (r0) { oam[69].ypos = v4; oam[71].ypos = v4; } uint8 v5 = 8; - if (!R0_) + if (!r0) v5 = 4; - R1_ = v5; - R2_ = v5 - 1; - R3_ = spr_table15f6[spr_current_slotid]; + uint8 r1 = v5; + uint8 r2 = v5 - 1; + uint8 r3 = spr_table15f6[spr_current_slotid]; int8 v6 = 0; if (spr_spriteid[spr_current_slotid] < 0x5B) v6 = 9; @@ -3961,17 +4221,17 @@ void NormalSpritePlatformDraw(uint8 k) { // 01b2d1 v9[64].xpos = v7; int8 v18 = v7 + 8; v9[64].charnum = kNormalSpritePlatformGFXRt_DiagPlatTiles[v8]; - int8 v10 = R3_ | sprites_tile_priority; - if (R1_ < R2_) + int8 v10 = r3 | sprites_tile_priority; + if (r1 < r2) v10 |= 0x40; v9[64].flags = v10; v7 = v18; v1 += 4; ++v8; - } while ((--R1_ & 0x80) == 0); + } while ((--r1 & 0x80) == 0); uint8 v11 = spr_current_slotid; uint8 v12 = spr_oamindex[spr_current_slotid]; - if (!R0_) { + if (!r0) { if (spr_spriteid[spr_current_slotid] >= 0x5B) { OamEnt *v14 = get_OamEnt(oam_buf, v12); v14[68].charnum = -53; @@ -3983,7 +4243,7 @@ void NormalSpritePlatformDraw(uint8 k) { // 01b2d1 } } uint8 v15 = 8; - if (!R0_) + if (!r0) v15 = 4; NormalSpritePlatformGFXRt_01B37E(v11, v15); } else { @@ -3992,17 +4252,17 @@ void NormalSpritePlatformDraw(uint8 k) { // 01b2d1 } void NormalSpritePlatformGFXRt_DrawFlatPlatform(uint8 k) { // 01b2df - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R1_ = spr_table1602[k]; + uint8 r1 = spr_table1602[k]; int8 v2 = spr_ypos_lo[k] - mirror_current_layer1_ypos; - OamEnt *oam = get_OamEnt(oam_buf, drt); + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); oam[64].ypos = v2; oam[65].ypos = v2; oam[66].ypos = v2; - if (R1_) { + if (r1) { oam[67].ypos = v2; oam[68].ypos = v2; } @@ -4012,13 +4272,13 @@ void NormalSpritePlatformGFXRt_DrawFlatPlatform(uint8 k) { // 01b2df oam[65].xpos = v4; int8 v5 = v4 + 16; oam[66].xpos = v5; - if (R1_) { + if (r1) { int8 v6 = v5 + 16; oam[67].xpos = v6; oam[68].xpos = v6 + 16; } uint8 v7 = spr_current_slotid; - if (R1_) { + if (r1) { oam[64].charnum = -22; oam[65].charnum = -21; oam[66].charnum = -21; @@ -4037,9 +4297,9 @@ void NormalSpritePlatformGFXRt_DrawFlatPlatform(uint8 k) { // 01b2df oam[66].flags = v8; oam[67].flags = v8; oam[68].flags = v8; - if (!R1_) + if (!r1) oam[66].charnum = 98; - if (R1_) + if (r1) NormalSpritePlatformGFXRt_01B37E(v7, 4); else NormalSpritePlatformGFXRt_01B37E(v7, 2); @@ -4054,13 +4314,13 @@ uint8 SolidSpriteBlock(uint8 k) { // 01b457 if (!r) return 0; - R0_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; - if (sign8(player_on_screen_pos_y + 24 - R0_)) { + uint8 r0 = spr_ypos_lo[k] - mirror_current_layer1_ypos; + if (sign8(player_on_screen_pos_y + 24 - r0)) { if ((player_yspeed & 0x80) == 0 && (player_blocked_flags & 8) == 0) { player_yspeed = 16; misc_player_on_solid_sprite = 1; - R1_ = player_riding_yoshi_flag ? 47 : 31; - player_ypos = GetSprYPos(k) - R1_; + uint8 r1 = player_riding_yoshi_flag ? 47 : 31; + player_ypos = GetSprYPos(k) - r1; if ((player_blocked_flags & 3) == 0) player_xpos += (int8)spr_table1528[k]; return 1; @@ -4074,7 +4334,7 @@ uint8 SolidSpriteBlock(uint8 k) { // 01b457 v7 = 8; if (player_riding_yoshi_flag) v7 += 8; - if ((uint8)(player_on_screen_pos_y + v7) < R0_) + if ((uint8)(player_on_screen_pos_y + v7) < r0) return sub_1B505(k); if ((player_yspeed & 0x80) == 0) return 0; @@ -4143,9 +4403,9 @@ void SprXXX_BuoyantPlatformsAndMine_01B563(uint8 k) { // 01b563 if (sign8(spr_yspeed[k] - 64)) ++spr_yspeed[k]; if (spr_table164a[k]) { - R0_ = (spr_spriteid[k] >= 0x5D) ? -4 : -8; + uint8 r0 = (spr_spriteid[k] >= 0x5D) ? -4 : -8; uint8 v2 = spr_yspeed[k]; - if ((v2 & 0x80) == 0 || v2 >= R0_) + if ((v2 & 0x80) == 0 || v2 >= r0) spr_yspeed[k] = v2 - 2; } uint8 v10 = player_yspeed; @@ -4156,24 +4416,24 @@ void SprXXX_BuoyantPlatformsAndMine_01B563(uint8 k) { // 01b563 } else { v3 = SolidSpriteBlock(k); } - R0_ = v10; + uint8 r0 = v10; misc_scratch7e185e = 0; if (v3) { if (spr_spriteid[k] >= 0x5D) { - R0_ = player_current_power_up ? 3 : 2; - if (sign8(spr_yspeed[k] - R0_)) + r0 = player_current_power_up ? 3 : 2; + if (sign8(spr_yspeed[k] - r0)) spr_yspeed[k] += 2; } ++misc_scratch7e185e; - if (R0_ >= 0x20) - spr_yspeed[k] = R0_ >> 2; + if (r0 >= 0x20) + spr_yspeed[k] = r0 >> 2; } bool v5 = misc_scratch7e185e == spr_table151c[k]; spr_table151c[k] = misc_scratch7e185e; if (!v5 && !misc_scratch7e185e && (player_yspeed & 0x80) != 0) { - R0_ = player_current_power_up ? 8 : 6; + r0 = player_current_power_up ? 8 : 6; if (sign8(spr_yspeed[k] - 32)) - spr_yspeed[k] += R0_; + spr_yspeed[k] += r0; } if ((counter_global_frames & 1) == 0) { int8 v7 = spr_yspeed[k]; @@ -4183,7 +4443,6 @@ void SprXXX_BuoyantPlatformsAndMine_01B563(uint8 k) { // 01b563 if (misc_scratch7e185e) { v8 = player_current_power_up ? 5 : 2; } - R0_ = v8; uint16 old_y = GetSprYPos(k); SetSprYPos(k, old_y - v8); HandleNormalSpriteLevelCollision(k); @@ -4198,25 +4457,25 @@ void SprXXX_BuoyantPlatformsAndMine_01B563(uint8 k) { // 01b563 } void SprXXX_BuoyantPlatformsAndMine_SpikeBallDraw(uint8 k) { // 01b666 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 3; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSprXXX_BuoyantPlatformsAndMine_SpikeBallXDisp[i] + R0_; - oam[64].ypos = kSprXXX_BuoyantPlatformsAndMine_SpikeBallYDisp[i] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSprXXX_BuoyantPlatformsAndMine_SpikeBallXDisp[i] + drt.x; + oam[64].ypos = kSprXXX_BuoyantPlatformsAndMine_SpikeBallYDisp[i] + drt.y; oam[64].charnum = ((uint8)((counter_local_frames >> 2) & 4) >> 1) - 86; oam[64].flags = kSprXXX_BuoyantPlatformsAndMine_SpikeBallProp[i]; - drt += 4; + drt.idx += 4; } FinishOAMWrite(k, 2, 3); } void SprXXX_TurnBlockBridge_HorizontalAndVerticalTurnBlockBridgeEntry(uint8 k) { // 01b6a5 SubOffscreen_Bank01_Entry1(k); - SprXXX_TurnBlockBridge_Draw(k); - SprXXX_TurnBlockBridge_01B852(k); + uint16 t = SprXXX_TurnBlockBridge_Draw(k); + SprXXX_TurnBlockBridge_01B852(k, t); SprXXX_TurnBlockBridge_01B6B2(k); } @@ -4232,8 +4491,8 @@ void SprXXX_TurnBlockBridge_01B6B2(uint8 k) { // 01b6b2 void SprXXX_TurnBlockBridge_HorizontalTurnBlockBridgeEntry(uint8 k) { // 01b6da SubOffscreen_Bank01_Entry1(k); - SprXXX_TurnBlockBridge_Draw(k); - SprXXX_TurnBlockBridge_01B852(k); + uint16 t = SprXXX_TurnBlockBridge_Draw(k); + SprXXX_TurnBlockBridge_01B852(k, t); SprXXX_TurnBlockBridge_01B6E7(k); } @@ -4247,95 +4506,90 @@ void SprXXX_TurnBlockBridge_01B6E7(uint8 k) { // 01b6e7 } } -void SprXXX_TurnBlockBridge_Draw(uint8 k) { // 01b710 - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) - return; - R0_ = 0; - R1_ = 0; - R2_ = 0; - R3_ = 0; +uint16 SprXXX_TurnBlockBridge_Draw(uint8 k) { // 01b710 + GetDrawInfoRes drt; + + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) + return 0; + uint8 arr[4] = { 0 }; uint8 v1 = spr_table00c2[k] & 2; uint8 v2 = spr_table151c[k]; - *(&R0_ + v1) = v2; - *(&R1_ + v1) = v2 >> 1; + arr[v1] = v2; + arr[v1 + 1] = v2 >> 1; int8 v3 = spr_ypos_lo[k] - mirror_current_layer1_ypos; OamEnt *oam = get_OamEnt(oam_buf, spr_oamindex[k]); oam[68].ypos = v3; - oam[66].ypos = v3 - R2_; - oam[67].ypos = v3 - R3_; - oam[64].ypos = R2_ + v3; - oam[65].ypos = R3_ + v3; + oam[66].ypos = v3 - arr[2]; + oam[67].ypos = v3 - arr[3]; + oam[64].ypos = arr[2] + v3; + oam[65].ypos = arr[3] + v3; int8 v5 = spr_xpos_lo[k] - mirror_current_layer1_xpos; oam[68].xpos = v5; - oam[66].xpos = v5 - R0_; - oam[67].xpos = v5 - R1_; - oam[64].xpos = R0_ + v5; - oam[65].xpos = R1_ + v5; + oam[66].xpos = v5 - arr[0]; + oam[67].xpos = v5 - arr[1]; + oam[64].xpos = arr[0] + v5; + oam[65].xpos = arr[1] + v5; oam[65].charnum = 64; oam[67].charnum = 64; oam[68].charnum = 64; oam[66].charnum = 64; oam[64].charnum = 64; uint8 v6 = sprites_tile_priority; - oam[67].flags = sprites_tile_priority; + oam[67].flags = v6; oam[65].flags = v6; oam[66].flags = v6; oam[68].flags = v6; oam[64].flags = v6 | 0x60; - uint8 v8 = R0_; - uint8 v7 = R2_; NormalSpritePlatformGFXRt_01B37E(k, 4); - R2_ = v7; - R0_ = v8; + return arr[0] | arr[2] << 8; } void FinishOAMWrite(uint8 k, uint8 j, uint8 a) { // 01b7bb - R11_ = j; - R8_ = a; + uint8 r11 = j; + uint8 r8 = a; uint8 v3 = spr_oamindex[k]; - R0_W = GetSprYPos(k); - R6_ = R0_W - mirror_current_layer1_ypos; - R2_W = GetSprXPos(k); - R7_ = R2_W - mirror_current_layer1_xpos; + uint16 r0w = GetSprYPos(k); + uint8 r6 = r0w - mirror_current_layer1_ypos; + uint16 r2w = GetSprXPos(k); + uint8 r7 = r2w - mirror_current_layer1_xpos; do { uint8 v4 = v3 >> 2; - uint8 v5 = R11_; - if ((R11_ & 0x80) != 0) + uint8 v5 = r11; + if ((r11 & 0x80) != 0) v5 = sprites_oamtile_size_buffer[v4 + 64] & 2; sprites_oamtile_size_buffer[v4 + 64] = v5; OamEnt *oam = get_OamEnt(oam_buf, v3); - R4_W = R2_W + (int8)(oam[64].xpos - R7_); - if (FinishOAMWrite_01B844()) + uint16 r4w = r2w + (int8)(oam[64].xpos - r7); + if (FinishOAMWrite_01B844(r4w)) sprites_oamtile_size_buffer[(v3 >> 2) + 64] |= 1; - R9_W = R0_W + (int8)(oam[64].ypos - R6_); - if (Spr05F_BrownChainedPlatform_01C9BF()) + if (Spr05F_BrownChainedPlatform_01C9BF(r0w + (int8)(oam[64].ypos - r6))) oam[64].ypos = -16; v3 += 4; - } while ((--R8_ & 0x80) == 0); + } while ((--r8 & 0x80) == 0); } -uint8 FinishOAMWrite_01B844() { // 01b844 - return (uint16)(R4_W - mirror_current_layer1_xpos) >= 0x100; +uint8 FinishOAMWrite_01B844(uint16 r4w) { // 01b844 + return (uint16)(r4w - mirror_current_layer1_xpos) >= 0x100; } -void SprXXX_TurnBlockBridge_Return01B851() { // 01b851 - ; -} +void SprXXX_TurnBlockBridge_01B852(uint8 k, uint16 t) { // 01b852 + uint8 R0 = t; + uint8 r2 = t >> 8; + uint8 r14 = R0; + uint8 r13 = r2; -void SprXXX_TurnBlockBridge_01B852(uint8 k) { // 01b852 - if (!spr_table15c4[k] && !player_current_state && SprXXX_TurnBlockBridge_01B8FF(k) & 1) { - R2_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; - R9_ = R2_ - R13_; - if ((uint8)(player_on_screen_pos_y + 24) >= (uint8)(R2_ - R13_)) { - R2_ += R13_; + if (!spr_table15c4[k] && !player_current_state && SprXXX_TurnBlockBridge_01B8FF(k, R0, r2)) { + r2 = spr_ypos_lo[k] - mirror_current_layer1_ypos; + if ((uint8)(player_on_screen_pos_y + 24) >= (uint8)(r2 - r13)) { + r2 += r13; int8 v5 = -1; if (player_ducking_flag || !player_current_power_up) v5 = 8; - if ((uint8)(player_on_screen_pos_y + v5) < R2_) { - R0_ = R14_ + 16; + if ((uint8)(player_on_screen_pos_y + v5) < r2) { + uint8 r0 = r14 + 16; if ((uint8)(spr_xpos_lo[k] - mirror_current_layer1_xpos) >= (uint8)player_on_screen_pos_x) - R0_ = -R0_; - player_xpos = GetSprXPos(k) + (int8)R0_; + r0 = -r0; + player_xpos = GetSprXPos(k) + (int8)r0; player_xspeed = 0; } else if ((player_yspeed & 0x80) != 0) { player_yspeed = 16; @@ -4343,22 +4597,23 @@ void SprXXX_TurnBlockBridge_01B852(uint8 k) { // 01b852 } else if ((player_yspeed & 0x80) == 0) { player_yspeed = 0; misc_player_on_solid_sprite = 1; - R0_ = R13_ + (player_riding_yoshi_flag ? 47 : 31); - player_ypos = GetSprYPos(k) - R0_; + uint8 r0 = r13 + (player_riding_yoshi_flag ? 47 : 31); + player_ypos = GetSprYPos(k) - r0; player_xpos += (int8)sprites_position_disp; } } } -uint8 SprXXX_TurnBlockBridge_01B8FF(uint8 k) { // 01b8ff - R14_ = R0_; - R13_ = R2_; - SetHiLo(&R10_, &R4_, GetSprXPos(k) - R0_); - R6_ = 2 * R0_ + 16; - SetHiLo(&R11_, &R5_, GetSprYPos(k) - R2_); - R7_ = 2 * R2_ + 16; - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - return StandardSpriteToSpriteCollisionChecks_CheckContact(); +uint8 SprXXX_TurnBlockBridge_01B8FF(uint8 k, uint16 R0, uint16 r2) { // 01b8ff +// r14 = r0; +// r13 = r2; + CollInfo ci; + SetHiLo(&ci.r10, &ci.r4, GetSprXPos(k) - R0); + ci.r6 = 2 * R0 + 16; + SetHiLo(&ci.r11, &ci.r5, GetSprYPos(k) - r2); + ci.r7 = 2 * r2 + 16; + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + return StandardSpriteToSpriteCollisionChecks_CheckContact(&ci); } void SprXXX_NetKoopas_Init_HorizontalNetKoopaEntry(uint8 k) { // 01b93e @@ -4477,9 +4732,10 @@ void Spr054_ClimbingNetDoor(uint8 k) { // 01bacd sprites_player_xspeed_on_swinging_net_door = player_xpos - 16 - spr_xpos_lo[k]; } if (!(spr_decrementing_table154c[k] | spr_decrementing_table1540[k])) { - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - Spr054_ClimbingNetDoor_01BC1D(); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + Spr054_ClimbingNetDoor_01BC1D(&ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (timer_display_player_net_punch_pose == 1) spr_decrementing_table154c[k] = 6; } @@ -4493,32 +4749,32 @@ void Spr054_ClimbingNetDoor(uint8 k) { // 01bacd if (v1 == 16) player_current_layer_priority ^= 1; spr_oamindex[k] = 48; - R3_ = 48; + uint8 r3 = 48; uint8 v2 = 48; - R0_ = spr_xpos_lo[k] - mirror_current_layer1_xpos; - R1_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; - R2_ = spr_decrementing_table1540[k] >> 1; - uint8 v3 = R2_; - R6_ = kSpr054_ClimbingNetDoor_AnimationFrame[R2_]; - int8 v4 = kSpr054_ClimbingNetDoor_XDisp[R2_] + R0_; + uint8 r0 = spr_xpos_lo[k] - mirror_current_layer1_xpos; + uint8 r1 = spr_ypos_lo[k] - mirror_current_layer1_ypos; + uint8 r2 = spr_decrementing_table1540[k] >> 1; + uint8 v3 = r2; + uint8 r6 = kSpr054_ClimbingNetDoor_AnimationFrame[r2]; + int8 v4 = kSpr054_ClimbingNetDoor_XDisp[r2] + r0; OamEnt *oam = get_OamEnt(oam_buf, 0x30); oam[64].xpos = v4; oam[65].xpos = v4; oam[66].xpos = v4; - if (R6_ != 2) { - int8 v6 = R0_ + 32 - kSpr054_ClimbingNetDoor_XDisp[v3]; + if (r6 != 2) { + int8 v6 = r0 + 32 - kSpr054_ClimbingNetDoor_XDisp[v3]; oam[67].xpos = v6; oam[68].xpos = v6; oam[69].xpos = v6; - if (!R6_) { - int8 v7 = R0_ + 16; - oam[70].xpos = R0_ + 16; + if (!r6) { + int8 v7 = r0 + 16; + oam[70].xpos = r0 + 16; oam[71].xpos = v7; oam[72].xpos = v7; } } - uint8 v8 = R1_; - oam[64].ypos = R1_; + uint8 v8 = r1; + oam[64].ypos = r1; oam[67].ypos = v8; oam[70].ypos = v8; v8 += 16; @@ -4529,15 +4785,14 @@ void Spr054_ClimbingNetDoor(uint8 k) { // 01bacd oam[66].ypos = v8; oam[69].ypos = v8; oam[72].ypos = v8; - R7_ = 8; - uint8 v9 = R6_ + __CFSHL__(4 * R6_, 1) + 8 * R6_; + uint8 n = 8; + uint8 v9 = 9 * r6; do { get_OamEnt(oam_buf, v2)[64].charnum = kSpr054_ClimbingNetDoor_Tiles[v9]; v2 += 4; ++v9; - --R7_; - } while ((R7_ & 0x80) == 0); - uint8 v10 = R3_; + } while ((--n & 0x80) == 0); + uint8 v10 = r3; for (int8 i = 8; i >= 0; --i) { int8 v12 = sprites_tile_priority | 9; if ((uint8)i < 6) @@ -4547,7 +4802,7 @@ void Spr054_ClimbingNetDoor(uint8 k) { // 01bacd get_OamEnt(oam_buf, v10)[64].flags = v12; v10 += 4; } - uint8 v13 = R6_; + uint8 v13 = r6; NormalSpritePlatformGFXRt_01B37E(spr_current_slotid, 8); if (v13) { if (v13 == 2) { @@ -4562,11 +4817,11 @@ void Spr054_ClimbingNetDoor(uint8 k) { // 01bacd } } -void Spr054_ClimbingNetDoor_01BC1D() { // 01bc1d - SetHiLo(&R8_, &R0_, player_xpos); - SetHiLo(&R9_, &R1_, player_ypos); - R2_ = 16; - R3_ = 16; +void Spr054_ClimbingNetDoor_01BC1D(CollInfo *ci) { // 01bc1d + SetHiLo(&ci->r8, &ci->r0, player_xpos); + SetHiLo(&ci->r9, &ci->r1, player_ypos); + ci->r2 = 16; + ci->r3 = 16; } void Spr020_Magic(uint8 k) { // 01bc38 @@ -4610,25 +4865,25 @@ void Spr020_Magic(uint8 k) { // 01bc38 } void Spr020_Magic_Draw(uint8 k) { // 01bcf0 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R3_ = (counter_local_frames >> 1) & 0xF; - R2_ = (R3_ + 12) & 0xF; - R1_ -= 4; - R0_ -= 4; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].ypos = kSpr020_Magic_Disp[(R3_ + 12) & 0xF] + R1_; - oam[64].xpos = kSpr020_Magic_Disp[R3_] + R0_; - R2_ = (R2_ + 5) & 0xF; - oam[65].ypos = kSpr020_Magic_Disp[R2_] + R1_; - R3_ = (R3_ + 5) & 0xF; - oam[65].xpos = kSpr020_Magic_Disp[R3_] + R0_; - R2_ = (R2_ + 5) & 0xF; - oam[66].ypos = kSpr020_Magic_Disp[R2_] + R1_; - R3_ = (R3_ + 5) & 0xF; - oam[66].xpos = kSpr020_Magic_Disp[R3_] + R0_; + uint8 r3 = (counter_local_frames >> 1) & 0xF; + uint8 r2 = (r3 + 12) & 0xF; + drt.y -= 4; + drt.x -= 4; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].ypos = kSpr020_Magic_Disp[(r3 + 12) & 0xF] + drt.y; + oam[64].xpos = kSpr020_Magic_Disp[r3] + drt.x; + r2 = (r2 + 5) & 0xF; + oam[65].ypos = kSpr020_Magic_Disp[r2] + drt.y; + r3 = (r3 + 5) & 0xF; + oam[65].xpos = kSpr020_Magic_Disp[r3] + drt.x; + r2 = (r2 + 5) & 0xF; + oam[66].ypos = kSpr020_Magic_Disp[r2] + drt.y; + r3 = (r3 + 5) & 0xF; + oam[66].xpos = kSpr020_Magic_Disp[r3] + drt.x; uint8 v3 = spr_current_slotid; int8 v4 = sprites_tile_priority | spr_table15f6[spr_current_slotid]; oam[64].flags = v4; @@ -4679,8 +4934,7 @@ void Spr01F_MagiKoopa_State00_FindOpenSpace(uint8 k) { // 01bdf2 if (r < 0xD1) { SetSprYPos(k, (mirror_current_layer1_ypos + r) & ~0xf); SetSprXPos(k, (mirror_current_layer1_xpos + GetRand()) & ~0xf); - CheckPlayerPositionRelativeToSprite_Bank01_X(k); - if ((uint8)(R15_ + 32) >= 0x40) { + if ((uint8)(player_current_xpos - GetSprXPos(k) + 32) >= 0x40) { spr_yspeed[k] = 0; spr_xspeed[k] = 1; HandleNormalSpriteLevelCollision(k); @@ -4771,51 +5025,52 @@ void Spr01F_MagiKoopa_01BF1D(uint8 k) { // 01bf1d SetSprXPos(j, GetSprXPos(k)); SetSprYPos(j, GetSprYPos(k) + 10); InitializeNormalSpriteRAMTables(j); - AimTowardsPlayer_Bank01(j, 0x20); - spr_yspeed[j] = R0_; - spr_xspeed[j] = R1_; -} - -void AimTowardsPlayer_Bank01(uint8 k, uint8 a) { // 01bf6a - R1_ = a; - R2_ = CheckPlayerPositionRelativeToSprite_Bank01_Y(k); - uint8 v2 = R14_; - if ((R14_ & 0x80) != 0) - v2 = -R14_; - R12_ = v2; - R3_ = CheckPlayerPositionRelativeToSprite_Bank01_X(k); - uint8 v3 = R15_; - if ((R15_ & 0x80) != 0) - v3 = -R15_; - R13_ = v3; + PointU8 pt = AimTowardsPlayer_Bank01(j, 0x20); + spr_yspeed[j] = pt.y; + spr_xspeed[j] = pt.x; +} + +PointU8 AimTowardsPlayer_Bank01(uint8 k, uint8 a) { // 01bf6a + uint8 r1 = a; + uint8 r2 = CheckPlayerPositionRelativeToSprite_Bank01_Y(k); + uint8 v2 = player_current_ypos - GetSprYPos(k); + if ((v2 & 0x80) != 0) + v2 = -v2; + uint8 r12 = v2; + uint8 r3 = CheckPlayerPositionRelativeToSprite_Bank01_X(k); + uint8 v3 = player_current_xpos - GetSprXPos(k); + if ((v3 & 0x80) != 0) + v3 = -v3; + uint8 r13 = v3; int8 v4 = 0; - uint8 v5 = R13_; - if (R13_ < R12_) { + uint8 v5 = r13; + if (r13 < r12) { v4 = 1; - R13_ = R12_; - R12_ = v5; + r13 = r12; + r12 = v5; } - R11_ = 0; - R0_ = 0; - uint8 v6 = R1_; + uint8 r11 = 0; + uint8 r0 = 0; + uint8 v6 = r1; do { - uint8 v7 = R12_ + R11_; - if ((uint8)(R12_ + R11_) >= R13_) { - v7 -= ((uint8)(R12_ + R11_) < R13_) + R13_; - ++R0_; + uint8 v7 = r12 + r11; + if ((uint8)(r12 + r11) >= r13) { + v7 -= ((uint8)(r12 + r11) < r13) + r13; + ++r0; } - R11_ = v7; + r11 = v7; --v6; } while (v6); if (v4) { - uint8 v8 = R0_; - R0_ = R1_; - R1_ = v8; + uint8 v8 = r0; + r0 = r1; + r1 = v8; } - if (R2_) - R0_ = -R0_; - if (R3_) - R1_ = -R1_; + if (r2) + r0 = -r0; + if (r3) + r1 = -r1; + return (PointU8) {.x = r1, .y = r0 }; } bool Spr01F_MagiKoopa_01BFE3_ReturnsTwice(uint8 k) { // 01bfe3 @@ -4851,12 +5106,12 @@ void Spr01F_MagiKoopa_01C028(uint8 k) { // 01c028 unsigned int v4; uint8 v1 = 16 * (spr_table1570[k] - 1); - R0_ = 0; + uint8 r0 = 0; uint8 v2 = palettes_dynamic_palette_upload_index; do { palettes_dynamic_palette_colors[v2++] = *((uint8 *)kSpr01F_MagiKoopa_MagiKoopaFadePalettes + v1++); - ++R0_; - } while (R0_ != 16); + ++r0; + } while (r0 != 16); uint8 v3 = palettes_dynamic_palette_upload_index; v4 = palettes_dynamic_palette_upload_index; *(&palettes_dynamic_palette_bytes_to_upload + palettes_dynamic_palette_upload_index) = 16; @@ -4889,9 +5144,8 @@ void Spr07B_GoalTape(uint8 k) { // 01c098 } spr_yspeed[k] = kSpr07B_GoalTape_YSpeed[spr_table1588[k] & 1]; UpdateNormalSpritePosition_Y(k); - R0_ = spr_table00c2[k]; - R1_ = spr_table151c[k]; - if ((uint16)(player_xpos - R0_W) < 0x10 && + uint16 r0w = spr_table00c2[k] | spr_table151c[k] << 8; + if ((uint16)(player_xpos - r0w) < 0x10 && (uint8)(spr_table1534[k] & 1) >= (HIBYTE(player_ypos) + (spr_table1528[k] < LOBYTE(player_ypos)))) { flag_secret_goal_sprite = spr_table187b[k] >> 2; io_music_ch1 = 12; @@ -4914,7 +5168,7 @@ void Spr07B_GoalTape(uint8 k) { // 01c098 } void Spr07B_GoalTape_Draw(uint8 k) { // 01c12d - uint8 drt; + GetDrawInfoRes drt; if (spr_table160e[k]) { if (spr_decrementing_table1540[k]) @@ -4922,16 +5176,16 @@ void Spr07B_GoalTape_Draw(uint8 k) { // 01c12d else spr_current_status[k] = 0; } else { - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - int8 v2 = R0_ - 8; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_ - 8; + int8 v2 = drt.x - 8; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x - 8; v2 += 8; oam[65].xpos = v2; oam[66].xpos = v2 + 8; - int8 v4 = R1_ + 8; - oam[64].ypos = R1_ + 8; + int8 v4 = drt.y + 8; + oam[64].ypos = drt.y + 8; oam[65].ypos = v4; oam[66].ypos = v4; oam[64].charnum = -44; @@ -5007,8 +5261,7 @@ void Spr080_Key(uint8 k) { // 01c1f2 DrawWingTiles(k); } if (spr_table00c2[k]) { - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) - return; + GetDrawInfo_Bank01_ReturnsTwice(k); return; } PowerUpAndItemDraw(k); @@ -5278,50 +5531,50 @@ void SprXXX_PowerUps_GiveMario1Up(uint8 k) { // 01c5fe } void PowerUpAndItemDraw(uint8 k) { // 01c61a - uint8 drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R10_ = 0; + uint8 r10 = 0; if (!flag_reznor_room_oamindex_timer && misc_nmito_use_flag != 0xC1 && (misc_nmito_use_flag & 0x40) != 0) { spr_oamindex[k] = 0xD8; - drt = 0xD8; + drt.idx = 0xD8; } if (spr_spriteid[k] == 33) { PowerUpAndItemGFXRt_DrawCoinSprite(k); } else { if (spr_spriteid[k] == 118) - R10_ = kPowerUpAndItemGFXRt_StarPalValues[(counter_global_frames >> 1) & 3]; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; - oam[64].ypos = R1_ - 1; + r10 = kPowerUpAndItemGFXRt_StarPalValues[(counter_global_frames >> 1) & 3]; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; + oam[64].ypos = drt.y - 1; int8 v3 = 0; if (!(spr_table157c[k] & 1)) v3 = 64; - oam[64].flags = R10_ ^ (spr_table15f6[k] | sprites_tile_priority | v3); + oam[64].flags = r10 ^ (spr_table15f6[k] | sprites_tile_priority | v3); oam[64].charnum = kPowerUpAndItemGFXRt_PowerUpTiles[(uint8)(spr_spriteid[k] - 116)]; NormalSpritePlatformGFXRt_01B37E(spr_current_slotid, 0); } } void PowerUpAndItemGFXRt_DrawCoinSprite(uint8 k) { // 01c645 - uint8 drt; + GetDrawInfoRes drt; uint8 v3; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; - oam[64].ypos = R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; + oam[64].ypos = drt.y; oam[64].charnum = -24; oam[64].flags = sprites_tile_priority | spr_table15f6[k]; if ((((uint8)(counter_local_frames + k) >> 2) & 3) != 0) { uint8 ka = k; uint8 v4 = ((uint8)(counter_local_frames + k) >> 2) & 3; - int8 v5 = R0_ + 4; - OamEnt *v6 = get_OamEnt(oam_buf, drt); - v6[64].xpos = R0_ + 4; + int8 v5 = drt.x + 4; + OamEnt *v6 = get_OamEnt(oam_buf, drt.idx); + v6[64].xpos = drt.x + 4; v6[65].xpos = v5; - v6[65].ypos = R1_ + 8; + v6[65].ypos = drt.y + 8; uint8 v7 = kPowerUpAndItemGFXRt_DrawCoinSprite_Tiles[v4 - 1]; v6[64].charnum = v7; v6[65].charnum = v7; @@ -5390,119 +5643,105 @@ void Spr05F_BrownChainedPlatform(uint8 k) { // 01c773 uint8 v23 = spr_table1528[k]; spr_table151c[k] = -v24; spr_table1528[k] = (2 - ((v24 != 0) + spr_table1528[k])) & 1; - Spr05F_BrownChainedPlatform_01CACB(k); + CalcTiltPlatformArgs ctpa = Spr05F_BrownChainedPlatform_01CACB(k); GetSineAndCosineOfTiltingPlatform(); - CalculateCircleCoordinatesForTiltingPlaform(); + PointU16 pt = CalculateCircleCoordinatesForTiltingPlaform(ctpa); spr_table1528[k] = v23; spr_table151c[k] = v24; - sprites_position_disp = temp14b8 - spr_table00c2[k]; - spr_table00c2[k] = temp14b8; + sprites_position_disp = pt.x - spr_table00c2[k]; + spr_table00c2[k] = pt.x; OamEnt *oam = get_OamEnt(oam_buf, spr_oamindex[k]); - oam[64].ypos = temp14ba - mirror_current_layer1_ypos - 8; - oam[64].xpos = temp14b8 - mirror_current_layer1_xpos - 8; + oam[64].ypos = pt.y - mirror_current_layer1_ypos - 8; + oam[64].xpos = pt.x - mirror_current_layer1_xpos - 8; oam[64].charnum = -94; oam[64].flags = 49; uint8 v4 = 0; - uint8 v5 = temp14ba - temp14b2; - if ((int8)(temp14ba - temp14b2) < 0) { - v5 = temp14b2 - temp14ba; + uint8 v5 = pt.y - ctpa.temp14b2; + if ((int8)(pt.y - ctpa.temp14b2) < 0) { + v5 = ctpa.temp14b2 - pt.y; v4 = 1; } - R0_ = v4; - WriteReg(WRDIVH, v5); - WriteReg(WRDIVL, 0); - WriteReg(WRDIVB, 5); - R2_ = ReadReg(RDDIVL); - R6_ = R2_; - R3_ = ReadReg(RDDIVH); - R7_ = R3_; + uint8 r0 = v4; + uint16 r2w = SnesDivide(v5 << 8, 5); + uint16 r6 = r2w; uint8 v6 = 0; - uint8 v7 = temp14b8 - temp14b0; - if ((int8)(temp14b8 - temp14b0) < 0) { - v7 = temp14b0 - temp14b8; + uint8 v7 = pt.x - ctpa.temp14b0; + if ((int8)(pt.x - ctpa.temp14b0) < 0) { + v7 = ctpa.temp14b0 - pt.x; v6 = 1; } - R1_ = v6; - WriteReg(WRDIVH, v7); - WriteReg(WRDIVL, 0); - WriteReg(WRDIVB, 5); - R4_ = ReadReg(RDDIVL); - R8_ = R4_; - R5_ = ReadReg(RDDIVH); - R9_ = R5_; + uint8 r1 = v6; + uint16 r4w = SnesDivide(v7 << 8, 5); + uint16 r8w = r4w; uint8 v8 = spr_oamindex[k] + 4; - R10_ = temp14b2 - mirror_current_layer1_ypos - 8; + uint8 r10 = ctpa.temp14b2 - mirror_current_layer1_ypos - 8; OamEnt *v9 = get_OamEnt(oam_buf, v8); - v9[64].ypos = temp14b2 - mirror_current_layer1_ypos - 8; - R11_ = temp14b0 - mirror_current_layer1_xpos - 8; - v9[64].xpos = R11_; + v9[64].ypos = ctpa.temp14b2 - mirror_current_layer1_ypos - 8; + uint8 r11 = ctpa.temp14b0 - mirror_current_layer1_xpos - 8; + v9[64].xpos = r11; v9[64].charnum = -94; v9[64].flags = 49; for (int8 i = 3; i >= 0; --i) { v8 += 4; OamEnt *v12 = get_OamEnt(oam_buf, v8); - if (R0_) - v12[64].ypos = R10_ - R7_; + if (r0) + v12[64].ypos = r10 - (r6 >> 8); else - v12[64].ypos = R7_ + R10_; - R6_W += R2_W; - if (R1_) - v12[64].xpos = R11_ - R9_; + v12[64].ypos = (r6 >> 8) + r10; + r6 += r2w; + if (r1) + v12[64].xpos = r11 - (r8w >> 8); else - v12[64].xpos = R9_ + R11_; - R8_W += R4_W; + v12[64].xpos = (r8w >> 8) + r11; + r8w += r4w; v12[64].charnum = -94; v12[64].flags = 49; } for (uint8 j = 3; (j & 0x80) == 0; --j) { - R2_ = j; +// r2 = j; v8 += 4; OamEnt *v14 = get_OamEnt(oam_buf, v8); - v14[64].ypos = temp14ba - mirror_current_layer1_ypos - 16; - v14[64].xpos = kSpr05F_BrownChainedPlatform_PlatformXDisp[j] + temp14b8 - mirror_current_layer1_xpos; + v14[64].ypos = pt.y - mirror_current_layer1_ypos - 16; + v14[64].xpos = kSpr05F_BrownChainedPlatform_PlatformXDisp[j] + pt.x - mirror_current_layer1_xpos; v14[64].charnum = kSpr05F_BrownChainedPlatform_PlatformTiles[j]; v14[64].flags = 49; } - R8_ = 9; - R0_ = temp14b2 - 8; - R1_ = temp14b3 - (temp14b2 < 8); - R2_ = temp14b0 - 8; - R3_ = temp14b1 - (temp14b0 < 8); + uint8 R8 = 9; + uint16 r0w = ctpa.temp14b2 - 8; + r2w = ctpa.temp14b0 - 8; uint8 v15 = spr_oamindex[spr_current_slotid]; OamEnt *v16 = get_OamEnt(oam_buf, v15); - R6_ = v16[65].ypos; - R7_ = v16[65].xpos; + uint8 ypos = v16[65].ypos; + uint8 xpos = v16[65].xpos; + PointU16 pt2; do { sprites_oamtile_size_buffer[(v15 >> 2) + 64] = 2; int8 v17 = 0; OamEnt *v18 = get_OamEnt(oam_buf, v15); - int8 v19 = v18[64].xpos - R7_; - R4_W = R2_W + (int8)v19; - if (FinishOAMWrite_01B844() & 1) + int8 v19 = v18[64].xpos - xpos; + uint16 r4w = r2w + (int8)v19; + if (FinishOAMWrite_01B844(r4w) & 1) sprites_oamtile_size_buffer[(v15 >> 2) + 64] = 3; - int8 v21 = v18[64].ypos - R6_; - R9_W = R0_W + (int8)v21; - if (Spr05F_BrownChainedPlatform_01C9BF() & 1) + int8 v21 = v18[64].ypos - ypos; + uint16 r9 = r0w + (int8)v21; + if (Spr05F_BrownChainedPlatform_01C9BF(r9) & 1) v18[64].ypos = -16; - if (R8_ == 9) { - temp14b8 = R4_; - temp14b9 = R5_; - temp14ba = R9_; - temp14bb = R10_; + if (R8 == 9) { + pt2.x = r4w; + pt2.y = r9; } v15 += 4; - --R8_; - } while ((R8_ & 0x80) == 0); + } while ((--R8 & 0x80) == 0); uint8 v22 = spr_current_slotid; get_OamEnt(oam_buf, spr_oamindex[spr_current_slotid])[65].ypos = -16; if (!flag_sprites_locked) { Spr05F_BrownChainedPlatform_UpdateAngle(v22); - sub_1C9EC(v22); + sub_1C9EC(v22, pt2); } } -uint8 Spr05F_BrownChainedPlatform_01C9BF() { // 01c9bf - return (uint16)(*(uint16 *)&R9_ + 16 - mirror_current_layer1_ypos) >= 0x100; +uint8 Spr05F_BrownChainedPlatform_01C9BF(uint16 r9) { // 01c9bf + return (uint16)(r9 + 16 - mirror_current_layer1_ypos) >= 0x100; } void sub_1C9DA(uint8 k) { // 01c9da @@ -5517,24 +5756,24 @@ void Spr05F_BrownChainedPlatform_01C9E2(uint8 k) { // 01c9e2 spr_current_slotid = k; } -void sub_1C9EC(uint8 k) { // 01c9ec - uint16 t = __PAIR16__(temp14b9, temp14b8) - mirror_current_layer1_xpos + 16; +void sub_1C9EC(uint8 k, PointU16 pt) { // 01c9ec + uint16 t = pt.x - mirror_current_layer1_xpos + 16; uint8 v1 = flag_sprites_locked | (t >= 0x120); spr_table15c4[k] = v1; if (!v1) { - uint8 v2 = Spr05F_BrownChainedPlatform_01CA9C(k); + uint8 v2 = Spr05F_BrownChainedPlatform_01CA9C(k, pt); spr_table1602[k] = 0; if (v2 & 1) { spr_table160e[k] = 1; - R3_ = temp14ba - mirror_current_layer1_ypos; - R14_ = temp14ba - mirror_current_layer1_ypos - 8; - if ((uint8)(player_on_screen_pos_y + 24) < R14_) { + uint8 r3 = pt.y - mirror_current_layer1_ypos; + uint8 r14 = pt.y - mirror_current_layer1_ypos - 8; + if ((uint8)(player_on_screen_pos_y + 24) < r14) { if ((player_yspeed & 0x80) == 0) { player_yspeed = 0; misc_player_on_solid_sprite = 3; spr_table1602[k] = 3; - R15_ = player_riding_yoshi_flag ? 56 : 40; - player_ypos = WORD(temp14ba) - R15_; + uint8 r15 = player_riding_yoshi_flag ? 56 : 40; + player_ypos = pt.y - r15; if ((player_blocked_flags & 3) == 0) player_xpos += (int8)sprites_position_disp; Spr05F_BrownChainedPlatform_01C9E2(k); @@ -5556,143 +5795,136 @@ void sub_1C9EC(uint8 k) { // 01c9ec } } -uint8 Spr05F_BrownChainedPlatform_01CA9C(uint8 k) { // 01ca9c - SetHiLo(&R10_, &R4_, WORD(temp14b8) - 24); - R6_ = 64; - SetHiLo(&R11_, &R5_, WORD(temp14ba) - 12); - R7_ = 19; - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - return StandardSpriteToSpriteCollisionChecks_CheckContact(); +uint8 Spr05F_BrownChainedPlatform_01CA9C(uint8 k, PointU16 pt) { // 01ca9c + CollInfo ci; + SetHiLo(&ci.r10, &ci.r4, pt.x - 24); + ci.r6 = 64; + SetHiLo(&ci.r11, &ci.r5, pt.y - 12); + ci.r7 = 19; + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + return StandardSpriteToSpriteCollisionChecks_CheckContact(&ci); } -void Spr05F_BrownChainedPlatform_01CACB(uint8 k) { // 01cacb - temp14bc = 80; - temp14bf = 0; +CalcTiltPlatformArgs Spr05F_BrownChainedPlatform_01CACB(uint8 k) { // 01cacb + CalcTiltPlatformArgs rv; + rv.temp14bc = 80; + rv.temp14bf = 0; misc_rotating_object_xradius_hi = 0; - temp14c0 = 0; - WORD(temp14b4) = GetSprXPos(k); - WORD(temp14b0) = WORD(temp14b4) - 80; - WORD(temp14b6) = GetSprYPos(k); - WORD(temp14b2) = WORD(temp14b6); + rv.temp14b0 = GetSprXPos(k) - 80; + rv.temp14b2 = GetSprYPos(k); misc_m7_rotation = PAIR16(spr_table1528[k], spr_table151c[k]); + return rv; } void GetSineAndCosineOfTiltingPlatform() { // 01cb20 sprites_brown_roating_platform_angle_sign1 = HIBYTE(misc_m7_rotation); sprites_brown_rotating_platform_sine = kCircleCoordinates[(uint16)((2 * misc_m7_rotation) & 0x1FF) >> 1]; - R0_W = misc_m7_rotation + 128; + uint16 r0w = misc_m7_rotation + 128; sprites_brown_rotating_platform_cosine = kCircleCoordinates[(uint16)((2 * (misc_m7_rotation + 128)) & 0x1FF) >> 1]; - sprites_brown_roating_platform_angle_sign2 = R1_; + sprites_brown_roating_platform_angle_sign2 = r0w >> 8; } -void CalculateCircleCoordinatesForTiltingPlaform() { // 01cb53 +PointU16 CalculateCircleCoordinatesForTiltingPlaform(CalcTiltPlatformArgs inp) { // 01cb53 unsigned int v5; unsigned int v10; - R2_W = sprites_brown_rotating_platform_cosine; - R0_W = *(uint16 *)&temp14bc; - CalculateCircleCoordinatesForTiltingPlaform_01CC28(); + uint16 r2w = sprites_brown_rotating_platform_cosine; + uint16 r0w = inp.temp14bc; + uint32 out = CalculateCircleCoordinatesForTiltingPlaform_01CC28(r0w, r2w); bool sign = sprites_brown_roating_platform_angle_sign2 & 1; - uint16 v0 = R4_W; + uint16 v0 = out; if (sign) v0 = -v0; - R8_W = v0; - uint16 v1 = R6_W; + uint16 r8w = v0; + uint16 v1 = out >> 16; if (sign) v1 = -v1; - R10_W = v1; - R2_W = sprites_brown_rotating_platform_sine; - R0_W = *(uint16 *)&temp14bf; - CalculateCircleCoordinatesForTiltingPlaform_01CC28(); + uint16 r10w = v1; + r2w = sprites_brown_rotating_platform_sine; + r0w = inp.temp14bf; + out = CalculateCircleCoordinatesForTiltingPlaform_01CC28(r0w, r2w); sign = sprites_brown_roating_platform_angle_sign1 & 1; - uint16 v2 = R4_W; + uint16 v2 = out; if (sign) v2 = -v2; - R4_W = v2; - uint16 v3 = R6_W; + uint16 v3 = out >> 16; if (sign) v3 = -v3; - v5 = __PAIR32__(R10_W, R8_W) + __PAIR32__(v3, R4_W); - R4_W = v5; - R6_W = v5 >> 16; - *(uint16 *)&temp14b8 = *(uint16 *)&temp14b0 + *(uint16 *)&R5_; - R2_W = sprites_brown_rotating_platform_cosine; - R0_W = *(uint16 *)&temp14bf; - CalculateCircleCoordinatesForTiltingPlaform_01CC28(); + v5 = __PAIR32__(r10w, r8w) + __PAIR32__(v3, v2); + uint16 temp14b8_ = inp.temp14b0 + (v5 >> 8); + r2w = sprites_brown_rotating_platform_cosine; + r0w = inp.temp14bf; + out = CalculateCircleCoordinatesForTiltingPlaform_01CC28(r0w, r2w); sign = sprites_brown_roating_platform_angle_sign2 & 1; - uint16 v6 = R4_W; + uint16 v6 = out; if (sign) v6 = -v6; - R8_W = v6; - uint16 v7 = R6_W; + r8w = v6; + uint16 v7 = out >> 16; if (sign) v7 = -v7; - R10_W = v7; - R2_W = sprites_brown_rotating_platform_sine; - R0_W = *(uint16 *)&temp14bc; - CalculateCircleCoordinatesForTiltingPlaform_01CC28(); + r10w = v7; + r2w = sprites_brown_rotating_platform_sine; + r0w = inp.temp14bc; + out = CalculateCircleCoordinatesForTiltingPlaform_01CC28(r0w, r2w); sign = sprites_brown_roating_platform_angle_sign1 & 1; - uint16 v8 = R4_W; + uint16 v8 = out; if (sign) v8 = -v8; - R4_W = v8; - uint16 v9 = R6_W; + uint16 v9 = out >> 16; if (sign) v9 = -v9; - v10 = __PAIR32__(v9, R4_W) - __PAIR32__(R10_W, R8_W); - R6_W = HIWORD(v10); - R4_W = v10; - *(uint16 *)&temp14ba = *(uint16 *)&temp14b2 - *(uint16 *)&R5_; -} - -void CalculateCircleCoordinatesForTiltingPlaform_01CC28() { // 01cc28 - WriteReg(WRMPYA, R0_); - WriteReg(WRMPYB, R2_); - R4_ = ReadReg(RDMPYL); - R5_ = ReadReg(RDMPYH); - - WriteReg(WRMPYA, R0_); - WriteReg(WRMPYB, R3_); - uint16 t = R5_ + ReadReg(RDMPYL); - R5_ = t; - R6_ = (t >> 8) + ReadReg(RDMPYH); - - WriteReg(WRMPYA, R1_); - WriteReg(WRMPYB, R2_); - t = R5_ + ReadReg(RDMPYL); - R5_ = t; - R6_ += (t >> 8) + ReadReg(RDMPYH); - - WriteReg(WRMPYA, R1_); - WriteReg(WRMPYB, R3_); - t = R6_ + ReadReg(RDMPYL); - R6_ = t; - R7_ = (t >> 8) + ReadReg(RDMPYH); -} - -uint8 CheckTiltingPlatformCollision() { // 01cc9d - if (temp14b7 | temp14b5) - return 0; - CheckTiltingPlatformColl_01CCC7(); - GetSineAndCosineOfTiltingPlatform(); - CalculateCircleCoordinatesForTiltingPlaform(); - R0_ = temp14ba & 0xF0; - return sprites_cutscene_sprite_table_0AF6[temp14ba & 0xF0 | (temp14b8 >> 4)] >= 0x15; + v10 = __PAIR32__(v9, v8) - __PAIR32__(r10w, r8w); + uint16 temp14ba_ = inp.temp14b2 - (v10 >> 8); + return (PointU16) { .x = temp14b8_, .y = temp14ba_ }; } -void CheckTiltingPlatformColl_01CCC7() { // 01ccc7 - *(uint16 *)&temp14b0 = mirror_m7_center_xpos; - *(uint16 *)&temp14b2 = mirror_m7_center_ypos; - *(uint16 *)&temp14bc = *(uint16 *)&temp14b4 - mirror_m7_center_xpos; - *(uint16 *)&temp14bf = *(uint16 *)&temp14b6 - mirror_m7_center_ypos; -} +uint32 CalculateCircleCoordinatesForTiltingPlaform_01CC28(uint16 R0_W_, uint16 R2_W_) { // 01cc28 + uint8 r4, r5, r6, r7; -void CheckTiltingPlatformColl_Return01CCEA() { // 01ccea - ; + uint16 mult; + + mult = Mult8x8(R0_W_, R2_W_); + r4 = mult; + r5 = mult >> 8; + + mult = Mult8x8(R0_W_, R2_W_ >> 8); + uint16 t = r5 + (mult & 0xff); + r5 = t; + r6 = (t >> 8) + (mult >> 8); + + mult = Mult8x8(R0_W_ >> 8, R2_W_); + + t = r5 + (mult & 0xff); + r5 = t; + r6 += (t >> 8) + (mult >> 8); + + mult = Mult8x8(R0_W_ >> 8, R2_W_ >> 8); + + t = r6 + (mult & 0xff); + r6 = t; + r7 = (t >> 8) + (mult >> 8); + + return r7 << 24 | r6 << 16 | r5 << 8 | r4; } -void CheckTiltingPlatformColl_Return01CCEB() { // 01cceb - ; +CheckPlatformCollRet CheckTiltingPlatformCollision(uint16 temp14b4, uint16 temp14b6) { // 01cc9d + CheckPlatformCollRet rv = { 0 }; + if (temp14b4 >= 256 || temp14b6 >= 256) { + rv.out_of_bounds = true; + return rv; + } + CalcTiltPlatformArgs args = { + .temp14b0 = mirror_m7_center_xpos, + .temp14b2 = mirror_m7_center_ypos, + .temp14bc = temp14b4 - mirror_m7_center_xpos, + .temp14bf = temp14b6 - mirror_m7_center_ypos, + }; + GetSineAndCosineOfTiltingPlatform(); + PointU16 pt = CalculateCircleCoordinatesForTiltingPlaform(args); + rv.pt = pt; + rv.retval = sprites_cutscene_sprite_table_0AF6[pt.y & 0xF0 | (pt.x >> 4) & 0xF] >= 0x15; + return rv; } void Spr05F_BrownChainedPlatform_UpdateAngle(uint8 k) { // 01ccf0 @@ -5735,8 +5967,7 @@ void Spr029_KoopaKids_Init(uint8 k) { // 01cd2f } void Spr029_KoopaKid_MortonRoyLudwig_GetDrawInfo(uint8 k) { // 01cda7 - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) - return; + GetDrawInfo_Bank01_ReturnsTwice(k); } void Spr029_KoopaKid_MortonRoyLudwig(uint8 k) { // 01cdab @@ -5746,7 +5977,6 @@ void Spr029_KoopaKid_MortonRoyLudwig(uint8 k) { // 01cdab uint8 v2 = kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CDA5[spr_table157c[k]]; if (spr_decrementing_table15ac[k] < 8) v2 ^= 0x80; - R0_ = v2; v1 = v2 + kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CD9C[spr_table1602[k]] + kSpr029_KoopaKid_MortonRoyLudwig_DATA_01CD99[spr_table00c2[k]]; } @@ -6021,14 +6251,11 @@ void Spr029_KoopaKid_MortonRoyLudwig_ProcessRoysAttacks(uint8 k) { // 01d116 } } } - R5_ = spr_table1534[k]; - R6_ = R5_; - R11_ = R5_; - R12_ = R5_; - R7_ = spr_table160e[k]; - R8_ = R7_; - R9_ = R7_; - R10_ = R7_; + uint8 arr[8] = { + spr_table1534[k], spr_table1534[k], + spr_table160e[k], spr_table160e[k], spr_table160e[k], spr_table160e[k], + spr_table1534[k], spr_table1534[k], + }; if ((uint8)(2 * misc_m7_rotation)) { LABEL_34:; uint8 v12 = spr_table157c[k]; @@ -6048,7 +6275,7 @@ LABEL_34:; } if (!spr_table157c[k]) v5 += 4; - spr_xpos_lo[k] = *(&R5_ + v5); + spr_xpos_lo[k] = arr[v5]; uint8 v7 = spr_table1594[k]; uint8 v8 = spr_ypos_lo[k]; if (v7 != 3) { @@ -6074,17 +6301,17 @@ LABEL_25:; if (!spr_table157c[k]) v11 ^= 2; if (v11 == 2) { - CheckPlayerPositionRelativeToSprite_Bank01_X(k); - if ((uint8)(R15_ + 16) < 0x20) + if ((uint8)(player_current_xpos - GetSprXPos(k) + 16) < 0x20) ++spr_table1528[k]; } } void Spr029_KoopaKid_MortonRoyLudwig_01D2A8(uint8 k) { // 01d2a8 if (spr_table151c[k] < 3 && (spr_table187b[k] != 3 || spr_table1528[k] < 3)) { - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - Spr029_KoopaKid_MortonRoyLudwig_01D40B(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + Spr029_KoopaKid_MortonRoyLudwig_01D40B(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (!spr_decrementing_table1fe2[k]) { spr_decrementing_table1fe2[k] = 8; if (player_in_air_flag) { @@ -6155,12 +6382,13 @@ void Spr029_KoopaKid_MortonRoyLudwig_01D3B1(uint8 k) { // 01d3b1 for (uint8 i = 10; i != 7; --i) { sprites_second_tracked_sprite_index = i; if (ext_spr_spriteid[i] == 5) { - SetHiLo(&R8_, &R0_, PAIR16(ext_spr_xpos_hi[i], ext_spr_xpos_lo[i])); - SetHiLo(&R9_, &R1_, PAIR16(ext_spr_ypos_hi[i], ext_spr_ypos_lo[i])); - R2_ = 8; - R3_ = 8; - Spr029_KoopaKid_MortonRoyLudwig_01D40B(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + SetHiLo(&ci.r8, &ci.r0, PAIR16(ext_spr_xpos_hi[i], ext_spr_xpos_lo[i])); + SetHiLo(&ci.r9, &ci.r1, PAIR16(ext_spr_ypos_hi[i], ext_spr_ypos_lo[i])); + ci.r2 = 8; + ci.r3 = 8; + Spr029_KoopaKid_MortonRoyLudwig_01D40B(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { ext_spr_spriteid[i] = 1; ext_spr_decrementing_table176f[i] = 15; io_sound_ch1 = 1; @@ -6172,12 +6400,12 @@ void Spr029_KoopaKid_MortonRoyLudwig_01D3B1(uint8 k) { // 01d3b1 } } -void Spr029_KoopaKid_MortonRoyLudwig_01D40B(uint8 k) { // 01d40b - SetHiLo(&R10_, &R4_, GetSprXPos(k) - 8); - R6_ = 16; - R7_ = 16; +void Spr029_KoopaKid_MortonRoyLudwig_01D40B(uint8 k, CollInfo *ci) { // 01d40b + SetHiLo(&ci->r10, &ci->r4, GetSprXPos(k) - 8); + ci->r6 = 16; + ci->r7 = 16; uint8 v2 = (spr_table1602[k] >= 0x69) ? 19 : 8; - SetHiLo(&R11_, &R5_, GetSprYPos(k) + v2); + SetHiLo(&ci->r11, &ci->r5, GetSprYPos(k) + v2); } void Spr034_LudwigFireball(uint8 k) { // 01d44e @@ -6188,14 +6416,15 @@ void Spr034_LudwigFireball(uint8 k) { // 01d44e CheckPlayerToNormalSpriteCollision(k); } UpdateNormalSpritePosition_X(k); - R0_W = GetSprXPos(k) + 32; - if (R0_W >= 0x230) + uint16 r0w = GetSprXPos(k) + 32; + if (r0w >= 0x230) spr_current_status[k] = 0; } - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R3_ = 2 * spr_table1602[k]; - R2_ = 2 * spr_table157c[k]; + uint8 r3 = 2 * spr_table1602[k]; + uint8 r2 = 2 * spr_table157c[k]; uint8 v2 = kSpr034_LudwigFireball_OAMIndexes[k]; spr_oamindex[k] = v2; uint8 v3 = v2; @@ -6204,13 +6433,13 @@ void Spr034_LudwigFireball(uint8 k) { // 01d44e do { v9 = v4; int8 v8 = v4; - uint8 v5 = R2_ + v4; + uint8 v5 = r2 + v4; OamEnt *oam = get_OamEnt(oam_buf, v3); - oam[64].xpos = kSpr034_LudwigFireball_XDisp[v5] + R0_; + oam[64].xpos = kSpr034_LudwigFireball_XDisp[v5] + drt.x; uint8 v7 = ((counter_local_frames & 2) != 0) ? 0x80 : 0; oam[64].flags = kSpr034_LudwigFireball_Prop[v5] | v7; - oam[64].ypos = R1_ + 2; - oam[64].charnum = kSpr034_LudwigFireball_Tiles[(uint8)(R3_ + v8)]; + oam[64].ypos = drt.y + 2; + oam[64].charnum = kSpr034_LudwigFireball_Tiles[(uint8)(r3 + v8)]; v3 += 4; v4 = v9 - 1; } while (v4 >= 0); @@ -6248,7 +6477,6 @@ void Spr03F_ParachuteGoomba(uint8 k) { // 01d4fb misc_scratch7e185e = (v6 >> 1) ^ 0xF; v5 = misc_scratch7e185e - 16; } - R0_ = v5; uint16 old_y = GetSprYPos(k); SetSprYPos(k, old_y + (0xff00 | v5)); uint8 v14 = spr_table15f6[k]; @@ -6340,11 +6568,11 @@ void SprXXX_LineGuided_Init_BrownLineGuidePlatformEntry(uint8 k) { // 01d711 } void SprXXX_LineGuided_ChainsawEntry(uint8 k) { // 01d719 - R2_ = counter_local_frames ^ (4 * k); - if (!(flag_sprites_locked | R2_ & 7)) { - R0_ = kSprXXX_LineGuided_DATA_01D717[(R2_ & 8) != 0]; - R1_ = -14; - SpawnNormalSpriteTurnAroundSmoke_Entry2(k); + uint8 r2 = counter_local_frames ^ (4 * k); + if (!(flag_sprites_locked | r2 & 7)) { + uint8 r0 = kSprXXX_LineGuided_DATA_01D717[(r2 & 8) != 0]; + uint8 r1 = -14; + SpawnNormalSpriteTurnAroundSmoke_Entry2(k, r0, r1); } SprXXX_LineGuided_LineGuideGrinderEntry(k); } @@ -6422,9 +6650,9 @@ void SprXXX_LineGuided_LineFuzzyPlats(uint8 k) { // 01d74a SprXXX_LineGuided_01D74D(k); return; } - R0_ = spr_table1602[k] ? 40 : 24; + uint8 r0 = spr_table1602[k] ? 40 : 24; uint16 old_x = GetSprXPos(k), old_y = GetSprYPos(k); - AddSprXYPos(k, -R0_, -8); + AddSprXYPos(k, -r0, -8); NormalSpritePlatformGFXRt_DrawFlatPlatform(k); SetSprXPos(k, old_x); SetSprYPos(k, old_y); @@ -6434,8 +6662,8 @@ void SprXXX_LineGuided_LineFuzzyPlats(uint8 k) { // 01d74a uint8 v20 = spr_table1528[k]; spr_table1528[k] = -v7; old_x = GetSprXPos(k), old_y = GetSprYPos(k); - R0_ = spr_table1602[k] ? 40 : 24; - AddSprXYPos(k, -R0_, -8); + r0 = spr_table1602[k] ? 40 : 24; + AddSprXYPos(k, -r0, -8); if (SolidSpriteBlock(k)) { if (spr_table1626[k]) { spr_table1626[k] = 0; @@ -6472,23 +6700,29 @@ void SprXXX_LineGuided_State01_OnLineGuide(uint8 k) { // 01d768 } void SprXXX_LineGuided_01D7B0(uint8 k, uint8 j) { // 01d7b0 - R4_ = spr_table151c[k]; - R5_ = spr_table1528[k]; - R6_ = RomPtr_07(*(uint16 *)&R4_)[j] & 0xF; - R7_ = RomPtr_07(*(uint16 *)&R4_)[j] >> 4; - spr_ypos_lo[k] = R7_ + (spr_ypos_lo[k] & 0xF0); - spr_xpos_lo[k] = R6_ + (spr_xpos_lo[k] & 0xF0); + uint16 t = PAIR16(spr_table1528[k], spr_table151c[k]); + uint8 r6 = RomPtr_07(t)[j] & 0xF; + uint8 r7 = RomPtr_07(t)[j] >> 4; + spr_ypos_lo[k] = r7 + (spr_ypos_lo[k] & 0xF0); + spr_xpos_lo[k] = r6 + (spr_xpos_lo[k] & 0xF0); } +static const uint8 kLineGuideSpeedTable_PtrsLo[32] = { 0xdb, 0xf0, 0x5, 0x1a, 0x2f, 0x3b, 0x4b, 0x5b, 0x6b, 0x7b, 0x87, 0x93, 0xa3, 0xb3, 0xc3, 0xd3, 0xdf, 0xf4, 0x9, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79, 0x89, 0x99, 0xa9, 0xb9, 0xc9, 0xde, }; +static const uint8 kLineGuideSpeedTable_PtrsHi[32] = { 0xf9, 0xf9, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, }; + void SprXXX_LineGuided_State00_AtEndOfTile(uint8 k) { // 01d7f4 + uint8 r4, r5; uint8 v1 = 3; + int r8 = -1, r10 = -1; + r8 = GetSprYPos(k); + r10 = GetSprXPos(k); do { sprites_second_tracked_sprite_index = v1; - R2_W = GetSprXPos(k) + PAIR16(kSprXXX_LineGuided_DATA_01D7E5[v1], kSprXXX_LineGuided_DATA_01D7E1[v1]); - R0_W = GetSprYPos(k) + PAIR16(kSprXXX_LineGuided_DATA_01D7ED[v1], kSprXXX_LineGuided_DATA_01D7E9[v1]); - if (spr_decrementing_table1540[k] || (R4_ = R0_ & 0xF0, (spr_ypos_lo[k] & 0xF0) != (R0_ & 0xF0)) || - (R5_ = R2_ & 0xF0, (spr_xpos_lo[k] & 0xF0) != (R2_ & 0xF0))) { - if (SprXXX_LineGuided_01D94D()) + uint16 r2w = GetSprXPos(k) + PAIR16(kSprXXX_LineGuided_DATA_01D7E5[v1], kSprXXX_LineGuided_DATA_01D7E1[v1]); + uint16 r0w = GetSprYPos(k) + PAIR16(kSprXXX_LineGuided_DATA_01D7ED[v1], kSprXXX_LineGuided_DATA_01D7E9[v1]); + if (spr_decrementing_table1540[k] || (r4 = r0w & 0xF0, (spr_ypos_lo[k] & 0xF0) != (r0w & 0xF0)) || + (r5 = r2w & 0xF0, (spr_xpos_lo[k] & 0xF0) != (r2w & 0xF0))) { + if (SprXXX_LineGuided_01D94D(r0w, r2w)) goto LABEL_22; if (blocks_currently_processed_map16_tile_lo == 0x94) { if (flag_on_off_switch) @@ -6503,10 +6737,8 @@ void SprXXX_LineGuided_State00_AtEndOfTile(uint8 k) { // 01d7f4 LABEL_22: v7 = spr_table160e[k]; } else { - R8_W = GetSprYPos(k); - R10_W = GetSprXPos(k); - SetSprYPos(k, R0_W); - SetSprXPos(k, R2_W); + SetSprYPos(k, r0w); + SetSprXPos(k, r2w); } spr_table151c[k] = kLineGuideSpeedTable_PtrsLo[v7]; spr_table1528[k] = kLineGuideSpeedTable_PtrsHi[v7]; @@ -6526,15 +6758,15 @@ void SprXXX_LineGuided_State00_AtEndOfTile(uint8 k) { // 01d7f4 } if ((v8 & 0xF) >= 0xA && spr_table00c2[k] != 2) spr_table157c[k] = 1; - R12_ = spr_ypos_lo[k]; - R13_ = spr_xpos_lo[k]; + uint8 r12 = spr_ypos_lo[k]; + uint8 r13 = spr_xpos_lo[k]; SprXXX_LineGuided_State01_OnLineGuide(k); - if ((uint8)(R12_ - spr_ypos_lo[k] + 8) < 0x10 && (uint8)(R13_ - spr_xpos_lo[k] + 8) < 0x10) { + if ((uint8)(r12 - spr_ypos_lo[k] + 8) < 0x10 && (uint8)(r13 - spr_xpos_lo[k] + 8) < 0x10) { spr_table00c2[k] = 1; return; } - SetSprYPos(k, R8_W); - SetSprXPos(k, R10_W); + SetSprYPos(k, r8); + SetSprXPos(k, r10); } LABEL_13: v1 = sprites_second_tracked_sprite_index - 1; @@ -6553,22 +6785,19 @@ void SprXXX_LineGuided_State00_AtEndOfTile(uint8 k) { // 01d7f4 } } -uint8 SprXXX_LineGuided_01D94D() { // 01d94d - - R6_ = R0_ & 0xF0; - uint8 v4 = R2_ >> 4; - uint8 v3 = R0_ & 0xF0 | (R2_ >> 4); +uint8 SprXXX_LineGuided_01D94D(uint16 r0w, uint16 r2w) { // 01d94d + uint8 r2 = r2w; + uint8 r3 = r2w >> 8; + uint8 v4 = r2 >> 4; + uint8 v3 = r0w & 0xF0 | (r2 >> 4); + uint16 r5; if ((misc_level_layout_flags & 1) != 0) { - WORD(R5_) = PAIR16(kLevelDataLayoutTables_EightBitHi_Vertical[R1_], kLevelDataLayoutTables_EightBitLo_Vertical[R1_]) + PAIR16(R3_, v3); + r5 = PAIR16(kLevelDataLayoutTables_EightBitHi_Vertical[r0w >> 8], kLevelDataLayoutTables_EightBitLo_Vertical[r0w >> 8]) + PAIR16(r2w >> 8, v3); } else { - WORD(R5_) = PAIR16(kLevelDataLayoutTables_EightBitHi[R3_], kLevelDataLayoutTables_EightBitLo[R3_]) + PAIR16(R1_, v3); + r5 = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[r2w >> 8], kLevelDataLayoutTables_EightBitLo_Horizontal[r2w >> 8]) + PAIR16(r0w >> 8, v3); } - R7_ = 126; - blocks_currently_processed_map16_tile_lo = *IndirPtr(&R5_, 0); - ++R7_; - uint8 v1 = *IndirPtr(&R5_, 0); - R5_ = v4; - return kSprXXX_LineGuided_DATA_018000[v4 & 7] & v1; + blocks_currently_processed_map16_tile_lo = g_ram[r5]; + return kSprXXX_LineGuided_DATA_018000[v4 & 7] & g_ram[r5 + 0x10000]; } void SprXXX_LineGuided_01DA90(uint8 a) { // 01da90 @@ -6600,17 +6829,17 @@ void Spr0B4_NonLineGuideGrinder(uint8 k) { // 01db5c } void Spr0B4_NonLineGuideGrinder_Draw(uint8 k) { // 01dba2 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 3; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0B4_NonLineGuideGrinder_XDisp[i] + R0_; - oam[64].ypos = kSpr0B4_NonLineGuideGrinder_YDisp[i] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0B4_NonLineGuideGrinder_XDisp[i] + drt.x; + oam[64].ypos = kSpr0B4_NonLineGuideGrinder_YDisp[i] + drt.y; oam[64].charnum = counter_local_frames & 2 | 0x6C; oam[64].flags = kSpr0B4_NonLineGuideGrinder_Prop[i]; - drt += 4; + drt.idx += 4; } FinishOAMWrite(k, 2, 3); } @@ -6627,43 +6856,44 @@ void SprXXX_LineGuided_01DBD4(uint8 k) { // 01dbd4 } void SprXXX_LineGuided_01DC0B(uint8 k) { // 01dc0b - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 3; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSprXXX_LineGuided_DATA_01DC3B[i] + R0_; - oam[64].ypos = kSprXXX_LineGuided_DATA_01DC3F[i] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSprXXX_LineGuided_DATA_01DC3B[i] + drt.x; + oam[64].ypos = kSprXXX_LineGuided_DATA_01DC3F[i] + drt.y; oam[64].charnum = counter_local_frames & 2 | 0x6C; oam[64].flags = kSprXXX_LineGuided_DATA_01DC43[i]; - drt += 4; + drt.idx += 4; } FinishOAMWrite(k, 2, 3); } void SprXXX_LineGuided_01DC54(uint8 k) { // 01dc54 - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - R0_ -= 8; - R1_ -= 8; - R2_ = ((uint8)(counter_local_frames ^ (4 * k)) >> 3) & 3; + drt.x -= 8; + drt.y -= 8; + uint8 r2 = ((uint8)(counter_local_frames ^ (4 * k)) >> 3) & 3; uint8 v1 = 5; if (k >= 6 && sprites_sprite_memory_setting) v1 = 9; - R3_ = v1; + uint8 r3 = v1; uint8 v2 = spr_oamindex[k]; uint8 v3 = 0; do { OamEnt *oam = get_OamEnt(oam_buf, v2); - oam[64].xpos = R0_; - uint8 v5 = R1_; - oam[64].ypos = R1_; - R1_ = v5 + 16; - oam[64].charnum = v3 ? kSprXXX_LineGuided_LineGuideRopeTiles[v3] : kSprXXX_LineGuided_RopeMotorTiles[R2_]; + oam[64].xpos = drt.x; + uint8 v5 = drt.y; + oam[64].ypos = drt.y; + drt.y = v5 + 16; + oam[64].charnum = v3 ? kSprXXX_LineGuided_LineGuideRopeTiles[v3] : kSprXXX_LineGuided_RopeMotorTiles[r2]; oam[64].flags = v3 ? 49 : 55; v2 += 4; - } while (++v3 != R3_); + } while (++v3 != r3); get_OamEnt(oam_buf, v2)[63].charnum = -34; uint8 v8 = (spr_current_slotid >= 6 && sprites_sprite_memory_setting) ? 8 : 4; FinishOAMWrite(spr_current_slotid, 2, v8); @@ -6677,10 +6907,10 @@ void Spr082_BonusGame_Init(uint8 k) { // 01ddac do { spr_current_status[v1] = 8; spr_spriteid[v1] = -126; - SetSprXYPos(v1, kSpr082_BonusGame_Init_DATA_01DD90[v1], - (int8)kSpr082_BonusGame_Init_DATA_01DD99[v1] + 256); + SetSprXYPos(v1, kSpr082_BonusGame_Init_DATA_01DD90[v1 - 1], + (int8)kSpr082_BonusGame_Init_DATA_01DD99[v1 - 1] + 256); InitializeNormalSpriteRAMTables(v1); - spr_table157c[v1] = kSpr082_BonusGame_Init_DATA_01DDA2[v1]; + spr_table157c[v1] = kSpr082_BonusGame_Init_DATA_01DDA2[v1 - 1]; spr_table1570[v1] = (counter_global_frames + v1) & 7; --v1; } while (v1); @@ -6739,7 +6969,7 @@ void Spr082_BonusGame(uint8 k) { // 01de2a } void Spr082_BonusGame_01DF19(uint8 k) { // 01df19 - R0_ = kSpr082_BonusGame_DATA_01DF10[spr_decrementing_table1540[k] >> 1]; + uint8 r0 = kSpr082_BonusGame_DATA_01DF10[spr_decrementing_table1540[k] >> 1]; uint8 v1 = spr_oamindex[k]; int8 v2 = spr_xpos_lo[k] - mirror_current_layer1_xpos; OamEnt *oam = get_OamEnt(oam_buf, v1); @@ -6752,7 +6982,7 @@ void Spr082_BonusGame_01DF19(uint8 k) { // 01df19 uint8 t4 = spr_decrementing_table154c[k]; uint8 t5 = t4 ? (t4 & 0x10) != 0 : 0; - int8 v4 = spr_ypos_lo[k] - R0_ - mirror_current_layer1_ypos; + int8 v4 = spr_ypos_lo[k] - r0 - mirror_current_layer1_ypos; oam[68].ypos = v4; if (!t5) { oam[64].ypos = v4; @@ -6782,29 +7012,30 @@ void Spr082_BonusGame_01DF19(uint8 k) { // 01df19 } void Spr082_BonusGame_01DFD9() { // 01dfd9 - R0_ = 7; + uint8 arr7[3], arr4[3]; + uint8 r0 = 7; do { for (uint8 i = 2; (i & 0x80) == 0; --i) { - R1_ = i; - uint8 v1 = kSpr082_BonusGame_DATA_01DFC1[(uint8)(i + R0_ + __CFSHL__(R0_, 1) + 2 * R0_)]; - R2_ = kSpr082_BonusGame_Init_DATA_01DD99[v1 + 1]; - R3_ = kSpr082_BonusGame_Init_DATA_01DD90[v1 + 1]; + uint8 r1 = i; + uint8 v1 = kSpr082_BonusGame_DATA_01DFC1[(uint8)(i + 3 * r0)]; + uint8 r2 = kSpr082_BonusGame_Init_DATA_01DD99[v1]; + uint8 r3 = kSpr082_BonusGame_Init_DATA_01DD90[v1]; uint8 j; for (j = 9; j != 1; --j) { - if (spr_ypos_lo[j] == R2_ && spr_xpos_lo[j] == R3_) + if (spr_ypos_lo[j] == r2 && spr_xpos_lo[j] == r3) break; } - *(&R4_ + i) = spr_table1570[j]; - *(&R7_ + i) = j; + arr4[i] = spr_table1570[j]; + arr7[i] = j; } - if (R4_ == R5_ && R4_ == R6_) { + if (arr4[0] == arr4[1] && arr4[0] == arr4[2]) { ++counter_number_of_bonus_game1ups_to_spawn; - spr_decrementing_table154c[R7_] = 112; - spr_decrementing_table154c[R8_] = 112; - spr_decrementing_table154c[R9_] = 112; + spr_decrementing_table154c[arr7[0]] = 112; + spr_decrementing_table154c[arr7[1]] = 112; + spr_decrementing_table154c[arr7[2]] = 112; } - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); uint8 v3 = 41; counter_remaining_bonus_game1ups = counter_number_of_bonus_game1ups_to_spawn; if (!counter_number_of_bonus_game1ups_to_spawn) { @@ -6895,12 +7126,12 @@ void Spr033_Podoboo(uint8 k) { // 01e093 void Spr033_Podoboo_01E0E2(uint8 k) { // 01e0e2 uint8 v1 = spr_ypos_lo[k]; bool v2 = v1 < spr_table1528[k]; - R0_ = v1 - spr_table1528[k]; + uint8 r0 = v1 - spr_table1528[k]; int8 v3 = 0; if ((spr_ypos_hi[k] - (v2 + spr_table151c[k])) & 1) v3 = 0x80; - R0_ = (R0_ >> 1) + v3; - int8 v4 = kSpr033_Podoboo_DATA_01E07B[R0_ >> 3]; + r0 = (r0 >> 1) + v3; + int8 v4 = kSpr033_Podoboo_DATA_01E07B[r0 >> 3]; if (v4 >= 0) { spr_decrementing_table1564[k] = v4; v4 = 0x80; @@ -6913,38 +7144,39 @@ void Spr00E_Keyhole_Init(uint8 k) { // 01e1b8 } void Spr00E_Keyhole(uint8 k) { // 01e1c8 - uint8 drt; + GetDrawInfoRes drt; uint8 i; + CollInfo ci; for (i = 11; (i & 0x80) == 0; --i) { if (spr_current_status[i] >= 8 && spr_spriteid[i] == 0x80) break; } if (player_riding_yoshi_flag && yoshi_key_in_mouth_flag) { - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); } else { spr_table151c[k] = i; if ((i & 0x80) != 0 || spr_current_status[i] != 11) goto LABEL_15; - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(i); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(i, &ci); } - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact() && !spr_decrementing_table154c[k]) { + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci) && !spr_decrementing_table154c[k]) { timer_end_level_via_keyhole = 48; io_music_ch1 = 16; ++player_freeze_player_flag; ++flag_sprites_locked; - WORD(temp1436) = GetSprXPos(k); - WORD(temp1438) = GetSprYPos(k); + player_on_tilting_platform_xpos = GetSprXPos(k); + player_on_tilting_platform_ypos = GetSprYPos(k); spr_decrementing_table154c[k] = 48; } LABEL_15: - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; - oam[65].xpos = R0_; - oam[64].ypos = R1_; - oam[65].ypos = R1_ + 8; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; + oam[65].xpos = drt.x; + oam[64].ypos = drt.y; + oam[65].ypos = drt.y + 8; oam[64].charnum = -21; oam[65].charnum = -5; oam[64].flags = 48; @@ -6981,16 +7213,14 @@ void Spr04E_LedgeMontyMole(uint8 k) { // 01e2cf } void SprXXX_SmallMontyMole_State00_Invisible(uint8 k) { // 01e2e0 - CheckPlayerPositionRelativeToSprite_Bank01_X(k); - if ((uint8)(R15_ + 96) < 0xC0 && !spr_xoffscreen_flag[k]) { + if ((uint8)(player_current_xpos - GetSprXPos(k) + 96) < 0xC0 && !spr_xoffscreen_flag[k]) { ++spr_table00c2[k]; uint8 v1 = 104; if (ow_players_map[player_current_character] != 1) v1 = 32; spr_decrementing_table1540[k] = v1; } - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) - return; + GetDrawInfo_Bank01_ReturnsTwice(k); } void SprXXX_SmallMontyMole_State01_AboutToEmerge(uint8 k) { // 01e309 @@ -7230,9 +7460,9 @@ void Spr02F_PortableSpringboard(uint8 k) { // 01e623 uint8 v4 = kSpr02F_PortableSpringboard_PlayerYDisp[v2 >> 1]; if (player_riding_yoshi_flag) v4 += 18; - R0_ = v4; + uint8 r0 = v4; spr_table1602[k] = kSpr02F_PortableSpringboard_AnimationFrames[v3]; - player_ypos = GetSprYPos(k) - R0_; + player_ypos = GetSprYPos(k) - r0; player_in_air_flag = 0; player_xspeed = 0; misc_player_on_solid_sprite = 2; @@ -7282,17 +7512,17 @@ void Spr02F_PortableSpringboard_01E6F0(uint8 k) { // 01e6f0 } void GenericSmushedSpriteDraw(uint8 k) { // 01e700 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; if (!CheckIfNormalSpriteOffScreen(k)) { - uint8 v2 = R0_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; + uint8 v2 = drt.x; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; oam[65].xpos = v2 + 8; - int8 v4 = R1_ + 8; - oam[64].ypos = R1_ + 8; + int8 v4 = drt.y + 8; + oam[64].ypos = drt.y + 8; oam[65].ypos = v4; uint8 v5 = spr_spriteid[k]; int8 v6 = -2; @@ -7309,7 +7539,7 @@ void GenericSmushedSpriteDraw(uint8 k) { // 01e700 int8 v7 = spr_table15f6[k] | sprites_tile_priority; oam[64].flags = v7; oam[65].flags = v7 | 0x40; - uint8 v8 = drt >> 2; + uint8 v8 = drt.idx >> 2; sprites_oamtile_size_buffer[v8 + 64] = 0; sprites_oamtile_size_buffer[v8 + 65] = 0; } @@ -7346,9 +7576,9 @@ void Spr087_LakituCloud(uint8 k) { // 01e7a4 if (spr_current_status[i] == 8 && spr_spriteid[i] == 30) { spr_table160e[k] = i; Spr087_LakituCloud_01E98D(k); - R0_ = kSpr087_LakituCloud_CloudYPosOffset[(counter_local_frames >> 3) & 7]; + uint8 r0 = kSpr087_LakituCloud_CloudYPosOffset[(counter_local_frames >> 3) & 7]; SetSprXPos(i, GetSprXPos(k)); - SetSprYPos(i, GetSprYPos(k) - R0_); + SetSprYPos(i, GetSprYPos(k) - r0); spr_decrementing_table154c[k] = 16; Spr087_LakituCloud_Draw(k); return; @@ -7388,25 +7618,24 @@ void Spr087_LakituCloud(uint8 k) { // 01e7a4 } void Spr087_LakituCloud_Draw(uint8 k) { // 01e8ca - if (GetDrawInfo_Bank01_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank01_ReturnsTwice(k)).idx == 0xff) return; if (!spr_yoffscreen_flag[k]) { - R12_ = -8; - R13_ = -4; uint8 v1 = 0; if (!spr_table00c2[k]) v1 = 48; - R14_ = v1; misc_scratch7e18b6 = v1; - R15_ = v1 | 4; - temp14b0 = R0_; - temp14b2 = R1_; - R2_ = (counter_local_frames >> 2) & 0xC; - R3_ = 3; + uint8 oam_idxs[4] = { 0xf8, 0xfc, v1, v1 | 4 }; + + uint8 temp14b0 = drt.x; + uint8 temp14b2 = drt.y; + uint8 r2 = (counter_local_frames >> 2) & 0xC; + uint8 r3 = 3; do { - uint8 v2 = R2_ + R3_; - OamEnt *oam = get_OamEnt(oam_buf, *(&R12_ + R3_)); - oam[64].xpos = temp14b0 + kSpr087_LakituCloud_XDisp[(uint8)(R2_ + R3_)]; + uint8 v2 = r2 + r3; + OamEnt *oam = get_OamEnt(oam_buf, oam_idxs[r3]); + oam[64].xpos = temp14b0 + kSpr087_LakituCloud_XDisp[(uint8)(r2 + r3)]; oam[64].ypos = temp14b2 + kSpr087_LakituCloud_YDisp[v2]; uint8 v4 = spr_current_slotid; oam[64].charnum = 96; @@ -7414,8 +7643,7 @@ void Spr087_LakituCloud_Draw(uint8 k) { // 01e8ca if (v5) oam[64].charnum = kSpr087_LakituCloud_EvaporatingCloudTiles[v5 >> 3]; oam[64].flags = sprites_tile_priority; - --R3_; - } while ((R3_ & 0x80) == 0); + } while ((--r3 & 0x80) == 0); uint8 v6 = spr_current_slotid; spr_oamindex[spr_current_slotid] = -8; FinishOAMWrite(v6, 2, 1); @@ -7436,10 +7664,10 @@ void Spr087_LakituCloud_01E98D(uint8 k) { // 01e98d if (!flag_sprites_locked) { uint8 v1 = CheckPlayerPositionRelativeToSprite_Bank01_X(k); spr_table157c[spr_table160e[k]] = v1; - R0_ = v1; - uint8 v2 = R0_; + uint8 r0 = v1; + uint8 v2 = r0; if (timer_disappearing_sprite) { - uint8 v10 = R0_; + uint8 v10 = r0; uint8 ka = k; uint8 v3 = spr_table160e[k]; SubOffscreen_Bank01_Entry1(v3); @@ -7609,10 +7837,9 @@ void Spr035_Yoshi(uint8 k) { // 01ebca if (v1 == 1) { flag_sprites_locked = 0; player_freeze_player_flag = 0; - v1 = misc_intro_level_flag | flag_yoshi_saved | (ow_players_map[player_current_character] - 1); - if (!v1) { + uint8 tt = misc_intro_level_flag | flag_yoshi_saved | (ow_players_map[player_current_character] - 1); + if (!tt) { ++flag_yoshi_saved; - v1 = 3; misc_display_message = 3; } } @@ -7645,12 +7872,13 @@ void Spr035_Yoshi(uint8 k) { // 01ebca SetFacingDirectionBasedOnSpeed(k); if (CheckNormalSpriteLevelColl_Wall(k)) ChangeNormalSpriteDirection_FlipXSpeedAndDirection(k); - SetHiLo(&R10_, &R4_, GetSprXPos(k) + 4); - SetHiLo(&R11_, &R5_, GetSprYPos(k) + 19); - R7_ = 8; - R6_ = 8; - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - if (StandardSpriteToSpriteCollisionChecks_CheckContact() && player_in_air_flag && + CollInfo ci; + SetHiLo(&ci.r10, &ci.r4, GetSprXPos(k) + 4); + SetHiLo(&ci.r11, &ci.r5, GetSprYPos(k) + 19); + ci.r7 = 8; + ci.r6 = 8; + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci) && player_in_air_flag && !(player_riding_yoshi_flag | player_carrying_something_flag1) && (player_yspeed & 0x80) == 0) { Spr035_Yoshi_01EDCE(k, 1); player_xspeed = 0; @@ -7697,11 +7925,11 @@ void Spr035_Yoshi(uint8 k) { // 01ebca if ((slot & 0x80) == 0) { spr_current_status[slot] = 9; spr_spriteid[slot] = 44; - R15_ = spr_table157c[k]; + uint8 r15 = spr_table157c[k]; SetSprXPos(slot, GetSprXPos(k) + PAIR16(kSpr035_Yoshi_YoshiEggInitialXOffsetHi[spr_table157c[k]], kSpr035_Yoshi_YoshiEggInitialXOffsetLo[spr_table157c[k]])); SetSprYPos(slot, GetSprYPos(k) + 8); InitializeNormalSpriteRAMTables(slot); - spr_xspeed[slot] = kSpr035_Yoshi_YoshiEggInitialXSpeed[R15_]; + spr_xspeed[slot] = kSpr035_Yoshi_YoshiEggInitialXSpeed[r15]; spr_yspeed[slot] = -16; spr_decrementing_table154c[slot] = 16; spr_table151c[slot] = yoshi_laid_egg_contents; @@ -7733,18 +7961,16 @@ void Spr035_Yoshi_HandleOffYoshi(uint8 k) { // 01ee61 } if (yoshi_in_pipe == 2) spr_table1602[k] = 3; - Spr035_Yoshi_01EF18(k); - OamEnt *oam = get_OamEnt(oam_buf, R14_); - R0_ = oam[64].charnum; - R1_ = 0; + uint8 r14 = Spr035_Yoshi_01EF18(k); + OamEnt *oam = get_OamEnt(oam_buf, r14); + uint16 r0w = oam[64].charnum; oam[64].charnum = 6; OamEnt *v2 = get_OamEnt(oam_buf, spr_oamindex[k]); - R2_ = v2[64].charnum; - R3_ = 0; + uint16 r2w = v2[64].charnum; v2[64].charnum = 8; - *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[6] = 32 * R0_W + 0x8500; + *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[6] = 32 * r0w + 0x8500; *(uint16 *)&graphics_dynamic_sprite_pointers_bottom_lo[6] = *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[6] + 512; - *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[8] = 32 * R2_W + 0x8500; + *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[8] = 32 * r2w + 0x8500; *(uint16 *)&graphics_dynamic_sprite_pointers_bottom_lo[8] = *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[8] + 512; spr_table1602[k] = v6; Spr035_Yoshi_01F0A2(k); @@ -7766,12 +7992,15 @@ void Spr035_Yoshi_HandleOffYoshi(uint8 k) { // 01ee61 } } -void Spr035_Yoshi_01EF18(uint8 k) { // 01ef18 +uint8 Spr035_Yoshi_01EF18(uint8 k) { // 01ef18 + static const uint8 kSpr035_Yoshi_YoshiThroatXDisp[40] = { 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xd, 0xd, 0xd, 0xd, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfb, 0xfb, 0xfb, 0xfb, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xd, 0xd, 0xd, 0xd, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfb, 0xfb, 0xfb, 0xfb, }; + static const uint8 kSpr035_Yoshi_YoshiThroatYDisp[40] = { 0xe, 0xe, 0xe, 0xd, 0xd, 0xd, 0xc, 0xc, 0xb, 0xb, 0xe, 0xe, 0xe, 0xd, 0xd, 0xd, 0xc, 0xc, 0xb, 0xb, 0x12, 0x12, 0x12, 0x11, 0x11, 0x11, 0x10, 0x10, 0xf, 0xf, 0x12, 0x12, 0x12, 0x11, 0x11, 0x11, 0x10, 0x10, 0xf, 0xf, }; + int8 v9, v11; uint8 v1 = spr_table1602[k]; misc_scratch7e185e = v1; - R15_ = spr_table1602[k] = kSpr035_Yoshi_YoshiHeadTiles[v1]; + uint8 r15 = spr_table1602[k] = kSpr035_Yoshi_YoshiHeadTiles[v1]; uint16 old_x = GetSprXPos(k), old_y = GetSprYPos(k); AddSprYPos(k, kSpr035_Yoshi_YoshiPositionY[v1]); uint8 v4 = v1 + (spr_table157c[k] ? 13 : 0); @@ -7779,7 +8008,7 @@ void Spr035_Yoshi_01EF18(uint8 k) { // 01ef18 uint8 v15 = spr_oamindex[k]; if (yoshi_in_pipe | spr_decrementing_table15ac[k]) spr_oamindex[k] = 4; - R14_ = spr_oamindex[k]; + uint8 r14 = spr_oamindex[k]; GenericGFXRtDraw1Tile16x16(k); OamEnt *oam = get_OamEnt(oam_buf, spr_oamindex[k]); oam[64].ypos += kSpr035_Yoshi_YoshiHeadYDisp[misc_scratch7e185e]; @@ -7789,9 +8018,9 @@ void Spr035_Yoshi_01EF18(uint8 k) { // 01ef18 AddSprYPos(k, 16); GenericGFXRtDraw1Tile16x16(k); SetSprYPos(k, old_y); - uint8 v7 = R14_; - if ((R15_ & 0x80) != 0) - get_OamEnt(oam_buf, R14_)[64].ypos = -16; + uint8 v7 = r14; + if ((r15 & 0x80) != 0) + get_OamEnt(oam_buf, r14)[64].ypos = -16; uint8 v8 = spr_table00c2[k]; if (!v8) { if ((counter_local_frames & 0x30) == 0) { @@ -7825,15 +8054,13 @@ LABEL_24:; } v10 = spr_decrementing_table1564[k]; if (!v10) - return; + return r14; v11 = 0; if (v10 >= 0xF) { if (v10 >= 0x1C) { if (v10 == 28) { - uint8 v20 = R14_; Spr035_Yoshi_ChangeBerryIntoBushTile(); Spr035_Yoshi_HandleYoshiSwallowingSomething(); - R14_ = v20; } ++player_freeze_player_flag; v10 = 0; @@ -7843,25 +8070,26 @@ LABEL_24:; goto LABEL_33; } LABEL_34: - get_OamEnt(oam_buf, R14_)[64].charnum = v11; + get_OamEnt(oam_buf, r14)[64].charnum = v11; if (v10 < 0xF && v10 >= 5) { uint8 v12 = v10 - 5; if (spr_table157c[k]) v12 += 10; if (spr_table1602[k] == 10) v12 += 20; - R2_ = v12; + uint8 r2 = v12; if (!CheckIfNormalSpriteOffScreen(k)) { - R0_ = spr_xpos_lo[k] - mirror_current_layer1_xpos; - R1_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; + uint8 r0 = spr_xpos_lo[k] - mirror_current_layer1_xpos; + uint8 r1 = spr_ypos_lo[k] - mirror_current_layer1_ypos; OamEnt *v14 = get_OamEnt(oam_buf, 0); - v14[64].xpos = kSpr035_Yoshi_YoshiThroatXDisp[R2_] + R0_; - v14[64].ypos = kSpr035_Yoshi_YoshiThroatYDisp[R2_] + R1_; + v14[64].xpos = kSpr035_Yoshi_YoshiThroatXDisp[r2] + r0; + v14[64].ypos = kSpr035_Yoshi_YoshiThroatYDisp[r2] + r1; v14[64].charnum = 63; v14[64].flags = get_OamEnt(oam_buf, spr_oamindex[k])[64].flags | 1; sprites_oamtile_size_buffer[64] = 0; } } + return r14; } void Spr035_Yoshi_01F0A2(uint8 k) { // 01f0a2 @@ -7922,8 +8150,8 @@ void Spr035_Yoshi_MouthState00(uint8 k) { // 01f14b if (v2 < 0xD) { uint8 v3 = 3; if (!spr_table187b[v1]) { - R0_ = 4 * kSpr035_Yoshi_YoshiAbilityIndex[(spr_table15f6[k] >> 1) & 7]; - v3 = kSpr035_Yoshi_YoshiShellAbility[R0_ | kSpr035_Yoshi_YoshiAbilityIndex[(spr_table15f6[v1] >> 1) & 7]]; + uint8 r0 = 4 * kSpr035_Yoshi_YoshiAbilityIndex[(spr_table15f6[k] >> 1) & 7]; + v3 = kSpr035_Yoshi_YoshiShellAbility[r0 | kSpr035_Yoshi_YoshiAbilityIndex[(spr_table15f6[v1] >> 1) & 7]]; } yoshi_yoshi_has_wings = v3 & 2; yoshi_stomp_ground_flag = v3 & 1; @@ -7957,10 +8185,9 @@ void Spr035_Yoshi_MouthState00(uint8 k) { // 01f14b spr_table160e[k] = -1; if (spr_spriteid[j] < 0xD && (spr_table187b[j] || (spr_table15f6[j] & 0xE) == 8 || (spr_table15f6[k] & 0xE) == 8)) { spr_current_status[j] = 0; - R0_ = 2; - Spr035_Yoshi_01F295(j); - Spr035_Yoshi_01F295(j); - Spr035_Yoshi_01F295(j); + Spr035_Yoshi_01F295(j, 2); + Spr035_Yoshi_01F295(j, 1); + Spr035_Yoshi_01F295(j, 0); io_sound_ch3 = 23; } else { Spr035_Yoshi_01F2DF(j); @@ -7977,19 +8204,18 @@ void Spr035_Yoshi_MouthState00(uint8 k) { // 01f14b } } -void Spr035_Yoshi_01F295(uint8 k) { // 01f295 +void Spr035_Yoshi_01F295(uint8 k, uint8 r0) { // 01f295 uint8 j = CheckAvailableExtendedSpriteSlot(k); ext_spr_spriteid[j] = 17; SetHiLo(&ext_spr_xpos_hi[j], &ext_spr_xpos_lo[j], GetSprXPos(k)); SetHiLo(&ext_spr_ypos_hi[j], &ext_spr_ypos_lo[j], GetSprYPos(k)); ext_spr_table1779[j] = 0; uint8 v2 = spr_table157c[k] & 1; - uint8 v3 = R0_; - uint8 v4 = kSpr035_Yoshi_YoshiFireballInitialXSpeed[R0_]; + uint8 v3 = r0; + uint8 v4 = kSpr035_Yoshi_YoshiFireballInitialXSpeed[r0]; ext_spr_xspeed[j] = v2 ? -v4 : v4; ext_spr_yspeed[j] = kSpr035_Yoshi_YoshiFireballInitialYSpeed[v3]; ext_spr_decrementing_table176f[j] = -96; - --R0_; } void Spr035_Yoshi_01F2DF(uint8 j) { // 01f2df @@ -8012,8 +8238,8 @@ void Spr035_Yoshi_MouthState01_ExtendTongue(uint8 k) { // 01f314 spr_decrementing_table1558[k] = 8; ++spr_table1594[k]; } - Spr035_Yoshi_01F3FE(k); - Spr035_Yoshi_01F4B2(k); + uint8 r13 = Spr035_Yoshi_01F3FE(k); + Spr035_Yoshi_01F4B2(k, r13); } void Spr035_Yoshi_MouthState02_RetractTongue(uint8 k) { // 01f332 @@ -8035,7 +8261,7 @@ void Spr035_Yoshi_MouthState02_RetractTongue(uint8 k) { // 01f332 spr_current_status[v2] = 0; spr_decrementing_table1564[k] = 27; spr_table160e[k] = -1; - R0_ = v2; + uint8 r0 = v2; if (spr_spriteid[v2] == 0x9D && spr_table00c2[v2] == 3) { spr_spriteid[v2] = 116; spr_property_bits167a[v2] |= 0x40; @@ -8043,9 +8269,9 @@ void Spr035_Yoshi_MouthState02_RetractTongue(uint8 k) { // 01f332 uint8 v3 = spr_spriteid[v2]; if (v3 == 0x81) { v3 = kSprXXX_PowerUps_ChangingItemSprite[(spr_table187b[v2] >> 6) & 3]; - spr_spriteid[R0_] = v3; + spr_spriteid[r0] = v3; } - uint8 v4 = R0_; + uint8 v4 = r0; if (spr_property_bits167a[v4] & 0x40) { spr_table00c2[v4] = 0; SprXXX_PowerUps_01C4BF(v4); @@ -8065,90 +8291,86 @@ void Spr035_Yoshi_MouthState02_RetractTongue(uint8 k) { // 01f332 spr_table151c[k] = v1; } } - Spr035_Yoshi_01F3FE(k); - Spr035_Yoshi_01F4B2(k); + uint8 r13 = Spr035_Yoshi_01F3FE(k); + Spr035_Yoshi_01F4B2(k, r13); } -void Spr035_Yoshi_Return01F3FD() { // 01f3fd - ; +uint8 Spr035_Yoshi_01F3FE(uint8 k) { // 01f3fe + uint8 r13 = 0; + if (yoshi_in_pipe | spr_yoffscreen_flag[k] | spr_xoffscreen_flag[k]) + return r13; + uint8 v1 = spr_table1602[k]; + misc_scratch7e185e = kSpr035_Yoshi_DATA_01F61A[v1]; + uint8 r1 = spr_ypos_lo[k] + misc_scratch7e185e - mirror_current_layer1_ypos; + if (!spr_table157c[k]) + v1 += 8; + r13 = kSpr035_Yoshi_DATA_01F60A[v1]; + int t = (uint8)(spr_xpos_lo[k] - mirror_current_layer1_xpos) + r13; + uint8 r0 = t; + if (spr_table157c[k] ? !(t & 0x100) : (t & 0x100)) + return r13; + uint8 r7 = spr_table157c[k]; + uint8 Reg = SnesDivide(spr_table151c[k] << 8, 4) >> 8; + if (r7 & 1) + Reg = -Reg; + uint8 r5 = Reg; + uint8 n = 4; + uint8 v3 = 12; + do { + OamEnt *oam = get_OamEnt(oam_buf, v3); + oam->xpos = r0; + uint16 t = r5 + r0; + r0 = t; + if (sign8(r5) ? (t & 0x100) == 0 : (t & 0x100) != 0) + break; + oam->ypos = r1; + int8 v6 = 118; + if (!n) + v6 = 102; + oam->charnum = v6; + int8 v7 = 9; + if (!(r7 & 1)) + v7 = 73; + oam->flags = sprites_tile_priority | v7; + sprites_oamtile_size_buffer[v3 >> 2] = 0; + v3 += 4; + --n; + } while ((n & 0x80) == 0); + return r13; } -void Spr035_Yoshi_01F3FE(uint8 k) { // 01f3fe - if (!(yoshi_in_pipe | (uint8)(spr_yoffscreen_flag[k] | spr_xoffscreen_flag[k]))) { - uint8 v1 = spr_table1602[k]; - misc_scratch7e185e = kSpr035_Yoshi_DATA_01F61A[v1]; - R1_ = spr_ypos_lo[k] + misc_scratch7e185e - mirror_current_layer1_ypos; - if (!spr_table157c[k]) - v1 += 8; - R13_ = kSpr035_Yoshi_DATA_01F60A[v1]; - int t = (uint8)(spr_xpos_lo[k] - mirror_current_layer1_xpos) + R13_; - R0_ = t; - if (spr_table157c[k] ? !(t & 0x100) : (t & 0x100)) - return; - WriteReg(WRDIVH, spr_table151c[k]); - WriteReg(WRDIVL, 0); - WriteReg(WRDIVB, 4); - R7_ = spr_table157c[k]; - uint8 Reg = ReadReg(RDDIVH); - if (R7_ & 1) - Reg = -Reg; - R5_ = Reg; - R6_ = 4; - uint8 v3 = 12; - do { - OamEnt *oam = get_OamEnt(oam_buf, v3); - oam->xpos = R0_; - uint16 t = R5_ + R0_; - R0_ = t; - if (sign8(R5_) ? (t & 0x100) == 0 : (t & 0x100) != 0) - break; - oam->ypos = R1_; - int8 v6 = 118; - if (!R6_) - v6 = 102; - oam->charnum = v6; - int8 v7 = 9; - if (!(R7_ & 1)) - v7 = 73; - oam->flags = sprites_tile_priority | v7; - sprites_oamtile_size_buffer[v3 >> 2] = 0; - v3 += 4; - --R6_; - } while ((R6_ & 0x80) == 0); - } -} - -void Spr035_Yoshi_01F4B2(uint8 k) { // 01f4b2 +void Spr035_Yoshi_01F4B2(uint8 k, uint8 r13) { // 01f4b2 int8 v8; + CollInfo ci; if ((spr_table160e[k] & 0x80) != 0) { - if ((R13_ & 0x80) != 0) - v8 = R13_ - spr_table151c[k]; + if ((r13 & 0x80) != 0) + v8 = r13 - spr_table151c[k]; else - v8 = spr_table151c[k] + R13_; - SetHiLo(&R8_, &R0_, GetSprXPos(k) + (int8)v8); - SetHiLo(&R9_, &R1_, GetSprYPos(k) + (uint8)(misc_scratch7e185e + 2)); - R2_ = 8; - R3_ = 4; + v8 = spr_table151c[k] + r13; + SetHiLo(&ci.r8, &ci.r0, GetSprXPos(k) + (int8)v8); + SetHiLo(&ci.r9, &ci.r1, GetSprYPos(k) + (uint8)(misc_scratch7e185e + 2)); + ci.r2 = 8; + ci.r3 = 4; for (uint8 i = 11; (i & 0x80) == 0; --i) { sprites_second_tracked_sprite_index = i; if (i != spr_current_slotid && (spr_table160e[k] & 0x80) != 0 && spr_current_status[i] >= 8 && !spr_table1632[i]) { - Spr035_Yoshi_TryEatSprite(k, i); + Spr035_Yoshi_TryEatSprite(k, i, &ci); } } - CheckBerryTileCollisionWithYoshiTongue(); + CheckBerryTileCollisionWithYoshiTongue(&ci); } else { uint8 v2; - if ((R13_ & 0x80) != 0) - v2 = R13_ - spr_table151c[k]; + if ((r13 & 0x80) != 0) + v2 = r13 - spr_table151c[k]; else - v2 = spr_table151c[k] + R13_; + v2 = spr_table151c[k] + r13; uint8 j = spr_table160e[k]; SetSprXPos(j, GetSprXPos(k) + (int8)(v2 - 4)); - R0_ = -4; + uint8 r0 = -4; if ((spr_property_bits1662[j] & 0x40) == 0 && (spr_property_bits190f[j] & 0x20) != 0) - R0_ = -8; - uint8 v6 = misc_scratch7e185e + R0_; + r0 = -8; + uint8 v6 = misc_scratch7e185e + r0; SetSprYPos(j, GetSprYPos(k) + (int8)v6); spr_yspeed[j] = 0; spr_xspeed[j] = 0; @@ -8156,25 +8378,25 @@ void Spr035_Yoshi_01F4B2(uint8 k) { // 01f4b2 } } -void Spr035_Yoshi_TryEatSprite(uint8 k, uint8 j) { // 01f58e - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(j); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { +void Spr035_Yoshi_TryEatSprite(uint8 k, uint8 j, CollInfo *ci) { // 01f58e + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(j, ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(ci)) { if (spr_property_bits1686[j] & 1) { io_sound_ch1 = 1; return; } if (spr_spriteid[j] == 112) { misc_scratch7e185e = j; - Spr070_Pokey_RemovePokeySegment(j, R1_ - spr_ypos_lo[j]); + uint8 r13 = Spr070_Pokey_RemovePokeySegment(j, ci->r1 - spr_ypos_lo[j]); j = FindFreeNormalSpriteSlot_HighPriority(); if ((j & 0x80) != 0) return; spr_current_status[j] = 8; spr_spriteid[j] = 112; - SetSprXPos(j, PAIR16(R8_, R0_)); - SetSprYPos(j, PAIR16(R9_, R1_)); + SetSprXPos(j, PAIR16(ci->r8, ci->r0)); + SetSprYPos(j, PAIR16(ci->r9, ci->r1)); InitializeNormalSpriteRAMTables(j); - spr_table00c2[j] = R13_ & spr_table00c2[misc_scratch7e185e]; + spr_table00c2[j] = r13 & spr_table00c2[misc_scratch7e185e]; spr_table1534[j] = 1; } spr_table160e[k] = j; @@ -8198,11 +8420,13 @@ void Spr035_Yoshi_01F622(uint8 k) { // 01f622 } void Spr035_Yoshi_01F668(uint8 k, uint8 j) { // 01f668 + CollInfo ci; uint8 v6; uint8 ka = k; - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + uint8 r0; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j, &ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { uint8 v2 = spr_spriteid[j]; if (v2 != 0x9D) { if (v2 == 21 || v2 == 22) { @@ -8225,9 +8449,9 @@ void Spr035_Yoshi_01F668(uint8 k, uint8 j) { // 01f668 } Spr035_Yoshi_01F6CD(j); } - } else if ((v3 != 78 && v3 != 77 || spr_table00c2[j] >= 2) && !sign8(R5_ + 13 - R1_)) { + } else if ((v3 != 78 && v3 != 77 || spr_table00c2[j] >= 2) && !sign8(ci.r5 + 13 - ci.r1)) { if (spr_current_status[j] != 10 || - (R0_ = CheckPlayerPositionRelativeToSprite_Bank01_X(j), v6 = spr_xspeed[j], k = ka, ((4 * v6 + __CFSHL__(v6, 1)) & 1) == R0_)) { + (r0 = CheckPlayerPositionRelativeToSprite_Bank01_X(j), v6 = spr_xspeed[j], k = ka, ((4 * v6 + __CFSHL__(v6, 1)) & 1) == r0)) { if (!timer_star_power) { spr_decrementing_table163e[k] = 16; io_sound_ch2 = 3; @@ -8270,8 +8494,7 @@ void PrepareToHatchNormalSpriteYoshiEgg(uint8 k) { // 01f751 void Spr02C_YoshiEgg(uint8 k) { // 01f764 if (spr_table187b[k]) { if (!CheckIfNormalSpriteOffScreen(k)) { - CheckPlayerPositionRelativeToSprite_Bank01_X(k); - if ((uint8)(R15_ + 32) < 0x40) { + if ((uint8)(player_current_xpos - GetSprXPos(k) + 32) < 0x40) { spr_table187b[k] = 0; PrepareToHatchNormalSpriteYoshiEgg(k); spr_table151c[k] = yoshi_stray_yoshi_flag ? 120 : 45; @@ -8287,7 +8510,6 @@ void Spr02C_YoshiEgg(uint8 k) { // 01f764 uint8 v7 = kSpr02C_YoshiEgg_DATA_01F75C[v3]; GenericGFXRtDraw1Tile16x16(k); uint8 v4 = spr_oamindex[k]; - R0_ = v7; OamEnt *oam = get_OamEnt(oam_buf, v4); oam[64].flags = v7 | oam[64].flags & 0xFE; oam[64].charnum = v8; @@ -8302,7 +8524,6 @@ void Spr02C_YoshiEgg(uint8 k) { // 01f764 spr_current_status[k] = 9; uint8 v9 = spr_table15f6[k] & 0xE; InitializeNormalSpriteRAMTables(k); - R0_ = v9; spr_table15f6[k] = v9 | spr_table15f6[k] & 0xF1; } else { InitializeNormalSpriteRAMTables(k); @@ -8313,17 +8534,17 @@ void Spr02C_YoshiEgg(uint8 k) { // 01f764 void Spr02C_YoshiEgg_01F7C8(uint8 k) { // 01f7c8 if (!CheckIfNormalSpriteOffScreen(k)) { - R0_ = spr_xpos_lo[k]; - R2_W = GetSprYPos(k); + uint8 r0 = spr_xpos_lo[k]; + uint16 r2w = GetSprYPos(k); uint8 v1 = 3; uint8 j = 11; while (1) { if (!mextspr_spriteid[j]) { LABEL_8: mextspr_spriteid[j] = 3; - mextspr_xpos_lo[j] = kSpr02C_YoshiEgg_EggShellInitialXPosLo[v1] + R0_; - mextspr_ypos_lo[j] = kSpr02C_YoshiEgg_EggShellInitialYPosLo[v1] + R2_; - mextspr_ypos_hi[j] = R3_; + mextspr_xpos_lo[j] = kSpr02C_YoshiEgg_EggShellInitialXPosLo[v1] + r0; + mextspr_ypos_lo[j] = kSpr02C_YoshiEgg_EggShellInitialYPosLo[v1] + r2w; + mextspr_ypos_hi[j] = r2w >> 8; mextspr_yspeed[j] = kSpr02C_YoshiEgg_EggShellInitialYSpeed[v1]; mextspr_xspeed[j] = kSpr02C_YoshiEgg_EggShellInitialXSpeed[v1]; mextspr_timer[j] = (v1-- << 6) | 0x28; @@ -8393,11 +8614,11 @@ void sub_1F8E1(uint8 k, uint8 a) { // 01f8e1 uint8 v2 = CheckPlayerPositionRelativeToSprite_Bank01_X(k); if (!spr_decrementing_table1540[k]) { spr_decrementing_table1540[k] = 32; - if (spr_table00c2[k] && (uint8)(R15_ + 10) < 0x14) + if (spr_table00c2[k] && (uint8)(player_current_xpos - GetSprXPos(k) + 10) < 0x14) goto LABEL_13; spr_table00c2[k] = (v2 == player_facing_direction); } - if ((uint8)(R15_ + 10) >= 0x14) { + if ((uint8)(player_current_xpos - GetSprXPos(k) + 10) >= 0x14) { uint8 v3 = spr_decrementing_table15ac[k]; if (v3) { LABEL_25: @@ -8494,19 +8715,19 @@ void sub_1F8E1(uint8 k, uint8 a) { // 01f8e1 void Spr0A7_IggyBall(uint8 k) { // 01fa58 GenericGFXRtDraw1Tile16x16(k); - R0_ = kSpr0A7_IggyBall_XFlip[spr_table157c[k]]; + uint8 r0 = kSpr0A7_IggyBall_XFlip[spr_table157c[k]]; uint8 v1 = spr_oamindex[k]; uint8 v2 = (counter_local_frames >> 2) & 3; OamEnt *oam = get_OamEnt(oam_buf, v1); oam[64].charnum = kSpr0A7_IggyBall_Tiles[v2]; - oam[64].flags = R0_ ^ kSpr0A7_IggyBall_Prop[v2]; + oam[64].flags = r0 ^ kSpr0A7_IggyBall_Prop[v2]; if (!flag_sprites_locked) { spr_xspeed[k] = kSpr0A7_IggyBall_XSpeed[spr_table157c[k]]; UpdateNormalSpritePosition_X(k); UpdateNormalSpritePosition_Y(k); if (sign8(spr_yspeed[k] - 64)) spr_yspeed[k] += 4; - if (Spr0A7_IggyBall_CheckTiltingPlatformCollision(k) & 1) + if (Spr0A7_IggyBall_CheckTiltingPlatformCollision(k).retval) spr_yspeed[k] = -16; CheckPlayerToNormalSpriteCollision(k); if (spr_ypos_lo[k] >= 0x44 && spr_ypos_lo[k] < 0x50) @@ -8519,9 +8740,10 @@ void Spr029_KoopaKids(uint8 k) { // 01fac1 } void Spr029_KoopaKid_IggyLarry(uint8 k) { // 01faf5 + PointU16 pt; if (!(spr_decrementing_table154c[k] | flag_sprites_locked)) { - R0_ = CheckPlayerPositionRelativeToSprite_Bank01_X(k); - if (((4 * (uint8)misc_m7_rotation + __CFSHL__(misc_m7_rotation, 1)) & 1) == R0_ && (++spr_table1534[k] & 0x7F) == 0) + uint8 r0 = CheckPlayerPositionRelativeToSprite_Bank01_X(k); + if (((4 * (uint8)misc_m7_rotation + __CFSHL__(misc_m7_rotation, 1)) & 1) == r0 && (++spr_table1534[k] & 0x7F) == 0) spr_decrementing_table1564[k] = 127; } spr_xoffscreen_flag[k] = 0; @@ -8547,8 +8769,7 @@ void Spr029_KoopaKid_IggyLarry(uint8 k) { // 01faf5 spr_decrementing_table163e[k] = 80; DespawnNonBossSprites(); } - temp14b8 = spr_xpos_lo[k]; - temp14ba = spr_ypos_lo[k]; + pt = (PointU16){ .x = spr_xpos_lo[k] , .y = spr_ypos_lo[k] }; goto LABEL_35; } UpdateNormalSpritePosition_X(k); @@ -8560,15 +8781,15 @@ void Spr029_KoopaKid_IggyLarry(uint8 k) { // 01faf5 } spr_yspeed[k] = 0; spr_xspeed[k] = 0; - R0_ = (uint8)(misc_m7_rotation + ((misc_m7_rotation & 0x80) != 0 ? 8 : 0)) >> 4; - R1_ = -R0_ & 0xF; + uint8 r0 = (uint8)(misc_m7_rotation + ((misc_m7_rotation & 0x80) != 0 ? 8 : 0)) >> 4; + uint8 r1 = -r0 & 0xF; uint8 v2; if (spr_decrementing_table154c[k]) { uint8 v3; if (HIBYTE(misc_m7_rotation)) - v3 = kSpr029_KoopaKid_IggyLarry_HurtXSpeed[R1_ + 8]; + v3 = kSpr029_KoopaKid_IggyLarry_HurtXSpeed[r1 + 8]; else - v3 = -kSpr029_KoopaKid_IggyLarry_HurtXSpeed[R0_ + 8]; + v3 = -kSpr029_KoopaKid_IggyLarry_HurtXSpeed[r0 + 8]; v2 = 4 * v3; } else if (HIBYTE(misc_m7_rotation)) { if (spr_xpos_lo[k] >= 0x78) @@ -8586,16 +8807,17 @@ void Spr029_KoopaKid_IggyLarry(uint8 k) { // 01faf5 ++spr_table1570[k]; spr_table1602[k] = kSpr029_KoopaKid_IggyLarry_WalkingAnimationFrames[(spr_table1570[k] >> 2) & 0xF]; } - Spr029_KoopaKid_IggyLarry_01FD50(k); - Spr029_KoopaKid_IggyLarry_01FC62(k); + pt = Spr029_KoopaKid_IggyLarry_01FD50(k); + + Spr029_KoopaKid_IggyLarry_01FC62(k, pt); LABEL_35:; uint8 v4 = spr_decrementing_table154c[k]; if (v4) { if (v4 >= 0x10 || v4 < 8) { spr_table1602[k] = 3; - Spr029_KoopaKid_IggyLarry_Draw(k); + Spr029_KoopaKid_IggyLarry_Draw(k, pt); } else { - Spr029_KoopaKid_IggyLarry_InShellDraw(k); + Spr029_KoopaKid_IggyLarry_InShellDraw(k, pt); } } else { uint8 v9 = spr_table157c[k]; @@ -8610,33 +8832,29 @@ LABEL_35:; uint8 v7 = spr_decrementing_table1564[k]; spr_table1602[k] = kSpr029_KoopaKid_IggyLarry_ThrowingAnimationFrames[v6 >> 3]; if (v7 == 40 && !flag_sprites_locked) - Spr029_KoopaKid_IggyLarry_ThrowBall(k); + Spr029_KoopaKid_IggyLarry_ThrowBall(k, pt); } - Spr029_KoopaKid_IggyLarry_Draw(k); + Spr029_KoopaKid_IggyLarry_Draw(k, pt); spr_table157c[k] = v9; } } -void Spr029_KoopaKid_IggyLarry_01FC62(uint8 k) { // 01fc62 +void Spr029_KoopaKid_IggyLarry_01FC62(uint8 k, PointU16 pt) { // 01fc62 if (!player_current_state && !spr_table160e[k]) { if (spr_xpos_lo[k] < 0x20 || spr_xpos_lo[k] >= 0xD8) { - spr_xpos_lo[k] = temp14b8; - spr_ypos_lo[k] = temp14ba; + spr_xpos_lo[k] = pt.x; + spr_ypos_lo[k] = pt.y; ++spr_table160e[k]; } - R0_ = temp14b8 - 8; - R1_ = temp14ba + 96; - R2_ = 15; - R3_ = 12; - R8_ = 0; - R9_ = 0; - R4_ = player_on_screen_pos_x + 2; - R5_ = player_on_screen_pos_y + 16; - R6_ = 12; - R7_ = 14; - R10_ = 0; - R11_ = 0; - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci = { + .r0 = pt.x - 8, + .r1 = pt.y + 96, + .r2 = 15, + .r3 = 12, + .r4 = player_on_screen_pos_x + 2, + .r5 = player_on_screen_pos_y + 16, + .r6 = 12, .r7 = 14, .r8 = 0, .r9 = 0, .r10 = 0, .r11 = 0 }; + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (!spr_decrementing_table1558[k]) { spr_decrementing_table1558[k] = 8; if (player_in_air_flag) { @@ -8644,8 +8862,8 @@ void Spr029_KoopaKid_IggyLarry_01FC62(uint8 k) { // 01fc62 BoostMarioSpeed(); uint8 v3 = spr_xpos_lo[k]; uint8 v2 = spr_ypos_lo[k]; - spr_xpos_lo[k] = temp14b8 - 8; - spr_ypos_lo[k] = temp14ba - 16; + spr_xpos_lo[k] = pt.x - 8; + spr_ypos_lo[k] = pt.y - 16; spr_xoffscreen_flag[k] = 0; SpawnContactEffectFromAbove(k); spr_ypos_lo[k] = v2; @@ -8660,13 +8878,15 @@ void Spr029_KoopaKid_IggyLarry_01FC62(uint8 k) { // 01fc62 for (uint8 i = 10; i != 7; --i) { sprites_second_tracked_sprite_index = i; if (ext_spr_spriteid[i] == 5) { - R4_ = ext_spr_xpos_lo[i] - mirror_current_layer1_xpos; - R10_ = 0; - R5_ = ext_spr_ypos_lo[i] - mirror_current_layer1_ypos; - R11_ = 0; - R6_ = 8; - R7_ = 8; - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + uint8 r4 = ext_spr_xpos_lo[i] - mirror_current_layer1_xpos; + uint8 r5 = ext_spr_ypos_lo[i] - mirror_current_layer1_ypos; + ci = (CollInfo){ + .r0 = pt.x - 8, + .r1 = pt.y + 96, + .r2 = 15, + .r3 = 12, + .r4 = r4, .r5 = r5, .r6 = 8, .r7 = 8, .r8 = 0, .r9 = 0, .r10 = 0, .r11 = 0 }; + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { ext_spr_spriteid[i] = 1; ext_spr_decrementing_table176f[i] = 15; io_sound_ch1 = 1; @@ -8678,15 +8898,19 @@ void Spr029_KoopaKid_IggyLarry_01FC62(uint8 k) { // 01fc62 } } -void Spr029_KoopaKid_IggyLarry_01FD50(uint8 k) { // 01fd50 - WORD(temp14b4) = GetSprXPos(k) + 8; - WORD(temp14b6) = GetSprYPos(k) + 47; +PointU16 Spr029_KoopaKid_IggyLarry_01FD50(uint8 k) { // 01fd50 + uint16 temp14b4 = GetSprXPos(k) + 8; + uint16 temp14b6 = GetSprYPos(k) + 47; misc_m7_rotation = ((misc_m7_rotation ^ 0x1FF) + 1) & 0x1FF; - CheckTiltingPlatformCollision(); + CheckPlatformCollRet cpcr = CheckTiltingPlatformCollision(temp14b4, temp14b6); misc_m7_rotation = ((misc_m7_rotation ^ 0x1FF) + 1) & 0x1FF; + if (cpcr.out_of_bounds) { + cpcr.pt = (PointU16){ .x = spr_xpos_lo[k] , .y = spr_ypos_lo[k] }; + } + return cpcr.pt; } -void Spr029_KoopaKid_IggyLarry_ThrowBall(uint8 k) { // 01fda7 +void Spr029_KoopaKid_IggyLarry_ThrowBall(uint8 k, PointU16 pt) { // 01fda7 uint8 j = 5; while (spr_current_status[j]) { if ((--j & 0x80) != 0) @@ -8698,14 +8922,14 @@ void Spr029_KoopaKid_IggyLarry_ThrowBall(uint8 k) { // 01fda7 InitializeNormalSpriteRAMTables(j); uint8 v2 = spr_table157c[k]; spr_table157c[j] = v2; - SetSprXPos(j, (uint8)(kSpr029_KoopaKid_IggyLarry_BallXDisp[v2] + temp14b8 - 8)); - SetSprYPos(j, temp14ba - 24); + SetSprXPos(j, (uint8)(kSpr029_KoopaKid_IggyLarry_BallXDisp[v2] + (uint8)pt.x - 8)); + SetSprYPos(j, (uint8)pt.y - 24); } -void Spr029_KoopaKid_IggyLarry_Draw(uint8 k) { // 01febc +void Spr029_KoopaKid_IggyLarry_Draw(uint8 k, PointU16 pt) { // 01febc uint8 v1 = spr_table00c2[k]; - R13_ = *((uint8 *)kSpr029_KoopaKid_IggyLarry_TileSize + v1 + 1); - R5_ = v1; + uint8 r13 = *((uint8 *)kSpr029_KoopaKid_IggyLarry_TileSize + v1 + 1); + uint8 r5 = v1; uint8 v2 = spr_oamindex[k]; uint8 v3 = spr_table157c[k]; int8 v4 = v3 & 1; @@ -8713,27 +8937,27 @@ void Spr029_KoopaKid_IggyLarry_Draw(uint8 k) { // 01febc int8 v6 = 0; if (v4) v6 = 0x80; - R2_ = ((uint8)((v5 >> 1) + v6) >> 1) & 0x40 ^ 0x40; - R3_ = 4 * spr_table1602[k]; + uint8 r2 = ((uint8)((v5 >> 1) + v6) >> 1) & 0x40 ^ 0x40; + uint8 r3 = 4 * spr_table1602[k]; int8 v7 = 3; int8 v13; do { v13 = v7; - uint8 v8 = R3_ + v7; + uint8 v8 = r3 + v7; uint8 v12 = v8; - if (R2_) + if (r2) v8 += 48; OamEnt *oam = get_OamEnt(oam_buf, v2); - oam[64].xpos = kSpr029_KoopaKid_IggyLarry_XDisp[v8] + temp14b8 - 8; - oam[64].ypos = kSpr029_KoopaKid_IggyLarry_YDisp[v12] + temp14ba + 96; + oam[64].xpos = kSpr029_KoopaKid_IggyLarry_XDisp[v8] + pt.x - 8; + oam[64].ypos = kSpr029_KoopaKid_IggyLarry_YDisp[v12] + pt.y + 96; uint8 v10 = kSpr029_KoopaKid_IggyLarry_Tiles[v12]; oam[64].charnum = v10; - if (R5_ == 3 && v10 < 5) + if (r5 == 3 && v10 < 5) oam[64].charnum = kSpr029_KoopaKid_IggyLarry_IggyTiles[v10 >> 1]; - uint8 v11 = R13_; + uint8 v11 = r13; if (oam[64].charnum >= 0x4A) v11 = 53; - oam[64].flags = R2_ | v11; + oam[64].flags = r2 | v11; sprites_oamtile_size_buffer[(v2 >> 2) + 64] = *((uint8 *)kSpr029_KoopaKid_IggyLarry_TileSize + (v12 & 3)); v2 += 4; v7 = v13 - 1; @@ -8741,19 +8965,19 @@ void Spr029_KoopaKid_IggyLarry_Draw(uint8 k) { // 01febc FinishOAMWrite(k, 0xFF, 3); } -void Spr029_KoopaKid_IggyLarry_InShellDraw(uint8 k) { // 01ff5b - R13_ = *((uint8 *)kSpr029_KoopaKid_IggyLarry_TileSize + spr_table00c2[k] + 1); +void Spr029_KoopaKid_IggyLarry_InShellDraw(uint8 k, PointU16 pt) { // 01ff5b + uint8 r13 = *((uint8 *)kSpr029_KoopaKid_IggyLarry_TileSize + spr_table00c2[k] + 1); OamEnt *oam = get_OamEnt(oam_buf, 0x70); - oam[64].xpos = temp14b8 - 8; - oam[64].ypos = temp14ba + 96; + oam[64].xpos = pt.x - 8; + oam[64].ypos = pt.y + 96; uint8 v2 = (counter_local_frames >> 1) & 3; oam[64].charnum = kSpr029_KoopaKid_IggyLarry_InShellTiles[v2]; - oam[64].flags = R13_ | kSpr029_KoopaKid_IggyLarry_InShellProp[v2] | 0x30; + oam[64].flags = r13 | kSpr029_KoopaKid_IggyLarry_InShellProp[v2] | 0x30; sprites_oamtile_size_buffer[92] = 2; } -uint8 Spr0A7_IggyBall_CheckTiltingPlatformCollision(uint8 k) { // 01ff98 - WORD(temp14b4) = GetSprXPos(k) + 8; - WORD(temp14b6) = GetSprYPos(k) + 15; - return CheckTiltingPlatformCollision(); +CheckPlatformCollRet Spr0A7_IggyBall_CheckTiltingPlatformCollision(uint8 k) { // 01ff98 + uint16 temp14b4 = GetSprXPos(k) + 8; + uint16 temp14b6 = GetSprYPos(k) + 15; + return CheckTiltingPlatformCollision(temp14b4, temp14b6); } diff --git a/src/smw_02.c b/src/smw_02.c index 0a0130c..4d85059 100644 --- a/src/smw_02.c +++ b/src/smw_02.c @@ -95,9 +95,413 @@ void (*kProcessClusterSprites_ClusterSpritePtrs[9])(uint8 k) = { &ClusterSpr06_SumoBroFlame, &ClusterSpr07_ReappearingBoo, &ClusterSpr03_BooCeiling, - }; +static const uint8 kBobOmbExplosion_BombExplosionX[10] = { 0x0, 0x8, 0x6, 0xfa, 0xf8, 0x6, 0x8, 0x0, 0xf8, 0xfa, }; +static const uint8 kBobOmbExplosion_BombExplosionY[10] = { 0xf8, 0xfe, 0x6, 0x6, 0xfe, 0xfa, 0x2, 0x8, 0x2, 0xfa, }; +static const uint8 kGameMode14_InLevel_DATA_028178[87] = { 0xf8, 0x38, 0x78, 0xb8, 0x0, 0x10, 0x20, 0xd0, 0xe0, 0x10, 0x40, 0x80, 0xc0, 0x10, 0x10, 0x20, 0xb0, 0x20, 0x50, 0x60, 0xc0, 0xf0, 0x80, 0xb0, 0x20, 0x60, 0xa0, 0xe0, 0x70, 0xf0, 0x70, 0xb0, 0xf0, 0x10, 0x20, 0x50, 0x60, 0x90, 0xa0, 0xd0, 0xe0, 0x10, 0x20, 0x50, 0x60, 0x90, 0xa0, 0xd0, 0xe0, 0x10, 0x20, 0x50, 0x60, 0x90, 0xa0, 0xd0, 0xe0, 0x50, 0x60, 0xc0, 0xd0, 0x30, 0x40, 0x70, 0x80, 0xb0, 0xc0, 0x30, 0x40, 0x70, 0x80, 0xb0, 0xc0, 0x40, 0x50, 0x80, 0x90, 0xc8, 0xd8, 0x30, 0x40, 0xa0, 0xb0, 0x58, 0x68, 0xb0, 0xc0, }; +static const uint8 kGameMode14_InLevel_DATA_0281CF[87] = { 0x70, 0x70, 0x70, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, 0x70, 0x80, 0x80, 0x80, 0x90, 0x90, 0x90, 0xa0, 0x50, 0x60, 0x60, 0x70, 0x70, 0x70, 0x70, 0x60, 0x60, 0x70, 0x70, 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x30, 0x30, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x70, 0x70, 0x78, 0x78, 0x70, 0x70, 0x80, 0x80, 0x88, 0x88, 0xa0, 0xa0, 0xa0, 0xa0, }; +static const uint8 kGameMode14_InLevel_DATA_028226[87] = { 0xe8, 0xe8, 0xe8, 0xe8, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xee, 0xee, 0xee, 0xee, 0xee, 0xc0, 0xc2, 0xc0, 0xc2, 0xc0, 0xc2, 0xc0, 0xc2, 0xe0, 0xe2, 0xe0, 0xe2, 0xe0, 0xe2, 0xe0, 0xe2, 0xc4, 0xa4, 0xc4, 0xa4, 0xc4, 0xa4, 0xc4, 0xa4, 0xcc, 0xce, 0xcc, 0xce, 0xc8, 0xca, 0xc8, 0xca, 0xc8, 0xca, 0xca, 0xc8, 0xca, 0xc8, 0xca, 0xc8, 0xcc, 0xce, 0xcc, 0xce, 0xcc, 0xce, 0xcc, 0xce, 0xcc, 0xce, 0xcc, 0xce, 0xcc, 0xce, }; +static const uint8 kGameMode14_InLevel_DATA_0283C8[4] = { 0x0, 0x4, 0x8, 0xc, }; +static const uint8 kGameMode14_InLevel_DATA_0283CC[2] = { 0xc, 0x30, }; +static const uint8 kSpawnLavaSplash_InitialXSpeed[8] = { 0x4, 0xfc, 0x6, 0xfa, 0x8, 0xf8, 0xa, 0xf6, }; +static const uint8 kSpawnLavaSplash_InitialYSpeed[8] = { 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe6, 0xe8, 0xea, }; +static const uint8 kSpawnLavaSplash_InitialAnimationFrameCounter[8] = { 0x1f, 0x13, 0x10, 0x1c, 0x17, 0x1a, 0xf, 0x1e, }; +static const uint8 kSpawnBounceSprite_BlockBounceYSpeed[4] = { 0xc0, 0x0, 0x0, 0x40, }; +static const uint8 kSpawnBounceSprite_BlockBounceXSpeed[4] = { 0x0, 0x40, 0xc0, 0x0, }; +static const uint8 kSpawnBrickPieces_ylo[4] = { 0x0, 0x0, 0x8, 0x8, }; +static const uint8 kSpawnBrickPieces_xlo[4] = { 0x0, 0x8, 0x0, 0x8, }; +static const uint8 kSpawnBrickPieces_InitialYSpeed[4] = { 0xfb, 0xfb, 0xfd, 0xfd, }; +static const uint8 kSpawnBrickPieces_InitialXSpeed[4] = { 0xff, 0x1, 0xff, 0x1, }; +static const uint8 kSpawnBounceSprite_BlockBounce[9] = { 0x0, 0x3, 0x0, 0x0, 0x1, 0x7, 0x0, 0x4, 0xa, }; +static const uint8 kSpawnBounceSprite_DATA_0288A1[2] = { 0x35, 0x78, }; +static const uint8 kSpawnBounceSprite_SpriteInBlock[34] = { 0x0, 0x74, 0x75, 0x76, 0x77, 0x78, 0x0, 0x0, 0x79, 0x0, 0x3e, 0x7d, 0x2c, 0x4, 0x81, 0x45, 0x80, 0x0, 0x74, 0x75, 0x76, 0x77, 0x78, 0x0, 0x0, 0x79, 0x0, 0x3e, 0x7d, 0x2c, 0x4, 0x81, 0x45, 0x80, }; +static const uint8 kSpawnBounceSprite_StatusOfSprInBlk[17] = { 0x0, 0x8, 0x8, 0x8, 0x8, 0x8, 0x0, 0x0, 0x8, 0x0, 0x9, 0x8, 0x9, 0x9, 0x8, 0x8, 0x9, }; +static const uint8 kSpawnBounceSprite_DATA_0288D6[3] = { 0x80, 0x7e, 0x7d, }; +static const uint8 kSpawnBounceSprite_DATA_0288D9[3] = { 0x9, 0x8, 0x8, }; +static const uint8 kSpawnBounceSprite_DATA_028A42[2] = { 0x6, 0x2, }; +static const uint8 kGameMode14_InLevel_DATA_028AA9[8] = { 0x7, 0x3, 0x3, 0x1, 0x1, 0x1, 0x1, 0x1, }; +static const uint8 kMinorExtendedSpriteOAMIndexes[12] = { 0x50, 0x54, 0x58, 0x5c, 0x60, 0x64, 0x68, 0x6c, 0x70, 0x74, 0x78, 0x7c, }; +static const uint8 kMExtSpr01_BrickPiece_Tiles[8] = { 0x3c, 0x3d, 0x3d, 0x3c, 0x3c, 0x3d, 0x3d, 0x3c, }; +static const uint8 kMExtSpr01_BrickPiece_Flip[8] = { 0x0, 0x0, 0x80, 0x80, 0x80, 0xc0, 0x40, 0x0, }; +static const uint8 kSpr035_Yoshi_DATA_028C09[2] = { 0x40, 0xc0, }; +static const uint8 kSpr035_Yoshi_DATA_028C0B[2] = { 0xc, 0xfc, }; +static const uint8 kSpr035_Yoshi_DATA_028C0D[2] = { 0x0, 0xff, }; +static const uint8 kMExtSpr0B_UnusedYoshiSmoke_Tiles[4] = { 0x66, 0x66, 0x64, 0x62, }; +static const uint8 kMExtSpr0A_BooStream_Tiles[12] = { 0x88, 0xa8, 0xaa, 0x8c, 0x8e, 0xae, 0x88, 0xa8, 0xaa, 0x8c, 0x8e, 0xae, }; +static const uint8 kMExtSpr07_WaterSplash_Tiles[13] = { 0x68, 0x68, 0x6a, 0x6a, 0x6a, 0x62, 0x62, 0x62, 0x64, 0x64, 0x64, 0x64, 0x66, }; +static const uint8 kMExtSpr06_RipVanFishZ_Tiles[4] = { 0xf1, 0xf0, 0xe1, 0xe0, }; +static const uint8 kMExtSpr02_SmallStar_Tiles[6] = { 0x66, 0x6e, 0xff, 0x6d, 0x6c, 0x5c, }; +static const uint8 kMExtSpr04_PodobooFire_Tiles[4] = { 0xd7, 0xc7, 0xd6, 0xc6, }; +static const uint8 kBounceSpr07_SpinningTurnBlock_YAcceleration[4] = { 0x13, 0x0, 0x0, 0xed, }; +static const uint8 kBounceSpr01_TurnBlock_YAcceleration[4] = { 0x10, 0x0, 0x0, 0xf0, }; +static const uint8 kBounceSpr01_TurnBlock_XAcceleration[4] = { 0x0, 0xf0, 0x10, 0x0, }; +static const uint8 kBounceSpr01_TurnBlock_DATA_0290D6[4] = { 0x80, 0x80, 0x80, 0x0, }; +static const uint8 kBounceSpr01_TurnBlock_DATA_0290DA[4] = { 0x80, 0xe0, 0x20, 0x80, }; +static const uint8 kBounceSpriteGFXRt_OAMIndex[4] = { 0x10, 0x14, 0x18, 0x1c, }; +static const uint8 kBounceSpriteGFXRt_Tiles[7] = { 0x40, 0x6b, 0x2a, 0x42, 0xea, 0x8a, 0x40, }; +static const uint8 kCheckPlayerAttackToNormalSpriteColl_DATA_029392[2] = { 0xf8, 0x8, }; +static const uint8 kHandleCapeLevelColl_DATA_02953C[2] = { 0x8, 0x8, }; +static const uint8 kHandleCapeLevelColl_DATA_02953E[2] = { 0x2, 0xe, }; +static const uint8 kCheckPlayerAttackToNormalSpriteColl_DATA_029657[2] = { 0xfc, 0xe0, }; +static const uint8 kCheckPlayerAttackToNormalSpriteColl_DATA_029658[2] = { 0xff, 0xff, }; +static const uint8 kCheckPlayerAttackToNormalSpriteColl_DATA_02965A[2] = { 0x18, 0x50, }; +static const uint8 kCheckPlayerAttackToNormalSpriteColl_DATA_02965C[2] = { 0xfc, 0xf8, }; +static const uint8 kCheckPlayerAttackToNormalSpriteColl_DATA_02965E[2] = { 0xff, 0xff, }; +static const uint8 kCheckPlayerAttackToNormalSpriteColl_DATA_029660[2] = { 0x18, 0x10, }; +static const uint8 kSmokeSpriteOAMIndexes_One[4] = { 0x20, 0x24, 0x28, 0x2c, }; +static const uint8 kSmokeSpriteOAMIndexes_Two[4] = { 0x90, 0x94, 0x98, 0x9c, }; +static const uint8 kSmokeSpr01_PuffOfSmoke_Tiles[7] = { 0x66, 0x66, 0x64, 0x62, 0x60, 0x62, 0x60, }; +static const uint8 kSmokeSpr05_Glitter_DATA_0298C2[4] = { 0x4, 0x8, 0x4, 0x0, }; +static const uint8 kSmokeSpr05_Glitter_DATA_0298C6[4] = { 0xfc, 0x4, 0xc, 0x4, }; +static const uint8 kSmokeSpr03_TurnAroundSmoke_Tiles[5] = { 0x66, 0x66, 0x64, 0x62, 0x62, }; +static const uint8 kProcessSpinningCoinSprites_DATA_0299E9[8] = { 0x30, 0x38, 0x40, 0x48, 0xec, 0xea, 0xe8, 0xec, }; +static const uint8 kProcessSpinningCoinSprites_RollingCoinTiles[3] = { 0xea, 0xfa, 0xea, }; +static const uint8 kSpawnYoshiStompSmoke_InitialXLo[2] = { 0x8, 0xf8, }; +static const uint8 kSpawnYoshiStompSmoke_InitialXHi[2] = { 0x0, 0xff, }; +static const uint8 kSpawnYoshiStompSmoke_InitialXSpeed[2] = { 0x18, 0xe8, }; +static const uint8 kExtSpr0F_SmokeTrail_Tiles[11] = { 0x66, 0x64, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, }; +// todo: oob read +static const uint8 kExtSpr10_SpinJumpStars_DATA_029CB0[6] = { 0xff, 0x7, 0x1, 0x0, 0x0, 0xa5 }; +static const uint8 kExtSpr09_Unused_DATA_029D5E[16] = { 0x0, 0x1, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x1, 0x0, }; +static const uint8 kExtSpr09_Unused_XDisp[12] = { 0x10, 0xf8, 0x3, 0x10, 0xf8, 0x3, 0x10, 0xf0, 0xff, 0x10, 0xf0, 0xff, }; +static const uint8 kExtSpr09_Unused_YDisp[12] = { 0x2, 0x2, 0xee, 0x2, 0x2, 0xee, 0xfe, 0xfe, 0xe6, 0xfe, 0xfe, 0xe6, }; +static const uint8 kExtSpr09_Unused_Tiles[12] = { 0xb3, 0xb3, 0xb1, 0xb2, 0xb2, 0xb0, 0x8e, 0x8e, 0xa8, 0x8c, 0x8c, 0x88, }; +static const uint8 kExtSpr09_Unused_Prop[3] = { 0x69, 0x29, 0x29, }; +static const uint8 kExtSpr09_Unused_TileSize[4] = { 0x0, 0x0, 0x2, 0x2, }; +static const uint8 kExtSpr08_LauncherArm_YSpeed[3] = { 0x8, 0x0, 0xf8, }; +static const uint8 kExtSpr07_LavaSplash_Tiles[4] = { 0xd7, 0xc7, 0xd6, 0xc6, }; +static const uint8 kExtSpr12_BreathBubble_XDisp[4] = { 0x0, 0x1, 0x0, 0xff, }; +static const uint8 kExtSpr05_MarioFireball_DATA_029F99[9] = { 0x0, 0xb8, 0xc0, 0xc8, 0xd0, 0xd8, 0xe0, 0xe8, 0xf0, }; +static const uint8 kExtSpr05_MarioFireball_DATA_029FA2[13] = { 0x0, 0x5, 0x3, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0xF8,0xFC, 0xA0,0xA4 }; +static const uint8 kCheckPlayerFireballToNormalSpriteColl_FireKillXSpeed[2] = { 0xf0, 0x10, }; +static const uint8 kExtendedSpriteOAMIndexes[8] = { 0x90, 0x94, 0x98, 0x9c, 0xa0, 0xa4, 0xa8, 0xac, }; +static const uint8 kGenericExtendedSpriteGFXRt_FireballTiles[4] = { 0x2c, 0x2d, 0x2c, 0x2d, }; +static const uint8 kGenericExtendedSpriteGFXRt_DATA_02A15F[4] = { 0x4, 0x4, 0xc4, 0xc4, }; +static const uint8 kExtSpr02_ReznorFireball_Tiles[4] = { 0x26, 0x2a, 0x26, 0x2a, }; +static const uint8 kExtSpr02_ReznorFireball_Prop[4] = { 0x35, 0x35, 0xf5, 0xf5, }; +static const uint8 kExtSpr03_FlameRemnant_Tiles[2] = { 0xac, 0xad, }; +static const uint8 kExtSpr04_Hammer_Tiles[8] = { 0x8, 0x6d, 0x6d, 0x8, 0x8, 0x6d, 0x6d, 0x8, }; +static const uint8 kExtSpr04_Hammer_Prop[8] = { 0x47, 0x47, 0x7, 0x7, 0x87, 0x87, 0xc7, 0xc7, }; +static const uint8 kExtSpr01_SmokePuff_Tiles[4] = { 0x66, 0x64, 0x60, 0x62, }; +static const uint8 kExtSpr01_SmokePuff_Prop[4] = { 0x0, 0x40, 0xc0, 0x80, }; +static const uint8 kCheckMarioToExtendedSpriteColl_YoshiXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kGetExtendedSpriteClipping_DATA_02A4E9[12] = { 0x3, 0x3, 0x4, 0x3, 0x4, 0x0, 0x0, 0x0, 0x4, 0x3, 0x3, 0x3, }; +static const uint8 kGetExtendedSpriteClipping_DATA_02A4F5[12] = { 0x3, 0x3, 0x4, 0x3, 0x4, 0x0, 0x0, 0x0, 0x2, 0x3, 0x3, 0x3, }; +static const uint8 kGetExtendedSpriteClipping_DATA_02A501[12] = { 0x1, 0x1, 0x8, 0x1, 0x8, 0x0, 0x0, 0xf, 0x8, 0x1, 0x1, 0x1, }; +static const uint8 kGetExtendedSpriteClipping_DATA_02A50D[12] = { 0x1, 0x1, 0x8, 0x1, 0x8, 0x0, 0x0, 0xf, 0xc, 0x1, 0x1, 0x1, }; +static const uint8 kParseLevelSpriteList_SpriteSlotMax[19] = { 0x9, 0x5, 0x7, 0x7, 0x7, 0x6, 0x7, 0x6, 0x6, 0x9, 0x8, 0x4, 0x7, 0x7, 0x7, 0x8, 0x9, 0x5, 0x5, }; +static const uint8 kParseLevelSpriteList_SpriteSlotMax1[19] = { 0x9, 0x7, 0x7, 0x1, 0x0, 0x1, 0x7, 0x6, 0x6, 0x0, 0x2, 0x0, 0x7, 0x1, 0x7, 0x8, 0x9, 0x7, 0x5, }; +static const uint8 kParseLevelSpriteList_SpriteSlotMax2[19] = { 0x9, 0x7, 0x7, 0x1, 0x0, 0x6, 0x7, 0x6, 0x6, 0x0, 0x2, 0x0, 0x7, 0x1, 0x7, 0x8, 0x9, 0x7, 0x5, }; +static const uint8 kParseLevelSpriteList_SpriteSlotStart[19] = { 0xff, 0xff, 0x0, 0x1, 0x0, 0x1, 0xff, 0x1, 0xff, 0x0, 0xff, 0x0, 0xff, 0x1, 0xff, 0xff, 0xff, 0xff, 0xff, }; +static const uint8 kParseLevelSpriteList_SpriteSlotStart1[19] = { 0xff, 0x5, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x5, 0xff, }; +static const uint8 kParseLevelSpriteList_ReservedSprite1[18] = { 0xff, 0x5f, 0x54, 0x5e, 0x60, 0x28, 0x88, 0xff, 0xff, 0xc5, 0x86, 0x28, 0xff, 0x90, 0xff, 0xff, 0xff, 0xae, }; +static const uint8 kParseLevelSpriteList_ReservedSprite2[18] = { 0xff, 0x64, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, }; +static const uint8 kParseLevelSpriteList_DATA_02A7F6[3] = { 0xd0, 0x0, 0x20, }; +static const uint8 kParseLevelSpriteList_DATA_02A7F9[3] = { 0xff, 0x0, 0x1, }; +static const uint8 kSpr0E5_LoadReappearingBoo_DATA_02AA0B[20] = { 0x31, 0x71, 0xa1, 0x43, 0x93, 0xc3, 0x14, 0x65, 0xe5, 0x36, 0xa7, 0x39, 0x99, 0xf9, 0x1a, 0x7a, 0xda, 0x4c, 0xad, 0xed, }; +static const uint8 kSpr0E5_LoadReappearingBoo_DATA_02AA1F[20] = { 0x1, 0x51, 0x91, 0xd1, 0x22, 0x62, 0xa2, 0x73, 0xe3, 0xc7, 0x88, 0x29, 0x5a, 0xaa, 0xeb, 0x2c, 0x8c, 0xcc, 0xfc, 0x5d, }; +static const uint8 kSpr0E6_LoadCandleFlames_xlo[4] = { 0x50, 0x90, 0xd0, 0x10, }; +static const uint8 kProcessScoreSprites_LeftTiles[22] = { 0x0, 0x83, 0x83, 0x83, 0x83, 0x44, 0x54, 0x46, 0x47, 0x44, 0x54, 0x46, 0x47, 0x56, 0x29, 0x39, 0x38, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, }; +static const uint8 kProcessScoreSprites_RightTiles[22] = { 0x0, 0x44, 0x54, 0x46, 0x47, 0x45, 0x45, 0x45, 0x45, 0x55, 0x55, 0x55, 0x55, 0x57, 0x57, 0x57, 0x57, 0x4e, 0x44, 0x4f, 0x54, 0x5d, }; +static const uint8 kProcessScoreSprites_PointMultiplierLo[17] = { 0x0, 0x1, 0x2, 0x4, 0x8, 0xa, 0x14, 0x28, 0x50, 0x64, 0xc8, 0x90, 0x20, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kProcessScoreSprites_PointMultiplierHi[17] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x3, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kProcessScoreSprites_UpdateSpeedFrameIndex[4] = { 0x3, 0x1, 0x0, 0x0, }; +static const uint8 kProcessScoreSprites_OAMIndex[6] = { 0xb0, 0xb8, 0xc0, 0xc8, 0xd0, 0xd8, }; +static const uint8 kProcessScoreSprites_StuffToGive[11] = { 1, 2, 3, 5, 5, 0xA, 0xF,0x14,0x19, 4, 6, }; +static const uint8 kSpr0E0_Load3Platforms_InitialAngleLo[3] = { 0x0, 0xaa, 0x54, }; +static const uint8 kSpr0E0_Load3Platforms_InitialAngleHi[3] = { 0x0, 0x0, 0x1, }; +static const uint8 kSpr0DE_Load5Eeries_xlo[5] = { 0xe0, 0xf0, 0x0, 0x10, 0x20, }; +static const uint8 kSpr0DE_Load5Eeries_xhi[5] = { 0xff, 0xff, 0x0, 0x0, 0x0, }; +static const uint8 kSpr0DE_Load5Eeries_InitialYSpeed[5] = { 0x17, 0xe9, 0x17, 0xe9, 0x17, }; +static const uint8 kSpr0DE_Load5Eeries_InitialVerticalDirection[5] = { 0x0, 0x1, 0x0, 0x1, 0x0, }; +static const uint8 kSpr0DE_Load5Eeries_InitialXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kGenSpr0C_GenerateSurroundingBullets_DATA_02B0C9[2] = { 0x4, 0x8, }; +static const uint8 kGenSpr0C_GenerateSurroundingBullets_DATA_02B0CB[2] = { 0x4, 0x3, }; +static const uint8 kGenSpr0C_GenerateSurroundingBullets_InitialXLo[9] = { 0x0, 0x0, 0x40, 0xc0, 0xf0, 0x0, 0x0, 0xf0, 0xf0, }; +static const uint8 kGenSpr0C_GenerateSurroundingBullets_InitialYLo[9] = { 0x50, 0xb0, 0xe0, 0xe0, 0x80, 0x0, 0xe0, 0xe0, 0x0, }; +static const uint8 kGenSpr0C_GenerateSurroundingBullets_InitialFiringDirection[9] = { 0x0, 0x0, 0x2, 0x2, 0x1, 0x5, 0x4, 0x7, 0x6, }; +static const uint8 kGenSpr07_GenerateFish_DATA_02B153[4] = { 0x10, 0x18, 0x20, 0x28, }; +static const uint8 kGenSpr07_GenerateFish_DATA_02B157[4] = { 0x18, 0x1a, 0x1c, 0x1e, }; +static const uint8 kGenSpr09_GenerateSuperKoopa_InitialXLo[2] = { 0xe0, 0x10, }; +static const uint8 kGenSpr09_GenerateSuperKoopa_InitialXHi[2] = { 0xff, 0x1, }; +static const uint8 kGenSpr0A_GenerateBubbles_DATA_02B25A[4] = { 0x0, 0x1, 0x2, 0x0, }; +static const uint8 kGenSprXX_GenerateDolphins_InitialXLo[2] = { 0x10, 0xe0, }; +static const uint8 kGenSprXX_GenerateDolphins_InitialXHi[2] = { 1, -1, }; +static const uint8 kGenSprXX_GenerateDolphins_InitialXSpeed[2] = { -24, 24 }; +static const uint8 kGenSprXX_GenerateDolphins_InitialYSpeed[4] = { 0xf0, 0xe0, 0x0, 0x10, }; +static const uint8 kGenSprXX_GenerateDolphins_DATA_02B268[2] = { 4, 9 }; +static const uint8 kGenSprXX_GenerateDolphins_DATA_02B26A[2] = { -1, 4 }; +static const uint8 kGenSpr01_GenerateEerie_InitialXLo[2] = { 0xf0, 0xff, }; +static const uint8 kGenSpr01_GenerateEerie_InitialXHi[2] = { 0xff, 0x0, }; +static const uint8 kGenSpr01_GenerateEerie_InitialXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kGenSprXX_GenerateParachuteEnemies_SpriteToSpawn[6] = { 0x3f, 0x40, 0x3f, 0x3f, 0x40, 0x40, }; +static const uint8 kGenSprXX_GenerateParachuteEnemies_InitialXSpeed[4] = { 0xfa, 0xfb, 0xfc, 0xfd, }; +static const uint8 kShooterSpr02_TorpedoShooter_InitialXSpeed[2] = { 0x1, 0xff, }; +static const uint8 kShooterSpr01_BulletBillShooter_ShooterSmokeDispX[2] = { 0xf4, 0xc, }; +static const uint8 kSpr070_Pokey_PokeyClipIndex[6] = { 0x1b, 0x1b, 0x1a, 0x19, 0x18, 0x17, }; +static const uint8 kSpr070_Pokey_DATA_02B653[4] = { 0x1, 0x2, 0x4, 0x8, }; +static const uint8 kSpr070_Pokey_DATA_02B657[4] = { 0x0, 0x1, 0x3, 0x7, }; +static const uint8 kSpr070_Pokey_DATA_02B65B[4] = { 0xff, 0xfe, 0xfc, 0xf8, }; +static const uint8 kSpr070_Pokey_XDisp[4] = { 0x0, 0x1, 0x0, 0xff, }; +static const uint8 kSpr070_Pokey_XSpeed[2] = { 0x2, 0xfe, }; +static const uint8 kSpr070_Pokey_DATA_02B665[13] = { 0x0, 0x5, 0x9, 0xc, 0xe, 0xf, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, }; +static const uint8 kSpr070_Pokey_PokeyUnsetBit[5] = { 0xef, 0xf7, 0xfb, 0xfd, 0xfe, }; +static const uint8 kSpr070_Pokey_DATA_02B829[5] = { 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, }; +static const uint8 kSpr044_TorpedoTed_MaxSpeed[2] = { 0x20, 0xf0, }; +static const uint8 kSpr044_TorpedoTed_Acceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr044_TorpedoTed_XDisp[3] = { 0x10, 0x0, 0x10, }; +static const uint8 kSpr044_TorpedoTed_Prop[2] = { 0x40, 0x0, }; +static const uint8 kSpr044_TorpedoTed_DATA_02B94E[2] = { 0xf4, 0x1c, }; +static const uint8 kSpr044_TorpedoTed_DATA_02B950[2] = { 0xff, 0x0, }; +static const uint8 kSpr035_Yoshi_DATA_02BB0B[4] = { 0x2, 0xfa, 0x6, 0x6, }; +static const uint8 kSpr035_Yoshi_DATA_02BB0F[4] = { 0x0, 0xff, 0x0, 0x0, }; +static const uint8 kSpr035_Yoshi_DATA_02BB13[4] = { 0x10, 0x8, 0x10, 0x8, }; +static const uint8 kSpr035_Yoshi_Tiles[4] = { 0x5d, 0xc6, 0x5d, 0xc6, }; +static const uint8 kSpr035_Yoshi_Prop[4] = { 0x46, 0x46, 0x6, 0x6, }; +static const uint8 kSpr035_Yoshi_TileSize[4] = { 0x0, 0x2, 0x0, 0x2, }; +static const uint8 kSprXXX_Dolphins_XAcceleration[6] = { 0xff, 0x1, 0xff, 0x1, 0x0, 0x0, }; +static const uint8 kSprXXX_Dolphins_MaxXSpeed[6] = { 0xe8, 0x18, 0xf8, 0x8, 0x0, 0x0, }; +static const uint8 kSprXXX_Dolphins_Tiles1[2] = { 0xe2, 0x88, }; +static const uint8 kSprXXX_Dolphins_Tiles2[2] = { 0xe7, 0xa8, }; +static const uint8 kSprXXX_Dolphins_Tiles3[2] = { 0xe8, 0xa9, }; +static const uint8 kSprXXX_WallFollowers_XSpeed[8] = { 0x8, 0x0, 0xf8, 0x0, 0xf8, 0x0, 0x8, 0x0, }; +static const uint8 kSprXXX_WallFollowers_YSpeed[8] = { 0x0, 0x8, 0x0, 0xf8, 0x0, 0x8, 0x0, 0xf8, }; +static const uint8 kSprXXX_WallFollowers_DATA_02BC9F[8] = { 0x1, 0xff, 0xff, 0x1, 0xff, 0x1, 0x1, 0xff, }; +static const uint8 kSprXXX_WallFollowers_DATA_02BCA7[8] = { 0x1, 0x1, 0xff, 0xff, 0x1, 0x1, 0xff, 0xff, }; +static const uint8 kSprXXX_WallFollowers_DATA_02BCAF[8] = { 0x1, 0x4, 0x2, 0x8, 0x2, 0x4, 0x1, 0x8, }; +static const uint8 kSprXXX_WallFollowers_SpikeTopAnimationFramesOffset[16] = { 0x0, 0x2, 0x0, 0x2, 0x0, 0x2, 0x0, 0x2, 0x5, 0x4, 0x5, 0x4, 0x5, 0x4, 0x5, 0x4, }; +static const uint8 kSprXXX_WallFollowers_SpikeTopDirection[16] = { 0x0, 0xc0, 0xc0, 0x0, 0x40, 0x80, 0x80, 0x40, 0x80, 0xc0, 0x40, 0x0, 0xc0, 0x80, 0x0, 0x40, }; +static const uint8 kSprXXX_WallFollowers_UrchinAnimationFrames[4] = { 0x0, 0x1, 0x2, 0x1, }; +static const uint8 kSprXXX_WallFollowers_FuzzyProp[2] = { 0x5, 0x45, }; +static const uint8 kSprXXX_WallFollowers_HotheadXDisp[4] = { 0xf8, 0x8, 0xf8, 0x8, }; +static const uint8 kSprXXX_WallFollowers_HotheadYDisp[4] = { 0xf8, 0xf8, 0x8, 0x8, }; +static const uint8 kSprXXX_WallFollowers_HotheadTiles[8] = { 0xc, 0xe, 0xe, 0xc, 0xe, 0xc, 0xc, 0xe, }; +static const uint8 kSprXXX_WallFollowers_HotheadProp[8] = { 0x5, 0x5, 0xc5, 0xc5, 0x45, 0x45, 0x85, 0x85, }; +static const uint8 kSprXXX_WallFollowers_HotheadEyesXDisp[8] = { 0x7, 0x7, 0x1, 0x1, 0x1, 0x1, 0x7, 0x7, }; +static const uint8 kSprXXX_WallFollowers_HotheadEyesYDisp[8] = { 0x0, 0x8, 0x8, 0x0, 0x0, 0x8, 0x8, 0x0, }; +static const uint8 kSprXXX_WallFollowers_UrchinXDisp[5] = { 0x8, 0x0, 0x10, 0x0, 0x10, }; +static const uint8 kSprXXX_WallFollowers_UrchinYDisp[5] = { 0x8, 0x0, 0x0, 0x10, 0x10, }; +static const uint8 kSprXXX_WallFollowers_UrchinProp[5] = { 0x37, 0x37, 0x77, 0xb7, 0xf7, }; +static const uint8 kSprXXX_WallFollowers_UrchinTiles[4] = { 0xc4, 0xc6, 0xc8, 0xc6, }; +static const uint8 kSpr03D_RipVanFish_MaxSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr03D_RipVanFish_Acceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr091_CharginChuck_DATA_02C132[4] = { 0x30, 0x20, 0xa, 0x30, }; +static const uint8 kSpr091_CharginChuck_DATA_02C136[4] = { 0x5, 0xe, 0xf, 0x10, }; +static const uint8 kSpr091_CharginChuck_DigginChuckRockInitialXPosLo[2] = { 0x14, 0xec, }; +static const uint8 kSpr091_CharginChuck_DigginChuckRockInitialXPosHi[2] = { 0x0, 0xff, }; +static const uint8 kSpr091_CharginChuck_DigginChuckRockInitialXSpeed[2] = { 0x8, 0xf8, }; +static const uint8 kSpr091_CharginChuck_DATA_02C1F3[2] = { 0x1, 0x3, }; +static const uint8 kSpr091_CharginChuck_DATA_02C213[4] = { 0x1, 0x2, 0x3, 0x2, }; +static const uint8 kSpr091_CharginChuck_MaxYSpeed[2] = { 0x40, 0x10, }; +static const uint8 kSpr091_CharginChuck_YAcceleration[2] = { 0x3, 0x1, }; +static const uint8 kSpr091_CharginChuck_DATA_02C373[8] = { 0x5, 0x5, 0x5, 0x2, 0x2, 0x6, 0x6, 0x6, }; +static const uint8 kSpr091_CharginChuck_DATA_02C3B3[4] = { 0x7f, 0xbf, 0xff, 0xdf, }; +static const uint8 kSpr091_CharginChuck_DATA_02C3B7[4] = { 0x18, 0x19, 0x14, 0x14, }; +static const uint8 kSpr091_CharginChuck_DATA_02C3BB[16] = { 0x18, 0x18, 0x18, 0x18, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x16, 0x15, 0x15, 0x16, 0x16, 0x16, }; +static const uint8 kSpr091_CharginChuck_BaseballInitialXPosLo[2] = { 0x10, 0xf8, }; +static const uint8 kSpr091_CharginChuck_BaseballInitialXPosHi[2] = { 0x0, 0xff, }; +static const uint8 kSpr091_CharginChuck_BaseballInitialXSpeed[2] = { 0x18, 0xe8, }; +static const uint8 kSpr091_CharginChuck_DATA_02C4B5[8] = { 0x0, 0x0, 0x11, 0x11, 0x11, 0x11, 0x0, 0x0, }; +static const uint8 kSpr091_CharginChuck_SplittingInitialXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr091_CharginChuck_JumpingInitialXSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr091_CharginChuck_DATA_02C62E[11] = { 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x4, 0x4, 0x4, }; +static const uint8 kSpr091_CharginChuck_DATA_02C639[2] = { 0x0, 0x4, }; +static const uint8 kSpr091_CharginChuck_DATA_02C666[2] = { 0x1, 0xff, }; +static const uint8 kSpr091_CharginChuck_ChargingXSpeed[4] = { 0x10, 0xf0, 0x18, 0xe8, }; +static const uint8 kSpr091_CharginChuck_DATA_02C6A3[4] = { 0x12, 0x13, 0x12, 0x13, }; +static const uint8 kSpr091_CharginChuck_DATA_02C73D[7] = { 0xa, 0xb, 0xa, 0xc, 0xd, 0xc, 0xc }; +static const uint8 kSpr091_CharginChuck_HurtAnimationFrameCounter[6] = { 0x10, 0x10, 0x4, 0x8, 0x10, 0x18, }; +static const uint8 kSpr091_CharginChuck_StompKnockbackXSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr091_CharginChuck_HeadXDisp[26] = { 0xf8, 0xf8, 0xf8, 0x0, 0x0, 0xfe, 0x0, 0x0, 0xfa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfd, 0xfd, 0xf9, 0xf6, 0xf6, 0xf8, 0xfe, 0xfc, 0xfa, 0xf8, 0xfa, }; +static const uint8 kSpr091_CharginChuck_HeadYDisp[26] = { 0xf8, 0xf9, 0xf7, 0xf8, 0xfc, 0xf8, 0xf4, 0xf5, 0xf5, 0xfc, 0xfd, 0x0, 0xf9, 0xf5, 0xf8, 0xfa, 0xf6, 0xf6, 0xf4, 0xf4, 0xf8, 0xf6, 0xf6, 0xf8, 0xf8, 0xf5, }; +static const uint8 kSpr091_CharginChuck_HeadOAMIndexOffset[26] = { 0x8, 0x8, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x0, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x10, 0x10, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, }; +static const uint8 kSpr091_CharginChuck_HeadTiles[7] = { 0x6, 0xa, 0xe, 0xa, 0x6, 0x4b, 0x4b, }; +static const uint8 kSpr091_CharginChuck_HeadProp[7] = { 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x40, }; +static const uint8 kSpr091_CharginChuck_BodyXDisp1[52] = { 0xf8, 0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xf8, 0x1, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xf8, 0xf8, 0xf8, 0xf8, 0x8, 0x6, 0xf8, 0xf8, 0x1, 0x10, 0x10, 0x10, 0x4, 0x4, 0x4, 0x4, 0x8, 0x7, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x10, 0x8, 0x8, 0x10, 0x0, 0x2, 0x10, 0x10, 0x7, }; +static const uint8 kSpr091_CharginChuck_BodyXDisp2[52] = { 0x0, 0x0, 0x0, 0x4, 0x4, 0x4, 0x4, 0x8, 0x0, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfc, 0xfc, 0xfc, 0xfc, 0xf8, 0x0, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr091_CharginChuck_BodyYDisp1[26] = { 0x6, 0x6, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x6, 0xf8, 0xf8, 0x0, 0x0, 0xf8, }; +static const uint8 kSpr091_CharginChuck_BodyTiles1[26] = { 0xd, 0x34, 0x35, 0x26, 0x2d, 0x28, 0x40, 0x42, 0x5d, 0x2d, 0x64, 0x64, 0x64, 0x64, 0xe7, 0x28, 0x82, 0xcb, 0x23, 0x20, 0xd, 0xc, 0x5d, 0xbd, 0xbd, 0x5d, }; +static const uint8 kSpr091_CharginChuck_BodyTiles2[26] = { 0x4e, 0xc, 0x22, 0x26, 0x2d, 0x29, 0x40, 0x42, 0xae, 0x2d, 0x64, 0x64, 0x64, 0x64, 0xe8, 0x29, 0x83, 0xcc, 0x24, 0x21, 0x4e, 0xa0, 0xa0, 0xa2, 0xa4, 0xae, }; +static const uint8 kSpr091_CharginChuck_BodyProp1[26] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr091_CharginChuck_BodyProp2[26] = { 0x0, 0x0, 0x0, 0x40, 0x40, 0x0, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr091_CharginChuck_BodyTileSize1[26] = { 0x0, 0x0, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr091_CharginChuck_BodyOAMIndexOffset[26] = { 0x0, 0x0, 0x0, 0x4, 0x4, 0x4, 0xc, 0xc, 0x0, 0x8, 0x0, 0x0, 0x4, 0x4, 0x4, 0x4, 0x4, 0x0, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr091_CharginChuck_JumpinChuckLeftHandXDisp[2] = { 0xfa, 0x0, }; +static const uint8 kSpr091_CharginChuck_JumpinChuckRightHandXDisp[2] = { 0xe, 0x0, }; +static const uint8 kSpr091_CharginChuck_JumpinChuckHandTiles[2] = { 0xc, 0x44, }; +static const uint8 kSpr091_CharginChuck_JumpinChuckHandsYDisp[2] = { 0xf8, 0xf0, }; +static const uint8 kSpr091_CharginChuck_JumpinChuckHandTileSize[2] = { 0x0, 0x2, }; +static const uint8 kSpr091_CharginChuck_CharginShoulderProp[2] = { 0x47, 0x7, }; +static const uint8 kSpr091_CharginChuck_BaseballXDisp[12] = { 0xfa, 0xa, 0x6, 0x0, 0x0, 0x1, 0xe, 0xfe, 0x2, 0x0, 0x0, 0x9, }; +static const uint8 kSpr091_CharginChuck_BaseballYDisp[6] = { 0x8, 0xf4, 0xf4, 0x0, 0x0, 0xf4, }; +static const uint8 kSpr091_CharginChuck_DigginChuckXDisp[6] = { 0xfc, 0x4, 0x10, 0xf0, 0x12, 0xee, }; +static const uint8 kSpr091_CharginChuck_DigginChuckProp[2] = { 0x47, 0x7, }; +static const uint8 kSpr091_CharginChuck_DigginChuckYDisp[3] = { 0xf8, 0x0, 0xf8, }; +static const uint8 kSpr091_CharginChuck_DigginChuckTiles[3] = { 0xca, 0xe2, 0xa0, }; +static const uint8 kSpr091_CharginChuck_DigginChuckTileSize[3] = { 0x0, 0x2, 0x2, }; +static const uint8 kSpr088_WingedCage_XDisp[4] = { 0x0, 0x30, 0x60, 0x90, }; +static const uint8 kSpr088_WingedCage_YDisp[4] = { 0xf8, 0x0, 0xf8, 0x0, }; +static const uint8 kSpr060_FlatPalaceSwitch_XDisp[8] = { 0x0, 0x8, 0x10, 0x18, 0x0, 0x8, 0x10, 0x18, }; +static const uint8 kSpr060_FlatPalaceSwitch_YDisp[8] = { 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x8, }; +static const uint8 kSpr060_FlatPalaceSwitch_Tile[8] = { 0x0, 0x1, 0x1, 0x0, 0x10, 0x11, 0x11, 0x10, }; +static const uint8 kSpr060_FlatPalaceSwitch_Prop[8] = { 0x31, 0x31, 0x71, 0x71, 0x31, 0x31, 0x71, 0x71, }; +static const uint8 kSpr060_FlatPalaceSwitch_Palette[4] = { 0xa, 0x4, 0x6, 0x8, }; +static const uint8 kSprXXX_WallSpringboard_HighBouncePlayerYSpeed[8] = { 0xb6, 0xb4, 0xb0, 0xa8, 0xa0, 0x98, 0x90, 0x88, }; +static const uint8 kSprXXX_WallSpringboard_AutoBouncePlayerYSpeed[8] = { 0x0, 0x0, 0xe8, 0xe0, 0xd0, 0xc8, 0xc0, 0xb8, }; +static const uint8 kSprXXX_WallSpringboard_XDisp[40] = { 0x0, 0x8, 0x10, 0x18, 0x20, 0x0, 0x8, 0x10, 0x18, 0x20, 0x0, 0x8, 0x10, 0x18, 0x20, 0x0, 0x8, 0x10, 0x18, 0x1f, 0x0, 0x8, 0x10, 0x17, 0x1e, 0x0, 0x8, 0xf, 0x16, 0x1d, 0x0, 0x7, 0xf, 0x16, 0x1c, 0x0, 0x7, 0xe, 0x15, 0x1b, }; +static const uint8 kSprXXX_WallSpringboard_YDisp[40] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x2, 0x0, 0x0, 0x1, 0x2, 0x4, 0x0, 0x1, 0x2, 0x4, 0x6, 0x0, 0x1, 0x3, 0x6, 0x8, 0x0, 0x2, 0x4, 0x8, 0xa, 0x0, 0x2, 0x5, 0x7, 0xc, 0x0, 0x2, 0x5, 0x9, 0xe, }; +static const uint8 kSprXXX_WallSpringboard_MaxAngle[5] = { 0x1, 0x1, 0x3, 0x5, 0x7, }; +static const uint8 kSubOffscreen_Bank02[2] = { 0x40, 0xb0, }; +static const uint8 kSubOffscreen_Bank02_DATA_02D005[2] = { 0x1, 0xff, }; +static const uint8 kSubOffscreen_Bank02_DATA_02D007[8] = { 0x30, 0xc0, 0xa0, 0xc0, 0xa0, 0x70, 0x60, 0xb0, }; +static const uint8 kSubOffscreen_Bank02_DATA_02D00F[8] = { 0x1, 0xff, 0x1, 0xff, 0x1, 0xff, 0x1, 0xff, }; +static const uint8 kSpr035_Yoshi_DATA_02D0D0[2] = { 0x14, 0xfc, }; +static const uint8 kSpr035_Yoshi_DATA_02D0D2[2] = { 0x0, 0xff, }; +static const uint8 kSpr035_Yoshi_DATA_02D1F1[2] = { 0x0, 0x4, }; +static const uint8 kHandleHeldPBalloonAndInLakituCloudMovement_XAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kHandleHeldPBalloonAndInLakituCloudMovement_MaxXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kGetDrawInfo_DATA_02D374[2] = { 0xc, 0x1c, }; +static const uint8 kGetDrawInfo_DATA_02D376[2] = { 0x1, 0x2, }; +static const uint8 kSpr086_Wiggler_StompSounds[7] = { 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, }; +static const uint8 kSpr09F_BanzaiBill_XDisp[16] = { 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, }; +static const uint8 kSpr09F_BanzaiBill_YDisp[16] = { 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, }; +static const uint8 kSpr09F_BanzaiBill_Tiles[16] = { 0x80, 0x82, 0x84, 0x86, 0xa0, 0x88, 0xce, 0xee, 0xc0, 0xc2, 0xce, 0xee, 0x8e, 0xae, 0x84, 0x86, }; +static const uint8 kSpr09F_BanzaiBill_Prop[16] = { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0xb3, 0xb3, }; +static const uint8 kSpr0A3_GreyChainedPlatform_DATA_02D807[4] = { 0xf8, 0x8, 0xf8, 0x8, }; +static const uint8 kSpr0A3_GreyChainedPlatform_DATA_02D80B[4] = { 0xf8, 0xf8, 0x8, 0x8, }; +static const uint8 kSpr0A3_GreyChainedPlatform_DATA_02D80F[4] = { 0x33, 0x73, 0xb3, 0xf3, }; +static const uint8 kSpr0A3_GreyChainedPlatform_DATA_02D840[4] = { 0x0, 0xf0, 0x0, 0x10, }; +static const uint8 kSpr0A3_GreyChainedPlatform_WoodPlatformTiles[4] = { 0xa2, 0x60, 0x61, 0x62, }; +static const uint8 kSpr09D_BubbleWithSprite_BubbleSprTiles1[4] = { 0xa8, 0xca, 0x67, 0x24, }; +static const uint8 kSpr09D_BubbleWithSprite_BubbleSprTiles2[4] = { 0xaa, 0xcc, 0x69, 0x24, }; +static const uint8 kSpr09D_BubbleWithSprite_BubbleSprGfxProp1[4] = { 0x84, 0x85, 0x5, 0x8, }; +static const uint8 kSpr09D_BubbleWithSprite_BubbleSprGfxProp2[2] = { 0x8, 0xf8, }; +static const uint8 kSpr09D_BubbleWithSprite_BubbleSprGfxProp3[2] = { 0x1, 0xff, }; +static const uint8 kSpr09D_BubbleWithSprite_BubbleSprGfxProp4[2] = { 0xc, 0xf4, }; +static const uint8 kSpr09D_BubbleWithSprite_BubbleSprites[4] = { 0xf, 0xd, 0x15, 0x74, }; +static const uint8 kSpr09D_BubbleWithSprite_XDisp[15] = { 0xf8, 0x8, 0xf8, 0x8, 0xff, 0xf9, 0x7, 0xf9, 0x7, 0x0, 0xfa, 0x6, 0xfa, 0x6, 0x0, }; +static const uint8 kSpr09D_BubbleWithSprite_YDisp[15] = { 0xf6, 0xf6, 0x2, 0x2, 0xfc, 0xf5, 0xf5, 0x3, 0x3, 0xfc, 0xf4, 0xf4, 0x4, 0x4, 0xfb, }; +static const uint8 kSpr09D_BubbleWithSprite_Tiles[5] = { 0xa0, 0xa0, 0xa0, 0xa0, 0x99, }; +static const uint8 kSpr09D_BubbleWithSprite_Prop[5] = { 0x7, 0x47, 0x87, 0xc7, 0x3, }; +static const uint8 kSpr09D_BubbleWithSprite_TileSize[5] = { 0x2, 0x2, 0x2, 0x2, 0x0, }; +static const uint8 kSpr09D_BubbleWithSprite_DATA_02D9D2[4] = { 0x0, 0x5, 0xa, 0x5, }; +static const uint8 kSpr09B_HammerBro_HammerFreq[7] = { 0x1f, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, }; +static const uint8 kSpr09B_HammerBro_XDisp[4] = { 0x8, 0x10, 0x0, 0x10, }; +static const uint8 kSpr09B_HammerBro_YDisp[4] = { 0xf8, 0xf8, 0x0, 0x0, }; +static const uint8 kSpr09B_HammerBro_Tiles[8] = { 0x5a, 0x4a, 0x46, 0x48, 0x4a, 0x5a, 0x48, 0x46, }; +static const uint8 kSpr09B_HammerBro_TileSize[4] = { 0x0, 0x0, 0x2, 0x2, }; +static const uint8 kSpr09C_HammerBroPlatform_XAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr09C_HammerBroPlatform_MaxXSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr09C_HammerBroPlatform_YAcceleration[2] = { 0x2, 0xfe, }; +static const uint8 kSpr09C_HammerBroPlatform_MaxYSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr09C_HammerBroPlatform_XDisp[8] = { 0x0, 0x10, 0xf2, 0x1e, 0x0, 0x10, 0xfa, 0x1e, }; +static const uint8 kSpr09C_HammerBroPlatform_YDisp[8] = { 0x0, 0x0, 0xf6, 0xf6, 0x0, 0x0, 0xfe, 0xfe, }; +static const uint8 kSpr09C_HammerBroPlatform_Tiles[8] = { 0x40, 0x40, 0xc6, 0xc6, 0x40, 0x40, 0x5d, 0x5d, }; +static const uint8 kSpr09C_HammerBroPlatform_Prop[8] = { 0x32, 0x32, 0x72, 0x32, 0x32, 0x32, 0x72, 0x32, }; +static const uint8 kSpr09C_HammerBroPlatform_TileSize[8] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, 0x0, }; +static const uint8 kSpr09C_HammerBroPlatform_BounceYDisp[8] = { 0x0, 0x4, 0x6, 0x8, 0x8, 0x6, 0x4, 0x0, }; +static const uint8 kSpr09A_SumoBro_XSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr09A_SumoBro_XDisp[48] = { 0xff, 0x7, 0xfc, 0x4, 0xff, 0x7, 0xfc, 0x4, 0xff, 0xff, 0xfc, 0x4, 0xff, 0xff, 0xfc, 0x4, 0x2, 0x2, 0xf4, 0x4, 0x2, 0x2, 0xf4, 0x4, 0x9, 0x1, 0x4, 0xfc, 0x9, 0x1, 0x4, 0xfc, 0x1, 0x1, 0x4, 0xfc, 0x1, 0x1, 0x4, 0xfc, 0xff, 0xff, 0xc, 0xfc, 0xff, 0xff, 0xc, 0xfc, }; +static const uint8 kSpr09A_SumoBro_YDisp[24] = { 0xf8, 0xf8, 0x0, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0xf8, 0xf0, 0x0, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0xf8, 0xf8, 0x1, 0x0, 0xf8, 0xf8, 0xff, 0x0, }; +static const uint8 kSpr09A_SumoBro_Tiles[24] = { 0x98, 0x99, 0xa7, 0xa8, 0x98, 0x99, 0xaa, 0xab, 0x8a, 0x66, 0xaa, 0xab, 0xee, 0xee, 0xc5, 0xc6, 0x80, 0x80, 0xc1, 0xc3, 0x80, 0x80, 0xc1, 0xc3, }; +static const uint8 kSpr09A_SumoBro_TileSize[24] = { 0x0, 0x0, 0x2, 0x2, 0x0, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, }; +static const uint8 kSpr02B_SumoLightning_FireInitialXPosLo[5] = { 0xfc, 0xc, 0xec, 0x1c, 0xdc, }; +static const uint8 kSpr02B_SumoLightning_FireInitialXPosHi[5] = { 0xff, 0x0, 0xff, 0x0, 0xff, }; +static const uint8 kSpr099_VolcanoLotus_Tiles[3] = { 0x8e, 0x9e, 0xe2, }; +static const uint8 kSpr099_VolcanoLotus_FireInitialXSpeed[4] = { 0x10, 0xf0, 0x6, 0xfa, }; +static const uint8 kSpr099_VolcanoLotus_FireInitialYSpeed[4] = { 0xec, 0xec, 0xe8, 0xe8, }; +static const uint8 kSpr045_DirectionalCoins_XSpeed[4] = { 0x0, 0x0, 0xf0, 0x10, }; +static const uint8 kSpr045_DirectionalCoins_YSpeed[4] = { 0xf0, 0x10, 0x0, 0x0, }; +static const uint8 kSpr045_DirectionalCoins_DATA_02E201[16] = { 0x0, 0x3, 0x2, 0x0, 0x1, 0x3, 0x2, 0x0, 0x0, 0x3, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr045_DirectionalCoins_DATA_02E211[4] = { 0x1, 0x0, 0x3, 0x2, }; +static const uint8 kSpr090_GreenGasBubble_XSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr090_GreenGasBubble_Acceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr090_GreenGasBubble_MaxYSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr090_GreenGasBubble_DATA_02E352[16] = { 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, }; +static const uint8 kSpr090_GreenGasBubble_DATA_02E362[16] = { 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, }; +static const uint8 kSpr090_GreenGasBubble_Tiles[16] = { 0x80, 0x82, 0x84, 0x86, 0xa0, 0xa2, 0xa4, 0xa6, 0xa0, 0xa2, 0xa4, 0xa6, 0x80, 0x82, 0x84, 0x86, }; +static const uint8 kSpr090_GreenGasBubble_Prop[16] = { 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, }; +static const uint8 kSpr090_GreenGasBubble_DATA_02E392[16] = { 0x0, 0x0, 0x2, 0x2, 0x0, 0x0, 0x2, 0x2, 0x1, 0x1, 0x3, 0x3, 0x1, 0x1, 0x3, 0x3, }; +static const uint8 kSpr090_GreenGasBubble_DATA_02E3A2[4] = { 0x0, 0x1, 0x2, 0x1, }; +static const uint8 kSpr090_GreenGasBubble_DATA_02E3A6[4] = { 0x2, 0x1, 0x0, 0x1, }; +static const uint8 kSpr08F_ScalePlatform_MushrmScaleTiles[4] = { 0x2, 0x7, 0x7, 0x2, }; +static const uint8 kSpr052_MovingLedgeHole_XDisp[4] = { 0x0, 0x8, 0x18, 0x20, }; +static const uint8 kSpr052_MovingLedgeHole_Tiles[4] = { 0xeb, 0xea, 0xea, 0xeb, }; +static const uint8 kSpr052_MovingLedgeHole_Prop[4] = { 0x71, 0x31, 0x31, 0x31, }; +static const uint8 kSpr047_SwimmingAndJumpingCheepCheep_XSpeed[2] = { 0x14, 0xec, }; +static const uint8 kSpr049_ShiftingPipe_YSpeed[4] = { 0x0, 0xf0, 0x0, 0x10, }; +static const uint8 kSpr049_ShiftingPipe_DATA_02E839[4] = { 0x20, 0x40, 0x20, 0x40, }; +static const uint8 kSpr049_ShiftingPipe_LeftTileToSpawn[4] = { 0x0, 0x14, 0x0, 0x2, }; +static const uint8 kSpr049_ShiftingPipe_RightTileToSpawn[4] = { 0x0, 0x15, 0x0, 0x2, }; +static const uint8 kSpr04B_PipeLakitu_HeadTiles[3] = { 0xec, 0xa8, 0xce, }; +static const uint8 kSpr04B_PipeLakitu_BodyTiles[3] = { 0xee, 0xee, 0xee, }; +static const uint8 kSprXXX_SuperKoopas_NonGroundedKoopaXSpeed[2] = { 0x18, 0xe8, }; +static const uint8 kSprXXX_SuperKoopas_MaxXSpeed[2] = { 0x18, 0xe8, }; +static const uint8 kSprXXX_SuperKoopas_XAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kSprXXX_SuperKoopas_XDisp[72] = { 0x8, 0x8, 0x10, 0x0, 0x8, 0x8, 0x10, 0x0, 0x8, 0x10, 0x10, 0x0, 0x8, 0x10, 0x10, 0x0, 0x9, 0x9, 0x0, 0x0, 0x9, 0x9, 0x0, 0x0, 0x8, 0x10, 0x0, 0x0, 0x8, 0x10, 0x0, 0x0, 0x8, 0x10, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0xf8, 0xf8, 0x0, 0xff, 0xff, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x0, }; +static const uint8 kSprXXX_SuperKoopas_YDisp[36] = { 0x0, 0x8, 0x8, 0x0, 0x0, 0x8, 0x8, 0x0, 0x3, 0x3, 0x8, 0x0, 0x3, 0x3, 0x8, 0x0, 0xff, 0x7, 0x0, 0x0, 0xff, 0x7, 0x0, 0x0, 0xfd, 0xfd, 0x0, 0x0, 0xfd, 0xfd, 0x0, 0x0, 0xfd, 0xfd, 0x0, 0x0, }; +static const uint8 kSprXXX_SuperKoopas_Tiles[36] = { 0xc8, 0xd8, 0xd0, 0xe0, 0xc9, 0xd9, 0xc0, 0xe2, 0xe4, 0xe5, 0xf2, 0xe0, 0xf4, 0xf5, 0xf2, 0xe0, 0xda, 0xca, 0xe0, 0xcf, 0xdb, 0xcb, 0xe0, 0xcf, 0xe4, 0xe5, 0xe0, 0xcf, 0xf4, 0xf5, 0xe2, 0xcf, 0xe4, 0xe5, 0xe2, 0xcf, }; +static const uint8 kSprXXX_SuperKoopas_Prop[36] = { 0x3, 0x3, 0x3, 0x0, 0x3, 0x3, 0x3, 0x0, 0x3, 0x3, 0x1, 0x1, 0x3, 0x3, 0x1, 0x1, 0x83, 0x83, 0x80, 0x0, 0x83, 0x83, 0x80, 0x0, 0x3, 0x3, 0x0, 0x1, 0x3, 0x3, 0x0, 0x1, 0x3, 0x3, 0x0, 0x1, }; +static const uint8 kSprXXX_SuperKoopas_TileSize[36] = { 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0, }; +static const uint8 kSprXXX_SuperKoopas_DATA_02ED39[2] = { 0x10, 0xa, }; +static const uint8 kSpr061_SkullRaft_Init_XPosOffset[3] = { 0x10, 0x20, 0x30, }; +static const uint8 kSpr06A_CoinGameCloud_Acceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr06A_CoinGameCloud_MaxYSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr086_Wiggler_Init_WigglerSegmentTablePointerLo[4] = { 0x0, 0x80, 0x0, 0x80, }; +static const uint8 kSpr086_Wiggler_Init_WigglerSegmentTablePointerHi[4] = { 0x0, 0x0, 0x1, 0x1, }; +static const uint8 kSpr086_Wiggler_XSpeed[4] = { 0x8, 0xf8, 0x10, 0xf0, }; +static const uint8 kSpr086_Wiggler_DATA_02F103[5] = { 0x0, 0x1e, 0x3e, 0x5e, 0x7e, }; +static const uint8 kSpr086_Wiggler_WigglerYDisp[4] = { 0x0, 0x1, 0x2, 0x1, }; +static const uint8 kSpr086_Wiggler_WigglerTiles[4] = { 0xc4, 0xc6, 0xc8, 0xc6, }; +static const uint8 kSpr086_Wiggler_FlowerXDisp[2] = { 0x0, 0x8, }; +static const uint8 kSpr086_Wiggler_EyeXDisp[2] = { 0x4, 0x4, }; +static const uint8 kSpr08A_Bird_DATA_02F33C[4] = { 0x2, 0x3, 0x5, 0x1, }; +static const uint8 kSpr08A_Bird_XSpeed[2] = { 0x8, 0xf8, }; +static const uint8 kSpr08A_Bird_Tiles[5] = { 0xd2, 0xd3, 0xd0, 0xd1, 0x9b, }; +static const uint8 kSpr08A_Bird_Direction[2] = { 0x71, 0x31, }; +static const uint8 kSpr08A_Bird_Palette[4] = { 0x8, 0x4, 0x6, 0xa, }; +static const uint8 kSpr08A_Bird_BirdOAMIndex[4] = { 0x30, 0x34, 0x48, 0x3c, }; +static const uint8 kSpr08B_FireplaceSmoke_DATA_02F463[25] = { 0x3, 0x4, 0x5, 0x4, 0x5, 0x6, 0x5, 0x6, 0x7, 0x6, 0x7, 0x8, 0x7, 0x8, 0x7, 0x8, 0x7, 0x8, 0x7, 0x8, 0x7, 0x8, 0x7, 0x8, 0x7, }; +static const uint8 kSpr08C_SideExitAndFireplace_TopTile[2] = { 0xd4, 0xab, }; +static const uint8 kSpr08C_SideExitAndFireplace_BottomTile[2] = { 0xbb, 0x9a, }; +static const uint8 kSpr08D_GhostHouseDoor_DATA_02F59E[10] = { 0x8, 0x18, 0xf8, 0xf8, 0xf8, 0xf8, 0x28, 0x28, 0x28, 0x28, }; +static const uint8 kSpr08D_GhostHouseDoor_DATA_02F5A8[10] = { 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr08D_GhostHouseDoor_YDisp[10] = { 0x5f, 0x5f, 0x8f, 0x97, 0xa7, 0xaf, 0x8f, 0x97, 0xa7, 0xaf, }; +static const uint8 kSpr08D_GhostHouseDoor_Tile[10] = { 0x9c, 0x9e, 0xa0, 0xb0, 0xb0, 0xa0, 0xa0, 0xb0, 0xb0, 0xa0, }; +static const uint8 kSpr08D_GhostHouseDoor_Prop[10] = { 0x23, 0x23, 0x2d, 0x2d, 0xad, 0xad, 0x6d, 0x6d, 0xed, 0xed, }; +static const uint8 kDrawNoYoshiSign_XDisp[8] = { 0xf8, 0x8, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kDrawNoYoshiSign_YDisp[8] = { 0x0, 0x0, 0x10, 0x10, 0x20, 0x30, 0x40, 0x8, }; +static const uint8 kDrawNoYoshiSign_Tiles[8] = { 0xc7, 0xa7, 0xa7, 0xc7, 0xa9, 0xc9, 0xc9, 0xe0, }; +static const uint8 kDrawNoYoshiSign_Prop[8] = { 0xa9, 0x69, 0xa9, 0x69, 0x29, 0x29, 0x29, 0x6b, }; +static const uint8 kDrawBigCastleGate_XDisp[12] = { 0x0, 0x10, 0x20, 0x0, 0x10, 0x20, 0x0, 0x10, 0x20, 0x0, 0x10, 0x20, }; +static const uint8 kDrawBigCastleGate_YDisp[12] = { 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x30, 0x30, 0x30, }; +static const uint8 kDrawGhostHouseEntranceDoor_XDisp[32] = { 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0xf2, 0xf2, 0xf2, 0xf2, 0x1e, 0x1e, 0x1e, 0x1e, }; +static const uint8 kDrawGhostHouseEntranceDoor_YDisp[8] = { 0x0, 0x8, 0x18, 0x20, 0x0, 0x8, 0x18, 0x20, }; +static const uint8 kDrawGhostHouseEntranceDoor_Prop[8] = { 0x7d, 0x7d, 0xfd, 0xfd, 0x3d, 0x3d, 0xbd, 0xbd, }; +static const uint8 kDrawGhostHouseEntranceDoor_Tiles[32] = { 0xa0, 0xb0, 0xb0, 0xa0, 0xa0, 0xb0, 0xb0, 0xa0, 0xa3, 0xb3, 0xb3, 0xa3, 0xa3, 0xb3, 0xb3, 0xa3, 0xa2, 0xb2, 0xb2, 0xa2, 0xa2, 0xb2, 0xb2, 0xa2, 0xa3, 0xb3, 0xb3, 0xa3, 0xa3, 0xb3, 0xb3, 0xa3, }; +static const uint8 kDrawGhostHouseEntranceDoor_OAMIndexes[8] = { 0x40, 0x44, 0x48, 0x4c, 0xf0, 0xf4, 0xf8, 0xfc, }; +static const uint8 kDrawGhostHouseEntranceDoor_AnimationFrame[16] = { 0x0, 0x1, 0x2, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x2, 0x1, 0x0, }; +static const uint8 kClusterSpr07_ReappearingBoo_DATA_02F837[2] = { 0x1, 0xff, }; +static const uint8 kClusterSpr07_ReappearingBoo_DATA_02F839[4] = { 0x0, 0xff, 0x2, 0xe, }; +static const uint8 kClusterSpr06_SumoBroFlame_DATA_02F8FC[8] = { 0x0, 0x10, 0x0, 0x10, 0x8, 0x10, 0xff, 0x10, }; +static const uint8 kClusterSpr06_SumoBroFlame_Tiles[8] = { 0xdc, 0xec, 0xcc, 0xec, 0xcc, 0xdc, 0x0, 0xcc, }; +static const uint8 kClusterSpr06_SumoBroFlame_DATA_02F90C[16] = { 0x3, 0x3, 0x3, 0x3, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x3, 0x3, }; +// todo: oob +static const uint8 kClusterSpr06_SumoBroFlame_DATA_02F9AA[7] = { 0x2, 0xa, 0x12, 0x1a, 0x8a, 0x45, 0x13 }; +static const uint8 kClusterSpr05_CandleFlame_DATA_02FA02[8] = { 0x3, 0x7, 0x7, 0x7, 0xf, 0x7, 0x7, 0xf, }; +static const uint8 kClusterSpr05_CandleFlame_OAMIndex[4] = { 0xf0, 0xf4, 0xf8, 0xfc, }; +static const uint8 kClusterSpr05_CandleFlame_Tiles[4] = { 0xe2, 0xe4, 0xe2, 0xe4, }; +static const uint8 kClusterSpr05_CandleFlame_Prop[4] = { 0x9, 0x9, 0x49, 0x49, }; +static const uint16 kClusterSpr04_BooRing_DATA_02FA84[10] = { 0x0, 0x28, 0x50, 0x78, 0xa0, 0xc8, 0xf0, 0x118, 0x140, 0x168, }; +static const uint8 kClusterSpr03_BooCeiling_DATA_02FBBB[2] = { 0x1, 0xff, }; +static const uint8 kClusterSpr03_BooCeiling_DATA_02FBBD[2] = { 0x8, 0xf8, }; +static const uint8 kClusterSpr03_BooCeiling_BooCeilingTiles[8] = { 0x88, 0x8c, 0xa8, 0x8e, 0xaa, 0xae, 0x88, 0x8c, }; +static const uint8 kClusterSpr03_BooCeiling_BatCeilingTiles[4] = { 0xae, 0xae, 0xc0, 0xeb, }; +static const uint8 kClusterSpriteOAMIndexes[20] = { 0xe0, 0xe4, 0xe8, 0xec, 0xf0, 0xf4, 0xf8, 0xfc, 0x5c, 0x58, 0x54, 0x50, 0x4c, 0x48, 0x44, 0x40, 0x3c, 0x38, 0x34, 0x30, }; +static const uint8 kClusterSpr01_1up_OAMIndex[8] = { 0x90, 0x94, 0x98, 0x9c, 0xa0, 0xa4, 0xa8, 0xac, }; + + void DropReservedItem() { // 028008 uint8 v0 = player_current_item_box; if (player_current_item_box) { @@ -125,9 +529,10 @@ void DropReservedItem() { // 028008 } void BobOmbExplosion(uint8 k) { // 02808a + GetDrawInfoRes drt; spr_property_bits1656[k] = 0; spr_property_bits1662[k] = 17; - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; if (!flag_sprites_locked) ++spr_table1570[k]; @@ -137,28 +542,27 @@ void BobOmbExplosion(uint8 k) { // 02808a if ((uint8)(spr_decrementing_table1540[k] - 16) < 0x20) CheckPlayerToNormalSpriteCollision(k); } - R15_ = 4; + uint8 r15 = 4; do { int8 v4 = spr_decrementing_table1540[k] >> 1; - R2_ = v4 & 3; - R0_ = spr_xpos_lo[k] - mirror_current_layer1_xpos + 4; - R1_ = spr_ypos_lo[k] - mirror_current_layer1_ypos + 4; - uint8 v1 = R15_; + uint8 r2 = v4 & 3; + uint8 r0 = spr_xpos_lo[k] - mirror_current_layer1_xpos + 4; + uint8 r1 = spr_ypos_lo[k] - mirror_current_layer1_ypos + 4; + uint8 v1 = r15; if ((v4 & 4) != 0) - v1 = R15_ + 5; + v1 = r15 + 5; do { - R0_ += kBobOmbExplosion_BombExplosionX[v1]; - R1_ += kBobOmbExplosion_BombExplosionY[v1]; - --R2_; - } while ((R2_ & 0x80) == 0); - uint8 v2 = spr_oamindex[k] + 4 * R15_; + r0 += kBobOmbExplosion_BombExplosionX[v1]; + r1 += kBobOmbExplosion_BombExplosionY[v1]; + } while ((--r2 & 0x80) == 0); + uint8 v2 = spr_oamindex[k] + 4 * r15; OamEnt *oam = get_OamEnt(oam_buf, v2); - oam[64].xpos = R0_; - oam[64].ypos = R1_; + oam[64].xpos = r0; + oam[64].ypos = r1; oam[64].charnum = -68; oam[64].flags = sprites_tile_priority | (2 * ((counter_global_frames >> 2) & 3) + 1); sprites_oamtile_size_buffer[(v2 >> 2) + 64] = 0; - } while ((--R15_ & 0x80) == 0); + } while ((--r15 & 0x80) == 0); Spr070_Pokey_Bank02SpriteEntry(k, 0, 4); } else { spr_current_status[k] = 0; @@ -173,9 +577,10 @@ void BobOmbExplosion_ExplodeSprites(uint8 k) { // 028139 } void BobOmbExplosion_ExplodeKillSpr(uint8 k, uint8 j) { // 028150 - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j, &ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if ((spr_property_bits167a[j] & 2) == 0) { spr_current_status[j] = 2; spr_yspeed[j] = -64; @@ -186,59 +591,59 @@ void BobOmbExplosion_ExplodeKillSpr(uint8 k, uint8 j) { // 028150 void GameMode14_InLevel_02827D() { // 02827d misc_morton_roy_ludwig_background_xoffset = mirror_current_layer1_xpos; - R5_ = -(int8)mirror_current_layer1_xpos; + //r5 = -(int8)mirror_current_layer1_xpos; int8 v0 = 0; if (mirror_current_layer1_xpos & 0x100) v0 = 0x80; misc_morton_roy_ludwig_background_xoffset = (misc_morton_roy_ludwig_background_xoffset >> 1) + v0; - R6_ = -misc_morton_roy_ludwig_background_xoffset; + uint8 r8 = -misc_morton_roy_ludwig_background_xoffset; int8 v1 = 0; if ((mirror_current_layer1_xpos & 0x200) != 0) v1 = 0x80; misc_morton_roy_ludwig_background_xoffset = -(int8)((misc_morton_roy_ludwig_background_xoffset >> 1) + v1); uint16 v2 = 356; - *(uint16 *)&R3_ = 356; + uint16 r3w = 356; do { get_OamEnt(oam_buf, v2)[3].ypos = -16; v2 += 4; } while (v2 < 0x18C); - R12_W = 0; + uint16 r12w = 0; uint16 v3 = 56; uint16 v4 = 224; if (spr_table187b[9] == 1) { - R12_W = 57; + r12w = 57; v3 = 29; v4 = 252; } do { - R0_W = v3; - R10_W = R12_W + v3; - uint16 v5 = R12_W + v3; - uint8 v6 = kGameMode14_InLevel_DATA_028178[v5] + R6_; + uint16 r0w = v3; + uint16 r10w = r12w + v3; + uint16 v5 = r12w + v3; + uint8 v6 = kGameMode14_InLevel_DATA_028178[v5] + r8; OamEnt *oam = get_OamEnt(oam_buf, v4); oam[3].xpos = v6; - R2_ = v6; - R7_ = shaking_layer1_disp_y; + uint8 r2 = v6; + uint8 r7 = shaking_layer1_disp_y; int8 v8 = 0; if (__CFSHL__(shaking_layer1_disp_y, 1)) v8 = 0x80; - R7_ = (R7_ >> 1) + v8; - oam[3].ypos = kGameMode14_InLevel_DATA_0281CF[v5] - 1 - R7_; + r7 = (r7 >> 1) + v8; + oam[3].ypos = kGameMode14_InLevel_DATA_0281CF[v5] - 1 - r7; if (!flag_update_background_sprites_in_koopa_kid_rooms) { - oam[3].charnum = kGameMode14_InLevel_DATA_028226[R10_W]; + oam[3].charnum = kGameMode14_InLevel_DATA_028226[r10w]; oam[3].flags = 13; } sprites_oamtile_size_buffer[(v4 >> 2) + 3] = 2; - if (R2_ >= 0xF0 && spr_table187b[9] != 1) { - uint16 v9 = *(uint16 *)&R3_; + if (r2 >= 0xF0 && spr_table187b[9] != 1) { + uint16 v9 = r3w; OamEnt *v10 = get_OamEnt(oam_buf, v4); - get_OamEnt(oam_buf, *(uint16 *)&R3_)[3] = v10[3]; + get_OamEnt(oam_buf, r3w)[3] = v10[3]; sprites_oamtile_size_buffer[(v9 >> 2) + 3] = 3; - R3_W += 4; + r3w += 4; } v4 -= 4; - v3 = R0_W - 1; - } while ((int16)(R0_W - 1) >= 0); + v3 = r0w - 1; + } while ((int16)v3 >= 0); flag_update_background_sprites_in_koopa_kid_rooms = 1; if (spr_table187b[9] == 1) { OamEnt *v12 = get_OamEnt(oam_buf, 0); @@ -249,25 +654,26 @@ void GameMode14_InLevel_02827D() { // 02827d v12[51].flags = -51; v12[52].flags = -51; } else if ((counter_local_frames & 3) == 0) { - R0_ = 0; + uint8 r0 = 0; do { - uint8 v13 = kGameMode14_InLevel_DATA_0283C8[R0_]; + uint8 v13 = kGameMode14_InLevel_DATA_0283C8[r0]; if ((GetRand() & 1) == 0) { OamEnt *v14 = get_OamEnt(oam_buf, v13); v14[3].charnum ^= 2; } get_OamEnt(oam_buf, v13)[3].flags = 9; - ++R0_; - } while (R0_ != 4); + ++r0; + } while (r0 != 4); } GameMode14_InLevel_0283CE(); } void GameMode14_InLevel_0283CE() { // 0283ce - R12_ = spr_table1534[9] - 30; - R13_ = spr_table160e[9] + 16; + uint8 xposes[2] = { + spr_table1534[9] - 30, + spr_table160e[9] + 16 + }; for (uint8 i = 1; (i & 0x80) == 0; --i) { - R15_ = i; int8 v1 = *(&sprites_morton_and_roy_left_pillar_status + i); if (v1) { if (v1 >= 0) { @@ -275,7 +681,7 @@ void GameMode14_InLevel_0283CE() { // 0283ce flag_sprites_locked = v1; GameMode14_InLevel_0283F8(i); } - GameMode14_InLevel_028439(i); + GameMode14_InLevel_028439(i, xposes[i]); } } } @@ -301,37 +707,36 @@ void GameMode14_InLevel_0283F8(uint8 k) { // 0283f8 *(&sprites_morton_and_roy_left_pillar_yposition + k) = v1; } -void GameMode14_InLevel_028439(uint8 k) { // 028439 +void GameMode14_InLevel_028439(uint8 k, uint8 xpos) { // 028439 uint8 v1 = kGameMode14_InLevel_DATA_0283CC[k]; - R0_ = 0; + uint8 r0 = 0; do { OamEnt *oam = get_OamEnt(oam_buf, v1); oam->ypos = -16; - int8 v3 = *(&sprites_morton_and_roy_left_pillar_yposition + k) - mirror_current_layer1_ypos - shaking_layer1_disp_y - R0_; + int8 v3 = *(&sprites_morton_and_roy_left_pillar_yposition + k) - mirror_current_layer1_ypos - shaking_layer1_disp_y - r0; if ((uint8)v3 < 0x20) break; if ((uint8)v3 < 0xA4) oam->ypos = v3; - oam->xpos = *(&R12_ + k); + oam->xpos = xpos; int8 v4 = -26; - if (R0_) + if (r0) v4 = 8; oam->charnum = v4; oam->flags = 13; sprites_oamtile_size_buffer[v1 >> 2] = 2; - k = R15_; v1 += 4; - R0_ += 16; - } while (R0_ < 0x90); + r0 += 16; + } while (r0 < 0x90); } -void sub_284A6(uint8 k, uint8 a) { // 0284a6 - R3_ = a; - R1_ = 2; +void sub_284A6(uint8 k, uint8 a, uint8 r0, uint8 r2) { // 0284a6 + uint8 r3 = a; + uint8 r1 = 2; do { - SpawnWaterSplash_0284D8(k); - R2_ += R3_; - } while ((--R1_ & 0x80) == 0); + SpawnWaterSplash_0284D8(k, r0, r2); + r2 += r3; + } while ((--r1 & 0x80) == 0); } void SpawnWaterSplash_VerticalCheepCheepEntry(uint8 k) { // 0284bc @@ -343,17 +748,17 @@ void SpawnWaterSplash(uint8 k) { // 0284c0 } void SpawnWaterSplash_0284C2(uint8 k, uint8 a) { // 0284c2 - R0_ = a; - R2_ = 0; + uint8 r0 = a; + uint8 r2 = 0; if (spr_spriteid[k] == 65 || spr_spriteid[k] == 66) { if ((spr_yspeed[k] & 0x80) != 0) - sub_284A6(k, 0xA); + sub_284A6(k, 0xA, r0, r2); } else { - SpawnWaterSplash_0284D8(k); + SpawnWaterSplash_0284D8(k, r0, r2); } } -void SpawnWaterSplash_0284D8(uint8 k) { // 0284d8 +void SpawnWaterSplash_0284D8(uint8 k, uint8 r0, uint8 r2) { // 0284d8 if (!CheckIfNormalSpriteOffScreen(k)) { uint8 j = 11; while (mextspr_spriteid[j]) { @@ -361,16 +766,16 @@ void SpawnWaterSplash_0284D8(uint8 k) { // 0284d8 return; } mextspr_ypos_lo[j] = (spr_ypos_lo[k] & 0xF0) + 3; - SetHiLo(&mextspr_xpos_hi[j], &mextspr_xpos_lo[j], GetSprXPos(k) + R2_); + SetHiLo(&mextspr_xpos_hi[j], &mextspr_xpos_lo[j], GetSprXPos(k) + r2); mextspr_spriteid[j] = 7; - mextspr_timer[j] = R0_; + mextspr_timer[j] = r0; } } void SpawnLavaSplash(uint8 k) { // 028528 CheckIfNormalSpriteOffScreen(k); if (!spr_yoffscreen_flag[k]) { - R0_ = 4; + uint8 r0 = 4; uint8 j = 7; do { while (ext_spr_spriteid[j]) { @@ -383,8 +788,8 @@ void SpawnLavaSplash(uint8 k) { // 028528 ext_spr_xspeed[j] = kSpawnLavaSplash_InitialXSpeed[GetRand() & 7]; ext_spr_yspeed[j] = kSpawnLavaSplash_InitialYSpeed[misc_random_byte2 & 7]; ext_spr_decrementing_table176f[j] = kSpawnLavaSplash_InitialAnimationFrameCounter[GetRand() & 7]; - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } } @@ -395,14 +800,14 @@ void SpawnSparkles_PlayerEntry() { // 02858f v0 = 15; v1 = 16; } - R1_ = v1; + uint8 r1 = v1; GetRand(); - R0_ = player_ypos + R1_ + (misc_random_byte1 & v0); - R2_ = player_xpos + (misc_random_byte2 & 0xF) - 2; - SpawnSparkles(); + uint8 r0 = player_ypos + r1 + (misc_random_byte1 & v0); + uint8 r2 = player_xpos + (misc_random_byte2 & 0xF) - 2; + SpawnSparkles(r0, r2); } -void SpawnSparkles() { // 0285ba +void SpawnSparkles(uint8 r0, uint8 r2) { // 0285ba uint8 v0 = 11; while (mextspr_spriteid[v0]) { if ((--v0 & 0x80) != 0) @@ -410,8 +815,8 @@ void SpawnSparkles() { // 0285ba } mextspr_spriteid[v0] = 5; mextspr_yspeed[v0] = 0; - mextspr_ypos_lo[v0] = R0_; - mextspr_xpos_lo[v0] = R2_; + mextspr_ypos_lo[v0] = r0; + mextspr_xpos_lo[v0] = r2; mextspr_timer[v0] = 23; } @@ -448,7 +853,7 @@ uint8 GrabThrowBlockBlock() { // 02862f } void SpawnBrickPieces(uint8 a) { // 028663 - R0_ = a; + uint8 r0 = a; uint8 v1 = 3; uint8 j = 11; LABEL_2: @@ -467,7 +872,7 @@ void SpawnBrickPieces(uint8 a) { // 028663 SetHiLo(&mextspr_ypos_hi[j], &mextspr_ypos_lo[j], blocks_ypos + kSpawnBrickPieces_ylo[v1]); mextspr_yspeed[j] = kSpawnBrickPieces_InitialYSpeed[v1]; mextspr_xspeed[j] = kSpawnBrickPieces_InitialXSpeed[v1]; - mextspr_timer[j] = R0_; + mextspr_timer[j] = r0; --v1; } while ((v1 & 0x80) == 0); } @@ -501,8 +906,8 @@ uint8 InitializeBlockPunchAttack() { // 0286ed return j; } -void SpawnBounceSprite() { // 028752 - if (R4_ == 7) { +void SpawnBounceSprite(uint8 r4, uint8 r5, uint8 r6, uint8 r7) { // 028752 + if (r4 == 7) { uint8 v0 = player_current_character + __CFSHL__(player_current_character, 1) + 2 * player_current_character; uint8 v1 = *(&player_mario_score_lo + v0); *(&player_mario_score_lo + v0) = v1 + 5; @@ -527,15 +932,15 @@ void SpawnBounceSprite() { // 028752 uint16 t = PAIR16(bounce_spr_ypos_hi[j], bounce_spr_ypos_lo[j]) + 12; blocks_ypos = t & ~0xF; blocks_map16_to_generate = bounce_spr_map16_tile_to_spawn[j]; - uint8 v12 = R4_; - uint8 v11 = R5_; - uint8 v10 = R6_; - uint8 v9 = R7_; + //uint8 v12 = r4; + //uint8 v11 = r5; + //uint8 v10 = r6; + //uint8 v9 = r7; GenerateTile(); - R7_ = v9; - R6_ = v10; - R5_ = v11; - R4_ = v12; + //r7 = v9; + // r6 = v10; + //r5 = v11; + //r4 = v12; blocks_ypos = v5; blocks_xpos = v4; } @@ -543,16 +948,16 @@ void SpawnBounceSprite() { // 028752 break; } } - uint8 v6 = R4_; - if (R4_ < 0x10) { - if (R4_ == 5) + uint8 v6 = r4; + if (r4 < 0x10) { + if (r4 == 5) io_sound_ch1 = 11; - bounce_spr_yxppccct[v3] = kSpawnBounceSprite_BlockBounce[R4_]; + bounce_spr_yxppccct[v3] = kSpawnBounceSprite_BlockBounce[r4]; } else { - R4_ = 0; + r4 = 0; bounce_spr_yxppccct[v3] = kSpawnBounceSprite_BlockBounce[v6 - 9]; } - bounce_spr_spriteid[v3] = R4_ + 1; + bounce_spr_spriteid[v3] = r4 + 1; bounce_spr_current_status[v3] = 0; bounce_spr_xpos_lo[v3] = blocks_xpos; bounce_spr_xpos_hi[v3] = HIBYTE(blocks_xpos); @@ -561,32 +966,31 @@ void SpawnBounceSprite() { // 028752 int8 v7 = 0; if (misc_current_layer_being_processed & 1) v7 = 0x80; - R8_ = ((uint8)misc_current_layer_being_processed >> 2) + v7; - uint8 v8 = R6_; - bounce_spr_yspeed[v3] = kSpawnBounceSprite_BlockBounceYSpeed[R6_]; - bounce_spr_xspeed[v3] = kSpawnBounceSprite_BlockBounceXSpeed[v8]; - bounce_spr_properties[v3] = R8_ | v8; - bounce_spr_map16_tile_to_spawn[v3] = R7_; + uint8 r8 = ((uint8)misc_current_layer_being_processed >> 2) + v7; + bounce_spr_yspeed[v3] = kSpawnBounceSprite_BlockBounceYSpeed[r6]; + bounce_spr_xspeed[v3] = kSpawnBounceSprite_BlockBounceXSpeed[r6]; + bounce_spr_properties[v3] = r8 | r6; + bounce_spr_map16_tile_to_spawn[v3] = r7; bounce_spr_timer[v3] = 8; if (bounce_spr_spriteid[v3] == 7) bounce_spr07_spinning_turn_block_despawn_timer[v3] = -1; InitializeBlockPunchAttack(); - SpawnBounceSprite_02887D(); + SpawnBounceSprite_02887D(r5); } } -void SpawnBounceSprite_02887D() { // 02887d +void SpawnBounceSprite_02887D(uint8 r5) { // 02887d uint8 j; - if (!R5_) + if (!r5) return; - if (R5_ < 8 && R5_ >= 6) { - if (R5_ == 7 && !blocks_multi_coin_block_timer) + if (r5 < 8 && r5 >= 6) { + if (r5 == 7 && !blocks_multi_coin_block_timer) blocks_multi_coin_block_timer = -1; goto LABEL_7; } - if (R5_ != 11 || (blocks_xpos & 0x30) != 32) { - switch (R5_) { + if (r5 != 11 || (blocks_xpos & 0x30) != 32) { + switch (r5) { case 0x10: goto LABEL_16; case 8: if (sprites_sprite_memory_setting) { @@ -611,14 +1015,14 @@ void SpawnBounceSprite_02887D() { // 02887d } LABEL_24: misc_scratch7e185e = j; - uint8 v1 = R5_; - spr_current_status[j] = kSpawnBounceSprite_StatusOfSprInBlk[R5_]; + uint8 v1 = r5; + spr_current_status[j] = kSpawnBounceSprite_StatusOfSprInBlk[r5]; if (yoshi_stray_yoshi_flag) v1 += 17; sprites_second_tracked_sprite_index = v1; uint8 v2 = kSpawnBounceSprite_SpriteInBlock[v1]; spr_spriteid[j] = v2; - R14_ = v2; + //r14 = v2; uint8 v3 = 2; if (v2 < 0x81 && v2 >= 0x79) v3 = 3; @@ -785,21 +1189,14 @@ void ProcessMinorExtendedSprites_028B94(uint8 k, uint8 a) { // 028b94 } void Spr035_Yoshi_SpawnUnusedYoshiSmoke(uint8 k) { // 028bb0 - Spr035_Yoshi_SpawnUnusedYoshiSmoke_Return(k); -} - -void Spr035_Yoshi_SpawnUnusedYoshiSmoke_Return(uint8 k) { // 028bb8 - ; } void Spr035_Yoshi_Sub(uint8 k) { // 028bb9 - R0_ = 0; - Spr035_Yoshi_028BC0(k); - ++R0_; - Spr035_Yoshi_028BC0(k); + Spr035_Yoshi_028BC0(k, 0); + Spr035_Yoshi_028BC0(k, 1); } -void Spr035_Yoshi_028BC0(uint8 k) { // 028bc0 +void Spr035_Yoshi_028BC0(uint8 k, uint8 r0) { // 028bc0 uint8 j = 11; while (mextspr_spriteid[j]) { if ((--j & 0x80) != 0) @@ -808,8 +1205,8 @@ void Spr035_Yoshi_028BC0(uint8 k) { // 028bc0 mextspr_spriteid[j] = 11; mextspr_timer[j] = 0; SetHiLo(&mextspr_ypos_hi[j], &mextspr_ypos_lo[j], GetSprYPos(k) + 28); - mextspr_xspeed[j] = kSpr035_Yoshi_DATA_028C09[R0_]; - SetHiLo(&mextspr_xpos_hi[j], &mextspr_xpos_lo[j], player_xpos + PAIR16(kSpr035_Yoshi_DATA_028C0D[R0_], kSpr035_Yoshi_DATA_028C0B[R0_])); + mextspr_xspeed[j] = kSpr035_Yoshi_DATA_028C09[r0]; + SetHiLo(&mextspr_xpos_hi[j], &mextspr_xpos_lo[j], player_xpos + PAIR16(kSpr035_Yoshi_DATA_028C0D[r0], kSpr035_Yoshi_DATA_028C0B[r0])); } void MExtSpr0B_UnusedYoshiSmoke(uint8 k) { // 028c0f @@ -817,14 +1214,14 @@ void MExtSpr0B_UnusedYoshiSmoke(uint8 k) { // 028c0f if (mextspr_timer[k]-- != 1) { uint8 v5 = kMinorExtendedSpriteOAMIndexes[k]; uint8 v6 = mextspr_xpos_lo[k]; - R0_ = v6 - mirror_current_layer1_xpos; + uint8 r0 = v6 - mirror_current_layer1_xpos; if (mextspr_xpos_hi[k] == (uint8)((v6 < (uint8)mirror_current_layer1_xpos) + HIBYTE(mirror_current_layer1_xpos))) { uint8 v7 = mextspr_ypos_lo[k]; - R1_ = v7 - mirror_current_layer1_ypos; + uint8 r1 = v7 - mirror_current_layer1_ypos; if (mextspr_ypos_hi[k] == (uint8)((v7 < (uint8)mirror_current_layer1_ypos) + HIBYTE(mirror_current_layer1_ypos))) { OamEnt *oam = get_OamEnt(oam_buf, v5); - oam->xpos = R0_; - oam->ypos = R1_; + oam->xpos = r0; + oam->ypos = r1; oam->charnum = kMExtSpr0B_UnusedYoshiSmoke_Tiles[mextspr_timer[k] >> 2]; oam->flags = sprites_tile_priority | 8; sprites_oamtile_size_buffer[v5 >> 2] = 0; @@ -864,23 +1261,24 @@ void MExtSpr0B_UnusedYoshiSmoke(uint8 k) { // 028c0f void MExtSpr0A_BooStream(uint8 k) { // 028cc4 if (!flag_sprites_locked) { - SetHiLo(&R10_, &R4_, PAIR16(mextspr_xpos_hi[k], mextspr_xpos_lo[k]) + 4); - SetHiLo(&R11_, &R5_, PAIR16(mextspr_ypos_hi[k], mextspr_ypos_lo[k]) + 4); - R6_ = 8; - R7_ = 8; - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) + CollInfo ci; + SetHiLo(&ci.r10, &ci.r4, PAIR16(mextspr_xpos_hi[k], mextspr_xpos_lo[k]) + 4); + SetHiLo(&ci.r11, &ci.r5, PAIR16(mextspr_ypos_hi[k], mextspr_ypos_lo[k]) + 4); + ci.r6 = 8; + ci.r7 = 8; + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) DamagePlayer_Hurt(); if (mextspr_timer[k]-- == 1) goto LABEL_9; } uint8 v4 = kMinorExtendedSpriteOAMIndexes[k]; uint8 v5 = mextspr_xpos_lo[k]; - R0_ = v5 - mirror_current_layer1_xpos; + uint8 r0 = v5 - mirror_current_layer1_xpos; if (mextspr_xpos_hi[k] != (uint8)((v5 < (uint8)mirror_current_layer1_xpos) + HIBYTE(mirror_current_layer1_xpos))) return; OamEnt *oam = get_OamEnt(oam_buf, v4); - oam->xpos = R0_; + oam->xpos = r0; if ((uint8)(mextspr_ypos_lo[k] - mirror_current_layer1_ypos) >= 0xF0) { LABEL_9: mextspr_spriteid[k] = 0; @@ -900,16 +1298,16 @@ void MExtSpr07_WaterSplash(uint8 k) { // 028d4f uint8 v1 = mextspr_timer[k]; if (v1 == 32) goto LABEL_3; - R0_ = 0; + uint8 r0 = 0; if (v1 >= 0x10) { if (!(flag_sprites_locked | v1 & 1)) ++mextspr_ypos_lo[k]; - R2_ = (uint8)(mextspr_timer[k] - 16) >> 2; - R0_ = (counter_global_frames & 1) ? -R2_ : R2_; + uint8 r2 = (uint8)(mextspr_timer[k] - 16) >> 2; + r0 = (counter_global_frames & 1) ? -r2 : r2; } uint8 v3 = kMinorExtendedSpriteOAMIndexes[k]; - if ((uint8)(R0_ + mextspr_xpos_lo[k] - mirror_current_layer1_xpos) >= 0xF0 || - (oam = get_OamEnt(oam_buf, v3), oam->xpos = R0_ + mextspr_xpos_lo[k] - mirror_current_layer1_xpos, + if ((uint8)(r0 + mextspr_xpos_lo[k] - mirror_current_layer1_xpos) >= 0xF0 || + (oam = get_OamEnt(oam_buf, v3), oam->xpos = r0 + mextspr_xpos_lo[k] - mirror_current_layer1_xpos, (uint8)(mextspr_ypos_lo[k] - mirror_current_layer1_ypos) >= 0xE8)) { LABEL_3: mextspr_spriteid[k] = 0; @@ -1040,7 +1438,7 @@ void MExtSpr01_BrickPiece(uint8 k) { // 028f8b ++mextspr_yspeed[k]; } uint16 t = PAIR16(mextspr_ypos_hi[k], mextspr_ypos_lo[k]) - mirror_current_layer1_ypos; - R0_ = t; + uint8 r0 = t; if ((t >> 8)) { if ((int8)(t >> 8) < 0) return; @@ -1049,13 +1447,13 @@ void MExtSpr01_BrickPiece(uint8 k) { // 028f8b uint8 v8 = kMinorExtendedSpriteOAMIndexes[k]; uint16 tx = PAIR16(mextspr_xpos_hi[k], mextspr_xpos_lo[k]) - mirror_current_layer1_xpos; - R1_ = tx; - if ((tx >> 8) || (oam = get_OamEnt(oam_buf, v8), oam->xpos = tx, R0_ >= 0xF0)) { + uint8 r1 = tx; + if ((tx >> 8) || (oam = get_OamEnt(oam_buf, v8), oam->xpos = tx, r0 >= 0xF0)) { LABEL_15: MExtSpr_Delete(k); return; } - oam->ypos = R0_; + oam->ypos = r0; uint8 v13 = mextspr_timer[k]; uint8 v11 = (sprites_currently_processed_misc_sprite + (counter_local_frames >> 1)) & 7; oam->charnum = kMExtSpr01_BrickPiece_Tiles[v11]; @@ -1142,10 +1540,10 @@ void BounceSpr01_TurnBlock(uint8 k) { // 0290de uint8 v3 = 32; if (player_riding_yoshi_flag) v3 = 48; - R0_ = v3; + uint8 r0 = v3; uint8 v4 = bounce_spr_ypos_lo[k]; - LOBYTE(player_ypos) = v4 - R0_; - HIBYTE(player_ypos) = bounce_spr_ypos_hi[k] - (v4 < R0_); + LOBYTE(player_ypos) = v4 - r0; + HIBYTE(player_ypos) = bounce_spr_ypos_hi[k] - (v4 < r0); misc_player_on_solid_sprite = 1; blocks_note_block_bounce_flag = 1; player_yspeed = 0; @@ -1193,18 +1591,18 @@ void BounceSpriteDraw(uint8 k) { // 0291f8 uint8 v1 = 0; if ((bounce_spr_properties[k] & 0x80) != 0) v1 = 4; - R2_ = *((uint8 *)&mirror_current_layer1_ypos + v1); - R3_ = *((uint8 *)&mirror_current_layer1_xpos + v1); - R4_ = *((uint8 *)&mirror_current_layer1_ypos + v1 + 1); - R5_ = *((uint8 *)&mirror_current_layer1_xpos + v1 + 1); - if (bounce_spr_ypos_hi[k] == (uint8)((bounce_spr_ypos_lo[k] < R2_) + R4_) && - bounce_spr_xpos_hi[k] == (uint8)((bounce_spr_xpos_lo[k] < R3_) + R5_)) { + uint8 r2 = *((uint8 *)&mirror_current_layer1_ypos + v1); + uint8 r3 = *((uint8 *)&mirror_current_layer1_xpos + v1); + uint8 r4 = *((uint8 *)&mirror_current_layer1_ypos + v1 + 1); + uint8 r5 = *((uint8 *)&mirror_current_layer1_xpos + v1 + 1); + if (bounce_spr_ypos_hi[k] == (uint8)((bounce_spr_ypos_lo[k] < r2) + r4) && + bounce_spr_xpos_hi[k] == (uint8)((bounce_spr_xpos_lo[k] < r3) + r5)) { uint8 v2 = kBounceSpriteGFXRt_OAMIndex[k]; - R1_ = bounce_spr_ypos_lo[k] - R2_; + uint8 r1 = bounce_spr_ypos_lo[k] - r2; OamEnt *oam = get_OamEnt(oam_buf, v2); - oam->ypos = R1_; - R0_ = bounce_spr_xpos_lo[k] - R3_; - oam->xpos = R0_; + oam->ypos = r1; + uint8 r0 = bounce_spr_xpos_lo[k] - r3; + oam->xpos = r0; oam->flags = sprites_tile_priority | bounce_spr_yxppccct[k]; oam->charnum = kBounceSpriteGFXRt_Tiles[bounce_spr_spriteid[k] - 1]; sprites_oamtile_size_buffer[v2 >> 2] = 2; @@ -1213,56 +1611,55 @@ void BounceSpriteDraw(uint8 k) { // 0291f8 void GetBounceSpriteLevelCollisionMap16ID(uint8 k) { // 029265 int8 v1 = 1; - R15_ = bounce_spr_properties[k]; - if ((R15_ & 0x80) != 0) + uint8 r15 = bounce_spr_properties[k]; + uint16 r5w; + if ((r15 & 0x80) != 0) v1 = 2; if ((misc_level_layout_flags & (uint8)v1) != 0) { uint16 t = PAIR16(bounce_spr_ypos_hi[k], bounce_spr_ypos_lo[k]) - 3; - R0_ = t & ~0xf; + uint8 r0 = t & ~0xf; uint8 v2 = (t >> 8); if (v2 >= misc_screens_in_lvl) return; - R3_ = v2; - R8_ = v2 & 0x10; - R1_ = bounce_spr_xpos_lo[k]; + uint8 r3 = v2; +// r8 = v2 & 0x10; + uint8 r1 = bounce_spr_xpos_lo[k]; if (bounce_spr_xpos_hi[k] >= 2) return; - R2_ = bounce_spr_xpos_hi[k]; - R0_ |= R1_ >> 4; - uint8 v3 = kLevelDataLayoutTables_EightBitLo_Vertical[R3_]; - uint8 v4 = kLevelDataLayoutTables_EightBitHi_Vertical[R3_]; - if (R15_) { - v3 = kLevelDataLayoutTables_EightBitLo_Vertical_L2[R3_]; - v4 = kLevelDataLayoutTables_EightBitHi_Vertical_L2[R3_]; - } - *(uint16 *)&R5_ = PAIR16(R2_, R0_) + PAIR16(v4, v3); + uint8 r2 = bounce_spr_xpos_hi[k]; + r0 |= r1 >> 4; + uint8 v3 = kLevelDataLayoutTables_EightBitLo_Vertical[r3]; + uint8 v4 = kLevelDataLayoutTables_EightBitHi_Vertical[r3]; + if (r15) { + v3 = kLevelDataLayoutTables_EightBitLo_Vertical[r3 + 14]; + v4 = kLevelDataLayoutTables_EightBitHi_Vertical[r3 + 14]; + } + r5w = PAIR16(r2, r0) + PAIR16(v4, v3); } else { uint16 t = PAIR16(bounce_spr_ypos_hi[k], bounce_spr_ypos_lo[k]) - 3; - R0_ = t & ~0xf; + uint8 r0 = t & ~0xf; uint8 t2 = t >> 8; if (t2 >= 2) return; - R2_ = t2; - R1_ = bounce_spr_xpos_lo[k]; + uint8 r2 = t2; + uint8 r1 = bounce_spr_xpos_lo[k]; uint8 v5 = bounce_spr_xpos_hi[k]; if (v5 >= misc_screens_in_lvl) return; - R3_ = bounce_spr_xpos_hi[k]; - R0_ |= R1_ >> 4; + uint8 r3 = bounce_spr_xpos_hi[k]; + r0 |= r1 >> 4; uint8 v6 = v5; - uint8 v7 = kLevelDataLayoutTables_EightBitLo[v5]; - uint8 v8 = kLevelDataLayoutTables_EightBitHi[v6]; - if (R15_) { - v7 = kLevelDataLayoutTables_EightBitLo_Horizontal_L2[v6]; - v8 = kLevelDataLayoutTables_EightBitHi_Horizontal_L2[v6]; + uint8 v7 = kLevelDataLayoutTables_EightBitLo_Horizontal[v5]; + uint8 v8 = kLevelDataLayoutTables_EightBitHi_Horizontal[v6]; + if (r15) { + v7 = kLevelDataLayoutTables_EightBitLo_Horizontal[v6 + 16]; + v8 = kLevelDataLayoutTables_EightBitHi_Horizontal[v6 + 16]; } - *(uint16 *)&R5_ = PAIR16(R2_, R0_) + PAIR16(v8, v7); + r5w = PAIR16(r2, r0) + PAIR16(v8, v7); } - R7_ = 126; uint8 v9 = sprites_currently_processed_misc_sprite; - blocks_currently_processed_map16_tile_lo = *IndirPtr(&R5_, 0); - ++R7_; - if (!*IndirPtr(&R5_, 0) && blocks_currently_processed_map16_tile_lo == 43) { + blocks_currently_processed_map16_tile_lo = g_ram[r5w]; + if (!g_ram[r5w + 0x10000] && blocks_currently_processed_map16_tile_lo == 43) { uint8 v11 = bounce_spr_ypos_lo[v9]; bounce_spr_ypos_lo[v9] = (v11 - ((blocks_currently_processed_map16_tile_lo < 0x2B) + 3)) & 0xF0; uint8 v10 = bounce_spr_ypos_hi[v9]; @@ -1297,13 +1694,12 @@ void CheckPlayerAttackToNormalSpriteCollision(uint8 k) { // 029398 if (bounce_spr_interact_timer[k]-- == 1) { bounce_spr_type[k] = 0; } else if (bounce_spr_interact_timer[k] < 3) { - R14_ = 0; - CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry(); + CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry(0); } } } -void CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry() { // 0293ae +void CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry(uint8 r14) { // 0293ae uint8 j = sprites_currently_processed_misc_sprite; for (uint8 i = 11; (i & 0x80) == 0; --i) { @@ -1314,19 +1710,20 @@ void CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry() { // 0293ae if (player_climbing_flag) v2 ^= 1; if (player_current_layer_priority == v2) { - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(i); - if (R14_) - CheckPlayerAttackToNormalSpriteColl_GetCapeSwingOrNetPunchClipping(); + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(i, &ci); + if (r14) + CheckPlayerAttackToNormalSpriteColl_GetCapeSwingOrNetPunchClipping(&ci); else - CheckPlayerAttackToNormalSpriteColl_GetBounceSpriteClipping(j); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) - CheckPlayerAttackToNormalSpriteColl_029404(i); + CheckPlayerAttackToNormalSpriteColl_GetBounceSpriteClipping(j, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) + CheckPlayerAttackToNormalSpriteColl_029404(i, r14); } } } } -void CheckPlayerAttackToNormalSpriteColl_029404(uint8 k) { // 029404 +void CheckPlayerAttackToNormalSpriteColl_029404(uint8 k, uint8 r14) { // 029404 spr_decrementing_table154c[k] = 8; if (spr_spriteid[k] == 0x81) { if (spr_table00c2[k]) { @@ -1345,7 +1742,7 @@ void CheckPlayerAttackToNormalSpriteColl_029404(uint8 k) { // 029404 spr_decrementing_table1540[k] = -1; LABEL_11: spr_decrementing_table1558[k] = 0; - if (R14_ != 53) + if (r14 != 53) SpawnContactEffectFromSide(k); GivePoints(k, 0); spr_current_status[k] = 2; @@ -1362,9 +1759,9 @@ void CheckPlayerAttackToNormalSpriteColl_029404(uint8 k) { // 029404 } } uint8 v1 = -64; - if (R14_) { + if (r14) { v1 = -80; - if (R14_ == 2) + if (r14 == 2) v1 = -64; } spr_yspeed[k] = v1; @@ -1379,17 +1776,16 @@ void RunPlayerBlockCode_TriggerCapeDiveGroundPound() { // 0294c1 for (uint8 i = 9; (i & 0x80) == 0; --i) { if (spr_current_status[i] >= 8 && (spr_table1588[i] & 4) != 0 && !(spr_decrementing_table154c[i] | spr_table15d0[i] | spr_property_bits166e[i] & 0x20)) { - R14_ = 53; - CheckPlayerAttackToNormalSpriteColl_029404(i); + CheckPlayerAttackToNormalSpriteColl_029404(i, 53); } } } void HandleCapeInteraction() { // 0294f5 if (flag_cape_to_sprite_interaction) { - R14_ = flag_cape_to_sprite_interaction; + //r14 = flag_cape_to_sprite_interaction; if (counter_global_frames & 1) { - CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry(); + CheckPlayerAttackToNormalSpriteColl_CapeSwingEntry(flag_cape_to_sprite_interaction); HandleCapeToExtendedSpriteCollision(); } HandleCapeLevelCollision(); @@ -1397,63 +1793,62 @@ void HandleCapeInteraction() { // 0294f5 } void HandleCapeLevelCollision() { // 02950b - R15_ = 0; - HandleCapeLevelColl_029540(); + HandleCapeLevelColl_029540(0); if ((misc_level_layout_flags & 0x80) != 0) { - ++R15_; player_cape_hitbox_x += misc_second_level_layer_xpos; player_cape_hitbox_y += misc_second_level_layer_ypos; - HandleCapeLevelColl_029540(); + HandleCapeLevelColl_029540(1); } } -void HandleCapeLevelColl_029540() { // 029540 +void HandleCapeLevelColl_029540(uint8 r15) { // 029540 + uint16 r5; + uint8 r0, r1, r2, r3; uint8 v0 = counter_global_frames & 1; - if ((misc_level_layout_flags & (uint8)(R15_ + 1)) != 0) { + if ((misc_level_layout_flags & (uint8)(r15 + 1)) != 0) { uint16 posy = player_cape_hitbox_y + kHandleCapeLevelColl_DATA_02953C[v0]; - LOBYTE(blocks_ypos) = R0_ = posy & 0xF0; + + LOBYTE(blocks_ypos) = r0 = posy & 0xF0; if ((posy >> 8) < misc_screens_in_lvl) { - HIBYTE(blocks_ypos) = R3_ = (posy >> 8); + HIBYTE(blocks_ypos) = r3 = (posy >> 8); uint16 posx = player_cape_hitbox_x + kHandleCapeLevelColl_DATA_02953E[v0]; - LOBYTE(blocks_xpos) = R1_ = posx; + LOBYTE(blocks_xpos) = r1 = posx; if ((uint8)(posx >> 8) < 2) { - HIBYTE(blocks_xpos) = R2_ = (posx >> 8); - R0_ |= R1_ >> 4; - uint8 v2 = kLevelDataLayoutTables_EightBitLo_Vertical[R3_]; - uint8 v3 = kLevelDataLayoutTables_EightBitHi_Vertical[R3_]; - if (R15_) { - v2 = kLevelDataLayoutTables_EightBitLo_Vertical_L2[R3_]; - v3 = kLevelDataLayoutTables_EightBitHi_Vertical_L2[R3_]; + HIBYTE(blocks_xpos) = r2 = (posx >> 8); + r0 |= r1 >> 4; + uint8 v2 = kLevelDataLayoutTables_EightBitLo_Vertical[r3]; + uint8 v3 = kLevelDataLayoutTables_EightBitHi_Vertical[r3]; + if (r15) { + v2 = kLevelDataLayoutTables_EightBitLo_Vertical[r3 + 14]; + v3 = kLevelDataLayoutTables_EightBitHi_Vertical[r3 + 14]; } - R5_W = PAIR16(R2_, R0_) + PAIR16(v3, v2); + r5 = PAIR16(r2, r0) + PAIR16(v3, v2); LABEL_17: - R7_ = 126; - blocks_currently_processed_map16_tile_lo = *IndirPtr(&R5_, 0); - ++R7_; - uint8 *v8 = IndirPtr(&R5_, 0); + blocks_currently_processed_map16_tile_lo = g_ram[r5]; + uint8 *v8 = &g_ram[r5 + 0x10000]; if (ModifyMap16IDForSpecialBlocks(*v8)) { - LOBYTE(misc_current_layer_being_processed) = R15_; + LOBYTE(misc_current_layer_being_processed) = r15; CheckIfBlockWasHit(blocks_currently_processed_map16_tile_lo, 0); } } } } else { uint16 posy = player_cape_hitbox_y + kHandleCapeLevelColl_DATA_02953C[v0]; - LOBYTE(blocks_ypos) = R0_ = posy & ~0xF; + LOBYTE(blocks_ypos) = r0 = posy & ~0xF; if ((posy >> 8) < 2) { - HIBYTE(blocks_ypos) = R2_ = (posy >> 8); + HIBYTE(blocks_ypos) = r2 = (posy >> 8); uint16 posx = player_cape_hitbox_x + kHandleCapeLevelColl_DATA_02953E[v0]; - LOBYTE(blocks_xpos) = R1_ = posx; + LOBYTE(blocks_xpos) = r1 = posx; if ((uint8)(posx >> 8) < misc_screens_in_lvl) { - HIBYTE(blocks_xpos) = R3_ = posx >> 8; - R0_ |= R1_ >> 4; - uint8 v6 = kLevelDataLayoutTables_EightBitLo[R3_]; - uint8 v7 = kLevelDataLayoutTables_EightBitHi[R3_]; - if (R15_) { - v6 = kLevelDataLayoutTables_EightBitLo_Horizontal_L2[R3_]; - v7 = kLevelDataLayoutTables_EightBitHi_Horizontal_L2[R3_]; + HIBYTE(blocks_xpos) = r3 = posx >> 8; + r0 |= r1 >> 4; + uint8 v6 = kLevelDataLayoutTables_EightBitLo_Horizontal[r3]; + uint8 v7 = kLevelDataLayoutTables_EightBitHi_Horizontal[r3]; + if (r15) { + v6 = kLevelDataLayoutTables_EightBitLo_Horizontal[r3 + 16]; + v7 = kLevelDataLayoutTables_EightBitHi_Horizontal[r3 + 16]; } - R5_W = PAIR16(R2_, R0_) + PAIR16(v7, v6); + r5 = PAIR16(r2, r0) + PAIR16(v7, v6); goto LABEL_17; } } @@ -1464,9 +1859,10 @@ void HandleCapeToExtendedSpriteCollision() { // 029631 for (uint8 i = 7; (i & 0x80) == 0; --i) { spr_current_slotid = i; if (ext_spr_spriteid[i] >= 2) { - GetExtendedSpriteClipping(i); - CheckPlayerAttackToNormalSpriteColl_GetCapeSwingOrNetPunchClipping(); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + GetExtendedSpriteClipping(i, &ci); + CheckPlayerAttackToNormalSpriteColl_GetCapeSwingOrNetPunchClipping(&ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (ext_spr_spriteid[i] != 18) CheckMarioToExtendedSpriteColl_02A4DE(i); } @@ -1474,21 +1870,21 @@ void HandleCapeToExtendedSpriteCollision() { // 029631 } } -void CheckPlayerAttackToNormalSpriteColl_GetBounceSpriteClipping(uint8 j) { // 029663 +void CheckPlayerAttackToNormalSpriteColl_GetBounceSpriteClipping(uint8 j, CollInfo *ci) { // 029663 uint8 v1 = bounce_spr_type[j]; - SetHiLo(&R8_, &R0_, PAIR16(kCheckPlayerAttackToNormalSpriteColl_DATA_029658[v1 - 1], kCheckPlayerAttackToNormalSpriteColl_DATA_029657[v1 - 1]) + + SetHiLo(&ci->r8, &ci->r0, PAIR16(kCheckPlayerAttackToNormalSpriteColl_DATA_029658[v1 - 1], kCheckPlayerAttackToNormalSpriteColl_DATA_029657[v1 - 1]) + PAIR16(bounce_spr_hitbox_x_hi[j], bounce_spr_hitbox_x_lo[j])); - R2_ = kCheckPlayerAttackToNormalSpriteColl_DATA_02965A[v1 - 1]; - SetHiLo(&R9_, &R1_, PAIR16(kCheckPlayerAttackToNormalSpriteColl_DATA_02965E[v1 - 1], kCheckPlayerAttackToNormalSpriteColl_DATA_02965C[v1 - 1]) + + ci->r2 = kCheckPlayerAttackToNormalSpriteColl_DATA_02965A[v1 - 1]; + SetHiLo(&ci->r9, &ci->r1, PAIR16(kCheckPlayerAttackToNormalSpriteColl_DATA_02965E[v1 - 1], kCheckPlayerAttackToNormalSpriteColl_DATA_02965C[v1 - 1]) + PAIR16(bounce_spr_hitbox_y_hi[j], bounce_spr_hitbox_y_lo[j])); - R3_ = kCheckPlayerAttackToNormalSpriteColl_DATA_029660[v1 - 1]; + ci->r3 = kCheckPlayerAttackToNormalSpriteColl_DATA_029660[v1 - 1]; } -void CheckPlayerAttackToNormalSpriteColl_GetCapeSwingOrNetPunchClipping() { // 029696 - SetHiLo(&R8_, &R0_, player_cape_hitbox_x - 2); - R2_ = 20; - SetHiLo(&R9_, &R1_, player_cape_hitbox_y); - R3_ = 16; +void CheckPlayerAttackToNormalSpriteColl_GetCapeSwingOrNetPunchClipping(CollInfo *ci) { // 029696 + SetHiLo(&ci->r8, &ci->r0, player_cape_hitbox_x - 2); + ci->r2 = 20; + SetHiLo(&ci->r9, &ci->r1, player_cape_hitbox_y); + ci->r3 = 16; } void ProcessBounceAndSmokeSprites_SmokeSprites(uint8 k) { // 0296c0 @@ -1644,11 +2040,11 @@ void SmokeSpr05_Glitter(uint8 k) { // 0298ca } } mextspr_spriteid[v2] = 2; - R1_ = smoke_spr_ypos_lo[k]; - R0_ = smoke_spr_xpos_lo[k]; + uint8 r1 = smoke_spr_ypos_lo[k]; + uint8 r0 = smoke_spr_xpos_lo[k]; uint8 v3 = (smoke_spr_timer[k] >> 2) & 3; - mextspr_xpos_lo[v2] = R0_ + kSmokeSpr05_Glitter_DATA_0298C2[v3]; - mextspr_ypos_lo[v2] = R1_ + kSmokeSpr05_Glitter_DATA_0298C6[v3]; + mextspr_xpos_lo[v2] = r0 + kSmokeSpr05_Glitter_DATA_0298C2[v3]; + mextspr_ypos_lo[v2] = r1 + kSmokeSpr05_Glitter_DATA_0298C6[v3]; mextspr_timer[v2] = 23; } } @@ -1721,34 +2117,33 @@ void ProcessSpinningCoinSprites_Sub(uint8 k) { // 0299f1 } } uint8 v2 = 4 * block_coin_spr_layer_index[k]; - R2_ = *((uint8 *)&mirror_current_layer1_ypos + v2); - R3_ = *((uint8 *)&mirror_current_layer1_xpos + v2); - R4_ = *((uint8 *)&mirror_current_layer1_ypos + v2 + 1); - if (block_coin_spr_ypos_hi[k] != (uint8)((block_coin_spr_ypos_lo[k] < R2_) + R4_)) + uint8 r2 = *((uint8 *)&mirror_current_layer1_ypos + v2); + uint8 r3 = *((uint8 *)&mirror_current_layer1_xpos + v2); + uint8 r4 = *((uint8 *)&mirror_current_layer1_ypos + v2 + 1); + if (block_coin_spr_ypos_hi[k] != (uint8)((block_coin_spr_ypos_lo[k] < r2) + r4)) return; - if ((uint8)(block_coin_spr_xpos_lo[k] - R3_) >= 0xF8) { + if ((uint8)(block_coin_spr_xpos_lo[k] - r3) >= 0xF8) { LABEL_9: block_coin_spr_slotid[k] = 0; return; } - R0_ = block_coin_spr_xpos_lo[k] - R3_; - R1_ = block_coin_spr_ypos_lo[k] - R2_; - R15_ = kProcessSpinningCoinSprites_DATA_0299E9[k]; - uint8 v3 = R15_; - OamEnt *oam = get_OamEnt(oam_buf, R15_); - oam->xpos = R0_; - oam->ypos = R1_; + uint8 r0 = block_coin_spr_xpos_lo[k] - r3; + uint8 r1 = block_coin_spr_ypos_lo[k] - r2; + uint8 v3 = kProcessSpinningCoinSprites_DATA_0299E9[k]; + OamEnt *oam = get_OamEnt(oam_buf, v3); + oam->xpos = r0; + oam->ypos = r1; oam->charnum = -24; oam->flags = sprites_tile_priority | 4; sprites_oamtile_size_buffer[v3 >> 2] = 2; if ((((uint8)(counter_local_frames + k) >> 2) & 3) != 0) { - uint8 v5 = R15_; + uint8 v5 = v3; uint8 v6 = ((uint8)(counter_local_frames + k) >> 2) & 3; - int8 v7 = R0_ + 4; - OamEnt *v8 = get_OamEnt(oam_buf, R15_); - v8->xpos = R0_ + 4; + int8 v7 = r0 + 4; + OamEnt *v8 = get_OamEnt(oam_buf, v3); + v8->xpos = r0 + 4; v8[1].xpos = v7; - v8[1].ypos = R1_ + 8; + v8[1].ypos = r1 + 8; uint8 v9 = kProcessSpinningCoinSprites_RollingCoinTiles[v6 - 1]; v8->charnum = v9; v8[1].charnum = v9; @@ -1803,11 +2198,11 @@ void ProcessExtendedSprites_029B16(uint8 k) { // 029b16 void ExtSpr0C_VolcanoLotusFire(uint8 k) { // 029b51 uint8 v1 = kExtendedSpriteOAMIndexes[k]; uint8 v2 = ext_spr_xpos_lo[k]; - R0_ = v2 - mirror_current_layer1_xpos; + uint8 r0 = v2 - mirror_current_layer1_xpos; if (ext_spr_xpos_hi[k] != (uint8)((v2 < (uint8)mirror_current_layer1_xpos) + HIBYTE(mirror_current_layer1_xpos))) goto LABEL_18; uint8 v3 = ext_spr_ypos_lo[k]; - R1_ = v3 - mirror_current_layer1_ypos; + uint8 r1 = v3 - mirror_current_layer1_ypos; int8 v4 = ext_spr_ypos_hi[k] - ((v3 < (uint8)mirror_current_layer1_ypos) + HIBYTE(mirror_current_layer1_ypos)); if (v4) { if (v4 >= 0) { @@ -1817,9 +2212,9 @@ void ExtSpr0C_VolcanoLotusFire(uint8 k) { // 029b51 } } else { OamEnt *oam = get_OamEnt(oam_buf, v1); - oam->xpos = R0_; - if (R1_ < 0xF0) { - oam->ypos = R1_; + oam->xpos = r0; + if (r1 < 0xF0) { + oam->ypos = r1; oam->flags = sprites_tile_priority | 9; int8 v6 = -90; if (((spr_current_slotid ^ (counter_local_frames >> 1)) & 2) != 0) @@ -1846,13 +2241,11 @@ void ExtSpr0C_VolcanoLotusFire(uint8 k) { // 029b51 void SpawnYoshiStompSmoke() { // 029be4 timer_shake_layer1 = 5; io_sound_ch3 = 9; - R0_ = 0; - SpawnYoshiStompSmoke_SpawnFirstSmoke(); - R0_ = 1; - SpawnYoshiStompSmoke_SpawnFirstSmoke(); + SpawnYoshiStompSmoke_SpawnFirstSmoke(0); + SpawnYoshiStompSmoke_SpawnFirstSmoke(1); } -void SpawnYoshiStompSmoke_SpawnFirstSmoke() { // 029bf5 +void SpawnYoshiStompSmoke_SpawnFirstSmoke(uint8 r0) { // 029bf5 uint8 j = 7; while (ext_spr_spriteid[j]) { if ((--j & 0x80) != 0) @@ -1860,8 +2253,8 @@ void SpawnYoshiStompSmoke_SpawnFirstSmoke() { // 029bf5 } ext_spr_spriteid[j] = 15; SetHiLo(&ext_spr_ypos_hi[j], &ext_spr_ypos_lo[j], player_ypos + 40); - SetHiLo(&ext_spr_xpos_hi[j], &ext_spr_xpos_lo[j], player_xpos + PAIR16(kSpawnYoshiStompSmoke_InitialXHi[R0_], kSpawnYoshiStompSmoke_InitialXLo[R0_])); - ext_spr_xspeed[j] = kSpawnYoshiStompSmoke_InitialXSpeed[R0_]; + SetHiLo(&ext_spr_xpos_hi[j], &ext_spr_xpos_lo[j], player_xpos + PAIR16(kSpawnYoshiStompSmoke_InitialXHi[r0], kSpawnYoshiStompSmoke_InitialXLo[r0])); + ext_spr_xspeed[j] = kSpawnYoshiStompSmoke_InitialXSpeed[r0]; ext_spr_decrementing_table176f[j] = 21; } @@ -1917,7 +2310,8 @@ void ExtSpr0A_CloudCoin(uint8 k) { // 029cb5 ext_spr_xspeed[k] = v1; UpdateExtendedSpritePosition_X(k); } else { - if (!ext_spr_table1765[k] && HandleExtendedSpriteLevelCollision(k) & 1) { + ExtCollOut eco; + if (!ext_spr_table1765[k] && HandleExtendedSpriteLevelCollision(k, &eco) & 1) { ext_spr_yspeed[k] = -48; ++ext_spr_table1765[k]; } @@ -1925,19 +2319,18 @@ void ExtSpr0A_CloudCoin(uint8 k) { // 029cb5 } } if ((uint8)(ext_spr_ypos_lo[k] - mirror_current_layer1_ypos) < 0xF0) { - R1_ = ext_spr_ypos_lo[k] - mirror_current_layer1_ypos; + uint8 r1 = ext_spr_ypos_lo[k] - mirror_current_layer1_ypos; if (ext_spr_xpos_hi[k] == (uint8)((ext_spr_xpos_lo[k] < (uint8)mirror_current_layer1_xpos) + HIBYTE(mirror_current_layer1_xpos))) { uint8 v2 = kExtendedSpriteOAMIndexes[k]; - R15_ = v2; - R0_ = ext_spr_xpos_lo[k] - mirror_current_layer1_xpos; + uint8 r0 = ext_spr_xpos_lo[k] - mirror_current_layer1_xpos; OamEnt *oam = get_OamEnt(oam_buf, v2); - oam->xpos = R0_; + oam->xpos = r0; if (ext_spr_spriteid[k] == 14) { - oam->ypos = R1_ - 5; + oam->ypos = r1 - 5; oam->charnum = -104; ExtSpr0A_CloudCoin_029D36(v2, 0xB); } else { - ExtSpr0A_CloudCoin_029D45(v2); + ExtSpr0A_CloudCoin_029D45(v2, r1); } } } else { @@ -1950,9 +2343,9 @@ void ExtSpr0A_CloudCoin_029D36(uint8 j, uint8 a) { // 029d36 sprites_oamtile_size_buffer[j >> 2] = 0; } -void ExtSpr0A_CloudCoin_029D45(uint8 j) { // 029d45 +void ExtSpr0A_CloudCoin_029D45(uint8 j, uint8 r1) { // 029d45 OamEnt *oam = get_OamEnt(oam_buf, j); - oam->ypos = R1_; + oam->ypos = r1; oam->charnum = -62; ExtSpr0A_CloudCoin_029D36(j, 4); sprites_oamtile_size_buffer[j >> 2] = 2; @@ -1964,19 +2357,19 @@ void ExtSpr09_Unused(uint8 k) { // 029d9d CheckMarioToExtendedSpriteCollision(k); if (spr_current_status[ext_spr_xspeed[k]] == 8 && (v1 = ext_spr_decrementing_table176f[k]) != 0) { - R15_ = kExtSpr09_Unused_DATA_029D5E[v1 >> 2]; - R2_ = R15_ + __CFSHL__(R15_, 1) + 2 * R15_; - R3_ = R2_ + ext_spr_table1765[k]; - R0_ = kExtSpr09_Unused_XDisp[R3_] + ext_spr_xpos_lo[k] - mirror_current_layer1_xpos; - uint8 v2 = kExtSpr09_Unused_YDisp[R3_] + ext_spr_ypos_lo[k] - mirror_current_layer1_ypos; - R1_ = v2; + uint8 r15 = kExtSpr09_Unused_DATA_029D5E[v1 >> 2]; + uint8 r2 = 3 * r15; + uint8 r3 = r2 + ext_spr_table1765[k]; + uint8 r0 = kExtSpr09_Unused_XDisp[r3] + ext_spr_xpos_lo[k] - mirror_current_layer1_xpos; + uint8 v2 = kExtSpr09_Unused_YDisp[r3] + ext_spr_ypos_lo[k] - mirror_current_layer1_ypos; + uint8 r1 = v2; uint8 v3 = kExtendedSpriteOAMIndexes[k]; - if (v2 < 0xF0 && (oam = get_OamEnt(oam_buf, v3), oam->ypos = v2, R0_ >= 0x10) && R0_ < 0xF0) { - oam->xpos = R0_; + if (v2 < 0xF0 && (oam = get_OamEnt(oam_buf, v3), oam->ypos = v2, r0 >= 0x10) && r0 < 0xF0) { + oam->xpos = r0; oam->flags = kExtSpr09_Unused_Prop[ext_spr_table1765[k]]; - oam->charnum = kExtSpr09_Unused_Tiles[R3_]; - sprites_oamtile_size_buffer[v3 >> 2] = kExtSpr09_Unused_TileSize[R15_]; - if ((uint8)(R0_ - player_on_screen_pos_x + 4) < 8 && (uint8)(R1_ - player_on_screen_pos_y) < 0x10) { + oam->charnum = kExtSpr09_Unused_Tiles[r3]; + sprites_oamtile_size_buffer[v3 >> 2] = kExtSpr09_Unused_TileSize[r15]; + if ((uint8)(r0 - player_on_screen_pos_x + 4) < 8 && (uint8)(r1 - player_on_screen_pos_y) < 0x10) { CheckMarioToExtendedSpriteColl_02A469(spr_current_slotid); } } else { @@ -2032,9 +2425,9 @@ void ExtSpr07_LavaSplash(uint8 k) { // 029e86 } uint8 v2 = kExtendedSpriteOAMIndexes[k]; uint8 v3 = ext_spr_xpos_lo[k]; - R0_ = v3 - mirror_current_layer1_xpos; + uint8 r0 = v3 - mirror_current_layer1_xpos; if (ext_spr_xpos_hi[k] == (uint8)((v3 < (uint8)mirror_current_layer1_xpos) + HIBYTE(mirror_current_layer1_xpos)) && - (oam = get_OamEnt(oam_buf, v2), oam->xpos = R0_, (uint8)(ext_spr_ypos_lo[k] - mirror_current_layer1_ypos) < 0xF0)) { + (oam = get_OamEnt(oam_buf, v2), oam->xpos = r0, (uint8)(ext_spr_ypos_lo[k] - mirror_current_layer1_ypos) < 0xF0)) { oam->ypos = ext_spr_ypos_lo[k] - mirror_current_layer1_ypos; oam->charnum = kExtSpr07_LavaSplash_Tiles[(ext_spr_decrementing_table176f[k] >> 3) & 3]; oam->flags = sprites_tile_priority | 5; @@ -2046,19 +2439,21 @@ void ExtSpr07_LavaSplash(uint8 k) { // 029e86 } void ExtSpr12_BreathBubble(uint8 k) { // 029eee + ExtCollOut eco = { 0 }; + uint8 t; if (!flag_sprites_locked) { if ((++ext_spr_table1765[k] & 0x30) != 0) AddHiLo(&ext_spr_ypos_hi[k], &ext_spr_ypos_lo[k], -1); if (!((counter_global_frames ^ k) & 1) && - (HandleExtendedSpriteLevelCollision(k) || !flag_underwater_level && R12_ >= 6 && (!R15_ || R13_ >= 6))) { + ((t = HandleExtendedSpriteLevelCollision(k, &eco)) & 1 || !flag_underwater_level && eco.r12 >= 6 && (!(t & 2) || eco.r13 >= 6))) { goto LABEL_11; } } if (ext_spr_ypos_hi[k] == (uint8)((ext_spr_ypos_lo[k] < (uint8)mirror_current_layer1_ypos) + HIBYTE(mirror_current_layer1_ypos))) { GenericExtendedSpriteDraw(k); - R0_ = kExtSpr12_BreathBubble_XDisp[(uint8)(ext_spr_table1765[k] & 0xC) >> 2]; + uint8 r0 = kExtSpr12_BreathBubble_XDisp[(uint8)(ext_spr_table1765[k] & 0xC) >> 2]; OamEnt *oam = get_OamEnt(oam_buf, kExtendedSpriteOAMIndexes[k]); - oam->xpos += R0_; + oam->xpos += r0; oam->ypos += 5; oam->charnum = 28; } else { @@ -2097,15 +2492,16 @@ void ExtSpr05_MarioFireball(uint8 k) { // 029faf CheckPlayerFireballToNormalSpriteCollision(k); if (sign8(ext_spr_yspeed[k] - 48)) ext_spr_yspeed[k] += 4; - if (HandleExtendedSpriteLevelCollision(k)) { + ExtCollOut eco; + if (HandleExtendedSpriteLevelCollision(k, &eco) & 1) { if (++ext_spr_sub_xpos[k] >= 2) { ExtSpr05_MarioFireball_02A02C(k); ExtSpr05_MarioFireball_02A045(k); return; } if ((ext_spr_xspeed[k] & 0x80) != 0) - R11_ = -R11_; - uint8 v1 = R11_ + 4; + eco.r11 = -eco.r11; + uint8 v1 = eco.r11 + 4; ext_spr_yspeed[k] = kExtSpr05_MarioFireball_DATA_029F99[v1]; SetHiLo(&ext_spr_ypos_hi[k], &ext_spr_ypos_lo[k], PAIR16(ext_spr_ypos_hi[k], ext_spr_ypos_lo[k]) - kExtSpr05_MarioFireball_DATA_029FA2[v1]); } else { @@ -2133,19 +2529,19 @@ void ExtSpr05_MarioFireball_02A04F(uint8 k) { // 02a04f OamEnt *oam; uint8 v1 = kExtSpr05_MarioFireball_DATA_029FA2[k + 3]; - R0_ = (uint8)(ext_spr_xspeed[k] & 0x80) >> 1; + uint8 r0 = (uint8)(ext_spr_xspeed[k] & 0x80) >> 1; if ((uint8)(ext_spr_xpos_lo[k] - mirror_current_layer1_xpos) >= 0xF8 || (oam = get_OamEnt(oam_buf, v1), oam[64].xpos = ext_spr_xpos_lo[k] - mirror_current_layer1_xpos, (uint8)(ext_spr_ypos_lo[k] - mirror_current_layer1_ypos) >= 0xF0)) { EraseExtSprite(k); } else { oam[64].ypos = ext_spr_ypos_lo[k] - mirror_current_layer1_ypos; - R1_ = ext_spr_table1779[k]; + uint8 r1 = ext_spr_table1779[k]; uint8 v3 = (ext_spr_table1765[k] >> 2) & 3; oam[64].charnum = kGenericExtendedSpriteGFXRt_FireballTiles[v3]; - int8 v4 = sprites_tile_priority | R0_ ^ kGenericExtendedSpriteGFXRt_DATA_02A15F[v3]; + int8 v4 = sprites_tile_priority | r0 ^ kGenericExtendedSpriteGFXRt_DATA_02A15F[v3]; oam[64].flags = v4; - if (R1_) + if (r1) oam[64].flags = v4 & 0xCF | 0x10; sprites_oamtile_size_buffer[(v1 >> 2) + 64] = 0; } @@ -2158,9 +2554,10 @@ void CheckPlayerFireballToNormalSpriteCollision(uint8 k) { // 02a0ac for (uint8 i = 9; (i & 0x80) == 0; --i) { spr_current_slotid = i; if (spr_current_status[i] >= 8 && ext_spr_table1779[v1] == (spr_table1632[i] | spr_table15d0[i] | spr_property_bits167a[i] & 2)) { - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(i); - CheckPlayerFireballToNormalSpriteColl_GetPlayerFireballClipping(v1); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(i, &ci); + CheckPlayerFireballToNormalSpriteColl_GetPlayerFireballClipping(v1, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (ext_spr_spriteid[v1] != 17) ExtSpr05_MarioFireball_02A045(v1); if ((spr_property_bits166e[i] & 0x10) == 0) { @@ -2202,45 +2599,48 @@ void ExtSpr02_ReznorFireball(uint8 k) { // 02a16b void ExtSpr02_ReznorFireball_PiranhaFireballEntry(uint8 k) { // 02a178 if ((misc_nmito_use_flag & 0x80) != 0) { GenericExtendedSpriteDraw(k); + uint8 r0 = (uint8)(ext_spr_xspeed[k] & 0x80 ^ 0x80) >> 1; uint8 v1 = kExtendedSpriteOAMIndexes[k]; uint8 v2 = (counter_local_frames >> 2) & 3; OamEnt *oam = get_OamEnt(oam_buf, v1); oam->charnum = kExtSpr02_ReznorFireball_Tiles[v2]; - oam->flags = R0_ ^ kExtSpr02_ReznorFireball_Prop[v2]; + oam->flags = r0 ^ kExtSpr02_ReznorFireball_Prop[v2]; sprites_oamtile_size_buffer[v1 >> 2] = 2; } else { GenericExtendedSpriteDraw(k); } } -void GenericExtendedSpriteDraw(uint8 k) { // 02a1a4 - GenericExtendedSpriteGFXRt_FireballEntry(k, kExtendedSpriteOAMIndexes[k]); +uint8 GenericExtendedSpriteDraw(uint8 k) { // 02a1a4 + return GenericExtendedSpriteGFXRt_FireballEntry(k, kExtendedSpriteOAMIndexes[k]); } -void GenericExtendedSpriteGFXRt_FireballEntry(uint8 k, uint8 j) { // 02a1a7 +uint8 GenericExtendedSpriteGFXRt_FireballEntry(uint8 k, uint8 j) { // 02a1a7 uint8 v3; + uint8 r2; - R0_ = (uint8)(ext_spr_xspeed[k] & 0x80 ^ 0x80) >> 1; + uint8 r0 = (uint8)(ext_spr_xspeed[k] & 0x80 ^ 0x80) >> 1; uint8 v2 = ext_spr_xpos_lo[k]; - R1_ = v2 - mirror_current_layer1_xpos; + uint8 r1 = v2 - mirror_current_layer1_xpos; if (ext_spr_xpos_hi[k] == (uint8)((v2 < (uint8)mirror_current_layer1_xpos) + HIBYTE(mirror_current_layer1_xpos)) && - (v3 = ext_spr_ypos_lo[k], R2_ = v3 - mirror_current_layer1_ypos, + (v3 = ext_spr_ypos_lo[k], r2 = v3 - mirror_current_layer1_ypos, ext_spr_ypos_hi[k] == (uint8)((v3 < (uint8)mirror_current_layer1_ypos) + HIBYTE(mirror_current_layer1_ypos))) && - R2_ < 0xF0) { + r2 < 0xF0) { OamEnt *oam = get_OamEnt(oam_buf, j); - oam->ypos = R2_; - oam->xpos = R1_; - R1_ = ext_spr_table1779[k]; + oam->ypos = r2; + oam->xpos = r1; + r1 = ext_spr_table1779[k]; uint8 v5 = (counter_local_frames >> 2) & 3; oam->charnum = kGenericExtendedSpriteGFXRt_FireballTiles[v5]; - int8 v6 = sprites_tile_priority | R0_ ^ kGenericExtendedSpriteGFXRt_DATA_02A15F[v5]; + int8 v6 = sprites_tile_priority | r0 ^ kGenericExtendedSpriteGFXRt_DATA_02A15F[v5]; oam->flags = v6; - if (R1_) + if (r1) oam->flags = v6 & 0xCF | 0x10; sprites_oamtile_size_buffer[j >> 2] = 0; } else { EraseExtSprite(k); } + return r0; } void ExtSpr03_FlameRemnant(uint8 k) { // 02a219 @@ -2274,7 +2674,7 @@ void ExtSpr0D_Baseball(uint8 k) { // 02a254 } if (ext_spr_spriteid[k] == 13) { uint8 v1 = ext_spr_xpos_lo[k]; - R0_ = v1 - mirror_current_layer1_xpos; + uint8 r0 = v1 - mirror_current_layer1_xpos; int8 v2 = ext_spr_xpos_hi[k] - ((v1 < (uint8)mirror_current_layer1_xpos) + HIBYTE(mirror_current_layer1_xpos)); if (v2) { if (((ext_spr_xspeed[k] ^ v2) & 0x80) != 0) @@ -2285,12 +2685,12 @@ void ExtSpr0D_Baseball(uint8 k) { // 02a254 } uint8 v3 = kExtendedSpriteOAMIndexes[k]; OamEnt *oam = get_OamEnt(oam_buf, v3); - oam->xpos = R0_; + oam->xpos = r0; uint8 v5 = ext_spr_ypos_lo[k]; - R1_ = v5 - mirror_current_layer1_ypos; + uint8 r1 = v5 - mirror_current_layer1_ypos; if (ext_spr_ypos_hi[k] != (uint8)((v5 < (uint8)mirror_current_layer1_ypos) + HIBYTE(mirror_current_layer1_ypos))) goto LABEL_12; - oam->ypos = R1_; + oam->ypos = r1; oam->charnum = -83; oam->flags = (16 * counter_local_frames) & 0xC0 | 0x39; sprites_oamtile_size_buffer[v3 >> 2] = 0; @@ -2323,12 +2723,12 @@ void ExtSpr04_Hammer(uint8 k) { // 02a2ef } uint8 ExtSpr04_Hammer_ThrownBoneEntry(uint8 k) { // 02a317 - GenericExtendedSpriteDraw(k); + uint8 r0 = GenericExtendedSpriteDraw(k); uint8 result = kExtendedSpriteOAMIndexes[k]; uint8 v2 = (ext_spr_table1765[k] >> 3) & 7; OamEnt *oam = get_OamEnt(oam_buf, result); oam->charnum = kExtSpr04_Hammer_Tiles[v2]; - oam->flags = sprites_tile_priority | R0_ ^ kExtSpr04_Hammer_Prop[v2] ^ 0x40; + oam->flags = sprites_tile_priority | r0 ^ kExtSpr04_Hammer_Prop[v2] ^ 0x40; sprites_oamtile_size_buffer[result >> 2] = 2; return result; } @@ -2370,9 +2770,10 @@ void ExtSpr01_SmokePuff(uint8 k) { // 02a34f void CheckMarioToExtendedSpriteCollision(uint8 k) { // 02a3f6 if (ext_spr_table1779[k] == player_current_layer_priority) { - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - GetExtendedSpriteClipping(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + GetExtendedSpriteClipping(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (ext_spr_spriteid[k] == 10) { GiveCoins_OneCoin(); ++counter_pink_berry_cloud_coins; @@ -2444,104 +2845,103 @@ void CheckMarioToExtendedSpriteColl_02A4DE(uint8 k) { // 02a4de ext_spr_spriteid[k] = 1; } -void GetExtendedSpriteClipping(uint8 k) { // 02a519 +void GetExtendedSpriteClipping(uint8 k, CollInfo *ci) { // 02a519 uint8 v1 = ext_spr_spriteid[k]; - SetHiLo(&R10_, &R4_, PAIR16(ext_spr_xpos_hi[k], ext_spr_xpos_lo[k]) + kGetExtendedSpriteClipping_DATA_02A4E9[v1 - 2]); - R6_ = kGetExtendedSpriteClipping_DATA_02A501[v1 - 2]; - SetHiLo(&R11_, &R5_, PAIR16(ext_spr_ypos_hi[k], ext_spr_ypos_lo[k]) + kGetExtendedSpriteClipping_DATA_02A4F5[v1 - 2]); - R7_ = kGetExtendedSpriteClipping_DATA_02A50D[v1 - 2]; + SetHiLo(&ci->r10, &ci->r4, PAIR16(ext_spr_xpos_hi[k], ext_spr_xpos_lo[k]) + kGetExtendedSpriteClipping_DATA_02A4E9[v1 - 2]); + ci->r6 = kGetExtendedSpriteClipping_DATA_02A501[v1 - 2]; + SetHiLo(&ci->r11, &ci->r5, PAIR16(ext_spr_ypos_hi[k], ext_spr_ypos_lo[k]) + kGetExtendedSpriteClipping_DATA_02A4F5[v1 - 2]); + ci->r7 = kGetExtendedSpriteClipping_DATA_02A50D[v1 - 2]; } -void CheckPlayerFireballToNormalSpriteColl_GetPlayerFireballClipping(uint8 j) { // 02a547 - SetHiLo(&R8_, &R0_, PAIR16(ext_spr_xpos_hi[j], ext_spr_xpos_lo[j]) - 2); - R2_ = 12; - SetHiLo(&R9_, &R1_, PAIR16(ext_spr_ypos_hi[j], ext_spr_ypos_lo[j]) - 4); - R3_ = 19; +void CheckPlayerFireballToNormalSpriteColl_GetPlayerFireballClipping(uint8 j, CollInfo *ci) { // 02a547 + SetHiLo(&ci->r8, &ci->r0, PAIR16(ext_spr_xpos_hi[j], ext_spr_xpos_lo[j]) - 2); + ci->r2 = 12; + SetHiLo(&ci->r9, &ci->r1, PAIR16(ext_spr_ypos_hi[j], ext_spr_ypos_lo[j]) - 4); + ci->r3 = 19; } -uint8 HandleExtendedSpriteLevelCollision(uint8 k) { // 02a56e - R15_ = 0; - R14_ = 0; - R11_ = 0; +// &1 = R14, &2 = R15 +uint8 HandleExtendedSpriteLevelCollision(uint8 k, ExtCollOut *out) { // 02a56e + uint8 r15 = 0; + uint8 r14 = 0; + out->r11 = 0; sprites_distance_to_snap_down_to_nearest_tile = 0; if (!flag_reznor_room_oamindex_timer && (misc_nmito_use_flag & 0x80) != 0) { if ((misc_nmito_use_flag & 0x40) == 0) { - WORD(temp14b4) = PAIR16(ext_spr_xpos_hi[k], ext_spr_xpos_lo[k]) + 4; - WORD(temp14b6) = PAIR16(ext_spr_ypos_hi[k], ext_spr_ypos_lo[k]) + 8; - return CheckTiltingPlatformCollision(); + uint16 temp14b4 = PAIR16(ext_spr_xpos_hi[k], ext_spr_xpos_lo[k]) + 4; + uint16 temp14b6 = PAIR16(ext_spr_ypos_hi[k], ext_spr_ypos_lo[k]) + 8; + return CheckTiltingPlatformCollision(temp14b4, temp14b6).retval; } if (misc_nmito_use_flag != 0xC1) return ext_spr_ypos_lo[k] >= 0xA8; } - R14_ = 2 * R14_ + (HandleExtendedSpriteLevelColl_02A611(k)); - R12_ = blocks_currently_processed_map16_tile_lo; + r14 = 2 * r14 + (HandleExtendedSpriteLevelColl_02A611(k, 0, out)); + out->r12 = blocks_currently_processed_map16_tile_lo; if ((misc_level_layout_flags & 0x80) != 0) { - ++R15_; + ++r15; uint16 old_x = PAIR16(ext_spr_xpos_hi[k], ext_spr_xpos_lo[k]); uint16 old_y = PAIR16(ext_spr_ypos_hi[k], ext_spr_ypos_lo[k]); AddHiLo(&ext_spr_xpos_hi[k], &ext_spr_xpos_lo[k], misc_second_level_layer_xpos); AddHiLo(&ext_spr_ypos_hi[k], &ext_spr_ypos_lo[k], misc_second_level_layer_ypos); - R14_ = 2 * R14_ + (HandleExtendedSpriteLevelColl_02A611(k)); - R13_ = blocks_currently_processed_map16_tile_lo; + r14 = 2 * r14 + (HandleExtendedSpriteLevelColl_02A611(k, 1, out)); + out->r13 = blocks_currently_processed_map16_tile_lo; SetHiLo(&ext_spr_xpos_hi[k], &ext_spr_xpos_lo[k], old_x); SetHiLo(&ext_spr_ypos_hi[k], &ext_spr_ypos_lo[k], old_y); } - return R14_ != 0; + return (r14 != 0) + (r15 != 0) * 2; } -uint8 HandleExtendedSpriteLevelColl_02A611(uint8 k) { // 02a611 +uint8 HandleExtendedSpriteLevelColl_02A611(uint8 k, uint8 r15, ExtCollOut *out) { // 02a611 + uint16 r5; + uint8 r0, r1, r2, r3; while (1) { - if ((misc_level_layout_flags & (uint8)(R15_ + 1)) != 0) { + if ((misc_level_layout_flags & (uint8)(r15 + 1)) != 0) { uint16 t = PAIR16(ext_spr_ypos_hi[k], ext_spr_ypos_lo[k]) + 8; LOBYTE(blocks_ypos) = t; - R0_ = t & ~0xF; + r0 = t & ~0xF; if ((t >> 8) >= misc_screens_in_lvl) return 0; - R3_ = (t >> 8); + r3 = (t >> 8); HIBYTE(blocks_ypos) = (t >> 8); t = PAIR16(ext_spr_xpos_hi[k], ext_spr_xpos_lo[k]) + 4; - R1_ = t; + r1 = t; LOBYTE(blocks_xpos) = t; if ((t >> 8) >= 2) return 0; - HIBYTE(blocks_xpos) = R2_ = (t >> 8); - R0_ |= R1_ >> 4; - uint8 v4 = kLevelDataLayoutTables_EightBitLo_Vertical[R3_]; - uint8 v5 = kLevelDataLayoutTables_EightBitHi_Vertical[R3_]; - if (R15_) { - v4 = kLevelDataLayoutTables_EightBitLo_Vertical_L2[R3_]; - v5 = kLevelDataLayoutTables_EightBitHi_Vertical_L2[R3_]; + HIBYTE(blocks_xpos) = r2 = (t >> 8); + r0 |= r1 >> 4; + uint8 v4 = kLevelDataLayoutTables_EightBitLo_Vertical[r3]; + uint8 v5 = kLevelDataLayoutTables_EightBitHi_Vertical[r3]; + if (r15) { + v4 = kLevelDataLayoutTables_EightBitLo_Vertical[r3 + 14]; + v5 = kLevelDataLayoutTables_EightBitHi_Vertical[r3 + 14]; } - *(uint16 *)&R5_ = PAIR16(R2_, R0_) + PAIR16(v5, v4); + r5 = PAIR16(r2, r0) + PAIR16(v5, v4); } else { uint16 t = PAIR16(ext_spr_ypos_hi[k], ext_spr_ypos_lo[k]) + 8; blocks_ypos = t; - R0_ = t & 0xf0; - R2_ = t >> 8; - if ((uint8)(R0_ - mirror_current_layer1_ypos) >= 0xF0) + r0 = t & 0xf0; + r2 = t >> 8; + if ((uint8)(r0 - mirror_current_layer1_ypos) >= 0xF0) return 0; uint16 xpos = PAIR16(ext_spr_xpos_hi[k], ext_spr_xpos_lo[k]) + 4; - - LOBYTE(blocks_xpos) = R1_ = xpos; + LOBYTE(blocks_xpos) = r1 = xpos; if ((xpos >> 8) >= misc_screens_in_lvl) return 0; - R3_ = (xpos >> 8); + r3 = (xpos >> 8); HIBYTE(blocks_xpos) = (xpos >> 8); - R0_ |= R1_ >> 4; - uint8 v10 = kLevelDataLayoutTables_EightBitLo[R3_]; - uint8 v11 = kLevelDataLayoutTables_EightBitHi[R3_]; - if (R15_) { - v10 = kLevelDataLayoutTables_EightBitLo_Horizontal_L2[R3_]; - v11 = kLevelDataLayoutTables_EightBitHi_Horizontal_L2[R3_]; + r0 |= r1 >> 4; + uint8 v10 = kLevelDataLayoutTables_EightBitLo_Horizontal[r3]; + uint8 v11 = kLevelDataLayoutTables_EightBitHi_Horizontal[r3]; + if (r15) { + v10 = kLevelDataLayoutTables_EightBitLo_Horizontal[r3 + 16]; + v11 = kLevelDataLayoutTables_EightBitHi_Horizontal[r3 + 16]; } - *(uint16 *)&R5_ = PAIR16(R2_, R0_) + PAIR16(v11, v10); + r5 = PAIR16(r2, r0) + PAIR16(v11, v10); } - R7_ = 126; k = spr_current_slotid; - blocks_currently_processed_map16_tile_lo = *IndirPtr(&R5_, 0); - ++R7_; - uint8 *v12 = IndirPtr(&R5_, 0); - if (!ModifyMap16IDForSpecialBlocks(*v12)) + blocks_currently_processed_map16_tile_lo = g_ram[r5]; + if (!ModifyMap16IDForSpecialBlocks(g_ram[r5 + 0x10000])) return 0; if (blocks_currently_processed_map16_tile_lo < 0x11) return (blocks_ypos & 0xF) < 6; @@ -2553,14 +2953,16 @@ uint8 HandleExtendedSpriteLevelColl_02A611(uint8 k) { // 02a611 return 0; AddHiLo(&ext_spr_ypos_hi[k], &ext_spr_ypos_lo[k], -2); } - R10_ = blocks_xpos; - R12_ = blocks_ypos; - uint8 v13 = CheckWhatSlopeSpriteIsOn(blocks_currently_processed_map16_tile_lo); - uint8 v14 = R0_; - if (R0_ < 0xC && v14 < *IndirPtr(&R5_, v13)) + out->r10 = blocks_xpos; + out->r12 = blocks_ypos; + uint8 r8_slope_type; + uint8 v13 = CheckWhatSlopeSpriteIsOn(blocks_currently_processed_map16_tile_lo, blocks_xpos, blocks_ypos, &r8_slope_type); + uint8 v14 = blocks_ypos & 0xf; + uint8 *rr = IndirPtr(&R5_slopeptr, v13); + if (v14 < 0xC && v14 < *rr) return 0; - sprites_distance_to_snap_down_to_nearest_tile = *IndirPtr(&R5_, v13); - R11_ = kSlopeDataTables_SlopeType[R8_]; + sprites_distance_to_snap_down_to_nearest_tile = *rr; + out->r11 = kSlopeDataTables_SlopeType[r8_slope_type]; return 1; } @@ -2582,69 +2984,73 @@ void ParseLevelSpriteList() { // 02a7fc void ParseLevelSpriteList_Entry2() { // 02a802 int8 v0; + uint8 r0; if (misc_level_layout_flags & 1) { uint16 t = kParseLevelSpriteList_DATA_02A7F6[camera_layer1_scrolling_direction] + (uint8)mirror_current_layer1_ypos; - R0_ = t & 0xF0; + r0 = t & 0xF0; v0 = HIBYTE(mirror_current_layer1_ypos) + (t >> 8); } else { uint16 t = kParseLevelSpriteList_DATA_02A7F6[camera_layer1_scrolling_direction] + (uint8)mirror_current_layer1_xpos; - R0_ = t & 0xF0; + r0 = t & 0xF0; v0 = HIBYTE(mirror_current_layer1_xpos) + (t >> 8); } int8 v1 = kParseLevelSpriteList_DATA_02A7F9[camera_layer1_scrolling_direction] + v0; if (v1 >= 0) { - R1_ = v1; - ParseLevelSpriteList_LoadSpriteLoopStrt(0, 1); + uint8 r1 = v1; + ParseLevelSpriteList_LoadSpriteLoopStrt(0, 1, r0 | r1 << 8); } } -void ParseLevelSpriteList_LoadSpriteLoopStrt(uint8 k, uint8 j) { // 02a82e +void ParseLevelSpriteList_LoadSpriteLoopStrt(uint8 k, uint8 j, uint16 r0w) { // 02a82e + uint8 *psld = IndirPtr(&ptr_sprite_list_data, 0); + uint8 r2, r3; while (1) { - uint8 *v2 = IndirPtr(&ptr_sprite_list_data, j); +// printf("M: Load sprites offs %d: 0x%x\n", j, r0w); + uint8 *v2 = &psld[j]; if (*v2 == 0xFF) break; - R2_ = (8 * *v2) & 0x10; + r2 = (8 * *v2) & 0x10; uint8 v3 = j + 1; - uint8 v4 = R2_ | *IndirPtr(&ptr_sprite_list_data, v3) & 0xF; - bool v5 = v4 < R1_; - int8 v6 = v4 - R1_; + uint8 v4 = r2 | psld[v3] & 0xF; + bool v5 = v4 < (r0w >> 8); + int8 v6 = v4 - (r0w >> 8); if (v5) goto LABEL_3; if (v6) return; - if ((*IndirPtr(&ptr_sprite_list_data, v3) & 0xF0) != R0_ || sprites_load_status[k]) { + if ((psld[v3] & 0xF0) != (uint8)r0w || sprites_load_status[k]) { LABEL_3: j = v3 + 2; ++k; } else { - R2_ = k; + r2 = k; ++sprites_load_status[k]; uint8 v7 = v3 + 1; - uint8 v8 = *IndirPtr(&ptr_sprite_list_data, v7); + uint8 v8 = psld[v7]; uint8 v9; - R5_ = v8; + uint8 r5 = v8; v3 = v7 - 1; if (v8 >= 0xE7) { if (!*(uint16 *)l1_l2_scroll_spr_spriteid) { - l1_l2_scroll_spr_spriteid[0] = R5_ + 25; - l1_l2_scroll_spr_scroll_type_index[0] = *IndirPtr(&ptr_sprite_list_data, (uint8)(v3 - 1)) >> 2; + l1_l2_scroll_spr_spriteid[0] = r5 + 25; + l1_l2_scroll_spr_scroll_type_index[0] = psld[(uint8)(v3 - 1)] >> 2; InitializeScrollSprites(); } goto LABEL_3; } if (v8 == 0xDE) { - R3_ = v3 - 1; - Spr0DE_Load5Eeries(k); + r3 = v3 - 1; + Spr0DE_Load5Eeries(k, r0w, r2, r3); goto LABEL_3; } if (v8 == 0xE0) { - R3_ = v3 - 1; - Spr0E0_Load3Platforms(); + r3 = v3 - 1; + Spr0E0_Load3Platforms(r0w, r2, r3); goto LABEL_3; } if (v8 < 0xCB) { if (v8 >= 0xC9) { - SprXXX_LoadShooter(k, v3, v8); + SprXXX_LoadShooter(k, v3, v8, r0w); goto LABEL_3; } v9 = 1; @@ -2655,51 +3061,51 @@ void ParseLevelSpriteList_LoadSpriteLoopStrt(uint8 k, uint8 j) { // 02a82e goto LABEL_3; } if (v8 >= 0xE1) { - R3_ = v3 - 1; - Spr0E1_LoadBooCeiling(k, v8); + r3 = v3 - 1; + Spr0E1_LoadBooCeiling(k, v8, r0w, r2, r3); goto LABEL_3; } v9 = 9; } - R4_ = v9; - R3_ = v3 - 1; + uint8 r4 = v9; + r3 = v3 - 1; uint8 v10 = kParseLevelSpriteList_SpriteSlotMax[sprites_sprite_memory_setting]; - R6_ = kParseLevelSpriteList_SpriteSlotStart[sprites_sprite_memory_setting]; - if (R5_ == kParseLevelSpriteList_ReservedSprite1[sprites_sprite_memory_setting]) { + uint8 r6 = kParseLevelSpriteList_SpriteSlotStart[sprites_sprite_memory_setting]; + if (r5 == kParseLevelSpriteList_ReservedSprite1[sprites_sprite_memory_setting]) { v10 = kParseLevelSpriteList_SpriteSlotMax1[sprites_sprite_memory_setting]; - R6_ = kParseLevelSpriteList_SpriteSlotStart1[sprites_sprite_memory_setting]; + r6 = kParseLevelSpriteList_SpriteSlotStart1[sprites_sprite_memory_setting]; } - if (R5_ == kParseLevelSpriteList_ReservedSprite2[sprites_sprite_memory_setting] && (R5_ != 100 || (R0_ & 0x10) != 0)) { + if (r5 == kParseLevelSpriteList_ReservedSprite2[sprites_sprite_memory_setting] && (r5 != 100 || (r0w & 0x10) != 0)) { v10 = kParseLevelSpriteList_SpriteSlotMax2[sprites_sprite_memory_setting]; - R6_ = -1; + r6 = -1; } - R15_ = v10; + uint8 r15 = v10; while (spr_current_status[v10]) { - if (--v10 == R6_) { - if (R5_ != 123) { + if (--v10 == r6) { + if (r5 != 123) { LABEL_38: - sprites_load_status[R2_] = 0; + sprites_load_status[r2] = 0; return; } - v10 = R15_; + v10 = r15; while ((spr_property_bits167a[v10] & 2) != 0) { - if (--v10 == R6_) + if (--v10 == r6) goto LABEL_38; } break; } } - uint8 v11 = R3_; - uint8 *v12 = IndirPtr(&ptr_sprite_list_data, R3_); + uint8 v11 = r3; + uint8 *v12 = &psld[r3]; if (misc_level_layout_flags & 1) { - SetSprXYPos(v10, *v12 & 0xF0 | (*v12 & 0xD) << 8, R0_W); + SetSprXYPos(v10, *v12 & 0xF0 | (*v12 & 0xD) << 8, r0w); } else { - SetSprXYPos(v10, R0_W, *v12 & 0xF0 | (*v12 & 0xD) << 8); + SetSprXYPos(v10, r0w, *v12 & 0xF0 | (*v12 & 0xD) << 8); } uint8 v14 = v11 + 2; - spr_current_status[v10] = R4_; - uint8 v15 = *IndirPtr(&ptr_sprite_list_data, v14); - if (R4_ >= 9) + spr_current_status[v10] = r4; + uint8 v15 = psld[v14]; + if (r4 >= 9) v15 += 42; if ((ow_level_tile_settings[73] & 0x80) != 0) { if (v15 == 4) @@ -2708,7 +3114,7 @@ void ParseLevelSpriteList_LoadSpriteLoopStrt(uint8 k, uint8 j) { // 02a82e v15 = 6; } spr_spriteid[v10] = v15; - spr_load_status_table_index[v10] = R2_; + spr_load_status_table_index[v10] = r2; if (!timer_silver_pswitch || (kInitializeNormalSpriteRAMTables_Sprite190FVals[spr_spriteid[v10]] & 0x40) != 0) { InitializeNormalSpriteRAMTables(v10); } else { @@ -2720,32 +3126,30 @@ void ParseLevelSpriteList_LoadSpriteLoopStrt(uint8 k, uint8 j) { // 02a82e spr_xoffscreen_flag[v10] = 1; spr_decrementing_table1fe2[v10] = 4; j = v14 + 1; - k = R2_ + 1; + k = r2 + 1; } } } uint8 FindFreeNormalSpriteSlot_LowPriority() { // 02a9de - R14_ = 2; - return FindFreeNormalSpriteSlot_02A9E6(); + return FindFreeNormalSpriteSlot_02A9E6(2); } uint8 FindFreeNormalSpriteSlot_HighPriority() { // 02a9e4 - R14_ = 0; - return FindFreeNormalSpriteSlot_02A9E6(); + return FindFreeNormalSpriteSlot_02A9E6(0); } -uint8 FindFreeNormalSpriteSlot_02A9E6() { // 02a9ef - R15_ = kParseLevelSpriteList_SpriteSlotStart[sprites_sprite_memory_setting]; - uint8 result = kParseLevelSpriteList_SpriteSlotMax[sprites_sprite_memory_setting] - R14_; +uint8 FindFreeNormalSpriteSlot_02A9E6(uint8 r14) { // 02a9ef + uint8 r15 = kParseLevelSpriteList_SpriteSlotStart[sprites_sprite_memory_setting]; + uint8 result = kParseLevelSpriteList_SpriteSlotMax[sprites_sprite_memory_setting] - r14; while (spr_current_status[result]) { - if (--result == R15_) + if (--result == r15) return -1; } return result; } -void Spr0E1_LoadBooCeiling(uint8 k, uint8 a) { // 02aac0 +void Spr0E1_LoadBooCeiling(uint8 k, uint8 a, uint16 r0w, uint8 r2, uint8 r3) { // 02aac0 flag_run_cluster_sprites = 1; switch (a) { case 0xE4: @@ -2756,7 +3160,7 @@ void Spr0E1_LoadBooCeiling(uint8 k, uint8 a) { // 02aac0 uint8 r = GetRand(); SetHiLo(&cluster_spr_xpos_hi[i], &cluster_spr_xpos_lo[i], mirror_current_layer1_xpos + r); cluster_spr_table0f4a[i] = cluster_spr_xpos_lo[i]; - uint8 *v14 = IndirPtr(&ptr_sprite_list_data, R3_); + uint8 *v14 = IndirPtr(&ptr_sprite_list_data, r3); cluster_spr_ypos_lo[i] = *v14 & 0xF0; cluster_spr_ypos_hi[i] = *v14 & 1; } @@ -2788,28 +3192,28 @@ void Spr0E1_LoadBooCeiling(uint8 k, uint8 a) { // 02aac0 uint8 v7 = 1; if (a != 0xE2) v7 = -1; - R15_ = v7; - R14_ = 9; + uint8 r15 = v7; + uint8 r14 = 9; for (uint8 n = 19; (n & 0x80) == 0; --n) { if (!cluster_spr_spriteid[n]) { cluster_spr_spriteid[n] = 4; cluster_spr_table0f86[n] = cluster_spr04_boo_ring_index; - cluster_spr_table0f72[n] = R14_; - uint8 v9 = R15_; - cluster_spr_table0f4a[n] = R15_; - R15_ = 0; + cluster_spr_table0f72[n] = r14; + uint8 v9 = r15; + cluster_spr_table0f4a[n] = r15; + r15 = 0; if (v9) { - uint8 *v10 = IndirPtr(&ptr_sprite_list_data, R3_); + uint8 *v10 = IndirPtr(&ptr_sprite_list_data, r3); uint8 v11 = cluster_spr04_boo_ring_index; uint8 v18 = *v10; - *(&cluster_spr04_boo_ring1_center_ypos_lo + cluster_spr04_boo_ring_index) = v18 & 0xF0; - *(&cluster_spr04_boo_ring1_center_ypos_hi + cluster_spr04_boo_ring_index) = v18 & 1; - *(&cluster_spr04_boo_ring1_center_xpos_lo + v11) = R0_; - *(&cluster_spr04_boo_ring1_center_xpos_hi + v11) = R1_; + *(&cluster_spr04_boo_ring1_center_ypos_lo + v11) = v18 & 0xF0; + *(&cluster_spr04_boo_ring1_center_ypos_hi + v11) = v18 & 1; + *(&cluster_spr04_boo_ring1_center_xpos_lo + v11) = r0w; + *(&cluster_spr04_boo_ring1_center_xpos_hi + v11) = r0w >> 8; *(&cluster_spr04_boo_ring1_offscreen_flag + v11) = 0; - *(&cluster_spr04_boo_ring_unused_ring1_level_list_index + v11) = R2_; + *(&cluster_spr04_boo_ring_unused_ring1_level_list_index + v11) = r2; } - if ((--R14_ & 0x80) != 0) + if ((--r14 & 0x80) != 0) break; } } @@ -2832,10 +3236,10 @@ void Spr0E1_LoadBooCeiling(uint8 k, uint8 a) { // 02aac0 } } -void SprXXX_LoadShooter(uint8 k, uint8 j, uint8 a) { // 02ab78 - R2_ = k; - R3_ = j - 1; - R4_ = a; +void SprXXX_LoadShooter(uint8 k, uint8 j, uint8 a, uint16 r0w) { // 02ab78 + uint8 r2 = k; + uint8 r3 = j - 1; + uint8 r4 = a; uint8 v3 = 7; while (shooter_spr_spriteid[v3]) { if ((--v3 & 0x80) != 0) { @@ -2846,42 +3250,40 @@ void SprXXX_LoadShooter(uint8 k, uint8 j, uint8 a) { // 02ab78 break; } } - uint8 v4 = R3_; - shooter_spr_spriteid[v3] = R4_ + 56; - if (misc_level_layout_flags & 1) { - uint8 *v5 = IndirPtr(&ptr_sprite_list_data, v4); + uint8 v4 = r3; + shooter_spr_spriteid[v3] = r4 + 56; + uint8 *v5 = IndirPtr(&ptr_sprite_list_data, v4); + + if (misc_level_layout_flags & 1) { uint8 v7 = *v5; shooter_spr_xpos_lo[v3] = *v5 & 0xF0; shooter_spr_xpos_hi[v3] = v7 & 1; - shooter_spr_ypos_lo[v3] = R0_; - shooter_spr_ypos_hi[v3] = R1_; + SetHiLo(&shooter_spr_ypos_hi[v3], &shooter_spr_ypos_lo[v3], r0w); } else { - uint8 *v6 = IndirPtr(&ptr_sprite_list_data, v4); - uint8 v8 = *v6; - shooter_spr_ypos_lo[v3] = *v6 & 0xF0; + uint8 v8 = *v5; + shooter_spr_ypos_lo[v3] = *v5 & 0xF0; shooter_spr_ypos_hi[v3] = v8 & 1; - shooter_spr_xpos_lo[v3] = R0_; - shooter_spr_xpos_hi[v3] = R1_; + SetHiLo(&shooter_spr_xpos_hi[v3], &shooter_spr_xpos_lo[v3], r0w); } - shooter_spr_unused_level_list_index[v3] = R2_; + shooter_spr_unused_level_list_index[v3] = r2; shooter_spr_shoot_timer[v3] = 16; - ParseLevelSpriteList_LoadSpriteLoopStrt(R2_ + 1, v4 + 3); + ParseLevelSpriteList_LoadSpriteLoopStrt(r2 + 1, v4 + 3, r0w); } void InitializeAllSpritesOnLevelLoad() { // 02abf2 for (int8 i = 63; i >= 0; --i) sprites_load_status[(uint8)i] = 0; - R0_ = -1; + uint8 r0 = -1; for (uint8 j = 11; (j & 0x80) == 0; --j) { spr_load_status_table_index[j] = -1; if (spr_current_status[j] == 11) - R0_ = j; + r0 = j; else spr_current_status[j] = 0; } - uint8 v2 = R0_; - if ((R0_ & 0x80) == 0) { - spr_current_status[R0_] = 0; + uint8 v2 = r0; + if ((r0 & 0x80) == 0) { + spr_current_status[r0] = 0; spr_current_status[0] = 11; spr_spriteid[0] = spr_spriteid[v2]; SetSprXPos(0, GetSprXPos(v2)); @@ -2985,7 +3387,7 @@ void ProcessScoreSprites_Sub(uint8 k) { // 02adc9 uint8 v2 = score_spr_spriteid[k]; if (v2 >= 0xD) { if (v2 < 0x11) { - misc_1up_handler += kProcessScoreSprites_CoinsToGive[v2 - 17]; + misc_1up_handler += kProcessScoreSprites_StuffToGive[v2 - 13]; timer_give1up = 0; LABEL_10: LABEL_11: @@ -2999,7 +3401,7 @@ void ProcessScoreSprites_Sub(uint8 k) { // 02adc9 } goto LABEL_15; } - GiveCoins_MultipleCoins(kProcessScoreSprites_CoinsToGive[v2 - 17]); + GiveCoins_MultipleCoins(kProcessScoreSprites_StuffToGive[v2 - 13]); } uint8 v3 = 3 * player_current_character; uint32 t = *(&player_mario_score_hi + v3) << 16 | *(&player_mario_score_mid + v3) << 8 | *(&player_mario_score_lo + v3); @@ -3011,19 +3413,19 @@ void ProcessScoreSprites_Sub(uint8 k) { // 02adc9 } LABEL_15:; uint8 v10 = 4 * score_spr_layer_index[k]; - R2_W = *(uint16 *)((char *)&mirror_current_layer1_ypos + v10); - R4_W = *(uint16 *)((char *)&mirror_current_layer1_xpos + v10); - uint16 xpos = PAIR16(score_spr_xpos_hi[k], score_spr_xpos_lo[k]) - R4_W; - uint16 ypos = PAIR16(score_spr_ypos_hi[k], score_spr_ypos_lo[k]) - R2_W; + uint16 r2w = *(uint16 *)((char *)&mirror_current_layer1_ypos + v10); + uint16 r4w = *(uint16 *)((char *)&mirror_current_layer1_xpos + v10); + uint16 xpos = PAIR16(score_spr_xpos_hi[k], score_spr_xpos_lo[k]) - r4w; + uint16 ypos = PAIR16(score_spr_ypos_hi[k], score_spr_ypos_lo[k]) - r2w; if (!((uint16)(xpos + 12) >> 8) && !(xpos >> 8) && !(ypos >> 8)) { uint8 v11 = kProcessScoreSprites_OAMIndex[k]; if ((misc_nmito_use_flag & 0x40) != 0) v11 = 4; - int8 v12 = score_spr_ypos_lo[k] - R2_; + int8 v12 = score_spr_ypos_lo[k] - r2w; OamEnt *oam = get_OamEnt(oam_buf, v11); oam->ypos = v12; oam[1].ypos = v12; - int8 v14 = score_spr_xpos_lo[k] - R4_; + int8 v14 = score_spr_xpos_lo[k] - r4w; oam->xpos = v14; oam[1].xpos = v14 + 8; uint8 v23 = k; @@ -3035,7 +3437,7 @@ LABEL_15:; uint8 v17 = score_spr_spriteid[v16]; uint8 v18 = 8; if (v17 >= 0xE) - v18 = kProcessScoreSprites_TwoUp3UpProp[v17 - 14]; + v18 = kProcessScoreSprites_StuffToGive[v17 - 5]; int8 v19 = v18 | 0x30; OamEnt *v20 = get_OamEnt(oam_buf, v24); v20->flags = v19; @@ -3045,8 +3447,8 @@ LABEL_15:; sprites_oamtile_size_buffer[v21 + 1] = 0; if (score_spr_spriteid[v16] >= 0x11) { OamEnt *v22 = get_OamEnt(oam_buf, 0x4C); - v22->xpos = score_spr_xpos_lo[v16] - R4_ - 8; - v22->ypos = score_spr_ypos_lo[v16] - R2_; + v22->xpos = score_spr_xpos_lo[v16] - r4w - 8; + v22->ypos = score_spr_ypos_lo[v16] - r2w; v22->charnum = 95; v22->flags = 52; sprites_oamtile_size_buffer[19] = 0; @@ -3054,11 +3456,10 @@ LABEL_15:; } } -void Spr0E0_Load3Platforms() { // 02af33 - uint8 v3 = *IndirPtr(&ptr_sprite_list_data, R3_); - R8_ = v3 & 0xF0; - R9_ = v3 & 1; - R4_ = 2; +void Spr0E0_Load3Platforms(uint16 r0w, uint8 r2, uint8 r3) { // 02af33 + uint8 v3 = *IndirPtr(&ptr_sprite_list_data, r3); + uint16 ypos = PAIR16(v3 & 1, v3 & 0xF0); + uint8 r4 = 2; do { uint8 j = FindFreeNormalSpriteSlot_HighPriority(); if ((j & 0x80) != 0) @@ -3067,35 +3468,34 @@ void Spr0E0_Load3Platforms() { // 02af33 spr_current_status[j] = 1; spr_spriteid[j] = -93; InitializeNormalSpriteRAMTables(j); - SetSprXYPos(j, R0_W, R8_W); - uint8 v2 = R4_; - spr_table1602[v1] = kSpr0E0_Load3Platforms_InitialAngleLo[R4_]; + SetSprXYPos(j, r0w, ypos); + uint8 v2 = r4; + spr_table1602[v1] = kSpr0E0_Load3Platforms_InitialAngleLo[r4]; spr_table151c[v1] = kSpr0E0_Load3Platforms_InitialAngleHi[v2]; if (v2 == 2) - spr_load_status_table_index[v1] = R2_; - } while ((--R4_ & 0x80) == 0); + spr_load_status_table_index[v1] = r2; + } while ((--r4 & 0x80) == 0); } -void Spr0DE_Load5Eeries(uint8 k) { // 02af9d - uint8 v5 = *IndirPtr(&ptr_sprite_list_data, R3_); - R8_ = v5 & 0xF0; - R9_ = v5 & 1; - R4_ = 4; +void Spr0DE_Load5Eeries(uint8 k, uint16 r0w, uint8 r2, uint8 r3) { // 02af9d + uint8 v5 = *IndirPtr(&ptr_sprite_list_data, r3); + uint16 ypos = PAIR16(v5 & 1, v5 & 0xF0); + uint8 r4 = 4; do { uint8 j = FindFreeNormalSpriteSlot_HighPriority(); if ((j & 0x80) != 0) break; - uint8 v3 = R4_; + uint8 v3 = r4; spr_current_status[j] = 8; spr_spriteid[j] = 57; InitializeNormalSpriteRAMTables(j); - SetSprXYPos(j, PAIR16(kSpr0DE_Load5Eeries_xhi[v3], kSpr0DE_Load5Eeries_xlo[v3]) + R0_W, R8_W); + SetSprXYPos(j, PAIR16(kSpr0DE_Load5Eeries_xhi[v3], kSpr0DE_Load5Eeries_xlo[v3]) + r0w, ypos); spr_yspeed[j] = kSpr0DE_Load5Eeries_InitialYSpeed[v3]; spr_table00c2[j] = kSpr0DE_Load5Eeries_InitialVerticalDirection[v3]; if (v3 == 4) - spr_load_status_table_index[j] = R2_; + spr_load_status_table_index[j] = r2; spr_xspeed[j] = kSpr0DE_Load5Eeries_InitialXSpeed[CheckPlayerPositionRelativeToSprite_Bank23_X(j)]; - } while ((--R4_ & 0x80) == 0); + } while ((--r4 & 0x80) == 0); } void ProcessGeneratorSprite() { // 02affe @@ -3153,25 +3553,25 @@ void GenSpr0D_GenerateDiagnalBullets() { // 02b0cd sprites_special_bullet_generator_timer = 0; io_sound_ch3 = 9; int8 v1 = kGenSpr0C_GenerateSurroundingBullets_DATA_02B0CB[gen_spr_spriteid - 12]; - R13_ = kGenSpr0C_GenerateSurroundingBullets_DATA_02B0C9[gen_spr_spriteid - 12]; + uint8 r13 = kGenSpr0C_GenerateSurroundingBullets_DATA_02B0C9[gen_spr_spriteid - 12]; do { - GenSpr0C_GenerateSurroundingBullets(); - --R13_; + GenSpr0C_GenerateSurroundingBullets(r13); + --r13; --v1; } while (v1 >= 0); } } } -void GenSpr0C_GenerateSurroundingBullets() { // 02b115 +void GenSpr0C_GenerateSurroundingBullets(uint8 r13) { // 02b115 uint8 j = FindFreeNormalSpriteSlot_LowPriority(); if ((j & 0x80) == 0) { spr_spriteid[j] = 28; spr_current_status[j] = 8; InitializeNormalSpriteRAMTables(j); - SetSprXPos(j, mirror_current_layer1_xpos + kGenSpr0C_GenerateSurroundingBullets_InitialXLo[R13_]); - SetSprYPos(j, mirror_current_layer1_ypos + kGenSpr0C_GenerateSurroundingBullets_InitialYLo[R13_]); - spr_table00c2[j] = kGenSpr0C_GenerateSurroundingBullets_InitialFiringDirection[R13_]; + SetSprXPos(j, mirror_current_layer1_xpos + kGenSpr0C_GenerateSurroundingBullets_InitialXLo[r13]); + SetSprYPos(j, mirror_current_layer1_ypos + kGenSpr0C_GenerateSurroundingBullets_InitialYLo[r13]); + spr_table00c2[j] = kGenSpr0C_GenerateSurroundingBullets_InitialFiringDirection[r13]; } } @@ -3234,10 +3634,10 @@ void GenSpr0A_GenerateBubbles() { // 02b207 void GenSprXX_GenerateDolphins() { // 02b26c if ((counter_local_frames & 0x1F) == 0) { uint8 v5 = gen_spr_spriteid; - uint8 j = kGenSprXX_GenerateDolphins_InitialYSpeed[v5 - 1]; - R0_ = kGenSprXX_GenerateDolphins_InitialYSpeed[v5 + 1]; + uint8 j = kGenSprXX_GenerateDolphins_DATA_02B268[v5 - 5]; + uint8 r0 = kGenSprXX_GenerateDolphins_DATA_02B26A[v5 - 5]; while (spr_current_status[j]) { - if (--j == R0_) + if (--j == r0) return; } spr_current_status[j] = 8; @@ -3246,8 +3646,8 @@ void GenSprXX_GenerateDolphins() { // 02b26c uint8 v1 = (GetRand() & 0x7F) + 64; SetSprYPos(j, mirror_current_layer1_ypos + v1); spr_yspeed[j] = kGenSprXX_GenerateDolphins_InitialYSpeed[GetRand() & 3]; - SetSprXPos(j, mirror_current_layer1_xpos + PAIR16(kGenSpr0A_GenerateBubbles_DATA_02B25A[v5 + 1], kGenSpr0A_GenerateBubbles_DATA_02B25A[v5 - 1])); - spr_xspeed[j] = kGenSprXX_GenerateDolphins_InitialXLo[v5 - 1]; + SetSprXPos(j, mirror_current_layer1_xpos + PAIR16(kGenSprXX_GenerateDolphins_InitialXHi[v5 - 5], kGenSprXX_GenerateDolphins_InitialXLo[v5 - 5])); + spr_xspeed[j] = kGenSprXX_GenerateDolphins_InitialXSpeed[v5 - 5]; ++spr_table151c[j]; } } @@ -3332,7 +3732,7 @@ void ShooterSpr02_TorpedoShooter(uint8 k) { // 02b3b6 InitializeNormalSpriteRAMTables(j); uint8 v3 = CheckPlayerPositionRelativeToSprite_Bank23_X(j); spr_table157c[v2] = v3; - R0_ = v3; + uint8 r0 = v3; spr_decrementing_table1540[v2] = 48; uint8 v4 = 7; while (ext_spr_spriteid[v4]) { @@ -3343,7 +3743,7 @@ void ShooterSpr02_TorpedoShooter(uint8 k) { // 02b3b6 SetHiLo(&ext_spr_xpos_hi[v4], &ext_spr_xpos_lo[v4], PAIR16(shooter_spr_xpos_hi[k], shooter_spr_xpos_lo[k]) + 8); SetHiLo(&ext_spr_ypos_hi[v4], &ext_spr_ypos_lo[v4], PAIR16(shooter_spr_ypos_hi[k], shooter_spr_ypos_lo[k]) - 9); ext_spr_decrementing_table176f[v4] = -112; - ext_spr_xspeed[v4] = kShooterSpr02_TorpedoShooter_InitialXSpeed[R0_]; + ext_spr_xspeed[v4] = kShooterSpr02_TorpedoShooter_InitialXSpeed[r0]; } } } @@ -3475,41 +3875,41 @@ void Spr070_Pokey_Sub(uint8 k) { // 02b672 for (uint8 i = 0; i != 4; ++i) { if ((kSpr070_Pokey_DATA_02B653[i] & spr_table00c2[k]) == 0) { uint8 kb = spr_table00c2[k]; - R0_ = kSpr070_Pokey_DATA_02B657[i] & kb; - spr_table00c2[k] = R0_ | kSpr070_Pokey_DATA_02B65B[i] & (kb >> 1); + uint8 r0 = kSpr070_Pokey_DATA_02B657[i] & kb; + spr_table00c2[k] = r0 | kSpr070_Pokey_DATA_02B65B[i] & (kb >> 1); } } } } - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R1_ += 64; - R2_ = spr_table00c2[k]; - R7_ = R2_; - R4_ = spr_table151c[k]; - R3_ = kSpr070_Pokey_DATA_02B665[spr_decrementing_table1540[k]]; - R5_ = 0; + drt.y += 64; + uint8 r2 = spr_table00c2[k]; + uint8 r7 = r2; + uint8 r4 = spr_table151c[k]; + uint8 r3 = kSpr070_Pokey_DATA_02B665[spr_decrementing_table1540[k]]; + uint8 r5 = 0; uint8 v4 = spr_oamindex[k]; for (int8 j = 4; j >= 0; j--) { - R6_ = j; uint8 v6 = (j + (counter_local_frames >> 3)) & 3; - if (R7_ == 1) + if (r7 == 1) v6 = 0; OamEnt *oam = get_OamEnt(oam_buf, v4); - oam[64].xpos = kSpr070_Pokey_XDisp[v6] + R0_; - uint8 v8 = R6_; - int8 v9 = R2_ & 1; - R2_ >>= 1; + oam[64].xpos = kSpr070_Pokey_XDisp[v6] + drt.x; + uint8 v8 = j; + int8 v9 = r2 & 1; + r2 >>= 1; if (v9) { - v9 = R4_ & 1; - R4_ >>= 1; + v9 = r4 & 1; + r4 >>= 1; if (!v9) - R5_ = R3_; - oam[64].ypos = R1_ - R5_; + r5 = r3; + oam[64].ypos = drt.y - r5; } - R1_ -= 16; + drt.y -= 16; int8 v10 = -24; - if (!(R2_ & 1)) + if (!(r2 & 1)) v10 = -118; oam[64].charnum = v10; oam[64].flags = sprites_tile_priority | 5; @@ -3527,9 +3927,10 @@ void Spr070_Pokey_02B7AC(uint8 k) { // 02b7ac uint8 v1 = 9; while (1) { if (!((counter_global_frames ^ v1) & 1) && spr_current_status[v1] == 10) { - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(v1); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(v1, &ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) break; } if ((--v1 & 0x80) != 0) @@ -3538,12 +3939,12 @@ void Spr070_Pokey_02B7AC(uint8 k) { // 02b7ac if (!spr_decrementing_table1558[k]) { uint8 v2 = spr_ypos_lo[v1] - spr_ypos_lo[k]; sprites_second_tracked_sprite_index = v1; - Spr070_Pokey_RemovePokeySgmntRt(k, v2); - Spr070_Pokey_02B82E(k); + uint8 r13 = Spr070_Pokey_RemovePokeySegment(k, v2); + Spr070_Pokey_02B82E(k, r13); } } -void Spr070_Pokey_RemovePokeySgmntRt(uint8 k, uint8 a) { // 02b7ed +uint8 Spr070_Pokey_RemovePokeySegment(uint8 k, uint8 a) { // 02b7ed uint8 v2 = 0; if (!sign8(a - 9)) { v2 = 1; @@ -3559,16 +3960,13 @@ void Spr070_Pokey_RemovePokeySgmntRt(uint8 k, uint8 a) { // 02b7ed uint8 v3 = kSpr070_Pokey_PokeyUnsetBit[v2] & spr_table00c2[k]; spr_table00c2[k] = v3; spr_table151c[k] = v3; - R13_ = kSpr070_Pokey_DATA_02B829[v2]; + uint8 r13 = kSpr070_Pokey_DATA_02B829[v2]; spr_decrementing_table1540[k] = 12; spr_decrementing_table1558[k] = 24; + return r13; } -void Spr070_Pokey_RemovePokeySegment(uint8 k, uint8 a) { // 02b81c - Spr070_Pokey_RemovePokeySgmntRt(k, a); -} - -void Spr070_Pokey_02B82E(uint8 k) { // 02b82e +void Spr070_Pokey_02B82E(uint8 k, uint8 r13) { // 02b82e uint8 j = FindFreeNormalSpriteSlot_HighPriority(); if ((j & 0x80) == 0) { spr_current_status[j] = 2; @@ -3579,7 +3977,7 @@ void Spr070_Pokey_02B82E(uint8 k) { // 02b82e SetSprYPos(j, GetSprYPos(v2)); spr_xspeed[j] = (int8)spr_xspeed[v2] >> 1; spr_yspeed[j] = -32; - spr_table00c2[j] = R13_ & spr_table00c2[k]; + spr_table00c2[j] = r13 & spr_table00c2[k]; spr_table1534[j] = 1; GivePoints_Entry2(j, 1); } @@ -3616,19 +4014,18 @@ void Spr044_TorpedoTed(uint8 k) { // 02b88a } void Spr044_TorpedoTed_Draw(uint8 k) { // 02b8f7 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - uint8 v2 = R1_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].ypos = R1_; - oam[65].ypos = v2; - R2_ = sprites_tile_priority | spr_table15f6[k]; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].ypos = drt.y; + oam[65].ypos = drt.y; + uint8 r2 = sprites_tile_priority | spr_table15f6[k]; uint8 v4 = spr_table157c[k]; - oam[64].xpos = kSpr044_TorpedoTed_XDisp[v4] + R0_; - oam[65].xpos = kSpr044_TorpedoTed_XDisp[v4 + 1] + R0_; - int8 v5 = R2_ | kSpr044_TorpedoTed_Prop[v4]; + oam[64].xpos = kSpr044_TorpedoTed_XDisp[v4] + drt.x; + oam[65].xpos = kSpr044_TorpedoTed_XDisp[v4 + 1] + drt.x; + int8 v5 = r2 | kSpr044_TorpedoTed_Prop[v4]; oam[64].flags = v5; oam[65].flags = v5; oam[64].charnum = 0x80; @@ -3687,24 +4084,21 @@ void CheckPlayerToNormalSpriteColl_02B9D9(uint8 j) { // 02b9d9 spr_yspeed[j] = -40; } -void CheckBerryTileCollisionWithYoshiTongue() { // 02b9fa - R15_ = 0; - R4_ = R1_ & 0xF0; - if (R9_ < 2) { - R13_ = R9_; - HIBYTE(yoshi_ypos) = R9_; - R6_ = R0_; - if (R8_ < misc_screens_in_lvl) { - R7_ = R8_; - R4_ |= R6_ >> 4; - uint16 vv = PAIR16(kLevelDataLayoutTables_EightBitHi[R8_], kLevelDataLayoutTables_EightBitLo[R8_]); - if (R15_) - vv = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal_L2[R8_], kLevelDataLayoutTables_EightBitLo_Horizontal_L2[R8_]); - R5_W = PAIR16(R13_, R4_) + vv; - R7_ = 126; - blocks_currently_processed_map16_tile_lo = *IndirPtr(&R5_, 0); - ++R7_; - if (!*IndirPtr(&R5_, 0) && blocks_currently_processed_map16_tile_lo >= 0x45 && blocks_currently_processed_map16_tile_lo < 0x48) { +void CheckBerryTileCollisionWithYoshiTongue(CollInfo *ci) { // 02b9fa + uint8 r15 = 0; + uint8 r4 = ci->r1 & 0xF0; + if (ci->r9 < 2) { + uint8 r13 = ci->r9; + HIBYTE(yoshi_ypos) = ci->r9; + if (ci->r8 < misc_screens_in_lvl) { + r4 |= ci->r0 >> 4; + uint16 vv = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[ci->r8], kLevelDataLayoutTables_EightBitLo_Horizontal[ci->r8]); + if (r15) + vv = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[ci->r8 + 16], kLevelDataLayoutTables_EightBitLo_Horizontal[ci->r8 + 16]); + + uint16 r5 = PAIR16(r13, r4) + vv; + blocks_currently_processed_map16_tile_lo = g_ram[r5]; + if (!g_ram[r5 + 0x10000] && blocks_currently_processed_map16_tile_lo >= 0x45 && blocks_currently_processed_map16_tile_lo < 0x48) { yoshi_berry_being_eaten = blocks_currently_processed_map16_tile_lo - 68; uint8 j = 11; while (spr_current_status[j]) { @@ -3713,9 +4107,9 @@ void CheckBerryTileCollisionWithYoshiTongue() { // 02b9fa } spr_current_status[j] = 8; spr_spriteid[j] = 116; - blocks_xpos = PAIR16(R8_, R0_); + blocks_xpos = PAIR16(ci->r8, ci->r0); SetSprXPos(j, blocks_xpos); - blocks_ypos = PAIR16(R9_, R1_); + blocks_ypos = PAIR16(ci->r9, ci->r1); SetSprYPos(j, blocks_ypos); InitializeNormalSpriteRAMTables(j); ++spr_table160e[j]; @@ -3729,16 +4123,16 @@ void CheckBerryTileCollisionWithYoshiTongue() { // 02b9fa } void Spr035_Yoshi_DrawYoshisWings(uint8 k, uint8 a) { // 02bb23 - R2_ = a; + uint8 r2 = a; if (!CheckIfNormalSpriteOffScreen(k)) { OamEnt *oam = get_OamEnt(oam_buf, 0xF8); - SetHiLo(&R4_, &R0_, GetSprXPos(k)); - R1_ = spr_ypos_lo[k]; - uint8 v2 = R2_ + 2 * spr_table157c[k]; - uint16 t = PAIR16(R4_, R0_) + PAIR16(kSpr035_Yoshi_DATA_02BB0F[v2], kSpr035_Yoshi_DATA_02BB0B[v2]) - mirror_current_layer1_xpos; + uint16 xpos = GetSprXPos(k); + uint8 r1 = spr_ypos_lo[k]; + uint8 v2 = r2 + 2 * spr_table157c[k]; + uint16 t = xpos + PAIR16(kSpr035_Yoshi_DATA_02BB0F[v2], kSpr035_Yoshi_DATA_02BB0B[v2]) - mirror_current_layer1_xpos; oam->xpos = t; if (t < 256) { - oam->ypos = kSpr035_Yoshi_DATA_02BB13[v2] + R1_ - mirror_current_layer1_ypos; + oam->ypos = kSpr035_Yoshi_DATA_02BB13[v2] + r1 - mirror_current_layer1_ypos; oam->charnum = kSpr035_Yoshi_Tiles[v2]; oam->flags = kSpr035_Yoshi_Prop[v2] | sprites_tile_priority; sprites_oamtile_size_buffer[0xF8 >> 2] = kSpr035_Yoshi_TileSize[v2]; @@ -3782,37 +4176,36 @@ void SprXXX_Dolphins(uint8 k) { // 02bb94 } void SprXXX_Dolphins_Draw(uint8 k) { // 02bc14 - uint8 drt; + GetDrawInfoRes drt; if (spr_spriteid[k] == 67) { spr_table157c[k] = (uint8)(counter_local_frames & 4) >> 2; GenericGFXRtDraw2Tiles16x16sStacked_Sub(k); } else { - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_xspeed[k]; - uint8 v2 = R0_; - bool v3 = __CFSHL__(R2_, 1); - R2_ *= 2; + uint8 r2 = spr_xspeed[k]; + uint8 v2 = drt.x; + bool v3 = __CFSHL__(r2, 1); + r2 *= 2; if (v3) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; int8 v5 = v2 + 16; oam[65].xpos = v5; oam[66].xpos = v5 + 8; } else { - int8 v6 = R0_ + 24; - OamEnt *v7 = get_OamEnt(oam_buf, drt); - v7[64].xpos = R0_ + 24; + int8 v6 = drt.x + 24; + OamEnt *v7 = get_OamEnt(oam_buf, drt.idx); + v7[64].xpos = drt.x + 24; v6 -= 16; v7[65].xpos = v6; v7[66].xpos = v6 - 8; } - uint8 v8 = R1_; - OamEnt *v9 = get_OamEnt(oam_buf, drt); - v9[64].ypos = R1_; - v9[65].ypos = v8; - v9[66].ypos = v8; + OamEnt *v9 = get_OamEnt(oam_buf, drt.idx); + v9[64].ypos = drt.y; + v9[65].ypos = drt.y; + v9[66].ypos = drt.y; uint8 v10 = (uint8)(counter_local_frames & 8) >> 3; v9[64].charnum = kSprXXX_Dolphins_Tiles1[v10]; v9[65].charnum = kSprXXX_Dolphins_Tiles2[v10]; @@ -3936,7 +4329,7 @@ LABEL_49:; } void SprXXX_WallFollowers_SparkyDraw(uint8 k) { // 02be4e - uint8 drt; + GetDrawInfoRes drt; if (spr_spriteid[k] == 0xA5) { GenericGFXRtDraw1Tile16x16(k); @@ -3952,77 +4345,73 @@ void SprXXX_WallFollowers_SparkyDraw(uint8 k) { // 02be4e v4[64].flags ^= 16 * (counter_local_frames & 0xC); } } else { - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - spr_oamindex[k] = drt + 4; - uint8 v6 = drt + 4; - R3_ = counter_local_frames & 4; + spr_oamindex[k] = drt.idx + 4; + uint8 v6 = drt.idx + 4; + uint8 r3 = counter_local_frames & 4; uint8 v7 = 3; do { OamEnt *v8 = get_OamEnt(oam_buf, v6); - v8[64].xpos = kSprXXX_WallFollowers_HotheadXDisp[v7] + R0_; - v8[64].ypos = kSprXXX_WallFollowers_HotheadYDisp[v7] + R1_; + v8[64].xpos = kSprXXX_WallFollowers_HotheadXDisp[v7] + drt.x; + v8[64].ypos = kSprXXX_WallFollowers_HotheadYDisp[v7] + drt.y; uint8 v15 = v7; - uint8 v9 = R3_ | v7; + uint8 v9 = r3 | v7; v8[64].charnum = kSprXXX_WallFollowers_HotheadTiles[v9]; v8[64].flags = sprites_tile_priority | kSprXXX_WallFollowers_HotheadProp[v9]; v6 += 4; v7 = v15 - 1; } while ((int8)v7 >= 0); uint8 v10 = k; - uint8 kb = R0_; - uint8 v16 = R1_; Spr070_Pokey_Bank02SpriteEntry(v10, 2, 3); - R1_ = v16; - R0_ = kb; uint8 v11 = 9; if (spr_decrementing_table1558[v10]) v11 = 25; - R2_ = v11; + uint8 r2 = v11; uint8 v12 = spr_oamindex[v10] - 4; spr_oamindex[v10] = v12; uint8 kc = v10; uint8 v13 = spr_table00c2[v10]; OamEnt *v14 = get_OamEnt(oam_buf, v12); - v14[64].xpos = kSprXXX_WallFollowers_HotheadEyesXDisp[v13] + R0_; - v14[64].ypos = kSprXXX_WallFollowers_HotheadEyesYDisp[v13] + R1_; - v14[64].charnum = R2_; + v14[64].xpos = kSprXXX_WallFollowers_HotheadEyesXDisp[v13] + drt.x; + v14[64].ypos = kSprXXX_WallFollowers_HotheadEyesYDisp[v13] + drt.y; + v14[64].charnum = r2; v14[64].flags = sprites_tile_priority | 5; Spr070_Pokey_Bank02SpriteEntry(kc, 0, 0); } } void SprXXX_WallFollowers_UrchinDraw(uint8 k) { // 02bf5c - uint8 drt; + GetDrawInfoRes drt; if (!spr_decrementing_table163e[k]) { ++spr_table1528[k]; spr_decrementing_table163e[k] = 12; } spr_table1602[k] = kSprXXX_WallFollowers_UrchinAnimationFrames[spr_table1528[k] & 3]; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R5_ = 0; - R2_ = spr_table1602[k]; - R3_ = spr_decrementing_table1558[k]; + uint8 r5 = 0; + uint8 r2 = spr_table1602[k]; + uint8 r3 = spr_decrementing_table1558[k]; do { - uint8 v2 = R5_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSprXXX_WallFollowers_UrchinXDisp[R5_] + R0_; - oam[64].ypos = kSprXXX_WallFollowers_UrchinYDisp[v2] + R1_; + uint8 v2 = r5; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSprXXX_WallFollowers_UrchinXDisp[r5] + drt.x; + oam[64].ypos = kSprXXX_WallFollowers_UrchinYDisp[v2] + drt.y; oam[64].flags = kSprXXX_WallFollowers_UrchinProp[v2]; uint8 v4; if (v2) { - v4 = kSprXXX_WallFollowers_UrchinTiles[R2_]; + v4 = kSprXXX_WallFollowers_UrchinTiles[r2]; } else { v4 = -54; - if (R3_) + if (r3) v4 = -52; } oam[64].charnum = v4; - drt += 4; - ++R5_; - } while (R5_ != 5); + drt.idx += 4; + ++r5; + } while (r5 != 5); Spr070_Pokey_Bank02SpriteEntry(spr_current_slotid, 2, 4); } @@ -4089,11 +4478,9 @@ void Spr03D_RipVanFish(uint8 k) { // 02bfcd } SpawnMusicNoteOrZ_Z(k); if (!flag_wake_up_rip_van_fish) { - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 48) >= 0x60) + if ((uint8)(player_xpos - GetSprXPos(k) + 48) >= 0x60) break; - CheckPlayerPositionRelativeToSprite_Bank23_Y(k); - if ((uint8)(R14_ + 48) >= 0x60) + if ((uint8)(player_ypos - GetSprYPos(k) + 48) >= 0x60) break; } ++spr_table00c2[k]; @@ -4176,11 +4563,11 @@ void Spr091_CharginChuck_02C19A(uint8 k) { // 02c19a if ((j & 0x80) == 0) { spr_current_status[j] = 8; spr_spriteid[j] = 72; - R2_ = spr_table157c[k]; - R0_W = GetSprXPos(k); + uint8 r2 = spr_table157c[k]; + uint16 r0w = GetSprXPos(k); InitializeNormalSpriteRAMTables(j); - uint8 v2 = R2_; - SetSprXPos(j, PAIR16(kSpr091_CharginChuck_DigginChuckRockInitialXPosHi[v2], kSpr091_CharginChuck_DigginChuckRockInitialXPosLo[v2]) + R0_W); + uint8 v2 = r2; + SetSprXPos(j, PAIR16(kSpr091_CharginChuck_DigginChuckRockInitialXPosHi[v2], kSpr091_CharginChuck_DigginChuckRockInitialXPosLo[v2]) + r0w); spr_xspeed[j] = kSpr091_CharginChuck_DigginChuckRockInitialXSpeed[v2]; SetSprYPos(j, GetSprYPos(k) + 10); spr_yspeed[j] = -64; @@ -4267,8 +4654,7 @@ void Spr091_CharginChuck_02C22C(uint8 k) { // 02c22c void Spr091_CharginChuck_State0B_WaitToWhistle(uint8 k) { // 02c356 spr_table1602[k] = 3; if (spr_table164a[k]) { - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 48) < 0x60) + if ((uint8)(player_xpos - GetSprXPos(k) + 48) < 0x60) spr_table00c2[k] = 12; } Spr091_CharginChuck_02C556(k); @@ -4301,8 +4687,7 @@ void Spr091_CharginChuck_State0A_Pitchin(uint8 k) { // 02c3cb spr_table1534[k] = 0; } } else { - CheckPlayerPositionRelativeToSprite_Bank23_Y(k); - if ((int8)R14_ <= -49) { + if ((int8)(player_ypos - GetSprYPos(k)) <= -49) { spr_yspeed[k] = -56; spr_decrementing_table1540[k] = 62; ++spr_table1534[k]; @@ -4333,11 +4718,11 @@ void Spr091_CharginChuck_02C466(uint8 k) { // 02c466 return; } ext_spr_spriteid[j] = 13; - R0_W = GetSprXPos(k); + uint16 r0w = GetSprXPos(k); SetHiLo(&ext_spr_ypos_hi[j], &ext_spr_ypos_lo[j], GetSprYPos(k)); uint8 v2 = spr_table157c[k]; SetHiLo(&ext_spr_xpos_hi[j], &ext_spr_xpos_lo[j], - PAIR16(kSpr091_CharginChuck_BaseballInitialXPosHi[v2], kSpr091_CharginChuck_BaseballInitialXPosLo[v2]) + R0_W); + PAIR16(kSpr091_CharginChuck_BaseballInitialXPosHi[v2], kSpr091_CharginChuck_BaseballInitialXPosLo[v2]) + r0w); ext_spr_xspeed[j] = kSpr091_CharginChuck_BaseballInitialXSpeed[v2]; } } @@ -4370,8 +4755,7 @@ void Spr091_CharginChuck_State08_Clappin(uint8 k) { // 02c4e3 if (!spr_decrementing_table1540[k]) { spr_decrementing_table1540[k] = 32; spr_yspeed[k] = -16; - CheckPlayerPositionRelativeToSprite_Bank23_Y(k); - if ((int8)R14_ <= -49) { + if ((int8)(player_ypos - GetSprYPos(k)) <= -49) { spr_yspeed[k] = -64; ++spr_table160e[k]; io_sound_ch3 = 8; @@ -4455,7 +4839,7 @@ void Spr091_CharginChuck_02C5BC(uint8 k) { // 02c5bc void Spr091_CharginChuck_02C602(uint8 k) { // 02c602 spr_table157c[k] = CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 80) >= 0xA0) { + if ((uint8)(player_xpos - GetSprXPos(k) + 80) >= 0xA0) { spr_table1602[k] = 3; if ((counter_global_frames & 0x3F) == 0) spr_yspeed[k] = -32; @@ -4472,8 +4856,7 @@ void Spr091_CharginChuck_State00_LookingSideToSide(uint8 k) { // 02c63b spr_table1602[k] = 3; spr_table187b[k] = 0; if ((spr_decrementing_table1540[k] & 0xF) == 0) { - CheckPlayerPositionRelativeToSprite_Bank23_Y(k); - if ((uint8)(R14_ + 40) < 0x50) { + if ((uint8)(player_ypos - GetSprYPos(k) + 40) < 0x50) { Spr091_CharginChuck_02C556(k); ++spr_table187b[k]; LABEL_4: @@ -4499,8 +4882,7 @@ void Spr091_CharginChuck_State00_LookingSideToSide(uint8 k) { // 02c63b } void Spr091_CharginChuck_State01_Charging(uint8 k) { // 02c6a7 - CheckPlayerPositionRelativeToSprite_Bank23_Y(k); - if ((uint8)(R14_ + 48) < 0x60 && CheckPlayerPositionRelativeToSprite_Bank23_X(k) == spr_table157c[k]) { + if ((uint8)(player_ypos - GetSprYPos(k) + 48) < 0x60 && CheckPlayerPositionRelativeToSprite_Bank23_X(k) == spr_table157c[k]) { spr_decrementing_table1540[k] = 32; spr_table187b[k] = 32; } @@ -4547,7 +4929,7 @@ void Spr091_CharginChuck_State03_Hurt(uint8 k) { // 02c74a } ++spr_table1570[k]; if (++v1 != 7) { - spr_decrementing_table1540[k] = kSpr091_CharginChuck_HurtAnimationFrameCounter[v1]; + spr_decrementing_table1540[k] = kSpr091_CharginChuck_HurtAnimationFrameCounter[v1 - 1]; goto LABEL_4; } if (spr_spriteid[k] == 0x94) { @@ -4573,8 +4955,7 @@ void Spr091_CharginChuck_ProcessPlayerInteraction(uint8 k) { // 02c79d GivePoints(k, 3); return; } - CheckPlayerPositionRelativeToSprite_Bank23_Y(k); - if (sign8(R14_ + 20)) { + if (sign8(player_ypos - GetSprYPos(k) + 20)) { spr_decrementing_table1564[k] = 5; io_sound_ch1 = 2; SpawnContactEffectFromAbove(k); @@ -4598,19 +4979,20 @@ void Spr091_CharginChuck_ProcessPlayerInteraction(uint8 k) { // 02c79d } void Spr091_CharginChuck_Draw(uint8 k) { // 02c81a - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - Spr091_CharginChuck_DrawHead(k); - Spr091_CharginChuck_DrawBody(); - Spr091_CharginChuck_DrawExtraTiles(k); - Spr091_CharginChuck_DrawDigginChuckExtraTiles(k); + PointU8 pt = Spr091_CharginChuck_DrawHead(k, (PointU8) {.x = drt.x, .y = drt.y }); + Spr091_CharginChuck_DrawBody(k, pt); + Spr091_CharginChuck_DrawExtraTiles(k, pt); + Spr091_CharginChuck_DrawDigginChuckExtraTiles(k, pt); Spr070_Pokey_Bank02SpriteEntry(k, 0xFF, 4); } -void Spr091_CharginChuck_DrawHead(uint8 k) { // 02c88c - R7_ = 0; +PointU8 Spr091_CharginChuck_DrawHead(uint8 k, PointU8 pt) { // 02c88c + uint8 r7 = 0; uint8 v1 = spr_table1602[k]; - R4_ = v1; + uint8 r4 = v1; bool v2 = 0; if (v1 == 9) { uint8 v3 = spr_decrementing_table1540[k]; @@ -4618,79 +5000,89 @@ void Spr091_CharginChuck_DrawHead(uint8 k) { // 02c88c uint8 v4 = v3 - 32; v2 = !v2; if (v2) { - R7_ = v4 >> 5; + r7 = v4 >> 5; v2 = (v4 & 2) != 0; } } - R0_ += v2; - R2_ = spr_table151c[k]; - R3_ = spr_table157c[k]; - R8_ = sprites_tile_priority | spr_table15f6[k]; - R5_ = spr_oamindex[k]; - uint8 v5 = kSpr091_CharginChuck_HeadOAMIndexOffset[v1] + R5_; - uint8 v6 = kSpr091_CharginChuck_HeadXDisp[R4_]; - if (!R3_) + pt.x += v2; + uint8 r2 = spr_table151c[k]; + uint8 r3 = spr_table157c[k]; + uint8 r8 = sprites_tile_priority | spr_table15f6[k]; + uint8 r5 = spr_oamindex[k]; + uint8 v5 = kSpr091_CharginChuck_HeadOAMIndexOffset[v1] + r5; + uint8 v6 = kSpr091_CharginChuck_HeadXDisp[r4]; + if (!r3) v6 = -v6; OamEnt *oam = get_OamEnt(oam_buf, v5); - oam[64].xpos = R0_ + v6; - oam[64].ypos = kSpr091_CharginChuck_HeadYDisp[R4_] + R1_ - R7_; - int v8 = R2_; - oam[64].flags = R8_ | kSpr091_CharginChuck_HeadProp[R2_]; + oam[64].xpos = pt.x + v6; + oam[64].ypos = kSpr091_CharginChuck_HeadYDisp[r4] + pt.y - r7; + int v8 = r2; + oam[64].flags = r8 | kSpr091_CharginChuck_HeadProp[r2]; oam[64].charnum = kSpr091_CharginChuck_HeadTiles[v8]; sprites_oamtile_size_buffer[(v5 >> 2) + 64] = 2; + return pt; } -void Spr091_CharginChuck_DrawBody() { // 02ca27 - R6_ = 0; - uint8 v0 = R4_; - if (!R3_) { - v0 = R4_ + 26; - R6_ = 64; +void Spr091_CharginChuck_DrawBody(uint8 k, PointU8 pt) { // 02ca27 + uint8 r2 = spr_table151c[k]; + uint8 r3 = spr_table157c[k]; + uint8 r4 = spr_table1602[k]; + uint8 r5 = spr_oamindex[k]; + uint8 r6 = 0; + uint8 v0 = r4; + if (!r3) { + v0 = r4 + 26; + r6 = 64; } - uint8 v1 = R5_ + kSpr091_CharginChuck_BodyOAMIndexOffset[R4_]; + uint8 v1 = r5 + kSpr091_CharginChuck_BodyOAMIndexOffset[r4]; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = kSpr091_CharginChuck_BodyXDisp1[v0] + R0_; - oam[65].xpos = kSpr091_CharginChuck_BodyXDisp2[v0] + R0_; - uint8 v3 = R4_; - int v4 = R4_; - oam[64].ypos = kSpr091_CharginChuck_BodyYDisp1[R4_] + R1_; - oam[65].ypos = R1_; + oam[64].xpos = kSpr091_CharginChuck_BodyXDisp1[v0] + pt.x; + oam[65].xpos = kSpr091_CharginChuck_BodyXDisp2[v0] + pt.x; + uint8 v3 = r4; + int v4 = r4; + oam[64].ypos = kSpr091_CharginChuck_BodyYDisp1[r4] + pt.y; + oam[65].ypos = pt.y; oam[64].charnum = kSpr091_CharginChuck_BodyTiles1[v4]; oam[65].charnum = kSpr091_CharginChuck_BodyTiles2[v3]; - int8 v5 = R6_ | R8_; - oam[64].flags = kSpr091_CharginChuck_BodyProp1[v3] ^ (R6_ | R8_); + uint8 r8 = sprites_tile_priority | spr_table15f6[k]; + int8 v5 = r6 | r8; + oam[64].flags = kSpr091_CharginChuck_BodyProp1[v3] ^ (r6 | r8); oam[65].flags = kSpr091_CharginChuck_BodyProp2[v3] ^ v5; v1 >>= 2; sprites_oamtile_size_buffer[v1 + 64] = kSpr091_CharginChuck_BodyTileSize1[v3]; sprites_oamtile_size_buffer[v1 + 65] = 2; } -void Spr091_CharginChuck_DrawExtraTiles(uint8 k) { // 02ca9d - uint8 v1 = R4_; - if (R4_ >= 0x14) { - R2_ = R4_; +void Spr091_CharginChuck_DrawExtraTiles(uint8 k, PointU8 pt) { // 02ca9d + uint8 r2 = spr_table151c[k]; + uint8 r3 = spr_table157c[k]; + uint8 r4 = spr_table1602[k]; + uint8 r5 = spr_oamindex[k]; + uint8 v1 = r4; + if (r4 >= 0x14) { + r2 = r4; if (!spr_table157c[k]) - v1 = R4_ + 6; - uint8 v16 = R5_ + 8; - OamEnt *oam = get_OamEnt(oam_buf, (uint8)(R5_ + 8)); - oam[64].xpos = kSpr091_CharginChuck_BaseballXDisp[v1 - 20] + R0_; - uint8 v18 = kSpr091_CharginChuck_BaseballYDisp[R2_ - 20]; + v1 = r4 + 6; + uint8 v16 = r5 + 8; + OamEnt *oam = get_OamEnt(oam_buf, (uint8)(r5 + 8)); + oam[64].xpos = kSpr091_CharginChuck_BaseballXDisp[v1 - 20] + pt.x; + uint8 v18 = kSpr091_CharginChuck_BaseballYDisp[r2 - 20]; if (v18) { - oam[64].ypos = R1_ + v18; + oam[64].ypos = pt.y + v18; oam[64].charnum = -83; oam[64].flags = sprites_tile_priority | 9; sprites_oamtile_size_buffer[(v16 >> 2) + 64] = 0; } - } else if (R4_ == 18 || R4_ == 19) { - uint8 v10 = R5_; + } else if (r4 == 18 || r4 == 19) { + uint8 v10 = r5; uint8 v11 = spr_table157c[k]; - OamEnt *v12 = get_OamEnt(oam_buf, R5_); - v12[64].xpos = R0_ + ((8 * v11) ^ 8); - v12[65].xpos = R0_ + 8 * v11; + OamEnt *v12 = get_OamEnt(oam_buf, r5); + v12[64].xpos = pt.x + ((8 * v11) ^ 8); + v12[65].xpos = pt.x + 8 * v11; v12[64].charnum = 28; v12[65].charnum = 29; - int8 v13 = R1_ - 8; - v12[64].ypos = R1_ - 8; + int8 v13 = pt.y - 8; + v12[64].ypos = pt.y - 8; v12[65].ypos = v13; int8 v14 = sprites_tile_priority | kSpr091_CharginChuck_CharginShoulderProp[v11]; v12[64].flags = v14; @@ -4699,21 +5091,22 @@ void Spr091_CharginChuck_DrawExtraTiles(uint8 k) { // 02ca9d sprites_oamtile_size_buffer[v15 + 64] = 0; sprites_oamtile_size_buffer[v15 + 65] = 0; } else { - uint8 v2 = R4_ - 6; - if ((uint8)(R4_ - 6) < 2) { - uint8 v3 = R4_ - 6; - uint8 v4 = R5_; - OamEnt *v5 = get_OamEnt(oam_buf, R5_); - v5[64].xpos = kSpr091_CharginChuck_JumpinChuckLeftHandXDisp[v2] + R0_; - v5[65].xpos = kSpr091_CharginChuck_JumpinChuckRightHandXDisp[v2] + R0_; - int8 v6 = kSpr091_CharginChuck_JumpinChuckHandsYDisp[v2] + R1_; + uint8 v2 = r4 - 6; + if ((uint8)(r4 - 6) < 2) { + uint8 v3 = r4 - 6; + uint8 v4 = r5; + OamEnt *v5 = get_OamEnt(oam_buf, r5); + v5[64].xpos = kSpr091_CharginChuck_JumpinChuckLeftHandXDisp[v2] + pt.x; + v5[65].xpos = kSpr091_CharginChuck_JumpinChuckRightHandXDisp[v2] + pt.x; + int8 v6 = kSpr091_CharginChuck_JumpinChuckHandsYDisp[v2] + pt.y; v5[64].ypos = v6; v5[65].ypos = v6; uint8 v7 = kSpr091_CharginChuck_JumpinChuckHandTiles[v3]; v5[64].charnum = v7; v5[65].charnum = v7; - uint8 v8 = R8_; - v5[64].flags = R8_; + uint8 r8 = sprites_tile_priority | spr_table15f6[k]; + uint8 v8 = r8; + v5[64].flags = r8; v5[65].flags = v8 | 0x40; v4 >>= 2; uint8 v9 = kSpr091_CharginChuck_JumpinChuckHandTileSize[v3]; @@ -4723,7 +5116,7 @@ void Spr091_CharginChuck_DrawExtraTiles(uint8 k) { // 02ca9d } } -void Spr091_CharginChuck_DrawDigginChuckExtraTiles(uint8 k) { // 02cba1 +void Spr091_CharginChuck_DrawDigginChuckExtraTiles(uint8 k, PointU8 pt) { // 02cba1 if (spr_spriteid[k] == 70) { uint8 v1 = spr_table1602[k]; uint8 v2; @@ -4734,15 +5127,15 @@ void Spr091_CharginChuck_DrawDigginChuckExtraTiles(uint8 k) { // 02cba1 return; v2 = v1 - 14; } - R2_ = v2; + uint8 r2 = v2; uint8 v3 = spr_oamindex[k] + 12; uint8 v4 = spr_table157c[k] | (2 * v2); OamEnt *oam = get_OamEnt(oam_buf, v3); - oam[64].xpos = kSpr091_CharginChuck_DigginChuckXDisp[v4] + R0_; + oam[64].xpos = kSpr091_CharginChuck_DigginChuckXDisp[v4] + pt.x; oam[64].flags = sprites_tile_priority | kSpr091_CharginChuck_DigginChuckProp[v4 & 1]; - uint8 v6 = R2_; - int v7 = R2_; - oam[64].ypos = kSpr091_CharginChuck_DigginChuckYDisp[R2_] + R1_; + uint8 v6 = r2; + int v7 = r2; + oam[64].ypos = kSpr091_CharginChuck_DigginChuckYDisp[r2] + pt.y; oam[64].charnum = kSpr091_CharginChuck_DigginChuckTiles[v7]; sprites_oamtile_size_buffer[(v3 >> 2) + 64] = kSpr091_CharginChuck_DigginChuckTileSize[v6]; } @@ -4766,57 +5159,57 @@ void Spr088_WingedCage(uint8 k) { // 02cbfe if (flag_standing_on_beta_cage) Spr088_WingedCage_SyncPlayerPosToLayer1(); AddSprYPos(k, (int8)misc_layer1_ydisp); - R0_W = GetSprXPos(k); - R2_W = GetSprYPos(k); + uint16 r0w = GetSprXPos(k); + uint16 r2w = GetSprYPos(k); if ((int8)(player_xspeed - 1) >= 0) { - if ((uint16)(R0_W + 144) < player_xpos) { - player_xpos = R0_W + 145; + if ((uint16)(r0w + 144) < player_xpos) { + player_xpos = r0w + 145; player_xspeed = 0; } - } else if (R0_W >= player_xpos) { - player_xpos = R0_W; + } else if (r0w >= player_xpos) { + player_xpos = r0w; player_xspeed = 0; } if ((player_yspeed & 0x80) == 0) { - if ((uint16)(R2_W + 96) < player_ypos) { - player_ypos = R2_W + 97; + if ((uint16)(r2w + 96) < player_ypos) { + player_ypos = r2w + 97; player_yspeed = 0; misc_player_on_solid_sprite = 1; flag_standing_on_beta_cage = 1; } - } else if ((uint16)(R2_W + 32) >= player_ypos) { + } else if ((uint16)(r2w + 32) >= player_ypos) { player_yspeed = 0; } } } void Spr088_WingedCage_Draw(uint8 k) { // 02ccb9 - R8_ = 3; - R0_ = spr_xpos_lo[k] - mirror_current_layer1_xpos; - R1_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; - R2_ = spr_oamindex[k]; + uint8 r8 = 3; + uint8 r0 = spr_xpos_lo[k] - mirror_current_layer1_xpos; + uint8 r1 = spr_ypos_lo[k] - mirror_current_layer1_ypos; + uint8 r2 = spr_oamindex[k]; do { - int8 v3 = kSpr088_WingedCage_XDisp[R8_] + R0_; - OamEnt *oam = get_OamEnt(oam_buf, R2_); + int8 v3 = kSpr088_WingedCage_XDisp[r8] + r0; + OamEnt *oam = get_OamEnt(oam_buf, r2); oam[64].xpos = v3; oam[65].xpos = v3; - int8 v5 = kSpr088_WingedCage_YDisp[R8_] + R1_; + int8 v5 = kSpr088_WingedCage_YDisp[r8] + r1; oam[64].ypos = v5; oam[65].ypos = v5 + 8; - uint8 t = (R8_ ^ (spr_table1570[spr_current_slotid] >> 3)) & 1; + uint8 t = (r8 ^ (spr_table1570[spr_current_slotid] >> 3)) & 1; oam[64].charnum = t ? 0x81 : 0xc6; oam[65].charnum = t ? 0xd7 : 0xd6; oam[64].flags = 112; oam[65].flags = 112; - uint8 v8 = R2_ >> 2; + uint8 v8 = r2 >> 2; sprites_oamtile_size_buffer[v8 + 64] = 0; sprites_oamtile_size_buffer[v8 + 65] = 0; - R2_ += 8; - } while ((--R8_ & 0x80) == 0); + r2 += 8; + } while ((--r8 & 0x80) == 0); } void Spr060_FlatPalaceSwitch_Sub(uint8 k) { // 02cd59 - uint8 drt; + GetDrawInfoRes drt; if (spr_decrementing_table1540[k] == 94) { blocks_map16_to_generate = 27; @@ -4825,19 +5218,19 @@ void Spr060_FlatPalaceSwitch_Sub(uint8 k) { // 02cd59 GenerateTile(); } SolidSpriteBlock(k); - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = kSpr060_FlatPalaceSwitch_Palette[sprites_color_of_flat_palace_switch_to_spawn]; + uint8 r2 = kSpr060_FlatPalaceSwitch_Palette[sprites_color_of_flat_palace_switch_to_spawn]; for (uint8 i = 7; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr060_FlatPalaceSwitch_XDisp[i] + R0_; - oam[64].ypos = kSpr060_FlatPalaceSwitch_YDisp[i] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr060_FlatPalaceSwitch_XDisp[i] + drt.x; + oam[64].ypos = kSpr060_FlatPalaceSwitch_YDisp[i] + drt.y; oam[64].charnum = kSpr060_FlatPalaceSwitch_Tile[i]; uint8 v5 = kSpr060_FlatPalaceSwitch_Prop[i]; if (i < 4) - v5 |= R2_; + v5 |= r2; oam[64].flags = v5; - drt += 4; + drt.idx += 4; } Spr070_Pokey_Bank02SpriteEntry(k, 0, 7); } @@ -4887,12 +5280,12 @@ void SprXXX_WallSpringboard_State02_Rebound(uint8 k) { // 02ce3a spr_table00c2[k] = 0; spr_table1528[k] = 0; } else { - R0_ = -spr_table151c[k]; + uint8 r0 = -spr_table151c[k]; if ((spr_table157c[k] & 1) != 0) { uint8 v5 = spr_table00c2[k] - 4; spr_table00c2[k] = v5; - if ((v5 & 0x80) != 0 && v5 < R0_) { - spr_table00c2[k] = R0_; + if ((v5 & 0x80) != 0 && v5 < r0) { + spr_table00c2[k] = r0; ++spr_table157c[k]; } } else { @@ -4909,55 +5302,55 @@ void SprXXX_WallSpringboard_State02_Rebound(uint8 k) { // 02ce3a } void SprXXX_WallSpringboard_Draw(uint8 k) { // 02cee0 - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = 4; - R5_ = spr_spriteid[k] - 107; + uint8 r2 = 4; + uint8 r5 = spr_spriteid[k] - 107; int8 v1 = spr_table00c2[k]; - R3_ = v1; + uint8 r3 = v1; if (v1 < 0) v1 = -v1; - R4_ = v1; + uint8 r4 = v1; uint8 v2 = spr_oamindex[k]; do { - uint8 v3 = R2_ + R4_ * 5; + uint8 v3 = r2 + r4 * 5; uint8 v4 = kSprXXX_WallSpringboard_XDisp[v3]; - if (R5_ & 1) + if (r5 & 1) v4 = -v4; - R8_ = v4; +// r8 = v4; OamEnt *oam = get_OamEnt(oam_buf, v2); - oam[64].xpos = R0_ + v4; + oam[64].xpos = drt.x + v4; uint8 v6 = kSprXXX_WallSpringboard_YDisp[v3]; - if (__CFSHL__(R3_, 1)) + if (__CFSHL__(r3, 1)) v6 = -v6; - R9_ = v6; - oam[64].ypos = R1_ + v6; +// r9 = v6; + oam[64].ypos = drt.y + v6; oam[64].charnum = 61; oam[64].flags = sprites_tile_priority | 0xA; - SprXXX_WallSpringboard_HandlePlayerCollision(k, v2); + SprXXX_WallSpringboard_HandlePlayerCollision(k, v2, r2); v2 += 4; - --R2_; - } while ((R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); Spr070_Pokey_Bank02SpriteEntry(k, 0, 4); } -void SprXXX_WallSpringboard_HandlePlayerCollision(uint8 k, uint8 j) { // 02cf52 +void SprXXX_WallSpringboard_HandlePlayerCollision(uint8 k, uint8 j, uint8 r2) { // 02cf52 if (!player_current_state && !(spr_yoffscreen_flag[k] | (uint8)(spr_xoffscreen_flag[k] | HIBYTE(player_on_screen_pos_x) | HIBYTE(player_on_screen_pos_y)))) { - R10_ = player_on_screen_pos_x + 2; - R11_ = player_on_screen_pos_y + (player_riding_yoshi_flag ? 32 : 16); + uint8 r10 = player_on_screen_pos_x + 2; + uint8 r11 = player_on_screen_pos_y + (player_riding_yoshi_flag ? 32 : 16); OamEnt *oam = get_OamEnt(oam_buf, j); - if ((uint8)(oam[64].xpos - R10_ + 8) < 0x14) { - R15_ = player_current_power_up ? 26 : 28; - if ((uint8)(oam[64].ypos - R11_ + 8) < R15_ && (player_yspeed & 0x80) == 0) { - R15_ = player_riding_yoshi_flag ? 47 : 31; - player_ypos = oam[64].ypos - R15_ + mirror_current_layer1_ypos; + if ((uint8)(oam[64].xpos - r10 + 8) < 0x14) { + uint8 r15 = player_current_power_up ? 26 : 28; + if ((uint8)(oam[64].ypos - r11 + 8) < r15 && (player_yspeed & 0x80) == 0) { + r15 = player_riding_yoshi_flag ? 47 : 31; + player_ypos = oam[64].ypos - r15 + mirror_current_layer1_ypos; player_in_air_flag = 0; misc_player_on_solid_sprite = 2; uint8 v7 = spr_table1528[k]; if (!v7 || v7 == 2) { player_xspeed = 0; - spr_table151c[k] = kSprXXX_WallSpringboard_MaxAngle[R2_]; + spr_table151c[k] = kSprXXX_WallSpringboard_MaxAngle[r2]; spr_table1528[k] = 1; spr_table1570[k] = 0; } else if (spr_decrementing_table1540[k] == 1) { @@ -4970,32 +5363,28 @@ void SprXXX_WallSpringboard_HandlePlayerCollision(uint8 k, uint8 j) { // 02cf52 } void SubOffscreen_Bank02_Entry4(uint8 k) { // 02d017 - R3_ = 6; - SubOffscreen_Bank02_02D027(k); + SubOffscreen_Bank02_02D027(k, 6); } void SubOffscreen_Bank02_Entry3(uint8 k) { // 02d01b - R3_ = 4; - SubOffscreen_Bank02_02D027(k); + SubOffscreen_Bank02_02D027(k, 4); } void SubOffscreen_Bank02_Entry2(uint8 k) { // 02d01f - R3_ = 2; - SubOffscreen_Bank02_02D027(k); + SubOffscreen_Bank02_02D027(k, 2); } void SubOffscreen_Bank02_Entry1(uint8 k) { // 02d025 - R3_ = 0; - SubOffscreen_Bank02_02D027(k); + SubOffscreen_Bank02_02D027(k, 0); } -void SubOffscreen_Bank02_02D027(uint8 k) { // 02d027 +void SubOffscreen_Bank02_02D027(uint8 k, uint8 r3) { // 02d027 if (CheckIfNormalSpriteOffScreen(k)) { if ((misc_level_layout_flags & 1) != 0) { sub_2D091(k); return; } - if (R3_ != 4) { + if (r3 != 4) { uint16 ypos = GetSprYPos(k) + 0x50; if (!sign8((ypos >> 8) - 2)) { LABEL_10: @@ -5005,11 +5394,11 @@ void SubOffscreen_Bank02_02D027(uint8 k) { // 02d027 if ((spr_property_bits167a[k] & 4) != 0) return; } - R1_ = R3_ | counter_global_frames & 1; - uint16 xpos = PAIR16(kSubOffscreen_Bank02_DATA_02D00F[R1_], kSubOffscreen_Bank02_DATA_02D007[R1_]) + + uint8 r1 = r3 | counter_global_frames & 1; + uint16 xpos = PAIR16(kSubOffscreen_Bank02_DATA_02D00F[r1], kSubOffscreen_Bank02_DATA_02D007[r1]) + mirror_current_layer1_xpos - GetSprXPos(k); uint8 v3 = (xpos >> 8); - if (R1_ & 1) + if (r1 & 1) v3 ^= 0x80; if ((v3 & 0x80) != 0) goto LABEL_10; @@ -5028,7 +5417,7 @@ void SubOffscreen_Bank02_EraseSprite(uint8 k) { // 02d07a void sub_2D091(uint8 k) { // 02d091 if ((spr_property_bits167a[k] & 4) == 0 && !(counter_global_frames & 1)) { bool v1 = (counter_global_frames & 2) != 0; - R1_ = v1; +// uint8 r1 = v1; uint16 ypos = mirror_current_layer1_ypos + PAIR16(kSubOffscreen_Bank02_DATA_02D005[v1], kSubOffscreen_Bank02[v1]) - GetSprYPos(k); uint8 r0 = ypos >> 8; if ((counter_global_frames & 2) != 0) @@ -5044,31 +5433,29 @@ void Spr035_Yoshi_CheckBerryTileCollisionWithAdultYoshiMouth(uint8 k) { // 02d0 } void Spr035_Yoshi_02D0E6(uint8 k) { // 02d0e6 - R15_ = 0; + uint8 r15 = 0; uint16 t = GetSprYPos(k) + 8; LOBYTE(yoshi_ypos) = t; - R0_ = t & 0xF0; + uint8 r0 = t & 0xF0; if (t < 0x200) { - R2_ = t >> 8; + uint8 r2 = t >> 8; HIBYTE(yoshi_ypos) = t >> 8; uint8 v2 = spr_table157c[k]; uint16 xpos = GetSprXPos(k) + PAIR16(kSpr035_Yoshi_DATA_02D0D2[v2], kSpr035_Yoshi_DATA_02D0D0[v2]); - R1_ = xpos; + uint8 r1 = xpos; LOBYTE(yoshi_xpos) = xpos; if ((xpos >> 8) < misc_screens_in_lvl) { HIBYTE(yoshi_xpos) = (xpos >> 8); - R3_ = (xpos >> 8); - R0_ |= R1_ >> 4; + uint8 r3 = (xpos >> 8); + r0 |= r1 >> 4; uint8 v6 = (xpos >> 8); - uint16 v8 = PAIR16(kLevelDataLayoutTables_EightBitHi[v6], kLevelDataLayoutTables_EightBitLo[v6]); - if (R15_) - v8 = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal_L2[v6], kLevelDataLayoutTables_EightBitLo_Horizontal_L2[v6]); - *(uint16 *)&R5_ = PAIR16(R2_, R0_) + v8; - R7_ = 126; + uint16 v8 = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[v6], kLevelDataLayoutTables_EightBitLo_Horizontal[v6]); + if (r15) + v8 = PAIR16(kLevelDataLayoutTables_EightBitHi_Horizontal[v6 + 16], kLevelDataLayoutTables_EightBitLo_Horizontal[v6 + 16]); + uint16 r5 = PAIR16(r2, r0) + v8; uint8 v9 = spr_current_slotid; - blocks_currently_processed_map16_tile_lo = *IndirPtr(&R5_, 0); - ++R7_; - if (!*IndirPtr(&R5_, 0) && blocks_currently_processed_map16_tile_lo >= 0x45 && blocks_currently_processed_map16_tile_lo < 0x48) { + blocks_currently_processed_map16_tile_lo = g_ram[r5]; + if (!g_ram[0x10000 + r5] && blocks_currently_processed_map16_tile_lo >= 0x45 && blocks_currently_processed_map16_tile_lo < 0x48) { yoshi_berry_being_eaten = blocks_currently_processed_map16_tile_lo - 68; timer_yoshi_tongue_is_out = 0; spr_table1602[v9] = kSpr035_Yoshi_DATA_02D1F1[yoshi_ducking_flag]; @@ -5131,7 +5518,6 @@ LABEL_14:; v4 = 8; } } - R0_ = v4; int8 v5 = spr_yspeed[k] - v4; if (v5) spr_yspeed[k] += (v5 < 0) ? 1 : -1; @@ -5152,55 +5538,56 @@ uint8 UpdateNormalSpritePosition_Y(uint8 k) { // 02d294 return disp; } -void AimTowardsPlayer_Bank23(uint8 k, uint8 a) { // 02d2fb - R1_ = a; - R2_ = CheckPlayerPositionRelativeToSprite_Bank23_Y(k); - uint8 v2 = R14_; - if ((R14_ & 0x80) != 0) - v2 = -R14_; - R12_ = v2; - R3_ = CheckPlayerPositionRelativeToSprite_Bank23_X(k); - uint8 v3 = R15_; - if ((R15_ & 0x80) != 0) - v3 = -R15_; - R13_ = v3; +PointU8 AimTowardsPlayer_Bank23(uint8 k, uint8 a) { // 02d2fb + uint8 r1 = a; + uint8 r2 = CheckPlayerPositionRelativeToSprite_Bank23_Y(k); + uint8 v2 = player_ypos - GetSprYPos(k); + if ((v2 & 0x80) != 0) + v2 = -v2; + uint8 r12 = v2; + uint8 r3 = CheckPlayerPositionRelativeToSprite_Bank23_X(k); + uint8 v3 = player_xpos - GetSprXPos(k); + if ((v3 & 0x80) != 0) + v3 = -v3; + uint8 r13 = v3; int8 v4 = 0; - uint8 v5 = R13_; - if (R13_ < R12_) { + uint8 v5 = r13; + if (r13 < r12) { v4 = 1; - R13_ = R12_; - R12_ = v5; + r13 = r12; + r12 = v5; } - R11_ = 0; - R0_ = 0; - uint8 v6 = R1_; + uint8 r11 = 0; + uint8 r0 = 0; + uint8 v6 = r1; do { - uint8 v7 = R12_ + R11_; - if ((uint8)(R12_ + R11_) >= R13_) { - v7 -= ((uint8)(R12_ + R11_) < R13_) + R13_; - ++R0_; + uint8 v7 = r12 + r11; + if ((uint8)(r12 + r11) >= r13) { + v7 -= ((uint8)(r12 + r11) < r13) + r13; + ++r0; } - R11_ = v7; + r11 = v7; --v6; } while (v6); if (v4) { - uint8 v8 = R0_; - R0_ = R1_; - R1_ = v8; + uint8 v8 = r0; + r0 = r1; + r1 = v8; } - if (R2_) - R0_ = -R0_; - if (R3_) - R1_ = -R1_; + if (r2) + r0 = -r0; + if (r3) + r1 = -r1; + return (PointU8) {.x = r1, .y = r0 }; } -uint8 GetDrawInfo_Bank23_ReturnsTwice(uint8 k) { // 02d378 +GetDrawInfoRes GetDrawInfo_Bank23_ReturnsTwice(uint8 k) { // 02d378 spr_yoffscreen_flag[k] = 0; spr_xoffscreen_flag[k] = (uint16)(GetSprXPos(k) - mirror_current_layer1_xpos) >= 256; bool carry = (uint16)(GetSprXPos(k) - mirror_current_layer1_xpos + 0x40) >= 0x180; spr_table15c4[k] = carry; if (carry) { - return 0xff; + return (GetDrawInfoRes) { .idx = 0xff, .x = 0, .y = 0 }; } else { uint8 v3 = (spr_property_bits1662[k] & 0x20) != 0; do { @@ -5208,9 +5595,9 @@ uint8 GetDrawInfo_Bank23_ReturnsTwice(uint8 k) { // 02d378 if ((ypos >> 8) != 0) spr_yoffscreen_flag[k] |= kGetDrawInfo_DATA_02D376[v3]; } while ((--v3 & 0x80) == 0); - R0_ = spr_xpos_lo[k] - mirror_current_layer1_xpos; - R1_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; - return spr_oamindex[k]; + uint8 r0 = spr_xpos_lo[k] - mirror_current_layer1_xpos; + uint8 r1 = spr_ypos_lo[k] - mirror_current_layer1_ypos; + return (GetDrawInfoRes) { .idx = spr_oamindex[k], .x = r0, .y = r1 }; } } @@ -5272,8 +5659,8 @@ void Spr089_Layer3Smasher(uint8 k) { // 02d3ea void Spr089_Layer3Smasher_02D49C(uint8 k) { // 02d49c uint8 v1 = (player_current_power_up && !player_ducking_flag) ? 16 : 0; if ((uint8)(spr_ypos_lo[k] + v1) >= (uint8)player_on_screen_pos_y) { - R0_W = GetSprXPos(k); - uint16 t = R0_W + player_on_screen_pos_x - 48; + uint16 r0w = GetSprXPos(k); + uint16 t = r0w + player_on_screen_pos_x - 48; if (t < 0x90) { if ((uint16)(t - 8) >= 0x80) { player_xspeed = sign16(t - 8 - 0x80) ? -8 : 8; @@ -5288,13 +5675,13 @@ void Spr089_Layer3Smasher_02D49C(uint8 k) { // 02d49c uint8 CheckPlayerPositionRelativeToSprite_Bank23_X(uint8 k) { // 02d4fa int t = player_xpos - GetSprXPos(k); - R15_ = t; +// r15 = t; return sign16(t) != 0; } uint8 CheckPlayerPositionRelativeToSprite_Bank23_Y(uint8 k) { // 02d50c int t = player_ypos - GetSprYPos(k); - R14_ = t; +// r14 = t; return sign16(t) != 0; } @@ -5309,17 +5696,17 @@ void Spr09F_BanzaiBill_Sub(uint8 k) { // 02d587 } void Spr09F_BanzaiBill_Draw(uint8 k) { // 02d5e4 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 15; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr09F_BanzaiBill_XDisp[i] + R0_; - oam[64].ypos = kSpr09F_BanzaiBill_YDisp[i] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr09F_BanzaiBill_XDisp[i] + drt.x; + oam[64].ypos = kSpr09F_BanzaiBill_YDisp[i] + drt.y; oam[64].charnum = kSpr09F_BanzaiBill_Tiles[i]; oam[64].flags = kSpr09F_BanzaiBill_Prop[i]; - drt += 4; + drt.idx += 4; } Spr070_Pokey_Bank02SpriteEntry(k, 2, 0xF); } @@ -5339,45 +5726,40 @@ void Spr09E_BallNChain_Sub(uint8 k) { // 02d62a int8 v1 = ((spr_xpos_lo[k] & 0x10) == 0) ? -2 : 2; SetHiLo(&spr_table151c[k], &spr_table1602[k], PAIR16(spr_table151c[k], spr_table1602[k]) + (int8)v1 & 0x1ff); } - R1_ = spr_table151c[k]; - R0_ = spr_table1602[k]; - R2_W = (R0_W + 128) & 0x1FF; - R4_W = kCircleCoordinates[(uint16)(2 * (uint8)R0_W) >> 1]; - R6_W = kCircleCoordinates[(uint16)(2 * (uint8)(R0_W + 0x80)) >> 1]; + uint16 r0w = spr_table151c[k] << 8 | spr_table1602[k]; + uint16 r2w = (r0w + 128) & 0x1FF; + uint16 r4w = kCircleCoordinates[(uint16)(2 * (uint8)r0w) >> 1]; + uint16 r6 = kCircleCoordinates[(uint16)(2 * (uint8)(r0w + 0x80)) >> 1]; uint8 v5 = spr_current_slotid; - WriteReg(WRMPYA, R4_); uint8 v6 = spr_table187b[v5]; - if (!R5_) { - WriteReg(WRMPYB, v6); - uint8 t = ReadReg(RDMPYL); - v6 = ReadReg(RDMPYH) + (t >> 7); + if (r4w < 256) { + uint16 mult = Mult8x8(r4w, v6); + uint8 t = mult; + v6 = (mult >> 8) + (t >> 7); } - v4 = R1_ & 1; - R1_ >>= 1; + v4 = (r0w >> 8) & 1; if (v4) v6 = -v6; - R4_ = v6; - WriteReg(WRMPYA, R6_); + r4w = v6; uint8 v8 = spr_table187b[v5]; - if (!R7_) { - WriteReg(WRMPYB, v8); - uint8 t = ReadReg(RDMPYL); - v8 = ReadReg(RDMPYH) + (t >> 7); + if (!(r6 >> 8)) { + uint16 mult = Mult8x8(r6, v8); + uint8 t = mult; + v8 = (mult >> 8) + (t >> 7); } - v4 = R3_ & 1; - R3_ >>= 1; + v4 = (r2w >> 8) & 1; if (v4) v8 = -v8; - R6_ = v8; uint16 old_x = GetSprXPos(v5); uint16 old_y = GetSprYPos(v5); - AddSprXPos(v5, (int8)R4_); + AddSprXPos(v5, (int8)r4w); spr_table1528[v5] = spr_xpos_lo[v5] - spr_table1534[v5]; spr_table1534[v5] = spr_xpos_lo[v5]; - AddSprYPos(v5, (int8)R6_); + AddSprYPos(v5, (int8)v8); + PointU8 pt; if (spr_spriteid[v5] == 0x9E) { CheckPlayerToNormalSpriteCollision(v5); - Spr0A3_GreyChainedPlatform_02D813(v5); + pt = Spr0A3_GreyChainedPlatform_02D813(v5); } else { if (SolidSpriteBlock(v5) & 1) { spr_table160e[v5] = 3; @@ -5390,67 +5772,69 @@ void Spr09E_BallNChain_Sub(uint8 k) { // 02d62a spr_table160e[v5] = 0; PlayerDraw(); } - Spr0A3_GreyChainedPlatform_02D848(v5); + pt = Spr0A3_GreyChainedPlatform_02D848(v5); } SetSprXPos(v5, old_x); SetSprYPos(v5, old_y); - R0_ = spr_xpos_lo[v5] + Spr0A3_GreyChainedPlatform_02D870(v5, mirror_current_layer1_xpos + R0_ - spr_xpos_lo[v5]) - - mirror_current_layer1_xpos; - R1_ = spr_ypos_lo[v5] + Spr0A3_GreyChainedPlatform_02D870(v5, mirror_current_layer1_ypos + R1_ - spr_ypos_lo[v5]) - - mirror_current_layer1_ypos; + uint8 r0 = spr_xpos_lo[v5] + Spr0A3_GreyChainedPlatform_02D870(v5, mirror_current_layer1_xpos + pt.x - spr_xpos_lo[v5]) - mirror_current_layer1_xpos; + uint8 r1 = spr_ypos_lo[v5] + Spr0A3_GreyChainedPlatform_02D870(v5, mirror_current_layer1_ypos + pt.y - spr_ypos_lo[v5]) - mirror_current_layer1_ypos; if (!spr_table15c4[v5]) { uint8 v11 = spr_oamindex[v5] + 16; uint8 v21 = v5; - R10_ = spr_xpos_lo[v5]; - R11_ = spr_ypos_lo[v5]; - R8_ = (spr_spriteid[v5] != 0x9E) ? -94 : -24; + uint8 r10 = spr_xpos_lo[v5]; + uint8 r11 = spr_ypos_lo[v5]; + uint8 r8 = (spr_spriteid[v5] != 0x9E) ? -94 : -24; for (int8 i = 1; i >= 0; --i) { OamEnt *oam = get_OamEnt(oam_buf, v11); - oam[64].xpos = R0_; - oam[64].ypos = R1_; - oam[64].charnum = R8_; + oam[64].xpos = r0; + oam[64].ypos = r1; + oam[64].charnum = r8; oam[64].flags = 51; - R0_ = mirror_current_layer1_xpos + R0_ - R10_; - int8 v15 = __CFSHL__(R0_, 1) ? 0x80 : 0; - R0_ = (R0_ >> 1) + v15; - R0_ = R10_ + R0_ - mirror_current_layer1_xpos; - R1_ = mirror_current_layer1_ypos + R1_ - R11_; - int8 v16 = (__CFSHL__(R1_, 1)) ? 0x80 : 0; - R1_ = R11_ + (R1_ >> 1) + v16 - mirror_current_layer1_ypos; + r0 = mirror_current_layer1_xpos + r0 - r10; + int8 v15 = __CFSHL__(r0, 1) ? 0x80 : 0; + r0 = (r0 >> 1) + v15; + r0 = r10 + r0 - mirror_current_layer1_xpos; + r1 = mirror_current_layer1_ypos + r1 - r11; + int8 v16 = (__CFSHL__(r1, 1)) ? 0x80 : 0; + r1 = r11 + (r1 >> 1) + v16 - mirror_current_layer1_ypos; v11 += 4; } Spr070_Pokey_Bank02SpriteEntry(v21, 2, 5); } } -void Spr0A3_GreyChainedPlatform_02D813(uint8 k) { // 02d813 - uint8 drt; +static const uint8 kSpr0A3_GreyChainedPlatform_DoNothing6Times[4] = { 0xea, 0xea, 0xea, 0xea }; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) - return; +PointU8 Spr0A3_GreyChainedPlatform_02D813(uint8 k) { // 02d813 + GetDrawInfoRes drt; + + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) + return (PointU8) { .x = drt.x, .y = drt.y }; for (uint8 i = 3; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0A3_GreyChainedPlatform_DATA_02D807[i] + R0_; - oam[64].ypos = kSpr0A3_GreyChainedPlatform_DATA_02D80B[i] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0A3_GreyChainedPlatform_DATA_02D807[i] + drt.x; + oam[64].ypos = kSpr0A3_GreyChainedPlatform_DATA_02D80B[i] + drt.y; oam[64].charnum = kSpr0A3_GreyChainedPlatform_DoNothing6Times[i]; oam[64].flags = kSpr0A3_GreyChainedPlatform_DATA_02D80F[i]; - drt += 4; + drt.idx += 4; } + return (PointU8) { .x = drt.x, .y = drt.y }; } -void Spr0A3_GreyChainedPlatform_02D848(uint8 k) { // 02d848 - uint8 drt; +PointU8 Spr0A3_GreyChainedPlatform_02D848(uint8 k) { // 02d848 + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) - return; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) + return (PointU8) {.x = drt.x, .y = drt.y}; for (uint8 i = 3; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0A3_GreyChainedPlatform_DATA_02D840[i] + R0_; - oam[64].ypos = R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0A3_GreyChainedPlatform_DATA_02D840[i] + drt.x; + oam[64].ypos = drt.y; oam[64].charnum = kSpr0A3_GreyChainedPlatform_WoodPlatformTiles[i]; oam[64].flags = 51; - drt += 4; + drt.idx += 4; } + return (PointU8) { .x = drt.x, .y = drt.y }; } uint8 Spr0A3_GreyChainedPlatform_02D870(uint8 k, uint8 a) { // 02d870 @@ -5458,22 +5842,21 @@ uint8 Spr0A3_GreyChainedPlatform_02D870(uint8 k, uint8 a) { // 02d870 if ((a & 0x80) != 0) a = -a; - WriteReg(WRDIVH, a); - WriteReg(WRDIVL, 0); - WriteReg(WRDIVB, spr_table187b[k] >> 1); - R14_ = ReadReg(RDDIVL); - uint8 Reg = ReadReg(RDDIVH); - bool v3 = __CFSHL__(R14_, 1); - R14_ *= 2; + uint16 dres = SnesDivide(a << 8, spr_table187b[k] >> 1); + + uint8 r14 = dres & 0xff; + uint8 Reg = dres >> 8; + bool v3 = __CFSHL__(r14, 1); + r14 *= 2; int8 v4 = 2 * Reg + v3; - v3 = __CFSHL__(R14_, 1); - R14_ *= 2; + v3 = __CFSHL__(r14, 1); + r14 *= 2; int8 v5 = 2 * v4 + v3; - v3 = __CFSHL__(R14_, 1); - R14_ *= 2; + v3 = __CFSHL__(r14, 1); + r14 *= 2; int8 v6 = 2 * v5 + v3; - v3 = __CFSHL__(R14_, 1); - R14_ *= 2; + v3 = __CFSHL__(r14, 1); + r14 *= 2; uint8 result = 2 * v6 + v3; return ((org_a & 0x80) != 0) ? -result : result; } @@ -5541,25 +5924,26 @@ void Spr09D_BubbleWithSprite(uint8 k) { // 02d8bb } void Spr09D_BubbleWithSprite_Draw(uint8 k) { // 02d9d6 - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = kSpr09D_BubbleWithSprite_DATA_02D9D2[(counter_local_frames >> 3) & 3]; + uint8 r2 = kSpr09D_BubbleWithSprite_DATA_02D9D2[(counter_local_frames >> 3) & 3]; uint8 v1 = spr_oamindex[k] - 20; spr_oamindex[k] = v1; uint8 v2 = v1; - R3_ = spr_table1534[k]; + uint8 r3 = spr_table1534[k]; int8 v3 = 4; do { uint8 v7 = v3; - uint8 v4 = R2_ + v3; + uint8 v4 = r2 + v3; OamEnt *oam = get_OamEnt(oam_buf, v2); - oam[64].xpos = kSpr09D_BubbleWithSprite_XDisp[v4] + R0_; - oam[64].ypos = kSpr09D_BubbleWithSprite_YDisp[v4] + R1_; + oam[64].xpos = kSpr09D_BubbleWithSprite_XDisp[v4] + drt.x; + oam[64].ypos = kSpr09D_BubbleWithSprite_YDisp[v4] + drt.y; oam[64].charnum = kSpr09D_BubbleWithSprite_Tiles[v7]; oam[64].flags = sprites_tile_priority | kSpr09D_BubbleWithSprite_Prop[v7]; - if (R3_ < 6) { + if (r3 < 6) { oam[64].flags = sprites_tile_priority | 2; - oam[64].charnum = R3_ < 3 ? 0x66 : 0x64; + oam[64].charnum = r3 < 3 ? 0x66 : 0x64; } sprites_oamtile_size_buffer[(v2 >> 2) + 64] = kSpr09D_BubbleWithSprite_TileSize[v7]; v2 += 4; @@ -5589,7 +5973,7 @@ void Spr09B_HammerBro(uint8 k) { // 02da5a if (!(spr_decrementing_table1540[k] | (uint8)(spr_yoffscreen_flag[k] | spr_xoffscreen_flag[k] | kSpr09B_HammerBro_HammerFreq[v1] & spr_table1570[k]))) { spr_decrementing_table1540[k] = 3; - R0_ = spr_table157c[k] ? 16 : -16; + uint8 r0 = spr_table157c[k] ? 16 : -16; uint8 j = 7; while (ext_spr_spriteid[j]) { if ((--j & 0x80) != 0) @@ -5599,30 +5983,30 @@ void Spr09B_HammerBro(uint8 k) { // 02da5a SetHiLo(&ext_spr_xpos_hi[j], &ext_spr_xpos_lo[j], GetSprXPos(k)); SetHiLo(&ext_spr_ypos_hi[j], &ext_spr_ypos_lo[j], GetSprYPos(k)); ext_spr_yspeed[j] = -48; - ext_spr_xspeed[j] = R0_; + ext_spr_xspeed[j] = r0; } } } void Spr09B_HammerBro_Draw(uint8 k) { // 02dafd - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_table157c[k]; + uint8 r2 = spr_table157c[k]; uint8 v2 = 3; do { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr09B_HammerBro_XDisp[v2] + R0_; - oam[64].ypos = kSpr09B_HammerBro_YDisp[v2] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr09B_HammerBro_XDisp[v2] + drt.x; + oam[64].ypos = kSpr09B_HammerBro_YDisp[v2] + drt.y; uint8 v5 = v2; - uint8 v4 = R2_; - oam[64].flags = R2_ | 0x37; + uint8 v4 = r2; + oam[64].flags = r2 | 0x37; if (v4) v2 += 4; oam[64].charnum = kSpr09B_HammerBro_Tiles[v2]; - sprites_oamtile_size_buffer[(drt >> 2) + 64] = kSpr09B_HammerBro_TileSize[v5]; - drt += 4; + sprites_oamtile_size_buffer[(drt.idx >> 2) + 64] = kSpr09B_HammerBro_TileSize[v5]; + drt.idx += 4; v2 = v5 - 1; } while ((int8)v2 >= 0); Spr070_Pokey_Bank02SpriteEntry(k, 0xFF, 3); @@ -5659,8 +6043,7 @@ void Spr09C_HammerBroPlatform(uint8 k) { // 02db5c SolidSpriteBlock(k); if (spr_decrementing_table1558[k]) { spr_table00c2[k] = 1; - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if (!sign8(R15_ - 8)) + if (!sign8(player_xpos - GetSprXPos(k) - 8)) ++spr_table00c2[k]; uint8 v7 = spr_table1594[k]; if ((v7 & 0x80) == 0) { @@ -5673,27 +6056,30 @@ void Spr09C_HammerBroPlatform(uint8 k) { // 02db5c } void Spr09C_HammerBroPlatform_Draw(uint8 k) { // 02dc3f - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + uint8 r6, r7; + GetDrawInfoRes drt; + + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R7_ = spr_table00c2[k]; - R5_ = kSpr09C_HammerBroPlatform_BounceYDisp[spr_decrementing_table1558[k] >> 1]; + r7 = spr_table00c2[k]; + uint8 r5 = kSpr09C_HammerBroPlatform_BounceYDisp[spr_decrementing_table1558[k] >> 1]; uint8 v1 = spr_oamindex[k]; - R2_ = (counter_local_frames >> 1) & 4; + uint8 r2 = (counter_local_frames >> 1) & 4; uint8 v2 = 3; do { - R6_ = v2; - uint8 v3 = R2_ | v2; + r6 = v2; + uint8 v3 = r2 | v2; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = kSpr09C_HammerBroPlatform_XDisp[v3] + R0_; - oam[64].ypos = kSpr09C_HammerBroPlatform_YDisp[v3] + R1_; - if (R6_ < 2 && R6_ + 1 == R7_) - oam[64].ypos -= R5_; + oam[64].xpos = kSpr09C_HammerBroPlatform_XDisp[v3] + drt.x; + oam[64].ypos = kSpr09C_HammerBroPlatform_YDisp[v3] + drt.y; + if (r6 < 2 && r6 + 1 == r7) + oam[64].ypos -= r5; oam[64].charnum = kSpr09C_HammerBroPlatform_Tiles[v3]; oam[64].flags = kSpr09C_HammerBroPlatform_Prop[v3]; sprites_oamtile_size_buffer[(v1 >> 2) + 64] = kSpr09C_HammerBroPlatform_TileSize[v3]; v1 += 4; - v2 = R6_ - 1; - } while ((int8)(R6_ - 1) >= 0); + v2 = r6 - 1; + } while ((int8)(r6 - 1) >= 0); Spr070_Pokey_Bank02SpriteEntry(k, 0xFF, 3); } @@ -5784,7 +6170,7 @@ void Spr09A_SumoBro_GenSumoLightning(uint8 k) { // 02dd8f if ((j & 0x80) == 0) { spr_spriteid[j] = 43; spr_current_status[j] = 8; - SetSprXPos(j, GetSprXPos(k) + 4); + SetSprXPos(j, GetSprXPos(k) + 5); SetSprYPos(j, GetSprYPos(k)); InitializeNormalSpriteRAMTables(j); spr_decrementing_table1fe2[j] = 16; @@ -5792,7 +6178,8 @@ void Spr09A_SumoBro_GenSumoLightning(uint8 k) { // 02dd8f } void Spr09A_SumoBro_Draw(uint8 k) { // 02de3e - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; uint8 v1 = spr_table157c[k]; int8 v2 = v1 & 1; @@ -5805,32 +6192,32 @@ void Spr09A_SumoBro_Draw(uint8 k) { // 02de3e int8 v6 = 0; if (v2) v6 = 0x80; - R2_ = ((v5 >> 1) + v6) & 0x40 ^ 0x40; + uint8 r2 = ((v5 >> 1) + v6) & 0x40 ^ 0x40; uint8 v7 = spr_oamindex[k]; uint8 v8 = 4 * spr_table1602[k]; - R5_ = 3; + uint8 r5 = 3; do { uint8 v11 = v8; - if (R2_) + if (r2) v8 += 24; OamEnt *oam = get_OamEnt(oam_buf, v7); - oam[64].xpos = kSpr09A_SumoBro_XDisp[v8] + R0_; - oam[64].ypos = kSpr09A_SumoBro_YDisp[v11] + R1_; + oam[64].xpos = kSpr09A_SumoBro_XDisp[v8] + drt.x; + oam[64].ypos = kSpr09A_SumoBro_YDisp[v11] + drt.y; uint8 v10 = kSpr09A_SumoBro_Tiles[v11]; oam[64].charnum = v10; - oam[64].flags = R2_ + (v10 != 102) + 52; + oam[64].flags = r2 + (v10 != 102) + 52; sprites_oamtile_size_buffer[(v7 >> 2) + 64] = kSpr09A_SumoBro_TileSize[v11]; v7 += 4; v8 = v11 + 1; - --R5_; - } while ((R5_ & 0x80) == 0); + --r5; + } while ((r5 & 0x80) == 0); Spr070_Pokey_Bank02SpriteEntry(k, 0xFF, 3); } void Spr02B_SumoLightning(uint8 k) { // 02deb0 uint8 v1 = spr_decrementing_table1540[k]; if (v1) { - R2_ = spr_decrementing_table1540[k]; + uint8 r2 = spr_decrementing_table1540[k]; if (v1 == 1) spr_current_status[k] = 0; if ((v1 & 0xF) == 1) { @@ -5863,7 +6250,7 @@ void Spr02B_SumoLightning(uint8 k) { // 02deb0 } void Spr02B_SumoLightning_02DF2C(uint8 k) { // 02df2c - R0_W = GetSprXPos(k); + uint16 r0w = GetSprXPos(k); uint8 j = 9; while (cluster_spr_spriteid[j]) { if ((--j & 0x80) != 0) { @@ -5875,7 +6262,7 @@ void Spr02B_SumoLightning_02DF2C(uint8 k) { // 02df2c } uint8 v2 = spr_table1570[k]; SetHiLo(&cluster_spr_xpos_hi[j], &cluster_spr_xpos_lo[j], - PAIR16(kSpr02B_SumoLightning_FireInitialXPosHi[v2], kSpr02B_SumoLightning_FireInitialXPosLo[v2]) + R0_W); + PAIR16(kSpr02B_SumoLightning_FireInitialXPosHi[v2], kSpr02B_SumoLightning_FireInitialXPosLo[v2]) + r0w); cluster_spr_ypos_lo[j] = spr_ypos_lo[k] - 16; cluster_spr_ypos_hi[j] = spr_ypos_hi[k]; // bug wtf? cluster_spr_table0f4a[j] = 127; @@ -5964,7 +6351,7 @@ void Spr099_VolcanoLotus_Draw(uint8 k) { // 02e00b void Spr099_VolcanoLotus_02E079(uint8 k) { // 02e079 if (!(spr_yoffscreen_flag[k] | spr_xoffscreen_flag[k])) { - R0_ = 3; + uint8 r0 = 3; do { uint8 j = 7; while (ext_spr_spriteid[j]) { @@ -5974,9 +6361,9 @@ void Spr099_VolcanoLotus_02E079(uint8 k) { // 02e079 ext_spr_spriteid[j] = 12; SetHiLo(&ext_spr_xpos_hi[j], &ext_spr_xpos_lo[j], GetSprXPos(k) + 4); SetHiLo(&ext_spr_ypos_hi[j], &ext_spr_ypos_lo[j], GetSprYPos(k)); - ext_spr_xspeed[j] = kSpr099_VolcanoLotus_FireInitialXSpeed[R0_]; - ext_spr_yspeed[j] = kSpr099_VolcanoLotus_FireInitialYSpeed[R0_]; - } while ((--R0_ & 0x80) == 0); + ext_spr_xspeed[j] = kSpr099_VolcanoLotus_FireInitialXSpeed[r0]; + ext_spr_yspeed[j] = kSpr099_VolcanoLotus_FireInitialYSpeed[r0]; + } while ((--r0 & 0x80) == 0); } } @@ -6024,8 +6411,7 @@ void Spr04F_JumpingPiranhaPlant(uint8 k) { // 02e0cd } else { spr_yspeed[k] = 0; if (!spr_decrementing_table1540[k]) { - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 27) >= 0x37) { + if ((uint8)(player_xpos - GetSprXPos(k) + 27) >= 0x37) { spr_yspeed[k] = -64; ++spr_table00c2[k]; spr_table1602[k] = 0; @@ -6047,7 +6433,7 @@ void SprXXX_JumpingPiranhaPlant_02E17F(uint8 k) { // 02e17f } void SprXXX_JumpingPiranhaPlant_02E1C0(uint8 k, uint8 a) { // 02e1c0 - R0_ = a; + uint8 r0 = a; uint8 j = 7; while (ext_spr_spriteid[j]) { if ((--j & 0x80) != 0) @@ -6057,7 +6443,7 @@ void SprXXX_JumpingPiranhaPlant_02E1C0(uint8 k, uint8 a) { // 02e1c0 SetHiLo(&ext_spr_xpos_hi[j], &ext_spr_xpos_lo[j], GetSprXPos(k) + 4); SetHiLo(&ext_spr_ypos_hi[j], &ext_spr_ypos_lo[j], GetSprYPos(k)); ext_spr_yspeed[j] = -48; - ext_spr_xspeed[j] = R0_; + ext_spr_xspeed[j] = r0; SprXXX_JumpingPiranhaPlant_02E17F(k); } @@ -6090,8 +6476,8 @@ void Spr045_DirectionalCoins(uint8 k) { // 02e21d if (kSpr045_DirectionalCoins_DATA_02E211[v4] != spr_table00c2[k]) spr_table151c[k] = v4; } - R0_ = spr_ypos_lo[k] & 0xF; - if (!(R0_ | spr_xpos_lo[k] & 0xF)) { + uint8 r0 = spr_ypos_lo[k] & 0xF; + if (!(r0 | spr_xpos_lo[k] & 0xF)) { spr_table00c2[k] = spr_table151c[k]; blocks_xpos = GetSprXPos(k); blocks_ypos = GetSprYPos(k); @@ -6139,27 +6525,28 @@ void Spr090_GreenGasBubble(uint8 k) { // 02e311 } void Spr090_GreenGasBubble_Draw(uint8 k) { // 02e3aa - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; uint8 v1 = (spr_table1570[k] >> 3) & 3; - R2_ = kSpr090_GreenGasBubble_DATA_02E3A2[v1]; - R3_ = kSpr090_GreenGasBubble_DATA_02E3A6[v1]; + uint8 r2 = kSpr090_GreenGasBubble_DATA_02E3A2[v1]; + uint8 r3 = kSpr090_GreenGasBubble_DATA_02E3A6[v1]; uint8 v2 = spr_oamindex[k]; for (uint8 i = 15; (i & 0x80) == 0; --i) { - int8 v7 = kSpr090_GreenGasBubble_DATA_02E352[i] + R0_; + int8 v7 = kSpr090_GreenGasBubble_DATA_02E352[i] + drt.x; int8 v4; if ((kSpr090_GreenGasBubble_DATA_02E392[i] & 2) != 0) - v4 = v7 - R2_; + v4 = v7 - r2; else - v4 = R2_ + v7; + v4 = r2 + v7; OamEnt *oam = get_OamEnt(oam_buf, v2); oam[64].xpos = v4; - int8 v8 = kSpr090_GreenGasBubble_DATA_02E362[i] + R1_; + int8 v8 = kSpr090_GreenGasBubble_DATA_02E362[i] + drt.y; int8 v6; if ((kSpr090_GreenGasBubble_DATA_02E392[i] & 1) != 0) - v6 = v8 - R3_; + v6 = v8 - r3; else - v6 = R3_ + v8; + v6 = r3 + v8; oam[64].ypos = v6; oam[64].charnum = kSpr090_GreenGasBubble_Tiles[i]; oam[64].flags = kSpr090_GreenGasBubble_Prop[i]; @@ -6180,8 +6567,7 @@ void Spr04C_ExplodingBlock(uint8 k) { // 02e41f spr_xspeed[k] = v1; UpdateNormalSpritePosition_X(k); CheckPlayerAndNormalSpriteCollisions(k); - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 96) < 0xC0 && !spr_xoffscreen_flag[k]) + if ((uint8)(player_xpos - GetSprXPos(k) + 96) < 0xC0 && !spr_xoffscreen_flag[k]) ShatterExplodingBlock(k); } } @@ -6254,16 +6640,16 @@ void Spr08F_ScalePlatform_02E559(uint8 k, uint8 a) { // 02e559 } void Spr08F_ScalePlatform_Draw(uint8 k) { // 02e57e - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - int8 v2 = R0_ - 8; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_ - 8; + int8 v2 = drt.x - 8; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x - 8; oam[65].xpos = v2 + 16; - int8 v4 = R1_ - 1; - oam[64].ypos = R1_ - 1; + int8 v4 = drt.y - 1; + oam[64].ypos = drt.y - 1; oam[65].ypos = v4; oam[64].charnum = 0x80; oam[65].charnum = 0x80; @@ -6293,9 +6679,10 @@ void Spr052_MovingLedgeHole_02E5F7(uint8 k) { // 02e5f7 if (i != k && ((counter_global_frames ^ i) & 3) == 0 && spr_current_status[i] >= 8) { uint8 v2 = spr_no_level_collision_flag[i]; if (!v2 || v2 - 1 == k) { - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(i); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - uint8 v4 = StandardSpriteToSpriteCollisionChecks_CheckContact(); + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(i, &ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + uint8 v4 = StandardSpriteToSpriteCollisionChecks_CheckContact(&ci); spr_no_level_collision_flag[i] = (v4 & 1) ? k + 1 : 0; } } @@ -6303,34 +6690,34 @@ void Spr052_MovingLedgeHole_02E5F7(uint8 k) { // 02e5f7 } void Spr052_MovingLedgeHole_Draw(uint8 k) { // 02e637 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 3; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr052_MovingLedgeHole_XDisp[i] + R0_; - oam[64].ypos = R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr052_MovingLedgeHole_XDisp[i] + drt.x; + oam[64].ypos = drt.y; oam[64].charnum = kSpr052_MovingLedgeHole_Tiles[i]; oam[64].flags = kSpr052_MovingLedgeHole_Prop[i]; - drt += 4; + drt.idx += 4; } Spr070_Pokey_Bank02SpriteEntry(k, 2, 3); } void Spr01E_Lakitu_LakituFishingLineDraw(uint8 k) { // 02e67a - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - spr_oamindex[k] = drt + 8; - int8 v2 = R0_ - 13; - OamEnt *oam = get_OamEnt(oam_buf, (uint8)(drt + 8)); - oam[64].xpos = R0_ - 13; + spr_oamindex[k] = drt.idx + 8; + int8 v2 = drt.x - 13; + OamEnt *oam = get_OamEnt(oam_buf, (uint8)(drt.idx + 8)); + oam[64].xpos = drt.x - 13; misc_scratch7e185e = v2 - 8; oam[65].xpos = v2 - 8; - uint8 v4 = R1_ + 2; - oam[64].ypos = R1_ + 2; + uint8 v4 = drt.y + 2; + oam[64].ypos = drt.y + 2; misc_scratch7e18b6 = v4; oam[65].ypos = v4 + 64; oam[64].charnum = -86; @@ -6443,8 +6830,7 @@ void Spr049_ShiftingPipe(uint8 k) { // 02e845 Spr049_ShiftingPipe_Draw(k); SubOffscreen_Bank02_Entry1(k); if (!(spr_xoffscreen_flag[k] | flag_sprites_locked)) { - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 80) < 0xA0) { + if ((uint8)(player_xpos - GetSprXPos(k) + 80) < 0xA0) { uint8 v2 = spr_table00c2[k] & 3; if (++spr_table1570[k] == kSpr049_ShiftingPipe_DATA_02E839[v2]) { spr_table1570[k] = 0; @@ -6484,16 +6870,16 @@ void Spr049_ShiftingPipe_GrowingPipeGfx(uint8 k, uint8 j) { // 02e8ba } void Spr049_ShiftingPipe_Draw(uint8 k) { // 02e902 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - uint8 v2 = R0_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; + uint8 v2 = drt.x; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; oam[65].xpos = v2 + 16; - int8 v4 = R1_ - 1; - oam[64].ypos = R1_ - 1; + int8 v4 = drt.y - 1; + oam[64].ypos = drt.y - 1; oam[65].ypos = v4; oam[64].charnum = -92; oam[65].charnum = -90; @@ -6521,8 +6907,7 @@ void Spr04B_PipeLakitu(uint8 k) { // 02e93d switch (v1) { case 0: if (!spr_decrementing_table1540[k]) { - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 19) >= 0x36) + if ((uint8)(player_xpos - GetSprXPos(k) + 19) >= 0x36) sub_2E980(k, 0x90); } return; @@ -6583,16 +6968,16 @@ void sub_2E980(uint8 k, uint8 a) { // 02e980 } void Spr04B_PipeLakitu_Draw(uint8 k) { // 02e9ec - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - uint8 v2 = R0_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; + uint8 v2 = drt.x; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; oam[65].xpos = v2; - uint8 v4 = R1_; - oam[64].ypos = R1_; + uint8 v4 = drt.y; + oam[64].ypos = drt.y; oam[65].ypos = v4 + 16; uint8 v5 = spr_table1602[k]; oam[64].charnum = kSpr04B_PipeLakitu_HeadTiles[v5]; @@ -6611,10 +6996,9 @@ void Spr04B_PipeLakitu_Draw(uint8 k) { // 02e9ec void SetBabyYoshiDynamicGraphicsPointer(uint8 k) { // 02ea25 OamEnt *oam = get_OamEnt(oam_buf, spr_oamindex[k]); - R0_ = oam[64].charnum; - R1_ = 0; + uint16 r0w = oam[64].charnum; oam[64].charnum = 6; - *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[6] = 32 * R0_W + 0x8500; + *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[6] = 32 * r0w + 0x8500; *(uint16 *)&graphics_dynamic_sprite_pointers_bottom_lo[6] = *(uint16 *)&graphics_dynamic_sprite_pointers_top_lo[6] + 512; } @@ -6632,9 +7016,10 @@ void CheckIfBabyYoshiCanEatNormalSprite2(uint8 k) { // 02ea4e } void CheckIfBabyYoshiCanEatNormalSprite_02EA8A(uint8 k, uint8 j) { // 02ea8a - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j, &ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (spr_decrementing_table163e[k] && (CheckIfBabyYoshiCanEatNormalSprite1(k), growing_yoshi_timer)) { spr_decrementing_table163e[k] = 0; } else { @@ -6698,25 +7083,25 @@ void SprXXX_SuperKoopas_02EB3D(uint8 k, uint8 j) { // 02eb3d } void SprXXX_SuperKoopas_GroundedSuperKoopaState00_Running(uint8 k) { // 02eb8d - R1_ = 0; - R0_ = 0; + uint8 r1 = 0; + uint8 r0 = 0; uint8 v1 = spr_table157c[k]; uint8 v2 = spr_xspeed[k]; if (v2 != kSprXXX_SuperKoopas_MaxXSpeed[v1]) { uint8 v3 = kSprXXX_SuperKoopas_XAcceleration[v1] + v2; - if (!R1_) + if (!r1) spr_xspeed[k] = v3; - ++R0_; + ++r0; } if (++spr_table151c[k] == 48) SprXXX_SuperKoopas_02EBCA(k); else - SprXXX_SuperKoopas_02EBB5(k); + SprXXX_SuperKoopas_02EBB5(k, r0); } -void SprXXX_SuperKoopas_02EBB5(uint8 k) { // 02ebb5 +void SprXXX_SuperKoopas_02EBB5(uint8 k, uint8 r0) { // 02ebb5 uint8 v1 = (counter_global_frames & 4) != 0; - if (!R0_) + if (!r0) v1 += 6; spr_table1602[k] = v1; } @@ -6731,8 +7116,7 @@ void SprXXX_SuperKoopas_GroundedSuperKoopaState01_Jumping(uint8 k) { // 02ebd1 spr_yspeed[k] = v1; if (!sign8(v1 - 20)) ++spr_table00c2[k]; - R0_ = 0; - SprXXX_SuperKoopas_02EBB5(k); + SprXXX_SuperKoopas_02EBB5(k, 0); ++spr_table1602[k]; } @@ -6748,22 +7132,22 @@ void SprXXX_SuperKoopas_02EBF8(uint8 k) { // 02ebf8 } void SprXXX_SuperKoopas_Draw(uint8 k) { // 02ecde - uint8 drt; + GetDrawInfoRes drt; uint8 v4; int8 v5; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_table157c[k]; - R5_ = spr_table15f6[k] & 0xE; - R3_ = 4 * spr_table1602[k]; - R4_ = 0; + uint8 r2 = spr_table157c[k]; + uint8 r5 = spr_table15f6[k] & 0xE; + uint8 r3 = 4 * spr_table1602[k]; + uint8 r4 = 0; do { - uint8 v2 = R4_ + R3_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].ypos = kSprXXX_SuperKoopas_YDisp[(uint8)(R4_ + R3_)] + R1_; + uint8 v2 = r4 + r3; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].ypos = kSprXXX_SuperKoopas_YDisp[(uint8)(r4 + r3)] + drt.y; oam[64].charnum = kSprXXX_SuperKoopas_Tiles[v2]; - sprites_oamtile_size_buffer[(drt >> 2) + 64] = kSprXXX_SuperKoopas_TileSize[v2]; + sprites_oamtile_size_buffer[(drt.idx >> 2) + 64] = kSprXXX_SuperKoopas_TileSize[v2]; if ((kSprXXX_SuperKoopas_Prop[v2] & 2) != 0) { if (spr_table1534[spr_current_slotid]) { v4 = kSprXXX_SuperKoopas_DATA_02ED39[(counter_local_frames & 2) != 0]; @@ -6774,33 +7158,33 @@ void SprXXX_SuperKoopas_Draw(uint8 k) { // 02ecde } v5 = (kSprXXX_SuperKoopas_Prop[v2] | v4) & ~2; } else { - v5 = R5_ | kSprXXX_SuperKoopas_Prop[v2]; + v5 = r5 | kSprXXX_SuperKoopas_Prop[v2]; } - if (!(R2_ & 1)) { + if (!(r2 & 1)) { v2 += 36; v5 |= 0x40; } oam[64].flags = sprites_tile_priority | v5; - oam[64].xpos = kSprXXX_SuperKoopas_XDisp[v2] + R0_; - drt += 4; - } while (++R4_ != 4); + oam[64].xpos = kSprXXX_SuperKoopas_XDisp[v2] + drt.x; + drt.idx += 4; + } while (++r4 != 4); Spr070_Pokey_Bank02SpriteEntry(k, 0xFF, 3); } void Spr061_SkullRaft_Init(uint8 k) { // 02ed8a sprites_floating_skull_speed = 0; ++spr_table00c2[k]; - R0_ = 2; + uint8 r0 = 2; do { uint8 j = FindFreeNormalSpriteSlot_HighPriority(); if ((j & 0x80) == 0) { spr_current_status[j] = 8; spr_spriteid[j] = 97; SetSprYPos(j, GetSprYPos(k)); - SetSprXPos(j, GetSprXPos(k) + kSpr061_SkullRaft_Init_XPosOffset[R0_]); + SetSprXPos(j, GetSprXPos(k) + kSpr061_SkullRaft_Init_XPosOffset[r0]); InitializeNormalSpriteRAMTables(j); } - } while ((--R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); } void Spr061_SkullRaft(uint8 k) { // 02edd8 @@ -6812,10 +7196,10 @@ void Spr061_SkullRaft(uint8 k) { // 02edd8 if (oam[64].ypos < 0xF0) oam[64].ypos += 3; if (!flag_sprites_locked) { - R0_ = 0; + uint8 r0 = 0; for (uint8 i = 9; (i & 0x80) == 0; --i) { if (spr_current_status[i] && spr_spriteid[i] == 97 && (spr_table1588[i] & 0xF) != 0) - R0_ = spr_table1588[i] & 0xF; + r0 = spr_table1588[i] & 0xF; } spr_xspeed[k] = sprites_floating_skull_speed; if (!sign8(spr_yspeed[k] - 32)) @@ -6829,8 +7213,8 @@ void Spr061_SkullRaft(uint8 k) { // 02edd8 ++v5[64].ypos; misc_player_on_solid_sprite = 1; player_in_air_flag = 0; - R1_ = player_riding_yoshi_flag ? 44 : 28; - player_ypos = GetSprYPos(k) - R1_; + uint8 r1 = player_riding_yoshi_flag ? 44 : 28; + player_ypos = GetSprYPos(k) - r1; if ((player_blocked_flags & 1) == 0) player_xpos += (int8)sprites_position_disp; } @@ -6854,9 +7238,9 @@ void Spr06A_CoinGameCloud(uint8 k) { // 02eeb5 Spr06A_CoinGameCloud_02EF67(k); } if ((counter_local_frames & 1) == 0) { - R0_W = GetSprYPos(k); - R2_W = 0x110; - bool v1 = R0_W >= R2_W; + uint16 r0w = GetSprYPos(k); + uint16 r2w = 0x110; + bool v1 = r0w >= r2w; if (spr_table1570[k] >= 0xB) { SubOffscreen_Bank02_Entry1(k); v1 = 1; @@ -6876,11 +7260,12 @@ void Spr06A_CoinGameCloud(uint8 k) { // 02eeb5 oam[64].charnum = 96; oam[64].flags = (8 * counter_local_frames) & 0xC0 | 0x30; spr_oamindex[k] = v4; - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; oam = get_OamEnt(oam_buf, spr_oamindex[k]); - oam[64].xpos = R0_ + 4; - oam[64].ypos = R1_ + 4; + oam[64].xpos = drt.x + 4; + oam[64].ypos = drt.y + 4; oam[64].charnum = 77; oam[64].flags = 57; Spr070_Pokey_Bank02SpriteEntry(k, 0, 0); @@ -6927,12 +7312,12 @@ void Spr086_Wiggler_Init(uint8 k) { // 02eff2 } void Spr086_Wiggler_Init_GetWigglerSegmentPosIndex(uint8 k) { // 02f011 - spr86_wiggler_segment_pos_ptr = PAIR16(kSpr086_Wiggler_Init_WigglerSegmentTablePointerHi[k & 3], kSpr086_Wiggler_Init_WigglerSegmentTablePointerLo[k & 3]) + 0x9a7b; - spr86_wiggler_segment_pos_ptr_bank = 127; + spr86_wiggler_segment_pos_ptr.addr = PAIR16(kSpr086_Wiggler_Init_WigglerSegmentTablePointerHi[k & 3], kSpr086_Wiggler_Init_WigglerSegmentTablePointerLo[k & 3]) + 0x9a7b; + spr86_wiggler_segment_pos_ptr.bank = 127; } void Spr086_Wiggler(uint8 k) { // 02f035 - uint8 drt; + GetDrawInfoRes drt; Spr086_Wiggler_Init_GetWigglerSegmentPosIndex(k); if (!flag_sprites_locked) { @@ -6944,7 +7329,6 @@ void Spr086_Wiggler(uint8 k) { // 02f035 v2 = 8; else v2 = v1 & 0xE; - R0_ = v2; spr_table15f6[k] = v2 | spr_table15f6[k] & 0xF1; } else { UpdateNormalSpritePosition_X(k); @@ -6978,37 +7362,35 @@ void Spr086_Wiggler(uint8 k) { // 02f035 spr_table00c2[k] = spr_table157c[k] | (2 * spr_table00c2[k]); } } - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R3_ = spr_table1570[k]; - R7_ = spr_table15f6[k]; - R8_ = spr_table151c[k]; - R2_ = spr_table00c2[k]; - uint8 v6 = drt + 4; + uint8 r3 = spr_table1570[k]; + uint8 r7 = spr_table15f6[k]; + uint8 r8 = spr_table151c[k]; + uint8 r2 = spr_table00c2[k]; + uint8 v6 = drt.idx + 4; uint8 v7 = 0; uint8 ka; do { ka = v7; - R5_ = v7; - R6_ = (v7 + (R3_ >> 3)) & 3; + uint8 r6 = (v7 + (r3 >> 3)) & 3; uint8 v24 = v6; uint8 v8 = kSpr086_Wiggler_DATA_02F103[v7]; - if (R8_) + if (r8) v8 = (v8 >> 1) & 0xFE; - R9_ = v8; uint8 *v9 = IndirPtr(&spr86_wiggler_segment_pos_ptr, v8); get_OamEnt(oam_buf, v24)[64].xpos = *v9 - mirror_current_layer1_xpos; - int8 v10 = *IndirPtr(&spr86_wiggler_segment_pos_ptr, (uint8)(R9_ + 1)) - mirror_current_layer1_ypos - - kSpr086_Wiggler_WigglerYDisp[R6_]; + int8 v10 = *IndirPtr(&spr86_wiggler_segment_pos_ptr, (uint8)(v8 + 1)) - mirror_current_layer1_ypos - + kSpr086_Wiggler_WigglerYDisp[r6]; OamEnt *oam = get_OamEnt(oam_buf, v24); oam[64].ypos = v10; uint8 v12 = -116; if (v7) - v12 = kSpr086_Wiggler_WigglerTiles[R6_]; + v12 = kSpr086_Wiggler_WigglerTiles[r6]; oam[64].charnum = v12; - int8 v13 = sprites_tile_priority | R7_; - int8 v14 = R2_ & 1; - R2_ >>= 1; + int8 v13 = sprites_tile_priority | r7; + int8 v14 = r2 & 1; + r2 >>= 1; if (!v14) v13 |= 0x40; oam[64].flags = v13; @@ -7020,7 +7402,7 @@ void Spr086_Wiggler(uint8 k) { // 02f035 OamEnt *v16 = get_OamEnt(oam_buf, v15); uint8 v17 = spr_current_slotid; uint8 flags; - if (R8_) { + if (r8) { v16[64].xpos = kSpr086_Wiggler_EyeXDisp[spr_table157c[spr_current_slotid]] + v16[65].xpos; v16[64].ypos = v16[65].ypos; v16[64].charnum = -120; @@ -7034,9 +7416,8 @@ void Spr086_Wiggler(uint8 k) { // 02f035 get_OamEnt(oam_buf, v15)[64].flags = flags; sprites_oamtile_size_buffer[(v15 >> 2) + 64] = 0; Spr070_Pokey_Bank02SpriteEntry(v17, 0xFF, 5); - R0_W = GetSprXPos(v17); - if ((uint16)(R0_W - player_xpos + 80) < 0xA0 && spr_current_status[v17] == 8) { - R0_ = 4; + if ((uint16)(GetSprXPos(v17) - player_xpos + 80) < 0xA0 && spr_current_status[v17] == 8) { + uint8 r0 = 4; uint8 v19 = spr_oamindex[v17]; do { OamEnt *v20 = get_OamEnt(oam_buf, v19); @@ -7079,13 +7460,12 @@ void Spr086_Wiggler(uint8 k) { // 02f035 } } v19 += 4; - --R0_; - } while ((R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); } } void Spr086_Wiggler_02F0DB(uint8 k) { // 02f0db - uint8 *v2 = g_ram + 0x10000 + spr86_wiggler_segment_pos_ptr; + uint8 *v2 = g_ram + 0x10000 + spr86_wiggler_segment_pos_ptr.addr; memmove(v2 + 2, v2, 0x7E); IndirWriteByte(&spr86_wiggler_segment_pos_ptr, 0, spr_xpos_lo[k]); IndirWriteByte(&spr86_wiggler_segment_pos_ptr, 1, spr_ypos_lo[k]); @@ -7163,13 +7543,13 @@ void Spr08A_Bird_02F3C1(uint8 k) { // 02f3c1 } void Spr08A_Bird_Draw(uint8 k) { // 02f3ea - R2_ = kSpr08A_Bird_Direction[spr_table157c[k]] | kSpr08A_Bird_Palette[k & 3]; + uint8 r2 = kSpr08A_Bird_Direction[spr_table157c[k]] | kSpr08A_Bird_Palette[k & 3]; uint8 v1 = kSpr08A_Bird_BirdOAMIndex[k & 3]; OamEnt *oam = get_OamEnt(oam_buf, v1); oam->xpos = spr_xpos_lo[k] - mirror_current_layer1_xpos; oam->ypos = spr_ypos_lo[k] - mirror_current_layer1_ypos; oam->charnum = kSpr08A_Bird_Tiles[spr_table1602[k]]; - oam->flags = R2_; + oam->flags = r2; sprites_oamtile_size_buffer[v1 >> 2] = 0; } @@ -7191,12 +7571,12 @@ void Spr08B_FireplaceSmoke(uint8 k) { // 02f434 void Spr08B_FireplaceSmoke_Draw(uint8 k) { // 02f47c if ((counter_local_frames & 0xF) == 0) ++spr_table151c[k]; - R0_ = kSpr08B_FireplaceSmoke_DATA_02F463[spr_table151c[k]]; + uint8 r0 = kSpr08B_FireplaceSmoke_DATA_02F463[spr_table151c[k]]; uint8 v1 = spr_oamindex[k]; int8 v4 = spr_xpos_lo[k] - mirror_current_layer1_xpos; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = v4 - R0_; - oam[65].xpos = R0_ + v4; + oam[64].xpos = v4 - r0; + oam[65].xpos = r0 + v4; int8 v3 = spr_ypos_lo[k] - mirror_current_layer1_ypos; oam[64].ypos = v3; oam[65].ypos = v3; @@ -7260,18 +7640,18 @@ void Spr08D_GhostHouseDoor(uint8 k) { // 02f5d0 uint8 v0 = 9; uint8 v1 = -96; do { - R2_ = 0; + uint8 r2 = 0; uint8 v2 = kSpr08D_GhostHouseDoor_DATA_02F59E[v0]; - R0_ = v2 - mirror_current_layer1_xpos; + uint8 r0 = v2 - mirror_current_layer1_xpos; if (kSpr08D_GhostHouseDoor_DATA_02F5A8[v0] != (uint8)((v2 < (uint8)mirror_current_layer1_xpos) + HIBYTE(mirror_current_layer1_xpos))) - ++R2_; + ++r2; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = R0_; + oam[64].xpos = r0; oam[64].ypos = kSpr08D_GhostHouseDoor_YDisp[v0]; oam[64].charnum = kSpr08D_GhostHouseDoor_Tile[v0]; oam[64].flags = kSpr08D_GhostHouseDoor_Prop[v0]; - sprites_oamtile_size_buffer[(v1 >> 2) + 64] = R2_ | 2; + sprites_oamtile_size_buffer[(v1 >> 2) + 64] = r2 | 2; v1 += 4; --v0; } while ((v0 & 0x80) == 0); @@ -7307,17 +7687,16 @@ void DrawBigCastleGate() { // 02f66e else v0 = -(int8)(v0 + 79); } - R0_ = v0; - DrawBigCastleGate_DrawBigCastleGate(); + DrawBigCastleGate_DrawBigCastleGate(v0); } -void DrawBigCastleGate_DrawBigCastleGate() { // 02f6b8 +void DrawBigCastleGate_DrawBigCastleGate(uint8 r0) { // 02f6b8 uint8 v0 = 11; uint8 v1 = -80; do { OamEnt *oam = get_OamEnt(oam_buf, v1); oam->xpos = kDrawBigCastleGate_XDisp[v0] - 72; - oam->ypos = kDrawBigCastleGate_YDisp[v0] + 80 - mirror_current_layer1_ypos - R0_; + oam->ypos = kDrawBigCastleGate_YDisp[v0] + 80 - mirror_current_layer1_ypos - r0; oam->charnum = -91; oam->flags = 33; sprites_oamtile_size_buffer[v1 >> 2] = 2; @@ -7334,36 +7713,36 @@ void DrawGhostHouseEntranceDoor() { // 02f759 io_sound_ch3 = 15; if (v0 == 8) io_sound_ch3 = 16; - R3_ = kDrawGhostHouseEntranceDoor_AnimationFrame[v0 >> 3]; + uint8 r3 = kDrawGhostHouseEntranceDoor_AnimationFrame[v0 >> 3]; uint8 v1 = 7; - R0_ = -72 - mirror_current_layer1_xpos; - R1_ = 96 - mirror_current_layer1_ypos; + uint8 r0 = -72 - mirror_current_layer1_xpos; + uint8 r1 = 96 - mirror_current_layer1_ypos; do { - R2_ = v1; + uint8 r2 = v1; uint8 v2 = kDrawGhostHouseEntranceDoor_OAMIndexes[v1]; - uint8 v3 = v1 + 8 * R3_; + uint8 v3 = v1 + 8 * r3; uint8 v5; if ((v2 & 0x80) != 0) { OamEnt *oam = get_OamEnt(oam_buf, v2); - oam->xpos = kDrawGhostHouseEntranceDoor_XDisp[v3] + R0_; + oam->xpos = kDrawGhostHouseEntranceDoor_XDisp[v3] + r0; oam->charnum = kDrawGhostHouseEntranceDoor_Tiles[v3]; - v5 = R2_; - int v9 = R2_; - oam->ypos = kDrawGhostHouseEntranceDoor_YDisp[R2_] + R1_; + v5 = r2; + int v9 = r2; + oam->ypos = kDrawGhostHouseEntranceDoor_YDisp[r2] + r1; uint8 v10 = kDrawGhostHouseEntranceDoor_Prop[v9]; - if (R3_ >= 3) + if (r3 >= 3) v10 ^= 0x40; oam->flags = v10; sprites_oamtile_size_buffer[v2 >> 2] = 2; } else { OamEnt *v4 = get_OamEnt(oam_buf, v2); - v4[64].xpos = kDrawGhostHouseEntranceDoor_XDisp[v3] + R0_; + v4[64].xpos = kDrawGhostHouseEntranceDoor_XDisp[v3] + r0; v4[64].charnum = kDrawGhostHouseEntranceDoor_Tiles[v3]; - v5 = R2_; - int v6 = R2_; - v4[64].ypos = kDrawGhostHouseEntranceDoor_YDisp[R2_] + R1_; + v5 = r2; + int v6 = r2; + v4[64].ypos = kDrawGhostHouseEntranceDoor_YDisp[r2] + r1; uint8 v7 = kDrawGhostHouseEntranceDoor_Prop[v6]; - if (R3_ >= 3) + if (r3 >= 3) v7 ^= 0x40; v4[64].flags = v7; sprites_oamtile_size_buffer[(v2 >> 2) + 64] = 2; @@ -7407,18 +7786,18 @@ void ClusterSpr07_ReappearingBoo(uint8 k) { // 02f83d cluster_spr04_boo_ring_index = 0; return; } - R0_ = cluster_spr_table1e66[k]; - R1_ = cluster_spr_table1e52[k]; + uint8 r0 = cluster_spr_table1e66[k]; + uint8 r1 = cluster_spr_table1e52[k]; if ((cluster_spr04_boo_ring_index & 1) == 0) { - R0_ = cluster_spr_table1e8e[k]; - R1_ = cluster_spr_table1e7a[k]; + r0 = cluster_spr_table1e8e[k]; + r1 = cluster_spr_table1e7a[k]; } - SetHiLo(&cluster_spr_xpos_hi[k], &cluster_spr_xpos_lo[k], mirror_current_layer1_xpos + R0_); - SetHiLo(&cluster_spr_ypos_hi[k], &cluster_spr_ypos_lo[k], mirror_current_layer1_ypos + R1_); + SetHiLo(&cluster_spr_xpos_hi[k], &cluster_spr_xpos_lo[k], mirror_current_layer1_xpos + r0); + SetHiLo(&cluster_spr_ypos_hi[k], &cluster_spr_ypos_lo[k], mirror_current_layer1_ypos + r1); } - R0_ = counter_local_frames + 4 * k; - if (!(flag_sprites_locked | R0_ & 7)) { - uint8 v3 = (uint8)(R0_ & 0x20) >> 5; + uint8 r0 = counter_local_frames + 4 * k; + if (!(flag_sprites_locked | r0 & 7)) { + uint8 v3 = (uint8)(r0 & 0x20) >> 5; SetHiLo(&cluster_spr_ypos_hi[k], &cluster_spr_ypos_lo[k], PAIR16(cluster_spr_ypos_hi[k], cluster_spr_ypos_lo[k]) + PAIR16(kClusterSpr07_ReappearingBoo_DATA_02F839[v3], kClusterSpr07_ReappearingBoo_DATA_02F837[v3])); @@ -7461,22 +7840,22 @@ void ClusterSpr06_SumoBroFlame_02F940(uint8 k) { // 02f940 spr_oamindex[0] = kClusterSpriteOAMIndexes[(uint8)(2 * k)]; SetSprXPos(0, PAIR16(cluster_spr_xpos_hi[k], cluster_spr_xpos_lo[k])); SetSprYPos(0, PAIR16(cluster_spr_ypos_hi[k], cluster_spr_ypos_lo[k])); - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(0)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(0)).idx == 0xff) return; int8 v2 = 1; do { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; uint8 v4 = misc_scratch7e185e | v2; int8 v5 = kClusterSpr06_SumoBroFlame_DATA_02F8FC[v4]; if (v5 >= 0) { - oam[64].ypos = R1_ + v5; + oam[64].ypos = drt.y + v5; oam[64].charnum = kClusterSpr06_SumoBroFlame_Tiles[v4]; oam[64].flags = sprites_tile_priority | (16 * (counter_local_frames & 4)) | 5; } - drt += 4; + drt.idx += 4; } while ((int8)--v2 >= 0); FinishOAMWrite(0, 2, 1); } @@ -7486,13 +7865,14 @@ void ClusterSpr06_SumoBroFlame_02F9A6(uint8 k) { // 02f9a6 } void ClusterSpr06_SumoBroFlame_CheckPlayerContact(uint8 k) { // 02f9ae + CollInfo ci; if (((counter_global_frames ^ k) & 3) == 0 && cluster_spr_table0f4a[k] >= 0x10) { - SetHiLo(&R10_, &R4_, PAIR16(cluster_spr_xpos_hi[k], cluster_spr_xpos_lo[k]) + 2); - R6_ = 12; - SetHiLo(&R11_, &R5_, PAIR16(cluster_spr_ypos_hi[k], cluster_spr_ypos_lo[k]) + kClusterSpr06_SumoBroFlame_DATA_02F9AA[misc_scratch7e185e]); - R7_ = 20; - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + SetHiLo(&ci.r10, &ci.r4, PAIR16(cluster_spr_xpos_hi[k], cluster_spr_xpos_lo[k]) + 2); + ci.r6 = 12; + SetHiLo(&ci.r11, &ci.r5, PAIR16(cluster_spr_ypos_hi[k], cluster_spr_ypos_lo[k]) + kClusterSpr06_SumoBroFlame_DATA_02F9AA[misc_scratch7e185e]); + ci.r7 = 20; + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (timer_star_power) ClusterSpr06_SumoBroFlame_02F9A6(k); else @@ -7535,40 +7915,38 @@ void ClusterSpr04_BooRing(uint8 k) { // 02fa98 if (v2) { SetHiLo((&cluster_spr04_boo_ring1_angle_hi + v1), (&cluster_spr04_boo_ring1_angle_lo + v1), PAIR16(*(&cluster_spr04_boo_ring1_angle_hi + v1), *(&cluster_spr04_boo_ring1_angle_lo + v1)) + (int8)v2 & 0x1ff); - R0_W = PAIR16(*(&cluster_spr04_boo_ring1_center_xpos_hi + v1), *(&cluster_spr04_boo_ring1_center_xpos_lo + v1)); - if ((uint16)(R0_W - mirror_current_layer1_xpos + 128) >= 0x200) { + uint16 r0w = PAIR16(*(&cluster_spr04_boo_ring1_center_xpos_hi + v1), *(&cluster_spr04_boo_ring1_center_xpos_lo + v1)); + if ((uint16)(r0w - mirror_current_layer1_xpos + 128) >= 0x200) { *(&cluster_spr04_boo_ring1_offscreen_flag + v1) = 1; sprites_load_status[*(&cluster_spr04_boo_ring_unused_ring1_level_list_index + v1)] = 0; --cluster_spr04_boo_ring_index; } } } - R0_W = PAIR16(*(&cluster_spr04_boo_ring1_angle_hi + v1), *(&cluster_spr04_boo_ring1_angle_lo + v1)) + + uint16 r0w = PAIR16(*(&cluster_spr04_boo_ring1_angle_hi + v1), *(&cluster_spr04_boo_ring1_angle_lo + v1)) + kClusterSpr04_BooRing_DATA_02FA84[cluster_spr_table0f72[k]] & 0x1ff; - R2_W = (R0_W + 128) & 0x1FF; - R4_W = kCircleCoordinates[(uint8)R0_W]; - R6_W = kCircleCoordinates[(uint8)(R0_W + 0x80)]; - WriteReg(WRMPYA, R4_); + uint16 r2w = (r0w + 128) & 0x1FF; + uint16 r4w = kCircleCoordinates[(uint8)r0w]; + uint16 r6 = kCircleCoordinates[(uint8)(r0w + 0x80)]; uint8 v6 = 80; - if (!R5_) { - WriteReg(WRMPYB, 0x50); - uint8 t = ReadReg(RDMPYL); - v6 = ReadReg(RDMPYH) + (t >> 7); + if (r4w < 256) { + uint16 mult = Mult8x8(r4w, v6); + uint8 t = mult; + v6 = (mult >> 8) + (t >> 7); } - R4_ = (R1_ & 1) ? -v6 : v6; - WriteReg(WRMPYA, R6_); + r4w = ((r0w >> 8) & 1) ? -v6 : v6; uint8 v8 = 80; - if (!R7_) { - WriteReg(WRMPYB, 0x50); - uint8 t = ReadReg(RDMPYL); - v8 = ReadReg(RDMPYH) + (t >> 7); + if (r6 < 256) { + uint16 mult = Mult8x8(r6, v8); + uint8 t = mult; + v8 = (mult >> 8) + (t >> 7); } - R6_ = (R3_ & 1) ? -v8 : v8; + uint8 yy = ((r2w >> 8) & 1) ? -v8 : v8; uint8 v11 = cluster_spr_table0f86[k]; SetHiLo(&cluster_spr_xpos_hi[k], &cluster_spr_xpos_lo[k], - PAIR16(*(&cluster_spr04_boo_ring1_center_xpos_hi + v11), *(&cluster_spr04_boo_ring1_center_xpos_lo + v11)) + (int8)R4_); + PAIR16(*(&cluster_spr04_boo_ring1_center_xpos_hi + v11), *(&cluster_spr04_boo_ring1_center_xpos_lo + v11)) + (int8)r4w); SetHiLo(&cluster_spr_ypos_hi[k], &cluster_spr_ypos_lo[k], - PAIR16(*(&cluster_spr04_boo_ring1_center_ypos_hi + v11), *(&cluster_spr04_boo_ring1_center_ypos_lo + v11)) + (int8)R6_); + PAIR16(*(&cluster_spr04_boo_ring1_center_ypos_hi + v11), *(&cluster_spr04_boo_ring1_center_ypos_lo + v11)) + (int8)yy); ClusterSpr03_BooCeiling_02FC8D(k); ClusterSpr04_BooRing_02FBB0(k); } @@ -7596,9 +7974,9 @@ void ClusterSpr03_BooCeiling(uint8 k) { // 02fbc7 SetHiLo(&cluster_spr_ypos_hi[v2], &cluster_spr_ypos_lo[v2], ypos); SetSprYPos(0, ypos); cluster_spr_table0f72[v2] = ypos & ~3; - AimTowardsPlayer_Bank23(0, 0x10); - cluster_spr_table1e52[v2] = R0_ + 9; - cluster_spr_table1e66[v2] = R1_; + PointU8 pt = AimTowardsPlayer_Bank23(0, 0x10); + cluster_spr_table1e52[v2] = pt.y + 9; + cluster_spr_table1e66[v2] = pt.x; } } k = spr_current_slotid; @@ -7628,8 +8006,8 @@ void ClusterSpr03_BooCeiling(uint8 k) { // 02fbc7 } void ClusterSpr03_BooCeiling_02FC8D(uint8 k) { // 02fc8d - R0_W = PAIR16(cluster_spr_xpos_hi[k], cluster_spr_xpos_lo[k]); - if ((uint16)(R0_W - mirror_current_layer1_xpos + 64) < 0x180) { + uint16 r0w = PAIR16(cluster_spr_xpos_hi[k], cluster_spr_xpos_lo[k]); + if ((uint16)(r0w - mirror_current_layer1_xpos + 64) < 0x180) { ClusterSpr03_BooCeiling_DrawClusterSpriteBoo(k, 2); uint16 ypos = PAIR16(cluster_spr_ypos_hi[k], cluster_spr_ypos_lo[k]); uint16 xpos = PAIR16(cluster_spr_xpos_hi[k], cluster_spr_xpos_lo[k]); @@ -7662,21 +8040,21 @@ void ClusterSpr03_BooCeiling_02FCE2(uint8 k) { // 02fce2 } void ClusterSpr03_BooCeiling_DrawClusterSpriteBoo(uint8 k, uint8 a) { // 02fd48 - R2_ = a; + uint8 r2 = a; uint8 v2 = kClusterSpriteOAMIndexes[k]; OamEnt *oam = get_OamEnt(oam_buf, v2); oam[64].xpos = cluster_spr_xpos_lo[k] - mirror_current_layer1_xpos; oam[64].ypos = cluster_spr_ypos_lo[k] - mirror_current_layer1_ypos; - R0_ = (counter_local_frames & 8) != 0; - oam[64].charnum = kClusterSpr03_BooCeiling_BooCeilingTiles[R0_ + 2 * (k & 3)]; + uint8 r0 = (counter_local_frames & 8) != 0; + oam[64].charnum = kClusterSpr03_BooCeiling_BooCeilingTiles[r0 + 2 * (k & 3)]; int8 v4 = (!__CFSHL__(cluster_spr_table1e66[k], 1)) ? 0x40 : 0; - oam[64].flags = R2_ | v4 | 0x31; + oam[64].flags = r2 | v4 | 0x31; sprites_oamtile_size_buffer[(v2 >> 2) + 64] = 2; if (cluster_spr_spriteid[k] == 8) { uint8 v5 = kClusterSpriteOAMIndexes[k]; - R0_ = (counter_local_frames & 4) != 0; + r0 = (counter_local_frames & 4) != 0; OamEnt *v6 = get_OamEnt(oam_buf, v5); - v6[64].charnum = kClusterSpr03_BooCeiling_BatCeilingTiles[(uint8)(R0_ | (2 * cluster_spr_table0f86[k]))]; + v6[64].charnum = kClusterSpr03_BooCeiling_BatCeilingTiles[(uint8)(r0 | (2 * cluster_spr_table0f86[k]))]; v6[64].flags = 55; } } @@ -7718,13 +8096,12 @@ void ClusterSpr01_1up(uint8 k) { // 02fdbc } void CheckPlayerToEnemyClusterSpriteCollision(uint8 k) { // 02fe71 - R2_ = 20; - R3_ = 0; - R0_W = PAIR16(cluster_spr_xpos_hi[k], cluster_spr_xpos_lo[k]); - if ((uint16)(player_xpos - R0_W + 10) < R2_W) { - R2_W = PAIR16(cluster_spr_ypos_hi[k], cluster_spr_ypos_lo[k]) + 3; - R4_W = player_current_power_up ? 32 : 20; - if ((uint16)(player_ypos - R2_W + 28) < R4_W) + uint16 r2w = 20; + uint16 r0w = PAIR16(cluster_spr_xpos_hi[k], cluster_spr_xpos_lo[k]); + if ((uint16)(player_xpos - r0w + 10) < r2w) { + r2w = PAIR16(cluster_spr_ypos_hi[k], cluster_spr_ypos_lo[k]) + 3; + uint16 r4w = player_current_power_up ? 32 : 20; + if ((uint16)(player_ypos - r2w + 28) < r4w) ClusterSpr06_SumoBroFlame_02F9F5(); } } diff --git a/src/smw_03.c b/src/smw_03.c index 7134b00..3beddcf 100644 --- a/src/smw_03.c +++ b/src/smw_03.c @@ -53,6 +53,316 @@ static FuncU8 *const kUnk_3cc29[7] = { &Spr029_KoopaKid_WendyLemmy_State06_SinkingInLava, }; +static const uint8 kSpr0AB_Rex_StompSounds[7] = { 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, }; +static const uint8 kSpr01B_Football_DATA_038007[7] = { 0xf0, 0xf8, 0xfc, 0x0, 0x4, 0x8, 0x10, }; +static const uint8 kSpr01B_Football_DATA_03800E[4] = { 0xa0, 0xd0, 0xc0, 0xd0, }; +static const uint8 kSpr0C5_BigBooBoss_XAcceleration[2] = { 0xff, 0x1, }; +static const uint8 kSpr0C5_BigBooBoss_MaxXSpeed[2] = { 0xf0, 0x10, }; +static const uint8 kSpr0C5_BigBooBoss_MaxYSpeed[2] = { 0xc, 0xf4, }; +static const uint8 kSpr0C5_BigBooBoss_YAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr0C5_BigBooBoss_DATA_038102[4] = { 0x1, 0x2, 0x2, 0x1, }; +static const uint8 kNormalSpriteBooGFXRt_BigBooXDisp[80] = { 0x8, 0x8, 0x20, 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, 0xfd, 0xc, 0xc, 0x27, 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x20, 0x20, 0x1f, 0x2e, 0x2e, 0x2c, 0x2c, 0xfb, 0x12, 0x12, 0x30, 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x20, 0x20, 0x1f, 0x2e, 0x2e, 0x2e, 0x2e, 0xf8, 0x11, 0xff, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, }; +static const uint8 kNormalSpriteBooGFXRt_BigBooYDisp[40] = { 0x12, 0x22, 0x18, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x18, 0x16, 0x16, 0x12, 0x22, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, 0x0, 0x10, 0x20, 0x30, }; +static const uint8 kNormalSpriteBooGFXRt_BigBooTiles[80] = { 0xc0, 0xe0, 0xe8, 0x80, 0xa0, 0xa0, 0x80, 0x82, 0xa2, 0xa2, 0x82, 0x84, 0xa4, 0xc4, 0xe4, 0x86, 0xa6, 0xc6, 0xe6, 0xe8, 0xc0, 0xe0, 0xe8, 0x80, 0xa0, 0xa0, 0x80, 0x82, 0xa2, 0xa2, 0x82, 0x84, 0xa4, 0xc4, 0xe4, 0x86, 0xa6, 0xc6, 0xe6, 0xe8, 0xc0, 0xe0, 0xe8, 0x80, 0xa0, 0xa0, 0x80, 0x82, 0xa2, 0xa2, 0x82, 0x84, 0xa4, 0xa4, 0x84, 0x86, 0xa6, 0xa6, 0x86, 0xe8, 0xe8, 0xe8, 0xc2, 0xe2, 0x80, 0xa0, 0xa0, 0x80, 0x82, 0xa2, 0xa2, 0x82, 0x84, 0xa4, 0xc4, 0xe4, 0x86, 0xa6, 0xc6, 0xe6, }; +static const uint8 kNormalSpriteBooGFXRt_BigBooProp[80] = { 0x0, 0x0, 0x40, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr0C4_GreyFallingPlatform_XDisp[4] = { 0x0, 0x10, 0x20, 0x30, }; +static const uint8 kSpr0C4_GreyFallingPlatform_Tiles[4] = { 0x60, 0x61, 0x61, 0x62, }; +static const uint8 kSpr0C2_Blurp_MaxYSpeed[2] = { 0x4, 0xfc, }; +static const uint8 kSpr0C2_Blurp_XSpeed[2] = { 0x8, 0xf8, }; +static const uint8 kSpr0C2_Blurp_YAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr0C3_PorcuPuffer_PorcuPuffAccel[2] = { 0x1, 0xff, }; +static const uint8 kSpr0C3_PorcuPuffer_PorcuPuffMaxSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0C3_PorcuPuffer_PocruPufferDispX[8] = { 0xf8, 0x8, 0xf8, 0x8, 0x8, 0xf8, 0x8, 0xf8, }; +static const uint8 kSpr0C3_PorcuPuffer_PocruPufferDispY[4] = { 0xf8, 0xf8, 0x8, 0x8, }; +static const uint8 kSpr0C3_PorcuPuffer_PocruPufferTiles[8] = { 0x86, 0xc0, 0xa6, 0xc2, 0x86, 0xc0, 0xa6, 0x8a, }; +static const uint8 kSpr0C3_PorcuPuffer_PocruPufferGfxProp[8] = { 0xd, 0xd, 0xd, 0xd, 0x4d, 0x4d, 0x4d, 0x4d, }; +static const uint8 kSpr0C1_WingedPlatform_FlyingBlockSpeedY[2] = { 0x8, 0xf8, }; +static const uint8 kSpr0C1_WingedPlatform_XDisp[10] = { 0x0, 0x10, 0x20, 0xf2, 0x2e, 0x0, 0x10, 0x20, 0xfa, 0x2e, }; +static const uint8 kSpr0C1_WingedPlatform_YDisp[10] = { 0x0, 0x0, 0x0, 0xf6, 0xf6, 0x0, 0x0, 0x0, 0xfe, 0xfe, }; +static const uint8 kSpr0C1_WingedPlatform_Tiles[10] = { 0x40, 0x40, 0x40, 0xc6, 0xc6, 0x40, 0x40, 0x40, 0x5d, 0x5d, }; +static const uint8 kSpr0C1_WingedPlatform_Prop[10] = { 0x32, 0x32, 0x32, 0x72, 0x32, 0x32, 0x32, 0x32, 0x72, 0x32, }; +static const uint8 kSpr0C1_WingedPlatform_TileSize[10] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, 0x0, }; +static const uint8 kSpr0C0_SinkingLavaPlatform_LavaPlatTiles[3] = { 0x85, 0x86, 0x85, }; +static const uint8 kSpr0C0_SinkingLavaPlatform_DATA_038737[3] = { 0x43, 0x3, 0x3, }; +static const uint8 kSpr0BF_MegaMole_MegaMoleSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0BF_MegaMole_TileDispX[8] = { 0x0, 0x10, 0x0, 0x10, 0x10, 0x0, 0x10, 0x0, }; +static const uint8 kSpr0BF_MegaMole_TileDispY[4] = { 0xf0, 0xf0, 0x0, 0x0, }; +static const uint8 kSpr0BF_MegaMole_Tiles[8] = { 0xc6, 0xc8, 0xe6, 0xe8, 0xca, 0xcc, 0xea, 0xec, }; +static const uint8 kSpr0BE_Swooper_Tiles[3] = { 0xae, 0xc0, 0xe8, }; +static const uint8 kSpr0BE_Swooper_MaxXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0BE_Swooper_XAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr0BD_SlidingNakedBlueKoopa_MaxXSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr0BD_SlidingNakedBlueKoopa_XAcceleration[2] = { 0x2, 0xfe, }; +static const uint8 kSpr0BC_BowserStatue_XSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0BC_BowserStatue_FireSpawnXDispXLo[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0BC_BowserStatue_FireSpawnXDispXHi[2] = { 0x0, 0xff, }; +static const uint8 kSpr0BC_BowserStatue_XDisp[6] = { 0x8, 0xf8, 0x0, 0x0, 0x8, 0x0, }; +static const uint8 kSpr0BC_BowserStatue_YDisp[3] = { 0x10, 0xf8, 0x0, }; +static const uint8 kSpr0BC_BowserStatue_Tiles[6] = { 0x56, 0x30, 0x41, 0x56, 0x30, 0x35, }; +static const uint8 kSpr0BC_BowserStatue_TileSize[3] = { 0x0, 0x2, 0x2, }; +static const uint8 kSpr0BC_BowserStatue_Prop[6] = { 0x0, 0x0, 0x0, 0x40, 0x40, 0x40, }; +static const uint8 kSpr0B7_CarrotTopLiftUpperRight_DATA_038BAA[128] = { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, }; +static const uint8 kSpr0B7_CarrotTopLiftUpperRight_DATA_038C2A[4] = { 0x0, 0xf8, 0x0, 0x8, }; +static const uint8 kSpr0B7_CarrotTopLiftUpperRight_XDisp[6] = { 0x10, 0x0, 0x10, 0x0, 0x10, 0x0, }; +static const uint8 kSpr0B7_CarrotTopLiftUpperRight_YDisp[6] = { 0x0, 0x10, 0x10, 0x0, 0x10, 0x10, }; +static const uint8 kSpr0B7_CarrotTopLiftUpperRight_Tiles[6] = { 0xe4, 0xe0, 0xe2, 0xe4, 0xe0, 0xe2, }; +static const uint8 kSpr0B7_CarrotTopLiftUpperRight_Prop[6] = { 0xb, 0xb, 0xb, 0x4b, 0x4b, 0x4b, }; +static const uint8 kSpr0B9_MessageBox_DATA_038D66[9] = { 0x0, 0x4, 0x7, 0x8, 0x8, 0x7, 0x4, 0x0, 0x0, }; +static const uint8 kSpr0BA_TimedPlatform_XDisp[3] = { 0x0, 0x10, 0xc, }; +static const uint8 kSpr0BA_TimedPlatform_YDisp[3] = { 0x0, 0x0, 0x4, }; +static const uint8 kSpr0BA_TimedPlatform_PlatformTiles[3] = { 0xc4, 0xc4, 0x0, }; +static const uint8 kSpr0BA_TimedPlatform_Prop[3] = { 0xb, 0x4b, 0xb, }; +static const uint8 kSpr0BA_TimedPlatform_TileSize[3] = { 0x2, 0x2, 0x0, }; +static const uint8 kSpr0BA_TimedPlatform_NumberTiles[4] = { 0xb6, 0xb5, 0xb4, 0xb3, }; +static const uint8 kSpr0BB_MovingCastleStone_XSpeed[4] = { 0x0, 0xf0, 0x0, 0x10, }; +static const uint8 kSpr0BB_MovingCastleStone_MovementTiming[4] = { 0x40, 0x50, 0x40, 0x50, }; +static const uint8 kSpr0BB_MovingCastleStone_XDisp[4] = { 0x0, 0x10, 0x0, 0x10, }; +static const uint8 kSpr0BB_MovingCastleStone_YDisp[4] = { 0x0, 0x0, 0x10, 0x10, }; +static const uint8 kSpr0BB_MovingCastleStone_Tiles[4] = { 0xcc, 0xce, 0xec, 0xee, }; +static const uint8 kSpr0B3_BowserStatueFire_XSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0B3_BowserStatueFire_XDisp[4] = { 0x8, 0x0, 0x0, 0x8, }; +static const uint8 kSpr0B3_BowserStatueFire_Tiles[8] = { 0x32, 0x50, 0x33, 0x34, 0x32, 0x50, 0x33, 0x34, }; +static const uint8 kSpr0B3_BowserStatueFire_Prop[8] = { 0x9, 0x9, 0x9, 0x9, 0x89, 0x89, 0x89, 0x89, }; +static const uint8 kSprXXX_ReflectingEnemy_BooStreamTiles[8] = { 0x88, 0x8c, 0x8e, 0xa8, 0xaa, 0xae, 0x88, 0x8c, }; +static const uint8 kSpr0AE_FishinBoo_XAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr0AE_FishinBoo_MaxXSpeed[2] = { 0x20, 0xe0, }; +static const uint8 kSpr0AE_FishinBoo_YAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr0AE_FishinBoo_MaxYSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0AE_FishinBoo_DATA_0390EB[4] = { 0x1a, 0x14, 0xee, 0xf8, }; +static const uint8 kSpr0AE_FishinBoo_DATA_0390EF[4] = { 0x0, 0x0, 0xff, 0xff, }; +static const uint8 kSpr0AE_FishinBoo_XDisp[40] = { 0xfb, 0x5, 0x0, 0xf2, 0xfd, 0x3, 0xea, 0xea, 0xea, 0xea, 0xfb, 0x5, 0x0, 0xfa, 0xfd, 0x3, 0xf2, 0xf2, 0xf2, 0xf2, 0xfb, 0x5, 0x0, 0xe, 0x3, 0xfd, 0x16, 0x16, 0x16, 0x16, 0xfb, 0x5, 0x0, 0x6, 0x3, 0xfd, 0xe, 0xe, 0xe, 0xe, }; +static const uint8 kSpr0AE_FishinBoo_YDisp[10] = { 0xb, 0xb, 0x0, 0x3, 0xf, 0xf, 0x13, 0x23, 0x33, 0x43, }; +static const uint8 kSpr0AE_FishinBoo_Tiles1[10] = { 0x60, 0x60, 0x64, 0x8a, 0x60, 0x60, 0xac, 0xac, 0xac, 0xce, }; +static const uint8 kSpr0AE_FishinBoo_Prop[10] = { 0x4, 0x4, 0xd, 0x9, 0x4, 0x4, 0xd, 0xd, 0xd, 0x7, }; +static const uint8 kSpr0AE_FishinBoo_Tiles2[4] = { 0xcc, 0xce, 0xcc, 0xce, }; +static const uint8 kSpr0AE_FishinBoo_DATA_039178[4] = { 0x0, 0x0, 0x40, 0x40, }; +static const uint8 kSpr0AE_FishinBoo_DATA_03917C[4] = { 0x0, 0x40, 0xc0, 0x80, }; +static const uint8 kSpr0B1_CreateEatBlock_XSpeed[5] = { 0x10, 0xf0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr0B1_CreateEatBlock_YSpeed[5] = { 0x0, 0x0, 0x10, 0xf0, 0x0, }; +static const uint8 kSpr0B1_CreateEatBlock_DATA_039279[11] = { 0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, }; +static const uint8 kSpr0B1_CreateEatBlock_SubmapMovementData[75] = { 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0xf0, 0xf0, 0x20, 0x12, 0x10, 0x12, 0x10, 0x12, 0x10, 0x12, 0x10, 0x12, 0x10, 0x12, 0x10, 0x12, 0xd0, 0xc3, 0xf1, 0x21, 0x22, 0xf1, 0xf1, 0x51, 0x43, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0xf0, 0xf0, 0xf0, 0x60, 0x32, 0x60, 0x32, 0x71, 0x32, 0x60, 0x32, 0x61, 0x32, 0x70, 0x33, 0x10, 0x33, 0x10, 0x33, 0x10, 0x33, 0x10, 0x33, 0xf0, 0x10, 0xf2, 0x52, 0xff, }; +static const uint8 kSpr0B1_CreateEatBlock_MainMapMovementData[52] = { 0x80, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x60, 0x23, 0x20, 0x23, 0xb0, 0x22, 0xa1, 0x22, 0xa0, 0x22, 0xa1, 0x22, 0xc0, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0x10, 0x13, 0xf0, 0xf0, 0xf0, 0x52, 0x50, 0x33, 0x50, 0x32, 0x50, 0x33, 0x50, 0x22, 0x50, 0x33, 0xf0, 0x50, 0x82, 0xff, }; +static const uint8 kSpr0AC_DownFirstWoodenSpike_DATA_039484[2] = { 0x1, 0xff, }; +static const uint8 kSpr0AC_DownFirstWoodenSpike_DATA_039486[2] = { 0x0, 0xff, }; +static const uint8 kSpr0AC_DownFirstWoodenSpike_YDisp[10] = { 0x0, 0x10, 0x20, 0x30, 0x40, 0x40, 0x30, 0x20, 0x10, 0x0, }; +static const uint8 kSpr0AC_DownFirstWoodenSpike_Tiles[10] = { 0x6a, 0x6a, 0x6a, 0x6a, 0x4a, 0x6a, 0x6a, 0x6a, 0x6a, 0x4a, }; +static const uint8 kSpr0AC_DownFirstWoodenSpike_Prop[10] = { 0x81, 0x81, 0x81, 0x81, 0x81, 0x1, 0x1, 0x1, 0x1, 0x1, }; +static const uint8 kSpr0AB_Rex_XSpeed[4] = { 0x8, 0xf8, 0x10, 0xf0, }; +static const uint8 kSpr0AB_Rex_RexKilledSpeed[2] = { 0xf0, 0x10, }; +static const uint8 kSpr0AB_Rex_XDisp[24] = { 0xfc, 0x0, 0xfc, 0x0, 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x4, 0x0, 0x4, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, }; +static const uint8 kSpr0AB_Rex_YDisp[12] = { 0xf1, 0x0, 0xf0, 0x0, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, }; +static const uint8 kSpr0AB_Rex_Tiles[12] = { 0x8a, 0xaa, 0x8a, 0xac, 0x8a, 0xaa, 0x8c, 0x8c, 0xa8, 0xa8, 0xa2, 0xb2, }; +static const uint8 kSpr0AB_Rex_Prop[2] = { 0x47, 0x7, }; +static const uint8 kSpr0AA_Fishbone_MaxXSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0AA_Fishbone_XAcceleration[2] = { 0x1, 0xff, }; +static const uint8 kSpr0AA_Fishbone_XDisp[4] = { 0xf8, 0xf8, 0x10, 0x10, }; +static const uint8 kSpr0AA_Fishbone_YDisp[2] = { 0x0, 0x8, }; +static const uint8 kSpr0AA_Fishbone_Prop[4] = { 0x4d, 0xcd, 0xd, 0x8d, }; +static const uint8 kSpr0AA_Fishbone_TailTiles[4] = { 0xa3, 0xa3, 0xb3, 0xb3, }; +static const uint8 kSpr0A9_Reznor_ReznorStartPosLo[4] = { 0x0, 0x80, 0x0, 0x80, }; +static const uint8 kSpr0A9_Reznor_ReznorStartPosHi[4] = { 0x0, 0x0, 0x1, 0x1, }; +static const uint8 kSpr0A9_Reznor_ReboundSpeedX[2] = { 0x20, 0xe0, }; +static const uint8 kSpr0A9_Reznor_XDisp[8] = { 0x0, 0xf0, 0x0, 0xf0, 0xf0, 0x0, 0xf0, 0x0, }; +static const uint8 kSpr0A9_Reznor_YDisp[4] = { 0xe0, 0xe0, 0xf0, 0xf0, }; +static const uint8 kSpr0A9_Reznor_Tiles[12] = { 0x40, 0x42, 0x60, 0x62, 0x44, 0x46, 0x64, 0x66, 0x28, 0x28, 0x48, 0x48, }; +static const uint8 kSpr0A9_Reznor_Prop[12] = { 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x7f, 0x3f, 0x7f, 0x3f, }; +static const uint8 kSpr0A9_Reznor_PlatformYDisp[8] = { 0x0, 0x3, 0x4, 0x5, 0x5, 0x4, 0x3, 0x0, }; +static const uint8 kSpr06F_DinoTorch_DATA_039C6E[3] = { 0x0, 0xfe, 0x2, }; +static const uint8 kSpr06F_DinoTorch_DATA_039C71[3] = { 0x0, 0xff, 0x0, }; +static const uint8 kSpr06F_DinoTorch_XSpeed[4] = { 0x8, 0xf8, 0x10, 0xf0, }; +static const uint8 kSpr06F_DinoTorch_DinoFlameTable[64] = { 0x41, 0x42, 0x42, 0x32, 0x22, 0x12, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x12, 0x22, 0x32, 0x42, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x43, 0x43, 0x33, 0x23, 0x13, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x13, 0x23, 0x33, 0x43, 0x43, 0x43, 0x43, 0x41, 0x41, }; +static const uint8 kSpr06F_DinoTorch_DinoFlame1[4] = { 0xdc, 0x2, 0x10, 0x2, }; +static const uint8 kSpr06F_DinoTorch_DinoFlame2[4] = { 0xff, 0x0, 0x0, 0x0, }; +static const uint8 kSpr06F_DinoTorch_DinoFlame3[4] = { 0x24, 0xc, 0x24, 0xc, }; +static const uint8 kSpr06F_DinoTorch_DinoFlame4[4] = { 0x2, 0xdc, 0x2, 0xdc, }; +static const uint8 kSpr06F_DinoTorch_DinoFlame5[4] = { 0x0, 0xff, 0x0, 0xff, }; +static const uint8 kSpr06F_DinoTorch_DinoFlame6[4] = { 0xc, 0x24, 0xc, 0x24, }; +static const uint8 kSpr06F_DinoTorch_DinoTorchXDisp[10] = { 0xd8, 0xe0, 0xec, 0xf8, 0x0, 0xff, 0xff, 0xff, 0xff, 0x0, }; +static const uint8 kSpr06F_DinoTorch_DinoTorchYDisp[10] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0xd8, 0xe0, 0xec, 0xf8, 0x0, }; +static const uint8 kSpr06F_DinoTorch_DinoFlameTiles[10] = { 0x80, 0x82, 0x84, 0x86, 0x0, 0x88, 0x8a, 0x8c, 0x8e, 0x0, }; +static const uint8 kSpr06F_DinoTorch_DinoTorchProp[5] = { 0x9, 0x5, 0x5, 0x5, 0xf, }; +static const uint8 kSpr06F_DinoTorch_DinoTorchTiles[4] = { 0xea, 0xaa, 0xc4, 0xc6, }; +static const uint8 kSpr06F_DinoTorch_DinoRhinoXDisp[8] = { 0xf8, 0x8, 0xf8, 0x8, 0x8, 0xf8, 0x8, 0xf8, }; +static const uint8 kSpr06F_DinoTorch_DinoRhinoProp[8] = { 0x2f, 0x2f, 0x2f, 0x2f, 0x6f, 0x6f, 0x6f, 0x6f, }; +static const uint8 kSpr06F_DinoTorch_DinoRhinoYDisp[4] = { 0xf0, 0xf0, 0x0, 0x0, }; +static const uint8 kSpr06F_DinoTorch_DinoRhinoTiles[16] = { 0xc0, 0xc2, 0xe4, 0xe6, 0xc0, 0xc2, 0xe0, 0xe2, 0xc8, 0xca, 0xe8, 0xe2, 0xcc, 0xce, 0xec, 0xee, }; +static const uint8 kSpr06F_DinoTorch_DinoTilesWritten[5] = { 0x4, 0x3, 0x2, 0x1, 0x0, }; +static const uint8 kSpr0A8_Blargg_XSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0A8_Blargg_XDisp[10] = { 0xf8, 0x8, 0xf8, 0x8, 0x18, 0x8, 0xf8, 0x8, 0xf8, 0xe8, }; +static const uint8 kSpr0A8_Blargg_YDisp[5] = { 0xf8, 0xf8, 0x8, 0x8, 0x8, }; +static const uint8 kSpr0A8_Blargg_Tiles[10] = { 0xa2, 0xa4, 0xc2, 0xc4, 0xa6, 0xa2, 0xa4, 0xe6, 0xc8, 0xa6, }; +static const uint8 kSpr0A8_Blargg_Prop[2] = { 0x45, 0x5, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A265[20] = { 0x4, 0x3, 0x2, 0x1, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, }; +static const uint8 kSpr0A0_ActivateBowserBattle_SmokeXDisp[72] = { 0xd5, 0xdd, 0x23, 0x2b, 0xd5, 0xdd, 0x23, 0x2b, 0xd5, 0xdd, 0x23, 0x2b, 0xd5, 0xdd, 0x23, 0x2b, 0xd6, 0xde, 0x22, 0x2a, 0xd6, 0xde, 0x22, 0x2a, 0xd7, 0xdf, 0x21, 0x29, 0xd7, 0xdf, 0x21, 0x29, 0xd8, 0xe0, 0x20, 0x28, 0xd8, 0xe0, 0x20, 0x28, 0xda, 0xe2, 0x1e, 0x26, 0xda, 0xe2, 0x1e, 0x26, 0xdc, 0xe4, 0x1c, 0x24, 0xdc, 0xe4, 0x1c, 0x24, 0xe0, 0xe8, 0x18, 0x20, 0xe0, 0xe8, 0x18, 0x20, 0xe8, 0xf0, 0x10, 0x18, 0xe8, 0xf0, 0x10, 0x18, }; +static const uint8 kSpr0A0_ActivateBowserBattle_SmokeYDisp[72] = { 0xdd, 0xd5, 0xd5, 0xdd, 0x23, 0x2b, 0x2b, 0x23, 0xdd, 0xd5, 0xd5, 0xdd, 0x23, 0x2b, 0x2b, 0x23, 0xde, 0xd6, 0xd6, 0xde, 0x22, 0x2a, 0x2a, 0x22, 0xdf, 0xd7, 0xd7, 0xdf, 0x21, 0x29, 0x29, 0x21, 0xe0, 0xd8, 0xd8, 0xe0, 0x20, 0x28, 0x28, 0x20, 0xe2, 0xda, 0xda, 0xe2, 0x1e, 0x26, 0x26, 0x1e, 0xe4, 0xdc, 0xdc, 0xe4, 0x1c, 0x24, 0x24, 0x1c, 0xe8, 0xe0, 0xe0, 0xe8, 0x18, 0x20, 0x20, 0x18, 0xf0, 0xe8, 0xe8, 0xf0, 0x10, 0x18, 0x18, 0x10, }; +static const uint8 kSpr0A0_ActivateBowserBattle_SmokeProp[8] = { 0x80, 0x40, 0x0, 0xc0, 0x0, 0xc0, 0x80, 0x40, }; +static const uint8 kSpr0A0_ActivateBowserBattle_SmokeTiles[9] = { 0xe3, 0xed, 0xed, 0xeb, 0xeb, 0xe9, 0xe9, 0xe7, 0xe7, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DuckingAnimationFrames[10] = { 0x0, 0x0, 0x0, 0x0, 0x2, 0x4, 0x6, 0x8, 0xa, 0xe, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A490[2] = { 0xff, 0x1, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A492[2] = { 0xc8, 0x38, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A494[2] = { 0x1, 0xff, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A496[2] = { 0x1c, 0xe4, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A498[4] = { 0x0, 0x2, 0x4, 0x2, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A4EB[2] = { 0x80, 0x0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A52D[64] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x4, 0x6, 0x8, 0xa, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xe, 0xa, 0x8, 0x6, 0x4, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A56D[64] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x80, 0xa0, 0xc0, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x80, 0x60, 0x40, 0x30, 0x20, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A64D[20] = { 0x0, 0x0, 0x0, 0x0, 0xfc, 0xf8, 0xf4, 0xf0, 0xf4, 0xf8, 0xfc, 0x0, 0x4, 0x8, 0xc, 0x10, 0xc, 0x8, 0x4, 0x0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A6F0[8] = { 0xe, 0xe, 0xa, 0x8, 0x6, 0x4, 0x2, 0x0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A71F[2] = { 0x1, 0xff, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A721[2] = { 0x10, 0x80, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A723[2] = { 0x7, 0x3, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A725[2] = { 0xff, 0x1, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A727[2] = { 0xf0, 0x8, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A729[2] = { 0x1, 0xff, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A72B[2] = { 0x3, 0x3, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A72D[2] = { 0x60, 0x2, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A72F[2] = { 0x1, 0x1, }; +static const uint8 kSpr0A0_ActivateBowserBattle_RainingFireSounds[10] = { 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x19, 0x1A }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03A8BE[24] = { 0x0, 0x0, 0x0, 0x8, 0x10, 0x14, 0x14, 0x16, 0x16, 0x18, 0x18, 0x17, 0x16, 0x16, 0x17, 0x18, 0x18, 0x17, 0x14, 0x10, 0xc, 0x8, 0x4, 0x0, }; +static const uint8 kSpr07C_PrincessPeach_PeachXDisp[80] = { 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, }; +static const uint8 kSpr07C_PrincessPeach_PeachYDisp[80] = { 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, 0x0, 0x0, 0x10, 0x10, }; +static const uint8 kSpr07C_PrincessPeach_PeachTiles[80] = { 0x5, 0x6, 0x15, 0x16, 0x9d, 0x9e, 0x4e, 0xae, 0x6, 0x5, 0x16, 0x15, 0x9e, 0x9d, 0xae, 0x4e, 0x8a, 0x8b, 0xaa, 0x68, 0x83, 0x84, 0xaa, 0x68, 0x8a, 0x8b, 0x80, 0x81, 0x83, 0x84, 0x80, 0x81, 0x85, 0x86, 0xa5, 0xa6, 0x83, 0x84, 0xa5, 0xa6, 0x82, 0x83, 0xa2, 0xa3, 0x82, 0x83, 0xa2, 0xa3, 0x8a, 0x8b, 0xaa, 0x68, 0x83, 0x84, 0xaa, 0x68, 0x8a, 0x8b, 0x80, 0x81, 0x83, 0x84, 0x80, 0x81, 0x85, 0x86, 0xa5, 0xa6, 0x83, 0x84, 0xa5, 0xa6, 0x82, 0x83, 0xa2, 0xa3, 0x82, 0x83, 0xa2, 0xa3, }; +static const uint8 kSpr07C_PrincessPeach_PeachProp[80] = { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x40, 0x40, 0x40, 0x40, 0x41, 0x41, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AB15[2] = { 0x1, 0xff, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AB17[2] = { 0x20, 0xe0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AB19[2] = { 0x2, 0xfe, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AB1B[6] = { 0x20, 0xe0, 0x1, 0xff, 0x10, 0xf0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AB62[2] = { 0x10, 0xf0, }; +static const uint8 kSpr07C_PrincessPeach_BlushYDisp[2] = { 0x1, 0x11, }; +static const uint8 kSpr07C_PrincessPeach_BlushTiles[2] = { 0x6e, 0x88, }; +static const uint8 kSpr07C_PrincessPeach_XSpeed[4] = { 0x8, 0xf8, 0xf8, 0x8, }; +static const uint8 kSpr07C_PrincessPeach_DATA_03AE5B[84] = { 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x18, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x20, 0x8, 0x8, 0x8, 0x8, 0x8, 0x20, 0x8, 0x8, 0x10, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x20, 0x8, 0x8, 0x8, 0x8, 0x8, 0x20, 0x8, 0x4, 0x20, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x10, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x10, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x40, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AF34[8] = { 0xf4, 0xff, 0xc, 0x19, 0x24, 0x19, 0xc, 0xff, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AF3C[8] = { 0xfc, 0xf6, 0xf4, 0xf6, 0xfc, 0x2, 0x4, 0x2, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AF44[8] = { 0x5, 0x5, 0x5, 0x5, 0x45, 0x45, 0x45, 0x45, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03AF4C[13] = { 0x34, 0x34, 0x34, 0x35, 0x35, 0x36, 0x36, 0x37, 0x38, 0x3a, 0x3e, 0x46, 0x54, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03B013[2] = { 0x0, 0x10, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03B015[2] = { 0x0, 0x0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03B017[2] = { 0xf8, 0x8, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03B074[2] = { 0x40, 0xc0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_DATA_03B076[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0A1_BowserBowlingBall_XSpeed[2] = { 0x10, 0xf0, }; +static const uint8 kSpr0A1_BowserBowlingBall_XDisp[12] = { 0xf0, 0x0, 0x10, 0xf0, 0x0, 0x10, 0xf0, 0x0, 0x10, 0x0, 0x0, 0xf8, }; +static const uint8 kSpr0A1_BowserBowlingBall_YDisp[12] = { 0xe2, 0xe2, 0xe2, 0xf2, 0xf2, 0xf2, 0x2, 0x2, 0x2, 0x2, 0x2, 0xea, }; +static const uint8 kSpr0A1_BowserBowlingBall_Tiles[12] = { 0x45, 0x47, 0x45, 0x65, 0x66, 0x65, 0x45, 0x47, 0x45, 0x39, 0x38, 0x63, }; +static const uint8 kSpr0A1_BowserBowlingBall_Prop[12] = { 0xd, 0xd, 0x4d, 0xd, 0xd, 0x4d, 0x8d, 0x8d, 0xcd, 0xd, 0xd, 0xd, }; +static const uint8 kSpr0A1_BowserBowlingBall_TileSize[12] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, 0x0, 0x2, }; +static const uint8 kSpr0A1_BowserBowlingBall_XDisp2[8] = { 0x4, 0xd, 0x10, 0xd, 0x4, 0xfb, 0xf8, 0xfb, }; +static const uint8 kSpr0A1_BowserBowlingBall_YDisp2[8] = { 0x0, 0xfd, 0xf4, 0xeb, 0xe8, 0xeb, 0xf4, 0xfd, }; +static const uint8 kSpr0A2_MechaKoopa_XSpeed[2] = { 0x8, 0xf8, }; +static const uint8 kSpr0A2_MechaKoopa_MechakoopaXDisp[8] = { 0xf8, 0x8, 0xf8, 0x0, 0x8, 0x0, 0x10, 0x0, }; +static const uint8 kSpr0A2_MechaKoopa_MechakoopaYDisp[24] = { 0xf8, 0xf8, 0x8, 0x0, 0xf9, 0xf9, 0x9, 0x0, 0xf8, 0xf8, 0x8, 0x0, 0xf9, 0xf9, 0x9, 0x0, 0xfd, 0x0, 0x5, 0x0, 0x0, 0x0, 0x8, 0x0, }; +static const uint8 kSpr0A2_MechaKoopa_MechakoopaTiles[24] = { 0x40, 0x42, 0x60, 0x51, 0x40, 0x42, 0x60, 0xa, 0x40, 0x42, 0x60, 0xc, 0x40, 0x42, 0x60, 0xe, 0x0, 0x2, 0x10, 0x1, 0x0, 0x2, 0x10, 0x1, }; +static const uint8 kSpr0A2_MechaKoopa_MechakoopaProp[8] = { 0x0, 0x0, 0x0, 0x0, 0x40, 0x40, 0x40, 0x40, }; +static const uint8 kSpr0A2_MechaKoopa_MechakoopaTileSize[4] = { 0x2, 0x0, 0x0, 0x2, }; +static const uint8 kSpr0A2_MechaKoopa_MechakoopaPalette[2] = { 0xb, 0x5, }; +static const uint8 kSpr0A2_MechaKoopa_KeyXDisp[2] = { 0xf9, 0xf, }; +static const uint8 kSpr0A2_MechaKoopa_KeyProp[2] = { 0x4d, 0xd, }; +static const uint8 kSpr0A2_MechaKoopa_KeyTiles[4] = { 0x70, 0x71, 0x72, 0x71, }; +static const uint8 kSpr0A0_ActivateBowserBattle_ItemBoxXPos[4] = { 0x70, 0x80, 0x70, 0x80, }; +static const uint8 kSpr0A0_ActivateBowserBattle_ItemBoxYPos[4] = { 0x7, 0x7, 0x17, 0x17, }; +static const uint8 kSpr0A0_ActivateBowserBattle_ItemBoxProp[4] = { 0x37, 0x77, 0xb7, 0xf7, }; +static const uint8 kSpr0A0_ActivateBowserBattle_RoofXPos[16] = { 0x0, 0x30, 0x60, 0x90, 0xc0, 0xf0, 0x0, 0x30, 0x40, 0x50, 0x60, 0x90, 0xa0, 0xb0, 0xc0, 0xf0, }; +static const uint8 kSpr0A0_ActivateBowserBattle_RoofYPos[16] = { 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, }; +static const uint8 kStandardSpriteToSpriteCollisionChecks_SprClippingDispX[60] = { 0x2, 0x2, 0x10, 0x14, 0x0, 0x0, 0x1, 0x8, 0xf8, 0xfe, 0x3, 0x6, 0x1, 0x0, 0x6, 0x2, 0x0, 0xe8, 0xfc, 0xfc, 0x4, 0x0, 0xfc, 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, 0x2, 0xe0, 0xf0, 0xfc, 0xfc, 0x0, 0xf8, 0xf4, 0xf2, 0x0, 0xfc, 0xf2, 0xf0, 0x2, 0x0, 0xf8, 0x4, 0x2, 0x2, 0x8, 0x0, 0x0, 0x0, 0xfc, 0x3, 0x8, 0x0, 0x8, 0x4, 0xf8, 0x0, }; +static const uint8 kStandardSpriteToSpriteCollisionChecks_SprClippingWidth[60] = { 0xc, 0xc, 0x10, 0x8, 0x30, 0x50, 0xe, 0x28, 0x20, 0x14, 0x1, 0x3, 0xd, 0xf, 0x14, 0x24, 0xf, 0x40, 0x8, 0x8, 0x18, 0xf, 0x18, 0xc, 0xc, 0xc, 0xc, 0xc, 0xa, 0x1c, 0x30, 0x30, 0x8, 0x8, 0x10, 0x20, 0x38, 0x3c, 0x20, 0x18, 0x1c, 0x20, 0xc, 0x10, 0x10, 0x8, 0x1c, 0x1c, 0x10, 0x30, 0x30, 0x40, 0x8, 0x12, 0x34, 0xf, 0x20, 0x8, 0x20, 0x10, }; +static const uint8 kStandardSpriteToSpriteCollisionChecks_SprClippingDispY[60] = { 0x3, 0x3, 0xfe, 0x8, 0xfe, 0xfe, 0x2, 0x8, 0xfe, 0x8, 0x7, 0x6, 0xfe, 0xfc, 0x6, 0xfe, 0xfe, 0xe8, 0x10, 0x10, 0x2, 0xfe, 0xf4, 0x8, 0x13, 0x23, 0x33, 0x43, 0xa, 0xfd, 0xf8, 0xfc, 0xe8, 0x10, 0x0, 0xe8, 0x20, 0x4, 0x58, 0xfc, 0xe8, 0xfc, 0xf8, 0x2, 0xf8, 0x4, 0xfe, 0xfe, 0xf2, 0xfe, 0xfe, 0xfe, 0xfc, 0x0, 0x8, 0xf8, 0x10, 0x3, 0x10, 0x0, }; +static const uint8 kStandardSpriteToSpriteCollisionChecks_SprClippingHeight[60] = { 0xa, 0x15, 0x12, 0x8, 0xe, 0xe, 0x18, 0x30, 0x10, 0x1e, 0x2, 0x3, 0x16, 0x10, 0x14, 0x12, 0x20, 0x40, 0x34, 0x74, 0xc, 0xe, 0x18, 0x45, 0x3a, 0x2a, 0x1a, 0xa, 0x30, 0x1b, 0x20, 0x12, 0x18, 0x18, 0x10, 0x20, 0x38, 0x14, 0x8, 0x18, 0x28, 0x1b, 0x13, 0x4c, 0x10, 0x4, 0x22, 0x20, 0x1c, 0x12, 0x12, 0x12, 0x8, 0x20, 0x2e, 0x14, 0x28, 0xa, 0x10, 0xd, }; +static const uint8 kStandardSpriteToSpriteCollisionChecks_MarioClipDispY[4] = { 0x6, 0x14, 0x10, 0x18, }; +static const uint8 kStandardSpriteToSpriteCollisionChecks_MarioClippingHeight[4] = { 0x1a, 0xc, 0x20, 0x18, }; +static const uint8 kGetDrawInfo_DATA_03B75C[2] = { 0xc, 0x1c, }; +static const uint8 kGetDrawInfo_DATA_03B75E[2] = { 0x1, 0x2, }; +static const uint8 kSpr0A1_BowserBowlingBall_BounceYSpeed[38] = { 0x0, 0x0, 0x0, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xe8, 0xe8, 0xe8, 0xe8, 0x0, 0x0, 0x0, 0x0, 0xfe, 0xfc, 0xf8, 0xec, 0xec, 0xec, 0xe8, 0xe4, 0xe0, 0xdc, 0xd8, 0xd4, 0xd0, 0xcc, 0xc8, }; +static const uint8 kSubOffscreen_Bank03[2] = { 0x40, 0xb0, }; +static const uint8 kSubOffscreen_Bank03_DATA_03B83D[2] = { 0x1, 0xff, }; +static const uint8 kSubOffscreen_Bank03_DATA_03B83F[8] = { 0x30, 0xc0, 0xa0, 0x80, 0xa0, 0x40, 0x60, 0xb0, }; +static const uint8 kSubOffscreen_Bank03_DATA_03B847[8] = { 0x1, 0xff, 0x1, 0xff, 0x1, 0x0, 0x1, 0xff, }; +const uint16 kSpr01F_MagiKoopa_MagiKoopaFadePalettes[64] = { 0x7fff, 0x294a, 0x0, 0x1400, 0x2000, 0x7e92, 0xa, 0x2a, 0x7fff, 0x35ad, 0x0, 0x2400, 0x2c00, 0x722f, 0xd, 0xad, 0x7fff, 0x4210, 0x0, 0x3000, 0x3800, 0x65cc, 0x50, 0x110, 0x7fff, 0x4e73, 0x0, 0x3c00, 0x4441, 0x5969, 0xb3, 0x173, 0x7fff, 0x5ad6, 0x0, 0x4800, 0x50a4, 0x4d06, 0x116, 0x1d6, 0x7fff, 0x6739, 0x0, 0x5442, 0x5d07, 0x40a3, 0x179, 0x239, 0x7fff, 0x739c, 0x0, 0x60a5, 0x696a, 0x3440, 0x1dc, 0x29c, 0x7fff, 0x7fff, 0x0, 0x6d08, 0x75cd, 0x2800, 0x23f, 0x2ff, }; +static const uint16 kBooFadePalettes[64] = { 0x7fff, 0xc63, 0x0, 0xc00, 0xc00, 0xc00, 0xc00, 0x3, 0x7fff, 0x1ce7, 0x0, 0x1c00, 0x1c00, 0x1c20, 0x1c81, 0x7, 0x7fff, 0x2d6b, 0x0, 0x2c00, 0x2c40, 0x2ca2, 0x2d05, 0xb, 0x7fff, 0x3def, 0x0, 0x3c60, 0x3cc3, 0x3d26, 0x3d89, 0xf, 0x7fff, 0x4e73, 0x0, 0x4ce4, 0x4d47, 0x4daa, 0x4e0d, 0x1013, 0x7fff, 0x5ef7, 0x0, 0x5d68, 0x5dcb, 0x5e2e, 0x5e91, 0x2017, 0x7fff, 0x6f7b, 0x0, 0x6dec, 0x6e4f, 0x6eb2, 0x6f15, 0x301b, 0x7fff, 0x7fff, 0x0, 0x7e70, 0x7ed3, 0x7f36, 0x7f99, 0x401f, }; +static const uint8 kCheckIfBabyYoshiCanEatNormalSprite_ChangingItemSpriteType[4] = { 0x74, 0x75, 0x77, 0x76, }; +static const uint8 kGameMode14_InLevel_DATA_03C0B2[4] = { 0x68, 0x6a, 0x6c, 0x6e, }; +// oob +static const uint8 kGameMode14_InLevel_DATA_03C0B6[20] = { 0x0, 0x3, 0x1, 0x2, 0x4, 0x2, 0x0, 0x1, 0x0, 0x4, 0x0, 0x2, 0x0, 0x3, 0x4, 0x1, +0xa5, 0x9d, 0xd0, 0x03}; +static const uint8 kGameMode14_InLevel_IggyPlatSpeed[4] = { 0xff, 0x1, 0xff, 0x1, }; +static const uint8 kGameMode14_InLevel_DATA_03C116[4] = { 0xff, 0x0, 0xff, 0x0, }; +static const uint8 kGameMode14_InLevel_IggyPlatBounds[4] = { 0xe7, 0x18, 0xd7, 0x28, }; +static const uint8 kHandleNormalSpriteLevelColl_DATA_03C1C6[2] = { 0x2, 0xfe, }; +static const uint8 kHandleNormalSpriteLevelColl_DATA_03C1C8[2] = { 0x0, 0xff, }; +static const uint8 kSpr0C8_LightSwitch_DATA_03C1EC[9] = { 0x0, 0x4, 0x7, 0x8, 0x8, 0x7, 0x4, 0x0, 0x0, }; +static const uint8 kSprXXX_LineGuided_MotorTiles[4] = { 0xe0, 0xc2, 0xc0, 0xc2, }; +static const uint8 kSprXXX_LineGuided_YDisp[2] = { 0xf2, 0xe, }; +static const uint8 kSprXXX_LineGuided_Prop[2] = { 0x33, 0xb3, }; +static const uint8 kSpr051_Ninji_YSpeed[4] = { 0xd0, 0xc0, 0xb0, 0xd0, }; +static const uint8 kSpr030_ThrowingDryBones_DryBonesTileXDisp[12] = { 0x0, 0x8, 0x0, 0x0, 0xf8, 0x0, 0x0, 0x4, 0x0, 0x0, 0xfc, 0x0, }; +static const uint8 kSpr030_ThrowingDryBones_DryBonesGfxProp[6] = { 0x43, 0x43, 0x43, 0x3, 0x3, 0x3, }; +static const uint8 kSpr030_ThrowingDryBones_DryBonesTileYDisp[9] = { 0xf4, 0xf0, 0x0, 0xf4, 0xf1, 0x0, 0xf4, 0xf0, 0x0, }; +static const uint8 kSpr030_ThrowingDryBones_DryBonesTiles[9] = { 0x0, 0x64, 0x66, 0x0, 0x64, 0x68, 0x82, 0x64, 0xe6, }; +static const uint8 kSpr030_ThrowingDryBones_DATA_03C3D7[3] = { 0x0, 0x0, 0xff, }; +static const uint8 kSpr0C6_Spotlight_DATA_03C48F[2] = { 0x1, 0xff, }; +static const uint8 kSpr0C6_Spotlight_DATA_03C491[2] = { 0xff, 0x90, }; +static const uint8 kSpr0C6_Spotlight_Tiles[9] = { 0x80, 0x82, 0x84, 0x86, 0x88, 0x8c, 0xc0, 0xc2, 0xc2, }; +static const uint8 kSpr0C6_Spotlight_Prop[9] = { 0x31, 0x33, 0x35, 0x37, 0x31, 0x33, 0x35, 0x37, 0x39, }; +static const uint8 kSpr0C6_Spotlight_DATA_03C4D8[2] = { 0x10, 0x8c, }; +static const uint8 kSpr0C6_Spotlight_DATA_03C4DA[2] = { 0x42, 0x31, }; +static const uint8 kSpr07A_Fireworks_DATA_03C626[84] = { 0x14, 0x28, 0x38, 0x20, 0x30, 0x4c, 0x40, 0x34, 0x2c, 0x1c, 0x8, 0xc, 0x4, 0xc, 0x1c, 0x24, 0x2c, 0x38, 0x40, 0x48, 0x50, 0x5c, 0x5c, 0x6c, 0x4c, 0x58, 0x24, 0x78, 0x64, 0x70, 0x78, 0x7c, 0x70, 0x68, 0x58, 0x4c, 0x40, 0x34, 0x24, 0x4, 0x18, 0x2c, 0xc, 0xc, 0x14, 0x18, 0x1c, 0x24, 0x2c, 0x28, 0x24, 0x30, 0x30, 0x34, 0x38, 0x3c, 0x44, 0x54, 0x48, 0x5c, 0x68, 0x40, 0x4c, 0x40, 0x3c, 0x40, 0x50, 0x54, 0x60, 0x54, 0x4c, 0x5c, 0x5c, 0x68, 0x74, 0x6c, 0x7c, 0x78, 0x68, 0x80, 0x18, 0x48, 0x2c, 0x1c, }; +static const uint8 kSpr07A_Fireworks_DATA_03C67A[84] = { 0x1c, 0xc, 0x8, 0x1c, 0x14, 0x8, 0x14, 0x24, 0x28, 0x2c, 0x30, 0x3c, 0x44, 0x4c, 0x44, 0x34, 0x40, 0x34, 0x24, 0x1c, 0x10, 0xc, 0x18, 0x18, 0x2c, 0x28, 0x68, 0x28, 0x34, 0x34, 0x38, 0x40, 0x44, 0x44, 0x38, 0x3c, 0x44, 0x48, 0x4c, 0x5c, 0x5c, 0x54, 0x64, 0x74, 0x74, 0x88, 0x80, 0x94, 0x8c, 0x78, 0x6c, 0x64, 0x70, 0x7c, 0x8c, 0x98, 0x90, 0x98, 0x84, 0x84, 0x88, 0x78, 0x78, 0x6c, 0x5c, 0x50, 0x50, 0x48, 0x50, 0x5c, 0x64, 0x64, 0x74, 0x78, 0x74, 0x64, 0x60, 0x58, 0x54, 0x50, 0x50, 0x58, 0x30, 0x34, }; +static const uint8 kSpr07A_Fireworks_DATA_03C6CE[84] = { 0x20, 0x30, 0x39, 0x47, 0x50, 0x60, 0x70, 0x7c, 0x7b, 0x80, 0x7d, 0x78, 0x6e, 0x60, 0x4f, 0x47, 0x41, 0x38, 0x30, 0x2a, 0x20, 0x10, 0x4, 0x0, 0x0, 0x8, 0x10, 0x20, 0x1a, 0x10, 0xa, 0x6, 0xf, 0x17, 0x16, 0x1c, 0x1f, 0x21, 0x10, 0x18, 0x20, 0x2c, 0x2e, 0x3b, 0x30, 0x30, 0x2d, 0x2a, 0x34, 0x36, 0x3a, 0x3f, 0x45, 0x4d, 0x5f, 0x54, 0x4e, 0x67, 0x70, 0x67, 0x70, 0x5c, 0x4e, 0x40, 0x48, 0x56, 0x57, 0x5f, 0x68, 0x72, 0x77, 0x6f, 0x66, 0x60, 0x67, 0x5c, 0x57, 0x4b, 0x4d, 0x54, 0x48, 0x43, 0x3d, 0x3c, }; +static const uint8 kSpr07A_Fireworks_DATA_03C722[84] = { 0x18, 0x1e, 0x25, 0x22, 0x1a, 0x17, 0x20, 0x30, 0x41, 0x4f, 0x61, 0x70, 0x7f, 0x8c, 0x94, 0x92, 0xa0, 0x86, 0x93, 0x88, 0x88, 0x78, 0x66, 0x50, 0x40, 0x30, 0x22, 0x20, 0x2c, 0x30, 0x40, 0x4f, 0x59, 0x51, 0x3f, 0x39, 0x4c, 0x5f, 0x6a, 0x6f, 0x77, 0x7e, 0x6c, 0x60, 0x58, 0x48, 0x3d, 0x2f, 0x28, 0x38, 0x44, 0x30, 0x36, 0x27, 0x21, 0x2f, 0x39, 0x2a, 0x2f, 0x39, 0x40, 0x3f, 0x49, 0x50, 0x60, 0x59, 0x4c, 0x51, 0x48, 0x4f, 0x56, 0x67, 0x5b, 0x68, 0x75, 0x7d, 0x87, 0x8a, 0x7a, 0x6b, 0x70, 0x82, 0x73, 0x92, }; +static const uint8 kSpr07C_PrincessPeach_InitialXLo[4] = { 0x60, 0xb0, 0x40, 0x80, }; +static const uint8 kSpr07A_Fireworks_FireworkSounds[4] = { 0x26, 0x0, 0x26, 0x28, }; +static const uint8 kSpr07A_Fireworks_FireworkSounds_WhistleCh3[4] = { 0x0, 0x2b, 0x0, 0x0, }; +static const uint8 kSpr07A_Fireworks_FireworkSounds_BangCh1[4] = { 0x27, 0x0, 0x27, 0x29, }; +static const uint8 kSpr07A_Fireworks_FireworkSounds_BangCh3[4] = { 0x0, 0x2c, 0x0, 0x0, }; +static const uint8 kSpr07C_PrincessPeach_DATA_03C78A[4] = { 0x0, 0xaa, 0xff, 0xaa, }; +static const uint8 kSpr07C_PrincessPeach_DATA_03C78E[4] = { 0x0, 0x7e, 0x27, 0x7e, }; +static const uint8 kSpr07C_PrincessPeach_DATA_03C792[4] = { 0xc0, 0xc0, 0xff, 0xc0, }; +static const uint8 kSpr07A_Fireworks_YSpeed[4] = { 0xe4, 0xe6, 0xe4, 0xe2, }; +static const uint8 kSpr07A_Fireworks_DATA_03C83D[4] = { 0x14, 0xc, 0x10, 0x15, }; +static const uint8 kSpr07A_Fireworks_DATA_03C841[4] = { 0x8, 0x10, 0xc, 0x5, }; +static const uint8 kSpr07A_Fireworks_DATA_03C889[4] = { 0xff, 0x80, 0xc0, 0xff, }; +static const uint8 kSpr07A_Fireworks_DATA_03C8F1[80] = { 0x6, 0x5, 0x4, 0x3, 0x3, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, }; +static const uint8 kSpr07A_Fireworks_DATA_03C969[4] = { 0xec, 0x8e, 0xec, 0xec, }; +static const uint8 kSpr07A_Fireworks_DATA_03C9B9[40] = { 0x36, 0x35, 0xc7, 0x34, 0x34, 0x34, 0x34, 0x24, 0x3, 0x3, 0x36, 0x35, 0xc7, 0x34, 0x34, 0x24, 0x24, 0x24, 0x24, 0x3, 0x36, 0x35, 0xc7, 0x34, 0x34, 0x34, 0x24, 0x24, 0x3, 0x24, 0x36, 0x35, 0xc7, 0x34, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3, }; +static const uint8 kSpr07A_Fireworks_DATA_03C9E1[8] = { 0x0, 0x1, 0x1, 0x0, 0x0, 0xff, 0xff, 0x0, }; +static const uint8 kSpawnFootball_xlo[2] = { 0x14, 0xec, }; +static const uint8 kSpawnFootball_xhi[2] = { 0x0, 0xff, }; +static const uint8 kSpawnFootball_InitialXSpeed[2] = { 0x18, 0xe8, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_SpawningXPos[8] = { 0x18, 0x38, 0x58, 0x78, 0x98, 0xb8, 0xd8, 0x78, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_LemmySpawningYPos[8] = { 0x40, 0x50, 0x50, 0x40, 0x30, 0x40, 0x50, 0x40, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_DATA_03CC48[9] = { 0x50, 0x4a, 0x50, 0x4a, 0x4a, 0x40, 0x4a, 0x48, 0x4a, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_DATA_03CC51[9] = { 0x2, 0x4, 0x6, 0x8, 0xb, 0xc, 0xe, 0x10, 0x13, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_SpawningPositionIndexes[48] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_DummyIDs[2] = { 0x10, 0x20, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_LemmyAndWendyAnimationFrames[144] = { 0x2, 0x2, 0x2, 0x2, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x4, 0x5, 0x5, 0x4, 0x5, 0x5, 0x4, 0x5, 0x5, 0x4, 0x4, 0x4, 0x4, 0x6, 0x6, 0x6, 0x6, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x6, 0x6, 0x6, 0x6, 0x8, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x8, 0x8, 0x9, 0x9, 0x8, 0x8, 0x8, 0x8, 0x8, 0xb, 0xb, 0xb, 0xb, 0xb, 0xa, 0xb, 0xa, 0xb, 0xa, 0xb, 0xa, 0xb, 0xb, 0xb, 0xb, 0xc, 0xc, 0xc, 0xc, 0xd, 0xc, 0xd, 0xc, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xe, 0xe, 0xe, 0xe, 0xe, 0xf, 0xe, 0xf, 0xe, 0xf, 0xe, 0xf, 0xe, 0xe, 0xe, 0xe, 0x10, 0x10, 0x10, 0x10, 0x11, 0x12, 0x11, 0x10, 0x11, 0x12, 0x11, 0x10, 0x11, 0x11, 0x11, 0x11, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_DummyHurtFrames[4] = { 0x16, 0x16, 0x15, 0x14, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_LemmyXDisp[138] = { 0xf8, 0x8, 0xf8, 0x8, 0x0, 0x0, 0xf8, 0x8, 0xf8, 0x8, 0x0, 0x0, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfb, 0x0, 0xfb, 0x3, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x8, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x6, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x2, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x4, 0x0, 0x8, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_WendyXDisp[138] = { 0xf8, 0x8, 0xf8, 0x8, 0x0, 0x0, 0xf8, 0x8, 0xf8, 0x8, 0x0, 0x0, 0xf8, 0x0, 0x8, 0x0, 0x0, 0x0, 0xfb, 0x0, 0xfb, 0x3, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x8, 0x0, 0x0, 0x0, 0xf8, 0x0, 0x8, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x6, 0x0, 0x8, 0xf8, 0x8, 0x0, 0x2, 0x0, 0x8, 0xf8, 0x8, 0x0, 0x4, 0x0, 0x8, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x8, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xf8, 0x8, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_LemmyYDisp[138] = { 0x4, 0x4, 0x14, 0x14, 0x0, 0x0, 0x4, 0x4, 0x14, 0x14, 0x0, 0x0, 0x0, 0x8, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x8, 0xf8, 0xf8, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x5, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf, 0xf8, 0xf8, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x4, 0x4, 0x2, 0x0, 0x0, 0x0, 0x4, 0x4, 0x1, 0x0, 0x0, 0x0, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x5, 0x5, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x3, 0x0, 0x0, 0x0, 0x5, 0x5, 0x4, 0x0, 0x0, 0x0, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_WendyYDisp[138] = { 0x4, 0x4, 0x14, 0x14, 0x0, 0x0, 0x4, 0x4, 0x14, 0x14, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0xf8, 0xf8, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x5, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x5, 0x5, 0x0, 0xf, 0xf8, 0xf8, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x4, 0x4, 0x2, 0x0, 0x0, 0x0, 0x4, 0x4, 0x1, 0x0, 0x0, 0x0, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x0, 0xf8, 0xf8, 0x0, 0x5, 0x5, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x3, 0x0, 0x0, 0x0, 0x5, 0x5, 0x4, 0x0, 0x0, 0x0, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_LemmyTiles[138] = { 0x20, 0x20, 0x26, 0x26, 0x8, 0x0, 0x2e, 0x2e, 0x24, 0x24, 0x8, 0x0, 0x0, 0x28, 0x2, 0x0, 0x0, 0x0, 0x4, 0x28, 0x12, 0x12, 0x0, 0x0, 0x22, 0x22, 0x4, 0x12, 0x12, 0x0, 0x20, 0x20, 0x8, 0x0, 0x0, 0x0, 0x0, 0x28, 0x2, 0x0, 0x0, 0x0, 0xa, 0x28, 0x13, 0x0, 0x0, 0x0, 0x20, 0x20, 0xc, 0x2, 0x0, 0x0, 0x20, 0x20, 0xc, 0x2, 0x0, 0x0, 0x22, 0x22, 0x6, 0x3, 0x12, 0x12, 0x20, 0x20, 0x6, 0x12, 0x12, 0x0, 0x2a, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x2c, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x20, 0x20, 0x6, 0x12, 0x12, 0x0, 0x20, 0x20, 0x6, 0x12, 0x12, 0x0, 0x22, 0x22, 0x8, 0x0, 0x0, 0x0, 0x20, 0x20, 0x8, 0x0, 0x0, 0x0, 0x2e, 0x2e, 0x8, 0x0, 0x0, 0x0, 0x4e, 0x4e, 0x60, 0x43, 0x43, 0x0, 0x4e, 0x4e, 0x64, 0x0, 0x0, 0x0, 0x62, 0x62, 0x64, 0x0, 0x0, 0x0, 0x62, 0x62, 0x64, 0x0, 0x0, 0x0, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_WendyTiles[138] = { 0x20, 0x20, 0x26, 0x26, 0x48, 0x0, 0x2e, 0x2e, 0x24, 0x24, 0x48, 0x0, 0x40, 0x28, 0x42, 0x0, 0x0, 0x0, 0x44, 0x28, 0x52, 0x52, 0x0, 0x0, 0x22, 0x22, 0x44, 0x52, 0x52, 0x0, 0x20, 0x20, 0x48, 0x0, 0x0, 0x0, 0x40, 0x28, 0x42, 0x0, 0x0, 0x0, 0x4a, 0x28, 0x53, 0x0, 0x0, 0x0, 0x20, 0x20, 0x4c, 0x1e, 0x1f, 0x0, 0x20, 0x20, 0x4c, 0x1f, 0x1e, 0x0, 0x22, 0x22, 0x44, 0x3, 0x52, 0x52, 0x20, 0x20, 0x44, 0x52, 0x52, 0x0, 0x2a, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x2c, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x20, 0x20, 0x46, 0x52, 0x52, 0x0, 0x20, 0x20, 0x46, 0x52, 0x52, 0x0, 0x22, 0x22, 0x48, 0x0, 0x0, 0x0, 0x20, 0x20, 0x48, 0x0, 0x0, 0x0, 0x2e, 0x2e, 0x48, 0x0, 0x0, 0x0, 0x4e, 0x4e, 0x66, 0x68, 0x68, 0x0, 0x4e, 0x4e, 0x6a, 0x0, 0x0, 0x0, 0x62, 0x62, 0x6a, 0x0, 0x0, 0x0, 0x62, 0x62, 0x6a, 0x0, 0x0, 0x0, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_LemmyProp[138] = { 0x5, 0x45, 0x5, 0x45, 0x5, 0x0, 0x5, 0x45, 0x5, 0x45, 0x5, 0x0, 0x5, 0x5, 0x5, 0x0, 0x0, 0x0, 0x5, 0x5, 0x5, 0x45, 0x0, 0x0, 0x5, 0x45, 0x5, 0x5, 0x45, 0x0, 0x5, 0x45, 0x5, 0x0, 0x0, 0x0, 0x5, 0x5, 0x5, 0x0, 0x0, 0x0, 0x5, 0x5, 0x5, 0x0, 0x0, 0x0, 0x5, 0x45, 0x5, 0x5, 0x0, 0x0, 0x5, 0x45, 0x45, 0x45, 0x0, 0x0, 0x5, 0x45, 0x5, 0x5, 0x5, 0x45, 0x5, 0x45, 0x45, 0x5, 0x45, 0x0, 0x5, 0x45, 0x0, 0x0, 0x0, 0x0, 0x5, 0x45, 0x0, 0x0, 0x0, 0x0, 0x5, 0x45, 0x45, 0x5, 0x45, 0x0, 0x5, 0x45, 0x5, 0x5, 0x45, 0x0, 0x5, 0x45, 0x5, 0x0, 0x0, 0x0, 0x5, 0x45, 0x5, 0x0, 0x0, 0x0, 0x5, 0x45, 0x5, 0x0, 0x0, 0x0, 0x7, 0x47, 0x7, 0x7, 0x47, 0x0, 0x7, 0x47, 0x7, 0x0, 0x0, 0x0, 0x7, 0x47, 0x7, 0x0, 0x0, 0x0, 0x7, 0x47, 0x7, 0x0, 0x0, 0x0, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_WendyProp[138] = { 0x9, 0x49, 0x9, 0x49, 0x9, 0x0, 0x9, 0x49, 0x9, 0x49, 0x9, 0x0, 0x9, 0x9, 0x9, 0x0, 0x0, 0x0, 0x9, 0x9, 0x9, 0x49, 0x0, 0x0, 0x9, 0x49, 0x9, 0x9, 0x49, 0x0, 0x9, 0x49, 0x9, 0x0, 0x0, 0x0, 0x9, 0x9, 0x9, 0x0, 0x0, 0x0, 0x9, 0x9, 0x9, 0x0, 0x0, 0x0, 0x9, 0x49, 0x9, 0x9, 0x9, 0x0, 0x9, 0x49, 0x49, 0x49, 0x49, 0x0, 0x9, 0x49, 0x9, 0x9, 0x9, 0x49, 0x9, 0x49, 0x49, 0x9, 0x49, 0x0, 0x9, 0x49, 0x0, 0x0, 0x0, 0x0, 0x9, 0x49, 0x0, 0x0, 0x0, 0x0, 0x9, 0x49, 0x49, 0x9, 0x49, 0x0, 0x9, 0x49, 0x9, 0x9, 0x49, 0x0, 0x9, 0x49, 0x9, 0x0, 0x0, 0x0, 0x9, 0x49, 0x9, 0x0, 0x0, 0x0, 0x9, 0x49, 0x9, 0x0, 0x0, 0x0, 0x5, 0x45, 0x5, 0x5, 0x45, 0x0, 0x5, 0x45, 0x5, 0x0, 0x0, 0x0, 0x5, 0x45, 0x5, 0x0, 0x0, 0x0, 0x5, 0x45, 0x5, 0x0, 0x0, 0x0, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_LemmyTileSize[138] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x4, 0x2, 0x2, 0x2, 0x2, 0x2, 0x4, 0x2, 0x2, 0x0, 0x4, 0x4, 0x4, 0x2, 0x2, 0x0, 0x0, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x0, 0x4, 0x4, 0x4, 0x2, 0x2, 0x0, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x0, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x4, 0x4, 0x4, 0x4, 0x2, 0x2, 0x4, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_WendyTileSize[138] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x4, 0x2, 0x2, 0x2, 0x2, 0x2, 0x4, 0x2, 0x2, 0x0, 0x4, 0x4, 0x4, 0x2, 0x2, 0x0, 0x0, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x0, 0x4, 0x4, 0x4, 0x2, 0x2, 0x0, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x0, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x4, 0x4, 0x4, 0x4, 0x2, 0x2, 0x4, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x0, 0x0, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x4, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_NumberOfTilesToDrawForLemmy[23] = { 0x4, 0x4, 0x2, 0x3, 0x4, 0x2, 0x2, 0x2, 0x3, 0x3, 0x5, 0x4, 0x1, 0x1, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x2, 0x2, 0x2, }; +static const uint8 kSpr029_KoopaKid_WendyLemmy_NumberOfTilesToDrawForWendy[23] = { 0x4, 0x4, 0x2, 0x3, 0x4, 0x2, 0x2, 0x2, 0x4, 0x4, 0x5, 0x4, 0x1, 0x1, 0x4, 0x4, 0x2, 0x2, 0x2, 0x4, 0x2, 0x2, 0x2, }; +#define kSpr07C_PrincessPeach_MessageData ((uint16*)RomFixedPtr(0x3D524)) +static const uint8 kSpr0A9_Reznor_DATA_03D700[12] = { 0xb0, 0xa0, 0x90, 0x80, 0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x0, }; +static const uint16 kGameMode12_PrepareLevel_DATA_03D8EC[54] = { 0xffff, 0xffff, 0xffff, 0x3424, 0xb25, 0x3626, 0x1b0e, 0x1c0c, 0x1d0d, 0x1e0e, 0x3929, 0x3a2a, 0x3b2b, 0x3826, 0x3020, 0x3121, 0x3727, 0x3828, 0xffff, 0x3222, 0x330e, 0x1c0c, 0x1d0d, 0x3c0e, 0x3d2d, 0xffff, 0x1707, 0x230e, 0x40e, 0x1c0c, 0x1d0d, 0x90e, 0x2c0e, 0x1a0a, 0xffff, 0x3424, 0x3b2b, 0xffff, 0x1707, 0x180e, 0x190e, 0x1a0a, 0x1202, 0x1303, 0x803, 0x503, 0x503, 0x1403, 0x1503, 0x503, 0x503, 0x803, 0x603, 0x1f0f, }; +#define kInitializeMode7TilemapsAndPalettes_TilemapData ((uint8*)RomFixedPtr(0x3D9DE)) +static const uint8 kInitializeMode7TilemapsAndPalettes_PalPtrLo[5] = { 0xbc, 0xa4, 0x98, 0x78, 0x6c, }; +static const uint8 kInitializeMode7TilemapsAndPalettes_PalPtrHi[5] = { 0xb2, 0xb2, 0xb2, 0xb3, 0xb3, }; +static const uint8 kInitializeMode7TilemapsAndPalettes_GFXFile[5] = { 0xb, 0xb, 0xb, 0x21, 0x0, }; +static const uint8 kInitializeMode7TilemapsAndPalettes_DATA_03DE4E[64] = { 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x3f, }; +static const uint16 kUpdateMode7SpriteAnimations_DATA_03DEBB[2] = { 0x100, 0x110, }; +static const uint16 kUpdateMode7SpriteAnimations_DATA_03DEBF[4] = { 0x706e, 0x50ff, 0xfefe, 0x57ff, }; +static const uint16 kUpdateMode7SpriteAnimations_DATA_03DEC7[4] = { 0x7472, 0x5452, 0x3e3c, 0x5355, }; +static const uint16 kUpdateMode7SpriteAnimations_DATA_03DECF[4] = { 0x5676, 0xff56, 0xffff, 0xff51, }; +static const uint16 kUpdateMode7SpriteAnimations_DATA_03DED7[4] = { 0x320, 0x330, 0x340, 0x350, }; +static const uint8 kSpr0A0_ActivateBowserBattle_BowserPaletteTableIndex[8] = { 0x0, 0xe, 0x1c, 0x2a, 0x38, 0x46, 0x54, 0x62, }; + void Spr01B_Football(uint8 k) { // 038012 GenericGFXRtDraw1Tile16x16(k); if (flag_sprites_locked) @@ -201,11 +511,12 @@ void Spr0C5_BigBooBoss_Dying(uint8 k) { // 0381d3 void Spr0C5_BigBooBoss_0381E4(uint8 k) { // 0381e4 uint8 j = 11; + CollInfo ci; while (1) { if (spr_current_status[j] == 9 || spr_current_status[j] == 10) { - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j, &ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) break; } if ((--j & 0x80) != 0) @@ -230,12 +541,12 @@ void FadingBooPaletteAnimation() { // 038239 v0 = sprites_big_boo_boss_palette_index; } uint8 v1 = 16 * v0; - R0_ = 0; + uint8 r0 = 0; uint8 v2 = palettes_dynamic_palette_upload_index; do { - palettes_dynamic_palette_colors[v2++] = *((uint8 *)kBooFadePalettes_Fade07 + v1++); - ++R0_; - } while (R0_ != 16); + palettes_dynamic_palette_colors[v2++] = *((uint8 *)kBooFadePalettes + v1++); + ++r0; + } while (r0 != 16); uint8 v3 = palettes_dynamic_palette_upload_index; v4 = palettes_dynamic_palette_upload_index; *(&palettes_dynamic_palette_bytes_to_upload + palettes_dynamic_palette_upload_index) = 16; @@ -245,7 +556,7 @@ void FadingBooPaletteAnimation() { // 038239 } void NormalSpriteBooDraw(uint8 k) { // 0383a0 - uint8 drt; + GetDrawInfoRes drt; if (spr_spriteid[k] == 55) { uint8 v1 = 0; @@ -258,33 +569,33 @@ void NormalSpriteBooDraw(uint8 k) { // 0383a0 spr_table1602[k] = v1; GenericGFXRtDraw1Tile16x16(k); } else { - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R6_ = spr_table1602[k]; - R3_ = 4 * R6_; - R2_ = 4 * R6_ + 16 * R6_; - R4_ = spr_table157c[k]; - R5_ = spr_table15f6[k]; + uint8 r6 = spr_table1602[k]; + uint8 r3 = 4 * r6; + uint8 r2 = 4 * r6 + 16 * r6; + uint8 r4 = spr_table157c[k]; + uint8 r5 = spr_table15f6[k]; uint8 v4 = 0; do { uint8 v12 = v4; - uint8 v5 = R2_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].charnum = kNormalSpriteBooGFXRt_BigBooTiles[R2_]; - uint8 a = R5_ | kNormalSpriteBooGFXRt_BigBooProp[v5]; - if (!(R4_ & 1)) + uint8 v5 = r2; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].charnum = kNormalSpriteBooGFXRt_BigBooTiles[r2]; + uint8 a = r5 | kNormalSpriteBooGFXRt_BigBooProp[v5]; + if (!(r4 & 1)) a ^= 0x40; oam[64].flags = sprites_tile_priority | a; uint8 v7 = kNormalSpriteBooGFXRt_BigBooXDisp[v5]; - if (!(R4_ & 1)) + if (!(r4 & 1)) v7 = 40 - v7; - oam[64].xpos = R0_ + v7; + oam[64].xpos = drt.x + v7; uint8 v8 = v12; - if (R6_ >= 3) + if (r6 >= 3) v8 = v12 + 20; - oam[64].ypos = kNormalSpriteBooGFXRt_BigBooYDisp[v8] + R1_; - drt += 4; - ++R2_; + oam[64].ypos = kNormalSpriteBooGFXRt_BigBooYDisp[v8] + drt.y; + drt.idx += 4; + ++r2; v4 = v12 + 1; } while (v4 != 20); uint8 v9 = spr_current_slotid; @@ -317,17 +628,17 @@ void Spr0C4_GreyFallingPlatform(uint8 k) { // 038454 } void Spr0C4_GreyFallingPlatform_Draw(uint8 k) { // 038492 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 3; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0C4_GreyFallingPlatform_XDisp[i] + R0_; - oam[64].ypos = R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0C4_GreyFallingPlatform_XDisp[i] + drt.x; + oam[64].ypos = drt.y; oam[64].charnum = kSpr0C4_GreyFallingPlatform_Tiles[i]; oam[64].flags = sprites_tile_priority | 3; - drt += 4; + drt.idx += 4; } FinishOAMWrite(k, 2, 3); } @@ -386,23 +697,23 @@ void Spr0C3_PorcuPuffer(uint8 k) { // 03852f } void Spr0C3_PorcuPuffer_Draw(uint8 k) { // 0385a3 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R3_ = counter_local_frames & 4; - R2_ = spr_table157c[k]; + uint8 r3 = counter_local_frames & 4; + uint8 r2 = spr_table157c[k]; uint8 v2 = 3; do { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].ypos = kSpr0C3_PorcuPuffer_PocruPufferDispY[v2] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].ypos = kSpr0C3_PorcuPuffer_PocruPufferDispY[v2] + drt.y; uint8 v4 = v2; - if (!R2_) + if (!r2) v2 |= 4; - oam[64].xpos = kSpr0C3_PorcuPuffer_PocruPufferDispX[v2] + R0_; + oam[64].xpos = kSpr0C3_PorcuPuffer_PocruPufferDispX[v2] + drt.x; oam[64].flags = sprites_tile_priority | kSpr0C3_PorcuPuffer_PocruPufferGfxProp[v2]; - oam[64].charnum = kSpr0C3_PorcuPuffer_PocruPufferTiles[R3_ | v4]; - drt += 4; + oam[64].charnum = kSpr0C3_PorcuPuffer_PocruPufferTiles[r3 | v4]; + drt.idx += 4; v2 = v4 - 1; } while ((int8)v2 >= 0); FinishOAMWrite(k, 2, 3); @@ -445,26 +756,26 @@ void Spr0C1_WingedPlatform(uint8 k) { // 0385f6 } void Spr0C1_WingedPlatform_Draw(uint8 k) { // 0386a8 - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; uint8 v1 = spr_oamindex[k]; uint8 v2 = (counter_local_frames >> 1) & 4; if (v2) ++v2; - R2_ = v2; + uint8 r2 = v2; uint8 v3 = 4; do { - R6_ = v3; - uint8 v4 = R2_ + v3; + uint8 v4 = r2 + v3; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = kSpr0C1_WingedPlatform_XDisp[v4] + R0_; - oam[64].ypos = kSpr0C1_WingedPlatform_YDisp[v4] + R1_; + oam[64].xpos = kSpr0C1_WingedPlatform_XDisp[v4] + drt.x; + oam[64].ypos = kSpr0C1_WingedPlatform_YDisp[v4] + drt.y; oam[64].charnum = kSpr0C1_WingedPlatform_Tiles[v4]; oam[64].flags = kSpr0C1_WingedPlatform_Prop[v4]; sprites_oamtile_size_buffer[(v1 >> 2) + 64] = kSpr0C1_WingedPlatform_TileSize[v4]; v1 += 4; - v3 = R6_ - 1; - } while ((int8)(R6_ - 1) >= 0); + v3 = v3 - 1; + } while ((int8)v3 >= 0); FinishOAMWrite(k, 0xFF, 4); } @@ -488,19 +799,19 @@ void Spr0C0_SinkingLavaPlatform(uint8 k) { // 0386ff } void Spr0C0_SinkingLavaPlatform_Draw(uint8 k) { // 03873a - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 2; (i & 0x80) == 0; --i) { - uint8 v3 = R0_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; - R0_ = v3 + 16; - oam[64].ypos = R1_; + uint8 v3 = drt.x; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; + drt.x = v3 + 16; + oam[64].ypos = drt.y; oam[64].charnum = kSpr0C0_SinkingLavaPlatform_LavaPlatTiles[i]; oam[64].flags = sprites_tile_priority | kSpr0C0_SinkingLavaPlatform_DATA_038737[i]; - drt += 4; + drt.idx += 4; } FinishOAMWrite(k, 2, 2); } @@ -531,8 +842,7 @@ void Spr0BF_MegaMole(uint8 k) { // 038770 if (!v1) spr_table151c[k] = spr_table157c[k]; if (CheckPlayerToNormalSpriteCollision(k) & 1) { - CheckPlayerPositionRelativeToSprite_Bank23_Y(k); - if (sign8(R14_ + 40)) { + if (sign8(player_ypos - GetSprYPos(k) + 40)) { if ((player_yspeed & 0x80) == 0) { misc_player_on_solid_sprite = 1; spr_decrementing_table154c[k] = 6; @@ -549,26 +859,26 @@ void Spr0BF_MegaMole(uint8 k) { // 038770 } void Spr0BF_MegaMole_Draw(uint8 k) { // 03883f - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_table151c[k]; - R3_ = 4 * ((spr_current_slotid + (counter_local_frames >> 2)) & 1); + uint8 r2 = spr_table151c[k]; + uint8 r3 = 4 * ((spr_current_slotid + (counter_local_frames >> 2)) & 1); uint8 v2 = 3; do { uint8 v5 = v2; - if (!R2_) + if (!r2) v2 += 4; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0BF_MegaMole_TileDispX[v2] + R0_; - oam[64].ypos = kSpr0BF_MegaMole_TileDispY[v5] + R1_; - oam[64].charnum = kSpr0BF_MegaMole_Tiles[(uint8)(R3_ + v5)]; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0BF_MegaMole_TileDispX[v2] + drt.x; + oam[64].ypos = kSpr0BF_MegaMole_TileDispY[v5] + drt.y; + oam[64].charnum = kSpr0BF_MegaMole_Tiles[(uint8)(r3 + v5)]; int8 v4 = 1; - if (!R2_) + if (!r2) v4 = 65; oam[64].flags = sprites_tile_priority | v4; - drt += 4; + drt.idx += 4; v2 = v5 - 1; } while ((int8)v2 >= 0); FinishOAMWrite(k, 2, 3); @@ -595,7 +905,7 @@ void Spr0BE_Swooper(uint8 k) { // 0388a3 void Spr0BE_Swooper_Waiting(uint8 k) { // 0388e4 if (!spr_xoffscreen_flag[k]) { uint8 v1 = CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 80) < 0xA0) { + if ((uint8)(player_xpos - GetSprXPos(k) + 80) < 0xA0) { ++spr_table00c2[k]; spr_table157c[k] = v1; spr_yspeed[k] = 32; @@ -670,10 +980,10 @@ void Spr0BD_SlidingNakedBlueKoopa(uint8 k) { // 038958 if (v8) { if (v8 < 0) v8 = -v8; - R0_ = v8; + uint8 r0 = v8; uint8 v9 = spr_slope_surface_its_on[k]; if (v9) { - v7 = R0_; + v7 = r0; if (((spr_xspeed[k] ^ v9) & 0x80) != 0) v7 = -48; } @@ -707,8 +1017,8 @@ void Spr0BD_SlidingNakedBlueKoopa(uint8 k) { // 038958 void Spr0BD_SlidingNakedBlueKoopa_0389FF(uint8 k) { // 0389ff if (spr_xspeed[k]) { if ((counter_global_frames & 3) == 0) { - R0_ = 4; - R1_ = 10; + uint8 r0 = 4; + uint8 r1 = 10; if (!CheckIfNormalSpriteOffScreen(k)) { uint8 v1 = 3; while (smoke_spr_spriteid[v1]) { @@ -716,8 +1026,8 @@ void Spr0BD_SlidingNakedBlueKoopa_0389FF(uint8 k) { // 0389ff return; } smoke_spr_spriteid[v1] = 3; - smoke_spr_xpos_lo[v1] = R0_ + spr_xpos_lo[k]; - smoke_spr_ypos_lo[v1] = R1_ + spr_ypos_lo[k]; + smoke_spr_xpos_lo[v1] = r0 + spr_xpos_lo[k]; + smoke_spr_ypos_lo[v1] = r1 + spr_ypos_lo[k]; smoke_spr_timer[v1] = 19; } } @@ -794,35 +1104,37 @@ void Spr0BC_BowserStatue_038ACB(uint8 k) { // 038acb } void Spr0BC_BowserStatue_Draw(uint8 k) { // 038b3d - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R4_ = spr_table1602[k]; - R3_ = (R4_ ^ 1) - 1; - R5_ = spr_table15f6[k]; - R2_ = spr_table157c[k]; + uint8 r4 = spr_table1602[k]; + uint8 r3 = (r4 ^ 1) - 1; + uint8 r5 = spr_table15f6[k]; + uint8 r2 = spr_table157c[k]; uint8 v2 = 2; do { uint8 v5 = v2; - if (!R2_) + if (!r2) v2 += 3; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0BC_BowserStatue_XDisp[v2] + R0_; - oam[64].flags = sprites_tile_priority | R5_ | kSpr0BC_BowserStatue_Prop[v2]; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0BC_BowserStatue_XDisp[v2] + drt.x; + oam[64].flags = sprites_tile_priority | r5 | kSpr0BC_BowserStatue_Prop[v2]; uint8 v4 = v5; - oam[64].ypos = kSpr0BC_BowserStatue_YDisp[v5] + R1_; - if (R4_) + oam[64].ypos = kSpr0BC_BowserStatue_YDisp[v5] + drt.y; + if (r4) v4 = v5 + 3; oam[64].charnum = kSpr0BC_BowserStatue_Tiles[v4]; - sprites_oamtile_size_buffer[(drt >> 2) + 64] = kSpr0BC_BowserStatue_TileSize[v5]; - drt += 4; + sprites_oamtile_size_buffer[(drt.idx >> 2) + 64] = kSpr0BC_BowserStatue_TileSize[v5]; + drt.idx += 4; v2 = v5 - 1; - } while (v2 != R3_); + } while (v2 != r3); FinishOAMWrite(k, 0xFF, 2); } void Spr0B8_CarrotTopLiftUpperLeft(uint8 k) { // 038c2f + CollInfo ci; + Spr0B7_CarrotTopLiftUpperRight_Draw(k); if (!flag_sprites_locked) { SubOffscreen_Bank03_Entry1(k); @@ -838,18 +1150,17 @@ void Spr0B8_CarrotTopLiftUpperLeft(uint8 k) { // 038c2f UpdateNormalSpritePosition_Y(k); spr_table151c[k] = spr_xpos_lo[k]; UpdateNormalSpritePosition_X(k); - Spr0B7_CarrotTopLiftUpperRight_038CE4(k); - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (StandardSpriteToSpriteCollisionChecks_CheckContact() && (player_yspeed & 0x80) == 0) { + Spr0B7_CarrotTopLiftUpperRight_038CE4(k, &ci); + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci) && (player_yspeed & 0x80) == 0) { uint8 v2 = player_xpos - spr_table151c[k] + 28; if (spr_spriteid[k] == 0xB8) v2 = player_xpos - spr_table151c[k] + 84; uint8 v3 = v2; uint8 v4 = player_riding_yoshi_flag ? 48 : 32; - R0_ = player_ypos + v4; if (sign8(kSpr0B7_CarrotTopLiftUpperRight_DATA_038BAA[v3] + spr_ypos_lo[k] - (player_ypos + v4))) { - R0_ = v4 - 3; - player_ypos = GetSprYPos(k) + kSpr0B7_CarrotTopLiftUpperRight_DATA_038BAA[v3] - R0_; + uint8 r0 = v4 - 3; + player_ypos = GetSprYPos(k) + kSpr0B7_CarrotTopLiftUpperRight_DATA_038BAA[v3] - r0; player_yspeed = 0; misc_player_on_solid_sprite = 1; player_xpos += (int8)sprites_position_disp; @@ -858,34 +1169,34 @@ void Spr0B8_CarrotTopLiftUpperLeft(uint8 k) { // 038c2f } } -void Spr0B7_CarrotTopLiftUpperRight_038CE4(uint8 k) { // 038ce4 - SetHiLo(&R8_, &R0_, player_xpos + 4); - R2_ = 8; - R3_ = 8; +void Spr0B7_CarrotTopLiftUpperRight_038CE4(uint8 k, CollInfo *ci) { // 038ce4 + SetHiLo(&ci->r8, &ci->r0, player_xpos + 4); + ci->r2 = 8; + ci->r3 = 8; uint8 v1 = player_riding_yoshi_flag ? 48 : 32; - SetHiLo(&R9_, &R1_, player_ypos + v1); + SetHiLo(&ci->r9, &ci->r1, player_ypos + v1); } void Spr0B7_CarrotTopLiftUpperRight_Draw(uint8 k) { // 038d24 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; bool v2 = spr_spriteid[k] < 0xB8; uint8 v3 = 2; - R2_ = 2; + uint8 r2 = 2; if (!v2) v3 = 5; do { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0B7_CarrotTopLiftUpperRight_XDisp[v3] + R0_; - oam[64].ypos = kSpr0B7_CarrotTopLiftUpperRight_YDisp[v3] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0B7_CarrotTopLiftUpperRight_XDisp[v3] + drt.x; + oam[64].ypos = kSpr0B7_CarrotTopLiftUpperRight_YDisp[v3] + drt.y; oam[64].charnum = kSpr0B7_CarrotTopLiftUpperRight_Tiles[v3]; oam[64].flags = sprites_tile_priority | kSpr0B7_CarrotTopLiftUpperRight_Prop[v3]; - drt += 4; + drt.idx += 4; --v3; - --R2_; - } while ((R2_ & 0x80) == 0); + --r2; + } while ((r2 & 0x80) == 0); FinishOAMWrite(k, 2, 2); } @@ -927,26 +1238,26 @@ void Spr0BA_TimedPlatform(uint8 k) { // 038dbb } void Spr0BA_TimedPlatform_Draw(uint8 k) { // 038e12 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; uint8 v5 = spr_table1570[k]; - R2_ = kSpr0BA_TimedPlatform_NumberTiles[v5 >> 6]; + uint8 r2 = kSpr0BA_TimedPlatform_NumberTiles[v5 >> 6]; uint8 v2 = 2; if (v5 < 8) v2 = 1; do { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0BA_TimedPlatform_XDisp[v2] + R0_; - oam[64].ypos = kSpr0BA_TimedPlatform_YDisp[v2] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0BA_TimedPlatform_XDisp[v2] + drt.x; + oam[64].ypos = kSpr0BA_TimedPlatform_YDisp[v2] + drt.y; uint8 v4 = kSpr0BA_TimedPlatform_PlatformTiles[v2]; if (v2 == 2) - v4 = R2_; + v4 = r2; oam[64].charnum = v4; oam[64].flags = sprites_tile_priority | kSpr0BA_TimedPlatform_Prop[v2]; - sprites_oamtile_size_buffer[(drt >> 2) + 64] = kSpr0BA_TimedPlatform_TileSize[v2]; - drt += 4; + sprites_oamtile_size_buffer[(drt.idx >> 2) + 64] = kSpr0BA_TimedPlatform_TileSize[v2]; + drt.idx += 4; --v2; } while ((v2 & 0x80) == 0); FinishOAMWrite(k, 0xFF, 2); @@ -964,17 +1275,17 @@ void Spr0BB_MovingCastleStone(uint8 k) { // 038e79 } void Spr0BB_MovingCastleStone_Draw(uint8 k) { // 038eb4 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 3; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0BB_MovingCastleStone_XDisp[i] + R0_; - oam[64].ypos = kSpr0BB_MovingCastleStone_YDisp[i] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0BB_MovingCastleStone_XDisp[i] + drt.x; + oam[64].ypos = kSpr0BB_MovingCastleStone_YDisp[i] + drt.y; oam[64].charnum = kSpr0BB_MovingCastleStone_Tiles[i]; oam[64].flags = sprites_tile_priority | 3; - drt += 4; + drt.idx += 4; } FinishOAMWrite(k, 2, 3); } @@ -990,25 +1301,25 @@ void Spr0B3_BowserStatueFire(uint8 k) { // 038eec } void Spr0B3_BowserStatueFire_Draw(uint8 k) { // 038f1b - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = 2 * spr_table157c[k]; - R3_ = 2 * ((counter_local_frames >> 1) & 3); + uint8 r2 = 2 * spr_table157c[k]; + uint8 r3 = 2 * ((counter_local_frames >> 1) & 3); int8 v2 = 1; do { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].ypos = R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].ypos = drt.y; int8 v6 = v2; - oam[64].xpos = kSpr0B3_BowserStatueFire_XDisp[(uint8)(R2_ | v2)] + R0_; - uint8 v4 = R3_ | v2; + oam[64].xpos = kSpr0B3_BowserStatueFire_XDisp[(uint8)(r2 | v2)] + drt.x; + uint8 v4 = r3 | v2; oam[64].charnum = kSpr0B3_BowserStatueFire_Tiles[v4]; uint8 v5 = kSpr0B3_BowserStatueFire_Prop[v4]; - if (!R2_) + if (!r2) v5 ^= 0x40; oam[64].flags = sprites_tile_priority | v5; - drt += 4; + drt.idx += 4; v2 = v6 - 1; } while ((int8)v2 >= 0); FinishOAMWrite(k, 0, 1); @@ -1023,8 +1334,8 @@ void SprXXX_ReflectingEnemy_ReflectingBooBuddiesEntry(uint8 k) { // 038f7a spr_table157c[k] = (spr_xspeed[k] & 0x80) != 0; GenericGFXRtDraw1Tile16x16(k); uint8 v1 = spr_oamindex[k]; - R0_ = (counter_local_frames & 0x10) != 0; - get_OamEnt(oam_buf, v1)[64].charnum = kSprXXX_ReflectingEnemy_BooStreamTiles[(uint8)(R0_ | (2 * (k & 3)))]; + uint8 r0 = (counter_local_frames & 0x10) != 0; + get_OamEnt(oam_buf, v1)[64].charnum = kSprXXX_ReflectingEnemy_BooStreamTiles[(uint8)(r0 | (2 * (k & 3)))]; SprXXX_ReflectingEnemy_038FA4(k); } @@ -1053,10 +1364,10 @@ void SprXXX_ReflectingEnemy_ReflectingPodobooDraw(uint8 k) { // 038ff2 v1 ^= 0x40; if ((spr_yspeed[k] & 0x80) == 0) v1 ^= 0x80; - R0_ = v1; + uint8 r0 = v1; OamEnt *oam = get_OamEnt(oam_buf, spr_oamindex[k]); oam[64].charnum = -84; - oam[64].flags = R0_ | oam[64].flags & 0x31; + oam[64].flags = r0 | oam[64].flags & 0x31; } void SprXXX_ReflectingEnemy_SpawnTrailingBoo(uint8 k) { // 039020 @@ -1114,47 +1425,48 @@ void Spr0AE_FishinBoo(uint8 k) { // 039065 void Spr0AE_FishinBoo_0390F3(uint8 k) { // 0390f3 int v1 = 3 * spr_table157c[k]; - SetHiLo(&R10_, &R4_, GetSprXPos(k) + PAIR16(kSpr0AE_FishinBoo_DATA_0390EF[v1], kSpr0AE_FishinBoo_DATA_0390EB[v1])); - R6_ = 4; - R7_ = 4; - SetHiLo(&R11_, &R5_, GetSprYPos(k) + 71); - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) + CollInfo ci; + SetHiLo(&ci.r10, &ci.r4, GetSprXPos(k) + PAIR16(kSpr0AE_FishinBoo_DATA_0390EF[v1], kSpr0AE_FishinBoo_DATA_0390EB[v1])); + ci.r6 = 4; + ci.r7 = 4; + SetHiLo(&ci.r11, &ci.r5, GetSprYPos(k) + 71); + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) DamagePlayer_Hurt(); } void Spr0AE_FishinBoo_Draw(uint8 k) { // 039180 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R4_ = spr_table1602[k]; - R2_ = spr_table157c[k]; - uint8 v9 = drt; + uint8 r4 = spr_table1602[k]; + uint8 r2 = spr_table157c[k]; + uint8 v9 = drt.idx; uint8 v2 = 9; do { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].ypos = kSpr0AE_FishinBoo_YDisp[v2] + R1_; - R3_ = 0; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].ypos = kSpr0AE_FishinBoo_YDisp[v2] + drt.y; + uint8 r3 = 0; uint8 v4 = kSpr0AE_FishinBoo_Tiles1[v2]; if (v2 == 9) { uint8 v5 = (counter_local_frames >> 2) & 3; - R3_ = kSpr0AE_FishinBoo_DATA_039178[v5]; + r3 = kSpr0AE_FishinBoo_DATA_039178[v5]; v4 = kSpr0AE_FishinBoo_Tiles2[v5]; v2 = 9; } oam[64].charnum = v4; - uint8 a = sprites_tile_priority | R3_ ^ kSpr0AE_FishinBoo_Prop[v2]; - if (R2_ == 0) + uint8 a = sprites_tile_priority | r3 ^ kSpr0AE_FishinBoo_Prop[v2]; + if (r2 == 0) a ^= 0x40; oam[64].flags = a; uint8 v8 = v2; - if (R4_) + if (r4) v2 += 10; - if (!R2_) + if (!r2) v2 += 20; - oam[64].xpos = kSpr0AE_FishinBoo_XDisp[v2] + R0_; - drt += 4; + oam[64].xpos = kSpr0AE_FishinBoo_XDisp[v2] + drt.x; + drt.idx += 4; v2 = v8 - 1; } while ((int8)v2 >= 0); OamEnt *v6 = get_OamEnt(oam_buf, v9); @@ -1195,8 +1507,7 @@ void Spr0B2_FallingSpike(uint8 k) { // 039214 goto LABEL_12; } spr_yspeed[k] = 0; - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 64) < 0x80) { + if ((uint8)(player_xpos - GetSprXPos(k) + 64) < 0x80) { ++spr_table00c2[k]; spr_decrementing_table1540[k] = 64; } @@ -1319,7 +1630,7 @@ void Spr0AC_DownFirstWoodenSpike_039475(uint8 k, uint8 a) { // 039475 void Spr0AC_DownFirstWoodenSpike_039488(uint8 k) { // 039488 if (CheckPlayerToNormalSpriteCollision(k) & 1) { uint8 v1 = CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 4) >= 8) { + if ((uint8)(player_xpos - GetSprXPos(k) + 4) >= 8) { player_xpos += PAIR16(kSpr0AC_DownFirstWoodenSpike_DATA_039486[v1], kSpr0AC_DownFirstWoodenSpike_DATA_039484[v1]); player_xspeed = 0; } else { @@ -1329,23 +1640,23 @@ void Spr0AC_DownFirstWoodenSpike_039488(uint8 k) { // 039488 } void Spr0AC_DownFirstWoodenSpike_Draw(uint8 k) { // 0394cf - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = 0; + uint8 r2 = 0; if (spr_spriteid[k] == 0xAD) - R2_ = 5; + r2 = 5; int8 v2 = 4; do { int8 v5 = v2; - uint8 v3 = R2_ + v2; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_; - oam[64].ypos = kSpr0AC_DownFirstWoodenSpike_YDisp[v3] + R1_; + uint8 v3 = r2 + v2; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x; + oam[64].ypos = kSpr0AC_DownFirstWoodenSpike_YDisp[v3] + drt.y; oam[64].charnum = kSpr0AC_DownFirstWoodenSpike_Tiles[v3]; oam[64].flags = kSpr0AC_DownFirstWoodenSpike_Prop[v3]; - drt += 4; + drt.idx += 4; v2 = v5 - 1; } while ((int8)v2 >= 0); FinishOAMWrite(k, 2, 4); @@ -1434,33 +1745,33 @@ void Spr0AB_Rex_RexPoints(uint8 k) { // 039628 } void Spr0AB_Rex_Draw(uint8 k) { // 03967e - uint8 drt; + GetDrawInfoRes drt; if (spr_decrementing_table1558[k]) spr_table1602[k] = 5; if (spr_decrementing_table1fe2[k]) spr_table1602[k] = 2; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R3_ = 2 * spr_table1602[k]; - R2_ = spr_table157c[k]; + uint8 r3 = 2 * spr_table1602[k]; + uint8 r2 = spr_table157c[k]; int8 v2 = 1; do { int8 v7 = v2; - uint8 v3 = R3_ | v2; - uint8 v6 = R3_ | v2; - if (!R2_) + uint8 v3 = r3 | v2; + uint8 v6 = r3 | v2; + if (!r2) v3 += 12; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0AB_Rex_XDisp[v3] + R0_; - oam[64].ypos = kSpr0AB_Rex_YDisp[v6] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0AB_Rex_XDisp[v3] + drt.x; + oam[64].ypos = kSpr0AB_Rex_YDisp[v6] + drt.y; oam[64].charnum = kSpr0AB_Rex_Tiles[v6]; - oam[64].flags = sprites_tile_priority | kSpr0AB_Rex_Prop[R2_]; + oam[64].flags = sprites_tile_priority | kSpr0AB_Rex_Prop[r2]; uint8 v5 = 0; - if (R3_ < 0xA) + if (r3 < 0xA) v5 = 2; - sprites_oamtile_size_buffer[(drt >> 2) + 64] = v5; - drt += 4; + sprites_oamtile_size_buffer[(drt.idx >> 2) + 64] = v5; + drt.idx += 4; --v2; } while ((int8)v2 >= 0); FinishOAMWrite(k, 0xFF, 1); @@ -1520,20 +1831,21 @@ void Spr0AA_Fishbone_Draw(uint8 k) { // 03978c if (spr_decrementing_table1558[k]) v1 = -88; get_OamEnt(oam_buf, spr_oamindex[k])[64].charnum = v1; - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = 2 * spr_table157c[k]; - R3_ = 2 * spr_table1602[k]; + uint8 r2 = 2 * spr_table157c[k]; + uint8 r3 = 2 * spr_table1602[k]; uint8 v2 = spr_oamindex[k] + 4; spr_oamindex[k] = v2; uint8 v3 = v2; for (int8 i = 1; i >= 0; --i) { OamEnt *oam = get_OamEnt(oam_buf, v3); - oam[64].ypos = kSpr0AA_Fishbone_YDisp[(uint8)i] + R1_; - int v6 = (uint8)(R2_ | i); - oam[64].xpos = kSpr0AA_Fishbone_XDisp[(uint8)(R2_ | i)] + R0_; + oam[64].ypos = kSpr0AA_Fishbone_YDisp[(uint8)i] + drt.y; + int v6 = (uint8)(r2 | i); + oam[64].xpos = kSpr0AA_Fishbone_XDisp[(uint8)(r2 | i)] + drt.x; oam[64].flags = sprites_tile_priority | kSpr0AA_Fishbone_Prop[v6]; - oam[64].charnum = kSpr0AA_Fishbone_TailTiles[(uint8)(R3_ | i)]; + oam[64].charnum = kSpr0AA_Fishbone_TailTiles[(uint8)(r3 | i)]; v3 += 4; } FinishOAMWrite(k, 0, 2); @@ -1574,42 +1886,36 @@ void Spr0A9_Reznor(uint8 k) { // 039890 } } if (spr_current_status[k] == 8) { - R0_W = (misc_m7_rotation + PAIR16(kSpr0A9_Reznor_ReznorStartPosHi[k & 3], kSpr0A9_Reznor_ReznorStartPosLo[k & 3])) & 0x1ff; - R0_W = (R0_W ^ 0x1FF) + 1; - R2_W = (R0_W + 128) & 0x1FF; - R4_W = kCircleCoordinates[(uint8)R0_W]; - R6_W = kCircleCoordinates[(uint8)(R0_W + 0x80)]; - WriteReg(WRMPYA, R4_); + uint16 r0w = (misc_m7_rotation + PAIR16(kSpr0A9_Reznor_ReznorStartPosHi[k & 3], kSpr0A9_Reznor_ReznorStartPosLo[k & 3])) & 0x1ff; + r0w = (r0w ^ 0x1FF) + 1; + uint16 r2w = (r0w + 128) & 0x1FF; + uint16 r4 = kCircleCoordinates[(uint8)r0w]; + uint16 r6 = kCircleCoordinates[(uint8)(r0w + 0x80)]; uint8 v4 = 56; - if (!R5_) { - WriteReg(WRMPYB, 0x38); - uint8 t = ReadReg(RDMPYL) >> 7; - v4 = ReadReg(RDMPYH) + t; + if (r4 < 256) { + uint16 mult = Mult8x8(r4, v4); + uint8 t = (uint8)mult >> 7; + v4 = (mult >> 8) + t; } - uint8 v3 = R1_ & 1; - R1_ >>= 1; + uint8 v3 = (r0w >> 8) & 1; if (v3) v4 = -v4; - R4_ = v4; - WriteReg(WRMPYA, R6_); uint8 v6 = 56; - if (!R7_) { - WriteReg(WRMPYB, 0x38); - uint8 t = ReadReg(RDMPYL) >> 7; - v6 = ReadReg(RDMPYH) + t; + if (r6 < 256) { + uint16 mult = Mult8x8(r6, v6); + uint8 t = (uint8)mult >> 7; + v6 = (mult >> 8) + t; } - v3 = R3_ & 1; - R3_ >>= 1; + v3 = (r2w >> 8) & 1; if (v3) v6 = -v6; - R6_ = v6; k = spr_current_slotid; uint8 v13 = spr_xpos_lo[k]; - uint16 xpos = mirror_m7_center_xpos + (int8)R4_ + 64; + uint16 xpos = mirror_m7_center_xpos + (int8)v4 + 64; SetSprXPos(k, xpos); spr_table1528[k] = spr_xpos_lo[k] - v13; - SetSprYPos(k, mirror_m7_center_ypos + (int8)R6_ + 32); + SetSprYPos(k, mirror_m7_center_ypos + (int8)v6 + 32); if (spr_table151c[k]) { SolidSpriteBlock(k); @@ -1684,37 +1990,37 @@ void Spr0A9_Reznor_ReznorFireRt(uint8 k) { // 039af8 SetHiLo(&ext_spr_xpos_hi[j], &ext_spr_xpos_lo[j], xpos - 8); SetHiLo(&ext_spr_ypos_hi[j], &ext_spr_ypos_lo[j], ypos - 20); SetSprXYPos(k, xpos - 8, ypos - 20); - AimTowardsPlayer_Bank23(k, 0x10); + PointU8 pt = AimTowardsPlayer_Bank23(k, 0x10); SetSprXYPos(k, xpos, ypos); - ext_spr_yspeed[j] = R0_; - ext_spr_xspeed[j] = R1_; + ext_spr_yspeed[j] = pt.y; + ext_spr_xspeed[j] = pt.x; } void Spr0A9_Reznor_Draw(uint8 k) { // 039b75 - uint8 drt; + GetDrawInfoRes drt; if (spr_table151c[k]) goto LABEL_10; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R3_ = 4 * spr_table1602[k]; - R2_ = 4 * spr_table157c[k]; + uint8 r3 = 4 * spr_table1602[k]; + uint8 r2 = 4 * spr_table157c[k]; uint8 ka = k; uint8 v2 = 3; do { uint8 v6 = v2; - if (R3_ < 8) - v2 |= R2_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0A9_Reznor_XDisp[v2] + R0_; - oam[64].ypos = kSpr0A9_Reznor_YDisp[v6] + R1_; - uint8 v4 = R3_ | v6; - oam[64].charnum = kSpr0A9_Reznor_Tiles[R3_ | v6]; + if (r3 < 8) + v2 |= r2; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0A9_Reznor_XDisp[v2] + drt.x; + oam[64].ypos = kSpr0A9_Reznor_YDisp[v6] + drt.y; + uint8 v4 = r3 | v6; + oam[64].charnum = kSpr0A9_Reznor_Tiles[r3 | v6]; uint8 v5 = kSpr0A9_Reznor_Prop[v4]; - if (v4 < 8 && !R2_) + if (v4 < 8 && !r2) v5 ^= 0x40; oam[64].flags = v5; - drt += 4; + drt.idx += 4; v2 = v6 - 1; } while ((int8)v2 >= 0); k = ka; @@ -1725,18 +2031,17 @@ void Spr0A9_Reznor_Draw(uint8 k) { // 039b75 } void Spr0A9_Reznor_PlatformDraw(uint8 k) { // 039beb - uint8 drt; + GetDrawInfoRes drt; spr_oamindex[k] += 16; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = kSpr0A9_Reznor_PlatformYDisp[spr_decrementing_table1564[k] >> 1]; - uint8 v2 = R0_; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[65].xpos = R0_; - oam[64].xpos = v2 - 16; - int8 v4 = R1_ - R2_; - oam[64].ypos = R1_ - R2_; + uint8 r2 = kSpr0A9_Reznor_PlatformYDisp[spr_decrementing_table1564[k] >> 1]; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[65].xpos = drt.x; + oam[64].xpos = drt.x - 16; + int8 v4 = drt.y - r2; + oam[64].ypos = drt.y - r2; oam[65].ypos = v4; oam[64].charnum = 78; oam[65].charnum = 78; @@ -1788,9 +2093,10 @@ void Spr06F_DinoTorch2(uint8 k) { // 039c47 spr_table1602[k] = v8 & 0xF; spr_table151c[k] = v8 >> 4; if (!(v8 >> 4) && spr_spriteid[k] != 110 && ((counter_global_frames ^ k) & 3) == 0) { - Spr06F_DinoTorch_DinoFlameClipping(k); - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - if (StandardSpriteToSpriteCollisionChecks_CheckContact()) { + CollInfo ci; + Spr06F_DinoTorch_DinoFlameClipping(k, &ci); + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + if (StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) { if (!timer_star_power) DamagePlayer_Hurt(); } @@ -1823,14 +2129,14 @@ void Spr06F_DinoTorch2(uint8 k) { // 039c47 } } -void Spr06F_DinoTorch_DinoFlameClipping(uint8 k) { // 039db6 +void Spr06F_DinoTorch_DinoFlameClipping(uint8 k, CollInfo *ci) { // 039db6 uint8 j = spr_table1602[k] - 2; if (!spr_table157c[k]) j = spr_table1602[k]; - SetHiLo(&R10_, &R4_, GetSprXPos(k) + PAIR16(kSpr06F_DinoTorch_DinoFlame2[j], kSpr06F_DinoTorch_DinoFlame1[j])); - R6_ = kSpr06F_DinoTorch_DinoFlame3[j]; - SetHiLo(&R11_, &R5_, GetSprYPos(k) + PAIR16(kSpr06F_DinoTorch_DinoFlame5[j], kSpr06F_DinoTorch_DinoFlame4[j])); - R7_ = kSpr06F_DinoTorch_DinoFlame6[j]; + SetHiLo(&ci->r10, &ci->r4, GetSprXPos(k) + PAIR16(kSpr06F_DinoTorch_DinoFlame2[j], kSpr06F_DinoTorch_DinoFlame1[j])); + ci->r6 = kSpr06F_DinoTorch_DinoFlame3[j]; + SetHiLo(&ci->r11, &ci->r5, GetSprYPos(k) + PAIR16(kSpr06F_DinoTorch_DinoFlame5[j], kSpr06F_DinoTorch_DinoFlame4[j])); + ci->r7 = kSpr06F_DinoTorch_DinoFlame6[j]; } void Spr06F_DinoTorch_DinoSetGfxFrame(uint8 k) { // 039def @@ -1838,60 +2144,60 @@ void Spr06F_DinoTorch_DinoSetGfxFrame(uint8 k) { // 039def } void Spr06F_DinoTorch_Draw(uint8 k) { // 039e49 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = spr_table157c[k]; - R4_ = spr_table1602[k]; + uint8 r2 = spr_table157c[k]; + uint8 r4 = spr_table1602[k]; if (spr_spriteid[k] == 111) { - R3_ = spr_table151c[k]; - R4_ = spr_table1602[k]; + uint8 r3 = spr_table151c[k]; + r4 = spr_table1602[k]; uint8 v4 = 32 * (counter_local_frames & 2); - if (R4_ != 3) + if (r4 != 3) v4 = (counter_local_frames & 2) << 6; - R5_ = v4; + uint8 r5 = v4; uint8 v5 = 4; do { - R6_ = v5; - if (R4_ == 3) + uint8 r6 = v5; + if (r4 == 3) v5 += 5; uint8 v6 = kSpr06F_DinoTorch_DinoTorchXDisp[v5]; - if (!R2_) + if (!r2) v6 = -v6; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_ + v6; - oam[64].ypos = R1_ + kSpr06F_DinoTorch_DinoTorchYDisp[v5]; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x + v6; + oam[64].ypos = drt.y + kSpr06F_DinoTorch_DinoTorchYDisp[v5]; uint8 v8; - if (R6_ == 4) - v8 = kSpr06F_DinoTorch_DinoTorchTiles[R4_]; + if (r6 == 4) + v8 = kSpr06F_DinoTorch_DinoTorchTiles[r4]; else v8 = kSpr06F_DinoTorch_DinoFlameTiles[v5]; oam[64].charnum = v8; int8 v9 = 0; - if (!R2_) + if (!r2) v9 = 64; - uint8 v10 = R6_; - if (R6_ != 4) - v9 ^= R5_; - oam[64].flags = sprites_tile_priority | kSpr06F_DinoTorch_DinoTorchProp[R6_] | v9; - drt += 4; + uint8 v10 = r6; + if (r6 != 4) + v9 ^= r5; + oam[64].flags = sprites_tile_priority | kSpr06F_DinoTorch_DinoTorchProp[r6] | v9; + drt.idx += 4; v5 = v10 - 1; - } while ((int8)(v5 - R3_) >= 0); + } while ((int8)(v5 - r3) >= 0); FinishOAMWrite(k, 2, kSpr06F_DinoTorch_DinoTilesWritten[spr_table151c[k]]); } else { uint8 v2 = 3; do { - R15_ = v2; - if (!R2_) + uint8 r15 = v2; + if (!r2) v2 += 4; - OamEnt *v3 = get_OamEnt(oam_buf, drt); + OamEnt *v3 = get_OamEnt(oam_buf, drt.idx); v3[64].flags = kSpr06F_DinoTorch_DinoRhinoProp[v2]; - v3[64].xpos = R0_ + kSpr06F_DinoTorch_DinoRhinoXDisp[v2]; - v3[64].ypos = R1_ + (R4_ != 0) + kSpr06F_DinoTorch_DinoRhinoYDisp[R15_]; - v3[64].charnum = kSpr06F_DinoTorch_DinoRhinoTiles[(uint8)(R15_ + __CFSHL__(2 * R4_, 1) + 4 * R4_)]; - drt += 4; - v2 = R15_ - 1; + v3[64].xpos = drt.x + kSpr06F_DinoTorch_DinoRhinoXDisp[v2]; + v3[64].ypos = drt.y + (r4 != 0) + kSpr06F_DinoTorch_DinoRhinoYDisp[r15]; + v3[64].charnum = kSpr06F_DinoTorch_DinoRhinoTiles[r15 + 4 * r4]; + drt.idx += 4; + v2 = r15 - 1; } while ((int8)v2 >= 0); FinishOAMWrite(k, 2, 3); } @@ -1972,8 +2278,7 @@ void Spr0A8_Blargg(uint8 k) { // 039f38 default: Unreachable(); return; } } else if (!(spr_decrementing_table1540[k] | spr_xoffscreen_flag[k])) { - CheckPlayerPositionRelativeToSprite_Bank23_X(k); - if ((uint8)(R15_ + 112) < 0xE0) { + if ((uint8)(player_xpos - GetSprXPos(k) + 112) < 0xE0) { spr_yspeed[k] = -29; SetHiLo(&spr_table151c[k], &spr_table1528[k], GetSprXPos(k)); SetHiLo(&spr_table1534[k], &spr_table1594[k], GetSprYPos(k)); @@ -1996,27 +2301,27 @@ void Spr0A8_Blargg_03A045(uint8 k) { // 03a045 } void Spr0A8_Blargg_Draw(uint8 k) { // 03a062 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; uint8 v2 = spr_table00c2[k]; if (v2) { if (v2 == 4) { - R3_ = 5 * (spr_table1602[k] != 0); // out of bounds read - R2_ = spr_table157c[k]; + uint8 r3 = 5 * (spr_table1602[k] != 0); // out of bounds read + uint8 r2 = spr_table157c[k]; uint8 v4n = 4; do { uint8 v4 = v4n; uint8 v6 = v4; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].ypos = kSpr0A8_Blargg_YDisp[v4] + R1_; - if (!R2_) + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].ypos = kSpr0A8_Blargg_YDisp[v4] + drt.y; + if (!r2) v4 += 5; - oam[64].xpos = kSpr0A8_Blargg_XDisp[v4] + R0_; - oam[64].charnum = kSpr0A8_Blargg_Tiles[(uint8)(R3_ + v6)]; - oam[64].flags = kSpr0A8_Blargg_Prop[R2_]; - drt += 4; + oam[64].xpos = kSpr0A8_Blargg_XDisp[v4] + drt.x; + oam[64].charnum = kSpr0A8_Blargg_Tiles[(uint8)(r3 + v6)]; + oam[64].flags = kSpr0A8_Blargg_Prop[r2]; + drt.idx += 4; } while ((int8)--v4n >= 0); FinishOAMWrite(k, 2, 4); } else { @@ -2093,16 +2398,16 @@ void Spr0A0_ActivateBowserBattle_Sub(uint8 k) { // 03a279 LOBYTE(mirror_m7_center_xpos) = -112; LOBYTE(mirror_m7_center_ypos) = -56; UpdateMode7SpriteAnimations(k); - if (temp14b5) + if (bowserbattle_var14b5) Spr0A0_ActivateBowserBattle_03AF59(k); if (spr_decrementing_table1564[k]) Spr0A0_ActivateBowserBattle_SmokeDraw(k); uint8 v1 = spr_table1594[k]; if (v1) { uint8 v2 = (uint8)(v1 - 1) >> 3; - R2_ = kSpr0A0_ActivateBowserBattle_DATA_03A8BE[v2]; - R3_ = ((uint8)(v1 - 1) >> 2) & 3; - Spr07C_PrincessPeach_GFXRt_DrawHELP(k, v2); + uint8 r2 = kSpr0A0_ActivateBowserBattle_DATA_03A8BE[v2]; + uint8 r3 = ((uint8)(v1 - 1) >> 2) & 3; + Spr07C_PrincessPeach_GFXRt_DrawHELP(k, v2, r2, r3); } if (!flag_sprites_locked) { spr_table1594[k] = 0; @@ -2111,8 +2416,8 @@ void Spr0A0_ActivateBowserBattle_Sub(uint8 k) { // 03a279 sprites_tile_priority = 0; if (Spr0A0_ActivateBowserBattle_ReturnsTwice_03A661(k)) return; - if (temp14b0 && (counter_global_frames & 3) == 0) - --temp14b0; + if (bowserbattle_var14b0 && (counter_global_frames & 3) == 0) + --bowserbattle_var14b0; if ((counter_global_frames & 0x7F) == 0 && (GetRand() & 1) == 0) spr_decrementing_table1558[k] = 12; Spr0A0_ActivateBowserBattle_03B078(k); @@ -2130,19 +2435,20 @@ void Spr0A0_ActivateBowserBattle_Sub(uint8 k) { // 03a279 } void Spr0A0_ActivateBowserBattle_SmokeDraw(uint8 k) { // 03a3e2 - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R3_ = (uint8)(spr_decrementing_table1564[k] - 1) >> 1; - R2_ = 8 * R3_; + uint8 r3 = (uint8)(spr_decrementing_table1564[k] - 1) >> 1; + uint8 r2 = 8 * r3; spr_oamindex[k] = 112; uint8 v1 = 112; uint8 v2 = 7; do { - uint8 v3 = R2_ | v2; + uint8 v3 = r2 | v2; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = kSpr0A0_ActivateBowserBattle_SmokeXDisp[v3] + R0_ + 8; - oam[64].ypos = kSpr0A0_ActivateBowserBattle_SmokeYDisp[v3] + R1_ + 48; - oam[64].charnum = kSpr0A0_ActivateBowserBattle_SmokeTiles[R3_]; + oam[64].xpos = kSpr0A0_ActivateBowserBattle_SmokeXDisp[v3] + drt.x + 8; + oam[64].ypos = kSpr0A0_ActivateBowserBattle_SmokeYDisp[v3] + drt.y + 48; + oam[64].charnum = kSpr0A0_ActivateBowserBattle_SmokeTiles[r3]; oam[64].flags = kSpr0A0_ActivateBowserBattle_SmokeProp[v2]; v1 += 4; } while ((int8)--v2 >= 0); @@ -2154,7 +2460,7 @@ void Spr0A0_ActivateBowserBattle_State00_InitialDescent(uint8 k) { // 03a441 if (v1) { if (v1 == 1) { spr_table151c[k] = 7; - temp14b0 = 120; + bowserbattle_var14b0 = 120; } } else { uint8 v2 = spr_decrementing_table1540[k]; @@ -2205,34 +2511,34 @@ void Spr0A0_ActivateBowserBattle_03A4ED(uint8 k) { // 03a4ed } void Spr0A0_ActivateBowserBattle_03A4FD(uint8 k) { // 03a4fd - if (!temp14b0) { - if (spr_table151c[k] != 8 || (++temp14b8, temp14b8 == 3)) { - temp14b8 = 0; + if (!bowserbattle_var14b0) { + if (spr_table151c[k] != 8 || (++bowserbattle_var14b8, bowserbattle_var14b8 == 3)) { + bowserbattle_var14b8 = 0; if (!spr_current_status[0] || !spr_current_status[1]) - temp14b1 = -1; + bowserbattle_var14b1 = -1; } else { - temp14b6 = -1; + bowserbattle_var14b6 = -1; } } } uint8 Spr0A0_ActivateBowserBattle_ReturnsTwice_03A5AD(uint8 k) { // 03a5ad - uint8 v1 = temp14b1; - if (temp14b1) { - if (--temp14b1) { + uint8 v1 = bowserbattle_var14b1; + if (bowserbattle_var14b1) { + if (--bowserbattle_var14b1) { spr_table1570[k] = kSpr0A0_ActivateBowserBattle_DATA_03A52D[v1 >> 2]; - if (temp14b1 == 0x80) { + if (bowserbattle_var14b1 == 0x80) { Spr0A0_ActivateBowserBattle_03B019(k); io_sound_ch3 = 8; } return true; } else { - temp14b0 = 84; + bowserbattle_var14b0 = 84; } } else { - uint8 v2 = temp14b6; - if (temp14b6) { - if (--temp14b6) { + uint8 v2 = bowserbattle_var14b6; + if (bowserbattle_var14b6) { + if (--bowserbattle_var14b6) { spr_table1570[k] = kSpr0A0_ActivateBowserBattle_DATA_03A52D[v2 >> 2]; uint8 v3 = kSpr0A0_ActivateBowserBattle_DATA_03A56D[v2 >> 2]; misc_m7_rotation = v3; @@ -2241,13 +2547,13 @@ uint8 Spr0A0_ActivateBowserBattle_ReturnsTwice_03A5AD(uint8 k) { // 03a5ad ++HIBYTE(misc_m7_rotation); sprites_tile_priority = 0; } - if (temp14b6 == 0x80) { + if (bowserbattle_var14b6 == 0x80) { io_sound_ch3 = 9; Spr0A0_ActivateBowserBattle_03A61D(k); } return true; } else { - temp14b0 = (temp14b8 != 2) ? 32 : 96; + bowserbattle_var14b0 = (bowserbattle_var14b8 != 2) ? 32 : 96; } } } @@ -2263,13 +2569,13 @@ void Spr0A0_ActivateBowserBattle_03A61D(uint8 k) { // 03a61d uint8 Spr0A0_ActivateBowserBattle_ReturnsTwice_03A661(uint8 k) { // 03a661 uint8 res = false; - uint8 v1 = temp14b5; - if (temp14b5) { - temp14b1 = 0; - temp14b6 = 0; - if (!--temp14b5) { + uint8 v1 = bowserbattle_var14b5; + if (bowserbattle_var14b5) { + bowserbattle_var14b1 = 0; + bowserbattle_var14b6 = 0; + if (!--bowserbattle_var14b5) { v1 = 80; - temp14b0 = 80; + bowserbattle_var14b0 = 80; if (spr_table187b[k]-- == 1) { if (spr_table151c[k] == 9) { spr_table151c[k] = 4; @@ -2284,7 +2590,7 @@ uint8 Spr0A0_ActivateBowserBattle_ReturnsTwice_03A661(uint8 k) { // 03a661 } res = true; uint8 v4 = v1; - int8 v3 = kSpr0A0_ActivateBowserBattle_DATA_03A64D[temp14b5 >> 2]; + int8 v3 = kSpr0A0_ActivateBowserBattle_DATA_03A64D[bowserbattle_var14b5 >> 2]; misc_m7_rotation = (uint8)v3; if (v3 < 0) ++HIBYTE(misc_m7_rotation); @@ -2328,7 +2634,7 @@ void Spr0A0_ActivateBowserBattle_State01_SwoopOut(uint8 k) { // 03a6f8 spr_yspeed[k] = 0; spr_table1528[k] = 0; spr_table1534[k] = 0; - temp14b2 = 0; + bowserbattle_var14b2 = 0; } else { uint8 v2 = spr_table1528[k]; if (v2 < 2 && (kSpr0A0_ActivateBowserBattle_DATA_03A723[v2] & counter_global_frames) == 0) { @@ -2342,19 +2648,19 @@ void Spr0A0_ActivateBowserBattle_State01_SwoopOut(uint8 k) { // 03a6f8 if (spr_yspeed[k] == kSpr0A0_ActivateBowserBattle_DATA_03A727[v4]) ++spr_table1534[k]; } - if (temp14b2 == 2) + if (bowserbattle_var14b2 == 2) goto LABEL_18; - if ((kSpr0A0_ActivateBowserBattle_DATA_03A72F[temp14b2] & counter_global_frames) == 0) { - LOBYTE(misc_m7_angle) = kSpr0A0_ActivateBowserBattle_DATA_03A729[temp14b2] + misc_m7_angle; + if ((kSpr0A0_ActivateBowserBattle_DATA_03A72F[bowserbattle_var14b2] & counter_global_frames) == 0) { + LOBYTE(misc_m7_angle) = kSpr0A0_ActivateBowserBattle_DATA_03A729[bowserbattle_var14b2] + misc_m7_angle; HIBYTE(misc_m7_angle) = misc_m7_angle; - if ((uint8)misc_m7_angle == kSpr0A0_ActivateBowserBattle_DATA_03A72D[temp14b2]) - ++temp14b2; + if ((uint8)misc_m7_angle == kSpr0A0_ActivateBowserBattle_DATA_03A72D[bowserbattle_var14b2]) + ++bowserbattle_var14b2; } if (spr_xpos_hi[k] == 0xFE) { LABEL_18: spr_table151c[k] = 3; - temp14b0 = 0x80; - temp14b7 = GetRand() & 0xF0; + bowserbattle_var14b0 = 0x80; + bowserbattle_var14b7 = GetRand() & 0xF0; io_music_ch1 = 29; } } @@ -2363,8 +2669,8 @@ void Spr0A0_ActivateBowserBattle_State01_SwoopOut(uint8 k) { // 03a6f8 void Spr0A0_ActivateBowserBattle_State03_DropFireballs(uint8 k) { // 03a7ad misc_m7_angle = 0x6060; SetSprXPos(k, -160); - if (temp14b0) { - if (temp14b0 < 0x60 && (counter_global_frames & 0x1F) == 0) { + if (bowserbattle_var14b0) { + if (bowserbattle_var14b0 < 0x60 && (counter_global_frames & 0x1F) == 0) { uint8 j = 7; while (spr_current_status[j]) { if (--j == 1) @@ -2373,8 +2679,8 @@ void Spr0A0_ActivateBowserBattle_State03_DropFireballs(uint8 k) { // 03a7ad io_sound_ch3 = 23; spr_current_status[j] = 8; spr_spriteid[j] = 51; - uint8 v3 = temp14b7; - temp14b7 = v3 + 32; + uint8 v3 = bowserbattle_var14b7; + bowserbattle_var14b7 = v3 + 32; SetSprXYPos(j, v3, 0); InitializeNormalSpriteRAMTables(j); ++spr_table00c2[j]; @@ -2402,17 +2708,17 @@ void Spr0A0_ActivateBowserBattle_State02_SwoopIn(uint8 k) { // 03a84b spr_xspeed[k] = 0; spr_yspeed[k] = 0; if (v1 == 1) { - spr_table151c[k] = temp14b4 + 1; + spr_table151c[k] = bowserbattle_var14b4 + 1; spr_xspeed[k] = 0; spr_yspeed[k] = 0; - temp14b0 = 0x80; + bowserbattle_var14b0 = 0x80; } else if (v1 >= 0x40) { if (v1 == 0xE8) io_sound_ch1 = 42; spr_table1594[k] = v1 - 63; } else { if (v1 == 63) - io_music_ch1 = kSpr0A0_ActivateBowserBattle_RainingFireSounds[temp14b4 + 1]; + io_music_ch1 = kSpr0A0_ActivateBowserBattle_RainingFireSounds[bowserbattle_var14b4 + 1]; spr_table1570[k] = kSpr0A0_ActivateBowserBattle_DuckingAnimationFrames[v1 >> 3]; } } else { @@ -2449,16 +2755,16 @@ void Spr0A0_ActivateBowserBattle_03A8D6(uint8 k) { // 03a8d6 spr_xspeed[j] = v5; } -void Spr07C_PrincessPeach_GFXRt_DrawHELP(uint8 k, uint8 j) { // 03aa6e - R0_ = spr_xpos_lo[k] + 4 - mirror_current_layer1_xpos; - R1_ = spr_ypos_lo[k] + 32 - R2_ - mirror_current_layer1_ypos; +void Spr07C_PrincessPeach_GFXRt_DrawHELP(uint8 k, uint8 j, uint8 r2, uint8 r3) { // 03aa6e + uint8 r0 = spr_xpos_lo[k] + 4 - mirror_current_layer1_xpos; + uint8 r1 = spr_ypos_lo[k] + 32 - r2 - mirror_current_layer1_ypos; if (j >= 8 && j < 0x10) { - int8 v2 = R0_ - 4; + int8 v2 = r0 - 4; OamEnt *oam = get_OamEnt(oam_buf, 0); - oam[40].xpos = R0_ - 4; + oam[40].xpos = r0 - 4; oam[41].xpos = v2 + 16; - int8 v4 = R1_ - 24; - oam[40].ypos = R1_ - 24; + int8 v4 = r1 - 24; + oam[40].ypos = r1 - 24; oam[41].ypos = v4; oam[40].charnum = 32; oam[41].charnum = 34; @@ -2468,18 +2774,18 @@ void Spr07C_PrincessPeach_GFXRt_DrawHELP(uint8 k, uint8 j) { // 03aa6e sprites_oamtile_size_buffer[40] = 2; sprites_oamtile_size_buffer[41] = 2; } - Spr07C_PrincessPeach_GFXRt_DrawPeach(k, 0x70); + Spr07C_PrincessPeach_GFXRt_DrawPeach(k, 0x70, (PointU8) { .x = r0, .y = r1 }, r3); } -void Spr07C_PrincessPeach_GFXRt_DrawPeach(uint8 k, uint8 j) { // 03aac8 - R4_ = 4 * R3_; +void Spr07C_PrincessPeach_GFXRt_DrawPeach(uint8 k, uint8 j, PointU8 pt, uint8 r3) { // 03aac8 + uint8 r4 = 4 * r3; int8 v2 = 3; do { int8 v6 = v2; - uint8 v3 = R4_ + v2; + uint8 v3 = r4 + v2; OamEnt *oam = get_OamEnt(oam_buf, j); - oam[64].xpos = kSpr07C_PrincessPeach_PeachXDisp[v3] + R0_; - oam[64].ypos = kSpr07C_PrincessPeach_PeachYDisp[v3] + R1_; + oam[64].xpos = kSpr07C_PrincessPeach_PeachXDisp[v3] + pt.x; + oam[64].ypos = kSpr07C_PrincessPeach_PeachYDisp[v3] + pt.y; oam[64].charnum = kSpr07C_PrincessPeach_PeachTiles[v3]; uint8 v5 = kSpr07C_PrincessPeach_PeachProp[v3]; if (spr_current_slotid != 9) @@ -2589,8 +2895,8 @@ void Spr0A0_ActivateBowserBattle_03AC63(uint8 k) { // 03ac63 } void Spr07C_PrincessPeach(uint8 k) { // 03ac97 - R0_ = spr_xpos_lo[k] - mirror_current_layer1_xpos; - R1_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; + uint8 r0 = spr_xpos_lo[k] - mirror_current_layer1_xpos; + uint8 r1 = spr_ypos_lo[k] - mirror_current_layer1_ypos; if ((counter_global_frames & 0x7F) == 0 && (GetRand() & 7) == 0) spr_decrementing_table154c[k] = 12; uint8 v1 = spr_table1602[k]; @@ -2598,9 +2904,9 @@ void Spr07C_PrincessPeach(uint8 k) { // 03ac97 ++v1; if (!spr_table157c[k]) v1 += 8; - R3_ = v1; + uint8 r3 = v1; spr_oamindex[k] = -48; - Spr07C_PrincessPeach_GFXRt_DrawPeach(k, 0xD0); + Spr07C_PrincessPeach_GFXRt_DrawPeach(k, 0xD0, (PointU8) { .x = r0, .y = r1 }, r3); FinishOAMWrite(k, 2, 3); if (spr_decrementing_table1558[k]) { uint8 ka = k; @@ -2660,9 +2966,10 @@ void Spr07C_PrincessPeach_WaitAfterFall(uint8 k) { // 03adb3 } uint8 Spr07C_PrincessPeach_03ADCC(uint8 k) { // 03adcc - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - StandardSpriteToSpriteCollisionChecks_GetMarioClipping(); - return StandardSpriteToSpriteCollisionChecks_CheckContact(); + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + StandardSpriteToSpriteCollisionChecks_GetMarioClipping(&ci); + return StandardSpriteToSpriteCollisionChecks_CheckContact(&ci); } void Spr07C_PrincessPeach_WalkTowardsBro(uint8 k) { // 03addd @@ -2707,6 +3014,8 @@ void Spr07C_PrincessPeach_KissBro(uint8 k) { // 03ae32 player_relative_yposition_during_screen_shake = 0; } if (v1 >= 0x50) { + if (v1 == 0x50) + spr_decrementing_table154c[k] = 0x14; spr_table1602[k] = 10; if (v1 == 104) spr_decrementing_table1558[k] = 0x80; @@ -2737,16 +3046,15 @@ void Spr07C_PrincessPeach_FadeText(uint8 k) { // 03aee8 uint8 v1 = spr_decrementing_table1540[k]; if (v1) { - R0_ = v1 >> 1; - R1_ = 0; - R0_W |= 32 * R0_W; - R0_W |= 32 * R0_W; + uint16 r0w = v1 >> 1; + r0w |= 32 * r0w; + r0w |= 32 * r0w; uint8 v2 = palettes_dynamic_palette_upload_index; v3 = palettes_dynamic_palette_upload_index; *(&palettes_dynamic_palette_bytes_to_upload + palettes_dynamic_palette_upload_index) = 2; *(&palettes_dynamic_palette_cgramaddress + v3) = -15; - palettes_dynamic_palette_colors[v2] = R0_; - palettes_dynamic_palette_colors[v2 + 1] = R1_; + palettes_dynamic_palette_colors[v2] = r0w; + palettes_dynamic_palette_colors[v2 + 1] = r0w >> 8; palettes_dynamic_palette_colors[v2 + 2] = 0; palettes_dynamic_palette_upload_index = v2 + 4; Spr07C_PrincessPeach_DisplayPeachRescueMessage(); @@ -2756,28 +3064,29 @@ void Spr07C_PrincessPeach_FadeText(uint8 k) { // 03aee8 } void Spr0A0_ActivateBowserBattle_03AF59(uint8 k) { // 03af59 - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R4_ = spr_table157c[k]; - R2_ = (counter_local_frames >> 2) & 7; + uint8 r4 = spr_table157c[k]; + uint8 r2 = (counter_local_frames >> 2) & 7; spr_oamindex[k] = -20; uint8 v1 = -20; int8 v2 = 3; do { - uint8 v3 = (R2_ + __CFSHL__(2 * v2, 1) + 4 * v2) & 7; + uint8 v3 = (r2 + __CFSHL__(2 * v2, 1) + 4 * v2) & 7; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = kSpr0A0_ActivateBowserBattle_DATA_03AF34[v3] + R0_; - oam[64].ypos = kSpr0A0_ActivateBowserBattle_DATA_03AF3C[v3] + R1_; + oam[64].xpos = kSpr0A0_ActivateBowserBattle_DATA_03AF34[v3] + drt.x; + oam[64].ypos = kSpr0A0_ActivateBowserBattle_DATA_03AF3C[v3] + drt.y; oam[64].charnum = 89; oam[64].flags = sprites_tile_priority | kSpr0A0_ActivateBowserBattle_DATA_03AF44[v3]; v1 += 4; } while ((int8)--v2 >= 0); - uint8 v5 = temp14b3++; + uint8 v5 = bowserbattle_var14b3++; uint8 v6 = v5 >> 3; if (v6 < 0xD) { OamEnt *v7 = get_OamEnt(oam_buf, 0xFC); - v7[64].xpos = R0_ + __CFSHL__(4 * (4 * R4_ + __CFSHL__(R4_, 1)), 1) + 8 * (4 * R4_ + __CFSHL__(R4_, 1)) + 21; - v7[64].ypos = kSpr0A0_ActivateBowserBattle_DATA_03AF4C[v6] + R1_; + v7[64].xpos = drt.x + __CFSHL__(4 * (4 * r4 + __CFSHL__(r4, 1)), 1) + 8 * (4 * r4 + __CFSHL__(r4, 1)) + 21; + v7[64].ypos = kSpr0A0_ActivateBowserBattle_DATA_03AF4C[v6] + drt.y; v7[64].charnum = 73; v7[64].flags = sprites_tile_priority | 7; } @@ -2792,13 +3101,11 @@ void Spr0A0_ActivateBowserBattle_03AF59(uint8 k) { // 03af59 } void Spr0A0_ActivateBowserBattle_03B019(uint8 k) { // 03b019 - R2_ = 0; - Spr0A0_ActivateBowserBattle_03B020(k); - ++R2_; - Spr0A0_ActivateBowserBattle_03B020(k); + Spr0A0_ActivateBowserBattle_03B020(k, 0); + Spr0A0_ActivateBowserBattle_03B020(k, 1); } -void Spr0A0_ActivateBowserBattle_03B020(uint8 k) { // 03b020 +void Spr0A0_ActivateBowserBattle_03B020(uint8 k, uint8 r2) { // 03b020 uint8 j = 1; while (spr_current_status[j]) { if ((--j & 0x80) != 0) @@ -2807,9 +3114,9 @@ void Spr0A0_ActivateBowserBattle_03B020(uint8 k) { // 03b020 spr_current_status[j] = 8; spr_spriteid[j] = -94; SetSprYPos(j, GetSprYPos(k) + 16); - SetSprXPos(j, GetSprXPos(k) + PAIR16(kSpr0A0_ActivateBowserBattle_DATA_03B015[R2_], kSpr0A0_ActivateBowserBattle_DATA_03B013[R2_])); + SetSprXPos(j, GetSprXPos(k) + PAIR16(kSpr0A0_ActivateBowserBattle_DATA_03B015[r2], kSpr0A0_ActivateBowserBattle_DATA_03B013[r2])); InitializeNormalSpriteRAMTables(j); - spr_xspeed[j] = kSpr0A0_ActivateBowserBattle_DATA_03B017[R2_]; + spr_xspeed[j] = kSpr0A0_ActivateBowserBattle_DATA_03B017[r2]; spr_yspeed[j] = -64; } @@ -2823,7 +3130,7 @@ void Spr0A0_ActivateBowserBattle_03B078(uint8 k) { // 03b078 player_yspeed = 0; uint8 v1 = CheckPlayerPositionRelativeToSprite_Bank23_X(k); uint8 v2; - if (temp14b6 | temp14b1) + if (bowserbattle_var14b6 | bowserbattle_var14b1) v2 = kSpr0A0_ActivateBowserBattle_DATA_03B076[v1]; else v2 = kSpr0A0_ActivateBowserBattle_DATA_03B074[v1]; @@ -2858,17 +3165,18 @@ void Spr0A0_ActivateBowserBattle_03B0DC(uint8 k) { // 03b0dc } void Spr0A0_ActivateBowserBattle_03B0F3(uint8 k, uint8 j) { // 03b0f3 - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j); + CollInfo ci; + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(j, &ci); spr_property_bits1662[k] = 36; - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (!(StandardSpriteToSpriteCollisionChecks_CheckContact())) { + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (!(StandardSpriteToSpriteCollisionChecks_CheckContact(&ci))) { ++spr_property_bits1662[k]; - StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k); - if (!(StandardSpriteToSpriteCollisionChecks_CheckContact()) || temp14b5) + StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(k, &ci); + if (!(StandardSpriteToSpriteCollisionChecks_CheckContact(&ci)) || bowserbattle_var14b5) return; - temp14b5 = 76; - temp14b3 = 0; - temp14b4 = spr_table151c[k]; + bowserbattle_var14b5 = 76; + bowserbattle_var14b3 = 0; + bowserbattle_var14b4 = spr_table151c[k]; io_sound_ch3 = 40; if (spr_table151c[k] == 9 && spr_table187b[k] == 1) DespawnNonBossSprites(); @@ -2910,19 +3218,19 @@ void Spr0A1_BowserBowlingBall(uint8 k) { // 03b163 } void Spr0A1_BowserBowlingBall_Draw(uint8 k) { // 03b221 - uint8 drt; + GetDrawInfoRes drt; spr_oamindex[k] = 112; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; for (uint8 i = 11; (i & 0x80) == 0; --i) { - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0A1_BowserBowlingBall_XDisp[i] + R0_; - oam[64].ypos = kSpr0A1_BowserBowlingBall_YDisp[i] + R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0A1_BowserBowlingBall_XDisp[i] + drt.x; + oam[64].ypos = kSpr0A1_BowserBowlingBall_YDisp[i] + drt.y; oam[64].charnum = kSpr0A1_BowserBowlingBall_Tiles[i]; oam[64].flags = sprites_tile_priority | kSpr0A1_BowserBowlingBall_Prop[i]; - sprites_oamtile_size_buffer[(drt >> 2) + 64] = kSpr0A1_BowserBowlingBall_TileSize[i]; - drt += 4; + sprites_oamtile_size_buffer[(drt.idx >> 2) + 64] = kSpr0A1_BowserBowlingBall_TileSize[i]; + drt.idx += 4; } uint8 v6 = (spr_table1570[k] >> 3) & 7; OamEnt *v4 = get_OamEnt(oam_buf, spr_oamindex[k]); @@ -2961,7 +3269,7 @@ void Spr0A2_MechaKoopa_Draw(uint8 k) { // 03b307 } void Spr0A2_MechaKoopa_MechakoopaDraw(uint8 k) { // 03b355 - uint8 drt; + GetDrawInfoRes drt; spr_table15f6[k] = 11; uint8 v1 = spr_decrementing_table1540[k]; @@ -2973,23 +3281,23 @@ void Spr0A2_MechaKoopa_MechakoopaDraw(uint8 k) { // 03b355 if (spr_decrementing_table1540[k] < 0x30) spr_table15f6[k] = kSpr0A2_MechaKoopa_MechakoopaPalette[spr_decrementing_table1540[k] & 1]; } - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R4_ = spr_table15f6[k]; - uint8 v4 = drt + 12; - R3_ = 4 * spr_table1602[k]; - R2_ = (4 * spr_table157c[k]) ^ 4; + uint8 r4 = spr_table15f6[k]; + uint8 v4 = drt.idx + 12; + uint8 r3 = 4 * spr_table1602[k]; + uint8 r2 = (4 * spr_table157c[k]) ^ 4; uint8 v5 = 3; do { uint8 v9 = v5; sprites_oamtile_size_buffer[(v4 >> 2) + 64] = kSpr0A2_MechaKoopa_MechakoopaTileSize[v5]; - uint8 v6 = R2_ + v5; + uint8 v6 = r2 + v5; OamEnt *oam = get_OamEnt(oam_buf, v4); - oam[64].xpos = kSpr0A2_MechaKoopa_MechakoopaXDisp[v6] + R0_; - oam[64].flags = sprites_tile_priority | R4_ | kSpr0A2_MechaKoopa_MechakoopaProp[v6]; - uint8 v8 = R3_ + v9; - oam[64].charnum = kSpr0A2_MechaKoopa_MechakoopaTiles[(uint8)(R3_ + v9)]; - oam[64].ypos = kSpr0A2_MechaKoopa_MechakoopaYDisp[v8] + R1_; + oam[64].xpos = kSpr0A2_MechaKoopa_MechakoopaXDisp[v6] + drt.x; + oam[64].flags = sprites_tile_priority | r4 | kSpr0A2_MechaKoopa_MechakoopaProp[v6]; + uint8 v8 = r3 + v9; + oam[64].charnum = kSpr0A2_MechaKoopa_MechakoopaTiles[(uint8)(r3 + v9)]; + oam[64].ypos = kSpr0A2_MechaKoopa_MechakoopaYDisp[v8] + drt.y; v4 -= 4; v5 = v9 - 1; } while ((int8)v5 >= 0); @@ -2998,18 +3306,18 @@ void Spr0A2_MechaKoopa_MechakoopaDraw(uint8 k) { // 03b355 } void Spr0A2_MechaKoopa_KeyDraw(uint8 k) { // 03b3f7 - uint8 drt; + GetDrawInfoRes drt; spr_oamindex[k] += 16; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = (spr_table1570[k] >> 2) & 3; + uint8 r2 = (spr_table1570[k] >> 2) & 3; uint8 v2 = spr_table157c[k]; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr0A2_MechaKoopa_KeyXDisp[v2] + R0_; - oam[64].ypos = R1_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr0A2_MechaKoopa_KeyXDisp[v2] + drt.x; + oam[64].ypos = drt.y; oam[64].flags = sprites_tile_priority | kSpr0A2_MechaKoopa_KeyProp[v2]; - oam[64].charnum = kSpr0A2_MechaKoopa_KeyTiles[R2_]; + oam[64].charnum = kSpr0A2_MechaKoopa_KeyTiles[r2]; FinishOAMWrite(k, 0, 0); } @@ -3039,8 +3347,8 @@ void Spr0A0_ActivateBowserBattle_DrawItemBox() { // 03b44f void Spr0A0_ActivateBowserBattle_DrawCastleRoof() { // 03b4ac uint8 v0 = -68; - R1_ = 0; - R15_ = spra0_bowser_end_of_battle_flag; + uint8 r1 = 0; + uint8 r15 = spra0_bowser_end_of_battle_flag; int8 v1 = 16; if (spra0_bowser_end_of_battle_flag) { v0 = -112; @@ -3049,9 +3357,9 @@ void Spr0A0_ActivateBowserBattle_DrawCastleRoof() { // 03b4ac do { OamEnt *oam = get_OamEnt(oam_buf, v0); oam[64].ypos = -64 - mirror_current_layer1_ypos; - int8 v3 = R1_ - mirror_current_layer1_xpos; - oam[64].xpos = R1_ - mirror_current_layer1_xpos; - R1_ = v3 + 16; + int8 v3 = r1 - mirror_current_layer1_xpos; + oam[64].xpos = r1 - mirror_current_layer1_xpos; + r1 = v3 + 16; oam[64].charnum = 8; oam[64].flags = sprites_tile_priority | 0xD; sprites_oamtile_size_buffer[(v0 >> 2) + 64] = 2; @@ -3059,7 +3367,7 @@ void Spr0A0_ActivateBowserBattle_DrawCastleRoof() { // 03b4ac --v1; } while (v1 >= 0); uint8 v4 = 15; - if (R15_) { + if (r15) { uint8 v8 = 80; do { OamEnt *v9 = get_OamEnt(oam_buf, v8); @@ -3092,44 +3400,45 @@ void Spr0A0_ActivateBowserBattle_DrawCastleRoof() { // 03b4ac } } -void StandardSpriteToSpriteCollisionChecks_GetMarioClipping() { // 03b664 - SetHiLo(&R8_, &R0_, player_xpos + 2); - R2_ = 12; +void StandardSpriteToSpriteCollisionChecks_GetMarioClipping(CollInfo *ci) { // 03b664 + SetHiLo(&ci->r8, &ci->r0, player_xpos + 2); + ci->r2 = 12; uint8 v0 = 0; if (player_ducking_flag || !player_current_power_up) v0 = 1; if (player_riding_yoshi_flag) v0 += 2; - R3_ = kStandardSpriteToSpriteCollisionChecks_MarioClippingHeight[v0]; - SetHiLo(&R9_, &R1_, player_ypos + kStandardSpriteToSpriteCollisionChecks_MarioClipDispY[v0]); + ci->r3 = kStandardSpriteToSpriteCollisionChecks_MarioClippingHeight[v0]; + SetHiLo(&ci->r9, &ci->r1, player_ypos + kStandardSpriteToSpriteCollisionChecks_MarioClipDispY[v0]); } -void StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(uint8 k) { // 03b69f +void StandardSpriteToSpriteCollisionChecks_GetSpriteClippingA(uint8 k, CollInfo *ci) { // 03b69f uint8 v2 = spr_property_bits1662[k] & 0x3F; - SetHiLo(&R10_, &R4_, GetSprXPos(k) + (int8)kStandardSpriteToSpriteCollisionChecks_SprClippingDispX[v2]); - R6_ = kStandardSpriteToSpriteCollisionChecks_SprClippingWidth[v2]; - SetHiLo(&R11_, &R5_, GetSprYPos(k) + (int8)kStandardSpriteToSpriteCollisionChecks_SprClippingDispY[v2]); - R7_ = kStandardSpriteToSpriteCollisionChecks_SprClippingHeight[v2]; + SetHiLo(&ci->r10, &ci->r4, GetSprXPos(k) + (int8)kStandardSpriteToSpriteCollisionChecks_SprClippingDispX[v2]); + ci->r6 = kStandardSpriteToSpriteCollisionChecks_SprClippingWidth[v2]; + SetHiLo(&ci->r11, &ci->r5, GetSprYPos(k) + (int8)kStandardSpriteToSpriteCollisionChecks_SprClippingDispY[v2]); + ci->r7 = kStandardSpriteToSpriteCollisionChecks_SprClippingHeight[v2]; } -void StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(uint8 k) { // 03b6e5 +void StandardSpriteToSpriteCollisionChecks_GetSpriteClippingB(uint8 k, CollInfo *ci) { // 03b6e5 uint8 v2 = spr_property_bits1662[k] & 0x3F; - SetHiLo(&R8_, &R0_, GetSprXPos(k) + (int8)kStandardSpriteToSpriteCollisionChecks_SprClippingDispX[v2]); - R2_ = kStandardSpriteToSpriteCollisionChecks_SprClippingWidth[v2]; - SetHiLo(&R9_, &R1_, GetSprYPos(k) + (int8)kStandardSpriteToSpriteCollisionChecks_SprClippingDispY[v2]); - R3_ = kStandardSpriteToSpriteCollisionChecks_SprClippingHeight[v2]; + SetHiLo(&ci->r8, &ci->r0, GetSprXPos(k) + (int8)kStandardSpriteToSpriteCollisionChecks_SprClippingDispX[v2]); + ci->r2 = kStandardSpriteToSpriteCollisionChecks_SprClippingWidth[v2]; + SetHiLo(&ci->r9, &ci->r1, GetSprYPos(k) + (int8)kStandardSpriteToSpriteCollisionChecks_SprClippingDispY[v2]); + ci->r3 = kStandardSpriteToSpriteCollisionChecks_SprClippingHeight[v2]; } -uint8 StandardSpriteToSpriteCollisionChecks_CheckContact() { // 03b72b + +uint8 StandardSpriteToSpriteCollisionChecks_CheckContact(CollInfo *ci) { // 03b72b for (uint8 i = 1; (i & 0x80) == 0; --i) { - uint8 r0 = *(&R0_ + i); - uint8 v4 = r0 - *(&R4_ + i); - R12_ = *(&R8_ + i) - (r0 < *(&R4_ + i)) - *(&R10_ + i); - uint16 t = R12_ + ((v4 + 0x80) >> 8); + uint8 r0 = *(&ci->r0 + i); + uint8 v4 = r0 - *(&ci->r4 + i); + uint8 r12 = *(&ci->r8 + i) - (r0 < *(&ci->r4 + i)) - *(&ci->r10 + i); + uint16 t = r12 + ((v4 + 0x80) >> 8); if ((uint8)t) return false; - R15_ = *(&R6_ + i) + *(&R4_ + i) - *(&R0_ + i); - if ((uint8)(*(&R6_ + i) + *(&R2_ + i)) < R15_) + uint8 r15 = *(&ci->r6 + i) + *(&ci->r4 + i) - *(&ci->r0 + i); + if ((uint8)(*(&ci->r6 + i) + *(&ci->r2 + i)) < r15) return false; } return true; @@ -3146,22 +3455,20 @@ void Spr0A1_BowserBowlingBall_MakeBallBounce(uint8 k) { // 03b7f8 } void SubOffscreen_Bank03_Entry4(uint8 k) { // 03b84f - R3_ = 6; - SubOffscreen_Bank03_03B85F(k); + SubOffscreen_Bank03_03B85F(k, 6); } void SubOffscreen_Bank03_Entry1(uint8 k) { // 03b85d - R3_ = 0; - SubOffscreen_Bank03_03B85F(k); + SubOffscreen_Bank03_03B85F(k, 0); } -void SubOffscreen_Bank03_03B85F(uint8 k) { // 03b85f +void SubOffscreen_Bank03_03B85F(uint8 k, uint8 r3) { // 03b85f if (!CheckIfNormalSpriteOffScreen(k)) return; if ((misc_level_layout_flags & 1) != 0) { if ((spr_property_bits167a[k] & 4) == 0 && !(counter_global_frames & 1)) { bool v1 = (counter_global_frames & 2) != 0; - R1_ = v1; + uint8 r1 = v1; uint16 ypos = PAIR16(kSubOffscreen_Bank03_DATA_03B83D[v1], kSubOffscreen_Bank03[v1]) + mirror_current_layer1_ypos - GetSprYPos(k); uint8 r0 = ypos >> 8; if ((counter_global_frames & 2) != 0) @@ -3174,11 +3481,11 @@ void SubOffscreen_Bank03_03B85F(uint8 k) { // 03b85f if (!sign8((ypos >> 8) - 2)) goto LABEL_8; if ((spr_property_bits167a[k] & 4) == 0) { - R1_ = R3_ | counter_global_frames & 1; + uint8 r1 = r3 | counter_global_frames & 1; uint16 xpos = - PAIR16(kSubOffscreen_Bank03_DATA_03B847[R1_], kSubOffscreen_Bank03_DATA_03B83F[R1_]) + mirror_current_layer1_xpos - GetSprXPos(k); + PAIR16(kSubOffscreen_Bank03_DATA_03B847[r1], kSubOffscreen_Bank03_DATA_03B83F[r1]) + mirror_current_layer1_xpos - GetSprXPos(k); uint8 r0 = xpos >> 8; - if (R1_ & 1) + if (r1 & 1) r0 ^= 0x80; if ((r0 & 0x80) != 0) { LABEL_8: @@ -3239,15 +3546,15 @@ void CheckIfBabyYoshiCanEatNormalSprite1(uint8 k) { // 03c02f void GameMode14_InLevel_03C0C6() { // 03c0c6 if (!flag_sprites_locked) GameMode14_InLevel_03C11E(); - R0_ = 0; + uint8 r0 = 0; uint8 v0 = 19; uint8 v1 = -80; do { - R2_ = v0; - uint8 v2 = R0_; +// r2 = v0; + uint8 v2 = r0; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam[64].xpos = R0_; - R0_ = v2 + 16; + oam[64].xpos = r0; + r0 = v2 + 16; oam[64].ypos = -60; oam[64].flags = sprites_tile_priority | 9; oam[64].charnum = kGameMode14_InLevel_DATA_03C0B2[(kGameMode14_InLevel_DATA_03C0B6[v0] + (counter_local_frames >> 3)) & 3]; @@ -3306,30 +3613,30 @@ void Spr0C8_LightSwitch(uint8 k) { // 03c1f5 } void SprXXX_LineGuided_ChainsawDraw(uint8 k) { // 03c26b - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; uint8 v2 = spr_spriteid[k] - 101; - R3_ = kSprXXX_LineGuided_YDisp[v2]; - R4_ = kSprXXX_LineGuided_Prop[v2]; - R2_ = counter_local_frames & 2; - int8 v3 = R0_ - 8; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = R0_ - 8; + uint8 r3 = kSprXXX_LineGuided_YDisp[v2]; + uint8 r4 = kSprXXX_LineGuided_Prop[v2]; + uint8 r2 = counter_local_frames & 2; + int8 v3 = drt.x - 8; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = drt.x - 8; oam[65].xpos = v3; oam[66].xpos = v3; - int8 v5 = R1_ - 8; - oam[64].ypos = R1_ - 8; - int8 v6 = R2_ + R3_ + v5; + int8 v5 = drt.y - 8; + oam[64].ypos = drt.y - 8; + int8 v6 = r2 + r3 + v5; oam[65].ypos = v6; - oam[66].ypos = R3_ + v6; + oam[66].ypos = r3 + v6; oam[64].charnum = kSprXXX_LineGuided_MotorTiles[(counter_local_frames >> 2) & 3]; oam[65].charnum = -82; oam[66].charnum = -114; oam[64].flags = 55; - uint8 v7 = R4_; - oam[65].flags = R4_; + uint8 v7 = r4; + oam[65].flags = r4; oam[66].flags = v7; FinishOAMWrite(k, 2, 2); } @@ -3349,7 +3656,8 @@ void TriggerHidden1up() { // 03c2d9 } void Spr0C7_InvisibleMushroom(uint8 k) { // 03c30f - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; if (CheckPlayerToNormalSpriteCollision(k) & 1) { spr_spriteid[k] = 116; @@ -3393,33 +3701,33 @@ void Spr030_ThrowingDryBones_DryBonesAndBonyBeetleDraw(uint8 k) { // 03c390 } void Spr030_ThrowingDryBones_03C3DA(uint8 k) { // 03c3da - uint8 drt; + GetDrawInfoRes drt; if (spr_spriteid[k] == 49) { GenericGFXRtDraw1Tile16x16(k); } else { - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R5_ = spr_decrementing_table15ac[k]; - R2_ = 3 * spr_table157c[k]; - R3_ = 3 * spr_table1602[k]; - R4_ = kSpr030_ThrowingDryBones_DATA_03C3D7[spr_table1602[k]]; + uint8 r5 = spr_decrementing_table15ac[k]; + uint8 r2 = 3 * spr_table157c[k]; + uint8 r3 = 3 * spr_table1602[k]; + uint8 r4 = kSpr030_ThrowingDryBones_DATA_03C3D7[spr_table1602[k]]; uint8 v2 = 2; do { uint8 v8 = v2; - uint8 v3 = R2_ + v2; + uint8 v3 = r2 + v2; uint8 v6 = v3; - if (R5_) + if (r5) v3 += 6; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr030_ThrowingDryBones_DryBonesTileXDisp[v3] + R0_; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr030_ThrowingDryBones_DryBonesTileXDisp[v3] + drt.x; oam[64].flags = sprites_tile_priority | kSpr030_ThrowingDryBones_DryBonesGfxProp[v6]; - uint8 v5 = R3_ + v8; - oam[64].ypos = kSpr030_ThrowingDryBones_DryBonesTileYDisp[(uint8)(R3_ + v8)] + R1_; + uint8 v5 = r3 + v8; + oam[64].ypos = kSpr030_ThrowingDryBones_DryBonesTileYDisp[(uint8)(r3 + v8)] + drt.y; oam[64].charnum = kSpr030_ThrowingDryBones_DryBonesTiles[v5]; - drt += 4; + drt.idx += 4; v2 = v8 - 1; - } while (v2 != R4_); + } while (v2 != r4); FinishOAMWrite(k, 2, 2); } } @@ -3504,7 +3812,7 @@ void Spr0C6_Spotlight(uint8 k) { // 03c4dc sprc6_spotlight_width_right_side_w = v6; sprc6_spotlight_bottom_right_window_pos_relative_to_top = v5; sprc6_spotlight_shift_right = 0; - R15_ = spr_table00c2[k]; + uint8 r15 = spr_table00c2[k]; for (uint16 j = 0; j != 448; j += 2) { if (j < 0x5F) goto LABEL_31; @@ -3524,7 +3832,7 @@ void Spr0C6_Spotlight(uint8 k) { // 03c4dc if (!sprc6_spotlight_bottom_right_window_pos_relative_to_top) sprc6_spotlight_right_scanline_x -= 2; } - if (R15_) { + if (r15) { misc_hdmawindow_effect_table[j] = sprc6_spotlight_left_scanline_x; misc_hdmawindow_effect_table[j + 1] = sprc6_spotlight_right_scanline_x; } else LABEL_31: { @@ -3644,74 +3952,69 @@ void Spr07A_Fireworks_FadeAway(uint8 k) { // 03c941 void Spr07A_Fireworks_03C96D(uint8 k) { // 03c96d if (((counter_global_frames ^ k) & 3) == 0) { - if (GetDrawInfo_Bank23_ReturnsTwice(k) == 0xff) + GetDrawInfoRes drt; + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - uint8 v1 = R0_; OamEnt *oam = get_OamEnt(oam_buf, 0); - oam[64].xpos = R0_; - oam[65].xpos = v1; - oam[64].ypos = R1_; + oam[64].xpos = drt.x; + oam[65].xpos = drt.x; + oam[64].ypos = drt.y; oam[64].charnum = kSpr07A_Fireworks_DATA_03C969[spr_table1534[k]] + ((uint8)((counter_global_frames >> 2) & 2) >> 1); - R2_ = (2 * counter_global_frames) & 0xE; - oam[64].flags = R2_ | (16 * counter_global_frames) & 0x40 | 0x31; + uint8 r2 = (2 * counter_global_frames) & 0xE; + oam[64].flags = r2 | (16 * counter_global_frames) & 0x40 | 0x31; sprites_oamtile_size_buffer[64] = 0; } } void Spr07A_Fireworks_03C9E9(uint8 k) { // 03c9e9 - R5_ = counter_global_frames ^ k; - R6_ = spr_table1570[k]; - R7_ = spr_table1602[k]; - R8_ = spr_xpos_lo[k]; - R9_ = spr_ypos_lo[k] - mirror_current_layer1_ypos; - R10_ = spr_table1534[k]; + uint8 r5 = counter_global_frames ^ k; + uint8 r6 = spr_table1570[k]; + uint8 r7 = spr_table1602[k]; + uint8 r8 = spr_xpos_lo[k]; + uint8 r9 = spr_ypos_lo[k] - mirror_current_layer1_ypos; + uint8 r10 = spr_table1534[k]; uint8 v1 = 63; uint8 v2 = 0; do { - R4_ = v1; + uint8 r4 = v1; uint8 v3 = kSpr07A_Fireworks_DATA_03C626[v1]; - if (R10_ >= 3) + if (r10 >= 3) v3 = kSpr07A_Fireworks_DATA_03C6CE[v1]; - R0_ = v3 - 64; + uint8 r0 = v3 - 64; uint8 v30 = v2; uint8 v4 = kSpr07A_Fireworks_DATA_03C67A[v1]; - if (R10_ >= 3) + if (r10 >= 3) v4 = kSpr07A_Fireworks_DATA_03C722[v1]; - R1_ = v4 - 80; - uint8 v5 = R0_; - if ((R0_ & 0x80) != 0) - v5 = -R0_; - WriteReg(WRMPYA, v5); - WriteReg(WRMPYB, R6_); - uint8 Reg = ReadReg(RDMPYH); + uint8 r1 = v4 - 80; + uint8 v5 = r0; + if ((r0 & 0x80) != 0) + v5 = -r0; + uint8 Reg = Mult8x8(v5, r6) >> 8; uint8 v7 = Reg; - if ((R0_ & 0x80) != 0) + if ((r0 & 0x80) != 0) v7 = -Reg; - R2_ = v7; - uint8 v8 = R1_; - if ((R1_ & 0x80) != 0) - v8 = -R1_; - WriteReg(WRMPYA, v8); - WriteReg(WRMPYB, R6_); - uint8 v9 = ReadReg(RDMPYH); + uint8 r2 = v7; + uint8 v8 = r1; + if ((r1 & 0x80) != 0) + v8 = -r1; + uint8 v9 = Mult8x8(v8, r6) >> 8; uint8 v10 = v9; - if ((R1_ & 0x80) != 0) + if ((r1 & 0x80) != 0) v10 = -v9; - R3_ = v10; + uint8 r3 = v10; uint8 v11 = 0; - if (R7_ >= 6) - v11 = ((uint8)(R4_ + R5_) >> 2) & 7; + if (r7 >= 6) + v11 = ((uint8)(r4 + r5) >> 2) & 7; uint8 v12 = kSpr07A_Fireworks_DATA_03C9E1[v11]; uint8 v13 = v30; OamEnt *oam = get_OamEnt(oam_buf, v30); - oam->xpos = R8_ + R2_ + v12; - oam->ypos = R9_ + R3_; + oam->xpos = r8 + r2 + v12; + oam->ypos = r9 + r3; uint8 v31 = v1; - R15_ = R5_ & 3; - oam->charnum = kSpr07A_Fireworks_DATA_03C9B9[(uint8)(R7_ + 10 * (R5_ & 3))]; - int8 v15 = R5_ >> 1; - if (R10_ != 3) - v15 ^= R4_; + oam->charnum = kSpr07A_Fireworks_DATA_03C9B9[(uint8)(r7 + 10 * (r5 & 3))]; + int8 v15 = r5 >> 1; + if (r10 != 3) + v15 ^= r4; oam->flags = v15 & 0xE | 0x31; sprites_oamtile_size_buffer[v13 >> 2] = 0; v2 = v13 + 4; @@ -3719,49 +4022,44 @@ void Spr07A_Fireworks_03C9E9(uint8 k) { // 03c9e9 } while ((int8)v1 >= 0); uint8 v16 = 83; do { - R4_ = v16; + uint8 r4 = v16; uint8 v17 = kSpr07A_Fireworks_DATA_03C626[v16]; - if (R10_ >= 3) + if (r10 >= 3) v17 = kSpr07A_Fireworks_DATA_03C6CE[v16]; - R0_ = v17 - 64; + uint8 r0 = v17 - 64; uint8 v18 = kSpr07A_Fireworks_DATA_03C67A[v16]; - if (R10_ >= 3) + if (r10 >= 3) v18 = kSpr07A_Fireworks_DATA_03C722[v16]; - R1_ = v18 - 80; + uint8 r1 = v18 - 80; uint8 v32 = v2; - uint8 v19 = R0_; - if ((R0_ & 0x80) != 0) - v19 = -R0_; - WriteReg(WRMPYA, v19); - WriteReg(WRMPYB, R6_); - uint8 v20 = ReadReg(RDMPYH); + uint8 v19 = r0; + if ((r0 & 0x80) != 0) + v19 = -r0; + uint8 v20 = Mult8x8(r6, v19) >> 8; uint8 v21 = v20; - if ((R0_ & 0x80) != 0) + if ((r0 & 0x80) != 0) v21 = -v20; - R2_ = v21; - uint8 v22 = R1_; - if ((R1_ & 0x80) != 0) - v22 = -R1_; - WriteReg(WRMPYA, v22); - WriteReg(WRMPYB, R6_); - uint8 v23 = ReadReg(RDMPYH); + uint8 r2 = v21; + uint8 v22 = r1; + if ((r1 & 0x80) != 0) + v22 = -r1; + uint8 v23 = Mult8x8(v22, r6) >> 8; uint8 v24 = v23; - if ((R1_ & 0x80) != 0) + if ((r1 & 0x80) != 0) v24 = -v23; - R3_ = v24; + uint8 r3 = v24; uint8 v25 = 0; - if (R7_ >= 6) - v25 = ((uint8)(R4_ + R5_) >> 2) & 7; + if (r7 >= 6) + v25 = ((uint8)(r4 + r5) >> 2) & 7; uint8 v26 = kSpr07A_Fireworks_DATA_03C9E1[v25]; uint8 v27 = v32; OamEnt *v28 = get_OamEnt(oam_buf, v32); - v28[64].xpos = R8_ + R2_ + v26; - v28[64].ypos = R9_ + R3_; - R15_ = R5_ & 3; - v28[64].charnum = kSpr07A_Fireworks_DATA_03C9B9[(uint8)(R7_ + 10 * (R5_ & 3))]; - int8 v29 = R5_ >> 1; - if (R10_ != 3) - v29 ^= R4_; + v28[64].xpos = r8 + r2 + v26; + v28[64].ypos = r9 + r3; + v28[64].charnum = kSpr07A_Fireworks_DATA_03C9B9[r7 + 10 * (r5 & 3)]; + int8 v29 = r5 >> 1; + if (r10 != 3) + v29 ^= r4; v28[64].flags = v29 & 0xE | 0x31; sprites_oamtile_size_buffer[(v27 >> 2) + 64] = 0; v2 = v27 + 4; @@ -3856,7 +4154,6 @@ void Spr029_KoopaKid_WendyLemmy_03CDCF(uint8 k) { // 03cdcf } void sub_3CDDA(uint8 k, uint8 a) { // 03cdda - R0_ = a >> 2; spr_table1602[k] = kSpr029_KoopaKid_WendyLemmy_LemmyAndWendyAnimationFrames[(uint8)((a >> 2) | (16 * spr_table1528[k]))]; } @@ -3948,37 +4245,37 @@ void Spr029_KoopaKid_WendyLemmy_CheckMarioStomp(uint8 k) { // 03cea7 } void Spr029_KoopaKid_WendyLemmy_Draw(uint8 k) { // 03d484 - uint8 drt; + GetDrawInfoRes drt; - if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)) == 0xff) + if ((drt = GetDrawInfo_Bank23_ReturnsTwice(k)).idx == 0xff) return; - R2_ = 6 * spr_table1602[k]; + uint8 r2 = 6 * spr_table1602[k]; if (spr_table00c2[k] == 6) { uint8 v5 = kSpr029_KoopaKid_WendyLemmy_NumberOfTilesToDrawForWendy[spr_table1602[k]]; do { uint8 v9 = v5; - uint8 v6 = R2_ + v5; - OamEnt *oam = get_OamEnt(oam_buf, drt); - oam[64].xpos = kSpr029_KoopaKid_WendyLemmy_WendyXDisp[v6] + R0_; - oam[64].ypos = kSpr029_KoopaKid_WendyLemmy_WendyYDisp[v6] + R1_; + uint8 v6 = r2 + v5; + OamEnt *oam = get_OamEnt(oam_buf, drt.idx); + oam[64].xpos = kSpr029_KoopaKid_WendyLemmy_WendyXDisp[v6] + drt.x; + oam[64].ypos = kSpr029_KoopaKid_WendyLemmy_WendyYDisp[v6] + drt.y; oam[64].charnum = kSpr029_KoopaKid_WendyLemmy_WendyTiles[v6]; oam[64].flags = kSpr029_KoopaKid_WendyLemmy_WendyProp[v6] | 0x10; - sprites_oamtile_size_buffer[(drt >> 2) + 64] = kSpr029_KoopaKid_WendyLemmy_WendyTileSize[v6]; - drt += 4; + sprites_oamtile_size_buffer[(drt.idx >> 2) + 64] = kSpr029_KoopaKid_WendyLemmy_WendyTileSize[v6]; + drt.idx += 4; v5 = v9 - 1; } while ((int8)v5 >= 0); } else { uint8 v2 = kSpr029_KoopaKid_WendyLemmy_NumberOfTilesToDrawForLemmy[spr_table1602[k]]; do { uint8 v8 = v2; - uint8 v3 = R2_ + v2; - OamEnt *v4 = get_OamEnt(oam_buf, drt); - v4[64].xpos = kSpr029_KoopaKid_WendyLemmy_LemmyXDisp[v3] + R0_; - v4[64].ypos = kSpr029_KoopaKid_WendyLemmy_LemmyYDisp[v3] + R1_; + uint8 v3 = r2 + v2; + OamEnt *v4 = get_OamEnt(oam_buf, drt.idx); + v4[64].xpos = kSpr029_KoopaKid_WendyLemmy_LemmyXDisp[v3] + drt.x; + v4[64].ypos = kSpr029_KoopaKid_WendyLemmy_LemmyYDisp[v3] + drt.y; v4[64].charnum = kSpr029_KoopaKid_WendyLemmy_LemmyTiles[v3]; v4[64].flags = kSpr029_KoopaKid_WendyLemmy_LemmyProp[v3] | 0x10; - sprites_oamtile_size_buffer[(drt >> 2) + 64] = kSpr029_KoopaKid_WendyLemmy_LemmyTileSize[v3]; - drt += 4; + sprites_oamtile_size_buffer[(drt.idx >> 2) + 64] = kSpr029_KoopaKid_WendyLemmy_LemmyTileSize[v3]; + drt.idx += 4; v2 = v8 - 1; } while ((int8)v2 >= 0); } @@ -4036,20 +4333,21 @@ void Spr0A9_Reznor_03D76C() { // 03d76c } void Spr0A9_Reznor_03D77F() { // 03d77f - R1_ = (uint8)blocks_xpos >> 3; + uint8 r1 = (uint8)blocks_xpos >> 3; uint16 v0 = (uint8)(blocks_ypos | ((uint8)blocks_xpos >> 4)); uint8 v1 = HIBYTE(blocks_xpos); if (HIBYTE(blocks_xpos)) { v0 += 432; v1 = 4; } - R0_ = v1; + uint8 r0 = v1; + uint16 r0w = r1 << 8 | r0; blocks_map16_table_lo[v0] = 37; blocks_map16_table_hi[v0] = 0; uint16 v2 = stripe_image_upload; - int16 v3 = R0_W + 0xc05a; + uint16 v3 = r0w + 0xc05a; int v4 = stripe_image_upload; - *(uint16 *)&stripe_image_upload_data[stripe_image_upload] = R0_W + 0xc05a; + *(uint16 *)&stripe_image_upload_data[stripe_image_upload] = r0w + 0xc05a; *(uint16 *)&stripe_image_upload_data[v4 + 6] = v3 | 0x2000; *(uint16 *)&stripe_image_upload_data[v2 + 2] = 576; *(uint16 *)&stripe_image_upload_data[v2 + 8] = 576; @@ -4060,49 +4358,37 @@ void Spr0A9_Reznor_03D77F() { // 03d77f } void GameMode12_PrepareLevel_UploadTiltingPlatformTilemap() { // 03d958 - WriteReg(VMAIN, 0); - WriteReg(VMADDL, 0); - WriteReg(VMADDH, 0); - int16 v0 = 0x4000; - do { - WriteReg(VMDATAL, 0xFF); - --v0; - } while (v0); + uint16 *dst = RtlGetVramAddr(); + for (int i = 0; i < 0x4000; i++) + LOBYTE(dst[i]) = 0xff; if ((misc_nmito_use_flag & 0x40) == 0) { - R5_ = -20; - R6_ = -41; - R7_ = 3; - R0_ = 16; - R1_ = 8; - GameMode12_PrepareLevel_03D991(); + GameMode12_PrepareLevel_03D991(RomPtr(0x3d7ec), 0x810); } } -void GameMode12_PrepareLevel_03D991() { // 03d991 - WriteReg(VMAIN, 0); +void GameMode12_PrepareLevel_03D991(const uint8 *p5, uint16 r0w) { // 03d991 uint8 v0 = 0; do { - R2_ = v0; + uint8 r2 = v0, r3; uint8 v1 = 0; do { - R3_ = v1; - WriteReg(VMADDL, R0_); - WriteReg(VMADDH, R1_); - v0 = R2_; - R4_ = 16; + r3 = v1; + uint16 *dst = RtlGetVramAddr() + r0w; + v0 = r2; + uint8 n = 16; do { - uint8 *v2 = IndirPtr(&R5_, v0); - uint8 v3 = *v2; - sprites_cutscene_sprite_table_0AF6[v0] = *v2; - uint8 v4 = R3_ | (4 * v3); - WriteReg(VMDATAL, *((uint8 *)kGameMode12_PrepareLevel_DATA_03D8EC + v4)); - WriteReg(VMDATAL, *((uint8 *)&kGameMode12_PrepareLevel_DATA_03D8EC[1] + v4)); + uint8 v3 = p5[v0]; + sprites_cutscene_sprite_table_0AF6[v0] = v3; + uint8 v4 = r3 | (4 * v3); + LOBYTE(dst[0]) = *((uint8 *)kGameMode12_PrepareLevel_DATA_03D8EC + v4); + LOBYTE(dst[1]) = *((uint8 *)&kGameMode12_PrepareLevel_DATA_03D8EC[1] + v4); + dst += 2; ++v0; - --R4_; - } while (R4_); - R0_W += 0x80; - v1 = R3_ ^ 1; - } while (R3_ != 1); + --n; + } while (n); + r0w += 0x80; + v1 = r3 ^ 1; + } while (r3 != 1); } while (v0); } @@ -4116,37 +4402,36 @@ void InitializeMode7TilemapsAndPalettes(uint8 k) { // 03dd7d misc_screens_in_lvl = -1; camera_last_screen_horiz = 0; uint8 v1 = kInitializeMode7TilemapsAndPalettes_GFXFile[misc_currently_active_boss]; - R0_ = kInitializeMode7TilemapsAndPalettes_PalPtrLo[misc_currently_active_boss]; - R1_ = kInitializeMode7TilemapsAndPalettes_PalPtrHi[misc_currently_active_boss]; - R2_ = 0; + uint16 r0w = kInitializeMode7TilemapsAndPalettes_PalPtrLo[misc_currently_active_boss] | + kInitializeMode7TilemapsAndPalettes_PalPtrHi[misc_currently_active_boss] << 8; + const uint8 *p0 = RomPtr_00(r0w); for (uint8 i = 11; (i & 0x80) == 0; --i) - *((uint8 *)&palettes_palette_mirror[2] + i) = *IndirPtr(&R0_, i); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0); - WriteReg(VMADDH, 0); + *((uint8 *)&palettes_palette_mirror[2] + i) = p0[i]; + uint16 *dst = RtlGetVramAddr(); if (v1) { - GraphicsDecompressionRoutines(v1); - R3_ = 0x80; + const uint8 *pp = GraphicsDecompress(v1); + uint8 r3 = 0x80; do { - InitializeMode7TilemapsAndPalettes_BufferTilemap(); - --R3_; - } while (R3_); + pp = InitializeMode7TilemapsAndPalettes_BufferTilemap(&dst, pp); + --r3; + } while (r3); } for (int8 j = 95; j >= 0; --j) misc_mode7_boss_tilemap[(uint8)j] = -1; } -void InitializeMode7TilemapsAndPalettes_BufferTilemap() { // 03dde5 +const uint8 *InitializeMode7TilemapsAndPalettes_BufferTilemap(uint16 **dstp, const uint8 *p0) { // 03dde5 + uint16 *dst = *dstp; uint8 v3; uint8 v8; uint8 v9; uint8 v1 = 0; uint8 v2 = 0; - R5_ = 8; + uint8 n = 8; do { - uint8 v12 = InitializeMode7TilemapsAndPalettes_03DE39(v1, v2); - InitializeMode7TilemapsAndPalettes_03DE3C(v1, (v12 >> 1) + 15); + uint8 v12 = InitializeMode7TilemapsAndPalettes_03DE39(v1, v2, p0); + InitializeMode7TilemapsAndPalettes_03DE3C(v1, (v12 >> 1) + 15, p0); int8 v4 = 8; do { uint16 v7 = v1; @@ -4176,31 +4461,33 @@ void InitializeMode7TilemapsAndPalettes_BufferTilemap() { // 03dde5 v3 = v9 + v0; v3 = v3 & 7; graphics_mode7_tile_buffer[v1] = v3; - WriteReg(VMDATAH, v3); + HIBYTE(*dst++) = v3; ++v1; --v4; } while (v4); v2 = v12; - --R5_; - } while (R5_); + --n; + } while (n); for (uint8 i = 7; (uint8)i < 0x40; i += 8) { uint8 v11 = i; - R5_ = 8; + n = 8; do { - WriteReg(VMDATAH, graphics_mode7_tile_buffer[v11--]); - --R5_; - } while (R5_); + HIBYTE(*dst++) = graphics_mode7_tile_buffer[v11--]; + --n; + } while (n); } - R0_W += 24; + p0 += 24; + *dstp = dst; + return p0; } -uint8 InitializeMode7TilemapsAndPalettes_03DE39(uint8 k, uint8 j) { // 03de39 - uint8 v2 = InitializeMode7TilemapsAndPalettes_03DE3C(k, j); - return InitializeMode7TilemapsAndPalettes_03DE3C(k, v2); +uint8 InitializeMode7TilemapsAndPalettes_03DE39(uint8 k, uint8 j, const uint8 *p0) { // 03de39 + uint8 v2 = InitializeMode7TilemapsAndPalettes_03DE3C(k, j, p0); + return InitializeMode7TilemapsAndPalettes_03DE3C(k, v2, p0); } -uint8 InitializeMode7TilemapsAndPalettes_03DE3C(uint8 k, uint8 j) { // 03de3c - uint8 v2 = *IndirPtr(&R0_, j); +uint8 InitializeMode7TilemapsAndPalettes_03DE3C(uint8 k, uint8 j, const uint8 *p0) { // 03de3c + uint8 v2 = p0[j]; int8 v3 = 8; do { bool v4 = __CFSHL__(v2, 1); @@ -4216,15 +4503,15 @@ uint8 InitializeMode7TilemapsAndPalettes_03DE3C(uint8 k, uint8 j) { // 03de3c } void InitializeMode7TilemapsAndPalettes_BufferReznorWallTilemap() { // 03de8e - WriteReg(VMAIN, 0); - R0_W = 0xa1c; + uint16 r0w = 0xa1c; uint8 v0 = 0; do { - R0_W += 128; - WriteRegWord(VMADDL, R0_W); + r0w += 128; + uint16 *dst = RtlGetVramAddr() + r0w; int8 v1 = 8; do { - WriteReg(VMDATAL, kInitializeMode7TilemapsAndPalettes_DATA_03DE4E[v0++]); + LOBYTE(dst[0]) = kInitializeMode7TilemapsAndPalettes_DATA_03DE4E[v0++]; + dst++; --v1; } while (v1); } while (v0 < 0x40); @@ -4235,7 +4522,7 @@ void UpdateMode7SpriteAnimations(uint8 k_in) { // 03dedf UpdateMode7SpriteAnimations_03DFAE(0, GetSprXPos(k)); UpdateMode7SpriteAnimations_03DFAE(2, GetSprYPos(k)); - R6_W = 0; + uint16 r6 = 0; uint16 v1 = 3; uint16 v2 = *(uint16 *)&misc_nmito_use_flag >> 1; if (misc_nmito_use_flag & 1) { @@ -4243,7 +4530,7 @@ void UpdateMode7SpriteAnimations(uint8 k_in) { // 03dedf *(uint16 *)&misc_mode7_boss_tilemap[1] = kUpdateMode7SpriteAnimations_DATA_03DEBF[v3]; *(uint16 *)&misc_mode7_boss_tilemap[3] = kUpdateMode7SpriteAnimations_DATA_03DEC7[v3]; *(uint16 *)&misc_mode7_boss_tilemap[5] = kUpdateMode7SpriteAnimations_DATA_03DECF[v3]; - R6_W = 8; + r6 = 8; int16 v4 = 896; if ((misc_mode7_tilemap_index & 0x7F) >= 0x2C) v4 = 904; @@ -4251,20 +4538,21 @@ void UpdateMode7SpriteAnimations(uint8 k_in) { // 03dedf k = 10; v1 = 7; } - R0_W = v1; + uint16 r0w = v1; if (!(misc_nmito_use_flag & 1)) { LABEL_6: v2 = 16 * (misc_mode7_tilemap_index & 0x7F); k = 3; } + uint16 r2w; do { - R2_W = k; + r2w = k; uint16 v8 = v2; if (*(int16 *)&blocks_screen_to_place_next_object < 0) - v2 += R0_W; + v2 += r0w; uint16 v5 = v2; - uint16 v6 = R6_W; - R4_ = R0_; + uint16 v6 = r6; + uint8 r4 = r0w; do { uint8 v7 = kInitializeMode7TilemapsAndPalettes_TilemapData[v5++]; if ((misc_mode7_tilemap_index & 0x80) != 0) { @@ -4272,18 +4560,18 @@ void UpdateMode7SpriteAnimations(uint8 k_in) { // 03dedf v5 -= 2; } misc_mode7_boss_tilemap[v6++] = v7; - --R4_; - } while ((R4_ & 0x80) == 0); - R6_W = v6; - v2 = R0_W + v8 + 1; - if (R2_W == 4) + --r4; + } while ((r4 & 0x80) == 0); + r6 = v6; + v2 = r0w + v8 + 1; + if (r2w == 4) goto LABEL_6; - if (R2_W == 8) + if (r2w == 8) v2 = 864; - if (R2_W == 10) + if (r2w == 10) v2 = kUpdateMode7SpriteAnimations_DATA_03DED7[(uint16)(2 * (spra0_bowser_clown_car_face_anim_frame & 3)) >> 1]; - k = R2_W - 1; - } while ((int16)(R2_W - 1) >= 0); + k = r2w - 1; + } while ((int16)(r2w - 1) >= 0); } void UpdateMode7SpriteAnimations_03DFAE(uint8 j, uint16 a) { // 03dfae @@ -4329,11 +4617,11 @@ void Spr0A0_ActivateBowserBattle_UpdatePaletteAndLightningAnimation() { // 03df } LABEL_11:; uint8 v6 = kSpr0A0_ActivateBowserBattle_BowserPaletteTableIndex[spra0_bowser_palette_index]; - R0_ = 14; + uint8 r0 = 14; do { palettes_dynamic_palette_colors[v2++ + 2] = *((uint8 *)kGlobalPalettes_Bowser + v6++); - --R0_; - } while (R0_); + --r0; + } while (r0); palettes_dynamic_palette_colors[v2 + 2] = 0; palettes_dynamic_palette_upload_index = v2 + 4; } diff --git a/src/smw_04.c b/src/smw_04.c index 86b0250..6567685 100644 --- a/src/smw_04.c +++ b/src/smw_04.c @@ -3,6 +3,7 @@ #include "smw_rtl.h" #include "variables.h" + void (*kHandleCurrentOverworldProcess_PtrsLong04857D[13])(void) = { &OwProcess00_OverworldEntryInitialization, &OwProcess01_ActivateEvents, @@ -49,49 +50,175 @@ void (*kProcessOverworldSprites_OverworldSpritePtrs[11])(uint8 k) = { &OWSpr0A_Boo, }; +#define kLayer2EventData_TileEntries ((uint16*)RomFixedPtr(0x4DD8D)) +#define kLoadOverworldSprites_SpriteSlotData ((SpriteSlotData*)RomFixedPtr(0x4F625)) + +static const uint16 kOwTileAnimations_WaterTileNumbers[3] = { 0xb480, 0xb498, 0xb4b0, }; +static const uint16 kOwTileAnimations_TileNumbers[64] = { 0xb300, 0xb318, 0xb330, 0xb348, 0xb360, 0xb378, 0xb390, 0xb3a8, 0xb3c0, 0xb3d8, 0xb3f0, 0xb408, 0xb420, 0xb438, 0xb450, 0xb468, 0xb480, 0xb498, 0xb4b0, 0xb4c8, 0xb4e0, 0xb4f8, 0xb510, 0xb528, 0xb540, 0xb558, 0xb570, 0xb588, 0xb5a0, 0xb5b8, 0xb5d0, 0xb5e8, 0xb600, 0xb618, 0xb630, 0xb648, 0xb660, 0xb678, 0xb690, 0xb6a8, 0xb6c0, 0xb6d8, 0xb6f0, 0xb708, 0xb720, 0xb738, 0xb750, 0xb768, 0xb780, 0xb798, 0xb7b0, 0xb7c8, 0xb7e0, 0xb7f8, 0xb810, 0xb828, 0xb840, 0xb858, 0xb870, 0xb888, 0xb8a0, 0xb8b8, 0xb8d0, 0xb8e8, }; +static const uint16 kGameMode0E_ShowOverworld_DATA_048211[8] = { 0x0, 0x2, 0xfffe, 0x2, 0x0, 0x2, 0xfffe, 0x2, }; +static const uint16 kGameMode0E_ShowOverworld_DATA_048221[8] = { 0x0, 0x111, 0xffef, 0x111, 0x0, 0x132, 0xffd7, 0x132, }; +static const uint8 kGameMode0E_ShowOverworld_DATA_048231[16] = { 0xf, 0xf, 0x7, 0x7, 0x7, 0x3, 0x3, 0x3, 0x1, 0x1, 0x3, 0x3, 0x3, 0x7, 0x7, 0x7, }; +static const uint16 kHandleOverworldStarPipeWarp_DATA_048431[27] = { 0x11, 0xa, 0x9, 0xb, 0x12, 0xa, 0x7, 0x20a, 0x203, 0x410, 0x412, 0x41c, 0x414, 0x612, 0x200, 0x612, 0x10, 0x617, 0x14, 0x61c, 0x14, 0x61c, 0x617, 0x511, 0x511, 0x414, 0x106, }; +static const uint16 kHandleOverworldStarPipeWarp_DATA_048467[27] = { 0x7, 0x3, 0x10, 0xe, 0x17, 0x18, 0x12, 0x14, 0xb, 0x3, 0x1, 0x9, 0x9, 0x1d, 0xe, 0x18, 0xf, 0x16, 0x10, 0x18, 0x2, 0x1d, 0x18, 0x13, 0x11, 0x3, 0x7, }; +static const uint16 kHandleOverworldStarPipeWarp_DATA_04849D[27] = { 0x4a8, 0x438, 0x908, 0x928, 0x9c8, 0x948, 0xd28, 0x118, 0xa8, 0x98, 0xb8, 0x128, 0xa8, 0x78, 0xd28, 0x408, 0xd78, 0x108, 0xdc8, 0x148, 0xdc8, 0x948, 0xb18, 0xd78, 0x268, 0xdc8, 0xd28, }; +static const uint16 kHandleOverworldStarPipeWarp_DATA_0484D3[27] = { 0x148, 0xb8, 0x38, 0x18, 0x98, 0x98, 0x1d8, 0x78, 0x38, 0x108, 0xe8, 0x178, 0x188, 0x128, 0x188, 0xe8, 0x168, 0xf8, 0x188, 0x108, 0x1d8, 0x38, 0x138, 0x188, 0x78, 0x1d8, 0x1d8, }; +static const uint8 kDrawOverworldPlayer_StarWarpAnimationOffset[4] = { 0x20, 0x60, 0x0, 0x40, }; +static const uint8 kDrawOverworldPlayer_PlayerAndYoshiXDisp[192] = { 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x7, 0xf, 0x7, 0xf, 0x0, 0x8, 0x0, 0x8, 0x7, 0xf, 0x7, 0xf, 0x0, 0x8, 0x0, 0x8, 0xf9, 0x1, 0xf9, 0x1, 0x0, 0x8, 0x0, 0x8, 0xf9, 0x1, 0xf9, 0x1, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x7, 0xf, 0x7, 0xf, 0x0, 0x8, 0x0, 0x8, 0x7, 0xf, 0x7, 0xf, 0x0, 0x8, 0x0, 0x8, 0xf9, 0x1, 0xf9, 0x1, 0x0, 0x8, 0x0, 0x8, 0xf9, 0x1, 0xf9, 0x1, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, 0x0, 0x8, }; +static const uint8 kDrawOverworldPlayer_PlayerAndYoshiYDisp[192] = { 0xfb, 0xfb, 0x3, 0x3, 0x0, 0x0, 0x8, 0x8, 0xfa, 0xfa, 0x2, 0x2, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0x8, 0x8, 0xf8, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0xf9, 0xf9, 0x1, 0x1, 0xfc, 0xfc, 0x4, 0x4, 0x0, 0x0, 0x8, 0x8, 0xfb, 0xfb, 0x3, 0x3, 0x0, 0x0, 0x8, 0x8, 0xfc, 0xfc, 0x4, 0x4, 0x0, 0x0, 0x8, 0x8, 0xfb, 0xfb, 0x3, 0x3, 0x0, 0x0, 0x8, 0x8, 0x8, 0x8, 0xfb, 0xfb, 0x3, 0x3, 0x0, 0x0, 0x8, 0x8, 0xfa, 0xfa, 0x2, 0x2, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0xf9, 0xf9, 0x1, 0x1, 0x8, 0x8, 0xfc, 0xfc, 0x4, 0x4, 0x0, 0x0, 0x8, 0x8, 0xfb, 0xfb, 0x3, 0x3, 0x0, 0x0, 0x8, 0x8, 0xfc, 0xfc, 0x4, 0x4, 0x0, 0x0, 0x8, 0x8, 0xfb, 0xfb, 0x3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0xf8, 0xf8, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0xf8, 0xf8, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0xf8, 0xf8, 0x0, 0x0, 0xfb, 0xfb, 0x3, 0x3, 0x0, 0x0, 0x8, 0x8, 0xfa, 0xfa, 0x2, 0x2, 0x0, 0x0, 0x8, 0x8, 0xfb, 0xfb, 0x3, 0x3, 0x0, 0x0, 0x8, 0x8, 0xfa, 0xfa, 0x2, 0x2, 0x0, 0x0, 0x8, 0x8, }; +static const uint16 kDrawOverworldPlayer_YoshiPalette[4] = { 0x0, 0x200, 0x400, 0x600, }; +static const uint16 kGameMode0C_LoadOverworld_DATA_048D74[11] = { 0xb, 0x13, 0x1a, 0x1b, 0x1f, 0x20, 0x31, 0x32, 0x34, 0x35, 0x40, }; +static const uint8 kGameMode0C_LoadOverworld_DATA_048D8A[7] = { 0x2, 0x3, 0x4, 0x6, 0x7, 0x9, 0x5, }; +static const uint16 kGameMode0C_LoadOverworld_KoopaKidTeleportXPos[3] = { 0x128, 0x0, 0x188, }; +static const uint16 kGameMode0C_LoadOverworld_KoopaKidTeleportYPos[3] = { 0x1c8, 0x0, 0x1d8, }; +static const uint8 kOverworldProcess02_HandleLevelBeaten_DATA_048F7F[8] = { 0x58, 0x59, 0x5d, 0x63, 0x77, 0x79, 0x7e, 0x80, }; +static const uint16 kSharedOverworldPathTables_DATA_049058[4] = { 0xffff, 0x1, 0xffff, 0x1, }; +static const uint8 kSharedOverworldPathTables_DATA_049060[4] = { 0x5, 0x3, 0x1, 0x0, }; +static const uint16 kSharedOverworldPathTables_DATA_049064[4] = { 0x0, 0x2, 0x4, 0x6, }; +static const uint16 kSharedOverworldPathTables_NoAutoMoveLevels[6] = { 0x28, 0x8, 0x14, 0x36, 0x3f, 0x45, }; +static const uint8 kSharedOverworldPathTables_HardCodedOWPaths_LevelNums[10] = { 0x9, 0x15, 0x23, 0x1b, 0x43, 0x44, 0x24, 0xff, 0x30, 0x31, }; +static const uint16 kSharedOverworldPathTables_DATA_049082[1] = { 0x178, }; +static const uint16 kSharedOverworldPathTables_DATA_049084[1] = { 0x128, }; +static const uint8 kSharedOverworldPathTables_HardCodedOWPaths_Layer1Tiles[68] = { 0x10, 0x10, 0x1e, 0x19, 0x16, 0x66, 0x16, 0x19, 0x1e, 0x10, 0x10, 0x66, 0x4, 0x4, 0x4, 0x58, 0x4, 0x4, 0x4, 0x66, 0x4, 0x4, 0x4, 0x4, 0x4, 0x6a, 0x4, 0x4, 0x4, 0x4, 0x4, 0x66, 0x1e, 0x19, 0x6, 0x9, 0xf, 0x20, 0x1a, 0x21, 0x1a, 0x14, 0x19, 0x18, 0x1f, 0x17, 0x82, 0x17, 0x1f, 0x18, 0x19, 0x14, 0x1a, 0x21, 0x1a, 0x20, 0xf, 0x9, 0x6, 0x19, 0x1e, 0x66, 0x4, 0x4, 0x58, 0x4, 0x4, 0x5f, }; +static const uint8 kSharedOverworldPathTables_HardCodedOWPaths_MovementDirection[68] = { 0x2, 0x2, 0x2, 0x2, 0x6, 0x6, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x4, 0x4, 0x4, 0x4, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x2, 0x2, 0x6, 0x6, 0x0, 0x0, 0x0, 0x4, 0x0, 0x4, 0x4, 0x0, 0x4, 0x0, 0x4, 0x6, 0x2, 0x6, 0x2, 0x6, 0x6, 0x2, 0x6, 0x2, 0x2, 0x2, 0x4, 0x4, 0x0, 0x0, 0x6, 0x6, 0x6, 0x4, 0x4, 0x4, }; +static const uint8 kSharedOverworldPathTables_HardCodedOWPaths_Layer1AndMovementTableIndex[10] = { 0x0, 0x6, 0xc, 0x10, 0x14, 0x1a, 0x20, 0x2f, 0x3e, 0x41, }; +static const uint8 kOverworldProcess04_PlayerIsMoving_OWPlayerPathSpeedOffset[2] = { 0xd, 0x8, }; +static const uint16 kOverworldProcess04_PlayerIsMoving_MaxOverworlCameraPosition[2] = { 0xffef, 0xffd7, }; +static const uint16 kOverworldProcess04_PlayerIsMoving_MaxOverworlCameraPosition_RightAndBottom[2] = { 0x111, 0x131, }; +static const uint16 kBitTable_Bank04[4] = { 0x8, 0x4, 0x2, 0x1, }; +static const uint16 kOverworldProcess04_PlayerIsMoving_DATA_049426[5] = { 0x4344, 0x4645, 0x4847, 0x4025, 0x4d42, }; +static const uint16 kOverworldProcess04_PlayerIsMoving_DATA_049430[15] = { 0xc, 0xe, 0x610, 0x12, 0x418, 0x21a, 0x620, 0x642, 0x44e, 0x250, 0x658, 0x5a, 0x670, 0x90, 0x6a0, }; +static const uint8 kOverworldProcess04_PlayerIsMoving_DATA_04944E[15] = { 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, }; +static const uint8 kHandleOverworldPathExits_DATA_0499F0[28] = { 0x0, 0x4, 0x0, 0x9, 0x14, 0x2, 0x15, 0x5, 0x14, 0x5, 0x9, 0xd, 0x15, 0xe, 0x9, 0x1e, 0x15, 0x8, 0xa, 0x1c, 0x1e, 0x0, 0x10, 0x19, 0x1f, 0x8, 0x10, 0x1c, }; +static const uint16 kHandleOverworldPathExits_DATA_049A0C[12] = { 0xffef, 0xffd8, 0xffef, 0x80, 0xffef, 0x128, 0xf0, 0xffd8, 0xf0, 0x80, 0xf0, 0x128, }; +static const uint16 kUpdateLevelName_DATA_049C91[31] = { 0x1cb, 0x0, 0x8, 0xd, 0x17, 0x23, 0x2e, 0x3a, 0x43, 0x4e, 0x59, 0x5f, 0x65, 0x75, 0x7d, 0x83, 0x87, 0x8c, 0x9a, 0xa8, 0xb2, 0xc2, 0xc9, 0xd3, 0xe5, 0xf7, 0xfe, 0x108, 0x113, 0x11a, 0x122, }; +static const uint16 kUpdateLevelName_DATA_049CCF[15] = { 0x1cb, 0x12b, 0x131, 0x138, 0x146, 0x14d, 0x154, 0x160, 0x167, 0x16c, 0x175, 0x180, 0x18a, 0x18f, 0x195, }; +static const uint16 kUpdateLevelName_DATA_049CED[13] = { 0x1cb, 0x19d, 0x19e, 0x19f, 0x1a0, 0x1a1, 0x1a2, 0x1a8, 0x1ac, 0x1b2, 0x1b7, 0x1c1, 0x1c6, }; +static const uint16 kSharedOverworldPathTables_DATA_049EA7[81] = { 0xf810, 0x10, 0xfc10, 0x10, 0xfc10, 0x10, 0xfc08, 0xf40c, 0x4fc, 0xfc04, 0x10f8, 0x1000, 0x8fc, 0x8fc, 0x10fc, 0x1000, 0x4f8, 0x10fc, 0x1000, 0x810, 0x410, 0x410, 0x408, 0xc0c, 0x404, 0x404, 0x1008, 0xf8fc, 0xf8fc, 0x1004, 0xfcf8, 0x1004, 0xf4f4, 0xf40c, 0x10, 0x1000, 0x1000, 0x10, 0x10, 0x8fc, 0x8fc, 0x1000, 0xfc10, 0xfc10, 0x4fc, 0xfc04, 0x10f8, 0x1000, 0x10fc, 0x410, 0x10, 0x1004, 0x404, 0xf8fc, 0x404, 0x810, 0xf40c, 0x1000, 0x10fc, 0x10, 0x1004, 0xf810, 0x1000, 0x1000, 0x10fc, 0x10, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0xfc04, 0x404, 0x404, 0x1000, 0x1000, 0x10, 0x10, 0x10fc, 0x4fc, }; +static const uint16 kSharedOverworldPathTables_DATA_049F49[81] = { 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x100, 0x100, 0x100, 0x100, 0x1, 0x1, 0x100, 0x1, 0x1, 0x1, 0x100, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x100, 0x100, 0x1, 0x100, 0x1, 0x100, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x100, 0x1, 0x1, 0x1, 0x1, 0x100, 0x100, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x100, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x100, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x100, }; +static const uint8 kSharedOverworldPathTables_DATA_049FEB[81] = { 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x4, 0x4, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x4, 0x4, 0x8, 0x8, 0x8, 0xc, 0xc, 0x8, 0x8, 0x8, 0x8, 0x8, 0xc, 0xc, 0x8, 0x8, 0x8, 0x8, 0xc, 0x8, 0x8, 0x8, 0xc, 0x8, 0xc, 0x14, 0x14, 0x14, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x4, 0x8, 0 }; +static const uint8 kSharedOverworldPathTables_DATA_04A03C[24] = { 0x7, 0x9, 0xa, 0xd, 0xe, 0x11, 0x17, 0x19, 0x1a, 0x1c, 0x1d, 0x1f, 0x28, 0x29, 0x2d, 0x2e, 0x35, 0x36, 0x37, 0x49, 0x4a, 0x4b, 0x4d, 0x51, }; +static const uint16 kSharedOverworldPathTables_DATA_04A054[24] = { 0xfc08, 0x8fc, 0x8fc, 0x8fc, 0x8fc, 0x4, 0x408, 0x804, 0x804, 0x4, 0x804, 0x4, 0x8fc, 0x0, 0x8fc, 0x8fc, 0x4, 0x4, 0x0, 0xfc08, 0x408, 0x408, 0x8fc, 0xfc08, }; +static const uint16 kSharedOverworldPathTables_DATA_04A084[48] = { 0x4, 0xfff8, 0x8, 0xfffc, 0xfff8, 0x4, 0xfff8, 0x4, 0x8, 0xfffc, 0x4, 0x4, 0x4, 0x8, 0x8, 0x4, 0xfff8, 0xfffc, 0x0, 0x0, 0x8, 0x4, 0x4, 0x4, 0xfff8, 0x4, 0x4, 0x4, 0x8, 0xfffc, 0xfff8, 0x4, 0x4, 0x4, 0x0, 0x0, 0x4, 0x4, 0x4, 0xfff8, 0x4, 0x8, 0xfffc, 0xfff8, 0xfff8, 0x4, 0xfffc, 0x8, }; +static const uint8 kSharedOverworldPathTables_DATA_04A0E4[24] = { 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, 0x2, 0x2, 0x2, 0x0, 0x2, 0x0, 0x2, 0x0, 0x2, 0x2, 0x0, 0x0, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2, }; +static const uint8 kLoadOverworldLayer1AndEvents_DATA_04D678[113] = { 0x0, 0xc0, 0xc0, 0xc0, 0x30, 0xc0, 0xc0, 0x0, 0xc0, 0x20, 0x30, 0xc0, 0xc0, 0xc0, 0xc0, 0xd0, 0x40, 0x40, 0x40, 0xd0, 0x40, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x80, 0x20, 0x80, 0x40, 0x40, 0x80, 0x60, 0x90, 0x0, 0x0, 0xc0, 0x0, 0x0, 0x0, 0xc0, 0x40, 0x20, 0x40, 0xc0, 0xe0, 0xc0, 0x0, 0xc0, 0x0, 0x0, 0xc0, 0x20, 0x80, 0x80, 0x80, 0x80, 0x30, 0x40, 0xe0, 0x0, 0x40, 0xe0, 0xe0, 0xd0, 0x70, 0xff, 0x40, 0x90, 0x55, 0x80, 0x80, 0x80, 0x80, 0x0, 0xc0, 0xc0, 0xc0, 0xc0, 0x40, 0x0, 0x80, 0xa0, 0x30, 0xaa, 0x60, 0xd0, 0x80, 0x0, 0x55, 0x55, 0x0, 0x0, 0xaa, 0x55, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint16 kChangingLayer1OverworldTiles_Layer1TileLocation[112] = { 0x0, 0x0, 0x0, 0x469, 0x44b, 0x429, 0x409, 0xd3, 0xe5, 0xa5, 0xd1, 0x85, 0xa9, 0xcb, 0xbd, 0x9d, 0xa5, 0x207, 0x0, 0x227, 0x512, 0x608, 0x4e3, 0x4c8, 0x62a, 0x4ec, 0x60c, 0x61c, 0x64a, 0x0, 0x4e0, 0x3e, 0x130, 0x134, 0x136, 0x13a, 0x0, 0x157, 0x184, 0x13a, 0x0, 0x0, 0x6aa, 0x676, 0x6c8, 0x6ac, 0x676, 0x0, 0x0, 0x6a4, 0x6aa, 0x6c4, 0x0, 0x304, 0x0, 0x0, 0x579, 0x577, 0x559, 0x574, 0x0, 0x554, 0x0, 0x534, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3b3, 0x0, 0x0, 0x0, 0x2df, 0x2dc, 0x0, 0x27e, 0x0, 0x0, 0x0, 0x4e0, 0x4e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x534, 0x534, 0x0, 0x0, 0x787, 0x0, 0x1f0, 0x368, 0x365, 0x3b5, 0x0, 0x736, 0x739, 0x73c, 0x71c, 0x719, 0x716, 0x713, 0x711, 0x0, 0x0, 0x0, }; +static const uint16 kOwEventProcess01_DestroyTileAnimation_DATA_04D93D[112] = { 0x0, 0x0, 0x0, 0x9221, 0x1621, 0x9220, 0x1220, 0x4623, 0x8a23, 0x8a22, 0x4223, 0xa22, 0x9222, 0x1623, 0xda22, 0x5a22, 0x8a22, 0xe28, 0x0, 0x8e28, 0x424, 0x1028, 0x8623, 0x1023, 0x9428, 0x9823, 0x1828, 0x5828, 0x1429, 0x0, 0x8023, 0xdc20, 0xc024, 0xc824, 0xcc24, 0xd424, 0x0, 0x4e25, 0x826, 0xd424, 0x0, 0x0, 0x942a, 0xcc29, 0x102b, 0x982a, 0xcc29, 0x0, 0x0, 0x882a, 0x942a, 0x82b, 0x0, 0x82c, 0x0, 0x0, 0xd225, 0xce25, 0x5225, 0xc825, 0x0, 0x4825, 0x0, 0xc824, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc62e, 0x0, 0x0, 0x0, 0x5e2b, 0x582b, 0x0, 0xdc29, 0x0, 0x0, 0x0, 0x8023, 0x8023, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc824, 0xc824, 0x0, 0x0, 0xe2e, 0x0, 0xc027, 0x902d, 0x8a2d, 0xca2e, 0x0, 0xcc2c, 0xd22c, 0xd82c, 0x582c, 0x522c, 0x4c2c, 0x462c, 0x422c, 0x0, 0x0, 0x0, }; +static const uint8 kChangingLayer1OverworldTiles_TilesThatChange[22] = { 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x59, 0x53, 0x52, 0x83, 0x4d, 0x57, 0x5a, 0x76, 0x78, 0x7a, 0x7b, 0x7d, 0x7f, 0x54, }; +static const uint8 kChangingLayer1OverworldTiles_TilesToBecome[22] = { 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x58, 0x43, 0x44, 0x45, 0x25, 0x5e, 0x5f, 0x77, 0x79, 0x63, 0x7c, 0x7e, 0x80, 0x23, }; +static const uint8 kInitializeOverworldTilemaps_PARAMS_04DAB3[7] = { 0x1, 0x18, 0x0, 0x40, 0x7f, 0x0, 0x20, }; +static const uint16 kSubmapSwitchProcess00_InitializeWindowHDMA_DATA_04DB08[2] = { 0xf900, 0x700, }; +static const uint8 kSubmapSwitchProcess00_InitializeWindowHDMA_DATA_04DB0C[4] = { 0x0, 0x0, 0x0, 0x70, }; +static const uint16 kSubmapSwitchProcess00_InitializeWindowHDMA_DATA_04DB10[2] = { 0xfac0, 0x540, }; +static const uint8 kSubmapSwitchProcess00_InitializeWindowHDMA_DATA_04DB14[4] = { 0x0, 0x0, 0x0, 0x54, }; +static const uint8 kSubmapSwitchProcess07_EndSubmapSwitch_DATA_04DBC8[7] = { 0x2, 0x3, 0x4, 0x6, 0x7, 0x9, 0x5, }; +static const uint8 kLoadOverworldLayer1AndEvents_DATA_04DC02[7] = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, }; +static const uint16 kLayer2EventData_Ptrs[121] = { 0x0, 0x0, 0xd, 0xd, 0x10, 0x15, 0x18, 0x1a, 0x20, 0x23, 0x26, 0x29, 0x2c, 0x35, 0x39, 0x3a, 0x42, 0x46, 0x4a, 0x4c, 0x4d, 0x4e, 0x52, 0x59, 0x5d, 0x60, 0x67, 0x6a, 0x6c, 0x6f, 0x72, 0x75, 0x77, 0x77, 0x83, 0x83, 0x84, 0x8e, 0x90, 0x92, 0x98, 0x98, 0x98, 0xa0, 0xa5, 0xac, 0xb2, 0xbd, 0xc2, 0xc5, 0xcc, 0xd3, 0xd7, 0xe1, 0xe2, 0xe2, 0xe2, 0xe5, 0xe7, 0xe8, 0xed, 0xee, 0xf1, 0xf5, 0xfa, 0xfd, 0x100, 0x100, 0x100, 0x100, 0x100, 0x102, 0x108, 0x10f, 0x112, 0x114, 0x116, 0x117, 0x11e, 0x12b, 0x12b, 0x12b, 0x12b, 0x12f, 0x12f, 0x12f, 0x133, 0x133, 0x133, 0x137, 0x137, 0x137, 0x140, 0x140, 0x146, 0x146, 0x146, 0x147, 0x152, 0x156, 0x15c, 0x15c, 0x15f, 0x162, 0x165, 0x168, 0x16b, 0x16e, 0x171, 0x173, 0x173, 0x173, 0x173, 0x173, 0x173, 0x173, 0x173, 0x173, 0x173, 0x173, 0x173, }; +static const uint8 kBitTable_DATA_04E44B[8] = { 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1, }; +static const uint16 kOwEventProcess01_DestroyTileAnimation_DATA_04E587[16] = { 0x5220, 0xda22, 0x5828, 0xc024, 0x9424, 0x4223, 0x9428, 0x982a, 0xe25, 0x5225, 0xc425, 0xde2a, 0x982a, 0x4428, 0x502c, 0xc2c, }; +static const uint8 kCheckIfDestroyTileEventIsActive_DATA_04E5A7[5] = { 0x77, 0x79, 0x58, 0x4c, 0xa6, }; +static const uint8 kCheckIfDestroyTileEventIsActive_DATA_04E5AC[5] = { 0x85, 0x86, 0x0, 0x10, 0x0, }; +static const uint8 kCheckIfDestroyTileEventIsActive_DATA_04E5B1[5] = { 0x85, 0x86, 0x81, 0x81, 0x81, }; +static const uint16 kCheckIfDestroyTileEventIsActive_DATA_04E5B6[16] = { 0x419, 0xbd, 0x61c, 0x130, 0x12a, 0xd1, 0x62a, 0x6ac, 0x547, 0x559, 0x572, 0x2bf, 0x2ac, 0x212, 0x318, 0x306, }; +static const uint8 kCheckIfDestroyTileEventIsActive_EventNums[16] = { 0x6, 0xf, 0x1c, 0x21, 0x24, 0x28, 0x29, 0x37, 0x40, 0x41, 0x43, 0x4a, 0x4d, 0x2, 0x61, 0x35, }; +static const uint16 kOwEventProcess00_CheckIfEventShouldRun_DATA_04E5E6[4] = { 0x5958, 0x635d, 0x7977, 0x807e, }; +static const uint8 kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles[44] = { 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x14, 0x14, 0x14, 0x14, 0x14, 0x1d, 0x1d, 0x1d, 0x1d, 0x12, 0x12, 0x12, 0x1c, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x34, 0x34, 0x34, 0x47, 0x4e, 0x4e, 0x1, 0xf, 0x24, 0x24, 0x6c, 0xf, 0xf, 0x54, 0x55, 0x57, 0x58, 0x5d, }; +static const uint8 kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TileLayer[44] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint16 kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TilemapLocation[44] = { 0x215, 0x235, 0x245, 0x255, 0x265, 0x275, 0x1114, 0x1094, 0xa9, 0x5a4, 0x524, 0x728, 0x6a4, 0x1a8, 0x1ac, 0x1b0, 0x3c, 0x2900, 0x2880, 0x510, 0x154, 0x1830, 0x18b0, 0x192e, 0x192a, 0x1926, 0x1824, 0x1820, 0x181c, 0x597, 0x2aec, 0x57b, 0x212, 0x3194, 0x32a0, 0x3320, 0x1d16, 0x3114, 0x625, 0x1f0, 0x1f0, 0x304, 0x304, 0x227, }; +static const uint16 kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TileNum[44] = { 0x68, 0x24, 0x24, 0x25, 0x0, 0x81, 0x938, 0x928, 0x66, 0x99c, 0x928, 0x9f8, 0x9fc, 0x998, 0x998, 0x928, 0x66, 0x938, 0x928, 0x66, 0x68, 0xa80, 0xa84, 0xa88, 0x998, 0x998, 0x994, 0x998, 0xa8c, 0x66, 0x384, 0x66, 0x79, 0xaa8, 0x938, 0x938, 0x9a0, 0xa30, 0x69, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, }; +static const uint8 kOwEventProcess01_DestroyTileAnimation_DATA_04EB56[44] = { 0xf5, 0x11, 0xf2, 0x15, 0xf5, 0x11, 0xf3, 0x14, 0xf5, 0x11, 0xf3, 0x14, 0xf6, 0x10, 0xf4, 0x13, 0xf7, 0xf, 0xf5, 0x12, 0xf8, 0xe, 0xf7, 0x11, 0xfa, 0xd, 0xf9, 0x10, 0xfc, 0xc, 0xfb, 0xd, 0xff, 0xa, 0xfe, 0xb, 0x1, 0x7, 0x1, 0x7, 0x0, 0x8, 0x0, 0x8, }; +static const uint8 kOwEventProcess01_DestroyTileAnimation_DATA_04EB82[44] = { 0xf8, 0xf8, 0x11, 0x12, 0xf8, 0xf8, 0x10, 0x11, 0xf8, 0xf8, 0x10, 0x11, 0xf9, 0xf9, 0xf, 0x10, 0xfa, 0xfa, 0xe, 0xf, 0xfb, 0xfb, 0xc, 0xd, 0xfc, 0xfc, 0xb, 0xb, 0xfe, 0xfe, 0xa, 0xa, 0x0, 0x0, 0x8, 0x8, 0x1, 0x1, 0x7, 0x7, 0x0, 0x0, 0x8, 0x8, }; +static const uint8 kOwEventProcess01_DestroyTileAnimation_DATA_04EBAE[44] = { 0xf6, 0xb6, 0x76, 0x36, 0xf6, 0xb6, 0x76, 0x36, 0x36, 0x76, 0xb6, 0xf6, 0x36, 0x76, 0xb6, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x30, 0x70, 0xb0, 0xf0, }; +static const uint8 kOwEventProcess01_DestroyTileAnimation_DATA_04EBDA[7] = { 0x22, 0x23, 0x32, 0x33, 0x32, 0x23, 0x22, }; +static const uint8 kOwEventProcess01_DestroyTileAnimation_DATA_04EBE1[10] = { 0x73, 0x73, 0x72, 0x72, 0x5f, 0x5f, 0x28, 0x28, 0x28, 0x28, }; +static const uint8 kDrawFlyingSwitchBlocks_XSpeed[8] = { 0x0, 0xd8, 0x28, 0xd0, 0x30, 0xd8, 0x28, 0x0, }; +static const uint8 kDrawFlyingSwitchBlocks_YSpeed[8] = { 0xd0, 0xd8, 0xd8, 0x0, 0x0, 0x28, 0x28, 0x30, }; +static const uint8 kOwPrompt02_ExpandPromptWindow_DATA_04F411[2] = { 0x4, 0xfc, }; +static const uint8 kOwPrompt02_ExpandPromptWindow_DATA_04F413[2] = { 0x68, 0x0, }; +static const uint8 kLifeExchangeText_Mario[14] = { 0x52, 0x49, 0x0, 0x9, 0x16, 0x28, 0xa, 0x28, 0x1b, 0x28, 0x12, 0x28, 0x18, 0x28, }; +static const uint16 kOwPrompt03_OverworldLifeExchanger_DATA_04F503[2] = { 0x387d, 0x787e, }; +static const uint16 kOwPrompt03_OverworldLifeExchanger_DATA_04F507[2] = { 0x387e, 0x787d, }; +static const uint16 kOwPrompt03_OverworldLifeExchanger_DATA_04F50B[2] = { 0xb87d, 0xf87e, }; +static const uint16 kOwPrompt03_OverworldLifeExchanger_DATA_04F50F[2] = { 0xb87e, 0xf87d, }; +static const uint8 kLoadOverworldSprites_SubmapBooXPosOffset[6] = { 0x30, 0x0, 0x0, 0x1, 0x10, 0xff, }; +static const uint8 kLoadOverworldSprites_SubmapBooYPosOffset[6] = { 0x20, 0x0, 0x70, 0xff, 0x10, 0x0, }; +static const uint8 kLoadOverworldSprites_UNK_04F672[3] = { 0x1, 0x40, 0x80, }; +static const uint8 kOverworldLightningAndRandomCloudSpawning_DATA_04F6D0[8] = { 0x70, 0x7f, 0x78, 0x7f, 0x70, 0x7f, 0x78, 0x7f, }; +static const uint16 kOverworldLightningAndRandomCloudSpawning_DATA_04F6D8[8] = { 0xfff0, 0x20, 0xc0, 0xfff0, 0xfff0, 0x80, 0xfff0, 0x0, }; +static const uint16 kOverworldLightningAndRandomCloudSpawning_DATA_04F6E8[8] = { 0x70, 0x160, 0x158, 0xb0, 0x160, 0x160, 0x70, 0x160, }; +const uint8 kOverworldLightningAndRandomCloudSpawning_DATA_04F6F8[8] = { 0x20, 0x58, 0x43, 0xcf, 0x18, 0x34, 0xa2, 0x5e, }; +const uint8 kOverworldLightningAndRandomCloudSpawning_DATA_04F700[8] = { 0x7, 0x5, 0x6, 0x7, 0x4, 0x6, 0x7, 0x5, }; +static const uint8 kCheckIfXIsAllowedOnYSubmap_DisableSpriteOnXSubmapFlags[10] = { 0x7f, 0x21, 0x7f, 0x7f, 0x7f, 0x77, 0x3f, 0xf7, 0xf7, 0x0, }; +static const uint8 kSetOverworldSpriteFrameIndex_DATA_04F833[16] = { 0x0, 0x52, 0x31, 0x19, 0x45, 0x2a, 0x3, 0x8b, 0x94, 0x3c, 0x78, 0xd, 0x36, 0x5e, 0x87, 0x1f, }; +static const uint8 kOverworldSpriteOAMIndexes[16] = { 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0x9c, 0x3c, 0x48, 0xc8, 0xcc, 0xa0, 0xa4, 0xd8, 0xdc, 0xe0, 0xe4, }; +static const uint8 kCheckIfXIsAllowedOnYSubmap_ANDTable[7] = { 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, }; +static const uint8 kOWSpr01_Lakitu_DATA_04F8A6[8] = { 0x1, 0x1, 0x3, 0x1, 0x1, 0x1, 0x1, 0x2, }; +static const uint8 kOWSpr01_Lakitu_DATA_04F8AE[8] = { 0xc, 0xc, 0x12, 0x12, 0x12, 0x12, 0xc, 0xc, }; +static const uint8 kOWSpr01_Lakitu_DATA_04F8B6[8] = { 0x10, 0x0, 0x8, 0x0, 0x20, 0x0, 0x20, 0x0, }; +static const uint8 kOWSpr01_Lakitu_DATA_04F8BE[8] = { 0x10, 0x0, 0x30, 0x0, 0x8, 0x0, 0x10, 0x0, }; +static const uint8 kOWSpr01_Lakitu_Acceleration[2] = { 0x1, 0xff, }; +static const uint8 kOWSpr01_Lakitu_XYSpeedCap[2] = { 0x10, 0xf0, }; +static const uint8 kOWSpr01_Lakitu_ZSpeedCap[2] = { 0x10, 0xf0, }; +static const uint8 kOWSpr02_BlueBird_DATA_04F9A8[4] = { 0x4e, 0x4f, 0x5e, 0x4f, }; +static const uint8 kOWSpr02_BlueBird_DATA_04F9AC[4] = { 0x8, 0x7, 0x4, 0x7, }; +static const uint8 kOWSpr02_BlueBird_DATA_04F9B0[4] = { 0x0, 0x1, 0x4, 0x1, }; +static const uint8 kOWSpr02_BlueBird_DATA_04F9B4[4] = { 0x1, 0x7, 0x9, 0x7, }; +static const uint8 kOWSpr06_KoopaKid_DATA_04FB85[3] = { 0x80, 0x40, 0x20, }; +static const uint8 kOWSpr06_KoopaKid_InitialXLo[3] = { 0x30, 0x10, 0xc0, }; +static const uint8 kOWSpr06_KoopaKid_InitialXHi[3] = { 0x1, 0x1, 0x1, }; +static const uint8 kOWSpr06_KoopaKid_InitialYLo[3] = { 0x7f, 0x7f, 0x8f, }; +static const uint8 kOWSpr06_KoopaKid_InitialYHi[3] = { 0x1, 0x0, 0x1, }; +static const uint8 kOWSpr06_KoopaKid_byte_4FB94[2] = { 0x8, 0x2, }; +static const uint8 kOWSpr06_KoopaKid_byte_4FB96[2] = { 0xf, 0x0, }; +static const uint16 kOWSpr07_Smoke_DATA_04FC1E[2] = { 0x38, 0x68, }; +static const uint16 kOWSpr07_Smoke_DATA_04FC22[2] = { 0x18a, 0x6a, }; +static const uint8 kOWSpr07_Smoke_DATA_04FC26[16] = { 0x1, 0x2, 0x3, 0x4, 0x3, 0x2, 0x1, 0x0, 0x1, 0x2, 0x3, 0x4, 0x3, 0x2, 0x1, 0x0, }; +static const uint8 kOWSpr07_Smoke_DATA_04FC36[16] = { 0xff, 0xff, 0xfe, 0xfd, 0xfd, 0xfc, 0xfb, 0xfb, 0xfa, 0xf9, 0xf9, 0xf8, 0xf7, 0xf7, 0xf6, 0xf5, }; +static const uint8 kOWSpr09_Bowser_DATA_04FD0A[6] = { 0x7, 0x7, 0x3, 0x3, 0x5f, 0x5f, }; +static const uint8 kOWSpr09_Bowser_DATA_04FD10[10] = { 0x1, 0xff, 0x1, 0xff, 0x1, 0xff, 0x1, 0xff, 0x1, 0xff, }; +// todo: why 10 +static const uint8 kOWSpr09_Bowser_DATA_04FD1A[10] = { 0x18, 0xe8, 0xa, 0xf6, 0x8, 0xf8, 0x3, 0xfd, 0x1, 0xff,}; +static const uint8 kOWSpr09_Bowser_DATA_04FD22[2] = { 0x1, 0xff, }; +static const uint8 kDrawOverworldSpriteShadow_LeftTileXDisp[16] = { 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2, 0x0, 0x0, 0x1, 0x1, 0x2, 0x2, 0x3, 0x3, }; +static const uint8 kDrawOverworldSpriteShadow_RightTileXDisp[16] = { 0x8, 0x8, 0x8, 0x8, 0x7, 0x6, 0x5, 0x5, 0x0, 0x0, 0xe, 0xe, 0xc, 0xc, 0xa, 0xa, }; + + void OwTileAnimations_ShiftWaterTiles() { // 048086 - *(uint16 *)&R3_ = 0; - *(uint16 *)&R5_ = 0; + uint16 r3 = 0; + uint16 r5 = 0; do { - R0_W = kOwTileAnimations_WaterTileNumbers[*(uint16 *)&R3_ >> 1]; - R2_ = 126; - OwTileAnimations_0480B9(*(uint16 *)&R5_); - *(uint16 *)&R5_ += 32; - *(uint16 *)&R3_ += 2; - } while (R3_ != 6); + OwTileAnimations_0480B9(r5, g_ram + kOwTileAnimations_WaterTileNumbers[r3 >> 1]); + r5 += 32; + r3 += 2; + } while (r3 != 6); } -void OwTileAnimations_0480B9(uint16 k) { // 0480b9 +void OwTileAnimations_0480B9(uint16 k, const uint8 *p0) { // 0480b9 uint16 v1 = 0; - *(uint16 *)&R7_ = 8; - *(uint16 *)&R9_ = 8; + uint16 r7 = 8; + uint16 r9 = 8; do { - *(uint16 *)&sprites_cutscene_sprite_table_0AF6[k] = *(uint16 *)IndirPtr(&R0_W, v1); + *(uint16 *)&sprites_cutscene_sprite_table_0AF6[k] = WORD(p0[v1]); v1 += 2; k += 2; - --*(uint16 *)&R7_; - } while (*(uint16 *)&R7_); + } while (--r7); do { - *(uint16 *)&sprites_cutscene_sprite_table_0AF6[k] = *IndirPtr(&R0_W, v1++); + *(uint16 *)&sprites_cutscene_sprite_table_0AF6[k] = p0[v1++]; k += 2; - --*(uint16 *)&R9_; - } while (*(uint16 *)&R9_); + } while (--r9); } void OwTileAnimations() { // 0480e0 if ((counter_global_frames & 7) == 0) { for (uint8 i = 31; (i & 0x80) == 0; --i) { - R0_ = sprites_cutscene_sprite_table_0AF6[i]; + uint8 r0 = sprites_cutscene_sprite_table_0AF6[i]; if ((i & 8) != 0) { - bool v1 = R0_ & 1; - R0_ >>= 1; + bool v1 = r0 & 1; int8 v2 = 0; if (v1) v2 = 0x80; sprites_cutscene_sprite_table_0AF6[i] = (sprites_cutscene_sprite_table_0AF6[i] >> 1) + v2; } else { - bool v1 = __CFSHL__(R0_, 1); - R0_ *= 2; + bool v1 = __CFSHL__(r0, 1); sprites_cutscene_sprite_table_0AF6[i] = 2 * sprites_cutscene_sprite_table_0AF6[i] + v1; } } @@ -104,31 +231,30 @@ void OwTileAnimations() { // 0480e0 2 * sprites_cutscene_sprite_sub_xpos[j + 4] + __CFSHL__(sprites_cutscene_sprite_sub_xpos[j + 4], 1); OwTileAnimations_048172(0x40); } - *(uint16 *)&R13_ = 96; - *(uint16 *)&R11_ = 0; + uint16 r13w = 96; + uint16 r11w = 0; do { int16 v4 = 56; - if (*(uint16 *)&R11_ < 0x20) + if (r11w < 0x20) v4 = 112; - int16 v5 = (uint16)(*(uint16 *)&counter_global_frames & v4) >> 2; + int16 v5 = (uint16)(counter_global_frames & v4) >> 2; if (v4 != 56) - v5 = (uint16)(*(uint16 *)&counter_global_frames & v4) >> 3; - R0_W = kOwTileAnimations_TileNumbers[(uint16)(*(uint16 *)&R11_ + v5) >> 1]; - R2_ = 126; - OwTileAnimations_0480B9(*(uint16 *)&R13_); - *(uint16 *)&R13_ += 32; - *(uint16 *)&R11_ += 16; - } while (*(uint16 *)&R11_ != 128); + v5 = (uint16)(counter_global_frames & v4) >> 3; + const uint8 *p0 = g_ram + kOwTileAnimations_TileNumbers[(uint16)(r11w + v5) >> 1]; + OwTileAnimations_0480B9(r13w, p0); + r13w += 32; + r11w += 16; + } while (r11w != 128); } void OwTileAnimations_048172(uint8 k) { // 048172 int8 v1 = 0; -LABEL_2: - R0_W = *(uint16 *)&sprites_cutscene_sprite_table_0AF6[(uint8)(k + 14)]; +LABEL_2:; + uint16 r0w = *(uint16 *)&sprites_cutscene_sprite_table_0AF6[(uint8)(k + 14)]; do { - R2_W = *(uint16 *)&sprites_cutscene_sprite_table_0AF6[k]; - *(uint16 *)&sprites_cutscene_sprite_table_0AF6[k] = R0_W; - R0_W = R2_W; + uint16 r2w = *(uint16 *)&sprites_cutscene_sprite_table_0AF6[k]; + *(uint16 *)&sprites_cutscene_sprite_table_0AF6[k] = r0w; + r0w = r2w; k += 2; if (++v1 == 8) goto LABEL_2; @@ -154,40 +280,39 @@ void GameMode0E_ShowOverworld_Bank04() { // 048241 return; } if (flag_pause >> 1) { + uint8 arr0[2]; uint16 v1 = ow_scroll_camera_ypos - mirror_current_layer1_ypos; - *(uint16 *)&R1_ = ow_scroll_camera_ypos - mirror_current_layer1_ypos; + arr0[1] = ow_scroll_camera_ypos - mirror_current_layer1_ypos; if ((int16)(ow_scroll_camera_ypos - mirror_current_layer1_ypos) < 0) v1 = mirror_current_layer1_ypos - ow_scroll_camera_ypos; - R5_ = v1 >> 1; + uint8 arr[2]; + arr[1] = v1 >> 1; uint16 v2 = ow_scroll_camera_xpos - mirror_current_layer1_xpos; - R0_W = ow_scroll_camera_xpos - mirror_current_layer1_xpos; + arr0[0] = ow_scroll_camera_xpos - mirror_current_layer1_xpos; if ((int16)(ow_scroll_camera_xpos - mirror_current_layer1_xpos) < 0) v2 = mirror_current_layer1_xpos - ow_scroll_camera_xpos; v3 = v2 >> 1; - R4_ = v3; + arr[0] = v3; uint8 v4 = 1; - if ((uint8)v3 < R5_) { + if ((uint8)v3 < arr[1]) { v4 = 0; - LOBYTE(v3) = R5_; + LOBYTE(v3) = arr[1]; } if ((uint8)v3 >= 2) { - WriteReg(WRDIVL, 0); - WriteReg(WRDIVH, *(&R4_ + v4)); - WriteReg(WRDIVB, v3); - v5 = ReadRegWord(RDDIVL) >> 2; - if ((*(&R1_ + v4) & 0x80) != 0) + v5 = SnesDivide(arr[v4] << 8, v3) >> 2; + if ((arr0[v4] & 0x80) != 0) LOBYTE(v5) = -(int8)v5; - *(&R1_ + v4) = v5; + arr0[v4] = v5; uint8 v6 = v4 ^ 1; uint8 v7 = 64; - if ((*(&R1_ + v6) & 0x80) != 0) + if ((arr0[v6] & 0x80) != 0) v7 = -64; - *(&R1_ + v6) = v7; + arr0[v6] = v7; uint8 v8 = 1; do { - uint16 t0 = *(&ow_layer1_sub_xpos + v8) + (uint8)(16 * *(&R1_ + v8)); + uint16 t0 = *(&ow_layer1_sub_xpos + v8) + (uint8)(16 * arr0[v8]); *(&ow_layer1_sub_xpos + v8) = t0; - uint16 t = *(&mirror_current_layer1_xpos + v8) + ((int8)*(&R1_ + v8) >> 4) + (t0 >> 8); + uint16 t = *(&mirror_current_layer1_xpos + v8) + ((int8)arr0[v8] >> 4) + (t0 >> 8); *(&mirror_current_layer1_xpos + v8) = t; *(&mirror_current_layer2_xpos + v8) = t; } while ((int8)--v8 >= 0); @@ -256,13 +381,12 @@ void GameMode0E_ShowOverworld_UpdateMainMapFreeScrollingPosition(uint8 k, uint8 bool HandleOverworldStarPipeWarp_GetIndex() { // 048509 uint8 result; - R1_ = ow_players_map[player_current_character]; - R0_ = 0; + uint16 r0w = ow_players_map[player_current_character] << 8; for (result = 52; (result & 0x80) == 0; result -= 2) { int v1 = result >> 1; - if ((uint16)(R0_W ^ kHandleOverworldStarPipeWarp_DATA_048431[v1]) < 0x200) { + if ((uint16)(r0w ^ kHandleOverworldStarPipeWarp_DATA_048431[v1]) < 0x200) { PointU16 *pt = get_PointU16(ow_players_grid_aligned_pos, player_current_characterx4); - if ((R0_W ^ kHandleOverworldStarPipeWarp_DATA_048431[v1]) == pt->x && pt->y == kHandleOverworldStarPipeWarp_DATA_048467[v1]) { + if ((r0w ^ kHandleOverworldStarPipeWarp_DATA_048431[v1]) == pt->x && pt->y == kHandleOverworldStarPipeWarp_DATA_048467[v1]) { break; } } @@ -307,22 +431,22 @@ void sub_485A7() { // 0485a7 --player_anim_timer; if (timer_cape_flap_animation) --timer_cape_flap_animation; - R0_ = 24; - R1_ = 7; + uint8 r0 = 24; + uint8 r1 = 7; uint8 v0 = 0; uint8 v1 = 0; do { - uint8 v2 = R0_; + uint8 v2 = r0; OamEnt *oam = get_OamEnt(oam_buf, v1); - oam->xpos = R0_; - R0_ = v2 + 8; - oam->ypos = R1_; + oam->xpos = r0; + r0 = v2 + 8; + oam->ypos = r1; oam->charnum = 126; oam->flags = 54; sprites_oamtile_size_buffer[v0++] = 0; if ((v0 & 3) == 0) { - R0_ = 24; - R1_ += 8; + r0 = 24; + r1 += 8; } v1 += 4; } while (v0 != 16); @@ -332,43 +456,43 @@ void DrawOverworldPlayer() { // 04862e uint16 v7; uint16 v2; uint16 v5; + uint8 r6, r7; - R0_W = 0; - R4_W = 0; + uint16 r0w = 0; + uint16 r4w = 0; PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); uint16 v1 = pt->x - mirror_current_layer1_xpos; - if (v1 >= 0x100 || (R0_W = pt->x - mirror_current_layer1_xpos, R8_W = v1, v2 = pt->y - mirror_current_layer1_ypos, v2 >= 0x100)) { +// r8w = v1; + if (v1 >= 0x100 || (r0w = pt->x - mirror_current_layer1_xpos, v2 = pt->y - mirror_current_layer1_ypos, v2 >= 0x100)) { v2 = 240; } - R2_W = v2; - R10_W = v2; + uint16 r2w = v2; + //r10w = v2; PointU16 *v3 = get_PointU16(ow_players_pos, player_current_characterx4 ^ 4); uint16 v4 = v3->x - mirror_current_layer1_xpos; - if (v4 >= 0x100 || (R4_W = v3->x - mirror_current_layer1_xpos, R12_W = v4, v5 = v3->y - mirror_current_layer1_ypos, v5 >= 0x100)) { + uint16 r12w = v4; + if (v4 >= 0x100 || (r4w = v3->x - mirror_current_layer1_xpos, v5 = v3->y - mirror_current_layer1_ypos, v5 >= 0x100)) { v5 = 240; } - R6_W = v5; - R14_W = v5; - R0_ -= 8; - R1_ = R2_ - 9; - R2_ = R4_ - 8; - R3_ = R6_ - 9; - temp8c = 3; - R6_ = R0_; - temp8a = R0_; - R7_ = R1_; - temp8b = R1_; + uint16 r14w = v5; + uint8 r0 = r0w - 8; + uint8 r1 = r2w - 9; + uint8 r2 = r4w - 8; + uint8 r3 = v5 - 9; + uint8 tmp8c = 3; + uint8 tmp8a = r6 = r0; + uint8 tmp8b = r7 = r1; uint8 v6 = *((uint8 *)ow_players_animation + ((uint8)player_current_characterx4 >> 1)); if (v6 != 18 && (v6 < 7 || v6 >= 0xF)) { - temp8b -= 5; - R7_ = temp8b; - } - LOBYTE(v7) = HIBYTE(player_current_characterx4); - HIBYTE(v7) = player_current_characterx4; - R4_W = v7 >> 1; - DrawOverworldPlayer_DrawHalo(0); - DrawOverworldPlayer_DrawCurrentPlayer(0, player_current_characterx4 >> 1); + tmp8b -= 5; + r7 = tmp8b; + } + v7 = swap16(player_current_characterx4); + r4w = v7 >> 1; + DrawOverworldPlayer_DrawHalo(0, r4w, (PointU8) { .x = tmp8a, .y = tmp8b }); + DrawOverworldPlayer_DrawCurrentPlayer(0, player_current_characterx4 >> 1, + (PointU8) {.x = tmp8a, .y = tmp8b}, tmp8c, r4w, r6); sprites_oamtile_size_buffer[39] = 0; sprites_oamtile_size_buffer[40] = 0; sprites_oamtile_size_buffer[41] = 0; @@ -377,24 +501,23 @@ void DrawOverworldPlayer() { // 04862e sprites_oamtile_size_buffer[44] = 0; sprites_oamtile_size_buffer[45] = 0; sprites_oamtile_size_buffer[46] = 0; - temp8c = 3; + tmp8c = 3; uint8 v8 = ow_players_map[0]; if (pointer_current_overworld_process == 10) v8 = ow_players_map[0] ^ 1; if (v8 == ow_players_map[1]) { - R6_ = R2_; - temp8a = R2_; - R7_ = R3_; - temp8b = R3_; + uint8 tmp8a = r6 = r2; + uint8 tmp8b = r7 = r3; uint8 v9 = *((uint8 *)ow_players_animation + (((uint8)player_current_characterx4 >> 1) ^ 2)); if (v9 != 18 && (v9 < 7 || v9 >= 0xF)) { - temp8b -= 5; - R7_ = temp8b; - } - if (flag_two_player_game && R12_W < 0xF0 && R14_W < 0xF0) { - R4_W ^= 0x200; - DrawOverworldPlayer_DrawHalo(0x20); - DrawOverworldPlayer_DrawCurrentPlayer(0x20, (player_current_characterx4 >> 1) ^ 2); + tmp8b -= 5; + r7 = tmp8b; + } + if (flag_two_player_game && r12w < 0xF0 && r14w < 0xF0) { + r4w ^= 0x200; + DrawOverworldPlayer_DrawHalo(0x20, r4w, (PointU8) { .x = tmp8a, .y = tmp8b }); + DrawOverworldPlayer_DrawCurrentPlayer(0x20, (player_current_characterx4 >> 1) ^ 2, + (PointU8) {.x = tmp8a, .y = tmp8b }, tmp8c, r4w, r6); sprites_oamtile_size_buffer[47] = 0; sprites_oamtile_size_buffer[48] = 0; sprites_oamtile_size_buffer[49] = 0; @@ -407,29 +530,22 @@ void DrawOverworldPlayer() { // 04862e } } -void DrawOverworldPlayer_DrawHalo(uint16 k) { // 048789 - uint16 v1; - - int16 v5 = *(uint16 *)&temp8a; - LOBYTE(v1) = HIBYTE(R4_W); - HIBYTE(v1) = R4_W; +void DrawOverworldPlayer_DrawHalo(uint16 k, uint16 r4, PointU8 pt) { // 048789 + uint16 v1 = swap16(r4); if (*(int16 *)(&player_current_character + (v1 >> 1)) < 0) { - uint8 v2 = temp8a; OamEnt *oam = get_OamEnt(oam_buf, k); - oam[45].xpos = temp8a; - oam[46].xpos = v2 + 8; - int8 v4 = temp8b - 7; - oam[45].ypos = temp8b - 7; - oam[46].ypos = v4; + oam[45].xpos = pt.x; + oam[46].xpos = pt.x + 8; + oam[45].ypos = pt.y - 7; + oam[46].ypos = pt.y - 7; oam[45].charnum = 124; oam[46].charnum = 124; oam[45].flags = 32; oam[46].flags = 96; } - *(uint16 *)&temp8a = v5; } -uint8 DrawOverworldPlayer_DrawCurrentPlayer(uint8 k_in, uint8 j) { // 04894f +uint8 DrawOverworldPlayer_DrawCurrentPlayer(uint8 k_in, uint8 j, PointU8 pt, uint8 tmp8c, uint16 r4w, uint8 r6) { // 04894f uint16 v3; uint16 v5; uint16 k = k_in; @@ -437,62 +553,58 @@ uint8 DrawOverworldPlayer_DrawCurrentPlayer(uint8 k_in, uint8 j) { // 04894f int16 v2 = k; v3 = j >> 1; if (players_has_yoshi[(uint8)v3]) { - R14_ = players_has_yoshi[(uint8)v3]; - R15_ = 0; + uint16 yoshi = players_has_yoshi[(uint8)v3]; LOBYTE(v3) = j; - temp8c = 7; - R0_W = 16 * ow_players_animation[v3 >> 1]; - uint16 v7 = R0_W + 2 * (counter_global_frames & 8); + tmp8c = 7; + uint16 r0w = 16 * ow_players_animation[v3 >> 1]; + uint16 v7 = r0w + 2 * (counter_global_frames & 8); if (!k && *(uint16 *)&pointer_current_overworld_process == 11) v7 = kDrawOverworldPlayer_StarWarpAnimationOffset[(uint8)(counter_global_frames & 0xC) >> 2]; do { uint16 v12 = v7; uint16 v8 = v7 >> 1; OamEnt *oam = get_OamEnt(oam_buf, k); - oam[39].xpos = temp8a + kDrawOverworldPlayer_PlayerAndYoshiXDisp[v8]; - oam[39].ypos = temp8b + kDrawOverworldPlayer_PlayerAndYoshiYDisp[v8]; + oam[39].xpos = pt.x + kDrawOverworldPlayer_PlayerAndYoshiXDisp[v8]; + oam[39].ypos = pt.y + kDrawOverworldPlayer_PlayerAndYoshiYDisp[v8]; uint16 v10 = v12; uint16 v11 = *(uint16 *)&kDrawOverworldPlayer_PlayerRidingYoshiTilesAndProp[v12]; if (v11 != 0xffff) { uint16 v13 = *(uint16 *)&kDrawOverworldPlayer_PlayerRidingYoshiTilesAndProp[v12]; uint16 v14; if ((v11 & 0xF00) == 512) { - R8_W = v10; - v14 = kDrawOverworldPlayer_YoshiPalette[(uint16)(R14_W - 4) >> 1] | v13 & 0xF0FF; - v10 = R8_W; + v14 = kDrawOverworldPlayer_YoshiPalette[(yoshi - 4) >> 1] | v13 & 0xF0FF; } else { - v14 = R4_W + v13; + v14 = r4w + v13; } *(uint16 *)&oam[39].charnum = v14; } k = k + 4; v7 = v10 + 2; - --temp8c; - } while ((temp8c & 0x80) == 0); + } while ((--tmp8c & 0x80) == 0); } else { LOBYTE(v3) = j; - R0_W = 16 * ow_players_animation[v3 >> 1]; - uint16 v4 = R0_W + (counter_global_frames & 0x18); - LOBYTE(v5) = HIBYTE(R4_W); - HIBYTE(v5) = R4_W; + uint16 r0w = 16 * ow_players_animation[v3 >> 1]; + uint16 v4 = r0w + (counter_global_frames & 0x18); + v5 = swap16(r4w); if (*(int16 *)(&player_current_character + (v5 >> 1)) >= 0) { if (!k && *(uint16 *)&pointer_current_overworld_process == 11) v4 = kDrawOverworldPlayer_StarWarpAnimationOffset[(uint8)(counter_global_frames & 0xC) >> 2]; } else { - v4 = R0_W; + v4 = r0w; } do { OamEnt *v6 = get_OamEnt(oam_buf, k); - *(uint16 *)&v6[39].xpos = *(uint16 *)&temp8a; - *(uint16 *)&v6[39].charnum = R4_W + kDrawOverworldPlayer_PlayerTilesAndProp[v4 >> 1]; + v6[39].xpos = pt.x; + v6[39].ypos = pt.y; + *(uint16 *)&v6[39].charnum = r4w + kDrawOverworldPlayer_PlayerTilesAndProp[v4 >> 1]; k = k + 4; v4 += 2; - temp8a += 8; - if ((--temp8c & 1) != 0) { - temp8a = R6_; - temp8b += 8; + pt.x += 8; + if ((--tmp8c & 1) != 0) { + pt.x = r6; + pt.y += 8; } - } while ((temp8c & 0x80) == 0); + } while ((tmp8c & 0x80) == 0); } return k; } @@ -513,10 +625,10 @@ void GameMode0C_LoadOverworld_048D91() { // 048d91 if (misc_currently_active_boss_end_cutscene) { *(uint16 *)&misc_currently_active_boss_end_cutscene = yoshi_current_yoshi_color << 8; PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); - R0_W = pt->x >> 4; - R2_W = pt->y >> 4; - CalculateOverworldPlayerPosition((uint8)player_current_characterx4 >> 2); - if ((ow_level_tile_settings[ow_level_number_of_each_tiletbl[R4_W]] & 0x80) == 0) { + uint16 r0w = pt->x >> 4; + uint16 r2w = pt->y >> 4; + uint16 r4w = CalculateOverworldPlayerPosition((uint8)player_current_characterx4 >> 2, r0w, r2w); + if ((ow_level_tile_settings[ow_level_number_of_each_tiletbl[r4w]] & 0x80) == 0) { uint16 v3 = 20; while (ow_level_number_lo != kGameMode0C_LoadOverworld_DATA_048D74[v3 >> 1]) { v3 -= 2; @@ -532,14 +644,13 @@ void GameMode0C_LoadOverworld_048D91() { // 048d91 void GameMode0C_LoadOverworld_048E55() { // 048e55 player_current_characterx4 = 4 * player_current_character; PointU16 *pt = get_PointU16(ow_players_grid_aligned_pos, 4 * player_current_character); - R0_W = pt->x; - R2_W = pt->y; - CalculateOverworldPlayerPosition((uint16)(4 * player_current_character) >> 2); - R0_W = 0; - R0_W = kLevelNames[(uint16)(2 * ow_level_number_of_each_tiletbl[R4_W]) >> 1]; - UpdateLevelName(); - if (R4_W <= 0x7FF) - ow_tile_player_is_standing_on = blocks_map16_table_lo[R4_W]; + uint16 r0w = pt->x; + uint16 r2w = pt->y; + uint16 r4w = CalculateOverworldPlayerPosition((uint16)(4 * player_current_character) >> 2, r0w, r2w); + r0w = kLevelNames[(uint16)(2 * ow_level_number_of_each_tiletbl[r4w]) >> 1]; + UpdateLevelName(r0w); + if (r4w <= 0x7FF) + ow_tile_player_is_standing_on = blocks_map16_table_lo[r4w]; if (ow_enter_level_flag) { if ((ow_enter_level_flag & 0x80) == 0) { if ((misc_exit_level_action & 0x80) == 0) @@ -570,17 +681,17 @@ void OwProcess00_OverworldEntryInitialization() { // 048ef1 pointer_current_overworld_process = 12; } else { PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); - R0_W = pt->x >> 4; - R2_W = pt->y >> 4; - CalculateOverworldPlayerPosition((uint8)player_current_characterx4 >> 2); + uint16 r0w = pt->x >> 4; + uint16 r2w = pt->y >> 4; + uint16 r4w = CalculateOverworldPlayerPosition((uint8)player_current_characterx4 >> 2, r0w, r2w); if (flag_got_midpoint && misc_exit_level_action) { if ((misc_exit_level_action & 0x80) == 0) { - *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[R4_W]] = - *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[R4_W]] & 0xFF3F | 0x80; + *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[r4w]] = + *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[r4w]] & 0xFF3F | 0x80; ++*(uint16 *)&pointer_current_overworld_process; goto LABEL_11; } - *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[R4_W]] |= 0x40; + *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[r4w]] |= 0x40; } pointer_current_overworld_process = 5; } @@ -616,13 +727,13 @@ void OwProcess02_HandleLevelBeaten() { // 048f87 } else { ++flag_show_save_prompt; } -LABEL_10: - R6_W = 0; +LABEL_10:; + //r6w = 0; PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); - R0_W = pt->x >> 4; - R2_W = pt->y >> 4; - CalculateOverworldPlayerPosition((uint8)player_current_characterx4 >> 2); - ow_tile_player_is_standing_on = blocks_map16_table_lo[R4_W]; + uint16 r0w = pt->x >> 4; + uint16 r2w = pt->y >> 4; + uint16 r4w = CalculateOverworldPlayerPosition((uint8)player_current_characterx4 >> 2, r0w, r2w); + ow_tile_player_is_standing_on = blocks_map16_table_lo[r4w]; ++pointer_current_overworld_process; } @@ -640,6 +751,7 @@ void OwProcess03_StandingStill() { // 049120 uint8 v0 = 0x91; // note: undefined uint16 j; uint16 v16; + uint16 r8; flag_switch_players = 0; if ((ow_enter_level_flag & 0x80) == 0) { @@ -692,25 +804,24 @@ LABEL_15:; LABEL_18:; uint8 v3 = player_current_characterx4; PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); - R0_W = pt->x >> 4; + uint16 r0w = pt->x >> 4; PointU16 *v5 = get_PointU16(ow_players_grid_aligned_pos, player_current_characterx4); - v5->x = R0_W; - R2_W = pt->y >> 4; - v5->y = R2_W; - CalculateOverworldPlayerPosition(v3 >> 2); + v5->x = r0w; + uint16 r2w = pt->y >> 4; + v5->y = r2w; + uint16 r4w = CalculateOverworldPlayerPosition(v3 >> 2, r0w, r2w); if (misc_exit_level_action) { - R8_ = kSharedOverworldPathTables_DATA_049060[(uint8)(misc_exit_level_action - 1)]; - R9_ = 0; + r8 = kSharedOverworldPathTables_DATA_049060[(uint8)(misc_exit_level_action - 1)]; for (uint16 i = 10; (i & 0x8000) == 0; i -= 2) { - if (ow_level_number_of_each_tiletbl[R4_W] == kSharedOverworldPathTables_NoAutoMoveLevels[i >> 1]) { + if (ow_level_number_of_each_tiletbl[r4w] == kSharedOverworldPathTables_NoAutoMoveLevels[i >> 1]) { *(uint16 *)&pointer_current_overworld_process = 5; UpdateSaveBuffer(); goto LABEL_63; } } - uint16 v7 = ow_level_direction_flags[R4_W]; - int16 v8 = R8_W; - if (R8_W) { + uint16 v7 = ow_level_direction_flags[r4w]; + int16 v8 = r8; + if (r8) { do { v7 >>= 1; --v8; @@ -730,8 +841,8 @@ LABEL_18:; goto LABEL_63; } if ((uint8)ow_tile_player_is_standing_on != 0x82) { - R6_W = 0; - v10 = ow_level_tile_settings[ow_level_number_of_each_tiletbl[R4_W]] & (uint8)v10 & 0xF; +// r6w = 0; + v10 = ow_level_tile_settings[ow_level_number_of_each_tiletbl[r4w]] & (uint8)v10 & 0xF; if (!v10) goto LABEL_63; } @@ -743,28 +854,29 @@ LABEL_18:; break; } } - *(uint16 *)&ow_player_direction = j; + ow_player_direction = j; uint16 v14 = 0; if (j < 4) v14 = 2; - R8_W = R4_W; - *(uint16 *)((int8 *)&R0_W + v14) += kSharedOverworldPathTables_DATA_049058[j >> 1]; - int16 v22; - uint16 v15 = CalculateOverworldPlayerPosition(player_current_characterx4 >> 2); - if ((R4_W & 0x8000) == 0 && v15 < 0x800) { - v16 = blocks_map16_table_lo[R4_W]; - if (blocks_map16_table_lo[R4_W]) { + r8 = r4w; + *(uint16 *)(v14 ? &r2w : &r0w) += kSharedOverworldPathTables_DATA_049058[j >> 1]; + int16 v22; + r4w = CalculateOverworldPlayerPosition(player_current_characterx4 >> 2, r0w, r2w); + uint16 v15 = ow_players_map[player_current_characterx4 >> 2] ? r4w : 0; + if ((r4w & 0x8000) == 0 && v15 < 0x800) { + v16 = blocks_map16_table_lo[r4w]; + if (blocks_map16_table_lo[r4w]) { if (v16 <= 0x86) { LABEL_53: ow_tile_player_is_standing_on = v16; - R0_W = v16; - R2_W = 0; + r0w = v16; + r2w = 0; for (uint16 k = 23; (k & 0x8000) == 0; --k) { - if (kSharedOverworldPathTables_DATA_04A03C[k] == R0_W) { + if (kSharedOverworldPathTables_DATA_04A03C[k] == r0w) { int16 v29 = player_current_characterx4 + WORD(kSharedOverworldPathTables_DATA_04A0E4[k]); int v21 = (uint16)(4 * k) >> 1; - R0_W = kSharedOverworldPathTables_DATA_04A084[v21]; - R2_W = kSharedOverworldPathTables_DATA_04A084[v21 + 1]; + r0w = kSharedOverworldPathTables_DATA_04A084[v21]; + r2w = kSharedOverworldPathTables_DATA_04A084[v21 + 1]; v22 = (uint8)v29; goto LABEL_62; } @@ -772,18 +884,18 @@ LABEL_18:; uint16 v23 = 8; if ((j & 2) == 0) v23 = -8; - R0_W = v23; + r0w = v23; int16 v24 = 0; if (j < 4) v24 = 2; v22 = player_current_characterx4 + v24; LABEL_62:; - uint16 v25 = get_PointU16(ow_players_pos, v22)->x + R0_W; + uint16 v25 = get_PointU16(ow_players_pos, v22)->x + r0w; get_PointU16(players_overworld_xpos_is_going_to, v22)->x = v25; uint16 v26 = v22 ^ 2; - uint16 v27 = get_PointU16(ow_players_pos, v26)->x + R2_W; + uint16 v27 = get_PointU16(ow_players_pos, v26)->x + r2w; get_PointU16(players_overworld_xpos_is_going_to, v26)->x = v27; - R0_W = j; + r0w = j; int v28 = (uint16)((v26 >> 1) & 2) >> 1; ow_players_animation[v28] = j | ow_players_animation[v28] & 8; get_PointU16(l1_l2_scroll_spr_sub_pos, 0)->x = 15; @@ -795,25 +907,25 @@ LABEL_62:; } ow_process_hardcoded_path_flag = 0; ow_hardcoded_path_index = 0; - R0_W = ow_level_number_of_each_tiletbl[R8_W]; + r0w = ow_level_number_of_each_tiletbl[r8]; uint16 v17 = 9; while (kSharedOverworldPathTables_HardCodedOWPaths_LevelNums[v17] != 255) { - if (kSharedOverworldPathTables_HardCodedOWPaths_LevelNums[v17] == R0_W) + if (kSharedOverworldPathTables_HardCodedOWPaths_LevelNums[v17] == r0w) goto LABEL_49; LABEL_51: if ((--v17 & 0x8000) != 0) goto LABEL_52; } PointU16 *v18 = get_PointU16(ow_players_pos, player_current_characterx4); - if (v18->y != kSharedOverworldPathTables_DATA_049082 || v18->x != kSharedOverworldPathTables_DATA_049084 || + if (v18->y != kSharedOverworldPathTables_DATA_049082[0] || v18->x != kSharedOverworldPathTables_DATA_049084[0] || ow_players_map[player_current_character]) { goto LABEL_51; } LABEL_49: - R0_W = v17; + r0w = v17; uint16 v19 = kSharedOverworldPathTables_HardCodedOWPaths_Layer1AndMovementTableIndex[v17]; ow_hardcoded_path_index = v19 - 1; - R2_W = j; + r2w = j; if (kSharedOverworldPathTables_HardCodedOWPaths_MovementDirection[v19] == j) { ow_process_hardcoded_path_flag = 1; v16 = kSharedOverworldPathTables_HardCodedOWPaths_Layer1Tiles[v19]; @@ -835,91 +947,90 @@ void OwProcess04_PlayerIsMoving() { // 04945d uint16 v24; uint16 v25; uint16 v29; + uint16 r14w; + uint16 r8; + uint16 r0w, r2w; while (1) { if (flag_switch_players) { pointer_current_overworld_process = 8; return; } + uint16 arr4[2]; uint8 v0 = player_current_characterx4 + 2; for (uint16 i = 2; (i & 0x8000) == 0; i -= 2) { uint16 x = get_PointU16(players_overworld_xpos_is_going_to, v0)->x; int16 v3 = x - get_PointU16(ow_players_pos, v0)->x; - *(uint16 *)((int8 *)&R0_W + i) = v3; + *(uint16 *)(i ? &r2w : &r0w) = v3; if (v3 < 0) v3 = -v3; - *(uint16 *)((int8 *)&R4_W + i) = v3; + arr4[i >> 1] = v3; v0 -= 2; } uint16 v4 = -1; - R10_W = R4_W; - HIBYTE(v5) = HIBYTE(R6_W); - R12_W = R6_W; - if (R6_W >= R4_W) { - R10_W = R6_W; - HIBYTE(v5) = HIBYTE(R4_W); - R12_W = R4_W; + uint16 r10w = arr4[0]; + uint16 r12 = arr4[1]; + if (arr4[1] >= arr4[0]) { + r10w = arr4[1]; + r12 = arr4[0]; v4 = 1; } - R8_W = v4; - WriteReg(WRMPYA, 16 * kOverworldProcess04_PlayerIsMoving_OWPlayerPathSpeedOffset[ow_player_on_climbing_tile]); - LOBYTE(v5) = R12_; - if (R12_) { - WriteReg(WRMPYB, R12_); - uint16 rw = ReadRegWord(RDMPYL); - WriteRegWord(WRDIVL, rw); - WriteReg(WRDIVB, R10_); - v5 = ReadRegWord(RDDIVL); - } - R14_W = v5; - R10_W = 16 * kOverworldProcess04_PlayerIsMoving_OWPlayerPathSpeedOffset[ow_player_on_climbing_tile]; + r8 = v4; + uint8 ma = 16 * kOverworldProcess04_PlayerIsMoving_OWPlayerPathSpeedOffset[ow_player_on_climbing_tile]; + v5 = r12; + if (v5) { + uint16 rw = Mult8x8(ma, r12); + v5 = SnesDivide(rw, r10w); + } + r14w = v5; + r10w = 16 * kOverworldProcess04_PlayerIsMoving_OWPlayerPathSpeedOffset[ow_player_on_climbing_tile]; for (uint16 j = 2; (j & 0x8000) == 0; j -= 2) { uint16 v8; - if ((R8_W & 0x8000) != 0) - v8 = R14_W; + if ((r8 & 0x8000) != 0) + v8 = r14w; else - v8 = R10_W; - if (*(int16 *)((int8 *)&R0_W + j) < 0) + v8 = r10w; + if ((int16)(j ? r2w : r0w) < 0) v8 = -v8; *(uint16 *)((int8 *)&player_overworld_xspeed + j) = v8; - R8_W = -R8_W; + r8 = -r8; } uint16 v9 = 0; - if ((R8_W & 0x8000) == 0) + if ((r8 & 0x8000) == 0) v9 = 2; - if (*(uint16 *)((int8 *)&R0_W + v9)) + if ((v9 ? r2w : r0w)) break; if (*(uint16 *)l1_l2_scroll_spr_timer) { ow_process_hardcoded_path_flag = 0; PointU16 *pt = get_PointU16(ow_players_grid_aligned_pos, player_current_characterx4); - R0_W = pt->x; - R2_W = pt->y; - CalculateOverworldPlayerPosition(player_current_characterx4 >> 2); - R0_W = 0; - R0_W = kLevelNames[(uint16)(2 * ow_level_number_of_each_tiletbl[R4_W]) >> 1]; - UpdateLevelName(); + uint16 r0w = pt->x; + uint16 r2w = pt->y; + uint16 r4w = CalculateOverworldPlayerPosition(player_current_characterx4 >> 2, r0w, r2w); + r0w = kLevelNames[(uint16)(2 * ow_level_number_of_each_tiletbl[r4w]) >> 1]; + UpdateLevelName(r0w); ++*(uint16 *)&pointer_current_overworld_process; UpdateSaveBuffer(); OwProcess04_PlayerIsMoving_049831(); return; } copy_of_tile_player_is_standingd_on = ow_tile_player_is_standing_on; - R8_W = 8; - uint16 v11 = *(uint16 *)&ow_player_direction; - R10_W = ow_player_direction ^ 2; + r8 = 8; + uint16 v11 = ow_player_direction; + uint16 r4w; + r10w = ow_player_direction ^ 2; while (1) { PointU16 *v13 = get_PointU16(ow_players_grid_aligned_pos, player_current_characterx4); - R0_W = v13->x; - R2_W = v13->y; - uint16 v14 = 0; + r0w = v13->x; + r2w = v13->y; if (v11 < 4) - v14 = 2; - *(uint16 *)((int8 *)&R0_W + v14) += kSharedOverworldPathTables_DATA_049058[v11 >> 1]; - CalculateOverworldPlayerPosition(player_current_characterx4 >> 2); + r2w += kSharedOverworldPathTables_DATA_049058[v11 >> 1]; + else + r0w += kSharedOverworldPathTables_DATA_049058[v11 >> 1]; + r4w = CalculateOverworldPlayerPosition(player_current_characterx4 >> 2, r0w, r2w); v15 = ow_process_hardcoded_path_flag; if (!ow_process_hardcoded_path_flag) break; - R6_W = v11; +// r6w = v11; uint16 v16 = ow_hardcoded_path_index + 1; if (kSharedOverworldPathTables_HardCodedOWPaths_MovementDirection[(uint16)(ow_hardcoded_path_index + 1)] == v11) { ++ow_hardcoded_path_index; @@ -931,28 +1042,25 @@ void OwProcess04_PlayerIsMoving() { // 04945d uint16 v12; do { LABEL_24: - v12 = R8_W - 2; - R8_W = v12; - } while (v12 == R10_W); + v12 = r8 - 2; + r8 = v12; + } while (v12 == r10w); v11 = v12; } - if ((R4_W & 0x8000) != 0 || v15 >= 0x800) + if ((r4w & 0x8000) != 0 || v15 >= 0x800) goto LABEL_24; - v15 = blocks_map16_table_lo[R4_W]; + v15 = blocks_map16_table_lo[r4w]; LABEL_34: ow_tile_player_is_standing_on = v15; if (v15 == 0 || v15 >= 0x87) goto LABEL_24; v42 = v15; int16 v41 = v11; - uint16 v17 = 0; - R14_W = kSharedOverworldPathTables_DATA_049FEB[(uint16)(v15 - 1)]; - if ((uint8)R14_W == 20) - v17 = 1; - ow_player_on_climbing_tile = v17; + r14w = kSharedOverworldPathTables_DATA_049FEB[v15 - 1]; + ow_player_on_climbing_tile = (r14w == 20); PointU16 *v18 = get_PointU16(ow_players_grid_aligned_pos, player_current_characterx4); - v18->x = R0_W; - v18->y = R2_W; + v18->x = r0w; + v18->y = r2w; v19 = v41; uint8 v20 = 9; while ((uint8)v15 != *((uint8 *)kOverworldProcess04_PlayerIsMoving_DATA_049426 + v20)) { @@ -972,7 +1080,7 @@ void OwProcess04_PlayerIsMoving() { // 04945d if (v42 < 0x56) { v25 = 2 * (v42 - 1); int v26 = v25 >> 1; - R4_W = kSharedOverworldPathTables_DATA_049F49[v26]; + r4w = kSharedOverworldPathTables_DATA_049F49[v26]; v24 = kSharedOverworldPathTables_DATA_049EA7[v26]; } else { if (v42 == 128 || v42 >= 0x6A && v42 < 0x6E) { @@ -987,14 +1095,14 @@ void OwProcess04_PlayerIsMoving() { // 04945d *(uint16 *)&io_sound_ch3 = 35; } if ((uint8)ow_tile_player_is_standing_on != 130) { - R6_W = 0; - *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[R4_W]] |= kBitTable_Bank04[(uint16)((uint8)v19 ^ 2) >> 1]; +// r6w = 0; + *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[r4w]] |= kBitTable_Bank04[(uint16)((uint8)v19 ^ 2) >> 1]; } - R14_W = ow_players_animation[(uint16)((player_current_characterx4 >> 1) & 2) >> 1] & 0xC; - R4_W = 1; - R0_W = (uint8)copy_of_tile_player_is_standingd_on; + r14w = ow_players_animation[((player_current_characterx4 >> 1) & 2) >> 1] & 0xC; + r4w = 1; + r0w = (uint8)copy_of_tile_player_is_standingd_on; for (int16 k = 23; k >= 0; --k) { - if (kSharedOverworldPathTables_DATA_04A03C[(uint16)k] == R0_W) { + if (kSharedOverworldPathTables_DATA_04A03C[(uint16)k] == r0w) { v24 = kSharedOverworldPathTables_DATA_04A054[(uint16)(2 * k) >> 1]; goto LABEL_60; } @@ -1005,7 +1113,7 @@ void OwProcess04_PlayerIsMoving() { // 04945d LABEL_60: v25 = 0; } - R0_W = v24; + r0w = v24; v27 = v25; uint16 v28 = 14; while ((uint8)v27 != LOBYTE(kOverworldProcess04_PlayerIsMoving_DATA_049430[v28])) { @@ -1021,36 +1129,34 @@ void OwProcess04_PlayerIsMoving() { // 04945d LABEL_68: v29 = (v19 & 2) != 0; LABEL_69: - if (*(&R4_ + v29)) { - R0_ = -R0_; - R1_ = -R1_; - } - R4_W = (uint8)R14_W; - if (*((uint8 *)&R0_W + ((R14_W & 7) == 0)) < 0x80) - R4_W += 2; - ow_players_animation[(uint16)((player_current_characterx4 >> 1) & 2) >> 1] = R4_W; - int16 v30 = (uint8)R0_W; - if ((uint8)R0_W >= 0x80) - v30 = (uint8)R0_W | 0xFF00; + if (r4w & (v29 ? 0xff00 : 0xff)) { + BYTE(r0w) = -BYTE(r0w); + HIBYTE(r0w) = -HIBYTE(r0w); + } + r4w = (uint8)r14w; + if ((((r14w & 7) == 0) ? (r0w >> 8) : (r0w & 0xff)) < 0x80) + r4w += 2; + ow_players_animation[((player_current_characterx4 >> 1) & 2) >> 1] = r4w; + int16 v30 = (uint8)r0w; + if ((uint8)r0w >= 0x80) + v30 = (uint8)r0w | 0xFF00; PointU16 *v31 = get_PointU16(ow_players_pos, player_current_characterx4); PointU16 *v32 = get_PointU16(players_overworld_xpos_is_going_to, player_current_characterx4); v32->x = (v31->x + v30) & 0xFFFC; - int16 v33 = R1_; - if (R1_ >= 0x80) - v33 = R1_ | 0xFF00; + int16 v33 = (int8)(r0w >> 8); v32->y = (v31->y + v33) & 0xFFFC; if ((v32->x & 0xF) != 0) { if ((v32->y & 0xF) == 0) { v19 = 0; - if ((R1_ & 0x80) == 0) + if ((r0w & 0x8000) == 0) v19 = 2; } } else { v19 = 4; - if ((R0_ & 0x80) == 0) + if ((r0w & 0x80) == 0) v19 = 6; } - *(uint16 *)&ow_player_direction = v19; + ow_player_direction = v19; if (pointer_current_overworld_process == 10) goto LABEL_90; } @@ -1079,13 +1185,13 @@ void OwProcess04_PlayerIsMoving_049831() { // 049831 void OwProcess04_PlayerIsMoving_04983F() { // 04983f PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); - R0_W = pt->x; - R2_W = pt->y; + uint16 r0w = pt->x; + uint16 r2w = pt->y; if (!ow_players_map[player_current_characterx4 >> 2]) { uint16 v1 = 2; uint16 v2 = 2; do { - uint16 v3 = *(uint16 *)((int8 *)&R0_W + v1) - 128; + uint16 v3 = (v1 ? r2w : r0w) - 128; if ((v3 & 0x8000) == 0) { int v5 = v2 >> 1; if (v3 >= kOverworldProcess04_PlayerIsMoving_MaxOverworlCameraPosition_RightAndBottom[v5]) @@ -1103,18 +1209,15 @@ void OwProcess04_PlayerIsMoving_04983F() { // 04983f } } -uint16 CalculateOverworldPlayerPosition(uint8 k) { // 049885 - R4_W = R0_W & 0xF; - R4_W += 16 * (R0_W & 0x10); - R4_W += (uint8)(16 * R2_W); - if ((R2_W & 0x10) != 0) - R4_W += 512; - uint16 result = ow_players_map[k]; - if (ow_players_map[k]) { - result = R4_W + 0x400; - R4_W += 0x400; - } - return result; +uint16 CalculateOverworldPlayerPosition(uint8 k, uint16 r0w, uint16 r2w) { // 049885 + uint16 r4 = r0w & 0xF; + r4 += 16 * (r0w & 0x10); + r4 += (uint8)(16 * r2w); + if ((r2w & 0x10) != 0) + r4 += 512; + if (ow_players_map[k]) + r4 += 0x400; + return r4; } void OwProcess0C_IntroMarch() { // 0498c6 @@ -1133,32 +1236,31 @@ void OwProcess0C_IntroMarch() { // 0498c6 void UnlockOverworldPathBasedOnExit() { // 049903 if ((int8)misc_exit_level_action > 0) { - R8_ = kSharedOverworldPathTables_DATA_049060[(uint8)(misc_exit_level_action - 1)]; - R9_ = 0; + uint16 r8 = kSharedOverworldPathTables_DATA_049060[(uint8)(misc_exit_level_action - 1)]; uint8 v0 = player_current_characterx4; PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); - R0_W = pt->x >> 4; + uint16 r0w = pt->x >> 4; PointU16 *v2 = get_PointU16(ow_players_grid_aligned_pos, player_current_characterx4); - v2->x = R0_W; - R2_W = pt->y >> 4; - v2->y = R2_W; - CalculateOverworldPlayerPosition(v0 >> 2); - uint16 v3 = ow_level_direction_flags[R4_W]; - int16 v4 = R8_W; - if (R8_W) { + v2->x = r0w; + uint16 r2w = pt->y >> 4; + v2->y = r2w; + uint16 r4w = CalculateOverworldPlayerPosition(v0 >> 2, r0w, r2w); + uint16 v3 = ow_level_direction_flags[r4w]; + int16 v4 = r8; + if (r8) { do { v3 >>= 1; --v4; } while (v4 >= 0); } - *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[R4_W]] |= kBitTable_Bank04[(uint16)(2 * (v3 & 3)) >> 1]; + *(uint16 *)&ow_level_tile_settings[ow_level_number_of_each_tiletbl[r4w]] |= kBitTable_Bank04[(uint16)(2 * (v3 & 3)) >> 1]; } } void HandleOverworldPathExits() { // 049a24 PointU16 *pt; ow_currently_loaded_submap = ow_players_map[(uint8)(player_current_characterx4 >> 2)]; - R2_W = 26; + uint16 r2w = 26; uint8 v0 = 13; uint8 v1 = player_current_characterx4; while (1) { @@ -1167,8 +1269,8 @@ void HandleOverworldPathExits() { // 049a24 kHandleOverworldPathExits_DATA_049964[v0].field_4 == ow_currently_loaded_submap) { break; } - --R2_W; - --R2_W; + --r2w; + --r2w; if ((--v0 & 0x80) != 0) return; } @@ -1176,8 +1278,8 @@ void HandleOverworldPathExits() { // 049a24 pt->x = kHandleOverworldPathExits_DATA_0499AA[v0].field_2; ow_currently_loaded_submap = kHandleOverworldPathExits_DATA_0499AA[v0].field_4; PointU16 *v4 = get_PointU16(ow_players_grid_aligned_pos, v1); - v4->y = kHandleOverworldPathExits_DATA_0499F0[R2_]; - v4->x = kHandleOverworldPathExits_DATA_0499F0[R2_ + 1]; + v4->y = kHandleOverworldPathExits_DATA_0499F0[r2w]; + v4->x = kHandleOverworldPathExits_DATA_0499F0[r2w + 1]; } void HandleOverworldPathExits_SetLayerPositions() { // 049a93 @@ -1195,29 +1297,31 @@ void HandleOverworldPathExits_SetLayerPositions() { // 049a93 } } -void UpdateLevelName() { // 049d07 +#define kUpdateLevelName_LevelNameStrings ((uint8*)RomFixedPtr(0x49AC5)) + +void UpdateLevelName(uint16 r0w) { // 049d07 uint16 v0 = stripe_image_upload; - R2_W = stripe_image_upload + 38; + uint16 r2w = stripe_image_upload + 38; stripe_image_upload += 42; *(uint16 *)&stripe_image_upload_data[v0 + 2] = 0x2500; *(uint16 *)&stripe_image_upload_data[v0] = 0x8b50; - uint16 v1 = kUpdateLevelName_DATA_049C91[(uint16)(2 * (R1_ & 0x7F)) >> 1]; + uint16 v1 = kUpdateLevelName_DATA_049C91[(uint16)(2 * ((r0w >> 8) & 0x7F)) >> 1]; if ((kUpdateLevelName_LevelNameStrings[v1] & 0x80) == 0) - v0 = UpdateLevelName_049D7F(v0, v1); - uint16 v2 = kUpdateLevelName_DATA_049CCF[(uint16)((uint8)(R0_W & 0xF0) >> 3) >> 1]; + v0 = UpdateLevelName_049D7F(v0, v1, r2w); + uint16 v2 = kUpdateLevelName_DATA_049CCF[(uint16)((uint8)(r0w & 0xF0) >> 3) >> 1]; if (kUpdateLevelName_LevelNameStrings[v2] != 0x9F) - v0 = UpdateLevelName_049D7F(v0, v2); - v0 = UpdateLevelName_049D7F(v0, kUpdateLevelName_DATA_049CED[(uint16)(2 * (R0_W & 0xF)) >> 1]); - while (v0 < R2_W) - v0 = UpdateLevelName_049D7F(v0, 0x1CB); + v0 = UpdateLevelName_049D7F(v0, v2, r2w); + v0 = UpdateLevelName_049D7F(v0, kUpdateLevelName_DATA_049CED[(uint16)(2 * (r0w & 0xF)) >> 1], r2w); + while (v0 < r2w) + v0 = UpdateLevelName_049D7F(v0, 0x1CB, r2w); stripe_image_upload_data[v0 + 4] = -1; } -uint16 UpdateLevelName_049D7F(uint16 k, uint16 j) { // 049d7f +uint16 UpdateLevelName_049D7F(uint16 k, uint16 j, uint16 r2w) { // 049d7f uint8 t; do { t = kUpdateLevelName_LevelNameStrings[j]; - if (k < R2_W) { + if (k < r2w) { stripe_image_upload_data[k + 4] = t & 0x7F; stripe_image_upload_data[k + 5] = 57; k += 2; @@ -1286,7 +1390,6 @@ void OwProcess0B_StarWarpAnimation() { // 049e52 if (++ow_star_launch_speed == 5) ow_star_launch_speed = 4; } - R0_W = ow_star_launch_speed; PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); uint16 v1 = pt->y - ow_star_launch_speed; pt->y = v1; @@ -1318,14 +1421,11 @@ void InitializeOverworldTilemaps() { // 04d6e9 *(uint16 *)&misc_level_layout_flags = 0; camera_xy_layer1_vramupd_left_up = -1; camera_xy_layer1_vramupd_right_down = -1; - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0); - WriteReg(VMADDH, 0x30); - for (uint8 i = 6; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + 0x4310), kInitializeOverworldTilemaps_PARAMS_04DAB3[i]); + + uint32 addr = 0x14000; if (ow_players_map[(uint8)player_current_characterx4 >> 2]) - WriteReg(A1T1H, 0x60); - WriteReg(MDMAEN, 2); + addr = 0x16000; + SmwCopyToVram(0x3000, g_ram + addr, 0x2000); } uint16 LoadOverworldLayer1AndEvents_InitializedOverworldLayer1Tilemap(uint16 k, uint8 a) { // 04d770 @@ -1365,58 +1465,49 @@ uint16 LoadOverworldLayer1AndEvents_InitializedOverworldLayer1Tilemap(uint16 k, } void LoadOverworldLayer1AndEvents_04D7F2() { // 04d7f2 - uint16 v0; - - HIBYTE(v0) = 0; - R13_ = 0; - R14_ = -48; - R15_ = 126; - R10_ = 0; - R11_ = -40; - R12_ = 126; - R4_ = 0; - R5_ = -56; - R6_ = 126; - R0_W = 1; + uint8 *r13 = g_ram + 0xd000; + uint8 *r10 = g_ram + 0xd800; + uint8 *r4 = g_ram + 0xc800; + + uint8 r0 = 1; for (int16 i = 0x7ff; i >= 0; --i) { - IndirWriteByte(&R10_, i, 0); - IndirWriteByte(&R13_, i, 0); + r10[i] = 0; + r13[i] = 0; } for (uint16 j = 0; j != 0x800; ++j) { - uint8 v3 = *IndirPtr(&R4_, j); + uint8 v3 = r4[j]; if (v3 >= 0x56 && v3 < 0x81) { - LOBYTE(v0) = R0_; - IndirWriteByte(&R13_, j, R0_); - IndirWriteByte(&R10_, j, kLoadOverworldLayer1AndEvents_DATA_04D678[v0]); - ++R0_; + uint8 v0 = r0; + r13[j] = r0; + r10[j] = kLoadOverworldLayer1AndEvents_DATA_04D678[v0]; + ++r0; } } - R15_ = 0; + uint8 r15 = 0; do { - LoadOverworldLayer1AndEvents_04DA49(); - ++R15_; - } while (R15_ != 111); + LoadOverworldLayer1AndEvents_04DA49(r15); + ++r15; + } while (r15 != 111); } -void LoadOverworldLayer1AndEvents_04DA49() { // 04da49 - if ((kBitTable_DATA_04E44B[R15_ & 7] & ow_event_flags[(uint8)(R15_ & 0xF8) >> 3]) != 0) { - R4_W = 0xc800; - uint16 v0 = kChangingLayer1OverworldTiles_Layer1TileLocation[(uint16)(2 * R15_) >> 1]; +void LoadOverworldLayer1AndEvents_04DA49(uint8 r15) { // 04da49 + if ((kBitTable_DATA_04E44B[r15 & 7] & ow_event_flags[(uint8)(r15 & 0xF8) >> 3]) != 0) { + uint8 *p4 = g_ram + 0xc800; + uint16 v0 = kChangingLayer1OverworldTiles_Layer1TileLocation[r15]; uint16 v1 = 21; - R6_ = 126; - uint8 v2 = *IndirPtr(&R4_, v0); + uint8 v2 = p4[v0]; while (v2 != kChangingLayer1OverworldTiles_TilesThatChange[v1]) { if ((--v1 & 0x8000) != 0) goto LABEL_8; } uint8 v3 = kChangingLayer1OverworldTiles_TilesToBecome[v1]; - IndirWriteByte(&R4_, v0, v3); + p4[v0] = v3; if (v1 == 21) - IndirWriteByte(&R4_, v0 + 1, v3); + p4[v0 + 1] = v3; LABEL_8: - CheckIfDestroyTileEventIsActive(R15_); + CheckIfDestroyTileEventIsActive(r15); pointer_overworld_event_process = 0; - OwEventProcess07_SilentEventsAndEndOfEvent_Entry2(R15_); + OwEventProcess07_SilentEventsAndEndOfEvent_Entry2(r15); } } @@ -1424,26 +1515,24 @@ void LoadOverworldLayer2AndEventsTilemaps() { // 04daad LoadOverworldLayer2AndEventsTilemaps_Sub(); } -void BufferOverworldLayer2Tilemap(uint16 k, uint16 j) { // 04daba +void BufferOverworldLayer2Tilemap(uint16 k, uint16 j, uint16 r14w, const uint8 *p0) { // 04daba do { - R3_ = *IndirPtr(&R0_, j); - if ((R3_ & 0x80) != 0) { - R3_ &= ~0x80; - uint8 v2 = *IndirPtr(&R0_, ++j); + uint8 r3 = p0[j]; + if ((r3 & 0x80) != 0) { + r3 &= ~0x80; + uint8 v2 = p0[++j]; do { ow_layer2_tiles[k] = v2; k += 2; - --R3_; - } while ((R3_ & 0x80) == 0); + } while ((--r3 & 0x80) == 0); } else { do { - ow_layer2_tiles[k] = *IndirPtr(&R0_, ++j); + ow_layer2_tiles[k] = p0[++j]; k += 2; - --R3_; - } while ((R3_ & 0x80) == 0); + } while ((--r3 & 0x80) == 0); } ++j; - } while (k < R14_W); + } while (k < r14w); } void OwProcess0A_SwitchBetweenSubmaps() { // 04daef @@ -1471,13 +1560,13 @@ void SubmapSwitchProcess06_EndWindowHDMA() { // 04db18 if (ow_hdmatransition_effect_flag) HandleOverworldPathExits_SetLayerPositions(); } - R0_ = 2 * HIBYTE(ow_hdmatransition_effect_ypos); + uint8 r0 = 2 * HIBYTE(ow_hdmatransition_effect_ypos); HIBYTE(v1) = HIBYTE(ow_hdmatransition_effect_xpos) + 0x80; LOBYTE(v1) = 0x80 - HIBYTE(ow_hdmatransition_effect_xpos); uint8 v2 = 0; uint8 v3 = -88; do { - if (v2 >= R0_) + if (v2 >= r0) v1 = 255; *(uint16 *)&misc_hdmawindow_effect_table[v3 + 78] = v1; *(uint16 *)&misc_hdmawindow_effect_table[v2 + 248] = v1; @@ -1518,10 +1607,10 @@ void LoadOverworldLayer1AndEvents() { // 04dc09 do t = LoadOverworldLayer1AndEvents_InitializedOverworldLayer1Tilemap(t, v1); while (t != 432); - R0_W = 0xd000; + uint16 r0w = 0xd000; for (uint16 i = 0; i != 0x400; i += 2) { - pointer_map16_tiles[i >> 1] = R0_W; - R0_W += 8; + pointer_map16_tiles[i >> 1] = r0w; + r0w += 8; } uint8 *v3 = g_ram + 0xC800; const uint8 *v4 = RomPtr_0C(0xF7DF); @@ -1531,73 +1620,65 @@ void LoadOverworldLayer1AndEvents() { // 04dc09 void LoadOverworldLayer2AndEventsTilemaps_Sub() { // 04dc6a LoadOverworldLayer2AndEventsTilemaps_04DD40(); - R0_W = 0xa533; - R2_ = 4; - R14_W = 0x4000; - BufferOverworldLayer2Tilemap(0, 0); - R0_W = 0xc02b; - BufferOverworldLayer2Tilemap(1, 0); - R15_ = 0; + BufferOverworldLayer2Tilemap(0, 0, 0x4000, RomPtr_04(0xa533)); + BufferOverworldLayer2Tilemap(1, 0, 0x4000, RomPtr_04(0xc02b)); + uint8 r15 = 0; do { - LoadOverworldLayer2AndEventsTilemaps_04E453(); - ++R15_; - } while (R15_ != 111); + LoadOverworldLayer2AndEventsTilemaps_04E453(r15); + ++r15; + } while (r15 != 111); } void SubmapSwitchProcess01_UpdateLayer1() { // 04dcb6 - *(uint16 *)&temp65 = 0xd000; - temp67 = 5; - R0_W = 0; - R1_ = ow_submap_switch_process - 1; + const uint8 *p0 = RomPtr(0x05d000); + uint16 r0w = (ow_submap_switch_process - 1) << 8; if (ow_players_map[(uint8)(player_current_characterx4 >> 2)]) - R1_ += 4; + r0w += 4 << 8; do { - R2_ = blocks_map16_table_lo[R0_W]; - *(uint16 *)&R3_ = *(uint16 *)&blocks_map16_table_hi[R0_W]; - uint16 v0 = 8 * R2_W; - R2_W = (4 * (uint8)R0_W) & 0x3F; - uint16 v1 = R2_W | (8 * (uint8)R0_W) & 0xF80; - *(uint16 *)&ow_byte_7EE000[v1 + 0x400] = *(uint16 *)IndirPtr(&temp65, v0); + uint16 r2w = blocks_map16_table_lo[r0w] | blocks_map16_table_hi[r0w] << 8; + uint16 v0 = 8 * r2w; + r2w = (4 * (uint8)r0w) & 0x3F; + uint16 v1 = r2w | (8 * (uint8)r0w) & 0xF80; + *(uint16 *)&ow_byte_7EE000[v1 + 0x400] = WORD(p0[v0]); v0 += 2; - *(uint16 *)&ow_byte_7EE000[v1 + 0x440] = *(uint16 *)IndirPtr(&temp65, v0); + *(uint16 *)&ow_byte_7EE000[v1 + 0x440] = WORD(p0[v0]); v0 += 2; - *(uint16 *)&ow_byte_7EE000[v1 + 0x402] = *(uint16 *)IndirPtr(&temp65, v0); - *(uint16 *)&ow_byte_7EE000[v1 + 0x442] = *(uint16 *)IndirPtr(&temp65, v0 + 2); - ++R0_; - } while (R0_); + *(uint16 *)&ow_byte_7EE000[v1 + 0x402] = WORD(p0[v0]); + v0 += 2; + *(uint16 *)&ow_byte_7EE000[v1 + 0x442] = WORD(p0[v0]); + ++r0w; + } while (r0w&0xff); ++ow_submap_switch_process; } void LoadOverworldLayer2AndEventsTilemaps_04DD40() { // 04dd40 - R2_W = 0x8d00; - R4_ = 12; - LoadOverworldLayer2AndEventsTilemaps_04DD57(0, 0); + LoadOverworldLayer2AndEventsTilemaps_04DD57(0, 0, RomPtr(0xc8d00)); } -void LoadOverworldLayer2AndEventsTilemaps_04DD57(uint16 k, uint16 j) { // 04dd57 +void LoadOverworldLayer2AndEventsTilemaps_04DD57(uint16 k, uint16 j, const uint8 *p2) { // 04dd57 do { - uint8 *v2 = IndirPtr(&R2_, j++); - R5_ = *v2; - if ((R5_ & 0x80) != 0) { - R5_ &= ~0x80; - uint8 v3 = *IndirPtr(&R2_, j); + const uint8 *v2 = &p2[j++]; + uint8 r5 = *v2; + if ((r5 & 0x80) != 0) { + r5 &= ~0x80; + uint8 v3 = p2[j]; do { ow_layer2_event_tiles[k++] = v3; - --R5_; - } while ((R5_ & 0x80) == 0); + --r5; + } while ((r5 & 0x80) == 0); ++j; } else { do { - ow_layer2_event_tiles[k++] = *IndirPtr(&R2_, j++); - --R5_; - } while ((R5_ & 0x80) == 0); + ow_layer2_event_tiles[k++] = p2[j++]; + --r5; + } while ((r5 & 0x80) == 0); } - } while (*(uint16 *)IndirPtr(&R2_W, j) != 0xFFFF); + } while (WORD(p2[j]) != 0xFFFF); } -void LoadOverworldLayer2AndEventsTilemaps_04E453() { // 04e453 - if ((kBitTable_DATA_04E44B[R15_ & 7] & ow_event_flags[R15_ >> 3]) != 0) { - int v0 = (uint8)(2 * R15_) >> 1; +void LoadOverworldLayer2AndEventsTilemaps_04E453(uint8 r15) { // 04e453 + if ((kBitTable_DATA_04E44B[r15 & 7] & ow_event_flags[r15 >> 3]) != 0) { + int v0 = (uint8)(2 * r15) >> 1; ow_starting_event_tile = kLayer2EventData_Ptrs[v0]; for (ow_final_event_tile = kLayer2EventData_Ptrs[v0 + 1]; ow_starting_event_tile != ow_final_event_tile; ++ow_starting_event_tile) { BufferEventTileToLayer2Tilemap(); @@ -1608,63 +1689,52 @@ void LoadOverworldLayer2AndEventsTilemaps_04E453() { // 04e453 void BufferEventTileToLayer2Tilemap() { // 04e496 int v0 = (uint16)(4 * ow_starting_event_tile) >> 1; uint16 v1 = kLayer2EventData_TileEntries[v0]; - R4_W = kLayer2EventData_TileEntries[v0 + 1]; - BufferEventTileToLayer2Tilemap_Entry2(4 * ow_starting_event_tile, v1); + BufferEventTileToLayer2Tilemap_Entry2(4 * ow_starting_event_tile, v1, kLayer2EventData_TileEntries[v0 + 1]); } -void BufferEventTileToLayer2Tilemap_Entry2(uint16 k, uint16 j) { // 04e4a9 - R8_ = 127; - R11_ = 12; - R6_W = 0; - *(uint16 *)&R9_ = 0x8000; +void BufferEventTileToLayer2Tilemap_Entry2(uint16 k, uint16 j, uint16 r4) { // 04e4a9 + const uint8 *r6 = g_ram + 0x10000; + const uint8 *r9 = RomPtr(0xc8000); if (j < 0x900) - BufferEventTileToLayer2Tilemap_Buffer6x6Tile(k, j); + BufferEventTileToLayer2Tilemap_Buffer6x6Tile(k, j, r4, r6, r9); else - BufferEventTileToLayer2Tilemap_Buffer2x2Tile(k, j); + BufferEventTileToLayer2Tilemap_Buffer2x2Tile(k, j, r4, r6, r9); } -void BufferEventTileToLayer2Tilemap_Buffer2x2Tile(uint16 k, uint16 j) { // 04e4d0 - R0_W = 1; +void BufferEventTileToLayer2Tilemap_Buffer2x2Tile(uint16 k, uint16 j, uint16 r4, const uint8 *r6, const uint8 *r9) { // 04e4d0 + uint16 r0w = 1; do { - uint16 v2 = R4_W; - R12_W = 1; + uint16 v2 = r4; + uint8 r12 = 1; do { - ow_layer2_tiles[v2] = *IndirPtr(&R9_, j); - uint16 v3 = v2 + 1; - ow_layer2_tiles[v3] = *IndirPtr(&R6_, j++); - v2 = v3 + 1; + ow_layer2_tiles[v2++] = r9[j]; + ow_layer2_tiles[v2++] = r6[j++]; if ((v2 & 0x3F) == 0) v2 = ((v2 - 1) & 0xFFC0) + 0x800; - --R12_W; - } while ((R12_W & 0x8000) == 0); - uint16 v4 = R4_W; - R4_W += 64; - if ((R4_W & 0x7C0) == 0) - R4_W = (v4 & 0xF83F) + 0x1000; - --R0_W; - } while ((R0_W & 0x8000) == 0); -} - -void BufferEventTileToLayer2Tilemap_Buffer6x6Tile(uint16 k, uint16 j) { // 04e520 - R0_W = 5; + } while ((--r12 & 0x80) == 0); + uint16 v4 = r4; + r4 += 64; + if ((r4 & 0x7C0) == 0) + r4 = (v4 & 0xF83F) + 0x1000; + } while ((--r0w & 0x8000) == 0); +} + +void BufferEventTileToLayer2Tilemap_Buffer6x6Tile(uint16 k, uint16 j, uint16 r4, const uint8 *r6, const uint8 *r9) { // 04e520 + uint16 r0w = 5; do { - uint16 v2 = R4_W; - R12_W = 5; + uint16 v2 = r4; + uint8 r12 = 5; do { - ow_layer2_tiles[v2] = *IndirPtr(&R9_, j); - uint16 v3 = v2 + 1; - ow_layer2_tiles[v3] = *IndirPtr(&R6_, j++); - v2 = v3 + 1; + ow_layer2_tiles[v2++] = r9[j]; + ow_layer2_tiles[v2++] = r6[j++]; if ((v2 & 0x3F) == 0) v2 = ((v2 - 1) & 0xFFC0) + 0x800; - --R12_W; - } while ((R12_W & 0x8000) == 0); - uint16 v4 = R4_W; - R4_W += 64; - if ((R4_W & 0x7C0) == 0) - R4_W = (v4 & 0xF83F) + 0x1000; - --R0_W; - } while ((R0_W & 0x8000) == 0); + } while ((--r12 & 0x80) == 0); + uint16 v4 = r4; + r4 += 64; + if ((r4 & 0x7C0) == 0) + r4 = (v4 & 0xF83F) + 0x1000; + } while ((--r0w & 0x8000) == 0); } void OwProcess01_ActivateEvents() { // 04e570 @@ -1709,21 +1779,20 @@ uint16 CheckIfDestroyTileEventIsActive(uint8 a) { // 04e677 } } ow_destroy_tile_event_vramindex = v1; - R12_ = 126; - R10_W = 0xc800; + uint8 *p = blocks_map16_table_lo; uint16 v2 = kCheckIfDestroyTileEventIsActive_DATA_04E5B6[v1]; uint16 v3 = 4; - uint8 v4 = *IndirPtr(&R10_, v2); + uint8 v4 = p[v2]; while (v4 != kCheckIfDestroyTileEventIsActive_DATA_04E5A7[v3]) { if ((--v3 & 0x8000) != 0) goto LABEL_4; } ow_destroy_tile_event_tile_index = v3; if ((int16)(v3 - 3) >= 0) { - IndirWriteByte(&R10_, v2, kCheckIfDestroyTileEventIsActive_DATA_04E5AC[v3]); + p[v2] = kCheckIfDestroyTileEventIsActive_DATA_04E5AC[v3]; v2 += 16; } - IndirWriteByte(&R10_, v2, kCheckIfDestroyTileEventIsActive_DATA_04E5B1[v3]); + p[v2] = kCheckIfDestroyTileEventIsActive_DATA_04E5B1[v3]; return v2; } @@ -1742,22 +1811,20 @@ void OwEventProcess03_GetLayer2Tile() { // 04e6f9 uint16 v2; OwEventProcess03_GetLayer2Tile_04EA62(); - R14_ = 127; uint16 v0 = 4 * ow_starting_event_tile; int v1 = (uint16)(4 * ow_starting_event_tile) >> 1; *(uint16 *)&timer_destroy_tile_event_unknown = kLayer2EventData_TileEntries[v1]; - R0_W = kLayer2EventData_TileEntries[v1 + 1]; - LOBYTE(v2) = (uint16)(((uint16)(R0_W & 0x1FFF) >> 1) + 0x3000) >> 8; - HIBYTE(v2) = (uint16)(R0_W & 0x1FFF) >> 1; - R2_W = v2; - ow_on_screen_ypos_of_current_event_tile = (R0_W >> 3) & 0xF8; - ow_on_screen_xpos_of_current_event_tile = 4 * (R0_ & 0x3E); - R12_W = 0x4000; - R10_W = 0xefff; + uint16 r0w = kLayer2EventData_TileEntries[v1 + 1]; + LOBYTE(v2) = (uint16)(((uint16)(r0w & 0x1FFF) >> 1) + 0x3000) >> 8; + HIBYTE(v2) = (uint16)(r0w & 0x1FFF) >> 1; + uint16 r2w = v2; + ow_on_screen_ypos_of_current_event_tile = (r0w >> 3) & 0xF8; + ow_on_screen_xpos_of_current_event_tile = 4 * (r0w & 0x3E); + const uint8 *r12 = g_ram + 0x14000; if (*(uint16 *)&timer_destroy_tile_event_unknown < 0x900) - v0 = BufferEventTileToStripeImageTable_Buffer6x6Tile(); + v0 = BufferEventTileToStripeImageTable_Buffer6x6Tile(r0w, r2w, 0xefff, r12); else - v0 = BufferEventTileToStripeImageTable_Buffer2x2Tile(); + v0 = BufferEventTileToStripeImageTable_Buffer2x2Tile(r0w, r2w, 0xefff, r12); *(uint16 *)&stripe_image_upload_data[v0] = 255; stripe_image_upload = v0; BufferEventTileToLayer2Tilemap(); @@ -1765,149 +1832,149 @@ void OwEventProcess03_GetLayer2Tile() { // 04e6f9 ++pointer_overworld_event_process; } -uint16 BufferEventTileToStripeImageTable_Buffer2x2Tile() { // 04e76c +uint16 BufferEventTileToStripeImageTable_Buffer2x2Tile(uint16 r0w, uint16 r2w, uint16 r10, const uint8 *r12) { // 04e76c int16 v3; int16 v5; int16 v6; uint16 v9; int16 v12; uint16 v13; + uint16 r8; - R6_W = 1; + uint16 n = 1; uint16 v0 = stripe_image_upload; do { - *(uint16 *)&stripe_image_upload_data[v0] = R2_W; + *(uint16 *)&stripe_image_upload_data[v0] = r2w; uint16 v1 = v0 + 2; int16 v2 = 768; - R8_W = R3_ & 0x1F; - R8_W = 32 - R8_W; - if (R8_W == 1) { - LOBYTE(v3) = (uint16)(2 * R8_W - 1) >> 8; - HIBYTE(v3) = 2 * R8_W - 1; + r8 = (r2w >> 8) & 0x1F; + r8 = 32 - r8; + if (r8 == 1) { + LOBYTE(v3) = (uint16)(2 * r8 - 1) >> 8; + HIBYTE(v3) = 2 * r8 - 1; v2 = v3; } *(uint16 *)&stripe_image_upload_data[v1] = v2; v0 = v1 + 2; - R4_W = 1; - uint16 v4 = R0_W; + uint16 r4 = 1; + uint16 v4 = r0w; do { - *(uint16 *)&stripe_image_upload_data[v0] = R10_W & *(uint16 *)IndirPtr(&R12_W, v4); + *(uint16 *)&stripe_image_upload_data[v0] = r10 & WORD(r12[v4]); v0 += 2; v4 += 2; - if ((v4 & 0x3F) == 0 && R4_W) { + if ((v4 & 0x3F) == 0 && r4) { v4 = ((v4 - 1) & 0xFFC0) + 0x800; - LOBYTE(v5) = HIBYTE(R2_W); - HIBYTE(v5) = R2_W; + LOBYTE(v5) = HIBYTE(r2w); + HIBYTE(v5) = r2w; v6 = (v5 & 0x3BE0) + 0x400; int8 v7 = v6; LOBYTE(v6) = HIBYTE(v6); HIBYTE(v6) = v7; *(uint16 *)&stripe_image_upload_data[v0] = v6; uint16 v8 = v0 + 2; - LOBYTE(v6) = (uint16)(2 * R8_W - 1) >> 8; - HIBYTE(v6) = 2 * R8_W - 1; + LOBYTE(v6) = (uint16)(2 * r8 - 1) >> 8; + HIBYTE(v6) = 2 * r8 - 1; *(uint16 *)&stripe_image_upload_data[v8] = v6; v0 = v8 + 2; } - --R4_W; - } while ((R4_W & 0x8000) == 0); - LOBYTE(v9) = HIBYTE(R2_W); - HIBYTE(v9) = R2_W; + --r4; + } while ((r4 & 0x8000) == 0); + LOBYTE(v9) = HIBYTE(r2w); + HIBYTE(v9) = r2w; v9 += 32; int8 v10 = v9; LOBYTE(v9) = HIBYTE(v9); HIBYTE(v9) = v10; - R2_W = v9; - uint16 v11 = R0_W; - R0_W += 64; - if ((R0_W & 0x7C0) == 0) { - R0_W = (v11 & 0xF83F) + 0x1000; - LOBYTE(v12) = HIBYTE(R2_W); - HIBYTE(v12) = R2_W; + r2w = v9; + uint16 v11 = r0w; + r0w += 64; + if ((r0w & 0x7C0) == 0) { + r0w = (v11 & 0xF83F) + 0x1000; + LOBYTE(v12) = HIBYTE(r2w); + HIBYTE(v12) = r2w; v13 = ((v12 - 32) & 0x341F) + 0x800; int8 v14 = v13; LOBYTE(v13) = HIBYTE(v13); HIBYTE(v13) = v14; - R2_W = v13; + r2w = v13; } - --R6_W; - } while ((R6_W & 0x8000) == 0); + --n; + } while ((n & 0x8000) == 0); return v0; } -uint16 BufferEventTileToStripeImageTable_Buffer6x6Tile() { // 04e824 +uint16 BufferEventTileToStripeImageTable_Buffer6x6Tile(uint16 r0w, uint16 r2w, uint16 r10, const uint8 *r12) { // 04e824 int16 v3; int16 v5; int16 v6; uint16 v9; int16 v12; uint16 v13; + uint16 r8; - R6_W = 5; + uint16 n = 5; uint16 v0 = stripe_image_upload; do { - *(uint16 *)&stripe_image_upload_data[v0] = R2_W; + *(uint16 *)&stripe_image_upload_data[v0] = r2w; uint16 v1 = v0 + 2; int16 v2 = 0xb00; - R8_W = R3_ & 0x1F; - R8_W = 32 - R8_W; - if (R8_W < 6) { - LOBYTE(v3) = (uint16)(2 * R8_W - 1) >> 8; - HIBYTE(v3) = 2 * R8_W - 1; + r8 = (r2w >> 8) & 0x1F; + r8 = 32 - r8; + if (r8 < 6) { + LOBYTE(v3) = (uint16)(2 * r8 - 1) >> 8; + HIBYTE(v3) = 2 * r8 - 1; v2 = v3; - R8_W = 6 - R8_W; + r8 = 6 - r8; } *(uint16 *)&stripe_image_upload_data[v1] = v2; v0 = v1 + 2; - R4_W = 5; - uint16 v4 = R0_W; + uint16 r4 = 5; + uint16 v4 = r0w; do { - *(uint16 *)&stripe_image_upload_data[v0] = R10_W & *(uint16 *)IndirPtr(&R12_W, v4); + *(uint16 *)&stripe_image_upload_data[v0] = r10 & WORD(r12[v4]); v0 += 2; v4 += 2; - if ((v4 & 0x3F) == 0 && R4_W) { + if ((v4 & 0x3F) == 0 && r4) { v4 = ((v4 - 1) & 0xFFC0) + 0x800; - LOBYTE(v5) = HIBYTE(R2_W); - HIBYTE(v5) = R2_W; + LOBYTE(v5) = HIBYTE(r2w); + HIBYTE(v5) = r2w; v6 = (v5 & 0x3BE0) + 0x400; int8 v7 = v6; LOBYTE(v6) = HIBYTE(v6); HIBYTE(v6) = v7; *(uint16 *)&stripe_image_upload_data[v0] = v6; uint16 v8 = v0 + 2; - LOBYTE(v6) = (uint16)(2 * R8_W - 1) >> 8; - HIBYTE(v6) = 2 * R8_W - 1; + LOBYTE(v6) = (uint16)(2 * r8 - 1) >> 8; + HIBYTE(v6) = 2 * r8 - 1; *(uint16 *)&stripe_image_upload_data[v8] = v6; v0 = v8 + 2; } - --R4_W; - } while ((R4_W & 0x8000) == 0); - LOBYTE(v9) = HIBYTE(R2_W); - HIBYTE(v9) = R2_W; + } while ((--r4 & 0x8000) == 0); + LOBYTE(v9) = HIBYTE(r2w); + HIBYTE(v9) = r2w; v9 += 32; int8 v10 = v9; LOBYTE(v9) = HIBYTE(v9); HIBYTE(v9) = v10; - R2_W = v9; - uint16 v11 = R0_W; - R0_W += 64; - if ((R0_W & 0x7C0) == 0) { - R0_W = (v11 & 0xF83F) + 0x1000; - LOBYTE(v12) = HIBYTE(R2_W); - HIBYTE(v12) = R2_W; + r2w = v9; + uint16 v11 = r0w; + r0w += 64; + if ((r0w & 0x7C0) == 0) { + r0w = (v11 & 0xF83F) + 0x1000; + LOBYTE(v12) = HIBYTE(r2w); + HIBYTE(v12) = r2w; v13 = ((v12 - 32) & 0x341F) + 0x800; int8 v14 = v13; LOBYTE(v13) = HIBYTE(v13); HIBYTE(v13) = v14; - R2_W = v13; + r2w = v13; } - --R6_W; - } while ((R6_W & 0x8000) == 0); + --n; + } while ((n & 0x8000) == 0); return v0; } void OwEventProcess07_SilentEventsAndEndOfEvent() { // 04e9ec - R15_ = ow_current_event_number; OwEventProcess07_SilentEventsAndEndOfEvent_Entry2(ow_current_event_number); } @@ -1915,17 +1982,16 @@ void OwEventProcess07_SilentEventsAndEndOfEvent_Entry2(uint8 a) { // 04e9f1 for (uint8 i = 43; (i & 0x80) == 0; --i) { if (a == kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles[i]) { uint8 v4 = i; - R2_ = kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TileLayer[i]; + uint8 r2 = kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TileLayer[i]; uint16 v2 = (uint8)(2 * i); int v3 = (uint8)v2 >> 1; - R0_W = kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TileNum[v3]; - R4_W = kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TilemapLocation[v3]; - if ((R2_W & 1) != 0) - BufferEventTileToLayer2Tilemap_Entry2(v2, R0_W); + uint16 r0w = kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TileNum[v3]; + uint16 r4w = kOwEventProcess07_SilentEventsAndEndOfEvent_SilentEventTiles_TilemapLocation[v3]; + if ((r2 & 1) != 0) + BufferEventTileToLayer2Tilemap_Entry2(v2, r0w, r4w); else - blocks_map16_table_lo[R4_W] = R0_; + blocks_map16_table_lo[r4w] = r0w; i = v4; - a = R15_; } } if (pointer_overworld_event_process) { @@ -1964,44 +2030,43 @@ void OwEventProcess03_GetLayer2Tile_04EA8B() { // 04ea8b void OwEventProcess04_FadeInLayer2Tile() { // 04eaa4 if (timer_level_end_fade < 0x40) { - GetXAndYDispOfCurrentEventTileSprite(); + PointU8 pt = GetXAndYDispOfCurrentEventTileSprite(); uint16 v0 = 140; int16 v1 = 6; if (*(uint16 *)&timer_destroy_tile_event_unknown >= 0x900) { v0 = 12; v1 = 2; } - *(uint16 *)&R5_ = v1; + uint16 r5 = v1; uint16 v2 = *(uint16 *)&timer_destroy_tile_event_unknown; do { - R3_ = R5_; - uint8 v3 = R0_; + uint8 r3 = r5; + uint8 v3 = pt.x; do { - R2_ = v3; + uint8 r2 = v3; OamEnt *oam = get_OamEnt(oam_buf, v0); - oam[84].ypos = R1_; + oam[84].ypos = pt.y; oam[84].charnum = kOverworldLayer2EventTilemap_Tiles[v2]; - R4_ = ow_layer2_event_tiles[v2] & 0xC0; - oam[84].flags = R4_ | ((uint8)(ow_layer2_event_tiles[v2] & 0x1C) >> 1) | 0x11; - uint8 v5 = R2_; - oam[84].xpos = R2_; + oam[84].flags = ow_layer2_event_tiles[v2] & 0xC0 | ((uint8)(ow_layer2_event_tiles[v2] & 0x1C) >> 1) | 0x11; + uint8 v5 = r2; + oam[84].xpos = r2; v3 = v5 + 8; ++v2; v0 -= 4; - --R3_; - } while (R3_); - R1_ += 8; + --r3; + } while (r3); + pt.y += 8; } while (v0 != 0xFFFC); for (int8 i = 35; i >= 0; --i) sprites_oamtile_size_buffer[(uint8)i + 84] = 0; uint8 v7 = 8; if (ow_players_map[player_current_character] == 3) v7 = 1; - temp8a = v7; + uint8 tmp8a = v7; do { OwEventProcess04_FadeInLayer2Tile_00B006(timer_level_end_fade); - --temp8a; - } while (temp8a); + --tmp8a; + } while (tmp8a); OwEventProcess03_GetLayer2Tile_04EA8B(); } else { ++pointer_overworld_event_process; @@ -2013,38 +2078,40 @@ void OwEventProcess04_FadeInLayer2Tile() { // 04eaa4 } void OwEventProcess06_FadeInLayer1Tile() { // 04ebeb + uint8 r2, r3; if ((--timer_destroy_tile_event_unknown & 0x80) == 0) { uint8 v0 = timer_destroy_tile_event_unknown; uint8 v1; + PointU8 pt; if (pointer_overworld_event_process == 1) { if (timer_destroy_tile_event_unknown == 24) { OwEventProcess01_DestroyTileAnimation_04EEAA(); v0 = 24; } v1 = v0 & 0xFC; - R2_ = kOwEventProcess01_DestroyTileAnimation_DATA_04EBE1[(uint8)(v0 & 0xFC) >> 2]; - GetXAndYDispOfCurrentEventTileSprite(); + r2 = kOwEventProcess01_DestroyTileAnimation_DATA_04EBE1[(uint8)(v0 & 0xFC) >> 2]; + pt = GetXAndYDispOfCurrentEventTileSprite(); } else { if (timer_destroy_tile_event_unknown == 16) { OwEventProcess01_DestroyTileAnimation_04ED83(); v0 = 16; } - R2_ = kOwEventProcess01_DestroyTileAnimation_DATA_04EBDA[v0 >> 2]; - GetXAndYDispOfCurrentEventTileSprite(); + r2 = kOwEventProcess01_DestroyTileAnimation_DATA_04EBDA[v0 >> 2]; + pt = GetXAndYDispOfCurrentEventTileSprite(); v1 = 40; } - R3_ = 3; + r3 = 3; uint8 v2 = 0; do { OamEnt *oam = get_OamEnt(oam_buf, v2); - oam[32].xpos = kOwEventProcess01_DestroyTileAnimation_DATA_04EB56[v1] + R0_; - oam[32].ypos = kOwEventProcess01_DestroyTileAnimation_DATA_04EB82[v1] + R1_; - oam[32].charnum = R2_; + oam[32].xpos = kOwEventProcess01_DestroyTileAnimation_DATA_04EB56[v1] + pt.x; + oam[32].ypos = kOwEventProcess01_DestroyTileAnimation_DATA_04EB82[v1] + pt.y; + oam[32].charnum = r2; oam[32].flags = kOwEventProcess01_DestroyTileAnimation_DATA_04EBAE[v1]; v2 += 4; ++v1; - --R3_; - } while ((R3_ & 0x80) == 0); + --r3; + } while ((r3 & 0x80) == 0); sprites_oamtile_size_buffer[32] = 0; sprites_oamtile_size_buffer[33] = 0; sprites_oamtile_size_buffer[34] = 0; @@ -2054,16 +2121,17 @@ void OwEventProcess06_FadeInLayer1Tile() { // 04ebeb } } -void GetXAndYDispOfCurrentEventTileSprite() { // 04ec67 - R0_ = ow_on_screen_xpos_of_current_event_tile - mirror_current_layer2_xpos; - R1_ = ow_on_screen_ypos_of_current_event_tile - (mirror_current_layer2_ypos + 1); +PointU8 GetXAndYDispOfCurrentEventTileSprite() { // 04ec67 + uint8 r0 = ow_on_screen_xpos_of_current_event_tile - mirror_current_layer2_xpos; + uint8 r1 = ow_on_screen_ypos_of_current_event_tile - (mirror_current_layer2_ypos + 1); + return (PointU8) { .x = r0, .y = r1 }; } void OwEventProcess05_GetLayer1Tile() { // 04ec78 - R15_ = 126; - *(uint16 *)&R13_ = 0xc800; + LongPtr r13 = LONGPTR(0x7ec800); + uint16 v0 = 21; - uint8 v1 = *IndirPtr(&R13_, kChangingLayer1OverworldTiles_Layer1TileLocation[(uint16)(2 * ow_current_event_number) >> 1]); + uint8 v1 = *IndirPtr(&r13, kChangingLayer1OverworldTiles_Layer1TileLocation[ow_current_event_number]); while (v1 != kChangingLayer1OverworldTiles_TilesThatChange[v0]) { if ((--v0 & 0x8000) != 0) { pointer_overworld_event_process = 7; @@ -2080,36 +2148,30 @@ void OwEventProcess05_GetLayer1Tile() { // 04ec78 } void OwEventProcess01_DestroyTileAnimation_04ED83() { // 04ed83 - R15_ = 126; - *(uint16 *)&R13_ = 0xc800; uint16 v0 = 21; - uint8 v1 = *IndirPtr(&R13_, kChangingLayer1OverworldTiles_Layer1TileLocation[(uint16)(2 * ow_current_event_number) >> 1]); + uint8 v1 = g_ram[0xc800 + kChangingLayer1OverworldTiles_Layer1TileLocation[ow_current_event_number]]; do { if (v1 == kChangingLayer1OverworldTiles_TilesThatChange[v0]) break; --v0; } while (v0); - R14_W = v0; - int v2 = (uint16)(2 * ow_current_event_number) >> 1; - R0_W = kOwEventProcess01_DestroyTileAnimation_DATA_04D93D[v2]; +// r14w = v0; + int v2 = ow_current_event_number; + uint16 r0w = kOwEventProcess01_DestroyTileAnimation_DATA_04D93D[v2]; blocks_map16_table_lo[kChangingLayer1OverworldTiles_Layer1TileLocation[v2]] = kChangingLayer1OverworldTiles_TilesToBecome[v0]; - R12_ = 4; - R10_W = 0xecd3; - OwEventProcess01_DestroyTileAnimation_04EDE6(stripe_image_upload, 8 * R14_W); + OwEventProcess01_DestroyTileAnimation_04EDE6(stripe_image_upload, 8 * v0, r0w, RomPtr(0x4ecd3)); } -void OwEventProcess01_DestroyTileAnimation_04EDE6(uint16 k, uint16 j) { // 04ede6 - uint16 v2 = R0_W; - *(uint16 *)&stripe_image_upload_data[k] = R0_W; +void OwEventProcess01_DestroyTileAnimation_04EDE6(uint16 k, uint16 j, uint16 r0w, const uint8 *p) { // 04ede6 + uint16 v2 = r0w; + *(uint16 *)&stripe_image_upload_data[k] = r0w; *(uint16 *)&stripe_image_upload_data[k + 8] = v2 + 0x2000; *(uint16 *)&stripe_image_upload_data[k + 2] = 768; *(uint16 *)&stripe_image_upload_data[k + 10] = 768; - *(uint16 *)&stripe_image_upload_data[k + 4] = *(uint16 *)IndirPtr(&R10_W, j); - uint16 v3 = j + 2; - *(uint16 *)&stripe_image_upload_data[k + 12] = *(uint16 *)IndirPtr(&R10_W, v3); - v3 += 2; - *(uint16 *)&stripe_image_upload_data[k + 6] = *(uint16 *)IndirPtr(&R10_W, v3); - *(uint16 *)&stripe_image_upload_data[k + 14] = *(uint16 *)IndirPtr(&R10_W, v3 + 2); + *(uint16 *)&stripe_image_upload_data[k + 4] = *(uint16 *)(p + j); + *(uint16 *)&stripe_image_upload_data[k + 12] = *(uint16 *)(p + j + 2); + *(uint16 *)&stripe_image_upload_data[k + 6] = *(uint16 *)(p + j + 4); + *(uint16 *)&stripe_image_upload_data[k + 14] = *(uint16 *)(p + j + 6); *(uint16 *)&stripe_image_upload_data[k + 16] = 255; stripe_image_upload = k + 16; } @@ -2117,54 +2179,43 @@ void OwEventProcess01_DestroyTileAnimation_04EDE6(uint16 k, uint16 j) { // 04ed void OwEventProcess04_FadeInLayer2Tile_04EE30() { // 04ee30 uint16 v2; - R14_ = 127; uint16 v0 = 4 * ow_starting_event_tile; int v1 = (uint16)(4 * ow_starting_event_tile) >> 1; - R0_W = kLayer2EventData_TileEntries[v1 + 1]; - LOBYTE(v2) = (uint16)(((uint16)(R0_W & 0x1FFF) >> 1) + 0x3000) >> 8; - HIBYTE(v2) = (uint16)(R0_W & 0x1FFF) >> 1; - R2_W = v2; - R12_W = 0x4000; - R10_W = -1; + uint16 r0w = kLayer2EventData_TileEntries[v1 + 1]; + LOBYTE(v2) = (uint16)(((uint16)(r0w & 0x1FFF) >> 1) + 0x3000) >> 8; + HIBYTE(v2) = (uint16)(r0w & 0x1FFF) >> 1; + uint16 r2w = v2; + const uint8 *r12 = g_ram + 0x14000; if (kLayer2EventData_TileEntries[v1] < 0x900) - v0 = BufferEventTileToStripeImageTable_Buffer6x6Tile(); + v0 = BufferEventTileToStripeImageTable_Buffer6x6Tile(r0w, r2w, 0xffff, r12); else - v0 = BufferEventTileToStripeImageTable_Buffer2x2Tile(); + v0 = BufferEventTileToStripeImageTable_Buffer2x2Tile(r0w, r2w, 0xffff, r12); *(uint16 *)&stripe_image_upload_data[v0] = 255; stripe_image_upload = v0; } void OwEventProcess01_DestroyTileAnimation_04EEAA() { // 04eeaa uint16 v2; + const uint8 *p = RomPtr(0x4ee7a); - R15_ = 126; - R12_ = 4; - *(uint16 *)&R13_ = 0xc800; - R10_W = 0xee7a; - R0_W = kOwEventProcess01_DestroyTileAnimation_DATA_04E587[(uint16)(2 * ow_destroy_tile_event_vramindex) >> 1]; + uint16 r0w = kOwEventProcess01_DestroyTileAnimation_DATA_04E587[(uint16)(2 * ow_destroy_tile_event_vramindex) >> 1]; uint16 v0 = stripe_image_upload; if (!sign16(ow_destroy_tile_event_tile_index - 3)) { uint16 v1 = 8 * ow_destroy_tile_event_tile_index; - v2 = R0_W; - *(uint16 *)&stripe_image_upload_data[stripe_image_upload] = R0_W; + v2 = r0w; + *(uint16 *)&stripe_image_upload_data[v0] = r0w; v2 += 0x2000; *(uint16 *)&stripe_image_upload_data[v0 + 8] = v2; - int8 v3 = v2; - LOBYTE(v2) = HIBYTE(v2); - HIBYTE(v2) = v3; + v2 = swap16(v2); v2 += 32; - int8 v4 = v2; - LOBYTE(v2) = HIBYTE(v2); - HIBYTE(v2) = v4; - R0_W = v2; + v2 = swap16(v2); + r0w = v2; *(uint16 *)&stripe_image_upload_data[v0 + 2] = 768; *(uint16 *)&stripe_image_upload_data[v0 + 10] = 768; - *(uint16 *)&stripe_image_upload_data[v0 + 4] = *(uint16 *)IndirPtr(&R10_W, v1); - v1 += 2; - *(uint16 *)&stripe_image_upload_data[v0 + 12] = *(uint16 *)IndirPtr(&R10_W, v1); - v1 += 2; - *(uint16 *)&stripe_image_upload_data[v0 + 6] = *(uint16 *)IndirPtr(&R10_W, v1); - *(uint16 *)&stripe_image_upload_data[v0 + 14] = *(uint16 *)IndirPtr(&R10_W, v1 + 2); + *(uint16 *)&stripe_image_upload_data[v0 + 4] = *(uint16 *)(p + v1); + *(uint16 *)&stripe_image_upload_data[v0 + 12] = *(uint16 *)(p + v1 + 2); + *(uint16 *)&stripe_image_upload_data[v0 + 6] = *(uint16 *)(p + v1 + 4); + *(uint16 *)&stripe_image_upload_data[v0 + 14] = *(uint16 *)(p + v1 + 6); v0 += 16; } uint16 v5; @@ -2172,18 +2223,18 @@ void OwEventProcess01_DestroyTileAnimation_04EEAA() { // 04eeaa v5 = 8 * ow_destroy_tile_event_tile_index; else v5 = 40; - OwEventProcess01_DestroyTileAnimation_04EDE6(v0, v5); + OwEventProcess01_DestroyTileAnimation_04EDE6(v0, v5, r0w, p); } void DrawFlyingSwitchBlocks() { // 04f290 int16 v8; - if (player_on_tilting_platform_ypos_hi < 0xC) { - if (!player_on_tilting_platform_xpos_hi) { - if (player_on_tilting_platform_ypos_hi < 8) { + if (switch_block_event_ejection_counter < 0xC) { + if (!switch_block_event_wait_counter) { + if (switch_block_event_ejection_counter < 8) { io_sound_ch3 = 28; - R0_ = 7; - uint8 v0 = temp1436; + uint8 r0 = 7; + uint8 v0 = switch_block_event_blocks_thrown_ctr; do { uint8 *pt = (uint8 *)get_PointU16(ow_players_pos, player_current_characterx4); blocks_layer2_tiles_lo[v0 + 120] = *pt; @@ -2192,67 +2243,65 @@ void DrawFlyingSwitchBlocks() { // 04f290 blocks_layer2_tiles_lo[v0 + 40] = pt[3]; blocks_layer2_tiles_lo[v0 + 200] = 0; blocks_layer2_tiles_lo[v0 + 80] = 0; - uint8 v2 = R0_; - blocks_layer2_tiles_lo[v0 + 240] = kDrawFlyingSwitchBlocks_XSpeed[R0_]; - blocks_layer2_tiles_lo[v0 + 280] = kDrawFlyingSwitchBlocks_YSpeed[v2]; + blocks_layer2_tiles_lo[v0 + 240] = kDrawFlyingSwitchBlocks_XSpeed[r0]; + blocks_layer2_tiles_lo[v0 + 280] = kDrawFlyingSwitchBlocks_YSpeed[r0]; blocks_layer2_tiles_lo[v0++ + 320] = -48; - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); if (v0 >= 0x28) { - uint8 v3 = temp1438 + 32; - if ((uint8)(temp1438 + 32) >= 0xA0) + uint8 v3 = switch_block_event_oam_index + 32; + if ((uint8)(switch_block_event_oam_index + 32) >= 0xA0) v3 = 0; - temp1438 = v3; + switch_block_event_oam_index = v3; v0 = 0; } - temp1436 = v0; + switch_block_event_blocks_thrown_ctr = v0; } - player_on_tilting_platform_xpos_hi = 16; - ++player_on_tilting_platform_ypos_hi; + switch_block_event_wait_counter = 16; + ++switch_block_event_ejection_counter; } - --player_on_tilting_platform_xpos_hi; - R15_ = temp1438; + --switch_block_event_wait_counter; + uint8 r15 = switch_block_event_oam_index; uint8 v4 = 0; do { - uint8 v5 = DrawFlyingSwitchBlocks_04F39C(v4, 0); - uint8 v6 = DrawFlyingSwitchBlocks_04F39C(v4 + 40, v5); - DrawFlyingSwitchBlocks_04F39C(v4 + 80, v6); + uint16 r0w = DrawFlyingSwitchBlocks_04F39C(v4, 0); + uint16 r2w = DrawFlyingSwitchBlocks_04F39C(v4 + 40, 2); + DrawFlyingSwitchBlocks_04F39C(v4 + 80, 4); int8 v7 = blocks_layer2_tiles_lo[v4 + 320] + 1; if (v7 >= 64) v7 = 64; blocks_layer2_tiles_lo[v4 + 320] = v7; HIBYTE(v8) = blocks_layer2_tiles_lo[v4 + 80]; LOBYTE(v8) = blocks_layer2_tiles_lo[v4 + 200]; - R2_W += v8; - if (!(R1_ | HIBYTE(R2_W))) { - uint8 v9 = R15_; - OamEnt *oam = get_OamEnt(oam_buf, R15_); - oam[80].ypos = R2_W; - oam[80].xpos = R0_; + r2w += v8; + if (!(HIBYTE(r0w) | HIBYTE(r2w))) { + uint8 v9 = r15; + OamEnt *oam = get_OamEnt(oam_buf, r15); + oam[80].ypos = r2w; + oam[80].xpos = r0w; oam[80].charnum = -26; oam[80].flags = (2 * (misc_color_of_palace_switch_pressed1 - 1)) | 0x30; sprites_oamtile_size_buffer[(v9 >> 2) + 80] = 2; } - uint8 v11 = R15_ + 4; - if ((uint8)(R15_ + 4) >= 0xA0) + uint8 v11 = r15 + 4; + if ((uint8)(r15 + 4) >= 0xA0) v11 = 0; - R15_ = v11; + r15 = v11; ++v4; - } while (v4 < temp1436 || player_on_tilting_platform_ypos_hi >= 5 && v4 < 0x28); + } while (v4 < switch_block_event_blocks_thrown_ctr || switch_block_event_ejection_counter >= 5 && v4 < 0x28); } else { misc_color_of_palace_switch_pressed1 = 0; } } -uint8 DrawFlyingSwitchBlocks_04F39C(uint8 k, uint8 j) { // 04f39c +uint16 DrawFlyingSwitchBlocks_04F39C(uint8 k, uint8 j) { // 04f39c uint16 sub = blocks_layer2_tiles_lo[k + 360] + (uint8)(16 * blocks_layer2_tiles_lo[k + 240]); blocks_layer2_tiles_lo[k + 360] = sub; uint16 spd = ((int8)blocks_layer2_tiles_lo[k + 240] >> 4) + (sub >> 8); uint16 pos = PAIR16(blocks_layer2_tiles_lo[k], blocks_layer2_tiles_lo[k + 120]) + spd; blocks_layer2_tiles_lo[k + 120] = pos; blocks_layer2_tiles_lo[k] = pos >> 8; - *(uint16 *)((int8 *)&R0_W + j) = pos - *(uint16 *)((int8 *)&mirror_current_layer1_xpos + j) - 8; - return j + 2; + return pos - *(uint16 *)((int8 *)&mirror_current_layer1_xpos + j) - 8; } void DisplayOwPrompt(uint8 a) { // 04f3e5 @@ -2459,26 +2508,25 @@ void OverworldLightningAndRandomCloudSpawning() { // 04f708 *(&sprites_overworld_cloud_sync_table + (uint8)j) = j; uint8 v11 = 4; do { - R0_ = v11; + uint8 r0 = v11; do { - R1_ = v11; - int v12 = *(&sprites_overworld_cloud_sync_table + R0_); - R2_ = owspr_ypos_lo[*(&sprites_overworld_cloud_sync_table + R0_)]; - R3_ = owspr_ypos_hi[v12]; - uint8 v13 = R1_; - uint8 v14 = *(&sprites_starting_oamindex_for_overworld_sprites + R1_); + uint8 r1 = v11; + int v12 = *(&sprites_overworld_cloud_sync_table + r0); + uint16 r2w = owspr_ypos_hi[v12] << 8 | owspr_ypos_lo[*(&sprites_overworld_cloud_sync_table + r0)]; + uint8 v13 = r1; + uint8 v14 = *(&sprites_starting_oamindex_for_overworld_sprites + r1); HIBYTE(v15) = owspr_ypos_hi[v14]; LOBYTE(v15) = owspr_ypos_lo[v14]; - if ((int16)(v15 - R2_W) < 0) { - uint8 v18 = *(&sprites_starting_oamindex_for_overworld_sprites + R1_); - uint8 v16 = R0_; - *(&sprites_starting_oamindex_for_overworld_sprites + R1_) = *(&sprites_overworld_cloud_sync_table + R0_); + if ((int16)(v15 - r2w) < 0) { + uint8 v18 = *(&sprites_starting_oamindex_for_overworld_sprites + r1); + uint8 v16 = r0; + *(&sprites_starting_oamindex_for_overworld_sprites + r1) = *(&sprites_overworld_cloud_sync_table + r0); *(&sprites_overworld_cloud_sync_table + v16) = v18; } v11 = v13 - 1; } while (v11); - v11 = R0_ - 1; - } while (R0_ != 1); + v11 = r0 - 1; + } while (v11); sprites_starting_oamindex_for_overworld_sprites = 48; ow_enter_level_flag = 0; for (uint8 k = 15; (k & 0x80) == 0; --k) { @@ -2508,10 +2556,10 @@ uint8 CheckIfXIsAllowedOnYSubmap_Sprites(uint8 k) { // 04f87c } uint8 CheckIfXIsAllowedOnYSubmap_Lightning(uint8 a) { // 04f882 - R0_ = a; + uint8 r0 = a; if (pointer_current_overworld_process == 10 && ow_submap_switch_process != 1) return 1; - uint8 result = R0_ & kCheckIfXIsAllowedOnYSubmap_ANDTable[ow_players_map[(uint8)player_current_characterx4 >> 2]]; + uint8 result = r0 & kCheckIfXIsAllowedOnYSubmap_ANDTable[ow_players_map[(uint8)player_current_characterx4 >> 2]]; if (result) return 1; return result; @@ -2520,21 +2568,20 @@ uint8 CheckIfXIsAllowedOnYSubmap_Lightning(uint8 a) { // 04f882 void OWSpr01_Lakitu(uint8 k) { // 04f8cc UpdateOverworldSpritePosition(k); DrawOverworldSpriteShadow(k, 0); - GetOverworldSpriteOnScreenPosition(k); - R4_W = R2_W; + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); + uint16 r4w = pt.y; uint8 v2 = SetOverworldSpriteFrameIndex(k); uint8 v3 = ((v2 & 0x10) != 0) ? 7 : 6; do { - R6_ = v3; - R0_W += kOWSpr01_Lakitu_DATA_04F8A6[v3]; - uint32 t = R4_W + kOWSpr01_Lakitu_DATA_04F8AE[v3]; - R2_W = t; - OWSpr05_Cloud_04FB7B(0x3228, t >> 16); - v3 = R6_ - 2; + pt.x += kOWSpr01_Lakitu_DATA_04F8A6[v3]; + uint32 t = r4w + kOWSpr01_Lakitu_DATA_04F8AE[v3]; + pt.y = t; + OWSpr05_Cloud_04FB7B(0x3228, t >> 16, pt); + v3 -= 2; } while ((int8)v3 >= 0); uint8 v5 = misc_which_file_to_erase; - GetOverworldSpriteOnScreenPosition(misc_which_file_to_erase); - OWSpr05_Cloud_04FB7A(0x3226); + pt = GetOverworldSpriteOnScreenPosition(misc_which_file_to_erase); + OWSpr05_Cloud_04FB7A(0x3226, pt); if (owspr_table0e15[v5]) { OWSpr01_Lakitu_CalculateOverworldLakitusSpeed(v5); } else { @@ -2543,16 +2590,16 @@ void OWSpr01_Lakitu(uint8 k) { // 04f8cc owspr_zspeed[v5] = v7; if (v7 == kOWSpr01_Lakitu_ZSpeedCap[v6]) owspr_table0e05[v5] ^= 1; - CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(v5); + OwHvPos pos = CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(v5); bool less; uint8 j = owspr_table0df5[v5]; int8 v8; - if (((R0_W ^ (2 * *(uint16 *)&owspr_table0df5[v5 + 15])) & 0x8000) == 0 || - (v8 = 64, (less = R6_W < *(uint16 *)&kOWSpr01_Lakitu_DATA_04F8B6[j]))) { - int16 v9 = R2_W ^ *(uint16 *)&owspr_table0df5[v5 + 15]; + if (((pos.r0 ^ (2 * *(uint16 *)&owspr_table0df5[v5 + 15])) & 0x8000) == 0 || + (v8 = 64, (less = pos.r6 < *(uint16 *)&kOWSpr01_Lakitu_DATA_04F8B6[j]))) { + int16 v9 = pos.r2 ^ *(uint16 *)&owspr_table0df5[v5 + 15]; if (!(v9 & 0x80)) goto label1; - less = R8_W < *(uint16 *)&kOWSpr01_Lakitu_DATA_04F8BE[j]; + less = pos.r8 < *(uint16 *)&kOWSpr01_Lakitu_DATA_04F8BE[j]; v8 = 0x80; } if (!less) { @@ -2577,33 +2624,39 @@ void OWSpr02_BlueBird(uint8 k) { // 04f9b8 uint16 v7; DrawOverworldSpriteShadow(k, 0); - CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(k); - uint8 v2 = kOWSpr01_Lakitu_Acceleration[(R1_ & 0x80) == 0] + owspr_xspeed[k]; - if (v2 != kOWSpr01_Lakitu_XYSpeedCap[(R1_ & 0x80) == 0]) + OwHvPos pos = CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(k); + uint8 v2 = kOWSpr01_Lakitu_Acceleration[(pos.r0 & 0x8000) == 0] + owspr_xspeed[k]; + if (v2 != kOWSpr01_Lakitu_XYSpeedCap[(pos.r0 & 0x8000) == 0]) owspr_xspeed[k] = v2; - PointU16 *pt = get_PointU16(ow_players_pos, player_current_characterx4); - owspr_ypos_lo[k] = pt->y; - owspr_ypos_hi[k] = HIBYTE(pt->y); + PointU16 *pt1 = get_PointU16(ow_players_pos, player_current_characterx4); + owspr_ypos_lo[k] = pt1->y; + owspr_ypos_hi[k] = HIBYTE(pt1->y); UpdateOverworldSpritePosition(k); - GetOverworldSpriteOnScreenPosition(k); + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); int8 v4 = 54; if ((owspr_xspeed[k] & 0x80) == 0) v4 = 118; int8 v10 = v4; HIBYTE(v5) = v4; LOBYTE(v5) = 76; - OWSpr05_Cloud_04FB7A(v5); + OWSpr05_Cloud_04FB7A(v5, pt); HIBYTE(v7) = v10; uint8 v6 = (SetOverworldSpriteFrameIndex(k) >> 3) & 3; LOBYTE(v7) = kOWSpr02_BlueBird_DATA_04F9AC[v6]; if ((owspr_xspeed[k] & 0x80) == 0) LOBYTE(v7) = kOWSpr02_BlueBird_DATA_04F9B0[v6]; - R0_W += (uint8)v7; - R2_W += kOWSpr02_BlueBird_DATA_04F9B4[v6]; + pt.x += (uint8)v7; + pt.y += kOWSpr02_BlueBird_DATA_04F9B4[v6]; LOBYTE(v7) = kOWSpr02_BlueBird_DATA_04F9A8[v6]; - OWSpr05_Cloud_04FB7B(v7, 0); + OWSpr05_Cloud_04FB7B(v7, 0, pt); } +static const uint8 kOWSpr03_CheepCheep_DATA_04FA2E[3] = { 0x70, 0x50, 0xb0, }; +static const uint8 kOWSpr03_CheepCheep_DATA_04FA31[3] = { 0x0, 0x1, 0x0, }; +static const uint8 kOWSpr03_CheepCheep_DATA_04FA34[3] = { 0xcf, 0x8f, 0x7f, }; +static const uint8 kOWSpr03_CheepCheep_DATA_04FA37[3] = { 0x0, 0x0, 0x1, }; +static const uint8 kOWSpr03_CheepCheep_DATA_04FA3A[4] = { 0x73, 0x72, 0x63, 0x62, }; + void OWSpr03_CheepCheep(uint8 k) { // 04fa3e if (owspr_table0df5[k]) { OWSpr03_CheepCheep_04FA83(k); @@ -2638,7 +2691,7 @@ void OWSpr03_CheepCheep_04FA83(uint8 k) { // 04fa83 UpdateOverworldSpritePosition(k); if (!(owspr_table0e25[k] | owspr_zpos_lo[k])) owspr_table0df5[k] = 0; - GetOverworldSpriteOnScreenPosition(k); + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); uint8 v1 = owspr_table0df5[k]; uint8 v2 = 8; if ((owspr_zspeed[k] & 0x80) != 0) { @@ -2646,46 +2699,46 @@ void OWSpr03_CheepCheep_04FA83(uint8 k) { // 04fa83 v2 = 16; } uint8 a = (counter_global_frames & v2) != 0 ? 0x48 : 0x4a; - uint8 j = OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v1 << 8 | a); - AddZPositionToTempYPos(k); - R2_W -= 8; + uint8 j = OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v1 << 8 | a, pt); + pt.y += owspr_zpos_lo[k]; + pt.y -= 8; uint8 v6 = owspr_table0e25[k]; if (v6) { v6 = kOWSpr03_CheepCheep_DATA_04FA3A[v6 >> 2]; - j = OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(j, 0x36 << 8 | v6); - R0_W += 8; - OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(j, 0x76 << 8 | v6); + j = OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(j, 0x36 << 8 | v6, pt); + pt.x += 8; + OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(j, 0x76 << 8 | v6, pt); } } -uint8 OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(uint8 j, uint16 a) { // 04faed - return OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(j, a, 0); +uint8 OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(uint8 j, uint16 a, PointU16 pt) { // 04faed + return OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(j, a, 0, pt); } void OWSpr04_PiranhaPlant(uint8 k) { // 04faf1 uint16 v2; CheckPlayerToOverworldSpriteCollision(k); - GetOverworldSpriteOnScreenPosition(k); + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); int8 v1 = 42; if ((SetOverworldSpriteFrameIndex(k) & 8) != 0) v1 = 44; HIBYTE(v2) = 50; LOBYTE(v2) = v1; - OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v2); + OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v2, pt); } -uint8 OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(uint8 k, uint16 a) { // 04fb06 - return OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(kOverworldSpriteOAMIndexes[k], a, 1); +uint8 OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(uint8 k, uint16 a, PointU16 pt) { // 04fb06 + return OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(kOverworldSpriteOAMIndexes[k], a, 1, pt); } -uint8 OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(uint8 j, uint16 a, uint8 cr) { // 04fb0a +uint8 OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(uint8 j, uint16 a, uint8 cr, PointU16 pt) { // 04fb0a OamEnt *oam = get_OamEnt(oam_buf, j); *(uint16 *)&oam[16].charnum = a; - if (!R1_) { - oam[16].xpos = R0_; - if (!R3_) { - oam[16].ypos = R2_; + if (pt.x < 256) { + oam[16].xpos = pt.x; + if (pt.y < 256) { + oam[16].ypos = pt.y; sprites_oamtile_size_buffer[(j >> 2) + 16] = cr << 1; j -= 4; } @@ -2697,32 +2750,32 @@ void OWSpr05_Cloud(uint8 k) { // 04fb37 owspr_xspeed[k] = 2; owspr_yspeed[k] = -1; UpdateOverworldSpritePosition(k); - GetOverworldSpriteOnScreenPosition(k); - bool v1 = (uint16)(R0_W + 32) >= 0x140; - if ((uint16)(R0_W + 32) < 0x140) - v1 = (uint16)(R2_W + 128) >= 0x1A0; + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); + bool v1 = (uint16)(pt.x + 32) >= 0x140; + if ((uint16)(pt.x + 32) < 0x140) + v1 = (uint16)(pt.y + 128) >= 0x1A0; if (v1) owspr_spriteid[k] = 0; - OWSpr05_Cloud_04FB77(0x32); - R0_W += 16; - OWSpr05_Cloud_04FB77(0x72); + OWSpr05_Cloud_04FB77(0x32, pt); + pt.x += 16; + OWSpr05_Cloud_04FB77(0x72, pt); } -void OWSpr05_Cloud_04FB77(uint8 a) { // 04fb77 +void OWSpr05_Cloud_04FB77(uint8 a, PointU16 pt) { // 04fb77 uint16 v1; HIBYTE(v1) = a; LOBYTE(v1) = 68; - OWSpr05_Cloud_04FB7A(v1); + OWSpr05_Cloud_04FB7B(v1, 1, pt); } -void OWSpr05_Cloud_04FB7A(uint16 a) { // 04fb7a - OWSpr05_Cloud_04FB7B(a, 1); +void OWSpr05_Cloud_04FB7A(uint16 a, PointU16 pt) { // 04fb7a + OWSpr05_Cloud_04FB7B(a, 1, pt); } -void OWSpr05_Cloud_04FB7B(uint16 a, uint8 cr) { // 04fb7b +void OWSpr05_Cloud_04FB7B(uint16 a, uint8 cr, PointU16 pt) { // 04fb7b sprites_starting_oamindex_for_overworld_sprites = - OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(sprites_starting_oamindex_for_overworld_sprites, a, cr); + OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(sprites_starting_oamindex_for_overworld_sprites, a, cr, pt); } void OWSpr06_KoopaKid(uint8 k) { // 04fb98 @@ -2745,7 +2798,7 @@ void OWSpr06_KoopaKid(uint8 k) { // 04fb98 owspr_xspeed[k] = -16; owspr_table0e25[k] = 0; } - GetOverworldSpriteOnScreenPosition(k); + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); if (!owspr_table0e25[k]) { ++owspr_table0e05[k]; UpdateOverworldSpritePosition_X(k); @@ -2762,7 +2815,7 @@ void OWSpr06_KoopaKid(uint8 k) { // 04fb98 v4 = 98; HIBYTE(v5) = v4; LOBYTE(v5) = 106; - OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v5); + OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v5, pt); uint8 v6 = CheckPlayerToOverworldSpriteCollision(k); int8 v7 = v6 & 1; int8 v8 = v6 >> 1; @@ -2784,47 +2837,47 @@ void OWSpr07_Smoke(uint8 k) { // 04fc46 v2 = 0; owspr_table0df5[k] = v2; } - R4_ = 3; - R6_ = counter_global_frames; - R7_ = 0; + uint8 r4 = 3; + uint8 r6 = counter_global_frames; + uint8 r7 = 0; uint8 v3 = kOverworldSpriteOAMIndexes[k]; uint8 v4 = owspr_table0df5[k]; do { uint8 j = v3; - GetOverworldSpriteOnScreenPosition(misc_which_file_to_erase); - uint8 v5 = kOWSpr07_Smoke_DATA_04FC36[v4] + R7_; - R2_W += ~0xff | v5; - R0_W += kOWSpr07_Smoke_DATA_04FC26[v4]; + PointU16 pt = GetOverworldSpriteOnScreenPosition(misc_which_file_to_erase); + uint8 v5 = kOWSpr07_Smoke_DATA_04FC36[v4] + r7; + pt.y += ~0xff | v5; + pt.x += kOWSpr07_Smoke_DATA_04FC26[v4]; uint8 t = v4 + 12; v4 = t & 0xF; if (t >= 0x10) - R7_ -= 12; + r7 -= 12; HIBYTE(v7) = 48; int8 v8 = 40; - R6_ += 10; - if ((R6_ & 0x20) != 0) + r6 += 10; + if ((r6 & 0x20) != 0) v8 = 95; LOBYTE(v7) = v8; - v3 = OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(j, v7); - --R4_; - } while (R4_); + v3 = OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(j, v7, pt); + --r4; + } while (r4); } void OWSpr08_BowserSign(uint8 k) { // 04fce1 uint16 v2; - GetOverworldSpriteOnScreenPosition(k); - R4_ = 4; - R5_ = 111; + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); + uint8 r4 = 4; + uint8 r5 = 111; uint8 v1 = kOverworldSpriteOAMIndexes[k]; do { HIBYTE(v2) = (counter_global_frames >> 1) & 6 | 0x30; - LOBYTE(v2) = R5_; - v1 = OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(v1, v2); - R0_ -= 8; - --R5_; - --R4_; - } while (R4_); + LOBYTE(v2) = r5; + v1 = OWSpr03_CheepCheep_GenericOverworldSpriteGFXRt_Draw8x8(v1, v2, pt); + BYTE(pt.x) -= 8; + --r5; + --r4; + } while (r4); } void OWSpr09_Bowser(uint8 k) { // 04fd24 @@ -2832,13 +2885,13 @@ void OWSpr09_Bowser(uint8 k) { // 04fd24 UpdateOverworldSpritePosition(k); GetOverworldSpriteOnScreenPosition(k); - GetOverworldSpriteOnScreenPosition(k); + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); int8 v1 = 0; if ((owspr_xspeed[k] & 0x80) == 0) v1 = 64; HIBYTE(v2) = v1; LOBYTE(v2) = 104; - OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v2); + OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v2, pt); if (!(++owspr_table0e15[k] & 1)) { OWSpr09_Bowser_04FD55(k + 16, owspr_table0e05[k] | 2); OWSpr09_Bowser_04FD55(k, owspr_table0df5[k]); @@ -2858,81 +2911,70 @@ void OWSpr0A_Boo(uint8 k) { // 04fd70 UpdateOverworldSpritePosition(k); GetOverworldSpriteOnScreenPosition(k); - GetOverworldSpriteOnScreenPosition(k); + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); if (ow_players_map[player_current_character]) { if (k == 15 && (ow_event_flags[5] & 0x12) == 0) - R3_ = 15; - R0_W += *(uint16 *)&kLoadOverworldSprites_SubmapBooXPosOffset[(uint8)(2 * k) - 26]; - R2_W += *(uint16 *)&kLoadOverworldSprites_SubmapBooYPosOffset[(uint8)(2 * k) - 26]; + HIBYTE(pt.y) = 15; + pt.x += *(uint16 *)&kLoadOverworldSprites_SubmapBooXPosOffset[(uint8)(2 * k) - 26]; + pt.y += *(uint16 *)&kLoadOverworldSprites_SubmapBooYPosOffset[(uint8)(2 * k) - 26]; } int8 v1 = 52; if ((owspr_xspeed[k] & 0x80) == 0) v1 = 68; HIBYTE(v2) = v1; LOBYTE(v2) = 96; - OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v2); - R0_ = owspr_table0e25[k]++; - OWSpr0A_Boo_04FDD2(k + 32, 8); - OWSpr0A_Boo_04FDD2(k + 16, 6); - OWSpr0A_Boo_04FDD2(misc_which_file_to_erase, 4); + OWSpr04_PiranhaPlant_GenericOverworldSpriteDraw(k, v2, pt); + uint8 r0 = owspr_table0e25[k]++; + OWSpr0A_Boo_04FDD2(k + 32, 8, r0); + OWSpr0A_Boo_04FDD2(k + 16, 6, r0); + OWSpr0A_Boo_04FDD2(misc_which_file_to_erase, 4, r0); } -void OWSpr0A_Boo_04FDD2(uint8 k, uint8 a) { // 04fdd2 +void OWSpr0A_Boo_04FDD2(uint8 k, uint8 a, uint8 r0) { // 04fdd2 uint8 v2 = owspr_table0df5[k] | a; - if ((R0_ & kOWSpr09_Bowser_DATA_04FD0A[v2 - 4]) != 0) + if ((r0 & kOWSpr09_Bowser_DATA_04FD0A[v2 - 4]) != 0) owspr_table0df5[k] = v2; else OWSpr09_Bowser_04FD55(k, v2); } void DrawOverworldSpriteShadow(uint8 k, uint8 cr) { // 04fe00 - int8 v2 = 0; - if (cr) - v2 = 0x80; - R4_ = (R4_ >> 1) + v2; - GetOverworldSpriteOnScreenPosition(k); - AddZPositionToTempYPos(k); + uint8 r4 = cr ? 0x80 : 0; + PointU16 pt = GetOverworldSpriteOnScreenPosition(k); + pt.y += owspr_zpos_lo[k]; uint8 v3 = owspr_zpos_lo[k] >> 4; uint8 v4 = 41; - if ((R4_ & 0x80) != 0) { + if ((r4 & 0x80) != 0) { v4 = 46; v3 += 8; } - R5_ = v4; - R6_ = v3; - R0_W += kDrawOverworldSpriteShadow_LeftTileXDisp[v3]; - uint8 j = DrawOverworldSpriteShadow_04FE45(kOverworldSpriteOAMIndexes[k], 0x32); - R0_W += kDrawOverworldSpriteShadow_RightTileXDisp[v3]; - DrawOverworldSpriteShadow_04FE45(j, 0x72); + uint8 r5 = v4; + pt.x += kDrawOverworldSpriteShadow_LeftTileXDisp[v3]; + uint8 j = DrawOverworldSpriteShadow_04FE45(kOverworldSpriteOAMIndexes[k], 0x32, pt, r4, r5); + pt.x += kDrawOverworldSpriteShadow_RightTileXDisp[v3]; + DrawOverworldSpriteShadow_04FE45(j, 0x72, pt, r4, r5); } -uint8 DrawOverworldSpriteShadow_04FE45(uint8 j, uint8 a) { // 04fe45 - return OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(j, R5_ | a << 8, __CFSHL__(R4_, 1)); -} - -void AddZPositionToTempYPos(uint8 k) { // 04fe4e - R2_W += owspr_zpos_lo[k]; +uint8 DrawOverworldSpriteShadow_04FE45(uint8 j, uint8 a, PointU16 pt, uint8 r4, uint8 r5) { // 04fe45 + return OWSpr04_PiranhaPlant_GenericOverworldSpriteGFXRt_Entry2(j, r5 | a << 8, __CFSHL__(r4, 1), pt); } uint8 SetOverworldSpriteFrameIndex(uint8 k) { // 04fe5b return kSetOverworldSpriteFrameIndex_DATA_04F833[k] + counter_global_frames; } -void GetOverworldSpriteOnScreenPosition(uint8 k) { // 04fe62 - GetOverworldSpriteOnScreenPosition_Y(k + 16, 2); - bool v1 = R2_ >= owspr_zpos_lo[misc_which_file_to_erase]; - R2_ -= owspr_zpos_lo[misc_which_file_to_erase]; - if (!v1) - --R3_; - GetOverworldSpriteOnScreenPosition_Y(misc_which_file_to_erase, 0); +PointU16 GetOverworldSpriteOnScreenPosition(uint8 k) { // 04fe62 + uint16 r2w = GetOverworldSpriteOnScreenPosition_Y(k + 16, 2); + r2w -= owspr_zpos_lo[misc_which_file_to_erase]; + uint16 r0w = GetOverworldSpriteOnScreenPosition_Y(misc_which_file_to_erase, 0); + return (PointU16) { .x = r0w, .y = r2w }; } -void GetOverworldSpriteOnScreenPosition_Y(uint8 k, uint8 j) { // 04fe7d +uint16 GetOverworldSpriteOnScreenPosition_Y(uint8 k, uint8 j) { // 04fe7d int16 v2; - HIBYTE(v2) = owspr_xpos_hi[k]; LOBYTE(v2) = owspr_xpos_lo[k]; - *(uint16 *)((int8 *)&R0_W + j) = v2 - *(uint16 *)((int8 *)&mirror_current_layer1_xpos + j); + return v2 - *(uint16 *)((int8 *)&mirror_current_layer1_xpos + j); } void UpdateOverworldSpritePosition(uint8 k) { // 04fe90 @@ -2954,73 +2996,76 @@ void UpdateOverworldSpritePosition_X(uint8 k) { // 04feab } uint8 CheckPlayerToOverworldSpriteCollision(uint8 k) { // 04fed7 - CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(k); - bool v1 = R6_W >= 8; - if (R6_W < 8) - v1 = R8_W >= 8; - if (!v1) + OwHvPos pos = CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(k); + bool v1 = pos.r6 >= 8; + if (pos.r6 < 8) + v1 = pos.r8 >= 8; + if (pos.r6 < 8 && !v1) ow_enter_level_flag = k; return v1; } -void CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(uint8 k) { // 04feef +OwHvPos CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(uint8 k) { // 04feef int16 v1; int16 v3; HIBYTE(v1) = owspr_xpos_hi[k]; LOBYTE(v1) = owspr_xpos_lo[k]; int16 v2 = v1 + 8 - get_PointU16(ow_players_pos, player_current_characterx4)->x; - R0_W = v2; + uint16 r0w = v2; + if (v2 < 0) v2 = -v2; - R6_W = v2; HIBYTE(v3) = owspr_ypos_hi[k]; LOBYTE(v3) = owspr_ypos_lo[k]; int16 v4 = v3 + 8 - get_PointU16(ow_players_pos, player_current_characterx4)->y; - R2_W = v4; + uint16 r2w = v4; if (v4 < 0) v4 = -v4; - R8_W = v4; + uint16 r8w = v4; + return (OwHvPos) { .r0 = r0w, .r2 = r2w, .r6 = v2, .r8 = r8w }; } void OWSpr01_Lakitu_CalculateOverworldLakitusSpeed(uint8 k) { // 04ff2e int16 v4; - CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(k); - R6_ >>= 1; - R8_ >>= 1; + OwHvPos pos = CheckPlayerToOverworldSpriteColl_SubOverworldHorizAndVertPos(k); uint8 v1 = owspr_zpos_lo[k] >> 1; - R10_ = v1; - R5_ = 0; + + uint16 arr[3] = { + pos.r6 >> 1, + pos.r8 >> 1, + v1, + }; + + uint8 sign_arr[3] = { pos.r0 >> 8, pos.r2 >> 8, 0 }; + uint8 v2 = 4; - if (v1 < R8_) { + if (v1 < arr[1]) { v2 = 2; - v1 = R8_; + v1 = arr[1]; } - if (v1 < R6_) { + if (v1 < arr[0]) { v2 = 0; - v1 = R6_; + v1 = arr[0]; } if (v1) { - R12_ = v2; + uint8 r12 = v2; + uint8 out_arr[3]; for (uint8 i = 4; (i & 0x80) == 0; i -= 2) { - if (i == R12_) { + if (i == r12) { LOBYTE(v4) = 32; } else { - WriteReg(WRDIVL, 0); - WriteReg(WRDIVH, *(&R6_ + i)); - WriteReg(WRDIVB, *(&R6_ + v2)); - v4 = ReadRegWord(RDDIVL) >> 3; + v4 = SnesDivide(arr[i >> 1] << 8, arr[r12 >> 1]) >> 3; } - if ((*(&R1_ + i) & 0x80) == 0) + if (!(sign_arr[i >> 1] & 0x80)) LOBYTE(v4) = -(int8)v4; - *(&R0_ + i) = v4; + out_arr[i >> 1] = v4; } - uint8 v5 = misc_which_file_to_erase; int v6 = misc_which_file_to_erase; - owspr_xspeed[misc_which_file_to_erase] = R0_; - owspr_yspeed[v6] = R2_; - owspr_zspeed[v5] = R4_; + owspr_xspeed[v6] = out_arr[0]; + owspr_yspeed[v6] = out_arr[1]; + owspr_zspeed[v6] = out_arr[2]; } else { owspr_table0e15[k] = 0; owspr_xspeed[k] = 0; diff --git a/src/smw_05.c b/src/smw_05.c index b919e11..2ed0e4a 100644 --- a/src/smw_05.c +++ b/src/smw_05.c @@ -204,23 +204,137 @@ void (*kProcessLevelEndRoutines_Ptrs05CC0E[4])(void) = { &GiveTimeBonusAndBonusStars_Return, }; +static const uint16 kInitializeMap16Pointers_TilesetMap16Ptrs[15] = { 0x8b70, 0xbc00, 0xc800, 0xd400, 0xe300, 0xe300, 0xc800, 0x8b70, 0xc800, 0xd400, 0xd400, 0xd400, 0x8b70, 0xe300, 0xd400, }; +static const uint8 kLoadLevelHeader_VerticalTable[32] = { 0x0, 0x0, 0x80, 0x1, 0x81, 0x2, 0x82, 0x3, 0x83, 0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, }; +static const uint8 kLoadLevelHeader_LevMainScrnTbl[32] = { 0x15, 0x15, 0x17, 0x15, 0x15, 0x15, 0x17, 0x15, 0x17, 0x15, 0x15, 0x15, 0x15, 0x15, 0x4, 0x4, 0x15, 0x17, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x1, 0x2, }; +static const uint8 kLoadLevelHeader_LevSubScrnTbl[32] = { 0x2, 0x2, 0x0, 0x2, 0x2, 0x2, 0x0, 0x2, 0x0, 0x0, 0x2, 0x0, 0x2, 0x2, 0x13, 0x13, 0x0, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x16, 0x15, }; +static const uint8 kLoadLevelHeader_LevCGADSUBtable[32] = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x20, 0x24, 0x24, 0x20, 0x24, 0x20, 0x70, 0x70, 0x24, 0x24, 0x20, 0xff, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x21, 0x22, }; +static const uint8 kLoadLevelHeader_SpecialLevTable[32] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0xc1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kLoadLevelHeader_LevXYPPCCCTtbl[32] = { 0x20, 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x20, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, }; +static const uint8 kLoadLevelHeader_TimerTable[4] = { 0x0, 0x2, 0x3, 0x4, }; +static const uint8 kLoadLevelHeader_LevelMusicTable[8] = { 0x2, 0x6, 0x1, 0x8, 0x7, 0x3, 0x5, 0x12, }; +static const uint16 kCalculateRowOrColumnOfTilemapToUpdate_PipeMap16Ptrs[4] = { 0x8ab0, 0x84e0, 0x8af0, 0x8b30, }; +static const uint16 kDisplayMessage_DATA_05A580[8] = { 0xa751, 0x8751, 0x6751, 0x4751, 0x2751, 0x751, 0xe750, 0xc750, }; +static const uint8 kDisplayMessage_DATA_05A590[23] = { 0x14, 0x45, 0x3f, 0x8, 0x0, 0x29, 0xaa, 0x27, 0x26, 0x84, 0x95, 0xa9, 0x15, 0x13, 0xce, 0xa7, 0xa4, 0x25, 0xa5, 0x5, 0xa6, 0x2a, 0x28, }; +static const uint16 kDisplayMessage_DATA_05A5A7[25] = { 0x8d, 0x8d, 0x8d, 0x8d, 0x0, 0x291, 0x41d, 0x518, 0x61d, 0x8b7, 0x7b2, 0x30b, 0x83c, 0x99d, 0xa9e, 0x4a0, 0xa2c, 0x6a6, 0x730, 0x911, 0x5a4, 0x38f, 0x109, 0x20a, 0x191, }; +static const uint8 kDisplayMessage_DATA_05B106[2] = { 0x4c, 0x50, }; +static const uint8 kDisplayMessage_DATA_05B108[2] = { 0x50, 0x0, }; +static const uint8 kDisplayMessage_DATA_05B10A[2] = { 0x4, 0xfc, }; +static const uint16 kDisplayMessage_SwitchBlockTileAndProperties[32] = { 0x35ad, 0x75ad, 0xb5ad, 0xf5ad, 0x35a7, 0x75a7, 0x35b7, 0x75b7, 0x37bd, 0x77bd, 0xb7bd, 0xf7bd, 0x37a7, 0x77a7, 0x37b7, 0x77b7, 0x39ad, 0x79ad, 0xb9ad, 0xf9ad, 0x39a7, 0x79a7, 0x39b7, 0x79b7, 0x3bbd, 0x7bbd, 0xbbbd, 0xfbbd, 0x3ba7, 0x7ba7, 0x3bb7, 0x7bb7, }; +static const uint8 kDisplayMessage_SwitchBlockXAndYDisp[16] = { 0x50, 0x4f, 0x58, 0x4f, 0x50, 0x57, 0x58, 0x57, 0x92, 0x4f, 0x9a, 0x4f, 0x92, 0x57, 0x9a, 0x57, }; +const uint8 kBitTable_Bank05[8] = { 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1, }; +// todo: oob read +static const uint8 kLevelTileAnimations_DATA_05B96B[24] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x2, 2, 0, 0, 0, 0, 0, }; +static const uint8 kLevelTileAnimations_DATA_05B97D[14] = { 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x2, 0x0, }; +static const uint8 kLevelTileAnimations_DATA_05B98B[14] = { 0x0, 0x5, 0xa, 0xf, 0x14, 0x14, 0x19, 0x14, 0xa, 0x14, 0x0, 0x5, 0x0, 0x14, }; +static const uint16 kSpr0F3_RegularAutoScroll_DATA_05BFFD[2] = { 0x0, 0x2, }; +static const uint16 kSpr0F3_RegularAutoScroll_MaxXSpeed[2] = { 0x80, 0x100, }; +static const uint8 kScrollLayer3_TideYAcceleration[2] = { 0xff, 0x1, }; +static const uint8 kScrollLayer3_TideMaxYSpeed[2] = { 0xfc, 0x4, }; +static const uint8 kScrollLayer3_TideMaxYPos[2] = { 0x30, 0xa0, }; +static const uint16 kLayer2SpecialScrolling0B_Layer2OnOffControlled_DATA_05C71B[2] = { 0x20, 0xc1, }; +static const uint16 kLayer2SpecialScrolling0B_Layer2OnOffControlled_DATA_05C71F[2] = { 0xffc0, 0x40, }; +static const uint16 kLayer2SpecialScrolling0B_Layer2OnOffControlled_DATA_05C723[2] = { 0xffff, 0x1, }; +static const uint16 kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C7F0[6] = { 0x0, 0x2f0, 0x8b0, 0x0, 0x0, 0x370, }; +static const uint16 kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C7FC[6] = { 0xd0, 0x350, 0xa30, 0x8, 0x40, 0x380, }; +static const uint8 kSpr0F5_Layer2ScrollWhenTouched_DATA_05C808[3] = { 0x0, 0x6, 0x8, }; +static const uint8 kSpr0F5_Layer2ScrollWhenTouched_DATA_05C80B[3] = { 0x3, 0x1, 0x2, }; +static const uint16 kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C80E[1] = { 0xc0, }; +static const uint16 kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C810[2] = { 0x0, 0xb0, }; +static const uint16 kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C814[2] = { 0xff80, 0xc0, }; +static const uint16 kLayer2SpecialScrolling0E_Layer2ScrollWhenTouched_DATA_05C818[2] = { 0xffff, 0x1, }; +static const uint16 kLayer2SpecialScrolling02_Layer2Smash_DATA_05C880[18] = { 0x0, 0x1c0, 0x300, 0x800, 0x838, 0xa00, 0x0, 0x380, 0x450, 0x890, 0x960, 0xe80, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x0, }; +static const uint16 kLayer2SpecialScrolling02_Layer2Smash_DATA_05C8A4[18] = { 0x8, 0x300, 0x410, 0x838, 0x870, 0xb00, 0x8, 0x450, 0x4a0, 0x960, 0xa40, 0xfff, 0x5000, 0x5000, 0x5000, 0x5000, 0x5000, 0x80, }; +static const uint16 kLayer2SpecialScrolling02_Layer2Smash_DATA_05C8C8[27] = { 0xc0, 0xb0, 0x70, 0xc0, 0xc0, 0xc0, 0x0, 0x0, 0xc0, 0xb0, 0xa0, 0x70, 0xb0, 0xb0, 0xb0, 0x0, 0x0, 0xb0, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x0, 0x0, 0x10, }; +static const uint16 kLayer2SpecialScrolling02_Layer2Smash_DATA_05C8FE[27] = { 0x100, 0x100, 0x800, 0x100, 0x100, 0x800, 0x0, 0x0, 0x180, 0xff00, 0xff00, 0x0, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xf800, 0xf800, 0xf800, 0xf800, 0xf800, 0xf800, 0x0, 0x0, 0xfe40, }; +static const uint8 kLayer2SpecialScrolling02_Layer2Smash_DATA_05C934[27] = { 0x80, 0x40, 0x1, 0x80, 0x0, 0x0, 0x80, 0x0, 0x40, 0x0, 0x0, 0x20, 0x40, 0x0, 0x20, 0x0, 0x0, 0x20, 0x80, 0x80, 0x20, 0x80, 0x80, 0x20, 0x0, 0x0, 0xa0, }; +static const uint8 kSpr0E9_Layer2Smash_DATA_05C94F[3] = { 0x0, 0xc, 0x18, }; +static const uint8 kSpr0E9_Layer2Smash_DATA_05C952[3] = { 0x5, 0x5, 0x5, }; +static const uint8 kSpr0E7_SpecialAutoScroll_L1AndL2ScrollID[10] = { 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x0, 0x1, 0x9, }; +static const uint8 kSpr0E7_SpecialAutoScroll_L1AndL2ScrollTypeIndex[10] = { 0x1, 0x0, 0x2, 0x0, 0x4, 0x3, 0x5, 0x0, 0x6, 0x0, }; +static const uint16 kMostlyUnusedScrollSpriteRoutine_UNK_05C9E5[17] = { 0x100, 0x0, 0x0, 0x202, 0x2, 0x502, 0x202, 0x5, 0x200, 0x1, 0x203, 0x403, 0x103, 0x100, 0x0, 0x3, 0x0, }; +static const uint16 kSpr0EB_UnusedSprite_DATA_05CA08[2] = { 0x400, 0x400, }; +static const uint16 kSpr0EB_UnusedSprite_DATA_05CA0C[2] = { 0x0, 0x100, }; +static const uint16 kSpr0EB_UnusedSprite_DATA_05CA10[3] = { 0x100, 0x140, 0xe0, }; +static const uint16 kSpr0F1_UnusedSprite_DATA_05CA16[4] = { 0x5, 0x500, 0x205, 0x502, }; +static const uint16 kSpr0F1_UnusedSprite_DATA_05CA1E[4] = { 0x0, 0x100, 0x302, 0x304, }; +static const uint16 kSpr0F1_UnusedSprite_DATA_05CA26[12] = { 0x1, 0x101, 0x600, 0x600, 0x0, 0x100, 0x100, 0x8, 0x800, 0x0, 0x100, 0x1, }; +static const uint16 kSpr0EF_Layer2ScrollSOrL_DATA_05CA3E[2] = { 0x800, 0x800, }; +static const uint16 kSpr0EF_Layer2ScrollSOrL_DATA_05CA42[2] = { 0x0, 0x100, }; +static const uint16 kSpr0EF_Layer2ScrollSOrL_DATA_05CA46[1] = { 0x101, }; +static const uint16 kSpr0EA_Layer2Scroll_DATA_05CA48[5] = { 0x300, 0x300, 0x300, 0x300, 0x300, }; +static const uint16 kSpr0EA_Layer2Scroll_DATA_05CA52[5] = { 0x0, 0x100, 0x200, 0x300, 0x400, }; +static const uint16 kSpr0EA_Layer2Scroll_DirectionToStartMoving[2] = { 0x1, 0x0, }; +static const uint8 kSpr0E7_SpecialAutoScroll_DATA_05CA61[7] = { 0x1, 0x18, 0x1e, 0x29, 0x2d, 0x35, 0x47, }; +static const uint8 kSpr0E7_SpecialAutoScroll_DATA_05CA68[7] = { 0x16, 0x5, 0xa, 0x3, 0x7, 0x11, 0x9, }; +static const uint8 kLayer1SpecialScrolling01_VariableScroll_DATA_05CA6F[80] = { 0x0, 0x9, 0x14, 0x1c, 0x24, 0x28, 0x33, 0x3c, 0x43, 0x4b, 0x54, 0x60, 0x67, 0x74, 0x77, 0x7b, 0x83, 0x8a, 0x8d, 0x90, 0x99, 0xa0, 0xb0, 0x0, 0x9, 0x14, 0x2c, 0x3c, 0xb0, 0x0, 0x9, 0x11, 0x1d, 0x2c, 0x32, 0x41, 0x48, 0x63, 0x6b, 0x70, 0x0, 0x27, 0x37, 0x70, 0x0, 0x7, 0x12, 0x27, 0x32, 0x48, 0x5b, 0x70, 0x0, 0x20, 0x28, 0x3a, 0x40, 0x5f, 0x66, 0x6b, 0x6b, 0x80, 0x80, 0x89, 0x92, 0x96, 0x9a, 0x9e, 0xa0, 0xb0, 0x0, 0x10, 0x1a, 0x20, 0x2b, 0x30, 0x3b, 0x40, 0x4b, 0x50, }; +static const uint8 kLayer1SpecialScrolling01_VariableScroll_DATA_05CABF[80] = { 0xc, 0xc, 0x6, 0xb, 0x8, 0xc, 0x3, 0x2, 0x9, 0x3, 0x9, 0x2, 0x6, 0x6, 0x7, 0x5, 0x8, 0x5, 0xa, 0x4, 0x8, 0x4, 0x4, 0xc, 0xc, 0x7, 0x7, 0x5, 0x5, 0xc, 0xc, 0x8, 0xc, 0xc, 0x7, 0x7, 0xa, 0xa, 0xc, 0xc, 0x0, 0x0, 0xa, 0xa, 0x0, 0x0, 0x9, 0x9, 0x3, 0x3, 0xc, 0xc, 0xc, 0xc, 0x8, 0x8, 0x5, 0x5, 0x2, 0x2, 0x9, 0x9, 0x1, 0x1, 0x1, 0x2, 0x3, 0x7, 0x8, 0x8, 0xc, 0xc, 0x2, 0x2, 0xa, 0xa, 0x2, 0x2, 0xa, 0xa, }; +static const uint8 kLayer1SpecialScrolling01_VariableScroll_DATA_05CB0F[80] = { 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x10, 0x8, 0x40, 0x8, 0x4, 0x8, 0x10, 0x8, 0x8, 0x10, 0x10, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, }; +static const uint8 kLayer1SpecialScrolling01_VariableScroll_DATA_05CB5F[28] = { 0x1, 0x0, 0xff, 0xff, 0x1, 0x0, 0xff, 0xff, 0x1, 0x0, 0xff, 0xff, 0x1, 0x0, 0xff, 0xff, 0x1, 0x0, 0xff, 0xff, 0x1, 0x0, 0xff, 0xff, 0x1, 0x0, 0xff, 0xff, }; +static const uint16 kUnusedScrollSpriteRoutine_DATA_05CB7B[16] = { 0x1, 0xffff, 0x1, 0xffff, 0x1, 0xffff, 0x1, 0xffff, 0x1, 0xffff, 0x1, 0xffff, 0x1, 0xffff, 0x4, 0xfffc, }; +static const uint16 kLayer2SpecialScrolling04_Unused_DATA_05CB9B[4] = { 0x1, 0xffff, 0x1, 0xffff, }; +static const uint16 kLayer2SpecialScrolling0A_Unused_DATA_05CBA3[12] = { 0x4, 0xfffc, 0x4, 0xfffc, 0x4, 0xfffc, 0x4, 0xfffc, 0x1, 0xffff, 0x1, 0xffff, }; +static const uint16 kScrollLayer3_DATA_05CBBB[2] = { 0x4, 0xfffc, }; +static const uint16 kSharedScrollSpriteTables_DATA_05CBC3[2] = { 0x1, 0xffff, }; +static const uint8 kSharedScrollSpriteTables_UNK_05CBC7[28] = { 0x30, 0x70, 0x80, 0x10, 0x28, 0x30, 0x30, 0x30, 0x30, 0x14, 0x2, 0x30, 0x30, 0x30, 0x30, 0x70, 0x80, 0x70, 0x80, 0x70, 0x80, 0x70, 0x80, 0x70, 0x80, 0x70, 0x80, 0x18, }; +static const uint8 kLayer2SpecialScrolling04_Unused_DATA_05CBE3[2] = { 0x18, 0x18, }; +static const uint8 kLayer2SpecialScrolling0A_Unused_DATA_05CBE5[6] = { 0x18, 0x18, 0x8, 0x20, 0x6, 0x6, }; +static const uint8 kScrollLayer3_DATA_05CBEB[2] = { 0x4, 0x4, }; +static const uint8 kSharedScrollSpriteTables_DATA_05CBED[4] = { 0x60, 0x42, 0xd0, 0xb2, }; +static const uint8 kSharedScrollSpriteTables_DATA_05CBF1[4] = { 0x80, 0x80, 0x80, 0x80, }; +static const uint8 kSharedScrollSpriteTables_DATA_05CBF5[10] = { 0x90, 0x72, 0x60, 0x42, 0x20, 0x10, 0x40, 0x22, 0x20, 0x10, }; + +// todo: oob +static const uint8 kCourseClearText[76] = { 0x51, 0xd, 0x0, 0x9, 0x30, 0x28, 0x31, 0x28, 0x32, 0x28, 0x33, 0x28, 0x34, 0x28, 0x51, 0x49, 0x0, 0x19, 0xc, 0x38, 0x18, 0x38, 0x1e, 0x38, 0x1b, 0x38, 0x1c, 0x38, 0xe, 0x38, 0xfc, 0x38, 0xc, 0x38, 0x15, 0x38, 0xe, 0x38, 0xa, 0x38, 0x1b, 0x38, 0x28, 0x38, 0x51, 0xa9, 0x0, 0x19, 0x76, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x26, 0x38, 0x5, 0x38, 0x0, 0x38, 0x77, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xff, 0x40 }; + +static const uint8 kCourseClearText_Luigi[5] = { 0x40, 0x41, 0x42, 0x43, 0x44, }; +static const uint8 kGotBonusStarsText_Bonus[35] = { 0x52, 0xa, 0x0, 0x15, 0xb, 0x38, 0x18, 0x38, 0x17, 0x38, 0x1e, 0x38, 0x1c, 0x38, 0x28, 0x38, 0xfc, 0x38, 0x64, 0x28, 0x26, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x51, 0xf3, 0x0, 0x3, 0xfc, 0x38, 0xfc, 0x38, 0xff, }; +static const uint8 kDisplayCourseClearTextBonusStars_DATA_05CD62[20] = { 0xb7, 0xc3, 0xb8, 0xb9, 0xba, 0xbb, 0xba, 0xbf, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc3, 0xc1, 0xb9, 0xc2, 0xc4, 0xb7, 0xc5, }; +static const uint16 kAdjustTimeBonusDisplay_DATA_05CDE9[10] = { 0x0, 0x2710, 0x0, 0x3e8, 0x0, 0x64, 0x0, 0xa, 0x0, 0x1, }; +static const uint16 kCalculateTimeBonusDigits_DATA_05CE3A[4] = { 0x0, 0x64, 0xc8, 0x12c, }; +static const uint8 kCalculateTimeBonusDigits_DATA_05CE42[10] = { 0x0, 0xa, 0x14, 0x1e, 0x28, 0x32, 0x3c, 0x46, 0x50, 0x5a, }; +static const uint8 kNoBonusStarsText_Stars[32] = { 0x51, 0xb1, 0x0, 0x9, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0xfc, 0x38, 0x0, 0x38, 0x51, 0xf3, 0x0, 0x3, 0xfc, 0x38, 0xfc, 0x38, 0x52, 0x13, 0x0, 0x3, 0xfc, 0x38, 0xfc, 0x38, 0xff, 10 }; +static const uint8 kGiveTimeBonusAndBonusStars_DATA_05CEC2[4] = { 0xa, 0x0, 0x64, 0x0, }; +static const uint8 kGiveTimeBonusAndBonusStars_DATA_05CEC6[4] = { 0x1, 0x0, 0xa, 0x0, }; +static const uint8 kSpecifySublevelToLoad_DATA_05D708[4] = { 0x0, 0x60, 0xc0, 0x0, }; +static const uint8 kSpecifySublevelToLoad_DATA_05D70C[4] = { 0x60, 0x90, 0xc0, 0x0, }; +static const uint8 kSpecifySublevelToLoad_L2VertScrollSettings[8] = { 0x3, 0x1, 0x1, 0x0, 0x0, 0x2, 0x2, 0x1, }; +static const uint8 kSpecifySublevelToLoad_L2HorzScrollSettings[8] = { 0x2, 0x2, 0x1, 0x0, 0x1, 0x2, 0x1, 0x0, }; +static const uint8 kSpecifySublevelToLoad_DATA_05D730[16] = { 0x0, 0x30, 0x60, 0x80, 0xa0, 0xb0, 0xc0, 0xe0, 0x10, 0x30, 0x50, 0x60, 0x70, 0x90, 0x0, 0x0, }; +static const uint8 kSpecifySublevelToLoad_DATA_05D740[16] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, }; +static const uint8 kSpecifySublevelToLoad_DATA_05D750[8] = { 0x10, 0x80, 0x0, 0xe0, 0x10, 0x70, 0x0, 0xe0, }; +static const uint8 kSpecifySublevelToLoad_DATA_05D758[8] = { 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, }; +static const uint8 kSpecifySublevelToLoad_LevelEntranceTileset[6] = { 0x5, 0x1, 0x2, 0x6, 0x8, 0x1, }; +static const uint8 kSpecifySublevelToLoad_LevelEntranceLayer3[6] = { 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kSpecifySublevelToLoad_LevelEntranceYPos[6] = { 0x70, 0x70, 0x60, 0x70, 0x70, 0x70, }; +static const uint16 kSpecifySublevelToLoad_Layer1Ptrs[9] = { 0xec24, 0xec7e, 0xec7e, 0xe985, 0xe9fb, 0xeab0, 0xeb0b, 0xeb72, 0xebbe, }; +static const uint16 kSpecifySublevelToLoad_SpritePtrs[9] = { 0xd899, 0xd8a1, 0xd8a1, 0xd7e5, 0xd7ea, 0xd825, 0xd84b, 0xd86e, 0xd888, }; +static const uint16 kSpecifySublevelToLoad_Layer2Ptrs[9] = { 0xdf59, 0xdf59, 0xdf59, 0xdf59, 0xdf59, 0xdf59, 0xdf59, 0xdf59, 0xdf59, }; +static const uint8 kSpecifySublevelToLoad_BonusLevelSublevelsLo[3] = { 0x0, 0xc8, 0x0, }; +static const uint8 kLoadOverworldLifeCounter_DATA_05DBC9[9] = { 0x50, 0x88, 0x0, 0x3, 0xfe, 0x38, 0xfe, 0x38, 0xff, }; + +static const uint16 kLevelDataLayoutTables_Layer1LoPtrs[32] = { 0xbad8, 0xbad8, 0xbad8, 0xbb38, 0xbb38, 0xbb92, 0xbb92, 0xbbec, 0xbbec, 0x0, 0xbbec, 0x0, 0xbad8, 0xbbec, 0xbad8, 0xbad8, 0x0, 0xbad8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbad8, 0xbad8, }; +static const uint16 kLevelDataLayoutTables_Layer2LoPtrs[32] = { 0xbb08, 0xbb08, 0xbb08, 0xbb62, 0xbb62, 0xbbc2, 0xbbc2, 0xbc16, 0xbc16, 0x0, 0xbc16, 0x0, 0xbb08, 0xbc16, 0xbb08, 0xbb08, 0x0, 0xbb08, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbb08, 0xbb08, }; +static const uint16 kLevelDataLayoutTables_Layer1HiPtrs[32] = { 0xbc40, 0xbc40, 0xbc40, 0xbca0, 0xbca0, 0xbcfa, 0xbcfa, 0xbd54, 0xbd54, 0x0, 0xbd54, 0x0, 0xbc40, 0xbd54, 0xbc40, 0xbc40, 0x0, 0xbc40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbc40, 0xbc40, }; +static const uint16 kLevelDataLayoutTables_Layer2HiPtrs[32] = { 0xbc70, 0xbc70, 0xbc70, 0xbcca, 0xbcca, 0xbd2a, 0xbd2a, 0xbd7e, 0xbd7e, 0x0, 0xbd7e, 0x0, 0xbc70, 0xbd7e, 0xbc70, 0xbc70, 0x0, 0xbc70, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbc70, 0xbc70, }; + + void LoadSublevel() { // 05801e for (uint16 i = 0; i != 512; ++i) { blocks_layer2_tiles_lo[i] = 37; blocks_layer2_tiles_lo[i + 512] = 37; } blocks_screen_to_place_current_object = 0; - if (ptr_layer2_data_bank == 0xFF) { - bool v1 = ptr_layer2_data >= 0xE8FE; + if (ptr_layer2_data.bank == 0xFF) { + bool v1 = ptr_layer2_data.addr >= 0xE8FE; for (uint16 j = 0; j != 512; ++j) { blocks_layer2_tiles_hi[j] = v1; blocks_layer2_tiles_hi[j + 512] = v1; } - ptr_layer2_data_bank = 12; + ptr_layer2_data.bank = 12; unusedram_copy_of_level_tileset_setting = 0; misc_level_tileset_setting = 0; - *(uint16 *)&R13_ = 0xb900; - BufferBGTilemap(); + BufferBGTilemap(g_ram + 0xb900); } for (uint16 k = 0; k != 512; k++) { InitializeLevelData_Hi(k, 0); @@ -247,7 +361,7 @@ void InitializeLevelLayer1And2Tilemaps() { // 05809e ++camera_layer1_row_column_to_update_right_down; ++camera_layer2_row_column_to_update_right_down; uint16 v0 = 614; - R0_W = 7; + uint16 R0_W = 7; uint16 v1 = kCalculateRowOrColumnOfTilemapToUpdate_PipeMap16Ptrs[(camera_layer1_row_column_to_update_right_down >> 4) & 3]; do { pointer_map16_tiles[v0 >> 1] = v1; @@ -257,47 +371,43 @@ void InitializeLevelLayer1And2Tilemaps() { // 05809e ++blocks_screen_to_place_current_object; } while (blocks_screen_to_place_current_object != 32); uint8 v2 = mirror_main_screen_layers; - WriteReg(TM, mirror_main_screen_layers); - WriteReg(TMW, v2); + RtlPpuWrite(TM, mirror_main_screen_layers); + RtlPpuWrite(TMW, v2); uint8 v3 = mirror_sub_screen_layers; - WriteReg(TS, mirror_sub_screen_layers); - WriteReg(TSW, v3); + RtlPpuWrite(TS, mirror_sub_screen_layers); + RtlPpuWrite(TSW, v3); camera_xy_layer1_vramupd_left_up = -1; camera_xy_layer1_vramupd_right_down = -1; camera_xy_layer2_vramupd_left_up = -1; camera_xy_layer2_vramupd_right_down = -1; } -void BufferBGTilemap() { // 058126 - *(uint16 *)&R3_ = 0; - *(uint16 *)&R5_ = 0; - R15_ = 126; +void BufferBGTilemap(uint8 *r13) { // 058126 + uint8 *p = IndirPtr(&ptr_layer2_data, 0); + uint16 R3 = 0; + uint16 R5_W = 0; do { - int16 v0 = *(uint16 *)&R3_; - R7_ = *IndirPtr(&ptr_layer2_data, *(uint16 *)&R3_); + int16 v0 = R3; + uint8 r7 = p[R3]; uint16 v1 = v0 + 1; - *(uint16 *)&R3_ = v1; - if ((R7_ & 0x80) == 0) { + R3 = v1; + if ((r7 & 0x80) == 0) { do { - int16 v4 = *(uint16 *)&R3_; - uint8 v5 = *IndirPtr(&ptr_layer2_data, *(uint16 *)&R3_); - *(uint16 *)&R3_ = v4 + 1; - int16 v6 = *(uint16 *)&R5_; - IndirWriteByte(&R13_, *(uint16 *)&R5_, v5); - *(uint16 *)&R5_ = v6 + 1; - } while ((--R7_ & 0x80) == 0); + uint8 v5 = p[R3++]; + r13[R5_W++] = v5; + } while ((--r7 & 0x80) == 0); } else { - R7_ &= ~0x80; - uint8 v2 = *IndirPtr(&ptr_layer2_data, v1); - *(uint16 *)&R3_ = v1 + 1; - uint16 v3 = *(uint16 *)&R5_; + r7 &= ~0x80; + uint8 v2 = p[v1]; + R3 = v1 + 1; + uint16 v3 = R5_W; do { - IndirWriteByte(&R13_, v3++, v2); - } while ((--R7_ & 0x80) == 0); - *(uint16 *)&R5_ = v3; + r13[v3++] = v2; + } while ((--r7 & 0x80) == 0); + R5_W = v3; } - } while (*IndirPtr(&ptr_layer2_data, *(uint16 *)&R3_) != 0xFF || *IndirPtr(&ptr_layer2_data, (*(uint16 *)&R3_) + 1) != 0xFF); - R0_W = 0x9100; + } while (p[R3] != 0xFF || p[R3 + 1] != 0xFF); + uint16 R0_W = 0x9100; for (uint16 i = 0; i != 0x400; i += 2) { pointer_map16_tiles[i >> 1] = R0_W; R0_W += 8; @@ -305,24 +415,23 @@ void BufferBGTilemap() { // 058126 } void InitializeMap16Pointers() { // 0581fb - R15_ = 5; - ptr_slope_steepness_bank = 0; + ptr_slope_steepness.bank = 0; blocks_lowest_number_solid_map16_tile_for_sprites = -60; blocks_highest_number_solid_map16_tile_for_sprites = -54; - ptr_slope_steepness = 0xe55e; - R0_W = kInitializeMap16Pointers_TilesetMap16Ptrs[misc_level_tileset_setting]; - R2_W = 0x8000; - *(uint16 *)&R13_ = 0x81bb; - R4_W = 0; - *(uint16 *)&R9_ = 0; - *(uint16 *)&R11_ = 0; + ptr_slope_steepness.addr = 0xe55e; + uint16 R0_W = kInitializeMap16Pointers_TilesetMap16Ptrs[misc_level_tileset_setting]; + uint16 R2_W = 0x8000; + LongPtr r13 = LONGPTR(0x581bb); +// R4_W = 0; +// R9_ = 0; + uint8 r11 = 0; uint16 v0 = 0; uint16 v1 = 0; do { - R12_ = *IndirPtr(&R13_, v0); + uint16 r12 = *IndirPtr(&r13, v0); do { - bool v2 = __CFSHL__(R12_, 1); - R12_ *= 2; + bool v2 = __CFSHL__(r12, 1); + r12 *= 2; if (v2) { pointer_map16_tiles[v1 >> 1] = R2_W; R2_W += 8; @@ -331,15 +440,15 @@ void InitializeMap16Pointers() { // 0581fb R0_W += 8; } v1 += 2; - ++R9_; - } while (++R11_ != 8); - R11_ = 0; +// ++R9_; + } while (++r11 != 8); + r11 = 0; ++v0; } while (v0 != 64); if (!misc_level_tileset_setting || misc_level_tileset_setting == 7) { blocks_lowest_number_solid_map16_tile_for_sprites = -1; blocks_highest_number_solid_map16_tile_for_sprites = -1; - ptr_slope_steepness = 0xe5c8; + ptr_slope_steepness.addr = 0xe5c8; uint16 v3 = 904; R0_W = 0x8a70; for (int16 i = 3; i >= 0; --i) { @@ -427,7 +536,7 @@ void BeginLoadingLevelData() { // 0583ac LoadLevelHeader(); InitializeMap16Pointers(); while (misc_level_mode_setting != 9 && misc_level_mode_setting != 11 && misc_level_mode_setting != 16) { - if (*IndirPtr(&temp65, 0) != 0xFF) + if (*IndirPtr(&ptr_layer1_data, 0) != 0xFF) LoadLevelDataObject(); if (misc_level_mode_setting == 0 || misc_level_mode_setting == 10 || misc_level_mode_setting == 12 || misc_level_mode_setting == 13 || misc_level_mode_setting == 14 || misc_level_mode_setting == 17 || misc_level_mode_setting == 30) @@ -435,18 +544,19 @@ void BeginLoadingLevelData() { // 0583ac LOBYTE(misc_current_layer_being_processed) = misc_current_layer_being_processed + 1; if ((uint8)misc_current_layer_being_processed == 2) break; - WORD(temp65) = WORD(ptr_layer2_data) + 5; - temp67 = ptr_layer2_data_bank; + ptr_layer1_data.addr = ptr_layer2_data.addr + 5; + ptr_layer1_data.bank = ptr_layer2_data.bank; blocks_screen_to_place_current_object = 0; } LOBYTE(misc_current_layer_being_processed) = 0; } void LoadLevelHeader() { // 0584e3 - uint8 v0 = *IndirPtr(&temp65, 0); + uint8 *hdr = IndirPtr(&ptr_layer1_data, 0); + uint8 v0 = hdr[0]; misc_screens_in_lvl = (v0 & 0x1F) + 1; misc_bgpalette_setting = v0 >> 5; - misc_level_mode_setting = *IndirPtr(&temp65, 1) & 0x1F; + misc_level_mode_setting = hdr[1] & 0x1F; sprites_tile_priority = kLoadLevelHeader_LevXYPPCCCTtbl[misc_level_mode_setting]; mirror_main_screen_layers = kLoadLevelHeader_LevMainScrnTbl[misc_level_mode_setting]; mirror_sub_screen_layers = kLoadLevelHeader_LevSubScrnTbl[misc_level_mode_setting]; @@ -461,91 +571,83 @@ void LoadLevelHeader() { // 0584e3 } camera_last_screen_horiz = v1; camera_last_screen_vert = v2; - misc_background_color_setting = *IndirPtr(&temp65, 1) >> 5; - R0_ = *IndirPtr(&temp65, 2); - graphics_level_sprite_graphics_setting = R0_ & 0xF; - uint8 v3 = kLoadLevelHeader_LevelMusicTable[(R0_ >> 4) & 7]; + misc_background_color_setting = hdr[1] >> 5; + uint8 r0 = hdr[2]; + graphics_level_sprite_graphics_setting = r0 & 0xF; + uint8 v3 = kLoadLevelHeader_LevelMusicTable[(r0 >> 4) & 7]; if ((misc_music_register_backup & 0x80) != 0) v3 |= 0x80; if (v3 == misc_music_register_backup) v3 |= 0x40; misc_music_register_backup = v3; - mirror_bgmode_and_tile_size_setting = ((uint8)(R0_ & 0x80) >> 4) | 1; - R0_ = *IndirPtr(&temp65, 3); + mirror_bgmode_and_tile_size_setting = ((uint8)(r0 & 0x80) >> 4) | 1; + r0 = hdr[3]; if (!counter_sublevels_entered) { - counter_timer_hundreds = kLoadLevelHeader_TimerTable[R0_ >> 6]; + counter_timer_hundreds = kLoadLevelHeader_TimerTable[r0 >> 6]; counter_timer_tens = 0; counter_timer_ones = 0; } - misc_fgpalette_setting = R0_ & 7; - misc_sprite_palette_setting = (uint8)(R0_ & 0x38) >> 3; - misc_level_tileset_setting = *IndirPtr(&temp65, 4) & 0xF; + misc_fgpalette_setting = r0 & 7; + misc_sprite_palette_setting = (uint8)(r0 & 0x38) >> 3; + misc_level_tileset_setting = hdr[4] & 0xF; unusedram_copy_of_level_tileset_setting = misc_level_tileset_setting; - int8 v4 = *IndirPtr(&temp65, 4) & 0xC0; + int8 v4 = hdr[4] & 0xC0; misc_item_memory_setting = 2 * (4 * v4 + __CFSHL__(v4, 1)) + __CFSHL__(2 * v4, 1); - uint8 v5 = (uint8)(*IndirPtr(&temp65, 4) & 0x30) >> 4; + uint8 v5 = (uint8)(hdr[4] & 0x30) >> 4; if (v5 == 3) { flag_layer1_horiz_scroll_level_setting = 0; v5 = 0; } flag_layer1_vert_scroll_level_setting = v5; - WORD(temp65) += 5; -} - -void LoadLevelDataObject_0585D8() { // 0585d8 - if (__PAIR16__(blocks_object_number, blocks_size_or_type) >= 2) { - R0_ = R10_ & 0xF; - R1_ = R11_ & 0xF; - R10_ = R11_ & 0xF | R10_ & 0xF0; - R11_ = R0_ | R11_ & 0xF0; - } + ptr_layer1_data.addr += 5; } void LoadLevelDataObject() { // 0585ff do { - R10_ = *IndirPtr(&temp65, 0); - R11_ = *IndirPtr(&temp65, 1); - blocks_size_or_type = *IndirPtr(&temp65, 2); - - WORD(temp65) += 3; - blocks_object_number = (R11_ >> 4) | ((uint8)(R10_ & 0x60) >> 1); + uint8 *hdr = IndirPtr(&ptr_layer1_data, 0); + uint8 r10 = hdr[0]; + uint8 r11 = hdr[1]; + blocks_size_or_type = hdr[2]; + ptr_layer1_data.addr += 3; + + blocks_object_number = (r11 >> 4) | ((uint8)(r10 & 0x60) >> 1); int8 v1 = misc_level_layout_flags; if ((uint8)misc_current_layer_being_processed) v1 = misc_level_layout_flags >> 1; - if ((v1 & 1) != 0) - LoadLevelDataObject_0585D8(); - blocks_sub_scr_pos = 16 * (R10_ & 0xF); - blocks_sub_scr_pos |= R11_ & 0xF; + if ((v1 & 1) != 0) { + if (__PAIR16__(blocks_object_number, blocks_size_or_type) >= 2) { + uint8 r0 = r10 & 0xF; + r10 = r11 & 0xF | r10 & 0xF0; + r11 = r0 | r11 & 0xF0; + } + } + blocks_sub_scr_pos = 16 * (r10 & 0xF); + blocks_sub_scr_pos |= r11 & 0xF; int v2 = misc_current_layer_being_processed; - R3_W = kLevelDataLayoutTables_LoTablePtrs[v2]; - R6_W = kLevelDataLayoutTables_HiTablePtrs[v2]; uint8 v3 = 2 * (misc_level_mode_setting & 0x1F); - R5_ = 0; - R8_ = 0; - R0_ = *IndirPtr(&R3_, v3); - R13_ = *IndirPtr(&R6_, v3++); - R1_ = *IndirPtr(&R3_, v3); - R14_ = *IndirPtr(&R6_, v3); - R2_ = 0; - R15_ = 0; - blocks_screen_to_place_current_object += __CFSHL__(R10_ & 0x80, 1) + 2 * (R10_ & 0x80); + + const uint8 *r3 = RomPtr_00(kLevelDataLayoutTables_LoTablePtrs[v2]); + const uint8 *r6 = RomPtr_00(kLevelDataLayoutTables_HiTablePtrs[v2]); + + const uint8 *r0 = RomPtr_00(WORD(r3[v3])); + const uint8 *r13 = RomPtr_00(WORD(r6[v3])); + + blocks_screen_to_place_current_object += __CFSHL__(r10 & 0x80, 1); blocks_screen_to_place_next_object = blocks_screen_to_place_current_object; uint8 v4 = 3 * blocks_screen_to_place_current_object; - LOBYTE(ptr_lo_map16_data) = *IndirPtr(&R0_, v4); - LOBYTE(ptr_hi_map16_data) = *IndirPtr(&R13_, v4++); - HIBYTE(ptr_lo_map16_data) = *IndirPtr(&R0_, v4); - HIBYTE(ptr_hi_map16_data) = *IndirPtr(&R13_, v4++); - ptr_lo_map16_data_bank = *IndirPtr(&R0_, v4); - ptr_hi_map16_data_bank = *IndirPtr(&R13_, v4); - if ((R10_ & 0x10) != 0) { + ptr_lo_map16_data = *(LongPtr *)(r0 + v4); + ptr_hi_map16_data = *(LongPtr *)(r13 + v4); + if ((r10 & 0x10) != 0) { ++HIBYTE(ptr_lo_map16_data); ++HIBYTE(ptr_hi_map16_data); } + loadlvl_R10 = r10; + loadlvl_R11 = r11; if (blocks_object_number) ProcessStandardAndTilesetSpecificObjects(); else ProcessExtendedObjects(); - } while (*IndirPtr(&temp65, 0) != 0xFF); + } while (*IndirPtr(&ptr_layer1_data, 0) != 0xFF); } void CheckIfLevelTilemapsNeedScrollUpdate() { // 0586f1 @@ -596,7 +698,7 @@ void CalculateRowOrColumnOfTilemapToUpdate() { // 05877e camera_layer1_row_column_to_update_right_down = (mirror_current_layer1_xpos >> 4) + 23; uint16 v0 = (*((uint8 *)&camera_layer1_row_column_to_update_left_up + camera_layer1_scrolling_direction) >> 3) & 6; uint16 v1 = 614; - R0_W = 7; + uint16 R0_W = 7; uint16 v2 = kCalculateRowOrColumnOfTilemapToUpdate_PipeMap16Ptrs[v0 >> 1]; do { pointer_map16_tiles[v1 >> 1] = v2; @@ -630,47 +732,33 @@ void BufferScrollingTiles_Layer2_Init() { // 058955 } void BufferScrollingTiles_Layer1() { // 0589ce - uint16 v0; - - v0 = 2 * misc_level_mode_setting; - R10_ = *((uint8 *)kLevelDataLayoutTables_Layer1LoPtrs + v0); - R11_ = *((uint8 *)kLevelDataLayoutTables_Layer1LoPtrs + v0 + 1); - R13_ = *((uint8 *)kLevelDataLayoutTables_Layer1HiPtrs + v0); - R14_ = *((uint8 *)kLevelDataLayoutTables_Layer1HiPtrs + v0 + 1); - R12_ = 0; - R15_ = 0; - LOBYTE(v0) = camera_layer1_scrolling_direction; + const uint8 *r10 = RomPtr_00(kLevelDataLayoutTables_Layer1LoPtrs[misc_level_mode_setting]); + const uint8 *r13 = RomPtr_00(kLevelDataLayoutTables_Layer1HiPtrs[misc_level_mode_setting]); + + uint16 v0 = camera_layer1_scrolling_direction; HIBYTE(blocks_layer1_vramupload_address) = 2 * (*((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0xF); int8 v1 = 32; if ((*((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0x10) != 0) v1 = 36; LOBYTE(blocks_layer1_vramupload_address) = v1; - R0_W = (uint16)(*(uint16 *)((int8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0x1F0) >> 4; - uint16 v2 = 3 * R0_W; - ptr_lo_map16_data = *(uint16 *)IndirPtr(&R10_W, v2); - ptr_hi_map16_data = *(uint16 *)IndirPtr(&R13_, v2); - v2 += 2; - ptr_lo_map16_data_bank = *IndirPtr(&R10_, v2); - ptr_hi_map16_data_bank = *IndirPtr(&R13_, v2); - uint8 v3 = 13; - if (!sign8(misc_level_tileset_setting - 16)) - v3 = 5; - R12_ = v3; - R8_W = *((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0xF; + uint16 R0_W = (uint16)(*(uint16 *)((int8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0x1F0) >> 4; + const uint8 *plo = IndirPtr((LongPtr *)(r10 + 3 * R0_W), 0); + const uint8 *phi = IndirPtr((LongPtr *)(r13 + 3 * R0_W), 0); + uint8 bank = sign8(misc_level_tileset_setting - 16) ? 13 : 5; + uint16 r8 = *((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0xF; uint16 v4 = 0; do { - uint16 v5 = R8_W; - R0_W = *IndirPtr(&ptr_lo_map16_data, v5); - *(uint16 *)&R1_ = *(uint16 *)IndirPtr(&ptr_hi_map16_data, v5); - R10_W = pointer_map16_tiles[R0_W]; + uint16 v5 = r8; + R0_W = plo[v5] | phi[v5] << 8; + r10 = RomPtrWithBank(bank, pointer_map16_tiles[R0_W]); int v6 = v4 >> 1; - blocks_layer1_tiles_to_upload_buffer[v6] = *(uint16 *)IndirPtr(&R10_W, 0); - blocks_layer1_tiles_to_upload_buffer[v6 + 1] = *(uint16 *)IndirPtr(&R10_W, 2); - blocks_layer1_tiles_to_upload_buffer[v6 + 64] = *(uint16 *)IndirPtr(&R10_W, 4); - blocks_layer1_tiles_to_upload_buffer[v6 + 65] = *(uint16 *)IndirPtr(&R10_W, 6); + blocks_layer1_tiles_to_upload_buffer[v6] = *(uint16 *)(r10); + blocks_layer1_tiles_to_upload_buffer[v6 + 1] = *(uint16 *)(r10 + 2); + blocks_layer1_tiles_to_upload_buffer[v6 + 64] = *(uint16 *)(r10 + 4); + blocks_layer1_tiles_to_upload_buffer[v6 + 65] = *(uint16 *)(r10 + 6); v4 += 4; - R8_W += 16; - } while (R8_W < 0x1B0); + r8 += 16; + } while (r8 < 0x1B0); } void BufferScrollingTiles_Layer1_NoScroll() { // 058a9a @@ -678,103 +766,79 @@ void BufferScrollingTiles_Layer1_NoScroll() { // 058a9a } void BufferScrollingTiles_Layer1_VerticalLevel() { // 058a9b - uint16 v0; - int lvl_setting = misc_level_mode_setting; int max_n = (lvl_setting == 7 || lvl_setting == 8 || lvl_setting == 10 || lvl_setting == 13) ? 28 : 16; - v0 = 2 * lvl_setting; - R10_ = *((uint8 *)kLevelDataLayoutTables_Layer1LoPtrs + v0); - R11_ = *((uint8 *)kLevelDataLayoutTables_Layer1LoPtrs + v0 + 1); - R13_ = *((uint8 *)kLevelDataLayoutTables_Layer1HiPtrs + v0); - R14_ = *((uint8 *)kLevelDataLayoutTables_Layer1HiPtrs + v0 + 1); - R12_ = 0; - R15_ = 0; - LOBYTE(v0) = camera_layer1_scrolling_direction; + const uint8 *r10 = RomPtr_00(kLevelDataLayoutTables_Layer1LoPtrs[lvl_setting]); + const uint8 *r13 = RomPtr_00(kLevelDataLayoutTables_Layer1HiPtrs[lvl_setting]); + + uint16 v0 = camera_layer1_scrolling_direction; uint8 v1 = 32; if ((*((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0x10) != 0) v1 = 40; - R0_ = v1; LOBYTE(blocks_layer1_vramupload_address) = v1 | (*((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) >> 2) & 3; HIBYTE(blocks_layer1_vramupload_address) = (*((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) & 3) << 6; - R0_W = (uint16)(*(uint16 *)((int8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0x1F0) >> 4; + uint16 R0_W = (uint16)(*(uint16 *)((int8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0x1F0) >> 4; uint16 v2 = (R0_W < max_n) ? 3 * R0_W : 0; - ptr_lo_map16_data = *(uint16 *)IndirPtr(&R10_W, v2); - ptr_hi_map16_data = *(uint16 *)IndirPtr(&R13_, v2); - v2 += 2; - ptr_lo_map16_data_bank = *IndirPtr(&R10_, v2); - ptr_hi_map16_data_bank = *IndirPtr(&R13_, v2); - uint8 v3 = 13; - if (!sign8(misc_level_tileset_setting - 16)) - v3 = 5; - R12_ = v3; - R8_W = 16 * (*((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0xF); + const uint8 *plo = IndirPtr((LongPtr *)(r10 + v2), 0); + const uint8 *phi = IndirPtr((LongPtr *)(r13 + v2), 0); + uint8 bank = sign8(misc_level_tileset_setting - 16) ? 13 : 5; + uint16 r8 = 16 * (*((uint8 *)&camera_layer1_row_column_to_update_left_up + v0) & 0xF); uint16 v4 = 0; do { - uint16 v5 = R8_W; - R0_W = *IndirPtr(&ptr_lo_map16_data, R8_W); - *(uint16 *)&R1_ = *(uint16 *)IndirPtr(&ptr_hi_map16_data, v5); - R10_W = pointer_map16_tiles[(uint16)(2 * R0_W) >> 1]; + uint16 v5 = r8; + R0_W = plo[r8] | phi[v5] << 8; + + r10 = RomPtrWithBank(bank, pointer_map16_tiles[R0_W]); int v6 = v4 >> 1; - blocks_layer1_tiles_to_upload_buffer[v6] = *(uint16 *)IndirPtr(&R10_W, 0); - blocks_layer1_tiles_to_upload_buffer[v6 + 64] = *(uint16 *)IndirPtr(&R10_W, 2); + blocks_layer1_tiles_to_upload_buffer[v6] = WORD(r10[0]); + blocks_layer1_tiles_to_upload_buffer[v6 + 64] = WORD(r10[2]); uint16 v7 = v4 + 2; int v8 = v7 >> 1; - blocks_layer1_tiles_to_upload_buffer[v8] = *(uint16 *)IndirPtr(&R10_W, 4); - blocks_layer1_tiles_to_upload_buffer[v8 + 64] = *(uint16 *)IndirPtr(&R10_W, 6); + blocks_layer1_tiles_to_upload_buffer[v8] = WORD(r10[4]); + blocks_layer1_tiles_to_upload_buffer[v8 + 64] = WORD(r10[6]); v4 = v7 + 2; - uint16 v9 = R8_W++; - if ((R8_W & 0xF) == 0) - R8_W = (v9 & 0xFFF0) + 256; - } while ((R8_W & 0x10F) != 0); + uint16 v9 = r8++; + if ((r8 & 0xF) == 0) + r8 = (v9 & 0xFFF0) + 256; + } while ((r8 & 0x10F) != 0); } void BufferScrollingTiles_Layer2() { // 058b8d - uint16 v0; - - v0 = 2 * misc_level_mode_setting; int16 v1 = 0; if (misc_level_tileset_setting == 3) v1 = 0x1000; - *(uint16 *)&R3_ = v1; - R10_ = *((uint8 *)kLevelDataLayoutTables_Layer2LoPtrs + v0); - R11_ = *((uint8 *)kLevelDataLayoutTables_Layer2LoPtrs + v0 + 1); - R13_ = *((uint8 *)kLevelDataLayoutTables_Layer2HiPtrs + v0); - R14_ = *((uint8 *)kLevelDataLayoutTables_Layer2HiPtrs + v0 + 1); - R12_ = 0; - R15_ = 0; - LOBYTE(v0) = camera_layer2_scrolling_direction; + uint16 R3_W = v1; + + const uint8 *r10 = RomPtr_00(kLevelDataLayoutTables_Layer2LoPtrs[misc_level_mode_setting]); + const uint8 *r13 = RomPtr_00(kLevelDataLayoutTables_Layer2HiPtrs[misc_level_mode_setting]); + + uint16 v0 = camera_layer2_scrolling_direction; HIBYTE(blocks_layer2_vramupload_address) = 2 * (*((uint8 *)&camera_layer2_row_column_to_update_left_up + v0) & 0xF); int8 v2 = 48; if ((*((uint8 *)&camera_layer2_row_column_to_update_left_up + v0) & 0x10) != 0) v2 = 52; LOBYTE(blocks_layer2_vramupload_address) = v2; - R0_W = (uint16)(*(uint16 *)((int8 *)&camera_layer2_row_column_to_update_left_up + v0) & 0x1F0) >> 4; + uint16 R0_W = (uint16)(*(uint16 *)((int8 *)&camera_layer2_row_column_to_update_left_up + v0) & 0x1F0) >> 4; uint16 v3 = 3 * R0_W; - ptr_lo_map16_data = *(uint16 *)IndirPtr(&R10_W, v3); - ptr_hi_map16_data = *(uint16 *)IndirPtr(&R13_, v3); - v3 += 2; - ptr_lo_map16_data_bank = *IndirPtr(&R10_, v3); - ptr_hi_map16_data_bank = *IndirPtr(&R13_, v3); - uint8 v4 = 13; - if (!sign8(misc_level_tileset_setting - 16)) - v4 = 5; - R12_ = v4; - R8_W = *((uint8 *)&camera_layer2_row_column_to_update_left_up + v0) & 0xF; + const uint8 *plo = IndirPtr((LongPtr *)(r10 + v3), 0); + const uint8 *phi = IndirPtr((LongPtr *)(r13 + v3), 0); + + uint8 bank = sign8(misc_level_tileset_setting - 16) ? 13 : 5; + uint16 r8 = *((uint8 *)&camera_layer2_row_column_to_update_left_up + v0) & 0xF; uint16 v5 = 0; do { - uint16 v6 = R8_W; - R0_W = *IndirPtr(&ptr_lo_map16_data, R8_W); - *(uint16 *)&R1_ = *(uint16 *)IndirPtr(&ptr_hi_map16_data, v6); - R10_W = pointer_map16_tiles[(uint16)(2 * R0_W) >> 1]; + uint16 v6 = r8; + R0_W = plo[r8] | phi[v6] << 8; + r10 = RomPtrWithBank(bank, pointer_map16_tiles[R0_W]); int v7 = v5 >> 1; - blocks_layer2_tiles_to_upload_buffer[v7] = *(uint16 *)&R3_ | *(uint16 *)IndirPtr(&R10_W, 0); - blocks_layer2_tiles_to_upload_buffer[v7 + 1] = *(uint16 *)&R3_ | *(uint16 *)IndirPtr(&R10_W, 2); - blocks_layer2_tiles_to_upload_buffer[v7 + 64] = *(uint16 *)&R3_ | *(uint16 *)IndirPtr(&R10_W, 4); - blocks_layer2_tiles_to_upload_buffer[v7 + 65] = *(uint16 *)&R3_ | *(uint16 *)IndirPtr(&R10_W, 6); + blocks_layer2_tiles_to_upload_buffer[v7] = R3_W | WORD(r10[0]); + blocks_layer2_tiles_to_upload_buffer[v7 + 1] = R3_W | WORD(r10[2]); + blocks_layer2_tiles_to_upload_buffer[v7 + 64] = R3_W | WORD(r10[4]); + blocks_layer2_tiles_to_upload_buffer[v7 + 65] = R3_W | WORD(r10[6]); v5 += 4; - R8_W += 16; - } while (R8_W < 0x1B0); + r8 += 16; + } while (r8 < 0x1B0); } void BufferScrollingTiles_Layer2_NoScroll() { // 058c70 @@ -782,59 +846,46 @@ void BufferScrollingTiles_Layer2_NoScroll() { // 058c70 } void BufferScrollingTiles_Layer2_VerticalLevel() { // 058c71 - uint16 v1; - int lvl_setting = misc_level_mode_setting; int max_n = (lvl_setting == 7 || lvl_setting == 8 || lvl_setting == 10 || lvl_setting == 13) ? 28 : 16; - v1 = 2 * lvl_setting; int16 v2 = 0; if (misc_level_tileset_setting == 3) v2 = 0x1000; - *(uint16 *)&R3_ = v2; - R10_ = *((uint8 *)kLevelDataLayoutTables_Layer2LoPtrs + v1); - R11_ = *((uint8 *)kLevelDataLayoutTables_Layer2LoPtrs + v1 + 1); - R13_ = *((uint8 *)kLevelDataLayoutTables_Layer2HiPtrs + v1); - R14_ = *((uint8 *)kLevelDataLayoutTables_Layer2HiPtrs + v1 + 1); - R12_ = 0; - R15_ = 0; - LOBYTE(v1) = camera_layer2_scrolling_direction; + uint16 R3_W = v2; + + const uint8 *r10 = RomPtr_00(kLevelDataLayoutTables_Layer2LoPtrs[misc_level_mode_setting]); + const uint8 *r13 = RomPtr_00(kLevelDataLayoutTables_Layer2HiPtrs[misc_level_mode_setting]); + + uint16 v1 = camera_layer2_scrolling_direction; uint8 v3 = 48; if ((*((uint8 *)&camera_layer2_row_column_to_update_left_up + v1) & 0x10) != 0) v3 = 56; - R0_ = v3; LOBYTE(blocks_layer2_vramupload_address) = v3 | (*((uint8 *)&camera_layer2_row_column_to_update_left_up + v1) >> 2) & 3; HIBYTE(blocks_layer2_vramupload_address) = (*((uint8 *)&camera_layer2_row_column_to_update_left_up + v1) & 3) << 6; - R0_W = (uint16)(*(uint16 *)((int8 *)&camera_layer2_row_column_to_update_left_up + v1) & 0x1F0) >> 4; + uint16 R0_W = (uint16)(*(uint16 *)((int8 *)&camera_layer2_row_column_to_update_left_up + v1) & 0x1F0) >> 4; uint16 v4 = (R0_W < max_n) ? 3 * R0_W : 0; - ptr_lo_map16_data = *(uint16 *)IndirPtr(&R10_W, v4); - ptr_hi_map16_data = *(uint16 *)IndirPtr(&R13_, v4); - v4 += 2; - ptr_lo_map16_data_bank = *IndirPtr(&R10_, v4); - ptr_hi_map16_data_bank = *IndirPtr(&R13_, v4); - uint8 v5 = 13; - if (!sign8(misc_level_tileset_setting - 16)) - v5 = 5; - R12_ = v5; - R8_W = 16 * (*((uint8 *)&camera_layer2_row_column_to_update_left_up + v1) & 0xF); + const uint8 *plo = IndirPtr((LongPtr *)(r10 + v4), 0); + const uint8 *phi = IndirPtr((LongPtr *)(r13 + v4), 0); + uint8 bank = sign8(misc_level_tileset_setting - 16) ? 13 : 5; + uint16 r8 = 16 * (*((uint8 *)&camera_layer2_row_column_to_update_left_up + v1) & 0xF); uint16 v6 = 0; do { - uint16 v7 = R8_W; - R0_W = *IndirPtr(&ptr_lo_map16_data, R8_W); - *(uint16 *)&R1_ = *(uint16 *)IndirPtr(&ptr_hi_map16_data, v7); - R10_W = pointer_map16_tiles[(uint16)(2 * R0_W) >> 1]; + uint16 v7 = r8; + R0_W = plo[r8] | phi[v7] << 8; + r10 = RomPtrWithBank(bank, pointer_map16_tiles[R0_W]); int v8 = v6 >> 1; - blocks_layer2_tiles_to_upload_buffer[v8] = *(uint16 *)&R3_ | *(uint16 *)IndirPtr(&R10_W, 0); - blocks_layer2_tiles_to_upload_buffer[v8 + 64] = *(uint16 *)&R3_ | *(uint16 *)IndirPtr(&R10_W, 2); + blocks_layer2_tiles_to_upload_buffer[v8] = R3_W | *(uint16 *)(r10); + blocks_layer2_tiles_to_upload_buffer[v8 + 64] = R3_W | *(uint16 *)(r10 + 2); uint16 v9 = v6 + 2; int v10 = v9 >> 1; - blocks_layer2_tiles_to_upload_buffer[v10] = *(uint16 *)&R3_ | *(uint16 *)IndirPtr(&R10_W, 4); - blocks_layer2_tiles_to_upload_buffer[v10 + 64] = *(uint16 *)&R3_ | *(uint16 *)IndirPtr(&R10_W, 6); + blocks_layer2_tiles_to_upload_buffer[v10] = R3_W | *(uint16 *)(r10 + 4); + blocks_layer2_tiles_to_upload_buffer[v10 + 64] = R3_W | *(uint16 *)(r10 + 6); v6 = v9 + 2; - uint16 v11 = R8_W++; - if ((R8_W & 0xF) == 0) - R8_W = (v11 & 0xFFF0) + 256; - } while ((R8_W & 0x10F) != 0); + uint16 v11 = r8++; + if ((r8 & 0xF) == 0) + r8 = (v11 & 0xFFF0) + 256; + } while ((r8 & 0x10F) != 0); } void BufferScrollingTiles_Layer2_Background() { // 058d7a @@ -843,35 +894,32 @@ void BufferScrollingTiles_Layer2_Background() { // 058d7a if ((blocks_screen_to_place_current_object & 0x10) != 0) v0 = 52; LOBYTE(blocks_layer2_vramupload_address) = v0; - ptr_lo_map16_data = 0xb900; - ptr_hi_map16_data = 0xbd00; - R10_W = 0x9100; + const uint8 *phi = g_ram + 0xbd00, *plo = g_ram + 0xb900; + if ((blocks_screen_to_place_current_object & 0xF0) != 0) { - ptr_lo_map16_data += 432; - ptr_hi_map16_data += 432; + plo += 432; + phi += 432; } - ptr_lo_map16_data_bank = 126; - ptr_hi_map16_data_bank = 126; - R12_ = 13; - R8_W = blocks_screen_to_place_current_object & 0xF; + const uint8 *r10 = RomPtr(0xd9100); + uint16 r8 = blocks_screen_to_place_current_object & 0xF; uint16 v1 = 0; do { - uint16 v2 = R8_W; - R0_W = *IndirPtr(&ptr_lo_map16_data, R8_W); - *(uint16 *)&R1_ = *(uint16 *)IndirPtr(&ptr_hi_map16_data, v2); + uint16 v2 = r8; + uint16 R0_W = plo[r8] | phi[v2] << 8; uint16 v3 = 8 * R0_W; int v4 = v1 >> 1; - blocks_layer2_tiles_to_upload_buffer[v4] = *(uint16 *)IndirPtr(&R10_W, 8 * R0_W); + blocks_layer2_tiles_to_upload_buffer[v4] = *(uint16 *)(r10 + v3); v3 += 2; - blocks_layer2_tiles_to_upload_buffer[v4 + 1] = *(uint16 *)IndirPtr(&R10_W, v3); + blocks_layer2_tiles_to_upload_buffer[v4 + 1] = *(uint16 *)(r10 + v3); v3 += 2; - blocks_layer2_tiles_to_upload_buffer[v4 + 64] = *(uint16 *)IndirPtr(&R10_W, v3); - blocks_layer2_tiles_to_upload_buffer[v4 + 65] = *(uint16 *)IndirPtr(&R10_W, v3 + 2); + blocks_layer2_tiles_to_upload_buffer[v4 + 64] = *(uint16 *)(r10 + v3); + blocks_layer2_tiles_to_upload_buffer[v4 + 65] = *(uint16 *)(r10 + v3 + 2); v1 += 4; - R8_W += 16; - } while (R8_W < 0x1B0); + r8 += 16; + } while (r8 < 0x1B0); } + void DisplayMessage() { // 05b10c int16 v7; @@ -934,15 +982,15 @@ void DisplayMessage() { // 05b10c } if (v0 == 22 && player_riding_yoshi_flag) v0 = 23; - R0_W = kDisplayMessage_DATA_05A5A7[v0]; + uint16 R0_W = kDisplayMessage_DATA_05A5A7[v0]; uint16 v3 = stripe_image_upload; uint16 v4 = 14; do { *(uint16 *)&stripe_image_upload_data[v3] = kDisplayMessage_DATA_05A580[v4 >> 1]; *(uint16 *)&stripe_image_upload_data[v3 + 2] = 0x2300; uint16 v11 = v4; - R2_ = 18; - R3_ = 0; + uint8 R2_ = 18; + uint8 R3_ = 0; uint16 v5 = R0_W; do { uint8 v6 = 31; @@ -998,14 +1046,13 @@ void sub_5B165(uint8 a) { // 05b165 void DisplayMessage_DrawSwitchBlocks(uint8 k) { // 05b2eb uint8 v1 = 16 * k; - R0_ = 0; + uint16 R0_W = 0; for (int8 i = 28; i >= 0; i -= 4) { OamEnt *oam = get_OamEnt(oam_buf, (uint8)i); *(uint16 *)&oam->charnum = kDisplayMessage_SwitchBlockTileAndProperties[v1 >> 1]; - *(uint16 *)&oam->xpos = *(uint16 *)&kDisplayMessage_SwitchBlockXAndYDisp[R0_]; + *(uint16 *)&oam->xpos = *(uint16 *)&kDisplayMessage_SwitchBlockXAndYDisp[R0_W]; v1 += 2; - ++R0_W; - ++R0_W; + R0_W += 2; } *(uint16 *)oam_buf_ext = 0; } @@ -1021,10 +1068,10 @@ void GiveCoins_MultipleCoins(uint8 a) { // 05b329 } void GiveCoins_MultipleCoins_NoCoinSound(uint8 a) { // 05b330 - R0_ = a; + uint8 r0 = a; counter_coin_handler += a; if (counter_green_star_block) { - uint8 v1 = counter_green_star_block - R0_; + uint8 v1 = counter_green_star_block - r0; counter_green_star_block = (int8)v1 < 0 ? 0 : v1; } } @@ -1041,12 +1088,11 @@ uint8 UnusedOverworldEventPassedCheck(uint8 j) { // 05b363 } void HandleLevelTileAnimations() { // 05bb39 - R0_ = counter_local_frames & 7; - uint8 v0 = (counter_local_frames & 7) + __CFSHL__(counter_local_frames & 7, 1) + 2 * (counter_local_frames & 7); - R0_W = (uint8)(counter_local_frames & 0x18) >> 2; - graphics_tile_anim_vramaddress3 = *(uint16 *)((char *)&kLevelTileAnimations_DATA_05B93B[0].field_0 + (uint8)(2 * v0)); - graphics_tile_anim_vramaddress2 = *(uint16 *)((char *)&kLevelTileAnimations_DATA_05B93B[0].field_2 + (uint8)(2 * v0)); - graphics_tile_anim_vramaddress1 = *(uint16 *)((char *)&kLevelTileAnimations_DATA_05B93B[0].field_4 + (uint8)(2 * v0)); + uint8 v0 = 3 * (counter_local_frames & 7); + uint16 R0_W = (uint8)(counter_local_frames & 0x18) >> 2; + graphics_tile_anim_vramaddress3 = *(uint16 *)((char *)&kLevelTileAnimations_DATA_05B93B[0].field_0 + (2 * v0)); + graphics_tile_anim_vramaddress2 = *(uint16 *)((char *)&kLevelTileAnimations_DATA_05B93B[0].field_2 + (2 * v0)); + graphics_tile_anim_vramaddress1 = *(uint16 *)((char *)&kLevelTileAnimations_DATA_05B93B[0].field_4 + (2 * v0)); uint8 v2 = 4; do { uint8 v4 = v2; @@ -1202,7 +1248,7 @@ void Spr0EB_UnusedSprite_05BDF0() { // 05bdf0 v0 = l1_l2_scroll_spr_scroll_type_index[1]; uint16 v1 = kSpr0EB_UnusedSprite_DATA_05CA10[v0 >> 1]; *(uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2] = v1; - R0_W = kSpr0EB_UnusedSprite_DATA_05CA10[((uint8)(2 * v0) >> 1) + 1]; + uint16 R0_W = kSpr0EB_UnusedSprite_DATA_05CA10[((uint8)(2 * v0) >> 1) + 1]; int8 v2 = v1; uint8 v3 = scroll_spr_layer_index; uint16 v4 = R0_W; @@ -1402,6 +1448,10 @@ void Spr0F5_Layer2ScrollWhenTouched() { // 05c036 void Layer1SpecialScrolling00_VariableScroll() { // 05c04d uint16 rw; + uint16 r12; + uint16 r10; + uint16 r8; + uint16 R0_W, R2_W; while (1) { if (!l1_l2_scroll_spr_timer[scroll_spr_layer_index >> 2]) { @@ -1409,15 +1459,15 @@ void Layer1SpecialScrolling00_VariableScroll() { // 05c04d return; } uint8 v0 = *(uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2]; - R4_W = kLayer1SpecialScrolling01_VariableScroll_DATA_05CA6F[v0 - 1]; - R6_W = kLayer1SpecialScrolling01_VariableScroll_DATA_05CABF[v0 - 1]; + uint16 R4_W = kLayer1SpecialScrolling01_VariableScroll_DATA_05CA6F[v0 - 1]; + uint16 r6 = kLayer1SpecialScrolling01_VariableScroll_DATA_05CABF[v0 - 1]; PointU16 *pt = get_PointU16(misc_layer1_pos, scroll_spr_layer_index); R0_W = pt->x; R2_W = pt->y; uint8 v2 = 2; if (kLayer1SpecialScrolling01_VariableScroll_DATA_05CA6F[v0] == R4_W) { R4_W = 0; - R8_ = 2; + r8 = 2; } else { int16 v3 = 16 * kLayer1SpecialScrolling01_VariableScroll_DATA_05CA6F[v0] - R0_W; R0_W = v3; @@ -1426,11 +1476,11 @@ void Layer1SpecialScrolling00_VariableScroll() { // 05c04d v3 = -v3; } R4_W = v3; - R8_ = v2; + r8 = v2; } uint8 v4 = 0; - if (kLayer1SpecialScrolling01_VariableScroll_DATA_05CABF[v0] == R6_W) { - R6_W = 0; + if (kLayer1SpecialScrolling01_VariableScroll_DATA_05CABF[v0] == r6) { + r6 = 0; } else { int16 v5 = 16 * kLayer1SpecialScrolling01_VariableScroll_DATA_05CABF[v0] - R2_W; R2_W = v5; @@ -1438,51 +1488,49 @@ void Layer1SpecialScrolling00_VariableScroll() { // 05c04d v4 = 2; v5 = -v5; } - R6_W = v5; + r6 = v5; } if (!(misc_level_layout_flags & 1)) - v4 = R8_; + v4 = r8; camera_layer1_scrolling_direction = v4; - R8_W = -1; - R10_W = R4_W; - R12_W = R6_W; - if (R6_W >= R4_W) { - R10_W = R6_W; - R12_W = R4_W; - R8_W = 1; + r8 = -1; + r10 = R4_W; + r12 = r6; + if (r6 >= R4_W) { + r10 = r6; + r12 = R4_W; + r8 = 1; } - WriteRegWord(WRDIVL, R10_W); - WriteReg(WRDIVB, kLayer1SpecialScrolling01_VariableScroll_DATA_05CB0F[v0]); - rw = ReadRegWord(RDDIVL); + rw = SnesDivide(r10, kLayer1SpecialScrolling01_VariableScroll_DATA_05CB0F[v0]); if (rw) break; uint16 v7 = scroll_spr_layer_index >> 2; ++*(uint16 *)&l1_l2_scroll_spr_current_state[(uint8)v7]; --l1_l2_scroll_spr_timer[(uint8)v7]; } - R10_W = rw; - R12_W *= 16; + r10 = rw; + r12 *= 16; uint8 v8 = 16; uint16 v9 = 0; - R14_W = 0; + uint16 r14 = 0; do { - v9 = 2 * v9 + __CFSHL__uint16(R12_W); - R12_W *= 2; - bool v10 = v9 >= R10_W; - if (v9 >= R10_W) - v9 -= R10_W; - R14_W = 2 * R14_W + v10; + v9 = 2 * v9 + __CFSHL__uint16(r12); + r12 *= 2; + bool v10 = v9 >= r10; + if (v9 >= r10) + v9 -= r10; + r14 = 2 * r14 + v10; } while (--v8); - R10_W = 16 * kLayer1SpecialScrolling01_VariableScroll_DATA_05CB0F[(uint8) * + r10 = 16 * kLayer1SpecialScrolling01_VariableScroll_DATA_05CB0F[(uint8) * (uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2]]; uint8 v11 = 2; do { uint16 v12; - if ((R8_W & 0x8000) != 0) - v12 = R14_W; + if ((r8 & 0x8000) != 0) + v12 = r14; else - v12 = R10_W; - if (*(int16 *)((int8 *)&R0_W + v11) < 0) + v12 = r10; + if ((int16)(v11 ? R2_W : R0_W) < 0) v12 = -v12; uint8 v16 = v11; uint8 v13 = scroll_spr_layer_index + v11; @@ -1494,6 +1542,7 @@ void Layer1SpecialScrolling00_VariableScroll() { // 05c04d v15->x += *(uint16 *)&kLayer1SpecialScrolling01_VariableScroll_DATA_05CB5F[v14]; } UpdateLayerPositionWithScrollSprite(v13); + r8 = -r8; v11 = v16 - 2; } while ((int8)v11 >= 0); } @@ -1510,6 +1559,7 @@ void UnusedScrollSpriteRoutine() { // 05c1ae if ((l1_l2_scroll_spr_timer[scroll_spr_layer_index >> 2] & 0x80) != 0) { uint16 x = get_PointU16(l1_l2_scroll_spr_sub_pos, scroll_spr_layer_index)->x; PointU16 *pt = get_PointU16(misc_layer1_pos, scroll_spr_layer_index); + uint16 R2_W, R4_W; if (pt->y < x) { R2_W = pt->y; R4_W = x; @@ -1525,7 +1575,7 @@ void UnusedScrollSpriteRoutine() { // 05c1ae uint8 v5 = l1_l2_scroll_spr_scroll_type_index[0]; if (scroll_spr_layer_index) v5 = l1_l2_scroll_spr_scroll_type_index[1]; - R0_W = kSharedScrollSpriteTables_UNK_05CBC7[v5]; + uint16 R0_W = kSharedScrollSpriteTables_UNK_05CBC7[v5]; uint8 v6 = v4 >> 2; uint16 v7 = *(uint16 *)&l1_l2_scroll_spr_current_state[v6] ^ 1; *(uint16 *)&l1_l2_scroll_spr_current_state[v6] = v7; @@ -1557,11 +1607,9 @@ void Layer1SpecialScrolling04_Unused() { // 05c283 uint16 v1 = x - get_PointU16(misc_layer1_pos, scroll_spr_layer_index)->y; if (v1 < 0) v1 = -v1; - R2_W = v1; + uint16 R2_W = v1; uint8 v2 = l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2]; - WriteRegWord(WRDIVL, v1); - WriteReg(WRDIVB, kLayer2SpecialScrolling04_Unused_DATA_05CBE3[v2 >> 1]); - if (!ReadRegWord(RDDIVL)) { + if (!SnesDivide(v1, kLayer2SpecialScrolling04_Unused_DATA_05CBE3[v2 >> 1])) { v2 = *(uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2]; uint16 v3 = 512; if (v2 == 1) @@ -1594,11 +1642,9 @@ void Layer1SpecialScrolling0A_Unused() { // 05c32e uint16 v1 = y - get_PointU16(misc_layer1_pos, scroll_spr_layer_index)->x; if (v1 < 0) v1 = -v1; - R2_W = v1; + uint16 R2_W = v1; uint8 v2 = l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2] >> 1; - WriteRegWord(WRDIVL, v1); - WriteReg(WRDIVB, kLayer2SpecialScrolling0A_Unused_DATA_05CBE5[v2]); - if (!ReadRegWord(RDDIVL)) { + if (!SnesDivide(v1, kLayer2SpecialScrolling0A_Unused_DATA_05CBE5[v2])) { uint8 v3 = scroll_spr_layer_index; uint16 v4 = 0x600; if ((uint8) * (uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2] == 1) @@ -1679,7 +1725,6 @@ void ScrollLayer3() { // 05c40c uint16 v5 = misc_layer1_xdisp; if (misc_layer1_xdisp >= 0x80) v5 = misc_layer1_xdisp | 0xFF00; - R0_W = v5; mirror_layer3_xpos += v5; } mirror_layer3_ypos = mirror_current_layer1_ypos; @@ -1692,12 +1737,13 @@ void UpdateLayerPositionWithScrollSprite(uint8 k) { // 05c4f9 pt->x = v2; PointU16 *v6 = get_PointU16(misc_layer1_pos, k); v6->x += (int8)(v2 >> 8); - R8_W = -R8_W; + //R8_W = -R8_W; } void Layer1SpecialScrolling08_Layer2ScrollSOrL() { // 05c51f uint16 y = get_PointU16(l1_l2_scroll_spr_sub_pos, scroll_spr_layer_index)->y; PointU16 *pt = get_PointU16(misc_layer1_pos, scroll_spr_layer_index); + uint16 R2_W, R4_W; if (pt->x < y) { R2_W = pt->x; R4_W = y; @@ -1709,7 +1755,7 @@ void Layer1SpecialScrolling08_Layer2ScrollSOrL() { // 05c51f uint8 v2 = l1_l2_scroll_spr_scroll_type_index[0]; if (*(uint16 *)&scroll_spr_layer_index) v2 = l1_l2_scroll_spr_scroll_type_index[1]; - R0_W = kSharedScrollSpriteTables_DATA_05CBED[(uint8)(2 * v2) + 1]; + uint16 R0_W = kSharedScrollSpriteTables_DATA_05CBED[(uint8)(2 * v2) + 1]; uint16 v3 = *(uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2] ^ 1; *(uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2] = v3; if (!(uint8)v3) @@ -1733,6 +1779,7 @@ void Layer1SpecialScrolling08_Layer2ScrollSOrL() { // 05c51f void Layer2SpecialScrolling03_Layer2Scroll() { // 05c5bb uint16 x = get_PointU16(l1_l2_scroll_spr_sub_pos, scroll_spr_layer_index)->x; PointU16 *pt = get_PointU16(misc_layer1_pos, scroll_spr_layer_index); + uint16 R2_W, R4_W; if (pt->y < x) { R2_W = pt->y; R4_W = x; @@ -1744,7 +1791,7 @@ void Layer2SpecialScrolling03_Layer2Scroll() { // 05c5bb uint8 v2 = l1_l2_scroll_spr_scroll_type_index[0]; if (*(uint16 *)&scroll_spr_layer_index) v2 = l1_l2_scroll_spr_scroll_type_index[1]; - R0_W = kSharedScrollSpriteTables_DATA_05CBF5[(uint8)(2 * v2) + 1]; + uint16 R0_W = kSharedScrollSpriteTables_DATA_05CBF5[(uint8)(2 * v2) + 1]; uint16 v3 = *(uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2] ^ 1; *(uint16 *)&l1_l2_scroll_spr_current_state[scroll_spr_layer_index >> 2] = v3; if (!(uint8)v3) @@ -1796,7 +1843,7 @@ void Layer1SpecialScrolling05_Unused() { // 05c69e camera_layer1_scrolling_direction = 2; camera_layer2_scrolling_direction = 0; if (l1_l2_scroll_spr_scroll_type_index[0]) { - WriteReg(TM, 0x16); + RtlPpuWrite(TM, 0x16); PointU16 *pt = get_PointU16(l1_l2_scroll_spr_speed, 0); uint16 y = pt[1].y; if (y != 0xFF80) @@ -1900,8 +1947,7 @@ void Layer2SpecialScrolling0D_FastBGScroll_NonFlagged() { // 05c7c1 void Layer2SpecialScrolling0E_Layer2ScrollWhenTouched() { // 05c81c PointU16 *v3; - R0_W = 0; - R0_ = l1_l2_scroll_spr_timer[1]; + uint16 R0_W = l1_l2_scroll_spr_timer[1]; uint8 v0 = 0; uint8 v1 = l1_l2_scroll_spr_timer[0]; if (l1_l2_scroll_spr_timer[0] >= 8) @@ -1996,7 +2042,7 @@ void ShowCourseClearText() { // 05cc66 int16 v2 = 74; uint16 v3 = stripe_image_upload + 74; do { - *(uint16 *)&stripe_image_upload_data[v3] = *(uint16 *)&kCourseClearText_Mario[(uint16)v2]; + *(uint16 *)&stripe_image_upload_data[v3] = *(uint16 *)&kCourseClearText[(uint16)v2]; v3 -= 2; v2 -= 2; } while (v2 >= 0); @@ -2023,10 +2069,10 @@ void ShowCourseClearText() { // 05cc66 stripe_image_upload_data[v9 + 50] = -4; v9 += 2; } while (v9 != 4); - CalculateTimeBonusDigits(); - R0_W = 0; + uint16 R2_W = CalculateTimeBonusDigits(); + uint16 R0_W = 0; counter_level_end_score_tally = R2_W; - AdjustTimeBonusDisplay(0x42, 0); + AdjustTimeBonusDisplay(0x42, 0, R0_W, R2_W); for (uint8 j = 0; j != 8; j += 2) { if ((stripe_image_upload_data[j + 64] & 0xF) != 0) break; @@ -2064,39 +2110,38 @@ void DisplayCourseClearTextBonusStars() { // 05cd76 } } -void AdjustTimeBonusDisplay(uint8 k, uint8 j) { // 05cdfd +void AdjustTimeBonusDisplay(uint8 k, uint8 j, uint16 R0_W_, uint16 R2_W) { // 05cdfd do { for (*(uint16 *)((int8 *)&stripe_image_upload + k) &= 0xFF00;; ++*(uint16 *)((int8 *)&stripe_image_upload + k)) { int v2 = j >> 1; bool v3 = R2_W >= kAdjustTimeBonusDisplay_DATA_05CDE9[v2 + 1]; - R6_W = R2_W - kAdjustTimeBonusDisplay_DATA_05CDE9[v2 + 1]; + uint16 r6 = R2_W - kAdjustTimeBonusDisplay_DATA_05CDE9[v2 + 1]; uint16 v4 = !v3 + kAdjustTimeBonusDisplay_DATA_05CDE9[v2]; - R4_W = R0_W - v4; - if (R0_W < v4) + uint16 R4_W = R0_W_ - v4; + if (R0_W_ < v4) break; - R2_W = R6_W; - R0_W = R4_W; + R2_W = r6; + R0_W_ = R4_W; } k += 2; j += 4; } while (j != 20); } -void CalculateTimeBonusDigits() { // 05ce4c - R0_W = kCalculateTimeBonusDigits_DATA_05CE3A[counter_timer_hundreds]; +uint16 CalculateTimeBonusDigits() { // 05ce4c + uint16 R0_W = kCalculateTimeBonusDigits_DATA_05CE3A[counter_timer_hundreds]; R0_W += kCalculateTimeBonusDigits_DATA_05CE42[counter_timer_tens]; R0_W += counter_timer_ones; - WriteReg(WRMPYA, R0_); - WriteReg(WRMPYB, 0x32); - R2_ = ReadReg(RDMPYL); - R3_ = ReadReg(RDMPYH); - WriteReg(WRMPYA, R1_); - WriteReg(WRMPYB, 0x32); - R3_ += ReadReg(RDMPYL); + uint16 mult = Mult8x8(R0_W, 0x32); + uint8 R2_ = mult; + uint8 R3_ = mult >> 8; + R3_ += Mult8x8(R0_W >> 8, 0x32); + return R2_ | R3_ << 8; } void GiveTimeBonusAndBonusStars() { // 05ceca uint16 v7; + uint16 R2_W = 0; uint8 v0 = 0; if (player_current_character) @@ -2126,15 +2171,15 @@ void GiveTimeBonusAndBonusStars() { // 05ceca } uint8 v4 = 30; uint8 v5 = stripe_image_upload + 30; - R10_W = stripe_image_upload + 31; + uint16 r10 = stripe_image_upload + 31; do { - *(uint16 *)&stripe_image_upload_data[v5] = kNoBonusStarsText_Stars[v4 >> 1]; + *(uint16 *)&stripe_image_upload_data[v5] = WORD(kNoBonusStarsText_Stars[v4]); v5 -= 2; v4 -= 2; } while ((v4 & 0x80) == 0); if (counter_level_end_score_tally) { - R0_W = 0; - AdjustTimeBonusDisplay(stripe_image_upload + 6, 0); + uint16 R0_W = 0; + AdjustTimeBonusDisplay(stripe_image_upload + 6, 0, R0_W, R2_W); R0_W = stripe_image_upload + 8; uint8 v6 = stripe_image_upload; do { @@ -2142,7 +2187,7 @@ void GiveTimeBonusAndBonusStars() { // 05ceca break; *(uint16 *)&stripe_image_upload_data[v6 + 4] = 0x38fc; v6 += 2; - } while (v6 != R0_); + } while (v6 != (uint8)R0_W); } v7 = timer_display_bonus_stars; if (timer_display_bonus_stars) { @@ -2157,7 +2202,7 @@ void GiveTimeBonusAndBonusStars() { // 05ceca stripe_image_upload_data[v8 + 26] = kDisplayCourseClearTextBonusStars_DATA_05CD62[v7 + 1]; } } - stripe_image_upload = R10_W; + stripe_image_upload = r10; } void GiveTimeBonusAndBonusStars_Return() { // 05cfe9 @@ -2167,8 +2212,11 @@ void GiveTimeBonusAndBonusStars_Return() { // 05cfe9 void SpecifySublevelToLoad() { // 05d796 uint16 v1; int16 v5; - int16 v9; uint16 v10; + uint16 r14w; + + uint8 R1_ = 0; + flag_override_no_yoshi_intro_for_midway_entrance = 0; if (in_yoshi_wings_bonus_area || flag_active_bonus_game) @@ -2177,33 +2225,30 @@ void SpecifySublevelToLoad() { // 05d796 uint8 v0 = HIBYTE(player_xpos); if ((misc_level_layout_flags & 1) != 0) v0 = HIBYTE(player_ypos); - unusedram_7e17bb = misc_subscreen_exit_entrance_number_lo[v0]; - R14_ = unusedram_7e17bb; - R15_ = ow_players_map[(uint8)player_current_characterx4 >> 2] != 0; + r14w = (ow_players_map[(uint8)player_current_characterx4 >> 2] != 0) << 8 | misc_subscreen_exit_entrance_number_lo[v0]; + if (flag_use_secondary_entrance) { - uint16 j = R14_W; - R14_ = kSpecifySublevelToLoad_DATA_05F800[j]; - unusedram_7e17bb = R14_; - R0_ = kSpecifySublevelToLoad_DATA_05FA00[j]; - LOBYTE(player_ypos) = kSpecifySublevelToLoad_DATA_05D730[R0_ & 0xF]; - HIBYTE(player_ypos) = kSpecifySublevelToLoad_DATA_05D740[R0_ & 0xF]; - LOBYTE(mirror_current_layer1_ypos) = kSpecifySublevelToLoad_DATA_05D708[(uint8)(R0_ & 0x30) >> 4]; - LOBYTE(mirror_current_layer2_ypos) = kSpecifySublevelToLoad_DATA_05D70C[R0_ >> 6]; + uint16 j = r14w; + r14w = (r14w & ~0xff) | kSpecifySublevelToLoad_DATA_05F800[j]; + uint8 r0 = kSpecifySublevelToLoad_DATA_05FA00[j]; + LOBYTE(player_ypos) = kSpecifySublevelToLoad_DATA_05D730[r0 & 0xF]; + HIBYTE(player_ypos) = kSpecifySublevelToLoad_DATA_05D740[r0 & 0xF]; + LOBYTE(mirror_current_layer1_ypos) = kSpecifySublevelToLoad_DATA_05D708[(r0 & 0x30) >> 4]; + LOBYTE(mirror_current_layer2_ypos) = kSpecifySublevelToLoad_DATA_05D70C[r0 >> 6]; R1_ = kSpecifySublevelToLoad_DATA_05FC00[j]; LOBYTE(player_xpos) = kSpecifySublevelToLoad_DATA_05D750[R1_ >> 5]; HIBYTE(player_xpos) = kSpecifySublevelToLoad_DATA_05D758[R1_ >> 5]; misc_level_header_entrance_settings = kSpecifySublevelToLoad_DATA_05FE00[j] & 7; } } else { - R15_ = 0; - LOBYTE(v1) = 0; + v1 = 0; uint8 v2 = misc_intro_level_flag; if (!misc_intro_level_flag) { mirror_current_layer1_xpos = 0; mirror_current_layer2_xpos = 0; PointU16 *pt = get_PointU16(ow_players_grid_aligned_pos, player_current_characterx4); - R0_W = pt->x & 0xF; - R2_W = 16 * (pt->y & 0xF); + uint16 R0_W = pt->x & 0xF; + uint16 R2_W = 16 * (pt->y & 0xF); R0_W |= 16 * (pt->x & 0x10); uint16 v4 = R0_W | R2_W | (32 * (pt->y & 0x10)); v1 = (uint8)player_current_characterx4 >> 2; @@ -2214,56 +2259,42 @@ void SpecifySublevelToLoad() { // 05d796 } if (v2 >= 0x25) v2 -= 36; - unusedram_7e17bb = v2; - R14_ = v2; - R15_ = ow_players_map[(uint8)v1] != 0; + r14w = (ow_players_map[(uint8)v1] != 0) << 8 | v2; } - temp65 = *((uint8 *)&kSpecifySublevelToLoad_Layer1DataPtrs[0].addr + (uint16)(3 * R14_W)); - temp66 = *((uint8 *)&kSpecifySublevelToLoad_Layer1DataPtrs[0].addr + (uint16)(3 * R14_W) + 1); - temp67 = *(&kSpecifySublevelToLoad_Layer1DataPtrs[0].bank + (uint16)(3 * R14_W)); - LOBYTE(ptr_layer2_data) = *((uint8 *)&kSpecifySublevelToLoad_Layer2DataPtrs[0].addr + (uint16)(3 * R14_W)); - HIBYTE(ptr_layer2_data) = *((uint8 *)&kSpecifySublevelToLoad_Layer2DataPtrs[0].addr + (uint16)(3 * R14_W) + 1); - ptr_layer2_data_bank = *(&kSpecifySublevelToLoad_Layer2DataPtrs[0].bank + (uint16)(3 * R14_W)); + ptr_layer1_data = kSpecifySublevelToLoad_Layer1DataPtrs[r14w]; + ptr_layer2_data = kSpecifySublevelToLoad_Layer2DataPtrs[r14w]; HIBYTE(v5) = 0; - LOBYTE(ptr_sprite_list_data) = *((uint8 *)kSpecifySublevelToLoad_SpriteDataPtrs + (uint16)(2 * R14_W)); - HIBYTE(ptr_sprite_list_data) = *((uint8 *)kSpecifySublevelToLoad_SpriteDataPtrs + (uint16)(2 * R14_W) + 1); - ptr_sprite_list_data_bank = 7; - sprites_sprite_memory_setting = *IndirPtr(&ptr_sprite_list_data, 0) & 0x3F; - sprites_sprite_buoyancy_settings = *IndirPtr(&ptr_sprite_list_data, 0) & 0xC0; - uint8 v6 = kSpecifySublevelToLoad_DATA_05F000[R14_W] >> 4; + ptr_sprite_list_data.addr = kSpecifySublevelToLoad_SpriteDataPtrs[r14w]; + ptr_sprite_list_data.bank = 7; + uint8 sprite_hdr = *IndirPtr(&ptr_sprite_list_data, 0); + sprites_sprite_memory_setting = sprite_hdr & 0x3F; + sprites_sprite_buoyancy_settings = sprite_hdr & 0xC0; + uint8 v6 = kSpecifySublevelToLoad_DATA_05F000[r14w] >> 4; flag_layer2_horiz_scroll_level_setting = kSpecifySublevelToLoad_L2HorzScrollSettings[v6]; flag_layer2_vert_scroll_level_setting = kSpecifySublevelToLoad_L2VertScrollSettings[v6]; flag_layer1_horiz_scroll_level_setting = 1; - LOBYTE(v5) = kSpecifySublevelToLoad_DATA_05F200[R14_W] & 0xC0; - bool v7 = __CFSHL__(v5, 1); - LOBYTE(v5) = 2 * v5; - int16 v8 = v7; - v7 = __CFSHL__(v5, 1); - LOBYTE(v5) = 2 * v5; - v9 = v5 + v8; - LOBYTE(v9) = 2 * v9; - v10 = v9 + v7; - misc_level_layer3_settings = v10; + misc_level_layer3_settings = (kSpecifySublevelToLoad_DATA_05F200[r14w] & 0xC0) >> 6; HIBYTE(mirror_current_layer1_ypos) = 0; HIBYTE(mirror_current_layer2_ypos) = 0; - flag_disable_no_yoshi_intro = kSpecifySublevelToLoad_DATA_05F600[R14_W] & 0x80; - misc_level_layout_flags = (uint8)(kSpecifySublevelToLoad_DATA_05F600[R14_W] & 0x60) >> 5; + flag_disable_no_yoshi_intro = kSpecifySublevelToLoad_DATA_05F600[r14w] & 0x80; + misc_level_layout_flags = (uint8)(kSpecifySublevelToLoad_DATA_05F600[r14w] & 0x60) >> 5; + uint8 R2_ = 0; // todo: what is R2 here? if (!flag_use_secondary_entrance) { - v10 = kSpecifySublevelToLoad_DATA_05F000[R14_W] & 0xF; + v10 = kSpecifySublevelToLoad_DATA_05F000[r14w] & 0xF; player_ypos = PAIR16(kSpecifySublevelToLoad_DATA_05D740[v10], kSpecifySublevelToLoad_DATA_05D730[v10]); - R2_ = kSpecifySublevelToLoad_DATA_05F200[R14_W]; + R2_ = kSpecifySublevelToLoad_DATA_05F200[r14w]; v10 = R2_ & 7; player_xpos = PAIR16(kSpecifySublevelToLoad_DATA_05D758[v10], kSpecifySublevelToLoad_DATA_05D750[v10]); misc_level_header_entrance_settings = (uint8)(R2_ & 0x38) >> 3; - R2_ = kSpecifySublevelToLoad_DATA_05F400[R14_W]; + R2_ = kSpecifySublevelToLoad_DATA_05F400[r14w]; v10 = R2_ & 3; mirror_current_layer2_ypos = kSpecifySublevelToLoad_DATA_05D70C[v10]; LOBYTE(v10) = (uint8)(R2_ & 0xC) >> 2; mirror_current_layer1_ypos = kSpecifySublevelToLoad_DATA_05D708[v10]; - R1_ = kSpecifySublevelToLoad_DATA_05F600[R14_W]; + R1_ = kSpecifySublevelToLoad_DATA_05F600[r14w]; } if ((misc_level_layout_flags & 1) != 0) { - HIBYTE(player_ypos) = *IndirPtr(&temp65, 0) & 0x1F; + HIBYTE(player_ypos) = *IndirPtr(&ptr_layer1_data, 0) & 0x1F; camera_last_screen_vert = HIBYTE(player_ypos) + 1; flag_layer1_vert_scroll_level_setting = 1; } @@ -2287,7 +2318,7 @@ void SpecifySublevelToLoad() { // 05d796 uint8 v11; if (ow_level_number_lo < 0x52) { v11 = 4; - int8 v12 = *IndirPtr(&temp65, 4) & 0xF; + uint8 v12 = *IndirPtr(&ptr_layer1_data, 4) & 0xF; while (v12 != kSpecifySublevelToLoad_LevelEntranceTileset[v11]) { if ((--v11 & 0x80) != 0) goto LABEL_47; @@ -2307,22 +2338,18 @@ void SpecifySublevelToLoad() { // 05d796 LOBYTE(mirror_current_layer1_ypos) = -64; LOBYTE(mirror_current_layer2_ypos) = -64; misc_level_header_entrance_settings = 0; - ptr_sprite_list_data = 0xc3ee; - ptr_sprite_list_data_bank = 7; - sprites_sprite_memory_setting = *IndirPtr(&ptr_sprite_list_data, 0) & 0x3F; - sprites_sprite_buoyancy_settings = *IndirPtr(&ptr_sprite_list_data, 0) & 0xC0; + ptr_sprite_list_data.addr = 0xc3ee; + ptr_sprite_list_data.bank = 7; + uint8 sprite_hdr = *IndirPtr(&ptr_sprite_list_data, 0); + sprites_sprite_memory_setting = sprite_hdr & 0x3F; + sprites_sprite_buoyancy_settings = sprite_hdr & 0xC0; flag_layer2_horiz_scroll_level_setting = 0; flag_layer2_vert_scroll_level_setting = 0; flag_layer1_horiz_scroll_level_setting = 0; misc_level_layout_flags = 0; misc_level_layer3_settings = kSpecifySublevelToLoad_LevelEntranceLayer3[v11]; - R0_ = v11; - temp65 = *((uint8 *)&kSpecifySublevelToLoad_LevelEntranceLayer1[0].addr + (uint8)(3 * v11)); - temp66 = *((uint8 *)&kSpecifySublevelToLoad_LevelEntranceLayer1[0].addr + (uint8)(3 * v11) + 1); - temp67 = *(&kSpecifySublevelToLoad_LevelEntranceLayer1[0].bank + (uint8)(3 * v11)); - LOBYTE(ptr_layer2_data) = *((uint8 *)&kSpecifySublevelToLoad_LevelEntranceLayer2.addr + (uint8)(3 * v11)); - HIBYTE(ptr_layer2_data) = *((uint8 *)&kSpecifySublevelToLoad_LevelEntranceLayer2.addr + (uint8)(3 * v11) + 1); - ptr_layer2_data_bank = *(&kSpecifySublevelToLoad_LevelEntranceLayer2.bank + (uint8)(3 * v11)); + ptr_layer1_data = kSpecifySublevelToLoad_LevelEntranceLayer1[v11]; + ptr_layer2_data = kSpecifySublevelToLoad_LevelEntranceLayer2[v11]; } misc_level_tileset_setting = kSpecifySublevelToLoad_LevelEntranceTileset[v11]; } @@ -2332,7 +2359,7 @@ void SpecifySublevelToLoad() { // 05d796 } void SpecifySublevelToLoad_HandleChocolateIsland2Gimmick() { // 05daef - int8 v0 = *IndirPtr(&temp65, 4) & 0xC0; + int8 v0 = *IndirPtr(&ptr_layer1_data, 4) & 0xC0; int8 v1 = 2 * (4 * v0 + __CFSHL__(v0, 1)) + __CFSHL__(2 * v0, 1); uint8 v2; if (v1) { @@ -2360,11 +2387,14 @@ void SpecifySublevelToLoad_HandleChocolateIsland2Gimmick() { // 05daef v2 = (counter_yoshi_coins_to_display != 4) ? 2 : 0; } int v3 = v2 >> 1; - *(uint16 *)&temp65 = kSpecifySublevelToLoad_Layer1Ptrs[v3]; - ptr_sprite_list_data = kSpecifySublevelToLoad_SpritePtrs[v3]; - ptr_layer2_data = kSpecifySublevelToLoad_Layer2Ptrs[v3]; - sprites_sprite_memory_setting = *IndirPtr(&ptr_sprite_list_data, 0) & 0x7F; - sprites_sprite_buoyancy_settings = *IndirPtr(&ptr_sprite_list_data, 0) & 0x80; + ptr_layer1_data.addr = kSpecifySublevelToLoad_Layer1Ptrs[v3]; + ptr_sprite_list_data.addr = kSpecifySublevelToLoad_SpritePtrs[v3]; + ptr_layer2_data.addr = kSpecifySublevelToLoad_Layer2Ptrs[v3]; + + uint8 sprite_hdr = *IndirPtr(&ptr_sprite_list_data, 0); + + sprites_sprite_memory_setting = sprite_hdr & 0x7F; + sprites_sprite_buoyancy_settings = sprite_hdr & 0x80; } void SpecifySublevelToLoad_05DBAC() { // 05dbac @@ -2391,24 +2421,30 @@ void LoadOverworldLifeCounter() { // 05dbf2 LOBYTE(stripe_image_upload) = 8; } +static const uint8 kSpr07B_GoalTape_BonusStarsEarned[32] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x40, 0x50, }; +static const uint8 kSpr07B_GoalTape_DATA_07F0C8[108] = { 0x0, 0x8, 0x10, 0x0, 0x10, 0x0, 0x10, 0x0, 0x10, 0x0, 0x8, 0x10, 0xff, 0x8, 0x8, 0x8, 0x8, 0x8, 0xff, 0x0, 0x8, 0x10, 0x10, 0x8, 0x0, 0x0, 0x8, 0x10, 0xff, 0x0, 0x8, 0x10, 0x8, 0x10, 0x10, 0x0, 0x8, 0x10, 0xff, 0x0, 0x0, 0x10, 0x0, 0x10, 0x0, 0x8, 0x10, 0x10, 0xff, 0x0, 0x8, 0x10, 0x0, 0x0, 0x8, 0x10, 0x10, 0x0, 0x8, 0x10, 0xff, 0x8, 0x10, 0x0, 0x0, 0x8, 0x10, 0x0, 0x10, 0x0, 0x8, 0x10, 0xff, 0x0, 0x8, 0x10, 0x10, 0xc, 0x8, 0x8, 0xff, 0x0, 0x8, 0x10, 0x0, 0x10, 0x0, 0x8, 0x10, 0x0, 0x10, 0x0, 0x8, 0x10, 0xff, 0x0, 0x8, 0x10, 0x0, 0x10, 0x0, 0x8, 0x10, 0x10, 0x0, 0x8, 0x10, 0xff, }; +static const uint8 kSpr07B_GoalTape_DATA_07F134[108] = { 0x0, 0x0, 0x0, 0x8, 0x8, 0x10, 0x10, 0x18, 0x18, 0x20, 0x20, 0x20, 0xff, 0x0, 0x8, 0x10, 0x18, 0x20, 0xff, 0x0, 0x0, 0x0, 0x8, 0x10, 0x18, 0x20, 0x20, 0x20, 0xff, 0x0, 0x0, 0x8, 0x10, 0x10, 0x18, 0x20, 0x20, 0x20, 0xff, 0x0, 0x8, 0x8, 0x10, 0x10, 0x18, 0x18, 0x18, 0x20, 0xff, 0x0, 0x0, 0x0, 0x8, 0x10, 0x10, 0x10, 0x18, 0x20, 0x20, 0x20, 0xff, 0x0, 0x0, 0x8, 0x10, 0x10, 0x10, 0x18, 0x18, 0x20, 0x20, 0x20, 0xff, 0x0, 0x0, 0x0, 0x8, 0x10, 0x18, 0x20, 0xff, 0x0, 0x0, 0x0, 0x8, 0x8, 0x10, 0x10, 0x10, 0x18, 0x18, 0x20, 0x20, 0x20, 0xff, 0x0, 0x0, 0x0, 0x8, 0x8, 0x10, 0x10, 0x10, 0x18, 0x20, 0x20, 0x20, 0xff, }; +static const uint8 kSpr07B_GoalTape_DATA_07F1A0[10] = { 0x0, 0xd, 0x13, 0x1d, 0x27, 0x31, 0x3d, 0x49, 0x51, 0x5f, }; +static const uint8 kSpr07B_GoalTape_DATA_07F24E[4] = { 0x66, 0x66, 0x6e, 0xff, }; + void Spr07B_GoalTape_BonusStarNumbersDraw(uint8 k) { // 07f1ca - R4_ = spr_decrementing_table1540[k]; - R2_ = 0; + uint16 R4_ = spr_decrementing_table1540[k]; + uint8 R2_ = 0; uint8 v2 = kSpr07B_GoalTape_BonusStarsEarned[spr_table1594[k] >> 2]; if (v2 >> 4) - Spr07B_GoalTape_07F200(kSpr07B_GoalTape_DATA_07F1A0[v2 >> 4], 0x20); + Spr07B_GoalTape_07F200(kSpr07B_GoalTape_DATA_07F1A0[v2 >> 4], 0x20, R2_, R4_); uint8 v1 = kSpr07B_GoalTape_DATA_07F1A0[v2 & 0xF]; R2_ = 32; - Spr07B_GoalTape_07F200(v1, 0x54); + Spr07B_GoalTape_07F200(v1, 0x54, R2_, R4_); } -uint8 Spr07B_GoalTape_07F200(uint8 k, uint8 j) { // 07f200 +uint8 Spr07B_GoalTape_07F200(uint8 k, uint8 j, uint16 R2, uint16 R4_) { // 07f200 while (1) { int8 v2 = kSpr07B_GoalTape_DATA_07F0C8[k]; if (v2 < 0) break; OamEnt *oam = get_OamEnt(oam_buf, j); - oam->xpos = R2_ + v2 + 100; + oam->xpos = R2 + v2 + 100; oam->ypos = kSpr07B_GoalTape_DATA_07F134[k] + 64; uint8 v4 = -17; if (R4_ < 0x10) diff --git a/src/smw_07.c b/src/smw_07.c index 67a12c2..7a0a95c 100644 --- a/src/smw_07.c +++ b/src/smw_07.c @@ -2,6 +2,16 @@ #include "funcs.h" #include "smw_rtl.h" #include "variables.h" + +static const uint8 kInitializeNormalSpriteRAMTables_Sprite1656Vals[201] = { 0x70, 0x70, 0x70, 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0, 0x10, 0x10, 0x10, 0x14, 0x0, 0x0, 0x0, 0x0, 0x10, 0x10, 0x11, 0x81, 0x10, 0x10, 0x80, 0x11, 0x11, 0x82, 0x0, 0x13, 0x13, 0x13, 0x13, 0x1, 0x0, 0x0, 0x0, 0x81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x80, 0x0, 0x0, 0x0, 0x7, 0x7, 0x7, 0x0, 0x0, 0x30, 0x30, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x0, 0x10, 0x10, 0x8c, 0x8c, 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0xb, 0xb, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x19, 0x30, 0xa, 0x10, 0x10, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x70, 0x10, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, }; +static const uint8 kInitializeNormalSpriteRAMTables_Sprite1662Vals[201] = { 0x0, 0x0, 0x0, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0xa, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x80, 0x80, 0x81, 0x1, 0x80, 0x80, 0x0, 0x81, 0x81, 0x0, 0x0, 0x81, 0x81, 0x81, 0x81, 0x6, 0x0, 0x7, 0x6, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x37, 0x0, 0x37, 0x0, 0x0, 0x9, 0x1, 0x0, 0x0, 0x0, 0xe, 0xe, 0xe, 0x0, 0x0, 0x0, 0x0, 0xf, 0xf, 0x10, 0x14, 0x0, 0xd, 0x80, 0x0, 0x1d, 0x0, 0x80, 0x80, 0x80, 0x80, 0x0, 0x0, 0x80, 0x2, 0xc, 0x3, 0x5, 0x4, 0x5, 0x4, 0x0, 0x0, 0x4, 0x5, 0x4, 0x5, 0x0, 0x1d, 0xc, 0x4, 0x4, 0x12, 0x20, 0x21, 0x2c, 0x34, 0x4, 0x4, 0x4, 0x4, 0xc, 0x16, 0x0, 0x17, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1e, 0x35, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0xc, 0xc, 0x0, 0x0, 0x3a, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, 0x1c, 0x8, 0x38, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0x0, 0xd, 0x80, 0x1d, 0x0, 0x0, 0xb6, 0x24, 0x23, 0x3b, 0x1f, 0x22, 0x0, 0x27, 0x0, 0x0, 0x28, 0x0, 0x2a, 0x2b, 0x2b, 0x0, 0x0, 0x0, 0xc, 0x0, 0x2d, 0x0, 0x0, 0x0, 0x2e, 0x2e, 0xc, 0x1d, 0x2f, 0xc, 0x0, 0x80, 0x30, 0x32, 0x31, 0x0, 0x0, 0x33, 0x7, 0xff, 0x0, 0xc, }; +static const uint8 kInitializeNormalSpriteRAMTables_Sprite166EVals[201] = { 0xa, 0x8, 0x6, 0x4, 0xa, 0x8, 0x6, 0x4, 0xa, 0xa, 0x8, 0x8, 0x4, 0x17, 0x32, 0x4, 0x4, 0x1d, 0x3d, 0x9, 0x9, 0x45, 0x45, 0x85, 0x85, 0xb, 0x8, 0x1, 0x12, 0x15, 0x9, 0x4f, 0x1c, 0x24, 0xb, 0x9, 0xb, 0x9, 0x33, 0x33, 0xfd, 0x2b, 0x8, 0x35, 0x3b, 0x3a, 0x19, 0x3a, 0x13, 0x13, 0x13, 0x34, 0x39, 0x2a, 0x15, 0xf3, 0xfd, 0xfd, 0x37, 0x37, 0x37, 0xc7, 0x30, 0x5, 0x15, 0x37, 0x37, 0x37, 0x33, 0x30, 0x8b, 0x85, 0x1d, 0x3b, 0x3b, 0x9, 0x34, 0x1, 0x1, 0x8, 0x8, 0x9, 0x20, 0x30, 0x20, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe1, 0xe1, 0xeb, 0xeb, 0xe3, 0xe3, 0xe3, 0xe1, 0xe1, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xe3, 0xf0, 0xe3, 0xf3, 0x3f, 0x3f, 0xf, 0x35, 0xb, 0x9, 0x7, 0x8, 0xa, 0x20, 0x24, 0xa, 0x3a, 0x3a, 0x20, 0x20, 0x21, 0x28, 0x20, 0x20, 0x0, 0x20, 0x20, 0x20, 0x20, 0xf5, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, 0x3b, 0xf3, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0x9b, 0x93, 0x0, 0x30, 0x31, 0x31, 0x31, 0xfb, 0xfb, 0xbb, 0xe3, 0xf3, 0x35, 0x35, 0x39, 0x35, 0x35, 0x7d, 0x7, 0x37, 0x37, 0x3d, 0x3f, 0x3f, 0x30, 0x31, 0x31, 0x31, 0x4, 0x35, 0x3b, 0x3b, 0x36, 0x7b, 0x3b, 0x33, 0x6, 0xb, 0x11, 0xf5, 0xf5, 0xcb, 0xcd, 0xf3, 0x3f, 0xff, 0x20, 0x38, }; +static const uint8 kInitializeNormalSpriteRAMTables_Sprite167AVals[201] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x2, 0x18, 0x0, 0x0, 0x81, 0x0, 0x1, 0x99, 0x99, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0xc2, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x83, 0x0, 0x0, 0x9a, 0x1e, 0x1, 0xbe, 0x81, 0x81, 0x81, 0x2, 0x18, 0x87, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x3e, 0x1, 0x1, 0x82, 0x82, 0x82, 0x1, 0x2, 0x81, 0x0, 0x0, 0xa2, 0x82, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa2, 0x8, 0x2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0x22, 0x22, 0x22, 0x22, 0xa2, 0xa2, 0xa2, 0xa2, 0xe2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0x82, 0x82, 0xa2, 0xa2, 0x9a, 0x80, 0x82, 0x3e, 0xc2, 0x82, 0x82, 0x82, 0x92, 0x80, 0x82, 0x82, 0x82, 0x2, 0x2, 0x2, 0x2, 0xa2, 0xa2, 0x1, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0x1, 0x1, 0x1, 0xa2, 0x81, 0x0, 0x1, 0x80, 0x0, 0x19, 0xa2, 0x1, 0x1, 0x1, 0x0, 0x0, 0x81, 0x1, 0x81, 0x81, 0x81, 0x0, 0x1, 0x1, 0xa2, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa0, 0x1, 0x1, 0xa1, 0xa2, 0xa2, 0x1, 0x1, 0xa2, 0xa3, 0xff, 0x82, 0xa2, }; +static const uint8 kInitializeNormalSpriteRAMTables_Sprite1686Vals[201] = { 0x0, 0x0, 0x0, 0x0, 0x2, 0x2, 0x2, 0x2, 0x42, 0x52, 0x52, 0x52, 0x52, 0x0, 0x9, 0x0, 0x40, 0x0, 0x1, 0x0, 0x0, 0x10, 0x10, 0x90, 0x90, 0x1, 0x10, 0x10, 0x90, 0x0, 0x11, 0x1, 0x1, 0x8, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x19, 0x80, 0x0, 0x39, 0x9, 0x9, 0x10, 0xa, 0x9, 0x9, 0x9, 0x99, 0x18, 0x29, 0x8, 0x19, 0x19, 0x19, 0x11, 0x11, 0x15, 0x10, 0xa, 0x40, 0x40, 0x8d, 0x8d, 0x8d, 0x11, 0x18, 0x11, 0x80, 0x0, 0x29, 0x29, 0x10, 0x10, 0x10, 0x10, 0x0, 0x0, 0x10, 0x29, 0x20, 0x29, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0x29, 0x29, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x29, 0x19, 0x29, 0x29, 0x59, 0x59, 0x18, 0x18, 0x10, 0x10, 0x50, 0x28, 0x28, 0x28, 0x28, 0x8, 0x29, 0x29, 0x39, 0x39, 0x29, 0x28, 0x28, 0x3a, 0x28, 0x29, 0x31, 0x31, 0x29, 0x0, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x29, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x11, 0x1, 0x39, 0x10, 0x19, 0x19, 0x19, 0x19, 0x1, 0x29, 0x98, 0x14, 0x14, 0x10, 0x18, 0x18, 0x18, 0x0, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1d, 0x1d, 0x19, 0x19, 0x18, 0x18, 0x19, 0x19, 0x19, 0x1d, 0x19, 0x18, 0x0, 0x10, 0x0, 0x99, 0x99, 0x10, 0x90, 0xa9, 0xb9, 0xff, 0x39, 0x19, }; +const uint8 kInitializeNormalSpriteRAMTables_Sprite190FVals[201] = { 0x0, 0x0, 0x0, 0x0, 0xa0, 0xa0, 0xa0, 0xa0, 0xb0, 0xb0, 0xb0, 0xb0, 0xa0, 0x80, 0x44, 0x80, 0x80, 0x80, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x20, 0x0, 0x0, 0x0, 0x60, 0x20, 0x4, 0x4, 0x20, 0x20, 0x20, 0x20, 0x24, 0x4, 0x0, 0x44, 0x20, 0x4, 0x44, 0xc4, 0x0, 0xc4, 0x24, 0x24, 0x24, 0x4, 0x4, 0x46, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x0, 0xc4, 0x0, 0x0, 0x5, 0x5, 0x5, 0x4, 0x44, 0x48, 0x0, 0x0, 0x40, 0x40, 0x40, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x64, 0xc4, 0x64, 0x45, 0x65, 0x45, 0x65, 0x45, 0x45, 0x45, 0x45, 0x65, 0x65, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x5, 0x5, 0x44, 0x44, 0x44, 0x44, 0x46, 0x0, 0x0, 0x0, 0x10, 0x10, 0x10, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x40, 0x40, 0x40, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x1, 0x0, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x0, 0x40, 0x40, 0x40, 0x0, 0x4, 0x4, 0x40, 0x40, 0x0, 0x41, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x41, 0x41, 0x40, 0x41, 0x40, 0x0, 0x0, 0x0, 0x20, 0x47, 0x45, 0x0, 0x0, 0x41, 0x41, 0xff, 0x40, 0x40, }; +static const uint8 kSpawnSpinJumpStars_InitialXSpeed[4] = { 0xe0, 0x20, 0xe0, 0x20, }; +static const uint8 kSpawnSpinJumpStars_InitialYSpeed[4] = { 0xf0, 0xf0, 0x10, 0x10, }; + void InitializeNormalSpriteRAMTables_ClearTables(uint8 k) { // 07f722 spr_table164a[k] = 0; spr_table1632[k] = 0; diff --git a/src/smw_0c.c b/src/smw_0c.c index 2ce134b..89bcd49 100644 --- a/src/smw_0c.c +++ b/src/smw_0c.c @@ -70,6 +70,95 @@ void (*kGameMode19_Cutscene_Ptrs0CCA79[5])(void) = { &CheckIfPlayerCanEndCastleDestructionCutscene, }; +static const uint16 kBufferCreditsBackgrounds_Layer2Pointers[7] = { 0xf45a, 0xe7c0, 0xec82, 0xdd44, 0xd900, 0xdf59, 0xde54, }; +static const uint16 kBufferCreditsBackgrounds_TilePageModifier[7] = { 0xffff, 0xfeff, 0xfeff, 0xfeff, 0xffff, 0xfeff, 0xfeff, }; +static const uint8 kUpdateCreditsBackground_PARAMS_0C9559[7] = { 0x1, 0x18, 0x0, 0x40, 0x7f, 0x0, 0x4, }; +static const uint8 kUpdateCreditsBackground_PARAMS_0C9560[7] = { 0x1, 0x18, 0x0, 0x44, 0x7f, 0x0, 0x4, }; +static const uint8 kGameMode1B_EndingCinema_DATA_0C9EAC[5] = { 0x40, 0x3e, 0xfc, 0x0, 0xff, }; +static const uint16 kGameMode1B_EndingCinema_BackgroundChangeHeight[7] = { 0xc0, 0x180, 0x240, 0x300, 0x3c0, 0x480, 0x559, }; +static const uint8 kGameMode1B_EndingCinema_PeachOnYoshiOffset[3] = { 0x0, 0xff, 0x0, }; +static const uint8 kInitializeCreditsEggPositions_InitialXPos[7] = { 0x63, 0x73, 0x83, 0x93, 0xa3, 0xb3, 0xc3, }; +static const uint8 kInitializeCreditsEggPositions_InitialYPos[7] = { 0xa0, 0x9c, 0xa0, 0x9c, 0xa0, 0x9c, 0xa0, }; +static const uint8 kGameMode1D_LoadYoshisHouse_Tiles[42] = { 0xff, 0x2, 0x4, 0x6, 0x8, 0x6, 0x8, 0x6, 0x8, 0x6, 0x8, 0x4, 0x2, 0xff, 0x20, 0x22, 0x24, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x24, 0x22, 0x20, 0x40, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x42, 0x40, }; +static const uint8 kGameMode1D_LoadYoshisHouse_Prop[42] = { 0xff, 0x37, 0x37, 0x35, 0x35, 0x37, 0x37, 0x39, 0x39, 0x3b, 0x3b, 0x77, 0x77, 0xff, 0x37, 0x37, 0x37, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x37, 0x37, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x77, }; +static const uint8 kDrawEndingThankYou_Tiles[16] = { 0x26, 0x28, 0x2a, 0x2c, 0x46, 0x48, 0x4a, 0x4c, 0x60, 0x62, 0x64, 0x66, 0x6a, 0x6c, 0x6e, 0xa, }; +static const uint8 kProcessCheeringYoshis_DATA_0CA30D[4] = { 0x0, 0x1, 0x2, 0x1, }; +static const uint8 kProcessCheeringYoshis_DATA_0CA311[4] = { 0x0, 0x1, 0x1, 0x1, }; +static const uint8 kGameMode1D_LoadYoshisHouse_EggInitialXPos[7] = { 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xa0, }; +static const uint8 kGameMode1D_LoadYoshisHouse_EggInitialYPos[7] = { 0xaf, 0xab, 0xaf, 0xab, 0xaf, 0xab, 0xaf, }; +static const uint8 kGameMode1D_LoadYoshisHouse_EggYSpeed[7] = { 0xf6, 0x0, 0xf6, 0x0, 0xf6, 0x0, 0xf6, }; +static const uint8 kYoshisWatchInExcitementDuringEnding_DATA_0CA439[3] = { 0x0, 0x2, 0x2, }; +static const uint8 kHatchYoshiEggsDuringEnding_DATA_0CA524[7] = { 0x20, 0x1, 0x10, 0x40, 0x8, 0x2, 0x4, }; +static const uint8 kHatchYoshiEggsDuringEnding_DATA_0CA52B[7] = { 0x10, 0x60, 0x20, 0x0, 0x30, 0x50, 0x40, }; +static const uint8 kHatchYoshiEggsDuringEnding_DATA_0CA5D2[4] = { 0xc8, 0xc8, 0xd8, 0xd8, }; +static const uint8 kHatchYoshiEggsDuringEnding_DATA_0CA5D6[4] = { 0x26, 0x66, 0x26, 0x66, }; +static const uint8 kHatchYoshiEggsDuringEnding_DATA_0CA5DA[4] = { 0xe8, 0x18, 0xf4, 0xc, }; +static const uint16 kDrawCreditsPeachRedAndYellowYoshi_DATA_0CA7B9[26] = { 0x6463, 0x6968, 0x6463, 0x6968, 0x4c4b, 0x6c6b, 0x8b8a, 0x68aa, 0x8e8d, 0xaead, 0x8a, 0x44aa, 0xe8a, 0x2eaa, 0x8081, 0xa0a1, 0x8384, 0xa3a4, 0x8687, 0xa6a7, 0x8180, 0xa1a0, 0x8483, 0xa4a3, 0x8786, 0xa7a6, }; +static const uint16 kDrawCreditsPeachRedAndYellowYoshi_DATA_0CA7ED[26] = { 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2020, 0x2020, 0x2121, 0x2121, 0x2121, 0x2121, 0x7878, 0x7878, 0x7878, 0x7878, 0x7878, 0x7878, 0x3434, 0x3434, 0x3434, 0x3434, 0x3434, 0x3434, }; +static const uint8 kDrawEndingBabyYoshis_BabyYoshiProp[7] = { 0x68, 0x26, 0x24, 0x6a, 0x28, 0x64, 0x26, }; +static const uint16 kDrawLeaningEndingYoshis_DATA_0CA93A[12] = { 0xb9bb, 0xdbdc, 0xd9da, 0x898b, 0xabac, 0xa9aa, 0xbbb9, 0xdad9, 0xdcdb, 0x8b89, 0xaaa9, 0xacab, }; +static const uint16 kDrawLeaningEndingYoshis_DATA_0CA952[12] = { 0x7878, 0x7878, 0x7878, 0x7878, 0x7878, 0x7878, 0x3434, 0x3434, 0x3434, 0x3434, 0x3434, 0x3434, }; +static const uint16 kDrawLeaningEndingYoshis_DATA_0CA96A[12] = { 0x1000, 0x800, 0x1810, 0x1000, 0x800, 0x1810, 0x1000, 0x800, 0x1810, 0x1000, 0x800, 0x1810, }; +static const uint16 kDrawLeaningEndingYoshis_DATA_0CA982[12] = { 0x0, 0x1010, 0x1010, 0x0, 0x1010, 0x1010, 0x0, 0x1010, 0x1010, 0x0, 0x1010, 0x1010, }; +static const uint8 kDrawLeaningEndingYoshis_DATA_0CA99A[4] = { 0x0, 0x6, 0xc, 0x12, }; +static const uint8 kDrawCameraFacingEndingYoshis_Tiles[6] = { 0xc4, 0xe4, 0xe6, 0xe8, 0xce, 0xee, }; +static const uint8 kDrawCameraFacingEndingYoshis_Prop[4] = { 0x36, 0x36, 0x3a, 0x3a, }; +static const uint8 kDrawingTheEndMarioLuigiAndPeach_TileData[140] = { 0x53, 0x6a, 0x80, 0x3c, 0x63, 0x6a, 0x82, 0x3c, 0x53, 0x7a, 0xa0, 0x3c, 0x63, 0x7a, 0xa2, 0x3c, 0x53, 0x8a, 0x84, 0x3c, 0x63, 0x8a, 0x86, 0x3c, 0x53, 0x9a, 0xa4, 0x3c, 0x63, 0x9a, 0xa6, 0x3c, 0x53, 0xaa, 0x88, 0x3c, 0x63, 0xaa, 0x8a, 0x3c, 0x8d, 0x5a, 0xa8, 0x3a, 0x9d, 0x5a, 0xaa, 0x3a, 0x8d, 0x6a, 0x8c, 0x3a, 0x9d, 0x6a, 0x8e, 0x3a, 0x8d, 0x7a, 0xac, 0x3a, 0x9d, 0x7a, 0xae, 0x3a, 0x8d, 0x8a, 0x63, 0x3a, 0x9d, 0x8a, 0x65, 0x3a, 0x8d, 0x9a, 0x48, 0x3a, 0x9d, 0x9a, 0x68, 0x3a, 0x8d, 0xaa, 0x6b, 0x3a, 0x9d, 0xaa, 0x6d, 0x3a, 0x78, 0x58, 0x4d, 0x3e, 0x70, 0x68, 0xe0, 0x3f, 0x80, 0x68, 0xc4, 0x3f, 0x70, 0x78, 0x4a, 0x3f, 0x80, 0x78, 0x4c, 0x3f, 0x70, 0x88, 0x6a, 0x3f, 0x80, 0x88, 0x6c, 0x3f, 0x68, 0x98, 0xab, 0x3f, 0x78, 0x98, 0xc8, 0x3f, 0x88, 0x98, 0xe6, 0x3f, 0x68, 0xa8, 0xe8, 0x3f, 0x78, 0xa8, 0xea, 0x3f, 0x88, 0xa8, 0xec, 0x3f, }; +static const uint8 kCreditsFadeOut_DATA_0CAB1B[2] = { 0xfe, 0x2, }; +static const uint8 kCreditsFadeOut_DATA_0CAB1D[2] = { 0x0, 0xe0, }; +static const uint8 kCreditsFadeOut_BGPaletteIndex[8] = { 0x0, 0x18, 0x30, 0x48, 0x60, 0x78, 0x90, 0xa8, }; +static const uint8 kCreditsFadeOut_SkyColorSetting[7] = { 0x6, 0x0, 0x0, 0x2, 0x5, 0x6, 0x0, }; +static const uint8 kCreditsFadeOut_BGPaletteSetting[7] = { 0x3, 0x3, 0x7, 0x0, 0x1, 0x2, 0x0, }; +static const uint16 kGetLayer1And2PointersForEnemyRollcall_Layer1Ptrs[13] = { 0xac29, 0xac3e, 0xac53, 0xac77, 0xac9e, 0xacc8, 0xacda, 0xacef, 0xad04, 0xad1f, 0xad31, 0xad3d, 0xad52, }; +static const uint16 kGetLayer1And2PointersForEnemyRollcall_Layer2Ptrs[13] = { 0xec82, 0xdd44, 0xdf59, 0xd900, 0xde54, 0xe8fe, 0xdab9, 0xef80, 0xf45a, 0xe103, 0xf45a, 0xe103, 0xad52, }; +static const uint8 kInitializeEnemyRollcallLayerPositions_DATA_0CADB5[13] = { 0x28, 0x28, 0x44, 0x28, 0x38, 0x20, 0x28, 0x20, 0x8, 0x28, 0x7c, 0x68, 0x28, }; +static const uint16 kInitializeEnemyRollcallLayerPositions_InitialLayer2YPos[13] = { 0x0, 0x88, 0xe0, 0xc0, 0xe8, 0x0, 0xa0, 0x50, 0xb0, 0xe0, 0x18, 0xe0, 0x0, }; +static const uint16 kInitializeEnemyRollcallLayerPositions_SpecialWorldEnemyNamePtrs[13] = { 0xfe49, 0xfe4b, 0xfe5f, 0xfe71, 0xfe73, 0xfe8f, 0xfe91, 0xfe93, 0xfe95, 0xfe97, 0xfe99, 0xfe9b, 0xfe9d, }; +#define kGameMode25_ShowEnemyRollcallScreen_TileData ((uint8*)RomFixedPtr(0xCAF11)) +static const uint16 kGameMode25_ShowEnemyRollcallScreen_EnemyRollcallSpriteDataPtrs[13] = { 0x2fc, 0x11c, 0x1c1, 0x222, 0x0, 0x45, 0x28b, 0x395, 0x9e, 0x42a, 0x493, 0xe7, 0x4fc, }; +static const uint8 kDrawThankYouSpeechBubble_TileData[12] = { 0x20, 0x48, 0xa6, 0x18, 0x30, 0x48, 0xa8, 0x18, 0x28, 0x58, 0x8d, 0x8, }; +static const uint8 kDrawCastleDestructionCastleDoor_Tiles[4] = { 0x86, 0x87, 0x96, 0x97, }; +static const uint8 kHandleTNTExplosion_DATA_0CCC49[4] = { 0x3, 0x1, 0x3, 0x1, }; +static const uint16 kHandleTNTExplosion_DATA_0CCC4D[2] = { 0x7393, 0x7fff, }; +static const uint8 kHandleTNTExplosion_DATA_0CCC9F[18] = { 0xa0, 0xa4, 0x0, 0xc0, 0xc4, 0x0, 0xa0, 0xa2, 0xa4, 0xc0, 0xc2, 0xc4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; +static const uint8 kHandleTNTExplosion_DATA_0CCCB1[5] = { 0x0, 0x6, 0xc, 0x6, 0xc, }; +static const uint8 kHandleCastleLiftoff_CastleDustTiles[8] = { 0x80, 0x81, 0x82, 0x83, 0x83, 0x82, 0x81, 0x80, }; +static const uint8 kHandleCastleLiftoff_RocketFlameTiles[4] = { 0xc6, 0xc8, 0xc6, 0xc8, }; +static const uint8 kHandleCastleLiftoff_RocketFlameProp[4] = { 0x25, 0x25, 0x65, 0x65, }; +static const uint8 kHandleFarawayCastleRocket_DATA_0CCED4[7] = { 0x2, 0xff, 0x2, 0x3, 0x4, 0x5, 0x6, }; +static const uint8 kHandleFarawayCastleRocket_DATA_0CCEDB[7] = { 0x3, 0x1, 0x7, 0x7, 0x7, 0x7, 0x7, }; +static const uint8 kHandleFarawayCastleRocket_Tiles[7] = { 0xb7, 0xb8, 0x89, 0x99, 0xa9, 0xb9, 0xe8, }; +static const uint8 kHandleFarawayCastleRocket_Prop[7] = { 0x25, 0x25, 0x23, 0x23, 0x23, 0x23, 0x23, }; +static const uint8 kHandleDudTNTExplosion_TilesAndProp[4] = { 0x60, 0x62, 0x64, 0x66, }; +static const uint8 kDrawCutsceneContactEffect_Tiles[4] = { 0x7c, 0x7d, 0x7d, 0x7c, }; +static const uint8 kDrawCutsceneContactEffect_Prop[4] = { 0x30, 0x30, 0xf0, 0xf0, }; +static const uint8 kHandleCastleCrumblingDown_RubbleTiles[41] = { 0x20, 0xb3, 0x0, 0xf, 0xc0, 0x1, 0xc1, 0x1, 0xc2, 0x1, 0xc3, 0x1, 0xc4, 0x1, 0xc5, 0x1, 0xc1, 0x41, 0xc0, 0x41, 0x20, 0xd3, 0x0, 0xf, 0xd0, 0x1, 0xd1, 0x1, 0xd2, 0x1, 0xd3, 0x1, 0xd4, 0x1, 0xd5, 0x1, 0xd1, 0x41, 0xd0, 0x41, 0xff, }; +static const uint8 kProcessMop_DATA_0CD1F0[13] = { 0x20, 0xf4, 0x40, 0x2, 0xf8, 0x0, 0x21, 0x14, 0x40, 0x2, 0xf8, 0x0, 0xff, }; +static const uint16 kProcessMop_DATA_0CD1FD[24] = { 0xf420, 0x1421, 0x3421, 0x5421, 0x7421, 0x9421, 0xb421, 0xd421, 0xf620, 0x1621, 0x3621, 0x5621, 0x7621, 0x9621, 0xb621, 0xd621, 0xf820, 0x1821, 0x3821, 0x5821, 0x7821, 0x9821, 0xb821, 0xd821, }; +static const uint8 kSpawnHammerDebris_YSpeed[16] = { 0xc8, 0xc0, 0xc4, 0xc8, 0xc0, 0xb4, 0xc8, 0xb8, 0xc6, 0xb7, 0xc4, 0xb0, 0xc8, 0xc0, 0xc8, 0xc4, }; +static const uint8 kSpawnHammerDebris_XSpeed[16] = { 0x18, 0xf8, 0xa, 0x20, 0xe8, 0x1a, 0xea, 0x8, 0xf0, 0x18, 0xe0, 0x2a, 0xf8, 0x20, 0xfa, 0x18, }; +static const uint8 kProcessHammerDebris_DATA_0CD423[2] = { 0x3c, 0x3d, }; +static const uint8 kDrawQuestionMark_YDisp[32] = { 0xf8, 0x80, 0x80, 0x80, 0xfa, 0x80, 0x80, 0x80, 0xfa, 0xfc, 0x80, 0x80, 0xfa, 0xfc, 0x4, 0x80, 0xf8, 0x80, 0x80, 0x80, 0xf9, 0x80, 0x80, 0x80, 0xfa, 0x80, 0x80, 0x80, 0xfa, 0x80, 0x80, 0x80, }; +static const uint8 kDrawQuestionMark_XDisp[32] = { 0x8, 0x80, 0x80, 0x80, 0x9, 0x80, 0x80, 0x80, 0x9, 0xff, 0x80, 0x80, 0x9, 0xff, 0xf6, 0x80, 0x4, 0x80, 0x80, 0x80, 0x0, 0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0x0, 0x80, 0x80, 0x80, }; +static const uint8 kDrawPlayerCough_Tiles[4] = { 0x89, 0x99, 0xa9, 0xb9, }; +static const uint8 kDrawWoodHammer_HammerSwingPlayerPoses[16] = { 0x35, 0x36, 0x36, 0x36, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x36, 0x36, 0x35, 0x35, 0x35, }; +static const uint8 kDrawWoodHammer_Tiles[19] = { 0x8b, 0x8b, 0x8b, 0xaa, 0x8a, 0xce, 0xce, 0x8a, 0x8a, 0xaa, 0xaa, 0x8a, 0xaa, 0x8a, 0xce, 0x8a, 0xaa, 0x8a, 0x8a, }; +static const uint8 kDrawWoodHammer_Prop[19] = { 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x21, 0x21, 0x21, 0x21, 0xa1, 0x21, 0x21, 0x61, 0x61, 0x61, 0xe1, 0xe1, }; +static const uint8 kDrawWoodHammer_XDisp[38] = { 0xfa, 0xfa, 0xf9, 0xfb, 0xf9, 0xfa, 0xf0, 0xf0, 0xf4, 0xf4, 0xfd, 0xff, 0xfd, 0xff, 0xa, 0xd, 0xa, 0xd, 0xe, 0x10, 0xe, 0x10, 0xd, 0xe, 0xe, 0x10, 0xa, 0xd, 0xfd, 0xff, 0xf4, 0xf4, 0xf0, 0xf0, 0xf3, 0xf0, 0xf3, 0xf0, }; +static const uint8 kDrawWoodHammer_YDisp[38] = { 0x6, 0x3, 0x7, 0x0, 0x7, 0x1, 0xd, 0x8, 0x2, 0xfb, 0xff, 0xf6, 0xff, 0xf6, 0x3, 0xfd, 0x3, 0xfd, 0xa, 0x6, 0xa, 0x6, 0x12, 0xf, 0xa, 0x6, 0x3, 0xfd, 0xff, 0xf6, 0x2, 0xfb, 0xd, 0x8, 0x15, 0x10, 0x15, 0x10, }; +static const uint8 kProcessMop_DATA_0CD6C4[6] = { 0xe7, 0xe6, 0xe6, 0xea, 0xe6, 0xe7, }; +static const uint8 kProcessMop_DATA_0CD6CA[6] = { 0xf6, 0xf1, 0xf3, 0xf3, 0xf3, 0xf4, }; +static const uint8 kProcessMop_DATA_0CD6D0[3] = { 0x1b, 0xe, 0x0, }; +static const uint8 kProcessMop_DATA_0CD6D3[3] = { 0x15, 0x8, 0x0, }; +static const uint8 kProcessMop_Tiles[3] = { 0x8e, 0x8e, 0x8c, }; +static const uint8 kProcessMop_DATA_0CD6D9[7] = { 0xfc, 0x4, 0xfc, 0x4, 0xfc, 0x4, 0xfc, }; +// todo: oob +static const uint8 kProcessMop_DATA_0CD6E0[7] = { 0x34, 0x68, 0x34, 0x68, 0x34,0x68, 0x34, }; +static const uint8 kProcessMop_DATA_0CD6E5[7] = { 0x68, 0x34, 0xb0, 0x0, 0xc0, 0x0, 0xc0, }; +static const uint8 kCarryEggAwayFromCastle_DATA_0CD7EB[2] = { 0xf7, 0xf6, }; +static const uint8 kCarryEggAwayFromCastle_DATA_0CD7ED[6] = { 0x63, 0x5f, 0x62, 0x5f, 0x62, 0x5e, }; +static const uint8 kCarryEggAwayFromCastle_YDisp[16] = { 0x67, 0x66, 0x65, 0x65, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x65, 0x65, 0x66, 0x67, }; + void GameMode1B_EndingCinema_Bank0C() { // 0c938d GameMode1B_EndingCinema_Sub(); CreditsFadeOut(); @@ -94,121 +183,92 @@ void GameMode21_DelayEnemyRollcall_Bank03() { // 0c93ad void BufferCreditsBackgrounds() { // 0c93dd *(uint16 *)&blocks_screen_to_place_current_object = 0; do { - int v0 = (uint16)(2 * blocks_screen_to_place_current_object) >> 1; - ptr_layer2_data = kBufferCreditsBackgrounds_Layer2Pointers[v0]; - *(uint16 *)&temp65 = kBufferCreditsBackgrounds_TilePageModifier[v0]; - bool v1 = ptr_layer2_data >= 0xE8FE; + int v0 = blocks_screen_to_place_current_object; + uint16 ptr_layer2_data_addr = kBufferCreditsBackgrounds_Layer2Pointers[v0]; + uint16 modifier = kBufferCreditsBackgrounds_TilePageModifier[v0]; + bool v1 = ptr_layer2_data_addr >= 0xE8FE; for (uint16 i = 0; i != 512; ++i) { blocks_layer2_tiles_hi[i] = v1; blocks_layer2_tiles_hi[i + 512] = v1; } - ptr_layer2_data_bank = 12; - *(uint16 *)&R13_ = 0xb900; - BufferCreditsBackgrounds_0C944C(); - BufferCreditsBackgrounds_0C94C0(); + BufferCreditsBackgrounds_0C944C(0xb900, RomPtr_0C(ptr_layer2_data_addr)); + BufferCreditsBackgrounds_0C94C0(modifier); ++*(uint16 *)&blocks_screen_to_place_current_object; } while (*(uint16 *)&blocks_screen_to_place_current_object != 7); - WORD(temp65) = 0x5840; - temp67 = 0; + credits_var65 = 0x5840; + credits_index = 0; blocks_screen_to_place_current_object = 0; UpdateCreditsBackground(); InitializeCreditsEggPositions(); io_music_ch1 = 9; } -void BufferCreditsBackgrounds_0C944C() { // 0c944c - *(uint16 *)&R3_ = 0; - *(uint16 *)&R5_ = 0; - R15_ = 126; +void BufferCreditsBackgrounds_0C944C(uint16 r13w, const uint8 *src) { // 0c944c + uint16 R3 = 0; + uint16 R5 = 0; + uint8 *wp = g_ram + r13w; do { - int16 v0 = *(uint16 *)&R3_; - R7_ = *IndirPtr(&ptr_layer2_data, *(uint16 *)&R3_); + int16 v0 = R3; + uint8 r7 = src[R3]; uint16 v1 = v0 + 1; - *(uint16 *)&R3_ = v1; - if ((R7_ & 0x80) == 0) { + R3 = v1; + if ((r7 & 0x80) == 0) { do { - int16 v4 = *(uint16 *)&R3_; - uint8 v5 = *IndirPtr(&ptr_layer2_data, *(uint16 *)&R3_); - *(uint16 *)&R3_ = v4 + 1; - int16 v6 = *(uint16 *)&R5_; - IndirWriteByte(&R13_, *(uint16 *)&R5_, v5); - *(uint16 *)&R5_ = v6 + 1; - --R7_; - } while ((R7_ & 0x80) == 0); + int16 v4 = R3; + uint8 v5 = src[R3]; + R3 = v4 + 1; + int16 v6 = R5; + wp[R5] = v5; + R5 = v6 + 1; + } while ((--r7 & 0x80) == 0); } else { - R7_ &= ~0x80; - uint8 v2 = *IndirPtr(&ptr_layer2_data, v1); - *(uint16 *)&R3_ = v1 + 1; - uint16 v3 = *(uint16 *)&R5_; + r7 &= ~0x80; + uint8 v2 = src[v1]; + R3 = v1 + 1; + uint16 v3 = R5; do { - IndirWriteByte(&R13_, v3++, v2); - --R7_; - } while ((R7_ & 0x80) == 0); - *(uint16 *)&R5_ = v3; + wp[v3++] = v2; + } while ((--r7 & 0x80) == 0); + R5 = v3; } - } while (*IndirPtr(&ptr_layer2_data, *(uint16 *)&R3_) != 0xFF || *IndirPtr(&ptr_layer2_data, *(uint16 *)&R3_ + 1) != 0xFF); - R0_W = 0x9100; + } while (src[R3] != 0xFF || src[R3 + 1] != 0xFF); + uint16 r0w = 0x9100; for (uint16 i = 0; i != 0x400; i += 2) { - pointer_map16_tiles[i >> 1] = R0_W; - R0_W += 8; + pointer_map16_tiles[i >> 1] = r0w; + r0w += 8; } } -void BufferCreditsBackgrounds_0C94C0() { // 0c94c0 - uint16 v0; +void BufferCreditsBackgrounds_0C94C0(uint16 mask) { // 0c94c0 + const uint8 *p_lo = g_ram + 0xb900; + const uint8 *p_hi = g_ram + 0xbd00; - ptr_lo_map16_data = 0xb900; - ptr_lo_map16_data_bank = 126; - ptr_hi_map16_data_bank = 126; - ptr_hi_map16_data = 0xbd00; - ptr_layer2_data_bank = 13; - R4_W = 240; - HIBYTE(v0) = blocks_screen_to_place_current_object; - LOBYTE(v0) = 0; - R0_W = v0; - R8_W = 127; + uint16 r4w = 240; + uint16 r0w = blocks_screen_to_place_current_object << 8; + uint16 r8w = 127; while (1) { do { - uint16 v1 = R4_W; - R2_ = *IndirPtr(&ptr_lo_map16_data, R4_W); - R3_ = *IndirPtr(&ptr_hi_map16_data, v1); - ptr_layer2_data = pointer_map16_tiles[(uint16)(2 * R2_W) >> 1]; - R6_W = (4 * R0_W) & 0x3F; - uint16 v2 = R6_W | (2 * ((4 * R0_W) & 0xFFC0)); - *(uint16 *)&ow_layer2_tiles[v2] = *(uint16 *)&temp65 & *(uint16 *)IndirPtr(&ptr_layer2_data, 0); - *(uint16 *)&ow_layer2_tiles[v2 + 64] = *(uint16 *)&temp65 & *(uint16 *)IndirPtr(&ptr_layer2_data, 2); - *(uint16 *)&ow_layer2_tiles[v2 + 2] = *(uint16 *)&temp65 & *(uint16 *)IndirPtr(&ptr_layer2_data, 4); - *(uint16 *)&ow_layer2_tiles[v2 + 66] = *(uint16 *)&temp65 & *(uint16 *)IndirPtr(&ptr_layer2_data, 6); - ++R0_W; - ++R4_W; - --R8_W; - } while ((R8_W & 0x8000) == 0); - R8_W = 127; - if (R4_W != 368) + uint16 r2w = p_lo[r4w] | p_hi[r4w] << 8; + const uint8 *p2 = RomPtr_0D(pointer_map16_tiles[r2w]); + uint16 v2 = (4 * r0w) & 0x3F | (2 * ((4 * r0w) & 0xFFC0)); + *(uint16 *)&ow_layer2_tiles[v2] = mask & WORD(p2[0]); + *(uint16 *)&ow_layer2_tiles[v2 + 64] = mask & WORD(p2[2]); + *(uint16 *)&ow_layer2_tiles[v2 + 2] = mask & WORD(p2[4]); + *(uint16 *)&ow_layer2_tiles[v2 + 66] = mask & WORD(p2[6]); + ++r0w; + ++r4w; + --r8w; + } while ((r8w & 0x8000) == 0); + r8w = 127; + if (r4w != 368) break; - R4_W = 672; + r4w = 672; } } void UpdateCreditsBackground() { // 0c9567 - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0xC0); - WriteReg(VMADDH, 0x30); - for (uint8 i = 6; (i & 0x80) == 0; --i) - WriteReg((SnesRegs)(i + 0x4310), kUpdateCreditsBackground_PARAMS_0C9559[i]); - int8 v1 = 8 * blocks_screen_to_place_current_object; - uint8 Reg = ReadReg(A1T1H); - WriteReg(A1T1H, Reg | v1); - WriteReg(MDMAEN, 2); - WriteReg(VMAIN, 0x80); - WriteReg(VMADDL, 0xC0); - WriteReg(VMADDH, 0x34); - for (uint8 j = 6; (j & 0x80) == 0; --j) - WriteReg((SnesRegs)(j + 0x4310), kUpdateCreditsBackground_PARAMS_0C9560[j]); - int8 v4 = 8 * blocks_screen_to_place_current_object; - uint8 v5 = ReadReg(A1T1H); - WriteReg(A1T1H, v5 | v4); - WriteReg(MDMAEN, 2); + SmwCopyToVram(0x30c0, g_ram + (0x14000 | blocks_screen_to_place_current_object << 11), 0x400); + SmwCopyToVram(0x34c0, g_ram + (0x14400 | blocks_screen_to_place_current_object << 11), 0x400); flag_update_credits_background = 0; } @@ -216,56 +276,50 @@ void GameMode1B_EndingCinema_BufferNextRowOfCredits() { // 0c9eb1 uint16 v0 = stripe_image_upload; uint16 v1 = 0; int v2 = stripe_image_upload; - stripe_image_upload_data[stripe_image_upload] = temp66; - stripe_image_upload_data[v2 + 1] = temp65; + WORD(stripe_image_upload_data[v2 + 0]) = swap16(credits_var65); uint16 v3 = v0 + 2; do stripe_image_upload_data[v3++] = kGameMode1B_EndingCinema_DATA_0C9EAC[v1++]; while (v1 != 5); uint16 v4 = v3 - 1; stripe_image_upload = v4; - uint16 v5 = kGameMode1B_EndingCinema_RowPointers[(uint16)(2 * temp67++) >> 1]; + uint16 v5 = kGameMode1B_EndingCinema_RowPointers[credits_index++]; if (kGameMode1B_EndingCinema_Tilemaps[v5] != 0xFF) { - R2_ = kGameMode1B_EndingCinema_Tilemaps[v5]; - R0_ = kGameMode1B_EndingCinema_Tilemaps[v5 + 1]; - R1_ = 0; + uint8 r2 = kGameMode1B_EndingCinema_Tilemaps[v5]; + uint16 r0w = kGameMode1B_EndingCinema_Tilemaps[v5 + 1]; uint16 v6 = v5 + 2; - stripe_image_upload_data[v4] = temp66; - stripe_image_upload_data[v4 + 1] = R2_ + temp65; + WORD(stripe_image_upload_data[v4]) = swap16(credits_var65) + (r2 << 8); uint16 v7 = v4 + 2; - stripe_image_upload_data[v7] = R1_; - stripe_image_upload_data[v7 + 1] = R0_; + WORD(stripe_image_upload_data[v7]) = swap16(r0w); uint16 v8 = v7 + 2; do { *(uint16 *)&stripe_image_upload_data[v8] = *(uint16 *)&kGameMode1B_EndingCinema_Tilemaps[v6]; v8 += 2; v6 += 2; - --R0_W; - --R0_W; - } while ((R0_W & 0x8000) == 0); + r0w -= 2; + } while ((r0w & 0x8000) == 0); *(uint16 *)&stripe_image_upload_data[v8] = 255; stripe_image_upload = v8; } - *(uint16 *)&temp65 += 32; - if ((*(uint16 *)&temp65 & 0x3FF) == 0) - *(uint16 *)&temp65 ^= 0xC00; + credits_var65 += 32; + if ((credits_var65 & 0x3FF) == 0) + credits_var65 ^= 0xC00; } void GameMode1B_EndingCinema_Sub() { // 0c9f6a get_PointU16(l1_l2_scroll_spr_speed, 0)->x = -128; - R0_W = mirror_current_layer2_xpos; - GameMode1B_EndingCinema_0C9FCB(0); - mirror_current_layer2_xpos = R0_W; + uint16 r0w = mirror_current_layer2_xpos; + r0w += GameMode1B_EndingCinema_0C9FCB(0); + mirror_current_layer2_xpos = r0w; if (mirror_layer3_ypos < 0x559) { get_PointU16(l1_l2_scroll_spr_speed, 2)->x = 64; - uint16 v0 = mirror_layer3_ypos; - *(&R0_W + 1) = mirror_layer3_ypos; - R4_W = v0; - GameMode1B_EndingCinema_0C9FCB(2); - uint16 v1 = *(&R0_W + 1); - if (v1 != R4_W) { - mirror_layer3_ypos = *(&R0_W + 1); - if ((v1 & 7) == 1) + uint16 r1w = mirror_layer3_ypos; + uint16 r4w = mirror_layer3_ypos; + r4w += GameMode1B_EndingCinema_0C9FCB(2); + uint16 v1 = r1w; + if (v1 != r4w) { + mirror_layer3_ypos = r4w; + if ((r4w & 7) == 1) GameMode1B_EndingCinema_BufferNextRowOfCredits(); } } @@ -286,17 +340,15 @@ void GameMode1B_EndingCinema_Sub() { // 0c9f6a SetSprXYPos(0, 82, 143); spr_oamindex[0] = -96; SpawnEndingYoshiSpriteAndDrawPlayer(); - R0_ = 81; - R1_ = 0; - R2_ = kGameMode1B_EndingCinema_PeachOnYoshiOffset[spr_table1602[0]] - 123; - DrawCreditsPeachRedAndYellowYoshi_Peach(0, 4 * spr_table1602[0]); - R14_ = -96; - MakeCreditsEggsBounce(); - R2_ = 16; - DrawEndingBabyYoshis(); + uint8 r0 = 81; + uint8 r2 = kGameMode1B_EndingCinema_PeachOnYoshiOffset[spr_table1602[0]] - 123; + DrawCreditsPeachRedAndYellowYoshi_Peach(0, 4 * spr_table1602[0], r0, r2); + MakeCreditsEggsBounce(-96); + r2 = 16; + DrawEndingBabyYoshis(r2); } -void GameMode1B_EndingCinema_0C9FCB(uint8 k) { // 0c9fcb +uint16 GameMode1B_EndingCinema_0C9FCB(uint8 k) { // 0c9fcb uint16 v4; PointU16 *pt = get_PointU16(l1_l2_scroll_spr_sub_pos, k); @@ -308,7 +360,7 @@ void GameMode1B_EndingCinema_0C9FCB(uint8 k) { // 0c9fcb uint8 v5 = v3; LOBYTE(v4) = HIBYTE(v3); HIBYTE(v4) = v5; - *(uint16 *)((int8 *)&R0_W + k) += v4; + return v4; } void InitializeCreditsEggPositions() { // 0ca051 @@ -333,67 +385,60 @@ void InitializeCreditsEggPositions() { // 0ca051 } void GameMode1D_LoadYoshisHouse_DrawEndingYoshisHouseDecorations() { // 0ca0e3 - R0_ = 16; - R2_ = 16; - R1_ = 47; + uint8 r0 = 16; + uint8 r2 = 16; + uint8 r1 = 47; uint8 v0 = -112; for (uint8 i = 0; i != 42; ++i) { if (kGameMode1D_LoadYoshisHouse_Tiles[i] != 0xFF) { OamEnt *oam = get_OamEnt(oam_buf, v0); oam[64].charnum = kGameMode1D_LoadYoshisHouse_Tiles[i]; oam[64].flags = kGameMode1D_LoadYoshisHouse_Prop[i]; - oam[64].xpos = R0_; - oam[64].ypos = R1_; + oam[64].xpos = r0; + oam[64].ypos = r1; sprites_oamtile_size_buffer[(v0 >> 2) + 64] = 2; v0 += 4; } - R0_ += 16; - if (R0_ == 0xF0) { - R0_ = R2_; - R1_ += 16; + r0 += 16; + if (r0 == 0xF0) { + r0 = r2; + r1 += 16; } } } void DrawEndingThankYou() { // 0ca146 - R8_W = 63; - R10_W = 63; - R0_W = 0; - R2_W = 0; - R4_W = 0; - DrawEndingThankYou_Entry2(0x50, 0); -} - -void DrawEndingThankYou_Entry2(uint8 k, uint8 j) { // 0ca159 - R0_W += 128; - R2_W = R0_W; - DrawEndingThankYou_0CA183(k, j); - R0_W = 128 - R4_W - 64; - R2_W = 128 - R4_W - 64; - R8_W = 63; - R10_W = 63; - DrawEndingThankYou_0CA183(k, j); -} - -void DrawEndingThankYou_0CA183(uint8 k, uint8 j) { // 0ca183 + DrawEndingThankYou_Entry2(0x50, 0, 0, 0, 63); +} + +void DrawEndingThankYou_Entry2(uint8 k, uint8 j, uint16 r0w, uint16 r4, uint16 r8) { // 0ca159 + r0w += 128; + uint16 r2w = r0w; + k = DrawEndingThankYou_0CA183(k, j, r8, r0w, r2w); + r0w = 128 - r4 - 64; + r2w = 128 - r4 - 64; + DrawEndingThankYou_0CA183(k, j+8, 63, r0w, r2w); +} + +uint8 DrawEndingThankYou_0CA183(uint8 k, uint8 j, uint16 r8, uint16 r0w, uint16 r2) { // 0ca183 do { - if (!R1_) { + if (r0w < 256) { OamEnt *oam = get_OamEnt(oam_buf, k); oam[64].charnum = kDrawEndingThankYou_Tiles[j]; oam[64].flags = 53; - oam[64].xpos = R0_; - oam[64].ypos = R8_; + oam[64].xpos = r0w; + oam[64].ypos = r8; sprites_oamtile_size_buffer[(k >> 2) + 64] = 2; k += 4; } - R0_W += 16; + r0w += 16; if ((j & 7) == 3) { - R0_ = R2_; - R1_ = R3_; - R8_ += 16; + r0w = r2; + r8 += 16; } ++j; } while ((j & 7) != 0); + return k; } void GameMode1D_LoadYoshisHouse_0CA1D4() { // 0ca1d4 @@ -408,6 +453,7 @@ void sub_CA1ED() { // 0ca1ed } void WalkingIntoYoshisHouseDuringEnding_0CA1F6() { // 0ca1f6 + uint8 r2; player_ypos = 352; if (sprites_cutscene_sprite_xpos_lo[0] == 112) { yoshi_stray_yoshi_flag = 0; @@ -415,14 +461,13 @@ void WalkingIntoYoshisHouseDuringEnding_0CA1F6() { // 0ca1f6 HandlePlayerPoseAndAnimationTimersDuringEnding_0CA764(); SpawnEndingYoshiSpriteAndDrawPlayer_0CA7B4(); if (!l1_l2_scroll_spr_current_state[0]) { - R0_ = spr_xpos_lo[0]; - R2_ = -97; - R14_ = 1; - DrawCameraFacingEndingYoshis_BlueYoshi(0xB4, 0); + uint8 r0 = spr_xpos_lo[0]; + r2 = -97; + DrawCameraFacingEndingYoshis_BlueYoshi(0xB4, 0, 1, r0, r2); } - R0_W = PAIR16(sprites_cutscene_sprite_xpos_hi[0], sprites_cutscene_sprite_xpos_lo[0]) + 16; - R2_ = -97; - DrawCreditsPeachRedAndYellowYoshi_Peach(0xA4, 0xC); + uint16 r0w = PAIR16(sprites_cutscene_sprite_xpos_hi[0], sprites_cutscene_sprite_xpos_lo[0]) + 16; + r2 = -97; + DrawCreditsPeachRedAndYellowYoshi_Peach(0xA4, 0xC, r0w, r2); } else { sprites_cutscene_sprite_xspeed[0] = -8; UpdateCutsceneSpritePosition_X(0); @@ -434,18 +479,17 @@ void WalkingIntoYoshisHouseDuringEnding_0CA1F6() { // 0ca1f6 SetSprYPos(0, 0x160); spr_oamindex[0] = 48; SpawnEndingYoshiSpriteAndDrawPlayer(); - R0_W = PAIR16(sprites_cutscene_sprite_xpos_hi[0], sprites_cutscene_sprite_xpos_lo[0]) + 16; - R2_ = -97; + uint16 r0w = PAIR16(sprites_cutscene_sprite_xpos_hi[0], sprites_cutscene_sprite_xpos_lo[0]) + 16; + r2 = -97; PointU16 *pt = get_PointU16(l1_l2_scroll_spr_sub_pos, 0); if ((int8)--LOBYTE(pt->x) < 0) { LOBYTE(pt->x) = 6; HIBYTE(pt->x) ^= 1; } - DrawCreditsPeachRedAndYellowYoshi_Peach(0xA4, 4 * (HIBYTE(pt->x) + 3)); + DrawCreditsPeachRedAndYellowYoshi_Peach(0xA4, 4 * (HIBYTE(pt->x) + 3), r0w, r2); } - R0_ = sprites_cutscene_sprite_xpos_lo[7]; - R1_ = sprites_cutscene_sprite_xpos_hi[7]; - if (R0_W == 48) { + uint16 r0w = sprites_cutscene_sprite_xpos_lo[7] | sprites_cutscene_sprite_xpos_hi[7] << 8; + if (r0w == 48) { if (!*(uint16 *)l1_l2_scroll_spr_current_state) ++*(uint16 *)l1_l2_scroll_spr_current_state; } else { @@ -460,10 +504,10 @@ void WalkingIntoYoshisHouseDuringEnding_0CA1F6() { // 0ca1f6 } void WalkingIntoYoshisHouseDuringEnding_0CA2FC() { // 0ca2fc - R14_ = -81; - MakeCreditsEggsBounce(); - R2_ = -120; - DrawEndingBabyYoshis(); + uint8 r2; + MakeCreditsEggsBounce(-81); + r2 = -120; + DrawEndingBabyYoshis(r2); } void ProcessCheeringYoshis() { // 0ca315 @@ -490,19 +534,16 @@ void ProcessCheeringYoshis() { // 0ca315 LABEL_10: LOBYTE(misc_layer3_xspeed) = v0; if (sprites_draw_ending_yoshis == 1) { - R0_ = 24; - R1_ = 0; - R2_ = sprites_cutscene_sprite_ypos_lo[1]; - DrawCreditsPeachRedAndYellowYoshi_Peach(0xD0, 4 * (kProcessCheeringYoshis_DATA_0CA30D[(uint8)misc_layer3_xspeed] + 7)); - R0_ = -44; - R1_ = 0; - R2_ = sprites_cutscene_sprite_ypos_lo[1]; - DrawCreditsPeachRedAndYellowYoshi_Peach(0xF0, 4 * (kProcessCheeringYoshis_DATA_0CA30D[(uint8)misc_layer3_xspeed] + 10)); + uint8 r0 = 24; + uint8 r2 = sprites_cutscene_sprite_ypos_lo[1]; + DrawCreditsPeachRedAndYellowYoshi_Peach(0xD0, 4 * (kProcessCheeringYoshis_DATA_0CA30D[(uint8)misc_layer3_xspeed] + 7), r0, r2); + r0 = -44; + r2 = sprites_cutscene_sprite_ypos_lo[1]; + DrawCreditsPeachRedAndYellowYoshi_Peach(0xF0, 4 * (kProcessCheeringYoshis_DATA_0CA30D[(uint8)misc_layer3_xspeed] + 10), r0, r2); uint8 v1 = 2 * kProcessCheeringYoshis_DATA_0CA311[(uint8)misc_layer3_xspeed]; - R0_ = 80; - R2_ = sprites_cutscene_sprite_ypos_lo[1]; - R14_ = 0; - DrawCameraFacingEndingYoshis_BlueYoshi(0xF0, v1); + r0 = 80; + r2 = sprites_cutscene_sprite_ypos_lo[1]; + DrawCameraFacingEndingYoshis_BlueYoshi(0xF0, v1, 0, r0, r2); } } @@ -562,44 +603,40 @@ void YoshisWatchInExcitementDuringEnding_0CA478() { // 0ca478 if ((misc_layer3_xspeed & 3) != 0) { YoshisWatchInExcitementDuringEnding_0CA4B6(); } else { - R0_ = 24; - R1_ = 0; - R2_ = -97; - DrawCreditsPeachRedAndYellowYoshi_Peach(0xD0, 4 * ((misc_layer3_xspeed & 3) + 7)); - R0_ = -44; - R1_ = 0; - R2_ = -97; - DrawCreditsPeachRedAndYellowYoshi_Peach(0xF0, 4 * ((misc_layer3_xspeed & 3) + 10)); + uint8 r2; + uint8 r0 = 24; + r2 = -97; + DrawCreditsPeachRedAndYellowYoshi_Peach(0xD0, 4 * ((misc_layer3_xspeed & 3) + 7), r0, r2); + r0 = -44; + r2 = -97; + DrawCreditsPeachRedAndYellowYoshi_Peach(0xF0, 4 * ((misc_layer3_xspeed & 3) + 10), r0, r2); YoshisWatchInExcitementDuringEnding_0CA4E9(); } } void YoshisWatchInExcitementDuringEnding_0CA4B6() { // 0ca4b6 - R0_ = 24; - R1_ = 0; - R2_ = -89; - DrawLeaningEndingYoshis(0xC0, 4 * ((misc_layer3_xspeed & 3) - 1)); - R0_ = -52; - R1_ = 0; - R2_ = -89; - DrawLeaningEndingYoshis(0xD8, 4 * ((misc_layer3_xspeed & 3) - 1 + 2)); + uint8 r2; + uint8 r0 = 24; + r2 = -89; + DrawLeaningEndingYoshis(0xC0, 4 * ((misc_layer3_xspeed & 3) - 1), r0, r2); + r0 = -52; + r2 = -89; + DrawLeaningEndingYoshis(0xD8, 4 * ((misc_layer3_xspeed & 3) - 1 + 2), r0, r2); YoshisWatchInExcitementDuringEnding_0CA4E9(); } void YoshisWatchInExcitementDuringEnding_0CA4E9() { // 0ca4e9 uint8 v0 = 2 * kYoshisWatchInExcitementDuringEnding_DATA_0CA439[misc_layer3_xspeed & 3]; - R0_ = 80; - R2_ = -97; - R14_ = 0; - DrawCameraFacingEndingYoshis_BlueYoshi(0xF0, v0); + uint8 r0 = 80; + uint8 r2 = -97; + DrawCameraFacingEndingYoshis_BlueYoshi(0xF0, v0, 0, r0, r2); YoshisWatchInExcitementDuringEnding_0CA510(v0); } void YoshisWatchInExcitementDuringEnding_0CA510(uint8 j) { // 0ca510 - R0_ = spr_xpos_lo[0]; - R2_ = -97; - R14_ = 1; - DrawCameraFacingEndingYoshis_BlueYoshi(0xB4, j); + uint8 r0 = spr_xpos_lo[0]; + uint8 r2 = -97; + DrawCameraFacingEndingYoshis_BlueYoshi(0xB4, j, 1, r0, r2); WalkingIntoYoshisHouseDuringEnding_0CA1F6(); } @@ -632,7 +669,7 @@ void HatchYoshiEggsDuringEnding() { // 0ca532 sprites_cutscene_sprite_xpos_hi[5] = 0; sprites_cutscene_sprite_xpos_hi[6] = 0; LOBYTE(misc_layer3_yspeed) = kHatchYoshiEggsDuringEnding_DATA_0CA524[v0] | misc_layer3_yspeed; - if (++HIBYTE(misc_layer3_yspeed) != 8) { + if (++HIBYTE(misc_layer3_yspeed) != 7) { io_sound_ch3 = 10; LABEL_5: HatchYoshiEggsDuringEnding_0CA5DE(); @@ -685,15 +722,7 @@ void SlideInThankYouDuringEnding() { // 0ca65b HIBYTE(misc_layer3_tide_sub_ypos) = -16; v0 = 0; } - R0_ = v0; - R2_ = v0; - R4_ = v0; - R1_ = 0; - R3_ = 0; - R5_ = 0; - R8_ = 63; - R10_ = 63; - DrawEndingThankYou_Entry2(0x50, 0); + DrawEndingThankYou_Entry2(0x50, 0, v0, v0, 63); --HIBYTE(misc_layer3_xspeed); if ((misc_layer3_xspeed & 0x8000) != 0) { HIBYTE(misc_layer3_xspeed) = 6; @@ -705,6 +734,7 @@ void SlideInThankYouDuringEnding() { // 0ca65b } void EveryoneCheeringDuringEnding() { // 0ca6b0 + uint8 r2; DrawEndingThankYou(); ProcessCheeringYoshis(); WalkingIntoYoshisHouseDuringEnding_0CA2FC(); @@ -714,13 +744,12 @@ void EveryoneCheeringDuringEnding() { // 0ca6b0 HandlePlayerPoseAndAnimationTimersDuringEnding_0CA764(); SpawnEndingYoshiSpriteAndDrawPlayer_0CA7B4(); uint8 v0 = 2 * kProcessCheeringYoshis_DATA_0CA311[(uint8)misc_layer3_xspeed]; - R0_ = spr_xpos_lo[0]; - R2_ = sprites_cutscene_sprite_ypos_lo[1]; - R14_ = 1; - DrawCameraFacingEndingYoshis_BlueYoshi(0xB4, v0); - R0_W = PAIR16(sprites_cutscene_sprite_xpos_hi[0], sprites_cutscene_sprite_xpos_lo[0]) + 16; - R2_ = -97; - DrawCreditsPeachRedAndYellowYoshi_Peach(0xA4, 4 * (((uint8)(counter_global_frames & 8) >> 3) + 5)); + uint8 r0 = spr_xpos_lo[0]; + r2 = sprites_cutscene_sprite_ypos_lo[1]; + DrawCameraFacingEndingYoshis_BlueYoshi(0xB4, v0, 1, r0, r2); + uint16 r0w = PAIR16(sprites_cutscene_sprite_xpos_hi[0], sprites_cutscene_sprite_xpos_lo[0]) + 16; + r2 = -97; + DrawCreditsPeachRedAndYellowYoshi_Peach(0xA4, 4 * (((uint8)(counter_global_frames & 8) >> 3) + 5), r0w, r2); if (!--HIBYTE(misc_layer3_tide_sub_ypos)) { ++misc_game_mode; HIBYTE(misc_layer3_yspeed) = 64; @@ -773,65 +802,65 @@ void SpawnEndingYoshiSpriteAndDrawPlayer_0CA7B4() { // 0ca7b4 PlayerDraw(); } -void DrawCreditsPeachRedAndYellowYoshi_Peach(uint8 k_in, uint8 j_in) { // 0ca821 +void DrawCreditsPeachRedAndYellowYoshi_Peach(uint8 k_in, uint8 j_in, uint16 r0w, uint8 r2) { // 0ca821 uint16 j = j_in; uint16 k = k_in; int16 v2 = k; if (j >= 0x28) k = k | 0x100; - R4_ = 1; + uint8 r4 = 1; do { - if (R1_) + if (r0w >= 256) break; - R10_ = 2; - uint8 v3 = R0_; + uint8 r10 = 2; + uint8 v3 = r0w; OamEnt *oam = get_OamEnt(oam_buf, k); - oam[1].xpos = R0_; + oam[1].xpos = r0w; oam->xpos = v3 + 8; if (v3 >= 0xF8) - R10_ = 1; - uint8 v5 = R2_; - oam->ypos = R2_; + r10 = 1; + uint8 v5 = r2; + oam->ypos = r2; oam[1].ypos = v5; oam[1].charnum = *((uint8 *)kDrawCreditsPeachRedAndYellowYoshi_DATA_0CA7B9 + j); oam->charnum = *((uint8 *)kDrawCreditsPeachRedAndYellowYoshi_DATA_0CA7B9 + j + 1); oam[1].flags = *((uint8 *)kDrawCreditsPeachRedAndYellowYoshi_DATA_0CA7ED + j); oam->flags = *((uint8 *)kDrawCreditsPeachRedAndYellowYoshi_DATA_0CA7ED + j + 1); - R2_ += 16; + r2 += 16; sprites_oamtile_size_buffer[(k >> 2) + 1] = 2; - sprites_oamtile_size_buffer[k >> 2] = R10_; + sprites_oamtile_size_buffer[k >> 2] = r10; k = k + 8; j = j + 2; - --R4_; - } while ((R4_ & 0x80) == 0); + --r4; + } while ((r4 & 0x80) == 0); } -void MakeCreditsEggsBounce() { // 0ca8a3 +void MakeCreditsEggsBounce(uint8 r14) { // 0ca8a3 for (uint8 i = 13; i != 6; --i) { sprites_cutscene_sprite_yspeed[i] += sprites_cutscene_sprite_table_0AF6[i]; UpdateCutsceneSpritePosition_Y(i); - if (sprites_cutscene_sprite_ypos_lo[i] >= R14_) { + if (sprites_cutscene_sprite_ypos_lo[i] >= r14) { sprites_cutscene_sprite_sub_ypos[i] = 0; sprites_cutscene_sprite_yspeed[i] = -10; sprites_cutscene_sprite_table_0AF6[i] = 1; - sprites_cutscene_sprite_ypos_lo[i] = R14_; + sprites_cutscene_sprite_ypos_lo[i] = r14; } } } -void DrawEndingBabyYoshis() { // 0ca8df - R14_ = misc_layer3_yspeed; +void DrawEndingBabyYoshis(uint8 r2) { // 0ca8df + uint8 r14 = misc_layer3_yspeed; for (uint8 i = 13; i != 6; --i) { if (!sprites_cutscene_sprite_xpos_hi[i]) { - R0_ = sprites_cutscene_sprite_xpos_lo[i]; - R1_ = sprites_cutscene_sprite_ypos_lo[i]; - uint8 v1 = R2_; - OamEnt *oam = get_OamEnt(oam_buf, R2_); - oam->xpos = R0_; - oam->ypos = R1_; - int8 v3 = R14_ & 1; - R14_ >>= 1; + uint8 r0 = sprites_cutscene_sprite_xpos_lo[i]; + uint8 r1 = sprites_cutscene_sprite_ypos_lo[i]; + uint8 v1 = r2; + OamEnt *oam = get_OamEnt(oam_buf, r2); + oam->xpos = r0; + oam->ypos = r1; + int8 v3 = r14 & 1; + r14 >>= 1; if (v3) { oam->charnum = -22; oam->flags = kDrawEndingBabyYoshis_BabyYoshiProp[(uint8)(i - 7)]; @@ -840,23 +869,20 @@ void DrawEndingBabyYoshis() { // 0ca8df oam->flags = 33; } sprites_oamtile_size_buffer[v1 >> 2] = 2; - ++R2_; - ++R2_; - ++R2_; - ++R2_; + r2 += 4; } } } -void DrawLeaningEndingYoshis(uint8 k, uint8 j) { // 0ca99e +void DrawLeaningEndingYoshis(uint8 k, uint8 j, uint8 r0, uint8 r2) { // 0ca99e uint8 v2 = kDrawLeaningEndingYoshis_DATA_0CA99A[j >> 2]; - R4_ = 2; + uint8 r4 = 2; do { OamEnt *oam = get_OamEnt(oam_buf, k); - oam->xpos = R0_ + *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA96A + v2); - oam[1].xpos = R0_ + *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA96A + v2 + 1); - oam->ypos = R2_ + *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA982 + v2); - oam[1].ypos = R2_ + *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA982 + v2 + 1); + oam->xpos = r0 + *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA96A + v2); + oam[1].xpos = r0 + *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA96A + v2 + 1); + oam->ypos = r2 + *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA982 + v2); + oam[1].ypos = r2 + *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA982 + v2 + 1); oam->charnum = *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA93A + v2); oam[1].charnum = *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA93A + v2 + 1); oam->flags = *((uint8 *)kDrawLeaningEndingYoshis_DATA_0CA952 + v2); @@ -865,26 +891,25 @@ void DrawLeaningEndingYoshis(uint8 k, uint8 j) { // 0ca99e uint8 v6 = k; uint8 v4 = k >> 2; uint8 v5 = 2; - if ((R4_ & 2) == 0) + if ((r4 & 2) == 0) v5 = 0; sprites_oamtile_size_buffer[v4] = v5; sprites_oamtile_size_buffer[v4 + 1] = v5; k = v6 + 8; v2 = v7 + 2; - --R4_; - } while ((R4_ & 0x80) == 0); + } while ((--r4 & 0x80) == 0); } -void DrawCameraFacingEndingYoshis_BlueYoshi(uint8 k, uint8 j) { // 0caa15 - uint8 v2 = R14_; +void DrawCameraFacingEndingYoshis_BlueYoshi(uint8 k, uint8 j, uint8 r14, uint8 r0, uint8 r2) { // 0caa15 + uint8 v2 = r14; OamEnt *oam = get_OamEnt(oam_buf, k); oam->flags = kDrawCameraFacingEndingYoshis_Prop[v2 * 2 + 0]; oam[1].flags = kDrawCameraFacingEndingYoshis_Prop[v2 * 2 + 1]; - uint8 v4 = R0_; - oam->xpos = R0_; + uint8 v4 = r0; + oam->xpos = r0; oam[1].xpos = v4; - uint8 v5 = R2_; - oam->ypos = R2_; + uint8 v5 = r2; + oam->ypos = r2; oam[1].ypos = v5 + 16; oam->charnum = *(kDrawCameraFacingEndingYoshis_Tiles + j); oam[1].charnum = *(kDrawCameraFacingEndingYoshis_Tiles + j + 1); @@ -950,8 +975,8 @@ LABEL_13:; v3 += 2; v4 -= 2; } while (v4); - WriteReg(TMW, 0x13); - WriteReg(TSW, 0x13); + RtlPpuWrite(TMW, 0x13); + RtlPpuWrite(TSW, 0x13); mirror_color_math_initial_settings = 34; mirror_hdmaenable = 0x80; } @@ -961,38 +986,31 @@ void CreditsFadeOut_0CABB2() { // 0cabb2 palettes_dynamic_palette_colors[12] = 12; palettes_dynamic_palette_cgramaddress = 2; palettes_dynamic_palette_colors[13] = 18; - palettes_background_color = *(uint16 *)((int8 *)&kGlobalPalettes_Sky + - (uint16)(2 * (kCreditsFadeOut_SkyColorSetting[blocks_screen_to_place_current_object] & 0xF))); - R0_W = 0xb0b0; - R0_W = kCreditsFadeOut_BGPaletteIndex[kCreditsFadeOut_BGPaletteSetting[blocks_screen_to_place_current_object] & 0xF] + 0xb0b0; - R2_W = 0; - R4_W = 0; - R8_W = 1; + palettes_background_color = kGlobalPalettes_Sky[kCreditsFadeOut_SkyColorSetting[blocks_screen_to_place_current_object] & 0xF]; + uint16 r0w = kCreditsFadeOut_BGPaletteIndex[kCreditsFadeOut_BGPaletteSetting[blocks_screen_to_place_current_object] & 0xF] + 0xb0b0; + const uint8 *p0 = RomPtr_00(r0w); + uint16 r4w = 0; + uint16 n = 1; uint16 v0; do { - v0 = R4_W; + v0 = r4w; for (int16 i = 5; i >= 0; --i) { - *(uint16 *)&palettes_dynamic_palette_colors[v0] = *(uint16 *)IndirPtr(&R0_W, 0); - ++R0_W; - ++R0_W; + *(uint16 *)&palettes_dynamic_palette_colors[v0] = WORD(p0[0]); + p0 += 2; v0 += 2; } - R4_W += 14; - --R8_W; - } while ((R8_W & 0x8000) == 0); + r4w += 14; + --n; + } while ((n & 0x8000) == 0); *(uint16 *)&palettes_dynamic_palette_colors[v0] = 0; } void GetLayer1And2PointersForEnemyRollcall() { // 0cad8c - ++counter_enemy_rollcall_screen; - uint8 v0 = -1; - if (counter_enemy_rollcall_screen == 12) - v0 = 12; - temp67 = 12; - ptr_layer2_data_bank = v0; - int v1 = (uint8)(2 * counter_enemy_rollcall_screen) >> 1; - *(uint16 *)&temp65 = kGetLayer1And2PointersForEnemyRollcall_Layer1Ptrs[v1]; - ptr_layer2_data = kGetLayer1And2PointersForEnemyRollcall_Layer2Ptrs[v1]; + int v1 = ++counter_enemy_rollcall_screen; + ptr_layer2_data.bank = (counter_enemy_rollcall_screen == 12) ? 12 : 0xff; + ptr_layer2_data.addr = kGetLayer1And2PointersForEnemyRollcall_Layer2Ptrs[v1]; + ptr_layer1_data.bank = 12; + ptr_layer1_data.addr = kGetLayer1And2PointersForEnemyRollcall_Layer1Ptrs[v1]; } void InitializeEnemyRollcallLayerPositions() { // 0cadf6 @@ -1001,14 +1019,13 @@ void InitializeEnemyRollcallLayerPositions() { // 0cadf6 uint8 v6 = 2 * counter_enemy_rollcall_screen; LoadStripeImage(); if ((ow_level_tile_settings[73] & 0x80) != 0) { - R0_ = *((uint8 *)kInitializeEnemyRollcallLayerPositions_SpecialWorldEnemyNamePtrs + (uint8)(2 * counter_enemy_rollcall_screen)); - R1_ = *((uint8 *)kInitializeEnemyRollcallLayerPositions_SpecialWorldEnemyNamePtrs + (uint8)(2 * counter_enemy_rollcall_screen) + 1); - R2_ = 13; + uint16 r0w = kInitializeEnemyRollcallLayerPositions_SpecialWorldEnemyNamePtrs[counter_enemy_rollcall_screen]; + const uint8 *p0 = RomPtr_0D(r0w); uint8 v0 = 0; uint8 v1 = stripe_image_upload; uint16 v3; do { - uint8 *v2 = IndirPtr(&R0_W, v0); + const uint8 *v2 = &p0[v0]; v3 = *(uint16 *)v2; *(uint16 *)&stripe_image_upload_data[v1] = *(uint16 *)v2; v0 += 2; @@ -1070,45 +1087,45 @@ void GameMode25_ShowEnemyRollcallScreen_Sub() { // 0caead --pt[1].x; if ((pt->x & (uint8)mirror_current_layer1_xpos) == 0) goto LABEL_7; -LABEL_10: - HIBYTE(v2) = 0; +LABEL_10:; uint8 v3 = 32; if (counter_enemy_rollcall_screen == 5) v3 = 48; - R0_ = v3; - LOBYTE(v2) = 2 * counter_enemy_rollcall_screen; + uint8 r0 = v3; + v2 = 2 * counter_enemy_rollcall_screen; uint16 v4 = kGameMode25_ShowEnemyRollcallScreen_EnemyRollcallSpriteDataPtrs[v2 >> 1]; - *(uint16 *)&R1_ = 127; + uint16 r1w = 127; int16 v5 = 508; while (1) { uint16 v9 = v5; uint16 x = mirror_current_layer1_xpos; if ((kGameMode25_ShowEnemyRollcallScreen_TileData[v4 + 3] & 0x20) != 0) x = get_PointU16(misc_layer1_pos, 0)->x; - *(uint16 *)&R3_ = x; + uint8 r4 = x >> 8; if (kGameMode25_ShowEnemyRollcallScreen_TileData[v4] == 0xFF) break; OamEnt *oam = get_OamEnt(oam_buf, v9); - int t = kGameMode25_ShowEnemyRollcallScreen_TileData[v4] - R3_; + int t = kGameMode25_ShowEnemyRollcallScreen_TileData[v4] - (x & 0xff); oam->xpos = t; - R4_ = (0 - R4_ - (t < 0)) & 1; - sprites_oamtile_size_buffer[*(uint16 *)&R1_] = R4_ | ((uint8)(kGameMode25_ShowEnemyRollcallScreen_TileData[v4 + 3] & 0x10) >> 3); + r4 = (0 - r4 - (t < 0)) & 1; + sprites_oamtile_size_buffer[r1w] = r4 | ((uint8)(kGameMode25_ShowEnemyRollcallScreen_TileData[v4 + 3] & 0x10) >> 3); oam->ypos = kGameMode25_ShowEnemyRollcallScreen_TileData[v4 + 1]; oam->charnum = kGameMode25_ShowEnemyRollcallScreen_TileData[v4 + 2]; - oam->flags = R0_ | kGameMode25_ShowEnemyRollcallScreen_TileData[v4 + 3] & 0xCF; + oam->flags = r0 | kGameMode25_ShowEnemyRollcallScreen_TileData[v4 + 3] & 0xCF; v5 = v9 - 4; v4 += 4; - --R1_; + --BYTE(r1w); } } void DisplayCastleDestructionText() { // 0cc94e if (l1_l2_scroll_spr_current_state[1]) { if ((--l1_l2_scroll_spr_current_state[1] & 0x1F) == 0) { - R0_ = 8 * (misc_currently_active_boss_end_cutscene - 1); - R0_ |= (uint8)(l1_l2_scroll_spr_current_state[1] & 0xE0) >> 5; - graphics_stripe_image_to_upload = 3 * R0_ + 33; + uint8 r0; + r0 = 8 * (misc_currently_active_boss_end_cutscene - 1); + r0 |= (uint8)(l1_l2_scroll_spr_current_state[1] & 0xE0) >> 5; + graphics_stripe_image_to_upload = 3 * r0 + 33; } } } @@ -1168,9 +1185,9 @@ void GameMode19_Cutscene_LemmyCutscene() { // 0cca2f void GameMode19_Cutscene_WendyCutscene() { // 0cca51 ProcessMop(); if (l1_l2_scroll_spr_timer[0]) { - R0_ = -80; + uint8 r0 = -80; sprites_cutscene_sprite_xpos_lo[1] = 104; - DrawWhiteFlag(0x30); + DrawWhiteFlag(0x30, r0); } kGameMode19_Cutscene_Ptrs0CCA6E[l1_l2_scroll_spr_current_state[0]](); } @@ -1205,8 +1222,8 @@ void RaiseFlagUpFromRubble() { // 0ccace sprites_cutscene_sprite_xspeed[1] = -16; CopyOfUpdateCutsceneSpritePosition_X(1); } - R0_ = -85; - DrawWhiteFlag(0x30); + uint8 r0 = -85; + DrawWhiteFlag(0x30, r0); } } else { l1_l2_scroll_spr_timer[0] = 0; @@ -1214,9 +1231,9 @@ void RaiseFlagUpFromRubble() { // 0ccace } } -void DrawWhiteFlag(uint8 k) { // 0ccafd +void DrawWhiteFlag(uint8 k, uint8 r0) { // 0ccafd OamEnt *oam = get_OamEnt(oam_buf, k); - oam[96].xpos = R0_; + oam[96].xpos = r0; oam[96].ypos = sprites_cutscene_sprite_xpos_lo[1]; oam[96].charnum = -26; oam[96].flags = 33; @@ -1259,18 +1276,18 @@ void HandleTNTFuse_TNTFuseAndLineDraw() { // 0ccb80 uint8 v0 = 96; if (l1_l2_scroll_spr_spriteid[0]) v0 = sprites_cutscene_sprite_xpos_lo[0]; - R0_ = v0; - R1_ = 103; + uint8 r0 = v0; + uint8 r1 = 103; for (uint8 i = 20; i != 40; i += 4) { - if (R0_ < 0xB0) { + if (r0 < 0xB0) { OamEnt *oam = get_OamEnt(oam_buf, i); - oam[96].xpos = R0_; - oam[96].ypos = R1_; + oam[96].xpos = r0; + oam[96].ypos = r1; oam[96].charnum = -28; oam[96].flags = 63; sprites_oamtile_size_buffer[(i >> 2) + 96] = 2; } - R0_ += 16; + r0 += 16; } if (l1_l2_scroll_spr_spriteid[0]) { if ((uint8)(sprites_cutscene_sprite_xpos_lo[0] - 8) < 0xB0) { @@ -1294,26 +1311,26 @@ void DrawCastleDestructionCastleDoor() { // 0ccbfa } void sub_CCBFC(uint8 k) { // 0ccbfc - R0_ = -88; - R2_ = -88; - R1_ = 95; - DrawCastleDestructionCastleDoor_Entry3(k); + uint8 r0 = -88; + uint8 r2 = -88; + uint8 r1 = 95; + DrawCastleDestructionCastleDoor_Entry3(k, r0, r1, r2); } -void DrawCastleDestructionCastleDoor_Entry3(uint8 k) { // 0ccc06 +void DrawCastleDestructionCastleDoor_Entry3(uint8 k, uint8 r0, uint8 r1, uint8 r2) { // 0ccc06 uint8 v1 = 0; do { OamEnt *oam = get_OamEnt(oam_buf, k); - oam[96].xpos = R0_; - oam[96].ypos = R1_; + oam[96].xpos = r0; + oam[96].ypos = r1; oam[96].charnum = kDrawCastleDestructionCastleDoor_Tiles[v1]; oam[96].flags = 45; sprites_oamtile_size_buffer[(k >> 2) + 96] = 2; ++v1; - R0_ += 8; + r0 += 8; if ((v1 & 1) == 0) { - R0_ = R2_; - R1_ += 8; + r0 = r2; + r1 += 8; } k += 4; } while (v1 != 4); @@ -1329,24 +1346,23 @@ void HandleTNTExplosion() { // 0ccc51 HandleTNTExplosion_TNTExplosionDraw(); } else { ClearCutsceneSpritesSubpixelPosition(); - palettes_background_color = *(uint16 *)((int8 *)&kGlobalPalettes_Sky + - (uint8)(2 * kGameMode19_Cutscene_SkyColorSetting[misc_currently_active_boss_end_cutscene - 1])); + palettes_background_color = kGlobalPalettes_Sky[kGameMode19_Cutscene_SkyColorSetting[misc_currently_active_boss_end_cutscene - 1]]; ++l1_l2_scroll_spr_current_state[0]; } sub_CCBFC(0x1C); } void HandleTNTExplosion_TNTExplosionDraw() { // 0cccb6 - R8_ = kHandleTNTExplosion_DATA_0CCCB1[(uint8)(l1_l2_scroll_spr_scroll_type_index[0] + 1)]; + uint8 r8 = kHandleTNTExplosion_DATA_0CCCB1[(uint8)(l1_l2_scroll_spr_scroll_type_index[0] + 1)]; uint8 v0 = -96; if (l1_l2_scroll_spr_scroll_type_index[0] == 0xFF) v0 = -88; - R0_ = v0; - R4_ = v0; - R2_ = 87; + uint8 r0 = v0; + uint8 r4 = v0; + uint8 r2 = 87; uint8 v1 = 0; do { - uint8 v2 = kHandleTNTExplosion_DATA_0CCC9F[R8_]; + uint8 v2 = kHandleTNTExplosion_DATA_0CCC9F[r8]; if (v2) { OamEnt *oam = get_OamEnt(oam_buf, v1); oam[1].charnum = v2; @@ -1354,16 +1370,16 @@ void HandleTNTExplosion_TNTExplosionDraw() { // 0cccb6 if ((l1_l2_scroll_spr_scroll_type_index[0] & 0x80) == 0 && (l1_l2_scroll_spr_scroll_type_index[0] & 2) != 0) v4 = 57; oam[1].flags = v4; - oam[1].xpos = R0_; - oam[1].ypos = R2_; + oam[1].xpos = r0; + oam[1].ypos = r2; sprites_oamtile_size_buffer[(v1 >> 2) + 1] = 2; } - ++R8_; - R0_ += 16; + ++r8; + r0 += 16; v1 += 4; if (v1 == 12) { - R0_ = R4_; - R2_ += 16; + r0 = r4; + r2 += 16; } } while (v1 != 24); } @@ -1446,10 +1462,10 @@ void HandleCastleLiftoff() { // 0ccda1 void HandleCastleLiftoff_0CCE2A() { // 0cce2a HandleCastleLiftoff_DrawCastleDust(); - R0_ = -88; - R2_ = -88; - R1_ = 95 - sprites_cutscene_sprite_ypos_lo[0]; - DrawCastleDestructionCastleDoor_Entry3(0x14); + uint8 r0 = -88; + uint8 r2 = -88; + uint8 r1 = 95 - sprites_cutscene_sprite_ypos_lo[0]; + DrawCastleDestructionCastleDoor_Entry3(0x14, r0, r1, r2); } void HandleCastleLiftoff_DrawCastleDust() { // 0cce48 @@ -1457,23 +1473,23 @@ void HandleCastleLiftoff_DrawCastleDust() { // 0cce48 l1_l2_scroll_spr_spriteid[1] = 5; l1_l2_scroll_spr_scroll_type_index[0] ^= 1; } - R0_ = -104; + uint8 r0 = -104; uint8 v0 = 33; if (l1_l2_scroll_spr_scroll_type_index[0]) v0 = 97; - R4_ = v0; + uint8 r4 = v0; uint8 v1 = 4 * l1_l2_scroll_spr_scroll_type_index[0]; uint8 v2 = 0; uint8 v4; do { OamEnt *oam = get_OamEnt(oam_buf, v2); - oam[1].xpos = R0_; + oam[1].xpos = r0; oam[1].ypos = sprites_cutscene_sprite_ypos_lo[1]; oam[1].charnum = kHandleCastleLiftoff_CastleDustTiles[v1]; - oam[1].flags = R4_; + oam[1].flags = r4; v4 = v2; sprites_oamtile_size_buffer[(v2 >> 2) + 1] = 2; - R0_ += 16; + r0 += 16; ++v1; v2 += 4; } while (v4 != 12); @@ -1541,10 +1557,10 @@ void HandleDudTNTExplosion() { // 0ccf72 } void HandleDudTNTExplosion_0CCF90() { // 0ccf90 - R0_ = -88; - R2_ = -88; - R1_ = 95; - DrawCastleDestructionCastleDoor_Entry3(8); + uint8 r0 = -88; + uint8 r2 = -88; + uint8 r1 = 95; + DrawCastleDestructionCastleDoor_Entry3(8, r0, r1, r2); } void HandleDudTNTExplosion_DrawDudTNTExplosion(uint8 k) { // 0ccfa3 @@ -1613,29 +1629,29 @@ LABEL_12:; else v0 = -87; } - R0_ = v0; - R2_ = v0; - R1_ = 95; - DrawCastleDestructionCastleDoor_Entry3(8); + uint8 r0 = v0; + uint8 r2 = v0; + uint8 r1 = 95; + DrawCastleDestructionCastleDoor_Entry3(8, r0, r1, r2); } void DrawCutsceneContactEffect() { // 0cd069 uint8 v0 = 0; uint8 v1 = 4; - R0_ = player_xpos + 16; - R2_ = player_xpos + 16; - R1_ = player_ypos + 16; + uint8 r0 = player_xpos + 16; + uint8 r2 = player_xpos + 16; + uint8 r1 = player_ypos + 16; do { OamEnt *oam = get_OamEnt(oam_buf, v1); - oam->xpos = R0_; - oam->ypos = R1_; + oam->xpos = r0; + oam->ypos = r1; oam->charnum = kDrawCutsceneContactEffect_Tiles[v0]; oam->flags = kDrawCutsceneContactEffect_Prop[v0]; sprites_oamtile_size_buffer[v1 >> 2] = 0; - R0_ += 8; + r0 += 8; if (++v0 == 2) { - R0_ = R2_; - R1_ += 8; + r0 = r2; + r1 += 8; } v1 += 4; } while (v0 != 4); @@ -1720,18 +1736,18 @@ void HandleCastleCrumblingDown_DrawCastleRubble() { // 0cd1d0 } void ProcessMop_EraseColumn() { // 0cd22d - R1_ = stripe_image_upload; + uint8 r1 = stripe_image_upload; int8 v0 = 12; uint8 v1 = stripe_image_upload + 12; do stripe_image_upload_data[v1--] = kProcessMop_DATA_0CD1F0[(uint8)v0--]; while (v0 >= 0); LOBYTE(stripe_image_upload) = stripe_image_upload + 12; - R0_ = player_xpos + 96; + uint8 r0 = player_xpos + 96; uint8 v2 = player_xpos + 96 + ((uint8)(LOBYTE(get_PointU16(l1_l2_scroll_spr_speed, 0)->x) - 56) >> 2); int v3 = v2 >> 1; - int v4 = R1_; - *(uint16 *)&stripe_image_upload_data[R1_] = kProcessMop_DATA_0CD1FD[v3]; + int v4 = r1; + *(uint16 *)&stripe_image_upload_data[r1] = kProcessMop_DATA_0CD1FD[v3]; *(uint16 *)&stripe_image_upload_data[v4 + 6] = kProcessMop_DATA_0CD1FD[v3 + 1]; if (v2 == 28) l1_l2_scroll_spr_timer[0] = 1; @@ -1878,23 +1894,23 @@ void DrawQuestionMark() { // 0cd4a4 uint8 v0 = 0; if (!player_current_power_up) v0 = 8; - R2_ = v0; + uint8 r2 = v0; uint8 v1 = 64; - R0_ = 2; + uint8 r0 = 2; uint8 v2 = 4 * l1_l2_scroll_spr_timer[1]; do { if (kDrawQuestionMark_XDisp[v2] != 0x80) { OamEnt *oam = get_OamEnt(oam_buf, v1); oam->xpos = player_xpos + kDrawQuestionMark_XDisp[v2]; - oam->ypos = R2_ + player_ypos + kDrawQuestionMark_YDisp[v2]; + oam->ypos = r2 + player_ypos + kDrawQuestionMark_YDisp[v2]; oam->charnum = -74; oam->flags = 49; sprites_oamtile_size_buffer[v1 >> 2] = 0; v1 += 4; } ++v2; - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void DrawPlayerCough_RoyCutscene() { // 0cd4f8 @@ -1906,10 +1922,10 @@ void DrawPlayerCough_RoyCutscene() { // 0cd4f8 uint8 v1 = 0; if (!player_current_power_up) v1 = 8; - R0_ = v1; + uint8 r0 = v1; OamEnt *oam = get_OamEnt(oam_buf, 0x34); oam->xpos = player_xpos + 4; - oam->ypos = R0_ + player_ypos + sprites_cutscene_sprite_ypos_lo[2]; + oam->ypos = r0 + player_ypos + sprites_cutscene_sprite_ypos_lo[2]; oam->charnum = kDrawPlayerCough_Tiles[(uint8)-sprites_cutscene_sprite_ypos_lo[2] >> 2]; oam->flags = 51; sprites_oamtile_size_buffer[13] = 0; @@ -1932,11 +1948,10 @@ void DrawPlayerCough_MortonCutscene() { // 0cd557 uint8 v1 = 15; if (!player_current_power_up) v1 = 19; - R0_ = v1; - R1_ = 12; + uint8 r0 = v1; OamEnt *oam = get_OamEnt(oam_buf, 0x34); oam->xpos = player_xpos + sprites_cutscene_sprite_xpos_lo[3] + 12; - oam->ypos = R0_ + player_ypos + sprites_cutscene_sprite_ypos_lo[3]; + oam->ypos = r0 + player_ypos + sprites_cutscene_sprite_ypos_lo[3]; oam->charnum = kDrawPlayerCough_Tiles[sprites_cutscene_sprite_xpos_lo[3] >> 2]; oam->flags = 51; sprites_oamtile_size_buffer[13] = 0; @@ -2008,21 +2023,21 @@ void ProcessMop() { // 0cd6ec uint8 v2 = 2 * player_walking_frame; if (player_current_power_up) ++v2; - R0_ = kProcessMop_DATA_0CD6C4[v2]; - R1_ = kProcessMop_DATA_0CD6CA[v2]; + uint8 r0 = kProcessMop_DATA_0CD6C4[v2]; + uint8 r1 = kProcessMop_DATA_0CD6CA[v2]; int8 v3 = 0; if (player_facing_direction & 1) v3 = 0x80; - R2_ = ((uint8)((player_facing_direction >> 2) + v3) >> 1) ^ 0x61; + uint8 r2 = ((uint8)((player_facing_direction >> 2) + v3) >> 1) ^ 0x61; for (uint8 j = 2; (j & 0x80) == 0; --j) { - int8 v5 = kProcessMop_DATA_0CD6D0[j] + R0_; - if ((R2_ & 0x40) != 0) + int8 v5 = kProcessMop_DATA_0CD6D0[j] + r0; + if ((r2 & 0x40) != 0) v5 = -v5; OamEnt *oam = get_OamEnt(oam_buf, (uint8)(4 * j)); oam[80].xpos = player_xpos + v5; - oam[80].ypos = player_ypos + kProcessMop_DATA_0CD6D3[j] + R1_; + oam[80].ypos = player_ypos + kProcessMop_DATA_0CD6D3[j] + r1; oam[80].charnum = kProcessMop_Tiles[j]; - oam[80].flags = R2_; + oam[80].flags = r2; } return; } @@ -2034,19 +2049,19 @@ void ProcessMop() { // 0cd6ec v7 = 56; player_current_pose = v7; uint8 v9 = 0; - R0_ = x - 1; + uint8 r0 = x - 1; int8 v10 = -84; do { OamEnt *v11 = get_OamEnt(oam_buf, v9); v11[80].charnum = v10; v11[80].flags = 33; v11[80].xpos = player_xpos; - uint8 v12 = R0_; - v11[80].ypos = R0_; + uint8 v12 = r0; + v11[80].ypos = r0; uint8 v13 = v12 + 16; if (v13 >= 0x68) v13 = 104; - R0_ = v13; + r0 = v13; v9 += 4; v10 = -82; } while (v9 < 0x14); diff --git a/src/smw_0d.c b/src/smw_0d.c index 08bea05..6531a29 100644 --- a/src/smw_0d.c +++ b/src/smw_0d.c @@ -623,6 +623,139 @@ void (*kProcessGhostHouseObjects_GhostHousePtrs[63])(uint8 k) = { &GhostHouseObj3F_SwitchPalaceLeftFacingWall, }; +static const uint8 kExtObjXX_Generic1TileObject_Tiles[51] = { 0x1f, 0x22, 0x24, 0x42, 0x43, 0x27, 0x29, 0x25, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x45, 0x46, 0x47, 0x48, 0x36, 0x37, 0x11, 0x12, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x29, 0x1d, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x25, 0x26, 0x27, 0x28, 0x2a, 0xde, 0xe0, 0xe2, 0xe4, 0xec, 0xed, 0x2c, 0x25, 0x2d, }; +static const uint8 kExtObj42_TopLeftSlope_LeftTiles[2] = { 0xd8, 0xdb, }; +static const uint8 kExtObj42_TopLeftSlope_RightTiles[2] = { 0xda, 0xdc, }; +static const uint8 kExtObjXX_PurpleTriangle_TriangleTiles[2] = { 0xb4, 0xb5, }; +static const uint8 kExtObj47_Door_TopTiles[2] = { 0x1f, 0x27, }; +static const uint8 kExtObj47_Door_BottomTiles[2] = { 0x20, 0x28, }; +static const uint8 kExtObjXX_LargeBush_BigBushTiles[45] = { 0x25, 0x25, 0x25, 0x4b, 0x4d, 0x4e, 0x25, 0x25, 0x25, 0x25, 0x25, 0x54, 0x49, 0x49, 0x5f, 0x63, 0x25, 0x25, 0x25, 0x25, 0x57, 0x49, 0x49, 0x52, 0x4a, 0x5d, 0x25, 0x25, 0x5a, 0x49, 0x49, 0x50, 0x51, 0x4a, 0x60, 0x25, 0x5a, 0x49, 0x49, 0x49, 0x53, 0x4a, 0x4a, 0x4a, 0x63, }; +static const uint8 kExtObjXX_LargeBush_SmallBushTiles[24] = { 0x25, 0x25, 0x4b, 0x4c, 0x25, 0x25, 0x25, 0x54, 0x49, 0x5f, 0x63, 0x25, 0x25, 0x57, 0x49, 0x52, 0x4a, 0x5d, 0x5a, 0x49, 0x49, 0x49, 0x4f, 0x60, }; +static const uint8 kExtObj4A_ClimbingNetDoor_Tiles[16] = { 0x10, 0x11, 0x11, 0x12, 0x13, 0xb, 0xb, 0x15, 0x13, 0xb, 0xb, 0x15, 0x16, 0x17, 0x17, 0x18, }; +static const uint8 kExtObj86_GoalSign_Tiles[4] = { 0x66, 0x67, 0x68, 0x69, }; +static const uint8 kExtObj91_VerticalLevelSteepLeftSlope_TopTiles[2] = { 0xaa, 0xaf, }; +static const uint8 kExtObj91_VerticalLevelSteepLeftSlope_BottomTiles[2] = { 0xe2, 0xe4, }; +static const uint8 kExtObj93_VerticalLevelNormalLeftSlope_TopLeftTiles[2] = { 0x96, 0xa0, }; +static const uint8 kExtObj93_VerticalLevelNormalLeftSlope_TopRightTiles[2] = { 0x9b, 0xa5, }; +static const uint8 kExtObj93_VerticalLevelNormalLeftSlope_BottomLeftTiles[2] = { 0xde, 0xe6, }; +static const uint8 kExtObj93_VerticalLevelNormalLeftSlope_BottomRightTiles[2] = { 0xe6, 0xe0, }; +static const uint8 kExtObj95_VerticalLevelVerySteepLeftSlope_TopTiles[2] = { 0xca, 0xcc, }; +static const uint8 kExtObj95_VerticalLevelVerySteepLeftSlope_MiddleTiles[2] = { 0xcb, 0xcd, }; +static const uint8 kExtObj95_VerticalLevelVerySteepLeftSlope_BottomTiles[2] = { 0xf1, 0xf2, }; +static const uint8 kBitTable_Bank0D[8] = { 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1, }; +static const uint8 kBank0DItemMemoryIndexes_Lo[3] = { 0x0, 0x80, 0x0, }; +static const uint8 kBank0DItemMemoryIndexes_Hi[3] = { 0x0, 0x0, 0x1, }; +static const uint8 kStdObjXX_Generic1RepeatedTileObject_Tiles[15] = { 0x2, 0x21, 0x23, 0x2a, 0x2b, 0x3f, 0x3, 0x13, 0x1e, 0x24, 0x2e, 0x2f, 0x30, 0x32, 0x65, }; +static const uint8 kStdObj0F_VerticalPipes_TopLeftPipeEndTiles[5] = { 0x33, 0x37, 0x39, 0x0, 0x0, }; +static const uint8 kStdObj0F_VerticalPipes_TopRightPipeEndTiles[5] = { 0x34, 0x38, 0x3a, 0x0, 0x0, }; +static const uint8 kStdObj0F_VerticalPipes_BottomLeftPipeEndTiles[5] = { 0x0, 0x0, 0x39, 0x33, 0x37, }; +static const uint8 kStdObj0F_VerticalPipes_BottomRightPipeEndTiles[5] = { 0x0, 0x0, 0x3a, 0x34, 0x38, }; +static const uint8 kStdObj10_HorizontalPipes_EndTiles[8] = { 0x3b, 0x3c, 0x3b, 0x3f, 0x3b, 0x3c, 0x3b, 0x3f, }; +static const uint8 kStdObj10_HorizontalPipes_ShaftTiles[8] = { 0x3d, 0x3e, 0x3d, 0x3e, 0x3d, 0x3e, 0x3d, 0x3e, }; +static const uint8 kFillInSlopeTileAir_DATA_0DABF7[3] = { 0x3f, 0x1, 0x3, }; +static const uint8 kFillInSlopeTileAir_DATA_0DABFA[3] = { 0x1, 0x3, 0x4, }; +static const uint8 kStdObj13_GroundEdgesAndVine_TopTiles[15] = { 0x40, 0x41, 0x6, 0x45, 0x4b, 0x48, 0x4c, 0x1, 0x3, 0xb6, 0xb7, 0x45, 0x4b, 0x48, 0x4c, }; +static const uint8 kStdObj13_GroundEdgesAndVine_MiddleTiles1[15] = { 0x40, 0x41, 0x6, 0x4b, 0x4b, 0x4c, 0x4c, 0x40, 0x41, 0x4b, 0x4c, 0x4b, 0x4b, 0x4c, 0x4c, }; +static const uint8 kStdObj13_GroundEdgesAndVine_MiddleTiles2[15] = { 0x40, 0x41, 0x6, 0x4b, 0x4b, 0x4c, 0x4c, 0x40, 0x41, 0x4b, 0x4c, 0x4b, 0x4b, 0x4c, 0x4c, }; +static const uint8 kStdObj13_GroundEdgesAndVine_BottomTiles[15] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, 0xe2, 0xe4, 0xe4, }; +static const uint8 kStdObj13_GroundEdgesAndVine_DATA_0DB0F0[18] = { 0x7d, 0x7e, 0x82, 0x83, 0x9b, 0x9c, 0xa0, 0xa1, 0xaa, 0xab, 0xaf, 0xb0, 0xd8, 0xdc, 0xde, 0xe0, 0xe2, 0xe4, }; +static const uint8 kStdObj13_GroundEdgesAndVine_DATA_0DB102[18] = { 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xd9, 0xdd, 0xdf, 0xe1, 0xe3, 0xe5, }; +static const uint8 kStdObj13_GroundEdgesAndVine_DATA_0DB15C[30] = { 0x6e, 0x6f, 0x73, 0x74, 0x78, 0x79, 0x7d, 0x7e, 0x82, 0x83, 0x87, 0x88, 0x8c, 0x8d, 0x91, 0x92, 0x96, 0x97, 0x9b, 0x9c, 0xa0, 0xa1, 0xa5, 0xa6, 0xaa, 0xab, 0xaf, 0xb0, 0xe2, 0xe4, }; +static const uint8 kStdObj13_GroundEdgesAndVine_DATA_0DB17A[30] = { 0x70, 0x70, 0x75, 0x75, 0x7a, 0x7a, 0x7f, 0x7f, 0x84, 0x84, 0x89, 0x89, 0x8e, 0x8e, 0x93, 0x93, 0x98, 0x98, 0x9d, 0x9d, 0xa2, 0xa2, 0xa7, 0xa7, 0xac, 0xac, 0xb1, 0xb1, 0xe9, 0xea, }; +static const uint8 kStdObj15_MidwayAndGoalPoint_TopMidwayTiles[3] = { 0x2f, 0x25, 0x32, }; +static const uint8 kStdObj15_MidwayAndGoalPoint_MiddleMidwayTiles[3] = { 0x30, 0x25, 0x33, }; +static const uint8 kStdObj15_MidwayAndGoalPoint_BottomMidwayTiles[3] = { 0x31, 0x25, 0x34, }; +static const uint8 kStdObj15_MidwayAndGoalPoint_TopGoalTiles[3] = { 0x39, 0x25, 0x3c, }; +static const uint8 kStdObj15_MidwayAndGoalPoint_MiddleGoalTiles[3] = { 0x3a, 0x25, 0x3d, }; +static const uint8 kStdObj15_MidwayAndGoalPoint_BottomGoalTiles[3] = { 0x3b, 0x25, 0x3e, }; +static const uint8 kStdObj17_RopeAndCloudLine_Tiles[2] = { 0x5, 0x6, }; +static const uint8 kStdObj18_WaterWithAnimatedSurface_TopTiles[4] = { 0x0, 0x1, 0x4, 0x8, }; +static const uint8 kStdObj18_WaterWithAnimatedSurface_BottomTiles[4] = { 0x2, 0x3, 0x5, 0xb, }; +static const uint8 kStdObj1C_DonutBridge_Tiles[2] = { 0x26, 0x44, }; +static const uint8 kStdObj1E_ClimbingNetWithSideEdge_SideTiles[2] = { 0xa, 0xc, }; +static const uint8 kStdObj1E_ClimbingNetWithSideEdge_TopCornerTiles[2] = { 0x7, 0x9, }; +static const uint8 kStdObj1E_ClimbingNetWithSideEdge_TopInnerCornerTiles[2] = { 0x1a, 0x19, }; +static const uint8 kStdObj1E_ClimbingNetWithSideEdge_BottomCornerTiles[2] = { 0xd, 0xf, }; +static const uint8 kStdObj1E_ClimbingNetWithSideEdge_BottomInnerCornerTiles[2] = { 0x1c, 0x1b, }; +static const uint8 kExtObj68_CloudFringeBottomAndRightEdge_Tiles[8] = { 0x91, 0x92, 0x96, 0x97, 0x9a, 0x9b, 0x9f, 0xa0, }; +static const uint8 kExtObj8E_YellowSwitchBlock_ActiveTiles[2] = { 0x6a, 0x6b, }; +static const uint8 kExtObj8E_YellowSwitchBlock_InactiveTiles[2] = { 0x6a, 0x6b, }; +static const uint8 kGrassObj3F_SmallBushes_LeftTiles[5] = { 0x73, 0x7a, 0x85, 0x88, 0xc3, }; +static const uint8 kGrassObj3F_SmallBushes_MiddleTiles[5] = { 0x74, 0x7b, 0x86, 0x89, 0xc3, }; +static const uint8 kGrassObj3F_SmallBushes_RightTiles[5] = { 0x79, 0x80, 0x87, 0x8e, 0xc3, }; +static const uint8 kGrassObj3C_ArchLedge_Tiles[28] = { 0x7, 0xa, 0xa, 0x8, 0xa, 0xa, 0x9, 0x81, 0x82, 0x83, 0x81, 0x82, 0x83, 0x81, 0x81, 0x25, 0x84, 0x81, 0x25, 0x84, 0x81, 0x81, 0x25, 0x84, 0x81, 0x25, 0x84, 0x81, }; +static const uint8 kGrassObj3D_TopCloudFridge_Tiles[2] = { 0x93, 0x9c, }; +static const uint8 kExtObj88_RightTreeBranch_Tiles[2] = { 0xc1, 0xc2, }; +static const uint8 kGrassObj3E_SideCloudFridges_TopTiles[8] = { 0x94, 0x8f, 0x9d, 0x98, 0x95, 0x90, 0x9e, 0x99, }; +static const uint8 kGrassObj3E_SideCloudFridges_BottomTiles[8] = { 0x8f, 0x8f, 0x98, 0x98, 0x90, 0x90, 0x99, 0x99, }; +static const uint8 kGrassObj39_RightFacingDiagonalPipe_Tiles[16] = { 0xc4, 0xc5, 0xc7, 0xec, 0xed, 0xc6, 0xc7, 0xee, 0x59, 0x5a, 0xef, 0xc7, 0xee, 0x59, 0x5b, 0x5c, }; +static const uint8 kGrassObj32_BlueSwitchBlocks_InactiveTiles[2] = { 0x6c, 0x6d, }; +static const uint8 kGrassObj32_BlueSwitchBlocks_ActiveTiles[2] = { 0x6c, 0x6d, }; +static const uint8 kGrassObj37_SmallTreeTrunk_TopTiles[2] = { 0xbd, 0xbf, }; +static const uint8 kGrassObj37_SmallTreeTrunk_BottomTiles[2] = { 0xbe, 0xc0, }; +static const uint8 kGrassObj34_ForestGroundEdges_TopTiles[4] = { 0x5f, 0x5e, 0x10, 0xf, }; +static const uint8 kGrassObj34_ForestGroundEdges_BottomTiles[4] = { 0x60, 0x5d, 0xc5, 0xc4, }; +static const uint8 kGrassObj33_ForestTreeTop_Tiles[96] = { 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb5, 0xb3, 0xb5, 0xb3, 0xb3, 0xb4, 0xb4, 0xb5, 0xb3, 0xb4, 0xb4, 0xb4, 0xb4, 0xb5, 0xb3, 0xb5, 0xb6, 0xb1, 0xb6, 0xb1, 0xb1, 0xb3, 0xb5, 0xb6, 0xb1, 0xb3, 0xb5, 0xb3, 0xb5, 0xb6, 0xb1, 0xb6, 0x25, 0x25, 0x25, 0x25, 0x25, 0xb1, 0xb6, 0x25, 0x25, 0xb1, 0xb6, 0xb1, 0xb6, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, }; +static const uint8 kExtObj4B_ConveyorEndTile1_Tiles[2] = { 0x7, 0x8, }; +static const uint8 kExtObj84_CastleEntrance_Tiles[126] = { 0x73, 0x74, 0x75, 0x73, 0x74, 0x74, 0x7b, 0x79, 0x7a, 0x79, 0x7a, 0x7b, 0x79, 0x7a, 0x7b, 0x73, 0x74, 0x75, 0x73, 0x74, 0x74, 0x74, 0x75, 0x73, 0x77, 0x77, 0x78, 0x76, 0x77, 0x77, 0x7a, 0x7b, 0x79, 0x7a, 0x7a, 0x7b, 0x79, 0x7a, 0x7b, 0x73, 0x74, 0x74, 0x75, 0x73, 0x74, 0x73, 0x75, 0x73, 0x77, 0x7a, 0x7a, 0x7b, 0x79, 0x7a, 0x79, 0x7b, 0x79, 0x7b, 0x7c, 0x7d, 0x7d, 0x7d, 0x7d, 0x25, 0x73, 0x74, 0x75, 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x25, 0x76, 0x77, 0x78, 0x80, 0x81, 0x81, 0x81, 0x81, 0x25, 0x76, 0x77, 0x78, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x25, 0x79, 0x7a, 0x7b, 0x83, 0x84, 0x84, 0x85, 0x80, 0x25, 0x73, 0x74, 0x75, 0x83, 0x84, 0x84, 0x85, 0x7c, 0x25, 0x76, 0x77, 0x78, 0x83, 0x84, 0x84, 0x85, 0x7e, 0x25, 0x79, 0x7a, 0x7b, 0x83, 0x84, 0x84, 0x85, 0x80, }; +static const uint8 kExtObj90_LargeBossDoor_Tiles[6] = { 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9c, }; +static const uint8 kCastleObj3D_Escalator_ConveyorTiles[4] = { 0xce, 0xd1, 0xcf, 0xd0, }; +static const uint8 kCastleObj3D_Escalator_ConveyorCornerTiles[4] = { 0xf3, 0xf6, 0xf4, 0xf5, }; +static const uint8 kCastleObj3E_HorizontalLineOfSpikes_Tiles[2] = { 0x5a, 0x59, }; +static const uint8 kCastleObj3F_VerticalLineOfSpikes_Tiles[3] = { 0x5b, 0x5c, 0x53, }; +static const uint8 kCastleObj3C_StoneBlock_LeftTiles[3] = { 0x5d, 0x60, 0x63, }; +static const uint8 kCastleObj3C_StoneBlock_MiddleTiles[3] = { 0x5e, 0x61, 0x64, }; +static const uint8 kCastleObj3C_StoneBlock_RightTiles[3] = { 0x5f, 0x62, 0x65, }; +static const uint8 kExtObjXX_LineGuideQuarterLargeCircle_Tiles[16] = { 0x7a, 0x7b, 0x7c, 0x25, 0x7e, 0x7f, 0x25, 0x7d, 0x82, 0x25, 0x80, 0x81, 0x25, 0x83, 0x84, 0x85, }; +static const uint8 kExtObjXX_LineGuideQuarterSmallCircle_Tiles[4] = { 0x76, 0x77, 0x78, 0x79, }; +static const uint8 kExtObj55_HorizontalLineGuideEnd_Tiles[2] = { 0x96, 0x97, }; +static const uint8 kExtObj56_VerticalLineGuideEnd_Tiles[2] = { 0x98, 0x99, }; +static const uint8 kRopeObj36_HorizontalConveyorRope_Tiles[2] = { 0xc, 0xd, }; +static const uint8 kCastleObj37_HorizontalLineGuide_Tiles[2] = { 0x92, 0x93, }; +static const uint8 kCastleObj38_VerticalLineGuide_Tiles[3] = { 0x90, 0x91, 0xa2, }; +static const uint8 kRopeObj35_ColumnWithPlantOnTop_LeftPlantTiles[4] = { 0x9a, 0x9c, 0x9e, 0xa0, }; +static const uint8 kRopeObj35_ColumnWithPlantOnTop_RightPlantTiles[4] = { 0x9b, 0x9d, 0x9f, 0xa1, }; +static const uint8 kRopeObj35_ColumnWithPlantOnTop_ColumnTiles[6] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, }; +static const uint8 kRopeObj32_LogBridge_Tiles[2] = { 0xa3, 0xe, }; +static const uint8 kExtObj75_CanvasTile1_Tiles[7] = { 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, }; +static const uint8 kExtObj7C_BitOfCanvas1_TopTiles[3] = { 0x81, 0x82, 0x83, }; +static const uint8 kExtObj7C_BitOfCanvas1_BottomTiles[3] = { 0x84, 0x85, 0x86, }; +static const uint8 kExtObj7F_TorpedoLauncher_Tiles[4] = { 0x66, 0x67, 0x68, 0x69, }; +static const uint8 kUndergroundObj38_RightLavaEdge_TopTiles[2] = { 0x5a, 0x5b, }; +static const uint8 kUndergroundObj38_RightLavaEdge_MiddleTiles[2] = { 0x5b, 0x5b, }; +static const uint8 kUndergroundObj3E_CeilingEdges_TopTiles[4] = { 0x50, 0x50, 0x51, 0x51, }; +static const uint8 kUndergroundObj3E_CeilingEdges_BottomTiles[4] = { 0x4d, 0x50, 0x4f, 0x51, }; +static const uint8 kUndergroundObj37_LargeCanvas_CanvasTiles[14] = { 0x5c, 0x5d, 0x5e, 0x60, 0x73, 0x74, 0x75, 0x62, 0x63, 0x64, 0x5f, 0x76, 0x76, 0x76, }; +static const uint8 kUndergroundObj37_LargeCanvas_CanvasPosLo[8] = { 0x50, 0x58, 0x94, 0x9c, 0xd0, 0xd8, 0x14, 0x1c, }; +static const uint8 kUndergroundObj37_LargeCanvas_CanvasPosHi[8] = { 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc9, 0xc9, }; +static const uint16 kUndergroundObj37_LargeCanvas_ScreenPosLo[16] = { 0xc800, 0xc9b0, 0xcb60, 0xcd10, 0xcec0, 0xd070, 0xd220, 0xd3d0, 0xd580, 0xd730, 0xd8e0, 0xda90, 0xdc40, 0xddf0, 0xdfa0, 0xe150, }; +static const uint16 kUndergroundObj37_LargeCanvas_ScreenPosHi[16] = { 0xc800, 0xc9b0, 0xcb60, 0xcd10, 0xcec0, 0xd070, 0xd220, 0xd3d0, 0xd580, 0xd730, 0xd8e0, 0xda90, 0xdc40, 0xddf0, 0xdfa0, 0xe150, }; +static const uint8 kExtObj71_Canvas1_Tiles[19] = { 0x5c, 0x5d, 0x5e, 0x60, 0x73, 0x74, 0x75, 0x73, 0x74, 0x75, 0x73, 0x74, 0x75, 0x73, 0x74, 0x75, 0x76, 0x76, 0x76, }; +static const uint8 kExtObj71_Canvas1_TileIndex[4] = { 0x0, 0x13, 0x26, 0x39, }; +static const uint8 kUndergroundObj36_4SidedGround_LeftTiles[3] = { 0x45, 0x50, 0x4d, }; +static const uint8 kUndergroundObj36_4SidedGround_MiddleTiles[3] = { 0x0, 0xf0, 0x4e, }; +static const uint8 kUndergroundObj36_4SidedGround_RightTiles[3] = { 0x48, 0x51, 0x4f, }; +static const uint8 kExtObj57_SwitchPalaceBottomRightInnerCorner_Tiles[8] = { 0x73, 0x74, 0x75, 0x76, 0x93, 0x94, 0x95, 0x96, }; +static const uint8 kExtObj61_GhostHouseClock_Tiles[27] = { 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x86, 0x87, 0x25, 0x25, 0x86, 0x87, 0x25, 0x25, 0x86, 0x25, 0x84, 0x85, 0x84, 0x85, 0x25, 0x85, 0x25, 0x25, }; +static const uint16 kExtObj64_TopRightCobweb_Tiles[6] = { 0x8d8c, 0x8e25, 0x9190, 0x258f, 0xfdfc, 0xfffe, }; +static const uint16 kExtObj66_GhostHouseTopRightToBottomLeftBeam2_Tiles[16] = { 0x2525, 0x7b7a, 0x7c25, 0x257d, 0x7d7c, 0x2525, 0x257d, 0x2525, 0x7f7e, 0x2525, 0x8025, 0x2581, 0x2525, 0x8180, 0x2525, 0x8025, }; +static const uint16 kExtObj49_GhostHouseExit_Tiles[39] = { 0xa5a5, 0xa5a4, 0xa4a5, 0xa8a7, 0xa7a4, 0xa4a8, 0xadac, 0xaca4, 0xa4ad, 0xafae, 0xaea4, 0xa4af, 0xb1b0, 0xb0a4, 0xa4b1, 0xa8a7, 0xa7a4, 0xa4a8, 0xa5a5, 0xa5a5, 0xa4a5, 0xb4b4, 0xb4b4, 0xa4b4, 0xb2ac, 0xb4ad, 0xa4b4, 0xb3b0, 0xb4b1, 0xa4b4, 0xc2c1, 0xb4c6, 0xa4b4, 0xc2c1, 0xa5c6, 0xa4a5, 0xc2c1, 0xa7c6, 0xa4a8, }; +static const uint16 kExtObj80_GhostHouseEntrance_Tiles[70] = { 0xa6a4, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa5a4, 0xa5a5, 0xa5a5, 0xa5a5, 0xa5a5, 0xc0a4, 0xa8a8, 0xa8a8, 0xabab, 0xa8a8, 0xa6a4, 0xadac, 0xacc0, 0xa6ad, 0xadac, 0xa6a4, 0xafae, 0xaea6, 0xbfaf, 0xafae, 0xbfa4, 0xb1b0, 0xb0ab, 0xa6b1, 0xb1b0, 0xa6a4, 0xa8ab, 0xa8a9, 0xa9ab, 0xa8a8, 0xa5a4, 0xa5a5, 0xb6b5, 0xb8b7, 0xa5b9, 0xa7a4, 0xaba8, 0xbbba, 0xbdbc, 0xa8be, 0xc0a4, 0xadac, 0xaca6, 0xadb2, 0xacbf, 0xa7a4, 0xafae, 0xaec0, 0xafb3, 0xaeab, 0xbfa4, 0xb1b0, 0xc1a6, 0xc3c2, 0xb0a6, 0xa5a4, 0xa5a5, 0xc1a5, 0xc3c2, 0xc4c4, 0xb4a4, 0xb4b4, 0xc1b4, 0xc3c2, 0xc5c5, }; +static const uint16 kExtObj85_YoshisHouse_Tiles[80] = { 0x2525, 0x2525, 0x2525, 0x2525, 0x2525, 0xcb25, 0x25cc, 0x2525, 0xcd25, 0xcfce, 0xcfcf, 0xcfcf, 0xcfcf, 0xcfcf, 0xd0cf, 0x25d1, 0xd225, 0xd3eb, 0xd3d3, 0xd3eb, 0xd3d3, 0xebd3, 0xd3d3, 0x25d4, 0xd525, 0xebd3, 0xd3d3, 0xd3d3, 0xebd3, 0xd3d3, 0xebd3, 0x25d6, 0xd525, 0xd3d3, 0xd3d3, 0xebd3, 0xd3d3, 0xd3d3, 0xd3d3, 0x25d6, 0xd725, 0xd9d8, 0xd8d8, 0xd8d9, 0xd9d8, 0xdad8, 0xd8db, 0x25dc, 0x2525, 0xdd25, 0x2525, 0x25dd, 0xdd25, 0xcb25, 0x25cc, 0x2525, 0x2525, 0xddde, 0x2525, 0x25dd, 0xdd25, 0xcb25, 0x25cc, 0x2525, 0xdf25, 0xe1e0, 0x2525, 0x25dd, 0xdd25, 0xe225, 0xe4e3, 0x2525, 0xe5e5, 0xdde6, 0xe5e5, 0xe5dd, 0xdde5, 0xe7e5, 0xe9e8, 0xe5e5, }; +static const uint8 kExtObj81_Seaweed_Tiles[2] = { 0xc9, 0xca, }; +static const uint16 kExtObj8A_GreenSwitchPalaceSwitch_Tiles[8] = { 0xedec, 0xefee, 0xf1f0, 0xf3f2, 0xf5f4, 0xf7f6, 0xf9f8, 0xfbfa, }; +static const uint8 kGhostObj35_BrickBackground_Tiles[3] = { 0x92, 0x5e, 0x82, }; +static const uint8 kGhostObj37_HorizontalBackgroundLogAndRailing_LeftTiles[3] = { 0x82, 0x89, 0x88, }; +static const uint8 kGhostObj37_HorizontalBackgroundLogAndRailing_MiddleTiles[3] = { 0x82, 0x8a, 0x88, }; +static const uint8 kGhostObj37_HorizontalBackgroundLogAndRailing_RightTiles[3] = { 0x82, 0x8b, 0x88, }; +static const uint8 kGhostObj39_VerticalBackgroundLog_TopTiles[3] = { 0x83, 0x78, 0x79, }; +static const uint8 kGhostObj39_VerticalBackgroundLog_BottomTiles[3] = { 0x83, 0x79, 0x79, }; +static const uint8 kGhostObj3A_SolidBrickWallAndVerticalLineOfSpikes_Tiles[4] = { 0x5f, 0x60, 0x5a, 0x5b, }; +static const uint8 kGhostObj31_WoodCrate_LeftEdgeTiles[2] = { 0x63, 0x65, }; +static const uint8 kGhostObj31_WoodCrate_MiddleTiles[2] = { 0xc7, 0xc8, }; +static const uint8 kGhostObj31_WoodCrate_RightEdgeTiles[2] = { 0x64, 0x6a, }; +static const uint8 kGhostObj2E_HorizontalLineOfSpikes_Tiles[1] = { 0x59, }; + void ProcessExtendedObjects() { // 0da100 FuncU8 *p = kProcessExtendedObjects_ExtendedObjectPtrs[blocks_size_or_type]; if (p) @@ -640,17 +773,17 @@ void ProcessGrasslandObjects() { // 0da44b } void ExtObj00_ScreenExit(uint8 k) { // 0da512 - blocks_object_number = *IndirPtr(&temp65, 0); - WORD(temp65) += 1; - uint8 v2 = R10_ & 0x1F; + blocks_object_number = *IndirPtr(&ptr_layer1_data, 0); + ptr_layer1_data.addr += 1; + uint8 v2 = loadlvl_R10 & 0x1F; misc_subscreen_exit_entrance_number_lo[v2] = blocks_object_number; - misc_subscreen_exit_properties[v2] = R11_ & 1; - flag_use_secondary_entrance = R11_ >> 1; + misc_subscreen_exit_properties[v2] = loadlvl_R11 & 1; + flag_use_secondary_entrance = loadlvl_R11 >> 1; } void ExtObj01_ScreenJump(uint8 k) { // 0da53d - blocks_screen_to_place_current_object = R10_ & 0x1F; - blocks_screen_to_place_next_object = R10_ & 0x1F; + blocks_screen_to_place_current_object = loadlvl_R10 & 0x1F; + blocks_screen_to_place_next_object = loadlvl_R10 & 0x1F; } void ExtObj18_3upMoon(uint8 k) { // 0da57b @@ -660,11 +793,11 @@ void ExtObj18_3upMoon(uint8 k) { // 0da57b void ExtObjXX_Generic1TileObject_0DA57F(uint8 k, uint8 a) { // 0da57f int8 v6; - R0_ = a; + uint8 r0 = a; if (k >= 0x18 && k < 0x1D) { uint8 v2 = ow_level_number_lo >> 3; uint8 v3 = ow_level_number_lo & 7; - if (R0_ == 8) { + if (r0 == 8) { if ((kBitTable_Bank0D[v3] & flag_collected_moons[v2]) != 0) return; } else if ((kBitTable_Bank0D[v3] & flag_collected1up_checkpoints[v2]) != 0) { @@ -673,27 +806,26 @@ void ExtObjXX_Generic1TileObject_0DA57F(uint8 k, uint8 a) { // 0da57f } uint8 v4 = blocks_sub_scr_pos; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - uint8 v5 = R0_; - if ((int8)(R0_ - 19) >= 0) + uint8 v5 = r0; + if ((int8)(r0 - 19) >= 0) SetMap16HighByteForCurrentObject_Page01(v4); - R12_ = kExtObjXX_Generic1TileObject_Tiles[v5]; + uint8 r12 = kExtObjXX_Generic1TileObject_Tiles[v5]; if (v5 == 1 || v5 == 7 || v5 == 50 || v5 == 38 || v5 == 27 && ((v6 = v4 & 0xF, (v4 & 0xF) == 1) || v6 == 4 || v6 == 7 || v6 == 10 || v6 == 13)) { - R8_W = PAIR16(kBank0DItemMemoryIndexes_Hi[misc_item_memory_setting], kBank0DItemMemoryIndexes_Lo[misc_item_memory_setting]) + 0x19f8; - R14_ = 4 * blocks_screen_to_place_next_object; - if ((R10_ & 0x10) != 0) - R14_ |= 2; + uint16 r8 = PAIR16(kBank0DItemMemoryIndexes_Hi[misc_item_memory_setting], kBank0DItemMemoryIndexes_Lo[misc_item_memory_setting]) + 0x19f8; + uint8 r14 = 4 * blocks_screen_to_place_next_object; + if ((loadlvl_R10 & 0x10) != 0) + r14 |= 2; if ((v4 & 8) != 0) - R14_ |= 1; - R15_ = kBitTable_Bank0D[blocks_sub_scr_pos & 7] & RomPtr_RAM(R8_W)[R14_]; - if (R15_) { + r14 |= 1; + if (kBitTable_Bank0D[blocks_sub_scr_pos & 7] & RomPtr_RAM(r8)[r14]) { if (v5 == 7) return; SetMap16HighByteForCurrentObject_Page01(v4); - R12_ = 50; + r12 = 50; } } - IndirWriteByte(&ptr_lo_map16_data, v4, R12_); + SetMap16LowByte(v4, r12); } void ExtObjXX_Generic1TileObject_GreenStarBlockEntry(uint8 k) { // 0da64d @@ -705,16 +837,16 @@ void ExtObj42_TopLeftSlope(uint8 k) { // 0da656 uint8 v2 = k - 66; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kExtObj42_TopLeftSlope_LeftTiles[v2]); - IndirWriteByte(&ptr_lo_map16_data, v3, kExtObj42_TopLeftSlope_RightTiles[v2]); + SetMap16LowByte(v3, kExtObj42_TopLeftSlope_RightTiles[v2]); SetMap16HighByteForCurrentObject_Page01(v3); } void ExtObjXX_PurpleTriangle(uint8 k) { // 0da673 uint8 v1 = blocks_sub_scr_pos; - IndirWriteByte(&ptr_lo_map16_data, blocks_sub_scr_pos, kExtObjXX_PurpleTriangle_TriangleTiles[(uint8)(k - 68)]); + SetMap16LowByte(blocks_sub_scr_pos, kExtObjXX_PurpleTriangle_TriangleTiles[(uint8)(k - 68)]); SetMap16HighByteForCurrentObject_Page01(v1); uint8 v2 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - IndirWriteByte(&ptr_lo_map16_data, v2, 0xEB); + SetMap16LowByte(v2, 0xEB); SetMap16HighByteForCurrentObject_Page01(v2); } @@ -724,19 +856,16 @@ void ExtObj46_MidwayBar(uint8 k) { // 0da68e SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos - 1); uint8 v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x35); SetMap16HighByteForCurrentObject_Page00(v2); - IndirWriteByte(&ptr_lo_map16_data, v2, 0x38); + SetMap16LowByte(v2, 0x38); } } void PreserveLevelDataPointerInObjects() { // 0da6b1 - uint16 v0 = ptr_lo_map16_data; - R5_ = HIBYTE(v0); - R4_ = v0; + lvlload_R4W = ptr_lo_map16_data.addr; } void RestoreLevelDataPointerInObjects() { // 0da6ba - ptr_lo_map16_data = __PAIR16__(R5_, R4_); - ptr_hi_map16_data = __PAIR16__(R5_, R4_); + ptr_hi_map16_data.addr = ptr_lo_map16_data.addr = lvlload_R4W; blocks_screen_to_place_next_object = blocks_screen_to_place_current_object; } @@ -744,52 +873,51 @@ void ExtObj47_Door(uint8 k) { // 0da6d1 uint8 v1 = blocks_sub_scr_pos; uint8 v2 = k - 71; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v1, kExtObj47_Door_TopTiles[v2]); + SetMap16LowByte(v1, kExtObj47_Door_TopTiles[v2]); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); SetMap16HighByteForCurrentObject_Page00(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, kExtObj47_Door_BottomTiles[v2]); + SetMap16LowByte(v3, kExtObj47_Door_BottomTiles[v2]); } void ExtObjXX_LargeBush_BigBushEntry(uint8 k) { // 0da71b uint8 v1 = blocks_sub_scr_pos; - R0_ = 8; - R1_ = 4; + uint8 r0 = 8; + uint8 r1 = 4; uint8 v2 = 0; PreserveLevelDataPointerInObjects(); do { - R2_ = R0_; + uint8 r2 = r0; do { SetMap16HighByteForCurrentObject_Page00(v1); v1 = ExtObjXX_LargeBush_HandleOverlappingBigBushTiles(v1, kExtObjXX_LargeBush_BigBushTiles[v2++]); - --R2_; - } while ((R2_ & 0x80) == 0); + --r2; + } while ((r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R1_; - } while ((R1_ & 0x80) == 0); + --r1; + } while ((r1 & 0x80) == 0); } void ExtObjXX_LargeBush_SmallBushEntry(uint8 k) { // 0da760 uint8 v1 = blocks_sub_scr_pos; - R0_ = 5; - R1_ = 3; + uint8 r0 = 5; + uint8 r1 = 3; uint8 v2 = 0; PreserveLevelDataPointerInObjects(); do { - R2_ = R0_; + uint8 r2 = r0; do { SetMap16HighByteForCurrentObject_Page00(v1); v1 = ExtObjXX_LargeBush_HandleOverlappingBigBushTiles(v1, kExtObjXX_LargeBush_SmallBushTiles[v2++]); - --R2_; - } while ((R2_ & 0x80) == 0); + --r2; + } while ((r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R1_; - } while ((R1_ & 0x80) == 0); + --r1; + } while ((r1 & 0x80) == 0); } uint8 ExtObjXX_LargeBush_HandleOverlappingBigBushTiles(uint8 j, uint8 a) { // 0da78d - R15_ = a; if (a == 37) { return HandleHorizontalSubScreenCrossingForCurrentObject_Entry2(j); } else { @@ -797,11 +925,11 @@ uint8 ExtObjXX_LargeBush_HandleOverlappingBigBushTiles(uint8 j, uint8 a) { // 0 uint8 v2 = *IndirPtr(&ptr_lo_map16_data, j); if (v2 != 37) { if (v2 != 73) - ++R15_; - ++R15_; + ++a; + ++a; } } - return HandleHorizontalSubScreenCrossingForCurrentObject(j, R15_); + return HandleHorizontalSubScreenCrossingForCurrentObject(j, a); } } @@ -810,11 +938,11 @@ void ExtObj4A_ClimbingNetDoor(uint8 k) { // 0da7c1 uint8 v1 = 0; PreserveLevelDataPointerInObjects(); do { - R2_ = 3; + uint8 r2 = 3; do { v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, kExtObj4A_ClimbingNetDoor_Tiles[v1++]); - --R2_; - } while ((R2_ & 0x80) == 0); + --r2; + } while ((r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } while (v1 != 16); @@ -838,10 +966,10 @@ void ExtObj91_VerticalLevelSteepLeftSlope(uint8 k) { // 0da80d uint8 v1 = blocks_sub_scr_pos; uint8 v2 = k + 111; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v1, kExtObj91_VerticalLevelSteepLeftSlope_TopTiles[v2]); + SetMap16LowByte(v1, kExtObj91_VerticalLevelSteepLeftSlope_TopTiles[v2]); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_VerticalLevel(); SetMap16HighByteForCurrentObject_Page01(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, kExtObj91_VerticalLevelSteepLeftSlope_BottomTiles[v2]); + SetMap16LowByte(v3, kExtObj91_VerticalLevelSteepLeftSlope_BottomTiles[v2]); } uint8 HandleVerticalSubScreenCrossingForCurrentObject_VerticalLevel() { // 0da82a @@ -858,74 +986,74 @@ void ExtObj93_VerticalLevelNormalLeftSlope(uint8 k) { // 0da846 SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kExtObj93_VerticalLevelNormalLeftSlope_TopLeftTiles[v2]); SetMap16HighByteForCurrentObject_Page01(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, kExtObj93_VerticalLevelNormalLeftSlope_TopRightTiles[v2]); + SetMap16LowByte(v3, kExtObj93_VerticalLevelNormalLeftSlope_TopRightTiles[v2]); uint8 v4 = HandleVerticalSubScreenCrossingForCurrentObject_VerticalLevel(); SetMap16HighByteForCurrentObject_Page01(v4); uint8 v5 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, kExtObj93_VerticalLevelNormalLeftSlope_BottomLeftTiles[v2]); SetMap16HighByteForCurrentObject_Page01(v5); - IndirWriteByte(&ptr_lo_map16_data, v5, kExtObj93_VerticalLevelNormalLeftSlope_BottomRightTiles[v2]); + SetMap16LowByte(v5, kExtObj93_VerticalLevelNormalLeftSlope_BottomRightTiles[v2]); } void ExtObj95_VerticalLevelVerySteepLeftSlope(uint8 k) { // 0da87d uint8 v1 = blocks_sub_scr_pos; uint8 v2 = k + 107; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v1, kExtObj95_VerticalLevelVerySteepLeftSlope_TopTiles[v2]); + SetMap16LowByte(v1, kExtObj95_VerticalLevelVerySteepLeftSlope_TopTiles[v2]); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_VerticalLevel(); SetMap16HighByteForCurrentObject_Page01(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, kExtObj95_VerticalLevelVerySteepLeftSlope_MiddleTiles[v2]); + SetMap16LowByte(v3, kExtObj95_VerticalLevelVerySteepLeftSlope_MiddleTiles[v2]); uint8 v4 = HandleVerticalSubScreenCrossingForCurrentObject_VerticalLevel(); SetMap16HighByteForCurrentObject_Page01(v4); - IndirWriteByte(&ptr_lo_map16_data, v4, kExtObj95_VerticalLevelVerySteepLeftSlope_BottomTiles[v2]); + SetMap16LowByte(v4, kExtObj95_VerticalLevelVerySteepLeftSlope_BottomTiles[v2]); } void StdObj05_Coins(uint8 k) { // 0da8c3 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R2_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r2 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); while (1) { if (k != 4) goto LABEL_9; - R8_W = PAIR16(kBank0DItemMemoryIndexes_Hi[misc_item_memory_setting], kBank0DItemMemoryIndexes_Lo[misc_item_memory_setting]) + 0x19f8; - R14_ = 4 * blocks_screen_to_place_next_object; - if ((R10_ & 0x10) != 0) - R14_ |= 2; + uint16 r8 = PAIR16(kBank0DItemMemoryIndexes_Hi[misc_item_memory_setting], kBank0DItemMemoryIndexes_Lo[misc_item_memory_setting]) + 0x19f8; + uint8 r14 = 4 * blocks_screen_to_place_next_object; + if ((loadlvl_R10 & 0x10) != 0) + r14 |= 2; if ((v1 & 8) != 0) - R14_ |= 1; - R15_ = kBitTable_Bank0D[v1 & 7] & RomPtr_RAM(R8_W)[R14_]; + r14 |= 1; + uint8 r15 = kBitTable_Bank0D[v1 & 7] & RomPtr_RAM(r8)[r14]; k = 4; - if (R15_) { + if (r15) { v1 = HandleHorizontalSubScreenCrossingForCurrentObject_Entry2(v1); } else { -LABEL_9: - R12_ = kStdObjXX_Generic1RepeatedTileObject_Tiles[k]; +LABEL_9:; + uint8 r12 = kStdObjXX_Generic1RepeatedTileObject_Tiles[k]; SetMap16HighByteForCurrentObject_Page00(v1); if ((int8)(k - 7) >= 0) SetMap16HighByteForCurrentObject_Page01(v1); - v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, R12_); + v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, r12); } - if ((--R2_ & 0x80) != 0) { + if ((--r2 & 0x80) != 0) { RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R2_ = R0_; - if ((--R1_ & 0x80) != 0) + r2 = r0; + if ((--r1 & 0x80) != 0) break; } } } uint8 HandleHorizontalSubScreenCrossingForCurrentObject(uint8 j, uint8 a) { // 0da95b - IndirWriteByte(&ptr_lo_map16_data, j, a); + SetMap16LowByte(j, a); return HandleHorizontalSubScreenCrossingForCurrentObject_Entry2(j); } uint8 HandleHorizontalSubScreenCrossingForCurrentObject_Entry2(uint8 j) { // 0da95d uint8 result = j + 1; if ((result & 0xF) == 0) { - ptr_lo_map16_data += 0x1b0; - ptr_hi_map16_data = ptr_lo_map16_data; + ptr_lo_map16_data.addr += 0x1b0; + ptr_hi_map16_data.addr = ptr_lo_map16_data.addr; ++blocks_screen_to_place_next_object; result = blocks_sub_scr_pos & 0xF0; } @@ -942,7 +1070,7 @@ uint8 HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel() { // 0d void HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(uint8 cr) { // 0da987 HIBYTE(ptr_lo_map16_data) += cr; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); - R5_ = HIBYTE(ptr_lo_map16_data); + HIBYTE(lvlload_R4W) = HIBYTE(ptr_lo_map16_data); } uint8 GoDownLeftAndUpdateLevelDataPointerInObjects() { // 0da992 @@ -975,16 +1103,16 @@ uint8 GoDownRightAndUpdateLevelDataPointerInObjects() { // 0da9b4 } void GoBackOneScreenAndUpdateLevelDataPointerInObjects() { // 0da9d6 - ptr_lo_map16_data -= 0x1b0; - ptr_hi_map16_data = ptr_lo_map16_data; - R4_W = ptr_lo_map16_data; + ptr_lo_map16_data.addr -= 0x1b0; + ptr_hi_map16_data.addr = ptr_lo_map16_data.addr; + lvlload_R4W = ptr_lo_map16_data.addr; --blocks_screen_to_place_next_object; } void GoForwardOneScreenAndUpdateLevelDataPointerInObjects() { // 0da9ef - ptr_lo_map16_data += 0x1b0; - ptr_hi_map16_data = ptr_lo_map16_data; - R4_W = ptr_lo_map16_data; + ptr_lo_map16_data.addr += 0x1b0; + ptr_hi_map16_data.addr = ptr_lo_map16_data.addr; + lvlload_R4W = ptr_lo_map16_data.addr; ++blocks_screen_to_place_next_object; } @@ -996,9 +1124,13 @@ void SetMap16HighByteForCurrentObject_Page00(uint8 j) { // 0daa0d IndirWriteByte(&ptr_hi_map16_data, j, 0); } +void SetMap16LowByte(uint16 j, uint8 a) { + IndirWriteByte(&ptr_lo_map16_data, j, a); +} + void StdObj0F_VerticalPipes(uint8 k) { // 0daa26 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; uint8 v2 = blocks_size_or_type & 0xF; PreserveLevelDataPointerInObjects(); if ((int8)(v2 - 3) >= 0) @@ -1006,40 +1138,40 @@ void StdObj0F_VerticalPipes(uint8 k) { // 0daa26 SetMap16HighByteForCurrentObject_Page01(v1); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kStdObj0F_VerticalPipes_TopLeftPipeEndTiles[v2]); SetMap16HighByteForCurrentObject_Page01(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, kStdObj0F_VerticalPipes_TopRightPipeEndTiles[v2]); + SetMap16LowByte(v3, kStdObj0F_VerticalPipes_TopRightPipeEndTiles[v2]); while (1) { RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); if (v2 != 5 && (int8)(v2 - 2) >= 0) break; - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) return; LABEL_3: if (v2 == 5) { SetMap16HighByteForCurrentObject_Page01(v1); uint8 v4 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x68); SetMap16HighByteForCurrentObject_Page01(v4); - IndirWriteByte(&ptr_lo_map16_data, v4, 0x69); + SetMap16LowByte(v4, 0x69); } else { LABEL_5: SetMap16HighByteForCurrentObject_Page01(v1); uint8 v5 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x35); SetMap16HighByteForCurrentObject_Page01(v5); - IndirWriteByte(&ptr_lo_map16_data, v5, 0x36); + SetMap16LowByte(v5, 0x36); } } - if (--R0_) + if (--r0) goto LABEL_5; SetMap16HighByteForCurrentObject_Page01(v1); uint8 v6 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kStdObj0F_VerticalPipes_BottomLeftPipeEndTiles[v2]); SetMap16HighByteForCurrentObject_Page01(v6); - IndirWriteByte(&ptr_lo_map16_data, v6, kStdObj0F_VerticalPipes_BottomRightPipeEndTiles[v2]); + SetMap16LowByte(v6, kStdObj0F_VerticalPipes_BottomRightPipeEndTiles[v2]); } void StdObj10_HorizontalPipes(uint8 k) { // 0daab4 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type & 0xF; uint8 v2 = (uint8)(blocks_size_or_type & 0xF0) >> 3; PreserveLevelDataPointerInObjects(); while (1) { @@ -1054,14 +1186,14 @@ void StdObj10_HorizontalPipes(uint8 k) { // 0daab4 LABEL_5: if ((int8)(v2 - 4) >= 0) break; - if ((--R1_ & 0x80) != 0) + if ((--r1 & 0x80) != 0) goto LABEL_10; } - if (!--R1_) { + if (!--r1) { SetMap16HighByteForCurrentObject_Page01(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, kStdObj10_HorizontalPipes_EndTiles[v2]); + SetMap16LowByte(v1, kStdObj10_HorizontalPipes_EndTiles[v2]); LABEL_10: - R1_ = R0_; + r1 = r0; RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); if ((++v2 & 1) == 0) @@ -1074,16 +1206,16 @@ void StdObj11_BulletShooter(uint8 k) { // 0dab0d uint8 v1 = blocks_sub_scr_pos; int8 v2 = blocks_size_or_type >> 4; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v1, 0x41); + SetMap16LowByte(v1, 0x41); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); int8 v4 = v2 - 1; if (v4 >= 0) { SetMap16HighByteForCurrentObject_Page01(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, 0x42); + SetMap16LowByte(v3, 0x42); uint8 v5 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); for (int8 i = v4 - 1; i >= 0; --i) { SetMap16HighByteForCurrentObject_Page01(v5); - IndirWriteByte(&ptr_lo_map16_data, v5, 0x43); + SetMap16LowByte(v5, 0x43); v5 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } } @@ -1100,12 +1232,11 @@ void StdObj12_SlopesLeftSlope() { // 0dab6e bool v8; uint8 v0 = blocks_sub_scr_pos; - R2_ = 1; - R0_ = 1; + uint8 r2 = 1; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; + uint8 r0 = (blocks_size_or_type >> 4) + 1; while (1) { - uint8 v1 = R2_; + uint8 v1 = r2; SetMap16HighByteForCurrentObject_Page01(v0); uint8 v2 = FillInSlopeTileAir(v0, 0x96); SetMap16HighByteForCurrentObject_Page01(v2); @@ -1125,12 +1256,12 @@ void StdObj12_SlopesLeftSlope() { // 0dab6e } LABEL_6: RestoreLevelDataPointerInObjects(); - ++R2_; - ++R2_; - v8 = (--R0_ & 0x80) != 0; - if (R0_) + ++r2; + ++r2; + v8 = (--r0 & 0x80) != 0; + if (r0) break; - v4 = R2_ - 2; + v4 = r2 - 2; v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } if (v8) @@ -1149,25 +1280,24 @@ void StdObj12_SlopesLeftSlope() { // 0dab6e } uint8 FillInSlopeTileAir(uint8 j, uint8 a) { // 0dabfd - R12_ = a; uint8 v2 = 2; uint8 v3 = *IndirPtr(&ptr_lo_map16_data, j); while (v3 != kFillInSlopeTileAir_DATA_0DABF7[v2]) { if ((--v2 & 0x80) != 0) - return HandleHorizontalSubScreenCrossingForCurrentObject(j, R12_); + return HandleHorizontalSubScreenCrossingForCurrentObject(j, a); } - R12_ += kFillInSlopeTileAir_DATA_0DABFA[v2]; - return HandleHorizontalSubScreenCrossingForCurrentObject(j, R12_); + a += kFillInSlopeTileAir_DATA_0DABFA[v2]; + return HandleHorizontalSubScreenCrossingForCurrentObject(j, a); } void StdObj12_Slopes_SteepLeftSlope() { // 0dac21 uint8 v0 = blocks_sub_scr_pos; - R0_ = (blocks_size_or_type >> 4) + 1; - R2_ = 0; + uint8 r0 = (blocks_size_or_type >> 4) + 1; + uint8 r2 = 0; PreserveLevelDataPointerInObjects(); bool v5; while (1) { - uint8 v1 = R2_; + uint8 v1 = r2; SetMap16HighByteForCurrentObject_Page01(v0); for (uint8 i = FillInSlopeTileAir(v0, 0xAA);; i = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel()) { int8 v3 = v1 - 1; @@ -1179,11 +1309,11 @@ void StdObj12_Slopes_SteepLeftSlope() { // 0dac21 } } RestoreLevelDataPointerInObjects(); - ++R2_; - v5 = (--R0_ & 0x80) != 0; - if (R0_) + ++r2; + v5 = (--r0 & 0x80) != 0; + if (r0) break; - v1 = R2_; + v1 = r2; } if (v5) break; @@ -1203,12 +1333,11 @@ void StdObj12_Slopes_SteepLeftSlope() { // 0dac21 void StdObj12_Slopes_GradualLeftSlope() { // 0dac92 bool v12; uint8 v0 = blocks_sub_scr_pos; - R2_ = 3; - R0_ = 3; + uint8 r2 = 3; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; + uint8 r0 = (blocks_size_or_type >> 4) + 1; while (1) { - uint8 v1 = R2_; + uint8 v1 = r2; SetMap16HighByteForCurrentObject_Page01(v0); uint8 v2 = FillInSlopeTileAir(v0, 0x6E); SetMap16HighByteForCurrentObject_Page01(v2); @@ -1236,11 +1365,11 @@ void StdObj12_Slopes_GradualLeftSlope() { // 0dac92 } LABEL_6: RestoreLevelDataPointerInObjects(); - R2_ += 4; - v12 = (--R0_ & 0x80) != 0; - if (R0_) + r2 += 4; + v12 = (--r0 & 0x80) != 0; + if (r0) break; - v6 = R2_ - 4; + v6 = r2 - 4; v5 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } if (v12) @@ -1260,10 +1389,9 @@ void StdObj12_Slopes_GradualLeftSlope() { // 0dac92 void StdObj12_SlopesRightSlope() { // 0dad44 uint8 v0 = blocks_sub_scr_pos; - R2_ = 1; - R0_ = 1; + uint8 r2 = 1; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; + uint8 r0 = (blocks_size_or_type >> 4) + 1; do { SetMap16HighByteForCurrentObject_Page01(v0); uint8 v4 = FillInSlopeTileAir(v0, 0xA0); @@ -1271,9 +1399,9 @@ void StdObj12_SlopesRightSlope() { // 0dad44 FillInSlopeTileAir(v4, 0xA5); RestoreLevelDataPointerInObjects(); uint8 v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - ++R2_; - uint8 v2 = ++R2_; - if ((--R0_ & 0x80) != 0) + ++r2; + uint8 v2 = ++r2; + if ((--r0 & 0x80) != 0) break; while (v2 != 3) { SetMap16HighByteForCurrentObject_Page00(v1); @@ -1284,22 +1412,21 @@ void StdObj12_SlopesRightSlope() { // 0dad44 uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0xE6); SetMap16HighByteForCurrentObject_Page01(v3); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v3, 0xE0); - } while (R0_); + } while (r0); } void StdObj12_Slopes_SteepRightSlope() { // 0dada3 uint8 v0 = blocks_sub_scr_pos; - R2_ = 0; - R0_ = 0; + uint8 r2 = 0; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; - while (R0_) { + uint8 r0 = (blocks_size_or_type >> 4) + 1; + while (r0) { SetMap16HighByteForCurrentObject_Page01(v0); FillInSlopeTileAir(v0, 0xAF); RestoreLevelDataPointerInObjects(); uint8 v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - uint8 v2 = ++R2_; - if ((--R0_ & 0x80) != 0) + uint8 v2 = ++r2; + if ((--r0 & 0x80) != 0) break; while (v2 != 1) { SetMap16HighByteForCurrentObject_Page00(v1); @@ -1313,9 +1440,9 @@ void StdObj12_Slopes_SteepRightSlope() { // 0dada3 void StdObj12_Slopes_GradualRightSlope() { // 0dadeb uint8 v0 = blocks_sub_scr_pos; - R2_ = 3; + uint8 r2 = 3; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; + uint8 r0 = (blocks_size_or_type >> 4) + 1; do { SetMap16HighByteForCurrentObject_Page01(v0); uint8 v6 = FillInSlopeTileAir(v0, 0x82); @@ -1327,9 +1454,9 @@ void StdObj12_Slopes_GradualRightSlope() { // 0dadeb FillInSlopeTileAir(v8, 0x91); RestoreLevelDataPointerInObjects(); uint8 v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R2_ += 4; - uint8 v2 = R2_; - if ((--R0_ & 0x80) != 0) + r2 += 4; + uint8 v2 = r2; + if ((--r0 & 0x80) != 0) break; while (v2 != 7) { SetMap16HighByteForCurrentObject_Page00(v1); @@ -1344,16 +1471,16 @@ void StdObj12_Slopes_GradualRightSlope() { // 0dadeb uint8 v5 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, 0xDB); SetMap16HighByteForCurrentObject_Page01(v5); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v5, 0xDC); - } while (R0_); + } while (r0); } void StdObj12_Slopes_UpsideDownNormalLeftSlope() { // 0dae6d uint8 v0 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; - R2_ = 2 * (blocks_size_or_type >> 4); - --R2_; - R1_ = 0; - int8 v1 = R2_; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r2 = 2 * (blocks_size_or_type >> 4); + --r2; + uint8 r1 = 0; + int8 v1 = r2; PreserveLevelDataPointerInObjects(); LABEL_3: SetMap16HighByteForCurrentObject_Page01(v0); @@ -1368,8 +1495,8 @@ void StdObj12_Slopes_UpsideDownNormalLeftSlope() { // 0dae6d while (1) { RestoreLevelDataPointerInObjects(); uint8 v7; - if (R1_) { - R2_ -= 2; + if (r1) { + r2 -= 2; v7 = blocks_sub_scr_pos + 18; if (blocks_sub_scr_pos + 18 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); @@ -1381,13 +1508,13 @@ void StdObj12_Slopes_UpsideDownNormalLeftSlope() { // 0dae6d GoForwardOneScreenAndUpdateLevelDataPointerInObjects(); } } else { - ++R1_; + ++r1; v7 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } blocks_sub_scr_pos = v7; - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; - uint8 v2 = R2_; + uint8 v2 = r2; SetMap16HighByteForCurrentObject_Page01(v7); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v7, 0xC6); SetMap16HighByteForCurrentObject_Page01(v3); @@ -1400,12 +1527,12 @@ void StdObj12_Slopes_UpsideDownNormalLeftSlope() { // 0dae6d void StdObj12_Slopes_UpsideDownNormalRightSlope() { // 0daefc uint8 v0 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; - R2_ = 2 * (blocks_size_or_type >> 4); - ++R2_; - R1_ = 0; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r2 = 2 * (blocks_size_or_type >> 4); + ++r2; + uint8 r1 = 0; PreserveLevelDataPointerInObjects(); - uint8 v1 = R2_; + uint8 v1 = r2; uint8 v2; do { while ((int8)(v1 - 4) >= 0) { @@ -1415,26 +1542,26 @@ void StdObj12_Slopes_UpsideDownNormalRightSlope() { // 0daefc } if ((int8)(v1 - 2) < 0 || (SetMap16HighByteForCurrentObject_Page01(v0), v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0xF0), - SetMap16HighByteForCurrentObject_Page01(v2), v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, 0xEF), R1_)) { + SetMap16HighByteForCurrentObject_Page01(v2), v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, 0xEF), r1)) { SetMap16HighByteForCurrentObject_Page01(v0); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0xC8); SetMap16HighByteForCurrentObject_Page01(v3); HandleHorizontalSubScreenCrossingForCurrentObject(v3, 0xC9); } RestoreLevelDataPointerInObjects(); - R2_ -= 2; - v1 = R2_; - ++R1_; + r2 -= 2; + v1 = r2; + ++r1; v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void StdObj12_Slopes_UpsideDownSteepLeftSlope() { // 0daf61 uint8 v0 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; - R2_ = (blocks_size_or_type >> 4) - 1; - R1_ = 0; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r2 = (blocks_size_or_type >> 4) - 1; + uint8 r1 = 0; int8 v1 = (blocks_size_or_type >> 4) - 1; PreserveLevelDataPointerInObjects(); LABEL_3: @@ -1446,8 +1573,8 @@ void StdObj12_Slopes_UpsideDownSteepLeftSlope() { // 0daf61 while (1) { RestoreLevelDataPointerInObjects(); uint8 v4; - if (R1_) { - --R2_; + if (r1) { + --r2; v4 = blocks_sub_scr_pos + 17; if (blocks_sub_scr_pos + 17 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); @@ -1459,13 +1586,13 @@ void StdObj12_Slopes_UpsideDownSteepLeftSlope() { // 0daf61 GoForwardOneScreenAndUpdateLevelDataPointerInObjects(); } } else { - ++R1_; + ++r1; v4 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } blocks_sub_scr_pos = v4; - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; - uint8 v2 = R2_; + uint8 v2 = r2; SetMap16HighByteForCurrentObject_Page01(v4); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, 0xC4); v1 = v2 - 1; @@ -1477,16 +1604,16 @@ void StdObj12_Slopes_UpsideDownSteepLeftSlope() { // 0daf61 void StdObj12_Slopes_0DAFDF(uint8 cr) { // 0dafdf HIBYTE(ptr_lo_map16_data) -= !(cr & 1); HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); - R5_ = HIBYTE(ptr_lo_map16_data); + HIBYTE(lvlload_R4W) = HIBYTE(ptr_lo_map16_data); } void StdObj12_Slopes_UpsideDownSteepRightSlope() { // 0dafea uint8 v0 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; - R2_ = blocks_size_or_type >> 4; - R1_ = 0; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r2 = blocks_size_or_type >> 4; + uint8 r1 = 0; PreserveLevelDataPointerInObjects(); - uint8 v1 = R2_; + uint8 v1 = r2; do { while ((int8)(v1 - 2) >= 0) { SetMap16HighByteForCurrentObject_Page01(v0); @@ -1494,57 +1621,55 @@ void StdObj12_Slopes_UpsideDownSteepRightSlope() { // 0dafea --v1; } if ((int8)(v1 - 1) < 0 || - (SetMap16HighByteForCurrentObject_Page01(v0), v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0xED), R1_)) { + (SetMap16HighByteForCurrentObject_Page01(v0), v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0xED), r1)) { SetMap16HighByteForCurrentObject_Page01(v0); HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0xC5); } RestoreLevelDataPointerInObjects(); - v1 = --R2_; - ++R1_; + v1 = --r2; + ++r1; v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void StdObj13_GroundEdgesAndVine(uint8 k) { // 0db075 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; uint8 v2 = blocks_size_or_type & 0xF; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); if ((int8)(v2 - 3) >= 0) SetMap16HighByteForCurrentObject_Page01(v1); uint8 v3 = StdObj13_GroundEdgesAndVine_0DB114(v2, v1, kStdObj13_GroundEdgesAndVine_TopTiles[v2]); - IndirWriteByte(&ptr_lo_map16_data, v1, v3); + SetMap16LowByte(v1, v3); uint8 v4 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) == 0) { + if ((--r0 & 0x80) == 0) { SetMap16HighByteForCurrentObject_Page00(v4); if ((int8)(v2 - 9) >= 0 || (int8)(v2 - 7) < 0 && (int8)(v2 - 3) >= 0) SetMap16HighByteForCurrentObject_Page01(v4); uint8 v5 = StdObj13_GroundEdgesAndVine_0DB198(v2, v4, kStdObj13_GroundEdgesAndVine_MiddleTiles1[v2]); - IndirWriteByte(&ptr_lo_map16_data, v4, v5); + SetMap16LowByte(v4, v5); v4 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) == 0) { + if ((--r0 & 0x80) == 0) { do { SetMap16HighByteForCurrentObject_Page00(v4); if ((int8)(v2 - 9) >= 0 || (int8)(v2 - 7) < 0 && (int8)(v2 - 3) >= 0) SetMap16HighByteForCurrentObject_Page01(v4); uint8 v6 = StdObj13_GroundEdgesAndVine_0DB198(v2, v4, kStdObj13_GroundEdgesAndVine_MiddleTiles2[v2]); - IndirWriteByte(&ptr_lo_map16_data, v4, v6); + SetMap16LowByte(v4, v6); v4 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } } if ((int8)(v2 - 11) >= 0) { SetMap16HighByteForCurrentObject_Page01(v4); - IndirWriteByte(&ptr_lo_map16_data, v4, kStdObj13_GroundEdgesAndVine_BottomTiles[v2]); + SetMap16LowByte(v4, kStdObj13_GroundEdgesAndVine_BottomTiles[v2]); } } uint8 StdObj13_GroundEdgesAndVine_0DB114(uint8 k, uint8 j, uint8 a) { // 0db114 if (((int8)(k - 3) < 0 || (int8)(k - 9) < 0 || (int8)(k - 11) >= 0) && k != 2) { - R11_ = k; - R12_ = a; uint8 v3 = 17; uint8 v4 = *IndirPtr(&ptr_lo_map16_data, j); do { @@ -1554,22 +1679,19 @@ uint8 StdObj13_GroundEdgesAndVine_0DB114(uint8 k, uint8 j, uint8 a) { // 0db114 } --v3; } while ((v3 & 0x80) == 0); - if (v4 != 37 && (R12_ == 1 || R12_ == 3 || R12_ == 69 || R12_ == 72)) - ++R12_; - return R12_; + if (v4 != 37 && (a == 1 || a == 3 || a == 69 || a == 72)) + a += 1; } return a; } uint8 StdObj13_GroundEdgesAndVine_0DB198(uint8 k, uint8 j, uint8 a) { // 0db198 if (((int8)(k - 3) < 0 || (int8)(k - 7) >= 0 && (int8)(k - 9) < 0) && k != 2) { - R11_ = k; - R12_ = a; uint8 v3 = 29; uint8 v4 = *IndirPtr(&ptr_lo_map16_data, j); while (v4 != kStdObj13_GroundEdgesAndVine_DATA_0DB15C[v3]) { if ((--v3 & 0x80) != 0) - return R12_; + return a; } SetMap16HighByteForCurrentObject_Page01(j); return kStdObj13_GroundEdgesAndVine_DATA_0DB17A[v3]; @@ -1578,18 +1700,18 @@ uint8 StdObj13_GroundEdgesAndVine_0DB198(uint8 k, uint8 j, uint8 a) { // 0db198 } void StdObj21_WideScaleGroundLedge(uint8 k) { // 0db1c8 - R0_ = blocks_size_or_type; - R2_ = 2; - StdObj21_WideScaleGroundLedge_0DB1E3(blocks_size_or_type); + uint8 r0 = blocks_size_or_type; + uint8 r2 = 2; + StdObj21_WideScaleGroundLedge_0DB1E3(blocks_size_or_type, r0, r2); } void StdObj21_WideScaleGroundLedge_StandardLedgeEntry(uint8 k) { // 0db1d4 - R0_ = blocks_size_or_type & 0xF; - R2_ = blocks_size_or_type >> 4; - StdObj21_WideScaleGroundLedge_0DB1E3(blocks_size_or_type & 0xF); + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r2 = blocks_size_or_type >> 4; + StdObj21_WideScaleGroundLedge_0DB1E3(blocks_size_or_type & 0xF, r0, r2); } -void StdObj21_WideScaleGroundLedge_0DB1E3(uint8 k) { // 0db1e3 +void StdObj21_WideScaleGroundLedge_0DB1E3(uint8 k, uint8 r0, uint8 r2) { // 0db1e3 PreserveLevelDataPointerInObjects(); uint8 v1 = blocks_sub_scr_pos; do { @@ -1600,8 +1722,8 @@ void StdObj21_WideScaleGroundLedge_0DB1E3(uint8 k) { // 0db1e3 while (1) { RestoreLevelDataPointerInObjects(); uint8 v2 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - uint8 v3 = R0_; - if ((--R2_ & 0x80) != 0) + uint8 v3 = r0; + if ((--r2 & 0x80) != 0) break; do { SetMap16HighByteForCurrentObject_Page00(v2); @@ -1613,40 +1735,40 @@ void StdObj21_WideScaleGroundLedge_0DB1E3(uint8 k) { // 0db1e3 void StdObj15_MidwayAndGoalPoint(uint8 k) { // 0db224 uint8 v1 = blocks_sub_scr_pos; - R2_ = blocks_size_or_type & 0xF; - R0_ = blocks_size_or_type >> 4; - R1_ = blocks_size_or_type >> 4; + uint8 r2 = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); for (uint8 i = 0; i != 3; ++i) { - R3_ = kStdObj15_MidwayAndGoalPoint_TopMidwayTiles[i]; - if (R2_) - R3_ = kStdObj15_MidwayAndGoalPoint_TopGoalTiles[i]; + uint8 r3 = kStdObj15_MidwayAndGoalPoint_TopMidwayTiles[i]; + if (r2) + r3 = kStdObj15_MidwayAndGoalPoint_TopGoalTiles[i]; SetMap16HighByteForCurrentObject_Page00(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, R3_); + SetMap16LowByte(v1, r3); if (v1 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } uint8 v4 = v1 + 16; - if (--R1_) { + if (--r1) { do { - R3_ = kStdObj15_MidwayAndGoalPoint_MiddleMidwayTiles[i]; - if (R2_) - R3_ = kStdObj15_MidwayAndGoalPoint_MiddleGoalTiles[i]; + r3 = kStdObj15_MidwayAndGoalPoint_MiddleMidwayTiles[i]; + if (r2) + r3 = kStdObj15_MidwayAndGoalPoint_MiddleGoalTiles[i]; SetMap16HighByteForCurrentObject_Page00(v4); - IndirWriteByte(&ptr_lo_map16_data, v4, R3_); + SetMap16LowByte(v4, r3); if (v4 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v4 += 16; - } while (--R1_); + } while (--r1); } - R3_ = kStdObj15_MidwayAndGoalPoint_BottomMidwayTiles[i]; - if (R2_) - R3_ = kStdObj15_MidwayAndGoalPoint_BottomGoalTiles[i]; + r3 = kStdObj15_MidwayAndGoalPoint_BottomMidwayTiles[i]; + if (r2) + r3 = kStdObj15_MidwayAndGoalPoint_BottomGoalTiles[i]; SetMap16HighByteForCurrentObject_Page00(v4); - IndirWriteByte(&ptr_lo_map16_data, v4, R3_); + SetMap16LowByte(v4, r3); RestoreLevelDataPointerInObjects(); v1 = blocks_sub_scr_pos + 1; if (((blocks_sub_scr_pos + 1) & 0xF) == 0) { @@ -1654,54 +1776,54 @@ void StdObj15_MidwayAndGoalPoint(uint8 k) { // 0db224 v1 = blocks_sub_scr_pos & 0xF0; } blocks_sub_scr_pos = v1; - R1_ = R0_; + r1 = r0; } } void ExtObj41_YoshiCoin(uint8 k) { // 0db2ca if ((kBitTable_Bank0D[ow_level_number_lo & 7] & flag_collected5_yoshi_coins[ow_level_number_lo >> 3]) == 0) { - R8_W = PAIR16(kBank0DItemMemoryIndexes_Hi[misc_item_memory_setting], kBank0DItemMemoryIndexes_Lo[misc_item_memory_setting]) + 0x19f8; - R14_ = 4 * blocks_screen_to_place_next_object; - if ((R10_ & 0x10) != 0) - R14_ |= 2; + uint16 r8 = PAIR16(kBank0DItemMemoryIndexes_Hi[misc_item_memory_setting], kBank0DItemMemoryIndexes_Lo[misc_item_memory_setting]) + 0x19f8; + uint8 r14 = 4 * blocks_screen_to_place_next_object; + if ((loadlvl_R10 & 0x10) != 0) + r14 |= 2; if ((blocks_sub_scr_pos & 8) != 0) - R14_ |= 1; - if ((kBitTable_Bank0D[blocks_sub_scr_pos & 7] & RomPtr_RAM(R8_W)[R14_]) == 0) { + r14 |= 1; + if ((kBitTable_Bank0D[blocks_sub_scr_pos & 7] & RomPtr_RAM(r8)[r14]) == 0) { uint8 v2 = blocks_sub_scr_pos; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v2, 0x2D); + SetMap16LowByte(v2, 0x2D); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); SetMap16HighByteForCurrentObject_Page00(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, 0x2E); + SetMap16LowByte(v3, 0x2E); } } } void StdObj16_PurpleCoins(uint8 k) { // 0db336 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; int8 v2 = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); while (1) { - R8_W = PAIR16(kBank0DItemMemoryIndexes_Hi[misc_item_memory_setting], kBank0DItemMemoryIndexes_Lo[misc_item_memory_setting]) + 0x19f8; - R14_ = 4 * blocks_screen_to_place_next_object; - if ((R10_ & 0x10) != 0) - R14_ |= 2; + uint16 r8 = PAIR16(kBank0DItemMemoryIndexes_Hi[misc_item_memory_setting], kBank0DItemMemoryIndexes_Lo[misc_item_memory_setting]) + 0x19f8; + uint8 r14 = 4 * blocks_screen_to_place_next_object; + if ((loadlvl_R10 & 0x10) != 0) + r14 |= 2; if ((v1 & 8) != 0) - R14_ |= 1; - R15_ = kBitTable_Bank0D[v1 & 7] & RomPtr_RAM(R8_W)[R14_]; + r14 |= 1; + uint8 r15 = kBitTable_Bank0D[v1 & 7] & RomPtr_RAM(r8)[r14]; SetMap16HighByteForCurrentObject_Page00(v1); - R12_ = 44; - if (R15_) + uint8 r12 = 44; + if (r15) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(0); else - v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, R12_); + v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, r12); if (--v2 < 0) { RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - v2 = R0_; - if ((--R1_ & 0x80) != 0) + v2 = r0; + if ((--r1 & 0x80) != 0) break; } } @@ -1709,45 +1831,42 @@ void StdObj16_PurpleCoins(uint8 k) { // 0db336 void StdObj17_RopeAndCloudLine(uint8 k) { // 0db3bd uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kStdObj17_RopeAndCloudLine_Tiles[v2]); - --R0_; - } while ((R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); } void RopeObj2E_Unused(uint8 k) { // 0db3e3 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R2_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r2 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; uint8 v2 = k - 23; PreserveLevelDataPointerInObjects(); do { SetMap16HighByteForCurrentObject_Page00(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kStdObj18_WaterWithAnimatedSurface_TopTiles[v2]); - --R2_; - } while ((R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); while (1) { RestoreLevelDataPointerInObjects(); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R2_ = R0_; - if ((--R1_ & 0x80) != 0) + r2 = r0; + if ((--r1 & 0x80) != 0) break; do { SetMap16HighByteForCurrentObject_Page00(v3); v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v3, kStdObj18_WaterWithAnimatedSurface_BottomTiles[v2]); - --R2_; - } while ((R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); } } void StdObj1C_DonutBridge(uint8 k) { // 0db42d uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type & 0xF; PreserveLevelDataPointerInObjects(); uint8 v2 = 0; while (1) { @@ -1755,10 +1874,10 @@ void StdObj1C_DonutBridge(uint8 k) { // 0db42d if (v2) SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kStdObj1C_DonutBridge_Tiles[v2]); - if ((--R1_ & 0x80) != 0) { + if ((--r1 & 0x80) != 0) { RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R1_ = R0_; + r1 = r0; if (++v2 == 2) break; } @@ -1767,11 +1886,11 @@ void StdObj1C_DonutBridge(uint8 k) { // 0db42d void StdObj1D_ClimbingNetWithBottomEdge(uint8 k) { // 0db461 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; - R1_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r1 = blocks_size_or_type & 0xF; int8 v2 = blocks_size_or_type & 0xF; PreserveLevelDataPointerInObjects(); - for (; R0_; --R0_) { + for (; r0; --r0) { do { SetMap16HighByteForCurrentObject_Page00(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0xB); @@ -1779,7 +1898,7 @@ void StdObj1D_ClimbingNetWithBottomEdge(uint8 k) { // 0db461 } while (v2 >= 0); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - v2 = R1_; + v2 = r1; } do { SetMap16HighByteForCurrentObject_Page00(v1); @@ -1790,57 +1909,41 @@ void StdObj1D_ClimbingNetWithBottomEdge(uint8 k) { // 0db461 void StdObj1E_ClimbingNetWithSideEdge(uint8 k) { // 0db49e uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; uint8 v2 = blocks_size_or_type & 0xF; StdObj1E_ClimbingNetWithSideEdge_0DB4D9(v2, blocks_sub_scr_pos, kStdObj1E_ClimbingNetWithSideEdge_SideTiles[v2]); while (1) { if (v1 + 16 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); v1 += 16; - if (!--R0_) + if (!--r0) break; SetMap16HighByteForCurrentObject_Page00(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, kStdObj1E_ClimbingNetWithSideEdge_SideTiles[v2]); + SetMap16LowByte(v1, kStdObj1E_ClimbingNetWithSideEdge_SideTiles[v2]); } StdObj1E_ClimbingNetWithSideEdge_0DB4FE(v2, v1, kStdObj1E_ClimbingNetWithSideEdge_SideTiles[v2]); } void StdObj1E_ClimbingNetWithSideEdge_0DB4D9(uint8 k, uint8 j, uint8 a) { // 0db4d9 - R12_ = a; uint8 v3 = *IndirPtr(&ptr_lo_map16_data, j); - uint8 v4; if (v3 == 8) { - v4 = kStdObj1E_ClimbingNetWithSideEdge_TopCornerTiles[k]; -LABEL_5: - R12_ = v4; - goto LABEL_6; - } - if (v3 == 14) { - v4 = kStdObj1E_ClimbingNetWithSideEdge_TopInnerCornerTiles[k]; - goto LABEL_5; + a = kStdObj1E_ClimbingNetWithSideEdge_TopCornerTiles[k]; + } else if (v3 == 14) { + a = kStdObj1E_ClimbingNetWithSideEdge_TopInnerCornerTiles[k]; } -LABEL_6: SetMap16HighByteForCurrentObject_Page00(j); - IndirWriteByte(&ptr_lo_map16_data, j, R12_); + SetMap16LowByte(j, a); } void StdObj1E_ClimbingNetWithSideEdge_0DB4FE(uint8 k, uint8 j, uint8 a) { // 0db4fe - R12_ = a; uint8 v3 = *IndirPtr(&ptr_lo_map16_data, j); - uint8 v4; if (v3 == 14) { - v4 = kStdObj1E_ClimbingNetWithSideEdge_BottomCornerTiles[k]; -LABEL_5: - R12_ = v4; - goto LABEL_6; + a = kStdObj1E_ClimbingNetWithSideEdge_BottomCornerTiles[k]; + } else if (v3 == 8) { + a = kStdObj1E_ClimbingNetWithSideEdge_BottomInnerCornerTiles[k]; } - if (v3 == 8) { - v4 = kStdObj1E_ClimbingNetWithSideEdge_BottomInnerCornerTiles[k]; - goto LABEL_5; - } -LABEL_6: SetMap16HighByteForCurrentObject_Page00(j); - IndirWriteByte(&ptr_lo_map16_data, j, R12_); + SetMap16LowByte(j, a); } void StdObj1F_SkinnyVerticalPipeBoneLog(uint8 k) { // 0db51f @@ -1848,14 +1951,14 @@ void StdObj1F_SkinnyVerticalPipeBoneLog(uint8 k) { // 0db51f int8 v2 = (uint8)(blocks_size_or_type & 0xF0) >> 4; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); for (uint8 i = 83;; i = 84) { - IndirWriteByte(&ptr_lo_map16_data, v1, i); + SetMap16LowByte(v1, i); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); if (!--v2) break; SetMap16HighByteForCurrentObject_Page01(v1); } SetMap16HighByteForCurrentObject_Page01(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, 0x55); + SetMap16LowByte(v1, 0x55); } void StdObj20_SkinnyHorizontalPipeBoneLog(uint8 k) { // 0db547 @@ -1869,14 +1972,14 @@ void StdObj20_SkinnyHorizontalPipeBoneLog(uint8 k) { // 0db547 SetMap16HighByteForCurrentObject_Page01(v1); } SetMap16HighByteForCurrentObject_Page01(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, 0x58); + SetMap16LowByte(v1, 0x58); } void ExtObj6B_CloudFringeBottomLeft(uint8 k) { // 0db571 uint8 v0 = blocks_sub_scr_pos; uint8 v1 = blocks_size_or_type - 104; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj68_CloudFringeBottomAndRightEdge_Tiles[v1]); + SetMap16LowByte(v0, kExtObj68_CloudFringeBottomAndRightEdge_Tiles[v1]); } void ExtObj8E_YellowSwitchBlock(uint8 k) { // 0db583 @@ -1891,42 +1994,42 @@ void ExtObj8E_YellowSwitchBlock_0DB58D(uint8 k) { // 0db58d uint8 v1 = blocks_sub_scr_pos; if (flag_activated_switches[k]) { SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v1, kExtObj8E_YellowSwitchBlock_ActiveTiles[k]); + SetMap16LowByte(v1, kExtObj8E_YellowSwitchBlock_ActiveTiles[k]); } else { SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v1, kExtObj8E_YellowSwitchBlock_InactiveTiles[k]); + SetMap16LowByte(v1, kExtObj8E_YellowSwitchBlock_InactiveTiles[k]); } } void GrassObj3F_SmallBushes(uint8 k) { // 0db5b7 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = blocks_size_or_type >> 4; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); for (uint8 i = kGrassObj3F_SmallBushes_LeftTiles[v2];; i = kGrassObj3F_SmallBushes_MiddleTiles[v2]) { v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, i); - if (!--R0_) + if (!--r0) break; SetMap16HighByteForCurrentObject_Page00(v1); } SetMap16HighByteForCurrentObject_Page00(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, kGrassObj3F_SmallBushes_RightTiles[v2]); + SetMap16LowByte(v1, kGrassObj3F_SmallBushes_RightTiles[v2]); } void GrassObj3C_ArchLedge(uint8 k) { // 0db604 - R0_ = blocks_size_or_type & 0xF; - R3_ = 3; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r3 = 3; uint8 v1 = 0; PreserveLevelDataPointerInObjects(); uint8 v2 = blocks_sub_scr_pos; - R2_ = R0_; - R1_ = 2; + uint8 r2 = r0; + uint8 r1 = 2; do { SetMap16HighByteForCurrentObject_Page01(v2); v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, kGrassObj3C_ArchLedge_Tiles[v1++]); - --R1_; - } while ((R1_ & 0x80) == 0); - if (--R2_) { + --r1; + } while ((r1 & 0x80) == 0); + if (--r2) { do { SetMap16HighByteForCurrentObject_Page01(v2); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, kGrassObj3C_ArchLedge_Tiles[v1]); @@ -1934,8 +2037,8 @@ void GrassObj3C_ArchLedge(uint8 k) { // 0db604 uint8 v4 = HandleHorizontalSubScreenCrossingForCurrentObject(v3, kGrassObj3C_ArchLedge_Tiles[v1 + 1]); SetMap16HighByteForCurrentObject_Page01(v4); v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, kGrassObj3C_ArchLedge_Tiles[v1 + 2]); - --R2_; - } while (R2_); + --r2; + } while (r2); } uint8 v5 = v1 + 3; SetMap16HighByteForCurrentObject_Page01(v2); @@ -1944,17 +2047,17 @@ void GrassObj3C_ArchLedge(uint8 k) { // 0db604 uint8 v7 = v5 + 1; RestoreLevelDataPointerInObjects(); HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R3_ & 0x80) != 0) + if ((--r3 & 0x80) != 0) break; uint8 v6 = blocks_sub_scr_pos; - R2_ = R0_; - R1_ = 2; + r2 = r0; + r1 = 2; do { SetMap16HighByteForCurrentObject_Page00(v6); v6 = HandleHorizontalSubScreenCrossingForCurrentObject(v6, kGrassObj3C_ArchLedge_Tiles[v7++]); - --R1_; - } while ((R1_ & 0x80) == 0); - if (--R2_) { + --r1; + } while ((r1 & 0x80) == 0); + if (--r2) { do { SetMap16HighByteForCurrentObject_Page00(v6); uint8 v8 = HandleHorizontalSubScreenCrossingForCurrentObject(v6, kGrassObj3C_ArchLedge_Tiles[v7]); @@ -1962,8 +2065,8 @@ void GrassObj3C_ArchLedge(uint8 k) { // 0db604 uint8 v9 = HandleHorizontalSubScreenCrossingForCurrentObject(v8, kGrassObj3C_ArchLedge_Tiles[v7 + 1]); SetMap16HighByteForCurrentObject_Page00(v9); v6 = HandleHorizontalSubScreenCrossingForCurrentObject(v9, kGrassObj3C_ArchLedge_Tiles[v7 + 2]); - --R2_; - } while (R2_); + --r2; + } while (r2); } v5 = v7 + 3; SetMap16HighByteForCurrentObject_Page00(v6); @@ -1973,31 +2076,31 @@ void GrassObj3C_ArchLedge(uint8 k) { // 0db604 void GrassObj3D_TopCloudFridge(uint8 k) { // 0db6c3 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page00(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kGrassObj3D_TopCloudFridge_Tiles[v2]); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void ExtObj89_LeftTreeBranch(uint8 k) { // 0db6e3 uint8 v0 = blocks_sub_scr_pos; uint8 v1 = blocks_size_or_type + 120; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj88_RightTreeBranch_Tiles[v1]); + SetMap16LowByte(v0, kExtObj88_RightTreeBranch_Tiles[v1]); } void GrassObj3E_SideCloudFridges(uint8 k) { // 0db705 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; uint8 v2 = blocks_size_or_type & 0xF; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); for (uint8 i = kGrassObj3E_SideCloudFridges_TopTiles[v2];; i = kGrassObj3E_SideCloudFridges_BottomTiles[v2]) { - IndirWriteByte(&ptr_lo_map16_data, v1, i); + SetMap16LowByte(v1, i); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page00(v1); } @@ -2005,53 +2108,53 @@ void GrassObj3E_SideCloudFridges(uint8 k) { // 0db705 void GrassObj39_RightFacingDiagonalPipe(uint8 k) { // 0db73f uint8 updated = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; - R1_ = 1; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r1 = 1; uint8 v2 = 0; PreserveLevelDataPointerInObjects(); while (1) { - R2_ = R1_; + uint8 r2 = r1; do { SetMap16HighByteForCurrentObject_Page01(updated); updated = HandleHorizontalSubScreenCrossingForCurrentObject(updated, kGrassObj39_RightFacingDiagonalPipe_Tiles[v2++]); - --R2_; - } while ((R2_ & 0x80) == 0); + --r2; + } while ((r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); updated = GoDownLeftAndUpdateLevelDataPointerInObjects(); - ++R1_; - ++R1_; - if ((--R0_ & 0x80) != 0) + ++r1; + ++r1; + if ((--r0 & 0x80) != 0) break; if (v2 == 6) { - --R1_; + --r1; do { - R2_ = R1_; + r2 = r1; do { SetMap16HighByteForCurrentObject_Page01(updated); updated = HandleHorizontalSubScreenCrossingForCurrentObject(updated, kGrassObj39_RightFacingDiagonalPipe_Tiles[v2++]); - --R2_; - } while ((R2_ & 0x80) == 0); + --r2; + } while ((r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); updated = GoDownLeftAndUpdateLevelDataPointerInObjects(); if (v2 == 16) v2 = 11; - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); break; } } uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject_Entry2(updated); SetMap16HighByteForCurrentObject_Page01(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, 0xEB); + SetMap16LowByte(v3, 0xEB); } void GrassObjXX_DiagonalLedge_LeftFacingDiagonalLedgeEntry(uint8 k) { // 0db7aa uint8 v7; uint8 j = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R2_ = blocks_size_or_type & 0xF; - R3_ = blocks_size_or_type >> 4; - R1_ = 1; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r2 = blocks_size_or_type & 0xF; + uint8 r3 = blocks_size_or_type >> 4; + uint8 r1 = 1; PreserveLevelDataPointerInObjects(); SetMap16HighByteForCurrentObject_Page01(j); j = FillInSlopeTileAir(j, 0xAA); @@ -2059,9 +2162,9 @@ void GrassObjXX_DiagonalLedge_LeftFacingDiagonalLedgeEntry(uint8 k) { // 0db7aa while (1) { RestoreLevelDataPointerInObjects(); j = GoDownLeftAndUpdateLevelDataPointerInObjects(); - ++R1_; - v7 = ++R1_; - if ((--R2_ & 0x80) != 0) + ++r1; + v7 = ++r1; + if ((--r2 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page01(j); j = FillInSlopeTileAir(j, 0xAA); @@ -2079,7 +2182,7 @@ void GrassObjXX_DiagonalLedge_LeftFacingDiagonalLedgeEntry(uint8 k) { // 0db7aa blocks_sub_scr_pos = j; PreserveLevelDataPointerInObjects(); uint8 v9 = v7 - 1; - R1_ = v9; + r1 = v9; SetMap16HighByteForCurrentObject_Page01(j); j = FillInSlopeTileAir(j, 0xF7); for (;;) { @@ -2091,8 +2194,8 @@ void GrassObjXX_DiagonalLedge_LeftFacingDiagonalLedgeEntry(uint8 k) { // 0db7aa j = GrassObjXX_DiagonalLedge_AddDiagonalBlackLinesToDirt(j, 0xA6); RestoreLevelDataPointerInObjects(); j = GoDownRightAndUpdateLevelDataPointerInObjects(); - v9 = R1_; - if ((--R3_ & 0x80) != 0) + v9 = r1; + if ((--r3 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page00(j); j = GrassObjXX_DiagonalLedge_AddDiagonalBlackLinesToDirt(j, 0xA3); @@ -2100,22 +2203,21 @@ void GrassObjXX_DiagonalLedge_LeftFacingDiagonalLedgeEntry(uint8 k) { // 0db7aa } uint8 GrassObjXX_DiagonalLedge_AddDiagonalBlackLinesToDirt(uint8 j, uint8 a) { // 0db84e - R15_ = a; uint8 v2 = *IndirPtr(&ptr_lo_map16_data, j); if (v2 != 37) { if (v2 != 63) - ++R15_; - ++R15_; + ++a; + ++a; } - return HandleHorizontalSubScreenCrossingForCurrentObject(j, R15_); + return HandleHorizontalSubScreenCrossingForCurrentObject(j, a); } void GrassObjXX_DiagonalLedge_RightFacingDiagonalLedgeEntry(uint8 k) { // 0db863 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R2_ = blocks_size_or_type & 0xF; - R3_ = blocks_size_or_type >> 4; - R1_ = 1; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r2 = blocks_size_or_type & 0xF; + uint8 r3 = blocks_size_or_type >> 4; + uint8 r1 = 1; PreserveLevelDataPointerInObjects(); uint8 v2 = GrassObjXX_DiagonalLedge_AddDiagonalBlackLinesToDirt(v1, 0xAF); SetMap16HighByteForCurrentObject_Page01(v2); @@ -2124,9 +2226,9 @@ void GrassObjXX_DiagonalLedge_RightFacingDiagonalLedgeEntry(uint8 k) { // 0db86 while (1) { RestoreLevelDataPointerInObjects(); updated = GoDownLeftAndUpdateLevelDataPointerInObjects(); - ++R1_; - uint8 v4 = ++R1_; - if ((--R2_ & 0x80) != 0) + ++r1; + uint8 v4 = ++r1; + if ((--r2 & 0x80) != 0) break; uint8 i; SetMap16HighByteForCurrentObject_Page00(updated); @@ -2139,7 +2241,7 @@ void GrassObjXX_DiagonalLedge_RightFacingDiagonalLedgeEntry(uint8 k) { // 0db86 SetMap16HighByteForCurrentObject_Page01(v5); FillInSlopeTileAir(v5, 0xAF); } - uint8 v7 = --R1_; + uint8 v7 = --r1; SetMap16HighByteForCurrentObject_Page00(updated); uint8 j; for (j = GrassObjXX_DiagonalLedge_AddDiagonalBlackLinesToDirt(updated, 0xA9); --v7; @@ -2151,8 +2253,8 @@ void GrassObjXX_DiagonalLedge_RightFacingDiagonalLedgeEntry(uint8 k) { // 0db86 while (1) { RestoreLevelDataPointerInObjects(); uint8 v11 = GoDownLeftAndUpdateLevelDataPointerInObjects(); - uint8 v10 = R1_; - if ((--R3_ & 0x80) != 0) + uint8 v10 = r1; + if ((--r3 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page00(v11); uint8 m; @@ -2175,75 +2277,72 @@ void GrassObj32_BlueSwitchBlocks_RedSwitchBlockEntry(uint8 k) { // 0db91e void GrassObj32_BlueSwitchBlocks_0DB920(uint8 k) { // 0db920 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; do { - R2_ = R0_; + uint8 r2 = r0; PreserveLevelDataPointerInObjects(); do { SetMap16HighByteForCurrentObject_Page00(v1); - R15_ = kGrassObj32_BlueSwitchBlocks_InactiveTiles[k]; + uint8 r15 = kGrassObj32_BlueSwitchBlocks_InactiveTiles[k]; if (flag_activated_switches[k + 2]) { SetMap16HighByteForCurrentObject_Page01(v1); - R15_ = kGrassObj32_BlueSwitchBlocks_ActiveTiles[k]; + r15 = kGrassObj32_BlueSwitchBlocks_ActiveTiles[k]; } - v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, R15_); - --R2_; - } while ((R2_ & 0x80) == 0); + v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, r15); + } while ((--r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R1_; - } while ((R1_ & 0x80) == 0); + } while ((--r1 & 0x80) == 0); } void GrassObj37_SmallTreeTrunk(uint8 k) { // 0db966 uint8 v1 = blocks_sub_scr_pos; uint8 v2 = blocks_size_or_type & 0xF; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page00(v1); GrassObj37_SmallTreeTrunk_0DB997(v2, v1, kGrassObj37_SmallTreeTrunk_TopTiles[v2]); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page00(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, kGrassObj37_SmallTreeTrunk_BottomTiles[v2]); + SetMap16LowByte(v3, kGrassObj37_SmallTreeTrunk_BottomTiles[v2]); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); } void GrassObj37_SmallTreeTrunk_0DB997(uint8 k, uint8 j, uint8 a) { // 0db997 - R15_ = a; + uint8 *v3 = IndirPtr(&ptr_lo_map16_data, j); + if (k == 1) { - uint8 v3 = *IndirPtr(&ptr_lo_map16_data, j); - if (v3 == 0xB1 || v3 == 0xB6) - R15_ = v3 + 1; - } else if (*IndirPtr(&ptr_lo_map16_data, j) == 14) { + if (*v3 == 0xB1 || *v3 == 0xB6) + a = *v3 + 1; + } else if (*v3== 14) { SetMap16HighByteForCurrentObject_Page01(j); - R15_ = 13; + a = 13; } - IndirWriteByte(&ptr_lo_map16_data, j, R15_); + *v3 = a; } void GrassObj36_LargeTreeTrunk(uint8 k) { // 0db9c0 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; do { PreserveLevelDataPointerInObjects(); GrassObj36_LargeTreeTrunk_0DB9F6(0xB9, v1); RestoreLevelDataPointerInObjects(); uint8 v2 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page00(v2); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, 0xBB); SetMap16HighByteForCurrentObject_Page00(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, 0xBC); + SetMap16LowByte(v3, 0xBC); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void GrassObj36_LargeTreeTrunk_0DB9F6(uint8 k, uint8 j) { // 0db9f6 @@ -2252,14 +2351,14 @@ void GrassObj36_LargeTreeTrunk_0DB9F6(uint8 k, uint8 j) { // 0db9f6 k = 11; } uint8 v2 = HandleHorizontalSubScreenCrossingForCurrentObject(j, k); - IndirWriteByte(&ptr_lo_map16_data, v2, k + 1); + SetMap16LowByte(v2, k + 1); } void GrassObj35_ForestGround(uint8 k) { // 0dba0a uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; int8 v2 = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); do { SetMap16HighByteForCurrentObject_Page01(v1); @@ -2269,8 +2368,8 @@ void GrassObj35_ForestGround(uint8 k) { // 0dba0a while (1) { RestoreLevelDataPointerInObjects(); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - int8 v4 = R0_; - if ((--R1_ & 0x80) != 0) + int8 v4 = r0; + if ((--r1 & 0x80) != 0) break; do { SetMap16HighByteForCurrentObject_Page00(v3); @@ -2283,42 +2382,42 @@ void GrassObj35_ForestGround(uint8 k) { // 0dba0a void GrassObj34_ForestGroundEdges(uint8 k) { // 0dba4c uint8 v1 = blocks_sub_scr_pos; uint8 v2 = blocks_size_or_type & 0xF; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v1, kGrassObj34_ForestGroundEdges_TopTiles[v2]); + SetMap16LowByte(v1, kGrassObj34_ForestGroundEdges_TopTiles[v2]); while (1) { uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; if ((int8)(v2 - 2) < 0) SetMap16HighByteForCurrentObject_Page01(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, kGrassObj34_ForestGroundEdges_BottomTiles[v2]); + SetMap16LowByte(v3, kGrassObj34_ForestGroundEdges_BottomTiles[v2]); } } void GrassObj33_ForestTreeTop(uint8 k) { // 0dbadc - R15_ = blocks_size_or_type; + uint8 r15 = blocks_size_or_type; do { - R14_ = blocks_sub_scr_pos; + uint8 r14 = blocks_sub_scr_pos; uint8 v1 = blocks_sub_scr_pos; uint8 v2 = 0; - R1_ = 5; - R0_ = 15; + uint8 r1 = 5; + uint8 r0 = 15; PreserveLevelDataPointerInObjects(); do { - R2_ = R0_; + uint8 r2 = r0; do { v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kGrassObj33_ForestTreeTop_Tiles[v2++]); - } while ((--R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); - if (R14_ + 16 >= 256) + if (r14 + 16 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); - R14_ += 16; - v1 = R14_; - } while ((--R1_ & 0x80) == 0); - ptr_lo_map16_data += 0xb0; - ptr_hi_map16_data = ptr_lo_map16_data; - } while ((--R15_ & 0x80) == 0); + r14 += 16; + v1 = r14; + } while ((--r1 & 0x80) == 0); + ptr_lo_map16_data.addr += 0xb0; + ptr_hi_map16_data.addr = ptr_lo_map16_data.addr; + } while ((--r15 & 0x80) == 0); } void GrassObj30_IcyVerticalPipe(uint8 k) { // 0dbb2c @@ -2328,7 +2427,7 @@ void GrassObj30_IcyVerticalPipe(uint8 k) { // 0dbb2c SetMap16HighByteForCurrentObject_Page01(v1); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x61); SetMap16HighByteForCurrentObject_Page01(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, 0x62); + SetMap16LowByte(v3, 0x62); while (1) { RestoreLevelDataPointerInObjects(); uint8 v5 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); @@ -2337,7 +2436,7 @@ void GrassObj30_IcyVerticalPipe(uint8 k) { // 0dbb2c SetMap16HighByteForCurrentObject_Page01(v5); uint8 v4 = HandleHorizontalSubScreenCrossingForCurrentObject(v5, 0x63); SetMap16HighByteForCurrentObject_Page01(v4); - IndirWriteByte(&ptr_lo_map16_data, v4, 0x64); + SetMap16LowByte(v4, 0x64); } } @@ -2353,23 +2452,23 @@ void ExtObj4B_ConveyorEndTile1(uint8 k) { // 0dc259 uint8 v0 = blocks_sub_scr_pos; uint8 v1 = blocks_size_or_type - 75; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj4B_ConveyorEndTile1_Tiles[v1]); + SetMap16LowByte(v0, kExtObj4B_ConveyorEndTile1_Tiles[v1]); } void ExtObj84_CastleEntrance(uint8 k) { // 0dc2e9 uint8 v0 = blocks_sub_scr_pos; for (uint8 i = 0; i != 126; ++i) { - R0_ = 8; + uint8 r0 = 8; do { SetMap16HighByteForCurrentObject_Page00(v0); if (kExtObj84_CastleEntrance_Tiles[i] != 37) - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj84_CastleEntrance_Tiles[i]); + SetMap16LowByte(v0, kExtObj84_CastleEntrance_Tiles[i]); v0 = HandleHorizontalSubScreenCrossingForCurrentObject_Entry2(v0); ++i; - --R0_; - } while (R0_); + --r0; + } while (r0); SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj84_CastleEntrance_Tiles[i]); + SetMap16LowByte(v0, kExtObj84_CastleEntrance_Tiles[i]); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } } @@ -2377,14 +2476,14 @@ void ExtObj84_CastleEntrance(uint8 k) { // 0dc2e9 void ExtObj90_LargeBossDoor(uint8 k) { // 0dc31e uint8 v0 = blocks_sub_scr_pos; uint8 v1 = 0; - R0_ = 1; + uint8 r0 = 1; do { - R1_ = R0_; + uint8 r1 = r0; do { SetMap16HighByteForCurrentObject_Page00(v0); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, kExtObj90_LargeBossDoor_Tiles[v1++]); - --R1_; - } while ((R1_ & 0x80) == 0); + --r1; + } while ((r1 & 0x80) == 0); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } while (v1 != 6); } @@ -2395,29 +2494,29 @@ void CastleObj3D_Escalator(uint8 k) { // 0dc341 void CastleObj3D_Escalator_LeftSlope() { // 0dc358 uint8 v0 = blocks_sub_scr_pos; - R2_ = 0; + uint8 r2 = 0; uint8 v1 = blocks_size_or_type & 3; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; + uint8 r0 = (blocks_size_or_type >> 4) + 1; bool v4; while (1) { - R3_ = R2_; + uint8 r3 = r2; SetMap16HighByteForCurrentObject_Page01(v0); for (uint8 i = HandleHorizontalSubScreenCrossingForCurrentObject(v0, kCastleObj3D_Escalator_ConveyorTiles[v1]);; i = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel()) { - if ((--R3_ & 0x80) == 0) { + if ((--r3 & 0x80) == 0) { SetMap16HighByteForCurrentObject_Page01(i); for (uint8 j = HandleHorizontalSubScreenCrossingForCurrentObject(i, kCastleObj3D_Escalator_ConveyorCornerTiles[v1]); - (--R3_ & 0x80) == 0; j = HandleHorizontalSubScreenCrossingForCurrentObject(j, 0x3F)) { + (--r3 & 0x80) == 0; j = HandleHorizontalSubScreenCrossingForCurrentObject(j, 0x3F)) { SetMap16HighByteForCurrentObject_Page00(j); } } RestoreLevelDataPointerInObjects(); - ++R2_; - v4 = (--R0_ & 0x80) != 0; - if (R0_) + ++r2; + v4 = (--r0 & 0x80) != 0; + if (r0) break; - R3_ = R2_; + r3 = r2; } if (v4) break; @@ -2436,22 +2535,22 @@ void CastleObj3D_Escalator_LeftSlope() { // 0dc358 void CastleObj3D_Escalator_RightSlope() { // 0dc3d8 uint8 v0 = blocks_sub_scr_pos; - R2_ = 0; + uint8 r2 = 0; uint8 v1 = blocks_size_or_type & 3; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; - while (R0_) { + uint8 r0 = (blocks_size_or_type >> 4) + 1; + while (r0) { SetMap16HighByteForCurrentObject_Page01(v0); HandleHorizontalSubScreenCrossingForCurrentObject(v0, kCastleObj3D_Escalator_ConveyorTiles[v1]); RestoreLevelDataPointerInObjects(); uint8 v2 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R3_ = ++R2_; - if ((--R0_ & 0x80) != 0) + uint8 r3 = ++r2; + if ((--r0 & 0x80) != 0) break; - while (R3_ != 1) { + while (r3 != 1) { SetMap16HighByteForCurrentObject_Page00(v2); v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, 0x3F); - --R3_; + --r3; } SetMap16HighByteForCurrentObject_Page01(v2); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, kCastleObj3D_Escalator_ConveyorCornerTiles[v1]); @@ -2460,48 +2559,48 @@ void CastleObj3D_Escalator_RightSlope() { // 0dc3d8 void CastleObj3E_HorizontalLineOfSpikes(uint8 k) { // 0dc42e uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kCastleObj3E_HorizontalLineOfSpikes_Tiles[v2]); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void CastleObj3F_VerticalLineOfSpikes(uint8 k) { // 0dc44f uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; uint8 v2 = blocks_size_or_type & 0xF; do { SetMap16HighByteForCurrentObject_Page01(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, kCastleObj3F_VerticalLineOfSpikes_Tiles[v2]); + SetMap16LowByte(v1, kCastleObj3F_VerticalLineOfSpikes_Tiles[v2]); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void CastleObj3C_StoneBlock(uint8 k) { // 0dc478 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); uint8 v2 = 0; while (1) { - R2_ = R0_; + uint8 r2 = r0; SetMap16HighByteForCurrentObject_Page01(v1); uint8 i; - for (i = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kCastleObj3C_StoneBlock_LeftTiles[v2]); --R2_; + for (i = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kCastleObj3C_StoneBlock_LeftTiles[v2]); --r2; i = HandleHorizontalSubScreenCrossingForCurrentObject(i, kCastleObj3C_StoneBlock_MiddleTiles[v2])) { SetMap16HighByteForCurrentObject_Page01(i); } SetMap16HighByteForCurrentObject_Page01(i); - IndirWriteByte(&ptr_lo_map16_data, i, kCastleObj3C_StoneBlock_RightTiles[v2]); + SetMap16LowByte(i, kCastleObj3C_StoneBlock_RightTiles[v2]); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); v2 = 1; - bool v4 = R1_-- == 1; - if ((R1_ & 0x80) != 0) + bool v4 = r1-- == 1; + if ((r1 & 0x80) != 0) break; if (v4) v2 = 2; @@ -2510,13 +2609,13 @@ void CastleObj3C_StoneBlock(uint8 k) { // 0dc478 void CastleObj3B_GrassLedge(uint8 k) { // 0dc4c9 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; for (int8 i = blocks_size_or_type & 0xF; i >= 0; --i) { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 9); } uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - int8 v4 = R0_; + int8 v4 = r0; do { SetMap16HighByteForCurrentObject_Page00(v3); v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v3, 0x86); @@ -2527,7 +2626,7 @@ void CastleObj3B_GrassLedge(uint8 k) { // 0dc4c9 void CastleObj36_LargeSpikedPillar(uint8 k) { // 0dc4ef uint8 v1 = blocks_sub_scr_pos; int8 v2 = blocks_size_or_type & 0xF; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); if (v2) { uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject_Entry2(v1); @@ -2549,7 +2648,7 @@ void CastleObj36_LargeSpikedPillar(uint8 k) { // 0dc4ef HandleHorizontalSubScreenCrossingForCurrentObject(v7, 0x8A); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page00(v1); uint8 v8 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x8B); @@ -2561,8 +2660,8 @@ void CastleObj36_LargeSpikedPillar(uint8 k) { // 0dc4ef HandleHorizontalSubScreenCrossingForCurrentObject(v10, 0x8C); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); if (!v2) { uint8 v11 = HandleHorizontalSubScreenCrossingForCurrentObject_Entry2(v1); SetMap16HighByteForCurrentObject_Page00(v11); @@ -2574,11 +2673,11 @@ void CastleObj36_LargeSpikedPillar(uint8 k) { // 0dc4ef void CastleObj35_RockWallBackground(uint8 k) { // 0dc58a uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); do { - int8 v2 = R0_; + int8 v2 = r0; do { SetMap16HighByteForCurrentObject_Page00(v1); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x94); @@ -2588,7 +2687,7 @@ void CastleObj35_RockWallBackground(uint8 k) { // 0dc58a } while (v2 >= 0); RestoreLevelDataPointerInObjects(); uint8 v4 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - int8 v5 = R0_; + int8 v5 = r0; do { SetMap16HighByteForCurrentObject_Page00(v4); uint8 v6 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, 0x96); @@ -2598,33 +2697,33 @@ void CastleObj35_RockWallBackground(uint8 k) { // 0dc58a } while (v5 >= 0); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R1_; - } while ((R1_ & 0x80) == 0); + --r1; + } while ((r1 & 0x80) == 0); } void CastleObj34_VerticalDoubleEndedPipe(uint8 k) { // 0dc5d8 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); SetMap16HighByteForCurrentObject_Page01(v1); uint8 v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x33); SetMap16HighByteForCurrentObject_Page01(v2); - IndirWriteByte(&ptr_lo_map16_data, v2, 0x34); + SetMap16LowByte(v2, 0x34); uint8 v4; while (1) { RestoreLevelDataPointerInObjects(); v4 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if (!--R0_) + if (!--r0) break; SetMap16HighByteForCurrentObject_Page00(v4); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, 0x9D); SetMap16HighByteForCurrentObject_Page00(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, 0x9E); + SetMap16LowByte(v3, 0x9E); } SetMap16HighByteForCurrentObject_Page01(v4); uint8 v5 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, 0x33); SetMap16HighByteForCurrentObject_Page01(v5); - IndirWriteByte(&ptr_lo_map16_data, v5, 0x34); + SetMap16LowByte(v5, 0x34); } void ProcessRopeObjects() { // 0dcd90 @@ -2649,7 +2748,7 @@ void ExtObjXX_LineGuideQuarterSmallCircle(uint8 k) { // 0dce94 uint8 v0 = blocks_sub_scr_pos; uint8 v1 = blocks_size_or_type - 81; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObjXX_LineGuideQuarterSmallCircle_Tiles[v1]); + SetMap16LowByte(v0, kExtObjXX_LineGuideQuarterSmallCircle_Tiles[v1]); } void ExtObj70_BitOfCanvas1(uint8 k) { // 0dcea6 @@ -2657,14 +2756,14 @@ void ExtObj70_BitOfCanvas1(uint8 k) { // 0dcea6 SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); uint8 v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0x84); SetMap16HighByteForCurrentObject_Page00(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, 0x85); + SetMap16LowByte(v1, 0x85); } void ExtObj55_HorizontalLineGuideEnd(uint8 k) { // 0dcec0 uint8 v0 = blocks_sub_scr_pos; for (uint8 i = 0; i != 2; ++i) { SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj55_HorizontalLineGuideEnd_Tiles[i]); + SetMap16LowByte(v0, kExtObj55_HorizontalLineGuideEnd_Tiles[i]); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } } @@ -2679,36 +2778,36 @@ void ExtObj56_VerticalLineGuideEnd(uint8 k) { // 0dceda void RopeObj36_HorizontalConveyorRope(uint8 k) { // 0dcef2 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kRopeObj36_HorizontalConveyorRope_Tiles[v2]); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void RopeObj38_HorizontalLineGuide(uint8 k) { // 0dcf12 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page00(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kCastleObj37_HorizontalLineGuide_Tiles[v2]); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void CastleObj38_VerticalLineGuide(uint8 k) { // 0dcf33 uint8 v1 = blocks_sub_scr_pos; uint8 v2 = blocks_size_or_type & 0xF; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page00(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, kCastleObj38_VerticalLineGuide_Tiles[v2]); + SetMap16LowByte(v1, kCastleObj38_VerticalLineGuide_Tiles[v2]); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void RopeObj3A_SlopedLineGuide(uint8 k) { // 0dcf53 @@ -2723,7 +2822,7 @@ void RopeObj3A_SlopedLineGuideLeftSlope(uint8 k) { // 0dcf6e SetMap16HighByteForCurrentObject_Page00(v1); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x8C); SetMap16HighByteForCurrentObject_Page00(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, 0x8D); + SetMap16LowByte(v3, 0x8D); RestoreLevelDataPointerInObjects(); v1 = blocks_sub_scr_pos + 14; if (blocks_sub_scr_pos + 14 >= 256) @@ -2743,12 +2842,12 @@ void RopeObj3A_SlopedLineGuide_ONOFFLeftSlope(uint8 k) { // 0dcfb1 uint8 v1 = 0x86; if (k == 4) v1 = 0x94; - R0_ = v1; + uint8 r0 = v1; uint8 v2 = blocks_sub_scr_pos; int8 v3 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page00(v2); - IndirWriteByte(&ptr_lo_map16_data, v2, R0_); + SetMap16LowByte(v2, r0); v2 = blocks_sub_scr_pos + 15; if (blocks_sub_scr_pos + 15 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); @@ -2771,7 +2870,7 @@ void RopeObj3A_SlopedLineGuideRightSlope(uint8 k) { // 0dcff0 SetMap16HighByteForCurrentObject_Page00(v1); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x8E); SetMap16HighByteForCurrentObject_Page00(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, 0x8F); + SetMap16LowByte(v3, 0x8F); RestoreLevelDataPointerInObjects(); uint8 v4 = blocks_sub_scr_pos + 16; if (blocks_sub_scr_pos + 16 >= 256) @@ -2790,12 +2889,12 @@ void RopeObj3A_SlopedLineGuide_ONOFFRightSlope(uint8 k) { // 0dd034 uint8 v1 = -121; if (k == 5) v1 = -107; - R0_ = v1; + uint8 r0 = v1; uint8 v2 = blocks_sub_scr_pos; int8 v3 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page00(v2); - IndirWriteByte(&ptr_lo_map16_data, v2, R0_); + SetMap16LowByte(v2, r0); uint8 v4 = blocks_sub_scr_pos + 16; if (blocks_sub_scr_pos + 16 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); @@ -2817,12 +2916,12 @@ void RopeObj3B_VerySteepSlopedLineGuide_VerySteepLeftSlope() { // 0dd080 uint8 v0 = blocks_sub_scr_pos; for (int8 i = blocks_size_or_type & 0xF; i >= 0; --i) { SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x88); + SetMap16LowByte(v0, 0x88); if (v0 + 16 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); v0 += 16; SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x8A); + SetMap16LowByte(v0, 0x8A); if (v0 + 15 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); v0 = v0 + 15; @@ -2840,12 +2939,12 @@ void RopeObj3B_VerySteepSlopedLineGuide_VerySteepRightSlope() { // 0dd0c3 uint8 v0 = blocks_sub_scr_pos; for (int8 i = blocks_size_or_type & 0xF; i >= 0; --i) { SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x89); + SetMap16LowByte(v0, 0x89); if (v0 + 16 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); v0 = v0 + 16; SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x8B); + SetMap16LowByte(v0, 0x8B); if (v0 + 16 >= 256) HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); v0 = v0 + 16; @@ -2860,14 +2959,14 @@ void RopeObj3B_VerySteepSlopedLineGuide_VerySteepRightSlope() { // 0dd0c3 void RopeObj3C_MushroomTop(uint8 k) { // 0dd103 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); uint8 v2 = 7; uint8 v3 = *IndirPtr(&ptr_lo_map16_data, v1); if (!sign8(v3 - 115) && sign8(v3 - 118)) v2 = 10; uint8 i; - for (i = HandleHorizontalSubScreenCrossingForCurrentObject(v1, v2); --R0_; + for (i = HandleHorizontalSubScreenCrossingForCurrentObject(v1, v2); --r0; i = HandleHorizontalSubScreenCrossingForCurrentObject(i, 8)) { SetMap16HighByteForCurrentObject_Page01(i); } @@ -2881,11 +2980,11 @@ void RopeObj3C_MushroomTop(uint8 k) { // 0dd103 void RopeObj3D_MushroomColumn(uint8 k) { // 0dd145 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); do { - uint8 v2 = R0_; + uint8 v2 = r0; SetMap16HighByteForCurrentObject_Page00(v1); for (uint8 i = 115;; i = 116) { v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, i); @@ -2897,8 +2996,8 @@ void RopeObj3D_MushroomColumn(uint8 k) { // 0dd145 HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x75); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R1_; - } while ((R1_ & 0x80) == 0); + --r1; + } while ((r1 & 0x80) == 0); } void RopeObj3E_HorizontalLog(uint8 k) { // 0dd182 @@ -2920,33 +3019,33 @@ void RopeObj3F_VerticalLog(uint8 k) { // 0dd1a5 int8 v2 = blocks_size_or_type >> 4; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); for (uint8 i = 92;; i = 93) { - IndirWriteByte(&ptr_lo_map16_data, v1, i); + SetMap16LowByte(v1, i); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); if (!--v2) break; SetMap16HighByteForCurrentObject_Page01(v1); } SetMap16HighByteForCurrentObject_Page01(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, 0x5E); + SetMap16LowByte(v1, 0x5E); } void RopeObj35_ColumnWithPlantOnTop(uint8 k) { // 0dd1d9 uint8 v1 = blocks_sub_scr_pos; uint8 v2 = blocks_size_or_type & 0xF; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); SetMap16HighByteForCurrentObject_Page00(v1); uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kRopeObj35_ColumnWithPlantOnTop_LeftPlantTiles[v2]); SetMap16HighByteForCurrentObject_Page00(v3); - IndirWriteByte(&ptr_lo_map16_data, v3, kRopeObj35_ColumnWithPlantOnTop_RightPlantTiles[v2]); - if ((--R0_ & 0x80) == 0) { + SetMap16LowByte(v3, kRopeObj35_ColumnWithPlantOnTop_RightPlantTiles[v2]); + if ((--r0 & 0x80) == 0) { RestoreLevelDataPointerInObjects(); uint8 v4 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); SetMap16HighByteForCurrentObject_Page01(v4); uint8 v5 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, 0x5F); SetMap16HighByteForCurrentObject_Page01(v5); - IndirWriteByte(&ptr_lo_map16_data, v5, 0x60); - if ((--R0_ & 0x80) == 0) { + SetMap16LowByte(v5, 0x60); + if ((--r0 & 0x80) == 0) { RestoreLevelDataPointerInObjects(); uint8 v6 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); uint8 v7 = 0; @@ -2955,22 +3054,22 @@ void RopeObj35_ColumnWithPlantOnTop(uint8 k) { // 0dd1d9 uint8 v8 = HandleHorizontalSubScreenCrossingForCurrentObject(v6, kRopeObj35_ColumnWithPlantOnTop_ColumnTiles[v7]); uint8 v9 = v7 + 1; SetMap16HighByteForCurrentObject_Page01(v8); - IndirWriteByte(&ptr_lo_map16_data, v8, kRopeObj35_ColumnWithPlantOnTop_ColumnTiles[v9]); + SetMap16LowByte(v8, kRopeObj35_ColumnWithPlantOnTop_ColumnTiles[v9]); v7 = v9 + 1; RestoreLevelDataPointerInObjects(); v6 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); if (v7 == 6) v7 = 0; - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } } } void RopeObj32_LogBridge(uint8 k) { // 0dd24e uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type & 0xF; PreserveLevelDataPointerInObjects(); uint8 v2 = 0; while (1) { @@ -2978,10 +3077,10 @@ void RopeObj32_LogBridge(uint8 k) { // 0dd24e if (v2) SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kRopeObj32_LogBridge_Tiles[v2]); - if ((--R1_ & 0x80) != 0) { + if ((--r1 & 0x80) != 0) { RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R1_ = R0_; + r1 = r0; if (++v2 == 2) break; } @@ -2995,24 +3094,24 @@ void ProcessUndergroundObjects() { // 0dd990 void ExtObj60_CaveLavaInnerCorner(uint8 k) { // 0dda57 uint8 v0 = blocks_sub_scr_pos; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, 0xFE); + SetMap16LowByte(v0, 0xFE); } void ExtObj75_CanvasTile1(uint8 k) { // 0dda68 uint8 v0 = blocks_sub_scr_pos; uint8 v1 = blocks_size_or_type - 117; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj75_CanvasTile1_Tiles[v1]); + SetMap16LowByte(v0, kExtObj75_CanvasTile1_Tiles[v1]); } void ExtObj7C_BitOfCanvas1(uint8 k) { // 0dda80 uint8 v0 = blocks_sub_scr_pos; uint8 v1 = blocks_size_or_type - 124; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj7C_BitOfCanvas1_TopTiles[v1]); + SetMap16LowByte(v0, kExtObj7C_BitOfCanvas1_TopTiles[v1]); uint8 v2 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); SetMap16HighByteForCurrentObject_Page00(v2); - IndirWriteByte(&ptr_lo_map16_data, v2, kExtObj7C_BitOfCanvas1_BottomTiles[v1]); + SetMap16LowByte(v2, kExtObj7C_BitOfCanvas1_BottomTiles[v1]); } void ExtObj7F_TorpedoLauncher(uint8 k) { // 0ddaa2 @@ -3032,16 +3131,16 @@ void ExtObj7F_TorpedoLauncher(uint8 k) { // 0ddaa2 void UndergroundObj38_RightLavaEdge(uint8 k) { // 0ddac8 uint8 v1 = blocks_sub_scr_pos; uint8 v2 = blocks_size_or_type & 0xF; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - UndergroundObj38_RightLavaEdge_0DDAE8(v2, v1, kUndergroundObj38_RightLavaEdge_TopTiles[v2]); + UndergroundObj38_RightLavaEdge_0DDAE8(v2, v1, kUndergroundObj38_RightLavaEdge_TopTiles[v2], r0); } -void UndergroundObj38_RightLavaEdge_0DDAE8(uint8 k, uint8 j, uint8 a) { // 0ddae8 +void UndergroundObj38_RightLavaEdge_0DDAE8(uint8 k, uint8 j, uint8 a, uint8 r0) { // 0ddae8 while (1) { - IndirWriteByte(&ptr_lo_map16_data, j, a); + SetMap16LowByte(j, a); j = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page01(j); a = kUndergroundObj38_RightLavaEdge_MiddleTiles[k]; @@ -3055,12 +3154,11 @@ void UndergroundObj39_SlopedCaveLava(uint8 k) { // 0ddaf2 void UndergroundObj39_SlopedCaveLavaLeftSlope() { // 0ddb06 bool v8; uint8 v0 = blocks_sub_scr_pos; - R2_ = 1; - R0_ = 1; + uint8 r2 = 1; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; + uint8 r0 = (blocks_size_or_type >> 4) + 1; while (1) { - uint8 v1 = R2_; + uint8 v1 = r2; SetMap16HighByteForCurrentObject_Page01(v0); uint8 v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0xD2); SetMap16HighByteForCurrentObject_Page01(v2); @@ -3080,12 +3178,12 @@ void UndergroundObj39_SlopedCaveLavaLeftSlope() { // 0ddb06 } LABEL_6: RestoreLevelDataPointerInObjects(); - ++R2_; - ++R2_; - v8 = (--R0_ & 0x80) != 0; - if (R0_) + ++r2; + ++r2; + v8 = (--r0 & 0x80) != 0; + if (r0) break; - v4 = R2_ - 2; + v4 = r2 - 2; v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } if (v8) @@ -3105,17 +3203,16 @@ void UndergroundObj39_SlopedCaveLavaLeftSlope() { // 0ddb06 void UndergroundObj39_SlopedCaveLava_SteepLeftSlope() { // 0ddb8f uint8 v0 = blocks_sub_scr_pos; - R2_ = 0; - R0_ = 0; + uint8 r2 = 0; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; - UndergroundObj39_SlopedCaveLava_0DDBA4(v0); + uint8 r0 = (blocks_size_or_type >> 4) + 1; + UndergroundObj39_SlopedCaveLava_0DDBA4(v0, r0, r2); } -void UndergroundObj39_SlopedCaveLava_0DDBA4(uint8 j) { // 0ddba4 +void UndergroundObj39_SlopedCaveLava_0DDBA4(uint8 j, uint8 r0, uint8 r2) { // 0ddba4 bool v5; while (1) { - uint8 v1 = R2_; + uint8 v1 = r2; SetMap16HighByteForCurrentObject_Page01(j); for (uint8 i = HandleHorizontalSubScreenCrossingForCurrentObject(j, 0xD6);; i = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel()) { @@ -3128,11 +3225,11 @@ void UndergroundObj39_SlopedCaveLava_0DDBA4(uint8 j) { // 0ddba4 } } RestoreLevelDataPointerInObjects(); - ++R2_; - v5 = (--R0_ & 0x80) != 0; - if (R0_) + ++r2; + v5 = (--r0 & 0x80) != 0; + if (r0) break; - v1 = R2_; + v1 = r2; } if (v5) break; @@ -3151,10 +3248,9 @@ void UndergroundObj39_SlopedCaveLava_0DDBA4(uint8 j) { // 0ddba4 void UndergroundObj39_SlopedCaveLavaRightSlope() { // 0ddc02 uint8 v0 = blocks_sub_scr_pos; - R2_ = 1; - R0_ = 1; + uint8 r2 = 1; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; + uint8 r0 = (blocks_size_or_type >> 4) + 1; do { SetMap16HighByteForCurrentObject_Page01(v0); uint8 v4 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0xD4); @@ -3162,9 +3258,9 @@ void UndergroundObj39_SlopedCaveLavaRightSlope() { // 0ddc02 HandleHorizontalSubScreenCrossingForCurrentObject(v4, 0xD5); RestoreLevelDataPointerInObjects(); uint8 v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - ++R2_; - uint8 v2 = ++R2_; - if ((--R0_ & 0x80) != 0) + ++r2; + uint8 v2 = ++r2; + if ((--r0 & 0x80) != 0) break; while (v2 != 3) { SetMap16HighByteForCurrentObject_Page01(v1); @@ -3175,22 +3271,21 @@ void UndergroundObj39_SlopedCaveLavaRightSlope() { // 0ddc02 uint8 v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0xFF); SetMap16HighByteForCurrentObject_Page01(v3); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v3, 0xFC); - } while (R0_); + } while (r0); } void UndergroundObj39_SlopedCaveLava_SteepRightSlope() { // 0ddc61 uint8 v0 = blocks_sub_scr_pos; - R2_ = 0; - R0_ = 0; + uint8 r2 = 0; PreserveLevelDataPointerInObjects(); - R0_ = (blocks_size_or_type >> 4) + 1; - while (R0_) { + uint8 r0 = (blocks_size_or_type >> 4) + 1; + while (r0) { SetMap16HighByteForCurrentObject_Page01(v0); HandleHorizontalSubScreenCrossingForCurrentObject(v0, 0xD7); RestoreLevelDataPointerInObjects(); uint8 v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - uint8 v2 = ++R2_; - if ((--R0_ & 0x80) != 0) + uint8 v2 = ++r2; + if ((--r0 & 0x80) != 0) break; while (v2 != 1) { SetMap16HighByteForCurrentObject_Page01(v1); @@ -3204,10 +3299,10 @@ void UndergroundObj39_SlopedCaveLava_SteepRightSlope() { // 0ddc61 void UndergroundObj3B_CaveLava(uint8 k) { // 0ddca9 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); - int8 v3 = R0_; + int8 v3 = r0; if (k != 57) goto LABEL_4; do { @@ -3218,8 +3313,8 @@ void UndergroundObj3B_CaveLava(uint8 k) { // 0ddca9 while (1) { RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - v3 = R0_; - if ((--R1_ & 0x80) != 0) + v3 = r0; + if ((--r1 & 0x80) != 0) break; do { LABEL_4: @@ -3232,11 +3327,11 @@ void UndergroundObj3B_CaveLava(uint8 k) { // 0ddca9 void UndergroundObj3D_CeilingLedge(uint8 k) { // 0ddcea uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; - R1_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r1 = blocks_size_or_type & 0xF; PreserveLevelDataPointerInObjects(); - for (; R0_; --R0_) { - int8 v2 = R1_; + for (; r0; --r0) { + int8 v2 = r1; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x65); @@ -3245,7 +3340,7 @@ void UndergroundObj3D_CeilingLedge(uint8 k) { // 0ddcea RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } - int8 v3 = R1_; + int8 v3 = r1; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x4E); @@ -3255,15 +3350,15 @@ void UndergroundObj3D_CeilingLedge(uint8 k) { // 0ddcea void UndergroundObj3E_CeilingEdges(uint8 k) { // 0ddd2e uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; uint8 v2 = blocks_size_or_type & 0xF; if (blocks_size_or_type >> 4) { do { SetMap16HighByteForCurrentObject_Page01(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, kUndergroundObj3E_CeilingEdges_TopTiles[v2]); + SetMap16LowByte(v1, kUndergroundObj3E_CeilingEdges_TopTiles[v2]); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while (R0_); + --r0; + } while (r0); } SetMap16HighByteForCurrentObject_Page01(v1); HandleHorizontalSubScreenCrossingForCurrentObject(v1, kUndergroundObj3E_CeilingEdges_BottomTiles[v2]); @@ -3271,11 +3366,11 @@ void UndergroundObj3E_CeilingEdges(uint8 k) { // 0ddd2e void UndergroundObj3F_SolidDirt(uint8 k) { // 0ddd5c uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; - R1_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type >> 4; + uint8 r1 = blocks_size_or_type & 0xF; PreserveLevelDataPointerInObjects(); do { - int8 v2 = R1_; + int8 v2 = r1; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x65); @@ -3283,8 +3378,8 @@ void UndergroundObj3F_SolidDirt(uint8 k) { // 0ddd5c } while (v2 >= 0); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void UndergroundObj3C_VerySteepSlope(uint8 k) { // 0ddd87 @@ -3293,38 +3388,38 @@ void UndergroundObj3C_VerySteepSlope(uint8 k) { // 0ddd87 void UndergroundObj3C_VerySteepSlope_VerySteepLeftSlope() { // 0ddd99 uint8 v0 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = 2 * (blocks_size_or_type & 0xF) + 2; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = 2 * (blocks_size_or_type & 0xF) + 2; do { PreserveLevelDataPointerInObjects(); - uint8 v1 = R1_; + uint8 v1 = r1; SetMap16HighByteForCurrentObject_Page01(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0xCA); + SetMap16LowByte(v0, 0xCA); if (v0 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v0 += 16; SetMap16HighByteForCurrentObject_Page01(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0xCB); + SetMap16LowByte(v0, 0xCB); if (v0 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v0 += 16; SetMap16HighByteForCurrentObject_Page01(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0xF1); + SetMap16LowByte(v0, 0xF1); if (v0 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v0 += 16; int8 v8 = v1 - 2; while (--v8 >= 0) { SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x3F); + SetMap16LowByte(v0, 0x3F); if (v0 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v0 += 16; @@ -3340,44 +3435,44 @@ void UndergroundObj3C_VerySteepSlope_VerySteepLeftSlope() { // 0ddd99 GoBackOneScreenAndUpdateLevelDataPointerInObjects(); } blocks_sub_scr_pos = v0; - R1_ -= 2; - } while ((--R0_ & 0x80) == 0); + r1 -= 2; + } while ((--r0 & 0x80) == 0); } void UndergroundObj3C_VerySteepSlope_VerySteepRightSlope() { // 0dde3c uint8 v0 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = 2 * (blocks_size_or_type & 0xF) + 2; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = 2 * (blocks_size_or_type & 0xF) + 2; do { PreserveLevelDataPointerInObjects(); - uint8 v1 = R1_; + uint8 v1 = r1; SetMap16HighByteForCurrentObject_Page01(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0xCC); + SetMap16LowByte(v0, 0xCC); if (v0 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v0 += 16; SetMap16HighByteForCurrentObject_Page01(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0xCD); + SetMap16LowByte(v0, 0xCD); if (v0 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v0 += 16; SetMap16HighByteForCurrentObject_Page01(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0xF2); + SetMap16LowByte(v0, 0xF2); if (v0 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v0 += 16; int8 v8 = v1 - 2; while (--v8 >= 0) { SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x3F); + SetMap16LowByte(v0, 0x3F); if (v0 + 16 >= 256) { - HIBYTE(ptr_lo_map16_data) += 1; + ptr_lo_map16_data.addr += 256; HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); } v0 += 16; @@ -3392,8 +3487,8 @@ void UndergroundObj3C_VerySteepSlope_VerySteepRightSlope() { // 0dde3c v0 = (v0 - 1) & 0xF0; } blocks_sub_scr_pos = v0; - R1_ -= 2; - } while ((--R0_ & 0x80) == 0); + r1 -= 2; + } while ((--r0 & 0x80) == 0); } void UndergroundObj37_LargeCanvas(uint8 k) { // 0ddf3a @@ -3401,10 +3496,10 @@ void UndergroundObj37_LargeCanvas(uint8 k) { // 0ddf3a PreserveLevelDataPointerInObjects(); uint8 v1 = 80; blocks_sub_scr_pos = 80; - R0_ = 15; - R1_ = 4; + uint8 r0 = 15; + uint8 r1 = 4; do { - int8 v2 = R0_; + int8 v2 = r0; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x61); @@ -3415,26 +3510,26 @@ void UndergroundObj37_LargeCanvas(uint8 k) { // 0ddf3a HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel_Entry2(1); blocks_sub_scr_pos += 64; v1 = blocks_sub_scr_pos; - } while ((--R1_ & 0x80) == 0); + } while ((--r1 & 0x80) == 0); LOBYTE(ptr_lo_map16_data) = 0; - R4_ = 0; + LOBYTE(lvlload_R4W) = 0; LOBYTE(ptr_hi_map16_data) = 0; - R0_ = 0; - R3_ = 7; + r0 = 0; + uint8 r3 = 7; while (1) { - R1_ = 2; - blocks_sub_scr_pos = kUndergroundObj37_LargeCanvas_CanvasPosLo[R0_]; + r1 = 2; + blocks_sub_scr_pos = kUndergroundObj37_LargeCanvas_CanvasPosLo[r0]; uint8 v4 = blocks_sub_scr_pos; - HIBYTE(ptr_lo_map16_data) = kUndergroundObj37_LargeCanvas_CanvasPosHi[R0_]; - R5_ = HIBYTE(ptr_lo_map16_data); + HIBYTE(ptr_lo_map16_data) = kUndergroundObj37_LargeCanvas_CanvasPosHi[r0]; + HIBYTE(lvlload_R4W) = HIBYTE(ptr_lo_map16_data); HIBYTE(ptr_hi_map16_data) = HIBYTE(ptr_lo_map16_data); - R2_ = 3; + uint8 r2 = 3; uint8 v5 = 0; do { SetMap16HighByteForCurrentObject_Page01(v4); v4 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, kUndergroundObj37_LargeCanvas_CanvasTiles[v5++]); - --R2_; - } while ((R2_ & 0x80) == 0); + --r2; + } while ((r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); uint8 v6 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); do { @@ -3443,45 +3538,40 @@ void UndergroundObj37_LargeCanvas(uint8 k) { // 0ddf3a SetMap16HighByteForCurrentObject_Page00(v7); uint8 v8 = HandleHorizontalSubScreenCrossingForCurrentObject(v7, kUndergroundObj37_LargeCanvas_CanvasTiles[v5 + 1]); SetMap16HighByteForCurrentObject_Page00(v8); - IndirWriteByte(&ptr_lo_map16_data, v8, kUndergroundObj37_LargeCanvas_CanvasTiles[v5 + 2]); + SetMap16LowByte(v8, kUndergroundObj37_LargeCanvas_CanvasTiles[v5 + 2]); v6 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - } while ((--R1_ & 0x80) == 0); + } while ((--r1 & 0x80) == 0); uint8 v9 = v5 + 3; - R2_ = 3; + r2 = 3; do { SetMap16HighByteForCurrentObject_Page01(v6); v6 = HandleHorizontalSubScreenCrossingForCurrentObject(v6, kUndergroundObj37_LargeCanvas_CanvasTiles[v9++]); - } while ((--R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); - R2_ = 2; + r2 = 2; uint8 v10 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); do { SetMap16HighByteForCurrentObject_Page00(v10); v10 = HandleHorizontalSubScreenCrossingForCurrentObject(v10, kUndergroundObj37_LargeCanvas_CanvasTiles[v9++]); - } while ((--R2_ & 0x80) == 0); - if ((--R3_ & 0x80) != 0) + } while ((--r2 & 0x80) == 0); + if ((--r3 & 0x80) != 0) break; - ++R0_; + ++r0; } - R8_ = 1; - R9_ = 0; + uint8 r8 = 1; while (1) { - int v11 = (uint16)(2 * R8_W) >> 1; - R4_W = kUndergroundObj37_LargeCanvas_ScreenPosLo[v11]; - R6_W = kUndergroundObj37_LargeCanvas_ScreenPosHi[v11]; - R0_W = 432; - R2_W = 0xc800; - uint8 *v12 = g_ram + R4_W; + int v11 = (uint16)(2 * r8) >> 1; + uint16 r4w = kUndergroundObj37_LargeCanvas_ScreenPosLo[v11]; + uint16 r6 = kUndergroundObj37_LargeCanvas_ScreenPosHi[v11]; + uint8 *v12 = g_ram + r4w; uint8 *v13 = g_ram + 0xC800; MemCpy(v12, v13, 0x1B1); - R0_W = 432; - R2_W = 0xc800; - uint8 *v14 = g_ram + 0x10000 + (R6_W); + uint8 *v14 = g_ram + 0x10000 + (r6); uint8 *v15 = g_ram + 0x10000 + 0xC800; MemCpy(v14, v15, 0x1B1); if (!--blocks_size_or_type) break; - ++R8_; + ++r8; } } @@ -3489,60 +3579,60 @@ void ExtObj71_Canvas1(uint8 k) { // 0de0ae uint8 v0 = blocks_sub_scr_pos; uint8 v1 = kExtObj71_Canvas1_TileIndex[(uint8)(blocks_size_or_type - 113)]; PreserveLevelDataPointerInObjects(); - R1_ = 2; - R2_ = 3; + uint8 r1 = 2; + uint8 r2 = 3; do { SetMap16HighByteForCurrentObject_Page01(v0); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, kExtObj71_Canvas1_Tiles[v1++]); - } while ((--R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); uint8 v2 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); do { - R2_ = 2; + r2 = 2; do { SetMap16HighByteForCurrentObject_Page00(v2); v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, kExtObj71_Canvas1_Tiles[v1++]); - } while ((--R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); RestoreLevelDataPointerInObjects(); v2 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - } while ((--R1_ & 0x80) == 0); - R2_ = 2; + } while ((--r1 & 0x80) == 0); + r2 = 2; do { SetMap16HighByteForCurrentObject_Page00(v2); v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, kExtObj71_Canvas1_Tiles[v1++]); - } while ((--R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); SetMap16HighByteForCurrentObject_Page01(v2); - IndirWriteByte(&ptr_lo_map16_data, v2, 0x5F); + SetMap16LowByte(v2, 0x5F); RestoreLevelDataPointerInObjects(); - R2_ = 2; + r2 = 2; uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); do { SetMap16HighByteForCurrentObject_Page00(v3); v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v3, kExtObj71_Canvas1_Tiles[v1++]); - } while ((--R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); } void UndergroundObj36_4SidedGround(uint8 k) { // 0de135 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); uint8 v2 = 0; while (1) { - R2_ = R0_; + uint8 r2 = r0; SetMap16HighByteForCurrentObject_Page01(v1); uint8 i; - for (i = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kUndergroundObj36_4SidedGround_LeftTiles[v2]); --R2_; + for (i = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kUndergroundObj36_4SidedGround_LeftTiles[v2]); --r2; i = HandleHorizontalSubScreenCrossingForCurrentObject(i, kUndergroundObj36_4SidedGround_MiddleTiles[v2])) { SetMap16HighByteForCurrentObject_Page01(i); } SetMap16HighByteForCurrentObject_Page01(i); - IndirWriteByte(&ptr_lo_map16_data, i, kUndergroundObj36_4SidedGround_RightTiles[v2]); + SetMap16LowByte(i, kUndergroundObj36_4SidedGround_RightTiles[v2]); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); v2 = 1; - bool v4 = R1_-- == 1; - if ((R1_ & 0x80) != 0) + bool v4 = r1-- == 1; + if ((r1 & 0x80) != 0) break; if (v4) v2 = 2; @@ -3557,36 +3647,36 @@ void ExtObj5B_BitOfBrickBackground1(uint8 k) { // 0de95f uint8 v0 = blocks_sub_scr_pos; uint8 v1 = blocks_size_or_type - 87; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj57_SwitchPalaceBottomRightInnerCorner_Tiles[v1]); + SetMap16LowByte(v0, kExtObj57_SwitchPalaceBottomRightInnerCorner_Tiles[v1]); } void ExtObj5F_LargeBackgroundArea(uint8 k) { // 0de971 - R0_ = 3; + uint8 r0 = 3; uint8 v0 = 0; do { do { SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0++, 0x77); + SetMap16LowByte(v0++, 0x77); } while (v0); HIBYTE(ptr_hi_map16_data) = ++HIBYTE(ptr_lo_map16_data); - } while ((--R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); } void ExtObj61_GhostHouseClock(uint8 k) { // 0de9aa uint8 v0 = blocks_sub_scr_pos; uint8 v1 = 9 * (blocks_size_or_type - 97); - R0_ = 2; - R1_ = 2; + uint8 r0 = 2; + uint8 r1 = 2; PreserveLevelDataPointerInObjects(); do { do { SetMap16HighByteForCurrentObject_Page00(v0); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, kExtObj61_GhostHouseClock_Tiles[v1++]); - } while ((--R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); RestoreLevelDataPointerInObjects(); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R0_ = 2; - } while ((--R1_ & 0x80) == 0); + r0 = 2; + } while ((--r1 & 0x80) == 0); } void ExtObj65_TopLeftCobweb(uint8 k) { // 0de9ed @@ -3595,47 +3685,47 @@ void ExtObj65_TopLeftCobweb(uint8 k) { // 0de9ed void ExtObj64_TopRightCobweb_GhostHouseWindowEntry(uint8 k) { // 0de9f5 uint8 v1 = blocks_sub_scr_pos; - R0_ = 1; - R1_ = 1; + uint8 r0 = 1; + uint8 r1 = 1; PreserveLevelDataPointerInObjects(); do { do { SetMap16HighByteForCurrentObject_Page00(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, *((uint8 *)kExtObj64_TopRightCobweb_Tiles + k++)); - } while ((--R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R0_ = 1; - } while ((--R1_ & 0x80) == 0); + r0 = 1; + } while ((--r1 & 0x80) == 0); } void ExtObj66_GhostHouseTopRightToBottomLeftBeam2(uint8 k) { // 0dea3e uint8 v0 = blocks_sub_scr_pos; uint8 v1 = 16 * (blocks_size_or_type - 102); - R0_ = 3; - R1_ = 3; + uint8 r0 = 3; + uint8 r1 = 3; PreserveLevelDataPointerInObjects(); do { do { SetMap16HighByteForCurrentObject_Page00(v0); v0 = HandleHorizontalSubScreenCrossingForCurrentObject( v0, *((uint8 *)kExtObj66_GhostHouseTopRightToBottomLeftBeam2_Tiles + v1++)); - } while ((--R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); RestoreLevelDataPointerInObjects(); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R0_ = 3; - } while ((--R1_ & 0x80) == 0); + r0 = 3; + } while ((--r1 & 0x80) == 0); } void ExtObj49_GhostHouseExit(uint8 k) { // 0deabf uint8 v0 = blocks_sub_scr_pos; uint8 v1 = 0; do { - R0_ = 5; + uint8 r0 = 5; do { SetMap16HighByteForCurrentObject_Page00(v0); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, *((uint8 *)kExtObj49_GhostHouseExit_Tiles + v1++)); - } while ((--R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } while (v1 != 78); } @@ -3643,13 +3733,13 @@ void ExtObj49_GhostHouseExit(uint8 k) { // 0deabf void ExtObj80_GhostHouseEntrance(uint8 k) { // 0deb6a uint8 v0 = blocks_sub_scr_pos; for (uint8 i = 0; i != 0x8C; ++i) { - R0_ = 9; + uint8 r0 = 9; do { SetMap16HighByteForCurrentObject_Page00(v0); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, *((uint8 *)kExtObj80_GhostHouseEntrance_Tiles + i++)); - } while (--R0_); + } while (--r0); SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, *((uint8 *)kExtObj80_GhostHouseEntrance_Tiles + i)); + SetMap16LowByte(v0, *((uint8 *)kExtObj80_GhostHouseEntrance_Tiles + i)); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } } @@ -3657,13 +3747,13 @@ void ExtObj80_GhostHouseEntrance(uint8 k) { // 0deb6a void ExtObj85_YoshisHouse(uint8 k) { // 0dec33 uint8 v0 = blocks_sub_scr_pos; for (uint8 i = 0; i != 0xA0; ++i) { - R0_ = 15; + uint8 r0 = 15; do { SetMap16HighByteForCurrentObject_Page00(v0); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, *((uint8 *)kExtObj85_YoshisHouse_Tiles + i++)); - } while (--R0_); + } while (--r0); SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, *((uint8 *)kExtObj85_YoshisHouse_Tiles + i)); + SetMap16LowByte(v0, *((uint8 *)kExtObj85_YoshisHouse_Tiles + i)); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } } @@ -3671,14 +3761,14 @@ void ExtObj85_YoshisHouse(uint8 k) { // 0dec33 void ExtObj97_SwitchPalaceRightAndBottomEdgeTile(uint8 k) { // 0dec5c uint8 v0 = blocks_sub_scr_pos; SetMap16HighByteForCurrentObject_Page01(blocks_sub_scr_pos); - IndirWriteByte(&ptr_lo_map16_data, v0, 0x10); + SetMap16LowByte(v0, 0x10); } void ExtObj81_Seaweed(uint8 k) { // 0dec68 uint8 v0 = blocks_sub_scr_pos; for (uint8 i = 0; i != 2; ++i) { SetMap16HighByteForCurrentObject_Page00(v0); - IndirWriteByte(&ptr_lo_map16_data, v0, kExtObj81_Seaweed_Tiles[i]); + SetMap16LowByte(v0, kExtObj81_Seaweed_Tiles[i]); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); } } @@ -3687,16 +3777,16 @@ void ExtObj8D_SwitchPalaceSwitch(uint8 k) { // 0dec8e uint8 v0 = blocks_sub_scr_pos; if (!flag_activated_switches[(uint8)(blocks_size_or_type + 118)]) { uint8 v1 = 4 * (blocks_size_or_type + 118); - R0_ = 1; - R1_ = 1; + uint8 r0 = 1; + uint8 r1 = 1; do { - R2_ = R0_; + uint8 r2 = r0; do { SetMap16HighByteForCurrentObject_Page00(v0); v0 = HandleHorizontalSubScreenCrossingForCurrentObject(v0, *((uint8 *)kExtObj8A_GreenSwitchPalaceSwitch_Tiles + v1++)); - } while ((--R2_ & 0x80) == 0); + } while ((--r2 & 0x80) == 0); v0 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - } while ((--R1_ & 0x80) == 0); + } while ((--r1 & 0x80) == 0); } } @@ -3710,20 +3800,20 @@ void GhostHouseObj36_WoodenBlocks(uint8 k) { // 0decc9 void GhostHouseObj35_BrickBackground_0DECCE(uint8 k) { // 0decce uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R2_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r2 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); while (1) { SetMap16HighByteForCurrentObject_Page00(v1); if (k == 1) SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, kGhostObj35_BrickBackground_Tiles[k]); - if ((--R2_ & 0x80) != 0) { + if ((--r2 & 0x80) != 0) { RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - R2_ = R0_; - if ((--R1_ & 0x80) != 0) + r2 = r0; + if ((--r1 & 0x80) != 0) break; } } @@ -3731,18 +3821,18 @@ void GhostHouseObj35_BrickBackground_0DECCE(uint8 k) { // 0decce void GhostHouseObj37_HorizontalBackgroundLogAndRailing(uint8 k) { // 0ded12 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = blocks_size_or_type >> 4; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); for (uint8 i = kGhostObj37_HorizontalBackgroundLogAndRailing_LeftTiles[v2];; i = kGhostObj37_HorizontalBackgroundLogAndRailing_MiddleTiles[v2]) { v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, i); - if (!--R0_) + if (!--r0) break; SetMap16HighByteForCurrentObject_Page00(v1); } SetMap16HighByteForCurrentObject_Page00(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, kGhostObj37_HorizontalBackgroundLogAndRailing_RightTiles[v2]); + SetMap16LowByte(v1, kGhostObj37_HorizontalBackgroundLogAndRailing_RightTiles[v2]); } void GhostHouseObj38_WoodenLedge(uint8 k) { // 0ded43 @@ -3758,18 +3848,18 @@ void GhostHouseObj38_WoodenLedge_WoodLedgeOnColumnEntry(uint8 k, uint8 j) { // SetMap16HighByteForCurrentObject_Page01(j); } SetMap16HighByteForCurrentObject_Page01(j); - IndirWriteByte(&ptr_lo_map16_data, j, 0xC); + SetMap16LowByte(j, 0xC); } void GhostHouseObj39_VerticalBackgroundLog(uint8 k) { // 0ded6b uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; uint8 v2 = blocks_size_or_type & 0xF; SetMap16HighByteForCurrentObject_Page00(blocks_sub_scr_pos); for (uint8 i = kGhostObj39_VerticalBackgroundLog_TopTiles[v2];; i = kGhostObj39_VerticalBackgroundLog_BottomTiles[v2]) { - IndirWriteByte(&ptr_lo_map16_data, v1, i); + SetMap16LowByte(v1, i); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R0_ & 0x80) != 0) + if ((--r0 & 0x80) != 0) break; SetMap16HighByteForCurrentObject_Page00(v1); } @@ -3778,13 +3868,13 @@ void GhostHouseObj39_VerticalBackgroundLog(uint8 k) { // 0ded6b void GhostHouseObj3A_SolidBrickWallAndVerticalLineOfSpikes(uint8 k) { // 0ded99 uint8 v1 = blocks_size_or_type & 0xF; uint8 v2 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page01(v2); - IndirWriteByte(&ptr_lo_map16_data, v2, kGhostObj3A_SolidBrickWallAndVerticalLineOfSpikes_Tiles[v1]); + SetMap16LowByte(v2, kGhostObj3A_SolidBrickWallAndVerticalLineOfSpikes_Tiles[v1]); v2 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - --R0_; - } while ((R0_ & 0x80) == 0); + --r0; + } while ((r0 & 0x80) == 0); } void GhostHouseObj3B_BonusGameLedge(uint8 k) { // 0dedb9 @@ -3798,16 +3888,16 @@ void GhostHouseObj3B_BonusGameLedge(uint8 k) { // 0dedb9 SetMap16HighByteForCurrentObject_Page01(v1); } SetMap16HighByteForCurrentObject_Page01(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, 9); + SetMap16LowByte(v1, 9); } void GhostHouseObj3C_SwitchPalaceCeiling(uint8 k) { // 0deddb int8 i; uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); - for (i = R0_; R1_; --R1_) { + for (i = r0; r1; --r1) { do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x53); @@ -3815,7 +3905,7 @@ void GhostHouseObj3C_SwitchPalaceCeiling(uint8 k) { // 0deddb } while (i >= 0); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - i = R0_; + i = r0; } do { SetMap16HighByteForCurrentObject_Page01(v1); @@ -3826,10 +3916,10 @@ void GhostHouseObj3C_SwitchPalaceCeiling(uint8 k) { // 0deddb void GhostHouseObj3D_SwitchPalaceLedge(uint8 k) { // 0dee17 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); - int8 v2 = R0_; + int8 v2 = r0; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x5D); @@ -3838,8 +3928,8 @@ void GhostHouseObj3D_SwitchPalaceLedge(uint8 k) { // 0dee17 while (1) { RestoreLevelDataPointerInObjects(); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - int8 v4 = R0_; - if ((--R1_ & 0x80) != 0) + int8 v4 = r0; + if ((--r1 & 0x80) != 0) break; do { SetMap16HighByteForCurrentObject_Page01(v3); @@ -3851,11 +3941,11 @@ void GhostHouseObj3D_SwitchPalaceLedge(uint8 k) { // 0dee17 void GhostHouseObj3E_SwitchPalaceRightFacingWall(uint8 k) { // 0dee52 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); do { - for (uint8 i = R0_; i; --i) { + for (uint8 i = r0; i; --i) { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x53); } @@ -3863,19 +3953,19 @@ void GhostHouseObj3E_SwitchPalaceRightFacingWall(uint8 k) { // 0dee52 HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x55); RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - } while ((--R1_ & 0x80) == 0); + } while ((--r1 & 0x80) == 0); } void GhostHouseObj3F_SwitchPalaceLeftFacingWall(uint8 k) { // 0dee89 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); do { SetMap16HighByteForCurrentObject_Page01(v1); uint8 v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0x5C); - int8 v3 = R0_; - if (R0_) { + int8 v3 = r0; + if (r0) { do { SetMap16HighByteForCurrentObject_Page01(v2); v2 = HandleHorizontalSubScreenCrossingForCurrentObject(v2, 0x53); @@ -3884,14 +3974,14 @@ void GhostHouseObj3F_SwitchPalaceLeftFacingWall(uint8 k) { // 0dee89 } RestoreLevelDataPointerInObjects(); v1 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - } while ((--R1_ & 0x80) == 0); + } while ((--r1 & 0x80) == 0); } void GhostHouseObj34_WoodLedgeOnColumn(uint8 k) { // 0deec0 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = 4 * (blocks_size_or_type & 0xF) + 2; - R1_ = blocks_size_or_type >> 4; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); GhostHouseObj38_WoodenLedge_WoodLedgeOnColumnEntry(v2, v1); RestoreLevelDataPointerInObjects(); @@ -3906,10 +3996,10 @@ void GhostHouseObj34_WoodLedgeOnColumn(uint8 k) { // 0deec0 uint8 v5 = v3 + 16; do { RestoreLevelDataPointerInObjects(); - uint8 v6 = R1_; + uint8 v6 = r1; SetMap16HighByteForCurrentObject_Page00(v5); for (uint8 i = 120;; i = 121) { - IndirWriteByte(&ptr_lo_map16_data, v5, i); + SetMap16LowByte(v5, i); if (v5 + 16 >= 256) HIBYTE(ptr_hi_map16_data) = ++HIBYTE(ptr_lo_map16_data); v5 += 16; @@ -3924,7 +4014,7 @@ void GhostHouseObj34_WoodLedgeOnColumn(uint8 k) { // 0deec0 GoForwardOneScreenAndUpdateLevelDataPointerInObjects(); } blocks_sub_scr_pos = v5; - } while ((--R0_ & 0x80) == 0); + } while ((--r0 & 0x80) == 0); } void GhostHouseObj33_Cloud(uint8 k) { // 0def45 @@ -3938,23 +4028,23 @@ void GhostHouseObj33_Cloud(uint8 k) { // 0def45 SetMap16HighByteForCurrentObject_Page00(v1); } SetMap16HighByteForCurrentObject_Page00(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, 0xA2); + SetMap16LowByte(v1, 0xA2); } void GhostHouseObj32_GrassLedge2(uint8 k) { // 0def67 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; int8 v2 = blocks_size_or_type & 0xF; PreserveLevelDataPointerInObjects(); do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0xE); } while (--v2 >= 0); - while ((--R1_ & 0x80) == 0) { + while ((--r1 & 0x80) == 0) { RestoreLevelDataPointerInObjects(); uint8 v3 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - int8 v4 = R0_; + int8 v4 = r0; do { SetMap16HighByteForCurrentObject_Page00(v3); v3 = HandleHorizontalSubScreenCrossingForCurrentObject(v3, 0xA3); @@ -3964,26 +4054,26 @@ void GhostHouseObj32_GrassLedge2(uint8 k) { // 0def67 void GhostHouseObj31_WoodCrate(uint8 k) { // 0defa8 uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); - R2_ = R0_; + uint8 r2 = r0; SetMap16HighByteForCurrentObject_Page01(v1); for (uint8 i = 97;; i = 13) { v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, i); - if (!--R2_) + if (!--r2) break; SetMap16HighByteForCurrentObject_Page01(v1); } SetMap16HighByteForCurrentObject_Page01(v1); - IndirWriteByte(&ptr_lo_map16_data, v1, 0x62); + SetMap16LowByte(v1, 0x62); uint8 v5; for (uint8 j = 1;;) { RestoreLevelDataPointerInObjects(); - R2_ = R0_; + uint8 r2 = r0; j ^= 1; v5 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if (!--R1_) + if (!--r1) break; SetMap16HighByteForCurrentObject_Page01(v5); uint8 v4 = kGhostObj31_WoodCrate_LeftEdgeTiles[j]; @@ -3994,27 +4084,27 @@ void GhostHouseObj31_WoodCrate(uint8 k) { // 0defa8 v4 = kGhostObj31_WoodCrate_MiddleTiles[j]; LABEL_7: v5 = HandleHorizontalSubScreenCrossingForCurrentObject(v5, v4); - } while (--R2_); + } while (--r2); SetMap16HighByteForCurrentObject_Page01(v5); - IndirWriteByte(&ptr_lo_map16_data, v5, kGhostObj31_WoodCrate_RightEdgeTiles[j]); + SetMap16LowByte(v5, kGhostObj31_WoodCrate_RightEdgeTiles[j]); } SetMap16HighByteForCurrentObject_Page01(v5); for (uint8 m = 107;; m = 108) { v5 = HandleHorizontalSubScreenCrossingForCurrentObject(v5, m); - if (!--R0_) + if (!--r0) break; SetMap16HighByteForCurrentObject_Page01(v5); } SetMap16HighByteForCurrentObject_Page01(v5); - IndirWriteByte(&ptr_lo_map16_data, v5, 0x6D); + SetMap16LowByte(v5, 0x6D); } void GhostHouseObj30_GrassLedge1(uint8 k) { // 0df02b uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; - R1_ = blocks_size_or_type >> 4; + uint8 r0 = blocks_size_or_type & 0xF; + uint8 r1 = blocks_size_or_type >> 4; PreserveLevelDataPointerInObjects(); - int8 v2 = R0_; + int8 v2 = r0; do { SetMap16HighByteForCurrentObject_Page01(v1); v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, 0xF); @@ -4022,9 +4112,9 @@ void GhostHouseObj30_GrassLedge1(uint8 k) { // 0df02b while (1) { RestoreLevelDataPointerInObjects(); uint8 v4 = HandleVerticalSubScreenCrossingForCurrentObject_HorizontalLevel(); - if ((--R1_ & 0x80) != 0) + if ((--r1 & 0x80) != 0) break; - int8 v3 = R0_; + int8 v3 = r0; do { SetMap16HighByteForCurrentObject_Page00(v4); v4 = HandleHorizontalSubScreenCrossingForCurrentObject(v4, 0xEA); @@ -4038,10 +4128,10 @@ void GhostHouseObj35_BrickBackground_LogBackgroundEntry(uint8 k) { // 0df066 void GhostHouseObj2E_HorizontalLineOfSpikes(uint8 k) { // 0df06c uint8 v1 = blocks_sub_scr_pos; - R0_ = blocks_size_or_type & 0xF; + uint8 r0 = blocks_size_or_type & 0xF; uint8 v2 = blocks_size_or_type >> 4; do { SetMap16HighByteForCurrentObject_Page01(v1); - v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, *(&kGhostObj2E_HorizontalLineOfSpikes_Tiles + v2)); - } while ((--R0_ & 0x80) == 0); + v1 = HandleHorizontalSubScreenCrossingForCurrentObject(v1, *(kGhostObj2E_HorizontalLineOfSpikes_Tiles + v2)); + } while ((--r0 & 0x80) == 0); } diff --git a/src/smw_cpu_infra.c b/src/smw_cpu_infra.c index b89550e..e5ad0ef 100644 --- a/src/smw_cpu_infra.c +++ b/src/smw_cpu_infra.c @@ -12,7 +12,6 @@ static const uint32 kPatchedCarrys_SMW[] = { 0x18081, 0x1A2CC, 0x1B066, - 0x0fe79, 0x0fe80, 0x0fe88, @@ -28,7 +27,6 @@ static const uint32 kPatchedCarrys_SMW[] = { 0x2B2F6, 0x3AD9B, 0x498A2, - 0x2FBF5, 0x2FBF7, 0x2FC11, @@ -46,6 +44,7 @@ static const uint32 kPatchedCarrys_SMW[] = { 0x2C06C, 0x2AD15, 0x02DDA1, + 0x0399DB, 0x1BC75, @@ -88,14 +87,14 @@ uint32 PatchBugs_SMW1(void) { g_cpu->y = 0; } else if (FixBugHook(0xCC32)) { // UpdateHDMAWindowBuffer_00CC14 reads bad ptr - if (R6_W == 0) { + if (WORD(g_ram[6]) == 0) { g_cpu->a = 0; return 0xCC34; } } else if (FixBugHook(0x04FC00)) { // OWSpr06_KoopaKid uninited Y g_cpu->y = owspr_table0df5[(uint8)g_cpu->x]; } else if (FixBugHook(0x03B830)) { // CheckPlayerPositionRelativeToSprite_Y in bank 3 writes to R15 instead of R14 - R14_ = g_cpu->a; + g_ram[0xe] = g_cpu->a; return 0x3b832; } else if (FixBugHook(0x2F2FC)) { // Wiggler reads from spr_ylos_lo instead of hi g_cpu->a = spr_ypos_hi[g_cpu->x & 0xff]; @@ -112,10 +111,10 @@ uint32 PatchBugs_SMW1(void) { if (LOBYTE(g_cpu->a) == 255 || LOBYTE(g_cpu->a) == 0) g_cpu->a = 1; } else if (FixBugHook(0x4862E)) { // DrawOverworldPlayer doesn't init - R0_W = 0; - R4_W = 0; + WORD(g_ram[0]) = 0; + WORD(g_ram[4]) = 0; } else if (FixBugHook(0x3A0A7)) { // Spr0A8_Blargg OOB - R3_ = (spr_table1602[g_cpu->x] != 0) * 5; + g_ram[3] = (spr_table1602[g_cpu->x] != 0) * 5; } else if (FixBugHook(0x811D)) { if (g_use_my_apu_code) return 0x8125; @@ -126,17 +125,45 @@ uint32 PatchBugs_SMW1(void) { RtlSetUploadingApu(true); } else if (FixBugHook(0x80FB)) { RtlSetUploadingApu(false); + } else if (FixBugHook(0xE3FB)) { + g_ram[12] = g_ram[13] = 0; // R13 not initialized + } else if (FixBugHook(0x1FD50)) { + // Spr029_KoopaKid_Status08_IggyLarry_01FD50 may not init its outputs + WORD(g_ram[0x14b8]) = spr_xpos_lo[g_cpu->x]; + WORD(g_ram[0x14ba]) = spr_ypos_lo[g_cpu->x]; + } else if (FixBugHook(0x1d7f4)) { + WORD(g_ram[8]) = GetSprYPos(g_cpu->x); + WORD(g_ram[10]) = GetSprXPos(g_cpu->x); + } else if (FixBugHook(0x1ec36)) { + g_cpu->a = 1; + } else if (FixBugHook(0x19F1C)) { + if (g_cpu->y >= 84) + g_cpu->y = 0; + } else if (FixBugHook(0x817e)) { + g_cpu->y = g_ram[kSmwRam_APUI02]; + return 0x8181; } return 0; } void SmwCpuInitialize(void) { *SnesRomPtr(0x843B) = 0x60; // remove WaitForHBlank_Entry2 + *SnesRomPtr(0x2DDA2) = 5; + *SnesRomPtr(0xCA5AC) = 7; } static void SmwFixSnapshotForCompare(Snapshot *b, Snapshot *a) { memcpy(&b->ram[0x0], &a->ram[0x0], 16); // temps memcpy(&b->ram[0x10b], &a->ram[0x10b], 0x100 - 0xb); // stack + + memcpy(&b->ram[0x17bb], &a->ram[0x17bb], 1); // unusedram_7e17bb + + memcpy(&b->ram[0x65], &a->ram[0x65], 12); // temp66, etc + memcpy(&b->ram[0x8a], &a->ram[0x8a], 6); // temp8a, etc + + memcpy(&b->ram[0x14B0], &a->ram[0x14B0], 0x11); // temp14b0 etc + + memcpy(&b->ram[0x1436], &a->ram[0x1436], 4); // temp14b0 etc } static uint32 RunCpuUntilPC(uint32 pc1, uint32 pc2) { @@ -171,6 +198,8 @@ void SmwRunOneFrameOfGame_Emulated(void) { // Right after NMI completes, draw the frame, possibly triggering IRQ. assert(!snes->cpu->i); + +/* snes->vPos = snes->hPos = 0; snes->cpu->nmiWanted = snes->cpu->irqWanted = false; snes->inVblank = snes->inNmi = false; @@ -183,26 +212,36 @@ void SmwRunOneFrameOfGame_Emulated(void) { snes_runCpu(snes); } } + */ } -void SmwRunOneFrameOfGame(void) { +void SmwDrawPpuFrame(void) { + SimpleHdma hdma_chans[3]; + Snes *snes = g_snes; - snes->vPos = snes->hPos = 0; - snes->cpu->nmiWanted = snes->cpu->irqWanted = false; - snes->inVblank = snes->inNmi = false; - if (snes->cpu->pc == 0x8000) { - snes->cpu->pc = 0x8001; - SmwVectorReset(); - } - SmwRunOneFrameOfGame_Internal(); + dma_startDma(snes->dma, mirror_hdmaenable, true); +// dma_initHdma(snes->dma); - SmwVectorNMI(); + SimpleHdma_Init(&hdma_chans[0], &g_snes->dma->channel[5]); + SimpleHdma_Init(&hdma_chans[1], &g_snes->dma->channel[6]); + SimpleHdma_Init(&hdma_chans[2], &g_snes->dma->channel[7]); - snes->vPos = snes->hPos = 0; - snes->cpu->nmiWanted = snes->cpu->irqWanted = false; - snes->inVblank = snes->inNmi = false; + int trigger = snes->vIrqEnabled ? snes->vTimer + 1 : -1; + + for (int i = 0; i <= 224; i++) { + ppu_runLine(snes->ppu, i); + SimpleHdma_DoLine(&hdma_chans[0]); + SimpleHdma_DoLine(&hdma_chans[1]); + SimpleHdma_DoLine(&hdma_chans[2]); +// dma_doHdma(snes->dma); + if (i == trigger) { + SmwVectorIRQ(); + trigger = snes->vIrqEnabled ? snes->vTimer + 1 : -1; + } + } + /* while (!snes->inNmi) { snes_handle_pos_stuff(snes); @@ -210,7 +249,22 @@ void SmwRunOneFrameOfGame(void) { snes->cpu->irqWanted = false; SmwVectorIRQ(); } + }*/ +} + +void SmwRunOneFrameOfGame(void) { + Snes *snes = g_snes; + snes->vPos = snes->hPos = 0; + snes->cpu->nmiWanted = snes->cpu->irqWanted = false; + snes->inVblank = snes->inNmi = false; + + if (snes->cpu->pc == 0x8000) { + snes->cpu->pc = 0x8001; + SmwVectorReset(); } + SmwRunOneFrameOfGame_Internal(); + + SmwVectorNMI(); } const RtlGameInfo kSmwGameInfo = { @@ -221,5 +275,6 @@ const RtlGameInfo kSmwGameInfo = { &SmwCpuInitialize, &SmwRunOneFrameOfGame, &SmwRunOneFrameOfGame_Emulated, + &SmwDrawPpuFrame, &SmwFixSnapshotForCompare, }; diff --git a/src/smw_rtl.c b/src/smw_rtl.c index 83af423..9ee61dc 100644 --- a/src/smw_rtl.c +++ b/src/smw_rtl.c @@ -1,6 +1,8 @@ #include "smw_rtl.h" #include "variables.h" #include +#include "common_cpu_infra.h" +#include "snes/snes.h" void AddSprXPos(uint8 k, uint16 x) { AddHiLo(&spr_xpos_hi[k], &spr_xpos_lo[k], x); @@ -43,3 +45,9 @@ void SmwSavePlaythroughSnapshot() { snprintf(buf, sizeof(buf), "playthrough/%d_%d_%d.sav", ow_level_number_lo, misc_exit_level_action, (int)time(NULL)); RtlSaveSnapshot(buf, false); } + +void UploadOAMBuffer() { // 008449 + memcpy(g_snes->ppu->oam, g_ram + 0x200, 0x220); + RtlPpuWrite(OAMADDH, 0x80); + RtlPpuWrite(OAMADDL, mirror_oamaddress_lo); +} diff --git a/src/smw_rtl.h b/src/smw_rtl.h index 37a8788..a4aa837 100644 --- a/src/smw_rtl.h +++ b/src/smw_rtl.h @@ -11,6 +11,11 @@ void SmwVectorNMI(); void SmwVectorIRQ(); void SmwSavePlaythroughSnapshot(); +void SmwCopyToVram(uint16 vram_addr, const uint8 *src, int n); +void SmwClearVram(uint16 vram_addr, uint16 value, int n); +void SmwCopyToVramPitch32(uint16 vram_addr, const uint8 *src, int n); +void SmwCopyToVramLow(uint16 vram_addr, const uint8 *src, int n); + extern bool g_did_finish_level_hook; void AddSprXPos(uint8 k, uint16 x); @@ -42,3 +47,10 @@ typedef struct LevelTileAnimations { } LevelTileAnimations; #pragma pack (pop) + +typedef struct GenTileArgs { + uint8 r6, r7; + uint16 r8; + uint16 r12, r14; + uint16 r10; +} GenTileArgs; diff --git a/src/smw_spc_player.c b/src/smw_spc_player.c index 61527d6..50d5b45 100644 --- a/src/smw_spc_player.c +++ b/src/smw_spc_player.c @@ -64,7 +64,7 @@ typedef struct SmwSpcPlayer { SpcPlayer base; DspRegWriteHistory *reg_write_history; uint8 new_value_from_snes[4]; - uint8 port_to_snes[4]; + uint8 last_value_from_snes[4]; uint8 timer_cycles; uint8 counter_sf0c; @@ -174,7 +174,7 @@ static const MemMap kChannel_Maps[] = { }; static const MemMapSized kSpcPlayer_Maps[] = { {offsetof(SmwSpcPlayer, new_value_from_snes), 0x0, 4}, -{offsetof(SmwSpcPlayer, port_to_snes), 0x4, 4}, +{offsetof(SmwSpcPlayer, base.port_to_snes), 0x4, 4}, {offsetof(SmwSpcPlayer, last_value_from_snes), 0x8, 4}, {offsetof(SmwSpcPlayer, counter_sf0c), 0xc, 1}, {offsetof(SmwSpcPlayer, sfx3_timer), 0xd, 1}, @@ -345,7 +345,7 @@ static void Spc_Loop_Part2(SmwSpcPlayer *p, uint8 ticks) { if (!p->smw_pause_music) Music_Process(p); ReadPortFromSnes(p, 2); - } else if (p->port_to_snes[2]) { + } else if (p->base.port_to_snes[2]) { Channel *c = p->channel + 7; for (p->cur_chan_bit = 0x80; p->cur_chan_bit != 0; p->cur_chan_bit >>= 1, c--) { if (HIBYTE(c->pattern_cur_ptr)) @@ -424,11 +424,11 @@ static void WritePitch(SmwSpcPlayer *p, Channel *c, uint16 pitch) { } static void Sfx0_TurnOffChannel(SmwSpcPlayer *p) { - if (p->port_to_snes[0] == 0x11) { + if (p->base.port_to_snes[0] == 0x11) { p->smw_pause_music = 0x60; Dsp_Write(p, FLG, 0x60); } - p->port_to_snes[0] = 0; + p->base.port_to_snes[0] = 0; p->is_chan_on &= ~0x10; if (p->channel[4].instrument_id) Channel_SetInstrument(p, &p->channel[4], p->channel[4].instrument_id); @@ -450,16 +450,16 @@ static void Sfx0_Process(SmwSpcPlayer *p) { uint8 cmd; if (p->new_value_from_snes[0] == 0x12 || p->new_value_from_snes[0] == 0x11 || - p->port_to_snes[0] != 0x11 && p->port_to_snes[0] != 0x1d) { + p->base.port_to_snes[0] != 0x11 && p->base.port_to_snes[0] != 0x1d) { if (p->new_value_from_snes[0] & 0x80) { p->smw_tempo_increase = 10; p->tempo = (p->tempo + (p->smw_tempo_increase << 8)) & ~0xff; p->new_value_from_snes[3] = 0x1d; - p->port_to_snes[0] = 0x1d; + p->base.port_to_snes[0] = 0x1d; goto play_it; } else if (p->new_value_from_snes[0] != 0) { - p->port_to_snes[0] = p->new_value_from_snes[0]; + p->base.port_to_snes[0] = p->new_value_from_snes[0]; goto play_it; } } @@ -468,7 +468,7 @@ static void Sfx0_Process(SmwSpcPlayer *p) { if (--p->sfx0_countdown) return; goto restart_sfx; - } else if (p->port_to_snes[0]) { + } else if (p->base.port_to_snes[0]) { goto keep_playing; } else { return; @@ -488,7 +488,7 @@ static void Sfx0_Process(SmwSpcPlayer *p) { } p->sfx0_countdown = 2; - if (p->port_to_snes[0] == 0x11 && p->echo_channels) { + if (p->base.port_to_snes[0] == 0x11 && p->echo_channels) { SetEchoOff(p); } @@ -546,7 +546,7 @@ static void Sfx0_Process(SmwSpcPlayer *p) { goto note_continue; } else if (cmd == 0xff) { restart_sfx: - p->sfx0_sound_ptr_cur = WORD(p->ram[0x5681 + (uint8)(p->port_to_snes[0] * 2)]); + p->sfx0_sound_ptr_cur = WORD(p->ram[0x5681 + (uint8)(p->base.port_to_snes[0] * 2)]); goto start_sfx; } else { PlayNote(p, &p->channel[4], cmd); @@ -565,7 +565,7 @@ static void Sfx0_Process(SmwSpcPlayer *p) { } static void Sfx3_TurnOffChannel(SmwSpcPlayer *p) { - p->port_to_snes[3] = 0; + p->base.port_to_snes[3] = 0; p->is_chan_on &= ~0x40; p->chan_bit_flags = 0; Dsp_Write(p, NON, 0); @@ -576,9 +576,9 @@ static void Sfx3_TurnOffChannel(SmwSpcPlayer *p) { static void Sfx3_Process(SmwSpcPlayer *p) { uint8 cmd; - if (p->port_to_snes[3] != 0x24 && (p->new_value_from_snes[3] == 0x24 || p->port_to_snes[3] != 0x1d && p->port_to_snes[3] != 5)) { + if (p->base.port_to_snes[3] != 0x24 && (p->new_value_from_snes[3] == 0x24 || p->base.port_to_snes[3] != 0x1d && p->base.port_to_snes[3] != 5)) { if (p->new_value_from_snes[3] != 0) { - p->port_to_snes[3] = p->new_value_from_snes[3]; + p->base.port_to_snes[3] = p->new_value_from_snes[3]; p->sfx3_timer = 2; Dsp_Write(p, KOF, 0x40); p->is_chan_on |= 0x40; @@ -590,9 +590,9 @@ static void Sfx3_Process(SmwSpcPlayer *p) { if (p->sfx3_timer) { if (--p->sfx3_timer) return; - p->sfx3_sound_ptr_cur = WORD(p->ram[0x5619 + (uint8)(p->port_to_snes[3] * 2)]); + p->sfx3_sound_ptr_cur = WORD(p->ram[0x5619 + (uint8)(p->base.port_to_snes[3] * 2)]); goto start_sfx; - } else if (!p->port_to_snes[3]) { + } else if (!p->base.port_to_snes[3]) { return; } @@ -706,7 +706,7 @@ static void Sfx1_Process(SmwSpcPlayer *p) { if (p->new_value_from_snes[1] == 2) { // enable yoshi drums - if ((p->port_to_snes[2] == 6 || !(p->port_to_snes[2] & ~3)) && !p->smw_player_on_yoshi) { + if ((p->base.port_to_snes[2] == 6 || !(p->base.port_to_snes[2] & ~3)) && !p->smw_player_on_yoshi) { Port1_WriteInstrument(p, 9); p->smw_player_on_yoshi = 1; } @@ -714,9 +714,9 @@ static void Sfx1_Process(SmwSpcPlayer *p) { // disable yoshi drums p->smw_player_on_yoshi = 0; } else if (p->new_value_from_snes[1] == 1 || - p->port_to_snes[1] != 1 && p->new_value_from_snes[1] == 4) { + p->base.port_to_snes[1] != 1 && p->new_value_from_snes[1] == 4) { // jump & two note sfx - p->port_to_snes[1] = p->new_value_from_snes[1]; + p->base.port_to_snes[1] = p->new_value_from_snes[1]; p->sfx1_countdown = 4; Dsp_Write(p, KOF, 0x80); p->is_chan_on |= 0x80; @@ -727,7 +727,7 @@ static void Sfx1_Process(SmwSpcPlayer *p) { return; } - if (p->port_to_snes[1] == 1) { + if (p->base.port_to_snes[1] == 1) { if (p->sfx1_countdown) { if (--p->sfx1_countdown) return; @@ -741,7 +741,7 @@ static void Sfx1_Process(SmwSpcPlayer *p) { Dsp_Write(p, V7VOLR, 0x38); Write_KeyOn(p, 0x80); } else if (--p->chan7_countdown_2 == 0) { - p->port_to_snes[1] = 0; + p->base.port_to_snes[1] = 0; p->is_chan_on &= ~0x80; if (p->channel[7].instrument_id) Channel_SetInstrument(p, &p->channel[7], p->channel[7].instrument_id); @@ -756,14 +756,14 @@ static void Sfx1_Process(SmwSpcPlayer *p) { p->did_affect_volumepitch_flag = 0; if (p->channel[7].pitch_slide_length) Sfx_WritePitchSweep(p, &p->channel[7]); - } else if (p->port_to_snes[1] == 4) { + } else if (p->base.port_to_snes[1] == 4) { if (p->sfx1_countdown) { if (--p->sfx1_countdown) return; p->chan7_countdown_2 = 0x18; goto write_it; } else if (--p->chan7_countdown_2 == 0) { - p->port_to_snes[1] = 0; + p->base.port_to_snes[1] = 0; p->is_chan_on &= ~0x80; if (p->channel[7].instrument_id) Channel_SetInstrument(p, &p->channel[7], p->channel[7].instrument_id); @@ -785,8 +785,8 @@ static void Music_Process(SmwSpcPlayer *p) { uint8 cmd; int t; - if (p->port_to_snes[2] != 0) { - if ((p->port_to_snes[2] == 6 || !(p->port_to_snes[2] & ~3)) && !p->smw_player_on_yoshi) { + if (p->base.port_to_snes[2] != 0) { + if ((p->base.port_to_snes[2] == 6 || !(p->base.port_to_snes[2] & ~3)) && !p->smw_player_on_yoshi) { Dsp_Write(p, KOF, 0x20); p->is_chan_on |= 0x20; } else { @@ -802,7 +802,7 @@ static void Music_Process(SmwSpcPlayer *p) { } if (p->counter_sf0c) goto music_keep_running; - if (p->port_to_snes[2]) + if (p->base.port_to_snes[2]) goto label_a; return; } @@ -810,7 +810,7 @@ static void Music_Process(SmwSpcPlayer *p) { if (cmd == 0x16 || cmd == 0x10 || cmd == 0xf || cmd >= 9 && cmd < 13) p->smw_tempo_increase = 0; - p->port_to_snes[2] = cmd; + p->base.port_to_snes[2] = cmd; p->counter_sf0c = 2; p->music_ptr_toplevel = WORD(p->ram[0x1360 + (cmd - 1) * 2]); @@ -848,7 +848,7 @@ static void Music_Process(SmwSpcPlayer *p) { if ((t >> 8) != 0) break; if (t == 0) { - p->port_to_snes[2] = 0; + p->base.port_to_snes[2] = 0; Dsp_Write(p, KOF, ~p->is_chan_on); return; } @@ -1320,7 +1320,7 @@ static void SmwSpcPlayer_Upload(SpcPlayer *p_in, const uint8_t *data) { p->ram[target++ & 0xffff] = *data++; } while (--numbytes); } - p->port_to_snes[0] = p->port_to_snes[1] = p->port_to_snes[2] = p->port_to_snes[3] = 0; + p->base.port_to_snes[0] = p->base.port_to_snes[1] = p->base.port_to_snes[2] = p->base.port_to_snes[3] = 0; p->is_chan_on = 0; p->smw_tempo_increase = 0; p->smw_pause_music = 0; diff --git a/src/smw_spc_player.h b/src/smw_spc_player.h index 76d8501..3274988 100644 --- a/src/smw_spc_player.h +++ b/src/smw_spc_player.h @@ -14,6 +14,7 @@ typedef struct SpcPlayer { Dsp *dsp; uint8 *ram; uint8 input_ports[4]; + uint8 port_to_snes[4]; SpcPlayer_Initialize_Func *initialize; SpcPlayer_GenerateSamples_Func *gen_samples; diff --git a/src/snes/cpu.c b/src/snes/cpu.c index dcc00fe..837819b 100644 --- a/src/snes/cpu.c +++ b/src/snes/cpu.c @@ -10,7 +10,7 @@ #include "../types.h" //#include "../variables.h" #include "../smw_rtl.h" -#include "../../smb1/smb1_variables.h" +#include "../variables.h" static const int cyclesPerOpcode[256] = { 7, 6, 7, 4, 5, 3, 5, 6, 3, 2, 2, 4, 6, 4, 6, 5, @@ -746,21 +746,23 @@ static void cpu_doOpcode(Cpu* cpu, uint8_t opcode) { pc_hist_ctr = (pc_hist_ctr + 1) & 15; if (cur_pc == pc_bp) { - printf("Rseached BP 0x%x. A=0x%.2x, X=0x%.2x, Y=0x%.2x. C=%d. 0x%x\n", + printf("Reached BP 0x%x. A=0x%.2x, X=0x%.2x, Y=0x%.2x. C=%d. 0x%x\n", cur_pc, (uint8)cpu->a, cpu->x, cpu->y, cpu->c, - WORD(tempE4)); + 0); bp_cnt += 1; - g_snes->debug_cycles = 0; + //g_snes->debug_cycles = 1; } - if (cur_pc == 0x29186&&0) - printf("curpc=0x%x 0x%x\n", g_cpu->a, g_cpu->x); - if (cur_pc == 0x29197 && g_cpu->x == 0x800&&0) { - printf("x=0x%x, y=0x%x, t4=0x%x\n", g_cpu->x, g_cpu->y, WORD(tempE4)); + if (cur_pc == 0x85d2) { +// printf("T: upl stripe %d\n", graphics_stripe_image_to_upload); +// if (cur_pc == 0x29197 && g_cpu->x == 0x800&&0) { +// printf("x=0x%x, y=0x%x, t4=0x%x\n", g_cpu->x, g_cpu->y, WORD(tempE4)); //g_snes->debug_cycles = 1; uint16 t = g_ram[0xf3] | g_ram[0xf4] << 8; // printf("wr 0x%x = 0x%x\n", t + g_cpu->y, g_cpu->a & 0xff); } +// if (cur_pc == 0x2A82E) +// printf("T: Load sprites offs %d: 0x%x\n", g_cpu->y, WORD(g_ram[0])); restart: switch(opcode) { @@ -1478,7 +1480,6 @@ static void cpu_doOpcode(Cpu* cpu, uint8_t opcode) { break; } case 0x6b: { // rtl imp - g_snes->debug_cycles = false; if (cpu->sp >= cpu->spBreakpoint && cpu->spBreakpoint) { assert(cpu->sp == cpu->spBreakpoint); cpu->spBreakpoint = 0; diff --git a/src/snes/snes.c b/src/snes/snes.c index fdd70fc..79bfec1 100644 --- a/src/snes/snes.c +++ b/src/snes/snes.c @@ -208,7 +208,7 @@ void snes_runCycle(Snes* snes) { snes_handle_pos_stuff(snes); } -#define IS_ADR(x) (x == 0xffffffff) +#define IS_ADR(x) (x == 0xffffff) void snes_runCpu(Snes *snes) { uint32_t pc = snes->cpu->k << 16 | snes->cpu->pc; diff --git a/src/snes/snes_regs.h b/src/snes/snes_regs.h index 9fe3cc7..82305fb 100644 --- a/src/snes/snes_regs.h +++ b/src/snes/snes_regs.h @@ -196,6 +196,7 @@ typedef enum SnesRegs { NTRL6 = 0x436A, UNUSED6 = 0x436B, MIRR6 = 0x436F, + DMAP7 = 0x4370, BBAD7 = 0x4371, A1T7L = 0x4372, @@ -203,6 +204,8 @@ typedef enum SnesRegs { A1B7 = 0x4374, DAS7L = 0x4375, DAS7H = 0x4376, + + DAS70 = 0x4377, A2A7L = 0x4378, A2A7H = 0x4379, diff --git a/src/types.h b/src/types.h index f462c73..fa4e121 100644 --- a/src/types.h +++ b/src/types.h @@ -102,6 +102,10 @@ typedef struct PointU16 { uint16 x, y; } PointU16; +typedef struct PointU8 { + uint8 x, y; +} PointU8; + typedef struct OamEnt { uint8 xpos; uint8 ypos; @@ -109,7 +113,7 @@ typedef struct OamEnt { uint8 flags; } OamEnt; -typedef void FuncU8(uint8 k); +typedef void FuncU8(uint8 kk); typedef void FuncV(void); // Some convenience macros to make partial accesses nicer @@ -122,7 +126,7 @@ typedef void FuncV(void); #define LOBYTE(x) BYTEn(x,LOW_IND(x,uint8)) #define LOWORD(x) WORDn(x,LOW_IND(x,uint16)) -#define HIBYTE(x) BYTEn(x,HIGH_IND(x,uint8)) +#define HIBYTE(x) BYTEn(x,1) #define HIWORD(x) WORDn(x,HIGH_IND(x,uint16)) #define GET_HIBYTE(x) (((x) & 0xff00) >> 8) diff --git a/src/variables.h b/src/variables.h index 60e5bf5..5021e28 100644 --- a/src/variables.h +++ b/src/variables.h @@ -1,32 +1,40 @@ -#define R0_W (*(uint16*)(g_ram+0x0)) -#define R1_W (*(uint16*)(g_ram+0x1)) -#define R2_W (*(uint16*)(g_ram+0x2)) -#define R3_W (*(uint16*)(g_ram+0x3)) -#define R4_W (*(uint16*)(g_ram+0x4)) -#define R5_W (*(uint16*)(g_ram+0x5)) -#define R6_W (*(uint16*)(g_ram+0x6)) -#define R8_W (*(uint16*)(g_ram+0x8)) -#define R9_W (*(uint16*)(g_ram+0x9)) -#define R10_W (*(uint16*)(g_ram+0xA)) -#define R12_W (*(uint16*)(g_ram+0xC)) -#define R14_W (*(uint16*)(g_ram+0xE)) +//#define r0w (*(uint16*)(g_ram+0x0)) +//#define r1w (*(uint16*)(g_ram+0x1)) +//#define r2w (*(uint16*)(g_ram+0x2)) +//#define r3w (*(uint16*)(g_ram+0x3)) +//#define r4w (*(uint16*)(g_ram+0x4)) +//#define r5w (*(uint16*)(g_ram+0x5)) +//#define r6w (*(uint16*)(g_ram+0x6)) +//#define r8w (*(uint16*)(g_ram+0x8)) +//#define r9w (*(uint16*)(g_ram+0x9)) +//#define r10w (*(uint16*)(g_ram+0xA)) +//#define r12w (*(uint16*)(g_ram+0xC)) +//#define r14w (*(uint16*)(g_ram+0xE)) + +//#define r0 (*(uint8*)(g_ram+0x0)) +//#define r1 (*(uint8*)(g_ram+0x1)) +//#define r2 (*(uint8*)(g_ram+0x2)) +//#define r3 (*(uint8*)(g_ram+0x3)) +//#define r4 (*(uint8*)(g_ram+0x4)) +//#define r5 (*(uint8*)(g_ram+0x5)) +//#define r6 (*(uint8*)(g_ram+0x6)) +//#define r7 (*(uint8*)(g_ram+0x7)) +//#define r8 (*(uint8*)(g_ram+0x8)) +//#define r9 (*(uint8*)(g_ram+0x9)) +//#define r10 (*(uint8*)(g_ram+0xA)) +//#define r11 (*(uint8*)(g_ram+0xB)) +//#define r12 (*(uint8*)(g_ram+0xC)) +//#define r13 (*(uint8*)(g_ram+0xD)) +//#define r14 (*(uint8*)(g_ram+0xE)) +//#define r15 (*(uint8*)(g_ram+0xF)) + +#define R5_slopeptr (*(LongPtr*)(g_ram+0x5)) + +#define lvlload_R4W (*(uint16*)(g_ram+0x4)) + +#define loadlvl_R10 (*(uint8*)(g_ram+0xA)) +#define loadlvl_R11 (*(uint8*)(g_ram+0xB)) -#define R0_ (*(uint8*)(g_ram+0x0)) -#define R1_ (*(uint8*)(g_ram+0x1)) -#define R2_ (*(uint8*)(g_ram+0x2)) -#define R3_ (*(uint8*)(g_ram+0x3)) -#define R4_ (*(uint8*)(g_ram+0x4)) -#define R5_ (*(uint8*)(g_ram+0x5)) -#define R6_ (*(uint8*)(g_ram+0x6)) -#define R7_ (*(uint8*)(g_ram+0x7)) -#define R8_ (*(uint8*)(g_ram+0x8)) -#define R9_ (*(uint8*)(g_ram+0x9)) -#define R10_ (*(uint8*)(g_ram+0xA)) -#define R11_ (*(uint8*)(g_ram+0xB)) -#define R12_ (*(uint8*)(g_ram+0xC)) -#define R13_ (*(uint8*)(g_ram+0xD)) -#define R14_ (*(uint8*)(g_ram+0xE)) -#define R15_ (*(uint8*)(g_ram+0xF)) #define waiting_for_vblank (*(uint8*)(g_ram+0x10)) #define flag_irqto_use (*(uint8*)(g_ram+0x11)) #define graphics_stripe_image_to_upload (*(uint8*)(g_ram+0x12)) @@ -84,15 +92,16 @@ #define camera_last_screen_horiz (*(uint8*)(g_ram+0x5E)) #define camera_last_screen_vert (*(uint8*)(g_ram+0x5F)) #define sprites_tile_priority (*(uint8*)(g_ram+0x64)) -#define temp65 (*(uint8*)(g_ram+0x65)) -#define temp66 (*(uint8*)(g_ram+0x66)) -#define temp67 (*(uint8*)(g_ram+0x67)) -#define ptr_layer2_data (*(uint16*)(g_ram+0x68)) -#define ptr_layer2_data_bank (*(uint8*)(g_ram+0x6A)) -#define ptr_lo_map16_data (*(uint16*)(g_ram+0x6B)) -#define ptr_lo_map16_data_bank (*(uint8*)(g_ram+0x6D)) -#define ptr_hi_map16_data (*(uint16*)(g_ram+0x6E)) -#define ptr_hi_map16_data_bank (*(uint8*)(g_ram+0x70)) + +// alias +#define credits_var65 (*(uint16*)(g_ram+0x65)) +#define credits_index (*(uint8*)(g_ram+0x67)) + +#define ptr_layer1_data (*(LongPtr*)(g_ram+0x65)) +#define ptr_layer2_data (*(LongPtr*)(g_ram+0x68)) +#define ptr_lo_map16_data (*(LongPtr*)(g_ram+0x6B)) +#define ptr_hi_map16_data (*(LongPtr*)(g_ram+0x6E)) + #define player_current_state (*(uint8*)(g_ram+0x71)) #define player_in_air_flag (*(uint8*)(g_ram+0x72)) #define player_ducking_flag (*(uint8*)(g_ram+0x73)) @@ -107,15 +116,17 @@ #define player_yspeed (*(uint8*)(g_ram+0x7D)) #define player_on_screen_pos_x (*(uint16*)(g_ram+0x7E)) #define player_on_screen_pos_y (*(uint16*)(g_ram+0x80)) -#define ptr_slope_steepness (*(uint16*)(g_ram+0x82)) -#define ptr_slope_steepness_bank (*(uint8*)(g_ram+0x84)) +#define ptr_slope_steepness (*(LongPtr*)(g_ram+0x82)) #define flag_underwater_level (*(uint8*)(g_ram+0x85)) #define flag_ice_level (*(uint8*)(g_ram+0x86)) #define player_timer_pipe_warping (*(uint8*)(g_ram+0x88)) #define player_pipe_action (*(uint8*)(g_ram+0x89)) -#define temp8a (*(uint8*)(g_ram+0x8A)) -#define temp8b (*(uint8*)(g_ram+0x8B)) -#define temp8c (*(uint8*)(g_ram+0x8C)) + +#define decomp_src (*(LongPtr*)(g_ram+0x8A)) + +#define player_collision_var8a (*(uint8*)(g_ram+0x8A)) +#define player_collision_var8b (*(uint8*)(g_ram+0x8B)) +#define player_collision_var8c (*(uint8*)(g_ram+0x8C)) #define temp8d (*(uint8*)(g_ram+0x8D)) #define temp8e (*(uint8*)(g_ram+0x8E)) #define temp8f (*(uint8*)(g_ram+0x8F)) @@ -133,12 +144,10 @@ #define spr_yspeed ((uint8*)(g_ram+0xAA)) #define spr_xspeed ((uint8*)(g_ram+0xB6)) #define spr_table00c2 ((uint8*)(g_ram+0xC2)) -#define ptr_sprite_list_data (*(uint16*)(g_ram+0xCE)) -#define ptr_sprite_list_data_bank (*(uint8*)(g_ram+0xD0)) +#define ptr_sprite_list_data (*(LongPtr*)(g_ram+0xCE)) #define player_current_xpos (*(uint16*)(g_ram+0xD1)) #define player_current_ypos (*(uint16*)(g_ram+0xD3)) -#define spr86_wiggler_segment_pos_ptr (*(uint16*)(g_ram+0xD5)) -#define spr86_wiggler_segment_pos_ptr_bank (*(uint8*)(g_ram+0xD7)) +#define spr86_wiggler_segment_pos_ptr (*(LongPtr*)(g_ram+0xD5)) #define spr_ypos_lo ((uint8*)(g_ram+0xD8)) #define spr_xpos_lo ((uint8*)(g_ram+0xE4)) #define misc_game_mode (*(uint8*)(g_ram+0x100)) @@ -223,8 +232,7 @@ #define players_overworld_xpos_is_going_to ((PointU16*)(g_ram+0xDC7)) #define player_overworld_xspeed (*(uint16*)(g_ram+0xDCF)) #define player_overworld_yspeed (*(uint16*)(g_ram+0xDD1)) -#define ow_player_direction (*(uint8*)(g_ram+0xDD3)) -#define unusedram_7e0dd4 (*(uint8*)(g_ram+0xDD4)) +#define ow_player_direction (*(uint16*)(g_ram+0xDD3)) #define misc_exit_level_action (*(uint8*)(g_ram+0xDD5)) #define player_current_characterx4 (*(uint16*)(g_ram+0xDD6)) #define flag_switch_players (*(uint8*)(g_ram+0xDD8)) @@ -388,10 +396,6 @@ #define timer_hdmawindow_scaling_factor (*(uint8*)(g_ram+0x1433)) #define timer_end_level_via_keyhole (*(uint8*)(g_ram+0x1434)) #define flag_keyhole_anim_phase (*(uint8*)(g_ram+0x1435)) -#define temp1436 (*(uint8*)(g_ram+0x1436)) -#define player_on_tilting_platform_xpos_hi (*(uint8*)(g_ram+0x1437)) -#define temp1438 (*(uint8*)(g_ram+0x1438)) -#define player_on_tilting_platform_ypos_hi (*(uint8*)(g_ram+0x1439)) #define flag_upload_load_screen_letters_tovram (*(uint8*)(g_ram+0x143A)) #define misc_death_message_to_display (*(uint8*)(g_ram+0x143B)) #define timer_display_death_message_animation (*(uint8*)(g_ram+0x143C)) @@ -466,22 +470,55 @@ #define timer_blue_pswitch (*(uint8*)(g_ram+0x14AD)) #define timer_silver_pswitch (*(uint8*)(g_ram+0x14AE)) #define flag_on_off_switch (*(uint8*)(g_ram+0x14AF)) -#define temp14b0 (*(uint8*)(g_ram+0x14B0)) -#define temp14b1 (*(uint8*)(g_ram+0x14B1)) -#define temp14b2 (*(uint8*)(g_ram+0x14B2)) -#define temp14b3 (*(uint8*)(g_ram+0x14B3)) -#define temp14b4 (*(uint8*)(g_ram+0x14B4)) -#define temp14b5 (*(uint8*)(g_ram+0x14B5)) -#define temp14b6 (*(uint8*)(g_ram+0x14B6)) -#define temp14b7 (*(uint8*)(g_ram+0x14B7)) -#define temp14b8 (*(uint8*)(g_ram+0x14B8)) -#define temp14b9 (*(uint8*)(g_ram+0x14B9)) -#define temp14ba (*(uint8*)(g_ram+0x14BA)) -#define temp14bb (*(uint8*)(g_ram+0x14BB)) -#define temp14bc (*(uint8*)(g_ram+0x14BC)) +//#define temp14b0 (*(uint8*)(g_ram+0x14B0)) +//#define temp14b1 (*(uint8*)(g_ram+0x14B1)) +//#define temp14b2 (*(uint8*)(g_ram+0x14B2)) +//#define temp14b3 (*(uint8*)(g_ram+0x14B3)) +// +//#define temp14b4 (*(uint8*)(g_ram+0x14B4)) +//#define temp14b5 (*(uint8*)(g_ram+0x14B5)) +//#define temp14b6 (*(uint8*)(g_ram+0x14B6)) +//#define temp14b7 (*(uint8*)(g_ram+0x14B7)) +// +//#define temp14b8 (*(uint8*)(g_ram+0x14B8)) +//#define temp14b9 (*(uint8*)(g_ram+0x14B9)) +//#define temp14ba (*(uint8*)(g_ram+0x14BA)) +//#define temp14bb (*(uint8*)(g_ram+0x14BB)) +// +//#define temp14bc (*(uint8*)(g_ram+0x14BC)) +// +//#define temp1436 (*(uint8*)(g_ram+0x1436)) +//#define player_on_tilting_platform_xpos_hi (*(uint8*)(g_ram+0x1437)) + +#define player_on_tilting_platform_xpos (*(uint16*)(g_ram+0x1436)) +#define player_on_tilting_platform_ypos (*(uint16*)(g_ram+0x1438)) + +//#define temp1438 (*(uint8*)(g_ram+0x1438)) +//#define player_on_tilting_platform_ypos_hi (*(uint8*)(g_ram+0x1439)) + +// These are aliased +#define switch_block_event_oam_index (*(uint8*)(g_ram+0x1438)) +#define switch_block_event_blocks_thrown_ctr (*(uint8*)(g_ram+0x1436)) +#define switch_block_event_wait_counter (*(uint8*)(g_ram+0x1437)) +#define switch_block_event_ejection_counter (*(uint8*)(g_ram+0x1439)) + +#define bowserbattle_var14b0 (*(uint8*)(g_ram+0x14B0)) +#define bowserbattle_var14b1 (*(uint8*)(g_ram+0x14B1)) +#define bowserbattle_var14b2 (*(uint8*)(g_ram+0x14B2)) +#define bowserbattle_var14b3 (*(uint8*)(g_ram+0x14B3)) +#define bowserbattle_var14b4 (*(uint8*)(g_ram+0x14B4)) +#define bowserbattle_var14b5 (*(uint8*)(g_ram+0x14B5)) +#define bowserbattle_var14b6 (*(uint8*)(g_ram+0x14B6)) +#define bowserbattle_var14b7 (*(uint8*)(g_ram+0x14B7)) +#define bowserbattle_var14b8 (*(uint8*)(g_ram+0x14B8)) +#define bowserbattle_var14b9 (*(uint8*)(g_ram+0x14B9)) +#define bowserbattle_var14ba (*(uint8*)(g_ram+0x14BA)) +#define bowserbattle_var14bb (*(uint8*)(g_ram+0x14BB)) +#define bowserbattle_var14bc (*(uint8*)(g_ram+0x14BC)) + #define misc_rotating_object_xradius_hi (*(uint8*)(g_ram+0x14BD)) -#define temp14bf (*(uint8*)(g_ram+0x14BF)) -#define temp14c0 (*(uint8*)(g_ram+0x14C0)) +//#define temp14bf (*(uint8*)(g_ram+0x14BF)) +//#define temp14c0 (*(uint8*)(g_ram+0x14C0)) #define sprites_brown_rotating_platform_sine (*(uint16*)(g_ram+0x14C2)) #define sprites_brown_rotating_platform_cosine (*(uint16*)(g_ram+0x14C5)) #define spr_current_status ((uint8*)(g_ram+0x14C8))