diff --git a/asm/credits.s b/asm/credits.s index a8a665b06a..e69384c03b 100644 --- a/asm/credits.s +++ b/asm/credits.s @@ -2678,7 +2678,7 @@ _08176B54: bl LoadSpritePalettes movs r0, 0x78 movs r1, 0x2E - bl sub_817B834 + bl intro_create_brendan_sprite lsls r0, 24 lsrs r2, r0, 24 ldr r0, =gTasks @@ -2703,7 +2703,7 @@ _08176B54: movs r0, 0x88 lsls r0, 1 movs r1, 0x2E - bl sub_817B88C + bl intro_create_may_sprite b _08176C2C .pool _08176BD8: @@ -2717,7 +2717,7 @@ _08176BD8: bl LoadSpritePalettes movs r0, 0x78 movs r1, 0x2E - bl sub_817B88C + bl intro_create_may_sprite lsls r0, 24 lsrs r2, r0, 24 ldr r0, =gTasks @@ -2742,7 +2742,7 @@ _08176BD8: movs r0, 0x88 lsls r0, 1 movs r1, 0x2E - bl sub_817B834 + bl intro_create_brendan_sprite _08176C2C: lsls r0, 24 lsrs r2, r0, 24 diff --git a/asm/intro.s b/asm/intro.s index c1754873ce..97dd9b6de8 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -3,5991 +3,6 @@ .syntax unified - .text - - thumb_func_start sub_816CBE8 -sub_816CBE8: @ 816CBE8 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl ScanlineEffect_InitHBlankDmaTransfer - pop {r0} - bx r0 - thumb_func_end sub_816CBE8 - - thumb_func_start sub_816CC00 -sub_816CC00: @ 816CC00 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - ldr r0, =gMain - ldrh r0, [r0, 0x2E] - cmp r0, 0 - beq _0816CC3C - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816CC3C - ldr r0, =sub_816CC54 - bl SetMainCallback2 - b _0816CC4C - .pool -_0816CC3C: - ldr r2, =gUnknown_030062A0 - ldr r1, [r2] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0816CC4C - adds r0, r1, 0x1 - str r0, [r2] -_0816CC4C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816CC00 - - thumb_func_start sub_816CC54 -sub_816CC54: @ 816CC54 - push {lr} - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0816CC66 - ldr r0, =CB2_InitTitleScreen - bl SetMainCallback2 -_0816CC66: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816CC54 - - thumb_func_start load_copyright_graphics -@ void load_copyright_graphics(u16 tile_patterns_dest, u16 tilemap_dest, u16 unknown_dest) -load_copyright_graphics: @ 816CC70 - push {r4-r6,lr} - adds r3, r0, 0 - adds r4, r1, 0 - adds r5, r2, 0 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - ldr r0, =gIntroCopyright_Gfx - movs r6, 0xC0 - lsls r6, 19 - adds r3, r6 - adds r1, r3, 0 - bl LZ77UnCompVram - ldr r0, =gIntroCopyright_Tilemap - adds r4, r6 - adds r1, r4, 0 - bl LZ77UnCompVram - ldr r0, =gIntroCopyright_Pal - adds r1, r5, 0 - movs r2, 0x20 - bl LoadPalette - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end load_copyright_graphics - - thumb_func_start SerialCb_CopyrightScreen -SerialCb_CopyrightScreen: @ 816CCB8 - push {lr} - ldr r0, =gUnknown_030062B0 - bl GameCubeMultiBoot_HandleSerialInterrupt - pop {r0} - bx r0 - .pool - thumb_func_end SerialCb_CopyrightScreen - - thumb_func_start do_copyright_screen -do_copyright_screen: @ 816CCC8 - push {r4-r6,lr} - sub sp, 0x10 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r5, r0, r1 - ldrb r4, [r5] - cmp r4, 0x8C - bne _0816CCDC - b _0816CE00 -_0816CCDC: - cmp r4, 0x8C - bgt _0816CCEC - cmp r4, 0 - beq _0816CCF4 - b _0816CDBC - .pool -_0816CCEC: - cmp r4, 0x8D - bne _0816CCF2 - b _0816CE2C -_0816CCF2: - b _0816CDBC -_0816CCF4: - movs r0, 0 - bl SetVBlankCallback - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - movs r1, 0xA0 - lsls r1, 19 - ldr r2, =0x00007fff - adds r0, r2, 0 - strh r0, [r1] - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0x10 - movs r1, 0 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - str r4, [sp, 0x4] - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05006000 - add r0, sp, 0x4 - bl CpuSet - str r4, [sp, 0x8] - add r0, sp, 0x8 - movs r1, 0xE0 - lsls r1, 19 - ldr r2, =0x05000100 - bl CpuSet - add r0, sp, 0xC - strh r4, [r0] - ldr r1, =0x05000002 - ldr r2, =0x010001ff - bl CpuSet - bl ResetPaletteFade - movs r1, 0xE0 - lsls r1, 6 - movs r0, 0 - movs r2, 0 - bl load_copyright_graphics - bl ScanlineEffect_Stop - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r1, 0xE0 - lsls r1, 3 - movs r0, 0x8 - bl SetGpuReg - movs r0, 0x1 - bl EnableInterrupts - ldr r0, =sub_816CBE8 - bl SetVBlankCallback - movs r1, 0x80 - lsls r1, 19 - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =SerialCb_CopyrightScreen - bl SetSerialCallback - ldr r0, =gUnknown_030062B0 - bl GameCubeMultiBoot_Init -_0816CDBC: - bl UpdatePaletteFade - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - ldr r0, =gUnknown_030062B0 - bl GameCubeMultiBoot_Main - b _0816CEA0 - .pool -_0816CE00: - ldr r4, =gUnknown_030062B0 - adds r0, r4, 0 - bl GameCubeMultiBoot_Main - ldrb r0, [r4, 0x2] - cmp r0, 0x1 - beq _0816CEA0 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _0816CEA0 - .pool -_0816CE2C: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0816CEA0 - ldr r0, =task_intro_1 - movs r1, 0 - bl CreateTask - ldr r0, =sub_816CC00 - bl SetMainCallback2 - ldr r5, =gUnknown_030062B0 - ldrb r0, [r5, 0x2] - cmp r0, 0 - beq _0816CE8C - ldrb r0, [r5, 0x2] - cmp r0, 0x2 - bne _0816CE96 - ldr r6, =0x020000ac - ldr r4, [r6] - ldr r0, =0x65366347 - cmp r4, r0 - bne _0816CE6C - ldr r0, =gMultiBootProgram_PokemonColosseum_Start - movs r1, 0x80 - lsls r1, 18 - movs r2, 0xA0 - lsls r2, 9 - bl CpuSet - str r4, [r6] -_0816CE6C: - adds r0, r5, 0 - bl GameCubeMultiBoot_ExecuteProgram - b _0816CE96 - .pool -_0816CE8C: - bl GameCubeMultiBoot_Quit - ldr r0, =SerialCB - bl SetSerialCallback -_0816CE96: - movs r0, 0 - b _0816CEA2 - .pool -_0816CEA0: - movs r0, 0x1 -_0816CEA2: - add sp, 0x10 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end do_copyright_screen - - thumb_func_start c2_copyright_1 -c2_copyright_1: @ 816CEAC - push {lr} - bl do_copyright_screen - lsls r0, 24 - cmp r0, 0 - bne _0816CEFA - bl sub_815355C - lsls r0, 16 - lsrs r0, 16 - bl SetSaveBlocksPointers - bl sub_808447C - bl ResetSaveCounters - movs r0, 0 - bl sub_81534D0 - ldr r0, =gSaveFileStatus - ldrh r0, [r0] - cmp r0, 0 - beq _0816CEDE - cmp r0, 0x2 - bne _0816CEE2 -_0816CEDE: - bl Sav2_ClearSetDefault -_0816CEE2: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x15] - lsls r0, 31 - lsrs r0, 31 - bl SetPokemonCryStereo - ldr r0, =0x02000000 - movs r1, 0xE0 - lsls r1, 9 - bl InitHeap -_0816CEFA: - pop {r0} - bx r0 - .pool - thumb_func_end c2_copyright_1 - - thumb_func_start CB2_InitCopyrightScreenAfterTitleScreen -CB2_InitCopyrightScreenAfterTitleScreen: @ 816CF0C - push {lr} - bl do_copyright_screen - pop {r0} - bx r0 - thumb_func_end CB2_InitCopyrightScreenAfterTitleScreen - - thumb_func_start task_intro_1 -@ void task_intro_1(int task_id) -task_intro_1: @ 816CF18 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - mov r8, r0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r0, 0 - bl SetVBlankCallback - ldr r4, =gUnknown_0203BCC8 - bl Random - movs r1, 0x1 - ands r1, r0 - strh r1, [r4] - bl intro_reset_and_hide_bgs - movs r0, 0x1E - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0x50 - bl SetGpuReg - movs r0, 0x16 - movs r1, 0x18 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0x28 - bl SetGpuReg - ldr r0, =gIntro1BGLeavesGfx - movs r1, 0xC0 - lsls r1, 19 - bl LZ77UnCompVram - ldr r0, =gIntro1BG0_Tilemap - ldr r1, =0x06008000 - bl LZ77UnCompVram - ldr r1, =0x06008800 - add r0, sp, 0x8 - movs r6, 0 - strh r6, [r0] - ldr r4, =0x040000d4 - str r0, [r4] - str r1, [r4, 0x4] - ldr r5, =0x81000400 - str r5, [r4, 0x8] - ldr r0, [r4, 0x8] - ldr r0, =gIntro1BG1_Tilemap - ldr r1, =0x06009000 - bl LZ77UnCompVram - ldr r1, =0x06009800 - add r0, sp, 0x8 - strh r6, [r0] - str r0, [r4] - str r1, [r4, 0x4] - str r5, [r4, 0x8] - ldr r0, [r4, 0x8] - ldr r0, =gIntro1BG2_Tilemap - ldr r1, =0x0600a000 - bl LZ77UnCompVram - ldr r1, =0x0600a800 - add r0, sp, 0x8 - strh r6, [r0] - str r0, [r4] - str r1, [r4, 0x4] - str r5, [r4, 0x8] - ldr r0, [r4, 0x8] - ldr r0, =gIntro1BG3_Tilemap - ldr r1, =0x0600b000 - bl LZ77UnCompVram - ldr r1, =0x0600b800 - add r0, sp, 0x8 - strh r6, [r0] - str r0, [r4] - str r1, [r4, 0x4] - str r5, [r4, 0x8] - ldr r0, [r4, 0x8] - ldr r0, =gIntro1BGPals - movs r5, 0x80 - lsls r5, 2 - movs r1, 0 - adds r2, r5, 0 - bl LoadPalette - ldr r1, =0x00009603 - movs r0, 0xE - bl SetGpuReg - ldr r1, =0x00009402 - movs r0, 0xC - bl SetGpuReg - ldr r1, =0x00009201 - movs r0, 0xA - bl SetGpuReg - movs r1, 0x90 - lsls r1, 8 - movs r0, 0x8 - bl SetGpuReg - ldr r0, =gUnknown_085E4FDC - bl LoadCompressedObjectPic - ldr r0, =gUnknown_085E4FEC - bl LoadCompressedObjectPic - ldr r0, =gUnknown_085E4FFC - bl LoadSpritePalettes - ldr r0, =gUnknown_085E4A74 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_085E4A84 - bl LoadSpritePalettes - ldr r4, =gPlttBufferUnfaded + 0x200 - movs r3, 0xF0 - lsls r3, 1 - adds r1, r4, r3 - adds r0, r4, 0 - movs r2, 0x10 - bl CpuSet - movs r0, 0xE1 - lsls r0, 1 - adds r1, r4, r0 - adds r0, r4, 0 - movs r2, 0xF - bl CpuSet - movs r3, 0xD2 - lsls r3, 1 - adds r1, r4, r3 - adds r0, r4, 0 - movs r2, 0xE - bl CpuSet - movs r0, 0xC3 - lsls r0, 1 - adds r1, r4, r0 - adds r0, r4, 0 - movs r2, 0xD - bl CpuSet - movs r3, 0xB4 - lsls r3, 1 - adds r1, r4, r3 - adds r0, r4, 0 - movs r2, 0xC - bl CpuSet - movs r0, 0xA5 - lsls r0, 1 - adds r1, r4, r0 - adds r0, r4, 0 - movs r2, 0xB - bl CpuSet - movs r3, 0x96 - lsls r3, 1 - adds r1, r4, r3 - adds r0, r4, 0 - movs r2, 0xA - bl CpuSet - movs r0, 0x78 - movs r1, 0x50 - movs r2, 0 - bl sub_816FDB8 - movs r1, 0xE - negs r1, r1 - movs r0, 0x78 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - movs r0, 0xEC - adds r2, r5, 0 - movs r3, 0x1 - bl sub_816F7D0 - ldr r2, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x8] - ldr r0, =task_intro_2 - str r0, [r1] - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_1 - - thumb_func_start task_intro_2 -task_intro_2: @ 816D12C - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - negs r0, r0 - movs r5, 0 - str r5, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_816CBE8 - bl SetVBlankCallback - movs r1, 0xFA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_3 - str r1, [r0] - ldr r0, =gUnknown_030062A0 - str r5, [r0] - movs r0, 0xCF - lsls r0, 1 - bl m4aSongNumStart - bl ResetSerial - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_2 - - thumb_func_start task_intro_3 -task_intro_3: @ 816D190 - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - ldr r5, =gUnknown_030062A0 - ldr r0, [r5] - cmp r0, 0x4C - bne _0816D1BE - ldr r2, =gSprites - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r3, 0x8 - ldrsh r1, [r0, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strh r1, [r0, 0x2E] -_0816D1BE: - ldr r0, [r5] - cmp r0, 0x80 - bne _0816D1CC - ldr r0, =task_intro_3_1 - movs r1, 0 - bl CreateTask -_0816D1CC: - ldr r0, [r5] - cmp r0, 0xFB - bne _0816D1EE - ldr r2, =gSprites - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r3, 0x8 - ldrsh r1, [r0, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strh r1, [r0, 0x2E] -_0816D1EE: - ldr r1, [r5] - movs r0, 0x80 - lsls r0, 1 - cmp r1, r0 - bne _0816D200 - ldr r0, =task_intro_3_2 - movs r1, 0 - bl CreateTask -_0816D200: - ldr r1, [r5] - movs r0, 0xB8 - lsls r0, 1 - cmp r1, r0 - bne _0816D220 - movs r2, 0x80 - lsls r2, 3 - movs r0, 0x70 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x30 - movs r1, 0 - movs r3, 0x5 - bl sub_816F7D0 -_0816D220: - ldr r1, [r5] - movs r0, 0xC0 - lsls r0, 1 - cmp r1, r0 - bne _0816D240 - movs r2, 0x80 - lsls r2, 3 - movs r0, 0x80 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0xC8 - movs r1, 0x3C - movs r3, 0x9 - bl sub_816F7D0 -_0816D240: - ldr r0, [r5] - movs r4, 0x8C - lsls r4, 2 - cmp r0, r4 - bne _0816D252 - ldr r0, =task_intro_3_3 - movs r1, 0 - bl CreateTask -_0816D252: - ldr r0, [r5] - cmp r0, r4 - bls _0816D27A - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0x50 - strh r1, [r0, 0xA] - strh r2, [r0, 0xC] - movs r1, 0x18 - strh r1, [r0, 0xE] - strh r2, [r0, 0x10] - movs r1, 0x28 - strh r1, [r0, 0x12] - strh r2, [r0, 0x14] - ldr r1, =task_intro_4 - str r1, [r0] -_0816D27A: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_3 - - thumb_func_start task_intro_3_3 -task_intro_3_3: @ 816D2A0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816D2C4 - ldrh r0, [r4, 0x6] - adds r0, 0x1 - strh r0, [r4, 0x6] -_0816D2C4: - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0816D2D8 - cmp r0, 0x1 - beq _0816D314 - b _0816D324 - .pool -_0816D2D8: - ldr r0, =gUnknown_085E4AB8 - ldr r2, =gUnknown_085E4AD0 - movs r1, 0x8 - ldrsh r3, [r4, r1] - lsls r3, 1 - adds r1, r3, r2 - ldrb r1, [r1] - adds r2, 0x1 - adds r3, r2 - ldrh r2, [r4, 0x6] - ldrb r3, [r3] - adds r2, r3 - lsls r2, 16 - asrs r2, 16 - movs r3, 0 - bl CreateSprite - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - movs r0, 0xC - strh r0, [r4, 0x2] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0816D324 - .pool -_0816D314: - ldrh r0, [r4, 0x2] - subs r0, 0x1 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _0816D324 - strh r0, [r4] -_0816D324: - movs r1, 0x6 - ldrsh r0, [r4, r1] - cmp r0, 0x3C - ble _0816D332 - adds r0, r5, 0 - bl DestroyTask -_0816D332: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end task_intro_3_3 - - thumb_func_start sub_816D338 -sub_816D338: @ 816D338 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x2E] - adds r0, 0x1 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xC - bne _0816D350 - adds r0, r1, 0 - bl DestroySprite -_0816D350: - pop {r0} - bx r0 - thumb_func_end sub_816D338 - - thumb_func_start task_intro_4 -task_intro_4: @ 816D354 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r1, r0, 24 - adds r4, r1, 0 - ldr r5, =gUnknown_030062A0 - ldr r2, [r5] - ldr r0, =0x00000387 - cmp r2, r0 - bhi _0816D418 - ldr r0, =gTasks - lsls r4, r1, 2 - adds r4, r1 - lsls r4, 3 - adds r4, r0 - movs r1, 0xA - ldrsh r0, [r4, r1] - lsls r0, 16 - ldrh r1, [r4, 0xC] - adds r1, r0, r1 - ldr r0, =0xffffa000 - adds r1, r0 - asrs r0, r1, 16 - strh r0, [r4, 0xA] - strh r1, [r4, 0xC] - ldrh r1, [r4, 0xA] - movs r0, 0x1A - bl SetGpuReg - movs r1, 0xE - ldrsh r0, [r4, r1] - lsls r0, 16 - ldrh r1, [r4, 0x10] - adds r1, r0, r1 - ldr r0, =0xffff8000 - adds r1, r0 - asrs r0, r1, 16 - strh r0, [r4, 0xE] - strh r1, [r4, 0x10] - ldrh r1, [r4, 0xE] - movs r0, 0x16 - bl SetGpuReg - movs r1, 0x12 - ldrsh r0, [r4, r1] - lsls r0, 16 - ldrh r1, [r4, 0x14] - adds r1, r0, r1 - ldr r0, =0xffff4000 - adds r1, r0 - asrs r0, r1, 16 - strh r0, [r4, 0x12] - strh r1, [r4, 0x14] - ldrh r1, [r4, 0x12] - movs r0, 0x12 - bl SetGpuReg - ldr r1, [r5] - movs r0, 0xD0 - lsls r0, 2 - cmp r1, r0 - bne _0816D43E - ldr r0, =gUnknown_085E4FC4 - movs r1, 0x78 - movs r2, 0xA0 - movs r3, 0xA - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - b _0816D43E - .pool -_0816D418: - ldr r0, =0x000003ef - cmp r2, r0 - bls _0816D43E - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_5 - str r1, [r0] -_0816D43E: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_4 - - thumb_func_start task_intro_5 -task_intro_5: @ 816D458 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - ldr r0, =0x00000402 - cmp r1, r0 - bls _0816D476 - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldr r0, =task_intro_6 - str r0, [r1] -_0816D476: - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_5 - - thumb_func_start task_intro_6 -task_intro_6: @ 816D48C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl intro_reset_and_hide_bgs - movs r0, 0 - bl SetVBlankCallback - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r0, =gUnknown_0203BD24 - movs r1, 0 - strh r1, [r0] - ldr r0, =gUnknown_0203BD26 - strh r1, [r0] - ldr r0, =gUnknown_0203BCCC - strh r1, [r0] - movs r0, 0x1 - bl load_intro_part2_graphics - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_7 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_6 - - thumb_func_start task_intro_7 -task_intro_7: @ 816D4E4 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203BCC8 - ldrh r0, [r0] - cmp r0, 0 - bne _0816D504 - ldr r0, =gUnknown_085F52BC - bl LoadCompressedObjectPic - b _0816D50A - .pool -_0816D504: - ldr r0, =gUnknown_085F52CC - bl LoadCompressedObjectPic -_0816D50A: - ldr r0, =gUnknown_085F52DC - bl LoadCompressedObjectPic - ldr r0, =gUnknown_085F52FC - bl LoadCompressedObjectPic - movs r6, 0 - lsls r7, r4, 2 - ldr r5, =gUnknown_085E4AE8 -_0816D51C: - lsls r0, r6, 3 - adds r0, r5 - bl LoadCompressedObjectPic - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x2 - bls _0816D51C - ldr r0, =gUnknown_085F530C - bl LoadSpritePalettes - ldr r0, =gUnknown_085E4B08 - bl LoadSpritePalettes - ldr r0, =gUnknown_085E4BDC - movs r5, 0x88 - lsls r5, 1 - adds r1, r5, 0 - movs r2, 0x80 - movs r3, 0 - bl CreateSprite - ldr r0, =gUnknown_085E4BA4 - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x6E - movs r3, 0x1 - bl CreateSprite - ldr r0, =gUnknown_0203BCC8 - ldrh r0, [r0] - cmp r0, 0 - bne _0816D590 - adds r0, r5, 0 - movs r1, 0x64 - bl sub_817B834 - b _0816D598 - .pool -_0816D590: - adds r0, r5, 0 - movs r1, 0x64 - bl sub_817B88C -_0816D598: - lsls r0, 24 - lsrs r6, r0, 24 - ldr r2, =gSprites - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r5, r2, 0 - adds r5, 0x1C - adds r3, r0, r5 - ldr r1, =sub_816F9D4 - str r1, [r3] - adds r2, 0x8 - adds r0, r2 - ldr r1, =gUnknown_085E4DC4 - str r1, [r0] - ldr r0, =gTasks - adds r4, r7, r4 - lsls r4, 3 - adds r4, r0 - strh r6, [r4, 0xA] - ldr r0, =gUnknown_085E4B40 - movs r1, 0x88 - lsls r1, 1 - movs r2, 0x50 - movs r3, 0x4 - bl CreateSprite - movs r0, 0x40 - negs r0, r0 - movs r1, 0x3C - bl sub_817B9C4 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - adds r0, r5 - ldr r1, =sub_816FAB0 - str r1, [r0] - strh r6, [r4, 0xC] - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_816CBE8 - bl SetVBlankCallback - movs r1, 0x80 - lsls r1, 7 - movs r2, 0x80 - lsls r2, 3 - movs r0, 0x1 - movs r3, 0x10 - bl sub_817B3DC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x8] - movs r0, 0x1 - bl sub_817B150 - ldr r0, =task_intro_8 - str r0, [r4] - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_7 - - thumb_func_start task_intro_8 -@ void task_intro_8(int task_id) -task_intro_8: @ 816D650 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - ldr r5, =gUnknown_030062A0 - ldr r1, [r5] - movs r0, 0xE8 - lsls r0, 3 - cmp r1, r0 - bne _0816D67C - ldr r1, =gUnknown_0203BD28 - movs r0, 0x2 - strh r0, [r1] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0, 0x8] - bl DestroyTask -_0816D67C: - ldr r1, [r5] - ldr r0, =0x0000079a - cmp r1, r0 - bls _0816D6A4 - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0x8 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_9 - str r1, [r0] -_0816D6A4: - ldr r1, [r5] - ldr r0, =0x00000455 - ldr r3, =gTasks - cmp r1, r0 - bne _0816D6C8 - ldr r2, =gSprites - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r3 - movs r7, 0xA - ldrsh r1, [r0, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strh r1, [r0, 0x2E] -_0816D6C8: - ldr r1, [r5] - ldr r0, =0x000004be - cmp r1, r0 - bne _0816D6EA - ldr r2, =gSprites - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r3 - movs r7, 0xA - ldrsh r1, [r0, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x2E] -_0816D6EA: - ldr r1, [r5] - ldr r0, =0x00000572 - cmp r1, r0 - bne _0816D70C - ldr r2, =gSprites - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r3 - movs r7, 0xC - ldrsh r1, [r0, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strh r1, [r0, 0x2E] -_0816D70C: - ldr r1, [r5] - ldr r0, =0x00000576 - cmp r1, r0 - bne _0816D72E - ldr r2, =gSprites - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r3 - movs r7, 0xA - ldrsh r1, [r0, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x2 - strh r1, [r0, 0x2E] -_0816D72E: - ldr r1, [r5] - movs r0, 0xC5 - lsls r0, 3 - cmp r1, r0 - bne _0816D752 - ldr r2, =gSprites - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r3 - movs r7, 0xA - ldrsh r1, [r0, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x3 - strh r1, [r0, 0x2E] -_0816D752: - ldr r1, [r5] - ldr r0, =0x000006bf - cmp r1, r0 - bne _0816D774 - ldr r2, =gSprites - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r3 - movs r4, 0xA - ldrsh r1, [r0, r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x4 - strh r1, [r0, 0x2E] -_0816D774: - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r4, r0, r3 - ldrh r0, [r4, 0xE] - lsls r0, 16 - asrs r0, 18 - movs r1, 0x7F - ands r0, r1 - movs r1, 0x30 - bl Sin - ldr r1, =gUnknown_0203BCCC - strh r0, [r1] - ldrh r2, [r4, 0xE] - movs r7, 0xE - ldrsh r1, [r4, r7] - ldr r0, =0x000001ff - cmp r1, r0 - bgt _0816D7A0 - adds r0, r2, 0x1 - strh r0, [r4, 0xE] -_0816D7A0: - movs r0, 0 - bl sub_817B540 - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_8 - - thumb_func_start task_intro_9 -task_intro_9: @ 816D7E8 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - ldr r0, =0x00000814 - cmp r1, r0 - bls _0816D806 - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldr r0, =task_intro_10 - str r0, [r1] -_0816D806: - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_9 - - thumb_func_start sub_816D81C -sub_816D81C: @ 816D81C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x34] - adds r0, 0x4 - strh r0, [r4, 0x34] - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x8 - bls _0816D830 - b _0816D9BA -_0816D830: - lsls r0, 2 - ldr r1, =_0816D840 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0816D840: - .4byte _0816D864 - .4byte _0816D87A - .4byte _0816D898 - .4byte _0816D8BC - .4byte _0816D8D8 - .4byte _0816D8FA - .4byte _0816D912 - .4byte _0816D96E - .4byte _0816D99C -_0816D864: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB3 - bgt _0816D874 - b _0816D9BA -_0816D874: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_0816D87A: - ldrh r0, [r4, 0x20] - subs r0, 0x4 - strh r0, [r4, 0x20] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - beq _0816D88A - b _0816D9BA -_0816D88A: - movs r0, 0x8 - strh r0, [r4, 0x2E] - movs r0, 0x14 - strh r0, [r4, 0x30] - movs r0, 0x2 - strh r0, [r4, 0x32] - b _0816D9BA -_0816D898: - ldrh r1, [r4, 0x20] - adds r1, 0x8 - strh r1, [r4, 0x20] - ldrh r0, [r4, 0x22] - subs r0, 0x2 - strh r0, [r4, 0x22] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x7C - beq _0816D8AE - b _0816D9BA -_0816D8AE: - movs r0, 0x8 - strh r0, [r4, 0x2E] - movs r0, 0x14 - strh r0, [r4, 0x30] - movs r0, 0x3 - strh r0, [r4, 0x32] - b _0816D9BA -_0816D8BC: - ldrh r0, [r4, 0x22] - adds r0, 0x4 - strh r0, [r4, 0x22] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x50 - bne _0816D9BA - movs r0, 0x8 - strh r0, [r4, 0x2E] - movs r0, 0xA - strh r0, [r4, 0x30] - movs r0, 0x4 - strh r0, [r4, 0x32] - b _0816D9BA -_0816D8D8: - ldrh r1, [r4, 0x20] - subs r1, 0x8 - strh r1, [r4, 0x20] - ldrh r0, [r4, 0x22] - subs r0, 0x2 - strh r0, [r4, 0x22] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x3C - bne _0816D9BA - movs r0, 0x8 - strh r0, [r4, 0x2E] - movs r0, 0xA - strh r0, [r4, 0x30] - movs r0, 0x5 - strh r0, [r4, 0x32] - b _0816D9BA -_0816D8FA: - ldrh r0, [r4, 0x20] - adds r0, 0x3C - strh r0, [r4, 0x20] - movs r0, 0xC0 - strh r0, [r4, 0x36] - movs r0, 0x80 - strh r0, [r4, 0x38] - movs r0, 0x3 - strh r0, [r4, 0x3A] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_0816D912: - ldrh r0, [r4, 0x36] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x3C - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x38] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x14 - bl Sin - strh r0, [r4, 0x26] - ldrh r1, [r4, 0x36] - adds r1, 0x2 - strh r1, [r4, 0x36] - ldrh r0, [r4, 0x38] - adds r0, 0x4 - strh r0, [r4, 0x38] - movs r0, 0xFF - ands r1, r0 - cmp r1, 0x40 - bne _0816D9BA - adds r2, r4, 0 - adds r2, 0x3F - ldrb r0, [r2] - movs r1, 0x2 - negs r1, r1 - ands r1, r0 - strb r1, [r2] - ldrh r0, [r4, 0x3A] - subs r0, 0x1 - strh r0, [r4, 0x3A] - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - bne _0816D9BA - ldrh r0, [r4, 0x24] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - b _0816D9B8 -_0816D96E: - ldrh r0, [r4, 0x20] - subs r0, 0x2 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x38] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x14 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x38] - adds r0, 0x4 - strh r0, [r4, 0x38] - movs r0, 0x20 - ldrsh r1, [r4, r0] - movs r0, 0x10 - negs r0, r0 - cmp r1, r0 - bge _0816D9BA - adds r0, r4, 0 - bl DestroySprite - b _0816D9BA -_0816D99C: - ldrh r0, [r4, 0x34] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - subs r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - cmp r0, 0 - bne _0816D9BA - ldrh r0, [r4, 0x32] -_0816D9B8: - strh r0, [r4, 0x2E] -_0816D9BA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816D81C - - thumb_func_start sub_816D9C0 -sub_816D9C0: @ 816D9C0 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x5 - bls _0816D9CE - b _0816DADA -_0816D9CE: - lsls r0, 2 - ldr r1, =_0816D9DC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0816D9DC: - .4byte _0816D9F4 - .4byte _0816DA08 - .4byte _0816DA20 - .4byte _0816DA64 - .4byte _0816DA9A - .4byte _0816DACA -_0816D9F4: - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - movs r0, 0x99 - lsls r0, 3 - cmp r1, r0 - bne _0816DADA - b _0816DABA - .pool -_0816DA08: - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - movs r0, 0xC5 - lsls r0, 3 - cmp r1, r0 - bne _0816DA70 - adds r0, r4, 0 - movs r1, 0 - b _0816DABE - .pool -_0816DA20: - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - ldr r0, =0x000006c7 - cmp r1, r0 - beq _0816DA50 - ldrh r0, [r4, 0x30] - adds r2, r0, 0 - adds r2, 0x20 - strh r2, [r4, 0x30] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _0816DADA - ldrh r0, [r4, 0x20] - adds r0, 0x1 - b _0816DA8A - .pool -_0816DA50: - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAnim - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r0, 0x50 - strh r0, [r4, 0x32] - b _0816DADA -_0816DA64: - ldrh r0, [r4, 0x32] - subs r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - cmp r0, 0 - beq _0816DA94 -_0816DA70: - ldrh r0, [r4, 0x30] - adds r2, r0, 0 - adds r2, 0x40 - strh r2, [r4, 0x30] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _0816DADA - ldrh r0, [r4, 0x20] - subs r0, 0x1 -_0816DA8A: - strh r0, [r4, 0x20] - movs r0, 0xFF - ands r2, r0 - strh r2, [r4, 0x30] - b _0816DADA -_0816DA94: - adds r0, r4, 0 - movs r1, 0x2 - b _0816DABE -_0816DA9A: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0816DAAE - ldrh r0, [r4, 0x20] - adds r0, 0x4 - strh r0, [r4, 0x20] -_0816DAAE: - movs r0, 0x20 - ldrsh r1, [r4, r0] - movs r0, 0xA8 - lsls r0, 1 - cmp r1, r0 - ble _0816DADA -_0816DABA: - adds r0, r4, 0 - movs r1, 0x1 -_0816DABE: - bl StartSpriteAnim - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _0816DADA -_0816DACA: - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - ldr r0, =0x0000073f - cmp r1, r0 - bls _0816DADA - ldrh r0, [r4, 0x20] - subs r0, 0x2 - strh r0, [r4, 0x20] -_0816DADA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816D9C0 - - thumb_func_start sub_816DAE8 -sub_816DAE8: @ 816DAE8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0816DB1C - cmp r0, 0x1 - bgt _0816DAFE - cmp r0, 0 - beq _0816DB04 - b _0816DBA4 -_0816DAFE: - cmp r0, 0x2 - beq _0816DB42 - b _0816DBA4 -_0816DB04: - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - movs r0, 0x88 - lsls r0, 3 - cmp r1, r0 - bne _0816DBA4 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _0816DBA4 - .pool -_0816DB1C: - ldrh r0, [r4, 0x20] - subs r0, 0x2 - strh r0, [r4, 0x20] - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - movs r0, 0x92 - lsls r0, 3 - cmp r1, r0 - bne _0816DBA4 - ldrh r0, [r4, 0x22] - subs r0, 0xC - strh r0, [r4, 0x22] - movs r0, 0x80 - strh r0, [r4, 0x30] - movs r0, 0 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_0816DB42: - movs r2, 0x20 - ldrsh r0, [r4, r2] - movs r2, 0x24 - ldrsh r1, [r4, r2] - adds r0, r1 - movs r1, 0x20 - negs r1, r1 - cmp r0, r1 - bgt _0816DB60 - adds r0, r4, 0 - bl DestroySprite - b _0816DBA4 - .pool -_0816DB60: - ldrh r0, [r4, 0x30] - movs r1, 0xFF - ands r1, r0 - cmp r1, 0x3F - bgt _0816DB72 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x10 - b _0816DB84 -_0816DB72: - cmp r1, 0x40 - bne _0816DB7C - ldrh r0, [r4, 0x20] - subs r0, 0x30 - strh r0, [r4, 0x20] -_0816DB7C: - ldrh r0, [r4, 0x30] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x40 -_0816DB84: - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0xC - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_0816DBA4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816DAE8 - - thumb_func_start task_intro_10 -task_intro_10: @ 816DBAC - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - bl intro_reset_and_hide_bgs - ldr r0, =gIntro3Pokeball_Gfx - movs r1, 0xC0 - lsls r1, 19 - bl LZ77UnCompVram - ldr r0, =gIntro3Pokeball_Tilemap - ldr r1, =0x06004000 - bl LZ77UnCompVram - ldr r0, =gIntro3PokeballPal - movs r2, 0x80 - lsls r2, 2 - movs r1, 0 - bl LoadPalette - ldr r0, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - movs r5, 0 - strh r5, [r4, 0x8] - strh r5, [r4, 0xA] - strh r5, [r4, 0xC] - strh r5, [r4, 0xE] - movs r0, 0x78 - movs r1, 0x50 - movs r2, 0 - movs r3, 0 - bl sub_816F2A8 - bl ResetSpriteData - bl FreeAllSpritePalettes - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, =0x00004883 - movs r0, 0xC - bl SetGpuReg - ldr r1, =0x00001441 - movs r0, 0 - bl SetGpuReg - ldr r0, =task_intro_11 - str r0, [r4] - ldr r0, =gUnknown_030062A0 - str r5, [r0] - movs r0, 0xDD - lsls r0, 1 - bl m4aSongNumStart - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_10 - - thumb_func_start task_intro_11 -task_intro_11: @ 816DC64 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r3, r0, r2 - movs r1, 0x80 - lsls r1, 3 - adds r0, r1, 0 - ldrh r1, [r3, 0x8] - adds r0, r1 - strh r0, [r3, 0x8] - ldrh r4, [r3, 0xA] - movs r0, 0xA - ldrsh r1, [r3, r0] - ldr r0, =0x000006bf - cmp r1, r0 - bgt _0816DCA4 - ldrh r0, [r3, 0xC] - adds r1, r4, r0 - strh r1, [r3, 0xA] - adds r0, 0x2 - strh r0, [r3, 0xC] - b _0816DCA8 - .pool -_0816DCA4: - ldr r0, =task_intro_12 - str r0, [r3] -_0816DCA8: - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r2 - movs r0, 0xA - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 9 - bl __divsi3 - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - ldrh r3, [r4, 0x8] - movs r0, 0x78 - movs r1, 0x50 - bl sub_816F2A8 - ldr r0, =gUnknown_030062A0 - ldr r0, [r0] - cmp r0, 0x1C - bne _0816DCE6 - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0816DCE6: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_11 - - thumb_func_start task_intro_12 -task_intro_12: @ 816DCFC - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_030062A0 - ldr r0, [r0] - cmp r0, 0x2B - bls _0816DD18 - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldr r0, =task_intro_13 - str r0, [r1] -_0816DD18: - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_12 - - thumb_func_start task_intro_13 -task_intro_13: @ 816DD28 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816DD94 - bl intro_reset_and_hide_bgs - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r1, =gReservedSpritePaletteCount - movs r0, 0x8 - strb r0, [r1] - ldr r0, =gIntro3GroudonGfx - movs r1, 0xC0 - lsls r1, 19 - bl LZDecompressVram - ldr r0, =gIntro3GroudonTilemap - ldr r1, =0x0600c000 - bl LZDecompressVram - ldr r0, =gIntro3LegendBgGfx - ldr r1, =0x06004000 - bl LZDecompressVram - ldr r0, =gIntro3GroudonBgTilemap - ldr r1, =0x0600e000 - bl LZDecompressVram - ldr r0, =gBattleAnimPicTable + 0x1D0 - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gBattleAnimPaletteTable + 0x1D0 - bl LoadCompressedObjectPaletteUsingHeap - ldr r0, =gIntro3BgPal - ldr r1, =gPlttBufferUnfaded - movs r2, 0x80 - lsls r2, 1 - bl CpuSet - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_14 - str r1, [r0] -_0816DD94: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_13 - - thumb_func_start task_intro_14 -task_intro_14: @ 816DDD8 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0x40 - movs r1, 0xF0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0xA0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x3F - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - ldr r1, =0x0000b880 - movs r0, 0xC - bl SetGpuReg - ldr r1, =0x00001c05 - movs r0, 0xA - bl SetGpuReg - ldr r1, =0x00003641 - movs r0, 0 - bl SetGpuReg - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - movs r0, 0 - strh r0, [r4, 0x8] - ldr r0, =0x0000ffa0 - strh r0, [r4, 0xA] - ldr r1, =0x0000ff51 - strh r1, [r4, 0xC] - movs r2, 0x80 - lsls r2, 1 - strh r2, [r4, 0xE] - movs r3, 0 - bl sub_816F2A8 - ldr r0, =task_intro_15 - str r0, [r4] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_14 - - thumb_func_start task_intro_15 -task_intro_15: @ 816DE7C - 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 r2, [r4, 0x8] - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - beq _0816DEB8 - adds r0, r2, 0x4 - strh r0, [r4, 0x8] - movs r0, 0x8 - ldrsh r1, [r4, r0] - lsls r1, 8 - adds r0, r2, 0 - subs r0, 0x9C - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x44 - bl SetGpuReg - b _0816DEC6 - .pool -_0816DEB8: - movs r1, 0x82 - lsls r1, 6 - movs r0, 0x44 - bl SetGpuReg - ldr r0, =task_intro_16 - str r0, [r4] -_0816DEC6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_15 - - thumb_func_start task_intro_16 -task_intro_16: @ 816DED0 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =task_intro_17 - str r0, [r1] - bx lr - .pool - thumb_func_end task_intro_16 - - thumb_func_start task_intro_17 -task_intro_17: @ 816DEEC - push {lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0 - strh r2, [r1, 0x8] - ldr r0, =task_intro_18 - str r0, [r1] - movs r0, 0x1 - str r0, [sp] - movs r0, 0x4 - str r0, [sp, 0x4] - str r2, [sp, 0x8] - movs r0, 0 - movs r1, 0xA0 - movs r2, 0x4 - movs r3, 0x4 - bl ScanlineEffect_InitWave - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_17 - - thumb_func_start task_intro_18 -task_intro_18: @ 816DF2C - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x6 - bhi _0816DF62 - ldrh r0, [r4, 0xA] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0816DF62 - ldrh r0, [r4, 0x8] - movs r1, 0x3 - eors r0, r1 - strh r0, [r4, 0x8] -_0816DF62: - ldrh r0, [r4, 0x2] - ldrh r1, [r4, 0x8] - ldrh r2, [r4, 0x4] - adds r1, r2 - lsls r1, 16 - lsrs r1, 16 - ldrh r2, [r4, 0x6] - movs r3, 0 - bl sub_816F2A8 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0x9 - bls _0816DF80 - b _0816E176 -_0816DF80: - lsls r0, 2 - ldr r1, =_0816DF94 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0816DF94: - .4byte _0816DFBC - .4byte _0816DFE6 - .4byte _0816E024 - .4byte _0816E038 - .4byte _0816E07C - .4byte _0816E09A - .4byte _0816E0C8 - .4byte _0816E0DE - .4byte _0816E13C - .4byte _0816E156 -_0816DFBC: - ldrh r0, [r4, 0x2] - adds r0, 0x10 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA0 - beq _0816DFCC - b _0816E176 -_0816DFCC: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - movs r0, 0x2 - strh r0, [r4, 0xC] - movs r2, 0xF1 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r4, 0xE] - adds r0, r5, 0 - bl sub_816E190 - b _0816E176 -_0816DFE6: - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816DFF4 - b _0816E176 -_0816DFF4: - movs r0, 0x2 - strh r0, [r4, 0xC] - movs r1, 0xE - ldrsh r0, [r4, r1] - ldr r1, =gIntro3BgPal - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0x3E - movs r2, 0x1 - bl CpuSet - ldrh r0, [r4, 0xE] - adds r0, 0x2 - strh r0, [r4, 0xE] - lsls r0, 16 - movs r1, 0xF6 - lsls r1, 17 - cmp r0, r1 - beq _0816E01A - b _0816E176 -_0816E01A: - b _0816E14E - .pool -_0816E024: - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E032 - b _0816E176 -_0816E032: - movs r0, 0x2 - strh r0, [r4, 0xC] - b _0816E14E -_0816E038: - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E046 - b _0816E176 -_0816E046: - movs r0, 0x2 - strh r0, [r4, 0xC] - movs r2, 0xE - ldrsh r0, [r4, r2] - ldr r1, =gIntro3BgPal - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0x3E - movs r2, 0x1 - bl CpuSet - ldrh r0, [r4, 0xE] - subs r0, 0x2 - strh r0, [r4, 0xE] - lsls r0, 16 - movs r1, 0xF0 - lsls r1, 17 - cmp r0, r1 - beq _0816E06C - b _0816E176 -_0816E06C: - movs r0, 0x8 - strh r0, [r4, 0xC] - b _0816E14E - .pool -_0816E07C: - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - cmp r0, 0 - bne _0816E176 - movs r1, 0x60 - negs r1, r1 - adds r0, r1, 0 - strh r0, [r4, 0x2] - movs r0, 0xA9 - strh r0, [r4, 0x4] - movs r0, 0x3 - strh r0, [r4, 0xC] - b _0816E14E -_0816E09A: - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - bne _0816E176 - movs r0, 0x50 - strh r0, [r4, 0x2] - movs r0, 0x29 - strh r0, [r4, 0x4] - movs r0, 0x10 - strh r0, [r4, 0xC] - ldr r0, =0x00000195 - str r1, [sp] - movs r1, 0 - movs r2, 0x64 - movs r3, 0xA - bl PlayCryInternal - b _0816E14E - .pool -_0816E0C8: - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - cmp r0, 0 - bne _0816E176 - movs r0, 0x50 - strh r0, [r4, 0x2] - movs r0, 0x28 - strh r0, [r4, 0x4] - b _0816E14E -_0816E0DE: - ldrh r0, [r4, 0x2] - adds r0, 0x4 - strh r0, [r4, 0x2] - ldrh r0, [r4, 0x4] - adds r0, 0x4 - strh r0, [r4, 0x4] - ldr r2, =0x00000666 - adds r0, r2, 0 - ldrh r1, [r4, 0xC] - adds r0, r1 - strh r0, [r4, 0xC] - movs r2, 0xC - ldrsh r0, [r4, r2] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - lsrs r0, 8 - movs r1, 0x40 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r4, 0x6] - movs r2, 0x2 - ldrsh r0, [r4, r2] - cmp r0, 0x78 - bne _0816E176 - movs r0, 0x2 - negs r0, r0 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0x3 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - strh r5, [r4, 0x6] - movs r0, 0 - strh r0, [r4, 0x8] - b _0816E14E - .pool -_0816E13C: - ldrh r1, [r4, 0x6] - movs r2, 0x6 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _0816E14E - adds r0, r1, 0 - subs r0, 0x8 - strh r0, [r4, 0x6] - b _0816E176 -_0816E14E: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _0816E176 -_0816E156: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816E176 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_19 - str r1, [r0] - ldr r1, =gScanlineEffect - movs r0, 0x3 - strb r0, [r1, 0x15] -_0816E176: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_18 - - thumb_func_start sub_816E190 -sub_816E190: @ 816E190 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - movs r4, 0 - ldr r6, =gSprites - ldr r5, =gUnknown_085E4C64 -_0816E19C: - movs r0, 0 - ldrsh r1, [r5, r0] - lsls r3, r4, 24 - lsrs r3, 24 - ldr r0, =gUnknown_08596C10 - movs r2, 0xA0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r0, r6, 0 - adds r0, 0x1C - adds r0, r2, r0 - ldr r1, =sub_816E1F8 - str r1, [r0] - adds r2, r6 - ldrb r0, [r2, 0x5] - movs r3, 0xD - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - strb r0, [r2, 0x5] - strh r4, [r2, 0x30] - strh r7, [r2, 0x36] - ldrb r1, [r5, 0x2] - adds r0, r2, 0 - bl StartSpriteAnim - adds r5, 0x6 - adds r4, 0x1 - cmp r4, 0x5 - ble _0816E19C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816E190 - - thumb_func_start sub_816E1F8 -sub_816E1F8: @ 816E1F8 - push {lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x34] - adds r0, 0x1 - strh r0, [r3, 0x34] - ldrh r0, [r3, 0x34] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0816E214 - ldrh r0, [r3, 0x26] - movs r1, 0x3 - eors r0, r1 - strh r0, [r3, 0x26] -_0816E214: - movs r1, 0x2E - ldrsh r0, [r3, r1] - cmp r0, 0 - beq _0816E222 - cmp r0, 0x1 - beq _0816E278 - b _0816E29C -_0816E222: - ldr r2, =gUnknown_085E4C64 - movs r0, 0x30 - ldrsh r1, [r3, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 1 - adds r2, 0x4 - adds r0, r2 - ldrh r2, [r0] - ldrh r1, [r3, 0x32] - adds r2, r1 - strh r2, [r3, 0x32] - movs r0, 0x32 - ldrsh r1, [r3, r0] - movs r0, 0xFF - lsls r0, 8 - ands r1, r0 - asrs r1, 8 - ldrh r0, [r3, 0x22] - subs r0, r1 - strh r0, [r3, 0x22] - movs r0, 0xFF - ands r2, r0 - strh r2, [r3, 0x32] - ldr r2, =gTasks - movs r0, 0x36 - ldrsh r1, [r3, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0x8 - ldrsh r0, [r0, r1] - cmp r0, 0x7 - ble _0816E29C - ldrh r0, [r3, 0x2E] - adds r0, 0x1 - strh r0, [r3, 0x2E] - b _0816E29C - .pool -_0816E278: - ldrh r1, [r3, 0x20] - movs r2, 0x20 - ldrsh r0, [r3, r2] - cmp r0, 0x77 - bgt _0816E286 - subs r0, r1, 0x2 - b _0816E288 -_0816E286: - adds r0, r1, 0x2 -_0816E288: - strh r0, [r3, 0x20] - ldrh r1, [r3, 0x22] - movs r2, 0x22 - ldrsh r0, [r3, r2] - cmp r0, 0x4F - bgt _0816E298 - subs r0, r1, 0x2 - b _0816E29A -_0816E298: - adds r0, r1, 0x2 -_0816E29A: - strh r0, [r3, 0x22] -_0816E29C: - pop {r0} - bx r0 - thumb_func_end sub_816E1F8 - - thumb_func_start task_intro_19 -task_intro_19: @ 816E2A0 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl ResetSpriteData - ldr r0, =gIntro3KyogreGfx - movs r1, 0xC0 - lsls r1, 19 - bl LZDecompressVram - ldr r0, =gIntro3KyogreTilemap - ldr r1, =0x0600c000 - bl LZDecompressVram - ldr r0, =gIntro3KyogreBgTilemap - ldr r1, =0x0600e000 - bl LZDecompressVram - ldr r0, =gUnknown_085E4C88 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_085E4C98 - bl LoadSpritePalette - movs r0, 0x2 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =task_intro_20 - str r0, [r1] - movs r4, 0 - strh r4, [r1, 0x8] - movs r0, 0xA8 - lsls r0, 1 - strh r0, [r1, 0xA] - movs r2, 0x50 - strh r2, [r1, 0xC] - movs r2, 0x10 - strh r2, [r1, 0x14] - adds r2, 0xF0 - strh r2, [r1, 0xE] - movs r1, 0x50 - movs r3, 0 - bl sub_816F2A8 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x6 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0xA0 - movs r2, 0x4 - movs r3, 0x4 - bl ScanlineEffect_InitWave - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_19 - - thumb_func_start task_intro_20 -task_intro_20: @ 816E358 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldrh r0, [r5, 0x2] - ldrh r1, [r5, 0x4] - ldrh r2, [r5, 0x6] - movs r3, 0 - bl sub_816F2A8 - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0xD - bls _0816E380 - b _0816E6BC -_0816E380: - lsls r0, 2 - ldr r1, =_0816E394 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0816E394: - .4byte _0816E3CC - .4byte _0816E3E0 - .4byte _0816E43C - .4byte _0816E488 - .4byte _0816E4C4 - .4byte _0816E4EC - .4byte _0816E544 - .4byte _0816E560 - .4byte _0816E5A0 - .4byte _0816E5BC - .4byte _0816E5FC - .4byte _0816E61A - .4byte _0816E664 - .4byte _0816E69C -_0816E3CC: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E3DA - b _0816E6BC -_0816E3DA: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_0816E3E0: - ldrh r0, [r5, 0xC] - adds r0, 0x4 - strh r0, [r5, 0xC] - movs r2, 0xC - ldrsh r0, [r5, r2] - movs r1, 0x80 - lsls r1, 1 - bl Sin - ldr r1, =gTasks - lsls r4, r6, 2 - adds r4, r6 - lsls r4, 3 - adds r4, r1 - movs r2, 0xAC - lsls r2, 1 - adds r1, r2, 0 - subs r1, r0 - strh r1, [r4, 0xA] - movs r1, 0xC - ldrsh r0, [r5, r1] - movs r1, 0x40 - bl Cos - movs r1, 0x54 - subs r1, r0 - strh r1, [r4, 0xC] - movs r2, 0xC - ldrsh r0, [r5, r2] - cmp r0, 0x40 - beq _0816E420 - b _0816E6BC -_0816E420: - movs r0, 0x19 - strh r0, [r5, 0xC] - movs r0, 0x1 - strh r0, [r5, 0xE] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - movs r0, 0 - bl sub_816E6D4 - b _0816E6BC - .pool -_0816E43C: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E44A - b _0816E6BC -_0816E44A: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - ldrh r2, [r1, 0xA] - adds r0, r2 - strh r0, [r1, 0xA] - ldr r2, =0xfffffefe - adds r0, r2, 0 - ldrh r2, [r1, 0xC] - adds r0, r2 - strh r0, [r1, 0xC] - movs r0, 0x8 - strh r0, [r5, 0xC] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - movs r0, 0 - bl sub_816E6D4 - bl sub_816E74C - b _0816E6BC - .pool -_0816E488: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E496 - b _0816E6BC -_0816E496: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r2, =0xffffff00 - adds r0, r2, 0 - ldrh r2, [r1, 0xA] - adds r0, r2 - strh r0, [r1, 0xA] - movs r2, 0x81 - lsls r2, 1 - adds r0, r2, 0 - ldrh r2, [r1, 0xC] - adds r0, r2 - strh r0, [r1, 0xC] - movs r0, 0x8 - strh r0, [r5, 0xC] - b _0816E690 - .pool -_0816E4C4: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E4D2 - b _0816E6BC -_0816E4D2: - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0xC] - subs r1, 0xFC - strh r1, [r0, 0xC] - movs r0, 0x8 - strh r0, [r5, 0xC] - b _0816E690 - .pool -_0816E4EC: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E4FA - b _0816E6BC -_0816E4FA: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0xC] - adds r0, 0xFC - strh r0, [r1, 0xC] - ldrh r2, [r5, 0xE] - movs r0, 0xE - ldrsh r1, [r5, r0] - cmp r1, 0 - beq _0816E528 - movs r0, 0xC - strh r0, [r5, 0xC] - subs r0, r2, 0x1 - strh r0, [r5, 0xE] - movs r0, 0x2 - strh r0, [r5] - b _0816E6BC - .pool -_0816E528: - movs r0, 0x1 - strh r0, [r5, 0xC] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - movs r0, 0xCA - lsls r0, 1 - str r1, [sp] - movs r1, 0 - movs r2, 0x78 - movs r3, 0xA - bl PlayCryInternal - b _0816E6BC -_0816E544: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E552 - b _0816E6BC -_0816E552: - movs r0, 0x4 - strh r0, [r5, 0xC] - movs r1, 0xF5 - lsls r1, 1 - adds r0, r1, 0 - strh r0, [r5, 0xE] - b _0816E690 -_0816E560: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E56E - b _0816E6BC -_0816E56E: - movs r0, 0x4 - strh r0, [r5, 0xC] - movs r2, 0xE - ldrsh r0, [r5, r2] - ldr r1, =gIntro3BgPal - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0x5E - movs r2, 0x1 - bl CpuSet - ldrh r0, [r5, 0xE] - subs r0, 0x2 - strh r0, [r5, 0xE] - lsls r0, 16 - movs r1, 0xF0 - lsls r1, 17 - cmp r0, r1 - beq _0816E594 - b _0816E6BC -_0816E594: - b _0816E690 - .pool -_0816E5A0: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - beq _0816E5AE - b _0816E6BC -_0816E5AE: - movs r0, 0x4 - strh r0, [r5, 0xC] - movs r1, 0xF1 - lsls r1, 1 - adds r0, r1, 0 - strh r0, [r5, 0xE] - b _0816E690 -_0816E5BC: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - bne _0816E6BC - movs r0, 0x4 - strh r0, [r5, 0xC] - movs r2, 0xE - ldrsh r0, [r5, r2] - ldr r1, =gIntro3BgPal - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0x5E - movs r2, 0x1 - bl CpuSet - ldrh r0, [r5, 0xE] - adds r0, 0x2 - strh r0, [r5, 0xE] - lsls r0, 16 - movs r1, 0xF7 - lsls r1, 17 - cmp r0, r1 - bne _0816E6BC - movs r0, 0x10 - strh r0, [r5, 0xC] - b _0816E690 - .pool -_0816E5FC: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _0816E6BC - strh r0, [r5, 0xC] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - adds r0, r6, 0 - bl sub_816E6D4 - b _0816E6BC -_0816E61A: - ldrh r0, [r5, 0xC] - adds r0, 0x4 - strh r0, [r5, 0xC] - ldrh r0, [r5, 0x6] - subs r0, 0x8 - strh r0, [r5, 0x6] - movs r1, 0xC - ldrsh r0, [r5, r1] - movs r1, 0x3C - bl Sin - ldr r2, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r2 - adds r0, 0x58 - strh r0, [r1, 0xA] - movs r2, 0xC - ldrsh r0, [r5, r2] - cmp r0, 0x40 - bne _0816E6BC - movs r0, 0x2 - negs r0, r0 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0x3 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0816E690 - .pool -_0816E664: - ldrh r0, [r5, 0xC] - adds r0, 0x4 - strh r0, [r5, 0xC] - ldrh r0, [r5, 0x6] - subs r0, 0x8 - strh r0, [r5, 0x6] - movs r1, 0xC - ldrsh r0, [r5, r1] - movs r1, 0x14 - bl Sin - ldr r2, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r2 - adds r0, 0x80 - strh r0, [r1, 0xA] - movs r2, 0xC - ldrsh r0, [r5, r2] - cmp r0, 0x80 - bne _0816E6BC -_0816E690: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - b _0816E6BC - .pool -_0816E69C: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816E6BC - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_21 - str r1, [r0] - ldr r1, =gScanlineEffect - movs r0, 0x3 - strb r0, [r1, 0x15] -_0816E6BC: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_20 - - thumb_func_start sub_816E6D4 -sub_816E6D4: @ 816E6D4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r5, 0 - ldr r7, =gUnknown_085E4CA8 - ldr r0, =gSprites - mov r9, r0 - adds r4, r7, 0 - movs r6, 0 -_0816E6EE: - movs r3, 0 - ldrsh r1, [r4, r3] - adds r0, r7, 0x2 - adds r0, r6, r0 - movs r3, 0 - ldrsh r2, [r0, r3] - lsls r3, r5, 24 - lsrs r3, 24 - ldr r0, =gUnknown_085E4D14 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r9 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - mov r0, r8 - strh r0, [r2, 0x38] - ldrh r0, [r4, 0x4] - strh r0, [r2, 0x3A] - movs r0, 0x40 - strh r0, [r2, 0x3C] - adds r4, 0x6 - adds r6, 0x6 - adds r5, 0x1 - cmp r5, 0x5 - ble _0816E6EE - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816E6D4 - - thumb_func_start sub_816E74C -sub_816E74C: @ 816E74C - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r5, 0 - ldr r7, =gUnknown_085E4CA8 - adds r4, r7, 0x4 - movs r6, 0x24 - ldr r0, =gSprites - mov r8, r0 -_0816E75E: - movs r3, 0x20 - ldrsh r1, [r4, r3] - adds r0, r7, 0x2 - adds r0, r6, r0 - movs r3, 0 - ldrsh r2, [r0, r3] - lsls r3, r5, 24 - lsrs r3, 24 - ldr r0, =gUnknown_085E4D14 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r8 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - ldrh r0, [r4] - strh r0, [r2, 0x3A] - movs r0, 0x40 - strh r0, [r2, 0x3C] - adds r4, 0x6 - adds r6, 0x6 - adds r5, 0x1 - cmp r5, 0x5 - ble _0816E75E - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816E74C - - thumb_func_start sub_816E7B4 -sub_816E7B4: @ 816E7B4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0816E7C6 - cmp r0, 0x1 - beq _0816E84C - b _0816E882 -_0816E7C6: - ldrh r1, [r4, 0x3A] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _0816E80A - ldrh r0, [r4, 0x30] - adds r0, 0xB - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x30 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 24 - negs r0, r0 - strh r0, [r4, 0x26] - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0816E82A - adds r0, r4, 0 - bl DestroySprite - b _0816E82A -_0816E80A: - subs r0, r1, 0x1 - strh r0, [r4, 0x3A] - lsls r0, 16 - cmp r0, 0 - bne _0816E82A - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAnim - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_0816E82A: - ldr r2, =gTasks - movs r0, 0x38 - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0x8 - ldrsh r0, [r0, r1] - cmp r0, 0xB - ble _0816E882 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _0816E882 - .pool -_0816E84C: - ldrh r1, [r4, 0x20] - movs r2, 0x20 - ldrsh r0, [r4, r2] - cmp r0, 0x77 - bgt _0816E85A - subs r0, r1, 0x3 - b _0816E85C -_0816E85A: - adds r0, r1, 0x3 -_0816E85C: - strh r0, [r4, 0x20] - ldrh r1, [r4, 0x22] - movs r2, 0x22 - ldrsh r0, [r4, r2] - cmp r0, 0x4F - bgt _0816E86C - subs r0, r1, 0x3 - b _0816E86E -_0816E86C: - adds r0, r1, 0x3 -_0816E86E: - strh r0, [r4, 0x22] - ldrh r0, [r4, 0x22] - subs r0, 0x14 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x8C - bls _0816E882 - adds r0, r4, 0 - bl DestroySprite -_0816E882: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816E7B4 - - thumb_func_start task_intro_21 -task_intro_21: @ 816E888 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0x50 - movs r1, 0x87 - bl SetGpuReg - ldr r1, =0x00001f1f - movs r0, 0x52 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0x1F - bl SetGpuReg - movs r1, 0xB0 - lsls r1, 7 - movs r0, 0x8 - bl SetGpuReg - ldr r1, =0x00005a04 - movs r0, 0xA - bl SetGpuReg - ldr r1, =0x00001c06 - movs r0, 0xC - bl SetGpuReg - movs r1, 0xDD - lsls r1, 6 - movs r0, 0 - bl SetGpuReg - movs r0, 0x10 - movs r1, 0x50 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - ldr r1, =0x0000ffb0 - movs r0, 0x14 - bl SetGpuReg - movs r0, 0x16 - movs r1, 0 - bl SetGpuReg - movs r0, 0x18 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - ldr r4, =gIntro3CloudsGfx - movs r1, 0xC0 - lsls r1, 19 - adds r0, r4, 0 - bl LZDecompressVram - ldr r1, =0x06004000 - adds r0, r4, 0 - bl LZDecompressVram - ldr r0, =gIntro3Clouds3Tilemap - ldr r1, =0x0600e000 - bl LZDecompressVram - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_22 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_21 - - thumb_func_start task_intro_22 -task_intro_22: @ 816E954 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gIntro3Clouds1Tilemap - ldr r1, =0x0600c000 - bl LZDecompressVram - ldr r0, =gIntro3Clouds2Tilemap - ldr r1, =0x0600d000 - bl LZDecompressVram - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_23 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_22 - - thumb_func_start task_intro_23 -task_intro_23: @ 816E998 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - 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 r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_24 - str r1, [r0] - movs r1, 0 - strh r1, [r0, 0x8] - movs r1, 0x10 - strh r1, [r0, 0x14] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_23 - - thumb_func_start task_intro_24 -task_intro_24: @ 816E9DC - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r5, r1, 3 - ldr r6, =gTasks + 0x8 - adds r4, r5, r6 - ldrh r1, [r4, 0xC] - lsls r1, 16 - asrs r1, 24 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x10 - bl SetGpuReg - ldrh r1, [r4, 0xC] - lsls r1, 16 - asrs r1, 24 - negs r1, r1 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x14 - bl SetGpuReg - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0816EA24 - cmp r0, 0x1 - beq _0816EA58 - b _0816EAA6 - .pool -_0816EA24: - ldrh r0, [r4, 0xC] - subs r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - cmp r0, 0 - bne _0816EAA6 - movs r0, 0x2 - negs r0, r0 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r2, 0xA0 - lsls r2, 7 - adds r0, r2, 0 - strh r0, [r4, 0xC] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _0816EAA6 - .pool -_0816EA58: - movs r0, 0xC - ldrsh r1, [r4, r0] - movs r0, 0xA0 - lsls r0, 6 - cmp r1, r0 - bne _0816EA74 - ldr r0, =0x0000fffe - ldr r1, =0x00002949 - str r1, [sp] - movs r1, 0x3 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0816EA74: - ldrh r1, [r4, 0xC] - movs r2, 0xC - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _0816EA90 - adds r0, r1, 0 - subs r0, 0x80 - strh r0, [r4, 0xC] - b _0816EAA6 - .pool -_0816EA90: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816EAA6 - adds r0, r6, 0 - subs r0, 0x8 - adds r0, r5, r0 - ldr r1, =task_intro_25 - str r1, [r0] -_0816EAA6: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_24 - - thumb_func_start task_intro_25 -task_intro_25: @ 816EAB8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gIntro3RayquazaTilemap - ldr r1, =0x0600e000 - bl LZDecompressVram - ldr r0, =gIntro3Clouds4Tilemap - ldr r1, =0x0600c000 - bl LZDecompressVram - ldr r0, =gIntro3RayquazaGfx - ldr r1, =0x06004000 - bl LZDecompressVram - ldr r0, =gIntro3Clouds2Gfx - movs r1, 0xC0 - lsls r1, 19 - bl LZDecompressVram - movs r1, 0xD5 - lsls r1, 6 - movs r0, 0 - bl SetGpuReg - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_26 - str r1, [r0] - movs r2, 0 - strh r2, [r0, 0x8] - movs r1, 0x1 - strh r1, [r0, 0x14] - strh r2, [r0, 0x16] - ldr r0, =gUnknown_085E4BF4 - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gUnknown_085E4C04 - bl LoadSpritePalettes - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_25 - - thumb_func_start task_intro_26 -task_intro_26: @ 816EB44 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r2, =gTasks + 0x8 - adds r6, r1, r2 - movs r3, 0 - ldrsh r0, [r6, r3] - cmp r0, 0x1 - beq _0816EBE0 - cmp r0, 0x1 - bgt _0816EB6C - cmp r0, 0 - beq _0816EB72 - b _0816EC62 - .pool -_0816EB6C: - cmp r0, 0x2 - beq _0816EC4C - b _0816EC62 -_0816EB72: - ldrh r0, [r6, 0xC] - subs r0, 0x1 - strh r0, [r6, 0xC] - lsls r0, 16 - cmp r0, 0 - bne _0816EC62 - ldr r4, =gUnknown_085E4C4C - adds r0, r4, 0 - movs r1, 0xC8 - movs r2, 0x30 - movs r3, 0 - bl CreateSprite - adds r0, r4, 0 - movs r1, 0xC8 - movs r2, 0x50 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0 - movs r1, 0xC8 - movs r2, 0x70 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x2 - bl StartSpriteAnim - ldrh r0, [r6] - adds r0, 0x1 - strh r0, [r6] - movs r0, 0x48 - strh r0, [r6, 0xC] - b _0816EC62 - .pool -_0816EBE0: - ldrh r0, [r6, 0xC] - subs r0, 0x1 - strh r0, [r6, 0xC] - lsls r0, 16 - cmp r0, 0 - bne _0816EC62 - ldr r4, =gUnknown_085E4C4C - adds r0, r4, 0 - movs r1, 0x28 - movs r2, 0x30 - movs r3, 0 - bl CreateSprite - adds r0, r4, 0 - movs r1, 0x28 - movs r2, 0x50 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0 - movs r1, 0x28 - movs r2, 0x70 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x2 - bl StartSpriteAnim - ldrh r0, [r6] - adds r0, 0x1 - strh r0, [r6] - movs r0, 0x30 - strh r0, [r6, 0xC] - b _0816EC62 - .pool -_0816EC4C: - ldrh r0, [r6, 0xC] - subs r0, 0x1 - strh r0, [r6, 0xC] - lsls r0, 16 - cmp r0, 0 - bne _0816EC62 - adds r0, r2, 0 - subs r0, 0x8 - adds r0, r1, r0 - ldr r1, =task_intro_27 - str r1, [r0] -_0816EC62: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_26 - - thumb_func_start sub_816EC6C -sub_816EC6C: @ 816EC6C - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _0816EC88 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_0816EC88: - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0816ECAC - cmp r0, 0x1 - bgt _0816EC9A - cmp r0, 0 - beq _0816ECA0 - b _0816ED12 -_0816EC9A: - cmp r0, 0x2 - beq _0816ECDC - b _0816ED12 -_0816ECA0: - movs r0, 0xE1 - lsls r0, 1 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_0816ECAC: - movs r1, 0x30 - ldrsh r0, [r4, r1] - ldr r1, =gIntro3BgPal - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0xBA - movs r2, 0x1 - bl CpuSet - ldrh r0, [r4, 0x30] - adds r0, 0x2 - strh r0, [r4, 0x30] - lsls r0, 16 - movs r1, 0xE7 - lsls r1, 17 - cmp r0, r1 - bne _0816ED12 - movs r0, 0xE6 - lsls r0, 1 - strh r0, [r4, 0x30] - movs r0, 0x4 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_0816ECDC: - ldrh r0, [r4, 0x32] - subs r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - cmp r0, 0 - bne _0816ED12 - movs r0, 0x4 - strh r0, [r4, 0x32] - movs r1, 0x30 - ldrsh r0, [r4, r1] - ldr r1, =gIntro3BgPal - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0xBA - movs r2, 0x1 - bl CpuSet - ldrh r0, [r4, 0x30] - subs r0, 0x2 - strh r0, [r4, 0x30] - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 17 - cmp r0, r1 - bne _0816ED12 - adds r0, r4, 0 - bl DestroySprite -_0816ED12: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816EC6C - - thumb_func_start task_intro_27 -task_intro_27: @ 816ED20 - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_085E5048 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_085E5058 - bl LoadSpritePalettes - movs r1, 0xD5 - lsls r1, 6 - movs r0, 0 - bl SetGpuReg - ldr r6, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r6 - ldr r0, =task_intro_28 - str r0, [r4] - ldr r0, =0x0000ffde - ldr r1, =0x00002949 - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0 - strh r0, [r4, 0x8] - movs r0, 0xA8 - strh r0, [r4, 0xA] - ldr r1, =0x0000fff0 - strh r1, [r4, 0xC] - ldr r0, =0x0000ff78 - strh r0, [r4, 0xE] - strh r1, [r4, 0x10] - ldr r0, =sub_816EEA8 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r6 - strh r5, [r1, 0x10] - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_27 - - thumb_func_start task_intro_28 -task_intro_28: @ 816EDB4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r4, r1, 3 - ldr r5, =gTasks + 0x8 - adds r2, r4, r5 - ldrh r0, [r2, 0xE] - movs r3, 0x1 - ands r0, r3 - cmp r0, 0 - bne _0816EDD6 - ldrh r0, [r2, 0xC] - movs r1, 0x2 - eors r0, r1 - strh r0, [r2, 0xC] -_0816EDD6: - ldrh r0, [r2, 0xE] - adds r0, 0x1 - strh r0, [r2, 0xE] - movs r6, 0 - ldrsh r1, [r2, r6] - cmp r1, 0x1 - beq _0816EE2E - cmp r1, 0x1 - bgt _0816EDF4 - cmp r1, 0 - beq _0816EDFE - b _0816EE86 - .pool -_0816EDF4: - cmp r1, 0x2 - beq _0816EE3A - cmp r1, 0x3 - beq _0816EE70 - b _0816EE86 -_0816EDFE: - ands r0, r3 - cmp r0, 0 - beq _0816EE1C - ldrh r0, [r2, 0x2] - subs r0, 0x2 - strh r0, [r2, 0x2] - ldrh r0, [r2, 0x4] - adds r0, 0x1 - strh r0, [r2, 0x4] - ldrh r0, [r2, 0x6] - adds r0, 0x2 - strh r0, [r2, 0x6] - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] -_0816EE1C: - movs r1, 0x2 - ldrsh r0, [r2, r1] - cmp r0, 0x68 - bne _0816EE86 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - strh r3, [r2, 0xA] - b _0816EE86 -_0816EE2E: - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - movs r0, 0x4 - strh r0, [r2, 0xA] - b _0816EE86 -_0816EE3A: - ldrh r0, [r2, 0x2] - adds r0, 0x4 - strh r0, [r2, 0x2] - ldrh r0, [r2, 0x4] - subs r0, 0x2 - strh r0, [r2, 0x4] - ldrh r0, [r2, 0x6] - subs r0, 0x4 - strh r0, [r2, 0x6] - ldrh r0, [r2, 0x8] - subs r0, 0x2 - strh r0, [r2, 0x8] - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816EE86 - movs r0, 0x8C - strh r0, [r2, 0xA] - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _0816EE86 - .pool -_0816EE70: - ldrh r0, [r2, 0xA] - subs r0, 0x1 - strh r0, [r2, 0xA] - lsls r0, 16 - cmp r0, 0 - bne _0816EE86 - adds r0, r5, 0 - subs r0, 0x8 - adds r0, r4, r0 - ldr r1, =task_intro_29 - str r1, [r0] -_0816EE86: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_28 - - thumb_func_start task_intro_29 -task_intro_29: @ 816EE90 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - ldr r0, =sub_816CC54 - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end task_intro_29 - - thumb_func_start sub_816EEA8 -sub_816EEA8: @ 816EEA8 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldrh r0, [r5, 0x4] - adds r0, 0x1 - strh r0, [r5, 0x4] - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0x5 - bls _0816EECA - b _0816F0B2 -_0816EECA: - lsls r0, 2 - ldr r1, =_0816EEDC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0816EEDC: - .4byte _0816EEF4 - .4byte _0816EF34 - .4byte _0816EF80 - .4byte _0816F00A - .4byte _0816F074 - .4byte _0816F0A0 -_0816EEF4: - ldrh r1, [r5, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816EF16 - movs r2, 0x2 - ldrsh r0, [r5, r2] - lsls r0, 1 - ldr r1, =gIntro3BgPal + 0x1A2 - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0xBC - movs r2, 0x1 - bl CpuSet - ldrh r0, [r5, 0x2] - adds r0, 0x1 - strh r0, [r5, 0x2] -_0816EF16: - movs r1, 0x2 - ldrsh r0, [r5, r1] - cmp r0, 0x6 - beq _0816EF20 - b _0816F0B2 -_0816EF20: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - movs r0, 0 - strh r0, [r5, 0x2] - b _0816EF70 - .pool -_0816EF34: - ldrh r1, [r5, 0x6] - movs r2, 0x6 - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _0816F004 - ldrh r1, [r5, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816EF60 - movs r1, 0x2 - ldrsh r0, [r5, r1] - lsls r0, 1 - ldr r1, =gIntro3BgPal + 0x1A2 - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0xB0 - movs r2, 0x1 - bl CpuSet - ldrh r0, [r5, 0x2] - adds r0, 0x1 - strh r0, [r5, 0x2] -_0816EF60: - movs r2, 0x2 - ldrsh r0, [r5, r2] - cmp r0, 0x6 - beq _0816EF6A - b _0816F0B2 -_0816EF6A: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_0816EF70: - movs r0, 0xA - strh r0, [r5, 0x6] - b _0816F0B2 - .pool -_0816EF80: - ldrh r1, [r5, 0x6] - movs r2, 0x6 - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _0816F004 - ldrh r1, [r5, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816EFAC - movs r1, 0x2 - ldrsh r0, [r5, r1] - lsls r0, 1 - ldr r1, =gIntro3BgPal + 0x182 - adds r0, r1 - ldr r1, =gPlttBufferFaded + 0xB8 - movs r2, 0x1 - bl CpuSet - ldrh r0, [r5, 0x2] - adds r0, 0x1 - strh r0, [r5, 0x2] -_0816EFAC: - movs r2, 0x2 - ldrsh r0, [r5, r2] - cmp r0, 0x6 - beq _0816EFB6 - b _0816F0B2 -_0816EFB6: - ldr r0, =gUnknown_085E5030 - movs r1, 0x78 - movs r2, 0x58 - movs r3, 0xF - bl CreateSprite - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x67 - bl PlaySE - ldr r1, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r1 - adds r3, r0, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r3] - ldrh r1, [r5, 0x8] - strh r1, [r0, 0x34] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - movs r0, 0x10 - strh r0, [r5, 0x6] - b _0816F0B2 - .pool -_0816F004: - subs r0, r1, 0x1 - strh r0, [r5, 0x6] - b _0816F0B2 -_0816F00A: - ldrh r1, [r5, 0x4] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816F0B2 - ldrh r0, [r5, 0x6] - subs r0, 0x1 - adds r2, r0, 0 - strh r0, [r5, 0x6] - lsls r0, 16 - cmp r0, 0 - beq _0816F068 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x00002949 - movs r0, 0x50 - movs r1, 0x10 - bl BlendPalette - ldr r4, =gIntro3BgPal + 0x1AC - ldr r5, =gPlttBufferFaded + 0xBC - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0x1 - bl CpuSet - adds r1, r5, 0 - subs r1, 0xC - adds r0, r4, 0 - movs r2, 0x1 - bl CpuSet - subs r4, 0x20 - subs r5, 0x4 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0x1 - bl CpuSet - b _0816F0B2 - .pool -_0816F068: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - movs r0, 0x35 - strh r0, [r5, 0x6] - b _0816F0B2 -_0816F074: - ldrh r0, [r5, 0x6] - subs r0, 0x1 - strh r0, [r5, 0x6] - lsls r0, 16 - cmp r0, 0 - bne _0816F0B2 - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - b _0816F0B2 - .pool -_0816F0A0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816F0B2 - adds r0, r2, 0 - bl DestroyTask -_0816F0B2: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816EEA8 - - thumb_func_start intro_reset_and_hide_bgs -@ void intro_reset_and_hide_bgs() -intro_reset_and_hide_bgs: @ 816F0C0 - push {lr} - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1C - movs r1, 0 - bl SetGpuReg - movs r0, 0x1E - movs r1, 0 - bl SetGpuReg - movs r0, 0x18 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - movs r0, 0x14 - movs r1, 0 - bl SetGpuReg - movs r0, 0x16 - movs r1, 0 - bl SetGpuReg - movs r0, 0x10 - movs r1, 0 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0 - 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 - pop {r0} - bx r0 - thumb_func_end intro_reset_and_hide_bgs - - thumb_func_start task_intro_3_1 -task_intro_3_1: @ 816F128 - 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 r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0816F170 - cmp r0, 0x1 - ble _0816F148 - cmp r0, 0x2 - beq _0816F1BC -_0816F148: - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldr r0, =gUnknown_0853FF70 - ldrh r1, [r0, 0x3E] - movs r0, 0x52 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - b _0816F1AC - .pool -_0816F170: - ldrh r1, [r4, 0xA] - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _0816F1A0 - subs r0, r1, 0x1 - strh r0, [r4, 0xA] - movs r1, 0xA - ldrsh r0, [r4, r1] - lsrs r1, r0, 31 - adds r0, r1 - movs r1, 0xFF - lsls r1, 1 - ldr r2, =gUnknown_0853FF70 - ands r0, r1 - adds r0, r2 - ldrh r1, [r0] - movs r0, 0x52 - bl SetGpuReg - b _0816F1DA - .pool -_0816F1A0: - ldr r0, =gUnknown_0853FF70 - ldrh r1, [r0] - movs r0, 0x52 - bl SetGpuReg - movs r0, 0x10 -_0816F1AC: - strh r0, [r4, 0xA] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0816F1DA - .pool -_0816F1BC: - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyTask -_0816F1DA: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end task_intro_3_1 - - thumb_func_start task_intro_3_2 -task_intro_3_2: @ 816F1E0 - 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 r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0816F228 - cmp r0, 0x1 - ble _0816F200 - cmp r0, 0x2 - beq _0816F274 -_0816F200: - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldr r0, =gUnknown_0853FF70 - ldrh r1, [r0] - movs r0, 0x52 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - b _0816F264 - .pool -_0816F228: - ldrh r1, [r4, 0xA] - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0x3D - bgt _0816F258 - adds r0, r1, 0x1 - strh r0, [r4, 0xA] - movs r1, 0xA - ldrsh r0, [r4, r1] - lsrs r1, r0, 31 - adds r0, r1 - movs r1, 0xFF - lsls r1, 1 - ldr r2, =gUnknown_0853FF70 - ands r0, r1 - adds r0, r2 - ldrh r1, [r0] - movs r0, 0x52 - bl SetGpuReg - b _0816F2A2 - .pool -_0816F258: - ldr r0, =gUnknown_0853FF70 - ldrh r1, [r0, 0x3E] - movs r0, 0x52 - bl SetGpuReg - movs r0, 0x10 -_0816F264: - strh r0, [r4, 0xA] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0816F2A2 - .pool -_0816F274: - ldrh r1, [r4, 0xA] - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _0816F284 - subs r0, r1, 0x1 - strh r0, [r4, 0xA] - b _0816F2A2 -_0816F284: - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - adds r0, r5, 0 - bl DestroyTask -_0816F2A2: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end task_intro_3_2 - - thumb_func_start sub_816F2A8 -sub_816F2A8: @ 816F2A8 - push {r4,lr} - sub sp, 0x24 - lsls r2, 16 - lsrs r2, 16 - movs r4, 0x80 - lsls r4, 8 - str r4, [sp] - str r4, [sp, 0x4] - mov r4, sp - strh r0, [r4, 0x8] - mov r0, sp - strh r1, [r0, 0xA] - strh r2, [r0, 0xC] - strh r2, [r0, 0xE] - strh r3, [r0, 0x10] - add r4, sp, 0x14 - adds r1, r4, 0 - movs r2, 0x1 - bl BgAffineSet - ldrh r1, [r4] - movs r0, 0x20 - bl SetGpuReg - ldrh r1, [r4, 0x2] - movs r0, 0x22 - bl SetGpuReg - ldrh r1, [r4, 0x4] - movs r0, 0x24 - bl SetGpuReg - ldrh r1, [r4, 0x6] - movs r0, 0x26 - bl SetGpuReg - ldrh r1, [r4, 0x8] - movs r0, 0x28 - bl SetGpuReg - ldrh r1, [r4, 0xA] - movs r0, 0x2A - bl SetGpuReg - ldrh r1, [r4, 0xC] - movs r0, 0x2C - bl SetGpuReg - ldrh r1, [r4, 0xE] - movs r0, 0x2E - bl SetGpuReg - add sp, 0x24 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816F2A8 - - thumb_func_start sub_816F318 -sub_816F318: @ 816F318 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0xBF - ble _0816F394 - ldrh r1, [r4, 0x34] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _0816F336 - subs r0, r1, 0x1 - strh r0, [r4, 0x34] - b _0816F39A -_0816F336: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x30] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x32] - str r1, [sp] - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - movs r0, 0x32 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 5 - subs r0, r1 - movs r1, 0x64 - bl __divsi3 - strh r0, [r4, 0x32] - movs r2, 0x32 - ldrsh r1, [r4, r2] - adds r0, r1, 0 - subs r0, 0xC0 - cmp r0, 0 - bge _0816F378 - adds r0, 0x7F -_0816F378: - asrs r0, 7 - adds r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xF - bls _0816F386 - movs r0, 0xF -_0816F386: - lsls r2, r0, 4 - ldrb r1, [r4, 0x5] - movs r0, 0xF - ands r0, r1 - orrs r0, r2 - strb r0, [r4, 0x5] - b _0816F39A -_0816F394: - adds r0, r4, 0 - bl DestroySprite -_0816F39A: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816F318 - - thumb_func_start sub_816F3A4 -sub_816F3A4: @ 816F3A4 - push {r4,lr} - adds r4, r0, 0 - ldr r2, =gSprites - movs r1, 0x3C - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r3, 0x3C - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _0816F420 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r0, r3 - strh r0, [r4, 0x22] - adds r0, r4, 0 - movs r1, 0x3 - bl StartSpriteAnim - movs r0, 0x80 - lsls r0, 3 - strh r0, [r4, 0x32] - ldrh r1, [r4, 0x30] - movs r0, 0x3 - ands r0, r1 - lsls r0, 3 - strh r0, [r4, 0x34] - ldr r0, =sub_816F318 - str r0, [r4, 0x1C] - ldrb r1, [r4, 0x1] - movs r0, 0x3F - ands r0, r1 - movs r1, 0x40 - orrs r0, r1 - strb r0, [r4, 0x1] - ldrb r0, [r4, 0x3] - movs r1, 0xC0 - orrs r0, r1 - strb r0, [r4, 0x3] - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x2 - bl CalcCenterToCornerVec - b _0816F44C - .pool -_0816F420: - ldrh r0, [r1, 0x24] - strh r0, [r4, 0x24] - movs r0, 0x3C - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x26] - strh r0, [r4, 0x26] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x20] - strh r0, [r4, 0x20] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x22] - strh r0, [r4, 0x22] -_0816F44C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816F3A4 - - thumb_func_start sub_816F454 -sub_816F454: @ 816F454 - push {lr} - adds r1, r0, 0 - movs r2, 0x2E - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _0816F464 - ldr r0, =sub_816F46C - str r0, [r1, 0x1C] -_0816F464: - pop {r0} - bx r0 - .pool - thumb_func_end sub_816F454 - - thumb_func_start sub_816F46C -sub_816F46C: @ 816F46C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r7, r0, 0 - ldrh r4, [r7, 0x20] - movs r1, 0x20 - ldrsh r0, [r7, r1] - cmp r0, 0x74 - bgt _0816F4AC - ldrh r0, [r7, 0x26] - ldrh r1, [r7, 0x22] - adds r0, r1 - movs r1, 0 - strh r0, [r7, 0x22] - strh r1, [r7, 0x26] - adds r0, r4, 0x4 - strh r0, [r7, 0x20] - ldr r0, =0x0000fffc - strh r0, [r7, 0x24] - movs r0, 0x80 - strh r0, [r7, 0x36] - ldr r0, =sub_816F5B4 - str r0, [r7, 0x1C] - b _0816F59E - .pool -_0816F4AC: - ldrh r1, [r7, 0x36] - ldr r5, =gSineTable - lsls r0, r1, 24 - lsrs r0, 23 - adds r0, r5 - ldrh r2, [r0] - adds r0, r1, 0 - adds r0, 0x40 - lsls r0, 24 - lsrs r0, 23 - adds r0, r5 - ldrh r3, [r0] - adds r1, 0x2 - strh r1, [r7, 0x36] - lsls r2, 16 - asrs r0, r2, 16 - cmp r0, 0 - bge _0816F4D2 - adds r0, 0x1F -_0816F4D2: - asrs r0, 5 - strh r0, [r7, 0x26] - subs r0, r4, 0x1 - strh r0, [r7, 0x20] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816F4E8 - ldrh r0, [r7, 0x22] - adds r0, 0x1 - strh r0, [r7, 0x22] -_0816F4E8: - lsls r0, r3, 16 - asrs r0, 16 - negs r0, r0 - cmp r0, 0 - bge _0816F4F4 - adds r0, 0xF -_0816F4F4: - lsls r1, r0, 12 - lsrs r1, 16 - ldrh r4, [r7, 0x32] - ldrh r3, [r7, 0x34] - adds r0, r1, 0 - subs r0, 0x10 - lsls r0, 24 - lsrs r0, 23 - adds r0, r5 - ldrh r2, [r0] - adds r1, 0x30 - lsls r1, 24 - lsrs r1, 23 - adds r1, r5 - movs r0, 0 - ldrsh r1, [r1, r0] - adds r0, r1, 0 - muls r0, r4 - cmp r0, 0 - bge _0816F51E - adds r0, 0xFF -_0816F51E: - lsls r0, 8 - lsrs r0, 16 - mov r8, r0 - lsls r0, r2, 16 - asrs r2, r0, 16 - negs r0, r2 - muls r0, r3 - cmp r0, 0 - bge _0816F532 - adds r0, 0xFF -_0816F532: - lsls r0, 8 - lsrs r0, 16 - mov r10, r0 - adds r0, r2, 0 - muls r0, r4 - cmp r0, 0 - bge _0816F542 - adds r0, 0xFF -_0816F542: - lsls r0, 8 - lsrs r5, r0, 16 - adds r0, r1, 0 - muls r0, r3 - cmp r0, 0 - bge _0816F550 - adds r0, 0xFF -_0816F550: - lsls r6, r0, 8 - lsrs r6, 16 - ldrh r0, [r7, 0x30] - lsls r0, 24 - lsrs r0, 24 - str r3, [sp] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - ldrh r0, [r7, 0x30] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r5 - mov r1, r10 - lsls r5, r1, 16 - lsrs r3, r5, 16 - lsls r4, r6, 16 - str r6, [sp] - mov r1, r8 - mov r2, r9 - bl SetOamMatrix - ldrh r0, [r7, 0x30] - adds r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - lsls r5, 1 - lsrs r5, 16 - lsls r4, 1 - lsrs r4, 16 - str r4, [sp] - mov r1, r8 - mov r2, r9 - adds r3, r5, 0 - bl SetOamMatrix -_0816F59E: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816F46C - - thumb_func_start sub_816F5B4 -sub_816F5B4: @ 816F5B4 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldrh r0, [r4, 0x30] - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x3A] - adds r1, 0x40 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - ldrh r0, [r4, 0x30] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x3A] - adds r1, 0x40 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - ldrh r0, [r4, 0x30] - adds r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x3A] - adds r1, 0x40 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - ldrh r1, [r4, 0x36] - movs r2, 0x36 - ldrsh r0, [r4, r2] - cmp r0, 0x40 - beq _0816F64C - adds r0, r1, 0 - subs r0, 0x8 - strh r0, [r4, 0x36] - ldrh r0, [r4, 0x36] - adds r1, r0, 0 - ldr r2, =gSineTable - adds r0, 0x40 - lsls r0, 24 - lsrs r0, 23 - adds r0, r2 - movs r3, 0 - ldrsh r0, [r0, r3] - cmp r0, 0 - bge _0816F62E - adds r0, 0x3F -_0816F62E: - asrs r0, 6 - strh r0, [r4, 0x24] - lsls r0, r1, 24 - lsrs r0, 23 - adds r0, r2 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _0816F642 - adds r0, 0x3F -_0816F642: - asrs r0, 6 - strh r0, [r4, 0x26] - b _0816F654 - .pool -_0816F64C: - movs r0, 0 - strh r0, [r4, 0x36] - ldr r0, =sub_816F660 - str r0, [r4, 0x1C] -_0816F654: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816F5B4 - - thumb_func_start sub_816F660 -sub_816F660: @ 816F660 - push {r4,lr} - adds r1, r0, 0 - movs r2, 0x2E - ldrsh r0, [r1, r2] - cmp r0, 0x2 - beq _0816F6C0 - ldrh r0, [r1, 0x36] - adds r0, 0x8 - strh r0, [r1, 0x36] - ldr r3, =gSineTable - lsls r0, 24 - lsrs r0, 23 - adds r0, r3 - movs r4, 0 - ldrsh r0, [r0, r4] - cmp r0, 0 - bge _0816F684 - adds r0, 0xF -_0816F684: - asrs r0, 4 - adds r0, 0x40 - lsls r0, 16 - lsrs r2, r0, 16 - adds r0, r2, 0 - adds r0, 0x40 - lsls r0, 24 - lsrs r0, 23 - adds r0, r3 - movs r4, 0 - ldrsh r0, [r0, r4] - cmp r0, 0 - bge _0816F6A0 - adds r0, 0x3F -_0816F6A0: - asrs r0, 6 - strh r0, [r1, 0x24] - lsls r0, r2, 24 - lsrs r0, 23 - adds r0, r3 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bge _0816F6B4 - adds r0, 0x3F -_0816F6B4: - asrs r0, 6 - strh r0, [r1, 0x26] - b _0816F6C4 - .pool -_0816F6C0: - ldr r0, =sub_816F6D0 - str r0, [r1, 0x1C] -_0816F6C4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816F660 - - thumb_func_start sub_816F6D0 -sub_816F6D0: @ 816F6D0 - push {r4,lr} - adds r4, r0, 0 - ldrh r2, [r4, 0x22] - movs r0, 0x22 - ldrsh r1, [r4, r0] - movs r3, 0x38 - ldrsh r0, [r4, r3] - cmp r1, r0 - bge _0816F6E8 - adds r0, r2, 0x4 - strh r0, [r4, 0x22] - b _0816F744 -_0816F6E8: - movs r0, 0x1 - strh r0, [r4, 0x3C] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r0, r3 - strh r0, [r4, 0x22] - adds r0, r4, 0 - movs r1, 0x3 - bl StartSpriteAnim - movs r0, 0x80 - lsls r0, 3 - strh r0, [r4, 0x32] - ldrh r1, [r4, 0x30] - movs r0, 0x3 - ands r0, r1 - lsls r0, 3 - strh r0, [r4, 0x34] - ldr r0, =sub_816F318 - str r0, [r4, 0x1C] - ldrb r1, [r4, 0x1] - movs r0, 0x3F - ands r0, r1 - movs r1, 0x40 - orrs r0, r1 - strb r0, [r4, 0x1] - ldrb r0, [r4, 0x3] - movs r1, 0xC0 - orrs r0, r1 - strb r0, [r4, 0x3] - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x2 - bl CalcCenterToCornerVec -_0816F744: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816F6D0 - - thumb_func_start sub_816F750 -sub_816F750: @ 816F750 - push {r4,lr} - adds r4, r0, 0 - ldrh r2, [r4, 0x22] - movs r0, 0x22 - ldrsh r1, [r4, r0] - movs r3, 0x38 - ldrsh r0, [r4, r3] - cmp r1, r0 - bge _0816F768 - adds r0, r2, 0x4 - strh r0, [r4, 0x22] - b _0816F7C4 -_0816F768: - movs r0, 0x1 - strh r0, [r4, 0x3C] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x26] - ldrh r3, [r4, 0x22] - adds r0, r3 - strh r0, [r4, 0x22] - adds r0, r4, 0 - movs r1, 0x3 - bl StartSpriteAnim - movs r0, 0x80 - lsls r0, 3 - strh r0, [r4, 0x32] - ldrh r1, [r4, 0x30] - movs r0, 0x3 - ands r0, r1 - lsls r0, 3 - strh r0, [r4, 0x34] - ldr r0, =sub_816F318 - str r0, [r4, 0x1C] - ldrb r1, [r4, 0x1] - movs r0, 0x3F - ands r0, r1 - movs r1, 0x40 - orrs r0, r1 - strb r0, [r4, 0x1] - ldrb r0, [r4, 0x3] - movs r1, 0xC0 - orrs r0, r1 - strb r0, [r4, 0x3] - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x2 - bl CalcCenterToCornerVec -_0816F7C4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816F750 - - thumb_func_start sub_816F7D0 -sub_816F7D0: @ 816F7D0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - adds r4, r0, 0 - adds r5, r1, 0 - ldr r6, [sp, 0x34] - ldr r0, [sp, 0x38] - mov r8, r0 - lsls r4, 16 - lsls r5, 16 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x8] - lsls r3, 16 - lsrs r3, 16 - str r3, [sp, 0xC] - lsls r6, 16 - lsrs r6, 16 - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - ldr r0, =gUnknown_085E4D64 - lsrs r2, r4, 16 - mov r10, r2 - asrs r4, 16 - lsrs r1, r5, 16 - str r1, [sp, 0x4] - asrs r5, 16 - adds r1, r4, 0 - adds r2, r5, 0 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gSprites - mov r9, r2 - lsls r0, r7, 4 - adds r0, r7 - lsls r5, r0, 2 - adds r4, r5, r2 - movs r0, 0 - strh r0, [r4, 0x2E] - strh r0, [r4, 0x3C] - mov r0, sp - ldrh r0, [r0, 0xC] - strh r0, [r4, 0x30] - mov r1, sp - ldrh r1, [r1, 0x8] - strh r1, [r4, 0x32] - mov r2, sp - ldrh r2, [r2, 0x8] - strh r2, [r4, 0x34] - strh r6, [r4, 0x38] - mov r0, sp - ldrh r0, [r0, 0x8] - strh r0, [r4, 0x3A] - ldrb r0, [r4, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r4, 0x1] - movs r0, 0x1F - ldr r1, [sp, 0xC] - ands r1, r0 - lsls r1, 1 - ldrb r2, [r4, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x3] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x2 - movs r3, 0x2 - bl CalcCenterToCornerVec - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAnim - mov r1, r8 - cmp r1, 0 - bne _0816F898 - mov r0, r9 - adds r0, 0x1C - adds r0, r5, r0 - ldr r1, =sub_816F454 - b _0816F8A0 - .pool -_0816F898: - mov r0, r9 - adds r0, 0x1C - adds r0, r5, r0 - ldr r1, =sub_816F750 -_0816F8A0: - str r1, [r0] - str r7, [sp, 0x10] - mov r2, r10 - lsls r2, 16 - asrs r2, 16 - mov r10, r2 - ldr r0, [sp, 0x4] - lsls r0, 16 - asrs r0, 16 - mov r8, r0 - ldr r0, =gUnknown_085E4D64 - mov r1, r10 - mov r2, r8 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r7, r0, 24 - ldr r5, =gSprites - lsls r4, r7, 4 - adds r4, r7 - lsls r4, 2 - adds r0, r4, r5 - mov r1, sp - ldrh r1, [r1, 0x10] - strh r1, [r0, 0x3C] - ldr r2, [sp, 0xC] - adds r2, 0x1 - mov r9, r2 - strh r2, [r0, 0x30] - ldrb r1, [r0, 0x1] - movs r2, 0x3 - orrs r1, r2 - strb r1, [r0, 0x1] - mov r2, r9 - movs r1, 0x1F - ands r2, r1 - lsls r2, 1 - ldrb r3, [r0, 0x3] - movs r6, 0x3F - negs r6, r6 - adds r1, r6, 0 - ands r1, r3 - orrs r1, r2 - strb r1, [r0, 0x3] - movs r1, 0 - movs r2, 0x2 - movs r3, 0x2 - bl CalcCenterToCornerVec - ldr r2, =gSprites + 0x1C - adds r4, r2 - ldr r0, =sub_816F3A4 - str r0, [r4] - ldr r0, =gUnknown_085E4D64 - mov r1, r10 - mov r2, r8 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r7, r0, 24 - lsls r4, r7, 4 - adds r4, r7 - lsls r4, 2 - adds r5, r4, r5 - mov r1, sp - ldrh r1, [r1, 0x10] - strh r1, [r5, 0x3C] - ldr r2, [sp, 0xC] - adds r2, 0x2 - mov r8, r2 - strh r2, [r5, 0x30] - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAnim - ldrb r0, [r5, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r5, 0x1] - mov r0, r8 - movs r2, 0x1F - ands r0, r2 - lsls r0, 1 - ldrb r1, [r5, 0x3] - ands r6, r1 - orrs r6, r0 - strb r6, [r5, 0x3] - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x2 - movs r3, 0x2 - bl CalcCenterToCornerVec - ldr r0, =gSprites + 0x1C - adds r4, r0 - ldr r1, =sub_816F3A4 - str r1, [r4] - ldr r2, [sp, 0xC] - lsls r0, r2, 24 - lsrs r0, 24 - ldr r5, [sp, 0x8] - adds r5, 0x20 - lsls r4, r5, 16 - lsrs r4, 16 - str r4, [sp] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - mov r0, r9 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - str r4, [sp] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r5, 17 - lsrs r5, 16 - str r5, [sp] - mov r0, r8 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - ldr r0, [sp, 0x10] - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_816F7D0 - - thumb_func_start sub_816F9D4 -sub_816F9D4: @ 816F9D4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bhi _0816FA62 - lsls r0, 2 - ldr r1, =_0816F9F0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0816F9F0: - .4byte _0816FA04 - .4byte _0816FA12 - .4byte _0816FA30 - .4byte _0816FA62 - .4byte _0816FA50 -_0816FA04: - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAnimIfDifferent - ldrh r0, [r4, 0x20] - subs r0, 0x1 - b _0816FA60 -_0816FA12: - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAnimIfDifferent - ldr r0, =gUnknown_030062A0 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - bne _0816FAAA - ldrh r0, [r4, 0x20] - adds r0, 0x1 - b _0816FA60 - .pool -_0816FA30: - ldrh r2, [r4, 0x20] - movs r1, 0x20 - ldrsh r0, [r4, r1] - cmp r0, 0x78 - ble _0816FA46 - ldr r0, =gUnknown_030062A0 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - beq _0816FA6E -_0816FA46: - adds r0, r2, 0x1 - b _0816FA60 - .pool -_0816FA50: - ldrh r2, [r4, 0x20] - movs r0, 0x20 - ldrsh r1, [r4, r0] - movs r0, 0x20 - negs r0, r0 - cmp r1, r0 - ble _0816FA62 - subs r0, r2, 0x2 -_0816FA60: - strh r0, [r4, 0x20] -_0816FA62: - ldr r0, =gUnknown_030062A0 - ldr r0, [r0] - movs r1, 0x7 - ands r0, r1 - cmp r0, 0 - bne _0816FAAA -_0816FA6E: - movs r1, 0x26 - ldrsh r5, [r4, r1] - cmp r5, 0 - beq _0816FA80 - movs r0, 0 - strh r0, [r4, 0x26] - b _0816FAAA - .pool -_0816FA80: - bl Random - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x1 - beq _0816FAA8 - cmp r1, 0x1 - bgt _0816FA96 - cmp r1, 0 - beq _0816FA9E - b _0816FAAA -_0816FA96: - cmp r1, 0x3 - bgt _0816FAAA - strh r5, [r4, 0x26] - b _0816FAAA -_0816FA9E: - ldr r0, =0x0000ffff - strh r0, [r4, 0x26] - b _0816FAAA - .pool -_0816FAA8: - strh r1, [r4, 0x26] -_0816FAAA: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_816F9D4 - - thumb_func_start sub_816FAB0 -sub_816FAB0: @ 816FAB0 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0816FACA - cmp r0, 0x1 - ble _0816FB12 - cmp r0, 0x2 - beq _0816FAEA - cmp r0, 0x3 - beq _0816FB04 - b _0816FB12 -_0816FACA: - movs r2, 0x24 - ldrsh r0, [r4, r2] - movs r2, 0x20 - ldrsh r1, [r4, r2] - adds r0, r1 - ldr r1, =0x0000012f - cmp r0, r1 - bgt _0816FAE4 - ldrh r0, [r4, 0x24] - adds r0, 0x8 - b _0816FB10 - .pool -_0816FAE4: - movs r0, 0x2 - strh r0, [r4, 0x2E] - b _0816FB12 -_0816FAEA: - movs r1, 0x24 - ldrsh r0, [r4, r1] - movs r2, 0x20 - ldrsh r1, [r4, r2] - adds r0, r1 - cmp r0, 0x78 - ble _0816FAFE - ldrh r0, [r4, 0x24] - subs r0, 0x1 - b _0816FB10 -_0816FAFE: - movs r0, 0x3 - strh r0, [r4, 0x2E] - b _0816FB12 -_0816FB04: - ldrh r1, [r4, 0x24] - movs r2, 0x24 - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _0816FB12 - subs r0, r1, 0x2 -_0816FB10: - strh r0, [r4, 0x24] -_0816FB12: - ldrh r0, [r4, 0x30] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x8 - bl Sin - ldr r1, =gUnknown_0203BCCC - ldrh r1, [r1] - subs r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0x4 - strh r0, [r4, 0x30] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816FAB0 - - thumb_func_start sub_816FB38 -sub_816FB38: @ 816FB38 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x2E - ldrsh r0, [r6, r1] - cmp r0, 0x5 - bls _0816FB46 - b _0816FD38 -_0816FB46: - lsls r0, 2 - ldr r1, =_0816FB54 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0816FB54: - .4byte _0816FB6C - .4byte _0816FB94 - .4byte _0816FBB4 - .4byte _0816FC5C - .4byte _0816FCC4 - .4byte _0816FCF4 -_0816FB6C: - ldrh r1, [r6, 0x30] - movs r2, 0x30 - ldrsh r0, [r6, r2] - cmp r0, 0 - beq _0816FB7C - subs r0, r1, 0x1 - strh r0, [r6, 0x30] - b _0816FD38 -_0816FB7C: - adds r2, r6, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r0 - strb r1, [r2] - adds r0, r6, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - b _0816FCE6 -_0816FB94: - ldr r0, =gUnknown_030062A0 - ldr r0, [r0] - cmp r0, 0x90 - beq _0816FB9E - b _0816FD38 -_0816FB9E: - ldrh r0, [r6, 0x2E] - adds r0, 0x1 - strh r0, [r6, 0x2E] - movs r0, 0x9 - strh r0, [r6, 0x30] - movs r0, 0x2 - strh r0, [r6, 0x34] - b _0816FD38 - .pool -_0816FBB4: - ldrh r1, [r6, 0x34] - movs r2, 0x34 - ldrsh r0, [r6, r2] - cmp r0, 0 - bne _0816FC66 - movs r0, 0x2 - strh r0, [r6, 0x34] - movs r1, 0x30 - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _0816FC14 - lsls r0, 1 - ldr r4, =gIntro1GameFreakTextFadePal - adds r0, r4 - ldr r5, =gPlttBufferFaded + 0x23E - adds r1, r5, 0 - movs r2, 0x1 - bl CpuSet - movs r1, 0x30 - ldrsh r0, [r6, r1] - lsls r0, 1 - adds r1, r4, 0 - adds r1, 0x20 - adds r0, r1 - adds r1, r5, 0 - subs r1, 0x16 - movs r2, 0x1 - bl CpuSet - movs r2, 0x30 - ldrsh r0, [r6, r2] - lsls r0, 1 - adds r4, 0x40 - adds r0, r4 - subs r5, 0xA - adds r1, r5, 0 - movs r2, 0x1 - bl CpuSet - ldrh r0, [r6, 0x30] - subs r0, 0x1 - strh r0, [r6, 0x30] - b _0816FD38 - .pool -_0816FC14: - movs r1, 0x30 - ldrsh r0, [r6, r1] - lsls r0, 1 - ldr r4, =gIntro1GameFreakTextFadePal - adds r0, r4 - ldr r5, =gPlttBufferFaded + 0x23E - adds r1, r5, 0 - movs r2, 0x1 - bl CpuSet - movs r2, 0x30 - ldrsh r0, [r6, r2] - lsls r0, 1 - adds r1, r4, 0 - adds r1, 0x20 - adds r0, r1 - adds r1, r5, 0 - subs r1, 0x16 - movs r2, 0x1 - bl CpuSet - movs r1, 0x30 - ldrsh r0, [r6, r1] - lsls r0, 1 - adds r4, 0x40 - adds r0, r4 - subs r5, 0xA - adds r1, r5, 0 - movs r2, 0x1 - bl CpuSet - b _0816FCE6 - .pool -_0816FC5C: - ldrh r1, [r6, 0x34] - movs r2, 0x34 - ldrsh r0, [r6, r2] - cmp r0, 0 - beq _0816FC6C -_0816FC66: - subs r0, r1, 0x1 - strh r0, [r6, 0x34] - b _0816FD38 -_0816FC6C: - movs r0, 0x2 - strh r0, [r6, 0x34] - movs r1, 0x30 - ldrsh r0, [r6, r1] - cmp r0, 0x9 - bgt _0816FCE6 - lsls r0, 1 - ldr r4, =gIntro1GameFreakTextFadePal - adds r0, r4 - ldr r5, =gPlttBufferFaded + 0x23E - adds r1, r5, 0 - movs r2, 0x1 - bl CpuSet - movs r1, 0x30 - ldrsh r0, [r6, r1] - lsls r0, 1 - adds r1, r4, 0 - adds r1, 0x20 - adds r0, r1 - adds r1, r5, 0 - subs r1, 0x16 - movs r2, 0x1 - bl CpuSet - movs r2, 0x30 - ldrsh r0, [r6, r2] - lsls r0, 1 - adds r4, 0x40 - adds r0, r4 - subs r5, 0xA - adds r1, r5, 0 - movs r2, 0x1 - bl CpuSet - ldrh r0, [r6, 0x30] - adds r0, 0x1 - strh r0, [r6, 0x30] - b _0816FD38 - .pool -_0816FCC4: - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - movs r0, 0x88 - lsls r0, 1 - cmp r1, r0 - bne _0816FD38 - adds r0, r6, 0 - movs r1, 0x2 - bl StartSpriteAffineAnim - ldrb r1, [r6, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r6, 0x1] -_0816FCE6: - ldrh r0, [r6, 0x2E] - adds r0, 0x1 - strh r0, [r6, 0x2E] - b _0816FD38 - .pool -_0816FCF4: - ldr r1, =gUnknown_085E4F48 - movs r2, 0x32 - ldrsh r0, [r6, r2] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - ldrh r1, [r6, 0x34] - adds r0, r1 - strh r0, [r6, 0x34] - movs r2, 0x34 - ldrsh r0, [r6, r2] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - asrs r0, 8 - strh r0, [r6, 0x24] - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x3 - bgt _0816FD24 - movs r2, 0x24 - ldrsh r0, [r6, r2] - negs r0, r0 - strh r0, [r6, 0x24] -_0816FD24: - adds r0, r6, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0816FD38 - adds r0, r6, 0 - bl DestroySprite -_0816FD38: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816FB38 - - thumb_func_start sub_816FD44 -sub_816FD44: @ 816FD44 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0816FD7C - cmp r0, 0x1 - bgt _0816FD5A - cmp r0, 0 - beq _0816FD60 - b _0816FDB0 -_0816FD5A: - cmp r0, 0x2 - beq _0816FD9C - b _0816FDB0 -_0816FD60: - ldr r0, =gUnknown_030062A0 - ldr r0, [r0] - cmp r0, 0x80 - bne _0816FDB0 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r0 - strb r1, [r2] - b _0816FD90 - .pool -_0816FD7C: - ldr r0, =gUnknown_030062A0 - ldr r1, [r0] - movs r0, 0x88 - lsls r0, 1 - cmp r1, r0 - bne _0816FDB0 - adds r0, r4, 0 - movs r1, 0x3 - bl StartSpriteAffineAnim -_0816FD90: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _0816FDB0 - .pool -_0816FD9C: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0816FDB0 - adds r0, r4, 0 - bl DestroySprite -_0816FDB0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816FD44 - - thumb_func_start sub_816FDB8 -sub_816FDB8: @ 816FDB8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 16 - lsrs r0, 16 - str r0, [sp] - lsls r1, 16 - lsrs r1, 16 - str r1, [sp, 0x4] - movs r7, 0 -_0816FDD2: - lsls r5, r7, 2 - ldr r0, =gUnknown_085E4E94 - adds r0, 0x2 - adds r0, r5, r0 - ldr r2, [sp] - lsls r1, r2, 16 - asrs r1, 16 - ldrh r0, [r0] - adds r1, r0 - lsls r1, 16 - asrs r1, 16 - ldr r3, [sp, 0x4] - lsls r2, r3, 16 - asrs r0, r2, 16 - str r0, [sp, 0x8] - ldr r3, =0xfffc0000 - adds r2, r3 - ldr r0, =gUnknown_085E4F5C - asrs r2, 16 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - lsls r4, r6, 4 - adds r4, r6 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - movs r1, 0 - strh r1, [r4, 0x2E] - ldr r0, =gUnknown_085E4FA4 - adds r0, r7, r0 - ldrb r0, [r0] - strh r0, [r4, 0x30] - strh r7, [r4, 0x32] - adds r1, r4, 0 - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - mov r10, r2 - mov r3, r10 - orrs r0, r3 - strb r0, [r1] - adds r1, r7, 0 - adds r1, 0xC - movs r0, 0x1F - mov r9, r0 - mov r2, r9 - ands r1, r2 - lsls r1, 1 - ldrb r0, [r4, 0x3] - movs r3, 0x3F - negs r3, r3 - mov r8, r3 - mov r2, r8 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x3] - ldr r3, =gUnknown_085E4E94 - adds r5, r3 - ldrb r1, [r5] - adds r0, r4, 0 - bl StartSpriteAnim - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAffineAnim - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x8 - bls _0816FDD2 - ldr r0, =gUnknown_085E4F8C - ldr r2, [sp, 0x8] - subs r2, 0x6 - lsls r2, 16 - asrs r2, 16 - movs r1, 0x78 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r2, 0 - strh r2, [r0, 0x2E] - adds r2, r0, 0 - adds r2, 0x3E - ldrb r1, [r2] - mov r3, r10 - orrs r1, r3 - strb r1, [r2] - adds r2, r7, 0 - adds r2, 0xC - mov r1, r9 - ands r2, r1 - lsls r2, 1 - ldrb r1, [r0, 0x3] - mov r3, r8 - ands r1, r3 - orrs r1, r2 - strb r1, [r0, 0x3] - movs r1, 0x1 - bl StartSpriteAffineAnim - adds r0, r6, 0 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_816FDB8 - thumb_func_start sub_816FEDC sub_816FEDC: @ 816FEDC push {r4-r6,lr} diff --git a/asm/intro_credits_graphics.s b/asm/intro_credits_graphics.s index ad249a470f..3187138ce9 100644 --- a/asm/intro_credits_graphics.s +++ b/asm/intro_credits_graphics.s @@ -828,8 +828,8 @@ sub_817B7C4: @ 817B7C4 .pool thumb_func_end sub_817B7C4 - thumb_func_start sub_817B834 -sub_817B834: @ 817B834 + thumb_func_start intro_create_brendan_sprite +intro_create_brendan_sprite: @ 817B834 push {r4-r6,lr} adds r5, r0, 0 adds r4, r1, 0 @@ -866,10 +866,10 @@ sub_817B834: @ 817B834 pop {r1} bx r1 .pool - thumb_func_end sub_817B834 + thumb_func_end intro_create_brendan_sprite - thumb_func_start sub_817B88C -sub_817B88C: @ 817B88C + thumb_func_start intro_create_may_sprite +intro_create_may_sprite: @ 817B88C push {r4-r6,lr} adds r5, r0, 0 adds r4, r1, 0 @@ -906,7 +906,7 @@ sub_817B88C: @ 817B88C pop {r1} bx r1 .pool - thumb_func_end sub_817B88C + thumb_func_end intro_create_may_sprite thumb_func_start nullsub_66 nullsub_66: @ 817B8E4 @@ -1019,8 +1019,8 @@ sub_817B948: @ 817B948 .pool thumb_func_end sub_817B948 - thumb_func_start sub_817B9C4 -sub_817B9C4: @ 817B9C4 + thumb_func_start intro_create_flygon_sprite +intro_create_flygon_sprite: @ 817B9C4 push {r4-r6,lr} mov r6, r8 push {r6} @@ -1072,6 +1072,6 @@ sub_817B9C4: @ 817B9C4 pop {r1} bx r1 .pool - thumb_func_end sub_817B9C4 + thumb_func_end intro_create_flygon_sprite .align 2, 0 @ Don't pad with nop. diff --git a/data/intro.s b/data/intro.s index d43a579724..142d1c69e6 100644 --- a/data/intro.s +++ b/data/intro.s @@ -230,9 +230,12 @@ gUnknown_085E4C4C:: @ 85E4C4C .align 2 gUnknown_085E4C64:: @ 85E4C64 - .2byte 0x0068, 0x0000, 0x00c0, 0x008e, 0x0003, 0x0280, 0x0053, 0x0001 - .2byte 0x0180, 0x009b, 0x0000, 0x0080, 0x0038, 0x0002, 0x0200, 0x00ae - .2byte 0x0001, 0x0100 + .2byte 0x0068, 0x0000, 0x00c0 + .2byte 0x008e, 0x0003, 0x0280 + .2byte 0x0053, 0x0001, 0x0180 + .2byte 0x009b, 0x0000, 0x0080 + .2byte 0x0038, 0x0002, 0x0200 + .2byte 0x00ae, 0x0001, 0x0100 .align 2 gUnknown_085E4C88:: @ 85E4C88 @@ -246,11 +249,18 @@ gUnknown_085E4C98:: @ 85E4C98 .align 2 gUnknown_085E4CA8:: @ 85E4CA8 - .2byte 0x0042, 0x0040, 0x0001, 0x0060, 0x0060, 0x0008, 0x0080, 0x0040 - .2byte 0x0001, 0x0090, 0x0030, 0x0008, 0x00a0, 0x0048, 0x0001, 0x00b0 - .2byte 0x0060, 0x0008, 0x0060, 0x0060, 0x0004, 0x0070, 0x0068, 0x0008 - .2byte 0x0080, 0x0060, 0x0004, 0x0058, 0x0020, 0x0004, 0x0068, 0x0018 - .2byte 0x0008, 0x0078, 0x0020, 0x0004 + .2byte 0x0042, 0x0040, 0x0001 + .2byte 0x0060, 0x0060, 0x0008 + .2byte 0x0080, 0x0040, 0x0001 + .2byte 0x0090, 0x0030, 0x0008 + .2byte 0x00a0, 0x0048, 0x0001 + .2byte 0x00b0, 0x0060, 0x0008 + .2byte 0x0060, 0x0060, 0x0004 + .2byte 0x0070, 0x0068, 0x0008 + .2byte 0x0080, 0x0060, 0x0004 + .2byte 0x0058, 0x0020, 0x0004 + .2byte 0x0068, 0x0018, 0x0008 + .2byte 0x0078, 0x0020, 0x0004 .align 2 gUnknown_085E4CF0:: @ 85E4CF0 @@ -420,10 +430,22 @@ gUnknown_085E4E90:: @ 85E4E90 .align 2 gUnknown_085E4E94:: @ 85E4E94 - .2byte 0x0000, 0xffb8, 0x0001, 0xffc8, 0x0002, 0xffd8, 0x0003, 0xffe8 - .2byte 0x0004, 0x0008, 0x0005, 0x0018, 0x0003, 0x0028, 0x0001, 0x0038 - .2byte 0x0006, 0x0048, 0x0000, 0xffe4, 0x0001, 0xffec, 0x0002, 0xfff4 - .2byte 0x0003, 0xfffc, 0x0002, 0x0004, 0x0004, 0x000c, 0x0005, 0x0014 + .2byte 0x0000, 0xffb8 + .2byte 0x0001, 0xffc8 + .2byte 0x0002, 0xffd8 + .2byte 0x0003, 0xffe8 + .2byte 0x0004, 0x0008 + .2byte 0x0005, 0x0018 + .2byte 0x0003, 0x0028 + .2byte 0x0001, 0x0038 + .2byte 0x0006, 0x0048 + .2byte 0x0000, 0xffe4 + .2byte 0x0001, 0xffec + .2byte 0x0002, 0xfff4 + .2byte 0x0003, 0xfffc + .2byte 0x0002, 0x0004 + .2byte 0x0004, 0x000c + .2byte 0x0005, 0x0014 .2byte 0x0003, 0x001c .align 2 diff --git a/data/intro_credits_graphics.s b/data/intro_credits_graphics.s index 636c1a8fbd..7c5726eb89 100644 --- a/data/intro_credits_graphics.s +++ b/data/intro_credits_graphics.s @@ -383,17 +383,17 @@ gUnknown_085F52A4:: @ 85F52A4 spr_template 0x03ed, 0x03ed, gUnknown_085F526C, gUnknown_085F5284, NULL, gDummySpriteAffineAnimTable, nullsub_66 .align 2 -gUnknown_085F52BC:: @ 85F52BC +gIntro2BrendanSpriteSheet:: @ 85F52BC obj_tiles gIntro2BrendanNoTurnGfx, 0x2000, 0x03ea null_obj_tiles .align 2 -gUnknown_085F52CC:: @ 85F52CC +gIntro2MaySpriteSheet:: @ 85F52CC obj_tiles gIntro2MayNoTurnGfx, 0x2000, 0x03eb null_obj_tiles .align 2 -gUnknown_085F52DC:: @ 85F52DC +gIntro2BicycleSpriteSheet:: @ 85F52DC obj_tiles gIntro2BicycleGfx, 0x1000, 0x03e9 null_obj_tiles @@ -403,7 +403,7 @@ gUnknown_085F52EC:: @ 85F52EC null_obj_tiles .align 2 -gUnknown_085F52FC:: @ 85F52FC +gIntro2FlygonSpriteSheet:: @ 85F52FC obj_tiles gIntro2FlygonGfx, 0x1000, 0x03ed null_obj_tiles diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 1847b688f3..0364c38bcd 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -623,23 +623,6 @@ #define TIMER_INTR_ENABLE 0x40 #define TIMER_ENABLE 0x80 -// BGCNT -#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs. -#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data. -#define BGCNT_MOSAIC 0x0040 -#define BGCNT_16COLOR 0x0000 // 4 bits per pixel -#define BGCNT_256COLOR 0x0080 // 8 bits per pixel -#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for tile map. -#define BGCNT_WRAP 0x2000 // Only affects affine BGs. Text BGs wrap by default. -#define BGCNT_TXT256x256 0x0000 // Internal screen size size of text mode BG in pixels. -#define BGCNT_TXT512x256 0x4000 -#define BGCNT_TXT256x512 0x8000 -#define BGCNT_TXT512x512 0xC000 -#define BGCNT_AFF128x128 0x0000 // Internal screen size size of affine mode BG in pixels. -#define BGCNT_AFF256x256 0x4000 -#define BGCNT_AFF512x512 0x8000 -#define BGCNT_AFF1024x1024 0xC000 - // serial #define SIO_ID 0x0030 // Communication ID diff --git a/include/graphics.h b/include/graphics.h index 6e5de9ef42..76eaff28f8 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2725,4 +2725,24 @@ extern const u16 gBagScreenFemale_Pal[]; extern const u16 gBagScreenMale_Pal[]; extern const u8 gBagMenuHMIcon_Gfx[]; +//intro graphics +extern const u8 gIntro3GroudonGfx[]; +extern const u8 gIntro3GroudonTilemap[]; +extern const u8 gIntro3LegendBgGfx[]; +extern const u8 gIntro3GroudonBgTilemap[]; +extern const u8 gIntro3GroudonBgTilemap[]; +extern const u8 gIntro3BgPal[0x200]; +extern const u8 gIntro3KyogreGfx[]; +extern const u8 gIntro3KyogreTilemap[]; +extern const u8 gIntro3KyogreBgTilemap[]; +extern const u8 gIntro3CloudsGfx[]; +extern const u8 gIntro3Clouds1Tilemap[]; +extern const u8 gIntro3Clouds2Tilemap[]; +extern const u8 gIntro3Clouds3Tilemap[]; +extern const u8 gIntro3Clouds4Tilemap[]; +extern const u8 gIntro3RayquazaTilemap[]; +extern const u8 gIntro3RayquazaGfx[]; +extern const u8 gIntro3Clouds2Gfx[]; +extern const u16 gIntro1GameFreakTextFadePal[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/intro.h b/include/intro.h index aae3438fe8..b1bfe20a40 100644 --- a/include/intro.h +++ b/include/intro.h @@ -6,7 +6,7 @@ // Exported RAM declarations // Exported ROM declarations -void c2_copyright_1(void); +void CB2_InitCopyrightScreenAfterBootup(void); void CB2_InitCopyrightScreenAfterBootup(void); void CB2_InitCopyrightScreenAfterTitleScreen(void); void sub_816F2A8(u16, u16, u16, u16); diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h new file mode 100644 index 0000000000..c63861d878 --- /dev/null +++ b/include/intro_credits_graphics.h @@ -0,0 +1,18 @@ +#ifndef GUARD_INTRO_CREDITS_GRAPHICS_H +#define GUARD_INTRO_CREDITS_GRAPHICS_H + +extern const struct CompressedSpriteSheet gIntro2BrendanSpriteSheet[]; +extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[]; +extern const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[]; +extern const struct CompressedSpriteSheet gIntro2FlygonSpriteSheet[]; +extern const struct SpritePalette gUnknown_085F530C[]; + +void load_intro_part2_graphics(u8 a); +void sub_817B150(u8 a); +u8 sub_817B3DC(u8 a, u16 b, u16 c, u16 d); +void sub_817B540(u8); +u8 intro_create_brendan_sprite(s16 a, s16 b); +u8 intro_create_may_sprite(s16 a, s16 b); +u8 intro_create_flygon_sprite(s16 a, s16 b); + +#endif // GUARD_INTRO_CREDITS_GRAPHICS_H diff --git a/include/libgcnmultiboot.h b/include/libgcnmultiboot.h new file mode 100644 index 0000000000..7d347df051 --- /dev/null +++ b/include/libgcnmultiboot.h @@ -0,0 +1,17 @@ +#ifndef GUARD_LIBGCMMULTIBOOT_H +#define GUARD_LIBGCNMULTIBOOT_H + +struct GcmbStruct +{ + u16 gcmb_field_0; + vu8 gcmb_field_2; + u8 filler3[0x2C - 0x3]; +}; + +void GameCubeMultiBoot_Main(struct GcmbStruct *pStruct); +void GameCubeMultiBoot_ExecuteProgram(struct GcmbStruct *pStruct); +void GameCubeMultiBoot_Init(struct GcmbStruct *pStruct); +void GameCubeMultiBoot_HandleSerialInterrupt(struct GcmbStruct *pStruct); +void GameCubeMultiBoot_Quit(void); + +#endif // GUARD_LIBGCNMULTIBOOT_H diff --git a/include/multiboot_pokemon_colosseum.h b/include/multiboot_pokemon_colosseum.h new file mode 100644 index 0000000000..33e4bc33c7 --- /dev/null +++ b/include/multiboot_pokemon_colosseum.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MULTIBOOT_POKEMON_COLOSSEUM_H +#define GUARD_MULTIBOOT_POKEMON_COLOSSEUM_H + +extern const u16 gMultiBootProgram_PokemonColosseum_Start[0x14000]; + +#endif // GUARD_MULTIBOOT_POKEMON_COLOSSEUM_H diff --git a/include/save.h b/include/save.h index 3bd1ff8cf4..f06db29557 100644 --- a/include/save.h +++ b/include/save.h @@ -47,19 +47,19 @@ enum // Do save types enum { - NORMAL_SAVE, - LINK_SAVE, - //EREADER_SAVE, // depreciated in Emerald - LINK2_SAVE, // unknown 2nd link save - HOF_SAVE, - DIFFERENT_FILE_SAVE, - HOF_DELETE_SAVE // unused + SAVE_NORMAL, + SAVE_LINK, + //EREADER_SAVE, // deprecated in Emerald + SAVE_LINK2, // unknown 2nd link save + SAVE_HALL_OF_FAME, + SAVE_OVERWRITE_DIFFERENT_FILE, + SAVE_HALL_OF_FAME_ERASE_BEFORE // unused }; #define SECTION_ID_RECORDED_BATTLE 31 void ClearSaveData(void); -void ResetSaveCounters(void); +void Save_ResetSaveCounters(void); bool32 SetDamagedSectorBits(u8 op, u8 bit); u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location); u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location); @@ -88,7 +88,7 @@ u8 sub_81533E0(void); u8 sub_8153408(void); u8 sub_8153430(void); bool8 sub_8153474(void); -u8 sub_81534D0(u8 a1); +u8 Save_LoadGameData(u8 a1); u16 sub_815355C(void); u32 TryCopySpecialSaveSection(u8 sector, u8* dst); u32 sub_8153634(u8 sector, u8* src); diff --git a/ld_script.txt b/ld_script.txt index 86e0d58d3c..79914e1721 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -218,6 +218,7 @@ SECTIONS { asm/use_pokeblock.o(.text); src/battle_controller_wally.o(.text); asm/player_pc.o(.text); + src/intro.o(.text); asm/intro.o(.text); src/reset_save_heap.o(.text); src/field_region_map.o(.text); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 6dda6ad9cb..d40e212bb7 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -516,7 +516,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId) } else { - if (sub_81534D0(3) != TRUE) + if (Save_LoadGameData(3) != TRUE) memset(gDecompressionBuffer, 0, 0x2000); } @@ -885,7 +885,7 @@ void CB2_DoHallOfFamePC(void) static void Task_HofPC_CopySaveData(u8 taskId) { sub_81980F0(0, 0x1E, 0, 0xC, 0x226); - if (sub_81534D0(3) != 1) + if (Save_LoadGameData(3) != 1) { gTasks[taskId].func = Task_HofPC_PrintDataIsCorrupted; } diff --git a/src/intro.c b/src/intro.c new file mode 100644 index 0000000000..0b66decfc0 --- /dev/null +++ b/src/intro.c @@ -0,0 +1,2281 @@ +#include "global.h" +#include "main.h" +#include "palette.h" +#include "scanline_effect.h" +#include "task.h" +#include "title_screen.h" +#include "libgcnmultiboot.h" +#include "malloc.h" +#include "gpu_regs.h" +#include "link.h" +#include "multiboot_pokemon_colosseum.h" +#include "load_save.h" +#include "save.h" +#include "new_game.h" +#include "m4a.h" +#include "random.h" +#include "decompress.h" +#include "constants/songs.h" +#include "intro_credits_graphics.h" +#include "trig.h" +#include "intro.h" +#include "graphics.h" +#include "sound.h" +#include "constants/species.h" +#include "blend_palette.h" +#include "title_screen.h" + +extern EWRAM_DATA u16 gUnknown_0203BCC8; +extern EWRAM_DATA u16 gUnknown_0203BCCA; +extern EWRAM_DATA u16 gUnknown_0203BCCC; + +extern u16 gUnknown_0203BD24; +extern u16 gUnknown_0203BD26; +extern u16 gUnknown_0203BD28; + +extern u32 gIntroFrameCounter; +extern struct GcmbStruct gMultibootProgramStruct; + +extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; +extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; + +extern const struct SpriteTemplate gUnknown_08596C10[]; + +extern u8 gIntroCopyright_Gfx[]; +extern u8 gIntroCopyright_Tilemap[]; +extern u16 gIntroCopyright_Pal[]; + +extern const u16 gIntro1BGPals[16][16]/* = +{ + INCBIN_U16("graphics/intro/intro1_bgpal1.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal2.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal3.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal4.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal5.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal6.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal7.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal8.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal9.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal10.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal11.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal12.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal13.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal14.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal15.gbapal"), + INCBIN_U16("graphics/intro/intro1_bgpal16.gbapal"), +}*/; +extern const u8 gIntro1BG0_Tilemap[]/* = INCBIN_U8("graphics/intro/intro1_bg0_map.bin.lz")*/; +extern const u8 gIntro1BG1_Tilemap[]/* = INCBIN_U8("graphics/intro/intro1_bg1_map.bin.lz")*/; +extern const u8 gIntro1BG2_Tilemap[]/* = INCBIN_U8("graphics/intro/intro1_bg2_map.bin.lz")*/; +extern const u8 gIntro1BG3_Tilemap[]/* = INCBIN_U8("graphics/intro/intro1_bg3_map.bin.lz")*/; +extern const u8 gIntro1BGLeavesGfx[]/* = INCBIN_U8("graphics/intro/introgfx.4bpp.lz")*/; +extern const u16 gIntro3PokeballPal[]/* = INCBIN_U16("graphics/intro/intro3_pokeball.gbapal")*/; +extern const u8 gIntro3Pokeball_Tilemap[]/* = INCBIN_U8("graphics/intro/intro3_pokeball_map.bin.lz")*/; +extern const u8 gIntro3Pokeball_Gfx[]/* = INCBIN_U8("graphics/intro/intro3_pokeball.8bpp.lz")*/; + +extern const struct CompressedSpriteSheet gUnknown_085E4A74[]; +extern const struct SpritePalette gUnknown_085E4A84[]; +extern const struct SpriteTemplate gUnknown_085E4AB8[]; +extern const struct CompressedSpriteSheet gUnknown_085E4AE8[3]; +extern const u8 gUnknown_085E4AD0[][2]; +extern const struct SpritePalette gUnknown_085E4B08[]; +extern const struct SpriteTemplate gUnknown_085E4B40[]; +extern const struct SpriteTemplate gUnknown_085E4BA4[]; +extern const struct SpriteTemplate gUnknown_085E4BDC[]; +extern const struct CompressedSpriteSheet gUnknown_085E4BF4[]; +extern const struct SpritePalette gUnknown_085E4C04[]; +extern const struct SpriteTemplate gUnknown_085E4C4C[]; +extern const s16 gUnknown_085E4C64[][3]; +extern const struct CompressedSpriteSheet gUnknown_085E4C88[]; +extern const struct SpritePalette gUnknown_085E4C98[]; +extern const s16 gUnknown_085E4CA8[][3]; +extern const struct SpriteTemplate gUnknown_085E4D14[]; +extern const struct SpriteTemplate gUnknown_085E4D64/* = +{ + .tileTag = 2000, + .paletteTag = 2000, + .oam = &gOamData_840ADE8, + .anims = gSpriteAnimTable_840AE10, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_813D208, +}*/; +extern const union AnimCmd *const gUnknown_085E4DC4[]/* = +{ + Unknown_40AE38, + Unknown_40AE4C, + Unknown_40AE60, + Unknown_40AE70, +}*/; +extern const s16 gUnknown_085E4E94[][2]; +extern const u16 gUnknown_085E4F48[]; +extern const struct SpriteTemplate gUnknown_085E4F5C[]; +extern const struct SpriteTemplate gUnknown_085E4F8C[]; +extern const u8 gUnknown_085E4FA4[]; +extern const struct SpriteTemplate gUnknown_085E4FC4[]; +extern const struct CompressedSpriteSheet gUnknown_085E4FDC[]/* = +{ + {gIntroTiles, 0x1400, 2000}, + {NULL}, +}*/; +extern const struct CompressedSpriteSheet gUnknown_085E4FEC[]/* = +{ + {gIntro1EonTiles, 0x400, 2002}, + {NULL}, +}*/; +extern const struct SpritePalette gUnknown_085E4FFC[]/* = +{ + {Palette_406340, 2000}, + {Palette_406360, 2001}, + {gIntro1EonPalette, 2002}, + {NULL}, +}*/; +extern const struct SpriteTemplate gUnknown_085E5030[]; +extern const struct CompressedSpriteSheet gUnknown_085E5048[]; +extern const struct SpritePalette gUnknown_085E5058[]; + +extern void MainCB2_EndIntro(void); +extern void Task_IntroLoadPart1Graphics(u8); +extern u8 CreateWaterDrop(s16, s16, u16, u16, u16, u8); +extern void Task_IntroFadeIn(u8); +extern void intro_reset_and_hide_bgs(void); +extern void Task_IntroWaterDrops(u8); +extern void Task_IntroWaterDrops_1(u8); +extern void Task_IntroWaterDrops_2(u8); +extern void Task_IntroWaterDrops_3(u8); +extern void Task_IntroScrollDownAndShowFlygon(u8); +extern void Task_IntroWaitToSetupPart2(u8); +extern void Task_IntroLoadPart2Graphics(u8); +extern void Task_IntroStartBikeRide(u8); +extern void Task_IntroHandleBikeAndFlygonMovement(u8); +extern void Task_IntroWaitToSetupPart3(u8); +extern void Task_IntroLoadPart3Graphics(u8); +extern void Task_IntroSpinAndZoomPokeball(u8); +extern void Task_IntroWaitToSetupPart3LegendsFight(u8); +extern void Task_IntroLoadPart1Graphics3(u8); +extern void Task_IntroLoadPart1Graphics4(u8); +extern void Task_IntroLoadPart1Graphics5(u8); +extern void Task_IntroLoadPart1Graphics6(u8); +extern void Task_IntroLoadPart1Graphics7(u8); +extern void Task_IntroLoadPart1Graphics8(u8); +extern void Task_IntroLoadPart1Graphics9(u8); +extern void Task_IntroFadeIn0(u8); +extern void Task_IntroFadeIn1(u8); +extern void Task_IntroFadeIn2(u8); +extern void Task_IntroFadeIn3(u8); +extern void Task_IntroFadeIn4(u8); +extern void Task_IntroFadeIn5(u8); +extern void Task_IntroFadeIn6(u8); +extern void Task_IntroFadeIn7(u8); +extern void Task_IntroFadeIn8(u8); +extern void Task_IntroFadeIn9(u8); +extern void sub_816E190(u8); +extern void sub_816E1F8(struct Sprite *); +extern void sub_816E6D4(u8); +extern void sub_816E74C(void); +extern void sub_816EEA8(u8); +extern void sub_816F46C(struct Sprite *); +extern void sub_816F5B4(struct Sprite *); +extern void sub_816F660(struct Sprite *); +extern void SpriteCB_WaterDropFall(struct Sprite *); +extern void sub_816F318(struct Sprite *); +extern void sub_816F9D4(struct Sprite *); +extern void sub_816FAB0(struct Sprite *); +extern u8 sub_816FDB8(s16, s16, s16); + +void VBlankCB_Intro(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + ScanlineEffect_InitHBlankDmaTransfer(); +} + +void MainCB2_Intro(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); + if (gMain.newKeys && !gPaletteFade.active) + SetMainCallback2(MainCB2_EndIntro); + else if (gIntroFrameCounter != -1) + gIntroFrameCounter++; +} + +void MainCB2_EndIntro(void) +{ + if (!UpdatePaletteFade()) + SetMainCallback2(CB2_InitTitleScreen); +} + +void LoadCopyrightGraphics(u16 tilesetAddress, u16 tilemapAddress, u16 paletteAddress) +{ + LZ77UnCompVram(gIntroCopyright_Gfx, (void *)(VRAM + tilesetAddress)); + LZ77UnCompVram(gIntroCopyright_Tilemap, (void *)(VRAM + tilemapAddress)); + LoadPalette(gIntroCopyright_Pal, paletteAddress, 0x20); +} + +void SerialCB_CopyrightScreen(void) +{ + GameCubeMultiBoot_HandleSerialInterrupt(&gMultibootProgramStruct); +} + +u8 SetUpCopyrightScreen(void) +{ + u16 ime; + + switch (gMain.state) + { + case 0: + SetVBlankCallback(NULL); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + *(u16 *)PLTT = 0x7FFF; + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetGpuReg(REG_OFFSET_BG0HOFS, 0); + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + CpuFill32(0, (void *)VRAM, VRAM_SIZE); + CpuFill32(0, (void *)OAM, OAM_SIZE); + CpuFill16(0, (void *)(PLTT + 2), PLTT_SIZE - 2); + ResetPaletteFade(); + LoadCopyrightGraphics(0, 0x3800, 0); + ScanlineEffect_Stop(); + ResetTasks(); + ResetSpriteData(); + FreeAllSpritePalettes(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0xFFFF); + SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) + | BGCNT_CHARBASE(0) + | BGCNT_SCREENBASE(7) + | BGCNT_16COLOR + | BGCNT_TXT256x256); + EnableInterrupts(INTR_FLAG_VBLANK); + SetVBlankCallback(VBlankCB_Intro); + REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON; + SetSerialCallback(SerialCB_CopyrightScreen); + GameCubeMultiBoot_Init(&gMultibootProgramStruct); + default: + UpdatePaletteFade(); + gMain.state++; + GameCubeMultiBoot_Main(&gMultibootProgramStruct); + break; + case 140: + GameCubeMultiBoot_Main(&gMultibootProgramStruct); + if (gMultibootProgramStruct.gcmb_field_2 != 1) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0); + gMain.state++; + } + break; + case 141: + if (UpdatePaletteFade()) + break; + CreateTask(Task_IntroLoadPart1Graphics, 0); + SetMainCallback2(MainCB2_Intro); + if (gMultibootProgramStruct.gcmb_field_2 != 0) + { + if (gMultibootProgramStruct.gcmb_field_2 == 2) + { + // check the multiboot ROM header game code to see if we already did this + if (*(u32 *)(EWRAM_START + 0xAC) == 0x65366347) // "Gc6e" in ASCII + { + CpuCopy16(&gMultiBootProgram_PokemonColosseum_Start, (void *)EWRAM_START, sizeof(gMultiBootProgram_PokemonColosseum_Start)); + *(u32 *)(EWRAM_START + 0xAC) = 0x65366347; + } + GameCubeMultiBoot_ExecuteProgram(&gMultibootProgramStruct); + } + } + else + { + GameCubeMultiBoot_Quit(); + SetSerialCallback(SerialCB); + } + return 0; + } + + return 1; +} + +void CB2_InitCopyrightScreenAfterBootup(void) +{ + if (!SetUpCopyrightScreen()) + { + SetSaveBlocksPointers(sub_815355C()); + sub_808447C(); + Save_ResetSaveCounters(); + Save_LoadGameData(SAVE_NORMAL); + if (gSaveFileStatus == 0 || gSaveFileStatus == 2) + Sav2_ClearSetDefault(); + SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound); + InitHeap(gHeap, HEAP_SIZE); + } +} + +void CB2_InitCopyrightScreenAfterTitleScreen(void) +{ + SetUpCopyrightScreen(); +} + +void Task_IntroLoadPart1Graphics(u8 taskId) +{ + SetVBlankCallback(NULL); + gUnknown_0203BCC8 = Random() & 1; + intro_reset_and_hide_bgs(); + SetGpuReg(REG_OFFSET_BG3VOFS, 0); + SetGpuReg(REG_OFFSET_BG2VOFS, 0x50); + SetGpuReg(REG_OFFSET_BG1VOFS, 0x18); + SetGpuReg(REG_OFFSET_BG0VOFS, 0x28); + LZ77UnCompVram(gIntro1BGLeavesGfx, (void *)VRAM); + LZ77UnCompVram(gIntro1BG0_Tilemap, (void *)(VRAM + 0x8000)); + DmaClear16(3, VRAM + 0x8800, 0x800); + LZ77UnCompVram(gIntro1BG1_Tilemap, (void *)(VRAM + 0x9000)); + DmaClear16(3, VRAM + 0x9800, 0x800); + LZ77UnCompVram(gIntro1BG2_Tilemap, (void *)(VRAM + 0xA000)); + DmaClear16(3, VRAM + 0xA800, 0x800); + LZ77UnCompVram(gIntro1BG3_Tilemap, (void *)(VRAM + 0xB000)); + DmaClear16(3, VRAM + 0xB800, 0x800); + LoadPalette(gIntro1BGPals, 0, sizeof(gIntro1BGPals)); + SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(22) | BGCNT_16COLOR | BGCNT_TXT256x512); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(20) | BGCNT_16COLOR | BGCNT_TXT256x512); + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(18) | BGCNT_16COLOR | BGCNT_TXT256x512); + SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(16) | BGCNT_16COLOR | BGCNT_TXT256x512); + LoadCompressedObjectPic(gUnknown_085E4FDC); + LoadCompressedObjectPic(gUnknown_085E4FEC); + LoadSpritePalettes(gUnknown_085E4FFC); + LoadCompressedObjectPic(gUnknown_085E4A74); + LoadSpritePalettes(gUnknown_085E4A84); + CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1F0, 0x20); + CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1E1, 0x1E); + CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1D2, 0x1C); + CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1C3, 0x1A); + CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1B4, 0x18); + CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1A5, 0x16); + CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x196, 0x14); + sub_816FDB8(0x78, 0x50, 0); + gTasks[taskId].data[0] = CreateWaterDrop(236, -14, 0x200, 1, 0x78, FALSE); + gTasks[taskId].func = Task_IntroFadeIn; +} + +void Task_IntroFadeIn(u8 taskId) +{ + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + SetVBlankCallback(VBlankCB_Intro); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON); + gTasks[taskId].func = Task_IntroWaterDrops; + gIntroFrameCounter = 0; + m4aSongNumStart(MUS_DEMO1); + ResetSerial(); +} + +void Task_IntroWaterDrops(u8 taskId) +{ + //start moving rock + if (gIntroFrameCounter == 76) + gSprites[gTasks[taskId].data[0]].data[0] = 1; + + if (gIntroFrameCounter == 128) + CreateTask(Task_IntroWaterDrops_1, 0); + + //drop rock + if (gIntroFrameCounter == 251) + gSprites[gTasks[taskId].data[0]].data[0] = 2; + + if (gIntroFrameCounter == 256) + CreateTask(Task_IntroWaterDrops_2, 0); + + if (gIntroFrameCounter == 368) + CreateWaterDrop(48, 0, 0x400, 5, 0x70, TRUE); + + if (gIntroFrameCounter == 384) + CreateWaterDrop(200, 60, 0x400, 9, 0x80, TRUE); + + if (gIntroFrameCounter == 560) + CreateTask(Task_IntroWaterDrops_3, 0); + + if (gIntroFrameCounter > 560) + { + gTasks[taskId].data[1] = 0x50; + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3] = 0x18; + gTasks[taskId].data[4] = 0; + gTasks[taskId].data[5] = 0x28; + gTasks[taskId].data[6] = 0; + gTasks[taskId].func = Task_IntroScrollDownAndShowFlygon; + } +} + +void Task_IntroWaterDrops_3(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + if (++data[2] & 1) + data[3]++; + + switch (data[0]) + { + case 0: + CreateSprite(gUnknown_085E4AB8, gUnknown_085E4AD0[data[4]][0], gUnknown_085E4AD0[data[4]][1] + data[3], 0); + data[0]++; + data[1] = 0xC; + data[4]++; + break; + case 1: + if (!--data[1]) + data[0] = 0; + break; + } + + if (data[3] > 0x3C) + DestroyTask(taskId); +} + +void sub_816D338(struct Sprite *sprite) +{ + if (++sprite->data[0] == 0xC) + DestroySprite(sprite); +} + +void Task_IntroScrollDownAndShowFlygon(u8 taskId) +{ + if (gIntroFrameCounter < 904) + { + s32 r2; + + //slide backgrounds downward + r2 = (gTasks[taskId].data[1] << 16) + (u16)gTasks[taskId].data[2]; + r2 -= 0x6000; + gTasks[taskId].data[1] = r2 >> 16; + gTasks[taskId].data[2] = r2; + SetGpuReg(REG_OFFSET_BG2VOFS, gTasks[taskId].data[1]); + r2 = (gTasks[taskId].data[3] << 16) + (u16)gTasks[taskId].data[4]; + r2 -= 0x8000; + gTasks[taskId].data[3] = r2 >> 16; + gTasks[taskId].data[4] = r2; + SetGpuReg(REG_OFFSET_BG1VOFS, gTasks[taskId].data[3]); + r2 = (gTasks[taskId].data[5] << 16) + (u16)gTasks[taskId].data[6]; + r2 -= 0xC000; + gTasks[taskId].data[5] = r2 >> 16; + gTasks[taskId].data[6] = r2; + SetGpuReg(REG_OFFSET_BG0VOFS, gTasks[taskId].data[5]); + + //show Flygon sprite + if (gIntroFrameCounter == 832) + { + u8 spriteId = CreateSprite(gUnknown_085E4FC4, 120, 160, 10); + gSprites[spriteId].invisible = TRUE; + } + } + else + { + //fade to white + if (gIntroFrameCounter > 1007) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0xFFFF); + gTasks[taskId].func = Task_IntroWaitToSetupPart2; + } + } +} + +void Task_IntroWaitToSetupPart2(u8 taskId) +{ + if (gIntroFrameCounter > 1026) + gTasks[taskId].func = Task_IntroLoadPart2Graphics; +} + +void Task_IntroLoadPart2Graphics(u8 taskId) +{ + intro_reset_and_hide_bgs(); + SetVBlankCallback(NULL); + ResetSpriteData(); + FreeAllSpritePalettes(); + gUnknown_0203BD24 = 0; + gUnknown_0203BD26 = 0; + gUnknown_0203BCCC = 0; + load_intro_part2_graphics(1); + gTasks[taskId].func = Task_IntroStartBikeRide; +} + +void Task_IntroStartBikeRide(u8 taskId) +{ + u8 spriteId; + + if (gUnknown_0203BCC8 == 0) + LoadCompressedObjectPic(gIntro2BrendanSpriteSheet); + else + LoadCompressedObjectPic(gIntro2MaySpriteSheet); + + LoadCompressedObjectPic(gIntro2BicycleSpriteSheet); + LoadCompressedObjectPic(gIntro2FlygonSpriteSheet); + + for (spriteId = 0; spriteId < 3; spriteId++) + { + LoadCompressedObjectPic(&gUnknown_085E4AE8[spriteId]); + } + + LoadSpritePalettes(gUnknown_085F530C); + LoadSpritePalettes(gUnknown_085E4B08); + CreateSprite(gUnknown_085E4BDC, 0x110, 0x80, 0); + CreateSprite(gUnknown_085E4BA4, 0x120, 0x6E, 1); + + if (gUnknown_0203BCC8 == 0) + spriteId = intro_create_brendan_sprite(0x110, 100); + else + spriteId = intro_create_may_sprite(0x110, 100); + + gSprites[spriteId].callback = sub_816F9D4; + gSprites[spriteId].anims = gUnknown_085E4DC4; + gTasks[taskId].data[1] = spriteId; + CreateSprite(gUnknown_085E4B40, 0x110, 0x50, 0x4); + spriteId = intro_create_flygon_sprite(-0x40, 0x3C); + gSprites[spriteId].callback = sub_816FAB0; + gTasks[taskId].data[2] = spriteId; + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0xFFFF); + SetVBlankCallback(VBlankCB_Intro); + gTasks[taskId].data[0] = sub_817B3DC(1, 0x4000, 0x400, 0x10); + sub_817B150(1); + gTasks[taskId].func = Task_IntroHandleBikeAndFlygonMovement; +} + +void Task_IntroHandleBikeAndFlygonMovement(u8 taskId) +{ + s16 a; + u16 sine; + + if (gIntroFrameCounter == 1856) + { + gUnknown_0203BD28 = 2; + DestroyTask(gTasks[taskId].data[0]); + } + if (gIntroFrameCounter > 1946) + { + BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 16, 0xFFFF); + gTasks[taskId].func = Task_IntroWaitToSetupPart3; + } + if (gIntroFrameCounter == 1109) + gSprites[gTasks[taskId].data[1]].data[0] = 1; + if (gIntroFrameCounter == 1214) + gSprites[gTasks[taskId].data[1]].data[0] = 0; + if (gIntroFrameCounter == 1394) + gSprites[gTasks[taskId].data[2]].data[0] = 1; + if (gIntroFrameCounter == 1398) + gSprites[gTasks[taskId].data[1]].data[0] = 2; + if (gIntroFrameCounter == 1576) + gSprites[gTasks[taskId].data[1]].data[0] = 3; + if (gIntroFrameCounter == 1727) + gSprites[gTasks[taskId].data[1]].data[0] = 4; + + sine = Sin(gTasks[taskId].data[3] >> 2 & 0x7F, 48); + gUnknown_0203BCCC = sine; + if (gTasks[taskId].data[3] < 512) + gTasks[taskId].data[3]++; + sub_817B540(0); +} + +void Task_IntroWaitToSetupPart3(u8 taskId) +{ + if (gIntroFrameCounter > 2068) + gTasks[taskId].func = Task_IntroLoadPart3Graphics; +} + +void sub_816D81C(struct Sprite *sprite) +{ + sprite->data[3] += 4; + switch (sprite->data[0]) + { + case 0: + if (++sprite->data[1] < 180) + break; + ++sprite->data[0]; + case 1: + sprite->pos1.x -= 4; + if (sprite->pos1.x == 0x3C) + { + sprite->data[0] = 8; + sprite->data[1] = 20; + sprite->data[2] = 2; + } + break; + case 2: + sprite->pos1.x += 8; + sprite->pos1.y -= 2; + if (sprite->pos1.x == 0x7C) + { + sprite->data[0] = 8; + sprite->data[1] = 20; + sprite->data[2] = 3; + } + break; + case 3: + sprite->pos1.y += 4; + if (sprite->pos1.y == 0x50) + { + sprite->data[0] = 8; + sprite->data[1] = 10; + sprite->data[2] = 4; + } + break; + case 4: + sprite->pos1.x -= 8; + sprite->pos1.y -= 2; + if (sprite->pos1.x == 0x3C) + { + sprite->data[0] = 8; + sprite->data[1] = 10; + sprite->data[2] = 5; + } + break; + case 5: + sprite->pos1.x += 0x3C; + sprite->data[4] = 0xC0; + sprite->data[5] = 0x80; + sprite->data[6] = 0x3; + sprite->data[0]++; + case 6: + sprite->pos2.x = Sin((u8)sprite->data[4], 0x3C); + sprite->pos2.y = Sin((u8)sprite->data[5], 0x14); + sprite->data[4] += 2; + sprite->data[5] += 4; + if ((sprite->data[4] & 0xFF) == 0x40) + { + sprite->hFlip = FALSE; + if (!--sprite->data[6]) + { + sprite->pos1.x += sprite->pos2.x; + sprite->pos2.x = 0; + sprite->data[0]++; + } + } + break; + case 7: + sprite->pos1.x -= 2; + sprite->pos2.y = Sin((u8)sprite->data[5], 0x14); + sprite->data[5] += 4; + if (sprite->pos1.x < -16) + DestroySprite(sprite); + break; + case 8: + sprite->pos2.y = Cos((u8)sprite->data[3], 2); + if (!--sprite->data[1]) + sprite->data[0] = sprite->data[2]; + break; + } +} + +void sub_816D9C0(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + if (gIntroFrameCounter == 1224) + { + StartSpriteAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 1: + if (gIntroFrameCounter == 1576) + { + StartSpriteAnim(sprite, 0); + sprite->data[0]++; + } + else + { + sprite->data[1] += 0x40; + if (sprite->data[1] & 0xFF00) + { + sprite->pos1.x--; + sprite->data[1] &= 0xFF; + } + } + break; + case 2: + if (gIntroFrameCounter != 1735) + { + sprite->data[1] += 0x20; + if (sprite->data[1] & 0xFF00) + { + sprite->pos1.x++; + sprite->data[1] &= 0xFF; + } + } + else + { + StartSpriteAnim(sprite, 1); + sprite->data[0]++; + sprite->data[2] = 0x50; + } + break; + case 3: + if (--sprite->data[2]) + { + sprite->data[1] += 0x40; + if (sprite->data[1] & 0xFF00) + { + sprite->pos1.x--; + sprite->data[1] &= 0xFF; + } + } + else + { + StartSpriteAnim(sprite, 2); + sprite->data[0]++; + } + break; + case 4: + if (sprite->animEnded) + sprite->pos1.x += 4; + + if (sprite->pos1.x > 336) + { + StartSpriteAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 5: + if (gIntroFrameCounter > 1855) + sprite->pos1.x -= 2; + break; + } +} + +void sub_816DAE8(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + if (gIntroFrameCounter == 1088) + sprite->data[0]++; + break; + case 1: + sprite->pos1.x -= 2; + if (gIntroFrameCounter != 1168) + break; + sprite->pos1.y -= 12; + sprite->data[1] = 0x80; + sprite->data[2] = 0; + sprite->data[0]++; + case 2: + if (sprite->pos1.x + sprite->pos2.x <= -0x20) + { + DestroySprite(sprite); + } + else + { + if ((sprite->data[1] & 0xFF) < 0x40) + { + sprite->pos2.x = Sin((u8)sprite->data[1], 0x10); + } + else + { + if ((sprite->data[1] & 0xFF) == 0x40) + sprite->pos1.x -= 0x30; + sprite->pos2.x = Sin((u8)sprite->data[1], 0x40); + } + sprite->data[1]++; + sprite->pos2.y = Cos((u8)sprite->data[2], 0xC); + sprite->data[2]++; + } + break; + } +} + +void Task_IntroLoadPart3Graphics(u8 taskId) +{ + intro_reset_and_hide_bgs(); + LZ77UnCompVram(gIntro3Pokeball_Gfx, (void *)VRAM); + LZ77UnCompVram(gIntro3Pokeball_Tilemap, (void *)(VRAM + 0x4000)); + LoadPalette(gIntro3PokeballPal, 0, 0x200); + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3] = 0; + sub_816F2A8(0x78, 0x50, 0, 0); + ResetSpriteData(); + FreeAllSpritePalettes(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0xFFFF); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(8) | BGCNT_256COLOR | BGCNT_AFF256x256); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG2_ON | DISPCNT_OBJ_ON); + gTasks[taskId].func = Task_IntroSpinAndZoomPokeball; + gIntroFrameCounter = 0; + m4aSongNumStart(MUS_T_BATTLE); +} + +void Task_IntroSpinAndZoomPokeball(u8 taskId) +{ + gTasks[taskId].data[0] += 0x400; + + if (gTasks[taskId].data[1] <= 0x6BF) + { + gTasks[taskId].data[1] += gTasks[taskId].data[2]; + gTasks[taskId].data[2] += 2; + } + else + { + gTasks[taskId].func = Task_IntroWaitToSetupPart3LegendsFight; + } + + sub_816F2A8(0x78, 0x50, 0x10000 / gTasks[taskId].data[1], gTasks[taskId].data[0]); + + if (gIntroFrameCounter == 28) + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0xFFFF); +} + +void Task_IntroWaitToSetupPart3LegendsFight(u8 taskId) +{ + if (gIntroFrameCounter > 43) + gTasks[taskId].func = Task_IntroLoadPart1Graphics3; +} + +void Task_IntroLoadPart1Graphics3(u8 taskId) +{ + u16 i; + + if (!gPaletteFade.active) + { + intro_reset_and_hide_bgs(); + ResetSpriteData(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 8; + LZDecompressVram(gIntro3GroudonGfx, (void *)VRAM); + LZDecompressVram(gIntro3GroudonTilemap, (void *)(VRAM + 0xC000)); + LZDecompressVram(gIntro3LegendBgGfx, (void *)(VRAM + 0x4000)); + LZDecompressVram(gIntro3GroudonBgTilemap, (void *)(VRAM + 0xE000)); + LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[0x3A]); + LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[0x3A]); + CpuCopy16(gIntro3BgPal, gPlttBufferUnfaded, sizeof(gIntro3BgPal)); + gTasks[taskId].func = Task_IntroLoadPart1Graphics4; + } +} + +void Task_IntroLoadPart1Graphics4(u8 taskId) +{ + SetGpuReg(REG_OFFSET_WIN0H, 0xF0); + SetGpuReg(REG_OFFSET_WIN0V, 0xA0); + SetGpuReg(REG_OFFSET_WININ, 0x3F); + SetGpuReg(REG_OFFSET_WINOUT, 0); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(0) + | BGCNT_CHARBASE(0) + | BGCNT_SCREENBASE(24) + | BGCNT_256COLOR + | BGCNT_WRAP + | BGCNT_AFF512x512); + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) + | BGCNT_CHARBASE(1) + | BGCNT_SCREENBASE(28) + | BGCNT_16COLOR + | BGCNT_TXT256x256); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 + | DISPCNT_OBJ_1D_MAP + | DISPCNT_BG1_ON + | DISPCNT_BG2_ON + | DISPCNT_OBJ_ON + | DISPCNT_WIN0_ON); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0xFFFF); + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0xFFA0; + gTasks[taskId].data[2] = 0xFF51; + gTasks[taskId].data[3] = 0x100; + sub_816F2A8(0xFFA0, 0xFF51, 0x100, 0); + gTasks[taskId].func = Task_IntroLoadPart1Graphics5; +} + +void Task_IntroLoadPart1Graphics5(u8 taskId) +{ + u16 foo = gTasks[taskId].data[0]; + + if (gTasks[taskId].data[0] != 32) + { + gTasks[taskId].data[0] += 4; + SetGpuReg(REG_OFFSET_WIN0V, (gTasks[taskId].data[0] * 256) - (foo -= 0x9C)); + } + else + { + SetGpuReg(REG_OFFSET_WIN0V, 0x2080); + gTasks[taskId].func = Task_IntroLoadPart1Graphics6; + } +} + +void Task_IntroLoadPart1Graphics6(u8 taskId) +{ + gTasks[taskId].func = Task_IntroLoadPart1Graphics7; +} + +void Task_IntroLoadPart1Graphics7(u8 taskId) +{ + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = Task_IntroLoadPart1Graphics8; + ScanlineEffect_InitWave(0, 0xA0, 0x4, 4, 1, 4, 0); +} + +void Task_IntroLoadPart1Graphics8(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + data[5]++; + if ((u16)(data[0] - 1) < 7 && data[5] % 2 == 0) + data[4] ^= 3; + sub_816F2A8(data[1], data[2] + data[4], data[3], 0); + switch (data[0]) + { + case 0: + data[1] += 0x10; + if (data[1] == 0xA0) + { + data[0]++; + data[6] = 2; + data[7] = 0x1E2; + sub_816E190(taskId); + } + break; + case 1: + if (--data[6] == 0) + { + data[6] = 2; + CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[31], sizeof(u16)); + data[7] += 2; + if (data[7] == 0x1EC) + data[0]++; + } + break; + case 2: + if (--data[6] == 0) + { + data[6] = 2; + data[0]++; + } + break; + case 3: + if (--data[6] == 0) + { + data[6] = 2; + CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[31], sizeof(u16)); + data[7] -= 2; + if (data[7] == 0x1E0) + { + data[6] = 8; + data[0]++; + } + } + break; + case 4: + if (--data[6] == 0) + { + data[1] = -0x60; + data[2] = 0xA9; + data[6] = 3; + data[0]++; + } + break; + case 5: + if (--data[6] == 0) + { + data[1] = 0x50; + data[2] = 0x29; + data[6] = 0x10; + PlayCryInternal(SPECIES_GROUDON, 0, 100, 10, 0); + data[0]++; + } + break; + case 6: + if (--data[6] == 0) + { + data[1] = 0x50; + data[2] = 0x28; + data[0]++; + } + break; + case 7: + data[1] += 4; + data[2] += 4; + data[6] += 0x666; + data[3] = Sin((data[6] & 0xFF00) >> 8, 0x40) + 0x100; + if (data[1] == 0x78) + { + BeginNormalPaletteFade(0xFFFFFFFE, 3, 0, 16, 0x7FFF); + data[3] = 0x100; + data[4] = 0; + data[0]++; + } + break; + case 8: + if (data[3]) + data[3] -= 8; + else + data[0]++; + break; + case 9: + if (!gPaletteFade.active) + { + gTasks[taskId].func = Task_IntroLoadPart1Graphics9; + gScanlineEffect.state = 3; + } + break; + } +} + +void sub_816E190(u8 a0) +{ + int i; + u8 spriteId; + + for (i = 0; i < 6; i++) + { + spriteId = CreateSprite(gUnknown_08596C10, gUnknown_085E4C64[i][0], 0xA0, i); + gSprites[spriteId].callback = sub_816E1F8; + gSprites[spriteId].oam.priority = 0; + gSprites[spriteId].data[1] = i; + gSprites[spriteId].data[4] = a0; + StartSpriteAnim(&gSprites[spriteId], gUnknown_085E4C64[i][1]); + } +} + +void sub_816E1F8(struct Sprite *sprite) +{ + sprite->data[3]++; + if (sprite->data[3] % 2 == 0) + sprite->pos2.y ^= 3; + + switch(sprite->data[0]) + { + case 0: + sprite->data[2] += gUnknown_085E4C64[sprite->data[1]][2]; + sprite->pos1.y -= (sprite->data[2] & 0xFF00) >> 8; + sprite->data[2] &= 0xFF; + if (gTasks[sprite->data[4]].data[0] > 7) + sprite->data[0]++; + break; + case 1: + if (sprite->pos1.x < 0x78) + sprite->pos1.x -= 2; + else + sprite->pos1.x += 2; + + if (sprite->pos1.y < 0x50) + sprite->pos1.y -= 2; + else + sprite->pos1.y += 2; + break; + } +} + +void Task_IntroLoadPart1Graphics9(u8 taskId) +{ + ResetSpriteData(); + LZDecompressVram(gIntro3KyogreGfx, (void *)VRAM); + LZDecompressVram(gIntro3KyogreTilemap, (void *)(VRAM + 0xC000)); + LZDecompressVram(gIntro3KyogreBgTilemap, (void *)(VRAM + 0xE000)); + LoadCompressedObjectPic(gUnknown_085E4C88); + LoadSpritePalette(gUnknown_085E4C98); + BeginNormalPaletteFade(0xFFFFFFFE, 0, 0x10, 0, 0xFFFF); + gTasks[taskId].func = Task_IntroFadeIn0; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0x150; + gTasks[taskId].data[2] = 0x50; + gTasks[taskId].data[6] = 0x10; + gTasks[taskId].data[3] = 0x100; + sub_816F2A8(0x150, 0x50, 0x100, 0); + ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, 6, 0); +} + +void Task_IntroFadeIn0(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + sub_816F2A8(data[1], data[2], data[3], 0); + + switch (data[0]) + { + case 0: + if (--data[6] != 0) + break; + data[0]++; + case 1: + data[6] += 4; + gTasks[taskId].data[1] = 0x158 - Sin(data[6], 0x100); + gTasks[taskId].data[2] = 0x54 - Cos(data[6], 0x40); + if (data[6] == 0x40) + { + data[6] = 0x19; + data[7] = 1; + data[0]++; + sub_816E6D4(0); + } + break; + case 2: + if (--data[6] == 0) + { + gTasks[taskId].data[1] += 0x100; + gTasks[taskId].data[2] -= 0x102; + data[6] = 8; + data[0]++; + sub_816E6D4(0); + sub_816E74C(); + } + break; + case 3: + if (--data[6] == 0) + { + gTasks[taskId].data[1] -= 0x100; + gTasks[taskId].data[2] += 0x102; + data[6] = 8; + data[0]++; + } + break; + case 4: + if (--data[6] == 0) + { + gTasks[taskId].data[2] -= 0xFC; + data[6] = 8; + data[0]++; + } + break; + case 5: + if (--data[6] == 0) + { + gTasks[taskId].data[2] += 0xFC; + if (data[7] != 0) + { + data[6] = 12; + data[7]--; + data[0] = 2; + } + else + { + data[6] = 1; + data[0]++; + PlayCryInternal(SPECIES_KYOGRE, 0, 120, 10, 0); + } + } + break; + case 6: + if (--data[6] == 0) + { + data[6] = 4; + data[7] = 0x1EA; + data[0]++; + } + break; + case 7: + if (--data[6] == 0) + { + data[6] = 4; + CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[47], sizeof(u16)); + data[7] -= 2; + if (data[7] == 0x1E0) + data[0]++; + } + break; + case 8: + if (--data[6] == 0) + { + data[6] = 4; + data[7] = 0x1E2; + data[0]++; + } + break; + case 9: + if (--data[6] == 0) + { + data[6] = 4; + CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[47], sizeof(u16)); + data[7] += 2; + if (data[7] == 0x1EE) + { + data[6] = 0x10; + data[0]++; + } + } + break; + case 10: + if (--data[6] == 0) + { + data[6] = 0; + data[0]++; + sub_816E6D4(taskId); + } + break; + case 11: + data[6] += 4; + data[3] -= 8; + gTasks[taskId].data[1] = Sin(data[6], 0x3C) + 0x58; + if (data[6] == 0x40) + { + BeginNormalPaletteFade(0xFFFFFFFE, 3, 0, 16, 0x7FFF); + data[0]++; + } + break; + case 12: + data[6] += 4; + data[3] -= 8; + gTasks[taskId].data[1] = Sin(data[6], 0x14) + 0x80; + if (data[6] == 0x80) + data[0]++; + break; + case 13: + if (!gPaletteFade.active) + { + gTasks[taskId].func = Task_IntroFadeIn1; + gScanlineEffect.state = 3; + } + break; + } +} + +void sub_816E6D4(u8 a0) +{ + int i; + u8 spriteId; + + for (i = 0; i < 6; i++) + { + spriteId = CreateSprite(gUnknown_085E4D14, gUnknown_085E4CA8[i][0], gUnknown_085E4CA8[i][1], i); + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].data[5] = a0; + gSprites[spriteId].data[6] = gUnknown_085E4CA8[i][2]; + gSprites[spriteId].data[7] = 0x40; + } +} + +void sub_816E74C(void) +{ + int i; + u8 spriteId; + + for (i = 0; i < 6; i++) + { + spriteId = CreateSprite(gUnknown_085E4D14, gUnknown_085E4CA8[i + 6][0], gUnknown_085E4CA8[i + 6][1], i); + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].data[6] = gUnknown_085E4CA8[i][2]; + gSprites[spriteId].data[7] = 0x40; + } +} + +void sub_816E7B4(struct Sprite *sprite) +{ + switch(sprite->data[0]) + { + case 0: + if (sprite->data[6] == 0) + { + sprite->data[1] = (sprite->data[1] + 11) & 0xFF; + sprite->pos2.x = Sin(sprite->data[1], 4); + sprite->data[2] += 0x30; + sprite->pos2.y = -(sprite->data[2] >> 8); + if (sprite->animEnded) + DestroySprite(sprite); + } + else if (--sprite->data[6] == 0) + { + StartSpriteAnim(sprite, 0); + sprite->invisible = FALSE; + } + if (gTasks[sprite->data[5]].data[0] > 11) + sprite->data[0]++; + break; + case 1: + if (sprite->pos1.x < 120) + sprite->pos1.x -= 3; + else + sprite->pos1.x += 3; + + if (sprite->pos1.y < 80) + sprite->pos1.y -= 3; + else + sprite->pos1.y += 3; + if ((u16)(sprite->pos1.y - 20) > 140) + DestroySprite(sprite); + break; + } +} + +void Task_IntroFadeIn1(u8 taskId) +{ + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 + | BLDCNT_TGT1_BG1 + | BLDCNT_TGT1_BG2 + | BLDCNT_EFFECT_LIGHTEN); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(31, 31)); + SetGpuReg(REG_OFFSET_BLDY, 31); + SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) + | BGCNT_CHARBASE(0) + | BGCNT_SCREENBASE(24) + | BGCNT_16COLOR + | BGCNT_TXT512x256); + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) + | BGCNT_CHARBASE(1) + | BGCNT_SCREENBASE(26) + | BGCNT_16COLOR + | BGCNT_TXT512x256); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) + | BGCNT_CHARBASE(1) + | BGCNT_SCREENBASE(28) + | BGCNT_16COLOR + | BGCNT_TXT256x256); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 + | DISPCNT_OBJ_1D_MAP + | DISPCNT_BG0_ON + | DISPCNT_BG1_ON + | DISPCNT_BG2_ON + | DISPCNT_OBJ_ON + | DISPCNT_WIN0_ON); + SetGpuReg(REG_OFFSET_BG0HOFS, 80); + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + SetGpuReg(REG_OFFSET_BG1HOFS, -80); + SetGpuReg(REG_OFFSET_BG1VOFS, 0); + SetGpuReg(REG_OFFSET_BG2HOFS, 0); + SetGpuReg(REG_OFFSET_BG2VOFS, 0); + LZDecompressVram(gIntro3CloudsGfx, (void *)VRAM); + LZDecompressVram(gIntro3CloudsGfx, (void *)(VRAM + 0x4000)); + LZDecompressVram(gIntro3Clouds3Tilemap, (void *)(VRAM + 0xE000)); + gTasks[taskId].func = Task_IntroFadeIn2; +} + +void Task_IntroFadeIn2(u8 taskId) +{ + LZDecompressVram(gIntro3Clouds1Tilemap, (void *)(VRAM + 0xC000)); + LZDecompressVram(gIntro3Clouds2Tilemap, (void *)(VRAM + 0xD000)); + gTasks[taskId].func = Task_IntroFadeIn3; +} + +void Task_IntroFadeIn3(u8 taskId) +{ + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + gTasks[taskId].func = Task_IntroFadeIn4; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[6] = 16; +} + +void Task_IntroFadeIn4(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + SetGpuReg(REG_OFFSET_BG0HOFS, (data[6] >> 8)); + SetGpuReg(REG_OFFSET_BG1HOFS, -(data[6] >> 8)); + + switch (data[0]) + { + case 0: + if (--data[6] == 0) + { + BeginNormalPaletteFade(0xFFFFFFFE, 0, 16, 0, 0xFFFF); + data[6] = 0x5000; + data[0]++; + } + break; + case 1: + if (data[6] == 0x2800) + BeginNormalPaletteFade(0x0000FFFE, 3, 0, 16, 0x2949); + + if (data[6] != 0) + data[6] -= 0x80; + else if (!gPaletteFade.active) + gTasks[taskId].func = Task_IntroFadeIn5; + break; + } +} + +void Task_IntroFadeIn5(u8 taskId) +{ + LZDecompressVram(gIntro3RayquazaTilemap, (void *)(VRAM + 0xE000)); + LZDecompressVram(gIntro3Clouds4Tilemap, (void *)(VRAM + 0xC000)); + LZDecompressVram(gIntro3RayquazaGfx, (void *)(VRAM + 0x4000)); + LZDecompressVram(gIntro3Clouds2Gfx, (void *)VRAM); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 + | DISPCNT_OBJ_1D_MAP + | DISPCNT_BG0_ON + | DISPCNT_BG2_ON + | DISPCNT_OBJ_ON + | DISPCNT_WIN0_ON); + gTasks[taskId].func = Task_IntroFadeIn6; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[6] = 1; + gTasks[taskId].data[7] = 0; + LoadCompressedObjectPicUsingHeap(gUnknown_085E4BF4); + LoadSpritePalettes(gUnknown_085E4C04); +} + +void Task_IntroFadeIn6(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + u8 spriteId; + + switch (data[0]) + { + case 0: + if (--data[6] == 0) + { + CreateSprite(gUnknown_085E4C4C, 200, 48, 0); + spriteId = CreateSprite(gUnknown_085E4C4C, 200, 80, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + spriteId = CreateSprite(gUnknown_085E4C4C, 200, 112, 2); + StartSpriteAnim(&gSprites[spriteId], 2); + data[0]++; + data[6] = 72; + } + break; + case 1: + if (--data[6] == 0) + { + CreateSprite(gUnknown_085E4C4C, 40, 48, 0); + spriteId = CreateSprite(gUnknown_085E4C4C, 40, 80, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + spriteId = CreateSprite(gUnknown_085E4C4C, 40, 112, 2); + StartSpriteAnim(&gSprites[spriteId], 2); + data[0]++; + data[6] = 48; + } + break; + case 2: + if (--data[6] == 0) + gTasks[taskId].func = Task_IntroFadeIn7; + break; + } +} + +void sub_816EC6C(struct Sprite *sprite) +{ + if (sprite->animEnded) + sprite->invisible = TRUE; + + switch(sprite->data[0]) + { + case 0: + sprite->data[1] = 0x1C2; + sprite->data[0]++; + case 1: + CpuCopy16(&gIntro3BgPal[sprite->data[1]], &gPlttBufferFaded[93], 2); + sprite->data[1] += 2; + if (sprite->data[1] != 0x1CE) + break; + sprite->data[1] = 0x1CC; + sprite->data[2] = 4; + sprite->data[0]++; + case 2: + if (--sprite->data[2] == 0) + { + sprite->data[2] = 4; + CpuCopy16(&gIntro3BgPal[sprite->data[1]], &gPlttBufferFaded[93], 2); + sprite->data[1] -= 2; + if (sprite->data[1] == 0x1C0) + DestroySprite(sprite); + } + break; + } +} + +void Task_IntroFadeIn7(u8 taskId) +{ + u8 newTaskId; + + LoadCompressedObjectPic(gUnknown_085E5048); + LoadSpritePalettes(gUnknown_085E5058); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 + | DISPCNT_OBJ_1D_MAP + | DISPCNT_BG0_ON + | DISPCNT_BG2_ON + | DISPCNT_OBJ_ON + | DISPCNT_WIN0_ON); + gTasks[taskId].func = Task_IntroFadeIn8; + BeginNormalPaletteFade(0x0000FFDE, 0, 16, 0, 0x2949); + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0xA8; + gTasks[taskId].data[2] = -0x10; + gTasks[taskId].data[3] = -0x88; + gTasks[taskId].data[4] = -0x10; + newTaskId = CreateTask(sub_816EEA8, 0); + gTasks[newTaskId].data[4] = taskId; +} + +void Task_IntroFadeIn8(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[7] % 2 == 0) + data[6] ^= 2; + + data[7]++; + + switch(data[0]) + { + case 0: + if ((data[7] & 1) != 0) + { + data[1] -= 2; + data[2]++; + data[3] += 2; + data[4]++; + } + if (data[1] == 0x68) + { + data[0]++; + data[5] = 1; + } + break; + case 1: + data[0]++; + data[5] = 4; + break; + case 2: + data[1] += 4; + data[2] -= 2; + data[3] -= 4; + data[4] -= 2; + if (!gPaletteFade.active) + { + data[5] = 0x8C; + data[0]++; + } + break; + case 3: + if (--data[5] == 0) + gTasks[taskId].func = Task_IntroFadeIn9; + break; + } +} + +void Task_IntroFadeIn9(u8 taskId) +{ + DestroyTask(taskId); + SetMainCallback2(MainCB2_EndIntro); +} + +void sub_816EEA8(u8 taskId) +{ + u8 spriteId; + s16 *data = gTasks[taskId].data; + + data[2]++; + + switch(data[0]) + { + case 0: + if ((data[2] & 1) != 0) + { + CpuCopy16(&gIntro3BgPal[0x1A2 + data[1] * 2], &gPlttBufferFaded[94], 2); + data[1]++; + } + if (data[1] == 6) + { + data[0]++; + data[1] = 0; + data[3] = 10; + } + break; + case 1: + if (data[3] == 0) + { + if ((data[2] & 1) != 0) + { + CpuCopy16(&gIntro3BgPal[0x1A2 + data[1] * 2], &gPlttBufferFaded[88], 2); + data[1]++; + } + if (data[1] == 6) + { + data[0]++; + data[3] = 10; + } + } + else + { + data[3]--; + } + break; + case 2: + if (data[3] == 0) + { + if ((data[2] & 1) != 0) + { + CpuCopy16(&gIntro3BgPal[0x182 + data[1] * 2], &gPlttBufferFaded[92], 2); + data[1]++; + } + if (data[1] == 6) + { + spriteId = CreateSprite(gUnknown_085E5030, 120, 88, 15); + PlaySE(SE_OP_BASYU); + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].data[3] = data[4]; + data[0]++; + data[3] = 16; + } + } + else + { + data[3]--; + } + break; + case 3: + if ((data[2] & 1) != 0) + { + if (--data[3] != 0) + { + BlendPalette(0x50, 16, data[3], 0x2949); + CpuCopy16(&gIntro3BgPal[0x1AC], &gPlttBufferFaded[94], 2); + CpuCopy16(&gIntro3BgPal[0x1AC], &gPlttBufferFaded[88], 2); + CpuCopy16(&gIntro3BgPal[0x18C], &gPlttBufferFaded[92], 2); + } + else + { + data[0]++; + data[3] = 53; + } + } + break; + case 4: + if (--data[3] == 0) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0x7FFF); + data[0]++; + } + break; + case 5: + if (!gPaletteFade.active) + DestroyTask(taskId); + break; + } +} + +void intro_reset_and_hide_bgs(void) +{ + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetGpuReg(REG_OFFSET_BG3HOFS, 0); + SetGpuReg(REG_OFFSET_BG3VOFS, 0); + SetGpuReg(REG_OFFSET_BG2HOFS, 0); + SetGpuReg(REG_OFFSET_BG2VOFS, 0); + SetGpuReg(REG_OFFSET_BG1HOFS, 0); + SetGpuReg(REG_OFFSET_BG1VOFS, 0); + SetGpuReg(REG_OFFSET_BG0HOFS, 0); + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); +} + +void Task_IntroWaterDrops_1(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + default: + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND + | BLDCNT_TGT2_BG0 + | BLDCNT_TGT2_BG1 + | BLDCNT_TGT2_BG2 + | BLDCNT_TGT2_BG3 + | BLDCNT_TGT2_OBJ + | BLDCNT_TGT2_BD); + SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[31]); + SetGpuReg(REG_OFFSET_BLDY, 0); + gTasks[taskId].data[1] = 0x40; + gTasks[taskId].data[0]++; + break; + case 1: + if (gTasks[taskId].data[1] != 0) + { + u8 tmp; + + gTasks[taskId].data[1]--; + tmp = gTasks[taskId].data[1] / 2; + SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[tmp]); + } + else + { + SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[0]); + gTasks[taskId].data[1] = 0x10; + gTasks[taskId].data[0]++; + } + break; + case 2: + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + DestroyTask(taskId); + break; + } +} + +void Task_IntroWaterDrops_2(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + default: + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND + | BLDCNT_TGT2_BG0 + | BLDCNT_TGT2_BG1 + | BLDCNT_TGT2_BG2 + | BLDCNT_TGT2_BG3 + | BLDCNT_TGT2_OBJ + | BLDCNT_TGT2_BD); + SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[0]); + SetGpuReg(REG_OFFSET_BLDY, 0); + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[0]++; + break; + case 1: + if (gTasks[taskId].data[1] < 62) + { + u8 tmp; + + gTasks[taskId].data[1]++; + tmp = gTasks[taskId].data[1] / 2; + SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[tmp]); + } + else + { + SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[31]); + gTasks[taskId].data[1] = 0x10; + gTasks[taskId].data[0]++; + } + break; + case 2: + if (gTasks[taskId].data[1] != 0) + { + gTasks[taskId].data[1]--; + } + else + { + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + DestroyTask(taskId); + } + break; + } +} + +void sub_816F2A8(u16 scrX, u16 scrY, u16 zoom, u16 alpha) +{ + struct BgAffineSrcData src; + struct BgAffineDstData dest; + + src.texX = 0x8000; + src.texY = 0x8000; + src.scrX = scrX; + src.scrY = scrY; + src.sx = zoom; + src.sy = zoom; + src.alpha = alpha; + BgAffineSet(&src, &dest, 1); + SetGpuReg(REG_OFFSET_BG2PA, dest.pa); + SetGpuReg(REG_OFFSET_BG2PB, dest.pb); + SetGpuReg(REG_OFFSET_BG2PC, dest.pc); + SetGpuReg(REG_OFFSET_BG2PD, dest.pd); + SetGpuReg(REG_OFFSET_BG2X_L, dest.dx); + SetGpuReg(REG_OFFSET_BG2X_H, dest.dx >> 16); + SetGpuReg(REG_OFFSET_BG2Y_L, dest.dy); + SetGpuReg(REG_OFFSET_BG2Y_H, dest.dy >> 16); +} + +void sub_816F318(struct Sprite *sprite) +{ + u8 r0; + + if (sprite->data[2] >= 192) + { + if (sprite->data[3] != 0) + { + sprite->data[3]--; + } + else + { + sprite->invisible = FALSE; + SetOamMatrix(sprite->data[1], sprite->data[2], 0, 0, sprite->data[2]); + sprite->data[2] = (sprite->data[2] * 95) / 100; + r0 = (sprite->data[2] - 192) / 128 + 9; + if (r0 > 15) + r0 = 15; + sprite->oam.paletteNum = r0; + } + } + else + { + DestroySprite(sprite); + } +} + +void sub_816F3A4(struct Sprite *sprite) +{ + if (gSprites[sprite->data[7]].data[7] != 0) + { + sprite->invisible = TRUE; + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + StartSpriteAnim(sprite, 3); + sprite->data[2] = 1024; + sprite->data[3] = 8 * (sprite->data[1] & 3); + sprite->callback = sub_816F318; + sprite->oam.shape = 1; + sprite->oam.size = 3; + CalcCenterToCornerVec(sprite, 1, 3, 2); + } + else + { + sprite->pos2.x = gSprites[sprite->data[7]].pos2.x; + sprite->pos2.y = gSprites[sprite->data[7]].pos2.y; + sprite->pos1.x = gSprites[sprite->data[7]].pos1.x; + sprite->pos1.y = gSprites[sprite->data[7]].pos1.y; + } +} + +void sub_816F454(struct Sprite *sprite) +{ + if (sprite->data[0] != 0) + sprite->callback = sub_816F46C; +} + +void sub_816F46C(struct Sprite *sprite) +{ + if (sprite->pos1.x <= 116) + { + sprite->pos1.y += sprite->pos2.y; + sprite->pos2.y = 0; + sprite->pos1.x += 4; + sprite->pos2.x = -4; + sprite->data[4] = 128; + sprite->callback = sub_816F5B4; + } + else + { + u16 data2; + u16 data3; + u16 data4; + s16 sin1; + s16 sin2; + s16 sin3; + s16 sin4; + s16 var1; + s16 var2; + s16 var3; + s16 var4; + s16 temp; + + data4 = sprite->data[4]; + sin1 = gSineTable[(u8)data4]; + sin2 = gSineTable[(u8)(data4 + 64)]; + sprite->data[4] += 2; + sprite->pos2.y = sin1 / 32; + sprite->pos1.x--; + if (sprite->pos1.x & 1) + sprite->pos1.y++; + temp = -sin2 / 16; + data2 = sprite->data[2]; + data3 = sprite->data[3]; + sin3 = gSineTable[(u8)(temp - 16)]; + sin4 = gSineTable[(u8)(temp + 48)]; + var1 = sin4 * data2 / 256; + var2 = -sin3 * data3 / 256; + var3 = sin3 * data2 / 256; + var4 = sin4 * data3 / 256; + SetOamMatrix(sprite->data[1], data2, 0, 0, data3); + SetOamMatrix(sprite->data[1] + 1, var1, var3, var2, var4); + SetOamMatrix(sprite->data[1] + 2, var1, var3, var2 * 2, var4 * 2); + } +} + +void sub_816F5B4(struct Sprite *sprite) +{ + SetOamMatrix(sprite->data[1], sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); + SetOamMatrix(sprite->data[1] + 1, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); + SetOamMatrix(sprite->data[1] + 2, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); + if (sprite->data[4] != 64) + { + u16 data4; + + sprite->data[4] -= 8; + data4 = sprite->data[4]; + sprite->pos2.x = gSineTable[(u8)(data4 + 64)] / 64; + sprite->pos2.y = gSineTable[(u8)data4] / 64; + } + else + { + sprite->data[4] = 0; + sprite->callback = sub_816F660; + } +} + +void sub_816F660(struct Sprite *sprite) +{ + if (sprite->data[0] != 2) + { + s16 r2; + + sprite->data[4] += 8; + r2 = gSineTable[(u8)sprite->data[4]] / 16 + 64; + sprite->pos2.x = gSineTable[(u8)(r2 + 64)] / 64; + sprite->pos2.y = gSineTable[(u8)r2] / 64; + } + else + { + sprite->callback = SpriteCB_WaterDropFall; + } +} + +void SpriteCB_WaterDropFall(struct Sprite *sprite) +{ + if (sprite->pos1.y < sprite->data[5]) + { + sprite->pos1.y += 4; + } + else + { + sprite->data[7] = 1; + sprite->invisible = TRUE; + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + StartSpriteAnim(sprite, 3); + sprite->data[2] = 1024; + sprite->data[3] = 8 * (sprite->data[1] & 3); + sprite->callback = sub_816F318; + sprite->oam.shape = 1; + sprite->oam.size = 3; + CalcCenterToCornerVec(sprite, 1, 3, 2); + } +} + +//Duplicate function +void SpriteCB_WaterDropFall_2(struct Sprite *sprite) +{ + if (sprite->pos1.y < sprite->data[5]) + { + sprite->pos1.y += 4; + } + else + { + sprite->data[7] = 1; + sprite->invisible = TRUE; + sprite->pos1.x += sprite->pos2.x; + sprite->pos1.y += sprite->pos2.y; + StartSpriteAnim(sprite, 3); + sprite->data[2] = 1024; + sprite->data[3] = 8 * (sprite->data[1] & 3); + sprite->callback = sub_816F318; + sprite->oam.shape = 1; + sprite->oam.size = 3; + CalcCenterToCornerVec(sprite, 1, 3, 2); + } +} + +u8 CreateWaterDrop(s16 x, s16 y, u16 c, u16 d, u16 e, u8 fallImmediately) +{ + u8 spriteId; + u8 oldSpriteId; + + spriteId = CreateSprite(&gUnknown_085E4D64, x, y, 1); + gSprites[spriteId].data[0] = 0; + gSprites[spriteId].data[7] = 0; + gSprites[spriteId].data[1] = d; + gSprites[spriteId].data[2] = c; + gSprites[spriteId].data[3] = c; + gSprites[spriteId].data[5] = e; + gSprites[spriteId].data[6] = c; + gSprites[spriteId].oam.affineMode = 3; + gSprites[spriteId].oam.matrixNum = d; + CalcCenterToCornerVec(&gSprites[spriteId], 0, 2, 2); + StartSpriteAnim(&gSprites[spriteId], 2); + if (!fallImmediately) + gSprites[spriteId].callback = sub_816F454; + else + gSprites[spriteId].callback = SpriteCB_WaterDropFall_2; + oldSpriteId = spriteId; + + spriteId = CreateSprite(&gUnknown_085E4D64, x, y, 1); + gSprites[spriteId].data[7] = oldSpriteId; + gSprites[spriteId].data[1] = d + 1; + gSprites[spriteId].oam.affineMode = 3; + gSprites[spriteId].oam.matrixNum = d + 1; + CalcCenterToCornerVec(&gSprites[spriteId], 0, 2, 2); + gSprites[spriteId].callback = sub_816F3A4; + + spriteId = CreateSprite(&gUnknown_085E4D64, x, y, 1); + gSprites[spriteId].data[7] = oldSpriteId; + gSprites[spriteId].data[1] = d + 2; + StartSpriteAnim(&gSprites[spriteId], 1); + gSprites[spriteId].oam.affineMode = 3; + gSprites[spriteId].oam.matrixNum = d + 2; + CalcCenterToCornerVec(&gSprites[spriteId], 0, 2, 2); + gSprites[spriteId].callback = sub_816F3A4; + + SetOamMatrix(d, c + 32, 0, 0, c + 32); + SetOamMatrix(d + 1, c + 32, 0, 0, c + 32); + SetOamMatrix(d + 2, c + 32, 0, 0, 2 * (c + 32)); + + return oldSpriteId; +} + +void sub_816F9D4(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + StartSpriteAnimIfDifferent(sprite, 0); + sprite->pos1.x--; + break; + case 1: + StartSpriteAnimIfDifferent(sprite, 0); + if (gIntroFrameCounter & 7) + return; + sprite->pos1.x++; + break; + case 2: + if (sprite->pos1.x <= 120 || gIntroFrameCounter & 7) + sprite->pos1.x++; + break; + case 3: + break; + case 4: + if (sprite->pos1.x > -32) + sprite->pos1.x -= 2; + break; + } + if (gIntroFrameCounter & 7) + return; + if (sprite->pos2.y != 0) + { + sprite->pos2.y = 0; + } + else + { + switch (Random() & 3) + { + case 0: + sprite->pos2.y = -1; + break; + case 1: + sprite->pos2.y = 1; + break; + case 2: + case 3: + sprite->pos2.y = 0; + break; + } + } +} + +void sub_816FAB0(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + break; + case 1: + if (sprite->pos2.x + sprite->pos1.x < 304) + sprite->pos2.x += 8; + else + sprite->data[0] = 2; + break; + case 2: + if (sprite->pos2.x + sprite->pos1.x > 120) + sprite->pos2.x -= 1; + else + sprite->data[0] = 3; + break; + case 3: + if (sprite->pos2.x > 0) + sprite->pos2.x -= 2; + break; + } + sprite->pos2.y = Sin((u8)sprite->data[1], 8) - gUnknown_0203BCCC; + sprite->data[1] += 4; +} + +void sub_816FB38(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + if (sprite->data[1] != 0) + { + sprite->data[1]--; + } + else + { + sprite->invisible = FALSE; + StartSpriteAffineAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 1: + if (gIntroFrameCounter == 0x90) + { + sprite->data[0]++; + sprite->data[1] = 9; + sprite->data[3] = 2; + } + break; + case 2: + if (sprite->data[3] == 0) + { + sprite->data[3] = 2; + if (sprite->data[1] != 0) + { + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); + sprite->data[1]--; + } + else + { + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); + sprite->data[0]++; + } + } + else + { + sprite->data[3]--; + } + break; + case 3: + if (sprite->data[3] != 0) + { + sprite->data[3]--; + } + else + { + sprite->data[3] = 2; + if (sprite->data[1] < 10) + { + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); + sprite->data[1]++; + } + else + { + sprite->data[0]++; + } + } + break; + case 4: + if (gIntroFrameCounter == 0x110) + { + StartSpriteAffineAnim(sprite, 2); + sprite->oam.objMode = 1; + sprite->data[0]++; + } + break; + case 5: + sprite->data[3] += gUnknown_085E4F48[sprite->data[2]]; + sprite->pos2.x = (sprite->data[3] & 0xFF00) >> 8; + if (sprite->data[2] < 4) + { + s16 temp = sprite->pos2.x; + sprite->pos2.x = -temp; + } + if (sprite->affineAnimEnded) + DestroySprite(sprite); + break; + } +} + +void sub_816FD44(struct Sprite *sprite) +{ + switch(sprite->data[0]) + { + case 0: + if (gIntroFrameCounter == 0x80) + { + sprite->invisible = FALSE; + sprite->data[0]++; + } + break; + case 1: + if (gIntroFrameCounter == 0x110) + { + StartSpriteAffineAnim(sprite, 3); + sprite->data[0]++; + } + break; + case 2: + if (sprite->affineAnimEnded) + DestroySprite(sprite); + break; + } +} + +u8 sub_816FDB8(s16 a0, s16 a1, s16 a2) +{ + u16 i; + u8 spriteId; + + for (i = 0; i < 9; i++) + { + spriteId = CreateSprite(gUnknown_085E4F5C, gUnknown_085E4E94[i][1] + a0, a1 - 4, 0); + gSprites[spriteId].data[0] = 0; + gSprites[spriteId].data[1] = gUnknown_085E4FA4[i]; + gSprites[spriteId].data[2] = i; + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].oam.matrixNum = i + 12; + StartSpriteAnim(&gSprites[spriteId], gUnknown_085E4E94[i][0]); + StartSpriteAffineAnim(&gSprites[spriteId], 0); + } + spriteId = CreateSprite(gUnknown_085E4F8C, 120, a1 - 6, 0); + gSprites[spriteId].data[0] = 0; + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].oam.matrixNum = i + 12; + StartSpriteAffineAnim(&gSprites[spriteId], 1); + return spriteId; +} + +/*void sub_816FEDC(struct Sprite *sprite) +{ + sprite->data[7]++; + + if (sprite->data[0] != 0) + { + s16 sin1; + s16 sin2; + s16 var1; + s16 var2; + s16 var3; + + sin1 = gSineTable[(u8)sprite->data[2]]; + sin2 = gSineTable[(u8)(sprite->data[2] + 64)]; + var1 = sin2 * sprite->data[1] / 256; + var2 = -sin1 * sprite->data[1] / 256; + var3 = sin1 * sprite->data[1] / 256; + SetOamMatrix(1, var1, var3, var2, var1); + } + + switch (sprite->data[0]) + { + case 0: + default: + sprite->oam.affineMode = 3; + sprite->oam.matrixNum = 1; + CalcCenterToCornerVec(sprite, 1, 3, 3); + sprite->invisible = FALSE; + sprite->data[0] = 1; + sprite->data[1] = 0x80; + sprite->data[2] = 0; + sprite->data[3] = 0; + break; + case 1: + sprite->pos2.x = -Sin((u8)sprite->data[3], 140); + sprite->pos2.y = -Sin((u8)sprite->data[3], 120); + sprite->data[1] += 7; + sprite->data[3] += 3; + if (sprite->pos1.x + sprite->pos2.x <= -16) + { + sprite->oam.priority = 3; + sprite->data[0]++; + sprite->pos1.x = 20; + sprite->pos1.y = 40; + sprite->data[1] = 0x200; + sprite->data[2] = 0; + sprite->data[3] = 0x10; + } + break; + case 2: + sprite->pos2.x = Sin((u8)sprite->data[3], 34); + sprite->pos2.y = -Cos((u8)sprite->data[3], 60); + sprite->data[1] += 2; + if (sprite->data[7] % 5 == 0) + sprite->data[3]++; + break; + } +}*/ diff --git a/src/main.c b/src/main.c index 3be6b91c7e..f04f9b61b8 100644 --- a/src/main.c +++ b/src/main.c @@ -166,7 +166,7 @@ static void InitMainCallbacks(void) gUnknown_0203CF5C = NULL; gMain.vblankCounter2 = 0; gMain.callback1 = NULL; - SetMainCallback2(c2_copyright_1); + SetMainCallback2(CB2_InitCopyrightScreenAfterBootup); gSaveBlock2Ptr = &gSaveblock2; gPokemonStoragePtr = &gPokemonStorage; } diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c index 22e50f4e72..8a7671c5b7 100644 --- a/src/mystery_event_menu.c +++ b/src/mystery_event_menu.c @@ -241,7 +241,7 @@ static void CB2_MysteryEventMenu(void) u16 unkVal = RunMysteryEventScript(gDecompressionBuffer); CpuFill32(0, gDecompressionBuffer, 0x7D4); if (!GetEventLoadMessage(gStringVar4, unkVal)) - TrySavingData(NORMAL_SAVE); + TrySavingData(SAVE_NORMAL); gMain.state++; } break; diff --git a/src/reset_save_heap.c b/src/reset_save_heap.c index 9950f6691f..81321b86d0 100644 --- a/src/reset_save_heap.c +++ b/src/reset_save_heap.c @@ -20,8 +20,8 @@ void sub_81700F8(void) gMain.inBattle = FALSE; SetSaveBlocksPointers(sub_815355C()); sub_808447C(); - ResetSaveCounters(); - sub_81534D0(0); + Save_ResetSaveCounters(); + Save_LoadGameData(0); if (gSaveFileStatus == 0 || gSaveFileStatus == 2) Sav2_ClearSetDefault(); SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound); diff --git a/src/save.c b/src/save.c index 8d77e801a8..8025d65867 100644 --- a/src/save.c +++ b/src/save.c @@ -3,6 +3,7 @@ #include "save.h" #include "constants/game_stat.h" #include "task.h" +#include "decompress.h" // for the chunk declarations extern struct SaveBlock2 gSaveblock2; @@ -96,7 +97,7 @@ void ClearSaveData(void) } } -void ResetSaveCounters(void) +void Save_ResetSaveCounters(void) { gSaveCounter = 0; gLastWrittenSector = 0; @@ -670,25 +671,25 @@ u8 HandleSavingData(u8 saveType) UpdateSaveAddresses(); switch (saveType) { - case HOF_DELETE_SAVE: // deletes HOF before overwriting HOF completely. unused + case SAVE_HALL_OF_FAME_ERASE_BEFORE: // deletes HOF before overwriting HOF completely. unused for (i = 0xE * 2 + 0; i < 32; i++) EraseFlashSector(i); - case HOF_SAVE: // hall of fame. + case SAVE_HALL_OF_FAME: // hall of fame. if (GetGameStat(GAME_STAT_ENTERED_HOF) < 999) IncrementGameStat(GAME_STAT_ENTERED_HOF); SaveSerializedGame(); save_write_to_flash(0xFFFF, gRamSaveSectionLocations); - tempAddr = (u8 *)0x201C000; // FIXME: make this a label. + tempAddr = gDecompressionBuffer; HandleWriteSectorNBytes(0x1C, tempAddr, 0xF80); HandleWriteSectorNBytes(0x1D, tempAddr + 0xF80, 0xF80); break; - case NORMAL_SAVE: // normal save. also called by overwriting your own save. + case SAVE_NORMAL: // normal save. also called by overwriting your own save. default: SaveSerializedGame(); save_write_to_flash(0xFFFF, gRamSaveSectionLocations); break; - case LINK_SAVE: // _081532C4 - case LINK2_SAVE: + case SAVE_LINK: // _081532C4 + case SAVE_LINK2: SaveSerializedGame(); for(i = 0; i < 5; i++) ClearSaveData_2(i, gRamSaveSectionLocations); @@ -702,7 +703,7 @@ u8 HandleSavingData(u8 saveType) save_write_to_flash(0, gRamSaveSectionLocations); break; */ - case DIFFERENT_FILE_SAVE: + case SAVE_OVERWRITE_DIFFERENT_FILE: for (i = (0xE * 2 + 0); i < 32; i++) EraseFlashSector(i); // erase HOF. SaveSerializedGame(); @@ -799,7 +800,7 @@ bool8 sub_8153474(void) return retVal; } -u8 sub_81534D0(u8 a1) +u8 Save_LoadGameData(u8 a1) { u8 result; diff --git a/sym_common.txt b/sym_common.txt index 9ec7196c23..34eb950d3b 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -155,10 +155,10 @@ gUnknown_03006294: @ 3006294 gUnknown_03006298: @ 3006298 .space 0x8 -gUnknown_030062A0: @ 30062A0 +gIntroFrameCounter: @ 30062A0 .space 0x10 -gUnknown_030062B0: @ 30062B0 +gMultibootProgramStruct: @ 30062B0 .space 0x2C gUnknown_030062DC: @ 30062DC