From d3d725cc8398f306eb489dd0e6aa16b7e7564f39 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Thu, 11 Oct 2018 21:23:39 -0400 Subject: [PATCH 01/17] decompiled up to sub_81B0948 --- asm/party_menu.s | 1139 ----------------------------------------- include/battle_main.h | 16 + include/graphics.h | 5 + ld_script.txt | 1 + src/party_menu.c | 521 +++++++++++++++++++ 5 files changed, 543 insertions(+), 1139 deletions(-) create mode 100755 src/party_menu.c diff --git a/asm/party_menu.s b/asm/party_menu.s index 67fdab266..f8b75c036 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -4,1145 +4,6 @@ .syntax unified .text - - thumb_func_start sub_81B0038 -sub_81B0038: @ 81B0038 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r4, [sp, 0x24] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp] - lsls r4, 24 - lsrs r6, r4, 24 - bl reset_brm - ldr r0, =gUnknown_0203CEC4 - mov r10, r0 - movs r0, 0x8E - lsls r0, 2 - bl Alloc - adds r5, r0, 0 - mov r1, r10 - str r5, [r1] - cmp r5, 0 - bne _081B0088 - ldr r0, [sp, 0x2C] - bl SetMainCallback2 - b _081B0194 - .pool -_081B0088: - ldr r3, =gUnknown_0203CEC8 - movs r1, 0xF - mov r4, r8 - ands r1, r4 - ldrb r2, [r3, 0x8] - movs r0, 0x10 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x8] - ldr r0, [sp, 0x2C] - str r0, [r3] - movs r4, 0 - strb r7, [r3, 0xB] - lsls r2, r6, 2 - ldrh r1, [r5, 0xA] - movs r0, 0x3 - ands r0, r1 - orrs r0, r2 - strh r0, [r5, 0xA] - ldr r0, [sp, 0x28] - str r0, [r5] - str r4, [r5, 0x4] - ldrb r1, [r5, 0x8] - movs r0, 0xF - negs r0, r0 - ands r0, r1 - strb r0, [r5, 0x8] - mov r1, r10 - ldr r2, [r1] - ldrh r0, [r2, 0x8] - movs r4, 0xFE - lsls r4, 3 - adds r1, r4, 0 - orrs r0, r1 - strh r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xFE - lsls r1, 10 - orrs r0, r1 - str r0, [r2, 0x8] - adds r6, r3, 0 - mov r5, r8 - cmp r5, 0x4 - bne _081B00F0 - ldrb r0, [r2, 0x8] - movs r1, 0x1 - orrs r0, r1 - b _081B00F8 - .pool -_081B00F0: - ldrb r1, [r2, 0x8] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 -_081B00F8: - strb r0, [r2, 0x8] - mov r0, r9 - cmp r0, 0xFF - beq _081B0114 - movs r0, 0x3 - mov r1, r9 - ands r0, r1 - lsls r0, 4 - ldrb r2, [r6, 0x8] - movs r1, 0x31 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r6, 0x8] -_081B0114: - movs r2, 0 - ldr r5, =gUnknown_0203CEC4 - movs r4, 0x86 - lsls r4, 2 - movs r3, 0 -_081B011E: - ldr r0, [r5] - lsls r1, r2, 1 - adds r0, r4 - adds r0, r1 - strh r3, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0xF - bls _081B011E - movs r2, 0 - ldr r4, =gUnknown_0203CEC4 - movs r3, 0xFF -_081B0138: - ldr r0, [r4] - adds r0, 0xC - adds r0, r2 - ldrb r1, [r0] - orrs r1, r3 - strb r1, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x2 - bls _081B0138 - ldr r4, [sp] - cmp r4, 0 - bne _081B015C - strb r4, [r6, 0x9] - b _081B017E - .pool -_081B015C: - adds r1, r6, 0 - movs r0, 0x9 - ldrsb r0, [r1, r0] - cmp r0, 0x5 - bgt _081B017A - adds r1, r0, 0 - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - bne _081B017E -_081B017A: - movs r0, 0 - strb r0, [r6, 0x9] -_081B017E: - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - bl CalculatePlayerPartyCount - ldr r0, =c2_811EBD0 - bl SetMainCallback2 -_081B0194: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0038 - - thumb_func_start sub_81B01B0 -sub_81B01B0: @ 81B01B0 - 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_81B01B0 - - thumb_func_start sub_81B01CC -sub_81B01CC: @ 81B01CC - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_81B01CC - - thumb_func_start c2_811EBD0 -c2_811EBD0: @ 81B01E0 - push {lr} -_081B01E2: - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B0206 - bl sub_81B020C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B0206 - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B01E2 -_081B0206: - pop {r0} - bx r0 - thumb_func_end c2_811EBD0 - - thumb_func_start sub_81B020C -sub_81B020C: @ 81B020C - push {r4,lr} - sub sp, 0x4 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0x16 - bls _081B0222 - b _081B0498 -_081B0222: - lsls r0, 2 - ldr r1, =_081B0234 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B0234: - .4byte _081B0290 - .4byte _081B02AC - .4byte _081B02B2 - .4byte _081B02D4 - .4byte _081B02DA - .4byte _081B02EC - .4byte _081B02FE - .4byte _081B0310 - .4byte _081B0338 - .4byte _081B0354 - .4byte _081B0368 - .4byte _081B038C - .4byte _081B03A0 - .4byte _081B03A6 - .4byte _081B03B8 - .4byte _081B03BE - .4byte _081B03E0 - .4byte _081B0400 - .4byte _081B0414 - .4byte _081B0428 - .4byte _081B0430 - .4byte _081B044C - .4byte _081B0474 -_081B0290: - bl SetVBlankHBlankCallbacksToNull - bl ResetVramOamAndBgCntRegs - bl clear_scheduled_bg_copies_to_vram - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B02AC: - bl ScanlineEffect_Stop - b _081B0484 -_081B02B2: - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B02D4: - bl ResetSpriteData - b _081B0484 -_081B02DA: - bl FreeAllSpritePalettes - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B02EC: - bl sub_81221AC - lsls r0, 24 - cmp r0, 0 - beq _081B02F8 - b _081B0484 -_081B02F8: - bl ResetTasks - b _081B0484 -_081B02FE: - bl sub_81B209C - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B0310: - bl sub_81B0550 - lsls r0, 24 - cmp r0, 0 - bne _081B0322 - bl sub_81B04BC - movs r0, 0x1 - b _081B04B2 -_081B0322: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - movs r1, 0x86 - lsls r1, 2 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081B0484 - .pool -_081B0338: - bl sub_81B05C8 - lsls r0, 24 - cmp r0, 0 - bne _081B0344 - b _081B04B0 -_081B0344: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B0354: - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - lsls r0, 26 - lsrs r0, 30 - bl sub_81B239C - b _081B0484 - .pool -_081B0368: - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - lsls r0, 26 - lsrs r0, 30 - bl sub_81B0740 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - movs r1, 0x86 - lsls r1, 2 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081B0484 - .pool -_081B038C: - bl sub_81B5D30 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B03A0: - bl sub_81B6040 - b _081B0484 -_081B03A6: - bl sub_81B6160 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B03B8: - bl LoadMonIconPalettes - b _081B0484 -_081B03BE: - bl party_menu_add_per_mon_objects - lsls r0, 24 - cmp r0, 0 - bne _081B03CA - b _081B04B0 -_081B03CA: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - movs r1, 0x86 - lsls r1, 2 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081B0484 - .pool -_081B03E0: - bl sub_81B0DA0 - lsls r0, 24 - cmp r0, 0 - beq _081B04B0 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - movs r1, 0x86 - lsls r1, 2 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081B0484 - .pool -_081B0400: - bl sub_81B0F28 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B0414: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - lsrs r0, 31 - bl sub_81B2428 - b _081B0484 - .pool -_081B0428: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - b _081B048C -_081B0430: - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0 - bl CreateTask - ldr r0, [r4] - ldrh r0, [r0, 0xA] - lsrs r0, 2 - bl display_pokemon_menu_message - b _081B0484 - .pool -_081B044C: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _081B048C - .pool -_081B0474: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_081B0484: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_081B048C: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _081B04B0 - .pool -_081B0498: - ldr r0, =sub_81B01CC - bl SetVBlankCallback - ldr r0, =sub_81B01B0 - bl SetMainCallback2 - movs r0, 0x1 - b _081B04B2 - .pool -_081B04B0: - movs r0, 0 -_081B04B2: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B020C - - thumb_func_start sub_81B04BC -sub_81B04BC: @ 81B04BC - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sub_81B04F8 - movs r1, 0 - bl CreateTask - ldr r0, =sub_81B01CC - bl SetVBlankCallback - ldr r0, =sub_81B01B0 - bl SetMainCallback2 - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B04BC - - thumb_func_start sub_81B04F8 -sub_81B04F8: @ 81B04F8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B051C - ldr r0, =gUnknown_0203CEC8 - ldr r0, [r0] - bl SetMainCallback2 - bl sub_81B06F4 - adds r0, r4, 0 - bl DestroyTask -_081B051C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B04F8 - - thumb_func_start reset_brm -reset_brm: @ 81B052C - ldr r0, =gUnknown_0203CEC4 - movs r1, 0 - str r1, [r0] - ldr r0, =gUnknown_0203CEE4 - str r1, [r0] - ldr r0, =gUnknown_0203CEDC - str r1, [r0] - ldr r0, =gUnknown_0203CEE0 - str r1, [r0] - bx lr - .pool - thumb_func_end reset_brm - - thumb_func_start sub_81B0550 -sub_81B0550: @ 81B0550 - push {r4,r5,lr} - ldr r5, =gUnknown_0203CEE4 - movs r4, 0x80 - lsls r4, 4 - adds r0, r4, 0 - bl Alloc - str r0, [r5] - cmp r0, 0 - beq _081B05C0 - movs r1, 0 - adds r2, r4, 0 - bl memset - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_086156B8 - movs r0, 0 - movs r2, 0x3 - bl InitBgsFromTemplates - ldr r1, [r5] - movs r0, 0x1 - bl SetBgTilemapBuffer - bl ResetAllBgsCoordinates - movs r0, 0x1 - 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, 0x1 - b _081B05C2 - .pool -_081B05C0: - movs r0, 0 -_081B05C2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81B0550 - - thumb_func_start sub_81B05C8 -sub_81B05C8: @ 81B05C8 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - movs r1, 0x86 - lsls r1, 2 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x7 - bhi _081B06B0 - lsls r0, 2 - ldr r1, =_081B05F0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B05F0: - .4byte _081B0610 - .4byte _081B0638 - .4byte _081B0658 - .4byte _081B0684 - .4byte _081B0688 - .4byte _081B068C - .4byte _081B0690 - .4byte _081B0694 -_081B0610: - ldr r4, =gUnknown_0203CEE0 - ldr r0, =gPartyMenuMisc_Gfx - mov r1, sp - bl malloc_and_decompress - adds r1, r0, 0 - str r1, [r4] - ldr r2, [sp] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0x1 - movs r3, 0 - bl LoadBgTiles - b _081B069A - .pool -_081B0638: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _081B06B4 - ldr r0, =gPartyMenuMisc_Tilemap - ldr r1, =gUnknown_0203CEE4 - ldr r1, [r1] - bl LZDecompressWram - b _081B069A - .pool -_081B0658: - ldr r0, =gPartyMenuMisc_Pal - movs r2, 0xB0 - lsls r2, 1 - movs r1, 0 - bl LoadCompressedPalette - ldr r0, =gPlttBufferUnfaded - ldr r4, =gUnknown_0203CEC4 - ldr r1, [r4] - adds r1, 0x18 - movs r2, 0xB0 - bl CpuSet - ldr r1, [r4] - b _081B069E - .pool -_081B0684: - movs r0, 0x4 - b _081B0696 -_081B0688: - movs r0, 0x5 - b _081B0696 -_081B068C: - movs r0, 0x6 - b _081B0696 -_081B0690: - movs r0, 0x7 - b _081B0696 -_081B0694: - movs r0, 0x8 -_081B0696: - bl sub_81B06C0 -_081B069A: - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] -_081B069E: - movs r0, 0x86 - lsls r0, 2 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _081B06B4 - .pool -_081B06B0: - movs r0, 0x1 - b _081B06B6 -_081B06B4: - movs r0, 0 -_081B06B6: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B05C8 - - thumb_func_start sub_81B06C0 -sub_81B06C0: @ 81B06C0 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 28 - ldr r5, =gPlttBufferUnfaded + 0x60 - lsrs r4, 23 - adds r1, r5, 0 - subs r1, 0x60 - adds r1, r4, r1 - adds r0, r5, 0 - movs r2, 0x10 - bl CpuSet - ldr r0, =gPlttBufferFaded - adds r4, r0 - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0x10 - bl CpuSet - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B06C0 - - thumb_func_start sub_81B06F4 -sub_81B06F4: @ 81B06F4 - push {lr} - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - cmp r0, 0 - beq _081B0702 - bl Free -_081B0702: - ldr r0, =gUnknown_0203CEE4 - ldr r0, [r0] - cmp r0, 0 - beq _081B070E - bl Free -_081B070E: - ldr r0, =gUnknown_0203CEE0 - ldr r0, [r0] - cmp r0, 0 - beq _081B071A - bl Free -_081B071A: - ldr r0, =gUnknown_0203CEDC - ldr r0, [r0] - cmp r0, 0 - beq _081B0726 - bl Free -_081B0726: - bl FreeAllWindowBuffers - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B06F4 - - thumb_func_start sub_81B0740 -sub_81B0740: @ 81B0740 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gUnknown_0203CEDC - movs r0, 0x60 - bl Alloc - str r0, [r4] - movs r5, 0 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 4 - mov r8, r0 - movs r6, 0xFF - mov r9, r4 -_081B0764: - ldr r2, [r4] - lsls r3, r5, 4 - adds r2, r3, r2 - ldr r0, =gUnknown_086156E4 - mov r12, r0 - str r0, [r2] - lsls r0, r5, 3 - ldr r1, =gUnknown_08615704 - adds r0, r1 - add r0, r8 - str r0, [r2, 0x4] - strb r5, [r2, 0x8] - ldr r1, [r4] - adds r1, r3, r1 - ldrb r0, [r1, 0x9] - orrs r0, r6 - strb r0, [r1, 0x9] - ldr r1, [r4] - adds r1, r3, r1 - ldrb r0, [r1, 0xA] - orrs r0, r6 - strb r0, [r1, 0xA] - ldr r1, [r4] - adds r1, r3, r1 - ldrb r0, [r1, 0xB] - orrs r0, r6 - strb r0, [r1, 0xB] - ldr r0, [r4] - adds r3, r0 - ldrb r0, [r3, 0xC] - orrs r0, r6 - strb r0, [r3, 0xC] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _081B0764 - mov r1, r9 - ldr r0, [r1] - mov r1, r12 - subs r1, 0x20 - str r1, [r0] - cmp r7, 0x3 - bne _081B07CC - str r1, [r0, 0x30] - b _081B07D2 - .pool -_081B07CC: - cmp r7, 0 - beq _081B07D2 - str r1, [r0, 0x10] -_081B07D2: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B0740 - - thumb_func_start sub_81B07E0 -sub_81B07E0: @ 81B07E0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x5 - bne _081B085C - cmp r5, 0x2 - bls _081B085C - adds r0, r5, 0 - bl sub_81B0CEC - ldr r0, =gUnknown_02022FF8 - subs r1, r5, 0x3 - lsls r1, 5 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _081B0828 - ldr r0, =gUnknown_0203CEDC - lsls r4, r5, 4 - ldr r0, [r0] - adds r0, r4 - movs r1, 0x40 - bl sub_81B2748 - b _081B0836 - .pool -_081B0828: - ldr r0, =gUnknown_0203CEDC - lsls r4, r5, 4 - ldr r0, [r0] - adds r0, r4 - movs r1, 0x8 - bl sub_81B2748 -_081B0836: - adds r5, r4, 0 - ldr r4, =gUnknown_0203CEDC - ldr r0, [r4] - adds r0, r5, r0 - ldrb r0, [r0, 0x8] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - adds r0, r5, r0 - ldrb r0, [r0, 0x8] - bl PutWindowTilemap - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - b _081B093E - .pool -_081B085C: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - bne _081B089C - ldr r4, =gUnknown_0203CEDC - ldr r0, [r4] - lsls r5, 4 - adds r0, r5, r0 - ldrb r0, [r0, 0x8] - bl sub_81B2720 - ldr r0, [r4] - adds r0, r5 - movs r1, 0x40 - bl sub_81B2748 - ldr r0, [r4] - adds r0, r5, r0 - ldrb r0, [r0, 0x8] - movs r1, 0x2 - bl CopyWindowToVram - b _081B092C - .pool -_081B089C: - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - movs r1, 0xF - ands r1, r0 - cmp r1, 0x7 - bne _081B08B4 - adds r0, r5, 0 - bl sub_81B0B60 - b _081B08F6 - .pool -_081B08B4: - cmp r1, 0x2 - bne _081B08C0 - adds r0, r5, 0 - bl sub_81B0B08 - b _081B08F6 -_081B08C0: - cmp r1, 0x4 - bne _081B08CC - adds r0, r5, 0 - bl sub_81B0A9C - b _081B08F6 -_081B08CC: - cmp r1, 0xB - bne _081B08D8 - adds r0, r5, 0 - bl sub_81B0B98 - b _081B08F6 -_081B08D8: - cmp r1, 0xC - bne _081B08E4 - adds r0, r5, 0 - bl sub_81B0BC4 - b _081B08F6 -_081B08E4: - adds r0, r5, 0 - bl sub_81B0BFC - lsls r0, 24 - cmp r0, 0 - bne _081B08F6 - adds r0, r5, 0 - bl sub_81B0948 -_081B08F6: - ldr r2, =gUnknown_0203CEC8 - ldrb r1, [r2, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x5 - bne _081B0910 - adds r0, r5, 0 - movs r1, 0 - bl sub_81B0FCC - b _081B092A - .pool -_081B0910: - movs r0, 0x9 - ldrsb r0, [r2, r0] - cmp r0, r5 - bne _081B0922 - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81B0FCC - b _081B092A -_081B0922: - adds r0, r5, 0 - movs r1, 0 - bl sub_81B0FCC -_081B092A: - lsls r5, 4 -_081B092C: - ldr r0, =gUnknown_0203CEDC - ldr r0, [r0] - adds r0, r5, r0 - ldrb r0, [r0, 0x8] - bl PutWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram -_081B093E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B07E0 - - thumb_func_start sub_81B0948 -sub_81B0948: @ 81B0948 - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x64 - adds r1, r4, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r0, r7, 0 - movs r1, 0x2D - bl GetMonData - adds r2, r0, 0 - cmp r2, 0 - beq _081B09A0 - ldr r6, =gUnknown_0203CEDC - ldr r0, [r6] - lsls r5, r4, 4 - adds r0, r5, r0 - ldr r2, [r0] - ldrb r0, [r0, 0x8] - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - ldr r4, [r2] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl _call_via_r4 - ldr r1, [r6] - adds r1, r5 - adds r0, r7, 0 - movs r2, 0 - bl sub_81B2A70 - b _081B0A02 - .pool -_081B09A0: - ldr r5, =gUnknown_0203CEDC - ldr r0, [r5] - lsls r4, 4 - adds r0, r4, r0 - ldr r1, [r0] - ldrb r0, [r0, 0x8] - str r2, [sp] - str r2, [sp, 0x4] - ldr r6, [r1] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl _call_via_r6 - ldr r1, [r5] - adds r1, r4 - adds r0, r7, 0 - movs r2, 0 - bl sub_81B2A70 - ldr r1, [r5] - adds r1, r4 - adds r0, r7, 0 - movs r2, 0 - bl sub_81B2AC8 - ldr r1, [r5] - adds r1, r4 - adds r0, r7, 0 - movs r2, 0 - bl sub_81B2B8C - ldr r1, [r5] - adds r1, r4 - adds r0, r7, 0 - movs r2, 0 - bl sub_81B2CD4 - ldr r1, [r5] - adds r1, r4 - adds r0, r7, 0 - movs r2, 0 - bl sub_81B2D74 - ldr r1, [r5] - adds r1, r4 - adds r0, r7, 0 - bl sub_81B2E28 -_081B0A02: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0948 thumb_func_start sub_81B0A10 sub_81B0A10: @ 81B0A10 diff --git a/include/battle_main.h b/include/battle_main.h index 5a61b5ef0..18bdde2f1 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -7,6 +7,20 @@ struct TrainerMoney u8 value; }; +struct UnknownPokemonStruct4 +{ + /*0x00*/ u16 species; + /*0x02*/ u16 heldItem; + /*0x04*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; + /*0x0F*/ u8 level; + /*0x10*/ u16 hp; + /*0x12*/ u16 maxhp; + /*0x14*/ u32 status; + /*0x18*/ u32 personality; + /*0x1C*/ u8 gender; + /*0x1D*/ u8 language; +}; + #define TYPE_NAME_LENGTH 6 #define ABILITY_NAME_LENGTH 12 @@ -70,6 +84,8 @@ void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands(void); bool8 TryRunFromBattle(u8 battlerId); +extern struct UnknownPokemonStruct4 gUnknown_02022FF8[3]; + extern const u8 gTypeEffectiveness[336]; extern const u8 gTypeNames[][TYPE_NAME_LENGTH + 1]; extern const struct TrainerMoney gTrainerMoneyTable[]; diff --git a/include/graphics.h b/include/graphics.h index 4cbee1c34..a7bbc5b68 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3914,6 +3914,11 @@ extern const u16 gIntro2BrendanNoTurnPal[]; extern const u16 gIntro2FlygonPal[]; extern const u8 gIntro2FlygonGfx[]; +// party menu graphics +extern const u8 gPartyMenuMisc_Gfx[]; +extern const u16 gPartyMenuMisc_Tilemap[]; +extern const u8 gPartyMenuMisc_Pal[]; + // berry pics extern const u8 gBerryPic_Cheri[]; extern const u8 gBerryPalette_Cheri[]; diff --git a/ld_script.txt b/ld_script.txt index 43a556034..9dc6efaa6 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -253,6 +253,7 @@ SECTIONS { src/dynamic_placeholder_text_util.o(.text); src/save_location.o(.text); src/item_icon.o(.text); + src/party_menu.o(.text); asm/party_menu.o(.text); src/battle_tent.o(.text); src/unk_text_util_2.o(.text); diff --git a/src/party_menu.c b/src/party_menu.c new file mode 100755 index 000000000..9b8947465 --- /dev/null +++ b/src/party_menu.c @@ -0,0 +1,521 @@ +#include "global.h" +#include "battle_main.h" +#include "bg.h" +#include "constants/rgb.h" +#include "constants/species.h" +#include "decompress.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "main.h" +#include "malloc.h" +#include "menu.h" +#include "menu_helpers.h" +#include "palette.h" +#include "pokemon.h" +#include "pokemon_icon.h" +#include "scanline_effect.h" +#include "sprite.h" +#include "task.h" +#include "text.h" +#include "window.h" + +struct Unk_Rodata1 { + void (*unk0)(u8, u8, u8, u8, u8, u8); + u32 unk4[7]; +}; + +struct Unk_203CEC4 { + TaskFunc unk0; + void *unk4; + u32 unk8_0:1; + u32 unk8_1:3; + u32 unk8_2:7; + u32 unk9_0:7; + u32 unkA_0:14; + u8 unkC[3]; + u8 fillerF[9]; + u16 unk18[0xB0]; + u8 filler[0xA0]; + s16 unk218[16]; +}; + +struct Unk_203CEC8 { + MainCallback unk0; + u8 filler[4]; + u8 unk8_0:4; + u8 unk8_1:2; + u8 unk8_2:2; + s8 unk9; + u8 unkA; + u8 unkB; +}; + +struct Unk_203CEDC { + struct Unk_Rodata1 *unk0; + u32 *unk4; + u8 unk8; + u8 unk9; + u8 unkA; + u8 unkB; + u8 unkC; +}; + +struct Unk_203CEE4 { + u8 filler[0x800]; +}; + +// BELOW TO BE PUT IN EWRAM + +extern struct Unk_203CEC4 *gUnknown_0203CEC4; +extern struct Unk_203CEC8 gUnknown_0203CEC8; +extern struct Unk_203CEDC *gUnknown_0203CEDC; +extern u8 *gUnknown_0203CEE0; +extern struct Unk_203CEE4 *gUnknown_0203CEE4; + +// ABOVE TO BE PUT IN EWRAM + +// BELOW TO BE CONVERTED TO C + +extern struct BgTemplate gUnknown_086156B8[]; +extern struct Unk_Rodata1 gUnknown_086156C4[2]; +// extern struct Unk_Rodata1 gUnknown_086156E4; +extern u32 gUnknown_08615704[][6][2]; + +// ABOVE TO BE CONVERTED TO C + +void reset_brm(void); +void c2_811EBD0(void); +bool8 sub_81B020C(void); +void sub_81B209C(void); +void sub_81B04BC(void); +bool8 sub_81B0550(void); +bool8 sub_81B05C8(void); +void sub_81B239C(u8); +void sub_81B0740(u8); +void sub_81B5D30(void); +void sub_81B6040(void); +void sub_81B6160(void); +bool8 party_menu_add_per_mon_objects(void); +bool8 sub_81B0DA0(void); +void sub_81B0F28(void); +void sub_81B2428(u8); +void display_pokemon_menu_message(u32); +void sub_81B04F8(u8); +void sub_81B06F4(void); +void sub_81B06C0(u8); +void sub_81B0CEC(u8); +void sub_81B2748(struct Unk_203CEDC *, u8); +void sub_81B2720(u8); +void sub_81B0B60(u8); +void sub_81B0B08(u8); +void sub_81B0A9C(u8); +void sub_81B0B98(u8); +void sub_81B0BC4(u8); +bool8 sub_81B0BFC(u8); +void sub_81B0948(u8); +void sub_81B0FCC(u8, u8); +void sub_81B2A70(struct Pokemon *, struct Unk_203CEDC *, u8); +void sub_81B2AC8(struct Pokemon *, struct Unk_203CEDC *, u8); +void sub_81B2B8C(struct Pokemon *, struct Unk_203CEDC *, u8); +void sub_81B2CD4(struct Pokemon *, struct Unk_203CEDC *, u8); +void sub_81B2D74(struct Pokemon *, struct Unk_203CEDC *, u8); +void sub_81B2E28(struct Pokemon *, struct Unk_203CEDC *); + +void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) +{ + u16 i; + + reset_brm(); + gUnknown_0203CEC4 = Alloc(sizeof(struct Unk_203CEC4)); + if (gUnknown_0203CEC4 == 0) + { + SetMainCallback2(g); + } + else + { + gUnknown_0203CEC8.unk8_0 = a; + gUnknown_0203CEC8.unk0 = g; + gUnknown_0203CEC8.unkB = c; + gUnknown_0203CEC4->unkA_0 = e; + gUnknown_0203CEC4->unk0 = f; + gUnknown_0203CEC4->unk4 = NULL; + gUnknown_0203CEC4->unk8_1 = 0; + gUnknown_0203CEC4->unk8_2 = 0xFF; + gUnknown_0203CEC4->unk9_0 = 0xFF; + + if (a == 4) + gUnknown_0203CEC4->unk8_0 = TRUE; + else + gUnknown_0203CEC4->unk8_0 = FALSE; + + if (b != 0xFF) + gUnknown_0203CEC8.unk8_1 = b; + + for (i = 0; i <= 15; i++) + gUnknown_0203CEC4->unk218[i] = 0; + for (i = 0; i < 3; i++) + gUnknown_0203CEC4->unkC[i] |= 0xFF; + + if (d == 0) + gUnknown_0203CEC8.unk9 = 0; + else if (gUnknown_0203CEC8.unk9 > 5 || GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES) == SPECIES_NONE) + gUnknown_0203CEC8.unk9 = 0; // wut why is this else if? + + gTextFlags.flag_2 = 0; + CalculatePlayerPartyCount(); + SetMainCallback2(c2_811EBD0); + } +} + +void sub_81B01B0(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); +} + +void sub_81B01CC(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void c2_811EBD0(void) +{ + while (TRUE) + { + if (sub_81221EC() == TRUE || sub_81B020C() == TRUE || sub_81221AC() == TRUE) + break; + } +} + +bool8 sub_81B020C(void) +{ + switch (gMain.state) + { + case 0: + SetVBlankHBlankCallbacksToNull(); + ResetVramOamAndBgCntRegs(); + clear_scheduled_bg_copies_to_vram(); + gMain.state++; + break; + case 1: + ScanlineEffect_Stop(); + gMain.state++; + break; + case 2: + ResetPaletteFade(); + gPaletteFade.bufferTransferDisabled = TRUE; + gMain.state++; + break; + case 3: + ResetSpriteData(); + gMain.state++; + break; + case 4: + FreeAllSpritePalettes(); + gMain.state++; + break; + case 5: + if (!sub_81221AC()) + ResetTasks(); + gMain.state++; + break; + case 6: + sub_81B209C(); + gMain.state++; + break; + case 7: + if (!sub_81B0550()) + { + sub_81B04BC(); + return TRUE; + } + else + { + gUnknown_0203CEC4->unk218[0] = 0; + gMain.state++; + } + break; + case 8: + if (sub_81B05C8()) + gMain.state++; + break; + case 9: + sub_81B239C(gUnknown_0203CEC8.unk8_1); + gMain.state++; + break; + case 10: + sub_81B0740(gUnknown_0203CEC8.unk8_1); + gUnknown_0203CEC4->unk218[0] = 0; + gMain.state++; + break; + case 11: + sub_81B5D30(); + gMain.state++; + break; + case 12: + sub_81B6040(); + gMain.state++; + break; + case 13: + sub_81B6160(); + gMain.state++; + break; + case 14: + LoadMonIconPalettes(); + gMain.state++; + break; + case 15: + if (party_menu_add_per_mon_objects()) + { + gUnknown_0203CEC4->unk218[0] = 0; + gMain.state++; + } + break; + case 16: + if (sub_81B0DA0()) + { + gUnknown_0203CEC4->unk218[0] = 0; + gMain.state++; + } + break; + case 17: + sub_81B0F28(); + gMain.state++; + break; + case 18: + sub_81B2428(gUnknown_0203CEC4->unk8_0); + gMain.state++; + break; + case 19: + gMain.state++; + break; + case 20: + CreateTask(gUnknown_0203CEC4->unk0, 0); + display_pokemon_menu_message(gUnknown_0203CEC4->unkA_0); + gMain.state++; + break; + case 21: + BlendPalettes(0xFFFFFFFF, 16, 0); + gPaletteFade.bufferTransferDisabled = FALSE; + gMain.state++; + break; + case 22: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + gMain.state++; + break; + default: + SetVBlankCallback(sub_81B01CC); + SetMainCallback2(sub_81B01B0); + return TRUE; + } + return FALSE; +} + +void sub_81B04BC(void) +{ + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + CreateTask(sub_81B04F8, 0); + SetVBlankCallback(sub_81B01CC); + SetMainCallback2(sub_81B01B0); +} + +void sub_81B04F8(u8 taskId) +{ + if (!gPaletteFade.active) + { + SetMainCallback2(gUnknown_0203CEC8.unk0); + sub_81B06F4(); + DestroyTask(taskId); + } +} + +void reset_brm(void) +{ + gUnknown_0203CEC4 = NULL; + gUnknown_0203CEE4 = NULL; + gUnknown_0203CEDC = NULL; + gUnknown_0203CEE0 = NULL; +} + +bool8 sub_81B0550(void) +{ + gUnknown_0203CEE4 = Alloc(sizeof(struct Unk_203CEE4)); + if (gUnknown_0203CEE4 == NULL) + return FALSE; + memset(gUnknown_0203CEE4, 0, sizeof(struct Unk_203CEE4)); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_086156B8, 3); + SetBgTilemapBuffer(1, gUnknown_0203CEE4); + ResetAllBgsCoordinates(); + schedule_bg_copy_tilemap_to_vram(1); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + ShowBg(0); + ShowBg(1); + ShowBg(2); + return TRUE; +} + +bool8 sub_81B05C8(void) +{ + int sizeout; + + switch (gUnknown_0203CEC4->unk218[0]) + { + case 0: + gUnknown_0203CEE0 = malloc_and_decompress(gPartyMenuMisc_Gfx, &sizeout); + LoadBgTiles(1, gUnknown_0203CEE0, sizeout, 0); + gUnknown_0203CEC4->unk218[0]++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + LZDecompressWram(gPartyMenuMisc_Tilemap, gUnknown_0203CEE4); + gUnknown_0203CEC4->unk218[0]++; + } + break; + case 2: + LoadCompressedPalette(gPartyMenuMisc_Pal, 0, 0x160); + CpuCopy16(gPlttBufferUnfaded, gUnknown_0203CEC4->unk18, 0x160); + gUnknown_0203CEC4->unk218[0]++; + break; + case 3: + sub_81B06C0(4); + gUnknown_0203CEC4->unk218[0]++; + break; + case 4: + sub_81B06C0(5); + gUnknown_0203CEC4->unk218[0]++; + break; + case 5: + sub_81B06C0(6); + gUnknown_0203CEC4->unk218[0]++; + break; + case 6: + sub_81B06C0(7); + gUnknown_0203CEC4->unk218[0]++; + break; + case 7: + sub_81B06C0(8); + gUnknown_0203CEC4->unk218[0]++; + break; + default: + return TRUE; + } + return FALSE; +} + +void sub_81B06C0(u8 offset) +{ + offset *= 16; + CpuCopy16(&gPlttBufferUnfaded[0x30], &gPlttBufferUnfaded[offset], 32); + CpuCopy16(&gPlttBufferUnfaded[0x30], &gPlttBufferFaded[offset], 32); +} + +void sub_81B06F4(void) +{ + if (gUnknown_0203CEC4) + Free(gUnknown_0203CEC4); + if (gUnknown_0203CEE4) + Free(gUnknown_0203CEE4); + if (gUnknown_0203CEE0) + Free(gUnknown_0203CEE0); + if (gUnknown_0203CEDC) + Free(gUnknown_0203CEDC); + FreeAllWindowBuffers(); +} + +void sub_81B0740(u8 a) +{ + u8 i; + + gUnknown_0203CEDC = Alloc(sizeof(struct Unk_203CEDC[6])); + + for (i = 0; i < 6; i++) + { + gUnknown_0203CEDC[i].unk0 = &gUnknown_086156C4[1]; + gUnknown_0203CEDC[i].unk4 = gUnknown_08615704[a][i]; + gUnknown_0203CEDC[i].unk8 = i; + gUnknown_0203CEDC[i].unk9 |= 0xFF; + gUnknown_0203CEDC[i].unkA |= 0xFF; + gUnknown_0203CEDC[i].unkB |= 0xFF; + gUnknown_0203CEDC[i].unkC |= 0xFF; + } + gUnknown_0203CEDC[0].unk0 = &gUnknown_086156C4[0]; + if (a == 3) + gUnknown_0203CEDC[3].unk0 = &gUnknown_086156C4[0]; + else if (a) + gUnknown_0203CEDC[1].unk0 = &gUnknown_086156C4[0]; +} + +void sub_81B07E0(u8 a) +{ + if (gUnknown_0203CEC8.unk8_0 == 5 && a > 2) + { + sub_81B0CEC(a); + if (gUnknown_02022FF8[a - 3].species == SPECIES_NONE) + sub_81B2748(&gUnknown_0203CEDC[a], 0x40); + else + sub_81B2748(&gUnknown_0203CEDC[a], 8); + CopyWindowToVram(gUnknown_0203CEDC[a].unk8, 2); + PutWindowTilemap(gUnknown_0203CEDC[a].unk8); + schedule_bg_copy_tilemap_to_vram(2); + } + else + { + if (GetMonData(&gPlayerParty[a], MON_DATA_SPECIES) == SPECIES_NONE) + { + sub_81B2720(gUnknown_0203CEDC[a].unk8); + sub_81B2748(&gUnknown_0203CEDC[a], 0x40); + CopyWindowToVram(gUnknown_0203CEDC[a].unk8, 2); + } + else + { + if (gUnknown_0203CEC8.unk8_0 == 7) + sub_81B0B60(a); + else if (gUnknown_0203CEC8.unk8_0 == 2) + sub_81B0B08(a); + else if (gUnknown_0203CEC8.unk8_0 == 4) + sub_81B0A9C(a); + else if (gUnknown_0203CEC8.unk8_0 == 11) + sub_81B0B98(a); + else if (gUnknown_0203CEC8.unk8_0 == 12) + sub_81B0BC4(a); + else if (!sub_81B0BFC(a)) + sub_81B0948(a); + + if (gUnknown_0203CEC8.unk8_0 == 5) + sub_81B0FCC(a, 0); + else if (gUnknown_0203CEC8.unk9 == a) + sub_81B0FCC(a, 1); + else + sub_81B0FCC(a, 0); + } + PutWindowTilemap(gUnknown_0203CEDC[a].unk8); + schedule_bg_copy_tilemap_to_vram(0); + } +} + +void sub_81B0948(u8 a) +{ + if (GetMonData(&gPlayerParty[a], MON_DATA_IS_EGG)) + { + gUnknown_0203CEDC[a].unk0->unk0(gUnknown_0203CEDC[a].unk8, 0, 0, 0, 0, 1); + sub_81B2A70(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); + } + else + { + gUnknown_0203CEDC[a].unk0->unk0(gUnknown_0203CEDC[a].unk8, 0, 0, 0, 0, 0); + sub_81B2A70(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); + sub_81B2AC8(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); + sub_81B2B8C(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); + sub_81B2CD4(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); + sub_81B2D74(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); + sub_81B2E28(&gPlayerParty[a], &gUnknown_0203CEDC[a]); + } +} From 65a0c48eec7d2184478841d232d1fb3c3350fa37 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 17 Oct 2018 20:03:02 -0400 Subject: [PATCH 02/17] decompiled some more of the file --- asm/party_menu.s | 1514 ----------------------------------- include/contest.h | 1 + include/fldeff_softboiled.h | 6 + include/party_menu.h | 31 +- src/item_use.c | 4 +- src/party_menu.c | 661 +++++++++++++-- 6 files changed, 639 insertions(+), 1578 deletions(-) create mode 100755 include/fldeff_softboiled.h diff --git a/asm/party_menu.s b/asm/party_menu.s index f8b75c036..f5ed314ce 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,1520 +5,6 @@ .text - thumb_func_start sub_81B0A10 -sub_81B0A10: @ 81B0A10 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - movs r1, 0x64 - adds r2, r0, 0 - muls r2, r1 - ldr r1, =gPlayerParty - adds r6, r2, r1 - ldr r7, =gUnknown_0203CEDC - ldr r1, [r7] - lsls r5, r0, 4 - adds r1, r5, r1 - ldr r2, [r1] - ldrb r0, [r1, 0x8] - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - ldr r4, [r2] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl _call_via_r4 - ldr r1, [r7] - adds r1, r5 - adds r0, r6, 0 - movs r2, 0 - bl sub_81B2A70 - adds r0, r6, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081B0A7C - ldr r1, [r7] - adds r1, r5 - adds r0, r6, 0 - movs r2, 0 - bl sub_81B2AC8 - ldr r1, [r7] - adds r1, r5 - adds r0, r6, 0 - movs r2, 0 - bl sub_81B2B8C -_081B0A7C: - ldr r1, [r7] - adds r1, r5 - mov r0, r8 - movs r2, 0 - bl sub_81B2FA8 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0A10 - - thumb_func_start sub_81B0A9C -sub_81B0A9C: @ 81B0A9C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r6, =gUnknown_0203CEF8 - bl sub_81B85AC - lsls r0, 24 - cmp r0, 0 - bne _081B0AD6 - adds r0, r5, 0 - movs r1, 0x7 - bl sub_81B0A10 - b _081B0B02 - .pool -_081B0AC8: - adds r1, r4, 0x2 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_81B0A10 - b _081B0B02 -_081B0AD6: - movs r4, 0 - b _081B0AEE -_081B0ADA: - adds r1, r6, r4 - ldrb r0, [r1] - cmp r0, 0 - beq _081B0AE8 - subs r0, 0x1 - cmp r0, r5 - beq _081B0AC8 -_081B0AE8: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_081B0AEE: - bl sub_81B8830 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bcc _081B0ADA - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81B0A10 -_081B0B02: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B0A9C - - thumb_func_start sub_81B0B08 -sub_81B0B08: @ 81B0B08 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_80DAE0C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bhi _081B0B5A - lsls r0, 2 - ldr r1, =_081B0B34 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B0B34: - .4byte _081B0B48 - .4byte _081B0B52 - .4byte _081B0B52 - .4byte _081B0B48 - .4byte _081B0B48 -_081B0B48: - adds r0, r4, 0 - movs r1, 0x7 - bl sub_81B0A10 - b _081B0B5A -_081B0B52: - adds r0, r4, 0 - movs r1, 0x6 - bl sub_81B0A10 -_081B0B5A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0B08 - - thumb_func_start sub_81B0B60 -sub_81B0B60: @ 81B0B60 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl GetNumberOfRelearnableMoves - lsls r0, 24 - cmp r0, 0 - bne _081B0B88 - adds r0, r4, 0 - movs r1, 0x9 - bl sub_81B0A10 - b _081B0B90 - .pool -_081B0B88: - adds r0, r4, 0 - movs r1, 0x8 - bl sub_81B0A10 -_081B0B90: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0B60 - - thumb_func_start sub_81B0B98 -sub_81B0B98: @ 81B0B98 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_81B218C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B0BB6 - adds r0, r4, 0 - movs r1, 0x6 - bl sub_81B0A10 - b _081B0BBE -_081B0BB6: - adds r0, r4, 0 - movs r1, 0x7 - bl sub_81B0A10 -_081B0BBE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0B98 - - thumb_func_start sub_81B0BC4 -sub_81B0BC4: @ 81B0BC4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - beq _081B0BEC - adds r0, r4, 0 - movs r1, 0xB - bl sub_81B0A10 - b _081B0BF4 - .pool -_081B0BEC: - adds r0, r4, 0 - movs r1, 0xC - bl sub_81B0A10 -_081B0BF4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0BC4 - - thumb_func_start sub_81B0BFC -sub_81B0BFC: @ 81B0BFC - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - ldr r0, =gSpecialVar_ItemId - ldrh r4, [r0] - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0xC - bne _081B0C40 - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - ldr r0, =gSpecialVar_0x8005 - ldrb r2, [r0] - adds r0, r5, 0 - movs r1, 0 - bl sub_81B0C94 - b _081B0C8A - .pool -_081B0C40: - cmp r0, 0x3 - bne _081B0C56 - adds r0, r4, 0 - bl CheckIfItemIsTMHMOrEvolutionStone - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B0C5A - cmp r0, 0x2 - beq _081B0C66 -_081B0C56: - movs r0, 0 - b _081B0C8C -_081B0C5A: - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B0C94 - b _081B0C8A -_081B0C66: - adds r0, r6, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081B0C82 - adds r0, r6, 0 - movs r1, 0x3 - adds r2, r4, 0 - bl GetEvolutionTargetSpecies - lsls r0, 16 - cmp r0, 0 - bne _081B0C56 -_081B0C82: - adds r0, r5, 0 - movs r1, 0 - bl sub_81B0A10 -_081B0C8A: - movs r0, 0x1 -_081B0C8C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81B0BFC - - thumb_func_start sub_81B0C94 -sub_81B0C94: @ 81B0C94 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x64 - muls r0, r4 - ldr r3, =gPlayerParty - adds r0, r3 - bl sub_81B22D8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _081B0CD2 - cmp r0, 0x2 - bgt _081B0CC4 - cmp r0, 0x1 - beq _081B0CC8 - b _081B0CDC - .pool -_081B0CC4: - cmp r0, 0x3 - bne _081B0CDC -_081B0CC8: - adds r0, r4, 0 - movs r1, 0x9 - bl sub_81B0A10 - b _081B0CE4 -_081B0CD2: - adds r0, r4, 0 - movs r1, 0xA - bl sub_81B0A10 - b _081B0CE4 -_081B0CDC: - adds r0, r4, 0 - movs r1, 0x8 - bl sub_81B0A10 -_081B0CE4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0C94 - - thumb_func_start sub_81B0CEC -sub_81B0CEC: @ 81B0CEC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CEDC - lsls r2, r0, 4 - ldr r1, [r1] - adds r6, r1, r2 - subs r0, 0x3 - lsls r0, 24 - ldr r5, =gUnknown_02022FF8 - lsrs r0, 19 - mov r8, r0 - adds r7, r0, r5 - ldrh r0, [r7] - cmp r0, 0 - bne _081B0D24 - ldrb r0, [r6, 0x8] - bl sub_81B2720 - b _081B0D8E - .pool -_081B0D24: - ldr r2, [r6] - ldrb r0, [r6, 0x8] - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - ldr r4, [r2] - movs r2, 0 - movs r3, 0 - bl _call_via_r4 - ldr r4, =gStringVar1 - adds r5, 0x4 - add r5, r8 - adds r0, r4, 0 - adds r1, r5, 0 - bl StringCopy - adds r0, r4, 0 - bl StringGetEnd10 - adds r0, r4, 0 - bl sub_81DB52C - ldrb r0, [r6, 0x8] - ldr r3, [r6] - adds r3, 0x4 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B2A3C - ldrb r0, [r7, 0xF] - adds r1, r6, 0 - bl sub_81B2B40 - ldrb r0, [r7, 0x1C] - ldrh r1, [r7] - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_81B2BF4 - ldrh r0, [r7, 0x10] - adds r1, r6, 0 - bl sub_81B2D3C - ldrh r0, [r7, 0x12] - adds r1, r6, 0 - bl sub_81B2DDC - ldrh r0, [r7, 0x10] - ldrh r1, [r7, 0x12] - adds r2, r6, 0 - bl sub_81B2E64 -_081B0D8E: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0CEC - - thumb_func_start sub_81B0DA0 -sub_81B0DA0: @ 81B0DA0 - push {r4,r5,lr} - ldr r5, =gUnknown_0203CEC4 - ldr r0, [r5] - movs r4, 0x86 - lsls r4, 2 - adds r0, r4 - ldrb r0, [r0] - bl sub_81B07E0 - ldr r1, [r5] - adds r1, r4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - beq _081B0DCC - movs r0, 0 - b _081B0DCE - .pool -_081B0DCC: - movs r0, 0x1 -_081B0DCE: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81B0DA0 - - thumb_func_start sub_81B0DD4 -sub_81B0DD4: @ 81B0DD4 - lsls r0, 16 - ldr r1, =gUnknown_0203CEE0 - lsrs r0, 11 - ldr r1, [r1] - adds r1, r0 - adds r0, r1, 0 - bx lr - .pool - thumb_func_end sub_81B0DD4 - - thumb_func_start party_menu_add_per_mon_objects_internal -party_menu_add_per_mon_objects_internal: @ 81B0DE8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x5 - bne _081B0E98 - cmp r7, 0x2 - bls _081B0E98 - subs r0, r7, 0x3 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, =gUnknown_02022FF8 - mov r9, r0 - mov r2, r10 - lsls r2, 5 - mov r8, r2 - mov r6, r8 - add r6, r9 - ldrh r0, [r6] - cmp r0, 0 - beq _081B0EDC - mov r1, r9 - adds r1, 0x18 - add r1, r8 - ldr r1, [r1] - ldr r4, =gUnknown_0203CEDC - lsls r5, r7, 4 - ldr r2, [r4] - adds r2, r5 - movs r3, 0 - str r3, [sp] - bl party_menu_link_mon_icon_anim - ldrh r0, [r6] - ldrh r1, [r6, 0x2] - ldr r2, [r4] - adds r2, r5 - bl party_menu_link_mon_held_item_object - ldrh r0, [r6] - ldr r1, [r4] - adds r1, r5 - bl party_menu_link_mon_pokeball_object - ldrh r0, [r6, 0x10] - cmp r0, 0 - bne _081B0E68 - movs r3, 0x7 - b _081B0E78 - .pool -_081B0E68: - mov r0, r9 - adds r0, 0x14 - add r0, r8 - ldr r0, [r0] - bl pokemon_ailments_get_primary - lsls r0, 24 - lsrs r3, r0, 24 -_081B0E78: - ldr r1, =gUnknown_02022FF8 - mov r2, r10 - lsls r0, r2, 5 - adds r0, r1 - ldrh r0, [r0] - ldr r1, =gUnknown_0203CEDC - ldr r2, [r1] - adds r2, r5 - adds r1, r3, 0 - bl party_menu_link_mon_status_condition_object - b _081B0EDC - .pool -_081B0E98: - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B0EDC - ldr r4, =gUnknown_0203CEDC - lsls r5, r7, 4 - ldr r1, [r4] - adds r1, r5 - adds r0, r6, 0 - adds r2, r7, 0 - bl party_menu_icon_anim - ldr r1, [r4] - adds r1, r5 - adds r0, r6, 0 - bl party_menu_held_item_object - ldr r1, [r4] - adds r1, r5 - adds r0, r6, 0 - bl party_menu_pokeball_object - ldr r1, [r4] - adds r1, r5 - adds r0, r6, 0 - bl party_menu_status_condition_object -_081B0EDC: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_add_per_mon_objects_internal - - thumb_func_start party_menu_add_per_mon_objects -party_menu_add_per_mon_objects: @ 81B0EF4 - push {r4,r5,lr} - ldr r5, =gUnknown_0203CEC4 - ldr r0, [r5] - movs r4, 0x86 - lsls r4, 2 - adds r0, r4 - ldrb r0, [r0] - bl party_menu_add_per_mon_objects_internal - ldr r1, [r5] - adds r1, r4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - beq _081B0F20 - movs r0, 0 - b _081B0F22 - .pool -_081B0F20: - movs r0, 0x1 -_081B0F22: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end party_menu_add_per_mon_objects - - thumb_func_start sub_81B0F28 -sub_81B0F28: @ 81B0F28 - push {r4,lr} - sub sp, 0xC - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x5 - bne _081B0F54 - movs r0, 0x7 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r1, 0xE - movs r2, 0x17 - movs r3, 0x11 - bl FillBgTilemapBufferRect - b _081B0FBC - .pool -_081B0F54: - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B0F94 - movs r0, 0xBF - movs r1, 0x88 - bl sub_81B5F74 - ldr r3, [r4] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x7F - ands r0, r1 - lsls r0, 4 - ldrh r2, [r3, 0x8] - ldr r1, =0xfffff80f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x8] - bl sub_81B120C - movs r0, 0xBF - movs r1, 0x98 - bl sub_81B5F74 - b _081B0F9C - .pool -_081B0F94: - movs r0, 0xC6 - movs r1, 0x94 - bl sub_81B5F34 -_081B0F9C: - ldr r3, [r4] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x7F - ands r0, r1 - lsls r0, 11 - ldr r1, [r3, 0x8] - ldr r2, =0xfffc07ff - ands r1, r2 - orrs r1, r0 - str r1, [r3, 0x8] - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - movs r1, 0x1 - bl sub_81B0FCC -_081B0FBC: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0F28 - - thumb_func_start sub_81B0FCC -sub_81B0FCC: @ 81B0FCC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - cmp r7, 0x6 - beq _081B1038 - cmp r7, 0x7 - beq _081B1074 - movs r0, 0x64 - muls r0, r7 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B10E8 - ldr r6, =gUnknown_0203CEDC - lsls r5, r7, 4 - ldr r4, [r6] - adds r4, r5 - adds r0, r7, 0 - mov r1, r8 - bl sub_81B10F8 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_81B2748 - ldr r0, [r6] - adds r0, r5, r0 - ldrb r0, [r0, 0x9] - mov r1, r8 - bl sub_81B5B6C - ldr r0, [r6] - adds r5, r0 - ldrb r0, [r5, 0xB] - mov r1, r8 - bl sub_81B5F98 - b _081B10E8 - .pool -_081B1038: - mov r0, r8 - cmp r0, 0 - bne _081B1052 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r1, 0x17 - movs r2, 0x10 - movs r3, 0x7 - bl sub_8199C30 - b _081B1064 -_081B1052: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0x17 - movs r2, 0x10 - movs r3, 0x7 - bl sub_8199C30 -_081B1064: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrh r0, [r0, 0x8] - lsls r0, 21 - b _081B10DA - .pool -_081B1074: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - bne _081B10A6 - mov r0, r8 - cmp r0, 0 - bne _081B1098 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r1, 0x17 - movs r2, 0x11 - b _081B10B8 - .pool -_081B1098: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0x17 - movs r2, 0x11 - b _081B10B8 -_081B10A6: - mov r0, r8 - cmp r0, 0 - bne _081B10C0 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r1, 0x17 - movs r2, 0x12 -_081B10B8: - movs r3, 0x7 - bl sub_8199C30 - b _081B10D2 -_081B10C0: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0x17 - movs r2, 0x12 - movs r3, 0x7 - bl sub_8199C30 -_081B10D2: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldr r0, [r0, 0x8] - lsls r0, 14 -_081B10DA: - lsrs r0, 25 - mov r1, r8 - bl sub_81B5F98 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram -_081B10E8: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0FCC - - thumb_func_start sub_81B10F8 -sub_81B10F8: @ 81B10F8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r4, 0 - cmp r1, 0x1 - bne _081B110A - movs r4, 0x1 -_081B110A: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _081B1120 - movs r0, 0x2 - orrs r4, r0 -_081B1120: - adds r0, r5, 0 - bl sub_81B118C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B1136 - movs r0, 0x8 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_081B1136: - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0xB] - adds r2, r0, 0 - cmp r1, 0x9 - bne _081B1148 - movs r0, 0x10 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_081B1148: - cmp r1, 0x8 - bne _081B1164 - movs r0, 0x9 - ldrsb r0, [r2, r0] - cmp r5, r0 - beq _081B115C - movs r0, 0xA - ldrsb r0, [r2, r0] - cmp r5, r0 - bne _081B1164 -_081B115C: - movs r0, 0x4 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_081B1164: - ldrb r0, [r2, 0xB] - cmp r0, 0xA - bne _081B117A - movs r0, 0x9 - ldrsb r0, [r2, r0] - cmp r5, r0 - bne _081B117A - movs r0, 0x20 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_081B117A: - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B10F8 - - thumb_func_start sub_81B118C -sub_81B118C: @ 81B118C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0x20 - bne _081B11B4 - cmp r2, 0x1 - beq _081B11AA - cmp r2, 0x4 - beq _081B11AA - cmp r2, 0x5 - bne _081B11B4 -_081B11AA: - movs r0, 0x1 - b _081B11F8 - .pool -_081B11B4: - cmp r2, 0x2 - bhi _081B11F6 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 11 - ands r0, r1 - cmp r0, 0 - beq _081B11F6 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B11F6 - adds r0, r2, 0 - bl sub_81B8F38 - ldr r1, =gBattleStruct - ldr r1, [r1] - movs r2, 0xA8 - lsls r2, 2 - adds r1, r2 - ldrb r1, [r1] - lsls r0, 24 - lsrs r0, 24 - asrs r1, r0 - movs r0, 0x1 - ands r1, r0 - cmp r1, 0 - bne _081B11F8 -_081B11F6: - movs r0, 0 -_081B11F8: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B118C - - thumb_func_start sub_81B120C -sub_81B120C: @ 81B120C - push {r4-r6,lr} - sub sp, 0xC - ldr r1, =gUnknown_086157C4 - movs r6, 0x7 - str r6, [sp] - movs r5, 0x2 - str r5, [sp, 0x4] - movs r4, 0x11 - str r4, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x17 - movs r3, 0x10 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r1, =gUnknown_086157E0 - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x17 - movs r3, 0x12 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B120C - - thumb_func_start sub_81B1250 -sub_81B1250: @ 81B1250 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x49 - ands r0, r1 - cmp r0, 0x49 - bne _081B1280 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B1280 - movs r0, 0x1 - b _081B1282 - .pool -_081B1280: - movs r0, 0 -_081B1282: - pop {r1} - bx r1 - thumb_func_end sub_81B1250 - - thumb_func_start sub_81B1288 -sub_81B1288: @ 81B1288 - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - movs r0, 0x64 - bl Alloc - adds r5, r0, 0 - adds r1, r4, 0 - movs r2, 0x64 - bl memcpy - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x64 - bl memcpy - adds r0, r6, 0 - adds r1, r5, 0 - movs r2, 0x64 - bl memcpy - adds r0, r5, 0 - bl Free - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B1288 - - thumb_func_start sub_81B12C0 -sub_81B12C0: @ 81B12C0 - 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, =c3_0811FAB4 - str r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B12C0 - - thumb_func_start c3_0811FAB4 -c3_0811FAB4: @ 81B12F8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B134C - ldr r4, =gUnknown_0203CEC8 - ldrb r1, [r4, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - bne _081B131A - bl sub_81B9080 -_081B131A: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldr r0, [r0, 0x4] - cmp r0, 0 - beq _081B1338 - bl SetMainCallback2 - b _081B133E - .pool -_081B1338: - ldr r0, [r4] - bl SetMainCallback2 -_081B133E: - bl ResetSpriteData - bl sub_81B06F4 - adds r0, r5, 0 - bl DestroyTask -_081B134C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end c3_0811FAB4 - - thumb_func_start GetCursorSelectionMonId -GetCursorSelectionMonId: @ 81B1354 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - bx lr - .pool - thumb_func_end GetCursorSelectionMonId - - thumb_func_start sub_81B1360 -sub_81B1360: @ 81B1360 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - lsls r0, 28 - lsrs r0, 28 - bx lr - .pool - thumb_func_end sub_81B1360 - - thumb_func_start sub_81B1370 -sub_81B1370: @ 81B1370 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B13E0 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B13E0 - bl sub_81B13EC - adds r4, r0, 0 - bl sub_81B1760 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - beq _081B13C0 - cmp r0, 0x2 - bgt _081B13B0 - cmp r0, 0x1 - beq _081B13B6 - b _081B13E0 - .pool -_081B13B0: - cmp r0, 0x8 - beq _081B13CA - b _081B13E0 -_081B13B6: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_81B140C - b _081B13E0 -_081B13C0: - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_81B15D0 - b _081B13E0 -_081B13CA: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B13E0 - movs r0, 0x5 - bl PlaySE - bl sub_81B4F88 -_081B13E0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1370 - - thumb_func_start sub_81B13EC -sub_81B13EC: @ 81B13EC - push {lr} - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0xB] - cmp r1, 0x8 - beq _081B13FA - cmp r1, 0xA - bne _081B1404 -_081B13FA: - adds r0, 0xA - b _081B1406 - .pool -_081B1404: - adds r0, 0x9 -_081B1406: - pop {r1} - bx r1 - thumb_func_end sub_81B13EC - - thumb_func_start sub_81B140C -sub_81B140C: @ 81B140C - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x6 - bne _081B142C - ldr r0, =gUnknown_0203CEC8 - ldr r1, [r0, 0x4] - adds r0, r5, 0 - bl _call_via_r1 - b _081B159E - .pool -_081B142C: - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - subs r0, 0x3 - cmp r0, 0xA - bls _081B1438 - b _081B1592 -_081B1438: - lsls r0, 2 - ldr r1, =_081B144C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B144C: - .4byte _081B149C - .4byte _081B1592 - .4byte _081B1538 - .4byte _081B1538 - .4byte _081B1510 - .4byte _081B1560 - .4byte _081B1592 - .4byte _081B1478 - .4byte _081B156E - .4byte _081B14E8 - .4byte _081B157C -_081B1478: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - bne _081B1486 - b _081B159E -_081B1486: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81615A8 - b _081B159E - .pool -_081B149C: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - bne _081B14AA - b _081B159E -_081B14AA: - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - ldr r2, =gUnknown_0203CEC4 - cmp r0, 0x1 - bne _081B14BE - ldr r1, [r2] - ldr r0, =sub_81B9140 - str r0, [r1, 0x4] -_081B14BE: - ldr r0, [r2] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gUnknown_03006328 - ldr r1, =sub_81B6794 - ldr r2, [r0] - adds r0, r5, 0 - bl _call_via_r2 - b _081B159E - .pool -_081B14E8: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - beq _081B159E - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81B7E4C - b _081B159E - .pool -_081B1510: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - beq _081B159E - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81B8474 - b _081B159E - .pool -_081B1538: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - beq _081B159E - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81B7FAC - b _081B159E - .pool -_081B1560: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81B3938 - b _081B159E -_081B156E: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81B12C0 - b _081B159E -_081B157C: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - beq _081B159E - ldrb r1, [r4] - adds r0, r5, 0 - bl sub_81B21AC - b _081B159E -_081B1592: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81B36FC -_081B159E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81B140C - - thumb_func_start sub_81B15A4 -sub_81B15A4: @ 81B15A4 - push {lr} - ldrb r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2D - bl GetMonData - cmp r0, 0x1 - beq _081B15C4 - movs r0, 0x1 - b _081B15CC - .pool -_081B15C4: - movs r0, 0x20 - bl PlaySE - movs r0, 0 -_081B15CC: - pop {r1} - bx r1 - thumb_func_end sub_81B15A4 - - thumb_func_start sub_81B15D0 -sub_81B15D0: @ 81B15D0 - push {r4,r5,lr} - adds r5, r1, 0 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0x8 - beq _081B1602 - cmp r0, 0x8 - bgt _081B15F0 - cmp r0, 0x1 - beq _081B15FA - b _081B161E - .pool -_081B15F0: - cmp r0, 0xA - beq _081B1602 - cmp r0, 0xD - beq _081B1610 - b _081B161E -_081B15FA: - movs r0, 0x20 - bl PlaySE - b _081B1652 -_081B1602: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B407C - b _081B1652 -_081B1610: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B2210 - b _081B1652 -_081B161E: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B1660 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B1652 - bl sub_81221AC - lsls r0, 24 - cmp r0, 0 - bne _081B1642 - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x7 - strh r0, [r1] -_081B1642: - ldr r0, =gUnknown_0203CEE8 - movs r1, 0 - strb r1, [r0] - movs r0, 0x7 - strb r0, [r5] - adds r0, r4, 0 - bl sub_81B12C0 -_081B1652: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B15D0 - thumb_func_start sub_81B1660 sub_81B1660: @ 81B1660 push {r4-r6,lr} diff --git a/include/contest.h b/include/contest.h index d62d33ab7..f15a7310e 100644 --- a/include/contest.h +++ b/include/contest.h @@ -427,5 +427,6 @@ bool8 Contest_IsMonsTurnDisabled(u8 a); bool8 sub_80DE1E8(u8 a); void SetStartledString(u8 a, u8 b); s8 Contest_GetMoveExcitement(u16); +u8 sub_80DAE0C(struct Pokemon *); #endif //GUARD_CONTEST_H diff --git a/include/fldeff_softboiled.h b/include/fldeff_softboiled.h new file mode 100755 index 000000000..8579c6cfe --- /dev/null +++ b/include/fldeff_softboiled.h @@ -0,0 +1,6 @@ +#ifndef GUARD_FLDEFF_SOFTBOILED_H +#define GUARD_FLDEFF_SOFTBOILED_H + +void sub_81615A8(u8 taskId); + +#endif // GUARD_FLDEFF_SOFTBOILED_H diff --git a/include/party_menu.h b/include/party_menu.h index b93b78544..a0a8bdbe6 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -10,7 +10,8 @@ enum AILMENT_PRZ, AILMENT_SLP, AILMENT_FRZ, - AILMENT_BRN + AILMENT_BRN, + AILMENT_FNT = 7 }; enum @@ -23,13 +24,17 @@ enum PARTY_GIVE_ITEM, }; -struct Struct203CEC8 -{ - u8 filler[0x9]; +struct Struct203CEC8 { + MainCallback unk0; + TaskFunc unk4; + u8 unk8_0:4; + u8 unk8_1:2; + u8 unk8_2:2; s8 unk9; s8 unkA; u8 unkB; - u8 filler2[0x2]; + u8 unkD; + u8 unkE; }; extern struct Struct203CEC8 gUnknown_0203CEC8; @@ -47,7 +52,7 @@ void sub_81B7F60(void); void sub_81B0FCC(u8 partyIdx, u8 a); void sub_81B1370(u8 taskId); -void display_pokemon_menu_message(u8 windowId); +void display_pokemon_menu_message(u32 windowId); void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); void sub_81B1B5C(void *a, u8 b); u8 sub_81B1BD4(); @@ -62,14 +67,14 @@ void sub_81B617C(void); u8 sub_81B6D14(u16 a); bool8 hm_add_c3_without_phase_2(void); -extern void dp05_ether(u8, u16, TaskFunc); -extern void dp05_pp_up(u8, u16, TaskFunc); -extern void dp05_rare_candy(u8, u16, TaskFunc); +extern void dp05_ether(u8, TaskFunc); +extern void dp05_pp_up(u8, TaskFunc); +extern void dp05_rare_candy(u8, TaskFunc); -extern void sub_81B67C8(u8, u16, TaskFunc); -extern void sub_81B79E8(u8, u16, TaskFunc); -extern void sub_81B6DC4(u8, u16, TaskFunc); -extern void sub_81B7C74(u8, u16, TaskFunc); +extern void sub_81B67C8(u8, TaskFunc); +extern void sub_81B79E8(u8, TaskFunc); +extern void sub_81B6DC4(u8, TaskFunc); +extern void sub_81B7C74(u8, TaskFunc); extern u16 ItemIdToBattleMoveId(u16); #endif // GUARD_PARTY_MENU_H diff --git a/src/item_use.c b/src/item_use.c index 67bdabd87..601c2b81b 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -38,7 +38,7 @@ #include "constants/vars.h" extern void(*gUnknown_0203A0F4)(u8 taskId); -extern void (*gUnknown_03006328)(u8, u16, TaskFunc); +extern void (*gUnknown_03006328)(u8, TaskFunc); extern void unknown_ItemMenu_Confirm(u8 taskId); extern void sub_81C5B14(u8 taskId); extern void ScriptUnfreezeEventObjects(void); @@ -52,7 +52,7 @@ extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[]; extern int sub_80247BC(void); extern struct MapHeader* mapconnection_get_mapheader(struct MapConnection *connection); extern void SetUpItemUseCallback(u8 taskId); -extern void ItemUseCB_Medicine(u8, u16, TaskFunc); +extern void ItemUseCB_Medicine(u8, TaskFunc); extern void bag_menu_yes_no(u8, u8, const struct YesNoFuncTable*); extern void sub_81C5924(void); extern void sub_81C59BC(void); diff --git a/src/party_menu.c b/src/party_menu.c index 9b8947465..c15f0d59c 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1,20 +1,30 @@ #include "global.h" -#include "battle_main.h" +#include "battle.h" #include "bg.h" #include "constants/rgb.h" +#include "constants/songs.h" #include "constants/species.h" +#include "contest.h" #include "decompress.h" +#include "event_data.h" +#include "fldeff_softboiled.h" #include "gpu_regs.h" #include "graphics.h" +#include "international_string_util.h" +#include "item_menu.h" +#include "item_use.h" #include "main.h" #include "malloc.h" #include "menu.h" #include "menu_helpers.h" #include "palette.h" +#include "party_menu.h" #include "pokemon.h" #include "pokemon_icon.h" #include "scanline_effect.h" +#include "sound.h" #include "sprite.h" +#include "string_util.h" #include "task.h" #include "text.h" #include "window.h" @@ -26,7 +36,7 @@ struct Unk_Rodata1 { struct Unk_203CEC4 { TaskFunc unk0; - void *unk4; + MainCallback unk4; u32 unk8_0:1; u32 unk8_1:3; u32 unk8_2:7; @@ -39,17 +49,6 @@ struct Unk_203CEC4 { s16 unk218[16]; }; -struct Unk_203CEC8 { - MainCallback unk0; - u8 filler[4]; - u8 unk8_0:4; - u8 unk8_1:2; - u8 unk8_2:2; - s8 unk9; - u8 unkA; - u8 unkB; -}; - struct Unk_203CEDC { struct Unk_Rodata1 *unk0; u32 *unk4; @@ -67,10 +66,12 @@ struct Unk_203CEE4 { // BELOW TO BE PUT IN EWRAM extern struct Unk_203CEC4 *gUnknown_0203CEC4; -extern struct Unk_203CEC8 gUnknown_0203CEC8; +extern struct Struct203CEC8 gUnknown_0203CEC8; extern struct Unk_203CEDC *gUnknown_0203CEDC; extern u8 *gUnknown_0203CEE0; extern struct Unk_203CEE4 *gUnknown_0203CEE4; +extern u8 gUnknown_0203CEE8; +extern u8 gUnknown_0203CEF8[]; // ABOVE TO BE PUT IN EWRAM @@ -80,9 +81,13 @@ extern struct BgTemplate gUnknown_086156B8[]; extern struct Unk_Rodata1 gUnknown_086156C4[2]; // extern struct Unk_Rodata1 gUnknown_086156E4; extern u32 gUnknown_08615704[][6][2]; +extern u8 gUnknown_086157C4[]; +extern u8 gUnknown_086157E0[]; // ABOVE TO BE CONVERTED TO C +extern void (*gUnknown_03006328)(u8, TaskFunc); + void reset_brm(void); void c2_811EBD0(void); bool8 sub_81B020C(void); @@ -120,6 +125,54 @@ void sub_81B2B8C(struct Pokemon *, struct Unk_203CEDC *, u8); void sub_81B2CD4(struct Pokemon *, struct Unk_203CEDC *, u8); void sub_81B2D74(struct Pokemon *, struct Unk_203CEDC *, u8); void sub_81B2E28(struct Pokemon *, struct Unk_203CEDC *); +void sub_81B2FA8(u8, struct Unk_203CEDC *, u8); +u8 sub_81B8830(void); +bool8 sub_81B85AC(struct Pokemon *); +bool8 sub_81B218C(u8); +void sub_81B0C94(u8, u16, u8); +u8 sub_81B22D8(struct Pokemon *, u16, u8); +void sub_81B2A3C(u8, u8*, u8, u32*); +void sub_81B2B40(u8, struct Unk_203CEDC *); +void sub_81B2BF4(u8, u16, u8*, struct Unk_203CEDC *); +void sub_81B2D3C(u16, struct Unk_203CEDC *); +void sub_81B2DDC(u16, struct Unk_203CEDC *); +void sub_81B2E64(u16, u16, struct Unk_203CEDC *); +void party_menu_link_mon_icon_anim(u16, u32, struct Unk_203CEDC *, u8, u8); +void party_menu_link_mon_held_item_object(u16, u16, struct Unk_203CEDC *); +void party_menu_link_mon_pokeball_object(u16, struct Unk_203CEDC *); +void party_menu_link_mon_status_condition_object(u16, u8, struct Unk_203CEDC *); +void party_menu_held_item_object(struct Pokemon *, struct Unk_203CEDC *); +void party_menu_pokeball_object(struct Pokemon *, struct Unk_203CEDC *); +void party_menu_icon_anim(struct Pokemon *, struct Unk_203CEDC *, u8); +void party_menu_status_condition_object(struct Pokemon *, struct Unk_203CEDC *); +u8 sub_81B5F74(u8, u8); +void sub_81B120C(void); +u8 sub_81B5F34(u8, u8); +void sub_81B5B6C(u8, u8); +void sub_81B5F98(u8, u8); +u8 sub_81B10F8(u8, u8); +bool8 sub_81B118C(u8); +u8 sub_81B8F38(u8); +void c3_0811FAB4(u8); +void sub_81B9080(void); +void sub_81B4F88(void); +void sub_81B15D0(u8, s8*); +void sub_81B140C(u8, s8*); +u16 sub_81B1760(s8*); +s8* sub_81B13EC(void); +bool8 sub_81B15A4(u8*); +void sub_81B302C(u8*); +void sub_81B9140(void); +void sub_81B6794(u8); +void sub_81B7E4C(u8); +void sub_81B8474(u8); +void sub_81B7FAC(u8); +void sub_81B3938(u8); +void sub_81B21AC(u8, u8); +void sub_81B36FC(u8); +void sub_81B407C(u8); +void sub_81B2210(u8); +bool8 sub_81B1660(u8); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -453,69 +506,579 @@ void sub_81B0740(u8 a) gUnknown_0203CEDC[1].unk0 = &gUnknown_086156C4[0]; } -void sub_81B07E0(u8 a) +void sub_81B07E0(u8 slot) { - if (gUnknown_0203CEC8.unk8_0 == 5 && a > 2) + if (gUnknown_0203CEC8.unk8_0 == 5 && slot > 2) { - sub_81B0CEC(a); - if (gUnknown_02022FF8[a - 3].species == SPECIES_NONE) - sub_81B2748(&gUnknown_0203CEDC[a], 0x40); + sub_81B0CEC(slot); + if (gUnknown_02022FF8[slot - 3].species == SPECIES_NONE) + sub_81B2748(&gUnknown_0203CEDC[slot], 0x40); else - sub_81B2748(&gUnknown_0203CEDC[a], 8); - CopyWindowToVram(gUnknown_0203CEDC[a].unk8, 2); - PutWindowTilemap(gUnknown_0203CEDC[a].unk8); + sub_81B2748(&gUnknown_0203CEDC[slot], 8); + CopyWindowToVram(gUnknown_0203CEDC[slot].unk8, 2); + PutWindowTilemap(gUnknown_0203CEDC[slot].unk8); schedule_bg_copy_tilemap_to_vram(2); } else { - if (GetMonData(&gPlayerParty[a], MON_DATA_SPECIES) == SPECIES_NONE) + if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) == SPECIES_NONE) { - sub_81B2720(gUnknown_0203CEDC[a].unk8); - sub_81B2748(&gUnknown_0203CEDC[a], 0x40); - CopyWindowToVram(gUnknown_0203CEDC[a].unk8, 2); + sub_81B2720(gUnknown_0203CEDC[slot].unk8); + sub_81B2748(&gUnknown_0203CEDC[slot], 0x40); + CopyWindowToVram(gUnknown_0203CEDC[slot].unk8, 2); } else { if (gUnknown_0203CEC8.unk8_0 == 7) - sub_81B0B60(a); + sub_81B0B60(slot); else if (gUnknown_0203CEC8.unk8_0 == 2) - sub_81B0B08(a); + sub_81B0B08(slot); else if (gUnknown_0203CEC8.unk8_0 == 4) - sub_81B0A9C(a); + sub_81B0A9C(slot); else if (gUnknown_0203CEC8.unk8_0 == 11) - sub_81B0B98(a); + sub_81B0B98(slot); else if (gUnknown_0203CEC8.unk8_0 == 12) - sub_81B0BC4(a); - else if (!sub_81B0BFC(a)) - sub_81B0948(a); + sub_81B0BC4(slot); + else if (!sub_81B0BFC(slot)) + sub_81B0948(slot); if (gUnknown_0203CEC8.unk8_0 == 5) - sub_81B0FCC(a, 0); - else if (gUnknown_0203CEC8.unk9 == a) - sub_81B0FCC(a, 1); + sub_81B0FCC(slot, 0); + else if (gUnknown_0203CEC8.unk9 == slot) + sub_81B0FCC(slot, 1); else - sub_81B0FCC(a, 0); + sub_81B0FCC(slot, 0); } - PutWindowTilemap(gUnknown_0203CEDC[a].unk8); + PutWindowTilemap(gUnknown_0203CEDC[slot].unk8); schedule_bg_copy_tilemap_to_vram(0); } } -void sub_81B0948(u8 a) +void sub_81B0948(u8 slot) { - if (GetMonData(&gPlayerParty[a], MON_DATA_IS_EGG)) + if (GetMonData(&gPlayerParty[slot], MON_DATA_IS_EGG)) { - gUnknown_0203CEDC[a].unk0->unk0(gUnknown_0203CEDC[a].unk8, 0, 0, 0, 0, 1); - sub_81B2A70(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 1); + sub_81B2A70(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); } else { - gUnknown_0203CEDC[a].unk0->unk0(gUnknown_0203CEDC[a].unk8, 0, 0, 0, 0, 0); - sub_81B2A70(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2AC8(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2B8C(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2CD4(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2D74(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2E28(&gPlayerParty[a], &gUnknown_0203CEDC[a]); + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 0); + sub_81B2A70(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2AC8(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2B8C(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2CD4(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2D74(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2E28(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); } } + +void sub_81B0A10(u8 slot, u8 b) +{ + struct Pokemon *currentPokemon = &gPlayerParty[slot]; + + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 1); + sub_81B2A70(currentPokemon, &gUnknown_0203CEDC[slot], 0); + if (!GetMonData(currentPokemon, MON_DATA_IS_EGG)) + { + sub_81B2AC8(currentPokemon, &gUnknown_0203CEDC[slot], 0); + sub_81B2B8C(currentPokemon, &gUnknown_0203CEDC[slot], 0); + } + sub_81B2FA8(b, &gUnknown_0203CEDC[slot], 0); +} + +void sub_81B0A9C(u8 slot) +{ + u8 i; + struct Pokemon *currentPokemon = &gPlayerParty[slot]; + u8 *ptr = gUnknown_0203CEF8; + + if (!sub_81B85AC(currentPokemon)) + { + sub_81B0A10(slot, 7); + return; + } + else + { + i = 0; + while (i < sub_81B8830()) + { + if (ptr[i] != 0 && (ptr[i] - 1) == slot) + { + sub_81B0A10(slot, i + 2); + return; + } + i++; + } + sub_81B0A10(slot, 1); + } +} + +void sub_81B0B08(u8 slot) +{ + switch (sub_80DAE0C(&gPlayerParty[slot])) + { + case 0: + case 3: + case 4: + sub_81B0A10(slot, 7); + break; + case 1: + case 2: + sub_81B0A10(slot, 6); + break; + } +} + +void sub_81B0B60(u8 slot) +{ + if (!GetNumberOfRelearnableMoves(&gPlayerParty[slot])) + sub_81B0A10(slot, 9); + else + sub_81B0A10(slot, 8); +} + +void sub_81B0B98(u8 slot) +{ + if (sub_81B218C(slot) == TRUE) + sub_81B0A10(slot, 6); + else + sub_81B0A10(slot, 7); +} + +void sub_81B0BC4(u8 slot) +{ + if (GetMonData(&gPlayerParty[slot], MON_DATA_HELD_ITEM)) + sub_81B0A10(slot, 11); + else + sub_81B0A10(slot, 12); +} + +bool8 sub_81B0BFC(u8 slot) +{ + struct Pokemon *currentPokemon = &gPlayerParty[slot]; + u16 item = gSpecialVar_ItemId; + + if (gUnknown_0203CEC8.unkB == 12) + { + gSpecialVar_Result = FALSE; + sub_81B0C94(slot, 0, gSpecialVar_0x8005); + } + else + { + if (gUnknown_0203CEC8.unkB != 3) + return FALSE; + + switch (CheckIfItemIsTMHMOrEvolutionStone(item)) + { + default: + return FALSE; + case 1: + sub_81B0C94(slot, item, 0); + break; + case 2: + if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item) != SPECIES_NONE) + return FALSE; + sub_81B0A10(slot, 0); + break; + } + } + return TRUE; +} + +void sub_81B0C94(u8 slot, u16 item, u8 c) +{ + switch (sub_81B22D8(&gPlayerParty[slot], item, c)) + { + case 1: + case 3: + sub_81B0A10(slot, 9); + break; + case 2: + sub_81B0A10(slot, 10); + break; + default: + sub_81B0A10(slot, 8); + break; + } +} + +void sub_81B0CEC(u8 slot) +{ + struct Unk_203CEDC *structPtr = &gUnknown_0203CEDC[slot]; + u8 actualSlot = slot - 3; + + if (gUnknown_02022FF8[actualSlot].species == SPECIES_NONE) + { + sub_81B2720(structPtr->unk8); + } + else + { + structPtr->unk0->unk0(structPtr->unk8, 0, 0, 0, 0, 0); + StringCopy(gStringVar1, gUnknown_02022FF8[actualSlot].nickname); + StringGetEnd10(gStringVar1); + sub_81DB52C(gStringVar1); + sub_81B2A3C(structPtr->unk8, gStringVar1, 0, structPtr->unk0->unk4); + sub_81B2B40(gUnknown_02022FF8[actualSlot].level, structPtr); + sub_81B2BF4(gUnknown_02022FF8[actualSlot].gender, gUnknown_02022FF8[actualSlot].species, gUnknown_02022FF8[actualSlot].nickname, structPtr); + sub_81B2D3C(gUnknown_02022FF8[actualSlot].hp, structPtr); + sub_81B2DDC(gUnknown_02022FF8[actualSlot].maxhp, structPtr); + sub_81B2E64(gUnknown_02022FF8[actualSlot].hp, gUnknown_02022FF8[actualSlot].maxhp, structPtr); + } +} + +bool8 sub_81B0DA0(void) +{ + sub_81B07E0(gUnknown_0203CEC4->unk218[0]); + if (++gUnknown_0203CEC4->unk218[0] == 6) + return TRUE; + return FALSE; +} + +u8* sub_81B0DD4(u16 a) +{ + return &gUnknown_0203CEE0[a << 5]; +} + +void party_menu_add_per_mon_objects_internal(u8 slot) +{ + u8 actualSlot; + + if (gUnknown_0203CEC8.unk8_0 == 5 && slot > 2) + { + u8 status; + actualSlot = slot - 3; + + if (gUnknown_02022FF8[actualSlot].species != SPECIES_NONE) + { + party_menu_link_mon_icon_anim(gUnknown_02022FF8[actualSlot].species, gUnknown_02022FF8[actualSlot].personality, &gUnknown_0203CEDC[slot], 0, 0); + party_menu_link_mon_held_item_object(gUnknown_02022FF8[actualSlot].species, gUnknown_02022FF8[actualSlot].heldItem, &gUnknown_0203CEDC[slot]); + party_menu_link_mon_pokeball_object(gUnknown_02022FF8[actualSlot].species, &gUnknown_0203CEDC[slot]); + if (gUnknown_02022FF8[actualSlot].hp == 0) + status = AILMENT_FNT; + else + status = pokemon_ailments_get_primary(gUnknown_02022FF8[actualSlot].status); + party_menu_link_mon_status_condition_object(gUnknown_02022FF8[actualSlot].species, status, &gUnknown_0203CEDC[slot]); + } + } + else if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) != SPECIES_NONE) + { + party_menu_icon_anim(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], slot); + party_menu_held_item_object(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); + party_menu_pokeball_object(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); + party_menu_status_condition_object(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); + } +} + +bool8 party_menu_add_per_mon_objects(void) +{ + party_menu_add_per_mon_objects_internal(gUnknown_0203CEC4->unk218[0]); + if (++gUnknown_0203CEC4->unk218[0] == 6) + return TRUE; + return FALSE; +} + +void sub_81B0F28(void) +{ + if (gUnknown_0203CEC8.unk8_0 == 5) + { + FillBgTilemapBufferRect(1, 14, 23, 17, 7, 2, 1); + } + else + { + if (gUnknown_0203CEC4->unk8_0 != FALSE) + { + gUnknown_0203CEC4->unk8_2 = sub_81B5F74(0xBF, 0x88); + sub_81B120C(); + gUnknown_0203CEC4->unk9_0 = sub_81B5F74(0xBF, 0x98); + } + else + { + gUnknown_0203CEC4->unk9_0 = sub_81B5F34(0xC6, 0x94); + } + sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); + } +} + +void sub_81B0FCC(u8 slot, u8 b) +{ + u8 spriteId; + + switch (slot) + { + default: + if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) != SPECIES_NONE) + { + sub_81B2748(&gUnknown_0203CEDC[slot], sub_81B10F8(slot, b)); + sub_81B5B6C(gUnknown_0203CEDC[slot].unk9, b); + sub_81B5F98(gUnknown_0203CEDC[slot].unkB, b); + } + return; + case 6: + if (b == 0) + sub_8199C30(1, 23, 16, 7, 2, 1); + else + sub_8199C30(1, 23, 16, 7, 2, 2); + spriteId = gUnknown_0203CEC4->unk8_2; + break; + case 7: + if (!gUnknown_0203CEC4->unk8_0) + { + if (b == 0) + sub_8199C30(1, 23, 17, 7, 2, 1); + else + sub_8199C30(1, 23, 17, 7, 2, 2); + } + else if (b == 0) + { + sub_8199C30(1, 23, 18, 7, 2, 1); + } + else + { + sub_8199C30(1, 23, 18, 7, 2, 2); + } + spriteId = gUnknown_0203CEC4->unk9_0; + break; + } + sub_81B5F98(spriteId, b); + schedule_bg_copy_tilemap_to_vram(1); +} + +u8 sub_81B10F8(u8 slot, u8 b) +{ + u8 returnVar = 0; + if (b == 1) + returnVar = 1; + if (GetMonData(&gPlayerParty[slot], MON_DATA_HP) == 0) + returnVar |= 2; + if (sub_81B118C(slot) == TRUE) + returnVar |= 8; + if (gUnknown_0203CEC8.unkB == 9) + returnVar |= 16; + if (gUnknown_0203CEC8.unkB == 8) + { + if (slot == gUnknown_0203CEC8.unk9 || slot == gUnknown_0203CEC8.unkA) + returnVar |= 4; + } + if (gUnknown_0203CEC8.unkB == 10 && slot == gUnknown_0203CEC8.unk9 ) + returnVar |= 32; + + return returnVar; +} + +bool8 sub_81B118C(u8 slot) +{ + if (gUnknown_0203CEC8.unk8_1 == 2 && (slot == 1 || slot == 4 || slot == 5)) + return TRUE; + + if (slot < 3 && (gBattleTypeFlags & BATTLE_TYPE_ARENA) && gMain.inBattle && (gBattleStruct->field_2A0 >> sub_81B8F38(slot) & 1)) + return TRUE; + + return FALSE; +} + +void sub_81B120C(void) +{ + CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_086157C4, 23, 16, 7, 2, 17); + CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_086157E0, 23, 18, 7, 2, 17); + schedule_bg_copy_tilemap_to_vram(1); +} + +bool8 sub_81B1250(void) +{ + if ((gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI)) == (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI) && gMain.inBattle) + return TRUE; + return FALSE; +} + +void sub_81B1288(struct Pokemon *partySlot, struct Pokemon *pokemon) +{ + struct Pokemon *temp = Alloc(sizeof(struct Pokemon)); + + *temp = *partySlot; + *partySlot = *pokemon; + *pokemon = *temp; + + Free(temp); +} + +void sub_81B12C0(u8 taskId) +{ + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = c3_0811FAB4; +} + +void c3_0811FAB4(u8 taskId) +{ + if (!gPaletteFade.active) + { + if (gUnknown_0203CEC8.unk8_0 == 1) + sub_81B9080(); + + if (gUnknown_0203CEC4->unk4 != NULL) + SetMainCallback2(gUnknown_0203CEC4->unk4); + else + SetMainCallback2(gUnknown_0203CEC8.unk0); + + ResetSpriteData(); + sub_81B06F4(); + DestroyTask(taskId); + } +} + +u8 GetCursorSelectionMonId(void) +{ + return gUnknown_0203CEC8.unk9; +} + +u8 sub_81B1360(void) +{ + return gUnknown_0203CEC8.unk8_0; +} + +void sub_81B1370(u8 taskId) +{ + if (!gPaletteFade.active && sub_81221EC() != TRUE) + { + s8 *ptr = sub_81B13EC(); + + switch (sub_81B1760(ptr)) + { + case 1: + sub_81B140C(taskId, ptr); + break; + case 2: + sub_81B15D0(taskId, ptr); + break; + case 8: + if (gUnknown_0203CEC4->unk8_0) + { + PlaySE(SE_SELECT); + sub_81B4F88(); + } + } + } +} + +s8* sub_81B13EC(void) +{ + if (gUnknown_0203CEC8.unkB == 8 || gUnknown_0203CEC8.unkB == 10) + return &gUnknown_0203CEC8.unkA; + return &gUnknown_0203CEC8.unk9; +} + +void sub_81B140C(u8 taskId, s8 *ptr) +{ + if (*ptr == 6) + { + gUnknown_0203CEC8.unk4(taskId); + } + else + { + switch (gUnknown_0203CEC8.unkB - 3) + { + case 7: + if (sub_81B15A4((u8*)ptr)) + { + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81615A8(taskId); + } + break; + case 0: + if (sub_81B15A4((u8*)ptr)) + { + if (gUnknown_0203CEC8.unk8_0 == 1) + gUnknown_0203CEC4->unk4 = sub_81B9140; + + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + gUnknown_03006328(taskId, sub_81B6794); + } + break; + case 9: + if (sub_81B15A4((u8*)ptr)) + { + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B7E4C(taskId); + } + break; + case 4: + if (sub_81B15A4((u8*)ptr)) + { + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B8474(taskId); + } + break; + case 2: + case 3: + if (sub_81B15A4((u8*)ptr)) + { + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B7FAC(taskId); + } + break; + case 5: + PlaySE(SE_SELECT); + sub_81B3938(taskId); + break; + case 8: + PlaySE(SE_SELECT); + sub_81B12C0(taskId); + break; + case 10: + if (sub_81B15A4((u8*)ptr)) + { + sub_81B21AC(taskId, (u8)*ptr); + } + break; + default: + case 1: + case 6: + PlaySE(SE_SELECT); + sub_81B36FC(taskId); + break; + } + } +} + +bool8 sub_81B15A4(u8 *slotPtr) +{ + if (GetMonData(&gPlayerParty[*slotPtr], MON_DATA_IS_EGG) == TRUE) + { + PlaySE(SE_HAZURE); + return FALSE; + } + return TRUE; +} + +void sub_81B15D0(u8 taskId, s8 *ptr) +{ + switch (gUnknown_0203CEC8.unkB) + { + case 1: + PlaySE(SE_HAZURE); + break; + case 8: + case 10: + PlaySE(SE_SELECT); + sub_81B407C(taskId); + break; + case 13: + PlaySE(SE_SELECT); + sub_81B2210(taskId); + break; + default: + PlaySE(SE_SELECT); + if (sub_81B1660(taskId) != TRUE) + { + if (!sub_81221AC()) + gSpecialVar_0x8004 = 7; + gUnknown_0203CEE8 = 0; + *ptr = 7; + sub_81B12C0(taskId); + } + break; + } +} From dded980cde81b1b71a636d8c2b7c15668e0a7b35 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 17 Oct 2018 23:36:18 -0400 Subject: [PATCH 03/17] fix building --- include/party_menu.h | 1 + src/battle_main.c | 15 +-------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/include/party_menu.h b/include/party_menu.h index 0103099e4..bf0db514b 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -1,6 +1,7 @@ #ifndef GUARD_PARTY_MENU_H #define GUARD_PARTY_MENU_H +#include "main.h" #include "task.h" enum diff --git a/src/battle_main.c b/src/battle_main.c index 80ee5c425..44cd65976 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -52,20 +52,7 @@ #include "international_string_util.h" #include "pokeball.h" #include "party_menu.h" - -struct UnknownPokemonStruct4 -{ - /*0x00*/ u16 species; - /*0x02*/ u16 heldItem; - /*0x04*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; - /*0x0F*/ u8 level; - /*0x10*/ u16 hp; - /*0x12*/ u16 maxhp; - /*0x14*/ u32 status; - /*0x18*/ u32 personality; - /*0x1C*/ u8 gender; - /*0x1D*/ u8 language; -}; +#include "battle_main.h" extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; From ba3247d5cd27070c51e28437e8880dec72d973b5 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Sat, 20 Oct 2018 20:25:28 -0400 Subject: [PATCH 04/17] decompiled more, stuck on sub_81B1760 --- asm/party_menu.s | 121 ---------------------------------------- include/party_menu.h | 2 +- include/strings.h | 1 + src/fldeff_softboiled.c | 2 +- src/party_menu.c | 104 ++++++++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 123 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index e5540e171..399a9f215 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,127 +5,6 @@ .text - thumb_func_start sub_81B1660 -sub_81B1660: @ 81B1660 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - movs r1, 0xF - ands r1, r0 - cmp r1, 0x2 - bne _081B1680 - ldr r5, =gText_CancelParticipation - b _081B168A - .pool -_081B1680: - cmp r1, 0x4 - bne _081B168A - bl sub_81B88BC - adds r5, r0, 0 -_081B168A: - cmp r5, 0 - beq _081B16CC - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - ldr r4, =gStringVar4 - adds r0, r4, 0 - adds r1, r5, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B16D4 - str r1, [r0] - movs r0, 0x1 - b _081B16CE - .pool -_081B16CC: - movs r0, 0 -_081B16CE: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81B1660 - - thumb_func_start sub_81B16D4 -sub_81B16D4: @ 81B16D4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B16F8 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1708 - str r0, [r1] -_081B16F8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B16D4 - - thumb_func_start sub_81B1708 -sub_81B1708: @ 81B1708 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B172E - cmp r1, 0 - bgt _081B1728 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B174C - b _081B1758 -_081B1728: - cmp r1, 0x1 - beq _081B1752 - b _081B1758 -_081B172E: - ldr r0, =gUnknown_0203CEE8 - strb r1, [r0] - ldr r1, =gUnknown_0203CEC8 - movs r0, 0x7 - strb r0, [r1, 0x9] - bl sub_81B8558 - adds r0, r4, 0 - bl sub_81B12C0 - b _081B1758 - .pool -_081B174C: - movs r0, 0x5 - bl PlaySE -_081B1752: - adds r0, r4, 0 - bl sub_81B1C1C -_081B1758: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B1708 - thumb_func_start sub_81B1760 sub_81B1760: @ 81B1760 push {r4,lr} diff --git a/include/party_menu.h b/include/party_menu.h index bf0db514b..f2615dac5 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -55,7 +55,7 @@ void sub_81B0FCC(u8 partyIdx, u8 a); void sub_81B1370(u8 taskId); void display_pokemon_menu_message(u32 windowId); void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); -void sub_81B1B5C(void *a, u8 b); +u8 sub_81B1B5C(const u8 *a, u8 b); u8 sub_81B1BD4(void); void sub_81B8448(void); void sub_81B8518(u8 unused); diff --git a/include/strings.h b/include/strings.h index 4ea33635b..31b8f399d 100644 --- a/include/strings.h +++ b/include/strings.h @@ -369,6 +369,7 @@ extern const u8 gText_ThreeDashes[]; // party menu text extern const u8 gText_PkmnHPRestoredByVar2[]; extern const u8 gText_CantBeUsedOnPkmn[]; +extern const u8 gText_CancelParticipation[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/src/fldeff_softboiled.c b/src/fldeff_softboiled.c index d0a40a9a9..3b2d4988f 100644 --- a/src/fldeff_softboiled.c +++ b/src/fldeff_softboiled.c @@ -103,7 +103,7 @@ static void sub_8161784(u8 taskId) static void sub_81617B8(u8 taskId) { PlaySE(SE_SELECT); - sub_81B1B5C(&gText_CantBeUsedOnPkmn, 0); + sub_81B1B5C(gText_CantBeUsedOnPkmn, 0); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_8161784; } diff --git a/src/party_menu.c b/src/party_menu.c index c15f0d59c..07519d648 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -25,6 +25,7 @@ #include "sound.h" #include "sprite.h" #include "string_util.h" +#include "strings.h" #include "task.h" #include "text.h" #include "window.h" @@ -173,6 +174,15 @@ void sub_81B36FC(u8); void sub_81B407C(u8); void sub_81B2210(u8); bool8 sub_81B1660(u8); +const u8* sub_81B88BC(void); +u8 sub_81B1B5C(const u8*, u8); +void sub_81B16D4(u8); +void sub_81B334C(void); +void sub_81B1708(u8); +bool8 sub_81B1BD4(void); +void sub_81B1C1C(u8); +void sub_81B8558(void); +void sub_81B17F8(s8*); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -1082,3 +1092,97 @@ void sub_81B15D0(u8 taskId, s8 *ptr) break; } } + +bool8 sub_81B1660(u8 taskId) +{ + const u8* stringPtr = NULL; + + if (gUnknown_0203CEC8.unk8_0 == 2) + stringPtr = gText_CancelParticipation; + else if (gUnknown_0203CEC8.unk8_0 == 4) + stringPtr = sub_81B88BC(); + + if (stringPtr == NULL) + return FALSE; + + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + StringExpandPlaceholders(gStringVar4, stringPtr); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B16D4; + return TRUE; +} + +void sub_81B16D4(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B1708; + } +} + +void sub_81B1708(u8 taskId) +{ + switch (Menu_ProcessInputNoWrap_()) + { + case 0: + gUnknown_0203CEE8 = 0; + gUnknown_0203CEC8.unk9 = 7; + sub_81B8558(); + sub_81B12C0(taskId); + break; + case -1: + PlaySE(SE_SELECT); + case 1: + sub_81B1C1C(taskId); + break; + } +} + +/* u16 sub_81B1760(s8* ptr) +{ + s8 r1; + + switch (gMain.newAndRepeatedKeys) + { + case DPAD_UP: + r1 = -1; + break; + case DPAD_DOWN: + r1 = 1; + break; + case DPAD_LEFT: + r1 = -2; + break; + case DPAD_RIGHT: + r1 = 2; + break; + default: + switch (sub_812210C()) + { + case 1: + r1 = -1; + break; + case 2: + r1 = 1; + break; + default: + r1 = 0; + break; + } + } + + if (gMain.newKeys & START_BUTTON) + return 8; + + if ((s8)r1) + { + sub_81B17F8(ptr); + return 0; + } + + if ((gMain.newKeys & A_BUTTON) && *ptr == 7) + return 2; + + return gMain.newKeys & (A_BUTTON | B_BUTTON); +} */ From 18124740a4d75ae95948f95ca6f63c320e51501c Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Thu, 6 Dec 2018 23:14:33 -0500 Subject: [PATCH 05/17] pushing so I can merge --- asm/party_menu.s | 3223 ----------------------------------------- include/party_menu.h | 7 +- include/rom_8011DC0.h | 1 + include/strings.h | 6 + src/party_menu.c | 1617 ++++++++++++++++++++- 5 files changed, 1618 insertions(+), 3236 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index 399a9f215..54d7510d9 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,3229 +5,6 @@ .text - thumb_func_start sub_81B1760 -sub_81B1760: @ 81B1760 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x30] - adds r3, r0, 0 - cmp r1, 0x20 - beq _081B178E - cmp r1, 0x20 - bgt _081B177C - cmp r1, 0x10 - beq _081B1792 - b _081B1796 - .pool -_081B177C: - cmp r1, 0x40 - beq _081B1786 - cmp r1, 0x80 - beq _081B178A - b _081B1796 -_081B1786: - movs r1, 0xFF - b _081B17B2 -_081B178A: - movs r1, 0x1 - b _081B17B2 -_081B178E: - movs r1, 0xFE - b _081B17B2 -_081B1792: - movs r1, 0x2 - b _081B17B2 -_081B1796: - bl sub_812210C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B17AA - cmp r0, 0x2 - beq _081B17AE - movs r1, 0 - b _081B17B0 -_081B17AA: - movs r1, 0xFF - b _081B17B0 -_081B17AE: - movs r1, 0x1 -_081B17B0: - ldr r3, =gMain -_081B17B2: - ldrh r2, [r3, 0x2E] - movs r0, 0x8 - ands r0, r2 - cmp r0, 0 - beq _081B17C4 - movs r0, 0x8 - b _081B17F0 - .pool -_081B17C4: - lsls r0, r1, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B17D6 - adds r0, r4, 0 - bl sub_81B17F8 - movs r0, 0 - b _081B17F0 -_081B17D6: - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _081B17EA - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x7 - bne _081B17EA - movs r0, 0x2 - b _081B17F0 -_081B17EA: - ldrh r1, [r3, 0x2E] - movs r0, 0x3 - ands r0, r1 -_081B17F0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B1760 - - thumb_func_start sub_81B17F8 -sub_81B17F8: @ 81B17F8 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldrb r4, [r5] - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - lsls r0, 26 - lsrs r0, 30 - cmp r0, 0 - bne _081B1820 - lsls r1, 24 - asrs r1, 24 - adds r0, r5, 0 - bl sub_81B1854 - b _081B182A - .pool -_081B1820: - lsls r1, 24 - asrs r1, 24 - adds r0, r5, 0 - bl sub_81B195C -_081B182A: - movs r1, 0 - ldrsb r1, [r5, r1] - lsls r4, 24 - asrs r0, r4, 24 - cmp r1, r0 - beq _081B184C - movs r0, 0x5 - bl PlaySE - lsrs r0, r4, 24 - movs r1, 0 - bl sub_81B0FCC - ldrb r0, [r5] - movs r1, 0x1 - bl sub_81B0FCC -_081B184C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81B17F8 - - thumb_func_start sub_81B1854 -sub_81B1854: @ 81B1854 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - asrs r1, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B187A - cmp r1, r0 - bgt _081B1870 - subs r0, 0x1 - cmp r1, r0 - beq _081B1924 - b _081B1952 -_081B1870: - cmp r1, 0x1 - beq _081B18C0 - cmp r1, 0x2 - beq _081B18F8 - b _081B1952 -_081B187A: - ldrb r0, [r4] - movs r1, 0 - ldrsb r1, [r4, r1] - cmp r1, 0 - bne _081B1888 - movs r0, 0x7 - b _081B1950 -_081B1888: - cmp r1, 0x6 - bne _081B1898 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - subs r0, 0x1 - b _081B1950 - .pool -_081B1898: - cmp r1, 0x7 - bne _081B18BC - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B18B0 - movs r0, 0x6 - b _081B1950 - .pool -_081B18B0: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - subs r0, 0x1 - b _081B1950 - .pool -_081B18BC: - subs r0, 0x1 - b _081B1950 -_081B18C0: - ldrb r2, [r4] - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x7 - beq _081B194E - movs r1, 0 - ldrsb r1, [r4, r1] - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - subs r0, 0x1 - cmp r1, r0 - bne _081B18F4 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B18F0 - movs r0, 0x6 - b _081B1950 - .pool -_081B18F0: - movs r0, 0x7 - b _081B1950 -_081B18F4: - adds r0, r2, 0x1 - b _081B1950 -_081B18F8: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r0, 0x1 - beq _081B1952 - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - bne _081B1952 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 28 - lsrs r0, 29 - cmp r0, 0 - bne _081B1950 - movs r0, 0x1 - b _081B1950 - .pool -_081B1924: - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - beq _081B1952 - cmp r0, 0x6 - beq _081B1952 - cmp r0, 0x7 - beq _081B1952 - ldr r0, =gUnknown_0203CEC4 - ldr r3, [r0] - movs r1, 0 - ldrsb r1, [r4, r1] - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r3, 0x8] - movs r0, 0xF - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x8] -_081B194E: - movs r0, 0 -_081B1950: - strb r0, [r4] -_081B1952: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1854 - - thumb_func_start sub_81B195C -sub_81B195C: @ 81B195C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r2, r1, 24 - asrs r5, r1, 24 - movs r6, 0x1 - negs r6, r6 - cmp r5, r6 - beq _081B1988 - cmp r5, r6 - bgt _081B197E - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - bne _081B197C - b _081B1A9C -_081B197C: - b _081B1AF4 -_081B197E: - cmp r5, 0x1 - beq _081B19E4 - cmp r5, 0x2 - beq _081B1A24 - b _081B1AF4 -_081B1988: - ldrb r1, [r4] - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - bne _081B1996 - movs r0, 0x7 - b _081B1AF2 -_081B1996: - cmp r0, 0x6 - bne _081B19A8 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - subs r0, 0x1 - b _081B1AF2 - .pool -_081B19A8: - cmp r0, 0x7 - bne _081B19C4 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B19C0 - movs r0, 0x6 - b _081B1AF2 - .pool -_081B19C0: - subs r0, r1, 0x1 - strb r0, [r4] -_081B19C4: - movs r0, 0 - ldrsb r0, [r4, r0] - lsls r1, r2, 24 - asrs r1, 24 - bl sub_81B1B00 - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _081B19E0 - b _081B1AF4 -_081B19E0: - strb r2, [r4] - b _081B1AF4 -_081B19E4: - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x6 - bne _081B19F0 - movs r0, 0x7 - b _081B1AF2 -_081B19F0: - cmp r0, 0x7 - bne _081B19F8 - movs r0, 0 - b _081B1AF2 -_081B19F8: - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x1 - bl sub_81B1B00 - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, r6 - bne _081B19E0 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B1A20 - movs r0, 0x6 - b _081B1AF2 - .pool -_081B1A20: - movs r0, 0x7 - b _081B1AF2 -_081B1A24: - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - bne _081B1A5C - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 28 - lsrs r6, r0, 29 - cmp r6, 0x3 - bne _081B1A54 - ldr r0, =gPlayerParty + 300 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B1AF4 - strb r6, [r4] - b _081B1AF4 - .pool -_081B1A54: - ldr r0, =gPlayerParty + 200 - b _081B1A70 - .pool -_081B1A5C: - cmp r0, 0x1 - bne _081B1AF4 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 28 - lsrs r5, r0, 29 - cmp r5, 0x5 - bne _081B1A88 - ldr r0, =gPlayerParty + 500 -_081B1A70: - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B1AF4 - strb r5, [r4] - b _081B1AF4 - .pool -_081B1A88: - ldr r0, =gPlayerParty + 400 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B1AF4 - movs r0, 0x4 - b _081B1AF2 - .pool -_081B1A9C: - ldrb r1, [r4] - subs r0, r1, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081B1ACC - ldr r0, =gUnknown_0203CEC4 - ldr r3, [r0] - movs r1, 0 - ldrsb r1, [r4, r1] - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r3, 0x8] - movs r0, 0xF - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x8] - movs r0, 0 - b _081B1AF2 - .pool -_081B1ACC: - subs r0, r1, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081B1AF4 - ldr r0, =gUnknown_0203CEC4 - ldr r3, [r0] - movs r1, 0 - ldrsb r1, [r4, r1] - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r3, 0x8] - movs r0, 0xF - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x8] - movs r0, 0x1 -_081B1AF2: - strb r0, [r4] -_081B1AF4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B195C - - thumb_func_start sub_81B1B00 -sub_81B1B00: @ 81B1B00 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - asrs r6, r1, 24 -_081B1B0A: - lsls r0, r5, 24 - asrs r0, 24 - adds r0, r6 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, r5, 24 - lsrs r0, r1, 24 - cmp r0, 0x5 - bhi _081B1B38 - asrs r4, r1, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B1B0A - adds r0, r4, 0 - b _081B1B3C - .pool -_081B1B38: - movs r0, 0x1 - negs r0, r0 -_081B1B3C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81B1B00 - - thumb_func_start GetMonNickname -@ u8 *GetMonNickname(struct pokemon *mon, u8 *dest) -GetMonNickname: @ 81B1B44 - push {r4,lr} - adds r4, r1, 0 - movs r1, 0x2 - adds r2, r4, 0 - bl GetMonData - adds r0, r4, 0 - bl StringGetEnd10 - pop {r4} - pop {r1} - bx r1 - thumb_func_end GetMonNickname - - thumb_func_start sub_81B1B5C -sub_81B1B5C: @ 81B1B5C - push {r4,lr} - lsls r4, r1, 24 - lsrs r4, 24 - bl sub_81B3300 - ldr r0, =sub_81B1B8C - movs r1, 0x1 - 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] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B1B5C - - thumb_func_start sub_81B1B8C -sub_81B1B8C: @ 81B1B8C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - movs r0, 0x6 - bl RunTextPrintersRetIsActive - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - beq _081B1BC8 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r2, 0x8 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _081B1BC2 - movs r0, 0x6 - movs r1, 0 - bl sub_8198070 - movs r0, 0x6 - bl ClearWindowTilemap -_081B1BC2: - adds r0, r5, 0 - bl DestroyTask -_081B1BC8: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1B8C - - thumb_func_start sub_81B1BD4 -sub_81B1BD4: @ 81B1BD4 - push {lr} - ldr r0, =sub_81B1B8C - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B1BD4 - - thumb_func_start sub_81B1BE8 -sub_81B1BE8: @ 81B1BE8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B1C0E - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 - str r0, [r1] -_081B1C0E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1BE8 - - thumb_func_start sub_81B1C1C -sub_81B1C1C: @ 81B1C1C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B1C74 - movs r0, 0x6 - movs r1, 0 - bl sub_8198070 - movs r0, 0x6 - bl ClearWindowTilemap - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B1C60 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1BE8 - b _081B1C72 - .pool -_081B1C60: - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 -_081B1C72: - str r0, [r1] -_081B1C74: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1C1C - - thumb_func_start sub_81B1C84 -sub_81B1C84: @ 81B1C84 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnWasGivenItem - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1C84 - - thumb_func_start sub_81B1CD0 -sub_81B1CD0: @ 81B1CD0 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_RecievedItemFromPkmn - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1CD0 - - thumb_func_start sub_81B1D1C -sub_81B1D1C: @ 81B1D1C - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_SwitchPkmnItem - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1D1C - - thumb_func_start sub_81B1D68 -sub_81B1D68: @ 81B1D68 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gStringVar1 - bl CopyItemName - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_SwitchedPkmnItem - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1D68 - - thumb_func_start sub_81B1DB8 -sub_81B1DB8: @ 81B1DB8 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - lsls r5, r1, 16 - lsrs r4, r5, 16 - adds r7, r4, 0 - adds r0, r4, 0 - bl ItemIsMail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B1DE2 - adds r0, r6, 0 - adds r1, r4, 0 - bl GiveMailToMon - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _081B1DF6 -_081B1DE2: - mov r0, sp - strb r7, [r0] - mov r1, sp - lsrs r0, r5, 24 - strb r0, [r1, 0x1] - adds r0, r6, 0 - movs r1, 0xC - mov r2, sp - bl SetMonData -_081B1DF6: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B1DB8 - - thumb_func_start sub_81B1E00 -sub_81B1E00: @ 81B1E00 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r1, sp - strh r0, [r1] - cmp r0, 0 - bne _081B1E1C - movs r0, 0 - b _081B1E3E -_081B1E1C: - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - cmp r0, 0 - beq _081B1E3C - movs r1, 0 - mov r0, sp - strh r1, [r0] - adds r0, r4, 0 - movs r1, 0xC - mov r2, sp - bl SetMonData - movs r0, 0x2 - b _081B1E3E -_081B1E3C: - movs r0, 0x1 -_081B1E3E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B1E00 - - thumb_func_start pokemon_item_not_removed -pokemon_item_not_removed: @ 81B1E48 - push {lr} - ldr r0, =gStringVar4 - ldr r1, =gText_BagFullCouldNotRemoveItem - bl StringExpandPlaceholders - pop {r0} - bx r0 - .pool - thumb_func_end pokemon_item_not_removed - - thumb_func_start sub_81B1E60 -sub_81B1E60: @ 81B1E60 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r0, 2 - add r0, r8 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - ldrh r0, [r7, 0x4] - ldrh r1, [r7] - adds r0, r1 - strh r0, [r7] - ldrh r0, [r7, 0x6] - subs r0, 0x1 - strh r0, [r7, 0x6] - movs r2, 0x8 - ldrsh r0, [r7, r2] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x39 - adds r2, r7, 0 - bl SetMonData - movs r3, 0x8 - ldrsh r2, [r7, r3] - adds r0, r2, 0 - muls r0, r5 - adds r0, r4 - ldr r6, =gUnknown_0203CEDC - lsls r2, 4 - ldr r1, [r6] - adds r1, r2 - movs r2, 0x1 - bl sub_81B2CD4 - movs r0, 0x8 - ldrsh r2, [r7, r0] - adds r0, r2, 0 - muls r0, r5 - adds r0, r4 - lsls r2, 4 - ldr r1, [r6] - adds r1, r2 - bl sub_81B2E28 - movs r1, 0x6 - ldrsh r0, [r7, r1] - cmp r0, 0 - beq _081B1EDC - movs r2, 0 - ldrsh r1, [r7, r2] - cmp r1, 0 - beq _081B1EDC - movs r3, 0x2 - ldrsh r0, [r7, r3] - cmp r1, r0 - bne _081B1EFE -_081B1EDC: - movs r0, 0 - ldrsh r1, [r7, r0] - movs r2, 0xA - ldrsh r0, [r7, r2] - cmp r1, r0 - ble _081B1EF8 - ldr r0, =gStringVar2 - movs r3, 0xA - ldrsh r2, [r7, r3] - subs r1, r2 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN -_081B1EF8: - mov r0, r8 - bl SwitchTaskToFollowupFunc -_081B1EFE: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1E60 - - thumb_func_start sub_81B1F18 -sub_81B1F18: @ 81B1F18 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - mov r9, r1 - adds r5, r2, 0 - mov r10, r3 - ldr r7, [sp, 0x20] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r0, r9 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r5, 24 - lsrs r5, 24 - mov r0, r10 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - movs r0, 0x64 - mov r6, r9 - muls r6, r0 - ldr r0, =gPlayerParty - adds r6, r0 - mov r0, r8 - lsls r4, r0, 2 - add r4, r8 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - adds r0, r6, 0 - movs r1, 0x39 - bl GetMonData - strh r0, [r4] - adds r0, r6, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r4, 0x2] - lsls r5, 24 - asrs r5, 24 - strh r5, [r4, 0x4] - mov r0, r10 - strh r0, [r4, 0x6] - mov r0, r9 - strh r0, [r4, 0x8] - ldrh r0, [r4] - strh r0, [r4, 0xA] - ldr r1, =sub_81B1E60 - mov r0, r8 - adds r2, r7, 0 - bl SetTaskFuncWithFollowupFunc - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1F18 - - thumb_func_start sub_81B1FA8 -sub_81B1FA8: @ 81B1FA8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r3, r0, r1 - cmp r5, 0x5 - bhi _081B200A - lsls r0, r5, 2 - ldr r1, =_081B1FD4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B1FD4: - .4byte _081B1FEC - .4byte _081B1FF2 - .4byte _081B1FF6 - .4byte _081B1FFA - .4byte _081B1FFE - .4byte _081B2002 -_081B1FEC: - strh r2, [r3] - strh r2, [r3, 0xA] - b _081B200A -_081B1FF2: - strh r2, [r3, 0x2] - b _081B200A -_081B1FF6: - strh r2, [r3, 0x4] - b _081B200A -_081B1FFA: - strh r2, [r3, 0x6] - b _081B200A -_081B1FFE: - strh r2, [r3, 0x8] - b _081B200A -_081B2002: - ldr r1, =sub_81B1E60 - adds r0, r4, 0 - bl SetTaskFuncWithFollowupFunc -_081B200A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1FA8 - - thumb_func_start pokemon_ailments_get_primary -pokemon_ailments_get_primary: @ 81B2014 - push {lr} - adds r1, r0, 0 - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - beq _081B2024 - movs r0, 0x1 - b _081B2056 -_081B2024: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081B2030 - movs r0, 0x2 - b _081B2056 -_081B2030: - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - beq _081B203C - movs r0, 0x3 - b _081B2056 -_081B203C: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _081B2048 - movs r0, 0x4 - b _081B2056 -_081B2048: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081B2054 - movs r0, 0 - b _081B2056 -_081B2054: - movs r0, 0x5 -_081B2056: - pop {r1} - bx r1 - thumb_func_end pokemon_ailments_get_primary - - thumb_func_start sub_81B205C -@ u8 sub_81B205C(struct pokemon *mon, int a2, void *a3) -sub_81B205C: @ 81B205C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _081B206E - movs r0, 0x7 - b _081B2096 -_081B206E: - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - bl pokemon_ailments_get_primary - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _081B2096 - adds r0, r4, 0 - movs r1, 0 - bl CheckPartyPokerus - lsls r0, 24 - cmp r0, 0 - bne _081B2094 - movs r0, 0 - b _081B2096 -_081B2094: - movs r0, 0x6 -_081B2096: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B205C - - thumb_func_start sub_81B209C -sub_81B209C: @ 81B209C - push {r4,r5,lr} - ldr r2, =gUnknown_0203CEC8 - ldrb r1, [r2, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xB - bne _081B2126 - adds r5, r2, 0 - adds r5, 0xE - movs r0, 0 - strh r0, [r2, 0xE] - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r0, 0 - bne _081B20FC - movs r4, 0 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - bcs _081B2126 -_081B20C4: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_81B2134 - lsls r0, 16 - lsrs r0, 16 - lsls r0, r4 - ldrh r1, [r5] - adds r0, r1 - strh r0, [r5] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - bcc _081B20C4 - b _081B2126 - .pool -_081B20FC: - movs r4, 0 - b _081B211E -_081B2100: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_81B2164 - lsls r0, 16 - lsrs r0, 16 - lsls r0, r4 - ldrh r1, [r5] - adds r0, r1 - strh r0, [r5] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_081B211E: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - bcc _081B2100 -_081B2126: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B209C - - thumb_func_start sub_81B2134 -sub_81B2134: @ 81B2134 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0x1 - beq _081B215A - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl sub_802C908 - cmp r0, 0 - beq _081B215A - movs r0, 0x1 - b _081B215C -_081B215A: - movs r0, 0 -_081B215C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B2134 - - thumb_func_start sub_81B2164 -sub_81B2164: @ 81B2164 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0x1 - beq _081B2182 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0x55 - bne _081B2182 - movs r0, 0x1 - b _081B2184 -_081B2182: - movs r0, 0 -_081B2184: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B2164 - - thumb_func_start sub_81B218C -sub_81B218C: @ 81B218C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CEC8 - movs r2, 0xE - ldrsh r1, [r1, r2] - asrs r1, r0 - movs r0, 0x1 - ands r1, r0 - cmp r1, 0 - bne _081B21A4 - movs r0, 0 -_081B21A4: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B218C - - thumb_func_start sub_81B21AC -sub_81B21AC: @ 81B21AC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - adds r0, r5, 0 - bl sub_81B218C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B21DC - movs r0, 0x5 - bl PlaySE - ldr r0, =gSpecialVar_0x8004 - strh r5, [r0] - adds r0, r4, 0 - bl sub_81B12C0 - b _081B21FE - .pool -_081B21DC: - movs r0, 0x20 - bl PlaySE - ldr r0, =gText_PkmnCantParticipate - movs r1, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B21FE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B21AC - - thumb_func_start sub_81B2210 -sub_81B2210: @ 81B2210 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gText_CancelParticipation - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B2248 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2210 - - thumb_func_start sub_81B2248 -sub_81B2248: @ 81B2248 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B226C - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B227C - str r0, [r1] -_081B226C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2248 - - thumb_func_start sub_81B227C -sub_81B227C: @ 81B227C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B22A2 - cmp r1, 0 - bgt _081B229C - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B22B4 - b _081B22C8 -_081B229C: - cmp r1, 0x1 - beq _081B22BA - b _081B22C8 -_081B22A2: - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x7 - strh r0, [r1] - adds r0, r4, 0 - bl sub_81B12C0 - b _081B22C8 - .pool -_081B22B4: - movs r0, 0x5 - bl PlaySE -_081B22BA: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1C1C - str r0, [r1] -_081B22C8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B227C - - thumb_func_start sub_81B22D8 -sub_81B22D8: @ 81B22D8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - adds r7, r4, 0 - lsls r2, 24 - lsrs r6, r2, 24 - mov r8, r6 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - beq _081B22FA - movs r0, 0x3 - b _081B2356 -_081B22FA: - movs r0, 0x90 - lsls r0, 1 - cmp r4, r0 - bls _081B231C - adds r1, r4, 0 - subs r1, 0x21 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl CanMonLearnTMHM - cmp r0, 0 - beq _081B2334 - adds r0, r7, 0 - bl ItemIdToBattleMoveId - b _081B233E -_081B231C: - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl sub_81B2370 - lsls r0, 24 - cmp r0, 0 - bne _081B2338 -_081B2334: - movs r0, 0x1 - b _081B2356 -_081B2338: - mov r0, r8 - bl sub_81B2360 -_081B233E: - lsls r0, 16 - lsrs r1, r0, 16 - adds r0, r5, 0 - bl pokemon_has_move - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B2354 - movs r0, 0 - b _081B2356 -_081B2354: - movs r0, 0x2 -_081B2356: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81B22D8 - - thumb_func_start sub_81B2360 -sub_81B2360: @ 81B2360 - lsls r0, 24 - ldr r1, =gUnknown_0861500C - lsrs r0, 23 - adds r0, r1 - ldrh r0, [r0] - bx lr - .pool - thumb_func_end sub_81B2360 - - thumb_func_start sub_81B2370 -sub_81B2370: @ 81B2370 - push {lr} - lsls r0, 16 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_08615048 - lsrs r0, 14 - adds r0, r2 - movs r2, 0x1 - lsls r2, r1 - ldr r0, [r0] - ands r0, r2 - cmp r0, 0 - bne _081B2394 - movs r0, 0 - b _081B2396 - .pool -_081B2394: - movs r0, 0x1 -_081B2396: - pop {r1} - bx r1 - thumb_func_end sub_81B2370 - - thumb_func_start sub_81B239C -sub_81B239C: @ 81B239C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x1 - beq _081B23C4 - cmp r0, 0x1 - bgt _081B23B2 - cmp r0, 0 - beq _081B23B8 - b _081B23DC -_081B23B2: - cmp r1, 0x2 - beq _081B23D0 - b _081B23DC -_081B23B8: - ldr r0, =gUnknown_08615810 - bl InitWindows - b _081B23E2 - .pool -_081B23C4: - ldr r0, =gUnknown_08615850 - bl InitWindows - b _081B23E2 - .pool -_081B23D0: - ldr r0, =gUnknown_08615890 - bl InitWindows - b _081B23E2 - .pool -_081B23DC: - ldr r0, =gUnknown_086158D0 - bl InitWindows -_081B23E2: - bl DeactivateAllTextPrinters - movs r4, 0 -_081B23E8: - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _081B23E8 - movs r0, 0 - movs r1, 0x4F - movs r2, 0xD0 - bl LoadUserWindowBorderGfx - bl GetOverworldTextboxPalettePtr - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0860F074 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B239C - - thumb_func_start sub_81B2428 -sub_81B2428: @ 81B2428 - push {r4-r6,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x5 - bne _081B243E - b _081B2554 -_081B243E: - cmp r2, 0x1 - bne _081B24B4 - ldr r0, =gUnknown_08615918 - bl AddWindow - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r5, =gMenuText_Confirm - movs r0, 0 - adds r1, r5, 0 - movs r2, 0x30 - bl GetStringCenterAlignXOffset - lsls r0, 24 - lsrs r2, r0, 24 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - ldr r0, =gUnknown_086157FC - str r0, [sp, 0x8] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0xC] - str r5, [sp, 0x10] - adds r0, r4, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, =gUnknown_08615910 - bl AddWindow - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - b _081B24C0 - .pool -_081B24B4: - ldr r0, =gUnknown_08615908 - bl AddWindow - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0x3 -_081B24C0: - adds r0, r5, 0 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xA - beq _081B2514 - ldr r4, =gText_Cancel - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x30 - bl GetStringCenterAlignXOffset - lsls r0, 24 - lsrs r2, r0, 24 - adds r2, r6 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_086157FC - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - b _081B2540 - .pool -_081B2514: - ldr r4, =gText_Cancel2 - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x30 - bl GetStringCenterAlignXOffset - lsls r0, 24 - lsrs r2, r0, 24 - adds r2, r6 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_086157FC - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 -_081B2540: - adds r0, r5, 0 - bl PutWindowTilemap - adds r0, r5, 0 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram -_081B2554: - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2428 - - thumb_func_start sub_81B2564 -sub_81B2564: @ 81B2564 - lsls r0, 24 - ldr r1, =gUnknown_0203CEC4 - lsrs r0, 23 - adds r0, 0x18 - ldr r1, [r1] - adds r1, r0 - adds r0, r1, 0 - bx lr - .pool - thumb_func_end sub_81B2564 - - thumb_func_start sub_81B2578 -sub_81B2578: @ 81B2578 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - str r1, [sp, 0xC] - ldr r1, [sp, 0x4C] - ldr r4, [sp, 0x50] - ldr r5, [sp, 0x54] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x10] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x14] - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x18] - lsls r4, 24 - lsrs r6, r4, 24 - lsls r5, 24 - lsrs r5, 24 - mov r10, r5 - mov r0, r10 - muls r0, r6 - lsls r0, 5 - bl AllocZeroed - mov r9, r0 - cmp r0, 0 - beq _081B2646 - movs r5, 0 - ldr r0, [sp, 0x14] - lsls r0, 19 - str r0, [sp, 0x1C] - ldr r1, [sp, 0x18] - lsls r1, 19 - str r1, [sp, 0x20] - lsls r2, r6, 19 - str r2, [sp, 0x24] - mov r0, r10 - lsls r0, 19 - str r0, [sp, 0x28] - cmp r5, r10 - bcs _081B2624 -_081B25DA: - movs r4, 0 - adds r1, r5, 0x1 - mov r8, r1 - cmp r4, r6 - bcs _081B261A - ldr r2, [sp, 0x18] - adds r0, r2, r5 - ldr r2, [sp, 0x10] - adds r1, r0, 0 - muls r1, r2 - adds r7, r1, 0 -_081B25F0: - ldr r1, [sp, 0x14] - adds r0, r1, r4 - adds r0, r7 - ldr r2, [sp, 0xC] - adds r0, r2, r0 - ldrb r0, [r0] - bl sub_81B0DD4 - adds r1, r5, 0 - muls r1, r6 - adds r1, r4 - lsls r1, 5 - add r1, r9 - movs r2, 0x10 - bl CpuSet - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _081B25F0 -_081B261A: - mov r1, r8 - lsls r0, r1, 24 - lsrs r5, r0, 24 - cmp r5, r10 - bcc _081B25DA -_081B2624: - ldr r0, [sp, 0x1C] - lsrs r2, r0, 16 - ldr r1, [sp, 0x20] - lsrs r3, r1, 16 - ldr r1, [sp, 0x24] - lsrs r0, r1, 16 - str r0, [sp] - ldr r1, [sp, 0x28] - lsrs r0, r1, 16 - str r0, [sp, 0x4] - ldr r0, [sp, 0x8] - mov r1, r9 - bl BlitBitmapToWindow - mov r0, r9 - bl Free -_081B2646: - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2578 - - thumb_func_start sub_81B2658 -sub_81B2658: @ 81B2658 - push {r4-r6,lr} - sub sp, 0xC - ldr r4, [sp, 0x1C] - ldr r5, [sp, 0x20] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r6, r1, 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 - cmp r3, 0 - bne _081B2684 - cmp r4, 0 - bne _081B2684 - movs r3, 0xA - movs r4, 0x7 -_081B2684: - cmp r5, 0 - bne _081B26A0 - ldr r1, =gUnknown_08615988 - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - movs r2, 0xA - adds r3, r6, 0 - bl sub_81B2578 - b _081B26B0 - .pool -_081B26A0: - ldr r1, =gUnknown_086159CE - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - movs r2, 0xA - adds r3, r6, 0 - bl sub_81B2578 -_081B26B0: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2658 - - thumb_func_start sub_81B26BC -sub_81B26BC: @ 81B26BC - push {r4-r6,lr} - sub sp, 0xC - ldr r4, [sp, 0x1C] - ldr r5, [sp, 0x20] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r6, r1, 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 - cmp r3, 0 - bne _081B26E8 - cmp r4, 0 - bne _081B26E8 - movs r3, 0x12 - movs r4, 0x3 -_081B26E8: - cmp r5, 0 - bne _081B2704 - ldr r1, =gUnknown_08615A14 - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - movs r2, 0x12 - adds r3, r6, 0 - bl sub_81B2578 - b _081B2714 - .pool -_081B2704: - ldr r1, =gUnknown_08615A4A - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - movs r2, 0x12 - adds r3, r6, 0 - bl sub_81B2578 -_081B2714: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B26BC - - thumb_func_start sub_81B2720 -sub_81B2720: @ 81B2720 - push {lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_08615A80 - movs r2, 0 - str r2, [sp] - movs r2, 0x12 - str r2, [sp, 0x4] - movs r2, 0x3 - str r2, [sp, 0x8] - movs r2, 0x12 - movs r3, 0 - bl sub_81B2578 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2720 - - thumb_func_start sub_81B2748 -sub_81B2748: @ 81B2748 - push {r4-r7,lr} - lsls r1, 24 - lsrs r4, r1, 24 - adds r5, r4, 0 - ldrb r0, [r0, 0x8] - movs r1, 0x5 - bl GetWindowAttribute - lsls r0, 28 - lsrs r6, r0, 24 - adds r7, r6, 0 - movs r0, 0x40 - ands r0, r4 - cmp r0, 0 - beq _081B277C - ldr r5, =gUnknown_08615AF1 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AC0 - b _081B297E - .pool -_081B277C: - movs r0, 0x20 - ands r0, r4 - cmp r0, 0 - beq _081B27D8 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081B2794 - ldr r5, =gUnknown_08615ADF - b _081B2942 - .pool -_081B2794: - ldr r5, =gUnknown_08615ADF - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AEE - b _081B2976 - .pool -_081B27D8: - movs r0, 0x10 - ands r0, r4 - cmp r0, 0 - beq _081B2824 - ldr r5, =gUnknown_08615ADF - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AEE - b _081B2976 - .pool -_081B2824: - movs r0, 0x4 - ands r0, r4 - cmp r0, 0 - beq _081B2880 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081B283C - ldr r5, =gUnknown_08615ADF - b _081B2942 - .pool -_081B283C: - ldr r5, =gUnknown_08615ADF - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AEE - b _081B2976 - .pool -_081B2880: - movs r0, 0x2 - ands r0, r4 - cmp r0, 0 - beq _081B28DC - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081B2898 - ldr r5, =gUnknown_08615ADC - b _081B2942 - .pool -_081B2898: - ldr r5, =gUnknown_08615AD3 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AE8 - b _081B2976 - .pool -_081B28DC: - movs r0, 0x8 - ands r0, r4 - cmp r0, 0 - beq _081B2938 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081B28F4 - ldr r5, =gUnknown_08615AD9 - b _081B2942 - .pool -_081B28F4: - ldr r5, =gUnknown_08615AD0 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AE5 - b _081B2976 - .pool -_081B2938: - movs r0, 0x1 - ands r5, r0 - cmp r5, 0 - beq _081B29BC - ldr r5, =gUnknown_08615AD6 -_081B2942: - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AEB -_081B2976: - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABD -_081B297E: - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - b _081B2A24 - .pool -_081B29BC: - ldr r5, =gUnknown_08615ACD - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AE2 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABD - ldrb r1, [r4] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette -_081B2A24: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2748 - - thumb_func_start sub_81B2A3C -sub_81B2A3C: @ 81B2A3C - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - lsls r2, 24 - lsrs r2, 24 - ldrb r5, [r3] - ldrb r3, [r3, 0x1] - lsls r4, r2, 1 - adds r4, r2 - ldr r2, =gUnknown_086157FC - adds r4, r2 - str r4, [sp] - movs r2, 0 - str r2, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0 - adds r2, r5, 0 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2A3C - - thumb_func_start sub_81B2A70 -sub_81B2A70: @ 81B2A70 - push {r4-r7,lr} - sub sp, 0x14 - adds r7, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2AC0 - cmp r4, 0x1 - bne _081B2AAA - ldr r5, [r6] - ldrb r0, [r6, 0x8] - ldrb r1, [r5, 0x4] - lsrs r1, 3 - ldrb r2, [r5, 0x5] - lsrs r2, 3 - ldrb r3, [r5, 0x6] - lsrs r3, 3 - ldrb r4, [r5, 0x7] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2AAA: - adds r0, r7, 0 - add r1, sp, 0x8 - bl GetMonNickname - ldrb r0, [r6, 0x8] - ldr r3, [r6] - adds r3, 0x4 - add r1, sp, 0x8 - movs r2, 0 - bl sub_81B2A3C -_081B2AC0: - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2A70 - - thumb_func_start sub_81B2AC8 -sub_81B2AC8: @ 81B2AC8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r6, r0, 0 - adds r7, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - mov r8, r4 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2B34 - adds r0, r6, 0 - bl sub_81B205C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081B2AF6 - cmp r0, 0x6 - bne _081B2B34 -_081B2AF6: - cmp r4, 0 - beq _081B2B1C - ldr r5, [r7] - ldrb r0, [r7, 0x8] - ldrb r1, [r5, 0x8] - lsrs r1, 3 - ldrb r2, [r5, 0x9] - lsrs r2, 3 - adds r2, 0x1 - ldrb r3, [r5, 0xA] - lsrs r3, 3 - ldrb r4, [r5, 0xB] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2B1C: - mov r0, r8 - cmp r0, 0x2 - beq _081B2B34 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - adds r1, r7, 0 - bl sub_81B2B40 -_081B2B34: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2AC8 - - thumb_func_start sub_81B2B40 -sub_81B2B40: @ 81B2B40 - push {r4-r6,lr} - adds r2, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r2, 24 - ldr r5, =gStringVar2 - adds r0, r5, 0 - adds r1, r2, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar1 - ldr r1, =gText_LevelSymbol - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - adds r1, r5, 0 - bl StringAppend - ldrb r0, [r6, 0x8] - ldr r3, [r6] - adds r3, 0x8 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B2A3C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2B40 - - thumb_func_start sub_81B2B8C -sub_81B2B8C: @ 81B2B8C - push {r4-r7,lr} - sub sp, 0x14 - adds r6, r0, 0 - adds r7, r1, 0 - lsls r2, 24 - lsrs r2, 24 - cmp r2, 0x1 - bne _081B2BBE - ldr r5, [r7] - ldrb r0, [r7, 0x8] - ldrb r1, [r5, 0xC] - lsrs r1, 3 - ldrb r2, [r5, 0xD] - lsrs r2, 3 - adds r2, 0x1 - ldrb r3, [r5, 0xE] - lsrs r3, 3 - ldrb r4, [r5, 0xF] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2BBE: - adds r0, r6, 0 - add r1, sp, 0x8 - bl GetMonNickname - adds r0, r6, 0 - bl GetMonGender - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - add r2, sp, 0x8 - adds r3, r7, 0 - bl sub_81B2BF4 - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2B8C - - thumb_func_start sub_81B2BF4 -sub_81B2BF4: @ 81B2BF4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r9, r2 - adds r7, r3, 0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, 16 - lsrs r4, r1, 16 - adds r5, r4, 0 - ldrb r0, [r7, 0x8] - movs r1, 0x5 - bl GetWindowAttribute - lsls r0, 28 - lsrs r6, r0, 24 - cmp r4, 0 - beq _081B2CBA - cmp r4, 0x20 - beq _081B2C24 - cmp r4, 0x1D - bne _081B2C38 -_081B2C24: - movs r0, 0xB - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - mov r0, r9 - bl StringCompare - cmp r0, 0 - beq _081B2CBA -_081B2C38: - mov r0, r8 - cmp r0, 0 - beq _081B2C48 - cmp r0, 0xFE - beq _081B2C88 - b _081B2CBA - .pool -_081B2C48: - ldr r5, =gUnknown_08615AC3 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AB6 - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r7, 0x8] - ldr r1, =gText_MaleSymbol - ldr r3, [r7] - adds r3, 0xC - movs r2, 0x2 - bl sub_81B2A3C - b _081B2CBA - .pool -_081B2C88: - ldr r5, =gUnknown_08615AC5 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AB6 - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r7, 0x8] - ldr r1, =gText_FemaleSymbol - ldr r3, [r7] - adds r3, 0xC - movs r2, 0x2 - bl sub_81B2A3C -_081B2CBA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2BF4 - - thumb_func_start sub_81B2CD4 -sub_81B2CD4: @ 81B2CD4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r7, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - mov r8, r4 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2D2E - cmp r4, 0 - beq _081B2D16 - ldr r5, [r6] - ldrb r0, [r6, 0x8] - ldrb r1, [r5, 0x10] - lsrs r1, 3 - ldrb r2, [r5, 0x11] - lsrs r2, 3 - adds r2, 0x1 - ldrb r3, [r5, 0x12] - lsrs r3, 3 - ldrb r4, [r5, 0x13] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2D16: - mov r0, r8 - cmp r0, 0x2 - beq _081B2D2E - adds r0, r7, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl sub_81B2D3C -_081B2D2E: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2CD4 - - thumb_func_start sub_81B2D3C -sub_81B2D3C: @ 81B2D3C - push {r4,r5,lr} - adds r2, r0, 0 - adds r4, r1, 0 - lsls r2, 16 - lsrs r2, 16 - ldr r5, =gStringVar1 - adds r0, r5, 0 - adds r1, r2, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - movs r1, 0xBA - strb r1, [r0] - movs r1, 0xFF - strb r1, [r0, 0x1] - ldrb r0, [r4, 0x8] - ldr r3, [r4] - adds r3, 0x10 - adds r1, r5, 0 - movs r2, 0 - bl sub_81B2A3C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2D3C - - thumb_func_start sub_81B2D74 -sub_81B2D74: @ 81B2D74 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r7, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - mov r8, r4 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2DD0 - cmp r4, 0 - beq _081B2DB8 - ldr r5, [r6] - ldrb r0, [r6, 0x8] - ldrb r1, [r5, 0x14] - lsrs r1, 3 - adds r1, 0x1 - ldrb r2, [r5, 0x15] - lsrs r2, 3 - adds r2, 0x1 - ldrb r3, [r5, 0x16] - lsrs r3, 3 - ldrb r4, [r5, 0x17] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2DB8: - mov r0, r8 - cmp r0, 0x2 - beq _081B2DD0 - adds r0, r7, 0 - movs r1, 0x3A - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl sub_81B2DDC -_081B2DD0: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2D74 - - thumb_func_start sub_81B2DDC -sub_81B2DDC: @ 81B2DDC - push {r4-r6,lr} - adds r2, r0, 0 - adds r6, r1, 0 - lsls r2, 16 - lsrs r2, 16 - ldr r5, =gStringVar2 - adds r0, r5, 0 - adds r1, r2, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar1 - ldr r1, =gText_Slash - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - adds r1, r5, 0 - bl StringAppend - ldrb r0, [r6, 0x8] - ldr r3, [r6] - adds r3, 0x14 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B2A3C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2DDC - - thumb_func_start sub_81B2E28 -sub_81B2E28: @ 81B2E28 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2E5C - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - adds r2, r6, 0 - bl sub_81B2E64 -_081B2E5C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B2E28 - - thumb_func_start sub_81B2E64 -sub_81B2E64: @ 81B2E64 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - adds r6, r2, 0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - ldrb r0, [r6, 0x8] - movs r1, 0x5 - bl GetWindowAttribute - lsls r0, 28 - lsrs r7, r0, 24 - mov r1, r8 - lsls r0, r1, 16 - asrs r0, 16 - mov r2, r9 - lsls r1, r2, 16 - asrs r1, 16 - bl GetHPBarLevel - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _081B2EB0 - cmp r0, 0x2 - blt _081B2EE0 - cmp r0, 0x4 - bgt _081B2EE0 - ldr r5, =gUnknown_08615AC7 - b _081B2EB2 - .pool -_081B2EB0: - ldr r5, =gUnknown_08615AC9 -_081B2EB2: - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AB8 - ldrb r1, [r4] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - b _081B2F04 - .pool -_081B2EE0: - ldr r5, =gUnknown_08615ACB - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AB8 - ldrb r1, [r4] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette -_081B2F04: - mov r1, r8 - lsls r0, r1, 16 - asrs r0, 16 - mov r2, r9 - lsls r1, r2, 16 - asrs r1, 16 - ldr r2, [r6] - ldrb r2, [r2, 0x1A] - bl GetScaledHPFraction - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r0, [r6, 0x8] - ldr r4, =gUnknown_08615AB8 - ldrb r1, [r4, 0x1] - ldr r3, [r6] - ldrb r2, [r3, 0x18] - ldrb r3, [r3, 0x19] - str r5, [sp] - movs r7, 0x1 - str r7, [sp, 0x4] - bl FillWindowPixelRect - ldrb r0, [r6, 0x8] - ldrb r1, [r4] - ldr r3, [r6] - ldrb r2, [r3, 0x18] - ldrb r3, [r3, 0x19] - adds r3, 0x1 - str r5, [sp] - movs r4, 0x2 - str r4, [sp, 0x4] - bl FillWindowPixelRect - ldr r1, [r6] - ldrb r0, [r1, 0x1A] - cmp r5, r0 - beq _081B2F88 - ldrb r0, [r6, 0x8] - ldrb r2, [r1, 0x18] - adds r2, r5 - ldrb r3, [r1, 0x19] - ldrb r1, [r1, 0x1A] - subs r1, r5 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - str r7, [sp, 0x4] - movs r1, 0xD - bl FillWindowPixelRect - ldrb r0, [r6, 0x8] - ldr r1, [r6] - ldrb r2, [r1, 0x18] - adds r2, r5 - ldrb r3, [r1, 0x19] - adds r3, 0x1 - ldrb r1, [r1, 0x1A] - subs r1, r5 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - str r4, [sp, 0x4] - movs r1, 0x2 - bl FillWindowPixelRect -_081B2F88: - ldrb r0, [r6, 0x8] - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2E64 - - thumb_func_start sub_81B2FA8 -sub_81B2FA8: @ 81B2FA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r6, r1, 0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r2, 24 - lsrs r7, r2, 24 - cmp r7, 0 - beq _081B2FF2 - ldr r5, [r6] - ldrb r1, [r5, 0x1C] - movs r4, 0x7 - adds r0, r1, 0 - ands r0, r4 - ldrb r2, [r5, 0x1E] - adds r0, r2 - adds r3, r0, 0x7 - asrs r3, 3 - ldrb r2, [r5, 0x1D] - adds r0, r2, 0 - ands r0, r4 - ldrb r4, [r5, 0x1F] - adds r0, r4 - adds r4, r0, 0x7 - ldrb r0, [r6, 0x8] - lsrs r1, 3 - lsrs r2, 3 - lsrs r4, 3 - str r4, [sp] - movs r4, 0x1 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2FF2: - cmp r7, 0x2 - beq _081B3018 - ldrb r0, [r6, 0x8] - ldr r1, [r6] - ldrb r2, [r1, 0x1C] - ldrb r3, [r1, 0x1D] - ldr r1, =gUnknown_086157FC - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r4, =gUnknown_08615B60 - mov r5, r8 - lsls r1, r5, 2 - adds r1, r4 - ldr r1, [r1] - str r1, [sp, 0x8] - movs r1, 0x1 - bl AddTextPrinterParameterized3 -_081B3018: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2FA8 - - thumb_func_start sub_81B302C -sub_81B302C: @ 81B302C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _081B304C - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram -_081B304C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B302C - - thumb_func_start display_pokemon_menu_message -display_pokemon_menu_message: @ 81B3054 - push {r4-r6,lr} - sub sp, 0xC - adds r6, r0, 0 - ldr r0, =gUnknown_0203CEC4 - ldr r4, [r0] - adds r5, r4, 0 - adds r5, 0xD - ldrb r0, [r4, 0xD] - cmp r0, 0xFF - beq _081B306E - adds r0, r5, 0 - bl sub_81B302C -_081B306E: - cmp r6, 0x7F - beq _081B313C - adds r0, r6, 0 - subs r0, 0x15 - cmp r0, 0x5 - bhi _081B30D4 - lsls r0, 2 - ldr r1, =_081B308C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B308C: - .4byte _081B30A4 - .4byte _081B30BC - .4byte _081B30BC - .4byte _081B30AC - .4byte _081B30B4 - .4byte _081B30C4 -_081B30A4: - ldr r0, =gUnknown_08615928 - b _081B30C6 - .pool -_081B30AC: - ldr r0, =gUnknown_08615930 - b _081B30C6 - .pool -_081B30B4: - ldr r0, =gUnknown_08615938 - b _081B30C6 - .pool -_081B30BC: - ldr r0, =gUnknown_08615940 - b _081B30C6 - .pool -_081B30C4: - ldr r0, =gUnknown_08615948 -_081B30C6: - bl AddWindow - strb r0, [r5] - b _081B30DC - .pool -_081B30D4: - ldr r0, =gUnknown_08615920 - bl AddWindow - strb r0, [r4, 0xD] -_081B30DC: - cmp r6, 0 - bne _081B3104 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B30F8 - movs r6, 0x2 - b _081B3104 - .pool -_081B30F8: - bl sub_81B314C - lsls r0, 24 - cmp r0, 0 - bne _081B3104 - movs r6, 0x1 -_081B3104: - ldrb r0, [r5] - movs r1, 0 - movs r2, 0x4F - movs r3, 0xD - bl SetWindowBorderStyle - ldr r4, =gStringVar4 - ldr r1, =gUnknown_08615AF4 - lsls r0, r6, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringExpandPlaceholders - ldrb r0, [r5] - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram -_081B313C: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end display_pokemon_menu_message - - thumb_func_start sub_81B314C -sub_81B314C: @ 81B314C - push {r4-r7,lr} - ldr r7, =gPlayerParty - movs r6, 0 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0x1 - bne _081B3168 -_081B315A: - movs r0, 0x1 - b _081B31AA - .pool -_081B3168: - movs r5, 0 -_081B316A: - movs r0, 0x64 - muls r0, r5 - adds r4, r7, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B319A - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _081B3194 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - beq _081B319A -_081B3194: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_081B319A: - cmp r6, 0x1 - bhi _081B315A - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _081B316A - movs r0, 0 -_081B31AA: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81B314C - thumb_func_start sub_81B31B0 sub_81B31B0: @ 81B31B0 push {r4-r7,lr} diff --git a/include/party_menu.h b/include/party_menu.h index f2615dac5..30a86e162 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -12,7 +12,8 @@ enum AILMENT_SLP, AILMENT_FRZ, AILMENT_BRN, - AILMENT_FNT = 7 + AILMENT_PKRS, + AILMENT_FNT }; enum @@ -35,12 +36,12 @@ struct Struct203CEC8 { s8 unkA; u8 unkB; u8 unkD; - u8 unkE; + s16 unkE; }; extern struct Struct203CEC8 gUnknown_0203CEC8; -extern const u16 gUnknown_0861500C[]; +extern const u16 gUnknown_0861500C[]; // tutor table bool8 pokemon_has_move(struct Pokemon *, u16); void sub_81B58A8(void); diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index b6ca0e248..1aa663bc7 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -11,5 +11,6 @@ void sub_8018438(void); u16 mevent_081445C0(u8); void sub_801B990(u32, u32); u8 sub_8013F78(void); +bool32 sub_802C908(u16); #endif //GUARD_rom_8011DC0_H diff --git a/include/strings.h b/include/strings.h index 31b8f399d..d8b1f4f7c 100644 --- a/include/strings.h +++ b/include/strings.h @@ -370,6 +370,12 @@ extern const u8 gText_ThreeDashes[]; extern const u8 gText_PkmnHPRestoredByVar2[]; extern const u8 gText_CantBeUsedOnPkmn[]; extern const u8 gText_CancelParticipation[]; +extern const u8 gText_PkmnWasGivenItem[]; +extern const u8 gText_RecievedItemFromPkmn[]; +extern const u8 gText_SwitchPkmnItem[]; +extern const u8 gText_SwitchedPkmnItem[]; +extern const u8 gText_BagFullCouldNotRemoveItem[]; +extern const u8 gText_PkmnCantParticipate[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/src/party_menu.c b/src/party_menu.c index 07519d648..1f419f6bb 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1,19 +1,25 @@ #include "global.h" #include "battle.h" +#include "battle_interface.h" #include "bg.h" +#include "constants/battle.h" +#include "constants/items.h" #include "constants/rgb.h" #include "constants/songs.h" #include "constants/species.h" #include "contest.h" +#include "data2.h" #include "decompress.h" #include "event_data.h" #include "fldeff_softboiled.h" #include "gpu_regs.h" #include "graphics.h" #include "international_string_util.h" +#include "item.h" #include "item_menu.h" #include "item_use.h" #include "main.h" +#include "mail.h" #include "malloc.h" #include "menu.h" #include "menu_helpers.h" @@ -21,6 +27,7 @@ #include "party_menu.h" #include "pokemon.h" #include "pokemon_icon.h" +#include "rom_8011DC0.h" #include "scanline_effect.h" #include "sound.h" #include "sprite.h" @@ -28,11 +35,16 @@ #include "strings.h" #include "task.h" #include "text.h" +#include "text_window.h" #include "window.h" struct Unk_Rodata1 { void (*unk0)(u8, u8, u8, u8, u8, u8); - u32 unk4[7]; + u8 unk4[24]; + u8 unk1C; + u8 unk1D; + u8 unk1E; + u8 unk1F; }; struct Unk_203CEC4 { @@ -52,7 +64,7 @@ struct Unk_203CEC4 { struct Unk_203CEDC { struct Unk_Rodata1 *unk0; - u32 *unk4; + u8 *unk4; u8 unk8; u8 unk9; u8 unkA; @@ -78,12 +90,57 @@ extern u8 gUnknown_0203CEF8[]; // BELOW TO BE CONVERTED TO C +extern u32 gUnknown_08615048[]; // tutor compatibility table extern struct BgTemplate gUnknown_086156B8[]; extern struct Unk_Rodata1 gUnknown_086156C4[2]; // extern struct Unk_Rodata1 gUnknown_086156E4; -extern u32 gUnknown_08615704[][6][2]; +extern u8 gUnknown_08615704[][6][8]; extern u8 gUnknown_086157C4[]; extern u8 gUnknown_086157E0[]; +extern const u8 gUnknown_086157FC[][3]; +extern struct WindowTemplate gUnknown_08615810[]; +extern struct WindowTemplate gUnknown_08615850[]; +extern struct WindowTemplate gUnknown_086158D0[]; +extern struct WindowTemplate gUnknown_08615890[]; +extern struct WindowTemplate gUnknown_08615908; +extern struct WindowTemplate gUnknown_08615910; +extern struct WindowTemplate gUnknown_08615918; +extern struct WindowTemplate gUnknown_08615920; +extern struct WindowTemplate gUnknown_08615928; +extern struct WindowTemplate gUnknown_08615930; +extern struct WindowTemplate gUnknown_08615938; +extern struct WindowTemplate gUnknown_08615940; +extern struct WindowTemplate gUnknown_08615948; +extern u8 gUnknown_08615988[]; +extern u8 gUnknown_086159CE[]; +extern u8 gUnknown_08615A14[]; +extern u8 gUnknown_08615A4A[]; +extern u8 gUnknown_08615A80[]; +extern u8 gUnknown_08615AB6[]; +extern u8 gUnknown_08615AB8[]; +extern u8 gUnknown_08615ABA[]; +extern u8 gUnknown_08615ABD[]; +extern u8 gUnknown_08615AC0[]; +extern u8 gUnknown_08615AC3[]; +extern u8 gUnknown_08615AC5[]; +extern u8 gUnknown_08615AC7[]; +extern u8 gUnknown_08615AC9[]; +extern u8 gUnknown_08615ACB[]; +extern u8 gUnknown_08615ACD[]; +extern u8 gUnknown_08615AD0[]; +extern u8 gUnknown_08615AD3[]; +extern u8 gUnknown_08615AD6[]; +extern u8 gUnknown_08615AD9[]; +extern u8 gUnknown_08615ADC[]; +extern u8 gUnknown_08615ADF[]; +extern u8 gUnknown_08615AE2[]; +extern u8 gUnknown_08615AE5[]; +extern u8 gUnknown_08615AE8[]; +extern u8 gUnknown_08615AEB[]; +extern u8 gUnknown_08615AEE[]; +extern u8 gUnknown_08615AF1[]; +extern const u8 *gUnknown_08615AF4[]; +extern const u8 *gUnknown_08615B60[]; // ABOVE TO BE CONVERTED TO C @@ -132,7 +189,7 @@ bool8 sub_81B85AC(struct Pokemon *); bool8 sub_81B218C(u8); void sub_81B0C94(u8, u16, u8); u8 sub_81B22D8(struct Pokemon *, u16, u8); -void sub_81B2A3C(u8, u8*, u8, u32*); +void sub_81B2A3C(u8, const u8*, u8, u8*); void sub_81B2B40(u8, struct Unk_203CEDC *); void sub_81B2BF4(u8, u16, u8*, struct Unk_203CEDC *); void sub_81B2D3C(u16, struct Unk_203CEDC *); @@ -182,7 +239,21 @@ void sub_81B1708(u8); bool8 sub_81B1BD4(void); void sub_81B1C1C(u8); void sub_81B8558(void); -void sub_81B17F8(s8*); +void sub_81B17F8(s8*, s8); +void sub_81B1854(s8*, s8); +void sub_81B195C(s8*, s8); +s8 sub_81B1B00(s8, s8); +void sub_81B3300(const u8*); +void sub_81B1B8C(u8); +void sub_81B2CD4(struct Pokemon*, struct Unk_203CEDC*, u8); +void sub_81B2E28(struct Pokemon*, struct Unk_203CEDC*); +bool16 sub_81B2134(struct Pokemon*); +bool16 sub_81B2164(struct Pokemon*); +void sub_81B2248(u8); +void sub_81B227C(u8); +bool8 sub_81B2370(u16, u8); +u16 sub_81B2360(u8); +bool8 sub_81B314C(void); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -642,7 +713,7 @@ void sub_81B0B08(u8 slot) void sub_81B0B60(u8 slot) { - if (!GetNumberOfRelearnableMoves(&gPlayerParty[slot])) + if (GetNumberOfRelearnableMoves(&gPlayerParty[slot]) == 0) sub_81B0A10(slot, 9); else sub_81B0A10(slot, 8); @@ -1139,7 +1210,7 @@ void sub_81B1708(u8 taskId) } } -/* u16 sub_81B1760(s8* ptr) +u16 sub_81B1760(s8 *ptr) { s8 r1; @@ -1175,9 +1246,9 @@ void sub_81B1708(u8 taskId) if (gMain.newKeys & START_BUTTON) return 8; - if ((s8)r1) + if (r1) { - sub_81B17F8(ptr); + sub_81B17F8(ptr, r1); return 0; } @@ -1185,4 +1256,1530 @@ void sub_81B1708(u8 taskId) return 2; return gMain.newKeys & (A_BUTTON | B_BUTTON); -} */ +} + +#ifdef NONMATCHING +void sub_81B17F8(s8 *ptr, s8 b) +{ + s8 slot = *ptr; + + if (!gUnknown_0203CEC8.unk8_1) + sub_81B1854(ptr, b); + else + sub_81B195C(ptr, b); + + if (*ptr != slot) + { + PlaySE(SE_SELECT); + sub_81B0FCC(slot, 0); + sub_81B0FCC(*ptr, 1); + } +} +#else +NAKED +void sub_81B17F8(s8 *ptr, s8 b) +{ + asm_unified("push {r4,r5,lr}\n\ + adds r5, r0, 0\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + ldrb r4, [r5]\n\ + ldr r0, =gUnknown_0203CEC8\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 26\n\ + lsrs r0, 30\n\ + cmp r0, 0\n\ + bne _081B1820\n\ + lsls r1, 24\n\ + asrs r1, 24\n\ + adds r0, r5, 0\n\ + bl sub_81B1854\n\ + b _081B182A\n\ + .pool\n\ +_081B1820:\n\ + lsls r1, 24\n\ + asrs r1, 24\n\ + adds r0, r5, 0\n\ + bl sub_81B195C\n\ +_081B182A:\n\ + movs r1, 0\n\ + ldrsb r1, [r5, r1]\n\ + lsls r4, 24\n\ + asrs r0, r4, 24\n\ + cmp r1, r0\n\ + beq _081B184C\n\ + movs r0, 0x5\n\ + bl PlaySE\n\ + lsrs r0, r4, 24\n\ + movs r1, 0\n\ + bl sub_81B0FCC\n\ + ldrb r0, [r5]\n\ + movs r1, 0x1\n\ + bl sub_81B0FCC\n\ +_081B184C:\n\ + pop {r4,r5}\n\ + pop {r0}\n\ + bx r0\n"); +} +#endif + +#ifdef NONMATCHING +void sub_81B1854(s8 *ptr, s8 b) +{ + u8 r0r2; + + switch (b) + { + case -1: + r0r2 = *ptr; + if (*ptr == 0) + { + *ptr = 7; + } + else if (*ptr == 6) + { + *ptr = gPlayerPartyCount - 1; + } + else if (*ptr == 7) + { + if (gUnknown_0203CEC4->unk8_0) + *ptr = 6; + else + *ptr = gPlayerPartyCount - 1; + } + else + { + *ptr = r0r2 - 1; + } + break; + case 1: + r0r2 = *ptr; + if (*ptr != 7) + { + if ((u32)*ptr == gPlayerPartyCount - 1) + { + if (gUnknown_0203CEC4->unk8_0) + *ptr = 6; + else + *ptr = 7; + } + else + { + *ptr = r0r2 + 1; + } + } + else + { + *ptr = 0; + } + break; + case 2: + if (gPlayerPartyCount != 1 && *ptr == 0) + { + if (gUnknown_0203CEC4->unk8_1 == 0) + *ptr = 1; + else + *ptr = gUnknown_0203CEC4->unk8_1; + } + break; + case -2: + if (*ptr != 0 && *ptr != 6 && *ptr != 7) + { + gUnknown_0203CEC4->unk8_1 = *ptr; + *ptr = 0; + } + break; + } +} +#else +NAKED +void sub_81B1854(s8 *ptr, s8 b) +{ + asm_unified("push {r4,lr}\n\ + adds r4, r0, 0\n\ + lsls r1, 24\n\ + asrs r1, 24\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + cmp r1, r0\n\ + beq _081B187A\n\ + cmp r1, r0\n\ + bgt _081B1870\n\ + subs r0, 0x1\n\ + cmp r1, r0\n\ + beq _081B1924\n\ + b _081B1952\n\ +_081B1870:\n\ + cmp r1, 0x1\n\ + beq _081B18C0\n\ + cmp r1, 0x2\n\ + beq _081B18F8\n\ + b _081B1952\n\ +_081B187A:\n\ + ldrb r0, [r4]\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + cmp r1, 0\n\ + bne _081B1888\n\ + movs r0, 0x7\n\ + b _081B1950\n\ +_081B1888:\n\ + cmp r1, 0x6\n\ + bne _081B1898\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + subs r0, 0x1\n\ + b _081B1950\n\ + .pool\n\ +_081B1898:\n\ + cmp r1, 0x7\n\ + bne _081B18BC\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081B18B0\n\ + movs r0, 0x6\n\ + b _081B1950\n\ + .pool\n\ +_081B18B0:\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + subs r0, 0x1\n\ + b _081B1950\n\ + .pool\n\ +_081B18BC:\n\ + subs r0, 0x1\n\ + b _081B1950\n\ +_081B18C0:\n\ + ldrb r2, [r4]\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0x7\n\ + beq _081B194E\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + subs r0, 0x1\n\ + cmp r1, r0\n\ + bne _081B18F4\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081B18F0\n\ + movs r0, 0x6\n\ + b _081B1950\n\ + .pool\n\ +_081B18F0:\n\ + movs r0, 0x7\n\ + b _081B1950\n\ +_081B18F4:\n\ + adds r0, r2, 0x1\n\ + b _081B1950\n\ +_081B18F8:\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + cmp r0, 0x1\n\ + beq _081B1952\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0\n\ + bne _081B1952\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 28\n\ + lsrs r0, 29\n\ + cmp r0, 0\n\ + bne _081B1950\n\ + movs r0, 0x1\n\ + b _081B1950\n\ + .pool\n\ +_081B1924:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0\n\ + beq _081B1952\n\ + cmp r0, 0x6\n\ + beq _081B1952\n\ + cmp r0, 0x7\n\ + beq _081B1952\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r3, [r0]\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + movs r0, 0x7\n\ + ands r1, r0\n\ + lsls r1, 1\n\ + ldrb r2, [r3, 0x8]\n\ + movs r0, 0xF\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3, 0x8]\n\ +_081B194E:\n\ + movs r0, 0\n\ +_081B1950:\n\ + strb r0, [r4]\n\ +_081B1952:\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n"); +} +#endif + +#ifdef NONMATCHING +void sub_81B195C(s8 *ptr, s8 b) +{ + u8 unk; + s8 unk2 = b; + u8 unk3; + + switch (b) + { + case -1: + unk = *ptr; + if (*ptr == 0) + { + *ptr = 7; + } + else if (*ptr == 6) + { + *ptr = gPlayerPartyCount - 1; + } + else if (*ptr == 7) + { + if (gUnknown_0203CEC4->unk8_0) + { + *ptr = 6; + } + else + { + *ptr = unk - 1; + unk2 = sub_81B1B00(*ptr, unk2); + if (unk2 != -1) + *ptr = unk2; + } + } + else + { + unk2 = sub_81B1B00(*ptr, unk2); + if (unk2 != -1) + *ptr = unk2; + } + break; + case 1: + if (*ptr == 6) + { + *ptr = 7; + } + else if (*ptr == 7) + { + *ptr = 0; + } + else + { + unk2 = sub_81B1B00(*ptr, 1); + if (unk2 == -1) + { + if (gUnknown_0203CEC4->unk8_0) + *ptr = 6; + else + *ptr = 7; + } + else + { + *ptr = unk2; + } + } + break; + case 2: + if (*ptr == 0) + { + if (gUnknown_0203CEC4->unk8_1 == 3) + { + if (GetMonData(&gPlayerParty[3], MON_DATA_SPECIES) != SPECIES_NONE) + *ptr = 3; + } + else if (GetMonData(&gPlayerParty[2], MON_DATA_SPECIES) != SPECIES_NONE) + { + *ptr = 2; + } + } + else if (*ptr == 1) + { + if (gUnknown_0203CEC4->unk8_1 == 5) + { + if (GetMonData(&gPlayerParty[5], MON_DATA_SPECIES) != SPECIES_NONE) + *ptr = 5; + } + else if (GetMonData(&gPlayerParty[4], MON_DATA_SPECIES) != SPECIES_NONE) + { + *ptr = 4; + } + } + break; + case -2: + unk3 = *ptr - 2; + if (unk3 <= 1) + { + gUnknown_0203CEC4->unk8_1 = *ptr; + *ptr = 0; + } + else + { + unk3 = *ptr - 4; + if (unk3 <= 1) + { + gUnknown_0203CEC4->unk8_1 = *ptr; + *ptr = 1; + } + } + break; + } +} +#else +NAKED +void sub_81B195C(s8 *ptr, s8 b) +{ + asm_unified("push {r4-r6,lr}\n\ + adds r4, r0, 0\n\ + lsls r1, 24\n\ + lsrs r2, r1, 24\n\ + asrs r5, r1, 24\n\ + movs r6, 0x1\n\ + negs r6, r6\n\ + cmp r5, r6\n\ + beq _081B1988\n\ + cmp r5, r6\n\ + bgt _081B197E\n\ + movs r0, 0x2\n\ + negs r0, r0\n\ + cmp r5, r0\n\ + bne _081B197C\n\ + b _081B1A9C\n\ +_081B197C:\n\ + b _081B1AF4\n\ +_081B197E:\n\ + cmp r5, 0x1\n\ + beq _081B19E4\n\ + cmp r5, 0x2\n\ + beq _081B1A24\n\ + b _081B1AF4\n\ +_081B1988:\n\ + ldrb r1, [r4]\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0\n\ + bne _081B1996\n\ + movs r0, 0x7\n\ + b _081B1AF2\n\ +_081B1996:\n\ + cmp r0, 0x6\n\ + bne _081B19A8\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + subs r0, 0x1\n\ + b _081B1AF2\n\ + .pool\n\ +_081B19A8:\n\ + cmp r0, 0x7\n\ + bne _081B19C4\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081B19C0\n\ + movs r0, 0x6\n\ + b _081B1AF2\n\ + .pool\n\ +_081B19C0:\n\ + subs r0, r1, 0x1\n\ + strb r0, [r4]\n\ +_081B19C4:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + lsls r1, r2, 24\n\ + asrs r1, 24\n\ + bl sub_81B1B00\n\ + lsls r0, 24\n\ + lsrs r2, r0, 24\n\ + asrs r0, 24\n\ + movs r1, 0x1\n\ + negs r1, r1\n\ + cmp r0, r1\n\ + bne _081B19E0\n\ + b _081B1AF4\n\ +_081B19E0:\n\ + strb r2, [r4]\n\ + b _081B1AF4\n\ +_081B19E4:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0x6\n\ + bne _081B19F0\n\ + movs r0, 0x7\n\ + b _081B1AF2\n\ +_081B19F0:\n\ + cmp r0, 0x7\n\ + bne _081B19F8\n\ + movs r0, 0\n\ + b _081B1AF2\n\ +_081B19F8:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + movs r1, 0x1\n\ + bl sub_81B1B00\n\ + lsls r0, 24\n\ + lsrs r2, r0, 24\n\ + asrs r0, 24\n\ + cmp r0, r6\n\ + bne _081B19E0\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081B1A20\n\ + movs r0, 0x6\n\ + b _081B1AF2\n\ + .pool\n\ +_081B1A20:\n\ + movs r0, 0x7\n\ + b _081B1AF2\n\ +_081B1A24:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0\n\ + bne _081B1A5C\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 28\n\ + lsrs r6, r0, 29\n\ + cmp r6, 0x3\n\ + bne _081B1A54\n\ + ldr r0, =gPlayerParty + 300\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + beq _081B1AF4\n\ + strb r6, [r4]\n\ + b _081B1AF4\n\ + .pool\n\ +_081B1A54:\n\ + ldr r0, =gPlayerParty + 200\n\ + b _081B1A70\n\ + .pool\n\ +_081B1A5C:\n\ + cmp r0, 0x1\n\ + bne _081B1AF4\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 28\n\ + lsrs r5, r0, 29\n\ + cmp r5, 0x5\n\ + bne _081B1A88\n\ + ldr r0, =gPlayerParty + 500\n\ +_081B1A70:\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + beq _081B1AF4\n\ + strb r5, [r4]\n\ + b _081B1AF4\n\ + .pool\n\ +_081B1A88:\n\ + ldr r0, =gPlayerParty + 400\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + beq _081B1AF4\n\ + movs r0, 0x4\n\ + b _081B1AF2\n\ + .pool\n\ +_081B1A9C:\n\ + ldrb r1, [r4]\n\ + subs r0, r1, 0x2\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bhi _081B1ACC\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r3, [r0]\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + movs r0, 0x7\n\ + ands r1, r0\n\ + lsls r1, 1\n\ + ldrb r2, [r3, 0x8]\n\ + movs r0, 0xF\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3, 0x8]\n\ + movs r0, 0\n\ + b _081B1AF2\n\ + .pool\n\ +_081B1ACC:\n\ + subs r0, r1, 0x4\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bhi _081B1AF4\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r3, [r0]\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + movs r0, 0x7\n\ + ands r1, r0\n\ + lsls r1, 1\n\ + ldrb r2, [r3, 0x8]\n\ + movs r0, 0xF\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3, 0x8]\n\ + movs r0, 0x1\n\ +_081B1AF2:\n\ + strb r0, [r4]\n\ +_081B1AF4:\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n"); +} +#endif + +s8 sub_81B1B00(s8 a, s8 b) +{ + while (TRUE) + { + a += b; + if ((u8)a >= 6) + return -1; + if (GetMonData(&gPlayerParty[a], MON_DATA_SPECIES) != SPECIES_NONE) + return a; + } +} + +u8* GetMonNickname(struct Pokemon *mon, u8 *dest) +{ + GetMonData(mon, MON_DATA_NICKNAME, dest); + return StringGetEnd10(dest); +} + +u8 sub_81B1B5C(const u8* str, u8 b) +{ + u8 taskId; + + sub_81B3300(str); + taskId = CreateTask(sub_81B1B8C, 1); + gTasks[taskId].data[0] = b; + return taskId; +} + +void sub_81B1B8C(u8 taskId) +{ + if (RunTextPrintersRetIsActive(6) != TRUE) + { + if (gTasks[taskId].data[0] == 0) + { + sub_8198070(6, 0); + ClearWindowTilemap(6); + } + DestroyTask(taskId); + } +} + +bool8 sub_81B1BD4(void) +{ + return FuncIsActiveTask(sub_81B1B8C); +} + +void sub_81B1BE8(u8 taskId) +{ + if (sub_81221EC() != TRUE) + { + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; + } +} + +void sub_81B1C1C(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_8198070(6, 0); + ClearWindowTilemap(6); + if (sub_81221AC() == TRUE) + { + gTasks[taskId].func = sub_81B1BE8; + } + else + { + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; + } + } +} + +void sub_81B1C84(struct Pokemon *mon, u16 item, u8 c) +{ + GetMonNickname(mon, gStringVar1); + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_PkmnWasGivenItem); + sub_81B1B5C(gStringVar4, c); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B1CD0(struct Pokemon *mon, u16 item, u8 c) +{ + GetMonNickname(mon, gStringVar1); + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_RecievedItemFromPkmn); + sub_81B1B5C(gStringVar4, c); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B1D1C(struct Pokemon *mon, u16 item, u8 c) +{ + GetMonNickname(mon, gStringVar1); + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_SwitchPkmnItem); + sub_81B1B5C(gStringVar4, c); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B1D68(u16 item, u16 item2, u8 c) +{ + CopyItemName(item, gStringVar1); + CopyItemName(item2, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_SwitchedPkmnItem); + sub_81B1B5C(gStringVar4, c); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B1DB8(struct Pokemon *mon, u16 item) +{ + u8 itemBytes[2]; + + if (ItemIsMail(item) == TRUE) + { + if (GiveMailToMon(mon, item) == 0xFF) + return; + } + itemBytes[0] = item; + itemBytes[1] = item >> 8; + SetMonData(mon, MON_DATA_HELD_ITEM, itemBytes); +} + +u8 sub_81B1E00(struct Pokemon* mon) +{ + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + if (item == ITEM_NONE) + return 0; + if (AddBagItem(item, 1) == FALSE) + return 1; + + item = ITEM_NONE; + SetMonData(mon, MON_DATA_HELD_ITEM, &item); + return 2; +} + +void pokemon_item_not_removed(void) +{ + StringExpandPlaceholders(gStringVar4, gText_BagFullCouldNotRemoveItem); +} + +void sub_81B1E60(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + data[0] += data[2]; + data[3]--; + SetMonData(&gPlayerParty[data[4]], MON_DATA_HP, &data[0]); + sub_81B2CD4(&gPlayerParty[data[4]], &gUnknown_0203CEDC[data[4]], 1); + sub_81B2E28(&gPlayerParty[data[4]], &gUnknown_0203CEDC[data[4]]); + if (data[3] == 0 || data[0] == 0 || data[0] == data[1]) + { + if (data[0] > data[5]) + ConvertIntToDecimalStringN(gStringVar2, data[0] - data[5], 0, 3); + SwitchTaskToFollowupFunc(taskId); + } +} + +void sub_81B1F18(u8 taskId, u8 slot, s8 c, s16 HPSomething, TaskFunc func) +{ + struct Pokemon *mon = &gPlayerParty[slot]; + s16 *data = gTasks[taskId].data; + + data[0] = GetMonData(mon, MON_DATA_HP); + data[1] = GetMonData(mon, MON_DATA_MAX_HP); + data[2] = c; + data[3] = HPSomething; + data[4] = slot; + data[5] = data[0]; + SetTaskFuncWithFollowupFunc(taskId, sub_81B1E60, func); +} + +void sub_81B1FA8(u8 taskId, u8 b, u32 hp) +{ + s16 *data = gTasks[taskId].data; + + switch (b) // only case 0 is used + { + case 0: + data[0] = hp; + data[5] = hp; + break; + case 1: + data[1] = hp; + break; + case 2: + data[2] = hp; + break; + case 3: + data[3] = hp; + break; + case 4: + data[4] = hp; + break; + case 5: + SetTaskFuncWithFollowupFunc(taskId, sub_81B1E60, (TaskFunc)hp); // >casting hp as a taskfunc + break; + } +} + +u8 pokemon_ailments_get_primary(u32 status) +{ + if (status & STATUS1_PSN_ANY) + return AILMENT_PSN; + if (status & STATUS1_PARALYSIS) + return AILMENT_PRZ; + if (status & STATUS1_SLEEP) + return AILMENT_SLP; + if (status & STATUS1_FREEZE) + return AILMENT_FRZ; + if (status & STATUS1_BURN) + return AILMENT_BRN; + return AILMENT_NONE; +} + +u8 sub_81B205C(struct Pokemon *mon) +{ + u8 ailment; + + if (GetMonData(mon, MON_DATA_HP) == 0) + return AILMENT_FNT; + ailment = pokemon_ailments_get_primary(GetMonData(mon, MON_DATA_STATUS)); + if (ailment != AILMENT_NONE) + return ailment; + if (CheckPartyPokerus(mon, 0)) + return AILMENT_PKRS; + return AILMENT_NONE; +} + +void sub_81B209C(void) +{ + u16 *ptr; + + if (gUnknown_0203CEC8.unk8_0 == 11) + { + u8 i; + + ptr = &gUnknown_0203CEC8.unkE; + gUnknown_0203CEC8.unkE = 0; + if (gSpecialVar_0x8005 == 0) + { + for (i = 0; i < gPlayerPartyCount; i++) + *ptr += sub_81B2134(&gPlayerParty[i]) << i; + } + else + { + for (i = 0; i < gPlayerPartyCount; i++) + *ptr += sub_81B2164(&gPlayerParty[i]) << i; + } + } +} + +bool16 sub_81B2134(struct Pokemon *mon) +{ + if (GetMonData(mon, MON_DATA_IS_EGG) != TRUE && sub_802C908(GetMonData(mon, MON_DATA_SPECIES)) != FALSE) + return TRUE; + return FALSE; +} + +// Dodrio Berry Picking select? + +bool16 sub_81B2164(struct Pokemon *mon) +{ + if (GetMonData(mon, MON_DATA_IS_EGG) != TRUE && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_DODRIO) + return TRUE; + return FALSE; +} + +bool8 sub_81B218C(u8 slot) +{ + if (!((gUnknown_0203CEC8.unkE >> slot) & 1)) + return FALSE; + return TRUE; +} + +void sub_81B21AC(u8 taskId, u8 slot) +{ + if (sub_81B218C(slot) == TRUE) + { + PlaySE(SE_SELECT); + gSpecialVar_0x8004 = slot; + sub_81B12C0(taskId); + } + else + { + PlaySE(SE_HAZURE); + sub_81B1B5C(gText_PkmnCantParticipate, 0); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B1C1C; + } +} + +void sub_81B2210(u8 taskId) +{ + sub_81B1B5C(gText_CancelParticipation, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B2248; +} + +void sub_81B2248(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B227C; + } +} + +void sub_81B227C(u8 taskId) +{ + switch (Menu_ProcessInputNoWrap_()) + { + case 0: + gSpecialVar_0x8004 = 7; + sub_81B12C0(taskId); + break; + case -1: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B1C1C; + break; + } +} + +u8 sub_81B22D8(struct Pokemon *mon, u16 item, u8 c) +{ + u16 move; + + if (GetMonData(mon, MON_DATA_IS_EGG) != FALSE) + return 3; + if (item >= ITEM_TM01_FOCUS_PUNCH) + { + if (CanMonLearnTMHM(mon, item - 33) != FALSE) + move = ItemIdToBattleMoveId(item); + else + return 1; + do {} while (0); // :morphon: + } + else if (sub_81B2370(GetMonData(mon, MON_DATA_SPECIES), c) == FALSE) + { + return 1; + } + else + { + move = sub_81B2360(c); + } + + if (pokemon_has_move(mon, move) == TRUE) + return 2; + return 0; +} + +u16 sub_81B2360(u8 tutor) +{ + return gUnknown_0861500C[tutor]; +} + +bool8 sub_81B2370(u16 species, u8 tutor) +{ + if (gUnknown_08615048[species] & (1 << tutor)) + return TRUE; + return FALSE; +} + +void sub_81B239C(u8 a) +{ + u8 i; + + switch (a) + { + case 0: + InitWindows(gUnknown_08615810); + break; + case 1: + InitWindows(gUnknown_08615850); + break; + case 2: + InitWindows(gUnknown_08615890); + break; + default: + InitWindows(gUnknown_086158D0); + break; + } + DeactivateAllTextPrinters(); + for (i = 0; i < 6; i++) + FillWindowPixelBuffer(i, 0); + LoadUserWindowBorderGfx(0, 0x4F, 0xD0); + LoadPalette(GetOverworldTextboxPalettePtr(), 0xE0, 0x20); + LoadPalette(gUnknown_0860F074, 0xF0, 0x20); +} + +void sub_81B2428(bool8 a) +{ + u8 firstWindowId; + u8 windowId; + u8 offset; + u8 mainOffset; + + if (gUnknown_0203CEC8.unk8_0 != 5) + { + if (a == TRUE) + { + firstWindowId = AddWindow(&gUnknown_08615918); + FillWindowPixelBuffer(firstWindowId, 0); + mainOffset = GetStringCenterAlignXOffset(0, gMenuText_Confirm, 48); + AddTextPrinterParameterized4(firstWindowId, 0, mainOffset, 1, 0, 0, gUnknown_086157FC[0], -1, gMenuText_Confirm); + PutWindowTilemap(firstWindowId); + CopyWindowToVram(firstWindowId, 2); + windowId = AddWindow(&gUnknown_08615910); + offset = 0; + } + else + { + windowId = AddWindow(&gUnknown_08615908); + offset = 3; + } + FillWindowPixelBuffer(windowId, 0); + if (gUnknown_0203CEC8.unk8_0 != 10) + { + mainOffset = GetStringCenterAlignXOffset(0, gText_Cancel, 48); + AddTextPrinterParameterized3(windowId, 0, mainOffset + offset, 1, gUnknown_086157FC[0], -1, gText_Cancel); + } + else + { + mainOffset = GetStringCenterAlignXOffset(0, gText_Cancel2, 48); + AddTextPrinterParameterized3(windowId, 0, mainOffset + offset, 1, gUnknown_086157FC[0], -1, gText_Cancel2); + } + PutWindowTilemap(windowId); + CopyWindowToVram(windowId, 2); + schedule_bg_copy_tilemap_to_vram(0); + } +} + +u16* sub_81B2564(u8 a) +{ + return &gUnknown_0203CEC4->unk18[a]; +} + +void sub_81B2578(u8 windowId, u8 *b, u8 c, u8 x, u8 y, u8 width, u8 height) +{ + u8 *pixels = AllocZeroed(height * width * 32); + u8 i, j; + + if (pixels != NULL) + { + for (i = 0; i < height; i++) + { + for (j = 0; j < width; j++) + CpuCopy16(sub_81B0DD4(b[x + j + ((y + i) * c)]), &pixels[(i * width + j) * 32], 32); + } + BlitBitmapToWindow(windowId, pixels, x * 8, y * 8, width * 8, height * 8); + Free(pixels); + } +} + +void sub_81B2658(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) +{ + if (width == 0 && height == 0) + { + width = 10; + height = 7; + } + if (f == 0) + sub_81B2578(windowId, gUnknown_08615988, 10, x, y, width, height); + else + sub_81B2578(windowId, gUnknown_086159CE, 10, x, y, width, height); +} + +void sub_81B26BC(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) +{ + if (width == 0 && height == 0) + { + width = 18; + height = 3; + } + if (f == 0) + sub_81B2578(windowId, gUnknown_08615A14, 18, x, y, width, height); + else + sub_81B2578(windowId, gUnknown_08615A4A, 18, x, y, width, height); +} + +void sub_81B2720(u8 windowId) +{ + sub_81B2578(windowId, gUnknown_08615A80, 18, 0, 0, 18, 3); +} + +void sub_81B2748(struct Unk_203CEDC *ptr, u8 bitfield) +{ + u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + + if (0x40 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615AF1[0]), gUnknown_08615AC0[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AF1[1]), gUnknown_08615AC0[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AF1[2]), gUnknown_08615AC0[2] + palNum, 2); + } + else if (0x20 & bitfield) + { + if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + } + } + else if (0x10 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else if (4 & bitfield) + { + if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + } + } + else if (2 & bitfield) + { + if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615ADC[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADC[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADC[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615AD3[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD3[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD3[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE8[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE8[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE8[2]), gUnknown_08615ABD[2] + palNum, 2); + } + } + else if (8 & bitfield) + { + if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615AD9[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD9[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD9[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615AD0[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD0[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD0[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE5[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE5[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE5[2]), gUnknown_08615ABD[2] + palNum, 2); + } + } + else if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615AD6[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD6[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD6[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615ACD[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ACD[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ACD[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE2[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE2[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE2[2]), gUnknown_08615ABD[2] + palNum, 2); + } +} + +void sub_81B2A3C(u8 windowId, const u8 *str, u8 color, u8 *ptr) +{ + AddTextPrinterParameterized3(windowId, 0, ptr[0], ptr[1], gUnknown_086157FC[color], 0, str); +} + +void sub_81B2A70(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + u8 nickname[POKEMON_NAME_LENGTH + 1]; + + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + if (c == 1) + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[0] >> 3, ptr->unk0->unk4[1] >> 3, ptr->unk0->unk4[2] >> 3, ptr->unk0->unk4[3] >> 3, 0); + GetMonNickname(mon, nickname); + sub_81B2A3C(ptr->unk8, nickname, 0, ptr->unk0->unk4); + } +} + +void sub_81B2AC8(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + u8 ailment = sub_81B205C(mon); + if (ailment == AILMENT_NONE || ailment == AILMENT_PKRS) + { + if (c != 0) + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[4] >> 3, (ptr->unk0->unk4[5] >> 3) + 1, ptr->unk0->unk4[6] >> 3, ptr->unk0->unk4[7] >> 3, 0); + if (c != 2) + sub_81B2B40(GetMonData(mon, MON_DATA_LEVEL), ptr); + } + } +} + +void sub_81B2B40(u8 level, struct Unk_203CEDC *ptr) +{ + ConvertIntToDecimalStringN(gStringVar2, level, 0, 3); + StringCopy(gStringVar1, gText_LevelSymbol); + StringAppend(gStringVar1, gStringVar2); + sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[4]); +} + +void sub_81B2B8C(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + u8 nickname[POKEMON_NAME_LENGTH + 1]; + + if (c == 1) + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[8] >> 3, (ptr->unk0->unk4[9] >> 3) + 1, ptr->unk0->unk4[10] >> 3, ptr->unk0->unk4[11] >> 3, 0); + GetMonNickname(mon, nickname); + sub_81B2BF4(GetMonGender(mon), GetMonData(mon, MON_DATA_SPECIES), nickname, ptr); +} + +void sub_81B2BF4(u8 gender, u16 species, u8 *nickname, struct Unk_203CEDC *ptr) +{ + u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + + if (species == SPECIES_NONE) + return; + if (species == SPECIES_NIDORAN_M || species == SPECIES_NIDORAN_F) + { + if (StringCompare(nickname, gSpeciesNames[species]) == 0) + return; + } + switch (gender) + { + case MON_MALE: + LoadPalette(sub_81B2564(gUnknown_08615AC3[0]), gUnknown_08615AB6[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AC3[1]), gUnknown_08615AB6[1] + palNum, 2); + sub_81B2A3C(ptr->unk8, gText_MaleSymbol, 2, &ptr->unk0->unk4[8]); + break; + case MON_FEMALE: + LoadPalette(sub_81B2564(gUnknown_08615AC5[0]), gUnknown_08615AB6[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AC5[1]), gUnknown_08615AB6[1] + palNum, 2); + sub_81B2A3C(ptr->unk8, gText_FemaleSymbol, 2, &ptr->unk0->unk4[8]); + break; + } +} + +void sub_81B2CD4(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + if (c != 0) + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[12] >> 3, (ptr->unk0->unk4[13] >> 3) + 1, ptr->unk0->unk4[14] >> 3, ptr->unk0->unk4[15] >> 3, 0); + if (c != 2) + sub_81B2D3C(GetMonData(mon, MON_DATA_HP), ptr); + } +} + +void sub_81B2D3C(u16 hp, struct Unk_203CEDC *ptr) +{ + u8 *strOut = ConvertIntToDecimalStringN(gStringVar1, hp, 1, 3); + + strOut[0] = CHAR_SLASH; + strOut[1] = EOS; + + sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[12]); +} + +void sub_81B2D74(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + if (c != 0) + ptr->unk0->unk0(ptr->unk8, (ptr->unk0->unk4[16] >> 3) + 1, (ptr->unk0->unk4[17] >> 3) + 1, ptr->unk0->unk4[18] >> 3, ptr->unk0->unk4[19] >> 3, 0); + if (c != 2) + sub_81B2DDC(GetMonData(mon, MON_DATA_MAX_HP), ptr); + } +} + +void sub_81B2DDC(u16 maxhp, struct Unk_203CEDC *ptr) +{ + ConvertIntToDecimalStringN(gStringVar2, maxhp, 1, 3); + StringCopy(gStringVar1, gText_Slash); + StringAppend(gStringVar1, gStringVar2); + sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[16]); +} + +void sub_81B2E28(struct Pokemon *mon, struct Unk_203CEDC *ptr) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + sub_81B2E64(GetMonData(mon, MON_DATA_HP), GetMonData(mon, MON_DATA_MAX_HP), ptr); +} + +void sub_81B2E64(u16 hp, u16 maxhp, struct Unk_203CEDC *ptr) +{ + u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + u8 hpFraction; + + switch (GetHPBarLevel(hp, maxhp)) + { + case 3: + case 4: + LoadPalette(sub_81B2564(gUnknown_08615AC7[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AC7[1]), gUnknown_08615AB8[1] + palNum, 2); + break; + case 2: + LoadPalette(sub_81B2564(gUnknown_08615AC9[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AC9[1]), gUnknown_08615AB8[1] + palNum, 2); + break; + default: + LoadPalette(sub_81B2564(gUnknown_08615ACB[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ACB[1]), gUnknown_08615AB8[1] + palNum, 2); + break; + } + + hpFraction = GetScaledHPFraction(hp, maxhp, ptr->unk0->unk4[22]); + FillWindowPixelRect(ptr->unk8, gUnknown_08615AB8[1], ptr->unk0->unk4[20], ptr->unk0->unk4[21], hpFraction, 1); + FillWindowPixelRect(ptr->unk8, gUnknown_08615AB8[0], ptr->unk0->unk4[20], ptr->unk0->unk4[21] + 1, hpFraction, 2); + if (hpFraction != ptr->unk0->unk4[22]) + { + FillWindowPixelRect(ptr->unk8, 13, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21], ptr->unk0->unk4[22] - hpFraction, 1); + FillWindowPixelRect(ptr->unk8, 2, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21] + 1, ptr->unk0->unk4[22] - hpFraction, 2); + } + CopyWindowToVram(ptr->unk8, 2); +} + +#ifdef NONMATCHING +void sub_81B2FA8(u8 stringID, struct Unk_203CEDC *ptr, u8 c) +{ + if (c != 0) + { + int unk = ((ptr->unk0->unk1C & 7) + ptr->unk0->unk1E + 7) / 8; + int unk2 = ((ptr->unk0->unk1D & 7) + ptr->unk0->unk1F + 7) / 8; + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk1C >> 3, ptr->unk0->unk1D >> 3, unk, unk2, 1); + } + if (c != 2) + AddTextPrinterParameterized3(ptr->unk8, 1, ptr->unk0->unk1C, ptr->unk0->unk1D, gUnknown_086157FC[0], 0, gUnknown_08615B60[stringID]); +} +#else +NAKED +void sub_81B2FA8(u8 stringID, struct Unk_203CEDC *ptr, u8 c) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0xC\n\ + adds r6, r1, 0\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + lsls r2, 24\n\ + lsrs r7, r2, 24\n\ + cmp r7, 0\n\ + beq _081B2FF2\n\ + ldr r5, [r6]\n\ + ldrb r1, [r5, 0x1C]\n\ + movs r4, 0x7\n\ + adds r0, r1, 0\n\ + ands r0, r4\n\ + ldrb r2, [r5, 0x1E]\n\ + adds r0, r2\n\ + adds r3, r0, 0x7\n\ + asrs r3, 3\n\ + ldrb r2, [r5, 0x1D]\n\ + adds r0, r2, 0\n\ + ands r0, r4\n\ + ldrb r4, [r5, 0x1F]\n\ + adds r0, r4\n\ + adds r4, r0, 0x7\n\ + ldrb r0, [r6, 0x8]\n\ + lsrs r1, 3\n\ + lsrs r2, 3\n\ + lsrs r4, 3\n\ + str r4, [sp]\n\ + movs r4, 0x1\n\ + str r4, [sp, 0x4]\n\ + ldr r4, [r5]\n\ + bl _call_via_r4\n\ +_081B2FF2:\n\ + cmp r7, 0x2\n\ + beq _081B3018\n\ + ldrb r0, [r6, 0x8]\n\ + ldr r1, [r6]\n\ + ldrb r2, [r1, 0x1C]\n\ + ldrb r3, [r1, 0x1D]\n\ + ldr r1, =gUnknown_086157FC\n\ + str r1, [sp]\n\ + movs r1, 0\n\ + str r1, [sp, 0x4]\n\ + ldr r4, =gUnknown_08615B60\n\ + mov r5, r8\n\ + lsls r1, r5, 2\n\ + adds r1, r4\n\ + ldr r1, [r1]\n\ + str r1, [sp, 0x8]\n\ + movs r1, 0x1\n\ + bl AddTextPrinterParameterized3\n\ +_081B3018:\n\ + add sp, 0xC\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n"); +} +#endif + +void sub_81B302C(u8 *ptr) +{ + if (*ptr != 0xFF) + { + sub_8198070(*ptr, 0); + RemoveWindow(*ptr); + *ptr = 0xFF; + schedule_bg_copy_tilemap_to_vram(2); + } +} + +void display_pokemon_menu_message(u32 stringID) +{ + u8 *windowPtr = &gUnknown_0203CEC4->unkC[1]; + + if (*windowPtr != 0xFF) + sub_81B302C(windowPtr); + + if (stringID != 0x7F) + { + switch (stringID - 21) + { + case 0: + *windowPtr = AddWindow(&gUnknown_08615928); + break; + case 3: + *windowPtr = AddWindow(&gUnknown_08615930); + break; + case 4: + *windowPtr = AddWindow(&gUnknown_08615938); + break; + case 1: + case 2: + *windowPtr = AddWindow(&gUnknown_08615940); + break; + case 5: + *windowPtr = AddWindow(&gUnknown_08615948); + break; + default: + *windowPtr = AddWindow(&gUnknown_08615920); + break; + } + if (stringID == 0) + { + if (gUnknown_0203CEC4->unk8_0 != FALSE) + stringID = 2; + else if (sub_81B314C() == FALSE) + stringID = 1; + } + SetWindowBorderStyle(*windowPtr, 0, 0x4F, 0xD); + StringExpandPlaceholders(gStringVar4, gUnknown_08615AF4[stringID]); + AddTextPrinterParameterized(*windowPtr, 1, gStringVar4, 0, 1, 0, 0); + schedule_bg_copy_tilemap_to_vram(2); + } +} + +bool8 sub_81B314C(void) +{ + struct Pokemon *party = gPlayerParty; + u8 i; + u8 j = 0; + + if (gUnknown_0203CEC8.unkB == 1) + return TRUE; + + for (i = 0; i < 6; i++) + { + if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE) + { + if (GetMonData(&party[i], MON_DATA_HP) != 0 || GetMonData(&party[i], MON_DATA_IS_EGG) != FALSE) + j++; + } + if (j > 1) + return TRUE; + } + return FALSE; +} From a6db7b2419e0130a7f9686edd998764dc205d449 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Mon, 10 Dec 2018 02:38:23 -0500 Subject: [PATCH 06/17] decompiled up to brm_cancel_1 --- asm/party_menu.s | 1835 --------------------------------------------- include/menu.h | 3 + include/strings.h | 1 + src/party_menu.c | 609 ++++++++++++++- 4 files changed, 612 insertions(+), 1836 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index 3b28ab8d4..17ebaab51 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,1841 +5,6 @@ .text - thumb_func_start sub_81B31B0 -sub_81B31B0: @ 81B31B0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x1C - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - beq _081B320C - cmp r4, 0x1 - bgt _081B31CC - cmp r4, 0 - beq _081B31D2 - b _081B321C -_081B31CC: - cmp r4, 0x2 - beq _081B3214 - b _081B321C -_081B31D2: - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldrb r0, [r1, 0x17] - lsls r0, 1 - movs r3, 0x13 - subs r3, r0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0xA - str r0, [sp] - ldrb r0, [r1, 0x17] - lsls r0, 25 - lsrs r0, 24 - str r0, [sp, 0x4] - movs r0, 0xE - str r0, [sp, 0x8] - ldr r0, =0x000002e9 - str r0, [sp, 0xC] - add r0, sp, 0x14 - movs r1, 0x2 - movs r2, 0x13 - bl SetWindowTemplateFields - b _081B3226 - .pool -_081B320C: - ldr r0, =gUnknown_08615950 - b _081B321E - .pool -_081B3214: - ldr r0, =gUnknown_08615958 - b _081B321E - .pool -_081B321C: - ldr r0, =gUnknown_08615960 -_081B321E: - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x14] - str r1, [sp, 0x18] -_081B3226: - add r0, sp, 0x14 - bl AddWindow - ldr r6, =gUnknown_0203CEC4 - ldr r1, [r6] - strb r0, [r1, 0xC] - ldr r0, [r6] - ldrb r0, [r0, 0xC] - movs r1, 0 - movs r2, 0x4F - movs r3, 0xD - bl SetWindowBorderStyle - cmp r4, 0x3 - bne _081B3250 - ldr r0, [r6] - b _081B32E2 - .pool -_081B3250: - movs r0, 0x1 - movs r1, 0 - bl GetMenuCursorDimensionByFont - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r0, 0x1 - movs r1, 0x2 - bl GetFontAttribute - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r5, 0 - ldr r0, [r6] - ldrb r0, [r0, 0x17] - cmp r5, r0 - bcs _081B32CA - adds r7, r6, 0 - movs r6, 0 -_081B327A: - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0xF - adds r4, r0, r5 - ldrb r0, [r4] - movs r2, 0x3 - cmp r0, 0x12 - bls _081B328C - movs r2, 0x4 -_081B328C: - ldrb r0, [r1, 0xC] - lsls r3, r5, 4 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - mov r1, r8 - str r1, [sp] - str r6, [sp, 0x4] - lsls r1, r2, 1 - adds r1, r2 - ldr r2, =gUnknown_086157FC - adds r1, r2 - str r1, [sp, 0x8] - str r6, [sp, 0xC] - ldr r2, =gUnknown_08615C08 - ldrb r1, [r4] - lsls r1, 3 - adds r1, r2 - ldr r1, [r1] - str r1, [sp, 0x10] - movs r1, 0x1 - mov r2, r9 - bl AddTextPrinterParameterized4 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, [r7] - ldrb r0, [r0, 0x17] - cmp r5, r0 - bcc _081B327A -_081B32CA: - ldr r4, =gUnknown_0203CEC4 - ldr r1, [r4] - ldrb r0, [r1, 0xC] - ldrb r1, [r1, 0x17] - movs r2, 0 - movs r3, 0x1 - bl InitMenuInUpperLeftCorner - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, [r4] -_081B32E2: - ldrb r0, [r0, 0xC] - add sp, 0x1C - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B31B0 - - thumb_func_start sub_81B3300 -sub_81B3300: @ 81B3300 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - movs r0, 0x6 - movs r1, 0 - movs r2, 0x4F - movs r3, 0xD - bl SetWindowBorderStyle - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - bl GetPlayerTextSpeedDelay - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0x6 - movs r1, 0x1 - adds r2, r4, 0 - bl AddTextPrinterParameterized2 - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3300 - - thumb_func_start sub_81B334C -sub_81B334C: @ 81B334C - push {lr} - ldr r0, =gUnknown_08615968 - movs r1, 0x4F - movs r2, 0xD - movs r3, 0 - bl CreateYesNoMenu - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B334C - - thumb_func_start sub_81B3364 -sub_81B3364: @ 81B3364 - push {r4,lr} - ldr r0, =gUnknown_08615970 - bl AddWindow - ldr r4, =gUnknown_0203CEC4 - ldr r1, [r4] - strb r0, [r1, 0xC] - ldr r0, [r4] - ldrb r0, [r0, 0xC] - movs r1, 0 - movs r2, 0x4F - movs r3, 0xD - bl SetWindowBorderStyle - ldr r0, [r4] - ldrb r0, [r0, 0xC] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B3364 - - thumb_func_start sub_81B3394 -sub_81B3394: @ 81B3394 - push {r4,lr} - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - ldrb r0, [r0, 0xC] - bl ClearWindowTilemap - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3394 - - thumb_func_start sub_81B33B4 -sub_81B33B4: @ 81B33B4 - push {r4,lr} - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - cmp r2, 0 - bne _081B33C8 - bl sub_81B3414 - b _081B3400 -_081B33C8: - ldr r4, =gUnknown_0203CEC4 - ldr r1, [r4] - ldr r0, =gUnknown_08615D70 - adds r0, r2, r0 - ldrb r0, [r0] - strb r0, [r1, 0x17] - movs r3, 0 - ldr r0, [r4] - ldrb r0, [r0, 0x17] - cmp r3, r0 - bcs _081B3400 - ldr r1, =gUnknown_08615D38 - lsls r0, r2, 2 - adds r2, r0, r1 -_081B33E4: - ldr r1, [r4] - adds r1, 0xF - adds r1, r3 - ldr r0, [r2] - adds r0, r3 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldr r0, [r4] - ldrb r0, [r0, 0x17] - cmp r3, r0 - bcc _081B33E4 -_081B3400: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B33B4 - - thumb_func_start sub_81B3414 -sub_81B3414: @ 81B3414 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r9, r0 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - ldr r2, =gUnknown_0203CEC4 - ldr r1, [r2] - movs r0, 0 - strb r0, [r1, 0x17] - ldr r1, [r2] - adds r0, r1, 0 - adds r0, 0xF - adds r1, 0x17 - movs r2, 0 - bl AppendToList - movs r7, 0 - ldr r0, =gUnknown_08615D7E - ldrh r0, [r0] - str r0, [sp] -_081B3446: - movs r4, 0 - adds r0, r7, 0x1 - mov r8, r0 - ldr r1, [sp] - cmp r1, 0xE - beq _081B34A0 - movs r0, 0x64 - mov r6, r10 - muls r6, r0 - ldr r5, =gUnknown_08615D7E -_081B345A: - mov r1, r9 - adds r0, r1, r6 - adds r1, r7, 0 - adds r1, 0xD - bl GetMonData - lsls r1, r4, 1 - adds r1, r5 - ldrh r1, [r1] - cmp r0, r1 - bne _081B3490 - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xF - adds r1, 0x17 - adds r2, r4, 0 - adds r2, 0x13 - lsls r2, 24 - lsrs r2, 24 - bl AppendToList - b _081B34A0 - .pool -_081B3490: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 1 - adds r0, r5 - ldrh r0, [r0] - cmp r0, 0xE - bne _081B345A -_081B34A0: - mov r1, r8 - lsls r0, r1, 24 - lsrs r7, r0, 24 - cmp r7, 0x3 - bls _081B3446 - bl InBattlePike - lsls r0, 24 - cmp r0, 0 - bne _081B3518 - mov r0, r9 - adds r0, 0x64 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B34D2 - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xF - adds r1, 0x17 - movs r2, 0x1 - bl AppendToList -_081B34D2: - movs r0, 0x64 - mov r1, r10 - muls r1, r0 - adds r0, r1, 0 - add r0, r9 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B3508 - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xF - adds r1, 0x17 - movs r2, 0x6 - bl AppendToList - b _081B3518 - .pool -_081B3508: - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xF - adds r1, 0x17 - movs r2, 0x3 - bl AppendToList -_081B3518: - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xF - adds r1, 0x17 - movs r2, 0x2 - bl AppendToList - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3414 - - thumb_func_start sub_81B353C -sub_81B353C: @ 81B353C - push {r4,lr} - adds r4, r0, 0 - ldr r1, =gUnknown_0203CEC8 - ldrb r0, [r1, 0x8] - lsls r0, 28 - lsrs r0, 28 - adds r2, r1, 0 - cmp r0, 0xC - bhi _081B35FE - lsls r0, 2 - ldr r1, =_081B3560 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B3560: - .4byte _081B3594 - .4byte _081B35B0 - .4byte _081B35FE - .4byte _081B35FE - .4byte _081B35BC - .4byte _081B35FE - .4byte _081B35DC - .4byte _081B35FE - .4byte _081B35EE - .4byte _081B35F2 - .4byte _081B35F6 - .4byte _081B35FE - .4byte _081B35FA -_081B3594: - bl InMultiBattleRoom - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B35AC - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - beq _081B35FE -_081B35AC: - movs r1, 0x1 - b _081B3600 -_081B35B0: - adds r0, r4, 0 - bl sub_81B8A2C - lsls r0, 24 - lsrs r1, r0, 24 - b _081B3600 -_081B35BC: - movs r0, 0x9 - ldrsb r0, [r2, r0] - bl sub_81B856C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081B35D4 - cmp r0, 0x1 - beq _081B35D8 - movs r1, 0x7 - b _081B3600 -_081B35D4: - movs r1, 0x4 - b _081B3600 -_081B35D8: - movs r1, 0x5 - b _081B3600 -_081B35DC: - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - movs r1, 0x6 - cmp r0, 0 - beq _081B3600 - movs r1, 0x7 - b _081B3600 -_081B35EE: - movs r1, 0xA - b _081B3600 -_081B35F2: - movs r1, 0xB - b _081B3600 -_081B35F6: - movs r1, 0xC - b _081B3600 -_081B35FA: - movs r1, 0xD - b _081B3600 -_081B35FE: - movs r1, 0 -_081B3600: - adds r0, r1, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B353C - - thumb_func_start sub_81B3608 -sub_81B3608: @ 81B3608 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r4, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r4, r1] - movs r0, 0x64 - muls r0, r1 - ldr r7, =gPlayerParty - adds r5, r0, r7 - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - ldrb r1, [r4, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xC - beq _081B3674 - ldrb r4, [r4, 0x9] - adds r0, r5, 0 - bl sub_81B353C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r7, 0 - adds r1, r4, 0 - bl sub_81B33B4 - movs r0, 0 - bl sub_81B31B0 - movs r0, 0x15 - bl display_pokemon_menu_message - b _081B36EA - .pool -_081B3674: - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0 - bne _081B36C0 - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnNotHolding - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - str r1, [r0] - movs r0, 0 - b _081B36EC - .pool -_081B36C0: - ldrb r4, [r4, 0x9] - adds r0, r5, 0 - bl sub_81B353C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r7, 0 - adds r1, r4, 0 - bl sub_81B33B4 - movs r0, 0x1 - bl sub_81B31B0 - ldr r1, =gStringVar2 - adds r0, r6, 0 - bl CopyItemName - movs r0, 0x1A - bl display_pokemon_menu_message -_081B36EA: - movs r0, 0x1 -_081B36EC: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B3608 - - thumb_func_start sub_81B36FC -sub_81B36FC: @ 81B36FC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_81B3608 - lsls r0, 24 - cmp r0, 0 - beq _081B3720 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0xFF - strh r1, [r0, 0x8] - ldr r1, =sub_81B3730 - str r1, [r0] -_081B3720: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B36FC - - thumb_func_start sub_81B3730 -sub_81B3730: @ 81B3730 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B37EE - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B37EE - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x17] - cmp r0, 0x3 - bhi _081B3774 - bl Menu_ProcessInputNoWrapAround_other - b _081B3778 - .pool -_081B3774: - bl ProcessMenuInput_other -_081B3778: - lsls r0, 24 - lsrs r4, r0, 24 - bl GetMenuCursorPos - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5] - lsls r0, r4, 24 - asrs r5, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - beq _081B37EE - adds r0, 0x1 - cmp r5, r0 - bne _081B37CC - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xE - bl sub_81B302C - ldr r2, =gUnknown_08615C08 - ldr r0, [r4] - ldrb r1, [r0, 0x17] - adds r0, r1 - ldrb r0, [r0, 0xE] - lsls r0, 3 - adds r2, 0x4 - adds r0, r2 - ldr r1, [r0] - adds r0, r6, 0 - bl _call_via_r1 - b _081B37EE - .pool -_081B37CC: - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xE - bl sub_81B302C - ldr r1, =gUnknown_08615C08 - ldr r0, [r4] - adds r0, 0xF - adds r0, r5 - ldrb r0, [r0] - lsls r0, 3 - adds r1, 0x4 - adds r0, r1 - ldr r1, [r0] - adds r0, r6, 0 - bl _call_via_r1 -_081B37EE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3730 - - thumb_func_start sub_81B37FC -sub_81B37FC: @ 81B37FC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B3828 - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B37FC - - thumb_func_start sub_81B3828 -sub_81B3828: @ 81B3828 - push {r4,lr} - sub sp, 0x4 - ldr r4, =gUnknown_0203CEC8 - ldrb r1, [r4, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - bne _081B3868 - bl pokemon_change_order - ldr r1, =gPlayerParty - ldrb r2, [r4, 0x9] - ldr r0, =gPlayerPartyCount - ldrb r3, [r0] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sub_81B3894 - str r0, [sp] - movs r0, 0x1 - bl ShowPokemonSummaryScreen - b _081B3880 - .pool -_081B3868: - ldr r1, =gPlayerParty - ldrb r2, [r4, 0x9] - ldr r0, =gPlayerPartyCount - ldrb r3, [r0] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sub_81B3894 - str r0, [sp] - movs r0, 0 - bl ShowPokemonSummaryScreen -_081B3880: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3828 - - thumb_func_start sub_81B3894 -sub_81B3894: @ 81B3894 - push {lr} - sub sp, 0xC - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r3, =gUnknown_0203CEC8 - ldr r0, =gUnknown_0203CF20 - ldrb r0, [r0] - strb r0, [r3, 0x9] - ldrb r0, [r3, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r3, 0xB] - movs r1, 0x15 - str r1, [sp] - ldr r1, =sub_81B36FC - str r1, [sp, 0x4] - ldr r1, [r3] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3894 - - thumb_func_start brm_switch -brm_switch: @ 81B38DC - push {r4-r6,lr} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203CEC8 - movs r0, 0x8 - strb r0, [r5, 0xB] - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - movs r0, 0x3 - bl display_pokemon_menu_message - ldrb r0, [r5, 0x9] - movs r1, 0x1 - bl sub_81B0FCC - ldrb r0, [r5, 0x9] - strb r0, [r5, 0xA] - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1370 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end brm_switch - - thumb_func_start sub_81B3938 -sub_81B3938: @ 81B3938 - push {r4-r7,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - ldr r3, =gUnknown_0203CEC8 - movs r1, 0xA - ldrsb r1, [r3, r1] - movs r0, 0x9 - ldrsb r0, [r3, r0] - cmp r1, r0 - bne _081B3968 - adds r0, r7, 0 - bl sub_81B407C - b _081B3ABA - .pool -_081B3968: - add r2, sp, 0x8 - movs r0, 0x9 - ldrsb r0, [r3, r0] - ldr r1, =gUnknown_0203CEDC - ldr r1, [r1] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x8] - movs r4, 0 - strb r0, [r2] - adds r0, r2, 0 - ldrb r0, [r0] - movs r1, 0x1 - bl GetWindowAttribute - strh r0, [r6] - add r0, sp, 0x8 - ldrb r0, [r0] - movs r1, 0x2 - bl GetWindowAttribute - strh r0, [r6, 0x2] - add r0, sp, 0x8 - ldrb r0, [r0] - movs r1, 0x3 - bl GetWindowAttribute - strh r0, [r6, 0x4] - add r0, sp, 0x8 - ldrb r0, [r0] - movs r1, 0x4 - bl GetWindowAttribute - strh r0, [r6, 0x6] - strh r4, [r6, 0x10] - movs r1, 0x4 - ldrsh r0, [r6, r1] - cmp r0, 0xA - bne _081B39C4 - movs r2, 0x1 - negs r2, r2 - adds r0, r2, 0 - b _081B39C6 - .pool -_081B39C4: - movs r0, 0x1 -_081B39C6: - strh r0, [r6, 0x14] - add r2, sp, 0x8 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xA] - lsls r0, 24 - asrs r0, 24 - ldr r1, =gUnknown_0203CEDC - ldr r1, [r1] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x8] - movs r4, 0 - strb r0, [r2, 0x1] - adds r0, r2, 0 - ldrb r0, [r0, 0x1] - movs r1, 0x1 - bl GetWindowAttribute - strh r0, [r6, 0x8] - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - movs r1, 0x2 - bl GetWindowAttribute - strh r0, [r6, 0xA] - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - movs r1, 0x3 - bl GetWindowAttribute - strh r0, [r6, 0xC] - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - movs r1, 0x4 - bl GetWindowAttribute - strh r0, [r6, 0xE] - strh r4, [r6, 0x12] - movs r1, 0xC - ldrsh r0, [r6, r1] - cmp r0, 0xA - bne _081B3A2C - movs r2, 0x1 - negs r2, r2 - adds r0, r2, 0 - b _081B3A2E - .pool -_081B3A2C: - movs r0, 0x1 -_081B3A2E: - strh r0, [r6, 0x16] - ldr r4, =gUnknown_0203CEF0 - movs r0, 0x4 - ldrsh r1, [r6, r0] - movs r2, 0x6 - ldrsh r0, [r6, r2] - lsls r0, 1 - muls r0, r1 - bl Alloc - str r0, [r4] - ldr r5, =gUnknown_0203CEF4 - movs r0, 0xC - ldrsh r1, [r6, r0] - movs r2, 0xE - ldrsh r0, [r6, r2] - lsls r0, 1 - muls r0, r1 - bl Alloc - str r0, [r5] - ldr r1, [r4] - ldrb r2, [r6] - ldrb r3, [r6, 0x2] - ldrb r0, [r6, 0x4] - str r0, [sp] - ldrb r0, [r6, 0x6] - str r0, [sp, 0x4] - movs r0, 0 - bl sub_8199CBC - ldr r1, [r5] - ldrb r2, [r6, 0x8] - ldrb r3, [r6, 0xA] - ldrb r0, [r6, 0xC] - str r0, [sp] - ldrb r0, [r6, 0xE] - str r0, [sp, 0x4] - movs r0, 0 - bl sub_8199CBC - add r0, sp, 0x8 - ldrb r0, [r0] - bl ClearWindowTilemap - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl ClearWindowTilemap - ldr r4, =gUnknown_0203CEC8 - movs r0, 0x9 - strb r0, [r4, 0xB] - ldrb r0, [r4, 0x9] - movs r1, 0x1 - bl sub_81B0FCC - ldrb r0, [r4, 0xA] - movs r1, 0x1 - bl sub_81B0FCC - adds r0, r7, 0 - bl sub_81B3CC0 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B3D48 - str r1, [r0] -_081B3ABA: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3938 - - thumb_func_start sub_81B3AD8 -sub_81B3AD8: @ 81B3AD8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r2, 0 - mov r12, r3 - ldr r7, [sp, 0x18] - lsls r0, 16 - lsrs r3, r0, 16 - adds r5, r3, 0 - lsls r1, 16 - lsrs r2, r1, 16 - mov r8, r2 - lsls r0, r3, 16 - asrs r1, r0, 16 - lsls r0, r2, 16 - asrs r0, 16 - adds r4, r1, r0 - cmp r4, 0 - blt _081B3B02 - cmp r1, 0x1F - ble _081B3B06 -_081B3B02: - movs r0, 0 - b _081B3B34 -_081B3B06: - cmp r1, 0 - bge _081B3B1A - negs r0, r1 - strb r0, [r6] - movs r0, 0 - mov r1, r12 - strb r0, [r1] - adds r0, r2, r3 - strb r0, [r7] - b _081B3B32 -_081B3B1A: - movs r0, 0 - strb r0, [r6] - mov r0, r12 - strb r5, [r0] - cmp r4, 0x1F - ble _081B3B2E - movs r0, 0x20 - subs r0, r5 - strb r0, [r7] - b _081B3B32 -_081B3B2E: - mov r1, r8 - strb r1, [r7] -_081B3B32: - movs r0, 0x1 -_081B3B34: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81B3AD8 - - thumb_func_start sub_81B3B40 -sub_81B3B40: @ 81B3B40 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - str r0, [sp, 0x28] - ldr r0, [sp, 0x54] - ldr r4, [sp, 0x58] - lsls r2, 16 - lsrs r2, 16 - mov r9, r2 - lsls r3, 16 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - lsls r4, 16 - lsrs r4, 16 - str r4, [sp, 0x30] - lsls r1, 16 - asrs r7, r1, 16 - lsrs r0, r3, 16 - str r0, [sp, 0x2C] - asrs r3, 16 - mov r8, r3 - mov r5, sp - adds r5, 0x25 - mov r6, sp - adds r6, 0x26 - str r6, [sp] - adds r0, r7, 0 - mov r1, r8 - add r2, sp, 0x24 - adds r3, r5, 0 - bl sub_81B3AD8 - lsls r0, 24 - cmp r0, 0 - beq _081B3BFA - ldrb r2, [r5] - mov r1, r9 - lsls r0, r1, 24 - lsrs r0, 24 - mov r9, r0 - ldrb r0, [r6] - str r0, [sp] - mov r1, r10 - lsls r0, r1, 24 - lsrs r4, r0, 24 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - mov r3, r9 - bl FillBgTilemapBufferRect_Palette0 - ldr r1, [sp, 0x30] - lsls r0, r1, 16 - asrs r0, 16 - adds r0, r7, r0 - lsls r0, 16 - asrs r0, 16 - str r6, [sp] - mov r1, r8 - add r2, sp, 0x24 - adds r3, r5, 0 - bl sub_81B3AD8 - lsls r0, 24 - cmp r0, 0 - beq _081B3BFA - add r0, sp, 0x24 - ldrb r2, [r0] - ldr r1, [sp, 0x2C] - lsls r0, r1, 24 - lsrs r0, 24 - str r0, [sp] - str r4, [sp, 0x4] - ldrb r0, [r5] - str r0, [sp, 0x8] - mov r0, r9 - str r0, [sp, 0xC] - ldrb r0, [r6] - str r0, [sp, 0x10] - str r4, [sp, 0x14] - movs r0, 0x11 - str r0, [sp, 0x18] - movs r0, 0 - str r0, [sp, 0x1C] - str r0, [sp, 0x20] - ldr r1, [sp, 0x28] - movs r3, 0 - bl CopyRectToBgTilemapBufferRect -_081B3BFA: - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B3B40 - - thumb_func_start sub_81B3C0C -sub_81B3C0C: @ 81B3C0C - push {r4,lr} - ldr r4, =gSprites - ldrb r2, [r0, 0xB] - lsls r3, r2, 4 - adds r3, r2 - lsls r3, 2 - adds r3, r4 - lsls r1, 16 - asrs r1, 13 - ldrh r2, [r3, 0x24] - adds r2, r1 - strh r2, [r3, 0x24] - ldrb r3, [r0, 0xA] - lsls r2, r3, 4 - adds r2, r3 - lsls r2, 2 - adds r2, r4 - ldrh r3, [r2, 0x24] - adds r3, r1 - strh r3, [r2, 0x24] - ldrb r3, [r0, 0x9] - lsls r2, r3, 4 - adds r2, r3 - lsls r2, 2 - adds r2, r4 - ldrh r3, [r2, 0x24] - adds r3, r1 - strh r3, [r2, 0x24] - ldrb r2, [r0, 0xC] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r4 - ldrh r2, [r0, 0x24] - adds r2, r1 - strh r2, [r0, 0x24] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3C0C - - thumb_func_start sub_81B3C60 -sub_81B3C60: @ 81B3C60 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _081B3C8E - ldr r2, =gUnknown_0203CEDC - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - lsls r1, 4 - ldr r0, [r2] - adds r0, r1 - movs r2, 0x14 - ldrsh r1, [r4, r2] - bl sub_81B3C0C -_081B3C8E: - movs r1, 0x16 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _081B3CAC - ldr r2, =gUnknown_0203CEDC - ldr r0, =gUnknown_0203CEC8 - movs r1, 0xA - ldrsb r1, [r0, r1] - lsls r1, 4 - ldr r0, [r2] - adds r0, r1 - movs r2, 0x16 - ldrsh r1, [r4, r2] - bl sub_81B3C0C -_081B3CAC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3C60 - - thumb_func_start sub_81B3CC0 -sub_81B3CC0: @ 81B3CC0 - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r5, r1, r0 - movs r1, 0x14 - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _081B3D00 - ldr r0, =gUnknown_0203CEF0 - ldr r0, [r0] - ldrh r1, [r5, 0x10] - ldrh r2, [r5] - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - movs r3, 0x2 - ldrsh r2, [r5, r3] - movs r4, 0x4 - ldrsh r3, [r5, r4] - movs r6, 0x6 - ldrsh r4, [r5, r6] - str r4, [sp] - movs r6, 0x14 - ldrsh r4, [r5, r6] - str r4, [sp, 0x4] - bl sub_81B3B40 -_081B3D00: - movs r1, 0x16 - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _081B3D2E - ldr r0, =gUnknown_0203CEF4 - ldr r0, [r0] - ldrh r1, [r5, 0x12] - ldrh r2, [r5, 0x8] - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - movs r3, 0xA - ldrsh r2, [r5, r3] - movs r4, 0xC - ldrsh r3, [r5, r4] - movs r6, 0xE - ldrsh r4, [r5, r6] - str r4, [sp] - movs r6, 0x16 - ldrsh r4, [r5, r6] - str r4, [sp, 0x4] - bl sub_81B3B40 -_081B3D2E: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3CC0 - - thumb_func_start sub_81B3D48 -sub_81B3D48: @ 81B3D48 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r7, r0, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - adds r6, r7, r0 - adds r0, r4, 0 - bl sub_81B3CC0 - adds r0, r4, 0 - bl sub_81B3C60 - ldrh r1, [r6, 0x14] - ldrh r2, [r6, 0x10] - adds r1, r2 - strh r1, [r6, 0x10] - ldrh r0, [r6, 0x16] - ldrh r3, [r6, 0x12] - adds r0, r3 - strh r0, [r6, 0x12] - add r2, sp, 0x8 - ldrh r0, [r6] - adds r0, r1 - strh r0, [r2] - adds r1, r2, 0 - ldrh r0, [r6, 0x12] - ldrh r3, [r6, 0x8] - adds r2, r0, r3 - strh r2, [r1, 0x2] - adds r0, r1, 0 - ldrh r0, [r0] - cmp r0, 0x21 - bls _081B3E3A - lsls r0, r2, 16 - lsrs r0, 16 - cmp r0, 0x21 - bls _081B3E3A - movs r1, 0x14 - ldrsh r0, [r6, r1] - negs r0, r0 - strh r0, [r6, 0x14] - movs r2, 0x16 - ldrsh r0, [r6, r2] - negs r0, r0 - strh r0, [r6, 0x16] - bl swap_pokemon_and_oams - ldr r4, =gUnknown_0203CEC8 - ldrb r0, [r4, 0x9] - bl sub_81B0948 - ldrb r0, [r4, 0xA] - bl sub_81B0948 - movs r0, 0x9 - ldrsb r0, [r4, r0] - ldr r5, =gUnknown_0203CEDC - ldr r1, [r5] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x8] - bl PutWindowTilemap - movs r0, 0xA - ldrsb r0, [r4, r0] - ldr r1, [r5] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x8] - bl PutWindowTilemap - ldr r0, =gUnknown_0203CEF0 - ldr r1, [r0] - ldrb r2, [r6] - ldrb r3, [r6, 0x2] - ldrb r0, [r6, 0x4] - str r0, [sp] - ldrb r0, [r6, 0x6] - str r0, [sp, 0x4] - movs r0, 0 - bl sub_8199CBC - ldr r0, =gUnknown_0203CEF4 - ldr r1, [r0] - ldrb r2, [r6, 0x8] - ldrb r3, [r6, 0xA] - ldrb r0, [r6, 0xC] - str r0, [sp] - ldrb r0, [r6, 0xE] - str r0, [sp, 0x4] - movs r0, 0 - bl sub_8199CBC - movs r0, 0x9 - ldrsb r0, [r4, r0] - ldr r1, [r5] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x8] - bl ClearWindowTilemap - movs r0, 0xA - ldrsb r0, [r4, r0] - ldr r1, [r5] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x8] - bl ClearWindowTilemap - mov r0, r8 - subs r0, 0x8 - adds r0, r7, r0 - ldr r1, =sub_81B3E60 - str r1, [r0] -_081B3E3A: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B3D48 - - thumb_func_start sub_81B3E60 -sub_81B3E60: @ 81B3E60 - push {r4-r6,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 - adds r0, r6, 0 - bl sub_81B3CC0 - adds r0, r6, 0 - bl sub_81B3C60 - movs r1, 0x14 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081B3EE4 - movs r2, 0x16 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _081B3EE4 - ldr r5, =gUnknown_0203CEC8 - movs r0, 0x9 - ldrsb r0, [r5, r0] - ldr r4, =gUnknown_0203CEDC - ldr r1, [r4] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x8] - bl PutWindowTilemap - movs r0, 0xA - ldrsb r0, [r5, r0] - ldr r1, [r4] - lsls r0, 4 - adds r0, r1 - ldrb r0, [r0, 0x8] - bl PutWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gUnknown_0203CEF0 - ldr r0, [r0] - bl Free - ldr r0, =gUnknown_0203CEF4 - ldr r0, [r0] - bl Free - adds r0, r6, 0 - bl sub_81B407C - b _081B3F08 - .pool -_081B3EE4: - ldrh r1, [r4, 0x14] - ldrh r0, [r4, 0x10] - adds r1, r0 - strh r1, [r4, 0x10] - ldrh r0, [r4, 0x16] - ldrh r2, [r4, 0x12] - adds r0, r2 - strh r0, [r4, 0x12] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0 - bne _081B3EFE - strh r1, [r4, 0x14] -_081B3EFE: - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081B3F08 - strh r0, [r4, 0x16] -_081B3F08: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B3E60 - - thumb_func_start oamt_swap_pos -oamt_swap_pos: @ 81B3F10 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - ldrb r3, [r0] - ldrb r2, [r1] - strb r2, [r0] - strb r3, [r1] - ldr r5, =gSprites - ldrb r2, [r0] - lsls r3, r2, 4 - adds r3, r2 - lsls r3, 2 - adds r3, r5 - ldrh r6, [r3, 0x20] - ldrh r2, [r3, 0x22] - mov r8, r2 - ldrh r2, [r3, 0x24] - mov r9, r2 - ldrh r2, [r3, 0x26] - mov r10, r2 - ldrb r4, [r1] - lsls r2, r4, 4 - adds r2, r4 - lsls r2, 2 - adds r2, r5 - ldrh r2, [r2, 0x20] - strh r2, [r3, 0x20] - ldrb r2, [r0] - lsls r3, r2, 4 - adds r3, r2 - lsls r3, 2 - adds r3, r5 - ldrb r4, [r1] - lsls r2, r4, 4 - adds r2, r4 - lsls r2, 2 - adds r2, r5 - ldrh r2, [r2, 0x22] - strh r2, [r3, 0x22] - ldrb r2, [r0] - lsls r3, r2, 4 - adds r3, r2 - lsls r3, 2 - adds r3, r5 - ldrb r4, [r1] - lsls r2, r4, 4 - adds r2, r4 - lsls r2, 2 - adds r2, r5 - ldrh r2, [r2, 0x24] - strh r2, [r3, 0x24] - ldrb r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r5 - ldrb r3, [r1] - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - adds r0, r5 - ldrh r0, [r0, 0x26] - strh r0, [r2, 0x26] - ldrb r2, [r1] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - strh r6, [r0, 0x20] - ldrb r2, [r1] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - mov r2, r8 - strh r2, [r0, 0x22] - ldrb r2, [r1] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - mov r2, r9 - strh r2, [r0, 0x24] - ldrb r1, [r1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - mov r1, r10 - strh r1, [r0, 0x26] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end oamt_swap_pos - - thumb_func_start swap_pokemon_and_oams -swap_pokemon_and_oams: @ 81B3FDC - push {r4-r6,lr} - sub sp, 0x8 - ldr r1, =gUnknown_0203CEDC - ldr r2, =gUnknown_0203CEC8 - movs r3, 0x9 - ldrsb r3, [r2, r3] - lsls r0, r3, 4 - ldr r1, [r1] - adds r0, r1, r0 - str r0, [sp] - ldrb r2, [r2, 0xA] - lsls r2, 24 - asrs r2, 24 - lsls r0, r2, 4 - adds r0, r1, r0 - str r0, [sp, 0x4] - movs r1, 0x64 - adds r4, r3, 0 - muls r4, r1 - ldr r0, =gPlayerParty - adds r4, r0 - adds r5, r2, 0 - muls r5, r1 - adds r5, r0 - movs r0, 0x64 - bl Alloc - adds r6, r0, 0 - adds r1, r4, 0 - movs r2, 0x64 - bl memcpy - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0x64 - bl memcpy - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x64 - bl memcpy - adds r0, r6, 0 - bl Free - ldr r0, [sp] - adds r0, 0xB - ldr r1, [sp, 0x4] - adds r1, 0xB - bl oamt_swap_pos - ldr r0, [sp] - adds r0, 0xA - ldr r1, [sp, 0x4] - adds r1, 0xA - bl oamt_swap_pos - ldr r0, [sp] - adds r0, 0x9 - ldr r1, [sp, 0x4] - adds r1, 0x9 - bl oamt_swap_pos - ldr r0, [sp] - adds r0, 0xC - ldr r1, [sp, 0x4] - adds r1, 0xC - bl oamt_swap_pos - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end swap_pokemon_and_oams - - thumb_func_start sub_81B407C -sub_81B407C: @ 81B407C - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - ldr r4, =gUnknown_0203CEC8 - movs r0, 0 - strb r0, [r4, 0xB] - ldrb r0, [r4, 0x9] - movs r1, 0 - bl sub_81B0FCC - ldrb r0, [r4, 0xA] - strb r0, [r4, 0x9] - ldrb r0, [r4, 0xA] - movs r1, 0x1 - bl sub_81B0FCC - movs r0, 0 - bl display_pokemon_menu_message - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1370 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B407C - - thumb_func_start brm_cancel_1 -brm_cancel_1: @ 81B40D4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x6 - bne _081B4110 - movs r0, 0xF - bl display_pokemon_menu_message - b _081B4116 - .pool -_081B4110: - movs r0, 0 - bl display_pokemon_menu_message -_081B4116: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 - str r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end brm_cancel_1 - thumb_func_start sub_81B4134 sub_81B4134: @ 81B4134 push {r4,r5,lr} diff --git a/include/menu.h b/include/menu.h index eb525efe9..60be8361f 100644 --- a/include/menu.h +++ b/include/menu.h @@ -90,5 +90,8 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo void sub_8197AE8(bool8 copyToVram); void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs); s8 Menu_ProcessInputGridLayout(void); +u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted); +s8 Menu_ProcessInputNoWrapAround_other(void); +void sub_8199CBC(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8 height); #endif // GUARD_MENU_H diff --git a/include/strings.h b/include/strings.h index 22ff75bc5..0ec3526ea 100644 --- a/include/strings.h +++ b/include/strings.h @@ -406,6 +406,7 @@ extern const u8 gText_SwitchPkmnItem[]; extern const u8 gText_SwitchedPkmnItem[]; extern const u8 gText_BagFullCouldNotRemoveItem[]; extern const u8 gText_PkmnCantParticipate[]; +extern const u8 gText_PkmnNotHolding[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/src/party_menu.c b/src/party_menu.c index 833950657..c43beaadb 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2,9 +2,11 @@ #include "battle.h" #include "battle_controllers.h" #include "battle_interface.h" +#include "battle_pike.h" #include "bg.h" #include "constants/battle.h" #include "constants/items.h" +#include "constants/moves.h" #include "constants/rgb.h" #include "constants/songs.h" #include "constants/species.h" @@ -12,6 +14,7 @@ #include "data2.h" #include "decompress.h" #include "event_data.h" +#include "field_specials.h" #include "fldeff_softboiled.h" #include "gpu_regs.h" #include "graphics.h" @@ -28,10 +31,12 @@ #include "party_menu.h" #include "pokemon.h" #include "pokemon_icon.h" +#include "pokemon_summary_screen.h" #include "rom_8011DC0.h" #include "scanline_effect.h" #include "sound.h" #include "sprite.h" +#include "start_menu.h" #include "string_util.h" #include "strings.h" #include "task.h" @@ -57,7 +62,8 @@ struct Unk_203CEC4 { u32 unk9_0:7; u32 unkA_0:14; u8 unkC[3]; - u8 fillerF[9]; + u8 unkF[8]; + u8 unk17; u16 unk18[0xB0]; u8 filler[0xA0]; s16 unk218[16]; @@ -77,6 +83,11 @@ struct Unk_203CEE4 { u8 filler[0x800]; }; +struct Unk_8615C08 { + const u8 *textPtr; + TaskFunc func; +}; + // BELOW TO BE PUT IN EWRAM extern struct Unk_203CEC4 *gUnknown_0203CEC4; @@ -85,7 +96,10 @@ extern struct Unk_203CEDC *gUnknown_0203CEDC; extern u8 *gUnknown_0203CEE0; extern struct Unk_203CEE4 *gUnknown_0203CEE4; extern u8 gUnknown_0203CEE8; +extern u16 *gUnknown_0203CEF0; +extern u16 *gUnknown_0203CEF4; extern u8 gSelectedOrderFromParty[]; +extern u8 gUnknown_0203CF20; // summary screen? // ABOVE TO BE PUT IN EWRAM @@ -112,6 +126,11 @@ extern struct WindowTemplate gUnknown_08615930; extern struct WindowTemplate gUnknown_08615938; extern struct WindowTemplate gUnknown_08615940; extern struct WindowTemplate gUnknown_08615948; +extern struct WindowTemplate gUnknown_08615950; +extern struct WindowTemplate gUnknown_08615958; +extern struct WindowTemplate gUnknown_08615960; +extern struct WindowTemplate gUnknown_08615968; +extern struct WindowTemplate gUnknown_08615970; extern u8 gUnknown_08615988[]; extern u8 gUnknown_086159CE[]; extern u8 gUnknown_08615A14[]; @@ -142,6 +161,10 @@ extern u8 gUnknown_08615AEE[]; extern u8 gUnknown_08615AF1[]; extern const u8 *gUnknown_08615AF4[]; extern const u8 *gUnknown_08615B60[]; +extern struct Unk_8615C08 gUnknown_08615C08[]; +extern u8 *gUnknown_08615D38[]; +extern u8 gUnknown_08615D70[]; +extern const u16 gUnknown_08615D7E[]; // ABOVE TO BE CONVERTED TO C @@ -255,6 +278,18 @@ void sub_81B227C(u8); bool8 sub_81B2370(u16, u8); u16 sub_81B2360(u8); bool8 sub_81B314C(void); +void sub_81B3414(struct Pokemon*, u8); +u8 sub_81B8A2C(struct Pokemon*); +u8 sub_81B856C(s8); +void sub_81B469C(u8); +void sub_81B3730(u8); +void sub_81B3828(void); +void pokemon_change_order(void); +void sub_81B3894(void); +void sub_81B3CC0(u8); +void sub_81B3D48(u8); +void swap_pokemon_and_oams(void); +void sub_81B3E60(u8); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -2784,3 +2819,575 @@ bool8 sub_81B314C(void) } return FALSE; } + +u8 sub_81B31B0(u8 a) +{ + struct WindowTemplate window; + u8 cursorDimension; + u8 fontAttribute; + u8 i; + + switch (a) + { + case 0: + SetWindowTemplateFields(&window, 2, 19, 19 - (gUnknown_0203CEC4->unk17 * 2), 10, gUnknown_0203CEC4->unk17 * 2, 14, 0x2E9); + break; + case 1: + window = gUnknown_08615950; + break; + case 2: + window = gUnknown_08615958; + break; + default: + window = gUnknown_08615960; + break; + } + + gUnknown_0203CEC4->unkC[0] = AddWindow(&window); + SetWindowBorderStyle(gUnknown_0203CEC4->unkC[0], 0, 0x4F, 13); + if (a == 3) + return gUnknown_0203CEC4->unkC[0]; + cursorDimension = GetMenuCursorDimensionByFont(1, 0); + fontAttribute = GetFontAttribute(1, 2); + + for (i = 0; i < gUnknown_0203CEC4->unk17; i++) + { + u8 unk = (gUnknown_0203CEC4->unkF[i] > 18) ? 4 : 3; + AddTextPrinterParameterized4(gUnknown_0203CEC4->unkC[0], 1, cursorDimension, (i * 16) + 1, fontAttribute, 0, gUnknown_086157FC[unk], 0, gUnknown_08615C08[gUnknown_0203CEC4->unkF[i]].textPtr); + } + + InitMenuInUpperLeftCorner(gUnknown_0203CEC4->unkC[0], gUnknown_0203CEC4->unk17, 0, 1); + schedule_bg_copy_tilemap_to_vram(2); + + return gUnknown_0203CEC4->unkC[0]; +} + +void sub_81B3300(const u8 *text) +{ + SetWindowBorderStyle(6, 0, 0x4F, 13); + gTextFlags.canABSpeedUpPrint = TRUE; + AddTextPrinterParameterized2(6, 1, text, GetPlayerTextSpeedDelay(), 0, 2, 1, 3); +} + +void sub_81B334C(void) +{ + CreateYesNoMenu(&gUnknown_08615968, 0x4F, 13, 0); +} + +u8 sub_81B3364(void) +{ + gUnknown_0203CEC4->unkC[0] = AddWindow(&gUnknown_08615970); + SetWindowBorderStyle(gUnknown_0203CEC4->unkC[0], 0, 0x4F, 13); + return gUnknown_0203CEC4->unkC[0]; +} + +void sub_81B3394(void) +{ + ClearWindowTilemap(gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); +} + +void sub_81B33B4(struct Pokemon *mons, u8 a, u8 b) +{ + u8 i; + + if (b == 0) + { + sub_81B3414(mons, a); + } + else + { + gUnknown_0203CEC4->unk17 = gUnknown_08615D70[b]; + for (i = 0; i < gUnknown_0203CEC4->unk17; i++) + gUnknown_0203CEC4->unkF[i] = gUnknown_08615D38[b][i]; + } +} + +void sub_81B3414(struct Pokemon *mons, u8 a) +{ + u8 i, j; + + gUnknown_0203CEC4->unk17 = 0; + AppendToList(gUnknown_0203CEC4->unkF, &gUnknown_0203CEC4->unk17, 0); + for (i = 0; i < 4; i++) + { + for (j = 0; gUnknown_08615D7E[j] != MOVE_SWORDS_DANCE; j++) + { + if (GetMonData(&mons[a], i + MON_DATA_MOVE1) == gUnknown_08615D7E[j]) + { + AppendToList(gUnknown_0203CEC4->unkF, &gUnknown_0203CEC4->unk17, j + 19); + break; + } + } + } + if (!InBattlePike()) + { + if (GetMonData(&mons[1], MON_DATA_SPECIES) != SPECIES_NONE) + AppendToList(gUnknown_0203CEC4->unkF, &gUnknown_0203CEC4->unk17, 1); + if (ItemIsMail(GetMonData(&mons[a], MON_DATA_HELD_ITEM))) + AppendToList(gUnknown_0203CEC4->unkF, &gUnknown_0203CEC4->unk17, 6); + else + AppendToList(gUnknown_0203CEC4->unkF, &gUnknown_0203CEC4->unk17, 3); + } + AppendToList(gUnknown_0203CEC4->unkF, &gUnknown_0203CEC4->unk17, 2); +} + +u8 sub_81B353C(struct Pokemon *mon) +{ + u32 returnVar; + + switch (gUnknown_0203CEC8.unk8_0) + { + case 0: + if (InMultiBattleRoom() == TRUE || GetMonData(mon, MON_DATA_IS_EGG) != FALSE) + returnVar = 1; + else + returnVar = 0; + break; + case 1: + returnVar = sub_81B8A2C(mon); + break; + case 4: + switch (sub_81B856C(gUnknown_0203CEC8.unk9)) + { + default: + returnVar = 7; + break; + case 0: + returnVar = 4; + break; + case 1: + returnVar = 5; + break; + } + break; + case 6: + returnVar = (GetMonData(mon, MON_DATA_IS_EGG) != FALSE) ? 7 : 6; + break; + case 8: + returnVar = 10; + break; + case 9: + returnVar = 11; + break; + case 10: + returnVar = 12; + break; + case 12: + returnVar = 13; + break; + default: + returnVar = 0; + break; + } + return returnVar; +} + +bool8 sub_81B3608(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item; + + GetMonNickname(mon, gStringVar1); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + if (gUnknown_0203CEC8.unk8_0 != 12) + { + sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.unk9, sub_81B353C(mon)); + sub_81B31B0(0); + display_pokemon_menu_message(21); + } + else + { + item = GetMonData(mon, MON_DATA_HELD_ITEM); + if (item != ITEM_NONE) + { + sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.unk9, sub_81B353C(mon)); + sub_81B31B0(1); + CopyItemName(item, gStringVar2); + display_pokemon_menu_message(26); + } + else + { + StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B469C; + return FALSE; + } + } + return TRUE; +} + +void sub_81B36FC(u8 taskId) +{ + if (sub_81B3608(taskId) != FALSE) + { + gTasks[taskId].data[0] = 0xFF; + gTasks[taskId].func = sub_81B3730; + } +} + +void sub_81B3730(u8 taskId) +{ + s16 *data; + s8 input; + + if (gPaletteFade.active == FALSE && sub_81221EC() != TRUE) + { + data = gTasks[taskId].data; + if (gUnknown_0203CEC4->unk17 <= 3) + input = Menu_ProcessInputNoWrapAround_other(); + else + input = ProcessMenuInput_other(); + data[0] = GetMenuCursorPos(); + if (input != -2) + { + if (input == -1) + { + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[2]); + gUnknown_08615C08[gUnknown_0203CEC4->unkF[gUnknown_0203CEC4->unk17 - 1]].func(taskId); + } + else + { + sub_81B302C(&gUnknown_0203CEC4->unkC[2]); + gUnknown_08615C08[gUnknown_0203CEC4->unkF[input]].func(taskId); + } + } + } +} + +void sub_81B37FC(u8 taskId) +{ + PlaySE(SE_SELECT); + gUnknown_0203CEC4->unk4 = sub_81B3828; + sub_81B12C0(taskId); +} + +void sub_81B3828(void) +{ + if (gUnknown_0203CEC8.unk8_0 == 1) + { + pokemon_change_order(); + ShowPokemonSummaryScreen(PSS_MODE_UNK1, gPlayerParty, gUnknown_0203CEC8.unk9, gPlayerPartyCount - 1, sub_81B3894); + } + else + { + ShowPokemonSummaryScreen(PSS_MODE_NORMAL, gPlayerParty, gUnknown_0203CEC8.unk9, gPlayerPartyCount - 1, sub_81B3894); + } +} + +void sub_81B3894(void) +{ + gPaletteFade.bufferTransferDisabled = TRUE; + gUnknown_0203CEC8.unk9 = gUnknown_0203CF20; + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.unk0); +} + +void brm_switch(u8 taskId) +{ + PlaySE(SE_SELECT); + gUnknown_0203CEC8.unkB = 8; + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + display_pokemon_menu_message(3); + sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); + gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.unk9; + gTasks[taskId].func = sub_81B1370; +} + +void sub_81B3938(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + u8 windowIds[2]; + + if (gUnknown_0203CEC8.unkA == gUnknown_0203CEC8.unk9) + { + sub_81B407C(taskId); + } + else + { + windowIds[0] = gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unk8; + data[0] = GetWindowAttribute(windowIds[0], WINDOW_TILEMAP_LEFT); + data[1] = GetWindowAttribute(windowIds[0], WINDOW_TILEMAP_TOP); + data[2] = GetWindowAttribute(windowIds[0], WINDOW_WIDTH); + data[3] = GetWindowAttribute(windowIds[0], WINDOW_HEIGHT); + data[8] = 0; + if (data[2] == 10) + data[10] = -1; + else + data[10] = 1; + windowIds[1] = gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].unk8; + data[4] = GetWindowAttribute(windowIds[1], WINDOW_TILEMAP_LEFT); + data[5] = GetWindowAttribute(windowIds[1], WINDOW_TILEMAP_TOP); + data[6] = GetWindowAttribute(windowIds[1], WINDOW_WIDTH); + data[7] = GetWindowAttribute(windowIds[1], WINDOW_HEIGHT); + data[9] = 0; + if (data[6] == 10) + data[11] = -1; + else + data[11] = 1; + gUnknown_0203CEF0 = Alloc(data[2] * (data[3] << 1)); + gUnknown_0203CEF4 = Alloc(data[6] * (data[7] << 1)); + sub_8199CBC(0, gUnknown_0203CEF0, data[0], data[1], data[2], data[3]); + sub_8199CBC(0, gUnknown_0203CEF4, data[4], data[5], data[6], data[7]); + ClearWindowTilemap(windowIds[0]); + ClearWindowTilemap(windowIds[1]); + gUnknown_0203CEC8.unkB = 9; + sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); + sub_81B0FCC(gUnknown_0203CEC8.unkA, 1); + sub_81B3CC0(taskId); + gTasks[taskId].func = sub_81B3D48; + } +} + +#ifdef NONMATCHING +bool8 sub_81B3AD8(s16 a, s16 b, u8 *c, u8 *d, u8 *e) +{ + + if ((a + b) < 0 || a > 31) + { + return FALSE; + } + if (a < 0) + { + *c = -a; + *d = 0; + *e = a + b; + return TRUE; + } + else + { + *c = 0; + *d = a; + if ((a + b) > 31) + *e = 32 - a; + else + *e = b; + return TRUE; + } + +} +#else +NAKED +bool8 sub_81B3AD8(s16 a, s16 b, u8 *c, u8 *d, u8 *e) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + adds r6, r2, 0\n\ + mov r12, r3\n\ + ldr r7, [sp, 0x18]\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + adds r5, r3, 0\n\ + lsls r1, 16\n\ + lsrs r2, r1, 16\n\ + mov r8, r2\n\ + lsls r0, r3, 16\n\ + asrs r1, r0, 16\n\ + lsls r0, r2, 16\n\ + asrs r0, 16\n\ + adds r4, r1, r0\n\ + cmp r4, 0\n\ + blt _081B3B02\n\ + cmp r1, 0x1F\n\ + ble _081B3B06\n\ +_081B3B02:\n\ + movs r0, 0\n\ + b _081B3B34\n\ +_081B3B06:\n\ + cmp r1, 0\n\ + bge _081B3B1A\n\ + negs r0, r1\n\ + strb r0, [r6]\n\ + movs r0, 0\n\ + mov r1, r12\n\ + strb r0, [r1]\n\ + adds r0, r2, r3\n\ + strb r0, [r7]\n\ + b _081B3B32\n\ +_081B3B1A:\n\ + movs r0, 0\n\ + strb r0, [r6]\n\ + mov r0, r12\n\ + strb r5, [r0]\n\ + cmp r4, 0x1F\n\ + ble _081B3B2E\n\ + movs r0, 0x20\n\ + subs r0, r5\n\ + strb r0, [r7]\n\ + b _081B3B32\n\ +_081B3B2E:\n\ + mov r1, r8\n\ + strb r1, [r7]\n\ +_081B3B32:\n\ + movs r0, 0x1\n\ +_081B3B34:\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n"); +} +#endif + +void sub_81B3B40(const void *rectSrc, s16 a, s16 b, s16 c, s16 d, s16 e) +{ + u8 f, g, h; + + if (sub_81B3AD8(a, c, &f, &g, &h) != FALSE) + { + FillBgTilemapBufferRect_Palette0(0, 0, g, b, h, d); + if (sub_81B3AD8(a + e, c, &f, &g, &h) != FALSE) + CopyRectToBgTilemapBufferRect(0, rectSrc, f, 0, c, d, g, b, h, d, 17, 0, 0); + } +} + +void sub_81B3C0C(struct Unk_203CEDC *ptr, s16 a) +{ + gSprites[ptr->unkB].pos2.x += a * 8; + gSprites[ptr->unkA].pos2.x += a * 8; + gSprites[ptr->unk9].pos2.x += a * 8; + gSprites[ptr->unkC].pos2.x += a * 8; +} + +void sub_81B3C60(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[10] != 0) + sub_81B3C0C(&gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], data[10]); + if (data[11] != 0) + sub_81B3C0C(&gUnknown_0203CEDC[gUnknown_0203CEC8.unkA], data[11]); +} + +void sub_81B3CC0(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[10] != 0) + sub_81B3B40(gUnknown_0203CEF0, data[0] + data[8], data[1], data[2], data[3], data[10]); + if (data[11] != 0) + sub_81B3B40(gUnknown_0203CEF4, data[4] + data[9], data[5], data[6], data[7], data[11]); + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_81B3D48(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + u16 tilemapRelatedMaybe[2]; + + sub_81B3CC0(taskId); + sub_81B3C60(taskId); + data[8] += data[10]; + data[9] += data[11]; + tilemapRelatedMaybe[0] = data[0] + data[8]; + tilemapRelatedMaybe[1] = data[4] + data[9]; + if (tilemapRelatedMaybe[0] > 33 && tilemapRelatedMaybe[1] > 33) + { + data[10] *= -1; + data[11] *= -1; + swap_pokemon_and_oams(); + sub_81B0948(gUnknown_0203CEC8.unk9); + sub_81B0948(gUnknown_0203CEC8.unkA); + PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unk8); + PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].unk8); + sub_8199CBC(0, gUnknown_0203CEF0, data[0], data[1], data[2], data[3]); + sub_8199CBC(0, gUnknown_0203CEF4, data[4], data[5], data[6], data[7]); + ClearWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unk8); + ClearWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].unk8); + gTasks[taskId].func = sub_81B3E60; + } +} + +void sub_81B3E60(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + sub_81B3CC0(taskId); + sub_81B3C60(taskId); + if (data[10] == 0 && data[11] == 0) + { + PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unk8); + PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].unk8); + schedule_bg_copy_tilemap_to_vram(0); + Free(gUnknown_0203CEF0); + Free(gUnknown_0203CEF4); + sub_81B407C(taskId); + } + else + { + data[8] += data[10]; + data[9] += data[11]; + if (data[8] == 0) + data[10] = 0; + if (data[9] == 0) + data[11] = 0; + } +} + +void oamt_swap_pos(u8 *spriteIdPtr1, u8 *spriteIdPtr2) +{ + u8 spriteIdBuffer = *spriteIdPtr1; + u16 xBuffer1, yBuffer1, xBuffer2, yBuffer2; + + *spriteIdPtr1 = *spriteIdPtr2; + *spriteIdPtr2 = spriteIdBuffer; + xBuffer1 = gSprites[*spriteIdPtr1].pos1.x; + yBuffer1 = gSprites[*spriteIdPtr1].pos1.y; + xBuffer2 = gSprites[*spriteIdPtr1].pos2.x; + yBuffer2 = gSprites[*spriteIdPtr1].pos2.y; + gSprites[*spriteIdPtr1].pos1.x = gSprites[*spriteIdPtr2].pos1.x; + gSprites[*spriteIdPtr1].pos1.y = gSprites[*spriteIdPtr2].pos1.y; + gSprites[*spriteIdPtr1].pos2.x = gSprites[*spriteIdPtr2].pos2.x; + gSprites[*spriteIdPtr1].pos2.y = gSprites[*spriteIdPtr2].pos2.y; + gSprites[*spriteIdPtr2].pos1.x = xBuffer1; + gSprites[*spriteIdPtr2].pos1.y = yBuffer1; + gSprites[*spriteIdPtr2].pos2.x = xBuffer2; + gSprites[*spriteIdPtr2].pos2.y = yBuffer2; +} + +void swap_pokemon_and_oams(void) +{ + struct Unk_203CEDC *structPtrs[2]; + struct Pokemon *mon1, *mon2; + struct Pokemon *monBuffer; + + structPtrs[0] = &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]; + structPtrs[1] = &gUnknown_0203CEDC[gUnknown_0203CEC8.unkA]; + mon1 = &gPlayerParty[gUnknown_0203CEC8.unk9]; + mon2 = &gPlayerParty[gUnknown_0203CEC8.unkA]; + monBuffer = Alloc(sizeof(struct Pokemon)); + *monBuffer = *mon1; + *mon1 = *mon2; + *mon2 = *monBuffer; + Free(monBuffer); + oamt_swap_pos(&structPtrs[0]->unkB, &structPtrs[1]->unkB); + oamt_swap_pos(&structPtrs[0]->unkA, &structPtrs[1]->unkA); + oamt_swap_pos(&structPtrs[0]->unk9, &structPtrs[1]->unk9); + oamt_swap_pos(&structPtrs[0]->unkC, &structPtrs[1]->unkC); +} + +void sub_81B407C(u8 taskId) +{ + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + gUnknown_0203CEC8.unkB = 0; + sub_81B0FCC(gUnknown_0203CEC8.unk9, 0); + gUnknown_0203CEC8.unk9 = gUnknown_0203CEC8.unkA; + sub_81B0FCC(gUnknown_0203CEC8.unkA, 1); + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; +} + +void brm_cancel_1(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + if (gUnknown_0203CEC8.unk8_0 == 6) + display_pokemon_menu_message(15); + else + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; +} From 2265d49ac2e8868e0b3362f8e7a4d22355eed202 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 12 Dec 2018 22:55:39 -0500 Subject: [PATCH 07/17] decompiled up to sub_81B5A8C --- asm/party_menu.s | 2870 ----------------------------------- include/easy_chat.h | 3 + include/fldeff_softboiled.h | 1 + include/item_menu.h | 1 + include/link_rfu.h | 1 + include/pokemon_icon.h | 2 + include/region_map.h | 1 + include/rom_8011DC0.h | 4 + include/strings.h | 16 + include/trade.h | 5 + src/party_menu.c | 953 +++++++++++- 11 files changed, 971 insertions(+), 2886 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index 17ebaab51..cebbff264 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,2876 +5,6 @@ .text - thumb_func_start sub_81B4134 -sub_81B4134: @ 81B4134 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gPlayerParty - ldr r1, =gUnknown_0203CEC8 - ldrb r1, [r1, 0x9] - movs r2, 0x8 - bl sub_81B33B4 - movs r0, 0x1 - bl sub_81B31B0 - movs r0, 0x18 - bl display_pokemon_menu_message - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0xFF - strh r1, [r0, 0x8] - ldr r1, =sub_81B3730 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4134 - - thumb_func_start sub_81B4198 -sub_81B4198: @ 81B4198 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B41C4 - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4198 - - thumb_func_start sub_81B41C4 -sub_81B41C4: @ 81B41C4 - push {lr} - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _081B41E0 - ldr r2, =c2_8123744 - movs r0, 0x2 - movs r1, 0x5 - bl GoToBagMenu - b _081B41E8 - .pool -_081B41E0: - ldr r1, =c2_8123744 - movs r0, 0x2 - bl sub_81C4F98 -_081B41E8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B41C4 - - thumb_func_start c2_8123744 -c2_8123744: @ 81B41F0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - ldr r6, =gSpecialVar_ItemId - ldrh r0, [r6] - cmp r0, 0 - bne _081B4224 - ldr r3, =gUnknown_0203CEC8 - ldrb r0, [r3, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r3, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B36FC - str r1, [sp, 0x4] - ldr r1, [r3] - b _081B425A - .pool -_081B4224: - ldr r4, =gUnknown_0203CEFC - ldr r5, =gUnknown_0203CEC8 - movs r0, 0x9 - ldrsb r0, [r5, r0] - movs r1, 0x64 - mov r8, r1 - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - ldr r7, =gPlayerParty - adds r0, r7 - movs r1, 0xC - bl GetMonData - strh r0, [r4] - lsls r0, 16 - cmp r0, 0 - beq _081B4278 - ldrb r0, [r5, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r5, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B4350 - str r1, [sp, 0x4] - ldr r1, [r5] -_081B425A: - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 - b _081B42C0 - .pool -_081B4278: - ldrh r0, [r6] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B42A4 - ldrh r0, [r6] - movs r1, 0x1 - bl RemoveBagItem - movs r0, 0x9 - ldrsb r0, [r5, r0] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r7 - ldrh r1, [r6] - bl sub_81B1DB8 - bl sub_81B452C - b _081B42C0 -_081B42A4: - ldrb r0, [r5, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r5, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B42D0 - str r1, [sp, 0x4] - ldr r1, [r5] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 -_081B42C0: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end c2_8123744 - - thumb_func_start sub_81B42D0 -sub_81B42D0: @ 81B42D0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B432C - ldr r0, =gSpecialVar_ItemId - ldrh r4, [r0] - ldr r0, =gUnknown_0203CEC8 - mov r8, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0 - bl sub_81B1C84 - mov r1, r8 - movs r0, 0x9 - ldrsb r0, [r1, r0] - muls r0, r6 - adds r0, r5 - adds r1, r4, 0 - bl sub_81B1DB8 - adds r0, r4, 0 - movs r1, 0x1 - bl RemoveBagItem - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - str r1, [r0] -_081B432C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B42D0 - - thumb_func_start sub_81B4350 -sub_81B4350: @ 81B4350 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B4388 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gUnknown_0203CEFC - ldrh r1, [r1] - movs r2, 0x1 - bl sub_81B1D1C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B43A8 - str r1, [r0] -_081B4388: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4350 - - thumb_func_start sub_81B43A8 -sub_81B43A8: @ 81B43A8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B43CC - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B43DC - str r0, [r1] -_081B43CC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B43A8 - - thumb_func_start sub_81B43DC -sub_81B43DC: @ 81B43DC - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B4402 - cmp r1, 0 - bgt _081B43FC - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B44D8 - b _081B44EC -_081B43FC: - cmp r1, 0x1 - beq _081B44DE - b _081B44EC -_081B4402: - ldr r5, =gSpecialVar_ItemId - ldrh r0, [r5] - movs r1, 0x1 - bl RemoveBagItem - ldr r6, =gUnknown_0203CEFC - ldrh r0, [r6] - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - cmp r0, 0 - bne _081B4458 - ldrh r0, [r5] - movs r1, 0x1 - bl AddBagItem - ldrh r0, [r6] - bl pokemon_item_not_removed - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] - b _081B44EC - .pool -_081B4458: - ldrh r0, [r5] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B4498 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldrh r1, [r5] - bl sub_81B1DB8 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B44FC - str r1, [r0] - b _081B44EC - .pool -_081B4498: - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldrh r1, [r5] - bl sub_81B1DB8 - ldrh r0, [r5] - ldrh r1, [r6] - movs r2, 0x1 - bl sub_81B1D68 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - str r1, [r0] - b _081B44EC - .pool -_081B44D8: - movs r0, 0x5 - bl PlaySE -_081B44DE: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1C1C - str r0, [r1] -_081B44EC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B43DC - - thumb_func_start sub_81B44FC -sub_81B44FC: @ 81B44FC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B451C - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B452C - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 -_081B451C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B44FC - - thumb_func_start sub_81B452C -sub_81B452C: @ 81B452C - push {lr} - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x40 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSaveBlock1Ptr - lsls r2, r0, 3 - adds r2, r0 - lsls r2, 2 - ldr r0, =0x00002be0 - adds r2, r0 - ldr r1, [r1] - adds r1, r2 - ldr r2, =sub_81B4578 - movs r0, 0x4 - movs r3, 0x3 - bl sub_811A20C - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B452C - - thumb_func_start sub_81B4578 -sub_81B4578: @ 81B4578 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - ldr r6, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r6, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =gSpecialVar_Result - ldrh r7, [r0] - cmp r7, 0 - bne _081B45F8 - adds r0, r5, 0 - bl TakeMailFromMon - ldr r4, =gUnknown_0203CEFC - adds r0, r5, 0 - movs r1, 0xC - adds r2, r4, 0 - bl SetMonData - ldrh r0, [r4] - movs r1, 0x1 - bl RemoveBagItem - mov r0, r8 - movs r1, 0x1 - bl AddBagItem - ldrb r0, [r6, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r6, 0xB] - str r7, [sp] - ldr r1, =sub_81B36FC - str r1, [sp, 0x4] - ldr r1, [r6] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 - b _081B4614 - .pool -_081B45F8: - ldrb r0, [r6, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r6, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B4624 - str r1, [sp, 0x4] - ldr r1, [r6] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 -_081B4614: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4578 - - thumb_func_start sub_81B4624 -sub_81B4624: @ 81B4624 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B468A - ldr r1, =gUnknown_0203CEFC - ldrh r0, [r1] - cmp r0, 0 - bne _081B4670 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gSpecialVar_ItemId - ldrh r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_81B1C84 - b _081B467C - .pool -_081B4670: - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldrh r1, [r1] - movs r2, 0 - bl sub_81B1D68 -_081B467C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B469C - str r0, [r1] -_081B468A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4624 - - thumb_func_start sub_81B469C -sub_81B469C: @ 81B469C - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r4, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B471C - ldr r5, =gUnknown_0203CEDC - movs r0, 0x9 - ldrsb r0, [r4, r0] - lsls r0, 4 - ldr r1, [r5] - adds r1, r0 - adds r0, r6, 0 - bl sub_81B5C94 - ldrb r1, [r4, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xC - bne _081B4716 - adds r0, r6, 0 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - beq _081B4704 - movs r0, 0x9 - ldrsb r0, [r4, r0] - lsls r0, 4 - ldr r1, [r5] - adds r1, r0 - movs r0, 0xB - movs r2, 0x1 - bl sub_81B2FA8 - b _081B4716 - .pool -_081B4704: - movs r0, 0x9 - ldrsb r0, [r4, r0] - lsls r0, 4 - ldr r1, [r5] - adds r1, r0 - movs r0, 0xC - movs r2, 0x1 - bl sub_81B2FA8 -_081B4716: - adds r0, r7, 0 - bl sub_81B1C1C -_081B471C: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B469C - - thumb_func_start sub_81B4724 -sub_81B4724: @ 81B4724 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r6, r0, 16 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81B1E00 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081B4788 - cmp r0, 0x1 - beq _081B47AC - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x1 - bl sub_81B1CD0 - b _081B47BA - .pool -_081B4788: - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnNotHolding - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - b _081B47B4 - .pool -_081B47AC: - adds r0, r6, 0 - bl pokemon_item_not_removed - ldr r0, =gStringVar4 -_081B47B4: - movs r1, 0x1 - bl sub_81B1B5C -_081B47BA: - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B469C - str r0, [r1] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4724 - - thumb_func_start sub_81B47E0 -sub_81B47E0: @ 81B47E0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r0, r7, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - cmp r5, 0 - bne _081B4864 - ldr r1, =gStringVar1 - adds r0, r7, 0 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnNotHolding - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - b _081B488A - .pool -_081B4864: - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_ThrowAwayItem - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B48A8 -_081B488A: - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B47E0 - - thumb_func_start sub_81B48A8 -sub_81B48A8: @ 81B48A8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B48CC - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B48DC - str r0, [r1] -_081B48CC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B48A8 - - thumb_func_start sub_81B48DC -sub_81B48DC: @ 81B48DC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B491A - cmp r1, 0 - bgt _081B4914 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B4964 - b _081B4978 - .pool -_081B4914: - cmp r1, 0x1 - beq _081B496A - b _081B4978 -_081B491A: - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gStringVar1 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_ItemThrownAway - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B4988 - str r1, [r0] - b _081B4978 - .pool -_081B4964: - movs r0, 0x5 - bl PlaySE -_081B496A: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1C1C - str r0, [r1] -_081B4978: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B48DC - - thumb_func_start sub_81B4988 -sub_81B4988: @ 81B4988 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r6, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r6, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B49EC - movs r1, 0 - mov r0, sp - strh r1, [r0] - adds r0, r5, 0 - movs r1, 0xC - mov r2, sp - bl SetMonData - ldr r4, =gUnknown_0203CEDC - movs r0, 0x9 - ldrsb r0, [r6, r0] - lsls r0, 4 - ldr r1, [r4] - adds r1, r0 - adds r0, r5, 0 - bl sub_81B5C94 - movs r0, 0x9 - ldrsb r0, [r6, r0] - lsls r0, 4 - ldr r1, [r4] - adds r1, r0 - movs r0, 0xC - movs r2, 0x1 - bl sub_81B2FA8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B49EC: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4988 - - thumb_func_start sub_81B4A08 -sub_81B4A08: @ 81B4A08 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gPlayerParty - ldr r1, =gUnknown_0203CEC8 - ldrb r1, [r1, 0x9] - movs r2, 0x9 - bl sub_81B33B4 - movs r0, 0x2 - bl sub_81B31B0 - movs r0, 0x19 - bl display_pokemon_menu_message - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0xFF - strh r1, [r0, 0x8] - ldr r1, =sub_81B3730 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4A08 - - thumb_func_start sub_81B4A6C -sub_81B4A6C: @ 81B4A6C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B4A98 - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4A6C - - thumb_func_start sub_81B4A98 -sub_81B4A98: @ 81B4A98 - push {lr} - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x40 - bl GetMonData - ldr r2, =gSaveBlock1Ptr - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =0x00002be0 - adds r1, r0 - ldr r0, [r2] - adds r0, r1 - ldr r1, =sub_81B4AE0 - movs r2, 0x1 - bl ReadMail - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4A98 - - thumb_func_start sub_81B4AE0 -sub_81B4AE0: @ 81B4AE0 - push {lr} - sub sp, 0xC - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r3, =gUnknown_0203CEC8 - ldrb r0, [r3, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r3, 0xB] - movs r1, 0x15 - str r1, [sp] - ldr r1, =sub_81B36FC - str r1, [sp, 0x4] - ldr r1, [r3] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4AE0 - - thumb_func_start brm_take_2 -brm_take_2: @ 81B4B20 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203CEC4 - ldr r0, [r5] - adds r0, 0xD - bl sub_81B302C - ldr r0, [r5] - adds r0, 0xC - bl sub_81B302C - ldr r0, =gText_SendMailToPC - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B4B6C - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end brm_take_2 - - thumb_func_start sub_81B4B6C -sub_81B4B6C: @ 81B4B6C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B4B90 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B4BA0 - str r0, [r1] -_081B4B90: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4B6C - - thumb_func_start sub_81B4BA0 -sub_81B4BA0: @ 81B4BA0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B4BC6 - cmp r1, 0 - bgt _081B4BC0 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B4C30 - b _081B4C4C -_081B4BC0: - cmp r1, 0x1 - beq _081B4C36 - b _081B4C4C -_081B4BC6: - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl TakeMailFromMon2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _081B4C0C - ldr r0, =gText_MailSentToPC - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - b _081B4C4A - .pool -_081B4C0C: - ldr r0, =gText_PCMailboxFull - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - b _081B4C4A - .pool -_081B4C30: - movs r0, 0x5 - bl PlaySE -_081B4C36: - ldr r0, =gText_MailMessageWillBeLost - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B4C60 -_081B4C4A: - str r1, [r0] -_081B4C4C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4BA0 - - thumb_func_start sub_81B4C60 -sub_81B4C60: @ 81B4C60 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B4C84 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B4C94 - str r0, [r1] -_081B4C84: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4C60 - - thumb_func_start sub_81B4C94 -sub_81B4C94: @ 81B4C94 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B4CBE - cmp r1, 0 - bgt _081B4CB8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B4D50 - b _081B4D64 -_081B4CB8: - cmp r1, 0x1 - beq _081B4D56 - b _081B4D64 -_081B4CBE: - ldr r0, =gUnknown_0203CEC8 - mov r8, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r7, 0x64 - muls r0, r7 - ldr r6, =gPlayerParty - adds r0, r6 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B4D24 - mov r1, r8 - movs r0, 0x9 - ldrsb r0, [r1, r0] - muls r0, r7 - adds r0, r6 - bl TakeMailFromMon - ldr r0, =gText_MailTakenFromPkmn - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - str r1, [r0] - b _081B4D64 - .pool -_081B4D24: - adds r0, r4, 0 - bl pokemon_item_not_removed - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] - b _081B4D64 - .pool -_081B4D50: - movs r0, 0x5 - bl PlaySE -_081B4D56: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1C1C - str r0, [r1] -_081B4D64: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4C94 - - thumb_func_start sub_81B4D78 -sub_81B4D78: @ 81B4D78 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r5, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r5, r1] - movs r0, 0x64 - muls r0, r1 - ldr r6, =gPlayerParty - adds r7, r0, r6 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldrb r4, [r5, 0x9] - adds r0, r7, 0 - bl sub_81B353C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_81B33B4 - ldrb r1, [r5, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xC - beq _081B4DE4 - movs r0, 0 - bl sub_81B31B0 - movs r0, 0x15 - bl display_pokemon_menu_message - b _081B4E02 - .pool -_081B4DE4: - movs r0, 0x1 - bl sub_81B31B0 - adds r0, r7, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gStringVar2 - bl CopyItemName - movs r0, 0x1A - bl display_pokemon_menu_message -_081B4E02: - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0xFF - strh r1, [r0, 0x8] - ldr r1, =sub_81B3730 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4D78 - - thumb_func_start brm_shift_sendout -brm_shift_sendout: @ 81B4E2C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203CEC4 - ldr r0, [r5] - adds r0, 0xC - bl sub_81B302C - bl sub_81B8A7C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B4E5C - adds r0, r4, 0 - bl sub_81B12C0 - b _081B4E7A - .pool -_081B4E5C: - ldr r0, [r5] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gStringVar4 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B4E7A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end brm_shift_sendout - - thumb_func_start sub_81B4E8C -sub_81B4E8C: @ 81B4E8C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - bl sub_81B8830 - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - cmp r5, r6 - bcs _081B4F36 - ldr r2, =gUnknown_0203CEC8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - mov r8, r0 -_081B4EC6: - ldr r0, =gSelectedOrderFromParty - adds r4, r5, r0 - ldrb r0, [r4] - cmp r0, 0 - bne _081B4F2C - movs r0, 0x5 - str r2, [sp] - bl PlaySE - ldr r2, [sp] - ldrb r0, [r2, 0x9] - adds r0, 0x1 - strb r0, [r4] - adds r0, r5, 0x2 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CEDC - ldrb r2, [r2, 0x9] - lsls r2, 24 - asrs r2, 24 - lsls r2, 4 - ldr r1, [r1] - adds r1, r2 - movs r2, 0x1 - bl sub_81B2FA8 - subs r0, r6, 0x1 - cmp r5, r0 - bne _081B4F04 - bl sub_81B4F88 -_081B4F04: - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =sub_81B1370 - mov r1, r8 - str r0, [r1] - b _081B4F68 - .pool -_081B4F2C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r6 - bcc _081B4EC6 -_081B4F36: - ldr r0, =gStringVar1 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_NoMoreThanVar1Pkmn - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x20 - bl PlaySE - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B4F68: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4E8C - - thumb_func_start sub_81B4F88 -sub_81B4F88: @ 81B4F88 - push {r4,lr} - ldr r4, =gUnknown_0203CEC8 - ldrb r0, [r4, 0x9] - movs r1, 0 - bl sub_81B0FCC - movs r0, 0x6 - strb r0, [r4, 0x9] - movs r1, 0x1 - bl sub_81B0FCC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4F88 - - thumb_func_start sub_81B4FA8 -sub_81B4FA8: @ 81B4FA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - bl sub_81B8830 - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - cmp r4, r5 - bcs _081B502A - ldr r6, =gSelectedOrderFromParty - subs r2, r5, 0x1 - adds r7, r6, 0 - ldr r3, =gUnknown_0203CEC8 -_081B4FE2: - adds r0, r4, r6 - ldrb r1, [r0] - movs r0, 0x9 - ldrsb r0, [r3, r0] - adds r0, 0x1 - cmp r1, r0 - bne _081B5020 - adds r0, r4, 0 - adds r4, r2, 0 - cmp r0, r4 - bge _081B500C - adds r3, r7, 0 -_081B4FFA: - adds r2, r0, r3 - adds r1, r0, 0x1 - adds r0, r1, r3 - ldrb r0, [r0] - strb r0, [r2] - lsls r1, 24 - lsrs r0, r1, 24 - cmp r0, r4 - blt _081B4FFA -_081B500C: - adds r1, r0, r6 - movs r0, 0 - strb r0, [r1] - b _081B502A - .pool -_081B5020: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _081B4FE2 -_081B502A: - ldr r6, =gUnknown_0203CEDC - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - lsls r0, 4 - ldr r1, [r6] - adds r1, r0 - movs r0, 0x1 - movs r2, 0x1 - bl sub_81B2FA8 - movs r4, 0 - subs r5, 0x1 - mov r0, r8 - lsls r7, r0, 2 - cmp r4, r5 - bge _081B5078 -_081B504E: - ldr r0, =gSelectedOrderFromParty - adds r1, r4, r0 - ldrb r0, [r1] - cmp r0, 0 - beq _081B506E - adds r0, r4, 0x2 - lsls r0, 24 - lsrs r0, 24 - ldrb r2, [r1] - lsls r2, 4 - subs r2, 0x10 - ldr r1, [r6] - adds r1, r2 - movs r2, 0x1 - bl sub_81B2FA8 -_081B506E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - blt _081B504E -_081B5078: - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =gTasks - mov r2, r8 - adds r1, r7, r2 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 - str r0, [r1] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4FA8 - - thumb_func_start sub_81B50AC -sub_81B50AC: @ 81B50AC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B12C0 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B50AC - - thumb_func_start sub_81B50C8 -sub_81B50C8: @ 81B50C8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - mov r9, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r1, 0x64 - mov r8, r1 - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x41 - bl GetMonData - adds r6, r0, 0 - lsls r6, 16 - lsrs r6, 16 - mov r1, r9 - movs r0, 0x9 - ldrsb r0, [r1, r0] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - mov r1, r9 - movs r0, 0x9 - ldrsb r0, [r1, r0] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r4 - movs r1, 0x50 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_800F7DC - ldr r0, [r0] - adds r1, r6, 0 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_807A8D0 - cmp r0, 0x1 - beq _081B515C - cmp r0, 0x2 - beq _081B5170 - movs r0, 0x5 - bl PlaySE - adds r0, r7, 0 - bl sub_81B12C0 - b _081B51B0 - .pool -_081B515C: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnCantBeTradedNow - bl StringExpandPlaceholders - b _081B5178 - .pool -_081B5170: - ldr r0, =gStringVar4 - ldr r1, =gText_EggCantBeTradedNow - bl StringExpandPlaceholders -_081B5178: - movs r0, 0x20 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r4, =gStringVar4 - ldr r1, =gText_PauseUntilPress - adds r0, r4, 0 - bl StringAppend - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B51B0: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B50C8 - - thumb_func_start brm_trade_1 -brm_trade_1: @ 81B51D4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - mov r8, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r6, 0x64 - muls r0, r6 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x41 - bl GetMonData - mov r9, r0 - mov r1, r9 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - mov r1, r8 - movs r0, 0x9 - ldrsb r0, [r1, r0] - muls r0, r6 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - mov r1, r8 - movs r0, 0x9 - ldrsb r0, [r1, r0] - muls r0, r6 - adds r0, r4 - movs r1, 0x50 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_800F7DC - ldr r0, [r0] - ldr r1, =gUnknown_02022C38 - ldr r1, [r1] - ldr r2, =gUnknown_02022C3C - ldrh r3, [r2] - ldr r2, =gUnknown_02022C3E - ldrb r2, [r2] - str r2, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - mov r2, r9 - bl sub_807A7E0 - cmp r0, 0 - beq _081B52C8 - ldr r5, =gStringVar4 - ldr r1, =gUnknown_08615E0C - subs r0, 0x1 - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl StringExpandPlaceholders - movs r0, 0x20 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r1, =gText_PauseUntilPress - adds r0, r5, 0 - bl StringAppend - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] - b _081B52D4 - .pool -_081B52C8: - movs r0, 0x5 - bl PlaySE - adds r0, r7, 0 - bl sub_81B12C0 -_081B52D4: - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end brm_trade_1 - - thumb_func_start sub_81B52E4 -sub_81B52E4: @ 81B52E4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gPlayerParty - ldr r1, =gUnknown_0203CEC8 - ldrb r1, [r1, 0x9] - lsls r1, 24 - asrs r1, 24 - lsls r1, 16 - lsrs r1, 16 - bl sub_807A918 - cmp r0, 0x2 - beq _081B5340 - cmp r0, 0x2 - bgt _081B5328 - cmp r0, 0x1 - beq _081B532E - b _081B5368 - .pool -_081B5328: - cmp r0, 0x3 - beq _081B5354 - b _081B5368 -_081B532E: - ldr r0, =gStringVar4 - ldr r1, =gText_OnlyPkmnForBattle - bl StringExpandPlaceholders - b _081B53C0 - .pool -_081B5340: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnCantBeTradedNow - bl StringExpandPlaceholders - b _081B53C0 - .pool -_081B5354: - ldr r0, =gStringVar4 - ldr r1, =gText_EggCantBeTradedNow - bl StringExpandPlaceholders - b _081B53C0 - .pool -_081B5368: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gJPText_PutVar1IntoSpinner - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B53FC - b _081B53E4 - .pool -_081B53C0: - movs r0, 0x20 - bl PlaySE - ldr r4, =gStringVar4 - ldr r1, =gText_PauseUntilPress - adds r0, r4, 0 - bl StringAppend - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C -_081B53E4: - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B52E4 - - thumb_func_start sub_81B53FC -sub_81B53FC: @ 81B53FC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B5420 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B5430 - str r0, [r1] -_081B5420: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B53FC - - thumb_func_start sub_81B5430 -sub_81B5430: @ 81B5430 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B5456 - cmp r1, 0 - bgt _081B5450 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B545E - b _081B546A -_081B5450: - cmp r1, 0x1 - beq _081B5464 - b _081B546A -_081B5456: - adds r0, r4, 0 - bl sub_81B12C0 - b _081B546A -_081B545E: - movs r0, 0x5 - bl PlaySE -_081B5464: - adds r0, r4, 0 - bl sub_81B1C1C -_081B546A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B5430 - - thumb_func_start sub_81B5470 -sub_81B5470: @ 81B5470 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - bl GetMenuCursorPos - ldr r5, =gUnknown_0203CEC4 - ldr r1, [r5] - lsls r0, 24 - lsrs r0, 24 - adds r1, 0xF - adds r1, r0 - ldrb r0, [r1] - subs r0, 0x13 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x5 - bl PlaySE - ldr r1, =gUnknown_08615D9C - lsls r0, r4, 3 - adds r7, r0, r1 - ldr r0, [r7] - cmp r0, 0 - bne _081B54A2 - b _081B5664 -_081B54A2: - ldr r0, [r5] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r5] - adds r0, 0xD - bl sub_81B302C - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B54C6 - bl InUnionRoom - cmp r0, 0x1 - bne _081B54E8 -_081B54C6: - adds r0, r4, 0 - subs r0, 0xB - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081B54E4 - movs r0, 0xD - bl display_pokemon_menu_message - b _081B5656 - .pool -_081B54E4: - ldrb r0, [r7, 0x4] - b _081B5652 -_081B54E8: - cmp r4, 0x7 - bhi _081B5524 - ldr r1, =0x00000867 - adds r0, r4, r1 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B5524 - ldr r0, =gText_CantUseUntilNewBadge - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] - b _081B5664 - .pool -_081B5524: - ldr r1, =gUnknown_08615D9C - lsls r0, r4, 3 - adds r5, r0, r1 - ldr r0, [r5] - bl _call_via_r0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B553A - b _081B563C -_081B553A: - subs r0, r4, 0x5 - cmp r0, 0x7 - bhi _081B5624 - lsls r0, 2 - ldr r1, =_081B5554 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B5554: - .4byte _081B5614 - .4byte _081B5624 - .4byte _081B5624 - .4byte _081B557C - .4byte _081B55B8 - .4byte _081B5624 - .4byte _081B5574 - .4byte _081B5574 -_081B5574: - adds r0, r6, 0 - bl sub_8161560 - b _081B5664 -_081B557C: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - movs r0, 0x1C - ldrsb r0, [r1, r0] - lsls r0, 16 - lsrs r0, 16 - ldrb r1, [r1, 0x1D] - lsls r1, 24 - asrs r1, 24 - lsls r1, 16 - lsrs r1, 16 - bl Overworld_GetMapHeaderByGroupAndId - adds r1, r0, 0 - ldr r0, =gStringVar1 - ldrb r1, [r1, 0x14] - bl sub_81245DC - ldr r0, =gStringVar4 - ldr r1, =gText_ReturnToHealingSpot - b _081B55E8 - .pool -_081B55B8: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - lsls r0, 16 - lsrs r0, 16 - adds r1, 0x25 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - lsls r1, 16 - lsrs r1, 16 - bl Overworld_GetMapHeaderByGroupAndId - adds r1, r0, 0 - ldr r0, =gStringVar1 - ldrb r1, [r1, 0x14] - bl sub_81245DC - ldr r0, =gStringVar4 - ldr r1, =gText_EscapeFromHere -_081B55E8: - bl StringExpandPlaceholders - adds r0, r6, 0 - bl sub_81B5674 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - movs r1, 0x86 - lsls r1, 2 - adds r0, r1 - strh r4, [r0] - b _081B5664 - .pool -_081B5614: - ldr r1, =gUnknown_0203CEC8 - ldr r0, =MCB2_FlyMap - b _081B5628 - .pool -_081B5624: - ldr r1, =gUnknown_0203CEC8 - ldr r0, =CB2_ReturnToField -_081B5628: - str r0, [r1] - adds r0, r6, 0 - bl sub_81B12C0 - b _081B5664 - .pool -_081B563C: - cmp r4, 0x1 - beq _081B564A - cmp r4, 0x4 - bne _081B5650 - bl sub_81B5864 - b _081B5656 -_081B564A: - bl sub_81B57DC - b _081B5656 -_081B5650: - ldrb r0, [r5, 0x4] -_081B5652: - bl display_pokemon_menu_message -_081B5656: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =task_brm_cancel_1_on_keypad_a_or_b - str r0, [r1] -_081B5664: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5470 - - thumb_func_start sub_81B5674 -sub_81B5674: @ 81B5674 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gStringVar4 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B56A4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5674 - - thumb_func_start sub_81B56A4 -sub_81B56A4: @ 81B56A4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B56C8 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B56D8 - str r0, [r1] -_081B56C8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B56A4 - - thumb_func_start sub_81B56D8 -sub_81B56D8: @ 81B56D8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B56FE - cmp r1, 0 - bgt _081B56F8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B5714 - b _081B572A -_081B56F8: - cmp r1, 0x1 - beq _081B571A - b _081B572A -_081B56FE: - ldr r1, =gUnknown_0203CEC8 - ldr r0, =CB2_ReturnToField - str r0, [r1] - adds r0, r4, 0 - bl sub_81B12C0 - b _081B572A - .pool -_081B5714: - movs r0, 0x5 - bl PlaySE -_081B571A: - ldr r0, =gFieldCallback2 - movs r1, 0 - str r1, [r0] - ldr r0, =gPostMenuFieldCallback - str r1, [r0] - adds r0, r4, 0 - bl sub_81B1C1C -_081B572A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B56D8 - - thumb_func_start FieldCallback_PrepareFadeInFromMenu -FieldCallback_PrepareFadeInFromMenu: @ 81B5738 - push {lr} - bl pal_fill_black - ldr r0, =task_launch_hm_phase_2 - movs r1, 0x8 - bl CreateTask - movs r0, 0x1 - pop {r1} - bx r1 - .pool - thumb_func_end FieldCallback_PrepareFadeInFromMenu - - thumb_func_start task_launch_hm_phase_2 -task_launch_hm_phase_2: @ 81B5750 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsWeatherNotFadingIn - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B577C - bl brm_get_selected_species - ldr r1, =gFieldEffectArguments - lsls r0, 16 - lsrs r0, 16 - str r0, [r1] - ldr r0, =gPostMenuFieldCallback - ldr r0, [r0] - bl _call_via_r0 - adds r0, r4, 0 - bl DestroyTask -_081B577C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_launch_hm_phase_2 - - thumb_func_start brm_get_selected_species -brm_get_selected_species: @ 81B578C - push {lr} - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - .pool - thumb_func_end brm_get_selected_species - - thumb_func_start task_brm_cancel_1_on_keypad_a_or_b -task_brm_cancel_1_on_keypad_a_or_b: @ 81B57B4 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081B57CE - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B57D4 -_081B57CE: - adds r0, r2, 0 - bl brm_cancel_1 -_081B57D4: - pop {r0} - bx r0 - .pool - thumb_func_end task_brm_cancel_1_on_keypad_a_or_b - - thumb_func_start sub_81B57DC -sub_81B57DC: @ 81B57DC - push {lr} - ldr r0, =0x00000888 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B57F8 - movs r0, 0xC - bl display_pokemon_menu_message - b _081B57FE - .pool -_081B57F8: - movs r0, 0xD - bl display_pokemon_menu_message -_081B57FE: - pop {r0} - bx r0 - thumb_func_end sub_81B57DC - - thumb_func_start hm_surf_run_dp02scr -hm_surf_run_dp02scr: @ 81B5804 - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - movs r0, 0x9 - bl FieldEffectStart - pop {r0} - bx r0 - .pool - thumb_func_end hm_surf_run_dp02scr - - thumb_func_start sub_81B5820 -sub_81B5820: @ 81B5820 - push {lr} - bl PartyHasMonWithSurf - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B585C - bl IsPlayerFacingSurfableFishableWater - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B585C - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =hm_surf_run_dp02scr - str r0, [r1] - movs r0, 0x1 - b _081B585E - .pool -_081B585C: - movs r0, 0 -_081B585E: - pop {r1} - bx r1 - thumb_func_end sub_81B5820 - - thumb_func_start sub_81B5864 -sub_81B5864: @ 81B5864 - push {lr} - movs r0, 0x8 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - beq _081B587A - movs r0, 0x9 - bl display_pokemon_menu_message - b _081B5880 -_081B587A: - movs r0, 0x8 - bl display_pokemon_menu_message -_081B5880: - pop {r0} - bx r0 - thumb_func_end sub_81B5864 - - thumb_func_start sub_81B5884 -sub_81B5884: @ 81B5884 - push {lr} - ldr r0, =gMapHeader - ldrb r0, [r0, 0x17] - bl Overworld_MapTypeAllowsTeleportAndFly - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B58A0 - movs r0, 0 - b _081B58A2 - .pool -_081B58A0: - movs r0, 0x1 -_081B58A2: - pop {r1} - bx r1 - thumb_func_end sub_81B5884 - - thumb_func_start sub_81B58A8 -sub_81B58A8: @ 81B58A8 - push {lr} - sub sp, 0xC - movs r0, 0 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =CB2_ReturnToFieldWithOpenMenu - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B58A8 - - thumb_func_start hm2_waterfall -hm2_waterfall: @ 81B58D4 - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - movs r0, 0x2B - bl FieldEffectStart - pop {r0} - bx r0 - .pool - thumb_func_end hm2_waterfall - - thumb_func_start hm_prepare_waterfall -hm_prepare_waterfall: @ 81B58F0 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsWaterfall - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B594C - bl IsPlayerSurfingNorth - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B594C - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =hm2_waterfall - str r0, [r1] - movs r0, 0x1 - b _081B594E - .pool -_081B594C: - movs r0, 0 -_081B594E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end hm_prepare_waterfall - - thumb_func_start sub_81B5958 -sub_81B5958: @ 81B5958 - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - movs r0, 0x2C - bl FieldEffectStart - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5958 - - thumb_func_start sub_81B5974 -sub_81B5974: @ 81B5974 - push {lr} - bl TrySetDiveWarp - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1, 0x4] - cmp r0, 0 - bne _081B5990 - movs r0, 0 - b _081B599E - .pool -_081B5990: - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =sub_81B5958 - str r0, [r1] - movs r0, 0x1 -_081B599E: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B5974 - - thumb_func_start party_menu_icon_anim -@ void party_menu_icon_anim(struct pokemon *mon, int a2, int a3) -party_menu_icon_anim: @ 81B59B4 - push {r4-r7,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r7, r1, 0 - adds r4, r2, 0 - movs r6, 0x1 - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B59EA - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B59EA - ldr r0, =gUnknown_08616020 - adds r0, r4, r0 - ldrb r1, [r0] - eors r1, r6 - negs r0, r1 - orrs r0, r1 - lsrs r6, r0, 31 -_081B59EA: - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0 - bl GetMonData - adds r1, r0, 0 - str r6, [sp] - adds r0, r4, 0 - adds r2, r7, 0 - movs r3, 0x1 - bl party_menu_link_mon_icon_anim - ldrb r0, [r7, 0x9] - adds r1, r5, 0 - bl sub_81B5B38 - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_icon_anim - - thumb_func_start party_menu_link_mon_icon_anim -@ void party_menu_link_mon_icon_anim(u16 speciesId, u32 personality, int a3, char a4, int a5) -party_menu_link_mon_icon_anim: @ 81B5A2C - push {r4-r7,lr} - sub sp, 0xC - adds r6, r1, 0 - adds r4, r2, 0 - lsls r0, 16 - lsrs r5, r0, 16 - lsls r3, 24 - lsrs r7, r3, 24 - cmp r5, 0 - beq _081B5A7A - ldr r1, =sub_80D3014 - ldr r0, [r4, 0x4] - ldrb r2, [r0] - ldrb r3, [r0, 0x1] - movs r0, 0x4 - str r0, [sp] - str r6, [sp, 0x4] - ldr r0, [sp, 0x20] - str r0, [sp, 0x8] - adds r0, r5, 0 - bl CreateMonIcon - strb r0, [r4, 0x9] - ldr r2, =gSprites - ldrb r0, [r4, 0x9] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x3 - adds r2, r7, 0 - ands r2, r0 - lsls r2, 2 - ldrb r3, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] -_081B5A7A: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_link_mon_icon_anim - - thumb_func_start sub_81B5A8C -sub_81B5A8C: @ 81B5A8C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - adds r0, r1, 0 - adds r1, r2, 0 - bl GetHPBarLevel - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _081B5AEC - cmp r0, 0x2 - bgt _081B5AB4 - cmp r0, 0x1 - beq _081B5B04 - b _081B5B1C -_081B5AB4: - cmp r0, 0x3 - beq _081B5AD4 - cmp r0, 0x4 - bne _081B5B1C - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl sub_80D32C8 - b _081B5B2C - .pool -_081B5AD4: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl sub_80D32C8 - b _081B5B2C - .pool -_081B5AEC: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x2 - bl sub_80D32C8 - b _081B5B2C - .pool -_081B5B04: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x3 - bl sub_80D32C8 - b _081B5B2C - .pool -_081B5B1C: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x4 - bl sub_80D32C8 -_081B5B2C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5A8C - thumb_func_start sub_81B5B38 sub_81B5B38: @ 81B5B38 push {r4-r6,lr} diff --git a/include/easy_chat.h b/include/easy_chat.h index 541fa6c1b..23fd9ed83 100644 --- a/include/easy_chat.h +++ b/include/easy_chat.h @@ -1,6 +1,8 @@ #ifndef GUARD_EASYCHAT_H #define GUARD_EASYCHAT_H +#include "main.h" + void InitEasyChatPhrases(void); void easy_chat_input_maybe(void); u8 * CopyEasyChatWord(u8 *dest, u16 word); @@ -12,5 +14,6 @@ u16 sub_811EE38(u16 group); u16 sub_811F01C(void); bool16 EasyChat_GetNumWordsInGroup(u8); u16 sub_811EE90(u16); +void sub_811A20C(u8 kind, u16 *words, MainCallback callback, u8 sizeParam); #endif // GUARD_EASYCHAT_H diff --git a/include/fldeff_softboiled.h b/include/fldeff_softboiled.h index 8579c6cfe..abb3c7913 100755 --- a/include/fldeff_softboiled.h +++ b/include/fldeff_softboiled.h @@ -2,5 +2,6 @@ #define GUARD_FLDEFF_SOFTBOILED_H void sub_81615A8(u8 taskId); +void sub_8161560(u8 taskId); #endif // GUARD_FLDEFF_SOFTBOILED_H diff --git a/include/item_menu.h b/include/item_menu.h index 649eb934c..6214c69fc 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -60,5 +60,6 @@ void CB2_BagMenuFromStartMenu(void); u8 sub_81ABB2C(u8 pocketId); bool8 UseRegisteredKeyItemOnField(void); void CB2_GoToSellMenu(void); +void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); #endif //GUARD_item_menu_H diff --git a/include/link_rfu.h b/include/link_rfu.h index 426565e56..e394e2611 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -2,6 +2,7 @@ #define GUARD_LINK_RFU_H #include "librfu.h" +#include "link.h" // Exported type declarations diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index f1c8a3e61..17c7d5573 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -16,5 +16,7 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u u8 UpdateMonIconFrame(struct Sprite *sprite); void LoadMonIconPalette(u16 species); void sub_80D328C(struct Sprite *sprite); +void sub_80D3014(struct Sprite *sprite); +void sub_80D32C8(struct Sprite *sprite, u8 animNum); #endif // GUARD_POKEMON_ICON_H diff --git a/include/region_map.h b/include/region_map.h index 0c82232cf..ed1c1a201 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -107,6 +107,7 @@ u8 *sub_8124610(u8 *dest, u16 mapSecId); u16 CorrectSpecialMapSecId(u16 mapSecId); void sub_8122D88(struct RegionMap *regionMap); void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y); +void MCB2_FlyMap(void); extern const struct RegionMapLocation gRegionMapEntries[]; diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index 1aa663bc7..c1bdbdf34 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -5,6 +5,10 @@ // Exported RAM declarations +extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; +extern u16 gUnknown_02022C3C; +extern u8 gUnknown_02022C3E; + // Exported ROM declarations void sub_8018438(void); diff --git a/include/strings.h b/include/strings.h index 0ec3526ea..f46554cc5 100644 --- a/include/strings.h +++ b/include/strings.h @@ -407,6 +407,22 @@ extern const u8 gText_SwitchedPkmnItem[]; extern const u8 gText_BagFullCouldNotRemoveItem[]; extern const u8 gText_PkmnCantParticipate[]; extern const u8 gText_PkmnNotHolding[]; +extern const u8 gText_ThrowAwayItem[]; +extern const u8 gText_ItemThrownAway[]; +extern const u8 gText_SendMailToPC[]; +extern const u8 gText_MailSentToPC[]; +extern const u8 gText_PCMailboxFull[]; +extern const u8 gText_MailMessageWillBeLost[]; +extern const u8 gText_MailTakenFromPkmn[]; +extern const u8 gText_NoMoreThanVar1Pkmn[]; +extern const u8 gText_PkmnCantBeTradedNow[]; +extern const u8 gText_EggCantBeTradedNow[]; +extern const u8 gText_OnlyPkmnForBattle[]; +extern const u8 gJPText_PutVar1IntoSpinner[]; +extern const u8 gText_PauseUntilPress[]; +extern const u8 gText_CantUseUntilNewBadge[]; +extern const u8 gText_ReturnToHealingSpot[]; +extern const u8 gText_EscapeFromHere[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/include/trade.h b/include/trade.h index af4da0015..e3c18bffd 100644 --- a/include/trade.h +++ b/include/trade.h @@ -1,6 +1,8 @@ #ifndef GUARD_TRADE_H #define GUARD_TRADE_H +#include "link_rfu.h" + // Exported type declarations // Exported RAM declarations @@ -10,5 +12,8 @@ s32 sub_807A728(void); void sub_80773AC(void); void sub_807AE50(void); +int sub_807A8D0(u32 /* probably wrong */, u16, u16, u8); +int sub_807A7E0(u32 /* probably wrong */, u32 /* probably wrong */, u16, u16, u16, u16, u8); +int sub_807A918(struct Pokemon*, u16); #endif //GUARD_TRADE_H diff --git a/src/party_menu.c b/src/party_menu.c index c43beaadb..e01f333d5 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -3,8 +3,10 @@ #include "battle_controllers.h" #include "battle_interface.h" #include "battle_pike.h" +#include "battle_pyramid.h" #include "bg.h" #include "constants/battle.h" +#include "constants/flags.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/rgb.h" @@ -13,8 +15,14 @@ #include "contest.h" #include "data2.h" #include "decompress.h" +#include "easy_chat.h" #include "event_data.h" +#include "field_control_avatar.h" +#include "field_effect.h" +#include "field_player_avatar.h" +#include "field_screen.h" #include "field_specials.h" +#include "fieldmap.h" #include "fldeff_softboiled.h" #include "gpu_regs.h" #include "graphics.h" @@ -22,16 +30,21 @@ #include "item.h" #include "item_menu.h" #include "item_use.h" +#include "link.h" +#include "link_rfu.h" #include "main.h" #include "mail.h" #include "malloc.h" #include "menu.h" #include "menu_helpers.h" +#include "metatile_behavior.h" +#include "overworld.h" #include "palette.h" #include "party_menu.h" #include "pokemon.h" #include "pokemon_icon.h" #include "pokemon_summary_screen.h" +#include "region_map.h" #include "rom_8011DC0.h" #include "scanline_effect.h" #include "sound.h" @@ -42,6 +55,7 @@ #include "task.h" #include "text.h" #include "text_window.h" +#include "trade.h" #include "window.h" struct Unk_Rodata1 { @@ -88,6 +102,11 @@ struct Unk_8615C08 { TaskFunc func; }; +struct Unk_8615D9C { + bool8 (*fieldMoveFunc)(void); + u8 msgID; +}; + // BELOW TO BE PUT IN EWRAM extern struct Unk_203CEC4 *gUnknown_0203CEC4; @@ -99,6 +118,7 @@ extern u8 gUnknown_0203CEE8; extern u16 *gUnknown_0203CEF0; extern u16 *gUnknown_0203CEF4; extern u8 gSelectedOrderFromParty[]; +extern u16 gUnknown_0203CEFC; extern u8 gUnknown_0203CF20; // summary screen? // ABOVE TO BE PUT IN EWRAM @@ -165,6 +185,9 @@ extern struct Unk_8615C08 gUnknown_08615C08[]; extern u8 *gUnknown_08615D38[]; extern u8 gUnknown_08615D70[]; extern const u16 gUnknown_08615D7E[]; +extern const struct Unk_8615D9C gUnknown_08615D9C[]; +extern const u8 *gUnknown_08615E0C[]; +extern u8 gUnknown_08616020[]; // ABOVE TO BE CONVERTED TO C @@ -219,13 +242,13 @@ void sub_81B2BF4(u8, u16, u8*, struct Unk_203CEDC *); void sub_81B2D3C(u16, struct Unk_203CEDC *); void sub_81B2DDC(u16, struct Unk_203CEDC *); void sub_81B2E64(u16, u16, struct Unk_203CEDC *); -void party_menu_link_mon_icon_anim(u16, u32, struct Unk_203CEDC *, u8, u8); +void party_menu_link_mon_icon_anim(u16, u32, struct Unk_203CEDC *, u8, u32); void party_menu_link_mon_held_item_object(u16, u16, struct Unk_203CEDC *); void party_menu_link_mon_pokeball_object(u16, struct Unk_203CEDC *); void party_menu_link_mon_status_condition_object(u16, u8, struct Unk_203CEDC *); void party_menu_held_item_object(struct Pokemon *, struct Unk_203CEDC *); void party_menu_pokeball_object(struct Pokemon *, struct Unk_203CEDC *); -void party_menu_icon_anim(struct Pokemon *, struct Unk_203CEDC *, u8); +void party_menu_icon_anim(struct Pokemon *, struct Unk_203CEDC *, u32); void party_menu_status_condition_object(struct Pokemon *, struct Unk_203CEDC *); u8 sub_81B5F74(u8, u8); void sub_81B120C(void); @@ -290,6 +313,38 @@ void sub_81B3CC0(u8); void sub_81B3D48(u8); void swap_pokemon_and_oams(void); void sub_81B3E60(u8); +void sub_81B41C4(void); +void c2_8123744(void); +void sub_81B452C(void); +void sub_81B4350(u8); +void sub_81B42D0(u8); +void sub_81B43A8(u8); +void sub_81B43DC(u8); +void sub_81B44FC(u8); +void sub_81B4578(void); +void sub_81B4624(u8); +void sub_81B5C94(struct Pokemon*, struct Unk_203CEDC*); +void sub_81B48A8(u8); +void sub_81B48DC(u8); +void sub_81B4988(u8); +void sub_81B4A98(void); +void sub_81B4AE0(void); +void sub_81B4B6C(u8); +void sub_81B4BA0(u8); +void sub_81B4C60(u8); +void sub_81B4C94(u8); +bool8 sub_81B8A7C(void); +void sub_81B53FC(u8); +void sub_81B5430(u8); +void task_brm_cancel_1_on_keypad_a_or_b(u8); +void sub_81B5674(u8); +void sub_81B57DC(void); +void sub_81B5864(void); +void sub_81B56A4(u8); +void sub_81B56D8(u8); +void task_launch_hm_phase_2(u8); +u16 brm_get_selected_species(void); +void sub_81B5B38(u8, struct Pokemon*); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -1238,7 +1293,7 @@ void sub_81B1708(u8 taskId) sub_81B8558(); sub_81B12C0(taskId); break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); case 1: sub_81B1C1C(taskId); @@ -1967,7 +2022,7 @@ void sub_81B1C1C(u8 taskId) } } -void sub_81B1C84(struct Pokemon *mon, u16 item, u8 c) +void sub_81B1C84(struct Pokemon *mon, u16 item, u8 c, u8 unused) { GetMonNickname(mon, gStringVar1); CopyItemName(item, gStringVar2); @@ -2031,7 +2086,7 @@ u8 sub_81B1E00(struct Pokemon* mon) return 2; } -void pokemon_item_not_removed(void) +void pokemon_item_not_removed(u16 itemUnused) { StringExpandPlaceholders(gStringVar4, gText_BagFullCouldNotRemoveItem); } @@ -2211,7 +2266,7 @@ void sub_81B227C(u8 taskId) gSpecialVar_0x8004 = 7; sub_81B12C0(taskId); break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); case 1: gTasks[taskId].func = sub_81B1C1C; @@ -2634,12 +2689,12 @@ void sub_81B2E64(u16 hp, u16 maxhp, struct Unk_203CEDC *ptr) switch (GetHPBarLevel(hp, maxhp)) { - case 3: - case 4: + case HP_BAR_GREEN: + case HP_BAR_FULL: LoadPalette(sub_81B2564(gUnknown_08615AC7[0]), gUnknown_08615AB8[0] + palNum, 2); LoadPalette(sub_81B2564(gUnknown_08615AC7[1]), gUnknown_08615AB8[1] + palNum, 2); break; - case 2: + case HP_BAR_YELLOW: LoadPalette(sub_81B2564(gUnknown_08615AC9[0]), gUnknown_08615AB8[0] + palNum, 2); LoadPalette(sub_81B2564(gUnknown_08615AC9[1]), gUnknown_08615AB8[1] + palNum, 2); break; @@ -2809,11 +2864,8 @@ bool8 sub_81B314C(void) for (i = 0; i < 6; i++) { - if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE) - { - if (GetMonData(&party[i], MON_DATA_HP) != 0 || GetMonData(&party[i], MON_DATA_IS_EGG) != FALSE) - j++; - } + if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE && (GetMonData(&party[i], MON_DATA_HP) != 0 || GetMonData(&party[i], MON_DATA_IS_EGG) != FALSE)) + j++; if (j > 1) return TRUE; } @@ -3040,9 +3092,9 @@ void sub_81B3730(u8 taskId) else input = ProcessMenuInput_other(); data[0] = GetMenuCursorPos(); - if (input != -2) + if (input != MENU_NOTHING_CHOSEN) { - if (input == -1) + if (input == MENU_B_PRESSED) { PlaySE(SE_SELECT); sub_81B302C(&gUnknown_0203CEC4->unkC[2]); @@ -3391,3 +3443,872 @@ void brm_cancel_1(u8 taskId) display_pokemon_menu_message(0); gTasks[taskId].func = sub_81B1370; } + +void sub_81B4134(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.unk9, 8); + sub_81B31B0(1); + display_pokemon_menu_message(24); + gTasks[taskId].data[0] = 0xFF; + gTasks[taskId].func = sub_81B3730; +} + +void sub_81B4198(u8 taskId) +{ + PlaySE(SE_SELECT); + gUnknown_0203CEC4->unk4 = sub_81B41C4; + sub_81B12C0(taskId); +} + +void sub_81B41C4(void) +{ + if (InBattlePyramid() == FALSE) + GoToBagMenu(2, 5, c2_8123744); + else + sub_81C4F98(2, c2_8123744); +} + +void c2_8123744(void) +{ + if (gSpecialVar_ItemId == ITEM_NONE) + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B36FC, gUnknown_0203CEC8.unk0); + } + else + { + gUnknown_0203CEFC = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_HELD_ITEM); + if (gUnknown_0203CEFC != ITEM_NONE) + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4350, gUnknown_0203CEC8.unk0); + } + else if (ItemIsMail(gSpecialVar_ItemId) != FALSE) + { + RemoveBagItem(gSpecialVar_ItemId, 1); + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId); + sub_81B452C(); + } + else + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B42D0, gUnknown_0203CEC8.unk0); + } + } +} + +void sub_81B42D0(u8 taskId) +{ + u16 item; + + if (!gPaletteFade.active) + { + item = gSpecialVar_ItemId; + sub_81B1C84(&gPlayerParty[gUnknown_0203CEC8.unk9], item, 0, 0); + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], item); + RemoveBagItem(item, 1); + gTasks[taskId].func = sub_81B469C; + } +} + +void sub_81B4350(u8 taskId) +{ + if (!gPaletteFade.active) + { + sub_81B1D1C(&gPlayerParty[gUnknown_0203CEC8.unk9], gUnknown_0203CEFC, 1); + gTasks[taskId].func = sub_81B43A8; + } +} + +void sub_81B43A8(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B43DC; + } +} + +void sub_81B43DC(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + RemoveBagItem(gSpecialVar_ItemId, 1); + if (AddBagItem(gUnknown_0203CEFC, 1) == FALSE) + { + AddBagItem(gSpecialVar_ItemId, 1); + pokemon_item_not_removed(gUnknown_0203CEFC); + sub_81B1B5C(gStringVar4, 0); + gTasks[taskId].func = sub_81B1C1C; + } + else if (ItemIsMail(gSpecialVar_ItemId) != FALSE) + { + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId); + gTasks[taskId].func = sub_81B44FC; + } + else + { + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId); + sub_81B1D68(gSpecialVar_ItemId, gUnknown_0203CEFC, 1); + gTasks[taskId].func = sub_81B469C; + } + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B1C1C; + break; + } +} + +void sub_81B44FC(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + gUnknown_0203CEC4->unk4 = sub_81B452C; + sub_81B12C0(taskId); + } +} + +void sub_81B452C(void) +{ + u8 mail = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAIL); + + sub_811A20C(4, gSaveBlock1Ptr->mail[mail].words, sub_81B4578, 3); +} + +void sub_81B4578(void) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + if (gSpecialVar_Result == FALSE) + { + TakeMailFromMon(mon); + SetMonData(mon, MON_DATA_HELD_ITEM, &gUnknown_0203CEFC); + RemoveBagItem(gUnknown_0203CEFC, 1); + AddBagItem(item, 1); + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0, sub_81B36FC, gUnknown_0203CEC8.unk0); + } + else + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4624, gUnknown_0203CEC8.unk0); + } +} + +void sub_81B4624(u8 taskId) +{ + if (!gPaletteFade.active) + { + if (gUnknown_0203CEFC == ITEM_NONE) + sub_81B1C84(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId, 0, 0); + else + sub_81B1D68(gSpecialVar_ItemId, gUnknown_0203CEFC, 0); + gTasks[taskId].func = sub_81B469C; + } +} + +void sub_81B469C(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + + if (sub_81B1BD4() != TRUE) + { + sub_81B5C94(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); + if (gUnknown_0203CEC8.unk8_0 == 12) + { + if (GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE) + sub_81B2FA8(11, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + else + sub_81B2FA8(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + } + sub_81B1C1C(taskId); + } +} + +void sub_81B4724(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + switch (sub_81B1E00(mon)) + { + case 0: + GetMonNickname(mon, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); + sub_81B1B5C(gStringVar4, 1); + break; + case 1: + pokemon_item_not_removed(item); + sub_81B1B5C(gStringVar4, 1); + break; + default: + sub_81B1CD0(mon, item, 1); + break; + } + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B469C; +} + +void sub_81B47E0(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + if (item == ITEM_NONE) + { + GetMonNickname(mon, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B469C; + } + else + { + CopyItemName(item, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_ThrowAwayItem); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B48A8; + } +} + +void sub_81B48A8(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B48DC; + } +} + +void sub_81B48DC(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + CopyItemName(GetMonData(mon, MON_DATA_HELD_ITEM), gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_ItemThrownAway); + sub_81B1B5C(gStringVar4, 0); + gTasks[taskId].func = sub_81B4988; + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B1C1C; + break; + } +} + +void sub_81B4988(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 itemClear; + + if (sub_81B1BD4() != TRUE) + { + itemClear = ITEM_NONE; + SetMonData(mon, MON_DATA_HELD_ITEM, &itemClear); + sub_81B5C94(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); + sub_81B2FA8(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + gTasks[taskId].func = sub_81B1C1C; + } +} + +void sub_81B4A08(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.unk9, 9); + sub_81B31B0(2); + display_pokemon_menu_message(25); + gTasks[taskId].data[0] = 0xFF; + gTasks[taskId].func = sub_81B3730; +} + +void sub_81B4A6C(u8 taskId) +{ + PlaySE(SE_SELECT); + gUnknown_0203CEC4->unk4 = sub_81B4A98; + sub_81B12C0(taskId); +} + +void sub_81B4A98(void) +{ + ReadMail(&gSaveBlock1Ptr->mail[GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAIL)], sub_81B4AE0, 1); +} + +void sub_81B4AE0(void) +{ + gPaletteFade.bufferTransferDisabled = TRUE; + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.unk0); +} + +void brm_take_2(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B1B5C(gText_SendMailToPC, 1); + gTasks[taskId].func = sub_81B4B6C; +} + +void sub_81B4B6C(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B4BA0; + } +} + +void sub_81B4BA0(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + if (TakeMailFromMon2(&gPlayerParty[gUnknown_0203CEC8.unk9]) != 0xFF) + { + sub_81B1B5C(gText_MailSentToPC, 0); + gTasks[taskId].func = sub_81B469C; + } + else + { + sub_81B1B5C(gText_PCMailboxFull, 0); + gTasks[taskId].func = sub_81B1C1C; + } + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + sub_81B1B5C(gText_MailMessageWillBeLost, 1); + gTasks[taskId].func = sub_81B4C60; + break; + } +} + +void sub_81B4C60(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B4C94; + } +} + +void sub_81B4C94(u8 taskId) +{ + u16 item; + + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + item = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_HELD_ITEM); + if (AddBagItem(item, 1) == TRUE) + { + TakeMailFromMon(&gPlayerParty[gUnknown_0203CEC8.unk9]); + sub_81B1B5C(gText_MailTakenFromPkmn, 0); + gTasks[taskId].func = sub_81B469C; + } + else + { + pokemon_item_not_removed(item); + sub_81B1B5C(gStringVar4, 0); + gTasks[taskId].func = sub_81B1C1C; + } + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B1C1C; + break; + } +} + +void sub_81B4D78(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.unk9, sub_81B353C(mon)); + if (gUnknown_0203CEC8.unk8_0 != 12) + { + sub_81B31B0(0); + display_pokemon_menu_message(21); + } + else + { + sub_81B31B0(1); + CopyItemName(GetMonData(mon, MON_DATA_HELD_ITEM), gStringVar2); + display_pokemon_menu_message(26); + } + gTasks[taskId].data[0] = 0xFF; + gTasks[taskId].func = sub_81B3730; +} + +void brm_shift_sendout(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + if (sub_81B8A7C() == TRUE) + { + sub_81B12C0(taskId); + } + else + { + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; + } +} + +void sub_81B4E8C(u8 taskId) +{ + u8 unk; + u8 i; + + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + unk = sub_81B8830(); + for (i = 0; i < unk; i++) + { + if (gSelectedOrderFromParty[i] == 0) + { + PlaySE(SE_SELECT); + gSelectedOrderFromParty[i] = gUnknown_0203CEC8.unk9 + 1; + sub_81B2FA8(i + 2, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + if (i == (unk - 1)) + sub_81B4F88(); + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; + return; + } + } + ConvertIntToDecimalStringN(gStringVar1, unk, 0, 1); + StringExpandPlaceholders(gStringVar4, gText_NoMoreThanVar1Pkmn); + PlaySE(SE_HAZURE); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; +} + +void sub_81B4F88(void) +{ + sub_81B0FCC(gUnknown_0203CEC8.unk9, 0); + gUnknown_0203CEC8.unk9 = 6; + sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); +} + +void sub_81B4FA8(u8 taskId) +{ + u8 unk; + u8 i, j; + + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + unk = sub_81B8830(); + for (i = 0; i < unk; i++) + { + if (gSelectedOrderFromParty[i] == (gUnknown_0203CEC8.unk9 + 1)) + { + for (j = i; j < (unk - 1); j++) + gSelectedOrderFromParty[j] = gSelectedOrderFromParty[j + 1]; + gSelectedOrderFromParty[j] = 0; + break; + } + } + sub_81B2FA8(1, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + for (i = 0; i < (unk - 1); i++) + { + if (gSelectedOrderFromParty[i] != 0) + sub_81B2FA8(i + 2, &gUnknown_0203CEDC[gSelectedOrderFromParty[i] - 1], 1); + } + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; +} + +void sub_81B50AC(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B12C0(taskId); +} + +void sub_81B50C8(u8 taskId) +{ + u16 species2 = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES2); + u16 species = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES); + u8 obedience = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_OBEDIENCE); + + switch (sub_807A8D0(*(u32 *)sub_800F7DC() /* dirty cast, probably needs to be changed */, species2, species, obedience)) + { + case 1: + StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gText_EggCantBeTradedNow); + break; + default: + PlaySE(SE_SELECT); + sub_81B12C0(taskId); + return; + } + PlaySE(SE_HAZURE); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + StringAppend(gStringVar4, gText_PauseUntilPress); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; +} + +void brm_trade_1(u8 taskId) +{ + u16 species2 = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES2); + u16 species = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES); + u8 obedience = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_OBEDIENCE); + u32 stringId = sub_807A7E0(*(u32 *)sub_800F7DC() /* dirty cast, probably needs to be changed */, *(u32 *)&gUnknown_02022C38 /* dirty cast, probably needs to be changed */, species2, gUnknown_02022C3C, gUnknown_02022C3E, species, obedience); + + if (stringId != 0) + { + StringExpandPlaceholders(gStringVar4, gUnknown_08615E0C[stringId - 1]); + PlaySE(SE_HAZURE); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + StringAppend(gStringVar4, gText_PauseUntilPress); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; + } + else + { + PlaySE(SE_SELECT); + sub_81B12C0(taskId); + } +} + +void sub_81B52E4(u8 taskId) +{ + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + switch (sub_807A918(gPlayerParty, gUnknown_0203CEC8.unk9)) + { + case 1: + StringExpandPlaceholders(gStringVar4, gText_OnlyPkmnForBattle); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gText_EggCantBeTradedNow); + break; + default: + PlaySE(SE_SELECT); + GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unk9], gStringVar1); + StringExpandPlaceholders(gStringVar4, gJPText_PutVar1IntoSpinner); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B53FC; + return; + } + PlaySE(SE_HAZURE); + StringAppend(gStringVar4, gText_PauseUntilPress); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; +} + +void sub_81B53FC(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B5430; + } +} + +void sub_81B5430(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + sub_81B12C0(taskId); + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + sub_81B1C1C(taskId); + break; + } +} + +void sub_81B5470(u8 taskId) +{ + u8 fieldMove = gUnknown_0203CEC4->unkF[GetMenuCursorPos()] - 19; + struct MapHeader const *mapHeader; + u8 fieldMove2; + + PlaySE(SE_SELECT); + if (gUnknown_08615D9C[fieldMove].fieldMoveFunc != NULL) + { + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + if (sub_81221AC() == TRUE || InUnionRoom() == TRUE) + { + fieldMove2 = fieldMove - 11; + if (fieldMove2 <= 1) + display_pokemon_menu_message(13); + else + display_pokemon_menu_message(gUnknown_08615D9C[fieldMove].msgID); + gTasks[taskId].func = task_brm_cancel_1_on_keypad_a_or_b; + } + else + { + if (fieldMove <= 7 && FlagGet(FLAG_BADGE01_GET + fieldMove) != TRUE) + { + sub_81B1B5C(gText_CantUseUntilNewBadge, 1); + gTasks[taskId].func = sub_81B1C1C; + } + else if (gUnknown_08615D9C[fieldMove].fieldMoveFunc() == TRUE) + { + switch (fieldMove - 5) + { + case 6: + case 7: + sub_8161560(taskId); + break; + case 3: + mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->lastHealLocation.mapGroup, gSaveBlock1Ptr->lastHealLocation.mapNum); + sub_81245DC(gStringVar1, mapHeader->regionMapSectionId); + StringExpandPlaceholders(gStringVar4, gText_ReturnToHealingSpot); + sub_81B5674(taskId); + gUnknown_0203CEC4->unk218[0] = fieldMove; + break; + case 4: + mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum); + sub_81245DC(gStringVar1, mapHeader->regionMapSectionId); + StringExpandPlaceholders(gStringVar4, gText_EscapeFromHere); + sub_81B5674(taskId); + gUnknown_0203CEC4->unk218[0] = fieldMove; + break; + case 0: + gUnknown_0203CEC8.unk0 = MCB2_FlyMap; + sub_81B12C0(taskId); + break; + default: + gUnknown_0203CEC8.unk0 = CB2_ReturnToField; + sub_81B12C0(taskId); + break; + } + } + else + { + switch (fieldMove) + { + case 4: + sub_81B5864(); + break; + case 1: + sub_81B57DC(); + break; + default: + display_pokemon_menu_message(gUnknown_08615D9C[fieldMove].msgID); + break; + } + gTasks[taskId].func = task_brm_cancel_1_on_keypad_a_or_b; + } + } + } +} + +void sub_81B5674(u8 taskId) +{ + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B56A4; +} + +void sub_81B56A4(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B56D8; + } +} + +void sub_81B56D8(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + gUnknown_0203CEC8.unk0 = CB2_ReturnToField; + sub_81B12C0(taskId); + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gFieldCallback2 = NULL; + gPostMenuFieldCallback = NULL; + sub_81B1C1C(taskId); + break; + } +} + +bool8 FieldCallback_PrepareFadeInFromMenu(void) +{ + pal_fill_black(); + CreateTask(task_launch_hm_phase_2, 8); + return TRUE; +} + +void task_launch_hm_phase_2(u8 taskId) +{ + if (IsWeatherNotFadingIn() == TRUE) + { + gFieldEffectArguments[0] = brm_get_selected_species(); + gPostMenuFieldCallback(); + DestroyTask(taskId); + } +} + +u16 brm_get_selected_species(void) +{ + return GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES); +} + +void task_brm_cancel_1_on_keypad_a_or_b(u8 taskId) +{ + if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + brm_cancel_1(taskId); +} + +void sub_81B57DC(void) +{ + if (FlagGet(FLAG_SYS_USE_FLASH) == TRUE) + display_pokemon_menu_message(12); + else + display_pokemon_menu_message(13); +} + +void hm_surf_run_dp02scr(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + FieldEffectStart(9); +} + +bool8 sub_81B5820(void) +{ + if (PartyHasMonWithSurf() == TRUE && IsPlayerFacingSurfableFishableWater() == TRUE) + { + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = hm_surf_run_dp02scr; + return TRUE; + } + return FALSE; +} + +void sub_81B5864(void) +{ + if (TestPlayerAvatarFlags(8) != FALSE) + display_pokemon_menu_message(9); + else + display_pokemon_menu_message(8); +} + +bool8 sub_81B5884(void) +{ + if (Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE) + return TRUE; + return FALSE; +} + +void sub_81B58A8(void) +{ + sub_81B0038(0, 0, 0, 1, 0, sub_81B1370, CB2_ReturnToFieldWithOpenMenu); +} + +void hm2_waterfall(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + FieldEffectStart(43); +} + +bool8 hm_prepare_waterfall(void) +{ + s16 x, y; + + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + if (MetatileBehavior_IsWaterfall(MapGridGetMetatileBehaviorAt(x, y)) == TRUE && IsPlayerSurfingNorth() == TRUE) + { + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = hm2_waterfall; + return TRUE; + } + return FALSE; +} + +void sub_81B5958(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + FieldEffectStart(44); +} + +bool8 sub_81B5974(void) +{ + gFieldEffectArguments[1] = TrySetDiveWarp(); + if (gFieldEffectArguments[1] != 0) + { + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = sub_81B5958; + return TRUE; + } + return FALSE; +} + +void party_menu_icon_anim(struct Pokemon *mon, struct Unk_203CEDC *ptr, u32 a) +{ + u32 bit = 1; + u16 species2; + + if (sub_81B1250() == TRUE && gMain.inBattle != FALSE) + bit = (gUnknown_08616020[a] ^ bit) ? 1 : 0; + species2 = GetMonData(mon, MON_DATA_SPECIES2); + party_menu_link_mon_icon_anim(species2, GetMonData(mon, MON_DATA_PERSONALITY), ptr, 1, bit); + sub_81B5B38(ptr->unk9, mon); +} + +void party_menu_link_mon_icon_anim(u16 species, u32 pid, struct Unk_203CEDC *ptr, u8 priority, u32 bit) +{ + if (species != SPECIES_NONE) + { + ptr->unk9 = CreateMonIcon(species, sub_80D3014, ptr->unk4[0], ptr->unk4[1], 4, pid, bit); + gSprites[ptr->unk9].oam.priority = priority; + } +} + +void sub_81B5A8C(u8 spriteId, s16 hp, s16 maxhp) +{ + switch (GetHPBarLevel(hp, maxhp)) + { + case HP_BAR_FULL: + sub_80D32C8(&gSprites[spriteId], 0); + break; + case HP_BAR_GREEN: + sub_80D32C8(&gSprites[spriteId], 1); + break; + case HP_BAR_YELLOW: + sub_80D32C8(&gSprites[spriteId], 2); + break; + case HP_BAR_RED: + sub_80D32C8(&gSprites[spriteId], 3); + break; + default: + sub_80D32C8(&gSprites[spriteId], 4); + break; + } +} From 71a7a8a0759373a8dafcccee82fa2d37cb285b85 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Mon, 17 Dec 2018 02:39:17 -0500 Subject: [PATCH 08/17] decompiled up to sub_81B8A7C --- asm/party_menu.s | 5655 ------------------------------ include/party_menu.h | 3 +- include/player_pc.h | 1 + include/pokemon_summary_screen.h | 1 + include/pokenav.h | 2 + include/strings.h | 39 + src/battle_script_commands.c | 4 +- src/party_menu.c | 2380 ++++++++++++- 8 files changed, 2407 insertions(+), 5678 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index cebbff264..1dfa7537e 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,5661 +5,6 @@ .text - thumb_func_start sub_81B5B38 -sub_81B5B38: @ 81B5B38 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - lsls r5, 24 - lsrs r5, 24 - adds r0, r6, 0 - movs r1, 0x39 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r6, 0 - movs r1, 0x3A - bl GetMonData - adds r2, r0, 0 - lsls r2, 16 - lsrs r2, 16 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_81B5A8C - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B5B38 - - thumb_func_start sub_81B5B6C -sub_81B5B6C: @ 81B5B6C - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - ldr r5, =gSprites - lsls r0, r4, 4 - adds r0, r4 - lsls r6, r0, 2 - adds r2, r6, r5 - movs r7, 0 - movs r3, 0 - strh r3, [r2, 0x2E] - mov r12, r5 - cmp r1, 0 - bne _081B5BC4 - movs r1, 0x20 - ldrsh r0, [r2, r1] - cmp r0, 0x10 - bne _081B5BA4 - strh r3, [r2, 0x24] - ldr r0, =0x0000fffc - strh r0, [r2, 0x26] - b _081B5BAA - .pool -_081B5BA4: - ldr r0, =0x0000fffc - strh r0, [r2, 0x24] - strh r3, [r2, 0x26] -_081B5BAA: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - mov r1, r12 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_81B5C08 - b _081B5BD0 - .pool -_081B5BC4: - strh r3, [r2, 0x24] - strh r3, [r2, 0x26] - adds r0, r5, 0 - adds r0, 0x1C - adds r0, r6, r0 - ldr r1, =sub_81B5BDC -_081B5BD0: - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5B6C - - thumb_func_start sub_81B5BDC -sub_81B5BDC: @ 81B5BDC - push {r4,lr} - adds r4, r0, 0 - bl UpdateMonIconFrame - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081B5C02 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081B5C00 - ldr r0, =0x0000fffd - strh r0, [r4, 0x26] - b _081B5C02 - .pool -_081B5C00: - strh r1, [r4, 0x26] -_081B5C02: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B5BDC - - thumb_func_start sub_81B5C08 -sub_81B5C08: @ 81B5C08 - push {lr} - bl UpdateMonIconFrame - pop {r0} - bx r0 - thumb_func_end sub_81B5C08 - - thumb_func_start party_menu_held_item_object -party_menu_held_item_object: @ 81B5C14 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B5C3C - ldr r0, =gSpriteTemplate_8615EC0 - ldr r2, [r4, 0x4] - ldrb r1, [r2, 0x2] - ldrb r2, [r2, 0x3] - movs r3, 0 - bl CreateSprite - strb r0, [r4, 0xA] - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_81B5C94 -_081B5C3C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_held_item_object - - thumb_func_start party_menu_link_mon_held_item_object -party_menu_link_mon_held_item_object: @ 81B5C48 - push {r4,r5,lr} - adds r4, r2, 0 - lsls r0, 16 - lsls r1, 16 - lsrs r5, r1, 16 - cmp r0, 0 - beq _081B5C84 - ldr r0, =gSpriteTemplate_8615EC0 - ldr r2, [r4, 0x4] - ldrb r1, [r2, 0x2] - ldrb r2, [r2, 0x3] - movs r3, 0 - bl CreateSprite - strb r0, [r4, 0xA] - ldr r2, =gSprites - ldrb r0, [r4, 0xA] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_81B5CB0 -_081B5C84: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_link_mon_held_item_object - - thumb_func_start sub_81B5C94 -sub_81B5C94: @ 81B5C94 - push {r4,lr} - adds r4, r1, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - adds r1, r4, 0 - bl sub_81B5CB0 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B5C94 - - thumb_func_start sub_81B5CB0 -sub_81B5CB0: @ 81B5CB0 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _081B5CD8 - ldr r2, =gSprites - ldrb r1, [r4, 0xA] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - b _081B5D24 - .pool -_081B5CD8: - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B5CFC - ldrb r1, [r4, 0xA] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - b _081B5D0E - .pool -_081B5CFC: - ldrb r1, [r4, 0xA] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim -_081B5D0E: - ldr r2, =gSprites - ldrb r1, [r4, 0xA] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 -_081B5D24: - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5CB0 - - thumb_func_start sub_81B5D30 -sub_81B5D30: @ 81B5D30 - push {lr} - ldr r0, =gUnknown_08615EB0 - bl LoadSpriteSheet - ldr r0, =gUnknown_08615EB8 - bl LoadSpritePalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5D30 - - thumb_func_start sub_81B5D4C -sub_81B5D4C: @ 81B5D4C - push {r4-r7,lr} - adds r6, r0, 0 - adds r7, r1, 0 - lsls r2, 24 - lsrs r2, 24 - cmp r2, 0 - beq _081B5D60 - cmp r2, 0x1 - beq _081B5DA8 - b _081B5DE4 -_081B5D60: - movs r5, 0 - ldrb r0, [r6] - cmp r5, r0 - bcs _081B5DE4 -_081B5D68: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - beq _081B5D94 - adds r0, r7, r5 - ldrb r4, [r0] - adds r0, r1, 0 - bl ItemIsMail - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_81B5DF0 -_081B5D94: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - ldrb r0, [r6] - cmp r5, r0 - bcc _081B5D68 - b _081B5DE4 - .pool -_081B5DA8: - movs r5, 0 - b _081B5DDE -_081B5DAC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - beq _081B5DD8 - adds r0, r5, r7 - ldrb r4, [r0, 0x6] - adds r0, r1, 0 - bl ItemIsMail - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_81B5DF0 -_081B5DD8: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 -_081B5DDE: - ldrb r0, [r6, 0x1] - cmp r5, r0 - bcc _081B5DAC -_081B5DE4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5D4C - - thumb_func_start sub_81B5DF0 -sub_81B5DF0: @ 81B5DF0 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - adds r6, r0, 0 - mov r9, r1 - lsls r6, 24 - lsrs r6, 24 - mov r0, r9 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r0, =gSprites - mov r8, r0 - lsls r0, r6, 4 - adds r0, r6 - lsls r0, 2 - add r0, r8 - adds r0, 0x43 - ldrb r3, [r0] - ldr r0, =gSpriteTemplate_8615EC0 - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r1, 0xFA - movs r2, 0xAA - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - mov r0, r8 - adds r5, r4, r0 - movs r0, 0x4 - strh r0, [r5, 0x24] - movs r0, 0xA - strh r0, [r5, 0x26] - movs r0, 0x1C - add r8, r0 - add r4, r8 - ldr r0, =sub_81B5E74 - str r0, [r4] - strh r6, [r5, 0x3C] - adds r0, r5, 0 - mov r1, r9 - bl StartSpriteAnim - ldr r1, [r4] - adds r0, r5, 0 - bl _call_via_r1 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5DF0 - - thumb_func_start sub_81B5E74 -sub_81B5E74: @ 81B5E74 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x3C] - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - adds r0, r2, 0 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _081B5EA8 - adds r0, r4, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - b _081B5EC6 - .pool -_081B5EA8: - adds r3, r4, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - ldrh r0, [r2, 0x24] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r2, 0x26] - ldrh r2, [r2, 0x22] - adds r0, r2 - strh r0, [r4, 0x22] -_081B5EC6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B5E74 - - thumb_func_start party_menu_pokeball_object -party_menu_pokeball_object: @ 81B5ECC - push {r4,lr} - adds r4, r1, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B5EEA - ldr r0, =gSpriteTemplate_8615F08 - ldr r2, [r4, 0x4] - ldrb r1, [r2, 0x6] - ldrb r2, [r2, 0x7] - movs r3, 0x8 - bl CreateSprite - strb r0, [r4, 0xB] -_081B5EEA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_pokeball_object - - thumb_func_start party_menu_link_mon_pokeball_object -party_menu_link_mon_pokeball_object: @ 81B5EF4 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 16 - cmp r0, 0 - beq _081B5F24 - ldr r0, =gSpriteTemplate_8615F08 - ldr r2, [r4, 0x4] - ldrb r1, [r2, 0x6] - ldrb r2, [r2, 0x7] - movs r3, 0x8 - bl CreateSprite - strb r0, [r4, 0xB] - ldr r2, =gSprites - ldrb r0, [r4, 0xB] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] -_081B5F24: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_link_mon_pokeball_object - - thumb_func_start sub_81B5F34 -sub_81B5F34: @ 81B5F34 - push {lr} - adds r3, r0, 0 - adds r2, r1, 0 - lsls r3, 24 - lsrs r3, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gSpriteTemplate_8615F08 - adds r1, r3, 0 - movs r3, 0x8 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r3, [r1, 0x5] - movs r2, 0xD - negs r2, r2 - ands r2, r3 - movs r3, 0x8 - orrs r2, r3 - strb r2, [r1, 0x5] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B5F34 - - thumb_func_start sub_81B5F74 -sub_81B5F74: @ 81B5F74 - push {lr} - adds r3, r0, 0 - adds r2, r1, 0 - lsls r3, 24 - lsrs r3, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gSpriteTemplate_8615F78 - adds r1, r3, 0 - movs r3, 0x8 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B5F74 - - thumb_func_start sub_81B5F98 -sub_81B5F98: @ 81B5F98 - push {lr} - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r2, =gSprites - adds r0, r2 - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5F98 - - thumb_func_start sub_81B5FBC -sub_81B5FBC: @ 81B5FBC - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - cmp r6, 0 - bne _081B6000 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - mov r8, r0 - add r4, r8 - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAnim - lsls r5, r7, 4 - adds r5, r7 - lsls r5, 2 - add r5, r8 - adds r0, r5, 0 - movs r1, 0x4 - bl StartSpriteAnim - strh r6, [r4, 0x26] - strh r6, [r5, 0x26] - b _081B602C - .pool -_081B6000: - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - ldr r0, =gSprites - mov r8, r0 - add r5, r8 - adds r0, r5, 0 - movs r1, 0x3 - bl StartSpriteAnim - lsls r4, r7, 4 - adds r4, r7 - lsls r4, 2 - add r4, r8 - adds r0, r4, 0 - movs r1, 0x5 - bl StartSpriteAnim - ldr r0, =0x0000fffc - strh r0, [r5, 0x26] - movs r0, 0x4 - strh r0, [r4, 0x26] -_081B602C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5FBC - - thumb_func_start sub_81B6040 -sub_81B6040: @ 81B6040 - push {lr} - ldr r0, =gUnknown_08615EF8 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_08615F70 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_08615F00 - bl LoadCompressedObjectPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6040 - - thumb_func_start party_menu_status_condition_object -party_menu_status_condition_object: @ 81B6064 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B608C - ldr r0, =gSpriteTemplate_8616008 - ldr r2, [r4, 0x4] - ldrb r1, [r2, 0x4] - ldrb r2, [r2, 0x5] - movs r3, 0 - bl CreateSprite - strb r0, [r4, 0xC] - adds r0, r5, 0 - adds r1, r4, 0 - bl party_menu_get_status_condition_and_update_object -_081B608C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_status_condition_object - - thumb_func_start party_menu_link_mon_status_condition_object -party_menu_link_mon_status_condition_object: @ 81B6098 - push {r4,r5,lr} - adds r4, r2, 0 - lsls r0, 16 - lsls r1, 24 - lsrs r5, r1, 24 - cmp r0, 0 - beq _081B60D4 - ldr r0, =gSpriteTemplate_8616008 - ldr r2, [r4, 0x4] - ldrb r1, [r2, 0x4] - ldrb r2, [r2, 0x5] - movs r3, 0 - bl CreateSprite - strb r0, [r4, 0xC] - adds r0, r5, 0 - adds r1, r4, 0 - bl party_menu_update_status_condition_object - ldr r2, =gSprites - ldrb r0, [r4, 0xC] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] -_081B60D4: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_link_mon_status_condition_object - - thumb_func_start party_menu_get_status_condition_and_update_object -@ void party_menu_get_status_condition_and_update_object(struct pokemon *mon, void *a2, void *a3) -party_menu_get_status_condition_and_update_object: @ 81B60E4 - push {r4,lr} - adds r4, r1, 0 - bl sub_81B205C - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl party_menu_update_status_condition_object - pop {r4} - pop {r0} - bx r0 - thumb_func_end party_menu_get_status_condition_and_update_object - - thumb_func_start party_menu_update_status_condition_object -@ void party_menu_update_status_condition_object(u8 a1, void *a2) -party_menu_update_status_condition_object: @ 81B60FC - push {r4,r5,lr} - adds r5, r1, 0 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _081B610C - cmp r2, 0x6 - bne _081B6128 -_081B610C: - ldr r2, =gSprites - ldrb r1, [r5, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - b _081B6152 - .pool -_081B6128: - ldrb r1, [r5, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - subs r1, r2, 0x1 - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAnim - ldrb r1, [r5, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 -_081B6152: - strb r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_update_status_condition_object - - thumb_func_start sub_81B6160 -sub_81B6160: @ 81B6160 - push {lr} - ldr r0, =gUnknown_08615FF8 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_08616000 - bl LoadCompressedObjectPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6160 - - thumb_func_start sub_81B617C -sub_81B617C: @ 81B617C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - ldr r0, =c2_815ABFC - mov r8, r0 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B61BC - movs r7, 0x1 - bl sub_81B8984 - lsls r0, 24 - lsrs r6, r0, 24 - b _081B61C0 - .pool -_081B61B0: - ldr r0, =gUnknown_0203CEC8 - strb r5, [r0, 0x9] - b _081B6204 - .pool -_081B61BC: - movs r7, 0 - movs r6, 0 -_081B61C0: - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - bl GetItemEffectType - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xA - bne _081B621C - ldr r1, =gUnknown_0203CEC8 - movs r0, 0 - strb r0, [r1, 0x9] - movs r5, 0 -_081B61D8: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B61FA - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _081B61B0 -_081B61FA: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _081B61D8 -_081B6204: - ldr r0, =sub_81B6280 - movs r1, 0x7F - b _081B6230 - .pool -_081B621C: - ldrh r0, [r4] - bl GetPocketByItemId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x5 - cmp r0, 0x3 - bne _081B622E - movs r1, 0x4 -_081B622E: - ldr r0, =sub_81B1370 -_081B6230: - str r1, [sp] - str r0, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x3 - movs r3, 0x1 - bl sub_81B0038 - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B617C - - thumb_func_start c2_815ABFC -c2_815ABFC: @ 81B6254 - push {lr} - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _081B626C - movs r0, 0xC - movs r1, 0x5 - movs r2, 0 - bl GoToBagMenu - b _081B6276 -_081B626C: - ldr r0, =gPyramidBagCursorData - ldr r1, [r0] - movs r0, 0x4 - bl sub_81C4F98 -_081B6276: - pop {r0} - bx r0 - .pool - thumb_func_end c2_815ABFC - - thumb_func_start sub_81B6280 -sub_81B6280: @ 81B6280 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B62B2 - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - bne _081B62A6 - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B9140 - str r0, [r1, 0x4] -_081B62A6: - ldr r0, =gUnknown_03006328 - ldr r1, =sub_81B6794 - ldr r2, [r0] - adds r0, r3, 0 - bl _call_via_r2 -_081B62B2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6280 - - thumb_func_start IsHPRecoveryItem -@ bool8 IsHPRecoveryItem(u16 itemId) -IsHPRecoveryItem: @ 81B62D0 - push {lr} - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAF - bne _081B62EC - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003214 - adds r0, r1 - b _081B62F6 - .pool -_081B62EC: - ldr r1, =gItemEffectTable - subs r0, 0xD - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] -_081B62F6: - ldrb r1, [r0, 0x4] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _081B6308 - movs r0, 0 - b _081B630A - .pool -_081B6308: - movs r0, 0x1 -_081B630A: - pop {r1} - bx r1 - thumb_func_end IsHPRecoveryItem - - thumb_func_start GetMedicineItemEffectMessage -@ void GetMedicineItemEffectMessage(u16 itemId) -GetMedicineItemEffectMessage: @ 81B6310 - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl GetItemEffectType - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x3 - cmp r0, 0x12 - bls _081B6326 - b _081B64BC -_081B6326: - lsls r0, 2 - ldr r1, =_081B6334 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B6334: - .4byte _081B6380 - .4byte _081B6394 - .4byte _081B63A8 - .4byte _081B63BC - .4byte _081B63D0 - .4byte _081B63E4 - .4byte _081B63F8 - .4byte _081B64BC - .4byte _081B640C - .4byte _081B6430 - .4byte _081B6420 - .4byte _081B6460 - .4byte _081B6470 - .4byte _081B6450 - .4byte _081B6440 - .4byte _081B64BC - .4byte _081B6494 - .4byte _081B6494 - .4byte _081B64A8 -_081B6380: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnCuredOfPoison - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B6394: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnWokeUp2 - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B63A8: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnBurnHealed - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B63BC: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnThawedOut - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B63D0: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnCuredOfParalysis - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B63E4: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnSnappedOutOfConfusion - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B63F8: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnGotOverInfatuation - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B640C: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnBecameHealthy - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B6420: - ldr r0, =gStringVar2 - ldr r1, =gText_HP3 - b _081B6474 - .pool -_081B6430: - ldr r0, =gStringVar2 - ldr r1, =gText_Attack3 - b _081B6474 - .pool -_081B6440: - ldr r0, =gStringVar2 - ldr r1, =gText_Defense3 - b _081B6474 - .pool -_081B6450: - ldr r0, =gStringVar2 - ldr r1, =gText_Speed2 - b _081B6474 - .pool -_081B6460: - ldr r0, =gStringVar2 - ldr r1, =gText_SpAtk3 - b _081B6474 - .pool -_081B6470: - ldr r0, =gStringVar2 - ldr r1, =gText_SpDef3 -_081B6474: - bl StringCopy - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnBaseVar2StatIncreased - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B6494: - ldr r0, =gStringVar4 - ldr r1, =gText_MovesPPIncreased - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B64A8: - ldr r0, =gStringVar4 - ldr r1, =gText_PPWasRestored - bl StringExpandPlaceholders - b _081B64C4 - .pool -_081B64BC: - ldr r0, =gStringVar4 - ldr r1, =gText_WontHaveEffect - bl StringExpandPlaceholders -_081B64C4: - pop {r0} - bx r0 - .pool - thumb_func_end GetMedicineItemEffectMessage - - thumb_func_start UsingHPEVItemOnShedinja -@ bool8 UsingHPEVItemOnShedinja(struct pokemon *mon, u16 itemId) -UsingHPEVItemOnShedinja: @ 81B64D0 - push {r4,lr} - adds r4, r0, 0 - lsls r0, r1, 16 - lsrs r0, 16 - bl GetItemEffectType - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xD - bne _081B64FC - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - ldr r1, =0x0000012f - cmp r0, r1 - bne _081B64FC - movs r0, 0 - b _081B64FE - .pool -_081B64FC: - movs r0, 0x1 -_081B64FE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end UsingHPEVItemOnShedinja - - thumb_func_start IsBlueYellowRedFlute -@ bool8 IsBlueYellowRedFlute(u16 itemId) -IsBlueYellowRedFlute: @ 81B6504 - push {lr} - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x27 - beq _081B6516 - cmp r0, 0x29 - beq _081B6516 - cmp r0, 0x28 - bne _081B651A -_081B6516: - movs r0, 0x1 - b _081B651C -_081B651A: - movs r0, 0 -_081B651C: - pop {r1} - bx r1 - thumb_func_end IsBlueYellowRedFlute - - thumb_func_start ExecuteTableBasedItemEffect__ -@ bool8 ExecuteTableBasedItemEffect__(u8 partyMonIndex, u16 itemId, u8 monMoveIndex) -ExecuteTableBasedItemEffect__: @ 81B6520 - push {r4-r6,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - lsls r2, 24 - lsrs r6, r2, 24 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _081B6558 - movs r0, 0x64 - muls r0, r3 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r5, 0 - adds r2, r3, 0 - b _081B6572 - .pool -_081B6558: - movs r0, 0x64 - adds r4, r3, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r3, 0 - bl sub_81B8F38 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 -_081B6572: - adds r3, r6, 0 - bl ExecuteTableBasedItemEffect - lsls r0, 24 - lsrs r0, 24 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end ExecuteTableBasedItemEffect__ - - thumb_func_start ItemUseCB_Medicine -ItemUseCB_Medicine: @ 81B6588 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - str r1, [sp, 0x4] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r0, 0 - mov r10, r0 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - ldr r0, =gSpecialVar_ItemId - ldrh r6, [r0] - adds r0, r5, 0 - adds r1, r6, 0 - bl UsingHPEVItemOnShedinja - lsls r0, 24 - cmp r0, 0 - beq _081B6600 - adds r0, r6, 0 - bl IsHPRecoveryItem - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0x1 - bne _081B65EE - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - cmp r10, r0 - bne _081B65EE - movs r1, 0 - mov r8, r1 -_081B65EE: - ldr r4, =gUnknown_0203CEC8 - ldrb r0, [r4, 0x9] - adds r1, r6, 0 - movs r2, 0 - bl ExecuteTableBasedItemEffect__ - lsls r0, 24 - cmp r0, 0 - beq _081B6624 -_081B6600: - ldr r1, =gUnknown_0203CEE8 - movs r0, 0 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldr r0, =gText_WontHaveEffect - b _081B66F4 - .pool -_081B6624: - ldr r1, =gUnknown_0203CEE8 - movs r0, 0x1 - strb r0, [r1] - adds r0, r6, 0 - bl IsBlueYellowRedFlute - lsls r0, 24 - cmp r0, 0 - bne _081B6650 - movs r0, 0x1 - bl PlaySE - ldrb r0, [r4, 0xB] - cmp r0, 0xE - beq _081B6656 - adds r0, r6, 0 - movs r1, 0x1 - bl RemoveBagItem - b _081B6656 - .pool -_081B6650: - movs r0, 0x75 - bl PlaySE -_081B6656: - ldr r4, =gUnknown_0203CEDC - ldr r7, =gUnknown_0203CEC8 - movs r0, 0x9 - ldrsb r0, [r7, r0] - lsls r0, 4 - ldr r1, [r4] - adds r1, r0 - adds r0, r5, 0 - bl party_menu_get_status_condition_and_update_object - ldr r2, =gSprites - movs r0, 0x9 - ldrsb r0, [r7, r0] - ldr r1, [r4] - lsls r0, 4 - adds r3, r0, r1 - ldrb r1, [r3, 0xC] - 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 - bge _081B6694 - adds r0, r5, 0 - adds r1, r3, 0 - movs r2, 0x1 - bl sub_81B2AC8 -_081B6694: - mov r2, r8 - cmp r2, 0x1 - bne _081B66E4 - mov r0, r10 - cmp r0, 0 - bne _081B66A8 - ldrb r0, [r7, 0x9] - movs r1, 0x1 - bl sub_81B0FCC -_081B66A8: - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - mov r1, r10 - subs r3, r1 - lsls r3, 16 - asrs r3, 16 - ldrb r1, [r7, 0x9] - ldr r0, =sub_81B672C - str r0, [sp] - mov r0, r9 - movs r2, 0x1 - bl sub_81B1F18 - mov r0, r9 - movs r1, 0 - mov r2, r10 - bl sub_81B1FA8 - b _081B6710 - .pool -_081B66E4: - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - adds r0, r6, 0 - bl GetMedicineItemEffectMessage - ldr r0, =gStringVar4 -_081B66F4: - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - mov r2, r9 - lsls r0, r2, 2 - add r0, r9 - lsls r0, 3 - adds r0, r1 - ldr r1, [sp, 0x4] - str r1, [r0] -_081B6710: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseCB_Medicine - - thumb_func_start sub_81B672C -sub_81B672C: @ 81B672C - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnHPRestoredByVar2 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - bl HandleBattleLowHpMusicChange - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6794 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B672C - - thumb_func_start sub_81B6794 -sub_81B6794: @ 81B6794 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B67BA - ldr r0, =gUnknown_0203CEE8 - ldrb r1, [r0] - cmp r1, 0 - bne _081B67B4 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - str r1, [r0, 0x4] -_081B67B4: - adds r0, r4, 0 - bl sub_81B12C0 -_081B67BA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6794 - - thumb_func_start sub_81B67C8 -sub_81B67C8: @ 81B67C8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - str r1, [sp] - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r4, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r4, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - ldr r0, =gSpecialVar_ItemId - ldrh r6, [r0] - adds r0, r6, 0 - bl GetItemEffectType - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r5, 0 - movs r1, 0x20 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x4] - adds r0, r5, 0 - adds r1, r7, 0 - bl sub_81B691C - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - ldrb r0, [r4, 0x9] - adds r1, r6, 0 - movs r2, 0 - bl ExecuteTableBasedItemEffect__ - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x20 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - adds r0, r5, 0 - adds r1, r7, 0 - bl sub_81B691C - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - cmp r4, 0 - bne _081B6850 - ldr r0, [sp, 0x4] - cmp r0, r9 - bne _081B6874 - ldr r1, [sp, 0x8] - cmp r1, r8 - bne _081B6874 -_081B6850: - ldr r1, =gUnknown_0203CEE8 - movs r0, 0 - strb r0, [r1] - movs r0, 0x5 - bl PlaySE - ldr r0, =gText_WontHaveEffect - b _081B68E2 - .pool -_081B6874: - ldr r1, =gUnknown_0203CEE8 - movs r0, 0x1 - strb r0, [r1] - movs r0, 0x1 - bl PlaySE - adds r0, r6, 0 - movs r1, 0x1 - bl RemoveBagItem - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r1, =gStringVar2 - adds r0, r7, 0 - bl option_menu_get_string - ldr r2, [sp, 0x4] - cmp r2, r9 - beq _081B68D8 - ldr r0, [sp, 0x8] - cmp r0, r8 - beq _081B68C4 - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnFriendlyBaseVar2Fell - bl StringExpandPlaceholders - b _081B68E0 - .pool -_081B68C4: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnFriendlyBaseVar2CantFall - bl StringExpandPlaceholders - b _081B68E0 - .pool -_081B68D8: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnAdoresBaseVar2Fell - bl StringExpandPlaceholders -_081B68E0: - ldr r0, =gStringVar4 -_081B68E2: - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - mov r2, r10 - lsls r0, r2, 2 - add r0, r10 - lsls r0, 3 - adds r0, r1 - ldr r1, [sp] - str r1, [r0] - 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_81B67C8 - - thumb_func_start sub_81B691C -sub_81B691C: @ 81B691C - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r1, 0 - subs r0, 0xC - cmp r0, 0x5 - bhi _081B6992 - lsls r0, 2 - ldr r1, =_081B693C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B693C: - .4byte _081B696C - .4byte _081B6954 - .4byte _081B697E - .4byte _081B6984 - .4byte _081B6978 - .4byte _081B6972 -_081B6954: - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - ldr r1, =0x0000012f - cmp r0, r1 - beq _081B6992 - adds r0, r4, 0 - movs r1, 0x1A - b _081B6988 - .pool -_081B696C: - adds r0, r4, 0 - movs r1, 0x1B - b _081B6988 -_081B6972: - adds r0, r4, 0 - movs r1, 0x1C - b _081B6988 -_081B6978: - adds r0, r4, 0 - movs r1, 0x1D - b _081B6988 -_081B697E: - adds r0, r4, 0 - movs r1, 0x1E - b _081B6988 -_081B6984: - adds r0, r4, 0 - movs r1, 0x1F -_081B6988: - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - b _081B6994 -_081B6992: - movs r0, 0 -_081B6994: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B691C - - thumb_func_start option_menu_get_string -option_menu_get_string: @ 81B699C - push {lr} - adds r2, r1, 0 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0xC - cmp r0, 0x5 - bhi _081B6A08 - lsls r0, 2 - ldr r1, =_081B69B8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B69B8: - .4byte _081B69D8 - .4byte _081B69D0 - .4byte _081B69F0 - .4byte _081B6A00 - .4byte _081B69E8 - .4byte _081B69E0 -_081B69D0: - ldr r1, =gText_HP3 - b _081B69F2 - .pool -_081B69D8: - ldr r1, =gText_Attack3 - b _081B69F2 - .pool -_081B69E0: - ldr r1, =gText_Defense3 - b _081B69F2 - .pool -_081B69E8: - ldr r1, =gText_Speed2 - b _081B69F2 - .pool -_081B69F0: - ldr r1, =gText_SpAtk3 -_081B69F2: - adds r0, r2, 0 - bl StringCopy - b _081B6A08 - .pool -_081B6A00: - ldr r1, =gText_SpDef3 - adds r0, r2, 0 - bl StringCopy -_081B6A08: - pop {r0} - bx r0 - .pool - thumb_func_end option_menu_get_string - - thumb_func_start sub_81B6A10 -sub_81B6A10: @ 81B6A10 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r7, 0 - movs r0, 0x1 - mov r10, r0 - movs r0, 0x3 - bl sub_81B31B0 - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - movs r0, 0x64 - adds r1, r4, 0 - muls r1, r0 - mov r8, r1 - ldr r0, =gPlayerParty - mov r9, r0 -_081B6A40: - adds r1, r5, 0 - adds r1, 0xD - mov r0, r8 - add r0, r9 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - movs r0, 0xD - adds r2, r4, 0 - muls r2, r0 - ldr r0, =gMoveNames - adds r2, r0 - lsls r0, r5, 4 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r6, 0 - mov r1, r10 - movs r3, 0x8 - bl AddTextPrinterParameterized - cmp r4, 0 - beq _081B6A82 - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 -_081B6A82: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _081B6A40 - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - 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_81B6A10 - - thumb_func_start ether_effect_related_3 -ether_effect_related_3: @ 81B6AB4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl Menu_ProcessInput - lsls r0, 24 - asrs r1, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _081B6AF0 - adds r0, 0x1 - cmp r1, r0 - bne _081B6AE0 - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B6BB4 - b _081B6AF0 -_081B6AE0: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl ether_effect_related_2 -_081B6AF0: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ether_effect_related_3 - - thumb_func_start dp05_ether -dp05_ether: @ 81B6AFC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - cmp r0, 0xAF - bne _081B6B20 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003214 - adds r0, r1 - b _081B6B2A - .pool -_081B6B20: - ldr r1, =gItemEffectTable - subs r0, 0xD - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] -_081B6B2A: - ldrb r1, [r0, 0x4] - movs r0, 0x10 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _081B6B4C - ldr r0, =gUnknown_0203CEC8 - strh r1, [r0, 0xE] - adds r0, r4, 0 - bl ether_effect_related - b _081B6B6E - .pool -_081B6B4C: - movs r0, 0x5 - bl PlaySE - movs r0, 0x16 - bl display_pokemon_menu_message - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - bl sub_81B6A10 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =ether_effect_related_3 - str r1, [r0] -_081B6B6E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp05_ether - - thumb_func_start ether_effect_related_2 -ether_effect_related_2: @ 81B6B80 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xC - bl sub_81B302C - bl GetMenuCursorPos - ldr r1, =gUnknown_0203CEC8 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0xE] - adds r0, r4, 0 - bl ether_effect_related - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ether_effect_related_2 - - thumb_func_start sub_81B6BB4 -sub_81B6BB4: @ 81B6BB4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =sub_81B1370 - str r0, [r1] - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - movs r1, 0 - str r1, [r0, 0x4] - adds r0, 0xC - bl sub_81B302C - movs r0, 0x5 - bl display_pokemon_menu_message - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6BB4 - - thumb_func_start ether_effect_related -ether_effect_related: @ 81B6BEC - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - movs r4, 0 - ldr r7, =gUnknown_0203CED6 - ldr r0, =gSpecialVar_ItemId - ldrh r5, [r0] - movs r0, 0xE - negs r0, r0 - adds r0, r7 - mov r8, r0 - ldrb r0, [r0, 0x9] - ldrb r2, [r7] - adds r1, r5, 0 - bl ExecuteTableBasedItemEffect__ - lsls r0, 24 - cmp r0, 0 - beq _081B6C34 - ldr r0, =gUnknown_0203CEE8 - strb r4, [r0] - movs r0, 0x5 - bl PlaySE - ldr r0, =gText_WontHaveEffect - b _081B6C7E - .pool -_081B6C34: - ldr r1, =gUnknown_0203CEE8 - movs r0, 0x1 - strb r0, [r1] - mov r0, r8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - adds r4, r1, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - movs r0, 0x1 - bl PlaySE - adds r0, r5, 0 - movs r1, 0x1 - bl RemoveBagItem - movs r0, 0 - ldrsh r1, [r7, r0] - adds r1, 0xD - adds r0, r4, 0 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =gStringVar1 - movs r1, 0xD - muls r1, r4 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - adds r0, r5, 0 - bl GetMedicineItemEffectMessage - ldr r0, =gStringVar4 -_081B6C7E: - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6794 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end ether_effect_related - - thumb_func_start dp05_pp_up -dp05_pp_up: @ 81B6CC0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - movs r0, 0x17 - bl display_pokemon_menu_message - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - bl sub_81B6A10 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =ether_effect_related_3 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp05_pp_up - - thumb_func_start ItemIdToBattleMoveId -ItemIdToBattleMoveId: @ 81B6CFC - lsls r0, 16 - ldr r1, =0xfedf0000 - adds r0, r1 - ldr r1, =gUnknown_08616040 - lsrs r0, 15 - adds r0, r1 - ldrh r0, [r0] - bx lr - .pool - thumb_func_end ItemIdToBattleMoveId - - thumb_func_start sub_81B6D14 -sub_81B6D14: @ 81B6D14 - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - movs r1, 0 - ldr r3, =gUnknown_08616040 -_081B6D1E: - adds r0, r1, 0 - adds r0, 0x32 - lsls r0, 1 - adds r0, r3 - ldrh r0, [r0] - cmp r0, r2 - bne _081B6D34 - movs r0, 0x1 - b _081B6D40 - .pool -_081B6D34: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x7 - bls _081B6D1E - movs r0, 0 -_081B6D40: - pop {r1} - bx r1 - thumb_func_end sub_81B6D14 - - thumb_func_start pokemon_has_move -pokemon_has_move: @ 81B6D44 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - movs r4, 0 -_081B6D4E: - adds r1, r4, 0 - adds r1, 0xD - adds r0, r6, 0 - bl GetMonData - cmp r0, r5 - bne _081B6D60 - movs r0, 0x1 - b _081B6D6C -_081B6D60: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _081B6D4E - movs r0, 0 -_081B6D6C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end pokemon_has_move - - thumb_func_start sub_81B6D74 -sub_81B6D74: @ 81B6D74 - push {r4,lr} - adds r1, r0, 0 - ldr r4, =gStringVar4 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6D74 - - thumb_func_start sub_81B6D98 -sub_81B6D98: @ 81B6D98 - push {r4,lr} - adds r4, r0, 0 - adds r0, r1, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_81B6D74 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6794 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6D98 - - thumb_func_start sub_81B6DC4 -sub_81B6DC4: @ 81B6DC4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0x5 - bl PlaySE - ldr r7, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r7, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - movs r0, 0xE - adds r0, r7 - mov r8, r0 - ldr r0, =gSpecialVar_ItemId - ldrh r4, [r0] - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - adds r0, r4, 0 - bl ItemIdToBattleMoveId - strh r0, [r7, 0xE] - ldr r0, =gStringVar2 - movs r1, 0xE - ldrsh r2, [r7, r1] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - movs r0, 0 - mov r1, r8 - strh r0, [r1, 0x2] - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B22D8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B6E70 - cmp r0, 0x2 - beq _081B6E78 - ldrh r1, [r7, 0xE] - adds r0, r5, 0 - bl GiveMoveToMon - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - beq _081B6E88 - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B6EB4 - str r0, [r1] - b _081B6E9C - .pool -_081B6E70: - ldr r1, =gText_PkmnCantLearnMove - b _081B6E7A - .pool -_081B6E78: - ldr r1, =gText_PkmnAlreadyKnows -_081B6E7A: - adds r0, r6, 0 - bl sub_81B6D98 - b _081B6E9C - .pool -_081B6E88: - ldr r0, =gText_PkmnNeedsToReplaceMove - bl sub_81B6D74 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6FF4 - str r1, [r0] -_081B6E9C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6DC4 - - thumb_func_start sub_81B6EB4 -sub_81B6EB4: @ 81B6EB4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r2, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r6, r2, 0 - adds r6, 0xE - ldr r0, =gSpecialVar_ItemId - ldrh r4, [r0] - movs r1, 0x2 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081B6EF0 - adds r0, r5, 0 - movs r1, 0x4 - bl AdjustFriendship - movs r0, 0xA9 - lsls r0, 1 - cmp r4, r0 - bhi _081B6EF0 - adds r0, r4, 0 - movs r1, 0x1 - bl RemoveBagItem -_081B6EF0: - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r0, =gStringVar2 - movs r1, 0 - ldrsh r2, [r6, r1] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnLearnedMove3 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - 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_81B6F60 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6EB4 - - thumb_func_start sub_81B6F60 -sub_81B6F60: @ 81B6F60 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B6F86 - ldr r0, =0x0000016f - bl PlayFanfare - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6F98 - str r1, [r0] -_081B6F86: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6F60 - - thumb_func_start sub_81B6F98 -sub_81B6F98: @ 81B6F98 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _081B6FEA - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _081B6FC0 - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B6FEA -_081B6FC0: - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x10 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - bne _081B6FDC - adds r0, r4, 0 - bl sub_81B77AC - b _081B6FEA - .pool -_081B6FDC: - cmp r0, 0x2 - bne _081B6FE4 - ldr r0, =gSpecialVar_Result - strh r2, [r0] -_081B6FE4: - adds r0, r5, 0 - bl sub_81B12C0 -_081B6FEA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6F98 - - thumb_func_start sub_81B6FF4 -sub_81B6FF4: @ 81B6FF4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B7018 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B7028 - str r0, [r1] -_081B7018: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B6FF4 - - thumb_func_start sub_81B7028 -sub_81B7028: @ 81B7028 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B704E - cmp r1, 0 - bgt _081B7048 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B7074 - b _081B7080 -_081B7048: - cmp r1, 0x1 - beq _081B707A - b _081B7080 -_081B704E: - ldr r0, =gText_WhichMoveToForget - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B7088 - str r1, [r0] - b _081B7080 - .pool -_081B7074: - movs r0, 0x5 - bl PlaySE -_081B707A: - adds r0, r4, 0 - bl sub_81B7230 -_081B7080: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B7028 - - thumb_func_start sub_81B7088 -sub_81B7088: @ 81B7088 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B70A8 - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B70B8 - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 -_081B70A8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7088 - - thumb_func_start sub_81B70B8 -sub_81B70B8: @ 81B70B8 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gPlayerParty - ldr r4, =gUnknown_0203CEC8 - ldrb r1, [r4, 0x9] - ldr r2, =gPlayerPartyCount - ldrb r2, [r2] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =sub_81B70F0 - ldrh r4, [r4, 0xE] - str r4, [sp] - bl ShowSelectMovePokemonSummaryScreen - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B70B8 - - thumb_func_start sub_81B70F0 -sub_81B70F0: @ 81B70F0 - push {lr} - sub sp, 0xC - movs r0, 0x7F - str r0, [sp] - ldr r0, =sub_81B711C - str r0, [sp, 0x4] - ldr r0, =gUnknown_0203CEC8 - ldr r0, [r0] - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B70F0 - - thumb_func_start sub_81B711C -sub_81B711C: @ 81B711C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B714E - bl sub_81C1B94 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - beq _081B7148 - adds r0, r4, 0 - bl sub_81B7154 - b _081B714E - .pool -_081B7148: - adds r0, r5, 0 - bl sub_81B7230 -_081B714E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81B711C - - thumb_func_start sub_81B7154 -sub_81B7154: @ 81B7154 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - adds r5, r1, 0 - muls r5, r0 - ldr r0, =gPlayerParty - adds r5, r0 - bl sub_81C1B94 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r1, 0xD - adds r0, r5, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r0, =gStringVar2 - movs r1, 0xD - muls r1, r4 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r0, =gText_12PoofForgotMove - bl sub_81B6D74 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B71D4 - str r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7154 - - thumb_func_start sub_81B71D4 -sub_81B71D4: @ 81B71D4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B7220 - ldr r5, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r5, r1] - movs r0, 0x64 - adds r4, r1, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - bl sub_81C1B94 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl RemoveMonPPBonus - ldrh r5, [r5, 0xE] - bl sub_81C1B94 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl SetMonMoveSlot - adds r0, r6, 0 - bl sub_81B6EB4 -_081B7220: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B71D4 - - thumb_func_start sub_81B7230 -sub_81B7230: @ 81B7230 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gStringVar2 - ldr r1, =gUnknown_0203CEC8 - movs r3, 0xE - ldrsh r2, [r1, r3] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_StopLearningMove2 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B7294 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7230 - - thumb_func_start sub_81B7294 -sub_81B7294: @ 81B7294 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B72B8 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B72C8 - str r0, [r1] -_081B72B8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7294 - - thumb_func_start sub_81B72C8 -sub_81B72C8: @ 81B72C8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r7, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r7, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r5, r0, 24 - cmp r5, 0 - beq _081B7306 - cmp r5, 0 - bgt _081B7300 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _081B738C - b _081B73C2 - .pool -_081B7300: - cmp r5, 0x1 - beq _081B7392 - b _081B73C2 -_081B7306: - ldr r1, =gStringVar1 - adds r0, r4, 0 - bl GetMonNickname - ldr r0, =gStringVar2 - movs r1, 0xE - ldrsh r2, [r7, r1] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_MoveNotLearned - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - movs r3, 0x10 - ldrsh r0, [r7, r3] - cmp r0, 0x1 - bne _081B7368 - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B73E4 - str r0, [r1] - b _081B73C2 - .pool -_081B7368: - cmp r0, 0x2 - bne _081B7370 - ldr r0, =gSpecialVar_Result - strh r5, [r0] -_081B7370: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B6794 - str r0, [r1] - b _081B73C2 - .pool -_081B738C: - movs r0, 0x5 - bl PlaySE -_081B7392: - ldr r1, =gStringVar1 - adds r0, r4, 0 - bl GetMonNickname - ldr r0, =gStringVar2 - ldr r1, =gUnknown_0203CEC8 - movs r3, 0xE - ldrsh r2, [r1, r3] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r0, =gText_PkmnNeedsToReplaceMove - bl sub_81B6D74 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6FF4 - str r1, [r0] -_081B73C2: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B72C8 - - thumb_func_start sub_81B73E4 -sub_81B73E4: @ 81B73E4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B73FC - adds r0, r4, 0 - bl sub_81B77AC -_081B73FC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B73E4 - - thumb_func_start dp05_rare_candy -dp05_rare_candy: @ 81B7404 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r10, r1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - mov r9, r0 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - ldr r0, =gUnknown_0203CEC4 - ldr r6, [r0] - movs r1, 0x86 - lsls r1, 2 - adds r4, r6, r1 - ldr r2, =gSpecialVar_ItemId - mov r8, r2 - adds r0, r5, 0 - movs r1, 0x38 - bl GetMonData - cmp r0, 0x64 - beq _081B7478 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_81B79A0 - mov r1, r9 - ldrb r0, [r1, 0x9] - mov r2, r8 - ldrh r1, [r2] - movs r2, 0 - bl ExecuteTableBasedItemEffect__ - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x89 - lsls r0, 2 - adds r1, r6, r0 - adds r0, r5, 0 - bl sub_81B79A0 - b _081B747A - .pool -_081B7478: - movs r4, 0x1 -_081B747A: - movs r0, 0x5 - bl PlaySE - cmp r4, 0 - beq _081B74B4 - ldr r1, =gUnknown_0203CEE8 - movs r0, 0 - strb r0, [r1] - ldr r0, =gText_WontHaveEffect - movs r1, 0x1 - bl sub_81B1B5C - 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 - mov r1, r10 - b _081B7516 - .pool -_081B74B4: - ldr r1, =gUnknown_0203CEE8 - movs r0, 0x1 - strb r0, [r1] - movs r0, 0 - bl PlayFanfareByFanfareNum - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - adds r1, r5, 0 - bl sub_81B754C - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r4, =gStringVar2 - adds r0, r5, 0 - movs r1, 0x38 - bl GetMonData - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnElevatedToLvVar2 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - 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_81B75D4 -_081B7516: - str r1, [r0] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp05_rare_candy - - thumb_func_start sub_81B754C -sub_81B754C: @ 81B754C - push {r4-r7,lr} - adds r5, r1, 0 - lsls r0, 24 - lsrs r0, 24 - adds r7, r0, 0 - ldr r6, =gUnknown_0203CEDC - lsls r4, r7, 4 - ldr r1, [r6] - adds r1, r4 - adds r0, r5, 0 - bl party_menu_get_status_condition_and_update_object - ldr r2, =gSprites - ldr r0, [r6] - adds r3, r4, r0 - ldrb r1, [r3, 0xC] - 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 - bge _081B7588 - adds r0, r5, 0 - adds r1, r3, 0 - movs r2, 0x1 - bl sub_81B2AC8 -_081B7588: - ldr r1, [r6] - adds r1, r4 - adds r0, r5, 0 - movs r2, 0x1 - bl sub_81B2CD4 - ldr r1, [r6] - adds r1, r4 - adds r0, r5, 0 - movs r2, 0x1 - bl sub_81B2D74 - ldr r1, [r6] - adds r1, r4 - adds r0, r5, 0 - bl sub_81B2E28 - ldr r0, [r6] - adds r0, r4, r0 - ldrb r0, [r0, 0x9] - adds r1, r5, 0 - bl sub_81B5B38 - adds r0, r7, 0 - movs r1, 0x1 - bl sub_81B0FCC - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B754C - - thumb_func_start sub_81B75D4 -sub_81B75D4: @ 81B75D4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0 - bl WaitFanfare - lsls r0, 24 - cmp r0, 0 - beq _081B7620 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B7620 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081B7606 - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B7620 -_081B7606: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B767C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B7634 - str r0, [r1] -_081B7620: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B75D4 - - thumb_func_start sub_81B7634 -sub_81B7634: @ 81B7634 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081B764E - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B7668 -_081B764E: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B76C8 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B7704 - str r0, [r1] -_081B7668: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7634 - - thumb_func_start sub_81B767C -sub_81B767C: @ 81B767C - push {r4,r5,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203CEC4 - ldr r5, [r0] - movs r0, 0x86 - lsls r0, 2 - adds r4, r5, r0 - bl sub_81B3364 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x18] - ldrh r0, [r4, 0x18] - movs r1, 0x89 - lsls r1, 2 - adds r2, r5, r1 - movs r1, 0x2 - str r1, [sp] - movs r1, 0x3 - str r1, [sp, 0x4] - adds r1, r4, 0 - movs r3, 0x1 - bl sub_81D3640 - ldrb r0, [r4, 0x18] - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B767C - - thumb_func_start sub_81B76C8 -sub_81B76C8: @ 81B76C8 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - movs r0, 0x86 - lsls r0, 2 - adds r4, r1, r0 - ldrh r0, [r4, 0x18] - movs r2, 0x89 - lsls r2, 2 - adds r1, r2 - movs r2, 0x3 - str r2, [sp] - movs r2, 0x1 - movs r3, 0x2 - bl sub_81D3784 - ldrb r0, [r4, 0x18] - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B76C8 - - thumb_func_start sub_81B7704 -sub_81B7704: @ 81B7704 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0 - bl WaitFanfare - lsls r0, 24 - cmp r0, 0 - beq _081B77A6 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r6, 0x1 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _081B772C - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B77A6 -_081B772C: - bl sub_81B3394 - ldr r4, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r4, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x1 - bl MonTryLearningNewMove - lsls r0, 16 - lsrs r1, r0, 16 - strh r6, [r4, 0x10] - ldr r0, =0x0000fffe - cmp r1, r0 - beq _081B7788 - cmp r1, r0 - bgt _081B776C - cmp r1, 0 - beq _081B7778 - b _081B77A0 - .pool -_081B776C: - ldr r0, =0x0000ffff - cmp r1, r0 - beq _081B7780 - b _081B77A0 - .pool -_081B7778: - adds r0, r5, 0 - bl sub_81B7810 - b _081B77A6 -_081B7780: - adds r0, r5, 0 - bl sub_81B787C - b _081B77A6 -_081B7788: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B77AC - str r0, [r1] - b _081B77A6 - .pool -_081B77A0: - adds r0, r5, 0 - bl sub_81B7910 -_081B77A6: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B7704 - - thumb_func_start sub_81B77AC -sub_81B77AC: @ 81B77AC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - bl MonTryLearningNewMove - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =0x0000fffe - cmp r1, r0 - beq _081B780A - cmp r1, r0 - bgt _081B77E8 - cmp r1, 0 - beq _081B77F4 - b _081B7804 - .pool -_081B77E8: - ldr r0, =0x0000ffff - cmp r1, r0 - beq _081B77FC - b _081B7804 - .pool -_081B77F4: - adds r0, r4, 0 - bl sub_81B7810 - b _081B780A -_081B77FC: - adds r0, r4, 0 - bl sub_81B787C - b _081B780A -_081B7804: - adds r0, r4, 0 - bl sub_81B7910 -_081B780A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B77AC - - thumb_func_start sub_81B7810 -sub_81B7810: @ 81B7810 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r6, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r0, r7, 0 - movs r1, 0 - movs r2, 0 - bl GetEvolutionTargetSpecies - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _081B7860 - bl sub_81B06F4 - ldr r0, =gCB2_AfterEvolution - ldr r1, [r6] - str r1, [r0] - ldrb r3, [r6, 0x9] - adds r0, r7, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl BeginEvolutionScene - adds r0, r5, 0 - bl DestroyTask - b _081B786E - .pool -_081B7860: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B6794 - str r0, [r1] -_081B786E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7810 - - thumb_func_start sub_81B787C -sub_81B787C: @ 81B787C - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0203CEC8 - mov r8, r0 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r0, =gStringVar2 - ldr r6, =gMoveToLearn - ldrh r2, [r6] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnNeedsToReplaceMove - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldrh r0, [r6] - mov r1, r8 - strh r0, [r1, 0xE] - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6FF4 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B787C - - thumb_func_start sub_81B7910 -sub_81B7910: @ 81B7910 - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r6, r0, 0 - adds r5, r1, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r5, 16 - lsrs r5, 16 - ldr r0, =gUnknown_0203CEC8 - mov r8, r0 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r0, =gStringVar2 - movs r1, 0xD - muls r1, r5 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnLearnedMove3 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - mov r0, r8 - strh r5, [r0, 0xE] - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6F60 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7910 - - thumb_func_start sub_81B79A0 -sub_81B79A0: @ 81B79A0 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r5] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - strh r0, [r5, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - strh r0, [r5, 0x4] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - strh r0, [r5, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - strh r0, [r5, 0xA] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - strh r0, [r5, 0x6] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81B79A0 - - thumb_func_start sub_81B79E8 -sub_81B79E8: @ 81B79E8 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CEC4 - ldr r2, [r1] - movs r3, 0x86 - lsls r3, 2 - adds r1, r2, r3 - movs r3, 0 - strh r3, [r1] - ldr r4, =0x0000021a - adds r1, r2, r4 - strh r3, [r1] - ldr r1, =gUnknown_0203CEC8 - ldrb r1, [r1, 0x9] - lsls r1, 24 - asrs r1, 24 - movs r3, 0x87 - lsls r3, 2 - adds r2, r3 - strh r1, [r2] - bl sub_81B7A28 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B79E8 - - thumb_func_start sub_81B7A28 -sub_81B7A28: @ 81B7A28 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - mov r8, r4 - ldr r6, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r6, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B7A6E - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - ldrb r0, [r6, 0x9] - ldr r1, =gSpecialVar_ItemId - ldrh r1, [r1] - movs r2, 0 - bl ExecuteTableBasedItemEffect__ - lsls r0, 24 - cmp r0, 0 - beq _081B7A94 -_081B7A6E: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =task_intro_gamefreak - str r0, [r1] - b _081B7B2A - .pool -_081B7A94: - movs r0, 0x1 - bl PlaySE - ldr r4, =gUnknown_0203CEDC - movs r0, 0x9 - ldrsb r0, [r6, r0] - lsls r0, 4 - ldr r1, [r4] - adds r1, r0 - adds r0, r5, 0 - bl party_menu_get_status_condition_and_update_object - ldr r2, =gSprites - movs r0, 0x9 - ldrsb r0, [r6, r0] - ldr r1, [r4] - lsls r0, 4 - adds r3, r0, r1 - ldrb r1, [r3, 0xC] - 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 - bge _081B7AD6 - adds r0, r5, 0 - adds r1, r3, 0 - movs r2, 0x1 - bl sub_81B2AC8 -_081B7AD6: - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - movs r1, 0x87 - lsls r1, 2 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl sub_81B0FCC - ldrb r0, [r6, 0x9] - movs r1, 0x1 - bl sub_81B0FCC - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - adds r3, r0, 0 - subs r3, r7 - lsls r3, 16 - asrs r3, 16 - ldrb r1, [r6, 0x9] - ldr r0, =sub_81B7C10 - str r0, [sp] - mov r0, r8 - movs r2, 0x1 - bl sub_81B1F18 - mov r0, r8 - movs r1, 0 - adds r2, r7, 0 - bl sub_81B1FA8 - ldr r0, [r4] - movs r2, 0x86 - lsls r2, 2 - adds r1, r0, r2 - movs r2, 0x1 - strh r2, [r1] - ldr r1, =0x0000021a - adds r0, r1 - strh r2, [r0] -_081B7B2A: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7A28 - - thumb_func_start task_intro_gamefreak -task_intro_gamefreak: @ 81B7B4C - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B7C0A - ldr r5, =gUnknown_0203CEC4 - ldr r2, [r5] - movs r0, 0x86 - lsls r0, 2 - adds r1, r2, r0 - movs r3, 0 - ldrsh r0, [r1, r3] - ldr r3, =gUnknown_0203CEC8 - cmp r0, 0x1 - bne _081B7B82 - movs r0, 0 - strh r0, [r1] - movs r1, 0x9 - ldrsb r1, [r3, r1] - movs r6, 0x87 - lsls r6, 2 - adds r0, r2, r6 - strh r1, [r0] -_081B7B82: - ldrb r0, [r3, 0x9] - adds r0, 0x1 - strb r0, [r3, 0x9] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x6 - bne _081B7C04 - ldr r0, [r5] - ldr r1, =0x0000021a - adds r0, r1 - movs r2, 0 - ldrsh r1, [r0, r2] - cmp r1, 0 - bne _081B7BC8 - ldr r0, =gUnknown_0203CEE8 - strb r1, [r0] - ldr r0, =gText_WontHaveEffect - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - b _081B7BD8 - .pool -_081B7BC8: - ldr r1, =gUnknown_0203CEE8 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem -_081B7BD8: - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6794 - str r1, [r0] - ldr r1, =gUnknown_0203CEC8 - movs r0, 0 - strb r0, [r1, 0x9] - b _081B7C0A - .pool -_081B7C04: - adds r0, r4, 0 - bl sub_81B7A28 -_081B7C0A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end task_intro_gamefreak - - thumb_func_start sub_81B7C10 -sub_81B7C10: @ 81B7C10 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnHPRestoredByVar2 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_intro_gamefreak - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7C10 - - thumb_func_start sub_81B7C74 -sub_81B7C74: @ 81B7C74 - push {r4-r6,lr} - adds r6, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0x5 - bl PlaySE - ldr r2, =gCB2_AfterEvolution - ldr r1, =gUnknown_0203CEC8 - ldr r0, [r1] - str r0, [r2] - ldrb r0, [r1, 0x9] - ldr r4, =gSpecialVar_ItemId - ldrh r1, [r4] - movs r2, 0 - bl ExecuteTableBasedItemEffect__ - lsls r0, 24 - cmp r0, 0 - beq _081B7CD8 - ldr r1, =gUnknown_0203CEE8 - movs r0, 0 - strb r0, [r1] - ldr r0, =gText_WontHaveEffect - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - str r6, [r0] - b _081B7CE4 - .pool -_081B7CD8: - ldrh r0, [r4] - movs r1, 0x1 - bl RemoveBagItem - bl sub_81B06F4 -_081B7CE4: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B7C74 - - thumb_func_start GetItemEffectType -@ u8 GetItemEffectType(u16 itemId) -GetItemEffectType: @ 81B7CEC - push {r4,r5,lr} - lsls r0, 16 - lsrs r1, r0, 16 - adds r2, r1, 0 - subs r2, 0xD - lsls r0, r2, 16 - lsrs r0, 16 - cmp r0, 0xA5 - bls _081B7D00 - b _081B7E40 -_081B7D00: - cmp r1, 0xAF - bne _081B7D18 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003214 - adds r4, r0, r1 - b _081B7D20 - .pool -_081B7D18: - ldr r1, =gItemEffectTable - lsls r0, r2, 2 - adds r0, r1 - ldr r4, [r0] -_081B7D20: - ldrb r1, [r4] - movs r5, 0x3F - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _081B7D42 - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _081B7D42 - ldrb r0, [r4, 0x2] - cmp r0, 0 - bne _081B7D42 - ldrb r3, [r4, 0x3] - movs r0, 0x80 - ands r0, r3 - cmp r0, 0 - beq _081B7D4C -_081B7D42: - movs r0, 0 - b _081B7E46 - .pool -_081B7D4C: - movs r2, 0x40 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _081B7D5A - movs r0, 0xA - b _081B7E46 -_081B7D5A: - adds r0, r2, 0 - ands r0, r3 - cmp r0, 0 - beq _081B7D66 - movs r0, 0x1 - b _081B7E46 -_081B7D66: - adds r2, r5, 0 - ands r2, r3 - cmp r2, 0 - bne _081B7D74 - lsrs r0, r1, 7 - cmp r0, 0 - beq _081B7DB6 -_081B7D74: - cmp r2, 0x20 - bne _081B7D7C - movs r0, 0x4 - b _081B7E46 -_081B7D7C: - cmp r2, 0x10 - bne _081B7D84 - movs r0, 0x3 - b _081B7E46 -_081B7D84: - cmp r2, 0x8 - bne _081B7D8C - movs r0, 0x5 - b _081B7E46 -_081B7D8C: - cmp r2, 0x4 - bne _081B7D94 - movs r0, 0x6 - b _081B7E46 -_081B7D94: - cmp r2, 0x2 - bne _081B7D9C - movs r0, 0x7 - b _081B7E46 -_081B7D9C: - cmp r2, 0x1 - bne _081B7DA4 - movs r0, 0x8 - b _081B7E46 -_081B7DA4: - lsrs r0, r1, 7 - cmp r0, 0 - beq _081B7DB2 - cmp r2, 0 - bne _081B7DB2 - movs r0, 0x9 - b _081B7E46 -_081B7DB2: - movs r0, 0xB - b _081B7E46 -_081B7DB6: - ldrb r1, [r4, 0x4] - movs r0, 0x44 - ands r0, r1 - adds r2, r1, 0 - cmp r0, 0 - beq _081B7DC6 - movs r0, 0x2 - b _081B7E46 -_081B7DC6: - movs r5, 0x2 - adds r0, r5, 0 - ands r0, r2 - cmp r0, 0 - beq _081B7DD4 - movs r0, 0xC - b _081B7E46 -_081B7DD4: - movs r3, 0x1 - adds r0, r3, 0 - ands r0, r2 - cmp r0, 0 - beq _081B7DE2 - movs r0, 0xD - b _081B7E46 -_081B7DE2: - ldrb r1, [r4, 0x5] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081B7DF0 - movs r0, 0xE - b _081B7E46 -_081B7DF0: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081B7DFC - movs r0, 0xF - b _081B7E46 -_081B7DFC: - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _081B7E08 - movs r0, 0x10 - b _081B7E46 -_081B7E08: - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _081B7E14 - movs r0, 0x11 - b _081B7E46 -_081B7E14: - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _081B7E20 - movs r0, 0x12 - b _081B7E46 -_081B7E20: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _081B7E2C - movs r0, 0x13 - b _081B7E46 -_081B7E2C: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081B7E38 - movs r0, 0x14 - b _081B7E46 -_081B7E38: - movs r0, 0x18 - ands r0, r2 - cmp r0, 0 - bne _081B7E44 -_081B7E40: - movs r0, 0x16 - b _081B7E46 -_081B7E44: - movs r0, 0x15 -_081B7E46: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end GetItemEffectType - - thumb_func_start sub_81B7E4C -sub_81B7E4C: @ 81B7E4C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B7F1C - ldr r7, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r7, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - movs r0, 0xE - adds r0, r7 - mov r8, r0 - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r4, =gSpecialVar_0x8005 - ldrb r0, [r4] - bl sub_81B2360 - strh r0, [r7, 0xE] - ldr r0, =gStringVar2 - movs r1, 0xE - ldrsh r2, [r7, r1] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - movs r0, 0x2 - mov r1, r8 - strh r0, [r1, 0x2] - ldrb r2, [r4] - adds r0, r5, 0 - movs r1, 0 - bl sub_81B22D8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B7EF0 - cmp r0, 0x2 - beq _081B7EF8 - ldrh r1, [r7, 0xE] - adds r0, r5, 0 - bl GiveMoveToMon - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - beq _081B7F08 - adds r0, r6, 0 - bl sub_81B6EB4 - b _081B7F1C - .pool -_081B7EF0: - ldr r1, =gText_PkmnCantLearnMove - b _081B7EFA - .pool -_081B7EF8: - ldr r1, =gText_PkmnAlreadyKnows -_081B7EFA: - adds r0, r6, 0 - bl sub_81B6D98 - b _081B7F1C - .pool -_081B7F08: - ldr r0, =gText_PkmnNeedsToReplaceMove - bl sub_81B6D74 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B6FF4 - str r1, [r0] -_081B7F1C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7E4C - - thumb_func_start CB2_PartyMenuFromStartMenu -CB2_PartyMenuFromStartMenu: @ 81B7F34 - push {lr} - sub sp, 0xC - movs r0, 0 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =CB2_ReturnToFieldWithOpenMenu - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end CB2_PartyMenuFromStartMenu - - thumb_func_start sub_81B7F60 -sub_81B7F60: @ 81B7F60 - push {lr} - sub sp, 0xC - bl InBattlePyramid - lsls r0, 24 - ldr r1, =sub_81C4F84 - cmp r0, 0 - bne _081B7F72 - ldr r1, =c2_815ABFC -_081B7F72: - movs r0, 0x6 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - str r1, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0x5 - movs r3, 0 - bl sub_81B0038 - ldr r1, =gUnknown_0203CEC8 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - strh r0, [r1, 0xC] - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7F60 - - thumb_func_start sub_81B7FAC -sub_81B7FAC: @ 81B7FAC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - ldr r5, =gUnknown_0203CEFC - ldr r0, =gUnknown_0203CEC8 - mov r9, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r1, 0x64 - mov r8, r1 - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - ldr r7, =gPlayerParty - adds r0, r7 - movs r1, 0xC - bl GetMonData - strh r0, [r5] - lsls r0, 16 - cmp r0, 0 - bne _081B7FF8 - adds r0, r4, 0 - bl sub_81B8044 - b _081B8030 - .pool -_081B7FF8: - ldrh r0, [r5] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B800C - adds r0, r4, 0 - bl sub_81B83B8 - b _081B8030 -_081B800C: - mov r1, r9 - movs r0, 0x9 - ldrsb r0, [r1, r0] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r7 - ldrh r1, [r5] - movs r2, 0x1 - bl sub_81B1D1C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B82A0 - str r1, [r0] -_081B8030: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B7FAC - - thumb_func_start sub_81B8044 -sub_81B8044: @ 81B8044 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r5, =gUnknown_0203CEC8 - ldrh r0, [r5, 0xC] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B807C - ldrh r0, [r5, 0xC] - bl sub_81B83F0 - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B814C - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 - b _081B8082 - .pool -_081B807C: - adds r0, r4, 0 - bl sub_81B8088 -_081B8082: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81B8044 - - thumb_func_start sub_81B8088 -sub_81B8088: @ 81B8088 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B80E4 - ldr r4, =gUnknown_0203CEC8 - ldrh r5, [r4, 0xC] - movs r0, 0x9 - ldrsb r0, [r4, r0] - movs r1, 0x64 - mov r8, r1 - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - ldr r6, =gPlayerParty - adds r0, r6 - adds r1, r5, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81B1C84 - movs r0, 0x9 - ldrsb r0, [r4, r0] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r6 - adds r1, r5, 0 - bl sub_81B1DB8 - adds r0, r5, 0 - bl sub_81B83F0 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B8104 - str r1, [r0] -_081B80E4: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8088 - - thumb_func_start sub_81B8104 -sub_81B8104: @ 81B8104 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r4, [r0, 0x9] - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B8138 - lsls r2, r4, 24 - asrs r2, 24 - movs r0, 0x64 - muls r0, r2 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gUnknown_0203CEDC - lsls r2, 4 - ldr r1, [r1] - adds r1, r2 - bl sub_81B5C94 - adds r0, r5, 0 - bl sub_81B12C0 -_081B8138: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8104 - - thumb_func_start sub_81B814C -sub_81B814C: @ 81B814C - push {r4-r6,lr} - ldr r4, =gUnknown_0203CEC8 - movs r0, 0x9 - ldrsb r0, [r4, r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - ldrh r1, [r4, 0xC] - bl sub_81B1DB8 - movs r0, 0x9 - ldrsb r0, [r4, r0] - muls r0, r6 - adds r0, r5 - movs r1, 0x40 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSaveBlock1Ptr - lsls r2, r0, 3 - adds r2, r0 - lsls r2, 2 - ldr r0, =0x00002be0 - adds r2, r0 - ldr r1, [r1] - adds r1, r2 - ldr r2, =sub_81B81A8 - movs r0, 0x4 - movs r3, 0x3 - bl sub_811A20C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B814C - - thumb_func_start sub_81B81A8 -sub_81B81A8: @ 81B81A8 - push {r4-r7,lr} - sub sp, 0xC - ldr r6, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r6, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0 - bne _081B8208 - adds r0, r5, 0 - bl TakeMailFromMon - ldr r4, =gUnknown_0203CEFC - adds r0, r5, 0 - movs r1, 0xC - adds r2, r4, 0 - bl SetMonData - ldrh r0, [r4] - movs r1, 0x1 - bl RemoveBagItem - adds r0, r7, 0 - bl sub_81B841C - ldr r0, [r6] - bl SetMainCallback2 - b _081B8224 - .pool -_081B8208: - ldrb r0, [r6, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r6, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B8230 - str r1, [sp, 0x4] - ldr r1, [r6] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 -_081B8224: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B81A8 - - thumb_func_start sub_81B8230 -sub_81B8230: @ 81B8230 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B828A - ldr r1, =gUnknown_0203CEFC - ldrh r0, [r1] - cmp r0, 0 - beq _081B8264 - ldr r0, =gUnknown_0203CEC8 - ldrh r0, [r0, 0xC] - ldrh r1, [r1] - movs r2, 0 - bl sub_81B1D68 - b _081B827C - .pool -_081B8264: - ldr r2, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r2, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldrh r1, [r2, 0xC] - movs r2, 0 - movs r3, 0x1 - bl sub_81B1C84 -_081B827C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B8104 - str r0, [r1] -_081B828A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8230 - - thumb_func_start sub_81B82A0 -sub_81B82A0: @ 81B82A0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B82C4 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B82D4 - str r0, [r1] -_081B82C4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B82A0 - - thumb_func_start sub_81B82D4 -sub_81B82D4: @ 81B82D4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B82FA - cmp r1, 0 - bgt _081B82F4 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B8394 - b _081B83A8 -_081B82F4: - cmp r1, 0x1 - beq _081B839A - b _081B83A8 -_081B82FA: - ldr r7, =gUnknown_0203CEC8 - ldrh r4, [r7, 0xC] - adds r0, r4, 0 - bl sub_81B83F0 - ldr r6, =gUnknown_0203CEFC - ldrh r0, [r6] - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - cmp r0, 0 - bne _081B8338 - adds r0, r4, 0 - bl sub_81B841C - ldrh r0, [r6] - bl pokemon_item_not_removed - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_81B1B5C - b _081B8378 - .pool -_081B8338: - adds r0, r4, 0 - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B835C - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B814C - str r0, [r1, 0x4] - adds r0, r5, 0 - bl sub_81B12C0 - b _081B83A8 - .pool -_081B835C: - movs r1, 0x9 - ldrsb r1, [r7, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - bl sub_81B1DB8 - ldrh r1, [r6] - adds r0, r4, 0 - movs r2, 0x1 - bl sub_81B1D68 -_081B8378: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B8104 - str r1, [r0] - b _081B83A8 - .pool -_081B8394: - movs r0, 0x5 - bl PlaySE -_081B839A: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B8104 - str r0, [r1] -_081B83A8: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B82D4 - - thumb_func_start sub_81B83B8 -sub_81B83B8: @ 81B83B8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gText_RemoveMailBeforeItem - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B8104 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B83B8 - - thumb_func_start sub_81B83F0 -sub_81B83F0: @ 81B83F0 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0x6 - bne _081B8410 - lsls r0, r1, 24 - lsrs r0, 24 - movs r1, 0x1 - bl RemovePCItem - b _081B8418 - .pool -_081B8410: - adds r0, r1, 0 - movs r1, 0x1 - bl RemoveBagItem -_081B8418: - pop {r0} - bx r0 - thumb_func_end sub_81B83F0 - - thumb_func_start sub_81B841C -sub_81B841C: @ 81B841C - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0x5 - beq _081B8438 - adds r0, r1, 0 - movs r1, 0x1 - bl AddPCItem - b _081B8440 - .pool -_081B8438: - adds r0, r1, 0 - movs r1, 0x1 - bl AddBagItem -_081B8440: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_81B841C - - thumb_func_start sub_81B8448 -sub_81B8448: @ 81B8448 - push {lr} - sub sp, 0xC - movs r0, 0x6 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =Mailbox_ReturnToMailListAfterDeposit - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0x7 - movs r3, 0 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8448 - - thumb_func_start sub_81B8474 -sub_81B8474: @ 81B8474 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - ldr r1, =gUnknown_0203CEE8 - movs r0, 0 - strb r0, [r1] - ldr r2, =gSaveBlock1Ptr - ldr r0, =playerPCItemPageInfo - ldrh r1, [r0] - adds r1, 0x6 - ldrh r0, [r0, 0x2] - adds r1, r0 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =0x00002be0 - adds r0, r1 - ldr r1, [r2] - adds r4, r1, r0 - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - beq _081B84DC - ldr r0, =gText_PkmnHoldingItemCantHoldMail - movs r1, 0x1 - bl sub_81B1B5C - b _081B84F2 - .pool -_081B84DC: - adds r0, r5, 0 - adds r1, r4, 0 - bl GiveMailToMon2 - adds r0, r4, 0 - bl ClearMailStruct - ldr r0, =gText_MailTransferredFromMailbox - movs r1, 0x1 - bl sub_81B1B5C -_081B84F2: - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B8104 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8474 - - thumb_func_start sub_81B8518 -sub_81B8518: @ 81B8518 - push {lr} - sub sp, 0xC - bl sub_81B8558 - movs r0, 0 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =gMain - ldr r0, [r0, 0x8] - str r0, [sp, 0x8] - movs r0, 0x4 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_81B0038 - ldr r1, =gUnknown_0203CEC8 - ldr r0, =sub_81B879C - str r0, [r1, 0x4] - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8518 - - thumb_func_start sub_81B8558 -sub_81B8558: @ 81B8558 - push {lr} - ldr r0, =gSelectedOrderFromParty - movs r1, 0 - movs r2, 0x4 - bl memset - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8558 - - thumb_func_start sub_81B856C -sub_81B856C: @ 81B856C - push {r4,lr} - lsls r0, 24 - asrs r4, r0, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_81B85AC - lsls r0, 24 - cmp r0, 0 - bne _081B858C - movs r0, 0x2 - b _081B85A4 - .pool -_081B858C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r0, 24 - bl sub_81B8770 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B85A2 - movs r0, 0 - b _081B85A4 -_081B85A2: - movs r0, 0x1 -_081B85A4: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B856C - - thumb_func_start sub_81B85AC -sub_81B85AC: @ 81B85AC - push {r4-r6,lr} - adds r5, r0, 0 - movs r6, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081B8608 - adds r0, r5, 0 - movs r1, 0x38 - bl GetMonData - adds r4, r0, 0 - bl sub_81B8888 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bhi _081B8608 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x0000191a - cmp r1, r0 - bne _081B85EA - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - bne _081B8608 -_081B85EA: - ldr r0, =0x000040cf - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x8 - beq _081B864A - cmp r0, 0x9 - bne _081B8618 - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _081B864A -_081B8608: - movs r0, 0 - b _081B864C - .pool -_081B8618: - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - ldr r3, =gFrontierBannedSpecies - lsls r1, r6, 1 - adds r0, r1, r3 - ldrh r0, [r0] - ldr r2, =0x0000ffff - cmp r0, r2 - beq _081B864A -_081B8632: - adds r0, r1, r3 - ldrh r0, [r0] - cmp r0, r4 - beq _081B8608 - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, r6, 1 - adds r0, r1, r3 - ldrh r0, [r0] - cmp r0, r2 - bne _081B8632 -_081B864A: - movs r0, 0x1 -_081B864C: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B85AC - - thumb_func_start sub_81B865C -sub_81B865C: @ 81B865C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - bl sub_81B885C - lsls r0, 24 - lsrs r2, r0, 24 - adds r1, r2, 0 - ldr r3, =gSelectedOrderFromParty - adds r0, r2, r3 - subs r0, 0x1 - ldrb r0, [r0] - cmp r0, 0 - bne _081B869C - cmp r2, 0x1 - bne _081B8688 - movs r0, 0xE - b _081B8758 - .pool -_081B8688: - ldr r0, =gStringVar1 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - movs r0, 0x11 - b _081B8758 - .pool -_081B869C: - ldr r0, =0x000040cf - bl VarGet - lsls r0, 24 - movs r1, 0xF8 - lsls r1, 24 - adds r0, r1 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081B86C0 - b _081B8756 - .pool -_081B86B8: - movs r0, 0x12 - b _081B8758 -_081B86BC: - movs r0, 0x13 - b _081B8758 -_081B86C0: - bl sub_81B8830 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r5, 0 - b _081B8750 -_081B86CE: - ldr r3, =gSelectedOrderFromParty - adds r4, r3, r5 - ldrb r0, [r4] - movs r1, 0x64 - muls r0, r1 - subs r0, 0x64 - ldr r3, =gPlayerParty - adds r0, r3, r0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - ldrb r0, [r4] - movs r1, 0x64 - muls r0, r1 - subs r0, 0x64 - ldr r3, =gPlayerParty - adds r0, r3, r0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r6, r0, 16 - adds r1, r5, 0x1 - lsls r0, r1, 24 - lsrs r4, r0, 24 - mov r9, r1 - cmp r4, r8 - bcs _081B8748 - movs r7, 0x64 -_081B870E: - ldr r0, =gSelectedOrderFromParty - adds r5, r0, r4 - ldrb r0, [r5] - muls r0, r7 - subs r0, 0x64 - ldr r1, =gPlayerParty - adds r0, r1, r0 - movs r1, 0xB - bl GetMonData - cmp r10, r0 - beq _081B86B8 - cmp r6, 0 - beq _081B873E - ldrb r0, [r5] - muls r0, r7 - subs r0, 0x64 - ldr r3, =gPlayerParty - adds r0, r3, r0 - movs r1, 0xC - bl GetMonData - cmp r6, r0 - beq _081B86BC -_081B873E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r8 - bcc _081B870E -_081B8748: - mov r1, r9 - lsls r0, r1, 24 - lsrs r5, r0, 24 - mov r0, r8 -_081B8750: - subs r0, 0x1 - cmp r5, r0 - blt _081B86CE -_081B8756: - movs r0, 0xFF -_081B8758: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B865C - - thumb_func_start sub_81B8770 -sub_81B8770: @ 81B8770 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - ldr r3, =gSelectedOrderFromParty -_081B877A: - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, r2 - bne _081B878C - movs r0, 0x1 - b _081B8798 - .pool -_081B878C: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _081B877A - movs r0, 0 -_081B8798: - pop {r1} - bx r1 - thumb_func_end sub_81B8770 - - thumb_func_start sub_81B879C -sub_81B879C: @ 81B879C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_81B865C - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xFF - beq _081B87D4 - movs r0, 0x20 - bl PlaySE - adds r0, r4, 0 - bl display_pokemon_menu_message - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B87E8 - str r0, [r1] - b _081B87E0 - .pool -_081B87D4: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81B12C0 -_081B87E0: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81B879C - - thumb_func_start sub_81B87E8 -sub_81B87E8: @ 81B87E8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081B8802 - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B881C -_081B8802: - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 - str r0, [r1] -_081B881C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B87E8 - - thumb_func_start sub_81B8830 -sub_81B8830: @ 81B8830 - push {lr} - ldr r0, =0x000040cf - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x8 - beq _081B884C - cmp r0, 0x9 - bne _081B8850 - movs r0, 0x3 - b _081B8854 - .pool -_081B884C: - movs r0, 0x2 - b _081B8854 -_081B8850: - ldr r0, =gSpecialVar_0x8005 - ldrb r0, [r0] -_081B8854: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B8830 - - thumb_func_start sub_81B885C -sub_81B885C: @ 81B885C - push {lr} - ldr r0, =0x000040cf - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x8 - beq _081B8878 - cmp r0, 0x9 - bne _081B887C - movs r0, 0x1 - b _081B8880 - .pool -_081B8878: - movs r0, 0x2 - b _081B8880 -_081B887C: - ldr r0, =gSpecialVar_0x8005 - ldrb r0, [r0] -_081B8880: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B885C - - thumb_func_start sub_81B8888 -sub_81B8888: @ 81B8888 - push {lr} - ldr r0, =0x000040cf - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x8 - beq _081B88A4 - cmp r0, 0x9 - bne _081B88A8 -_081B889C: - movs r0, 0x64 - b _081B88B2 - .pool -_081B88A4: - movs r0, 0x1E - b _081B88B2 -_081B88A8: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _081B889C - movs r0, 0x32 -_081B88B2: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B8888 - - thumb_func_start sub_81B88BC -sub_81B88BC: @ 81B88BC - push {lr} - ldr r0, =0x000040cf - bl VarGet - lsls r0, 24 - lsrs r1, r0, 24 - movs r2, 0xF8 - lsls r2, 24 - adds r0, r2 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081B88E0 - ldr r0, =gText_CancelBattle - b _081B88FA - .pool -_081B88E0: - cmp r1, 0x1 - bne _081B88F8 - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r0, 0x2 - bne _081B88F8 - ldr r0, =gText_ReturnToWaitingRoom - b _081B88FA - .pool -_081B88F8: - ldr r0, =gText_CancelChallenge -_081B88FA: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B88BC - - thumb_func_start sub_81B8904 -sub_81B8904: @ 81B8904 - push {lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - movs r2, 0 - str r2, [sp] - ldr r2, =sub_81B1370 - str r2, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8904 - - thumb_func_start sub_81B892C -sub_81B892C: @ 81B892C - push {lr} - sub sp, 0xC - movs r0, 0x4 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =CB2_ReturnToFieldContinueScriptPlayMapMusic - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0xC - movs r3, 0 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B892C - - thumb_func_start sub_81B8958 -sub_81B8958: @ 81B8958 - push {lr} - sub sp, 0xC - movs r0, 0x1 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =CB2_ReturnToFieldContinueScriptPlayMapMusic - str r0, [sp, 0x8] - movs r0, 0xB - movs r1, 0 - movs r2, 0xD - movs r3, 0 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8958 - - thumb_func_start sub_81B8984 -sub_81B8984: @ 81B8984 - push {lr} - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _081B8994 - movs r0, 0 - b _081B89A6 -_081B8994: - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B89A4 - movs r0, 0x1 - b _081B89A6 -_081B89A4: - movs r0, 0x2 -_081B89A6: - pop {r1} - bx r1 - thumb_func_end sub_81B8984 - - thumb_func_start OpenPartyMenuInBattle -OpenPartyMenuInBattle: @ 81B89AC - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_81B8984 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =SetCB2ToReshowScreenAfterMenu - str r0, [sp, 0x8] - movs r0, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl sub_81B0038 - bl nullsub_35 - bl pokemon_change_order - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end OpenPartyMenuInBattle - - thumb_func_start sub_81B89F0 -sub_81B89F0: @ 81B89F0 - push {lr} - sub sp, 0xC - bl sub_81B8984 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x5 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =c2_815ABFC - str r0, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x3 - movs r3, 0 - bl sub_81B0038 - bl nullsub_35 - bl pokemon_change_order - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B89F0 - - thumb_func_start sub_81B8A2C -sub_81B8A2C: @ 81B8A2C - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gPlayerParty + 0x64 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B8A74 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081B8A74 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0x1 - bne _081B8A5C - movs r0, 0x3 - b _081B8A76 - .pool -_081B8A5C: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 11 - ands r0, r1 - cmp r0, 0 - bne _081B8A74 - movs r0, 0x2 - b _081B8A76 - .pool -_081B8A74: - movs r0, 0x7 -_081B8A76: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B8A2C - - thumb_func_start sub_81B8A7C -sub_81B8A7C: @ 81B8A7C - push {r4-r7,lr} - mov r7, r8 - push {r7} - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B8AC4 - cmp r5, 0x1 - beq _081B8AA2 - cmp r5, 0x4 - beq _081B8AA2 - cmp r5, 0x5 - bne _081B8AC4 -_081B8AA2: - ldr r4, =gStringVar1 - bl GetTrainerPartnerName - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - ldr r0, =gStringVar4 - ldr r1, =gText_CantSwitchWithAlly - b _081B8C42 - .pool -_081B8AC4: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _081B8AF8 - ldr r1, =gStringVar1 - adds r0, r4, 0 - bl GetMonNickname - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnHasNoEnergy - b _081B8C42 - .pool -_081B8AF8: - movs r4, 0 - b _081B8B24 -_081B8AFC: - adds r0, r4, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _081B8B1E - adds r0, r5, 0 - bl sub_81B8F38 - lsls r0, 24 - ldr r2, =gBattlerPartyIndexes - lsls r1, r4, 1 - adds r1, r2 - lsrs r0, 24 - ldrh r1, [r1] - cmp r0, r1 - beq _081B8BFC -_081B8B1E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_081B8B24: - ldr r0, =gBattlersCount - ldrb r0, [r0] - cmp r4, r0 - bcc _081B8AFC - movs r7, 0x64 - adds r0, r5, 0 - muls r0, r7 - ldr r1, =gPlayerParty - mov r8, r1 - adds r6, r0, r1 - adds r0, r6, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - beq _081B8B60 - ldr r0, =gStringVar4 - ldr r1, =gText_EggCantBattle - b _081B8C42 - .pool -_081B8B60: - adds r0, r5, 0 - bl sub_81B8F38 - ldr r1, =gBattleStruct - ldr r1, [r1] - adds r1, 0x8B - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r1] - cmp r0, r1 - bne _081B8B94 - ldr r1, =gStringVar1 - adds r0, r6, 0 - bl GetMonNickname - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnAlreadySelected - b _081B8C42 - .pool -_081B8B94: - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0x4 - bne _081B8BA8 - bl SetMonPreventsSwitchingString - b _081B8C46 - .pool -_081B8BA8: - cmp r0, 0x2 - beq _081B8C20 - adds r0, r5, 0 - bl sub_81B8F38 - ldr r1, =gUnknown_0203CEE9 - strb r0, [r1] - ldr r1, =gUnknown_0203CEE8 - movs r0, 0x1 - strb r0, [r1] - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerInMenuId - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrb r0, [r0] - bl pokemon_order_func - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B8FB0 - adds r0, r4, 0 - muls r0, r7 - add r0, r8 - adds r1, r6, 0 - bl sub_81B1288 - movs r0, 0x1 - b _081B8C48 - .pool -_081B8BFC: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnAlreadyInBattle - b _081B8C42 - .pool -_081B8C20: - ldr r0, =gBattlerInMenuId - ldrb r0, [r0] - ldr r1, =gBattlerPartyIndexes - lsls r0, 1 - adds r0, r1 - ldrb r0, [r0] - bl pokemon_order_func - lsls r0, 24 - lsrs r0, 24 - muls r0, r7 - add r0, r8 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnCantSwitchOut -_081B8C42: - bl StringExpandPlaceholders -_081B8C46: - movs r0, 0 -_081B8C48: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B8A7C - thumb_func_start sub_81B8C68 sub_81B8C68: @ 81B8C68 push {r4,lr} diff --git a/include/party_menu.h b/include/party_menu.h index 147a53304..8b5423bb7 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -35,8 +35,9 @@ struct Struct203CEC8 { s8 unk9; s8 unkA; u8 unkB; - u8 unkD; + u16 unkC; s16 unkE; + s16 unk10; }; extern struct Struct203CEC8 gUnknown_0203CEC8; diff --git a/include/player_pc.h b/include/player_pc.h index bd060faa8..5a0b83683 100644 --- a/include/player_pc.h +++ b/include/player_pc.h @@ -84,5 +84,6 @@ extern const struct MenuAction gMailboxMailOptions[]; void ReshowPlayerPC(u8 taskId); void sub_816B31C(void); +void Mailbox_ReturnToMailListAfterDeposit(void); #endif //GUARD_PLAYER_PC_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 5dc37c70d..926e5ff53 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -4,6 +4,7 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void sub_81C4F98(u8, void(*)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); +u8 sub_81C1B94(void); // The Pokemon Summary Screen can operate in different modes. Certain features, // such as move re-ordering, are available in the different modes. diff --git a/include/pokenav.h b/include/pokenav.h index 1fde8aa44..d8f0c9f97 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -36,5 +36,7 @@ u8 GetCurrentTrainerHillMapId(void); u8 sub_81D6490(void); const struct WarpEvent *sub_81D6120(void); const struct WarpEvent *sub_81D6134(u8); +void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); +void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); #endif //GUARD_POKENAV_H diff --git a/include/strings.h b/include/strings.h index f1f0e74ba..37a721471 100644 --- a/include/strings.h +++ b/include/strings.h @@ -423,6 +423,45 @@ extern const u8 gText_PauseUntilPress[]; extern const u8 gText_CantUseUntilNewBadge[]; extern const u8 gText_ReturnToHealingSpot[]; extern const u8 gText_EscapeFromHere[]; +extern const u8 gText_PkmnCuredOfPoison[]; +extern const u8 gText_PkmnWokeUp2[]; +extern const u8 gText_PkmnBurnHealed[]; +extern const u8 gText_PkmnThawedOut[]; +extern const u8 gText_PkmnCuredOfParalysis[]; +extern const u8 gText_PkmnGotOverInfatuation[]; +extern const u8 gText_PkmnBecameHealthy[]; +extern const u8 gText_HP3[]; +extern const u8 gText_SpAtk3[]; +extern const u8 gText_SpDef3[]; +extern const u8 gText_PkmnBaseVar2StatIncreased[]; +extern const u8 gText_MovesPPIncreased[]; +extern const u8 gText_PPWasRestored[]; +extern const u8 gText_WontHaveEffect[]; +extern const u8 gText_PkmnSnappedOutOfConfusion[]; +extern const u8 gText_PkmnFriendlyBaseVar2Fell[]; +extern const u8 gText_PkmnFriendlyBaseVar2CantFall[]; +extern const u8 gText_PkmnAdoresBaseVar2Fell[]; +extern const u8 gText_PkmnAlreadyKnows[]; +extern const u8 gText_PkmnCantLearnMove[]; +extern const u8 gText_PkmnNeedsToReplaceMove[]; +extern const u8 gText_PkmnLearnedMove3[]; +extern const u8 gText_WhichMoveToForget[]; +extern const u8 gText_12PoofForgotMove[]; +extern const u8 gText_StopLearningMove2[]; +extern const u8 gText_MoveNotLearned[]; +extern const u8 gText_PkmnElevatedToLvVar2[]; +extern const u8 gText_RemoveMailBeforeItem[]; +extern const u8 gText_PkmnHoldingItemCantHoldMail[]; +extern const u8 gText_MailTransferredFromMailbox[]; +extern const u8 gText_CancelBattle[]; +extern const u8 gText_ReturnToWaitingRoom[]; +extern const u8 gText_CancelChallenge[]; +extern const u8 gText_CantSwitchWithAlly[]; +extern const u8 gText_PkmnHasNoEnergy[]; +extern const u8 gText_EggCantBattle[]; +extern const u8 gText_PkmnAlreadySelected[]; +extern const u8 gText_PkmnAlreadyInBattle[]; +extern const u8 gText_PkmnCantSwitchOut[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 475b16c98..3b52fc8ab 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -55,8 +55,8 @@ extern const u8* const gBattleScriptsForMoveEffects[]; extern void ShowSelectMovePokemonSummaryScreen(struct Pokemon* party, u8 monPartyId, u8 monCount, void (*callback)(void), u16 move); // pokemon summary screen extern u8 sub_81C1B94(void); // pokemon summary screen extern void sub_81D388C(struct Pokemon* mon, void* statStoreLocation); // pokenav.s -extern void sub_81D3640(u8 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s -extern void sub_81D3784(u8 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s +extern void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s +extern void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s extern u8* GetMonNickname(struct Pokemon* mon, u8* dst); // party_menu extern void sub_81B8E80(u8 battlerId, u8, u8); // party menu extern bool8 sub_81B1250(void); // ? diff --git a/src/party_menu.c b/src/party_menu.c index e01f333d5..c33c6176c 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1,29 +1,29 @@ #include "global.h" +#include "alloc.h" #include "battle.h" +#include "battle_anim.h" #include "battle_controllers.h" +#include "battle_gfx_sfx_util.h" #include "battle_interface.h" #include "battle_pike.h" #include "battle_pyramid.h" +#include "battle_pyramid_bag.h" #include "bg.h" -#include "constants/battle.h" -#include "constants/flags.h" -#include "constants/items.h" -#include "constants/moves.h" -#include "constants/rgb.h" -#include "constants/songs.h" -#include "constants/species.h" #include "contest.h" #include "data2.h" #include "decompress.h" #include "easy_chat.h" #include "event_data.h" +#include "evolution_scene.h" #include "field_control_avatar.h" #include "field_effect.h" #include "field_player_avatar.h" -#include "field_screen.h" +#include "field_screen_effect.h" #include "field_specials.h" +#include "field_weather.h" #include "fieldmap.h" #include "fldeff_softboiled.h" +#include "frontier_util.h" #include "gpu_regs.h" #include "graphics.h" #include "international_string_util.h" @@ -32,9 +32,8 @@ #include "item_use.h" #include "link.h" #include "link_rfu.h" -#include "main.h" #include "mail.h" -#include "malloc.h" +#include "main.h" #include "menu.h" #include "menu_helpers.h" #include "metatile_behavior.h" @@ -44,7 +43,9 @@ #include "pokemon.h" #include "pokemon_icon.h" #include "pokemon_summary_screen.h" +#include "pokenav.h" #include "region_map.h" +#include "reshow_battle_screen.h" #include "rom_8011DC0.h" #include "scanline_effect.h" #include "sound.h" @@ -57,6 +58,17 @@ #include "text_window.h" #include "trade.h" #include "window.h" +#include "constants/battle.h" +#include "constants/battle_frontier.h" +#include "constants/field_effects.h" +#include "constants/flags.h" +#include "constants/items.h" +#include "constants/maps.h" +#include "constants/moves.h" +#include "constants/rgb.h" +#include "constants/songs.h" +#include "constants/species.h" +#include "constants/vars.h" struct Unk_Rodata1 { void (*unk0)(u8, u8, u8, u8, u8, u8); @@ -115,9 +127,10 @@ extern struct Unk_203CEDC *gUnknown_0203CEDC; extern u8 *gUnknown_0203CEE0; extern struct Unk_203CEE4 *gUnknown_0203CEE4; extern u8 gUnknown_0203CEE8; +extern u8 gUnknown_0203CEE9; extern u16 *gUnknown_0203CEF0; extern u16 *gUnknown_0203CEF4; -extern u8 gSelectedOrderFromParty[]; +extern u8 gSelectedOrderFromParty[4]; extern u16 gUnknown_0203CEFC; extern u8 gUnknown_0203CF20; // summary screen? @@ -187,7 +200,19 @@ extern u8 gUnknown_08615D70[]; extern const u16 gUnknown_08615D7E[]; extern const struct Unk_8615D9C gUnknown_08615D9C[]; extern const u8 *gUnknown_08615E0C[]; +extern const struct SpriteSheet gUnknown_08615EB0; +extern const struct SpritePalette gUnknown_08615EB8; +extern struct SpriteTemplate gSpriteTemplate_8615EC0; +extern const struct CompressedSpriteSheet gUnknown_08615EF8; +extern const struct CompressedSpritePalette gUnknown_08615F00; +extern struct SpriteTemplate gSpriteTemplate_8615F08; +extern const struct CompressedSpriteSheet gUnknown_08615F70; +extern struct SpriteTemplate gSpriteTemplate_8615F78; +extern const struct CompressedSpriteSheet gUnknown_08615FF8; +extern const struct CompressedSpritePalette gUnknown_08616000; +extern struct SpriteTemplate gSpriteTemplate_8616008; extern u8 gUnknown_08616020[]; +extern u16 gUnknown_08616040[]; // ABOVE TO BE CONVERTED TO C @@ -345,6 +370,72 @@ void sub_81B56D8(u8); void task_launch_hm_phase_2(u8); u16 brm_get_selected_species(void); void sub_81B5B38(u8, struct Pokemon*); +void sub_81B5C08(struct Sprite*); +void sub_81B5BDC(struct Sprite*); +void sub_81B5CB0(u16, struct Unk_203CEDC*); +void sub_81B5DF0(u8, u8); +void sub_81B5E74(struct Sprite*); +void party_menu_get_status_condition_and_update_object(struct Pokemon*, struct Unk_203CEDC*); +void party_menu_update_status_condition_object(u8, struct Unk_203CEDC*); +u8 sub_81B8984(void); +void sub_81B6280(u8); +void c2_815ABFC(void); +u8 GetItemEffectType(u16); +void sub_81B672C(u8); +u16 sub_81B691C(struct Pokemon*, u8); +void option_menu_get_string(u8, u8*); +void sub_81B6BB4(u8); +void ether_effect_related_2(u8); +void ether_effect_related(u8); +void sub_81B6EB4(u8); +void sub_81B6FF4(u8); +void sub_81B6F60(u8); +void sub_81B6F98(u8); +void sub_81B77AC(u8); +void sub_81B7028(u8); +void sub_81B7088(u8); +void sub_81B7230(u8); +void sub_81B70B8(void); +void sub_81B70F0(void); +void sub_81B711C(u8); +void sub_81B7154(u8); +void sub_81B71D4(u8); +void sub_81B7294(u8); +void sub_81B72C8(u8); +void sub_81B73E4(u8); +void sub_81B79A0(struct Pokemon*, s16*); +void sub_81B754C(u8, struct Pokemon*); +void sub_81B75D4(u8); +void sub_81B767C(u8); +void sub_81B7634(u8); +void sub_81B76C8(u8); +void sub_81B7704(u8); +void sub_81B7810(u8); +void sub_81B787C(u8); +void sub_81B7910(u8, u16); +void sub_81B7A28(u8); +void task_sacred_ash_party_loop(u8); +void sub_81B7C10(u8); +void sub_81B8044(u8); +void sub_81B83B8(u8); +void sub_81B82A0(u8); +void sub_81B83F0(u16); +void sub_81B814C(void); +void sub_81B8088(u8); +void sub_81B8104(u8); +void sub_81B81A8(void); +bool8 sub_81B841C(u16); +void sub_81B8230(u8); +void sub_81B82D4(u8); +void sub_81B879C(u8); +void sub_81B8558(void); +bool8 sub_81B85AC(struct Pokemon*); +bool8 sub_81B8770(u8); +u8 sub_81B8888(void); +u8 sub_81B885C(void); +void sub_81B87E8(u8); +u8 pokemon_order_func(u8); +void sub_81B8FB0(u8, u8); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -352,7 +443,7 @@ void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) reset_brm(); gUnknown_0203CEC4 = Alloc(sizeof(struct Unk_203CEC4)); - if (gUnknown_0203CEC4 == 0) + if (gUnknown_0203CEC4 == NULL) { SetMainCallback2(g); } @@ -2108,7 +2199,7 @@ void sub_81B1E60(u8 taskId) } } -void sub_81B1F18(u8 taskId, u8 slot, s8 c, s16 HPSomething, TaskFunc func) +void sub_81B1F18(u8 taskId, u8 slot, s8 c, s16 HPDifference, TaskFunc func) { struct Pokemon *mon = &gPlayerParty[slot]; s16 *data = gTasks[taskId].data; @@ -2116,7 +2207,7 @@ void sub_81B1F18(u8 taskId, u8 slot, s8 c, s16 HPSomething, TaskFunc func) data[0] = GetMonData(mon, MON_DATA_HP); data[1] = GetMonData(mon, MON_DATA_MAX_HP); data[2] = c; - data[3] = HPSomething; + data[3] = HPDifference; data[4] = slot; data[5] = data[0]; SetTaskFuncWithFollowupFunc(taskId, sub_81B1E60, func); @@ -2961,7 +3052,7 @@ void sub_81B3414(struct Pokemon *mons, u8 a) gUnknown_0203CEC4->unk17 = 0; AppendToList(gUnknown_0203CEC4->unkF, &gUnknown_0203CEC4->unk17, 0); - for (i = 0; i < 4; i++) + for (i = 0; i < MAX_MON_MOVES; i++) { for (j = 0; gUnknown_08615D7E[j] != MOVE_SWORDS_DANCE; j++) { @@ -3466,7 +3557,7 @@ void sub_81B4198(u8 taskId) void sub_81B41C4(void) { if (InBattlePyramid() == FALSE) - GoToBagMenu(2, 5, c2_8123744); + GoToBagMenu(RETURN_LOCATION_POKEMON_LIST, POCKETS_COUNT, c2_8123744); else sub_81C4F98(2, c2_8123744); } @@ -4198,7 +4289,7 @@ void sub_81B57DC(void) void hm_surf_run_dp02scr(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - FieldEffectStart(9); + FieldEffectStart(FLDEFF_USE_SURF); } bool8 sub_81B5820(void) @@ -4235,7 +4326,7 @@ void sub_81B58A8(void) void hm2_waterfall(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - FieldEffectStart(43); + FieldEffectStart(FLDEFF_USE_WATERFALL); } bool8 hm_prepare_waterfall(void) @@ -4255,7 +4346,7 @@ bool8 hm_prepare_waterfall(void) void sub_81B5958(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - FieldEffectStart(44); + FieldEffectStart(FLDEFF_USE_DIVE); } bool8 sub_81B5974(void) @@ -4291,7 +4382,7 @@ void party_menu_link_mon_icon_anim(u16 species, u32 pid, struct Unk_203CEDC *ptr } } -void sub_81B5A8C(u8 spriteId, s16 hp, s16 maxhp) +void sub_81B5A8C(u8 spriteId, u16 hp, u16 maxhp) { switch (GetHPBarLevel(hp, maxhp)) { @@ -4312,3 +4403,2252 @@ void sub_81B5A8C(u8 spriteId, s16 hp, s16 maxhp) break; } } + +void sub_81B5B38(u8 spriteId, struct Pokemon *mon) +{ + sub_81B5A8C(spriteId, GetMonData(mon, MON_DATA_HP), GetMonData(mon, MON_DATA_MAX_HP)); +} + +void sub_81B5B6C(u8 spriteId, u8 a) +{ + gSprites[spriteId].data[0] = 0; + if (a == 0) + { + if (gSprites[spriteId].pos1.x == 16) + { + gSprites[spriteId].pos2.x = 0; + gSprites[spriteId].pos2.y = -4; + } + else + { + gSprites[spriteId].pos2.x = -4; + gSprites[spriteId].pos2.y = 0; + } + gSprites[spriteId].callback = sub_81B5C08; + } + else + { + gSprites[spriteId].pos2.x = 0; + gSprites[spriteId].pos2.y = 0; + gSprites[spriteId].callback = sub_81B5BDC; + } +} + +void sub_81B5BDC(struct Sprite *sprite) +{ + u8 unk = UpdateMonIconFrame(sprite); + + if (unk != 0) + { + if (unk & 1) + sprite->pos2.y = -3; + else + sprite->pos2.y = 1; + } +} + +void sub_81B5C08(struct Sprite *sprite) +{ + UpdateMonIconFrame(sprite); +} + +void party_menu_held_item_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + ptr->unkA = CreateSprite(&gSpriteTemplate_8615EC0, ptr->unk4[2], ptr->unk4[3], 0); + sub_81B5C94(mon, ptr); + } +} + +void party_menu_link_mon_held_item_object(u16 species, u16 item, struct Unk_203CEDC *ptr) +{ + if (species != SPECIES_NONE) + { + ptr->unkA = CreateSprite(&gSpriteTemplate_8615EC0, ptr->unk4[2], ptr->unk4[3], 0); + gSprites[ptr->unkA].oam.priority = 0; + sub_81B5CB0(item, ptr); + } +} + +void sub_81B5C94(struct Pokemon *mon, struct Unk_203CEDC *ptr) +{ + sub_81B5CB0(GetMonData(mon, MON_DATA_HELD_ITEM), ptr); +} + +void sub_81B5CB0(u16 item, struct Unk_203CEDC *ptr) +{ + if (item == ITEM_NONE) + { + gSprites[ptr->unkA].invisible = TRUE; + } + else + { + if (ItemIsMail(item) != FALSE) + StartSpriteAnim(&gSprites[ptr->unkA], 1); + else + StartSpriteAnim(&gSprites[ptr->unkA], 0); + gSprites[ptr->unkA].invisible = FALSE; + } +} + +void sub_81B5D30(void) +{ + LoadSpriteSheet(&gUnknown_08615EB0); + LoadSpritePalette(&gUnknown_08615EB8); +} + +void sub_81B5D4C(u8 *a, u8 *b, u8 c) +{ + u16 i; + u16 item; + + switch (c) + { + case 0: + for (i = 0; i < a[0]; i++) + { + item = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); + if (item != ITEM_NONE) + sub_81B5DF0(b[i], ItemIsMail(item)); + } + break; + case 1: + for (i = 0; i < a[1]; i++) + { + item = GetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM); + if (item != ITEM_NONE) + sub_81B5DF0(b[i + 6], ItemIsMail(item)); + } + break; + } +} + +void sub_81B5DF0(u8 spriteId, u8 isMail) +{ + u8 subpriority = gSprites[spriteId].subpriority; + u8 newSpriteId = CreateSprite(&gSpriteTemplate_8615EC0, 250, 170, subpriority - 1); + + gSprites[newSpriteId].pos2.x = 4; + gSprites[newSpriteId].pos2.y = 10; + gSprites[newSpriteId].callback = sub_81B5E74; + gSprites[newSpriteId].data[7] = spriteId; + StartSpriteAnim(&gSprites[newSpriteId], isMail); + gSprites[newSpriteId].callback(&gSprites[newSpriteId]); +} + +void sub_81B5E74(struct Sprite *sprite) +{ + u8 otherSpriteId = sprite->data[7]; + + if (gSprites[otherSpriteId].invisible != FALSE) + { + sprite->invisible = TRUE; + } + else + { + sprite->invisible = FALSE; + sprite->pos1.x = gSprites[otherSpriteId].pos1.x + gSprites[otherSpriteId].pos2.x; + sprite->pos1.y = gSprites[otherSpriteId].pos1.y + gSprites[otherSpriteId].pos2.y; + } +} + +void party_menu_pokeball_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + ptr->unkB = CreateSprite(&gSpriteTemplate_8615F08, ptr->unk4[6], ptr->unk4[7], 8); +} + +void party_menu_link_mon_pokeball_object(u16 species, struct Unk_203CEDC *ptr) +{ + if (species != SPECIES_NONE) + { + ptr->unkB = CreateSprite(&gSpriteTemplate_8615F08, ptr->unk4[6], ptr->unk4[7], 8); + gSprites[ptr->unkB].oam.priority = 0; + } +} + +u8 sub_81B5F34(u8 x, u8 y) +{ + u8 spriteId = CreateSprite(&gSpriteTemplate_8615F08, x, y, 8); + + gSprites[spriteId].oam.priority = 2; + return spriteId; +} + +u8 sub_81B5F74(u8 x, u8 y) +{ + return CreateSprite(&gSpriteTemplate_8615F78, x, y, 8); +} + +void sub_81B5F98(u8 spriteId, u8 a) +{ + StartSpriteAnim(&gSprites[spriteId], a); +} + +void sub_81B5FBC(u8 spriteId, u8 spriteId2, u8 a) +{ + if (a == 0) + { + StartSpriteAnim(&gSprites[spriteId], 2); + StartSpriteAnim(&gSprites[spriteId2], 4); + gSprites[spriteId].pos2.y = 0; + gSprites[spriteId2].pos2.y = 0; + } + else + { + StartSpriteAnim(&gSprites[spriteId], 3); + StartSpriteAnim(&gSprites[spriteId2], 5); + gSprites[spriteId].pos2.y = -4; + gSprites[spriteId2].pos2.y = 4; + } +} + +void sub_81B6040(void) +{ + LoadCompressedObjectPic(&gUnknown_08615EF8); + LoadCompressedObjectPic(&gUnknown_08615F70); + LoadCompressedObjectPalette(&gUnknown_08615F00); +} + +void party_menu_status_condition_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + ptr->unkC = CreateSprite(&gSpriteTemplate_8616008, ptr->unk4[4], ptr->unk4[5], 0); + party_menu_get_status_condition_and_update_object(mon, ptr); + } +} + +void party_menu_link_mon_status_condition_object(u16 species, u8 status, struct Unk_203CEDC *ptr) +{ + if (species != SPECIES_NONE) + { + ptr->unkC = CreateSprite(&gSpriteTemplate_8616008, ptr->unk4[4], ptr->unk4[5], 0); + party_menu_update_status_condition_object(status, ptr); + gSprites[ptr->unkC].oam.priority = 0; + } +} + +void party_menu_get_status_condition_and_update_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) +{ + party_menu_update_status_condition_object(sub_81B205C(mon), ptr); +} + +void party_menu_update_status_condition_object(u8 status, struct Unk_203CEDC *ptr) +{ + switch (status) + { + case AILMENT_NONE: + case AILMENT_PKRS: + gSprites[ptr->unkC].invisible = TRUE; + break; + default: + StartSpriteAnim(&gSprites[ptr->unkC], status - 1); + gSprites[ptr->unkC].invisible = FALSE; + break; + } +} + +void sub_81B6160(void) +{ + LoadCompressedObjectPic(&gUnknown_08615FF8); + LoadCompressedObjectPalette(&gUnknown_08616000); +} + +void sub_81B617C(void) +{ + MainCallback callback = c2_815ABFC; + u8 doubleBattleStatus; + bool8 inBattle; + u8 i; + u8 msgIDMaybe; + register TaskFunc task asm("r0"); + + if (gMain.inBattle != FALSE) + { + inBattle = TRUE; + doubleBattleStatus = sub_81B8984(); + } + else + { + inBattle = FALSE; + doubleBattleStatus = 0; + } + if (GetItemEffectType(gSpecialVar_ItemId) == 10) + { + gUnknown_0203CEC8.unk9 = 0; + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE && GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0) + { + gUnknown_0203CEC8.unk9 = i; + break; + } + } + task = sub_81B6280; + msgIDMaybe = 0x7F; + } + else + { + msgIDMaybe = (GetPocketByItemId(gSpecialVar_ItemId) == POCKET_TM_HM) ? 4 : 5; + task = sub_81B1370; + } + sub_81B0038(inBattle, doubleBattleStatus, 3, 1, msgIDMaybe, task, callback); +} + +void c2_815ABFC(void) +{ + if (InBattlePyramid() == FALSE) + GoToBagMenu(RETURN_LOCATION_UNCHANGED, POCKETS_COUNT, NULL); + else + sub_81C4F98(4, gPyramidBagCursorData.callback); +} + +void sub_81B6280(u8 taskId) +{ + if (!gPaletteFade.active) + { + if (gUnknown_0203CEC8.unk8_0 == 1) + gUnknown_0203CEC4->unk4 = sub_81B9140; + gUnknown_03006328(taskId, sub_81B6794); + } +} + +bool8 IsHPRecoveryItem(u16 item) +{ + const u8 *effect; + + if (item == ITEM_ENIGMA_BERRY) + effect = gSaveBlock1Ptr->enigmaBerry.itemEffect; + else + effect = gItemEffectTable[item - ITEM_POTION]; + if ((effect[4] & 4) != 0) + return TRUE; + return FALSE; +} + +void GetMedicineItemEffectMessage(u16 item) +{ + switch (GetItemEffectType(item) - 3) + { + case 0: + StringExpandPlaceholders(gStringVar4, gText_PkmnCuredOfPoison); + break; + case 1: + StringExpandPlaceholders(gStringVar4, gText_PkmnWokeUp2); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gText_PkmnBurnHealed); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gText_PkmnThawedOut); + break; + case 4: + StringExpandPlaceholders(gStringVar4, gText_PkmnCuredOfParalysis); + break; + case 5: + StringExpandPlaceholders(gStringVar4, gText_PkmnSnappedOutOfConfusion); + break; + case 6: + StringExpandPlaceholders(gStringVar4, gText_PkmnGotOverInfatuation); + break; + case 8: + StringExpandPlaceholders(gStringVar4, gText_PkmnBecameHealthy); + break; + case 10: + StringCopy(gStringVar2, gText_HP3); + StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased); + break; + case 9: + StringCopy(gStringVar2, gText_Attack3); + StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased); + break; + case 14: + StringCopy(gStringVar2, gText_Defense3); + StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased); + break; + case 13: + StringCopy(gStringVar2, gText_Speed2); + StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased); + break; + case 11: + StringCopy(gStringVar2, gText_SpAtk3); + StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased); + break; + case 12: + StringCopy(gStringVar2, gText_SpDef3); + StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased); + break; + case 16: + case 17: + StringExpandPlaceholders(gStringVar4, gText_MovesPPIncreased); + break; + case 18: + StringExpandPlaceholders(gStringVar4, gText_PPWasRestored); + break; + default: + StringExpandPlaceholders(gStringVar4, gText_WontHaveEffect); + break; + } +} + +bool8 UsingHPEVItemOnShedinja(struct Pokemon *mon, u16 item) +{ + if (GetItemEffectType(item) == 13 && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_SHEDINJA) + return FALSE; + return TRUE; +} + +bool8 IsBlueYellowRedFlute(u16 item) +{ + if (item == ITEM_BLUE_FLUTE || item == ITEM_RED_FLUTE || item == ITEM_YELLOW_FLUTE) + return TRUE; + return FALSE; +} + +bool8 ExecuteTableBasedItemEffect__(u8 partyMonIndex, u16 item, u8 monMoveIndex) +{ + if (gMain.inBattle != FALSE) + return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, sub_81B8F38(partyMonIndex), monMoveIndex); + else + return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, partyMonIndex, monMoveIndex); +} + +void ItemUseCB_Medicine(u8 taskId, TaskFunc task) +{ + u16 hp = 0; + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = gSpecialVar_ItemId; + bool8 canHeal; + + if (UsingHPEVItemOnShedinja(mon, item) != FALSE) + { + canHeal = IsHPRecoveryItem(item); + if (canHeal == TRUE) + { + hp = GetMonData(mon, MON_DATA_HP); + if (hp == GetMonData(mon, MON_DATA_MAX_HP)) + canHeal = FALSE; + } + if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, item, 0) != FALSE) + { + iTriedHonestlyIDid: + gUnknown_0203CEE8 = 0; + PlaySE(SE_SELECT); + sub_81B1B5C(gText_WontHaveEffect, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = task; + return; + } + } + else + { + goto iTriedHonestlyIDid; + } + gUnknown_0203CEE8 = 1; + if (IsBlueYellowRedFlute(item) == FALSE) + { + PlaySE(SE_KAIFUKU); + if (gUnknown_0203CEC8.unkB != 14) + RemoveBagItem(item, 1); + } + else + { + PlaySE(SE_BIDORO); + } + party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); + if (gSprites[gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unkC].invisible != FALSE) + sub_81B2AC8(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + if (canHeal == TRUE) + { + if (hp == 0) + sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); + sub_81B1F18(taskId, gUnknown_0203CEC8.unk9, 1, GetMonData(mon, MON_DATA_HP) - hp, sub_81B672C); + sub_81B1FA8(taskId, 0, hp); + return; + } + else + { + GetMonNickname(mon, gStringVar1); + GetMedicineItemEffectMessage(item); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = task; + } +} + +void sub_81B672C(u8 taskId) +{ + GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unk9], gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); + sub_81B1B5C(gStringVar4, 0); + schedule_bg_copy_tilemap_to_vram(2); + HandleBattleLowHpMusicChange(); + gTasks[taskId].func = sub_81B6794; +} + +void sub_81B6794(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + if (gUnknown_0203CEE8 == 0) + gUnknown_0203CEC4->unk4 = NULL; + sub_81B12C0(taskId); + } +} + +void sub_81B67C8(u8 taskId, TaskFunc task) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = gSpecialVar_ItemId; + u8 effectType = GetItemEffectType(item); + u16 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP); + u16 relevantEV = sub_81B691C(mon, effectType); + bool8 cannotUseEffect = ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, item, 0); + u16 newFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP); + u16 newRelevantEV = sub_81B691C(mon, effectType); + + if (cannotUseEffect != FALSE || (friendship == newFriendship && relevantEV == newRelevantEV)) + { + gUnknown_0203CEE8 = 0; + PlaySE(SE_SELECT); + sub_81B1B5C(gText_WontHaveEffect, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = task; + } + else + { + gUnknown_0203CEE8 = 1; + PlaySE(SE_KAIFUKU); + RemoveBagItem(item, 1); + GetMonNickname(mon, gStringVar1); + option_menu_get_string(effectType, gStringVar2); + if (friendship != newFriendship) + { + if (relevantEV != newRelevantEV) + StringExpandPlaceholders(gStringVar4, gText_PkmnFriendlyBaseVar2Fell); + else + StringExpandPlaceholders(gStringVar4, gText_PkmnFriendlyBaseVar2CantFall); + } + else + { + StringExpandPlaceholders(gStringVar4, gText_PkmnAdoresBaseVar2Fell); + } + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = task; + } +} + +u16 sub_81B691C(struct Pokemon *mon, u8 effectType) +{ + switch (effectType - 12) + { + case 1: + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_SHEDINJA) + return GetMonData(mon, MON_DATA_HP_EV); + break; + case 0: + return GetMonData(mon, MON_DATA_ATK_EV); + case 5: + return GetMonData(mon, MON_DATA_DEF_EV); + case 4: + return GetMonData(mon, MON_DATA_SPEED_EV); + case 2: + return GetMonData(mon, MON_DATA_SPATK_EV); + case 3: + return GetMonData(mon, MON_DATA_SPDEF_EV); + } + return 0; +} + +void option_menu_get_string(u8 effectType, u8 *dest) +{ + switch (effectType - 12) + { + case 1: + StringCopy(dest, gText_HP3); + break; + case 0: + StringCopy(dest, gText_Attack3); + break; + case 5: + StringCopy(dest, gText_Defense3); + break; + case 4: + StringCopy(dest, gText_Speed2); + break; + case 2: + StringCopy(dest, gText_SpAtk3); + break; + case 3: + StringCopy(dest, gText_SpDef3); + break; + } +} + +void sub_81B6A10(u8 slot) +{ + u8 i; + u8 moveCount = 0; + u8 fontId = 1; + u8 windowId = sub_81B31B0(3); + u16 move; + + for (i = 0; i < MAX_MON_MOVES; i++) + { + move = GetMonData(&gPlayerParty[slot], MON_DATA_MOVE1 + i); + AddTextPrinterParameterized(windowId, fontId, gMoveNames[move], 8, (i * 16) + 1, 0xFF, NULL); + if (move != MOVE_NONE) + moveCount++; + } + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, moveCount, 0); + schedule_bg_copy_tilemap_to_vram(2); +} + +void ether_effect_related_3(u8 taskId) +{ + s8 input = Menu_ProcessInput(); + + if (input != MENU_NOTHING_CHOSEN) + { + if (input == MENU_B_PRESSED) + { + PlaySE(SE_SELECT); + sub_81B6BB4(taskId); + } + else + { + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + ether_effect_related_2(taskId); + } + } +} + +void dp05_ether(u8 taskId, TaskFunc unused) +{ + const u8 *effect; + u16 item = gSpecialVar_ItemId; + + if (item == ITEM_ENIGMA_BERRY) + effect = gSaveBlock1Ptr->enigmaBerry.itemEffect; + else + effect = gItemEffectTable[item - ITEM_POTION]; + if ((effect[4] & 0x10) == 0) + { + gUnknown_0203CEC8.unkE = 0; + ether_effect_related(taskId); + } + else + { + PlaySE(SE_SELECT); + display_pokemon_menu_message(22); + sub_81B6A10(gUnknown_0203CEC8.unk9); + gTasks[taskId].func = ether_effect_related_3; + } +} + +void ether_effect_related_2(u8 taskId) +{ + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + gUnknown_0203CEC8.unkE = GetMenuCursorPos(); + ether_effect_related(taskId); +} + +void sub_81B6BB4(u8 taskId) +{ + gTasks[taskId].func = sub_81B1370; + gUnknown_0203CEC4->unk4 = NULL; + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + display_pokemon_menu_message(5); +} + +void ether_effect_related(u8 taskId) +{ + u16 move = MOVE_NONE; + s16 *moveslot = &gUnknown_0203CEC8.unkE; + u16 item = gSpecialVar_ItemId; + struct Struct203CEC8 *ptr = &gUnknown_0203CEC8; + struct Pokemon *mon; + + if (ExecuteTableBasedItemEffect__(ptr->unk9, item, *moveslot) != FALSE) + { + gUnknown_0203CEE8 = 0; + PlaySE(SE_SELECT); + sub_81B1B5C(gText_WontHaveEffect, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B6794; + } + else + { + gUnknown_0203CEE8 = 1; + mon = &gPlayerParty[ptr->unk9]; + PlaySE(SE_KAIFUKU); + RemoveBagItem(item, 1); + move = GetMonData(mon, MON_DATA_MOVE1 + *moveslot); + StringCopy(gStringVar1, gMoveNames[move]); + GetMedicineItemEffectMessage(item); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B6794; + } +} + +void dp05_pp_up(u8 taskId, TaskFunc unused) +{ + PlaySE(SE_SELECT); + display_pokemon_menu_message(23); + sub_81B6A10(gUnknown_0203CEC8.unk9); + gTasks[taskId].func = ether_effect_related_3; +} + +u16 ItemIdToBattleMoveId(u16 item) +{ + u16 tmNumber = item - ITEM_TM01_FOCUS_PUNCH; + return gUnknown_08616040[tmNumber]; +} + +bool8 sub_81B6D14(u16 move) +{ + u8 i; + + for (i = 0; i < NUM_HIDDEN_MACHINES; i++) + { + if (gUnknown_08616040[i + NUM_TECHNICAL_MACHINES] == move) + return TRUE; + } + return FALSE; +} + +bool8 pokemon_has_move(struct Pokemon *mon, u16 move) +{ + u8 i; + + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (GetMonData(mon, MON_DATA_MOVE1 + i) == move) + return TRUE; + } + return FALSE; +} + +void sub_81B6D74(const u8 *str) +{ + StringExpandPlaceholders(gStringVar4, str); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B6D98(u8 taskId, const u8 *str) +{ + sub_81B6D74(str); + gTasks[taskId].func = sub_81B6794; +} + +// move[1] doesn't use constants cause I don't know if it's actually a move ID storage + +void sub_81B6DC4(u8 taskId, TaskFunc unused) +{ + struct Pokemon *mon; + s16 *move; + u16 item; + + PlaySE(SE_SELECT); + mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + move = &gUnknown_0203CEC8.unkE; + item = gSpecialVar_ItemId; + GetMonNickname(mon, gStringVar1); + move[0] = ItemIdToBattleMoveId(item); + StringCopy(gStringVar2, gMoveNames[move[0]]); + move[1] = 0; + switch (sub_81B22D8(mon, item, 0)) + { + case 1: + sub_81B6D98(taskId, gText_PkmnCantLearnMove); + return; + case 2: + sub_81B6D98(taskId, gText_PkmnAlreadyKnows); + return; + } + if (GiveMoveToMon(mon, move[0]) != 0xFFFF) + { + gTasks[taskId].func = sub_81B6EB4; + } + else + { + sub_81B6D74(gText_PkmnNeedsToReplaceMove); + gTasks[taskId].func = sub_81B6FF4; + } +} + +void sub_81B6EB4(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + s16 *move = &gUnknown_0203CEC8.unkE; + u16 item = gSpecialVar_ItemId; + + if (move[1] == 0) + { + AdjustFriendship(mon, 4); + if (item < ITEM_HM01_CUT) + RemoveBagItem(item, 1); + } + GetMonNickname(mon, gStringVar1); + StringCopy(gStringVar2, gMoveNames[move[0]]); + StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B6F60; +} + +void sub_81B6F60(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + PlayFanfare(MUS_FANFA1); + gTasks[taskId].func = sub_81B6F98; + } +} + +void sub_81B6F98(u8 taskId) +{ + if (IsFanfareTaskInactive() != FALSE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) + { + if (gUnknown_0203CEC8.unk10 == 1) + sub_81B77AC(taskId); + else + { + if (gUnknown_0203CEC8.unk10 == 2) + gSpecialVar_Result = TRUE; + sub_81B12C0(taskId); + } + } +} + +void sub_81B6FF4(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B7028; + } +} + +void sub_81B7028(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + sub_81B1B5C(gText_WhichMoveToForget, 1); + gTasks[taskId].func = sub_81B7088; + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + sub_81B7230(taskId); + break; + } +} + +void sub_81B7088(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + gUnknown_0203CEC4->unk4 = sub_81B70B8; + sub_81B12C0(taskId); + } +} + +void sub_81B70B8(void) +{ + ShowSelectMovePokemonSummaryScreen(gPlayerParty, gUnknown_0203CEC8.unk9, gPlayerPartyCount - 1, sub_81B70F0, gUnknown_0203CEC8.unkE); +} + +void sub_81B70F0(void) +{ + sub_81B0038(0, 0, 0, 1, 0x7F, sub_81B711C, gUnknown_0203CEC8.unk0); +} + +void sub_81B711C(u8 taskId) +{ + if (!gPaletteFade.active) + { + if (sub_81C1B94() != 4) + sub_81B7154(taskId); + else + sub_81B7230(taskId); + } +} + +void sub_81B7154(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 move = GetMonData(mon, MON_DATA_MOVE1 + sub_81C1B94()); + + GetMonNickname(mon, gStringVar1); + StringCopy(gStringVar2, gMoveNames[move]); + sub_81B6D74(gText_12PoofForgotMove); + gTasks[taskId].func = sub_81B71D4; +} + +void sub_81B71D4(u8 taskId) +{ + struct Pokemon *mon; + u16 move; + + if (sub_81B1BD4() != TRUE) + { + mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + RemoveMonPPBonus(mon, sub_81C1B94()); + move = gUnknown_0203CEC8.unkE; + SetMonMoveSlot(mon, move, sub_81C1B94()); + sub_81B6EB4(taskId); + } +} + +void sub_81B7230(u8 taskId) +{ + StringCopy(gStringVar2, gMoveNames[gUnknown_0203CEC8.unkE]); + StringExpandPlaceholders(gStringVar4, gText_StopLearningMove2); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B7294; +} + +void sub_81B7294(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B72C8; + } +} + +void sub_81B72C8(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + GetMonNickname(mon, gStringVar1); + StringCopy(gStringVar2, gMoveNames[gUnknown_0203CEC8.unkE]); + StringExpandPlaceholders(gStringVar4, gText_MoveNotLearned); + sub_81B1B5C(gStringVar4, 1); + if (gUnknown_0203CEC8.unk10 == 1) + { + gTasks[taskId].func = sub_81B73E4; + } + else + { + if (gUnknown_0203CEC8.unk10 == 2) + gSpecialVar_Result = FALSE; + gTasks[taskId].func = sub_81B6794; + } + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + GetMonNickname(mon, gStringVar1); + StringCopy(gStringVar2, gMoveNames[gUnknown_0203CEC8.unkE]); + sub_81B6D74(gText_PkmnNeedsToReplaceMove); + gTasks[taskId].func = sub_81B6FF4; + break; + } +} + +void sub_81B73E4(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + sub_81B77AC(taskId); +} + +void dp05_rare_candy(u8 taskId, TaskFunc task) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + struct Unk_203CEC4 *ptr = gUnknown_0203CEC4; + s16 *arrayPtr = ptr->unk218; + u16 *itemPtr = &gSpecialVar_ItemId; + bool8 cannotUseEffect; + + if (GetMonData(mon, MON_DATA_LEVEL) != MAX_LEVEL) + { + sub_81B79A0(mon, arrayPtr); + cannotUseEffect = ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, *itemPtr, 0); + sub_81B79A0(mon, &ptr->unk218[6]); + } + else + { + cannotUseEffect = TRUE; + } + PlaySE(SE_SELECT); + if (cannotUseEffect != FALSE) + { + gUnknown_0203CEE8 = 0; + sub_81B1B5C(gText_WontHaveEffect, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = task; + } + else + { + gUnknown_0203CEE8 = 1; + PlayFanfareByFanfareNum(0); + sub_81B754C(gUnknown_0203CEC8.unk9, mon); + RemoveBagItem(gSpecialVar_ItemId, 1); + GetMonNickname(mon, gStringVar1); + ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), 0, 3); + StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B75D4; + } +} + +void sub_81B754C(u8 slot, struct Pokemon *mon) +{ + party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[slot]); + if (gSprites[gUnknown_0203CEDC[slot].unkC].invisible != FALSE) + sub_81B2AC8(mon, &gUnknown_0203CEDC[slot], 1); + sub_81B2CD4(mon, &gUnknown_0203CEDC[slot], 1); + sub_81B2D74(mon, &gUnknown_0203CEDC[slot], 1); + sub_81B2E28(mon, &gUnknown_0203CEDC[slot]); + sub_81B5B38(gUnknown_0203CEDC[slot].unk9, mon); + sub_81B0FCC(slot, 1); + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_81B75D4(u8 taskId) +{ + if (WaitFanfare(0) != FALSE && sub_81B1BD4() != TRUE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) + { + PlaySE(SE_SELECT); + sub_81B767C(taskId); + gTasks[taskId].func = sub_81B7634; + } +} + +void sub_81B7634(u8 taskId) +{ + if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + { + PlaySE(SE_SELECT); + sub_81B76C8(taskId); + gTasks[taskId].func = sub_81B7704; + } +} + +void sub_81B767C(u8 taskId) +{ + s16 *arrayPtr = gUnknown_0203CEC4->unk218; + + arrayPtr[12] = sub_81B3364(); + sub_81D3640(arrayPtr[12], arrayPtr, &arrayPtr[6], 1, 2, 3); + CopyWindowToVram(arrayPtr[12], 2); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B76C8(u8 taskIdUnused) +{ + s16 *arrayPtr = gUnknown_0203CEC4->unk218; + + sub_81D3784(arrayPtr[12], &arrayPtr[6], 1, 2, 3); + CopyWindowToVram(arrayPtr[12], 2); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B7704(u8 taskId) +{ + u16 result; + + if (WaitFanfare(0) != FALSE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) + { + sub_81B3394(); + result = MonTryLearningNewMove(&gPlayerParty[gUnknown_0203CEC8.unk9], 1); + gUnknown_0203CEC8.unk10 = 1; + switch (result) + { + case 0: + sub_81B7810(taskId); + break; + case 0xFFFF: + sub_81B787C(taskId); + break; + case 0xFFFE: + gTasks[taskId].func = sub_81B77AC; + break; + default: + sub_81B7910(taskId, result); + break; + } + } +} + +void sub_81B77AC(u8 taskId) +{ + u16 result = MonTryLearningNewMove(&gPlayerParty[gUnknown_0203CEC8.unk9], 0); + + switch (result) + { + case 0: + sub_81B7810(taskId); + break; + case 0xFFFF: + sub_81B787C(taskId); + break; + case 0xFFFE: + return; + default: + sub_81B7910(taskId, result); + break; + } +} + +void sub_81B7810(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, 0); + + if (targetSpecies != SPECIES_NONE) + { + sub_81B06F4(); + gCB2_AfterEvolution = gUnknown_0203CEC8.unk0; + BeginEvolutionScene(mon, targetSpecies, 1, gUnknown_0203CEC8.unk9); + DestroyTask(taskId); + } + else + { + gTasks[taskId].func = sub_81B6794; + } +} + +void sub_81B787C(u8 taskId) +{ + GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unk9], gStringVar1); + StringCopy(gStringVar2, gMoveNames[gMoveToLearn]); + StringExpandPlaceholders(gStringVar4, gText_PkmnNeedsToReplaceMove); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gUnknown_0203CEC8.unkE = gMoveToLearn; + gTasks[taskId].func = sub_81B6FF4; +} + +void sub_81B7910(u8 taskId, u16 move) +{ + GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unk9], gStringVar1); + StringCopy(gStringVar2, gMoveNames[move]); + StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3); + sub_81B1B5C(gStringVar4, 1); + schedule_bg_copy_tilemap_to_vram(2); + gUnknown_0203CEC8.unkE = move; + gTasks[taskId].func = sub_81B6F60; +} + +void sub_81B79A0(struct Pokemon *mon, s16 *data) +{ + data[0] = GetMonData(mon, MON_DATA_MAX_HP); + data[1] = GetMonData(mon, MON_DATA_ATK); + data[2] = GetMonData(mon, MON_DATA_DEF); + data[4] = GetMonData(mon, MON_DATA_SPATK); + data[5] = GetMonData(mon, MON_DATA_SPDEF); + data[3] = GetMonData(mon, MON_DATA_SPEED); +} + +void sub_81B79E8(u8 taskId, TaskFunc unused) +{ + gUnknown_0203CEC4->unk218[0] = 0; + gUnknown_0203CEC4->unk218[1] = 0; + gUnknown_0203CEC4->unk218[2] = gUnknown_0203CEC8.unk9; + sub_81B7A28(taskId); +} + +#ifdef NONMATCHING +void sub_81B7A28(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 hp; + + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + hp = GetMonData(mon, MON_DATA_HP); + if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, gSpecialVar_ItemId, 0) != FALSE) + { + gTasks[taskId].func = task_sacred_ash_party_loop; + return; + } + } + else + { + gTasks[taskId].func = task_sacred_ash_party_loop; + return; + } + PlaySE(SE_KAIFUKU); + party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); + if (gSprites[gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unkC].invisible != FALSE) + sub_81B2AC8(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + sub_81B0FCC(gUnknown_0203CEC4->unk218[2], 0); + sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); + sub_81B1F18(taskId, gUnknown_0203CEC8.unk9, 1, GetMonData(mon, MON_DATA_HP) - hp, sub_81B7C10); + sub_81B1FA8(taskId, 0, hp); + gUnknown_0203CEC4->unk218[0] = 1; + gUnknown_0203CEC4->unk218[1] = 1; +} +#else +NAKED +void sub_81B7A28(u8 taskId) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0x4\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + mov r8, r4\n\ + ldr r6, =gUnknown_0203CEC8\n\ + movs r1, 0x9\n\ + ldrsb r1, [r6, r1]\n\ + movs r0, 0x64\n\ + muls r1, r0\n\ + ldr r0, =gPlayerParty\n\ + adds r5, r1, r0\n\ + adds r0, r5, 0\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + beq _081B7A6E\n\ + adds r0, r5, 0\n\ + movs r1, 0x39\n\ + bl GetMonData\n\ + lsls r0, 16\n\ + lsrs r7, r0, 16\n\ + ldrb r0, [r6, 0x9]\n\ + ldr r1, =gSpecialVar_ItemId\n\ + ldrh r1, [r1]\n\ + movs r2, 0\n\ + bl ExecuteTableBasedItemEffect__\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _081B7A94\n\ +_081B7A6E:\n\ + ldr r0, =gTasks\n\ + lsls r1, r4, 2\n\ + adds r1, r4\n\ + lsls r1, 3\n\ + adds r1, r0\n\ + ldr r0, =task_sacred_ash_party_loop\n\ + str r0, [r1]\n\ + b _081B7B2A\n\ + .pool\n\ +_081B7A94:\n\ + movs r0, 0x1\n\ + bl PlaySE\n\ + ldr r4, =gUnknown_0203CEDC\n\ + movs r0, 0x9\n\ + ldrsb r0, [r6, r0]\n\ + lsls r0, 4\n\ + ldr r1, [r4]\n\ + adds r1, r0\n\ + adds r0, r5, 0\n\ + bl party_menu_get_status_condition_and_update_object\n\ + ldr r2, =gSprites\n\ + movs r0, 0x9\n\ + ldrsb r0, [r6, r0]\n\ + ldr r1, [r4]\n\ + lsls r0, 4\n\ + adds r3, r0, r1\n\ + ldrb r1, [r3, 0xC]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + adds r0, r2\n\ + adds r0, 0x3E\n\ + ldrb r0, [r0]\n\ + lsls r0, 29\n\ + cmp r0, 0\n\ + bge _081B7AD6\n\ + adds r0, r5, 0\n\ + adds r1, r3, 0\n\ + movs r2, 0x1\n\ + bl sub_81B2AC8\n\ +_081B7AD6:\n\ + ldr r4, =gUnknown_0203CEC4\n\ + ldr r0, [r4]\n\ + movs r1, 0x87\n\ + lsls r1, 2\n\ + adds r0, r1\n\ + ldrb r0, [r0]\n\ + movs r1, 0\n\ + bl sub_81B0FCC\n\ + ldrb r0, [r6, 0x9]\n\ + movs r1, 0x1\n\ + bl sub_81B0FCC\n\ + adds r0, r5, 0\n\ + movs r1, 0x39\n\ + bl GetMonData\n\ + adds r3, r0, 0\n\ + subs r3, r7\n\ + lsls r3, 16\n\ + asrs r3, 16\n\ + ldrb r1, [r6, 0x9]\n\ + ldr r0, =sub_81B7C10\n\ + str r0, [sp]\n\ + mov r0, r8\n\ + movs r2, 0x1\n\ + bl sub_81B1F18\n\ + mov r0, r8\n\ + movs r1, 0\n\ + adds r2, r7, 0\n\ + bl sub_81B1FA8\n\ + ldr r0, [r4]\n\ + movs r2, 0x86\n\ + lsls r2, 2\n\ + adds r1, r0, r2\n\ + movs r2, 0x1\n\ + strh r2, [r1]\n\ + ldr r1, =0x0000021a\n\ + adds r0, r1\n\ + strh r2, [r0]\n\ +_081B7B2A:\n\ + add sp, 0x4\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n"); +} +#endif + +void task_sacred_ash_party_loop(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + if (gUnknown_0203CEC4->unk218[0] == 1) + { + gUnknown_0203CEC4->unk218[0] = 0; + gUnknown_0203CEC4->unk218[2] = gUnknown_0203CEC8.unk9; + } + if (++(gUnknown_0203CEC8.unk9) == PARTY_SIZE) + { + if (gUnknown_0203CEC4->unk218[1] == 0) + { + gUnknown_0203CEE8 = 0; + sub_81B1B5C(gText_WontHaveEffect, 1); + schedule_bg_copy_tilemap_to_vram(2); + } + else + { + gUnknown_0203CEE8 = 1; + RemoveBagItem(gSpecialVar_ItemId, 1); + } + gTasks[taskId].func = sub_81B6794; + gUnknown_0203CEC8.unk9 = 0; + } + else + { + sub_81B7A28(taskId); + } + } +} + +void sub_81B7C10(u8 taskId) +{ + GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unk9], gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); + sub_81B1B5C(gStringVar4, 0); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = task_sacred_ash_party_loop; +} + +void sub_81B7C74(u8 taskId, TaskFunc task) +{ + PlaySE(SE_SELECT); + gCB2_AfterEvolution = gUnknown_0203CEC8.unk0; + if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, gSpecialVar_ItemId, 0) != FALSE) + { + gUnknown_0203CEE8 = 0; + sub_81B1B5C(gText_WontHaveEffect, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = task; + } + else + { + RemoveBagItem(gSpecialVar_ItemId, 1); + sub_81B06F4(); + } +} + +/* u8 GetItemEffectType(u16 item) +{ + const u8 *itemEffect; + + if IS_POKEMON_ITEM(item) + { + if (item == ITEM_ENIGMA_BERRY) + itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect; + else + itemEffect = gItemEffectTable[item - ITEM_POTION]; + if ((itemEffect[0] & 0x3F) || itemEffect[1] != 0 || itemEffect[2] != 0 || (itemEffect[3] & 0x80)) + return 0; + if (itemEffect[0] & 0x40) + return 10; + if (itemEffect[3] & 0x40) + return 1; + if ((itemEffect[3] & 0x3F) || (itemEffect[0] >> 7)) + { + if (itemEffect[3] == 0x20) + return 4; + if (itemEffect[3] == 0x10) + return 3; + if (itemEffect[3] == 8) + return 5; + if (itemEffect[3] == 4) + return 6; + if (itemEffect[3] == 2) + return 7; + if (itemEffect[3] == 1) + return 8; + if ((itemEffect[0] >> 7) != 0 && itemEffect[3] == 0) + return 9; + else + return 11; + } + if (itemEffect[4] & 0x44) + return 2; + if (itemEffect[4] & 2) + return 12; + if (itemEffect[4] & 1) + return 13; + if (itemEffect[5] & 8) + return 14; + if (itemEffect[5] & 4) + return 15; + if (itemEffect[5] & 2) + return 16; + if (itemEffect[5] & 1) + return 17; + if (itemEffect[4] & 0x80) + return 18; + if (itemEffect[4] & 0x20) + return 19; + if (itemEffect[5] & 0x10) + return 20; + if (itemEffect[4] & 0x18) + return 21; + return 22; + } + else + { + return 22; + } +} */ + +u8 GetItemEffectType(u16 item) +{ + const u8 *itemEffect; +#ifndef NONMATCHING + register u8 itemEffect0 asm("r1"); + register u8 itemEffect3 asm("r3"); + register u32 itemEffect0_r0 asm("r0"); // u32 to prevent shifting when transferring itemEffect0 to this + u8 mask; +#else +#define itemEffect0 itemEffect[0] +#define itemEffect3 itemEffect[3] +#define mask 0x3F +#endif + + if (!IS_POKEMON_ITEM(item)) + { + return 22; + } + else + { + // Read the item's effect properties. + if (item == ITEM_ENIGMA_BERRY) + { + itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect; + } + else + { + itemEffect = gItemEffectTable[item - ITEM_POTION]; + } + +#ifndef NONMATCHING + itemEffect0 = itemEffect[0]; + mask = 0x3F; +#endif + + if ((itemEffect0 & mask) || itemEffect[1] || itemEffect[2]) + { + return 0; + } +#ifndef NONMATCHING + itemEffect3 = itemEffect[3]; +#endif + if (itemEffect3 & 0x80) + { + return 0; + } + else if (itemEffect0 & 0x40) + { + return 10; + } + else if (itemEffect3 & 0x40) + { + return 1; + } + else if ((itemEffect3 & mask) || (itemEffect0 >> 7)) + { + if ((itemEffect3 & mask) == 0x20) + { + return 4; + } + else if ((itemEffect3 & mask) == 0x10) + { + return 3; + } + else if ((itemEffect3 & mask) == 0x8) + { + return 5; + } + else if ((itemEffect3 & mask) == 0x4) + { + return 6; + } + else if ((itemEffect3 & mask) == 0x2) + { + return 7; + } + else if ((itemEffect3 & mask) == 0x1) + { + return 8; + } + // alternate fakematching + // itemEffect0_r0 = itemEffect0 >> 7; + // asm(""); // increase live length for greg + // if ((itemEffect0_r0 != 0) && (itemEffect3 & mask) == 0) +#ifndef NONMATCHING + else if (((itemEffect0_r0 = itemEffect0 >> 7) != 0) && (itemEffect3 & mask) == 0) +#else + else if (((itemEffect[0] >> 7) != 0) && (itemEffect[3] & 0x3F) == 0) +#endif + { + return 9; + } + else + { + return 11; + } + } + else if (itemEffect[4] & 0x44) + { + return 2; + } + else if (itemEffect[4] & 0x2) + { + return 12; + } + else if (itemEffect[4] & 0x1) + { + return 13; + } + else if (itemEffect[5] & 0x8) + { + return 14; + } + else if (itemEffect[5] & 0x4) + { + return 15; + } + else if (itemEffect[5] & 0x2) + { + return 16; + } + else if (itemEffect[5] & 0x1) + { + return 17; + } + else if (itemEffect[4] & 0x80) + { + return 18; + } + else if (itemEffect[4] & 0x20) + { + return 19; + } + else if (itemEffect[5] & 0x10) + { + return 20; + } + else if (itemEffect[4] & 0x18) + { + return 21; + } + return 22; + } +#ifdef NONMATCHING +#undef itemEffect0 +#undef itemEffect3 +#undef mask +#endif +} + +void sub_81B7E4C(u8 taskId) +{ + struct Pokemon *mon; + s16 *move; + + if (!gPaletteFade.active) + { + mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + move = &gUnknown_0203CEC8.unkE; + GetMonNickname(mon, gStringVar1); + gUnknown_0203CEC8.unkE = sub_81B2360(gSpecialVar_0x8005); + StringCopy(gStringVar2, gMoveNames[gUnknown_0203CEC8.unkE]); + move[1] = 2; + switch (sub_81B22D8(mon, 0, gSpecialVar_0x8005)) + { + case 1: + sub_81B6D98(taskId, gText_PkmnCantLearnMove); + return; + case 2: + sub_81B6D98(taskId, gText_PkmnAlreadyKnows); + return; + default: + if (GiveMoveToMon(mon, gUnknown_0203CEC8.unkE) != 0xFFFF) + { + sub_81B6EB4(taskId); + return; + } + break; + } + sub_81B6D74(gText_PkmnNeedsToReplaceMove); + gTasks[taskId].func = sub_81B6FF4; + } +} + +void CB2_PartyMenuFromStartMenu(void) +{ + sub_81B0038(0, 0, 0, 0, 0, sub_81B1370, CB2_ReturnToFieldWithOpenMenu); +} + +void sub_81B7F60(void) +{ + MainCallback callback = (InBattlePyramid() == FALSE) ? c2_815ABFC : sub_81C4F84; + sub_81B0038(0, 0, 5, 0, 6, sub_81B1370, callback); + gUnknown_0203CEC8.unkC = gSpecialVar_ItemId; +} + +void sub_81B7FAC(u8 taskId) +{ + gUnknown_0203CEFC = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_HELD_ITEM); + if (gUnknown_0203CEFC == ITEM_NONE) + { + sub_81B8044(taskId); + } + else if (ItemIsMail(gUnknown_0203CEFC) != FALSE) + { + sub_81B83B8(taskId); + } + else + { + sub_81B1D1C(&gPlayerParty[gUnknown_0203CEC8.unk9], gUnknown_0203CEFC, 1); + gTasks[taskId].func = sub_81B82A0; + } +} + +void sub_81B8044(u8 taskId) +{ + if (ItemIsMail(gUnknown_0203CEC8.unkC) != FALSE) + { + sub_81B83F0(gUnknown_0203CEC8.unkC); + gUnknown_0203CEC4->unk4 = sub_81B814C; + sub_81B12C0(taskId); + } + else + { + sub_81B8088(taskId); + } +} + +void sub_81B8088(u8 taskId) +{ + u16 item; + + if (!gPaletteFade.active) + { + item = gUnknown_0203CEC8.unkC; + sub_81B1C84(&gPlayerParty[gUnknown_0203CEC8.unk9], item, 0, 1); + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], item); + sub_81B83F0(item); + gTasks[taskId].func = sub_81B8104; + } +} + +void sub_81B8104(u8 taskId) +{ + s8 slot = gUnknown_0203CEC8.unk9; + + if (sub_81B1BD4() != TRUE) + { + sub_81B5C94(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); + sub_81B12C0(taskId); + } +} + +void sub_81B814C(void) +{ + u8 mail; + + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gUnknown_0203CEC8.unkC); + mail = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAIL); + sub_811A20C(4, gSaveBlock1Ptr->mail[mail].words, sub_81B81A8, 3); +} + +void sub_81B81A8(void) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + if (gSpecialVar_Result == FALSE) + { + TakeMailFromMon(mon); + SetMonData(mon, MON_DATA_HELD_ITEM, &gUnknown_0203CEFC); + RemoveBagItem(gUnknown_0203CEFC, 1); + sub_81B841C(item); + SetMainCallback2(gUnknown_0203CEC8.unk0); + } + else + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B8230, gUnknown_0203CEC8.unk0); + } +} + +void sub_81B8230(u8 taskId) +{ + if (!gPaletteFade.active) + { + if (gUnknown_0203CEFC != ITEM_NONE) + sub_81B1D68(gUnknown_0203CEC8.unkC, gUnknown_0203CEFC, 0); + else + sub_81B1C84(&gPlayerParty[gUnknown_0203CEC8.unk9], gUnknown_0203CEC8.unkC, 0, 1); + gTasks[taskId].func = sub_81B8104; + } +} + +void sub_81B82A0(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B82D4; + } +} + +void sub_81B82D4(u8 taskId) +{ + u16 item; + + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + item = gUnknown_0203CEC8.unkC; + sub_81B83F0(item); + if (AddBagItem(gUnknown_0203CEFC, 1) == FALSE) + { + sub_81B841C(item); + pokemon_item_not_removed(gUnknown_0203CEFC); + sub_81B1B5C(gStringVar4, 0); + gTasks[taskId].func = sub_81B8104; + } + else if (ItemIsMail(item) != FALSE) + { + gUnknown_0203CEC4->unk4 = sub_81B814C; + sub_81B12C0(taskId); + } + else + { + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], item); + sub_81B1D68(item, gUnknown_0203CEFC, 1); + gTasks[taskId].func = sub_81B8104; + } + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B8104; + break; + } +} + +void sub_81B83B8(u8 taskId) +{ + sub_81B1B5C(gText_RemoveMailBeforeItem, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B8104; +} + +void sub_81B83F0(u16 item) +{ + if (gUnknown_0203CEC8.unkB == 6) + RemovePCItem(item, 1); + else + RemoveBagItem(item, 1); +} + +bool8 sub_81B841C(u16 item) +{ + if (gUnknown_0203CEC8.unkB == 5) + return AddBagItem(item, 1); + else + return AddPCItem(item, 1); +} + +void sub_81B8448(void) +{ + sub_81B0038(0, 0, 7, 0, 6, sub_81B1370, Mailbox_ReturnToMailListAfterDeposit); +} + +void sub_81B8474(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + struct MailStruct *mail; + + gUnknown_0203CEE8 = 0; + mail = &gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos]; + if (GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE) + { + sub_81B1B5C(gText_PkmnHoldingItemCantHoldMail, 1); + } + else + { + GiveMailToMon2(mon, mail); + ClearMailStruct(mail); + sub_81B1B5C(gText_MailTransferredFromMailbox, 1); + } + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B8104; +} + +void sub_81B8518(u8 unused) +{ + sub_81B8558(); + sub_81B0038(4, 0, 0, 0, 0, sub_81B1370, gMain.savedCallback); + gUnknown_0203CEC8.unk4 = sub_81B879C; +} + +void sub_81B8558(void) +{ + memset(gSelectedOrderFromParty, 0, ARRAY_COUNT(gSelectedOrderFromParty)); +} + +u8 sub_81B856C(s8 slot) +{ + if (sub_81B85AC(&gPlayerParty[slot]) == FALSE) + return 2; + if (sub_81B8770(slot + 1) == TRUE) + return 1; + return 0; +} + +bool8 sub_81B85AC(struct Pokemon *mon) +{ + u16 i = 0; + u16 species; + + if (GetMonData(mon, MON_DATA_IS_EGG) != FALSE || GetMonData(mon, MON_DATA_LEVEL) > sub_81B8888() || (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) && gSaveBlock1Ptr->location.mapNum /* possibly dirty cast */ == MAP_NUM(BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) && GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE)) + return FALSE; + switch (VarGet(VAR_FRONTIER_FACILITY)) // oddly the specific cases are beyond 6, turns out case 9 is apparently related to link battles + { + case 9: + if (GetMonData(mon, MON_DATA_HP) != 0) + return TRUE; + return FALSE; + case 8: + return TRUE; + default: + species = GetMonData(mon, MON_DATA_SPECIES); + for (; gFrontierBannedSpecies[i] != 0xFFFF; i++) + { + if (gFrontierBannedSpecies[i] == species) + return FALSE; + } + return TRUE; + } +} + +#ifdef NONMATCHING +u8 sub_81B865C(void) +{ + u8 unk = sub_81B885C(); + u8 unk2; + u8 i, j; + u16 species; + u16 item; + u8 facilityNum; + + if (gSelectedOrderFromParty[unk - 1] == 0) + { + if (unk == 1) + return 14; + ConvertIntToDecimalStringN(gStringVar1, unk, 0, 1); + return 17; + } + facilityNum = VarGet(VAR_FRONTIER_FACILITY); + if (facilityNum != 8 && facilityNum != 9) + { + unk2 = sub_81B8830(); + for (i = 0; i < (unk2 - 1); i++) + { + species = GetMonData(&gPlayerParty[gSelectedOrderFromParty[i - 1]], MON_DATA_SPECIES); + item = GetMonData(&gPlayerParty[gSelectedOrderFromParty[i - 1]], MON_DATA_HELD_ITEM); + for (j = i + 1; j < unk2; j++) + { + if (species == GetMonData(&gPlayerParty[gSelectedOrderFromParty[j - 1]], MON_DATA_SPECIES)) + return 18; + if (item != ITEM_NONE && item == GetMonData(&gPlayerParty[gSelectedOrderFromParty[j - 1]], MON_DATA_HELD_ITEM)) + return 19; + } + } + } + return 0xFF; +} +#else +NAKED +u8 sub_81B865C(void) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + bl sub_81B885C\n\ + lsls r0, 24\n\ + lsrs r2, r0, 24\n\ + adds r1, r2, 0\n\ + ldr r3, =gSelectedOrderFromParty\n\ + adds r0, r2, r3\n\ + subs r0, 0x1\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + bne _081B869C\n\ + cmp r2, 0x1\n\ + bne _081B8688\n\ + movs r0, 0xE\n\ + b _081B8758\n\ + .pool\n\ +_081B8688:\n\ + ldr r0, =gStringVar1\n\ + movs r2, 0\n\ + movs r3, 0x1\n\ + bl ConvertIntToDecimalStringN\n\ + movs r0, 0x11\n\ + b _081B8758\n\ + .pool\n\ +_081B869C:\n\ + ldr r0, =0x000040cf\n\ + bl VarGet\n\ + lsls r0, 24\n\ + movs r1, 0xF8\n\ + lsls r1, 24\n\ + adds r0, r1\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bhi _081B86C0\n\ + b _081B8756\n\ + .pool\n\ +_081B86B8:\n\ + movs r0, 0x12\n\ + b _081B8758\n\ +_081B86BC:\n\ + movs r0, 0x13\n\ + b _081B8758\n\ +_081B86C0:\n\ + bl sub_81B8830\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + movs r5, 0\n\ + b _081B8750\n\ +_081B86CE:\n\ + ldr r3, =gSelectedOrderFromParty\n\ + adds r4, r3, r5\n\ + ldrb r0, [r4]\n\ + movs r1, 0x64\n\ + muls r0, r1\n\ + subs r0, 0x64\n\ + ldr r3, =gPlayerParty\n\ + adds r0, r3, r0\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + mov r10, r0\n\ + ldrb r0, [r4]\n\ + movs r1, 0x64\n\ + muls r0, r1\n\ + subs r0, 0x64\n\ + ldr r3, =gPlayerParty\n\ + adds r0, r3, r0\n\ + movs r1, 0xC\n\ + bl GetMonData\n\ + lsls r0, 16\n\ + lsrs r6, r0, 16\n\ + adds r1, r5, 0x1\n\ + lsls r0, r1, 24\n\ + lsrs r4, r0, 24\n\ + mov r9, r1\n\ + cmp r4, r8\n\ + bcs _081B8748\n\ + movs r7, 0x64\n\ +_081B870E:\n\ + ldr r0, =gSelectedOrderFromParty\n\ + adds r5, r0, r4\n\ + ldrb r0, [r5]\n\ + muls r0, r7\n\ + subs r0, 0x64\n\ + ldr r1, =gPlayerParty\n\ + adds r0, r1, r0\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + cmp r10, r0\n\ + beq _081B86B8\n\ + cmp r6, 0\n\ + beq _081B873E\n\ + ldrb r0, [r5]\n\ + muls r0, r7\n\ + subs r0, 0x64\n\ + ldr r3, =gPlayerParty\n\ + adds r0, r3, r0\n\ + movs r1, 0xC\n\ + bl GetMonData\n\ + cmp r6, r0\n\ + beq _081B86BC\n\ +_081B873E:\n\ + adds r0, r4, 0x1\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + cmp r4, r8\n\ + bcc _081B870E\n\ +_081B8748:\n\ + mov r1, r9\n\ + lsls r0, r1, 24\n\ + lsrs r5, r0, 24\n\ + mov r0, r8\n\ +_081B8750:\n\ + subs r0, 0x1\n\ + cmp r5, r0\n\ + blt _081B86CE\n\ +_081B8756:\n\ + movs r0, 0xFF\n\ +_081B8758:\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + .pool\n"); +} +#endif + +bool8 sub_81B8770(u8 slot) +{ + u8 i; + + for (i = 0; i < 4; i++) + { + if (gSelectedOrderFromParty[i] == slot) + return TRUE; + } + return FALSE; +} + +void sub_81B879C(u8 taskId) +{ + u8 msgID = sub_81B865C(); + + if (msgID != 0xFF) + { + PlaySE(SE_HAZURE); + display_pokemon_menu_message(msgID); + gTasks[taskId].func = sub_81B87E8; + } + else + { + PlaySE(SE_SELECT); + sub_81B12C0(taskId); + } +} + +void sub_81B87E8(u8 taskId) +{ + if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + { + PlaySE(SE_SELECT); + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; + } +} + +u8 sub_81B8830(void) +{ + switch (VarGet(VAR_FRONTIER_FACILITY)) + { + case 9: + return 3; + case 8: + return 2; + default: + return gSpecialVar_0x8005; + } +} + +u8 sub_81B885C(void) +{ + switch (VarGet(VAR_FRONTIER_FACILITY)) + { + case 9: + return 1; + case 8: + return 2; + default: + return gSpecialVar_0x8005; + } +} + +u8 sub_81B8888(void) +{ + switch (VarGet(VAR_FRONTIER_FACILITY)) + { + case 9: + return 100; + case 8: + return 30; + default: + if (gSpecialVar_0x8004 == 0) + return 50; + return 100; + } +} + +const u8* sub_81B88BC(void) +{ + u8 facilityNum = VarGet(VAR_FRONTIER_FACILITY); + + if (!(facilityNum != 8 && facilityNum != 9)) + return gText_CancelBattle; + if (facilityNum == FRONTIER_FACILITY_DOME && gSpecialVar_0x8005 == 2) + return gText_ReturnToWaitingRoom; + return gText_CancelChallenge; +} + +void sub_81B8904(u8 initArg, MainCallback callback) +{ + sub_81B0038(initArg, 0, 0, 0, 0, sub_81B1370, callback); +} + +void sub_81B892C(void) +{ + sub_81B0038(0, 0, 12, 0, 4, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic); +} + +void sub_81B8958(void) +{ + sub_81B0038(11, 0, 13, 0, 1, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic); +} + +u8 sub_81B8984(void) +{ + if (IsDoubleBattle() == FALSE) + return 0; + if (sub_81B1250() == TRUE) + return 2; + return 1; +} + +void OpenPartyMenuInBattle(u8 arg) +{ + sub_81B0038(1, sub_81B8984(), arg, 0, 0, sub_81B1370, SetCB2ToReshowScreenAfterMenu); + nullsub_35(); + pokemon_change_order(); +} + +void sub_81B89F0(void) +{ + sub_81B0038(1, sub_81B8984(), 3, 0, 5, sub_81B1370, c2_815ABFC); + nullsub_35(); + pokemon_change_order(); +} + +u8 sub_81B8A2C(struct Pokemon *mon) +{ + if (GetMonData(&gPlayerParty[1], MON_DATA_SPECIES) != SPECIES_NONE && GetMonData(mon, MON_DATA_IS_EGG) == FALSE) + { + if (gUnknown_0203CEC8.unkB == 1) + return 3; + if (!(gBattleTypeFlags & BATTLE_TYPE_ARENA)) + return 2; + } + return 7; +} + +bool8 sub_81B8A7C(void) +{ + u8 slot = GetCursorSelectionMonId(); + u8 newSlot; + u8 i; + u8 neededToMatch; + + if (sub_81B1250() == TRUE && (slot == 1 || slot == 4 || slot == 5)) + { + StringCopy(gStringVar1, GetTrainerPartnerName()); + StringExpandPlaceholders(gStringVar4, gText_CantSwitchWithAlly); + return FALSE; + } + if (GetMonData(&gPlayerParty[slot], MON_DATA_HP) == 0) + { + GetMonNickname(&gPlayerParty[slot], gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnHasNoEnergy); + return FALSE; + } + for (i = 0; i < gBattlersCount; i++) + { + if (GetBattlerSide(i) == B_SIDE_PLAYER && sub_81B8F38(slot) == gBattlerPartyIndexes[i]) + { + GetMonNickname(&gPlayerParty[slot], gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnAlreadyInBattle); + return FALSE; + } + } + if (GetMonData(&gPlayerParty[slot], MON_DATA_IS_EGG) != FALSE) + { + StringExpandPlaceholders(gStringVar4, gText_EggCantBattle); + return FALSE; + } + if (sub_81B8F38(slot) == gBattleStruct->field_8B) + { + GetMonNickname(&gPlayerParty[slot], gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnAlreadySelected); + return FALSE; + } + if (gUnknown_0203CEC8.unkB == 4) + { + SetMonPreventsSwitchingString(); + return FALSE; + } + if (gUnknown_0203CEC8.unkB == 2) + { + neededToMatch = gBattlerInMenuId; + GetMonNickname(&gPlayerParty[pokemon_order_func(gBattlerPartyIndexes[neededToMatch])], gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnCantSwitchOut); + return FALSE; + } + gUnknown_0203CEE9 = sub_81B8F38(slot); + gUnknown_0203CEE8 = 1; + newSlot = pokemon_order_func(gBattlerPartyIndexes[gBattlerInMenuId]); + sub_81B8FB0(newSlot, slot); + sub_81B1288(&gPlayerParty[newSlot], &gPlayerParty[slot]); + return TRUE; +} From 8781d969ff0a702b21ed00529bf13baa4dd9bf6d Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Tue, 18 Dec 2018 05:38:08 -0500 Subject: [PATCH 09/17] finish party_menu --- asm/party_menu.s | 1649 ------------------------------ asm/trade.s | 4 +- data/party_menu.s | 4 +- include/party_menu.h | 4 +- include/pokemon_storage_system.h | 1 + include/pokemon_summary_screen.h | 2 + ld_script.txt | 1 - src/battle_script_commands.c | 4 +- src/party_menu.c | 1607 +++++++++++++++++++---------- src/pokemon_summary_screen.c | 6 +- sym_ewram.txt | 44 +- 11 files changed, 1107 insertions(+), 2219 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index 1dfa7537e..2428f2984 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,1653 +5,4 @@ .text - thumb_func_start sub_81B8C68 -sub_81B8C68: @ 81B8C68 - push {r4,lr} - ldr r4, =gUnknown_0203CF00 - bl sub_806D7EC - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_81B8C88 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8C68 - - thumb_func_start sub_81B8C88 -sub_81B8C88: @ 81B8C88 - push {r4-r6,lr} - sub sp, 0x8 - adds r6, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B8CBE - cmp r4, 0 - beq _081B8CB0 - movs r0, 0x30 - strb r0, [r6] - movs r0, 0x45 - strb r0, [r6, 0x1] - movs r0, 0x12 - strb r0, [r6, 0x2] - b _081B8D58 -_081B8CB0: - movs r0, 0x3 - strb r0, [r6] - movs r0, 0x12 - strb r0, [r6, 0x1] - movs r0, 0x45 - strb r0, [r6, 0x2] - b _081B8D58 -_081B8CBE: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _081B8CFC - movs r5, 0x1 - movs r0, 0 - bl GetBattlerAtPosition - mov r2, sp - ldr r1, =gBattlerPartyIndexes - lsls r0, 24 - lsrs r0, 23 - adds r0, r1 - ldrh r0, [r0] - strb r0, [r2] - movs r4, 0 - mov r1, sp -_081B8CE2: - ldrb r0, [r1] - cmp r4, r0 - beq _081B8CF0 - mov r2, sp - adds r0, r2, r5 - strb r4, [r0] - adds r5, 0x1 -_081B8CF0: - adds r4, 0x1 - cmp r4, 0x5 - ble _081B8CE2 - b _081B8D40 - .pool -_081B8CFC: - movs r5, 0x2 - movs r0, 0 - bl GetBattlerAtPosition - mov r1, sp - ldr r4, =gBattlerPartyIndexes - lsls r0, 24 - lsrs r0, 23 - adds r0, r4 - ldrh r0, [r0] - strb r0, [r1] - movs r0, 0x2 - bl GetBattlerAtPosition - mov r1, sp - lsls r0, 24 - lsrs r0, 23 - adds r0, r4 - ldrh r0, [r0] - strb r0, [r1, 0x1] - movs r4, 0 -_081B8D26: - ldrb r0, [r1] - cmp r4, r0 - beq _081B8D3A - ldrb r0, [r1, 0x1] - cmp r4, r0 - beq _081B8D3A - mov r2, sp - adds r0, r2, r5 - strb r4, [r0] - adds r5, 0x1 -_081B8D3A: - adds r4, 0x1 - cmp r4, 0x5 - ble _081B8D26 -_081B8D40: - movs r4, 0 - mov r3, sp -_081B8D44: - adds r0, r6, r4 - ldrb r1, [r3] - lsls r1, 4 - ldrb r2, [r3, 0x1] - orrs r1, r2 - strb r1, [r0] - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x2 - ble _081B8D44 -_081B8D58: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8C88 - - thumb_func_start sub_81B8D64 -sub_81B8D64: @ 81B8D64 - push {lr} - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gBattleStruct - lsls r3, r2, 1 - adds r3, r2 - adds r3, 0x60 - ldr r0, [r0] - adds r0, r3 - bl sub_81B8D88 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8D64 - - thumb_func_start sub_81B8D88 -sub_81B8D88: @ 81B8D88 - push {r4-r7,lr} - sub sp, 0x8 - adds r5, r0, 0 - adds r0, r2, 0 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r0, 24 - lsrs r0, 24 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _081B8DB0 - movs r0, 0 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x2 - b _081B8DBC -_081B8DB0: - movs r0, 0x1 - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x3 -_081B8DBC: - bl GetBattlerAtPosition - lsls r0, 24 - lsrs r6, r0, 24 - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B8DF0 - cmp r7, 0 - beq _081B8DE2 - movs r0, 0x30 - strb r0, [r5] - movs r0, 0x45 - strb r0, [r5, 0x1] - movs r0, 0x12 - strb r0, [r5, 0x2] - b _081B8E72 -_081B8DE2: - movs r0, 0x3 - strb r0, [r5] - movs r0, 0x12 - strb r0, [r5, 0x1] - movs r0, 0x45 - strb r0, [r5, 0x2] - b _081B8E72 -_081B8DF0: - bl IsDoubleBattle - lsls r0, 24 - cmp r0, 0 - bne _081B8E28 - movs r3, 0x1 - mov r2, sp - ldr r1, =gBattlerPartyIndexes - lsls r0, r4, 1 - adds r0, r1 - ldrh r0, [r0] - strb r0, [r2] - movs r4, 0 - mov r1, sp -_081B8E0C: - ldrb r0, [r1] - cmp r4, r0 - beq _081B8E1A - mov r2, sp - adds r0, r2, r3 - strb r4, [r0] - adds r3, 0x1 -_081B8E1A: - adds r4, 0x1 - cmp r4, 0x5 - ble _081B8E0C - b _081B8E5A - .pool -_081B8E28: - movs r3, 0x2 - mov r1, sp - ldr r2, =gBattlerPartyIndexes - lsls r0, r4, 1 - adds r0, r2 - ldrh r0, [r0] - strb r0, [r1] - lsls r0, r6, 1 - adds r0, r2 - ldrh r0, [r0] - strb r0, [r1, 0x1] - movs r4, 0 -_081B8E40: - ldrb r0, [r1] - cmp r4, r0 - beq _081B8E54 - ldrb r0, [r1, 0x1] - cmp r4, r0 - beq _081B8E54 - mov r2, sp - adds r0, r2, r3 - strb r4, [r0] - adds r3, 0x1 -_081B8E54: - adds r4, 0x1 - cmp r4, 0x5 - ble _081B8E40 -_081B8E5A: - movs r4, 0 - mov r3, sp -_081B8E5E: - adds r0, r5, r4 - ldrb r1, [r3] - lsls r1, 4 - ldrb r2, [r3, 0x1] - orrs r1, r2 - strb r1, [r0] - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x2 - ble _081B8E5E -_081B8E72: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8D88 - - thumb_func_start sub_81B8E80 -sub_81B8E80: @ 81B8E80 - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - movs r7, 0 - bl sub_81B1250 - lsls r0, 24 - cmp r0, 0 - beq _081B8F2E - ldr r0, =gBattleStruct - lsls r1, r4, 1 - adds r1, r4 - adds r1, 0x60 - ldr r0, [r0] - adds r4, r0, r1 - movs r2, 0 - add r6, sp - mov r12, r6 - movs r6, 0xF - mov r3, sp -_081B8EB2: - adds r1, r4, r2 - ldrb r0, [r1] - lsrs r0, 4 - strb r0, [r3] - adds r3, 0x1 - ldrb r1, [r1] - adds r0, r6, 0 - ands r0, r1 - strb r0, [r3] - adds r3, 0x1 - adds r2, 0x1 - cmp r2, 0x2 - ble _081B8EB2 - mov r0, r12 - ldrb r3, [r0] - movs r2, 0 - mov r0, sp - ldrb r0, [r0] - cmp r0, r5 - bne _081B8EE8 - mov r0, sp - ldrb r7, [r0] - strb r3, [r0] - b _081B8EFC - .pool -_081B8EE8: - adds r2, 0x1 - cmp r2, 0x5 - bgt _081B8EFC - mov r0, sp - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, r5 - bne _081B8EE8 - adds r7, r0, 0 - strb r3, [r1] -_081B8EFC: - cmp r2, 0x6 - beq _081B8F2E - mov r0, r12 - strb r7, [r0] - mov r0, sp - ldrb r0, [r0] - lsls r0, 4 - mov r1, sp - ldrb r1, [r1, 0x1] - orrs r0, r1 - strb r0, [r4] - mov r0, sp - ldrb r0, [r0, 0x2] - lsls r0, 4 - mov r1, sp - ldrb r1, [r1, 0x3] - orrs r0, r1 - strb r0, [r4, 0x1] - mov r0, sp - ldrb r0, [r0, 0x4] - lsls r0, 4 - mov r1, sp - ldrb r1, [r1, 0x5] - orrs r0, r1 - strb r0, [r4, 0x2] -_081B8F2E: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B8E80 - - thumb_func_start sub_81B8F38 -sub_81B8F38: @ 81B8F38 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0x1 - ands r1, r2 - lsrs r2, r0, 25 - cmp r1, 0 - beq _081B8F58 - ldr r0, =gUnknown_0203CF00 - adds r0, r2, r0 - ldrb r0, [r0] - movs r1, 0xF - ands r1, r0 - b _081B8F60 - .pool -_081B8F58: - ldr r0, =gUnknown_0203CF00 - adds r0, r2, r0 - ldrb r0, [r0] - lsrs r1, r0, 4 -_081B8F60: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B8F38 - - thumb_func_start sub_81B8F6C -sub_81B8F6C: @ 81B8F6C - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - movs r1, 0x1 - ands r1, r3 - lsrs r3, r0, 25 - cmp r1, 0 - beq _081B8F94 - ldr r0, =gUnknown_0203CF00 - adds r0, r3, r0 - ldrb r2, [r0] - movs r1, 0xF0 - ands r1, r2 - orrs r1, r4 - strb r1, [r0] - b _081B8FA4 - .pool -_081B8F94: - ldr r2, =gUnknown_0203CF00 - adds r2, r3, r2 - ldrb r1, [r2] - movs r0, 0xF - ands r0, r1 - lsls r1, r4, 4 - orrs r0, r1 - strb r0, [r2] -_081B8FA4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B8F6C - - thumb_func_start sub_81B8FB0 -sub_81B8FB0: @ 81B8FB0 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - adds r0, r5, 0 - bl sub_81B8F38 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_81B8F38 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_81B8F6C - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_81B8F6C - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B8FB0 - - thumb_func_start pokemon_order_func -pokemon_order_func: @ 81B8FEC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r3, 0 - movs r2, 0 - ldr r5, =gUnknown_0203CF00 -_081B8FF8: - adds r0, r3, r5 - ldrb r1, [r0] - lsrs r0, r1, 4 - cmp r0, r4 - beq _081B9010 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - movs r0, 0xF - ands r0, r1 - cmp r0, r4 - bne _081B9018 -_081B9010: - adds r0, r2, 0 - b _081B902A - .pool -_081B9018: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x2 - bls _081B8FF8 - movs r0, 0 -_081B902A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end pokemon_order_func - - thumb_func_start pokemon_change_order -pokemon_change_order: @ 81B9030 - push {r4-r6,lr} - movs r4, 0x96 - lsls r4, 2 - adds r0, r4, 0 - bl Alloc - adds r5, r0, 0 - ldr r1, =gPlayerParty - adds r2, r4, 0 - bl memcpy - movs r4, 0 - movs r6, 0x64 -_081B904A: - adds r0, r4, 0 - bl pokemon_order_func - lsls r0, 24 - lsrs r0, 24 - muls r0, r6 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - muls r1, r6 - adds r1, r5 - movs r2, 0x64 - bl memcpy - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _081B904A - adds r0, r5, 0 - bl Free - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end pokemon_change_order - - thumb_func_start sub_81B9080 -sub_81B9080: @ 81B9080 - push {r4-r6,lr} - movs r4, 0x96 - lsls r4, 2 - adds r0, r4, 0 - bl Alloc - adds r5, r0, 0 - ldr r1, =gPlayerParty - adds r2, r4, 0 - bl memcpy - movs r4, 0 - movs r6, 0x64 -_081B909A: - adds r0, r4, 0 - bl sub_81B8F38 - lsls r0, 24 - lsrs r0, 24 - muls r0, r6 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - muls r1, r6 - adds r1, r5 - movs r2, 0x64 - bl memcpy - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _081B909A - adds r0, r5, 0 - bl Free - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9080 - - thumb_func_start sub_81B90D0 -sub_81B90D0: @ 81B90D0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r6, 0x1 - movs r7, 0x64 - ldr r0, =gPlayerParty - mov r8, r0 -_081B90DE: - adds r0, r6, 0 - bl sub_81B8F38 - lsls r0, 24 - lsrs r0, 24 - muls r0, r7 - mov r1, r8 - adds r5, r0, r1 - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B912C - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _081B912C - movs r0, 0 - bl sub_81B8F38 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - adds r1, r6, 0 - bl sub_81B8FB0 - adds r0, r4, 0 - muls r0, r7 - add r0, r8 - adds r1, r5, 0 - bl sub_81B1288 - b _081B9136 - .pool -_081B912C: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x5 - bls _081B90DE -_081B9136: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B90D0 - - thumb_func_start sub_81B9140 -sub_81B9140: @ 81B9140 - push {lr} - ldr r0, =SetCB2ToReshowScreenAfterMenu - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9140 - - thumb_func_start sub_81B9150 -sub_81B9150: @ 81B9150 - push {lr} - sub sp, 0xC - movs r0, 0x7F - str r0, [sp] - ldr r0, =sub_81B917C - str r0, [sp, 0x4] - ldr r0, =gMain - ldr r0, [r0, 0x8] - str r0, [sp, 0x8] - movs r0, 0x5 - movs r1, 0x3 - movs r2, 0 - movs r3, 0 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9150 - - thumb_func_start sub_81B917C -sub_81B917C: @ 81B917C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r1, 0x80 - lsls r1, 1 - strh r1, [r4, 0x8] - bl sub_81B9294 - movs r1, 0x80 - lsls r1, 9 - movs r0, 0x2 - movs r2, 0 - bl ChangeBgX - ldr r0, =sub_81B91B4 - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B917C - - thumb_func_start sub_81B91B4 -sub_81B91B4: @ 81B91B4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r6, r5, 2 - adds r0, r6, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B9220 - ldrh r0, [r4] - subs r0, 0x8 - strh r0, [r4] - adds r0, r5, 0 - bl sub_81B9294 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081B9220 - movs r4, 0x3 - ldr r7, =gUnknown_02022FF8 -_081B91E8: - subs r0, r4, 0x3 - lsls r0, 5 - adds r0, r7 - ldrh r0, [r0] - cmp r0, 0 - beq _081B9204 - ldr r0, =gUnknown_0203CEDC - ldr r1, [r0] - lsls r0, r4, 4 - adds r0, r1 - ldrb r0, [r0, 0x9] - movs r1, 0 - bl sub_81B5B6C -_081B9204: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _081B91E8 - movs r0, 0x78 - bl PlaySE - ldr r0, =gTasks - adds r1, r6, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B9240 - str r0, [r1] -_081B9220: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B91B4 - - thumb_func_start sub_81B9240 -sub_81B9240: @ 81B9240 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - lsls r1, 16 - movs r0, 0x80 - lsls r0, 17 - cmp r1, r0 - bne _081B9266 - adds r0, r2, 0 - bl sub_81B12C0 -_081B9266: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9240 - - thumb_func_start sub_81B9270 -sub_81B9270: @ 81B9270 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 16 - lsrs r3, r1, 16 - cmp r1, 0 - blt _081B928A - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - strh r3, [r0, 0x24] -_081B928A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9270 - - thumb_func_start sub_81B9294 -sub_81B9294: @ 81B9294 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r5, r1, r0 - movs r6, 0x3 - ldr r7, =gUnknown_0203CEDC -_081B92A8: - ldr r0, =gUnknown_02022FF8 - subs r1, r6, 0x3 - lsls r1, 5 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _081B9300 - ldr r0, [r7] - lsls r4, r6, 4 - adds r0, r4, r0 - ldrb r0, [r0, 0x9] - ldrh r1, [r5] - subs r1, 0x8 - lsls r1, 16 - asrs r1, 16 - bl sub_81B9270 - ldr r0, [r7] - adds r0, r4, r0 - ldrb r0, [r0, 0xA] - ldrh r1, [r5] - subs r1, 0x8 - lsls r1, 16 - asrs r1, 16 - bl sub_81B9270 - ldr r0, [r7] - adds r0, r4, r0 - ldrb r0, [r0, 0xB] - ldrh r1, [r5] - subs r1, 0x8 - lsls r1, 16 - asrs r1, 16 - bl sub_81B9270 - ldr r0, [r7] - adds r4, r0 - ldrb r0, [r4, 0xC] - ldrh r1, [r5] - subs r1, 0x8 - lsls r1, 16 - asrs r1, 16 - bl sub_81B9270 -_081B9300: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x5 - bls _081B92A8 - movs r1, 0x80 - lsls r1, 4 - movs r0, 0x2 - movs r2, 0x1 - bl ChangeBgX - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9294 - - thumb_func_start sub_81B9328 -sub_81B9328: @ 81B9328 - push {lr} - sub sp, 0xC - movs r0, 0xF - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =sub_81B9390 - str r0, [sp, 0x8] - movs r0, 0x6 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9328 - - thumb_func_start sub_81B9354 -sub_81B9354: @ 81B9354 - push {lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gFieldCallback2 - ldr r1, =hm_add_c3_without_phase_2 - str r1, [r2] - movs r1, 0 - str r1, [sp] - ldr r1, =sub_81B1370 - str r1, [sp, 0x4] - ldr r1, =CB2_ReturnToField - str r1, [sp, 0x8] - movs r1, 0 - movs r2, 0xB - movs r3, 0 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9354 - - thumb_func_start sub_81B9390 -sub_81B9390: @ 81B9390 - push {r4,lr} - ldr r4, =gSpecialVar_0x8004 - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - cmp r0, 0x5 - bls _081B93A6 - movs r0, 0xFF - strh r0, [r4] -_081B93A6: - ldr r0, =gFieldCallback2 - ldr r1, =hm_add_c3_without_phase_2 - str r1, [r0] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9390 - - thumb_func_start hm_add_c3_without_phase_2 -hm_add_c3_without_phase_2: @ 81B93C8 - push {lr} - bl pal_fill_black - ldr r0, =task_hm_without_phase_2 - movs r1, 0xA - bl CreateTask - movs r0, 0x1 - pop {r1} - bx r1 - .pool - thumb_func_end hm_add_c3_without_phase_2 - - thumb_func_start task_hm_without_phase_2 -task_hm_without_phase_2: @ 81B93E0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsWeatherNotFadingIn - lsls r0, 24 - cmp r0, 0 - beq _081B93FE - adds r0, r4, 0 - bl DestroyTask - bl ScriptContext2_Disable - bl EnableBothScriptContexts -_081B93FE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end task_hm_without_phase_2 - - thumb_func_start sub_81B9404 -sub_81B9404: @ 81B9404 - push {lr} - bl ScriptContext2_Enable - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - ldr r0, =sub_81B9424 - movs r1, 0xA - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9404 - - thumb_func_start sub_81B9424 -sub_81B9424: @ 81B9424 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _081B945C - bl overworld_free_bg_tilemaps - str r4, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =sub_81B9470 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r2, 0xB - movs r3, 0 - bl sub_81B0038 - adds r0, r5, 0 - bl DestroyTask -_081B945C: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9424 - - thumb_func_start sub_81B9470 -sub_81B9470: @ 81B9470 - push {lr} - bl GetCursorSelectionMonId - ldr r2, =gUnknown_02039F24 - strb r0, [r2] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bls _081B9486 - movs r0, 0xFF - strb r0, [r2] -_081B9486: - ldr r1, =gSpecialVar_0x8004 - ldrb r0, [r2] - strh r0, [r1] - ldr r1, =gFieldCallback2 - ldr r0, =hm_add_c3_without_phase_2 - str r0, [r1] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9470 - - thumb_func_start sub_81B94B0 -sub_81B94B0: @ 81B94B0 - push {lr} - bl ScriptContext2_Enable - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - ldr r0, =sub_81B94D0 - movs r1, 0xA - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B94B0 - - thumb_func_start sub_81B94D0 -sub_81B94D0: @ 81B94D0 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _081B9508 - bl overworld_free_bg_tilemaps - str r4, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =sub_81B9390 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0 - movs r2, 0xB - movs r3, 0 - bl sub_81B0038 - adds r0, r5, 0 - bl DestroyTask -_081B9508: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B94D0 - - thumb_func_start sub_81B951C -sub_81B951C: @ 81B951C - push {lr} - bl ScriptContext2_Enable - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - ldr r0, =sub_81B953C - movs r1, 0xA - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B951C - - thumb_func_start sub_81B953C -sub_81B953C: @ 81B953C - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _081B9574 - bl overworld_free_bg_tilemaps - str r4, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =sub_81B9588 - str r0, [sp, 0x8] - movs r0, 0x7 - movs r1, 0 - movs r2, 0xB - movs r3, 0 - bl sub_81B0038 - adds r0, r5, 0 - bl DestroyTask -_081B9574: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B953C - - thumb_func_start sub_81B9588 -sub_81B9588: @ 81B9588 - push {r4,r5,lr} - ldr r5, =gSpecialVar_0x8004 - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5] - cmp r0, 0x5 - bls _081B95A4 - movs r0, 0xFF - strh r0, [r5] - b _081B95BA - .pool -_081B95A4: - ldr r4, =gSpecialVar_0x8005 - ldrh r1, [r5] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl GetNumberOfRelearnableMoves - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] -_081B95BA: - ldr r0, =gFieldCallback2 - ldr r1, =hm_add_c3_without_phase_2 - str r1, [r0] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9588 - - thumb_func_start sub_81B95E0 -sub_81B95E0: @ 81B95E0 - push {r4,r5,lr} - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - movs r4, 0 - adds r5, r1, 0 - b _081B95FA - .pool -_081B95F4: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_081B95FA: - cmp r4, 0x2 - bhi _081B9614 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - beq _081B95F4 - movs r0, 0x1 - strh r0, [r5] -_081B9614: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B95E0 - - thumb_func_start sub_81B9620 -sub_81B9620: @ 81B9620 - push {lr} - bl ScriptContext2_Enable - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - ldr r0, =sub_81B9640 - movs r1, 0xA - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9620 - - thumb_func_start sub_81B9640 -sub_81B9640: @ 81B9640 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _081B9678 - bl overworld_free_bg_tilemaps - str r4, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =sub_81B9390 - str r0, [sp, 0x8] - movs r0, 0xC - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl sub_81B0038 - adds r0, r5, 0 - bl DestroyTask -_081B9678: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9640 - - thumb_func_start sub_81B968C -sub_81B968C: @ 81B968C - push {lr} - sub sp, 0x4 - ldr r1, =gPlayerParty - ldr r0, =gSpecialVar_0x8004 - ldrb r2, [r0] - ldr r0, =gPlayerPartyCount - ldrb r3, [r0] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =CB2_ReturnToField - str r0, [sp] - movs r0, 0x3 - bl ShowPokemonSummaryScreen - ldr r1, =gFieldCallback - ldr r0, =sub_80AF168 - str r0, [r1] - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B968C - - thumb_func_start sub_81B96D0 -sub_81B96D0: @ 81B96D0 - push {r4,r5,lr} - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - movs r4, 0 - adds r5, r1, 0 -_081B96DC: - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - adds r1, 0xD - bl GetMonData - cmp r0, 0 - beq _081B96FA - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_081B96FA: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _081B96DC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B96D0 - - thumb_func_start sub_81B9718 -sub_81B9718: @ 81B9718 - push {r4,r5,lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - movs r0, 0x64 - adds r5, r1, 0 - muls r5, r0 - ldr r0, =gPlayerParty - adds r5, r0 - ldr r0, =gSpecialVar_0x8005 - ldrh r1, [r0] - adds r1, 0xD - adds r0, r5, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r0, =gStringVar2 - movs r1, 0xD - muls r1, r4 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9718 - - thumb_func_start sub_81B9770 -sub_81B9770: @ 81B9770 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gSpecialVar_0x8004 - mov r8, r0 - ldrh r0, [r0] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - ldr r4, =gSpecialVar_0x8005 - ldrb r2, [r4] - movs r1, 0 - bl SetMonMoveSlot - mov r1, r8 - ldrh r0, [r1] - muls r0, r6 - adds r0, r5 - ldrb r1, [r4] - bl RemoveMonPPBonus - ldrh r4, [r4] - cmp r4, 0x2 - bhi _081B97C4 -_081B97A2: - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - lsls r1, r4, 24 - lsrs r1, 24 - adds r4, 0x1 - lsls r2, r4, 24 - lsrs r2, 24 - bl sub_81B97DC - lsls r4, 16 - lsrs r4, 16 - cmp r4, 0x2 - bls _081B97A2 -_081B97C4: - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9770 - - thumb_func_start sub_81B97DC -sub_81B97DC: @ 81B97DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - mov r8, r0 - adds r5, r1, 0 - adds r4, r2, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - adds r0, 0xD - str r0, [sp, 0x8] - mov r0, r8 - ldr r1, [sp, 0x8] - bl GetMonData - mov r1, sp - adds r1, 0x2 - str r1, [sp, 0x14] - strh r0, [r1] - adds r3, r4, 0 - adds r3, 0xD - str r3, [sp, 0xC] - mov r0, r8 - adds r1, r3, 0 - bl GetMonData - mov r1, sp - strh r0, [r1] - adds r7, r5, 0 - adds r7, 0x11 - str r7, [sp, 0x10] - mov r0, r8 - adds r1, r7, 0 - bl GetMonData - mov r1, sp - adds r1, 0x5 - str r1, [sp, 0x18] - strb r0, [r1] - adds r3, r4, 0 - adds r3, 0x11 - str r3, [sp, 0x1C] - mov r0, r8 - adds r1, r3, 0 - bl GetMonData - add r7, sp, 0x4 - mov r10, r7 - strb r0, [r7] - mov r0, r8 - movs r1, 0x15 - bl GetMonData - mov r6, sp - adds r6, 0x6 - strb r0, [r6] - ldr r1, =gUnknown_08329D22 - adds r0, r5, r1 - ldrb r0, [r0] - mov r9, r0 - ldrb r0, [r6] - adds r2, r0, 0 - mov r3, r9 - ands r2, r3 - lsls r5, 1 - asrs r2, r5 - lsls r2, 24 - lsrs r2, 24 - adds r1, r4, r1 - ldrb r3, [r1] - adds r1, r0, 0 - ands r1, r3 - lsls r4, 1 - asrs r1, r4 - lsls r1, 24 - lsrs r1, 24 - mov r7, r9 - bics r0, r7 - strb r0, [r6] - ldrb r0, [r6] - bics r0, r3 - strb r0, [r6] - lsls r2, r4 - lsls r1, r5 - adds r2, r1 - ldrb r0, [r6] - orrs r0, r2 - strb r0, [r6] - mov r0, r8 - ldr r1, [sp, 0x8] - mov r2, sp - bl SetMonData - mov r0, r8 - ldr r1, [sp, 0xC] - ldr r2, [sp, 0x14] - bl SetMonData - mov r0, r8 - ldr r1, [sp, 0x10] - mov r2, r10 - bl SetMonData - mov r0, r8 - ldr r1, [sp, 0x1C] - ldr r2, [sp, 0x18] - bl SetMonData - mov r0, r8 - movs r1, 0x15 - adds r2, r6, 0 - bl SetMonData - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B97DC - - thumb_func_start sub_81B98DC -sub_81B98DC: @ 81B98DC - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2D - bl GetMonData - adds r1, r0, 0 - cmp r1, 0 - beq _081B990C - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] - b _081B9910 - .pool -_081B990C: - ldr r0, =gSpecialVar_Result - strh r1, [r0] -_081B9910: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B98DC - - thumb_func_start sub_81B9918 -sub_81B9918: @ 81B9918 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gSpecialVar_0x8005 - ldrh r1, [r1] - adds r1, 0xD - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - cmp r0, 0x39 - bne _081B999C - movs r6, 0 - b _081B9980 - .pool -_081B9958: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r6, r0 - beq _081B997E - movs r4, 0 - movs r0, 0x64 - adds r5, r6, 0 - muls r5, r0 - ldr r7, =gPlayerParty -_081B996A: - adds r1, r4, 0 - adds r1, 0xD - adds r0, r5, r7 - bl GetMonData - cmp r0, 0x39 - beq _081B999C - adds r4, 0x1 - cmp r4, 0x3 - bls _081B996A -_081B997E: - adds r6, 0x1 -_081B9980: - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - bcc _081B9958 - mov r0, r8 - bl sub_80D23A8 - cmp r0, 0x1 - beq _081B999C - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] -_081B999C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B9918 - .align 2, 0 @ Don't pad with nop. diff --git a/asm/trade.s b/asm/trade.s index a583e4319..7cb61a97e 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -725,7 +725,7 @@ _080777B8: b _08077B22 .pool _080777E8: - bl sub_81B5D30 + bl LoadHeldItemIcons ldr r0, =gUnknown_0203229C ldr r1, [r0] adds r0, r1, 0 @@ -1343,7 +1343,7 @@ _08077D80: b _080780D8 .pool _08077DB0: - bl sub_81B5D30 + bl LoadHeldItemIcons ldr r0, =gUnknown_0203229C ldr r1, [r0] adds r0, r1, 0 diff --git a/data/party_menu.s b/data/party_menu.s index eedcd4377..011a73106 100644 --- a/data/party_menu.s +++ b/data/party_menu.s @@ -69,11 +69,11 @@ gUnknown_086156B8:: @ 86156B8 .align 2 gUnknown_086156C4:: @ 86156C4 - .4byte sub_81B2658, 0x0d280b18, 0x08201420, 0x08081440, 0x08182526, 0x08182535, 0x03302318, 0x1040220c + .4byte BlitBitmapToPartyWindow_Default1, 0x0d280b18, 0x08201420, 0x08081440, 0x08182526, 0x08182535, 0x03302318, 0x1040220c .align 2 gUnknown_086156E4:: @ 86156E4 - .4byte sub_81B26BC, 0x0d280316, 0x08200c1e, 0x08080c3e, 0x08180c66, 0x08180c75, 0x03300a58, 0x1040044d + .4byte BlitBitmapToPartyWindow_Default2, 0x0d280316, 0x08200c1e, 0x08080c3e, 0x08180c66, 0x08180c75, 0x03300a58, 0x1040044d .align 2 gUnknown_08615704:: @ 8615704 diff --git a/include/party_menu.h b/include/party_menu.h index 8b5423bb7..27a043cb6 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -27,10 +27,10 @@ enum }; struct Struct203CEC8 { - MainCallback unk0; + MainCallback exitCallback; TaskFunc unk4; u8 unk8_0:4; - u8 unk8_1:2; + u8 mode:2; u8 unk8_2:2; s8 unk9; s8 unkA; diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 9b5358f06..7f618498b 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -84,5 +84,6 @@ u32 GetBoxMonDataFromAnyBox(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); u8 sub_80D214C(struct BoxPokemon *a, u8 b, u8 c, u8 d); +bool32 sub_80D23A8(u16 move); #endif // GUARD_POKEMON_STORAGE_SYSTEM_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 926e5ff53..63d740949 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -1,6 +1,8 @@ #ifndef GUARD_POKEMON_SUMMARY_SCREEN_H #define GUARD_POKEMON_SUMMARY_SCREEN_H +extern u8 gUnknown_0203CF20; + void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void sub_81C4F98(u8, void(*)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); diff --git a/ld_script.txt b/ld_script.txt index 1d86a44ca..27eed1699 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -277,7 +277,6 @@ SECTIONS { src/save_location.o(.text); src/item_icon.o(.text); src/party_menu.o(.text); - asm/party_menu.o(.text); src/battle_tent.o(.text); src/unk_text_util_2.o(.text); src/multiboot.o(.text); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3b52fc8ab..119607d0e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -59,7 +59,7 @@ extern void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocat extern void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s extern u8* GetMonNickname(struct Pokemon* mon, u8* dst); // party_menu extern void sub_81B8E80(u8 battlerId, u8, u8); // party menu -extern bool8 sub_81B1250(void); // ? +extern bool8 IsMultiBattle(void); // ? extern u8 sub_813B21C(void); extern u16 get_unknown_box_id(void); @@ -7609,7 +7609,7 @@ static void atk8F_forcerandomswitch(void) } *(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i; - if (!sub_81B1250()) + if (!IsMultiBattle()) sub_803BDA0(gBattlerTarget); if ((gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) diff --git a/src/party_menu.c b/src/party_menu.c index c33c6176c..ce22f2dae 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -42,12 +42,14 @@ #include "party_menu.h" #include "pokemon.h" #include "pokemon_icon.h" +#include "pokemon_storage_system.h" #include "pokemon_summary_screen.h" #include "pokenav.h" #include "region_map.h" #include "reshow_battle_screen.h" #include "rom_8011DC0.h" #include "scanline_effect.h" +#include "script.h" #include "sound.h" #include "sprite.h" #include "start_menu.h" @@ -70,6 +72,13 @@ #include "constants/species.h" #include "constants/vars.h" +enum { + CAN_LEARN_MOVE, + CANNOT_LEARN_MOVE, + ALREADY_KNOWS_MOVE, + CANNOT_LEARN_MOVE_IS_EGG +}; + struct Unk_Rodata1 { void (*unk0)(u8, u8, u8, u8, u8, u8); u8 unk4[24]; @@ -79,9 +88,9 @@ struct Unk_Rodata1 { u8 unk1F; }; -struct Unk_203CEC4 { +struct Struct203CEC4 { TaskFunc unk0; - MainCallback unk4; + MainCallback exitCallback; u32 unk8_0:1; u32 unk8_1:3; u32 unk8_2:7; @@ -90,51 +99,45 @@ struct Unk_203CEC4 { u8 unkC[3]; u8 unkF[8]; u8 unk17; - u16 unk18[0xB0]; + u16 palBuffer[0xB0]; u8 filler[0xA0]; - s16 unk218[16]; + s16 data[16]; }; -struct Unk_203CEDC { +struct Struct203CEDC { struct Unk_Rodata1 *unk0; u8 *unk4; - u8 unk8; + u8 windowId; u8 unk9; u8 unkA; u8 unkB; u8 unkC; }; -struct Unk_203CEE4 { - u8 filler[0x800]; -}; - -struct Unk_8615C08 { +struct Struct8615C08 { const u8 *textPtr; TaskFunc func; }; -struct Unk_8615D9C { +struct Struct8615D9C { bool8 (*fieldMoveFunc)(void); u8 msgID; }; -// BELOW TO BE PUT IN EWRAM - -extern struct Unk_203CEC4 *gUnknown_0203CEC4; -extern struct Struct203CEC8 gUnknown_0203CEC8; -extern struct Unk_203CEDC *gUnknown_0203CEDC; -extern u8 *gUnknown_0203CEE0; -extern struct Unk_203CEE4 *gUnknown_0203CEE4; -extern u8 gUnknown_0203CEE8; -extern u8 gUnknown_0203CEE9; -extern u16 *gUnknown_0203CEF0; -extern u16 *gUnknown_0203CEF4; -extern u8 gSelectedOrderFromParty[4]; -extern u16 gUnknown_0203CEFC; -extern u8 gUnknown_0203CF20; // summary screen? - -// ABOVE TO BE PUT IN EWRAM +EWRAM_DATA struct Struct203CEC4 *gUnknown_0203CEC4 = NULL; +EWRAM_DATA struct Struct203CEC8 gUnknown_0203CEC8 = {0}; +EWRAM_DATA struct Struct203CEDC *gUnknown_0203CEDC = NULL; +EWRAM_DATA u8 *gUnknown_0203CEE0 = NULL; +EWRAM_DATA u8 *gUnknown_0203CEE4 = NULL; +EWRAM_DATA u8 gUnknown_0203CEE8 = 0; +EWRAM_DATA u8 gUnknown_0203CEE9 = 0; +EWRAM_DATA MainCallback gPostMenuFieldCallback = NULL; +EWRAM_DATA u16 *gUnknown_0203CEF0 = 0; +EWRAM_DATA u16 *gUnknown_0203CEF4 = 0; +EWRAM_DATA u8 gSelectedOrderFromParty[4] = {0}; +EWRAM_DATA u16 gUnknown_0203CEFC = 0; +EWRAM_DATA u16 gUnknown_0203CEFE = 0; // unused +EWRAM_DATA u8 gUnknown_0203CF00[3] = {0}; // BELOW TO BE CONVERTED TO C @@ -194,11 +197,11 @@ extern u8 gUnknown_08615AEE[]; extern u8 gUnknown_08615AF1[]; extern const u8 *gUnknown_08615AF4[]; extern const u8 *gUnknown_08615B60[]; -extern struct Unk_8615C08 gUnknown_08615C08[]; +extern struct Struct8615C08 gUnknown_08615C08[]; extern u8 *gUnknown_08615D38[]; extern u8 gUnknown_08615D70[]; extern const u16 gUnknown_08615D7E[]; -extern const struct Unk_8615D9C gUnknown_08615D9C[]; +extern const struct Struct8615D9C gUnknown_08615D9C[]; extern const u8 *gUnknown_08615E0C[]; extern const struct SpriteSheet gUnknown_08615EB0; extern const struct SpritePalette gUnknown_08615EB8; @@ -219,76 +222,76 @@ extern u16 gUnknown_08616040[]; extern void (*gUnknown_03006328)(u8, TaskFunc); void reset_brm(void); -void c2_811EBD0(void); -bool8 sub_81B020C(void); +void PartyMenuInitCallback(void); +bool8 PartyMenuSetup(void); void sub_81B209C(void); -void sub_81B04BC(void); -bool8 sub_81B0550(void); -bool8 sub_81B05C8(void); +void PartyMenuExit(void); +bool8 AllocPartyMenuBg(void); +bool8 AllocPartyMiscGfx(void); void sub_81B239C(u8); -void sub_81B0740(u8); -void sub_81B5D30(void); -void sub_81B6040(void); -void sub_81B6160(void); +void PartyMenuInitHelperStructs(u8); +void LoadHeldItemIcons(void); +void LoadPartyMenuPokeballGfx(void); +void LoadPartyMenuAilmentGfx(void); bool8 party_menu_add_per_mon_objects(void); -bool8 sub_81B0DA0(void); +bool8 RenderPartyMenuBoxes(void); void sub_81B0F28(void); void sub_81B2428(u8); void display_pokemon_menu_message(u32); -void sub_81B04F8(u8); -void sub_81B06F4(void); -void sub_81B06C0(u8); +void PartyMenuExitTask(u8); +void FreePartyPointers(void); +void PartyPaletteBufferCopy(u8); void sub_81B0CEC(u8); -void sub_81B2748(struct Unk_203CEDC *, u8); +void UpdateSelectedPartyBox(struct Struct203CEDC *, u8); void sub_81B2720(u8); -void sub_81B0B60(u8); -void sub_81B0B08(u8); -void sub_81B0A9C(u8); +void DisplayPartyPokemonSelectForRelearner(u8); +void DisplayPartyPokemonSelectForContest(u8); +void DisplayPartyPokemonSelectForBattle(u8); void sub_81B0B98(u8); -void sub_81B0BC4(u8); +void DisplayPartyPokemonSelectHeldItemRelated(u8); bool8 sub_81B0BFC(u8); -void sub_81B0948(u8); +void DisplayPartyPokemonData(u8); void sub_81B0FCC(u8, u8); -void sub_81B2A70(struct Pokemon *, struct Unk_203CEDC *, u8); -void sub_81B2AC8(struct Pokemon *, struct Unk_203CEDC *, u8); -void sub_81B2B8C(struct Pokemon *, struct Unk_203CEDC *, u8); -void sub_81B2CD4(struct Pokemon *, struct Unk_203CEDC *, u8); -void sub_81B2D74(struct Pokemon *, struct Unk_203CEDC *, u8); -void sub_81B2E28(struct Pokemon *, struct Unk_203CEDC *); -void sub_81B2FA8(u8, struct Unk_203CEDC *, u8); +void DisplayPartyPokemonNickname(struct Pokemon *, struct Struct203CEDC *, u8); +void DisplayPartyPokemonLevelCheck(struct Pokemon *, struct Struct203CEDC *, u8); +void DisplayPartyPokemonGenderNidoranCheck(struct Pokemon *, struct Struct203CEDC *, u8); +void DisplayPartyPokemonHPCheck(struct Pokemon *, struct Struct203CEDC *, u8); +void DisplayPartyPokemonMaxHPCheck(struct Pokemon *, struct Struct203CEDC *, u8); +void DisplayPartyPokemonHPBarCheck(struct Pokemon *, struct Struct203CEDC *); +void DisplayPartyPokemonOtherText(u8, struct Struct203CEDC *, u8); u8 sub_81B8830(void); -bool8 sub_81B85AC(struct Pokemon *); +bool8 GetBattleEntryEligibility(struct Pokemon *); bool8 sub_81B218C(u8); -void sub_81B0C94(u8, u16, u8); -u8 sub_81B22D8(struct Pokemon *, u16, u8); -void sub_81B2A3C(u8, const u8*, u8, u8*); -void sub_81B2B40(u8, struct Unk_203CEDC *); -void sub_81B2BF4(u8, u16, u8*, struct Unk_203CEDC *); -void sub_81B2D3C(u16, struct Unk_203CEDC *); -void sub_81B2DDC(u16, struct Unk_203CEDC *); -void sub_81B2E64(u16, u16, struct Unk_203CEDC *); -void party_menu_link_mon_icon_anim(u16, u32, struct Unk_203CEDC *, u8, u32); -void party_menu_link_mon_held_item_object(u16, u16, struct Unk_203CEDC *); -void party_menu_link_mon_pokeball_object(u16, struct Unk_203CEDC *); -void party_menu_link_mon_status_condition_object(u16, u8, struct Unk_203CEDC *); -void party_menu_held_item_object(struct Pokemon *, struct Unk_203CEDC *); -void party_menu_pokeball_object(struct Pokemon *, struct Unk_203CEDC *); -void party_menu_icon_anim(struct Pokemon *, struct Unk_203CEDC *, u32); -void party_menu_status_condition_object(struct Pokemon *, struct Unk_203CEDC *); +void DisplayPartyPokemonSelectToTeachMove(u8, u16, u8); +u8 CanPartyPokemonLearnTMTutor(struct Pokemon *, u16, u8); +void DisplayPartyPokemonBarDetail(u8, const u8*, u8, u8*); +void DisplayPartyPokemonLevel(u8, struct Struct203CEDC *); +void DisplayPartyPokemonGender(u8, u16, u8*, struct Struct203CEDC *); +void DisplayPartyPokemonHP(u16, struct Struct203CEDC *); +void DisplayPartyPokemonMaxHP(u16, struct Struct203CEDC *); +void DisplayPartyPokemonHPBar(u16, u16, struct Struct203CEDC *); +void party_menu_link_mon_icon_anim(u16, u32, struct Struct203CEDC *, u8, u32); +void party_menu_link_mon_held_item_object(u16, u16, struct Struct203CEDC *); +void party_menu_link_mon_pokeball_object(u16, struct Struct203CEDC *); +void party_menu_link_mon_status_condition_object(u16, u8, struct Struct203CEDC *); +void party_menu_held_item_object(struct Pokemon *, struct Struct203CEDC *); +void party_menu_pokeball_object(struct Pokemon *, struct Struct203CEDC *); +void party_menu_icon_anim(struct Pokemon *, struct Struct203CEDC *, u32); +void party_menu_status_condition_object(struct Pokemon *, struct Struct203CEDC *); u8 sub_81B5F74(u8, u8); void sub_81B120C(void); u8 sub_81B5F34(u8, u8); -void sub_81B5B6C(u8, u8); +void AnimateSelectedPartyIcon(u8, u8); void sub_81B5F98(u8, u8); -u8 sub_81B10F8(u8, u8); -bool8 sub_81B118C(u8); +u8 GetPartyBoxPalBitfield(u8, u8); +bool8 PartyBoxPal_ParnterOrDisqualifiedInArena(u8); u8 sub_81B8F38(u8); void c3_0811FAB4(u8); void sub_81B9080(void); void sub_81B4F88(void); void sub_81B15D0(u8, s8*); void sub_81B140C(u8, s8*); -u16 sub_81B1760(s8*); +u16 PartyMenuButtonHandler(s8*); s8* sub_81B13EC(void); bool8 sub_81B15A4(u8*); void sub_81B302C(u8*); @@ -311,14 +314,14 @@ void sub_81B1708(u8); bool8 sub_81B1BD4(void); void sub_81B1C1C(u8); void sub_81B8558(void); -void sub_81B17F8(s8*, s8); -void sub_81B1854(s8*, s8); -void sub_81B195C(s8*, s8); +void UpdateCurrentPartySelection(s8*, s8); +void SetNewPartySelectTarget1(s8*, s8); +void SetNewPartySelectTarget2(s8*, s8); s8 sub_81B1B00(s8, s8); void sub_81B3300(const u8*); void sub_81B1B8C(u8); -void sub_81B2CD4(struct Pokemon*, struct Unk_203CEDC*, u8); -void sub_81B2E28(struct Pokemon*, struct Unk_203CEDC*); +void DisplayPartyPokemonHPCheck(struct Pokemon*, struct Struct203CEDC*, u8); +void DisplayPartyPokemonHPBarCheck(struct Pokemon*, struct Struct203CEDC*); bool16 sub_81B2134(struct Pokemon*); bool16 sub_81B2164(struct Pokemon*); void sub_81B2248(u8); @@ -348,7 +351,7 @@ void sub_81B43DC(u8); void sub_81B44FC(u8); void sub_81B4578(void); void sub_81B4624(u8); -void sub_81B5C94(struct Pokemon*, struct Unk_203CEDC*); +void sub_81B5C94(struct Pokemon*, struct Struct203CEDC*); void sub_81B48A8(u8); void sub_81B48DC(u8); void sub_81B4988(u8); @@ -370,13 +373,13 @@ void sub_81B56D8(u8); void task_launch_hm_phase_2(u8); u16 brm_get_selected_species(void); void sub_81B5B38(u8, struct Pokemon*); -void sub_81B5C08(struct Sprite*); -void sub_81B5BDC(struct Sprite*); -void sub_81B5CB0(u16, struct Unk_203CEDC*); +void UpdatePartyMonIconFrame(struct Sprite*); +void UpdatePartyMonIconFrameAndBounce(struct Sprite*); +void sub_81B5CB0(u16, struct Struct203CEDC*); void sub_81B5DF0(u8, u8); void sub_81B5E74(struct Sprite*); -void party_menu_get_status_condition_and_update_object(struct Pokemon*, struct Unk_203CEDC*); -void party_menu_update_status_condition_object(u8, struct Unk_203CEDC*); +void party_menu_get_status_condition_and_update_object(struct Pokemon*, struct Struct203CEDC*); +void party_menu_update_status_condition_object(u8, struct Struct203CEDC*); u8 sub_81B8984(void); void sub_81B6280(u8); void c2_815ABFC(void); @@ -429,32 +432,47 @@ void sub_81B8230(u8); void sub_81B82D4(u8); void sub_81B879C(u8); void sub_81B8558(void); -bool8 sub_81B85AC(struct Pokemon*); +bool8 GetBattleEntryEligibility(struct Pokemon*); bool8 sub_81B8770(u8); u8 sub_81B8888(void); u8 sub_81B885C(void); void sub_81B87E8(u8); u8 pokemon_order_func(u8); void sub_81B8FB0(u8, u8); +void sub_81B8C88(u8*, bool8); +void sub_81B8D88(u8*, u8, u8); +void sub_81B917C(u8); +void sub_81B91B4(u8); +void sub_81B9294(u8); +void sub_81B9240(u8); +void sub_81B9390(void); +void task_hm_without_phase_2(u8); +void sub_81B9424(u8); +void sub_81B9470(void); +void sub_81B94D0(u8); +void sub_81B953C(u8); +void sub_81B9588(void); +void sub_81B9640(u8); +void sub_81B97DC(struct Pokemon*, u8, u8); -void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) +void InitPartyMenu(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc task, MainCallback callback) { u16 i; reset_brm(); - gUnknown_0203CEC4 = Alloc(sizeof(struct Unk_203CEC4)); + gUnknown_0203CEC4 = Alloc(sizeof(struct Struct203CEC4)); if (gUnknown_0203CEC4 == NULL) { - SetMainCallback2(g); + SetMainCallback2(callback); } else { gUnknown_0203CEC8.unk8_0 = a; - gUnknown_0203CEC8.unk0 = g; + gUnknown_0203CEC8.exitCallback = callback; gUnknown_0203CEC8.unkB = c; gUnknown_0203CEC4->unkA_0 = e; - gUnknown_0203CEC4->unk0 = f; - gUnknown_0203CEC4->unk4 = NULL; + gUnknown_0203CEC4->unk0 = task; + gUnknown_0203CEC4->exitCallback = NULL; gUnknown_0203CEC4->unk8_1 = 0; gUnknown_0203CEC4->unk8_2 = 0xFF; gUnknown_0203CEC4->unk9_0 = 0xFF; @@ -465,10 +483,10 @@ void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) gUnknown_0203CEC4->unk8_0 = FALSE; if (b != 0xFF) - gUnknown_0203CEC8.unk8_1 = b; + gUnknown_0203CEC8.mode = b; for (i = 0; i <= 15; i++) - gUnknown_0203CEC4->unk218[i] = 0; + gUnknown_0203CEC4->data[i] = 0; for (i = 0; i < 3; i++) gUnknown_0203CEC4->unkC[i] |= 0xFF; @@ -479,11 +497,11 @@ void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) gTextFlags.autoScroll = 0; CalculatePlayerPartyCount(); - SetMainCallback2(c2_811EBD0); + SetMainCallback2(PartyMenuInitCallback); } } -void sub_81B01B0(void) +void PartyMenuCallback(void) { RunTasks(); AnimateSprites(); @@ -492,23 +510,23 @@ void sub_81B01B0(void) UpdatePaletteFade(); } -void sub_81B01CC(void) +void PartyMenuVBlankCallback(void) { LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); } -void c2_811EBD0(void) +void PartyMenuInitCallback(void) { while (TRUE) { - if (sub_81221EC() == TRUE || sub_81B020C() == TRUE || sub_81221AC() == TRUE) + if (sub_81221EC() == TRUE || PartyMenuSetup() == TRUE || sub_81221AC() == TRUE) break; } } -bool8 sub_81B020C(void) +bool8 PartyMenuSetup(void) { switch (gMain.state) { @@ -545,40 +563,40 @@ bool8 sub_81B020C(void) gMain.state++; break; case 7: - if (!sub_81B0550()) + if (!AllocPartyMenuBg()) { - sub_81B04BC(); + PartyMenuExit(); return TRUE; } else { - gUnknown_0203CEC4->unk218[0] = 0; + gUnknown_0203CEC4->data[0] = 0; gMain.state++; } break; case 8: - if (sub_81B05C8()) + if (AllocPartyMiscGfx()) gMain.state++; break; case 9: - sub_81B239C(gUnknown_0203CEC8.unk8_1); + sub_81B239C(gUnknown_0203CEC8.mode); gMain.state++; break; case 10: - sub_81B0740(gUnknown_0203CEC8.unk8_1); - gUnknown_0203CEC4->unk218[0] = 0; + PartyMenuInitHelperStructs(gUnknown_0203CEC8.mode); + gUnknown_0203CEC4->data[0] = 0; gMain.state++; break; case 11: - sub_81B5D30(); + LoadHeldItemIcons(); gMain.state++; break; case 12: - sub_81B6040(); + LoadPartyMenuPokeballGfx(); gMain.state++; break; case 13: - sub_81B6160(); + LoadPartyMenuAilmentGfx(); gMain.state++; break; case 14: @@ -588,14 +606,14 @@ bool8 sub_81B020C(void) case 15: if (party_menu_add_per_mon_objects()) { - gUnknown_0203CEC4->unk218[0] = 0; + gUnknown_0203CEC4->data[0] = 0; gMain.state++; } break; case 16: - if (sub_81B0DA0()) + if (RenderPartyMenuBoxes()) { - gUnknown_0203CEC4->unk218[0] = 0; + gUnknown_0203CEC4->data[0] = 0; gMain.state++; } break; @@ -625,27 +643,27 @@ bool8 sub_81B020C(void) gMain.state++; break; default: - SetVBlankCallback(sub_81B01CC); - SetMainCallback2(sub_81B01B0); + SetVBlankCallback(PartyMenuVBlankCallback); + SetMainCallback2(PartyMenuCallback); return TRUE; } return FALSE; } -void sub_81B04BC(void) +void PartyMenuExit(void) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - CreateTask(sub_81B04F8, 0); - SetVBlankCallback(sub_81B01CC); - SetMainCallback2(sub_81B01B0); + CreateTask(PartyMenuExitTask, 0); + SetVBlankCallback(PartyMenuVBlankCallback); + SetMainCallback2(PartyMenuCallback); } -void sub_81B04F8(u8 taskId) +void PartyMenuExitTask(u8 taskId) { if (!gPaletteFade.active) { - SetMainCallback2(gUnknown_0203CEC8.unk0); - sub_81B06F4(); + SetMainCallback2(gUnknown_0203CEC8.exitCallback); + FreePartyPointers(); DestroyTask(taskId); } } @@ -658,12 +676,12 @@ void reset_brm(void) gUnknown_0203CEE0 = NULL; } -bool8 sub_81B0550(void) +bool8 AllocPartyMenuBg(void) { - gUnknown_0203CEE4 = Alloc(sizeof(struct Unk_203CEE4)); + gUnknown_0203CEE4 = Alloc(0x800); if (gUnknown_0203CEE4 == NULL) return FALSE; - memset(gUnknown_0203CEE4, 0, sizeof(struct Unk_203CEE4)); + memset(gUnknown_0203CEE4, 0, 0x800); ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, gUnknown_086156B8, 3); SetBgTilemapBuffer(1, gUnknown_0203CEE4); @@ -677,48 +695,48 @@ bool8 sub_81B0550(void) return TRUE; } -bool8 sub_81B05C8(void) +bool8 AllocPartyMiscGfx(void) { int sizeout; - switch (gUnknown_0203CEC4->unk218[0]) + switch (gUnknown_0203CEC4->data[0]) { case 0: gUnknown_0203CEE0 = malloc_and_decompress(gPartyMenuMisc_Gfx, &sizeout); LoadBgTiles(1, gUnknown_0203CEE0, sizeout, 0); - gUnknown_0203CEC4->unk218[0]++; + gUnknown_0203CEC4->data[0]++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { LZDecompressWram(gPartyMenuMisc_Tilemap, gUnknown_0203CEE4); - gUnknown_0203CEC4->unk218[0]++; + gUnknown_0203CEC4->data[0]++; } break; case 2: LoadCompressedPalette(gPartyMenuMisc_Pal, 0, 0x160); - CpuCopy16(gPlttBufferUnfaded, gUnknown_0203CEC4->unk18, 0x160); - gUnknown_0203CEC4->unk218[0]++; + CpuCopy16(gPlttBufferUnfaded, gUnknown_0203CEC4->palBuffer, 0x160); + gUnknown_0203CEC4->data[0]++; break; case 3: - sub_81B06C0(4); - gUnknown_0203CEC4->unk218[0]++; + PartyPaletteBufferCopy(4); + gUnknown_0203CEC4->data[0]++; break; case 4: - sub_81B06C0(5); - gUnknown_0203CEC4->unk218[0]++; + PartyPaletteBufferCopy(5); + gUnknown_0203CEC4->data[0]++; break; case 5: - sub_81B06C0(6); - gUnknown_0203CEC4->unk218[0]++; + PartyPaletteBufferCopy(6); + gUnknown_0203CEC4->data[0]++; break; case 6: - sub_81B06C0(7); - gUnknown_0203CEC4->unk218[0]++; + PartyPaletteBufferCopy(7); + gUnknown_0203CEC4->data[0]++; break; case 7: - sub_81B06C0(8); - gUnknown_0203CEC4->unk218[0]++; + PartyPaletteBufferCopy(8); + gUnknown_0203CEC4->data[0]++; break; default: return TRUE; @@ -726,14 +744,14 @@ bool8 sub_81B05C8(void) return FALSE; } -void sub_81B06C0(u8 offset) +void PartyPaletteBufferCopy(u8 offset) { offset *= 16; CpuCopy16(&gPlttBufferUnfaded[0x30], &gPlttBufferUnfaded[offset], 32); CpuCopy16(&gPlttBufferUnfaded[0x30], &gPlttBufferFaded[offset], 32); } -void sub_81B06F4(void) +void FreePartyPointers(void) { if (gUnknown_0203CEC4) Free(gUnknown_0203CEC4); @@ -746,17 +764,17 @@ void sub_81B06F4(void) FreeAllWindowBuffers(); } -void sub_81B0740(u8 a) +void PartyMenuInitHelperStructs(u8 a) { u8 i; - gUnknown_0203CEDC = Alloc(sizeof(struct Unk_203CEDC[6])); + gUnknown_0203CEDC = Alloc(sizeof(struct Struct203CEDC[PARTY_SIZE])); - for (i = 0; i < 6; i++) + for (i = 0; i < PARTY_SIZE; i++) { gUnknown_0203CEDC[i].unk0 = &gUnknown_086156C4[1]; gUnknown_0203CEDC[i].unk4 = gUnknown_08615704[a][i]; - gUnknown_0203CEDC[i].unk8 = i; + gUnknown_0203CEDC[i].windowId = i; gUnknown_0203CEDC[i].unk9 |= 0xFF; gUnknown_0203CEDC[i].unkA |= 0xFF; gUnknown_0203CEDC[i].unkB |= 0xFF; @@ -769,41 +787,41 @@ void sub_81B0740(u8 a) gUnknown_0203CEDC[1].unk0 = &gUnknown_086156C4[0]; } -void sub_81B07E0(u8 slot) +void RenderPartyMenuBox(u8 slot) { if (gUnknown_0203CEC8.unk8_0 == 5 && slot > 2) { sub_81B0CEC(slot); if (gUnknown_02022FF8[slot - 3].species == SPECIES_NONE) - sub_81B2748(&gUnknown_0203CEDC[slot], 0x40); + UpdateSelectedPartyBox(&gUnknown_0203CEDC[slot], 0x40); else - sub_81B2748(&gUnknown_0203CEDC[slot], 8); - CopyWindowToVram(gUnknown_0203CEDC[slot].unk8, 2); - PutWindowTilemap(gUnknown_0203CEDC[slot].unk8); + UpdateSelectedPartyBox(&gUnknown_0203CEDC[slot], 8); + CopyWindowToVram(gUnknown_0203CEDC[slot].windowId, 2); + PutWindowTilemap(gUnknown_0203CEDC[slot].windowId); schedule_bg_copy_tilemap_to_vram(2); } else { if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) == SPECIES_NONE) { - sub_81B2720(gUnknown_0203CEDC[slot].unk8); - sub_81B2748(&gUnknown_0203CEDC[slot], 0x40); - CopyWindowToVram(gUnknown_0203CEDC[slot].unk8, 2); + sub_81B2720(gUnknown_0203CEDC[slot].windowId); + UpdateSelectedPartyBox(&gUnknown_0203CEDC[slot], 0x40); + CopyWindowToVram(gUnknown_0203CEDC[slot].windowId, 2); } else { if (gUnknown_0203CEC8.unk8_0 == 7) - sub_81B0B60(slot); + DisplayPartyPokemonSelectForRelearner(slot); else if (gUnknown_0203CEC8.unk8_0 == 2) - sub_81B0B08(slot); + DisplayPartyPokemonSelectForContest(slot); else if (gUnknown_0203CEC8.unk8_0 == 4) - sub_81B0A9C(slot); + DisplayPartyPokemonSelectForBattle(slot); else if (gUnknown_0203CEC8.unk8_0 == 11) sub_81B0B98(slot); else if (gUnknown_0203CEC8.unk8_0 == 12) - sub_81B0BC4(slot); + DisplayPartyPokemonSelectHeldItemRelated(slot); else if (!sub_81B0BFC(slot)) - sub_81B0948(slot); + DisplayPartyPokemonData(slot); if (gUnknown_0203CEC8.unk8_0 == 5) sub_81B0FCC(slot, 0); @@ -812,53 +830,53 @@ void sub_81B07E0(u8 slot) else sub_81B0FCC(slot, 0); } - PutWindowTilemap(gUnknown_0203CEDC[slot].unk8); + PutWindowTilemap(gUnknown_0203CEDC[slot].windowId); schedule_bg_copy_tilemap_to_vram(0); } } -void sub_81B0948(u8 slot) +void DisplayPartyPokemonData(u8 slot) { if (GetMonData(&gPlayerParty[slot], MON_DATA_IS_EGG)) { - gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 1); - sub_81B2A70(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].windowId, 0, 0, 0, 0, 1); + DisplayPartyPokemonNickname(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); } else { - gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 0); - sub_81B2A70(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); - sub_81B2AC8(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); - sub_81B2B8C(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); - sub_81B2CD4(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); - sub_81B2D74(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); - sub_81B2E28(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].windowId, 0, 0, 0, 0, 0); + DisplayPartyPokemonNickname(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + DisplayPartyPokemonLevelCheck(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + DisplayPartyPokemonGenderNidoranCheck(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + DisplayPartyPokemonHPCheck(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + DisplayPartyPokemonMaxHPCheck(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + DisplayPartyPokemonHPBarCheck(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); } } -void sub_81B0A10(u8 slot, u8 b) +void DisplayPartyPokemonSelectData(u8 slot, u8 stringID) { - struct Pokemon *currentPokemon = &gPlayerParty[slot]; + struct Pokemon *mon = &gPlayerParty[slot]; - gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 1); - sub_81B2A70(currentPokemon, &gUnknown_0203CEDC[slot], 0); - if (!GetMonData(currentPokemon, MON_DATA_IS_EGG)) + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].windowId, 0, 0, 0, 0, 1); + DisplayPartyPokemonNickname(mon, &gUnknown_0203CEDC[slot], 0); + if (!GetMonData(mon, MON_DATA_IS_EGG)) { - sub_81B2AC8(currentPokemon, &gUnknown_0203CEDC[slot], 0); - sub_81B2B8C(currentPokemon, &gUnknown_0203CEDC[slot], 0); + DisplayPartyPokemonLevelCheck(mon, &gUnknown_0203CEDC[slot], 0); + DisplayPartyPokemonGenderNidoranCheck(mon, &gUnknown_0203CEDC[slot], 0); } - sub_81B2FA8(b, &gUnknown_0203CEDC[slot], 0); + DisplayPartyPokemonOtherText(stringID, &gUnknown_0203CEDC[slot], 0); } -void sub_81B0A9C(u8 slot) +void DisplayPartyPokemonSelectForBattle(u8 slot) { u8 i; - struct Pokemon *currentPokemon = &gPlayerParty[slot]; + struct Pokemon *mon = &gPlayerParty[slot]; u8 *ptr = gSelectedOrderFromParty; - if (!sub_81B85AC(currentPokemon)) + if (!GetBattleEntryEligibility(mon)) { - sub_81B0A10(slot, 7); + DisplayPartyPokemonSelectData(slot, 7); return; } else @@ -868,53 +886,53 @@ void sub_81B0A9C(u8 slot) { if (ptr[i] != 0 && (ptr[i] - 1) == slot) { - sub_81B0A10(slot, i + 2); + DisplayPartyPokemonSelectData(slot, i + 2); return; } i++; } - sub_81B0A10(slot, 1); + DisplayPartyPokemonSelectData(slot, 1); } } -void sub_81B0B08(u8 slot) +void DisplayPartyPokemonSelectForContest(u8 slot) { switch (sub_80DAE0C(&gPlayerParty[slot])) { case 0: case 3: case 4: - sub_81B0A10(slot, 7); + DisplayPartyPokemonSelectData(slot, 7); break; case 1: case 2: - sub_81B0A10(slot, 6); + DisplayPartyPokemonSelectData(slot, 6); break; } } -void sub_81B0B60(u8 slot) +void DisplayPartyPokemonSelectForRelearner(u8 slot) { if (GetNumberOfRelearnableMoves(&gPlayerParty[slot]) == 0) - sub_81B0A10(slot, 9); + DisplayPartyPokemonSelectData(slot, 9); else - sub_81B0A10(slot, 8); + DisplayPartyPokemonSelectData(slot, 8); } void sub_81B0B98(u8 slot) { if (sub_81B218C(slot) == TRUE) - sub_81B0A10(slot, 6); + DisplayPartyPokemonSelectData(slot, 6); else - sub_81B0A10(slot, 7); + DisplayPartyPokemonSelectData(slot, 7); } -void sub_81B0BC4(u8 slot) +void DisplayPartyPokemonSelectHeldItemRelated(u8 slot) { if (GetMonData(&gPlayerParty[slot], MON_DATA_HELD_ITEM)) - sub_81B0A10(slot, 11); + DisplayPartyPokemonSelectData(slot, 11); else - sub_81B0A10(slot, 12); + DisplayPartyPokemonSelectData(slot, 12); } bool8 sub_81B0BFC(u8 slot) @@ -925,7 +943,7 @@ bool8 sub_81B0BFC(u8 slot) if (gUnknown_0203CEC8.unkB == 12) { gSpecialVar_Result = FALSE; - sub_81B0C94(slot, 0, gSpecialVar_0x8005); + DisplayPartyPokemonSelectToTeachMove(slot, 0, gSpecialVar_0x8005); } else { @@ -937,70 +955,70 @@ bool8 sub_81B0BFC(u8 slot) default: return FALSE; case 1: - sub_81B0C94(slot, item, 0); + DisplayPartyPokemonSelectToTeachMove(slot, item, 0); break; case 2: if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item) != SPECIES_NONE) return FALSE; - sub_81B0A10(slot, 0); + DisplayPartyPokemonSelectData(slot, 0); break; } } return TRUE; } -void sub_81B0C94(u8 slot, u16 item, u8 c) +void DisplayPartyPokemonSelectToTeachMove(u8 slot, u16 item, u8 tutor) { - switch (sub_81B22D8(&gPlayerParty[slot], item, c)) + switch (CanPartyPokemonLearnTMTutor(&gPlayerParty[slot], item, tutor)) { - case 1: - case 3: - sub_81B0A10(slot, 9); + case CANNOT_LEARN_MOVE: + case CANNOT_LEARN_MOVE_IS_EGG: + DisplayPartyPokemonSelectData(slot, 9); break; - case 2: - sub_81B0A10(slot, 10); + case ALREADY_KNOWS_MOVE: + DisplayPartyPokemonSelectData(slot, 10); break; default: - sub_81B0A10(slot, 8); + DisplayPartyPokemonSelectData(slot, 8); break; } } void sub_81B0CEC(u8 slot) { - struct Unk_203CEDC *structPtr = &gUnknown_0203CEDC[slot]; + struct Struct203CEDC *structPtr = &gUnknown_0203CEDC[slot]; u8 actualSlot = slot - 3; if (gUnknown_02022FF8[actualSlot].species == SPECIES_NONE) { - sub_81B2720(structPtr->unk8); + sub_81B2720(structPtr->windowId); } else { - structPtr->unk0->unk0(structPtr->unk8, 0, 0, 0, 0, 0); + structPtr->unk0->unk0(structPtr->windowId, 0, 0, 0, 0, 0); StringCopy(gStringVar1, gUnknown_02022FF8[actualSlot].nickname); StringGetEnd10(gStringVar1); sub_81DB52C(gStringVar1); - sub_81B2A3C(structPtr->unk8, gStringVar1, 0, structPtr->unk0->unk4); - sub_81B2B40(gUnknown_02022FF8[actualSlot].level, structPtr); - sub_81B2BF4(gUnknown_02022FF8[actualSlot].gender, gUnknown_02022FF8[actualSlot].species, gUnknown_02022FF8[actualSlot].nickname, structPtr); - sub_81B2D3C(gUnknown_02022FF8[actualSlot].hp, structPtr); - sub_81B2DDC(gUnknown_02022FF8[actualSlot].maxhp, structPtr); - sub_81B2E64(gUnknown_02022FF8[actualSlot].hp, gUnknown_02022FF8[actualSlot].maxhp, structPtr); + DisplayPartyPokemonBarDetail(structPtr->windowId, gStringVar1, 0, structPtr->unk0->unk4); + DisplayPartyPokemonLevel(gUnknown_02022FF8[actualSlot].level, structPtr); + DisplayPartyPokemonGender(gUnknown_02022FF8[actualSlot].gender, gUnknown_02022FF8[actualSlot].species, gUnknown_02022FF8[actualSlot].nickname, structPtr); + DisplayPartyPokemonHP(gUnknown_02022FF8[actualSlot].hp, structPtr); + DisplayPartyPokemonMaxHP(gUnknown_02022FF8[actualSlot].maxhp, structPtr); + DisplayPartyPokemonHPBar(gUnknown_02022FF8[actualSlot].hp, gUnknown_02022FF8[actualSlot].maxhp, structPtr); } } -bool8 sub_81B0DA0(void) +bool8 RenderPartyMenuBoxes(void) { - sub_81B07E0(gUnknown_0203CEC4->unk218[0]); - if (++gUnknown_0203CEC4->unk218[0] == 6) + RenderPartyMenuBox(gUnknown_0203CEC4->data[0]); + if (++gUnknown_0203CEC4->data[0] == 6) return TRUE; return FALSE; } -u8* sub_81B0DD4(u16 a) +u8* GetPartyMiscGraphicsTile(u16 tileId) { - return &gUnknown_0203CEE0[a << 5]; + return &gUnknown_0203CEE0[tileId << 5]; } void party_menu_add_per_mon_objects_internal(u8 slot) @@ -1035,8 +1053,8 @@ void party_menu_add_per_mon_objects_internal(u8 slot) bool8 party_menu_add_per_mon_objects(void) { - party_menu_add_per_mon_objects_internal(gUnknown_0203CEC4->unk218[0]); - if (++gUnknown_0203CEC4->unk218[0] == 6) + party_menu_add_per_mon_objects_internal(gUnknown_0203CEC4->data[0]); + if (++gUnknown_0203CEC4->data[0] == 6) return TRUE; return FALSE; } @@ -1072,8 +1090,8 @@ void sub_81B0FCC(u8 slot, u8 b) default: if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) != SPECIES_NONE) { - sub_81B2748(&gUnknown_0203CEDC[slot], sub_81B10F8(slot, b)); - sub_81B5B6C(gUnknown_0203CEDC[slot].unk9, b); + UpdateSelectedPartyBox(&gUnknown_0203CEDC[slot], GetPartyBoxPalBitfield(slot, b)); + AnimateSelectedPartyIcon(gUnknown_0203CEDC[slot].unk9, b); sub_81B5F98(gUnknown_0203CEDC[slot].unkB, b); } return; @@ -1107,14 +1125,14 @@ void sub_81B0FCC(u8 slot, u8 b) schedule_bg_copy_tilemap_to_vram(1); } -u8 sub_81B10F8(u8 slot, u8 b) +u8 GetPartyBoxPalBitfield(u8 slot, u8 b) { u8 returnVar = 0; if (b == 1) returnVar = 1; if (GetMonData(&gPlayerParty[slot], MON_DATA_HP) == 0) returnVar |= 2; - if (sub_81B118C(slot) == TRUE) + if (PartyBoxPal_ParnterOrDisqualifiedInArena(slot) == TRUE) returnVar |= 8; if (gUnknown_0203CEC8.unkB == 9) returnVar |= 16; @@ -1129,9 +1147,9 @@ u8 sub_81B10F8(u8 slot, u8 b) return returnVar; } -bool8 sub_81B118C(u8 slot) +bool8 PartyBoxPal_ParnterOrDisqualifiedInArena(u8 slot) { - if (gUnknown_0203CEC8.unk8_1 == 2 && (slot == 1 || slot == 4 || slot == 5)) + if (gUnknown_0203CEC8.mode == 2 && (slot == 1 || slot == 4 || slot == 5)) return TRUE; if (slot < 3 && (gBattleTypeFlags & BATTLE_TYPE_ARENA) && gMain.inBattle && (gBattleStruct->arenaLostPlayerMons >> sub_81B8F38(slot) & 1)) @@ -1147,7 +1165,7 @@ void sub_81B120C(void) schedule_bg_copy_tilemap_to_vram(1); } -bool8 sub_81B1250(void) +bool8 IsMultiBattle(void) { if ((gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI)) == (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI) && gMain.inBattle) return TRUE; @@ -1178,13 +1196,13 @@ void c3_0811FAB4(u8 taskId) if (gUnknown_0203CEC8.unk8_0 == 1) sub_81B9080(); - if (gUnknown_0203CEC4->unk4 != NULL) - SetMainCallback2(gUnknown_0203CEC4->unk4); + if (gUnknown_0203CEC4->exitCallback != NULL) + SetMainCallback2(gUnknown_0203CEC4->exitCallback); else - SetMainCallback2(gUnknown_0203CEC8.unk0); + SetMainCallback2(gUnknown_0203CEC8.exitCallback); ResetSpriteData(); - sub_81B06F4(); + FreePartyPointers(); DestroyTask(taskId); } } @@ -1205,7 +1223,7 @@ void sub_81B1370(u8 taskId) { s8 *ptr = sub_81B13EC(); - switch (sub_81B1760(ptr)) + switch (PartyMenuButtonHandler(ptr)) { case 1: sub_81B140C(taskId, ptr); @@ -1251,7 +1269,7 @@ void sub_81B140C(u8 taskId, s8 *ptr) if (sub_81B15A4((u8*)ptr)) { if (gUnknown_0203CEC8.unk8_0 == 1) - gUnknown_0203CEC4->unk4 = sub_81B9140; + gUnknown_0203CEC4->exitCallback = sub_81B9140; sub_81B302C(&gUnknown_0203CEC4->unkC[1]); gUnknown_03006328(taskId, sub_81B6794); @@ -1392,35 +1410,35 @@ void sub_81B1708(u8 taskId) } } -u16 sub_81B1760(s8 *ptr) +u16 PartyMenuButtonHandler(s8 *ptr) { - s8 r1; + s8 movementDir; switch (gMain.newAndRepeatedKeys) { case DPAD_UP: - r1 = -1; + movementDir = -1; break; case DPAD_DOWN: - r1 = 1; + movementDir = 1; break; case DPAD_LEFT: - r1 = -2; + movementDir = -2; break; case DPAD_RIGHT: - r1 = 2; + movementDir = 2; break; default: switch (sub_812210C()) { case 1: - r1 = -1; + movementDir = -1; break; case 2: - r1 = 1; + movementDir = 1; break; default: - r1 = 0; + movementDir = 0; break; } } @@ -1428,9 +1446,9 @@ u16 sub_81B1760(s8 *ptr) if (gMain.newKeys & START_BUTTON) return 8; - if (r1) + if (movementDir) { - sub_81B17F8(ptr, r1); + UpdateCurrentPartySelection(ptr, movementDir); return 0; } @@ -1441,14 +1459,14 @@ u16 sub_81B1760(s8 *ptr) } #ifdef NONMATCHING -void sub_81B17F8(s8 *ptr, s8 b) +void UpdateCurrentPartySelection(s8 *ptr, s8 movementDir) { s8 slot = *ptr; - if (!gUnknown_0203CEC8.unk8_1) - sub_81B1854(ptr, b); + if (gUnknown_0203CEC8.mode == 0) + SetNewPartySelectTarget1(ptr, movementDir); else - sub_81B195C(ptr, b); + SetNewPartySelectTarget2(ptr, movementDir); if (*ptr != slot) { @@ -1459,7 +1477,7 @@ void sub_81B17F8(s8 *ptr, s8 b) } #else NAKED -void sub_81B17F8(s8 *ptr, s8 b) +void UpdateCurrentPartySelection(s8 *ptr, s8 b) { asm_unified("push {r4,r5,lr}\n\ adds r5, r0, 0\n\ @@ -1475,14 +1493,14 @@ void sub_81B17F8(s8 *ptr, s8 b) lsls r1, 24\n\ asrs r1, 24\n\ adds r0, r5, 0\n\ - bl sub_81B1854\n\ + bl SetNewPartySelectTarget1\n\ b _081B182A\n\ .pool\n\ _081B1820:\n\ lsls r1, 24\n\ asrs r1, 24\n\ adds r0, r5, 0\n\ - bl sub_81B195C\n\ + bl SetNewPartySelectTarget2\n\ _081B182A:\n\ movs r1, 0\n\ ldrsb r1, [r5, r1]\n\ @@ -1506,7 +1524,7 @@ _081B184C:\n\ #endif #ifdef NONMATCHING -void sub_81B1854(s8 *ptr, s8 b) +void SetNewPartySelectTarget1(s8 *ptr, s8 b) { u8 r0r2; @@ -1575,7 +1593,7 @@ void sub_81B1854(s8 *ptr, s8 b) } #else NAKED -void sub_81B1854(s8 *ptr, s8 b) +void SetNewPartySelectTarget1(s8 *ptr, s8 b) { asm_unified("push {r4,lr}\n\ adds r4, r0, 0\n\ @@ -1716,7 +1734,7 @@ _081B1952:\n\ #endif #ifdef NONMATCHING -void sub_81B195C(s8 *ptr, s8 b) +void SetNewPartySelectTarget2(s8 *ptr, s8 b) { u8 unk; s8 unk2 = b; @@ -1827,7 +1845,7 @@ void sub_81B195C(s8 *ptr, s8 b) } #else NAKED -void sub_81B195C(s8 *ptr, s8 b) +void SetNewPartySelectTarget2(s8 *ptr, s8 b) { asm_unified("push {r4-r6,lr}\n\ adds r4, r0, 0\n\ @@ -2189,8 +2207,8 @@ void sub_81B1E60(u8 taskId) data[0] += data[2]; data[3]--; SetMonData(&gPlayerParty[data[4]], MON_DATA_HP, &data[0]); - sub_81B2CD4(&gPlayerParty[data[4]], &gUnknown_0203CEDC[data[4]], 1); - sub_81B2E28(&gPlayerParty[data[4]], &gUnknown_0203CEDC[data[4]]); + DisplayPartyPokemonHPCheck(&gPlayerParty[data[4]], &gUnknown_0203CEDC[data[4]], 1); + DisplayPartyPokemonHPBarCheck(&gPlayerParty[data[4]], &gUnknown_0203CEDC[data[4]]); if (data[3] == 0 || data[0] == 0 || data[0] == data[1]) { if (data[0] > data[5]) @@ -2365,32 +2383,32 @@ void sub_81B227C(u8 taskId) } } -u8 sub_81B22D8(struct Pokemon *mon, u16 item, u8 c) +u8 CanPartyPokemonLearnTMTutor(struct Pokemon *mon, u16 item, u8 tutor) { u16 move; if (GetMonData(mon, MON_DATA_IS_EGG) != FALSE) - return 3; + return CANNOT_LEARN_MOVE_IS_EGG; if (item >= ITEM_TM01_FOCUS_PUNCH) { if (CanMonLearnTMHM(mon, item - 33) != FALSE) move = ItemIdToBattleMoveId(item); else - return 1; + return CANNOT_LEARN_MOVE; do {} while (0); // :morphon: } - else if (sub_81B2370(GetMonData(mon, MON_DATA_SPECIES), c) == FALSE) + else if (sub_81B2370(GetMonData(mon, MON_DATA_SPECIES), tutor) == FALSE) { - return 1; + return CANNOT_LEARN_MOVE; } else { - move = sub_81B2360(c); + move = sub_81B2360(tutor); } if (pokemon_has_move(mon, move) == TRUE) - return 2; - return 0; + return ALREADY_KNOWS_MOVE; + return CAN_LEARN_MOVE; } u16 sub_81B2360(u8 tutor) @@ -2425,7 +2443,7 @@ void sub_81B239C(u8 a) break; } DeactivateAllTextPrinters(); - for (i = 0; i < 6; i++) + for (i = 0; i < PARTY_SIZE; i++) FillWindowPixelBuffer(i, 0); LoadUserWindowBorderGfx(0, 0x4F, 0xD0); LoadPalette(GetOverworldTextboxPalettePtr(), 0xE0, 0x20); @@ -2474,12 +2492,12 @@ void sub_81B2428(bool8 a) } } -u16* sub_81B2564(u8 a) +u16* GetPartyMenuPaletteFromBuffer(u8 paletteId) { - return &gUnknown_0203CEC4->unk18[a]; + return &gUnknown_0203CEC4->palBuffer[paletteId]; } -void sub_81B2578(u8 windowId, u8 *b, u8 c, u8 x, u8 y, u8 width, u8 height) +void BlitBitmapToPartyWindow(u8 windowId, u8 *b, u8 c, u8 x, u8 y, u8 width, u8 height) { u8 *pixels = AllocZeroed(height * width * 32); u8 i, j; @@ -2489,14 +2507,14 @@ void sub_81B2578(u8 windowId, u8 *b, u8 c, u8 x, u8 y, u8 width, u8 height) for (i = 0; i < height; i++) { for (j = 0; j < width; j++) - CpuCopy16(sub_81B0DD4(b[x + j + ((y + i) * c)]), &pixels[(i * width + j) * 32], 32); + CpuCopy16(GetPartyMiscGraphicsTile(b[x + j + ((y + i) * c)]), &pixels[(i * width + j) * 32], 32); } BlitBitmapToWindow(windowId, pixels, x * 8, y * 8, width * 8, height * 8); Free(pixels); } } -void sub_81B2658(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) +void BlitBitmapToPartyWindow_Default1(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) { if (width == 0 && height == 0) { @@ -2504,12 +2522,12 @@ void sub_81B2658(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) height = 7; } if (f == 0) - sub_81B2578(windowId, gUnknown_08615988, 10, x, y, width, height); + BlitBitmapToPartyWindow(windowId, gUnknown_08615988, 10, x, y, width, height); else - sub_81B2578(windowId, gUnknown_086159CE, 10, x, y, width, height); + BlitBitmapToPartyWindow(windowId, gUnknown_086159CE, 10, x, y, width, height); } -void sub_81B26BC(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) +void BlitBitmapToPartyWindow_Default2(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) { if (width == 0 && height == 0) { @@ -2517,158 +2535,158 @@ void sub_81B26BC(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) height = 3; } if (f == 0) - sub_81B2578(windowId, gUnknown_08615A14, 18, x, y, width, height); + BlitBitmapToPartyWindow(windowId, gUnknown_08615A14, 18, x, y, width, height); else - sub_81B2578(windowId, gUnknown_08615A4A, 18, x, y, width, height); + BlitBitmapToPartyWindow(windowId, gUnknown_08615A4A, 18, x, y, width, height); } void sub_81B2720(u8 windowId) { - sub_81B2578(windowId, gUnknown_08615A80, 18, 0, 0, 18, 3); + BlitBitmapToPartyWindow(windowId, gUnknown_08615A80, 18, 0, 0, 18, 3); } -void sub_81B2748(struct Unk_203CEDC *ptr, u8 bitfield) +void UpdateSelectedPartyBox(struct Struct203CEDC *ptr, u8 bitfield) { - u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + u8 palNum = GetWindowAttribute(ptr->windowId, WINDOW_PALETTE_NUM) * 16; if (0x40 & bitfield) { - LoadPalette(sub_81B2564(gUnknown_08615AF1[0]), gUnknown_08615AC0[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AF1[1]), gUnknown_08615AC0[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AF1[2]), gUnknown_08615AC0[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AF1[0]), gUnknown_08615AC0[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AF1[1]), gUnknown_08615AC0[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AF1[2]), gUnknown_08615AC0[2] + palNum, 2); } else if (0x20 & bitfield) { if (1 & bitfield) { - LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); } else { - LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); } } else if (0x10 & bitfield) { - LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); } else if (4 & bitfield) { if (1 & bitfield) { - LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); } else { - LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); } } else if (2 & bitfield) { if (1 & bitfield) { - LoadPalette(sub_81B2564(gUnknown_08615ADC[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADC[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ADC[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADC[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADC[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADC[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); } else { - LoadPalette(sub_81B2564(gUnknown_08615AD3[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AD3[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AD3[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE8[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE8[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE8[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD3[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD3[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD3[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE8[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE8[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE8[2]), gUnknown_08615ABD[2] + palNum, 2); } } else if (8 & bitfield) { if (1 & bitfield) { - LoadPalette(sub_81B2564(gUnknown_08615AD9[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AD9[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AD9[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD9[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD9[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD9[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); } else { - LoadPalette(sub_81B2564(gUnknown_08615AD0[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AD0[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AD0[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE5[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE5[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE5[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD0[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD0[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD0[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE5[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE5[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE5[2]), gUnknown_08615ABD[2] + palNum, 2); } } else if (1 & bitfield) { - LoadPalette(sub_81B2564(gUnknown_08615AD6[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AD6[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AD6[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD6[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD6[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD6[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); } else { - LoadPalette(sub_81B2564(gUnknown_08615ACD[0]), gUnknown_08615ABA[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ACD[1]), gUnknown_08615ABA[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ACD[2]), gUnknown_08615ABA[2] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE2[0]), gUnknown_08615ABD[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE2[1]), gUnknown_08615ABD[1] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AE2[2]), gUnknown_08615ABD[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ACD[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ACD[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ACD[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE2[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE2[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE2[2]), gUnknown_08615ABD[2] + palNum, 2); } } -void sub_81B2A3C(u8 windowId, const u8 *str, u8 color, u8 *ptr) +void DisplayPartyPokemonBarDetail(u8 windowId, const u8 *str, u8 color, u8 *align) { - AddTextPrinterParameterized3(windowId, 0, ptr[0], ptr[1], gUnknown_086157FC[color], 0, str); + AddTextPrinterParameterized3(windowId, 0, align[0], align[1], gUnknown_086157FC[color], 0, str); } -void sub_81B2A70(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +void DisplayPartyPokemonNickname(struct Pokemon *mon, struct Struct203CEDC *ptr, u8 c) { u8 nickname[POKEMON_NAME_LENGTH + 1]; if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { if (c == 1) - ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[0] >> 3, ptr->unk0->unk4[1] >> 3, ptr->unk0->unk4[2] >> 3, ptr->unk0->unk4[3] >> 3, 0); + ptr->unk0->unk0(ptr->windowId, ptr->unk0->unk4[0] >> 3, ptr->unk0->unk4[1] >> 3, ptr->unk0->unk4[2] >> 3, ptr->unk0->unk4[3] >> 3, 0); GetMonNickname(mon, nickname); - sub_81B2A3C(ptr->unk8, nickname, 0, ptr->unk0->unk4); + DisplayPartyPokemonBarDetail(ptr->windowId, nickname, 0, ptr->unk0->unk4); } } -void sub_81B2AC8(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +void DisplayPartyPokemonLevelCheck(struct Pokemon *mon, struct Struct203CEDC *ptr, u8 c) { if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { @@ -2676,34 +2694,34 @@ void sub_81B2AC8(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) if (ailment == AILMENT_NONE || ailment == AILMENT_PKRS) { if (c != 0) - ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[4] >> 3, (ptr->unk0->unk4[5] >> 3) + 1, ptr->unk0->unk4[6] >> 3, ptr->unk0->unk4[7] >> 3, 0); + ptr->unk0->unk0(ptr->windowId, ptr->unk0->unk4[4] >> 3, (ptr->unk0->unk4[5] >> 3) + 1, ptr->unk0->unk4[6] >> 3, ptr->unk0->unk4[7] >> 3, 0); if (c != 2) - sub_81B2B40(GetMonData(mon, MON_DATA_LEVEL), ptr); + DisplayPartyPokemonLevel(GetMonData(mon, MON_DATA_LEVEL), ptr); } } } -void sub_81B2B40(u8 level, struct Unk_203CEDC *ptr) +void DisplayPartyPokemonLevel(u8 level, struct Struct203CEDC *ptr) { ConvertIntToDecimalStringN(gStringVar2, level, 0, 3); StringCopy(gStringVar1, gText_LevelSymbol); StringAppend(gStringVar1, gStringVar2); - sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[4]); + DisplayPartyPokemonBarDetail(ptr->windowId, gStringVar1, 0, &ptr->unk0->unk4[4]); } -void sub_81B2B8C(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +void DisplayPartyPokemonGenderNidoranCheck(struct Pokemon *mon, struct Struct203CEDC *ptr, u8 c) { u8 nickname[POKEMON_NAME_LENGTH + 1]; if (c == 1) - ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[8] >> 3, (ptr->unk0->unk4[9] >> 3) + 1, ptr->unk0->unk4[10] >> 3, ptr->unk0->unk4[11] >> 3, 0); + ptr->unk0->unk0(ptr->windowId, ptr->unk0->unk4[8] >> 3, (ptr->unk0->unk4[9] >> 3) + 1, ptr->unk0->unk4[10] >> 3, ptr->unk0->unk4[11] >> 3, 0); GetMonNickname(mon, nickname); - sub_81B2BF4(GetMonGender(mon), GetMonData(mon, MON_DATA_SPECIES), nickname, ptr); + DisplayPartyPokemonGender(GetMonGender(mon), GetMonData(mon, MON_DATA_SPECIES), nickname, ptr); } -void sub_81B2BF4(u8 gender, u16 species, u8 *nickname, struct Unk_203CEDC *ptr) +void DisplayPartyPokemonGender(u8 gender, u16 species, u8 *nickname, struct Struct203CEDC *ptr) { - u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + u8 palNum = GetWindowAttribute(ptr->windowId, WINDOW_PALETTE_NUM) * 16; if (species == SPECIES_NONE) return; @@ -2715,112 +2733,112 @@ void sub_81B2BF4(u8 gender, u16 species, u8 *nickname, struct Unk_203CEDC *ptr) switch (gender) { case MON_MALE: - LoadPalette(sub_81B2564(gUnknown_08615AC3[0]), gUnknown_08615AB6[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AC3[1]), gUnknown_08615AB6[1] + palNum, 2); - sub_81B2A3C(ptr->unk8, gText_MaleSymbol, 2, &ptr->unk0->unk4[8]); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AC3[0]), gUnknown_08615AB6[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AC3[1]), gUnknown_08615AB6[1] + palNum, 2); + DisplayPartyPokemonBarDetail(ptr->windowId, gText_MaleSymbol, 2, &ptr->unk0->unk4[8]); break; case MON_FEMALE: - LoadPalette(sub_81B2564(gUnknown_08615AC5[0]), gUnknown_08615AB6[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AC5[1]), gUnknown_08615AB6[1] + palNum, 2); - sub_81B2A3C(ptr->unk8, gText_FemaleSymbol, 2, &ptr->unk0->unk4[8]); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AC5[0]), gUnknown_08615AB6[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AC5[1]), gUnknown_08615AB6[1] + palNum, 2); + DisplayPartyPokemonBarDetail(ptr->windowId, gText_FemaleSymbol, 2, &ptr->unk0->unk4[8]); break; } } -void sub_81B2CD4(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +void DisplayPartyPokemonHPCheck(struct Pokemon *mon, struct Struct203CEDC *ptr, u8 c) { if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { if (c != 0) - ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[12] >> 3, (ptr->unk0->unk4[13] >> 3) + 1, ptr->unk0->unk4[14] >> 3, ptr->unk0->unk4[15] >> 3, 0); + ptr->unk0->unk0(ptr->windowId, ptr->unk0->unk4[12] >> 3, (ptr->unk0->unk4[13] >> 3) + 1, ptr->unk0->unk4[14] >> 3, ptr->unk0->unk4[15] >> 3, 0); if (c != 2) - sub_81B2D3C(GetMonData(mon, MON_DATA_HP), ptr); + DisplayPartyPokemonHP(GetMonData(mon, MON_DATA_HP), ptr); } } -void sub_81B2D3C(u16 hp, struct Unk_203CEDC *ptr) +void DisplayPartyPokemonHP(u16 hp, struct Struct203CEDC *ptr) { u8 *strOut = ConvertIntToDecimalStringN(gStringVar1, hp, 1, 3); strOut[0] = CHAR_SLASH; strOut[1] = EOS; - sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[12]); + DisplayPartyPokemonBarDetail(ptr->windowId, gStringVar1, 0, &ptr->unk0->unk4[12]); } -void sub_81B2D74(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +void DisplayPartyPokemonMaxHPCheck(struct Pokemon *mon, struct Struct203CEDC *ptr, u8 c) { if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { if (c != 0) - ptr->unk0->unk0(ptr->unk8, (ptr->unk0->unk4[16] >> 3) + 1, (ptr->unk0->unk4[17] >> 3) + 1, ptr->unk0->unk4[18] >> 3, ptr->unk0->unk4[19] >> 3, 0); + ptr->unk0->unk0(ptr->windowId, (ptr->unk0->unk4[16] >> 3) + 1, (ptr->unk0->unk4[17] >> 3) + 1, ptr->unk0->unk4[18] >> 3, ptr->unk0->unk4[19] >> 3, 0); if (c != 2) - sub_81B2DDC(GetMonData(mon, MON_DATA_MAX_HP), ptr); + DisplayPartyPokemonMaxHP(GetMonData(mon, MON_DATA_MAX_HP), ptr); } } -void sub_81B2DDC(u16 maxhp, struct Unk_203CEDC *ptr) +void DisplayPartyPokemonMaxHP(u16 maxhp, struct Struct203CEDC *ptr) { ConvertIntToDecimalStringN(gStringVar2, maxhp, 1, 3); StringCopy(gStringVar1, gText_Slash); StringAppend(gStringVar1, gStringVar2); - sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[16]); + DisplayPartyPokemonBarDetail(ptr->windowId, gStringVar1, 0, &ptr->unk0->unk4[16]); } -void sub_81B2E28(struct Pokemon *mon, struct Unk_203CEDC *ptr) +void DisplayPartyPokemonHPBarCheck(struct Pokemon *mon, struct Struct203CEDC *ptr) { if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) - sub_81B2E64(GetMonData(mon, MON_DATA_HP), GetMonData(mon, MON_DATA_MAX_HP), ptr); + DisplayPartyPokemonHPBar(GetMonData(mon, MON_DATA_HP), GetMonData(mon, MON_DATA_MAX_HP), ptr); } -void sub_81B2E64(u16 hp, u16 maxhp, struct Unk_203CEDC *ptr) +void DisplayPartyPokemonHPBar(u16 hp, u16 maxhp, struct Struct203CEDC *ptr) { - u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + u8 palNum = GetWindowAttribute(ptr->windowId, WINDOW_PALETTE_NUM) * 16; u8 hpFraction; switch (GetHPBarLevel(hp, maxhp)) { case HP_BAR_GREEN: case HP_BAR_FULL: - LoadPalette(sub_81B2564(gUnknown_08615AC7[0]), gUnknown_08615AB8[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AC7[1]), gUnknown_08615AB8[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AC7[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AC7[1]), gUnknown_08615AB8[1] + palNum, 2); break; case HP_BAR_YELLOW: - LoadPalette(sub_81B2564(gUnknown_08615AC9[0]), gUnknown_08615AB8[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615AC9[1]), gUnknown_08615AB8[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AC9[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AC9[1]), gUnknown_08615AB8[1] + palNum, 2); break; default: - LoadPalette(sub_81B2564(gUnknown_08615ACB[0]), gUnknown_08615AB8[0] + palNum, 2); - LoadPalette(sub_81B2564(gUnknown_08615ACB[1]), gUnknown_08615AB8[1] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ACB[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ACB[1]), gUnknown_08615AB8[1] + palNum, 2); break; } hpFraction = GetScaledHPFraction(hp, maxhp, ptr->unk0->unk4[22]); - FillWindowPixelRect(ptr->unk8, gUnknown_08615AB8[1], ptr->unk0->unk4[20], ptr->unk0->unk4[21], hpFraction, 1); - FillWindowPixelRect(ptr->unk8, gUnknown_08615AB8[0], ptr->unk0->unk4[20], ptr->unk0->unk4[21] + 1, hpFraction, 2); + FillWindowPixelRect(ptr->windowId, gUnknown_08615AB8[1], ptr->unk0->unk4[20], ptr->unk0->unk4[21], hpFraction, 1); + FillWindowPixelRect(ptr->windowId, gUnknown_08615AB8[0], ptr->unk0->unk4[20], ptr->unk0->unk4[21] + 1, hpFraction, 2); if (hpFraction != ptr->unk0->unk4[22]) { - FillWindowPixelRect(ptr->unk8, 13, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21], ptr->unk0->unk4[22] - hpFraction, 1); - FillWindowPixelRect(ptr->unk8, 2, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21] + 1, ptr->unk0->unk4[22] - hpFraction, 2); + FillWindowPixelRect(ptr->windowId, 13, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21], ptr->unk0->unk4[22] - hpFraction, 1); + FillWindowPixelRect(ptr->windowId, 2, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21] + 1, ptr->unk0->unk4[22] - hpFraction, 2); } - CopyWindowToVram(ptr->unk8, 2); + CopyWindowToVram(ptr->windowId, 2); } #ifdef NONMATCHING -void sub_81B2FA8(u8 stringID, struct Unk_203CEDC *ptr, u8 c) +void DisplayPartyPokemonOtherText(u8 stringID, struct Struct203CEDC *ptr, u8 c) { if (c != 0) { int unk = ((ptr->unk0->unk1C & 7) + ptr->unk0->unk1E + 7) / 8; int unk2 = ((ptr->unk0->unk1D & 7) + ptr->unk0->unk1F + 7) / 8; - ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk1C >> 3, ptr->unk0->unk1D >> 3, unk, unk2, 1); + ptr->unk0->unk0(ptr->windowId, ptr->unk0->unk1C >> 3, ptr->unk0->unk1D >> 3, unk, unk2, 1); } if (c != 2) - AddTextPrinterParameterized3(ptr->unk8, 1, ptr->unk0->unk1C, ptr->unk0->unk1D, gUnknown_086157FC[0], 0, gUnknown_08615B60[stringID]); + AddTextPrinterParameterized3(ptr->windowId, 1, ptr->unk0->unk1C, ptr->unk0->unk1D, gUnknown_086157FC[0], 0, gUnknown_08615B60[stringID]); } #else NAKED -void sub_81B2FA8(u8 stringID, struct Unk_203CEDC *ptr, u8 c) +void DisplayPartyPokemonOtherText(u8 stringID, struct Struct203CEDC *ptr, u8 c) { asm_unified("push {r4-r7,lr}\n\ mov r7, r8\n\ @@ -3203,7 +3221,7 @@ void sub_81B3730(u8 taskId) void sub_81B37FC(u8 taskId) { PlaySE(SE_SELECT); - gUnknown_0203CEC4->unk4 = sub_81B3828; + gUnknown_0203CEC4->exitCallback = sub_81B3828; sub_81B12C0(taskId); } @@ -3224,7 +3242,7 @@ void sub_81B3894(void) { gPaletteFade.bufferTransferDisabled = TRUE; gUnknown_0203CEC8.unk9 = gUnknown_0203CF20; - sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.unk0); + InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.exitCallback); } void brm_switch(u8 taskId) @@ -3250,7 +3268,7 @@ void sub_81B3938(u8 taskId) } else { - windowIds[0] = gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unk8; + windowIds[0] = gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].windowId; data[0] = GetWindowAttribute(windowIds[0], WINDOW_TILEMAP_LEFT); data[1] = GetWindowAttribute(windowIds[0], WINDOW_TILEMAP_TOP); data[2] = GetWindowAttribute(windowIds[0], WINDOW_WIDTH); @@ -3260,7 +3278,7 @@ void sub_81B3938(u8 taskId) data[10] = -1; else data[10] = 1; - windowIds[1] = gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].unk8; + windowIds[1] = gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].windowId; data[4] = GetWindowAttribute(windowIds[1], WINDOW_TILEMAP_LEFT); data[5] = GetWindowAttribute(windowIds[1], WINDOW_TILEMAP_TOP); data[6] = GetWindowAttribute(windowIds[1], WINDOW_WIDTH); @@ -3387,7 +3405,7 @@ void sub_81B3B40(const void *rectSrc, s16 a, s16 b, s16 c, s16 d, s16 e) } } -void sub_81B3C0C(struct Unk_203CEDC *ptr, s16 a) +void sub_81B3C0C(struct Struct203CEDC *ptr, s16 a) { gSprites[ptr->unkB].pos2.x += a * 8; gSprites[ptr->unkA].pos2.x += a * 8; @@ -3432,14 +3450,14 @@ void sub_81B3D48(u8 taskId) data[10] *= -1; data[11] *= -1; swap_pokemon_and_oams(); - sub_81B0948(gUnknown_0203CEC8.unk9); - sub_81B0948(gUnknown_0203CEC8.unkA); - PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unk8); - PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].unk8); + DisplayPartyPokemonData(gUnknown_0203CEC8.unk9); + DisplayPartyPokemonData(gUnknown_0203CEC8.unkA); + PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].windowId); + PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].windowId); sub_8199CBC(0, gUnknown_0203CEF0, data[0], data[1], data[2], data[3]); sub_8199CBC(0, gUnknown_0203CEF4, data[4], data[5], data[6], data[7]); - ClearWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unk8); - ClearWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].unk8); + ClearWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].windowId); + ClearWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].windowId); gTasks[taskId].func = sub_81B3E60; } } @@ -3452,8 +3470,8 @@ void sub_81B3E60(u8 taskId) sub_81B3C60(taskId); if (data[10] == 0 && data[11] == 0) { - PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unk8); - PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].unk8); + PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].windowId); + PutWindowTilemap(gUnknown_0203CEDC[gUnknown_0203CEC8.unkA].windowId); schedule_bg_copy_tilemap_to_vram(0); Free(gUnknown_0203CEF0); Free(gUnknown_0203CEF4); @@ -3493,7 +3511,7 @@ void oamt_swap_pos(u8 *spriteIdPtr1, u8 *spriteIdPtr2) void swap_pokemon_and_oams(void) { - struct Unk_203CEDC *structPtrs[2]; + struct Struct203CEDC *structPtrs[2]; struct Pokemon *mon1, *mon2; struct Pokemon *monBuffer; @@ -3550,7 +3568,7 @@ void sub_81B4134(u8 taskId) void sub_81B4198(u8 taskId) { PlaySE(SE_SELECT); - gUnknown_0203CEC4->unk4 = sub_81B41C4; + gUnknown_0203CEC4->exitCallback = sub_81B41C4; sub_81B12C0(taskId); } @@ -3566,14 +3584,14 @@ void c2_8123744(void) { if (gSpecialVar_ItemId == ITEM_NONE) { - sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B36FC, gUnknown_0203CEC8.unk0); + InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B36FC, gUnknown_0203CEC8.exitCallback); } else { gUnknown_0203CEFC = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_HELD_ITEM); if (gUnknown_0203CEFC != ITEM_NONE) { - sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4350, gUnknown_0203CEC8.unk0); + InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4350, gUnknown_0203CEC8.exitCallback); } else if (ItemIsMail(gSpecialVar_ItemId) != FALSE) { @@ -3583,7 +3601,7 @@ void c2_8123744(void) } else { - sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B42D0, gUnknown_0203CEC8.unk0); + InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B42D0, gUnknown_0203CEC8.exitCallback); } } } @@ -3657,7 +3675,7 @@ void sub_81B44FC(u8 taskId) { if (sub_81B1BD4() != TRUE) { - gUnknown_0203CEC4->unk4 = sub_81B452C; + gUnknown_0203CEC4->exitCallback = sub_81B452C; sub_81B12C0(taskId); } } @@ -3680,11 +3698,11 @@ void sub_81B4578(void) SetMonData(mon, MON_DATA_HELD_ITEM, &gUnknown_0203CEFC); RemoveBagItem(gUnknown_0203CEFC, 1); AddBagItem(item, 1); - sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0, sub_81B36FC, gUnknown_0203CEC8.unk0); + InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0, sub_81B36FC, gUnknown_0203CEC8.exitCallback); } else { - sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4624, gUnknown_0203CEC8.unk0); + InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4624, gUnknown_0203CEC8.exitCallback); } } @@ -3710,9 +3728,9 @@ void sub_81B469C(u8 taskId) if (gUnknown_0203CEC8.unk8_0 == 12) { if (GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE) - sub_81B2FA8(11, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + DisplayPartyPokemonOtherText(11, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); else - sub_81B2FA8(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + DisplayPartyPokemonOtherText(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); } sub_81B1C1C(taskId); } @@ -3808,7 +3826,7 @@ void sub_81B4988(u8 taskId) itemClear = ITEM_NONE; SetMonData(mon, MON_DATA_HELD_ITEM, &itemClear); sub_81B5C94(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); - sub_81B2FA8(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + DisplayPartyPokemonOtherText(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); gTasks[taskId].func = sub_81B1C1C; } } @@ -3828,7 +3846,7 @@ void sub_81B4A08(u8 taskId) void sub_81B4A6C(u8 taskId) { PlaySE(SE_SELECT); - gUnknown_0203CEC4->unk4 = sub_81B4A98; + gUnknown_0203CEC4->exitCallback = sub_81B4A98; sub_81B12C0(taskId); } @@ -3840,7 +3858,7 @@ void sub_81B4A98(void) void sub_81B4AE0(void) { gPaletteFade.bufferTransferDisabled = TRUE; - sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.unk0); + InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.exitCallback); } void brm_take_2(u8 taskId) @@ -3977,7 +3995,7 @@ void sub_81B4E8C(u8 taskId) { PlaySE(SE_SELECT); gSelectedOrderFromParty[i] = gUnknown_0203CEC8.unk9 + 1; - sub_81B2FA8(i + 2, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + DisplayPartyPokemonOtherText(i + 2, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); if (i == (unk - 1)) sub_81B4F88(); display_pokemon_menu_message(0); @@ -4018,11 +4036,11 @@ void sub_81B4FA8(u8 taskId) break; } } - sub_81B2FA8(1, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + DisplayPartyPokemonOtherText(1, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); for (i = 0; i < (unk - 1); i++) { if (gSelectedOrderFromParty[i] != 0) - sub_81B2FA8(i + 2, &gUnknown_0203CEDC[gSelectedOrderFromParty[i] - 1], 1); + DisplayPartyPokemonOtherText(i + 2, &gUnknown_0203CEDC[gSelectedOrderFromParty[i] - 1], 1); } display_pokemon_menu_message(0); gTasks[taskId].func = sub_81B1370; @@ -4178,21 +4196,21 @@ void sub_81B5470(u8 taskId) sub_81245DC(gStringVar1, mapHeader->regionMapSectionId); StringExpandPlaceholders(gStringVar4, gText_ReturnToHealingSpot); sub_81B5674(taskId); - gUnknown_0203CEC4->unk218[0] = fieldMove; + gUnknown_0203CEC4->data[0] = fieldMove; break; case 4: mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum); sub_81245DC(gStringVar1, mapHeader->regionMapSectionId); StringExpandPlaceholders(gStringVar4, gText_EscapeFromHere); sub_81B5674(taskId); - gUnknown_0203CEC4->unk218[0] = fieldMove; + gUnknown_0203CEC4->data[0] = fieldMove; break; case 0: - gUnknown_0203CEC8.unk0 = MCB2_FlyMap; + gUnknown_0203CEC8.exitCallback = MCB2_FlyMap; sub_81B12C0(taskId); break; default: - gUnknown_0203CEC8.unk0 = CB2_ReturnToField; + gUnknown_0203CEC8.exitCallback = CB2_ReturnToField; sub_81B12C0(taskId); break; } @@ -4237,7 +4255,7 @@ void sub_81B56D8(u8 taskId) switch (Menu_ProcessInputNoWrapClearOnChoose()) { case 0: - gUnknown_0203CEC8.unk0 = CB2_ReturnToField; + gUnknown_0203CEC8.exitCallback = CB2_ReturnToField; sub_81B12C0(taskId); break; case MENU_B_PRESSED: @@ -4320,7 +4338,7 @@ bool8 sub_81B5884(void) void sub_81B58A8(void) { - sub_81B0038(0, 0, 0, 1, 0, sub_81B1370, CB2_ReturnToFieldWithOpenMenu); + InitPartyMenu(0, 0, 0, 1, 0, sub_81B1370, CB2_ReturnToFieldWithOpenMenu); } void hm2_waterfall(void) @@ -4361,19 +4379,19 @@ bool8 sub_81B5974(void) return FALSE; } -void party_menu_icon_anim(struct Pokemon *mon, struct Unk_203CEDC *ptr, u32 a) +void party_menu_icon_anim(struct Pokemon *mon, struct Struct203CEDC *ptr, u32 a) { u32 bit = 1; u16 species2; - if (sub_81B1250() == TRUE && gMain.inBattle != FALSE) + if (IsMultiBattle() == TRUE && gMain.inBattle != FALSE) bit = (gUnknown_08616020[a] ^ bit) ? 1 : 0; species2 = GetMonData(mon, MON_DATA_SPECIES2); party_menu_link_mon_icon_anim(species2, GetMonData(mon, MON_DATA_PERSONALITY), ptr, 1, bit); sub_81B5B38(ptr->unk9, mon); } -void party_menu_link_mon_icon_anim(u16 species, u32 pid, struct Unk_203CEDC *ptr, u8 priority, u32 bit) +void party_menu_link_mon_icon_anim(u16 species, u32 pid, struct Struct203CEDC *ptr, u8 priority, u32 bit) { if (species != SPECIES_NONE) { @@ -4409,7 +4427,7 @@ void sub_81B5B38(u8 spriteId, struct Pokemon *mon) sub_81B5A8C(spriteId, GetMonData(mon, MON_DATA_HP), GetMonData(mon, MON_DATA_MAX_HP)); } -void sub_81B5B6C(u8 spriteId, u8 a) +void AnimateSelectedPartyIcon(u8 spriteId, u8 a) { gSprites[spriteId].data[0] = 0; if (a == 0) @@ -4424,17 +4442,17 @@ void sub_81B5B6C(u8 spriteId, u8 a) gSprites[spriteId].pos2.x = -4; gSprites[spriteId].pos2.y = 0; } - gSprites[spriteId].callback = sub_81B5C08; + gSprites[spriteId].callback = UpdatePartyMonIconFrame; } else { gSprites[spriteId].pos2.x = 0; gSprites[spriteId].pos2.y = 0; - gSprites[spriteId].callback = sub_81B5BDC; + gSprites[spriteId].callback = UpdatePartyMonIconFrameAndBounce; } } -void sub_81B5BDC(struct Sprite *sprite) +void UpdatePartyMonIconFrameAndBounce(struct Sprite *sprite) { u8 unk = UpdateMonIconFrame(sprite); @@ -4447,12 +4465,12 @@ void sub_81B5BDC(struct Sprite *sprite) } } -void sub_81B5C08(struct Sprite *sprite) +void UpdatePartyMonIconFrame(struct Sprite *sprite) { UpdateMonIconFrame(sprite); } -void party_menu_held_item_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) +void party_menu_held_item_object(struct Pokemon *mon, struct Struct203CEDC *ptr) { if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { @@ -4461,7 +4479,7 @@ void party_menu_held_item_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) } } -void party_menu_link_mon_held_item_object(u16 species, u16 item, struct Unk_203CEDC *ptr) +void party_menu_link_mon_held_item_object(u16 species, u16 item, struct Struct203CEDC *ptr) { if (species != SPECIES_NONE) { @@ -4471,12 +4489,12 @@ void party_menu_link_mon_held_item_object(u16 species, u16 item, struct Unk_203C } } -void sub_81B5C94(struct Pokemon *mon, struct Unk_203CEDC *ptr) +void sub_81B5C94(struct Pokemon *mon, struct Struct203CEDC *ptr) { sub_81B5CB0(GetMonData(mon, MON_DATA_HELD_ITEM), ptr); } -void sub_81B5CB0(u16 item, struct Unk_203CEDC *ptr) +void sub_81B5CB0(u16 item, struct Struct203CEDC *ptr) { if (item == ITEM_NONE) { @@ -4492,7 +4510,7 @@ void sub_81B5CB0(u16 item, struct Unk_203CEDC *ptr) } } -void sub_81B5D30(void) +void LoadHeldItemIcons(void) { LoadSpriteSheet(&gUnknown_08615EB0); LoadSpritePalette(&gUnknown_08615EB8); @@ -4553,13 +4571,13 @@ void sub_81B5E74(struct Sprite *sprite) } } -void party_menu_pokeball_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) +void party_menu_pokeball_object(struct Pokemon *mon, struct Struct203CEDC *ptr) { if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) ptr->unkB = CreateSprite(&gSpriteTemplate_8615F08, ptr->unk4[6], ptr->unk4[7], 8); } -void party_menu_link_mon_pokeball_object(u16 species, struct Unk_203CEDC *ptr) +void party_menu_link_mon_pokeball_object(u16 species, struct Struct203CEDC *ptr) { if (species != SPECIES_NONE) { @@ -4604,14 +4622,14 @@ void sub_81B5FBC(u8 spriteId, u8 spriteId2, u8 a) } } -void sub_81B6040(void) +void LoadPartyMenuPokeballGfx(void) { LoadCompressedObjectPic(&gUnknown_08615EF8); LoadCompressedObjectPic(&gUnknown_08615F70); LoadCompressedObjectPalette(&gUnknown_08615F00); } -void party_menu_status_condition_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) +void party_menu_status_condition_object(struct Pokemon *mon, struct Struct203CEDC *ptr) { if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { @@ -4620,7 +4638,7 @@ void party_menu_status_condition_object(struct Pokemon *mon, struct Unk_203CEDC } } -void party_menu_link_mon_status_condition_object(u16 species, u8 status, struct Unk_203CEDC *ptr) +void party_menu_link_mon_status_condition_object(u16 species, u8 status, struct Struct203CEDC *ptr) { if (species != SPECIES_NONE) { @@ -4630,12 +4648,12 @@ void party_menu_link_mon_status_condition_object(u16 species, u8 status, struct } } -void party_menu_get_status_condition_and_update_object(struct Pokemon *mon, struct Unk_203CEDC *ptr) +void party_menu_get_status_condition_and_update_object(struct Pokemon *mon, struct Struct203CEDC *ptr) { party_menu_update_status_condition_object(sub_81B205C(mon), ptr); } -void party_menu_update_status_condition_object(u8 status, struct Unk_203CEDC *ptr) +void party_menu_update_status_condition_object(u8 status, struct Struct203CEDC *ptr) { switch (status) { @@ -4650,7 +4668,7 @@ void party_menu_update_status_condition_object(u8 status, struct Unk_203CEDC *pt } } -void sub_81B6160(void) +void LoadPartyMenuAilmentGfx(void) { LoadCompressedObjectPic(&gUnknown_08615FF8); LoadCompressedObjectPalette(&gUnknown_08616000); @@ -4694,7 +4712,7 @@ void sub_81B617C(void) msgIDMaybe = (GetPocketByItemId(gSpecialVar_ItemId) == POCKET_TM_HM) ? 4 : 5; task = sub_81B1370; } - sub_81B0038(inBattle, doubleBattleStatus, 3, 1, msgIDMaybe, task, callback); + InitPartyMenu(inBattle, doubleBattleStatus, 3, 1, msgIDMaybe, task, callback); } void c2_815ABFC(void) @@ -4710,7 +4728,7 @@ void sub_81B6280(u8 taskId) if (!gPaletteFade.active) { if (gUnknown_0203CEC8.unk8_0 == 1) - gUnknown_0203CEC4->unk4 = sub_81B9140; + gUnknown_0203CEC4->exitCallback = sub_81B9140; gUnknown_03006328(taskId, sub_81B6794); } } @@ -4859,7 +4877,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task) } party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); if (gSprites[gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unkC].invisible != FALSE) - sub_81B2AC8(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + DisplayPartyPokemonLevelCheck(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); if (canHeal == TRUE) { if (hp == 0) @@ -4893,7 +4911,7 @@ void sub_81B6794(u8 taskId) if (sub_81B1BD4() != TRUE) { if (gUnknown_0203CEE8 == 0) - gUnknown_0203CEC4->unk4 = NULL; + gUnknown_0203CEC4->exitCallback = NULL; sub_81B12C0(taskId); } } @@ -5059,7 +5077,7 @@ void ether_effect_related_2(u8 taskId) void sub_81B6BB4(u8 taskId) { gTasks[taskId].func = sub_81B1370; - gUnknown_0203CEC4->unk4 = NULL; + gUnknown_0203CEC4->exitCallback = NULL; sub_81B302C(&gUnknown_0203CEC4->unkC[0]); display_pokemon_menu_message(5); } @@ -5162,12 +5180,12 @@ void sub_81B6DC4(u8 taskId, TaskFunc unused) move[0] = ItemIdToBattleMoveId(item); StringCopy(gStringVar2, gMoveNames[move[0]]); move[1] = 0; - switch (sub_81B22D8(mon, item, 0)) + switch (CanPartyPokemonLearnTMTutor(mon, item, 0)) { - case 1: + case CANNOT_LEARN_MOVE: sub_81B6D98(taskId, gText_PkmnCantLearnMove); return; - case 2: + case ALREADY_KNOWS_MOVE: sub_81B6D98(taskId, gText_PkmnAlreadyKnows); return; } @@ -5255,7 +5273,7 @@ void sub_81B7088(u8 taskId) { if (sub_81B1BD4() != TRUE) { - gUnknown_0203CEC4->unk4 = sub_81B70B8; + gUnknown_0203CEC4->exitCallback = sub_81B70B8; sub_81B12C0(taskId); } } @@ -5267,7 +5285,7 @@ void sub_81B70B8(void) void sub_81B70F0(void) { - sub_81B0038(0, 0, 0, 1, 0x7F, sub_81B711C, gUnknown_0203CEC8.unk0); + InitPartyMenu(0, 0, 0, 1, 0x7F, sub_81B711C, gUnknown_0203CEC8.exitCallback); } void sub_81B711C(u8 taskId) @@ -5367,8 +5385,8 @@ void sub_81B73E4(u8 taskId) void dp05_rare_candy(u8 taskId, TaskFunc task) { struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; - struct Unk_203CEC4 *ptr = gUnknown_0203CEC4; - s16 *arrayPtr = ptr->unk218; + struct Struct203CEC4 *ptr = gUnknown_0203CEC4; + s16 *arrayPtr = ptr->data; u16 *itemPtr = &gSpecialVar_ItemId; bool8 cannotUseEffect; @@ -5376,7 +5394,7 @@ void dp05_rare_candy(u8 taskId, TaskFunc task) { sub_81B79A0(mon, arrayPtr); cannotUseEffect = ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, *itemPtr, 0); - sub_81B79A0(mon, &ptr->unk218[6]); + sub_81B79A0(mon, &ptr->data[6]); } else { @@ -5409,10 +5427,10 @@ void sub_81B754C(u8 slot, struct Pokemon *mon) { party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[slot]); if (gSprites[gUnknown_0203CEDC[slot].unkC].invisible != FALSE) - sub_81B2AC8(mon, &gUnknown_0203CEDC[slot], 1); - sub_81B2CD4(mon, &gUnknown_0203CEDC[slot], 1); - sub_81B2D74(mon, &gUnknown_0203CEDC[slot], 1); - sub_81B2E28(mon, &gUnknown_0203CEDC[slot]); + DisplayPartyPokemonLevelCheck(mon, &gUnknown_0203CEDC[slot], 1); + DisplayPartyPokemonHPCheck(mon, &gUnknown_0203CEDC[slot], 1); + DisplayPartyPokemonMaxHPCheck(mon, &gUnknown_0203CEDC[slot], 1); + DisplayPartyPokemonHPBarCheck(mon, &gUnknown_0203CEDC[slot]); sub_81B5B38(gUnknown_0203CEDC[slot].unk9, mon); sub_81B0FCC(slot, 1); schedule_bg_copy_tilemap_to_vram(0); @@ -5440,7 +5458,7 @@ void sub_81B7634(u8 taskId) void sub_81B767C(u8 taskId) { - s16 *arrayPtr = gUnknown_0203CEC4->unk218; + s16 *arrayPtr = gUnknown_0203CEC4->data; arrayPtr[12] = sub_81B3364(); sub_81D3640(arrayPtr[12], arrayPtr, &arrayPtr[6], 1, 2, 3); @@ -5450,7 +5468,7 @@ void sub_81B767C(u8 taskId) void sub_81B76C8(u8 taskIdUnused) { - s16 *arrayPtr = gUnknown_0203CEC4->unk218; + s16 *arrayPtr = gUnknown_0203CEC4->data; sub_81D3784(arrayPtr[12], &arrayPtr[6], 1, 2, 3); CopyWindowToVram(arrayPtr[12], 2); @@ -5511,8 +5529,8 @@ void sub_81B7810(u8 taskId) if (targetSpecies != SPECIES_NONE) { - sub_81B06F4(); - gCB2_AfterEvolution = gUnknown_0203CEC8.unk0; + FreePartyPointers(); + gCB2_AfterEvolution = gUnknown_0203CEC8.exitCallback; BeginEvolutionScene(mon, targetSpecies, 1, gUnknown_0203CEC8.unk9); DestroyTask(taskId); } @@ -5556,9 +5574,9 @@ void sub_81B79A0(struct Pokemon *mon, s16 *data) void sub_81B79E8(u8 taskId, TaskFunc unused) { - gUnknown_0203CEC4->unk218[0] = 0; - gUnknown_0203CEC4->unk218[1] = 0; - gUnknown_0203CEC4->unk218[2] = gUnknown_0203CEC8.unk9; + gUnknown_0203CEC4->data[0] = 0; + gUnknown_0203CEC4->data[1] = 0; + gUnknown_0203CEC4->data[2] = gUnknown_0203CEC8.unk9; sub_81B7A28(taskId); } @@ -5585,13 +5603,13 @@ void sub_81B7A28(u8 taskId) PlaySE(SE_KAIFUKU); party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); if (gSprites[gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unkC].invisible != FALSE) - sub_81B2AC8(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); - sub_81B0FCC(gUnknown_0203CEC4->unk218[2], 0); + DisplayPartyPokemonLevelCheck(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + sub_81B0FCC(gUnknown_0203CEC4->data[2], 0); sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); sub_81B1F18(taskId, gUnknown_0203CEC8.unk9, 1, GetMonData(mon, MON_DATA_HP) - hp, sub_81B7C10); sub_81B1FA8(taskId, 0, hp); - gUnknown_0203CEC4->unk218[0] = 1; - gUnknown_0203CEC4->unk218[1] = 1; + gUnknown_0203CEC4->data[0] = 1; + gUnknown_0203CEC4->data[1] = 1; } #else NAKED @@ -5669,7 +5687,7 @@ _081B7A94:\n\ adds r0, r5, 0\n\ adds r1, r3, 0\n\ movs r2, 0x1\n\ - bl sub_81B2AC8\n\ + bl DisplayPartyPokemonLevelCheck\n\ _081B7AD6:\n\ ldr r4, =gUnknown_0203CEC4\n\ ldr r0, [r4]\n\ @@ -5723,14 +5741,14 @@ void task_sacred_ash_party_loop(u8 taskId) { if (sub_81B1BD4() != TRUE) { - if (gUnknown_0203CEC4->unk218[0] == 1) + if (gUnknown_0203CEC4->data[0] == 1) { - gUnknown_0203CEC4->unk218[0] = 0; - gUnknown_0203CEC4->unk218[2] = gUnknown_0203CEC8.unk9; + gUnknown_0203CEC4->data[0] = 0; + gUnknown_0203CEC4->data[2] = gUnknown_0203CEC8.unk9; } if (++(gUnknown_0203CEC8.unk9) == PARTY_SIZE) { - if (gUnknown_0203CEC4->unk218[1] == 0) + if (gUnknown_0203CEC4->data[1] == 0) { gUnknown_0203CEE8 = 0; sub_81B1B5C(gText_WontHaveEffect, 1); @@ -5763,7 +5781,7 @@ void sub_81B7C10(u8 taskId) void sub_81B7C74(u8 taskId, TaskFunc task) { PlaySE(SE_SELECT); - gCB2_AfterEvolution = gUnknown_0203CEC8.unk0; + gCB2_AfterEvolution = gUnknown_0203CEC8.exitCallback; if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, gSpecialVar_ItemId, 0) != FALSE) { gUnknown_0203CEE8 = 0; @@ -5774,7 +5792,7 @@ void sub_81B7C74(u8 taskId, TaskFunc task) else { RemoveBagItem(gSpecialVar_ItemId, 1); - sub_81B06F4(); + FreePartyPointers(); } } @@ -6006,12 +6024,12 @@ void sub_81B7E4C(u8 taskId) gUnknown_0203CEC8.unkE = sub_81B2360(gSpecialVar_0x8005); StringCopy(gStringVar2, gMoveNames[gUnknown_0203CEC8.unkE]); move[1] = 2; - switch (sub_81B22D8(mon, 0, gSpecialVar_0x8005)) + switch (CanPartyPokemonLearnTMTutor(mon, 0, gSpecialVar_0x8005)) { - case 1: + case CANNOT_LEARN_MOVE: sub_81B6D98(taskId, gText_PkmnCantLearnMove); return; - case 2: + case ALREADY_KNOWS_MOVE: sub_81B6D98(taskId, gText_PkmnAlreadyKnows); return; default: @@ -6029,13 +6047,13 @@ void sub_81B7E4C(u8 taskId) void CB2_PartyMenuFromStartMenu(void) { - sub_81B0038(0, 0, 0, 0, 0, sub_81B1370, CB2_ReturnToFieldWithOpenMenu); + InitPartyMenu(0, 0, 0, 0, 0, sub_81B1370, CB2_ReturnToFieldWithOpenMenu); } void sub_81B7F60(void) { MainCallback callback = (InBattlePyramid() == FALSE) ? c2_815ABFC : sub_81C4F84; - sub_81B0038(0, 0, 5, 0, 6, sub_81B1370, callback); + InitPartyMenu(0, 0, 5, 0, 6, sub_81B1370, callback); gUnknown_0203CEC8.unkC = gSpecialVar_ItemId; } @@ -6062,7 +6080,7 @@ void sub_81B8044(u8 taskId) if (ItemIsMail(gUnknown_0203CEC8.unkC) != FALSE) { sub_81B83F0(gUnknown_0203CEC8.unkC); - gUnknown_0203CEC4->unk4 = sub_81B814C; + gUnknown_0203CEC4->exitCallback = sub_81B814C; sub_81B12C0(taskId); } else @@ -6116,11 +6134,11 @@ void sub_81B81A8(void) SetMonData(mon, MON_DATA_HELD_ITEM, &gUnknown_0203CEFC); RemoveBagItem(gUnknown_0203CEFC, 1); sub_81B841C(item); - SetMainCallback2(gUnknown_0203CEC8.unk0); + SetMainCallback2(gUnknown_0203CEC8.exitCallback); } else { - sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B8230, gUnknown_0203CEC8.unk0); + InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B8230, gUnknown_0203CEC8.exitCallback); } } @@ -6163,7 +6181,7 @@ void sub_81B82D4(u8 taskId) } else if (ItemIsMail(item) != FALSE) { - gUnknown_0203CEC4->unk4 = sub_81B814C; + gUnknown_0203CEC4->exitCallback = sub_81B814C; sub_81B12C0(taskId); } else @@ -6206,7 +6224,7 @@ bool8 sub_81B841C(u16 item) void sub_81B8448(void) { - sub_81B0038(0, 0, 7, 0, 6, sub_81B1370, Mailbox_ReturnToMailListAfterDeposit); + InitPartyMenu(0, 0, 7, 0, 6, sub_81B1370, Mailbox_ReturnToMailListAfterDeposit); } void sub_81B8474(u8 taskId) @@ -6233,7 +6251,7 @@ void sub_81B8474(u8 taskId) void sub_81B8518(u8 unused) { sub_81B8558(); - sub_81B0038(4, 0, 0, 0, 0, sub_81B1370, gMain.savedCallback); + InitPartyMenu(4, 0, 0, 0, 0, sub_81B1370, gMain.savedCallback); gUnknown_0203CEC8.unk4 = sub_81B879C; } @@ -6244,14 +6262,14 @@ void sub_81B8558(void) u8 sub_81B856C(s8 slot) { - if (sub_81B85AC(&gPlayerParty[slot]) == FALSE) + if (GetBattleEntryEligibility(&gPlayerParty[slot]) == FALSE) return 2; if (sub_81B8770(slot + 1) == TRUE) return 1; return 0; } -bool8 sub_81B85AC(struct Pokemon *mon) +bool8 GetBattleEntryEligibility(struct Pokemon *mon) { u16 i = 0; u16 species; @@ -6546,38 +6564,38 @@ const u8* sub_81B88BC(void) void sub_81B8904(u8 initArg, MainCallback callback) { - sub_81B0038(initArg, 0, 0, 0, 0, sub_81B1370, callback); + InitPartyMenu(initArg, 0, 0, 0, 0, sub_81B1370, callback); } void sub_81B892C(void) { - sub_81B0038(0, 0, 12, 0, 4, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic); + InitPartyMenu(0, 0, 12, 0, 4, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic); } void sub_81B8958(void) { - sub_81B0038(11, 0, 13, 0, 1, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic); + InitPartyMenu(11, 0, 13, 0, 1, sub_81B1370, CB2_ReturnToFieldContinueScriptPlayMapMusic); } u8 sub_81B8984(void) { if (IsDoubleBattle() == FALSE) return 0; - if (sub_81B1250() == TRUE) + if (IsMultiBattle() == TRUE) return 2; return 1; } void OpenPartyMenuInBattle(u8 arg) { - sub_81B0038(1, sub_81B8984(), arg, 0, 0, sub_81B1370, SetCB2ToReshowScreenAfterMenu); + InitPartyMenu(1, sub_81B8984(), arg, 0, 0, sub_81B1370, SetCB2ToReshowScreenAfterMenu); nullsub_35(); pokemon_change_order(); } void sub_81B89F0(void) { - sub_81B0038(1, sub_81B8984(), 3, 0, 5, sub_81B1370, c2_815ABFC); + InitPartyMenu(1, sub_81B8984(), 3, 0, 5, sub_81B1370, c2_815ABFC); nullsub_35(); pokemon_change_order(); } @@ -6601,7 +6619,7 @@ bool8 sub_81B8A7C(void) u8 i; u8 neededToMatch; - if (sub_81B1250() == TRUE && (slot == 1 || slot == 4 || slot == 5)) + if (IsMultiBattle() == TRUE && (slot == 1 || slot == 4 || slot == 5)) { StringCopy(gStringVar1, GetTrainerPartnerName()); StringExpandPlaceholders(gStringVar4, gText_CantSwitchWithAlly); @@ -6652,3 +6670,562 @@ bool8 sub_81B8A7C(void) sub_81B1288(&gPlayerParty[newSlot], &gPlayerParty[slot]); return TRUE; } + +void sub_81B8C68(void) +{ + sub_81B8C88(gUnknown_0203CF00, sub_806D7EC()); +} + +void sub_81B8C88(u8 *ptr, bool8 multiplayerFlag) +{ + u8 partyIndexes[6]; + int i, j; + + if (IsMultiBattle() == TRUE) + { + if (multiplayerFlag != FALSE) + { + ptr[0] = 0 | (3 << 4); + ptr[1] = 5 | (4 << 4); + ptr[2] = 2 | (1 << 4); + } + else + { + ptr[0] = 3 | (0 << 4); + ptr[1] = 2 | (1 << 4); + ptr[2] = 5 | (4 << 4); + } + return; + } + else if (IsDoubleBattle() == FALSE) + { + j = 1; + partyIndexes[0] = gBattlerPartyIndexes[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]; + for (i = 0; i < PARTY_SIZE; i++) + { + if (i != partyIndexes[0]) + { + partyIndexes[j] = i; + j++; + } + } + } + else + { + j = 2; + partyIndexes[0] = gBattlerPartyIndexes[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]; + partyIndexes[1] = gBattlerPartyIndexes[GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)]; + for (i = 0; i < PARTY_SIZE; i++) + { + if (i != partyIndexes[0] && i != partyIndexes[1]) + { + partyIndexes[j] = i; + j++; + } + } + } + for (i = 0; i < 3; i++) + ptr[i] = (partyIndexes[0 + (i * 2)] << 4) | partyIndexes[1 + (i * 2)]; +} + +void sub_81B8D64(u8 battlerPosition, u8 multiplayerFlag) +{ + sub_81B8D88(gBattleStruct->field_60[battlerPosition], multiplayerFlag, battlerPosition); +} + +void sub_81B8D88(u8 *ptr, bool8 multiplayerFlag, u8 battlerPosition) +{ + u8 partyIndexes[6]; + int i, j; + u8 leftBattler; + u8 rightBattler; + + if (GetBattlerSide(battlerPosition) == B_SIDE_PLAYER) + { + leftBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + rightBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + } + else + { + leftBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + rightBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + } + if (IsMultiBattle() == TRUE) + { + if (multiplayerFlag != FALSE) + { + ptr[0] = 0 | (3 << 4); + ptr[1] = 5 | (4 << 4); + ptr[2] = 2 | (1 << 4); + } + else + { + ptr[0] = 3 | (0 << 4); + ptr[1] = 2 | (1 << 4); + ptr[2] = 5 | (4 << 4); + } + return; + } + else if (IsDoubleBattle() == FALSE) + { + j = 1; + partyIndexes[0] = gBattlerPartyIndexes[leftBattler]; + for (i = 0; i < PARTY_SIZE; i++) + { + if (i != partyIndexes[0]) + { + partyIndexes[j] = i; + j++; + } + } + } + else + { + j = 2; + partyIndexes[0] = gBattlerPartyIndexes[leftBattler]; + partyIndexes[1] = gBattlerPartyIndexes[rightBattler]; + for (i = 0; i < PARTY_SIZE; i++) + { + if (i != partyIndexes[0] && i != partyIndexes[1]) + { + partyIndexes[j] = i; + j++; + } + } + } + for (i = 0; i < 3; i++) + ptr[i] = (partyIndexes[0 + (i * 2)] << 4) | partyIndexes[1 + (i * 2)]; +} + +void sub_81B8E80(u8 battlerPosition, u8 unk, u8 arrayIndex) +{ + u8 possiblePartyIndexes[6]; + u8 unk2 = 0; + int i, j; + u8 *battleStructRelated; + u8 possiblePartyIndexBuffer; + + if (IsMultiBattle() != FALSE) + { + battleStructRelated = gBattleStruct->field_60[battlerPosition]; + for (i = j = 0; i < 3; j++, i++) + { + possiblePartyIndexes[j] = battleStructRelated[i] >> 4; + j++; + possiblePartyIndexes[j] = battleStructRelated[i] & 0xF; + } + possiblePartyIndexBuffer = possiblePartyIndexes[arrayIndex]; + for (i = 0; i < PARTY_SIZE; i++) + { + if (possiblePartyIndexes[i] == unk) + { + unk2 = possiblePartyIndexes[i]; + possiblePartyIndexes[i] = possiblePartyIndexBuffer; + break; + } + } + if (i != PARTY_SIZE) + { + possiblePartyIndexes[arrayIndex] = unk2; + battleStructRelated[0] = (possiblePartyIndexes[0] << 4) | possiblePartyIndexes[1]; + battleStructRelated[1] = (possiblePartyIndexes[2] << 4) | possiblePartyIndexes[3]; + battleStructRelated[2] = (possiblePartyIndexes[4] << 4) | possiblePartyIndexes[5]; + } + } +} + +u8 sub_81B8F38(u8 slot) +{ + u8 modResult = slot & 1; + u8 retVal; + + slot /= 2; + if (modResult != 0) + retVal = gUnknown_0203CF00[slot] & 0xF; + else + retVal = gUnknown_0203CF00[slot] >> 4; + return retVal; +} + +void sub_81B8F6C(u8 slot, u8 setVal) +{ + bool32 modResult = slot & 1; + + slot /= 2; + if (modResult != 0) + gUnknown_0203CF00[slot] = (gUnknown_0203CF00[slot] & 0xF0) | setVal; + else + gUnknown_0203CF00[slot] = (gUnknown_0203CF00[slot] & 0xF) | (setVal << 4); +} + +void sub_81B8FB0(u8 slot, u8 slot2) +{ + u8 valBuffer = sub_81B8F38(slot); + sub_81B8F6C(slot, sub_81B8F38(slot2)); + sub_81B8F6C(slot2, valBuffer); +} + +u8 pokemon_order_func(u8 slot) +{ + u8 i, j; + + for (j = i = 0; i < 3; j++, i++) + { + if ((gUnknown_0203CF00[i] >> 4) != slot) + { + j++; + if ((gUnknown_0203CF00[i] & 0xF) == slot) + return j; + } + else + { + return j; + } + } + return 0; +} + +void pokemon_change_order(void) +{ + struct Pokemon *partyBuffer = Alloc(sizeof(gPlayerParty)); + u8 i; + + memcpy(partyBuffer, gPlayerParty, sizeof(gPlayerParty)); + for (i = 0; i < PARTY_SIZE; i++) + memcpy(&gPlayerParty[pokemon_order_func(i)], &partyBuffer[i], sizeof(struct Pokemon)); + Free(partyBuffer); +} + +void sub_81B9080(void) +{ + struct Pokemon *partyBuffer = Alloc(sizeof(gPlayerParty)); + u8 i; + + memcpy(partyBuffer, gPlayerParty, sizeof(gPlayerParty)); + for (i = 0; i < PARTY_SIZE; i++) + memcpy(&gPlayerParty[sub_81B8F38(i)], &partyBuffer[i], sizeof(struct Pokemon)); + Free(partyBuffer); +} + +void sub_81B90D0(void) +{ + u8 i; + struct Pokemon *mon; + u8 leadVal; + + for (i = 1; i < PARTY_SIZE; i++) + { + mon = &gPlayerParty[sub_81B8F38(i)]; + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE && GetMonData(mon, MON_DATA_HP) != 0) + { + leadVal = sub_81B8F38(0); + sub_81B8FB0(0, i); + sub_81B1288(&gPlayerParty[leadVal], mon); + break; + } + } +} + +void sub_81B9140(void) +{ + SetMainCallback2(SetCB2ToReshowScreenAfterMenu); +} + +void sub_81B9150(void) +{ + InitPartyMenu(5, 3, 0, 0, 0x7F, sub_81B917C, gMain.savedCallback); +} + +void sub_81B917C(u8 taskId) +{ + gTasks[taskId].data[0] = 256; + sub_81B9294(taskId); + ChangeBgX(2, 0x10000, 0); + gTasks[taskId].func = sub_81B91B4; +} + +void sub_81B91B4(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + u8 i; + + if (!gPaletteFade.active) + { + data[0] -= 8; + sub_81B9294(taskId); + if (data[0] == 0) + { + for (i = 3; i < PARTY_SIZE; i++) + { + if (gUnknown_02022FF8[i - 3].species != SPECIES_NONE) + AnimateSelectedPartyIcon(gUnknown_0203CEDC[i].unk9, 0); + } + PlaySE(SE_W231); // Harden SE? + gTasks[taskId].func = sub_81B9240; + } + } +} + +void sub_81B9240(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (++data[0] == 0x100) + sub_81B12C0(taskId); +} + +void sub_81B9270(u8 spriteId, s16 x) +{ + if (x >= 0) + gSprites[spriteId].pos2.x = x; +} + +void sub_81B9294(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + u8 i; + + for (i = 3; i < PARTY_SIZE; i++) + { + if (gUnknown_02022FF8[i - 3].species != SPECIES_NONE) + { + sub_81B9270(gUnknown_0203CEDC[i].unk9, data[0] - 8); + sub_81B9270(gUnknown_0203CEDC[i].unkA, data[0] - 8); + sub_81B9270(gUnknown_0203CEDC[i].unkB, data[0] - 8); + sub_81B9270(gUnknown_0203CEDC[i].unkC, data[0] - 8); + } + } + ChangeBgX(2, 0x800, 1); +} + +void sub_81B9328(void) +{ + InitPartyMenu(6, 0, 0, 0, 15, sub_81B1370, sub_81B9390); +} + +void sub_81B9354(u8 arg1) +{ + gFieldCallback2 = hm_add_c3_without_phase_2; + InitPartyMenu(arg1, 0, 11, 0, 0, sub_81B1370, CB2_ReturnToField); +} + +void sub_81B9390(void) +{ + gSpecialVar_0x8004 = GetCursorSelectionMonId(); + if (gSpecialVar_0x8004 >= PARTY_SIZE) + gSpecialVar_0x8004 = 0xFF; + gFieldCallback2 = hm_add_c3_without_phase_2; + SetMainCallback2(CB2_ReturnToField); +} + +bool8 hm_add_c3_without_phase_2(void) // might not be bool +{ + pal_fill_black(); + CreateTask(task_hm_without_phase_2, 10); + return TRUE; +} + +void task_hm_without_phase_2(u8 taskId) +{ + if (IsWeatherNotFadingIn() != FALSE) + { + DestroyTask(taskId); + ScriptContext2_Disable(); + EnableBothScriptContexts(); + } +} + +void sub_81B9404(void) +{ + ScriptContext2_Enable(); + FadeScreen(FADE_TO_BLACK, 0); + CreateTask(sub_81B9424, 10); +} + +void sub_81B9424(u8 taskId) +{ + if (!gPaletteFade.active) + { + overworld_free_bg_tilemaps(); + InitPartyMenu(2, 0, 11, 0, 0, sub_81B1370, sub_81B9470); + DestroyTask(taskId); + } +} + +void sub_81B9470(void) +{ + gUnknown_02039F24 = GetCursorSelectionMonId(); + if (gUnknown_02039F24 >= PARTY_SIZE) + gUnknown_02039F24 = 0xFF; + gSpecialVar_0x8004 = gUnknown_02039F24; + gFieldCallback2 = hm_add_c3_without_phase_2; + SetMainCallback2(CB2_ReturnToField); +} + +void sub_81B94B0(void) +{ + ScriptContext2_Enable(); + FadeScreen(FADE_TO_BLACK, 0); + CreateTask(sub_81B94D0, 10); +} + +void sub_81B94D0(u8 taskId) +{ + if (!gPaletteFade.active) + { + overworld_free_bg_tilemaps(); + InitPartyMenu(3, 0, 11, 0, 0, sub_81B1370, sub_81B9390); + DestroyTask(taskId); + } +} + +void sub_81B951C(void) +{ + ScriptContext2_Enable(); + FadeScreen(FADE_TO_BLACK, 0); + CreateTask(sub_81B953C, 10); +} + +void sub_81B953C(u8 taskId) +{ + if (!gPaletteFade.active) + { + overworld_free_bg_tilemaps(); + InitPartyMenu(7, 0, 11, 0, 0, sub_81B1370, sub_81B9588); + DestroyTask(taskId); + } +} + +void sub_81B9588(void) +{ + gSpecialVar_0x8004 = GetCursorSelectionMonId(); + if (gSpecialVar_0x8004 >= PARTY_SIZE) + gSpecialVar_0x8004 = 0xFF; + else + gSpecialVar_0x8005 = GetNumberOfRelearnableMoves(&gPlayerParty[gSpecialVar_0x8004]); + gFieldCallback2 = hm_add_c3_without_phase_2; + SetMainCallback2(CB2_ReturnToField); +} + +void sub_81B95E0(void) +{ + u8 i; + + gSpecialVar_Result = FALSE; + for (i = 0; i < 3; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) != ITEM_NONE) + { + gSpecialVar_Result = TRUE; + break; + } + } +} + +void sub_81B9620(void) +{ + ScriptContext2_Enable(); + FadeScreen(FADE_TO_BLACK, 0); + CreateTask(sub_81B9640, 10); +} + +void sub_81B9640(u8 taskId) +{ + if (!gPaletteFade.active) + { + overworld_free_bg_tilemaps(); + InitPartyMenu(12, 0, 0, 0, 0, sub_81B1370, sub_81B9390); + DestroyTask(taskId); + } +} + +void sub_81B968C(void) +{ + ShowPokemonSummaryScreen(PSS_MODE_SELECT_MOVE, gPlayerParty, gSpecialVar_0x8004, gPlayerPartyCount - 1, CB2_ReturnToField); + gFieldCallback = sub_80AF168; +} + +void sub_81B96D0(void) +{ + u8 i; + + gSpecialVar_Result = 0; + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_MOVE1 + i) != ITEM_NONE) + gSpecialVar_Result++; + } +} + +void sub_81B9718(void) +{ + struct Pokemon *mon = &gPlayerParty[gSpecialVar_0x8004]; + u16 move = GetMonData(mon, MON_DATA_MOVE1 + gSpecialVar_0x8005); + + GetMonNickname(mon, gStringVar1); + StringCopy(gStringVar2, gMoveNames[move]); +} + +void sub_81B9770(void) +{ + u16 i; + + SetMonMoveSlot(&gPlayerParty[gSpecialVar_0x8004], MOVE_NONE, gSpecialVar_0x8005); + RemoveMonPPBonus(&gPlayerParty[gSpecialVar_0x8004], gSpecialVar_0x8005); + for (i = gSpecialVar_0x8005; i < MAX_MON_MOVES - 1; i++) + sub_81B97DC(&gPlayerParty[gSpecialVar_0x8004], i, i + 1); +} + +void sub_81B97DC(struct Pokemon *mon, u8 slotTo, u8 slotFrom) +{ + u16 move1 = GetMonData(mon, MON_DATA_MOVE1 + slotTo); + u16 move0 = GetMonData(mon, MON_DATA_MOVE1 + slotFrom); + u8 pp1 = GetMonData(mon, MON_DATA_PP1 + slotTo); + u8 pp0 = GetMonData(mon, MON_DATA_PP1 + slotFrom); + u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES); + u8 ppBonusMask1 = gUnknown_08329D22[slotTo]; + u8 ppBonusMove1 = (ppBonuses & ppBonusMask1) >> (slotTo * 2); + u8 ppBonusMask2 = gUnknown_08329D22[slotFrom]; + u8 ppBonusMove2 = (ppBonuses & ppBonusMask2) >> (slotFrom * 2); + ppBonuses &= ~ppBonusMask1; + ppBonuses &= ~ppBonusMask2; + ppBonuses |= (ppBonusMove1 << (slotFrom * 2)) + (ppBonusMove2 << (slotTo * 2)); + SetMonData(mon, MON_DATA_MOVE1 + slotTo, &move0); + SetMonData(mon, MON_DATA_MOVE1 + slotFrom, &move1); + SetMonData(mon, MON_DATA_PP1 + slotTo, &pp0); + SetMonData(mon, MON_DATA_PP1 + slotFrom, &pp1); + SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); +} + +void sub_81B98DC(void) +{ + if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_IS_EGG) != FALSE) + gSpecialVar_Result = TRUE; + else + gSpecialVar_Result = FALSE; +} + +void sub_81B9918(void) +{ + u16 move; + u32 i, j; + + gSpecialVar_Result = FALSE; + move = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_MOVE1 + gSpecialVar_0x8005); + if (move == MOVE_SURF) + { + for (i = 0; i < CalculatePlayerPartyCount(); i++) + { + if (i != gSpecialVar_0x8004) + { + for (j = 0; j < MAX_MON_MOVES; j++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j) == MOVE_SURF) + return; + } + } + } + if (sub_80D23A8(move) != TRUE) + gSpecialVar_Result = TRUE; + } +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index f1c248a1a..36cd3d249 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -129,7 +129,7 @@ struct UnkStruct_61CC04 }; // forward declarations -bool8 sub_81B1250(void); +bool8 IsMultiBattle(void); static bool8 SummaryScreen_LoadGraphics(void); static void SummaryScreen_LoadingCB2(void); static void InitBGs(void); @@ -1500,7 +1500,7 @@ static void sub_81C0604(u8 taskId, s8 a) } r4_2 = sub_80D214C(pssData->monList.boxMons, pssData->curMonIndex, pssData->maxMonIndex, a); } - else if (sub_81B1250() == 1) + else if (IsMultiBattle() == 1) { r4_2 = sub_81C09B4(a); } @@ -3254,7 +3254,7 @@ static void PrintHeldItemName(void) const u8 *text; int offset; - if (pssData->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == TRUE && (pssData->curMonIndex == 1 || pssData->curMonIndex == 4 || pssData->curMonIndex == 5)) + if (pssData->summary.item == ITEM_ENIGMA_BERRY && IsMultiBattle() == TRUE && (pssData->curMonIndex == 1 || pssData->curMonIndex == 4 || pssData->curMonIndex == 5)) { text = ItemId_GetName(ITEM_ENIGMA_BERRY); } diff --git a/sym_ewram.txt b/sym_ewram.txt index f386e9da1..e9a9cbf9c 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -362,49 +362,7 @@ gUnknown_0203CD88: @ 203CD88 .include "src/list_menu.o" .include "src/dynamic_placeholder_text_util.o" .include "src/item_icon.o" - -gUnknown_0203CEC4: @ 203CEC4 - .space 0x4 - -gUnknown_0203CEC8: @ 203CEC8 - .space 0xE - -gUnknown_0203CED6: @ 203CED6 - .space 0x6 - -gUnknown_0203CEDC: @ 203CEDC - .space 0x4 - -gUnknown_0203CEE0: @ 203CEE0 - .space 0x4 - -gUnknown_0203CEE4: @ 203CEE4 - .space 0x4 - -gUnknown_0203CEE8: @ 203CEE8 - .space 0x1 - -gUnknown_0203CEE9: @ 203CEE9 - .space 0x3 - -gPostMenuFieldCallback: @ 203CEEC - .space 0x4 - -gUnknown_0203CEF0: @ 203CEF0 - .space 0x4 - -gUnknown_0203CEF4: @ 203CEF4 - .space 0x4 - -gSelectedOrderFromParty: @ 203CEF8 - .space 0x4 - -gUnknown_0203CEFC: @ 203CEFC - .space 0x4 - -gUnknown_0203CF00: @ 203CF00 - .space 0x4 - + .include "src/party_menu.o" .include "src/fossil_specials.o" .include "src/fldeff_groundshake.o" .include "src/pokemon_summary_screen.o" From 42c5ceef3a019234405e5013d40b5dbd33dbd2e6 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Tue, 18 Dec 2018 05:38:33 -0500 Subject: [PATCH 10/17] finish party_menu, remove asm file --- asm/party_menu.s | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 asm/party_menu.s diff --git a/asm/party_menu.s b/asm/party_menu.s deleted file mode 100644 index 2428f2984..000000000 --- a/asm/party_menu.s +++ /dev/null @@ -1,8 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - .align 2, 0 @ Don't pad with nop. From e771854eae0ec154d125b2171669ca2578997ae3 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 19 Dec 2018 10:51:55 -0500 Subject: [PATCH 11/17] removed commented out attempt --- src/party_menu.c | 65 ------------------------------------------------ 1 file changed, 65 deletions(-) diff --git a/src/party_menu.c b/src/party_menu.c index ce22f2dae..0c21960f9 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -5796,71 +5796,6 @@ void sub_81B7C74(u8 taskId, TaskFunc task) } } -/* u8 GetItemEffectType(u16 item) -{ - const u8 *itemEffect; - - if IS_POKEMON_ITEM(item) - { - if (item == ITEM_ENIGMA_BERRY) - itemEffect = gSaveBlock1Ptr->enigmaBerry.itemEffect; - else - itemEffect = gItemEffectTable[item - ITEM_POTION]; - if ((itemEffect[0] & 0x3F) || itemEffect[1] != 0 || itemEffect[2] != 0 || (itemEffect[3] & 0x80)) - return 0; - if (itemEffect[0] & 0x40) - return 10; - if (itemEffect[3] & 0x40) - return 1; - if ((itemEffect[3] & 0x3F) || (itemEffect[0] >> 7)) - { - if (itemEffect[3] == 0x20) - return 4; - if (itemEffect[3] == 0x10) - return 3; - if (itemEffect[3] == 8) - return 5; - if (itemEffect[3] == 4) - return 6; - if (itemEffect[3] == 2) - return 7; - if (itemEffect[3] == 1) - return 8; - if ((itemEffect[0] >> 7) != 0 && itemEffect[3] == 0) - return 9; - else - return 11; - } - if (itemEffect[4] & 0x44) - return 2; - if (itemEffect[4] & 2) - return 12; - if (itemEffect[4] & 1) - return 13; - if (itemEffect[5] & 8) - return 14; - if (itemEffect[5] & 4) - return 15; - if (itemEffect[5] & 2) - return 16; - if (itemEffect[5] & 1) - return 17; - if (itemEffect[4] & 0x80) - return 18; - if (itemEffect[4] & 0x20) - return 19; - if (itemEffect[5] & 0x10) - return 20; - if (itemEffect[4] & 0x18) - return 21; - return 22; - } - else - { - return 22; - } -} */ - u8 GetItemEffectType(u16 item) { const u8 *itemEffect; From fabbbdd02add1087f0243ffbeac2a79e0f82a98b Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 19 Dec 2018 19:53:52 -0500 Subject: [PATCH 12/17] fix up party_menu --- src/party_menu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/party_menu.c b/src/party_menu.c index 0c21960f9..dc0390889 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -783,7 +783,7 @@ void PartyMenuInitHelperStructs(u8 a) gUnknown_0203CEDC[0].unk0 = &gUnknown_086156C4[0]; if (a == 3) gUnknown_0203CEDC[3].unk0 = &gUnknown_086156C4[0]; - else if (a) + else if (a != 0) gUnknown_0203CEDC[1].unk0 = &gUnknown_086156C4[0]; } @@ -881,15 +881,13 @@ void DisplayPartyPokemonSelectForBattle(u8 slot) } else { - i = 0; - while (i < sub_81B8830()) + for (i = 0; i < sub_81B8830(); i++) { if (ptr[i] != 0 && (ptr[i] - 1) == slot) { DisplayPartyPokemonSelectData(slot, i + 2); return; } - i++; } DisplayPartyPokemonSelectData(slot, 1); } From 085e793460f39ced70416109dc5c0eb1668e17fd Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 19 Dec 2018 19:55:51 -0500 Subject: [PATCH 13/17] one line cleanup in summary_screen --- 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 36cd3d249..fb2a43786 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1500,7 +1500,7 @@ static void sub_81C0604(u8 taskId, s8 a) } r4_2 = sub_80D214C(pssData->monList.boxMons, pssData->curMonIndex, pssData->maxMonIndex, a); } - else if (IsMultiBattle() == 1) + else if (IsMultiBattle() == TRUE) { r4_2 = sub_81C09B4(a); } From 038836d21d6233b776c238510ac1e4ada499d9db Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 19 Dec 2018 20:08:01 -0500 Subject: [PATCH 14/17] pretty sure it's fixed now --- src/party_menu.c | 61 +++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/src/party_menu.c b/src/party_menu.c index dc0390889..a6a67d6eb 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1127,7 +1127,7 @@ u8 GetPartyBoxPalBitfield(u8 slot, u8 b) { u8 returnVar = 0; if (b == 1) - returnVar = 1; + returnVar |= 1; if (GetMonData(&gPlayerParty[slot], MON_DATA_HP) == 0) returnVar |= 2; if (PartyBoxPal_ParnterOrDisqualifiedInArena(slot) == TRUE) @@ -2547,15 +2547,15 @@ void UpdateSelectedPartyBox(struct Struct203CEDC *ptr, u8 bitfield) { u8 palNum = GetWindowAttribute(ptr->windowId, WINDOW_PALETTE_NUM) * 16; - if (0x40 & bitfield) + if (bitfield & 0x40) { LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AF1[0]), gUnknown_08615AC0[0] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AF1[1]), gUnknown_08615AC0[1] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AF1[2]), gUnknown_08615AC0[2] + palNum, 2); } - else if (0x20 & bitfield) + else if (bitfield & 0x20) { - if (1 & bitfield) + if (bitfield & 1) { LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); @@ -2574,7 +2574,7 @@ void UpdateSelectedPartyBox(struct Struct203CEDC *ptr, u8 bitfield) LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); } } - else if (0x10 & bitfield) + else if (bitfield & 0x10) { LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); @@ -2583,9 +2583,9 @@ void UpdateSelectedPartyBox(struct Struct203CEDC *ptr, u8 bitfield) LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); } - else if (4 & bitfield) + else if (bitfield & 4) { - if (1 & bitfield) + if (bitfield & 1) { LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); @@ -2604,9 +2604,9 @@ void UpdateSelectedPartyBox(struct Struct203CEDC *ptr, u8 bitfield) LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); } } - else if (2 & bitfield) + else if (bitfield & 2) { - if (1 & bitfield) + if (bitfield & 1) { LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADC[0]), gUnknown_08615ABA[0] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615ADC[1]), gUnknown_08615ABA[1] + palNum, 2); @@ -2625,9 +2625,9 @@ void UpdateSelectedPartyBox(struct Struct203CEDC *ptr, u8 bitfield) LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE8[2]), gUnknown_08615ABD[2] + palNum, 2); } } - else if (8 & bitfield) + else if (bitfield & 8) { - if (1 & bitfield) + if (bitfield & 1) { LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD9[0]), gUnknown_08615ABA[0] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD9[1]), gUnknown_08615ABA[1] + palNum, 2); @@ -2646,7 +2646,7 @@ void UpdateSelectedPartyBox(struct Struct203CEDC *ptr, u8 bitfield) LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AE5[2]), gUnknown_08615ABD[2] + palNum, 2); } } - else if (1 & bitfield) + else if (bitfield & 1) { LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD6[0]), gUnknown_08615ABA[0] + palNum, 2); LoadPalette(GetPartyMenuPaletteFromBuffer(gUnknown_08615AD6[1]), gUnknown_08615ABA[1] + palNum, 2); @@ -4959,21 +4959,21 @@ void sub_81B67C8(u8 taskId, TaskFunc task) u16 sub_81B691C(struct Pokemon *mon, u8 effectType) { - switch (effectType - 12) + switch (effectType) { - case 1: + case 13: if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_SHEDINJA) return GetMonData(mon, MON_DATA_HP_EV); break; - case 0: + case 12: return GetMonData(mon, MON_DATA_ATK_EV); - case 5: + case 17: return GetMonData(mon, MON_DATA_DEF_EV); - case 4: + case 16: return GetMonData(mon, MON_DATA_SPEED_EV); - case 2: + case 14: return GetMonData(mon, MON_DATA_SPATK_EV); - case 3: + case 15: return GetMonData(mon, MON_DATA_SPDEF_EV); } return 0; @@ -4981,24 +4981,24 @@ u16 sub_81B691C(struct Pokemon *mon, u8 effectType) void option_menu_get_string(u8 effectType, u8 *dest) { - switch (effectType - 12) + switch (effectType) { - case 1: + case 13: StringCopy(dest, gText_HP3); break; - case 0: + case 12: StringCopy(dest, gText_Attack3); break; - case 5: + case 17: StringCopy(dest, gText_Defense3); break; - case 4: + case 16: StringCopy(dest, gText_Speed2); break; - case 2: + case 14: StringCopy(dest, gText_SpAtk3); break; - case 3: + case 15: StringCopy(dest, gText_SpDef3); break; } @@ -5399,7 +5399,7 @@ void dp05_rare_candy(u8 taskId, TaskFunc task) cannotUseEffect = TRUE; } PlaySE(SE_SELECT); - if (cannotUseEffect != FALSE) + if (cannotUseEffect) { gUnknown_0203CEE8 = 0; sub_81B1B5C(gText_WontHaveEffect, 1); @@ -5436,7 +5436,7 @@ void sub_81B754C(u8 slot, struct Pokemon *mon) void sub_81B75D4(u8 taskId) { - if (WaitFanfare(0) != FALSE && sub_81B1BD4() != TRUE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) + if (WaitFanfare(FALSE) != FALSE && sub_81B1BD4() != TRUE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) { PlaySE(SE_SELECT); sub_81B767C(taskId); @@ -6207,7 +6207,10 @@ bool8 GetBattleEntryEligibility(struct Pokemon *mon) u16 i = 0; u16 species; - if (GetMonData(mon, MON_DATA_IS_EGG) != FALSE || GetMonData(mon, MON_DATA_LEVEL) > sub_81B8888() || (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) && gSaveBlock1Ptr->location.mapNum /* possibly dirty cast */ == MAP_NUM(BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) && GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE)) + if (GetMonData(mon, MON_DATA_IS_EGG) != FALSE || GetMonData(mon, MON_DATA_LEVEL) > sub_81B8888() || + (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) && + gSaveBlock1Ptr->location.mapNum == MAP_NUM(BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) && + GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE)) return FALSE; switch (VarGet(VAR_FRONTIER_FACILITY)) // oddly the specific cases are beyond 6, turns out case 9 is apparently related to link battles { From 64d4eed63be657f6eede3c81d3a318ecee3bc36f Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 19 Dec 2018 20:27:44 -0500 Subject: [PATCH 15/17] hidden conversation fixes applied --- src/party_menu.c | 113 ++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 59 deletions(-) diff --git a/src/party_menu.c b/src/party_menu.c index a6a67d6eb..8b46776c5 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1065,7 +1065,7 @@ void sub_81B0F28(void) } else { - if (gUnknown_0203CEC4->unk8_0 != FALSE) + if (gUnknown_0203CEC4->unk8_0) { gUnknown_0203CEC4->unk8_2 = sub_81B5F74(0xBF, 0x88); sub_81B120C(); @@ -2311,7 +2311,7 @@ void sub_81B209C(void) bool16 sub_81B2134(struct Pokemon *mon) { - if (GetMonData(mon, MON_DATA_IS_EGG) != TRUE && sub_802C908(GetMonData(mon, MON_DATA_SPECIES)) != FALSE) + if (GetMonData(mon, MON_DATA_IS_EGG) != TRUE && sub_802C908(GetMonData(mon, MON_DATA_SPECIES))) return TRUE; return FALSE; } @@ -2385,11 +2385,11 @@ u8 CanPartyPokemonLearnTMTutor(struct Pokemon *mon, u16 item, u8 tutor) { u16 move; - if (GetMonData(mon, MON_DATA_IS_EGG) != FALSE) + if (GetMonData(mon, MON_DATA_IS_EGG)) return CANNOT_LEARN_MOVE_IS_EGG; if (item >= ITEM_TM01_FOCUS_PUNCH) { - if (CanMonLearnTMHM(mon, item - 33) != FALSE) + if (CanMonLearnTMHM(mon, item - 33)) move = ItemIdToBattleMoveId(item); else return CANNOT_LEARN_MOVE; @@ -2689,7 +2689,7 @@ void DisplayPartyPokemonLevelCheck(struct Pokemon *mon, struct Struct203CEDC *pt if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { u8 ailment = sub_81B205C(mon); - if (ailment == AILMENT_NONE || ailment == AILMENT_PKRS) + if (ailment == AILMENT_NONE || ailment == AILMENT_PKRS) { if (c != 0) ptr->unk0->unk0(ptr->windowId, ptr->unk0->unk4[4] >> 3, (ptr->unk0->unk4[5] >> 3) + 1, ptr->unk0->unk4[6] >> 3, ptr->unk0->unk4[7] >> 3, 0); @@ -2721,13 +2721,8 @@ void DisplayPartyPokemonGender(u8 gender, u16 species, u8 *nickname, struct Stru { u8 palNum = GetWindowAttribute(ptr->windowId, WINDOW_PALETTE_NUM) * 16; - if (species == SPECIES_NONE) + if (species == SPECIES_NONE || ((species == SPECIES_NIDORAN_M || species == SPECIES_NIDORAN_F) && StringCompare(nickname, gSpeciesNames[species]) == 0)) return; - if (species == SPECIES_NIDORAN_M || species == SPECIES_NIDORAN_F) - { - if (StringCompare(nickname, gSpeciesNames[species]) == 0) - return; - } switch (gender) { case MON_MALE: @@ -2924,22 +2919,22 @@ void display_pokemon_menu_message(u32 stringID) if (stringID != 0x7F) { - switch (stringID - 21) + switch (stringID) { - case 0: + case 21: *windowPtr = AddWindow(&gUnknown_08615928); break; - case 3: + case 24: *windowPtr = AddWindow(&gUnknown_08615930); break; - case 4: + case 25: *windowPtr = AddWindow(&gUnknown_08615938); break; - case 1: - case 2: + case 22: + case 23: *windowPtr = AddWindow(&gUnknown_08615940); break; - case 5: + case 26: *windowPtr = AddWindow(&gUnknown_08615948); break; default: @@ -2948,12 +2943,12 @@ void display_pokemon_menu_message(u32 stringID) } if (stringID == 0) { - if (gUnknown_0203CEC4->unk8_0 != FALSE) + if (gUnknown_0203CEC4->unk8_0) stringID = 2; else if (sub_81B314C() == FALSE) stringID = 1; } - SetWindowBorderStyle(*windowPtr, 0, 0x4F, 0xD); + SetWindowBorderStyle(*windowPtr, FALSE, 0x4F, 0xD); StringExpandPlaceholders(gStringVar4, gUnknown_08615AF4[stringID]); AddTextPrinterParameterized(*windowPtr, 1, gStringVar4, 0, 1, 0, 0); schedule_bg_copy_tilemap_to_vram(2); @@ -2971,7 +2966,7 @@ bool8 sub_81B314C(void) for (i = 0; i < 6; i++) { - if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE && (GetMonData(&party[i], MON_DATA_HP) != 0 || GetMonData(&party[i], MON_DATA_IS_EGG) != FALSE)) + if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE && (GetMonData(&party[i], MON_DATA_HP) != 0 || GetMonData(&party[i], MON_DATA_IS_EGG))) j++; if (j > 1) return TRUE; @@ -3003,7 +2998,7 @@ u8 sub_81B31B0(u8 a) } gUnknown_0203CEC4->unkC[0] = AddWindow(&window); - SetWindowBorderStyle(gUnknown_0203CEC4->unkC[0], 0, 0x4F, 13); + SetWindowBorderStyle(gUnknown_0203CEC4->unkC[0], FALSE, 0x4F, 13); if (a == 3) return gUnknown_0203CEC4->unkC[0]; cursorDimension = GetMenuCursorDimensionByFont(1, 0); @@ -3023,7 +3018,7 @@ u8 sub_81B31B0(u8 a) void sub_81B3300(const u8 *text) { - SetWindowBorderStyle(6, 0, 0x4F, 13); + SetWindowBorderStyle(6, FALSE, 0x4F, 13); gTextFlags.canABSpeedUpPrint = TRUE; AddTextPrinterParameterized2(6, 1, text, GetPlayerTextSpeedDelay(), 0, 2, 1, 3); } @@ -3036,7 +3031,7 @@ void sub_81B334C(void) u8 sub_81B3364(void) { gUnknown_0203CEC4->unkC[0] = AddWindow(&gUnknown_08615970); - SetWindowBorderStyle(gUnknown_0203CEC4->unkC[0], 0, 0x4F, 13); + SetWindowBorderStyle(gUnknown_0203CEC4->unkC[0], FALSE, 0x4F, 13); return gUnknown_0203CEC4->unkC[0]; } @@ -3098,7 +3093,7 @@ u8 sub_81B353C(struct Pokemon *mon) switch (gUnknown_0203CEC8.unk8_0) { case 0: - if (InMultiBattleRoom() == TRUE || GetMonData(mon, MON_DATA_IS_EGG) != FALSE) + if (InMultiBattleRoom() == TRUE || GetMonData(mon, MON_DATA_IS_EGG)) returnVar = 1; else returnVar = 0; @@ -3121,7 +3116,7 @@ u8 sub_81B353C(struct Pokemon *mon) } break; case 6: - returnVar = (GetMonData(mon, MON_DATA_IS_EGG) != FALSE) ? 7 : 6; + returnVar = (GetMonData(mon, MON_DATA_IS_EGG)) ? 7 : 6; break; case 8: returnVar = 10; @@ -3179,7 +3174,7 @@ bool8 sub_81B3608(u8 taskId) void sub_81B36FC(u8 taskId) { - if (sub_81B3608(taskId) != FALSE) + if (sub_81B3608(taskId)) { gTasks[taskId].data[0] = 0xFF; gTasks[taskId].func = sub_81B3730; @@ -3395,10 +3390,10 @@ void sub_81B3B40(const void *rectSrc, s16 a, s16 b, s16 c, s16 d, s16 e) { u8 f, g, h; - if (sub_81B3AD8(a, c, &f, &g, &h) != FALSE) + if (sub_81B3AD8(a, c, &f, &g, &h)) { FillBgTilemapBufferRect_Palette0(0, 0, g, b, h, d); - if (sub_81B3AD8(a + e, c, &f, &g, &h) != FALSE) + if (sub_81B3AD8(a + e, c, &f, &g, &h)) CopyRectToBgTilemapBufferRect(0, rectSrc, f, 0, c, d, g, b, h, d, 17, 0, 0); } } @@ -3591,7 +3586,7 @@ void c2_8123744(void) { InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4350, gUnknown_0203CEC8.exitCallback); } - else if (ItemIsMail(gSpecialVar_ItemId) != FALSE) + else if (ItemIsMail(gSpecialVar_ItemId)) { RemoveBagItem(gSpecialVar_ItemId, 1); sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId); @@ -3649,7 +3644,7 @@ void sub_81B43DC(u8 taskId) sub_81B1B5C(gStringVar4, 0); gTasks[taskId].func = sub_81B1C1C; } - else if (ItemIsMail(gSpecialVar_ItemId) != FALSE) + else if (ItemIsMail(gSpecialVar_ItemId)) { sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId); gTasks[taskId].func = sub_81B44FC; @@ -4321,7 +4316,7 @@ bool8 sub_81B5820(void) void sub_81B5864(void) { - if (TestPlayerAvatarFlags(8) != FALSE) + if (TestPlayerAvatarFlags(8)) display_pokemon_menu_message(9); else display_pokemon_menu_message(8); @@ -4382,7 +4377,7 @@ void party_menu_icon_anim(struct Pokemon *mon, struct Struct203CEDC *ptr, u32 a) u32 bit = 1; u16 species2; - if (IsMultiBattle() == TRUE && gMain.inBattle != FALSE) + if (IsMultiBattle() == TRUE && gMain.inBattle) bit = (gUnknown_08616020[a] ^ bit) ? 1 : 0; species2 = GetMonData(mon, MON_DATA_SPECIES2); party_menu_link_mon_icon_anim(species2, GetMonData(mon, MON_DATA_PERSONALITY), ptr, 1, bit); @@ -4500,7 +4495,7 @@ void sub_81B5CB0(u16 item, struct Struct203CEDC *ptr) } else { - if (ItemIsMail(item) != FALSE) + if (ItemIsMail(item)) StartSpriteAnim(&gSprites[ptr->unkA], 1); else StartSpriteAnim(&gSprites[ptr->unkA], 0); @@ -4557,7 +4552,7 @@ void sub_81B5E74(struct Sprite *sprite) { u8 otherSpriteId = sprite->data[7]; - if (gSprites[otherSpriteId].invisible != FALSE) + if (gSprites[otherSpriteId].invisible) { sprite->invisible = TRUE; } @@ -4681,7 +4676,7 @@ void sub_81B617C(void) u8 msgIDMaybe; register TaskFunc task asm("r0"); - if (gMain.inBattle != FALSE) + if (gMain.inBattle) { inBattle = TRUE; doubleBattleStatus = sub_81B8984(); @@ -4825,7 +4820,7 @@ bool8 IsBlueYellowRedFlute(u16 item) bool8 ExecuteTableBasedItemEffect__(u8 partyMonIndex, u16 item, u8 monMoveIndex) { - if (gMain.inBattle != FALSE) + if (gMain.inBattle) return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, sub_81B8F38(partyMonIndex), monMoveIndex); else return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, partyMonIndex, monMoveIndex); @@ -4838,7 +4833,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task) u16 item = gSpecialVar_ItemId; bool8 canHeal; - if (UsingHPEVItemOnShedinja(mon, item) != FALSE) + if (UsingHPEVItemOnShedinja(mon, item)) { canHeal = IsHPRecoveryItem(item); if (canHeal == TRUE) @@ -4847,7 +4842,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task) if (hp == GetMonData(mon, MON_DATA_MAX_HP)) canHeal = FALSE; } - if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, item, 0) != FALSE) + if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, item, 0)) { iTriedHonestlyIDid: gUnknown_0203CEE8 = 0; @@ -4874,7 +4869,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task) PlaySE(SE_BIDORO); } party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); - if (gSprites[gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unkC].invisible != FALSE) + if (gSprites[gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unkC].invisible) DisplayPartyPokemonLevelCheck(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); if (canHeal == TRUE) { @@ -4925,7 +4920,7 @@ void sub_81B67C8(u8 taskId, TaskFunc task) u16 newFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP); u16 newRelevantEV = sub_81B691C(mon, effectType); - if (cannotUseEffect != FALSE || (friendship == newFriendship && relevantEV == newRelevantEV)) + if (cannotUseEffect || (friendship == newFriendship && relevantEV == newRelevantEV)) { gUnknown_0203CEE8 = 0; PlaySE(SE_SELECT); @@ -5088,7 +5083,7 @@ void ether_effect_related(u8 taskId) struct Struct203CEC8 *ptr = &gUnknown_0203CEC8; struct Pokemon *mon; - if (ExecuteTableBasedItemEffect__(ptr->unk9, item, *moveslot) != FALSE) + if (ExecuteTableBasedItemEffect__(ptr->unk9, item, *moveslot)) { gUnknown_0203CEE8 = 0; PlaySE(SE_SELECT); @@ -5229,7 +5224,7 @@ void sub_81B6F60(u8 taskId) void sub_81B6F98(u8 taskId) { - if (IsFanfareTaskInactive() != FALSE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) + if (IsFanfareTaskInactive() && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) { if (gUnknown_0203CEC8.unk10 == 1) sub_81B77AC(taskId); @@ -5424,7 +5419,7 @@ void dp05_rare_candy(u8 taskId, TaskFunc task) void sub_81B754C(u8 slot, struct Pokemon *mon) { party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[slot]); - if (gSprites[gUnknown_0203CEDC[slot].unkC].invisible != FALSE) + if (gSprites[gUnknown_0203CEDC[slot].unkC].invisible) DisplayPartyPokemonLevelCheck(mon, &gUnknown_0203CEDC[slot], 1); DisplayPartyPokemonHPCheck(mon, &gUnknown_0203CEDC[slot], 1); DisplayPartyPokemonMaxHPCheck(mon, &gUnknown_0203CEDC[slot], 1); @@ -5436,7 +5431,7 @@ void sub_81B754C(u8 slot, struct Pokemon *mon) void sub_81B75D4(u8 taskId) { - if (WaitFanfare(FALSE) != FALSE && sub_81B1BD4() != TRUE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) + if (WaitFanfare(FALSE) && sub_81B1BD4() != TRUE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) { PlaySE(SE_SELECT); sub_81B767C(taskId); @@ -5477,7 +5472,7 @@ void sub_81B7704(u8 taskId) { u16 result; - if (WaitFanfare(0) != FALSE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) + if (WaitFanfare(0) && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))) { sub_81B3394(); result = MonTryLearningNewMove(&gPlayerParty[gUnknown_0203CEC8.unk9], 1); @@ -5587,7 +5582,7 @@ void sub_81B7A28(u8 taskId) if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) { hp = GetMonData(mon, MON_DATA_HP); - if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, gSpecialVar_ItemId, 0) != FALSE) + if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, gSpecialVar_ItemId, 0)) { gTasks[taskId].func = task_sacred_ash_party_loop; return; @@ -5600,7 +5595,7 @@ void sub_81B7A28(u8 taskId) } PlaySE(SE_KAIFUKU); party_menu_get_status_condition_and_update_object(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); - if (gSprites[gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unkC].invisible != FALSE) + if (gSprites[gUnknown_0203CEDC[gUnknown_0203CEC8.unk9].unkC].invisible) DisplayPartyPokemonLevelCheck(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); sub_81B0FCC(gUnknown_0203CEC4->data[2], 0); sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); @@ -5780,7 +5775,7 @@ void sub_81B7C74(u8 taskId, TaskFunc task) { PlaySE(SE_SELECT); gCB2_AfterEvolution = gUnknown_0203CEC8.exitCallback; - if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, gSpecialVar_ItemId, 0) != FALSE) + if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.unk9, gSpecialVar_ItemId, 0)) { gUnknown_0203CEE8 = 0; sub_81B1B5C(gText_WontHaveEffect, 1); @@ -5997,7 +5992,7 @@ void sub_81B7FAC(u8 taskId) { sub_81B8044(taskId); } - else if (ItemIsMail(gUnknown_0203CEFC) != FALSE) + else if (ItemIsMail(gUnknown_0203CEFC)) { sub_81B83B8(taskId); } @@ -6010,7 +6005,7 @@ void sub_81B7FAC(u8 taskId) void sub_81B8044(u8 taskId) { - if (ItemIsMail(gUnknown_0203CEC8.unkC) != FALSE) + if (ItemIsMail(gUnknown_0203CEC8.unkC)) { sub_81B83F0(gUnknown_0203CEC8.unkC); gUnknown_0203CEC4->exitCallback = sub_81B814C; @@ -6112,7 +6107,7 @@ void sub_81B82D4(u8 taskId) sub_81B1B5C(gStringVar4, 0); gTasks[taskId].func = sub_81B8104; } - else if (ItemIsMail(item) != FALSE) + else if (ItemIsMail(item)) { gUnknown_0203CEC4->exitCallback = sub_81B814C; sub_81B12C0(taskId); @@ -6207,7 +6202,7 @@ bool8 GetBattleEntryEligibility(struct Pokemon *mon) u16 i = 0; u16 species; - if (GetMonData(mon, MON_DATA_IS_EGG) != FALSE || GetMonData(mon, MON_DATA_LEVEL) > sub_81B8888() || + if (GetMonData(mon, MON_DATA_IS_EGG) || GetMonData(mon, MON_DATA_LEVEL) > sub_81B8888() || (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY) && GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE)) @@ -6576,7 +6571,7 @@ bool8 sub_81B8A7C(void) return FALSE; } } - if (GetMonData(&gPlayerParty[slot], MON_DATA_IS_EGG) != FALSE) + if (GetMonData(&gPlayerParty[slot], MON_DATA_IS_EGG)) { StringExpandPlaceholders(gStringVar4, gText_EggCantBattle); return FALSE; @@ -6619,7 +6614,7 @@ void sub_81B8C88(u8 *ptr, bool8 multiplayerFlag) if (IsMultiBattle() == TRUE) { - if (multiplayerFlag != FALSE) + if (multiplayerFlag) { ptr[0] = 0 | (3 << 4); ptr[1] = 5 | (4 << 4); @@ -6688,7 +6683,7 @@ void sub_81B8D88(u8 *ptr, bool8 multiplayerFlag, u8 battlerPosition) } if (IsMultiBattle() == TRUE) { - if (multiplayerFlag != FALSE) + if (multiplayerFlag) { ptr[0] = 0 | (3 << 4); ptr[1] = 5 | (4 << 4); @@ -6741,7 +6736,7 @@ void sub_81B8E80(u8 battlerPosition, u8 unk, u8 arrayIndex) u8 *battleStructRelated; u8 possiblePartyIndexBuffer; - if (IsMultiBattle() != FALSE) + if (IsMultiBattle()) { battleStructRelated = gBattleStruct->field_60[battlerPosition]; for (i = j = 0; i < 3; j++, i++) @@ -6963,7 +6958,7 @@ bool8 hm_add_c3_without_phase_2(void) // might not be bool void task_hm_without_phase_2(u8 taskId) { - if (IsWeatherNotFadingIn() != FALSE) + if (IsWeatherNotFadingIn()) { DestroyTask(taskId); ScriptContext2_Disable(); @@ -7135,7 +7130,7 @@ void sub_81B97DC(struct Pokemon *mon, u8 slotTo, u8 slotFrom) void sub_81B98DC(void) { - if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_IS_EGG) != FALSE) + if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_IS_EGG)) gSpecialVar_Result = TRUE; else gSpecialVar_Result = FALSE; From 44fae5a6887a8419eb6887389a0d1fa7bd36e17d Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 19 Dec 2018 20:44:40 -0500 Subject: [PATCH 16/17] add TM constant use --- src/party_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/party_menu.c b/src/party_menu.c index 8b46776c5..b23dd93a7 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2389,7 +2389,7 @@ u8 CanPartyPokemonLearnTMTutor(struct Pokemon *mon, u16 item, u8 tutor) return CANNOT_LEARN_MOVE_IS_EGG; if (item >= ITEM_TM01_FOCUS_PUNCH) { - if (CanMonLearnTMHM(mon, item - 33)) + if (CanMonLearnTMHM(mon, item - ITEM_TM01_FOCUS_PUNCH)) move = ItemIdToBattleMoveId(item); else return CANNOT_LEARN_MOVE; From d6589d1abc29516fe1afe0aed4105d0dabc81778 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 19 Dec 2018 20:50:36 -0500 Subject: [PATCH 17/17] another fix --- src/party_menu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/party_menu.c b/src/party_menu.c index b23dd93a7..f9977fb89 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2721,7 +2721,9 @@ void DisplayPartyPokemonGender(u8 gender, u16 species, u8 *nickname, struct Stru { u8 palNum = GetWindowAttribute(ptr->windowId, WINDOW_PALETTE_NUM) * 16; - if (species == SPECIES_NONE || ((species == SPECIES_NIDORAN_M || species == SPECIES_NIDORAN_F) && StringCompare(nickname, gSpeciesNames[species]) == 0)) + if (species == SPECIES_NONE) + return; + if ((species == SPECIES_NIDORAN_M || species == SPECIES_NIDORAN_F) && StringCompare(nickname, gSpeciesNames[species]) == 0) return; switch (gender) {