through sub_80DA874

This commit is contained in:
PikalaxALT 2018-05-07 20:49:23 -04:00
parent e8bb464de9
commit f6fbecbc41
4 changed files with 147 additions and 384 deletions

View File

@ -5,388 +5,6 @@
.text .text
thumb_func_start sub_80DA51C
sub_80DA51C: @ 80DA51C
push {r4,r5,lr}
sub sp, 0x4
lsls r0, 24
lsrs r5, r0, 24
movs r0, 0x8
bl GetGpuReg
mov r1, sp
strh r0, [r1]
movs r0, 0xC
bl GetGpuReg
mov r4, sp
adds r4, 0x2
strh r0, [r4]
mov r3, sp
ldrb r2, [r3]
movs r1, 0x4
negs r1, r1
adds r0, r1, 0
ands r0, r2
strb r0, [r3]
ldrb r0, [r4]
ands r1, r0
strb r1, [r4]
mov r0, sp
ldrh r1, [r0]
movs r0, 0x8
bl SetGpuReg
ldrh r1, [r4]
movs r0, 0xC
bl SetGpuReg
ldr r2, =gContestResources
ldr r0, [r2]
ldr r1, [r0]
ldrb r0, [r1, 0x1]
adds r0, 0x1
strb r0, [r1, 0x1]
ldr r0, [r2]
ldr r0, [r0]
ldrb r0, [r0, 0x1]
cmp r0, 0x5
bne _080DA590
ldr r0, =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
ldr r0, =sub_80DA5E8
b _080DA5A0
.pool
_080DA590:
bl sub_80DDB0C
ldr r0, =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
ldr r0, =sub_80DA5B4
_080DA5A0:
str r0, [r1]
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA51C
thumb_func_start sub_80DA5B4
sub_80DA5B4: @ 80DA5B4
push {lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gContestResources
ldr r0, [r0]
ldr r0, [r0]
ldrb r1, [r0, 0x6]
movs r0, 0x40
ands r0, r1
cmp r0, 0
bne _080DA5D8
ldr r0, =gTasks
lsls r1, r2, 2
adds r1, r2
lsls r1, 3
adds r1, r0
ldr r0, =sub_80D833C
str r0, [r1]
_080DA5D8:
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA5B4
thumb_func_start sub_80DA5E8
sub_80DA5E8: @ 80DA5E8
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gBattle_BG0_Y
movs r1, 0
strh r1, [r0]
ldr r0, =gBattle_BG2_Y
strh r1, [r0]
ldr r4, =gContestResources
movs r3, 0
ldr r2, =gUnknown_02039F10
movs r1, 0x3
_080DA600:
ldr r0, [r4]
ldr r0, [r0, 0x4]
adds r0, r3, r0
ldrh r0, [r0, 0x4]
strh r0, [r2]
adds r3, 0x1C
adds r2, 0x2
subs r1, 0x1
cmp r1, 0
bge _080DA600
bl sub_80DBD18
bl sub_80DB89C
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
cmp r0, 0
bne _080DA65C
ldr r0, =gContestResources
ldr r2, [r0]
ldr r0, =gContestPlayerMonIndex
ldrb r1, [r0]
ldr r2, [r2, 0x4]
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r0, r2
ldrh r0, [r0, 0x8]
bl BravoTrainerPokemonProfile_BeforeInterview1
b _080DA668
.pool
_080DA65C:
bl sub_80DF250
bl sub_80DF4F8
bl sub_80DF750
_080DA668:
ldr r1, =gContestRngValue
ldr r0, =gRngValue
ldr r0, [r0]
str r0, [r1]
ldr r4, =gStringVar4
ldr r1, =gText_0827D597
adds r0, r4, 0
bl StringExpandPlaceholders
adds r0, r4, 0
movs r1, 0x1
bl sub_80DEC30
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
movs r1, 0
strh r1, [r0, 0xC]
ldr r1, =sub_80DA6B4
str r1, [r0]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA5E8
thumb_func_start sub_80DA6B4
sub_80DA6B4: @ 80DA6B4
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
bl sub_80DED4C
adds r4, r0, 0
cmp r4, 0
bne _080DA6EA
bl sub_80DE224
ldr r0, =gBattle_BG1_X
strh r4, [r0]
ldr r1, =gBattle_BG1_Y
movs r0, 0xA0
strh r0, [r1]
movs r0, 0x62
movs r1, 0
bl PlaySE12WithPanning
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
strh r4, [r0, 0x8]
ldr r1, =sub_80DA700
str r1, [r0]
_080DA6EA:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA6B4
thumb_func_start sub_80DA700
sub_80DA700: @ 80DA700
push {lr}
lsls r0, 24
lsrs r3, r0, 24
ldr r1, =gBattle_BG1_Y
ldrh r0, [r1]
subs r0, 0x7
strh r0, [r1]
lsls r0, 16
cmp r0, 0
bge _080DA718
movs r0, 0
strh r0, [r1]
_080DA718:
ldrh r2, [r1]
cmp r2, 0
bne _080DA72E
ldr r0, =gTasks
lsls r1, r3, 2
adds r1, r3
lsls r1, 3
adds r1, r0
ldr r0, =sub_80DA740
str r0, [r1]
strh r2, [r1, 0x8]
_080DA72E:
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA700
thumb_func_start sub_80DA740
sub_80DA740: @ 80DA740
push {r4,lr}
sub sp, 0x4
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, 0x31
ble _080DA794
movs r0, 0
strh r0, [r4, 0x8]
ldr r0, =gIsLinkContest
ldrb r0, [r0]
movs r1, 0x1
ands r1, r0
cmp r1, 0
beq _080DA780
ldr r0, =sub_80DA7A0
b _080DA792
.pool
_080DA780:
movs r0, 0x1
negs r0, r0
str r1, [sp]
movs r1, 0
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
ldr r0, =sub_80DA830
_080DA792:
str r0, [r4]
_080DA794:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA740
thumb_func_start sub_80DA7A0
sub_80DA7A0: @ 80DA7A0
push {r4,r5,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r5, =sub_80FCACC
adds r0, r5, 0
movs r1, 0
bl CreateTask
lsls r0, 24
lsrs r0, 24
ldr r2, =sub_80DA7EC
adds r1, r5, 0
bl SetTaskFuncWithFollowupFunc
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =TaskDummy1
str r1, [r0]
bl sub_80DBF68
movs r0, 0
bl sub_80DC490
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA7A0
thumb_func_start sub_80DA7EC
sub_80DA7EC: @ 80DA7EC
push {lr}
sub sp, 0x4
lsls r0, 24
lsrs r0, 24
bl DestroyTask
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
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_80DA830
str r1, [r0]
add sp, 0x4
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA7EC
thumb_func_start sub_80DA830
sub_80DA830: @ 80DA830
push {lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _080DA860
adds r0, r2, 0
bl DestroyTask
ldr r0, =gFieldCallback
ldr r1, =sub_80DA874
str r1, [r0]
bl FreeAllWindowBuffers
bl sub_80D7A5C
bl FreeMonSpritesGfx
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
_080DA860:
pop {r0}
bx r0
.pool
thumb_func_end sub_80DA830
thumb_func_start sub_80DA874
sub_80DA874: @ 80DA874
push {lr}
bl ScriptContext2_Disable
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80DA874
thumb_func_start sub_80DA884 thumb_func_start sub_80DA884
sub_80DA884: @ 80DA884 sub_80DA884: @ 80DA884
push {lr} push {lr}

View File

@ -3,5 +3,6 @@
void sub_80FCC88(u8); void sub_80FCC88(u8);
void sub_80FCC88(u8); void sub_80FCC88(u8);
void sub_80FCACC(u8);
#endif //GUARD_CONTEST_LINK_80FC4F4_H #endif //GUARD_CONTEST_LINK_80FC4F4_H

View File

@ -45,5 +45,6 @@ void PutPokemonTodayCaughtOnAir(void);
void TV_PutSecretBaseVisitOnTheAir(void); void TV_PutSecretBaseVisitOnTheAir(void);
bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language); bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language);
void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent); void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent);
void BravoTrainerPokemonProfile_BeforeInterview1(u16 move);
#endif //GUARD_TV_H #endif //GUARD_TV_H

