From 2265d49ac2e8868e0b3362f8e7a4d22355eed202 Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Wed, 12 Dec 2018 22:55:39 -0500 Subject: [PATCH] decompiled up to sub_81B5A8C --- asm/party_menu.s | 2870 ----------------------------------- include/easy_chat.h | 3 + include/fldeff_softboiled.h | 1 + include/item_menu.h | 1 + include/link_rfu.h | 1 + include/pokemon_icon.h | 2 + include/region_map.h | 1 + include/rom_8011DC0.h | 4 + include/strings.h | 16 + include/trade.h | 5 + src/party_menu.c | 953 +++++++++++- 11 files changed, 971 insertions(+), 2886 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index 17ebaab51..cebbff264 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,2876 +5,6 @@ .text - thumb_func_start sub_81B4134 -sub_81B4134: @ 81B4134 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gPlayerParty - ldr r1, =gUnknown_0203CEC8 - ldrb r1, [r1, 0x9] - movs r2, 0x8 - bl sub_81B33B4 - movs r0, 0x1 - bl sub_81B31B0 - movs r0, 0x18 - bl display_pokemon_menu_message - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0xFF - strh r1, [r0, 0x8] - ldr r1, =sub_81B3730 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4134 - - thumb_func_start sub_81B4198 -sub_81B4198: @ 81B4198 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B41C4 - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4198 - - thumb_func_start sub_81B41C4 -sub_81B41C4: @ 81B41C4 - push {lr} - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _081B41E0 - ldr r2, =c2_8123744 - movs r0, 0x2 - movs r1, 0x5 - bl GoToBagMenu - b _081B41E8 - .pool -_081B41E0: - ldr r1, =c2_8123744 - movs r0, 0x2 - bl sub_81C4F98 -_081B41E8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B41C4 - - thumb_func_start c2_8123744 -c2_8123744: @ 81B41F0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - ldr r6, =gSpecialVar_ItemId - ldrh r0, [r6] - cmp r0, 0 - bne _081B4224 - ldr r3, =gUnknown_0203CEC8 - ldrb r0, [r3, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r3, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B36FC - str r1, [sp, 0x4] - ldr r1, [r3] - b _081B425A - .pool -_081B4224: - ldr r4, =gUnknown_0203CEFC - ldr r5, =gUnknown_0203CEC8 - movs r0, 0x9 - ldrsb r0, [r5, r0] - movs r1, 0x64 - mov r8, r1 - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - ldr r7, =gPlayerParty - adds r0, r7 - movs r1, 0xC - bl GetMonData - strh r0, [r4] - lsls r0, 16 - cmp r0, 0 - beq _081B4278 - ldrb r0, [r5, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r5, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B4350 - str r1, [sp, 0x4] - ldr r1, [r5] -_081B425A: - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 - b _081B42C0 - .pool -_081B4278: - ldrh r0, [r6] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B42A4 - ldrh r0, [r6] - movs r1, 0x1 - bl RemoveBagItem - movs r0, 0x9 - ldrsb r0, [r5, r0] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r7 - ldrh r1, [r6] - bl sub_81B1DB8 - bl sub_81B452C - b _081B42C0 -_081B42A4: - ldrb r0, [r5, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r5, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B42D0 - str r1, [sp, 0x4] - ldr r1, [r5] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 -_081B42C0: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end c2_8123744 - - thumb_func_start sub_81B42D0 -sub_81B42D0: @ 81B42D0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B432C - ldr r0, =gSpecialVar_ItemId - ldrh r4, [r0] - ldr r0, =gUnknown_0203CEC8 - mov r8, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0 - bl sub_81B1C84 - mov r1, r8 - movs r0, 0x9 - ldrsb r0, [r1, r0] - muls r0, r6 - adds r0, r5 - adds r1, r4, 0 - bl sub_81B1DB8 - adds r0, r4, 0 - movs r1, 0x1 - bl RemoveBagItem - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - str r1, [r0] -_081B432C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B42D0 - - thumb_func_start sub_81B4350 -sub_81B4350: @ 81B4350 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B4388 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gUnknown_0203CEFC - ldrh r1, [r1] - movs r2, 0x1 - bl sub_81B1D1C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B43A8 - str r1, [r0] -_081B4388: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4350 - - thumb_func_start sub_81B43A8 -sub_81B43A8: @ 81B43A8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B43CC - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B43DC - str r0, [r1] -_081B43CC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B43A8 - - thumb_func_start sub_81B43DC -sub_81B43DC: @ 81B43DC - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B4402 - cmp r1, 0 - bgt _081B43FC - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B44D8 - b _081B44EC -_081B43FC: - cmp r1, 0x1 - beq _081B44DE - b _081B44EC -_081B4402: - ldr r5, =gSpecialVar_ItemId - ldrh r0, [r5] - movs r1, 0x1 - bl RemoveBagItem - ldr r6, =gUnknown_0203CEFC - ldrh r0, [r6] - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - cmp r0, 0 - bne _081B4458 - ldrh r0, [r5] - movs r1, 0x1 - bl AddBagItem - ldrh r0, [r6] - bl pokemon_item_not_removed - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] - b _081B44EC - .pool -_081B4458: - ldrh r0, [r5] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _081B4498 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldrh r1, [r5] - bl sub_81B1DB8 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B44FC - str r1, [r0] - b _081B44EC - .pool -_081B4498: - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldrh r1, [r5] - bl sub_81B1DB8 - ldrh r0, [r5] - ldrh r1, [r6] - movs r2, 0x1 - bl sub_81B1D68 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - str r1, [r0] - b _081B44EC - .pool -_081B44D8: - movs r0, 0x5 - bl PlaySE -_081B44DE: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1C1C - str r0, [r1] -_081B44EC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B43DC - - thumb_func_start sub_81B44FC -sub_81B44FC: @ 81B44FC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B451C - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B452C - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 -_081B451C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B44FC - - thumb_func_start sub_81B452C -sub_81B452C: @ 81B452C - push {lr} - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x40 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSaveBlock1Ptr - lsls r2, r0, 3 - adds r2, r0 - lsls r2, 2 - ldr r0, =0x00002be0 - adds r2, r0 - ldr r1, [r1] - adds r1, r2 - ldr r2, =sub_81B4578 - movs r0, 0x4 - movs r3, 0x3 - bl sub_811A20C - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B452C - - thumb_func_start sub_81B4578 -sub_81B4578: @ 81B4578 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - ldr r6, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r6, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r0, =gSpecialVar_Result - ldrh r7, [r0] - cmp r7, 0 - bne _081B45F8 - adds r0, r5, 0 - bl TakeMailFromMon - ldr r4, =gUnknown_0203CEFC - adds r0, r5, 0 - movs r1, 0xC - adds r2, r4, 0 - bl SetMonData - ldrh r0, [r4] - movs r1, 0x1 - bl RemoveBagItem - mov r0, r8 - movs r1, 0x1 - bl AddBagItem - ldrb r0, [r6, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r6, 0xB] - str r7, [sp] - ldr r1, =sub_81B36FC - str r1, [sp, 0x4] - ldr r1, [r6] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 - b _081B4614 - .pool -_081B45F8: - ldrb r0, [r6, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r6, 0xB] - movs r1, 0x7F - str r1, [sp] - ldr r1, =sub_81B4624 - str r1, [sp, 0x4] - ldr r1, [r6] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 -_081B4614: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4578 - - thumb_func_start sub_81B4624 -sub_81B4624: @ 81B4624 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B468A - ldr r1, =gUnknown_0203CEFC - ldrh r0, [r1] - cmp r0, 0 - bne _081B4670 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gSpecialVar_ItemId - ldrh r1, [r1] - movs r2, 0 - movs r3, 0 - bl sub_81B1C84 - b _081B467C - .pool -_081B4670: - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldrh r1, [r1] - movs r2, 0 - bl sub_81B1D68 -_081B467C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B469C - str r0, [r1] -_081B468A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4624 - - thumb_func_start sub_81B469C -sub_81B469C: @ 81B469C - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r4, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B471C - ldr r5, =gUnknown_0203CEDC - movs r0, 0x9 - ldrsb r0, [r4, r0] - lsls r0, 4 - ldr r1, [r5] - adds r1, r0 - adds r0, r6, 0 - bl sub_81B5C94 - ldrb r1, [r4, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xC - bne _081B4716 - adds r0, r6, 0 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - beq _081B4704 - movs r0, 0x9 - ldrsb r0, [r4, r0] - lsls r0, 4 - ldr r1, [r5] - adds r1, r0 - movs r0, 0xB - movs r2, 0x1 - bl sub_81B2FA8 - b _081B4716 - .pool -_081B4704: - movs r0, 0x9 - ldrsb r0, [r4, r0] - lsls r0, 4 - ldr r1, [r5] - adds r1, r0 - movs r0, 0xC - movs r2, 0x1 - bl sub_81B2FA8 -_081B4716: - adds r0, r7, 0 - bl sub_81B1C1C -_081B471C: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B469C - - thumb_func_start sub_81B4724 -sub_81B4724: @ 81B4724 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r6, r0, 16 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81B1E00 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081B4788 - cmp r0, 0x1 - beq _081B47AC - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x1 - bl sub_81B1CD0 - b _081B47BA - .pool -_081B4788: - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnNotHolding - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - b _081B47B4 - .pool -_081B47AC: - adds r0, r6, 0 - bl pokemon_item_not_removed - ldr r0, =gStringVar4 -_081B47B4: - movs r1, 0x1 - bl sub_81B1B5C -_081B47BA: - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B469C - str r0, [r1] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4724 - - thumb_func_start sub_81B47E0 -sub_81B47E0: @ 81B47E0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r0, r7, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - cmp r5, 0 - bne _081B4864 - ldr r1, =gStringVar1 - adds r0, r7, 0 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnNotHolding - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - b _081B488A - .pool -_081B4864: - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_ThrowAwayItem - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B48A8 -_081B488A: - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B47E0 - - thumb_func_start sub_81B48A8 -sub_81B48A8: @ 81B48A8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B48CC - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B48DC - str r0, [r1] -_081B48CC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B48A8 - - thumb_func_start sub_81B48DC -sub_81B48DC: @ 81B48DC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B491A - cmp r1, 0 - bgt _081B4914 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B4964 - b _081B4978 - .pool -_081B4914: - cmp r1, 0x1 - beq _081B496A - b _081B4978 -_081B491A: - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gStringVar1 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_ItemThrownAway - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B4988 - str r1, [r0] - b _081B4978 - .pool -_081B4964: - movs r0, 0x5 - bl PlaySE -_081B496A: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1C1C - str r0, [r1] -_081B4978: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B48DC - - thumb_func_start sub_81B4988 -sub_81B4988: @ 81B4988 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r6, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r6, r1] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B49EC - movs r1, 0 - mov r0, sp - strh r1, [r0] - adds r0, r5, 0 - movs r1, 0xC - mov r2, sp - bl SetMonData - ldr r4, =gUnknown_0203CEDC - movs r0, 0x9 - ldrsb r0, [r6, r0] - lsls r0, 4 - ldr r1, [r4] - adds r1, r0 - adds r0, r5, 0 - bl sub_81B5C94 - movs r0, 0x9 - ldrsb r0, [r6, r0] - lsls r0, 4 - ldr r1, [r4] - adds r1, r0 - movs r0, 0xC - movs r2, 0x1 - bl sub_81B2FA8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B49EC: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4988 - - thumb_func_start sub_81B4A08 -sub_81B4A08: @ 81B4A08 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gPlayerParty - ldr r1, =gUnknown_0203CEC8 - ldrb r1, [r1, 0x9] - movs r2, 0x9 - bl sub_81B33B4 - movs r0, 0x2 - bl sub_81B31B0 - movs r0, 0x19 - bl display_pokemon_menu_message - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0xFF - strh r1, [r0, 0x8] - ldr r1, =sub_81B3730 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4A08 - - thumb_func_start sub_81B4A6C -sub_81B4A6C: @ 81B4A6C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r1, [r0] - ldr r0, =sub_81B4A98 - str r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81B12C0 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4A6C - - thumb_func_start sub_81B4A98 -sub_81B4A98: @ 81B4A98 - push {lr} - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x40 - bl GetMonData - ldr r2, =gSaveBlock1Ptr - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =0x00002be0 - adds r1, r0 - ldr r0, [r2] - adds r0, r1 - ldr r1, =sub_81B4AE0 - movs r2, 0x1 - bl ReadMail - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4A98 - - thumb_func_start sub_81B4AE0 -sub_81B4AE0: @ 81B4AE0 - push {lr} - sub sp, 0xC - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r3, =gUnknown_0203CEC8 - ldrb r0, [r3, 0x8] - lsls r0, 28 - lsrs r0, 28 - ldrb r2, [r3, 0xB] - movs r1, 0x15 - str r1, [sp] - ldr r1, =sub_81B36FC - str r1, [sp, 0x4] - ldr r1, [r3] - str r1, [sp, 0x8] - movs r1, 0xFF - movs r3, 0x1 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4AE0 - - thumb_func_start brm_take_2 -brm_take_2: @ 81B4B20 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203CEC4 - ldr r0, [r5] - adds r0, 0xD - bl sub_81B302C - ldr r0, [r5] - adds r0, 0xC - bl sub_81B302C - ldr r0, =gText_SendMailToPC - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B4B6C - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end brm_take_2 - - thumb_func_start sub_81B4B6C -sub_81B4B6C: @ 81B4B6C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B4B90 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B4BA0 - str r0, [r1] -_081B4B90: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4B6C - - thumb_func_start sub_81B4BA0 -sub_81B4BA0: @ 81B4BA0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B4BC6 - cmp r1, 0 - bgt _081B4BC0 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B4C30 - b _081B4C4C -_081B4BC0: - cmp r1, 0x1 - beq _081B4C36 - b _081B4C4C -_081B4BC6: - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl TakeMailFromMon2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _081B4C0C - ldr r0, =gText_MailSentToPC - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - b _081B4C4A - .pool -_081B4C0C: - ldr r0, =gText_PCMailboxFull - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - b _081B4C4A - .pool -_081B4C30: - movs r0, 0x5 - bl PlaySE -_081B4C36: - ldr r0, =gText_MailMessageWillBeLost - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B4C60 -_081B4C4A: - str r1, [r0] -_081B4C4C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4BA0 - - thumb_func_start sub_81B4C60 -sub_81B4C60: @ 81B4C60 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B4C84 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B4C94 - str r0, [r1] -_081B4C84: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4C60 - - thumb_func_start sub_81B4C94 -sub_81B4C94: @ 81B4C94 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B4CBE - cmp r1, 0 - bgt _081B4CB8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B4D50 - b _081B4D64 -_081B4CB8: - cmp r1, 0x1 - beq _081B4D56 - b _081B4D64 -_081B4CBE: - ldr r0, =gUnknown_0203CEC8 - mov r8, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r7, 0x64 - muls r0, r7 - ldr r6, =gPlayerParty - adds r0, r6 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B4D24 - mov r1, r8 - movs r0, 0x9 - ldrsb r0, [r1, r0] - muls r0, r7 - adds r0, r6 - bl TakeMailFromMon - ldr r0, =gText_MailTakenFromPkmn - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B469C - str r1, [r0] - b _081B4D64 - .pool -_081B4D24: - adds r0, r4, 0 - bl pokemon_item_not_removed - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] - b _081B4D64 - .pool -_081B4D50: - movs r0, 0x5 - bl PlaySE -_081B4D56: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1C1C - str r0, [r1] -_081B4D64: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4C94 - - thumb_func_start sub_81B4D78 -sub_81B4D78: @ 81B4D78 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r5, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r5, r1] - movs r0, 0x64 - muls r0, r1 - ldr r6, =gPlayerParty - adds r7, r0, r6 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldrb r4, [r5, 0x9] - adds r0, r7, 0 - bl sub_81B353C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_81B33B4 - ldrb r1, [r5, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xC - beq _081B4DE4 - movs r0, 0 - bl sub_81B31B0 - movs r0, 0x15 - bl display_pokemon_menu_message - b _081B4E02 - .pool -_081B4DE4: - movs r0, 0x1 - bl sub_81B31B0 - adds r0, r7, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gStringVar2 - bl CopyItemName - movs r0, 0x1A - bl display_pokemon_menu_message -_081B4E02: - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0xFF - strh r1, [r0, 0x8] - ldr r1, =sub_81B3730 - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4D78 - - thumb_func_start brm_shift_sendout -brm_shift_sendout: @ 81B4E2C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203CEC4 - ldr r0, [r5] - adds r0, 0xC - bl sub_81B302C - bl sub_81B8A7C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B4E5C - adds r0, r4, 0 - bl sub_81B12C0 - b _081B4E7A - .pool -_081B4E5C: - ldr r0, [r5] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gStringVar4 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B4E7A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end brm_shift_sendout - - thumb_func_start sub_81B4E8C -sub_81B4E8C: @ 81B4E8C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - bl sub_81B8830 - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - cmp r5, r6 - bcs _081B4F36 - ldr r2, =gUnknown_0203CEC8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - mov r8, r0 -_081B4EC6: - ldr r0, =gSelectedOrderFromParty - adds r4, r5, r0 - ldrb r0, [r4] - cmp r0, 0 - bne _081B4F2C - movs r0, 0x5 - str r2, [sp] - bl PlaySE - ldr r2, [sp] - ldrb r0, [r2, 0x9] - adds r0, 0x1 - strb r0, [r4] - adds r0, r5, 0x2 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CEDC - ldrb r2, [r2, 0x9] - lsls r2, 24 - asrs r2, 24 - lsls r2, 4 - ldr r1, [r1] - adds r1, r2 - movs r2, 0x1 - bl sub_81B2FA8 - subs r0, r6, 0x1 - cmp r5, r0 - bne _081B4F04 - bl sub_81B4F88 -_081B4F04: - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =sub_81B1370 - mov r1, r8 - str r0, [r1] - b _081B4F68 - .pool -_081B4F2C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r6 - bcc _081B4EC6 -_081B4F36: - ldr r0, =gStringVar1 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_NoMoreThanVar1Pkmn - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x20 - bl PlaySE - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B4F68: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4E8C - - thumb_func_start sub_81B4F88 -sub_81B4F88: @ 81B4F88 - push {r4,lr} - ldr r4, =gUnknown_0203CEC8 - ldrb r0, [r4, 0x9] - movs r1, 0 - bl sub_81B0FCC - movs r0, 0x6 - strb r0, [r4, 0x9] - movs r1, 0x1 - bl sub_81B0FCC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4F88 - - thumb_func_start sub_81B4FA8 -sub_81B4FA8: @ 81B4FA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - bl sub_81B8830 - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - cmp r4, r5 - bcs _081B502A - ldr r6, =gSelectedOrderFromParty - subs r2, r5, 0x1 - adds r7, r6, 0 - ldr r3, =gUnknown_0203CEC8 -_081B4FE2: - adds r0, r4, r6 - ldrb r1, [r0] - movs r0, 0x9 - ldrsb r0, [r3, r0] - adds r0, 0x1 - cmp r1, r0 - bne _081B5020 - adds r0, r4, 0 - adds r4, r2, 0 - cmp r0, r4 - bge _081B500C - adds r3, r7, 0 -_081B4FFA: - adds r2, r0, r3 - adds r1, r0, 0x1 - adds r0, r1, r3 - ldrb r0, [r0] - strb r0, [r2] - lsls r1, 24 - lsrs r0, r1, 24 - cmp r0, r4 - blt _081B4FFA -_081B500C: - adds r1, r0, r6 - movs r0, 0 - strb r0, [r1] - b _081B502A - .pool -_081B5020: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _081B4FE2 -_081B502A: - ldr r6, =gUnknown_0203CEDC - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - lsls r0, 4 - ldr r1, [r6] - adds r1, r0 - movs r0, 0x1 - movs r2, 0x1 - bl sub_81B2FA8 - movs r4, 0 - subs r5, 0x1 - mov r0, r8 - lsls r7, r0, 2 - cmp r4, r5 - bge _081B5078 -_081B504E: - ldr r0, =gSelectedOrderFromParty - adds r1, r4, r0 - ldrb r0, [r1] - cmp r0, 0 - beq _081B506E - adds r0, r4, 0x2 - lsls r0, 24 - lsrs r0, 24 - ldrb r2, [r1] - lsls r2, 4 - subs r2, 0x10 - ldr r1, [r6] - adds r1, r2 - movs r2, 0x1 - bl sub_81B2FA8 -_081B506E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - blt _081B504E -_081B5078: - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =gTasks - mov r2, r8 - adds r1, r7, r2 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 - str r0, [r1] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B4FA8 - - thumb_func_start sub_81B50AC -sub_81B50AC: @ 81B50AC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B12C0 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B50AC - - thumb_func_start sub_81B50C8 -sub_81B50C8: @ 81B50C8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - mov r9, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r1, 0x64 - mov r8, r1 - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x41 - bl GetMonData - adds r6, r0, 0 - lsls r6, 16 - lsrs r6, 16 - mov r1, r9 - movs r0, 0x9 - ldrsb r0, [r1, r0] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - mov r1, r9 - movs r0, 0x9 - ldrsb r0, [r1, r0] - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - adds r0, r4 - movs r1, 0x50 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_800F7DC - ldr r0, [r0] - adds r1, r6, 0 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_807A8D0 - cmp r0, 0x1 - beq _081B515C - cmp r0, 0x2 - beq _081B5170 - movs r0, 0x5 - bl PlaySE - adds r0, r7, 0 - bl sub_81B12C0 - b _081B51B0 - .pool -_081B515C: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnCantBeTradedNow - bl StringExpandPlaceholders - b _081B5178 - .pool -_081B5170: - ldr r0, =gStringVar4 - ldr r1, =gText_EggCantBeTradedNow - bl StringExpandPlaceholders -_081B5178: - movs r0, 0x20 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r4, =gStringVar4 - ldr r1, =gText_PauseUntilPress - adds r0, r4, 0 - bl StringAppend - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] -_081B51B0: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B50C8 - - thumb_func_start brm_trade_1 -brm_trade_1: @ 81B51D4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - mov r8, r0 - ldrb r0, [r0, 0x9] - lsls r0, 24 - asrs r0, 24 - movs r6, 0x64 - muls r0, r6 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x41 - bl GetMonData - mov r9, r0 - mov r1, r9 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - mov r1, r8 - movs r0, 0x9 - ldrsb r0, [r1, r0] - muls r0, r6 - adds r0, r4 - movs r1, 0xB - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - mov r1, r8 - movs r0, 0x9 - ldrsb r0, [r1, r0] - muls r0, r6 - adds r0, r4 - movs r1, 0x50 - bl GetMonData - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_800F7DC - ldr r0, [r0] - ldr r1, =gUnknown_02022C38 - ldr r1, [r1] - ldr r2, =gUnknown_02022C3C - ldrh r3, [r2] - ldr r2, =gUnknown_02022C3E - ldrb r2, [r2] - str r2, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - mov r2, r9 - bl sub_807A7E0 - cmp r0, 0 - beq _081B52C8 - ldr r5, =gStringVar4 - ldr r1, =gUnknown_08615E0C - subs r0, 0x1 - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl StringExpandPlaceholders - movs r0, 0x20 - bl PlaySE - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r1, =gText_PauseUntilPress - adds r0, r5, 0 - bl StringAppend - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] - b _081B52D4 - .pool -_081B52C8: - movs r0, 0x5 - bl PlaySE - adds r0, r7, 0 - bl sub_81B12C0 -_081B52D4: - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end brm_trade_1 - - thumb_func_start sub_81B52E4 -sub_81B52E4: @ 81B52E4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r4] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gPlayerParty - ldr r1, =gUnknown_0203CEC8 - ldrb r1, [r1, 0x9] - lsls r1, 24 - asrs r1, 24 - lsls r1, 16 - lsrs r1, 16 - bl sub_807A918 - cmp r0, 0x2 - beq _081B5340 - cmp r0, 0x2 - bgt _081B5328 - cmp r0, 0x1 - beq _081B532E - b _081B5368 - .pool -_081B5328: - cmp r0, 0x3 - beq _081B5354 - b _081B5368 -_081B532E: - ldr r0, =gStringVar4 - ldr r1, =gText_OnlyPkmnForBattle - bl StringExpandPlaceholders - b _081B53C0 - .pool -_081B5340: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnCantBeTradedNow - bl StringExpandPlaceholders - b _081B53C0 - .pool -_081B5354: - ldr r0, =gStringVar4 - ldr r1, =gText_EggCantBeTradedNow - bl StringExpandPlaceholders - b _081B53C0 - .pool -_081B5368: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r4, =gStringVar4 - ldr r1, =gJPText_PutVar1IntoSpinner - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B53FC - b _081B53E4 - .pool -_081B53C0: - movs r0, 0x20 - bl PlaySE - ldr r4, =gStringVar4 - ldr r1, =gText_PauseUntilPress - adds r0, r4, 0 - bl StringAppend - adds r0, r4, 0 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C -_081B53E4: - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B52E4 - - thumb_func_start sub_81B53FC -sub_81B53FC: @ 81B53FC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B5420 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B5430 - str r0, [r1] -_081B5420: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B53FC - - thumb_func_start sub_81B5430 -sub_81B5430: @ 81B5430 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B5456 - cmp r1, 0 - bgt _081B5450 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B545E - b _081B546A -_081B5450: - cmp r1, 0x1 - beq _081B5464 - b _081B546A -_081B5456: - adds r0, r4, 0 - bl sub_81B12C0 - b _081B546A -_081B545E: - movs r0, 0x5 - bl PlaySE -_081B5464: - adds r0, r4, 0 - bl sub_81B1C1C -_081B546A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B5430 - - thumb_func_start sub_81B5470 -sub_81B5470: @ 81B5470 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - bl GetMenuCursorPos - ldr r5, =gUnknown_0203CEC4 - ldr r1, [r5] - lsls r0, 24 - lsrs r0, 24 - adds r1, 0xF - adds r1, r0 - ldrb r0, [r1] - subs r0, 0x13 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x5 - bl PlaySE - ldr r1, =gUnknown_08615D9C - lsls r0, r4, 3 - adds r7, r0, r1 - ldr r0, [r7] - cmp r0, 0 - bne _081B54A2 - b _081B5664 -_081B54A2: - ldr r0, [r5] - adds r0, 0xC - bl sub_81B302C - ldr r0, [r5] - adds r0, 0xD - bl sub_81B302C - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B54C6 - bl InUnionRoom - cmp r0, 0x1 - bne _081B54E8 -_081B54C6: - adds r0, r4, 0 - subs r0, 0xB - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081B54E4 - movs r0, 0xD - bl display_pokemon_menu_message - b _081B5656 - .pool -_081B54E4: - ldrb r0, [r7, 0x4] - b _081B5652 -_081B54E8: - cmp r4, 0x7 - bhi _081B5524 - ldr r1, =0x00000867 - adds r0, r4, r1 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B5524 - ldr r0, =gText_CantUseUntilNewBadge - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B1C1C - str r1, [r0] - b _081B5664 - .pool -_081B5524: - ldr r1, =gUnknown_08615D9C - lsls r0, r4, 3 - adds r5, r0, r1 - ldr r0, [r5] - bl _call_via_r0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B553A - b _081B563C -_081B553A: - subs r0, r4, 0x5 - cmp r0, 0x7 - bhi _081B5624 - lsls r0, 2 - ldr r1, =_081B5554 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B5554: - .4byte _081B5614 - .4byte _081B5624 - .4byte _081B5624 - .4byte _081B557C - .4byte _081B55B8 - .4byte _081B5624 - .4byte _081B5574 - .4byte _081B5574 -_081B5574: - adds r0, r6, 0 - bl sub_8161560 - b _081B5664 -_081B557C: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - movs r0, 0x1C - ldrsb r0, [r1, r0] - lsls r0, 16 - lsrs r0, 16 - ldrb r1, [r1, 0x1D] - lsls r1, 24 - asrs r1, 24 - lsls r1, 16 - lsrs r1, 16 - bl Overworld_GetMapHeaderByGroupAndId - adds r1, r0, 0 - ldr r0, =gStringVar1 - ldrb r1, [r1, 0x14] - bl sub_81245DC - ldr r0, =gStringVar4 - ldr r1, =gText_ReturnToHealingSpot - b _081B55E8 - .pool -_081B55B8: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - lsls r0, 16 - lsrs r0, 16 - adds r1, 0x25 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - lsls r1, 16 - lsrs r1, 16 - bl Overworld_GetMapHeaderByGroupAndId - adds r1, r0, 0 - ldr r0, =gStringVar1 - ldrb r1, [r1, 0x14] - bl sub_81245DC - ldr r0, =gStringVar4 - ldr r1, =gText_EscapeFromHere -_081B55E8: - bl StringExpandPlaceholders - adds r0, r6, 0 - bl sub_81B5674 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - movs r1, 0x86 - lsls r1, 2 - adds r0, r1 - strh r4, [r0] - b _081B5664 - .pool -_081B5614: - ldr r1, =gUnknown_0203CEC8 - ldr r0, =MCB2_FlyMap - b _081B5628 - .pool -_081B5624: - ldr r1, =gUnknown_0203CEC8 - ldr r0, =CB2_ReturnToField -_081B5628: - str r0, [r1] - adds r0, r6, 0 - bl sub_81B12C0 - b _081B5664 - .pool -_081B563C: - cmp r4, 0x1 - beq _081B564A - cmp r4, 0x4 - bne _081B5650 - bl sub_81B5864 - b _081B5656 -_081B564A: - bl sub_81B57DC - b _081B5656 -_081B5650: - ldrb r0, [r5, 0x4] -_081B5652: - bl display_pokemon_menu_message -_081B5656: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =task_brm_cancel_1_on_keypad_a_or_b - str r0, [r1] -_081B5664: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5470 - - thumb_func_start sub_81B5674 -sub_81B5674: @ 81B5674 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gStringVar4 - movs r1, 0x1 - bl sub_81B1B5C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81B56A4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5674 - - thumb_func_start sub_81B56A4 -sub_81B56A4: @ 81B56A4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B56C8 - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B56D8 - str r0, [r1] -_081B56C8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B56A4 - - thumb_func_start sub_81B56D8 -sub_81B56D8: @ 81B56D8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B56FE - cmp r1, 0 - bgt _081B56F8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B5714 - b _081B572A -_081B56F8: - cmp r1, 0x1 - beq _081B571A - b _081B572A -_081B56FE: - ldr r1, =gUnknown_0203CEC8 - ldr r0, =CB2_ReturnToField - str r0, [r1] - adds r0, r4, 0 - bl sub_81B12C0 - b _081B572A - .pool -_081B5714: - movs r0, 0x5 - bl PlaySE -_081B571A: - ldr r0, =gFieldCallback2 - movs r1, 0 - str r1, [r0] - ldr r0, =gPostMenuFieldCallback - str r1, [r0] - adds r0, r4, 0 - bl sub_81B1C1C -_081B572A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B56D8 - - thumb_func_start FieldCallback_PrepareFadeInFromMenu -FieldCallback_PrepareFadeInFromMenu: @ 81B5738 - push {lr} - bl pal_fill_black - ldr r0, =task_launch_hm_phase_2 - movs r1, 0x8 - bl CreateTask - movs r0, 0x1 - pop {r1} - bx r1 - .pool - thumb_func_end FieldCallback_PrepareFadeInFromMenu - - thumb_func_start task_launch_hm_phase_2 -task_launch_hm_phase_2: @ 81B5750 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsWeatherNotFadingIn - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B577C - bl brm_get_selected_species - ldr r1, =gFieldEffectArguments - lsls r0, 16 - lsrs r0, 16 - str r0, [r1] - ldr r0, =gPostMenuFieldCallback - ldr r0, [r0] - bl _call_via_r0 - adds r0, r4, 0 - bl DestroyTask -_081B577C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_launch_hm_phase_2 - - thumb_func_start brm_get_selected_species -brm_get_selected_species: @ 81B578C - push {lr} - ldr r0, =gUnknown_0203CEC8 - movs r1, 0x9 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - .pool - thumb_func_end brm_get_selected_species - - thumb_func_start task_brm_cancel_1_on_keypad_a_or_b -task_brm_cancel_1_on_keypad_a_or_b: @ 81B57B4 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081B57CE - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B57D4 -_081B57CE: - adds r0, r2, 0 - bl brm_cancel_1 -_081B57D4: - pop {r0} - bx r0 - .pool - thumb_func_end task_brm_cancel_1_on_keypad_a_or_b - - thumb_func_start sub_81B57DC -sub_81B57DC: @ 81B57DC - push {lr} - ldr r0, =0x00000888 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B57F8 - movs r0, 0xC - bl display_pokemon_menu_message - b _081B57FE - .pool -_081B57F8: - movs r0, 0xD - bl display_pokemon_menu_message -_081B57FE: - pop {r0} - bx r0 - thumb_func_end sub_81B57DC - - thumb_func_start hm_surf_run_dp02scr -hm_surf_run_dp02scr: @ 81B5804 - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - movs r0, 0x9 - bl FieldEffectStart - pop {r0} - bx r0 - .pool - thumb_func_end hm_surf_run_dp02scr - - thumb_func_start sub_81B5820 -sub_81B5820: @ 81B5820 - push {lr} - bl PartyHasMonWithSurf - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B585C - bl IsPlayerFacingSurfableFishableWater - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B585C - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =hm_surf_run_dp02scr - str r0, [r1] - movs r0, 0x1 - b _081B585E - .pool -_081B585C: - movs r0, 0 -_081B585E: - pop {r1} - bx r1 - thumb_func_end sub_81B5820 - - thumb_func_start sub_81B5864 -sub_81B5864: @ 81B5864 - push {lr} - movs r0, 0x8 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - beq _081B587A - movs r0, 0x9 - bl display_pokemon_menu_message - b _081B5880 -_081B587A: - movs r0, 0x8 - bl display_pokemon_menu_message -_081B5880: - pop {r0} - bx r0 - thumb_func_end sub_81B5864 - - thumb_func_start sub_81B5884 -sub_81B5884: @ 81B5884 - push {lr} - ldr r0, =gMapHeader - ldrb r0, [r0, 0x17] - bl Overworld_MapTypeAllowsTeleportAndFly - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B58A0 - movs r0, 0 - b _081B58A2 - .pool -_081B58A0: - movs r0, 0x1 -_081B58A2: - pop {r1} - bx r1 - thumb_func_end sub_81B5884 - - thumb_func_start sub_81B58A8 -sub_81B58A8: @ 81B58A8 - push {lr} - sub sp, 0xC - movs r0, 0 - str r0, [sp] - ldr r0, =sub_81B1370 - str r0, [sp, 0x4] - ldr r0, =CB2_ReturnToFieldWithOpenMenu - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_81B0038 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B58A8 - - thumb_func_start hm2_waterfall -hm2_waterfall: @ 81B58D4 - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - movs r0, 0x2B - bl FieldEffectStart - pop {r0} - bx r0 - .pool - thumb_func_end hm2_waterfall - - thumb_func_start hm_prepare_waterfall -hm_prepare_waterfall: @ 81B58F0 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsWaterfall - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B594C - bl IsPlayerSurfingNorth - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B594C - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =hm2_waterfall - str r0, [r1] - movs r0, 0x1 - b _081B594E - .pool -_081B594C: - movs r0, 0 -_081B594E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end hm_prepare_waterfall - - thumb_func_start sub_81B5958 -sub_81B5958: @ 81B5958 - push {lr} - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - movs r0, 0x2C - bl FieldEffectStart - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5958 - - thumb_func_start sub_81B5974 -sub_81B5974: @ 81B5974 - push {lr} - bl TrySetDiveWarp - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1, 0x4] - cmp r0, 0 - bne _081B5990 - movs r0, 0 - b _081B599E - .pool -_081B5990: - ldr r1, =gFieldCallback2 - ldr r0, =FieldCallback_PrepareFadeInFromMenu - str r0, [r1] - ldr r1, =gPostMenuFieldCallback - ldr r0, =sub_81B5958 - str r0, [r1] - movs r0, 0x1 -_081B599E: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B5974 - - thumb_func_start party_menu_icon_anim -@ void party_menu_icon_anim(struct pokemon *mon, int a2, int a3) -party_menu_icon_anim: @ 81B59B4 - push {r4-r7,lr} - sub sp, 0x4 - adds r5, r0, 0 - adds r7, r1, 0 - adds r4, r2, 0 - movs r6, 0x1 - bl sub_81B1250 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B59EA - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B59EA - ldr r0, =gUnknown_08616020 - adds r0, r4, r0 - ldrb r1, [r0] - eors r1, r6 - negs r0, r1 - orrs r0, r1 - lsrs r6, r0, 31 -_081B59EA: - adds r0, r5, 0 - movs r1, 0x41 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0 - bl GetMonData - adds r1, r0, 0 - str r6, [sp] - adds r0, r4, 0 - adds r2, r7, 0 - movs r3, 0x1 - bl party_menu_link_mon_icon_anim - ldrb r0, [r7, 0x9] - adds r1, r5, 0 - bl sub_81B5B38 - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_icon_anim - - thumb_func_start party_menu_link_mon_icon_anim -@ void party_menu_link_mon_icon_anim(u16 speciesId, u32 personality, int a3, char a4, int a5) -party_menu_link_mon_icon_anim: @ 81B5A2C - push {r4-r7,lr} - sub sp, 0xC - adds r6, r1, 0 - adds r4, r2, 0 - lsls r0, 16 - lsrs r5, r0, 16 - lsls r3, 24 - lsrs r7, r3, 24 - cmp r5, 0 - beq _081B5A7A - ldr r1, =sub_80D3014 - ldr r0, [r4, 0x4] - ldrb r2, [r0] - ldrb r3, [r0, 0x1] - movs r0, 0x4 - str r0, [sp] - str r6, [sp, 0x4] - ldr r0, [sp, 0x20] - str r0, [sp, 0x8] - adds r0, r5, 0 - bl CreateMonIcon - strb r0, [r4, 0x9] - ldr r2, =gSprites - ldrb r0, [r4, 0x9] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x3 - adds r2, r7, 0 - ands r2, r0 - lsls r2, 2 - ldrb r3, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] -_081B5A7A: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_link_mon_icon_anim - - thumb_func_start sub_81B5A8C -sub_81B5A8C: @ 81B5A8C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - adds r0, r1, 0 - adds r1, r2, 0 - bl GetHPBarLevel - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _081B5AEC - cmp r0, 0x2 - bgt _081B5AB4 - cmp r0, 0x1 - beq _081B5B04 - b _081B5B1C -_081B5AB4: - cmp r0, 0x3 - beq _081B5AD4 - cmp r0, 0x4 - bne _081B5B1C - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl sub_80D32C8 - b _081B5B2C - .pool -_081B5AD4: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl sub_80D32C8 - b _081B5B2C - .pool -_081B5AEC: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x2 - bl sub_80D32C8 - b _081B5B2C - .pool -_081B5B04: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x3 - bl sub_80D32C8 - b _081B5B2C - .pool -_081B5B1C: - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x4 - bl sub_80D32C8 -_081B5B2C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B5A8C - thumb_func_start sub_81B5B38 sub_81B5B38: @ 81B5B38 push {r4-r6,lr} diff --git a/include/easy_chat.h b/include/easy_chat.h index 541fa6c1b..23fd9ed83 100644 --- a/include/easy_chat.h +++ b/include/easy_chat.h @@ -1,6 +1,8 @@ #ifndef GUARD_EASYCHAT_H #define GUARD_EASYCHAT_H +#include "main.h" + void InitEasyChatPhrases(void); void easy_chat_input_maybe(void); u8 * CopyEasyChatWord(u8 *dest, u16 word); @@ -12,5 +14,6 @@ u16 sub_811EE38(u16 group); u16 sub_811F01C(void); bool16 EasyChat_GetNumWordsInGroup(u8); u16 sub_811EE90(u16); +void sub_811A20C(u8 kind, u16 *words, MainCallback callback, u8 sizeParam); #endif // GUARD_EASYCHAT_H diff --git a/include/fldeff_softboiled.h b/include/fldeff_softboiled.h index 8579c6cfe..abb3c7913 100755 --- a/include/fldeff_softboiled.h +++ b/include/fldeff_softboiled.h @@ -2,5 +2,6 @@ #define GUARD_FLDEFF_SOFTBOILED_H void sub_81615A8(u8 taskId); +void sub_8161560(u8 taskId); #endif // GUARD_FLDEFF_SOFTBOILED_H diff --git a/include/item_menu.h b/include/item_menu.h index 649eb934c..6214c69fc 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -60,5 +60,6 @@ void CB2_BagMenuFromStartMenu(void); u8 sub_81ABB2C(u8 pocketId); bool8 UseRegisteredKeyItemOnField(void); void CB2_GoToSellMenu(void); +void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); #endif //GUARD_item_menu_H diff --git a/include/link_rfu.h b/include/link_rfu.h index 426565e56..e394e2611 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -2,6 +2,7 @@ #define GUARD_LINK_RFU_H #include "librfu.h" +#include "link.h" // Exported type declarations diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index f1c8a3e61..17c7d5573 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -16,5 +16,7 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u u8 UpdateMonIconFrame(struct Sprite *sprite); void LoadMonIconPalette(u16 species); void sub_80D328C(struct Sprite *sprite); +void sub_80D3014(struct Sprite *sprite); +void sub_80D32C8(struct Sprite *sprite, u8 animNum); #endif // GUARD_POKEMON_ICON_H diff --git a/include/region_map.h b/include/region_map.h index 0c82232cf..ed1c1a201 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -107,6 +107,7 @@ u8 *sub_8124610(u8 *dest, u16 mapSecId); u16 CorrectSpecialMapSecId(u16 mapSecId); void sub_8122D88(struct RegionMap *regionMap); void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y); +void MCB2_FlyMap(void); extern const struct RegionMapLocation gRegionMapEntries[]; diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index 1aa663bc7..c1bdbdf34 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -5,6 +5,10 @@ // Exported RAM declarations +extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; +extern u16 gUnknown_02022C3C; +extern u8 gUnknown_02022C3E; + // Exported ROM declarations void sub_8018438(void); diff --git a/include/strings.h b/include/strings.h index 0ec3526ea..f46554cc5 100644 --- a/include/strings.h +++ b/include/strings.h @@ -407,6 +407,22 @@ extern const u8 gText_SwitchedPkmnItem[]; extern const u8 gText_BagFullCouldNotRemoveItem[]; extern const u8 gText_PkmnCantParticipate[]; extern const u8 gText_PkmnNotHolding[]; +extern const u8 gText_ThrowAwayItem[]; +extern const u8 gText_ItemThrownAway[]; +extern const u8 gText_SendMailToPC[]; +extern const u8 gText_MailSentToPC[]; +extern const u8 gText_PCMailboxFull[]; +extern const u8 gText_MailMessageWillBeLost[]; +extern const u8 gText_MailTakenFromPkmn[]; +extern const u8 gText_NoMoreThanVar1Pkmn[]; +extern const u8 gText_PkmnCantBeTradedNow[]; +extern const u8 gText_EggCantBeTradedNow[]; +extern const u8 gText_OnlyPkmnForBattle[]; +extern const u8 gJPText_PutVar1IntoSpinner[]; +extern const u8 gText_PauseUntilPress[]; +extern const u8 gText_CantUseUntilNewBadge[]; +extern const u8 gText_ReturnToHealingSpot[]; +extern const u8 gText_EscapeFromHere[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/include/trade.h b/include/trade.h index af4da0015..e3c18bffd 100644 --- a/include/trade.h +++ b/include/trade.h @@ -1,6 +1,8 @@ #ifndef GUARD_TRADE_H #define GUARD_TRADE_H +#include "link_rfu.h" + // Exported type declarations // Exported RAM declarations @@ -10,5 +12,8 @@ s32 sub_807A728(void); void sub_80773AC(void); void sub_807AE50(void); +int sub_807A8D0(u32 /* probably wrong */, u16, u16, u8); +int sub_807A7E0(u32 /* probably wrong */, u32 /* probably wrong */, u16, u16, u16, u16, u8); +int sub_807A918(struct Pokemon*, u16); #endif //GUARD_TRADE_H diff --git a/src/party_menu.c b/src/party_menu.c index c43beaadb..e01f333d5 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -3,8 +3,10 @@ #include "battle_controllers.h" #include "battle_interface.h" #include "battle_pike.h" +#include "battle_pyramid.h" #include "bg.h" #include "constants/battle.h" +#include "constants/flags.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/rgb.h" @@ -13,8 +15,14 @@ #include "contest.h" #include "data2.h" #include "decompress.h" +#include "easy_chat.h" #include "event_data.h" +#include "field_control_avatar.h" +#include "field_effect.h" +#include "field_player_avatar.h" +#include "field_screen.h" #include "field_specials.h" +#include "fieldmap.h" #include "fldeff_softboiled.h" #include "gpu_regs.h" #include "graphics.h" @@ -22,16 +30,21 @@ #include "item.h" #include "item_menu.h" #include "item_use.h" +#include "link.h" +#include "link_rfu.h" #include "main.h" #include "mail.h" #include "malloc.h" #include "menu.h" #include "menu_helpers.h" +#include "metatile_behavior.h" +#include "overworld.h" #include "palette.h" #include "party_menu.h" #include "pokemon.h" #include "pokemon_icon.h" #include "pokemon_summary_screen.h" +#include "region_map.h" #include "rom_8011DC0.h" #include "scanline_effect.h" #include "sound.h" @@ -42,6 +55,7 @@ #include "task.h" #include "text.h" #include "text_window.h" +#include "trade.h" #include "window.h" struct Unk_Rodata1 { @@ -88,6 +102,11 @@ struct Unk_8615C08 { TaskFunc func; }; +struct Unk_8615D9C { + bool8 (*fieldMoveFunc)(void); + u8 msgID; +}; + // BELOW TO BE PUT IN EWRAM extern struct Unk_203CEC4 *gUnknown_0203CEC4; @@ -99,6 +118,7 @@ extern u8 gUnknown_0203CEE8; extern u16 *gUnknown_0203CEF0; extern u16 *gUnknown_0203CEF4; extern u8 gSelectedOrderFromParty[]; +extern u16 gUnknown_0203CEFC; extern u8 gUnknown_0203CF20; // summary screen? // ABOVE TO BE PUT IN EWRAM @@ -165,6 +185,9 @@ extern struct Unk_8615C08 gUnknown_08615C08[]; extern u8 *gUnknown_08615D38[]; extern u8 gUnknown_08615D70[]; extern const u16 gUnknown_08615D7E[]; +extern const struct Unk_8615D9C gUnknown_08615D9C[]; +extern const u8 *gUnknown_08615E0C[]; +extern u8 gUnknown_08616020[]; // ABOVE TO BE CONVERTED TO C @@ -219,13 +242,13 @@ void sub_81B2BF4(u8, u16, u8*, struct Unk_203CEDC *); void sub_81B2D3C(u16, struct Unk_203CEDC *); void sub_81B2DDC(u16, struct Unk_203CEDC *); void sub_81B2E64(u16, u16, struct Unk_203CEDC *); -void party_menu_link_mon_icon_anim(u16, u32, struct Unk_203CEDC *, u8, u8); +void party_menu_link_mon_icon_anim(u16, u32, struct Unk_203CEDC *, u8, u32); void party_menu_link_mon_held_item_object(u16, u16, struct Unk_203CEDC *); void party_menu_link_mon_pokeball_object(u16, struct Unk_203CEDC *); void party_menu_link_mon_status_condition_object(u16, u8, struct Unk_203CEDC *); void party_menu_held_item_object(struct Pokemon *, struct Unk_203CEDC *); void party_menu_pokeball_object(struct Pokemon *, struct Unk_203CEDC *); -void party_menu_icon_anim(struct Pokemon *, struct Unk_203CEDC *, u8); +void party_menu_icon_anim(struct Pokemon *, struct Unk_203CEDC *, u32); void party_menu_status_condition_object(struct Pokemon *, struct Unk_203CEDC *); u8 sub_81B5F74(u8, u8); void sub_81B120C(void); @@ -290,6 +313,38 @@ void sub_81B3CC0(u8); void sub_81B3D48(u8); void swap_pokemon_and_oams(void); void sub_81B3E60(u8); +void sub_81B41C4(void); +void c2_8123744(void); +void sub_81B452C(void); +void sub_81B4350(u8); +void sub_81B42D0(u8); +void sub_81B43A8(u8); +void sub_81B43DC(u8); +void sub_81B44FC(u8); +void sub_81B4578(void); +void sub_81B4624(u8); +void sub_81B5C94(struct Pokemon*, struct Unk_203CEDC*); +void sub_81B48A8(u8); +void sub_81B48DC(u8); +void sub_81B4988(u8); +void sub_81B4A98(void); +void sub_81B4AE0(void); +void sub_81B4B6C(u8); +void sub_81B4BA0(u8); +void sub_81B4C60(u8); +void sub_81B4C94(u8); +bool8 sub_81B8A7C(void); +void sub_81B53FC(u8); +void sub_81B5430(u8); +void task_brm_cancel_1_on_keypad_a_or_b(u8); +void sub_81B5674(u8); +void sub_81B57DC(void); +void sub_81B5864(void); +void sub_81B56A4(u8); +void sub_81B56D8(u8); +void task_launch_hm_phase_2(u8); +u16 brm_get_selected_species(void); +void sub_81B5B38(u8, struct Pokemon*); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -1238,7 +1293,7 @@ void sub_81B1708(u8 taskId) sub_81B8558(); sub_81B12C0(taskId); break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); case 1: sub_81B1C1C(taskId); @@ -1967,7 +2022,7 @@ void sub_81B1C1C(u8 taskId) } } -void sub_81B1C84(struct Pokemon *mon, u16 item, u8 c) +void sub_81B1C84(struct Pokemon *mon, u16 item, u8 c, u8 unused) { GetMonNickname(mon, gStringVar1); CopyItemName(item, gStringVar2); @@ -2031,7 +2086,7 @@ u8 sub_81B1E00(struct Pokemon* mon) return 2; } -void pokemon_item_not_removed(void) +void pokemon_item_not_removed(u16 itemUnused) { StringExpandPlaceholders(gStringVar4, gText_BagFullCouldNotRemoveItem); } @@ -2211,7 +2266,7 @@ void sub_81B227C(u8 taskId) gSpecialVar_0x8004 = 7; sub_81B12C0(taskId); break; - case -1: + case MENU_B_PRESSED: PlaySE(SE_SELECT); case 1: gTasks[taskId].func = sub_81B1C1C; @@ -2634,12 +2689,12 @@ void sub_81B2E64(u16 hp, u16 maxhp, struct Unk_203CEDC *ptr) switch (GetHPBarLevel(hp, maxhp)) { - case 3: - case 4: + case HP_BAR_GREEN: + case HP_BAR_FULL: LoadPalette(sub_81B2564(gUnknown_08615AC7[0]), gUnknown_08615AB8[0] + palNum, 2); LoadPalette(sub_81B2564(gUnknown_08615AC7[1]), gUnknown_08615AB8[1] + palNum, 2); break; - case 2: + case HP_BAR_YELLOW: LoadPalette(sub_81B2564(gUnknown_08615AC9[0]), gUnknown_08615AB8[0] + palNum, 2); LoadPalette(sub_81B2564(gUnknown_08615AC9[1]), gUnknown_08615AB8[1] + palNum, 2); break; @@ -2809,11 +2864,8 @@ bool8 sub_81B314C(void) for (i = 0; i < 6; i++) { - if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE) - { - if (GetMonData(&party[i], MON_DATA_HP) != 0 || GetMonData(&party[i], MON_DATA_IS_EGG) != FALSE) - j++; - } + if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE && (GetMonData(&party[i], MON_DATA_HP) != 0 || GetMonData(&party[i], MON_DATA_IS_EGG) != FALSE)) + j++; if (j > 1) return TRUE; } @@ -3040,9 +3092,9 @@ void sub_81B3730(u8 taskId) else input = ProcessMenuInput_other(); data[0] = GetMenuCursorPos(); - if (input != -2) + if (input != MENU_NOTHING_CHOSEN) { - if (input == -1) + if (input == MENU_B_PRESSED) { PlaySE(SE_SELECT); sub_81B302C(&gUnknown_0203CEC4->unkC[2]); @@ -3391,3 +3443,872 @@ void brm_cancel_1(u8 taskId) display_pokemon_menu_message(0); gTasks[taskId].func = sub_81B1370; } + +void sub_81B4134(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.unk9, 8); + sub_81B31B0(1); + display_pokemon_menu_message(24); + gTasks[taskId].data[0] = 0xFF; + gTasks[taskId].func = sub_81B3730; +} + +void sub_81B4198(u8 taskId) +{ + PlaySE(SE_SELECT); + gUnknown_0203CEC4->unk4 = sub_81B41C4; + sub_81B12C0(taskId); +} + +void sub_81B41C4(void) +{ + if (InBattlePyramid() == FALSE) + GoToBagMenu(2, 5, c2_8123744); + else + sub_81C4F98(2, c2_8123744); +} + +void c2_8123744(void) +{ + if (gSpecialVar_ItemId == ITEM_NONE) + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B36FC, gUnknown_0203CEC8.unk0); + } + else + { + gUnknown_0203CEFC = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_HELD_ITEM); + if (gUnknown_0203CEFC != ITEM_NONE) + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4350, gUnknown_0203CEC8.unk0); + } + else if (ItemIsMail(gSpecialVar_ItemId) != FALSE) + { + RemoveBagItem(gSpecialVar_ItemId, 1); + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId); + sub_81B452C(); + } + else + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B42D0, gUnknown_0203CEC8.unk0); + } + } +} + +void sub_81B42D0(u8 taskId) +{ + u16 item; + + if (!gPaletteFade.active) + { + item = gSpecialVar_ItemId; + sub_81B1C84(&gPlayerParty[gUnknown_0203CEC8.unk9], item, 0, 0); + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], item); + RemoveBagItem(item, 1); + gTasks[taskId].func = sub_81B469C; + } +} + +void sub_81B4350(u8 taskId) +{ + if (!gPaletteFade.active) + { + sub_81B1D1C(&gPlayerParty[gUnknown_0203CEC8.unk9], gUnknown_0203CEFC, 1); + gTasks[taskId].func = sub_81B43A8; + } +} + +void sub_81B43A8(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B43DC; + } +} + +void sub_81B43DC(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + RemoveBagItem(gSpecialVar_ItemId, 1); + if (AddBagItem(gUnknown_0203CEFC, 1) == FALSE) + { + AddBagItem(gSpecialVar_ItemId, 1); + pokemon_item_not_removed(gUnknown_0203CEFC); + sub_81B1B5C(gStringVar4, 0); + gTasks[taskId].func = sub_81B1C1C; + } + else if (ItemIsMail(gSpecialVar_ItemId) != FALSE) + { + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId); + gTasks[taskId].func = sub_81B44FC; + } + else + { + sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId); + sub_81B1D68(gSpecialVar_ItemId, gUnknown_0203CEFC, 1); + gTasks[taskId].func = sub_81B469C; + } + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B1C1C; + break; + } +} + +void sub_81B44FC(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + gUnknown_0203CEC4->unk4 = sub_81B452C; + sub_81B12C0(taskId); + } +} + +void sub_81B452C(void) +{ + u8 mail = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAIL); + + sub_811A20C(4, gSaveBlock1Ptr->mail[mail].words, sub_81B4578, 3); +} + +void sub_81B4578(void) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + if (gSpecialVar_Result == FALSE) + { + TakeMailFromMon(mon); + SetMonData(mon, MON_DATA_HELD_ITEM, &gUnknown_0203CEFC); + RemoveBagItem(gUnknown_0203CEFC, 1); + AddBagItem(item, 1); + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0, sub_81B36FC, gUnknown_0203CEC8.unk0); + } + else + { + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 0x7F, sub_81B4624, gUnknown_0203CEC8.unk0); + } +} + +void sub_81B4624(u8 taskId) +{ + if (!gPaletteFade.active) + { + if (gUnknown_0203CEFC == ITEM_NONE) + sub_81B1C84(&gPlayerParty[gUnknown_0203CEC8.unk9], gSpecialVar_ItemId, 0, 0); + else + sub_81B1D68(gSpecialVar_ItemId, gUnknown_0203CEFC, 0); + gTasks[taskId].func = sub_81B469C; + } +} + +void sub_81B469C(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + + if (sub_81B1BD4() != TRUE) + { + sub_81B5C94(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); + if (gUnknown_0203CEC8.unk8_0 == 12) + { + if (GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE) + sub_81B2FA8(11, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + else + sub_81B2FA8(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + } + sub_81B1C1C(taskId); + } +} + +void sub_81B4724(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + switch (sub_81B1E00(mon)) + { + case 0: + GetMonNickname(mon, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); + sub_81B1B5C(gStringVar4, 1); + break; + case 1: + pokemon_item_not_removed(item); + sub_81B1B5C(gStringVar4, 1); + break; + default: + sub_81B1CD0(mon, item, 1); + break; + } + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B469C; +} + +void sub_81B47E0(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + if (item == ITEM_NONE) + { + GetMonNickname(mon, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B469C; + } + else + { + CopyItemName(item, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_ThrowAwayItem); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B48A8; + } +} + +void sub_81B48A8(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B48DC; + } +} + +void sub_81B48DC(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + CopyItemName(GetMonData(mon, MON_DATA_HELD_ITEM), gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_ItemThrownAway); + sub_81B1B5C(gStringVar4, 0); + gTasks[taskId].func = sub_81B4988; + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B1C1C; + break; + } +} + +void sub_81B4988(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + u16 itemClear; + + if (sub_81B1BD4() != TRUE) + { + itemClear = ITEM_NONE; + SetMonData(mon, MON_DATA_HELD_ITEM, &itemClear); + sub_81B5C94(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9]); + sub_81B2FA8(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + gTasks[taskId].func = sub_81B1C1C; + } +} + +void sub_81B4A08(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.unk9, 9); + sub_81B31B0(2); + display_pokemon_menu_message(25); + gTasks[taskId].data[0] = 0xFF; + gTasks[taskId].func = sub_81B3730; +} + +void sub_81B4A6C(u8 taskId) +{ + PlaySE(SE_SELECT); + gUnknown_0203CEC4->unk4 = sub_81B4A98; + sub_81B12C0(taskId); +} + +void sub_81B4A98(void) +{ + ReadMail(&gSaveBlock1Ptr->mail[GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAIL)], sub_81B4AE0, 1); +} + +void sub_81B4AE0(void) +{ + gPaletteFade.bufferTransferDisabled = TRUE; + sub_81B0038(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.unk0); +} + +void brm_take_2(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B1B5C(gText_SendMailToPC, 1); + gTasks[taskId].func = sub_81B4B6C; +} + +void sub_81B4B6C(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B4BA0; + } +} + +void sub_81B4BA0(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + if (TakeMailFromMon2(&gPlayerParty[gUnknown_0203CEC8.unk9]) != 0xFF) + { + sub_81B1B5C(gText_MailSentToPC, 0); + gTasks[taskId].func = sub_81B469C; + } + else + { + sub_81B1B5C(gText_PCMailboxFull, 0); + gTasks[taskId].func = sub_81B1C1C; + } + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + sub_81B1B5C(gText_MailMessageWillBeLost, 1); + gTasks[taskId].func = sub_81B4C60; + break; + } +} + +void sub_81B4C60(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B4C94; + } +} + +void sub_81B4C94(u8 taskId) +{ + u16 item; + + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + item = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_HELD_ITEM); + if (AddBagItem(item, 1) == TRUE) + { + TakeMailFromMon(&gPlayerParty[gUnknown_0203CEC8.unk9]); + sub_81B1B5C(gText_MailTakenFromPkmn, 0); + gTasks[taskId].func = sub_81B469C; + } + else + { + pokemon_item_not_removed(item); + sub_81B1B5C(gStringVar4, 0); + gTasks[taskId].func = sub_81B1C1C; + } + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B1C1C; + break; + } +} + +void sub_81B4D78(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.unk9]; + + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.unk9, sub_81B353C(mon)); + if (gUnknown_0203CEC8.unk8_0 != 12) + { + sub_81B31B0(0); + display_pokemon_menu_message(21); + } + else + { + sub_81B31B0(1); + CopyItemName(GetMonData(mon, MON_DATA_HELD_ITEM), gStringVar2); + display_pokemon_menu_message(26); + } + gTasks[taskId].data[0] = 0xFF; + gTasks[taskId].func = sub_81B3730; +} + +void brm_shift_sendout(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + if (sub_81B8A7C() == TRUE) + { + sub_81B12C0(taskId); + } + else + { + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; + } +} + +void sub_81B4E8C(u8 taskId) +{ + u8 unk; + u8 i; + + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + unk = sub_81B8830(); + for (i = 0; i < unk; i++) + { + if (gSelectedOrderFromParty[i] == 0) + { + PlaySE(SE_SELECT); + gSelectedOrderFromParty[i] = gUnknown_0203CEC8.unk9 + 1; + sub_81B2FA8(i + 2, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + if (i == (unk - 1)) + sub_81B4F88(); + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; + return; + } + } + ConvertIntToDecimalStringN(gStringVar1, unk, 0, 1); + StringExpandPlaceholders(gStringVar4, gText_NoMoreThanVar1Pkmn); + PlaySE(SE_HAZURE); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; +} + +void sub_81B4F88(void) +{ + sub_81B0FCC(gUnknown_0203CEC8.unk9, 0); + gUnknown_0203CEC8.unk9 = 6; + sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); +} + +void sub_81B4FA8(u8 taskId) +{ + u8 unk; + u8 i, j; + + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + unk = sub_81B8830(); + for (i = 0; i < unk; i++) + { + if (gSelectedOrderFromParty[i] == (gUnknown_0203CEC8.unk9 + 1)) + { + for (j = i; j < (unk - 1); j++) + gSelectedOrderFromParty[j] = gSelectedOrderFromParty[j + 1]; + gSelectedOrderFromParty[j] = 0; + break; + } + } + sub_81B2FA8(1, &gUnknown_0203CEDC[gUnknown_0203CEC8.unk9], 1); + for (i = 0; i < (unk - 1); i++) + { + if (gSelectedOrderFromParty[i] != 0) + sub_81B2FA8(i + 2, &gUnknown_0203CEDC[gSelectedOrderFromParty[i] - 1], 1); + } + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; +} + +void sub_81B50AC(u8 taskId) +{ + PlaySE(SE_SELECT); + sub_81B12C0(taskId); +} + +void sub_81B50C8(u8 taskId) +{ + u16 species2 = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES2); + u16 species = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES); + u8 obedience = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_OBEDIENCE); + + switch (sub_807A8D0(*(u32 *)sub_800F7DC() /* dirty cast, probably needs to be changed */, species2, species, obedience)) + { + case 1: + StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gText_EggCantBeTradedNow); + break; + default: + PlaySE(SE_SELECT); + sub_81B12C0(taskId); + return; + } + PlaySE(SE_HAZURE); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + StringAppend(gStringVar4, gText_PauseUntilPress); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; +} + +void brm_trade_1(u8 taskId) +{ + u16 species2 = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES2); + u16 species = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES); + u8 obedience = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_OBEDIENCE); + u32 stringId = sub_807A7E0(*(u32 *)sub_800F7DC() /* dirty cast, probably needs to be changed */, *(u32 *)&gUnknown_02022C38 /* dirty cast, probably needs to be changed */, species2, gUnknown_02022C3C, gUnknown_02022C3E, species, obedience); + + if (stringId != 0) + { + StringExpandPlaceholders(gStringVar4, gUnknown_08615E0C[stringId - 1]); + PlaySE(SE_HAZURE); + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + StringAppend(gStringVar4, gText_PauseUntilPress); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; + } + else + { + PlaySE(SE_SELECT); + sub_81B12C0(taskId); + } +} + +void sub_81B52E4(u8 taskId) +{ + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + switch (sub_807A918(gPlayerParty, gUnknown_0203CEC8.unk9)) + { + case 1: + StringExpandPlaceholders(gStringVar4, gText_OnlyPkmnForBattle); + break; + case 2: + StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); + break; + case 3: + StringExpandPlaceholders(gStringVar4, gText_EggCantBeTradedNow); + break; + default: + PlaySE(SE_SELECT); + GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unk9], gStringVar1); + StringExpandPlaceholders(gStringVar4, gJPText_PutVar1IntoSpinner); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B53FC; + return; + } + PlaySE(SE_HAZURE); + StringAppend(gStringVar4, gText_PauseUntilPress); + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B1C1C; +} + +void sub_81B53FC(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B5430; + } +} + +void sub_81B5430(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + sub_81B12C0(taskId); + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + sub_81B1C1C(taskId); + break; + } +} + +void sub_81B5470(u8 taskId) +{ + u8 fieldMove = gUnknown_0203CEC4->unkF[GetMenuCursorPos()] - 19; + struct MapHeader const *mapHeader; + u8 fieldMove2; + + PlaySE(SE_SELECT); + if (gUnknown_08615D9C[fieldMove].fieldMoveFunc != NULL) + { + sub_81B302C(&gUnknown_0203CEC4->unkC[0]); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + if (sub_81221AC() == TRUE || InUnionRoom() == TRUE) + { + fieldMove2 = fieldMove - 11; + if (fieldMove2 <= 1) + display_pokemon_menu_message(13); + else + display_pokemon_menu_message(gUnknown_08615D9C[fieldMove].msgID); + gTasks[taskId].func = task_brm_cancel_1_on_keypad_a_or_b; + } + else + { + if (fieldMove <= 7 && FlagGet(FLAG_BADGE01_GET + fieldMove) != TRUE) + { + sub_81B1B5C(gText_CantUseUntilNewBadge, 1); + gTasks[taskId].func = sub_81B1C1C; + } + else if (gUnknown_08615D9C[fieldMove].fieldMoveFunc() == TRUE) + { + switch (fieldMove - 5) + { + case 6: + case 7: + sub_8161560(taskId); + break; + case 3: + mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->lastHealLocation.mapGroup, gSaveBlock1Ptr->lastHealLocation.mapNum); + sub_81245DC(gStringVar1, mapHeader->regionMapSectionId); + StringExpandPlaceholders(gStringVar4, gText_ReturnToHealingSpot); + sub_81B5674(taskId); + gUnknown_0203CEC4->unk218[0] = fieldMove; + break; + case 4: + mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum); + sub_81245DC(gStringVar1, mapHeader->regionMapSectionId); + StringExpandPlaceholders(gStringVar4, gText_EscapeFromHere); + sub_81B5674(taskId); + gUnknown_0203CEC4->unk218[0] = fieldMove; + break; + case 0: + gUnknown_0203CEC8.unk0 = MCB2_FlyMap; + sub_81B12C0(taskId); + break; + default: + gUnknown_0203CEC8.unk0 = CB2_ReturnToField; + sub_81B12C0(taskId); + break; + } + } + else + { + switch (fieldMove) + { + case 4: + sub_81B5864(); + break; + case 1: + sub_81B57DC(); + break; + default: + display_pokemon_menu_message(gUnknown_08615D9C[fieldMove].msgID); + break; + } + gTasks[taskId].func = task_brm_cancel_1_on_keypad_a_or_b; + } + } + } +} + +void sub_81B5674(u8 taskId) +{ + sub_81B1B5C(gStringVar4, 1); + gTasks[taskId].func = sub_81B56A4; +} + +void sub_81B56A4(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B56D8; + } +} + +void sub_81B56D8(u8 taskId) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + gUnknown_0203CEC8.unk0 = CB2_ReturnToField; + sub_81B12C0(taskId); + break; + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + case 1: + gFieldCallback2 = NULL; + gPostMenuFieldCallback = NULL; + sub_81B1C1C(taskId); + break; + } +} + +bool8 FieldCallback_PrepareFadeInFromMenu(void) +{ + pal_fill_black(); + CreateTask(task_launch_hm_phase_2, 8); + return TRUE; +} + +void task_launch_hm_phase_2(u8 taskId) +{ + if (IsWeatherNotFadingIn() == TRUE) + { + gFieldEffectArguments[0] = brm_get_selected_species(); + gPostMenuFieldCallback(); + DestroyTask(taskId); + } +} + +u16 brm_get_selected_species(void) +{ + return GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES); +} + +void task_brm_cancel_1_on_keypad_a_or_b(u8 taskId) +{ + if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + brm_cancel_1(taskId); +} + +void sub_81B57DC(void) +{ + if (FlagGet(FLAG_SYS_USE_FLASH) == TRUE) + display_pokemon_menu_message(12); + else + display_pokemon_menu_message(13); +} + +void hm_surf_run_dp02scr(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + FieldEffectStart(9); +} + +bool8 sub_81B5820(void) +{ + if (PartyHasMonWithSurf() == TRUE && IsPlayerFacingSurfableFishableWater() == TRUE) + { + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = hm_surf_run_dp02scr; + return TRUE; + } + return FALSE; +} + +void sub_81B5864(void) +{ + if (TestPlayerAvatarFlags(8) != FALSE) + display_pokemon_menu_message(9); + else + display_pokemon_menu_message(8); +} + +bool8 sub_81B5884(void) +{ + if (Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE) + return TRUE; + return FALSE; +} + +void sub_81B58A8(void) +{ + sub_81B0038(0, 0, 0, 1, 0, sub_81B1370, CB2_ReturnToFieldWithOpenMenu); +} + +void hm2_waterfall(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + FieldEffectStart(43); +} + +bool8 hm_prepare_waterfall(void) +{ + s16 x, y; + + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + if (MetatileBehavior_IsWaterfall(MapGridGetMetatileBehaviorAt(x, y)) == TRUE && IsPlayerSurfingNorth() == TRUE) + { + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = hm2_waterfall; + return TRUE; + } + return FALSE; +} + +void sub_81B5958(void) +{ + gFieldEffectArguments[0] = GetCursorSelectionMonId(); + FieldEffectStart(44); +} + +bool8 sub_81B5974(void) +{ + gFieldEffectArguments[1] = TrySetDiveWarp(); + if (gFieldEffectArguments[1] != 0) + { + gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; + gPostMenuFieldCallback = sub_81B5958; + return TRUE; + } + return FALSE; +} + +void party_menu_icon_anim(struct Pokemon *mon, struct Unk_203CEDC *ptr, u32 a) +{ + u32 bit = 1; + u16 species2; + + if (sub_81B1250() == TRUE && gMain.inBattle != FALSE) + bit = (gUnknown_08616020[a] ^ bit) ? 1 : 0; + species2 = GetMonData(mon, MON_DATA_SPECIES2); + party_menu_link_mon_icon_anim(species2, GetMonData(mon, MON_DATA_PERSONALITY), ptr, 1, bit); + sub_81B5B38(ptr->unk9, mon); +} + +void party_menu_link_mon_icon_anim(u16 species, u32 pid, struct Unk_203CEDC *ptr, u8 priority, u32 bit) +{ + if (species != SPECIES_NONE) + { + ptr->unk9 = CreateMonIcon(species, sub_80D3014, ptr->unk4[0], ptr->unk4[1], 4, pid, bit); + gSprites[ptr->unk9].oam.priority = priority; + } +} + +void sub_81B5A8C(u8 spriteId, s16 hp, s16 maxhp) +{ + switch (GetHPBarLevel(hp, maxhp)) + { + case HP_BAR_FULL: + sub_80D32C8(&gSprites[spriteId], 0); + break; + case HP_BAR_GREEN: + sub_80D32C8(&gSprites[spriteId], 1); + break; + case HP_BAR_YELLOW: + sub_80D32C8(&gSprites[spriteId], 2); + break; + case HP_BAR_RED: + sub_80D32C8(&gSprites[spriteId], 3); + break; + default: + sub_80D32C8(&gSprites[spriteId], 4); + break; + } +}