Committing progress so far.

This commit is contained in:
ultima-soul 2018-12-24 15:10:36 -08:00
parent f966b65849
commit 2ca482dc24
3 changed files with 341 additions and 1321 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,5 +15,7 @@ u16 CalcCRC16WithTable(u8 *data, u32 length);
u32 CalcByteArraySum(const u8* data, u32 length); u32 CalcByteArraySum(const u8* data, u32 length);
void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor); void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor);
void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha); void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha);
void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output);
#endif // GUARD_UTIL_H #endif // GUARD_UTIL_H

View File

@ -113,7 +113,7 @@ void sub_80DBF90(void);
void sub_80DC2BC(void); void sub_80DC2BC(void);
void sub_80DC490(bool8); void sub_80DC490(bool8);
void sub_80DC4F0(void); void sub_80DC4F0(void);
void sub_80DC594(void); void CreateApplauseMeterSprite(void);
void sub_80DC5E8(void); void sub_80DC5E8(void);
void sub_80DC7EC(void); void sub_80DC7EC(void);
void sub_80DCD48(void); void sub_80DCD48(void);
@ -174,6 +174,14 @@ s16 sub_80DBD34(u8);
void DetermineFinalStandings(void); void DetermineFinalStandings(void);
bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *); bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *);
void sub_80DC0F4(u8); void sub_80DC0F4(u8);
void sub_80DC408(struct Sprite *);
void sub_80DC728(u8);
void sub_80DC6A4(u8);
void sub_80DC8D0(u8);
void sub_80DC81C(u8);
void sub_80DC87C(u8);
EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; EWRAM_DATA struct ContestPokemon gContestMons[4] = {0};
EWRAM_DATA s16 gContestMonConditions[4] = {0}; EWRAM_DATA s16 gContestMonConditions[4] = {0};
@ -230,6 +238,17 @@ extern const struct SpriteTemplate gSpriteTemplate_8587C18;
extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AffineAnimCmd *const gUnknown_082FF6C0[];
extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const union AffineAnimCmd *const gUnknown_082FF694[];
extern const u8 *const gContestEffectDescriptionPointers[]; extern const u8 *const gContestEffectDescriptionPointers[];
extern const struct SpriteSheet gUnknown_08587A74;
extern const u8 gUnknown_08587A6C[];
extern const struct SpriteTemplate gSpriteTemplate_8587AD0;
extern const struct SpritePalette gUnknown_08587B08;
extern const struct CompressedSpriteSheet gUnknown_08587AE8[];
extern const struct SpriteTemplate gSpriteTemplate_8587B18[];
extern const u8 gUnknown_08587A70[];
extern const struct SubspriteTable gSubspriteTables_8587B80[];
extern const struct CompressedSpriteSheet gUnknown_08587BB0;
extern const struct SpritePalette gUnknown_08587BB8;
extern const struct SpriteTemplate gSpriteTemplate_8587BC8;
void TaskDummy1(u8 taskId) void TaskDummy1(u8 taskId)
{ {
@ -577,7 +596,7 @@ u8 sub_80D7E44(u8 *a)
gContestResources->field_0->unk19216 = sub_80DB120(); gContestResources->field_0->unk19216 = sub_80DB120();
sub_80DC2BC(); sub_80DC2BC();
sub_80DC4F0(); sub_80DC4F0();
sub_80DC594(); CreateApplauseMeterSprite();
sub_80DC5E8(); sub_80DC5E8();
sub_80DC7EC(); sub_80DC7EC();
gBattlerPositions[0] = 0; gBattlerPositions[0] = 0;
@ -3090,8 +3109,6 @@ u8 sub_80DC028(s16 a, s16 b, u8 c)
return taskId; return taskId;
} }
#ifdef NONMATCHING
void sub_80DC0F4(u8 taskId) void sub_80DC0F4(u8 taskId)
{ {
u8 r7 = gTasks[taskId].data[3]; u8 r7 = gTasks[taskId].data[3];
@ -3103,6 +3120,7 @@ void sub_80DC0F4(u8 taskId)
u16 r6; u16 r6;
u8 r5; u8 r5;
u8 r10; u8 r10;
u8 r11;
gTasks[taskId].data[10] = 0; gTasks[taskId].data[10] = 0;
if (gTasks[taskId].data[1] == 0) if (gTasks[taskId].data[1] == 0)
@ -3158,16 +3176,15 @@ void sub_80DC0F4(u8 taskId)
} }
} }
} }
r10 = r5;
r11 = 0;
r10 = r5;
r1 = 0;
if (r5 > 7) if (r5 > 7)
{ {
r1 = 1; r11 = 1;
r5 -= 8; r5-= 8;
} }
ContestBG_FillBoxWithTile(0, r6, r5 + 22, gUnknown_02039F26[r7] * 5 + 2 + r11, 1, 1, 17);
ContestBG_FillBoxWithTile(0, r6, r5 + 0x16, (gUnknown_02039F26[r7] * 5) + 2 + r3, 1, 1, 0x11);
if (r1 > 0) if (r1 > 0)
{ {
PlaySE(SE_C_GAJI); PlaySE(SE_C_GAJI);
@ -3175,239 +3192,318 @@ void sub_80DC0F4(u8 taskId)
m4aMPlayPitchControl(&gMPlayInfo_SE1, 0xFFFF, r10 * 256); m4aMPlayPitchControl(&gMPlayInfo_SE1, 0xFFFF, r10 * 256);
} }
else else
{
PlaySE(SE_BOO); PlaySE(SE_BOO);
}
if (r10 == 0 && r5 == 0 && r6 == 0) if (!r11 && !r5 && !r6)
gTasks[taskId].data[2] = -gTasks[taskId].data[2]; gTasks[taskId].data[2] = -gTasks[taskId].data[2];
} }
} }
#else
NAKED void sub_80DC2BC(void)
void sub_80DC0F4(u8 taskId)
{ {
asm(".syntax unified\n\ s32 i;
push {r4-r7,lr}\n\
mov r7, r10\n\ LoadSpriteSheet(&gUnknown_08587A74);
mov r6, r9\n\ for (i = 0; i < 4; i++)
mov r5, r8\n\ {
push {r5-r7}\n\ u8 y = gUnknown_08587A6C[gUnknown_02039F26[i]];
sub sp, 0x10\n\
lsls r0, 24\n\ gContestResources->field_14[i].unk0 = CreateSprite(&gSpriteTemplate_8587AD0, 180, y, 1);
lsrs r7, r0, 24\n\ }
ldr r1, =gTasks\n\ }
lsls r0, r7, 2\n\
adds r0, r7\n\ void sub_80DC308(u8 a)
lsls r0, 3\n\ {
adds r4, r0, r1\n\ u8 spriteId;
ldrb r0, [r4, 0xE]\n\ s16 r5;
mov r9, r0\n\
ldrh r3, [r4, 0x8]\n\ gContestResources->field_14[a].unk2_0 = 1;
ldrh r1, [r4, 0xA]\n\ spriteId = gContestResources->field_14[a].unk0;
ldrh r0, [r4, 0x1C]\n\ r5 = sContestantStatus[a].unk4 / 10 * 2;
adds r0, 0x1\n\ if (r5 > 56)
strh r0, [r4, 0x1C]\n\ r5 = 56;
lsls r0, 16\n\ else if (r5 < 0)
asrs r0, 16\n\ r5 = 0;
cmp r0, 0xE\n\ gSprites[spriteId].invisible = FALSE;
bgt _080DC126\n\ gSprites[spriteId].data[0] = a;
b _080DC2A8\n\ gSprites[spriteId].data[1] = r5;
_080DC126:\n\ if (gSprites[spriteId].data[1] > gSprites[spriteId].pos2.x)
movs r0, 0\n\ gSprites[spriteId].data[2] = 1;
strh r0, [r4, 0x1C]\n\ else
ldrh r2, [r4, 0xA]\n\ gSprites[spriteId].data[2] = -1;
movs r5, 0xA\n\ gSprites[spriteId].callback = sub_80DC408;
ldrsh r0, [r4, r5]\n\ }
cmp r0, 0\n\
bne _080DC15C\n\ void sub_80DC3AC(void)
adds r0, r7, 0\n\ {
bl DestroyTask\n\ s32 i;
ldr r0, =gContestResources\n\
ldr r0, [r0]\n\ for (i = 0; i < 4; i++)
ldr r0, [r0, 0x14]\n\ sub_80DC308(i);
mov r2, r9\n\ }
lsls r1, r2, 2\n\
adds r1, r0\n\ bool8 sub_80DC3C4(void)
ldrb r2, [r1, 0x2]\n\ {
movs r0, 0x5\n\ s32 i;
negs r0, r0\n\
ands r0, r2\n\ for (i = 0; i < 4; i++)
strb r0, [r1, 0x2]\n\ {
b _080DC2A8\n\ if (gContestResources->field_14[i].unk2_0)
.pool\n\ break;
_080DC15C:\n\ }
cmp r3, 0\n\ if (i == 4)
bne _080DC1A4\n\ return TRUE;
lsls r0, r1, 16\n\ else
mov r8, r0\n\ return FALSE;
cmp r0, 0\n\ }
bge _080DC17A\n\
mov r0, r9\n\ void sub_80DC408(struct Sprite *sprite)
bl sub_80DBFC8\n\ {
adds r0, 0x2\n\ if (sprite->pos2.x == sprite->data[1])
lsls r0, 16\n\ {
lsrs r6, r0, 16\n\ gContestResources->field_14[sprite->data[0]].unk2_0 = 0;
ldrh r0, [r4, 0xA]\n\ sprite->callback = SpriteCallbackDummy;
adds r0, 0x1\n\ }
b _080DC188\n\ else
_080DC17A:\n\ {
mov r0, r9\n\ sprite->pos2.x += sprite->data[2];
bl sub_80DBFC8\n\ }
lsls r0, 16\n\ }
lsrs r6, r0, 16\n\
ldrh r0, [r4, 0xA]\n\ void sub_80DC44C(void)
subs r0, 0x1\n\ {
_080DC188:\n\ s32 i;
strh r0, [r4, 0xA]\n\
ldr r1, =gTasks\n\ for (i = 0; i < 4; i++)
lsls r0, r7, 2\n\ gSprites[gContestResources->field_14[i].unk0].pos1.y = gUnknown_08587A6C[gUnknown_02039F26[i]];
adds r0, r7\n\ }
lsls r0, 3\n\
adds r0, r1\n\ void sub_80DC490(bool8 a)
ldrh r1, [r0, 0x8]\n\ {
adds r2, r1, 0x1\n\ s32 i;
strh r2, [r0, 0x8]\n\
lsls r1, 24\n\ for (i = 0; i < 4; i++)
lsrs r5, r1, 24\n\ {
b _080DC210\n\ if (gUnknown_02039F26[i] > 1)
.pool\n\ {
_080DC1A4:\n\ if (!a)
movs r3, 0xC\n\ gSprites[gContestResources->field_14[i].unk0].pos1.x = 180;
ldrsh r0, [r4, r3]\n\ else
cmp r0, 0\n\ gSprites[gContestResources->field_14[i].unk0].pos1.x = 256;
bge _080DC1DE\n\ }
lsls r0, r1, 16\n\ }
mov r8, r0\n\ }
cmp r0, 0\n\
bge _080DC1CC\n\ void sub_80DC4F0(void)
ldrh r0, [r4, 0x8]\n\ {
adds r1, r0, 0x1\n\ s32 i;
strh r1, [r4, 0x8]\n\
lsls r0, 24\n\ LoadSpritePalette(&gUnknown_08587B08);
lsrs r5, r0, 24\n\ for (i = 0; i < 4; i++)
adds r0, r2, 0x1\n\ {
strh r0, [r4, 0xA]\n\ LoadCompressedObjectPic(&gUnknown_08587AE8[i]);
mov r0, r9\n\ gContestResources->field_14[i].unk1 = CreateSprite(
bl sub_80DBFC8\n\ &gSpriteTemplate_8587B18[i],
adds r0, 0x2\n\ 204, gUnknown_08587A70[gUnknown_02039F26[i]],
b _080DC20C\n\ 0);
_080DC1CC:\n\ SetSubspriteTables(&gSprites[gContestResources->field_14[i].unk1], gSubspriteTables_8587B80);
ldrh r0, [r4, 0x8]\n\ gSprites[gContestResources->field_14[i].unk1].invisible = TRUE;
subs r0, 0x1\n\ }
strh r0, [r4, 0x8]\n\ }
lsls r0, 24\n\
lsrs r5, r0, 24\n\ void CreateApplauseMeterSprite(void)
movs r6, 0\n\ {
subs r0, r2, 0x1\n\ u8 spriteId;
strh r0, [r4, 0xA]\n\
b _080DC210\n\ LoadCompressedObjectPic(&gUnknown_08587BB0);
_080DC1DE:\n\ LoadSpritePalette(&gUnknown_08587BB8);
lsls r0, r1, 16\n\ spriteId = CreateSprite(&gSpriteTemplate_8587BC8, 30, 44, 1);
mov r8, r0\n\ gSprites[spriteId].invisible = TRUE;
cmp r0, 0\n\ sContest.applauseMeterSpriteId = spriteId;
bge _080DC1F8\n\ }
ldrh r0, [r4, 0x8]\n\
subs r0, 0x1\n\ void sub_80DC5E8(void)
strh r0, [r4, 0x8]\n\ {
lsls r0, 24\n\ u8 i;
lsrs r5, r0, 24\n\ u8 taskId = CreateTask(sub_80DC728, 30);
movs r6, 0\n\
adds r0, r2, 0x1\n\ sContest.unk19211 = taskId;
strh r0, [r4, 0xA]\n\ for (i = 0; i < 4; i++)
b _080DC210\n\ gTasks[taskId].data[i * 4] = 0xFF;
_080DC1F8:\n\ }
ldrh r0, [r4, 0x8]\n\
adds r1, r0, 0x1\n\ void sub_80DC630(u8 a)
strh r1, [r4, 0x8]\n\ {
lsls r0, 24\n\ gTasks[sContest.unk19211].data[a * 4 + 0] = 0;
lsrs r5, r0, 24\n\ gTasks[sContest.unk19211].data[a * 4 + 1] = 0;
subs r0, r2, 0x1\n\ }
strh r0, [r4, 0xA]\n\
mov r0, r9\n\ void sub_80DC674(u8 a)
bl sub_80DBFC8\n\ {
_080DC20C:\n\ u8 taskId = CreateTask(sub_80DC6A4, 31);
lsls r0, 16\n\
lsrs r6, r0, 16\n\ gTasks[taskId].data[0] = a;
_080DC210:\n\ }
str r5, [sp, 0xC]\n\
movs r0, 0\n\ void sub_80DC6A4(u8 taskId)
mov r10, r0\n\ {
cmp r5, 0x7\n\ u8 r4 = gTasks[taskId].data[0];
bls _080DC226\n\
movs r2, 0x1\n\ if (gTasks[sContest.unk19211].data[r4 * 4 + 0] == 0
mov r10, r2\n\ || gTasks[sContest.unk19211].data[r4 * 4 + 0] == 0xFF)
adds r0, r5, 0\n\ {
subs r0, 0x8\n\ gTasks[sContest.unk19211].data[r4 * 4 + 0] = 0xFF;
lsls r0, 24\n\ gTasks[sContest.unk19211].data[r4 * 4 + 1] = 0;
lsrs r5, r0, 24\n\ BlendPalette((sContest.unk19218[r4] + 5) * 16 + 6, 2, 0, RGB(31, 31, 18));
_080DC226:\n\ DestroyTask(taskId);
adds r2, r5, 0\n\ }
adds r2, 0x16\n\ }
lsls r2, 24\n\
lsrs r2, 24\n\ void sub_80DC728(u8 taskId)
ldr r0, =gUnknown_02039F26\n\ {
add r0, r9\n\ u8 i;
ldrb r0, [r0]\n\
lsls r3, r0, 2\n\ for (i = 0; i < 4; i++)
adds r3, r0\n\ {
adds r3, 0x2\n\ u8 r3 = i * 4;
add r3, r10\n\
lsls r3, 24\n\ if (gTasks[taskId].data[r3 + 0] != 0xFF)
lsrs r3, 24\n\ {
movs r0, 0x1\n\ if (gTasks[taskId].data[r3 + 1] == 0)
str r0, [sp]\n\ gTasks[taskId].data[r3 + 0]++;
str r0, [sp, 0x4]\n\ else
movs r0, 0x11\n\ gTasks[taskId].data[r3 + 0]--;
str r0, [sp, 0x8]\n\
movs r0, 0\n\ if (gTasks[taskId].data[r3 + 0] == 16
adds r1, r6, 0\n\ || gTasks[taskId].data[r3 + 0] == 0)
bl ContestBG_FillBoxWithTile\n\ gTasks[taskId].data[r3 + 1] ^= 1;
mov r3, r8\n\
cmp r3, 0\n\ BlendPalette(
ble _080DC284\n\ (sContest.unk19218[i] + 5) * 16 + 6,
movs r0, 0x60\n\ 2,
bl PlaySE\n\ gTasks[taskId].data[r3 + 0],
ldr r4, =gMPlayInfo_SE1\n\ RGB(31, 31, 18));
adds r0, r4, 0\n\ }
bl m4aMPlayImmInit\n\ }
ldr r1, =0x0000ffff\n\ }
ldr r0, [sp, 0xC]\n\
lsls r2, r0, 24\n\ void sub_80DC7EC(void)
asrs r2, 16\n\ {
adds r0, r4, 0\n\ s32 i;
bl m4aMPlayPitchControl\n\
b _080DC28A\n\ sContest.unk19212 = CreateTask(sub_80DC8D0, 30);
.pool\n\ for (i = 0; i < 4; i++)
_080DC284:\n\ sub_80DC81C(i);
movs r0, 0x16\n\ }
bl PlaySE\n\
_080DC28A:\n\ void sub_80DC81C(u8 a)
mov r2, r10\n\ {
cmp r2, 0\n\ gTasks[sContest.unk19212].data[a * 4 + 0] = 0xFF;
bne _080DC2A8\n\ gTasks[sContest.unk19212].data[a * 4 + 1] = 0;
cmp r5, 0\n\ }
bne _080DC2A8\n\
cmp r6, 0\n\ void sub_80DC864(void)
bne _080DC2A8\n\ {
ldr r0, =gTasks\n\ s32 i;
lsls r1, r7, 2\n\
adds r1, r7\n\ for (i = 0; i < 4; i++)
lsls r1, 3\n\ sub_80DC87C(i);
adds r1, r0\n\ }
ldrh r0, [r1, 0xC]\n\
negs r0, r0\n\ void sub_80DC87C(u8 a)
strh r0, [r1, 0xC]\n\ {
_080DC2A8:\n\ u32 var;
add sp, 0x10\n\ u32 r0;
pop {r3-r5}\n\
mov r8, r3\n\ sub_80DC81C(a);
mov r9, r4\n\
mov r10, r5\n\ r0 = a + 5;
pop {r4-r7}\n\ DmaCopy16Defvars(
pop {r0}\n\ 3,
bx r0\n\ gPlttBufferUnfaded + r0 * 16 + 10,
.pool\n\ gPlttBufferFaded + r0 * 16 + 10,
.syntax divided\n"); 2);
var = (a + 5) * 16 + 12 + a;
DmaCopy16Defvars(
3,
gPlttBufferUnfaded + var,
gPlttBufferFaded + var,
2);
}
void sub_80DC8D0(u8 taskId)
{
u8 i;
for (i = 0; i < 4; i++)
{
u8 r3 = i * 4;
if (gTasks[taskId].data[r3 + 0] != 0xFF)
{
if (++gTasks[taskId].data[r3 + 2] > 2)
{
gTasks[taskId].data[r3 + 2] = 0;
if (gTasks[taskId].data[r3 + 1] == 0)
gTasks[taskId].data[r3 + 0]++;
else
gTasks[taskId].data[r3 + 0]--;
if (gTasks[taskId].data[r3 + 0] == 16
|| gTasks[taskId].data[r3 + 0] == 0)
gTasks[taskId].data[r3 + 1] ^= 1;
BlendPalette((i + 5) * 16 + 10, 1, gTasks[taskId].data[r3 + 0], RGB(31, 31, 18));
BlendPalette((i + 5) * 16 + 12 + i, 1, gTasks[taskId].data[r3 + 0], RGB(31, 31, 18));
}
}
}
}
void sub_80DC9B4(u8 a)
{
if (sContestantStatus[a].hasJudgesAttention)
sub_80DC630(a);
else
sub_80DC674(a);
}
extern const struct CompressedSpriteSheet gUnknown_08589904[];
extern const struct SpritePalette gUnknown_08589924[];
extern const struct SpriteTemplate gSpriteTemplate_858998C[];
u8 sub_80DC9EC(u8 a)
{
u8 r5 = gUnknown_02039F26[a] * 40 + 32;
u8 r8;
u8 r6;
volatile u8 zero;
LoadCompressedObjectPic(&gUnknown_08589904[a]);
LoadSpritePalette(&gUnknown_08589924[a]);
r6 = CreateSprite(&gSpriteTemplate_858998C[a], 184, r5, 29);
gSprites[r8].oam.tileNum += 64;
r8 = CreateSprite(&gSpriteTemplate_858998C[a], 248, r5, 29);
CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x26), (u8 *)(VRAM + 0x10000 + gSprites[r6].oam.tileNum * 32));
CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x36), (u8 *)(VRAM + 0x10000 + gSprites[r8].oam.tileNum * 32));
CpuSet(&r8, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x36), 0x050000c0);
RequestDma3Copy((void *)(VRAM + 0x10000 + (0x28 + gSprites[r6].oam.tileNum) * 32), (u8 *)(VRAM + 0x10000 + gSprites[r8].oam.tileNum * 32), 0x80, 1);
// What is this?
zero = 0;
zero = 0;
RequestDma3Copy((void *)(VRAM + 0x10000 + (0x28 + gSprites[r6].oam.tileNum) * 32), (u8 *)(VRAM + 0x10000 + gSprites[r6].oam.tileNum * 32), 0x80, 1);
gSprites[r6].data[0] = r8;
gSprites[r8].data[0] = r6;
return r6;
} }
#endif