From 3423a2f2c0dbb2054c0ecdfff0ca0ba4753799fa Mon Sep 17 00:00:00 2001 From: "y.demaisonregne" Date: Wed, 5 Apr 2023 23:55:53 +0200 Subject: [PATCH] Match MinimapUpdateForCollectedItem --- README.md | 2 +- src/minimap.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6a170d90..ad7d2634 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is a work in progress decompilation of Metroid - Zero Mission. -2450/2721 functions decompiled (90.04%, 271 left) +2451/2721 functions decompiled (90.08%, 270 left) Progress can be seen here : https://docs.google.com/spreadsheets/d/1X8XarD5evY8ZI7r_GQqh1pYmdVMbBcINYfRBUlogmKY/edit#gid=0 **This decomp is not shiftable, don't use it as a base to work on anything** diff --git a/src/minimap.c b/src/minimap.c index 71560741..cb89a936 100644 --- a/src/minimap.c +++ b/src/minimap.c @@ -468,10 +468,14 @@ void MinimapSetDownloadedTiles(u8 area, u16* dst) } +/** + * @brief 6cbd8 | 90 | Updates the minimap for a collected item + * + * @param xPosition X position + * @param yPosition Y position + */ void MinimapUpdateForCollectedItem(u8 xPosition, u8 yPosition) { - // https://decomp.me/scratch/pFd7R - u32 itemX; u32 itemY; u32 offset; @@ -481,18 +485,18 @@ void MinimapUpdateForCollectedItem(u8 xPosition, u8 yPosition) if (gCurrentArea < MAX_AMOUNT_OF_AREAS) { - itemX = (xPosition - 0x2) / 0xF + gCurrentRoomEntry.mapX; - itemY = (yPosition - 0x2) / 0xA + gCurrentRoomEntry.mapY; + itemX = (xPosition - 2) / 15 + gCurrentRoomEntry.mapX; + itemY = (yPosition - 2) / 10 + gCurrentRoomEntry.mapY; offset = gCurrentArea * MINIMAP_SIZE; - ptr = gMinimapTilesWithObtainedItems + offset; + ptr = (u32*)(0x2033800) + offset; // gMinimapTilesWithObtainedItems ptr[itemY] |= sExploredMinimapBitFlags[itemX]; itemX += itemY * MINIMAP_SIZE; - ptrU = gDecompressedMinimapVisitedTiles + itemX; - (*ptrU)++; - ptrU = gDecompressedMinimapData; + ptrU = (u16*)0x2034000; // gDecompressedMinimapVisitedTiles + ptrU[itemX]++; + ptrU = (u16*)0x2034800; // gDecompressedMinimapData ptrU[itemX]++; gUpdateMinimapFlag = MINIMAP_UPDATE_FLAG_LOWER_LINE;