From c2f1e2fe5355800f2941b4788925649142a9ebdf Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Wed, 20 Sep 2017 15:07:24 -0400 Subject: [PATCH 01/21] decompiled up to sub_81C0510 --- asm/pokemon_summary_screen.s | 1410 ---------------------------------- include/battle.h | 2 + ld_script.txt | 1 + src/pokemon_summary_screen.c | 730 ++++++++++++++++++ 4 files changed, 733 insertions(+), 1410 deletions(-) create mode 100755 src/pokemon_summary_screen.c diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 3fb4124774..a97751aa9e 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 51f9298cc7..a681ca946c 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 d6b3953fed..bd0aae460a 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 0000000000..12fd52dfbf --- /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 From 70e0a357be6cc1947f9cbbce9101dd3860eb2828 Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Wed, 20 Sep 2017 21:25:48 -0400 Subject: [PATCH 02/21] why are these functions bullying me --- asm/pokemon_summary_screen.s | 116 ------------------ src/pokemon_summary_screen.c | 220 ++++++++++++++++++++++++++++++++++- 2 files changed, 214 insertions(+), 122 deletions(-) diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index a97751aa9e..44abdb2dfc 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,122 +5,6 @@ .text - thumb_func_start sub_81C0604 -sub_81C0604: @ 81C0604 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - adds r4, r5, 0 - ldr r1, =gUnknown_0203CF1C - ldr r3, [r1] - ldr r2, =0x000040c3 - adds r0, r3, r2 - ldrb r0, [r0] - adds r6, r1, 0 - cmp r0, 0 - bne _081C06EE - ldr r1, =0x000040bd - adds r0, r3, r1 - ldrb r2, [r0] - cmp r2, 0x1 - bne _081C0678 - adds r1, 0x3 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081C0654 - lsls r1, r5, 24 - asrs r1, 24 - movs r4, 0x2 - eors r1, r2 - negs r0, r1 - orrs r0, r1 - asrs r0, 31 - ands r4, r0 - b _081C065C - .pool -_081C0654: - movs r4, 0x3 - cmp r5, 0x1 - bne _081C065C - movs r4, 0x1 -_081C065C: - ldr r2, [r6] - ldr r0, [r2] - ldr r3, =0x000040be - adds r1, r2, r3 - ldrb r1, [r1] - adds r3, 0x1 - adds r2, r3 - ldrb r2, [r2] - adds r3, r4, 0 - bl sub_80D214C - b _081C0696 - .pool -_081C0678: - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C068E - lsls r0, r5, 24 - asrs r0, 24 - bl sub_81C09B4 - b _081C0696 -_081C068E: - lsls r0, r4, 24 - asrs r0, 24 - bl sub_81C08F8 -_081C0696: - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - beq _081C06EE - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203CF1C - ldr r0, [r5] - adds r0, 0x77 - ldrb r0, [r0] - cmp r0, 0 - beq _081C06D4 - movs r0, 0x2 - movs r1, 0x1 - bl sub_81C4204 - movs r0, 0xD - bl ClearWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0 - movs r1, 0x2 - bl sub_81C2074 -_081C06D4: - ldr r0, [r5] - ldr r1, =0x000040be - adds r0, r1 - movs r2, 0 - strb r4, [r0] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0x8] - ldr r1, =sub_81C0704 - str r1, [r0] -_081C06EE: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0604 - thumb_func_start sub_81C0704 sub_81C0704: @ 81C0704 push {r4-r6,lr} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 12fd52dfbf..399900a998 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -92,7 +92,10 @@ void sub_81C0A8C(u8 taskId, s8 a); void sub_81C48F0(); void sub_81C0E48(u8 taskId); void sub_81C0704(u8 taskId); - +s8 sub_81C09B4(s8 a); +s8 sub_81C08F8(s8 a); +void sub_81C4204(u8 a, u8 b); +void sub_81C20F0(u8 taskId); u8 sub_81BFB10(); u8 sub_81B1250(); @@ -165,7 +168,8 @@ struct unkSummaryStruct{ u8 unk40C8; u8 unk_filler2[0xA]; u8 unk40D3; - u8 unk_filler5[0x1B]; + u8 unk40D4; + u8 unk_filler5[0x1A]; u8 unk40EF; s16 unk40F0; u8 unk_filler4[6]; @@ -688,20 +692,23 @@ void sub_81C0510(u8 taskId) } } -/* void sub_81C0604(u8 taskId, s8 a) +#ifdef NONMATCHING +void sub_81C0604(u8 taskId, s8 a) { - s8 r4; s8 r4_2; + int r4; + + if (gUnknown_0203CF1C->unk40C3 == 0) { if (gUnknown_0203CF1C->unk40BD == 1) { if(gUnknown_0203CF1C->unk40C0 != 0) { - r4 = 2 * (a != 2); + r4 = (a ^ 1) ? 2 : 0; } else if (a == 1) - r4 = 1; + r4 = a; else r4 = 3; r4_2 = sub_80D214C(gUnknown_0203CF1C->unk0, gUnknown_0203CF1C->unk40BE, gUnknown_0203CF1C->unk40BF, r4); @@ -727,4 +734,205 @@ void sub_81C0510(u8 taskId) gTasks[taskId].func = sub_81C0704; } } +} +#else +__attribute__((naked)) +void sub_81C0604(u8 taskId, s8 a) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + lsls r0, 24\n\ + lsrs r7, r0, 24\n\ + lsls r1, 24\n\ + lsrs r5, r1, 24\n\ + adds r4, r5, 0\n\ + ldr r1, =gUnknown_0203CF1C\n\ + ldr r3, [r1]\n\ + ldr r2, =0x000040c3\n\ + adds r0, r3, r2\n\ + ldrb r0, [r0]\n\ + adds r6, r1, 0\n\ + cmp r0, 0\n\ + bne _081C06EE\n\ + ldr r1, =0x000040bd\n\ + adds r0, r3, r1\n\ + ldrb r2, [r0]\n\ + cmp r2, 0x1\n\ + bne _081C0678\n\ + adds r1, 0x3\n\ + adds r0, r3, r1\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _081C0654\n\ + lsls r1, r5, 24\n\ + asrs r1, 24\n\ + movs r4, 0x2\n\ + eors r1, r2\n\ + negs r0, r1\n\ + orrs r0, r1\n\ + asrs r0, 31\n\ + ands r4, r0\n\ + b _081C065C\n\ + .pool\n\ +_081C0654:\n\ + movs r4, 0x3\n\ + cmp r5, 0x1\n\ + bne _081C065C\n\ + movs r4, 0x1\n\ +_081C065C:\n\ + ldr r2, [r6]\n\ + ldr r0, [r2]\n\ + ldr r3, =0x000040be\n\ + adds r1, r2, r3\n\ + ldrb r1, [r1]\n\ + adds r3, 0x1\n\ + adds r2, r3\n\ + ldrb r2, [r2]\n\ + adds r3, r4, 0\n\ + bl sub_80D214C\n\ + b _081C0696\n\ + .pool\n\ +_081C0678:\n\ + bl sub_81B1250\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bne _081C068E\n\ + lsls r0, r5, 24\n\ + asrs r0, 24\n\ + bl sub_81C09B4\n\ + b _081C0696\n\ +_081C068E:\n\ + lsls r0, r4, 24\n\ + asrs r0, 24\n\ + bl sub_81C08F8\n\ +_081C0696:\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + lsls r0, r4, 24\n\ + asrs r0, 24\n\ + movs r1, 0x1\n\ + negs r1, r1\n\ + cmp r0, r1\n\ + beq _081C06EE\n\ + movs r0, 0x5\n\ + bl PlaySE\n\ + ldr r5, =gUnknown_0203CF1C\n\ + ldr r0, [r5]\n\ + adds r0, 0x77\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _081C06D4\n\ + movs r0, 0x2\n\ + movs r1, 0x1\n\ + bl sub_81C4204\n\ + movs r0, 0xD\n\ + bl ClearWindowTilemap\n\ + movs r0, 0\n\ + bl schedule_bg_copy_tilemap_to_vram\n\ + movs r0, 0\n\ + movs r1, 0x2\n\ + bl sub_81C2074\n\ +_081C06D4:\n\ + ldr r0, [r5]\n\ + ldr r1, =0x000040be\n\ + adds r0, r1\n\ + movs r2, 0\n\ + strb r4, [r0]\n\ + ldr r1, =gTasks\n\ + lsls r0, r7, 2\n\ + adds r0, r7\n\ + lsls r0, 3\n\ + adds r0, r1\n\ + strh r2, [r0, 0x8]\n\ + ldr r1, =sub_81C0704\n\ + str r1, [r0]\n\ +_081C06EE:\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +/* void sub_81C0704(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + StopCryAndClearCrySongs(); + data[0]++; + break; + case 1: + sub_81C4898(); + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3]); + data[0]++; + break; + case 2: + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D4]); + data[0]++; + break; + case 3: + sub_81C0098(&gUnknown_0203CF1C->currentPoke); + gUnknown_0203CF1C->unk40F0 = 0; + data[0]++; + break; + case 4: + if (sub_81C00F0(&gUnknown_0203CF1C->currentPoke)) + data[0]++; + break; + case 5: + sub_81C49E0(&gUnknown_0203CF1C->currentPoke); + data[0]++; + break; + case 6: + sub_81C4A08(&gUnknown_0203CF1C->currentPoke); + data[0]++; + break; + case 7: + if (gUnknown_0203CF1C->summary.unk7) + sub_81C2074(10, -2); + sub_81C2228(&gUnknown_0203CF1C->currentPoke); + data[1] = 0; + data[0]++; + break; + case 8: + gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentPoke, &data[1]); + if (gUnknown_0203CF1C->unk40D3 != 0xFF) + { + gSprites[gUnknown_0203CF1C->unk40D3].data2 = 1; + sub_81C0E24(); + data[1] = 0; + data[0]++; + } + break; + case 9: + sub_81C4280(); + data[0]++; + break; + case 10: + sub_81C25E8(); + data[0]++; + break; + case 11: + sub_81C2D9C(gUnknown_0203CF1C->unk40C0); + sub_81C2524(); + data[0]++; + break; + case 12: + gSprites[gUnknown_0203CF1C->unk40D3].data2 = 0; + data[0]++; + break; + case 13: + if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0) + { + TaskFunc *func; + data[0] = 0; + func = &gTasks[taskId].func; + *func = sub_81C0510; + } + } } */ \ No newline at end of file From ee277bff16c6d118bf9a4af4a27f0b9619d1fb4b Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Fri, 22 Sep 2017 15:17:59 -0400 Subject: [PATCH 03/21] decompiled up to sub_81C0A50 --- asm/pokemon_summary_screen.s | 410 ------------------------ src/pokemon_summary_screen.c | 599 ++++++++++++++++++++++++----------- 2 files changed, 415 insertions(+), 594 deletions(-) diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 44abdb2dfc..e337c8b27a 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,416 +5,6 @@ .text - thumb_func_start sub_81C0704 -sub_81C0704: @ 81C0704 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r4, r1, 3 - ldr r6, =gTasks + 0x8 - adds r5, r4, r6 - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0xC - bls _081C071E - b _081C08BC -_081C071E: - lsls r0, 2 - ldr r1, =_081C0730 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C0730: - .4byte _081C0764 - .4byte _081C076A - .4byte _081C0780 - .4byte _081C07A8 - .4byte _081C07C8 - .4byte _081C07E0 - .4byte _081C07F0 - .4byte _081C0800 - .4byte _081C0828 - .4byte _081C086C - .4byte _081C0872 - .4byte _081C0878 - .4byte _081C0894 -_081C0764: - bl StopCryAndClearCrySongs - b _081C08EC -_081C076A: - bl sub_81C4898 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d3 - b _081C0786 - .pool -_081C0780: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d4 -_081C0786: - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySpriteAndFreeResources - b _081C08EC - .pool -_081C07A8: - 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 _081C08EC - .pool -_081C07C8: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C00F0 - lsls r0, 24 - cmp r0, 0 - bne _081C07DA - b _081C08F2 -_081C07DA: - b _081C08EC - .pool -_081C07E0: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C49E0 - b _081C08EC - .pool -_081C07F0: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - bl sub_81C4A08 - b _081C08EC - .pool -_081C0800: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0x77 - ldrb r0, [r0] - cmp r0, 0 - beq _081C0816 - movs r1, 0x2 - negs r1, r1 - movs r0, 0xA - bl sub_81C2074 -_081C0816: - ldr r0, [r4] - adds r0, 0xC - bl sub_81C2228 - movs r0, 0 - strh r0, [r5, 0x2] - b _081C08EC - .pool -_081C0828: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0xC - adds r1, r5, 0x2 - bl sub_81C45F4 - ldr r1, [r4] - ldr r2, =0x000040d3 - adds r1, r2 - strb r0, [r1] - ldr r0, [r4] - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _081C08F2 - ldr r2, =gSprites - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - strh r1, [r0, 0x32] - bl sub_81C0E24 - movs r0, 0 - strh r0, [r5, 0x2] - b _081C08EC - .pool -_081C086C: - bl sub_81C4280 - b _081C08EC -_081C0872: - bl sub_81C25E8 - b _081C08EC -_081C0878: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C2D9C - bl sub_81C2524 - b _081C08EC - .pool -_081C0894: - ldr r2, =gSprites - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d3 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x32] - b _081C08EC - .pool -_081C08BC: - bl sub_81221EC - lsls r0, 24 - cmp r0, 0 - bne _081C08F2 - ldr r0, =sub_81C20F0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _081C08F2 - strh r0, [r5] - adds r0, r6, 0 - subs r0, 0x8 - adds r0, r4, r0 - ldr r1, =sub_81C0510 - str r1, [r0] - b _081C08F2 - .pool -_081C08EC: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_081C08F2: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81C0704 - - thumb_func_start sub_81C08F8 -sub_81C08F8: @ 81C08F8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gUnknown_0203CF1C - ldr r2, [r1] - ldr r7, [r2] - ldr r3, =0x000040c0 - adds r0, r2, r3 - ldrb r0, [r0] - adds r5, r1, 0 - cmp r0, 0 - bne _081C0960 - lsls r0, r4, 24 - asrs r3, r0, 24 - movs r1, 0x1 - negs r1, r1 - adds r6, r0, 0 - cmp r3, r1 - bne _081C0928 - ldr r1, =0x000040be - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081C0988 -_081C0928: - asrs r0, r6, 24 - cmp r0, 0x1 - bne _081C0940 - ldr r0, [r5] - ldr r2, =0x000040be - adds r1, r0, r2 - ldr r3, =0x000040bf - adds r0, r3 - ldrb r1, [r1] - ldrb r0, [r0] - cmp r1, r0 - bcs _081C0988 -_081C0940: - ldr r0, [r5] - ldr r1, =0x000040be - adds r0, r1 - ldrb r0, [r0] - adds r0, r4 - lsls r0, 24 - asrs r0, 24 - b _081C09AE - .pool -_081C0960: - ldr r3, =0x000040be - adds r0, r2, r3 - ldrb r5, [r0] - lsls r6, r4, 24 -_081C0968: - lsls r0, r5, 24 - asrs r0, 24 - asrs r1, r6, 24 - adds r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - asrs r4, r0, 24 - cmp r4, 0 - blt _081C0988 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040bf - adds r0, r1 - ldrb r0, [r0] - cmp r4, r0 - ble _081C099C -_081C0988: - movs r0, 0x1 - negs r0, r0 - b _081C09AE - .pool -_081C099C: - movs r0, 0x64 - muls r0, r4 - adds r0, r7, r0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081C0968 - adds r0, r4, 0 -_081C09AE: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81C08F8 - - thumb_func_start sub_81C09B4 -sub_81C09B4: @ 81C09B4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - ldr r6, =gUnknown_0203CF1C - ldr r0, [r6] - ldr r1, [r0] - mov r8, r1 - movs r5, 0 - movs r2, 0 - ldr r3, =gUnknown_0861CC1C - movs r1, 0 - ldrsb r1, [r3, r1] - ldr r4, =0x000040be - adds r0, r4 - ldrb r0, [r0] - cmp r1, r0 - beq _081C09FC - adds r7, r3, 0 - adds r3, r4, 0 -_081C09E0: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x5 - bhi _081C09FC - adds r0, r2, r7 - movs r1, 0 - ldrsb r1, [r0, r1] - ldr r0, [r6] - adds r0, r3 - ldrb r0, [r0] - cmp r1, r0 - bne _081C09E0 - adds r5, r2, 0 -_081C09FC: - mov r0, r12 - lsls r6, r0, 24 - ldr r7, =gUnknown_0861CC1C -_081C0A02: - lsls r0, r5, 24 - asrs r0, 24 - asrs r1, r6, 24 - adds r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, r5, 24 - lsrs r0, r1, 24 - cmp r0, 0x5 - bhi _081C0A40 - asrs r0, r1, 24 - adds r0, r7 - movs r4, 0 - ldrsb r4, [r0, r4] - movs r0, 0x64 - muls r0, r4 - add r0, r8 - bl sub_81C0A50 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C0A02 - adds r0, r4, 0 - b _081C0A44 - .pool -_081C0A40: - movs r0, 0x1 - negs r0, r0 -_081C0A44: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81C09B4 - - thumb_func_start sub_81C0A50 -sub_81C0A50: @ 81C0A50 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081C0A84 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040be - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0A78 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081C0A84 -_081C0A78: - movs r0, 0x1 - b _081C0A86 - .pool -_081C0A84: - movs r0, 0 -_081C0A86: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81C0A50 - thumb_func_start sub_81C0A8C sub_81C0A8C: @ 81C0A8C push {r4-r7,lr} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 399900a998..77d1d1b28d 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -6,6 +6,7 @@ #include "malloc.h" #include "palette.h" #include "pokemon.h" +#include "songs.h" #include "sound.h" #include "sprite.h" #include "string_util.h" @@ -16,6 +17,7 @@ extern struct unkSummaryStruct* gUnknown_0203CF1C; extern struct BgTemplate gUnknown_0861CBB4; extern u8 gUnknown_0203CF20; extern struct MusicPlayerInfo gMPlay_BGM; +extern s8 gUnknown_0861CC1C[]; extern void sub_806F2AC(u8 a, u8 b); void sub_81C488C(u8 a); @@ -80,7 +82,7 @@ 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_81C2074(u16 a, s16 b); void sub_81C2524(); void sub_81C2228(struct Pokemon* poke); void sub_81C0484(u8 taskId); @@ -96,6 +98,7 @@ s8 sub_81C09B4(s8 a); s8 sub_81C08F8(s8 a); void sub_81C4204(u8 a, u8 b); void sub_81C20F0(u8 taskId); +u8 sub_81C0A50(struct Pokemon* mon); u8 sub_81BFB10(); u8 sub_81B1250(); @@ -105,7 +108,7 @@ union unkUnion{ struct BoxPokemon boxMons[6]; }; -u8 sub_80D214C(union unkUnion* a, u8 b, u8 c, int d); +u8 sub_80D214C(union unkUnion* a, u8 b, u8 c, u8 d); struct pokeSummary{ u16 species; // 0x0 @@ -462,62 +465,19 @@ u8 sub_81BFEB0() 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; + struct Pokemon *pokeMons = gUnknown_0203CF1C->unk0->mons; + *poke = pokeMons[gUnknown_0203CF1C->unk40BE]; } else - sub_8069004(&gUnknown_0203CF1C->unk0->boxMons[gUnknown_0203CF1C->unk40BE], poke); + { + struct BoxPokemon *boxMons = gUnknown_0203CF1C->unk0->boxMons; + sub_8069004(&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) { @@ -692,36 +652,42 @@ void sub_81C0510(u8 taskId) } } -#ifdef NONMATCHING void sub_81C0604(u8 taskId, s8 a) { s8 r4_2; - int r4; - - + if (gUnknown_0203CF1C->unk40C3 == 0) { if (gUnknown_0203CF1C->unk40BD == 1) { - if(gUnknown_0203CF1C->unk40C0 != 0) + if (gUnknown_0203CF1C->unk40C0 != 0) { - r4 = (a ^ 1) ? 2 : 0; + if (a == 1) + a = 0; + else + a = 2; } - else if (a == 1) - r4 = a; else - r4 = 3; - r4_2 = sub_80D214C(gUnknown_0203CF1C->unk0, gUnknown_0203CF1C->unk40BE, gUnknown_0203CF1C->unk40BF, r4); + { + if (a == 1) + a = 1; + else + a = 3; + } + r4_2 = sub_80D214C(gUnknown_0203CF1C->unk0, gUnknown_0203CF1C->unk40BE, gUnknown_0203CF1C->unk40BF, a); } else if (sub_81B1250() == 1) { r4_2 = sub_81C09B4(a); } else + { r4_2 = sub_81C08F8(a); + } + if (r4_2 != -1) { - PlaySE(5); + PlaySE(SE_SELECT); if (gUnknown_0203CF1C->summary.unk7 != 0) { sub_81C4204(2, 1); @@ -735,128 +701,9 @@ void sub_81C0604(u8 taskId, s8 a) } } } -#else -__attribute__((naked)) -void sub_81C0604(u8 taskId, s8 a) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - lsls r0, 24\n\ - lsrs r7, r0, 24\n\ - lsls r1, 24\n\ - lsrs r5, r1, 24\n\ - adds r4, r5, 0\n\ - ldr r1, =gUnknown_0203CF1C\n\ - ldr r3, [r1]\n\ - ldr r2, =0x000040c3\n\ - adds r0, r3, r2\n\ - ldrb r0, [r0]\n\ - adds r6, r1, 0\n\ - cmp r0, 0\n\ - bne _081C06EE\n\ - ldr r1, =0x000040bd\n\ - adds r0, r3, r1\n\ - ldrb r2, [r0]\n\ - cmp r2, 0x1\n\ - bne _081C0678\n\ - adds r1, 0x3\n\ - adds r0, r3, r1\n\ - ldrb r0, [r0]\n\ - cmp r0, 0\n\ - beq _081C0654\n\ - lsls r1, r5, 24\n\ - asrs r1, 24\n\ - movs r4, 0x2\n\ - eors r1, r2\n\ - negs r0, r1\n\ - orrs r0, r1\n\ - asrs r0, 31\n\ - ands r4, r0\n\ - b _081C065C\n\ - .pool\n\ -_081C0654:\n\ - movs r4, 0x3\n\ - cmp r5, 0x1\n\ - bne _081C065C\n\ - movs r4, 0x1\n\ -_081C065C:\n\ - ldr r2, [r6]\n\ - ldr r0, [r2]\n\ - ldr r3, =0x000040be\n\ - adds r1, r2, r3\n\ - ldrb r1, [r1]\n\ - adds r3, 0x1\n\ - adds r2, r3\n\ - ldrb r2, [r2]\n\ - adds r3, r4, 0\n\ - bl sub_80D214C\n\ - b _081C0696\n\ - .pool\n\ -_081C0678:\n\ - bl sub_81B1250\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - cmp r0, 0x1\n\ - bne _081C068E\n\ - lsls r0, r5, 24\n\ - asrs r0, 24\n\ - bl sub_81C09B4\n\ - b _081C0696\n\ -_081C068E:\n\ - lsls r0, r4, 24\n\ - asrs r0, 24\n\ - bl sub_81C08F8\n\ -_081C0696:\n\ - lsls r0, 24\n\ - lsrs r4, r0, 24\n\ - lsls r0, r4, 24\n\ - asrs r0, 24\n\ - movs r1, 0x1\n\ - negs r1, r1\n\ - cmp r0, r1\n\ - beq _081C06EE\n\ - movs r0, 0x5\n\ - bl PlaySE\n\ - ldr r5, =gUnknown_0203CF1C\n\ - ldr r0, [r5]\n\ - adds r0, 0x77\n\ - ldrb r0, [r0]\n\ - cmp r0, 0\n\ - beq _081C06D4\n\ - movs r0, 0x2\n\ - movs r1, 0x1\n\ - bl sub_81C4204\n\ - movs r0, 0xD\n\ - bl ClearWindowTilemap\n\ - movs r0, 0\n\ - bl schedule_bg_copy_tilemap_to_vram\n\ - movs r0, 0\n\ - movs r1, 0x2\n\ - bl sub_81C2074\n\ -_081C06D4:\n\ - ldr r0, [r5]\n\ - ldr r1, =0x000040be\n\ - adds r0, r1\n\ - movs r2, 0\n\ - strb r4, [r0]\n\ - ldr r1, =gTasks\n\ - lsls r0, r7, 2\n\ - adds r0, r7\n\ - lsls r0, 3\n\ - adds r0, r1\n\ - strh r2, [r0, 0x8]\n\ - ldr r1, =sub_81C0704\n\ - str r1, [r0]\n\ -_081C06EE:\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif -/* void sub_81C0704(u8 taskId) +#ifdef NONMATCHING +void sub_81C0704(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -935,4 +782,388 @@ _081C06EE:\n\ *func = sub_81C0510; } } -} */ \ No newline at end of file +} +#else +__attribute__((naked)) +void sub_81C0704(u8 taskId) +{ + asm(".syntax unified\n\ + push {r4-r6,lr}\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + lsls r1, r0, 2\n\ + adds r1, r0\n\ + lsls r4, r1, 3\n\ + ldr r6, =gTasks + 0x8\n\ + adds r5, r4, r6\n\ + movs r1, 0\n\ + ldrsh r0, [r5, r1]\n\ + cmp r0, 0xC\n\ + bls _081C071E\n\ + b _081C08BC\n\ +_081C071E:\n\ + lsls r0, 2\n\ + ldr r1, =_081C0730\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_081C0730:\n\ + .4byte _081C0764\n\ + .4byte _081C076A\n\ + .4byte _081C0780\n\ + .4byte _081C07A8\n\ + .4byte _081C07C8\n\ + .4byte _081C07E0\n\ + .4byte _081C07F0\n\ + .4byte _081C0800\n\ + .4byte _081C0828\n\ + .4byte _081C086C\n\ + .4byte _081C0872\n\ + .4byte _081C0878\n\ + .4byte _081C0894\n\ +_081C0764:\n\ + bl StopCryAndClearCrySongs\n\ + b _081C08EC\n\ +_081C076A:\n\ + bl sub_81C4898\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + ldr r1, =0x000040d3\n\ + b _081C0786\n\ + .pool\n\ +_081C0780:\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + ldr r1, =0x000040d4\n\ +_081C0786:\n\ + adds r0, r1\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + ldr r1, =gSprites\n\ + adds r0, r1\n\ + bl DestroySpriteAndFreeResources\n\ + b _081C08EC\n\ + .pool\n\ +_081C07A8:\n\ + ldr r4, =gUnknown_0203CF1C\n\ + ldr r0, [r4]\n\ + adds r0, 0xC\n\ + bl sub_81C0098\n\ + ldr r0, [r4]\n\ + ldr r1, =0x000040f0\n\ + adds r0, r1\n\ + movs r1, 0\n\ + strh r1, [r0]\n\ + b _081C08EC\n\ + .pool\n\ +_081C07C8:\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + adds r0, 0xC\n\ + bl sub_81C00F0\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + bne _081C07DA\n\ + b _081C08F2\n\ +_081C07DA:\n\ + b _081C08EC\n\ + .pool\n\ +_081C07E0:\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + adds r0, 0xC\n\ + bl sub_81C49E0\n\ + b _081C08EC\n\ + .pool\n\ +_081C07F0:\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + adds r0, 0xC\n\ + bl sub_81C4A08\n\ + b _081C08EC\n\ + .pool\n\ +_081C0800:\n\ + ldr r4, =gUnknown_0203CF1C\n\ + ldr r0, [r4]\n\ + adds r0, 0x77\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _081C0816\n\ + movs r1, 0x2\n\ + negs r1, r1\n\ + movs r0, 0xA\n\ + bl sub_81C2074\n\ +_081C0816:\n\ + ldr r0, [r4]\n\ + adds r0, 0xC\n\ + bl sub_81C2228\n\ + movs r0, 0\n\ + strh r0, [r5, 0x2]\n\ + b _081C08EC\n\ + .pool\n\ +_081C0828:\n\ + ldr r4, =gUnknown_0203CF1C\n\ + ldr r0, [r4]\n\ + adds r0, 0xC\n\ + adds r1, r5, 0x2\n\ + bl sub_81C45F4\n\ + ldr r1, [r4]\n\ + ldr r2, =0x000040d3\n\ + adds r1, r2\n\ + strb r0, [r1]\n\ + ldr r0, [r4]\n\ + adds r1, r0, r2\n\ + ldrb r0, [r1]\n\ + cmp r0, 0xFF\n\ + beq _081C08F2\n\ + ldr r2, =gSprites\n\ + adds r1, r0, 0\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + adds r0, r2\n\ + movs r1, 0x1\n\ + strh r1, [r0, 0x32]\n\ + bl sub_81C0E24\n\ + movs r0, 0\n\ + strh r0, [r5, 0x2]\n\ + b _081C08EC\n\ + .pool\n\ +_081C086C:\n\ + bl sub_81C4280\n\ + b _081C08EC\n\ +_081C0872:\n\ + bl sub_81C25E8\n\ + b _081C08EC\n\ +_081C0878:\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + ldr r1, =0x000040c0\n\ + adds r0, r1\n\ + ldrb r0, [r0]\n\ + bl sub_81C2D9C\n\ + bl sub_81C2524\n\ + b _081C08EC\n\ + .pool\n\ +_081C0894:\n\ + ldr r2, =gSprites\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + ldr r1, =0x000040d3\n\ + adds r0, r1\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + adds r0, r2\n\ + movs r1, 0\n\ + strh r1, [r0, 0x32]\n\ + b _081C08EC\n\ + .pool\n\ +_081C08BC:\n\ + bl sub_81221EC\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + bne _081C08F2\n\ + ldr r0, =sub_81C20F0\n\ + bl FuncIsActiveTask\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0\n\ + bne _081C08F2\n\ + strh r0, [r5]\n\ + adds r0, r6, 0\n\ + subs r0, 0x8\n\ + adds r0, r4, r0\n\ + ldr r1, =sub_81C0510\n\ + str r1, [r0]\n\ + b _081C08F2\n\ + .pool\n\ +_081C08EC:\n\ + ldrh r0, [r5]\n\ + adds r0, 0x1\n\ + strh r0, [r5]\n\ +_081C08F2:\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +s8 sub_81C08F8(s8 a) +{ + union unkUnion* r7 = gUnknown_0203CF1C->unk0; + if (gUnknown_0203CF1C->unk40C0 == 0) + { + if (a != -1 || gUnknown_0203CF1C->unk40BE != 0) + { + if (a != 1 || gUnknown_0203CF1C->unk40BE < gUnknown_0203CF1C->unk40BF) + { + return gUnknown_0203CF1C->unk40BE + a; + } + } + return -1; + } + else + { + s8 r5r4 = gUnknown_0203CF1C->unk40BE; + while(1) + { + r5r4 += a; + if (r5r4 < 0 || r5r4 > gUnknown_0203CF1C->unk40BF) + return -1; + else if (GetMonData(&r7->mons[r5r4], MON_DATA_IS_EGG) == 0) + return r5r4; + } + } +} +#else +__attribute__((naked)) +s8 sub_81C08F8(s8 a) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + ldr r1, =gUnknown_0203CF1C\n\ + ldr r2, [r1]\n\ + ldr r7, [r2]\n\ + ldr r3, =0x000040c0\n\ + adds r0, r2, r3\n\ + ldrb r0, [r0]\n\ + adds r5, r1, 0\n\ + cmp r0, 0\n\ + bne _081C0960\n\ + lsls r0, r4, 24\n\ + asrs r3, r0, 24\n\ + movs r1, 0x1\n\ + negs r1, r1\n\ + adds r6, r0, 0\n\ + cmp r3, r1\n\ + bne _081C0928\n\ + ldr r1, =0x000040be\n\ + adds r0, r2, r1\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _081C0988\n\ +_081C0928:\n\ + asrs r0, r6, 24\n\ + cmp r0, 0x1\n\ + bne _081C0940\n\ + ldr r0, [r5]\n\ + ldr r2, =0x000040be\n\ + adds r1, r0, r2\n\ + ldr r3, =0x000040bf\n\ + adds r0, r3\n\ + ldrb r1, [r1]\n\ + ldrb r0, [r0]\n\ + cmp r1, r0\n\ + bcs _081C0988\n\ +_081C0940:\n\ + ldr r0, [r5]\n\ + ldr r1, =0x000040be\n\ + adds r0, r1\n\ + ldrb r0, [r0]\n\ + adds r0, r4\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + b _081C09AE\n\ + .pool\n\ +_081C0960:\n\ + ldr r3, =0x000040be\n\ + adds r0, r2, r3\n\ + ldrb r5, [r0]\n\ + lsls r6, r4, 24\n\ +_081C0968:\n\ + lsls r0, r5, 24\n\ + asrs r0, 24\n\ + asrs r1, r6, 24\n\ + adds r0, r1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + asrs r4, r0, 24\n\ + cmp r4, 0\n\ + blt _081C0988\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + ldr r1, =0x000040bf\n\ + adds r0, r1\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + ble _081C099C\n\ +_081C0988:\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + b _081C09AE\n\ + .pool\n\ +_081C099C:\n\ + movs r0, 0x64\n\ + muls r0, r4\n\ + adds r0, r7, r0\n\ + movs r1, 0x2D\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + bne _081C0968\n\ + adds r0, r4, 0\n\ +_081C09AE:\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + .syntax divided\n"); +} +#endif + +s8 sub_81C09B4(s8 a) +{ + union unkUnion* r8 = gUnknown_0203CF1C->unk0; + s8 r5 = 0; + u8 i = 0; + if (gUnknown_0861CC1C[0] != gUnknown_0203CF1C->unk40BE) + { + while(1) + { + i += 1; + if (i > 5) + break; + if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->unk40BE) + { + r5 = i; + break; + } + } + } + while(1) + { + int b; + s8* c = &gUnknown_0861CC1C[0]; + r5 += a; + if ((u8)(r5) > 5) + { + return -1; + } + else + { + b = c[r5]; + if (sub_81C0A50(&r8->mons[c[r5]]) == 1) + return b; + } + } +} + +u8 sub_81C0A50(struct Pokemon* mon) +{ + if (GetMonData(mon, MON_DATA_SPECIES) == 0) + { + return 0; + } + else if (gUnknown_0203CF1C->unk40BE != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0) + return 1; + else + return 0; +} \ No newline at end of file From 3d16b884b93323d2329bd9d805e3ac958311ef0a Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Fri, 22 Sep 2017 18:28:18 -0400 Subject: [PATCH 04/21] updated branch with fix --- src/pokemon_summary_screen.c | 347 +++++++---------------------------- 1 file changed, 62 insertions(+), 285 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 77d1d1b28d..d555b88342 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -99,6 +99,8 @@ s8 sub_81C08F8(s8 a); void sub_81C4204(u8 a, u8 b); void sub_81C20F0(u8 taskId); u8 sub_81C0A50(struct Pokemon* mon); +void sub_81C49E0(); +void sub_81C0E24(); u8 sub_81BFB10(); u8 sub_81B1250(); @@ -702,298 +704,73 @@ void sub_81C0604(u8 taskId, s8 a) } } -#ifdef NONMATCHING void sub_81C0704(u8 taskId) { s16 *data = gTasks[taskId].data; - + switch (data[0]) { - case 0: - StopCryAndClearCrySongs(); - data[0]++; - break; - case 1: - sub_81C4898(); - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3]); - data[0]++; - break; - case 2: - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D4]); - data[0]++; - break; - case 3: - sub_81C0098(&gUnknown_0203CF1C->currentPoke); - gUnknown_0203CF1C->unk40F0 = 0; - data[0]++; - break; - case 4: - if (sub_81C00F0(&gUnknown_0203CF1C->currentPoke)) - data[0]++; - break; - case 5: - sub_81C49E0(&gUnknown_0203CF1C->currentPoke); - data[0]++; - break; - case 6: - sub_81C4A08(&gUnknown_0203CF1C->currentPoke); - data[0]++; - break; - case 7: - if (gUnknown_0203CF1C->summary.unk7) - sub_81C2074(10, -2); - sub_81C2228(&gUnknown_0203CF1C->currentPoke); - data[1] = 0; - data[0]++; - break; - case 8: - gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentPoke, &data[1]); - if (gUnknown_0203CF1C->unk40D3 != 0xFF) - { - gSprites[gUnknown_0203CF1C->unk40D3].data2 = 1; - sub_81C0E24(); - data[1] = 0; - data[0]++; - } - break; - case 9: - sub_81C4280(); - data[0]++; - break; - case 10: - sub_81C25E8(); - data[0]++; - break; - case 11: - sub_81C2D9C(gUnknown_0203CF1C->unk40C0); - sub_81C2524(); - data[0]++; - break; - case 12: - gSprites[gUnknown_0203CF1C->unk40D3].data2 = 0; - data[0]++; - break; - case 13: - if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0) - { - TaskFunc *func; - data[0] = 0; - func = &gTasks[taskId].func; - *func = sub_81C0510; - } + case 0: + StopCryAndClearCrySongs(); + break; + case 1: + sub_81C4898(); + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3]); + break; + case 2: + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D4]); + break; + case 3: + sub_81C0098(&gUnknown_0203CF1C->currentPoke); + gUnknown_0203CF1C->unk40F0 = 0; + break; + case 4: + if (sub_81C00F0(&gUnknown_0203CF1C->currentPoke) == 0) + return; + break; + case 5: + sub_81C49E0(&gUnknown_0203CF1C->currentPoke); + break; + case 6: + sub_81C4A08(&gUnknown_0203CF1C->currentPoke); + break; + case 7: + if (gUnknown_0203CF1C->summary.unk7) + sub_81C2074(10, -2); + sub_81C2228(&gUnknown_0203CF1C->currentPoke); + data[1] = 0; + break; + case 8: + gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentPoke, &data[1]); + if (gUnknown_0203CF1C->unk40D3 == 0xFF) + return; + gSprites[gUnknown_0203CF1C->unk40D3].data2 = 1; + sub_81C0E24(); + data[1] = 0; + break; + case 9: + sub_81C4280(); + break; + case 10: + sub_81C25E8(); + break; + case 11: + sub_81C2D9C(gUnknown_0203CF1C->unk40C0); + sub_81C2524(); + break; + case 12: + gSprites[gUnknown_0203CF1C->unk40D3].data2 = 0; + break; + default: + if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0) + { + data[0] = 0; + gTasks[taskId].func = sub_81C0510; + } + return; } + data[0]++; } -#else -__attribute__((naked)) -void sub_81C0704(u8 taskId) -{ - asm(".syntax unified\n\ - push {r4-r6,lr}\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - lsls r1, r0, 2\n\ - adds r1, r0\n\ - lsls r4, r1, 3\n\ - ldr r6, =gTasks + 0x8\n\ - adds r5, r4, r6\n\ - movs r1, 0\n\ - ldrsh r0, [r5, r1]\n\ - cmp r0, 0xC\n\ - bls _081C071E\n\ - b _081C08BC\n\ -_081C071E:\n\ - lsls r0, 2\n\ - ldr r1, =_081C0730\n\ - adds r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ -_081C0730:\n\ - .4byte _081C0764\n\ - .4byte _081C076A\n\ - .4byte _081C0780\n\ - .4byte _081C07A8\n\ - .4byte _081C07C8\n\ - .4byte _081C07E0\n\ - .4byte _081C07F0\n\ - .4byte _081C0800\n\ - .4byte _081C0828\n\ - .4byte _081C086C\n\ - .4byte _081C0872\n\ - .4byte _081C0878\n\ - .4byte _081C0894\n\ -_081C0764:\n\ - bl StopCryAndClearCrySongs\n\ - b _081C08EC\n\ -_081C076A:\n\ - bl sub_81C4898\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - ldr r1, =0x000040d3\n\ - b _081C0786\n\ - .pool\n\ -_081C0780:\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - ldr r1, =0x000040d4\n\ -_081C0786:\n\ - adds r0, r1\n\ - ldrb r1, [r0]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - ldr r1, =gSprites\n\ - adds r0, r1\n\ - bl DestroySpriteAndFreeResources\n\ - b _081C08EC\n\ - .pool\n\ -_081C07A8:\n\ - ldr r4, =gUnknown_0203CF1C\n\ - ldr r0, [r4]\n\ - adds r0, 0xC\n\ - bl sub_81C0098\n\ - ldr r0, [r4]\n\ - ldr r1, =0x000040f0\n\ - adds r0, r1\n\ - movs r1, 0\n\ - strh r1, [r0]\n\ - b _081C08EC\n\ - .pool\n\ -_081C07C8:\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - adds r0, 0xC\n\ - bl sub_81C00F0\n\ - lsls r0, 24\n\ - cmp r0, 0\n\ - bne _081C07DA\n\ - b _081C08F2\n\ -_081C07DA:\n\ - b _081C08EC\n\ - .pool\n\ -_081C07E0:\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - adds r0, 0xC\n\ - bl sub_81C49E0\n\ - b _081C08EC\n\ - .pool\n\ -_081C07F0:\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - adds r0, 0xC\n\ - bl sub_81C4A08\n\ - b _081C08EC\n\ - .pool\n\ -_081C0800:\n\ - ldr r4, =gUnknown_0203CF1C\n\ - ldr r0, [r4]\n\ - adds r0, 0x77\n\ - ldrb r0, [r0]\n\ - cmp r0, 0\n\ - beq _081C0816\n\ - movs r1, 0x2\n\ - negs r1, r1\n\ - movs r0, 0xA\n\ - bl sub_81C2074\n\ -_081C0816:\n\ - ldr r0, [r4]\n\ - adds r0, 0xC\n\ - bl sub_81C2228\n\ - movs r0, 0\n\ - strh r0, [r5, 0x2]\n\ - b _081C08EC\n\ - .pool\n\ -_081C0828:\n\ - ldr r4, =gUnknown_0203CF1C\n\ - ldr r0, [r4]\n\ - adds r0, 0xC\n\ - adds r1, r5, 0x2\n\ - bl sub_81C45F4\n\ - ldr r1, [r4]\n\ - ldr r2, =0x000040d3\n\ - adds r1, r2\n\ - strb r0, [r1]\n\ - ldr r0, [r4]\n\ - adds r1, r0, r2\n\ - ldrb r0, [r1]\n\ - cmp r0, 0xFF\n\ - beq _081C08F2\n\ - ldr r2, =gSprites\n\ - adds r1, r0, 0\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r0, r2\n\ - movs r1, 0x1\n\ - strh r1, [r0, 0x32]\n\ - bl sub_81C0E24\n\ - movs r0, 0\n\ - strh r0, [r5, 0x2]\n\ - b _081C08EC\n\ - .pool\n\ -_081C086C:\n\ - bl sub_81C4280\n\ - b _081C08EC\n\ -_081C0872:\n\ - bl sub_81C25E8\n\ - b _081C08EC\n\ -_081C0878:\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - ldr r1, =0x000040c0\n\ - adds r0, r1\n\ - ldrb r0, [r0]\n\ - bl sub_81C2D9C\n\ - bl sub_81C2524\n\ - b _081C08EC\n\ - .pool\n\ -_081C0894:\n\ - ldr r2, =gSprites\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - ldr r1, =0x000040d3\n\ - adds r0, r1\n\ - ldrb r1, [r0]\n\ - lsls r0, r1, 4\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r0, r2\n\ - movs r1, 0\n\ - strh r1, [r0, 0x32]\n\ - b _081C08EC\n\ - .pool\n\ -_081C08BC:\n\ - bl sub_81221EC\n\ - lsls r0, 24\n\ - cmp r0, 0\n\ - bne _081C08F2\n\ - ldr r0, =sub_81C20F0\n\ - bl FuncIsActiveTask\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - cmp r0, 0\n\ - bne _081C08F2\n\ - strh r0, [r5]\n\ - adds r0, r6, 0\n\ - subs r0, 0x8\n\ - adds r0, r4, r0\n\ - ldr r1, =sub_81C0510\n\ - str r1, [r0]\n\ - b _081C08F2\n\ - .pool\n\ -_081C08EC:\n\ - ldrh r0, [r5]\n\ - adds r0, 0x1\n\ - strh r0, [r5]\n\ -_081C08F2:\n\ - pop {r4-r6}\n\ - pop {r0}\n\ - bx r0\n\ - .syntax divided\n"); -} -#endif #ifdef NONMATCHING s8 sub_81C08F8(s8 a) From 40eb03542bf2eec8944249474b880854691da6ac Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Sat, 23 Sep 2017 20:23:55 -0400 Subject: [PATCH 05/21] decompiled up to sub_81C1040 --- asm/pokemon_summary_screen.s | 650 ----------------------------------- src/pokemon_summary_screen.c | 432 +++++++++++++++-------- 2 files changed, 288 insertions(+), 794 deletions(-) diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index e337c8b27a..862fb3d5bf 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,656 +5,6 @@ .text - thumb_func_start sub_81C0A8C -sub_81C0A8C: @ 81C0A8C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - str r6, [sp] - lsls r1, 24 - lsrs r3, r1, 24 - str r3, [sp, 0x4] - ldr r0, =gUnknown_0203CF1C - mov r8, r0 - ldr r2, [r0] - adds r1, r2, 0 - adds r1, 0x70 - lsls r0, r6, 2 - adds r0, r6 - lsls r7, r0, 3 - ldr r0, =gTasks + 0x8 - mov r9, r0 - adds r0, r7, r0 - str r0, [sp, 0x8] - ldrb r1, [r1, 0x4] - mov r10, r1 - cmp r1, 0 - bne _081C0B6E - lsls r0, r3, 24 - asrs r5, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _081C0AE0 - ldr r1, =0x000040c0 - adds r0, r2, r1 - ldr r3, =0x000040c1 - adds r1, r2, r3 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - beq _081C0B6E -_081C0AE0: - cmp r5, 0x1 - bne _081C0AF4 - ldr r1, =0x000040c0 - adds r0, r2, r1 - ldr r3, =0x000040c2 - adds r1, r2, r3 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - beq _081C0B6E -_081C0AF4: - movs r0, 0x5 - bl PlaySE - mov r1, r8 - ldr r0, [r1] - ldr r4, =0x000040c0 - adds r0, r4 - ldrb r0, [r0] - bl sub_81C2C38 - mov r2, r8 - ldr r1, [r2] - adds r1, r4 - ldrb r0, [r1] - ldr r3, [sp, 0x4] - adds r0, r3 - strb r0, [r1] - mov r1, r10 - ldr r0, [sp, 0x8] - strh r1, [r0] - cmp r5, 0x1 - bne _081C0B4C - ldr r1, =sub_81C0B8C - mov r0, r9 - subs r0, 0x8 - adds r0, r7, r0 - ldr r2, [r0] - adds r0, r6, 0 - bl SetTaskFuncWithFollowupFunc - b _081C0B5C - .pool -_081C0B4C: - ldr r1, =sub_81C0CC4 - mov r0, r9 - subs r0, 0x8 - adds r0, r7, r0 - ldr r2, [r0] - ldr r0, [sp] - bl SetTaskFuncWithFollowupFunc -_081C0B5C: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x000040c0 - adds r0, r2 - ldrb r0, [r0] - bl sub_81C2DE4 - bl sub_81C424C -_081C0B6E: - 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_81C0A8C - - thumb_func_start sub_81C0B8C -sub_81C0B8C: @ 81C0B8C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081C0C2A - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r3, =0x000040c9 - adds r0, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0BE0 - movs r0, 0x1 - strh r0, [r4, 0x2] - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x1 - bl SetBgAttribute - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - b _081C0BFE - .pool -_081C0BE0: - movs r0, 0x2 - strh r0, [r4, 0x2] - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x1 - bl SetBgAttribute - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram -_081C0BFE: - ldrb r0, [r4, 0x2] - movs r1, 0 - movs r2, 0 - bl ChangeBgX - ldrb r0, [r4, 0x2] - ldr r1, =gUnknown_0203CF1C - ldr r1, [r1] - ldr r3, =0x000040c0 - adds r2, r1, r3 - ldrb r2, [r2] - lsls r2, 12 - adds r2, 0xBC - adds r1, r2 - bl SetBgTilemapBuffer - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg -_081C0C2A: - ldrb r0, [r4, 0x2] - movs r1, 0x80 - lsls r1, 6 - movs r2, 0x1 - bl ChangeBgX - ldrh r0, [r4] - adds r0, 0x20 - strh r0, [r4] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _081C0C52 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81C0C68 - str r0, [r1] -_081C0C52: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0B8C - - thumb_func_start sub_81C0C68 -sub_81C0C68: @ 81C0C68 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 3 - ldr r0, =gTasks + 0x8 - adds r2, r0 - ldr r5, =gUnknown_0203CF1C - ldr r3, [r5] - ldr r0, =0x000040c9 - adds r3, r0 - ldrb r0, [r3] - movs r1, 0x1 - eors r0, r1 - movs r1, 0 - strb r0, [r3] - strh r1, [r2, 0x2] - strh r1, [r2] - bl sub_81C1BA0 - ldr r0, [r5] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C2AFC - bl sub_81C4280 - bl sub_81C0E24 - adds r0, r4, 0 - bl SwitchTaskToFollowupFunc - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0C68 - - thumb_func_start sub_81C0CC4 -sub_81C0CC4: @ 81C0CC4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081C0D0C - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c9 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0CFC - movs r0, 0x2 - b _081C0CFE - .pool -_081C0CFC: - movs r0, 0x1 -_081C0CFE: - strh r0, [r4, 0x2] - ldrb r0, [r4, 0x2] - movs r1, 0x80 - lsls r1, 9 - movs r2, 0 - bl ChangeBgX -_081C0D0C: - ldrb r0, [r4, 0x2] - movs r1, 0x80 - lsls r1, 6 - movs r2, 0x2 - bl ChangeBgX - ldrh r0, [r4] - adds r0, 0x20 - strh r0, [r4] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _081C0D34 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81C0D44 - str r0, [r1] -_081C0D34: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0CC4 - - thumb_func_start sub_81C0D44 -sub_81C0D44: @ 81C0D44 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c9 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0D8C - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x1 - bl SetBgAttribute - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - b _081C0DA6 - .pool -_081C0D8C: - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x1 - bl SetBgAttribute - movs r0, 0x1 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram -_081C0DA6: - ldr r6, =gUnknown_0203CF1C - ldr r2, [r6] - ldr r7, =0x000040c0 - adds r1, r2, r7 - ldrb r0, [r1] - cmp r0, 0x1 - bls _081C0DD0 - ldrb r0, [r4, 0x2] - ldrb r1, [r1] - lsls r1, 12 - ldr r3, =0xfffff0bc - adds r1, r3 - adds r1, r2, r1 - bl SetBgTilemapBuffer - ldrb r0, [r4, 0x2] - movs r1, 0x80 - lsls r1, 9 - movs r2, 0 - bl ChangeBgX -_081C0DD0: - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - ldr r2, [r6] - ldr r0, =0x000040c9 - adds r2, r0 - ldrb r0, [r2] - movs r1, 0x1 - eors r0, r1 - movs r1, 0 - strb r0, [r2] - strh r1, [r4, 0x2] - strh r1, [r4] - bl sub_81C1BA0 - ldr r0, [r6] - adds r0, r7 - ldrb r0, [r0] - bl sub_81C2AFC - bl sub_81C4280 - bl sub_81C0E24 - adds r0, r5, 0 - bl SwitchTaskToFollowupFunc - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0D44 - - thumb_func_start sub_81C0E24 -sub_81C0E24: @ 81C0E24 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040c0 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081C0E3C - adds r0, r1, 0 - adds r0, 0xC - bl sub_81C22CC -_081C0E3C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0E24 - - thumb_func_start sub_81C0E48 -sub_81C0E48: @ 81C0E48 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r5, =gUnknown_0203CF1C - ldr r0, [r5] - ldr r2, =0x000040c6 - adds r0, r2 - movs r1, 0 - strb r1, [r0] - ldr r1, [r5] - adds r2, r1, r2 - ldrb r0, [r2] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r6, [r1] - mov r8, r6 - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r0, [r5] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C0E96 - movs r0, 0xD - bl ClearWindowTilemap -_081C0E96: - movs r4, 0x3 - negs r4, r4 - movs r0, 0x9 - adds r1, r4, 0 - bl sub_81C1DA4 - movs r0, 0x9 - adds r1, r4, 0 - adds r2, r6, 0 - bl sub_81C1EFC - ldr r0, [r5] - ldr r1, =0x000040c8 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C0EC4 - movs r0, 0x5 - bl ClearWindowTilemap - movs r0, 0x6 - bl PutWindowTilemap -_081C0EC4: - ldr r0, [r5] - ldr r1, =0x000020bc - adds r0, r1 - movs r1, 0x3 - movs r2, 0 - bl sub_81C2194 - ldr r0, [r5] - ldr r1, =0x000030bc - adds r0, r1 - movs r1, 0x1 - movs r2, 0 - bl sub_81C2194 - mov r0, r8 - bl sub_81C3E9C - bl sub_81C3F44 - bl sub_81C44F0 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x8 - bl sub_81C4AF8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C0F44 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C0E48 - - thumb_func_start sub_81C0F44 -sub_81C0F44: @ 81C0F44 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C103A - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081C0F98 - movs r0, 0x4 - strh r0, [r4] - movs r1, 0x1 - negs r1, r1 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r2, r0 - adds r0, r4, 0 - bl sub_81C1070 - b _081C103A - .pool -_081C0F98: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081C0FC0 - movs r0, 0x4 - strh r0, [r4] - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C1070 - b _081C103A - .pool -_081C0FC0: - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081C1026 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040c8 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C0FE8 - subs r2, 0x4 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - bne _081C1004 -_081C0FE8: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81C11F4 - b _081C103A - .pool -_081C1004: - bl sub_81C1040 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C101E - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81C129C - b _081C103A -_081C101E: - movs r0, 0x20 - bl PlaySE - b _081C103A -_081C1026: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C103A - movs r0, 0x5 - bl PlaySE - adds r0, r6, 0 - bl sub_81C11F4 -_081C103A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81C0F44 - - thumb_func_start sub_81C1040 -sub_81C1040: @ 81C1040 - push {lr} - movs r1, 0x1 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r2, r0, 0 - adds r2, 0x84 -_081C104C: - lsls r0, r1, 1 - adds r0, r2, r0 - ldrh r0, [r0] - cmp r0, 0 - beq _081C1060 - movs r0, 0x1 - b _081C106C - .pool -_081C1060: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _081C104C - movs r0, 0 -_081C106C: - pop {r1} - bx r1 - thumb_func_end sub_81C1040 - thumb_func_start sub_81C1070 sub_81C1070: @ 81C1070 push {r4-r7,lr} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index d555b88342..9c4647cf05 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -78,8 +78,8 @@ 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_81C1DA4(u8 a, s16 b); +void sub_81C1EFC(u8 a, s16 b, u16 c); void sub_81C240C(u16 a); void sub_81C2194(void* a, u8 b, u8 c); void sub_81C2074(u16 a, s16 b); @@ -101,6 +101,26 @@ void sub_81C20F0(u8 taskId); u8 sub_81C0A50(struct Pokemon* mon); void sub_81C49E0(); void sub_81C0E24(); +void sub_81C2C38(); +void sub_81C0B8C(u8 taskId); +void sub_81C0CC4(u8 taskId); +void sub_81C2DE4(u8 a); +void sub_81C424C(); +void sub_81C0C68(u8 taskId); +void sub_81C0D44(u8 taskId); +void sub_81C22CC(struct Pokemon* mon); +void sub_81C0F44(u8 taskId); +void sub_81C3E9C(u16 a); +void sub_81C3F44(); +void sub_81C44F0(); +void sub_81C4AF8(u8 a); +void sub_81C1070(s16* a, s8 b, u8* c); +void sub_81C11F4(u8 a); +void sub_81C129C(u8 a); +u8 sub_81C1040(); + + +void SetBgAttribute(u8 bg, u8 attributeId, u8 value); u8 sub_81BFB10(); u8 sub_81B1250(); @@ -110,6 +130,8 @@ union unkUnion{ struct BoxPokemon boxMons[6]; }; + + u8 sub_80D214C(union unkUnion* a, u8 b, u8 c, u8 d); struct pokeSummary{ @@ -167,14 +189,23 @@ struct unkSummaryStruct{ u8 unk40C1; u8 unk40C2; u8 unk40C3; - u16 unk40C4; - u8 unk40C6; - u8 unk_filler3; + union +{ + struct + { + u16 unk40C4; + u8 unk40C6; + u8 unkfiller3; + } fooFiller; + u32 loadThis; +} unionThing; u8 unk40C8; - u8 unk_filler2[0xA]; + u8 unk40C9; + u8 unk_filler2[0x9]; u8 unk40D3; u8 unk40D4; - u8 unk_filler5[0x1A]; + u8 unk40D5; + u8 unk_filler5[0x19]; u8 unk40EF; s16 unk40F0; u8 unk_filler4[6]; @@ -222,7 +253,7 @@ void sub_81BF8EC(u8 a, void* b, u8 c, u8 d, void* e) void sub_81BFA38(void* a, u8 b, u8 c, void* d, u16 e) { sub_81BF8EC(3, a, b, c, d); - gUnknown_0203CF1C->unk40C4 = e; + gUnknown_0203CF1C->unionThing.fooFiller.unk40C4 = e; } void sub_81BFA80(u8 a, void* b, u8 c, u8 d, void* e) @@ -563,7 +594,7 @@ void sub_81C0348() } else { - sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); + sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unionThing.fooFiller.unk40C6]); sub_81C2194(&gUnknown_0203CF1C->unkTilemap2, 3, 0); sub_81C2194(&gUnknown_0203CF1C->unkTilemap3, 1, 0); SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap3); @@ -772,164 +803,58 @@ void sub_81C0704(u8 taskId) data[0]++; } -#ifdef NONMATCHING s8 sub_81C08F8(s8 a) { - union unkUnion* r7 = gUnknown_0203CF1C->unk0; + struct Pokemon *mons = gUnknown_0203CF1C->unk0->mons; + if (gUnknown_0203CF1C->unk40C0 == 0) { - if (a != -1 || gUnknown_0203CF1C->unk40BE != 0) - { - if (a != 1 || gUnknown_0203CF1C->unk40BE < gUnknown_0203CF1C->unk40BF) - { - return gUnknown_0203CF1C->unk40BE + a; - } - } - return -1; + if (a == -1 && gUnknown_0203CF1C->unk40BE == 0) + return -1; + if (a == 1 && gUnknown_0203CF1C->unk40BE >= gUnknown_0203CF1C->unk40BF) + return -1; + return gUnknown_0203CF1C->unk40BE + a; } else { - s8 r5r4 = gUnknown_0203CF1C->unk40BE; - while(1) + s8 index = gUnknown_0203CF1C->unk40BE; + + do { - r5r4 += a; - if (r5r4 < 0 || r5r4 > gUnknown_0203CF1C->unk40BF) + index += a; + if (index < 0 || index > gUnknown_0203CF1C->unk40BF) return -1; - else if (GetMonData(&r7->mons[r5r4], MON_DATA_IS_EGG) == 0) - return r5r4; - } + } while (GetMonData(&mons[index], MON_DATA_IS_EGG) != 0); + return index; } } -#else -__attribute__((naked)) -s8 sub_81C08F8(s8 a) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - lsls r0, 24\n\ - lsrs r4, r0, 24\n\ - ldr r1, =gUnknown_0203CF1C\n\ - ldr r2, [r1]\n\ - ldr r7, [r2]\n\ - ldr r3, =0x000040c0\n\ - adds r0, r2, r3\n\ - ldrb r0, [r0]\n\ - adds r5, r1, 0\n\ - cmp r0, 0\n\ - bne _081C0960\n\ - lsls r0, r4, 24\n\ - asrs r3, r0, 24\n\ - movs r1, 0x1\n\ - negs r1, r1\n\ - adds r6, r0, 0\n\ - cmp r3, r1\n\ - bne _081C0928\n\ - ldr r1, =0x000040be\n\ - adds r0, r2, r1\n\ - ldrb r0, [r0]\n\ - cmp r0, 0\n\ - beq _081C0988\n\ -_081C0928:\n\ - asrs r0, r6, 24\n\ - cmp r0, 0x1\n\ - bne _081C0940\n\ - ldr r0, [r5]\n\ - ldr r2, =0x000040be\n\ - adds r1, r0, r2\n\ - ldr r3, =0x000040bf\n\ - adds r0, r3\n\ - ldrb r1, [r1]\n\ - ldrb r0, [r0]\n\ - cmp r1, r0\n\ - bcs _081C0988\n\ -_081C0940:\n\ - ldr r0, [r5]\n\ - ldr r1, =0x000040be\n\ - adds r0, r1\n\ - ldrb r0, [r0]\n\ - adds r0, r4\n\ - lsls r0, 24\n\ - asrs r0, 24\n\ - b _081C09AE\n\ - .pool\n\ -_081C0960:\n\ - ldr r3, =0x000040be\n\ - adds r0, r2, r3\n\ - ldrb r5, [r0]\n\ - lsls r6, r4, 24\n\ -_081C0968:\n\ - lsls r0, r5, 24\n\ - asrs r0, 24\n\ - asrs r1, r6, 24\n\ - adds r0, r1\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - asrs r4, r0, 24\n\ - cmp r4, 0\n\ - blt _081C0988\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - ldr r1, =0x000040bf\n\ - adds r0, r1\n\ - ldrb r0, [r0]\n\ - cmp r4, r0\n\ - ble _081C099C\n\ -_081C0988:\n\ - movs r0, 0x1\n\ - negs r0, r0\n\ - b _081C09AE\n\ - .pool\n\ -_081C099C:\n\ - movs r0, 0x64\n\ - muls r0, r4\n\ - adds r0, r7, r0\n\ - movs r1, 0x2D\n\ - bl GetMonData\n\ - cmp r0, 0\n\ - bne _081C0968\n\ - adds r0, r4, 0\n\ -_081C09AE:\n\ - pop {r4-r7}\n\ - pop {r1}\n\ - bx r1\n\ - .syntax divided\n"); -} -#endif s8 sub_81C09B4(s8 a) { - union unkUnion* r8 = gUnknown_0203CF1C->unk0; + struct Pokemon *mons = gUnknown_0203CF1C->unk0->mons; s8 r5 = 0; - u8 i = 0; - if (gUnknown_0861CC1C[0] != gUnknown_0203CF1C->unk40BE) + u8 i; + + for (i = 0; i < 6; i++) { - while(1) + if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->unk40BE) { - i += 1; - if (i > 5) - break; - if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->unk40BE) - { - r5 = i; - break; - } + r5 = i; + break; } } - while(1) + + while (1) { int b; s8* c = &gUnknown_0861CC1C[0]; + r5 += a; - if ((u8)(r5) > 5) - { + if (r5 < 0 || r5 >= 6) return -1; - } - else - { - b = c[r5]; - if (sub_81C0A50(&r8->mons[c[r5]]) == 1) - return b; - } + b = c[r5]; + if (sub_81C0A50(&mons[b]) == 1) + return b; } } @@ -943,4 +868,223 @@ u8 sub_81C0A50(struct Pokemon* mon) return 1; else return 0; -} \ No newline at end of file +} + +void sub_81C0A8C(u8 taskId, s8 b) +{ + struct pokeSummary *summary = &gUnknown_0203CF1C->summary; + s16 *data = gTasks[taskId].data; + + if (summary->isEgg) + return; + if (b == -1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C1) + return; + if (b == 1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C2) + return; + PlaySE(SE_SELECT); + sub_81C2C38(gUnknown_0203CF1C->unk40C0); + gUnknown_0203CF1C->unk40C0 += b; + data[0] = 0; + if (b == 1) + SetTaskFuncWithFollowupFunc(taskId, sub_81C0B8C, gTasks[taskId].func); + else + SetTaskFuncWithFollowupFunc(taskId, sub_81C0CC4, gTasks[taskId].func); + sub_81C2DE4(gUnknown_0203CF1C->unk40C0); + sub_81C424C(); +} + +void sub_81C0B8C(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + if (data[0] == 0) + { + if (gUnknown_0203CF1C->unk40C9 == 0) + { + data[1] = 1; + SetBgAttribute(1, 7, 1); + SetBgAttribute(2, 7, 2); + schedule_bg_copy_tilemap_to_vram(1); + } + else + { + data[1] = 2; + SetBgAttribute(2, 7, 1); + SetBgAttribute(1, 7, 2); + schedule_bg_copy_tilemap_to_vram(2); + } + ChangeBgX(data[1], 0, 0); + SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->unk40C0 << 12) + 0xBC)); + ShowBg(1); + ShowBg(2); + } + ChangeBgX(data[1], 0x2000, 1); + data[0] += 32; + if (data[0] > 0xFF) + { + gTasks[taskId].func = sub_81C0C68; + } +} + +void sub_81C0C68(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + gUnknown_0203CF1C->unk40C9 ^= 1; + data[1] = 0; + data[0] = 0; + sub_81C1BA0(); + sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + sub_81C4280(); + sub_81C0E24(); + SwitchTaskToFollowupFunc(taskId); +} + +void sub_81C0CC4(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + if (data[0] == 0) + { + if (gUnknown_0203CF1C->unk40C9 == 0) + data[1] = 2; + else + data[1] = 1; + ChangeBgX(data[1], 0x10000, 0); + } + ChangeBgX(data[1], 0x2000, 2); + data[0] += 32; + if (data[0] > 0xFF) + gTasks[taskId].func = sub_81C0D44; +} + +void sub_81C0D44(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + if (gUnknown_0203CF1C->unk40C9 == 0) + { + SetBgAttribute(1, 7, 1); + SetBgAttribute(2, 7, 2); + schedule_bg_copy_tilemap_to_vram(2); + } + else + { + SetBgAttribute(2, 7, 1); + SetBgAttribute(1, 7, 2); + schedule_bg_copy_tilemap_to_vram(1); + } + if (gUnknown_0203CF1C->unk40C0 > 1) + { + SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->unk40C0 << 12) + 0xFFFFF0BC)); + ChangeBgX(data[1], 0x10000, 0); + } + ShowBg(1); + ShowBg(2); + gUnknown_0203CF1C->unk40C9 ^= 1; + data[1] = 0; + data[0] = 0; + sub_81C1BA0(); + sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + sub_81C4280(); + sub_81C0E24(); + SwitchTaskToFollowupFunc(taskId); +} + +void sub_81C0E24() +{ + if (gUnknown_0203CF1C->unk40C0 == 1) + sub_81C22CC(&gUnknown_0203CF1C->currentPoke); +} + +void sub_81C0E48(u8 taskId) +{ + u16 move; + gUnknown_0203CF1C->unionThing.fooFiller.unk40C6 = 0; + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unionThing.fooFiller.unk40C6]; + ClearWindowTilemap(0x13); + if (gSprites[gUnknown_0203CF1C->unk40D5].invisible == 0) + ClearWindowTilemap(0xD); + sub_81C1DA4(9, -3); + sub_81C1EFC(9, -3, move); + if (gUnknown_0203CF1C->unk40C8 == 0) + { + ClearWindowTilemap(5); + PutWindowTilemap(6); + } + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2, 3, 0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3, 1, 0); + sub_81C3E9C(move); + sub_81C3F44(); + sub_81C44F0(); + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + sub_81C4AF8(8); + gTasks[taskId].func = sub_81C0F44; +} + +void sub_81C0F44(u8 taskId) +{ + u8 id = taskId; + s16 *data = gTasks[taskId].data; + if (sub_81221EC() != 1) + { + if (gMain.newKeys & DPAD_UP) + { + data[0] = 4; + sub_81C1070(data, -1, &gUnknown_0203CF1C->unionThing.fooFiller.unk40C6); + } + else if (gMain.newKeys & DPAD_DOWN) + { + data[0] = 4; + sub_81C1070(data, 1, &gUnknown_0203CF1C->unionThing.fooFiller.unk40C6); + } + else if (gMain.newKeys & A_BUTTON) + { + if (gUnknown_0203CF1C->unk40C8 == 1 || ((int)(gUnknown_0203CF1C->unionThing.loadThis & 0xFFFFFF) == 0x40000)) + { + PlaySE(SE_SELECT); + sub_81C11F4(taskId); + } + else if (sub_81C1040() == 1) + { + PlaySE(SE_SELECT); + sub_81C129C(taskId); + } + else + PlaySE(0x20); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + sub_81C11F4(id); + } + } +} + +u8 sub_81C1040() +{ + u8 i; + for (i = 1; i <= 3; i++) + { + if (gUnknown_0203CF1C->summary.moves[i] != 0) + return 1; + } + return 0; +} + +/* void sub_81C1070(s16* a, s8 b, u8* c) +{ + s8 i; + s8 d = c*; + PlaySE(SE_SELECT); + i = 0; + while (i <= 3) + { + d += b + if (d > a[0]) + d = 0; + else if (d < 0) + d = data[0]; + if (d == 4) + break; + + } +} */ \ No newline at end of file From 0a88d1042a80bcc703d05f1cf19527272424a03f Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Tue, 3 Oct 2017 15:42:28 -0400 Subject: [PATCH 06/21] decompiled up to sub_81C13B0 --- asm/pokemon_summary_screen.s | 475 -------------------- src/pokemon_summary_screen.c | 833 +++++++++++++++++++++-------------- 2 files changed, 502 insertions(+), 806 deletions(-) diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 862fb3d5bf..7f1a1e48f9 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,481 +5,6 @@ .text - thumb_func_start sub_81C1070 -sub_81C1070: @ 81C1070 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - adds r4, r1, 0 - mov r8, r2 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - mov r0, r8 - ldrb r6, [r0] - movs r2, 0 - lsls r4, 24 - asrs r4, 24 - mov r12, r4 - movs r1, 0 - ldrsh r4, [r7, r1] - ldrb r0, [r7] - lsls r3, r0, 24 -_081C109C: - lsls r0, r6, 24 - asrs r0, 24 - add r0, r12 - lsls r0, 24 - lsrs r6, r0, 24 - asrs r0, 24 - cmp r0, r4 - ble _081C10B0 - movs r6, 0 - b _081C10B6 -_081C10B0: - cmp r0, 0 - bge _081C10B6 - lsrs r6, r3, 24 -_081C10B6: - lsls r0, r6, 24 - asrs r1, r0, 24 - mov r9, r0 - cmp r1, 0x4 - bne _081C10C2 - b _081C11CC -_081C10C2: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - lsls r1, 1 - adds r0, 0x84 - adds r0, r1 - ldrh r5, [r0] - cmp r5, 0 - bne _081C10E2 - lsls r0, r2, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, 0x3 - ble _081C109C -_081C10E2: - adds r0, r5, 0 - bl sub_81C240C - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r5, 0 - bl sub_81C3E9C - mov r1, r8 - ldrb r0, [r1] - cmp r0, 0x4 - bne _081C1110 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c4 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _081C1118 -_081C1110: - movs r1, 0x2 - ldrsh r0, [r7, r1] - cmp r0, 0x1 - bne _081C115E -_081C1118: - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1142 - movs r0, 0xD - bl ClearWindowTilemap -_081C1142: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r4, 0x3 - negs r4, r4 - movs r0, 0x9 - adds r1, r4, 0 - bl sub_81C1DA4 - movs r0, 0x9 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_81C1EFC -_081C115E: - mov r1, r8 - ldrb r0, [r1] - cmp r0, 0x4 - beq _081C11A0 - mov r1, r9 - asrs r0, r1, 24 - cmp r0, 0x4 - bne _081C11A0 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c4 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - bne _081C11A0 - movs r0, 0xE - bl ClearWindowTilemap - movs r0, 0xF - bl ClearWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0 - movs r1, 0x3 - bl sub_81C1DA4 - movs r0, 0 - movs r1, 0x3 - movs r2, 0 - bl sub_81C1EFC -_081C11A0: - mov r0, r8 - strb r6, [r0] - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c6 - adds r0, r1 - cmp r8, r0 - bne _081C11E0 - movs r0, 0x8 - bl sub_81C4D18 - b _081C11E6 - .pool -_081C11CC: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c4 - adds r0, r1 - ldrh r5, [r0] - b _081C10E2 - .pool -_081C11E0: - movs r0, 0x12 - bl sub_81C4D18 -_081C11E6: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C1070 - - thumb_func_start sub_81C11F4 -sub_81C11F4: @ 81C11F4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0x8 - bl sub_81C4C60 - movs r0, 0x6 - bl ClearWindowTilemap - movs r0, 0x5 - bl PutWindowTilemap - movs r0, 0 - bl sub_81C3E9C - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000020bc - adds r0, r1 - movs r1, 0x3 - movs r2, 0x1 - bl sub_81C2194 - ldr r0, [r4] - ldr r1, =0x000030bc - adds r0, r1 - movs r1, 0x1 - movs r2, 0x1 - bl sub_81C2194 - bl sub_81C4064 - ldr r0, [r4] - ldr r1, =0x000040c6 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x4 - beq _081C125E - movs r0, 0xE - bl ClearWindowTilemap - movs r0, 0xF - bl ClearWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl sub_81C1DA4 - movs r0, 0 - movs r1, 0x3 - movs r2, 0 - bl sub_81C1EFC -_081C125E: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81C0510 - str r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C11F4 - - thumb_func_start sub_81C129C -sub_81C129C: @ 81C129C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x000040c6 - adds r1, r0, r2 - ldrb r1, [r1] - adds r2, 0x1 - adds r0, r2 - strb r1, [r0] - movs r0, 0x1 - bl sub_81C4C84 - movs r0, 0x12 - bl sub_81C4AF8 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C12E4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C129C - - thumb_func_start sub_81C12E4 -sub_81C12E4: @ 81C12E4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C13AA - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081C1338 - movs r0, 0x3 - strh r0, [r4] - movs r1, 0x1 - negs r1, r1 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c7 - adds r2, r0 - adds r0, r4, 0 - bl sub_81C1070 - b _081C13AA - .pool -_081C1338: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081C1360 - movs r0, 0x3 - strh r0, [r4] - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c7 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C1070 - b _081C13AA - .pool -_081C1360: - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081C139A - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x000040c6 - adds r1, r0, r2 - adds r2, 0x1 - adds r0, r2 - ldrb r1, [r1] - ldrb r0, [r0] - cmp r1, r0 - bne _081C1390 - adds r0, r5, 0 - movs r1, 0 - bl sub_81C13B0 - b _081C13AA - .pool -_081C1390: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81C13B0 - b _081C13AA -_081C139A: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C13AA - adds r0, r6, 0 - movs r1, 0 - bl sub_81C13B0 -_081C13AA: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81C12E4 - - thumb_func_start sub_81C13B0 -sub_81C13B0: @ 81C13B0 - push {r4-r7,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl sub_81C4C84 - movs r0, 0x12 - bl sub_81C4C60 - cmp r4, 0x1 - bne _081C1464 - ldr r0, =gUnknown_0203CF1C - ldr r3, [r0] - ldr r1, =0x000040bd - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081C1410 - ldr r0, [r3] - ldr r2, =0x000040be - adds r1, r3, r2 - ldrb r2, [r1] - movs r1, 0x64 - muls r1, r2 - adds r0, r1 - ldr r4, =0x000040c6 - adds r1, r3, r4 - ldrb r1, [r1] - adds r4, 0x1 - adds r2, r3, r4 - ldrb r2, [r2] - bl sub_81C14BC - b _081C1430 - .pool -_081C1410: - ldr r0, [r3] - ldr r2, =0x000040be - adds r1, r3, r2 - ldrb r2, [r1] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 4 - adds r0, r1 - ldr r4, =0x000040c6 - adds r1, r3, r4 - ldrb r1, [r1] - adds r4, 0x1 - adds r2, r3, r4 - ldrb r2, [r2] - bl sub_81C15EC -_081C1430: - ldr r5, =gUnknown_0203CF1C - ldr r0, [r5] - adds r0, 0xC - bl sub_81C0098 - ldr r1, [r5] - ldr r6, =0x000040c6 - adds r0, r1, r6 - ldrb r0, [r0] - ldr r4, =0x000040c7 - adds r1, r4 - ldrb r1, [r1] - bl sub_81C40A0 - ldr r1, [r5] - adds r0, r1, r6 - ldrb r0, [r0] - adds r1, r4 - ldrb r1, [r1] - bl sub_81C4568 - ldr r0, [r5] - adds r4, r0, r4 - ldrb r1, [r4] - adds r0, r6 - strb r1, [r0] -_081C1464: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040c6 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r4, [r1] - adds r0, r4, 0 - bl sub_81C3E9C - adds r0, r4, 0 - bl sub_81C240C - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C0F44 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C13B0 - thumb_func_start sub_81C14BC sub_81C14BC: @ 81C14BC push {r4-r7,lr} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 9c4647cf05..5499706249 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -18,6 +18,7 @@ extern struct BgTemplate gUnknown_0861CBB4; extern u8 gUnknown_0203CF20; extern struct MusicPlayerInfo gMPlay_BGM; extern s8 gUnknown_0861CC1C[]; +extern u8 gUnknown_08329D22[]; extern void sub_806F2AC(u8 a, u8 b); void sub_81C488C(u8 a); @@ -61,7 +62,7 @@ u8 sub_81BFEB0(); void sub_81C2554(); void sub_81C1BA0(); void sub_81C0098(struct Pokemon* a); -u8 sub_81C00F0(struct Pokemon* a); +bool8 sub_81C00F0(struct Pokemon* a); void sub_81C25E8(); void sub_81C286C(); void sub_81C2D9C(u8 a); @@ -98,7 +99,7 @@ s8 sub_81C09B4(s8 a); s8 sub_81C08F8(s8 a); void sub_81C4204(u8 a, u8 b); void sub_81C20F0(u8 taskId); -u8 sub_81C0A50(struct Pokemon* mon); +bool8 sub_81C0A50(struct Pokemon* mon); void sub_81C49E0(); void sub_81C0E24(); void sub_81C2C38(); @@ -117,24 +118,33 @@ void sub_81C4AF8(u8 a); void sub_81C1070(s16* a, s8 b, u8* c); void sub_81C11F4(u8 a); void sub_81C129C(u8 a); -u8 sub_81C1040(); - +bool8 sub_81C1040(); +void sub_81C4064(); +void sub_81C4C60(u8 a); +void sub_81C12E4(u8 taskId); +void sub_81C4C84(u8 a); +void sub_81C13B0(u8 a, u8 b); +void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b); +void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); +void sub_81C40A0(u8 a, u8 b); +void sub_81C4568(u8 a, u8 b); void SetBgAttribute(u8 bg, u8 attributeId, u8 value); -u8 sub_81BFB10(); +bool8 sub_81BFB10(); u8 sub_81B1250(); -union unkUnion{ +union unkUnion +{ struct Pokemon mons[6]; struct BoxPokemon boxMons[6]; }; - u8 sub_80D214C(union unkUnion* a, u8 b, u8 c, u8 d); -struct pokeSummary{ +struct pokeSummary +{ u16 species; // 0x0 u16 species2; // 0x2 u8 isEgg; // 0x4 @@ -167,12 +177,13 @@ struct pokeSummary{ u32 OTID; // 0x48 }; -struct unkSummaryStruct{ - union unkUnion* unk0; - void* unk4; - void* unk8; - struct Pokemon currentPoke; - struct pokeSummary summary; +struct unkSummaryStruct +{ + /*0x00*/ union unkUnion *unk0; + /*0x04*/ void *unk4; + /*0x08*/ void *unk8; + /*0x0C*/ struct Pokemon currentPoke; + /*0x70*/ struct pokeSummary summary; u8 unkTilemap0[0x800]; u8 unkTilemap0_1[0x800]; u8 unkTilemap1[0x800]; @@ -189,16 +200,9 @@ struct unkSummaryStruct{ u8 unk40C1; u8 unk40C2; u8 unk40C3; - union -{ - struct - { - u16 unk40C4; - u8 unk40C6; - u8 unkfiller3; - } fooFiller; - u32 loadThis; -} unionThing; + u16 unk40C4; + u8 unk40C6; + u8 unk40C7; u8 unk40C8; u8 unk40C9; u8 unk_filler2[0x9]; @@ -211,7 +215,7 @@ struct unkSummaryStruct{ u8 unk_filler4[6]; }; -void sub_81BF8EC(u8 a, void* b, u8 c, u8 d, void* e) +void sub_81BF8EC(u8 a, void *b, u8 c, u8 d, void *e) { u8 byte; gUnknown_0203CF1C = AllocZeroed(0x40F8); @@ -226,21 +230,21 @@ void sub_81BF8EC(u8 a, void* b, u8 c, u8 d, void* e) 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; + 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; @@ -250,13 +254,13 @@ void sub_81BF8EC(u8 a, void* b, u8 c, u8 d, void* e) SetMainCallback2(sub_81BFAE4); } -void sub_81BFA38(void* a, u8 b, u8 c, void* d, u16 e) +void sub_81BFA38(void *a, u8 b, u8 c, void *d, u16 e) { sub_81BF8EC(3, a, b, c, d); - gUnknown_0203CF1C->unionThing.fooFiller.unk40C4 = e; + gUnknown_0203CF1C->unk40C4 = e; } -void sub_81BFA80(u8 a, void* b, u8 c, u8 d, void* 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; @@ -280,138 +284,138 @@ void sub_81BFAD0(void) void sub_81BFAE4() { - while(1) + while (1) { - if (sub_81221EC() == 1 || sub_81BFB10() == 1 || sub_81221AC() == 1) + if (sub_81221EC() == 1 || sub_81BFB10() == TRUE || sub_81221AC() == 1) break; } } -u8 sub_81BFB10() +bool8 sub_81BFB10(void) { - switch (gMain.state) + 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) { - 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; + gUnknown_0203CF1C->unk40F0 = 0; + gMain.state++; } - return 0; + 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 TRUE; + } + return FALSE; } void sub_81BFE24() @@ -437,68 +441,68 @@ 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); + 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 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; + } + 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; } -void sub_81C0098(struct Pokemon* poke) +void sub_81C0098(struct Pokemon *poke) { if (gUnknown_0203CF1C->unk40BD == 0) { @@ -512,89 +516,87 @@ void sub_81C0098(struct Pokemon* poke) } } -u8 sub_81C00F0(struct Pokemon* a) +bool8 sub_81C00F0(struct Pokemon *a) { u32 i; - struct pokeSummary* sum = &gUnknown_0203CF1C->summary; + 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; + 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 TRUE; } gUnknown_0203CF1C->unk40F0++; - return 0; + return FALSE; } -void sub_81C0348() +void sub_81C0348(void) { - u8 a = gUnknown_0203CF1C->unk40C0 - 2; - if (a > 1) + if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) { sub_81C1DA4(0, 255); sub_81C1EFC(0, 255, 0); } else { - sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unionThing.fooFiller.unk40C6]); + 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); @@ -604,11 +606,12 @@ void sub_81C0348() ClearWindowTilemap(0xD); } if (gUnknown_0203CF1C->summary.unk7 == 0) + { sub_81C2074(0, 0xFF); + } else { - u8 b = gUnknown_0203CF1C->unk40C0 - 2; - if (b > 1) + if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) PutWindowTilemap(0xD); } sub_81C2524(); @@ -629,7 +632,7 @@ void sub_81C044C(u8 taskId) void sub_81C0484(u8 taskId) { - if (sub_81221EC() != 1 && gPaletteFade.active == 0) + if (sub_81221EC() != 1 && !gPaletteFade.active) { SetMainCallback2(gUnknown_0203CF1C->unk4); gUnknown_0203CF20 = gUnknown_0203CF1C->unk40BE; @@ -647,18 +650,24 @@ void sub_81C0484(u8 taskId) void sub_81C0510(u8 taskId) { - if (sub_81221EC() != 1 && gPaletteFade.active == 0) + if (sub_81221EC() != 1 && !gPaletteFade.active) { 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) @@ -666,12 +675,12 @@ void sub_81C0510(u8 taskId) if (gUnknown_0203CF1C->unk40C0 == 0) { sub_81C48F0(); - PlaySE(5); + PlaySE(SE_SELECT); sub_81C044C(taskId); } else { - PlaySE(5); + PlaySE(SE_SELECT); sub_81C0E48(taskId); } } @@ -679,7 +688,7 @@ void sub_81C0510(u8 taskId) else if (gMain.newKeys & B_BUTTON) { sub_81C48F0(); - PlaySE(5); + PlaySE(SE_SELECT); sub_81C044C(taskId); } } @@ -756,7 +765,7 @@ void sub_81C0704(u8 taskId) gUnknown_0203CF1C->unk40F0 = 0; break; case 4: - if (sub_81C00F0(&gUnknown_0203CF1C->currentPoke) == 0) + if (sub_81C00F0(&gUnknown_0203CF1C->currentPoke) == FALSE) return; break; case 5: @@ -853,21 +862,19 @@ s8 sub_81C09B4(s8 a) if (r5 < 0 || r5 >= 6) return -1; b = c[r5]; - if (sub_81C0A50(&mons[b]) == 1) + if (sub_81C0A50(&mons[b]) == TRUE) return b; } } -u8 sub_81C0A50(struct Pokemon* mon) +bool8 sub_81C0A50(struct Pokemon* mon) { if (GetMonData(mon, MON_DATA_SPECIES) == 0) - { - return 0; - } + return FALSE; else if (gUnknown_0203CF1C->unk40BE != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0) - return 1; + return TRUE; else - return 0; + return FALSE; } void sub_81C0A8C(u8 taskId, s8 b) @@ -920,9 +927,7 @@ void sub_81C0B8C(u8 taskId) ChangeBgX(data[1], 0x2000, 1); data[0] += 32; if (data[0] > 0xFF) - { gTasks[taskId].func = sub_81C0C68; - } } void sub_81C0C68(u8 taskId) @@ -996,8 +1001,8 @@ void sub_81C0E24() void sub_81C0E48(u8 taskId) { u16 move; - gUnknown_0203CF1C->unionThing.fooFiller.unk40C6 = 0; - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unionThing.fooFiller.unk40C6]; + gUnknown_0203CF1C->unk40C6 = 0; + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; ClearWindowTilemap(0x13); if (gSprites[gUnknown_0203CF1C->unk40D5].invisible == 0) ClearWindowTilemap(0xD); @@ -1024,32 +1029,36 @@ void sub_81C0F44(u8 taskId) { u8 id = taskId; s16 *data = gTasks[taskId].data; + if (sub_81221EC() != 1) { if (gMain.newKeys & DPAD_UP) { data[0] = 4; - sub_81C1070(data, -1, &gUnknown_0203CF1C->unionThing.fooFiller.unk40C6); + sub_81C1070(data, -1, &gUnknown_0203CF1C->unk40C6); } else if (gMain.newKeys & DPAD_DOWN) { data[0] = 4; - sub_81C1070(data, 1, &gUnknown_0203CF1C->unionThing.fooFiller.unk40C6); + sub_81C1070(data, 1, &gUnknown_0203CF1C->unk40C6); } else if (gMain.newKeys & A_BUTTON) { - if (gUnknown_0203CF1C->unk40C8 == 1 || ((int)(gUnknown_0203CF1C->unionThing.loadThis & 0xFFFFFF) == 0x40000)) + if (gUnknown_0203CF1C->unk40C8 == 1 + || (gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) { PlaySE(SE_SELECT); sub_81C11F4(taskId); } - else if (sub_81C1040() == 1) + else if (sub_81C1040() == TRUE) { PlaySE(SE_SELECT); sub_81C129C(taskId); } else - PlaySE(0x20); + { + PlaySE(SE_HAZURE); + } } else if (gMain.newKeys & B_BUTTON) { @@ -1059,32 +1068,194 @@ void sub_81C0F44(u8 taskId) } } -u8 sub_81C1040() +bool8 sub_81C1040(void) { u8 i; - for (i = 1; i <= 3; i++) + for (i = 1; i < 4; i++) { if (gUnknown_0203CF1C->summary.moves[i] != 0) - return 1; + return TRUE; } - return 0; + return FALSE; } -/* void sub_81C1070(s16* a, s8 b, u8* c) +void sub_81C4D18(); + +void sub_81C1070(s16 *a, s8 b, u8 *c) { s8 i; - s8 d = c*; + s8 moveIndex; + u16 move; + PlaySE(SE_SELECT); - i = 0; - while (i <= 3) + moveIndex = *c; + for (i = 0; i < 4; i++) { - d += b - if (d > a[0]) - d = 0; - else if (d < 0) - d = data[0]; - if (d == 4) + moveIndex += b; + if (moveIndex > a[0]) + moveIndex = 0; + else if (moveIndex < 0) + moveIndex = a[0]; + if (moveIndex == 4) + { + move = gUnknown_0203CF1C->unk40C4; + break; + } + move = gUnknown_0203CF1C->summary.moves[moveIndex]; + if (move != 0) break; - } + sub_81C240C(move); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + sub_81C3E9C(move); + if ((*c == 4 && gUnknown_0203CF1C->unk40C4 == 0) || a[1] == 1) + { + ClearWindowTilemap(19); + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + ClearWindowTilemap(13); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C1DA4(9, -3); + sub_81C1EFC(9, -3, move); + } + if (*c != 4 && moveIndex == 4 && gUnknown_0203CF1C->unk40C4 == 0) + { + ClearWindowTilemap(14); + ClearWindowTilemap(15); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C1DA4(0, 3); + sub_81C1EFC(0, 3, 0); + } + *c = moveIndex; + if (c == &gUnknown_0203CF1C->unk40C6) + sub_81C4D18(8); + else + sub_81C4D18(18); +} + +void sub_81C11F4(u8 taskId) +{ + sub_81C4C60(8); + ClearWindowTilemap(6); + PutWindowTilemap(5); + sub_81C3E9C(0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2, 3, 1); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3, 1, 1); + sub_81C4064(); + if (gUnknown_0203CF1C->unk40C6 != 4) + { + ClearWindowTilemap(14); + ClearWindowTilemap(15); + sub_81C1DA4(0, 3); + sub_81C1EFC(0, 3, 0); + } + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81C0510; +} + +void sub_81C129C(u8 taskId) +{ + gUnknown_0203CF1C->unk40C7 = gUnknown_0203CF1C->unk40C6; + sub_81C4C84(1); + sub_81C4AF8(18); + gTasks[taskId].func = sub_81C12E4; +} + +void sub_81C12E4(u8 taskId) +{ + u8 a = taskId; + s16* data = gTasks[taskId].data; + if (sub_81221EC() != 1) + { + if (gMain.newKeys & DPAD_UP) + { + data[0] = 3; + sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->unk40C7); + } + else if (gMain.newKeys & DPAD_DOWN) + { + data[0] = 3; + sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->unk40C7); + } + else if (gMain.newKeys & A_BUTTON) + { + if (gUnknown_0203CF1C->unk40C6 == gUnknown_0203CF1C->unk40C7) + { + sub_81C13B0(taskId, 0); + } + else + sub_81C13B0(taskId, 1); + } + else if (gMain.newKeys & B_BUTTON) + sub_81C13B0(a, 0); + } +} + +void sub_81C13B0(u8 taskId, u8 b) +{ + u16 move; + PlaySE(SE_SELECT); + sub_81C4C84(0); + sub_81C4C60(18); + if (b == 1) + { + if (gUnknown_0203CF1C->unk40BD == 0) + { + struct Pokemon *why = gUnknown_0203CF1C->unk0->mons; + sub_81C14BC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + } + else + { + struct BoxPokemon *why = gUnknown_0203CF1C->unk0->boxMons; + sub_81C15EC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + } + sub_81C0098(&gUnknown_0203CF1C->currentPoke); + sub_81C40A0(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + sub_81C4568(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + gUnknown_0203CF1C->unk40C6 = gUnknown_0203CF1C->unk40C7; + } + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + sub_81C3E9C(move); + sub_81C240C(move); + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81C0F44; +} + +struct struct_moveSwap +{ + u16 field_0; + u16 field_2; + u8 field_4; + u8 field_5; + u8 field_6; + u16* ptr_8; + u16* ptr_C; + u8* ptr_10; + u8* ptr_14; + u8* ptr_18; + u16* ptr_1C; + u8* ptr_20; + u8* ptr_24; +}; + +/* void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b) +{ + struct struct_moveSwap sp; + u8 r2; + sp.ptr_8 = &gUnknown_0203CF1C->summary.moves[a]; + sp.ptr_1C = &sp.field_2; + sp.field_2 = gUnknown_0203CF1C->summary.moves[a]; + sp.ptr_C = &gUnknown_0203CF1C->summary.moves[b]; + sp.field_0 = gUnknown_0203CF1C->summary.moves[b]; + sp.ptr_10 = &gUnknown_0203CF1C->summary.pp[a]; + sp.ptr_24 = &sp.field_5; + sp.field_5 = gUnknown_0203CF1C->summary.pp[a]; + sp.ptr_14 = &gUnknown_0203CF1C->summary.pp[b]; + sp.ptr_20 = &sp.field_4; + sp.field_4 = gUnknown_0203CF1C->summary.pp[b]; + sp.ptr_18 = &gUnknown_0203CF1C->summary.ppBonuses; + sp.field_6 = gUnknown_0203CF1C->summary.ppBonuses; } */ \ No newline at end of file From 750937c58c96b51645ba9be5d65aa7c080cf2d6d Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Tue, 3 Oct 2017 16:10:18 -0400 Subject: [PATCH 07/21] fix battle.h --- include/battle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/battle.h b/include/battle.h index 2c7b7db665..aa01735e11 100644 --- a/include/battle.h +++ b/include/battle.h @@ -257,6 +257,8 @@ #define CMP_COMMON_BITS 0x4 #define CMP_NO_COMMON_BITS 0x5 +#include "global.h" + struct TrainerMonNoItemDefaultMoves { u16 species; @@ -264,8 +266,6 @@ struct TrainerMonNoItemDefaultMoves u16 evsValue; }; -#include "global.h" - u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg); u8 GetBankSide(u8 bank); From ddc2e96825c38e0ac05e602c07fc870d3464f139 Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Wed, 4 Oct 2017 13:27:50 -0400 Subject: [PATCH 08/21] egg pls save me --- src/pokemon_summary_screen.c | 87 +++++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 5499706249..9a478dabba 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1224,38 +1224,63 @@ void sub_81C13B0(u8 taskId, u8 b) gTasks[taskId].func = sub_81C0F44; } -struct struct_moveSwap -{ - u16 field_0; - u16 field_2; - u8 field_4; - u8 field_5; - u8 field_6; - u16* ptr_8; - u16* ptr_C; - u8* ptr_10; - u8* ptr_14; - u8* ptr_18; - u16* ptr_1C; - u8* ptr_20; - u8* ptr_24; -}; -/* void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b) +/* void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) { - struct struct_moveSwap sp; + u16* moveToPtr; + u8 r8; u8 r2; - sp.ptr_8 = &gUnknown_0203CF1C->summary.moves[a]; - sp.ptr_1C = &sp.field_2; - sp.field_2 = gUnknown_0203CF1C->summary.moves[a]; - sp.ptr_C = &gUnknown_0203CF1C->summary.moves[b]; - sp.field_0 = gUnknown_0203CF1C->summary.moves[b]; - sp.ptr_10 = &gUnknown_0203CF1C->summary.pp[a]; - sp.ptr_24 = &sp.field_5; - sp.field_5 = gUnknown_0203CF1C->summary.pp[a]; - sp.ptr_14 = &gUnknown_0203CF1C->summary.pp[b]; - sp.ptr_20 = &sp.field_4; - sp.field_4 = gUnknown_0203CF1C->summary.pp[b]; - sp.ptr_18 = &gUnknown_0203CF1C->summary.ppBonuses; - sp.field_6 = gUnknown_0203CF1C->summary.ppBonuses; + u8 r12; + u8 r1; + u16 localMoveTo; + u16 localMoveFrom; + u8 localPpTo; + u8 localPpFrom; + u8 localPpBonuses; + + u16* moveFromPtr; + u8* ppFromPtr; + u8* ppToPtr; + u8* ppBonusesPtr; + + moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; + localMoveFrom = *moveFromPtr; + + moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId]; + localMoveTo = *moveToPtr; + + ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; + localPpFrom = *ppFromPtr; + ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId]; + localPpTo = *ppToPtr; + + ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses; + localPpBonuses = *ppBonusesPtr; + + r8 = gUnknown_08329D22[swappingFromId]; + r2 = (int)(localPpBonuses & r8) >> (swappingFromId << 1); + r12 = gUnknown_08329D22[swappingToId]; + r1 = (int)(localPpBonuses & r12) >> (swappingToId << 1); + localPpBonuses &= ~r8; + localPpBonuses &= ~r12; + r2 = r2 << (swappingToId << 1); + r1 = r1 << (swappingFromId << 1); + r2 += r1; + localPpBonuses |= r2; + + SetMonData(mon, swappingFromId + MON_DATA_MOVE1, moveToPtr); + SetMonData(mon, swappingToId + MON_DATA_MOVE1, moveFromPtr); + + SetMonData(mon, swappingFromId + MON_DATA_PP1, ppToPtr); + SetMonData(mon, swappingToId + MON_DATA_PP1, ppFromPtr); + + SetMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses); + + *moveFromPtr = localMoveTo; + *moveToPtr = localMoveFrom; + + *ppFromPtr = localPpTo; + *ppToPtr = localPpFrom; + + *ppBonusesPtr = localPpBonuses; } */ \ No newline at end of file From d361f7030abb3441bfe61e95c3803297454acbb8 Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Mon, 9 Oct 2017 13:17:13 -0400 Subject: [PATCH 09/21] decompiled up to sub_81C20F0 --- asm/pokemon_summary_screen.s | 1518 ---------------------------------- src/pokemon_summary_screen.c | 1016 ++++++++++++++++++++++- 2 files changed, 976 insertions(+), 1558 deletions(-) diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index b243ab3b26..e576297716 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,1524 +5,6 @@ .text - thumb_func_start sub_81C14BC -sub_81C14BC: @ 81C14BC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - adds r7, r0, 0 - adds r4, r1, 0 - adds r6, r2, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - lsls r0, r4, 1 - mov r10, r0 - adds r1, r2, 0 - adds r1, 0x84 - adds r0, r1, r0 - str r0, [sp, 0x8] - ldrh r0, [r0] - mov r3, sp - adds r3, 0x2 - str r3, [sp, 0x1C] - strh r0, [r3] - lsls r0, r6, 1 - mov r9, r0 - add r1, r9 - str r1, [sp, 0xC] - ldrh r1, [r1] - mov r0, sp - strh r1, [r0] - adds r1, r2, 0 - adds r1, 0x8C - adds r3, r1, r4 - str r3, [sp, 0x10] - ldrb r0, [r3] - mov r3, sp - adds r3, 0x5 - str r3, [sp, 0x24] - strb r0, [r3] - adds r1, r6 - str r1, [sp, 0x14] - ldrb r0, [r1] - mov r1, sp - adds r1, 0x4 - str r1, [sp, 0x20] - strb r0, [r1] - adds r2, 0xA4 - str r2, [sp, 0x18] - ldrb r0, [r2] - mov r5, sp - adds r5, 0x6 - strb r0, [r5] - ldr r1, =gUnknown_08329D22 - adds r0, r4, r1 - ldrb r0, [r0] - mov r8, r0 - ldrb r0, [r5] - adds r2, r0, 0 - mov r3, r8 - ands r2, r3 - mov r3, r10 - asrs r2, r3 - lsls r2, 24 - lsrs r2, 24 - adds r1, r6, r1 - ldrb r1, [r1] - mov r12, r1 - adds r1, r0, 0 - mov r3, r12 - ands r1, r3 - mov r3, r9 - asrs r1, r3 - lsls r1, 24 - lsrs r1, 24 - mov r3, r8 - bics r0, r3 - strb r0, [r5] - ldrb r0, [r5] - mov r3, r12 - bics r0, r3 - strb r0, [r5] - mov r0, r9 - lsls r2, r0 - mov r3, r10 - lsls r1, r3 - adds r2, r1 - ldrb r0, [r5] - orrs r0, r2 - strb r0, [r5] - adds r1, r4, 0 - adds r1, 0xD - adds r0, r7, 0 - mov r2, sp - bl SetMonData - adds r1, r6, 0 - adds r1, 0xD - adds r0, r7, 0 - ldr r2, [sp, 0x1C] - bl SetMonData - adds r4, 0x11 - adds r0, r7, 0 - adds r1, r4, 0 - ldr r2, [sp, 0x20] - bl SetMonData - adds r6, 0x11 - adds r0, r7, 0 - adds r1, r6, 0 - ldr r2, [sp, 0x24] - bl SetMonData - adds r0, r7, 0 - movs r1, 0x15 - adds r2, r5, 0 - bl SetMonData - mov r0, sp - ldrh r0, [r0] - ldr r1, [sp, 0x8] - strh r0, [r1] - ldr r3, [sp, 0x1C] - ldrh r0, [r3] - ldr r1, [sp, 0xC] - strh r0, [r1] - ldr r3, [sp, 0x20] - ldrb r0, [r3] - ldr r1, [sp, 0x10] - strb r0, [r1] - ldr r3, [sp, 0x24] - ldrb r0, [r3] - ldr r1, [sp, 0x14] - strb r0, [r1] - ldrb r0, [r5] - ldr r3, [sp, 0x18] - strb r0, [r3] - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C14BC - - thumb_func_start sub_81C15EC -sub_81C15EC: @ 81C15EC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - adds r7, r0, 0 - adds r4, r1, 0 - adds r6, r2, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - lsls r0, r4, 1 - mov r10, r0 - adds r1, r2, 0 - adds r1, 0x84 - adds r0, r1, r0 - str r0, [sp, 0x8] - ldrh r0, [r0] - mov r3, sp - adds r3, 0x2 - str r3, [sp, 0x1C] - strh r0, [r3] - lsls r0, r6, 1 - mov r9, r0 - add r1, r9 - str r1, [sp, 0xC] - ldrh r1, [r1] - mov r0, sp - strh r1, [r0] - adds r1, r2, 0 - adds r1, 0x8C - adds r3, r1, r4 - str r3, [sp, 0x10] - ldrb r0, [r3] - mov r3, sp - adds r3, 0x5 - str r3, [sp, 0x24] - strb r0, [r3] - adds r1, r6 - str r1, [sp, 0x14] - ldrb r0, [r1] - mov r1, sp - adds r1, 0x4 - str r1, [sp, 0x20] - strb r0, [r1] - adds r2, 0xA4 - str r2, [sp, 0x18] - ldrb r0, [r2] - mov r5, sp - adds r5, 0x6 - strb r0, [r5] - ldr r1, =gUnknown_08329D22 - adds r0, r4, r1 - ldrb r0, [r0] - mov r8, r0 - ldrb r0, [r5] - adds r2, r0, 0 - mov r3, r8 - ands r2, r3 - mov r3, r10 - asrs r2, r3 - lsls r2, 24 - lsrs r2, 24 - adds r1, r6, r1 - ldrb r1, [r1] - mov r12, r1 - adds r1, r0, 0 - mov r3, r12 - ands r1, r3 - mov r3, r9 - asrs r1, r3 - lsls r1, 24 - lsrs r1, 24 - mov r3, r8 - bics r0, r3 - strb r0, [r5] - ldrb r0, [r5] - mov r3, r12 - bics r0, r3 - strb r0, [r5] - mov r0, r9 - lsls r2, r0 - mov r3, r10 - lsls r1, r3 - adds r2, r1 - ldrb r0, [r5] - orrs r0, r2 - strb r0, [r5] - adds r1, r4, 0 - adds r1, 0xD - adds r0, r7, 0 - mov r2, sp - bl SetBoxMonData - adds r1, r6, 0 - adds r1, 0xD - adds r0, r7, 0 - ldr r2, [sp, 0x1C] - bl SetBoxMonData - adds r4, 0x11 - adds r0, r7, 0 - adds r1, r4, 0 - ldr r2, [sp, 0x20] - bl SetBoxMonData - adds r6, 0x11 - adds r0, r7, 0 - adds r1, r6, 0 - ldr r2, [sp, 0x24] - bl SetBoxMonData - adds r0, r7, 0 - movs r1, 0x15 - adds r2, r5, 0 - bl SetBoxMonData - mov r0, sp - ldrh r0, [r0] - ldr r1, [sp, 0x8] - strh r0, [r1] - ldr r3, [sp, 0x1C] - ldrh r0, [r3] - ldr r1, [sp, 0xC] - strh r0, [r1] - ldr r3, [sp, 0x20] - ldrb r0, [r3] - ldr r1, [sp, 0x10] - strb r0, [r1] - ldr r3, [sp, 0x24] - ldrb r0, [r3] - ldr r1, [sp, 0x14] - strb r0, [r1] - ldrb r0, [r5] - ldr r3, [sp, 0x18] - strb r0, [r3] - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C15EC - - thumb_func_start sub_81C171C -sub_81C171C: @ 81C171C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_81C44F0 - movs r0, 0x8 - bl sub_81C4AF8 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C174C - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C171C - - thumb_func_start sub_81C174C -sub_81C174C: @ 81C174C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C176A - b _081C189A -_081C176A: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r2, 0x80 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _081C177A - b _081C189A -_081C177A: - ldr r6, =gMain - ldrh r1, [r6, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081C17B4 - movs r0, 0x4 - strh r0, [r4] - movs r1, 0x1 - negs r1, r1 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r2, r0 - adds r0, r4, 0 - bl sub_81C1070 - b _081C189A - .pool -_081C17B4: - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _081C17DC - movs r0, 0x4 - strh r0, [r4] - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r1, =0x000040c6 - adds r2, r1 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C1070 - b _081C189A - .pool -_081C17DC: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081C17F0 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C17FC -_081C17F0: - movs r1, 0x1 - negs r1, r1 - adds r0, r5, 0 - bl sub_81C0A8C - b _081C189A -_081C17FC: - ldrh r1, [r6, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081C1812 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081C181C -_081C1812: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81C0A8C - b _081C189A -_081C181C: - ldrh r1, [r6, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081C1876 - bl sub_81C18A8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C1868 - bl sub_81C48F0 - movs r0, 0x5 - bl PlaySE - ldr r2, =gUnknown_0203CF21 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c6 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - ldr r1, =gSpecialVar_0x8005 - ldrb r0, [r2] - strh r0, [r1] - adds r0, r5, 0 - bl sub_81C044C - b _081C189A - .pool -_081C1868: - movs r0, 0x20 - bl PlaySE - adds r0, r5, 0 - bl sub_81C18F4 - b _081C189A -_081C1876: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C189A - bl sub_81C48F0 - movs r0, 0x5 - bl PlaySE - ldr r1, =gUnknown_0203CF21 - movs r0, 0x4 - strb r0, [r1] - ldr r1, =gSpecialVar_0x8005 - movs r0, 0x4 - strh r0, [r1] - adds r0, r5, 0 - bl sub_81C044C -_081C189A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C174C - - thumb_func_start sub_81C18A8 -sub_81C18A8: @ 81C18A8 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r1, r2, r0 - ldrb r0, [r1] - cmp r0, 0x4 - beq _081C18DA - ldr r3, =0x000040c4 - adds r0, r2, r3 - ldrh r0, [r0] - cmp r0, 0 - beq _081C18DA - ldrb r1, [r1] - lsls r1, 1 - adds r0, r2, 0 - adds r0, 0x84 - adds r0, r1 - ldrh r0, [r0] - bl sub_81B6D14 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C18EC -_081C18DA: - movs r0, 0x1 - b _081C18EE - .pool -_081C18EC: - movs r0, 0 -_081C18EE: - pop {r1} - bx r1 - thumb_func_end sub_81C18A8 - - thumb_func_start sub_81C18F4 -sub_81C18F4: @ 81C18F4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0xE - bl ClearWindowTilemap - movs r0, 0xF - bl ClearWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0 - movs r1, 0x3 - bl sub_81C1DA4 - movs r0, 0 - movs r1, 0x3 - movs r2, 0 - bl sub_81C1EFC - bl sub_81C4154 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81C1940 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C18F4 - - thumb_func_start sub_81C1940 -sub_81C1940: @ 81C1940 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - mov r8, r0 - ldr r0, =gTasks + 0x8 - mov r9, r0 - mov r4, r8 - add r4, r9 - ldr r0, =sub_81C1E20 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C196C - b _081C1B74 -_081C196C: - ldr r6, =gMain - ldrh r1, [r6, 0x2E] - movs r0, 0x40 - ands r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _081C19B0 - movs r0, 0x1 - strh r0, [r4, 0x2] - movs r0, 0x4 - strh r0, [r4] - movs r1, 0x1 - negs r1, r1 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r0, =0x000040c6 - adds r2, r0 - adds r0, r4, 0 - bl sub_81C1070 - movs r0, 0 - strh r0, [r4, 0x2] - b _081C1B6A - .pool -_081C19B0: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081C19DC - movs r0, 0x1 - strh r0, [r4, 0x2] - movs r0, 0x4 - strh r0, [r4] - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r1, =0x000040c6 - adds r2, r1 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C1070 - strh r5, [r4, 0x2] - b _081C1B6A - .pool -_081C19DC: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081C19F0 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C1A64 -_081C19F0: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r2, =0x000040c0 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0x2 - bne _081C1A00 - b _081C1B74 -_081C1A00: - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r0, [r4] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1A28 - movs r0, 0xD - bl ClearWindowTilemap -_081C1A28: - ldr r1, [r4] - ldr r2, =0x000040c6 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r5, [r1] - mov r0, r9 - subs r0, 0x8 - add r0, r8 - ldr r1, =sub_81C174C - str r1, [r0] - movs r1, 0x1 - negs r1, r1 - adds r0, r7, 0 - b _081C1ACE - .pool -_081C1A64: - ldrh r1, [r6, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081C1A7A - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081C1B04 -_081C1A7A: - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - beq _081C1B74 - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r0, [r4] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1AB0 - movs r0, 0xD - bl ClearWindowTilemap -_081C1AB0: - ldr r1, [r4] - ldr r2, =0x000040c6 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r5, [r1] - mov r0, r9 - subs r0, 0x8 - add r0, r8 - ldr r1, =sub_81C174C - str r1, [r0] - adds r0, r7, 0 - movs r1, 0x1 -_081C1ACE: - bl sub_81C0A8C - movs r4, 0x2 - negs r4, r4 - movs r0, 0x9 - adds r1, r4, 0 - bl sub_81C1DA4 - movs r0, 0x9 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_81C1EFC - b _081C1B74 - .pool -_081C1B04: - ldrh r1, [r6, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _081C1B74 - movs r0, 0x13 - bl ClearWindowTilemap - ldr r2, =gSprites - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1B38 - movs r0, 0xD - bl ClearWindowTilemap -_081C1B38: - ldr r1, [r4] - ldr r2, =0x000040c6 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r5, [r1] - adds r0, r5, 0 - bl sub_81C3E9C - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r4, 0x3 - negs r4, r4 - movs r0, 0x9 - adds r1, r4, 0 - bl sub_81C1DA4 - movs r0, 0x9 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_81C1EFC -_081C1B6A: - mov r0, r9 - subs r0, 0x8 - add r0, r8 - ldr r1, =sub_81C174C - str r1, [r0] -_081C1B74: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1940 - - thumb_func_start sub_81C1B94 -sub_81C1B94: @ 81C1B94 - ldr r0, =gUnknown_0203CF21 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_81C1B94 - - thumb_func_start sub_81C1BA0 -sub_81C1BA0: @ 81C1BA0 - push {r4-r7,lr} - sub sp, 0xC - movs r0, 0x20 - bl Alloc - adds r4, r0, 0 - movs r5, 0 -_081C1BAE: - lsls r0, r5, 25 - lsrs r1, r0, 24 - adds r6, r1, 0 - ldr r0, =gUnknown_0203CF1C - ldr r3, [r0] - ldr r2, =0x000040c1 - adds r0, r3, r2 - ldrb r0, [r0] - cmp r5, r0 - bcs _081C1BD8 - lsls r0, r1, 1 - adds r0, r4 - movs r1, 0x40 - strh r1, [r0] - strh r1, [r0, 0x2] - movs r1, 0x50 - b _081C1BEE - .pool -_081C1BD8: - ldr r7, =0x000040c2 - adds r0, r3, r7 - ldrb r2, [r0] - cmp r5, r2 - bls _081C1BF8 - lsls r0, r1, 1 - adds r0, r4 - movs r1, 0x4A - strh r1, [r0] - strh r1, [r0, 0x2] - movs r1, 0x5A -_081C1BEE: - strh r1, [r0, 0x10] - strh r1, [r0, 0x12] - b _081C1C78 - .pool -_081C1BF8: - ldr r7, =0x000040c0 - adds r0, r3, r7 - ldrb r0, [r0] - cmp r5, r0 - bcs _081C1C1C - lsls r1, 1 - adds r1, r4 - movs r0, 0x46 - strh r0, [r1] - movs r0, 0x47 - strh r0, [r1, 0x2] - movs r0, 0x56 - strh r0, [r1, 0x10] - movs r0, 0x57 - b _081C1C76 - .pool -_081C1C1C: - cmp r5, r0 - bne _081C1C4C - cmp r5, r2 - beq _081C1C38 - lsls r1, 1 - adds r1, r4 - movs r0, 0x41 - strh r0, [r1] - movs r0, 0x42 - strh r0, [r1, 0x2] - movs r0, 0x51 - strh r0, [r1, 0x10] - movs r0, 0x52 - b _081C1C76 -_081C1C38: - lsls r1, 1 - adds r1, r4 - movs r0, 0x4B - strh r0, [r1] - movs r0, 0x4C - strh r0, [r1, 0x2] - movs r0, 0x5B - strh r0, [r1, 0x10] - movs r0, 0x5C - b _081C1C76 -_081C1C4C: - cmp r5, r2 - beq _081C1C64 - lsls r1, 1 - adds r1, r4 - movs r0, 0x43 - strh r0, [r1] - movs r0, 0x44 - strh r0, [r1, 0x2] - movs r0, 0x53 - strh r0, [r1, 0x10] - movs r0, 0x54 - b _081C1C76 -_081C1C64: - lsls r1, r6, 1 - adds r1, r4 - movs r0, 0x48 - strh r0, [r1] - movs r0, 0x49 - strh r0, [r1, 0x2] - movs r0, 0x58 - strh r0, [r1, 0x10] - movs r0, 0x59 -_081C1C76: - strh r0, [r1, 0x12] -_081C1C78: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _081C1BAE - movs r0, 0x8 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x10 - str r0, [sp, 0x8] - movs r0, 0x3 - adds r1, r4, 0 - movs r2, 0xB - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r4, 0 - bl Free - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C1BA0 - - thumb_func_start sub_81C1CB0 -sub_81C1CB0: @ 81C1CB0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r4, r0, 0 - mov r8, r1 - lsls r2, 24 - lsrs r6, r2, 24 - lsls r3, 24 - lsrs r5, r3, 24 - ldrb r1, [r4, 0x6] - ldrb r0, [r4, 0x7] - lsls r0, 1 - muls r0, r1 - bl Alloc - adds r7, r0, 0 - mov r1, sp - ldrh r0, [r4, 0x4] - strh r0, [r1] - ldrb r1, [r4, 0x7] - ldrb r0, [r4, 0x6] - adds r2, r1, 0 - muls r2, r0 - movs r0, 0x80 - lsls r0, 17 - orrs r2, r0 - mov r0, sp - adds r1, r7, 0 - bl CpuSet - ldrb r0, [r4, 0x6] - cmp r0, r6 - beq _081C1D60 - cmp r5, 0 - bne _081C1D30 - movs r5, 0 - ldrb r0, [r4, 0x7] - cmp r5, r0 - bcs _081C1D60 -_081C1D00: - ldrb r2, [r4, 0x6] - adds r1, r2, 0 - muls r1, r5 - adds r3, r6, r1 - lsls r3, 1 - ldr r0, [r4] - adds r0, r3 - lsls r1, 1 - adds r1, r7, r1 - subs r2, r6 - ldr r3, =0x001fffff - ands r2, r3 - bl CpuSet - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - ldrb r3, [r4, 0x7] - cmp r5, r3 - bcc _081C1D00 - b _081C1D60 - .pool -_081C1D30: - movs r5, 0 - ldrb r0, [r4, 0x7] - cmp r5, r0 - bcs _081C1D60 -_081C1D38: - ldrb r2, [r4, 0x6] - adds r1, r2, 0 - muls r1, r5 - lsls r3, r1, 1 - ldr r0, [r4] - adds r0, r3 - adds r1, r6, r1 - lsls r1, 1 - adds r1, r7, r1 - subs r2, r6 - ldr r3, =0x001fffff - ands r2, r3 - bl CpuSet - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - ldrb r3, [r4, 0x7] - cmp r5, r3 - bcc _081C1D38 -_081C1D60: - movs r5, 0 - b _081C1D8A - .pool -_081C1D68: - ldrb r2, [r4, 0x6] - adds r0, r2, 0 - muls r0, r5 - lsls r0, 1 - adds r0, r7, r0 - ldrb r1, [r4, 0x9] - adds r1, r5 - lsls r1, 5 - ldrb r3, [r4, 0x8] - adds r1, r3 - lsls r1, 1 - add r1, r8 - bl CpuSet - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 -_081C1D8A: - ldrb r0, [r4, 0x7] - cmp r5, r0 - bcc _081C1D68 - adds r0, r7, 0 - bl Free - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C1CB0 - - thumb_func_start sub_81C1DA4 -sub_81C1DA4: @ 81C1DA4 - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 16 - lsrs r4, r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_0861CC04 - ldrb r2, [r3, 0x6] - cmp r1, r2 - ble _081C1DBA - adds r4, r2, 0 -_081C1DBA: - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0 - beq _081C1DC6 - cmp r0, r2 - bne _081C1DE8 -_081C1DC6: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r0, =0x000020bc - adds r1, r0 - lsls r2, r4, 24 - lsrs r2, 24 - adds r0, r3, 0 - movs r3, 0x1 - bl sub_81C1CB0 - b _081C1E12 - .pool -_081C1DE8: - ldr r5, =sub_81C1E20 - adds r0, r5, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _081C1E04 - adds r0, r5, 0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 -_081C1E04: - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - strh r6, [r0, 0xA] -_081C1E12: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1DA4 - - thumb_func_start sub_81C1E20 -sub_81C1E20: @ 81C1E20 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4] - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r4, 0x2] - lsls r0, 16 - cmp r0, 0 - bge _081C1E50 - movs r0, 0 - strh r0, [r4, 0x2] - ldr r7, =gUnknown_0861CC04 - b _081C1E60 - .pool -_081C1E50: - movs r0, 0x2 - ldrsh r1, [r4, r0] - ldr r0, =gUnknown_0861CC04 - ldrb r2, [r0, 0x6] - adds r7, r0, 0 - cmp r1, r2 - ble _081C1E60 - strh r2, [r4, 0x2] -_081C1E60: - ldr r5, =gUnknown_0203CF1C - ldr r1, [r5] - ldr r0, =0x000020bc - adds r1, r0 - ldrb r2, [r4, 0x2] - adds r0, r7, 0 - movs r3, 0x1 - bl sub_81C1CB0 - movs r1, 0x2 - ldrsh r0, [r4, r1] - cmp r0, 0 - ble _081C1E80 - ldrb r7, [r7, 0x6] - cmp r0, r7 - blt _081C1EE0 -_081C1E80: - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bge _081C1EAC - ldr r0, [r5] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x2 - bne _081C1ED4 - movs r0, 0xE - bl PutWindowTilemap - b _081C1ED4 - .pool -_081C1EAC: - ldr r2, =gSprites - ldr r0, [r5] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C1ECE - movs r0, 0xD - bl PutWindowTilemap -_081C1ECE: - movs r0, 0x13 - bl PutWindowTilemap -_081C1ED4: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r6, 0 - bl DestroyTask -_081C1EE0: - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1E20 - - thumb_func_start sub_81C1EFC -sub_81C1EFC: @ 81C1EFC - push {r4-r7,lr} - lsls r0, 16 - lsrs r7, r0, 16 - lsls r1, 16 - lsls r2, 16 - lsrs r6, r2, 16 - lsrs r4, r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_0861CC10 - ldrb r2, [r3, 0x6] - cmp r1, r2 - ble _081C1F16 - adds r4, r2, 0 -_081C1F16: - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0 - beq _081C1F22 - cmp r0, r2 - bne _081C1F44 -_081C1F22: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r0, =0x000030bc - adds r1, r0 - lsls r2, r4, 24 - lsrs r2, 24 - adds r0, r3, 0 - movs r3, 0x1 - bl sub_81C1CB0 - b _081C1F70 - .pool -_081C1F44: - ldr r5, =sub_81C1F80 - adds r0, r5, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _081C1F60 - adds r0, r5, 0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 -_081C1F60: - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - strh r7, [r0, 0xA] - strh r6, [r0, 0xC] -_081C1F70: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1EFC - - thumb_func_start sub_81C1F80 -sub_81C1F80: @ 81C1F80 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4] - ldrh r1, [r4, 0x2] - adds r0, r1 - strh r0, [r4, 0x2] - lsls r0, 16 - cmp r0, 0 - bge _081C1FB0 - movs r0, 0 - strh r0, [r4, 0x2] - ldr r7, =gUnknown_0861CC10 - b _081C1FC0 - .pool -_081C1FB0: - movs r0, 0x2 - ldrsh r1, [r4, r0] - ldr r0, =gUnknown_0861CC10 - ldrb r2, [r0, 0x6] - adds r7, r0, 0 - cmp r1, r2 - ble _081C1FC0 - strh r2, [r4, 0x2] -_081C1FC0: - ldr r5, =gUnknown_0203CF1C - ldr r1, [r5] - ldr r0, =0x000030bc - adds r1, r0 - ldrb r2, [r4, 0x2] - adds r0, r7, 0 - movs r3, 0x1 - bl sub_81C1CB0 - movs r1, 0x2 - ldrsh r0, [r4, r1] - cmp r0, 0 - ble _081C1FE0 - ldrb r7, [r7, 0x6] - cmp r0, r7 - blt _081C2058 -_081C1FE0: - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bge _081C2024 - ldr r0, [r5] - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2006 - ldr r0, =sub_81C0B8C - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _081C2006 - movs r0, 0xF - bl PutWindowTilemap -_081C2006: - ldrh r0, [r4, 0x4] - bl sub_81C240C - b _081C204C - .pool -_081C2024: - ldr r2, =gSprites - ldr r0, [r5] - ldr r1, =0x000040d5 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - blt _081C2046 - movs r0, 0xD - bl PutWindowTilemap -_081C2046: - movs r0, 0x13 - bl PutWindowTilemap -_081C204C: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r6, 0 - bl DestroyTask -_081C2058: - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C1F80 - - thumb_func_start sub_81C2074 -sub_81C2074: @ 81C2074 - push {r4,r5,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 16 - lsrs r4, r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_0861CBEC - ldrb r2, [r3, 0x6] - cmp r1, r2 - ble _081C208A - adds r4, r2, 0 -_081C208A: - lsls r0, r4, 16 - asrs r0, 16 - cmp r0, 0 - beq _081C2096 - cmp r0, r2 - bne _081C20C8 -_081C2096: - ldr r5, =gUnknown_0203CF1C - ldr r1, [r5] - adds r1, 0xBC - lsls r4, 24 - lsrs r4, 24 - adds r0, r3, 0 - adds r2, r4, 0 - movs r3, 0 - bl sub_81C1CB0 - ldr r0, =gUnknown_0861CBF8 - ldr r1, [r5] - adds r1, 0xBC - adds r2, r4, 0 - movs r3, 0 - bl sub_81C1CB0 - b _081C20E2 - .pool -_081C20C8: - ldr r0, =sub_81C20F0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - strh r5, [r1, 0xA] -_081C20E2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2074 - - thumb_func_start sub_81C20F0 -sub_81C20F0: @ 81C20F0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldrh r0, [r5] - ldrh r1, [r5, 0x2] - adds r0, r1 - strh r0, [r5, 0x2] - lsls r0, 16 - cmp r0, 0 - bge _081C2120 - movs r0, 0 - strh r0, [r5, 0x2] - ldr r7, =gUnknown_0861CBEC - b _081C2130 - .pool -_081C2120: - movs r0, 0x2 - ldrsh r1, [r5, r0] - ldr r0, =gUnknown_0861CBEC - ldrb r2, [r0, 0x6] - adds r7, r0, 0 - cmp r1, r2 - ble _081C2130 - strh r2, [r5, 0x2] -_081C2130: - ldr r4, =gUnknown_0203CF1C - ldr r1, [r4] - adds r1, 0xBC - ldrb r2, [r5, 0x2] - adds r0, r7, 0 - movs r3, 0 - bl sub_81C1CB0 - ldr r0, =gUnknown_0861CBF8 - ldr r1, [r4] - adds r1, 0xBC - ldrb r2, [r5, 0x2] - movs r3, 0 - bl sub_81C1CB0 - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - movs r1, 0x2 - ldrsh r0, [r5, r1] - cmp r0, 0 - ble _081C2162 - ldrb r7, [r7, 0x6] - cmp r0, r7 - blt _081C2180 -_081C2162: - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0 - bge _081C217A - bl sub_81C4A88 - movs r0, 0xD - bl PutWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram -_081C217A: - adds r0, r6, 0 - bl DestroyTask -_081C2180: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C20F0 - thumb_func_start sub_81C2194 sub_81C2194: @ 81C2194 push {r4-r7,lr} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 9a478dabba..2c7c5e11c6 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1,4 +1,5 @@ #include "battle.h" +#include "bg.h" #include "decompress.h" #include "global.h" #include "m4a.h" @@ -19,6 +20,13 @@ extern u8 gUnknown_0203CF20; extern struct MusicPlayerInfo gMPlay_BGM; extern s8 gUnknown_0861CC1C[]; extern u8 gUnknown_08329D22[]; +extern u8 gUnknown_0203CF21; +extern u16 gSpecialVar_0x8005; +extern struct unkStruct_61CC04 gUnknown_0861CC04; +extern struct unkStruct_61CC04 gUnknown_0861CC10; +extern struct unkStruct_61CC04 gUnknown_0861CBEC; +extern struct unkStruct_61CC04 gUnknown_0861CBF8; +extern u16 gUnknown_08DC3CD4[]; extern void sub_806F2AC(u8 a, u8 b); void sub_81C488C(u8 a); @@ -33,7 +41,6 @@ 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; @@ -53,6 +60,7 @@ 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 void sub_81C1E20(u8 taskId); extern u32 ChangeBgX(u8 bg, u32 value, u8 op); @@ -79,10 +87,10 @@ void sub_81C0510(u8 taskId); void sub_81C171C(u8 taskId); void sub_8121E10(); u8 sub_81B205C(struct Pokemon* a); -void sub_81C1DA4(u8 a, s16 b); -void sub_81C1EFC(u8 a, s16 b, u16 c); +void sub_81C1DA4(u16 a, s16 b); +void sub_81C1EFC(u16 a, s16 b, u16 c); void sub_81C240C(u16 a); -void sub_81C2194(void* a, u8 b, u8 c); +void sub_81C2194(u16 *a, u16 b, u8 c); void sub_81C2074(u16 a, s16 b); void sub_81C2524(); void sub_81C2228(struct Pokemon* poke); @@ -128,6 +136,13 @@ void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b); void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); void sub_81C40A0(u8 a, u8 b); void sub_81C4568(u8 a, u8 b); +void sub_81C174C(u8 taskId); +u8 sub_81C18A8(); +void sub_81C18F4(u8 a); +u8 sub_81B6D14(u16 a); +void sub_81C1940(u8 taskId); +void sub_81C4154(); +void sub_81C1F80(u8 taskId); void SetBgAttribute(u8 bg, u8 attributeId, u8 value); @@ -184,14 +199,14 @@ struct unkSummaryStruct /*0x08*/ void *unk8; /*0x0C*/ struct Pokemon currentPoke; /*0x70*/ 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]; + u16 unkTilemap0[0x400]; + u16 unkTilemap0_1[0x400]; + u16 unkTilemap1[0x400]; + u16 unkTilemap1_1[0x400]; + u16 unkTilemap2[0x400]; + u16 unkTilemap2_1[0x400]; + u16 unkTilemap3[0x400]; + u16 unkTilemap3_1[0x400]; u8 unk40BC; u8 unk40BD; u8 unk40BE; @@ -597,8 +612,8 @@ void sub_81C0348(void) else { sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2, 3, 0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3, 1, 0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 0); SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap3); SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap2); ChangeBgX(2, 0x10000, 1); @@ -1013,8 +1028,8 @@ void sub_81C0E48(u8 taskId) ClearWindowTilemap(5); PutWindowTilemap(6); } - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2, 3, 0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3, 1, 0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 0); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 0); sub_81C3E9C(move); sub_81C3F44(); sub_81C44F0(); @@ -1139,8 +1154,8 @@ void sub_81C11F4(u8 taskId) ClearWindowTilemap(6); PutWindowTilemap(5); sub_81C3E9C(0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2, 3, 1); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3, 1, 1); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 1); + sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 1); sub_81C4064(); if (gUnknown_0203CF1C->unk40C6 != 4) { @@ -1225,24 +1240,20 @@ void sub_81C13B0(u8 taskId, u8 b) } -/* void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) +#ifdef NONMATCHING +void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) { - u16* moveToPtr; - u8 r8; - u8 r2; - u8 r12; - u8 r1; u16 localMoveTo; u16 localMoveFrom; u8 localPpTo; u8 localPpFrom; u8 localPpBonuses; - u16* moveFromPtr; + u16* moveToPtr; u8* ppFromPtr; u8* ppToPtr; u8* ppBonusesPtr; - + moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; localMoveFrom = *moveFromPtr; @@ -1251,28 +1262,31 @@ void sub_81C13B0(u8 taskId, u8 b) ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; localPpFrom = *ppFromPtr; + ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId]; localPpTo = *ppToPtr; ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses; localPpBonuses = *ppBonusesPtr; - r8 = gUnknown_08329D22[swappingFromId]; - r2 = (int)(localPpBonuses & r8) >> (swappingFromId << 1); - r12 = gUnknown_08329D22[swappingToId]; - r1 = (int)(localPpBonuses & r12) >> (swappingToId << 1); - localPpBonuses &= ~r8; - localPpBonuses &= ~r12; - r2 = r2 << (swappingToId << 1); - r1 = r1 << (swappingFromId << 1); - r2 += r1; - localPpBonuses |= r2; +{ + u8 bitsFrom, bitsTo; - SetMonData(mon, swappingFromId + MON_DATA_MOVE1, moveToPtr); - SetMonData(mon, swappingToId + MON_DATA_MOVE1, moveFromPtr); + bitsFrom = (localPpBonuses & gUnknown_08329D22[swappingFromId]) >> (swappingFromId << 1); + bitsTo = (localPpBonuses & gUnknown_08329D22[swappingToId]) >> (swappingToId << 1); - SetMonData(mon, swappingFromId + MON_DATA_PP1, ppToPtr); - SetMonData(mon, swappingToId + MON_DATA_PP1, ppFromPtr); + + localPpBonuses &= ~(gUnknown_08329D22[swappingFromId]); + localPpBonuses &= ~(gUnknown_08329D22[swappingToId]); + + localPpBonuses |= ((bitsFrom << (swappingToId << 1)) + (bitsTo << (swappingToId << 1))); +} + + SetMonData(mon, swappingFromId + MON_DATA_MOVE1, &localMoveTo); + SetMonData(mon, swappingToId + MON_DATA_MOVE1, &localMoveFrom); + + SetMonData(mon, swappingFromId + MON_DATA_PP1, &localPpTo); + SetMonData(mon, swappingToId + MON_DATA_PP1, &localPpFrom); SetMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses); @@ -1283,4 +1297,926 @@ void sub_81C13B0(u8 taskId, u8 b) *ppToPtr = localPpFrom; *ppBonusesPtr = localPpBonuses; +} +#else +__attribute__((naked)) +void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x28\n\ + adds r7, r0, 0\n\ + adds r4, r1, 0\n\ + adds r6, r2, 0\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r6, 24\n\ + lsrs r6, 24\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r2, [r0]\n\ + lsls r0, r4, 1\n\ + mov r10, r0\n\ + adds r1, r2, 0\n\ + adds r1, 0x84\n\ + adds r0, r1, r0\n\ + str r0, [sp, 0x8]\n\ + ldrh r0, [r0]\n\ + mov r3, sp\n\ + adds r3, 0x2\n\ + str r3, [sp, 0x1C]\n\ + strh r0, [r3]\n\ + lsls r0, r6, 1\n\ + mov r9, r0\n\ + add r1, r9\n\ + str r1, [sp, 0xC]\n\ + ldrh r1, [r1]\n\ + mov r0, sp\n\ + strh r1, [r0]\n\ + adds r1, r2, 0\n\ + adds r1, 0x8C\n\ + adds r3, r1, r4\n\ + str r3, [sp, 0x10]\n\ + ldrb r0, [r3]\n\ + mov r3, sp\n\ + adds r3, 0x5\n\ + str r3, [sp, 0x24]\n\ + strb r0, [r3]\n\ + adds r1, r6\n\ + str r1, [sp, 0x14]\n\ + ldrb r0, [r1]\n\ + mov r1, sp\n\ + adds r1, 0x4\n\ + str r1, [sp, 0x20]\n\ + strb r0, [r1]\n\ + adds r2, 0xA4\n\ + str r2, [sp, 0x18]\n\ + ldrb r0, [r2]\n\ + mov r5, sp\n\ + adds r5, 0x6\n\ + strb r0, [r5]\n\ + ldr r1, =gUnknown_08329D22\n\ + adds r0, r4, r1\n\ + ldrb r0, [r0]\n\ + mov r8, r0\n\ + ldrb r0, [r5]\n\ + adds r2, r0, 0\n\ + mov r3, r8\n\ + ands r2, r3\n\ + mov r3, r10\n\ + asrs r2, r3\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + adds r1, r6, r1\n\ + ldrb r1, [r1]\n\ + mov r12, r1\n\ + adds r1, r0, 0\n\ + mov r3, r12\n\ + ands r1, r3\n\ + mov r3, r9\n\ + asrs r1, r3\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r3, r8\n\ + bics r0, r3\n\ + strb r0, [r5]\n\ + ldrb r0, [r5]\n\ + mov r3, r12\n\ + bics r0, r3\n\ + strb r0, [r5]\n\ + mov r0, r9\n\ + lsls r2, r0\n\ + mov r3, r10\n\ + lsls r1, r3\n\ + adds r2, r1\n\ + ldrb r0, [r5]\n\ + orrs r0, r2\n\ + strb r0, [r5]\n\ + adds r1, r4, 0\n\ + adds r1, 0xD\n\ + adds r0, r7, 0\n\ + mov r2, sp\n\ + bl SetMonData\n\ + adds r1, r6, 0\n\ + adds r1, 0xD\n\ + adds r0, r7, 0\n\ + ldr r2, [sp, 0x1C]\n\ + bl SetMonData\n\ + adds r4, 0x11\n\ + adds r0, r7, 0\n\ + adds r1, r4, 0\n\ + ldr r2, [sp, 0x20]\n\ + bl SetMonData\n\ + adds r6, 0x11\n\ + adds r0, r7, 0\n\ + adds r1, r6, 0\n\ + ldr r2, [sp, 0x24]\n\ + bl SetMonData\n\ + adds r0, r7, 0\n\ + movs r1, 0x15\n\ + adds r2, r5, 0\n\ + bl SetMonData\n\ + mov r0, sp\n\ + ldrh r0, [r0]\n\ + ldr r1, [sp, 0x8]\n\ + strh r0, [r1]\n\ + ldr r3, [sp, 0x1C]\n\ + ldrh r0, [r3]\n\ + ldr r1, [sp, 0xC]\n\ + strh r0, [r1]\n\ + ldr r3, [sp, 0x20]\n\ + ldrb r0, [r3]\n\ + ldr r1, [sp, 0x10]\n\ + strb r0, [r1]\n\ + ldr r3, [sp, 0x24]\n\ + ldrb r0, [r3]\n\ + ldr r1, [sp, 0x14]\n\ + strb r0, [r1]\n\ + ldrb r0, [r5]\n\ + ldr r3, [sp, 0x18]\n\ + strb r0, [r3]\n\ + add sp, 0x28\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) +{ + u16 localMoveTo; + u16 localMoveFrom; + u8 localPpTo; + u8 localPpFrom; + u8 localPpBonuses; + u16* moveFromPtr; + u16* moveToPtr; + u8* ppFromPtr; + u8* ppToPtr; + u8* ppBonusesPtr; + + moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; + localMoveFrom = *moveFromPtr; + + moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId]; + localMoveTo = *moveToPtr; + + ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; + localPpFrom = *ppFromPtr; + + ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId]; + localPpTo = *ppToPtr; + + ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses; + localPpBonuses = *ppBonusesPtr; + +{ + u8 bitsFrom, bitsTo; + + bitsFrom = (localPpBonuses & gUnknown_08329D22[swappingFromId]) >> (swappingFromId << 1); + bitsTo = (localPpBonuses & gUnknown_08329D22[swappingToId]) >> (swappingToId << 1); + + + localPpBonuses &= ~(gUnknown_08329D22[swappingFromId]); + localPpBonuses &= ~(gUnknown_08329D22[swappingToId]); + + localPpBonuses |= ((bitsFrom << (swappingToId << 1)) + (bitsTo << (swappingToId << 1))); +} + + SetBoxMonData(mon, swappingFromId + MON_DATA_MOVE1, &localMoveTo); + SetBoxMonData(mon, swappingToId + MON_DATA_MOVE1, &localMoveFrom); + + SetBoxMonData(mon, swappingFromId + MON_DATA_PP1, &localPpTo); + SetBoxMonData(mon, swappingToId + MON_DATA_PP1, &localPpFrom); + + SetBoxMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses); + + *moveFromPtr = localMoveTo; + *moveToPtr = localMoveFrom; + + *ppFromPtr = localPpTo; + *ppToPtr = localPpFrom; + + *ppBonusesPtr = localPpBonuses; +} +#else +__attribute__((naked)) +void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x28\n\ + adds r7, r0, 0\n\ + adds r4, r1, 0\n\ + adds r6, r2, 0\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r6, 24\n\ + lsrs r6, 24\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r2, [r0]\n\ + lsls r0, r4, 1\n\ + mov r10, r0\n\ + adds r1, r2, 0\n\ + adds r1, 0x84\n\ + adds r0, r1, r0\n\ + str r0, [sp, 0x8]\n\ + ldrh r0, [r0]\n\ + mov r3, sp\n\ + adds r3, 0x2\n\ + str r3, [sp, 0x1C]\n\ + strh r0, [r3]\n\ + lsls r0, r6, 1\n\ + mov r9, r0\n\ + add r1, r9\n\ + str r1, [sp, 0xC]\n\ + ldrh r1, [r1]\n\ + mov r0, sp\n\ + strh r1, [r0]\n\ + adds r1, r2, 0\n\ + adds r1, 0x8C\n\ + adds r3, r1, r4\n\ + str r3, [sp, 0x10]\n\ + ldrb r0, [r3]\n\ + mov r3, sp\n\ + adds r3, 0x5\n\ + str r3, [sp, 0x24]\n\ + strb r0, [r3]\n\ + adds r1, r6\n\ + str r1, [sp, 0x14]\n\ + ldrb r0, [r1]\n\ + mov r1, sp\n\ + adds r1, 0x4\n\ + str r1, [sp, 0x20]\n\ + strb r0, [r1]\n\ + adds r2, 0xA4\n\ + str r2, [sp, 0x18]\n\ + ldrb r0, [r2]\n\ + mov r5, sp\n\ + adds r5, 0x6\n\ + strb r0, [r5]\n\ + ldr r1, =gUnknown_08329D22\n\ + adds r0, r4, r1\n\ + ldrb r0, [r0]\n\ + mov r8, r0\n\ + ldrb r0, [r5]\n\ + adds r2, r0, 0\n\ + mov r3, r8\n\ + ands r2, r3\n\ + mov r3, r10\n\ + asrs r2, r3\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + adds r1, r6, r1\n\ + ldrb r1, [r1]\n\ + mov r12, r1\n\ + adds r1, r0, 0\n\ + mov r3, r12\n\ + ands r1, r3\n\ + mov r3, r9\n\ + asrs r1, r3\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r3, r8\n\ + bics r0, r3\n\ + strb r0, [r5]\n\ + ldrb r0, [r5]\n\ + mov r3, r12\n\ + bics r0, r3\n\ + strb r0, [r5]\n\ + mov r0, r9\n\ + lsls r2, r0\n\ + mov r3, r10\n\ + lsls r1, r3\n\ + adds r2, r1\n\ + ldrb r0, [r5]\n\ + orrs r0, r2\n\ + strb r0, [r5]\n\ + adds r1, r4, 0\n\ + adds r1, 0xD\n\ + adds r0, r7, 0\n\ + mov r2, sp\n\ + bl SetBoxMonData\n\ + adds r1, r6, 0\n\ + adds r1, 0xD\n\ + adds r0, r7, 0\n\ + ldr r2, [sp, 0x1C]\n\ + bl SetBoxMonData\n\ + adds r4, 0x11\n\ + adds r0, r7, 0\n\ + adds r1, r4, 0\n\ + ldr r2, [sp, 0x20]\n\ + bl SetBoxMonData\n\ + adds r6, 0x11\n\ + adds r0, r7, 0\n\ + adds r1, r6, 0\n\ + ldr r2, [sp, 0x24]\n\ + bl SetBoxMonData\n\ + adds r0, r7, 0\n\ + movs r1, 0x15\n\ + adds r2, r5, 0\n\ + bl SetBoxMonData\n\ + mov r0, sp\n\ + ldrh r0, [r0]\n\ + ldr r1, [sp, 0x8]\n\ + strh r0, [r1]\n\ + ldr r3, [sp, 0x1C]\n\ + ldrh r0, [r3]\n\ + ldr r1, [sp, 0xC]\n\ + strh r0, [r1]\n\ + ldr r3, [sp, 0x20]\n\ + ldrb r0, [r3]\n\ + ldr r1, [sp, 0x10]\n\ + strb r0, [r1]\n\ + ldr r3, [sp, 0x24]\n\ + ldrb r0, [r3]\n\ + ldr r1, [sp, 0x14]\n\ + strb r0, [r1]\n\ + ldrb r0, [r5]\n\ + ldr r3, [sp, 0x18]\n\ + strb r0, [r3]\n\ + add sp, 0x28\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C171C(u8 taskId) +{ + sub_81C44F0(); + sub_81C4AF8(8); + gTasks[taskId].func = sub_81C174C; +} + +void sub_81C174C(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (sub_81221EC() != 1) + { + if (gPaletteFade.active != 1) + { + if (gMain.newKeys & DPAD_UP) + { + data[0] = 4; + sub_81C1070(data, -1, &gUnknown_0203CF1C->unk40C6); + } + else if (gMain.newKeys & DPAD_DOWN) + { + data[0] = 4; + sub_81C1070(data, 1, &gUnknown_0203CF1C->unk40C6); + } + 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 (sub_81C18A8() == 1) + { + sub_81C48F0(); + PlaySE(SE_SELECT); + gUnknown_0203CF21 = gUnknown_0203CF1C->unk40C6; + gSpecialVar_0x8005 = gUnknown_0203CF21; + sub_81C044C(taskId); + } + else + { + PlaySE(0x20); + sub_81C18F4(taskId); + } + } + else if (gMain.newKeys & B_BUTTON) + { + u32 var1; + sub_81C48F0(); + PlaySE(SE_SELECT); + gUnknown_0203CF21 = 4; + gSpecialVar_0x8005 = 4; + sub_81C044C(taskId); + } + } + } +} + +u8 sub_81C18A8() +{ + if (gUnknown_0203CF1C->unk40C6 == 4 || gUnknown_0203CF1C->unk40C4 == 0 || sub_81B6D14(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]) != 1) + return 1; + else + return 0; +} + +void sub_81C18F4(u8 taskId) +{ + ClearWindowTilemap(14); + ClearWindowTilemap(15); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C1DA4(0, 3); + sub_81C1EFC(0, 3, 0); + sub_81C4154(); + gTasks[taskId].func = sub_81C1940; +} + +void sub_81C1940(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16 move; + if (FuncIsActiveTask(sub_81C1E20) != 1) + { + if (gMain.newKeys & DPAD_UP) + { + data[1] = 1; + data[0] = 4; + sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->unk40C6); + data[1] = 0; + gTasks[taskId].func = sub_81C174C; + } + else if (gMain.newKeys & DPAD_DOWN) + { + data[1] = 1; + data[0] = 4; + sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->unk40C6); + data[1] = 0; + gTasks[taskId].func = sub_81C174C; + } + else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) + { + if (gUnknown_0203CF1C->unk40C0 != 2) + { + + ClearWindowTilemap(19); + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + ClearWindowTilemap(13); + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + gTasks[taskId].func = sub_81C174C; + sub_81C0A8C(taskId, -1); + sub_81C1DA4(9, -2); + sub_81C1EFC(9, -2, move); + } + } + else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2) + { + if (gUnknown_0203CF1C->unk40C0 != 3) + { + ClearWindowTilemap(19); + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + ClearWindowTilemap(13); + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + gTasks[taskId].func = sub_81C174C; + sub_81C0A8C(taskId, 1); + sub_81C1DA4(9, -2); + sub_81C1EFC(9, -2, move); + } + } + else if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + ClearWindowTilemap(19); + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + ClearWindowTilemap(13); + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + sub_81C3E9C(move); + schedule_bg_copy_tilemap_to_vram(0); + sub_81C1DA4(9, -3); + sub_81C1EFC(9, -3, move); + gTasks[taskId].func = sub_81C174C; + } + } +} + +u8 sub_81C1B94() +{ + return gUnknown_0203CF21; +} + +void sub_81C1BA0() +{ + u16 *alloced = Alloc(32); + u8 i; + for (i = 0; i < 4; i++) + { + u8 j = i << 1; + if (i < gUnknown_0203CF1C->unk40C1) + { + alloced[j+0] = 0x40; + alloced[j+1] = 0x40; + alloced[j+8] = 0x50; + alloced[j+9] = 0x50; + } + else if (i > gUnknown_0203CF1C->unk40C2) + { + alloced[j+0] = 0x4A; + alloced[j+1] = 0x4A; + alloced[j+8] = 0x5A; + alloced[j+9] = 0x5A; + } + else if (i < gUnknown_0203CF1C->unk40C0) + { + alloced[j+0] = 0x46; + alloced[j+1] = 0x47; + alloced[j+8] = 0x56; + alloced[j+9] = 0x57; + } + else if (i == gUnknown_0203CF1C->unk40C0) + { + if (i != gUnknown_0203CF1C->unk40C2) + { + alloced[j+0] = 0x41; + alloced[j+1] = 0x42; + alloced[j+8] = 0x51; + alloced[j+9] = 0x52; + } + else + { + alloced[j+0] = 0x4B; + alloced[j+1] = 0x4C; + alloced[j+8] = 0x5B; + alloced[j+9] = 0x5C; + } + } + else if (i != gUnknown_0203CF1C->unk40C2) + { + alloced[j+0] = 0x43; + alloced[j+1] = 0x44; + alloced[j+8] = 0x53; + alloced[j+9] = 0x54; + } + else + { + alloced[j+0] = 0x48; + alloced[j+1] = 0x49; + alloced[j+8] = 0x58; + alloced[j+9] = 0x59; + } + } + CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16); + schedule_bg_copy_tilemap_to_vram(3); + Free(alloced); +} + +struct unkStruct_61CC04 +{ + u8 *ptr; + u8 field_4; + u8 field_5; + u8 field_6; + u8 field_7; + u8 field_8; + u8 field_9; +}; + +#ifdef NONMATCHING +void sub_81C1CB0(struct unkStruct_61CC04 *a, u16 *b, u8 c, u8 d) +{ + u8 *alloced = Alloc(a->field_6 * (a->field_7 << 1)); + CpuFill16(a->field_4, alloced, a->field_7*a->field_6); + if (a->field_6 != c) + { + if (!d) + { + for (d;d < a->field_7; d++) + { + CpuCopy16(&a->ptr + ((c + a->field_6*d)), alloced + ((a->field_6*d) << 1), (a->field_6 - c) * 2); + } + } + else + { + for (d = 0;d < a->field_7; d++) + { + CpuCopy16(&a->ptr + (a->field_6*d), alloced + ((c + a->field_6*d) << 1), (a->field_6 - c) * 2); + } + } + } + d = 0; + while (d < a->field_7) + { + CpuCopy16(alloced + ((a->field_6*d) << 1), b + ((((a->field_9 + d) << 5) + a->field_8) << 1), a->field_6 * 2); + d++; + } + Free(alloced); +} +#else +__attribute__((naked)) +void sub_81C1CB0(struct unkStruct_61CC04 *a, u16 *b, u8 c, u8 d) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0x4\n\ + adds r4, r0, 0\n\ + mov r8, r1\n\ + lsls r2, 24\n\ + lsrs r6, r2, 24\n\ + lsls r3, 24\n\ + lsrs r5, r3, 24\n\ + ldrb r1, [r4, 0x6]\n\ + ldrb r0, [r4, 0x7]\n\ + lsls r0, 1\n\ + muls r0, r1\n\ + bl Alloc\n\ + adds r7, r0, 0\n\ + mov r1, sp\n\ + ldrh r0, [r4, 0x4]\n\ + strh r0, [r1]\n\ + ldrb r1, [r4, 0x7]\n\ + ldrb r0, [r4, 0x6]\n\ + adds r2, r1, 0\n\ + muls r2, r0\n\ + movs r0, 0x80\n\ + lsls r0, 17\n\ + orrs r2, r0\n\ + mov r0, sp\n\ + adds r1, r7, 0\n\ + bl CpuSet\n\ + ldrb r0, [r4, 0x6]\n\ + cmp r0, r6\n\ + beq _081C1D60\n\ + cmp r5, 0\n\ + bne _081C1D30\n\ + movs r5, 0\n\ + ldrb r0, [r4, 0x7]\n\ + cmp r5, r0\n\ + bcs _081C1D60\n\ +_081C1D00:\n\ + ldrb r2, [r4, 0x6]\n\ + adds r1, r2, 0\n\ + muls r1, r5\n\ + adds r3, r6, r1\n\ + lsls r3, 1\n\ + ldr r0, [r4]\n\ + adds r0, r3\n\ + lsls r1, 1\n\ + adds r1, r7, r1\n\ + subs r2, r6\n\ + ldr r3, =0x001fffff\n\ + ands r2, r3\n\ + bl CpuSet\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ + ldrb r3, [r4, 0x7]\n\ + cmp r5, r3\n\ + bcc _081C1D00\n\ + b _081C1D60\n\ + .pool\n\ +_081C1D30:\n\ + movs r5, 0\n\ + ldrb r0, [r4, 0x7]\n\ + cmp r5, r0\n\ + bcs _081C1D60\n\ +_081C1D38:\n\ + ldrb r2, [r4, 0x6]\n\ + adds r1, r2, 0\n\ + muls r1, r5\n\ + lsls r3, r1, 1\n\ + ldr r0, [r4]\n\ + adds r0, r3\n\ + adds r1, r6, r1\n\ + lsls r1, 1\n\ + adds r1, r7, r1\n\ + subs r2, r6\n\ + ldr r3, =0x001fffff\n\ + ands r2, r3\n\ + bl CpuSet\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ + ldrb r3, [r4, 0x7]\n\ + cmp r5, r3\n\ + bcc _081C1D38\n\ +_081C1D60:\n\ + movs r5, 0\n\ + b _081C1D8A\n\ + .pool\n\ +_081C1D68:\n\ + ldrb r2, [r4, 0x6]\n\ + adds r0, r2, 0\n\ + muls r0, r5\n\ + lsls r0, 1\n\ + adds r0, r7, r0\n\ + ldrb r1, [r4, 0x9]\n\ + adds r1, r5\n\ + lsls r1, 5\n\ + ldrb r3, [r4, 0x8]\n\ + adds r1, r3\n\ + lsls r1, 1\n\ + add r1, r8\n\ + bl CpuSet\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ +_081C1D8A:\n\ + ldrb r0, [r4, 0x7]\n\ + cmp r5, r0\n\ + bcc _081C1D68\n\ + adds r0, r7, 0\n\ + bl Free\n\ + add sp, 0x4\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided\n"); +} +#endif + +void sub_81C1DA4(u16 a, s16 b) +{ + if (b > gUnknown_0861CC04.field_6) + b = gUnknown_0861CC04.field_6; + if (b == 0 || b == gUnknown_0861CC04.field_6) + { + sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->unkTilemap2[0], b, 1); + } + else + { + u8 taskId = FindTaskIdByFunc(sub_81C1E20); + if (taskId == 0xFF) + { + taskId = CreateTask(sub_81C1E20, 8); + } + gTasks[taskId].data[0] = b; + gTasks[taskId].data[1] = a; + } +} + +void sub_81C1E20(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[1] += data[0]; + if (data[1] < 0) + { + data[1] = 0; + } + else if (data[1] > gUnknown_0861CC04.field_6) + { + data[1] = gUnknown_0861CC04.field_6; + } + sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->unkTilemap2[0], data[1], 1); + if (data[1] <= 0 || data[1] >= gUnknown_0861CC04.field_6) + { + if (data[0] < 0) + { + if (gUnknown_0203CF1C->unk40C0 == 2) + PutWindowTilemap(14); + + } + else + { + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + PutWindowTilemap(13); + PutWindowTilemap(19); + } + schedule_bg_copy_tilemap_to_vram(0); + DestroyTask(taskId); + } + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81C1EFC(u16 a, s16 b, u16 move) +{ + if (b > gUnknown_0861CC10.field_6) + b = gUnknown_0861CC10.field_6; + if (b == 0 || b == gUnknown_0861CC10.field_6) + sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->unkTilemap3[0], b, 1); + else + { + u8 taskId = FindTaskIdByFunc(sub_81C1F80); + if (taskId == 0xFF) + taskId = CreateTask(sub_81C1F80, 8); + gTasks[taskId].data[0] = b; + gTasks[taskId].data[1] = a; + gTasks[taskId].data[2] = move; + } +} + +void sub_81C1F80(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[1] += data[0]; + if (data[1] < 0) + { + data[1] = 0; + } + else if (data[1] > gUnknown_0861CC10.field_6) + { + data[1] = gUnknown_0861CC10.field_6; + } + sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->unkTilemap3[0], data[1], 1); + if (data[1] <= 0 || data[1] >= gUnknown_0861CC10.field_6) + { + if (data[0] < 0) + { + if (gUnknown_0203CF1C->unk40C0 == 3 && FuncIsActiveTask(sub_81C0B8C) == 0) + PutWindowTilemap(15); + sub_81C240C(data[2]); + } + else + { + if (!gSprites[gUnknown_0203CF1C->unk40D5].invisible) + { + PutWindowTilemap(13); + } + PutWindowTilemap(19); + } + schedule_bg_copy_tilemap_to_vram(0); + DestroyTask(taskId); + } + schedule_bg_copy_tilemap_to_vram(1); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81C2074(u16 a, s16 b) +{ + if (b > gUnknown_0861CBEC.field_6) + b = gUnknown_0861CBEC.field_6; + if (b == 0 || b == gUnknown_0861CBEC.field_6) + { + sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->unkTilemap0[0], b, 0); + sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->unkTilemap0[0], b, 0); + } + else + { + u8 taskId = CreateTask(sub_81C20F0, 8); + gTasks[taskId].data[0] = b; + gTasks[taskId].data[1] = a; + } +} + +void sub_81C20F0(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[1] += data[0]; + if (data[1] < 0) + data[1] = 0; + else if (data[1] > gUnknown_0861CBEC.field_6) + data[1] = gUnknown_0861CBEC.field_6; + sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->unkTilemap0[0], data[1], 0); + sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->unkTilemap0[0], data[1], 0); + schedule_bg_copy_tilemap_to_vram(3); + if (data[1] <= 0 || data[1] >= gUnknown_0861CBEC.field_6) + { + if (data[0] < 0) + { + sub_81C4A88(); + PutWindowTilemap(13); + schedule_bg_copy_tilemap_to_vram(0); + } + DestroyTask(taskId); + } +} + +/* void sub_81C2194(u16 *a, u16 b, u8 c) +{ + u16 i; + int var; + b *= 0x1000; + var = 0x56A; + + if (c == 0) + { + for (i = 0; i < 20; i++) + { + a[(i + var) << 1] = gUnknown_08DC3CD4[i] + b; + a[((i + var) << 1) + 0x40] = gUnknown_08DC3CD4[i] + b; + a[((i + var) << 1) + 0x80] = gUnknown_08DC3CD4[i + 20] + b; + } + } + else + { + for (i = 0; i < 20; i++) + { + a[(i + var)] = gUnknown_08DC3CD4[i + 20] + b; + a[((i + var)) + 0x40] = gUnknown_08DC3CD4[i + 40] + b; + a[((i + var)) + 0x80] = gUnknown_08DC3CD4[i + 40] + b; + } + } } */ \ No newline at end of file From 42f633cbf4c774924c8ace0a09587c18d13fd48f Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Mon, 9 Oct 2017 16:00:18 -0400 Subject: [PATCH 10/21] (un)fix battle.h --- include/battle.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/battle.h b/include/battle.h index 2a864d6aa2..10cdfaa735 100644 --- a/include/battle.h +++ b/include/battle.h @@ -271,8 +271,6 @@ #define CMP_COMMON_BITS 0x4 #define CMP_NO_COMMON_BITS 0x5 -#include "global.h" - struct TrainerMonNoItemDefaultMoves { u16 iv; From f6f81f34b19730039e54eccb38511cdffd1b5217 Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Mon, 9 Oct 2017 16:49:14 -0400 Subject: [PATCH 11/21] decompiled up to sub_81C228C --- asm/pokemon_summary_screen.s | 152 ----------------------------------- src/pokemon_summary_screen.c | 111 ++++++++++++++++++++++++- 2 files changed, 109 insertions(+), 154 deletions(-) diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 345d762673..7ca5f879a7 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,158 +5,6 @@ .text - thumb_func_start sub_81C2194 -sub_81C2194: @ 81C2194 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r2, 24 - lsls r1, 28 - lsrs r4, r1, 16 - ldr r7, =0x0000056a - cmp r2, 0 - bne _081C21E4 - movs r3, 0 - ldr r5, =gUnknown_08DC3CD4 -_081C21A8: - adds r2, r7, r3 - lsls r2, 1 - adds r2, r6 - lsls r0, r3, 1 - adds r0, r5 - ldrh r1, [r0] - adds r1, r4, r1 - strh r1, [r2] - adds r0, r2, 0 - adds r0, 0x40 - strh r1, [r0] - adds r2, 0x80 - adds r0, r3, 0 - adds r0, 0x14 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - adds r0, r4, r0 - strh r0, [r2] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x13 - bls _081C21A8 - b _081C221C - .pool -_081C21E4: - movs r3, 0 - ldr r5, =gUnknown_08DC3CD4 -_081C21E8: - adds r1, r7, r3 - lsls r1, 1 - adds r1, r6 - adds r0, r3, 0 - adds r0, 0x14 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - adds r0, r4, r0 - strh r0, [r1] - adds r2, r1, 0 - adds r2, 0x40 - adds r0, r3, 0 - adds r0, 0x28 - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - adds r0, r4, r0 - strh r0, [r2] - adds r1, 0x80 - strh r0, [r1] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x13 - bls _081C21E8 -_081C221C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2194 - - thumb_func_start sub_81C2228 -sub_81C2228: @ 81C2228 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - bl CheckPartyPokerus - lsls r0, 24 - cmp r0, 0 - bne _081C225C - adds r0, r4, 0 - movs r1, 0 - bl CheckPartyHasHadPokerus - lsls r0, 24 - cmp r0, 0 - beq _081C225C - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x00000502 - adds r1, r0, r2 - movs r2, 0x2C - b _081C2266 - .pool -_081C225C: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r2, =0x00000502 - adds r1, r0, r2 - ldr r2, =0x0000081a -_081C2266: - strh r2, [r1] - ldr r1, =0x00000d02 - adds r0, r1 - strh r2, [r0] - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2228 - - thumb_func_start sub_81C228C -sub_81C228C: @ 81C228C - push {lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _081C22AC - movs r0, 0x8 - str r0, [sp] - str r1, [sp, 0x4] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x8 - bl sub_8199C30 - b _081C22C0 -_081C22AC: - movs r0, 0x8 - str r0, [sp] - movs r0, 0x5 - str r0, [sp, 0x4] - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x8 - bl sub_8199C30 -_081C22C0: - movs r0, 0x3 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_81C228C - thumb_func_start sub_81C22CC sub_81C22CC: @ 81C22CC push {r4-r7,lr} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 5733e1d903..4c748073e9 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -63,6 +63,7 @@ extern void sub_8069004(struct BoxPokemon* a, void* b); extern void sub_81C1E20(u8 taskId); extern u32 ChangeBgX(u8 bg, u32 value, u8 op); +extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f); void sub_81BFAE4(void); void sub_81BFE24(); @@ -2194,7 +2195,9 @@ void sub_81C20F0(u8 taskId) } } -/* void sub_81C2194(u16 *a, u16 b, u8 c) +// somebody send help this is a complete fucking mess +#ifdef NONMATCHING +void sub_81C2194(u16 *a, u16 b, u8 c) { u16 i; int var; @@ -2219,4 +2222,108 @@ void sub_81C20F0(u8 taskId) a[((i + var)) + 0x80] = gUnknown_08DC3CD4[i + 40] + b; } } -} */ \ No newline at end of file +} +#else +__attribute__((naked)) +void sub_81C2194(u16 *a, u16 b, u8 c) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + adds r6, r0, 0\n\ + lsls r2, 24\n\ + lsls r1, 28\n\ + lsrs r4, r1, 16\n\ + ldr r7, =0x0000056a\n\ + cmp r2, 0\n\ + bne _081C21E4\n\ + movs r3, 0\n\ + ldr r5, =gUnknown_08DC3CD4\n\ +_081C21A8:\n\ + adds r2, r7, r3\n\ + lsls r2, 1\n\ + adds r2, r6\n\ + lsls r0, r3, 1\n\ + adds r0, r5\n\ + ldrh r1, [r0]\n\ + adds r1, r4, r1\n\ + strh r1, [r2]\n\ + adds r0, r2, 0\n\ + adds r0, 0x40\n\ + strh r1, [r0]\n\ + adds r2, 0x80\n\ + adds r0, r3, 0\n\ + adds r0, 0x14\n\ + lsls r0, 1\n\ + adds r0, r5\n\ + ldrh r0, [r0]\n\ + adds r0, r4, r0\n\ + strh r0, [r2]\n\ + adds r0, r3, 0x1\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + cmp r3, 0x13\n\ + bls _081C21A8\n\ + b _081C221C\n\ + .pool\n\ +_081C21E4:\n\ + movs r3, 0\n\ + ldr r5, =gUnknown_08DC3CD4\n\ +_081C21E8:\n\ + adds r1, r7, r3\n\ + lsls r1, 1\n\ + adds r1, r6\n\ + adds r0, r3, 0\n\ + adds r0, 0x14\n\ + lsls r0, 1\n\ + adds r0, r5\n\ + ldrh r0, [r0]\n\ + adds r0, r4, r0\n\ + strh r0, [r1]\n\ + adds r2, r1, 0\n\ + adds r2, 0x40\n\ + adds r0, r3, 0\n\ + adds r0, 0x28\n\ + lsls r0, 1\n\ + adds r0, r5\n\ + ldrh r0, [r0]\n\ + adds r0, r4, r0\n\ + strh r0, [r2]\n\ + adds r1, 0x80\n\ + strh r0, [r1]\n\ + adds r0, r3, 0x1\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + cmp r3, 0x13\n\ + bls _081C21E8\n\ +_081C221C:\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C2228(struct Pokemon *mon) +{ + if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0)) + { + gUnknown_0203CF1C->unkTilemap0[0x223] = 0x2C; + gUnknown_0203CF1C->unkTilemap0_1[0x223] = 0x2C; + } + else + { + gUnknown_0203CF1C->unkTilemap0[0x223] = 0x81A; + gUnknown_0203CF1C->unkTilemap0_1[0x223] = 0x81A; + } + schedule_bg_copy_tilemap_to_vram(3); +} + +void sub_81C228C(u8 a) +{ + if (a == 0) + sub_8199C30(3, 1, 4, 8, 8, 0); + else + sub_8199C30(3, 1, 4, 8, 8, 5); + schedule_bg_copy_tilemap_to_vram(3); +} \ No newline at end of file From 11f9a27640a9f921c6dc1858261d9a609a6599ca Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Wed, 18 Oct 2017 19:25:08 -0400 Subject: [PATCH 12/21] decompiled up to sub_81C3D54 --- asm/pokemon_summary_screen.s | 3095 ---------------------------------- src/pokemon_summary_screen.c | 1356 ++++++++++++++- 2 files changed, 1354 insertions(+), 3097 deletions(-) diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 7ca5f879a7..fd2518075e 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -5,3101 +5,6 @@ .text - thumb_func_start sub_81C22CC -sub_81C22CC: @ 81C22CC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r6, r1, 0 - adds r6, 0x70 - ldrb r1, [r6, 0x5] - mov r8, r0 - cmp r1, 0x63 - bhi _081C2340 - ldr r5, =gExperienceTables - adds r2, r1, 0 - adds r1, r2, 0x1 - lsls r1, 2 - ldr r4, =gBaseStats - ldrh r3, [r6] - lsls r0, r3, 3 - subs r0, r3 - lsls r0, 2 - adds r0, r4 - ldrb r3, [r0, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r3 - adds r1, r0 - adds r1, r5 - lsls r2, 2 - adds r2, r0 - adds r2, r5 - ldr r1, [r1] - ldr r2, [r2] - subs r1, r2 - ldr r0, [r6, 0x10] - subs r4, r0, r2 - lsls r0, r4, 6 - bl __udivsi3 - adds r6, r0, 0 - movs r7, 0 - adds r0, r7, 0 - orrs r0, r6 - cmp r0, 0 - bne _081C2344 - cmp r4, 0 - beq _081C2344 - movs r6, 0x1 - movs r7, 0 - b _081C2344 - .pool -_081C2340: - movs r6, 0 - movs r7, 0 -_081C2344: - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x00001d66 - adds r2, r0 - mov r9, r2 - movs r0, 0 - mov r12, r0 - ldr r1, =0x00002062 - mov r10, r1 -_081C2356: - cmp r7, 0 - bgt _081C2362 - cmp r7, 0 - bne _081C237C - cmp r6, 0x7 - bls _081C237C -_081C2362: - mov r2, r12 - lsls r0, r2, 1 - add r0, r9 - ldr r2, =0x0000206a - adds r1, r2, 0 - strh r1, [r0] - b _081C23B6 - .pool -_081C237C: - mov r1, r12 - lsls r0, r1, 1 - add r0, r9 - mov r8, r0 - adds r5, r7, 0 - adds r4, r6, 0 - cmp r7, 0 - bge _081C2394 - movs r4, 0x7 - movs r5, 0 - adds r4, r6 - adcs r5, r7 -_081C2394: - lsls r3, r5, 29 - lsrs r2, r4, 3 - adds r0, r3, 0 - orrs r0, r2 - asrs r1, r5, 3 - lsrs r5, r0, 29 - lsls r4, r1, 3 - adds r3, r5, 0 - orrs r3, r4 - lsls r2, r0, 3 - adds r1, r7, 0 - adds r0, r6, 0 - subs r0, r2 - sbcs r1, r3 - add r0, r10 - mov r2, r8 - strh r0, [r2] -_081C23B6: - movs r0, 0x8 - negs r0, r0 - asrs r1, r0, 31 - adds r6, r0 - adcs r7, r1 - cmp r7, 0 - bge _081C23C8 - movs r6, 0 - movs r7, 0 -_081C23C8: - mov r0, r12 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - cmp r0, 0x7 - bls _081C2356 - movs r0, 0x1 - bl GetBgTilemapBuffer - ldr r1, =gUnknown_0203CF1C - ldr r1, [r1] - ldr r2, =0x000010bc - adds r1, r2 - cmp r0, r1 - bne _081C23F8 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - b _081C23FE - .pool -_081C23F8: - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram -_081C23FE: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C22CC - - thumb_func_start sub_81C240C -sub_81C240C: @ 81C240C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 16 - lsrs r3, r0, 16 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000038bc - adds r5, r0, r1 - cmp r3, 0 - beq _081C2510 - ldr r1, =gContestEffects - ldr r2, =gContestMoves - lsls r3, 3 - adds r0, r3, r2 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldrb r4, [r0, 0x1] - mov r9, r1 - mov r8, r2 - mov r10, r3 - cmp r4, 0xFF - beq _081C244C - adds r0, r4, 0 - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r4, r0, 24 -_081C244C: - movs r2, 0 - movs r6, 0x3 - movs r3, 0xF3 - lsls r3, 2 -_081C2454: - cmp r4, 0xFF - beq _081C2484 - cmp r2, r4 - bcs _081C2484 - lsrs r0, r2, 2 - adds r1, r2, 0 - ands r1, r6 - lsls r0, 5 - adds r0, r1 - lsls r0, 1 - adds r0, r5 - adds r0, r3 - ldr r7, =0x0000103a - b _081C2496 - .pool -_081C2484: - lsrs r0, r2, 2 - adds r1, r2, 0 - ands r1, r6 - lsls r0, 5 - adds r0, r1 - lsls r0, 1 - adds r0, r5 - adds r0, r3 - ldr r7, =0x00001039 -_081C2496: - adds r1, r7, 0 - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _081C2454 - mov r0, r10 - add r0, r8 - ldrb r0, [r0] - lsls r0, 2 - add r0, r9 - ldrb r4, [r0, 0x2] - cmp r4, 0xFF - beq _081C24C0 - adds r0, r4, 0 - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r4, r0, 24 -_081C24C0: - movs r2, 0 - movs r6, 0x3 - ldr r3, =0x0000044c -_081C24C6: - cmp r4, 0xFF - beq _081C24F0 - cmp r2, r4 - bcs _081C24F0 - lsrs r0, r2, 2 - adds r1, r2, 0 - ands r1, r6 - lsls r0, 5 - adds r0, r1 - lsls r0, 1 - adds r0, r5 - adds r0, r3 - ldr r7, =0x0000103c - b _081C2502 - .pool -_081C24F0: - lsrs r0, r2, 2 - adds r1, r2, 0 - ands r1, r6 - lsls r0, 5 - adds r0, r1 - lsls r0, 1 - adds r0, r5 - adds r0, r3 - ldr r7, =0x0000103d -_081C2502: - adds r1, r7, 0 - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _081C24C6 -_081C2510: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C240C - - thumb_func_start sub_81C2524 -sub_81C2524: @ 81C2524 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x74 - ldrb r0, [r0] - cmp r0, 0 - beq _081C2544 - movs r1, 0x80 - lsls r1, 9 - movs r0, 0x3 - movs r2, 0 - bl ChangeBgX - b _081C254E - .pool -_081C2544: - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX -_081C254E: - pop {r0} - bx r0 - thumb_func_end sub_81C2524 - - thumb_func_start sub_81C2554 -sub_81C2554: @ 81C2554 - push {r4,r5,lr} - ldr r0, =gUnknown_0861CC24 - bl InitWindows - bl DeactivateAllTextPrinters - movs r4, 0 -_081C2562: - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x13 - bls _081C2562 - movs r4, 0 - ldr r5, =gUnknown_0203CF1C - ldr r3, =0x000040cb - movs r2, 0xFF -_081C257C: - ldr r0, [r5] - adds r0, r3 - adds r0, r4 - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _081C257C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2554 - - thumb_func_start sub_81C25A4 -sub_81C25A4: @ 81C25A4 - push {r4-r6,lr} - sub sp, 0x14 - ldr r4, [sp, 0x24] - ldr r5, [sp, 0x28] - lsls r0, 24 - lsrs r0, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - movs r6, 0 - str r6, [sp] - str r4, [sp, 0x4] - lsls r4, r5, 1 - adds r4, r5 - ldr r5, =gUnknown_0861CD2C - adds r4, r5 - str r4, [sp, 0x8] - str r6, [sp, 0xC] - str r1, [sp, 0x10] - movs r1, 0x1 - bl AddTextPrinterParametrized2 - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C25A4 - - thumb_func_start sub_81C25E8 -sub_81C25E8: @ 81C25E8 - push {lr} - movs r0, 0x11 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x12 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x13 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x74 - ldrb r0, [r0] - cmp r0, 0 - bne _081C2618 - bl sub_81C2628 - b _081C261C - .pool -_081C2618: - bl sub_81C2794 -_081C261C: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r0} - bx r0 - thumb_func_end sub_81C25E8 - - thumb_func_start sub_81C2628 -sub_81C2628: @ 81C2628 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - movs r1, 0xC - adds r1, r0 - mov r8, r1 - adds r7, r0, 0 - adds r7, 0x70 - ldrh r0, [r7] - bl SpeciesToPokedexNum - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _081C26CE - ldr r6, =gStringVar1 - ldr r1, =gText_UnkCtrlF908Clear01 - adds r0, r6, 0 - bl StringCopy - ldr r4, =gStringVar2 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0x2 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r0, r6, 0 - adds r1, r4, 0 - bl StringAppend - mov r0, r8 - bl IsMonShiny - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _081C26AC - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x11 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - movs r0, 0 - bl sub_81C228C - b _081C26C6 - .pool -_081C26AC: - movs r0, 0 - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0x11 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - movs r0, 0x1 - bl sub_81C228C -_081C26C6: - movs r0, 0x11 - bl PutWindowTilemap - b _081C26EE -_081C26CE: - movs r0, 0x11 - bl ClearWindowTilemap - mov r0, r8 - bl IsMonShiny - lsls r0, 24 - cmp r0, 0 - bne _081C26E8 - movs r0, 0 - bl sub_81C228C - b _081C26EE -_081C26E8: - movs r0, 0x1 - bl sub_81C228C -_081C26EE: - ldr r4, =gStringVar1 - ldr r1, =gText_LevelSymbol - adds r0, r4, 0 - bl StringCopy - ldr r5, =gStringVar2 - ldrb r1, [r7, 0x5] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r0, r4, 0 - adds r1, r5, 0 - bl StringAppend - movs r6, 0 - str r6, [sp] - movs r5, 0x1 - str r5, [sp, 0x4] - movs r0, 0x13 - adds r1, r4, 0 - movs r2, 0x18 - movs r3, 0x11 - bl sub_81C25A4 - mov r0, r8 - adds r1, r4, 0 - bl GetMonNickname - str r6, [sp] - str r5, [sp, 0x4] - movs r0, 0x12 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - add r1, sp, 0x8 - movs r0, 0xBA - strb r0, [r1] - mov r0, sp - adds r0, 0x9 - ldrh r2, [r7, 0x2] - movs r1, 0xB - muls r1, r2 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - str r6, [sp] - str r5, [sp, 0x4] - movs r0, 0x13 - add r1, sp, 0x8 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldrh r1, [r7, 0x2] - mov r0, r8 - bl sub_81C27DC - movs r0, 0x12 - bl PutWindowTilemap - movs r0, 0x13 - bl PutWindowTilemap - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2628 - - thumb_func_start sub_81C2794 -sub_81C2794: @ 81C2794 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0xC - ldr r4, =gStringVar1 - adds r1, r4, 0 - bl GetMonNickname - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x12 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - movs r0, 0x12 - bl PutWindowTilemap - movs r0, 0x11 - bl ClearWindowTilemap - movs r0, 0x13 - bl ClearWindowTilemap - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2794 - - thumb_func_start sub_81C27DC -sub_81C27DC: @ 81C27DC - push {lr} - sub sp, 0x8 - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0x20 - beq _081C282C - cmp r1, 0x1D - beq _081C282C - bl GetMonGender - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081C27FE - cmp r0, 0xFE - beq _081C2818 - b _081C282C -_081C27FE: - ldr r1, =gText_MaleSymbol - str r0, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - movs r0, 0x13 - movs r2, 0x39 - movs r3, 0x11 - bl sub_81C25A4 - b _081C282C - .pool -_081C2818: - ldr r1, =gText_FemaleSymbol - movs r0, 0 - str r0, [sp] - movs r0, 0x4 - str r0, [sp, 0x4] - movs r0, 0x13 - movs r2, 0x39 - movs r3, 0x11 - bl sub_81C25A4 -_081C282C: - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C27DC - - thumb_func_start sub_81C2838 -sub_81C2838: @ 81C2838 - push {r4,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - ldr r3, =gUnknown_0861CDD3 - cmp r1, 0 - bne _081C284A - subs r3, 0x80 -_081C284A: - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x10 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r4, 0 - adds r1, r3, 0 - movs r3, 0 - bl BlitBitmapToWindow - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2838 - - thumb_func_start sub_81C286C -sub_81C286C: @ 81C286C - push {r4-r7,lr} - sub sp, 0x8 - ldr r1, =gText_PkmnInfo - movs r5, 0 - str r5, [sp] - movs r6, 0x1 - str r6, [sp, 0x4] - movs r0, 0 - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_PkmnSkills - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0x1 - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_BattleMoves - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0x2 - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_ContestMoves - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0x3 - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r7, =gText_Cancel2 - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x3E - bl GetStringRightAlignXOffset - adds r4, r0, 0 - adds r2, r4, 0 - subs r2, 0x10 - cmp r2, 0 - bge _081C28CC - movs r2, 0 -_081C28CC: - movs r0, 0x4 - movs r1, 0 - bl sub_81C2838 - lsls r2, r4, 24 - lsrs r2, 24 - str r5, [sp] - str r5, [sp, 0x4] - movs r0, 0x4 - adds r1, r7, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r7, =gText_Info - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x3E - bl GetStringRightAlignXOffset - adds r4, r0, 0 - adds r2, r4, 0 - subs r2, 0x10 - cmp r2, 0 - bge _081C28FE - movs r2, 0 -_081C28FE: - movs r0, 0x5 - movs r1, 0 - bl sub_81C2838 - lsls r2, r4, 24 - lsrs r2, 24 - str r5, [sp] - str r5, [sp, 0x4] - movs r0, 0x5 - adds r1, r7, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r7, =gText_Switch - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x3E - bl GetStringRightAlignXOffset - adds r4, r0, 0 - adds r2, r4, 0 - subs r2, 0x10 - cmp r2, 0 - bge _081C2930 - movs r2, 0 -_081C2930: - movs r0, 0x6 - movs r1, 0 - bl sub_81C2838 - lsls r2, r4, 24 - lsrs r2, 24 - str r5, [sp] - str r5, [sp, 0x4] - movs r0, 0x6 - adds r1, r7, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_RentalPkmn - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0x8 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_TypeSlash - str r5, [sp] - str r5, [sp, 0x4] - movs r0, 0x9 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r4, =gText_HP4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringCenterAlignXOffset - adds r0, 0x6 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xA - adds r1, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r4, =gText_Attack3 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringCenterAlignXOffset - adds r0, 0x6 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xA - adds r1, r4, 0 - movs r3, 0x11 - bl sub_81C25A4 - ldr r4, =gText_Defense3 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringCenterAlignXOffset - adds r0, 0x6 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xA - adds r1, r4, 0 - movs r3, 0x21 - bl sub_81C25A4 - ldr r4, =gText_SpAtk4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x24 - bl GetStringCenterAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xB - adds r1, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r4, =gText_SpDef4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x24 - bl GetStringCenterAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xB - adds r1, r4, 0 - movs r3, 0x11 - bl sub_81C25A4 - ldr r4, =gText_Speed2 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x24 - bl GetStringCenterAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xB - adds r1, r4, 0 - movs r3, 0x21 - bl sub_81C25A4 - ldr r1, =gText_ExpPoints - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xC - movs r2, 0x6 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_NextLv - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xC - movs r2, 0x6 - movs r3, 0x11 - bl sub_81C25A4 - ldr r1, =gText_Status - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xD - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_Power - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xE - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_Accuracy2 - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xE - movs r2, 0 - movs r3, 0x11 - bl sub_81C25A4 - ldr r1, =gText_Appeal - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xF - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_Jam - str r5, [sp] - str r6, [sp, 0x4] - movs r0, 0xF - movs r2, 0 - movs r3, 0x11 - bl sub_81C25A4 - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C286C - - thumb_func_start sub_81C2AFC -sub_81C2AFC: @ 81C2AFC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - movs r0, 0 - bl ClearWindowTilemap - movs r0, 0x1 - bl ClearWindowTilemap - movs r0, 0x2 - bl ClearWindowTilemap - movs r0, 0x3 - bl ClearWindowTilemap - cmp r4, 0x1 - beq _081C2B66 - cmp r4, 0x1 - bgt _081C2B2A - cmp r4, 0 - beq _081C2B34 - b _081C2C06 -_081C2B2A: - cmp r5, 0x2 - beq _081C2B80 - cmp r5, 0x3 - beq _081C2BC4 - b _081C2C06 -_081C2B34: - movs r0, 0 - bl PutWindowTilemap - movs r0, 0x4 - bl PutWindowTilemap - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2B58 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C2B5E -_081C2B58: - movs r0, 0x8 - bl PutWindowTilemap -_081C2B5E: - movs r0, 0x9 - bl PutWindowTilemap - b _081C2C06 -_081C2B66: - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0xA - bl PutWindowTilemap - movs r0, 0xB - bl PutWindowTilemap - movs r0, 0xC - bl PutWindowTilemap - b _081C2C06 -_081C2B80: - movs r0, 0x2 - bl PutWindowTilemap - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2BBC - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C2C06 - movs r0, 0xE - bl PutWindowTilemap - b _081C2C06 - .pool -_081C2BBC: - movs r0, 0x5 - bl PutWindowTilemap - b _081C2C06 -_081C2BC4: - movs r0, 0x3 - bl PutWindowTilemap - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2C00 - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C2C06 - movs r0, 0xF - bl PutWindowTilemap - b _081C2C06 - .pool -_081C2C00: - movs r0, 0x5 - bl PutWindowTilemap -_081C2C06: - movs r4, 0 - ldr r5, =gUnknown_0203CF1C -_081C2C0A: - ldr r0, [r5] - ldr r1, =0x000040cb - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _081C2C0A - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2AFC - - thumb_func_start sub_81C2C38 -sub_81C2C38: @ 81C2C38 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x1 - beq _081C2C84 - cmp r0, 0x1 - bgt _081C2C4E - cmp r0, 0 - beq _081C2C58 - b _081C2D0E -_081C2C4E: - cmp r1, 0x2 - beq _081C2C98 - cmp r1, 0x3 - beq _081C2CD4 - b _081C2D0E -_081C2C58: - movs r0, 0x4 - bl ClearWindowTilemap - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2C76 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C2C7C -_081C2C76: - movs r0, 0x8 - bl ClearWindowTilemap -_081C2C7C: - movs r0, 0x9 - bl ClearWindowTilemap - b _081C2D0E -_081C2C84: - movs r0, 0xA - bl ClearWindowTilemap - movs r0, 0xB - bl ClearWindowTilemap - movs r0, 0xC - bl ClearWindowTilemap - b _081C2D0E -_081C2C98: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2CCC - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C2D0E - movs r0, 0xE - bl ClearWindowTilemap - b _081C2D0E - .pool -_081C2CCC: - movs r0, 0x5 - bl ClearWindowTilemap - b _081C2D0E -_081C2CD4: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C2D08 - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C2D0E - movs r0, 0xF - bl ClearWindowTilemap - b _081C2D0E - .pool -_081C2D08: - movs r0, 0x5 - bl ClearWindowTilemap -_081C2D0E: - movs r4, 0 -_081C2D10: - adds r0, r4, 0 - bl sub_81C2D68 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _081C2D10 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C2C38 - - thumb_func_start sub_81C2D2C -sub_81C2D2C: @ 81C2D2C - push {r4,lr} - adds r3, r0, 0 - lsls r1, 24 - lsrs r2, r1, 24 - ldr r0, =gUnknown_0203CF1C - ldr r4, =0x000040cb - adds r1, r2, r4 - ldr r0, [r0] - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0xFF - bne _081C2D56 - lsls r0, r2, 3 - adds r0, r3, r0 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl FillWindowPixelBuffer -_081C2D56: - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C2D2C - - thumb_func_start sub_81C2D68 -sub_81C2D68: @ 81C2D68 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CF1C - ldr r2, =0x000040cb - adds r0, r2 - ldr r1, [r1] - adds r4, r1, r0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _081C2D8C - bl ClearWindowTilemap - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] -_081C2D8C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2D68 - - thumb_func_start sub_81C2D9C -sub_81C2D9C: @ 81C2D9C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 -_081C2DA4: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040cb - adds r0, r1 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0xFF - beq _081C2DBA - movs r1, 0 - bl FillWindowPixelBuffer -_081C2DBA: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x7 - bls _081C2DA4 - ldr r0, =gUnknown_0861CE54 - lsls r1, r5, 2 - adds r1, r0 - ldr r0, [r1] - bl _call_via_r0 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2D9C - - thumb_func_start sub_81C2DE4 -sub_81C2DE4: @ 81C2DE4 - push {lr} - lsls r0, 24 - ldr r1, =gUnknown_0861CE64 - lsrs r0, 22 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x10 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2DE4 - - thumb_func_start sub_81C2E00 -sub_81C2E00: @ 81C2E00 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x74 - ldrb r0, [r0] - cmp r0, 0 - beq _081C2E24 - bl sub_81C335C - bl sub_81C33CC - bl sub_81C3428 - bl sub_81C349C - b _081C2E3C - .pool -_081C2E24: - bl sub_81C2EC4 - bl sub_81C2F5C - bl sub_81C2FD8 - bl sub_81C302C - bl sub_81C307C - bl sub_81C3194 -_081C2E3C: - pop {r0} - bx r0 - thumb_func_end sub_81C2E00 - - thumb_func_start sub_81C2E40 -sub_81C2E40: @ 81C2E40 - 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 - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - bhi _081C2EB8 - lsls r0, 2 - ldr r1, =_081C2E70 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C2E70: - .4byte _081C2E8C - .4byte _081C2E92 - .4byte _081C2E98 - .4byte _081C2E9E - .4byte _081C2EA4 - .4byte _081C2EAA - .4byte _081C2EB0 -_081C2E8C: - bl sub_81C2EC4 - b _081C2EB8 -_081C2E92: - bl sub_81C2F5C - b _081C2EB8 -_081C2E98: - bl sub_81C2FD8 - b _081C2EB8 -_081C2E9E: - bl sub_81C302C - b _081C2EB8 -_081C2EA4: - bl sub_81C307C - b _081C2EB8 -_081C2EAA: - bl sub_81C3194 - b _081C2EB8 -_081C2EB0: - adds r0, r2, 0 - bl DestroyTask - b _081C2EBE -_081C2EB8: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_081C2EBE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C2E40 - - thumb_func_start sub_81C2EC4 -sub_81C2EC4: @ 81C2EC4 - push {r4-r6,lr} - sub sp, 0x8 - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2F54 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2F54 - ldr r0, =gUnknown_0861CCCC - movs r1, 0 - bl sub_81C2D2C - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gText_OTSlash - movs r6, 0 - str r6, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - adds r2, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xA2 - ldrb r0, [r0] - cmp r0, 0 - bne _081C2F40 - adds r1, 0xA6 - lsls r2, 24 - lsrs r2, 24 - str r6, [sp] - movs r0, 0x5 - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r3, 0x1 - bl sub_81C25A4 - b _081C2F54 - .pool -_081C2F40: - adds r1, 0xA6 - lsls r2, 24 - lsrs r2, 24 - str r6, [sp] - movs r0, 0x6 - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r3, 0x1 - bl sub_81C25A4 -_081C2F54: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81C2EC4 - - thumb_func_start sub_81C2F5C -sub_81C2F5C: @ 81C2F5C - push {r4,r5,lr} - sub sp, 0x8 - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2FC0 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C2FC0 - ldr r5, =gStringVar1 - ldr r1, =gText_UnkCtrlF907F908 - adds r0, r5, 0 - bl StringCopy - ldr r1, =gUnknown_0203CF1C - ldr r1, [r1] - adds r1, 0xB8 - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x38 - bl GetStringRightAlignXOffset - adds r4, r0, 0 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x1 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - adds r1, r5, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 -_081C2FC0: - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2F5C - - thumb_func_start sub_81C2FD8 -sub_81C2FD8: @ 81C2FD8 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x70 - ldrh r0, [r0] - adds r1, 0x78 - ldrb r1, [r1] - bl GetAbilityBySpecies - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x2 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0xD - muls r1, r4 - ldr r2, =gAbilityNames - adds r1, r2 - movs r2, 0 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C2FD8 - - thumb_func_start sub_81C302C -sub_81C302C: @ 81C302C - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x70 - ldrh r0, [r0] - adds r1, 0x78 - ldrb r1, [r1] - bl GetAbilityBySpecies - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x2 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gAbilityDescriptionPointers - lsls r4, 2 - adds r4, r1 - ldr r1, [r4] - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - movs r3, 0x11 - bl sub_81C25A4 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C302C - - thumb_func_start sub_81C307C -sub_81C307C: @ 81C307C - push {r4-r6,lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r4, r0, 0 - adds r4, 0x70 - bl sub_81AFBF0 - ldr r1, =gUnknown_0861CE74 - movs r0, 0 - bl sub_81AFC0C - ldr r1, =gUnknown_0861CE7B - movs r0, 0x1 - bl sub_81AFC0C - bl sub_81C31C0 - bl sub_81A6BF4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C30C2 - bl sub_81B9E94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C30C2 - bl sub_81C3304 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C30E0 -_081C30C2: - ldr r0, =gStringVar4 - ldr r1, =gText_XNature - bl sub_81AFC28 - b _081C3182 - .pool -_081C30E0: - movs r0, 0x20 - bl Alloc - adds r6, r0, 0 - movs r0, 0x20 - bl Alloc - adds r5, r0, 0 - adds r0, r6, 0 - bl sub_81C31F0 - ldrb r0, [r4, 0x9] - cmp r0, 0xD4 - bhi _081C310C - adds r1, r0, 0 - adds r0, r5, 0 - bl sub_8124610 - movs r0, 0x4 - adds r1, r5, 0 - bl sub_81AFC0C -_081C310C: - bl sub_81C3220 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C3148 - ldrb r0, [r4, 0xA] - cmp r0, 0 - bne _081C3134 - ldrb r0, [r4, 0x9] - ldr r1, =gText_XNatureHatchedAtYZ - cmp r0, 0xD4 - bls _081C3170 - ldr r1, =gText_XNatureHatchedSomewhereAt - b _081C3170 - .pool -_081C3134: - ldrb r0, [r4, 0x9] - ldr r1, =gText_XNatureMetAtYZ - cmp r0, 0xD4 - bls _081C3170 - ldr r1, =gText_XNatureMetSomewhereAt - b _081C3170 - .pool -_081C3148: - ldrb r0, [r4, 0x9] - cmp r0, 0xFF - bne _081C3158 - ldr r1, =gText_XNatureFatefulEncounter - b _081C3170 - .pool -_081C3158: - cmp r0, 0xFE - beq _081C316E - bl sub_81C32BC - lsls r0, 24 - cmp r0, 0 - beq _081C316E - ldrb r0, [r4, 0x9] - ldr r1, =gText_XNatureProbablyMetAt - cmp r0, 0xD4 - bls _081C3170 -_081C316E: - ldr r1, =gText_XNatureObtainedInTrade -_081C3170: - ldr r0, =gStringVar4 - bl sub_81AFC28 - adds r0, r6, 0 - bl Free - adds r0, r5, 0 - bl Free -_081C3182: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C307C - - thumb_func_start sub_81C3194 -sub_81C3194: @ 81C3194 - push {lr} - sub sp, 0x8 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x3 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gStringVar4 - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3194 - - thumb_func_start sub_81C31C0 -sub_81C31C0: @ 81C31C0 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =gNatureNamePointers - adds r0, 0xA3 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x2 - bl sub_81AFC0C - ldr r1, =gText_EmptyString5 - movs r0, 0x5 - bl sub_81AFC0C - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C31C0 - - thumb_func_start sub_81C31F0 -sub_81C31F0: @ 81C31F0 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x7A - ldrb r1, [r0] - cmp r1, 0 - bne _081C3202 - movs r1, 0x5 -_081C3202: - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - movs r0, 0x3 - adds r1, r4, 0 - bl sub_81AFC0C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C31F0 - - thumb_func_start sub_81C3220 -sub_81C3220: @ 81C3220 - push {r4-r6,lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r6, r0, 0 - adds r6, 0x70 - ldr r1, [r0] - ldr r0, =gEnemyParty - cmp r1, r0 - bne _081C326C - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gLinkPlayers - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r0, r2, 0x4 - adds r0, r1, r0 - ldrh r4, [r0] - adds r0, r1, r2 - ldrb r5, [r0, 0x13] - ldr r0, =gStringVar1 - adds r2, 0x8 - adds r1, r2 - bl StringCopy - b _081C3282 - .pool -_081C326C: - bl sub_80F0020 - adds r4, r0, 0 - ldr r0, =0x0000ffff - ands r4, r0 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r5, [r1, 0x8] - ldr r0, =gStringVar1 - bl StringCopy -_081C3282: - adds r0, r6, 0 - adds r0, 0x32 - ldrb r0, [r0] - cmp r5, r0 - bne _081C32A4 - ldr r0, [r6, 0x48] - ldr r1, =0x0000ffff - ands r0, r1 - cmp r4, r0 - bne _081C32A4 - ldr r0, =gStringVar1 - adds r1, r6, 0 - adds r1, 0x36 - bl StringCompareWithoutExtCtrlCodes - cmp r0, 0 - beq _081C32B4 -_081C32A4: - movs r0, 0 - b _081C32B6 - .pool -_081C32B4: - movs r0, 0x1 -_081C32B6: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81C3220 - - thumb_func_start sub_81C32BC -sub_81C32BC: @ 81C32BC - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x70 - ldrb r0, [r0, 0xB] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _081C32D8 - movs r0, 0 - b _081C32DA - .pool -_081C32D8: - movs r0, 0x1 -_081C32DA: - pop {r1} - bx r1 - thumb_func_end sub_81C32BC - - thumb_func_start sub_81C32E0 -sub_81C32E0: @ 81C32E0 - push {lr} - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r0, 0x70 - ldrb r0, [r0, 0xB] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _081C32FC - movs r0, 0 - b _081C32FE - .pool -_081C32FC: - movs r0, 0x1 -_081C32FE: - pop {r1} - bx r1 - thumb_func_end sub_81C32E0 - - thumb_func_start sub_81C3304 -sub_81C3304: @ 81C3304 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 15 - ands r0, r1 - cmp r0, 0 - beq _081C3354 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C3354 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040be - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C333A - cmp r0, 0x4 - beq _081C333A - cmp r0, 0x5 - bne _081C3354 -_081C333A: - movs r0, 0x1 - b _081C3356 - .pool -_081C3354: - movs r0, 0 -_081C3356: - pop {r1} - bx r1 - thumb_func_end sub_81C3304 - - thumb_func_start sub_81C335C -sub_81C335C: @ 81C335C - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x8 - ldr r0, =gUnknown_0861CCCC - movs r1, 0 - bl sub_81C2D2C - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gText_OTSlash - mov r8, r0 - movs r0, 0x1 - mov r1, r8 - movs r2, 0 - bl GetStringWidth - adds r5, r0, 0 - movs r0, 0 - mov r9, r0 - str r0, [sp] - movs r6, 0x1 - str r6, [sp, 0x4] - adds r0, r4, 0 - mov r1, r8 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gText_FiveMarks - lsls r5, 24 - lsrs r5, 24 - mov r0, r9 - str r0, [sp] - str r6, [sp, 0x4] - adds r0, r4, 0 - adds r2, r5, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C335C - - thumb_func_start sub_81C33CC -sub_81C33CC: @ 81C33CC - push {r4,r5,lr} - sub sp, 0x8 - ldr r5, =gStringVar1 - ldr r1, =gText_UnkCtrlF907F908 - adds r0, r5, 0 - bl StringCopy - ldr r1, =gText_FiveMarks - adds r0, r5, 0 - bl StringAppend - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x38 - bl GetStringRightAlignXOffset - adds r4, r0, 0 - ldr r0, =gUnknown_0861CCCC - movs r1, 0x1 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - adds r1, r5, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C33CC - - thumb_func_start sub_81C3428 -sub_81C3428: @ 81C3428 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x70 - adds r0, 0xA5 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081C3448 - ldr r4, =gText_EggWillTakeALongTime - b _081C346C - .pool -_081C3448: - ldrh r0, [r1, 0x30] - cmp r0, 0x5 - bhi _081C3458 - ldr r4, =gText_EggAboutToHatch - b _081C346C - .pool -_081C3458: - cmp r0, 0xA - bhi _081C3464 - ldr r4, =gText_EggWillHatchSoon - b _081C346C - .pool -_081C3464: - ldr r4, =gText_EggWillTakeALongTime - cmp r0, 0x28 - bhi _081C346C - ldr r4, =gText_EggWillTakeSomeTime -_081C346C: - ldr r0, =gUnknown_0861CCCC - movs r1, 0x2 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3428 - - thumb_func_start sub_81C349C -sub_81C349C: @ 81C349C - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r4, r0, 0 - adds r4, 0x70 - adds r0, 0xA5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C3500 - ldrb r0, [r4, 0x9] - cmp r0, 0xFF - bne _081C34C4 - ldr r4, =gText_PeculiarEggNicePlace - b _081C3502 - .pool -_081C34C4: - bl sub_81C32BC - lsls r0, 24 - cmp r0, 0 - beq _081C34D8 - bl sub_81C3220 - lsls r0, 24 - cmp r0, 0 - bne _081C34E0 -_081C34D8: - ldr r4, =gText_PeculiarEggTrade - b _081C3502 - .pool -_081C34E0: - ldrb r0, [r4, 0x9] - cmp r0, 0xFD - bne _081C3500 - bl sub_81C32E0 - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gText_EggFromTraveler - cmp r0, 0x1 - bne _081C3502 - ldr r4, =gText_EggFromHotSprings - b _081C3502 - .pool -_081C3500: - ldr r4, =gText_OddEggFoundByCouple -_081C3502: - ldr r0, =gUnknown_0861CCCC - movs r1, 0x3 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C349C - - thumb_func_start sub_81C3530 -sub_81C3530: @ 81C3530 - push {lr} - bl sub_81C35E4 - bl sub_81C3690 - bl sub_81C3710 - bl sub_81C37D8 - bl sub_81C3808 - bl sub_81C3890 - bl sub_81C38C0 - pop {r0} - bx r0 - thumb_func_end sub_81C3530 - - thumb_func_start sub_81C3554 -sub_81C3554: @ 81C3554 - 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 - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - bhi _081C35D6 - lsls r0, 2 - ldr r1, =_081C3584 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C3584: - .4byte _081C35A4 - .4byte _081C35AA - .4byte _081C35B0 - .4byte _081C35B6 - .4byte _081C35BC - .4byte _081C35C2 - .4byte _081C35C8 - .4byte _081C35CE -_081C35A4: - bl sub_81C35E4 - b _081C35D6 -_081C35AA: - bl sub_81C3690 - b _081C35D6 -_081C35B0: - bl sub_81C3710 - b _081C35D6 -_081C35B6: - bl sub_81C37D8 - b _081C35D6 -_081C35BC: - bl sub_81C3808 - b _081C35D6 -_081C35C2: - bl sub_81C3890 - b _081C35D6 -_081C35C8: - bl sub_81C38C0 - b _081C35D6 -_081C35CE: - adds r0, r2, 0 - bl DestroyTask - b _081C35DC -_081C35D6: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_081C35DC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C3554 - - thumb_func_start sub_81C35E4 -sub_81C35E4: @ 81C35E4 - push {r4,r5,lr} - sub sp, 0x8 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0x9E - ldrh r0, [r0] - cmp r0, 0xAF - bne _081C3628 - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C3628 - ldr r0, [r4] - ldr r1, =0x000040be - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081C3614 - cmp r0, 0x4 - beq _081C3614 - cmp r0, 0x5 - bne _081C3628 -_081C3614: - movs r0, 0xAF - bl ItemId_GetItem - adds r5, r0, 0 - b _081C3650 - .pool -_081C3628: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x9E - ldrh r0, [r1] - cmp r0, 0 - bne _081C3644 - ldr r5, =gText_None - b _081C3650 - .pool -_081C3644: - ldrh r0, [r1] - ldr r4, =gStringVar1 - adds r1, r4, 0 - bl CopyItemName - adds r5, r4, 0 -_081C3650: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x48 - bl GetStringCenterAlignXOffset - adds r4, r0, 0 - adds r4, 0x6 - ldr r0, =gUnknown_0861CCEC - movs r1, 0 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r5, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C35E4 - - thumb_func_start sub_81C3690 -sub_81C3690: @ 81C3690 - push {r4,r5,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x76 - ldrb r0, [r1] - cmp r0, 0 - bne _081C36B0 - ldr r5, =gText_None - b _081C36C8 - .pool -_081C36B0: - ldr r0, =gStringVar1 - ldrb r1, [r1] - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_RibbonsVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r5, r4, 0 -_081C36C8: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x46 - bl GetStringCenterAlignXOffset - adds r4, r0, 0 - adds r4, 0x6 - ldr r0, =gUnknown_0861CCEC - movs r1, 0x1 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - adds r1, r5, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3690 - - thumb_func_start sub_81C3710 -sub_81C3710: @ 81C3710 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - movs r0, 0x8 - bl Alloc - mov r9, r0 - movs r0, 0x8 - bl Alloc - mov r8, r0 - movs r0, 0x8 - bl Alloc - adds r6, r0, 0 - movs r0, 0x8 - bl Alloc - adds r5, r0, 0 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0x90 - ldrh r1, [r0] - mov r0, r9 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - adds r0, 0x92 - ldrh r1, [r0] - mov r0, r8 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - adds r0, 0x94 - ldrh r1, [r0] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - adds r0, 0x96 - ldrh r1, [r0] - adds r0, r5, 0 - movs r2, 0x1 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - bl sub_81AFBF0 - movs r0, 0 - mov r1, r9 - bl sub_81AFC0C - movs r0, 0x1 - mov r1, r8 - bl sub_81AFC0C - movs r0, 0x2 - adds r1, r6, 0 - bl sub_81AFC0C - movs r0, 0x3 - adds r1, r5, 0 - bl sub_81AFC0C - ldr r0, =gStringVar4 - ldr r1, =gUnknown_0861CE82 - bl sub_81AFC28 - mov r0, r9 - bl Free - mov r0, r8 - bl Free - adds r0, r6, 0 - bl Free - adds r0, r5, 0 - bl Free - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3710 - - thumb_func_start sub_81C37D8 -sub_81C37D8: @ 81C37D8 - push {lr} - sub sp, 0x8 - ldr r0, =gUnknown_0861CCEC - movs r1, 0x2 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gStringVar4 - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - movs r2, 0x4 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C37D8 - - thumb_func_start sub_81C3808 -sub_81C3808: @ 81C3808 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gStringVar1 - mov r8, r0 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - adds r0, 0x98 - ldrh r1, [r0] - mov r0, r8 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r6, =gStringVar2 - ldr r0, [r4] - adds r0, 0x9A - ldrh r1, [r0] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r5, =gStringVar3 - ldr r0, [r4] - adds r0, 0x9C - ldrh r1, [r0] - adds r0, r5, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - bl sub_81AFBF0 - movs r0, 0 - mov r1, r8 - bl sub_81AFC0C - movs r0, 0x1 - adds r1, r6, 0 - bl sub_81AFC0C - movs r0, 0x2 - adds r1, r5, 0 - bl sub_81AFC0C - ldr r0, =gStringVar4 - ldr r1, =gUnknown_0861CE8E - bl sub_81AFC28 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3808 - - thumb_func_start sub_81C3890 -sub_81C3890: @ 81C3890 - push {lr} - sub sp, 0x8 - ldr r0, =gUnknown_0861CCEC - movs r1, 0x3 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gStringVar4 - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - movs r2, 0x2 - movs r3, 0x1 - bl sub_81C25A4 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3890 - - thumb_func_start sub_81C38C0 -sub_81C38C0: @ 81C38C0 - push {r4-r6,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r5, r0, 0 - adds r5, 0x70 - ldr r0, =gUnknown_0861CCEC - movs r1, 0x4 - bl sub_81C2D2C - lsls r0, 24 - lsrs r6, r0, 24 - ldr r4, =gStringVar1 - ldr r1, [r5, 0x10] - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringRightAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r6, 0 - adds r1, r4, 0 - movs r3, 0x1 - bl sub_81C25A4 - ldrb r0, [r5, 0x5] - cmp r0, 0x63 - bhi _081C3948 - ldr r4, =gExperienceTables - adds r1, r0, 0 - adds r1, 0x1 - lsls r1, 2 - ldr r3, =gBaseStats - ldrh r2, [r5] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r3 - ldrb r2, [r0, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r2 - adds r1, r0 - adds r1, r4 - ldr r1, [r1] - ldr r0, [r5, 0x10] - subs r1, r0 - b _081C394A - .pool -_081C3948: - movs r1, 0 -_081C394A: - ldr r4, =gStringVar1 - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x2A - bl GetStringRightAlignXOffset - adds r0, 0x2 - lsls r2, r0, 24 - lsrs r2, 24 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r6, 0 - adds r1, r4, 0 - movs r3, 0x11 - bl sub_81C25A4 - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C38C0 - - thumb_func_start sub_81C3984 -sub_81C3984: @ 81C3984 - push {r4,lr} - movs r0, 0 - bl sub_81C3B08 - movs r0, 0x1 - bl sub_81C3B08 - movs r0, 0x2 - bl sub_81C3B08 - movs r0, 0x3 - bl sub_81C3B08 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C39EA - bl sub_81C3F44 - ldr r1, [r4] - ldr r0, =0x000040c6 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0x4 - bne _081C39DC - ldr r0, =0x000040c4 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _081C39EA - bl sub_81C3E9C - b _081C39EA - .pool -_081C39DC: - ldrb r0, [r2] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r0, [r1] - bl sub_81C3E9C -_081C39EA: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C3984 - - thumb_func_start sub_81C39F0 -sub_81C39F0: @ 81C39F0 - 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 - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - bhi _081C3AFC - lsls r0, 2 - ldr r1, =_081C3A20 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C3A20: - .4byte _081C3A40 - .4byte _081C3A48 - .4byte _081C3A50 - .4byte _081C3A58 - .4byte _081C3A60 - .4byte _081C3A7C - .4byte _081C3ABE - .4byte _081C3AF4 -_081C3A40: - movs r0, 0 - bl sub_81C3B08 - b _081C3AFC -_081C3A48: - movs r0, 0x1 - bl sub_81C3B08 - b _081C3AFC -_081C3A50: - movs r0, 0x2 - bl sub_81C3B08 - b _081C3AFC -_081C3A58: - movs r0, 0x3 - bl sub_81C3B08 - b _081C3AFC -_081C3A60: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3AFC - bl sub_81C3F44 - b _081C3AFC - .pool -_081C3A7C: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3AFC - ldr r0, =0x000040c6 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0x4 - bne _081C3AB0 - ldr r2, =0x000040c4 - adds r0, r1, r2 - ldrh r0, [r0] - strh r0, [r4, 0x2] - b _081C3AFC - .pool -_081C3AB0: - ldrb r0, [r2] - lsls r0, 1 - adds r1, 0x84 - adds r1, r0 - ldrh r0, [r1] - strh r0, [r4, 0x2] - b _081C3AFC -_081C3ABE: - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - ldr r2, =0x000040bc - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3AFC - adds r2, 0x8 - adds r0, r1, r2 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C3AFC - ldrh r0, [r4, 0x2] - bl sub_81C3E9C - b _081C3AFC - .pool -_081C3AF4: - adds r0, r2, 0 - bl DestroyTask - b _081C3B02 -_081C3AFC: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_081C3B02: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C39F0 - - thumb_func_start sub_81C3B08 -sub_81C3B08: @ 81C3B08 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - mov r10, r0 - ldr r4, =gUnknown_0861CD14 - adds r0, r4, 0 - movs r1, 0 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81C2D2C - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - lsls r1, r7, 1 - mov r0, r10 - adds r0, 0x84 - adds r0, r1 - ldrh r5, [r0] - cmp r5, 0 - beq _081C3C00 - mov r0, r10 - adds r0, 0xA4 - ldrb r1, [r0] - adds r0, r5, 0 - adds r2, r7, 0 - bl CalculatePPWithBonus - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - movs r0, 0xD - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - lsls r0, r7, 4 - mov r9, r0 - mov r3, r9 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - mov r0, r8 - movs r2, 0 - bl sub_81C25A4 - ldr r0, =gStringVar1 - mov r8, r0 - mov r5, r10 - adds r5, 0x8C - adds r5, r7 - ldrb r1, [r5] - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar2 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - bl sub_81AFBF0 - movs r0, 0 - mov r1, r8 - bl sub_81AFC0C - movs r0, 0x1 - adds r1, r4, 0 - bl sub_81AFC0C - ldr r4, =gStringVar4 - ldr r1, =gUnknown_0861CE97 - adds r0, r4, 0 - bl sub_81AFC28 - adds r7, r4, 0 - ldrb r0, [r5] - adds r1, r6, 0 - bl sub_814FC20 - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - adds r5, 0x9 - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x2C - bl GetStringRightAlignXOffset - mov r4, r9 - b _081C3C26 - .pool -_081C3C00: - ldr r1, =gText_OneDash - lsls r4, r7, 4 - adds r3, r4, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - mov r0, r8 - movs r2, 0 - bl sub_81C25A4 - ldr r7, =gText_TwoDashes - movs r5, 0xC - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x2C - bl GetStringCenterAlignXOffset -_081C3C26: - lsls r2, r0, 24 - lsrs r2, 24 - adds r3, r4, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - lsls r0, r5, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - ldr r0, [sp, 0x8] - adds r1, r7, 0 - bl sub_81C25A4 - 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_81C3B08 - - thumb_func_start sub_81C3C5C -sub_81C3C5C: @ 81C3C5C - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _081C3CFC - movs r0, 0x13 - str r0, [sp] - movs r0, 0x20 - str r0, [sp, 0x4] - movs r0, 0xE - movs r1, 0 - movs r2, 0x35 - movs r3, 0 - bl FillWindowPixelRect - ldr r2, =gBattleMoves - lsls r1, r5, 1 - adds r0, r1, r5 - lsls r0, 2 - adds r2, r0, r2 - ldrb r0, [r2, 0x1] - adds r6, r1, 0 - cmp r0, 0x1 - bhi _081C3C9C - ldr r1, =gText_ThreeDashes - b _081C3CAC - .pool -_081C3C9C: - ldr r4, =gStringVar1 - ldrb r1, [r2, 0x1] - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r1, r4, 0 -_081C3CAC: - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0xE - movs r2, 0x35 - movs r3, 0x1 - bl sub_81C25A4 - ldr r1, =gBattleMoves - adds r0, r6, r5 - lsls r0, 2 - adds r1, r0, r1 - ldrb r0, [r1, 0x3] - cmp r0, 0 - bne _081C3CDC - ldr r1, =gText_ThreeDashes - b _081C3CEC - .pool -_081C3CDC: - ldr r4, =gStringVar1 - ldrb r1, [r1, 0x3] - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r1, r4, 0 -_081C3CEC: - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0xE - movs r2, 0x35 - movs r3, 0x11 - bl sub_81C25A4 -_081C3CFC: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3C5C - - thumb_func_start sub_81C3D08 -sub_81C3D08: @ 81C3D08 - push {r4,lr} - movs r0, 0 - bl sub_81C3B08 - movs r0, 0x1 - bl sub_81C3B08 - movs r0, 0x2 - bl sub_81C3B08 - movs r0, 0x3 - bl sub_81C3B08 - ldr r4, =gUnknown_0203CF1C - ldr r0, [r4] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3D40 - bl sub_81C3F44 - ldr r0, [r4] - ldr r1, =0x000040c6 - adds r0, r1 - ldrb r0, [r0] - bl sub_81C3E2C -_081C3D40: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C3D08 - - thumb_func_start sub_81C3D54 -sub_81C3D54: @ 81C3D54 - 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 - ldrh r0, [r4] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - bhi _081C3E20 - lsls r0, 2 - ldr r1, =_081C3D84 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C3D84: - .4byte _081C3DA0 - .4byte _081C3DA8 - .4byte _081C3DB0 - .4byte _081C3DB8 - .4byte _081C3DC0 - .4byte _081C3DDC - .4byte _081C3E18 -_081C3DA0: - movs r0, 0 - bl sub_81C3B08 - b _081C3E20 -_081C3DA8: - movs r0, 0x1 - bl sub_81C3B08 - b _081C3E20 -_081C3DB0: - movs r0, 0x2 - bl sub_81C3B08 - b _081C3E20 -_081C3DB8: - movs r0, 0x3 - bl sub_81C3B08 - b _081C3E20 -_081C3DC0: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040bc - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3E20 - bl sub_81C3F44 - b _081C3E20 - .pool -_081C3DDC: - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - ldr r1, =0x000040bc - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _081C3E20 - adds r1, 0x8 - adds r0, r2, r1 - ldr r0, [r0] - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 11 - cmp r0, r1 - beq _081C3E20 - ldr r1, =0x000040c6 - adds r0, r2, r1 - ldrb r0, [r0] - bl sub_81C3E2C - b _081C3E20 - .pool -_081C3E18: - adds r0, r2, 0 - bl DestroyTask - b _081C3E26 -_081C3E20: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_081C3E26: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C3D54 - thumb_func_start sub_81C3E2C sub_81C3E2C: @ 81C3E2C push {r4,lr} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 4c748073e9..a44102b4b8 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2,18 +2,41 @@ #include "battle.h" #include "bg.h" #include "decompress.h" +#include "item.h" +#include "items.h" +#include "link.h" #include "m4a.h" #include "main.h" #include "malloc.h" +#include "moves.h" #include "palette.h" #include "pokemon.h" #include "songs.h" #include "sound.h" +#include "species.h" #include "sprite.h" #include "string_util.h" #include "task.h" +#include "text.h" #include "window.h" +struct contestMove +{ + u8 effect; + u8 type; + u8 comboID; + u8 combo[4]; +}; + +struct contestEffect +{ + u8 type; + u8 appeal; + u8 jam; +}; + + + extern struct unkSummaryStruct* gUnknown_0203CF1C; extern struct BgTemplate gUnknown_0861CBB4; extern u8 gUnknown_0203CF20; @@ -27,6 +50,21 @@ extern struct unkStruct_61CC04 gUnknown_0861CC10; extern struct unkStruct_61CC04 gUnknown_0861CBEC; extern struct unkStruct_61CC04 gUnknown_0861CBF8; extern u16 gUnknown_08DC3CD4[]; +extern struct contestMove gContestMoves[]; +extern struct contestEffect gContestEffects[]; +extern struct WindowTemplate gUnknown_0861CC24; +extern struct TextColor gUnknown_0861CD2C[]; +extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; +extern u8 gText_MaleSymbol[]; +extern u8 gText_FemaleSymbol[]; +extern u8 gUnknown_0861CDD3[]; +extern void (*const gUnknown_0861CE54[])(); +extern void (*const gUnknown_0861CE64[])(u8 taskId); +extern struct WindowTemplate gUnknown_0861CCCC; +extern u8 gUnknown_0861CE74[]; +extern u8 gUnknown_0861CE7B[]; +extern struct WindowTemplate gUnknown_0861CCEC; +extern struct WindowTemplate gUnknown_0861CD14; extern void sub_806F2AC(u8 a, u8 b); void sub_81C488C(u8 a); @@ -61,9 +99,81 @@ extern void decompress_and_copy_tile_data_to_vram(u8 a, void* tiledata, u8 b, u8 extern u8 free_temp_tile_data_buffers_if_possible(); extern void sub_8069004(struct BoxPokemon* a, void* b); extern void sub_81C1E20(u8 taskId); +extern u8 *GetMonNickname(struct Pokemon *mon, u8 *dest); +extern u16 SpeciesToPokedexNum(u16 species); +extern u8 gText_UnkCtrlF908Clear01[]; +extern u8 gText_LevelSymbol[]; +extern u8 gText_PkmnInfo[]; +extern u8 gText_PkmnSkills[]; +extern u8 gText_BattleMoves[]; +extern u8 gText_ContestMoves[]; +extern u8 gText_Cancel2[]; +extern u8 gText_Info[]; +extern u8 gText_Switch[]; +extern u8 gText_RentalPkmn[]; +extern u8 gText_TypeSlash[]; +extern u8 gText_HP4[]; +extern u8 gText_Attack3[]; +extern u8 gText_Defense3[]; +extern u8 gText_SpAtk4[]; +extern u8 gText_SpDef4[]; +extern u8 gText_Speed2[]; +extern u8 gText_ExpPoints[]; +extern u8 gText_NextLv[]; +extern u8 gText_Status[]; +extern u8 gText_Power[]; +extern u8 gText_Accuracy2[]; +extern u8 gText_Appeal[]; +extern u8 gText_Jam[]; +extern u8 gText_OTSlash[]; +extern u8 gText_UnkCtrlF907F908[]; +extern u8 gAbilityNames[][13]; +extern u8 *gAbilityDescriptionPointers[]; +extern u8 gText_XNature[]; +extern u8 gText_XNatureHatchedAtYZ[]; +extern u8 gText_XNatureHatchedSomewhereAt[]; +extern u8 gText_XNatureMetAtYZ[]; +extern u8 gText_XNatureMetSomewhereAt[]; +extern u8 gText_XNatureFatefulEncounter[]; +extern u8 gText_XNatureProbablyMetAt[]; +extern u8 gText_XNatureObtainedInTrade[]; +extern u8 *gNatureNamePointers[]; +extern u8 gText_EmptyString5[]; +extern u32 gBattleTypeFlags; +extern u8 gText_FiveMarks[]; +extern u8 gText_EggWillTakeALongTime[]; +extern u8 gText_EggAboutToHatch[]; +extern u8 gText_EggWillHatchSoon[]; +extern u8 gText_EggWillTakeSomeTime[]; +extern u8 gText_PeculiarEggNicePlace[]; +extern u8 gText_PeculiarEggTrade[]; +extern u8 gText_EggFromTraveler[]; +extern u8 gText_EggFromHotSprings[]; +extern u8 gText_OddEggFoundByCouple[]; +extern u8 gText_None[]; +extern u8 gText_RibbonsVar1[]; +extern u8 gUnknown_0861CE82[]; +extern u8 gUnknown_0861CE8E[]; +extern u8 gMoveNames[][13]; +extern u8 gText_OneDash[]; +extern u8 gText_TwoDashes[]; +extern u8 gText_ThreeDashes[]; +extern u8 gUnknown_0861CE97[]; +extern struct BattleMove gBattleMoves[]; extern u32 ChangeBgX(u8 bg, u32 value, u8 op); extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f); +extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); +extern s32 GetStringCenterAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); +extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); +extern u8 sub_81A6BF4(); +extern u8 sub_81B9E94(); +extern void sub_81AFBF0(); +extern u8 sub_81AFC0C(u8 a, u8 *b); +extern void sub_81AFC28(u8 *a, u8 *b); +extern void sub_8124610(u8 *a, u8 b); +extern int sub_80F0020(); +extern u8 sub_814FC20(u8 a, u8 b); void sub_81BFAE4(void); void sub_81BFE24(); @@ -111,7 +221,7 @@ void sub_81C20F0(u8 taskId); bool8 sub_81C0A50(struct Pokemon* mon); void sub_81C49E0(); void sub_81C0E24(); -void sub_81C2C38(); +void sub_81C2C38(u8 a); void sub_81C0B8C(u8 taskId); void sub_81C0CC4(u8 taskId); void sub_81C2DE4(u8 a); @@ -144,6 +254,34 @@ u8 sub_81B6D14(u16 a); void sub_81C1940(u8 taskId); void sub_81C4154(); void sub_81C1F80(u8 taskId); +void sub_81C2628(); +void sub_81C2794(); +void sub_81C27DC(struct Pokemon *mon, u16 a); +void sub_81C2D68(u8 a); +void sub_81C335C(); +void sub_81C33CC(); +void sub_81C3428(); +void sub_81C349C(); +void sub_81C2EC4(); +void sub_81C2F5C(); +void sub_81C2FD8(); +void sub_81C302C(); +void sub_81C307C(); +void sub_81C3194(); +void sub_81C31C0(); +u8 sub_81C3304(); +void sub_81C31F0(u8 *a); +u8 sub_81C3220(); +u8 sub_81C32BC(); +void sub_81C35E4(); +void sub_81C3690(); +void sub_81C3710(); +void sub_81C37D8(); +void sub_81C3808(); +void sub_81C3890(); +void sub_81C38C0(); +void sub_81C3B08(u8 a); +void sub_81C3E2C(u8 a); void SetBgAttribute(u8 bg, u8 attributeId, u8 value); @@ -221,7 +359,8 @@ struct unkSummaryStruct u8 unk40C7; u8 unk40C8; u8 unk40C9; - u8 unk_filler2[0x9]; + u8 unk40CA; + u8 unk40CB[8]; u8 unk40D3; u8 unk40D4; u8 unk40D5; @@ -2326,4 +2465,1217 @@ void sub_81C228C(u8 a) else sub_8199C30(3, 1, 4, 8, 8, 5); schedule_bg_copy_tilemap_to_vram(3); +} + +void sub_81C22CC(struct Pokemon *unused) +{ + s64 r6r7; + struct pokeSummary *summary = &gUnknown_0203CF1C->summary; + u16 *r9; + u8 i; + + if (summary->level < MAX_MON_LEVEL) + { + u32 r1 = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; + u32 r4 = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; + + r6r7 = r4 * 64 / r1; + if (r6r7 == 0 && r4 != 0) + r6r7 = 1; + } + else + { + r6r7 = 0; + } + + r9 = &gUnknown_0203CF1C->unkTilemap1_1[0x255]; + for (i = 0; i < 8; i++) + { + if (r6r7 > 7) + r9[i] = 0x206A; + else + r9[i] = 0x2062 + (r6r7 % 8); + r6r7 -= 8; + if (r6r7 < 0) + r6r7 = 0; + } + + if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->unkTilemap1) + schedule_bg_copy_tilemap_to_vram(1); + else + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81C240C(u16 move) +{ + u16* r5 = &gUnknown_0203CF1C->unkTilemap3_1[0]; + u8 i; + u8 r4; + if (move != MOVE_NONE) + { + r4 = gContestEffects[gContestMoves[move].effect].appeal; + if (r4 != 0xFF) + r4 /= 10; + for (i = 0;i < 8; i++) + { + if (r4 != 0xFF && i < r4) + { + r5[((i>>2)*32)+(i&3)+0x1E6] = 0x103A; + } + else + r5[((i>>2)*32)+(i&3)+0x1E6] = 0x1039; + } + r4 = gContestEffects[gContestMoves[move].effect].jam; + if (r4 != 0xFF) + r4 /= 10; + for (i = 0;i < 8; i++) + { + if (r4 != 0xFF && i < r4) + { + r5[((i>>2)*32)+(i&3)+0x226] = 0x103C; + } + else + r5[((i>>2)*32)+(i&3)+0x226] = 0x103D; + } + } +} + +void sub_81C2524() +{ + if (gUnknown_0203CF1C->summary.isEgg != 0) + ChangeBgX(3, 0x10000, 0); + else + ChangeBgX(3, 0, 0); +} + +void sub_81C2554() +{ + u8 i; + InitWindows(&gUnknown_0861CC24); + DeactivateAllTextPrinters(); + for (i = 0; i < 20; i++) + FillWindowPixelBuffer(i, 0); + for (i = 0; i < 8; i++) + gUnknown_0203CF1C->unk40CB[i] |= 0xFF; +} + +void sub_81C25A4(u8 a, u8 *b, u8 c, u8 d, u8 e, u8 f) +{ + AddTextPrinterParametrized2(a, 1, c, d, 0, e, &gUnknown_0861CD2C[f], 0, b); +} + +void sub_81C25E8() +{ + FillWindowPixelBuffer(17, 0); + FillWindowPixelBuffer(18, 0); + FillWindowPixelBuffer(19, 0); + if (gUnknown_0203CF1C->summary.isEgg == 0) + sub_81C2628(); + else + sub_81C2794(); + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_81C2628() +{ + u8 strArray[16]; + struct Pokemon *mon = &gUnknown_0203CF1C->currentPoke; + struct pokeSummary *summary = &gUnknown_0203CF1C->summary; + u16 r5 = SpeciesToPokedexNum(summary->species); + if (r5 != 0xFFFF) + { + StringCopy(gStringVar1, &gText_UnkCtrlF908Clear01[0]); + ConvertIntToDecimalStringN(gStringVar2, r5, 2, 3); + StringAppend(gStringVar1, gStringVar2); + if (IsMonShiny(mon) == 0) + { + sub_81C25A4(17, gStringVar1, 0, 1, 0, 1); + sub_81C228C(0); + } + else + { + sub_81C25A4(17, gStringVar1, 0, 1, 0, 7); + sub_81C228C(1); + } + PutWindowTilemap(17); + } + else + { + ClearWindowTilemap(17); + if (IsMonShiny(mon) == 0) + sub_81C228C(0); + else + sub_81C228C(1); + } + StringCopy(gStringVar1, &gText_LevelSymbol[0]); + ConvertIntToDecimalStringN(gStringVar2, summary->level, 0, 3); + StringAppend(gStringVar1, gStringVar2); + sub_81C25A4(19, gStringVar1, 0x18, 17, 0, 1); + GetMonNickname(mon, gStringVar1); + sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); + strArray[0] = CHAR_SLASH; + StringCopy(&strArray[1], &gSpeciesNames[summary->species2][0]); + sub_81C25A4(19, &strArray[0], 0, 1, 0, 1); + sub_81C27DC(mon, summary->species2); + PutWindowTilemap(18); + PutWindowTilemap(19); +} + +void sub_81C2794() +{ + GetMonNickname(&gUnknown_0203CF1C->currentPoke, gStringVar1); + sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); + PutWindowTilemap(18); + ClearWindowTilemap(17); + ClearWindowTilemap(19); +} + +void sub_81C27DC(struct Pokemon *mon, u16 a) +{ + if (a != SPECIES_NIDORAN_M && a != SPECIES_NIDORAN_F) + { + u8 gender = GetMonGender(mon); + switch (gender) + { + case 0: + sub_81C25A4(0x13, &gText_MaleSymbol[0], 0x39, 17, 0, 3); + break; + case 0xFE: + sub_81C25A4(0x13, &gText_FemaleSymbol[0], 0x39, 17, 0, 4); + break; + } + } +} + +void sub_81C2838(u8 a, u8 b, u32 c) +{ + BlitBitmapToWindow(a, (b) ? &gUnknown_0861CDD3[0] : &gUnknown_0861CDD3[0] - 0x80, c, 0, 16, 16); +} + +void sub_81C286C() +{ + int r4; + int r2; + int temp; + sub_81C25A4(0, gText_PkmnInfo, 2, 1, 0, 1); + sub_81C25A4(1, gText_PkmnSkills, 2, 1, 0, 1); + sub_81C25A4(2, gText_BattleMoves, 2, 1, 0, 1); + sub_81C25A4(3, gText_ContestMoves, 2, 1, 0, 1); + r4 = GetStringRightAlignXOffset(1, gText_Cancel2, 0x3E); + r2 = r4 - 16; + if (r2 < 0) + r2 = 0; + sub_81C2838(4, 0, r2); + sub_81C25A4(4, gText_Cancel2, r4, 1, 0, 0); + r4 = GetStringRightAlignXOffset(1, gText_Info, 0x3E); + r2 = r4 - 16; + if (r2 < 0) + r2 = 0; + sub_81C2838(5, 0, r2); + sub_81C25A4(5, gText_Info, r4, 1, 0, 0); + r4 = GetStringRightAlignXOffset(1, gText_Switch, 0x3E); + r2 = r4 - 16; + if (r2 < 0) + r2 = 0; + sub_81C2838(6, 0, r2); + sub_81C25A4(6, gText_Switch, r4, 1, 0, 0); + sub_81C25A4(8, gText_RentalPkmn, 0, 1, 0, 1); + sub_81C25A4(9, gText_TypeSlash, 0, 1, 0, 0); + temp = 6; + temp += GetStringCenterAlignXOffset(1, gText_HP4, 42); + sub_81C25A4(10, gText_HP4, temp, 1, 0, 1); + temp = 6; + temp += GetStringCenterAlignXOffset(1, gText_Attack3, 42); + sub_81C25A4(10, gText_Attack3, temp, 17, 0, 1); + temp = 6; + temp += GetStringCenterAlignXOffset(1, gText_Defense3, 42); + sub_81C25A4(10, gText_Defense3, temp, 33, 0, 1); + temp = 2; + temp += GetStringCenterAlignXOffset(1, gText_SpAtk4, 36); + sub_81C25A4(11, gText_SpAtk4, temp, 1, 0, 1); + temp = 2; + temp += GetStringCenterAlignXOffset(1, gText_SpDef4, 36); + sub_81C25A4(11, gText_SpDef4, temp, 17, 0, 1); + temp = 2; + temp += GetStringCenterAlignXOffset(1, gText_Speed2, 36); + sub_81C25A4(11, gText_Speed2, temp, 33, 0, 1); + sub_81C25A4(12, gText_ExpPoints, 6, 1, 0, 1); + sub_81C25A4(12, gText_NextLv, 6, 17, 0, 1); + sub_81C25A4(13, gText_Status, 2, 1, 0, 1); + sub_81C25A4(14, gText_Power, 0, 1, 0, 1); + sub_81C25A4(14, gText_Accuracy2, 0, 17, 0, 1); + sub_81C25A4(15, gText_Appeal, 0, 1, 0, 1); + sub_81C25A4(15, gText_Jam, 0, 17, 0, 1); +} + +void sub_81C2AFC(u8 a) +{ + u8 i; + ClearWindowTilemap(0); + ClearWindowTilemap(1); + ClearWindowTilemap(2); + ClearWindowTilemap(3); + switch (a) + { + case 0: + PutWindowTilemap(0); + PutWindowTilemap(4); + if (sub_81A6BF4() == 1 || sub_81B9E94() == 1) + PutWindowTilemap(8); + PutWindowTilemap(9); + break; + case 1: + PutWindowTilemap(1); + PutWindowTilemap(10); + PutWindowTilemap(11); + PutWindowTilemap(12); + break; + case 2: + PutWindowTilemap(2); + if (gUnknown_0203CF1C->unk40BC == 3) + { + if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + PutWindowTilemap(14); + } + else + PutWindowTilemap(5); + break; + case 3: + PutWindowTilemap(3); + if (gUnknown_0203CF1C->unk40BC == 3) + { + if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + PutWindowTilemap(15); + } + else + PutWindowTilemap(5); + break; + } + for (i = 0; i < 8; i++) + { + PutWindowTilemap(gUnknown_0203CF1C->unk40CB[i]); + } + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_81C2C38(u8 a) +{ + u8 i; + switch (a) + { + case 0: + ClearWindowTilemap(4); + if (sub_81A6BF4() == 1 || sub_81B9E94() == 1) + ClearWindowTilemap(8); + ClearWindowTilemap(9); + break; + case 1: + ClearWindowTilemap(10); + ClearWindowTilemap(11); + ClearWindowTilemap(12); + break; + case 2: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + ClearWindowTilemap(14); + } + else + ClearWindowTilemap(5); + break; + case 3: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + ClearWindowTilemap(15); + } + else + ClearWindowTilemap(5); + break; + } + for (i = 0; i < 8; i++) + sub_81C2D68(i); + schedule_bg_copy_tilemap_to_vram(0); +} + + + +#ifdef NONMATCHING +u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) +{ + u8 *r4 = gUnknown_0203CF1C->unk40CB; + if (r4[a] == 0xFF) + { + r4[a] = AddWindow(&template[a]); + FillWindowPixelBuffer(r4[a], 0); + } + return r4[a]; +} +#else +__attribute__((naked)) +u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + adds r3, r0, 0\n\ + lsls r1, 24\n\ + lsrs r2, r1, 24\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r4, =0x000040cb\n\ + adds r1, r2, r4\n\ + ldr r0, [r0]\n\ + adds r4, r0, r1\n\ + ldrb r0, [r4]\n\ + cmp r0, 0xFF\n\ + bne _081C2D56\n\ + lsls r0, r2, 3\n\ + adds r0, r3, r0\n\ + bl AddWindow\n\ + strb r0, [r4]\n\ + ldrb r0, [r4]\n\ + movs r1, 0\n\ + bl FillWindowPixelBuffer\n\ +_081C2D56:\n\ + ldrb r0, [r4]\n\ + pop {r4}\n\ + pop {r1}\n\ + bx r1\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +void sub_81C2D68(u8 a) +{ + u8 *r4 = gUnknown_0203CF1C->unk40CB; + if (r4[a] != 0xFF) + { + ClearWindowTilemap(r4[a]); + RemoveWindow(r4[a]); + r4[a] = 0xFF; + } +} +#else +__attribute__((naked)) +void sub_81C2D68(u8 a) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + ldr r1, =gUnknown_0203CF1C\n\ + ldr r2, =0x000040cb\n\ + adds r0, r2\n\ + ldr r1, [r1]\n\ + adds r4, r1, r0\n\ + ldrb r0, [r4]\n\ + cmp r0, 0xFF\n\ + beq _081C2D8C\n\ + bl ClearWindowTilemap\n\ + ldrb r0, [r4]\n\ + bl RemoveWindow\n\ + movs r0, 0xFF\n\ + strb r0, [r4]\n\ +_081C2D8C:\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C2D9C(u8 a) +{ + u16 i; + for (i = 0; i < 8; i++) + { + if (gUnknown_0203CF1C->unk40CB[i] != 0xFF) + FillWindowPixelBuffer(gUnknown_0203CF1C->unk40CB[i], 0); + } + gUnknown_0861CE54[a](); +} + +void sub_81C2DE4(u8 a) +{ + CreateTask(gUnknown_0861CE64[a], 16); +} + +void sub_81C2E00() +{ + if (gUnknown_0203CF1C->summary.isEgg) + { + sub_81C335C(); + sub_81C33CC(); + sub_81C3428(); + sub_81C349C(); + } + else + { + sub_81C2EC4(); + sub_81C2F5C(); + sub_81C2FD8(); + sub_81C302C(); + sub_81C307C(); + sub_81C3194(); + } +} + +void sub_81C2E40(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + s16 dataa = data[0] - 1; + switch (dataa) + { + case 0: + sub_81C2EC4(); + break; + case 1: + sub_81C2F5C(); + break; + case 2: + sub_81C2FD8(); + break; + case 3: + sub_81C302C(); + break; + case 4: + sub_81C307C(); + break; + case 5: + sub_81C3194(); + break; + case 6: + DestroyTask(taskId); + return; + } + data[0]++; +} + +void sub_81C2EC4() +{ + u8 r5; + int r2; + if (sub_81A6BF4() != 1 && sub_81B9E94() != 1) + { + r5 = sub_81C2D2C(&gUnknown_0861CCCC, 0); + sub_81C25A4(r5, gText_OTSlash, 0, 1, 0, 1); + r2 = GetStringWidth(1, gText_OTSlash, 0); + if (gUnknown_0203CF1C->summary.OTGender == 0) + sub_81C25A4(r5, gUnknown_0203CF1C->summary.OTName, r2, 1, 0, 5); + else + sub_81C25A4(r5, gUnknown_0203CF1C->summary.OTName, r2, 1, 0, 6); + } +} + +void sub_81C2F5C() +{ + int r4; + if (sub_81A6BF4() != 1 && sub_81B9E94() != 1) + { + ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)gUnknown_0203CF1C->summary.OTID, 2, 5); + r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); + } +} + +void sub_81C2FD8() +{ + u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altability); + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); +} + +void sub_81C302C() +{ + u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altability); + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); +} + +void sub_81C307C() +{ + struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + u8 *text; + sub_81AFBF0(); + sub_81AFC0C(0, gUnknown_0861CE74); + sub_81AFC0C(1, gUnknown_0861CE7B); + sub_81C31C0(); + if (sub_81A6BF4() == 1 || sub_81B9E94() == 1 || sub_81C3304() == 1) + sub_81AFC28(gStringVar4, gText_XNature); + else + { + u8 *alloced1 = Alloc(32); + u8 *alloced2 = Alloc(32); + sub_81C31F0(alloced1); + if (sum->metLocation <= 0xD4) + { + sub_8124610(alloced2, sum->metLocation); + sub_81AFC0C(4, alloced2); + } + if (sub_81C3220() == 1) + { + if (sum->metLevel == 0) + text = (sum->metLocation > 0xD4) ? gText_XNatureHatchedSomewhereAt : gText_XNatureHatchedAtYZ; + else + text = (sum->metLocation > 0xD4) ? gText_XNatureMetSomewhereAt : gText_XNatureMetAtYZ; + } + else if (sum->metLocation == 0xFF) + text = gText_XNatureFatefulEncounter; + else if (sum->metLocation != 0xFE && sub_81C32BC()) + text = (sum->metLocation > 0xD4) ? gText_XNatureObtainedInTrade : gText_XNatureProbablyMetAt; + else + text = gText_XNatureObtainedInTrade; + sub_81AFC28(gStringVar4, text); + Free(alloced1); + Free(alloced2); + } +} + +void sub_81C3194() +{ + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0); +} + +void sub_81C31C0() +{ + struct unkSummaryStruct *sumStruct = gUnknown_0203CF1C; + sub_81AFC0C(2, gNatureNamePointers[sumStruct->summary.nature]); + sub_81AFC0C(5, gText_EmptyString5); +} + +void sub_81C31F0(u8 *a) +{ + u8 level = gUnknown_0203CF1C->summary.metLevel; + if (level == 0) + level = 5; + ConvertIntToDecimalStringN(a, level, 0, 3); + sub_81AFC0C(3, a); +} + +u8 sub_81C3220() +{ + struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + u32 r4; + u8 r5; + if (gUnknown_0203CF1C->unk0 == (union unkUnion *)&gEnemyParty) + { + u8 multiID = GetMultiplayerId()^1; + r4 = (u16)gLinkPlayers[multiID].trainerId; + r5 = gLinkPlayers[multiID].gender; + StringCopy(gStringVar1, gLinkPlayers[multiID].name); + } + else + { + r4 = sub_80F0020() & 0xFFFF; + r5 = gSaveBlock2Ptr->playerGender; + StringCopy(gStringVar1, gSaveBlock2Ptr->playerName); + } + if (r5 != sum->OTGender || r4 != (sum->OTID & 0xFFFF) || StringCompareWithoutExtCtrlCodes(gStringVar1, sum->OTName)) + { + return 0; + } + return 1; +} + +u8 sub_81C32BC() +{ + struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + u8 r0 = sum->metGame - 1; + if (r0 <= 4) + return 1; + return 0; +} + +u8 sub_81C32E0() +{ + struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + u8 r0 = sum->metGame - 1; + if (r0 <= 2) + return 1; + return 0; +} + +u8 sub_81C3304() +{ + if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) && gMain.inBattle) + { + if (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5) + return 1; + } + return 0; +} + +#ifdef NONMATCHING +void sub_81C335C() +{ + u8 r4 = sub_81C2D2C(&gUnknown_0861CCCC, 0); + u32 r5 = GetStringWidth(1, gText_OTSlash, 0); + sub_81C25A4(r4, gText_OTSlash, 0, 1, 0, 1); + sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1); +} +#else +__attribute__((naked)) +void sub_81C335C() +{ + asm(".syntax unified\n\ + push {r4-r6,lr}\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5,r6}\n\ + sub sp, 0x8\n\ + ldr r0, =gUnknown_0861CCCC\n\ + movs r1, 0\n\ + bl sub_81C2D2C\n\ + adds r4, r0, 0\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + ldr r0, =gText_OTSlash\n\ + mov r8, r0\n\ + movs r0, 0x1\n\ + mov r1, r8\n\ + movs r2, 0\n\ + bl GetStringWidth\n\ + adds r5, r0, 0\n\ + movs r0, 0\n\ + mov r9, r0\n\ + str r0, [sp]\n\ + movs r6, 0x1\n\ + str r6, [sp, 0x4]\n\ + adds r0, r4, 0\n\ + mov r1, r8\n\ + movs r2, 0\n\ + movs r3, 0x1\n\ + bl sub_81C25A4\n\ + ldr r1, =gText_FiveMarks\n\ + lsls r5, 24\n\ + lsrs r5, 24\n\ + mov r0, r9\n\ + str r0, [sp]\n\ + str r6, [sp, 0x4]\n\ + adds r0, r4, 0\n\ + adds r2, r5, 0\n\ + movs r3, 0x1\n\ + bl sub_81C25A4\n\ + add sp, 0x8\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C33CC() +{ + int r4; + StringCopy(gStringVar1, gText_UnkCtrlF907F908); + StringAppend(gStringVar1, gText_FiveMarks); + r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); +} + +void sub_81C3428() +{ + u8 *text; + struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + if (gUnknown_0203CF1C->summary.sanity == 1) + text = gText_EggWillTakeALongTime; + else if (sum->friendship <= 5) + text = gText_EggAboutToHatch; + else if (sum->friendship <= 10) + text = gText_EggWillHatchSoon; + else if (sum->friendship <= 40) + text = gText_EggWillTakeSomeTime; + else + text = gText_EggWillTakeALongTime; + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), text, 0, 1, 0, 0); +} + +void sub_81C349C() +{ + u8 *text; + struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + if (gUnknown_0203CF1C->summary.sanity != 1) + { + if (sum->metLocation == 0xFF) + text = gText_PeculiarEggNicePlace; + else if (sub_81C32BC() == 0 || sub_81C3220() == 0) + text = gText_PeculiarEggTrade; + else if (sum->metLocation == 0xFD) + text = (sub_81C32E0() == 1) ? gText_EggFromHotSprings : gText_EggFromTraveler; + else + text = gText_OddEggFoundByCouple; + } + else + text = gText_OddEggFoundByCouple; + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 3), text, 0, 1, 0, 0); +} + +void sub_81C3530() +{ + sub_81C35E4(); + sub_81C3690(); + sub_81C3710(); + sub_81C37D8(); + sub_81C3808(); + sub_81C3890(); + sub_81C38C0(); +} + +void sub_81C3554(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + s16 dataa = data[0] - 1; + switch (dataa) + { + case 0: + sub_81C35E4(); + break; + case 1: + sub_81C3690(); + break; + case 2: + sub_81C3710(); + break; + case 3: + sub_81C37D8(); + break; + case 4: + sub_81C3808(); + break; + case 5: + sub_81C3890(); + break; + case 6: + sub_81C38C0(); + break; + case 7: + DestroyTask(taskId); + return; + } + data[0]++; +} + +void sub_81C35E4() +{ + u8 *text; + int offset; + if (gUnknown_0203CF1C->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == 1 && (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5)) + { + text = (u8*)ItemId_GetItem(ITEM_ENIGMA_BERRY); + } + else if (gUnknown_0203CF1C->summary.item == ITEM_NONE) + text = gText_None; + else + { + CopyItemName(gUnknown_0203CF1C->summary.item, gStringVar1); + text = gStringVar1; + } + offset = GetStringCenterAlignXOffset(1, text, 0x48) + 6; + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 0), text, offset, 1, 0, 0); +} + +void sub_81C3690() +{ + u8 *text; + int offset; + if (gUnknown_0203CF1C->summary.ribbons == 0) + text = gText_None; + else + { + ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.ribbons, 1, 2); + StringExpandPlaceholders(gStringVar4, gText_RibbonsVar1); + text = gStringVar4; + } + offset = GetStringCenterAlignXOffset(1, text, 0x46) + 6; + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 1), text, offset, 1, 0, 0); +} + +void sub_81C3710() +{ + u8 *alloced1 = Alloc(8); + u8 *alloced2 = Alloc(8); + u8 *alloced3 = Alloc(8); + u8 *alloced4 = Alloc(8); + ConvertIntToDecimalStringN(alloced1, gUnknown_0203CF1C->summary.currentHP, 1, 3); + ConvertIntToDecimalStringN(alloced2, gUnknown_0203CF1C->summary.maxHP, 1, 3); + ConvertIntToDecimalStringN(alloced3, gUnknown_0203CF1C->summary.atk, 1, 7); + ConvertIntToDecimalStringN(alloced4, gUnknown_0203CF1C->summary.def, 1, 7); + sub_81AFBF0(); + sub_81AFC0C(0, alloced1); + sub_81AFC0C(1, alloced2); + sub_81AFC0C(2, alloced3); + sub_81AFC0C(3, alloced4); + sub_81AFC28(gStringVar4, gUnknown_0861CE82); + Free(alloced1); + Free(alloced2); + Free(alloced3); + Free(alloced4); +} + +void sub_81C37D8() +{ + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0); +} + +void sub_81C3808() +{ + ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.spatk, 1, 3); + ConvertIntToDecimalStringN(gStringVar2, gUnknown_0203CF1C->summary.spdef, 1, 3); + ConvertIntToDecimalStringN(gStringVar3, gUnknown_0203CF1C->summary.speed, 1, 3); + sub_81AFBF0(); + sub_81AFC0C(0, gStringVar1); + sub_81AFC0C(1, gStringVar2); + sub_81AFC0C(2, gStringVar3); + sub_81AFC28(gStringVar4, gUnknown_0861CE8E); +} + +void sub_81C3890() +{ + sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0); +} + +void sub_81C38C0() +{ + struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + u8 r6 = sub_81C2D2C(&gUnknown_0861CCEC, 4); + int offset; + u32 expToNextLevel; + ConvertIntToDecimalStringN(gStringVar1, sum->exp, 1, 7); + offset = GetStringRightAlignXOffset(1, gStringVar1, 0x2A) + 2; + sub_81C25A4(r6, gStringVar1, offset, 1, 0, 0); + if (sum->level < MAX_MON_LEVEL) + expToNextLevel = gExperienceTables[gBaseStats[sum->species].growthRate][sum->level + 1] - sum->exp; + else + expToNextLevel = 0; + ConvertIntToDecimalStringN(gStringVar1, expToNextLevel, 1, 6); + offset = GetStringRightAlignXOffset(1, gStringVar1, 0x2A) + 2; + sub_81C25A4(r6, gStringVar1, offset, 17, 0, 0); +} + +void sub_81C3984() +{ + sub_81C3B08(0); + sub_81C3B08(1); + sub_81C3B08(2); + sub_81C3B08(3); + if (gUnknown_0203CF1C->unk40BC == 3) + { + sub_81C3F44(); + if (gUnknown_0203CF1C->unk40C6 == 4) + { + if (gUnknown_0203CF1C->unk40C4 != 0) + sub_81C3E9C(gUnknown_0203CF1C->unk40C4); + } + else + sub_81C3E9C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); + } +} + +void sub_81C39F0(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + s16 dataa = data[0] - 1; + + switch (dataa) + { + case 0: + sub_81C3B08(0); + break; + case 1: + sub_81C3B08(1); + break; + case 2: + sub_81C3B08(2); + break; + case 3: + sub_81C3B08(3); + break; + case 4: + if (gUnknown_0203CF1C->unk40BC == 3) + sub_81C3F44(); + break; + case 5: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if (gUnknown_0203CF1C->unk40C6 == 4) + data[1] = gUnknown_0203CF1C->unk40C4; + else + data[1] = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + } + break; + case 6: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if (!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + sub_81C3E9C(data[1]); + } + break; + case 7: + DestroyTask(taskId); + return; + } + data[0]++; +} + +#ifdef NONMATCHING +void sub_81C3B08(u8 a) +{ + struct unkSummaryStruct *r10 = gUnknown_0203CF1C; + u8 r8 = sub_81C2D2C(&gUnknown_0861CD14, 0); + u8 sp = sub_81C2D2C(&gUnknown_0861CD14, 1); + u8 r6; + u8 r5; + u8 *text; + int offset; + u16 move; + if (r10->summary.moves[a] != 0) + { + move = r10->summary.moves[a]; + r6 = CalculatePPWithBonus(move, r10->summary.ppBonuses, a); + sub_81C25A4(r8, gMoveNames[move], 0, (a<<4) + 1, 0, 1); + ConvertIntToDecimalStringN(gStringVar1, r10->summary.pp[a], 1, 2); + ConvertIntToDecimalStringN(gStringVar2, r6, 1, 2); + sub_81AFBF0(); + sub_81AFC0C(0, gStringVar1); + sub_81AFC0C(1, gStringVar2); + sub_81AFC28(gStringVar4, gUnknown_0861CE97); + text = gStringVar4; + r5 = sub_814FC20(r10->summary.pp[a], r6) + 9; + offset = GetStringRightAlignXOffset(1, text, 0x2C); + } + else + { + sub_81C25A4(r8, gText_OneDash, 0, (a<<4) + 1, 0, 1); + text = gText_TwoDashes; + r5 = 12; + offset = GetStringCenterAlignXOffset(1, text, 0x2C); + } + sub_81C25A4(sp, text, offset, (a<<4), 0, r5); +} +#else +__attribute__((naked)) +void sub_81C3B08(u8 a) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0xC\n\ + lsls r0, 24\n\ + lsrs r7, r0, 24\n\ + ldr r0, =gUnknown_0203CF1C\n\ + ldr r0, [r0]\n\ + mov r10, r0\n\ + ldr r4, =gUnknown_0861CD14\n\ + adds r0, r4, 0\n\ + movs r1, 0\n\ + bl sub_81C2D2C\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + adds r0, r4, 0\n\ + movs r1, 0x1\n\ + bl sub_81C2D2C\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x8]\n\ + lsls r1, r7, 1\n\ + mov r0, r10\n\ + adds r0, 0x84\n\ + adds r0, r1\n\ + ldrh r5, [r0]\n\ + cmp r5, 0\n\ + beq _081C3C00\n\ + mov r0, r10\n\ + adds r0, 0xA4\n\ + ldrb r1, [r0]\n\ + adds r0, r5, 0\n\ + adds r2, r7, 0\n\ + bl CalculatePPWithBonus\n\ + adds r6, r0, 0\n\ + lsls r6, 24\n\ + lsrs r6, 24\n\ + movs r0, 0xD\n\ + adds r1, r5, 0\n\ + muls r1, r0\n\ + ldr r0, =gMoveNames\n\ + adds r1, r0\n\ + lsls r0, r7, 4\n\ + mov r9, r0\n\ + mov r3, r9\n\ + adds r3, 0x1\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + movs r0, 0\n\ + str r0, [sp]\n\ + movs r0, 0x1\n\ + str r0, [sp, 0x4]\n\ + mov r0, r8\n\ + movs r2, 0\n\ + bl sub_81C25A4\n\ + ldr r0, =gStringVar1\n\ + mov r8, r0\n\ + mov r5, r10\n\ + adds r5, 0x8C\n\ + adds r5, r7\n\ + ldrb r1, [r5]\n\ + movs r2, 0x1\n\ + movs r3, 0x2\n\ + bl ConvertIntToDecimalStringN\n\ + ldr r4, =gStringVar2\n\ + adds r0, r4, 0\n\ + adds r1, r6, 0\n\ + movs r2, 0x1\n\ + movs r3, 0x2\n\ + bl ConvertIntToDecimalStringN\n\ + bl sub_81AFBF0\n\ + movs r0, 0\n\ + mov r1, r8\n\ + bl sub_81AFC0C\n\ + movs r0, 0x1\n\ + adds r1, r4, 0\n\ + bl sub_81AFC0C\n\ + ldr r4, =gStringVar4\n\ + ldr r1, =gUnknown_0861CE97\n\ + adds r0, r4, 0\n\ + bl sub_81AFC28\n\ + adds r7, r4, 0\n\ + ldrb r0, [r5]\n\ + adds r1, r6, 0\n\ + bl sub_814FC20\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + adds r5, r0, 0\n\ + adds r5, 0x9\n\ + movs r0, 0x1\n\ + adds r1, r7, 0\n\ + movs r2, 0x2C\n\ + bl GetStringRightAlignXOffset\n\ + mov r4, r9\n\ + b _081C3C26\n\ + .pool\n\ +_081C3C00:\n\ + ldr r1, =gText_OneDash\n\ + lsls r4, r7, 4\n\ + adds r3, r4, 0x1\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + str r5, [sp]\n\ + movs r0, 0x1\n\ + str r0, [sp, 0x4]\n\ + mov r0, r8\n\ + movs r2, 0\n\ + bl sub_81C25A4\n\ + ldr r7, =gText_TwoDashes\n\ + movs r5, 0xC\n\ + movs r0, 0x1\n\ + adds r1, r7, 0\n\ + movs r2, 0x2C\n\ + bl GetStringCenterAlignXOffset\n\ +_081C3C26:\n\ + lsls r2, r0, 24\n\ + lsrs r2, 24\n\ + adds r3, r4, 0x1\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + movs r0, 0\n\ + str r0, [sp]\n\ + lsls r0, r5, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x4]\n\ + ldr r0, [sp, 0x8]\n\ + adds r1, r7, 0\n\ + bl sub_81C25A4\n\ + add sp, 0xC\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81C3C5C(u16 move) +{ + u8 *text; + if (move != 0) + { + FillWindowPixelRect(14, 0, 0x35, 0, 0x13, 0x20); + if (gBattleMoves[move].power <= 1) + text = gText_ThreeDashes; + else + { + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, 1, 3); + text = gStringVar1; + } + sub_81C25A4(14, text, 0x35, 1, 0, 0); + if (gBattleMoves[move].accuracy == 0) + text = gText_ThreeDashes; + else + { + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, 1, 3); + text = gStringVar1; + } + sub_81C25A4(14, text, 0x35, 17, 0, 0); + } +} + +void sub_81C3D08() +{ + sub_81C3B08(0); + sub_81C3B08(1); + sub_81C3B08(2); + sub_81C3B08(3); + if (gUnknown_0203CF1C->unk40BC == 3) + { + sub_81C3F44(); + sub_81C3E2C(gUnknown_0203CF1C->unk40C6); + } +} + +void sub_81C3D54(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + s16 dataa = data[0] - 1; + + switch (dataa) + { + case 0: + sub_81C3B08(0); + break; + case 1: + sub_81C3B08(1); + break; + case 2: + sub_81C3B08(2); + break; + case 3: + sub_81C3B08(3); + break; + case 4: + if (gUnknown_0203CF1C->unk40BC == 3) + sub_81C3F44(); + break; + case 5: + if (gUnknown_0203CF1C->unk40BC == 3) + { + if (!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + sub_81C3E2C(gUnknown_0203CF1C->unk40C6); + } + break; + case 6: + DestroyTask(taskId); + return; + } + data[0]++; } \ No newline at end of file From 79a947ed16f55b7fd045813d27659c087c211669 Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Wed, 18 Oct 2017 19:52:33 -0400 Subject: [PATCH 13/21] git made me --- src/pokemon_summary_screen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index a44102b4b8..c5b1970265 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -154,7 +154,6 @@ extern u8 gText_None[]; extern u8 gText_RibbonsVar1[]; extern u8 gUnknown_0861CE82[]; extern u8 gUnknown_0861CE8E[]; -extern u8 gMoveNames[][13]; extern u8 gText_OneDash[]; extern u8 gText_TwoDashes[]; extern u8 gText_ThreeDashes[]; From 7a515ea1f968e09213509e2d4c4547c7d8a35a9d Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Wed, 18 Oct 2017 20:05:26 -0400 Subject: [PATCH 14/21] fixed --- src/pokemon_summary_screen.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index c5b1970265..3e6342f36b 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -171,8 +171,8 @@ extern void sub_81AFBF0(); extern u8 sub_81AFC0C(u8 a, u8 *b); extern void sub_81AFC28(u8 *a, u8 *b); extern void sub_8124610(u8 *a, u8 b); -extern int sub_80F0020(); -extern u8 sub_814FC20(u8 a, u8 b); +extern int GetPlayerIDAsU32(); +extern u8 GetCurrentPpToMaxPpState(u8 a, u8 b); void sub_81BFAE4(void); void sub_81BFE24(); @@ -3065,7 +3065,7 @@ u8 sub_81C3220() } else { - r4 = sub_80F0020() & 0xFFFF; + r4 = GetPlayerIDAsU32() & 0xFFFF; r5 = gSaveBlock2Ptr->playerGender; StringCopy(gStringVar1, gSaveBlock2Ptr->playerName); } @@ -3443,7 +3443,7 @@ void sub_81C3B08(u8 a) sub_81AFC0C(1, gStringVar2); sub_81AFC28(gStringVar4, gUnknown_0861CE97); text = gStringVar4; - r5 = sub_814FC20(r10->summary.pp[a], r6) + 9; + r5 = GetCurrentPpToMaxPpState(r10->summary.pp[a], r6) + 9; offset = GetStringRightAlignXOffset(1, text, 0x2C); } else @@ -3547,7 +3547,7 @@ void sub_81C3B08(u8 a) adds r7, r4, 0\n\ ldrb r0, [r5]\n\ adds r1, r6, 0\n\ - bl sub_814FC20\n\ + bl GetCurrentPpToMaxPpState\n\ lsls r0, 24\n\ lsrs r0, 24\n\ adds r5, r0, 0\n\ From c63acde25054bf61a9fb955bbabd704b7521faec Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Fri, 20 Oct 2017 16:18:29 -0400 Subject: [PATCH 15/21] updating --- src/pokemon_summary_screen.c | 78 ++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 3e6342f36b..4ab36392d7 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -20,7 +20,7 @@ #include "text.h" #include "window.h" -struct contestMove +struct ContestMove { u8 effect; u8 type; @@ -28,7 +28,7 @@ struct contestMove u8 combo[4]; }; -struct contestEffect +struct ContestEffect { u8 type; u8 appeal; @@ -37,7 +37,7 @@ struct contestEffect -extern struct unkSummaryStruct* gUnknown_0203CF1C; +extern struct UnkSummaryStruct* gUnknown_0203CF1C; extern struct BgTemplate gUnknown_0861CBB4; extern u8 gUnknown_0203CF20; extern struct MusicPlayerInfo gMPlay_BGM; @@ -50,8 +50,8 @@ extern struct unkStruct_61CC04 gUnknown_0861CC10; extern struct unkStruct_61CC04 gUnknown_0861CBEC; extern struct unkStruct_61CC04 gUnknown_0861CBF8; extern u16 gUnknown_08DC3CD4[]; -extern struct contestMove gContestMoves[]; -extern struct contestEffect gContestEffects[]; +extern struct ContestMove gContestMoves[]; +extern struct ContestEffect gContestEffects[]; extern struct WindowTemplate gUnknown_0861CC24; extern struct TextColor gUnknown_0861CD2C[]; extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; @@ -289,14 +289,14 @@ u8 sub_81B1250(); union unkUnion { - struct Pokemon mons[6]; - struct BoxPokemon boxMons[6]; + struct Pokemon mon[6]; + struct BoxPokemon boxMon[6]; }; u8 sub_80D214C(union unkUnion* a, u8 b, u8 c, u8 d); -struct pokeSummary +struct PokeSummary { u16 species; // 0x0 u16 species2; // 0x2 @@ -304,7 +304,7 @@ struct pokeSummary u8 level; // 0x5 u8 ribbons; // 0x6 u8 unk7; // 0x7 - u8 altability; // 0x8 + u8 altAbility; // 0x8 u8 metLocation; // 0x9 u8 metLevel; // 0xA u8 metGame; // 0xB @@ -330,13 +330,13 @@ struct pokeSummary u32 OTID; // 0x48 }; -struct unkSummaryStruct +struct UnkSummaryStruct { /*0x00*/ union unkUnion *unk0; /*0x04*/ void *unk4; /*0x08*/ void *unk8; /*0x0C*/ struct Pokemon currentPoke; - /*0x70*/ struct pokeSummary summary; + /*0x70*/ struct PokeSummary summary; u16 unkTilemap0[0x400]; u16 unkTilemap0_1[0x400]; u16 unkTilemap1[0x400]; @@ -583,8 +583,8 @@ void sub_81BFE24() 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); + SetGpuReg(REG_OFFSET_DISPCNT, 0x1040); + SetGpuReg(REG_OFFSET_BLDCNT, 0); ShowBg(0); ShowBg(1); ShowBg(2); @@ -660,20 +660,20 @@ void sub_81C0098(struct Pokemon *poke) { if (gUnknown_0203CF1C->unk40BD == 0) { - struct Pokemon *pokeMons = gUnknown_0203CF1C->unk0->mons; - *poke = pokeMons[gUnknown_0203CF1C->unk40BE]; + struct Pokemon *partyMon = gUnknown_0203CF1C->unk0->mon; + *poke = partyMon[gUnknown_0203CF1C->unk40BE]; } else { - struct BoxPokemon *boxMons = gUnknown_0203CF1C->unk0->boxMons; - sub_8069004(&boxMons[gUnknown_0203CF1C->unk40BE], poke); + struct BoxPokemon *boxMon = gUnknown_0203CF1C->unk0->boxMon; + sub_8069004(&boxMon[gUnknown_0203CF1C->unk40BE], poke); } } bool8 sub_81C00F0(struct Pokemon *a) { u32 i; - struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; switch (gUnknown_0203CF1C->unk40F0) { case 0: @@ -681,7 +681,7 @@ bool8 sub_81C00F0(struct Pokemon *a) 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->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); @@ -968,7 +968,7 @@ void sub_81C0704(u8 taskId) s8 sub_81C08F8(s8 a) { - struct Pokemon *mons = gUnknown_0203CF1C->unk0->mons; + struct Pokemon *mon = gUnknown_0203CF1C->unk0->mon; if (gUnknown_0203CF1C->unk40C0 == 0) { @@ -987,14 +987,14 @@ s8 sub_81C08F8(s8 a) index += a; if (index < 0 || index > gUnknown_0203CF1C->unk40BF) return -1; - } while (GetMonData(&mons[index], MON_DATA_IS_EGG) != 0); + } while (GetMonData(&mon[index], MON_DATA_IS_EGG) != 0); return index; } } s8 sub_81C09B4(s8 a) { - struct Pokemon *mons = gUnknown_0203CF1C->unk0->mons; + struct Pokemon *mon = gUnknown_0203CF1C->unk0->mon; s8 r5 = 0; u8 i; @@ -1016,7 +1016,7 @@ s8 sub_81C09B4(s8 a) if (r5 < 0 || r5 >= 6) return -1; b = c[r5]; - if (sub_81C0A50(&mons[b]) == TRUE) + if (sub_81C0A50(&mon[b]) == TRUE) return b; } } @@ -1033,7 +1033,7 @@ bool8 sub_81C0A50(struct Pokemon* mon) void sub_81C0A8C(u8 taskId, s8 b) { - struct pokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &gUnknown_0203CF1C->summary; s16 *data = gTasks[taskId].data; if (summary->isEgg) @@ -1357,12 +1357,12 @@ void sub_81C13B0(u8 taskId, u8 b) { if (gUnknown_0203CF1C->unk40BD == 0) { - struct Pokemon *why = gUnknown_0203CF1C->unk0->mons; + struct Pokemon *why = gUnknown_0203CF1C->unk0->mon; sub_81C14BC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); } else { - struct BoxPokemon *why = gUnknown_0203CF1C->unk0->boxMons; + struct BoxPokemon *why = gUnknown_0203CF1C->unk0->boxMon; sub_81C15EC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); } sub_81C0098(&gUnknown_0203CF1C->currentPoke); @@ -2469,7 +2469,7 @@ void sub_81C228C(u8 a) void sub_81C22CC(struct Pokemon *unused) { s64 r6r7; - struct pokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &gUnknown_0203CF1C->summary; u16 *r9; u8 i; @@ -2579,7 +2579,7 @@ void sub_81C2628() { u8 strArray[16]; struct Pokemon *mon = &gUnknown_0203CF1C->currentPoke; - struct pokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &gUnknown_0203CF1C->summary; u16 r5 = SpeciesToPokedexNum(summary->species); if (r5 != 0xFFFF) { @@ -2981,19 +2981,19 @@ void sub_81C2F5C() void sub_81C2FD8() { - u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altability); + u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); } void sub_81C302C() { - u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altability); + u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); } void sub_81C307C() { - struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u8 *text; sub_81AFBF0(); sub_81AFC0C(0, gUnknown_0861CE74); @@ -3037,7 +3037,7 @@ void sub_81C3194() void sub_81C31C0() { - struct unkSummaryStruct *sumStruct = gUnknown_0203CF1C; + struct UnkSummaryStruct *sumStruct = gUnknown_0203CF1C; sub_81AFC0C(2, gNatureNamePointers[sumStruct->summary.nature]); sub_81AFC0C(5, gText_EmptyString5); } @@ -3053,7 +3053,7 @@ void sub_81C31F0(u8 *a) u8 sub_81C3220() { - struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u32 r4; u8 r5; if (gUnknown_0203CF1C->unk0 == (union unkUnion *)&gEnemyParty) @@ -3078,7 +3078,7 @@ u8 sub_81C3220() u8 sub_81C32BC() { - struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u8 r0 = sum->metGame - 1; if (r0 <= 4) return 1; @@ -3087,7 +3087,7 @@ u8 sub_81C32BC() u8 sub_81C32E0() { - struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u8 r0 = sum->metGame - 1; if (r0 <= 2) return 1; @@ -3179,7 +3179,7 @@ void sub_81C33CC() void sub_81C3428() { u8 *text; - struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; if (gUnknown_0203CF1C->summary.sanity == 1) text = gText_EggWillTakeALongTime; else if (sum->friendship <= 5) @@ -3196,7 +3196,7 @@ void sub_81C3428() void sub_81C349C() { u8 *text; - struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; if (gUnknown_0203CF1C->summary.sanity != 1) { if (sum->metLocation == 0xFF) @@ -3339,7 +3339,7 @@ void sub_81C3890() void sub_81C38C0() { - struct pokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u8 r6 = sub_81C2D2C(&gUnknown_0861CCEC, 4); int offset; u32 expToNextLevel; @@ -3423,7 +3423,7 @@ void sub_81C39F0(u8 taskId) #ifdef NONMATCHING void sub_81C3B08(u8 a) { - struct unkSummaryStruct *r10 = gUnknown_0203CF1C; + struct UnkSummaryStruct *r10 = gUnknown_0203CF1C; u8 r8 = sub_81C2D2C(&gUnknown_0861CD14, 0); u8 sp = sub_81C2D2C(&gUnknown_0861CD14, 1); u8 r6; From 2a60aefed6d00d94adc7d1aa67871dc66f71f18a Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Fri, 20 Oct 2017 16:28:38 -0400 Subject: [PATCH 16/21] updating --- src/pokemon_summary_screen.c | 50 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 4ab36392d7..57f4340b85 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -203,7 +203,7 @@ void sub_81C240C(u16 a); void sub_81C2194(u16 *a, u16 b, u8 c); void sub_81C2074(u16 a, s16 b); void sub_81C2524(); -void sub_81C2228(struct Pokemon* poke); +void sub_81C2228(struct Pokemon* mon); void sub_81C0484(u8 taskId); void sub_81C4898(); void sub_806F47C(u8 a); @@ -287,14 +287,14 @@ void SetBgAttribute(u8 bg, u8 attributeId, u8 value); bool8 sub_81BFB10(); u8 sub_81B1250(); -union unkUnion +union UnkUnion { struct Pokemon mon[6]; struct BoxPokemon boxMon[6]; }; -u8 sub_80D214C(union unkUnion* a, u8 b, u8 c, u8 d); +u8 sub_80D214C(union UnkUnion* a, u8 b, u8 c, u8 d); struct PokeSummary { @@ -332,10 +332,10 @@ struct PokeSummary struct UnkSummaryStruct { - /*0x00*/ union unkUnion *unk0; + /*0x00*/ union UnkUnion *unk0; /*0x04*/ void *unk4; /*0x08*/ void *unk8; - /*0x0C*/ struct Pokemon currentPoke; + /*0x0C*/ struct Pokemon currentMon; /*0x70*/ struct PokeSummary summary; u16 unkTilemap0[0x400]; u16 unkTilemap0_1[0x400]; @@ -490,12 +490,12 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 9: - sub_81C0098(&gUnknown_0203CF1C->currentPoke); + sub_81C0098(&gUnknown_0203CF1C->currentMon); gUnknown_0203CF1C->unk40F0 = 0; gMain.state++; break; case 10: - if (sub_81C00F0(&gUnknown_0203CF1C->currentPoke) != 0) + if (sub_81C00F0(&gUnknown_0203CF1C->currentMon) != 0) gMain.state++; break; case 11: @@ -525,7 +525,7 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 17: - gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentPoke, &gUnknown_0203CF1C->unk40F0); + gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0); if (gUnknown_0203CF1C->unk40D3 != 0xFF) { gUnknown_0203CF1C->unk40F0 = 0; @@ -533,11 +533,11 @@ bool8 sub_81BFB10(void) } break; case 18: - sub_81C4984(&gUnknown_0203CF1C->currentPoke); + sub_81C4984(&gUnknown_0203CF1C->currentMon); gMain.state++; break; case 19: - sub_81C4A08(&gUnknown_0203CF1C->currentPoke); + sub_81C4A08(&gUnknown_0203CF1C->currentMon); gMain.state++; break; case 20: @@ -656,17 +656,17 @@ u8 sub_81BFEB0() return 0; } -void sub_81C0098(struct Pokemon *poke) +void sub_81C0098(struct Pokemon *mon) { if (gUnknown_0203CF1C->unk40BD == 0) { struct Pokemon *partyMon = gUnknown_0203CF1C->unk0->mon; - *poke = partyMon[gUnknown_0203CF1C->unk40BE]; + *mon = partyMon[gUnknown_0203CF1C->unk40BE]; } else { struct BoxPokemon *boxMon = gUnknown_0203CF1C->unk0->boxMon; - sub_8069004(&boxMon[gUnknown_0203CF1C->unk40BE], poke); + sub_8069004(&boxMon[gUnknown_0203CF1C->unk40BE], mon); } } @@ -769,7 +769,7 @@ void sub_81C0348(void) PutWindowTilemap(0xD); } sub_81C2524(); - sub_81C2228(&gUnknown_0203CF1C->currentPoke); + sub_81C2228(&gUnknown_0203CF1C->currentMon); } void sub_81C0434() @@ -915,27 +915,27 @@ void sub_81C0704(u8 taskId) DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D4]); break; case 3: - sub_81C0098(&gUnknown_0203CF1C->currentPoke); + sub_81C0098(&gUnknown_0203CF1C->currentMon); gUnknown_0203CF1C->unk40F0 = 0; break; case 4: - if (sub_81C00F0(&gUnknown_0203CF1C->currentPoke) == FALSE) + if (sub_81C00F0(&gUnknown_0203CF1C->currentMon) == FALSE) return; break; case 5: - sub_81C49E0(&gUnknown_0203CF1C->currentPoke); + sub_81C49E0(&gUnknown_0203CF1C->currentMon); break; case 6: - sub_81C4A08(&gUnknown_0203CF1C->currentPoke); + sub_81C4A08(&gUnknown_0203CF1C->currentMon); break; case 7: if (gUnknown_0203CF1C->summary.unk7) sub_81C2074(10, -2); - sub_81C2228(&gUnknown_0203CF1C->currentPoke); + sub_81C2228(&gUnknown_0203CF1C->currentMon); data[1] = 0; break; case 8: - gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentPoke, &data[1]); + gUnknown_0203CF1C->unk40D3 = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]); if (gUnknown_0203CF1C->unk40D3 == 0xFF) return; gSprites[gUnknown_0203CF1C->unk40D3].data2 = 1; @@ -1149,7 +1149,7 @@ void sub_81C0D44(u8 taskId) void sub_81C0E24() { if (gUnknown_0203CF1C->unk40C0 == 1) - sub_81C22CC(&gUnknown_0203CF1C->currentPoke); + sub_81C22CC(&gUnknown_0203CF1C->currentMon); } void sub_81C0E48(u8 taskId) @@ -1365,7 +1365,7 @@ void sub_81C13B0(u8 taskId, u8 b) struct BoxPokemon *why = gUnknown_0203CF1C->unk0->boxMon; sub_81C15EC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); } - sub_81C0098(&gUnknown_0203CF1C->currentPoke); + sub_81C0098(&gUnknown_0203CF1C->currentMon); sub_81C40A0(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); sub_81C4568(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); gUnknown_0203CF1C->unk40C6 = gUnknown_0203CF1C->unk40C7; @@ -2578,7 +2578,7 @@ void sub_81C25E8() void sub_81C2628() { u8 strArray[16]; - struct Pokemon *mon = &gUnknown_0203CF1C->currentPoke; + struct Pokemon *mon = &gUnknown_0203CF1C->currentMon; struct PokeSummary *summary = &gUnknown_0203CF1C->summary; u16 r5 = SpeciesToPokedexNum(summary->species); if (r5 != 0xFFFF) @@ -2622,7 +2622,7 @@ void sub_81C2628() void sub_81C2794() { - GetMonNickname(&gUnknown_0203CF1C->currentPoke, gStringVar1); + GetMonNickname(&gUnknown_0203CF1C->currentMon, gStringVar1); sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); PutWindowTilemap(18); ClearWindowTilemap(17); @@ -3056,7 +3056,7 @@ u8 sub_81C3220() struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u32 r4; u8 r5; - if (gUnknown_0203CF1C->unk0 == (union unkUnion *)&gEnemyParty) + if (gUnknown_0203CF1C->unk0 == (union UnkUnion *)&gEnemyParty) { u8 multiID = GetMultiplayerId()^1; r4 = (u16)gLinkPlayers[multiID].trainerId; From 77ef72f782e9d86d4b9e7eebaa9ca186570b5e61 Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Fri, 20 Oct 2017 16:31:12 -0400 Subject: [PATCH 17/21] updating --- src/pokemon_summary_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 57f4340b85..05cd0b2d19 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -372,7 +372,7 @@ struct UnkSummaryStruct void sub_81BF8EC(u8 a, void *b, u8 c, u8 d, void *e) { u8 byte; - gUnknown_0203CF1C = AllocZeroed(0x40F8); + gUnknown_0203CF1C = AllocZeroed(sizeof(struct UnkSummaryStruct)); gUnknown_0203CF1C->unk40BC = a; gUnknown_0203CF1C->unk0 = b; gUnknown_0203CF1C->unk40BE = c; From fd464a546c3c6b975430085cfd506eea3d8f674f Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Sat, 21 Oct 2017 14:11:32 -0400 Subject: [PATCH 18/21] updating --- src/pokemon_summary_screen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 05cd0b2d19..7a7b6604e2 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -281,6 +281,7 @@ void sub_81C3890(); void sub_81C38C0(); void sub_81C3B08(u8 a); void sub_81C3E2C(u8 a); +void sub_81C4D18(); void SetBgAttribute(u8 bg, u8 attributeId, u8 value); @@ -1233,8 +1234,6 @@ bool8 sub_81C1040(void) return FALSE; } -void sub_81C4D18(); - void sub_81C1070(s16 *a, s8 b, u8 *c) { s8 i; From 52d368a29a1680e0c0df1bb24d6979204fe2c518 Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Sun, 22 Oct 2017 15:01:34 -0400 Subject: [PATCH 19/21] all done --- src/pokemon_summary_screen.c | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 7a7b6604e2..724e345a46 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -45,10 +45,10 @@ extern s8 gUnknown_0861CC1C[]; extern u8 gUnknown_08329D22[]; extern u8 gUnknown_0203CF21; extern u16 gSpecialVar_0x8005; -extern struct unkStruct_61CC04 gUnknown_0861CC04; -extern struct unkStruct_61CC04 gUnknown_0861CC10; -extern struct unkStruct_61CC04 gUnknown_0861CBEC; -extern struct unkStruct_61CC04 gUnknown_0861CBF8; +extern struct UnkStruct_61CC04 gUnknown_0861CC04; +extern struct UnkStruct_61CC04 gUnknown_0861CC10; +extern struct UnkStruct_61CC04 gUnknown_0861CBEC; +extern struct UnkStruct_61CC04 gUnknown_0861CBF8; extern u16 gUnknown_08DC3CD4[]; extern struct ContestMove gContestMoves[]; extern struct ContestEffect gContestEffects[]; @@ -1862,12 +1862,12 @@ void sub_81C174C(u8 taskId) } } -u8 sub_81C18A8() +bool8 sub_81C18A8() { if (gUnknown_0203CF1C->unk40C6 == 4 || gUnknown_0203CF1C->unk40C4 == 0 || sub_81B6D14(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]) != 1) - return 1; + return TRUE; else - return 0; + return FALSE; } void sub_81C18F4(u8 taskId) @@ -2017,7 +2017,7 @@ void sub_81C1BA0() Free(alloced); } -struct unkStruct_61CC04 +struct UnkStruct_61CC04 { u8 *ptr; u8 field_4; @@ -2029,7 +2029,7 @@ struct unkStruct_61CC04 }; #ifdef NONMATCHING -void sub_81C1CB0(struct unkStruct_61CC04 *a, u16 *b, u8 c, u8 d) +void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) { u8 *alloced = Alloc(a->field_6 * (a->field_7 << 1)); CpuFill16(a->field_4, alloced, a->field_7*a->field_6); @@ -2060,7 +2060,7 @@ void sub_81C1CB0(struct unkStruct_61CC04 *a, u16 *b, u8 c, u8 d) } #else __attribute__((naked)) -void sub_81C1CB0(struct unkStruct_61CC04 *a, u16 *b, u8 c, u8 d) +void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) { asm(".syntax unified\n\ push {r4-r7,lr}\n\ @@ -2645,7 +2645,7 @@ void sub_81C27DC(struct Pokemon *mon, u16 a) } } -void sub_81C2838(u8 a, u8 b, u32 c) +void sub_81C2838(u8 a, bool8 b, u32 c) { BlitBitmapToWindow(a, (b) ? &gUnknown_0861CDD3[0] : &gUnknown_0861CDD3[0] - 0x80, c, 0, 16, 16); } @@ -3075,32 +3075,32 @@ u8 sub_81C3220() return 1; } -u8 sub_81C32BC() +bool8 sub_81C32BC() { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u8 r0 = sum->metGame - 1; if (r0 <= 4) - return 1; - return 0; + return TRUE; + return FALSE; } -u8 sub_81C32E0() +bool8 sub_81C32E0() { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u8 r0 = sum->metGame - 1; if (r0 <= 2) - return 1; - return 0; + return TRUE; + return FALSE; } -u8 sub_81C3304() +bool8 sub_81C3304() { if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) && gMain.inBattle) { if (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5) - return 1; + return TRUE; } - return 0; + return FALSE; } #ifdef NONMATCHING From 72dcfeddd7a47eda5e397066d91f2f18024363dd Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Sun, 22 Oct 2017 15:12:48 -0400 Subject: [PATCH 20/21] all done(I hope) --- src/pokemon_summary_screen.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 724e345a46..b2f18090b4 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -247,7 +247,7 @@ void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); void sub_81C40A0(u8 a, u8 b); void sub_81C4568(u8 a, u8 b); void sub_81C174C(u8 taskId); -u8 sub_81C18A8(); +bool8 sub_81C18A8(); void sub_81C18F4(u8 a); u8 sub_81B6D14(u16 a); void sub_81C1940(u8 taskId); @@ -268,10 +268,10 @@ void sub_81C302C(); void sub_81C307C(); void sub_81C3194(); void sub_81C31C0(); -u8 sub_81C3304(); +bool8 sub_81C3304(); void sub_81C31F0(u8 *a); u8 sub_81C3220(); -u8 sub_81C32BC(); +bool8 sub_81C32BC(); void sub_81C35E4(); void sub_81C3690(); void sub_81C3710(); @@ -1835,7 +1835,7 @@ void sub_81C174C(u8 taskId) } else if (gMain.newKeys & A_BUTTON) { - if (sub_81C18A8() == 1) + if (sub_81C18A8() == TRUE) { sub_81C48F0(); PlaySE(SE_SELECT); @@ -2998,7 +2998,7 @@ void sub_81C307C() sub_81AFC0C(0, gUnknown_0861CE74); sub_81AFC0C(1, gUnknown_0861CE7B); sub_81C31C0(); - if (sub_81A6BF4() == 1 || sub_81B9E94() == 1 || sub_81C3304() == 1) + if (sub_81A6BF4() == 1 || sub_81B9E94() == 1 || sub_81C3304() == TRUE) sub_81AFC28(gStringVar4, gText_XNature); else { @@ -3203,7 +3203,7 @@ void sub_81C349C() else if (sub_81C32BC() == 0 || sub_81C3220() == 0) text = gText_PeculiarEggTrade; else if (sum->metLocation == 0xFD) - text = (sub_81C32E0() == 1) ? gText_EggFromHotSprings : gText_EggFromTraveler; + text = (sub_81C32E0() == TRUE) ? gText_EggFromHotSprings : gText_EggFromTraveler; else text = gText_OddEggFoundByCouple; } From 2082c0491b0f7334683f891ca2558cead7b08aaf Mon Sep 17 00:00:00 2001 From: "U-User-PC\\User" Date: Sun, 22 Oct 2017 21:00:08 -0400 Subject: [PATCH 21/21] more bool8 stuff --- src/pokemon_summary_screen.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index b2f18090b4..37ecdc982e 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -165,8 +165,8 @@ extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f); extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); extern s32 GetStringCenterAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); -extern u8 sub_81A6BF4(); -extern u8 sub_81B9E94(); +extern bool8 sub_81A6BF4(); +extern bool8 sub_81B9E94(); extern void sub_81AFBF0(); extern u8 sub_81AFC0C(u8 a, u8 *b); extern void sub_81AFC28(u8 *a, u8 *b); @@ -2718,7 +2718,7 @@ void sub_81C2AFC(u8 a) case 0: PutWindowTilemap(0); PutWindowTilemap(4); - if (sub_81A6BF4() == 1 || sub_81B9E94() == 1) + if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE) PutWindowTilemap(8); PutWindowTilemap(9); break; @@ -2763,7 +2763,7 @@ void sub_81C2C38(u8 a) { case 0: ClearWindowTilemap(4); - if (sub_81A6BF4() == 1 || sub_81B9E94() == 1) + if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE) ClearWindowTilemap(8); ClearWindowTilemap(9); break; @@ -2970,7 +2970,7 @@ void sub_81C2EC4() void sub_81C2F5C() { int r4; - if (sub_81A6BF4() != 1 && sub_81B9E94() != 1) + if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE) { ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)gUnknown_0203CF1C->summary.OTID, 2, 5); r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); @@ -2998,7 +2998,7 @@ void sub_81C307C() sub_81AFC0C(0, gUnknown_0861CE74); sub_81AFC0C(1, gUnknown_0861CE7B); sub_81C31C0(); - if (sub_81A6BF4() == 1 || sub_81B9E94() == 1 || sub_81C3304() == TRUE) + if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE || sub_81C3304() == TRUE) sub_81AFC28(gStringVar4, gText_XNature); else {