Merge branch 'master' into modern_gcc

This commit is contained in:
PikalaxALT 2019-07-20 11:51:22 -04:00
commit 8d0d5cfd55
11 changed files with 785 additions and 2017 deletions

View File

@ -5,438 +5,8 @@
.text
thumb_func_start sub_80216E0
sub_80216E0: @ 80216E0
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x10
adds r6, r0, 0
str r1, [sp]
movs r0, 0
str r0, [sp, 0x4]
movs r1, 0x4E
adds r1, r6
mov r10, r1
mov r9, r0
ldrb r2, [r6, 0x9]
cmp r0, r2
bcs _080217AE
ldr r7, =gUnknown_082F41CC
_08021704:
mov r3, r10
ldrh r0, [r3, 0xA]
mov r4, r9
lsls r1, r4, 1
add r1, r9
asrs r0, r1
lsls r0, 16
movs r1, 0xE0
lsls r1, 11
ands r1, r0
lsrs r1, 16
mov r8, r1
cmp r1, 0
beq _0802179E
ldr r0, [sp, 0x4]
adds r0, 0x1
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x4]
movs r0, 0x4
ands r0, r1
cmp r0, 0
beq _08021748
lsls r4, 2
ldr r5, [sp]
adds r5, 0x24
adds r0, r5, r4
ldr r0, [r0]
movs r1, 0x1
bl StartSpriteAnim
b _0802175A
.pool
_08021748:
mov r0, r9
lsls r4, r0, 2
ldr r5, [sp]
adds r5, 0x24
adds r0, r5, r4
ldr r0, [r0]
movs r1, 0
bl StartSpriteAnim
_0802175A:
adds r3, r5, r4
ldr r2, [r3]
adds r2, 0x3E
ldrb r0, [r2]
movs r4, 0x5
negs r4, r4
adds r1, r4, 0
ands r0, r1
strb r0, [r2]
ldr r2, [r3]
adds r2, 0x2C
ldrb r0, [r2]
subs r4, 0x3C
adds r1, r4, 0
ands r0, r1
strb r0, [r2]
ldr r2, [r3]
movs r0, 0x3
mov r1, r8
ands r1, r0
mov r8, r1
subs r1, 0x1
lsls r1, 1
adds r0, r1, r7
ldrb r0, [r0]
lsls r0, 24
asrs r0, 24
strh r0, [r2, 0x24]
ldr r2, [r3]
ldr r3, =gUnknown_082F41CC+1
adds r1, r3
movs r0, 0
ldrsb r0, [r1, r0]
strh r0, [r2, 0x26]
_0802179E:
mov r0, r9
adds r0, 0x1
lsls r0, 24
lsrs r0, 24
mov r9, r0
ldrb r4, [r6, 0x9]
cmp r9, r4
bcc _08021704
_080217AE:
ldr r0, [sp, 0x4]
cmp r0, 0
bne _080217C0
adds r2, r6, 0
adds r2, 0x25
ldrb r1, [r2]
b _0802189C
.pool
_080217C0:
ldrh r0, [r6, 0x28]
movs r1, 0x3
bl __umodsi3
lsls r0, 24
lsrs r0, 24
mov r8, r0
mov r1, r8
str r1, [sp, 0x8]
movs r2, 0
mov r9, r2
mov r3, r10
ldrh r1, [r3, 0xC]
lsls r0, r1, 1
adds r0, 0x3
adds r6, 0x25
str r6, [sp, 0xC]
adds r3, r1, 0
cmp r9, r0
bge _08021890
_080217E8:
mov r4, r9
lsls r1, r4, 2
ldr r0, [sp]
adds r0, 0x4C
adds r7, r0, r1
ldr r2, [r7]
adds r0, r2, 0
adds r0, 0x3E
ldrb r1, [r0]
movs r0, 0x4
ands r0, r1
cmp r0, 0
beq _0802187E
ldr r0, =sub_8022B28
str r0, [r2, 0x1C]
lsls r1, r4, 1
ldr r3, =gUnknown_082F41CC+6
adds r0, r1, r3
movs r4, 0
ldrsb r4, [r0, r4]
adds r0, r4, 0
adds r0, 0x78
strh r0, [r2, 0x20]
ldr r2, [r7]
ldr r0, =gUnknown_082F41CC+7
adds r1, r0
movs r6, 0
ldrsb r6, [r1, r6]
mov r1, r8
lsls r0, r1, 2
subs r0, 0x88
subs r0, r6, r0
strh r0, [r2, 0x22]
ldr r5, [r7]
ldr r2, [sp, 0x8]
lsls r1, r2, 2
adds r0, r4, 0
bl __divsi3
adds r4, r0
strh r4, [r5, 0x24]
ldr r0, [r7]
strh r6, [r0, 0x26]
mov r3, r10
ldrb r1, [r3, 0x4]
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _08021860
ldr r0, [r7]
movs r1, 0x1
bl StartSpriteAnim
b _08021868
.pool
_08021860:
ldr r0, [r7]
movs r1, 0
bl StartSpriteAnim
_08021868:
mov r0, r8
adds r0, 0x1
lsls r0, 16
lsrs r0, 16
mov r8, r0
mov r4, r10
ldrh r3, [r4, 0xC]
cmp r0, 0x3
bls _0802187E
movs r0, 0
mov r8, r0
_0802187E:
mov r0, r9
adds r0, 0x1
lsls r0, 24
lsrs r0, 24
mov r9, r0
lsls r0, r3, 1
adds r0, 0x3
cmp r9, r0
blt _080217E8
_08021890:
ldr r2, [sp, 0xC]
ldrb r1, [r2]
movs r0, 0x4
ands r0, r1
cmp r0, 0
beq _080218A6
_0802189C:
movs r0, 0x5
negs r0, r0
ands r0, r1
strb r0, [r2]
b _080218C4
_080218A6:
ldr r3, [sp, 0x4]
cmp r3, 0x1
bne _080218B4
movs r0, 0x4E
bl PlaySE
b _080218BA
_080218B4:
movs r0, 0x4D
bl PlaySE
_080218BA:
ldr r4, [sp, 0xC]
ldrb r0, [r4]
movs r1, 0x4
orrs r0, r1
strb r0, [r4]
_080218C4:
add sp, 0x10
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_80216E0
thumb_func_start sub_80218D4
sub_80218D4: @ 80218D4
push {r4-r7,lr}
adds r5, r0, 0
adds r6, r1, 0
movs r2, 0
ldrb r0, [r5, 0x9]
cmp r2, r0
bcs _08021906
adds r4, r6, 0
adds r4, 0x24
movs r7, 0x4
adds r3, r0, 0
_080218EA:
lsls r0, r2, 2
adds r0, r4, r0
ldr r0, [r0]
adds r0, 0x3E
ldrb r1, [r0]
adds r0, r7, 0
ands r0, r1
cmp r0, 0
beq _08021920
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, r3
bcc _080218EA
_08021906:
movs r2, 0
adds r3, r6, 0
adds r3, 0x4C
movs r4, 0x4
_0802190E:
lsls r0, r2, 2
adds r0, r3, r0
ldr r0, [r0]
adds r0, 0x3E
ldrb r1, [r0]
adds r0, r4, 0
ands r0, r1
cmp r0, 0
bne _08021924
_08021920:
movs r0, 0
b _0802193C
_08021924:
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0xA
bls _0802190E
movs r1, 0x2C
ldrsh r0, [r5, r1]
cmp r0, 0
beq _0802193A
movs r0, 0
strh r0, [r5, 0x2C]
_0802193A:
movs r0, 0x1
_0802193C:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_80218D4
thumb_func_start sub_8021944
sub_8021944: @ 8021944
push {r4-r7,lr}
adds r6, r0, 0
lsls r4, r1, 16
lsrs r4, 16
movs r7, 0
movs r5, 0xE1
lsls r5, 4
adds r0, r4, 0
adds r1, r5, 0
bl __udivsi3
strh r0, [r6, 0x4]
adds r0, r4, 0
adds r1, r5, 0
bl __umodsi3
lsls r0, 16
lsrs r0, 16
movs r1, 0x3C
bl __udivsi3
strh r0, [r6, 0x6]
adds r0, r4, 0
movs r1, 0x3C
bl __umodsi3
lsls r0, 24
asrs r0, 16
movs r1, 0x4
bl sub_8151534
adds r2, r7, 0
lsls r0, 16
asrs r3, r0, 16
movs r0, 0x7
mov r12, r0
ldr r5, =gUnknown_082F334C
movs r4, 0x1
_08021990:
mov r0, r12
subs r1, r0, r2
adds r0, r3, 0
asrs r0, r1
ands r0, r4
cmp r0, 0
beq _080219A6
lsls r0, r2, 2
adds r0, r5
ldr r0, [r0]
adds r7, r0
_080219A6:
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x7
bls _08021990
ldr r1, =0x000f4240
adds r0, r7, 0
bl __udivsi3
strh r0, [r6, 0x8]
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8021944
thumb_func_start sub_80219C8
sub_80219C8: @ 80219C8
push {r4-r6,lr}
mov r6, r8
push {r6}
sub sp, 0xC
adds r6, r0, 0
adds r4, r1, 0
adds r5, r2, 0
mov r8, r3
lsls r6, 24
lsrs r6, 24
lsls r4, 24
lsrs r4, 24
lsls r5, 24
lsrs r5, 24
movs r2, 0x1
negs r2, r2
movs r0, 0x2
mov r1, r8
bl GetStringWidth
lsls r4, 2
lsrs r0, 1
subs r4, r0
lsls r4, 24
lsrs r4, 24
lsls r0, r5, 1
adds r0, r5
ldr r1, =gUnknown_082F32D8
adds r0, r1
str r0, [sp]
movs r0, 0
str r0, [sp, 0x4]
mov r0, r8
str r0, [sp, 0x8]
adds r0, r6, 0
movs r1, 0x2
adds r2, r4, 0
movs r3, 0
bl AddTextPrinterParameterized3
add sp, 0xC
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_80219C8
thumb_func_start sub_8021A28
sub_8021A28: @ 8021A28

