Merge pull request #942 from jiangzhengwenjz/DrawTradeMenuPartyInfo

'real' match DrawTradeMenuPartyInfo
This commit is contained in:
Diegoisawesome 2019-12-20 15:49:14 -08:00 committed by GitHub
commit 773a599bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 71 deletions

View File

@ -276,48 +276,65 @@ static const u8 sTradeMonSpriteCoords[(PARTY_SIZE * 2) + 1][2] =
{23, 18} // CANCEL {23, 18} // CANCEL
}; };
static const u8 sTradeMonLevelCoords[][PARTY_SIZE][2] = static const u8 sTradeMonLevelCoords[][2][2] =
{ {
{
// Your party // Your party
{
{5, 4}, {5, 4},
{12, 4}, {12, 4},
},
{
{5, 9}, {5, 9},
{12, 9}, {12, 9},
},
{
{5, 14}, {5, 14},
{12, 14}, {12, 14},
}, },
{
// Friend's party // Friend's party
{
{20, 4}, {20, 4},
{27, 4}, {27, 4},
},
{
{20, 9}, {20, 9},
{27, 9}, {27, 9},
},
{
{20, 14}, {20, 14},
{27, 14} {27, 14},
} },
}; };
static const u8 sTradeMonBoxCoords[][PARTY_SIZE][2] = static const u8 sTradeMonBoxCoords[][2][2] =
{ {
{
// Your party // Your party
{
{1, 3}, {1, 3},
{8, 3}, {8, 3},
},
{
{1, 8}, {1, 8},
{8, 8}, {8, 8},
},
{
{1, 13}, {1, 13},
{8, 13}, {8, 13},
}, },
{
// Friend's party // Friend's party
{
{16, 3}, {16, 3},
{23, 3}, {23, 3},
},
{
{16, 8}, {16, 8},
{23, 8}, {23, 8},
},
{
{16, 13}, {16, 13},
{23, 13} {23, 13},
} },
}; };
static const u8 sUnref_0832DE6E[] = static const u8 sUnref_0832DE6E[] =

View File

@ -1988,73 +1988,28 @@ static void DrawTradeMenuPartyMonInfo(u8 whichParty, u8 monIdx, u8 x, u8 y, u8 w
sTradeMenuData->tilemapBuffer[(y - 1) * 32 + x + 1] = symbolTile; sTradeMenuData->tilemapBuffer[(y - 1) * 32 + x + 1] = symbolTile;
} }
// Very close but loop preamble not working.
#ifdef NONMATCHING
static void DrawTradeMenuPartyInfo(u8 whichParty) static void DrawTradeMenuPartyInfo(u8 whichParty)
{ {
int i; s32 i;
for (i = 0; i < sTradeMenuData->partyCounts[whichParty]; i++) for (i = 0; i < sTradeMenuData->partyCounts[whichParty]; i++)
{ {
DrawTradeMenuPartyMonInfo(whichParty, i, const u8 (*r5)[2];
sTradeMonLevelCoords[whichParty][i][0], const u8 (*r4)[2];
sTradeMonLevelCoords[whichParty][i][1], u32 r0 = 3 * whichParty;
sTradeMonBoxCoords[whichParty][i][0], const u8 (*r1)[2][2] = sTradeMonLevelCoords;
sTradeMonBoxCoords[whichParty][i][1]);
r5 = r1[r0];
r4 = sTradeMonBoxCoords[r0];
DrawTradeMenuPartyMonInfo(
whichParty,
i,
r5[i][0],
r5[i][1],
r4[i][0],
r4[i][1]
);
} }
} }
#else
NAKED
static void DrawTradeMenuPartyInfo(u8 whichParty)
{
asm_unified("push {r4-r7,lr}\n\
sub sp, 0x8\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
movs r7, 0\n\
ldr r0, =sTradeMenuData\n\
ldr r0, [r0]\n\
adds r0, 0x36\n\
adds r0, r6\n\
ldrb r0, [r0]\n\
cmp r7, r0\n\
bge _08079E94\n\
lsls r0, r6, 1\n\
adds r0, r6\n\
ldr r1, =sTradeMonLevelCoords\n\
lsls r0, 2\n\
adds r5, r0, r1\n\
ldr r1, =sTradeMonBoxCoords\n\
adds r4, r0, r1\n\
_08079E6A:\n\
lsls r1, r7, 24\n\
lsrs r1, 24\n\
ldrb r2, [r5]\n\
ldrb r3, [r5, 0x1]\n\
ldrb r0, [r4]\n\
str r0, [sp]\n\
ldrb r0, [r4, 0x1]\n\
str r0, [sp, 0x4]\n\
adds r0, r6, 0\n\
bl DrawTradeMenuPartyMonInfo\n\
adds r5, 0x2\n\
adds r4, 0x2\n\
adds r7, 0x1\n\
ldr r0, =sTradeMenuData\n\
ldr r0, [r0]\n\
adds r0, 0x36\n\
adds r0, r6\n\
ldrb r0, [r0]\n\
cmp r7, r0\n\
blt _08079E6A\n\
_08079E94:\n\
add sp, 0x8\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif // NONMATCHING
static void ResetTradeMenuPartyPositions(u8 whichParty) static void ResetTradeMenuPartyPositions(u8 whichParty)
{ {