diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 3fb412477..a97751aa9 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,1416 +5,6 @@ .text - thumb_func_start sub_81BF8EC -sub_81BF8EC: @ 81BF8EC - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r1 - adds r5, r2, 0 - adds r6, r3, 0 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r4, =gUnknown_0203CF1C - ldr r0, =0x000040f8 - bl AllocZeroed - str r0, [r4] - ldr r1, =0x000040bc - adds r0, r1 - strb r7, [r0] - ldr r0, [r4] - mov r2, r8 - str r2, [r0] - adds r1, 0x2 - adds r0, r1 - strb r5, [r0] - ldr r0, [r4] - ldr r2, =0x000040bf - adds r0, r2 - strb r6, [r0] - ldr r1, [r4] - ldr r0, [sp, 0x18] - str r0, [r1, 0x4] - cmp r7, 0x2 - bne _081BF94C - subs r2, 0x2 - adds r1, r2 - movs r0, 0x1 - b _081BF952 - .pool -_081BF94C: - ldr r0, =0x000040bd - adds r1, r0 - movs r0, 0 -_081BF952: - strb r0, [r1] - cmp r7, 0x1 - beq _081BF9A0 - cmp r7, 0x1 - bgt _081BF96C - cmp r7, 0 - beq _081BF97C - ldr r2, =gUnknown_0203CF1C - b _081BF9EE - .pool -_081BF96C: - cmp r7, 0x2 - beq _081BF97C - cmp r7, 0x3 - beq _081BF9D0 - ldr r2, =gUnknown_0203CF1C - b _081BF9EE - .pool -_081BF97C: - ldr r2, =gUnknown_0203CF1C - ldr r0, [r2] - ldr r1, =0x000040c1 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000040c2 - adds r0, r1 - movs r1, 0x3 - b _081BF9EC - .pool -_081BF9A0: - ldr r2, =gUnknown_0203CF1C - ldr r0, [r2] - ldr r1, =0x000040c1 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000040c2 - adds r0, r1 - movs r1, 0x3 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000040c8 - adds r0, r1 - strb r7, [r0] - b _081BF9EE - .pool -_081BF9D0: - ldr r2, =gUnknown_0203CF1C - ldr r0, [r2] - ldr r1, =0x000040c1 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000040c2 - adds r0, r1 - strb r7, [r0] - ldr r0, [r2] - adds r1, 0x1 - adds r0, r1 - movs r1, 0x1 -_081BF9EC: - strb r1, [r0] -_081BF9EE: - ldr r0, [r2] - ldr r2, =0x000040c1 - adds r1, r0, r2 - ldrb r1, [r1] - subs r2, 0x1 - adds r0, r2 - strb r1, [r0] - movs r0, 0xFF - bl sub_81C488C - ldr r0, =gBattleSpritesGfx - ldr r0, [r0] - cmp r0, 0 - bne _081BFA12 - movs r0, 0 - movs r1, 0 - bl sub_806F2AC -_081BFA12: - ldr r0, =sub_81BFAE4 - bl SetMainCallback2 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BF8EC - - thumb_func_start sub_81BFA38 -sub_81BFA38: @ 81BFA38 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - mov r8, r0 - adds r4, r1, 0 - adds r5, r2, 0 - ldr r6, [sp, 0x18] - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 16 - lsrs r6, 16 - str r3, [sp] - movs r0, 0x3 - mov r1, r8 - adds r2, r4, 0 - adds r3, r5, 0 - bl sub_81BF8EC - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c4 - adds r0, r1 - strh r6, [r0] - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BFA38 - - thumb_func_start sub_81BFA80 -sub_81BFA80: @ 81BFA80 - push {r4,lr} - sub sp, 0x4 - ldr r4, [sp, 0xC] - lsls r0, 24 - lsrs r0, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - str r4, [sp] - bl sub_81BF8EC - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040ef - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BFA80 - - thumb_func_start sub_81BFAB4 -sub_81BFAB4: @ 81BFAB4 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl do_scheduled_bg_tilemap_copies_to_vram - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_81BFAB4 - - thumb_func_start sub_81BFAD0 -sub_81BFAD0: @ 81BFAD0 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_81BFAD0 - - thumb_func_start sub_81BFAE4 -sub_81BFAE4: @ 81BFAE4 - push {lr} -_081BFAE6: - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081BFB0A - bl sub_81BFB10 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081BFB0A - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081BFAE6 -_081BFB0A: - pop {r0} - bx r0 - thumb_func_end sub_81BFAE4 - - thumb_func_start sub_81BFB10 -sub_81BFB10: @ 81BFB10 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x18 - bls _081BFB24 - b _081BFE00 -_081BFB24: - lsls r0, 2 - ldr r1, =_081BFB38 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081BFB38: - .4byte _081BFB9C - .4byte _081BFBAA - .4byte _081BFBBC - .4byte _081BFBD0 - .4byte _081BFBE4 - .4byte _081BFBEA - .4byte _081BFC04 - .4byte _081BFC20 - .4byte _081BFC26 - .4byte _081BFC38 - .4byte _081BFC58 - .4byte _081BFC7C - .4byte _081BFC82 - .4byte _081BFC94 - .4byte _081BFCAC - .4byte _081BFCC0 - .4byte _081BFCD8 - .4byte _081BFCF8 - .4byte _081BFD34 - .4byte _081BFD50 - .4byte _081BFD60 - .4byte _081BFD74 - .4byte _081BFD7A - .4byte _081BFDB0 - .4byte _081BFDCC -_081BFB9C: - bl SetVBlankHBlankCallbacksToNull - bl sub_8121DA0 - bl clear_scheduled_bg_copies_to_vram - b _081BFDE6 -_081BFBAA: - bl remove_some_task - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFBBC: - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - b _081BFDE4 - .pool -_081BFBD0: - bl ResetSpriteData - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFBE4: - bl FreeAllSpritePalettes - b _081BFDE6 -_081BFBEA: - bl sub_81BFE24 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081BFDE6 - .pool -_081BFC04: - bl sub_81BFEB0 - lsls r0, 24 - cmp r0, 0 - bne _081BFC10 - b _081BFE18 -_081BFC10: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFC20: - bl sub_81C2554 - b _081BFDE6 -_081BFC26: - bl sub_81C1BA0 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFC38: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0xC - bl sub_81C0098 - ldr r0, [r4] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081BFDE6 - .pool -_081BFC58: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C00F0 - lsls r0, 24 - cmp r0, 0 - bne _081BFC6A - b _081BFE18 -_081BFC6A: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFC7C: - bl sub_81C25E8 - b _081BFDE6 -_081BFC82: - bl sub_81C286C - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFC94: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C2D9C - b _081BFDE6 - .pool -_081BFCAC: - bl sub_81C0348 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFCC0: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C2AFC - b _081BFDE6 - .pool -_081BFCD8: - bl sub_81C4190 - bl sub_81C42C8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081BFDE6 - .pool -_081BFCF8: - ldr r4, =gUnknown_0203CF1C - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0xC - ldr r2, =0x000040f0 - adds r1, r2 - bl sub_81C45F4 - ldr r1, [r4] - ldr r2, =0x000040d3 - adds r1, r2 - strb r0, [r1] - ldr r1, [r4] - adds r2, r1, r2 - ldrb r0, [r2] - cmp r0, 0xFF - bne _081BFD1C - b _081BFE18 -_081BFD1C: - ldr r0, =0x000040f0 - adds r1, r0 - movs r0, 0 - strh r0, [r1] - b _081BFDE6 - .pool -_081BFD34: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C4984 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFD50: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C4A08 - b _081BFDE6 - .pool -_081BFD60: - bl sub_81C4A88 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFD74: - bl sub_81C4280 - b _081BFDE6 -_081BFD7A: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - beq _081BFDA0 - ldr r0, =sub_81C0510 - movs r1, 0 - bl CreateTask - b _081BFDE6 - .pool -_081BFDA0: - ldr r0, =sub_81C171C - movs r1, 0 - bl CreateTask - b _081BFDE6 - .pool -_081BFDB0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081BFDEE - .pool -_081BFDCC: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 -_081BFDE4: - strb r0, [r2, 0x8] -_081BFDE6: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_081BFDEE: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _081BFE18 - .pool -_081BFE00: - ldr r0, =sub_81BFAD0 - bl SetVBlankCallback - ldr r0, =sub_81BFAB4 - bl SetMainCallback2 - movs r0, 0x1 - b _081BFE1A - .pool -_081BFE18: - movs r0, 0 -_081BFE1A: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81BFB10 - - thumb_func_start sub_81BFE24 -sub_81BFE24: @ 81BFE24 - push {r4,lr} - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0861CBB4 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r4, =gUnknown_0203CF1C - ldr r1, [r4] - ldr r0, =0x000020bc - adds r1, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x000010bc - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - ldr r1, [r4] - adds r1, 0xBC - movs r0, 0x3 - bl SetBgTilemapBuffer - bl sub_8121E10 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81BFE24 - - thumb_func_start sub_81BFEB0 -sub_81BFEB0: @ 81BFEB0 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_0203CF1C - ldr r0, [r1] - ldr r2, =0x000040f0 - adds r0, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - adds r4, r1, 0 - cmp r0, 0xC - bls _081BFEC8 - b _081C008C -_081BFEC8: - lsls r0, 2 - ldr r1, =_081BFEE0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081BFEE0: - .4byte _081BFF14 - .4byte _081BFF30 - .4byte _081BFF60 - .4byte _081BFF78 - .4byte _081BFF90 - .4byte _081BFFA8 - .4byte _081BFFC0 - .4byte _081BFFF0 - .4byte _081BFFFC - .4byte _081C0018 - .4byte _081C0024 - .4byte _081C0040 - .4byte _081C0064 -_081BFF14: - bl reset_temp_tile_data_buffers - ldr r1, =gUnknown_08D97D0C - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _081C0046 - .pool -_081BFF30: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081BFF3E - b _081C008C -_081BFF3E: - ldr r0, =gUnknown_08D9862C - ldr r4, =gUnknown_0203CF1C - ldr r1, [r4] - adds r1, 0xBC - bl LZDecompressWram - ldr r1, [r4] - ldr r2, =0x000040f0 - adds r1, r2 - b _081C004E - .pool -_081BFF60: - ldr r0, =gUnknown_08D98CC8 - ldr r1, [r4] - ldr r2, =0x000008bc - adds r1, r2 - bl LZDecompressWram - ldr r1, [r4] - b _081C004A - .pool -_081BFF78: - ldr r0, =gUnknown_08D987FC - ldr r1, [r4] - ldr r2, =0x000018bc - adds r1, r2 - bl LZDecompressWram - ldr r1, [r4] - b _081C004A - .pool -_081BFF90: - ldr r0, =gUnknown_08D9898C - ldr r1, [r4] - ldr r2, =0x000028bc - adds r1, r2 - bl LZDecompressWram - ldr r1, [r4] - b _081C004A - .pool -_081BFFA8: - ldr r0, =gUnknown_08D98B28 - ldr r1, [r4] - ldr r2, =0x000038bc - adds r1, r2 - bl LZDecompressWram - ldr r1, [r4] - b _081C004A - .pool -_081BFFC0: - ldr r0, =gUnknown_08D9853C - movs r2, 0x80 - lsls r2, 1 - movs r1, 0 - bl LoadCompressedPalette - ldr r0, =gUnknown_08D85620 - movs r1, 0x81 - movs r2, 0x1E - bl LoadPalette - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040f0 - adds r1, r2 - b _081C004E - .pool -_081BFFF0: - ldr r0, =gUnknown_0861CFBC - bl LoadCompressedObjectPic - b _081C0046 - .pool -_081BFFFC: - ldr r0, =gUnknown_0861D074 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040f0 - adds r1, r2 - b _081C004E - .pool -_081C0018: - ldr r0, =gUnknown_0861D0F8 - bl LoadCompressedObjectPic - b _081C0046 - .pool -_081C0024: - ldr r0, =gUnknown_0861D100 - bl LoadCompressedObjectPalette - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040f0 - adds r1, r2 - b _081C004E - .pool -_081C0040: - ldr r0, =gUnknown_0861D07C - bl LoadCompressedObjectPalette -_081C0046: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] -_081C004A: - ldr r0, =0x000040f0 - adds r1, r0 -_081C004E: - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _081C008C - .pool -_081C0064: - ldr r0, =gUnknown_08D97B84 - movs r1, 0xE8 - lsls r1, 1 - movs r2, 0x60 - bl LoadCompressedPalette - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040f0 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - movs r0, 0x1 - b _081C008E - .pool -_081C008C: - movs r0, 0 -_081C008E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81BFEB0 - - thumb_func_start sub_81C0098 -sub_81C0098: @ 81C0098 - push {r4,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bd - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _081C00D0 - ldr r2, [r1] - ldr r4, =0x000040be - adds r0, r1, r4 - ldrb r1, [r0] - movs r0, 0x64 - muls r1, r0 - adds r1, r2 - adds r0, r3, 0 - movs r2, 0x64 - bl memcpy - b _081C00E6 - .pool -_081C00D0: - ldr r0, [r1] - ldr r2, =0x000040be - adds r1, r2 - ldrb r2, [r1] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 4 - adds r0, r1 - adds r1, r3, 0 - bl sub_8069004 -_081C00E6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0098 - - thumb_func_start sub_81C00F0 -sub_81C00F0: @ 81C00F0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r5, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r7, [r0] - adds r6, r7, 0 - adds r6, 0x70 - ldr r1, =0x000040f0 - adds r0, r7, r1 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0x1 - beq _081C0198 - cmp r0, 0x1 - bgt _081C0120 - cmp r0, 0 - beq _081C012C - b _081C0314 - .pool -_081C0120: - cmp r0, 0x2 - beq _081C01DC - cmp r0, 0x3 - bne _081C012A - b _081C02A8 -_081C012A: - b _081C0314 -_081C012C: - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - strh r0, [r6] - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - strh r0, [r6, 0x2] - adds r0, r5, 0 - movs r1, 0x19 - bl GetMonData - str r0, [r6, 0x10] - adds r0, r5, 0 - movs r1, 0x38 - bl GetMonData - strb r0, [r6, 0x5] - adds r0, r5, 0 - movs r1, 0x2E - bl GetMonData - strb r0, [r6, 0x8] - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - strh r0, [r6, 0x2E] - adds r0, r5, 0 - movs r1, 0 - bl GetMonData - str r0, [r6, 0xC] - adds r0, r5, 0 - movs r1, 0x4 - bl GetMonData - adds r1, r7, 0 - adds r1, 0xA5 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - beq _081C018C - movs r0, 0x1 - strb r0, [r6, 0x4] - b _081C0322 -_081C018C: - adds r0, r5, 0 - movs r1, 0x2D - bl GetMonData - strb r0, [r6, 0x4] - b _081C0322 -_081C0198: - movs r4, 0 - movs r0, 0x8C - adds r0, r7 - mov r8, r0 - movs r1, 0xA4 - adds r1, r7 - mov r9, r1 - adds r6, r7, 0 - adds r6, 0x84 -_081C01AA: - adds r1, r4, 0 - adds r1, 0xD - adds r0, r5, 0 - bl GetMonData - strh r0, [r6] - adds r1, r4, 0 - adds r1, 0x11 - adds r0, r5, 0 - bl GetMonData - mov r2, r8 - adds r1, r2, r4 - strb r0, [r1] - adds r6, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - bls _081C01AA - adds r0, r5, 0 - movs r1, 0x15 - bl GetMonData - mov r1, r9 - strb r0, [r1] - b _081C0322 -_081C01DC: - ldr r1, [r7] - ldr r0, =gPlayerParty - cmp r1, r0 - beq _081C01F8 - ldr r2, =0x000040bc - adds r0, r7, r2 - ldrb r0, [r0] - cmp r0, 0x2 - beq _081C01F8 - ldr r1, =0x000040ef - adds r0, r7, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081C0254 -_081C01F8: - adds r0, r5, 0 - bl GetNature - adds r1, r6, 0 - adds r1, 0x33 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - strh r0, [r6, 0x20] - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r6, 0x22] - adds r0, r5, 0 - movs r1, 0x3B - bl GetMonData - strh r0, [r6, 0x24] - adds r0, r5, 0 - movs r1, 0x3C - bl GetMonData - strh r0, [r6, 0x26] - adds r0, r5, 0 - movs r1, 0x3E - bl GetMonData - strh r0, [r6, 0x28] - adds r0, r5, 0 - movs r1, 0x3F - bl GetMonData - strh r0, [r6, 0x2A] - adds r0, r5, 0 - movs r1, 0x3D - b _081C02A0 - .pool -_081C0254: - adds r0, r5, 0 - bl GetNature - adds r1, r7, 0 - adds r1, 0xA3 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - strh r0, [r6, 0x20] - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r6, 0x22] - adds r0, r5, 0 - movs r1, 0x54 - bl GetMonData - strh r0, [r6, 0x24] - adds r0, r5, 0 - movs r1, 0x55 - bl GetMonData - strh r0, [r6, 0x26] - adds r0, r5, 0 - movs r1, 0x57 - bl GetMonData - strh r0, [r6, 0x28] - adds r0, r5, 0 - movs r1, 0x58 - bl GetMonData - strh r0, [r6, 0x2A] - adds r0, r5, 0 - movs r1, 0x56 -_081C02A0: - bl GetMonData - strh r0, [r6, 0x2C] - b _081C0322 -_081C02A8: - adds r4, r7, 0 - adds r4, 0xA6 - adds r0, r5, 0 - movs r1, 0x7 - adds r2, r4, 0 - bl GetMonData - adds r0, r5, 0 - movs r1, 0x3 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl ConvertInternationalString - adds r0, r5, 0 - bl sub_81B205C - strb r0, [r6, 0x7] - adds r0, r5, 0 - movs r1, 0x31 - bl GetMonData - adds r1, r7, 0 - adds r1, 0xA2 - strb r0, [r1] - adds r0, r5, 0 - movs r1, 0x1 - bl GetMonData - str r0, [r6, 0x48] - adds r0, r5, 0 - movs r1, 0x23 - bl GetMonData - strb r0, [r6, 0x9] - adds r0, r5, 0 - movs r1, 0x24 - bl GetMonData - strb r0, [r6, 0xA] - adds r0, r5, 0 - movs r1, 0x25 - bl GetMonData - strb r0, [r6, 0xB] - adds r0, r5, 0 - movs r1, 0x20 - bl GetMonData - strh r0, [r6, 0x30] - b _081C0322 -_081C0314: - adds r0, r5, 0 - movs r1, 0x52 - bl GetMonData - strb r0, [r6, 0x6] - movs r0, 0x1 - b _081C0332 -_081C0322: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040f0 - adds r1, r2 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0 -_081C0332: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C00F0 - - thumb_func_start sub_81C0348 -sub_81C0348: @ 81C0348 - push {r4-r6,lr} - ldr r6, =gUnknown_0203CF1C - ldr r2, [r6] - ldr r1, =0x000040c0 - adds r0, r2, r1 - ldrb r0, [r0] - subs r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _081C037C - movs r0, 0 - movs r1, 0xFF - bl sub_81C1DA4 - movs r0, 0 - movs r1, 0xFF - movs r2, 0 - bl sub_81C1EFC - b _081C03D8 - .pool -_081C037C: - ldr r1, =0x000040c6 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r1, 1 - adds r0, r2, 0 - adds r0, 0x84 - adds r0, r1 - ldrh r0, [r0] - bl sub_81C240C - ldr r0, [r6] - ldr r5, =0x000020bc - adds r0, r5 - movs r1, 0x3 - movs r2, 0 - bl sub_81C2194 - ldr r0, [r6] - ldr r4, =0x000030bc - adds r0, r4 - movs r1, 0x1 - movs r2, 0 - bl sub_81C2194 - ldr r1, [r6] - adds r1, r4 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r6] - adds r1, r5 - movs r0, 0x2 - bl SetBgTilemapBuffer - movs r1, 0x80 - lsls r1, 9 - movs r0, 0x2 - movs r2, 0x1 - bl ChangeBgX - movs r0, 0x13 - bl ClearWindowTilemap - movs r0, 0xD - bl ClearWindowTilemap -_081C03D8: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x77 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0400 - movs r0, 0 - movs r1, 0xFF - bl sub_81C2074 - b _081C0416 - .pool -_081C0400: - ldr r2, =0x000040c0 - adds r0, r1, r2 - ldrb r0, [r0] - subs r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _081C0416 - movs r0, 0xD - bl PutWindowTilemap -_081C0416: - bl sub_81C2524 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C2228 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0348 - - thumb_func_start sub_81C0434 -sub_81C0434: @ 81C0434 - push {lr} - bl FreeAllWindowBuffers - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0434 - - thumb_func_start sub_81C044C -sub_81C044C: @ 81C044C - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C0484 - str r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C044C - - thumb_func_start sub_81C0484 -sub_81C0484: @ 81C0484 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C04EC - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081C04EC - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r0, [r0, 0x4] - bl SetMainCallback2 - ldr r1, =gUnknown_0203CF20 - ldr r0, [r4] - ldr r2, =0x000040be - adds r0, r2 - ldrb r0, [r0] - strb r0, [r1] - bl sub_81C4898 - bl ResetSpriteData - bl FreeAllSpritePalettes - bl StopCryAndClearCrySongs - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - ldr r0, =gBattleSpritesGfx - ldr r0, [r0] - cmp r0, 0 - bne _081C04E2 - movs r0, 0 - bl sub_806F47C -_081C04E2: - bl sub_81C0434 - adds r0, r5, 0 - bl DestroyTask -_081C04EC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0484 - - thumb_func_start sub_81C0510 -sub_81C0510: @ 81C0510 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C05FE - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r2, 0x80 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _081C05FE - ldr r5, =gMain - ldrh r1, [r5, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081C0550 - movs r1, 0x1 - negs r1, r1 - adds r0, r4, 0 - bl sub_81C0604 - b _081C05FE - .pool -_081C0550: - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _081C0562 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C0604 - b _081C05FE -_081C0562: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081C0576 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C0582 -_081C0576: - movs r1, 0x1 - negs r1, r1 - adds r0, r4, 0 - bl sub_81C0A8C - b _081C05FE -_081C0582: - ldrh r1, [r5, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081C0598 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081C05A2 -_081C0598: - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C0A8C - b _081C05FE -_081C05A2: - ldrh r1, [r5, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081C05E6 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C05FE - cmp r0, 0 - bne _081C05D8 - bl sub_81C48F0 - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81C044C - b _081C05FE - .pool -_081C05D8: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81C0E48 - b _081C05FE -_081C05E6: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C05FE - bl sub_81C48F0 - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81C044C -_081C05FE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81C0510 - thumb_func_start sub_81C0604 sub_81C0604: @ 81C0604 push {r4-r7,lr} diff --git a/include/battle.h b/include/battle.h index 51f9298cc..a681ca946 100644 --- a/include/battle.h +++ b/include/battle.h @@ -186,6 +186,8 @@ #define WEATHER_HAIL (1 << 7) #define WEATHER_HAIL_ANY ((WEATHER_HAIL)) +#include "global.h" + u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg); u8 GetBankSide(u8 bank); diff --git a/ld_script.txt b/ld_script.txt index d6b3953fe..bd0aae460 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -260,6 +260,7 @@ SECTIONS { asm/fldeff_groundshake.o(.text); asm/fossil_specials.o(.text); asm/berry_fix_program.o(.text); + src/pokemon_summary_screen.o(.text); asm/pokemon_summary_screen.o(.text); asm/pokenav.o(.text); asm/rayquaza_scene.o(.text); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c new file mode 100755 index 000000000..12fd52dfb --- /dev/null +++ b/src/pokemon_summary_screen.c @@ -0,0 +1,730 @@ +#include "battle.h" +#include "decompress.h" +#include "global.h" +#include "m4a.h" +#include "main.h" +#include "malloc.h" +#include "palette.h" +#include "pokemon.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "task.h" +#include "window.h" + +extern struct unkSummaryStruct* gUnknown_0203CF1C; +extern struct BgTemplate gUnknown_0861CBB4; +extern u8 gUnknown_0203CF20; +extern struct MusicPlayerInfo gMPlay_BGM; + +extern void sub_806F2AC(u8 a, u8 b); +void sub_81C488C(u8 a); +extern void do_scheduled_bg_tilemap_copies_to_vram(void); +extern u8 sub_81221EC(); +extern u8 sub_81221AC(); +extern void SetVBlankHBlankCallbacksToNull(); +extern void sub_8121DA0(); +extern void clear_scheduled_bg_copies_to_vram(); +extern void remove_some_task(); +extern void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable); +extern void ShowBg(u8 a); +extern void SetGpuReg(u8 regOffset, u16 value); +extern void schedule_bg_copy_tilemap_to_vram(u8 a); +extern void InitBgsFromTemplates(u8 bgMode, struct BgTemplate *templates, u8 numTemplates); +extern void SetBgTilemapBuffer(u8 bg, void *tilemap); +extern u8 gUnknown_08D9862C; +extern u8 gUnknown_08D98CC8; +extern u8 gUnknown_08D987FC; +extern u8 gUnknown_08D9898C; +extern u8 gUnknown_08D98B28; +extern u8 gUnknown_08D9853C; +extern u8 gUnknown_08D85620; +extern struct CompressedSpriteSheet gUnknown_0861CFBC; +extern struct CompressedSpriteSheet gUnknown_0861D074; +extern struct CompressedSpriteSheet gUnknown_0861D0F8; +extern struct CompressedSpritePalette gUnknown_0861D100; +extern struct CompressedSpritePalette gUnknown_0861D07C; +extern u8 gUnknown_08D97B84; +extern u8 gUnknown_08D97D0C; +extern void reset_temp_tile_data_buffers(); +extern void decompress_and_copy_tile_data_to_vram(u8 a, void* tiledata, u8 b, u8 c, u8 d); +extern u8 free_temp_tile_data_buffers_if_possible(); +extern void sub_8069004(struct BoxPokemon* a, void* b); + +extern u32 ChangeBgX(u8 bg, u32 value, u8 op); + +void sub_81BFAE4(void); +void sub_81BFE24(); +u8 sub_81BFEB0(); +void sub_81C2554(); +void sub_81C1BA0(); +void sub_81C0098(struct Pokemon* a); +u8 sub_81C00F0(struct Pokemon* a); +void sub_81C25E8(); +void sub_81C286C(); +void sub_81C2D9C(u8 a); +void sub_81C0348(); +void sub_81C2AFC(u8 a); +void sub_81C4190(); +void sub_81C42C8(); +u8 sub_81C45F4(void* a, u16* b); +void sub_81C4984(); +void sub_81C4A08(); +void sub_81C4A88(); +void sub_81C4280(); +void sub_81C0510(u8 taskId); +void sub_81C171C(u8 taskId); +void sub_8121E10(); +u8 sub_81B205C(struct Pokemon* a); +void sub_81C1DA4(u8 a, u8 b); +void sub_81C1EFC(u8 a, u8 b, u8 c); +void sub_81C240C(u16 a); +void sub_81C2194(void* a, u8 b, u8 c); +void sub_81C2074(u8 a, u8 b); +void sub_81C2524(); +void sub_81C2228(struct Pokemon* poke); +void sub_81C0484(u8 taskId); +void sub_81C4898(); +void sub_806F47C(u8 a); +u8 GetLRKeysState(); +void sub_81C0604(u8 taskId, s8 a); +void sub_81C0A8C(u8 taskId, s8 a); +void sub_81C48F0(); +void sub_81C0E48(u8 taskId); +void sub_81C0704(u8 taskId); + + +u8 sub_81BFB10(); +u8 sub_81B1250(); + +union unkUnion{ + struct Pokemon mons[6]; + struct BoxPokemon boxMons[6]; +}; + +u8 sub_80D214C(union unkUnion* a, u8 b, u8 c, int d); + +struct pokeSummary{ + u16 species; // 0x0 + u16 species2; // 0x2 + u8 isEgg; // 0x4 + u8 level; // 0x5 + u8 ribbons; // 0x6 + u8 unk7; // 0x7 + u8 altability; // 0x8 + u8 metLocation; // 0x9 + u8 metLevel; // 0xA + u8 metGame; // 0xB + u32 pid; // 0xC + u32 exp; // 0x10 + u16 moves[4]; // 0x14 + u8 pp[4]; // 0x1C + u16 currentHP; // 0x20 + u16 maxHP; // 0x22 + u16 atk; // 0x24 + u16 def; // 0x26 + u16 spatk; // 0x28 + u16 spdef; // 0x2A + u16 speed; // 0x2C + u16 item; // 0x2E + u16 friendship; // 0x30 + u8 OTGender; // 0x32 + u8 nature; // 0x33 + u8 ppBonuses; // 0x34 + u8 sanity; // 0x35 + u8 OTName[8]; // 0x36 + u8 unk3E[9]; // 0x3E + u32 OTID; // 0x48 +}; + +struct unkSummaryStruct{ + union unkUnion* unk0; + void* unk4; + void* unk8; + struct Pokemon currentPoke; + struct pokeSummary summary; + u8 unkTilemap0[0x800]; + u8 unkTilemap0_1[0x800]; + u8 unkTilemap1[0x800]; + u8 unkTilemap1_1[0x800]; + u8 unkTilemap2[0x800]; + u8 unkTilemap2_1[0x800]; + u8 unkTilemap3[0x800]; + u8 unkTilemap3_1[0x800]; + u8 unk40BC; + u8 unk40BD; + u8 unk40BE; + u8 unk40BF; + u8 unk40C0; + u8 unk40C1; + u8 unk40C2; + u8 unk40C3; + u16 unk40C4; + u8 unk40C6; + u8 unk_filler3; + u8 unk40C8; + u8 unk_filler2[0xA]; + u8 unk40D3; + u8 unk_filler5[0x1B]; + u8 unk40EF; + s16 unk40F0; + u8 unk_filler4[6]; +}; + +void sub_81BF8EC(u8 a, void* b, u8 c, u8 d, void* e) +{ + u8 byte; + gUnknown_0203CF1C = AllocZeroed(0x40F8); + gUnknown_0203CF1C->unk40BC = a; + gUnknown_0203CF1C->unk0 = b; + gUnknown_0203CF1C->unk40BE = c; + gUnknown_0203CF1C->unk40BF = d; + gUnknown_0203CF1C->unk4 = e; + if (a == 2) + gUnknown_0203CF1C->unk40BD = 1; + else + gUnknown_0203CF1C->unk40BD = 0; + switch (a) + { + case 0: + case 2: + gUnknown_0203CF1C->unk40C1 = 0; + gUnknown_0203CF1C->unk40C2 = 3; + break; + case 1: + gUnknown_0203CF1C->unk40C1 = 0; + gUnknown_0203CF1C->unk40C2 = 3; + gUnknown_0203CF1C->unk40C8 = 1; + break; + case 3: + gUnknown_0203CF1C->unk40C1 = 2; + gUnknown_0203CF1C->unk40C2 = 3; + gUnknown_0203CF1C->unk40C3 = 1; + break; + } + byte = gUnknown_0203CF1C->unk40C1; + gUnknown_0203CF1C->unk40C0 = byte; + sub_81C488C(0xFF); + if (gBattleSpritesGfx == 0) + sub_806F2AC(0, 0); + SetMainCallback2(sub_81BFAE4); +} + +void sub_81BFA38(void* a, u8 b, u8 c, void* d, u16 e) +{ + sub_81BF8EC(3, a, b, c, d); + gUnknown_0203CF1C->unk40C4 = e; +} + +void sub_81BFA80(u8 a, void* b, u8 c, u8 d, void* e) +{ + sub_81BF8EC(a, b, c, d, e); + gUnknown_0203CF1C->unk40EF = 1; +} + +void sub_81BFAB4(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); +} + +void sub_81BFAD0(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_81BFAE4() +{ + while(1) + { + if (sub_81221EC() == 1 || sub_81BFB10() == 1 || sub_81221AC() == 1) + break; + } +} + +u8 sub_81BFB10() +{ + switch (gMain.state) + { + case 0: + SetVBlankHBlankCallbacksToNull(); + sub_8121DA0(); + clear_scheduled_bg_copies_to_vram(); + gMain.state++; + break; + case 1: + remove_some_task(); + gMain.state++; + break; + case 2: + ResetPaletteFade(); + gPaletteFade.bufferTransferDisabled = 1; + gMain.state++; + break; + case 3: + ResetSpriteData(); + gMain.state++; + break; + case 4: + FreeAllSpritePalettes(); + gMain.state++; + break; + case 5: + sub_81BFE24(); + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; + break; + case 6: + if (sub_81BFEB0() != 0) + gMain.state++; + break; + case 7: + sub_81C2554(); + gMain.state++; + break; + case 8: + sub_81C1BA0(); + gMain.state++; + break; + case 9: + sub_81C0098(&gUnknown_0203CF1C->currentPoke); + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; + break; + case 10: + if(sub_81C00F0(&gUnknown_0203CF1C->currentPoke) != 0) + gMain.state++; + break; + case 11: + sub_81C25E8(); + gMain.state++; + break; + case 12: + sub_81C286C(); + gMain.state++; + break; + case 13: + sub_81C2D9C(gUnknown_0203CF1C->unk40C0); + gMain.state++; + break; + case 14: + sub_81C0348(); + gMain.state++; + break; + case 15: + sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + gMain.state++; + break; + case 16: + sub_81C4190(); + sub_81C42C8(); + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; + break; + case 17: + gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentPoke, &gUnknown_0203CF1C->unk40F0); + if (gUnknown_0203CF1C->unk40D3 != 0xFF) + { + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; + } + break; + case 18: + sub_81C4984(&gUnknown_0203CF1C->currentPoke); + gMain.state++; + break; + case 19: + sub_81C4A08(&gUnknown_0203CF1C->currentPoke); + gMain.state++; + break; + case 20: + sub_81C4A88(); + gMain.state++; + break; + case 21: + sub_81C4280(); + gMain.state++; + break; + case 22: + if (gUnknown_0203CF1C->unk40BC != 3) + CreateTask(sub_81C0510, 0); + else + CreateTask(sub_81C171C, 0); + gMain.state++; + break; + case 23: + BlendPalettes(-1, 16, 0); + gMain.state++; + break; + case 24: + BeginNormalPaletteFade(-1, 0, 16, 0, 0); + gPaletteFade.bufferTransferDisabled = 0; + gMain.state++; + break; + default: + SetVBlankCallback(sub_81BFAD0); + SetMainCallback2(sub_81BFAB4); + return 1; + } + return 0; +} + +void sub_81BFE24() +{ + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, &gUnknown_0861CBB4, 4); + SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap2); + SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap1); + SetBgTilemapBuffer(3, &gUnknown_0203CF1C->unkTilemap0); + sub_8121E10(); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + schedule_bg_copy_tilemap_to_vram(3); + SetGpuReg(0, 0x1040); + SetGpuReg(0x50, 0); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); +} + +u8 sub_81BFEB0() +{ + switch (gUnknown_0203CF1C->unk40F0) + { + case 0: + reset_temp_tile_data_buffers(); + decompress_and_copy_tile_data_to_vram(1, &gUnknown_08D97D0C, 0, 0, 0); + gUnknown_0203CF1C->unk40F0++; + break; + case 1: + if (free_temp_tile_data_buffers_if_possible() != 1) + { + LZDecompressWram(&gUnknown_08D9862C, gUnknown_0203CF1C->unkTilemap0); + gUnknown_0203CF1C->unk40F0++; + } + break; + case 2: + LZDecompressWram(&gUnknown_08D98CC8, gUnknown_0203CF1C->unkTilemap0_1); + gUnknown_0203CF1C->unk40F0++; + break; + case 3: + LZDecompressWram(&gUnknown_08D987FC, gUnknown_0203CF1C->unkTilemap1_1); + gUnknown_0203CF1C->unk40F0++; + break; + case 4: + LZDecompressWram(&gUnknown_08D9898C, gUnknown_0203CF1C->unkTilemap2_1); + gUnknown_0203CF1C->unk40F0++; + break; + case 5: + LZDecompressWram(&gUnknown_08D98B28, gUnknown_0203CF1C->unkTilemap3_1); + gUnknown_0203CF1C->unk40F0++; + break; + case 6: + LoadCompressedPalette(&gUnknown_08D9853C, 0, 0x100); + LoadPalette(&gUnknown_08D85620, 0x81, 0x1E); + gUnknown_0203CF1C->unk40F0++; + break; + case 7: + LoadCompressedObjectPic(&gUnknown_0861CFBC); + gUnknown_0203CF1C->unk40F0++; + break; + case 8: + LoadCompressedObjectPic(&gUnknown_0861D074); + gUnknown_0203CF1C->unk40F0++; + break; + case 9: + LoadCompressedObjectPic(&gUnknown_0861D0F8); + gUnknown_0203CF1C->unk40F0++; + break; + case 10: + LoadCompressedObjectPalette(&gUnknown_0861D100); + gUnknown_0203CF1C->unk40F0++; + break; + case 11: + LoadCompressedObjectPalette(&gUnknown_0861D07C); + gUnknown_0203CF1C->unk40F0++; + break; + case 12: + LoadCompressedPalette(&gUnknown_08D97B84, 0x1D0, 0x60); + gUnknown_0203CF1C->unk40F0 = 0; + return 1; + } + return 0; +} + +#ifdef NONMATCHING +void sub_81C0098(struct Pokemon* poke) +{ + if (gUnknown_0203CF1C->unk40BD == 0) + { + struct Pokemon* src = &gUnknown_0203CF1C->unk0->mons[gUnknown_0203CF1C->unk40BE]; + *poke = *src; + } + else + sub_8069004(&gUnknown_0203CF1C->unk0->boxMons[gUnknown_0203CF1C->unk40BE], poke); +} +#else +__attribute__((naked)) +void sub_81C0098(struct Pokemon* poke) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + adds r3, r0, 0\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r1, [r0]\n\ + ldr r2, =0x000040bd\n\ + adds r0, r1, r2\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + bne _081C00D0\n\ + ldr r2, [r1]\n\ + ldr r4, =0x000040be\n\ + adds r0, r1, r4\n\ + ldrb r1, [r0]\n\ + movs r0, 0x64\n\ + muls r1, r0\n\ + adds r1, r2\n\ + adds r0, r3, 0\n\ + movs r2, 0x64\n\ + bl memcpy\n\ + b _081C00E6\n\ + .pool\n\ +_081C00D0:\n\ + ldr r0, [r1]\n\ + ldr r2, =0x000040be\n\ + adds r1, r2\n\ + ldrb r2, [r1]\n\ + lsls r1, r2, 2\n\ + adds r1, r2\n\ + lsls r1, 4\n\ + adds r0, r1\n\ + adds r1, r3, 0\n\ + bl sub_8069004\n\ +_081C00E6:\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +u8 sub_81C00F0(struct Pokemon* a) +{ + u32 i; + struct pokeSummary* sum = &gUnknown_0203CF1C->summary; + switch (gUnknown_0203CF1C->unk40F0) + { + + case 0: + sum->species = GetMonData(a, MON_DATA_SPECIES); + sum->species2 = GetMonData(a, MON_DATA_SPECIES2); + sum->exp = GetMonData(a, MON_DATA_EXP); + sum->level = GetMonData(a, MON_DATA_LEVEL); + sum->altability = GetMonData(a, MON_DATA_ALT_ABILITY); + sum->item = GetMonData(a, MON_DATA_HELD_ITEM); + sum->pid = GetMonData(a, MON_DATA_PERSONALITY); + sum->sanity = GetMonData(a, MON_DATA_SANITY_BIT1); + if (sum->sanity != 0) + sum->isEgg = 1; + else + sum->isEgg = GetMonData(a, MON_DATA_IS_EGG); + break; + case 1: + for (i = 0; i < 4; i++) + { + sum->moves[i] = GetMonData(a, MON_DATA_MOVE1+i); + sum->pp[i] = GetMonData(a, MON_DATA_PP1+i); + } + sum->ppBonuses = GetMonData(a, MON_DATA_PP_BONUSES); + break; + case 2: + if ((struct Pokemon*)gUnknown_0203CF1C->unk0 == gPlayerParty || gUnknown_0203CF1C->unk40BC == 2 || gUnknown_0203CF1C->unk40EF == 1) + { + sum->nature = GetNature(a); + sum->currentHP = GetMonData(a, MON_DATA_HP); + sum->maxHP = GetMonData(a, MON_DATA_MAX_HP); + sum->atk = GetMonData(a, MON_DATA_ATK); + sum->def = GetMonData(a, MON_DATA_DEF); + sum->spatk = GetMonData(a, MON_DATA_SPATK); + sum->spdef = GetMonData(a, MON_DATA_SPDEF); + sum->speed = GetMonData(a, MON_DATA_SPD); + } + else + { + sum->nature = GetNature(a); + sum->currentHP = GetMonData(a, MON_DATA_HP); + sum->maxHP = GetMonData(a, MON_DATA_MAX_HP); + sum->atk = GetMonData(a, MON_DATA_ATK2); + sum->def = GetMonData(a, MON_DATA_DEF2); + sum->spatk = GetMonData(a, MON_DATA_SPATK2); + sum->spdef = GetMonData(a, MON_DATA_SPDEF2); + sum->speed = GetMonData(a, MON_DATA_SPD2); + } + break; + case 3: + GetMonData(a, MON_DATA_OT_NAME, &sum->OTName); + ConvertInternationalString((u8*)&sum->OTName, GetMonData(a, MON_DATA_LANGUAGE)); + sum->unk7 = sub_81B205C(a); + sum->OTGender = GetMonData(a, MON_DATA_OT_GENDER); + sum->OTID = GetMonData(a, MON_DATA_OT_ID); + sum->metLocation = GetMonData(a, MON_DATA_MET_LOCATION); + sum->metLevel = GetMonData(a, MON_DATA_MET_LEVEL); + sum->metGame = GetMonData(a, MON_DATA_MET_GAME); + sum->friendship = GetMonData(a, MON_DATA_FRIENDSHIP); + break; + default: + sum->ribbons = GetMonData(a, MON_DATA_RIBBON_COUNT); + return 1; + } + gUnknown_0203CF1C->unk40F0++; + return 0; +} + +void sub_81C0348() +{ + u8 a = gUnknown_0203CF1C->unk40C0 - 2; + if (a > 1) + { + sub_81C1DA4(0, 255); + sub_81C1EFC(0, 255, 0); + } + else + { + sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2, 3, 0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3, 1, 0); + SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap3); + SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap2); + ChangeBgX(2, 0x10000, 1); + ClearWindowTilemap(0x13); + ClearWindowTilemap(0xD); + } + if (gUnknown_0203CF1C->summary.unk7 == 0) + sub_81C2074(0, 0xFF); + else + { + u8 b = gUnknown_0203CF1C->unk40C0 - 2; + if (b > 1) + PutWindowTilemap(0xD); + } + sub_81C2524(); + sub_81C2228(&gUnknown_0203CF1C->currentPoke); +} + +void sub_81C0434() +{ + FreeAllWindowBuffers(); + Free(gUnknown_0203CF1C); +} + +void sub_81C044C(u8 taskId) +{ + BeginNormalPaletteFade(-1, 0, 0, 16, 0); + gTasks[taskId].func = sub_81C0484; +} + +void sub_81C0484(u8 taskId) +{ + if (sub_81221EC() != 1 && gPaletteFade.active == 0) + { + SetMainCallback2(gUnknown_0203CF1C->unk4); + gUnknown_0203CF20 = gUnknown_0203CF1C->unk40BE; + sub_81C4898(); + ResetSpriteData(); + FreeAllSpritePalettes(); + StopCryAndClearCrySongs(); + m4aMPlayVolumeControl(&gMPlay_BGM, 0xFFFF, 0x100); + if (gBattleSpritesGfx == 0) + sub_806F47C(0); + sub_81C0434(); + DestroyTask(taskId); + } +} + +void sub_81C0510(u8 taskId) +{ + if (sub_81221EC() != 1 && gPaletteFade.active == 0) + { + if (gMain.newKeys & DPAD_UP) + sub_81C0604(taskId, -1); + else if (gMain.newKeys & DPAD_DOWN) + { + sub_81C0604(taskId, 1); + } + else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysState() == 1) + sub_81C0A8C(taskId, -1); + else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysState() == 2) + sub_81C0A8C(taskId, 1); + else if (gMain.newKeys & A_BUTTON) + { + if (gUnknown_0203CF1C->unk40C0 != 1) + { + if (gUnknown_0203CF1C->unk40C0 == 0) + { + sub_81C48F0(); + PlaySE(5); + sub_81C044C(taskId); + } + else + { + PlaySE(5); + sub_81C0E48(taskId); + } + } + } + else if (gMain.newKeys & B_BUTTON) + { + sub_81C48F0(); + PlaySE(5); + sub_81C044C(taskId); + } + } +} + +/* void sub_81C0604(u8 taskId, s8 a) +{ + s8 r4; + s8 r4_2; + if (gUnknown_0203CF1C->unk40C3 == 0) + { + if (gUnknown_0203CF1C->unk40BD == 1) + { + if(gUnknown_0203CF1C->unk40C0 != 0) + { + r4 = 2 * (a != 2); + } + else if (a == 1) + r4 = 1; + else + r4 = 3; + r4_2 = sub_80D214C(gUnknown_0203CF1C->unk0, gUnknown_0203CF1C->unk40BE, gUnknown_0203CF1C->unk40BF, r4); + } + else if (sub_81B1250() == 1) + { + r4_2 = sub_81C09B4(a); + } + else + r4_2 = sub_81C08F8(a); + if (r4_2 != -1) + { + PlaySE(5); + if (gUnknown_0203CF1C->summary.unk7 != 0) + { + sub_81C4204(2, 1); + ClearWindowTilemap(0xD); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C2074(0, 2); + } + gUnknown_0203CF1C->unk40BE = r4_2; + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = sub_81C0704; + } + } +} */ \ No newline at end of file