Match BgClipCallMotherBrainUpdateGlass

This commit is contained in:
y.demaisonregne 2023-04-04 23:51:27 +02:00
parent 78b6944153
commit 5b18c56b79
2 changed files with 27 additions and 7 deletions

View File

@ -2,7 +2,7 @@
This is a work in progress decompilation of Metroid - Zero Mission.
2425/2721 functions decompiled (89.12%, 296 left)
2426/2721 functions decompiled (89.16%, 295 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**

View File

@ -639,17 +639,14 @@ void BgClipSetItemAsCollected(u16 xPosition, u16 yPosition, u8 type)
limit = MAX_AMOUNT_OF_ITEMS_PER_AREA;
overLimit = TRUE;
pItem = (u8*)gItemsCollected[i];
i = 0;
for (; ; pItem += 4)
for (i = 0; i < limit; i++, pItem += 4)
{
if (i >= limit)
break;
else if (pItem[0] == 0xFF)
if (pItem[0] == UCHAR_MAX)
{
overLimit = FALSE;
break;
}
i++;
}
if (!overLimit)
@ -708,7 +705,30 @@ void BgClipRemoveCollectedTanks(void)
}
}
/**
* @brief 5b1d8 | 74 | Calls the BgClipMotherBrainUpdateGlass on every block of the glass
*
* @param stage Breaking stage
*/
void BgClipCallMotherBrainUpdateGlass(u8 stage)
{
u16 i;
u16 j;
// Check in the mother brain room
if (gCurrentArea != AREA_TOURIAN)
return;
if (gCurrentRoom != 4)
return;
// Loop on every tile of the glass
for (i = 0; i < 5; i++) // Y
{
for (j = 0; j < 7; j++) // X
{
// Fetch the correct tile value, and the correct positions
BgClipMotherBrainUpdateGlass(0, sMotherBrainGlassBreakingBaseTilemapValues[stage] + i * 16 + j, i + 13, j + 4);
}
}
}