Merge branch 'master' into battle_engine_v2

This commit is contained in:
DizzyEggg 2019-07-07 09:49:21 +02:00
commit ed28b46cc5
7 changed files with 107 additions and 644 deletions

View file

@ -600,129 +600,18 @@ void sub_8118FBC(int bgId, u8 arg1, u8 arg2, u8 battlerPosition, u8 arg4, u8 *ar
LoadBgTilemap(bgId, arg6, BG_SCREEN_SIZE, 0);
}
#ifdef NONMATCHING
void unref_sub_8119094(u8 arg0, u8 arg1, u8 battlerPosition, u8 arg3, u8 arg4, u16 arg5, u8 arg6, u8 arg7)
{
int i, j;
int offset;
int i, j, offset;
DmaCopy16(3, gMonSpritesGfxPtr->sprites[battlerPosition] + BG_SCREEN_SIZE * arg3, (void *)BG_SCREEN_ADDR(0) + arg5, BG_SCREEN_SIZE);
offset = (arg5 >> 5) - (arg7 << 9);
for (i = arg1; i < arg1 + 8; i++)
{
for (j = arg0; j < arg0 + 8; j++)
{
((u16 *)BG_VRAM)[i * 32 + j + (arg6 * 0x400) + arg0] = offset | (arg4 << 12);
*((u16 *)(BG_VRAM) + (i * 32) + (j + (arg6 << 10))) = offset | (arg4 << 12);
offset++;
}
}
}
#else
NAKED
void unref_sub_8119094(u8 arg0, u8 arg1, u8 battlerPosition, u8 arg3, u8 arg4, u16 arg5, u8 arg6, u8 arg7)
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x4\n\
ldr r4, [sp, 0x24]\n\
ldr r5, [sp, 0x28]\n\
mov r8, r5\n\
ldr r5, [sp, 0x2C]\n\
ldr r6, [sp, 0x30]\n\
mov r9, r6\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r12, r0\n\
lsls r1, 24\n\
lsls r2, 24\n\
lsls r3, 24\n\
lsls r4, 24\n\
lsrs r4, 24\n\
mov r10, r4\n\
mov r7, r8\n\
lsls r7, 16\n\
lsrs r6, r7, 16\n\
lsls r5, 24\n\
lsrs r5, 24\n\
mov r0, r9\n\
lsls r0, 24\n\
mov r9, r0\n\
ldr r4, =0x040000d4\n\
ldr r0, =gMonSpritesGfxPtr\n\
ldr r0, [r0]\n\
lsrs r2, 22\n\
adds r0, 0x4\n\
adds r0, r2\n\
lsrs r3, 13\n\
ldr r0, [r0]\n\
adds r0, r3\n\
str r0, [r4]\n\
movs r0, 0xC0\n\
lsls r0, 19\n\
adds r6, r0\n\
str r6, [r4, 0x4]\n\
ldr r0, =0x80000400\n\
str r0, [r4, 0x8]\n\
ldr r0, [r4, 0x8]\n\
adds r2, r7, 0\n\
lsrs r2, 21\n\
mov r6, r9\n\
lsrs r6, 15\n\
subs r4, r2, r6\n\
lsrs r0, r1, 24\n\
adds r1, r0, 0\n\
adds r1, 0x8\n\
cmp r0, r1\n\
bge _08119148\n\
mov r9, r1\n\
mov r7, r12\n\
lsls r7, 1\n\
mov r8, r7\n\
lsls r5, 11\n\
str r5, [sp]\n\
_08119110:\n\
mov r2, r12\n\
adds r3, r2, 0\n\
adds r3, 0x8\n\
adds r5, r0, 0x1\n\
cmp r2, r3\n\
bge _08119142\n\
mov r1, r10\n\
lsls r6, r1, 12\n\
lsls r0, 6\n\
movs r7, 0xC0\n\
lsls r7, 19\n\
adds r0, r7\n\
ldr r1, [sp]\n\
adds r0, r1, r0\n\
mov r7, r8\n\
adds r1, r7, r0\n\
subs r2, r3, r2\n\
_08119132:\n\
adds r0, r4, 0\n\
orrs r0, r6\n\
strh r0, [r1]\n\
adds r4, 0x1\n\
adds r1, 0x2\n\
subs r2, 0x1\n\
cmp r2, 0\n\
bne _08119132\n\
_08119142:\n\
adds r0, r5, 0\n\
cmp r0, r9\n\
blt _08119110\n\
_08119148:\n\
add sp, 0x4\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif

