diff --git a/asm/frontier_pass.s b/asm/frontier_pass.s new file mode 100644 index 000000000..c9746b91f --- /dev/null +++ b/asm/frontier_pass.s @@ -0,0 +1,3520 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .syntax unified + + .text + + + + + thumb_func_start sub_80C51C4 +sub_80C51C4: @ 80C51C4 + push {lr} + bl sub_80C51F0 + ldr r0, =sub_80C544C + bl SetMainCallback2 + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C51C4 + + thumb_func_start sub_80C51D8 +sub_80C51D8: @ 80C51D8 + push {lr} + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldr r0, [r0] + bl SetMainCallback2 + bl sub_80C52E4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C51D8 + + thumb_func_start sub_80C51F0 +sub_80C51F0: @ 80C51F0 + push {r4-r6,lr} + adds r4, r0, 0 + ldr r5, =gUnknown_02039CEC + ldr r0, [r5] + cmp r0, 0 + beq _080C5204 + movs r0, 0x1 + b _080C52C8 + .pool +_080C5204: + movs r0, 0x18 + bl AllocZeroed + str r0, [r5] + cmp r0, 0 + bne _080C5214 + movs r0, 0x2 + b _080C52C8 +_080C5214: + str r4, [r0] + bl GetCurrentRegionMapSectionId + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3A + beq _080C5232 + cmp r4, 0xCA + beq _080C5232 + ldr r0, [r5] + movs r1, 0xB0 + strh r1, [r0, 0x8] + movs r1, 0x68 + strh r1, [r0, 0xA] + b _080C5240 +_080C5232: + ldr r2, =gUnknown_02039CEC + ldr r1, [r2] + movs r0, 0xB0 + strh r0, [r1, 0x8] + movs r0, 0x30 + strh r0, [r1, 0xA] + adds r5, r2, 0 +_080C5240: + ldr r1, [r5] + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r2, =0x00000eb8 + adds r0, r2 + ldrh r0, [r0] + strh r0, [r1, 0x6] + bl CanCopyRecordedBattleSaveData + ldr r3, [r5] + movs r1, 0x1 + ands r0, r1 + ldrb r2, [r3, 0xE] + movs r1, 0x2 + negs r1, r1 + ands r1, r2 + orrs r1, r0 + strb r1, [r3, 0xE] + ldr r2, [r5] + ldrb r1, [r2, 0xE] + movs r0, 0xF + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0xE] + bl CountPlayerTrainerStars + ldr r3, [r5] + lsls r0, 4 + ldrb r2, [r3, 0xE] + movs r1, 0xF + ands r1, r2 + orrs r1, r0 + strb r1, [r3, 0xE] + movs r4, 0 + adds r6, r5, 0 +_080C5286: + lsls r5, r4, 1 + ldr r1, =0x000008c4 + adds r0, r5, r1 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _080C52A2 + ldr r1, [r6] + adds r1, 0xF + adds r1, r4 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] +_080C52A2: + ldr r2, =0x000008c5 + adds r0, r5, r2 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _080C52BC + ldr r1, [r6] + adds r1, 0xF + adds r1, r4 + ldrb r0, [r1] + adds r0, 0x1 + strb r0, [r1] +_080C52BC: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x6 + bls _080C5286 + movs r0, 0 +_080C52C8: + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_80C51F0 + + thumb_func_start sub_80C52E4 +sub_80C52E4: @ 80C52E4 + push {r4,lr} + ldr r4, =gUnknown_02039CEC + ldr r0, [r4] + cmp r0, 0 + beq _080C5308 + movs r1, 0 + movs r2, 0x18 + bl memset + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] + b _080C530A + .pool +_080C5308: + movs r0, 0x1 +_080C530A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_80C52E4 + + thumb_func_start sub_80C5310 +sub_80C5310: @ 80C5310 + push {r4,lr} + ldr r4, =gUnknown_02039CF0 + ldr r0, [r4] + cmp r0, 0 + beq _080C5324 + movs r0, 0x1 + b _080C533A + .pool +_080C5324: + ldr r0, =0x00002434 + bl AllocZeroed + str r0, [r4] + cmp r0, 0 + beq _080C5338 + movs r0, 0 + b _080C533A + .pool +_080C5338: + movs r0, 0x2 +_080C533A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_80C5310 + + thumb_func_start sub_80C5340 +sub_80C5340: @ 80C5340 + push {r4,lr} + bl FreeAllWindowBuffers + ldr r4, =gUnknown_02039CF0 + ldr r0, [r4] + cmp r0, 0 + bne _080C5358 + movs r0, 0x1 + b _080C53A0 + .pool +_080C5358: + ldr r0, [r0, 0x28] + cmp r0, 0 + beq _080C5368 + bl Free + ldr r1, [r4] + movs r0, 0 + str r0, [r1, 0x28] +_080C5368: + ldr r0, [r4] + ldr r0, [r0, 0x24] + cmp r0, 0 + beq _080C537A + bl Free + ldr r1, [r4] + movs r0, 0 + str r0, [r1, 0x24] +_080C537A: + ldr r0, [r4] + ldr r0, [r0, 0x20] + cmp r0, 0 + beq _080C538C + bl Free + ldr r1, [r4] + movs r0, 0 + str r0, [r1, 0x20] +_080C538C: + ldr r0, [r4] + ldr r2, =0x00002434 + movs r1, 0 + bl memset + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] +_080C53A0: + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_80C5340 + + thumb_func_start pokemon_details +pokemon_details: @ 80C53AC + push {r4-r7,lr} + sub sp, 0x10 + ldr r0, =gUnknown_02039CF0 + ldr r6, [r0] + adds r0, r6, 0 + adds r0, 0x2C + ldrb r0, [r0] + cmp r0, 0 + beq _080C5416 + ldr r3, =gUnknown_085713E0 + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldrb r4, [r0, 0xE] + lsls r4, 28 + lsrs r0, r4, 29 + subs r0, 0x1 + lsls r0, 2 + adds r0, r3 + movs r2, 0 + ldrsh r1, [r0, r2] + lsls r1, 8 + lsrs r0, r4, 29 + subs r0, 0x1 + lsls r0, 2 + adds r5, r3, 0x2 + adds r0, r5 + movs r7, 0 + ldrsh r2, [r0, r7] + lsls r2, 8 + lsrs r0, r4, 29 + subs r0, 0x1 + lsls r0, 2 + adds r0, r3 + movs r7, 0 + ldrsh r3, [r0, r7] + lsrs r4, 29 + subs r4, 0x1 + lsls r4, 2 + adds r4, r5 + movs r5, 0 + ldrsh r0, [r4, r5] + str r0, [sp] + movs r7, 0x2E + ldrsh r0, [r6, r7] + str r0, [sp, 0x4] + movs r4, 0x30 + ldrsh r0, [r6, r4] + str r0, [sp, 0x8] + movs r0, 0 + str r0, [sp, 0xC] + movs r0, 0x2 + bl SetBgAffine +_080C5416: + bl LoadOam + bl ProcessSpriteCopyRequests + bl TransferPlttBuffer + add sp, 0x10 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end pokemon_details + + thumb_func_start sub_80C5438 +sub_80C5438: @ 80C5438 + push {lr} + bl RunTasks + bl AnimateSprites + bl BuildOamBuffer + pop {r0} + bx r0 + thumb_func_end sub_80C5438 + + thumb_func_start sub_80C544C +sub_80C544C: @ 80C544C + push {lr} + bl sub_80C5484 + cmp r0, 0 + beq _080C5464 + ldr r0, =sub_80C5A48 + movs r1, 0 + bl CreateTask + ldr r0, =sub_80C5438 + bl SetMainCallback2 +_080C5464: + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C544C + + thumb_func_start sub_80C5470 +sub_80C5470: @ 80C5470 + push {lr} + bl sub_80C570C + cmp r0, 0 + beq _080C547E + bl sub_80C51D8 +_080C547E: + pop {r0} + bx r0 + thumb_func_end sub_80C5470 + + thumb_func_start sub_80C5484 +sub_80C5484: @ 80C5484 + push {r4,r5,lr} + sub sp, 0xC + movs r0, 0 + str r0, [sp, 0x8] + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldrh r0, [r0, 0x4] + cmp r0, 0xA + bls _080C5498 + b _080C56F4 +_080C5498: + lsls r0, 2 + ldr r1, =_080C54AC + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080C54AC: + .4byte _080C54D8 + .4byte _080C54EE + .4byte _080C54F4 + .4byte _080C550A + .4byte _080C5510 + .4byte _080C5560 + .4byte _080C5570 + .4byte _080C55D0 + .4byte _080C5624 + .4byte _080C5684 + .4byte _080C56D0 +_080C54D8: + movs r0, 0 + bl SetVBlankCallback + bl ScanlineEffect_Stop + bl SetVBlankHBlankCallbacksToNull + movs r0, 0x2 + bl DisableInterrupts + b _080C56F4 +_080C54EE: + bl sub_80C50D0 + b _080C56F4 +_080C54F4: + bl ResetTasks + bl ResetSpriteData + bl FreeAllSpritePalettes + bl ResetPaletteFade + bl reset_temp_tile_data_buffers + b _080C56F4 +_080C550A: + bl sub_80C5310 + b _080C56F4 +_080C5510: + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_085713E8 + movs r0, 0x1 + movs r2, 0x3 + bl InitBgsFromTemplates + ldr r4, =gUnknown_02039CF0 + ldr r1, [r4] + adds r1, 0x32 + movs r0, 0x1 + bl SetBgTilemapBuffer + ldr r1, [r4] + ldr r0, =0x00001032 + adds r1, r0 + movs r0, 0x2 + bl SetBgTilemapBuffer + ldr r1, [r4] + ldr r0, =0x00002032 + adds r1, r0 + movs r0, 0x3 + bl SetBgTilemapBuffer + movs r0, 0x2 + movs r1, 0x6 + movs r2, 0x1 + bl SetBgAttribute + b _080C56F4 + .pool +_080C5560: + ldr r0, =gUnknown_08571400 + bl InitWindows + bl DeactivateAllTextPrinters + b _080C56F4 + .pool +_080C5570: + ldr r0, =gUnknown_085712F8 + add r1, sp, 0x8 + bl malloc_and_decompress + ldr r4, =gUnknown_02039CF0 + ldr r1, [r4] + str r0, [r1, 0x20] + ldr r0, =gUnknown_08571060 + add r1, sp, 0x8 + bl malloc_and_decompress + ldr r1, [r4] + str r0, [r1, 0x24] + ldr r0, =gUnknown_085712C0 + add r1, sp, 0x8 + bl malloc_and_decompress + ldr r1, [r4] + str r0, [r1, 0x28] + ldr r1, =gUnknown_08DE08C8 + movs r4, 0 + str r4, [sp] + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + ldr r1, =gUnknown_08DE2084 + str r4, [sp] + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + b _080C56F4 + .pool +_080C55D0: + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + cmp r0, 0 + beq _080C55DC + b _080C56FE +_080C55DC: + movs r5, 0x1E + str r5, [sp] + movs r4, 0x14 + str r4, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + b _080C56F4 +_080C5624: + ldr r4, =gUnknown_08DE07C8 + movs r2, 0xD0 + lsls r2, 1 + adds r0, r4, 0 + movs r1, 0 + bl LoadPalette + ldr r5, =gUnknown_02039CEC + ldr r0, [r5] + ldrb r0, [r0, 0xE] + lsrs r0, 4 + lsls r0, 5 + adds r4, 0x20 + adds r0, r4 + movs r1, 0x10 + movs r2, 0x20 + bl LoadPalette + movs r0, 0 + bl stdpal_get + movs r1, 0xF0 + movs r2, 0x20 + bl LoadPalette + bl sub_80C629C + ldr r1, [r5] + ldrb r0, [r1, 0xC] + ldrb r1, [r1, 0xD] + bl sub_80C6104 + ldr r5, [r5] + ldrb r0, [r5, 0xE] + movs r1, 0xE + ands r1, r0 + cmp r1, 0x2 + beq _080C5674 + cmp r1, 0x4 + bne _080C56F4 +_080C5674: + movs r0, 0 + strh r0, [r5, 0x4] + movs r0, 0x1 + b _080C5700 + .pool +_080C5684: + movs r1, 0x82 + lsls r1, 5 + movs r0, 0 + bl SetGpuReg + movs r0, 0 + bl ShowBg + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + bl sub_80C62DC + ldr r0, =pokemon_details + bl SetVBlankCallback + movs r4, 0x1 + negs r4, r4 + adds r0, r4, 0 + movs r1, 0x10 + movs r2, 0 + bl BlendPalettes + movs r0, 0 + str r0, [sp] + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + b _080C56F4 + .pool +_080C56D0: + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + bne _080C56FE + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + strh r1, [r0, 0x4] + movs r0, 0x1 + b _080C5700 + .pool +_080C56F4: + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] +_080C56FE: + movs r0, 0 +_080C5700: + add sp, 0xC + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_80C5484 + + thumb_func_start sub_80C570C +sub_80C570C: @ 80C570C + push {lr} + sub sp, 0x4 + ldr r1, =gUnknown_02039CEC + ldr r0, [r1] + ldrh r0, [r0, 0x4] + adds r2, r1, 0 + cmp r0, 0x5 + bhi _080C57E4 + lsls r0, 2 + ldr r1, =_080C5730 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080C5730: + .4byte _080C5748 + .4byte _080C5770 + .4byte _080C577C + .4byte _080C57A6 + .4byte _080C57AC + .4byte _080C57BE +_080C5748: + ldr r0, [r2] + ldrb r0, [r0, 0xE] + movs r1, 0xE + ands r1, r0 + cmp r1, 0x2 + beq _080C576A + cmp r1, 0x4 + beq _080C576A + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _080C57E4 +_080C576A: + ldr r1, [r2] + movs r0, 0x2 + b _080C57EC +_080C5770: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + beq _080C57E4 + b _080C57EE +_080C577C: + movs r0, 0 + movs r1, 0 + bl SetGpuReg + movs r0, 0 + bl HideBg + movs r0, 0x1 + bl HideBg + movs r0, 0x2 + bl HideBg + movs r0, 0 + bl SetVBlankCallback + bl ScanlineEffect_Stop + bl SetVBlankHBlankCallbacksToNull + b _080C57E4 +_080C57A6: + bl sub_80C63FC + b _080C57E4 +_080C57AC: + bl sub_80C50D0 + bl ResetTasks + bl ResetSpriteData + bl FreeAllSpritePalettes + b _080C57E4 +_080C57BE: + movs r0, 0 + bl UnsetBgTilemapBuffer + movs r0, 0x1 + bl UnsetBgTilemapBuffer + movs r0, 0x2 + bl UnsetBgTilemapBuffer + bl sub_80C5340 + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + movs r0, 0 + strh r0, [r1, 0x4] + movs r0, 0x1 + b _080C57F0 + .pool +_080C57E4: + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + ldrh r0, [r1, 0x4] + adds r0, 0x1 +_080C57EC: + strh r0, [r1, 0x4] +_080C57EE: + movs r0, 0 +_080C57F0: + add sp, 0x4 + pop {r1} + bx r1 + .pool + thumb_func_end sub_80C570C + + thumb_func_start sub_80C57FC +sub_80C57FC: @ 80C57FC + push {r4-r7,lr} + lsls r0, 16 + lsrs r6, r0, 16 + movs r4, 0 + ldr r7, =gUnknown_08571454 + lsls r1, 16 + asrs r5, r1, 16 +_080C580A: + lsls r0, r4, 3 + adds r3, r0, r7 + movs r1, 0 + ldrsh r0, [r3, r1] + cmp r0, r5 + bgt _080C5854 + movs r1, 0x2 + ldrsh r0, [r3, r1] + cmp r0, r5 + blt _080C5854 + movs r0, 0x4 + ldrsh r1, [r3, r0] + lsls r0, r6, 16 + asrs r2, r0, 16 + cmp r1, r2 + bgt _080C5854 + movs r1, 0x6 + ldrsh r0, [r3, r1] + cmp r0, r2 + blt _080C5854 + cmp r4, 0x5 + bls _080C5842 + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + adds r0, r4 + ldrb r0, [r0, 0x9] + cmp r0, 0 + beq _080C585E +_080C5842: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r0, 24 + b _080C5860 + .pool +_080C5854: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0xC + bls _080C580A +_080C585E: + movs r0, 0 +_080C5860: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_80C57FC + + thumb_func_start sub_80C5868 +sub_80C5868: @ 80C5868 + push {lr} + bl sub_80C5484 + cmp r0, 0 + beq _080C58C6 + ldr r1, =gUnknown_02039CEC + ldr r0, [r1] + ldrb r0, [r0, 0xE] + lsls r0, 28 + lsrs r0, 29 + cmp r0, 0x1 + blt _080C58AC + cmp r0, 0x2 + bgt _080C58AC + ldr r0, =sub_80C5BD8 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + movs r0, 0x1 + strh r0, [r1, 0x8] + b _080C58C0 + .pool +_080C58AC: + ldr r2, [r1] + ldrb r1, [r2, 0xE] + movs r0, 0xF + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0xE] + ldr r0, =sub_80C5A48 + movs r1, 0 + bl CreateTask +_080C58C0: + ldr r0, =sub_80C5438 + bl SetMainCallback2 +_080C58C6: + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C5868 + + thumb_func_start sub_80C58D4 +sub_80C58D4: @ 80C58D4 + push {r4,lr} + ldr r4, =gUnknown_02039CF8 + ldr r0, [r4] + bl sub_80C51F0 + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + ldrh r0, [r4, 0x4] + strh r0, [r1, 0x8] + ldrh r0, [r4, 0x6] + strh r0, [r1, 0xA] + adds r0, r4, 0 + movs r1, 0 + movs r2, 0x8 + bl memset + bl InBattlePyramid + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _080C5914 + cmp r0, 0x2 + beq _080C591C + bl Overworld_PlaySpecialMapMusic + b _080C5924 + .pool +_080C5914: + ldr r0, =0x000001cd + b _080C5920 + .pool +_080C591C: + movs r0, 0xE7 + lsls r0, 1 +_080C5920: + bl PlayBGM +_080C5924: + ldr r0, =sub_80C5868 + bl SetMainCallback2 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C58D4 + + thumb_func_start sub_80C5934 +sub_80C5934: @ 80C5934 + push {lr} + bl sub_80C570C + cmp r0, 0 + beq _080C599A + ldr r0, =gUnknown_02039CEC + ldr r2, [r0] + ldrb r0, [r2, 0xE] + lsls r0, 28 + lsrs r0, 29 + cmp r0, 0x2 + beq _080C5994 + cmp r0, 0x2 + bgt _080C595C + cmp r0, 0x1 + beq _080C5962 + b _080C599A + .pool +_080C595C: + cmp r0, 0x3 + beq _080C5970 + b _080C599A +_080C5962: + ldr r0, =sub_80C5868 + bl sub_80C6454 + b _080C599A + .pool +_080C5970: + ldr r1, =gUnknown_02039CF8 + ldr r0, [r2] + str r0, [r1] + ldrh r0, [r2, 0x8] + strh r0, [r1, 0x4] + ldrh r0, [r2, 0xA] + strh r0, [r1, 0x6] + bl sub_80C52E4 + ldr r0, =sub_80C58D4 + bl PlayRecordedBattle + b _080C599A + .pool +_080C5994: + ldr r0, =sub_80C5868 + bl ShowPlayerTrainerCard +_080C599A: + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C5934 + + thumb_func_start sub_80C59A4 +sub_80C59A4: @ 80C59A4 + push {r4,lr} + lsls r0, 24 + lsrs r3, r0, 24 + adds r4, r3, 0 + lsls r1, 24 + lsrs r1, 24 + adds r2, r1, 0 + cmp r1, 0x1 + blt _080C59CC + cmp r1, 0x2 + ble _080C59F4 + cmp r1, 0x3 + bne _080C59CC + ldr r0, =gUnknown_02039CEC + ldr r2, [r0] + ldrb r1, [r2, 0xE] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + bne _080C59D4 +_080C59CC: + movs r0, 0 + b _080C5A30 + .pool +_080C59D4: + movs r0, 0xF + negs r0, r0 + ands r0, r1 + movs r1, 0x6 + orrs r0, r1 + strb r0, [r2, 0xE] + adds r0, r3, 0 + bl DestroyTask + ldr r0, =sub_80C5934 + bl SetMainCallback2 + b _080C5A1A + .pool +_080C59F4: + ldr r0, =gUnknown_02039CEC + ldr r3, [r0] + movs r0, 0x7 + ands r2, r0 + lsls r2, 1 + ldrb r1, [r3, 0xE] + subs r0, 0x16 + ands r0, r1 + orrs r0, r2 + strb r0, [r3, 0xE] + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_80C5BD8 + str r1, [r0] + movs r1, 0 + strh r1, [r0, 0x8] +_080C5A1A: + ldr r0, =gUnknown_02039CEC + ldr r2, [r0] + ldr r0, =gUnknown_02039CF0 + ldr r1, [r0] + ldr r0, [r1] + ldrh r0, [r0, 0x20] + strh r0, [r2, 0x8] + ldr r0, [r1] + ldrh r0, [r0, 0x22] + strh r0, [r2, 0xA] + movs r0, 0x1 +_080C5A30: + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_80C59A4 + + thumb_func_start sub_80C5A48 +sub_80C5A48: @ 80C5A48 + push {r4-r7,lr} + lsls r0, 24 + lsrs r6, r0, 24 + movs r5, 0 + ldr r2, =gMain + ldrh r1, [r2, 0x2C] + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _080C5A80 + ldr r0, =gUnknown_02039CF0 + ldr r4, [r0] + ldr r1, [r4] + ldrh r3, [r1, 0x22] + movs r7, 0x22 + ldrsh r0, [r1, r7] + cmp r0, 0x8 + ble _080C5A80 + subs r0, r3, 0x2 + strh r0, [r1, 0x22] + ldr r1, [r4] + movs r3, 0x22 + ldrsh r0, [r1, r3] + cmp r0, 0x7 + bgt _080C5A7E + movs r0, 0x2 + strh r0, [r1, 0x22] +_080C5A7E: + movs r5, 0x1 +_080C5A80: + ldrh r1, [r2, 0x2C] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _080C5AAE + ldr r0, =gUnknown_02039CF0 + ldr r4, [r0] + ldr r1, [r4] + ldrh r3, [r1, 0x22] + movs r7, 0x22 + ldrsh r0, [r1, r7] + cmp r0, 0x87 + bgt _080C5AAE + adds r0, r3, 0x2 + strh r0, [r1, 0x22] + ldr r1, [r4] + movs r3, 0x22 + ldrsh r0, [r1, r3] + cmp r0, 0x88 + ble _080C5AAC + movs r0, 0x88 + strh r0, [r1, 0x22] +_080C5AAC: + movs r5, 0x1 +_080C5AAE: + ldrh r1, [r2, 0x2C] + movs r0, 0x20 + ands r0, r1 + cmp r0, 0 + beq _080C5ADC + ldr r0, =gUnknown_02039CF0 + ldr r4, [r0] + ldr r1, [r4] + ldrh r3, [r1, 0x20] + movs r7, 0x20 + ldrsh r0, [r1, r7] + cmp r0, 0x5 + ble _080C5ADC + subs r0, r3, 0x2 + strh r0, [r1, 0x20] + ldr r1, [r4] + movs r3, 0x20 + ldrsh r0, [r1, r3] + cmp r0, 0x4 + bgt _080C5ADA + movs r0, 0x5 + strh r0, [r1, 0x20] +_080C5ADA: + movs r5, 0x1 +_080C5ADC: + ldrh r1, [r2, 0x2C] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _080C5B0A + ldr r0, =gUnknown_02039CF0 + ldr r4, [r0] + ldr r1, [r4] + ldrh r3, [r1, 0x20] + movs r7, 0x20 + ldrsh r0, [r1, r7] + cmp r0, 0xE7 + bgt _080C5B0A + adds r0, r3, 0x2 + strh r0, [r1, 0x20] + ldr r1, [r4] + movs r3, 0x20 + ldrsh r0, [r1, r3] + cmp r0, 0xE8 + ble _080C5B08 + movs r0, 0xE8 + strh r0, [r1, 0x20] +_080C5B08: + movs r5, 0x1 +_080C5B0A: + cmp r5, 0 + bne _080C5B88 + ldr r4, =gUnknown_02039CEC + ldr r0, [r4] + ldrb r3, [r0, 0xC] + cmp r3, 0 + beq _080C5B5E + ldrh r1, [r2, 0x2E] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _080C5B5E + cmp r3, 0x3 + bhi _080C5B48 + movs r0, 0x5 + bl PlaySE + ldr r0, [r4] + ldrb r1, [r0, 0xC] + adds r0, r6, 0 + bl sub_80C59A4 + cmp r0, 0 + bne _080C5BCA + b _080C5B5E + .pool +_080C5B48: + cmp r3, 0x4 + bne _080C5B5E + movs r0, 0x3 + bl PlaySE + ldr r0, =sub_80C5470 + bl SetMainCallback2 + adds r0, r6, 0 + bl DestroyTask +_080C5B5E: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _080C5BCA + movs r0, 0x3 + bl PlaySE + ldr r0, =sub_80C5470 + bl SetMainCallback2 + adds r0, r6, 0 + bl DestroyTask + b _080C5BCA + .pool +_080C5B88: + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0] + ldrh r0, [r1, 0x20] + subs r0, 0x5 + lsls r0, 16 + asrs r0, 16 + ldrh r1, [r1, 0x22] + adds r1, 0x5 + lsls r1, 16 + asrs r1, 16 + bl sub_80C57FC + lsls r0, 24 + lsrs r5, r0, 24 + ldr r4, =gUnknown_02039CEC + ldr r0, [r4] + ldrb r0, [r0, 0xC] + cmp r0, r5 + beq _080C5BCA + adds r0, r5, 0 + bl sub_80C5ED0 + ldr r1, [r4] + ldrb r0, [r1, 0xC] + strb r0, [r1, 0xD] + ldr r0, [r4] + strb r5, [r0, 0xC] + ldr r1, [r4] + ldrb r0, [r1, 0xC] + ldrb r1, [r1, 0xD] + bl sub_80C6104 +_080C5BCA: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C5A48 + + thumb_func_start sub_80C5BD8 +sub_80C5BD8: @ 80C5BD8 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x4 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 2 + adds r0, r4 + lsls r5, r0, 3 + ldr r0, =gTasks + 0x8 + mov r8, r0 + adds r6, r5, r0 + ldr r7, =gUnknown_02039CEC + ldr r0, [r7] + ldrh r0, [r0, 0x4] + cmp r0, 0x1 + beq _080C5CD4 + cmp r0, 0x1 + bgt _080C5C0C + cmp r0, 0 + beq _080C5C14 + b _080C5D9C + .pool +_080C5C0C: + cmp r0, 0x2 + bne _080C5C12 + b _080C5D2A +_080C5C12: + b _080C5D9C +_080C5C14: + movs r1, 0 + ldrsh r0, [r6, r1] + cmp r0, 0 + bne _080C5C4C + movs r0, 0x1 + movs r1, 0 + bl sub_80C5F58 + movs r1, 0x80 + lsls r1, 1 + adds r0, r1, 0 + strh r0, [r6, 0x2] + strh r0, [r6, 0x4] + movs r0, 0x15 + strh r0, [r6, 0x6] + strh r0, [r6, 0x8] + movs r0, 0x1 + negs r0, r0 + ldr r1, =0x00007fff + str r1, [sp] + movs r1, 0 + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _080C5CA4 + .pool +_080C5C4C: + movs r1, 0xFE + lsls r1, 1 + adds r0, r1, 0 + strh r0, [r6, 0x2] + strh r0, [r6, 0x4] + movs r1, 0x15 + negs r1, r1 + adds r0, r1, 0 + strh r0, [r6, 0x6] + strh r0, [r6, 0x8] + movs r1, 0x82 + lsls r1, 5 + movs r0, 0 + bl SetGpuReg + movs r0, 0 + bl ShowBg + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + bl sub_80C62DC + ldr r0, =pokemon_details + bl SetVBlankCallback + movs r5, 0x1 + negs r5, r5 + ldr r4, =0x00007fff + adds r0, r5, 0 + movs r1, 0x10 + adds r2, r4, 0 + bl BlendPalettes + str r4, [sp] + adds r0, r5, 0 + movs r1, 0 + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade +_080C5CA4: + ldr r4, =gUnknown_02039CF0 + ldr r0, [r4] + adds r0, 0x2C + movs r1, 0x1 + strb r1, [r0] + movs r1, 0x2 + ldrsh r0, [r6, r1] + bl sub_8151624 + ldr r1, [r4] + strh r0, [r1, 0x2E] + movs r1, 0x4 + ldrsh r0, [r6, r1] + bl sub_8151624 + ldr r1, [r4] + strh r0, [r1, 0x30] + b _080C5D9C + .pool +_080C5CD4: + bl UpdatePaletteFade + ldrh r0, [r6, 0x6] + ldrh r1, [r6, 0x2] + adds r0, r1 + strh r0, [r6, 0x2] + ldrh r0, [r6, 0x8] + ldrh r1, [r6, 0x4] + adds r0, r1 + strh r0, [r6, 0x4] + movs r1, 0x2 + ldrsh r0, [r6, r1] + bl sub_8151624 + ldr r4, =gUnknown_02039CF0 + ldr r1, [r4] + strh r0, [r1, 0x2E] + movs r1, 0x4 + ldrsh r0, [r6, r1] + bl sub_8151624 + ldr r1, [r4] + strh r0, [r1, 0x30] + movs r1, 0 + ldrsh r0, [r6, r1] + cmp r0, 0 + bne _080C5D1C + movs r0, 0x2 + ldrsh r1, [r6, r0] + movs r0, 0xFE + lsls r0, 1 + cmp r1, r0 + ble _080C5DA6 + b _080C5D9C + .pool +_080C5D1C: + movs r0, 0x2 + ldrsh r1, [r6, r0] + movs r0, 0x80 + lsls r0, 1 + cmp r1, r0 + bne _080C5DA6 + b _080C5D9C +_080C5D2A: + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + adds r1, r0, 0 + adds r1, 0x2C + ldrb r0, [r1] + cmp r0, 0 + beq _080C5D3C + movs r0, 0 + strb r0, [r1] +_080C5D3C: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + bne _080C5DA6 + movs r1, 0 + ldrsh r0, [r6, r1] + cmp r0, 0 + bne _080C5D64 + adds r0, r4, 0 + bl DestroyTask + ldr r0, =sub_80C5934 + bl SetMainCallback2 + b _080C5D82 + .pool +_080C5D64: + movs r0, 0 + movs r1, 0 + bl sub_80C5F58 + ldr r2, [r7] + ldrb r1, [r2, 0xE] + movs r0, 0xF + negs r0, r0 + ands r0, r1 + strb r0, [r2, 0xE] + mov r0, r8 + subs r0, 0x8 + adds r0, r5, r0 + ldr r1, =sub_80C5A48 + str r1, [r0] +_080C5D82: + movs r0, 0x2 + movs r1, 0x6 + movs r2, 0 + bl SetBgAttribute + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + movs r0, 0 + b _080C5DA4 + .pool +_080C5D9C: + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + ldrh r0, [r1, 0x4] + adds r0, 0x1 +_080C5DA4: + strh r0, [r1, 0x4] +_080C5DA6: + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C5BD8 + + thumb_func_start sub_80C5DB8 +sub_80C5DB8: @ 80C5DB8 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0xC + movs r4, 0 +_080C5DC2: + adds r0, r4, 0 + bl PutWindowTilemap + adds r0, r4, 0 + movs r1, 0 + bl FillWindowPixelBuffer + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x4 + bls _080C5DC2 + ldr r4, =gText_SymbolsEarned + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x60 + bl GetStringCenterAlignXOffset + lsls r2, r0, 24 + lsrs r2, 24 + ldr r6, =gUnknown_08571448 + str r6, [sp] + movs r0, 0 + mov r8, r0 + str r0, [sp, 0x4] + str r4, [sp, 0x8] + movs r1, 0x1 + movs r3, 0x5 + bl AddTextPrinterParameterized3 + ldr r4, =gText_BattleRecord + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x60 + bl GetStringCenterAlignXOffset + lsls r2, r0, 24 + lsrs r2, 24 + str r6, [sp] + mov r1, r8 + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x1 + movs r3, 0x5 + bl AddTextPrinterParameterized3 + str r6, [sp] + mov r0, r8 + str r0, [sp, 0x4] + ldr r0, =gText_BattlePoints + str r0, [sp, 0x8] + movs r0, 0x2 + movs r1, 0x8 + movs r2, 0x5 + movs r3, 0x4 + bl AddTextPrinterParameterized3 + ldr r4, =gStringVar4 + ldr r5, =gUnknown_02039CEC + ldr r0, [r5] + ldrh r1, [r0, 0x6] + adds r0, r4, 0 + movs r2, 0 + movs r3, 0x5 + bl ConvertIntToDecimalStringN + movs r0, 0x8 + adds r1, r4, 0 + movs r2, 0x5B + bl GetStringRightAlignXOffset + lsls r2, r0, 24 + lsrs r2, 24 + str r6, [sp] + mov r1, r8 + str r1, [sp, 0x4] + str r4, [sp, 0x8] + movs r0, 0x2 + movs r1, 0x8 + movs r3, 0x10 + bl AddTextPrinterParameterized3 + ldr r1, [r5] + ldrh r0, [r1, 0x8] + subs r0, 0x5 + lsls r0, 16 + asrs r0, 16 + ldrh r1, [r1, 0xA] + adds r1, 0x5 + lsls r1, 16 + asrs r1, 16 + bl sub_80C57FC + ldr r1, [r5] + strb r0, [r1, 0xC] + ldr r0, [r5] + mov r1, r8 + strb r1, [r0, 0xD] + ldr r0, [r5] + ldrb r0, [r0, 0xC] + bl sub_80C5ED0 + movs r4, 0 +_080C5E92: + adds r0, r4, 0 + movs r1, 0x3 + bl CopyWindowToVram + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x4 + bls _080C5E92 + movs r0, 0 + bl CopyBgTilemapBufferToVram + add sp, 0xC + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C5DB8 + + thumb_func_start sub_80C5ED0 +sub_80C5ED0: @ 80C5ED0 + push {r4,lr} + sub sp, 0xC + lsls r0, 24 + lsrs r4, r0, 24 + movs r0, 0x3 + movs r1, 0 + bl FillWindowPixelBuffer + cmp r4, 0x3 + bne _080C5F18 + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldrb r0, [r0, 0xE] + movs r1, 0x1 + ands r1, r0 + cmp r1, 0 + bne _080C5F18 + ldr r0, =gUnknown_0857144B + str r0, [sp] + str r1, [sp, 0x4] + ldr r0, =gUnknown_08571614 + ldr r0, [r0] + str r0, [sp, 0x8] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0x2 + movs r3, 0 + bl AddTextPrinterParameterized3 + b _080C5F3A + .pool +_080C5F18: + cmp r4, 0 + beq _080C5F3A + ldr r0, =gUnknown_0857144B + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + ldr r1, =gUnknown_08571614 + lsls r0, r4, 2 + adds r0, r1 + ldr r0, [r0] + str r0, [sp, 0x8] + movs r0, 0x3 + movs r1, 0x1 + movs r2, 0x2 + movs r3, 0 + bl AddTextPrinterParameterized3 +_080C5F3A: + movs r0, 0x3 + movs r1, 0x3 + bl CopyWindowToVram + movs r0, 0 + bl CopyBgTilemapBufferToVram + add sp, 0xC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C5ED0 + + thumb_func_start sub_80C5F58 +sub_80C5F58: @ 80C5F58 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x10 + lsls r0, 24 + lsrs r2, r0, 24 + lsls r1, 24 + lsrs r7, r1, 24 + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldrb r0, [r0, 0xE] + lsls r0, 28 + lsrs r0, 29 + cmp r0, 0x1 + beq _080C5F80 + cmp r0, 0x2 + beq _080C5FC2 + b _080C60EE + .pool +_080C5F80: + cmp r2, 0 + beq _080C5FA8 + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0, 0x20] + movs r0, 0xC + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x10 + str r0, [sp, 0x8] + movs r0, 0x2 + movs r2, 0x10 + movs r3, 0x3 + bl CopyToBgTilemapBufferRect_ChangePalette + b _080C6004 + .pool +_080C5FA8: + movs r0, 0xC + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x10 + str r0, [sp, 0x8] + movs r0, 0x2 + movs r1, 0 + movs r2, 0x10 + movs r3, 0x3 + bl FillBgTilemapBufferRect + b _080C6004 +_080C5FC2: + cmp r2, 0 + beq _080C5FEC + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0, 0x20] + adds r1, 0x54 + movs r0, 0xC + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x10 + str r0, [sp, 0x8] + movs r0, 0x2 + movs r2, 0x10 + movs r3, 0xA + bl CopyToBgTilemapBufferRect_ChangePalette + b _080C6004 + .pool +_080C5FEC: + movs r0, 0xC + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x10 + str r0, [sp, 0x8] + movs r0, 0x2 + movs r1, 0 + movs r2, 0x10 + movs r3, 0xA + bl FillBgTilemapBufferRect +_080C6004: + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + cmp r7, 0 + beq _080C6084 + movs r4, 0xFE + lsls r4, 1 + adds r0, r4, 0 + bl sub_8151624 + adds r6, r0, 0 + lsls r6, 16 + asrs r6, 16 + adds r0, r4, 0 + bl sub_8151624 + lsls r0, 16 + asrs r0, 16 + ldr r5, =gUnknown_085713E0 + ldr r1, =gUnknown_02039CEC + ldr r1, [r1] + ldrb r4, [r1, 0xE] + lsls r4, 28 + lsrs r1, r4, 29 + subs r1, 0x1 + lsls r1, 2 + adds r1, r5 + movs r2, 0 + ldrsh r1, [r1, r2] + lsls r1, 8 + lsrs r2, r4, 29 + subs r2, 0x1 + lsls r2, 2 + adds r3, r5, 0x2 + mov r8, r3 + add r2, r8 + movs r3, 0 + ldrsh r2, [r2, r3] + lsls r2, 8 + lsrs r3, r4, 29 + subs r3, 0x1 + lsls r3, 2 + adds r3, r5 + movs r5, 0 + ldrsh r3, [r3, r5] + lsrs r4, 29 + subs r4, 0x1 + lsls r4, 2 + add r4, r8 + movs r5, 0 + ldrsh r4, [r4, r5] + str r4, [sp] + str r6, [sp, 0x4] + str r0, [sp, 0x8] + movs r0, 0 + str r0, [sp, 0xC] + movs r0, 0x2 + bl SetBgAffine + b _080C60EE + .pool +_080C6084: + movs r4, 0x80 + lsls r4, 1 + adds r0, r4, 0 + bl sub_8151624 + adds r6, r0, 0 + lsls r6, 16 + asrs r6, 16 + adds r0, r4, 0 + bl sub_8151624 + lsls r0, 16 + asrs r0, 16 + ldr r5, =gUnknown_085713E0 + ldr r1, =gUnknown_02039CEC + ldr r1, [r1] + ldrb r4, [r1, 0xE] + lsls r4, 28 + lsrs r1, r4, 29 + subs r1, 0x1 + lsls r1, 2 + adds r1, r5 + movs r2, 0 + ldrsh r1, [r1, r2] + lsls r1, 8 + lsrs r2, r4, 29 + subs r2, 0x1 + lsls r2, 2 + adds r3, r5, 0x2 + mov r8, r3 + add r2, r8 + movs r3, 0 + ldrsh r2, [r2, r3] + lsls r2, 8 + lsrs r3, r4, 29 + subs r3, 0x1 + lsls r3, 2 + adds r3, r5 + movs r5, 0 + ldrsh r3, [r3, r5] + lsrs r4, 29 + subs r4, 0x1 + lsls r4, 2 + add r4, r8 + movs r5, 0 + ldrsh r4, [r4, r5] + str r4, [sp] + str r6, [sp, 0x4] + str r0, [sp, 0x8] + str r7, [sp, 0xC] + movs r0, 0x2 + bl SetBgAffine +_080C60EE: + add sp, 0x10 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C5F58 + + thumb_func_start sub_80C6104 +sub_80C6104: @ 80C6104 + push {r4,r5,lr} + sub sp, 0xC + lsls r0, 24 + lsrs r4, r0, 24 + lsls r1, 24 + lsrs r5, r1, 24 + cmp r5, 0x2 + beq _080C614C + cmp r5, 0x2 + bgt _080C611E + cmp r5, 0x1 + beq _080C6128 + b _080C61C4 +_080C611E: + cmp r5, 0x3 + beq _080C6170 + cmp r5, 0x4 + beq _080C61A4 + b _080C61C4 +_080C6128: + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0, 0x24] + movs r0, 0xC + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r2, 0x10 + movs r3, 0x3 + bl CopyToBgTilemapBufferRect_ChangePalette + b _080C61CE + .pool +_080C614C: + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0, 0x24] + movs r0, 0xA8 + lsls r0, 1 + adds r1, r0 + movs r0, 0xC + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r2, 0x10 + b _080C6192 + .pool +_080C6170: + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldrb r1, [r0, 0xE] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _080C61C4 + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0, 0x28] + movs r0, 0xC + str r0, [sp] + str r5, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r2, 0x2 +_080C6192: + movs r3, 0xA + bl CopyToBgTilemapBufferRect_ChangePalette + b _080C61CE + .pool +_080C61A4: + ldr r1, =gUnknown_08DE3350 + movs r0, 0x9 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r2, 0x15 + movs r3, 0 + bl CopyToBgTilemapBufferRect_ChangePalette + b _080C61CE + .pool +_080C61C4: + subs r0, r4, 0x1 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bhi _080C6294 +_080C61CE: + cmp r4, 0x2 + beq _080C620C + cmp r4, 0x2 + bgt _080C61DC + cmp r4, 0x1 + beq _080C61E6 + b _080C6284 +_080C61DC: + cmp r4, 0x3 + beq _080C6230 + cmp r4, 0x4 + beq _080C6264 + b _080C6284 +_080C61E6: + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0, 0x24] + adds r1, 0xA8 + movs r0, 0xC + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r2, 0x10 + movs r3, 0x3 + bl CopyToBgTilemapBufferRect_ChangePalette + b _080C628E + .pool +_080C620C: + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0, 0x24] + movs r0, 0xFC + lsls r0, 1 + adds r1, r0 + movs r0, 0xC + str r0, [sp] + movs r0, 0x7 + str r0, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r2, 0x10 + b _080C6254 + .pool +_080C6230: + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldrb r1, [r0, 0xE] + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _080C6294 + ldr r0, =gUnknown_02039CF0 + ldr r0, [r0] + ldr r1, [r0, 0x28] + adds r1, 0x48 + movs r0, 0xC + str r0, [sp] + str r4, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r2, 0x2 +_080C6254: + movs r3, 0xA + bl CopyToBgTilemapBufferRect_ChangePalette + b _080C628E + .pool +_080C6264: + ldr r1, =gUnknown_08DE3374 + movs r0, 0x9 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x11 + str r0, [sp, 0x8] + movs r0, 0x1 + movs r2, 0x15 + movs r3, 0 + bl CopyToBgTilemapBufferRect_ChangePalette + b _080C628E + .pool +_080C6284: + subs r0, r5, 0x1 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x3 + bhi _080C6294 +_080C628E: + movs r0, 0x1 + bl CopyBgTilemapBufferToVram +_080C6294: + add sp, 0xC + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_80C6104 + + thumb_func_start sub_80C629C +sub_80C629C: @ 80C629C + push {r4,lr} + ldr r1, =gUnknown_08DE3060 + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer + ldr r4, =gUnknown_02039CEC + ldr r1, [r4] + ldrb r0, [r1, 0xC] + ldrb r1, [r1, 0xD] + bl sub_80C6104 + ldr r0, [r4] + ldrb r1, [r0, 0xE] + lsls r1, 28 + lsrs r1, 29 + movs r0, 0x1 + bl sub_80C5F58 + bl sub_80C5DB8 + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C629C + + thumb_func_start sub_80C62DC +sub_80C62DC: @ 80C62DC + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x18 + movs r5, 0 + bl FreeAllSpritePalettes + bl ResetAffineAnimData + ldr r0, =gUnknown_085714E4 + bl LoadSpritePalettes + ldr r4, =gUnknown_085714BC + adds r0, r4, 0 + bl LoadCompressedSpriteSheet + adds r4, 0x10 + adds r0, r4, 0 + bl LoadCompressedSpriteSheet + ldr r0, =gUnknown_085715B4 + ldr r1, =gUnknown_02039CEC + ldr r2, [r1] + movs r3, 0x8 + ldrsh r1, [r2, r3] + movs r6, 0xA + ldrsh r2, [r2, r6] + movs r3, 0 + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + ldr r3, =gUnknown_02039CF0 + ldr r2, [r3] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r0, =gSprites + adds r1, r0 + str r1, [r2] + ldrb r2, [r1, 0x5] + movs r0, 0xD + negs r0, r0 + ands r0, r2 + strb r0, [r1, 0x5] + mov r8, sp + mov r9, r3 +_080C633C: + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + adds r0, 0xF + adds r2, r0, r5 + ldrb r0, [r2] + adds r4, r5, 0x1 + cmp r0, 0 + beq _080C63C2 + mov r1, sp + ldr r0, =gUnknown_085715E4 + ldm r0!, {r3,r6,r7} + stm r1!, {r3,r6,r7} + ldm r0!, {r3,r6,r7} + stm r1!, {r3,r6,r7} + mov r7, r8 + ldrh r0, [r7, 0x2] + ldr r1, =0x0000ffff + adds r0, r1 + ldrb r2, [r2] + adds r0, r2 + strh r0, [r7, 0x2] + ldr r1, =gUnknown_08571454 + adds r0, r5, 0x6 + lsls r0, 3 + adds r0, r1 + ldrh r1, [r0, 0x4] + adds r1, 0x8 + lsls r1, 16 + asrs r1, 16 + ldrh r2, [r0] + adds r2, 0x6 + lsls r2, 16 + asrs r2, 16 + lsls r3, r4, 24 + lsrs r3, 24 + mov r0, sp + bl CreateSprite + lsls r0, 24 + lsrs r0, 24 + mov r3, r9 + ldr r2, [r3] + lsls r3, r5, 2 + adds r2, 0x4 + adds r2, r3 + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r0, =gSprites + adds r1, r0 + str r1, [r2] + ldrb r2, [r1, 0x5] + movs r6, 0xD + negs r6, r6 + adds r0, r6, 0 + ands r2, r0 + movs r0, 0x8 + orrs r2, r0 + strb r2, [r1, 0x5] + mov r7, r9 + ldr r0, [r7] + adds r0, 0x4 + adds r0, r3 + ldr r0, [r0] + adds r1, r5, 0 + bl StartSpriteAnim +_080C63C2: + lsls r0, r4, 24 + lsrs r5, r0, 24 + cmp r5, 0x6 + bls _080C633C + add sp, 0x18 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C62DC + + thumb_func_start sub_80C63FC +sub_80C63FC: @ 80C63FC + push {r4-r6,lr} + movs r5, 0 + ldr r4, =gUnknown_02039CF0 + ldr r0, [r4] + ldr r0, [r0] + bl DestroySprite + ldr r0, [r4] + str r5, [r0] + adds r6, r4, 0 +_080C6410: + ldr r0, [r6] + lsls r4, r5, 2 + adds r0, 0x4 + adds r0, r4 + ldr r0, [r0] + cmp r0, 0 + beq _080C642C + bl DestroySprite + ldr r0, [r6] + adds r0, 0x4 + adds r0, r4 + movs r1, 0 + str r1, [r0] +_080C642C: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x6 + bls _080C6410 + bl FreeAllSpritePalettes + movs r0, 0x2 + bl FreeSpriteTilesByTag + movs r0, 0 + bl FreeSpriteTilesByTag + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C63FC + + thumb_func_start nullsub_39 +nullsub_39: @ 80C6450 + bx lr + thumb_func_end nullsub_39 + + thumb_func_start sub_80C6454 +sub_80C6454: @ 80C6454 + push {r4,r5,lr} + adds r4, r0, 0 + ldr r5, =gUnknown_02039CF4 + ldr r0, [r5] + cmp r0, 0 + beq _080C6466 + adds r0, r4, 0 + bl SetMainCallback2 +_080C6466: + ldr r0, =0x00003014 + bl AllocZeroed + str r0, [r5] + str r4, [r0] + bl ResetTasks + ldr r0, =sub_80C67BC + movs r1, 0 + bl CreateTask + ldr r0, =sub_80C5438 + bl SetMainCallback2 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C6454 + + thumb_func_start sub_80C6498 +sub_80C6498: @ 80C6498 + push {r4,lr} + bl ResetTasks + ldr r4, =gUnknown_02039CF4 + ldr r0, [r4] + ldr r0, [r0] + bl SetMainCallback2 + ldr r0, [r4] + ldr r2, =0x00003014 + movs r1, 0 + bl memset + ldr r0, [r4] + bl Free + movs r0, 0 + str r0, [r4] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C6498 + + thumb_func_start sub_80C64CC +sub_80C64CC: @ 80C64CC + push {r4,r5,lr} + sub sp, 0x8 + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldrh r0, [r0, 0x4] + cmp r0, 0x7 + bls _080C64DC + b _080C6694 +_080C64DC: + lsls r0, 2 + ldr r1, =_080C64F0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080C64F0: + .4byte _080C6510 + .4byte _080C6520 + .4byte _080C6526 + .4byte _080C6538 + .4byte _080C65C0 + .4byte _080C65E8 + .4byte _080C6628 + .4byte _080C6678 +_080C6510: + movs r0, 0 + bl SetVBlankCallback + bl ScanlineEffect_Stop + bl SetVBlankHBlankCallbacksToNull + b _080C6694 +_080C6520: + bl sub_80C50D0 + b _080C6694 +_080C6526: + bl ResetSpriteData + bl FreeAllSpritePalettes + bl ResetPaletteFade + bl reset_temp_tile_data_buffers + b _080C6694 +_080C6538: + movs r0, 0 + bl ResetBgsAndClearDma3BusyFlags + ldr r1, =gUnknown_085713F4 + movs r0, 0 + movs r2, 0x3 + bl InitBgsFromTemplates + ldr r4, =gUnknown_02039CF4 + ldr r1, [r4] + adds r1, 0x12 + movs r0, 0 + bl SetBgTilemapBuffer + ldr r1, [r4] + ldr r0, =0x00001012 + adds r1, r0 + movs r0, 0x1 + bl SetBgTilemapBuffer + ldr r1, [r4] + ldr r0, =0x00002012 + adds r1, r0 + movs r0, 0x2 + bl SetBgTilemapBuffer + movs r5, 0x1E + str r5, [sp] + movs r4, 0x14 + str r4, [sp, 0x4] + movs r0, 0 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x1 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + str r5, [sp] + str r4, [sp, 0x4] + movs r0, 0x2 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl FillBgTilemapBufferRect_Palette0 + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x1 + bl CopyBgTilemapBufferToVram + b _080C6618 + .pool +_080C65C0: + ldr r0, =gUnknown_08571428 + bl InitWindows + bl DeactivateAllTextPrinters + bl sub_80C6B94 + ldr r1, =gUnknown_0856FBBC + movs r0, 0 + str r0, [sp] + movs r0, 0x1 + movs r2, 0 + movs r3, 0 + bl decompress_and_copy_tile_data_to_vram + b _080C6694 + .pool +_080C65E8: + bl free_temp_tile_data_buffers_if_possible + lsls r0, 24 + cmp r0, 0 + bne _080C669E + ldr r0, =gUnknown_08DE07C8 + movs r2, 0xD0 + lsls r2, 1 + movs r1, 0 + bl LoadPalette + movs r0, 0 + bl stdpal_get + movs r1, 0xF0 + movs r2, 0x20 + bl LoadPalette + ldr r1, =gUnknown_08570E00 + movs r0, 0x2 + movs r2, 0 + movs r3, 0 + bl CopyToBgTilemapBuffer +_080C6618: + movs r0, 0x2 + bl CopyBgTilemapBufferToVram + b _080C6694 + .pool +_080C6628: + movs r1, 0x82 + lsls r1, 5 + movs r0, 0 + bl SetGpuReg + movs r0, 0 + bl ShowBg + movs r0, 0x1 + bl ShowBg + movs r0, 0x2 + bl ShowBg + bl sub_80C6974 + ldr r0, =pokemon_details + bl SetVBlankCallback + movs r5, 0x1 + negs r5, r5 + ldr r4, =0x00007fff + adds r0, r5, 0 + movs r1, 0x10 + adds r2, r4, 0 + bl BlendPalettes + str r4, [sp] + adds r0, r5, 0 + movs r1, 0 + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + b _080C6694 + .pool +_080C6678: + bl UpdatePaletteFade + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0 + bne _080C669E + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + strh r1, [r0, 0x4] + movs r0, 0x1 + b _080C66A0 + .pool +_080C6694: + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] +_080C669E: + movs r0, 0 +_080C66A0: + add sp, 0x8 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_80C64CC + + thumb_func_start sub_80C66AC +sub_80C66AC: @ 80C66AC + push {r4,lr} + sub sp, 0x4 + ldr r0, =gUnknown_02039CEC + ldr r0, [r0] + ldrh r0, [r0, 0x4] + cmp r0, 0x5 + bhi _080C67A4 + lsls r0, 2 + ldr r1, =_080C66CC + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080C66CC: + .4byte _080C66E4 + .4byte _080C66FC + .4byte _080C6722 + .4byte _080C6732 + .4byte _080C6774 + .4byte _080C6782 +_080C66E4: + movs r0, 0x1 + negs r0, r0 + ldr r1, =0x00007fff + str r1, [sp] + movs r1, 0 + movs r2, 0 + movs r3, 0x10 + bl BeginNormalPaletteFade + b _080C67A4 + .pool +_080C66FC: + bl UpdatePaletteFade + lsls r0, 24 + cmp r0, 0 + bne _080C67AE + movs r0, 0 + movs r1, 0 + bl SetGpuReg + movs r0, 0 + bl HideBg + movs r0, 0x1 + bl HideBg + movs r0, 0x2 + bl HideBg + b _080C67A4 +_080C6722: + movs r0, 0 + bl SetVBlankCallback + bl ScanlineEffect_Stop + bl SetVBlankHBlankCallbacksToNull + b _080C67A4 +_080C6732: + ldr r4, =gUnknown_02039CF4 + ldr r0, [r4] + ldr r0, [r0, 0x4] + cmp r0, 0 + beq _080C6746 + bl DestroySprite + movs r0, 0 + bl FreeSpriteTilesByTag +_080C6746: + ldr r0, [r4] + ldr r0, [r0, 0xC] + cmp r0, 0 + beq _080C6758 + bl DestroySprite + movs r0, 0x1 + bl FreeSpriteTilesByTag +_080C6758: + ldr r0, [r4] + ldr r0, [r0, 0x8] + cmp r0, 0 + beq _080C676A + bl DestroySprite + movs r0, 0x4 + bl FreeSpriteTilesByTag +_080C676A: + bl FreeAllWindowBuffers + b _080C67A4 + .pool +_080C6774: + bl sub_80C50D0 + bl ResetSpriteData + bl FreeAllSpritePalettes + b _080C67A4 +_080C6782: + movs r0, 0 + bl UnsetBgTilemapBuffer + movs r0, 0x1 + bl UnsetBgTilemapBuffer + movs r0, 0x2 + bl UnsetBgTilemapBuffer + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + movs r0, 0 + strh r0, [r1, 0x4] + movs r0, 0x1 + b _080C67B0 + .pool +_080C67A4: + ldr r0, =gUnknown_02039CEC + ldr r1, [r0] + ldrh r0, [r1, 0x4] + adds r0, 0x1 + strh r0, [r1, 0x4] +_080C67AE: + movs r0, 0 +_080C67B0: + add sp, 0x4 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_80C66AC + + thumb_func_start sub_80C67BC +sub_80C67BC: @ 80C67BC + push {r4,lr} + lsls r0, 24 + lsrs r2, r0, 24 + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0x5 + bls _080C67D6 + b _080C68DA +_080C67D6: + lsls r0, 2 + ldr r1, =_080C67E8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_080C67E8: + .4byte _080C6800 + .4byte _080C6806 + .4byte _080C686C + .4byte _080C6894 + .4byte _080C68C4 + .4byte _080C68CE +_080C6800: + bl sub_80C64CC + b _080C68C8 +_080C6806: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r2, 0x2 + adds r0, r2, 0 + ands r0, r1 + cmp r0, 0 + beq _080C6824 + movs r0, 0x3 + bl PlaySE + movs r0, 0x4 + b _080C68DE + .pool +_080C6824: + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _080C6848 + ldr r0, =gUnknown_02039CF4 + ldr r0, [r0] + ldrb r0, [r0, 0x10] + cmp r0, 0x5 + bls _080C6844 + movs r0, 0 + bl sub_80C6C70 + b _080C68E0 + .pool +_080C6844: + strh r2, [r4] + b _080C68E0 +_080C6848: + movs r0, 0x40 + ands r0, r1 + cmp r0, 0 + beq _080C68E0 + ldr r0, =gUnknown_02039CF4 + ldr r0, [r0] + ldrb r0, [r0, 0x10] + cmp r0, 0 + bne _080C6868 + movs r0, 0x1 + bl sub_80C6C70 + b _080C68E0 + .pool +_080C6868: + movs r0, 0x3 + b _080C68DE +_080C686C: + movs r1, 0x2 + ldrsh r0, [r4, r1] + cmp r0, 0x3 + ble _080C6882 + movs r0, 0 + bl sub_80C6C70 + movs r0, 0 + strh r0, [r4, 0x2] + movs r0, 0x1 + b _080C68DE +_080C6882: + ldr r0, =gUnknown_02039CF4 + ldr r0, [r0] + ldr r1, [r0, 0x4] + ldrh r0, [r1, 0x22] + adds r0, 0x4 + b _080C68B4 + .pool +_080C6894: + movs r1, 0x2 + ldrsh r0, [r4, r1] + cmp r0, 0x3 + ble _080C68AA + movs r0, 0x1 + bl sub_80C6C70 + movs r0, 0 + strh r0, [r4, 0x2] + movs r0, 0x1 + b _080C68DE +_080C68AA: + ldr r0, =gUnknown_02039CF4 + ldr r0, [r0] + ldr r1, [r0, 0x4] + ldrh r0, [r1, 0x22] + subs r0, 0x4 +_080C68B4: + strh r0, [r1, 0x22] + ldrh r0, [r4, 0x2] + adds r0, 0x1 + strh r0, [r4, 0x2] + b _080C68E0 + .pool +_080C68C4: + bl sub_80C66AC +_080C68C8: + cmp r0, 0 + bne _080C68DA + b _080C68E0 +_080C68CE: + adds r0, r2, 0 + bl DestroyTask + bl sub_80C6498 + b _080C68E0 +_080C68DA: + ldrh r0, [r4] + adds r0, 0x1 +_080C68DE: + strh r0, [r4] +_080C68E0: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_80C67BC + + thumb_func_start sub_80C68E8 +sub_80C68E8: @ 80C68E8 + push {lr} + lsls r0, 16 + lsrs r1, r0, 16 + ldr r2, =0xfffb0000 + adds r0, r2 + lsrs r0, 16 + cmp r0, 0x3 + bls _080C6904 + adds r0, r1, 0 + subs r0, 0xF + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bhi _080C690C +_080C6904: + movs r0, 0x1 + b _080C696E + .pool +_080C690C: + adds r0, r1, 0 + subs r0, 0x12 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x3 + bhi _080C691C + movs r0, 0x2 + b _080C696E +_080C691C: + adds r0, r1, 0 + subs r0, 0x16 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bhi _080C692C + movs r0, 0x3 + b _080C696E +_080C692C: + adds r0, r1, 0 + subs r0, 0x1C + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bhi _080C693C + movs r0, 0x4 + b _080C696E +_080C693C: + adds r0, r1, 0 + subs r0, 0x1F + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bhi _080C694C + movs r0, 0x5 + b _080C696E +_080C694C: + adds r0, r1, 0 + subs r0, 0x22 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x5 + bhi _080C695C + movs r0, 0x6 + b _080C696E +_080C695C: + adds r0, r1, 0 + subs r0, 0x19 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bls _080C696C + movs r0, 0 + b _080C696E +_080C696C: + movs r0, 0x7 +_080C696E: + pop {r1} + bx r1 + thumb_func_end sub_80C68E8 + + thumb_func_start sub_80C6974 +sub_80C6974: @ 80C6974 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x18 + movs r7, 0 + bl FreeAllSpritePalettes + ldr r0, =gUnknown_085714E4 + bl LoadSpritePalettes + ldr r6, =gUnknown_085714BC + adds r0, r6, 0 + bl LoadCompressedSpriteSheet + ldr r0, =gUnknown_085715B4 + mov r8, r0 + ldr r4, =gUnknown_02039CF4 + ldr r0, [r4] + ldrb r2, [r0, 0x10] + lsls r2, 4 + adds r2, 0x8 + mov r0, r8 + movs r1, 0x9B + movs r3, 0x2 + bl CreateSprite + lsls r0, 24 + lsrs r3, r0, 24 + ldr r0, [r4] + lsls r1, r3, 4 + adds r1, r3 + lsls r1, 2 + ldr r2, =gSprites + mov r9, r2 + add r1, r9 + str r1, [r0, 0x4] + ldrb r2, [r1, 0x5] + movs r5, 0xD + negs r5, r5 + adds r0, r5, 0 + ands r0, r2 + strb r0, [r1, 0x5] + ldr r0, [r4] + ldr r1, [r0, 0x4] + adds r1, 0x3F + ldrb r0, [r1] + movs r2, 0x1 + orrs r0, r2 + strb r0, [r1] + ldr r0, [r4] + ldr r0, [r0, 0x4] + movs r1, 0x1 + bl StartSpriteAnim + adds r6, 0x8 + adds r0, r6, 0 + bl LoadCompressedSpriteSheet + movs r3, 0x18 + add r8, r3 + ldr r6, =gUnknown_08571650 + ldr r0, [r4] + ldrb r0, [r0, 0x10] + lsls r0, 4 + adds r0, r6 + movs r2, 0x8 + ldrsh r1, [r0, r2] + movs r3, 0xA + ldrsh r2, [r0, r3] + mov r0, r8 + movs r3, 0x1 + bl CreateSprite + lsls r0, 24 + lsrs r3, r0, 24 + ldr r1, [r4] + lsls r0, r3, 4 + adds r0, r3 + lsls r0, 2 + add r0, r9 + str r0, [r1, 0xC] + ldrb r1, [r0, 0x5] + ands r5, r1 + strb r5, [r0, 0x5] + ldr r1, [r4] + ldr r0, [r1, 0xC] + ldrb r1, [r1, 0x10] + lsls r1, 4 + adds r1, r6 + ldrb r1, [r1, 0xC] + bl StartSpriteAnim + bl GetCurrentRegionMapSectionId + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x3A + beq _080C6A40 + cmp r5, 0xCA + beq _080C6A40 + b _080C6B7A +_080C6A40: + ldr r4, =gSaveBlock1Ptr + ldr r2, [r4] + movs r0, 0x5 + ldrsb r0, [r2, r0] + cmp r0, 0x4 + beq _080C6A52 + cmp r0, 0xE + bne _080C6A98 + movs r7, 0x37 +_080C6A52: + lsls r0, r7, 16 + asrs r0, 16 + ldrh r6, [r2] + adds r0, r6 + ldrh r4, [r2, 0x2] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0 + bge _080C6A66 + adds r0, 0x7 +_080C6A66: + lsls r0, 13 + lsrs r7, r0, 16 + lsls r0, r4, 16 + asrs r0, 16 + cmp r0, 0 + bge _080C6A74 + adds r0, 0x7 +_080C6A74: + lsls r0, 13 + lsrs r4, r0, 16 + movs r5, 0 + b _080C6AF2 + .pool +_080C6A98: + lsls r0, 16 + lsrs r0, 16 + bl sub_80C68E8 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0 + beq _080C6AB4 + subs r0, r5, 0x1 + lsls r0, 4 + adds r0, r6 + ldrh r7, [r0, 0x8] + ldrh r4, [r0, 0xA] + b _080C6AF2 +_080C6AB4: + ldr r1, [r4] + adds r0, r1, 0 + adds r0, 0x25 + ldrb r0, [r0] + lsls r0, 24 + asrs r0, 24 + cmp r0, 0xE + bne _080C6ACE + ldrh r0, [r1, 0x28] + adds r0, 0x37 + lsls r0, 16 + lsrs r7, r0, 16 + b _080C6AD0 +_080C6ACE: + ldrh r7, [r1, 0x28] +_080C6AD0: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r4, [r0, 0x2A] + lsls r0, r7, 16 + asrs r0, 16 + cmp r0, 0 + bge _080C6AE0 + adds r0, 0x7 +_080C6AE0: + lsls r0, 13 + lsrs r7, r0, 16 + lsls r0, r4, 16 + asrs r0, 16 + cmp r0, 0 + bge _080C6AEE + adds r0, 0x7 +_080C6AEE: + lsls r0, 13 + lsrs r4, r0, 16 +_080C6AF2: + ldr r0, =gUnknown_085714D4 + bl LoadCompressedSpriteSheet + mov r1, sp + ldr r0, =gUnknown_085715FC + ldm r0!, {r2,r3,r6} + stm r1!, {r2,r3,r6} + ldm r0!, {r2,r3,r6} + stm r1!, {r2,r3,r6} + mov r1, sp + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x8] + adds r0, 0x4 + strh r0, [r1, 0x2] + cmp r5, 0 + beq _080C6B2C + lsls r1, r7, 16 + asrs r1, 16 + lsls r2, r4, 16 + b _080C6B3E + .pool +_080C6B2C: + lsls r1, r7, 19 + lsls r2, r4, 19 + movs r0, 0xA0 + lsls r0, 13 + adds r1, r0 + asrs r1, 16 + movs r3, 0x90 + lsls r3, 14 + adds r2, r3 +_080C6B3E: + asrs r2, 16 + mov r0, sp + movs r3, 0 + bl CreateSprite + lsls r0, 24 + lsrs r3, r0, 24 + ldr r4, =gUnknown_02039CF4 + ldr r2, [r4] + lsls r1, r3, 4 + adds r1, r3 + lsls r1, 2 + ldr r0, =gSprites + adds r1, r0 + str r1, [r2, 0x8] + ldrb r2, [r1, 0x5] + movs r0, 0xD + negs r0, r0 + ands r0, r2 + strb r0, [r1, 0x5] + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0 + beq _080C6B7A + ldr r0, [r4] + ldr r0, [r0, 0x8] + movs r1, 0x1 + bl StartSpriteAnim +_080C6B7A: + add sp, 0x18 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C6974 + + thumb_func_start sub_80C6B94 +sub_80C6B94: @ 80C6B94 + push {r4-r6,lr} + sub sp, 0xC + movs r4, 0 +_080C6B9A: + adds r0, r4, 0 + bl PutWindowTilemap + adds r0, r4, 0 + movs r1, 0 + bl FillWindowPixelBuffer + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x2 + bls _080C6B9A + movs r4, 0 + movs r6, 0 + ldr r5, =gUnknown_08571650 +_080C6BB8: + ldr r0, =gUnknown_02039CF4 + ldr r0, [r0] + ldrb r0, [r0, 0x10] + cmp r4, r0 + bne _080C6BF0 + lsls r1, r4, 4 + adds r3, r1, 0x1 + lsls r3, 24 + lsrs r3, 24 + ldr r0, =gUnknown_0857144E + str r0, [sp] + str r6, [sp, 0x4] + adds r1, r5 + ldr r0, [r1] + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x7 + movs r2, 0x4 + bl AddTextPrinterParameterized3 + b _080C6C0E + .pool +_080C6BF0: + lsls r1, r4, 4 + adds r3, r1, 0x1 + lsls r3, 24 + lsrs r3, 24 + ldr r0, =gUnknown_0857144B + str r0, [sp] + str r6, [sp, 0x4] + adds r1, r5 + ldr r0, [r1] + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x7 + movs r2, 0x4 + bl AddTextPrinterParameterized3 +_080C6C0E: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x6 + bls _080C6BB8 + ldr r0, =gUnknown_08571448 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + ldr r1, =gUnknown_08571650 + ldr r0, =gUnknown_02039CF4 + ldr r0, [r0] + ldrb r0, [r0, 0x10] + lsls r0, 4 + adds r1, 0x4 + adds r0, r1 + ldr r0, [r0] + str r0, [sp, 0x8] + movs r0, 0x2 + movs r1, 0x1 + movs r2, 0x4 + movs r3, 0 + bl AddTextPrinterParameterized3 + movs r4, 0 +_080C6C40: + adds r0, r4, 0 + movs r1, 0x3 + bl CopyWindowToVram + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x2 + bls _080C6C40 + movs r0, 0 + bl CopyBgTilemapBufferToVram + add sp, 0xC + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C6B94 + + thumb_func_start sub_80C6C70 +sub_80C6C70: @ 80C6C70 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0xC + lsls r0, 24 + cmp r0, 0 + beq _080C6C8C + ldr r0, =gUnknown_02039CF4 + ldr r4, [r0] + ldrb r5, [r4, 0x10] + adds r0, r5, 0x6 + b _080C6C94 + .pool +_080C6C8C: + ldr r0, =gUnknown_02039CF4 + ldr r4, [r0] + ldrb r5, [r4, 0x10] + adds r0, r5, 0x1 +_080C6C94: + movs r1, 0x7 + bl __modsi3 + strb r0, [r4, 0x10] + lsls r0, r5, 4 + adds r3, r0, 0x1 + lsls r3, 24 + lsrs r3, 24 + ldr r6, =gUnknown_0857144B + str r6, [sp] + movs r1, 0 + mov r8, r1 + str r1, [sp, 0x4] + ldr r4, =gUnknown_08571650 + adds r0, r4 + ldr r0, [r0] + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x7 + movs r2, 0x4 + bl AddTextPrinterParameterized3 + ldr r5, =gUnknown_02039CF4 + ldr r1, [r5] + ldrb r3, [r1, 0x10] + lsls r3, 4 + adds r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + adds r0, r6, 0x3 + str r0, [sp] + mov r0, r8 + str r0, [sp, 0x4] + ldrb r0, [r1, 0x10] + lsls r0, 4 + adds r0, r4 + ldr r0, [r0] + str r0, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x7 + movs r2, 0x4 + bl AddTextPrinterParameterized3 + ldr r1, [r5] + ldr r2, [r1, 0x4] + ldrb r0, [r1, 0x10] + lsls r0, 4 + adds r0, 0x8 + strh r0, [r2, 0x22] + ldr r0, [r1, 0xC] + ldrb r1, [r1, 0x10] + lsls r1, 4 + adds r1, r4 + ldrb r1, [r1, 0xC] + bl StartSpriteAnim + ldr r1, [r5] + ldr r2, [r1, 0xC] + ldrb r0, [r1, 0x10] + lsls r0, 4 + adds r0, r4 + ldrh r0, [r0, 0x8] + strh r0, [r2, 0x20] + ldr r2, [r1, 0xC] + ldrb r0, [r1, 0x10] + lsls r0, 4 + adds r0, r4 + ldrh r0, [r0, 0xA] + strh r0, [r2, 0x22] + movs r0, 0x2 + movs r1, 0 + bl FillWindowPixelBuffer + subs r6, 0x3 + str r6, [sp] + mov r1, r8 + str r1, [sp, 0x4] + ldr r0, [r5] + ldrb r0, [r0, 0x10] + lsls r0, 4 + adds r4, 0x4 + adds r0, r4 + ldr r0, [r0] + str r0, [sp, 0x8] + movs r0, 0x2 + movs r1, 0x1 + movs r2, 0x4 + movs r3, 0 + bl AddTextPrinterParameterized3 + movs r4, 0 +_080C6D4A: + adds r0, r4, 0 + movs r1, 0x3 + bl CopyWindowToVram + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x2 + bls _080C6D4A + movs r0, 0 + bl CopyBgTilemapBufferToVram + movs r0, 0x6C + bl PlaySE + add sp, 0xC + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C6C70 + + thumb_func_start sub_80C6D80 +sub_80C6D80: @ 80C6D80 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x2C + str r0, [sp, 0x24] + adds r7, r1, 0 + lsls r2, 24 + lsrs r2, 24 + str r2, [sp, 0x28] + lsls r3, 24 + lsrs r3, 24 + mov r9, r3 + movs r0, 0 + movs r1, 0 + str r0, [sp, 0x1C] + str r1, [sp, 0x20] + ldr r1, =0x00ffffff + ldr r0, [sp, 0x1C] + ands r0, r1 + movs r1, 0xC0 + lsls r1, 21 + orrs r0, r1 + str r0, [sp, 0x1C] + ldr r1, =0xffffff00 + add r5, sp, 0x1C + ldr r0, [r5, 0x4] + ands r0, r1 + movs r1, 0x2 + orrs r0, r1 + str r0, [r5, 0x4] + adds r0, r5, 0 + bl AddWindow + lsls r0, 16 + lsrs r0, 16 + mov r10, r0 + lsls r4, r0, 24 + lsrs r4, 24 + mov r0, r9 + lsls r1, r0, 4 + orrs r1, r0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + bl FillWindowPixelBuffer + adds r0, r4, 0 + movs r1, 0x7 + bl GetWindowAttribute + adds r6, r0, 0 + ldrb r0, [r5, 0x3] + lsls r0, 5 + adds r0, r6 + mov r8, r0 + ldr r1, [sp, 0x28] + cmp r1, 0 + bne _080C6E04 + add r0, sp, 0x14 + b _080C6E08 + .pool +_080C6E04: + add r0, sp, 0x14 + mov r1, r9 +_080C6E08: + strb r1, [r0] + add r1, sp, 0x14 + movs r2, 0 + movs r0, 0xF + strb r0, [r1, 0x1] + movs r0, 0xE + strb r0, [r1, 0x2] + mov r0, r10 + lsls r4, r0, 24 + lsrs r0, r4, 24 + str r2, [sp] + str r2, [sp, 0x4] + str r1, [sp, 0x8] + movs r1, 0x1 + negs r1, r1 + str r1, [sp, 0xC] + ldr r1, [sp, 0x24] + str r1, [sp, 0x10] + movs r1, 0x1 + movs r3, 0x1 + bl AddTextPrinterParameterized4 + ldr r0, [sp, 0x4C] + mov r10, r4 + cmp r0, 0x6 + bls _080C6E3E + movs r0, 0x6 +_080C6E3E: + ldr r4, [sp, 0x4C] + subs r4, 0x6 + cmp r0, 0 + ble _080C6E70 + adds r5, r0, 0 +_080C6E48: + adds r0, r6, 0 + adds r1, r7, 0 + movs r2, 0x40 + bl CpuSet + adds r1, r7, 0 + adds r1, 0x80 + mov r0, r8 + movs r2, 0x40 + bl CpuSet + adds r6, 0x80 + movs r2, 0x80 + add r8, r2 + movs r0, 0x80 + lsls r0, 1 + adds r7, r0 + subs r5, 0x1 + cmp r5, 0 + bne _080C6E48 +_080C6E70: + cmp r4, 0 + ble _080C6E90 + add r0, sp, 0x18 + mov r2, r9 + lsls r1, r2, 4 + orrs r1, r2 + strh r1, [r0] + lsls r2, r4, 7 + ldr r1, =0x001fffff + ands r2, r1 + movs r1, 0x80 + lsls r1, 17 + orrs r2, r1 + adds r1, r7, 0 + bl CpuSet +_080C6E90: + mov r1, r10 + lsrs r0, r1, 24 + bl RemoveWindow + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C6D80 + + thumb_func_start sub_80C6EAC +sub_80C6EAC: @ 80C6EAC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x2C + str r0, [sp, 0x20] + str r1, [sp, 0x24] + adds r6, r3, 0 + ldr r0, [sp, 0x4C] + mov r9, r0 + ldr r1, [sp, 0x50] + mov r10, r1 + lsls r2, 16 + lsrs r2, 16 + str r2, [sp, 0x28] + lsls r6, 24 + lsrs r6, 24 + mov r2, r9 + lsls r2, 24 + lsrs r2, 24 + mov r9, r2 + mov r0, r10 + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + movs r0, 0 + movs r1, 0 + str r0, [sp, 0x18] + str r1, [sp, 0x1C] + ldr r0, [sp, 0x20] + bl StringLength_Multibyte + lsls r0, 24 + ldr r2, =0x00ffffff + ldr r1, [sp, 0x18] + ands r1, r2 + orrs r1, r0 + str r1, [sp, 0x18] + ldr r1, =0xffffff00 + add r2, sp, 0x18 + mov r8, r2 + ldr r0, [r2, 0x4] + ands r0, r1 + movs r1, 0x2 + orrs r0, r1 + str r0, [r2, 0x4] + ldr r5, [sp, 0x18] + lsrs r5, 24 + lsls r5, 5 + mov r0, r8 + bl AddWindow + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + lsls r1, r6, 4 + orrs r1, r6 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + bl FillWindowPixelBuffer + adds r0, r4, 0 + movs r1, 0x7 + bl GetWindowAttribute + adds r7, r0, 0 + mov r0, r8 + ldrb r0, [r0, 0x3] + lsls r0, 5 + mov r8, r0 + add r8, r7 + add r0, sp, 0x14 + movs r1, 0 + strb r6, [r0] + mov r2, r9 + strb r2, [r0, 0x1] + mov r2, r10 + strb r2, [r0, 0x2] + str r1, [sp] + str r1, [sp, 0x4] + str r0, [sp, 0x8] + movs r0, 0x1 + negs r0, r0 + str r0, [sp, 0xC] + ldr r0, [sp, 0x20] + str r0, [sp, 0x10] + adds r0, r4, 0 + movs r1, 0x1 + movs r2, 0 + movs r3, 0x2 + bl AddTextPrinterParameterized4 + lsrs r5, 1 + adds r0, r7, 0 + ldr r1, [sp, 0x24] + adds r2, r5, 0 + bl CpuSet + ldr r2, [sp, 0x24] + ldr r0, [sp, 0x28] + adds r1, r2, r0 + mov r0, r8 + adds r2, r5, 0 + bl CpuSet + adds r0, r4, 0 + bl RemoveWindow + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_80C6EAC + + .align 2, 0 @ Don't pad with nop. diff --git a/asm/trainer_card.s b/asm/trainer_card.s deleted file mode 100644 index d0f26e0e1..000000000 --- a/asm/trainer_card.s +++ /dev/null @@ -1,8438 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_80C2690 -sub_80C2690: @ 80C2690 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl sub_80C48C8 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldrb r0, [r0, 0x9] - cmp r0, 0 - beq _080C26C0 - ldr r1, =0x040000d4 - ldr r0, =gScanlineEffectRegBuffers - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_080C26C0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C2690 - - thumb_func_start sub_80C26D4 -sub_80C26D4: @ 80C26D4 - push {r4,lr} - ldr r4, =0x04000208 - ldrh r3, [r4] - movs r0, 0 - strh r0, [r4] - ldr r1, =gScanlineEffectRegBuffers - ldr r0, =0x04000006 - ldrh r2, [r0] - movs r0, 0xFF - ands r0, r2 - lsls r0, 1 - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x04000012 - strh r1, [r0] - strh r3, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C26D4 - - thumb_func_start sub_80C2710 -sub_80C2710: @ 80C2710 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_80C2710 - - thumb_func_start sub_80C2728 -sub_80C2728: @ 80C2728 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_02039CE8 - ldr r0, [r5] - movs r1, 0xA6 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - bl SetMainCallback2 - bl FreeAllWindowBuffers - ldr r0, [r5] - bl Free - movs r0, 0 - str r0, [r5] - adds r0, r4, 0 - bl DestroyTask - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C2728 - - thumb_func_start sub_80C2760 -sub_80C2760: @ 80C2760 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gUnknown_02039CE8 - ldr r0, [r1] - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x10 - bls _080C2776 - b _080C2ACA -_080C2776: - lsls r0, 2 - ldr r1, =_080C2788 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C2788: - .4byte _080C27CC - .4byte _080C27E2 - .4byte _080C27F0 - .4byte _080C27F8 - .4byte _080C280C - .4byte _080C2820 - .4byte _080C2830 - .4byte _080C2836 - .4byte _080C289C - .4byte _080C28C8 - .4byte _080C28E4 - .4byte _080C299C - .4byte _080C2970 - .4byte _080C2AAA - .4byte _080C2A98 - .4byte _080C2A2C - .4byte _080C2A68 -_080C27CC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - beq _080C27D8 - b _080C2ACA -_080C27D8: - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - b _080C28D4 -_080C27E2: - bl sub_80C3438 - lsls r0, 24 - cmp r0, 0 - bne _080C27EE - b _080C2ACA -_080C27EE: - b _080C28D4 -_080C27F0: - movs r0, 0x1 - bl sub_80C438C - b _080C28D4 -_080C27F8: - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - bl sub_80C4FF0 - movs r0, 0x2 - bl sub_80C438C - b _080C28D4 -_080C280C: - ldr r0, [r4] - ldr r1, =0x00000ef8 - adds r0, r1 - bl sub_80C4550 - ldr r1, [r4] - b _080C28D8 - .pool -_080C2820: - ldr r0, [r4] - movs r2, 0xB3 - lsls r2, 3 - adds r0, r2 - bl sub_80C45C0 - ldr r1, [r4] - b _080C28D8 -_080C2830: - bl sub_80C4630 - b _080C28D4 -_080C2836: - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0x1 - bne _080C2852 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - bne _080C2852 - bl sub_800E0E8 - movs r0, 0xE6 - movs r1, 0x96 - bl CreateWirelessStatusIndicatorSprite -_080C2852: - movs r6, 0x1 - negs r6, r6 - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - ldr r5, =0x0000052c - adds r0, r5 - ldrh r2, [r0] - adds r0, r6, 0 - movs r1, 0x10 - bl BlendPalettes - ldr r0, [r4] - adds r0, r5 - ldrh r0, [r0] - str r0, [sp] - adds r0, r6, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_80C2690 - bl SetVBlankCallback - ldr r1, [r4] - b _080C28D8 - .pool -_080C289C: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _080C28A8 - b _080C2ACA -_080C28A8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - beq _080C28B4 - b _080C2ACA -_080C28B4: - movs r0, 0xFB - bl PlaySE - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - movs r0, 0xA - strb r0, [r1] - b _080C2ACA - .pool -_080C28C8: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _080C28D4 - b _080C2ACA -_080C28D4: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] -_080C28D8: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C2ACA - .pool -_080C28E4: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r5, [r0] - cmp r5, 0 - bne _080C290A - ldr r0, [r4] - ldr r1, =0x00000529 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C290A - bl sub_80C3880 - movs r0, 0x1 - bl sub_80C438C - ldr r0, [r4] - ldr r2, =0x00000529 - adds r0, r2 - strb r5, [r0] -_080C290A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080C293C - bl sub_80C4918 - movs r0, 0xF9 - bl PlaySE - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - movs r0, 0xC - strb r0, [r1] - b _080C2ACA - .pool -_080C293C: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _080C2946 - b _080C2ACA -_080C2946: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080C2960 - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _080C2960 - bl InUnionRoom - cmp r0, 0x1 - beq _080C2A14 -_080C2960: - movs r0, 0x1 - negs r0, r0 - ldr r4, =gUnknown_02039CE8 - b _080C2A74 - .pool -_080C2970: - bl sub_80C4940 - lsls r0, 24 - cmp r0, 0 - bne _080C297C - b _080C2ACA -_080C297C: - bl sub_8087598 - cmp r0, 0x1 - bne _080C2986 - b _080C2ACA -_080C2986: - movs r0, 0xFB - bl PlaySE - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - movs r0, 0xB - strb r0, [r1] - b _080C2ACA - .pool -_080C299C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080C29F4 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080C29DC - ldr r0, [r4] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _080C29C0 - bl InUnionRoom - cmp r0, 0x1 - beq _080C2A14 -_080C29C0: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080C29DC - movs r0, 0x1 - negs r0, r0 - ldr r4, =gUnknown_02039CE8 - b _080C2A74 - .pool -_080C29DC: - bl sub_80C4918 - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - movs r0, 0xD - strb r0, [r1] - movs r0, 0xF9 - bl PlaySE - b _080C2ACA - .pool -_080C29F4: - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080C2ACA - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080C2A20 - ldr r0, [r4] - ldrb r0, [r0, 0x5] - cmp r0, 0 - beq _080C2A20 - bl InUnionRoom - cmp r0, 0x1 - bne _080C2A20 -_080C2A14: - ldr r1, [r4] - movs r0, 0xF - strb r0, [r1] - b _080C2ACA - .pool -_080C2A20: - movs r0, 0x1 - negs r0, r0 - ldr r4, =gUnknown_02039CE8 - b _080C2A74 - .pool -_080C2A2C: - bl sub_800AC34 - movs r0, 0 - movs r1, 0x1 - bl NewMenuHelpers_DrawDialogueFrame - ldr r2, =gText_WaitingTrainerFinishReading - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - movs r0, 0x10 - strb r0, [r1] - b _080C2ACA - .pool -_080C2A68: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _080C2ACA - movs r0, 0x1 - negs r0, r0 -_080C2A74: - ldr r1, [r4] - ldr r2, =0x0000052c - adds r1, r2 - ldrh r1, [r1] - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r4] - movs r0, 0xE - strb r0, [r1] - b _080C2ACA - .pool -_080C2A98: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080C2ACA - adds r0, r5, 0 - bl sub_80C2728 - b _080C2ACA -_080C2AAA: - bl sub_80C4940 - lsls r0, 24 - cmp r0, 0 - beq _080C2ACA - bl sub_8087598 - cmp r0, 0x1 - beq _080C2ACA - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - movs r0, 0xA - strb r0, [r1] - movs r0, 0xFB - bl PlaySE -_080C2ACA: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C2760 - - thumb_func_start sub_80C2AD8 -sub_80C2AD8: @ 80C2AD8 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x2] - cmp r0, 0x5 - bls _080C2AE6 - b _080C2C64 -_080C2AE6: - lsls r0, 2 - ldr r1, =_080C2AF8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C2AF8: - .4byte _080C2B10 - .4byte _080C2B44 - .4byte _080C2B78 - .4byte _080C2BD0 - .4byte _080C2C04 - .4byte _080C2C38 -_080C2B10: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C2B34 - ldr r0, =gUnknown_08DD1F78 - ldr r2, =0x00000ef8 - b _080C2C4A - .pool -_080C2B34: - ldr r0, =gUnknown_08DD2AE0 - ldr r2, =0x00000ef8 - b _080C2C4A - .pool -_080C2B44: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C2B68 - ldr r0, =gUnknown_08DD21B0 - ldr r2, =0x00000a48 - b _080C2C4A - .pool -_080C2B68: - ldr r0, =gUnknown_08DD2D30 - ldr r2, =0x00000a48 - b _080C2C4A - .pool -_080C2B78: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x5] - cmp r0, 0 - bne _080C2BAC - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C2BA0 - ldr r0, =gUnknown_08DD2010 - adds r2, 0x6E - b _080C2C4A - .pool -_080C2BA0: - ldr r0, =gUnknown_08DD2B78 - movs r2, 0xB3 - lsls r2, 3 - b _080C2C4A - .pool -_080C2BAC: - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C2BC4 - ldr r0, =gUnknown_08DD228C - adds r2, 0x6E - b _080C2C4A - .pool -_080C2BC4: - ldr r0, =gUnknown_08DD2E5C - movs r2, 0xB3 - lsls r2, 3 - b _080C2C4A - .pool -_080C2BD0: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C2BF4 - ldr r0, =gUnknown_0856F5CC - ldr r2, =0x000013a8 - b _080C2C4A - .pool -_080C2BF4: - ldr r0, =gUnknown_0856F814 - ldr r2, =0x000013a8 - b _080C2C4A - .pool -_080C2C04: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C2C28 - ldr r0, =gEmeraldTrainerCard_Gfx - ldr r2, =0x000019a8 - b _080C2C4A - .pool -_080C2C28: - ldr r0, =gFireRedTrainerCard_Gfx - ldr r2, =0x000019a8 - b _080C2C4A - .pool -_080C2C38: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080C2C6C - ldr r0, =gUnknown_0856F018 - ldr r2, =0x000017a8 -_080C2C4A: - adds r1, r2 - bl LZ77UnCompWram - b _080C2C6C - .pool -_080C2C64: - movs r0, 0 - strb r0, [r1, 0x2] - movs r0, 0x1 - b _080C2C78 -_080C2C6C: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x2] - adds r0, 0x1 - strb r0, [r1, 0x2] - movs r0, 0 -_080C2C78: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C2AD8 - - thumb_func_start sub_80C2C80 -sub_80C2C80: @ 80C2C80 - push {lr} - sub sp, 0x8 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r3, r1, 0 - cmp r0, 0xA - bls _080C2C96 - b _080C2DD8 -_080C2C96: - lsls r0, 2 - ldr r1, =_080C2CA8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C2CA8: - .4byte _080C2CD4 - .4byte _080C2CEC - .4byte _080C2D14 - .4byte _080C2D50 - .4byte _080C2D6A - .4byte _080C2D74 - .4byte _080C2D88 - .4byte _080C2D8E - .4byte _080C2DA0 - .4byte _080C2DA6 - .4byte _080C2DB8 -_080C2CD4: - bl sub_80C334C - bl sub_80C3414 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080C2DCC - .pool -_080C2CEC: - movs r1, 0xE0 - lsls r1, 19 - movs r0, 0 - str r0, [sp] - ldr r0, =0x040000d4 - mov r2, sp - str r2, [r0] - str r1, [r0, 0x4] - ldr r1, =0x85000100 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - movs r0, 0x87 - lsls r0, 3 - adds r1, r3, r0 - b _080C2DCC - .pool -_080C2D14: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052c - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - bne _080C2D36 - movs r2, 0xA0 - lsls r2, 19 - add r1, sp, 0x4 - strh r0, [r1] - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x81000200 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] -_080C2D36: - movs r2, 0x87 - lsls r2, 3 - adds r1, r3, r2 - b _080C2DCC - .pool -_080C2D50: - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetPaletteFade - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C2D6A: - bl sub_80C3388 - b _080C2DC4 - .pool -_080C2D74: - bl sub_80C41D8 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080C2DCC - .pool -_080C2D88: - bl sub_80C2AD8 - b _080C2DBC -_080C2D8E: - bl sub_80C4330 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080C2DCC - .pool -_080C2DA0: - bl sub_80C3278 - b _080C2DC4 -_080C2DA6: - bl sub_80C3548 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080C2DCC - .pool -_080C2DB8: - bl sub_80C43A8 -_080C2DBC: - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080C2DDC -_080C2DC4: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_080C2DCC: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C2DDC - .pool -_080C2DD8: - bl sub_80C3404 -_080C2DDC: - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_80C2C80 - - thumb_func_start sav12_xor_get_clamped_above -sav12_xor_get_clamped_above: @ 80C2DE4 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - bl GetGameStat - cmp r0, r4 - bls _080C2DF6 - adds r0, r4, 0 -_080C2DF6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sav12_xor_get_clamped_above - - thumb_func_start sub_80C2DFC -sub_80C2DFC: @ 80C2DFC - push {r4,r5,lr} - movs r5, 0 -_080C2E00: - lsls r4, r5, 1 - ldr r1, =0x000008c4 - adds r0, r4, r1 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080C2E1E - ldr r1, =0x000008c5 - adds r0, r4, r1 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _080C2E2C -_080C2E1E: - movs r0, 0 - b _080C2E38 - .pool -_080C2E2C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x6 - bls _080C2E00 - movs r0, 0x1 -_080C2E38: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80C2DFC - - thumb_func_start sub_80C2E40 -sub_80C2E40: @ 80C2E40 - push {r4,lr} - movs r0, 0xA - bl GetGameStat - negs r1, r0 - orrs r1, r0 - lsrs r4, r1, 31 - bl sub_80C08E4 - lsls r0, 16 - cmp r0, 0 - beq _080C2E5A - adds r4, 0x1 -_080C2E5A: - bl sub_80F8940 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _080C2E6C - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_080C2E6C: - bl sub_80C2DFC - lsls r0, 24 - cmp r0, 0 - beq _080C2E7C - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_080C2E7C: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80C2E40 - - thumb_func_start sub_80C2E84 -sub_80C2E84: @ 80C2E84 - push {lr} - adds r1, r0, 0 - movs r2, 0 - ldrh r0, [r1, 0x6] - cmp r0, 0 - bne _080C2E96 - ldr r0, [r1, 0x8] - cmp r0, 0 - beq _080C2E98 -_080C2E96: - movs r2, 0x1 -_080C2E98: - ldrb r0, [r1, 0x3] - cmp r0, 0 - beq _080C2EA4 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_080C2EA4: - ldrh r0, [r1, 0x1A] - cmp r0, 0x31 - bls _080C2EB0 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_080C2EB0: - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _080C2EBC - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_080C2EBC: - adds r0, r2, 0 - pop {r1} - bx r1 - thumb_func_end sub_80C2E84 - - thumb_func_start sub_80C2EC4 -sub_80C2EC4: @ 80C2EC4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - ldr r6, =gSaveBlock2Ptr - ldr r1, [r6] - ldrb r0, [r1, 0x8] - strb r0, [r5] - ldrh r0, [r1, 0xE] - strh r0, [r5, 0x10] - ldrb r0, [r1, 0x10] - strh r0, [r5, 0x12] - movs r0, 0x1 - bl GetGameStat - adds r4, r0, 0 - movs r0, 0xA - bl GetGameStat - cmp r0, 0 - bne _080C2EF6 - movs r4, 0 -_080C2EF6: - lsrs r0, r4, 16 - strh r0, [r5, 0x6] - lsrs r1, r4, 8 - movs r2, 0xFF - ands r1, r2 - strh r1, [r5, 0x8] - ands r4, r2 - strh r4, [r5, 0xA] - ldr r1, =0x000003e7 - cmp r0, r1 - bls _080C2F14 - strh r1, [r5, 0x6] - movs r0, 0x3B - strh r0, [r5, 0x8] - strh r0, [r5, 0xA] -_080C2F14: - ldr r0, =0x00000861 - bl FlagGet - strb r0, [r5, 0x2] - bl sub_80C08E4 - strb r0, [r5, 0x3] - bl sub_80C376C - strh r0, [r5, 0xC] - ldr r0, [r6] - ldrb r1, [r0, 0xB] - lsls r1, 8 - ldrb r0, [r0, 0xA] - orrs r0, r1 - strh r0, [r5, 0xE] - ldr r4, =0x0000270f - movs r0, 0x17 - adds r1, r4, 0 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x14] - movs r0, 0x18 - adds r1, r4, 0 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x16] - ldr r1, =0x0000ffff - movs r0, 0x15 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x20] - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - bl GetMoney - str r0, [r5, 0x24] - movs r2, 0 - adds r7, r5, 0 - adds r7, 0x30 - adds r6, r5, 0 - adds r6, 0x28 - ldr r0, [r4] - ldr r1, =0x00002bb0 - adds r3, r0, r1 -_080C2F74: - lsls r0, r2, 1 - adds r1, r6, r0 - adds r0, r3, r0 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _080C2F74 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r0, r7, 0 - bl StringCopy - mov r0, r8 - cmp r0, 0x1 - beq _080C3004 - cmp r0, 0x1 - bgt _080C2FC0 - cmp r0, 0 - beq _080C2FCC - b _080C3014 - .pool -_080C2FC0: - mov r1, r8 - cmp r1, 0x2 - bne _080C3014 - movs r0, 0 - strh r0, [r5, 0x18] - strh r0, [r5, 0x1A] -_080C2FCC: - ldr r1, =0x000003e7 - movs r0, 0x23 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x1C] - ldr r1, =0x0000ffff - movs r0, 0x22 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x1E] - bl sub_80F8940 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _080C2FF0 - movs r0, 0x1 - strb r0, [r5, 0x4] -_080C2FF0: - adds r0, r5, 0 - bl sub_80C2E84 - strb r0, [r5, 0x1] - b _080C3014 - .pool -_080C3004: - movs r1, 0 - movs r0, 0 - strh r0, [r5, 0x18] - strh r0, [r5, 0x1A] - strh r0, [r5, 0x1C] - strh r0, [r5, 0x1E] - strb r1, [r5, 0x4] - strb r1, [r5, 0x1] -_080C3014: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80C2EC4 - - thumb_func_start sub_80C3020 -sub_80C3020: @ 80C3020 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - movs r2, 0x64 - bl memset - adds r1, r4, 0 - adds r1, 0x38 - movs r0, 0x3 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2 - bl sub_80C2EC4 - bl sub_80C2DFC - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - adds r1, 0x60 - strh r0, [r1] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r2, =0x00000eba - adds r0, r2 - ldrh r0, [r0] - adds r2, r4, 0 - adds r2, 0x62 - strh r0, [r2] - ldrh r0, [r1] - cmp r0, 0 - beq _080C3066 - ldrb r0, [r4, 0x1] - adds r0, 0x1 - strb r0, [r4, 0x1] -_080C3066: - ldrb r0, [r4] - cmp r0, 0x1 - bne _080C3084 - ldr r2, =gUnknown_08329D54 - ldrh r0, [r4, 0xE] - movs r1, 0x7 - ands r0, r1 - adds r0, 0x8 - b _080C308C - .pool -_080C3084: - ldr r2, =gUnknown_08329D54 - ldrh r0, [r4, 0xE] - movs r1, 0x7 - ands r0, r1 -_080C308C: - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - adds r0, r4, 0 - adds r0, 0x4F - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3020 - - thumb_func_start TrainerCard_GenerateCardForPlayer -TrainerCard_GenerateCardForPlayer: @ 80C30A4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - movs r2, 0x60 - bl memset - adds r1, r4, 0 - adds r1, 0x38 - movs r0, 0x3 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2 - bl sub_80C2EC4 - bl sub_80C2DFC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x3A] - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - ldr r2, =0x00000eba - adds r1, r2 - ldrh r1, [r1] - strh r1, [r4, 0x3C] - cmp r0, 0 - beq _080C30E0 - ldrb r0, [r4, 0x1] - adds r0, 0x1 - strb r0, [r4, 0x1] -_080C30E0: - ldrb r0, [r4] - cmp r0, 0x1 - bne _080C3100 - ldr r2, =gUnknown_08329D54 - ldrh r0, [r4, 0xE] - movs r1, 0x7 - ands r0, r1 - adds r0, 0x8 - b _080C3108 - .pool -_080C3100: - ldr r2, =gUnknown_08329D54 - ldrh r0, [r4, 0xE] - movs r1, 0x7 - ands r0, r1 -_080C3108: - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - adds r0, r4, 0 - adds r0, 0x4F - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end TrainerCard_GenerateCardForPlayer - - thumb_func_start sub_80C3120 -sub_80C3120: @ 80C3120 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - lsls r4, r2, 24 - lsrs r4, 24 - movs r1, 0 - movs r2, 0x64 - bl memset - adds r0, r5, 0 - adds r0, 0x38 - strb r4, [r0] - adds r0, r4, 0 - bl sub_80C4FCC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080C3162 - cmp r0, 0x1 - bgt _080C3150 - cmp r0, 0 - beq _080C3156 - b _080C318A -_080C3150: - cmp r0, 0x2 - beq _080C316E - b _080C318A -_080C3156: - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x60 - bl memcpy - b _080C318A -_080C3162: - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x38 - bl memcpy - b _080C318A -_080C316E: - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x60 - bl memcpy - movs r0, 0 - str r0, [r5, 0x3C] - ldrh r1, [r6, 0x3A] - adds r0, r5, 0 - adds r0, 0x60 - strh r1, [r0] - ldrh r1, [r6, 0x3C] - adds r0, 0x2 - strh r1, [r0] -_080C318A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80C3120 - - thumb_func_start sub_80C3190 -sub_80C3190: @ 80C3190 - push {r4,r5,lr} - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - movs r1, 0 - strb r1, [r0, 0xA] - ldr r0, [r4] - strb r1, [r0, 0xB] - ldr r0, [r4] - strb r1, [r0, 0xC] - ldr r0, [r4] - strb r1, [r0, 0xD] - ldr r0, [r4] - strb r1, [r0, 0xE] - ldr r0, [r4] - strb r1, [r0, 0xF] - ldr r0, [r4] - strb r1, [r0, 0x10] - ldr r0, [r4] - adds r0, 0x11 - movs r2, 0x8 - bl memset - ldr r1, [r4] - ldr r2, =0x00000536 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C31CE - ldrb r0, [r1, 0xA] - adds r0, 0x1 - strb r0, [r1, 0xA] -_080C31CE: - ldr r1, [r4] - ldr r3, =0x0000053a - adds r0, r1, r3 - ldrh r0, [r0] - cmp r0, 0 - bne _080C31E4 - ldr r2, =0x0000053c - adds r0, r1, r2 - ldr r0, [r0] - cmp r0, 0 - beq _080C31EA -_080C31E4: - ldrb r0, [r1, 0xB] - adds r0, 0x1 - strb r0, [r1, 0xB] -_080C31EA: - ldr r2, =gUnknown_02039CE8 - ldr r1, [r2] - movs r3, 0xA9 - lsls r3, 3 - adds r0, r1, r3 - ldr r0, [r0] - cmp r0, 0 - beq _080C3200 - ldrb r0, [r1, 0xC] - adds r0, 0x1 - strb r0, [r1, 0xC] -_080C3200: - ldr r1, [r2] - ldr r3, =0x00000554 - adds r0, r1, r3 - ldrh r0, [r0] - cmp r0, 0 - beq _080C3212 - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] -_080C3212: - ldr r1, [r2] - ldr r2, =0x0000054c - adds r0, r1, r2 - ldr r0, [r0] - cmp r0, 0 - beq _080C3224 - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] -_080C3224: - movs r5, 0 - ldr r4, =0x00000867 -_080C3228: - lsls r0, r4, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080C3244 - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - adds r1, 0x11 - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C3244: - adds r4, 0x1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =0x0000086e - cmp r4, r0 - bls _080C3228 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3190 - - thumb_func_start sub_80C3278 -sub_80C3278: @ 80C3278 - push {lr} - movs r1, 0xC1 - lsls r1, 6 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r0, 0x50 - movs r1, 0xC1 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x3F - bl SetGpuReg - movs r0, 0x4A - movs r1, 0x1E - bl SetGpuReg - movs r0, 0x44 - movs r1, 0xA0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0xF0 - bl SetGpuReg - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080C32E0 - movs r0, 0xC7 - bl EnableInterrupts - b _080C32E6 - .pool -_080C32E0: - movs r0, 0x3 - bl EnableInterrupts -_080C32E6: - pop {r0} - bx r0 - thumb_func_end sub_80C3278 - - thumb_func_start sub_80C32EC -sub_80C32EC: @ 80C32EC - push {r4,lr} - lsls r0, 16 - lsrs r0, 16 - adds r0, 0x28 - movs r1, 0xA - bl __divsi3 - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, 0x4 - bgt _080C3306 - movs r2, 0 -_080C3306: - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - movs r1, 0xA5 - lsls r1, 3 - adds r0, r1 - strb r2, [r0] - ldr r0, [r4] - adds r0, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x54 - bl SetGpuReg - ldr r0, [r4] - ldr r1, =0x00007ca8 - adds r0, r1 - ldrh r2, [r0] - lsls r1, r2, 8 - movs r0, 0xA0 - subs r0, r2 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x44 - bl SetGpuReg - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C32EC - - thumb_func_start sub_80C334C -sub_80C334C: @ 80C334C - push {lr} - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0x8 - movs r1, 0 - bl SetGpuReg - movs r0, 0xA - movs r1, 0 - bl SetGpuReg - movs r0, 0xC - movs r1, 0 - bl SetGpuReg - movs r0, 0xE - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - thumb_func_end sub_80C334C - - thumb_func_start sub_80C3388 -sub_80C3388: @ 80C3388 - push {lr} - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0856FAB4 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - ldr r0, =gUnknown_0856FAC4 - bl InitWindows - bl DeactivateAllTextPrinters - bl sub_81973A4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3388 - - thumb_func_start sub_80C3404 -sub_80C3404: @ 80C3404 - push {lr} - ldr r0, =sub_80C2710 - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3404 - - thumb_func_start sub_80C3414 -sub_80C3414: @ 80C3414 - push {lr} - bl ResetTasks - bl ScanlineEffect_Stop - ldr r0, =sub_80C2760 - movs r1, 0 - bl CreateTask - bl sub_80C4EE4 - bl sub_80C3190 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3414 - - thumb_func_start sub_80C3438 -sub_80C3438: @ 80C3438 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - cmp r0, 0x5 - bhi _080C3494 - lsls r0, 2 - ldr r1, =_080C3458 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C3458: - .4byte _080C3470 - .4byte _080C3476 - .4byte _080C347C - .4byte _080C3482 - .4byte _080C3488 - .4byte _080C348E -_080C3470: - bl sub_80C3574 - b _080C349C -_080C3476: - bl sub_80C3608 - b _080C349C -_080C347C: - bl sub_80C3684 - b _080C349C -_080C3482: - bl sub_80C378C - b _080C349C -_080C3488: - bl sub_80C3880 - b _080C349C -_080C348E: - bl sub_80C3A18 - b _080C349C -_080C3494: - movs r0, 0 - strb r0, [r1, 0x1] - movs r0, 0x1 - b _080C34A8 -_080C349C: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0 -_080C34A8: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C3438 - - thumb_func_start sub_80C34B0 -sub_80C34B0: @ 80C34B0 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - cmp r0, 0x7 - bhi _080C352C - lsls r0, 2 - ldr r1, =_080C34D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C34D0: - .4byte _080C34F0 - .4byte _080C34F6 - .4byte _080C34FC - .4byte _080C3502 - .4byte _080C3508 - .4byte _080C3512 - .4byte _080C351C - .4byte _080C3526 -_080C34F0: - bl sub_80C3B50 - b _080C3534 -_080C34F6: - bl sub_80C3CCC - b _080C3534 -_080C34FC: - bl sub_80C3D60 - b _080C3534 -_080C3502: - bl sub_80C3DF0 - b _080C3534 -_080C3508: - bl sub_80C3E58 - bl sub_80C3F64 - b _080C3534 -_080C3512: - bl sub_80C3ED4 - bl sub_80C3FE0 - b _080C3534 -_080C351C: - bl sub_80C4140 - bl sub_80C40CC - b _080C3534 -_080C3526: - bl sub_80C42A4 - b _080C3534 -_080C352C: - movs r0, 0 - strb r0, [r1, 0x1] - movs r0, 0x1 - b _080C3540 -_080C3534: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0 -_080C3540: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C34B0 - - thumb_func_start sub_80C3548 -sub_80C3548: @ 80C3548 - push {lr} - bl sub_80C3AF0 - bl sub_80C3BC4 - bl sub_80C3CF4 - bl sub_80C3DC0 - bl sub_80C3E20 - bl sub_80C3E98 - bl sub_80C3F14 - bl sub_80C3FA4 - bl sub_80C4020 - pop {r0} - bx r0 - thumb_func_end sub_80C3548 - - thumb_func_start sub_80C3574 -sub_80C3574: @ 80C3574 - push {r4,r5,lr} - sub sp, 0x2C - ldr r1, =gText_TrainerCardName - add r0, sp, 0xC - bl StringCopy - adds r5, r0, 0 - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r0, =0x00000564 - adds r1, r0 - adds r0, r5, 0 - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00007caa - adds r0, r1 - ldrb r1, [r0] - adds r0, r5, 0 - bl ConvertInternationalString - ldr r0, [r4] - ldr r1, =0x0000052a - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C35E0 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - add r0, sp, 0xC - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x14 - movs r3, 0x1C - bl AddTextPrinterParameterized3 - b _080C35FA - .pool -_080C35E0: - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - add r1, sp, 0xC - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0x21 - bl AddTextPrinterParameterized3 -_080C35FA: - add sp, 0x2C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3574 - - thumb_func_start sub_80C3608 -sub_80C3608: @ 80C3608 - push {r4,lr} - sub sp, 0x2C - ldr r1, =gText_TrainerCardIDNo - add r0, sp, 0xC - bl StringCopy - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r2, =0x00000542 - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - ldr r1, =0x0000052a - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3650 - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x50 - bl GetStringCenterAlignXOffset - adds r0, 0x84 - b _080C365C - .pool -_080C3650: - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x60 - bl GetStringCenterAlignXOffset - adds r0, 0x78 -_080C365C: - movs r3, 0x9 - lsls r2, r0, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - add r0, sp, 0xC - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 - add sp, 0x2C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3608 - - thumb_func_start sub_80C3684 -sub_80C3684: @ 80C3684 - push {r4,r5,lr} - sub sp, 0xC - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C36C4 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardMoney - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x14 - movs r3, 0x38 - bl AddTextPrinterParameterized3 - b _080C36DE - .pool -_080C36C4: - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardMoney - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0x39 - bl AddTextPrinterParameterized3 -_080C36DE: - ldr r0, =gStringVar1 - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - movs r2, 0xAB - lsls r2, 3 - adds r1, r2 - ldr r1, [r1] - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - ldr r5, =gStringVar4 - ldr r1, =gText_PokedollarVar1 - adds r0, r5, 0 - bl StringExpandPlaceholders - ldr r0, [r4] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3734 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x90 - bl GetStringRightAlignXOffset - movs r3, 0x38 - b _080C3740 - .pool -_080C3734: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x80 - bl GetStringRightAlignXOffset - movs r3, 0x39 -_080C3740: - lsls r2, r0, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gStringVar4 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3684 - - thumb_func_start sub_80C376C -sub_80C376C: @ 80C376C - push {lr} - bl IsNationalPokedexEnabled - cmp r0, 0 - bne _080C377E - movs r0, 0x1 - bl GetHoennPokedexCount - b _080C3784 -_080C377E: - movs r0, 0x1 - bl GetNationalPokedexCount -_080C3784: - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_80C376C - - thumb_func_start sub_80C378C -sub_80C378C: @ 80C378C - push {r4,r5,lr} - sub sp, 0xC - ldr r0, =0x00000861 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080C386E - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C37DC - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardPokedex - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x14 - movs r3, 0x48 - bl AddTextPrinterParameterized3 - b _080C37F6 - .pool -_080C37DC: - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardPokedex - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0x49 - bl AddTextPrinterParameterized3 -_080C37F6: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - movs r1, 0xA8 - lsls r1, 3 - adds r0, r1 - ldrh r1, [r0] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r1, =gText_EmptyString6 - bl StringCopy - ldr r0, [r4] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3848 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x90 - bl GetStringRightAlignXOffset - movs r3, 0x48 - b _080C3854 - .pool -_080C3848: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x80 - bl GetStringRightAlignXOffset - movs r3, 0x49 -_080C3854: - lsls r2, r0, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gStringVar4 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 -_080C386E: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C378C - - thumb_func_start sub_80C3880 -sub_80C3880: @ 80C3880 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C38C8 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardTime - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x14 - movs r3, 0x58 - bl AddTextPrinterParameterized3 - b _080C38E2 - .pool -_080C38C8: - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardTime - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0x59 - bl AddTextPrinterParameterized3 -_080C38E2: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x5] - cmp r0, 0 - beq _080C390C - ldr r2, =0x00000544 - adds r0, r1, r2 - ldrh r5, [r0] - adds r2, 0x2 - adds r0, r1, r2 - ldrh r6, [r0] - b _080C3914 - .pool -_080C390C: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrh r5, [r0, 0xE] - ldrb r6, [r0, 0x10] -_080C3914: - ldr r0, =0x000003e7 - cmp r5, r0 - bls _080C391C - adds r5, r0, 0 -_080C391C: - cmp r6, 0x3B - bls _080C3922 - movs r6, 0x3B -_080C3922: - ldr r1, =gText_Colon2 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - mov r10, r0 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3958 - movs r7, 0x90 - movs r4, 0x58 - b _080C395C - .pool -_080C3958: - movs r7, 0x80 - movs r4, 0x59 -_080C395C: - mov r0, r10 - adds r0, 0x1E - subs r7, r0 - lsls r2, r7, 16 - lsrs r2, 16 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - adds r3, r4, 0 - bl FillWindowPixelRect - ldr r2, =gStringVar4 - mov r9, r2 - mov r0, r9 - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - lsls r2, r7, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - mov r8, r0 - str r0, [sp] - movs r5, 0x1 - negs r5, r5 - str r5, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - adds r7, 0x12 - lsls r2, r7, 24 - lsrs r2, 24 - ldr r1, =gUnknown_0856FB40 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldrb r0, [r0, 0x7] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp] - str r5, [sp, 0x4] - ldr r0, =gText_Colon2 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - add r7, r10 - mov r0, r9 - adds r1, r6, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - lsls r2, r7, 24 - lsrs r2, 24 - mov r0, r8 - str r0, [sp] - str r5, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3880 - - thumb_func_start sub_80C3A18 -sub_80C3A18: @ 80C3A18 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - ldr r7, =gUnknown_02039CE8 - ldr r1, [r7] - ldrb r0, [r1, 0x5] - cmp r0, 0 - beq _080C3ACE - ldr r0, =gUnknown_0856FB48 - mov r8, r0 - ldr r4, =0x0000052b - adds r0, r1, r4 - ldrb r0, [r0] - add r0, r8 - ldrb r3, [r0] - ldr r6, =gUnknown_0856FB0C - str r6, [sp] - movs r5, 0x1 - negs r5, r5 - str r5, [sp, 0x4] - adds r0, r1, 0 - adds r0, 0x19 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x8 - bl AddTextPrinterParameterized3 - ldr r1, [r7] - adds r1, 0x19 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r2, r0, 0 - adds r2, 0xE - lsls r2, 24 - lsrs r2, 24 - ldr r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - add r0, r8 - ldrb r3, [r0] - str r6, [sp] - str r5, [sp, 0x4] - adds r1, 0x26 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 - ldr r0, =gUnknown_0856FB4A - mov r8, r0 - ldr r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - add r0, r8 - ldrb r3, [r0] - str r6, [sp] - str r5, [sp, 0x4] - adds r1, 0x33 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x8 - bl AddTextPrinterParameterized3 - ldr r1, [r7] - adds r1, 0x33 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r2, r0, 0 - adds r2, 0xE - lsls r2, 24 - lsrs r2, 24 - ldr r1, [r7] - adds r4, r1, r4 - ldrb r0, [r4] - add r0, r8 - ldrb r3, [r0] - str r6, [sp] - str r5, [sp, 0x4] - adds r1, 0x40 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 -_080C3ACE: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3A18 - - thumb_func_start sub_80C3AF0 -sub_80C3AF0: @ 80C3AF0 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x4D - ldr r2, =0x00000564 - adds r1, r2 - bl StringCopy - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x4D - ldr r2, =0x00007caa - adds r1, r2 - ldrb r1, [r1] - bl ConvertInternationalString - ldr r1, [r4] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C3B30 - ldr r0, =gStringVar1 - adds r1, 0x4D - bl StringCopy - ldr r0, [r4] - adds r0, 0x4D - ldr r1, =gText_Var1sTrainerCard - bl StringExpandPlaceholders -_080C3B30: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3AF0 - - thumb_func_start sub_80C3B50 -sub_80C3B50: @ 80C3B50 - push {r4,lr} - sub sp, 0xC - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r2, =0x0000052b - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3B8C - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - adds r0, r1, 0 - adds r0, 0x4D - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x88 - movs r3, 0x9 - bl AddTextPrinterParameterized3 - b _080C3BB6 - .pool -_080C3B8C: - adds r1, 0x4D - movs r0, 0x1 - movs r2, 0xD8 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, [r4] - adds r0, 0x4D - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0x9 - bl AddTextPrinterParameterized3 -_080C3BB6: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3B50 - - thumb_func_start sub_80C3BC4 -sub_80C3BC4: @ 80C3BC4 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldrb r0, [r1, 0xB] - cmp r0, 0 - beq _080C3C0E - ldr r0, =gStringVar1 - ldr r2, =0x0000053a - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar2 - ldr r1, [r4] - ldr r2, =0x0000053c - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar3 - ldr r1, [r4] - ldr r2, =0x0000053e - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - adds r0, 0x93 - ldr r1, =gUnknown_0856FB4C - bl StringExpandPlaceholders -_080C3C0E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3BC4 - - thumb_func_start sub_80C3C34 -sub_80C3C34: @ 80C3C34 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0xC - adds r4, r0, 0 - mov r9, r2 - mov r10, r3 - ldr r2, =gUnknown_0856FB55 - ldr r6, =gUnknown_02039CE8 - ldr r0, [r6] - ldr r5, =0x0000052b - adds r0, r5 - ldrb r0, [r0] - adds r0, r2 - ldrb r2, [r0] - lsls r4, 28 - movs r0, 0x84 - lsls r0, 22 - adds r4, r0 - lsrs r4, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - mov r8, r0 - str r0, [sp, 0x4] - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - ldr r1, =gUnknown_0856FB57 - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - adds r0, r1 - ldrb r2, [r0] - movs r0, 0x1 - mov r1, r9 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - mov r0, r10 - str r0, [sp] - mov r0, r8 - str r0, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3C34 - - thumb_func_start sub_80C3CCC -sub_80C3CCC: @ 80C3CCC - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldrb r0, [r2, 0xB] - cmp r0, 0 - beq _080C3CE4 - ldr r1, =gText_HallOfFameDebut - adds r2, 0x93 - ldr r3, =gUnknown_0856FB0F - movs r0, 0 - bl sub_80C3C34 -_080C3CE4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3CCC - - thumb_func_start sub_80C3CF4 -sub_80C3CF4: @ 80C3CF4 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldrb r0, [r1, 0xC] - cmp r0, 0 - beq _080C3D40 - adds r0, r1, 0 - adds r0, 0xD9 - ldr r2, =gUnknown_0856FB5C - ldr r3, =0x0000052a - adds r1, r3 - ldrb r1, [r1] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - ldr r1, [r4] - ldr r2, =0x00000165 - adds r0, r1, r2 - movs r3, 0xA9 - lsls r3, 3 - adds r1, r3 - ldrh r1, [r1] - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r1, [r4] - ldr r2, =0x000001ab - adds r0, r1, r2 - ldr r3, =0x0000054a - adds r1, r3 - ldrh r1, [r1] - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN -_080C3D40: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3CF4 - - thumb_func_start sub_80C3D60 -sub_80C3D60: @ 80C3D60 - push {r4,r5,lr} - ldr r5, =gUnknown_02039CE8 - ldr r1, [r5] - ldrb r0, [r1, 0xC] - cmp r0, 0 - beq _080C3D9A - ldr r0, =gStringVar1 - ldr r2, =0x00000165 - adds r1, r2 - bl StringCopy - ldr r0, =gStringVar2 - ldr r1, [r5] - ldr r2, =0x000001ab - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_WinsLosses - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r1, [r5] - adds r1, 0xD9 - ldr r3, =gUnknown_0856FB0C - movs r0, 0x1 - adds r2, r4, 0 - bl sub_80C3C34 -_080C3D9A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3D60 - - thumb_func_start sub_80C3DC0 -sub_80C3DC0: @ 80C3DC0 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x10] - cmp r0, 0 - beq _080C3DDE - ldr r2, =0x00000237 - adds r0, r1, r2 - ldr r2, =0x00000554 - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN -_080C3DDE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3DC0 - - thumb_func_start sub_80C3DF0 -sub_80C3DF0: @ 80C3DF0 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldrb r0, [r2, 0x10] - cmp r0, 0 - beq _080C3E0A - ldr r1, =gText_PokemonTrades - ldr r0, =0x00000237 - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x2 - bl sub_80C3C34 -_080C3E0A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3DF0 - - thumb_func_start sub_80C3E20 -sub_80C3E20: @ 80C3E20 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3E48 - movs r3, 0xAE - lsls r3, 3 - adds r0, r2, r3 - ldr r1, [r0] - cmp r1, 0 - beq _080C3E48 - ldr r3, =0x000002c3 - adds r0, r2, r3 - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN -_080C3E48: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3E20 - - thumb_func_start sub_80C3E58 -sub_80C3E58: @ 80C3E58 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3E80 - adds r1, 0x46 - adds r0, r2, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080C3E80 - ldr r1, =gText_BerryCrush - ldr r0, =0x000002c3 - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x4 - bl sub_80C3C34 -_080C3E80: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3E58 - - thumb_func_start sub_80C3E98 -sub_80C3E98: @ 80C3E98 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3EBE - ldr r3, =0x00000574 - adds r0, r2, r3 - ldr r1, [r0] - cmp r1, 0 - beq _080C3EBE - ldr r3, =0x0000034f - adds r0, r2, r3 - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN -_080C3EBE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3E98 - - thumb_func_start sub_80C3ED4 -sub_80C3ED4: @ 80C3ED4 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3EFC - adds r1, 0x4A - adds r0, r2, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080C3EFC - ldr r1, =gText_UnionTradesAndBattles - ldr r0, =0x0000034f - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x3 - bl sub_80C3C34 -_080C3EFC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3ED4 - - thumb_func_start sub_80C3F14 -sub_80C3F14: @ 80C3F14 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C3F46 - ldr r0, =0x00000552 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _080C3F46 - ldr r0, =gStringVar1 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - ldr r1, =0x00000395 - adds r0, r1 - ldr r1, =gText_Var1DarkGreyShadowLightGrey - bl StringExpandPlaceholders -_080C3F46: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3F14 - - thumb_func_start sub_80C3F64 -sub_80C3F64: @ 80C3F64 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C3F8C - adds r1, 0x28 - adds r0, r2, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C3F8C - ldr r1, =gText_PokeblocksWithFriends - ldr r0, =0x00000395 - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x3 - bl sub_80C3C34 -_080C3F8C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3F64 - - thumb_func_start sub_80C3FA4 -sub_80C3FA4: @ 80C3FA4 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C3FCE - movs r3, 0xAA - lsls r3, 3 - adds r2, r1, r3 - ldrh r0, [r2] - cmp r0, 0 - beq _080C3FCE - ldr r3, =0x000003db - adds r0, r1, r3 - ldrh r1, [r2] - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN -_080C3FCE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3FA4 - - thumb_func_start sub_80C3FE0 -sub_80C3FE0: @ 80C3FE0 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C4008 - adds r1, 0x26 - adds r0, r2, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C4008 - ldr r1, =gText_WonContestsWFriends - ldr r0, =0x000003db - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x4 - bl sub_80C3C34 -_080C4008: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3FE0 - - thumb_func_start sub_80C4020 -sub_80C4020: @ 80C4020 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C4044 - cmp r0, 0x1 - ble _080C40B6 - cmp r0, 0x2 - beq _080C4094 - b _080C40B6 - .pool -_080C4044: - ldrb r0, [r1, 0xD] - cmp r0, 0 - beq _080C40B6 - ldr r0, =gStringVar1 - ldr r2, =0x0000054c - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar2 - ldr r1, [r4] - ldr r2, =0x0000054e - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - ldr r1, =0x00000421 - adds r0, r1 - ldr r1, =gText_WSlashStraightSlash - bl StringExpandPlaceholders - b _080C40B6 - .pool -_080C4094: - ldr r2, =0x00000596 - adds r1, r2 - ldrh r0, [r1] - cmp r0, 0 - beq _080C40B6 - ldr r0, =gStringVar1 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - ldr r1, =0x00000421 - adds r0, r1 - ldr r1, =gText_Var1DarkLightGreyBP - bl StringExpandPlaceholders -_080C40B6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4020 - - thumb_func_start sub_80C40CC -sub_80C40CC: @ 80C40CC - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C40F0 - cmp r0, 0x1 - ble _080C412C - cmp r0, 0x2 - beq _080C4114 - b _080C412C - .pool -_080C40F0: - ldrb r0, [r2, 0xD] - cmp r0, 0 - beq _080C412C - ldr r1, =gText_BattleTower - ldr r0, =0x00000421 - adds r2, r0 - ldr r3, =gUnknown_0856FB0C - movs r0, 0x5 - bl sub_80C3C34 - b _080C412C - .pool -_080C4114: - ldr r1, =0x00000596 - adds r0, r2, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C412C - ldr r1, =gText_BattlePtsWon - ldr r0, =0x00000421 - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x5 - bl sub_80C3C34 -_080C412C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C40CC - - thumb_func_start sub_80C4140 -sub_80C4140: @ 80C4140 - push {r4,r5,lr} - sub sp, 0x20 - ldr r1, =gUnknown_0856FB68 - add r0, sp, 0x10 - movs r2, 0x6 - bl memcpy - add r4, sp, 0x18 - ldr r1, =gUnknown_0856FB6E - adds r0, r4, 0 - movs r2, 0x6 - bl memcpy - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052a - adds r0, r1 - ldrb r0, [r0] - adds r5, r4, 0 - cmp r0, 0 - bne _080C41C0 - movs r4, 0 -_080C416C: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - lsls r1, r4, 1 - movs r2, 0xB1 - lsls r2, 3 - adds r0, r2 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, 0 - beq _080C41B6 - bl sub_80D30A0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r4, 20 - movs r2, 0xE0 - lsls r2, 16 - adds r1, r2 - lsrs r1, 16 - adds r2, r5, r4 - ldrb r2, [r2] - adds r2, 0x3 - lsls r2, 24 - lsrs r2, 24 - movs r3, 0x4 - str r3, [sp] - str r3, [sp, 0x4] - add r0, sp - adds r0, 0x10 - ldrb r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x1 - str r0, [sp, 0xC] - movs r0, 0x3 - movs r3, 0xF - bl WriteSequenceToBgTilemapBuffer -_080C41B6: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _080C416C -_080C41C0: - add sp, 0x20 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4140 - - thumb_func_start sub_80C41D8 -sub_80C41D8: @ 80C41D8 - push {r4,r5,lr} - sub sp, 0x4 - ldr r0, =gMonIconPalettes - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - movs r5, 0x8D - lsls r5, 3 - adds r1, r5 - movs r2, 0x60 - bl CpuSet - ldr r4, [r4] - ldr r1, =0x00000582 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C4214 - cmp r0, 0x1 - ble _080C424A - cmp r0, 0x2 - beq _080C422A - cmp r0, 0x3 - beq _080C4242 - b _080C424A - .pool -_080C4214: - movs r2, 0x8D - lsls r2, 3 - adds r0, r4, r2 - movs r1, 0 - str r1, [sp] - movs r1, 0x60 - movs r2, 0 - movs r3, 0 - bl TintPalette_CustomTone - b _080C424A -_080C422A: - adds r0, r4, r5 - movs r2, 0xFA - lsls r2, 1 - movs r3, 0xA5 - lsls r3, 1 - movs r1, 0x9B - lsls r1, 1 - str r1, [sp] - movs r1, 0x60 - bl TintPalette_CustomTone - b _080C424A -_080C4242: - adds r0, r4, r5 - movs r1, 0x60 - bl TintPalette_SepiaTone -_080C424A: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - movs r1, 0x8D - lsls r1, 3 - adds r0, r1 - movs r1, 0x50 - movs r2, 0xC0 - bl LoadPalette - movs r4, 0 -_080C425E: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - lsls r1, r4, 1 - movs r2, 0xB1 - lsls r2, 3 - adds r0, r2 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, 0 - beq _080C428E - movs r1, 0 - bl GetMonIconTiles - adds r1, r0, 0 - lsls r3, r4, 20 - movs r0, 0x80 - lsls r0, 14 - adds r3, r0 - lsrs r3, 16 - movs r0, 0x3 - movs r2, 0x80 - lsls r2, 2 - bl LoadBgTiles -_080C428E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _080C425E - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C41D8 - - thumb_func_start sub_80C42A4 -sub_80C42A4: @ 80C42A4 - push {r4,lr} - sub sp, 0x14 - ldr r1, =gUnknown_0856FB74 - add r0, sp, 0x10 - movs r2, 0x4 - bl memcpy - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080C4316 - adds r2, 0x56 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - bne _080C4316 - movs r4, 0 -_080C42CC: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x00000584 - adds r0, r1 - adds r0, r4 - ldrb r3, [r0] - cmp r3, 0 - beq _080C430C - lsls r1, r4, 18 - movs r2, 0xA0 - lsls r2, 17 - adds r1, r2 - lsrs r1, 16 - lsls r2, r4, 1 - adds r2, r4 - adds r2, 0x2 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - subs r0, r3, 0x1 - add r0, sp - adds r0, 0x10 - ldrb r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x1 - str r0, [sp, 0xC] - movs r0, 0x3 - movs r3, 0x2 - bl WriteSequenceToBgTilemapBuffer -_080C430C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _080C42CC -_080C4316: - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C42A4 - - thumb_func_start sub_80C4330 -sub_80C4330: @ 80C4330 - push {lr} - ldr r0, =gUnknown_0856F54C - movs r1, 0xB0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0856F56C - movs r1, 0xC0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0856F58C - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0856F5AC - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r0, =0x000017a8 - adds r1, r0 - movs r2, 0x80 - lsls r2, 3 - movs r0, 0x3 - movs r3, 0x80 - bl LoadBgTiles - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4330 - - thumb_func_start sub_80C438C -sub_80C438C: @ 80C438C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80C438C - - thumb_func_start sub_80C43A8 -sub_80C43A8: @ 80C43A8 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - cmp r0, 0x4 - bls _080C43B8 - b _080C4532 -_080C43B8: - lsls r0, 2 - ldr r1, =_080C43CC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C43CC: - .4byte _080C43E0 - .4byte _080C43F8 - .4byte _080C4418 - .4byte _080C44D8 - .4byte _080C4500 -_080C43E0: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r0, =0x000013a8 - adds r1, r0 - movs r2, 0x80 - lsls r2, 3 - movs r0, 0x3 - b _080C4406 - .pool -_080C43F8: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r3, =0x000019a8 - adds r1, r3 - movs r2, 0xC0 - lsls r2, 5 - movs r0, 0 -_080C4406: - movs r3, 0 - bl LoadBgTiles - b _080C4536 - .pool -_080C4418: - ldr r4, =gUnknown_02039CE8 - ldr r2, [r4] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C447C - ldr r1, =gEmeraldTrainerCardStarPals - ldr r3, =0x00000535 - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - movs r2, 0x60 - bl LoadPalette - ldr r0, =gUnknown_0856F4EC - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - ldr r0, [r4] - ldr r1, =0x00000534 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C44B2 - ldr r0, =gUnknown_0856F4AC - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - b _080C44B2 - .pool -_080C447C: - ldr r1, =gFireRedTrainerCardStarPals - ldr r3, =0x00000535 - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - movs r2, 0x60 - bl LoadPalette - ldr r0, =gUnknown_0856F50C - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - ldr r0, [r4] - ldr r1, =0x00000534 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C44B2 - ldr r0, =gUnknown_0856F4CC - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette -_080C44B2: - ldr r0, =gUnknown_0856F52C - movs r1, 0x40 - movs r2, 0x20 - bl LoadPalette - b _080C4536 - .pool -_080C44D8: - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r3, =0x00003ca8 - adds r1, r3 - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00005ca8 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - b _080C4536 - .pool -_080C4500: - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 -_080C4532: - movs r0, 0x1 - b _080C4542 -_080C4536: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x3] - adds r0, 0x1 - strb r0, [r1, 0x3] - movs r0, 0 -_080C4542: - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C43A8 - - thumb_func_start sub_80C4550 -sub_80C4550: @ 80C4550 - push {r4-r7,lr} - adds r7, r0, 0 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x00005ca8 - adds r6, r0, r1 - movs r1, 0 -_080C455E: - movs r2, 0 - lsls r5, r1, 16 - asrs r1, r5, 16 - lsls r3, r1, 5 - lsls r0, r1, 4 - subs r0, r1 - lsls r4, r0, 1 -_080C456C: - lsls r0, r2, 16 - asrs r1, r0, 16 - adds r2, r0, 0 - cmp r1, 0x1D - bgt _080C4590 - adds r0, r3, r1 - lsls r0, 1 - adds r0, r6 - adds r1, r4, r1 - lsls r1, 1 - adds r1, r7 - ldrh r1, [r1] - b _080C4598 - .pool -_080C4590: - adds r0, r3, r1 - lsls r0, 1 - adds r0, r6 - ldrh r1, [r7] -_080C4598: - strh r1, [r0] - movs r1, 0x80 - lsls r1, 9 - adds r0, r2, r1 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, 0x1F - ble _080C456C - adds r0, r5, r1 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _080C455E - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80C4550 - - thumb_func_start sub_80C45C0 -sub_80C45C0: @ 80C45C0 - push {r4-r7,lr} - adds r7, r0, 0 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x00003ca8 - adds r6, r0, r1 - movs r1, 0 -_080C45CE: - movs r2, 0 - lsls r5, r1, 16 - asrs r1, r5, 16 - lsls r3, r1, 5 - lsls r0, r1, 4 - subs r0, r1 - lsls r4, r0, 1 -_080C45DC: - lsls r0, r2, 16 - asrs r1, r0, 16 - adds r2, r0, 0 - cmp r1, 0x1D - bgt _080C4600 - adds r0, r3, r1 - lsls r0, 1 - adds r0, r6 - adds r1, r4, r1 - lsls r1, 1 - adds r1, r7 - ldrh r1, [r1] - b _080C4608 - .pool -_080C4600: - adds r0, r3, r1 - lsls r0, 1 - adds r0, r6 - ldrh r1, [r7] -_080C4608: - strh r1, [r0] - movs r1, 0x80 - lsls r1, 9 - adds r0, r2, r1 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, 0x1F - ble _080C45DC - adds r0, r5, r1 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _080C45CE - movs r0, 0 - bl CopyBgTilemapBufferToVram - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80C45C0 - - thumb_func_start sub_80C4630 -sub_80C4630: @ 80C4630 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - movs r0, 0xC0 - mov r8, r0 - movs r2, 0x3 - mov r10, r2 - ldr r2, =gUnknown_0856FB78 - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r3, =0x0000052b - adds r0, r1, r3 - ldrb r0, [r0] - adds r0, r2 - ldrb r3, [r0] - ldr r0, =0x00000535 - adds r1, r0 - ldrb r0, [r1] - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x4 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8F - movs r2, 0xF - bl FillBgTilemapBufferRect - ldr r0, [r4] - ldrb r0, [r0, 0x5] - cmp r0, 0 - bne _080C4724 - movs r2, 0x4 - mov r9, r2 - movs r2, 0 - movs r6, 0x1 -_080C467E: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - lsls r0, r2, 16 - asrs r7, r0, 16 - adds r1, 0x11 - adds r1, r7 - ldrb r0, [r1] - cmp r0, 0 - beq _080C4700 - mov r3, r9 - lsls r5, r3, 24 - lsrs r5, 24 - str r6, [sp] - str r6, [sp, 0x4] - mov r0, r10 - str r0, [sp, 0x8] - movs r0, 0x3 - mov r1, r8 - adds r2, r5, 0 - movs r3, 0xF - bl FillBgTilemapBufferRect - mov r1, r8 - adds r1, 0x1 - lsls r1, 16 - lsrs r1, 16 - mov r4, r9 - adds r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - str r6, [sp] - str r6, [sp, 0x4] - mov r2, r10 - str r2, [sp, 0x8] - movs r0, 0x3 - adds r2, r4, 0 - movs r3, 0xF - bl FillBgTilemapBufferRect - mov r1, r8 - adds r1, 0x10 - lsls r1, 16 - lsrs r1, 16 - str r6, [sp] - str r6, [sp, 0x4] - mov r3, r10 - str r3, [sp, 0x8] - movs r0, 0x3 - adds r2, r5, 0 - movs r3, 0x10 - bl FillBgTilemapBufferRect - mov r1, r8 - adds r1, 0x11 - lsls r1, 16 - lsrs r1, 16 - str r6, [sp] - str r6, [sp, 0x4] - mov r0, r10 - str r0, [sp, 0x8] - movs r0, 0x3 - adds r2, r4, 0 - movs r3, 0x10 - bl FillBgTilemapBufferRect -_080C4700: - adds r0, r7, 0x1 - lsls r0, 16 - mov r1, r8 - adds r1, 0x2 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - mov r2, r9 - lsls r1, r2, 16 - movs r3, 0xC0 - lsls r3, 10 - adds r1, r3 - lsrs r1, 16 - mov r9, r1 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080C467E -_080C4724: - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4630 - - thumb_func_start sub_80C474C -sub_80C474C: @ 80C474C - push {r4-r6,lr} - sub sp, 0xC - ldr r6, =gUnknown_02039CE8 - ldr r1, [r6] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080C4800 - ldrb r0, [r1, 0x10] - cmp r0, 0 - beq _080C478A - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x1B - movs r3, 0x9 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x1B - movs r3, 0xA - bl FillBgTilemapBufferRect -_080C478A: - ldr r0, [r6] - movs r1, 0xAE - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080C47BE - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x15 - movs r3, 0xD - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x15 - movs r3, 0xE - bl FillBgTilemapBufferRect -_080C47BE: - ldr r0, [r6] - ldr r2, =0x00000574 - adds r0, r2 - ldr r0, [r0] - cmp r0, 0 - beq _080C48B8 - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x1B - movs r3, 0xB - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x1B - movs r3, 0xC - bl FillBgTilemapBufferRect - b _080C48B8 - .pool -_080C4800: - ldrb r0, [r1, 0x10] - cmp r0, 0 - beq _080C482E - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x1B - movs r3, 0x9 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x1B - movs r3, 0xA - bl FillBgTilemapBufferRect -_080C482E: - ldr r0, [r6] - movs r1, 0xAA - lsls r1, 3 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C4864 - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x1B - movs r3, 0xD - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x1B - movs r3, 0xE - bl FillBgTilemapBufferRect -_080C4864: - ldr r0, [r6] - ldrb r0, [r0, 0xD] - cmp r0, 0 - beq _080C48B8 - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x11 - movs r3, 0xF - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x11 - movs r3, 0x10 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8C - movs r2, 0x1B - movs r3, 0xF - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9C - movs r2, 0x1B - movs r3, 0x10 - bl FillBgTilemapBufferRect -_080C48B8: - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80C474C - - thumb_func_start sub_80C48C8 -sub_80C48C8: @ 80C48C8 - push {lr} - ldr r3, =gUnknown_02039CE8 - ldr r1, [r3] - ldrb r0, [r1, 0x6] - adds r0, 0x1 - strb r0, [r1, 0x6] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3C - bls _080C48F6 - ldr r1, [r3] - movs r0, 0 - strb r0, [r1, 0x6] - ldr r2, [r3] - ldrb r0, [r2, 0x7] - movs r1, 0x1 - eors r0, r1 - strb r0, [r2, 0x7] - ldr r0, [r3] - ldr r1, =0x00000529 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] -_080C48F6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C48C8 - - thumb_func_start sub_80C4904 -sub_80C4904: @ 80C4904 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTrainerCards - movs r1, 0x64 - muls r0, r1 - adds r0, r2 - ldrb r0, [r0, 0x1] - bx lr - .pool - thumb_func_end sub_80C4904 - - thumb_func_start sub_80C4918 -sub_80C4918: @ 80C4918 - push {r4,lr} - ldr r4, =sub_80C4960 - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - ldr r0, =sub_80C26D4 - bl SetHBlankCallback - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4918 - - thumb_func_start sub_80C4940 -sub_80C4940: @ 80C4940 - push {lr} - ldr r0, =sub_80C4960 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _080C4958 - movs r0, 0 - b _080C495A - .pool -_080C4958: - movs r0, 0x1 -_080C495A: - pop {r1} - bx r1 - thumb_func_end sub_80C4940 - - thumb_func_start sub_80C4960 -sub_80C4960: @ 80C4960 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0856FB28 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_080C4972: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _080C4972 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4960 - - thumb_func_start sub_80C4998 -sub_80C4998: @ 80C4998 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - bl HideBg - movs r0, 0x3 - bl HideBg - bl ScanlineEffect_Stop - bl ScanlineEffect_Clear - movs r1, 0 - ldr r0, =gScanlineEffectRegBuffers - movs r2, 0 - movs r3, 0xF0 - lsls r3, 3 - adds r0, r3 -_080C49BC: - strh r2, [r0] - adds r0, 0x2 - adds r1, 0x1 - cmp r1, 0x9F - bls _080C49BC - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C4998 - - thumb_func_start sub_80C49D8 -sub_80C49D8: @ 80C49D8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r8, r0 - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - movs r0, 0 - strb r0, [r1, 0x9] - mov r0, r8 - ldrh r1, [r0, 0xA] - movs r2, 0xA - ldrsh r0, [r0, r2] - cmp r0, 0x4C - ble _080C4A08 - movs r0, 0x4D - mov r3, r8 - strh r0, [r3, 0xA] - b _080C4A0E - .pool -_080C4A08: - adds r0, r1, 0x7 - mov r4, r8 - strh r0, [r4, 0xA] -_080C4A0E: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - mov r2, r8 - ldrh r1, [r2, 0xA] - ldr r3, =0x00007ca8 - adds r0, r3 - strh r1, [r0] - ldrh r0, [r2, 0xA] - bl sub_80C32EC - mov r4, r8 - movs r0, 0xA - ldrsh r7, [r4, r0] - movs r0, 0xA0 - subs r0, r7 - mov r9, r0 - subs r4, r0, r7 - negs r0, r7 - lsls r6, r0, 16 - movs r0, 0xA0 - lsls r0, 16 - adds r1, r4, 0 - bl __udivsi3 - adds r5, r0, 0 - ldr r1, =0xffff0000 - adds r5, r1 - adds r0, r5, 0 - muls r0, r4 - adds r0, r6, r0 - str r0, [sp] - adds r0, r5, 0 - adds r1, r4, 0 - bl __udivsi3 - mov r10, r0 - lsls r5, 1 - movs r2, 0 - cmp r2, r7 - bcs _080C4A78 - ldr r3, =gScanlineEffectRegBuffers -_080C4A60: - lsls r0, r2, 16 - asrs r0, 16 - lsls r1, r0, 1 - adds r1, r3 - negs r2, r0 - strh r2, [r1] - adds r0, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, r7 - bcc _080C4A60 -_080C4A78: - lsls r1, r2, 16 - mov r3, r9 - lsls r0, r3, 16 - asrs r3, r0, 16 - ldr r4, =gUnknown_02039CE8 - mov r9, r4 - ldr r4, [sp] - lsrs r7, r4, 16 - cmp r1, r0 - bge _080C4AB0 - ldr r0, =gScanlineEffectRegBuffers - mov r12, r0 - adds r4, r3, 0 -_080C4A92: - lsrs r3, r6, 16 - adds r6, r5 - mov r2, r10 - subs r5, r2 - asrs r0, r1, 16 - lsls r1, r0, 1 - add r1, r12 - strh r3, [r1] - adds r0, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, r2, 16 - asrs r0, r1, 16 - cmp r0, r4 - blt _080C4A92 -_080C4AB0: - adds r3, r7, 0 - lsls r1, r2, 16 - asrs r0, r1, 16 - cmp r0, 0x9F - bgt _080C4ACE - ldr r2, =gScanlineEffectRegBuffers -_080C4ABC: - asrs r0, r1, 16 - lsls r1, r0, 1 - adds r1, r2 - strh r3, [r1] - adds r0, 0x1 - lsls r1, r0, 16 - asrs r0, r1, 16 - cmp r0, 0x9F - ble _080C4ABC -_080C4ACE: - mov r3, r9 - ldr r0, [r3] - movs r1, 0x1 - strb r1, [r0, 0x9] - mov r4, r8 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x4C - ble _080C4AE6 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080C4AE6: - movs r0, 0 - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C49D8 - - thumb_func_start sub_80C4B08 -sub_80C4B08: @ 80C4B08 - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r0, 0 - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0x9] - bl sub_8087598 - adds r2, r4, 0 - cmp r0, 0x1 - beq _080C4C08 -_080C4B20: - ldr r3, [r2] - ldrb r0, [r3, 0x4] - cmp r0, 0x4 - bhi _080C4BE4 - lsls r0, 2 - ldr r1, =_080C4B3C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C4B3C: - .4byte _080C4B50 - .4byte _080C4B6C - .4byte _080C4B8C - .4byte _080C4BB0 - .4byte _080C4BCE -_080C4B50: - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - b _080C4BF6 -_080C4B6C: - ldr r0, [r2] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _080C4B80 - bl sub_80C34B0 - lsls r0, 24 - cmp r0, 0 - bne _080C4BF6 - b _080C4C08 -_080C4B80: - bl sub_80C3438 - lsls r0, 24 - cmp r0, 0 - bne _080C4BF6 - b _080C4C08 -_080C4B8C: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x8] - cmp r0, 0 - bne _080C4BA8 - ldr r2, =0x00000a48 - adds r0, r1, r2 - bl sub_80C45C0 - b _080C4BF6 - .pool -_080C4BA8: - movs r0, 0x1 - bl sub_80C438C - b _080C4BF6 -_080C4BB0: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _080C4BC4 - bl sub_80C474C - b _080C4BF6 - .pool -_080C4BC4: - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - b _080C4BF6 -_080C4BCE: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - beq _080C4BF6 - bl sub_80C4FF0 - b _080C4BF6 - .pool -_080C4BE4: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - movs r1, 0 - strh r0, [r5, 0x8] - movs r0, 0x1 - strb r0, [r3, 0x9] - ldr r0, [r2] - strb r1, [r0, 0x4] - b _080C4C08 -_080C4BF6: - ldr r2, =gUnknown_02039CE8 - ldr r1, [r2] - ldrb r0, [r1, 0x4] - adds r0, 0x1 - strb r0, [r1, 0x4] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080C4B20 -_080C4C08: - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C4B08 - - thumb_func_start sub_80C4C1C -sub_80C4C1C: @ 80C4C1C - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0x9] - ldr r0, [r4] - ldrb r0, [r0, 0x8] - cmp r0, 0 - beq _080C4C50 - movs r0, 0x2 - bl sub_80C438C - ldr r0, [r4] - ldr r1, =0x00000ef8 - adds r0, r1 - bl sub_80C4550 - ldr r0, [r4] - movs r1, 0xB3 - lsls r1, 3 - adds r0, r1 - bl sub_80C45C0 - bl sub_80C4630 -_080C4C50: - movs r0, 0x1 - bl sub_80C438C - ldr r2, [r4] - ldrb r0, [r2, 0x8] - movs r1, 0x1 - eors r0, r1 - strb r0, [r2, 0x8] - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - ldr r1, [r4] - movs r0, 0x1 - strb r0, [r1, 0x9] - movs r0, 0xFA - bl PlaySE - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C4C1C - - thumb_func_start sub_80C4C84 -sub_80C4C84: @ 80C4C84 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r8, r0 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - movs r2, 0 - strb r2, [r0, 0x9] - mov r0, r8 - ldrh r1, [r0, 0xA] - movs r3, 0xA - ldrsh r0, [r0, r3] - cmp r0, 0x5 - bgt _080C4CB0 - mov r4, r8 - strh r2, [r4, 0xA] - b _080C4CB6 - .pool -_080C4CB0: - subs r0, r1, 0x5 - mov r1, r8 - strh r0, [r1, 0xA] -_080C4CB6: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - mov r2, r8 - ldrh r1, [r2, 0xA] - ldr r3, =0x00007ca8 - adds r0, r3 - strh r1, [r0] - ldrh r0, [r2, 0xA] - bl sub_80C32EC - mov r4, r8 - movs r0, 0xA - ldrsh r7, [r4, r0] - movs r0, 0xA0 - subs r0, r7 - mov r9, r0 - subs r4, r0, r7 - negs r0, r7 - lsls r6, r0, 16 - movs r0, 0xA0 - lsls r0, 16 - adds r1, r4, 0 - bl __udivsi3 - adds r5, r0, 0 - ldr r1, =0xffff0000 - adds r5, r1 - adds r0, r5, 0 - muls r0, r4 - adds r0, r6, r0 - str r0, [sp] - adds r0, r5, 0 - adds r1, r4, 0 - bl __udivsi3 - mov r10, r0 - lsrs r5, 1 - movs r2, 0 - cmp r2, r7 - bcs _080C4D20 - ldr r3, =gScanlineEffectRegBuffers -_080C4D08: - lsls r0, r2, 16 - asrs r0, 16 - lsls r1, r0, 1 - adds r1, r3 - negs r2, r0 - strh r2, [r1] - adds r0, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, r7 - bcc _080C4D08 -_080C4D20: - lsls r1, r2, 16 - mov r3, r9 - lsls r0, r3, 16 - asrs r3, r0, 16 - ldr r4, =gUnknown_02039CE8 - mov r9, r4 - ldr r4, [sp] - lsrs r7, r4, 16 - cmp r1, r0 - bge _080C4D56 - ldr r0, =gScanlineEffectRegBuffers - mov r12, r0 - adds r4, r3, 0 -_080C4D3A: - lsrs r3, r6, 16 - adds r6, r5 - add r5, r10 - asrs r0, r1, 16 - lsls r1, r0, 1 - add r1, r12 - strh r3, [r1] - adds r0, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, r2, 16 - asrs r0, r1, 16 - cmp r0, r4 - blt _080C4D3A -_080C4D56: - adds r3, r7, 0 - lsls r1, r2, 16 - asrs r0, r1, 16 - cmp r0, 0x9F - bgt _080C4D74 - ldr r2, =gScanlineEffectRegBuffers -_080C4D62: - asrs r0, r1, 16 - lsls r1, r0, 1 - adds r1, r2 - strh r3, [r1] - adds r0, 0x1 - lsls r1, r0, 16 - asrs r0, r1, 16 - cmp r0, 0x9F - ble _080C4D62 -_080C4D74: - mov r1, r9 - ldr r0, [r1] - movs r1, 0x1 - strb r1, [r0, 0x9] - mov r2, r8 - movs r3, 0xA - ldrsh r0, [r2, r3] - cmp r0, 0 - bgt _080C4D8C - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] -_080C4D8C: - movs r0, 0 - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C4C84 - - thumb_func_start sub_80C4DB0 -sub_80C4DB0: @ 80C4DB0 - push {lr} - movs r0, 0x1 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r0, 0 - bl SetHBlankCallback - ldr r0, =sub_80C4960 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C4DB0 - - thumb_func_start sub_80C4DDC -sub_80C4DDC: @ 80C4DDC - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gUnknown_02039CE8 - ldr r0, =0x00007cac - bl AllocZeroed - adds r1, r0, 0 - str r1, [r4] - movs r2, 0xA6 - lsls r2, 3 - adds r0, r1, r2 - str r5, [r0] - ldr r0, =sub_80C5868 - cmp r5, r0 - bne _080C4E18 - ldr r0, =0x0000052c - adds r1, r0 - ldr r0, =0x00007fff - b _080C4E1E - .pool -_080C4E18: - ldr r2, =0x0000052c - adds r1, r2 - movs r0, 0 -_080C4E1E: - strh r0, [r1] - bl InUnionRoom - adds r3, r0, 0 - cmp r3, 0x1 - bne _080C4E3C - ldr r1, =gUnknown_02039CE8 - ldr r0, [r1] - strb r3, [r0, 0x5] - adds r2, r1, 0 - b _080C4E44 - .pool -_080C4E3C: - ldr r2, =gUnknown_02039CE8 - ldr r1, [r2] - movs r0, 0 - strb r0, [r1, 0x5] -_080C4E44: - ldr r0, [r2] - ldr r1, =0x00007caa - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x00000534 - adds r0, r2 - bl sub_80C3020 - ldr r0, =sub_80C2C80 - bl SetMainCallback2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4DDC - - thumb_func_start TrainerCard_ShowLinkCard -TrainerCard_ShowLinkCard: @ 80C4E74 - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_02039CE8 - ldr r0, =0x00007cac - bl AllocZeroed - str r0, [r5] - movs r2, 0xA6 - lsls r2, 3 - adds r1, r0, r2 - str r6, [r1] - movs r1, 0x1 - strb r1, [r0, 0x5] - ldr r0, [r5] - ldr r1, =0x00000534 - adds r0, r1 - ldr r2, =gTrainerCards - movs r1, 0x64 - muls r1, r4 - adds r1, r2 - movs r2, 0x64 - bl memcpy - ldr r1, [r5] - ldr r2, =gLinkPlayers - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x1A] - ldr r2, =0x00007caa - adds r1, r2 - strb r0, [r1] - ldr r0, =sub_80C2C80 - bl SetMainCallback2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end TrainerCard_ShowLinkCard - - thumb_func_start sub_80C4EE4 -sub_80C4EE4: @ 80C4EE4 - push {r4,r5,lr} - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - movs r1, 0 - strb r1, [r0] - ldr r2, [r4] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x12] - strb r0, [r2, 0x6] - ldr r0, [r4] - strb r1, [r0, 0x7] - ldr r0, [r4] - strb r1, [r0, 0x8] - ldr r0, [r4] - movs r2, 0xA5 - lsls r2, 3 - adds r0, r2 - strb r1, [r0] - bl sub_80C4F50 - ldr r1, [r4] - ldr r3, =0x0000052a - adds r1, r3 - strb r0, [r1] - movs r5, 0 -_080C4F18: - movs r0, 0xD - muls r0, r5 - adds r0, 0x19 - ldr r1, [r4] - adds r0, r1, r0 - lsls r2, r5, 1 - ldr r3, =0x0000055c - adds r1, r3 - adds r1, r2 - ldrh r1, [r1] - bl CopyEasyChatWord - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _080C4F18 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4EE4 - - thumb_func_start sub_80C4F50 -sub_80C4F50: @ 80C4F50 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - cmp r1, 0 - bne _080C4F7C - ldr r0, =gGameVersion - ldrb r1, [r0] - subs r0, r1, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _080C4F74 - movs r0, 0 - b _080C4FC2 - .pool -_080C4F74: - cmp r1, 0x3 - beq _080C4FC0 - movs r0, 0x1 - b _080C4FC2 -_080C4F7C: - ldr r2, =0x0000056c - adds r0, r1, r2 - ldrb r2, [r0] - subs r0, r2, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _080C4FA0 - ldr r0, =0x0000052b - adds r1, r0 - movs r0, 0 - strb r0, [r1] - b _080C4FC2 - .pool -_080C4FA0: - lsls r0, r2, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _080C4FB8 - ldr r2, =0x0000052b - adds r1, r2 - movs r0, 0x1 - strb r0, [r1] - b _080C4FC2 - .pool -_080C4FB8: - ldr r0, =0x0000052b - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] -_080C4FC0: - movs r0, 0x2 -_080C4FC2: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C4F50 - - thumb_func_start sub_80C4FCC -sub_80C4FCC: @ 80C4FCC - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - movs r2, 0xFC - lsls r2, 24 - adds r0, r2 - lsrs r0, 24 - cmp r0, 0x1 - bhi _080C4FE2 - movs r0, 0 - b _080C4FEC -_080C4FE2: - cmp r1, 0x3 - beq _080C4FEA - movs r0, 0x1 - b _080C4FEC -_080C4FEA: - movs r0, 0x2 -_080C4FEC: - pop {r1} - bx r1 - thumb_func_end sub_80C4FCC - - thumb_func_start sub_80C4FF0 -sub_80C4FF0: @ 80C4FF0 - push {r4-r6,lr} - sub sp, 0x8 - bl InUnionRoom - cmp r0, 0x1 - bne _080C5060 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - bne _080C5060 - ldr r5, =gUnknown_02039CE8 - ldr r0, [r5] - ldr r1, =0x00000583 - adds r0, r1 - ldrb r0, [r0] - bl FacilityClassToPicIndex - lsls r0, 16 - lsrs r0, 16 - ldr r4, =gUnknown_0856FB18 - ldr r1, [r5] - ldr r3, =0x00000534 - adds r2, r1, r3 - ldrb r3, [r2] - lsls r3, 1 - ldr r2, =0x0000052b - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - adds r3, r1 - adds r1, r3, r4 - ldrb r2, [r1] - adds r4, 0x1 - adds r3, r4 - ldrb r3, [r3] - movs r1, 0x8 - str r1, [sp] - movs r1, 0x2 - str r1, [sp, 0x4] - movs r1, 0x1 - bl sub_818D938 - b _080C50AE - .pool -_080C5060: - ldr r2, =gUnknown_0856FB20 - ldr r6, =gUnknown_02039CE8 - ldr r0, [r6] - ldr r5, =0x00000534 - adds r1, r0, r5 - ldr r3, =0x0000052a - adds r0, r3 - ldrb r0, [r0] - lsls r0, 1 - ldrb r1, [r1] - adds r0, r1 - adds r0, r2 - ldrb r0, [r0] - bl FacilityClassToPicIndex - lsls r0, 16 - lsrs r0, 16 - ldr r4, =gUnknown_0856FB18 - ldr r1, [r6] - adds r5, r1, r5 - ldrb r3, [r5] - lsls r3, 1 - ldr r2, =0x0000052b - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - adds r3, r1 - adds r1, r3, r4 - ldrb r2, [r1] - adds r4, 0x1 - adds r3, r4 - ldrb r3, [r3] - movs r1, 0x8 - str r1, [sp] - movs r1, 0x2 - str r1, [sp, 0x4] - movs r1, 0x1 - bl sub_818D938 -_080C50AE: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4FF0 - - thumb_func_start sub_80C50D0 -sub_80C50D0: @ 80C50D0 - push {lr} - sub sp, 0x8 - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0xE - movs r1, 0 - bl SetGpuReg - movs r0, 0xC - movs r1, 0 - bl SetGpuReg - movs r0, 0xA - movs r1, 0 - bl SetGpuReg - movs r0, 0x8 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x42 - movs r1, 0 - bl SetGpuReg - movs r0, 0x46 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - mov r1, sp - movs r0, 0 - strh r0, [r1] - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x0100c000 - mov r0, sp - bl CpuSet - movs r0, 0 - str r0, [sp, 0x4] - add r0, sp, 0x4 - movs r1, 0xE0 - lsls r1, 19 - ldr r2, =0x05000100 - bl CpuSet - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C50D0 - - thumb_func_start sub_80C51C4 -sub_80C51C4: @ 80C51C4 - push {lr} - bl sub_80C51F0 - ldr r0, =sub_80C544C - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C51C4 - - thumb_func_start sub_80C51D8 -sub_80C51D8: @ 80C51D8 - push {lr} - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldr r0, [r0] - bl SetMainCallback2 - bl sub_80C52E4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C51D8 - - thumb_func_start sub_80C51F0 -sub_80C51F0: @ 80C51F0 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_02039CEC - ldr r0, [r5] - cmp r0, 0 - beq _080C5204 - movs r0, 0x1 - b _080C52C8 - .pool -_080C5204: - movs r0, 0x18 - bl AllocZeroed - str r0, [r5] - cmp r0, 0 - bne _080C5214 - movs r0, 0x2 - b _080C52C8 -_080C5214: - str r4, [r0] - bl GetCurrentRegionMapSectionId - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3A - beq _080C5232 - cmp r4, 0xCA - beq _080C5232 - ldr r0, [r5] - movs r1, 0xB0 - strh r1, [r0, 0x8] - movs r1, 0x68 - strh r1, [r0, 0xA] - b _080C5240 -_080C5232: - ldr r2, =gUnknown_02039CEC - ldr r1, [r2] - movs r0, 0xB0 - strh r0, [r1, 0x8] - movs r0, 0x30 - strh r0, [r1, 0xA] - adds r5, r2, 0 -_080C5240: - ldr r1, [r5] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r2, =0x00000eb8 - adds r0, r2 - ldrh r0, [r0] - strh r0, [r1, 0x6] - bl CanCopyRecordedBattleSaveData - ldr r3, [r5] - movs r1, 0x1 - ands r0, r1 - ldrb r2, [r3, 0xE] - movs r1, 0x2 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xE] - ldr r2, [r5] - ldrb r1, [r2, 0xE] - movs r0, 0xF - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0xE] - bl sub_80C2E40 - ldr r3, [r5] - lsls r0, 4 - ldrb r2, [r3, 0xE] - movs r1, 0xF - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xE] - movs r4, 0 - adds r6, r5, 0 -_080C5286: - lsls r5, r4, 1 - ldr r1, =0x000008c4 - adds r0, r5, r1 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080C52A2 - ldr r1, [r6] - adds r1, 0xF - adds r1, r4 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C52A2: - ldr r2, =0x000008c5 - adds r0, r5, r2 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080C52BC - ldr r1, [r6] - adds r1, 0xF - adds r1, r4 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C52BC: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bls _080C5286 - movs r0, 0 -_080C52C8: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C51F0 - - thumb_func_start sub_80C52E4 -sub_80C52E4: @ 80C52E4 - push {r4,lr} - ldr r4, =gUnknown_02039CEC - ldr r0, [r4] - cmp r0, 0 - beq _080C5308 - movs r1, 0 - movs r2, 0x18 - bl memset - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - b _080C530A - .pool -_080C5308: - movs r0, 0x1 -_080C530A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80C52E4 - - thumb_func_start sub_80C5310 -sub_80C5310: @ 80C5310 - push {r4,lr} - ldr r4, =gUnknown_02039CF0 - ldr r0, [r4] - cmp r0, 0 - beq _080C5324 - movs r0, 0x1 - b _080C533A - .pool -_080C5324: - ldr r0, =0x00002434 - bl AllocZeroed - str r0, [r4] - cmp r0, 0 - beq _080C5338 - movs r0, 0 - b _080C533A - .pool -_080C5338: - movs r0, 0x2 -_080C533A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80C5310 - - thumb_func_start sub_80C5340 -sub_80C5340: @ 80C5340 - push {r4,lr} - bl FreeAllWindowBuffers - ldr r4, =gUnknown_02039CF0 - ldr r0, [r4] - cmp r0, 0 - bne _080C5358 - movs r0, 0x1 - b _080C53A0 - .pool -_080C5358: - ldr r0, [r0, 0x28] - cmp r0, 0 - beq _080C5368 - bl Free - ldr r1, [r4] - movs r0, 0 - str r0, [r1, 0x28] -_080C5368: - ldr r0, [r4] - ldr r0, [r0, 0x24] - cmp r0, 0 - beq _080C537A - bl Free - ldr r1, [r4] - movs r0, 0 - str r0, [r1, 0x24] -_080C537A: - ldr r0, [r4] - ldr r0, [r0, 0x20] - cmp r0, 0 - beq _080C538C - bl Free - ldr r1, [r4] - movs r0, 0 - str r0, [r1, 0x20] -_080C538C: - ldr r0, [r4] - ldr r2, =0x00002434 - movs r1, 0 - bl memset - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_080C53A0: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C5340 - - thumb_func_start pokemon_details -pokemon_details: @ 80C53AC - push {r4-r7,lr} - sub sp, 0x10 - ldr r0, =gUnknown_02039CF0 - ldr r6, [r0] - adds r0, r6, 0 - adds r0, 0x2C - ldrb r0, [r0] - cmp r0, 0 - beq _080C5416 - ldr r3, =gUnknown_085713E0 - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldrb r4, [r0, 0xE] - lsls r4, 28 - lsrs r0, r4, 29 - subs r0, 0x1 - lsls r0, 2 - adds r0, r3 - movs r2, 0 - ldrsh r1, [r0, r2] - lsls r1, 8 - lsrs r0, r4, 29 - subs r0, 0x1 - lsls r0, 2 - adds r5, r3, 0x2 - adds r0, r5 - movs r7, 0 - ldrsh r2, [r0, r7] - lsls r2, 8 - lsrs r0, r4, 29 - subs r0, 0x1 - lsls r0, 2 - adds r0, r3 - movs r7, 0 - ldrsh r3, [r0, r7] - lsrs r4, 29 - subs r4, 0x1 - lsls r4, 2 - adds r4, r5 - movs r5, 0 - ldrsh r0, [r4, r5] - str r0, [sp] - movs r7, 0x2E - ldrsh r0, [r6, r7] - str r0, [sp, 0x4] - movs r4, 0x30 - ldrsh r0, [r6, r4] - str r0, [sp, 0x8] - movs r0, 0 - str r0, [sp, 0xC] - movs r0, 0x2 - bl SetBgAffine -_080C5416: - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - add sp, 0x10 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end pokemon_details - - thumb_func_start sub_80C5438 -sub_80C5438: @ 80C5438 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - pop {r0} - bx r0 - thumb_func_end sub_80C5438 - - thumb_func_start sub_80C544C -sub_80C544C: @ 80C544C - push {lr} - bl sub_80C5484 - cmp r0, 0 - beq _080C5464 - ldr r0, =sub_80C5A48 - movs r1, 0 - bl CreateTask - ldr r0, =sub_80C5438 - bl SetMainCallback2 -_080C5464: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C544C - - thumb_func_start sub_80C5470 -sub_80C5470: @ 80C5470 - push {lr} - bl sub_80C570C - cmp r0, 0 - beq _080C547E - bl sub_80C51D8 -_080C547E: - pop {r0} - bx r0 - thumb_func_end sub_80C5470 - - thumb_func_start sub_80C5484 -sub_80C5484: @ 80C5484 - push {r4,r5,lr} - sub sp, 0xC - movs r0, 0 - str r0, [sp, 0x8] - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldrh r0, [r0, 0x4] - cmp r0, 0xA - bls _080C5498 - b _080C56F4 -_080C5498: - lsls r0, 2 - ldr r1, =_080C54AC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C54AC: - .4byte _080C54D8 - .4byte _080C54EE - .4byte _080C54F4 - .4byte _080C550A - .4byte _080C5510 - .4byte _080C5560 - .4byte _080C5570 - .4byte _080C55D0 - .4byte _080C5624 - .4byte _080C5684 - .4byte _080C56D0 -_080C54D8: - movs r0, 0 - bl SetVBlankCallback - bl ScanlineEffect_Stop - bl SetVBlankHBlankCallbacksToNull - movs r0, 0x2 - bl DisableInterrupts - b _080C56F4 -_080C54EE: - bl sub_80C50D0 - b _080C56F4 -_080C54F4: - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetPaletteFade - bl reset_temp_tile_data_buffers - b _080C56F4 -_080C550A: - bl sub_80C5310 - b _080C56F4 -_080C5510: - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085713E8 - movs r0, 0x1 - movs r2, 0x3 - bl InitBgsFromTemplates - ldr r4, =gUnknown_02039CF0 - ldr r1, [r4] - adds r1, 0x32 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00001032 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00002032 - adds r1, r0 - movs r0, 0x3 - bl SetBgTilemapBuffer - movs r0, 0x2 - movs r1, 0x6 - movs r2, 0x1 - bl SetBgAttribute - b _080C56F4 - .pool -_080C5560: - ldr r0, =gUnknown_08571400 - bl InitWindows - bl DeactivateAllTextPrinters - b _080C56F4 - .pool -_080C5570: - ldr r0, =gUnknown_085712F8 - add r1, sp, 0x8 - bl malloc_and_decompress - ldr r4, =gUnknown_02039CF0 - ldr r1, [r4] - str r0, [r1, 0x20] - ldr r0, =gUnknown_08571060 - add r1, sp, 0x8 - bl malloc_and_decompress - ldr r1, [r4] - str r0, [r1, 0x24] - ldr r0, =gUnknown_085712C0 - add r1, sp, 0x8 - bl malloc_and_decompress - ldr r1, [r4] - str r0, [r1, 0x28] - ldr r1, =gUnknown_08DE08C8 - movs r4, 0 - str r4, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gUnknown_08DE2084 - str r4, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _080C56F4 - .pool -_080C55D0: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _080C55DC - b _080C56FE -_080C55DC: - movs r5, 0x1E - str r5, [sp] - movs r4, 0x14 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _080C56F4 -_080C5624: - ldr r4, =gUnknown_08DE07C8 - movs r2, 0xD0 - lsls r2, 1 - adds r0, r4, 0 - movs r1, 0 - bl LoadPalette - ldr r5, =gUnknown_02039CEC - ldr r0, [r5] - ldrb r0, [r0, 0xE] - lsrs r0, 4 - lsls r0, 5 - adds r4, 0x20 - adds r0, r4 - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - bl stdpal_get - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - bl sub_80C629C - ldr r1, [r5] - ldrb r0, [r1, 0xC] - ldrb r1, [r1, 0xD] - bl sub_80C6104 - ldr r5, [r5] - ldrb r0, [r5, 0xE] - movs r1, 0xE - ands r1, r0 - cmp r1, 0x2 - beq _080C5674 - cmp r1, 0x4 - bne _080C56F4 -_080C5674: - movs r0, 0 - strh r0, [r5, 0x4] - movs r0, 0x1 - b _080C5700 - .pool -_080C5684: - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - bl sub_80C62DC - ldr r0, =pokemon_details - bl SetVBlankCallback - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - str r0, [sp] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _080C56F4 - .pool -_080C56D0: - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _080C56FE - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - strh r1, [r0, 0x4] - movs r0, 0x1 - b _080C5700 - .pool -_080C56F4: - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] -_080C56FE: - movs r0, 0 -_080C5700: - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C5484 - - thumb_func_start sub_80C570C -sub_80C570C: @ 80C570C - push {lr} - sub sp, 0x4 - ldr r1, =gUnknown_02039CEC - ldr r0, [r1] - ldrh r0, [r0, 0x4] - adds r2, r1, 0 - cmp r0, 0x5 - bhi _080C57E4 - lsls r0, 2 - ldr r1, =_080C5730 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C5730: - .4byte _080C5748 - .4byte _080C5770 - .4byte _080C577C - .4byte _080C57A6 - .4byte _080C57AC - .4byte _080C57BE -_080C5748: - ldr r0, [r2] - ldrb r0, [r0, 0xE] - movs r1, 0xE - ands r1, r0 - cmp r1, 0x2 - beq _080C576A - cmp r1, 0x4 - beq _080C576A - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _080C57E4 -_080C576A: - ldr r1, [r2] - movs r0, 0x2 - b _080C57EC -_080C5770: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _080C57E4 - b _080C57EE -_080C577C: - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl HideBg - movs r0, 0x1 - bl HideBg - movs r0, 0x2 - bl HideBg - movs r0, 0 - bl SetVBlankCallback - bl ScanlineEffect_Stop - bl SetVBlankHBlankCallbacksToNull - b _080C57E4 -_080C57A6: - bl sub_80C63FC - b _080C57E4 -_080C57AC: - bl sub_80C50D0 - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - b _080C57E4 -_080C57BE: - movs r0, 0 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl UnsetBgTilemapBuffer - movs r0, 0x2 - bl UnsetBgTilemapBuffer - bl sub_80C5340 - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - movs r0, 0 - strh r0, [r1, 0x4] - movs r0, 0x1 - b _080C57F0 - .pool -_080C57E4: - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - ldrh r0, [r1, 0x4] - adds r0, 0x1 -_080C57EC: - strh r0, [r1, 0x4] -_080C57EE: - movs r0, 0 -_080C57F0: - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C570C - - thumb_func_start sub_80C57FC -sub_80C57FC: @ 80C57FC - push {r4-r7,lr} - lsls r0, 16 - lsrs r6, r0, 16 - movs r4, 0 - ldr r7, =gUnknown_08571454 - lsls r1, 16 - asrs r5, r1, 16 -_080C580A: - lsls r0, r4, 3 - adds r3, r0, r7 - movs r1, 0 - ldrsh r0, [r3, r1] - cmp r0, r5 - bgt _080C5854 - movs r1, 0x2 - ldrsh r0, [r3, r1] - cmp r0, r5 - blt _080C5854 - movs r0, 0x4 - ldrsh r1, [r3, r0] - lsls r0, r6, 16 - asrs r2, r0, 16 - cmp r1, r2 - bgt _080C5854 - movs r1, 0x6 - ldrsh r0, [r3, r1] - cmp r0, r2 - blt _080C5854 - cmp r4, 0x5 - bls _080C5842 - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - adds r0, r4 - ldrb r0, [r0, 0x9] - cmp r0, 0 - beq _080C585E -_080C5842: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r0, 24 - b _080C5860 - .pool -_080C5854: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xC - bls _080C580A -_080C585E: - movs r0, 0 -_080C5860: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80C57FC - - thumb_func_start sub_80C5868 -sub_80C5868: @ 80C5868 - push {lr} - bl sub_80C5484 - cmp r0, 0 - beq _080C58C6 - ldr r1, =gUnknown_02039CEC - ldr r0, [r1] - ldrb r0, [r0, 0xE] - lsls r0, 28 - lsrs r0, 29 - cmp r0, 0x1 - blt _080C58AC - cmp r0, 0x2 - bgt _080C58AC - ldr r0, =sub_80C5BD8 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0x1 - strh r0, [r1, 0x8] - b _080C58C0 - .pool -_080C58AC: - ldr r2, [r1] - ldrb r1, [r2, 0xE] - movs r0, 0xF - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0xE] - ldr r0, =sub_80C5A48 - movs r1, 0 - bl CreateTask -_080C58C0: - ldr r0, =sub_80C5438 - bl SetMainCallback2 -_080C58C6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C5868 - - thumb_func_start sub_80C58D4 -sub_80C58D4: @ 80C58D4 - push {r4,lr} - ldr r4, =gUnknown_02039CF8 - ldr r0, [r4] - bl sub_80C51F0 - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - ldrh r0, [r4, 0x4] - strh r0, [r1, 0x8] - ldrh r0, [r4, 0x6] - strh r0, [r1, 0xA] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x8 - bl memset - bl InBattlePyramid - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080C5914 - cmp r0, 0x2 - beq _080C591C - bl Overworld_PlaySpecialMapMusic - b _080C5924 - .pool -_080C5914: - ldr r0, =0x000001cd - b _080C5920 - .pool -_080C591C: - movs r0, 0xE7 - lsls r0, 1 -_080C5920: - bl PlayBGM -_080C5924: - ldr r0, =sub_80C5868 - bl SetMainCallback2 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C58D4 - - thumb_func_start sub_80C5934 -sub_80C5934: @ 80C5934 - push {lr} - bl sub_80C570C - cmp r0, 0 - beq _080C599A - ldr r0, =gUnknown_02039CEC - ldr r2, [r0] - ldrb r0, [r2, 0xE] - lsls r0, 28 - lsrs r0, 29 - cmp r0, 0x2 - beq _080C5994 - cmp r0, 0x2 - bgt _080C595C - cmp r0, 0x1 - beq _080C5962 - b _080C599A - .pool -_080C595C: - cmp r0, 0x3 - beq _080C5970 - b _080C599A -_080C5962: - ldr r0, =sub_80C5868 - bl sub_80C6454 - b _080C599A - .pool -_080C5970: - ldr r1, =gUnknown_02039CF8 - ldr r0, [r2] - str r0, [r1] - ldrh r0, [r2, 0x8] - strh r0, [r1, 0x4] - ldrh r0, [r2, 0xA] - strh r0, [r1, 0x6] - bl sub_80C52E4 - ldr r0, =sub_80C58D4 - bl PlayRecordedBattle - b _080C599A - .pool -_080C5994: - ldr r0, =sub_80C5868 - bl sub_80C4DDC -_080C599A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C5934 - - thumb_func_start sub_80C59A4 -sub_80C59A4: @ 80C59A4 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - adds r4, r3, 0 - lsls r1, 24 - lsrs r1, 24 - adds r2, r1, 0 - cmp r1, 0x1 - blt _080C59CC - cmp r1, 0x2 - ble _080C59F4 - cmp r1, 0x3 - bne _080C59CC - ldr r0, =gUnknown_02039CEC - ldr r2, [r0] - ldrb r1, [r2, 0xE] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080C59D4 -_080C59CC: - movs r0, 0 - b _080C5A30 - .pool -_080C59D4: - movs r0, 0xF - negs r0, r0 - ands r0, r1 - movs r1, 0x6 - orrs r0, r1 - strb r0, [r2, 0xE] - adds r0, r3, 0 - bl DestroyTask - ldr r0, =sub_80C5934 - bl SetMainCallback2 - b _080C5A1A - .pool -_080C59F4: - ldr r0, =gUnknown_02039CEC - ldr r3, [r0] - movs r0, 0x7 - ands r2, r0 - lsls r2, 1 - ldrb r1, [r3, 0xE] - subs r0, 0x16 - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0xE] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80C5BD8 - str r1, [r0] - movs r1, 0 - strh r1, [r0, 0x8] -_080C5A1A: - ldr r0, =gUnknown_02039CEC - ldr r2, [r0] - ldr r0, =gUnknown_02039CF0 - ldr r1, [r0] - ldr r0, [r1] - ldrh r0, [r0, 0x20] - strh r0, [r2, 0x8] - ldr r0, [r1] - ldrh r0, [r0, 0x22] - strh r0, [r2, 0xA] - movs r0, 0x1 -_080C5A30: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C59A4 - - thumb_func_start sub_80C5A48 -sub_80C5A48: @ 80C5A48 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - ldr r2, =gMain - ldrh r1, [r2, 0x2C] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080C5A80 - ldr r0, =gUnknown_02039CF0 - ldr r4, [r0] - ldr r1, [r4] - ldrh r3, [r1, 0x22] - movs r7, 0x22 - ldrsh r0, [r1, r7] - cmp r0, 0x8 - ble _080C5A80 - subs r0, r3, 0x2 - strh r0, [r1, 0x22] - ldr r1, [r4] - movs r3, 0x22 - ldrsh r0, [r1, r3] - cmp r0, 0x7 - bgt _080C5A7E - movs r0, 0x2 - strh r0, [r1, 0x22] -_080C5A7E: - movs r5, 0x1 -_080C5A80: - ldrh r1, [r2, 0x2C] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080C5AAE - ldr r0, =gUnknown_02039CF0 - ldr r4, [r0] - ldr r1, [r4] - ldrh r3, [r1, 0x22] - movs r7, 0x22 - ldrsh r0, [r1, r7] - cmp r0, 0x87 - bgt _080C5AAE - adds r0, r3, 0x2 - strh r0, [r1, 0x22] - ldr r1, [r4] - movs r3, 0x22 - ldrsh r0, [r1, r3] - cmp r0, 0x88 - ble _080C5AAC - movs r0, 0x88 - strh r0, [r1, 0x22] -_080C5AAC: - movs r5, 0x1 -_080C5AAE: - ldrh r1, [r2, 0x2C] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080C5ADC - ldr r0, =gUnknown_02039CF0 - ldr r4, [r0] - ldr r1, [r4] - ldrh r3, [r1, 0x20] - movs r7, 0x20 - ldrsh r0, [r1, r7] - cmp r0, 0x5 - ble _080C5ADC - subs r0, r3, 0x2 - strh r0, [r1, 0x20] - ldr r1, [r4] - movs r3, 0x20 - ldrsh r0, [r1, r3] - cmp r0, 0x4 - bgt _080C5ADA - movs r0, 0x5 - strh r0, [r1, 0x20] -_080C5ADA: - movs r5, 0x1 -_080C5ADC: - ldrh r1, [r2, 0x2C] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080C5B0A - ldr r0, =gUnknown_02039CF0 - ldr r4, [r0] - ldr r1, [r4] - ldrh r3, [r1, 0x20] - movs r7, 0x20 - ldrsh r0, [r1, r7] - cmp r0, 0xE7 - bgt _080C5B0A - adds r0, r3, 0x2 - strh r0, [r1, 0x20] - ldr r1, [r4] - movs r3, 0x20 - ldrsh r0, [r1, r3] - cmp r0, 0xE8 - ble _080C5B08 - movs r0, 0xE8 - strh r0, [r1, 0x20] -_080C5B08: - movs r5, 0x1 -_080C5B0A: - cmp r5, 0 - bne _080C5B88 - ldr r4, =gUnknown_02039CEC - ldr r0, [r4] - ldrb r3, [r0, 0xC] - cmp r3, 0 - beq _080C5B5E - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080C5B5E - cmp r3, 0x3 - bhi _080C5B48 - movs r0, 0x5 - bl PlaySE - ldr r0, [r4] - ldrb r1, [r0, 0xC] - adds r0, r6, 0 - bl sub_80C59A4 - cmp r0, 0 - bne _080C5BCA - b _080C5B5E - .pool -_080C5B48: - cmp r3, 0x4 - bne _080C5B5E - movs r0, 0x3 - bl PlaySE - ldr r0, =sub_80C5470 - bl SetMainCallback2 - adds r0, r6, 0 - bl DestroyTask -_080C5B5E: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080C5BCA - movs r0, 0x3 - bl PlaySE - ldr r0, =sub_80C5470 - bl SetMainCallback2 - adds r0, r6, 0 - bl DestroyTask - b _080C5BCA - .pool -_080C5B88: - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0] - ldrh r0, [r1, 0x20] - subs r0, 0x5 - lsls r0, 16 - asrs r0, 16 - ldrh r1, [r1, 0x22] - adds r1, 0x5 - lsls r1, 16 - asrs r1, 16 - bl sub_80C57FC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_02039CEC - ldr r0, [r4] - ldrb r0, [r0, 0xC] - cmp r0, r5 - beq _080C5BCA - adds r0, r5, 0 - bl sub_80C5ED0 - ldr r1, [r4] - ldrb r0, [r1, 0xC] - strb r0, [r1, 0xD] - ldr r0, [r4] - strb r5, [r0, 0xC] - ldr r1, [r4] - ldrb r0, [r1, 0xC] - ldrb r1, [r1, 0xD] - bl sub_80C6104 -_080C5BCA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C5A48 - - thumb_func_start sub_80C5BD8 -sub_80C5BD8: @ 80C5BD8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r5, r0, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - adds r6, r5, r0 - ldr r7, =gUnknown_02039CEC - ldr r0, [r7] - ldrh r0, [r0, 0x4] - cmp r0, 0x1 - beq _080C5CD4 - cmp r0, 0x1 - bgt _080C5C0C - cmp r0, 0 - beq _080C5C14 - b _080C5D9C - .pool -_080C5C0C: - cmp r0, 0x2 - bne _080C5C12 - b _080C5D2A -_080C5C12: - b _080C5D9C -_080C5C14: - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _080C5C4C - movs r0, 0x1 - movs r1, 0 - bl sub_80C5F58 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1, 0 - strh r0, [r6, 0x2] - strh r0, [r6, 0x4] - movs r0, 0x15 - strh r0, [r6, 0x6] - strh r0, [r6, 0x8] - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _080C5CA4 - .pool -_080C5C4C: - movs r1, 0xFE - lsls r1, 1 - adds r0, r1, 0 - strh r0, [r6, 0x2] - strh r0, [r6, 0x4] - movs r1, 0x15 - negs r1, r1 - adds r0, r1, 0 - strh r0, [r6, 0x6] - strh r0, [r6, 0x8] - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - bl sub_80C62DC - ldr r0, =pokemon_details - bl SetVBlankCallback - movs r5, 0x1 - negs r5, r5 - ldr r4, =0x00007fff - adds r0, r5, 0 - movs r1, 0x10 - adds r2, r4, 0 - bl BlendPalettes - str r4, [sp] - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_080C5CA4: - ldr r4, =gUnknown_02039CF0 - ldr r0, [r4] - adds r0, 0x2C - movs r1, 0x1 - strb r1, [r0] - movs r1, 0x2 - ldrsh r0, [r6, r1] - bl sub_8151624 - ldr r1, [r4] - strh r0, [r1, 0x2E] - movs r1, 0x4 - ldrsh r0, [r6, r1] - bl sub_8151624 - ldr r1, [r4] - strh r0, [r1, 0x30] - b _080C5D9C - .pool -_080C5CD4: - bl UpdatePaletteFade - ldrh r0, [r6, 0x6] - ldrh r1, [r6, 0x2] - adds r0, r1 - strh r0, [r6, 0x2] - ldrh r0, [r6, 0x8] - ldrh r1, [r6, 0x4] - adds r0, r1 - strh r0, [r6, 0x4] - movs r1, 0x2 - ldrsh r0, [r6, r1] - bl sub_8151624 - ldr r4, =gUnknown_02039CF0 - ldr r1, [r4] - strh r0, [r1, 0x2E] - movs r1, 0x4 - ldrsh r0, [r6, r1] - bl sub_8151624 - ldr r1, [r4] - strh r0, [r1, 0x30] - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _080C5D1C - movs r0, 0x2 - ldrsh r1, [r6, r0] - movs r0, 0xFE - lsls r0, 1 - cmp r1, r0 - ble _080C5DA6 - b _080C5D9C - .pool -_080C5D1C: - movs r0, 0x2 - ldrsh r1, [r6, r0] - movs r0, 0x80 - lsls r0, 1 - cmp r1, r0 - bne _080C5DA6 - b _080C5D9C -_080C5D2A: - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x2C - ldrb r0, [r1] - cmp r0, 0 - beq _080C5D3C - movs r0, 0 - strb r0, [r1] -_080C5D3C: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080C5DA6 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _080C5D64 - adds r0, r4, 0 - bl DestroyTask - ldr r0, =sub_80C5934 - bl SetMainCallback2 - b _080C5D82 - .pool -_080C5D64: - movs r0, 0 - movs r1, 0 - bl sub_80C5F58 - ldr r2, [r7] - ldrb r1, [r2, 0xE] - movs r0, 0xF - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0xE] - mov r0, r8 - subs r0, 0x8 - adds r0, r5, r0 - ldr r1, =sub_80C5A48 - str r1, [r0] -_080C5D82: - movs r0, 0x2 - movs r1, 0x6 - movs r2, 0 - bl SetBgAttribute - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - movs r0, 0 - b _080C5DA4 - .pool -_080C5D9C: - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - ldrh r0, [r1, 0x4] - adds r0, 0x1 -_080C5DA4: - strh r0, [r1, 0x4] -_080C5DA6: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C5BD8 - - thumb_func_start sub_80C5DB8 -sub_80C5DB8: @ 80C5DB8 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - movs r4, 0 -_080C5DC2: - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _080C5DC2 - ldr r4, =gText_SymbolsEarned - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x60 - bl GetStringCenterAlignXOffset - lsls r2, r0, 24 - lsrs r2, 24 - ldr r6, =gUnknown_08571448 - str r6, [sp] - movs r0, 0 - mov r8, r0 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x5 - bl AddTextPrinterParameterized3 - ldr r4, =gText_BattleRecord - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x60 - bl GetStringCenterAlignXOffset - lsls r2, r0, 24 - lsrs r2, 24 - str r6, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0x5 - bl AddTextPrinterParameterized3 - str r6, [sp] - mov r0, r8 - str r0, [sp, 0x4] - ldr r0, =gText_BattlePoints - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0x8 - movs r2, 0x5 - movs r3, 0x4 - bl AddTextPrinterParameterized3 - ldr r4, =gStringVar4 - ldr r5, =gUnknown_02039CEC - ldr r0, [r5] - ldrh r1, [r0, 0x6] - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - movs r0, 0x8 - adds r1, r4, 0 - movs r2, 0x5B - bl GetStringRightAlignXOffset - lsls r2, r0, 24 - lsrs r2, 24 - str r6, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x2 - movs r1, 0x8 - movs r3, 0x10 - bl AddTextPrinterParameterized3 - ldr r1, [r5] - ldrh r0, [r1, 0x8] - subs r0, 0x5 - lsls r0, 16 - asrs r0, 16 - ldrh r1, [r1, 0xA] - adds r1, 0x5 - lsls r1, 16 - asrs r1, 16 - bl sub_80C57FC - ldr r1, [r5] - strb r0, [r1, 0xC] - ldr r0, [r5] - mov r1, r8 - strb r1, [r0, 0xD] - ldr r0, [r5] - ldrb r0, [r0, 0xC] - bl sub_80C5ED0 - movs r4, 0 -_080C5E92: - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _080C5E92 - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C5DB8 - - thumb_func_start sub_80C5ED0 -sub_80C5ED0: @ 80C5ED0 - push {r4,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x3 - movs r1, 0 - bl FillWindowPixelBuffer - cmp r4, 0x3 - bne _080C5F18 - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldrb r0, [r0, 0xE] - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - bne _080C5F18 - ldr r0, =gUnknown_0857144B - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, =gUnknown_08571614 - ldr r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0x2 - movs r3, 0 - bl AddTextPrinterParameterized3 - b _080C5F3A - .pool -_080C5F18: - cmp r4, 0 - beq _080C5F3A - ldr r0, =gUnknown_0857144B - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - ldr r1, =gUnknown_08571614 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0x2 - movs r3, 0 - bl AddTextPrinterParameterized3 -_080C5F3A: - movs r0, 0x3 - movs r1, 0x3 - bl CopyWindowToVram - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C5ED0 - - thumb_func_start sub_80C5F58 -sub_80C5F58: @ 80C5F58 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldrb r0, [r0, 0xE] - lsls r0, 28 - lsrs r0, 29 - cmp r0, 0x1 - beq _080C5F80 - cmp r0, 0x2 - beq _080C5FC2 - b _080C60EE - .pool -_080C5F80: - cmp r2, 0 - beq _080C5FA8 - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0, 0x20] - movs r0, 0xC - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x10 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r2, 0x10 - movs r3, 0x3 - bl CopyToBgTilemapBufferRect_ChangePalette - b _080C6004 - .pool -_080C5FA8: - movs r0, 0xC - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x10 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r2, 0x10 - movs r3, 0x3 - bl FillBgTilemapBufferRect - b _080C6004 -_080C5FC2: - cmp r2, 0 - beq _080C5FEC - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0, 0x20] - adds r1, 0x54 - movs r0, 0xC - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x10 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r2, 0x10 - movs r3, 0xA - bl CopyToBgTilemapBufferRect_ChangePalette - b _080C6004 - .pool -_080C5FEC: - movs r0, 0xC - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x10 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r2, 0x10 - movs r3, 0xA - bl FillBgTilemapBufferRect -_080C6004: - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - cmp r7, 0 - beq _080C6084 - movs r4, 0xFE - lsls r4, 1 - adds r0, r4, 0 - bl sub_8151624 - adds r6, r0, 0 - lsls r6, 16 - asrs r6, 16 - adds r0, r4, 0 - bl sub_8151624 - lsls r0, 16 - asrs r0, 16 - ldr r5, =gUnknown_085713E0 - ldr r1, =gUnknown_02039CEC - ldr r1, [r1] - ldrb r4, [r1, 0xE] - lsls r4, 28 - lsrs r1, r4, 29 - subs r1, 0x1 - lsls r1, 2 - adds r1, r5 - movs r2, 0 - ldrsh r1, [r1, r2] - lsls r1, 8 - lsrs r2, r4, 29 - subs r2, 0x1 - lsls r2, 2 - adds r3, r5, 0x2 - mov r8, r3 - add r2, r8 - movs r3, 0 - ldrsh r2, [r2, r3] - lsls r2, 8 - lsrs r3, r4, 29 - subs r3, 0x1 - lsls r3, 2 - adds r3, r5 - movs r5, 0 - ldrsh r3, [r3, r5] - lsrs r4, 29 - subs r4, 0x1 - lsls r4, 2 - add r4, r8 - movs r5, 0 - ldrsh r4, [r4, r5] - str r4, [sp] - str r6, [sp, 0x4] - str r0, [sp, 0x8] - movs r0, 0 - str r0, [sp, 0xC] - movs r0, 0x2 - bl SetBgAffine - b _080C60EE - .pool -_080C6084: - movs r4, 0x80 - lsls r4, 1 - adds r0, r4, 0 - bl sub_8151624 - adds r6, r0, 0 - lsls r6, 16 - asrs r6, 16 - adds r0, r4, 0 - bl sub_8151624 - lsls r0, 16 - asrs r0, 16 - ldr r5, =gUnknown_085713E0 - ldr r1, =gUnknown_02039CEC - ldr r1, [r1] - ldrb r4, [r1, 0xE] - lsls r4, 28 - lsrs r1, r4, 29 - subs r1, 0x1 - lsls r1, 2 - adds r1, r5 - movs r2, 0 - ldrsh r1, [r1, r2] - lsls r1, 8 - lsrs r2, r4, 29 - subs r2, 0x1 - lsls r2, 2 - adds r3, r5, 0x2 - mov r8, r3 - add r2, r8 - movs r3, 0 - ldrsh r2, [r2, r3] - lsls r2, 8 - lsrs r3, r4, 29 - subs r3, 0x1 - lsls r3, 2 - adds r3, r5 - movs r5, 0 - ldrsh r3, [r3, r5] - lsrs r4, 29 - subs r4, 0x1 - lsls r4, 2 - add r4, r8 - movs r5, 0 - ldrsh r4, [r4, r5] - str r4, [sp] - str r6, [sp, 0x4] - str r0, [sp, 0x8] - str r7, [sp, 0xC] - movs r0, 0x2 - bl SetBgAffine -_080C60EE: - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C5F58 - - thumb_func_start sub_80C6104 -sub_80C6104: @ 80C6104 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - cmp r5, 0x2 - beq _080C614C - cmp r5, 0x2 - bgt _080C611E - cmp r5, 0x1 - beq _080C6128 - b _080C61C4 -_080C611E: - cmp r5, 0x3 - beq _080C6170 - cmp r5, 0x4 - beq _080C61A4 - b _080C61C4 -_080C6128: - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0, 0x24] - movs r0, 0xC - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x10 - movs r3, 0x3 - bl CopyToBgTilemapBufferRect_ChangePalette - b _080C61CE - .pool -_080C614C: - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0, 0x24] - movs r0, 0xA8 - lsls r0, 1 - adds r1, r0 - movs r0, 0xC - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x10 - b _080C6192 - .pool -_080C6170: - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldrb r1, [r0, 0xE] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080C61C4 - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0, 0x28] - movs r0, 0xC - str r0, [sp] - str r5, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x2 -_080C6192: - movs r3, 0xA - bl CopyToBgTilemapBufferRect_ChangePalette - b _080C61CE - .pool -_080C61A4: - ldr r1, =gUnknown_08DE3350 - movs r0, 0x9 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x15 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - b _080C61CE - .pool -_080C61C4: - subs r0, r4, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bhi _080C6294 -_080C61CE: - cmp r4, 0x2 - beq _080C620C - cmp r4, 0x2 - bgt _080C61DC - cmp r4, 0x1 - beq _080C61E6 - b _080C6284 -_080C61DC: - cmp r4, 0x3 - beq _080C6230 - cmp r4, 0x4 - beq _080C6264 - b _080C6284 -_080C61E6: - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0, 0x24] - adds r1, 0xA8 - movs r0, 0xC - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x10 - movs r3, 0x3 - bl CopyToBgTilemapBufferRect_ChangePalette - b _080C628E - .pool -_080C620C: - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0, 0x24] - movs r0, 0xFC - lsls r0, 1 - adds r1, r0 - movs r0, 0xC - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x10 - b _080C6254 - .pool -_080C6230: - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldrb r1, [r0, 0xE] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080C6294 - ldr r0, =gUnknown_02039CF0 - ldr r0, [r0] - ldr r1, [r0, 0x28] - adds r1, 0x48 - movs r0, 0xC - str r0, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x2 -_080C6254: - movs r3, 0xA - bl CopyToBgTilemapBufferRect_ChangePalette - b _080C628E - .pool -_080C6264: - ldr r1, =gUnknown_08DE3374 - movs r0, 0x9 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x15 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - b _080C628E - .pool -_080C6284: - subs r0, r5, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bhi _080C6294 -_080C628E: - movs r0, 0x1 - bl CopyBgTilemapBufferToVram -_080C6294: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80C6104 - - thumb_func_start sub_80C629C -sub_80C629C: @ 80C629C - push {r4,lr} - ldr r1, =gUnknown_08DE3060 - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r4, =gUnknown_02039CEC - ldr r1, [r4] - ldrb r0, [r1, 0xC] - ldrb r1, [r1, 0xD] - bl sub_80C6104 - ldr r0, [r4] - ldrb r1, [r0, 0xE] - lsls r1, 28 - lsrs r1, 29 - movs r0, 0x1 - bl sub_80C5F58 - bl sub_80C5DB8 - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C629C - - thumb_func_start sub_80C62DC -sub_80C62DC: @ 80C62DC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - movs r5, 0 - bl FreeAllSpritePalettes - bl ResetAffineAnimData - ldr r0, =gUnknown_085714E4 - bl LoadSpritePalettes - ldr r4, =gUnknown_085714BC - adds r0, r4, 0 - bl LoadCompressedSpriteSheet - adds r4, 0x10 - adds r0, r4, 0 - bl LoadCompressedSpriteSheet - ldr r0, =gUnknown_085715B4 - ldr r1, =gUnknown_02039CEC - ldr r2, [r1] - movs r3, 0x8 - ldrsh r1, [r2, r3] - movs r6, 0xA - ldrsh r2, [r2, r6] - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gUnknown_02039CF0 - ldr r2, [r3] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] - mov r8, sp - mov r9, r3 -_080C633C: - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - adds r0, 0xF - adds r2, r0, r5 - ldrb r0, [r2] - adds r4, r5, 0x1 - cmp r0, 0 - beq _080C63C2 - mov r1, sp - ldr r0, =gUnknown_085715E4 - ldm r0!, {r3,r6,r7} - stm r1!, {r3,r6,r7} - ldm r0!, {r3,r6,r7} - stm r1!, {r3,r6,r7} - mov r7, r8 - ldrh r0, [r7, 0x2] - ldr r1, =0x0000ffff - adds r0, r1 - ldrb r2, [r2] - adds r0, r2 - strh r0, [r7, 0x2] - ldr r1, =gUnknown_08571454 - adds r0, r5, 0x6 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x4] - adds r1, 0x8 - lsls r1, 16 - asrs r1, 16 - ldrh r2, [r0] - adds r2, 0x6 - lsls r2, 16 - asrs r2, 16 - lsls r3, r4, 24 - lsrs r3, 24 - mov r0, sp - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r3, r9 - ldr r2, [r3] - lsls r3, r5, 2 - adds r2, 0x4 - adds r2, r3 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - ldrb r2, [r1, 0x5] - movs r6, 0xD - negs r6, r6 - adds r0, r6, 0 - ands r2, r0 - movs r0, 0x8 - orrs r2, r0 - strb r2, [r1, 0x5] - mov r7, r9 - ldr r0, [r7] - adds r0, 0x4 - adds r0, r3 - ldr r0, [r0] - adds r1, r5, 0 - bl StartSpriteAnim -_080C63C2: - lsls r0, r4, 24 - lsrs r5, r0, 24 - cmp r5, 0x6 - bls _080C633C - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C62DC - - thumb_func_start sub_80C63FC -sub_80C63FC: @ 80C63FC - push {r4-r6,lr} - movs r5, 0 - ldr r4, =gUnknown_02039CF0 - ldr r0, [r4] - ldr r0, [r0] - bl DestroySprite - ldr r0, [r4] - str r5, [r0] - adds r6, r4, 0 -_080C6410: - ldr r0, [r6] - lsls r4, r5, 2 - adds r0, 0x4 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080C642C - bl DestroySprite - ldr r0, [r6] - adds r0, 0x4 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080C642C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x6 - bls _080C6410 - bl FreeAllSpritePalettes - movs r0, 0x2 - bl FreeSpriteTilesByTag - movs r0, 0 - bl FreeSpriteTilesByTag - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C63FC - - thumb_func_start nullsub_39 -nullsub_39: @ 80C6450 - bx lr - thumb_func_end nullsub_39 - - thumb_func_start sub_80C6454 -sub_80C6454: @ 80C6454 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_02039CF4 - ldr r0, [r5] - cmp r0, 0 - beq _080C6466 - adds r0, r4, 0 - bl SetMainCallback2 -_080C6466: - ldr r0, =0x00003014 - bl AllocZeroed - str r0, [r5] - str r4, [r0] - bl ResetTasks - ldr r0, =sub_80C67BC - movs r1, 0 - bl CreateTask - ldr r0, =sub_80C5438 - bl SetMainCallback2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C6454 - - thumb_func_start sub_80C6498 -sub_80C6498: @ 80C6498 - push {r4,lr} - bl ResetTasks - ldr r4, =gUnknown_02039CF4 - ldr r0, [r4] - ldr r0, [r0] - bl SetMainCallback2 - ldr r0, [r4] - ldr r2, =0x00003014 - movs r1, 0 - bl memset - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C6498 - - thumb_func_start sub_80C64CC -sub_80C64CC: @ 80C64CC - push {r4,r5,lr} - sub sp, 0x8 - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldrh r0, [r0, 0x4] - cmp r0, 0x7 - bls _080C64DC - b _080C6694 -_080C64DC: - lsls r0, 2 - ldr r1, =_080C64F0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C64F0: - .4byte _080C6510 - .4byte _080C6520 - .4byte _080C6526 - .4byte _080C6538 - .4byte _080C65C0 - .4byte _080C65E8 - .4byte _080C6628 - .4byte _080C6678 -_080C6510: - movs r0, 0 - bl SetVBlankCallback - bl ScanlineEffect_Stop - bl SetVBlankHBlankCallbacksToNull - b _080C6694 -_080C6520: - bl sub_80C50D0 - b _080C6694 -_080C6526: - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetPaletteFade - bl reset_temp_tile_data_buffers - b _080C6694 -_080C6538: - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085713F4 - movs r0, 0 - movs r2, 0x3 - bl InitBgsFromTemplates - ldr r4, =gUnknown_02039CF4 - ldr r1, [r4] - adds r1, 0x12 - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00001012 - adds r1, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00002012 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - movs r5, 0x1E - str r5, [sp] - movs r4, 0x14 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - b _080C6618 - .pool -_080C65C0: - ldr r0, =gUnknown_08571428 - bl InitWindows - bl DeactivateAllTextPrinters - bl sub_80C6B94 - ldr r1, =gUnknown_0856FBBC - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _080C6694 - .pool -_080C65E8: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - bne _080C669E - ldr r0, =gUnknown_08DE07C8 - movs r2, 0xD0 - lsls r2, 1 - movs r1, 0 - bl LoadPalette - movs r0, 0 - bl stdpal_get - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_08570E00 - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer -_080C6618: - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _080C6694 - .pool -_080C6628: - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - bl sub_80C6974 - ldr r0, =pokemon_details - bl SetVBlankCallback - movs r5, 0x1 - negs r5, r5 - ldr r4, =0x00007fff - adds r0, r5, 0 - movs r1, 0x10 - adds r2, r4, 0 - bl BlendPalettes - str r4, [sp] - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _080C6694 - .pool -_080C6678: - bl UpdatePaletteFade - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _080C669E - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - strh r1, [r0, 0x4] - movs r0, 0x1 - b _080C66A0 - .pool -_080C6694: - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] -_080C669E: - movs r0, 0 -_080C66A0: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C64CC - - thumb_func_start sub_80C66AC -sub_80C66AC: @ 80C66AC - push {r4,lr} - sub sp, 0x4 - ldr r0, =gUnknown_02039CEC - ldr r0, [r0] - ldrh r0, [r0, 0x4] - cmp r0, 0x5 - bhi _080C67A4 - lsls r0, 2 - ldr r1, =_080C66CC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C66CC: - .4byte _080C66E4 - .4byte _080C66FC - .4byte _080C6722 - .4byte _080C6732 - .4byte _080C6774 - .4byte _080C6782 -_080C66E4: - movs r0, 0x1 - negs r0, r0 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _080C67A4 - .pool -_080C66FC: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080C67AE - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl HideBg - movs r0, 0x1 - bl HideBg - movs r0, 0x2 - bl HideBg - b _080C67A4 -_080C6722: - movs r0, 0 - bl SetVBlankCallback - bl ScanlineEffect_Stop - bl SetVBlankHBlankCallbacksToNull - b _080C67A4 -_080C6732: - ldr r4, =gUnknown_02039CF4 - ldr r0, [r4] - ldr r0, [r0, 0x4] - cmp r0, 0 - beq _080C6746 - bl DestroySprite - movs r0, 0 - bl FreeSpriteTilesByTag -_080C6746: - ldr r0, [r4] - ldr r0, [r0, 0xC] - cmp r0, 0 - beq _080C6758 - bl DestroySprite - movs r0, 0x1 - bl FreeSpriteTilesByTag -_080C6758: - ldr r0, [r4] - ldr r0, [r0, 0x8] - cmp r0, 0 - beq _080C676A - bl DestroySprite - movs r0, 0x4 - bl FreeSpriteTilesByTag -_080C676A: - bl FreeAllWindowBuffers - b _080C67A4 - .pool -_080C6774: - bl sub_80C50D0 - bl ResetSpriteData - bl FreeAllSpritePalettes - b _080C67A4 -_080C6782: - movs r0, 0 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl UnsetBgTilemapBuffer - movs r0, 0x2 - bl UnsetBgTilemapBuffer - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - movs r0, 0 - strh r0, [r1, 0x4] - movs r0, 0x1 - b _080C67B0 - .pool -_080C67A4: - ldr r0, =gUnknown_02039CEC - ldr r1, [r0] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] -_080C67AE: - movs r0, 0 -_080C67B0: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C66AC - - thumb_func_start sub_80C67BC -sub_80C67BC: @ 80C67BC - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0x5 - bls _080C67D6 - b _080C68DA -_080C67D6: - lsls r0, 2 - ldr r1, =_080C67E8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C67E8: - .4byte _080C6800 - .4byte _080C6806 - .4byte _080C686C - .4byte _080C6894 - .4byte _080C68C4 - .4byte _080C68CE -_080C6800: - bl sub_80C64CC - b _080C68C8 -_080C6806: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x2 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _080C6824 - movs r0, 0x3 - bl PlaySE - movs r0, 0x4 - b _080C68DE - .pool -_080C6824: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080C6848 - ldr r0, =gUnknown_02039CF4 - ldr r0, [r0] - ldrb r0, [r0, 0x10] - cmp r0, 0x5 - bls _080C6844 - movs r0, 0 - bl sub_80C6C70 - b _080C68E0 - .pool -_080C6844: - strh r2, [r4] - b _080C68E0 -_080C6848: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080C68E0 - ldr r0, =gUnknown_02039CF4 - ldr r0, [r0] - ldrb r0, [r0, 0x10] - cmp r0, 0 - bne _080C6868 - movs r0, 0x1 - bl sub_80C6C70 - b _080C68E0 - .pool -_080C6868: - movs r0, 0x3 - b _080C68DE -_080C686C: - movs r1, 0x2 - ldrsh r0, [r4, r1] - cmp r0, 0x3 - ble _080C6882 - movs r0, 0 - bl sub_80C6C70 - movs r0, 0 - strh r0, [r4, 0x2] - movs r0, 0x1 - b _080C68DE -_080C6882: - ldr r0, =gUnknown_02039CF4 - ldr r0, [r0] - ldr r1, [r0, 0x4] - ldrh r0, [r1, 0x22] - adds r0, 0x4 - b _080C68B4 - .pool -_080C6894: - movs r1, 0x2 - ldrsh r0, [r4, r1] - cmp r0, 0x3 - ble _080C68AA - movs r0, 0x1 - bl sub_80C6C70 - movs r0, 0 - strh r0, [r4, 0x2] - movs r0, 0x1 - b _080C68DE -_080C68AA: - ldr r0, =gUnknown_02039CF4 - ldr r0, [r0] - ldr r1, [r0, 0x4] - ldrh r0, [r1, 0x22] - subs r0, 0x4 -_080C68B4: - strh r0, [r1, 0x22] - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - b _080C68E0 - .pool -_080C68C4: - bl sub_80C66AC -_080C68C8: - cmp r0, 0 - bne _080C68DA - b _080C68E0 -_080C68CE: - adds r0, r2, 0 - bl DestroyTask - bl sub_80C6498 - b _080C68E0 -_080C68DA: - ldrh r0, [r4] - adds r0, 0x1 -_080C68DE: - strh r0, [r4] -_080C68E0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80C67BC - - thumb_func_start sub_80C68E8 -sub_80C68E8: @ 80C68E8 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r2, =0xfffb0000 - adds r0, r2 - lsrs r0, 16 - cmp r0, 0x3 - bls _080C6904 - adds r0, r1, 0 - subs r0, 0xF - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _080C690C -_080C6904: - movs r0, 0x1 - b _080C696E - .pool -_080C690C: - adds r0, r1, 0 - subs r0, 0x12 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3 - bhi _080C691C - movs r0, 0x2 - b _080C696E -_080C691C: - adds r0, r1, 0 - subs r0, 0x16 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _080C692C - movs r0, 0x3 - b _080C696E -_080C692C: - adds r0, r1, 0 - subs r0, 0x1C - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _080C693C - movs r0, 0x4 - b _080C696E -_080C693C: - adds r0, r1, 0 - subs r0, 0x1F - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _080C694C - movs r0, 0x5 - b _080C696E -_080C694C: - adds r0, r1, 0 - subs r0, 0x22 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x5 - bhi _080C695C - movs r0, 0x6 - b _080C696E -_080C695C: - adds r0, r1, 0 - subs r0, 0x19 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bls _080C696C - movs r0, 0 - b _080C696E -_080C696C: - movs r0, 0x7 -_080C696E: - pop {r1} - bx r1 - thumb_func_end sub_80C68E8 - - thumb_func_start sub_80C6974 -sub_80C6974: @ 80C6974 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - movs r7, 0 - bl FreeAllSpritePalettes - ldr r0, =gUnknown_085714E4 - bl LoadSpritePalettes - ldr r6, =gUnknown_085714BC - adds r0, r6, 0 - bl LoadCompressedSpriteSheet - ldr r0, =gUnknown_085715B4 - mov r8, r0 - ldr r4, =gUnknown_02039CF4 - ldr r0, [r4] - ldrb r2, [r0, 0x10] - lsls r2, 4 - adds r2, 0x8 - mov r0, r8 - movs r1, 0x9B - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - ldr r0, [r4] - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - ldr r2, =gSprites - mov r9, r2 - add r1, r9 - str r1, [r0, 0x4] - ldrb r2, [r1, 0x5] - movs r5, 0xD - negs r5, r5 - adds r0, r5, 0 - ands r0, r2 - strb r0, [r1, 0x5] - ldr r0, [r4] - ldr r1, [r0, 0x4] - adds r1, 0x3F - ldrb r0, [r1] - movs r2, 0x1 - orrs r0, r2 - strb r0, [r1] - ldr r0, [r4] - ldr r0, [r0, 0x4] - movs r1, 0x1 - bl StartSpriteAnim - adds r6, 0x8 - adds r0, r6, 0 - bl LoadCompressedSpriteSheet - movs r3, 0x18 - add r8, r3 - ldr r6, =gUnknown_08571650 - ldr r0, [r4] - ldrb r0, [r0, 0x10] - lsls r0, 4 - adds r0, r6 - movs r2, 0x8 - ldrsh r1, [r0, r2] - movs r3, 0xA - ldrsh r2, [r0, r3] - mov r0, r8 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, [r4] - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - add r0, r9 - str r0, [r1, 0xC] - ldrb r1, [r0, 0x5] - ands r5, r1 - strb r5, [r0, 0x5] - ldr r1, [r4] - ldr r0, [r1, 0xC] - ldrb r1, [r1, 0x10] - lsls r1, 4 - adds r1, r6 - ldrb r1, [r1, 0xC] - bl StartSpriteAnim - bl GetCurrentRegionMapSectionId - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3A - beq _080C6A40 - cmp r5, 0xCA - beq _080C6A40 - b _080C6B7A -_080C6A40: - ldr r4, =gSaveBlock1Ptr - ldr r2, [r4] - movs r0, 0x5 - ldrsb r0, [r2, r0] - cmp r0, 0x4 - beq _080C6A52 - cmp r0, 0xE - bne _080C6A98 - movs r7, 0x37 -_080C6A52: - lsls r0, r7, 16 - asrs r0, 16 - ldrh r6, [r2] - adds r0, r6 - ldrh r4, [r2, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _080C6A66 - adds r0, 0x7 -_080C6A66: - lsls r0, 13 - lsrs r7, r0, 16 - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0 - bge _080C6A74 - adds r0, 0x7 -_080C6A74: - lsls r0, 13 - lsrs r4, r0, 16 - movs r5, 0 - b _080C6AF2 - .pool -_080C6A98: - lsls r0, 16 - lsrs r0, 16 - bl sub_80C68E8 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - beq _080C6AB4 - subs r0, r5, 0x1 - lsls r0, 4 - adds r0, r6 - ldrh r7, [r0, 0x8] - ldrh r4, [r0, 0xA] - b _080C6AF2 -_080C6AB4: - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x25 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xE - bne _080C6ACE - ldrh r0, [r1, 0x28] - adds r0, 0x37 - lsls r0, 16 - lsrs r7, r0, 16 - b _080C6AD0 -_080C6ACE: - ldrh r7, [r1, 0x28] -_080C6AD0: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r4, [r0, 0x2A] - lsls r0, r7, 16 - asrs r0, 16 - cmp r0, 0 - bge _080C6AE0 - adds r0, 0x7 -_080C6AE0: - lsls r0, 13 - lsrs r7, r0, 16 - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0 - bge _080C6AEE - adds r0, 0x7 -_080C6AEE: - lsls r0, 13 - lsrs r4, r0, 16 -_080C6AF2: - ldr r0, =gUnknown_085714D4 - bl LoadCompressedSpriteSheet - mov r1, sp - ldr r0, =gUnknown_085715FC - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - mov r1, sp - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - adds r0, 0x4 - strh r0, [r1, 0x2] - cmp r5, 0 - beq _080C6B2C - lsls r1, r7, 16 - asrs r1, 16 - lsls r2, r4, 16 - b _080C6B3E - .pool -_080C6B2C: - lsls r1, r7, 19 - lsls r2, r4, 19 - movs r0, 0xA0 - lsls r0, 13 - adds r1, r0 - asrs r1, 16 - movs r3, 0x90 - lsls r3, 14 - adds r2, r3 -_080C6B3E: - asrs r2, 16 - mov r0, sp - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - ldr r4, =gUnknown_02039CF4 - ldr r2, [r4] - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2, 0x8] - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - beq _080C6B7A - ldr r0, [r4] - ldr r0, [r0, 0x8] - movs r1, 0x1 - bl StartSpriteAnim -_080C6B7A: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C6974 - - thumb_func_start sub_80C6B94 -sub_80C6B94: @ 80C6B94 - push {r4-r6,lr} - sub sp, 0xC - movs r4, 0 -_080C6B9A: - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _080C6B9A - movs r4, 0 - movs r6, 0 - ldr r5, =gUnknown_08571650 -_080C6BB8: - ldr r0, =gUnknown_02039CF4 - ldr r0, [r0] - ldrb r0, [r0, 0x10] - cmp r4, r0 - bne _080C6BF0 - lsls r1, r4, 4 - adds r3, r1, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gUnknown_0857144E - str r0, [sp] - str r6, [sp, 0x4] - adds r1, r5 - ldr r0, [r1] - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x4 - bl AddTextPrinterParameterized3 - b _080C6C0E - .pool -_080C6BF0: - lsls r1, r4, 4 - adds r3, r1, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gUnknown_0857144B - str r0, [sp] - str r6, [sp, 0x4] - adds r1, r5 - ldr r0, [r1] - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x4 - bl AddTextPrinterParameterized3 -_080C6C0E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bls _080C6BB8 - ldr r0, =gUnknown_08571448 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - ldr r1, =gUnknown_08571650 - ldr r0, =gUnknown_02039CF4 - ldr r0, [r0] - ldrb r0, [r0, 0x10] - lsls r0, 4 - adds r1, 0x4 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0 - bl AddTextPrinterParameterized3 - movs r4, 0 -_080C6C40: - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _080C6C40 - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C6B94 - - thumb_func_start sub_80C6C70 -sub_80C6C70: @ 80C6C70 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - lsls r0, 24 - cmp r0, 0 - beq _080C6C8C - ldr r0, =gUnknown_02039CF4 - ldr r4, [r0] - ldrb r5, [r4, 0x10] - adds r0, r5, 0x6 - b _080C6C94 - .pool -_080C6C8C: - ldr r0, =gUnknown_02039CF4 - ldr r4, [r0] - ldrb r5, [r4, 0x10] - adds r0, r5, 0x1 -_080C6C94: - movs r1, 0x7 - bl __modsi3 - strb r0, [r4, 0x10] - lsls r0, r5, 4 - adds r3, r0, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldr r6, =gUnknown_0857144B - str r6, [sp] - movs r1, 0 - mov r8, r1 - str r1, [sp, 0x4] - ldr r4, =gUnknown_08571650 - adds r0, r4 - ldr r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x4 - bl AddTextPrinterParameterized3 - ldr r5, =gUnknown_02039CF4 - ldr r1, [r5] - ldrb r3, [r1, 0x10] - lsls r3, 4 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - adds r0, r6, 0x3 - str r0, [sp] - mov r0, r8 - str r0, [sp, 0x4] - ldrb r0, [r1, 0x10] - lsls r0, 4 - adds r0, r4 - ldr r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x4 - bl AddTextPrinterParameterized3 - ldr r1, [r5] - ldr r2, [r1, 0x4] - ldrb r0, [r1, 0x10] - lsls r0, 4 - adds r0, 0x8 - strh r0, [r2, 0x22] - ldr r0, [r1, 0xC] - ldrb r1, [r1, 0x10] - lsls r1, 4 - adds r1, r4 - ldrb r1, [r1, 0xC] - bl StartSpriteAnim - ldr r1, [r5] - ldr r2, [r1, 0xC] - ldrb r0, [r1, 0x10] - lsls r0, 4 - adds r0, r4 - ldrh r0, [r0, 0x8] - strh r0, [r2, 0x20] - ldr r2, [r1, 0xC] - ldrb r0, [r1, 0x10] - lsls r0, 4 - adds r0, r4 - ldrh r0, [r0, 0xA] - strh r0, [r2, 0x22] - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - subs r6, 0x3 - str r6, [sp] - mov r1, r8 - str r1, [sp, 0x4] - ldr r0, [r5] - ldrb r0, [r0, 0x10] - lsls r0, 4 - adds r4, 0x4 - adds r0, r4 - ldr r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0 - bl AddTextPrinterParameterized3 - movs r4, 0 -_080C6D4A: - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _080C6D4A - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x6C - bl PlaySE - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C6C70 - - thumb_func_start sub_80C6D80 -sub_80C6D80: @ 80C6D80 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - str r0, [sp, 0x24] - adds r7, r1, 0 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x28] - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - movs r0, 0 - movs r1, 0 - str r0, [sp, 0x1C] - str r1, [sp, 0x20] - ldr r1, =0x00ffffff - ldr r0, [sp, 0x1C] - ands r0, r1 - movs r1, 0xC0 - lsls r1, 21 - orrs r0, r1 - str r0, [sp, 0x1C] - ldr r1, =0xffffff00 - add r5, sp, 0x1C - ldr r0, [r5, 0x4] - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - str r0, [r5, 0x4] - adds r0, r5, 0 - bl AddWindow - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - lsls r4, r0, 24 - lsrs r4, 24 - mov r0, r9 - lsls r1, r0, 4 - orrs r1, r0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0 - movs r1, 0x7 - bl GetWindowAttribute - adds r6, r0, 0 - ldrb r0, [r5, 0x3] - lsls r0, 5 - adds r0, r6 - mov r8, r0 - ldr r1, [sp, 0x28] - cmp r1, 0 - bne _080C6E04 - add r0, sp, 0x14 - b _080C6E08 - .pool -_080C6E04: - add r0, sp, 0x14 - mov r1, r9 -_080C6E08: - strb r1, [r0] - add r1, sp, 0x14 - movs r2, 0 - movs r0, 0xF - strb r0, [r1, 0x1] - movs r0, 0xE - strb r0, [r1, 0x2] - mov r0, r10 - lsls r4, r0, 24 - lsrs r0, r4, 24 - str r2, [sp] - str r2, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0xC] - ldr r1, [sp, 0x24] - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - ldr r0, [sp, 0x4C] - mov r10, r4 - cmp r0, 0x6 - bls _080C6E3E - movs r0, 0x6 -_080C6E3E: - ldr r4, [sp, 0x4C] - subs r4, 0x6 - cmp r0, 0 - ble _080C6E70 - adds r5, r0, 0 -_080C6E48: - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x40 - bl CpuSet - adds r1, r7, 0 - adds r1, 0x80 - mov r0, r8 - movs r2, 0x40 - bl CpuSet - adds r6, 0x80 - movs r2, 0x80 - add r8, r2 - movs r0, 0x80 - lsls r0, 1 - adds r7, r0 - subs r5, 0x1 - cmp r5, 0 - bne _080C6E48 -_080C6E70: - cmp r4, 0 - ble _080C6E90 - add r0, sp, 0x18 - mov r2, r9 - lsls r1, r2, 4 - orrs r1, r2 - strh r1, [r0] - lsls r2, r4, 7 - ldr r1, =0x001fffff - ands r2, r1 - movs r1, 0x80 - lsls r1, 17 - orrs r2, r1 - adds r1, r7, 0 - bl CpuSet -_080C6E90: - mov r1, r10 - lsrs r0, r1, 24 - bl RemoveWindow - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C6D80 - - thumb_func_start sub_80C6EAC -sub_80C6EAC: @ 80C6EAC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - str r0, [sp, 0x20] - str r1, [sp, 0x24] - adds r6, r3, 0 - ldr r0, [sp, 0x4C] - mov r9, r0 - ldr r1, [sp, 0x50] - mov r10, r1 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x28] - lsls r6, 24 - lsrs r6, 24 - mov r2, r9 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - mov r0, r10 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - movs r0, 0 - movs r1, 0 - str r0, [sp, 0x18] - str r1, [sp, 0x1C] - ldr r0, [sp, 0x20] - bl StringLength_Multibyte - lsls r0, 24 - ldr r2, =0x00ffffff - ldr r1, [sp, 0x18] - ands r1, r2 - orrs r1, r0 - str r1, [sp, 0x18] - ldr r1, =0xffffff00 - add r2, sp, 0x18 - mov r8, r2 - ldr r0, [r2, 0x4] - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - str r0, [r2, 0x4] - ldr r5, [sp, 0x18] - lsrs r5, 24 - lsls r5, 5 - mov r0, r8 - bl AddWindow - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, r6, 4 - orrs r1, r6 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0 - movs r1, 0x7 - bl GetWindowAttribute - adds r7, r0, 0 - mov r0, r8 - ldrb r0, [r0, 0x3] - lsls r0, 5 - mov r8, r0 - add r8, r7 - add r0, sp, 0x14 - movs r1, 0 - strb r6, [r0] - mov r2, r9 - strb r2, [r0, 0x1] - mov r2, r10 - strb r2, [r0, 0x2] - str r1, [sp] - str r1, [sp, 0x4] - str r0, [sp, 0x8] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0xC] - ldr r0, [sp, 0x20] - str r0, [sp, 0x10] - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0x2 - bl AddTextPrinterParameterized4 - lsrs r5, 1 - adds r0, r7, 0 - ldr r1, [sp, 0x24] - adds r2, r5, 0 - bl CpuSet - ldr r2, [sp, 0x24] - ldr r0, [sp, 0x28] - adds r1, r2, r0 - mov r0, r8 - adds r2, r5, 0 - bl CpuSet - adds r0, r4, 0 - bl RemoveWindow - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C6EAC - - .align 2, 0 @ Don't pad with nop. diff --git a/data/event_scripts.s b/data/event_scripts.s index d52f4f1ba..031e82c00 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1262,7 +1262,7 @@ VerdanturfTown_PokemonCenter_1F_EventScript_27191E:: @ 827191E lock faceplayer setvar VAR_0x8004, 0 - specialvar VAR_RESULT, sub_80C2E40 + specialvar VAR_RESULT, CountPlayerTrainerStars compare VAR_RESULT, 4 goto_if_eq OldaleTown_PokemonCenter_1F_EventScript_271A68 msgbox gUnknown_082726EB, MSGBOX_YESNO diff --git a/data/trainer_card.s b/data/frontier_pass.s similarity index 61% rename from data/trainer_card.s rename to data/frontier_pass.s index f57973200..411c5c69d 100644 --- a/data/trainer_card.s +++ b/data/frontier_pass.s @@ -12,179 +12,6 @@ .2byte \short4 .endm - .align 2 -gUnknown_0856F018:: @ 856F018 - .incbin "graphics/trainer_card/stickers_fr.4bpp.lz" - - .align 2 -gUnknown_0856F18C:: @ 856F18C - .incbin "graphics/trainer_card/unknown_56F18C.gbapal" - - .align 2 -gEmeraldTrainerCard1Star_Pal:: @ 856F1AC - .incbin "graphics/trainer_card/one_star.gbapal" - - .align 2 -gFireRedTrainerCard1Star_Pal:: @ 856F20C - .incbin "graphics/trainer_card/one_star_fr.gbapal" - - .align 2 -gEmeraldTrainerCard2Star_Pal:: @ 856F26C - .incbin "graphics/trainer_card/two_stars.gbapal" - - .align 2 -gFireRedTrainerCard2Star_Pal:: @ 856F2CC - .incbin "graphics/trainer_card/two_stars_fr.gbapal" - - .align 2 -gEmeraldTrainerCard3Star_Pal:: @ 856F32C - .incbin "graphics/trainer_card/three_stars.gbapal" - - .align 2 -gFireRedTrainerCard3Star_Pal:: @ 856F38C - .incbin "graphics/trainer_card/three_stars_fr.gbapal" - - .align 2 -gEmeraldTrainerCard4Star_Pal:: @ 856F3EC - .incbin "graphics/trainer_card/four_stars.gbapal" - - .align 2 -gFireRedTrainerCard4Star_Pal:: @ 856F44C - .incbin "graphics/trainer_card/four_stars_fr.gbapal" - - .align 2 -gUnknown_0856F4AC:: @ 856F4AC - .incbin "graphics/trainer_card/female_bg.gbapal" - - .align 2 -gUnknown_0856F4CC:: @ 856F4CC - .incbin "graphics/trainer_card/female_bg_fr.gbapal" - - .align 2 -gUnknown_0856F4EC:: @ 856F4EC - .incbin "graphics/trainer_card/badges.gbapal" - - .align 2 -gUnknown_0856F50C:: @ 856F50C - .incbin "graphics/trainer_card/badges_fr.gbapal" - - .align 2 -gUnknown_0856F52C:: @ 856F52C - .incbin "graphics/trainer_card/gold.gbapal" - - .align 2 -gUnknown_0856F54C:: @ 856F54C - .incbin "graphics/trainer_card/stickers_fr1.gbapal" - - .align 2 -gUnknown_0856F56C:: @ 856F56C - .incbin "graphics/trainer_card/stickers_fr2.gbapal" - - .align 2 -gUnknown_0856F58C:: @ 856F58C - .incbin "graphics/trainer_card/stickers_fr3.gbapal" - - .align 2 -gUnknown_0856F5AC:: @ 856F5AC - .incbin "graphics/trainer_card/stickers_fr4.gbapal" - - .align 2 -gUnknown_0856F5CC:: @ 856F5CC - .incbin "graphics/trainer_card/badges.4bpp.lz" - - .align 2 -gUnknown_0856F814:: @ 856F814 - .incbin "graphics/trainer_card/badges_fr.4bpp.lz" - - .align 2 -gUnknown_0856FAB4:: @ 856FAB4 - .4byte 0x000025b0, 0x000001d9, 0x000031e2, 0x003011f3 - - .align 2 -gUnknown_0856FAC4:: @ 856FAC4 - window_template 0x01, 0x02, 0x0f, 0x1b, 0x04, 0x0f, 0x0253 - window_template 0x01, 0x01, 0x01, 0x1c, 0x12, 0x0f, 0x0001 - window_template 0x03, 0x13, 0x05, 0x09, 0x0a, 0x08, 0x0150 - null_window_template - - .align 2 -gEmeraldTrainerCardStarPals:: @ 856FAE4 - .4byte gEmeraldTrainerCard0Star_Pal - .4byte gEmeraldTrainerCard1Star_Pal - .4byte gEmeraldTrainerCard2Star_Pal - .4byte gEmeraldTrainerCard3Star_Pal - .4byte gEmeraldTrainerCard4Star_Pal - - .align 2 -gFireRedTrainerCardStarPals:: @ 856FAF8 - .4byte gFireRedTrainerCard0Star_Pal - .4byte gFireRedTrainerCard1Star_Pal - .4byte gFireRedTrainerCard2Star_Pal - .4byte gFireRedTrainerCard3Star_Pal - .4byte gFireRedTrainerCard4Star_Pal - -gUnknown_0856FB0C:: @ 856FB0C - .byte 0x00, 0x02, 0x03 - -gUnknown_0856FB0F:: @ 856FB0F - .byte 0x00, 0x04, 0x05 - -gUnknown_0856FB12:: @ 856FB12 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - -gUnknown_0856FB18:: @ 856FB18 - .byte 0x0d, 0x04, 0x0d, 0x04, 0x01, 0x00, 0x01, 0x00 - -gUnknown_0856FB20:: @ 856FB20 - .byte 0x4e, 0x4f, 0x50, 0x51, 0x3c, 0x3f - - .align 2 -gUnknown_0856FB28:: @ 856FB28 - .4byte sub_80C4998 - .4byte sub_80C49D8 - .4byte sub_80C4B08 - .4byte sub_80C4C1C - .4byte sub_80C4C84 - .4byte sub_80C4DB0 - - .align 2 -gUnknown_0856FB40:: @ 856FB40 - .4byte gUnknown_0856FB0C - .4byte gUnknown_0856FB12 - -gUnknown_0856FB48:: @ 856FB48 - .byte 0x71, 0x68 - -gUnknown_0856FB4A:: @ 856FB4A - .byte 0x81, 0x78 - -gUnknown_0856FB4C:: @ 856FB4C - .byte 0xfd, 0x02, 0xf0, 0xfd, 0x03, 0xf0, 0xfd, 0x04, 0xff - -gUnknown_0856FB55:: @ 856FB55 - .byte 0x08, 0x10 - -gUnknown_0856FB57:: @ 856FB57 - .byte 0xd8, 0xd8 - - .align 2 -gUnknown_0856FB5C:: @ 856FB5C - .4byte gText_LinkBattles - .4byte gText_LinkCableBattles - .4byte gText_LinkBattles - -gUnknown_0856FB68:: @ 856FB68 - .byte 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a - -gUnknown_0856FB6E:: @ 856FB6E - .byte 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14 - -gUnknown_0856FB74:: @ 856FB74 - .byte 0x0b, 0x0c, 0x0d, 0x0e - -gUnknown_0856FB78:: @ 856FB78 - .byte 0x07, 0x07 - .align 2 gUnknown_0856FB7C:: @ 856FB7C .incbin "graphics/frontier_pass/map_heads.gbapal" diff --git a/data/maps/LilycoveCity/scripts.inc b/data/maps/LilycoveCity/scripts.inc index 02319e8cf..c1cec509f 100644 --- a/data/maps/LilycoveCity/scripts.inc +++ b/data/maps/LilycoveCity/scripts.inc @@ -157,7 +157,7 @@ LilycoveCity_EventScript_1E2D11:: @ 81E2D11 LilycoveCity_EventScript_1E2D1A:: @ 81E2D1A lockall - specialvar VAR_0x8004, sub_80F8940 + specialvar VAR_0x8004, CountPlayerContestPaintings switch VAR_0x8004 case 0, LilycoveCity_EventScript_1E2D3A msgbox LilycoveCity_Text_1E4571, MSGBOX_DEFAULT diff --git a/data/maps/LilycoveCity_ContestLobby/scripts.inc b/data/maps/LilycoveCity_ContestLobby/scripts.inc index 74bee15d3..42ce7beeb 100644 --- a/data/maps/LilycoveCity_ContestLobby/scripts.inc +++ b/data/maps/LilycoveCity_ContestLobby/scripts.inc @@ -100,7 +100,7 @@ LilycoveCity_ContestLobby_EventScript_21A314:: @ 821A314 return LilycoveCity_ContestLobby_EventScript_21A360:: @ 821A360 - specialvar VAR_0x8004, sub_80F8940 + specialvar VAR_0x8004, CountPlayerContestPaintings switch VAR_0x8004 case 1, LilycoveCity_ContestLobby_EventScript_21A3A2 case 2, LilycoveCity_ContestLobby_EventScript_21A3A6 diff --git a/data/maps/LilycoveCity_CoveLilyMotel_2F/scripts.inc b/data/maps/LilycoveCity_CoveLilyMotel_2F/scripts.inc index f7fd5f453..03ac733f9 100644 --- a/data/maps/LilycoveCity_CoveLilyMotel_2F/scripts.inc +++ b/data/maps/LilycoveCity_CoveLilyMotel_2F/scripts.inc @@ -6,7 +6,7 @@ LilycoveCity_CoveLilyMotel_2F_EventScript_2186D3:: @ 82186D3 faceplayer call_if_unset FLAG_TEMP_2, LilycoveCity_CoveLilyMotel_2F_EventScript_2186F9 call_if_set FLAG_TEMP_2, LilycoveCity_CoveLilyMotel_2F_EventScript_21870F - specialvar VAR_RESULT, sub_80C08E4 + specialvar VAR_RESULT, HasAllHoennMons compare VAR_RESULT, 1 goto_if_eq LilycoveCity_CoveLilyMotel_2F_EventScript_218702 release diff --git a/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc b/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc index da39ee655..f73fbf092 100644 --- a/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc +++ b/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc @@ -92,7 +92,7 @@ LilycoveCity_LilycoveMuseum_2F_Movement_219863: @ 8219863 LilycoveCity_LilycoveMuseum_2F_EventScript_219866:: @ 8219866 lockall goto_if_set FLAG_RECEIVED_GLASS_ORNAMENT, LilycoveCity_LilycoveMuseum_2F_EventScript_219921 - specialvar VAR_0x8004, sub_80F8940 + specialvar VAR_0x8004, CountPlayerContestPaintings switch VAR_0x8004 case 1, LilycoveCity_LilycoveMuseum_2F_EventScript_2198BA case 2, LilycoveCity_LilycoveMuseum_2F_EventScript_2198BA diff --git a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc index 8568a72ef..1f65beda3 100644 --- a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc +++ b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc @@ -16,7 +16,7 @@ LittlerootTown_ProfessorBirchsLab_MapScript1_1F9CA1: @ 81F9CA1 end LittlerootTown_ProfessorBirchsLab_EventScript_1F9CCD:: @ 81F9CCD - specialvar VAR_RESULT, sub_80C08E4 + specialvar VAR_RESULT, HasAllHoennMons compare VAR_RESULT, 1 goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_1F9CE9 setobjectmovementtype 3, 3 diff --git a/data/specials.inc b/data/specials.inc index a5f272dc9..b3ca15ed1 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -148,7 +148,7 @@ gSpecials:: @ 81DBA64 def_special sub_80F88E8 def_special sub_80F88DC def_special sub_80F8864 - def_special sub_80F8940 + def_special CountPlayerContestPaintings def_special ShowContestWinner def_special MauvilleGymSpecial2 def_special MauvilleGymSpecial1 @@ -345,7 +345,7 @@ gSpecials:: @ 81DBA64 def_special sub_80B05B4 def_special SetPacifidlogTMReceivedDay def_special GetDaysUntilPacifidlogTMAvailable - def_special sub_80C08E4 + def_special HasAllHoennMons def_special MonOTNameMatchesPlayer def_special BufferLottoTicketNumber def_special sub_81653CC @@ -481,7 +481,7 @@ gSpecials:: @ 81DBA64 def_special sub_813B7D8 def_special sub_81C72A4 def_special sp106_CreateStartMenu - def_special sub_80C2E40 + def_special CountPlayerTrainerStars def_special sub_813AC7C def_special sub_813ADB8 def_special sub_813ADD4 diff --git a/include/graphics.h b/include/graphics.h index 29719d1a0..77390db90 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4846,4 +4846,18 @@ extern const u16 gUnknown_08DC64E8[]; extern const u16 gUnknown_08DC64FC[]; extern const u16 gUnknown_08DC6510[]; +// Trainer Card. +extern const u16 gEmeraldTrainerCard0Star_Pal[]; +extern const u32 gEmeraldTrainerCard_Gfx[]; +extern const u16 gFireRedTrainerCard0Star_Pal[]; +extern const u32 gFireRedTrainerCard_Gfx[]; +extern const u32 gUnknown_08DD2AE0[]; +extern const u32 gUnknown_08DD21B0[]; +extern const u32 gUnknown_08DD2D30[]; +extern const u32 gUnknown_08DD2010[]; +extern const u32 gUnknown_08DD2B78[]; +extern const u32 gUnknown_08DD228C[]; +extern const u32 gUnknown_08DD2E5C[]; +extern const u32 gUnknown_08DD1F78[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/palette.h b/include/palette.h index 540452f3d..f51dc4b88 100644 --- a/include/palette.h +++ b/include/palette.h @@ -66,5 +66,9 @@ void BeginHardwarePaletteFade(u8, u8, u8, u8, u8); void BlendPalettes(u32, u8, u16); void BlendPalettesUnfaded(u32, u8, u16); void sub_80A2C44(u32 a1, s8 a2, u8 a3, u8 a4, u16 a5, u8 a6, u8 a7); +void TintPalette_GrayScale(u16 *palette, u16 count); +void TintPalette_GrayScale2(u16 *palette, u16 count); +void TintPalette_SepiaTone(u16 *palette, u16 count); +void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 bTone); #endif // GUARD_PALETTE_H diff --git a/include/pokedex.h b/include/pokedex.h index b6d323fd3..91e9e37d4 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -41,5 +41,6 @@ u16 GetHoennPokedexCount(u8); u8 CreateDexDisplayMonDataTask(u16 dexNum, u32 trainerId, u32 personality); s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16); +bool16 HasAllHoennMons(void); #endif // GUARD_POKEDEX_H diff --git a/include/script_pokemon_util_80F87D8.h b/include/script_pokemon_util_80F87D8.h index 02a35ecba..7d8d99628 100644 --- a/include/script_pokemon_util_80F87D8.h +++ b/include/script_pokemon_util_80F87D8.h @@ -4,5 +4,6 @@ u16 sub_80F903C(void); void ReducePlayerPartyToSelectedMons(void); void HealPlayerParty(void); +u8 CountPlayerContestPaintings(void); #endif // GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H diff --git a/include/strings.h b/include/strings.h index ff0d08195..4e9c91ff5 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2222,4 +2222,30 @@ extern const u8 gText_PreliminaryResults[]; extern const u8 gText_Round2Results[]; extern const u8 gText_Var1sVar2Won[]; +// Trainer Card +extern const u8 gText_LinkCableBattles[]; +extern const u8 gText_LinkBattles[]; +extern const u8 gText_WaitingTrainerFinishReading[]; +extern const u8 gText_TrainerCardName[]; +extern const u8 gText_TrainerCardIDNo[]; +extern const u8 gText_TrainerCardMoney[]; +extern const u8 gText_PokedollarVar1[]; +extern const u8 gText_EmptyString6[]; +extern const u8 gText_TrainerCardPokedex[]; +extern const u8 gText_TrainerCardTime[]; +extern const u8 gText_Colon2[]; +extern const u8 gText_Var1sTrainerCard[]; +extern const u8 gText_HallOfFameDebut[]; +extern const u8 gText_WinsLosses[]; +extern const u8 gText_PokemonTrades[]; +extern const u8 gText_BerryCrush[]; +extern const u8 gText_UnionTradesAndBattles[]; +extern const u8 gText_Var1DarkGreyShadowLightGrey[]; +extern const u8 gText_PokeblocksWithFriends[]; +extern const u8 gText_WonContestsWFriends[]; +extern const u8 gText_WSlashStraightSlash[]; +extern const u8 gText_Var1DarkLightGreyBP[]; +extern const u8 gText_BattleTower[]; +extern const u8 gText_BattlePtsWon[]; + #endif //GUARD_STRINGS_H diff --git a/include/trainer_card.h b/include/trainer_card.h index 1af247d8a..1cadbd8fc 100644 --- a/include/trainer_card.h +++ b/include/trainer_card.h @@ -6,38 +6,47 @@ struct TrainerCard /*0x00*/ u8 gender; /*0x01*/ u8 stars; /*0x02*/ bool8 hasPokedex; - /*0x03*/ bool8 var_3; - /*0x04*/ bool8 var_4; - /*0x05*/ u8 var_5; - /*0x06*/ u16 firstHallOfFameA; - /*0x08*/ u16 firstHallOfFameB; - /*0x0A*/ u16 firstHallOfFameC; - /*0x0C*/ u16 pokedexSeen; + /*0x03*/ bool8 caughtAllHoenn; + /*0x04*/ bool8 hasAllPaintings; + /*0x06*/ u16 hofDebutHours; + /*0x08*/ u16 hofDebutMinutes; + /*0x0A*/ u16 hofDebutSeconds; + /*0x0C*/ u16 caughtMonsCount; /*0x0E*/ u16 trainerId; /*0x10*/ u16 playTimeHours; /*0x12*/ u16 playTimeMinutes; /*0x14*/ u16 linkBattleWins; /*0x16*/ u16 linkBattleLosses; /*0x18*/ u16 battleTowerWins; - /*0x1A*/ u16 battleTowerLosses; + /*0x1A*/ u16 battleTowerStraightWins; /*0x1C*/ u16 contestsWithFriends; /*0x1E*/ u16 pokeblocksWithFriends; /*0x20*/ u16 pokemonTrades; - /*0x22*/ u16 var_22; /*0x24*/ u32 money; /*0x28*/ u16 var_28[4]; - /*0x30*/ u8 playerName[8]; - /*0x38*/ u8 emeraldAddedUnknownFields[0x54-0x38]; - /*0x54*/ u16 monSpecies[2]; - /*0x58*/ u8 emeraldAddedUnknownFields2[0x64-0x58]; + /*0x30*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; + /*0x38*/ u8 version; + /*0x3A*/ u16 var_3A; + /*0x3C*/ u32 berryCrushPoints; + /*0x40*/ u32 unionRoomNum; + /*0x44*/ u8 filler44[0x8]; + /*0x4C*/ u8 var_4C; + /*0x4D*/ u8 var_4D; + /*0x4E*/ u8 var_4E; + /*0x4F*/ u8 var_4F; + /*0x50*/ u8 var_50[0x4]; + /*0x54*/ u16 monSpecies[PARTY_SIZE]; + /*0x60*/ bool16 hasAllSymbols; + /*0x62*/ u16 frontierBP; }; extern struct TrainerCard gTrainerCards[4]; -void sub_80C3120(struct TrainerCard *arg0, u16 *arg1, u8 gameVersion); -void TrainerCard_ShowLinkCard(u8 arg0, void (*callback)(void)); +u32 CountPlayerTrainerStars(void); +u8 sub_80C4904(u8 cardId); +void CopyTrainerCardData(struct TrainerCard *dst, u16 *src, u8 gameVersion); +void ShowPlayerTrainerCard(void (*callback)(void)); +void ShowTrainerCardInLink(u8 arg0, void (*callback)(void)); void TrainerCard_GenerateCardForPlayer(struct TrainerCard *); -u8 sub_80C4904(u8); -void sub_80C6D80(const u8 *, u8 *, u8, u8, u8); #endif // GUARD_TRAINER_CARD_H diff --git a/ld_script.txt b/ld_script.txt index c1f7a1972..e199c8fe5 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -124,7 +124,9 @@ SECTIONS { src/scanline_effect.o(.text); src/option_menu.o(.text); src/pokedex.o(.text); - asm/trainer_card.o(.text); + src/trainer_card.o(.text); + src/frontier_pass.o(.text); + asm/frontier_pass.o(.text); src/pokemon_storage_system.o(.text); src/pokemon_icon.o(.text); src/script_movement.o(.text); @@ -457,7 +459,8 @@ SECTIONS { src/field_effect.o(.rodata); src/option_menu.o(.rodata); src/pokedex.o(.rodata); - data/trainer_card.o(.rodata); + src/trainer_card.o(.rodata); + data/frontier_pass.o(.rodata); src/pokemon_storage_system.o(.rodata); src/pokemon_icon.o(.rodata); src/fldeff_cut.o(.rodata); diff --git a/src/cable_club.c b/src/cable_club.c index 784426d53..ce9b9db05 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -498,7 +498,7 @@ static void sub_80B2C30(u8 taskId) for (index = 0; index < GetLinkPlayerCount(); index++) { - sub_80C3120(&gTrainerCards[index], gBlockRecvBuffer[index], gLinkPlayers[index].version); + CopyTrainerCardData(&gTrainerCards[index], gBlockRecvBuffer[index], gLinkPlayers[index].version); } SetSuppressLinkErrorMessage(FALSE); @@ -1176,7 +1176,7 @@ static void sub_80B39A4(void) void sp02A_crash_sound(void) { - TrainerCard_ShowLinkCard(gSpecialVar_0x8006, CB2_ReturnToFieldContinueScriptPlayMapMusic); + ShowTrainerCardInLink(gSpecialVar_0x8006, CB2_ReturnToFieldContinueScriptPlayMapMusic); } bool32 sub_80B39D4(u8 linkPlayerIndex) diff --git a/src/frontier_pass.c b/src/frontier_pass.c new file mode 100644 index 000000000..4473dfae0 --- /dev/null +++ b/src/frontier_pass.c @@ -0,0 +1,31 @@ +#include "global.h" +#include "gpu_regs.h" +#include "bg.h" + +void sub_80C50D0(void) +{ + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetGpuReg(REG_OFFSET_BG3CNT, 0); + SetGpuReg(REG_OFFSET_BG2CNT, 0); + SetGpuReg(REG_OFFSET_BG1CNT, 0); + SetGpuReg(REG_OFFSET_BG0CNT, 0); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WIN1H, 0); + SetGpuReg(REG_OFFSET_WIN1V, 0); + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + CpuFill16(0, (void *)VRAM, VRAM_SIZE); + CpuFill32(0, (void *)OAM, OAM_SIZE); +} diff --git a/src/pokedex.c b/src/pokedex.c index 8c6ed3159..f99a8226a 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4271,46 +4271,46 @@ s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID) retVal = 0; switch (caseID) { - case FLAG_GET_SEEN: - if (gSaveBlock2Ptr->pokedex.seen[index] & mask) + case FLAG_GET_SEEN: + if (gSaveBlock2Ptr->pokedex.seen[index] & mask) + { + if ((gSaveBlock2Ptr->pokedex.seen[index] & mask) == (gSaveBlock1Ptr->seen1[index] & mask) + && (gSaveBlock2Ptr->pokedex.seen[index] & mask) == (gSaveBlock1Ptr->seen2[index] & mask)) + retVal = 1; + else { - if ((gSaveBlock2Ptr->pokedex.seen[index] & mask) == (gSaveBlock1Ptr->seen1[index] & mask) - && (gSaveBlock2Ptr->pokedex.seen[index] & mask) == (gSaveBlock1Ptr->seen2[index] & mask)) - retVal = 1; - else - { - gSaveBlock2Ptr->pokedex.seen[index] &= ~mask; - gSaveBlock1Ptr->seen1[index] &= ~mask; - gSaveBlock1Ptr->seen2[index] &= ~mask; - retVal = 0; - } + gSaveBlock2Ptr->pokedex.seen[index] &= ~mask; + gSaveBlock1Ptr->seen1[index] &= ~mask; + gSaveBlock1Ptr->seen2[index] &= ~mask; + retVal = 0; } - break; - case FLAG_GET_CAUGHT: - if (gSaveBlock2Ptr->pokedex.owned[index] & mask) + } + break; + case FLAG_GET_CAUGHT: + if (gSaveBlock2Ptr->pokedex.owned[index] & mask) + { + if ((gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock2Ptr->pokedex.seen[index] & mask) + && (gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock1Ptr->seen1[index] & mask) + && (gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock1Ptr->seen2[index] & mask)) + retVal = 1; + else { - if ((gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock2Ptr->pokedex.seen[index] & mask) - && (gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock1Ptr->seen1[index] & mask) - && (gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock1Ptr->seen2[index] & mask)) - retVal = 1; - else - { - gSaveBlock2Ptr->pokedex.owned[index] &= ~mask; - gSaveBlock2Ptr->pokedex.seen[index] &= ~mask; - gSaveBlock1Ptr->seen1[index] &= ~mask; - gSaveBlock1Ptr->seen2[index] &= ~mask; - retVal = 0; - } + gSaveBlock2Ptr->pokedex.owned[index] &= ~mask; + gSaveBlock2Ptr->pokedex.seen[index] &= ~mask; + gSaveBlock1Ptr->seen1[index] &= ~mask; + gSaveBlock1Ptr->seen2[index] &= ~mask; + retVal = 0; } - break; - case FLAG_SET_SEEN: - gSaveBlock2Ptr->pokedex.seen[index] |= mask; - gSaveBlock1Ptr->seen1[index] |= mask; - gSaveBlock1Ptr->seen2[index] |= mask; - break; - case FLAG_SET_CAUGHT: - gSaveBlock2Ptr->pokedex.owned[index] |= mask; - break; + } + break; + case FLAG_SET_SEEN: + gSaveBlock2Ptr->pokedex.seen[index] |= mask; + gSaveBlock1Ptr->seen1[index] |= mask; + gSaveBlock1Ptr->seen2[index] |= mask; + break; + case FLAG_SET_CAUGHT: + gSaveBlock2Ptr->pokedex.owned[index] |= mask; + break; } return retVal; } @@ -4324,14 +4324,14 @@ u16 GetNationalPokedexCount(u8 caseID) { switch (caseID) { - case FLAG_GET_SEEN: - if (GetSetPokedexFlag(i + 1, FLAG_GET_SEEN)) - count++; - break; - case FLAG_GET_CAUGHT: - if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) - count++; - break; + case FLAG_GET_SEEN: + if (GetSetPokedexFlag(i + 1, FLAG_GET_SEEN)) + count++; + break; + case FLAG_GET_CAUGHT: + if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) + count++; + break; } } return count; @@ -4346,14 +4346,14 @@ u16 GetHoennPokedexCount(u8 caseID) { switch (caseID) { - case FLAG_GET_SEEN: - if (GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_SEEN)) - count++; - break; - case FLAG_GET_CAUGHT: - if (GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_CAUGHT)) - count++; - break; + case FLAG_GET_SEEN: + if (GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_SEEN)) + count++; + break; + case FLAG_GET_CAUGHT: + if (GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_CAUGHT)) + count++; + break; } } return count; @@ -4381,7 +4381,7 @@ u16 sub_80C089C(u8 caseID) return count; } -bool8 sub_80C08E4(void) +bool16 HasAllHoennMons(void) { u16 i; diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index 813d143d2..41f7eeee7 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -1577,7 +1577,7 @@ void sub_80140E0(u8 taskId) for (i = 0; i < GetLinkPlayerCount(); i++) { recvBuff = gBlockRecvBuffer[i]; - sub_80C3120(&gTrainerCards[i], recvBuff, gLinkPlayers[i].version); + CopyTrainerCardData(&gTrainerCards[i], recvBuff, gLinkPlayers[i].version); } if (GetLinkPlayerCount() == 2) @@ -1607,7 +1607,7 @@ void sub_80141A4(void) break; case 1: if (!FuncIsActiveTask(sub_80140E0)) - TrainerCard_ShowLinkCard(GetMultiplayerId() ^ 1, CB2_ReturnToField); + ShowTrainerCardInLink(GetMultiplayerId() ^ 1, CB2_ReturnToField); break; } diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index f3eaa7161..cade00b50 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -128,18 +128,18 @@ void sub_80F88E8(void) } } -u8 sub_80F8940(void) +u8 CountPlayerContestPaintings(void) { int i; - u8 var0 = 0; + u8 count = 0; for (i = 0; i < 5; i++) { if (gSaveBlock1Ptr->contestWinners[8 + i].species) - var0++; + count++; } - return var0; + return count; } void sub_80F8970(void) diff --git a/src/start_menu.c b/src/start_menu.c index 0f608b1d2..6b4b0e775 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -9,6 +9,7 @@ #include "strings.h" #include "bg.h" #include "field_effect.h" +#include "party_menu.h" #include "task.h" #include "overworld.h" #include "link.h" @@ -30,6 +31,7 @@ #include "scanline_effect.h" #include "text_window.h" #include "load_save.h" +#include "trainer_card.h" #include "international_string_util.h" #include "constants/songs.h" #include "field_player_avatar.h" @@ -89,11 +91,9 @@ extern void var_800D_set_xB(void); extern void sub_808B864(void); extern void CB2_Pokedex(void); extern void PlayRainSoundEffect(void); -extern void CB2_PartyMenuFromStartMenu(void); extern void CB2_PokeNav(void); -extern void sub_80C4DDC(void (*)(void)); +extern void ShowPlayerTrainerCard(void (*)(void)); extern void sub_80C51C4(void (*)(void)); -extern void TrainerCard_ShowLinkCard(u8, void (*)(void)); extern void ScriptUnfreezeEventObjects(void); extern void sub_81A9EC8(void); extern void save_serialize_map(void); @@ -422,16 +422,19 @@ static bool32 PrintStartMenuActions(s8 *pIndex, u32 count) do { - if (sStartMenuItems[sCurrentStartMenuActions[index]].func.u8_void == StartMenuPlayerNameCallback) { + if (sStartMenuItems[sCurrentStartMenuActions[index]].func.u8_void == StartMenuPlayerNameCallback) + { PrintPlayerNameOnWindow(GetStartMenuWindowId(), sStartMenuItems[sCurrentStartMenuActions[index]].text, 8, (index << 4) + 9); } - else { + else + { StringExpandPlaceholders(gStringVar4, sStartMenuItems[sCurrentStartMenuActions[index]].text); AddTextPrinterParameterized(GetStartMenuWindowId(), 1, gStringVar4, 8, (index << 4) + 9, 0xFF, NULL); } index++; - if (index >= sNumStartMenuActions) { + if (index >= sNumStartMenuActions) + { *pIndex = index; return TRUE; } @@ -465,21 +468,14 @@ static bool32 InitStartMenuStep(void) break; case 3: if (GetSafariZoneFlag()) - { ShowSafariBallsWindow(); - } if (InBattlePyramid()) - { ShowPyramidFloorWindow(); - } sUnknown_02037619[0]++; break; case 4: - if (!PrintStartMenuActions(&sUnknown_02037619[1], 2)) - { - break; - } - sUnknown_02037619[0]++; + if (PrintStartMenuActions(&sUnknown_02037619[1], 2)) + sUnknown_02037619[0]++; break; case 5: sStartMenuCursorPos = sub_81983AC(GetStartMenuWindowId(), 1, 0, 9, 16, sNumStartMenuActions, sStartMenuCursorPos); @@ -494,15 +490,14 @@ static void InitStartMenu(void) { sUnknown_02037619[0] = 0; sUnknown_02037619[1] = 0; - while (!InitStartMenuStep()); + while (!InitStartMenuStep()) + ; } static void StartMenuTask(u8 taskId) { if (InitStartMenuStep() == TRUE) - { SwitchTaskToFollowupFunc(taskId); - } } static void CreateStartMenuTask(TaskFunc followupFunc) @@ -541,18 +536,14 @@ void sub_809FA34(u8 taskId) // Referenced in field_screen.s and rom_8011DC0.s { case 0: if (InUnionRoom() == TRUE) - { var_800D_set_xB(); - } gMenuCallback = HandleStartMenuInput; task->data[0]++; break; case 1: if (gMenuCallback() == TRUE) - { DestroyTask(taskId); - } break; } } @@ -588,9 +579,8 @@ static bool8 HandleStartMenuInput(void) PlaySE(SE_SELECT); if (sStartMenuItems[sCurrentStartMenuActions[sStartMenuCursorPos]].func.u8_void == StartMenuPokedexCallback) { - if (GetNationalPokedexCount(0) == 0) { + if (GetNationalPokedexCount(0) == 0) return FALSE; - } } gMenuCallback = sStartMenuItems[sCurrentStartMenuActions[sStartMenuCursorPos]].func.u8_void; @@ -686,17 +676,11 @@ static bool8 StartMenuPlayerNameCallback(void) CleanupOverworldWindowsAndTilemaps(); if (is_c1_link_related_active() || InUnionRoom()) - { - sub_80C4DDC(CB2_ReturnToFieldWithOpenMenu); // Display trainer card - } + ShowPlayerTrainerCard(CB2_ReturnToFieldWithOpenMenu); // Display trainer card else if (FlagGet(FLAG_SYS_FRONTIER_PASS)) - { sub_80C51C4(CB2_ReturnToFieldWithOpenMenu); // Display frontier pass - } else - { - sub_80C4DDC(CB2_ReturnToFieldWithOpenMenu); // Display trainer card - } + ShowPlayerTrainerCard(CB2_ReturnToFieldWithOpenMenu); // Display trainer card return TRUE; } @@ -707,9 +691,7 @@ static bool8 StartMenuPlayerNameCallback(void) static bool8 StartMenuSaveCallback(void) { if (InBattlePyramid()) - { RemoveExtraStartMenuWindows(); - } gMenuCallback = SaveStartCallback; // Display save menu @@ -755,7 +737,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void) { PlayRainSoundEffect(); CleanupOverworldWindowsAndTilemaps(); - TrainerCard_ShowLinkCard(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu); + ShowTrainerCardInLink(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu); return TRUE; } diff --git a/src/trade.c b/src/trade.c index 7af1e19c9..99c9f6088 100644 --- a/src/trade.c +++ b/src/trade.c @@ -49,6 +49,8 @@ #define Trade_SendData(ptr) (SendBlock(bitmask_all_link_players_but_self(), ptr->linkData, 20)) +extern void sub_80C6D80(const u8 *, u8 *, u8, u8, u8); + struct InGameTrade { /*0x00*/ u8 name[11]; /*0x0C*/ u16 species; diff --git a/src/trainer_card.c b/src/trainer_card.c new file mode 100755 index 000000000..cde15ae34 --- /dev/null +++ b/src/trainer_card.c @@ -0,0 +1,1857 @@ +#include "global.h" +#include "scanline_effect.h" +#include "palette.h" +#include "task.h" +#include "main.h" +#include "window.h" +#include "alloc.h" +#include "link.h" +#include "bg.h" +#include "sound.h" +#include "overworld.h" +#include "menu.h" +#include "text.h" +#include "event_data.h" +#include "easy_chat.h" +#include "money.h" +#include "strings.h" +#include "string_util.h" +#include "trainer_card.h" +#include "gpu_regs.h" +#include "international_string_util.h" +#include "pokedex.h" +#include "graphics.h" +#include "pokemon_icon.h" +#include "trainer_pokemon_sprites.h" +#include "script_pokemon_util_80F87D8.h" +#include "constants/songs.h" +#include "constants/flags.h" +#include "constants/game_stat.h" +#include "constants/battle_frontier.h" + +enum +{ + CARD_TYPE_FRLG, + CARD_TYPE_RS, + CARD_TYPE_EMERALD, +}; + +struct TrainerCardData +{ + u8 var_0; + u8 printState; + u8 gfxLoadState; + u8 bgPalLoadState; + u8 var_4; + bool8 isLink; + u8 var_6; + u8 var_7; + u8 var_8; + bool8 allowDMACopy; + bool8 hasPokedex; + bool8 hasHofResult; + bool8 hasLinkResults; + bool8 hasBattleTowerWins; + u8 var_E; + u8 var_F; + bool8 hasTrades; + u8 badgeCount[8]; + u8 var_19[4][0xD]; + u8 var_4D[0x46]; + u8 var_93[0x46]; + u8 var_D9[0x8C]; + u8 var_165[0x46]; + u8 var_1AB[0x8C]; + u8 var_237[0x8C]; + u8 var_2C3[0x8C]; + u8 var_34F[0x46]; + u8 var_395[0x46]; + u8 var_3DB[0x46]; + u8 var_421[0x46]; + u16 var_468[0x60]; + s8 var_528; + u8 var_529; + u8 cardType; + bool8 isHoenn; + u16 var_52C; + void (*callback2)(void); + struct TrainerCard trainerCard; + u16 var_598[0x4B0 / 2]; + u16 var_A48[0x4B0 / 2]; + u16 var_EF8[0x4B0 / 2]; + u8 var_13A8[0x400]; + u8 var_17A8[0x200]; + u8 var_19A8[0x2300]; + u16 var_3CA8[0x2000 / 2]; + u16 var_5CA8[0x2000 / 2]; + u16 var_7CA8; + u8 language; +}; + +//external functions +extern u8 sub_80D30A0(u16); +extern void sub_80C5868(void); + +// EWRAM +EWRAM_DATA static struct TrainerCardData *sData = NULL; + +//this file's functions +static void VblankCb_TrainerCard(void); +static void HblankCb_TrainerCard(void); +static void sub_80C48C8(void); +static void CB2_TrainerCard(void); +static void CloseTrainerCard(u8 task); +static bool8 PrintAllOnCardPage1(void); +static void sub_80C438C(u8); +static void sub_80C4FF0(void); +static void sub_80C4550(u16*); +static void sub_80C45C0(u16*); +static void sub_80C4630(void); +static void PrintTimeOnCard(void); +static void sub_80C4918(void); +static bool8 sub_80C4940(void); +static bool8 LoadCardGfx(void); +static void CB2_InitTrainerCard(void); +static u32 GetCappedGameStat(u8 statId, u32 maxValue); +static bool8 HasAllFrontierSymbols(void); +static u8 GetRubyTrainerStars(struct TrainerCard*); +static u16 GetCaughtMonsCount(void); +static void SetPlayerCardData(struct TrainerCard*, u8); +static void sub_80C3020(struct TrainerCard*); +static u8 VersionToCardType(u8); +static void SetDataFromTrainerCard(void); +static void HandleGpuRegs(void); +static void ResetGpuRegs(void); +static void InitBgsAndWindows(void); +static void SetTrainerCardCb2(void); +static void sub_80C3414(void); +static void sub_80C4EE4(void); +static u8 GetSetCardType(void); +static void PrintNameOnCard(void); +static void PrintIdOnCard(void); +static void PrintMoneyOnCard(void); +static void PrintPokedexOnCard(void); +static void PrintProfilePhraseOnCard(void); +static bool8 PrintStringsOnCardPage2(void); +static void sub_80C3B50(void); +static void PrintHofDebutStringOnCard(void); +static void PrintWinsLossesStringOnCard(void); +static void PrintTradesStringOnCard(void); +static void PrintBerryCrushStringOnCard(void); +static void PrintPokeblockStringOnCard(void); +static void PrintUnionStringOnCard(void); +static void PrintContestStringOnCard(void); +static void sub_80C4140(void); +static void PrintBattleFacilityStringOnCard(void); +static void sub_80C42A4(void); +static void PrintAllVariableNumsOnCardPage2(void); +static void PrintNameOnCard2(void); +static void PrintHofTimeOnCard(void); +static void PrintLinkResultsNumsOnCard(void); +static void PrintTradesNumOnCard(void); +static void PrintBerryCrushNumOnCard(void); +static void PrintUnionNumOnCard(void); +static void PrintPokeblocksNumOnCard(void); +static void PrintContestNumOnCard(void); +static void PrintBattleFacilityNumsOnCard(void); +static void PrintString(u8 top, const u8* str1, u8* str2, const u8* color); +static void sub_80C4330(void); +static u8 SetCardBgsAndPals(void); +static void sub_80C474C(void); +static void sub_80C4960(u8); +static bool8 sub_80C4998(struct Task* task); +static bool8 sub_80C49D8(struct Task* task); +static bool8 sub_80C4B08(struct Task* task); +static bool8 sub_80C4C1C(struct Task* task); +static bool8 sub_80C4C84(struct Task* task); +static bool8 sub_80C4DB0(struct Task* task); +static void sub_80C32EC(u16); +static void sub_80C41D8(void); +static void sub_80C6D80(const u8 *, u8 *, u8, u8, u8); + +// const rom data +static const u32 gUnknown_0856F018[] = INCBIN_U32("graphics/trainer_card/stickers_fr.4bpp.lz"); +static const u16 gUnknown_0856F18C[] = INCBIN_U16("graphics/trainer_card/unknown_56F18C.gbapal"); +static const u16 gEmeraldTrainerCard1Star_Pal[] = INCBIN_U16("graphics/trainer_card/one_star.gbapal"); +static const u16 gFireRedTrainerCard1Star_Pal[] = INCBIN_U16("graphics/trainer_card/one_star_fr.gbapal"); +static const u16 gEmeraldTrainerCard2Star_Pal[] = INCBIN_U16("graphics/trainer_card/two_stars.gbapal"); +static const u16 gFireRedTrainerCard2Star_Pal[] = INCBIN_U16("graphics/trainer_card/two_stars_fr.gbapal"); +static const u16 gEmeraldTrainerCard3Star_Pal[] = INCBIN_U16("graphics/trainer_card/three_stars.gbapal"); +static const u16 gFireRedTrainerCard3Star_Pal[] = INCBIN_U16("graphics/trainer_card/three_stars_fr.gbapal"); +static const u16 gEmeraldTrainerCard4Star_Pal[] = INCBIN_U16("graphics/trainer_card/four_stars.gbapal"); +static const u16 gFireRedTrainerCard4Star_Pal[] = INCBIN_U16("graphics/trainer_card/four_stars_fr.gbapal"); +static const u16 gUnknown_0856F4AC[] = INCBIN_U16("graphics/trainer_card/female_bg.gbapal"); +static const u16 gUnknown_0856F4CC[] = INCBIN_U16("graphics/trainer_card/female_bg_fr.gbapal"); +static const u16 gUnknown_0856F4EC[] = INCBIN_U16("graphics/trainer_card/badges.gbapal"); +static const u16 gUnknown_0856F50C[] = INCBIN_U16("graphics/trainer_card/badges_fr.gbapal"); +static const u16 gUnknown_0856F52C[] = INCBIN_U16("graphics/trainer_card/gold.gbapal"); +static const u16 gUnknown_0856F54C[] = INCBIN_U16("graphics/trainer_card/stickers_fr1.gbapal"); +static const u16 gUnknown_0856F56C[] = INCBIN_U16("graphics/trainer_card/stickers_fr2.gbapal"); +static const u16 gUnknown_0856F58C[] = INCBIN_U16("graphics/trainer_card/stickers_fr3.gbapal"); +static const u16 gUnknown_0856F5AC[] = INCBIN_U16("graphics/trainer_card/stickers_fr4.gbapal"); +static const u32 gUnknown_0856F5CC[] = INCBIN_U32("graphics/trainer_card/badges.4bpp.lz"); +static const u32 gUnknown_0856F814[] = INCBIN_U32("graphics/trainer_card/badges_fr.4bpp.lz"); + +static const struct BgTemplate gUnknown_0856FAB4[4] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 27, + .screenSize = 2, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 2, + .mapBaseIndex = 29, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 192 + }, +}; + +static const struct WindowTemplate gUnknown_0856FAC4[] = +{ + { + .bg = 1, + .tilemapLeft = 2, + .tilemapTop = 15, + .width = 27, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x253, + }, + { + .bg = 1, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 28, + .height = 18, + .paletteNum = 15, + .baseBlock = 0x1, + }, + { + .bg = 3, + .tilemapLeft = 19, + .tilemapTop = 5, + .width = 9, + .height = 10, + .paletteNum = 8, + .baseBlock = 0x150, + }, + DUMMY_WIN_TEMPLATE +}; + +static const u16 *const gEmeraldTrainerCardStarPals[] = +{ + gEmeraldTrainerCard0Star_Pal, + gEmeraldTrainerCard1Star_Pal, + gEmeraldTrainerCard2Star_Pal, + gEmeraldTrainerCard3Star_Pal, + gEmeraldTrainerCard4Star_Pal, +}; + +static const u16 *const gFireRedTrainerCardStarPals[] = +{ + gFireRedTrainerCard0Star_Pal, + gFireRedTrainerCard1Star_Pal, + gFireRedTrainerCard2Star_Pal, + gFireRedTrainerCard3Star_Pal, + gFireRedTrainerCard4Star_Pal, +}; + +static const u8 gUnknown_0856FB0C[] = {0, 2, 3}; +static const u8 gUnknown_0856FB0F[] = {0, 4, 5}; +static const u8 gUnknown_0856FB12[6] = {0}; + +static const u8 gUnknown_0856FB18[][2][2] = +{ + {{0xD, 4}, {0xD, 4}}, + {{1, 0}, {1, 0}}, +}; + +static const u8 gUnknown_0856FB20[][2] = {{0x4E, 0x4F}, {0x50, 0x51}, {0x3C, 0x3F}}; + +static bool8 (*const gUnknown_0856FB28[])(struct Task *) = +{ + sub_80C4998, + sub_80C49D8, + sub_80C4B08, + sub_80C4C1C, + sub_80C4C84, + sub_80C4DB0, +}; + +// code +static void VblankCb_TrainerCard(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_80C48C8(); + if (sData->allowDMACopy) + DmaCopy16(3, &gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 0x140); +} + +static void HblankCb_TrainerCard(void) +{ + u16 backup; + u16 bgVOffset; + + backup = REG_IME; + REG_IME = 0; + bgVOffset = gScanlineEffectRegBuffers[1][REG_VCOUNT & 0xFF]; + REG_BG0VOFS = bgVOffset; + REG_IME = backup; +} + +static void CB2_TrainerCard(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void CloseTrainerCard(u8 taskId) +{ + SetMainCallback2(sData->callback2); + FreeAllWindowBuffers(); + FREE_AND_SET_NULL(sData); + DestroyTask(taskId); +} + +static void sub_80C2760(u8 taskId) +{ + switch (sData->var_0) + { + case 0: + if (!IsDma3ManagerBusyWithBgCopy()) + { + FillWindowPixelBuffer(1, 0); + sData->var_0++; + } + break; + case 1: + if (PrintAllOnCardPage1()) + sData->var_0++; + break; + case 2: + sub_80C438C(1); + sData->var_0++; + break; + case 3: + FillWindowPixelBuffer(2, 0); + sub_80C4FF0(); + sub_80C438C(2); + sData->var_0++; + break; + case 4: + sub_80C4550(sData->var_EF8); + sData->var_0++; + break; + case 5: + sub_80C45C0(sData->var_598); + sData->var_0++; + break; + case 6: + sub_80C4630(); + sData->var_0++; + break; + case 7: + if (gWirelessCommType == 1 && gReceivedRemoteLinkPlayers == TRUE) + { + sub_800E0E8(); + CreateWirelessStatusIndicatorSprite(230, 150); + } + BlendPalettes(0xFFFFFFFF, 16, sData->var_52C); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, sData->var_52C); + SetVBlankCallback(VblankCb_TrainerCard); + sData->var_0++; + break; + case 8: + if (!UpdatePaletteFade() && !IsDma3ManagerBusyWithBgCopy()) + { + PlaySE(SE_RG_CARD3); + sData->var_0 = 10; + } + break; + case 9: + if (!IsSEPlaying()) + sData->var_0++; + break; + case 10: + if (!gReceivedRemoteLinkPlayers && sData->var_529) + { + PrintTimeOnCard(); + sub_80C438C(1); + sData->var_529 = 0; + } + if (gMain.newKeys & A_BUTTON) + { + sub_80C4918(); + PlaySE(SE_RG_CARD1); + sData->var_0 = 12; + } + else if (gMain.newKeys & B_BUTTON) + { + if (gReceivedRemoteLinkPlayers && sData->isLink && InUnionRoom() == TRUE) + { + sData->var_0 = 15; + } + else + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, sData->var_52C); + sData->var_0 = 14; + } + } + break; + case 12: + if (sub_80C4940() && sub_8087598() != TRUE) + { + PlaySE(SE_RG_CARD3); + sData->var_0 = 11; + } + break; + case 11: + if (gMain.newKeys & B_BUTTON) + { + if (gReceivedRemoteLinkPlayers && sData->isLink && InUnionRoom() == TRUE) + { + sData->var_0 = 15; + } + else if (gReceivedRemoteLinkPlayers) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, sData->var_52C); + sData->var_0 = 14; + } + else + { + sub_80C4918(); + sData->var_0 = 13; + PlaySE(SE_RG_CARD1); + } + } + else if (gMain.newKeys & A_BUTTON) + { + if (gReceivedRemoteLinkPlayers && sData->isLink && InUnionRoom() == TRUE) + { + sData->var_0 = 15; + } + else + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, sData->var_52C); + sData->var_0 = 14; + } + } + break; + case 15: + sub_800AC34(); + NewMenuHelpers_DrawDialogueFrame(0, 1); + AddTextPrinterParameterized(0, 1, gText_WaitingTrainerFinishReading, 0, 1, 255, 0); + CopyWindowToVram(0, 3); + sData->var_0 = 16; + break; + case 16: + if (!gReceivedRemoteLinkPlayers) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, sData->var_52C); + sData->var_0 = 14; + } + break; + case 14: + if (!UpdatePaletteFade()) + CloseTrainerCard(taskId); + break; + case 13: + if (sub_80C4940() && sub_8087598() != TRUE) + { + sData->var_0 = 10; + PlaySE(SE_RG_CARD3); + } + break; + } +} + +static bool8 LoadCardGfx(void) +{ + switch (sData->gfxLoadState) + { + case 0: + if (sData->cardType != CARD_TYPE_FRLG) + LZ77UnCompWram(gUnknown_08DD1F78, sData->var_EF8); + else + LZ77UnCompWram(gUnknown_08DD2AE0, sData->var_EF8); + break; + case 1: + if (sData->cardType != CARD_TYPE_FRLG) + LZ77UnCompWram(gUnknown_08DD21B0, sData->var_A48); + else + LZ77UnCompWram(gUnknown_08DD2D30, sData->var_A48); + break; + case 2: + if (!sData->isLink) + { + if (sData->cardType != CARD_TYPE_FRLG) + LZ77UnCompWram(gUnknown_08DD2010, sData->var_598); + else + LZ77UnCompWram(gUnknown_08DD2B78, sData->var_598); + } + else + { + if (sData->cardType != CARD_TYPE_FRLG) + LZ77UnCompWram(gUnknown_08DD228C, sData->var_598); + else + LZ77UnCompWram(gUnknown_08DD2E5C, sData->var_598); + } + break; + case 3: + if (sData->cardType != CARD_TYPE_FRLG) + LZ77UnCompWram(gUnknown_0856F5CC, sData->var_13A8); + else + LZ77UnCompWram(gUnknown_0856F814, sData->var_13A8); + break; + case 4: + if (sData->cardType != CARD_TYPE_FRLG) + LZ77UnCompWram(gEmeraldTrainerCard_Gfx, sData->var_19A8); + else + LZ77UnCompWram(gFireRedTrainerCard_Gfx, sData->var_19A8); + break; + case 5: + if (sData->cardType == CARD_TYPE_FRLG) + LZ77UnCompWram(gUnknown_0856F018, sData->var_17A8); + break; + default: + sData->gfxLoadState = 0; + return TRUE; + } + sData->gfxLoadState++; + return FALSE; +} + +static void CB2_InitTrainerCard(void) +{ + switch (gMain.state) + { + case 0: + ResetGpuRegs(); + sub_80C3414(); + gMain.state++; + break; + case 1: + DmaClear32(3, (void *)OAM, OAM_SIZE); + gMain.state++; + break; + case 2: + if (!sData->var_52C) + DmaClear16(3, (void *)PLTT, PLTT_SIZE); + gMain.state++; + break; + case 3: + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetPaletteFade(); + gMain.state++; + case 4: + InitBgsAndWindows(); + gMain.state++; + break; + case 5: + sub_80C41D8(); + gMain.state++; + break; + case 6: + if (LoadCardGfx() == TRUE) + gMain.state++; + break; + case 7: + sub_80C4330(); + gMain.state++; + break; + case 8: + HandleGpuRegs(); + gMain.state++; + break; + case 9: + PrintAllVariableNumsOnCardPage2(); + gMain.state++; + break; + case 10: + if (SetCardBgsAndPals() == TRUE) + gMain.state++; + break; + default: + SetTrainerCardCb2(); + break; + } +} + +static u32 GetCappedGameStat(u8 statId, u32 maxValue) +{ + u32 statValue = GetGameStat(statId); + + return min(maxValue, statValue); +} + +static bool8 HasAllFrontierSymbols(void) +{ + u8 i; + for (i = 0; i < NUM_FRONTIER_FACILITIES; i++) + { + if (!FlagGet(FLAG_SYS_TOWER_SILVER + 2 * i) || !FlagGet(FLAG_SYS_TOWER_GOLD + 2 * i)) + return FALSE; + } + return TRUE; +} + +u32 CountPlayerTrainerStars(void) +{ + u8 stars = 0; + + if (GetGameStat(GAME_STAT_ENTERED_HOF)) + stars++; + if (HasAllHoennMons()) + stars++; + if (CountPlayerContestPaintings() > 4) + stars++; + if (HasAllFrontierSymbols()) + stars++; + + return stars; +} + +static u8 GetRubyTrainerStars(struct TrainerCard *trainerCard) +{ + u8 stars = 0; + + if (trainerCard->hofDebutHours || trainerCard->hofDebutMinutes || trainerCard->hofDebutSeconds) + stars++; + if (trainerCard->caughtAllHoenn) + stars++; + if (trainerCard->battleTowerStraightWins > 49) + stars++; + if (trainerCard->hasAllPaintings) + stars++; + + return stars; +} + +static void SetPlayerCardData(struct TrainerCard *trainerCard, u8 cardType) +{ + u32 playTime; + u8 i; + + trainerCard->gender = gSaveBlock2Ptr->playerGender; + trainerCard->playTimeHours = gSaveBlock2Ptr->playTimeHours; + trainerCard->playTimeMinutes = gSaveBlock2Ptr->playTimeMinutes; + + playTime = GetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME); + if (!GetGameStat(GAME_STAT_ENTERED_HOF)) + playTime = 0; + + trainerCard->hofDebutHours = playTime >> 16; + trainerCard->hofDebutMinutes = (playTime >> 8) & 0xFF; + trainerCard->hofDebutSeconds = playTime & 0xFF; + if ((playTime >> 16) > 999) + { + trainerCard->hofDebutHours = 999; + trainerCard->hofDebutMinutes = 59; + trainerCard->hofDebutSeconds = 59; + } + + trainerCard->hasPokedex = FlagGet(FLAG_SYS_POKEDEX_GET); + trainerCard->caughtAllHoenn = HasAllHoennMons(); + trainerCard->caughtMonsCount = GetCaughtMonsCount(); + + trainerCard->trainerId = (gSaveBlock2Ptr->playerTrainerId[1] << 8) | gSaveBlock2Ptr->playerTrainerId[0]; + + trainerCard->linkBattleWins = GetCappedGameStat(GAME_STAT_LINK_BATTLE_WINS, 9999); + trainerCard->linkBattleLosses = GetCappedGameStat(GAME_STAT_LINK_BATTLE_LOSSES, 9999); + + trainerCard->pokemonTrades = GetCappedGameStat(GAME_STAT_POKEMON_TRADES, 0xFFFF); + + trainerCard->money = GetMoney(&gSaveBlock1Ptr->money); + + for (i = 0; i < 4; i++) + trainerCard->var_28[i] = gSaveBlock1Ptr->unk2BB0[i]; + + StringCopy(trainerCard->playerName, gSaveBlock2Ptr->playerName); + + switch (cardType) + { + case CARD_TYPE_EMERALD: + trainerCard->battleTowerWins = 0; + trainerCard->battleTowerStraightWins = 0; + // Seems like GF got CARD_TYPE_FRLG and CARD_TYPE_RS wrong. + case CARD_TYPE_FRLG: + trainerCard->contestsWithFriends = GetCappedGameStat(GAME_STAT_WON_LINK_CONTEST, 999); + trainerCard->pokeblocksWithFriends = GetCappedGameStat(GAME_STAT_POKEBLOCKS_WITH_FRIENDS, 0xFFFF); + if (CountPlayerContestPaintings() > 4) + trainerCard->hasAllPaintings = TRUE; + trainerCard->stars = GetRubyTrainerStars(trainerCard); + break; + case CARD_TYPE_RS: + trainerCard->battleTowerWins = 0; + trainerCard->battleTowerStraightWins = 0; + trainerCard->contestsWithFriends = 0; + trainerCard->pokeblocksWithFriends = 0; + trainerCard->hasAllPaintings = 0; + trainerCard->stars = 0; + break; + } +} + +static void sub_80C3020(struct TrainerCard *trainerCard) +{ + memset(trainerCard, 0, sizeof(struct TrainerCard)); + trainerCard->version = GAME_VERSION; + SetPlayerCardData(trainerCard, CARD_TYPE_EMERALD); + trainerCard->hasAllSymbols = HasAllFrontierSymbols(); + trainerCard->frontierBP = gSaveBlock2Ptr->frontier.field_EBA; + if (trainerCard->hasAllSymbols) + trainerCard->stars++; + + if (trainerCard->gender == FEMALE) + trainerCard->var_4F = gUnknown_08329D54[(trainerCard->trainerId % 8) + 8]; + else + trainerCard->var_4F = gUnknown_08329D54[trainerCard->trainerId % 8]; +} + +void TrainerCard_GenerateCardForPlayer(struct TrainerCard *trainerCard) +{ + memset(trainerCard, 0, 0x60); + trainerCard->version = GAME_VERSION; + SetPlayerCardData(trainerCard, CARD_TYPE_EMERALD); + trainerCard->var_3A = HasAllFrontierSymbols(); + *((u16*)&trainerCard->berryCrushPoints) = gSaveBlock2Ptr->frontier.field_EBA; + if (trainerCard->var_3A) + trainerCard->stars++; + + if (trainerCard->gender == FEMALE) + trainerCard->var_4F = gUnknown_08329D54[(trainerCard->trainerId % 8) + 8]; + else + trainerCard->var_4F = gUnknown_08329D54[trainerCard->trainerId % 8]; +} + +void CopyTrainerCardData(struct TrainerCard *dst, u16 *src, u8 gameVersion) +{ + memset(dst, 0, sizeof(struct TrainerCard)); + dst->version = gameVersion; + + switch (VersionToCardType(gameVersion)) + { + case CARD_TYPE_FRLG: + memcpy(dst, src, 0x60); + break; + case CARD_TYPE_RS: + memcpy(dst, src, 0x38); + break; + case CARD_TYPE_EMERALD: + memcpy(dst, src, 0x60); + dst->berryCrushPoints = 0; + dst->hasAllSymbols = src[29]; + dst->frontierBP = src[30]; + break; + } +} + +static void SetDataFromTrainerCard(void) +{ + u8 i; + u32 badgeFlag; + + sData->hasPokedex = FALSE; + sData->hasHofResult = FALSE; + sData->hasLinkResults = FALSE; + sData->hasBattleTowerWins = FALSE; + sData->var_E = 0; + sData->var_F = 0; + sData->hasTrades = FALSE; + memset(sData->badgeCount, 0, sizeof(sData->badgeCount)); + if (sData->trainerCard.hasPokedex) + sData->hasPokedex++; + + if (sData->trainerCard.hofDebutHours + || sData->trainerCard.hofDebutMinutes + || sData->trainerCard.hofDebutSeconds) + sData->hasHofResult++; + + if (sData->trainerCard.linkBattleWins || sData->trainerCard.linkBattleLosses) + sData->hasLinkResults++; + if (sData->trainerCard.pokemonTrades) + sData->hasTrades++; + if (sData->trainerCard.battleTowerWins || sData->trainerCard.battleTowerStraightWins) + sData->hasBattleTowerWins++; + + for (i = 0, badgeFlag = FLAG_BADGE01_GET; badgeFlag <= FLAG_BADGE08_GET; badgeFlag++, i++) + { + if (FlagGet(badgeFlag)) + sData->badgeCount[i]++; + } +} + +static void HandleGpuRegs(void) +{ + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_DARKEN); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ); + SetGpuReg(REG_OFFSET_WIN0V, 160); + SetGpuReg(REG_OFFSET_WIN0H, 240); + if (gReceivedRemoteLinkPlayers) + EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); + else + EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK); +} + +static void sub_80C32EC(u16 arg0) +{ + s8 quotient = (arg0 + 40) / 10; + + if (quotient <= 4) + quotient = 0; + sData->var_528 = quotient; + SetGpuReg(REG_OFFSET_BLDY, sData->var_528); + SetGpuReg(REG_OFFSET_WIN0V, (sData->var_7CA8 * 256) | (160 - sData->var_7CA8)); +} + +static void ResetGpuRegs(void) +{ + SetVBlankCallback(NULL); + SetHBlankCallback(NULL); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetGpuReg(REG_OFFSET_BG0CNT, 0); + SetGpuReg(REG_OFFSET_BG1CNT, 0); + SetGpuReg(REG_OFFSET_BG2CNT, 0); + SetGpuReg(REG_OFFSET_BG3CNT, 0); +} + +static void InitBgsAndWindows(void) +{ + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_0856FAB4, ARRAY_COUNT(gUnknown_0856FAB4)); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + InitWindows(gUnknown_0856FAC4); + DeactivateAllTextPrinters(); + sub_81973A4(); +} + +static void SetTrainerCardCb2(void) +{ + SetMainCallback2(CB2_TrainerCard); +} + +static void sub_80C3414(void) +{ + ResetTasks(); + ScanlineEffect_Stop(); + CreateTask(sub_80C2760, 0); + sub_80C4EE4(); + SetDataFromTrainerCard(); +} + +static bool8 PrintAllOnCardPage1(void) +{ + switch (sData->printState) + { + case 0: + PrintNameOnCard(); + break; + case 1: + PrintIdOnCard(); + break; + case 2: + PrintMoneyOnCard(); + break; + case 3: + PrintPokedexOnCard(); + break; + case 4: + PrintTimeOnCard(); + break; + case 5: + PrintProfilePhraseOnCard(); + break; + default: + sData->printState = 0; + return TRUE; + } + sData->printState++; + return FALSE; +} + +static bool8 PrintStringsOnCardPage2(void) +{ + switch (sData->printState) + { + case 0: + sub_80C3B50(); + break; + case 1: + PrintHofDebutStringOnCard(); + break; + case 2: + PrintWinsLossesStringOnCard(); + break; + case 3: + PrintTradesStringOnCard(); + break; + case 4: + PrintBerryCrushStringOnCard(); + PrintPokeblockStringOnCard(); + break; + case 5: + PrintUnionStringOnCard(); + PrintContestStringOnCard(); + break; + case 6: + sub_80C4140(); + PrintBattleFacilityStringOnCard(); + break; + case 7: + sub_80C42A4(); + break; + default: + sData->printState = 0; + return TRUE; + } + sData->printState++; + return FALSE; +} + +static void PrintAllVariableNumsOnCardPage2(void) +{ + PrintNameOnCard2(); + PrintHofTimeOnCard(); + PrintLinkResultsNumsOnCard(); + PrintTradesNumOnCard(); + PrintBerryCrushNumOnCard(); + PrintUnionNumOnCard(); + PrintPokeblocksNumOnCard(); + PrintContestNumOnCard(); + PrintBattleFacilityNumsOnCard(); +} + +static void PrintNameOnCard(void) +{ + u8 buffer[32]; + u8* txtPtr; + txtPtr = StringCopy(buffer, gText_TrainerCardName); + StringCopy(txtPtr, sData->trainerCard.playerName); + ConvertInternationalString(txtPtr, sData->language); + if (sData->cardType == CARD_TYPE_FRLG) + AddTextPrinterParameterized3(1, 1, 20, 28, gUnknown_0856FB0C, TEXT_SPEED_FF, buffer); + else + AddTextPrinterParameterized3(1, 1, 16, 33, gUnknown_0856FB0C, TEXT_SPEED_FF, buffer); +} + +static void PrintIdOnCard(void) +{ + u8 buffer[32]; + u8* txtPtr; + s32 xPos; + u32 top; + txtPtr = StringCopy(buffer, gText_TrainerCardIDNo); + ConvertIntToDecimalStringN(txtPtr, sData->trainerCard.trainerId, STR_CONV_MODE_LEADING_ZEROS, 5); + if (sData->cardType == CARD_TYPE_FRLG) + { + xPos = GetStringCenterAlignXOffset(1, buffer, 80) + 132; + top = 9; + } + else + { + xPos = GetStringCenterAlignXOffset(1, buffer, 96) + 120; + top = 9; + } + + AddTextPrinterParameterized3(1, 1, xPos, top, gUnknown_0856FB0C, TEXT_SPEED_FF, buffer); +} + +static void PrintMoneyOnCard(void) +{ + s32 xOffset; + u8 top; + + if (!sData->isHoenn) + AddTextPrinterParameterized3(1, 1, 20, 56, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardMoney); + else + AddTextPrinterParameterized3(1, 1, 16, 57, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardMoney); + + ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.money, 0, 6); + StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1); + if (!sData->isHoenn) + { + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 144); + top = 56; + } + else + { + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 128); + top = 57; + } + AddTextPrinterParameterized3(1, 1, xOffset, top, gUnknown_0856FB0C, TEXT_SPEED_FF, gStringVar4); +} + +static u16 GetCaughtMonsCount(void) +{ + if (IsNationalPokedexEnabled()) + return GetNationalPokedexCount(FLAG_GET_CAUGHT); + else + return GetHoennPokedexCount(FLAG_GET_CAUGHT); +} + +static void PrintPokedexOnCard(void) +{ + s32 xOffset; + u8 top; + if (FlagGet(FLAG_SYS_POKEDEX_GET)) + { + if (!sData->isHoenn) + AddTextPrinterParameterized3(1, 1, 20, 72, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardPokedex); + else + AddTextPrinterParameterized3(1, 1, 16, 73, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardPokedex); + StringCopy(ConvertIntToDecimalStringN(gStringVar4, sData->trainerCard.caughtMonsCount, 0, 3), gText_EmptyString6); + if (!sData->isHoenn) + { + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 144); + top = 72; + } + else + { + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 128); + top = 73; + } + AddTextPrinterParameterized3(1, 1, xOffset, top, gUnknown_0856FB0C, TEXT_SPEED_FF, gStringVar4); + } +} + +static const u8 *const gUnknown_0856FB40[] = {gUnknown_0856FB0C, gUnknown_0856FB12}; + +static void PrintTimeOnCard(void) +{ + u16 hours; + u16 minutes; + s32 width; + u32 r7, r4, r10; + + if (!sData->isHoenn) + AddTextPrinterParameterized3(1, 1, 20, 88, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardTime); + else + AddTextPrinterParameterized3(1, 1, 16, 89, gUnknown_0856FB0C, TEXT_SPEED_FF, gText_TrainerCardTime); + + if (sData->isLink) + { + hours = sData->trainerCard.playTimeHours; + minutes = sData->trainerCard.playTimeMinutes; + } + else + { + hours = gSaveBlock2Ptr->playTimeHours; + minutes = gSaveBlock2Ptr->playTimeMinutes; + } + + if (hours > 999) + hours = 999; + if (minutes > 59) + minutes = 59; + width = GetStringWidth(1, gText_Colon2, 0); + + if (!sData->isHoenn) + { + r7 = 144; + r4 = 88; + } + else + { + r7 = 128; + r4 = 89; + } + r10 = width + 30; + r7 -= r10; + + FillWindowPixelRect(1, 0, r7, r4, r10, 15); + ConvertIntToDecimalStringN(gStringVar4, hours, 1, 3); + AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB0C, TEXT_SPEED_FF, gStringVar4); + r7 += 18; + AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB40[sData->var_7], TEXT_SPEED_FF, gText_Colon2); + r7 += width; + ConvertIntToDecimalStringN(gStringVar4, minutes, 2, 2); + AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB0C, TEXT_SPEED_FF, gStringVar4); +} + +static const u8 gUnknown_0856FB48[] = {0x71, 0x68}; +static const u8 gUnknown_0856FB4A[] = {0x81, 0x78}; + +static void PrintProfilePhraseOnCard(void) +{ + if (sData->isLink) + { + AddTextPrinterParameterized3(1, 1, 8, gUnknown_0856FB48[sData->isHoenn], gUnknown_0856FB0C, TEXT_SPEED_FF, sData->var_19[0]); + AddTextPrinterParameterized3(1, 1, GetStringWidth(1, sData->var_19[0], 0) + 14, gUnknown_0856FB48[sData->isHoenn], gUnknown_0856FB0C, TEXT_SPEED_FF, sData->var_19[1]); + AddTextPrinterParameterized3(1, 1, 8, gUnknown_0856FB4A[sData->isHoenn], gUnknown_0856FB0C, TEXT_SPEED_FF, sData->var_19[2]); + AddTextPrinterParameterized3(1, 1, GetStringWidth(1, sData->var_19[2], 0) + 14, gUnknown_0856FB4A[sData->isHoenn], gUnknown_0856FB0C, TEXT_SPEED_FF, sData->var_19[3]); + } +} + +static void PrintNameOnCard2(void) +{ + StringCopy(sData->var_4D, sData->trainerCard.playerName); + ConvertInternationalString(sData->var_4D, sData->language); + if (sData->cardType != CARD_TYPE_FRLG) + { + StringCopy(gStringVar1, sData->var_4D); + StringExpandPlaceholders(sData->var_4D, gText_Var1sTrainerCard); + } +} + +static void sub_80C3B50(void) +{ + if (!sData->isHoenn) + AddTextPrinterParameterized3(1, 1, 136, 9, gUnknown_0856FB0C, TEXT_SPEED_FF, sData->var_4D); + else + AddTextPrinterParameterized3(1, 1, GetStringRightAlignXOffset(1, sData->var_4D, 216), 9, gUnknown_0856FB0C, TEXT_SPEED_FF, sData->var_4D); +} + +static const u8 gUnknown_0856FB4C[] = {0xfd, 0x02, 0xf0, 0xfd, 0x03, 0xf0, 0xfd, 0x04, 0xff}; + +static void PrintHofTimeOnCard(void) +{ + if (sData->hasHofResult) + { + ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.hofDebutHours, 1, 3); + ConvertIntToDecimalStringN(gStringVar2, sData->trainerCard.hofDebutMinutes, 2, 2); + ConvertIntToDecimalStringN(gStringVar3, sData->trainerCard.hofDebutSeconds, 2, 2); + StringExpandPlaceholders(sData->var_93, gUnknown_0856FB4C); + } +} + +static const u8 gUnknown_0856FB55[] = {0x08, 0x10}; +static const u8 gUnknown_0856FB57[] = {0xd8, 0xd8}; + +static void PrintString(u8 top, const u8* str1, u8* str2, const u8* color) +{ + AddTextPrinterParameterized3(1, 1, gUnknown_0856FB55[sData->isHoenn], top * 16 + 33, gUnknown_0856FB0C, TEXT_SPEED_FF, str1); + AddTextPrinterParameterized3(1, 1, GetStringRightAlignXOffset(1, str2, gUnknown_0856FB57[sData->isHoenn]), top * 16 + 33, color, TEXT_SPEED_FF, str2); +} + +static void PrintHofDebutStringOnCard(void) +{ + if (sData->hasHofResult) + PrintString(0, gText_HallOfFameDebut, sData->var_93, gUnknown_0856FB0F); +} + +static const u8 *const gUnknown_0856FB5C[] = {gText_LinkBattles, gText_LinkCableBattles, gText_LinkBattles}; + +static void PrintLinkResultsNumsOnCard(void) +{ + if (sData->hasLinkResults) + { + StringCopy(sData->var_D9, gUnknown_0856FB5C[sData->cardType]); + ConvertIntToDecimalStringN(sData->var_165, sData->trainerCard.linkBattleWins, 0, 4); + ConvertIntToDecimalStringN(sData->var_1AB, sData->trainerCard.linkBattleLosses, 0, 4); + } +} + +static void PrintWinsLossesStringOnCard(void) +{ + if (sData->hasLinkResults) + { + StringCopy(gStringVar1, sData->var_165); + StringCopy(gStringVar2, sData->var_1AB); + StringExpandPlaceholders(gStringVar4, gText_WinsLosses); + PrintString(1, sData->var_D9, gStringVar4, gUnknown_0856FB0C); + } +} + +static void PrintTradesNumOnCard(void) +{ + if (sData->hasTrades) + ConvertIntToDecimalStringN(sData->var_237, sData->trainerCard.pokemonTrades, 1, 5); +} + +static void PrintTradesStringOnCard(void) +{ + if (sData->hasTrades) + PrintString(2, gText_PokemonTrades, sData->var_237, gUnknown_0856FB0F); +} + +static void PrintBerryCrushNumOnCard(void) +{ + if (sData->cardType == CARD_TYPE_FRLG && sData->trainerCard.berryCrushPoints) + ConvertIntToDecimalStringN(sData->var_2C3, sData->trainerCard.berryCrushPoints, 1, 5); +} + +static void PrintBerryCrushStringOnCard(void) +{ + if (sData->cardType == CARD_TYPE_FRLG && sData->trainerCard.berryCrushPoints) + PrintString(4, gText_BerryCrush, sData->var_2C3, gUnknown_0856FB0F); +} + +static void PrintUnionNumOnCard(void) +{ + if (sData->cardType == CARD_TYPE_FRLG && sData->trainerCard.unionRoomNum) + ConvertIntToDecimalStringN(sData->var_34F, sData->trainerCard.unionRoomNum, 1, 5); +} + +static void PrintUnionStringOnCard(void) +{ + if (sData->cardType == CARD_TYPE_FRLG && sData->trainerCard.unionRoomNum) + PrintString(3, gText_UnionTradesAndBattles, sData->var_34F, gUnknown_0856FB0F); +} + +static void PrintPokeblocksNumOnCard(void) +{ + if (sData->cardType != CARD_TYPE_FRLG && sData->trainerCard.pokeblocksWithFriends) + { + ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.pokeblocksWithFriends, 1, 5); + StringExpandPlaceholders(sData->var_395, gText_Var1DarkGreyShadowLightGrey); + } +} + +static void PrintPokeblockStringOnCard(void) +{ + if (sData->cardType != CARD_TYPE_FRLG && sData->trainerCard.pokeblocksWithFriends) + PrintString(3, gText_PokeblocksWithFriends, sData->var_395, gUnknown_0856FB0F); +} + +static void PrintContestNumOnCard(void) +{ + if (sData->cardType != CARD_TYPE_FRLG && sData->trainerCard.contestsWithFriends) + ConvertIntToDecimalStringN(sData->var_3DB, sData->trainerCard.contestsWithFriends, 1, 5); +} + +static void PrintContestStringOnCard(void) +{ + if (sData->cardType != CARD_TYPE_FRLG && sData->trainerCard.contestsWithFriends) + PrintString(4, gText_WonContestsWFriends, sData->var_3DB, gUnknown_0856FB0F); +} + +static void PrintBattleFacilityNumsOnCard(void) +{ + switch (sData->cardType) + { + case CARD_TYPE_RS: + if (sData->hasBattleTowerWins) + { + ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.battleTowerWins, 1, 4); + ConvertIntToDecimalStringN(gStringVar2, sData->trainerCard.battleTowerStraightWins, 1, 4); + StringExpandPlaceholders(sData->var_421, gText_WSlashStraightSlash); + } + break; + case CARD_TYPE_EMERALD: + if (sData->trainerCard.frontierBP) + { + ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.frontierBP, 1, 5); + StringExpandPlaceholders(sData->var_421, gText_Var1DarkLightGreyBP); + } + break; + case CARD_TYPE_FRLG: + break; + } +} + +static void PrintBattleFacilityStringOnCard(void) +{ + switch (sData->cardType) + { + case CARD_TYPE_RS: + if (sData->hasBattleTowerWins) + PrintString(5, gText_BattleTower, sData->var_421, gUnknown_0856FB0C); + break; + case CARD_TYPE_EMERALD: + if (sData->trainerCard.frontierBP) + PrintString(5, gText_BattlePtsWon, sData->var_421, gUnknown_0856FB0F); + break; + case CARD_TYPE_FRLG: + break; + } +} + +static void sub_80C4140(void) +{ + u8 i; + u8 buffer[] = {0x05, 0x06, 0x07, 0x08, 0x09, 0x0a}; + u8 buffer2[] = {0x00, 0x04, 0x08, 0x0c, 0x10, 0x14}; + + if (sData->cardType == CARD_TYPE_FRLG) + { + for (i = 0; i < 6; i++) + { + if (sData->trainerCard.monSpecies[i]) + { + u8 monSpecies = sub_80D30A0(sData->trainerCard.monSpecies[i]); + WriteSequenceToBgTilemapBuffer(3, 16 * i + 224, buffer2[i] + 3, 15, 4, 4, buffer[monSpecies], 1); + } + } + } +} + +static void sub_80C41D8(void) +{ + u8 i; + + CpuSet(gMonIconPalettes, sData->var_468, 0x60); + switch (sData->trainerCard.var_4E) + { + case 0: + break; + case 1: + TintPalette_CustomTone(sData->var_468, 96, 0, 0, 0); + break; + case 2: + TintPalette_CustomTone(sData->var_468, 96, 500, 330, 310); + break; + case 3: + TintPalette_SepiaTone(sData->var_468, 96); + break; + } + LoadPalette(sData->var_468, 80, 192); + + for (i = 0; i < 6; i++) + { + if (sData->trainerCard.monSpecies[i]) + LoadBgTiles(3, GetMonIconTiles(sData->trainerCard.monSpecies[i], 0), 512, 16 * i + 32); + } +} + +static void sub_80C42A4(void) +{ + u8 i; + u8 buffer[4] = {0x0b, 0x0c, 0x0d, 0x0e}; + + if (sData->cardType == CARD_TYPE_FRLG && sData->trainerCard.var_4C == 1) + { + for (i = 0; i < 3; i++) + { + u8 var_50 = sData->trainerCard.var_50[i]; + if (sData->trainerCard.var_50[i]) + WriteSequenceToBgTilemapBuffer(3, i * 4 + 320, i * 3 + 2, 2, 2, 2, buffer[var_50 - 1], 1); + } + } +} + +static void sub_80C4330(void) +{ + LoadPalette(gUnknown_0856F54C, 176, 32); + LoadPalette(gUnknown_0856F56C, 192, 32); + LoadPalette(gUnknown_0856F58C, 208, 32); + LoadPalette(gUnknown_0856F5AC, 224, 32); + LoadBgTiles(3, sData->var_17A8, 1024, 128); +} + +static void sub_80C438C(u8 windowId) +{ + PutWindowTilemap(windowId); + CopyWindowToVram(windowId, 3); +} + +static u8 SetCardBgsAndPals(void) +{ + switch (sData->bgPalLoadState) + { + case 0: + LoadBgTiles(3, sData->var_13A8, 1024, 0); + break; + case 1: + LoadBgTiles(0, sData->var_19A8, 6144, 0); + break; + case 2: + if (sData->cardType != CARD_TYPE_FRLG) + { + LoadPalette(gEmeraldTrainerCardStarPals[sData->trainerCard.stars], 0, 96); + LoadPalette(gUnknown_0856F4EC, 48, 32); + if (sData->trainerCard.gender) + LoadPalette(gUnknown_0856F4AC, 16, 32); + } + else + { + LoadPalette(gFireRedTrainerCardStarPals[sData->trainerCard.stars], 0, 96); + LoadPalette(gUnknown_0856F50C, 48, 32); + if (sData->trainerCard.gender) + LoadPalette(gUnknown_0856F4CC, 16, 32); + } + LoadPalette(gUnknown_0856F52C, 64, 32); + break; + case 3: + SetBgTilemapBuffer(0, sData->var_3CA8); + SetBgTilemapBuffer(2, sData->var_5CA8); + break; + case 4: + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 32, 32); + default: + return 1; + } + sData->bgPalLoadState++; + return 0; +} + +static void sub_80C4550(u16 *ptr) +{ + s16 i, j; + u16 *dst = sData->var_5CA8; + + for (i = 0; i < 20; i++) + { + for (j = 0; j < 32; j++) + { + if (j < 30) + dst[32 * i + j] = ptr[30 * i + j]; + else + dst[32 * i + j] = ptr[0]; + } + } + CopyBgTilemapBufferToVram(2); +} + +static void sub_80C45C0(u16* ptr) +{ + s16 i, j; + u16 *dst = sData->var_3CA8; + + for (i = 0; i < 20; i++) + { + for (j = 0; j < 32; j++) + { + if (j < 30) + dst[32 * i + j] = ptr[30 * i + j]; + else + dst[32 * i + j] = ptr[0]; + } + } + CopyBgTilemapBufferToVram(0); +} + +static const u8 gUnknown_0856FB78[] = {7, 7}; + +static void sub_80C4630(void) +{ + s16 i, x; + u16 tileNum = 192; + u8 palNum = 3; + + FillBgTilemapBufferRect(3, 143, 15, gUnknown_0856FB78[sData->isHoenn], sData->trainerCard.stars, 1, 4); + if (!sData->isLink) + { + x = 4; + for (i = 0; i < 8; i++, tileNum += 2, x += 3) + { + if (sData->badgeCount[i]) + { + FillBgTilemapBufferRect(3, tileNum, x, 15, 1, 1, palNum); + FillBgTilemapBufferRect(3, tileNum + 1, x + 1, 15, 1, 1, palNum); + FillBgTilemapBufferRect(3, tileNum + 16, x, 16, 1, 1, palNum); + FillBgTilemapBufferRect(3, tileNum + 17, x + 1, 16, 1, 1, palNum); + } + } + } + CopyBgTilemapBufferToVram(3); +} + +static void sub_80C474C(void) +{ + if (sData->cardType == CARD_TYPE_FRLG) + { + if (sData->hasTrades) + { + FillBgTilemapBufferRect(3, 141, 27, 9, 1, 1, 1); + FillBgTilemapBufferRect(3, 157, 27, 10, 1, 1, 1); + } + if (sData->trainerCard.berryCrushPoints) + { + FillBgTilemapBufferRect(3, 141, 21, 13, 1, 1, 1); + FillBgTilemapBufferRect(3, 157, 21, 14, 1, 1, 1); + } + if (sData->trainerCard.unionRoomNum) + { + FillBgTilemapBufferRect(3, 141, 27, 11, 1, 1, 1); + FillBgTilemapBufferRect(3, 157, 27, 12, 1, 1, 1); + } + } + else + { + if (sData->hasTrades) + { + FillBgTilemapBufferRect(3, 141, 27, 9, 1, 1, 0); + FillBgTilemapBufferRect(3, 157, 27, 10, 1, 1, 0); + } + if (sData->trainerCard.contestsWithFriends) + { + FillBgTilemapBufferRect(3, 141, 27, 13, 1, 1, 0); + FillBgTilemapBufferRect(3, 157, 27, 14, 1, 1, 0); + } + if (sData->hasBattleTowerWins) + { + FillBgTilemapBufferRect(3, 141, 17, 15, 1, 1, 0); + FillBgTilemapBufferRect(3, 157, 17, 16, 1, 1, 0); + FillBgTilemapBufferRect(3, 140, 27, 15, 1, 1, 0); + FillBgTilemapBufferRect(3, 156, 27, 16, 1, 1, 0); + } + } + CopyBgTilemapBufferToVram(3); +} + +static void sub_80C48C8(void) +{ + if (++sData->var_6 > 60) + { + sData->var_6 = 0; + sData->var_7 ^= 1; + sData->var_529 = 1; + } +} + +u8 sub_80C4904(u8 cardId) +{ + struct TrainerCard* trainerCards = gTrainerCards; + return trainerCards[cardId].stars; +} + +static void sub_80C4918(void) +{ + u8 taskId = CreateTask(sub_80C4960, 0); + sub_80C4960(taskId); + SetHBlankCallback(HblankCb_TrainerCard); +} + +static bool8 sub_80C4940(void) +{ + if (FindTaskIdByFunc(sub_80C4960) == 0xFF) + return TRUE; + else + return FALSE; +} + +static void sub_80C4960(u8 taskId) +{ + while(gUnknown_0856FB28[gTasks[taskId].data[0]](&gTasks[taskId])) + ; +} + +static bool8 sub_80C4998(struct Task* task) +{ + u32 i; + + HideBg(1); + HideBg(3); + ScanlineEffect_Stop(); + ScanlineEffect_Clear(); + for (i = 0; i < 160; i++) + gScanlineEffectRegBuffers[1][i] = 0; + task->data[0]++; + return FALSE; +} + +static bool8 sub_80C49D8(struct Task* task) +{ + u32 r4, r5, r10, r7, r6, var_24, r9, var; + s16 i; + + sData->allowDMACopy = FALSE; + if (task->data[1] >= 77) + task->data[1] = 77; + else + task->data[1] += 7; + + sData->var_7CA8 = task->data[1]; + sub_80C32EC(task->data[1]); + + // ??? + r7 = task->data[1]; + r9 = 160 - r7; + r4 = r9 - r7; + r6 = -r7 << 16; + r5 = 0xA00000 / r4; + r5 += 0xFFFF0000; + var_24 = r6; + var_24 += r5 * r4; + r10 = r5 / r4; + r5 *= 2; + + for (i = 0; i < r7; i++) + gScanlineEffectRegBuffers[0][i] = -i; + for (; i < (s16)(r9); i++) + { + var = r6 >> 16; + r6 += r5; + r5 -= r10; + gScanlineEffectRegBuffers[0][i] = var; + } + var = var_24 >> 16; + for (; i < 160; i++) + gScanlineEffectRegBuffers[0][i] = var; + + sData->allowDMACopy = TRUE; + if (task->data[1] >= 77) + task->data[0]++; + + return FALSE; +} + +static bool8 sub_80C4B08(struct Task* task) +{ + sData->allowDMACopy = FALSE; + if (sub_8087598() == TRUE) + return FALSE; + + do + { + switch (sData->var_4) + { + case 0: + FillWindowPixelBuffer(1, 0); + FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 0x20, 0x20); + break; + case 1: + if (!sData->var_8) + { + if (!PrintStringsOnCardPage2()) + return FALSE; + } + else + { + if (!PrintAllOnCardPage1()) + return FALSE; + } + break; + case 2: + if (!sData->var_8) + sub_80C45C0(sData->var_A48); + else + sub_80C438C(1); + break; + case 3: + if (!sData->var_8) + sub_80C474C(); + else + FillWindowPixelBuffer(2, 0); + break; + case 4: + if (sData->var_8) + sub_80C4FF0(); + break; + default: + task->data[0]++; + sData->allowDMACopy = TRUE; + sData->var_4 = 0; + return FALSE; + } + sData->var_4++; + } while (gReceivedRemoteLinkPlayers == 0); + + return FALSE; +} + +static bool8 sub_80C4C1C(struct Task* task) +{ + sData->allowDMACopy = FALSE; + if (sData->var_8) + { + sub_80C438C(2); + sub_80C4550(sData->var_EF8); + sub_80C45C0(sData->var_598); + sub_80C4630(); + } + sub_80C438C(1); + sData->var_8 ^= 1; + task->data[0]++; + sData->allowDMACopy = TRUE; + PlaySE(SE_RG_CARD2); + return FALSE; +} + +static bool8 sub_80C4C84(struct Task* task) +{ + u32 r4, r5, r10, r7, r6, var_24, r9, var; + s16 i; + + sData->allowDMACopy = FALSE; + if (task->data[1] <= 5) + task->data[1] = 0; + else + task->data[1] -= 5; + + sData->var_7CA8 = task->data[1]; + sub_80C32EC(task->data[1]); + + // ??? + r7 = task->data[1]; + r9 = 160 - r7; + r4 = r9 - r7; + r6 = -r7 << 16; + r5 = 0xA00000 / r4; + r5 += 0xFFFF0000; + var_24 = r6; + var_24 += r5 * r4; + r10 = r5 / r4; + r5 /= 2; + + for (i = 0; i < r7; i++) + gScanlineEffectRegBuffers[0][i] = -i; + for (; i < (s16)(r9); i++) + { + var = r6 >> 16; + r6 += r5; + r5 += r10; + gScanlineEffectRegBuffers[0][i] = var; + } + var = var_24 >> 16; + for (; i < 160; i++) + gScanlineEffectRegBuffers[0][i] = var; + + sData->allowDMACopy = TRUE; + if (task->data[1] <= 0) + task->data[0]++; + + return FALSE; +} + +static bool8 sub_80C4DB0(struct Task *task) +{ + ShowBg(1); + ShowBg(3); + SetHBlankCallback(NULL); + DestroyTask(FindTaskIdByFunc(sub_80C4960)); + return FALSE; +} + +void ShowPlayerTrainerCard(void (*callback)(void)) +{ + sData = AllocZeroed(sizeof(*sData)); + sData->callback2 = callback; + if (callback == sub_80C5868) + sData->var_52C = 0x7FFF; + else + sData->var_52C = 0; + + if (InUnionRoom() == TRUE) + sData->isLink = TRUE; + else + sData->isLink = FALSE; + + sData->language = GAME_LANGUAGE; + sub_80C3020(&sData->trainerCard); + SetMainCallback2(CB2_InitTrainerCard); +} + +void ShowTrainerCardInLink(u8 cardId, void (*callback)(void)) +{ + sData = AllocZeroed(sizeof(*sData)); + sData->callback2 = callback; + sData->isLink = TRUE; + sData->trainerCard = gTrainerCards[cardId]; + sData->language = gLinkPlayers[cardId].language; + SetMainCallback2(CB2_InitTrainerCard); +} + +static void sub_80C4EE4(void) +{ + u8 i; + + sData->var_0 = 0; + sData->var_6 = gSaveBlock2Ptr->playTimeVBlanks; + sData->var_7 = 0; + sData->var_8 = 0; + sData->var_528 = 0; + sData->cardType = GetSetCardType(); + for (i = 0; i < 4; i++) + CopyEasyChatWord(sData->var_19[i], sData->trainerCard.var_28[i]); +} + +static u8 GetSetCardType(void) +{ + if (sData == NULL) + { + if (gGameVersion == VERSION_FIRE_RED || gGameVersion == VERSION_LEAF_GREEN) + return CARD_TYPE_FRLG; + else if (gGameVersion == VERSION_EMERALD) + return CARD_TYPE_EMERALD; + else + return CARD_TYPE_RS; + } + else + { + if (sData->trainerCard.version == VERSION_FIRE_RED || sData->trainerCard.version == VERSION_LEAF_GREEN) + { + sData->isHoenn = FALSE; + return CARD_TYPE_FRLG; + } + else if (sData->trainerCard.version == VERSION_EMERALD) + { + sData->isHoenn = TRUE; + return CARD_TYPE_EMERALD; + } + else + { + sData->isHoenn = TRUE; + return CARD_TYPE_RS; + } + } +} + +static u8 VersionToCardType(u8 version) +{ + if (version == VERSION_FIRE_RED || version == VERSION_LEAF_GREEN) + return CARD_TYPE_FRLG; + else if (version == VERSION_EMERALD) + return CARD_TYPE_EMERALD; + else + return CARD_TYPE_RS; +} + +static void sub_80C4FF0(void) +{ + if (InUnionRoom() == TRUE && gReceivedRemoteLinkPlayers == 1) + { + sub_818D938(FacilityClassToPicIndex(sData->trainerCard.var_4F), + TRUE, + gUnknown_0856FB18[sData->isHoenn][sData->trainerCard.gender][0], + gUnknown_0856FB18[sData->isHoenn][sData->trainerCard.gender][1], + 8, + 2); + } + else + { + sub_818D938(FacilityClassToPicIndex(gUnknown_0856FB20[sData->cardType][sData->trainerCard.gender]), + TRUE, + gUnknown_0856FB18[sData->isHoenn][sData->trainerCard.gender][0], + gUnknown_0856FB18[sData->isHoenn][sData->trainerCard.gender][1], + 8, + 2); + } +} diff --git a/sym_ewram.txt b/sym_ewram.txt index 7b5b6663e..75a44bb97 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -153,8 +153,7 @@ gUnknown_02039B6E: @ 2039B6E gUnknown_02039B88: @ 2039B88 .space 0x160 -gUnknown_02039CE8: @ 2039CE8 - .space 0x4 + .include "src/trainer_card.o" gUnknown_02039CEC: @ 2039CEC .space 0x4