From 1b4ecd32101c889aed12798ade4a273ebea55229 Mon Sep 17 00:00:00 2001 From: YohannDR Date: Wed, 31 May 2023 09:29:18 +0200 Subject: [PATCH] Fix ChozodiaEscapeShipHeatingUp fakematch --- README.md | 2 +- src/chozodia_escape.c | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1a5d1124..b97d559c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is a work in progress decompilation of Metroid - Zero Mission. -2593/2721 functions decompiled (95.30%, 128 left) +2594/2721 functions decompiled (95.33%, 127 left) 0x35075f/0x76b014 bytes of data not in blobs (44.68%, 0x41a8b5 left) diff --git a/src/chozodia_escape.c b/src/chozodia_escape.c index fee6a872..8a415ed6 100644 --- a/src/chozodia_escape.c +++ b/src/chozodia_escape.c @@ -608,13 +608,17 @@ u8 ChozodiaEscapeShipLeaving(void) return ended; } +/** + * @brief 882dc | 22c | Handles the ship heating up part of the cutscene + * + * @return u8 bool, ended + */ u8 ChozodiaEscapeShipHeatingUp(void) { - // https://decomp.me/scratch/vi0Uw - u8 ended; u32 timer; - u16 offset; + u32 offset; + u32 tmp; const u16* src1; const u16* src2; @@ -671,25 +675,24 @@ u8 ChozodiaEscapeShipHeatingUp(void) timer = CHOZODIA_ESCAPE_DATA.timer; if ((u16)timer < 127) { - asm("":::"r2"); - offset = (u16)timer / 16; - offset = sChozodiaEscapeHeatingUpPalOffsets[offset]; + tmp = (u16)timer / 16; + offset = sChozodiaEscapeHeatingUpPalOffsets[tmp]; src1 = &sChozodiaEscapeShipHeatingUpPAL[offset]; src2 = &sChozodiaEscapeGroundHeatingUpPAL[offset]; - dma_set(3, src1, PALRAM_OBJ, DMA_ENABLE << 16 | 16); + dma_set(3, src1, PALRAM_BASE + 0x200, DMA_ENABLE << 16 | 16); dma_set(3, src2, PALRAM_BASE + 0x280, DMA_ENABLE << 16 | 16); } if (CHOZODIA_ESCAPE_DATA.timer > 128) { - offset = CHOZODIA_ESCAPE_DATA.timer & 3; - if (offset == 1) + tmp = CHOZODIA_ESCAPE_DATA.timer & 3; + if (tmp == 1) { CHOZODIA_ESCAPE_DATA.oamYPositions[CHOZODIA_ESCAPE_OAM_MOTHER_SHIP_DOOR]--; CHOZODIA_ESCAPE_DATA.oamYPositions[CHOZODIA_ESCAPE_OAM_SHIP_EXTERIOR]--; } - if (offset == 3) + if (tmp == 3) { CHOZODIA_ESCAPE_DATA.oamYPositions[CHOZODIA_ESCAPE_OAM_MOTHER_SHIP_DOOR]++; CHOZODIA_ESCAPE_DATA.oamYPositions[CHOZODIA_ESCAPE_OAM_SHIP_EXTERIOR]++;