diff --git a/asm/contest.s b/asm/contest.s index 978421c3d..6504e7bf1 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,7588 +5,6 @@ .text - thumb_func_start TaskDummy1 -TaskDummy1: @ 80D7668 - bx lr - thumb_func_end TaskDummy1 - - thumb_func_start ResetLinkContestBoolean -ResetLinkContestBoolean: @ 80D766C - ldr r1, =gUnknown_02039F2A - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end ResetLinkContestBoolean - - thumb_func_start sub_80D7678 -sub_80D7678: @ 80D7678 - push {r4,lr} - movs r0, 0 - movs r1, 0x40 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - ldr r4, =0x00003f3f - movs r0, 0x48 - adds r1, r4, 0 - bl SetGpuReg - movs r0, 0x4A - adds r1, r4, 0 - bl SetGpuReg - movs r1, 0xFE - lsls r1, 7 - movs r0, 0 - bl SetGpuRegBits - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r0, =gBattle_BG1_X - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - ldr r0, =gBattle_BG3_X - strh r1, [r0] - ldr r0, =gBattle_BG3_Y - strh r1, [r0] - ldr r0, =gBattle_WIN0H - strh r1, [r0] - ldr r0, =gBattle_WIN0V - strh r1, [r0] - ldr r0, =gBattle_WIN1H - strh r1, [r0] - ldr r0, =gBattle_WIN1V - strh r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7678 - - thumb_func_start LoadContestBgAfterMoveAnim -LoadContestBgAfterMoveAnim: @ 80D7724 - push {r4,r5,lr} - ldr r0, =gUnknown_08C17AB0 - movs r1, 0xC0 - lsls r1, 19 - bl LZDecompressVram - ldr r0, =gUnknown_08C1850C - ldr r1, =0x06002000 - bl LZDecompressVram - ldr r1, =gUnknown_08C16FA8 - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_08C16E90 - movs r2, 0x80 - lsls r2, 2 - movs r1, 0 - bl LoadCompressedPalette - bl sub_80D782C - movs r4, 0 - movs r5, 0xA0 -_080D775E: - ldr r0, =gHeap+0x1A004 - adds r0, r5, r0 - ldr r1, =gUnknown_02039F26 - adds r1, r4, r1 - ldrb r1, [r1] - adds r1, 0x5 - lsls r1, 4 - movs r2, 0x20 - bl LoadPalette - adds r5, 0x20 - adds r4, 0x1 - cmp r4, 0x3 - ble _080D775E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LoadContestBgAfterMoveAnim - - thumb_func_start sub_80D779C -sub_80D779C: @ 80D779C - push {r4,lr} - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_08587F34 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0x3 - movs r1, 0x6 - movs r2, 0x1 - bl SetBgAttribute - movs r4, 0 -_080D77BA: - lsls r0, r4, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - lsls r2, r4, 2 - adds r1, 0x24 - adds r1, r2 - ldr r1, [r1] - bl SetBgTilemapBuffer - adds r4, 0x1 - cmp r4, 0x3 - ble _080D77BA - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D779C - - thumb_func_start sub_80D77E4 -sub_80D77E4: @ 80D77E4 - push {lr} - ldr r0, =gUnknown_08587F44 - bl InitWindows - bl DeactivateAllTextPrinters - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D7818 - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - b _080D7822 - .pool -_080D7818: - ldr r0, =gTextFlags - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] -_080D7822: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D77E4 - - thumb_func_start sub_80D782C -sub_80D782C: @ 80D782C - push {r4,r5,lr} - ldr r0, =gUnknown_08587C30 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - movs r1, 0 - movs r2, 0x2 - bl FillPalette - movs r5, 0xA - movs r4, 0xFA - lsls r4, 16 -_080D7848: - lsrs r1, r4, 16 - ldr r0, =gPlttBufferUnfaded + 0x1E2 - movs r2, 0x2 - bl LoadPalette - movs r0, 0x80 - lsls r0, 9 - adds r4, r0 - adds r5, 0x1 - cmp r5, 0xD - ble _080D7848 - ldr r0, =0x00007e3f - movs r1, 0xF3 - movs r2, 0x2 - bl FillPalette - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D782C - - thumb_func_start sub_80D787C -sub_80D787C: @ 80D787C - push {r4-r7,lr} - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0 - movs r2, 0x5C - bl memset - movs r5, 0 - movs r2, 0xFF -_080D7890: - ldr r0, [r4] - ldr r1, [r0] - adds r1, 0x2 - adds r1, r5 - ldrb r0, [r1] - orrs r0, r2 - strb r0, [r1] - adds r5, 0x1 - cmp r5, 0x3 - ble _080D7890 - movs r4, 0 - ldr r6, =gContestResources - movs r5, 0x3 -_080D78AA: - ldr r0, [r6] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - movs r1, 0 - movs r2, 0x1C - bl memset - adds r4, 0x1C - subs r5, 0x1 - cmp r5, 0 - bge _080D78AA - ldr r4, =gContestResources - movs r7, 0x4 - negs r7, r7 - movs r6, 0xFF - movs r3, 0 - movs r5, 0x3 -_080D78CC: - ldr r0, [r4] - ldr r1, [r0, 0x4] - adds r1, r3, r1 - ldrb r2, [r1, 0xB] - adds r0, r7, 0 - ands r0, r2 - strb r0, [r1, 0xB] - ldr r0, [r4] - ldr r1, [r0, 0x4] - adds r1, r3, r1 - ldrb r0, [r1, 0x13] - orrs r0, r6 - strb r0, [r1, 0x13] - ldr r0, [r4] - ldr r1, [r0, 0x4] - adds r1, r3, r1 - ldrb r0, [r1, 0x14] - orrs r0, r6 - strb r0, [r1, 0x14] - adds r3, 0x1C - subs r5, 0x1 - cmp r5, 0 - bge _080D78CC - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0, 0x8] - movs r1, 0 - movs r2, 0x14 - bl memset - ldr r0, [r4] - ldr r0, [r0, 0xC] - movs r1, 0 - movs r2, 0x44 - bl memset - ldr r2, [r4] - ldr r1, [r2, 0x10] - movs r0, 0 - str r0, [r1] - ldr r0, [r2, 0x14] - movs r1, 0 - movs r2, 0x10 - bl memset - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080D7938 - movs r0, 0 - bl sub_80DCE58 -_080D7938: - movs r5, 0 - adds r2, r4, 0 - movs r6, 0xFF - movs r3, 0 - ldr r4, =gUnknown_02039F26 -_080D7942: - ldr r0, [r2] - ldr r1, [r0, 0x4] - adds r1, r3, r1 - ldrb r0, [r1, 0x19] - orrs r0, r6 - strb r0, [r1, 0x19] - ldr r0, [r2] - ldr r1, [r0] - adds r1, 0x14 - adds r1, r5 - adds r0, r5, r4 - ldrb r0, [r0] - strb r0, [r1] - adds r3, 0x1C - adds r5, 0x1 - cmp r5, 0x3 - ble _080D7942 - bl sub_80DD590 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x1C] - movs r1, 0 - movs r2, 0x40 - bl memset - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D787C - - thumb_func_start sub_80D7988 -sub_80D7988: @ 80D7988 - push {r4,r5,lr} - ldr r4, =gContestResources - movs r0, 0x40 - bl AllocZeroed - str r0, [r4] - movs r0, 0x5C - bl AllocZeroed - ldr r1, [r4] - str r0, [r1] - movs r0, 0x70 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x4] - movs r0, 0x14 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x8] - movs r0, 0x44 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0xC] - movs r0, 0x10 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x10] - movs r0, 0x10 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x14] - movs r0, 0x14 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x18] - movs r0, 0x40 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x1C] - movs r0, 0xC - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x20] - movs r5, 0x80 - lsls r5, 5 - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x24] - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x28] - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x2C] - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x30] - movs r5, 0x80 - lsls r5, 4 - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x34] - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x38] - movs r0, 0x80 - lsls r0, 6 - bl AllocZeroed - ldr r2, [r4] - str r0, [r2, 0x3C] - ldr r1, =gUnknown_0202305C - str r0, [r1] - ldr r1, =gUnknown_02023060 - ldr r0, [r2, 0x28] - str r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7988 - - thumb_func_start sub_80D7A5C -sub_80D7A5C: @ 80D7A5C - push {r4,r5,lr} - ldr r5, =gContestResources - ldr r0, [r5] - ldr r0, [r0] - bl Free - ldr r0, [r5] - movs r4, 0 - str r4, [r0] - ldr r0, [r0, 0x4] - bl Free - ldr r0, [r5] - str r4, [r0, 0x4] - ldr r0, [r0, 0x8] - bl Free - ldr r0, [r5] - str r4, [r0, 0x8] - ldr r0, [r0, 0xC] - bl Free - ldr r0, [r5] - str r4, [r0, 0xC] - ldr r0, [r0, 0x10] - bl Free - ldr r0, [r5] - str r4, [r0, 0x10] - ldr r0, [r0, 0x14] - bl Free - ldr r0, [r5] - str r4, [r0, 0x14] - ldr r0, [r0, 0x18] - bl Free - ldr r0, [r5] - str r4, [r0, 0x18] - ldr r0, [r0, 0x1C] - bl Free - ldr r0, [r5] - str r4, [r0, 0x1C] - ldr r0, [r0, 0x20] - bl Free - ldr r0, [r5] - str r4, [r0, 0x20] - ldr r0, [r0, 0x24] - bl Free - ldr r0, [r5] - str r4, [r0, 0x24] - ldr r0, [r0, 0x28] - bl Free - ldr r0, [r5] - str r4, [r0, 0x28] - ldr r0, [r0, 0x2C] - bl Free - ldr r0, [r5] - str r4, [r0, 0x2C] - ldr r0, [r0, 0x30] - bl Free - ldr r0, [r5] - str r4, [r0, 0x30] - ldr r0, [r0, 0x34] - bl Free - ldr r0, [r5] - str r4, [r0, 0x34] - ldr r0, [r0, 0x38] - bl Free - ldr r0, [r5] - str r4, [r0, 0x38] - ldr r0, [r0, 0x3C] - bl Free - ldr r0, [r5] - str r4, [r0, 0x3C] - bl Free - str r4, [r5] - ldr r0, =gUnknown_0202305C - str r4, [r0] - ldr r0, =gUnknown_02023060 - str r4, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7A5C - - thumb_func_start sub_80D7B24 -sub_80D7B24: @ 80D7B24 - push {r4-r6,lr} - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r6, r0, r1 - ldrb r5, [r6] - cmp r5, 0x1 - beq _080D7BD4 - cmp r5, 0x1 - bgt _080D7B44 - cmp r5, 0 - beq _080D7B4E - b _080D7C56 - .pool -_080D7B44: - cmp r5, 0x2 - beq _080D7BDA - cmp r5, 0x3 - beq _080D7C04 - b _080D7C56 -_080D7B4E: - ldr r0, =gUnknown_02039F38 - strb r5, [r0] - bl sub_80D7988 - bl AllocateMonSpritesGfx - ldr r4, =gMonSpritesGfxPtr - ldr r0, [r4] - ldr r0, [r0] - bl Free - ldr r0, [r4] - str r5, [r0] - movs r0, 0x80 - lsls r0, 7 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1] - movs r0, 0 - bl SetVBlankCallback - bl sub_80D779C - bl sub_80D77E4 - bl sub_80D7678 - bl ScanlineEffect_Clear - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - bl ResetSpriteData - bl ResetTasks - bl FreeAllSpritePalettes - ldr r1, =gReservedSpritePaletteCount - movs r0, 0x4 - strb r0, [r1] - ldr r0, =gHeap - movs r1, 0xD0 - lsls r1, 9 - adds r0, r1 - strb r5, [r0] - bl ClearBattleMonForms - bl sub_80D787C - b _080D7BF6 - .pool -_080D7BD4: - movs r0, 0x2 - strb r0, [r6] - b _080D7C56 -_080D7BDA: - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - adds r0, 0x59 - bl sub_80D7E44 - lsls r0, 24 - cmp r0, 0 - beq _080D7C56 - ldr r0, [r4] - ldr r0, [r0] - adds r0, 0x59 - movs r1, 0 - strb r1, [r0] -_080D7BF6: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _080D7C56 - .pool -_080D7C04: - bl sub_80DE224 - ldr r0, =gBattle_BG1_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - movs r0, 0x2 - bl BeginFastPaletteFade - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - ldr r0, =vblank_cb_battle - bl SetVBlankCallback - ldr r0, =sub_80D7C7C - movs r1, 0xA - bl CreateTask - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1] - strb r0, [r1, 0x8] - ldr r0, =sub_80D823C - bl SetMainCallback2 - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080D7C56 - bl sub_800E0E8 - movs r0, 0x8 - movs r1, 0x8 - bl CreateWirelessStatusIndicatorSprite -_080D7C56: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7B24 - - thumb_func_start sub_80D7C7C -sub_80D7C7C: @ 80D7C7C - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _080D7CA2 - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - strh r2, [r1, 0x8] - ldr r0, =sub_80D7CB4 - str r0, [r1] -_080D7CA2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7C7C - - thumb_func_start sub_80D7CB4 -sub_80D7CB4: @ 80D7CB4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D7D90 - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080D7D3A - ldr r2, =gTasks - lsls r1, r5, 2 - adds r0, r1, r5 - lsls r0, 3 - adds r4, r0, r2 - movs r2, 0x8 - ldrsh r0, [r4, r2] - adds r6, r1, 0 - cmp r0, 0x1 - beq _080D7D04 - cmp r0, 0x1 - bgt _080D7CF4 - cmp r0, 0 - beq _080D7CFA - b _080D7D3A - .pool -_080D7CF4: - cmp r0, 0x2 - beq _080D7D28 - b _080D7D3A -_080D7CFA: - bl sub_80DBF68 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080D7D04: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080D7D9E - bl sub_800ADF8 - ldr r0, =gTasks - adds r1, r6, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080D7D9E - .pool -_080D7D28: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080D7D9E - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080D7D3A: - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080D7D9E - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _080D7D62 - bl sub_80DBF68 -_080D7D62: - ldr r0, =sub_80D7DAC - movs r1, 0 - bl CreateTask - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - ldr r1, =TaskDummy1 - str r1, [r0] - b _080D7D9E - .pool -_080D7D90: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80D80C8 - str r0, [r1] -_080D7D9E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7CB4 - - thumb_func_start sub_80D7DAC -sub_80D7DAC: @ 80D7DAC - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =sub_80FC998 - ldr r2, =sub_80D7DC8 - bl SetTaskFuncWithFollowupFunc - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7DAC - - thumb_func_start sub_80D7DC8 -sub_80D7DC8: @ 80D7DC8 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0x1 - strh r0, [r1, 0x8] - ldr r0, =sub_80D7DE8 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_80D7DC8 - - thumb_func_start sub_80D7DE8 -sub_80D7DE8: @ 80D7DE8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r5, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r5 - ldrh r1, [r0, 0x8] - subs r1, 0x1 - strh r1, [r0, 0x8] - lsls r1, 16 - cmp r1, 0 - bgt _080D7E2A - bl GetMultiplayerId - adds r0, r4, 0 - bl DestroyTask - 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, r5 - ldr r1, =sub_80D80C8 - str r1, [r0] - ldr r1, =gRngValue - ldr r0, =gUnknown_030060B8 - ldr r0, [r0] - str r0, [r1] -_080D7E2A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7DE8 - - thumb_func_start sub_80D7E44 -sub_80D7E44: @ 80D7E44 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x40 - mov r10, r0 - ldrb r0, [r0] - cmp r0, 0x6 - bls _080D7E5A - b _080D80A4 -_080D7E5A: - lsls r0, 2 - ldr r1, =_080D7E68 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D7E68: - .4byte _080D7E84 - .4byte _080D7EC8 - .4byte _080D7ED8 - .4byte _080D7F28 - .4byte _080D7F40 - .4byte _080D7F7C - .4byte _080D8004 -_080D7E84: - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - movs r1, 0xC0 - lsls r1, 19 - movs r4, 0x80 - lsls r4, 8 - movs r0, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl RequestDma3Fill - ldr r1, =0x06008000 - movs r0, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl RequestDma3Fill - ldr r1, =0x06010000 - movs r0, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl RequestDma3Fill - b _080D80AE - .pool -_080D7EC8: - ldr r0, =gUnknown_08C17AB0 - movs r1, 0xC0 - lsls r1, 19 - bl LZDecompressVram - b _080D80AE - .pool -_080D7ED8: - ldr r0, =gUnknown_08C1850C - ldr r4, =0x06002000 - adds r1, r4, 0 - bl LZDecompressVram - ldr r3, =gHeap+0x18000 - movs r5, 0x80 - lsls r5, 6 - ldr r1, =0x040000d4 - ldr r6, =0x84000400 - movs r2, 0x80 - lsls r2, 5 - movs r7, 0x84 - lsls r7, 24 -_080D7EF4: - str r4, [r1] - str r3, [r1, 0x4] - str r6, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r4, r2 - adds r3, r2 - subs r5, r2 - cmp r5, r2 - bhi _080D7EF4 - str r4, [r1] - str r3, [r1, 0x4] - lsrs r0, r5, 2 - orrs r0, r7 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - b _080D80AE - .pool -_080D7F28: - ldr r1, =gUnknown_08C16FA8 - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _080D80AE - .pool -_080D7F40: - ldr r1, =gUnknown_08C17170 - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x2C] - ldr r2, =gHeap+0x1AA04 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x84000200 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - b _080D80AE - .pool -_080D7F7C: - ldr r0, =gUnknown_08C16E90 - movs r2, 0x80 - lsls r2, 2 - movs r1, 0 - bl LoadCompressedPalette - ldr r5, =gPlttBufferUnfaded + 0x100 - ldr r6, =0x04000008 - adds r0, r5, 0 - mov r1, sp - adds r2, r6, 0 - bl CpuSet - ldr r0, =gUnknown_02039F25 - mov r9, r0 - ldrb r0, [r0] - adds r0, 0x5 - lsls r0, 5 - ldr r1, =0xffffff00 - adds r1, r5 - mov r8, r1 - add r0, r8 - add r4, sp, 0x20 - adds r1, r4, 0 - adds r2, r6, 0 - bl CpuSet - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl CpuSet - mov r2, r9 - ldrb r1, [r2] - adds r1, 0x5 - lsls r1, 5 - add r1, r8 - mov r0, sp - adds r2, r6, 0 - bl CpuSet - ldr r1, =gHeap+0x1A004 - ldr r0, =0x040000d4 - mov r2, r8 - str r2, [r0] - str r1, [r0, 0x4] - ldr r1, =0x84000080 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - bl sub_80D782C - b _080D80AE - .pool -_080D8004: - bl sub_80DD04C - bl sub_80DBF90 - bl sub_80DB2BC - bl sub_80DB120 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1] - movs r4, 0 - strb r0, [r1, 0x12] - bl sub_80DC2BC - bl sub_80DC4F0 - bl sub_80DC594 - bl sub_80DC5E8 - bl sub_80DC7EC - ldr r1, =gBattlerPositions - strb r4, [r1] - movs r0, 0x1 - strb r0, [r1, 0x1] - movs r3, 0x3 - strb r3, [r1, 0x2] - movs r2, 0x2 - strb r2, [r1, 0x3] - ldr r0, =gBattleTypeFlags - str r4, [r0] - ldr r4, =gBattlerAttacker - strb r2, [r4] - ldr r0, =gBattlerTarget - strb r3, [r0] - bl sub_80DB0C4 - ldr r2, =gBattlerSpriteIds - ldrb r1, [r4] - adds r1, r2 - strb r0, [r1] - bl sub_80DEA20 - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - b _080D80AE - .pool -_080D80A4: - movs r0, 0 - mov r1, r10 - strb r0, [r1] - movs r0, 0x1 - b _080D80B8 -_080D80AE: - mov r2, r10 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - movs r0, 0 -_080D80B8: - add sp, 0x40 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80D7E44 - - thumb_func_start sub_80D80C8 -sub_80D80C8: @ 80D80C8 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, =gPaletteFade - ldrb r2, [r1, 0x8] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1, 0x8] - ldrb r1, [r1, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _080D80F8 - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - strh r2, [r1, 0x8] - strh r2, [r1, 0xA] - ldr r0, =sub_80D8108 - str r0, [r1] -_080D80F8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D80C8 - - thumb_func_start sub_80D8108 -sub_80D8108: @ 80D8108 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r2, r1, 0 - cmp r0, 0x4 - bhi _080D8208 - lsls r0, 2 - ldr r1, =_080D8138 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D8138: - .4byte _080D814C - .4byte _080D8176 - .4byte _080D8194 - .4byte _080D81B0 - .4byte _080D8208 -_080D814C: - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r2 - ldrh r0, [r4, 0xA] - adds r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - ble _080D822C - movs r0, 0 - strh r0, [r4, 0xA] - movs r0, 0x61 - movs r1, 0 - bl PlaySE12WithPanning - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080D822C -_080D8176: - ldr r1, =gBattle_BG1_Y - ldrh r0, [r1] - adds r0, 0x7 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA0 - ble _080D822C - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r2 - b _080D81FA - .pool -_080D8194: - bl sub_80DE350 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080D822C - .pool -_080D81B0: - 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 - bl sub_80DDB0C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 -_080D81FA: - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _080D822C - .pool -_080D8208: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _080D822C - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r2 - strh r1, [r0, 0x8] - strh r1, [r0, 0xA] - ldr r1, =sub_80D833C - str r1, [r0] -_080D822C: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D8108 - - thumb_func_start sub_80D823C -sub_80D823C: @ 80D823C - push {r4,r5,lr} - bl AnimateSprites - bl RunTasks - bl BuildOamBuffer - bl UpdatePaletteFade - movs r4, 0 -_080D8250: - ldr r5, =gUnknown_02039F38 - ldrb r0, [r5] - asrs r0, r4 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D8266 - lsls r0, r4, 24 - lsrs r0, 24 - bl CopyBgTilemapBufferToVram -_080D8266: - adds r4, 0x1 - cmp r4, 0x3 - ble _080D8250 - movs r0, 0 - strb r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D823C - - thumb_func_start vblank_cb_battle -vblank_cb_battle: @ 80D827C - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, =gBattle_BG3_X - ldrh r1, [r0] - movs r0, 0x1C - bl SetGpuReg - ldr r0, =gBattle_BG3_Y - ldrh r1, [r0] - movs r0, 0x1E - bl SetGpuReg - ldr r0, =gBattle_WIN0H - ldrh r1, [r0] - movs r0, 0x40 - bl SetGpuReg - ldr r0, =gBattle_WIN0V - ldrh r1, [r0] - movs r0, 0x44 - bl SetGpuReg - ldr r0, =gBattle_WIN1H - ldrh r1, [r0] - movs r0, 0x42 - bl SetGpuReg - ldr r0, =gBattle_WIN1V - ldrh r1, [r0] - movs r0, 0x46 - bl SetGpuReg - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - bl ScanlineEffect_InitHBlankDmaTransfer - pop {r0} - bx r0 - .pool - thumb_func_end vblank_cb_battle - - thumb_func_start sub_80D833C -sub_80D833C: @ 80D833C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r0, 0x8 - ldrsh r1, [r4, r0] - cmp r1, 0 - bne _080D840C - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - bl sub_80DCD48 - ldr r1, =gPlttBufferUnfaded - ldr r2, =gHeap+0x1A204 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x84000100 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - ldr r0, =gStringVar1 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1] - ldrb r1, [r1, 0x1] - adds r1, 0x1 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_02039F25 - ldrb r0, [r0] - bl sub_80DBCA8 - lsls r0, 24 - cmp r0, 0 - bne _080D83CC - ldr r0, =gDisplayedStringBattle - ldr r1, =gText_0827D507 - bl StringCopy - b _080D83D4 - .pool -_080D83CC: - ldr r0, =gDisplayedStringBattle - ldr r1, =gText_0827D531 - bl StringCopy -_080D83D4: - bl sub_80DB89C - ldr r4, =gStringVar4 - ldr r1, =gDisplayedStringBattle - 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 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _080D841A - .pool -_080D840C: - bl sub_80DED4C - cmp r0, 0 - bne _080D841A - strh r0, [r4, 0x8] - ldr r0, =sub_80D8424 - str r0, [r4] -_080D841A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D833C - - thumb_func_start sub_80D8424 -sub_80D8424: @ 80D8424 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080D843C - cmp r1, 0x2 - bne _080D8482 -_080D843C: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_02039F25 - ldrb r0, [r0] - bl sub_80DBCA8 - lsls r0, 24 - cmp r0, 0 - bne _080D8474 - movs r0, 0x1 - bl sub_80DC490 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80D8490 - b _080D8480 - .pool -_080D8474: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80D8894 -_080D8480: - str r0, [r1] -_080D8482: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D8424 - - thumb_func_start sub_80D8490 -sub_80D8490: @ 80D8490 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r0, =gBattle_BG0_Y - movs r1, 0xA0 - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - movs r6, 0 - ldr r0, =gUnknown_02039F25 - mov r8, r0 - ldr r2, =gUnknown_02039E00 + 30 - mov r10, r2 - ldr r7, =gContestResources -_080D84B8: - lsls r1, r6, 1 - mov r0, r8 - ldrb r2, [r0] - lsls r0, r2, 6 - adds r1, r0 - add r1, r10 - ldrh r4, [r1] - add r5, sp, 0x4 - ldr r0, [r7] - ldr r1, [r0, 0x4] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0, 0x8] - cmp r0, 0 - beq _080D853C - adds r0, r2, 0 - bl sub_80DE1E8 - lsls r0, 24 - cmp r0, 0 - beq _080D853C - ldr r0, [r7] - mov r2, r8 - ldrb r1, [r2] - ldr r2, [r0, 0x4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x8] - adds r1, r4, 0 - bl AreMovesContestCombo - lsls r0, 24 - cmp r0, 0 - beq _080D853C - ldr r0, [r7] - mov r2, r8 - ldrb r1, [r2] - ldr r2, [r0, 0x4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x15] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D853C - add r0, sp, 0x4 - ldr r1, =gText_ColorLightShadowDarkGrey - b _080D8566 - .pool -_080D853C: - cmp r4, 0 - beq _080D856C - ldr r0, [r7] - mov r2, r8 - ldrb r1, [r2] - ldr r2, [r0, 0x4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x8] - cmp r0, r4 - bne _080D856C - ldr r0, =gContestMoves - lsls r1, r4, 3 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0x3 - beq _080D856C - add r0, sp, 0x4 - ldr r1, =gText_ColorBlue -_080D8566: - bl StringCopy - adds r5, r0, 0 -_080D856C: - movs r0, 0xD - adds r1, r4, 0 - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r5, 0 - bl StringCopy - adds r4, r6, 0x5 - lsls r0, r4, 24 - lsrs r0, 24 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x7 - str r0, [sp] - adds r0, r4, 0 - add r1, sp, 0x4 - movs r2, 0x5 - movs r3, 0x1 - bl sub_80DEBD0 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _080D84B8 - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bl sub_80D880C - ldr r2, =gUnknown_02039E00 - ldr r0, [r4] - ldr r0, [r0] - ldrb r1, [r0] - lsls r1, 1 - ldr r0, =gUnknown_02039F25 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r0, [r1] - bl prints_contest_move_description - ldr r1, =gTasks - mov r2, r9 - lsls r0, r2, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80D8610 - str r1, [r0] - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D8490 - - thumb_func_start sub_80D8610 -sub_80D8610: @ 80D8610 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - movs r6, 0 - ldr r3, =gMain - ldr r1, =gUnknown_02039E00 - ldr r0, =gUnknown_02039F25 - ldrb r0, [r0] - lsls r0, 6 - adds r1, 0x1E - adds r1, r0, r1 - movs r2, 0x3 -_080D8628: - ldrh r0, [r1] - cmp r0, 0 - beq _080D8634 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_080D8634: - adds r1, 0x2 - subs r2, 0x1 - cmp r2, 0 - bge _080D8628 - ldrh r0, [r3, 0x2E] - movs r5, 0x1 - ands r5, r0 - cmp r5, 0 - beq _080D8670 - movs r0, 0x5 - bl PlaySE - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80D8894 - str r0, [r1] - b _080D87FA - .pool -_080D8670: - ldrh r0, [r3, 0x30] - cmp r0, 0x20 - bne _080D8678 - b _080D87FA -_080D8678: - cmp r0, 0x20 - bgt _080D8682 - cmp r0, 0x2 - beq _080D868E - b _080D87FA -_080D8682: - cmp r0, 0x40 - beq _080D8730 - cmp r0, 0x80 - bne _080D868C - b _080D879C -_080D868C: - b _080D87FA -_080D868E: - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl sub_80DC490 - ldr r0, =gStringVar1 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1] - ldrb r1, [r1, 0x1] - adds r1, 0x1 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_02039F25 - ldrb r0, [r0] - bl sub_80DBCA8 - lsls r0, 24 - cmp r0, 0 - bne _080D86DC - ldr r0, =gDisplayedStringBattle - ldr r1, =gText_0827D507 - bl StringCopy - b _080D86E4 - .pool -_080D86DC: - ldr r0, =gDisplayedStringBattle - ldr r1, =gText_0827D531 - bl StringCopy -_080D86E4: - bl sub_80DB89C - ldr r4, =gStringVar4 - ldr r1, =gDisplayedStringBattle - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_80DEC30 - ldr r0, =gBattle_BG0_Y - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80D8424 - str r1, [r0] - b _080D87FA - .pool -_080D8730: - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bl sub_80D883C - ldr r0, [r4] - ldr r1, [r0] - ldrb r0, [r1] - cmp r0, 0 - bne _080D8754 - subs r0, r6, 0x1 - b _080D8756 - .pool -_080D8754: - subs r0, 0x1 -_080D8756: - strb r0, [r1] - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bl sub_80D880C - ldr r2, =gUnknown_02039E00 - ldr r0, [r4] - ldr r0, [r0] - ldrb r1, [r0] - lsls r1, 1 - ldr r0, =gUnknown_02039F25 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r0, [r1] - bl prints_contest_move_description - cmp r6, 0x1 - bls _080D87FA - movs r0, 0x5 - bl PlaySE - b _080D87FA - .pool -_080D879C: - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bl sub_80D883C - ldr r0, [r4] - ldr r1, [r0] - ldrb r2, [r1] - subs r0, r6, 0x1 - cmp r2, r0 - bne _080D87C0 - strb r5, [r1] - b _080D87C4 - .pool -_080D87C0: - adds r0, r2, 0x1 - strb r0, [r1] -_080D87C4: - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bl sub_80D880C - ldr r2, =gUnknown_02039E00 - ldr r0, [r4] - ldr r0, [r0] - ldrb r1, [r0] - lsls r1, 1 - ldr r0, =gUnknown_02039F25 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r0, [r1] - bl prints_contest_move_description - cmp r6, 0x1 - bls _080D87FA - movs r0, 0x5 - bl PlaySE -_080D87FA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D8610 - - thumb_func_start sub_80D880C -sub_80D880C: @ 80D880C - push {lr} - sub sp, 0x10 - adds r3, r0, 0 - lsls r3, 25 - movs r0, 0xF8 - lsls r0, 21 - adds r3, r0 - lsrs r3, 24 - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - str r0, [sp, 0xC] - movs r0, 0x2 - movs r1, 0x37 - movs r2, 0 - bl sub_80DECB8 - add sp, 0x10 - pop {r0} - bx r0 - thumb_func_end sub_80D880C - - thumb_func_start sub_80D883C -sub_80D883C: @ 80D883C - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x10 - adds r4, r0, 0 - lsls r4, 24 - asrs r4, 23 - adds r3, r4, 0 - adds r3, 0x1F - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x2 - mov r8, r0 - str r0, [sp] - movs r5, 0x1 - str r5, [sp, 0x4] - movs r6, 0x11 - str r6, [sp, 0x8] - str r5, [sp, 0xC] - movs r1, 0xB - movs r2, 0 - bl sub_80DECB8 - adds r4, 0x20 - lsls r4, 24 - lsrs r4, 24 - mov r0, r8 - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - str r5, [sp, 0xC] - movs r0, 0x2 - movs r1, 0xB - movs r2, 0 - adds r3, r4, 0 - bl sub_80DECB8 - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D883C - - thumb_func_start sub_80D8894 -sub_80D8894: @ 80D8894 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D890C - ldr r4, =gUnknown_02039F25 - 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, =gHeap+0x1A604 - 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, =gUnknown_02039F2A - 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} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r2, =gContestResources - ldr r0, [r2] - ldr r0, [r0] - ldrb r6, [r0, 0x11] - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r4, 0x8 - ldrsh r0, [r0, r4] - mov r9, r2 - adds r4, r1, 0 - cmp r0, 0x3B - bls _080D8B6E - bl _080DA100 -_080D8B6E: - lsls r0, 2 - ldr r1, =_080D8B84 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D8B84: - .4byte _080D8C74 - .4byte _080D8D30 - .4byte _080D8D56 - .4byte _080D8DC4 - .4byte _080D8E7C - .4byte _080D8EC8 - .4byte _080D8F84 - .4byte _080D8FB8 - .4byte _080D9010 - .4byte _080D908C - .4byte _080D9FC0 - .4byte _080D9FEC - .4byte _080D9238 - .4byte _080D926C - .4byte _080D9774 - .4byte _080D9864 - .4byte _080D98D4 - .4byte _080D9904 - .4byte _080D99EC - .4byte _080D999E - .4byte _080DA024 - .4byte _080DA0A0 - .4byte _080DA0C2 - .4byte _080D90B4 - .4byte _080D9180 - .4byte _080D9388 - .4byte _080D939E - .4byte _080D947C - .4byte _080D94A0 - .4byte _080D9508 - .4byte _080D95EC - .4byte _080DA038 - .4byte _080DA080 - .4byte _080D9EBC - .4byte _080D9F48 - .4byte _080D929A - .4byte _080D92D0 - .4byte _080D92F6 - .4byte _080D9334 - .4byte _080D955C - .4byte _080D95C4 - .4byte _080D9A2C - .4byte _080DA100 - .4byte _080D9DAC - .4byte _080DA100 - .4byte _080D9830 - .4byte _080D997C - .4byte _080D921A - .4byte _080D91A4 - .4byte _080D91F4 - .4byte _080D935C - .4byte _080D9690 - .4byte _080D971C - .4byte _080D9BAA - .4byte _080D9C68 - .4byte _080D9F68 - .4byte _080D9F84 - .4byte _080D9DD4 - .4byte _080D9E60 - .4byte _080D9EA0 -_080D8C74: - bl sub_80DCD48 - movs r7, 0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0] - ldr r0, [r0, 0x8] - ldrb r1, [r1, 0x10] - mov r5, r8 - lsls r5, 2 - mov r10, r5 - ldrb r2, [r0] - cmp r1, r2 - beq _080D8C9C - adds r2, r0, 0 -_080D8C92: - adds r7, 0x1 - adds r0, r2, r7 - ldrb r0, [r0] - cmp r1, r0 - bne _080D8C92 -_080D8C9C: - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - strb r7, [r0, 0x11] - ldr r0, [r4] - ldr r2, [r0] - ldrb r6, [r2, 0x11] - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _080D8D14 - ldrb r0, [r2, 0x7] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x7] - bl sub_80DA8A4 - lsls r0, 24 - cmp r0, 0 - beq _080D8CD4 - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DD080 -_080D8CD4: - 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 - ldr r1, =gTasks - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x8] - bl _080DA100 - .pool -_080D8D14: - adds r0, r6, 0 - bl sub_80DD080 - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x2 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D8D30: - mov r3, r9 - ldr r0, [r3] - ldr r0, [r0] - ldrb r1, [r0, 0x7] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D8D44 - bl _080DA100 -_080D8D44: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x8] - bl _080DA100 -_080D8D56: - adds r0, r6, 0 - bl sub_80DF080 - bl sub_80DF750 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r2, r0, r1 - ldrb r1, [r2, 0xC] - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - bne _080D8D86 - ldrb r1, [r2, 0xB] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _080D8DA4 -_080D8D86: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1F - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D8DA4: - bl sub_80DB89C - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - strh r6, [r1, 0x1C] - movs r0, 0x3 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D8DC4: - mov r4, r8 - lsls r4, 2 - mov r10, r4 - ldr r1, =gBattleMonForms - movs r2, 0 - adds r0, r1, 0x3 -_080D8DD0: - strb r2, [r0] - subs r0, 0x1 - cmp r0, r1 - bge _080D8DD0 - movs r7, 0x4 - mov r5, r9 - ldr r0, [r5] - ldr r0, [r0, 0x18] - movs r1, 0 - movs r2, 0x14 - bl memset - ldr r0, [r5] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DE9DC - ldr r4, =gUnknown_02039E00 - ldr r0, [r5] - ldr r0, [r0] - ldrb r3, [r0, 0x11] - lsls r2, r3, 6 - adds r0, r2, r4 - ldrh r0, [r0] - adds r1, r4, 0 - adds r1, 0x3C - adds r1, r2, r1 - ldr r1, [r1] - adds r4, 0x38 - adds r2, r4 - ldr r2, [r2] - bl sub_80DB174 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r3, r0, r2 - movs r1, 0x78 - strh r1, [r3, 0x24] - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_80DA134 - str r1, [r0] - ldr r0, =gTasks - mov r4, r10 - add r4, r8 - lsls r4, 3 - adds r4, r0 - strh r5, [r4, 0xC] - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - adds r0, r1 - strb r5, [r0] - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DC9EC - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80DCBE8 - strh r7, [r4, 0x8] - bl _080DA100 - .pool -_080D8E7C: - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r2, r0, r4 - ldrb r5, [r2, 0xC] - ldr r1, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _080D8EA0 - bl _080DA100 -_080D8EA0: - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080D8EB8 - bl _080DA100 -_080D8EB8: - movs r0, 0x5 - strh r0, [r2, 0x8] - bl _080DA100 - .pool -_080D8EC8: - mov r5, r9 - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r5, r0, 2 - adds r1, r5, r1 - ldrb r1, [r1, 0xC] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D8EF2 - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x21 - strh r1, [r0, 0x8] - bl _080DA100 -_080D8EF2: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 - adds r1, r2 - bl StringCopy - mov r2, r9 - ldr r0, [r2] - ldr r0, [r0, 0x4] - adds r3, r5, r0 - ldrh r1, [r3, 0x6] - movs r0, 0xB1 - lsls r0, 1 - cmp r1, r0 - bhi _080D8F38 - ldr r0, =gStringVar2 - adds r2, r1, 0 - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - b _080D8F48 - .pool -_080D8F38: - ldr r0, =gStringVar2 - ldr r2, =gUnknown_08587F1C - ldrb r1, [r3, 0xA] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy -_080D8F48: - ldr r4, =gStringVar4 - ldr r1, =gText_0827D55A - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x6 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D8F84: - bl sub_80DED4C - adds r1, r0, 0 - cmp r1, 0 - beq _080D8F92 - bl _080DA100 -_080D8F92: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x5A - strb r1, [r0] - ldr r1, =gTasks - mov r4, r8 - lsls r0, r4, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x7 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D8FB8: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r1] - ldrb r2, [r0, 0x11] - ldr r1, [r1, 0x4] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0, 0x6] - bl sub_80DE834 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, [r5] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DE864 - ldr r0, [r5] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DE9DC - adds r0, r4, 0 - bl sub_80DEAA8 - adds r0, r4, 0 - bl DoMoveAnim - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9010: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r4, [r0] - cmp r4, 0 - beq _080D9024 - bl _080DA100 -_080D9024: - adds r0, r6, 0 - bl sub_80DE9B0 - ldr r0, =gContestResources - ldr r1, [r0] - ldr r0, [r1] - adds r0, 0x5A - ldrb r0, [r0] - cmp r0, 0 - beq _080D9060 - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - strh r4, [r1, 0x1C] - movs r0, 0x9 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9060: - ldr r1, [r1, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _080D907A - adds r0, r6, 0 - bl sub_80DC674 -_080D907A: - bl sub_80DE12C - ldr r0, =gTasks - mov r4, r8 - lsls r1, r4, 2 - b _080D9192 - .pool -_080D908C: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r2, r0, r4 - ldrh r0, [r2, 0x1C] - adds r1, r0, 0x1 - strh r1, [r2, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - bgt _080D90A8 - bl _080DA100 -_080D90A8: - movs r0, 0 - strh r0, [r2, 0x1C] - movs r0, 0x7 - strh r0, [r2, 0x8] - bl _080DA100 -_080D90B4: - mov r0, r8 - lsls r2, r0, 2 - adds r0, r2, r0 - lsls r0, 3 - adds r7, r0, r4 - movs r0, 0 - strh r0, [r7, 0xA] - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x4] - mov r12, r0 - lsls r1, r6, 3 - subs r0, r1, r6 - lsls r5, r0, 2 - mov r0, r12 - adds r3, r5, r0 - ldrb r0, [r3, 0x13] - mov r10, r2 - str r1, [sp, 0x4] - cmp r0, 0xFF - beq _080D90FA - ldrb r1, [r3, 0x13] - adds r0, r6, 0 - bl sub_80DD45C - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r0, r5, r0 - movs r1, 0xFF - strb r1, [r0, 0x13] - movs r0, 0x18 - strh r0, [r7, 0x8] - bl _080DA100 -_080D90FA: - ldrb r0, [r3, 0x14] - cmp r0, 0xFF - beq _080D9178 - movs r7, 0 - cmp r7, r6 - beq _080D910E - mov r2, r12 - ldrb r0, [r2, 0x13] - cmp r0, 0xFF - bne _080D912C -_080D910E: - adds r7, 0x1 - cmp r7, 0x3 - bgt _080D912C - cmp r7, r6 - beq _080D910E - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x4] - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x13] - cmp r0, 0xFF - beq _080D910E -_080D912C: - cmp r7, 0x4 - bne _080D9168 - mov r4, r9 - ldr r0, [r4] - ldr r0, [r0, 0x4] - ldr r5, [sp, 0x4] - subs r4, r5, r6 - lsls r4, 2 - adds r0, r4, r0 - ldrb r1, [r0, 0x14] - adds r0, r6, 0 - bl sub_80DD45C - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r4, r0 - movs r0, 0xFF - strb r0, [r4, 0x14] - ldr r1, =gTasks - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x18 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9168: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x30 - strh r1, [r0, 0x8] - bl _080DA100 -_080D9178: - movs r0, 0x30 - strh r0, [r7, 0x8] - bl _080DA100 -_080D9180: - bl sub_80DED4C - cmp r0, 0 - beq _080D918C - bl _080DA100 -_080D918C: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 -_080D9192: - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x17 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D91A4: - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x11] - movs r3, 0x3 - ands r3, r0 - cmp r3, 0x1 - bne _080D91C4 - movs r0, 0x5 - bl sub_80DD720 - b _080D91DA -_080D91C4: - cmp r3, 0x2 - bne _080D91D0 - movs r0, 0x6 - bl sub_80DD720 - b _080D91DA -_080D91D0: - cmp r3, 0x3 - bne _080D9208 - movs r0, 0x7 - bl sub_80DD720 -_080D91DA: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x31 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D91F4: - mov r3, r9 - ldr r0, [r3] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D9208 - bl _080DA100 -_080D9208: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x2F - strh r1, [r0, 0x8] - bl _080DA100 -_080D921A: - movs r0, 0x1 - bl sub_80DE008 - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0xC - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9238: - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - movs r4, 0x2 - ldrsh r1, [r0, r4] - movs r0, 0 - adds r2, r6, 0 - bl sub_80DC028 - ldr r1, =gTasks - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0xD - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D926C: - mov r0, r9 - ldr r1, [r0] - ldr r0, [r1] - ldrb r0, [r0, 0x11] - ldr r1, [r1, 0x14] - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D9288 - bl _080DA100 -_080D9288: - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x23 - strh r1, [r0, 0x8] - bl _080DA100 -_080D929A: - mov r2, r9 - ldr r0, [r2] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x10] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0x10 - bne _080D92B8 - movs r0, 0x8 - bl sub_80DD720 -_080D92B8: - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x24 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D92D0: - mov r5, r9 - ldr r0, [r5] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D92E4 - bl _080DA100 -_080D92E4: - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x25 - strh r1, [r0, 0x8] - bl _080DA100 -_080D92F6: - adds r0, r6, 0 - movs r1, 0x1 - bl sub_80DB5B8 - lsls r0, 24 - cmp r0, 0 - beq _080D9320 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - movs r1, 0x26 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9320: - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - b _080D9354 - .pool -_080D9334: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r4 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - bgt _080D9350 - bl _080DA100 -_080D9350: - movs r0, 0 - strh r0, [r1, 0x1C] -_080D9354: - movs r0, 0x32 - strh r0, [r1, 0x8] - bl _080DA100 -_080D935C: - adds r0, r6, 0 - bl sub_80DB798 - lsls r0, 24 - cmp r0, 0 - beq _080D936E - movs r0, 0x63 - bl PlaySE -_080D936E: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x19 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9388: - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0 - strh r1, [r0, 0xA] - movs r1, 0x1A - strh r1, [r0, 0x8] - bl _080DA100 -_080D939E: - movs r3, 0 - movs r5, 0 - str r5, [sp] - mov r0, r8 - lsls r1, r0, 2 - adds r0, r1, r0 - lsls r0, 3 - adds r0, r4 - movs r2, 0xA - ldrsh r7, [r0, r2] - mov r10, r1 - cmp r7, 0x3 - bgt _080D9418 - ldr r5, =gUnknown_02039F26 - ldr r2, =gContestResources -_080D93BC: - movs r3, 0 - str r3, [sp] - adds r0, r3, 0 - cmp r0, r6 - beq _080D93E4 - ldrb r0, [r5] - cmp r0, r7 - bne _080D93E4 - ldr r0, [r2] - ldr r0, [r0, 0x4] - ldrb r0, [r0, 0x13] - cmp r0, 0xFF - beq _080D93E4 - movs r1, 0x1 - str r1, [sp] - b _080D940C - .pool -_080D93E4: - adds r3, 0x1 - cmp r3, 0x3 - bgt _080D940C - cmp r3, r6 - beq _080D93E4 - adds r0, r3, r5 - ldrb r0, [r0] - cmp r0, r7 - bne _080D93E4 - ldr r0, [r2] - ldr r1, [r0, 0x4] - lsls r0, r3, 3 - subs r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x13] - cmp r0, 0xFF - beq _080D93E4 - movs r0, 0x1 - str r0, [sp] -_080D940C: - ldr r1, [sp] - cmp r1, 0 - bne _080D9422 - adds r7, 0x1 - cmp r7, 0x3 - ble _080D93BC -_080D9418: - ldr r2, [sp] - lsls r0, r2, 24 - asrs r2, r0, 24 - cmp r2, 0 - beq _080D9464 -_080D9422: - mov r5, r10 - add r5, r8 - lsls r5, 3 - adds r5, r4 - ldr r0, =gUnknown_02039F26 - adds r0, r3, r0 - ldrb r0, [r0] - strh r0, [r5, 0xA] - lsls r0, r3, 24 - lsrs r0, 24 - mov r4, r9 - ldr r1, [r4] - ldr r1, [r1, 0x4] - lsls r4, r3, 3 - subs r4, r3 - lsls r4, 2 - adds r1, r4, r1 - ldrb r1, [r1, 0x13] - bl sub_80DD45C - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r4, r0 - movs r0, 0xFF - strb r0, [r4, 0x13] - movs r0, 0x1B - strh r0, [r5, 0x8] - bl _080DA100 - .pool -_080D9464: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r2, [r0, 0xA] - strh r2, [r0, 0x1C] - movs r1, 0x33 - strh r1, [r0, 0x8] - bl sub_80DB884 - bl _080DA100 -_080D947C: - bl sub_80DED4C - cmp r0, 0 - beq _080D9488 - bl _080DA100 -_080D9488: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1C - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D94A0: - movs r7, 0 - mov r3, r8 - lsls r0, r3, 2 - adds r1, r0, r3 - lsls r1, 3 - adds r1, r4 - movs r4, 0xA - ldrsh r2, [r1, r4] - ldr r1, =gUnknown_02039F26 - mov r10, r0 - adds r5, r1, 0 - ldrb r0, [r5] - cmp r2, r0 - beq _080D94CA - adds r1, r2, 0 - adds r2, r5, 0 -_080D94C0: - adds r7, 0x1 - adds r0, r7, r2 - ldrb r0, [r0] - cmp r1, r0 - bne _080D94C0 -_080D94CA: - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x4] - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0xE] - ldrh r0, [r0, 0x2] - adds r0, r1 - lsls r0, 16 - asrs r0, 16 - negs r1, r1 - lsls r2, r7, 24 - lsrs r2, 24 - bl sub_80DC028 - ldr r1, =gTasks - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1D - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9508: - movs r7, 0 - mov r2, r8 - lsls r0, r2, 2 - adds r1, r0, r2 - lsls r1, 3 - adds r1, r4 - movs r5, 0xA - ldrsh r3, [r1, r5] - ldr r1, =gUnknown_02039F26 - mov r10, r0 - adds r5, r1, 0 - ldrb r0, [r5] - cmp r3, r0 - beq _080D952E -_080D9524: - adds r7, 0x1 - adds r0, r7, r1 - ldrb r0, [r0] - cmp r3, r0 - bne _080D9524 -_080D952E: - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x14] - lsls r0, r7, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D9546 - bl _080DA100 -_080D9546: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x27 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D955C: - movs r7, 0 - mov r2, r8 - lsls r0, r2, 2 - adds r1, r0, r2 - lsls r1, 3 - adds r1, r4 - movs r3, 0xA - ldrsh r2, [r1, r3] - ldr r1, =gUnknown_02039F26 - mov r10, r0 - adds r5, r1, 0 - ldrb r4, [r5] - cmp r2, r4 - beq _080D9586 - adds r1, r2, 0 - adds r2, r5, 0 -_080D957C: - adds r7, 0x1 - adds r0, r7, r2 - ldrb r0, [r0] - cmp r1, r0 - bne _080D957C -_080D9586: - lsls r0, r7, 24 - lsrs r0, 24 - movs r1, 0x1 - bl sub_80DB5B8 - lsls r0, 24 - cmp r0, 0 - beq _080D95B4 - ldr r1, =gTasks - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - movs r1, 0x28 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D95B4: - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - b _080D95E4 - .pool -_080D95C4: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r4 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - bgt _080D95E0 - bl _080DA100 -_080D95E0: - movs r0, 0 - strh r0, [r1, 0x1C] -_080D95E4: - movs r0, 0x1E - strh r0, [r1, 0x8] - bl _080DA100 -_080D95EC: - movs r7, 0 - ldr r2, =gUnknown_02039F26 - ldrb r3, [r2] - mov r0, r8 - lsls r1, r0, 2 - adds r0, r1, r0 - lsls r0, 3 - adds r4, r0, r4 - movs r5, 0xA - ldrsh r0, [r4, r5] - mov r10, r1 - adds r5, r2, 0 - cmp r3, r0 - beq _080D961E - adds r3, r5, 0 - adds r2, r4, 0 -_080D960C: - adds r7, 0x1 - cmp r7, 0x3 - bgt _080D961E - adds r0, r7, r3 - ldrb r1, [r0] - movs r4, 0xA - ldrsh r0, [r2, r4] - cmp r1, r0 - bne _080D960C -_080D961E: - lsls r4, r7, 24 - lsrs r0, r4, 24 - bl sub_80DB798 - lsls r0, 24 - adds r6, r4, 0 - cmp r0, 0 - beq _080D963C - movs r0, 0x63 - bl PlaySE - b _080D9642 - .pool -_080D963C: - movs r0, 0x64 - bl PlaySE -_080D9642: - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r0, r7, 3 - subs r0, r7 - lsls r4, r0, 2 - adds r1, r4, r1 - ldrb r1, [r1, 0x15] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080D9670 - lsrs r0, r6, 24 - bl sub_80DC674 - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x15] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x15] -_080D9670: - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - movs r0, 0x1A - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9690: - mov r5, r8 - lsls r2, r5, 2 - adds r0, r2, r5 - lsls r0, 3 - adds r4, r0, r4 - ldrh r0, [r4, 0x1C] - adds r1, r0, 0x1 - strh r1, [r4, 0x1C] - lsls r0, 16 - asrs r0, 16 - mov r10, r2 - cmp r0, 0x9 - bgt _080D96AE - bl _080DA100 -_080D96AE: - movs r0, 0 - strh r0, [r4, 0x1C] - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r2, r0, r1 - ldrb r1, [r2, 0xC] - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - bne _080D96D4 - ldrb r1, [r2, 0x11] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D96F6 -_080D96D4: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E793 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 -_080D96F6: - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x34 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D971C: - bl sub_80DED4C - cmp r0, 0 - beq _080D9728 - bl _080DA100 -_080D9728: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _080D975C - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x11 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D975C: - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0xE - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9774: - mov r4, r9 - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x16] - lsls r4, r0, 24 - lsrs r5, r4, 24 - cmp r5, 0 - beq _080D97DC - bl sub_80DB89C - asrs r0, r4, 24 - cmp r0, 0x1 - bne _080D97A0 - ldr r0, =gText_0827E32E - b _080D97A6 - .pool -_080D97A0: - cmp r0, 0x2 - bne _080D97B4 - ldr r0, =gText_0827E35B -_080D97A6: - movs r1, 0x1 - bl sub_80DEC30 - b _080D97BC - .pool -_080D97B4: - ldr r0, =gText_0827E38D - movs r1, 0x1 - bl sub_80DEC30 -_080D97BC: - movs r0, 0x3 - bl sub_80DD720 - ldr r1, =gTasks - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - b _080D9812 - .pool -_080D97DC: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E2FE - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - movs r0, 0x2 - bl sub_80DD720 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x1C] -_080D9812: - movs r1, 0x2D - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9830: - mov r3, r9 - ldr r0, [r3] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D9844 - bl _080DA100 -_080D9844: - ldrb r0, [r2, 0x11] - bl sub_80DC9B4 - ldr r1, =gTasks - mov r4, r8 - lsls r0, r4, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0xF - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9864: - bl sub_80DED4C - cmp r0, 0 - beq _080D9870 - bl _080DA100 -_080D9870: - ldr r1, =gTasks - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x1C] - adds r0, 0x1 - strh r0, [r4, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x32 - bgt _080D988E - bl _080DA100 -_080D988E: - ldr r7, =gContestResources - ldr r0, [r7] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r5, r0, 2 - adds r2, r5, r1 - ldrb r1, [r2, 0x15] - movs r0, 0x10 - mov r8, r0 - ands r0, r1 - cmp r0, 0 - bne _080D98C2 - movs r1, 0x2 - ldrsh r0, [r2, r1] - ldrb r1, [r2, 0x17] - adds r2, r6, 0 - bl sub_80DC028 - ldr r0, [r7] - ldr r1, [r0, 0x4] - adds r1, r5, r1 - ldrh r0, [r1, 0x2] - ldrb r2, [r1, 0x17] - adds r0, r2 - strh r0, [r1, 0x2] -_080D98C2: - mov r3, r8 - strh r3, [r4, 0x8] - bl _080DA100 - .pool -_080D98D4: - mov r5, r9 - ldr r0, [r5] - ldr r1, [r0, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _080D98F0 - bl _080DA100 -_080D98F0: - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r1, [r0, 0x1C] - movs r1, 0x11 - strh r1, [r0, 0x8] - bl _080DA100 -_080D9904: - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D996C - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E6E3 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r0, =gTasks - mov r5, r8 - lsls r4, r5, 2 - add r4, r8 - lsls r4, 3 - adds r4, r0 - movs r0, 0 - strh r0, [r4, 0x1C] - bl sub_80DD720 - movs r0, 0x2E - strh r0, [r4, 0x8] - b _080DA100 - .pool -_080D996C: - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x29 - strh r1, [r0, 0x8] - b _080DA100 -_080D997C: - mov r2, r9 - ldr r0, [r2] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D998E - b _080DA100 -_080D998E: - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x13 - strh r1, [r0, 0x8] - b _080DA100 -_080D999E: - bl sub_80DED4C - cmp r0, 0 - beq _080D99A8 - b _080DA100 -_080D99A8: - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r4, r6, 3 - subs r4, r6 - lsls r4, 2 - adds r1, r4, r1 - movs r2, 0x2 - ldrsh r0, [r1, r2] - ldrb r1, [r1, 0x18] - negs r1, r1 - adds r2, r6, 0 - bl sub_80DC028 - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r4, r0 - ldrb r1, [r4, 0x18] - ldrh r0, [r4, 0x2] - subs r0, r1 - strh r0, [r4, 0x2] - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x12 - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D99EC: - bl sub_80DCD48 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _080D9A0A - b _080DA100 -_080D9A0A: - ldr r0, =gTasks - mov r5, r8 - lsls r4, r5, 2 - add r4, r8 - lsls r4, 3 - adds r4, r0 - strh r3, [r4, 0x1C] - bl sub_80DB89C - movs r0, 0x29 - strh r0, [r4, 0x8] - b _080DA100 - .pool -_080D9A2C: - mov r1, r9 - ldr r0, [r1] - ldr r2, [r0, 0x10] - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D9A56 - ldr r0, [r2] - lsls r0, 20 - lsrs r0, 29 - cmp r6, r0 - beq _080D9A56 - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x39 - strh r1, [r0, 0x8] - b _080DA100 -_080D9A56: - mov r3, r9 - ldr r1, [r3] - ldr r0, [r1, 0x10] - ldrb r0, [r0] - str r0, [sp] - ldr r1, [r1, 0x4] - lsls r2, r6, 3 - subs r0, r2, r6 - lsls r0, 2 - adds r5, r0, r1 - ldrb r1, [r5, 0x11] - movs r0, 0x10 - ands r0, r1 - str r2, [sp, 0x4] - cmp r0, 0 - beq _080D9A94 - movs r4, 0x1 - str r4, [sp] - ldr r0, =gStringVar3 - ldrh r2, [r5, 0x6] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - b _080D9AAE - .pool -_080D9A94: - ldr r0, =gStringVar3 - ldr r3, =gUnknown_08587F08 - ldr r2, =gContestMoves - ldrh r1, [r5, 0x6] - lsls r1, 3 - adds r1, r2 - ldrb r1, [r1, 0x1] - lsls r1, 29 - lsrs r1, 27 - adds r1, r3 - ldr r1, [r1] - bl StringCopy -_080D9AAE: - ldr r5, [sp] - lsls r0, r5, 24 - cmp r0, 0 - ble _080D9AD2 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - ldr r2, [sp, 0x4] - subs r0, r2, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D9AD2 - movs r3, 0 - str r3, [sp] -_080D9AD2: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gContestResources - ldr r0, [r4] - ldr r1, [r0] - ldrb r0, [r1, 0x13] - ldr r5, [sp] - lsls r2, r5, 24 - asrs r3, r2, 24 - adds r0, r3, r0 - strb r0, [r1, 0x13] - ldr r0, [r4] - ldr r1, [r0] - movs r0, 0x13 - ldrsb r0, [r1, r0] - adds r5, r2, 0 - cmp r0, 0 - bge _080D9B06 - movs r0, 0 - strb r0, [r1, 0x13] -_080D9B06: - cmp r3, 0 - bne _080D9B30 - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - b _080D9F58 - .pool -_080D9B30: - cmp r3, 0 - bge _080D9B48 - ldr r0, =gStringVar4 - ldr r1, =gText_0827E73C - bl StringExpandPlaceholders - b _080D9B74 - .pool -_080D9B48: - cmp r3, 0 - ble _080D9B6C - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0, 0x13] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x4 - bgt _080D9B6C - ldr r0, =gStringVar4 - ldr r1, =gText_0827E717 - bl StringExpandPlaceholders - b _080D9B74 - .pool -_080D9B6C: - ldr r0, =gStringVar4 - ldr r1, =gText_0827E76A - bl StringExpandPlaceholders -_080D9B74: - ldr r0, =gStringVar4 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - movs r0, 0 - strh r0, [r1, 0x1C] - strh r0, [r1, 0x1E] - cmp r5, 0 - bge _080D9BA4 - movs r0, 0x35 - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080D9BA4: - movs r0, 0x36 - strh r0, [r1, 0x8] - b _080DA100 -_080D9BAA: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r4, r0, r4 - movs r0, 0x1C - ldrsh r3, [r4, r0] - cmp r3, 0x1 - beq _080D9BE8 - cmp r3, 0x1 - bgt _080D9BC6 - cmp r3, 0 - beq _080D9BD0 - b _080DA100 -_080D9BC6: - cmp r3, 0x2 - beq _080D9C0C - cmp r3, 0x3 - beq _080D9C46 - b _080DA100 -_080D9BD0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x1 - bl sub_80DDED0 - ldr r0, =0x00000187 - bl PlayFanfare - b _080D9C3E - .pool -_080D9BE8: - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0] - ldrb r0, [r0, 0x7] - ands r3, r0 - cmp r3, 0 - beq _080D9BF8 - b _080DA100 -_080D9BF8: - bl sub_80DED4C - cmp r0, 0 - beq _080D9C02 - b _080DA100 -_080D9C02: - movs r0, 0x1 - negs r0, r0 - bl sub_80DDCDC - b _080D9C3E -_080D9C0C: - mov r2, r9 - ldr r0, [r2] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x20 - ands r0, r1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _080D9C22 - b _080DA100 -_080D9C22: - ldrh r0, [r4, 0x1E] - adds r1, r0, 0x1 - strh r1, [r4, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1D - bgt _080D9C32 - b _080DA100 -_080D9C32: - strh r2, [r4, 0x1E] - movs r1, 0x1 - negs r1, r1 - adds r0, r1, 0 - bl sub_80DDED0 -_080D9C3E: - ldrh r0, [r4, 0x1C] - adds r0, 0x1 - strh r0, [r4, 0x1C] - b _080DA100 -_080D9C46: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080D9C58 - b _080DA100 -_080D9C58: - strh r0, [r4, 0x1C] - strh r0, [r4, 0x1E] - movs r0, 0x2B - strh r0, [r4, 0x8] - b _080DA100 - .pool -_080D9C68: - mov r3, r8 - lsls r1, r3, 2 - adds r0, r1, r3 - lsls r0, 3 - adds r0, r4 - movs r5, 0x1C - ldrsh r0, [r0, r5] - mov r10, r1 - cmp r0, 0x4 - bls _080D9C7E - b _080DA100 -_080D9C7E: - lsls r0, 2 - ldr r1, =_080D9C8C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D9C8C: - .4byte _080D9CA0 - .4byte _080D9CB0 - .4byte _080D9CD4 - .4byte _080D9D3E - .4byte _080D9D84 -_080D9CA0: - bl sub_80DED4C - cmp r0, 0 - beq _080D9CAA - b _080DA100 -_080D9CAA: - movs r0, 0x1 - movs r1, 0x1 - b _080D9D68 -_080D9CB0: - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0] - ldrb r1, [r0, 0x7] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D9CC2 - b _080DA100 -_080D9CC2: - bl sub_80DDE0C - movs r0, 0xDF - bl PlaySE - movs r0, 0x1 - bl sub_80DDCDC - b _080D9D6C -_080D9CD4: - mov r3, r9 - ldr r2, [r3] - ldr r0, [r2] - ldrb r1, [r0, 0x6] - movs r0, 0x20 - ands r0, r1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _080D9CEA - b _080DA100 -_080D9CEA: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r5, r0, r4 - ldrh r0, [r5, 0x1E] - adds r1, r0, 0x1 - strh r1, [r5, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1D - bgt _080D9D02 - b _080DA100 -_080D9D02: - strh r3, [r5, 0x1E] - ldr r0, [r2, 0x4] - lsls r4, r6, 3 - subs r4, r6 - lsls r4, 2 - adds r0, r4, r0 - movs r1, 0x2 - ldrsh r0, [r0, r1] - ldr r1, [r2, 0x10] - ldrb r1, [r1, 0x2] - lsls r1, 24 - asrs r1, 24 - adds r2, r6, 0 - bl sub_80DC028 - mov r2, r9 - ldr r1, [r2] - ldr r0, [r1, 0x4] - adds r4, r0 - ldr r0, [r1, 0x10] - ldrb r0, [r0, 0x2] - lsls r0, 24 - asrs r0, 24 - ldrh r3, [r4, 0x2] - adds r0, r3 - strh r0, [r4, 0x2] - ldrh r0, [r5, 0x1C] - adds r0, 0x1 - strh r0, [r5, 0x1C] - b _080DA100 -_080D9D3E: - mov r4, r9 - ldr r2, [r4] - ldr r1, [r2, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D9D54 - b _080DA100 -_080D9D54: - ldr r0, [r2] - ldrb r1, [r0, 0x6] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080D9D62 - b _080DA100 -_080D9D62: - movs r1, 0x1 - negs r1, r1 - movs r0, 0x1 -_080D9D68: - bl sub_80DDED0 -_080D9D6C: - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - b _080DA100 - .pool -_080D9D84: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _080D9D96 - b _080DA100 -_080D9D96: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r3, [r0, 0x1C] - strh r3, [r0, 0x1E] - movs r1, 0x2B - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D9DAC: - mov r5, r9 - ldr r0, [r5] - ldr r1, [r0, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D9DC2 - b _080DA100 -_080D9DC2: - bl sub_80DB89C - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - b _080D9F58 - .pool -_080D9DD4: - bl sub_80DB89C - ldr r0, =gStringVar3 - ldr r5, =gContestResources - ldr r1, [r5] - ldr r1, [r1, 0x10] - ldr r1, [r1] - lsls r1, 20 - lsrs r1, 29 - lsls r1, 6 - ldr r4, =gUnknown_02039E00 + 2 - adds r1, r4 - bl StringCopy - ldr r0, =gStringVar1 - lsls r1, r6, 6 - adds r1, r4 - bl StringCopy - ldr r0, =gStringVar2 - ldr r1, [r5] - ldr r2, [r1, 0x4] - lsls r1, r6, 3 - subs r1, r6 - lsls r1, 2 - adds r1, r2 - ldrh r2, [r1, 0x6] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E7EA - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x3A - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D9E60: - bl sub_80DED4C - cmp r0, 0 - beq _080D9E6A - b _080DA100 -_080D9E6A: - bl sub_80DB89C - ldr r4, =gStringVar4 - ldr r1, =gText_0827E817 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r4, r8 - lsls r0, r4, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x3B - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D9EA0: - bl sub_80DED4C - cmp r0, 0 - beq _080D9EAA - b _080DA100 -_080D9EAA: - bl sub_80DB89C - ldr r0, =gTasks - mov r5, r8 - lsls r1, r5, 2 - b _080D9F58 - .pool -_080D9EBC: - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r4, r0, 2 - adds r2, r4, r1 - ldrb r1, [r2, 0x15] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D9EDC - movs r0, 0x11 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x15] -_080D9EDC: - adds r0, r6, 0 - bl sub_80DC9B4 - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 - adds r1, r2 - bl StringCopy - ldr r0, =gStringVar2 - mov r2, r9 - ldr r1, [r2] - ldr r1, [r1, 0x4] - adds r1, r4, r1 - ldrh r2, [r1, 0x6] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E58A - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x22 - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D9F48: - bl sub_80DED4C - cmp r0, 0 - beq _080D9F52 - b _080DA100 -_080D9F52: - ldr r0, =gTasks - mov r4, r8 - lsls r1, r4, 2 -_080D9F58: - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x37 - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080D9F68: - bl sub_80DDBE8 - ldr r0, =gTasks - mov r5, r8 - lsls r1, r5, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x38 - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080D9F84: - mov r1, r9 - ldr r0, [r1] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _080D9F9A - b _080DA100 -_080D9F9A: - movs r0, 0x13 - ldrsb r0, [r2, r0] - cmp r0, 0x4 - ble _080D9FA8 - strb r1, [r2, 0x13] - bl sub_80DD940 -_080D9FA8: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0xA - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080D9FC0: - mov r3, r8 - lsls r2, r3, 2 - add r2, r8 - lsls r2, 3 - adds r2, r4 - ldrb r5, [r2, 0xC] - ldr r1, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80DA164 - str r1, [r0] - movs r0, 0xB - strh r0, [r2, 0x8] - b _080DA100 - .pool -_080D9FEC: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r4, r0, r4 - ldrb r5, [r4, 0xC] - ldr r1, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r6, r0, r1 - adds r0, r6, 0 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _080DA100 - adds r0, r6, 0 - bl FreeSpriteOamMatrix - adds r0, r6, 0 - bl DestroySprite - movs r0, 0x14 - strh r0, [r4, 0x8] - b _080DA100 - .pool -_080DA024: - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0 - strh r1, [r0, 0x1C] - movs r1, 0x15 - strh r1, [r0, 0x8] - b _080DA100 -_080DA038: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827D56F - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x20 - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080DA080: - bl sub_80DED4C - cmp r0, 0 - bne _080DA100 - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x15 - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080DA0A0: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r4 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1D - ble _080DA100 - movs r0, 0 - strh r0, [r1, 0x1C] - movs r0, 0x16 - strh r0, [r1, 0x8] - b _080DA100 -_080DA0C2: - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1, 0x10] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bne _080DA0F4 - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r2, [r0, 0x8] - strh r2, [r0, 0xA] - strh r2, [r0, 0xC] - ldr r1, =sub_80DA198 - str r1, [r0] - b _080DA100 - .pool -_080DA0F4: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r2, [r0, 0x8] -_080DA100: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80D8B38 - - 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, =gUnknown_02039F2A - 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, =gHeap+0x1A204 - 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, =gUnknown_02039F25 - 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, =gUnknown_02039E00 + 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} - 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, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080DA65C - ldr r0, =gContestResources - ldr r2, [r0] - ldr r0, =gUnknown_02039F25 - 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, =gUnknown_030060B8 - 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, =gUnknown_02039F2A - 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 -sub_80DA884: @ 80DA884 - push {lr} - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080DA898 - ldr r1, =gUnknown_02039F25 - movs r0, 0x3 - strb r0, [r1] -_080DA898: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DA884 - - thumb_func_start sub_80DA8A4 -sub_80DA8A4: @ 80DA8A4 - push {lr} - ldr r0, =gUnknown_02039F25 - ldr r1, =gUnknown_02039F2B - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - beq _080DA8C0 - movs r0, 0 - b _080DA8C2 - .pool -_080DA8C0: - movs r0, 0x1 -_080DA8C2: - pop {r1} - bx r1 - thumb_func_end sub_80DA8A4 - - thumb_func_start sub_80DA8C8 -sub_80DA8C8: @ 80DA8C8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r6, =gSaveBlock2Ptr - ldr r1, [r6] - mov r0, sp - bl StringCopy - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080DA8F2 - mov r0, sp - bl sub_80DF9D4 -_080DA8F2: - ldr r5, =gUnknown_02039F25 - ldrb r0, [r5] - lsls r0, 6 - ldr r4, =gUnknown_02039E00 + 13 - adds r0, r4 - mov r1, sp - movs r2, 0x8 - bl memcpy - ldr r0, [r6] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _080DA928 - ldrb r0, [r5] - lsls r0, 6 - adds r0, r4, r0 - movs r1, 0xD8 - b _080DA930 - .pool -_080DA928: - ldrb r0, [r5] - lsls r0, 6 - adds r0, r4, r0 - movs r1, 0xD9 -_080DA930: - strb r1, [r0, 0x8] - ldr r7, =gUnknown_02039E00 - ldr r6, =gUnknown_02039F25 - ldrb r0, [r6] - lsls r0, 6 - adds r1, r7, 0 - adds r1, 0x18 - adds r0, r1 - movs r1, 0 - str r1, [r0] - ldrb r0, [r6] - lsls r0, 6 - adds r0, r7 - adds r0, 0x2C - strb r1, [r0] - movs r0, 0x64 - mov r1, r8 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - strh r0, [r1] - adds r0, r5, 0 - movs r1, 0x2 - mov r2, sp - bl GetMonData - mov r0, sp - bl StringGetEnd10 - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080DA994 - adds r0, r5, 0 - movs r1, 0x3 - bl GetMonData - adds r1, r0, 0 - mov r0, sp - bl sub_80DF9E0 -_080DA994: - ldrb r0, [r6] - lsls r0, 6 - adds r4, r7, 0x2 - adds r0, r4 - mov r1, sp - movs r2, 0xB - bl memcpy - ldrb r0, [r6] - lsls r0, 6 - adds r0, r4 - mov r1, sp - bl StringCopy - adds r0, r5, 0 - movs r1, 0x16 - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - adds r1, 0x26 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x17 - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - adds r1, 0x27 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x18 - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - adds r1, 0x28 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x21 - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - adds r1, 0x29 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x2F - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - adds r1, 0x2A - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x30 - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - adds r1, 0x2B - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0xD - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - strh r0, [r1, 0x1E] - adds r0, r5, 0 - movs r1, 0xE - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - strh r0, [r1, 0x20] - adds r0, r5, 0 - movs r1, 0xF - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - strh r0, [r1, 0x22] - adds r0, r5, 0 - movs r1, 0x10 - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r1, r7 - strh r0, [r1, 0x24] - adds r0, r5, 0 - movs r1, 0 - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r2, r7, 0 - adds r2, 0x38 - adds r1, r2 - str r0, [r1] - adds r0, r5, 0 - movs r1, 0x1 - bl GetMonData - ldrb r1, [r6] - lsls r1, 6 - adds r2, r7, 0 - adds r2, 0x3C - adds r1, r2 - str r0, [r1] - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r2, r0, 16 - ldrb r0, [r6] - lsls r0, 6 - adds r1, r0, r7 - adds r0, r1, 0 - adds r0, 0x26 - ldrb r3, [r0] - adds r0, 0x1 - ldrb r5, [r0] - adds r0, 0x1 - ldrb r6, [r0] - adds r0, 0x1 - ldrb r7, [r0] - adds r0, 0x1 - ldrb r4, [r0] - cmp r2, 0xFE - bne _080DAAC4 - adds r3, 0x14 - b _080DAB12 - .pool -_080DAAC4: - cmp r2, 0xFF - bne _080DAAD4 - lsls r0, r5, 16 - movs r1, 0xA0 - lsls r1, 13 - adds r0, r1 - lsrs r5, r0, 16 - b _080DAB12 -_080DAAD4: - movs r0, 0x80 - lsls r0, 1 - cmp r2, r0 - bne _080DAAE8 - lsls r0, r6, 16 - movs r1, 0xA0 - lsls r1, 13 - adds r0, r1 - lsrs r6, r0, 16 - b _080DAB12 -_080DAAE8: - ldr r0, =0x00000101 - cmp r2, r0 - bne _080DAB00 - lsls r0, r7, 16 - movs r1, 0xA0 - lsls r1, 13 - adds r0, r1 - lsrs r7, r0, 16 - b _080DAB12 - .pool -_080DAB00: - movs r0, 0x81 - lsls r0, 1 - cmp r2, r0 - bne _080DAB12 - lsls r0, r4, 16 - movs r1, 0xA0 - lsls r1, 13 - adds r0, r1 - lsrs r4, r0, 16 -_080DAB12: - cmp r3, 0xFF - ble _080DAB18 - movs r3, 0xFF -_080DAB18: - lsls r0, r5, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _080DAB22 - movs r5, 0xFF -_080DAB22: - lsls r0, r6, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _080DAB2C - movs r6, 0xFF -_080DAB2C: - lsls r0, r7, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _080DAB36 - movs r7, 0xFF -_080DAB36: - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _080DAB40 - movs r4, 0xFF -_080DAB40: - ldr r2, =gUnknown_02039E00 - ldr r1, =gUnknown_02039F25 - ldrb r0, [r1] - lsls r0, 6 - adds r0, r2 - adds r0, 0x26 - strb r3, [r0] - ldrb r0, [r1] - lsls r0, 6 - adds r0, r2 - adds r0, 0x27 - strb r5, [r0] - ldrb r0, [r1] - lsls r0, 6 - adds r0, r2 - adds r0, 0x28 - strb r6, [r0] - ldrb r0, [r1] - lsls r0, 6 - adds r0, r2 - adds r0, 0x29 - strb r7, [r0] - ldrb r0, [r1] - lsls r0, 6 - adds r0, r2 - adds r0, 0x2A - strb r4, [r0] - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DA8C8 - - thumb_func_start sub_80DAB8C -sub_80DAB8C: @ 80DAB8C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x64 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - movs r6, 0 - movs r7, 0 - bl sub_80DA884 - ldr r0, =0x00000864 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080DABC0 - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080DABC0 - movs r7, 0x1 -_080DABC0: - movs r5, 0 - ldr r2, =gUnknown_085880A4 - ldr r3, =gUnknown_085898A4 -_080DABC6: - ldrb r0, [r2, 0x1C] - lsls r0, 30 - lsrs r0, 30 - cmp r8, r0 - bne _080DAC3A - cmp r7, 0x1 - bne _080DABEC - ldrb r0, [r3] - cmp r0, 0x1 - beq _080DAC3A - b _080DABF2 - .pool -_080DABEC: - ldrb r0, [r3] - cmp r0, 0x2 - beq _080DAC3A -_080DABF2: - cmp r4, 0 - bne _080DABFE - ldrb r0, [r2, 0x1C] - lsls r0, 29 - cmp r0, 0 - blt _080DAC2E -_080DABFE: - cmp r4, 0x1 - bne _080DAC0A - ldrb r0, [r2, 0x1C] - lsls r0, 28 - cmp r0, 0 - blt _080DAC2E -_080DAC0A: - cmp r4, 0x2 - bne _080DAC16 - ldrb r0, [r2, 0x1C] - lsls r0, 27 - cmp r0, 0 - blt _080DAC2E -_080DAC16: - cmp r4, 0x3 - bne _080DAC22 - ldrb r0, [r2, 0x1C] - lsls r0, 26 - cmp r0, 0 - blt _080DAC2E -_080DAC22: - cmp r4, 0x4 - bne _080DAC3A - ldrb r0, [r2, 0x1C] - lsls r0, 25 - cmp r0, 0 - bge _080DAC3A -_080DAC2E: - adds r0, r6, 0 - adds r1, r0, 0x1 - lsls r1, 24 - lsrs r6, r1, 24 - add r0, sp - strb r5, [r0] -_080DAC3A: - adds r2, 0x40 - adds r3, 0x1 - adds r5, 0x1 - cmp r5, 0x5F - bls _080DABC6 - mov r0, sp - adds r1, r0, r6 - movs r0, 0xFF - strb r0, [r1] - movs r5, 0 - ldr r7, =gUnknown_085880A4 -_080DAC50: - bl Random - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl __modsi3 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gUnknown_02039E00 - lsls r2, r5, 6 - adds r2, r1 - mov r1, sp - adds r4, r1, r0 - ldrb r1, [r4] - lsls r1, 6 - adds r1, r7 - adds r0, r2, 0 - movs r2, 0x40 - bl memcpy - ldrb r0, [r4] - adds r2, r5, 0x1 - subs r1, r6, 0x1 - cmp r0, 0xFF - beq _080DAC92 - adds r3, r4, 0 -_080DAC86: - ldrb r0, [r3, 0x1] - strb r0, [r3] - adds r3, 0x1 - ldrb r0, [r3] - cmp r0, 0xFF - bne _080DAC86 -_080DAC92: - lsls r0, r1, 24 - lsrs r6, r0, 24 - adds r5, r2, 0 - cmp r5, 0x2 - ble _080DAC50 - ldr r0, =gUnknown_02039F24 - ldrb r0, [r0] - bl sub_80DA8C8 - add sp, 0x64 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DAB8C - - thumb_func_start sub_80DACBC -sub_80DACBC: @ 80DACBC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x64 - mov r8, r2 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - movs r7, 0 - ldr r0, =gUnknown_02039F30 - ldrb r1, [r0] - mov r9, r0 - cmp r1, 0x4 - bne _080DACDE - b _080DADF6 -_080DACDE: - movs r5, 0 - ldr r3, =gUnknown_085880A4 - ldr r6, =gUnknown_085898A4 -_080DACE4: - ldrb r0, [r3, 0x1C] - lsls r0, 30 - lsrs r0, 30 - cmp r2, r0 - bne _080DAD56 - mov r0, r8 - cmp r0, 0x1 - bne _080DAD08 - ldrb r0, [r6] - cmp r0, 0x1 - beq _080DAD56 - b _080DAD0E - .pool -_080DAD08: - ldrb r0, [r6] - cmp r0, 0x2 - beq _080DAD56 -_080DAD0E: - cmp r4, 0 - bne _080DAD1A - ldrb r0, [r3, 0x1C] - lsls r0, 29 - cmp r0, 0 - blt _080DAD4A -_080DAD1A: - cmp r4, 0x1 - bne _080DAD26 - ldrb r0, [r3, 0x1C] - lsls r0, 28 - cmp r0, 0 - blt _080DAD4A -_080DAD26: - cmp r4, 0x2 - bne _080DAD32 - ldrb r0, [r3, 0x1C] - lsls r0, 27 - cmp r0, 0 - blt _080DAD4A -_080DAD32: - cmp r4, 0x3 - bne _080DAD3E - ldrb r0, [r3, 0x1C] - lsls r0, 26 - cmp r0, 0 - blt _080DAD4A -_080DAD3E: - cmp r4, 0x4 - bne _080DAD56 - ldrb r0, [r3, 0x1C] - lsls r0, 25 - cmp r0, 0 - bge _080DAD56 -_080DAD4A: - adds r0, r7, 0 - adds r1, r0, 0x1 - lsls r1, 24 - lsrs r7, r1, 24 - add r0, sp - strb r5, [r0] -_080DAD56: - adds r3, 0x40 - adds r6, 0x1 - adds r5, 0x1 - cmp r5, 0x5F - bls _080DACE4 - mov r3, sp - adds r1, r3, r7 - movs r0, 0xFF - strb r0, [r1] - movs r5, 0 - mov r0, r9 - ldrb r1, [r0] - movs r0, 0x4 - subs r0, r1 - cmp r5, r0 - bge _080DADF6 - ldr r3, =gUnknown_02039E00 - mov r8, r3 - mov r6, r9 - movs r0, 0x2 - add r0, r8 - mov r9, r0 -_080DAD82: - bl sub_80F903C - lsls r0, 16 - lsrs r0, 16 - adds r1, r7, 0 - bl __modsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldrb r0, [r6] - adds r0, r5 - lsls r0, 6 - add r0, r8 - ldr r2, =gUnknown_085880A4 - mov r3, sp - adds r4, r3, r1 - ldrb r1, [r4] - lsls r1, 6 - adds r1, r2 - movs r2, 0x40 - bl memcpy - ldrb r0, [r6] - adds r0, r5 - lsls r0, 6 - mov r1, r8 - adds r1, 0xD - adds r0, r1 - bl sub_80DF9D4 - ldrb r0, [r6] - adds r0, r5 - lsls r0, 6 - add r0, r9 - movs r1, 0x2 - bl sub_80DF9E0 - ldrb r0, [r4] - adds r3, r5, 0x1 - subs r1, r7, 0x1 - cmp r0, 0xFF - beq _080DADE6 - adds r2, r4, 0 -_080DADDA: - ldrb r0, [r2, 0x1] - strb r0, [r2] - adds r2, 0x1 - ldrb r0, [r2] - cmp r0, 0xFF - bne _080DADDA -_080DADE6: - lsls r0, r1, 24 - lsrs r7, r0, 24 - adds r5, r3, 0 - ldrb r1, [r6] - movs r0, 0x4 - subs r0, r1 - cmp r5, r0 - blt _080DAD82 -_080DADF6: - add sp, 0x64 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DACBC - - thumb_func_start sub_80DAE0C -sub_80DAE0C: @ 80DAE0C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - beq _080DAE1E - movs r0, 0x3 - b _080DAE9A -_080DAE1E: - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _080DAE2E - movs r0, 0x4 - b _080DAE9A -_080DAE2E: - ldr r0, =gSpecialVar_ContestCategory - ldrh r0, [r0] - cmp r0, 0x4 - bhi _080DAE82 - lsls r0, 2 - ldr r1, =_080DAE48 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DAE48: - .4byte _080DAE5C - .4byte _080DAE62 - .4byte _080DAE68 - .4byte _080DAE6E - .4byte _080DAE74 -_080DAE5C: - adds r0, r4, 0 - movs r1, 0x32 - b _080DAE78 -_080DAE62: - adds r0, r4, 0 - movs r1, 0x33 - b _080DAE78 -_080DAE68: - adds r0, r4, 0 - movs r1, 0x34 - b _080DAE78 -_080DAE6E: - adds r0, r4, 0 - movs r1, 0x35 - b _080DAE78 -_080DAE74: - adds r0, r4, 0 - movs r1, 0x36 -_080DAE78: - bl GetMonData - lsls r0, 24 - lsrs r1, r0, 24 - b _080DAE86 -_080DAE82: - movs r0, 0 - b _080DAE9A -_080DAE86: - ldr r0, =gSpecialVar_ContestRank - adds r2, r1, 0 - ldrh r1, [r0] - movs r0, 0x2 - cmp r2, r1 - bhi _080DAE9A - movs r0, 0 - cmp r2, r1 - bcc _080DAE9A - movs r0, 0x1 -_080DAE9A: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DAE0C - - thumb_func_start sub_80DAEA4 -sub_80DAEA4: @ 80DAEA4 - push {r4,r5,lr} - movs r5, 0 -_080DAEA8: - ldr r0, =gUnknown_02039F26 - adds r0, r5, r0 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - lsls r4, r5, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_80DAF04 - adds r0, r4, 0 - bl sub_80DAF88 - adds r5, 0x1 - cmp r5, 0x3 - ble _080DAEA8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DAEA4 - - thumb_func_start sub_80DAED4 -sub_80DAED4: @ 80DAED4 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r4, r1, 24 - lsrs r4, 24 - ldr r0, =gDisplayedStringBattle - ldr r1, =gText_ColorTransparent - bl StringCopy - adds r1, r0, 0 - subs r0, r1, 0x1 - strb r4, [r0] - adds r0, r1, 0 - adds r1, r5, 0 - bl StringCopy - adds r1, r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DAED4 - - thumb_func_start sub_80DAF04 -sub_80DAF04: @ 80DAF04 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r0, r1, 24 - movs r2, 0xA0 - lsls r2, 20 - adds r1, r2 - lsrs r1, 24 - bl sub_80DAF1C - pop {r0} - bx r0 - thumb_func_end sub_80DAF04 - - thumb_func_start sub_80DAF1C -sub_80DAF1C: @ 80DAF1C - push {r4,r5,lr} - sub sp, 0x24 - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gText_Slash - add r0, sp, 0x4 - bl StringCopy - lsls r1, r5, 6 - ldr r0, =gUnknown_02039E00 + 13 - adds r1, r0 - add r0, sp, 0x4 - bl StringAppend - add r0, sp, 0x4 - adds r1, r4, 0 - bl sub_80DAED4 - ldr r4, =gDisplayedStringBattle - movs r0, 0x7 - adds r1, r4, 0 - movs r2, 0x60 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - cmp r2, 0x37 - ble _080DAF5C - movs r2, 0x37 -_080DAF5C: - ldr r0, =gUnknown_02039F26 - adds r0, r5, r0 - ldrb r0, [r0] - movs r1, 0x7 - str r1, [sp] - adds r1, r4, 0 - movs r3, 0x1 - bl sub_80DEBD0 - add sp, 0x24 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DAF1C - - thumb_func_start sub_80DAF88 -sub_80DAF88: @ 80DAF88 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r0, r1, 24 - movs r2, 0xA0 - lsls r2, 20 - adds r1, r2 - lsrs r1, 24 - bl sub_80DAFA0 - pop {r0} - bx r0 - thumb_func_end sub_80DAF88 - - thumb_func_start sub_80DAFA0 -sub_80DAFA0: @ 80DAFA0 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r4, 6 - ldr r2, =gUnknown_02039E00 + 2 - adds r0, r2 - bl sub_80DAED4 - ldr r0, =gUnknown_02039F26 - adds r4, r0 - ldrb r0, [r4] - ldr r1, =gDisplayedStringBattle - movs r2, 0x7 - str r2, [sp] - movs r2, 0x5 - movs r3, 0x1 - bl sub_80DEBD0 - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DAFA0 - - thumb_func_start sub_80DAFE0 -sub_80DAFE0: @ 80DAFE0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r0, r1, 24 - cmp r0, 0x4 - bhi _080DB06C - lsls r0, 2 - ldr r1, =_080DAFFC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DAFFC: - .4byte _080DB010 - .4byte _080DB028 - .4byte _080DB040 - .4byte _080DB050 - .4byte _080DB06C -_080DB010: - ldr r0, =gUnknown_02039E00 - lsls r2, 6 - adds r1, r2, r0 - adds r3, r1, 0 - adds r3, 0x26 - ldrb r5, [r3] - adds r3, 0x4 - ldrb r4, [r3] - adds r1, 0x27 - b _080DB07E - .pool -_080DB028: - ldr r0, =gUnknown_02039E00 - lsls r2, 6 - adds r1, r2, r0 - adds r3, r1, 0 - adds r3, 0x27 - ldrb r5, [r3] - subs r3, 0x1 - ldrb r4, [r3] - adds r1, 0x28 - b _080DB07E - .pool -_080DB040: - ldr r1, =gUnknown_02039E00 - lsls r2, 6 - adds r3, r2, r1 - adds r0, r3, 0 - adds r0, 0x28 - b _080DB05A - .pool -_080DB050: - ldr r1, =gUnknown_02039E00 - lsls r2, 6 - adds r3, r2, r1 - adds r0, r3, 0 - adds r0, 0x29 -_080DB05A: - ldrb r5, [r0] - subs r0, 0x1 - ldrb r4, [r0] - adds r0, 0x2 - ldrb r3, [r0] - adds r0, r1, 0 - b _080DB080 - .pool -_080DB06C: - ldr r0, =gUnknown_02039E00 - lsls r2, 6 - adds r1, r2, r0 - adds r3, r1, 0 - adds r3, 0x2A - ldrb r5, [r3] - subs r3, 0x1 - ldrb r4, [r3] - adds r1, 0x26 -_080DB07E: - ldrb r3, [r1] -_080DB080: - adds r1, r2, r0 - adds r1, 0x2B - adds r0, r4, r3 - ldrb r1, [r1] - adds r0, r1 - asrs r0, 1 - adds r0, r5, r0 - lsls r0, 16 - lsrs r0, 16 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DAFE0 - - thumb_func_start sub_80DB09C -sub_80DB09C: @ 80DB09C - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r4, 0 - ldr r5, =gUnknown_02039F00 -_080DB0A6: - lsls r0, r4, 24 - lsrs r0, 24 - adds r1, r6, 0 - bl sub_80DAFE0 - strh r0, [r5] - adds r5, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - ble _080DB0A6 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DB09C - - thumb_func_start sub_80DB0C4 -sub_80DB0C4: @ 80DB0C4 - push {r4,r5,lr} - ldr r0, =gUnknown_08587C00 - bl LoadCompressedObjectPic - ldr r0, =gContest2Pal - movs r1, 0x88 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r0, =gSpriteTemplate_8587BE8 - movs r1, 0x70 - movs r2, 0x24 - movs r3, 0x1E - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r5, r2, r4 - ldrb r3, [r5, 0x5] - movs r1, 0xF - ands r1, r3 - movs r3, 0x10 - orrs r1, r3 - strb r1, [r5, 0x5] - adds r4, 0x1C - adds r2, r4 - ldr r1, =SpriteCallbackDummy - str r1, [r2] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DB0C4 - - thumb_func_start sub_80DB120 -sub_80DB120: @ 80DB120 - push {lr} - ldr r0, =gUnknown_08587C08 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_08587C10 - bl LoadCompressedObjectPalette - ldr r0, =gSpriteTemplate_8587C18 - movs r1, 0x60 - movs r2, 0xA - movs r3, 0x1D - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r1 - movs r1, 0x3E - adds r1, r2 - mov r12, r1 - ldrb r1, [r1] - movs r3, 0x4 - orrs r1, r3 - mov r3, r12 - strb r1, [r3] - ldrh r1, [r2, 0x4] - lsls r1, 22 - lsrs r1, 22 - strh r1, [r2, 0x2E] - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DB120 - - thumb_func_start sub_80DB174 -sub_80DB174: @ 80DB174 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r1, 0 - adds r6, r2, 0 - adds r4, r3, 0 - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r5, 0 - bl sub_80DE84C - adds r5, r0, 0 - ldr r0, =gUnknown_02039F25 - ldrb r0, [r0] - cmp r4, r0 - bne _080DB1B8 - lsls r0, r5, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x4] - adds r2, r5, 0 - adds r3, r6, 0 - bl HandleLoadSpecialPokePic_2 - b _080DB1CC - .pool -_080DB1B8: - lsls r0, r5, 3 - ldr r1, =gMonBackPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x4] - adds r2, r5, 0 - adds r3, r6, 0 - bl HandleLoadSpecialPokePic_DontHandleDeoxys -_080DB1CC: - adds r0, r5, 0 - adds r1, r7, 0 - adds r2, r6, 0 - bl GetFrontSpritePalFromSpeciesAndPersonality - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - adds r0, r5, 0 - movs r1, 0 - bl SetMultiuseSpriteTemplateToPokemon - ldr r4, =gMultiuseSpriteTemplate - movs r0, 0x2 - adds r1, r5, 0 - movs r2, 0 - bl sub_80A600C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - movs r1, 0x70 - movs r3, 0x1E - bl CreateSprite - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gSprites - mov r8, r0 - lsls r0, r7, 4 - adds r0, r7 - lsls r6, r0, 2 - mov r0, r8 - adds r4, r6, r0 - ldrb r1, [r4, 0x5] - movs r0, 0xF - ands r0, r1 - movs r1, 0x20 - orrs r0, r1 - movs r1, 0xD - negs r1, r1 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r4, 0x5] - movs r0, 0x2 - bl sub_80A82E4 - adds r1, r4, 0 - adds r1, 0x43 - strb r0, [r1] - mov r0, r8 - adds r0, 0x1C - adds r0, r6, r0 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - ldrb r0, [r4, 0x5] - lsrs r0, 4 - strh r0, [r4, 0x2E] - strh r5, [r4, 0x32] - adds r0, r5, 0 - bl IsSpeciesNotUnown - lsls r0, 24 - cmp r0, 0 - beq _080DB278 - mov r0, r8 - adds r0, 0x10 - adds r0, r6, r0 - ldr r1, =gUnknown_082FF6C0 - b _080DB280 - .pool -_080DB278: - mov r0, r8 - adds r0, 0x10 - adds r0, r6, r0 - ldr r1, =gUnknown_082FF694 -_080DB280: - str r1, [r0] - lsls r0, r7, 4 - adds r0, r7 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAffineAnim - adds r0, r7, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DB174 - - thumb_func_start IsSpeciesNotUnown -IsSpeciesNotUnown: @ 80DB2A8 - push {lr} - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xC9 - beq _080DB2B6 - movs r0, 0x1 - b _080DB2B8 -_080DB2B6: - movs r0, 0 -_080DB2B8: - pop {r1} - bx r1 - thumb_func_end IsSpeciesNotUnown - - thumb_func_start sub_80DB2BC -sub_80DB2BC: @ 80DB2BC - push {r4-r6,lr} - ldr r5, =gContestResources - ldr r0, [r5] - ldr r0, [r0, 0x24] - movs r4, 0xA0 - lsls r4, 3 - adds r1, r0, r4 - movs r6, 0xA0 - lsls r6, 1 - adds r2, r6, 0 - bl CpuSet - ldr r0, [r5] - ldr r0, [r0, 0x2C] - adds r4, r0, r4 - adds r1, r4, 0 - adds r2, r6, 0 - bl CpuSet - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DB2BC - - thumb_func_start sub_80DB2EC -sub_80DB2EC: @ 80DB2EC - push {lr} - lsls r0, 16 - lsls r1, 24 - lsrs r3, r1, 24 - ldr r2, =gContestEffects - ldr r1, =gContestMoves - lsrs r0, 13 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0x8 - bhi _080DB354 - lsls r0, 2 - ldr r1, =_080DB320 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DB320: - .4byte _080DB344 - .4byte _080DB344 - .4byte _080DB34C - .4byte _080DB34C - .4byte _080DB354 - .4byte _080DB354 - .4byte _080DB354 - .4byte _080DB354 - .4byte _080DB344 -_080DB344: - ldr r0, =0x00009082 - b _080DB356 - .pool -_080DB34C: - ldr r0, =0x00009088 - b _080DB356 - .pool -_080DB354: - ldr r0, =0x00009086 -_080DB356: - lsls r1, r3, 12 - movs r2, 0x90 - lsls r2, 8 - adds r1, r2 - lsls r0, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DB2EC - - thumb_func_start prints_contest_move_description -prints_contest_move_description: @ 80DB370 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r1, =gContestMoves - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0, 0x1] - lsls r0, 29 - lsrs r0, 29 - ldr r7, =0x00004040 - cmp r0, 0 - beq _080DB3A4 - adds r7, 0x5 - cmp r0, 0x1 - beq _080DB3A4 - adds r7, 0x5 - cmp r0, 0x2 - beq _080DB3A4 - adds r7, 0x40 - cmp r0, 0x3 - bne _080DB3A4 - subs r7, 0x20 -_080DB3A4: - movs r6, 0x5 - str r6, [sp] - movs r4, 0x1 - str r4, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - str r4, [sp, 0xC] - movs r0, 0 - adds r1, r7, 0 - movs r2, 0xB - movs r3, 0x1F - bl sub_80DECB8 - adds r1, r7, 0 - adds r1, 0x10 - str r6, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - str r4, [sp, 0xC] - movs r0, 0 - movs r2, 0xB - movs r3, 0x20 - bl sub_80DECB8 - ldr r2, =gContestEffects - ldr r0, =gContestMoves - mov r3, r8 - lsls r1, r3, 3 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 2 - adds r2, r0, r2 - ldrb r0, [r2, 0x1] - adds r7, r1, 0 - cmp r0, 0xFF - bne _080DB3FC - movs r6, 0 - b _080DB408 - .pool -_080DB3FC: - ldrb r0, [r2, 0x1] - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r6, r0, 24 -_080DB408: - cmp r6, 0x8 - bls _080DB40E - movs r6, 0x8 -_080DB40E: - ldr r1, =0x00005035 - movs r0, 0x8 - str r0, [sp] - movs r5, 0x1 - str r5, [sp, 0x4] - movs r4, 0x11 - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0x15 - movs r3, 0x1F - bl sub_80DED10 - ldr r1, =0x00005012 - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0x15 - movs r3, 0x1F - bl sub_80DED10 - ldr r1, =gContestEffects - ldr r0, =gContestMoves - adds r0, r7, r0 - ldrb r0, [r0] - lsls r0, 2 - adds r1, r0, r1 - ldrb r0, [r1, 0x2] - cmp r0, 0xFF - bne _080DB460 - movs r6, 0 - b _080DB46C - .pool -_080DB460: - ldrb r0, [r1, 0x2] - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r6, r0, 24 -_080DB46C: - cmp r6, 0x8 - bls _080DB472 - movs r6, 0x8 -_080DB472: - ldr r1, =0x00005036 - movs r0, 0x8 - str r0, [sp] - movs r5, 0x1 - str r5, [sp, 0x4] - movs r4, 0x11 - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0x15 - movs r3, 0x20 - bl sub_80DED10 - ldr r1, =0x00005014 - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r2, 0x15 - movs r3, 0x20 - bl sub_80DED10 - movs r0, 0xA - movs r1, 0 - bl FillWindowPixelBuffer - ldr r1, =gContestEffectDescriptionPointers - ldr r0, =gContestMoves - adds r0, r7, r0 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - movs r0, 0xA - bl sub_80DEB70 - ldr r1, =gText_Slash - movs r0, 0x9 - bl sub_80DEB70 - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end prints_contest_move_description - - thumb_func_start sub_80DB4E0 -sub_80DB4E0: @ 80DB4E0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_02039F26 - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - adds r0, 0x2 - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r4, 0 - bl sub_80DBCA8 - lsls r0, 24 - cmp r0, 0 - bne _080DB560 - cmp r5, 0 - beq _080DB560 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_80DB2EC - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - movs r0, 0x2 - mov r8, r0 - str r0, [sp] - movs r5, 0x1 - str r5, [sp, 0x4] - movs r6, 0x11 - str r6, [sp, 0x8] - str r5, [sp, 0xC] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x14 - adds r3, r7, 0 - bl sub_80DECB8 - adds r4, 0x10 - lsls r4, 16 - lsrs r4, 16 - adds r3, r7, 0x1 - lsls r3, 24 - lsrs r3, 24 - mov r0, r8 - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - str r5, [sp, 0xC] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x14 - bl sub_80DECB8 - b _080DB576 - .pool -_080DB560: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0x14 - adds r3, r7, 0 - bl sub_80DED10 -_080DB576: - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80DB4E0 - - thumb_func_start sub_80DB584 -sub_80DB584: @ 80DB584 - push {r4,r5,lr} - movs r4, 0 - movs r5, 0 -_080DB58A: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x4] - adds r0, r5, r0 - ldrh r0, [r0, 0x6] - lsls r1, r4, 24 - lsrs r1, 24 - bl sub_80DB4E0 - adds r5, 0x1C - adds r4, 0x1 - cmp r4, 0x3 - ble _080DB58A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DB584 - - thumb_func_start sub_80DB5B0 -sub_80DB5B0: @ 80DB5B0 - ldr r0, =0x00002034 - bx lr - .pool - thumb_func_end sub_80DB5B0 - - thumb_func_start sub_80DB5B8 -sub_80DB5B8: @ 80DB5B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - mov r10, r8 - ldr r0, =gContestResources - mov r9, r0 - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 3 - subs r0, r2 - lsls r7, r0, 2 - adds r3, r7, r1 - ldrb r0, [r3, 0x10] - movs r5, 0x30 - ands r5, r0 - cmp r5, 0 - bne _080DB5F4 - movs r0, 0 - b _080DB68A - .pool -_080DB5F4: - ldr r0, =gUnknown_02039F26 - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - adds r0, 0x2 - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0xD - ldrsb r0, [r3, r0] - movs r1, 0xA - bl __divsi3 - lsls r0, 24 - asrs r4, r0, 24 - cmp r5, 0x10 - bne _080DB648 - bl sub_80DB5B0 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1 - str r0, [sp] - lsls r0, r4, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r2, 0x13 - adds r3, r6, 0 - bl sub_80DED10 - mov r1, r8 - cmp r1, 0 - beq _080DB688 - movs r0, 0x5B - b _080DB672 - .pool -_080DB648: - adds r3, r6, r4 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x3 - subs r0, r4 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0x13 - bl sub_80DED10 - mov r0, r10 - cmp r0, 0 - beq _080DB688 - movs r0, 0x26 -_080DB672: - bl PlaySE - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x4] - adds r1, r7, r1 - ldrb r2, [r1, 0x10] - movs r0, 0x31 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x10] -_080DB688: - movs r0, 0x1 -_080DB68A: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80DB5B8 - - thumb_func_start sub_80DB69C -sub_80DB69C: @ 80DB69C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - movs r7, 0 - movs r0, 0x1 - mov r10, r0 - movs r1, 0x11 - mov r9, r1 - movs r0, 0 - mov r8, r0 -_080DB6B6: - ldr r0, =gUnknown_02039F26 - adds r0, r7, r0 - ldrb r0, [r0] - lsls r4, r0, 2 - adds r4, r0 - adds r4, 0x2 - lsls r4, 24 - lsrs r4, 24 - bl sub_80DB5B0 - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x4] - add r0, r8 - ldrb r0, [r0, 0xD] - lsls r0, 24 - asrs r0, 24 - movs r1, 0xA - bl __divsi3 - lsls r0, 24 - mov r1, r10 - str r1, [sp] - asrs r6, r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - movs r0, 0 - adds r1, r5, 0 - movs r2, 0x13 - adds r3, r4, 0 - bl sub_80DED10 - adds r4, r6 - lsls r4, 24 - lsrs r4, 24 - mov r1, r10 - str r1, [sp] - movs r0, 0x3 - subs r0, r6 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0x13 - adds r3, r4, 0 - bl sub_80DED10 - movs r1, 0x1C - add r8, r1 - adds r7, 0x1 - cmp r7, 0x3 - ble _080DB6B6 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DB69C - - thumb_func_start sub_80DB748 -sub_80DB748: @ 80DB748 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - movs r0, 0 - cmp r1, 0x4 - bhi _080DB78A - lsls r0, r1, 2 - ldr r1, =_080DB764 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DB764: - .4byte _080DB778 - .4byte _080DB77C - .4byte _080DB780 - .4byte _080DB784 - .4byte _080DB788 -_080DB778: - movs r0, 0x80 - b _080DB78A -_080DB77C: - movs r0, 0x84 - b _080DB78A -_080DB780: - movs r0, 0x86 - b _080DB78A -_080DB784: - movs r0, 0x88 - b _080DB78A -_080DB788: - movs r0, 0x82 -_080DB78A: - movs r1, 0x90 - lsls r1, 8 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_80DB748 - - thumb_func_start sub_80DB798 -sub_80DB798: @ 80DB798 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - mov r9, r1 - movs r1, 0 - mov r8, r1 - ldr r1, =gUnknown_02039F26 - adds r1, r0, r1 - ldrb r2, [r1] - lsls r1, r2, 2 - adds r1, r2 - adds r1, 0x2 - lsls r1, 24 - lsrs r7, r1, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r2, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r2, r1, r2 - ldr r0, [r2, 0x10] - ldr r1, =0x00ff0003 - ands r0, r1 - cmp r0, 0 - bne _080DB7DC - ldrb r0, [r2, 0xF] - cmp r0, 0 - beq _080DB7EC -_080DB7DC: - movs r0, 0 - b _080DB80E - .pool -_080DB7EC: - ldrb r1, [r2, 0xC] - mov r0, r9 - ands r0, r1 - cmp r0, 0 - beq _080DB7FA - movs r0, 0x1 - b _080DB80E -_080DB7FA: - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - bne _080DB80C - ldrb r1, [r2, 0xB] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080DB81A -_080DB80C: - movs r0, 0x2 -_080DB80E: - bl sub_80DB748 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - b _080DB81E -_080DB81A: - movs r0, 0 - mov r9, r0 -_080DB81E: - mov r1, r9 - cmp r1, 0 - beq _080DB85E - movs r6, 0x2 - str r6, [sp] - movs r4, 0x1 - str r4, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - str r4, [sp, 0xC] - movs r0, 0 - mov r1, r8 - movs r2, 0x14 - adds r3, r7, 0 - bl sub_80DECB8 - mov r1, r8 - adds r1, 0x10 - lsls r1, 16 - lsrs r1, 16 - adds r3, r7, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r6, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - str r4, [sp, 0xC] - movs r0, 0 - movs r2, 0x14 - bl sub_80DECB8 - b _080DB874 -_080DB85E: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0x14 - adds r3, r7, 0 - bl sub_80DED10 -_080DB874: - mov r0, r9 - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80DB798 - thumb_func_start sub_80DB884 sub_80DB884: @ 80DB884 push {r4,lr} @@ -7613,7 +31,7 @@ sub_80DB89C: @ 80DB89C movs r1, 0x2 bl CopyWindowToVram movs r0, 0 - bl sub_80DED60 + bl Contest_SetBgCopyFlags pop {r0} bx r0 thumb_func_end sub_80DB89C @@ -7632,7 +50,7 @@ sub_80DB8B8: @ 80DB8B8 movs r0, 0 b _080DB90A _080DB8D0: - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] cmp r4, r0 beq _080DB8F4 @@ -7640,13 +58,13 @@ _080DB8D0: bl sub_81562C4 bl sub_8156324 lsls r0, 24 - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons lsrs r0, 23 lsls r1, r4, 6 b _080DB902 .pool _080DB8F4: - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, =gContestResources ldr r0, [r0] ldr r0, [r0] @@ -8197,7 +615,7 @@ sub_80DBCE0: @ 80DBCE0 strh r0, [r1] ldr r2, =gUnknown_02039F08 adds r2, r4, r2 - ldr r1, =gUnknown_02039F00 + ldr r1, =gContestMonConditions adds r4, r1 ldrh r4, [r4] adds r0, r4 @@ -8307,7 +725,7 @@ _080DBDB8: mov r4, sp ldr r6, =gUnknown_02039F08 ldr r2, [sp, 0x64] - ldr r5, =gUnknown_02039F00 + ldr r5, =gContestMonConditions ldr r3, [sp, 0x68] _080DBDD2: mov r7, r9 @@ -8415,7 +833,7 @@ _080DBE90: ble _080DBE06 movs r6, 0 mov r9, r6 - ldr r2, =gUnknown_02039F20 + ldr r2, =gContestFinalStandings ldr r1, [sp, 0x6C] _080DBEA2: ldr r0, [r1] @@ -8442,7 +860,7 @@ _080DBEA2: thumb_func_start sub_80DBED4 sub_80DBED4: @ 80DBED4 push {lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -8450,8 +868,8 @@ sub_80DBED4: @ 80DBED4 beq _080DBF0E ldr r0, =gSaveBlock2Ptr ldr r2, [r0] - ldr r1, =gUnknown_02039F20 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestFinalStandings + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -8524,7 +942,7 @@ sub_80DBF68: @ 80DBF68 bl sub_80DB89C ldr r0, =gUnknown_0827E8DA movs r1, 0 - bl sub_80DEC30 + bl Contest_StartTextPrinter pop {r0} bx r0 .pool @@ -8548,7 +966,7 @@ _080DBF9A: movs r0, 0 movs r1, 0 movs r2, 0x16 - bl sub_80DED10 + bl ContestBG_FillBoxWithTile movs r0, 0xA0 lsls r0, 19 adds r5, r0 @@ -8885,7 +1303,7 @@ _080DC226: str r0, [sp, 0x8] movs r0, 0 adds r1, r6, 0 - bl sub_80DED10 + bl ContestBG_FillBoxWithTile mov r3, r8 cmp r3, 0 ble _080DC284 @@ -10314,7 +2732,7 @@ _080DCDBC: add r1, sp, 0x4 movs r2, 0x37 movs r3, 0x1 - bl sub_80DEBD0 + bl Contest_PrintTextToBg0WindowAt adds r0, r5, 0x1 lsls r0, 24 lsrs r5, r0, 24 @@ -10357,7 +2775,7 @@ _080DCE14: add r1, sp, 0x4 movs r2, 0x5 movs r3, 0x1 - bl sub_80DEBD0 + bl Contest_PrintTextToBg0WindowAt adds r0, r5, 0x1 lsls r0, 24 lsrs r5, r0, 24 @@ -10440,7 +2858,7 @@ _080DCECC: movs r4, 0 cmp r4, r5 bge _080DCF48 - ldr r7, =gUnknown_02039F00 + ldr r7, =gContestMonConditions mov r9, r7 lsls r0, r5, 1 adds r1, r0, 0 @@ -11173,7 +3591,7 @@ sub_80DD45C: @ 80DD45C lsrs r6, r1, 24 ldr r0, =gStringVar1 lsls r1, r4, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r0, =gStringVar2 @@ -11253,7 +3671,7 @@ _080DD52C: bl sub_80DB89C adds r0, r4, 0 movs r1, 0x1 - bl sub_80DEC30 + bl Contest_StartTextPrinter pop {r4-r6} pop {r0} bx r0 @@ -12747,7 +5165,7 @@ _080DE146: adds r1, r4, 0 movs r2, 0x14 adds r3, r6, 0 - bl sub_80DECB8 + bl ContestBG_FillBoxWithIncrementingTile adds r4, 0x10 lsls r4, 16 lsrs r4, 16 @@ -12766,7 +5184,7 @@ _080DE146: adds r1, r4, 0 movs r2, 0x14 adds r3, r5, 0 - bl sub_80DECB8 + bl ContestBG_FillBoxWithIncrementingTile movs r0, 0x63 bl PlaySE _080DE1CA: @@ -12907,7 +5325,7 @@ sub_80DE224: @ 80DE224 movs r3, 0 bl CopyToBgTilemapBuffer movs r0, 0x1 - bl sub_80DED60 + bl Contest_SetBgCopyFlags movs r5, 0 ldr r7, =gSprites movs r6, 0x4 @@ -12970,7 +5388,7 @@ sub_80DE350: @ 80DE350 mov r0, sp bl CpuSet movs r0, 0x1 - bl sub_80DED60 + bl Contest_SetBgCopyFlags movs r0, 0xA bl GetGpuReg add r3, sp, 0x4 @@ -13165,7 +5583,7 @@ _080DE4E2: b _080DE5B4 .pool _080DE52C: - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r0, [r0] ands r1, r0 cmp r1, 0 @@ -13594,7 +6012,7 @@ sub_80DE864: @ 80DE864 bl sub_80DE834 lsls r0, 16 lsrs r5, r0, 16 - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons lsls r0, r7, 6 adds r0, r1 ldrh r0, [r0] @@ -13675,7 +6093,7 @@ _080DE920: lsls r0, 2 adds r0, r1 ldrb r4, [r0, 0x1B] - ldr r5, =gUnknown_02039E00 + ldr r5, =gContestMons lsls r4, 6 adds r0, r4, r5 ldrh r0, [r0] @@ -13767,7 +6185,7 @@ sub_80DE9DC: @ 80DE9DC ldr r0, [r6] ldr r0, [r0, 0x18] strb r4, [r0, 0x5] - ldr r5, =gUnknown_02039E00 + ldr r5, =gContestMons lsls r4, 6 adds r0, r4, r5 ldrh r0, [r0] @@ -13919,8 +6337,8 @@ _080DEB64: .pool thumb_func_end sub_80DEAA8 - thumb_func_start sub_80DEB70 -sub_80DEB70: @ 80DEB70 + thumb_func_start Contest_PrintTextToBg0WindowStd +Contest_PrintTextToBg0WindowStd: @ 80DEB70 push {r4,lr} sub sp, 0x10 adds r4, r0, 0 @@ -13960,15 +6378,15 @@ sub_80DEB70: @ 80DEB70 adds r0, r4, 0 bl PutWindowTilemap movs r0, 0 - bl sub_80DED60 + bl Contest_SetBgCopyFlags add sp, 0x10 pop {r4} pop {r0} bx r0 - thumb_func_end sub_80DEB70 + thumb_func_end Contest_PrintTextToBg0WindowStd - thumb_func_start sub_80DEBD0 -sub_80DEBD0: @ 80DEBD0 + thumb_func_start Contest_PrintTextToBg0WindowAt +Contest_PrintTextToBg0WindowAt: @ 80DEBD0 push {r4,r5,lr} sub sp, 0x10 adds r5, r0, 0 @@ -14008,15 +6426,15 @@ sub_80DEBD0: @ 80DEBD0 adds r0, r5, 0 bl PutWindowTilemap movs r0, 0 - bl sub_80DED60 + bl Contest_SetBgCopyFlags add sp, 0x10 pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_80DEBD0 + thumb_func_end Contest_PrintTextToBg0WindowAt - thumb_func_start sub_80DEC30 -sub_80DEC30: @ 80DEC30 + thumb_func_start Contest_StartTextPrinter +Contest_StartTextPrinter: @ 80DEC30 push {r4,r5,lr} sub sp, 0x10 str r0, [sp] @@ -14057,7 +6475,7 @@ sub_80DEC30: @ 80DEC30 bl AddTextPrinter b _080DECA4 _080DEC80: - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] adds r0, r5, 0 ands r0, r1 @@ -14078,15 +6496,15 @@ _080DECA4: movs r0, 0x4 bl PutWindowTilemap movs r0, 0 - bl sub_80DED60 + bl Contest_SetBgCopyFlags add sp, 0x10 pop {r4,r5} pop {r0} bx r0 - thumb_func_end sub_80DEC30 + thumb_func_end Contest_StartTextPrinter - thumb_func_start sub_80DECB8 -sub_80DECB8: @ 80DECB8 + thumb_func_start ContestBG_FillBoxWithIncrementingTile +ContestBG_FillBoxWithIncrementingTile: @ 80DECB8 push {r4-r7,lr} mov r7, r8 push {r7} @@ -14121,17 +6539,17 @@ sub_80DECB8: @ 80DECB8 mov r0, r8 bl WriteSequenceToBgTilemapBuffer mov r0, r8 - bl sub_80DED60 + bl Contest_SetBgCopyFlags add sp, 0x10 pop {r3} mov r8, r3 pop {r4-r7} pop {r0} bx r0 - thumb_func_end sub_80DECB8 + thumb_func_end ContestBG_FillBoxWithIncrementingTile - thumb_func_start sub_80DED10 -sub_80DED10: @ 80DED10 + thumb_func_start ContestBG_FillBoxWithTile +ContestBG_FillBoxWithTile: @ 80DED10 push {r4-r6,lr} sub sp, 0x10 ldr r4, [sp, 0x20] @@ -14156,15 +6574,15 @@ sub_80DED10: @ 80DED10 str r6, [sp, 0x8] movs r4, 0 str r4, [sp, 0xC] - bl sub_80DECB8 + bl ContestBG_FillBoxWithIncrementingTile add sp, 0x10 pop {r4-r6} pop {r0} bx r0 - thumb_func_end sub_80DED10 + thumb_func_end ContestBG_FillBoxWithTile - thumb_func_start sub_80DED4C -sub_80DED4C: @ 80DED4C + thumb_func_start Contest_RunTextPrinters +Contest_RunTextPrinters: @ 80DED4C push {lr} bl RunTextPrinters movs r0, 0x4 @@ -14173,11 +6591,11 @@ sub_80DED4C: @ 80DED4C lsrs r0, 16 pop {r1} bx r1 - thumb_func_end sub_80DED4C + thumb_func_end Contest_RunTextPrinters - thumb_func_start sub_80DED60 -sub_80DED60: @ 80DED60 - ldr r2, =gUnknown_02039F38 + thumb_func_start Contest_SetBgCopyFlags +Contest_SetBgCopyFlags: @ 80DED60 + ldr r2, =sContestBgCopyFlags movs r1, 0x1 lsls r1, r0 ldrb r0, [r2] @@ -14185,7 +6603,7 @@ sub_80DED60: @ 80DED60 strb r1, [r2] bx lr .pool - thumb_func_end sub_80DED60 + thumb_func_end Contest_SetBgCopyFlags thumb_func_start ResetContestLinkResults ResetContestLinkResults: @ 80DED74 @@ -14236,7 +6654,7 @@ sub_80DEDA8: @ 80DEDA8 lsrs r0, 24 mov r8, r0 movs r5, 0 - ldr r1, =gUnknown_02039F20 + ldr r1, =gContestFinalStandings ldrb r0, [r1] cmp r0, 0 beq _080DEDE6 @@ -14252,7 +6670,7 @@ _080DEDE6: ldr r0, [sp] cmp r0, 0xFF bne _080DEE00 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] cmp r5, r0 beq _080DEE00 @@ -14316,7 +6734,7 @@ _080DEE54: ldr r6, =0x00002e90 adds r2, r0, r6 adds r2, r7 - ldr r4, =gUnknown_02039E00 + ldr r4, =gContestMons lsls r5, 6 adds r1, r4, 0 adds r1, 0x38 @@ -14351,7 +6769,7 @@ _080DEE54: adds r5, r4 adds r1, r5, 0 bl StringCopy - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -14404,7 +6822,7 @@ _080DEF34: .pool _080DEF50: ldr r6, =gUnknown_02039F3C - ldr r4, =gUnknown_02039E00 + ldr r4, =gContestMons lsls r5, 6 adds r0, r4, 0 adds r0, 0x38 @@ -14820,7 +7238,7 @@ sub_80DF250: @ 80DF250 mov r7, sp adds r7, 0x2 str r7, [sp, 0x24] - ldr r5, =gUnknown_02039F20 + ldr r5, =gContestFinalStandings movs r2, 0 movs r3, 0x80 lsls r3, 17 @@ -14896,11 +7314,11 @@ _080DF2EE: strb r0, [r2, 0xD] _080DF30A: movs r5, 0 - ldr r2, =gUnknown_02039F00 + ldr r2, =gContestMonConditions add r2, r10 movs r6, 0 ldrsh r1, [r2, r6] - ldr r7, =gUnknown_02039F00 + ldr r7, =gContestMonConditions movs r3, 0 ldrsh r0, [r7, r3] cmp r1, r0 @@ -14921,7 +7339,7 @@ _080DF322: _080DF336: cmp r5, 0x4 bne _080DF354 - ldr r1, =gUnknown_02039F20 + ldr r1, =gContestFinalStandings adds r0, r4, r1 ldrb r0, [r0] cmp r0, 0 @@ -14939,12 +7357,12 @@ _080DF354: mov r12, r3 mov r8, r3 movs r5, 0 - ldr r0, =gUnknown_02039F00 + ldr r0, =gContestMonConditions add r0, r10 movs r7, 0 ldrsh r6, [r0, r7] str r6, [sp, 0x34] - ldr r2, =gUnknown_02039F00 + ldr r2, =gContestMonConditions ldr r0, =gUnknown_02039F18 mov r1, r10 adds r6, r1, r0 @@ -15156,8 +7574,8 @@ sub_80DF4F8: @ 80DF4F8 mov r5, r8 push {r5-r7} sub sp, 0xC - ldr r1, =gUnknown_02039F20 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestFinalStandings + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -15187,7 +7605,7 @@ _080DF528: lsls r2, r7, 1 lsls r4, r7, 4 mov r8, r4 - ldr r1, =gUnknown_02039F00 + ldr r1, =gContestMonConditions adds r0, r2, r1 movs r6, 0 ldrsh r5, [r0, r6] @@ -15518,7 +7936,7 @@ _080DF7AE: add r1, sp, 0x4 movs r2, 0x5 movs r3, 0x1 - bl sub_80DEBD0 + bl Contest_PrintTextToBg0WindowAt ldr r0, =gContestResources ldr r0, [r0] ldr r1, [r0, 0x1C] @@ -15576,7 +7994,7 @@ _080DF80A: mov r1, r9 movs r2, 0x5 movs r3, 0x1 - bl sub_80DEBD0 + bl Contest_PrintTextToBg0WindowAt ldrb r0, [r4] mov r1, sp adds r1, r5 @@ -15585,7 +8003,7 @@ _080DF80A: str r2, [sp] movs r2, 0x37 movs r3, 0x1 - bl sub_80DEBD0 + bl Contest_PrintTextToBg0WindowAt mov r1, r8 lsls r0, r1, 24 lsrs r7, r0, 24 @@ -15664,7 +8082,7 @@ _080DF8CC: mov r1, r9 movs r2, 0x5 movs r3, 0x1 - bl sub_80DEBD0 + bl Contest_PrintTextToBg0WindowAt ldrb r0, [r4] mov r1, sp adds r1, r5 @@ -15673,7 +8091,7 @@ _080DF8CC: str r2, [sp] movs r2, 0x37 movs r3, 0x1 - bl sub_80DEBD0 + bl Contest_PrintTextToBg0WindowAt mov r1, r8 lsls r0, r1, 24 lsrs r7, r0, 24 diff --git a/asm/contest_ai.s b/asm/contest_ai.s index 3438107eb..ff48661f0 100644 --- a/asm/contest_ai.s +++ b/asm/contest_ai.s @@ -39,7 +39,7 @@ _081562DE: strb r1, [r0] ldr r0, [r2] ldr r2, [r0, 0xC] - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons adds r0, r2, 0 adds r0, 0x41 ldrb r0, [r0] @@ -144,7 +144,7 @@ sub_81563B0: @ 81563B0 beq _081564A0 adds r7, r5, 0 ldr r6, =gAIScriptPtr - ldr r0, =gUnknown_02039E00 + 30 + ldr r0, =gContestMons + 30 mov r8, r0 _081563CC: ldr r0, [r7] @@ -1167,7 +1167,7 @@ sub_8156B88: @ 8156B88 ldr r0, =gContestResources ldr r0, [r0] ldr r2, [r0, 0xC] - ldr r1, =gUnknown_02039F00 + ldr r1, =gContestMonConditions adds r0, r2, 0 adds r0, 0x41 ldrb r0, [r0] @@ -1436,7 +1436,7 @@ _08156D9C: thumb_func_start sub_8156DA0 sub_8156DA0: @ 8156DA0 push {r4,lr} - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r4, =gContestResources ldr r0, [r4] ldr r0, [r0, 0xC] @@ -1615,7 +1615,7 @@ _08156EFC: thumb_func_start sub_8156F04 sub_8156F04: @ 8156F04 - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, =gContestResources ldr r0, [r0] ldr r3, [r0, 0xC] @@ -1714,7 +1714,7 @@ _08156FC8: thumb_func_start sub_8156FCC sub_8156FCC: @ 8156FCC - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, =gContestResources ldr r0, [r0] ldr r3, [r0, 0xC] @@ -1818,7 +1818,7 @@ _0815709C: thumb_func_start sub_81570A0 sub_81570A0: @ 81570A0 push {r4-r7,lr} - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r5, =gContestResources ldr r0, [r5] ldr r1, [r0, 0xC] @@ -1923,7 +1923,7 @@ _0815716C: thumb_func_start sub_8157174 sub_8157174: @ 8157174 push {r4-r7,lr} - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r5, =gContestResources ldr r0, [r5] ldr r1, [r0, 0xC] @@ -2028,7 +2028,7 @@ _08157240: thumb_func_start sub_8157248 sub_8157248: @ 8157248 push {r4,lr} - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, =gContestResources ldr r0, [r0] ldr r4, [r0, 0xC] @@ -2208,7 +2208,7 @@ _081573B0: thumb_func_start sub_81573B4 sub_81573B4: @ 81573B4 push {r4,lr} - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, =gContestResources ldr r0, [r0] ldr r4, [r0, 0xC] @@ -2388,7 +2388,7 @@ _0815751C: thumb_func_start sub_8157520 sub_8157520: @ 8157520 push {r4,r5,lr} - ldr r3, =gUnknown_02039E00 + ldr r3, =gContestMons ldr r5, =gContestResources ldr r4, [r5] ldr r1, [r4, 0xC] @@ -2575,7 +2575,7 @@ _08157684: sub_8157688: @ 8157688 push {r4-r6,lr} movs r3, 0 - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, =gContestResources ldr r0, [r0] ldr r0, [r0, 0xC] @@ -2711,7 +2711,7 @@ _08157788: sub_8157790: @ 8157790 push {r4-r6,lr} movs r3, 0 - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, =gContestResources ldr r0, [r0] ldr r0, [r0, 0xC] @@ -2846,7 +2846,7 @@ _08157890: sub_8157898: @ 8157898 push {r4-r6,lr} movs r5, 0 - ldr r3, =gUnknown_02039E00 + ldr r3, =gContestMons ldr r6, =gContestResources ldr r4, [r6] ldr r1, [r4, 0xC] @@ -3729,7 +3729,7 @@ sub_8157F5C: @ 8157F5C ldr r1, =gContestResources ldr r1, [r1] ldr r3, [r1, 0xC] - ldr r2, =gUnknown_02039F00 + ldr r2, =gContestMonConditions lsrs r0, 23 adds r0, r2 adds r1, r3, 0 @@ -5030,7 +5030,7 @@ sub_8158948: @ 8158948 push {r4-r6,lr} movs r5, 0 movs r4, 0 - ldr r6, =gUnknown_02039E00 + 30 + ldr r6, =gContestMons + 30 _08158950: lsls r1, r4, 1 ldr r0, =gContestResources @@ -5156,7 +5156,7 @@ sub_8158A34: @ 8158A34 lsls r0, 8 orrs r5, r0 movs r4, 0 - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons mov r12, r0 ldr r2, =gContestResources ldr r0, [r2] diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 36f444955..9eefa154f 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -276,10 +276,10 @@ sub_80F5A74: @ 80F5A74 lsrs r0, 24 adds r5, r0, 0 lsls r1, r5, 6 - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons adds r7, r1, r0 ldr r6, =gDisplayedStringBattle - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] cmp r5, r0 bne _080F5A96 @@ -398,7 +398,7 @@ sub_80F5B00: @ 80F5B00 movs r1, 0x14 bl CreateTask bl sub_80F7880 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 @@ -503,7 +503,7 @@ sub_80F5CE4: @ 80F5CE4 push {r4-r7,lr} lsls r0, 24 lsrs r6, r0, 24 - ldr r3, =gUnknown_02039F2A + ldr r3, =gIsLinkContest ldrb r1, [r3] movs r0, 0x1 ands r0, r1 @@ -535,8 +535,8 @@ _080F5D20: b _080F5E2E _080F5D2A: bl sub_80DBED4 - ldr r1, =gUnknown_02039F20 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestFinalStandings + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -648,7 +648,7 @@ _080F5E2E: lsls r0, 3 adds r4, r0, r1 strh r2, [r4, 0x8] - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r5, 0x1 adds r0, r5, 0 @@ -663,8 +663,8 @@ _080F5E2E: _080F5E78: movs r0, 0x24 bl IncrementGameStat - ldr r1, =gUnknown_02039F20 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestFinalStandings + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -1160,7 +1160,7 @@ _080F6298: adds r1, r0 lsls r1, 3 adds r1, r7 - ldr r0, =gUnknown_02039F20 + ldr r0, =gContestFinalStandings adds r0, r4, r0 ldrb r0, [r0] strh r0, [r1, 0x8] @@ -1201,7 +1201,7 @@ _080F62F2: adds r0, 0x1 strh r0, [r4, 0x8] movs r4, 0 - ldr r1, =gUnknown_02039F20 + ldr r1, =gContestFinalStandings ldrb r0, [r1] cmp r0, 0 beq _080F631C @@ -1236,10 +1236,10 @@ _080F6334: movs r0, 0 strh r0, [r2, 0xA] movs r4, 0 - ldr r1, =gUnknown_02039F20 + ldr r1, =gContestFinalStandings ldrb r0, [r1] ldr r7, =gStringVar1 - ldr r2, =gUnknown_02039E00 + 13 + ldr r2, =gContestMons + 13 mov r8, r2 cmp r0, 0 beq _080F636E @@ -1355,12 +1355,12 @@ _080F6454: adds r0, r3, 0 strh r0, [r1] movs r2, 0 - ldr r1, =gUnknown_02039F20 + ldr r1, =gContestFinalStandings ldrb r0, [r1] lsls r4, r7, 2 mov r10, r4 - ldr r3, =gUnknown_02039E00 - ldr r4, =gUnknown_02039F25 + ldr r3, =gContestMons + ldr r4, =gContestPlayerMonIndex mov r9, r4 ldr r4, =gMonFrontPicTable mov r12, r4 @@ -1623,14 +1623,14 @@ sub_80F66B4: @ 80F66B4 ands r0, r1 cmp r0, 0 beq _080F6702 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] adds r0, r2, 0 ands r0, r1 lsls r6, r7, 2 cmp r0, 0 bne _080F66F2 - ldr r5, =gUnknown_02039E00 + ldr r5, =gContestMons movs r4, 0x3 _080F66DA: ldrh r0, [r5] @@ -1664,7 +1664,7 @@ sub_80F671C: @ 80F671C push {r4,lr} lsls r0, 24 lsrs r2, r0, 24 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -1710,7 +1710,7 @@ sub_80F677C: @ 80F677C ldrb r0, [r0] cmp r0, 0 bne _080F67AC - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 @@ -1739,14 +1739,14 @@ task_repel: @ 80F67C4 sub sp, 0x4 lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 cmp r0, 0 bne _080F67E6 - ldr r1, =gUnknown_02039F20 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestFinalStandings + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -1980,7 +1980,7 @@ sub_80F69B8: @ 80F69B8 lsrs r5, r2, 24 lsls r3, 24 lsrs r6, r3, 24 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex movs r2, 0 ldrb r0, [r0] cmp r4, r0 @@ -2059,7 +2059,7 @@ sub_80F6A64: @ 80F6A64 lsls r1, 24 lsrs r6, r1, 24 movs r5, 0 - ldr r4, =gUnknown_02039E00 + ldr r4, =gContestMons _080F6A74: ldrh r0, [r4] lsls r1, r5, 24 @@ -2088,7 +2088,7 @@ sub_80F6A9C: @ 80F6A9C movs r5, 0xA0 lsls r5, 16 _080F6AA6: - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons lsls r0, r4, 6 adds r0, r1 ldrh r0, [r0] @@ -2119,7 +2119,7 @@ _080F6AA6: thumb_func_start sub_80F6AE8 sub_80F6AE8: @ 80F6AE8 push {r4,lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 @@ -2955,7 +2955,7 @@ sub_80F71C8: @ 80F71C8 sub sp, 0xC movs r5, 0x5 movs r4, 0x1 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] adds r0, r4, 0 ands r0, r1 @@ -3104,7 +3104,7 @@ sub_80F7310: @ 80F7310 lsls r0, 24 lsls r1, 24 lsrs r5, r1, 24 - ldr r1, =gUnknown_02039F00 + ldr r1, =gContestMonConditions lsrs r0, 23 adds r0, r1 movs r1, 0 @@ -3322,7 +3322,7 @@ sub_80F74BC: @ 80F74BC lsls r0, 24 lsrs r5, r0, 24 movs r4, 0 - ldr r1, =gUnknown_02039F20 + ldr r1, =gContestFinalStandings ldrb r0, [r1] ldr r6, =gUnknown_0203A034 cmp r0, 0 @@ -3729,7 +3729,7 @@ sub_80F77E0: @ 80F77E0 adds r1, r2 strh r4, [r1, 0x8] strh r5, [r1, 0xA] - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons lsls r4, 6 adds r4, r0 ldrh r0, [r4] @@ -3765,7 +3765,7 @@ sub_80F7824: @ 80F7824 strh r0, [r4, 0x1C] ldrh r0, [r4, 0xC] ldrb r2, [r4, 0x1E] - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons lsls r3, r5, 6 adds r1, 0x38 adds r3, r1 @@ -3847,7 +3847,7 @@ _080F78E4: mov r8, r5 mov r10, r5 _080F78EA: - ldr r0, =gUnknown_02039F00 + ldr r0, =gContestMonConditions mov r1, r8 lsls r7, r1, 1 adds r0, r7, r0 @@ -3987,7 +3987,7 @@ _080F79CC: negs r0, r0 _080F7A02: strb r0, [r1, 0x12] - ldr r0, =gUnknown_02039F20 + ldr r0, =gContestFinalStandings add r0, r8 ldrb r0, [r0] cmp r0, 0 @@ -4721,8 +4721,8 @@ _080F7FEE: sub_80F7FFC: @ 80F7FFC push {r4-r7,lr} sub sp, 0x4 - ldr r1, =gUnknown_02039F20 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestFinalStandings + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] @@ -4994,7 +4994,7 @@ sub_80F8264: @ 80F8264 ldr r0, =gSpecialVar_0x8006 ldrh r1, [r0] lsls r1, 6 - ldr r0, =gUnknown_02039E00 + 13 + ldr r0, =gContestMons + 13 adds r1, r0 adds r0, r4, 0 bl StringCopy @@ -5013,7 +5013,7 @@ sub_80F8290: @ 80F8290 ldr r1, =gSpecialVar_0x8006 ldrh r1, [r1] lsls r1, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy pop {r0} @@ -5027,7 +5027,7 @@ sub_80F82B4: @ 80F82B4 movs r1, 0 movs r2, 0 ldr r5, =gSpecialVar_0x8004 - ldr r4, =gUnknown_02039F00 + ldr r4, =gContestMonConditions ldr r0, =gSpecialVar_0x8006 ldrh r0, [r0] lsls r0, 1 @@ -5060,7 +5060,7 @@ _080F82DC: thumb_func_start sub_80F82FC sub_80F82FC: @ 80F82FC ldr r2, =gSpecialVar_0x8004 - ldr r1, =gUnknown_02039F00 + ldr r1, =gContestMonConditions ldr r0, =gSpecialVar_0x8006 ldrh r0, [r0] lsls r0, 1 @@ -5075,7 +5075,7 @@ sub_80F82FC: @ 80F82FC sub_80F831C: @ 80F831C push {lr} movs r1, 0 - ldr r2, =gUnknown_02039F20 + ldr r2, =gContestFinalStandings ldrb r0, [r2] ldr r3, =gSpecialVar_0x8005 cmp r0, 0 @@ -5101,10 +5101,10 @@ _080F833C: sub_80F834C: @ 80F834C push {r4,lr} movs r1, 0 - ldr r2, =gUnknown_02039F20 + ldr r2, =gContestFinalStandings ldrb r0, [r2] ldr r4, =gStringVar3 - ldr r3, =gUnknown_02039E00 + 13 + ldr r3, =gContestMons + 13 cmp r0, 0 beq _080F836E _080F835C: @@ -5134,10 +5134,10 @@ _080F836E: sub_80F8390: @ 80F8390 push {r4,lr} movs r1, 0 - ldr r2, =gUnknown_02039F20 + ldr r2, =gContestFinalStandings ldrb r0, [r2] ldr r4, =gStringVar1 - ldr r3, =gUnknown_02039E00 + 2 + ldr r3, =gContestMons + 2 cmp r0, 0 beq _080F83B2 _080F83A0: @@ -5216,7 +5216,7 @@ sub_80F840C: @ 80F840C thumb_func_start sub_80F8438 sub_80F8438: @ 80F8438 ldr r2, =gSpecialVar_0x8004 - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons ldr r0, =gSpecialVar_0x8006 ldrh r0, [r0] lsls r0, 6 @@ -5272,7 +5272,7 @@ sub_80F8484: @ 80F8484 thumb_func_start sub_80F84B0 sub_80F84B0: @ 80F84B0 ldr r0, =gSpecialVar_0x8004 - ldr r1, =gUnknown_02039F25 + ldr r1, =gContestPlayerMonIndex ldrb r1, [r1] strh r1, [r0] bx lr @@ -5314,7 +5314,7 @@ sub_80F8508: @ 80F8508 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x4 ands r0, r1 @@ -5578,7 +5578,7 @@ sub_80F8714: @ 80F8714 b _080F877E .pool _080F8748: - ldr r5, =gUnknown_02039E00 + 2 + ldr r5, =gContestMons + 2 movs r4, 0x3 _080F874C: adds r0, r5, 0 diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s index 99fec9d99..5934c3623 100644 --- a/asm/contest_link_80FC4F4.s +++ b/asm/contest_link_80FC4F4.s @@ -139,12 +139,12 @@ sub_80FC5DC: @ 80FC5DC cmp r0, 0 beq _080FC650 bl GetMultiplayerId - ldr r1, =gUnknown_02039F25 + ldr r1, =gContestPlayerMonIndex strb r0, [r1] bl GetLinkPlayerCount ldr r4, =gUnknown_02039F30 strb r0, [r4] - ldr r1, =gUnknown_02039F2A + ldr r1, =gIsLinkContest movs r0, 0x1 strb r0, [r1] ldr r0, =gWirelessCommType @@ -182,7 +182,7 @@ _080FC63A: ldrb r6, [r6] cmp r3, r6 bge _080FC64A - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r2, 0x4 orrs r1, r2 @@ -201,7 +201,7 @@ _080FC650: sub_80FC670: @ 80FC670 push {r4,lr} adds r4, r0, 0 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x4 ands r0, r1 @@ -285,10 +285,10 @@ _080FC6FE: cmp r0, 0 beq _080FC7F4 ldr r0, =gBlockSendBuffer - ldr r1, =gUnknown_02039F25 + ldr r1, =gContestPlayerMonIndex ldrb r1, [r1] lsls r1, 6 - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons adds r1, r2 movs r2, 0x40 bl memcpy @@ -298,10 +298,10 @@ _080FC6FE: .pool _080FC738: ldr r0, =gBlockSendBuffer - ldr r1, =gUnknown_02039F25 + ldr r1, =gContestPlayerMonIndex ldrb r1, [r1] lsls r1, 6 - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons adds r1, r2 movs r2, 0x40 bl memcpy @@ -321,7 +321,7 @@ _080FC758: ldr r6, =gLinkPlayers _080FC770: lsls r4, r5, 6 - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons adds r4, r0 lsls r1, r5, 8 ldr r0, =gBlockRecvBuffer @@ -434,7 +434,7 @@ _080FC858: adds r1, r4, 0 movs r2, 0x4 bl memcpy - ldr r0, =gUnknown_030060B8 + ldr r0, =gContestRngValue adds r1, r4, 0 movs r2, 0x4 bl memcpy @@ -603,7 +603,7 @@ _080FC9C4: lsls r0, 24 cmp r0, 0 beq _080FC9F0 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex movs r1, 0x1 bl sub_80FC4F4 cmp r0, 0x1 @@ -659,7 +659,7 @@ _080FCA30: beq _080FCAB2 ldr r0, =gContestResources ldr r2, [r0] - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] lsls r1, r0, 3 subs r1, r0 @@ -860,7 +860,7 @@ _080FCC08: lsls r0, 24 cmp r0, 0 beq _080FCC82 - ldr r0, =gUnknown_02039F20 + ldr r0, =gContestFinalStandings movs r1, 0x4 _080FCC16: bl sub_80FC4F4 @@ -881,7 +881,7 @@ _080FCC38: lsls r0, 24 cmp r0, 0 beq _080FCC82 - ldr r0, =gUnknown_02039F20 + ldr r0, =gContestFinalStandings ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 @@ -1262,7 +1262,7 @@ _080FCF80: lsls r0, 24 cmp r0, 0 beq _080FCFBE - ldr r0, =gUnknown_02039F00 + ldr r0, =gContestMonConditions movs r1, 0x8 bl sub_80FC4F4 cmp r0, 0x1 @@ -1274,7 +1274,7 @@ _080FCF9C: lsls r0, 24 cmp r0, 0 beq _080FCFBE - ldr r0, =gUnknown_02039F00 + ldr r0, =gContestMonConditions ldr r1, =gUnknown_02039F2B ldrb r1, [r1] lsls r1, 8 diff --git a/asm/contest_link_81D9DE4.s b/asm/contest_link_81D9DE4.s index 12eb159f7..35191e10f 100644 --- a/asm/contest_link_81D9DE4.s +++ b/asm/contest_link_81D9DE4.s @@ -88,8 +88,8 @@ _081D9EA4: _081D9EB4: bl GetMonData strb r0, [r4] - ldr r5, =gUnknown_02039E00 - ldr r4, =gUnknown_02039F25 + ldr r5, =gContestMons + ldr r4, =gContestPlayerMonIndex ldrb r0, [r4] lsls r0, 6 adds r0, r5 @@ -266,7 +266,7 @@ _081DA02A: lsls r0, 24 cmp r0, 0 bne _081DA0B8 - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons adds r1, r0, 0 adds r1, 0x2C ldrb r2, [r1] @@ -438,10 +438,10 @@ _081DA1A4: lsls r0, 24 cmp r0, 0 beq _081DA224 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] lsls r0, 6 - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons adds r0, r1 movs r1, 0x40 bl sub_80FC4F4 @@ -466,7 +466,7 @@ _081DA1D4: ldr r6, =gLinkPlayers _081DA1EC: lsls r4, r5, 6 - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons adds r4, r0 lsls r1, r5, 8 ldr r0, =gBlockRecvBuffer @@ -558,7 +558,7 @@ _081DA2AC: adds r1, r4, 0 movs r2, 0x4 bl memcpy - ldr r0, =gUnknown_030060B8 + ldr r0, =gContestRngValue adds r1, r4, 0 movs r2, 0x4 bl memcpy @@ -823,7 +823,7 @@ _081DA4CC: ldr r0, =gUnknown_02039F30 ldrb r2, [r0] lsls r0, r2, 6 - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons adds r0, r1 movs r1, 0x4 subs r1, r2 @@ -847,7 +847,7 @@ _081DA50C: ldr r4, =gUnknown_02039F30 ldrb r3, [r4] lsls r0, r3, 6 - ldr r5, =gUnknown_02039E00 + ldr r5, =gContestMons adds r0, r5 ldr r1, =gBlockRecvBuffer movs r2, 0x4 diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index bf1d0e156..b7388b41b 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -10,7 +10,7 @@ sub_80F87D8: @ 80F87D8 push {r4,lr} ldr r0, =gSaveBlock1Ptr ldr r2, [r0] - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons ldrb r3, [r1, 0x15] ldr r4, =0x000013bc adds r0, r2, r4 @@ -150,8 +150,8 @@ sub_80F88DC: @ 80F88DC thumb_func_start sub_80F88E8 sub_80F88E8: @ 80F88E8 push {lr} - ldr r0, =gUnknown_02039F20 - ldr r1, =gUnknown_02039F25 + ldr r0, =gContestFinalStandings + ldr r1, =gContestPlayerMonIndex ldrb r2, [r1] adds r0, r2, r0 ldrb r0, [r0] @@ -218,11 +218,11 @@ sub_80F8970: @ 80F8970 mov r5, r8 push {r5-r7} sub sp, 0x8 - ldr r0, =gUnknown_02039F00 + ldr r0, =gContestMonConditions mov r12, r0 ldr r1, =gSpecialVar_0x8006 mov r9, r1 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 mov r10, r2 mov r2, r12 mov r1, sp @@ -413,7 +413,7 @@ ShowContestWinner: @ 80F8ADC thumb_func_start sub_80F8AFC sub_80F8AFC: @ 80F8AFC push {r4,r5,lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -422,7 +422,7 @@ sub_80F8AFC: @ 80F8AFC movs r3, 0 ldr r0, =gUnknown_02039F30 adds r4, r0, 0 - ldr r5, =gUnknown_02039E00 + ldr r5, =gContestMons ldrb r0, [r4] cmp r3, r0 bge _080F8B50 @@ -482,7 +482,7 @@ sub_80F8B94: @ 80F8B94 ldr r1, =gReservedSpritePaletteCount movs r0, 0xC strb r0, [r1] - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -594,8 +594,8 @@ sub_80F8C7C: @ 80F8C7C strb r0, [r1] cmp r0, 0 bne _080F8D18 - ldr r0, =gUnknown_02039F20 - ldr r1, =gUnknown_02039F25 + ldr r0, =gContestFinalStandings + ldr r1, =gContestPlayerMonIndex ldrb r2, [r1] adds r0, r2, r0 ldrb r0, [r0] @@ -675,7 +675,7 @@ _080F8D44: mov r9, r0 movs r1, 0x3 mov r10, r1 - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r4, =gSpecialVar_0x8006 ldrh r1, [r4] lsls r1, 6 @@ -702,7 +702,7 @@ _080F8D44: movs r1, 0 strh r1, [r0, 0x8] strh r6, [r0, 0xA] - ldr r1, =gUnknown_02039F25 + ldr r1, =gContestPlayerMonIndex ldrh r0, [r4] ldrb r1, [r1] cmp r0, r1 @@ -758,7 +758,7 @@ _080F8DD8: bl CreateSprite lsls r0, 24 lsrs r5, r0, 24 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -938,7 +938,7 @@ _080F8F98: thumb_func_start sub_80F8FA0 sub_80F8FA0: @ 80F8FA0 push {r4,lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -973,13 +973,13 @@ _080F8FDE: thumb_func_start sub_80F8FE8 sub_80F8FE8: @ 80F8FE8 push {r4,lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 cmp r0, 0 beq _080F9020 - ldr r2, =gUnknown_030060B8 + ldr r2, =gContestRngValue ldr r1, [r2] ldr r0, =0x41c64e6d muls r0, r1 @@ -1007,7 +1007,7 @@ _080F902A: thumb_func_start sub_80F903C sub_80F903C: @ 80F903C - ldr r2, =gUnknown_030060B8 + ldr r2, =gContestRngValue ldr r1, [r2] ldr r0, =0x41c64e6d muls r0, r1 @@ -1022,7 +1022,7 @@ sub_80F903C: @ 80F903C thumb_func_start sub_80F905C sub_80F905C: @ 80F905C push {lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 @@ -1087,7 +1087,7 @@ _080F90D4: thumb_func_start sub_80F90DC sub_80F90DC: @ 80F90DC push {lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 @@ -1110,7 +1110,7 @@ _080F90FE: thumb_func_start sub_80F910C sub_80F910C: @ 80F910C push {lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 @@ -1130,7 +1130,7 @@ _080F9126: thumb_func_start sub_80F9134 sub_80F9134: @ 80F9134 push {lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x4 ands r0, r1 @@ -1148,7 +1148,7 @@ _080F914E: thumb_func_start sub_80F9154 sub_80F9154: @ 80F9154 - ldr r1, =gUnknown_02039F2A + ldr r1, =gIsLinkContest movs r0, 0 strb r0, [r1] bx lr @@ -1158,7 +1158,7 @@ sub_80F9154: @ 80F9154 thumb_func_start sub_80F9160 sub_80F9160: @ 80F9160 push {lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 diff --git a/common_syms/contest.txt b/common_syms/contest.txt new file mode 100644 index 000000000..6a519fb46 --- /dev/null +++ b/common_syms/contest.txt @@ -0,0 +1 @@ +gContestRngValue diff --git a/data/contest.s b/data/contest.s index 357a95d1d..eaf3f8c95 100644 --- a/data/contest.s +++ b/data/contest.s @@ -352,7 +352,7 @@ gUnknown_08587FA4:: @ 8587FA4 .align 2 -gUnknown_085880A4:: @ 85880A4 +gContestOpponents:: @ 85880A4 .include "data/contest_opponents.inc" gUnknown_085898A4:: @ 85898A4 diff --git a/data/graphics.s b/data/graphics.s index fdfa76343..01e8c3b2c 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -1241,11 +1241,11 @@ gUnknown_08C17980:: @ 8C17980 .incbin "graphics/unknown/unknown_C17980.bin.lz" .align 2 -gUnknown_08C17AB0:: @ 8C17AB0 +gContestMiscGfx:: @ 8C17AB0 .incbin "graphics/contest/misc.4bpp.lz" .align 2 -gUnknown_08C1850C:: @ 8C1850C +gContestAudienceGfx:: @ 8C1850C .incbin "graphics/contest/audience.4bpp.lz" .align 2 diff --git a/include/battle_anim.h b/include/battle_anim.h index d6d4c05d6..f690cf10c 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -107,4 +107,6 @@ u8 ItemIdToBallId(u16 itemId); u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId); u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 arg2, u8 ballId); +u8 sub_80A600C(u8, u16, u8); + #endif // GUARD_BATTLE_ANIM_H diff --git a/include/contest.h b/include/contest.h index c263882eb..b7324e26b 100644 --- a/include/contest.h +++ b/include/contest.h @@ -1,36 +1,241 @@ #ifndef GUARD_CONTEST_H #define GUARD_CONTEST_H -struct ContestMove +enum { - u8 effect; - u8 contestCategory:3; - u8 comboStarterId; - u8 comboMoves[4]; + CONTEST_CATEGORY_COOL, + CONTEST_CATEGORY_BEAUTY, + CONTEST_CATEGORY_CUTE, + CONTEST_CATEGORY_SMART, + CONTEST_CATEGORY_TOUGH, }; -struct ContestEffect +enum { - u8 effectType; - u8 appeal; - u8 jam; + CONTEST_EFFECT_HIGHLY_APPEALING, + CONTEST_EFFECT_USER_MORE_EASILY_STARTLED, + CONTEST_EFFECT_GREAT_APPEAL_BUT_NO_MORE_MOVES, + CONTEST_EFFECT_REPETITION_NOT_BORING, + CONTEST_EFFECT_AVOID_STARTLE_ONCE, + CONTEST_EFFECT_AVOID_STARTLE, + CONTEST_EFFECT_AVOID_STARTLE_SLIGHTLY, + CONTEST_EFFECT_USER_LESS_EASILY_STARTLED, + CONTEST_EFFECT_STARTLE_FRONT_MON, + CONTEST_EFFECT_SLIGHTLY_STARTLE_PREV_MONS, + CONTEST_EFFECT_STARTLE_PREV_MON, + CONTEST_EFFECT_STARTLE_PREV_MONS, + CONTEST_EFFECT_BADLY_STARTLE_FRONT_MON, + CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS, + CONTEST_EFFECT_STARTLE_PREV_MON_2, + CONTEST_EFFECT_STARTLE_PREV_MONS_2, + CONTEST_EFFECT_SHIFT_JUDGE_ATTENTION, + CONTEST_EFFECT_STARTLE_MON_WITH_JUDGES_ATTENTION, + CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN, + CONTEST_EFFECT_STARTLE_MONS_SAME_TYPE_APPEAL, + CONTEST_EFFECT_STARTLE_MONS_COOL_APPEAL, + CONTEST_EFFECT_STARTLE_MONS_BEAUTY_APPEAL, + CONTEST_EFFECT_STARTLE_MONS_CUTE_APPEAL, + CONTEST_EFFECT_STARTLE_MONS_SMART_APPEAL, + CONTEST_EFFECT_STARTLE_MONS_TOUGH_APPEAL, + CONTEST_EFFECT_MAKE_FOLLOWING_MON_NERVOUS, + CONTEST_EFFECT_MAKE_FOLLOWING_MONS_NERVOUS, + CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS, + CONTEST_EFFECT_BADLY_STARTLES_MONS_IN_GOOD_CONDITION, + CONTEST_EFFECT_BETTER_IF_FIRST, + CONTEST_EFFECT_BETTER_IF_LAST, + CONTEST_EFFECT_APPEAL_AS_GOOD_AS_PREV_ONES, + CONTEST_EFFECT_APPEAL_AS_GOOD_AS_PREV_ONE, + CONTEST_EFFECT_BETTER_WHEN_LATER, + CONTEST_EFFECT_QUALITY_DEPENDS_ON_TIMING, + CONTEST_EFFECT_BETTER_IF_SAME_TYPE, + CONTEST_EFFECT_BETTER_IF_DIFF_TYPE, + CONTEST_EFFECT_AFFECTED_BY_PREV_APPEAL, + CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, + CONTEST_EFFECT_BETTER_WITH_GOOD_CONDITION, + CONTEST_EFFECT_NEXT_APPEAL_EARLIER, + CONTEST_EFFECT_NEXT_APPEAL_LATER, + CONTEST_EFFECT_MAKE_SCRAMBLING_TURN_ORDER_EASIER, + CONTEST_EFFECT_SCRAMBLE_NEXT_TURN_ORDER, + CONTEST_EFFECT_EXCITE_AUDIENCE_IN_ANY_CONTEST, + CONTEST_EFFECT_BADLY_STARTLE_MONS_WITH_GOOD_APPEALS, + CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED, + CONTEST_EFFECT_DONT_EXCITE_AUDIENCE }; -struct ContestStruct_02039E00 +enum { - u16 unk_00; - u8 unk_02[11]; - u8 unk_0d[8]; - u8 filler_15[9]; - u8 filler_1E[34]; + COMBO_STARTER_RAIN_DANCE = 1, + COMBO_STARTER_RAGE, + COMBO_STARTER_FOCUS_ENERGY, + COMBO_STARTER_HYPNOSIS, + COMBO_STARTER_ENDURE, + COMBO_STARTER_HORN_ATTACK, + COMBO_STARTER_SWORDS_DANCE, + COMBO_STARTER_STOCKPILE, + COMBO_STARTER_SUNNY_DAY, + COMBO_STARTER_REST, + COMBO_STARTER_VICE_GRIP, + COMBO_STARTER_DEFENSE_CURL, + COMBO_STARTER_CHARGE, + COMBO_STARTER_ROCK_THROW, + COMBO_STARTER_YAWN, + COMBO_STARTER_SCARY_FACE, + COMBO_STARTER_POWDER_SNOW, + COMBO_STARTER_LOCK_ON, + COMBO_STARTER_SOFT_BOILED, + COMBO_STARTER_MEAN_LOOK, + COMBO_STARTER_SCRATCH, + COMBO_STARTER_GROWTH, + COMBO_STARTER_HAIL, + COMBO_STARTER_SANDSTORM, + COMBO_STARTER_BELLY_DRUM, + COMBO_STARTER_MIND_READER, + COMBO_STARTER_DRAGON_BREATH, + COMBO_STARTER_DRAGON_RAGE, + COMBO_STARTER_DRAGON_DANCE, + COMBO_STARTER_SURF, + COMBO_STARTER_DIVE, + COMBO_STARTER_STRING_SHOT, + COMBO_STARTER_LEER, + COMBO_STARTER_TAUNT, + COMBO_STARTER_CHARM, + COMBO_STARTER_HARDEN, + COMBO_STARTER_SING, + COMBO_STARTER_EARTHQUAKE, + COMBO_STARTER_DOUBLE_TEAM, + COMBO_STARTER_CURSE, + COMBO_STARTER_SWEET_SCENT, + COMBO_STARTER_SLUDGE, + COMBO_STARTER_SLUDGE_BOMB, + COMBO_STARTER_THUNDER_PUNCH, + COMBO_STARTER_FIRE_PUNCH, + COMBO_STARTER_ICE_PUNCH, + COMBO_STARTER_PECK, + COMBO_STARTER_METAL_SOUND, + COMBO_STARTER_MUD_SPORT, + COMBO_STARTER_WATER_SPORT, + COMBO_STARTER_BONE_CLUB, + COMBO_STARTER_BONEMERANG, + COMBO_STARTER_BONE_RUSH, + COMBO_STARTER_SAND_ATTACK, + COMBO_STARTER_MUD_SLAP, + COMBO_STARTER_FAKE_OUT, + COMBO_STARTER_PSYCHIC, + COMBO_STARTER_KINESIS, + COMBO_STARTER_CONFUSION, + COMBO_STARTER_POUND, + COMBO_STARTER_SMOG, + COMBO_STARTER_CALM_MIND }; -extern struct ContestStruct_02039E00 gUnknown_02039E00[4]; +enum +{ + CONTEST_STRING_MORE_CONSCIOUS, + CONTEST_STRING_NO_APPEAL, + CONTEST_STRING_SETTLE_DOWN, + CONTEST_STRING_OBLIVIOUS_TO_OTHERS, + CONTEST_STRING_LESS_AWARE, + CONTEST_STRING_STOPPED_CARING, + CONTEST_STRING_STARTLE_ATTEMPT, + CONTEST_STRING_DAZZLE_ATTEMPT, + CONTEST_STRING_JUDGE_LOOK_AWAY2, + CONTEST_STRING_UNNERVE_ATTEMPT, + CONTEST_STRING_NERVOUS, + CONTEST_STRING_UNNERVE_WAITING, + CONTEST_STRING_TAUNT_WELL, + CONTEST_STRING_REGAINED_FORM, + CONTEST_STRING_JAM_WELL, + CONTEST_STRING_HUSTLE_STANDOUT, + CONTEST_STRING_WORK_HARD_UNNOTICED, + CONTEST_STRING_WORK_BEFORE, + CONTEST_STRING_APPEAL_NOT_WELL, + CONTEST_STRING_WORK_PRECEDING, + CONTEST_STRING_APPEAL_NOT_WELL2, + CONTEST_STRING_APPEAL_NOT_SHOWN_WELL, + CONTEST_STRING_APPEAL_SLIGHTLY_WELL, + CONTEST_STRING_APPEAL_PRETTY_WELL, + CONTEST_STRING_APPEAL_EXCELLENTLY, + CONTEST_STRING_APPEAL_DUD, + CONTEST_STRING_APPEAL_NOT_VERY_WELL, + CONTEST_STRING_APPEAL_SLIGHTLY_WELL2, + CONTEST_STRING_APPEAL_PRETTY_WELL2, + CONTEST_STRING_APPEAL_VERY_WELL, + CONTEST_STRING_APPEAL_EXCELLENTLY2, + CONTEST_STRING_SAME_TYPE_GOOD, + CONTEST_STRING_DIFF_TYPE_GOOD, + CONTEST_STRING_STOOD_OUT_AS_MUCH, + CONTEST_STRING_NOT_AS_WELL, + CONTEST_STRING_CONDITION_ROSE, + CONTEST_STRING_HOT_STATUS, + CONTEST_STRING_MOVE_UP_LINE, + CONTEST_STRING_MOVE_BACK_LINE, + CONTEST_STRING_SCRAMBLE_ORDER, + CONTEST_STRING_JUDGE_EXPECTANTLY2, + CONTEST_STRING_WENT_OVER_WELL, + CONTEST_STRING_WENT_OVER_VERY_WELL, + CONTEST_STRING_APPEAL_COMBO_EXCELLENTLY, + CONTEST_STRING_AVERT_GAZE, + CONTEST_STRING_AVOID_SEEING, + CONTEST_STRING_NOT_FAZED, + CONTEST_STRING_LITTLE_DISTRACTED, + CONTEST_STRING_ATTEMPT_STARTLE, + CONTEST_STRING_LOOKED_DOWN, + CONTEST_STRING_TURNED_BACK, + CONTEST_STRING_UTTER_CRY, + CONTEST_STRING_LEAPT_UP, + CONTEST_STRING_TRIPPED_OVER, + CONTEST_STRING_MESSED_UP2, + CONTEST_STRING_FAILED_TARGET_NERVOUS, + CONTEST_STRING_FAILED_ANYONE_NERVOUS, + CONTEST_STRING_IGNORED, + CONTEST_STRING_NO_CONDITION_IMPROVE, + CONTEST_STRING_BAD_CONDITION_WEAK_APPEAL, + CONTEST_STRING_UNAFFECTED, + CONTEST_STRING_ATTRACTED_ATTENTION, + CONTEST_STRING_NONE = 255 +}; + +struct ContestPokemon +{ + /*0x00*/ u16 species; + /*0x02*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; + /*0x0D*/ u8 trainerName[8]; + /*0x15*/ u8 trainerGfxId; + /*0x18*/ u32 flags; + /*0x1C*/ u8 whichRank:2; + u8 aiPool_Cool:1; + u8 aiPool_Beauty:1; + u8 aiPool_Cute:1; + u8 aiPool_Smart:1; + u8 aiPool_Tough:1; + /*0x1E*/ u16 moves[4]; // moves + /*0x26*/ u8 cool; // cool + /*0x27*/ u8 beauty; // beauty + /*0x28*/ u8 cute; // cute + /*0x29*/ u8 smart; // smart + /*0x2A*/ u8 tough; // tough + /*0x2B*/ u8 sheen; // sheen + /*0x2C*/ u8 unk2C[12]; + /*0x38*/ u32 personality; // personality + /*0x3C*/ u32 otId; // otId +}; // wow + +extern struct ContestPokemon gContestMons[4]; extern u8 gUnknown_02039F24; extern u16 gSpecialVar_ContestCategory; -extern u8 gSpecialVar_ContestRank; +extern u16 gSpecialVar_ContestRank; extern u8 gUnknown_02039F30; +struct Shared18000 +{ + /*0x18000*/ u8 unk18000; + /*0x18001*/ u8 filler18001[3]; + /*0x18004*/ u16 unk18004[16][16]; + /*0x18204*/ u16 unk18204[0x200]; + /*0x18604*/ u16 unk18604[0x200]; + /*0x18A04*/ u8 unk18A04[0x800]; +}; + struct ContestStruct_field_18 { // unknown size @@ -43,19 +248,173 @@ struct ContestStruct_field_18 u32 field_10; }; +struct Contest +{ + /*0x19204*/ u8 playerMoveChoice; + /*0x19205*/ u8 turnNumber; + /*0x19206*/ u8 unk19206[4]; // seems to only be used by an unref function + /*0x1920A*/ u16 unk1920A_0:1; // Task active flags? + u16 unk1920A_1:1; + u16 unk1920A_2:1; + u16 unk1920A_3:1; + u16 unk1920A_4:1; + u16 unk1920A_5:1; + u16 unk1920A_6:1; + u16 unk1920A_7:1; + /*0x1920B*/ u16 unk1920B_0:1; + u16 unk1920B_1:1; + u16 unk1920B_2:1; + /*0x1920C*/ u8 mainTaskId; + /*0x1920D*/ u8 unk1920D[4]; + /*0x19211*/ u8 unk19211; + /*0x19212*/ u8 unk19212; + /*0x19213*/ u8 filler19213; + /*0x19214*/ u8 unk19214; + /*0x19215*/ u8 unk19215; + /*0x19216*/ u8 unk19216; // sprite ID + /*0x19217*/ s8 applauseLevel; + /*0x19218*/ u8 unk19218[4]; + /*0x1921C*/ u32 unk1921C; // saved RNG value? + u16 unk19220[5][4]; // move history? + u8 unk19248[5][4]; // excitement history + u8 applauseMeterSpriteId; // sprite ID + /*0x1925D*/ u8 unk1925D; + /*0x1925E*/ u8 unk1925E; +}; + +struct ContestantStatus +{ + /*0x00*/ s16 appeal1; // move appeal? + /*0x02*/ s16 appeal2; // final appeal after end of turn, maybe? + /*0x04*/ s16 unk4; + /*0x06*/ u16 currMove; + /*0x08*/ u16 prevMove; + /*0x0A*/ u8 moveCategory; + /*0x0B*/ u8 unkB_0:2; + u8 unkB_2:2; + u8 moveRepeatCount:3; + u8 noMoreTurns:1; // used a one-time move? + /*0x0C*/ u8 nervous:1; + u8 numTurnsSkipped:2; + /*0x0D*/ s8 condition; + /*0x0E*/ u8 jam; + /*0x0F*/ u8 jamReduction; + + // Flags set by move effect + /*0x10*/ u8 resistant:1; + u8 immune:1; + u8 moreEasilyStartled:1; + u8 usedRepeatableMove:1; + u8 conditionMod:2; // 1: just raised condition; 2: appeal greatly improved by condition + u8 turnOrderMod:2; // 1: defined; 2: random + /*0x11*/ u8 turnOrderModAction:2; // 1: made first; 2: made last; 3: made random + u8 turnSkipped:1; + u8 exploded:1; + u8 overrideCategoryExcitementMod:1; + u8 appealTripleCondition:1; + + /*0x12*/ u8 jamSafetyCount; + /*0x13*/ u8 effectStringId; // status action? + /*0x14*/ u8 effectStringId2; + /*0x15*/ u8 disappointedRepeat:1; + u8 unk15_1:1; + u8 unk15_2:1; + u8 unk15_3:1; + u8 hasJudgesAttention:1; + u8 judgesAttentionWasRemoved:1; + u8 unk15_6:1; + /*0x16*/ u8 unk16; + /*0x17*/ u8 unk17; + /*0x18*/ u8 unk18; + /*0x19*/ u8 nextTurnOrder; // turn position + /*0x1A*/ u8 attentionLevel; // How much the Pokemon "stood out" + /*0x1B*/ u8 unk1B; +}; + +struct UnknownContestStruct7 +{ + u8 turnOrder[4]; + s16 jam; + s16 jam2; + u8 jamQueue[5]; + u8 unnervedPokes[4]; + u8 contestant; +}; + +struct ContestAIInfo { + /*0x00*/ u8 aiState; + /*0x02*/ u16 unk2; + /*0x04*/ u8 unk4; + /*0x05*/ u8 unk5[4]; + /*0x09*/ u8 aiAction; + /*0x0A*/ u8 fillerA[0x6]; // TODO: don't know what's here + /*0x10*/ u8 unk10; + /*0x14*/ u32 flags; + /*0x18*/ s16 scriptResult; + /*0x1A*/ s16 scriptArr[3]; + /*0x20*/ u32 stack[8]; + /*0x40*/ u8 unk40; + /*0x41*/ u8 unk41; +}; + +struct UnknownContestStruct5 +{ + s8 bits_0; // current move excitement? + u8 excitementFrozen:1; + u8 excitementFreezer:3; + s8 unk2; +}; + +struct UnknownContestStruct4 +{ + u8 unk0; // sprite ID + u8 unk1; // sprite ID + u8 unk2_0:1; + u8 unk2_1:1; + u8 unk2_2:1; +}; + +struct ContestResourcesField1C +{ + u8 filler_00[0x40]; +}; + +struct ContestResourcesField20 +{ + u8 filler_00[0x0C]; +}; + struct ContestResources { - void *field_0; - void *field_4; - void *field_8; - void *field_C; - void *field_10; - void *field_14; + struct Contest *field_0; + struct ContestantStatus *field_4; + struct UnknownContestStruct7 *field_8; + struct ContestAIInfo *field_C; + struct UnknownContestStruct5 *field_10; + struct UnknownContestStruct4 *field_14; struct ContestStruct_field_18 *field_18; + struct ContestResourcesField1C * field_1c; + struct ContestResourcesField20 * field_20; + u8 * field_24[4]; + void * field_34; + void * field_38; + 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 u32 gContestRngValue; + bool8 IsSpeciesNotUnown(u16 species); void LoadContestBgAfterMoveAnim(void); diff --git a/include/contest_effect.h b/include/contest_effect.h new file mode 100644 index 000000000..3484ca5df --- /dev/null +++ b/include/contest_effect.h @@ -0,0 +1,22 @@ +#ifndef GUARD_CONTEST_EFFECT_H +#define GUARD_CONTEST_EFFECT_H + +struct ContestMove +{ + u8 effect; + u8 contestCategory:3; + u8 comboStarterId; + u8 comboMoves[4]; +}; + +struct ContestEffect +{ + u8 effectType; + u8 appeal; + u8 jam; +}; + +extern const struct ContestMove gContestMoves[]; +extern struct ContestEffect gContestEffects[]; + +#endif //GUARD_CONTEST_EFFECT_H diff --git a/include/contest_link_80F57C4.h b/include/contest_link_80F57C4.h index 98523c175..3c12e5e53 100644 --- a/include/contest_link_80F57C4.h +++ b/include/contest_link_80F57C4.h @@ -4,5 +4,6 @@ void sub_80F840C(void); void sub_80F8484(void); void sub_80F84C4(u8); +void sub_80FC998(u8 taskId); #endif // GUARD_CONTEST_LINK_80F57C4_H diff --git a/include/contest_link_80FC4F4.h b/include/contest_link_80FC4F4.h new file mode 100644 index 000000000..6f3bab97d --- /dev/null +++ b/include/contest_link_80FC4F4.h @@ -0,0 +1,8 @@ +#ifndef GUARD_CONTEST_LINK_80FC4F4_H +#define GUARD_CONTEST_LINK_80FC4F4_H + +void sub_80FCC88(u8); +void sub_80FCC88(u8); +void sub_80FCACC(u8); + +#endif //GUARD_CONTEST_LINK_80FC4F4_H diff --git a/include/data2.h b/include/data2.h index af830a4c4..176365146 100644 --- a/include/data2.h +++ b/include/data2.h @@ -19,5 +19,6 @@ extern const u8 gMoveNames[][MOVE_NAME_LENGTH + 1]; extern struct CompressedSpriteSheet gUnknown_0831C620; extern struct CompressedSpritePalette gUnknown_0831C628; extern const struct SpriteTemplate gUnknown_0831C688; +extern const struct CompressedSpriteSheet gMonBackPicTable[]; #endif // GUARD_DATA2_H diff --git a/include/event_scripts.h b/include/event_scripts.h index c187682b0..4f85156aa 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -394,6 +394,10 @@ extern const u8 Route111_EventScript_2907F0[]; extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_1F863F[]; extern const u8 LittlerootTown_MaysHouse_2F_EventScript_1F958F[]; +//contest_strings +extern const u8 gText_0827D507[]; +extern const u8 gText_0827D531[]; + //mauville_old_man extern const u8 gOtherText_Is[]; extern const u8 gOtherText_DontYouAgree[]; diff --git a/include/gba/types.h b/include/gba/types.h index 9f63489aa..a7dbf3e03 100644 --- a/include/gba/types.h +++ b/include/gba/types.h @@ -28,6 +28,17 @@ typedef u8 bool8; typedef u16 bool16; typedef u32 bool32; +struct BgCnt +{ + u16 priority:2; + u16 charBaseBlock:2; + u16 dummy:4; + u16 screenBaseBlock:5; + u16 areaOverflowMode:1; + u16 screenSize:2; +}; +typedef volatile struct BgCnt vBgCnt; + struct PlttData { u16 r:5; // red diff --git a/include/script_pokemon_util_80F87D8.h b/include/script_pokemon_util_80F87D8.h new file mode 100644 index 000000000..555b3428b --- /dev/null +++ b/include/script_pokemon_util_80F87D8.h @@ -0,0 +1,7 @@ + +#ifndef GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H +#define GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H + +u16 sub_80F903C(void); + +#endif // GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H diff --git a/include/strings.h b/include/strings.h index 528f70f69..2577579c5 100644 --- a/include/strings.h +++ b/include/strings.h @@ -451,6 +451,8 @@ extern const u8 gText_TooImportantToToss[]; extern const u8 gText_ConfirmTossItems[]; extern const u8 gText_MoveVar1Where[]; +extern const u8 gText_ColorLightShadowDarkGrey[]; +extern const u8 gText_ColorBlue[]; extern const u8 gText_Friend[]; extern const u8 gText_Tristan[]; extern const u8 gText_Philip[]; @@ -461,6 +463,8 @@ extern const u8 gText_FiveMarks[]; extern const u8 gText_TotalRecordWLD[]; extern const u8 gText_PlayersBattleResults[]; extern const u8 gText_WinLoseDraw[]; +extern const u8 gText_ColorTransparent[]; +extern const u8 gText_Slash[]; extern const u8 gText_99TimesPlus[]; extern const u8 gText_1MinutePlus[]; diff --git a/include/tv.h b/include/tv.h index 554bbad85..7a938f888 100644 --- a/include/tv.h +++ b/include/tv.h @@ -47,6 +47,7 @@ void UpdateTVShowsPerDay(u16 days); void PutPokemonTodayCaughtOnAir(void); void TV_PutSecretBaseVisitOnTheAir(void); void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent); +void BravoTrainerPokemonProfile_BeforeInterview1(u16 move); void UpdateTVScreensOnMap(int, int); void TV_PrintIntToStringVar(u8 varIdx, int value); diff --git a/ld_script.txt b/ld_script.txt index ea17676bf..65368e4b7 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -135,6 +135,7 @@ SECTIONS { src/item_menu_icons.o(.text); asm/battle_anim_80D51AC.o(.text); src/item.o(.text); + src/contest.o(.text); asm/contest.o(.text); asm/shop.o(.text); src/berry.o(.text); diff --git a/src/contest.c b/src/contest.c new file mode 100644 index 000000000..8513fc4a9 --- /dev/null +++ b/src/contest.c @@ -0,0 +1,2761 @@ +#include "global.h" +#include "gpu_regs.h" +#include "bg.h" +#include "malloc.h" +#include "constants/items.h" +#include "constants/event_objects.h" +#include "constants/moves.h" +#include "constants/songs.h" +#include "constants/species.h" +#include "constants/flags.h" +#include "battle.h" +#include "battle_anim.h" +#include "blend_palette.h" +#include "contest.h" +#include "data2.h" +#include "decompress.h" +#include "graphics.h" +#include "link.h" +#include "m4a.h" +#include "main.h" +#include "menu.h" +#include "overworld.h" +#include "palette.h" +#include "random.h" +#include "script.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "task.h" +#include "text.h" +#include "tv.h" +#include "scanline_effect.h" +#include "util.h" +#include "contest_link_80F57C4.h" +#include "dma3.h" +#include "battle_message.h" +#include "event_scripts.h" +#include "event_data.h" +#include "strings.h" +#include "contest_effect.h" +#include "contest_link_80FC4F4.h" +#include "script_pokemon_util_80F87D8.h" +#include "international_string_util.h" +#include "data2.h" +#include "constants/rgb.h" + +extern void (*gFieldCallback)(void); + +void sub_80D782C(void); +void sub_80D7C7C(u8 taskId); +void sub_80D7CB4(u8 taskId); +void sub_80D7DAC(u8 taskId); +void sub_80D7DC8(u8 taskId); +void sub_80D7DE8(u8 taskId); +bool8 sub_80D7E44(u8 *); +void sub_80D80C8(u8 taskId); +void sub_80D8108(u8 taskId); +void vblank_cb_battle(void); +void sub_80D823C(void); +void sub_80D833C(u8 taskId); +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 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); +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_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); +bool8 sub_80DA8A4(void); +void sub_80DAF04(u8); +void sub_80DAF1C(u8 a0, u8 a1); +void sub_80DAF88(u8); +void sub_80DAFA0(u8, u8); +u8 sub_80DB0C4(void); +u8 sub_80DB120(void); +u8 sub_80DB174(u16, u32, u32, u32); +void sub_80DB2BC(void); +void prints_contest_move_description(u16); +u16 sub_80DE84C(u16); +void sub_80DB89C(void); +u16 sub_80DB8B8(u8); +void sub_80DB918(void); +bool8 sub_80DBCA8(u8); +void sub_80DBF68(void); +void sub_80DBF90(void); +void sub_80DC2BC(void); +void sub_80DC490(bool8); +void sub_80DC4F0(void); +void sub_80DC594(void); +void sub_80DC5E8(void); +void sub_80DC7EC(void); +void sub_80DCD48(void); +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_80DE424(u8); +void sub_80DE69C(u8); +void sub_80DEA20(void); +void Contest_PrintTextToBg0WindowAt(u32, u8 *, s32, u8, u8); +void Contest_StartTextPrinter(const u8 *, u8); +void ContestBG_FillBoxWithIncrementingTile(u8, u16, u8, u8, u8, u8, u8, u8); +bool32 Contest_RunTextPrinters(void); +void Contest_SetBgCopyFlags(u32); +void sub_80FC9F8(u8); +bool8 AreMovesContestCombo(u16, u16); +void sub_80DBD18(void); +void sub_80DF250(void); +void sub_80DF4F8(void); +void sub_80DD080(u8); +void sub_80DF080(u8); +void sub_80DF750(void); +void sub_80DE9DC(u8); +void sub_80DCBE8(u8, u8); +u8 sub_80DC9EC(u8); +u16 sub_80DE834(u16); +void sub_80DE864(u8); +void sub_80DEAA8(u16); +void sub_80DE9B0(u8); +void sub_80DC674(u8); +void sub_80DE12C(void); +void sub_80DD45C(u8, u8); +void sub_80DD720(u8); +void sub_80DE008(bool8); +void sub_80DC028(s16, s16, u8); +bool8 sub_80DB5B8(u8, u8); +bool8 sub_80DB798(u8); +void sub_80DB884(void); +void sub_80DC9B4(u8); +void sub_80DDED0(s8, s8); +void sub_80DDCDC(s8); +void sub_80DDE0C(void); +void sub_80DD940(void); +void sub_80DB944(void); +void sub_80DBA18(void); +void sub_80DC3AC(void); +bool8 sub_80DC3C4(void); +void sub_80DF9D4(u8 *); +void sub_80DF9E0(u8 *, s32); +void ContestBG_FillBoxWithTile(u8, u16, u8, u8, u8, u8, u8); +void Contest_PrintTextToBg0WindowStd(u8, const u8 *); + +EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; +EWRAM_DATA s16 gContestMonConditions[4] = {0}; +EWRAM_DATA s16 gUnknown_02039F08[4] = {0}; +EWRAM_DATA s16 gUnknown_02039F10[4] = {0}; +EWRAM_DATA s16 gUnknown_02039F18[4] = {0}; +EWRAM_DATA u8 gContestFinalStandings[4] = {0}; +EWRAM_DATA u8 gUnknown_02039F24 = 0; +EWRAM_DATA u8 gContestPlayerMonIndex = 0; +EWRAM_DATA u8 gUnknown_02039F26[4] = {0}; +EWRAM_DATA u8 gIsLinkContest = 0; +// Bit 0: Is a link contest +// Bit 1: Link contest uses wireless adapter +EWRAM_DATA u8 gUnknown_02039F2B = 0; +EWRAM_DATA u16 gSpecialVar_ContestCategory = 0; +EWRAM_DATA u16 gSpecialVar_ContestRank = 0; +EWRAM_DATA u8 gUnknown_02039F30 = 0; +EWRAM_DATA u8 gUnknown_02039F31 = 0; +EWRAM_DATA struct ContestResources * gContestResources = NULL; +EWRAM_DATA u8 sContestBgCopyFlags = 0; +EWRAM_DATA struct ContestWinner gUnknown_02039F3C = {0}; + +u32 gContestRngValue; + +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gBattle_BG1_X; +extern s16 gBattle_BG1_Y; +extern u16 gBattle_BG2_X; +extern u16 gBattle_BG2_Y; +extern u16 gBattle_BG3_X; +extern u16 gBattle_BG3_Y; +extern u16 gBattle_WIN0H; +extern u16 gBattle_WIN0V; +extern u16 gBattle_WIN1H; +extern u16 gBattle_WIN1V; + +extern const u8 gContestMiscGfx[]; +extern const u8 gContestAudienceGfx[]; +extern const u8 gUnknown_08C16FA8[]; +extern const u8 gUnknown_08C16E90[]; +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[]; +extern const u8 gText_0827E793[]; +extern const u8 gText_0827E32E[]; +extern const u8 gText_0827E35B[]; +extern const u8 gText_0827E38D[]; +extern const u8 gText_0827E2FE[]; +extern const u8 gText_0827E6E3[]; +extern const u8 gText_0827E73C[]; +extern const u8 gText_0827E717[]; +extern const u8 gText_0827E76A[]; +extern const u8 gText_0827E7EA[]; +extern const u8 gText_0827E817[]; +extern const u8 gText_0827E58A[]; +extern const u8 gText_0827D56F[]; +extern const u8 gText_0827D597[]; +extern const struct ContestPokemon gContestOpponents[96]; +extern const u8 gUnknown_085898A4[96]; +extern const struct CompressedSpriteSheet gUnknown_08587C00; +extern const u8 gContest2Pal[]; +extern const struct SpriteTemplate gSpriteTemplate_8587BE8; +extern const struct CompressedSpriteSheet gUnknown_08587C08; +extern const struct CompressedSpritePalette gUnknown_08587C10; +extern const struct SpriteTemplate gSpriteTemplate_8587C18; +extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; +extern const union AffineAnimCmd *const gUnknown_082FF694[]; +extern const u8 *const gContestEffectDescriptionPointers[]; + +void TaskDummy1(u8 taskId) +{ +} + +void ResetLinkContestBoolean(void) +{ + gIsLinkContest = 0; +} + +void sub_80D7678(void) +{ + u16 savedIme; + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG0 | WINOUT_WINOBJ_BG1 | WINOUT_WINOBJ_BG2 | WINOUT_WINOBJ_BG3 | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR); + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 0; + gBattle_BG3_Y = 0; + gBattle_WIN0H = 0; + gBattle_WIN0V = 0; + gBattle_WIN1H = 0; + gBattle_WIN1V = 0; +} + +void LoadContestBgAfterMoveAnim(void) +{ + s32 i; + + LZDecompressVram(gContestMiscGfx, (void *)VRAM); + LZDecompressVram(gContestAudienceGfx, (void *)(VRAM + 0x2000)); + CopyToBgTilemapBuffer(3, gUnknown_08C16FA8, 0, 0); + CopyBgTilemapBufferToVram(3); + LoadCompressedPalette(gUnknown_08C16E90, 0, 0x200); + sub_80D782C(); + for (i = 0; i < 4; i++) + { + u32 var = 5 + i; + + LoadPalette(shared18000.unk18004[var], 16 * (5 + gUnknown_02039F26[i]), 16 * sizeof(u16)); + } +} + +void sub_80D779C(void) +{ + s32 i; + + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_08587F34, ARRAY_COUNT(gUnknown_08587F34)); + SetBgAttribute(3, BG_CTRL_ATTR_PRIORITY, 1); + for (i = 0; i < 4; i++) + { + SetBgTilemapBuffer(i, gContestResources->field_24[i]); + } +} + +void sub_80D77E4(void) +{ + InitWindows(gUnknown_08587F44); + DeactivateAllTextPrinters(); + if (gIsLinkContest & 1) + { + gTextFlags.flag_0 = FALSE; + } + else + { + gTextFlags.flag_0 = TRUE; + } +} + +void sub_80D782C(void) +{ + s32 i; + + LoadPalette(gUnknown_08587C30, 0xf0, 0x20); + FillPalette(RGB_BLACK, 0, 2); + for (i = 10; i < 14; i++) + LoadPalette(gPlttBufferUnfaded + 241, 240 + i, 2); + FillPalette(RGB(31, 17, 31), 0xF3, 2); +} + +void sub_80D787C(void) +{ + s32 i; + + *gContestResources->field_0 = (struct Contest){}; + for (i = 0; i < 4; i++) + { + gContestResources->field_0->unk19206[i] = 0xFF; + } + for (i = 0; i < 4; i++) + { + gContestResources->field_4[i] = (struct ContestantStatus){}; + } + for (i = 0; i < 4; i++) + { + gContestResources->field_4[i].unkB_0 = 0; + gContestResources->field_4[i].effectStringId = CONTEST_STRING_NONE; + gContestResources->field_4[i].effectStringId2 = CONTEST_STRING_NONE; + } + *gContestResources->field_8 = (struct UnknownContestStruct7){}; + *gContestResources->field_C = (struct ContestAIInfo){}; + *gContestResources->field_10 = (struct UnknownContestStruct5){}; + memset(gContestResources->field_14, 0, 4 * sizeof(struct UnknownContestStruct4)); + if (!(gIsLinkContest & 1)) + sub_80DCE58(0); + for (i = 0; i < 4; i++) + { + gContestResources->field_4[i].nextTurnOrder = 0xFF; + gContestResources->field_0->unk19218[i] = gUnknown_02039F26[i]; + } + sub_80DD590(); + *gContestResources->field_1c = (struct ContestResourcesField1C){}; +} + +void sub_80D7988(void) +{ + gContestResources = AllocZeroed(sizeof(struct ContestResources)); + gContestResources->field_0 = AllocZeroed(sizeof(struct Contest)); + gContestResources->field_4 = AllocZeroed(sizeof(struct ContestantStatus) * 4); + gContestResources->field_8 = AllocZeroed(sizeof(struct UnknownContestStruct7)); + gContestResources->field_C = AllocZeroed(sizeof(struct ContestAIInfo)); + gContestResources->field_10 = AllocZeroed(sizeof(struct UnknownContestStruct5) * 4); + gContestResources->field_14 = AllocZeroed(sizeof(struct UnknownContestStruct4) * 4); + gContestResources->field_18 = AllocZeroed(sizeof(struct ContestStruct_field_18)); + gContestResources->field_1c = AllocZeroed(sizeof(struct ContestResourcesField1C)); + gContestResources->field_20 = AllocZeroed(sizeof(struct ContestResourcesField20)); + gContestResources->field_24[0] = AllocZeroed(0x1000); + gContestResources->field_24[1] = AllocZeroed(0x1000); + gContestResources->field_24[2] = AllocZeroed(0x1000); + gContestResources->field_24[3] = AllocZeroed(0x1000); + gContestResources->field_34 = AllocZeroed(0x800); + gContestResources->field_38 = AllocZeroed(0x800); + gContestResources->field_3c = AllocZeroed(0x2000); + gUnknown_0202305C = gContestResources->field_3c; + gUnknown_02023060 = gContestResources->field_24[1]; +} + +void sub_80D7A5C(void) +{ + FREE_AND_SET_NULL(gContestResources->field_0); + FREE_AND_SET_NULL(gContestResources->field_4); + FREE_AND_SET_NULL(gContestResources->field_8); + FREE_AND_SET_NULL(gContestResources->field_C); + FREE_AND_SET_NULL(gContestResources->field_10); + FREE_AND_SET_NULL(gContestResources->field_14); + FREE_AND_SET_NULL(gContestResources->field_18); + FREE_AND_SET_NULL(gContestResources->field_1c); + FREE_AND_SET_NULL(gContestResources->field_20); + FREE_AND_SET_NULL(gContestResources->field_24[0]); + FREE_AND_SET_NULL(gContestResources->field_24[1]); + FREE_AND_SET_NULL(gContestResources->field_24[2]); + FREE_AND_SET_NULL(gContestResources->field_24[3]); + FREE_AND_SET_NULL(gContestResources->field_34); + FREE_AND_SET_NULL(gContestResources->field_38); + FREE_AND_SET_NULL(gContestResources->field_3c); + FREE_AND_SET_NULL(gContestResources); + gUnknown_0202305C = NULL; + gUnknown_02023060 = NULL; +} + +void sub_80D7B24(void) +{ + switch (gMain.state) + { + case 0: + sContestBgCopyFlags = 0; + sub_80D7988(); + AllocateMonSpritesGfx(); + FREE_AND_SET_NULL(gMonSpritesGfxPtr->firstDecompressed); + gMonSpritesGfxPtr->firstDecompressed = AllocZeroed(0x4000); + SetVBlankCallback(NULL); + sub_80D779C(); + sub_80D77E4(); + sub_80D7678(); + ScanlineEffect_Clear(); + ResetPaletteFade(); + gPaletteFade.bufferTransferDisabled = TRUE; + ResetSpriteData(); + ResetTasks(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 4; + //shared18000.unk18000 = 0; + gHeap[0x1a000] = 0; + ClearBattleMonForms(); + sub_80D787C(); + gMain.state++; + break; + case 1: + gMain.state++; + break; + case 2: + if (sub_80D7E44(&gContestResources->field_0->unk1925D)) + { + gContestResources->field_0->unk1925D = 0; + gMain.state++; + } + break; + case 3: + sub_80DE224(); + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + BeginFastPaletteFade(2); + gPaletteFade.bufferTransferDisabled = FALSE; + SetVBlankCallback(vblank_cb_battle); + gContestResources->field_0->mainTaskId = CreateTask(sub_80D7C7C, 10); + SetMainCallback2(sub_80D823C); + if (gIsLinkContest & 2) + { + sub_800E0E8(); + CreateWirelessStatusIndicatorSprite(8, 8); + } + break; + } +} + +void sub_80D7C7C(u8 taskId) +{ + if (!gPaletteFade.active) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = sub_80D7CB4; + } +} + +void sub_80D7CB4(u8 taskId) +{ + if (gIsLinkContest & 1) + { + if (gIsLinkContest & 2) + { + switch (gTasks[taskId].data[0]) + { + case 0: + sub_80DBF68(); + gTasks[taskId].data[0]++; + // fallthrough + case 1: + if (sub_800A520()) + { + sub_800ADF8(); + gTasks[taskId].data[0]++; + } + return; + case 2: + if (sub_800A520() != TRUE) + return; + gTasks[taskId].data[0]++; + break; + } + } + + if (!gPaletteFade.active) + { + gPaletteFade.bufferTransferDisabled = FALSE; + if (!(gIsLinkContest & 2)) + sub_80DBF68(); + CreateTask(sub_80D7DAC, 0); + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = TaskDummy1; + } + } + else + { + gTasks[taskId].func = sub_80D80C8; + } +} + +void sub_80D7DAC(u8 taskId) +{ + SetTaskFuncWithFollowupFunc(taskId, sub_80FC998, sub_80D7DC8); +} + +void sub_80D7DC8(u8 taskId) +{ + gTasks[taskId].data[0] = 1; + gTasks[taskId].func = sub_80D7DE8; +} + +void sub_80D7DE8(u8 taskId) +{ + gTasks[taskId].data[0]--; + if (gTasks[taskId].data[0] <= 0) + { + GetMultiplayerId(); // unused return value + DestroyTask(taskId); + gTasks[gContestResources->field_0->mainTaskId].func = sub_80D80C8; + gRngValue = gContestRngValue; + } +} + +u8 sub_80D7E44(u8 *a) +{ + u16 sp0[16]; + u16 sp20[16]; + + switch (*a) + { + case 0: + gPaletteFade.bufferTransferDisabled = TRUE; + RequestDma3Fill(0, (void *)VRAM, 0x8000, 1); + RequestDma3Fill(0, (void *)VRAM + 0x8000, 0x8000, 1); + RequestDma3Fill(0, (void *)VRAM + 0x10000, 0x8000, 1); + break; + case 1: + LZDecompressVram(gContestMiscGfx, (void *)VRAM); + break; + case 2: + LZDecompressVram(gContestAudienceGfx, (void *)(VRAM + 0x2000)); + DmaCopyLarge32(3, (void *)(VRAM + 0x2000), shared15800, 0x2000, 0x1000); + break; + case 3: + CopyToBgTilemapBuffer(3, gUnknown_08C16FA8, 0, 0); + CopyBgTilemapBufferToVram(3); + break; + case 4: + CopyToBgTilemapBuffer(2, gUnknown_08C17170, 0, 0); + CopyBgTilemapBufferToVram(2); + DmaCopy32Defvars(3, gContestResources->field_24[2], shared18000.unk18A04, 0x800); + break; + case 5: + LoadCompressedPalette(gUnknown_08C16E90, 0, 0x200); + CpuCopy32(gPlttBufferUnfaded + 128, sp0, 16 * sizeof(u16)); + CpuCopy32(gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, sp20, 16 * sizeof(u16)); + CpuCopy32(sp20, gPlttBufferUnfaded + 128, 16 * sizeof(u16)); + CpuCopy32(sp0, gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, 16 * sizeof(u16)); + DmaCopy32Defvars(3, gPlttBufferUnfaded, shared18000.unk18004, 0x200); + sub_80D782C(); + break; + case 6: + sub_80DD04C(); + sub_80DBF90(); + sub_80DB2BC(); + gContestResources->field_0->unk19216 = sub_80DB120(); + sub_80DC2BC(); + sub_80DC4F0(); + sub_80DC594(); + sub_80DC5E8(); + sub_80DC7EC(); + gBattlerPositions[0] = 0; + gBattlerPositions[1] = 1; + gBattlerPositions[2] = 3; + gBattlerPositions[3] = 2; + gBattleTypeFlags = 0; + gBattlerAttacker = 2; + gBattlerTarget = 3; + gBattlerSpriteIds[gBattlerAttacker] = sub_80DB0C4(); + sub_80DEA20(); + CopyBgTilemapBufferToVram(3); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(1); + ShowBg(3); + ShowBg(2); + ShowBg(0); + ShowBg(1); + break; + default: + *a = 0; + return 1; + } + + (*a)++; + return 0; +} + +void sub_80D80C8(u8 taskId) +{ + gPaletteFade.bufferTransferDisabled = FALSE; + if (!gPaletteFade.active) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].func = sub_80D8108; + } +} + + +void sub_80D8108(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + if (gTasks[taskId].data[1]++ <= 60) + break; + gTasks[taskId].data[1] = 0; + PlaySE12WithPanning(SE_C_MAKU_U, 0); + gTasks[taskId].data[0]++; + break; + case 1: + if ((gBattle_BG1_Y += 7) <= 160) + break; + gTasks[taskId].data[0]++; + break; + case 2: + sub_80DE350(); + gTasks[taskId].data[0]++; + break; + case 3: + { + u16 bg0Cnt = GetGpuReg(REG_OFFSET_BG0CNT); + u16 bg2Cnt = GetGpuReg(REG_OFFSET_BG2CNT); + ((struct BgCnt *)&bg0Cnt)->priority = 0; + ((struct BgCnt *)&bg2Cnt)->priority = 0; + SetGpuReg(REG_OFFSET_BG0CNT, bg0Cnt); + SetGpuReg(REG_OFFSET_BG2CNT, bg2Cnt); + sub_80DDB0C(); + gTasks[taskId].data[0]++; + break; + } + case 4: + default: + if (gContestResources->field_0->unk1920A_6) + break; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].func = sub_80D833C; + break; + } +} + +void sub_80D823C(void) +{ + s32 i; + + AnimateSprites(); + RunTasks(); + BuildOamBuffer(); + UpdatePaletteFade(); + + for (i = 0; i < 4; i++) + { + if ((sContestBgCopyFlags >> i) & 1) + CopyBgTilemapBufferToVram(i); + } + sContestBgCopyFlags = 0; +} + +void vblank_cb_battle(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X); + SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y); + SetGpuReg(REG_OFFSET_WIN0H, gBattle_WIN0H); + SetGpuReg(REG_OFFSET_WIN0V, gBattle_WIN0V); + SetGpuReg(REG_OFFSET_WIN1H, gBattle_WIN1H); + SetGpuReg(REG_OFFSET_WIN1V, gBattle_WIN1V); + TransferPlttBuffer(); + LoadOam(); + ProcessSpriteCopyRequests(); + ScanlineEffect_InitHBlankDmaTransfer(); +} + +void sub_80D833C(u8 taskId) +{ + if (gTasks[taskId].data[0] == 0) + { + gBattle_BG0_Y = 0; + gBattle_BG2_Y = 0; + sub_80DCD48(); + DmaCopy32Defvars(3, gPlttBufferUnfaded, shared18000.unk18204, 0x400); + ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1); + if (!sub_80DBCA8(gContestPlayerMonIndex)) + StringCopy(gDisplayedStringBattle, gText_0827D507); + else + StringCopy(gDisplayedStringBattle, gText_0827D531); + sub_80DB89C(); + StringExpandPlaceholders(gStringVar4, gDisplayedStringBattle); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[0]++; + } + else + { + if (!Contest_RunTextPrinters()) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = sub_80D8424; + } + } +} + +void sub_80D8424(u8 taskId) +{ + if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys == B_BUTTON)) + { + PlaySE(SE_SELECT); + if (!sub_80DBCA8(gContestPlayerMonIndex)) + { + sub_80DC490(TRUE); + gTasks[taskId].func = sub_80D8490; + } + else + { + gTasks[taskId].func = sub_80D8894; + } + } +} + +void sub_80D8490(u8 taskId) +{ + u8 i; + u8 sp8[32]; + + gBattle_BG0_Y = 0xA0; + gBattle_BG2_Y = 0xA0; + + for (i = 0; i < 4; i++) + { + u16 move = gContestMons[gContestPlayerMonIndex].moves[i]; + u8 *r5 = sp8; + + if (gContestResources->field_4[gContestPlayerMonIndex].prevMove != MOVE_NONE + && sub_80DE1E8(gContestPlayerMonIndex) + && AreMovesContestCombo(gContestResources->field_4[gContestPlayerMonIndex].prevMove, move) != 0 + && gContestResources->field_4[gContestPlayerMonIndex].hasJudgesAttention) + { + r5 = StringCopy(sp8, gText_ColorLightShadowDarkGrey); + } + else if (move != 0 + && gContestResources->field_4[gContestPlayerMonIndex].prevMove == move + && gContestMoves[move].effect != CONTEST_EFFECT_REPETITION_NOT_BORING) + { + // Gray the text because it is a repeated move + r5 = StringCopy(sp8, gText_ColorBlue); + } + r5 = StringCopy(r5, gMoveNames[move]); + + FillWindowPixelBuffer(i + 5, 0); + Contest_PrintTextToBg0WindowAt(i + 5, sp8, 5, 1, 7); + } + + sub_80D880C(gContestResources->field_0->playerMoveChoice); + prints_contest_move_description(gContestMons[gContestPlayerMonIndex].moves[gContestResources->field_0->playerMoveChoice]); + gTasks[taskId].func = sub_80D8610; +} + +void sub_80D8610(u8 taskId) +{ + u8 numMoves = 0; + s32 i; + + for (i = 0; i < 4; i++) + { + if (gContestMons[gContestPlayerMonIndex].moves[i] != MOVE_NONE) + numMoves++; + } + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + gTasks[taskId].func = sub_80D8894; + } + else + { + switch (gMain.newAndRepeatedKeys) + { + case B_BUTTON: + PlaySE(SE_SELECT); + sub_80DC490(FALSE); + ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1); + if (!sub_80DBCA8(gContestPlayerMonIndex)) + StringCopy(gDisplayedStringBattle, gText_0827D507); + else + StringCopy(gDisplayedStringBattle, gText_0827D531); + sub_80DB89C(); + StringExpandPlaceholders(gStringVar4, gDisplayedStringBattle); + Contest_StartTextPrinter(gStringVar4, 0); + gBattle_BG0_Y = 0; + gBattle_BG2_Y = 0; + gTasks[taskId].func = sub_80D8424; + break; + case DPAD_LEFT: + case DPAD_RIGHT: + break; + case DPAD_UP: + sub_80D883C(gContestResources->field_0->playerMoveChoice); + if (gContestResources->field_0->playerMoveChoice == 0) + gContestResources->field_0->playerMoveChoice = numMoves - 1; + else + gContestResources->field_0->playerMoveChoice--; + sub_80D880C(gContestResources->field_0->playerMoveChoice); + prints_contest_move_description(gContestMons[gContestPlayerMonIndex].moves[gContestResources->field_0->playerMoveChoice]); + if (numMoves > 1) + PlaySE(SE_SELECT); + break; + case DPAD_DOWN: + sub_80D883C(gContestResources->field_0->playerMoveChoice); + if (gContestResources->field_0->playerMoveChoice == numMoves - 1) + gContestResources->field_0->playerMoveChoice = 0; + else + gContestResources->field_0->playerMoveChoice++; + sub_80D880C(gContestResources->field_0->playerMoveChoice); + prints_contest_move_description(gContestMons[gContestPlayerMonIndex].moves[gContestResources->field_0->playerMoveChoice]); + if (numMoves > 1) + PlaySE(SE_SELECT); + break; + } + } +} + +void sub_80D880C(s8 a0) +{ + ContestBG_FillBoxWithIncrementingTile(2, 55, 0, 31 + a0 * 2, 2, 2, 17, 1); +} + +void sub_80D883C(s8 a0) +{ + ContestBG_FillBoxWithIncrementingTile(2, 11, 0, 31 + a0 * 2, 2, 1, 17, 1); + ContestBG_FillBoxWithIncrementingTile(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); + } + Contest_SetBgCopyFlags(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; + } +} + +void sub_80D8B38(u8 taskId) +{ + u8 spriteId; + s32 i; + u8 r6 = gContestResources->field_0->unk19215; + s8 r3; + + switch (gTasks[taskId].data[0]) + { + case 0: + sub_80DCD48(); + for (i = 0; gContestResources->field_0->unk19214 != gContestResources->field_8->turnOrder[i]; i++) + ; + gContestResources->field_0->unk19215 = i; + r6 = gContestResources->field_0->unk19215; + if (gIsLinkContest & 1) + { + u8 taskId2; + + gContestResources->field_0->unk1920B_2 = 1; + if (sub_80DA8A4()) + sub_80DD080(gContestResources->field_0->unk19215); + taskId2 = CreateTask(sub_80FCC88, 0); + SetTaskFuncWithFollowupFunc(taskId2, sub_80FCC88, sub_80DA110); + sub_80DBF68(); + gTasks[taskId].data[0] = 1; + } + else + { + sub_80DD080(gContestResources->field_0->unk19215); + gTasks[taskId].data[0] = 2; + } + return; + case 1: + if (!gContestResources->field_0->unk1920B_2) + gTasks[taskId].data[0] = 2; + return; + case 2: + sub_80DF080(r6); + sub_80DF750(); + if (gContestResources->field_4[r6].numTurnsSkipped != 0 + || gContestResources->field_4[r6].noMoreTurns) + { + gTasks[taskId].data[0] = 31; + } + else + { + sub_80DB89C(); + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 3; + } + return; + case 3: + for (i = 0; i < 4; i++) + gBattleMonForms[i] = 0; + memset(gContestResources->field_18, 0, sizeof(*gContestResources->field_18)); + sub_80DE9DC(gContestResources->field_0->unk19215); + spriteId = sub_80DB174( + gContestMons[gContestResources->field_0->unk19215].species, + gContestMons[gContestResources->field_0->unk19215].otId, + gContestMons[gContestResources->field_0->unk19215].personality, + gContestResources->field_0->unk19215); + gSprites[spriteId].pos2.x = 120; + gSprites[spriteId].callback = sub_80DA134; + gTasks[taskId].data[2] = spriteId; + gBattlerSpriteIds[gBattlerAttacker] = spriteId; + sub_80DCBE8(sub_80DC9EC(gContestResources->field_0->unk19215), FALSE); + gTasks[taskId].data[0] = 4; + return; + case 4: + spriteId = gTasks[taskId].data[2]; + if (gSprites[spriteId].callback == SpriteCallbackDummy) + { + if (!gContestResources->field_14[r6].unk2_1) + gTasks[taskId].data[0] = 5; + } + return; + case 5: + if (gContestResources->field_4[r6].nervous) + { + gTasks[taskId].data[0] = 33; + } + else + { + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + if (gContestResources->field_4[r6].currMove < MOVES_COUNT) + StringCopy(gStringVar2, gMoveNames[gContestResources->field_4[r6].currMove]); + else + StringCopy(gStringVar2, gUnknown_08587F1C[gContestResources->field_4[r6].moveCategory]); + StringExpandPlaceholders(gStringVar4, gText_0827D55A); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[0] = 6; + } + return; + case 6: + if (!Contest_RunTextPrinters()) + { + gContestResources->field_0->unk1925E = 0; + gTasks[taskId].data[0] = 7; + } + return; + case 7: + { + u16 move = sub_80DE834(gContestResources->field_4[gContestResources->field_0->unk19215].currMove); + + sub_80DE864(gContestResources->field_0->unk19215); + sub_80DE9DC(gContestResources->field_0->unk19215); + sub_80DEAA8(move); + DoMoveAnim(move); + gTasks[taskId].data[0] = 8; + } + return; + case 8: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_80DE9B0(r6); + if (gContestResources->field_0->unk1925E != 0) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 9; + } + else + { + if (!gContestResources->field_4[r6].hasJudgesAttention) + sub_80DC674(r6); + sub_80DE12C(); + gTasks[taskId].data[0] = 23; + } + } + return; + case 9: + if (gTasks[taskId].data[10]++ > 30) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 7; + } + return; + case 23: + gTasks[taskId].data[1] = 0; + if (gContestResources->field_4[r6].effectStringId != CONTEST_STRING_NONE) + { + sub_80DD45C(r6, gContestResources->field_4[r6].effectStringId); + gContestResources->field_4[r6].effectStringId = CONTEST_STRING_NONE; + gTasks[taskId].data[0] = 24; + } + else + { + if (gContestResources->field_4[r6].effectStringId2 != CONTEST_STRING_NONE) + { + for (i = 0; i < 4; i++) + { + if (i != r6 && gContestResources->field_4[i].effectStringId != CONTEST_STRING_NONE) + break; + } + if (i == 4) + { + sub_80DD45C(r6, gContestResources->field_4[r6].effectStringId2); + gContestResources->field_4[r6].effectStringId2 = CONTEST_STRING_NONE; + gTasks[taskId].data[0] = 24; + } + else + { + gTasks[taskId].data[0] = 48; + } + } + else + { + gTasks[taskId].data[0] = 48; + } + } + return; + case 24: + if (!Contest_RunTextPrinters()) + gTasks[taskId].data[0] = 23; + return; + case 48: + if (gContestResources->field_4[r6].turnOrderModAction == 1) + { + sub_80DD720(5); + } + else if (gContestResources->field_4[r6].turnOrderModAction == 2) + { + sub_80DD720(6); + } + else if (gContestResources->field_4[r6].turnOrderModAction == 3) + { + sub_80DD720(7); + } + else + { + gTasks[taskId].data[0] = 47; + return; + } + gTasks[taskId].data[0] = 49; + return; + case 49: + if (!gContestResources->field_0->unk1920A_4) + gTasks[taskId].data[0] = 47; + return; + case 47: + sub_80DE008(TRUE); + gTasks[taskId].data[0] = 12; + return; + case 12: + sub_80DC028(0, gContestResources->field_4[r6].appeal2, r6); + gTasks[taskId].data[0] = 13; + return; + case 13: + if (!gContestResources->field_14[gContestResources->field_0->unk19215].unk2_2) + gTasks[taskId].data[0] = 35; + return; + case 35: + if (gContestResources->field_4[r6].conditionMod == 1) + sub_80DD720(8); + gTasks[taskId].data[0] = 36; + return; + case 36: + if (!gContestResources->field_0->unk1920A_4) + gTasks[taskId].data[0] = 37; + return; + case 37: + if (sub_80DB5B8(r6, 1)) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 38; + } + else + { + gTasks[taskId].data[0] = 50; + } + return; + case 38: + if (++gTasks[taskId].data[10] > 20) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 50; + } + return; + case 50: + if (sub_80DB798(r6)) + PlaySE(SE_C_PASI); + gTasks[taskId].data[0] = 25; + return; + case 25: + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[0] = 26; + return; + case 26: + { + s32 r2 = 0; + + r3 = 0; + for (i = gTasks[taskId].data[1]; i < 4; i++) + { + r3 = 0; + for (r2 = 0; r2 < 4; r2++) + { + if (r2 != r6 && gUnknown_02039F26[r2] == i + && gContestResources->field_4[r2].effectStringId != CONTEST_STRING_NONE) + { + r3 = 1; + break; + } + } + if (r3 != 0) + break; + } + if (r3) + { + gTasks[taskId].data[1] = gUnknown_02039F26[r2]; + sub_80DD45C(r2, gContestResources->field_4[r2].effectStringId); + gContestResources->field_4[r2].effectStringId = CONTEST_STRING_NONE; + gTasks[taskId].data[0] = 27; + } + else + { + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 51; + sub_80DB884(); + } + } + return; + case 27: + if (!Contest_RunTextPrinters()) + gTasks[taskId].data[0] = 28; + return; + case 28: + for (i = 0; gTasks[taskId].data[1] != gUnknown_02039F26[i]; i++) + ; + sub_80DC028(gContestResources->field_4[i].appeal2 + gContestResources->field_4[i].jam, -gContestResources->field_4[i].jam, i); + gTasks[taskId].data[0] = 29; + return; + case 29: + for (i = 0; gTasks[taskId].data[1] != gUnknown_02039F26[i]; i++) + ; + if (!gContestResources->field_14[i].unk2_2) + gTasks[taskId].data[0] = 39; + return; + case 39: + for (i = 0; gTasks[taskId].data[1] != gUnknown_02039F26[i]; i++) + ; + if (sub_80DB5B8(i, 1)) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 40; + } + else + { + gTasks[taskId].data[0] = 30; + } + return; + case 40: + if (++gTasks[taskId].data[10] > 20) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 30; + } + return; + case 30: + for (i = 0; i < 4; i++) + { + if (gUnknown_02039F26[i] == gTasks[taskId].data[1]) + break; + } + if (sub_80DB798(i)) + PlaySE(SE_C_PASI); + else + PlaySE(SE_C_SYU); + if (gContestResources->field_4[i].judgesAttentionWasRemoved) + { + sub_80DC674(i); + gContestResources->field_4[i].judgesAttentionWasRemoved = 0; + } + gTasks[taskId].data[1]++; + gTasks[taskId].data[0] = 26; + return; + case 51: + if (gTasks[taskId].data[10]++ > 9) + { + gTasks[taskId].data[10] = 0; + if (gContestResources->field_4[r6].numTurnsSkipped != 0 + || gContestResources->field_4[r6].turnSkipped) + { + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringExpandPlaceholders(gStringVar4, gText_0827E793); + Contest_StartTextPrinter(gStringVar4, 1); + } + gTasks[taskId].data[0] = 52; + } + return; + case 52: + if (!Contest_RunTextPrinters()) + { + if (!gContestResources->field_4[r6].unk15_6) + gTasks[taskId].data[0] = 17; + else + gTasks[taskId].data[0] = 14; + } + return; + case 14: + r3 = gContestResources->field_4[r6].unk16; + if (gContestResources->field_4[r6].unk16 != 0) + { + sub_80DB89C(); + if (r3 == 1) + Contest_StartTextPrinter(gText_0827E32E, 1); + else if (r3 == 2) + Contest_StartTextPrinter(gText_0827E35B, 1); + else + Contest_StartTextPrinter(gText_0827E38D, 1); + sub_80DD720(3); + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 45; + } + else + { + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringExpandPlaceholders(gStringVar4, gText_0827E2FE); + Contest_StartTextPrinter(gStringVar4, 1); + sub_80DD720(2); + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 45; + } + return; + case 45: + if (!gContestResources->field_0->unk1920A_4) + { + sub_80DC9B4(gContestResources->field_0->unk19215); + gTasks[taskId].data[0] = 15; + } + return; + case 15: + if (!Contest_RunTextPrinters()) + { + if (++gTasks[taskId].data[10] > 50) + { + if (!gContestResources->field_4[r6].hasJudgesAttention) + { + sub_80DC028( + gContestResources->field_4[r6].appeal2, + gContestResources->field_4[r6].unk17, + r6); + gContestResources->field_4[r6].appeal2 += gContestResources->field_4[r6].unk17; + } + gTasks[taskId].data[0] = 16; + } + } + return; + case 16: + if (!gContestResources->field_14[r6].unk2_2) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 17; + } + return; + case 17: + if (gContestResources->field_4[r6].disappointedRepeat) + { + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringExpandPlaceholders(gStringVar4, gText_0827E6E3); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[10] = 0; + sub_80DD720(0); + gTasks[taskId].data[0] = 46; + } + else + { + gTasks[taskId].data[0] = 41; + } + return; + case 46: + if (!gContestResources->field_0->unk1920A_4) + gTasks[taskId].data[0] = 19; + return; + case 19: + if (!Contest_RunTextPrinters()) + { + sub_80DC028(gContestResources->field_4[r6].appeal2, -gContestResources->field_4[r6].unk18, r6); + gContestResources->field_4[r6].appeal2 -= gContestResources->field_4[r6].unk18; + gTasks[taskId].data[0] = 18; + } + return; + case 18: + sub_80DCD48(); + if (!gContestResources->field_14[r6].unk2_2) + { + gTasks[taskId].data[10] = 0; + sub_80DB89C(); + gTasks[taskId].data[0] = 41; + } + return; + case 41: + if (gContestResources->field_10->excitementFrozen && r6 != gContestResources->field_10->excitementFreezer) + { + gTasks[taskId].data[0] = 57; + } + else + { + r3 = gContestResources->field_10->bits_0; + if (gContestResources->field_4[r6].overrideCategoryExcitementMod) + { + r3 = 1; + StringCopy(gStringVar3, gMoveNames[gContestResources->field_4[r6].currMove]); + } + else + { + StringCopy(gStringVar3, gUnknown_08587F08[gContestMoves[gContestResources->field_4[r6].currMove].contestCategory]); + } + if (r3 > 0) + { + if (gContestResources->field_4[r6].disappointedRepeat) + r3 = 0; + } + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + gContestResources->field_0->applauseLevel += r3; + if (gContestResources->field_0->applauseLevel < 0) + gContestResources->field_0->applauseLevel = 0; + if (r3 == 0) + { + gTasks[taskId].data[0] = 55; + } + else + { + if (r3 < 0) + StringExpandPlaceholders(gStringVar4, gText_0827E73C); + else if (r3 > 0 && gContestResources->field_0->applauseLevel <= 4) + StringExpandPlaceholders(gStringVar4, gText_0827E717); + else + StringExpandPlaceholders(gStringVar4, gText_0827E76A); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11] = 0; + if (r3 < 0) + gTasks[taskId].data[0] = 53; + else + gTasks[taskId].data[0] = 54; + } + } + return; + case 53: + switch (gTasks[taskId].data[10]) + { + case 0: + sub_80DDED0(-1, 1); + PlayFanfare(MUS_ME_ZANNEN); + gTasks[taskId].data[10]++; + break; + case 1: + if (!gContestResources->field_0->unk1920B_0 && !Contest_RunTextPrinters()) + { + sub_80DDCDC(-1); + gTasks[taskId].data[10]++; + } + break; + case 2: + if (!gContestResources->field_0->unk1920A_5) + { + if (gTasks[taskId].data[11]++ > 29) + { + gTasks[taskId].data[11] = 0; + sub_80DDED0(-1, -1); + gTasks[taskId].data[10]++; + } + } + break; + case 3: + if (!gPaletteFade.active) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[0] = 43; + } + break; + } + return; + case 54: + switch (gTasks[taskId].data[10]) + { + case 0: + if (!Contest_RunTextPrinters()) + { + sub_80DDED0(1, 1); + gTasks[taskId].data[10]++; + } + break; + case 1: + if (!gContestResources->field_0->unk1920B_0) + { + sub_80DDE0C(); + PlaySE(SE_W227B); + sub_80DDCDC(1); + gTasks[taskId].data[10]++; + } + break; + case 2: + if (!gContestResources->field_0->unk1920A_5) + { + if (gTasks[taskId].data[11]++ > 29) + { + gTasks[taskId].data[11] = 0; + sub_80DC028(gContestResources->field_4[r6].appeal2, gContestResources->field_10->unk2, r6); + gContestResources->field_4[r6].appeal2 += gContestResources->field_10->unk2; + gTasks[taskId].data[10]++; + } + } + break; + case 3: + if (!gContestResources->field_14[r6].unk2_2) + { + if (!gContestResources->field_0->unk1920A_7) + { + sub_80DDED0(1, -1); + gTasks[taskId].data[10]++; + } + } + break; + case 4: + if (!gPaletteFade.active) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[0] = 43; + } + break; + } + return; + case 43: + if (!gContestResources->field_14[r6].unk2_2) + { + sub_80DB89C(); + gTasks[taskId].data[0] = 55; + } + return; + case 57: + sub_80DB89C(); + StringCopy(gStringVar3, gContestMons[gContestResources->field_10->excitementFreezer].nickname); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringCopy(gStringVar2, gMoveNames[gContestResources->field_4[r6].currMove]); + StringExpandPlaceholders(gStringVar4, gText_0827E7EA); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[0] = 58; + return; + case 58: + if (!Contest_RunTextPrinters()) + { + sub_80DB89C(); + StringExpandPlaceholders(gStringVar4, gText_0827E817); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[0] = 59; + } + return; + case 59: + if (!Contest_RunTextPrinters()) + { + sub_80DB89C(); + gTasks[taskId].data[0] = 55; + } + return; + case 33: + if (gContestResources->field_4[r6].hasJudgesAttention) + gContestResources->field_4[r6].hasJudgesAttention = 0; + sub_80DC9B4(r6); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringCopy(gStringVar2, gMoveNames[gContestResources->field_4[r6].currMove]); + StringExpandPlaceholders(gStringVar4, gText_0827E58A); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[0] = 34; + return; + case 34: + if (!Contest_RunTextPrinters()) + gTasks[taskId].data[0] = 55; + return; + case 55: + sub_80DDBE8(); + gTasks[taskId].data[0] = 56; + return; + case 56: + if (!gContestResources->field_0->unk1920A_6) + { + if (gContestResources->field_0->applauseLevel > 4) + { + gContestResources->field_0->applauseLevel = 0; + sub_80DD940(); + } + gTasks[taskId].data[0] = 10; + } + return; + case 10: + spriteId = gTasks[taskId].data[2]; + gSprites[spriteId].callback = sub_80DA164; + gTasks[taskId].data[0] = 11; + return; + case 11: + spriteId = gTasks[taskId].data[2]; + if (gSprites[spriteId].invisible) + { + FreeSpriteOamMatrix(&gSprites[spriteId]); + DestroySprite(&gSprites[spriteId]); + gTasks[taskId].data[0] = 20; + } + return; + case 20: + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 21; + return; + case 31: + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringExpandPlaceholders(gStringVar4, gText_0827D56F); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[0] = 32; + return; + case 32: + if (!Contest_RunTextPrinters()) + gTasks[taskId].data[0] = 21; + return; + case 21: + if (++gTasks[taskId].data[10] > 29) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 22; + } + return; + case 22: + if (++gContestResources->field_0->unk19214 == 4) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_80DA198; + } + else + { + gTasks[taskId].data[0] = 0; + } + 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]); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[0]++; + } + else + { + if (!Contest_RunTextPrinters()) + { + 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; +} + +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); + Contest_StartTextPrinter(gStringVar4, 1); + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_80DA6B4; +} + +void sub_80DA6B4(u8 taskId) +{ + if (!Contest_RunTextPrinters()) + { + 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(); +} + +void sub_80DA884(void) +{ + if (!(gIsLinkContest & 1)) + gContestPlayerMonIndex = 3; +} + +bool8 sub_80DA8A4(void) +{ + if (gContestPlayerMonIndex == gUnknown_02039F2B) + return TRUE; + return FALSE; +} + + +void sub_80DA8C8(u8 partyIndex) +{ + u8 name[20]; + u16 heldItem; + s16 cool; + s16 beauty; + s16 cute; + s16 smart; + s16 tough; + + StringCopy(name, gSaveBlock2Ptr->playerName); + if (gIsLinkContest & 1) + { + sub_80DF9D4(name); + } + memcpy(gContestMons[gContestPlayerMonIndex].trainerName, name, 8); + if (gSaveBlock2Ptr->playerGender == MALE) + gContestMons[gContestPlayerMonIndex].trainerGfxId = EVENT_OBJ_GFX_LINK_BRENDAN; + else + gContestMons[gContestPlayerMonIndex].trainerGfxId = EVENT_OBJ_GFX_LINK_MAY; + gContestMons[gContestPlayerMonIndex].flags = 0; + gContestMons[gContestPlayerMonIndex].unk2C[0] = 0; + gContestMons[gContestPlayerMonIndex].species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES); + GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, name); + StringGetEnd10(name); + if (gIsLinkContest & 1) + { + sub_80DF9E0(name, GetMonData(&gPlayerParty[partyIndex], MON_DATA_LANGUAGE)); + } + memcpy(gContestMons[gContestPlayerMonIndex].nickname, name, POKEMON_NAME_LENGTH + 1); + StringCopy(gContestMons[gContestPlayerMonIndex].nickname, name); + gContestMons[gContestPlayerMonIndex].cool = GetMonData(&gPlayerParty[partyIndex], MON_DATA_COOL); + gContestMons[gContestPlayerMonIndex].beauty = GetMonData(&gPlayerParty[partyIndex], MON_DATA_BEAUTY); + gContestMons[gContestPlayerMonIndex].cute = GetMonData(&gPlayerParty[partyIndex], MON_DATA_CUTE); + gContestMons[gContestPlayerMonIndex].smart = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SMART); + gContestMons[gContestPlayerMonIndex].tough = GetMonData(&gPlayerParty[partyIndex], MON_DATA_TOUGH); + gContestMons[gContestPlayerMonIndex].sheen = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SHEEN); + gContestMons[gContestPlayerMonIndex].moves[0] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MOVE1); + gContestMons[gContestPlayerMonIndex].moves[1] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MOVE2); + gContestMons[gContestPlayerMonIndex].moves[2] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MOVE3); + gContestMons[gContestPlayerMonIndex].moves[3] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MOVE4); + gContestMons[gContestPlayerMonIndex].personality = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PERSONALITY); + gContestMons[gContestPlayerMonIndex].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID); + + heldItem = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HELD_ITEM); + cool = gContestMons[gContestPlayerMonIndex].cool; + beauty = gContestMons[gContestPlayerMonIndex].beauty; + cute = gContestMons[gContestPlayerMonIndex].cute; + smart = gContestMons[gContestPlayerMonIndex].smart; + tough = gContestMons[gContestPlayerMonIndex].tough; + if (heldItem == ITEM_RED_SCARF) + cool += 20; + else if (heldItem == ITEM_BLUE_SCARF) + beauty += 20; + else if (heldItem == ITEM_PINK_SCARF) + cute += 20; + else if (heldItem == ITEM_GREEN_SCARF) + smart += 20; + else if (heldItem == ITEM_YELLOW_SCARF) + tough += 20; + if (cool > 255) + cool = 255; + if (beauty > 255) + beauty = 255; + if (cute > 255) + cute = 255; + if (smart > 255) + smart = 255; + if (tough > 255) + tough = 255; + gContestMons[gContestPlayerMonIndex].cool = cool; + gContestMons[gContestPlayerMonIndex].beauty = beauty; + gContestMons[gContestPlayerMonIndex].cute = cute; + gContestMons[gContestPlayerMonIndex].smart = smart; + gContestMons[gContestPlayerMonIndex].tough = tough; +} + +void sub_80DAB8C(u8 contestType, u8 rank) +{ + s32 i; + u8 opponentsCount = 0; + u8 opponents[100]; + bool8 r7 = FALSE; + const u8 * r3; + + sub_80DA884(); + + if (FlagGet(FLAG_SYS_GAME_CLEAR) && !(gIsLinkContest & 1)) + r7 = TRUE; + + // Find all suitable opponents + r3 = gUnknown_085898A4; + for (i = 0; i < ARRAY_COUNT(gContestOpponents); i++) + { + if (rank == gContestOpponents[i].whichRank) + { + if (r7 == TRUE) + { + if (r3[i] == 1) + continue; + } + else + { + if (r3[i] == 2) + continue; + } + if (contestType == CONTEST_CATEGORY_COOL && gContestOpponents[i].aiPool_Cool) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_BEAUTY && gContestOpponents[i].aiPool_Beauty) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_CUTE && gContestOpponents[i].aiPool_Cute) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_SMART && gContestOpponents[i].aiPool_Smart) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough) + opponents[opponentsCount++] = i; + } + } + opponents[opponentsCount] = 0xFF; + + // Choose three random opponents from the list + for (i = 0; i < 3; i++) + { + u16 rnd = Random() % opponentsCount; + s32 j; + + gContestMons[i] = gContestOpponents[opponents[rnd]]; + for (j = rnd; opponents[j] != 0xFF; j++) + opponents[j] = opponents[j + 1]; + opponentsCount--; + } + + sub_80DA8C8(gUnknown_02039F24); +} + +#ifdef NONMATCHING +void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame) +{ + s32 i; + u8 opponentsCount = 0; + u8 opponents[100]; + const u8 * r6; + + if (gUnknown_02039F30 == 4) + return; + + r6 = gUnknown_085898A4; + for (i = 0; i < ARRAY_COUNT(gContestOpponents); i++) + { + if (rank != gContestOpponents[i].whichRank) + continue; + if (isPostgame == TRUE) + { + if (r6[i] == 1) + continue; + } + else + { + if (r6[i] == 2) + continue; + } + if (contestType == CONTEST_CATEGORY_COOL && gContestOpponents[i].aiPool_Cool) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_BEAUTY && gContestOpponents[i].aiPool_Beauty) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_CUTE && gContestOpponents[i].aiPool_Cute) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_SMART && gContestOpponents[i].aiPool_Smart) + opponents[opponentsCount++] = i; + else if (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough) + opponents[opponentsCount++] = i; + } + opponents[opponentsCount] = 0xFF; + for (i = 0; i < 4 - gUnknown_02039F30; i++) + { + u16 rnd = sub_80F903C() % opponentsCount; + s32 j; + + gContestMons[gUnknown_02039F30 + i] = gContestOpponents[opponents[rnd]]; + sub_80DF9D4(gContestMons[gUnknown_02039F30 + i].trainerName); + sub_80DF9E0(gContestMons[gUnknown_02039F30 + i].nickname, GAME_LANGUAGE); + for (j = rnd; opponents[j] != 0xFF; j++) + opponents[j] = opponents[j + 1]; + opponentsCount--; + } +} +#else +NAKED void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tmov r7, r9\n" + "\tmov r6, r8\n" + "\tpush {r6,r7}\n" + "\tsub sp, 0x64\n" + "\tmov r8, r2\n" + "\tlsls r0, 24\n" + "\tlsrs r4, r0, 24\n" + "\tlsls r1, 24\n" + "\tlsrs r2, r1, 24\n" + "\tmovs r7, 0\n" + "\tldr r0, =gUnknown_02039F30\n" + "\tldrb r1, [r0]\n" + "\tmov r9, r0\n" + "\tcmp r1, 0x4\n" + "\tbne _080DACDE\n" + "\tb _080DADF6\n" + "_080DACDE:\n" + "\tmovs r5, 0\n" + "\tldr r3, =gContestOpponents\n" + "\tldr r6, =gUnknown_085898A4\n" + "_080DACE4:\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 30\n" + "\tlsrs r0, 30\n" + "\tcmp r2, r0\n" + "\tbne _080DAD56\n" + "\tmov r0, r8\n" + "\tcmp r0, 0x1\n" + "\tbne _080DAD08\n" + "\tldrb r0, [r6]\n" + "\tcmp r0, 0x1\n" + "\tbeq _080DAD56\n" + "\tb _080DAD0E\n" + "\t.pool\n" + "_080DAD08:\n" + "\tldrb r0, [r6]\n" + "\tcmp r0, 0x2\n" + "\tbeq _080DAD56\n" + "_080DAD0E:\n" + "\tcmp r4, 0\n" + "\tbne _080DAD1A\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 29\n" + "\tcmp r0, 0\n" + "\tblt _080DAD4A\n" + "_080DAD1A:\n" + "\tcmp r4, 0x1\n" + "\tbne _080DAD26\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 28\n" + "\tcmp r0, 0\n" + "\tblt _080DAD4A\n" + "_080DAD26:\n" + "\tcmp r4, 0x2\n" + "\tbne _080DAD32\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 27\n" + "\tcmp r0, 0\n" + "\tblt _080DAD4A\n" + "_080DAD32:\n" + "\tcmp r4, 0x3\n" + "\tbne _080DAD3E\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 26\n" + "\tcmp r0, 0\n" + "\tblt _080DAD4A\n" + "_080DAD3E:\n" + "\tcmp r4, 0x4\n" + "\tbne _080DAD56\n" + "\tldrb r0, [r3, 0x1C]\n" + "\tlsls r0, 25\n" + "\tcmp r0, 0\n" + "\tbge _080DAD56\n" + "_080DAD4A:\n" + "\tadds r0, r7, 0\n" + "\tadds r1, r0, 0x1\n" + "\tlsls r1, 24\n" + "\tlsrs r7, r1, 24\n" + "\tadd r0, sp\n" + "\tstrb r5, [r0]\n" + "_080DAD56:\n" + "\tadds r3, 0x40\n" + "\tadds r6, 0x1\n" + "\tadds r5, 0x1\n" + "\tcmp r5, 0x5F\n" + "\tbls _080DACE4\n" + "\tmov r3, sp\n" + "\tadds r1, r3, r7\n" + "\tmovs r0, 0xFF\n" + "\tstrb r0, [r1]\n" + "\tmovs r5, 0\n" + "\tmov r0, r9\n" + "\tldrb r1, [r0]\n" + "\tmovs r0, 0x4\n" + "\tsubs r0, r1\n" + "\tcmp r5, r0\n" + "\tbge _080DADF6\n" + "\tldr r3, =gContestMons\n" + "\tmov r8, r3\n" + "\tmov r6, r9\n" + "\tmovs r0, 0x2\n" + "\tadd r0, r8\n" + "\tmov r9, r0\n" + "_080DAD82:\n" + "\tbl sub_80F903C\n" + "\tlsls r0, 16\n" + "\tlsrs r0, 16\n" + "\tadds r1, r7, 0\n" + "\tbl __modsi3\n" + "\tadds r1, r0, 0\n" + "\tlsls r1, 16\n" + "\tlsrs r1, 16\n" + "\tldrb r0, [r6]\n" + "\tadds r0, r5\n" + "\tlsls r0, 6\n" + "\tadd r0, r8\n" + "\tldr r2, =gContestOpponents\n" + "\tmov r3, sp\n" + "\tadds r4, r3, r1\n" + "\tldrb r1, [r4]\n" + "\tlsls r1, 6\n" + "\tadds r1, r2\n" + "\tmovs r2, 0x40\n" + "\tbl memcpy\n" + "\tldrb r0, [r6]\n" + "\tadds r0, r5\n" + "\tlsls r0, 6\n" + "\tmov r1, r8\n" + "\tadds r1, 0xD\n" + "\tadds r0, r1\n" + "\tbl sub_80DF9D4\n" + "\tldrb r0, [r6]\n" + "\tadds r0, r5\n" + "\tlsls r0, 6\n" + "\tadd r0, r9\n" + "\tmovs r1, 0x2\n" + "\tbl sub_80DF9E0\n" + "\tldrb r0, [r4]\n" + "\tadds r3, r5, 0x1\n" + "\tsubs r1, r7, 0x1\n" + "\tcmp r0, 0xFF\n" + "\tbeq _080DADE6\n" + "\tadds r2, r4, 0\n" + "_080DADDA:\n" + "\tldrb r0, [r2, 0x1]\n" + "\tstrb r0, [r2]\n" + "\tadds r2, 0x1\n" + "\tldrb r0, [r2]\n" + "\tcmp r0, 0xFF\n" + "\tbne _080DADDA\n" + "_080DADE6:\n" + "\tlsls r0, r1, 24\n" + "\tlsrs r7, r0, 24\n" + "\tadds r5, r3, 0\n" + "\tldrb r1, [r6]\n" + "\tmovs r0, 0x4\n" + "\tsubs r0, r1\n" + "\tcmp r5, r0\n" + "\tblt _080DAD82\n" + "_080DADF6:\n" + "\tadd sp, 0x64\n" + "\tpop {r3,r4}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.pool"); +} +#endif + +// GetContestAvailability? +u8 sub_80DAE0C(struct Pokemon *pkmn) +{ + u8 ribbon; + u8 retVal; + + if (GetMonData(pkmn, MON_DATA_IS_EGG)) + return 3; + if (GetMonData(pkmn, MON_DATA_HP) == 0) + return 4; + switch (gSpecialVar_ContestCategory) + { + case CONTEST_CATEGORY_COOL: + ribbon = GetMonData(pkmn, MON_DATA_COOL_RIBBON); + break; + case CONTEST_CATEGORY_BEAUTY: + ribbon = GetMonData(pkmn, MON_DATA_BEAUTY_RIBBON); + break; + case CONTEST_CATEGORY_CUTE: + ribbon = GetMonData(pkmn, MON_DATA_CUTE_RIBBON); + break; + case CONTEST_CATEGORY_SMART: + ribbon = GetMonData(pkmn, MON_DATA_SMART_RIBBON); + break; + case CONTEST_CATEGORY_TOUGH: + ribbon = GetMonData(pkmn, MON_DATA_TOUGH_RIBBON); + break; + default: + return 0; + } + + // Couldn't get this to match any other way. + // Returns 2, 1, or 0 respectively if ribbon's rank is above, equal, or below + // the current contest rank. + if (ribbon > gSpecialVar_ContestRank) + retVal = 2; + else if (ribbon >= gSpecialVar_ContestRank) + retVal = 1; + else + retVal = 0; + return retVal; +} + +void sub_80DAEA4(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + FillWindowPixelBuffer(gUnknown_02039F26[i], 0); + sub_80DAF04(i); + sub_80DAF88(i); + } +} + +u8 * sub_80DAED4(const u8 * src, u8 color) +{ + u8 * ptr = StringCopy(gDisplayedStringBattle, gText_ColorTransparent); + ptr[-1] = color; + ptr = StringCopy(ptr, src); + + return ptr; +} + +void sub_80DAF04(u8 a0) +{ + sub_80DAF1C(a0, a0 + 10); +} + +void sub_80DAF1C(u8 a0, u8 a1) +{ + u8 buffer[32]; + s32 offset; + + StringCopy(buffer, gText_Slash); + StringAppend(buffer, gContestMons[a0].trainerName); + sub_80DAED4(buffer, a1); + offset = GetStringRightAlignXOffset(7, gDisplayedStringBattle, 0x60); + if (offset > 55) + offset = 55; + Contest_PrintTextToBg0WindowAt(gUnknown_02039F26[a0], gDisplayedStringBattle, offset, 1, 7); +} + +void sub_80DAF88(u8 a0) +{ + sub_80DAFA0(a0, a0 + 10); +} + +void sub_80DAFA0(u8 a0, u8 a1) +{ + sub_80DAED4(gContestMons[a0].nickname, a1); + Contest_PrintTextToBg0WindowAt(gUnknown_02039F26[a0], gDisplayedStringBattle, 5, 1, 7); +} + +u16 sub_80DAFE0(u8 who, u8 contestCategory) +{ + u8 statMain; + u8 statSub1; + u8 statSub2; + + switch (contestCategory) + { + case CONTEST_CATEGORY_COOL: + statMain = gContestMons[who].cool; + statSub1 = gContestMons[who].tough; + statSub2 = gContestMons[who].beauty; + break; + case CONTEST_CATEGORY_BEAUTY: + statMain = gContestMons[who].beauty; + statSub1 = gContestMons[who].cool; + statSub2 = gContestMons[who].cute; + break; + case CONTEST_CATEGORY_CUTE: + statMain = gContestMons[who].cute; + statSub1 = gContestMons[who].beauty; + statSub2 = gContestMons[who].smart; + break; + case CONTEST_CATEGORY_SMART: + statMain = gContestMons[who].smart; + statSub1 = gContestMons[who].cute; + statSub2 = gContestMons[who].tough; + break; + case CONTEST_CATEGORY_TOUGH: + default: + statMain = gContestMons[who].tough; + statSub1 = gContestMons[who].smart; + statSub2 = gContestMons[who].cool; + break; + } + return statMain + (statSub1 + statSub2 + gContestMons[who].sheen) / 2; +} + +void sub_80DB09C(u8 a0) +{ + s32 i; + + for (i = 0; i < 4; i++) + gContestMonConditions[i] = sub_80DAFE0(i, a0); +} + +u8 sub_80DB0C4(void) +{ + u8 spriteId; + + LoadCompressedObjectPic(&gUnknown_08587C00); + LoadCompressedPalette(gContest2Pal, 0x110, 32); + spriteId = CreateSprite(&gSpriteTemplate_8587BE8, 112, 36, 30); + gSprites[spriteId].oam.paletteNum = 1; + gSprites[spriteId].callback = SpriteCallbackDummy; + return spriteId; +} + +u8 sub_80DB120(void) +{ + u8 spriteId; + + LoadCompressedObjectPic(&gUnknown_08587C08); + LoadCompressedObjectPalette(&gUnknown_08587C10); + spriteId = CreateSprite(&gSpriteTemplate_8587C18, 96, 10, 29); + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].data[0] = gSprites[spriteId].oam.tileNum; + return spriteId; +} + +u8 sub_80DB174(u16 species, u32 otId, u32 personality, u32 index) +{ + u8 spriteId; + species = sub_80DE84C(species); + + if (index == gContestPlayerMonIndex) + HandleLoadSpecialPokePic_2(gMonBackPicTable + species, gMonSpritesGfxPtr->sprites[0], species, personality); + else + HandleLoadSpecialPokePic_DontHandleDeoxys(gMonBackPicTable + species, gMonSpritesGfxPtr->sprites[0], species, personality); + + LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20); + SetMultiuseSpriteTemplateToPokemon(species, 0); + + spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, sub_80A600C(2, species, 0), 30); + gSprites[spriteId].oam.paletteNum = 2; + gSprites[spriteId].oam.priority = 2; + gSprites[spriteId].subpriority = sub_80A82E4(2); + gSprites[spriteId].callback = SpriteCallbackDummy; + gSprites[spriteId].data[0] = gSprites[spriteId].oam.paletteNum; + gSprites[spriteId].data[2] = species; + if (IsSpeciesNotUnown(species)) + gSprites[spriteId].affineAnims = gUnknown_082FF6C0; + else + gSprites[spriteId].affineAnims = gUnknown_082FF694; + StartSpriteAffineAnim(gSprites + spriteId, 0); + + return spriteId; +} + +bool8 IsSpeciesNotUnown(u16 species) +{ + if (species == SPECIES_UNOWN) + return FALSE; + else + return TRUE; +} + +void sub_80DB2BC(void) +{ + CpuCopy16(gContestResources->field_24[0], gContestResources->field_24[0] + 0x500, 0x280); + CpuCopy16(gContestResources->field_24[2], gContestResources->field_24[2] + 0x500, 0x280); +} + +u16 sub_80DB2EC(u16 a0, u8 a1) +{ + u16 var; + + switch (gContestEffects[gContestMoves[a0].effect].effectType) + { + case 0: + case 1: + case 8: + var = 0x9082; + break; + case 2: + case 3: + var = 0x9088; + break; + default: + var = 0x9086; + break; + } + var += 0x9000 + (a1 << 12); + return var; +} + +void prints_contest_move_description(u16 a) +{ + u8 category; + u16 categoryTile; + u8 numHearts; + + category = gContestMoves[a].contestCategory; + if (category == CONTEST_CATEGORY_COOL) + categoryTile = 0x4040; + else if (category == CONTEST_CATEGORY_BEAUTY) + categoryTile = 0x4045; + else if (category == CONTEST_CATEGORY_CUTE) + categoryTile = 0x404A; + else if (category == CONTEST_CATEGORY_SMART) + categoryTile = 0x406A; + else + categoryTile = 0x408A; + + ContestBG_FillBoxWithIncrementingTile(0, categoryTile, 0x0b, 0x1f, 0x05, 0x01, 0x11, 0x01); + ContestBG_FillBoxWithIncrementingTile(0, categoryTile + 0x10, 0x0b, 0x20, 0x05, 0x01, 0x11, 0x01); + + if (gContestEffects[gContestMoves[a].effect].appeal == 0xFF) + numHearts = 0; + else + numHearts = gContestEffects[gContestMoves[a].effect].appeal / 10; + if (numHearts > 8) + numHearts = 8; + ContestBG_FillBoxWithTile(0, 0x5035, 0x15, 0x1f, 0x08, 0x01, 0x11); + ContestBG_FillBoxWithTile(0, 0x5012, 0x15, 0x1f, numHearts, 0x01, 0x11); + + if (gContestEffects[gContestMoves[a].effect].jam == 0xFF) + numHearts = 0; + else + numHearts = gContestEffects[gContestMoves[a].effect].jam / 10; + if (numHearts > 8) + numHearts = 8; + ContestBG_FillBoxWithTile(0, 0x5036, 0x15, 0x20, 0x08, 0x01, 0x11); + ContestBG_FillBoxWithTile(0, 0x5014, 0x15, 0x20, numHearts, 0x01, 0x11); + + FillWindowPixelBuffer(10, 0); + Contest_PrintTextToBg0WindowStd(10, gContestEffectDescriptionPointers[gContestMoves[a].effect]); + Contest_PrintTextToBg0WindowStd(9, gText_Slash); +} + +void sub_80DB4E0(u16 move, u8 b) +{ + u8 r7 = gUnknown_02039F26[b] * 5 + 2; + + if (!sub_80DBCA8(b) && move != MOVE_NONE) + { + u16 tile = sub_80DB2EC(move, b); + + ContestBG_FillBoxWithIncrementingTile(0, tile, 20, r7, 2, 1, 17, 1); + ContestBG_FillBoxWithIncrementingTile(0, tile + 16, 20, r7 + 1, 2, 1, 17, 1); + } + else + { + ContestBG_FillBoxWithTile(0, 0, 20, r7, 2, 2, 17); + } +} + +void sub_80DB584(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + sub_80DB4E0(gContestResources->field_4[i].currMove, i); +} + +u16 sub_80DB5B0(void) +{ + return 0x2034; +} + +bool8 sub_80DB5B8(u8 contestantIdx, bool8 resetMod) +{ + u8 r6; + s32 r4; + + if (sContestantStatus[contestantIdx].conditionMod == 0) + return FALSE; + r6 = gUnknown_02039F26[contestantIdx] * 5 + 2; + r4 = sContestantStatus[contestantIdx].condition / 10; + if (sContestantStatus[contestantIdx].conditionMod == 1) + { + ContestBG_FillBoxWithTile(0, sub_80DB5B0(), 19, r6, 1, r4, 17); + if (resetMod) + { + PlaySE(SE_EXPMAX); + sContestantStatus[contestantIdx].conditionMod = 0; + } + } + else + { + ContestBG_FillBoxWithTile(0, 0, 19, r6 + r4, 1, 3 - r4, 17); + if (resetMod) + { + PlaySE(SE_FU_ZAKU2); + sContestantStatus[contestantIdx].conditionMod = 0; + } + } + return TRUE; +} + +void sub_80DB69C(void) +{ + s32 i; + s32 r6; + + for (i = 0; i < 4; i++) + { + u8 r4 = gUnknown_02039F26[i] * 5 + 2; + u16 r5 = sub_80DB5B0(); + + r6 = sContestantStatus[i].condition / 10; + ContestBG_FillBoxWithTile(0, r5, 19, r4, 1, r6, 17); + ContestBG_FillBoxWithTile(0, 0, 19, r4 + r6, 1, 3 - r6, 17); + } +} + +u16 sub_80DB748(u8 status) +{ + u16 var = 0; + + switch (status) + { + case 0: + var = 0x80; + break; + case 1: + var = 0x84; + break; + case 2: + var = 0x86; + break; + case 3: + var = 0x88; + break; + case 4: + var = 0x82; + break; + } + var += 0x9000; + return var; +} + +bool8 sub_80DB798(u8 a) +{ + bool8 r9 = TRUE; + u16 r8 = 0; + u8 r7 = gUnknown_02039F26[a] * 5 + 2; + + if (sContestantStatus[a].resistant != 0 || sContestantStatus[a].immune != 0 || sContestantStatus[a].jamSafetyCount != 0 || sContestantStatus[a].jamReduction != 0) + r8 = sub_80DB748(0); + else if (sContestantStatus[a].nervous) + r8 = sub_80DB748(1); + else if (sContestantStatus[a].numTurnsSkipped != 0 || sContestantStatus[a].noMoreTurns) + r8 = sub_80DB748(2); + else + r9 = FALSE; + if (r9) + { + ContestBG_FillBoxWithIncrementingTile(0, r8, 20, r7, 2, 1, 17, 1); + ContestBG_FillBoxWithIncrementingTile(0, r8 + 16, 20, r7 + 1, 2, 1, 17, 1); + } + else + { + ContestBG_FillBoxWithTile(0, 0, 20, r7, 2, 2, 17); + } + return r9; +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 728b887f8..38b1fea4f 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -29,6 +29,7 @@ #include "daycare.h" #include "data2.h" #include "contest.h" +#include "contest_effect.h" extern struct UnkSummaryStruct* gUnknown_0203CF1C; extern struct BgTemplate gUnknown_0861CBB4; @@ -41,7 +42,6 @@ extern struct UnkStruct_61CC04 gUnknown_0861CC10; extern struct UnkStruct_61CC04 gUnknown_0861CBEC; extern struct UnkStruct_61CC04 gUnknown_0861CBF8; extern u16 gSummaryScreenWindow_Tilemap[]; -extern struct ContestMove gContestMoves[]; extern struct ContestEffect gContestEffects[]; extern struct WindowTemplate gUnknown_0861CC24; extern u8 gUnknown_0861CD2C[][3]; diff --git a/src/tv.c b/src/tv.c index 2e915697e..d09e72abc 100644 --- a/src/tv.c +++ b/src/tv.c @@ -1448,8 +1448,8 @@ void ContestLiveUpdates_BeforeInterview_5(u8 a0, u8 a1) sCurTVShowSlot = FindEmptyTVSlotWithinFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows); if (sCurTVShowSlot != -1) { - show->contestLiveUpdates.winningSpecies = gUnknown_02039E00[a1].unk_00; - StringCopy(show->contestLiveUpdates.winningTrainerName, gUnknown_02039E00[a1].unk_0d); + show->contestLiveUpdates.winningSpecies = gContestMons[a1].species; + StringCopy(show->contestLiveUpdates.winningTrainerName, gContestMons[a1].trainerName); StripExtCtrlCodes(show->contestLiveUpdates.winningTrainerName); show->contestLiveUpdates.appealFlags2 = a0; if (a1 + 1 > gUnknown_02039F30) diff --git a/sym_common.txt b/sym_common.txt index 0158b7615..96796d941 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -43,9 +43,7 @@ gUnknown_030060B0: @ 30060B0 gUnknown_030060B4: @ 30060B4 .space 0x4 -gUnknown_030060B8: @ 30060B8 - .space 0x4 - + .include "contest.o" .include "tv.o" .include "mauville_old_man.o" diff --git a/sym_ewram.txt b/sym_ewram.txt index 37a34b19a..c1b85ce65 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -382,61 +382,9 @@ gUnknown_02039D8C: @ 2039D8C .include "src/fldeff_cut.o" .include "src/map_name_popup.o" .include "src/item.o" + .include "src/contest.o" -gUnknown_02039E00: @ 2039E00 - .space 0x100 - -gUnknown_02039F00: @ 2039F00 - .space 0x8 - -gUnknown_02039F08: @ 2039F08 - .space 0x8 - -gUnknown_02039F10: @ 2039F10 - .space 0x8 - -gUnknown_02039F18: @ 2039F18 - .space 0x8 - -gUnknown_02039F20: @ 2039F20 - .space 0x4 - -gUnknown_02039F24: @ 2039F24 - .space 0x1 - -gUnknown_02039F25: @ 2039F25 - .space 0x1 - -gUnknown_02039F26: @ 2039F26 - .space 0x4 - -gUnknown_02039F2A: @ 2039F2A - .space 0x1 - -gUnknown_02039F2B: @ 2039F2B - .space 0x1 - -gSpecialVar_ContestCategory: @ 2039F2C - .space 0x2 - -gSpecialVar_ContestRank: @ 2039F2E - .space 0x2 - -gUnknown_02039F30: @ 2039F30 - .space 0x1 - -gUnknown_02039F31: @ 2039F31 - .space 0x3 - -gContestResources: @ 2039F34 - .space 0x4 - -gUnknown_02039F38: @ 2039F38 - .space 0x4 - -gUnknown_02039F3C: @ 2039F3C - .space 0x20 - + .align 2 gUnknown_02039F5C: @ 2039F5C .space 0x1