File diff suppressed because it is too large Load Diff

View File

@ -82,4 +82,7 @@
#define NUM_STATS 6
#define NUM_BATTLE_STATS 8
// Shiny odds
#define SHINY_ODDS 8 // Actual probability is SHINY_ODDS/65536
#endif // GUARD_CONSTANTS_POKEMON_H

View File

@ -3,7 +3,7 @@
#include "main.h"
void sub_802EB24(u8, u8, u8, u8, u8);
void sub_802EB24(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4);
bool32 sub_802EB84(void);
void sub_802A9A8(u16 monId, MainCallback callback);
bool32 sub_802C908(u16 species);

View File

@ -2707,6 +2707,14 @@ extern const u8 gText_Symbols[];
extern const u8 gText_Register2[];
extern const u8 gText_Exit2[];
// Pokemon jump
extern const u8 gText_WantToPlayAgain2[];
extern const u8 gText_SomeoneDroppedOut2[];
extern const u8 gText_CommunicationStandby4[];
extern const u8 gText_AwesomeWonF701F700[];
extern const u8 gText_FilledStorageSpace2[];
extern const u8 gText_CantHoldMore[];
// Pokenav Match Call
extern const u8 gText_CallCantBeMadeHere[];
extern const u8 gText_NumberRegistered[];

