mirror of
https://github.com/pret/pokefirered.git
synced 2026-05-06 05:35:23 -05:00
sub_815A1F8
This commit is contained in:
parent
764b19b470
commit
c609b533d4
|
|
@ -62,13 +62,12 @@ struct MapObjectTemplate
|
|||
/*0x06*/ s16 y;
|
||||
/*0x08*/ u8 elevation;
|
||||
/*0x09*/ u8 movementType;
|
||||
/*0x0A*/ union MapObjectRange range;
|
||||
///*0x0B*/ u8 fillerB[1];
|
||||
/*0x0C*/ u16 unkC;
|
||||
/*0x0E*/ u16 unkE;
|
||||
/*0x0A*/ u16 movementRangeX:4;
|
||||
u16 movementRangeY:4;
|
||||
/*0x0C*/ u16 trainerType;
|
||||
/*0x0E*/ u16 trainerRange_berryTreeId;
|
||||
/*0x10*/ const u8 *script;
|
||||
/*0x14*/ u16 flagId;
|
||||
/*0x16*/ u8 filler_16[2];
|
||||
}; /*size = 0x18*/
|
||||
|
||||
struct WarpEvent
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ static void WaitForMonSelection(void)
|
|||
{
|
||||
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
|
||||
{
|
||||
if (gPartyMenuUseExitCallback == 1)
|
||||
if (gPartyMenuUseExitCallback == TRUE)
|
||||
BtlController_EmitChosenMonReturnValue(1, gSelectedMonPartyId, gBattlePartyCurrentOrder);
|
||||
else
|
||||
BtlController_EmitChosenMonReturnValue(1, 6, NULL);
|
||||
|
|
|
|||
|
|
@ -1313,7 +1313,7 @@ static void WaitForMonSelection(void)
|
|||
{
|
||||
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
|
||||
{
|
||||
if (gPartyMenuUseExitCallback == 1)
|
||||
if (gPartyMenuUseExitCallback == TRUE)
|
||||
BtlController_EmitChosenMonReturnValue(1, gSelectedMonPartyId, gBattlePartyCurrentOrder);
|
||||
else
|
||||
BtlController_EmitChosenMonReturnValue(1, 6, NULL);
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ static void WaitForMonSelection(void)
|
|||
{
|
||||
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
|
||||
{
|
||||
if (gPartyMenuUseExitCallback == 1)
|
||||
if (gPartyMenuUseExitCallback == TRUE)
|
||||
BtlController_EmitChosenMonReturnValue(1, gSelectedMonPartyId, gBattlePartyCurrentOrder);
|
||||
else
|
||||
BtlController_EmitChosenMonReturnValue(1, 6, NULL);
|
||||
|
|
|
|||
|
|
@ -1599,12 +1599,7 @@ static void sub_80D1F64(s16 a1, s16 a2, u8 a3)
|
|||
}
|
||||
}
|
||||
}
|
||||
// PROBLEM #3: We need (a2 << 16) & 0x30000 here.
|
||||
// Is it because the programmer declared a s32 var to
|
||||
// hold the value of a2 and then cast the result to s16?
|
||||
// Currently I have to write it explicitly.
|
||||
// (around line 460 in ASM)
|
||||
if (!a3 || !((a2 << 16) & 0x30000))
|
||||
if (a3 == 0 || a2 % 4 == 0)
|
||||
{
|
||||
for (i = 0; i < 160; ++i)
|
||||
gScanlineEffectRegBuffers[1][i * 2 + a3] = (gScanlineEffectRegBuffers[1][i + 320] << 8) | gScanlineEffectRegBuffers[1][i + 480];
|
||||
|
|
@ -1618,49 +1613,14 @@ static void sub_80D1F64(s16 a1, s16 a2, u8 a3)
|
|||
case 0:
|
||||
if (res > 80)
|
||||
res = 80;
|
||||
// PROBLEM #4:
|
||||
// PROBLEM #3:
|
||||
// (around line 550 in ASM)
|
||||
// Case 0-3 are very similar, so it's very likely
|
||||
// that they have the same problem.
|
||||
// The code is definitely functional equivalent,
|
||||
// but the vanilla game used some extra shifts and
|
||||
// used unsigned comparison. Another difference is
|
||||
// that I can't figure out a way to make gUnknown_83FA444[a2]
|
||||
// happen outside the loop body.
|
||||
// It seems that sTransitionStructPtr->data[2] need
|
||||
// to be used in the first statement so that the
|
||||
// struct pointer sTransitionStructPtr will be loaded
|
||||
// early enough.
|
||||
//
|
||||
// Logically the generated code is following if + do-while structure.
|
||||
// But it seems that it can only make the situation even worse.
|
||||
/*
|
||||
i = res;
|
||||
if (i > 0)
|
||||
{
|
||||
// This happens before loop body.
|
||||
s16 unk = gUnknown_83FA444[a2];
|
||||
|
||||
do
|
||||
{
|
||||
sTransitionStructPtr->data[2] = ((i * unk) >> 8) + 120;
|
||||
if (sTransitionStructPtr->data[2] <= 255)
|
||||
{
|
||||
sTransitionStructPtr->bg123HOfs = 400 - i;
|
||||
sTransitionStructPtr->data[10] = gScanlineEffectRegBuffers[1][400 - i];
|
||||
if (gScanlineEffectRegBuffers[1][560 - i] < sTransitionStructPtr->data[2])
|
||||
gScanlineEffectRegBuffers[1][560 - i] = 120;
|
||||
else if (gScanlineEffectRegBuffers[1][400 - i] < sTransitionStructPtr->data[2])
|
||||
gScanlineEffectRegBuffers[1][400 - i] = sTransitionStructPtr->data[2];
|
||||
}
|
||||
}
|
||||
while (--i > 0);
|
||||
}
|
||||
*/
|
||||
// Case 0 ... 3 are very similar, so it's very likely that they have the same problem.
|
||||
// Weird shifts around writing to sTransitionStructPtr->data[2], and the following comparison.
|
||||
for (i = res; i > 0; --i)
|
||||
{
|
||||
sTransitionStructPtr->data[2] = ((i * gUnknown_83FA444[a2]) >> 8) + 120;
|
||||
if (sTransitionStructPtr->data[2] <= 255)
|
||||
if (sTransitionStructPtr->data[2] <= 255u) // why is this unsigned?
|
||||
{
|
||||
sTransitionStructPtr->bg123HOfs = 400 - i;
|
||||
sTransitionStructPtr->data[10] = gScanlineEffectRegBuffers[1][400 - i];
|
||||
|
|
@ -1674,7 +1634,7 @@ static void sub_80D1F64(s16 a1, s16 a2, u8 a3)
|
|||
case 1:
|
||||
if (res > 80)
|
||||
res = 80;
|
||||
// same as PROBLEM #4
|
||||
// same as PROBLEM #3
|
||||
for (i = res; i > 0; --i)
|
||||
{
|
||||
s16 unkVal;
|
||||
|
|
@ -1692,7 +1652,7 @@ static void sub_80D1F64(s16 a1, s16 a2, u8 a3)
|
|||
case 2:
|
||||
if (res < -79)
|
||||
res = -79;
|
||||
// same as PROBLEM #4
|
||||
// same as PROBLEM #3
|
||||
for (i = res; i <= 0; ++i)
|
||||
{
|
||||
sTransitionStructPtr->data[2] = ((i * gUnknown_83FA444[a2]) >> 8) + 120;
|
||||
|
|
@ -1710,7 +1670,7 @@ static void sub_80D1F64(s16 a1, s16 a2, u8 a3)
|
|||
case 3:
|
||||
if (res < -79)
|
||||
res = -79;
|
||||
// same as PROBLEM #4
|
||||
// same as PROBLEM #3
|
||||
for (i = res; i <= 0; ++i)
|
||||
{
|
||||
sTransitionStructPtr->data[2] = ((i * gUnknown_83FA444[a2]) >> 8) + 120;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ void sub_815A008(struct QuestLog * questLog)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
void sub_815A1F8(const struct QuestLog * questLog, const struct MapObjectTemplate * templates)
|
||||
{
|
||||
u32 i, j;
|
||||
|
|
@ -97,8 +96,8 @@ void sub_815A1F8(const struct QuestLog * questLog, const struct MapObjectTemplat
|
|||
{
|
||||
gMapObjects[i].coords1.x = templates[j].x + 7;
|
||||
gMapObjects[i].coords1.y = templates[j].y + 7;
|
||||
gMapObjects[i].range.as_nybbles.x = templates[j].range.as_nybbles.x;
|
||||
gMapObjects[i].range.as_nybbles.y = templates[j].range.as_nybbles.y;
|
||||
gMapObjects[i].range.as_nybbles.x = templates[j].movementRangeX;
|
||||
gMapObjects[i].range.as_nybbles.y = templates[j].movementRangeY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,430 +131,6 @@ void sub_815A1F8(const struct QuestLog * questLog, const struct MapObjectTemplat
|
|||
|
||||
CpuCopy16(gMapObjects, gSaveBlock1Ptr->mapObjects, sizeof(gMapObjects));
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_815A1F8(const struct QuestLog * questLog, const struct MapObjectTemplate * templates)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
"\tmov r6, r9\n"
|
||||
"\tmov r5, r8\n"
|
||||
"\tpush {r5-r7}\n"
|
||||
"\tsub sp, 0x10\n"
|
||||
"\tstr r1, [sp, 0x4]\n"
|
||||
"\tadds r0, 0x8\n"
|
||||
"\tstr r0, [sp, 0x8]\n"
|
||||
"\tmov r1, sp\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tstrh r0, [r1]\n"
|
||||
"\tldr r4, _0815A480 @ =gMapObjects\n"
|
||||
"\tldr r2, _0815A484 @ =0x01000120\n"
|
||||
"\tmov r0, sp\n"
|
||||
"\tadds r1, r4, 0\n"
|
||||
"\tbl CpuSet\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmov r12, r0\n"
|
||||
"\tmovs r1, 0x1\n"
|
||||
"\tmov r10, r1\n"
|
||||
"_0815A224:\n"
|
||||
"\tmov r2, r12\n"
|
||||
"\tlsls r7, r2, 3\n"
|
||||
"\tadds r5, r7, r2\n"
|
||||
"\tlsls r5, 2\n"
|
||||
"\tldr r0, _0815A480 @ =gMapObjects\n"
|
||||
"\tadds r5, r0\n"
|
||||
"\tlsls r6, r2, 2\n"
|
||||
"\tadd r6, r12\n"
|
||||
"\tlsls r6, 2\n"
|
||||
"\tldr r1, [sp, 0x8]\n"
|
||||
"\tadds r6, r1\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tlsls r0, 31\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tldrb r2, [r5]\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tnegs r1, r1\n"
|
||||
"\tands r1, r2\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r5]\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tlsls r0, 30\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tlsls r0, 3\n"
|
||||
"\tmovs r2, 0x9\n"
|
||||
"\tnegs r2, r2\n"
|
||||
"\tands r2, r1\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tstrb r2, [r5]\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tlsls r0, 29\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r1, r10\n"
|
||||
"\tands r0, r1\n"
|
||||
"\tlsls r0, 4\n"
|
||||
"\tmovs r1, 0x11\n"
|
||||
"\tnegs r1, r1\n"
|
||||
"\tands r1, r2\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r5]\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tlsls r0, 28\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tlsls r0, 5\n"
|
||||
"\tmovs r4, 0x21\n"
|
||||
"\tnegs r4, r4\n"
|
||||
"\tands r1, r4\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r5]\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tlsls r0, 27\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tldrb r1, [r5, 0x1]\n"
|
||||
"\tmovs r2, 0x2\n"
|
||||
"\tnegs r2, r2\n"
|
||||
"\tands r2, r1\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tstrb r2, [r5, 0x1]\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tlsls r0, 26\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r1, r10\n"
|
||||
"\tands r0, r1\n"
|
||||
"\tlsls r0, 1\n"
|
||||
"\tmovs r1, 0x3\n"
|
||||
"\tnegs r1, r1\n"
|
||||
"\tmov r8, r1\n"
|
||||
"\tmov r3, r8\n"
|
||||
"\tands r3, r2\n"
|
||||
"\torrs r3, r0\n"
|
||||
"\tstrb r3, [r5, 0x1]\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tlsls r0, 25\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tlsls r0, 2\n"
|
||||
"\tsubs r1, 0x2\n"
|
||||
"\tmov r9, r1\n"
|
||||
"\tands r1, r3\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r5, 0x1]\n"
|
||||
"\tldrb r0, [r6]\n"
|
||||
"\tlsrs r0, 7\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tlsls r0, 3\n"
|
||||
"\tmovs r2, 0x9\n"
|
||||
"\tnegs r2, r2\n"
|
||||
"\tands r2, r1\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tstrb r2, [r5, 0x1]\n"
|
||||
"\tldrb r0, [r6, 0x1]\n"
|
||||
"\tlsls r0, 31\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r1, r10\n"
|
||||
"\tands r0, r1\n"
|
||||
"\tlsls r0, 4\n"
|
||||
"\tmovs r1, 0x11\n"
|
||||
"\tnegs r1, r1\n"
|
||||
"\tands r1, r2\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r5, 0x1]\n"
|
||||
"\tldrb r0, [r6, 0x1]\n"
|
||||
"\tlsls r0, 30\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tlsls r0, 5\n"
|
||||
"\tands r4, r1\n"
|
||||
"\torrs r4, r0\n"
|
||||
"\tstrb r4, [r5, 0x1]\n"
|
||||
"\tldrb r0, [r6, 0x1]\n"
|
||||
"\tlsls r0, 29\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tlsls r0, 6\n"
|
||||
"\tmovs r2, 0x41\n"
|
||||
"\tnegs r2, r2\n"
|
||||
"\tadds r1, r2, 0\n"
|
||||
"\tands r4, r1\n"
|
||||
"\torrs r4, r0\n"
|
||||
"\tstrb r4, [r5, 0x1]\n"
|
||||
"\tldrb r0, [r6, 0x1]\n"
|
||||
"\tlsls r0, 28\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tlsls r0, 7\n"
|
||||
"\tmovs r3, 0x7F\n"
|
||||
"\tands r4, r3\n"
|
||||
"\torrs r4, r0\n"
|
||||
"\tstrb r4, [r5, 0x1]\n"
|
||||
"\tldrb r0, [r6, 0x1]\n"
|
||||
"\tlsls r0, 27\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r1, r10\n"
|
||||
"\tands r0, r1\n"
|
||||
"\tldrb r2, [r5, 0x2]\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tnegs r1, r1\n"
|
||||
"\tands r1, r2\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r5, 0x2]\n"
|
||||
"\tldrb r0, [r6, 0x1]\n"
|
||||
"\tlsls r0, 26\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tlsls r0, 7\n"
|
||||
"\tands r1, r3\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r5, 0x2]\n"
|
||||
"\tldrb r0, [r6, 0x1]\n"
|
||||
"\tlsls r0, 25\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tldrb r2, [r5, 0x3]\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tnegs r1, r1\n"
|
||||
"\tands r1, r2\n"
|
||||
"\torrs r1, r0\n"
|
||||
"\tstrb r1, [r5, 0x3]\n"
|
||||
"\tldrb r0, [r6, 0x1]\n"
|
||||
"\tlsrs r0, 7\n"
|
||||
"\tmov r2, r10\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tlsls r0, 1\n"
|
||||
"\tmov r2, r8\n"
|
||||
"\tands r2, r1\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tmov r8, r2\n"
|
||||
"\tstrb r2, [r5, 0x3]\n"
|
||||
"\tldrb r0, [r6, 0x2]\n"
|
||||
"\tlsls r0, 31\n"
|
||||
"\tlsrs r0, 31\n"
|
||||
"\tmov r1, r10\n"
|
||||
"\tands r0, r1\n"
|
||||
"\tlsls r0, 2\n"
|
||||
"\tmov r1, r9\n"
|
||||
"\tands r2, r1\n"
|
||||
"\torrs r2, r0\n"
|
||||
"\tstrb r2, [r5, 0x3]\n"
|
||||
"\tldrb r1, [r6, 0x2]\n"
|
||||
"\tlsls r1, 27\n"
|
||||
"\tlsrs r1, 28\n"
|
||||
"\tldrb r2, [r5, 0x18]\n"
|
||||
"\tmovs r4, 0x10\n"
|
||||
"\tnegs r4, r4\n"
|
||||
"\tadds r0, r4, 0\n"
|
||||
"\tands r0, r2\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstrb r0, [r5, 0x18]\n"
|
||||
"\tldrb r1, [r6, 0x3]\n"
|
||||
"\tlsls r1, 28\n"
|
||||
"\tmovs r3, 0xF\n"
|
||||
"\tlsrs r1, 28\n"
|
||||
"\tldrb r2, [r5, 0xB]\n"
|
||||
"\tadds r0, r4, 0\n"
|
||||
"\tands r0, r2\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstrb r0, [r5, 0xB]\n"
|
||||
"\tldrb r1, [r6, 0x3]\n"
|
||||
"\tlsrs r1, 4\n"
|
||||
"\tlsls r1, 4\n"
|
||||
"\tands r0, r3\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstrb r0, [r5, 0xB]\n"
|
||||
"\tldrb r0, [r6, 0x4]\n"
|
||||
"\tstrb r0, [r5, 0x5]\n"
|
||||
"\tldrb r0, [r6, 0x5]\n"
|
||||
"\tstrb r0, [r5, 0x6]\n"
|
||||
"\tldrb r0, [r6, 0x6]\n"
|
||||
"\tstrb r0, [r5, 0x7]\n"
|
||||
"\tldrb r0, [r6, 0x7]\n"
|
||||
"\tstrb r0, [r5, 0x8]\n"
|
||||
"\tldrb r0, [r6, 0x8]\n"
|
||||
"\tstrb r0, [r5, 0x9]\n"
|
||||
"\tldrb r0, [r6, 0x9]\n"
|
||||
"\tstrb r0, [r5, 0xA]\n"
|
||||
"\tldrh r0, [r6, 0xA]\n"
|
||||
"\tstrh r0, [r5, 0x10]\n"
|
||||
"\tldrh r0, [r6, 0xC]\n"
|
||||
"\tstrh r0, [r5, 0x12]\n"
|
||||
"\tldrb r0, [r6, 0xE]\n"
|
||||
"\tstrb r0, [r5, 0x1D]\n"
|
||||
"\tldrb r0, [r6, 0xF]\n"
|
||||
"\tstrb r0, [r5, 0x1F]\n"
|
||||
"\tldrb r0, [r6, 0x10]\n"
|
||||
"\tadds r1, r5, 0\n"
|
||||
"\tadds r1, 0x21\n"
|
||||
"\tstrb r0, [r1]\n"
|
||||
"\tldrb r0, [r6, 0x11]\n"
|
||||
"\tadds r1, 0x1\n"
|
||||
"\tstrb r0, [r1]\n"
|
||||
"\tmovs r6, 0\n"
|
||||
"\tmov r8, r7\n"
|
||||
"\tmov r2, r12\n"
|
||||
"\tadds r2, 0x1\n"
|
||||
"\tstr r2, [sp, 0xC]\n"
|
||||
"\tldrb r7, [r5, 0x8]\n"
|
||||
"\tldr r3, [sp, 0x4]\n"
|
||||
"\tmovs r0, 0xF\n"
|
||||
"\tmov r9, r0\n"
|
||||
"_0815A412:\n"
|
||||
"\tldrb r1, [r3]\n"
|
||||
"\tcmp r7, r1\n"
|
||||
"\tbne _0815A444\n"
|
||||
"\tldrh r0, [r3, 0x4]\n"
|
||||
"\tadds r0, 0x7\n"
|
||||
"\tstrh r0, [r5, 0xC]\n"
|
||||
"\tldrh r0, [r3, 0x6]\n"
|
||||
"\tadds r0, 0x7\n"
|
||||
"\tstrh r0, [r5, 0xE]\n"
|
||||
"\tldrb r1, [r3, 0xA]\n"
|
||||
"\tlsls r1, 28\n"
|
||||
"\tlsrs r1, 28\n"
|
||||
"\tmov r2, r9\n"
|
||||
"\tands r1, r2\n"
|
||||
"\tldrb r0, [r5, 0x19]\n"
|
||||
"\tands r0, r4\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstrb r0, [r5, 0x19]\n"
|
||||
"\tldrb r1, [r3, 0xA]\n"
|
||||
"\tlsrs r1, 4\n"
|
||||
"\tlsls r1, 4\n"
|
||||
"\tmovs r2, 0xF\n"
|
||||
"\tands r0, r2\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstrb r0, [r5, 0x19]\n"
|
||||
"_0815A444:\n"
|
||||
"\tadds r3, 0x18\n"
|
||||
"\tadds r6, 0x1\n"
|
||||
"\tcmp r6, 0x3F\n"
|
||||
"\tbls _0815A412\n"
|
||||
"\tmov r0, r8\n"
|
||||
"\tadd r0, r12\n"
|
||||
"\tlsls r0, 2\n"
|
||||
"\tldr r1, _0815A480 @ =gMapObjects\n"
|
||||
"\tadds r6, r0, r1\n"
|
||||
"\tmovs r2, 0x10\n"
|
||||
"\tldrsh r0, [r6, r2]\n"
|
||||
"\tmovs r2, 0x12\n"
|
||||
"\tldrsh r1, [r6, r2]\n"
|
||||
"\tbl MapGridGetMetatileBehaviorAt\n"
|
||||
"\tstrb r0, [r6, 0x1E]\n"
|
||||
"\tldrb r4, [r6, 0x1F]\n"
|
||||
"\tmovs r1, 0x10\n"
|
||||
"\tldrsh r0, [r6, r1]\n"
|
||||
"\tmovs r2, 0x12\n"
|
||||
"\tldrsh r1, [r6, r2]\n"
|
||||
"\tbl MapGridGetMetatileBehaviorAt\n"
|
||||
"\tcmp r4, r0\n"
|
||||
"\tbne _0815A488\n"
|
||||
"\tldrh r0, [r6, 0x10]\n"
|
||||
"\tstrh r0, [r6, 0x14]\n"
|
||||
"\tldrh r0, [r6, 0x12]\n"
|
||||
"\tb _0815A506\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0815A480: .4byte gMapObjects\n"
|
||||
"_0815A484: .4byte 0x01000120\n"
|
||||
"_0815A488:\n"
|
||||
"\tldrb r4, [r6, 0x1F]\n"
|
||||
"\tldrh r0, [r6, 0x10]\n"
|
||||
"\tsubs r0, 0x1\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tmovs r2, 0x12\n"
|
||||
"\tldrsh r1, [r6, r2]\n"
|
||||
"\tbl MapGridGetMetatileBehaviorAt\n"
|
||||
"\tcmp r4, r0\n"
|
||||
"\tbne _0815A4A8\n"
|
||||
"\tldrh r0, [r6, 0x10]\n"
|
||||
"\tsubs r0, 0x1\n"
|
||||
"\tstrh r0, [r6, 0x14]\n"
|
||||
"\tldrh r0, [r6, 0x12]\n"
|
||||
"\tb _0815A506\n"
|
||||
"_0815A4A8:\n"
|
||||
"\tldrb r4, [r6, 0x1F]\n"
|
||||
"\tldrh r0, [r6, 0x10]\n"
|
||||
"\tadds r0, 0x1\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tasrs r0, 16\n"
|
||||
"\tmovs r2, 0x12\n"
|
||||
"\tldrsh r1, [r6, r2]\n"
|
||||
"\tbl MapGridGetMetatileBehaviorAt\n"
|
||||
"\tcmp r4, r0\n"
|
||||
"\tbne _0815A4C8\n"
|
||||
"\tldrh r0, [r6, 0x10]\n"
|
||||
"\tadds r0, 0x1\n"
|
||||
"\tstrh r0, [r6, 0x14]\n"
|
||||
"\tldrh r0, [r6, 0x12]\n"
|
||||
"\tb _0815A506\n"
|
||||
"_0815A4C8:\n"
|
||||
"\tldrb r4, [r6, 0x1F]\n"
|
||||
"\tmovs r1, 0x10\n"
|
||||
"\tldrsh r0, [r6, r1]\n"
|
||||
"\tldrh r1, [r6, 0x12]\n"
|
||||
"\tsubs r1, 0x1\n"
|
||||
"\tlsls r1, 16\n"
|
||||
"\tasrs r1, 16\n"
|
||||
"\tbl MapGridGetMetatileBehaviorAt\n"
|
||||
"\tcmp r4, r0\n"
|
||||
"\tbne _0815A4E8\n"
|
||||
"\tldrh r0, [r6, 0x10]\n"
|
||||
"\tstrh r0, [r6, 0x14]\n"
|
||||
"\tldrh r0, [r6, 0x12]\n"
|
||||
"\tsubs r0, 0x1\n"
|
||||
"\tb _0815A506\n"
|
||||
"_0815A4E8:\n"
|
||||
"\tldrb r4, [r6, 0x1F]\n"
|
||||
"\tmovs r2, 0x10\n"
|
||||
"\tldrsh r0, [r6, r2]\n"
|
||||
"\tldrh r1, [r6, 0x12]\n"
|
||||
"\tadds r1, 0x1\n"
|
||||
"\tlsls r1, 16\n"
|
||||
"\tasrs r1, 16\n"
|
||||
"\tbl MapGridGetMetatileBehaviorAt\n"
|
||||
"\tcmp r4, r0\n"
|
||||
"\tbne _0815A508\n"
|
||||
"\tldrh r0, [r6, 0x10]\n"
|
||||
"\tstrh r0, [r6, 0x14]\n"
|
||||
"\tldrh r0, [r6, 0x12]\n"
|
||||
"\tadds r0, 0x1\n"
|
||||
"_0815A506:\n"
|
||||
"\tstrh r0, [r6, 0x16]\n"
|
||||
"_0815A508:\n"
|
||||
"\tldr r0, [sp, 0xC]\n"
|
||||
"\tmov r12, r0\n"
|
||||
"\tcmp r0, 0xF\n"
|
||||
"\tbhi _0815A512\n"
|
||||
"\tb _0815A224\n"
|
||||
"_0815A512:\n"
|
||||
"\tldr r0, _0815A538 @ =gMapObjects\n"
|
||||
"\tldr r1, _0815A53C @ =gSaveBlock1Ptr\n"
|
||||
"\tldr r1, [r1]\n"
|
||||
"\tmovs r2, 0xD4\n"
|
||||
"\tlsls r2, 3\n"
|
||||
"\tadds r1, r2\n"
|
||||
"\tmovs r2, 0x90\n"
|
||||
"\tlsls r2, 1\n"
|
||||
"\tbl CpuSet\n"
|
||||
"\tadd sp, 0x10\n"
|
||||
"\tpop {r3-r5}\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tmov r9, r4\n"
|
||||
"\tmov r10, r5\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r0}\n"
|
||||
"\tbx r0\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0815A538: .4byte gMapObjects\n"
|
||||
"_0815A53C: .4byte gSaveBlock1Ptr");
|
||||
}
|
||||
#endif // NONMATCHING
|
||||
|
||||
void sub_815A540(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -621,7 +621,7 @@ void sub_810C444(void)
|
|||
|
||||
for (i = 0; i < gMapHeader.events->mapObjectCount; i++)
|
||||
{
|
||||
if ((templates[i].unkC == 1 || templates[i].unkC == 3) && (templates[i].movementType == 0x4D || templates[i].movementType == 0x4E || templates[i].movementType == 0x4F))
|
||||
if ((templates[i].trainerType == 1 || templates[i].trainerType == 3) && (templates[i].movementType == 0x4D || templates[i].movementType == 0x4E || templates[i].movementType == 0x4F))
|
||||
{
|
||||
r6 = sub_810CF54();
|
||||
TryGetFieldObjectIdByLocalIdAndMap(templates[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &sp0);
|
||||
|
|
@ -864,7 +864,7 @@ static void GatherNearbyTrainerInfo(void)
|
|||
|
||||
for (mapObjectIdx = 0; mapObjectIdx < gMapHeader.events->mapObjectCount; mapObjectIdx++)
|
||||
{
|
||||
if (templates[mapObjectIdx].unkC == 1 || templates[mapObjectIdx].unkC == 3)
|
||||
if (templates[mapObjectIdx].trainerType == 1 || templates[mapObjectIdx].trainerType == 3)
|
||||
{
|
||||
sVsSeeker->trainerInfo[vsSeekerObjectIdx].script = templates[mapObjectIdx].script;
|
||||
sVsSeeker->trainerInfo[vsSeekerObjectIdx].trainerIdx = GetTrainerFlagFromScript(templates[mapObjectIdx].script);
|
||||
|
|
@ -1232,7 +1232,7 @@ void sub_810CB90(void)
|
|||
|
||||
for (r8 = 0; r8 < gMapHeader.events->mapObjectCount; r8++)
|
||||
{
|
||||
if ((r4[r8].unkC == 1 || r4[r8].unkC == 3) && r9 == sub_810CE10(sVsSeekerData, GetTrainerFlagFromScript(r4[r8].script)))
|
||||
if ((r4[r8].trainerType == 1 || r4[r8].trainerType == 3) && r9 == sub_810CE10(sVsSeekerData, GetTrainerFlagFromScript(r4[r8].script)))
|
||||
{
|
||||
struct MapObject *r4_2;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user