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; +}