Match sub_08080278 (by Catobat)

This commit is contained in:
Tal Hayon
2023-01-07 08:24:24 +02:00
parent 81534899cd
commit 0d2b6b8bc9
2 changed files with 63 additions and 122 deletions
+63 -2
View File
@@ -28,7 +28,7 @@ extern void sub_0805E248();
extern u8 gUpdateVisibleTiles;
extern u16 gUnk_0200B640;
extern u32** gUnk_08109194[];
extern u8 gUnk_02022830[];
extern u32 gUnk_02022830[];
extern u16 gUnk_020246B0[];
extern u8 gUnk_080B7910[];
@@ -418,7 +418,68 @@ void sub_080801BC(RoomControls* controls) {
}
}
ASM_FUNC("asm/non_matching/scroll/sub_08080278.inc", u32 sub_08080278())
u32 sub_08080278(void) {
u32 width;
u32 height;
u32 tilePos;
u16* bottomMapDataPtr;
u16* topMapDataPtr;
u32 result;
u16* bottomMapDataClonePtr;
u16* topMapDataClonePtr;
u32 indexX;
FORCE_REGISTER(u32 indexY, r10);
int iVar10;
u16* ptr1;
u32 tmp;
ptr1 = (u16*)gUnk_02022830;
width = gRoomControls.width >> 4;
height = (gRoomControls.height >> 4) << 6;
result = 0;
indexY = 0;
if (result < height) {
iVar10 = 0;
do {
indexX = 0;
if (indexX < width) {
topMapDataPtr = (u16*)((int)gMapTop.mapData + iVar10);
topMapDataClonePtr = (u16*)((int)gMapTop.mapDataClone + iVar10);
bottomMapDataPtr = (u16*)((int)gMapBottom.mapData + iVar10);
bottomMapDataClonePtr = (u16*)((int)gMapBottom.mapDataClone + iVar10);
while (indexX < width) {
tilePos = indexY + indexX;
if ((bottomMapDataClonePtr[0] != bottomMapDataPtr[0]) && (bottomMapDataPtr[0] < 0x4000)) {
ptr1[0] = tilePos | 0x4000;
ptr1[1] = bottomMapDataPtr[0];
ptr1 += 2;
result++;
if (result >= 0x600) {
return result;
}
}
if ((topMapDataClonePtr[0] != topMapDataPtr[0]) && (topMapDataPtr[0] < 0x4000)) {
ptr1[0] = tilePos | 0x8000;
ptr1[1] = topMapDataPtr[0];
ptr1 += 2;
result++;
if (result >= 0x800) {
return result;
}
}
topMapDataPtr++;
topMapDataClonePtr++;
bottomMapDataPtr++;
bottomMapDataClonePtr++;
indexX++;
}
}
iVar10 += 0x80;
indexY += 0x40;
} while (indexY < height);
}
return result;
}
void sub_08080368(void) {
u32 tmp;