View File

@ -42,6 +42,8 @@
free(ptr); \ free(ptr); \
ptr = NULL; ptr = NULL;
extern void (*gFieldCallback)(void);
void sub_80D782C(void); void sub_80D782C(void);
void sub_80D7C7C(u8 taskId); void sub_80D7C7C(u8 taskId);
void sub_80D7CB4(u8 taskId); void sub_80D7CB4(u8 taskId);
@ -79,8 +81,17 @@ void sub_80DA3CC(u8);
void sub_80DA464(u8); void sub_80DA464(u8);
void sub_80DA49C(u8); void sub_80DA49C(u8);
void sub_80DA4CC(u8); void sub_80DA4CC(u8);
void sub_80DE424(u8);
void sub_80DA51C(u8); void sub_80DA51C(u8);
void sub_80DA5B4(u8);
void sub_80DA5E8(u8);
void sub_80DA6B4(u8);
void sub_80DA700(u8);
void sub_80DA740(u8);
void sub_80DA7A0(u8);
void sub_80DA7EC(u8);
void sub_80DA830(u8);
void sub_80DA874(void);
void sub_80DE424(u8);
bool8 sub_80DA8A4(void); bool8 sub_80DA8A4(void);
u8 sub_80DB0C4(void); u8 sub_80DB0C4(void);
u8 sub_80DB120(void); u8 sub_80DB120(void);
@ -116,7 +127,9 @@ void sub_80DED60(u32);
void sub_80FC9F8(u8); void sub_80FC9F8(u8);
bool8 AreMovesContestCombo(u16, u16); bool8 AreMovesContestCombo(u16, u16);
void prints_contest_move_description(u16); void prints_contest_move_description(u16);
void sub_80DBD18(void);
void sub_80DF250(void);
void sub_80DF4F8(void);
void sub_80DD080(u8); void sub_80DD080(u8);
void sub_80DF080(u8); void sub_80DF080(u8);
@ -209,6 +222,7 @@ extern const u8 gText_0827E7EA[];
extern const u8 gText_0827E817[]; extern const u8 gText_0827E817[];
extern const u8 gText_0827E58A[]; extern const u8 gText_0827E58A[];
extern const u8 gText_0827D56F[]; extern const u8 gText_0827D56F[];
extern const u8 gText_0827D597[];
void TaskDummy1(u8 taskId) void TaskDummy1(u8 taskId)
@ -1819,3 +1833,132 @@ void sub_80DA4F4(u8 taskId)
sub_80DE350(); sub_80DE350();
gTasks[taskId].func = sub_80DA51C; gTasks[taskId].func = sub_80DA51C;
} }
void sub_80DA51C(u8 taskId)
{
vu16 sp0 = GetGpuReg(REG_OFFSET_BG0CNT);
vu16 sp2 = GetGpuReg(REG_OFFSET_BG2CNT);
((vBgCnt *)&sp0)->priority = 0;
((vBgCnt *)&sp2)->priority = 0;
SetGpuReg(REG_OFFSET_BG0CNT, sp0);
SetGpuReg(REG_OFFSET_BG2CNT, sp2);
sContest.turnNumber++;
if (sContest.turnNumber == 5)
{
gTasks[taskId].func = sub_80DA5E8;
}
else
{
sub_80DDB0C();
gTasks[taskId].func = sub_80DA5B4;
}
}
void sub_80DA5B4(u8 taskId)
{
if (!sContest.unk1920A_6)
gTasks[taskId].func = sub_80D833C;
}
void sub_80DA5E8(u8 taskId)
{
s32 i;
gBattle_BG0_Y = 0;
gBattle_BG2_Y = 0;
for (i = 0; i < 4; i++)
gUnknown_02039F10[i] = sContestantStatus[i].unk4;
sub_80DBD18();
sub_80DB89C();
if (!(gIsLinkContest & 1))
BravoTrainerPokemonProfile_BeforeInterview1(sContestantStatus[gContestPlayerMonIndex].prevMove);
else
{
sub_80DF250();
sub_80DF4F8();
sub_80DF750();
}
gContestRngValue = gRngValue;
StringExpandPlaceholders(gStringVar4, gText_0827D597);
sub_80DEC30(gStringVar4, 1);
gTasks[taskId].data[2] = 0;
gTasks[taskId].func = sub_80DA6B4;
}
void sub_80DA6B4(u8 taskId)
{
if (!sub_80DED4C())
{
sub_80DE224();
gBattle_BG1_X = 0;
gBattle_BG1_Y = 160;
PlaySE12WithPanning(SE_C_MAKU_D, 0);
gTasks[taskId].data[0] = 0;
gTasks[taskId].func = sub_80DA700;
}
}
void sub_80DA700(u8 taskId)
{
gBattle_BG1_Y -= 7;
if (gBattle_BG1_Y < 0)
gBattle_BG1_Y = 0;
if (*(u16 *)&gBattle_BG1_Y == 0) // Why cast?
{
gTasks[taskId].func = sub_80DA740;
gTasks[taskId].data[0] = 0;
}
}
void sub_80DA740(u8 taskId)
{
if (gTasks[taskId].data[0]++ >= 50)
{
gTasks[taskId].data[0] = 0;
if (gIsLinkContest & 1)
{
gTasks[taskId].func = sub_80DA7A0;
}
else
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
gTasks[taskId].func = sub_80DA830;
}
}
}
void sub_80DA7A0(u8 taskId)
{
u8 taskId2 = CreateTask(sub_80FCACC, 0);
SetTaskFuncWithFollowupFunc(taskId2, sub_80FCACC, sub_80DA7EC);
gTasks[taskId].func = TaskDummy1;
sub_80DBF68();
sub_80DC490(FALSE);
}
void sub_80DA7EC(u8 taskId)
{
DestroyTask(taskId);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
gTasks[sContest.mainTaskId].func = sub_80DA830;
}
void sub_80DA830(u8 taskId)
{
if (!gPaletteFade.active)
{
DestroyTask(taskId);
gFieldCallback = sub_80DA874;
FreeAllWindowBuffers();
sub_80D7A5C();
FreeMonSpritesGfx();
SetMainCallback2(CB2_ReturnToField);
}
}
void sub_80DA874(void)
{
ScriptContext2_Disable();
EnableBothScriptContexts();
}