From 701077e85a85e4ca63bad3aa7306848e1888fa8d Mon Sep 17 00:00:00 2001 From: YohannDR Date: Mon, 22 Jul 2024 22:46:02 +0200 Subject: [PATCH] Improve MinimapCheckSetAreaNameAsExplored --- src/minimap.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/minimap.c b/src/minimap.c index a8aaf4b0..7245a8f4 100644 --- a/src/minimap.c +++ b/src/minimap.c @@ -129,28 +129,35 @@ void MinimapCheckSetAreaNameAsExplored(u8 afterTransition) return; } - xPosition--; - gLastAreaNameVisited.mapX = xPosition; - yPosition--; - gLastAreaNameVisited.mapY = yPosition; + do { + gLastAreaNameVisited.mapX = --xPosition; + }while(0); + gLastAreaNameVisited.mapY = --yPosition; - pMap = &gDecompressedMinimapData[actualX + actualY * MINIMAP_SIZE]; + //pMap = &gDecompressedMinimapData[actualX + actualY * MINIMAP_SIZE]; + pMap = &((u16*)(0x02034800))[actualX + actualY * MINIMAP_SIZE]; offset = area * MINIMAP_SIZE + actualY; for (j = 0, i = 0; i < MINIMAP_SIZE; i++, pMap++) { - tile = (*pMap & 0x3FF) - 0x141; + set = *pMap & 0x3FF; + tile = set - 0x141; if (tile <= 0x1D) { sVisitedMinimapTilesPointer[offset] |= sExploredMinimapBitFlags[actualX + j]; j++; } + else + { + break; + } } if (afterTransition) { - sVisitedMinimapTilesPointer[area * MINIMAP_SIZE + gLastAreaNameVisited.mapY] |= sExploredMinimapBitFlags[gLastAreaNameVisited.mapX]; + offset = area * MINIMAP_SIZE + gLastAreaNameVisited.mapY; + sVisitedMinimapTilesPointer[offset] |= sExploredMinimapBitFlags[gLastAreaNameVisited.mapX]; gLastAreaNameVisited.flags = 0; } }