Match unk_7eedc

This commit is contained in:
y.demaisonregne 2023-06-24 22:56:28 +02:00
parent e854a5c602
commit daea411cd4
3 changed files with 30 additions and 26 deletions

View File

@ -2,7 +2,7 @@
This is a work in progress decompilation of Metroid - Zero Mission.
2648/2721 functions decompiled (97.32%, 73 left)
2649/2721 functions decompiled (97.35%, 72 left)
0x350b6c/0x76b014 bytes of data not in blobs (44.69%, 0x41a4a8 left)

View File

@ -5575,10 +5575,13 @@ u32 FileSelectUpdateTilemap(u8 request)
return ended;
}
/**
* @brief 7eedc | a0 | To document
*
* @param pTilemap Tilemap pointer
*/
void unk_7eedc(u16* pTilemap)
{
// https://decomp.me/scratch/M4UO4
s32 i;
s32 j;
u16 baseTile;
@ -5587,17 +5590,18 @@ void unk_7eedc(u16* pTilemap)
completion = gSaveFilesInfo[FILE_SELECT_DATA.fileSelectCursorPosition].completedGame & 0x7;
completion |= ((u16)gSaveFilesInfo[FILE_SELECT_DATA.fileSelectCursorPosition].completedGame >> 3) & 0x7;
pTilemap = &pTilemap[128];
for (i = 0; i < 3; i++)
{
baseTile = (completion >> i) & 1 ? 14 << 12 : 15 << 12;
for (j = 0; j < 16; j++)
for (j = 2; j < 2 + 16; j++)
{
pTilemap[i * 64 + 2 + j] &= 0x3FF;
pTilemap[i * 64 + 2 + j] |= baseTile;
pTilemap[i * 64 + j] &= 0x3FF;
pTilemap[i * 64 + j] |= baseTile;
pTilemap[i * 64 + 34 + j] &= 0x3FF;
pTilemap[i * 64 + 34 + j] |= baseTile;
pTilemap[i * 64 + 32 + j] &= 0x3FF;
pTilemap[i * 64 + 32 + j] |= baseTile;
}
}
}

View File

@ -1995,8 +1995,8 @@ u32 StatusScreenGetDestinationSlot(s32 offset, u32 previousSlot)
s32 newSlot;
u8 prevSlot;
s32 var_0;
s32 var_1;
s32 upperLimit;
s32 lowerLimit;
s32 var_2;
s32 off;
@ -2020,8 +2020,8 @@ u32 StatusScreenGetDestinationSlot(s32 offset, u32 previousSlot)
if (newSlot != 0)
return newSlot;
var_0 = 7;
var_1 = 1;
upperLimit = 7;
lowerLimit = 1;
if (prevSlot >= 12)
{
@ -2040,8 +2040,8 @@ u32 StatusScreenGetDestinationSlot(s32 offset, u32 previousSlot)
if (newSlot != 0)
return newSlot;
var_0 = 17;
var_1 = 8;
upperLimit = 17;
lowerLimit = 8;
if (prevSlot > 5)
{
@ -2064,10 +2064,10 @@ u32 StatusScreenGetDestinationSlot(s32 offset, u32 previousSlot)
newSlot += off;
if (newSlot < var_1)
newSlot = var_0;
else if (newSlot > var_0)
newSlot = var_1;
if (newSlot < lowerLimit)
newSlot = upperLimit;
else if (newSlot > upperLimit)
newSlot = lowerLimit;
if (newSlot == var_2)
{
@ -2081,13 +2081,13 @@ u32 StatusScreenGetDestinationSlot(s32 offset, u32 previousSlot)
{
if (prevSlot > 7)
{
var_0 = 17;
var_1 = 8;
upperLimit = 17;
lowerLimit = 8;
}
else
{
var_0 = 7;
var_1 = 1;
upperLimit = 7;
lowerLimit = 1;
}
if (off != 1)
@ -2099,10 +2099,10 @@ u32 StatusScreenGetDestinationSlot(s32 offset, u32 previousSlot)
{
newSlot += off;
if (newSlot < var_1)
newSlot = var_0;
else if (newSlot > var_0)
newSlot = var_1;
if (newSlot < lowerLimit)
newSlot = upperLimit;
else if (newSlot > upperLimit)
newSlot = lowerLimit;
if (newSlot == var_2)
{