sub_80D8A88

This commit is contained in:
PikalaxALT 2018-05-03 22:29:53 -04:00
parent 210cedd077
commit f05acd88d5
2 changed files with 109 additions and 300 deletions

View file

@ -5,301 +5,6 @@
.text
thumb_func_start sub_80D8894
sub_80D8894: @ 80D8894
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _080D890C
ldr r4, =gContestPlayerMonIndex
ldrb r0, [r4]
bl sub_80DB8B8
ldr r1, =gContestResources
ldr r1, [r1]
ldrb r2, [r4]
ldr r3, [r1, 0x4]
lsls r1, r2, 3
subs r1, r2
lsls r1, 2
adds r1, r3
strh r0, [r1, 0x6]
ldr r4, =sub_80FC9F8
adds r0, r4, 0
movs r1, 0
bl CreateTask
lsls r0, 24
lsrs r0, 24
ldr r2, =sub_80D892C
adds r1, r4, 0
bl SetTaskFuncWithFollowupFunc
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
ldr r1, =TaskDummy1
str r1, [r0]
bl sub_80DBF68
movs r0, 0
bl sub_80DC490
b _080D891E
.pool
_080D890C:
bl sub_80DB918
ldr r0, =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
ldr r0, =sub_80D895C
str r0, [r1]
_080D891E:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D8894
thumb_func_start sub_80D892C
sub_80D892C: @ 80D892C
push {lr}
lsls r0, 24
lsrs r0, 24
bl DestroyTask
ldr r2, =gTasks
ldr r0, =gContestResources
ldr r0, [r0]
ldr r0, [r0]
ldrb r1, [r0, 0x8]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
ldr r1, =sub_80D895C
str r1, [r0]
pop {r0}
bx r0
.pool
thumb_func_end sub_80D892C
thumb_func_start sub_80D895C
sub_80D895C: @ 80D895C
push {r4-r7,lr}
lsls r0, 24
lsrs r7, r0, 24
bl sub_80DB89C
ldr r0, =gBattle_BG0_Y
movs r1, 0
strh r1, [r0]
ldr r0, =gBattle_BG2_Y
strh r1, [r0]
movs r0, 0
bl sub_80DC490
movs r6, 0
movs r5, 0xA0
lsls r5, 19
_080D897C:
lsrs r4, r5, 24
adds r0, r4, 0
movs r1, 0
bl FillWindowPixelBuffer
adds r0, r4, 0
bl PutWindowTilemap
adds r0, r4, 0
movs r1, 0x2
bl CopyWindowToVram
movs r0, 0x80
lsls r0, 17
adds r5, r0
adds r6, 0x1
cmp r6, 0x3
ble _080D897C
movs r0, 0
bl sub_80DED60
ldr r1, =gPlttBufferFaded
ldr r0, =0x0201a604
movs r2, 0x80
lsls r2, 3
ldr r4, =0x040000d4
str r1, [r4]
str r0, [r4, 0x4]
lsrs r1, r2, 2
movs r3, 0x84
lsls r3, 24
orrs r1, r3
str r1, [r4, 0x8]
ldr r1, [r4, 0x8]
ldr r1, =0xfffffc00
adds r0, r1
movs r1, 0
bl LoadPalette
ldr r1, =gTasks
lsls r0, r7, 2
adds r0, r7
lsls r0, 3
adds r0, r1
movs r1, 0
strh r1, [r0, 0x8]
strh r1, [r0, 0xA]
ldr r1, =sub_80D8A04
str r1, [r0]
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D895C
thumb_func_start sub_80D8A04
sub_80D8A04: @ 80D8A04
push {r4,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
lsls r0, 16
asrs r0, 16
cmp r0, 0x2
ble _080D8A42
movs r0, 0
strh r0, [r4, 0x8]
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x2
bne _080D8A42
bl sub_80DDBE8
movs r0, 0x1
bl sub_80DE69C
ldr r0, =sub_80D8A50
str r0, [r4]
_080D8A42:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D8A04
thumb_func_start sub_80D8A50
sub_80D8A50: @ 80D8A50
push {lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gContestResources
ldr r0, [r0]
ldr r0, [r0]
ldrh r1, [r0, 0x6]
movs r0, 0x90
lsls r0, 2
ands r0, r1
cmp r0, 0
bne _080D8A76
ldr r0, =gTasks
lsls r1, r2, 2
adds r1, r2
lsls r1, 3
adds r1, r0
ldr r0, =sub_80D8A88
str r0, [r1]
_080D8A76:
pop {r0}
bx r0
.pool
thumb_func_end sub_80D8A50
thumb_func_start sub_80D8A88
sub_80D8A88: @ 80D8A88
push {r4-r7,lr}
lsls r0, 24
lsrs r6, r0, 24
ldr r0, =gTasks
lsls r3, r6, 2
adds r1, r3, r6
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
lsls r0, 16
asrs r0, 16
cmp r0, 0x13
ble _080D8B18
ldr r2, =gContestResources
ldr r0, [r2]
ldr r1, [r0]
movs r0, 0
strb r0, [r1, 0x10]
ldr r0, [r2]
ldr r1, [r0]
ldr r0, =gRngValue
ldr r0, [r0]
str r0, [r1, 0x18]
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
adds r7, r3, 0
cmp r0, 0
beq _080D8B08
bl sub_80DA8A4
lsls r0, 24
cmp r0, 0
beq _080D8B08
movs r4, 0
ldr r1, =gUnknown_02039F30
ldrb r0, [r1]
cmp r0, 0x3
bgt _080D8B08
adds r5, r1, 0
_080D8ADE:
ldrb r0, [r5]
adds r0, r4
lsls r0, 24
lsrs r0, 24
bl sub_80DB8B8
ldr r1, =gContestResources
ldr r1, [r1]
ldrb r2, [r5]
adds r2, r4
ldr r3, [r1, 0x4]
lsls r1, r2, 3
subs r1, r2
lsls r1, 2
adds r1, r3
strh r0, [r1, 0x6]
adds r4, 0x1
ldrb r0, [r5]
adds r0, r4, r0
cmp r0, 0x3
ble _080D8ADE
_080D8B08:
ldr r1, =gTasks
adds r0, r7, r6
lsls r0, 3
adds r0, r1
movs r1, 0
strh r1, [r0, 0x8]
ldr r1, =sub_80D8B38
str r1, [r0]
_080D8B18:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D8A88
thumb_func_start sub_80D8B38
sub_80D8B38: @ 80D8B38
push {r4-r7,lr}

View file

@ -53,16 +53,25 @@ void sub_80D8108(u8 taskId);
void vblank_cb_battle(void);
void sub_80D823C(void);
void sub_80D833C(u8 taskId);
void sub_80D8424(u8);
void sub_80D8610(u8);
void sub_80D8490(u8);
void sub_80D8424(u8 taskId);
void sub_80D8610(u8 taskId);
void sub_80D8490(u8 taskId);
void sub_80D880C(s8);
void sub_80D883C(s8);
void sub_80D8894(u8);
void sub_80D8894(u8 taskId);
void sub_80D892C(u8 taskId);
void sub_80D895C(u8 taskId);
void sub_80D8A04(u8 taskId);
void sub_80D8A50(u8 taskId);
void sub_80D8A88(u8 taskId);
void sub_80D8B38(u8 taskId);
bool8 sub_80DA8A4(void);
u8 sub_80DB0C4(void);
u8 sub_80DB120(void);
void sub_80DB2BC(void);
void sub_80DB89C(void);
u16 sub_80DB8B8(u8);
void sub_80DB918(void);
bool8 sub_80DBCA8(u8);
void sub_80DBF68(void);
void sub_80DBF90(void);
@ -77,16 +86,20 @@ void sub_80DCE58(u8);
void sub_80DD04C(void);
void sub_80DD590(void);
void sub_80DDB0C(void);
void sub_80DDBE8(void);
bool8 sub_80DE1E8(u8);
void sub_80DE224(void);
void sub_80DE350(void);
void sub_80DE69C(u8);
void sub_80DEA20(void);
void sub_80DEBD0(u32, u8 *, u8, u8, u8);
void sub_80DEC30(u8 *, u8);
void sub_80DECB8(u8, u16, u8, u8, u8, u8, u8, u8);
bool32 sub_80DED4C(void);
void sub_80DED60(u32);
void sub_80FC9F8(u8);
bool8 AreMovesContestCombo(u16, u16);
void prints_contest_move_description(u16);
void sub_80DECB8(u8, u16, u8, u8, u8, u8, u8, u8);
EWRAM_DATA struct ContestPokemon gContestMons[4] = {0};
@ -758,3 +771,94 @@ void sub_80D883C(s8 a0)
sub_80DECB8(2, 11, 0, 31 + a0 * 2, 2, 1, 17, 1);
sub_80DECB8(2, 11, 0, 32 + a0 * 2, 2, 1, 17, 1);
}
void sub_80D8894(u8 taskId)
{
if (gIsLinkContest & 1)
{
u16 var = sub_80DB8B8(gContestPlayerMonIndex);
u8 taskId2;
gContestResources->field_4[gContestPlayerMonIndex].currMove = var;
taskId2 = CreateTask(sub_80FC9F8, 0);
SetTaskFuncWithFollowupFunc(taskId2, sub_80FC9F8, sub_80D892C);
gTasks[taskId].func = TaskDummy1;
sub_80DBF68();
sub_80DC490(FALSE);
}
else
{
sub_80DB918();
gTasks[taskId].func = sub_80D895C;
}
}
void sub_80D892C(u8 taskId)
{
DestroyTask(taskId);
gTasks[gContestResources->field_0->mainTaskId].func = sub_80D895C;
}
void sub_80D895C(u8 taskId)
{
s32 i;
sub_80DB89C();
gBattle_BG0_Y = 0;
gBattle_BG2_Y = 0;
sub_80DC490(FALSE);
for (i = 0; i < 4; i++)
{
FillWindowPixelBuffer(5 + i, 0);
PutWindowTilemap(5 + i);
CopyWindowToVram(5 + i, 2);
}
sub_80DED60(0);
DmaCopy32Defvars(3, gPlttBufferFaded, shared18000.unk18604, 0x400);
LoadPalette(shared18000.unk18204, 0, 0x400);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].func = sub_80D8A04;
}
void sub_80D8A04(u8 taskId)
{
if (++gTasks[taskId].data[0] > 2)
{
gTasks[taskId].data[0] = 0;
if (++gTasks[taskId].data[1] == 2)
{
sub_80DDBE8();
sub_80DE69C(1);
gTasks[taskId].func = sub_80D8A50;
}
}
}
void sub_80D8A50(u8 taskId)
{
if (!gContestResources->field_0->unk1920A_6 && !gContestResources->field_0->unk1920B_1)
gTasks[taskId].func = sub_80D8A88;
}
void sub_80D8A88(u8 taskId)
{
if (++gTasks[taskId].data[0] > 19)
{
gContestResources->field_0->unk19214 = 0;
gContestResources->field_0->unk1921C = gRngValue;
if ((gIsLinkContest & 1) && sub_80DA8A4())
{
s32 i;
for (i = 0; i + gUnknown_02039F30 < 4; i++)
{
gContestResources->field_4[gUnknown_02039F30 + i].currMove = sub_80DB8B8(gUnknown_02039F30 + i);
}
}
gTasks[taskId].data[0] = 0;
gTasks[taskId].func = sub_80D8B38;
}
}