View file

@ -250,8 +250,7 @@ static void HoldContestPainting(void)
case 1:
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
{
u8 two = 2; //needed to make the asm match
gContestPaintingState = two;
gContestPaintingState++;
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
}

View file

@ -1422,109 +1422,109 @@ void sub_8026324(void)
u8 sp8 = gUnknown_02022C98->unk_0024;
u8 r6;
u8 r10;
u8 r2;
s32 r2;
u8 r5;
u8 r3;
s32 r2_2;
u8 r4;
u8 r7, r7_2;
if (gUnknown_02022C98->unk_0040 < 10)
if (gUnknown_02022C98->unk_0040 >= 10)
return;
for (r6 = 0; r6 < sp8; r6++)
{
for (r6 = 0; r6 < sp8; r6++)
if (gUnknown_02022C98->unk_31A0[r6].unk_2C != 0 && gUnknown_02022C98->unk_00A8[r6] == 1)
{
if ( gUnknown_02022C98->unk_31A0[r6].unk_2C != 0
&& gUnknown_02022C98->unk_00A8[r6] == 1)
for (r10 = sp0; r10 < sp4; r10++)
{
for (r10 = sp0; r10 < sp4; r10++)
r5 = gUnknown_082F449C[r10];
if (gUnknown_02022C98->unk_00F4[r5][0] == r6)
{
r5 = gUnknown_082F449C[r10];
if (gUnknown_02022C98->unk_00F4[r5][0] == r6)
break;
}
if (gUnknown_02022C98->unk_00F4[r5][1] == r6)
{
break;
}
if (sub_8026634(gUnknown_02022C98->unk_31A0[r6].unk_2C, r6, gUnknown_082F449C[r10]) == 1)
{
for (r2 = 0; r2 < 2; r2++)
{
break;
}
if (gUnknown_02022C98->unk_00F4[r5][1] == r6)
{
break;
}
if (sub_8026634(gUnknown_02022C98->unk_31A0[r6].unk_2C, r6, gUnknown_082F449C[r10]) == 1)
{
for (r2 = 0; r2 < 2; r2++)
if (gUnknown_02022C98->unk_00F4[r5][r2] == 0xFF)
{
if (gUnknown_02022C98->unk_00F4[r5][r2] == 0xFF)
{
gUnknown_02022C98->unk_00F4[r5][r2] = r6;
gUnknown_02022C98->unk_00A8[r6] = 2;
gUnknown_02022C98->unk_00C4[r5] = 1;
break;
}
gUnknown_02022C98->unk_00F4[r5][r2] = r6;
gUnknown_02022C98->unk_00A8[r6] = 2;
gUnknown_02022C98->unk_00C4[r5] = 1;
break;
}
break;
}
if (gUnknown_02022C98->unk_31A0[r6].unk_34 == 1)
{
break;
}
break;
}
if (gUnknown_02022C98->unk_31A0[r6].unk_34 == 1)
{
break;
}
}
}
for (r10 = sp0; r10 < sp4; r10++)
}
for (r10 = sp0; r10 < sp4; r10++)
{
r6 = 0xFF;
r5 = gUnknown_082F449C[r10];
if (gUnknown_02022C98->unk_00C4[r5] == 1)
{
r6 = 0xFF;
r5 = gUnknown_082F449C[r10];
if (gUnknown_02022C98->unk_00C4[r5] == 1)
r3 = gUnknown_02022C98->unk_0090[sub_8026D8C(r5)] / 7;
if (r3 < 2)
{
r3 = gUnknown_02022C98->unk_0090[sub_8026D8C(r5)] / 7;
if (r3 < 2)
r3 = 2;
}
r2 = gUnknown_082F7A88[r3][gUnknown_02022C98->unk_31A0[0].unk_14.unk_0[r5]] - gUnknown_02022C98->unk_00D0[r5];
if (r2 < 6)
{
gUnknown_02022C98->unk_009C[r5] += r2;
}
if (++gUnknown_02022C98->unk_009C[r5] >= 6)
{
gUnknown_02022C98->unk_009C[r5] = 0;
if (gUnknown_02022C98->unk_00F4[r5][0] != 0xFF && gUnknown_02022C98->unk_00F4[r5][1] == 0xFF)
{
r3 = 2;
r4 = gUnknown_02022C98->unk_00F4[r5][0];
}
r2 = gUnknown_082F7A88[r3][gUnknown_02022C98->unk_31A0[0].unk_14.unk_0[r5]] - gUnknown_02022C98->unk_00D0[r5];
if (r2 < 6)
else if (gUnknown_02022C98->unk_00F4[r5][0] == 0xFF && gUnknown_02022C98->unk_00F4[r5][1] == 0xFF)
{
gUnknown_02022C98->unk_009C[r5] += r2;
continue;
}
if (++gUnknown_02022C98->unk_009C[r5] < 6)
else
{
gUnknown_02022C98->unk_009C[r5] = 0;
if (gUnknown_02022C98->unk_00F4[r5][0] != 0xFF && gUnknown_02022C98->unk_00F4[r5][1] == 0xFF)
r7 = gUnknown_02022C98->unk_00F4[r5][0];
r7_2 = gUnknown_02022C98->unk_00F4[r5][1];
if ((Random() & 1))
{
r4 = gUnknown_02022C98->unk_00F4[r5][0];
}
else if (gUnknown_02022C98->unk_00F4[r5][0] == 0xFF && gUnknown_02022C98->unk_00F4[r5][1] == 0xFF)
{
continue;
r4 = r7_2;
r6 = r7;
}
else
{
r7 = gUnknown_02022C98->unk_00F4[r5][0];
r7_2 = gUnknown_02022C98->unk_00F4[r5][1];
if ((Random() & 1))
{
r4 = r7_2;
r6 = r7;
}
else
{
r4 = r7;
r6 = r7_2;
}
r4 = r7;
r6 = r7_2;
}
gUnknown_02022C98->unk_32CC.unk_1F[r5] = 7;
gUnknown_02022C98->unk_00C4[r5] = 2;
gUnknown_02022C98->unk_00A8[r4] = 3;
gUnknown_02022C98->unk_00B8[r5] = r4;
gUnknown_02022C98->unk_31A0[r4].unk_30 = 1;
gUnknown_02022C98->unk_31A0[r6].unk_34 = 1;
gUnknown_02022C98->unk_0086[r4]++;
sub_8026F1C(0, r5, r4);
sub_8027234(1);
sub_8026D1C(r4);
gUnknown_02022C98->unk_00E8[r5] = gUnknown_02022C98->unk_32CC.unk_14.unk_0[r5];
gUnknown_02022C98->unk_32CC.unk_14.unk_0[r5] = 3;
gUnknown_02022C98->unk_00F4[r5][0] = 0xFF;
gUnknown_02022C98->unk_00F4[r5][1] = 0xFF;
}
gUnknown_02022C98->unk_32CC.unk_14.unk_B[r5] = 7;
gUnknown_02022C98->unk_00C4[r5] = 2;
gUnknown_02022C98->unk_00A8[r4] = 3;
gUnknown_02022C98->unk_00B8[r5] = r4;
gUnknown_02022C98->unk_31A0[r4].unk_30 = 1;
gUnknown_02022C98->unk_31A0[r6].unk_34 = 1;
gUnknown_02022C98->unk_0086[r4]++;
sub_8026F1C(0, r5, r4);
sub_8027234(1);
sub_8026D1C(r4);
gUnknown_02022C98->unk_00E8[r5] = gUnknown_02022C98->unk_32CC.unk_14.unk_0[r5];
gUnknown_02022C98->unk_32CC.unk_14.unk_0[r5] = 3;
gUnknown_02022C98->unk_00F4[r5][0] = 0xFF;
gUnknown_02022C98->unk_00F4[r5][1] = 0xFF;
}
}
}
@ -1964,34 +1964,33 @@ u32 sub_8026634(u8 a0, u8 a1, u8 a2)
return FALSE;
}
#ifdef NONMATCHING
void sub_802671C(void)
{
u8 r1 = gUnknown_02022C98->unk_0044;
u8 r9 = gUnknown_02022C98->unk_0048;
u8 r3 = 0;
u8 r10 = 0;
u8 i;
u8 r3;
u8 r2;
struct DodrioBerryPickingSubstruct_31A0_14 * ptr;
struct DodrioBerryPickingStruct *ptr;
gUnknown_02022C98->unk_0120 = 0;
for (i = r1; i < r9 - 1; i++)
{
ptr = &gUnknown_02022C98->unk_32CC.unk_14;
ptr = gUnknown_02022C98;
if (gUnknown_02022C98->unk_00C4[i] == 0 || gUnknown_02022C98->unk_00C4[i] == 1)
{
gUnknown_02022C98->unk_0120 = 1;
if (ptr->unk_B[i] >= 10)
if (ptr->unk_32CC.unk_14.unk_B[i] >= 10)
{
ptr->unk_B[i] = 10;
ptr->unk_32CC.unk_14.unk_B[i] = 10;
gUnknown_02022C98->unk_00C4[i] = 3;
if (gUnknown_02022C98->unk_0148[i] == 0)
{
gUnknown_02022C98->unk_0148[i] = 1;
PlaySE(SE_FUUSEN1 + ptr->unk_0[i]);
PlaySE(SE_FUUSEN1 + ptr->unk_32CC.unk_14.unk_0[i]);
}
if (gUnknown_02022C98->unk_0040 < 10 || r10 == 1)
{
@ -2008,14 +2007,14 @@ void sub_802671C(void)
else
{
r3 = gUnknown_02022C98->unk_0090[sub_8026D8C(i)] / 7;
if (r3 < 2)
if (r3 >= 2)
{
r3 = 2;
}
r2 = gUnknown_082F7A88[r3][ptr->unk_0[i]];
r2 = gUnknown_082F7A88[r3][ptr->unk_32CC.unk_14.unk_0[i]];
if (++gUnknown_02022C98->unk_00D0[i] >= r2)
{
ptr->unk_B[i]++;
ptr->unk_32CC.unk_14.unk_B[i]++;
gUnknown_02022C98->unk_00D0[i] = 0;
}
sub_8026324();
@ -2030,8 +2029,8 @@ void sub_802671C(void)
gUnknown_02022C98->unk_00DC[i] = 0;
gUnknown_02022C98->unk_00D0[i] = 0;
gUnknown_02022C98->unk_00C4[i] = 0;
ptr->unk_B[i] = 1;
ptr->unk_0[i] = sub_8026DB0(sub_8026D8C(i), i);
ptr->unk_32CC.unk_14.unk_B[i] = 1;
ptr->unk_32CC.unk_14.unk_0[i] = sub_8026DB0(sub_8026D8C(i), i);
}
}
else if (gUnknown_02022C98->unk_00C4[i] == 3)
@ -2043,313 +2042,11 @@ void sub_802671C(void)
gUnknown_02022C98->unk_00DC[i] = 0;
gUnknown_02022C98->unk_00D0[i] = 0;
gUnknown_02022C98->unk_00C4[i] = 0;
ptr->unk_B[i] = 1;
gUnknown_02022C98->unk_00E8[i] = ptr->unk_0[i];
ptr->unk_0[i] = sub_8026DB0(sub_8026D8C(i), i);
ptr->unk_32CC.unk_14.unk_B[i] = 1;
gUnknown_02022C98->unk_00E8[i] = ptr->unk_32CC.unk_14.unk_0[i];
ptr->unk_32CC.unk_14.unk_0[i] = sub_8026DB0(sub_8026D8C(i), i);
}
}
}
}
}
#else
NAKED
void sub_802671C(void)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r10\n"
"\tmov r6, r9\n"
"\tmov r5, r8\n"
"\tpush {r5-r7}\n"
"\tldr r2, =gUnknown_02022C98\n"
"\tldr r4, [r2]\n"
"\tadds r0, r4, 0\n"
"\tadds r0, 0x44\n"
"\tldrb r1, [r0]\n"
"\tadds r0, 0x4\n"
"\tldrb r0, [r0]\n"
"\tmov r9, r0\n"
"\tmovs r3, 0\n"
"\tmov r10, r3\n"
"\tmovs r5, 0x90\n"
"\tlsls r5, 1\n"
"\tadds r0, r4, r5\n"
"\tstr r3, [r0]\n"
"\tadds r5, r1, 0\n"
"\tmov r0, r9\n"
"\tsubs r0, 0x1\n"
"\tcmp r5, r0\n"
"\tblt _0802674E\n"
"\tb _08026974\n"
"_0802674E:\n"
"\tmov r8, r2\n"
"_08026750:\n"
"\tmov r0, r8\n"
"\tldr r4, [r0]\n"
"\tadds r0, r4, 0\n"
"\tadds r0, 0xC4\n"
"\tadds r0, r5\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0x1\n"
"\tbls _08026762\n"
"\tb _0802686C\n"
"_08026762:\n"
"\tmovs r1, 0x90\n"
"\tlsls r1, 1\n"
"\tadds r0, r4, r1\n"
"\tmovs r2, 0x1\n"
"\tstr r2, [r0]\n"
"\tldr r1, =0x000032eb\n"
"\tadds r0, r4, r1\n"
"\tadds r6, r0, r5\n"
"\tldrb r0, [r6]\n"
"\tcmp r0, 0x9\n"
"\tbls _080267FC\n"
"\tmovs r7, 0\n"
"\tmovs r0, 0xA\n"
"\tstrb r0, [r6]\n"
"\tmov r1, r8\n"
"\tldr r0, [r1]\n"
"\tadds r0, 0xC4\n"
"\tadds r0, r5\n"
"\tmovs r1, 0x3\n"
"\tstrb r1, [r0]\n"
"\tmov r1, r8\n"
"\tldr r0, [r1]\n"
"\tmovs r6, 0xA4\n"
"\tlsls r6, 1\n"
"\tadds r0, r6\n"
"\tadds r1, r0, r5\n"
"\tldrb r0, [r1]\n"
"\tcmp r0, 0\n"
"\tbne _080267AC\n"
"\tstrb r2, [r1]\n"
"\tldr r2, =0x000032e0\n"
"\tadds r0, r4, r2\n"
"\tadds r0, r5\n"
"\tldrb r0, [r0]\n"
"\tadds r0, 0x4A\n"
"\tbl PlaySE\n"
"_080267AC:\n"
"\tmov r0, r8\n"
"\tldr r1, [r0]\n"
"\tadds r0, r1, 0\n"
"\tadds r0, 0x40\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0x9\n"
"\tbls _080267C2\n"
"\tmov r2, r10\n"
"\tcmp r2, 0x1\n"
"\tbeq _080267C2\n"
"\tb _08026964\n"
"_080267C2:\n"
"\tmovs r0, 0x1\n"
"\tmov r10, r0\n"
"\tadds r0, r1, r6\n"
"\tadds r0, r5\n"
"\tstrb r7, [r0]\n"
"\tmov r1, r8\n"
"\tldr r0, [r1]\n"
"\tadds r1, r0, 0\n"
"\tadds r1, 0x40\n"
"\tldrb r0, [r1]\n"
"\tcmp r0, 0x9\n"
"\tbhi _080267DE\n"
"\tadds r0, 0x1\n"
"\tstrb r0, [r1]\n"
"_080267DE:\n"
"\tmovs r0, 0x3\n"
"\tadds r1, r5, 0\n"
"\tmovs r2, 0\n"
"\tbl sub_8026F1C\n"
"\tmovs r0, 0\n"
"\tbl sub_8027234\n"
"\tb _08026964\n"
"\t.pool\n"
"_080267FC:\n"
"\tadds r0, r5, 0\n"
"\tbl sub_8026D8C\n"
"\tmov r2, r8\n"
"\tldr r7, [r2]\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tadds r1, r7, 0\n"
"\tadds r1, 0x90\n"
"\tadds r1, r0\n"
"\tldrb r0, [r1]\n"
"\tmovs r1, 0x7\n"
"\tbl __udivsi3\n"
"\tlsls r0, 24\n"
"\tlsrs r3, r0, 24\n"
"\tcmp r3, 0x1\n"
"\tbls _08026822\n"
"\tmovs r3, 0x2\n"
"_08026822:\n"
"\tldr r2, =gUnknown_082F7A88\n"
"\tldr r0, =0x000032e0\n"
"\tadds r1, r4, r0\n"
"\tadds r1, r5\n"
"\tlsls r0, r3, 1\n"
"\tadds r0, r3\n"
"\tldrb r1, [r1]\n"
"\tadds r0, r1\n"
"\tadds r0, r2\n"
"\tldrb r2, [r0]\n"
"\tadds r1, r7, 0\n"
"\tadds r1, 0xD0\n"
"\tadds r1, r5\n"
"\tldrb r0, [r1]\n"
"\tadds r0, 0x1\n"
"\tmovs r3, 0\n"
"\tstrb r0, [r1]\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tcmp r0, r2\n"
"\tbcc _0802685C\n"
"\tldrb r0, [r6]\n"
"\tadds r0, 0x1\n"
"\tstrb r0, [r6]\n"
"\tmov r1, r8\n"
"\tldr r0, [r1]\n"
"\tadds r0, 0xD0\n"
"\tadds r0, r5\n"
"\tstrb r3, [r0]\n"
"_0802685C:\n"
"\tbl sub_8026324\n"
"\tb _08026964\n"
"\t.pool\n"
"_0802686C:\n"
"\tcmp r0, 0x2\n"
"\tbne _080268F4\n"
"\tmovs r2, 0x90\n"
"\tlsls r2, 1\n"
"\tadds r0, r4, r2\n"
"\tmovs r6, 0x1\n"
"\tstr r6, [r0]\n"
"\tadds r1, r4, 0\n"
"\tadds r1, 0xDC\n"
"\tadds r1, r5\n"
"\tldrb r0, [r1]\n"
"\tadds r0, 0x1\n"
"\tmovs r3, 0\n"
"\tstrb r0, [r1]\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tcmp r0, 0x13\n"
"\tbls _08026964\n"
"\tmov r0, r8\n"
"\tldr r2, [r0]\n"
"\tadds r0, r2, 0\n"
"\tadds r0, 0xB8\n"
"\tadds r0, r5\n"
"\tldrb r1, [r0]\n"
"\tlsls r0, r1, 4\n"
"\tsubs r0, r1\n"
"\tlsls r0, 2\n"
"\tadds r2, r0\n"
"\tldr r1, =0x000031d0\n"
"\tadds r2, r1\n"
"\tstrb r3, [r2]\n"
"\tmov r2, r8\n"
"\tldr r0, [r2]\n"
"\tadds r0, 0xDC\n"
"\tadds r0, r5\n"
"\tstrb r3, [r0]\n"
"\tldr r0, [r2]\n"
"\tadds r0, 0xD0\n"
"\tadds r0, r5\n"
"\tstrb r3, [r0]\n"
"\tldr r0, [r2]\n"
"\tadds r0, 0xC4\n"
"\tadds r0, r5\n"
"\tstrb r3, [r0]\n"
"\tldr r1, =0x000032eb\n"
"\tadds r0, r4, r1\n"
"\tadds r0, r5\n"
"\tstrb r6, [r0]\n"
"\tadds r0, r5, 0\n"
"\tbl sub_8026D8C\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tadds r1, r5, 0\n"
"\tbl sub_8026DB0\n"
"\tldr r2, =0x000032e0\n"
"\tadds r1, r4, r2\n"
"\tadds r1, r5\n"
"\tstrb r0, [r1]\n"
"\tb _08026964\n"
"\t.pool\n"
"_080268F4:\n"
"\tcmp r0, 0x3\n"
"\tbne _08026964\n"
"\tadds r1, r4, 0\n"
"\tadds r1, 0xDC\n"
"\tadds r1, r5\n"
"\tldrb r0, [r1]\n"
"\tadds r0, 0x1\n"
"\tmovs r2, 0\n"
"\tstrb r0, [r1]\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tcmp r0, 0x13\n"
"\tbls _08026964\n"
"\tmov r0, r8\n"
"\tldr r1, [r0]\n"
"\tadds r0, r1, 0\n"
"\tadds r0, 0x40\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0x9\n"
"\tbhi _08026964\n"
"\tadds r0, r1, 0\n"
"\tadds r0, 0xDC\n"
"\tadds r0, r5\n"
"\tstrb r2, [r0]\n"
"\tmov r1, r8\n"
"\tldr r0, [r1]\n"
"\tadds r0, 0xD0\n"
"\tadds r0, r5\n"
"\tstrb r2, [r0]\n"
"\tldr r0, [r1]\n"
"\tadds r0, 0xC4\n"
"\tadds r0, r5\n"
"\tstrb r2, [r0]\n"
"\tldr r2, =0x000032eb\n"
"\tadds r0, r4, r2\n"
"\tadds r0, r5\n"
"\tmovs r1, 0x1\n"
"\tstrb r1, [r0]\n"
"\tmov r0, r8\n"
"\tldr r1, [r0]\n"
"\tadds r1, 0xE8\n"
"\tadds r1, r5\n"
"\tsubs r2, 0xB\n"
"\tadds r4, r2\n"
"\tadds r4, r5\n"
"\tldrb r0, [r4]\n"
"\tstrb r0, [r1]\n"
"\tadds r0, r5, 0\n"
"\tbl sub_8026D8C\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tadds r1, r5, 0\n"
"\tbl sub_8026DB0\n"
"\tstrb r0, [r4]\n"
"_08026964:\n"
"\tadds r0, r5, 0x1\n"
"\tlsls r0, 24\n"
"\tlsrs r5, r0, 24\n"
"\tmov r0, r9\n"
"\tsubs r0, 0x1\n"
"\tcmp r5, r0\n"
"\tbge _08026974\n"
"\tb _08026750\n"
"_08026974:\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.pool");
}
#endif // NONMATCHING

