through sub_8025758

This commit is contained in:
scnorton 2019-03-25 12:08:56 -04:00
parent 4780f208d3
commit c3e26a58df
2 changed files with 236 additions and 488 deletions

View File

@ -5,493 +5,6 @@
.text
thumb_func_start sub_8025470
sub_8025470: @ 8025470
push {r4,r5,lr}
sub sp, 0x4
ldr r4, =gUnknown_02022C98
ldr r0, [r4]
ldrb r0, [r0, 0x10]
cmp r0, 0x7
bls _08025480
b _08025606
_08025480:
lsls r0, 2
ldr r1, =_08025494
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08025494:
.4byte _080254B4
.4byte _080254D4
.4byte _080254F0
.4byte _08025504
.4byte _08025520
.4byte _0802553C
.4byte _08025564
.4byte _08025578
_080254B4:
bl sub_8027748
ldr r1, =0x00000bb7
cmp r0, r1
bls _080254C4
movs r0, 0x4
bl sub_80292E0
_080254C4:
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
b _080255E8
.pool
_080254D4:
bl sub_802A770
cmp r0, 0
beq _080254DE
b _0802563C
_080254DE:
movs r0, 0x3
bl sub_80292E0
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
b _080255E8
.pool
_080254F0:
bl sub_8028FCC
bl sub_80272E8
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
b _080255E8
.pool
_08025504:
bl sub_802A794
lsls r0, 24
lsrs r0, 24
mov r1, sp
strb r0, [r1]
cmp r0, 0
bne _08025516
b _0802563C
_08025516:
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
b _080255E8
.pool
_08025520:
bl sub_802A770
cmp r0, 0
beq _0802552A
b _0802563C
_0802552A:
movs r0, 0x5
bl sub_80292E0
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
b _080255E8
.pool
_0802553C:
bl sub_802A794
mov r1, sp
strb r0, [r1]
movs r0, 0
movs r2, 0x1
bl SendBlock
lsls r0, 24
cmp r0, 0
beq _0802563C
ldr r2, =gUnknown_02022C98
ldr r1, [r2]
movs r0, 0
strb r0, [r1, 0x8]
ldr r1, [r2]
b _080255E8
.pool
_08025564:
bl IsLinkTaskFinished
lsls r0, 24
cmp r0, 0
beq _0802563C
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
b _080255E8
.pool
_08025578:
bl sub_8025170
cmp r0, 0
beq _080255BE
movs r2, 0
ldr r1, =gUnknown_02022C98
ldr r0, [r1]
adds r0, 0x24
ldrb r0, [r0]
cmp r2, r0
bcs _080255BE
adds r3, r1, 0
movs r5, 0x86
lsls r5, 1
ldr r4, =gBlockRecvBuffer
_08025596:
ldr r1, [r3]
adds r1, r2, r1
adds r1, r5
lsls r0, r2, 8
adds r0, r4
ldrb r0, [r0]
strb r0, [r1]
ldr r1, [r3]
adds r0, r1, 0
adds r0, 0x24
ldrb r0, [r0]
strb r0, [r1, 0x8]
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
ldr r0, [r3]
adds r0, 0x24
ldrb r0, [r0]
cmp r2, r0
bcc _08025596
_080255BE:
ldr r4, =gUnknown_02022C98
ldr r2, [r4]
adds r1, r2, 0
adds r1, 0x24
ldrb r0, [r2, 0x8]
ldrb r1, [r1]
cmp r0, r1
bcc _080255F8
ldrb r0, [r2, 0x14]
adds r0, 0x1
strb r0, [r2, 0x14]
lsls r0, 24
lsrs r0, 24
cmp r0, 0x77
bls _0802563C
bl sub_8027608
movs r0, 0x6
bl sub_80292E0
ldr r1, [r4]
_080255E8:
ldrb r0, [r1, 0x10]
adds r0, 0x1
strb r0, [r1, 0x10]
b _0802563C
.pool
_080255F8:
bl sub_8027554
b _0802563C
_080255FE:
movs r0, 0x8
bl sub_8026240
b _0802563C
_08025606:
bl sub_802A770
cmp r0, 0
bne _0802563C
movs r2, 0
ldr r1, [r4]
adds r0, r1, 0
adds r0, 0x24
ldrb r0, [r0]
cmp r2, r0
bcs _08025636
movs r4, 0x86
lsls r4, 1
adds r3, r1, r4
adds r1, r0, 0
_08025624:
adds r0, r3, r2
ldrb r0, [r0]
cmp r0, 0x2
beq _080255FE
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, r1
bcc _08025624
_08025636:
movs r0, 0xA
bl sub_8026240
_0802563C:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_8025470
thumb_func_start sub_8025644
sub_8025644: @ 8025644
push {r4,lr}
ldr r4, =gUnknown_02022C98
ldr r0, [r4]
ldrb r0, [r0, 0x10]
cmp r0, 0x1
beq _08025672
cmp r0, 0x1
bgt _08025660
cmp r0, 0
beq _08025666
b _08025692
.pool
_08025660:
cmp r0, 0x2
beq _0802567C
b _08025692
_08025666:
bl sub_800AC34
movs r0, 0x7
bl sub_80292E0
b _08025688
_08025672:
bl sub_802A770
cmp r0, 0
bne _080256A0
b _08025688
_0802567C:
bl sub_802A794
lsls r0, 24
lsrs r0, 24
cmp r0, 0x5
bne _080256A0
_08025688:
ldr r1, [r4]
ldrb r0, [r1, 0x10]
adds r0, 0x1
strb r0, [r1, 0x10]
b _080256A0
_08025692:
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
bne _080256A0
movs r0, 0x9
bl sub_8026240
_080256A0:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8025644
thumb_func_start sub_80256AC
sub_80256AC: @ 80256AC
push {r4,lr}
sub sp, 0x4
ldr r4, =gUnknown_02022C98
ldr r0, [r4]
ldrb r1, [r0, 0x10]
cmp r1, 0x1
beq _080256E0
cmp r1, 0x1
bgt _080256C8
cmp r1, 0
beq _080256CE
b _08025728
.pool
_080256C8:
cmp r1, 0x2
beq _080256F8
b _08025728
_080256CE:
movs r0, 0x1
negs r0, r0
str r1, [sp]
movs r1, 0
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
b _0802571A
_080256E0:
bl UpdatePaletteFade
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _0802574C
b _0802571A
.pool
_080256F8:
bl sub_8028B80
bl sub_80287E4
ldr r0, [r4]
adds r0, 0x24
ldrb r0, [r0]
bl sub_8028614
bl sub_8028E84
ldr r1, =gUnknown_03000DB0
movs r0, 0x1
str r0, [r1]
movs r0, 0x8
bl sub_80292E0
_0802571A:
ldr r1, [r4]
ldrb r0, [r1, 0x10]
adds r0, 0x1
strb r0, [r1, 0x10]
b _0802574C
.pool
_08025728:
bl sub_802A770
cmp r0, 0
bne _0802574C
ldr r4, =gUnknown_02022C98
ldr r0, [r4]
ldr r0, [r0]
bl SetMainCallback2
ldr r0, [r4]
ldrb r0, [r0, 0x4]
bl DestroyTask
ldr r0, [r4]
bl Free
bl FreeAllWindowBuffers
_0802574C:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80256AC
thumb_func_start sub_8025758
sub_8025758: @ 8025758
push {r4,lr}
sub sp, 0x4
ldr r4, =gUnknown_02022C98
ldr r1, [r4]
ldrb r0, [r1, 0x10]
cmp r0, 0x6
bls _08025768
b _0802585C
_08025768:
lsls r0, 2
ldr r1, =_0802577C
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_0802577C:
.4byte _08025798
.4byte _08025838
.4byte _080257B0
.4byte _08025802
.4byte _08025808
.4byte _08025818
.4byte _08025838
_08025798:
movs r0, 0x9
bl sub_80292E0
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
b _08025848
_080257B0:
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgY
b _08025848
_08025802:
bl StopMapMusic
b _08025848
_08025808:
ldr r0, =0x0000021e
bl PlayNewMapMusic
bl sub_8028E4C
b _08025848
.pool
_08025818:
movs r4, 0x1
negs r4, r4
adds r0, r4, 0
movs r1, 0x10
movs r2, 0
bl BlendPalettes
movs r0, 0
str r0, [sp]
adds r0, r4, 0
movs r1, 0
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
b _08025848
_08025838:
bl UpdatePaletteFade
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _0802588C
_08025848:
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
ldrb r0, [r1, 0x10]
adds r0, 0x1
strb r0, [r1, 0x10]
b _0802588C
.pool
_0802585C:
ldrb r0, [r1, 0x4]
bl DestroyTask
ldr r0, =sub_802589C
bl sub_802621C
bl sub_802903C
ldr r0, [r4]
bl sub_8024A30
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
bne _08025882
ldr r0, [r4]
adds r0, 0x24
movs r1, 0x1
strb r1, [r0]
_08025882:
bl sub_80273F0
movs r0, 0
bl sub_8028EC8
_0802588C:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8025758
thumb_func_start sub_802589C
sub_802589C: @ 802589C
push {r4,r5,lr}