View File

@ -3,6 +3,12 @@ ENTRY(Start)
gNumMusicPlayers = 4;
gMaxLines = 0;
/* Modify the following load addresses as needed to make more room. Alternately, delete both the
declarations below and their references further down to get rid of the gaps. */
__anim_mon_load_address = 0x8b00000;
__gfx_load_address = 0x8c00000;
SECTIONS {
. = 0x2000000;
@ -1237,27 +1243,13 @@ SECTIONS {
data/multiboot_pokemon_colosseum.o(.rodata);
} =0
gap1 :
{
gap1_start = ABSOLUTE(.);
BYTE(0x00)
. = 0x8B00000 - gap1_start;
} =0
anim_mon_front_pic_data :
anim_mon_front_pic_data __anim_mon_load_address :
ALIGN(4)
{
src/anim_mon_front_pics.o(.rodata);
} =0
gap2 :
{
gap2_start = ABSOLUTE(.);
BYTE(0x00)
. = 0x8C00000 - gap2_start;
} =0
gfx_data :
gfx_data __gfx_load_address :
ALIGN(4)
{
src/graphics.o(.rodata);

View File

@ -2029,7 +2029,7 @@ void sub_8172EF0(u8 battler, struct Pokemon *mon)
if (IsBattlerSpriteVisible(battler))
{
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
if (shinyValue < 8)
if (shinyValue < SHINY_ODDS)
isShiny = TRUE;
if (isShiny)

View File

@ -55,7 +55,10 @@ struct BerryCrushGame_138_C
struct BerryCrushGame_138
{
u8 filler0[0xC];
u8 filler0[0x4];
u16 unk4;
u16 unk6;
u16 unk8;
struct BerryCrushGame_138_C *unkC[5];
u8 filler1C[0x4];
struct Sprite *unk24[5];
@ -105,7 +108,7 @@ struct BerryCrushGame
u8 filler26[0x2];
u16 unk28;
u16 unk2A;
u16 unk2C;
s16 unk2C;
u8 filler2E[0x8];
u8 unk36[0xA];
struct BerryCrushGame_40 unk40;
@ -149,6 +152,8 @@ extern const struct SpriteTemplate gUnknown_082F436C;
extern const u16 gUnknown_082F41E8[];
extern const s8 gUnknown_082F41CC[][2];
extern const s8 gUnknown_082F41D2[][2];
extern const u32 gUnknown_082F334C[];
extern const u8 gUnknown_082F32D8[][3];
struct BerryCrushGame *sub_8020C00(void)
{
@ -700,76 +705,121 @@ void sub_80216A8(struct BerryCrushGame *arg0)
}
}
// void sub_80216E0(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1)
// {
// u8 sp4;
// struct BerryCrushGame_4E *var4E;
// u8 i;
// u16 var0;
void sub_80216E0(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1)
{
u8 sp4;
struct BerryCrushGame_4E *var4E;
u8 i;
u16 var, var2;
// sp4 = 0;
// var4E = &arg0->unk40.unkE;
// for (i = 0; i < arg0->unk9; i++)
// {
// var0 = var4E->unkA >> (i * 3);
// var0 &= 7;
// if (var0)
// {
// int offset;
// sp4++;
// if (var0 & 0x4)
// StartSpriteAnim(arg1->unk24[i], 1);
// else
// StartSpriteAnim(arg1->unk24[i], 0);
sp4 = 0;
var4E = &arg0->unk40.unkE;
for (i = 0; i < arg0->unk9; i++)
{
var = var4E->unkA >> (i * 3);
var &= 7;
if (var)
{
sp4++;
if (var & 0x4)
StartSpriteAnim(arg1->unk24[i], 1);
else
StartSpriteAnim(arg1->unk24[i], 0);
// arg1->unk24[i]->invisible = 0;
// arg1->unk24[i]->animPaused = 0;
// offset = (var0 % 4) - 1;
// arg1->unk24[i]->pos2.x = gUnknown_082F41CC[offset][0];
// arg1->unk24[i]->pos2.y = gUnknown_082F41CC[offset][1];
// }
// }
arg1->unk24[i]->invisible = 0;
arg1->unk24[i]->animPaused = 0;
arg1->unk24[i]->pos2.x = gUnknown_082F41CC[(var % 4) - 1][0];
arg1->unk24[i]->pos2.y = gUnknown_082F41CC[(var % 4) - 1][1];
}
}
// if (sp4 == 0)
// {
// arg0->unk25_2 = 0;
// }
// else
// {
// u8 var3 = arg0->unk28 % 3;
// u16 var2 = var3;
// for (i = 0; i < var4E->unkC * 2 + 3; i++)
// {
// if (arg1->unk4C[i]->invisible)
// {
// arg1->unk4C[i]->callback = sub_8022B28;
// arg1->unk4C[i]->pos1.x = gUnknown_082F41D2[i][0] + 120;
// arg1->unk4C[i]->pos1.y = gUnknown_082F41D2[i][1] + (136 - var2 * 4);
// arg1->unk4C[i]->pos2.x = gUnknown_082F41D2[i][0] / (var3 * 4);
// arg1->unk4C[i]->pos2.y = gUnknown_082F41D2[i][1];
// if (var4E->unk4 & 0x2)
// StartSpriteAnim(arg1->unk4C[i], 1);
// else
// StartSpriteAnim(arg1->unk4C[i], 0);
if (sp4 == 0)
{
arg0->unk25_2 = 0;
}
else
{
var = (u8)(arg0->unk28 % 3);
var2 = var;
for (i = 0; i < var4E->unkC * 2 + 3; i++)
{
if (arg1->unk4C[i]->invisible)
{
arg1->unk4C[i]->callback = sub_8022B28;
arg1->unk4C[i]->pos1.x = gUnknown_082F41D2[i][0] + 120;
arg1->unk4C[i]->pos1.y = gUnknown_082F41D2[i][1] + 136 - (var * 4);
arg1->unk4C[i]->pos2.x = gUnknown_082F41D2[i][0] + (gUnknown_082F41D2[i][0] / (var2 * 4));
arg1->unk4C[i]->pos2.y = gUnknown_082F41D2[i][1];
if (var4E->unk4 & 0x2)
StartSpriteAnim(arg1->unk4C[i], 1);
else
StartSpriteAnim(arg1->unk4C[i], 0);
// var2++;
// if (var2 > 3)
// var2 = 0;
// }
// }
var++;
if (var > 3)
var = 0;
}
}
// if (arg0->unk25_2)
// {
// arg0->unk25_2 = 0;
// }
// else
// {
// if (sp4 == 1)
// PlaySE(SE_TOY_DANGO);
// else
// PlaySE(SE_TOY_KABE);
if (arg0->unk25_2)
{
arg0->unk25_2 = 0;
}
else
{
if (sp4 == 1)
PlaySE(SE_TOY_DANGO);
else
PlaySE(SE_TOY_KABE);
// arg0->unk25_2 = 1;
// }
// }
// }
arg0->unk25_2 = 1;
}
}
}
bool32 sub_80218D4(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1)
{
u8 i;
for (i = 0; i < arg0->unk9; i++)
{
if (!arg1->unk24[i]->invisible)
return FALSE;
}
for (i = 0; i < 11; i++)
{
if (!arg1->unk4C[i]->invisible)
return FALSE;
}
if (arg0->unk2C != 0)
arg0->unk2C = 0;
return TRUE;
}
void sub_8021944(struct BerryCrushGame_138 *arg0, u16 arg1)
{
u8 i = 0;
u32 r7 = 0;
s16 r3 = 0;
arg0->unk4 = arg1 / 3600;
arg0->unk6 = (arg1 % 3600) / 60;
r3 = sub_8151534((arg1 % 60) << 8, 4);
for (i = 0; i < 8; i++)
{
if ((r3 >> (7 - i)) & 1)
r7 += gUnknown_082F334C[i];
}
arg0->unk8 = r7 / 1000000;
}
void sub_80219C8(u8 windowId, u8 left, u8 colorId, const u8 *string)
{
left = (left * 4) - (GetStringWidth(2, string, -1) / 2u);
AddTextPrinterParameterized3(windowId, 2, left, 0, gUnknown_082F32D8[colorId], 0, string);
}

View File

@ -81,7 +81,7 @@ void TaskCloseBagMenu_2(u8);
u8 AddItemMessageWindow(u8);
void bag_menu_RemoveBagItem_message_window(u8);
void set_callback3_to_bag(u8);
void sub_81ABC54(u8, s16);
void PrintItemDepositAmount(u8, s16);
u8 BagMenu_AddWindow(u8);
u8 GetSwitchBagPocketDirection(void);
void SwitchBagPocket(u8, s16, u16);
@ -1050,10 +1050,10 @@ void BagMenu_InitListsMenu(u8 taskId)
void sub_81ABC3C(u8 a)
{
sub_81ABC54(BagMenu_AddWindow(a), 1);
PrintItemDepositAmount(BagMenu_AddWindow(a), 1);
}
void sub_81ABC54(u8 a, s16 b)
void PrintItemDepositAmount(u8 a, s16 b)
{
u8 r3 = (gBagPositionStruct.pocket == BERRIES_POCKET) ? 3 : 2;
ConvertIntToDecimalStringN(gStringVar1, b, 2, r3);
@ -1704,7 +1704,7 @@ void Task_ChooseHowManyToToss(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE)
{
sub_81ABC54(gBagMenu->unk817, data[8]);
PrintItemDepositAmount(gBagMenu->unk817, data[8]);
}
else if (gMain.newKeys & A_BUTTON)
{
@ -2056,7 +2056,7 @@ void sub_81ADA7C(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE)
{
sub_81ABC54(gBagMenu->unk817, data[8]);
PrintItemDepositAmount(gBagMenu->unk817, data[8]);
}
else if (gMain.newKeys & A_BUTTON)
{

View File

@ -2183,7 +2183,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
{
value = Random32();
shinyValue = HIHALF(value) ^ LOHALF(value) ^ HIHALF(personality) ^ LOHALF(personality);
} while (shinyValue < 8);
} while (shinyValue < SHINY_ODDS);
}
else if (otIdType == OT_ID_PRESET) //Pokemon has a preset OT ID
{
@ -6332,7 +6332,7 @@ const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32
return gMonPaletteTable[0].data;
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
if (shinyValue < 8)
if (shinyValue < SHINY_ODDS)
return gMonShinyPaletteTable[species].data;
else
return gMonPaletteTable[species].data;
@ -6351,7 +6351,7 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u
u32 shinyValue;
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
if (shinyValue < 8)
if (shinyValue < SHINY_ODDS)
return &gMonShinyPaletteTable[species];
else
return &gMonPaletteTable[species];
@ -6525,7 +6525,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality)
{
bool8 retVal = FALSE;
u32 shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
if (shinyValue < 8)
if (shinyValue < SHINY_ODDS)
retVal = TRUE;
return retVal;
}

View File

@ -1,7 +1,9 @@
#include "global.h"
#include "alloc.h"
#include "bg.h"
#include "data.h"
#include "decompress.h"
#include "dynamic_placeholder_text_util.h"
#include "event_data.h"
#include "item.h"
#include "link.h"
@ -10,11 +12,14 @@
#include "menu.h"
#include "palette.h"
#include "random.h"
#include "rom_8034C54.h"
#include "save.h"
#include "sound.h"
#include "sprite.h"
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "text_window.h"
#include "trig.h"
#include "pokemon.h"
#include "pokemon_jump.h"
@ -43,6 +48,33 @@ struct PokemonJump1_82E4
u8 unk1C[11];
};
struct PokemonJump2
{
int unk0;
u16 unk4;
u8 unk6;
u8 filler7[0xa - 0x7];
u8 unkA;
u8 unkB;
u8 unkC;
u8 unkD;
u8 unkE;
u8 unkF;
u16 filler10;
u16 unk12;
u16 unk14;
u8 filler16[0x1c - 0x16];
u16 unk1C[5];
u8 txtBuff[2][0x40];
u8 strBuff[0x100];
u16 tilemapBuffer[(0x81a8 - 0x1a6) / 2]; // 0x1A6
struct Sprite *unk81A8[MAX_RFU_PLAYERS];
struct Sprite *unk81BC[MAX_RFU_PLAYERS];
struct Sprite *unk81D0[8];
u8 filler81F0[0xC];
u8 unk81FC[MAX_RFU_PLAYERS];
};
struct PokemonJump1
{
MainCallback returnCallback;
@ -102,8 +134,7 @@ struct PokemonJump1
u8 unk8B[MAX_RFU_PLAYERS];
u16 unk90[MAX_RFU_PLAYERS];
u16 unk9A[MAX_RFU_PLAYERS];
void **unkA4;
u8 fillerA8[0x8200];
struct PokemonJump2 unkA4;
struct PokemonJump1_MonInfo unk82A8[MAX_RFU_PLAYERS];
struct PokemonJump1_82E4 unk82E4[MAX_RFU_PLAYERS];
struct PokemonJump1_82E4 *unk83AC;
@ -125,20 +156,6 @@ struct Unk802B078
int unk8;
};
struct PokemonJump2
{
u8 filler0[0xE];
u8 unkE;
u8 unkF;
u8 filler10[0x8198];
struct Sprite *unk81A8[MAX_RFU_PLAYERS];
struct Sprite *unk81BC[MAX_RFU_PLAYERS];
struct Sprite *unk81D0[8];
u8 filler81F0[0xC];
u8 unk81FC[MAX_RFU_PLAYERS];
};
static void sub_802AA60(struct PokemonJump1 *);
void sub_802AA94(struct PokemonJump1 *);
void sub_802AB20(void);
@ -216,15 +233,16 @@ static void sub_802CC40(struct Sprite *sprite);
static void sub_802CD08(struct Sprite *sprite);
static void sub_802CDD4(struct Sprite *sprite);
void sub_802DC9C(u32);
void sub_802D074(void *);
void sub_802D074(struct PokemonJump2 *);
void sub_802D0BC(struct PokemonJump2 *);
void sub_802D0AC(void);
void sub_802D0C8(int);
int sub_802D0F0(void);
bool32 sub_802D0F0(void);
void sub_802D764(void);
bool32 sub_802D788(void);
void sub_802D7E8(u16, u16);
void sub_802D884(u16);
void sub_802D8FC(u16);
void sub_802D7E8(u16 itemId, u16 quantity);
void sub_802D884(u16 itemId);
void sub_802D8FC(u16 itemId);
bool32 sub_802D974(void);
void sub_802DA14(void);
void sub_802DC80(int, s8);
@ -249,6 +267,7 @@ bool32 sub_802E264(struct PokemonJump1_82E4 *, int, u8 *, u16 *);
bool32 sub_802E2D0(struct PokemonJump1_82E4 *, int);
int sub_802E354(int, u16, u16);
void sub_802E3A8(void);
void sub_802D12C(u8 taskId);
EWRAM_DATA struct PokemonJump1 *gUnknown_02022CFC = NULL;
EWRAM_DATA struct PokemonJump2 *gUnknown_02022D00 = NULL;
@ -388,15 +407,33 @@ extern const u16 gUnknown_082FB64C[4];
extern const u16 gUnknown_082FB654[];
extern const s8 gUnknown_082FB65C[][48];
extern const int gUnknown_082FB6EC[];
extern const int gUnknown_082FB714[];
extern const u32 gUnknown_082FB714[][2];
extern const u16 gUnknown_082FB704[8];
extern const struct CompressedSpriteSheet gUnknown_082FBE08[5];
extern const struct SpritePalette gUnknown_082FBE30[2];
extern const struct SpriteTemplate gUnknown_082FBE40;
extern const struct SpriteTemplate gUnknown_082FC00C;
extern const s16 gUnknown_082FBE58[];
extern const s16 gUnknown_082FBE58[][10];
extern const s16 gUnknown_082FBEA8[8];
extern const struct SpriteTemplate gUnknown_082FBEB8[4];
extern const struct SpriteTemplate *gUnknown_082FBEB8[4];
extern const struct BgTemplate gUnknown_082FE164[4];
extern const struct WindowTemplate gUnknown_082FE174[];
extern const u16 gPkmnJumpBgPal[];
extern const u16 gPkmnJumpVenusaurPal[];
extern const u16 gPkmnJumpResultsPal[];
extern const u16 gPkmnJumpPal3[];
extern const u32 gPkmnJumpVenusaurGfx[];
extern const u32 gPkmnJumpBgTilemap[];
extern const u32 gPkmnJumpBgGfx[];
extern const u32 gPkmnJumpVenusaurTilemap[];
extern const u32 gPkmnJumpResultsGfx[];
extern const u32 gPkmnJumpResultsTilemap[];
struct
{
int id;
void (*func)(void);
} extern const gUnknown_082FE18C[10];
void sub_802A9A8(u16 partyIndex, MainCallback callback)
{
@ -1145,8 +1182,6 @@ static bool32 sub_802B720(void)
static bool32 sub_802B7E0(void)
{
int var0;
switch (gUnknown_02022CFC->unkA)
{
case 0:
@ -1155,8 +1190,7 @@ static bool32 sub_802B7E0(void)
gUnknown_02022CFC->unkA++;
break;
case 1:
var0 = sub_802D0F0();
if (!var0)
if (!sub_802D0F0())
{
sub_802DDF4(gUnknown_02022CFC->unk6);
gUnknown_02022CFC->unk3C = 0;
@ -1813,7 +1847,7 @@ static void sub_802C398(int multiplayerId)
sub_802DC80(multiplayerId, var1);
if (!var1 && multiplayerId == gUnknown_02022CFC->unk6)
sub_802C1BC();
player->unk0 = var1;
}
@ -2028,7 +2062,7 @@ static void sub_802C7A0(u16 arg0)
static bool32 sub_802C7BC(void)
{
if (gUnknown_02022CFC->unk78 >= gUnknown_082FB714[0])
if (gUnknown_02022CFC->unk78 >= gUnknown_082FB714[0][0])
return TRUE;
else
return FALSE;
@ -2053,6 +2087,22 @@ static u16 sub_802C818(void)
return gUnknown_082FB704[index];
}
#ifdef NONMATCHING
// Impossible to match.
static u16 sub_802C838(void)
{
u32 val, i;
val = 0;
for (i = 0; i < 5; val = gUnknown_082FB714[i][1], i++)
{
if (gUnknown_02022CFC->unk78 < gUnknown_082FB714[i][0])
break;
}
return val;
}
#else
NAKED
static u16 sub_802C838(void)
{
@ -2091,12 +2141,13 @@ _0802C874:\n\
pop {r1}\n\
bx r1");
}
#endif
static u16 sub_802C880(u16 item, u16 quantity)
{
while (quantity && !CheckBagHasSpace(item, quantity))
quantity--;
return quantity;
}
@ -2151,7 +2202,7 @@ void sub_802C974(struct PokemonJump2 *arg0)
for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE08); i++)
LoadCompressedSpriteSheet(&gUnknown_082FBE08[i]);
for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE30); i++)
LoadSpritePalette(&gUnknown_082FBE30[i]);
@ -2382,25 +2433,557 @@ void sub_802CE48(struct PokemonJump2 *arg0, s16 x, s16 y, u8 multiplayerId)
}
}
// void sub_802CE9C(struct PokemonJump2 *arg0)
// {
// int i;
// int count;
// u8 spriteId;
void sub_802CE9C(struct PokemonJump2 *arg0)
{
int i;
int count;
u8 spriteId;
// count = 0;
// for (i = 0; i < 4; i++)
// {
// spriteId = CreateSprite(&gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i * 10], 2);
// arg0->unk81D0[count] = &gSprites[spriteId];
// count++;
// }
count = 0;
for (i = 0; i < 4; i++)
{
spriteId = CreateSprite(gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i][0], 2);
arg0->unk81D0[count] = &gSprites[spriteId];
count++;
}
// for (i = 0; i < 4; i++)
// {
// spriteId = CreateSprite(&gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i * 10], 2);
// arg0->unk81D0[count] = &gSprites[spriteId];
// arg0->unk81D0[count]->hFlip = 1;
// count++;
// }
// }
for (i = 3; i >= 0; i--)
{
spriteId = CreateSprite(gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i][0], 2);
arg0->unk81D0[count] = &gSprites[spriteId];
arg0->unk81D0[count]->hFlip = 1;
count++;
}
}
void sub_802CF50(struct PokemonJump2 *arg0, int arg1)
{
int i, count, palNum;
int priority;
if (arg1 > 5)
{
arg1 = 10 - arg1;
priority = 3;
palNum = arg0->unkF;
}
else
{
priority = 2;
palNum = arg0->unkE;
}
count = 0;
for (i = 0; i < 4; i++)
{
arg0->unk81D0[count]->pos1.y = gUnknown_082FBE58[i][arg1];
arg0->unk81D0[count]->oam.priority = priority;
arg0->unk81D0[count]->oam.paletteNum = palNum;
StartSpriteAnim(arg0->unk81D0[count], arg1);
count++;
}
for (i = 3; i >= 0; i--)
{
arg0->unk81D0[count]->pos1.y = gUnknown_082FBE58[i][arg1];
arg0->unk81D0[count]->oam.priority = priority;
arg0->unk81D0[count]->oam.paletteNum = palNum;
StartSpriteAnim(arg0->unk81D0[count], arg1);
count++;
}
}
void sub_802D044(struct PokemonJump2 *arg0)
{
sub_802EB24(9, 7, 120, 80, 0);
sub_802CD3C(arg0);
}
bool32 sub_802D068(void)
{
return sub_802EB84();
}
void sub_802D150(void);
void sub_802DD08(void);
void sub_802DB8C(void);
void sub_802DBF8(void);
void sub_802DE1C(void);
void sub_802DFD4(void);
void sub_802D108(void (*func)(void));
void sub_802DF70(int arg0);
u32 sub_802DA9C(u8 arg0, u8 arg1, u8 arg2, u8 arg3);
void sub_802DB18(u8 arg0, u8 arg1, u8 arg2);
void sub_802D074(struct PokemonJump2 *arg0)
{
u8 taskId;
gUnknown_02022D00 = arg0;
sub_802D0BC(gUnknown_02022D00);
taskId = CreateTask(sub_802D12C, 3);
gUnknown_02022D00->unk6 = taskId;
SetWordTaskArg(gUnknown_02022D00->unk6, 2, (u32) gUnknown_02022D00);
sub_802D108(sub_802D150);
}
void sub_802D0AC(void)
{
FreeAllWindowBuffers();
sub_8034CC8();
}
void sub_802D0BC(struct PokemonJump2 *arg0)
{
arg0->unk4 = 0;
arg0->unk0 = 0;
arg0->unk12 = 0xFF;
}
void sub_802D0C8(int arg0)
{
int i;
for (i = 0; i < ARRAY_COUNT(gUnknown_082FE18C); i++)
{
if (gUnknown_082FE18C[i].id == arg0)
sub_802D108(gUnknown_082FE18C[i].func);
}
}
bool32 sub_802D0F0(void)
{
return (gUnknown_02022D00->unk0 != 1);
}
void sub_802D108(void (*func)(void))
{
SetWordTaskArg(gUnknown_02022D00->unk6, 0, (u32) func);
gUnknown_02022D00->unk4 = 0;
gUnknown_02022D00->unk0 = 0;
}
void sub_802D12C(u8 taskId)
{
if (!gUnknown_02022D00->unk0)
{
void (*func)(void) = (void *)(GetWordTaskArg(taskId, 0));
func();
}
}
void sub_802D150(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_082FE164, ARRAY_COUNT(gUnknown_082FE164));
InitWindows(gUnknown_082FE174);
reset_temp_tile_data_buffers();
sub_802C974(gUnknown_02022D00);
sub_802DD08();
LoadPalette(gPkmnJumpBgPal, 0, 0x20);
decompress_and_copy_tile_data_to_vram(3, gPkmnJumpBgGfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(3, gPkmnJumpBgTilemap, 0, 0, 1);
LoadPalette(gPkmnJumpVenusaurPal, 0x30, 0x20);
decompress_and_copy_tile_data_to_vram(2, gPkmnJumpVenusaurGfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(2, gPkmnJumpVenusaurTilemap, 0, 0, 1);
LoadPalette(gPkmnJumpResultsPal, 0x10, 0x20);
decompress_and_copy_tile_data_to_vram(1, gPkmnJumpResultsGfx, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(1, gPkmnJumpResultsTilemap, 0, 0, 1);
LoadPalette(gPkmnJumpPal3, 0x20, 0x20);
SetBgTilemapBuffer(0, gUnknown_02022D00->tilemapBuffer);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
sub_802DB8C();
sub_802DD64(0);
sub_8098C6C(0, 1, 0xE0);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(2);
CopyBgTilemapBufferToVram(1);
ResetBgPositions();
gUnknown_02022D00->unk4++;
break;
case 1:
if (!free_temp_tile_data_buffers_if_possible())
{
sub_802DBF8();
sub_802CE9C(gUnknown_02022D00);
sub_802CF50(gUnknown_02022D00, 6);
ShowBg(3);
ShowBg(0);
ShowBg(2);
HideBg(1);
gUnknown_02022D00->unk4++;
}
break;
case 2:
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D2E4(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
sub_802DE1C();
gUnknown_02022D00->unk4++;
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
sub_802DF70(0);
gUnknown_02022D00->unk4++;
}
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
{
sub_802DFD4();
gUnknown_02022D00->unk4++;
}
break;
case 3:
if (!IsDma3ManagerBusyWithBgCopy())
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D350(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
sub_802DE1C();
gUnknown_02022D00->unk4++;
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
sub_802DF70(1);
gUnknown_02022D00->unk4++;
}
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
{
sub_802DFD4();
gUnknown_02022D00->unk4++;
}
break;
case 3:
if (!IsDma3ManagerBusyWithBgCopy())
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D3BC(void)
{
int i, numPlayers;
numPlayers = sub_802C8AC();
switch (gUnknown_02022D00->unk4)
{
case 0:
for (i = 0; i < numPlayers; i++)
ClearWindowTilemap(gUnknown_02022D00->unk1C[i]);
CopyBgTilemapBufferToVram(0);
gUnknown_02022D00->unk4++;
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
for (i = 0; i < numPlayers; i++)
RemoveWindow(gUnknown_02022D00->unk1C[i]);
gUnknown_02022D00->unk0 = 1;
}
break;
}
}
void sub_802D448(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
gUnknown_02022D00->unk12 = sub_802DA9C(1, 8, 20, 2);
AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_WantToPlayAgain2, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_02022D00->unk12, 2);
gUnknown_02022D00->unk4++;
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
PutWindowTilemap(gUnknown_02022D00->unk12);
DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14);
sub_802DB18(23, 7, 0);
CopyBgTilemapBufferToVram(0);
gUnknown_02022D00->unk4++;
}
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D4F4(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
gUnknown_02022D00->unk12 = sub_802DA9C(2, 7, 26, 4);
AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_SavingDontTurnOffPower, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_02022D00->unk12, 2);
gUnknown_02022D00->unk4++;
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
PutWindowTilemap(gUnknown_02022D00->unk12);
DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14);
CopyBgTilemapBufferToVram(0);
gUnknown_02022D00->unk4++;
}
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D598(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
sub_802DA14();
sub_8198C78();
CopyBgTilemapBufferToVram(0);
gUnknown_02022D00->unk4++;
break;
case 1:
if (!sub_802DA44() && !IsDma3ManagerBusyWithBgCopy())
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D5E4(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
gUnknown_02022D00->unk12 = sub_802DA9C(2, 8, 22, 4);
AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_SomeoneDroppedOut2, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_02022D00->unk12, 2);
gUnknown_02022D00->unk4++;
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
PutWindowTilemap(gUnknown_02022D00->unk12);
DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14);
CopyBgTilemapBufferToVram(0);
gUnknown_02022D00->unk4++;
}
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D688(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
gUnknown_02022D00->unk12 = sub_802DA9C(7, 10, 16, 2);
AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_CommunicationStandby4, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_02022D00->unk12, 2);
gUnknown_02022D00->unk4++;
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
PutWindowTilemap(gUnknown_02022D00->unk12);
DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14);
CopyBgTilemapBufferToVram(0);
gUnknown_02022D00->unk4++;
}
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D72C(void)
{
switch (gUnknown_02022D00->unk4)
{
case 0:
sub_802D044(gUnknown_02022D00);
gUnknown_02022D00->unk4++;
break;
case 1:
if (!sub_802D068())
gUnknown_02022D00->unk0 = 1;
break;
}
}
void sub_802D764(void)
{
gUnknown_02022D00->unkA = 0;
gUnknown_02022D00->unkB = 0;
gUnknown_02022D00->unkC = 6;
sub_802DC9C(gUnknown_02022D00->unkC);
}
bool32 sub_802D788(void)
{
switch (gUnknown_02022D00->unkA)
{
case 0:
gUnknown_02022D00->unkB++;
if (gUnknown_02022D00->unkB > 10)
{
gUnknown_02022D00->unkB = 0;
gUnknown_02022D00->unkC++;
if (gUnknown_02022D00->unkC >= 10)
{
gUnknown_02022D00->unkC = 0;
gUnknown_02022D00->unkA++;
}
}
sub_802DC9C(gUnknown_02022D00->unkC);
if (gUnknown_02022D00->unkC != 7)
break;
case 1:
return FALSE;
}
return TRUE;
}
void sub_802D7E8(u16 itemId, u16 quantity)
{
CopyItemNameHandlePlural(itemId, gUnknown_02022D00->txtBuff[0], quantity);
ConvertIntToDecimalStringN(gUnknown_02022D00->txtBuff[1], quantity, STR_CONV_MODE_LEFT_ALIGN, 1);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gUnknown_02022D00->txtBuff[1]);
DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_AwesomeWonF701F700);
gUnknown_02022D00->unk12 = sub_802DA9C(4, 8, 22, 4);
AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_02022D00->unk12, 2);
gUnknown_02022D00->unk14 = MUS_FANFA1;
gUnknown_02022D00->unkD = 0;
}
void sub_802D884(u16 itemId)
{
CopyItemName(itemId, gUnknown_02022D00->txtBuff[0]);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]);
DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_FilledStorageSpace2);
gUnknown_02022D00->unk12 = sub_802DA9C(4, 8, 22, 4);
AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_02022D00->unk12, 2);
gUnknown_02022D00->unk14 = 0;
gUnknown_02022D00->unkD = 0;
}
void sub_802D8FC(u16 itemId)
{
CopyItemName(itemId, gUnknown_02022D00->txtBuff[0]);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]);
DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_CantHoldMore);
gUnknown_02022D00->unk12 = sub_802DA9C(4, 9, 22, 2);
AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL);
CopyWindowToVram(gUnknown_02022D00->unk12, 2);
gUnknown_02022D00->unk14 = 0;
gUnknown_02022D00->unkD = 0;
}
bool32 sub_802D974(void)
{
switch (gUnknown_02022D00->unkD)
{
case 0:
if (!IsDma3ManagerBusyWithBgCopy())
{
PutWindowTilemap(gUnknown_02022D00->unk12);
DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14);
CopyBgTilemapBufferToVram(0);
gUnknown_02022D00->unkD++;
}
break;
case 1:
if (IsDma3ManagerBusyWithBgCopy())
break;
if (gUnknown_02022D00->unk14 == 0)
{
gUnknown_02022D00->unkD += 2;
return FALSE;
}
PlayFanfare(gUnknown_02022D00->unk14);
gUnknown_02022D00->unkD++;
case 2:
if (!IsFanfareTaskInactive())
break;
gUnknown_02022D00->unkD++;
case 3:
return FALSE;
}
return TRUE;
}
void sub_802DA14(void)
{
if (gUnknown_02022D00->unk12 != 0xFF)
{
rbox_fill_rectangle(gUnknown_02022D00->unk12);
CopyWindowToVram(gUnknown_02022D00->unk12, 1);
gUnknown_02022D00->unkD = 0;
}
}
// Can't match this
/*
bool32 sub_802DA44(void)
{
if (gUnknown_02022D00->unk12 == 0xFF)
return FALSE;
if (gUnknown_02022D00->unkD == 0)
{
if (!IsDma3ManagerBusyWithBgCopy())
{
RemoveWindow(gUnknown_02022D00->unk12);
gUnknown_02022D00->unk12 = 0xFF;
gUnknown_02022D00->unkD++;
return FALSE;
}
}
else if (gUnknown_02022D00->unkD == 1)
return FALSE;
return TRUE;
}
*/