View file

@ -2914,70 +2914,21 @@ void sub_800EF88(u8 a0)
}
}
#ifdef NONMATCHING
// FIXME: gUnknown_03005000.unk_c87 should be in r5
// FIXME: gRecvCmds should be in r6 and r7
void sub_800EFB0(void)
{
s32 i, j;
for (i = 0; i < 5; i++)
{
struct UnkRfuStruct_2 *ptr = &gUnknown_03005000;
for (j = 0; j < 7; j++)
{
gUnknown_03005000.unk_c87[i][j][1] = gRecvCmds[i][j] >> 8;
gUnknown_03005000.unk_c87[i][j][0] = gRecvCmds[i][j];
ptr->unk_c87[i][j][1] = gRecvCmds[i][j] >> 8;
ptr->unk_c87[i][j][0] = gRecvCmds[i][j];
}
}
CpuFill16(0, gRecvCmds, sizeof gRecvCmds);
}
#else
NAKED void sub_800EFB0(void)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tsub sp, 0x4\n"
"\tmovs r2, 0\n"
"\tldr r7, =gRecvCmds\n"
"\tldr r0, =gUnknown_03005000\n"
"\tadds r6, r7, 0\n"
"\tldr r1, =0x00000c87\n"
"\tadds r5, r0, r1\n"
"_0800EFC0:\n"
"\tmovs r3, 0\n"
"\tlsls r0, r2, 3\n"
"\tlsls r1, r2, 4\n"
"\tadds r4, r2, 0x1\n"
"\tsubs r0, r2\n"
"\tlsls r0, 1\n"
"\tadds r2, r0, r5\n"
"\tadds r1, r6\n"
"_0800EFD0:\n"
"\tldrh r0, [r1]\n"
"\tlsrs r0, 8\n"
"\tstrb r0, [r2, 0x1]\n"
"\tldrh r0, [r1]\n"
"\tstrb r0, [r2]\n"
"\tadds r2, 0x2\n"
"\tadds r1, 0x2\n"
"\tadds r3, 0x1\n"
"\tcmp r3, 0x6\n"
"\tble _0800EFD0\n"
"\tadds r2, r4, 0\n"
"\tcmp r2, 0x4\n"
"\tble _0800EFC0\n"
"\tmovs r0, 0\n"
"\tmov r1, sp\n"
"\tstrh r0, [r1]\n"
"\tldr r2, =0x01000028\n"
"\tmov r0, sp\n"
"\tadds r1, r7, 0\n"
"\tbl CpuSet\n"
"\tadd sp, 0x4\n"
"\tpop {r4-r7}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.pool");
}
#endif
void sub_800F014(void)
{

View file

@ -54,8 +54,10 @@ static void UpdateBlendRegisters(void);
static bool8 IsSoftwarePaletteFadeFinishing(void);
static void sub_80A2D54(u8 taskId);
EWRAM_DATA u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE] = {0};
EWRAM_DATA u16 gPlttBufferFaded[PLTT_BUFFER_SIZE] = {0};
// palette buffers require alignment with agbcc because
// unaligned word reads are issued in BlendPalette otherwise
ALIGNED(4) EWRAM_DATA u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE] = {0};
ALIGNED(4) EWRAM_DATA u16 gPlttBufferFaded[PLTT_BUFFER_SIZE] = {0};
EWRAM_DATA struct PaletteStruct sPaletteStructs[0x10] = {0};
EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0};
static EWRAM_DATA u32 gFiller_2037FE0 = 0;