View File

@ -1,6 +1,8 @@
#include "global.h"
#include "alloc.h"
#include "palette.h"
#include "window.h"
#include "bg.h"
#include "link.h"
#include "link_rfu.h"
#include "task.h"
@ -42,7 +44,8 @@ struct DodrioBerryPickingSubstruct_318C
struct DodrioBerryPickingStruct
{
/*0x0000*/ void (*savedCallback)(void);
/*0x0004*/ u8 filler_0004[4];
/*0x0004*/ u8 unk_0004;
/*0x0005*/ u8 filler_0005[3];
/*0x0008*/ u8 unk_0008;
/*0x0009*/ u8 filler_0009[3];
/*0x000C*/ u8 unk_000C;
@ -156,21 +159,32 @@ void sub_8026B28(void);
void sub_8026B5C(u8, u8*, u8*);
bool32 sub_8026C50(void);
bool32 sub_8026C90(void);
void sub_80272E8(void);
void sub_80272A4(void);
void sub_80273F0(void);
void sub_802749C(void);
u8 sub_8027518(u8);
void sub_8027554(void);
void sub_8027608(void);
u32 sub_8027748(void);
void sub_80283A8(void);
void sub_8028408(struct DodrioBerryPickingSubstruct_318C *, u8, u8, u8);
void sub_8028504(u8);
void sub_8028614(u8);
void sub_802868C(u8, u8);
void sub_8028734(void);
void sub_80287E4(void);
void sub_80289E8(u8);
void sub_8028A34(void);
void sub_8028A88(void);
void sub_8028B80(void);
void sub_8028D44(void);
void sub_8028DFC(void);
void sub_8028E4C(void);
void sub_8028E84(void);
void sub_8028EC8(u8);
void sub_8028FCC(void);
void sub_802903C(void);
void sub_8029274(struct DodrioBerryPickingSubstruct_0160 *);
void sub_80292E0(u8);
bool32 sub_802A770(void);
@ -712,3 +726,224 @@ void sub_8025324(void)
break;
}
}
void sub_8025470(void)
{
u8 sp0;
u8 i;
switch (gUnknown_02022C98->unk_0010)
{
case 0:
if (sub_8027748() >= 3000)
{
sub_80292E0(4);
}
gUnknown_02022C98->unk_0010++;
break;
case 1:
if (!sub_802A770())
{
sub_80292E0(3);
gUnknown_02022C98->unk_0010++;
}
break;
case 2:
sub_8028FCC();
sub_80272E8();
gUnknown_02022C98->unk_0010++;
break;
case 3:
if ((sp0 = sub_802A794()) != 0)
{
gUnknown_02022C98->unk_0010++;
}
break;
case 4:
if (!sub_802A770())
{
sub_80292E0(5);
gUnknown_02022C98->unk_0010++;
}
break;
case 5:
sp0 = sub_802A794();
if (SendBlock(0, &sp0, sizeof(sp0)))
{
gUnknown_02022C98->unk_0008 = 0;
gUnknown_02022C98->unk_0010++;
}
break;
case 6:
if (IsLinkTaskFinished())
{
gUnknown_02022C98->unk_0010++;
}
break;
case 7:
if (sub_8025170())
{
for (i = 0; i < gUnknown_02022C98->unk_0024; i++)
{
*(gUnknown_02022C98->unk_010C + i) = *(u8 *)gBlockRecvBuffer[i];
gUnknown_02022C98->unk_0008 = gUnknown_02022C98->unk_0024;
}
}
if (gUnknown_02022C98->unk_0008 >= gUnknown_02022C98->unk_0024) {
if (++gUnknown_02022C98->unk_0014 >= 120)
{
sub_8027608();
sub_80292E0(6);
gUnknown_02022C98->unk_0010++;
}
}
else
{
sub_8027554();
}
break;
default:
if (!sub_802A770())
{
for (i = 0; i < gUnknown_02022C98->unk_0024; i++)
{
if (gUnknown_02022C98->unk_010C[i] == 2)
{
sub_8026240(8);
return;
}
}
sub_8026240(10);
}
break;
}
}
void sub_8025644(void)
{
switch (gUnknown_02022C98->unk_0010)
{
case 0:
sub_800AC34();
sub_80292E0(7);
gUnknown_02022C98->unk_0010++;
break;
case 1:
if (!sub_802A770())
{
gUnknown_02022C98->unk_0010++;
}
break;
case 2:
if (sub_802A794() == 5)
{
gUnknown_02022C98->unk_0010++;
}
break;
default:
if (gReceivedRemoteLinkPlayers == 0)
{
sub_8026240(9);
}
break;
}
}
void sub_80256AC(void)
{
switch (gUnknown_02022C98->unk_0010)
{
case 0:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
gUnknown_02022C98->unk_0010++;
break;
case 1:
UpdatePaletteFade();
if (!gPaletteFade.active)
{
gUnknown_02022C98->unk_0010++;
}
break;
case 2:
sub_8028B80();
sub_80287E4();
sub_8028614(gUnknown_02022C98->unk_0024);
sub_8028E84();
gUnknown_03000DB0 = TRUE;
sub_80292E0(8);
gUnknown_02022C98->unk_0010++;
break;
default:
if (!sub_802A770())
{
SetMainCallback2(gUnknown_02022C98->savedCallback);
DestroyTask(gUnknown_02022C98->unk_0004);
Free(gUnknown_02022C98);
FreeAllWindowBuffers();
}
break;
}
}
void sub_8025758(void)
{
switch (gUnknown_02022C98->unk_0010)
{
case 0:
sub_80292E0(9);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
gUnknown_02022C98->unk_0010++;
break;
case 1:
UpdatePaletteFade();
if (!gPaletteFade.active)
{
gUnknown_02022C98->unk_0010++;
}
break;
case 2:
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
gUnknown_02022C98->unk_0010++;
break;
case 3:
StopMapMusic();
gUnknown_02022C98->unk_0010++;
break;
case 4:
PlayNewMapMusic(MUS_RG_KINOMIKUI);
sub_8028E4C();
gUnknown_02022C98->unk_0010++;
break;
case 5:
BlendPalettes(0xFFFFFFFF, 16, 0);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
gUnknown_02022C98->unk_0010++;
break;
case 6:
UpdatePaletteFade();
if (!gPaletteFade.active)
{
gUnknown_02022C98->unk_0010++;
}
break;
default:
DestroyTask(gUnknown_02022C98->unk_0004);
sub_802621C(sub_802589C);
sub_802903C();
sub_8024A30(gUnknown_02022C98);
if (gReceivedRemoteLinkPlayers == 0)
{
gUnknown_02022C98->unk_0024 = 1;
}
sub_80273F0();
sub_8028EC8(0);
break;
}
}