through sub_80DA4F4

This commit is contained in:
PikalaxALT 2018-05-07 19:46:48 -04:00
parent e6cca15232
commit e8bb464de9
3 changed files with 216 additions and 510 deletions

View File

@ -5,509 +5,6 @@
.text
thumb_func_start sub_80DA110
sub_80DA110: @ 80DA110
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gContestResources
ldr r1, [r1]
ldr r3, [r1]
ldrb r2, [r3, 0x7]
movs r1, 0x5
negs r1, r1
ands r1, r2
strb r1, [r3, 0x7]
bl DestroyTask
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA110
thumb_func_start sub_80DA134
sub_80DA134: @ 80DA134
push {lr}
adds r1, r0, 0
ldrh r0, [r1, 0x24]
movs r3, 0x24
ldrsh r2, [r1, r3]
cmp r2, 0
beq _080DA148
subs r0, 0x2
strh r0, [r1, 0x24]
b _080DA15C
_080DA148:
ldrh r0, [r1, 0x2E]
adds r0, 0x1
strh r0, [r1, 0x2E]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1F
bne _080DA15C
strh r2, [r1, 0x2E]
ldr r0, =SpriteCallbackDummy
str r0, [r1, 0x1C]
_080DA15C:
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA134
thumb_func_start sub_80DA164
sub_80DA164: @ 80DA164
push {lr}
adds r2, r0, 0
ldrh r0, [r2, 0x24]
subs r0, 0x6
strh r0, [r2, 0x24]
movs r1, 0x20
ldrsh r0, [r2, r1]
movs r3, 0x24
ldrsh r1, [r2, r3]
adds r0, r1
movs r1, 0x20
negs r1, r1
cmp r0, r1
bge _080DA18E
ldr r0, =SpriteCallbackDummy
str r0, [r2, 0x1C]
adds r2, 0x3E
ldrb r0, [r2]
movs r1, 0x4
orrs r0, r1
strb r0, [r2]
_080DA18E:
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA164
thumb_func_start sub_80DA198
sub_80DA198: @ 80DA198
push {r4-r6,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r5, r1, r2
movs r1, 0x8
ldrsh r0, [r5, r1]
cmp r0, 0x1
beq _080DA22E
cmp r0, 0x1
bgt _080DA1C0
cmp r0, 0
beq _080DA1C6
b _080DA250
.pool
_080DA1C0:
cmp r0, 0x2
beq _080DA248
b _080DA250
_080DA1C6:
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r6, 0x1
adds r0, r6, 0
ands r0, r1
cmp r0, 0
beq _080DA224
ldr r0, =gContestResources
ldr r0, [r0]
ldr r2, [r0]
ldrb r0, [r2, 0x7]
movs r1, 0x4
orrs r0, r1
strb r0, [r2, 0x7]
bl sub_80DA8A4
lsls r0, 24
cmp r0, 0
beq _080DA1F4
bl sub_80DB944
bl sub_80DBA18
_080DA1F4:
ldr r4, =sub_80FCC88
adds r0, r4, 0
movs r1, 0
bl CreateTask
lsls r0, 24
lsrs r0, 24
ldr r2, =sub_80DA110
adds r1, r4, 0
bl SetTaskFuncWithFollowupFunc
bl sub_80DBF68
strh r6, [r5, 0x8]
b _080DA250
.pool
_080DA224:
bl sub_80DB944
bl sub_80DBA18
b _080DA23E
_080DA22E:
ldr r0, =gContestResources
ldr r0, [r0]
ldr r0, [r0]
ldrb r1, [r0, 0x7]
movs r0, 0x4
ands r0, r1
cmp r0, 0
bne _080DA250
_080DA23E:
movs r0, 0x2
strh r0, [r5, 0x8]
b _080DA250
.pool
_080DA248:
movs r0, 0
strh r0, [r5, 0x8]
ldr r0, =sub_80DA25C
str r0, [r5]
_080DA250:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA198
thumb_func_start sub_80DA25C
sub_80DA25C: @ 80DA25C
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0
bl sub_80DE008
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
movs r1, 0
strh r1, [r0, 0x8]
strh r1, [r0, 0xA]
ldr r1, =sub_80DA28C
str r1, [r0]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA25C
thumb_func_start sub_80DA28C
sub_80DA28C: @ 80DA28C
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
movs r0, 0x8
ldrsh r5, [r4, r0]
cmp r5, 0x1
beq _080DA2D2
cmp r5, 0x1
bgt _080DA2B4
cmp r5, 0
beq _080DA2BA
b _080DA312
.pool
_080DA2B4:
cmp r5, 0x2
beq _080DA304
b _080DA312
_080DA2BA:
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x14
ble _080DA312
movs r0, 0x2
bl sub_80DE69C
strh r5, [r4, 0xA]
b _080DA2F6
_080DA2D2:
ldr r0, =gContestResources
ldr r0, [r0]
ldr r0, [r0]
ldrb r1, [r0, 0x7]
movs r0, 0x2
ands r0, r1
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0
bne _080DA312
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x14
ble _080DA312
strh r1, [r4, 0xA]
_080DA2F6:
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _080DA312
.pool
_080DA304:
bl sub_80DC3AC
movs r0, 0
strh r0, [r4, 0x8]
strh r0, [r4, 0xA]
ldr r0, =sub_80DA31C
str r0, [r4]
_080DA312:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA28C
thumb_func_start sub_80DA31C
sub_80DA31C: @ 80DA31C
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_80DC3C4
lsls r0, 24
cmp r0, 0
beq _080DA33A
ldr r0, =gTasks
lsls r1, r4, 2
adds r1, r4
lsls r1, 3
adds r1, r0
ldr r0, =sub_80DA348
str r0, [r1]
_080DA33A:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA31C
thumb_func_start sub_80DA348
sub_80DA348: @ 80DA348
lsls r0, 24
lsrs r0, 24
ldr r2, =0x0201a204
ldr r3, =gPlttBufferUnfaded
ldr r1, =0x040000d4
str r2, [r1]
str r3, [r1, 0x4]
ldr r2, =0x84000100
str r2, [r1, 0x8]
ldr r1, [r1, 0x8]
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
movs r0, 0
strh r0, [r1, 0x8]
movs r0, 0x2
strh r0, [r1, 0xA]
ldr r0, =sub_80DA38C
str r0, [r1]
bx lr
.pool
thumb_func_end sub_80DA348
thumb_func_start sub_80DA38C
sub_80DA38C: @ 80DA38C
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
lsls r0, 16
asrs r0, 16
cmp r0, 0x2
ble _080DA3BE
movs r0, 0
strh r0, [r1, 0x8]
ldrh r0, [r1, 0xA]
subs r0, 0x1
strh r0, [r1, 0xA]
lsls r0, 16
cmp r0, 0
bne _080DA3BE
ldr r0, =sub_80DA3CC
str r0, [r1]
_080DA3BE:
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA38C
thumb_func_start sub_80DA3CC
sub_80DA3CC: @ 80DA3CC
push {r4-r6,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r6, r1, r2
movs r1, 0x8
ldrsh r0, [r6, r1]
cmp r0, 0
bne _080DA448
ldr r0, =gContestResources
ldr r0, [r0]
ldr r5, =gContestPlayerMonIndex
ldrb r1, [r5]
ldr r2, [r0, 0x4]
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r0, r2
ldrb r4, [r0, 0x1A]
bl sub_80DB89C
ldr r0, =gStringVar1
ldrb r1, [r5]
lsls r1, 6
ldr r2, =gContestMons + 2
adds r1, r2
bl StringCopy
ldr r5, =gStringVar4
ldr r0, =gUnknown_08587D90
lsls r4, 2
adds r4, r0
ldr r1, [r4]
adds r0, r5, 0
bl StringExpandPlaceholders
adds r0, r5, 0
movs r1, 0x1
bl sub_80DEC30
ldrh r0, [r6, 0x8]
adds r0, 0x1
strh r0, [r6, 0x8]
b _080DA45A
.pool
_080DA448:
bl sub_80DED4C
cmp r0, 0
bne _080DA45A
strh r0, [r6, 0x8]
ldr r0, =sub_80DA464
str r0, [r6]
bl sub_80DCD48
_080DA45A:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA3CC
thumb_func_start sub_80DA464
sub_80DA464: @ 80DA464
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 r1, r0, 0x1
strh r1, [r4, 0x8]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1D
ble _080DA48E
movs r0, 0
strh r0, [r4, 0x8]
bl sub_80DC3AC
ldr r0, =sub_80DA49C
str r0, [r4]
_080DA48E:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA464
thumb_func_start sub_80DA49C
sub_80DA49C: @ 80DA49C
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_80DC3C4
lsls r0, 24
cmp r0, 0
beq _080DA4BE
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
movs r1, 0
strh r1, [r0, 0x8]
ldr r1, =sub_80DA4CC
str r1, [r0]
_080DA4BE:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA49C
thumb_func_start sub_80DA4CC
sub_80DA4CC: @ 80DA4CC
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl sub_80DE224
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =sub_80DE424
str r1, [r0]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA4CC
thumb_func_start sub_80DA4F4
sub_80DA4F4: @ 80DA4F4
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl sub_80DE350
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =sub_80DA51C
str r1, [r0]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA4F4
thumb_func_start sub_80DA51C
sub_80DA51C: @ 80DA51C
push {r4,r5,lr}

View File

@ -401,11 +401,18 @@ struct ContestResources
void * field_3c;
};
extern struct ContestResources *gContestResources;
#define sContest (*gContestResources->field_0)
#define sContestantStatus (gContestResources->field_4)
#define shared192D0 (*gContestResources->field_8)
#define eContestAI (*gContestResources->field_C)
#define shared19328 (*gContestResources->field_10)
#define shared19338 (*gContestResources->field_14)
#define shared15800 (gHeap + 0x18000)
#define shared18000 (*(struct Shared18000 *)(gHeap + 0x1a000))
extern struct ContestResources *gContestResources;
extern u32 gContestRngValue;
bool8 IsSpeciesNotUnown(u16 species);

View File

@ -66,6 +66,21 @@ void sub_80D8A04(u8 taskId);
void sub_80D8A50(u8 taskId);
void sub_80D8A88(u8 taskId);
void sub_80D8B38(u8 taskId);
void sub_80DA110(u8);
void sub_80DA134(struct Sprite *);
void sub_80DA164(struct Sprite *);
void sub_80DA198(u8);
void sub_80DA25C(u8);
void sub_80DA28C(u8);
void sub_80DA31C(u8);
void sub_80DA348(u8);
void sub_80DA38C(u8);
void sub_80DA3CC(u8);
void sub_80DA464(u8);
void sub_80DA49C(u8);
void sub_80DA4CC(u8);
void sub_80DE424(u8);
void sub_80DA51C(u8);
bool8 sub_80DA8A4(void);
u8 sub_80DB0C4(void);
u8 sub_80DB120(void);
@ -104,12 +119,10 @@ void prints_contest_move_description(u16);
void sub_80DD080(u8);
void sub_80DA110(u8);
void sub_80DF080(u8);
void sub_80DF750(void);
void sub_80DE9DC(u8);
u8 sub_80DB174(u16, u32, u32, u32);
void sub_80DA134(struct Sprite *);
void sub_80DCBE8(u8, u8);
u8 sub_80DC9EC(u8);
u16 sub_80DE834(u16);
@ -130,8 +143,10 @@ void sub_80DDED0(s8, s8);
void sub_80DDCDC(s8);
void sub_80DDE0C(void);
void sub_80DD940(void);
void sub_80DA164(struct Sprite *);
void sub_80DA198(u8);
void sub_80DB944(void);
void sub_80DBA18(void);
void sub_80DC3AC(void);
bool8 sub_80DC3C4(void);
EWRAM_DATA struct ContestPokemon gContestMons[4] = {0};
EWRAM_DATA s16 gUnknown_02039F00[4] = {0};
@ -177,7 +192,7 @@ extern const u8 gUnknown_08C17170[];
extern const u16 gUnknown_08587C30[];
extern const struct BgTemplate gUnknown_08587F34[4];
extern const struct WindowTemplate gUnknown_08587F44[];
extern const u8 *const gUnknown_08587D90[];
extern const u8 *const gUnknown_08587F08[];
extern const u8 *const gUnknown_08587F1C[];
extern const u8 gText_0827D55A[];
@ -1617,3 +1632,190 @@ void sub_80D8B38(u8 taskId)
return;
}
}
void sub_80DA110(u8 taskId)
{
sContest.unk1920B_2 = 0;
DestroyTask(taskId);
}
void sub_80DA134(struct Sprite *sprite)
{
if (sprite->pos2.x != 0)
{
sprite->pos2.x -= 2;
}
else
{
if (++sprite->data[0] == 31)
{
sprite->data[0] = 0;
sprite->callback = SpriteCallbackDummy;
}
}
}
void sub_80DA164(struct Sprite *sprite)
{
sprite->pos2.x -= 6;
if (sprite->pos1.x + sprite->pos2.x < -32)
{
sprite->callback = SpriteCallbackDummy;
sprite->invisible = TRUE;
}
}
void sub_80DA198(u8 taskId)
{
switch (gTasks[taskId].data[0])
{
case 0:
if (gIsLinkContest & 1)
{
u8 taskId2;
sContest.unk1920B_2 = 1;
if (sub_80DA8A4())
{
sub_80DB944();
sub_80DBA18();
}
taskId2 = CreateTask(sub_80FCC88, 0);
SetTaskFuncWithFollowupFunc(taskId2, sub_80FCC88, sub_80DA110);
sub_80DBF68();
gTasks[taskId].data[0] = 1;
}
else
{
sub_80DB944();
sub_80DBA18();
gTasks[taskId].data[0] = 2;
}
break;
case 1:
if (!sContest.unk1920B_2)
gTasks[taskId].data[0] = 2;
break;
case 2:
gTasks[taskId].data[0] = 0;
gTasks[taskId].func = sub_80DA25C;
break;
}
}
void sub_80DA25C(u8 taskId)
{
sub_80DE008(FALSE);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].func = sub_80DA28C;
}
void sub_80DA28C(u8 taskId)
{
switch (gTasks[taskId].data[0])
{
case 0:
if (++gTasks[taskId].data[1] > 20)
{
sub_80DE69C(2);
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++;
}
break;
case 1:
if (!sContest.unk1920B_1)
{
if (++gTasks[taskId].data[1] > 20)
{
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++;
}
}
break;
case 2:
sub_80DC3AC();
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].func = sub_80DA31C;
break;
}
}
void sub_80DA31C(u8 taskId)
{
if (sub_80DC3C4())
gTasks[taskId].func = sub_80DA348;
}
void sub_80DA348(u8 taskId)
{
DmaCopy32Defvars(3, shared18000.unk18204, gPlttBufferUnfaded, 0x400);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 2;
gTasks[taskId].func = sub_80DA38C;
}
void sub_80DA38C(u8 taskId)
{
if (++gTasks[taskId].data[0] > 2)
{
gTasks[taskId].data[0] = 0;
if (--gTasks[taskId].data[1] == 0)
gTasks[taskId].func = sub_80DA3CC;
}
}
void sub_80DA3CC(u8 taskId)
{
if (gTasks[taskId].data[0] == 0)
{
u8 r4 = sContestantStatus[gContestPlayerMonIndex].attentionLevel;
sub_80DB89C();
StringCopy(gStringVar1, gContestMons[gContestPlayerMonIndex].nickname);
StringExpandPlaceholders(gStringVar4, gUnknown_08587D90[r4]);
sub_80DEC30(gStringVar4, 1);
gTasks[taskId].data[0]++;
}
else
{
if (!sub_80DED4C())
{
gTasks[taskId].data[0] = 0;
gTasks[taskId].func = sub_80DA464;
sub_80DCD48();
}
}
}
void sub_80DA464(u8 taskId)
{
if (gTasks[taskId].data[0]++ > 29)
{
gTasks[taskId].data[0] = 0;
sub_80DC3AC();
gTasks[taskId].func = sub_80DA49C;
}
}
void sub_80DA49C(u8 taskId)
{
if (sub_80DC3C4())
{
gTasks[taskId].data[0] = 0;
gTasks[taskId].func = sub_80DA4CC;
}
}
void sub_80DA4CC(u8 taskId)
{
sub_80DE224();
gTasks[taskId].func = sub_80DE424;
}
void sub_80DA4F4(u8 taskId)
{
sub_80DE350();
gTasks[taskId].func = sub_80DA51C;
}