View file

@ -96,7 +96,7 @@ typedef union {
struct UnkStruct_08625388 {
u16 idx;
u16 v2;
u16 v4;
u32 v4;
const u8 *v8[4];
};
@ -1209,7 +1209,6 @@ static void MatchCall_GetNameAndDescByRematchIdx(u32 idx, const u8 **desc, const
*name = trainer->trainerName;
}
#ifdef NONMATCHING
const u8 *sub_81D1B40(u32 idx, u32 offset)
{
u32 i;
@ -1218,95 +1217,21 @@ const u8 *sub_81D1B40(u32 idx, u32 offset)
{
if (sMatchCallCheckPageOverrides[i].idx == idx)
{
for (; i + 1 < ARRAY_COUNT(sMatchCallCheckPageOverrides) && sMatchCallCheckPageOverrides[i + 1].idx == idx; i++)
while (1)
{
if (i + 1 >= ARRAY_COUNT(sMatchCallCheckPageOverrides))
break;
if (sMatchCallCheckPageOverrides[i + 1].idx != idx)
break;
if (!FlagGet(sMatchCallCheckPageOverrides[i + 1].v4))
break;
i++;
}
return sMatchCallCheckPageOverrides[i].v8[offset];
}
}
return NULL;
}
#else
NAKED const u8 *sub_81D1B40(u32 idx, u32 offset)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r9\n"
"\tmov r6, r8\n"
"\tpush {r6,r7}\n"
"\tadds r6, r0, 0\n"
"\tmovs r5, 0\n"
"\tldr r2, =sMatchCallCheckPageOverrides\n"
"\tmovs r0, 0x8\n"
"\tadds r0, r2\n"
"\tmov r9, r0\n"
"_081D1B54:\n"
"\tlsls r0, r5, 1\n"
"\tadds r0, r5\n"
"\tlsls r0, 3\n"
"\tadds r0, r2\n"
"\tldrh r0, [r0]\n"
"\tcmp r0, r6\n"
"\tbne _081D1BBC\n"
"\tadds r4, r5, 0x1\n"
"\tlsls r1, 2\n"
"\tmov r8, r1\n"
"\tcmp r4, 0x3\n"
"\tbhi _081D1BA8\n"
"\tlsls r0, r4, 1\n"
"\tadds r0, r4\n"
"\tlsls r0, 3\n"
"\tadds r0, r2\n"
"\tldrh r0, [r0]\n"
"\tcmp r0, r6\n"
"\tbne _081D1BA8\n"
"\tldr r7, =sMatchCallCheckPageOverrides\n"
"_081D1B7C:\n"
"\tlsls r0, r4, 1\n"
"\tadds r0, r4\n"
"\tlsls r0, 3\n"
"\tadds r1, r7, 0x4\n"
"\tadds r0, r1\n"
"\tldrh r0, [r0]\n"
"\tbl FlagGet\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbeq _081D1BA8\n"
"\tadds r5, r4, 0\n"
"\tadds r4, r5, 0x1\n"
"\tcmp r4, 0x3\n"
"\tbhi _081D1BA8\n"
"\tlsls r0, r4, 1\n"
"\tadds r0, r4\n"
"\tlsls r0, 3\n"
"\tadds r0, r7\n"
"\tldrh r0, [r0]\n"
"\tcmp r0, r6\n"
"\tbeq _081D1B7C\n"
"_081D1BA8:\n"
"\tlsls r0, r5, 1\n"
"\tadds r0, r5\n"
"\tlsls r0, 3\n"
"\tadd r0, r8\n"
"\tadd r0, r9\n"
"\tldr r0, [r0]\n"
"\tb _081D1BC4\n"
"\t.pool\n"
"_081D1BBC:\n"
"\tadds r5, 0x1\n"
"\tcmp r5, 0x3\n"
"\tbls _081D1B54\n"
"\tmovs r0, 0\n"
"_081D1BC4:\n"
"\tpop {r3,r4}\n"
"\tmov r8, r3\n"
"\tmov r9, r4\n"
"\tpop {r4-r7}\n"
"\tpop {r1}\n"
"\tbx r1");
}
#endif
int sub_81D1BD0(u32 idx)
{

View file

@ -197,7 +197,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
gTempTextPrinter.textSpeed = 0;
for (j = 0; j < 0x400; ++j)
{
if ((u32)RenderFont(&gTempTextPrinter) == 1)
if (RenderFont(&gTempTextPrinter) == 1)
break;
}