Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

True match sub_08080278 #669

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 32 additions & 53 deletions src/scroll.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,64 +419,43 @@ void sub_080801BC(RoomControls* controls) {
}

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;
u16* ptr1 = (u16*)gUnk_02022830;
u16* mapBottomData = gMapBottom.mapData;
u16* mapTopData = gMapTop.mapData;
u16* mapBottomDataClone = gMapBottom.mapDataClone;
u16* mapTopDataClone = gMapTop.mapDataClone;
u32 width = gRoomControls.width >> 4;
u32 height = (gRoomControls.height >> 4) << 6;

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;
}
u32 result;
u32 y, x;

for (result = 0, y = 0; y < height; y += 0x40) {
for (x = 0; x < width; x++) {
u32 tilePos = y + x;
if (mapBottomDataClone[tilePos] != mapBottomData[tilePos]) {
if (mapBottomData[tilePos] < 0x4000) {
ptr1[0] = tilePos | 0x4000;
ptr1[1] = mapBottomData[tilePos];
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;
}
}
}
if (mapTopDataClone[tilePos] != mapTopData[tilePos]) {
if (mapTopData[tilePos] < 0x4000) {
ptr1[0] = tilePos | 0x8000;
ptr1[1] = mapTopData[tilePos];
ptr1 += 2;
result++;
if (result >= 0x800) {
return result;
}
topMapDataPtr++;
topMapDataClonePtr++;
bottomMapDataPtr++;
bottomMapDataClonePtr++;
indexX++;
}
}
iVar10 += 0x80;
indexY += 0x40;
} while (indexY < height);
}
}
return result;
}
Expand Down
Loading