diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index e3094b955..e72b8b156 100644 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -15923,11 +15923,11 @@ sub_8197080: @ 8197080 b _0819715C _081970A2: movs r0, 0 - bl sub_80C0844 + bl GetHoennPokedexCount lsls r0, 16 lsrs r4, r0, 16 movs r0, 0x1 - bl sub_80C0844 + bl GetHoennPokedexCount lsls r0, 16 lsrs r6, r0, 16 ldr r0, =gStringVar1 @@ -15977,11 +15977,11 @@ _081970A2: strb r6, [r5] adds r5, 0x1 movs r0, 0 - bl pokedex_count + bl GetNationalPokedexCount lsls r0, 16 lsrs r4, r0, 16 movs r0, 0x1 - bl pokedex_count + bl GetNationalPokedexCount lsls r0, 16 lsrs r6, r0, 16 mov r0, r10 diff --git a/asm/birch_pc.s b/asm/birch_pc.s deleted file mode 100644 index 6665d9beb..000000000 --- a/asm/birch_pc.s +++ /dev/null @@ -1,234 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start ScriptGetPokedexInfo -ScriptGetPokedexInfo: @ 8137A4C - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _08137A70 - movs r0, 0 - bl sub_80C0844 - ldr r1, =gSpecialVar_0x8005 - strh r0, [r1] - movs r0, 0x1 - bl sub_80C0844 - b _08137A80 - .pool -_08137A70: - movs r0, 0 - bl pokedex_count - ldr r1, =gSpecialVar_0x8005 - strh r0, [r1] - movs r0, 0x1 - bl pokedex_count -_08137A80: - ldr r1, =gSpecialVar_0x8006 - strh r0, [r1] - bl IsNationalPokedexEnabled - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - .pool - thumb_func_end ScriptGetPokedexInfo - - thumb_func_start GetPokedexRatingText -GetPokedexRatingText: @ 8137A98 - push {lr} - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x9 - bhi _08137AA4 - b _08137BFC -_08137AA4: - cmp r0, 0x13 - bhi _08137AB0 - ldr r0, =gUnknown_082A5DAB - b _08137C06 - .pool -_08137AB0: - cmp r0, 0x1D - bhi _08137ABC - ldr r0, =gUnknown_082A5DF1 - b _08137C06 - .pool -_08137ABC: - cmp r0, 0x27 - bhi _08137AC8 - ldr r0, =gUnknown_082A5E34 - b _08137C06 - .pool -_08137AC8: - cmp r0, 0x31 - bhi _08137AD4 - ldr r0, =gUnknown_082A5E83 - b _08137C06 - .pool -_08137AD4: - cmp r0, 0x3B - bhi _08137AE0 - ldr r0, =gUnknown_082A5EB9 - b _08137C06 - .pool -_08137AE0: - cmp r0, 0x45 - bhi _08137AEC - ldr r0, =gUnknown_082A5EF4 - b _08137C06 - .pool -_08137AEC: - cmp r0, 0x4F - bhi _08137AF8 - ldr r0, =gUnknown_082A5F39 - b _08137C06 - .pool -_08137AF8: - cmp r0, 0x59 - bhi _08137B04 - ldr r0, =gUnknown_082A5F82 - b _08137C06 - .pool -_08137B04: - cmp r0, 0x63 - bhi _08137B10 - ldr r0, =gUnknown_082A5FB9 - b _08137C06 - .pool -_08137B10: - cmp r0, 0x6D - bhi _08137B1C - ldr r0, =gUnknown_082A6018 - b _08137C06 - .pool -_08137B1C: - cmp r0, 0x77 - bhi _08137B28 - ldr r0, =gUnknown_082A6061 - b _08137C06 - .pool -_08137B28: - cmp r0, 0x81 - bhi _08137B34 - ldr r0, =gUnknown_082A609C - b _08137C06 - .pool -_08137B34: - cmp r0, 0x8B - bhi _08137B40 - ldr r0, =gUnknown_082A60D5 - b _08137C06 - .pool -_08137B40: - cmp r0, 0x95 - bhi _08137B4C - ldr r0, =gUnknown_082A6124 - b _08137C06 - .pool -_08137B4C: - cmp r0, 0x9F - bhi _08137B58 - ldr r0, =gUnknown_082A616F - b _08137C06 - .pool -_08137B58: - cmp r0, 0xA9 - bhi _08137B64 - ldr r0, =gUnknown_082A61D6 - b _08137C06 - .pool -_08137B64: - cmp r0, 0xB3 - bhi _08137B70 - ldr r0, =gUnknown_082A623A - b _08137C06 - .pool -_08137B70: - cmp r0, 0xBD - bhi _08137B7C - ldr r0, =gUnknown_082A6287 - b _08137C06 - .pool -_08137B7C: - cmp r0, 0xC7 - bls _08137BEA - cmp r0, 0xC8 - bne _08137BB8 - ldr r0, =0x00000199 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetSetPokedexFlag - lsls r0, 24 - cmp r0, 0 - bne _08137BEA - movs r0, 0xCD - lsls r0, 1 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetSetPokedexFlag - lsls r0, 24 - cmp r0, 0 - bne _08137BEA - b _08137C04 - .pool -_08137BB8: - cmp r0, 0xC9 - bne _08137BF8 - ldr r0, =0x00000199 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetSetPokedexFlag - lsls r0, 24 - cmp r0, 0 - beq _08137C04 - movs r0, 0xCD - lsls r0, 1 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetSetPokedexFlag - lsls r0, 24 - cmp r0, 0 - beq _08137C04 -_08137BEA: - ldr r0, =gUnknown_082A62C9 - b _08137C06 - .pool -_08137BF8: - cmp r0, 0xCA - beq _08137C04 -_08137BFC: - ldr r0, =gUnknown_082A5D6C - b _08137C06 - .pool -_08137C04: - ldr r0, =gUnknown_082A6312 -_08137C06: - pop {r1} - bx r1 - .pool - thumb_func_end GetPokedexRatingText - - thumb_func_start ShowPokedexRatingMessage -ShowPokedexRatingMessage: @ 8137C10 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - bl GetPokedexRatingText - bl ShowFieldMessage - pop {r0} - bx r0 - .pool - thumb_func_end ShowPokedexRatingMessage diff --git a/asm/easy_chat.s b/asm/easy_chat.s index db2ffac14..0cbe1f1ae 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -9252,7 +9252,7 @@ start_menu_is_selected_item_valid: @ 811EA6C cmp r0, 0 bne _0811EA84 movs r0, 0 - bl pokedex_count + bl GetNationalPokedexCount lsls r0, 16 lsrs r0, 16 b _0811EA9A @@ -10369,7 +10369,7 @@ sub_811F2D4: @ 811F2D4 movs r5, 0 strh r5, [r0] movs r0, 0 - bl pokedex_count + bl GetNationalPokedexCount lsls r0, 16 cmp r0, 0 beq _0811F2FC diff --git a/asm/item_menu.s b/asm/item_menu.s deleted file mode 100644 index 654729a94..000000000 --- a/asm/item_menu.s +++ /dev/null @@ -1,6452 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start ResetBagScrollPositions -ResetBagScrollPositions: @ 81AAB70 - push {r4,lr} - ldr r4, =gUnknown_0203CE58 - movs r0, 0 - strb r0, [r4, 0x5] - adds r0, r4, 0 - adds r0, 0x8 - movs r1, 0 - movs r2, 0xA - bl memset - adds r4, 0x12 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0xA - bl memset - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ResetBagScrollPositions - - thumb_func_start CB2_BagMenuFromStartMenu -@ void CB2_BagMenuFromStartMenu() -CB2_BagMenuFromStartMenu: @ 81AAB9C - push {lr} - ldr r2, =CB2_ReturnToFieldWithOpenMenu - movs r0, 0 - movs r1, 0x5 - bl GoToBagMenu - pop {r0} - bx r0 - .pool - thumb_func_end CB2_BagMenuFromStartMenu - - thumb_func_start sub_81AABB0 -sub_81AABB0: @ 81AABB0 - push {lr} - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _081AABCC - ldr r2, =SetCB2ToReshowScreenAfterMenu2 - movs r0, 0x1 - movs r1, 0x5 - bl GoToBagMenu - b _081AABD4 - .pool -_081AABCC: - ldr r1, =SetCB2ToReshowScreenAfterMenu2 - movs r0, 0x1 - bl sub_81C4F98 -_081AABD4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AABB0 - - thumb_func_start CB2_ChooseBerry -CB2_ChooseBerry: @ 81AABDC - push {lr} - ldr r2, =sub_80861B0 - movs r0, 0x4 - movs r1, 0x3 - bl GoToBagMenu - pop {r0} - bx r0 - .pool - thumb_func_end CB2_ChooseBerry - - thumb_func_start sub_81AABF0 -sub_81AABF0: @ 81AABF0 - push {lr} - adds r2, r0, 0 - movs r0, 0x5 - movs r1, 0x3 - bl GoToBagMenu - pop {r0} - bx r0 - thumb_func_end sub_81AABF0 - - thumb_func_start CB2_GoToSellMenu -@ void CB2_GoToSellMenu() -CB2_GoToSellMenu: @ 81AAC00 - push {lr} - ldr r2, =CB2_ExitSellMenu - movs r0, 0x3 - movs r1, 0x5 - bl GoToBagMenu - pop {r0} - bx r0 - .pool - thumb_func_end CB2_GoToSellMenu - - thumb_func_start sub_81AAC14 -sub_81AAC14: @ 81AAC14 - push {lr} - ldr r2, =sub_816B31C - movs r0, 0x6 - movs r1, 0x5 - bl GoToBagMenu - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AAC14 - - thumb_func_start sub_81AAC28 -sub_81AAC28: @ 81AAC28 - push {lr} - ldr r2, =bag_menu_leave_maybe_3 - movs r0, 0x9 - movs r1, 0x5 - bl GoToBagMenu - ldr r0, =gSpecialVar_0x8005 - movs r1, 0 - strh r1, [r0] - ldr r0, =gSpecialVar_Result - strh r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AAC28 - - thumb_func_start sub_81AAC50 -sub_81AAC50: @ 81AAC50 - push {lr} - ldr r2, =bag_menu_leave_maybe_2 - movs r0, 0x7 - movs r1, 0x5 - bl GoToBagMenu - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AAC50 - - thumb_func_start sub_81AAC70 -sub_81AAC70: @ 81AAC70 - push {lr} - ldr r2, =bag_menu_leave_maybe - movs r0, 0x8 - movs r1, 0x5 - bl GoToBagMenu - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AAC70 - - thumb_func_start GoToBagMenu -@ void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()) -GoToBagMenu: @ 81AAC90 - push {r4-r7,lr} - adds r4, r2, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - ldr r6, =gUnknown_0203CE54 - ldr r0, =0x00000c48 - bl AllocZeroed - str r0, [r6] - cmp r0, 0 - bne _081AACBC - adds r0, r4, 0 - bl SetMainCallback2 - b _081AAD3A - .pool -_081AACBC: - ldr r0, =gUnknown_0203CE58 - cmp r5, 0xC - beq _081AACC4 - strb r5, [r0, 0x4] -_081AACC4: - cmp r4, 0 - beq _081AACCA - str r4, [r0] -_081AACCA: - cmp r7, 0x4 - bhi _081AACD0 - strb r7, [r0, 0x5] -_081AACD0: - ldrb r0, [r0, 0x4] - subs r0, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081AACF0 - ldr r2, [r6] - ldr r0, =0x0000081b - adds r2, r0 - ldrb r1, [r2] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] -_081AACF0: - ldr r0, [r6] - movs r1, 0 - str r1, [r0] - ldr r1, =0x0000081a - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r6] - ldr r1, =0x0000081e - adds r0, r1 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - ldr r0, [r6] - ldr r1, =0x0000081f - adds r0, r1 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - ldr r0, [r6] - ldr r1, =0x00000804 - adds r0, r1 - movs r1, 0xFF - movs r2, 0xC - bl memset - ldr r0, [r6] - movs r1, 0x81 - lsls r1, 4 - adds r0, r1 - movs r1, 0xFF - movs r2, 0xA - bl memset - ldr r0, =CB2_Bag - bl SetMainCallback2 -_081AAD3A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end GoToBagMenu - - thumb_func_start c2_bag_3 -c2_bag_3: @ 81AAD5C - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl do_scheduled_bg_tilemap_copies_to_vram - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end c2_bag_3 - - thumb_func_start vblank_cb_bag_menu -vblank_cb_bag_menu: @ 81AAD78 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end vblank_cb_bag_menu - - thumb_func_start CB2_Bag -CB2_Bag: @ 81AAD8C - push {lr} -_081AAD8E: - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081AADB2 - bl setup_bag_menu - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081AADB2 - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081AAD8E -_081AADB2: - pop {r0} - bx r0 - thumb_func_end CB2_Bag - - thumb_func_start setup_bag_menu -setup_bag_menu: @ 81AADB8 - push {r4,r5,lr} - sub sp, 0x4 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0x14 - bls _081AADCE - b _081AB02C -_081AADCE: - lsls r0, 2 - ldr r1, =_081AADE0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081AADE0: - .4byte _081AAE34 - .4byte _081AAE3E - .4byte _081AAE50 - .4byte _081AAE56 - .4byte _081AAE78 - .4byte _081AAE7E - .4byte _081AAE86 - .4byte _081AAEA4 - .4byte _081AAECC - .4byte _081AAEDA - .4byte _081AAEEC - .4byte _081AAEFA - .4byte _081AAF0C - .4byte _081AAF1C - .4byte _081AAF54 - .4byte _081AAFA0 - .4byte _081AAFBC - .4byte _081AAFC2 - .4byte _081AAFD8 - .4byte _081AAFDE - .4byte _081AAFF8 -_081AAE34: - bl SetVBlankHBlankCallbacksToNull - bl clear_scheduled_bg_copies_to_vram - b _081AB012 -_081AAE3E: - bl ScanlineEffect_Stop - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAE50: - bl FreeAllSpritePalettes - b _081AB012 -_081AAE56: - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAE78: - bl ResetSpriteData - b _081AB012 -_081AAE7E: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - b _081AB01A -_081AAE86: - bl sub_81221AC - lsls r0, 24 - cmp r0, 0 - bne _081AAE94 - bl ResetTasks -_081AAE94: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAEA4: - bl bag_menu_init_bgs - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x00000834 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAECC: - bl load_bag_menu_graphics - lsls r0, 24 - cmp r0, 0 - bne _081AAED8 - b _081AB044 -_081AAED8: - b _081AB012 -_081AAEDA: - bl setup_bag_menu_textboxes - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAEEC: - bl sub_81ABA6C - bl sub_81ABAC4 - bl sub_81ABAE0 - b _081AB012 -_081AAEFA: - bl allocate_bag_item_list_buffers - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAF0C: - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - bl load_bag_item_list_buffers - b _081AB012 - .pool -_081AAF1C: - ldr r1, =gPocketNamesStringsTable - ldr r4, =gUnknown_0203CE58 - ldrb r0, [r4, 0x5] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl bag_menu_print_pocket_names - movs r0, 0 - bl bag_menu_copy_pocket_name_to_window - ldrb r0, [r4, 0x5] - movs r1, 0x1 - bl bag_menu_draw_pocket_indicator_square - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAF54: - ldr r4, =gUnknown_0203CE58 - ldrb r0, [r4, 0x4] - bl sub_81AB1F0 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gMultiuseListMenuTemplate - ldrb r2, [r4, 0x5] - lsls r2, 1 - adds r1, r4, 0 - adds r1, 0x12 - adds r1, r2, r1 - ldrh r1, [r1] - adds r4, 0x8 - adds r2, r4 - ldrh r2, [r2] - bl ListMenuInit - ldr r2, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - movs r2, 0 - strh r0, [r1, 0x8] - strh r2, [r1, 0xE] - strh r2, [r1, 0x18] - b _081AB012 - .pool -_081AAFA0: - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - bl AddBagVisualObject - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAFBC: - bl sub_80D4FAC - b _081AB012 -_081AAFC2: - bl bag_menu_add_pocket_scroll_arrow_indicators_maybe - bl bag_menu_add_list_scroll_arrow_indicators_maybe - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAFD8: - bl bag_menu_prepare_tmhm_move_window - b _081AB012 -_081AAFDE: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _081AB01A - .pool -_081AAFF8: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] -_081AB012: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_081AB01A: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _081AB044 - .pool -_081AB02C: - ldr r0, =vblank_cb_bag_menu - bl SetVBlankCallback - ldr r0, =c2_bag_3 - bl SetMainCallback2 - movs r0, 0x1 - b _081AB046 - .pool -_081AB044: - movs r0, 0 -_081AB046: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end setup_bag_menu - - thumb_func_start bag_menu_init_bgs -bag_menu_init_bgs: @ 81AB050 - push {r4,lr} - bl ResetVramOamAndBgCntRegs - ldr r4, =gUnknown_0203CE54 - ldr r0, [r4] - adds r0, 0x4 - movs r2, 0x80 - lsls r2, 4 - movs r1, 0 - bl memset - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_08613F90 - movs r0, 0 - movs r2, 0x3 - bl InitBgsFromTemplates - ldr r1, [r4] - adds r1, 0x4 - movs r0, 0x2 - bl SetBgTilemapBuffer - bl ResetAllBgsCoordinates - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_init_bgs - - thumb_func_start load_bag_menu_graphics -load_bag_menu_graphics: @ 81AB0BC - push {r4,lr} - sub sp, 0x4 - ldr r4, =gUnknown_0203CE54 - ldr r0, [r4] - ldr r1, =0x00000834 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x4 - bls _081AB0D2 - b _081AB1CC -_081AB0D2: - lsls r0, 2 - ldr r1, =_081AB0E8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081AB0E8: - .4byte _081AB0FC - .4byte _081AB118 - .4byte _081AB13C - .4byte _081AB174 - .4byte _081AB1A8 -_081AB0FC: - bl reset_temp_tile_data_buffers - ldr r1, =gBagScreen_Gfx - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _081AB1AE - .pool -_081AB118: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081AB1E4 - ldr r0, =gUnknown_08D9A88C - ldr r4, =gUnknown_0203CE54 - ldr r1, [r4] - adds r1, 0x4 - bl LZDecompressWram - ldr r1, [r4] - b _081AB1B2 - .pool -_081AB13C: - bl IsWallysBag - lsls r0, 24 - cmp r0, 0 - bne _081AB164 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - beq _081AB164 - ldr r0, =gBagScreenFemale_Pal - movs r1, 0 - movs r2, 0x40 - bl LoadCompressedPalette - b _081AB1AE - .pool -_081AB164: - ldr r0, =gBagScreenMale_Pal - movs r1, 0 - movs r2, 0x40 - bl LoadCompressedPalette - b _081AB1AE - .pool -_081AB174: - bl IsWallysBag - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081AB18A - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _081AB19C -_081AB18A: - ldr r0, =gUnknown_0857FB34 - bl LoadCompressedObjectPic - b _081AB1AE - .pool -_081AB19C: - ldr r0, =gUnknown_0857FB3C - bl LoadCompressedObjectPic - b _081AB1AE - .pool -_081AB1A8: - ldr r0, =gUnknown_0857FB44 - bl LoadCompressedObjectPalette -_081AB1AE: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] -_081AB1B2: - ldr r0, =0x00000834 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _081AB1E4 - .pool -_081AB1CC: - bl LoadListMenuArrowsGfx - ldr r0, [r4] - ldr r1, =0x00000834 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - movs r0, 0x1 - b _081AB1E6 - .pool -_081AB1E4: - movs r0, 0 -_081AB1E6: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end load_bag_menu_graphics - - thumb_func_start sub_81AB1F0 -sub_81AB1F0: @ 81AB1F0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xA - bne _081AB204 - ldr r0, =Task_WallyTutorialBagMenu - b _081AB206 - .pool -_081AB204: - ldr r0, =Task_BagMenu -_081AB206: - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81AB1F0 - - thumb_func_start allocate_bag_item_list_buffers -allocate_bag_item_list_buffers: @ 81AB218 - push {r4,lr} - ldr r4, =gUnknown_0203CE74 - movs r0, 0x82 - lsls r0, 2 - bl Alloc - str r0, [r4] - ldr r4, =gUnknown_0203CE78 - movs r0, 0xC3 - lsls r0, 3 - bl Alloc - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end allocate_bag_item_list_buffers - - thumb_func_start load_bag_item_list_buffers -@ void load_bag_item_list_buffers(int pocket_id) -load_bag_item_list_buffers: @ 81AB240 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, r7, 3 - ldr r0, =gBagPockets - adds r1, r0 - mov r8, r1 - ldr r0, =gUnknown_0203CE54 - ldr r2, [r0] - ldr r1, =0x0000081b - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081AB2FC - movs r6, 0 - ldr r3, =0x00000829 - adds r0, r2, r3 - adds r0, r7 - ldrb r0, [r0] - subs r0, 0x1 - cmp r6, r0 - bge _081AB2B6 - ldr r5, =gUnknown_0203CE78 -_081AB276: - lsls r4, r6, 1 - adds r4, r6 - lsls r4, 3 - ldr r0, [r5] - adds r0, r4 - mov r1, r8 - ldr r2, [r1] - lsls r1, r6, 2 - adds r1, r2 - ldrh r1, [r1] - bl get_name - ldr r0, =gUnknown_0203CE74 - ldr r0, [r0] - lsls r1, r6, 3 - adds r1, r0 - ldr r0, [r5] - adds r0, r4 - str r0, [r1] - str r6, [r1, 0x4] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r3, =0x00000829 - adds r0, r3 - adds r0, r7 - ldrb r0, [r0] - subs r0, 0x1 - cmp r6, r0 - blt _081AB276 -_081AB2B6: - ldr r5, =gUnknown_0203CE78 - lsls r4, r6, 1 - adds r4, r6 - lsls r4, 3 - ldr r0, [r5] - adds r0, r4 - ldr r1, =gText_CloseBag - bl StringCopy - ldr r0, =gUnknown_0203CE74 - ldr r0, [r0] - lsls r1, r6, 3 - adds r1, r0 - ldr r0, [r5] - adds r0, r4 - str r0, [r1] - movs r0, 0x2 - negs r0, r0 - str r0, [r1, 0x4] - b _081AB34A - .pool -_081AB2FC: - movs r6, 0 - ldr r4, =0x00000829 - adds r0, r2, r4 - adds r0, r7 - ldrb r0, [r0] - cmp r6, r0 - bcs _081AB34A - ldr r5, =gUnknown_0203CE78 -_081AB30C: - lsls r4, r6, 1 - adds r4, r6 - lsls r4, 3 - ldr r0, [r5] - adds r0, r4 - mov r1, r8 - ldr r2, [r1] - lsls r1, r6, 2 - adds r1, r2 - ldrh r1, [r1] - bl get_name - ldr r0, =gUnknown_0203CE74 - ldr r0, [r0] - lsls r1, r6, 3 - adds r1, r0 - ldr r0, [r5] - adds r0, r4 - str r0, [r1] - str r6, [r1, 0x4] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r3, =0x00000829 - adds r0, r3 - adds r0, r7 - ldrb r0, [r0] - cmp r6, r0 - bcc _081AB30C -_081AB34A: - ldr r2, =gMultiuseListMenuTemplate - adds r1, r2, 0 - ldr r0, =gUnknown_08613F9C - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r4, =0x00000829 - adds r0, r1, r4 - adds r0, r7 - ldrb r0, [r0] - strh r0, [r2, 0xC] - ldr r0, =gUnknown_0203CE74 - ldr r0, [r0] - str r0, [r2] - ldr r5, =0x0000082e - adds r1, r5 - adds r1, r7 - ldrb r0, [r1] - strh r0, [r2, 0xE] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end load_bag_item_list_buffers - - thumb_func_start get_name -@ void get_name(char *dest, int name_id) -get_name: @ 81AB39C - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - cmp r0, 0x2 - beq _081AB3C0 - cmp r0, 0x3 - beq _081AB420 - adds r0, r5, 0 - adds r1, r6, 0 - bl CopyItemName - b _081AB43E - .pool -_081AB3C0: - ldr r4, =gStringVar2 - adds r0, r5, 0 - bl ItemIdToBattleMoveId - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xD - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - movs r0, 0xA9 - lsls r0, 1 - cmp r5, r0 - bls _081AB408 - ldr r0, =gStringVar1 - ldr r2, =0xfffffeae - adds r1, r5, r2 - movs r2, 0x2 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r1, =gText_ClearTo11Var1Clear5Var2 - b _081AB438 - .pool -_081AB408: - ldr r0, =gStringVar1 - ldr r2, =0xfffffee0 - adds r1, r5, r2 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - b _081AB436 - .pool -_081AB420: - ldr r0, =gStringVar1 - adds r1, r5, 0 - subs r1, 0x84 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r1, =gStringVar2 - adds r0, r5, 0 - bl CopyItemName -_081AB436: - ldr r1, =gText_UnkF908Var1Clear7Var2 -_081AB438: - adds r0, r6, 0 - bl StringExpandPlaceholders -_081AB43E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end get_name - - thumb_func_start bag_menu_change_item_callback -bag_menu_change_item_callback: @ 81AB450 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x1 - beq _081AB466 - movs r0, 0x5 - bl PlaySE - bl ShakeBagVisual -_081AB466: - ldr r4, =gUnknown_0203CE54 - ldr r1, [r4] - ldr r2, =0x0000081a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xFF - bne _081AB50C - adds r2, 0x1 - adds r0, r1, r2 - ldrb r1, [r0] - lsls r1, 26 - lsrs r1, 30 - movs r0, 0x1 - eors r0, r1 - bl RemoveBagItemIconObject - movs r0, 0x2 - negs r0, r0 - cmp r6, r0 - beq _081AB4C8 - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r6, 16 - lsrs r1, 16 - bl BagGetItemIdByPocketPosition - lsls r0, 16 - lsrs r0, 16 - ldr r1, [r4] - ldr r2, =0x0000081b - adds r1, r2 - ldrb r1, [r1] - lsls r1, 26 - lsrs r1, 30 - bl AddBagItemIconObject - b _081AB4DA - .pool -_081AB4C8: - ldr r0, =0x0000ffff - ldr r1, [r4] - ldr r2, =0x0000081b - adds r1, r2 - ldrb r1, [r1] - lsls r1, 26 - lsrs r1, 30 - bl AddBagItemIconObject -_081AB4DA: - ldr r5, =gUnknown_0203CE54 - ldr r2, [r5] - ldr r4, =0x0000081b - adds r2, r4 - ldrb r3, [r2] - lsls r0, r3, 26 - lsrs r0, 30 - movs r1, 0x1 - eors r1, r0 - lsls r1, 4 - movs r0, 0x31 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldr r0, [r5] - adds r0, r4 - ldrb r1, [r0] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _081AB50C - adds r0, r6, 0 - bl bag_menu_print_description_box_text -_081AB50C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_change_item_callback - - thumb_func_start sub_81AB520 -@ void sub_81AB520(u8 rbox_id, int item_index_in_pocket, int a3) -sub_81AB520: @ 81AB520 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x14 - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r2, 24 - lsrs r7, r2, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - bne _081AB540 - b _081AB696 -_081AB540: - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x0000081a - adds r0, r1 - ldrb r1, [r0] - cmp r1, 0xFF - beq _081AB570 - lsls r0, r4, 24 - lsrs r0, 24 - cmp r1, r0 - bne _081AB568 - adds r0, r7, 0 - movs r1, 0x2 - bl bag_menu_print_cursor - b _081AB570 - .pool -_081AB568: - adds r0, r7, 0 - movs r1, 0xFF - bl bag_menu_print_cursor -_081AB570: - ldr r5, =gUnknown_0203CE58 - ldrb r0, [r5, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 16 - lsrs r4, 16 - adds r1, r4, 0 - bl BagGetItemIdByPocketPosition - lsls r0, 16 - lsrs r6, r0, 16 - ldrb r0, [r5, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl BagGetQuantityByPocketPosition - lsls r0, 16 - lsrs r4, r0, 16 - mov r9, r4 - ldr r1, =0xfffffead - adds r0, r6, r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x7 - bhi _081AB5BE - ldr r1, =gBagMenuHMIcon_Gfx - subs r3, r7, 0x1 - lsls r3, 16 - lsrs r3, 16 - movs r0, 0x10 - str r0, [sp] - str r0, [sp, 0x4] - mov r0, r8 - movs r2, 0x8 - bl BlitBitmapToWindow -_081AB5BE: - ldrb r0, [r5, 0x5] - cmp r0, 0x3 - bne _081AB610 - ldr r0, =gStringVar1 - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_xVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x7 - adds r1, r4, 0 - movs r2, 0x77 - bl GetStringRightAlignXOffset - lsls r3, r0, 24 - lsrs r3, 24 - str r7, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r0, 0xFF - str r0, [sp, 0xC] - str r1, [sp, 0x10] - b _081AB652 - .pool -_081AB610: - cmp r0, 0x4 - beq _081AB66C - adds r0, r6, 0 - bl itemid_is_unique - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _081AB66C - ldr r0, =gStringVar1 - mov r1, r9 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_xVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x7 - adds r1, r4, 0 - movs r2, 0x77 - bl GetStringRightAlignXOffset - lsls r3, r0, 24 - lsrs r3, 24 - str r7, [sp] - str r5, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0xFF - str r0, [sp, 0xC] - str r5, [sp, 0x10] -_081AB652: - mov r0, r8 - movs r1, 0x7 - adds r2, r4, 0 - bl bag_menu_print - b _081AB696 - .pool -_081AB66C: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00000496 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _081AB696 - cmp r0, r6 - bne _081AB696 - ldr r1, =gUnknown_086140A4 - subs r3, r7, 0x1 - lsls r3, 16 - lsrs r3, 16 - movs r0, 0x18 - str r0, [sp] - movs r0, 0x10 - str r0, [sp, 0x4] - mov r0, r8 - movs r2, 0x60 - bl BlitBitmapToWindow -_081AB696: - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AB520 - - thumb_func_start bag_menu_print_description_box_text -@ void bag_menu_print_description_box_text(int a1) -bag_menu_print_description_box_text: @ 81AB6B0 - push {r4,lr} - sub sp, 0x14 - adds r1, r0, 0 - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _081AB6E0 - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r1, 16 - bl BagGetItemIdByPocketPosition - lsls r0, 16 - lsrs r0, 16 - bl ItemId_GetDescription - adds r4, r0, 0 - b _081AB6FC - .pool -_081AB6E0: - ldr r0, =gStringVar1 - ldr r2, =gReturnToXStringsTable - ldr r1, =gUnknown_0203CE58 - ldrb r1, [r1, 0x4] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_ReturnToVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders -_081AB6FC: - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x3 - bl bag_menu_print - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_print_description_box_text - - thumb_func_start bag_menu_print_cursor_ -bag_menu_print_cursor_: @ 81AB73C - push {r4,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - bl ListMenuGetYCoordForPrintingArrowCursor - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl bag_menu_print_cursor - pop {r4} - pop {r0} - bx r0 - thumb_func_end bag_menu_print_cursor_ - - thumb_func_start bag_menu_print_cursor -bag_menu_print_cursor: @ 81AB75C - push {r4,r5,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0xFF - bne _081AB798 - movs r0, 0x1 - movs r1, 0 - bl GetMenuCursorDimensionByFont - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - movs r1, 0x1 - bl GetMenuCursorDimensionByFont - lsls r0, 24 - lsrs r0, 24 - str r4, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - adds r3, r5, 0 - bl FillWindowPixelRect - b _081AB7AE -_081AB798: - ldr r2, =gText_SelectorArrow2 - str r5, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0 - bl bag_menu_print -_081AB7AE: - add sp, 0x14 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_print_cursor - - thumb_func_start bag_menu_add_pocket_scroll_arrow_indicators_maybe -bag_menu_add_pocket_scroll_arrow_indicators_maybe: @ 81AB7BC - push {r4-r6,lr} - sub sp, 0x10 - ldr r5, =gUnknown_0203CE54 - ldr r4, [r5] - ldr r1, =0x0000081e - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0xFF - bne _081AB80A - ldr r2, =gUnknown_0203CE58 - ldrb r3, [r2, 0x5] - ldr r6, =0x00000829 - adds r0, r4, r6 - adds r0, r3 - ldrb r1, [r0] - adds r6, 0x5 - adds r0, r4, r6 - adds r0, r3 - ldrb r0, [r0] - subs r1, r0 - str r1, [sp] - movs r0, 0x6E - str r0, [sp, 0x4] - str r0, [sp, 0x8] - ldrb r0, [r2, 0x5] - lsls r0, 1 - adds r2, 0x12 - adds r0, r2 - str r0, [sp, 0xC] - movs r0, 0x2 - movs r1, 0xAC - movs r2, 0xC - movs r3, 0x94 - bl AddScrollIndicatorArrowPairParametrized - ldr r1, [r5] - ldr r2, =0x0000081e - adds r1, r2 - strb r0, [r1] -_081AB80A: - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_add_pocket_scroll_arrow_indicators_maybe - - thumb_func_start sub_81AB824 -sub_81AB824: @ 81AB824 - push {r4,lr} - ldr r4, =gUnknown_0203CE54 - ldr r0, [r4] - ldr r2, =0x0000081e - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _081AB842 - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r1, =0x0000081e - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] -_081AB842: - bl sub_81AB89C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AB824 - - thumb_func_start bag_menu_add_list_scroll_arrow_indicators_maybe -bag_menu_add_list_scroll_arrow_indicators_maybe: @ 81AB854 - push {r4,lr} - ldr r4, =gUnknown_0203CE54 - ldr r2, [r4] - ldr r1, =0x0000081b - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - beq _081AB882 - ldr r1, =0x0000081f - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0xFF - bne _081AB882 - ldr r0, =gUnknown_08614094 - ldr r1, =gUnknown_0203CE5E - bl AddScrollIndicatorArrowPair - ldr r1, [r4] - ldr r2, =0x0000081f - adds r1, r2 - strb r0, [r1] -_081AB882: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_add_list_scroll_arrow_indicators_maybe - - thumb_func_start sub_81AB89C -sub_81AB89C: @ 81AB89C - push {r4,lr} - ldr r4, =gUnknown_0203CE54 - ldr r0, [r4] - ldr r2, =0x0000081f - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _081AB8BA - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r1, =0x0000081f - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] -_081AB8BA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AB89C - - thumb_func_start free_bag_item_list_buffers -free_bag_item_list_buffers: @ 81AB8C8 - push {lr} - ldr r0, =gUnknown_0203CE78 - ldr r0, [r0] - bl Free - ldr r0, =gUnknown_0203CE74 - ldr r0, [r0] - bl Free - bl FreeAllWindowBuffers - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end free_bag_item_list_buffers - - thumb_func_start unknown_ItemMenu_Confirm -unknown_ItemMenu_Confirm: @ 81AB8F8 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task_close_bag_menu_2 - str r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end unknown_ItemMenu_Confirm - - thumb_func_start task_close_bag_menu_2 -task_close_bag_menu_2: @ 81AB930 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r2, r0, r1 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081AB9A0 - ldrb r0, [r2] - ldr r4, =gUnknown_0203CE58 - ldrb r2, [r4, 0x5] - lsls r2, 1 - adds r1, r4, 0 - adds r1, 0x12 - adds r1, r2, r1 - adds r3, r4, 0 - adds r3, 0x8 - adds r2, r3 - bl sub_81AE6C8 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - beq _081AB984 - bl SetMainCallback2 - b _081AB98A - .pool -_081AB984: - ldr r0, [r4] - bl SetMainCallback2 -_081AB98A: - bl sub_81AB824 - bl ResetSpriteData - bl FreeAllSpritePalettes - bl free_bag_item_list_buffers - adds r0, r5, 0 - bl DestroyTask -_081AB9A0: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end task_close_bag_menu_2 - - thumb_func_start sub_81AB9A8 -sub_81AB9A8: @ 81AB9A8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, r5, 3 - ldr r0, =gBagPockets - adds r4, r1, r0 - cmp r5, 0x3 - bgt _081AB9C8 - cmp r5, 0x2 - blt _081AB9C8 - adds r0, r4, 0 - bl sub_80D6FB4 - b _081AB9CE - .pool -_081AB9C8: - adds r0, r4, 0 - bl sub_80D6F64 -_081AB9CE: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r6, =0x00000829 - adds r1, r6 - adds r1, r5 - movs r2, 0 - strb r2, [r1] - adds r3, r0, 0 - ldrb r0, [r4, 0x4] - cmp r2, r0 - bcs _081ABA12 - ldr r0, [r4] - ldrh r0, [r0] - cmp r0, 0 - beq _081ABA12 - adds r7, r3, 0 -_081AB9EE: - ldr r0, [r7] - adds r0, r6 - adds r0, r5 - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - ldrb r1, [r4, 0x4] - cmp r2, r1 - bcs _081ABA12 - ldr r0, [r4] - lsls r1, r2, 2 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _081AB9EE -_081ABA12: - ldr r2, [r3] - ldr r1, =0x0000081b - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081ABA2E - ldr r0, =0x00000829 - adds r1, r2, r0 - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_081ABA2E: - ldr r1, [r3] - ldr r2, =0x00000829 - adds r0, r1, r2 - adds r0, r5 - ldrb r2, [r0] - cmp r2, 0x8 - bls _081ABA58 - ldr r3, =0x0000082e - adds r0, r1, r3 - adds r0, r5 - movs r1, 0x8 - strb r1, [r0] - b _081ABA60 - .pool -_081ABA58: - ldr r3, =0x0000082e - adds r0, r1, r3 - adds r0, r5 - strb r2, [r0] -_081ABA60: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AB9A8 - - thumb_func_start sub_81ABA6C -sub_81ABA6C: @ 81ABA6C - push {r4,lr} - movs r4, 0 -_081ABA70: - adds r0, r4, 0 - bl sub_81AB9A8 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _081ABA70 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81ABA6C - - thumb_func_start sub_81ABA88 -sub_81ABA88: @ 81ABA88 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - ldr r2, =gUnknown_0203CE6A - adds r4, r1, r2 - subs r2, 0xA - adds r1, r2 - ldr r2, =gUnknown_0203CE54 - ldr r3, [r2] - ldr r5, =0x0000082e - adds r2, r3, r5 - adds r2, r0 - ldrb r2, [r2] - subs r5, 0x5 - adds r3, r5 - adds r3, r0 - ldrb r3, [r3] - adds r0, r4, 0 - bl sub_812225C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81ABA88 - - thumb_func_start sub_81ABAC4 -sub_81ABAC4: @ 81ABAC4 - push {r4,lr} - movs r4, 0 -_081ABAC8: - adds r0, r4, 0 - bl sub_81ABA88 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _081ABAC8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81ABAC4 - - thumb_func_start sub_81ABAE0 -sub_81ABAE0: @ 81ABAE0 - push {r4-r7,lr} - sub sp, 0x4 - movs r5, 0 - ldr r6, =gUnknown_0203CE6A - adds r7, r6, 0 - subs r7, 0xA -_081ABAEC: - lsls r1, r5, 1 - adds r0, r1, r6 - adds r1, r7 - ldr r2, =gUnknown_0203CE54 - ldr r3, [r2] - ldr r4, =0x0000082e - adds r2, r3, r4 - adds r2, r5 - ldrb r2, [r2] - subs r4, 0x5 - adds r3, r4 - adds r3, r5 - ldrb r3, [r3] - movs r4, 0x8 - str r4, [sp] - bl sub_8122298 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _081ABAEC - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81ABAE0 - - thumb_func_start sub_81ABB2C -sub_81ABB2C: @ 81ABB2C - lsls r0, 24 - ldr r1, =gUnknown_0203CE58 - lsrs r0, 23 - adds r2, r1, 0 - adds r2, 0x12 - adds r2, r0, r2 - adds r1, 0x8 - adds r0, r1 - ldrb r0, [r0] - ldrb r2, [r2] - adds r0, r2 - lsls r0, 24 - lsrs r0, 24 - bx lr - .pool - thumb_func_end sub_81ABB2C - - thumb_func_start DisplayItemMessage -@ void DisplayItemMessage(u8 taskId, u8 fontId, u8 *str, void ( *callback)(u8 taskId)) -DisplayItemMessage: @ 81ABB4C - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x10 - adds r5, r0, 0 - adds r6, r1, 0 - mov r8, r2 - mov r9, r3 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - movs r0, 0x4 - bl AddItemMessageWindow - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x14] - movs r1, 0x11 - bl FillWindowPixelBuffer - bl GetPlayerTextSpeed - lsls r0, 24 - lsrs r0, 24 - ldrb r1, [r4, 0x14] - str r6, [sp] - str r0, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - mov r0, r9 - str r0, [sp, 0xC] - adds r0, r5, 0 - movs r2, 0xA - movs r3, 0xD - bl DisplayMessageAndContinueTask - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end DisplayItemMessage - - thumb_func_start bag_menu_inits_lists_menu -bag_menu_inits_lists_menu: @ 81ABBBC - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - lsls r6, 24 - lsrs r6, 24 - lsls r5, r6, 2 - adds r5, r6 - lsls r5, 3 - ldr r0, =gTasks + 0x8 - adds r5, r0 - ldr r7, =gUnknown_0203CE58 - ldrb r4, [r7, 0x5] - lsls r4, 1 - movs r0, 0x12 - adds r0, r7 - mov r8, r0 - add r8, r4 - adds r0, r7, 0 - adds r0, 0x8 - adds r4, r0 - movs r0, 0x4 - bl bag_menu_RemoveBagItem_message_window - ldrb r0, [r5] - mov r1, r8 - adds r2, r4, 0 - bl sub_81AE6C8 - ldrb r0, [r7, 0x5] - bl sub_81AB9A8 - ldrb r0, [r7, 0x5] - bl sub_81ABA88 - ldrb r0, [r7, 0x5] - bl load_bag_item_list_buffers - ldr r0, =gMultiuseListMenuTemplate - mov r2, r8 - ldrh r1, [r2] - ldrh r2, [r4] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5] - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r6, 0 - bl set_callback3_to_bag - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_inits_lists_menu - - thumb_func_start sub_81ABC3C -sub_81ABC3C: @ 81ABC3C - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl bag_menu_add_window - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl sub_81ABC54 - pop {r0} - bx r0 - thumb_func_end sub_81ABC3C - - thumb_func_start sub_81ABC54 -sub_81ABC54: @ 81ABC54 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 16 - lsrs r1, 16 - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - movs r3, 0x2 - cmp r0, 0x3 - bne _081ABC6C - movs r3, 0x3 -_081ABC6C: - ldr r0, =gStringVar1 - lsls r1, 16 - asrs r1, 16 - movs r2, 0x2 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_xVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x28 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x2 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl PrintTextOnWindow - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81ABC54 - - thumb_func_start sub_81ABCC0 -sub_81ABCC0: @ 81ABCC0 - push {r4-r7,lr} - sub sp, 0xC - adds r4, r0, 0 - adds r7, r2, 0 - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - movs r3, 0x2 - cmp r0, 0x3 - bne _081ABCD4 - movs r3, 0x3 -_081ABCD4: - ldr r0, =gStringVar1 - movs r2, 0x2 - bl ConvertIntToDecimalStringN - ldr r6, =gStringVar4 - ldr r1, =gText_xVar1 - adds r0, r6, 0 - bl StringExpandPlaceholders - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - adds r0, r4, 0 - movs r1, 0x1 - adds r2, r6, 0 - movs r3, 0 - bl PrintTextOnWindow - str r5, [sp] - adds r0, r4, 0 - movs r1, 0x26 - movs r2, 0x1 - adds r3, r7, 0 - bl PrintMoneyAmount - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81ABCC0 - - thumb_func_start Task_BagMenu -Task_BagMenu: @ 81ABD28 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r0, 2 - add r0, r9 - lsls r0, 3 - str r0, [sp] - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - ldr r5, =gUnknown_0203CE58 - ldrb r0, [r5, 0x5] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x12 - adds r7, r0, r1 - subs r1, 0xA - adds r0, r1 - mov r8, r0 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081ABD66 - b _081ABEB2 -_081ABD66: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081ABD74 - b _081ABEB2 -_081ABD74: - bl GetSwitchBagPocketDirection - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081ABDB8 - cmp r0, 0x2 - beq _081ABDC0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - cmp r0, 0 - beq _081ABE10 - bl sub_81AC2C0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081ABDA4 - b _081ABEB2 -_081ABDA4: - b _081ABDCC - .pool -_081ABDB8: - movs r1, 0x1 - negs r1, r1 - mov r0, r9 - b _081ABDC4 -_081ABDC0: - mov r0, r9 - movs r1, 0x1 -_081ABDC4: - movs r2, 0 - bl SwitchBagPocket - b _081ABEB2 -_081ABDCC: - ldrb r0, [r6] - adds r1, r7, 0 - mov r2, r8 - bl sub_81AE860 - ldrh r2, [r7] - mov r3, r8 - ldrh r0, [r3] - adds r2, r0 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =gUnknown_0203CE58 - ldr r3, =0x00000829 - adds r0, r3 - ldrb r1, [r1, 0x5] - adds r0, r1 - ldrb r0, [r0] - subs r0, 0x1 - cmp r2, r0 - beq _081ABEB2 - movs r0, 0x5 - bl PlaySE - mov r0, r9 - bl bag_menu_swap_items - b _081ABEB2 - .pool -_081ABE10: - ldrb r0, [r6] - bl ListMenuHandleInputGetItemId - adds r4, r0, 0 - ldrb r0, [r6] - adds r1, r7, 0 - mov r2, r8 - bl sub_81AE860 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _081ABE32 - adds r0, 0x1 - cmp r4, r0 - bne _081ABE68 - b _081ABEB2 -_081ABE32: - ldrb r0, [r5, 0x4] - cmp r0, 0x5 - bne _081ABE40 - movs r0, 0x20 - bl PlaySE - b _081ABEB2 -_081ABE40: - movs r0, 0x5 - bl PlaySE - ldr r0, =gSpecialVar_ItemId - mov r1, r10 - strh r1, [r0] - ldr r0, =gTasks + 0x8 - subs r0, 0x8 - ldr r3, [sp] - adds r0, r3, r0 - ldr r1, =unknown_ItemMenu_Confirm - str r1, [r0] - b _081ABEB2 - .pool -_081ABE68: - movs r0, 0x5 - bl PlaySE - bl sub_81AB824 - ldrb r0, [r6] - movs r1, 0x2 - bl bag_menu_print_cursor_ - strh r4, [r6, 0x2] - ldrb r0, [r5, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 16 - lsrs r4, 16 - adds r1, r4, 0 - bl BagGetQuantityByPocketPosition - strh r0, [r6, 0x4] - ldrb r0, [r5, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl BagGetItemIdByPocketPosition - ldr r1, =gSpecialVar_ItemId - strh r0, [r1] - ldr r1, =gUnknown_08614054 - ldrb r0, [r5, 0x4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - mov r0, r9 - bl _call_via_r1 -_081ABEB2: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end Task_BagMenu - - thumb_func_start set_callback3_to_bag -set_callback3_to_bag: @ 81ABECC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl bag_menu_add_pocket_scroll_arrow_indicators_maybe - bl bag_menu_add_list_scroll_arrow_indicators_maybe - movs r0, 0x3 - bl ClearWindowTilemap - movs r0, 0x4 - bl ClearWindowTilemap - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0 - 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, =Task_BagMenu - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end set_callback3_to_bag - - thumb_func_start GetSwitchBagPocketDirection -GetSwitchBagPocketDirection: @ 81ABF10 - push {lr} - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x0000081b - adds r0, r1 - ldrb r1, [r0] - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - bne _081ABF6A - bl GetLRKeysState - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081ABF3C - cmp r2, 0x1 - bne _081ABF54 -_081ABF3C: - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - b _081ABF6C - .pool -_081ABF54: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081ABF60 - cmp r2, 0x2 - bne _081ABF6A -_081ABF60: - movs r0, 0x5 - bl PlaySE - movs r0, 0x2 - b _081ABF6C -_081ABF6A: - movs r0, 0 -_081ABF6C: - pop {r1} - bx r1 - thumb_func_end GetSwitchBagPocketDirection - - thumb_func_start ChangeBagPocketId -@ void ChangeBagPocketId(u8 *bagPocketId, u8 deltaBagPocketId) -ChangeBagPocketId: @ 81ABF70 - push {r4,lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - asrs r1, 24 - cmp r1, 0x1 - bne _081ABF88 - ldrb r0, [r2] - cmp r0, 0x4 - bne _081ABF88 - movs r0, 0 - b _081ABFA0 -_081ABF88: - lsls r0, r4, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - ldrb r3, [r2] - cmp r0, r1 - bne _081ABF9E - cmp r3, 0 - bne _081ABF9E - movs r0, 0x4 - b _081ABFA0 -_081ABF9E: - adds r0, r3, r4 -_081ABFA0: - strb r0, [r2] - pop {r4} - pop {r0} - bx r0 - thumb_func_end ChangeBagPocketId - - thumb_func_start SwitchBagPocket -@ void SwitchBagPocket(u8 taskId, u16 deltaBagPocketId, u16 a3) -SwitchBagPocket: @ 81ABFA8 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - lsls r2, 16 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r0, 0 - strh r0, [r4, 0x1A] - strh r0, [r4, 0x18] - strh r5, [r4, 0x16] - cmp r2, 0 - bne _081AC026 - movs r0, 0 - bl ClearWindowTilemap - movs r0, 0x1 - bl ClearWindowTilemap - ldrb r0, [r4] - ldr r3, =gUnknown_0203CE58 - ldrb r2, [r3, 0x5] - lsls r2, 1 - adds r1, r3, 0 - adds r1, 0x12 - adds r1, r2, r1 - adds r3, 0x8 - adds r2, r3 - bl sub_81AE6C8 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r3, =gSprites - ldr r0, =gUnknown_0203CE54 - ldr r2, [r0] - ldr r1, =0x0000081b - adds r0, r2, r1 - ldrb r1, [r0] - lsls r1, 26 - lsrs r1, 30 - movs r0, 0x1 - eors r0, r1 - adds r2, r0 - ldr r0, =0x00000806 - adds r2, r0 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - bl sub_81AB824 -_081AC026: - ldr r4, =gUnknown_0203CE58 - ldrb r1, [r4, 0x5] - add r0, sp, 0x8 - strb r1, [r0] - lsls r1, r5, 24 - asrs r1, 24 - bl ChangeBagPocketId - lsls r0, r5, 16 - asrs r1, r0, 16 - adds r5, r0, 0 - cmp r1, 0x1 - bne _081AC07C - ldr r2, =gPocketNamesStringsTable - ldrb r0, [r4, 0x5] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - add r1, sp, 0x8 - ldrb r1, [r1] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl bag_menu_print_pocket_names - movs r0, 0 - bl bag_menu_copy_pocket_name_to_window - b _081AC09A - .pool -_081AC07C: - ldr r2, =gPocketNamesStringsTable - add r0, sp, 0x8 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - ldrb r1, [r4, 0x5] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl bag_menu_print_pocket_names - movs r0, 0x8 - bl bag_menu_copy_pocket_name_to_window -_081AC09A: - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - movs r1, 0 - bl bag_menu_draw_pocket_indicator_square - add r0, sp, 0x8 - ldrb r0, [r0] - movs r1, 0x1 - bl bag_menu_draw_pocket_indicator_square - movs r0, 0xF - str r0, [sp] - movs r0, 0x10 - str r0, [sp, 0x4] - movs r0, 0x2 - movs r1, 0xB - movs r2, 0xE - movs r3, 0x2 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add r0, sp, 0x8 - ldrb r0, [r0] - movs r1, 0x1 - bl SetBagVisualPocketId - movs r0, 0x1 - bl RemoveBagObject - asrs r0, r5, 16 - bl AddSwitchPocketRotatingBallObject - ldr r1, =sub_81AC10C - ldr r2, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r2 - ldr r2, [r0] - adds r0, r6, 0 - bl SetTaskFuncWithFollowupFunc - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end SwitchBagPocket - - thumb_func_start sub_81AC10C -sub_81AC10C: @ 81AC10C - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - bl sub_81221AC - lsls r0, 24 - cmp r0, 0 - bne _081AC184 - bl IsWallysBag - lsls r0, 24 - cmp r0, 0 - bne _081AC184 - bl GetSwitchBagPocketDirection - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081AC148 - cmp r0, 0x2 - beq _081AC164 - b _081AC184 - .pool -_081AC148: - ldr r0, =gUnknown_0203CE5D - movs r1, 0x16 - ldrsb r1, [r6, r1] - bl ChangeBagPocketId - adds r0, r7, 0 - bl SwitchTaskToFollowupFunc - movs r1, 0x1 - negs r1, r1 - adds r0, r7, 0 - b _081AC178 - .pool -_081AC164: - ldr r0, =gUnknown_0203CE5D - movs r1, 0x16 - ldrsb r1, [r6, r1] - bl ChangeBagPocketId - adds r0, r7, 0 - bl SwitchTaskToFollowupFunc - adds r0, r7, 0 - movs r1, 0x1 -_081AC178: - movs r2, 0x1 - bl SwitchBagPocket - b _081AC22E - .pool -_081AC184: - movs r1, 0x1A - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _081AC192 - cmp r0, 0x1 - beq _081AC1DC - b _081AC22E -_081AC192: - ldrb r0, [r6, 0x18] - bl sub_81AC23C - ldrh r0, [r6, 0x18] - adds r1, r0, 0x1 - strh r1, [r6, 0x18] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081AC1CC - movs r2, 0x16 - ldrsh r0, [r6, r2] - cmp r0, 0x1 - bne _081AC1BC - lsls r0, r1, 16 - asrs r0, 17 - lsls r0, 24 - lsrs r0, 24 - bl bag_menu_copy_pocket_name_to_window - b _081AC1CC -_081AC1BC: - lsls r1, 16 - asrs r1, 17 - movs r0, 0x8 - subs r0, r1 - lsls r0, 24 - lsrs r0, 24 - bl bag_menu_copy_pocket_name_to_window -_081AC1CC: - movs r1, 0x18 - ldrsh r0, [r6, r1] - cmp r0, 0x10 - bne _081AC22E - ldrh r0, [r6, 0x1A] - adds r0, 0x1 - strh r0, [r6, 0x1A] - b _081AC22E -_081AC1DC: - ldr r4, =gUnknown_0203CE5D - movs r1, 0x16 - ldrsb r1, [r6, r1] - adds r0, r4, 0 - bl ChangeBagPocketId - subs r5, r4, 0x5 - ldrb r0, [r5, 0x5] - bl load_bag_item_list_buffers - ldr r0, =gMultiuseListMenuTemplate - ldrb r2, [r5, 0x5] - lsls r2, 1 - adds r1, r4, 0 - adds r1, 0xD - adds r1, r2, r1 - ldrh r1, [r1] - adds r4, 0x3 - adds r2, r4 - ldrh r2, [r2] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6] - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x2 - bl PutWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - bl bag_menu_add_pocket_scroll_arrow_indicators_maybe - bl bag_menu_add_list_scroll_arrow_indicators_maybe - adds r0, r7, 0 - bl SwitchTaskToFollowupFunc -_081AC22E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AC10C - - thumb_func_start sub_81AC23C -sub_81AC23C: @ 81AC23C - push {lr} - sub sp, 0x8 - adds r3, r0, 0 - lsls r3, 24 - movs r0, 0x80 - lsls r0, 18 - adds r3, r0 - lsrs r3, 24 - movs r0, 0xF - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x2 - movs r1, 0x11 - movs r2, 0xE - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_81AC23C - - thumb_func_start bag_menu_draw_pocket_indicator_square -@ void bag_menu_draw_pocket_indicator_square(char x, int is_current_bag) -bag_menu_draw_pocket_indicator_square: @ 81AC26C - push {lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - cmp r1, 0 - bne _081AC298 - ldr r1, =0x00001017 - adds r2, r0, 0x5 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x1 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x2 - movs r3, 0x3 - bl FillBgTilemapBufferRect_Palette0 - b _081AC2AE - .pool -_081AC298: - ldr r1, =0x0000102b - adds r2, r0, 0x5 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x1 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x2 - movs r3, 0x3 - bl FillBgTilemapBufferRect_Palette0 -_081AC2AE: - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_draw_pocket_indicator_square - - thumb_func_start sub_81AC2C0 -sub_81AC2C0: @ 81AC2C0 - push {lr} - ldr r1, =gUnknown_0203CE58 - ldrb r0, [r1, 0x4] - cmp r0, 0x1 - bhi _081AC2E0 - ldrb r0, [r1, 0x5] - subs r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _081AC2E0 - movs r0, 0x1 - b _081AC2E2 - .pool -_081AC2E0: - movs r0, 0 -_081AC2E2: - pop {r1} - bx r1 - thumb_func_end sub_81AC2C0 - - thumb_func_start bag_menu_swap_items -bag_menu_swap_items: @ 81AC2E8 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - mov r9, r0 - adds r6, r4, r0 - ldrb r0, [r6] - movs r1, 0x10 - movs r2, 0x1 - bl sub_81AF15C - ldr r3, =gUnknown_0203CE58 - ldrb r0, [r3, 0x5] - lsls r0, 1 - adds r2, r3, 0 - adds r2, 0x12 - adds r2, r0, r2 - adds r1, r3, 0 - adds r1, 0x8 - adds r0, r1 - ldrh r1, [r0] - ldrh r2, [r2] - adds r1, r2 - strh r1, [r6, 0x2] - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r2, =0x0000081a - adds r0, r2 - movs r5, 0 - strb r1, [r0] - ldrb r0, [r3, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r6, 0x2] - bl BagGetItemIdByPocketPosition - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =gStringVar4 - mov r8, r0 - ldr r1, =gText_MoveVar1Where - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - str r5, [sp, 0x4] - str r5, [sp, 0x8] - str r5, [sp, 0xC] - str r5, [sp, 0x10] - movs r1, 0x1 - mov r2, r8 - movs r3, 0x3 - bl bag_menu_print - ldrb r0, [r6, 0x2] - bl sub_80D4FEC - bl sub_81AB89C - ldrb r0, [r6] - movs r1, 0x2 - bl bag_menu_print_cursor_ - movs r2, 0x8 - negs r2, r2 - add r9, r2 - add r4, r9 - ldr r0, =sub_81AC3C0 - str r0, [r4] - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_swap_items - - thumb_func_start sub_81AC3C0 -@ void sub_81AC3C0(u8 taskId) -sub_81AC3C0: @ 81AC3C0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081AC48E - ldr r0, =gMain - mov r8, r0 - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081AC418 - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - ldr r3, =gUnknown_0203CE58 - ldrb r2, [r3, 0x5] - lsls r2, 1 - adds r1, r3, 0 - adds r1, 0x12 - adds r1, r2, r1 - adds r3, 0x8 - adds r2, r3 - bl sub_81AE860 - b _081AC472 - .pool -_081AC418: - ldrb r0, [r4] - bl ListMenuHandleInputGetItemId - adds r7, r0, 0 - ldrb r0, [r4] - ldr r5, =gUnknown_0203CE58 - ldrb r2, [r5, 0x5] - lsls r2, 1 - adds r1, r5, 0 - adds r1, 0x12 - adds r1, r2, r1 - adds r4, r5, 0 - adds r4, 0x8 - adds r2, r4 - bl sub_81AE860 - movs r0, 0 - bl sub_80D4FC8 - ldrb r0, [r5, 0x5] - lsls r0, 1 - adds r0, r4 - ldrb r0, [r0] - bl sub_80D4FEC - movs r0, 0x2 - negs r0, r0 - cmp r7, r0 - beq _081AC460 - adds r0, 0x1 - cmp r7, r0 - bne _081AC482 - b _081AC48E - .pool -_081AC460: - movs r0, 0x5 - bl PlaySE - mov r0, r8 - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081AC47A -_081AC472: - adds r0, r6, 0 - bl sub_81AC498 - b _081AC48E -_081AC47A: - adds r0, r6, 0 - bl sub_81AC590 - b _081AC48E -_081AC482: - movs r0, 0x5 - bl PlaySE - adds r0, r6, 0 - bl sub_81AC498 -_081AC48E: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81AC3C0 - - thumb_func_start sub_81AC498 -sub_81AC498: @ 81AC498 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 3 - mov r10, r0 - ldr r0, =gTasks + 0x8 - add r0, r10 - mov r9, r0 - ldr r5, =gUnknown_0203CE58 - ldrb r6, [r5, 0x5] - lsls r1, r6, 1 - adds r0, r5, 0 - adds r0, 0x12 - adds r0, r1 - mov r8, r0 - ldr r2, =gUnknown_0203CE60 - adds r7, r1, r2 - ldrh r0, [r7] - mov r1, r8 - ldrh r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - mov r0, r9 - movs r1, 0x2 - ldrsh r2, [r0, r1] - cmp r2, r4 - beq _081AC4E2 - subs r0, r4, 0x1 - cmp r2, r0 - bne _081AC4F8 -_081AC4E2: - adds r0, r3, 0 - bl sub_81AC590 - b _081AC566 - .pool -_081AC4F8: - ldr r1, =gBagPockets - lsls r0, r6, 3 - adds r0, r1 - ldr r0, [r0] - adds r1, r2, 0 - adds r2, r4, 0 - bl sub_80D702C - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r2, =0x0000081a - adds r0, r2 - movs r1, 0xFF - strb r1, [r0] - mov r1, r9 - ldrb r0, [r1] - mov r1, r8 - adds r2, r7, 0 - bl sub_81AE6C8 - mov r2, r9 - movs r1, 0x2 - ldrsh r0, [r2, r1] - cmp r0, r4 - bge _081AC538 - ldrb r1, [r5, 0x5] - lsls r1, 1 - ldr r2, =gUnknown_0203CE60 - adds r1, r2 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] -_081AC538: - ldrb r0, [r5, 0x5] - bl load_bag_item_list_buffers - ldr r0, =gMultiuseListMenuTemplate - mov r2, r8 - ldrh r1, [r2] - ldrh r2, [r7] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - mov r1, r9 - strh r0, [r1] - movs r0, 0x1 - bl sub_80D4FC8 - bl bag_menu_add_list_scroll_arrow_indicators_maybe - ldr r0, =gTasks + 0x8 - subs r0, 0x8 - add r0, r10 - ldr r1, =Task_BagMenu - str r1, [r0] -_081AC566: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AC498 - - thumb_func_start sub_81AC590 -sub_81AC590: @ 81AC590 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - mov r9, r1 - ldr r0, =gTasks + 0x8 - mov r10, r0 - mov r7, r9 - add r7, r10 - ldr r4, =gUnknown_0203CE58 - ldrb r0, [r4, 0x5] - lsls r0, 1 - adds r1, r4, 0 - adds r1, 0x12 - adds r6, r0, r1 - movs r1, 0x8 - adds r1, r4 - mov r8, r1 - adds r5, r0, r1 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x0000081a - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldrb r0, [r7] - adds r1, r6, 0 - adds r2, r5, 0 - bl sub_81AE6C8 - movs r0, 0x2 - ldrsh r2, [r7, r0] - ldrh r0, [r6] - ldrh r1, [r5] - adds r0, r1 - cmp r2, r0 - bge _081AC5F2 - ldrb r1, [r4, 0x5] - lsls r1, 1 - add r1, r8 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] -_081AC5F2: - ldrb r0, [r4, 0x5] - bl load_bag_item_list_buffers - ldr r0, =gMultiuseListMenuTemplate - ldrh r1, [r6] - ldrh r2, [r5] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r7] - movs r0, 0x1 - bl sub_80D4FC8 - bl bag_menu_add_list_scroll_arrow_indicators_maybe - mov r0, r10 - subs r0, 0x8 - add r0, r9 - ldr r1, =Task_BagMenu - 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 sub_81AC590 - - thumb_func_start sub_81AC644 -sub_81AC644: @ 81AC644 - push {r4,r5,lr} - sub sp, 0x14 - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x4] - subs r0, 0x1 - cmp r0, 0x9 - bls _081AC654 - b _081AC82C -_081AC654: - lsls r0, 2 - ldr r1, =_081AC668 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081AC668: - .4byte _081AC690 - .4byte _081AC82C - .4byte _081AC82C - .4byte _081AC82C - .4byte _081AC6E8 - .4byte _081AC82C - .4byte _081AC76C - .4byte _081AC7CC - .4byte _081AC70C - .4byte _081AC690 -_081AC690: - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetBattleUsage - lsls r0, 24 - cmp r0, 0 - beq _081AC6C4 - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614042 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x2 - b _081ACA10 - .pool -_081AC6C4: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614046 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x1 - b _081ACA10 - .pool -_081AC6E8: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614047 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x4 - b _081ACA10 - .pool -_081AC70C: - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - bl itemid_is_unique - lsls r0, 24 - cmp r0, 0 - bne _081AC748 - ldrh r0, [r4] - cmp r0, 0xAF - beq _081AC748 - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_0861404B - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x2 - b _081ACA10 - .pool -_081AC748: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614046 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x1 - b _081ACA10 - .pool -_081AC76C: - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - bl itemid_is_unique - lsls r0, 24 - cmp r0, 0 - bne _081AC7A8 - ldrh r0, [r4] - cmp r0, 0xAF - beq _081AC7A8 - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_0861404D - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x2 - b _081ACA10 - .pool -_081AC7A8: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614046 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x1 - b _081ACA10 - .pool -_081AC7CC: - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - bl itemid_is_unique - lsls r0, 24 - cmp r0, 0 - bne _081AC808 - ldrh r0, [r4] - cmp r0, 0xAF - beq _081AC808 - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_0861404F - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x2 - b _081ACA10 - .pool -_081AC808: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614046 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x1 - b _081ACA10 - .pool -_081AC82C: - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081AC840 - bl InUnionRoom - cmp r0, 0x1 - bne _081AC8A4 -_081AC840: - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - cmp r0, 0x4 - beq _081AC856 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl sub_8122148 - lsls r0, 24 - cmp r0, 0 - bne _081AC880 -_081AC856: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614046 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x1 - b _081ACA10 - .pool -_081AC880: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614044 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x2 - b _081ACA10 - .pool -_081AC8A4: - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - cmp r0, 0x4 - bls _081AC8AE - b _081ACA12 -_081AC8AE: - lsls r0, 2 - ldr r1, =_081AC8C0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081AC8C0: - .4byte _081AC8D4 - .4byte _081AC9B4 - .4byte _081AC9D8 - .4byte _081AC9FC - .4byte _081AC92C -_081AC8D4: - ldr r4, =gUnknown_0203CE54 - ldr r1, [r4] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r3, =0x00000824 - adds r0, r1, r3 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x4 - strb r0, [r1] - ldr r0, [r4] - adds r0, r3 - ldr r1, =gUnknown_0861402C - movs r2, 0x4 - bl memcpy - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemIsMail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081AC90A - b _081ACA12 -_081AC90A: - ldr r0, [r4] - ldr r1, =0x00000824 - adds r0, r1 - movs r1, 0x6 - strb r1, [r0] - b _081ACA12 - .pool -_081AC92C: - ldr r4, =gUnknown_0203CE54 - ldr r1, [r4] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r5, =0x00000824 - adds r0, r1, r5 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x4 - strb r0, [r1] - ldr r0, [r4] - adds r0, r5 - ldr r1, =gUnknown_08614030 - movs r2, 0x4 - bl memcpy - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00000496 - adds r0, r1 - ldr r2, =gSpecialVar_ItemId - ldrh r0, [r0] - ldrh r1, [r2] - cmp r0, r1 - bne _081AC96C - ldr r0, [r4] - ldr r1, =0x00000825 - adds r0, r1 - movs r1, 0x8 - strb r1, [r0] -_081AC96C: - ldrh r1, [r2] - ldr r0, =0x00000103 - cmp r1, r0 - beq _081AC97A - adds r0, 0xD - cmp r1, r0 - bne _081ACA12 -_081AC97A: - movs r0, 0x6 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - beq _081ACA12 - ldr r0, [r4] - adds r0, r5 - movs r1, 0x7 - strb r1, [r0] - b _081ACA12 - .pool -_081AC9B4: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614034 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x4 - b _081ACA10 - .pool -_081AC9D8: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_08614038 - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x4 - b _081ACA10 - .pool -_081AC9FC: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - movs r0, 0x82 - lsls r0, 4 - adds r2, r1, r0 - ldr r0, =gUnknown_0861403C - str r0, [r2] - ldr r0, =0x00000828 - adds r1, r0 - movs r0, 0x6 -_081ACA10: - strb r0, [r1] -_081ACA12: - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - cmp r0, 0x2 - bne _081ACA50 - movs r0, 0x1 - bl ClearWindowTilemap - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl PrintTMHMMoveData - movs r0, 0x3 - bl PutWindowTilemap - movs r0, 0x4 - bl PutWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - b _081ACA86 - .pool -_081ACA50: - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_Var1IsSelected - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x3 - bl bag_menu_print -_081ACA86: - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x00000828 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081ACAB0 - movs r0, 0 - b _081ACAB6 - .pool -_081ACAB0: - cmp r0, 0x2 - bne _081ACAC4 - movs r0, 0x1 -_081ACAB6: - bl bag_menu_add_window - lsls r0, 24 - lsrs r0, 24 - bl sub_81ACAF8 - b _081ACAEE -_081ACAC4: - cmp r0, 0x4 - bne _081ACADC - movs r0, 0x2 - bl bag_menu_add_window - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - movs r2, 0x2 - bl sub_81ACB54 - b _081ACAEE -_081ACADC: - movs r0, 0x3 - bl bag_menu_add_window - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - movs r2, 0x3 - bl sub_81ACB54 -_081ACAEE: - add sp, 0x14 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81AC644 - - thumb_func_start sub_81ACAF8 -sub_81ACAF8: @ 81ACAF8 - push {r4-r6,lr} - sub sp, 0x14 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - str r0, [sp] - movs r0, 0x10 - str r0, [sp, 0x4] - ldr r6, =gUnknown_0203CE54 - ldr r1, [r6] - ldr r5, =0x00000828 - adds r0, r1, r5 - ldrb r0, [r0] - str r0, [sp, 0x8] - ldr r0, =gUnknown_08613FB4 - str r0, [sp, 0xC] - movs r0, 0x82 - lsls r0, 4 - adds r1, r0 - ldr r0, [r1] - str r0, [sp, 0x10] - adds r0, r4, 0 - movs r1, 0x7 - movs r2, 0x8 - movs r3, 0x1 - bl AddItemMenuActionTextPrinters - ldr r0, [r6] - adds r0, r5 - ldrb r1, [r0] - adds r0, r4, 0 - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81ACAF8 - - thumb_func_start sub_81ACB54 -sub_81ACB54: @ 81ACB54 - push {r4-r6,lr} - sub sp, 0x14 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - movs r0, 0x38 - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - ldr r0, =gUnknown_08613FB4 - str r0, [sp, 0xC] - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - movs r1, 0x82 - lsls r1, 4 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x10] - adds r0, r4, 0 - movs r1, 0x7 - movs r2, 0x8 - movs r3, 0x1 - bl sub_8198DBC - movs r0, 0 - str r0, [sp] - adds r0, r4, 0 - movs r1, 0x38 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_8199944 - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81ACB54 - - thumb_func_start unknown_item_menu_type -unknown_item_menu_type: @ 81ACBB0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_81AC644 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x00000828 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x2 - bhi _081ACBE8 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =Task_HandleInBattleItemMenuInput - b _081ACBF4 - .pool -_081ACBE8: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =Task_HandleOutOfBattleItemMenuInput -_081ACBF4: - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end unknown_item_menu_type - - thumb_func_start Task_HandleInBattleItemMenuInput -Task_HandleInBattleItemMenuInput: @ 81ACC04 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081ACC6A - bl ProcessMenuInputNoWrapAround - lsls r0, 24 - asrs r4, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _081ACC6A - adds r0, 0x1 - cmp r4, r0 - bne _081ACC44 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_08613FB4 - ldr r1, [r0, 0x24] - adds r0, r5, 0 - bl _call_via_r1 - b _081ACC6A - .pool -_081ACC44: - movs r0, 0x5 - bl PlaySE - ldr r1, =gUnknown_08613FB4 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - movs r2, 0x82 - lsls r2, 4 - adds r0, r2 - ldr r0, [r0] - adds r0, r4 - ldrb r0, [r0] - lsls r0, 3 - adds r1, 0x4 - adds r0, r1 - ldr r1, [r0] - adds r0, r6, 0 - bl _call_via_r1 -_081ACC6A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end Task_HandleInBattleItemMenuInput - - thumb_func_start Task_HandleOutOfBattleItemMenuInput -Task_HandleOutOfBattleItemMenuInput: @ 81ACC78 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081ACC8C - b _081ACDF0 -_081ACC8C: - bl GetMenuCursorPos - lsls r0, 24 - lsrs r4, r0, 24 - ldr r5, =gMain - ldrh r1, [r5, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081ACCD4 - lsls r0, r4, 24 - asrs r0, 24 - cmp r0, 0 - bgt _081ACCAA - b _081ACDF0 -_081ACCAA: - subs r0, 0x2 - lsls r0, 24 - asrs r0, 24 - bl sub_81ACDFC - lsls r0, 24 - cmp r0, 0 - bne _081ACCBC - b _081ACDF0 -_081ACCBC: - movs r0, 0x5 - bl PlaySE - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - bl sub_8199134 - b _081ACDF0 - .pool -_081ACCD4: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081ACD1C - lsls r0, r4, 24 - asrs r1, r0, 24 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r2, =0x00000828 - adds r0, r2 - ldrb r0, [r0] - subs r0, 0x2 - cmp r1, r0 - blt _081ACCF2 - b _081ACDF0 -_081ACCF2: - adds r0, r1, 0x2 - lsls r0, 24 - asrs r0, 24 - bl sub_81ACDFC - lsls r0, 24 - cmp r0, 0 - beq _081ACDF0 - movs r0, 0x5 - bl PlaySE - movs r0, 0 - movs r1, 0x1 - bl sub_8199134 - b _081ACDF0 - .pool -_081ACD1C: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _081ACD30 - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081ACD58 -_081ACD30: - lsls r0, r4, 24 - asrs r1, r0, 24 - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081ACDF0 - subs r0, r1, 0x1 - lsls r0, 24 - asrs r0, 24 - bl sub_81ACDFC - lsls r0, 24 - cmp r0, 0 - beq _081ACDF0 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - negs r0, r0 - b _081ACD92 -_081ACD58: - ldrh r1, [r5, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081ACD6E - bl GetLRKeysState - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081ACD9A -_081ACD6E: - lsls r0, r4, 24 - asrs r1, r0, 24 - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081ACDF0 - adds r0, r1, 0x1 - lsls r0, 24 - asrs r0, 24 - bl sub_81ACDFC - lsls r0, 24 - cmp r0, 0 - beq _081ACDF0 - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 -_081ACD92: - movs r1, 0 - bl sub_8199134 - b _081ACDF0 -_081ACD9A: - ldrh r1, [r5, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081ACDD8 - movs r0, 0x5 - bl PlaySE - ldr r2, =gUnknown_08613FB4 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - lsls r1, r4, 24 - asrs r1, 24 - movs r3, 0x82 - lsls r3, 4 - adds r0, r3 - ldr r0, [r0] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 3 - adds r2, 0x4 - adds r0, r2 - ldr r1, [r0] - adds r0, r6, 0 - bl _call_via_r1 - b _081ACDF0 - .pool -_081ACDD8: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081ACDF0 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_08613FB4 - ldr r1, [r0, 0x24] - adds r0, r6, 0 - bl _call_via_r1 -_081ACDF0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end Task_HandleOutOfBattleItemMenuInput - - thumb_func_start sub_81ACDFC -sub_81ACDFC: @ 81ACDFC - push {lr} - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - blt _081ACE30 - ldr r0, =gUnknown_0203CE54 - ldr r2, [r0] - ldr r3, =0x00000828 - adds r0, r2, r3 - ldrb r0, [r0] - cmp r1, r0 - bgt _081ACE30 - movs r3, 0x82 - lsls r3, 4 - adds r0, r2, r3 - ldr r0, [r0] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xE - beq _081ACE30 - movs r0, 0x1 - b _081ACE32 - .pool -_081ACE30: - movs r0, 0 -_081ACE32: - pop {r1} - bx r1 - thumb_func_end sub_81ACDFC - - thumb_func_start bag_menu_remove_some_window -bag_menu_remove_some_window: @ 81ACE38 - push {lr} - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x00000828 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081ACE58 - movs r0, 0 - bl bag_menu_remove_window - b _081ACE76 - .pool -_081ACE58: - cmp r0, 0x2 - bne _081ACE64 - movs r0, 0x1 - bl bag_menu_remove_window - b _081ACE76 -_081ACE64: - cmp r0, 0x4 - bne _081ACE70 - movs r0, 0x2 - bl bag_menu_remove_window - b _081ACE76 -_081ACE70: - movs r0, 0x3 - bl bag_menu_remove_window -_081ACE76: - pop {r0} - bx r0 - thumb_func_end bag_menu_remove_some_window - - thumb_func_start ItemMenu_UseOutOfBattle -@ void ItemMenu_UseOutOfBattle(u8 taskId) -ItemMenu_UseOutOfBattle: @ 81ACE7C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r5, =gSpecialVar_ItemId - ldrh r0, [r5] - bl ItemId_GetFieldFunc - cmp r0, 0 - beq _081ACEEE - bl bag_menu_remove_some_window - bl CalculatePlayerPartyCount - lsls r0, 24 - cmp r0, 0 - bne _081ACEB8 - ldrh r0, [r5] - bl ItemId_GetType - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081ACEB8 - adds r0, r4, 0 - bl bag_menu_print_there_is_no_pokemon - b _081ACEEE - .pool -_081ACEB8: - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - cmp r0, 0x3 - beq _081ACEE8 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetFieldFunc - adds r1, r0, 0 - adds r0, r4, 0 - bl _call_via_r1 - b _081ACEEE - .pool -_081ACEE8: - adds r0, r4, 0 - bl sub_80FDD10 -_081ACEEE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end ItemMenu_UseOutOfBattle - - thumb_func_start ItemMenu_Toss -ItemMenu_Toss: @ 81ACEF4 - push {r4-r7,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r6, r0, 3 - ldr r7, =gTasks + 0x8 - adds r4, r6, r7 - bl bag_menu_remove_some_window - movs r0, 0x1 - strh r0, [r4, 0x10] - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _081ACF24 - adds r0, r5, 0 - bl BagMenuConfirmToss - b _081ACF6A - .pool -_081ACF24: - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_TossHowManyVar1s - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x3 - bl bag_menu_print - movs r0, 0x7 - bl sub_81ABC3C - adds r0, r7, 0 - subs r0, 0x8 - adds r0, r6, r0 - ldr r1, =Task_ChooseHowManyToToss - str r1, [r0] -_081ACF6A: - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end ItemMenu_Toss - - thumb_func_start BagMenuConfirmToss -BagMenuConfirmToss: @ 81ACF88 - push {r4,r5,lr} - sub sp, 0x14 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =gStringVar2 - movs r2, 0x10 - ldrsh r1, [r4, r2] - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_ConfirmTossItems - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x3 - bl bag_menu_print - ldr r2, =gUnknown_08614084 - adds r0, r5, 0 - movs r1, 0x5 - bl bag_menu_yes_no - add sp, 0x14 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end BagMenuConfirmToss - - thumb_func_start BagMenuCancelToss -BagMenuCancelToss: @ 81AD010 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - movs r1, 0x2 - ldrsh r0, [r4, r1] - bl bag_menu_print_description_box_text - ldrb r0, [r4] - movs r1, 0 - bl bag_menu_print_cursor_ - adds r0, r5, 0 - bl set_callback3_to_bag - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end BagMenuCancelToss - - thumb_func_start Task_ChooseHowManyToToss -Task_ChooseHowManyToToss: @ 81AD044 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - adds r0, r4, 0 - adds r0, 0x10 - ldrh r1, [r4, 0x4] - bl AdjustQuantityAccordingToDPadInput - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081AD088 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x00000817 - adds r0, r1 - ldrb r0, [r0] - movs r2, 0x10 - ldrsh r1, [r4, r2] - bl sub_81ABC54 - b _081AD0C6 - .pool -_081AD088: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081AD0AC - movs r0, 0x5 - bl PlaySE - movs r0, 0x7 - bl bag_menu_remove_window - adds r0, r5, 0 - bl BagMenuConfirmToss - b _081AD0C6 - .pool -_081AD0AC: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081AD0C6 - movs r0, 0x5 - bl PlaySE - movs r0, 0x7 - bl bag_menu_remove_window - adds r0, r6, 0 - bl BagMenuCancelToss -_081AD0C6: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end Task_ChooseHowManyToToss - - thumb_func_start BagMenuActuallyToss -BagMenuActuallyToss: @ 81AD0CC - push {r4-r6,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r5, =gTasks + 0x8 - adds r6, r4, r5 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =gStringVar2 - movs r2, 0x10 - ldrsh r1, [r6, r2] - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r6, =gStringVar4 - ldr r1, =gText_ThrewAwayVar2Var1s - adds r0, r6, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r6, 0 - movs r3, 0x3 - bl bag_menu_print - subs r5, 0x8 - adds r4, r5 - ldr r0, =Task_ActuallyToss - str r0, [r4] - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end BagMenuActuallyToss - - thumb_func_start Task_ActuallyToss -Task_ActuallyToss: @ 81AD150 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldr r4, =gUnknown_0203CE58 - ldrb r0, [r4, 0x5] - lsls r0, 1 - adds r1, r4, 0 - adds r1, 0x12 - adds r1, r0 - mov r8, r1 - adds r1, r4, 0 - adds r1, 0x8 - adds r7, r0, r1 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _081AD1CE - movs r0, 0x5 - bl PlaySE - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldrh r1, [r5, 0x10] - bl RemoveBagItem - ldrb r0, [r5] - mov r1, r8 - adds r2, r7, 0 - bl sub_81AE6C8 - ldrb r0, [r4, 0x5] - bl sub_81AB9A8 - ldrb r0, [r4, 0x5] - bl sub_81ABA88 - ldrb r0, [r4, 0x5] - bl load_bag_item_list_buffers - ldr r0, =gMultiuseListMenuTemplate - mov r2, r8 - ldrh r1, [r2] - ldrh r2, [r7] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5] - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r6, 0 - bl set_callback3_to_bag -_081AD1CE: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end Task_ActuallyToss - - thumb_func_start ItemMenu_Register -ItemMenu_Register: @ 81AD1EC - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - ldr r0, =gUnknown_0203CE58 - ldrb r1, [r0, 0x5] - lsls r1, 1 - adds r2, r0, 0 - adds r2, 0x12 - adds r6, r1, r2 - adds r0, 0x8 - adds r5, r1, r0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00000496 - adds r1, r0, r2 - ldr r0, =gSpecialVar_ItemId - ldrh r2, [r0] - ldrh r0, [r1] - cmp r0, r2 - bne _081AD238 - movs r0, 0 - strh r0, [r1] - b _081AD23A - .pool -_081AD238: - strh r2, [r1] -_081AD23A: - ldrb r0, [r7] - adds r1, r6, 0 - adds r2, r5, 0 - bl sub_81AE6C8 - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - bl load_bag_item_list_buffers - ldr r0, =gMultiuseListMenuTemplate - ldrh r1, [r6] - ldrh r2, [r5] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r7] - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r4, 0 - bl ItemMenu_Cancel - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end ItemMenu_Register - - thumb_func_start ItemMenu_Give -ItemMenu_Give: @ 81AD278 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - bl bag_menu_remove_some_window - ldr r5, =gSpecialVar_ItemId - ldrh r0, [r5] - bl itemid_80BF6D8_mail_related - lsls r0, 24 - cmp r0, 0 - bne _081AD2AC - ldr r2, =gText_CantWriteMail - ldr r3, =sub_81AD350 - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _081AD2EA - .pool -_081AD2AC: - ldrh r0, [r5] - bl itemid_is_unique - lsls r0, 24 - cmp r0, 0 - bne _081AD2E4 - bl CalculatePlayerPartyCount - lsls r0, 24 - cmp r0, 0 - bne _081AD2CA - adds r0, r4, 0 - bl bag_menu_print_there_is_no_pokemon - b _081AD2EA -_081AD2CA: - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r0, =sub_81B7F60 - str r0, [r1] - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _081AD2EA - .pool -_081AD2E4: - adds r0, r6, 0 - bl bag_menu_print_cant_be_held_msg -_081AD2EA: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end ItemMenu_Give - - thumb_func_start bag_menu_print_there_is_no_pokemon -bag_menu_print_there_is_no_pokemon: @ 81AD2F0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_NoPokemon - ldr r3, =sub_81AD350 - movs r1, 0x1 - bl DisplayItemMessage - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_print_there_is_no_pokemon - - thumb_func_start bag_menu_print_cant_be_held_msg -bag_menu_print_cant_be_held_msg: @ 81AD30C - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r5, =gStringVar4 - ldr r1, =gText_Var1CantBeHeld - adds r0, r5, 0 - bl StringExpandPlaceholders - ldr r3, =sub_81AD350 - adds r0, r4, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl DisplayItemMessage - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_print_cant_be_held_msg - - thumb_func_start sub_81AD350 -sub_81AD350: @ 81AD350 - 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 - beq _081AD36E - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl bag_menu_inits_lists_menu -_081AD36E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AD350 - - thumb_func_start ItemMenu_CheckTag -ItemMenu_CheckTag: @ 81AD378 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CE54 - ldr r2, [r1] - ldr r1, =DoBerryTagScreen - str r1, [r2] - bl unknown_ItemMenu_Confirm - pop {r0} - bx r0 - .pool - thumb_func_end ItemMenu_CheckTag - - thumb_func_start ItemMenu_Cancel -ItemMenu_Cancel: @ 81AD398 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - bl bag_menu_remove_some_window - movs r1, 0x2 - ldrsh r0, [r4, r1] - bl bag_menu_print_description_box_text - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - ldrb r0, [r4] - movs r1, 0 - bl bag_menu_print_cursor_ - adds r0, r5, 0 - bl set_callback3_to_bag - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemMenu_Cancel - - thumb_func_start ItemMenu_UseInBattle -ItemMenu_UseInBattle: @ 81AD3DC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - bl ItemId_GetBattleFunc - cmp r0, 0 - beq _081AD400 - bl bag_menu_remove_some_window - ldrh r0, [r4] - bl ItemId_GetBattleFunc - adds r1, r0, 0 - adds r0, r5, 0 - bl _call_via_r1 -_081AD400: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemMenu_UseInBattle - - thumb_func_start bag_menu_mail_related -bag_menu_mail_related: @ 81AD40C - push {lr} - movs r0, 0xC - movs r1, 0x5 - movs r2, 0 - bl GoToBagMenu - pop {r0} - bx r0 - thumb_func_end bag_menu_mail_related - - thumb_func_start item_menu_type_2 -item_menu_type_2: @ 81AD41C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - bl itemid_80BF6D8_mail_related - lsls r0, 24 - cmp r0, 0 - bne _081AD44C - ldr r2, =gText_CantWriteMail - ldr r3, =sub_81AD350 - adds r0, r5, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _081AD4AE - .pool -_081AD44C: - ldrh r0, [r4] - bl sub_8122148 - lsls r0, 24 - cmp r0, 0 - bne _081AD488 - ldrh r0, [r4] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_Var1CantBeHeldHere - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r3, =sub_81AD350 - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage - b _081AD4AE - .pool -_081AD488: - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - cmp r0, 0x4 - beq _081AD4A8 - ldrh r0, [r4] - bl itemid_is_unique - lsls r0, 24 - cmp r0, 0 - bne _081AD4A8 - adds r0, r5, 0 - bl unknown_ItemMenu_Confirm - b _081AD4AE - .pool -_081AD4A8: - adds r0, r5, 0 - bl bag_menu_print_cant_be_held_msg -_081AD4AE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end item_menu_type_2 - - thumb_func_start item_menu_type_b -item_menu_type_b: @ 81AD4B4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r5, =gSpecialVar_ItemId - ldrh r0, [r5] - bl ItemIsMail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081AD4E4 - ldr r2, =gText_CantWriteMail - ldr r3, =sub_81AD350 - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _081AD51A - .pool -_081AD4E4: - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x5] - cmp r0, 0x4 - beq _081AD514 - ldrh r0, [r5] - bl itemid_is_unique - lsls r0, 24 - cmp r0, 0 - bne _081AD514 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =unknown_ItemMenu_Confirm - str r0, [r1] - b _081AD51A - .pool -_081AD514: - adds r0, r4, 0 - bl bag_menu_print_cant_be_held_msg -_081AD51A: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end item_menu_type_b - - thumb_func_start UseRegisteredKeyItemOnField -@ bool8 UseRegisteredKeyItemOnField() -UseRegisteredKeyItemOnField: @ 81AD520 - push {r4-r7,lr} - bl InUnionRoom - cmp r0, 0x1 - beq _081AD54C - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _081AD54C - bl InBattlePike - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0 - bne _081AD54C - bl InMultiBattleRoom - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081AD550 -_081AD54C: - movs r0, 0 - b _081AD5D2 -_081AD550: - bl HideMapNamePopUpWindow - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY_ScreenOff - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r5, =0x00000496 - adds r1, r0, r5 - ldrh r0, [r1] - cmp r0, 0 - beq _081AD5CA - movs r1, 0x1 - bl CheckBagHasItem - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x1 - bne _081AD5C4 - bl ScriptContext2_Enable - bl FreezeMapObjects - bl sub_808B864 - bl sub_808BCF4 - ldr r2, =gSpecialVar_ItemId - ldr r0, [r4] - adds r0, r5 - ldrh r1, [r0] - strh r1, [r2] - ldrh r0, [r0] - bl ItemId_GetFieldFunc - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r6, [r1, 0xE] - b _081AD5D0 - .pool -_081AD5C4: - ldr r0, [r4] - adds r0, r5 - strh r7, [r0] -_081AD5CA: - ldr r0, =EventScript_2736B3 - bl ScriptContext1_SetupScript -_081AD5D0: - movs r0, 0x1 -_081AD5D2: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end UseRegisteredKeyItemOnField - - thumb_func_start display_sell_item_ask_str -@ void display_sell_item_ask_str(int a1) -display_sell_item_ask_str: @ 81AD5DC - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r7, r5, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r6, =gSpecialVar_ItemId - ldrh r0, [r6] - bl itemid_get_market_price - lsls r0, 16 - cmp r0, 0 - bne _081AD634 - ldrh r0, [r6] - ldr r1, =gStringVar2 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_CantBuyKeyItem - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage - b _081AD66A - .pool -_081AD634: - movs r0, 0x1 - strh r0, [r4, 0x10] - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _081AD64C - bl bag_menu_AddMoney_window - adds r0, r5, 0 - bl sub_81AD680 - b _081AD66A -_081AD64C: - ldrh r0, [r6] - ldr r1, =gStringVar2 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_HowManyToSell - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r3, =sub_81AD730 - adds r0, r7, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage -_081AD66A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end display_sell_item_ask_str - - thumb_func_start sub_81AD680 -sub_81AD680: @ 81AD680 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldr r6, =gStringVar1 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl itemid_get_market_price - lsls r0, 16 - lsrs r0, 17 - movs r2, 0x10 - ldrsh r1, [r4, r2] - muls r1, r0 - adds r0, r6, 0 - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_ICanPayVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r3, =sub_81AD6E4 - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AD680 - - thumb_func_start sub_81AD6E4 -sub_81AD6E4: @ 81AD6E4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_0861408C - movs r1, 0x6 - bl bag_menu_yes_no - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AD6E4 - - thumb_func_start sub_81AD6FC -sub_81AD6FC: @ 81AD6FC - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - bl bag_menu_remove_money_window - movs r0, 0x4 - bl bag_menu_RemoveBagItem_message_window - ldrb r0, [r4] - movs r1, 0 - bl bag_menu_print_cursor_ - adds r0, r5, 0 - bl set_callback3_to_bag - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AD6FC - - thumb_func_start sub_81AD730 -sub_81AD730: @ 81AD730 - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r6, =gTasks + 0x8 - adds r0, r4, r6 - mov r8, r0 - movs r0, 0x8 - bl bag_menu_add_window - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl itemid_get_market_price - lsls r0, 16 - lsrs r0, 17 - mov r2, r8 - movs r3, 0x10 - ldrsh r1, [r2, r3] - adds r2, r0, 0 - muls r2, r1 - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81ABCC0 - bl bag_menu_AddMoney_window - subs r6, 0x8 - adds r4, r6 - ldr r0, =sub_81AD794 - str r0, [r4] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AD730 - - thumb_func_start sub_81AD794 -sub_81AD794: @ 81AD794 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - adds r0, r6, 0 - adds r0, 0x10 - ldrh r1, [r6, 0x4] - bl AdjustQuantityAccordingToDPadInput - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081AD7F4 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x00000818 - adds r0, r1 - ldrb r4, [r0] - movs r2, 0x10 - ldrsh r5, [r6, r2] - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl itemid_get_market_price - lsls r0, 16 - lsrs r0, 17 - movs r2, 0x10 - ldrsh r1, [r6, r2] - adds r2, r0, 0 - muls r2, r1 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81ABCC0 - b _081AD844 - .pool -_081AD7F4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081AD818 - movs r0, 0x5 - bl PlaySE - movs r0, 0x8 - bl bag_menu_remove_window - adds r0, r4, 0 - bl sub_81AD680 - b _081AD844 - .pool -_081AD818: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081AD844 - movs r0, 0x5 - bl PlaySE - ldrb r0, [r6] - movs r1, 0 - bl bag_menu_print_cursor_ - bl bag_menu_remove_money_window - movs r0, 0x8 - bl bag_menu_remove_window - movs r0, 0x4 - bl bag_menu_RemoveBagItem_message_window - adds r0, r5, 0 - bl set_callback3_to_bag -_081AD844: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81AD794 - - thumb_func_start sub_81AD84C -sub_81AD84C: @ 81AD84C - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldr r6, =gSpecialVar_ItemId - ldrh r0, [r6] - ldr r1, =gStringVar2 - bl CopyItemName - ldr r0, =gStringVar1 - mov r8, r0 - ldrh r0, [r6] - bl itemid_get_market_price - lsls r0, 16 - lsrs r0, 17 - movs r2, 0x10 - ldrsh r1, [r4, r2] - muls r1, r0 - mov r0, r8 - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_TurnedOverVar1ForVar2 - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r3, =sub_81AD8C8 - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AD84C - - thumb_func_start sub_81AD8C8 -sub_81AD8C8: @ 81AD8C8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - lsls r6, r0, 2 - adds r6, r0 - lsls r6, 3 - ldr r0, =gTasks + 0x8 - adds r0, r6 - mov r10, r0 - ldr r7, =gUnknown_0203CE58 - ldrb r5, [r7, 0x5] - lsls r5, 1 - movs r1, 0x12 - adds r1, r7 - mov r9, r1 - add r9, r5 - adds r0, r7, 0 - adds r0, 0x8 - adds r5, r0 - movs r0, 0x5F - bl PlaySE - ldr r2, =gSpecialVar_ItemId - mov r8, r2 - ldrh r0, [r2] - mov r3, r10 - ldrh r1, [r3, 0x10] - bl RemoveBagItem - ldr r0, =gSaveBlock1Ptr - ldr r4, [r0] - movs r1, 0x92 - lsls r1, 3 - adds r4, r1 - mov r2, r8 - ldrh r0, [r2] - bl itemid_get_market_price - lsls r0, 16 - lsrs r0, 17 - mov r3, r10 - movs r2, 0x10 - ldrsh r1, [r3, r2] - muls r1, r0 - adds r0, r4, 0 - bl AddMoney - mov r3, r10 - ldrb r0, [r3] - mov r1, r9 - adds r2, r5, 0 - bl sub_81AE6C8 - ldrb r0, [r7, 0x5] - bl sub_81AB9A8 - ldrb r0, [r7, 0x5] - bl sub_81ABA88 - ldrb r0, [r7, 0x5] - bl load_bag_item_list_buffers - ldr r0, =gMultiuseListMenuTemplate - mov r2, r9 - ldrh r1, [r2] - ldrh r2, [r5] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - mov r3, r10 - strh r0, [r3] - movs r1, 0x2 - bl bag_menu_print_cursor_ - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x00000819 - adds r0, r1 - ldrb r4, [r0] - ldr r2, =gSaveBlock1Ptr - ldr r0, [r2] - movs r3, 0x92 - lsls r3, 3 - adds r0, r3 - bl GetMoney - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - bl PrintMoneyAmountInMoneyBox - ldr r0, =gTasks + 0x8 - subs r0, 0x8 - adds r6, r0 - ldr r0, =sub_81AD9C0 - str r0, [r6] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AD8C8 - - thumb_func_start sub_81AD9C0 -sub_81AD9C0: @ 81AD9C0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _081AD9E2 - movs r0, 0x5 - bl PlaySE - bl bag_menu_remove_money_window - adds r0, r4, 0 - bl bag_menu_inits_lists_menu -_081AD9E2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AD9C0 - - thumb_func_start display_deposit_item_ask_str -display_deposit_item_ask_str: @ 81AD9EC - push {r4-r6,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r5, r0, 3 - ldr r6, =gTasks + 0x8 - adds r1, r5, r6 - movs r0, 0x1 - strh r0, [r1, 0x10] - movs r3, 0x4 - ldrsh r0, [r1, r3] - cmp r0, 0x1 - bne _081ADA18 - adds r0, r2, 0 - bl sub_81ADB14 - b _081ADA5E - .pool -_081ADA18: - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_DepositHowManyVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x3 - bl bag_menu_print - movs r0, 0x7 - bl sub_81ABC3C - adds r0, r6, 0 - subs r0, 0x8 - adds r0, r5, r0 - ldr r1, =sub_81ADA7C - str r1, [r0] -_081ADA5E: - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end display_deposit_item_ask_str - - thumb_func_start sub_81ADA7C -sub_81ADA7C: @ 81ADA7C - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - adds r0, r5, 0 - adds r0, 0x10 - ldrh r1, [r5, 0x4] - bl AdjustQuantityAccordingToDPadInput - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081ADAC0 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =0x00000817 - adds r0, r1 - ldrb r0, [r0] - movs r2, 0x10 - ldrsh r1, [r5, r2] - bl sub_81ABC54 - b _081ADB0E - .pool -_081ADAC0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081ADAE4 - movs r0, 0x5 - bl PlaySE - movs r0, 0x7 - bl bag_menu_remove_window - adds r0, r4, 0 - bl sub_81ADB14 - b _081ADB0E - .pool -_081ADAE4: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081ADB0E - movs r0, 0x5 - bl PlaySE - movs r1, 0x2 - ldrsh r0, [r5, r1] - bl bag_menu_print_description_box_text - ldrb r0, [r5] - movs r1, 0 - bl bag_menu_print_cursor_ - movs r0, 0x7 - bl bag_menu_remove_window - adds r0, r6, 0 - bl set_callback3_to_bag -_081ADB0E: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81ADA7C - - thumb_func_start sub_81ADB14 -sub_81ADB14: @ 81ADB14 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r7, r1, 3 - ldr r0, =gTasks + 0x8 - mov r9, r0 - adds r2, r7, 0 - add r2, r9 - mov r8, r2 - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - bl itemid_is_unique - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - beq _081ADB6C - ldr r2, =gText_CantStoreImportantItems - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0x1 - b _081ADBE2 - .pool -_081ADB6C: - ldrh r0, [r4] - mov r3, r8 - ldrh r1, [r3, 0x10] - bl AddPCItem - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x1 - bne _081ADBD4 - ldrh r0, [r4] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =gStringVar2 - mov r2, r8 - movs r3, 0x10 - ldrsh r1, [r2, r3] - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_DepositedVar2Var1s - adds r0, r4, 0 - bl StringExpandPlaceholders - str r6, [sp] - str r5, [sp, 0x4] - str r5, [sp, 0x8] - str r5, [sp, 0xC] - str r5, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x3 - bl bag_menu_print - mov r0, r9 - subs r0, 0x8 - adds r0, r7, r0 - ldr r1, =Task_ActuallyToss - b _081ADBF2 - .pool -_081ADBD4: - ldr r2, =gText_NoRoomForItems - movs r0, 0x1 - str r0, [sp] - str r5, [sp, 0x4] - str r5, [sp, 0x8] - str r5, [sp, 0xC] - str r5, [sp, 0x10] -_081ADBE2: - movs r1, 0x1 - movs r3, 0x3 - bl bag_menu_print - mov r0, r9 - subs r0, 0x8 - adds r0, r7, r0 - ldr r1, =sub_81ADC0C -_081ADBF2: - str r1, [r0] - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81ADB14 - - thumb_func_start sub_81ADC0C -sub_81ADC0C: @ 81ADC0C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _081ADC44 - movs r0, 0x5 - bl PlaySE - movs r1, 0x2 - ldrsh r0, [r5, r1] - bl bag_menu_print_description_box_text - ldrb r0, [r5] - movs r1, 0 - bl bag_menu_print_cursor_ - adds r0, r4, 0 - bl set_callback3_to_bag -_081ADC44: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81ADC0C - - thumb_func_start IsWallysBag -@ bool8 IsWallysBag() -IsWallysBag: @ 81ADC54 - push {lr} - ldr r0, =gUnknown_0203CE58 - ldrb r0, [r0, 0x4] - cmp r0, 0xA - beq _081ADC68 - movs r0, 0 - b _081ADC6A - .pool -_081ADC68: - movs r0, 0x1 -_081ADC6A: - pop {r1} - bx r1 - thumb_func_end IsWallysBag - - thumb_func_start PrepareBagForWallyTutorial -@ void PrepareBagForWallyTutorial() -PrepareBagForWallyTutorial: @ 81ADC70 - push {r4-r6,lr} - ldr r4, =gUnknown_0203CE80 - movs r0, 0xD0 - bl AllocZeroed - str r0, [r4] - ldr r5, =gSaveBlock1Ptr - ldr r1, [r5] - movs r2, 0xAC - lsls r2, 3 - adds r1, r2 - movs r2, 0x78 - bl memcpy - ldr r0, [r4] - ldr r1, [r5] - movs r2, 0xCA - lsls r2, 3 - adds r1, r2 - adds r0, 0x78 - movs r2, 0x40 - bl memcpy - ldr r0, [r4] - ldr r2, =gUnknown_0203CE58 - ldrb r1, [r2, 0x5] - adds r0, 0xCE - strh r1, [r0] - movs r6, 0 - adds r5, r2, 0 - adds r5, 0x8 -_081ADCAE: - ldr r2, [r4] - lsls r3, r6, 1 - adds r0, r2, 0 - adds r0, 0xB8 - adds r0, r3 - ldrh r1, [r5] - strh r1, [r0] - adds r2, 0xC2 - adds r2, r3 - ldrh r0, [r5, 0xA] - strh r0, [r2] - adds r5, 0x2 - adds r6, 0x1 - cmp r6, 0x4 - bls _081ADCAE - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - movs r1, 0xAC - lsls r1, 3 - adds r0, r1 - movs r1, 0x1E - bl ClearItemSlots - ldr r0, [r4] - movs r2, 0xCA - lsls r2, 3 - adds r0, r2 - movs r1, 0x10 - bl ClearItemSlots - bl ResetBagScrollPositions - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PrepareBagForWallyTutorial - - thumb_func_start RestoreBagAfterWallyTutorial -@ void RestoreBagAfterWallyTutorial() -RestoreBagAfterWallyTutorial: @ 81ADD00 - push {r4-r6,lr} - ldr r5, =gSaveBlock1Ptr - ldr r0, [r5] - movs r1, 0xAC - lsls r1, 3 - adds r0, r1 - ldr r4, =gUnknown_0203CE80 - ldr r1, [r4] - movs r2, 0x78 - bl memcpy - ldr r0, [r5] - movs r1, 0xCA - lsls r1, 3 - adds r0, r1 - ldr r1, [r4] - adds r1, 0x78 - movs r2, 0x40 - bl memcpy - ldr r1, =gUnknown_0203CE58 - ldr r0, [r4] - adds r0, 0xCE - ldrh r0, [r0] - strb r0, [r1, 0x5] - movs r5, 0 - adds r6, r4, 0 - adds r3, r1, 0 - adds r3, 0x8 -_081ADD3A: - lsls r2, r5, 1 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0xB8 - adds r0, r2 - ldrh r0, [r0] - strh r0, [r3] - adds r1, 0xC2 - adds r1, r2 - ldrh r0, [r1] - strh r0, [r3, 0xA] - adds r3, 0x2 - adds r5, 0x1 - cmp r5, 0x4 - bls _081ADD3A - ldr r0, [r6] - bl Free - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RestoreBagAfterWallyTutorial - - thumb_func_start DoWallyTutorialBagMenu -@ void DoWallyTutorialBagMenu() -DoWallyTutorialBagMenu: @ 81ADD70 - push {lr} - bl PrepareBagForWallyTutorial - movs r0, 0xD - movs r1, 0x1 - bl AddBagItem - movs r0, 0x4 - movs r1, 0x1 - bl AddBagItem - ldr r2, =SetCB2ToReshowScreenAfterMenu2 - movs r0, 0xA - movs r1, 0 - bl GoToBagMenu - pop {r0} - bx r0 - .pool - thumb_func_end DoWallyTutorialBagMenu - - thumb_func_start Task_WallyTutorialBagMenu -@ void Task_WallyTutorialBagMenu(u8 taskId) -Task_WallyTutorialBagMenu: @ 81ADD98 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081ADE32 - movs r0, 0x10 - ldrsh r1, [r4, r0] - cmp r1, 0xCC - beq _081ADDEC - cmp r1, 0xCC - bgt _081ADDD0 - cmp r1, 0x66 - beq _081ADDDA - b _081ADE2C - .pool -_081ADDD0: - movs r0, 0x99 - lsls r0, 1 - cmp r1, r0 - beq _081ADE0C - b _081ADE2C -_081ADDDA: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - movs r1, 0x1 - movs r2, 0 - bl SwitchBagPocket - b _081ADE2C -_081ADDEC: - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4] - movs r1, 0x2 - bl bag_menu_print_cursor_ - ldr r1, =gSpecialVar_ItemId - movs r0, 0x4 - strh r0, [r1] - adds r0, r5, 0 - bl sub_81AC644 - b _081ADE2C - .pool -_081ADE0C: - movs r0, 0x5 - bl PlaySE - bl bag_menu_remove_some_window - ldrb r0, [r4] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - bl RestoreBagAfterWallyTutorial - adds r0, r5, 0 - bl unknown_ItemMenu_Confirm - b _081ADE32 -_081ADE2C: - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] -_081ADE32: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end Task_WallyTutorialBagMenu - - thumb_func_start unknown_ItemMenu_Show -unknown_ItemMenu_Show: @ 81ADE38 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gSpecialVar_0x8005 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] - bl bag_menu_remove_some_window - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end unknown_ItemMenu_Show - - thumb_func_start bag_menu_leave_maybe_3 -bag_menu_leave_maybe_3: @ 81ADE6C - push {lr} - ldr r0, =gFieldCallback - ldr r1, =sub_819FA50 - str r1, [r0] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_leave_maybe_3 - - thumb_func_start unknown_ItemMenu_Give2 -unknown_ItemMenu_Give2: @ 81ADE8C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] - bl bag_menu_remove_some_window - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end unknown_ItemMenu_Give2 - - thumb_func_start bag_menu_leave_maybe_2 -bag_menu_leave_maybe_2: @ 81ADEBC - push {lr} - ldr r0, =gFieldCallback - ldr r1, =sub_818DEF4 - str r1, [r0] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_leave_maybe_2 - - thumb_func_start unknown_ItemMenu_Confirm2 -unknown_ItemMenu_Confirm2: @ 81ADEDC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] - bl bag_menu_remove_some_window - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end unknown_ItemMenu_Confirm2 - - thumb_func_start bag_menu_leave_maybe -bag_menu_leave_maybe: @ 81ADF00 - push {lr} - ldr r0, =gFieldCallback - ldr r1, =sub_818E564 - str r1, [r0] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_leave_maybe - - thumb_func_start bag_menu_print_pocket_names -bag_menu_print_pocket_names: @ 81ADF20 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x1C - adds r4, r0, 0 - mov r8, r1 - movs r0, 0 - movs r1, 0 - str r0, [sp, 0x14] - str r1, [sp, 0x18] - ldr r1, =0x00ffffff - ldr r0, [sp, 0x14] - ands r0, r1 - movs r1, 0x80 - lsls r1, 21 - orrs r0, r1 - str r0, [sp, 0x14] - ldr r1, =0xffffff00 - ldr r0, [sp, 0x18] - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - str r0, [sp, 0x18] - add r0, sp, 0x14 - bl AddWindow - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r6, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x40 - bl GetStringCenterAlignXOffset - lsls r3, r0, 24 - lsrs r3, 24 - movs r7, 0x1 - str r7, [sp] - movs r5, 0 - str r5, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0xFF - mov r9, r0 - str r0, [sp, 0xC] - str r7, [sp, 0x10] - adds r0, r6, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl bag_menu_print - mov r2, r8 - cmp r2, 0 - beq _081ADFBA - movs r0, 0x1 - mov r1, r8 - movs r2, 0x40 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - adds r3, 0x40 - lsls r3, 24 - lsrs r3, 24 - str r7, [sp] - str r5, [sp, 0x4] - str r5, [sp, 0x8] - mov r0, r9 - str r0, [sp, 0xC] - str r7, [sp, 0x10] - adds r0, r6, 0 - movs r1, 0x1 - mov r2, r8 - bl bag_menu_print -_081ADFBA: - adds r0, r6, 0 - movs r1, 0x7 - bl GetWindowAttribute - ldr r1, =gUnknown_0203CE54 - ldr r1, [r1] - ldr r2, =0x00000844 - adds r1, r2 - ldr r2, =0x04000100 - bl CpuSet - adds r0, r6, 0 - bl RemoveWindow - add sp, 0x1C - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_print_pocket_names - - thumb_func_start bag_menu_copy_pocket_name_to_window -bag_menu_copy_pocket_name_to_window: @ 81ADFF8 - push {r4-r7,lr} - adds r7, r0, 0 - cmp r7, 0x8 - bls _081AE002 - movs r7, 0x8 -_081AE002: - ldr r0, =gUnknown_0203CE54 - ldr r4, [r0] - ldr r0, =0x00000844 - adds r4, r0 - movs r0, 0x2 - movs r1, 0x7 - bl GetWindowAttribute - adds r5, r0, 0 - lsls r0, r7, 5 - adds r0, r4, r0 - ldr r6, =0x04000040 - adds r1, r5, 0 - adds r2, r6, 0 - bl CpuSet - adds r0, r7, 0 - adds r0, 0x10 - lsls r0, 5 - adds r4, r0 - movs r0, 0x80 - lsls r0, 1 - adds r5, r0 - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl CpuSet - movs r0, 0x2 - movs r1, 0x2 - bl CopyWindowToVram - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_copy_pocket_name_to_window - - thumb_func_start setup_bag_menu_textboxes -setup_bag_menu_textboxes: @ 81AE054 - push {r4,lr} - ldr r0, =gUnknown_08614174 - bl InitWindows - bl DeactivateAllTextPrinters - movs r0, 0 - movs r1, 0x1 - movs r2, 0xE0 - bl sub_809882C - movs r0, 0 - movs r1, 0xA - movs r2, 0xD0 - bl copy_textbox_border_tile_patterns_to_vram - movs r0, 0xC0 - movs r1, 0x1 - bl sub_819A2BC - ldr r0, =gUnknown_0860F074 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r4, 0 -_081AE088: - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _081AE088 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end setup_bag_menu_textboxes - - thumb_func_start bag_menu_print -bag_menu_print: @ 81AE0BC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x14 - mov r9, r3 - ldr r3, [sp, 0x30] - ldr r4, [sp, 0x34] - ldr r6, [sp, 0x38] - ldr r5, [sp, 0x3C] - mov r8, r5 - ldr r5, [sp, 0x40] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r7, r9 - lsls r7, 24 - lsrs r7, 24 - mov r9, r7 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r5, 24 - lsrs r5, 24 - str r4, [sp] - str r6, [sp, 0x4] - lsls r4, r5, 1 - adds r4, r5 - ldr r5, =gUnknown_08614164 - adds r4, r5 - str r4, [sp, 0x8] - mov r4, r8 - lsls r4, 24 - asrs r4, 24 - str r4, [sp, 0xC] - str r2, [sp, 0x10] - mov r2, r9 - bl AddTextPrinterParameterized2 - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_print - - thumb_func_start sub_81AE124 -sub_81AE124: @ 81AE124 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CE54 - ldr r1, [r1] - movs r2, 0x81 - lsls r2, 4 - adds r1, r2 - adds r1, r0 - ldrb r0, [r1] - bx lr - .pool - thumb_func_end sub_81AE124 - - thumb_func_start bag_menu_add_window -bag_menu_add_window: @ 81AE13C - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_0203CE54 - movs r3, 0x81 - lsls r3, 4 - adds r1, r2, r3 - ldr r0, [r0] - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0xFF - bne _081AE172 - lsls r0, r2, 3 - ldr r1, =gUnknown_086141AC - adds r0, r1 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - movs r2, 0x1 - movs r3, 0xE - bl SetWindowBorderStyle - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram -_081AE172: - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end bag_menu_add_window - - thumb_func_start bag_menu_remove_window -bag_menu_remove_window: @ 81AE184 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CE54 - movs r2, 0x81 - lsls r2, 4 - adds r0, r2 - ldr r1, [r1] - adds r4, r1, r0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _081AE1B8 - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0xFF - strb r0, [r4] -_081AE1B8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_remove_window - - thumb_func_start AddItemMessageWindow -@ u8 AddItemMessageWindow(u8 a1) -AddItemMessageWindow: @ 81AE1C4 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_0203CE54 - movs r3, 0x81 - lsls r3, 4 - adds r1, r2, r3 - ldr r0, [r0] - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0xFF - bne _081AE1E8 - lsls r0, r2, 3 - ldr r1, =gUnknown_086141AC - adds r0, r1 - bl AddWindow - strb r0, [r4] -_081AE1E8: - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end AddItemMessageWindow - - thumb_func_start bag_menu_RemoveBagItem_message_window -bag_menu_RemoveBagItem_message_window: @ 81AE1F8 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CE54 - movs r2, 0x81 - lsls r2, 4 - adds r0, r2 - ldr r1, [r1] - adds r4, r1, r0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _081AE22C - movs r1, 0 - bl sub_8197DF8 - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0xFF - strb r0, [r4] -_081AE22C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_RemoveBagItem_message_window - - thumb_func_start bag_menu_yes_no -bag_menu_yes_no: @ 81AE238 - push {lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 21 - ldr r3, =gUnknown_086141AC - adds r1, r3 - movs r3, 0x2 - str r3, [sp] - movs r3, 0x1 - str r3, [sp, 0x4] - movs r3, 0xE - str r3, [sp, 0x8] - str r2, [sp, 0xC] - movs r2, 0x1 - movs r3, 0 - bl CreateYesNoMenuWithCallbacks - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_yes_no - - thumb_func_start bag_menu_AddMoney_window -bag_menu_AddMoney_window: @ 81AE268 - push {r4,lr} - movs r0, 0x9 - bl bag_menu_add_window - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - bl GetMoney - adds r3, r0, 0 - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0xE - bl PrintMoneyAmountInMoneyBoxWithBorder - movs r0, 0x13 - movs r1, 0xB - bl AddMoneyLabelObject - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end bag_menu_AddMoney_window - - thumb_func_start bag_menu_remove_money_window -bag_menu_remove_money_window: @ 81AE2A4 - push {lr} - movs r0, 0x9 - bl bag_menu_remove_window - bl RemoveMoneyLabelObject - pop {r0} - bx r0 - thumb_func_end bag_menu_remove_money_window - - thumb_func_start bag_menu_prepare_tmhm_move_window -bag_menu_prepare_tmhm_move_window: @ 81AE2B4 - push {lr} - movs r0, 0x3 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x3 - movs r1, 0x13 - movs r2, 0 - movs r3, 0 - bl blit_move_info_icon - movs r0, 0x3 - movs r1, 0x14 - movs r2, 0 - movs r3, 0xC - bl blit_move_info_icon - movs r0, 0x3 - movs r1, 0x15 - movs r2, 0 - movs r3, 0x18 - bl blit_move_info_icon - movs r0, 0x3 - movs r1, 0x16 - movs r2, 0 - movs r3, 0x24 - bl blit_move_info_icon - movs r0, 0x3 - movs r1, 0x2 - bl CopyWindowToVram - pop {r0} - bx r0 - thumb_func_end bag_menu_prepare_tmhm_move_window - - thumb_func_start PrintTMHMMoveData -PrintTMHMMoveData: @ 81AE2FC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x14 - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0x4 - movs r1, 0 - bl FillWindowPixelBuffer - cmp r4, 0 - bne _081AE354 - movs r4, 0 - movs r5, 0 -_081AE31A: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 26 - lsrs r0, 24 - str r0, [sp] - str r5, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0xFF - str r0, [sp, 0xC] - movs r0, 0x4 - str r0, [sp, 0x10] - movs r1, 0x1 - ldr r2, =gText_ThreeDashes - movs r3, 0x7 - bl bag_menu_print - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _081AE31A - movs r0, 0x4 - movs r1, 0x2 - bl CopyWindowToVram - b _081AE440 - .pool -_081AE354: - adds r0, r4, 0 - bl ItemIdToBattleMoveId - lsls r0, 16 - lsrs r7, r0, 16 - ldr r1, =gBattleMoves - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r5, r0, r1 - ldrb r1, [r5, 0x2] - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x4 - movs r2, 0 - movs r3, 0 - bl blit_move_info_icon - ldrb r0, [r5, 0x1] - cmp r0, 0x1 - bhi _081AE38C - ldr r2, =gText_ThreeDashes - b _081AE39C - .pool -_081AE38C: - ldr r4, =gStringVar1 - ldrb r1, [r5, 0x1] - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r2, r4, 0 -_081AE39C: - movs r0, 0xC - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - movs r0, 0xFF - str r0, [sp, 0xC] - movs r0, 0x4 - str r0, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x7 - bl bag_menu_print - ldr r2, =gBattleMoves - lsls r1, r7, 1 - adds r0, r1, r7 - lsls r0, 2 - adds r2, r0, r2 - ldrb r0, [r2, 0x3] - adds r6, r1, 0 - cmp r0, 0 - bne _081AE3D8 - ldr r2, =gText_ThreeDashes - b _081AE3E8 - .pool -_081AE3D8: - ldr r4, =gStringVar1 - ldrb r1, [r2, 0x3] - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r2, r4, 0 -_081AE3E8: - movs r0, 0x18 - str r0, [sp] - movs r4, 0 - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0xFF - mov r8, r0 - str r0, [sp, 0xC] - movs r0, 0x4 - mov r9, r0 - str r0, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x7 - bl bag_menu_print - ldr r5, =gStringVar1 - ldr r1, =gBattleMoves - adds r0, r6, r7 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x4] - adds r0, r5, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - movs r0, 0x24 - str r0, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - mov r0, r8 - str r0, [sp, 0xC] - mov r0, r9 - str r0, [sp, 0x10] - movs r0, 0x4 - movs r1, 0x1 - adds r2, r5, 0 - movs r3, 0x7 - bl bag_menu_print - movs r0, 0x4 - movs r1, 0x2 - bl CopyWindowToVram -_081AE440: - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PrintTMHMMoveData - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/main_menu.s b/asm/main_menu.s index 8ea65fbec..22f8977f6 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -4654,12 +4654,12 @@ fmt_pokedex: @ 8031F7C cmp r0, 0 beq _08031FA4 movs r0, 0x1 - bl pokedex_count + bl GetNationalPokedexCount b _08031FAA .pool _08031FA4: movs r0, 0x1 - bl sub_80C0844 + bl GetHoennPokedexCount _08031FAA: lsls r0, 16 lsrs r7, r0, 16 diff --git a/asm/pokedex.s b/asm/pokedex.s index 526188cca..b1ddaa0d0 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -443,24 +443,24 @@ _080BB65E: cmp r0, 0 bne _080BB6D0 movs r0, 0 - bl sub_80C0844 + bl GetHoennPokedexCount ldr r1, [r4] ldr r2, =0x0000061a adds r1, r2 strh r0, [r1] movs r0, 0x1 - bl sub_80C0844 + bl GetHoennPokedexCount b _080BB6E4 .pool _080BB6D0: movs r0, 0 - bl pokedex_count + bl GetNationalPokedexCount ldr r1, [r4] ldr r2, =0x0000061a adds r1, r2 strh r0, [r1] movs r0, 0x1 - bl pokedex_count + bl GetNationalPokedexCount _080BB6E4: ldr r1, [r4] ldr r3, =0x0000061c @@ -5058,7 +5058,7 @@ _080BDF4C: movs r1, 0x1 bl StartSpriteAnim movs r0, 0 - bl sub_80C0844 + bl GetHoennPokedexCount lsls r0, 16 lsrs r6, r0, 16 movs r0, 0 @@ -5283,7 +5283,7 @@ _080BE198: lsrs r1, 24 bl StartSpriteAnim movs r0, 0x1 - bl sub_80C0844 + bl GetHoennPokedexCount lsls r0, 16 lsrs r6, r0, 16 movs r0, 0 @@ -9597,8 +9597,8 @@ _080C07E8: .pool thumb_func_end GetSetPokedexFlag - thumb_func_start pokedex_count -pokedex_count: @ 80C07F4 + thumb_func_start GetNationalPokedexCount +GetNationalPokedexCount: @ 80C07F4 push {r4-r7,lr} lsls r0, 24 lsrs r6, r0, 24 @@ -9641,10 +9641,10 @@ _080C0832: pop {r4-r7} pop {r1} bx r1 - thumb_func_end pokedex_count + thumb_func_end GetNationalPokedexCount - thumb_func_start sub_80C0844 -sub_80C0844: @ 80C0844 + thumb_func_start GetHoennPokedexCount +GetHoennPokedexCount: @ 80C0844 push {r4-r6,lr} lsls r0, 24 lsrs r6, r0, 24 @@ -9691,7 +9691,7 @@ _080C088C: pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_80C0844 + thumb_func_end GetHoennPokedexCount thumb_func_start sub_80C089C sub_80C089C: @ 80C089C diff --git a/asm/pokenav.s b/asm/pokenav.s index 99b99383c..56bf3d41f 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -3757,7 +3757,7 @@ sub_81C8EF8: @ 81C8EF8 lsls r2, 2 add r2, r8 str r2, [r5, 0x44] - ldrh r3, [r2( 0x4] + ldrh r3, [r2, 0x4] lsls r1, r3, 22 lsrs r1, 22 adds r1, 0x2 diff --git a/asm/smokescreen.s b/asm/smokescreen.s deleted file mode 100644 index 464e25c40..000000000 --- a/asm/smokescreen.s +++ /dev/null @@ -1,214 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_807521C -sub_807521C: @ 807521C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 24 - lsrs r4, r2, 24 - ldr r5, =gUnknown_0831C620 - ldrh r0, [r5, 0x6] - bl GetSpriteTileStartByTag - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - bne _0807524E - adds r0, r5, 0 - bl LoadCompressedObjectPicUsingHeap - ldr r0, =gUnknown_0831C628 - bl LoadCompressedObjectPaletteUsingHeap -_0807524E: - ldr r0, =sub_8075370 - bl CreateInvisibleSpriteWithCallback - mov r8, r0 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r5, r0, 4 - add r5, r8 - lsls r5, 2 - ldr r0, =gSprites - adds r5, r0 - strh r4, [r5, 0x30] - ldr r0, =gUnknown_0831C688 - mov r9, r0 - lsls r6, 16 - asrs r0, r6, 16 - mov r10, r0 - ldr r0, =0xfff00000 - adds r6, r0 - asrs r6, 16 - lsls r4, r7, 16 - asrs r7, r4, 16 - adds r4, r0 - asrs r4, 16 - mov r0, r9 - adds r1, r6, 0 - adds r2, r4, 0 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - mov r0, r8 - strh r0, [r1, 0x2E] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - adds r0, r1, 0 - bl AnimateSprite - mov r0, r9 - mov r1, r10 - adds r2, r4, 0 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - mov r0, r8 - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0 - bl AnimateSprite - mov r0, r9 - adds r1, r6, 0 - adds r2, r7, 0 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - mov r0, r8 - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAnim - adds r0, r4, 0 - bl AnimateSprite - mov r0, r9 - mov r1, r10 - adds r2, r7, 0 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - mov r0, r8 - strh r0, [r4, 0x2E] - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - adds r0, r4, 0 - movs r1, 0x3 - bl StartSpriteAnim - adds r0, r4, 0 - bl AnimateSprite - mov r0, r8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_807521C - - thumb_func_start sub_8075370 -sub_8075370: @ 8075370 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080753A8 - ldr r0, =gUnknown_0831C620 - ldrh r0, [r0, 0x6] - bl FreeSpriteTilesByTag - ldr r0, =gUnknown_0831C628 - ldrh r0, [r0, 0x4] - bl FreeSpritePaletteByTag - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080753A4 - adds r0, r4, 0 - bl DestroySprite - b _080753A8 - .pool -_080753A4: - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_080753A8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8075370 - - thumb_func_start sub_80753B4 -sub_80753B4: @ 80753B4 - push {lr} - adds r3, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080753DE - ldr r2, =gSprites - movs r0, 0x2E - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x2E] - subs r1, 0x1 - strh r1, [r0, 0x2E] - adds r0, r3, 0 - bl DestroySprite -_080753DE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80753B4 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/start_menu.s b/asm/start_menu.s index 03cb18341..275d2124e 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -418,7 +418,7 @@ _0809FAFE: cmp r1, r0 bne _0809FB34 movs r0, 0 - bl pokedex_count + bl GetNationalPokedexCount lsls r0, 16 cmp r0, 0 beq _0809FBA0 diff --git a/asm/trainer_card.s b/asm/trainer_card.s index d7c96054d..a56dbd157 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -1925,11 +1925,11 @@ sub_80C376C: @ 80C376C cmp r0, 0 bne _080C377E movs r0, 0x1 - bl sub_80C0844 + bl GetHoennPokedexCount b _080C3784 _080C377E: movs r0, 0x1 - bl pokedex_count + bl GetNationalPokedexCount _080C3784: lsls r0, 16 lsrs r0, 16 diff --git a/common_syms/item_menu.txt b/common_syms/item_menu.txt new file mode 100755 index 000000000..112b591aa --- /dev/null +++ b/common_syms/item_menu.txt @@ -0,0 +1 @@ +gFieldCallback diff --git a/data/battle_frontier_1.s b/data/battle_frontier_1.s index 34e8df6d2..e2eb99505 100644 --- a/data/battle_frontier_1.s +++ b/data/battle_frontier_1.s @@ -1872,24 +1872,24 @@ gUnknown_0860F010:: @ 860F010 .2byte FLAG_BADGE08_GET gUnknown_0860F020:: @ 860F020 - .4byte gUnknown_082A5D6C - .4byte gUnknown_082A5DAB - .4byte gUnknown_082A5DF1 - .4byte gUnknown_082A5E34 - .4byte gUnknown_082A5E83 - .4byte gUnknown_082A5EB9 - .4byte gUnknown_082A5EF4 - .4byte gUnknown_082A5F39 - .4byte gUnknown_082A5F82 - .4byte gUnknown_082A5FB9 - .4byte gUnknown_082A6018 - .4byte gUnknown_082A6061 - .4byte gUnknown_082A609C - .4byte gUnknown_082A60D5 - .4byte gUnknown_082A6124 - .4byte gUnknown_082A616F - .4byte gUnknown_082A61D6 - .4byte gUnknown_082A623A - .4byte gUnknown_082A6287 - .4byte gUnknown_082A62C9 - .4byte gUnknown_082A6312 + .4byte gBirchDexRatingText_LessThan10 + .4byte gBirchDexRatingText_LessThan20 + .4byte gBirchDexRatingText_LessThan30 + .4byte gBirchDexRatingText_LessThan40 + .4byte gBirchDexRatingText_LessThan50 + .4byte gBirchDexRatingText_LessThan60 + .4byte gBirchDexRatingText_LessThan70 + .4byte gBirchDexRatingText_LessThan80 + .4byte gBirchDexRatingText_LessThan90 + .4byte gBirchDexRatingText_LessThan100 + .4byte gBirchDexRatingText_LessThan110 + .4byte gBirchDexRatingText_LessThan120 + .4byte gBirchDexRatingText_LessThan130 + .4byte gBirchDexRatingText_LessThan140 + .4byte gBirchDexRatingText_LessThan150 + .4byte gBirchDexRatingText_LessThan160 + .4byte gBirchDexRatingText_LessThan170 + .4byte gBirchDexRatingText_LessThan180 + .4byte gBirchDexRatingText_LessThan190 + .4byte gBirchDexRatingText_LessThan200 + .4byte gBirchDexRatingText_DexCompleted diff --git a/data/item_menu.s b/data/item_menu.s deleted file mode 100644 index 1b11c5e59..000000000 --- a/data/item_menu.s +++ /dev/null @@ -1,127 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_08613F90:: @ 8613F90 - .4byte 0x11F0, 0x1E1, 0x21DE - -@ possibly a struct -gUnknown_08613F9C:: @ 8613F9C - .4byte 0 - .4byte bag_menu_change_item_callback - .4byte sub_81AB520 - .4byte 0 - .4byte 0x80000 - .4byte 0x7003011 - -gUnknown_08613FB4:: @ 8613FB4 - .4byte gMenuText_Use, ItemMenu_UseOutOfBattle - .4byte gMenuText_Toss, ItemMenu_Toss - .4byte gMenuText_Register, ItemMenu_Register - .4byte gMenuText_Give, ItemMenu_Give - .4byte gText_Cancel2, ItemMenu_Cancel - .4byte gMenuText_Use, ItemMenu_UseInBattle - .4byte gMenuText_Check, ItemMenu_UseOutOfBattle - .4byte gMenuText_Walk, ItemMenu_UseOutOfBattle - .4byte gMenuText_Deselect, ItemMenu_Register - .4byte gMenuText_CheckTag, ItemMenu_CheckTag - .4byte gMenuText_Confirm, unknown_ItemMenu_Confirm - .4byte gMenuText_Show, unknown_ItemMenu_Show - .4byte gMenuText_Give2, unknown_ItemMenu_Give2 - .4byte gMenuText_Confirm, unknown_ItemMenu_Confirm2 - .4byte gText_EmptyString2, NULL - -gUnknown_0861402C:: @ 861402C - .byte 0, 3, 1, 4 - -gUnknown_08614030:: @ 8614030 - .byte 0, 2, 14, 4 - -gUnknown_08614034:: @ 8614034 - .byte 3, 14, 1, 4 - -gUnknown_08614038:: @ 8614038 - .byte 0, 3, 14, 4 - -gUnknown_0861403C:: @ 861403C - .byte 9, 14, 0, 3, 1, 4 - -gUnknown_08614042:: @ 8614042 - .byte 5, 4 - -gUnknown_08614044:: @ 8614044 - .byte 3, 4 - -gUnknown_08614046:: @ 8614046 - .byte 4 - -gUnknown_08614047:: @ 8614047 - .byte 10, 9, 14, 4 - -gUnknown_0861404B:: @ 861404B - .byte 11, 4 - -gUnknown_0861404D:: @ 861404D - .byte 12, 4 - -gUnknown_0861404F:: @ 861404F - .byte 13, 4 - - .align 2 -gUnknown_08614054:: @ 8614054 - .4byte unknown_item_menu_type - .4byte unknown_item_menu_type - .4byte item_menu_type_2 - .4byte display_sell_item_ask_str - .4byte unknown_ItemMenu_Confirm - .4byte unknown_item_menu_type - .4byte display_deposit_item_ask_str - .4byte unknown_item_menu_type - .4byte unknown_item_menu_type - .4byte unknown_item_menu_type - .4byte NULL - .4byte item_menu_type_b - - .align 2 -gUnknown_08614084:: @ 8614084 - .4byte BagMenuActuallyToss - .4byte BagMenuCancelToss - -gUnknown_0861408C:: @ 861408C - .4byte sub_81AD84C - .4byte sub_81AD6FC - -@ probably a struct -gUnknown_08614094:: @ 8614094 - .4byte 0x1101C00 - .4byte 0xFFFF1064 - .4byte 0x6FFFFF - .4byte 0x6F - -gUnknown_086140A4:: @ 86140A4 - .incbin "graphics/interface/select_button.4bpp" - -gUnknown_08614164:: @ 8614164 - .byte 0, 1, 3, 0, 1, 4, 0, 3, 6, 2, 1, 3, 0, 14, 10, 0 - -gUnknown_08614174:: @ 8614174 - window_template 0, 14, 2, 15, 16, 1, 0x27 - window_template 0, 0, 13, 14, 6, 1, 0x117 - window_template 0, 4, 1, 8, 2, 1, 0x1A1 - window_template 0, 1, 13, 5, 6, 12, 0x16B - window_template 0, 7, 13, 4, 6, 12, 0x189 - window_template 1, 2, 15, 27, 4, 15, 0x1B1 - null_window_template - -gUnknown_086141AC:: @ 86141AC - window_template 1, 22, 17, 7, 2, 15, 0x21D - window_template 1, 22, 15, 7, 4, 15, 0x21D - window_template 1, 15, 15, 14, 4, 15, 0x21D - window_template 1, 15, 13, 14, 6, 15, 0x21D - window_template 1, 2, 15, 27, 4, 15, 0x1B1 - window_template 1, 24, 15, 5, 4, 15, 0x21D - window_template 1, 21, 9, 5, 4, 15, 0x21D - window_template 1, 24, 17, 5, 2, 15, 0x21D - window_template 1, 18, 11, 10, 2, 15, 0x245 - window_template 1, 1, 1, 10, 2, 15, 0x231 diff --git a/data/text/pokedex_rating.inc b/data/text/pokedex_rating.inc index 735488b37..666c90867 100644 --- a/data/text/pokedex_rating.inc +++ b/data/text/pokedex_rating.inc @@ -12,99 +12,99 @@ gUnknown_082A5D2C:: @ 82A5D2C .string "So, you’ve seen {STR_VAR_1} POKéMON,\n" .string "and you’ve caught {STR_VAR_2} POKéMON…$" -gUnknown_082A5D6C:: @ 82A5D6C +gBirchDexRatingText_LessThan10:: @ 82A5D6C .string "Go into grassy areas more and look\n" .string "for POKéMON more carefully.$" -gUnknown_082A5DAB:: @ 82A5DAB +gBirchDexRatingText_LessThan20:: @ 82A5DAB .string "I guess you’re getting the hang\n" .string "of it. But, it gets harder from here.$" -gUnknown_082A5DF1:: @ 82A5DF1 +gBirchDexRatingText_LessThan30:: @ 82A5DF1 .string "Some POKéMON only appear in\n" .string "certain areas.\l" .string "You must be persistent.$" -gUnknown_082A5E34:: @ 82A5E34 +gBirchDexRatingText_LessThan40:: @ 82A5E34 .string "Well, it could use more quantity,\n" .string "but this is looking more like\l" .string "a POKéDEX now.$" -gUnknown_082A5E83:: @ 82A5E83 +gBirchDexRatingText_LessThan50:: @ 82A5E83 .string "This is coming along pretty good.\n" .string "Keep up the effort.$" -gUnknown_082A5EB9:: @ 82A5EB9 +gBirchDexRatingText_LessThan60:: @ 82A5EB9 .string "Are you using any RODS?\n" .string "There are many POKéMON in the sea.$" -gUnknown_082A5EF4:: @ 82A5EF4 +gBirchDexRatingText_LessThan70:: @ 82A5EF4 .string "Instead of just catching POKéMON,\n" .string "how about making them evolve, too?$" -gUnknown_082A5F39:: @ 82A5F39 +gBirchDexRatingText_LessThan80:: @ 82A5F39 .string "This is going to be a fantastic\n" .string "POKéDEX.\l" .string "That’s the feeling I’m getting.$" -gUnknown_082A5F82:: @ 82A5F82 +gBirchDexRatingText_LessThan90:: @ 82A5F82 .string "You’ve collected this many…\n" .string "Your talent is remarkable!$" -gUnknown_082A5FB9:: @ 82A5FB9 +gBirchDexRatingText_LessThan100:: @ 82A5FB9 .string "Have you visited the SAFARI ZONE?\p" .string "I hear there are some POKéMON that\n" .string "can only be caught there.$" -gUnknown_082A6018:: @ 82A6018 +gBirchDexRatingText_LessThan110:: @ 82A6018 .string "You’ve finally reached\n" .string "the 100-kind mark.\p" .string "This is an impressive POKéDEX!$" -gUnknown_082A6061:: @ 82A6061 +gBirchDexRatingText_LessThan120:: @ 82A6061 .string "There might be POKéMON that can be\n" .string "found using ROCK SMASH.$" -gUnknown_082A609C:: @ 82A609C +gBirchDexRatingText_LessThan130:: @ 82A609C .string "You should get some more POKéMON\n" .string "by trading with others.$" -gUnknown_082A60D5:: @ 82A60D5 +gBirchDexRatingText_LessThan140:: @ 82A60D5 .string "I’ve heard of POKéMON that evolve\n" .string "when they come to fully love their\l" .string "TRAINERS.$" -gUnknown_082A6124:: @ 82A6124 +gBirchDexRatingText_LessThan150:: @ 82A6124 .string "I had no idea that there were so\n" .string "many POKéMON species in the HOENN\l" .string "region.$" -gUnknown_082A616F:: @ 82A616F +gBirchDexRatingText_LessThan160:: @ 82A616F .string "On occasion, some POKéMON appear\n" .string "in large numbers like outbreaks.\p" .string "Don’t miss opportunities like\n" .string "those.$" -gUnknown_082A61D6:: @ 82A61D6 +gBirchDexRatingText_LessThan170:: @ 82A61D6 .string "One can get a very good idea about\n" .string "the POKéMON of the HOENN region\l" .string "by looking through your POKéDEX.$" -gUnknown_082A623A:: @ 82A623A +gBirchDexRatingText_LessThan180:: @ 82A623A .string "I would say you already qualify as\n" .string "a POKéMON PROFESSOR, and a good\l" .string "one, too!$" -gUnknown_082A6287:: @ 82A6287 +gBirchDexRatingText_LessThan190:: @ 82A6287 .string "With a POKéDEX this complete,\n" .string "you’re a real professional at this!$" -gUnknown_082A62C9:: @ 82A62C9 +gBirchDexRatingText_LessThan200:: @ 82A62C9 .string "You’re very close to completing\n" .string "this POKéDEX.\l" .string "I can feel it in my bones!$" -gUnknown_082A6312:: @ 82A6312 +gBirchDexRatingText_DexCompleted:: @ 82A6312 .string "Congratulations!\n" .string "Your POKéDEX is complete!$" diff --git a/include/battle_frontier_2.h b/include/battle_frontier_2.h index 801c3f3ec..638ff692e 100644 --- a/include/battle_frontier_2.h +++ b/include/battle_frontier_2.h @@ -6,5 +6,6 @@ void sub_81A895C(void); u16 sub_81A89A0(u8); void sub_81A8AF8(void); bool8 InBattlePike(void); +void sub_819FA50(void); #endif // GUARD_BATTLE_FRONTIER_2_H diff --git a/include/data2.h b/include/data2.h index be0f33ab8..df71f6e88 100644 --- a/include/data2.h +++ b/include/data2.h @@ -16,5 +16,9 @@ extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; extern const u8 gMoveNames[][13]; extern const u8 gAbilityNames[][13]; extern const u8 gTypeNames[][7]; +extern struct CompressedSpriteSheet gUnknown_0831C620; +extern struct CompressedSpritePalette gUnknown_0831C628; +extern const struct SpriteTemplate gUnknown_0831C688; + #endif // GUARD_DATA2_H diff --git a/include/field_map_obj_helpers.h b/include/field_map_obj_helpers.h index 031c7a8ab..ae96b67d8 100644 --- a/include/field_map_obj_helpers.h +++ b/include/field_map_obj_helpers.h @@ -27,5 +27,6 @@ void sub_8098044(u8); void UnfreezeMapObjects(void); void FreezeMapObjectsExceptOne(u8 mapObjectId); void sub_8097B78(u8, u8); +void FreezeMapObjects(void); #endif //GUARD_FIELD_MAP_OBJ_HELPERS_H diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index de6db5d63..fef596dfb 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -33,8 +33,10 @@ u8 PlayerGetZCoord(void); void SetPlayerAvatarTransitionFlags(u16 a); void sub_808BCE8(void); void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d); +void sub_808B864(void); +void sub_808BCF4(void); void sub_808D074(u8); void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr); u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8); -#endif //GUARD_FIELD_PLAYER_AVATAR_H +#endif // GUARD_FIELD_PLAYER_AVATAR_H diff --git a/include/field_specials.h b/include/field_specials.h index dd72bdd13..c1f70a399 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -4,5 +4,6 @@ u8 GetLeadMonIndex(void); u8 sub_813B260(void); u16 get_unknown_box_id(void); +bool8 InMultiBattleRoom(void); #endif // GUARD_FIELD_SPECIALS_H diff --git a/include/graphics.h b/include/graphics.h index 39662c8c1..6e5de9ef4 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2719,4 +2719,10 @@ extern const u16 gFireRedMenuElements2_Pal[16]; extern const u16 gFireRedMenuElements3_Pal[16]; extern const u8 gFireRedMenuElements_Gfx[]; +//item menu graphics +extern const u8 gBagScreen_Gfx[]; +extern const u16 gBagScreenFemale_Pal[]; +extern const u16 gBagScreenMale_Pal[]; +extern const u8 gBagMenuHMIcon_Gfx[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/item.h b/include/item.h index 06eb08046..d81a3de33 100644 --- a/include/item.h +++ b/include/item.h @@ -61,5 +61,8 @@ ItemUseFunc ItemId_GetBattleFunc(u16 itemId); u8 ItemId_GetSecondaryId(u16 itemId); u16 itemid_get_market_price(u16 itemId); u16 BagGetItemIdByPocketPosition(u8 pocketId, u16 pocketPos); +void sub_80D6FB4(struct BagPocket*); +void sub_80D6F64(struct BagPocket*); +void sub_80D702C(struct ItemSlot*, s16, u16); #endif // ITEM_H diff --git a/include/item_menu_icons.h b/include/item_menu_icons.h index c3932390c..56e012421 100644 --- a/include/item_menu_icons.h +++ b/include/item_menu_icons.h @@ -8,5 +8,9 @@ u8 sub_80D511C(u8 a0, u8 a1, u8 a2, u8 a3); u8 CreateBerryTagSprite(u8 id, s16 x, s16 y); void FreeBerryTagSpritePalette(void); u8 CreateBerryFlavorCircleSprite(s16 x); +void sub_80D4FAC(void); +void RemoveBagItemIconObject(u8); +void sub_80D4FEC(u8); +void sub_80D4FC8(u8); #endif // GUARD_ITEM_MENU_ICONS diff --git a/include/item_use.h b/include/item_use.h index ee7939824..beee6b8d0 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -12,7 +12,7 @@ void ItemUseOutOfBattle_Itemfinder(u8); void ItemUseOnFieldCB_Itemfinder(u8); void RunItemfinderResults(u8); void ExitItemfinder(u8); -bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8); +bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8); void sub_80C9720(u8); void sub_80C9838(u8, s16, s16); u8 GetPlayerDirectionTowardsHiddenItem(s16, s16); @@ -50,5 +50,6 @@ void ItemUseOutOfBattle_EnigmaBerry(u8); void ItemUseInBattle_EnigmaBerry(u8); void ItemUseOutOfBattle_CannotUse(u8); u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId); +void sub_80FDD10(u8); #endif // GUARD_ITEM_USE_H diff --git a/include/list_menu.h b/include/list_menu.h index 8b793c0e4..77d00bf97 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -57,5 +57,6 @@ u8 ListMenuInit(struct ListMenuTemplate *template, u16 cursorPage, u16 cursorPos s32 ListMenuHandleInputGetItemId(u8 listTaskId); void sub_81AE860(u8 listTaskId, u16 *a1, u16 *a2); void sub_81AE6C8(u8 listTaskId, u16 *a1, u16 *a2); +u8 ListMenuGetYCoordForPrintingArrowCursor(u8); #endif //GUARD_LIST_MENU_H diff --git a/include/menu.h b/include/menu.h index 9b717525c..c85d01e2b 100644 --- a/include/menu.h +++ b/include/menu.h @@ -62,5 +62,10 @@ u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16); void *malloc_and_decompress(const void *src, int *sizeOut); u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode); void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); +void AddItemMenuActionTextPrinters (u8, u8, u8, u8, u8, u8, u8, const struct MenuAction*, const u8*); +void sub_8198DBC(u8, u8, u8, u8, u8, u8, u8, const struct MenuAction*, const u8*); +u8 sub_8199944(u8, u8, u8, u8, u8); +u8 sub_8199134(s8, s8); +void sub_819A2BC(u8, u8); #endif // GUARD_MENU_H diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 048a4aa43..e744c293c 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -32,5 +32,10 @@ void DisplayMessageAndContinueTask(u8 taskId, u8 arg1, u16 arg2, u8 arg3, u8 arg void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo); u8 GetLRKeysState(void); u8 sub_812210C(void); +bool8 sub_81221EC(void); +bool8 sub_81221AC(void); +bool8 sub_8122148(u16); +bool8 AdjustQuantityAccordingToDPadInput(s16*, u16); +bool8 itemid_80BF6D8_mail_related(u16); #endif //GUARD_MENU_HELPERS_H diff --git a/include/menu_indicators.h b/include/menu_indicators.h index d0baac810..794ecf777 100644 --- a/include/menu_indicators.h +++ b/include/menu_indicators.h @@ -8,5 +8,7 @@ // Exported ROM declarations u8 AddScrollIndicatorArrowPairParametrized(u8, u8, u8, u8, s32, u16, u16, u16 *); void RemoveScrollIndicatorArrowPair(u8); +u8 AddScrollIndicatorArrowPair(void*, void*); +void sub_81AF15C(u8, u8, u8); #endif //GUARD_MENU_INDICATORS_H diff --git a/include/party_menu.h b/include/party_menu.h index 1d1661cee..14aacce88 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -18,5 +18,6 @@ u8 pokemon_ailments_get_primary(u32 status); u8 *GetMonNickname(struct Pokemon *mon, u8 *dst); u8 GetCursorSelectionMonId(void); bool8 FieldCallback_Teleport(void); +void sub_81B7F60(void); #endif // GUARD_PARTY_MENU_H diff --git a/include/player_pc.h b/include/player_pc.h index b14d1ede3..cc2e85b2b 100644 --- a/include/player_pc.h +++ b/include/player_pc.h @@ -8,5 +8,6 @@ // Exported ROM declarations void sub_816B060(u8 taskId); +void sub_816B31C(void); #endif //GUARD_PLAYER_PC_H diff --git a/include/pokedex.h b/include/pokedex.h index 236feac45..d3cb670c8 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -17,7 +17,7 @@ enum }; s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); -u16 pokedex_count(u8); -u16 sub_80C0844(u8); +u16 GetNationalPokedexCount(u8); +u16 GetHoennPokedexCount(u8); #endif // GUARD_POKEDEX_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h new file mode 100755 index 000000000..adadcea03 --- /dev/null +++ b/include/pokemon_summary_screen.h @@ -0,0 +1,6 @@ +#ifndef GUARD_POKEMON_SUMMARY_SCREEN_H +#define GUARD_POKEMON_SUMMARY_SCREEN_H + +void sub_81C4F98(u8, void(*)(void)); + +#endif // GUARD_POKEMON_SUMMARY_SCREEN_H diff --git a/include/shop.h b/include/shop.h index d3e86408c..9b14a672e 100644 --- a/include/shop.h +++ b/include/shop.h @@ -6,5 +6,6 @@ extern EWRAM_DATA struct ItemSlot gUnknown_02039F80[3]; void CreatePokemartMenu(const u16 *); void CreateDecorationShop1Menu(const u16 *); void CreateDecorationShop2Menu(const u16 *); +void CB2_ExitSellMenu(void); #endif // GUARD_SHOP_H diff --git a/include/strings.h b/include/strings.h index 24b2d3e6f..69fd1bba3 100644 --- a/include/strings.h +++ b/include/strings.h @@ -139,6 +139,14 @@ extern const u8 gMenuText_Use[]; extern const u8 gMenuText_Toss[]; extern const u8 gMenuText_Give[]; extern const u8 gMenuText_Give2[]; +extern const u8 gMenuText_Register[]; +extern const u8 gMenuText_Check[]; +extern const u8 gMenuText_Walk[]; +extern const u8 gMenuText_Deselect[]; +extern const u8 gMenuText_CheckTag[]; +extern const u8 gMenuText_Confirm[]; +extern const u8 gMenuText_Show[]; +extern const u8 gMenuText_Give2[]; extern const u8 gText_Cancel2[]; @@ -244,4 +252,52 @@ extern const u8 gText_Var1DotVar2[]; extern const u8 gText_ThreeMarks[]; extern const u8 gText_FirmSlash[]; +//item menu screen text +extern const u8 gText_CloseBag[]; +extern const u8 gText_ClearTo11Var1Clear5Var2[]; +extern const u8 gText_UnkF908Var1Clear7Var2[]; +extern const u8 gText_xVar1[]; +extern const u8 gText_ReturnToVar1[]; +extern const u8 gText_SelectorArrow2[]; +extern const u8 gText_MoveVar1Where[]; +extern const u8 gText_Var1IsSelected[]; +extern const u8 gText_TossHowManyVar1s[]; +extern const u8 gText_ConfirmTossItems[]; +extern const u8 gText_ThrewAwayVar2Var1s[]; +extern const u8 gText_CantWriteMail[]; +extern const u8 gText_NoPokemon[]; +extern const u8 gText_Var1CantBeHeld[]; +extern const u8 gText_Var1CantBeHeldHere[]; +extern const u8 gText_CantBuyKeyItem[]; +extern const u8 gText_HowManyToSell[]; +extern const u8 gText_ICanPayVar1[]; +extern const u8 gText_TurnedOverVar1ForVar2[]; +extern const u8 gText_DepositHowManyVar1[]; +extern const u8 gText_CantStoreImportantItems[]; +extern const u8 gText_DepositedVar2Var1s[]; +extern const u8 gText_NoRoomForItems[]; +extern const u8 gText_ThreeDashes[]; + +extern const u8 gBirchDexRatingText_LessThan10[]; +extern const u8 gBirchDexRatingText_LessThan20[]; +extern const u8 gBirchDexRatingText_LessThan30[]; +extern const u8 gBirchDexRatingText_LessThan40[]; +extern const u8 gBirchDexRatingText_LessThan50[]; +extern const u8 gBirchDexRatingText_LessThan60[]; +extern const u8 gBirchDexRatingText_LessThan70[]; +extern const u8 gBirchDexRatingText_LessThan80[]; +extern const u8 gBirchDexRatingText_LessThan90[]; +extern const u8 gBirchDexRatingText_LessThan100[]; +extern const u8 gBirchDexRatingText_LessThan110[]; +extern const u8 gBirchDexRatingText_LessThan120[]; +extern const u8 gBirchDexRatingText_LessThan130[]; +extern const u8 gBirchDexRatingText_LessThan140[]; +extern const u8 gBirchDexRatingText_LessThan150[]; +extern const u8 gBirchDexRatingText_LessThan160[]; +extern const u8 gBirchDexRatingText_LessThan170[]; +extern const u8 gBirchDexRatingText_LessThan180[]; +extern const u8 gBirchDexRatingText_LessThan190[]; +extern const u8 gBirchDexRatingText_LessThan200[]; +extern const u8 gBirchDexRatingText_DexCompleted[]; + #endif //GUARD_STRINGS_H diff --git a/include/text.h b/include/text.h index e073c3762..81c066426 100644 --- a/include/text.h +++ b/include/text.h @@ -208,6 +208,7 @@ void DecompressGlyphTile(const u16 *src, u16 *dest); u8 GetLastTextColor(u8 colorType); void CopyGlyphToWindow(struct TextPrinter *x); void ClearTextSpan(struct TextPrinter *textPrinter, u32 width); +u8 GetMenuCursorDimensionByFont(u8, u8); u16 Font0Func(struct TextPrinter *textPrinter); u16 Font1Func(struct TextPrinter *textPrinter); diff --git a/ld_script.txt b/ld_script.txt index c1bad970e..76b537915 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -79,7 +79,7 @@ SECTIONS { src/daycare.o(.text); src/egg_hatch.o(.text); src/battle_interface.o(.text); - asm/smokescreen.o(.text); + src/smokescreen.o(.text); src/pokeball.o(.text); src/load_save.o(.text); asm/trade.o(.text); @@ -183,7 +183,7 @@ SECTIONS { asm/fldeff_flash.o(.text); asm/post_battle_event_funcs.o(.text); src/time_events.o(.text); - asm/birch_pc.o(.text); + src/birch_pc.o(.text); src/hof_pc.o(.text); asm/field_specials.o(.text); asm/battle_records.o(.text); @@ -246,7 +246,7 @@ SECTIONS { asm/battle_frontier_1.o(.text); src/menu.o(.text); asm/battle_frontier_2.o(.text); - asm/item_menu.o(.text); + src/item_menu.o(.text); asm/list_menu.o(.text); asm/menu_indicators.o(.text); src/unk_text_util.o(.text); @@ -520,7 +520,7 @@ SECTIONS { data/battle_frontier_1.o(.rodata); src/menu.o(.rodata); data/battle_frontier_2.o(.rodata); - data/item_menu.o(.rodata); + src/item_menu.o(.rodata); data/menu_indicators.o(.rodata); src/save_location.o(.rodata); data/item_icon.o(.rodata); diff --git a/src/battle_setup.c b/src/battle_setup.c index 6b981d0c5..5b2bf4d98 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -49,6 +49,8 @@ struct TrainerBattleParameter u8 ptrType; }; +extern void (*gFieldCallback)(void); + extern bool8 InBattlePyramid(void); extern bool8 InBattlePike(void); extern bool32 InTrainerHill(void); diff --git a/src/birch_pc.c b/src/birch_pc.c new file mode 100644 index 000000000..0f44824f7 --- /dev/null +++ b/src/birch_pc.c @@ -0,0 +1,93 @@ +#include "global.h" +#include "event_data.h" +#include "field_message_box.h" +#include "pokedex.h" +#include "constants/species.h" +#include "strings.h" + +extern u16 gSpecialVar_0x8004; +extern u16 gSpecialVar_0x8005; +extern u16 gSpecialVar_0x8006; + +bool16 ScriptGetPokedexInfo(void) +{ + if (gSpecialVar_0x8004 == 0) // is national dex not present? + { + gSpecialVar_0x8005 = GetHoennPokedexCount(0); + gSpecialVar_0x8006 = GetHoennPokedexCount(1); + } + else + { + gSpecialVar_0x8005 = GetNationalPokedexCount(0); + gSpecialVar_0x8006 = GetNationalPokedexCount(1); + } + + return IsNationalPokedexEnabled(); +} + +// This shows your Hoenn Pokedex rating and not your National Dex. +const u8 *GetPokedexRatingText(u16 count) +{ + if (count < 10) + return gBirchDexRatingText_LessThan10; + if (count < 20) + return gBirchDexRatingText_LessThan20; + if (count < 30) + return gBirchDexRatingText_LessThan30; + if (count < 40) + return gBirchDexRatingText_LessThan40; + if (count < 50) + return gBirchDexRatingText_LessThan50; + if (count < 60) + return gBirchDexRatingText_LessThan60; + if (count < 70) + return gBirchDexRatingText_LessThan70; + if (count < 80) + return gBirchDexRatingText_LessThan80; + if (count < 90) + return gBirchDexRatingText_LessThan90; + if (count < 100) + return gBirchDexRatingText_LessThan100; + if (count < 110) + return gBirchDexRatingText_LessThan110; + if (count < 120) + return gBirchDexRatingText_LessThan120; + if (count < 130) + return gBirchDexRatingText_LessThan130; + if (count < 140) + return gBirchDexRatingText_LessThan140; + if (count < 150) + return gBirchDexRatingText_LessThan150; + if (count < 160) + return gBirchDexRatingText_LessThan160; + if (count < 170) + return gBirchDexRatingText_LessThan170; + if (count < 180) + return gBirchDexRatingText_LessThan180; + if (count < 190) + return gBirchDexRatingText_LessThan190; + if (count < 200) + return gBirchDexRatingText_LessThan200; + if (count == 200) + { + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) + || GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200. + return gBirchDexRatingText_LessThan200; + return gBirchDexRatingText_DexCompleted; + } + if (count == 201) + { + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1) + && GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // If both of these flags are enabled, it means the actual count is less than 200. + return gBirchDexRatingText_LessThan200; + return gBirchDexRatingText_DexCompleted; + } + if (count == 202) + return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210. + return gBirchDexRatingText_LessThan10; +} + +void ShowPokedexRatingMessage(void) +{ + ShowFieldMessage(GetPokedexRatingText(gSpecialVar_0x8004)); +} diff --git a/src/decoration.c b/src/decoration.c index aa2d3aef9..c1b12a4d3 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -38,6 +38,8 @@ #include "decoration.h" #include "graphics.h" +extern void (*gFieldCallback)(void); + // Static type declarations #define OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG 0xbe5 diff --git a/src/item_menu.c b/src/item_menu.c new file mode 100755 index 000000000..5e368a6eb --- /dev/null +++ b/src/item_menu.c @@ -0,0 +1,2448 @@ +#include "global.h" +#include "battle.h" +#include "battle_controllers.h" +#include "battle_frontier_2.h" +#include "berry_tag_screen.h" +#include "bg.h" +#include "constants/items.h" +#include "constants/songs.h" +#include "decompress.h" +#include "event_data.h" +#include "field_map_obj_helpers.h" +#include "field_player_avatar.h" +#include "field_specials.h" +#include "graphics.h" +#include "gpu_regs.h" +#include "international_string_util.h" +#include "item.h" +#include "item_menu_icons.h" +#include "item_use.h" +#include "lilycove_lady.h" +#include "list_menu.h" +#include "link.h" +#include "mail.h" +#include "main.h" +#include "malloc.h" +#include "map_name_popup.h" +#include "menu.h" +#include "menu_indicators.h" +#include "money.h" +#include "overworld.h" +#include "palette.h" +#include "party_menu.h" +#include "player_pc.h" +#include "pokemon.h" +#include "pokemon_summary_screen.h" +#include "rom_818CFC8.h" +#include "scanline_effect.h" +#include "script.h" +#include "shop.h" +#include "sound.h" +#include "sprite.h" +#include "string.h" +#include "strings.h" +#include "string_util.h" +#include "task.h" +#include "text_window.h" +#include "menu_helpers.h" +#include "window.h" + +void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); +void CB2_Bag(void); +bool8 setup_bag_menu(void); +void bag_menu_init_bgs(void); +bool8 load_bag_menu_graphics(void); +void setup_bag_menu_textboxes(void); +void allocate_bag_item_list_buffers(void); +void load_bag_item_list_buffers(u8); +void bag_menu_print_pocket_names(u8*, u8*); +void bag_menu_copy_pocket_name_to_window(u32); +void bag_menu_draw_pocket_indicator_square(u8, u8); +void AddBagVisualObject(u8); +void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void); +void bag_menu_add_list_scroll_arrow_indicators_maybe(void); +void bag_menu_prepare_tmhm_move_window(void); +bool8 IsWallysBag(void); +void Task_WallyTutorialBagMenu(u8); +void Task_BagMenu(u8); +void get_name(s8*, u16); +u16 ItemIdToBattleMoveId(u16); +void ShakeBagVisual(void); +u16 BagGetItemIdByPocketPosition(u8, u16); +void AddBagItemIconObject(u16, u8); +void bag_menu_print_description_box_text(int); +void bag_menu_print_cursor(u8, u8); +void bag_menu_print(u8, u8, const u8*, u8, u8, u8, u8, u8, u8); +bool8 itemid_is_unique(u16); +u16 BagGetQuantityByPocketPosition(u8, u16); +void sub_81AB89C(void); +void task_close_bag_menu_2(u8); +u8 AddItemMessageWindow(u8); +void bag_menu_RemoveBagItem_message_window(u8); +void set_callback3_to_bag(u8); +void sub_81ABC54(u8, s16); +u8 bag_menu_add_window(u8); +u8 GetSwitchBagPocketDirection(void); +void SwitchBagPocket(u8, s16, u16); +bool8 sub_81AC2C0(void); +void bag_menu_swap_items(u8); +void SetBagVisualPocketId(u8, u8); +void RemoveBagObject(u8); +void AddSwitchPocketRotatingBallObject(s16); +void sub_81AC10C(u8); +void sub_81AC3C0(u8); +void sub_81AC498(u8); +void sub_81AC590(u8); +void PrintTMHMMoveData(u16); +void sub_81ACAF8(u8); +void sub_81ACB54(u8, u8, u8); +void Task_HandleInBattleItemMenuInput(u8); +void Task_HandleOutOfBattleItemMenuInput(u8); +bool8 sub_81ACDFC(s8); +void bag_menu_remove_window(u8); +void bag_menu_print_there_is_no_pokemon(u8); +void Task_ChooseHowManyToToss(u8); +void BagMenuConfirmToss(u8); +void bag_menu_yes_no(u8, u8, const struct YesNoFuncTable*); +void Task_ActuallyToss(u8); +void ItemMenu_Cancel(u8); +void sub_81AD350(u8); +void bag_menu_print_cant_be_held_msg(u8); +void bag_menu_AddMoney_window(void); +void sub_81AD680(u8); +void sub_81AD730(u8); +void sub_81AD6E4(u8); +void bag_menu_remove_money_window(void); +void bag_menu_RemoveBagItem_message_window(u8); +void sub_81AD794(u8); +void sub_81AD8C8(u8); +void sub_81AD9C0(u8); +void sub_81ADB14(u8); +void sub_81ADA7C(u8); +void sub_81ADC0C(u8); +void bag_menu_leave_maybe_3(void); +void bag_menu_leave_maybe_2(void); +void bag_menu_leave_maybe(void); +void sub_81ABA6C(void); +void sub_81ABAC4(void); +void sub_81ABAE0(void); +u8 sub_81AB1F0(u8); +void sub_81AC23C(u8); +void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu*); +void sub_81AB520(u8 rboxId, int item_index_in_pocket, u8 a); +void ItemMenu_UseOutOfBattle(u8 taskId); +void ItemMenu_Toss(u8 taskId); +void ItemMenu_Register(u8 taskId); +void ItemMenu_Give(u8 taskId); +void ItemMenu_Cancel(u8 taskId); +void ItemMenu_UseInBattle(u8 taskId); +void ItemMenu_CheckTag(u8 taskId); +void unknown_ItemMenu_Confirm(u8 taskId); +void unknown_ItemMenu_Show(u8 taskId); +void unknown_ItemMenu_Give2(u8 taskId); +void unknown_ItemMenu_Confirm2(u8 taskId); +void unknown_item_menu_type(u8 taskId); +void item_menu_type_2(u8 taskId); +void display_sell_item_ask_str(u8 taskId); +void unknown_ItemMenu_Confirm(u8 taskId); +void display_deposit_item_ask_str(u8 taskId); +void item_menu_type_b(u8 taskId); +void BagMenuActuallyToss(u8 taskId); +void BagMenuCancelToss(u8 taskId); +void sub_81AD84C(u8 taskId); +void sub_81AD6FC(u8 taskId); + +// .rodata + +const struct BgTemplate gUnknown_08613F90[3] = { + {0, 0, 31, 0, 0, 1, 0}, + {1, 0, 30, 0, 0, 0, 0}, + {2, 3, 29, 0, 0, 2, 0} +}; + +const struct ListMenuTemplate gUnknown_08613F9C = { + NULL, bag_menu_change_item_callback, sub_81AB520, 0, 0, 0, 0, 8, 0, 1, 1, 0, 3, 0, 0, 0, 7, 0 +}; + +const struct MenuAction gUnknown_08613FB4[] = { + {gMenuText_Use, ItemMenu_UseOutOfBattle}, + {gMenuText_Toss, ItemMenu_Toss}, + {gMenuText_Register, ItemMenu_Register}, + {gMenuText_Give, ItemMenu_Give}, + {gText_Cancel2, ItemMenu_Cancel}, + {gMenuText_Use, ItemMenu_UseInBattle}, + {gMenuText_Check, ItemMenu_UseOutOfBattle}, + {gMenuText_Walk, ItemMenu_UseOutOfBattle}, + {gMenuText_Deselect, ItemMenu_Register}, + {gMenuText_CheckTag, ItemMenu_CheckTag}, + {gMenuText_Confirm, unknown_ItemMenu_Confirm}, + {gMenuText_Show, unknown_ItemMenu_Show}, + {gMenuText_Give2, unknown_ItemMenu_Give2}, + {gMenuText_Confirm, unknown_ItemMenu_Confirm2}, + {gText_EmptyString2, NULL} +}; + +const u8 gUnknown_0861402C[] = {0, 3, 1, 4}; +const u8 gUnknown_08614030[] = {0, 2, 14, 4}; +const u8 gUnknown_08614034[] = {3, 14, 1, 4}; +const u8 gUnknown_08614038[] = {0, 3, 14, 4}; +const u8 gUnknown_0861403C[] = {9, 14, 0, 3, 1, 4}; +const u8 gUnknown_08614042[] = {5, 4}; +const u8 gUnknown_08614044[] = {3, 4}; +const u8 gUnknown_08614046 = 4; +const u8 gUnknown_08614047[] = {10, 9, 14, 4}; +const u8 gUnknown_0861404B[] = {11, 4}; +const u8 gUnknown_0861404D[] = {12, 4}; +const u8 gUnknown_0861404F[] = {13, 4}; + +const TaskFunc gUnknown_08614054[] = { + unknown_item_menu_type, + unknown_item_menu_type, + item_menu_type_2, + display_sell_item_ask_str, + unknown_ItemMenu_Confirm, + unknown_item_menu_type, + display_deposit_item_ask_str, + unknown_item_menu_type, + unknown_item_menu_type, + unknown_item_menu_type, + NULL, + item_menu_type_b +}; + +const struct YesNoFuncTable gUnknown_08614084 = {BagMenuActuallyToss, BagMenuCancelToss}; + +const struct YesNoFuncTable gUnknown_0861408C = {sub_81AD84C, sub_81AD6FC}; + +const u16 gUnknown_08614094[] = {0x1C00, 0x110, 0x1064, -1, -1, 0x6F, 0x6F, 0}; + +const u8 gUnknown_086140A4[] = INCBIN_U8("graphics/interface/select_button.4bpp"); + +const u8 gUnknown_08614164[][3] = { + {0, 1, 3}, + {0, 1, 4}, + {0, 3, 6}, + {2, 1, 3}, + {0, 14, 10} +}; + +const struct WindowTemplate gUnknown_08614174[] = { + {0, 14, 2, 15, 16, 1, 0x27}, + {0, 0, 13, 14, 6, 1, 0x117}, + {0, 4, 1, 8, 2, 1, 0x1A1}, + {0, 1, 13, 5, 6, 12, 0x16B}, + {0, 7, 13, 4, 6, 12, 0x189}, + {1, 2, 15, 27, 4, 15, 0x1B1}, + {0xFF, 0, 0, 0, 0, 0, 0} +}; + +const struct WindowTemplate gUnknown_086141AC[] = { + {1, 22, 17, 7, 2, 15, 0x21D}, + {1, 22, 15, 7, 4, 15, 0x21D}, + {1, 15, 15, 14, 4, 15, 0x21D}, + {1, 15, 13, 14, 6, 15, 0x21D}, + {1, 2, 15, 27, 4, 15, 0x1B1}, + {1, 24, 15, 5, 4, 15, 0x21D}, + {1, 21, 9, 5, 4, 15, 0x21D}, + {1, 24, 17, 5, 2, 15, 0x21D}, + {1, 18, 11, 10, 2, 15, 0x245}, + {1, 1, 1, 10, 2, 15, 0x231} +}; + +// .text + +struct BagStruct { + void (*bagCallback)(void); + u8 location; + u8 pocket; + u8 unk6[2]; + u16 cursorPosition[5]; + u16 scrollPosition[5]; +}; + +struct UnkBagStruct { + MainCallback unk0; + u8 unk4[0x800]; + u8 unk804; + u8 unk805; + u8 unk806[10]; + u8 unk810[7]; + u8 unk817; + u8 unk818; + u8 unk819; + u8 unk81A; + u8 unk81B:4; + u8 unk81B_1:2; + u8 unk81B_3:1; + u8 unk81B_2:1; + u8 filler3[2]; + u8 unk81E; + u8 unk81F; + const u8* unk820; + u8 unk824; + u8 unk825; + u8 filler[2]; + u8 unk828; + u8 unk829[5]; + u8 unk82E[6]; + s16 unk834; + u8 filler4[0xE]; + u8 unk844[32][32]; + u8 filler2[4]; +}; + +struct ListBuffer1 { + struct ListMenuItem subBuffers[65]; +}; + +struct ListBuffer2 { + s8 name[65][24]; +}; + +struct TempWallyStruct { + struct ItemSlot bagPocket_Items[30]; + struct ItemSlot bagPocket_PokeBalls[16]; + u16 cursorPosition[5]; + u16 scrollPosition[5]; + u8 filler[0x2]; + u16 pocket; +}; + +EWRAM_DATA struct UnkBagStruct *gUnknown_0203CE54 = 0; +EWRAM_DATA struct BagStruct gUnknown_0203CE58 = {0, 0, 0, {0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}; +EWRAM_DATA struct ListBuffer1 *gUnknown_0203CE74 = 0; +EWRAM_DATA struct ListBuffer2 *gUnknown_0203CE78 = 0; +EWRAM_DATA u16 gSpecialVar_ItemId = 0; +EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0; + +void (*gFieldCallback)(void); + +extern u8 *gPocketNamesStringsTable[]; +extern u8 gUnknown_08D9A88C[]; +extern struct CompressedSpriteSheet gUnknown_0857FB34; +extern struct CompressedSpriteSheet gUnknown_0857FB3C; +extern struct CompressedSpritePalette gUnknown_0857FB44; +extern struct ListMenuTemplate gUnknown_08613F9C; +extern u8 gMoveNames[][0xD]; +extern u8* gReturnToXStringsTable[]; +extern u32 gUnknown_0203CE5E[]; +extern u8 EventScript_2736B3[]; +extern const u16 gUnknown_0860F074[]; +extern struct BattleMove gBattleMoves[]; + +void ResetBagScrollPositions(void) +{ + gUnknown_0203CE58.pocket = 0; + memset(gUnknown_0203CE58.cursorPosition, 0, 10); + memset(gUnknown_0203CE58.scrollPosition, 0, 10); +} + +void CB2_BagMenuFromStartMenu(void) +{ + GoToBagMenu(0, 5, CB2_ReturnToFieldWithOpenMenu); +} + +void sub_81AABB0(void) +{ + if (!InBattlePyramid()) + GoToBagMenu(1, 5, SetCB2ToReshowScreenAfterMenu2); + else + sub_81C4F98(1, SetCB2ToReshowScreenAfterMenu2); +} + +void CB2_ChooseBerry(void) +{ + GoToBagMenu(4, 3, sub_80861B0); +} + +void sub_81AABF0(void(*callback)(void)) +{ + GoToBagMenu(5, 3, callback); +} + +void CB2_GoToSellMenu(void) +{ + GoToBagMenu(3, 5, CB2_ExitSellMenu); +} + +void sub_81AAC14(void) +{ + GoToBagMenu(6, 5, sub_816B31C); +} + +void sub_81AAC28(void) +{ + GoToBagMenu(9, 5, bag_menu_leave_maybe_3); + gSpecialVar_0x8005 = 0; + gSpecialVar_Result = 0; +} + +void sub_81AAC50(void) +{ + GoToBagMenu(7, 5, bag_menu_leave_maybe_2); + gSpecialVar_Result = 0; +} + +void sub_81AAC70(void) +{ + GoToBagMenu(8, 5, bag_menu_leave_maybe); + gSpecialVar_Result = 0; +} + +void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()) +{ + u8 temp; + gUnknown_0203CE54 = AllocZeroed(sizeof(struct UnkBagStruct)); + if (gUnknown_0203CE54 == 0) + { + SetMainCallback2(postExitMenuMainCallback2); + } + else + { + if (bagMenuType != 12) + gUnknown_0203CE58.location = bagMenuType; + if (postExitMenuMainCallback2) + gUnknown_0203CE58.bagCallback = postExitMenuMainCallback2; + if (pocketId <= 4) + gUnknown_0203CE58.pocket = pocketId; + temp = gUnknown_0203CE58.location - 4; + if (temp <= 1) + gUnknown_0203CE54->unk81B = 1; + gUnknown_0203CE54->unk0 = 0; + gUnknown_0203CE54->unk81A = 0xFF; + gUnknown_0203CE54->unk81E = -1; + gUnknown_0203CE54->unk81F = -1; + memset(&gUnknown_0203CE54->unk804, 0xFF, 12); + memset(gUnknown_0203CE54->unk810, 0xFF, 10); + SetMainCallback2(CB2_Bag); + } +} + +void c2_bag_3(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); +} + +void vblank_cb_bag_menu(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void CB2_Bag(void) +{ + while(sub_81221EC() != TRUE && setup_bag_menu() != TRUE && sub_81221AC() != TRUE) {}; +} + +bool8 setup_bag_menu(void) +{ + u32 index; + u8 taskId; + + switch (gMain.state) + { + case 0: + SetVBlankHBlankCallbacksToNull(); + clear_scheduled_bg_copies_to_vram(); + gMain.state++; + break; + case 1: + ScanlineEffect_Stop(); + gMain.state++; + break; + case 2: + FreeAllSpritePalettes(); + gMain.state++; + break; + case 3: + ResetPaletteFade(); + gPaletteFade.bufferTransferDisabled = TRUE; + gMain.state++; + break; + case 4: + ResetSpriteData(); + gMain.state++; + break; + case 5: + gMain.state++; + break; + case 6: + if (sub_81221AC() == FALSE) + ResetTasks(); + gMain.state++; + break; + case 7: + bag_menu_init_bgs(); + gUnknown_0203CE54->unk834 = 0; + gMain.state++; + break; + case 8: + if (!load_bag_menu_graphics()) + break; + gMain.state++; + break; + case 9: + setup_bag_menu_textboxes(); + gMain.state++; + break; + case 10: + sub_81ABA6C(); + sub_81ABAC4(); + sub_81ABAE0(); + gMain.state++; + break; + case 11: + allocate_bag_item_list_buffers(); + gMain.state++; + break; + case 12: + load_bag_item_list_buffers(gUnknown_0203CE58.pocket); + gMain.state++; + break; + case 13: + bag_menu_print_pocket_names(gPocketNamesStringsTable[gUnknown_0203CE58.pocket], 0); + bag_menu_copy_pocket_name_to_window(0); + bag_menu_draw_pocket_indicator_square(gUnknown_0203CE58.pocket, 1); + gMain.state++; + break; + case 14: + taskId = sub_81AB1F0(gUnknown_0203CE58.location); + gTasks[taskId].data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[8] = 0; + gMain.state++; + break; + case 15: + AddBagVisualObject(gUnknown_0203CE58.pocket); + gMain.state++; + break; + case 16: + sub_80D4FAC(); + gMain.state++; + break; + case 17: + bag_menu_add_pocket_scroll_arrow_indicators_maybe(); + bag_menu_add_list_scroll_arrow_indicators_maybe(); + gMain.state++; + break; + case 18: + bag_menu_prepare_tmhm_move_window(); + gMain.state++; + break; + case 19: + BlendPalettes(-1, 16, 0); + gMain.state++; + break; + case 20: + BeginNormalPaletteFade(-1, 0, 16, 0, 0); + gPaletteFade.bufferTransferDisabled = FALSE; + gMain.state++; + break; + default: + SetVBlankCallback(vblank_cb_bag_menu); + SetMainCallback2(c2_bag_3); + return TRUE; + } + return FALSE; +} + +void bag_menu_init_bgs(void) +{ + ResetVramOamAndBgCntRegs(); + memset(gUnknown_0203CE54->unk4, 0, 0x800); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_08613F90, 3); + SetBgTilemapBuffer(2, gUnknown_0203CE54->unk4); + ResetAllBgsCoordinates(); + schedule_bg_copy_tilemap_to_vram(2); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + ShowBg(0); + ShowBg(1); + ShowBg(2); + SetGpuReg(REG_OFFSET_BLDCNT, 0); +} + +bool8 load_bag_menu_graphics(void) +{ + switch (gUnknown_0203CE54->unk834) + { + case 0: + reset_temp_tile_data_buffers(); + decompress_and_copy_tile_data_to_vram(2, gBagScreen_Gfx, 0, 0, 0); + gUnknown_0203CE54->unk834++; + break; + case 1: + if (free_temp_tile_data_buffers_if_possible() != TRUE) + { + LZDecompressWram(gUnknown_08D9A88C, gUnknown_0203CE54->unk4); + gUnknown_0203CE54->unk834++; + } + break; + case 2: + if (!IsWallysBag() && gSaveBlock2Ptr->playerGender != MALE) + LoadCompressedPalette(gBagScreenFemale_Pal, 0, 0x40); + else + LoadCompressedPalette(gBagScreenMale_Pal, 0, 0x40); + gUnknown_0203CE54->unk834++; + break; + case 3: + if (IsWallysBag() == TRUE || gSaveBlock2Ptr->playerGender == MALE) + LoadCompressedObjectPic(&gUnknown_0857FB34); + else + LoadCompressedObjectPic(&gUnknown_0857FB3C); + gUnknown_0203CE54->unk834++; + break; + case 4: + LoadCompressedObjectPalette(&gUnknown_0857FB44); + gUnknown_0203CE54->unk834++; + break; + default: + LoadListMenuArrowsGfx(); + gUnknown_0203CE54->unk834 = 0; + return TRUE; + } + return FALSE; +} + +u8 sub_81AB1F0(u8 a) +{ + u8 taskId; + if (a == 10) + taskId = CreateTask(Task_WallyTutorialBagMenu, 0); + else + taskId = CreateTask(Task_BagMenu, 0); + return taskId; +} + +void allocate_bag_item_list_buffers(void) +{ + gUnknown_0203CE74 = Alloc(sizeof(struct ListBuffer1)); + gUnknown_0203CE78 = Alloc(sizeof(struct ListBuffer2)); +} + +void load_bag_item_list_buffers(u8 pocketId) +{ + u16 i; + struct BagPocket *pocket = &gBagPockets[pocketId]; + struct ListMenuItem *subBuffer; + + if (!gUnknown_0203CE54->unk81B_2) + { + for (i = 0; i < gUnknown_0203CE54->unk829[pocketId] - 1; i++) + { + get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId); + subBuffer = gUnknown_0203CE74->subBuffers; + subBuffer[i].name = gUnknown_0203CE78->name[i]; + subBuffer[i].id = i; + } + StringCopy(gUnknown_0203CE78->name[i], gText_CloseBag); + subBuffer = gUnknown_0203CE74->subBuffers; + subBuffer[i].name = gUnknown_0203CE78->name[i]; + subBuffer[i].id = -2; + } + else + { + for (i = 0; i < gUnknown_0203CE54->unk829[pocketId]; i++) + { + get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId); + subBuffer = gUnknown_0203CE74->subBuffers; + subBuffer[i].name = gUnknown_0203CE78->name[i]; + subBuffer[i].id = i; + } + } + gMultiuseListMenuTemplate = gUnknown_08613F9C; + gMultiuseListMenuTemplate.totalItems = gUnknown_0203CE54->unk829[pocketId]; + gMultiuseListMenuTemplate.items = gUnknown_0203CE74->subBuffers; + gMultiuseListMenuTemplate.maxShowed = gUnknown_0203CE54->unk82E[pocketId]; +} + +void get_name(s8 *dest, u16 itemId) +{ + switch (gUnknown_0203CE58.pocket) + { + case 2: + StringCopy(gStringVar2, gMoveNames[ItemIdToBattleMoveId(itemId)]); + if (itemId >= ITEM_HM01) + { + ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_HM01 + 1, 2, 1); + StringExpandPlaceholders(dest, gText_ClearTo11Var1Clear5Var2); + } + else + { + ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_TM01 + 1, 2, 2); + StringExpandPlaceholders(dest, gText_UnkF908Var1Clear7Var2); + } + break; + case 3: + ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_CHERI_BERRY + 1, 2, 2); + CopyItemName(itemId, gStringVar2); + StringExpandPlaceholders(dest, gText_UnkF908Var1Clear7Var2); + break; + default: + CopyItemName(itemId, dest); + break; + } +} + +void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu *unused) +{ + if (b != 1) + { + PlaySE(SE_SELECT); + ShakeBagVisual(); + } + if (gUnknown_0203CE54->unk81A == 0xFF) + { + RemoveBagItemIconObject(1 ^ gUnknown_0203CE54->unk81B_1); + if (a != -2) + AddBagItemIconObject(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a), gUnknown_0203CE54->unk81B_1); + else + AddBagItemIconObject(-1, gUnknown_0203CE54->unk81B_1); + gUnknown_0203CE54->unk81B_1 ^= 1; + if (!gUnknown_0203CE54->unk81B_3) + bag_menu_print_description_box_text(a); + } +} + +void sub_81AB520(u8 rboxId, int item_index_in_pocket, u8 a) +{ + u16 itemId; + u16 itemQuantity; + bool8 unique; + int offset; + if (item_index_in_pocket != -2) + { + if (gUnknown_0203CE54->unk81A != 0xFF) + { + if (gUnknown_0203CE54->unk81A == (u8)item_index_in_pocket) + bag_menu_print_cursor(a, 2); + else + bag_menu_print_cursor(a, -1); + } + itemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, item_index_in_pocket); + itemQuantity = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, item_index_in_pocket); + if ((u16)(itemId - ITEM_HM01) <= 7) + BlitBitmapToWindow(rboxId, gBagMenuHMIcon_Gfx, 8, a - 1, 16, 16); + if (gUnknown_0203CE58.pocket == 3) + { + ConvertIntToDecimalStringN(gStringVar1, itemQuantity, 1, 3); + StringExpandPlaceholders(gStringVar4, gText_xVar1); + offset = GetStringRightAlignXOffset(7, gStringVar4, 0x77); + bag_menu_print(rboxId, 7, gStringVar4, offset, a, 0, 0, -1, 0); + } + else if (gUnknown_0203CE58.pocket != 4 && (unique = itemid_is_unique(itemId)) == FALSE) + { + ConvertIntToDecimalStringN(gStringVar1, itemQuantity, 1, 2); + StringExpandPlaceholders(gStringVar4, gText_xVar1); + offset = GetStringRightAlignXOffset(7, gStringVar4, 0x77); + bag_menu_print(rboxId, 7, gStringVar4, offset, a, unique, unique, -1, unique); + } + else + { + if (gSaveBlock1Ptr->registeredItem && gSaveBlock1Ptr->registeredItem == itemId) + BlitBitmapToWindow(rboxId, gUnknown_086140A4, 0x60, a - 1, 0x18, 16); + } + } +} + +void bag_menu_print_description_box_text(int a) +{ + u8* str; + if (a != -2) + { + str = (u8*)ItemId_GetDescription(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a)); + } + else + { + StringCopy(gStringVar1, gReturnToXStringsTable[gUnknown_0203CE58.location]); + StringExpandPlaceholders(gStringVar4, gText_ReturnToVar1); + str = gStringVar4; + } + FillWindowPixelBuffer(1, 0); + bag_menu_print(1, 1, str, 3, 1, 0, 0, 0, 0); +} + +void bag_menu_print_cursor_(u8 a, u8 b) +{ + bag_menu_print_cursor(ListMenuGetYCoordForPrintingArrowCursor(a), b); +} + +void bag_menu_print_cursor(u8 a, u8 b) +{ + if (b == 0xFF) + FillWindowPixelRect(0, 0, 0, a, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1)); + else + bag_menu_print(0, 1, gText_SelectorArrow2, 0, a, 0, 0, 0, b); + +} + +void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void) +{ + if (gUnknown_0203CE54->unk81E == 0xFF) + gUnknown_0203CE54->unk81E = AddScrollIndicatorArrowPairParametrized(2, 0xAC, 12, 0x94, gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - gUnknown_0203CE54->unk82E[gUnknown_0203CE58.pocket], 0x6E, 0x6E, &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]); +} + +void sub_81AB824(void) +{ + if (gUnknown_0203CE54->unk81E != 0xFF) + { + RemoveScrollIndicatorArrowPair(gUnknown_0203CE54->unk81E); + gUnknown_0203CE54->unk81E = 0xFF; + } + sub_81AB89C(); +} + +void bag_menu_add_list_scroll_arrow_indicators_maybe(void) +{ + if (gUnknown_0203CE54->unk81B != 1 && gUnknown_0203CE54->unk81F == 0xFF) + gUnknown_0203CE54->unk81F = AddScrollIndicatorArrowPair(&gUnknown_08614094, gUnknown_0203CE58.unk6); +} + +void sub_81AB89C(void) +{ + if (gUnknown_0203CE54->unk81F != 0xFF) + { + RemoveScrollIndicatorArrowPair(gUnknown_0203CE54->unk81F); + gUnknown_0203CE54->unk81F = 0xFF; + } +} + +void free_bag_item_list_buffers(void) +{ + Free(gUnknown_0203CE78); + Free(gUnknown_0203CE74); + FreeAllWindowBuffers(); + Free(gUnknown_0203CE54); +} + +void unknown_ItemMenu_Confirm(u8 taskId) +{ + BeginNormalPaletteFade(-1, 0, 0, 16, 0); + gTasks[taskId].func = task_close_bag_menu_2; +} + +void task_close_bag_menu_2(u8 taskId) +{ + s16* data = gTasks[taskId].data; + if (!gPaletteFade.active) + { + sub_81AE6C8(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + if (gUnknown_0203CE54->unk0 != 0) + SetMainCallback2(gUnknown_0203CE54->unk0); + else + SetMainCallback2(gUnknown_0203CE58.bagCallback); + sub_81AB824(); + ResetSpriteData(); + FreeAllSpritePalettes(); + free_bag_item_list_buffers(); + DestroyTask(taskId); + } +} + +void sub_81AB9A8(u8 pocketId) +{ + u16 i; + struct BagPocket *pocket = &gBagPockets[pocketId]; + switch (pocketId) + { + case 2: + case 3: + sub_80D6FB4(pocket); + break; + default: + sub_80D6F64(pocket); + break; + } + gUnknown_0203CE54->unk829[pocketId] = 0; + for (i = 0; i < pocket->capacity && pocket->itemSlots[i].itemId; i++) + gUnknown_0203CE54->unk829[pocketId]++; + if (!gUnknown_0203CE54->unk81B_2) + gUnknown_0203CE54->unk829[pocketId]++; + if (gUnknown_0203CE54->unk829[pocketId] > 8) + gUnknown_0203CE54->unk82E[pocketId] = 8; + else + gUnknown_0203CE54->unk82E[pocketId] = gUnknown_0203CE54->unk829[pocketId]; +} + +void sub_81ABA6C(void) +{ + u8 i; + for (i = 0; i < 5; i++) + sub_81AB9A8(i); +} + +void sub_81ABA88(u8 a) +{ + sub_812225C(&gUnknown_0203CE58.scrollPosition[a], &gUnknown_0203CE58.cursorPosition[a], gUnknown_0203CE54->unk82E[a], gUnknown_0203CE54->unk829[a]); +} + +void sub_81ABAC4(void) +{ + u8 i; + for (i = 0; i < 5; i++) + sub_81ABA88(i); +} + +void sub_81ABAE0(void) +{ + u8 i; + for (i = 0; i < 5; i++) + sub_8122298(&gUnknown_0203CE58.scrollPosition[i], &gUnknown_0203CE58.cursorPosition[i], gUnknown_0203CE54->unk82E[i], gUnknown_0203CE54->unk829[i], 8); +} + +u8 sub_81ABB2C(u8 a) +{ + return gUnknown_0203CE58.scrollPosition[a] + gUnknown_0203CE58.cursorPosition[a]; +} + +void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u8 taskId)) +{ + s16* data = gTasks[taskId].data; + + data[10] = AddItemMessageWindow(4); + FillWindowPixelBuffer(data[10], 17); + DisplayMessageAndContinueTask(taskId, data[10], 10, 13, fontId, GetPlayerTextSpeed(), str, callback); + schedule_bg_copy_tilemap_to_vram(1); +} + +void bag_menu_inits_lists_menu(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]; + u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; + bag_menu_RemoveBagItem_message_window(4); + sub_81AE6C8(data[0], scrollPos, cursorPos); + sub_81AB9A8(gUnknown_0203CE58.pocket); + sub_81ABA88(gUnknown_0203CE58.pocket); + load_bag_item_list_buffers(gUnknown_0203CE58.pocket); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); + schedule_bg_copy_tilemap_to_vram(0); + set_callback3_to_bag(taskId); +} + +void sub_81ABC3C(u8 a) +{ + sub_81ABC54(bag_menu_add_window(a), 1); +} + +void sub_81ABC54(u8 a, s16 b) +{ + u8 r3 = (gUnknown_0203CE58.pocket == 3) ? 3 : 2; + ConvertIntToDecimalStringN(gStringVar1, b, 2, r3); + StringExpandPlaceholders(gStringVar4, gText_xVar1); + PrintTextOnWindow(a, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 0x28), 2, 0, 0); +} + +void sub_81ABCC0(int a, int b, int c) +{ + u8 r3 = (gUnknown_0203CE58.pocket == 3) ? 3 : 2; + ConvertIntToDecimalStringN(gStringVar1, b, 2, r3); + StringExpandPlaceholders(gStringVar4, gText_xVar1); + PrintTextOnWindow(a, 1, gStringVar4, 0, 1, -1, 0); + PrintMoneyAmount(a, 0x26, 1, c, 0); +} + +void Task_BagMenu(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]; + u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; + u16 select; + if (sub_81221EC() != TRUE && !gPaletteFade.active) + { + switch (GetSwitchBagPocketDirection()) + { + case 1: + SwitchBagPocket(taskId, -1, 0); + return; + case 2: + SwitchBagPocket(taskId, 1, 0); + return; + } + if ((select = (gMain.newKeys & SELECT_BUTTON))) + { + if (sub_81AC2C0() == 1) + { + sub_81AE860(data[0], scrollPos, cursorPos); + if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - 1) + { + PlaySE(SE_SELECT); + bag_menu_swap_items(taskId); + } + } + return; + } + else + { + int r4 = ListMenuHandleInputGetItemId(data[0]); + sub_81AE860(data[0], scrollPos, cursorPos); + switch (r4) + { + case -1: + break; + case -2: + if (gUnknown_0203CE58.location == 5) + { + PlaySE(SE_HAZURE); + break; + } + PlaySE(SE_SELECT); + gSpecialVar_ItemId = select; + gTasks[taskId].func = unknown_ItemMenu_Confirm; + break; + default: + PlaySE(SE_SELECT); + sub_81AB824(); + bag_menu_print_cursor_(data[0], 2); + data[1] = r4; + data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, r4); + gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, r4); + gUnknown_08614054[gUnknown_0203CE58.location](taskId); + break; + } + } + } +} + +void set_callback3_to_bag(u8 taskId) +{ + bag_menu_add_pocket_scroll_arrow_indicators_maybe(); + bag_menu_add_list_scroll_arrow_indicators_maybe(); + ClearWindowTilemap(3); + ClearWindowTilemap(4); + PutWindowTilemap(1); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = Task_BagMenu; +} + +u8 GetSwitchBagPocketDirection(void) +{ + u8 LRKeys; + if (gUnknown_0203CE54->unk81B != 0) + return 0; + LRKeys = GetLRKeysState(); + if ((gMain.newKeys & DPAD_LEFT) || LRKeys == 1) + { + PlaySE(SE_SELECT); + return 1; + } + if ((gMain.newKeys & DPAD_RIGHT) || LRKeys == 2) + { + PlaySE(SE_SELECT); + return 2; + } + return 0; +} + + +void ChangeBagPocketId(u8 *bagPocketId, s8 deltaBagPocketId) +{ + if (deltaBagPocketId == 1 && *bagPocketId == 4) + *bagPocketId = 0; + else if (deltaBagPocketId == -1 && *bagPocketId == 0) + *bagPocketId = 4; + else + *bagPocketId += deltaBagPocketId; +} + +#ifdef NONMATCHING +void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3) +{ + s16* data = gTasks[taskId].data; + u8 pocketId; + + + data[13] = 0; + data[12] = 0; + data[11] = deltaBagPocketId; + if (a3 == 0) + { + ClearWindowTilemap(0); + ClearWindowTilemap(1); + sub_81AE6C8(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + schedule_bg_copy_tilemap_to_vram(0); + gSprites[gUnknown_0203CE54->unk806[gUnknown_0203CE54->unk81B_1 ^ 1]].invisible = 1; + sub_81AB824(); + } + pocketId = gUnknown_0203CE58.pocket; + ChangeBagPocketId(&pocketId, deltaBagPocketId); + if (deltaBagPocketId == 1) + { + bag_menu_print_pocket_names(gPocketNamesStringsTable[gUnknown_0203CE58.pocket], gPocketNamesStringsTable[pocketId]); + bag_menu_copy_pocket_name_to_window(0); + } + else + { + bag_menu_print_pocket_names(gPocketNamesStringsTable[pocketId], gPocketNamesStringsTable[gUnknown_0203CE58.pocket]); + bag_menu_copy_pocket_name_to_window(8); + } + bag_menu_draw_pocket_indicator_square(gUnknown_0203CE58.pocket, 0); + bag_menu_draw_pocket_indicator_square(pocketId, 1); + FillBgTilemapBufferRect_Palette0(2, 11, 14, 2, 15, 16); + schedule_bg_copy_tilemap_to_vram(2); + SetBagVisualPocketId(pocketId, 1); + RemoveBagObject(1); + AddSwitchPocketRotatingBallObject(deltaBagPocketId); + SetTaskFuncWithFollowupFunc(taskId, sub_81AC10C, gTasks[taskId].func); +} +#else +__attribute__((naked)) +void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3) +{ + asm(".syntax unified\n\ + push {r4-r6,lr}\n\ + sub sp, 0xC\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + lsls r1, 16\n\ + lsrs r5, r1, 16\n\ + lsls r2, 16\n\ + lsls r0, r6, 2\n\ + adds r0, r6\n\ + lsls r0, 3\n\ + ldr r1, =gTasks + 0x8\n\ + adds r4, r0, r1\n\ + movs r0, 0\n\ + strh r0, [r4, 0x1A]\n\ + strh r0, [r4, 0x18]\n\ + strh r5, [r4, 0x16]\n\ + cmp r2, 0\n\ + bne _081AC026\n\ + movs r0, 0\n\ + bl ClearWindowTilemap\n\ + movs r0, 0x1\n\ + bl ClearWindowTilemap\n\ + ldrb r0, [r4]\n\ + ldr r3, =gUnknown_0203CE58\n\ + ldrb r2, [r3, 0x5]\n\ + lsls r2, 1\n\ + adds r1, r3, 0\n\ + adds r1, 0x12\n\ + adds r1, r2, r1\n\ + adds r3, 0x8\n\ + adds r2, r3\n\ + bl sub_81AE6C8\n\ + movs r0, 0\n\ + bl schedule_bg_copy_tilemap_to_vram\n\ + ldr r3, =gSprites\n\ + ldr r0, =gUnknown_0203CE54\n\ + ldr r2, [r0]\n\ + ldr r1, =0x0000081b\n\ + adds r0, r2, r1\n\ + ldrb r1, [r0]\n\ + lsls r1, 26\n\ + lsrs r1, 30\n\ + movs r0, 0x1\n\ + eors r0, r1\n\ + adds r2, r0\n\ + ldr r0, =0x00000806\n\ + adds r2, r0\n\ + ldrb r1, [r2]\n\ + lsls r0, r1, 4\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + adds r0, r3\n\ + adds r0, 0x3E\n\ + ldrb r1, [r0]\n\ + movs r2, 0x4\n\ + orrs r1, r2\n\ + strb r1, [r0]\n\ + bl sub_81AB824\n\ +_081AC026:\n\ + ldr r4, =gUnknown_0203CE58\n\ + ldrb r1, [r4, 0x5]\n\ + add r0, sp, 0x8\n\ + strb r1, [r0]\n\ + lsls r1, r5, 24\n\ + asrs r1, 24\n\ + bl ChangeBagPocketId\n\ + lsls r0, r5, 16\n\ + asrs r1, r0, 16\n\ + adds r5, r0, 0\n\ + cmp r1, 0x1\n\ + bne _081AC07C\n\ + ldr r2, =gPocketNamesStringsTable\n\ + ldrb r0, [r4, 0x5]\n\ + lsls r0, 2\n\ + adds r0, r2\n\ + ldr r0, [r0]\n\ + add r1, sp, 0x8\n\ + ldrb r1, [r1]\n\ + lsls r1, 2\n\ + adds r1, r2\n\ + ldr r1, [r1]\n\ + bl bag_menu_print_pocket_names\n\ + movs r0, 0\n\ + bl bag_menu_copy_pocket_name_to_window\n\ + b _081AC09A\n\ + .pool\n\ +_081AC07C:\n\ + ldr r2, =gPocketNamesStringsTable\n\ + add r0, sp, 0x8\n\ + ldrb r0, [r0]\n\ + lsls r0, 2\n\ + adds r0, r2\n\ + ldr r0, [r0]\n\ + ldrb r1, [r4, 0x5]\n\ + lsls r1, 2\n\ + adds r1, r2\n\ + ldr r1, [r1]\n\ + bl bag_menu_print_pocket_names\n\ + movs r0, 0x8\n\ + bl bag_menu_copy_pocket_name_to_window\n\ +_081AC09A:\n\ + ldr r0, =gUnknown_0203CE58\n\ + ldrb r0, [r0, 0x5]\n\ + movs r1, 0\n\ + bl bag_menu_draw_pocket_indicator_square\n\ + add r0, sp, 0x8\n\ + ldrb r0, [r0]\n\ + movs r1, 0x1\n\ + bl bag_menu_draw_pocket_indicator_square\n\ + movs r0, 0xF\n\ + str r0, [sp]\n\ + movs r0, 0x10\n\ + str r0, [sp, 0x4]\n\ + movs r0, 0x2\n\ + movs r1, 0xB\n\ + movs r2, 0xE\n\ + movs r3, 0x2\n\ + bl FillBgTilemapBufferRect_Palette0\n\ + movs r0, 0x2\n\ + bl schedule_bg_copy_tilemap_to_vram\n\ + add r0, sp, 0x8\n\ + ldrb r0, [r0]\n\ + movs r1, 0x1\n\ + bl SetBagVisualPocketId\n\ + movs r0, 0x1\n\ + bl RemoveBagObject\n\ + asrs r0, r5, 16\n\ + bl AddSwitchPocketRotatingBallObject\n\ + ldr r1, =sub_81AC10C\n\ + ldr r2, =gTasks\n\ + lsls r0, r6, 2\n\ + adds r0, r6\n\ + lsls r0, 3\n\ + adds r0, r2\n\ + ldr r2, [r0]\n\ + adds r0, r6, 0\n\ + bl SetTaskFuncWithFollowupFunc\n\ + add sp, 0xC\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_81AC10C(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (!sub_81221AC() && !IsWallysBag()) + { + switch (GetSwitchBagPocketDirection()) + { + case 1: + ChangeBagPocketId(&gUnknown_0203CE58.pocket, data[11]); + SwitchTaskToFollowupFunc(taskId); + SwitchBagPocket(taskId, -1, 1); + return; + case 2: + ChangeBagPocketId(&gUnknown_0203CE58.pocket, data[11]); + SwitchTaskToFollowupFunc(taskId); + SwitchBagPocket(taskId, 1, 1); + return; + } + } + switch (data[13]) + { + case 0: + sub_81AC23C(data[12]); + if (!(++data[12] & 1)) + { + if (data[11] == 1) + bag_menu_copy_pocket_name_to_window((u8)(data[12] >> 1)); + else + bag_menu_copy_pocket_name_to_window((u8)(8 - (data[12] >> 1))); + } + if (data[12] == 16) + data[13]++; + break; + case 1: + ChangeBagPocketId(&gUnknown_0203CE58.pocket, data[11]); + load_bag_item_list_buffers(gUnknown_0203CE58.pocket); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + PutWindowTilemap(1); + PutWindowTilemap(2); + schedule_bg_copy_tilemap_to_vram(0); + bag_menu_add_pocket_scroll_arrow_indicators_maybe(); + bag_menu_add_list_scroll_arrow_indicators_maybe(); + SwitchTaskToFollowupFunc(taskId); + } +} + +void sub_81AC23C(u8 a) +{ + FillBgTilemapBufferRect_Palette0(2, 17, 14, a + 2, 15, 1); + schedule_bg_copy_tilemap_to_vram(2); +} + +void bag_menu_draw_pocket_indicator_square(u8 x, u8 is_current_bag) +{ + if (is_current_bag == 0) + FillBgTilemapBufferRect_Palette0(2, 0x1017, x + 5, 3, 1, 1); + else + FillBgTilemapBufferRect_Palette0(2, 0x102B, x + 5, 3, 1, 1); + schedule_bg_copy_tilemap_to_vram(2); +} + +bool8 sub_81AC2C0(void) +{ + if (gUnknown_0203CE58.location <= 1) + { + u8 temp = gUnknown_0203CE58.pocket - 2; + if (temp > 1) + return TRUE; + } + return FALSE; +} + +void bag_menu_swap_items(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + sub_81AF15C(data[0], 16, 1); + data[1] = gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket] + gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; + gUnknown_0203CE54->unk81A = data[1]; + CopyItemName(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, data[1]), gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_MoveVar1Where); + FillWindowPixelBuffer(1, 0); + bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); + sub_80D4FEC(data[1]); + sub_81AB89C(); + bag_menu_print_cursor_(data[0], 2); + gTasks[taskId].func = sub_81AC3C0; +} + +void sub_81AC3C0(u8 taskId) +{ + s16* data = gTasks[taskId].data; + int r7; + + if (sub_81221EC() != TRUE) + { + if (gMain.newKeys & SELECT_BUTTON) + { + PlaySE(SE_SELECT); + sub_81AE860(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + sub_81AC498(taskId); + } + else + { + r7 = ListMenuHandleInputGetItemId(data[0]); + sub_81AE860(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + sub_80D4FC8(0); + sub_80D4FEC(gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + switch (r7) + { + case -1: + break; + case -2: + PlaySE(SE_SELECT); + if (gMain.newKeys & A_BUTTON) + sub_81AC498(taskId); + else + sub_81AC590(taskId); + break; + default: + PlaySE(SE_SELECT); + sub_81AC498(taskId); + } + } + } +} + +void sub_81AC498(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]; + u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; + u16 realPos = (*scrollPos + *cursorPos); + + if (data[1] == realPos || data[1] == (realPos - 1)) + sub_81AC590(taskId); + else + { + sub_80D702C(gBagPockets[gUnknown_0203CE58.pocket].itemSlots, data[1], realPos); + gUnknown_0203CE54->unk81A = -1; + sub_81AE6C8(data[0], scrollPos, cursorPos); + if (data[1] < realPos) + gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]--; + load_bag_item_list_buffers(gUnknown_0203CE58.pocket); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); + sub_80D4FC8(1); + bag_menu_add_list_scroll_arrow_indicators_maybe(); + gTasks[taskId].func = Task_BagMenu; + } +} + +void sub_81AC590(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]; + u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; + + gUnknown_0203CE54->unk81A = -1; + sub_81AE6C8(data[0], scrollPos, cursorPos); + if (data[1] < (*scrollPos + *cursorPos)) + gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]--; + load_bag_item_list_buffers(gUnknown_0203CE58.pocket); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); + sub_80D4FC8(1); + bag_menu_add_list_scroll_arrow_indicators_maybe(); + gTasks[taskId].func = Task_BagMenu; +} + +void sub_81AC644(u8 unused) +{ + switch (gUnknown_0203CE58.location - 1) + { + case 0: + case 9: + if (ItemId_GetBattleUsage(gSpecialVar_ItemId)) + { + gUnknown_0203CE54->unk820 = gUnknown_08614042; + gUnknown_0203CE54->unk828 = 2; + } + else + { + gUnknown_0203CE54->unk820 = &gUnknown_08614046; + gUnknown_0203CE54->unk828 = 1; + } + break; + case 4: + gUnknown_0203CE54->unk820 = gUnknown_08614047; + gUnknown_0203CE54->unk828 = 4; + break; + case 8: + if (!itemid_is_unique(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY) + { + gUnknown_0203CE54->unk820 = gUnknown_0861404B; + gUnknown_0203CE54->unk828 = 2; + } + else + { + gUnknown_0203CE54->unk820 = &gUnknown_08614046; + gUnknown_0203CE54->unk828 = 1; + } + break; + case 6: + if (!itemid_is_unique(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY) + { + gUnknown_0203CE54->unk820 = gUnknown_0861404D; + gUnknown_0203CE54->unk828 = 2; + } + else + { + gUnknown_0203CE54->unk820 = &gUnknown_08614046; + gUnknown_0203CE54->unk828 = 1; + } + break; + case 7: + if (!itemid_is_unique(gSpecialVar_ItemId) && gSpecialVar_ItemId != ITEM_ENIGMA_BERRY) + { + gUnknown_0203CE54->unk820 = gUnknown_0861404F; + gUnknown_0203CE54->unk828 = 2; + } + else + { + gUnknown_0203CE54->unk820 = &gUnknown_08614046; + gUnknown_0203CE54->unk828 = 1; + } + break; + case 1: + case 2: + case 3: + case 5: + default: + if (sub_81221AC() == TRUE || InUnionRoom() == TRUE) + { + if (gUnknown_0203CE58.pocket == 4 || !sub_8122148(gSpecialVar_ItemId)) + { + gUnknown_0203CE54->unk820 = &gUnknown_08614046; + gUnknown_0203CE54->unk828 = 1; + } + else + { + gUnknown_0203CE54->unk820 = gUnknown_08614044; + gUnknown_0203CE54->unk828 = 2; + } + } + else + { + switch (gUnknown_0203CE58.pocket) + { + case 0: + gUnknown_0203CE54->unk820 = &gUnknown_0203CE54->unk824; + gUnknown_0203CE54->unk828 = 4; + memcpy(&gUnknown_0203CE54->unk824, &gUnknown_0861402C, 4); + if (ItemIsMail(gSpecialVar_ItemId) == TRUE) + gUnknown_0203CE54->unk824 = 6; + break; + case 4: + gUnknown_0203CE54->unk820 = &gUnknown_0203CE54->unk824; + gUnknown_0203CE54->unk828 = 4; + memcpy(&gUnknown_0203CE54->unk824, &gUnknown_08614030, 4); + if (gSaveBlock1Ptr->registeredItem == gSpecialVar_ItemId) + gUnknown_0203CE54->unk825 = 8; + if (gSpecialVar_ItemId == ITEM_MACH_BIKE || gSpecialVar_ItemId == ITEM_ACRO_BIKE) + { + if (TestPlayerAvatarFlags(6)) + gUnknown_0203CE54->unk824 = 7; + } + break; + case 1: + gUnknown_0203CE54->unk820 = gUnknown_08614034; + gUnknown_0203CE54->unk828 = 4; + break; + case 2: + gUnknown_0203CE54->unk820 = gUnknown_08614038; + gUnknown_0203CE54->unk828 = 4; + break; + case 3: + gUnknown_0203CE54->unk820 = gUnknown_0861403C; + gUnknown_0203CE54->unk828 = 6; + break; + } + } + } + if (gUnknown_0203CE58.pocket == 2) + { + ClearWindowTilemap(1); + PrintTMHMMoveData(gSpecialVar_ItemId); + PutWindowTilemap(3); + PutWindowTilemap(4); + schedule_bg_copy_tilemap_to_vram(0); + } + else + { + CopyItemName(gSpecialVar_ItemId, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_Var1IsSelected); + FillWindowPixelBuffer(1, 0); + bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); + } + if (gUnknown_0203CE54->unk828 == 1) + sub_81ACAF8(bag_menu_add_window(0)); + else if (gUnknown_0203CE54->unk828 == 2) + sub_81ACAF8(bag_menu_add_window(1)); + else if (gUnknown_0203CE54->unk828 == 4) + sub_81ACB54(bag_menu_add_window(2), 2, 2); + else + sub_81ACB54(bag_menu_add_window(3), 2, 3); +} + +void sub_81ACAF8(u8 a) +{ + AddItemMenuActionTextPrinters(a, 7, 8, 1, 0, 16, gUnknown_0203CE54->unk828, gUnknown_08613FB4, gUnknown_0203CE54->unk820); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(a, gUnknown_0203CE54->unk828, 0); +} + +void sub_81ACB54(u8 a, u8 b, u8 c) +{ + sub_8198DBC(a, 7, 8, 1, 0x38, b, c, gUnknown_08613FB4, gUnknown_0203CE54->unk820); + sub_8199944(a, 0x38, b, c, 0); +} + +void unknown_item_menu_type(u8 taskId) +{ + sub_81AC644(taskId); + if (gUnknown_0203CE54->unk828 <= 2) + gTasks[taskId].func = Task_HandleInBattleItemMenuInput; + else + gTasks[taskId].func = Task_HandleOutOfBattleItemMenuInput; +} + +void Task_HandleInBattleItemMenuInput(u8 taskId) +{ + if (sub_81221EC() != TRUE) + { + s8 r4 = ProcessMenuInputNoWrapAround(); + switch (r4) + { + case -2: + break; + case -1: + PlaySE(SE_SELECT); + gUnknown_08613FB4[4].func.void_u8(taskId); + break; + default: + PlaySE(SE_SELECT); + gUnknown_08613FB4[gUnknown_0203CE54->unk820[r4]].func.void_u8(taskId); + break; + } + } +} + +void Task_HandleOutOfBattleItemMenuInput(u8 taskId) +{ + if (sub_81221EC() != TRUE) + { + s8 cursorPos = GetMenuCursorPos(); + if (gMain.newKeys & DPAD_UP) + { + if (cursorPos > 0 && sub_81ACDFC(cursorPos - 2)) + { + PlaySE(SE_SELECT); + sub_8199134(0, -1); + } + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (cursorPos < (gUnknown_0203CE54->unk828 - 2) && sub_81ACDFC(cursorPos + 2)) + { + PlaySE(SE_SELECT); + sub_8199134(0, 1); + } + } + else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysState() == 1) + { + if ((cursorPos & 1) && sub_81ACDFC(cursorPos - 1)) + { + PlaySE(SE_SELECT); + sub_8199134(-1, 0); + } + } + else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysState() == 2) + { + if (!(cursorPos & 1) && sub_81ACDFC(cursorPos + 1)) + { + PlaySE(SE_SELECT); + sub_8199134(1, 0); + } + } + else if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + gUnknown_08613FB4[gUnknown_0203CE54->unk820[cursorPos]].func.void_u8(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + gUnknown_08613FB4[4].func.void_u8(taskId); + } + } +} + +bool8 sub_81ACDFC(s8 a) +{ + if (a < 0) + return FALSE; + if (a > gUnknown_0203CE54->unk828) + return FALSE; + if (gUnknown_0203CE54->unk820[a] == 14) + return FALSE; + return TRUE; +} + +void bag_menu_remove_some_window(void) +{ + if (gUnknown_0203CE54->unk828 == 1) + bag_menu_remove_window(0); + else if (gUnknown_0203CE54->unk828 == 2) + { + bag_menu_remove_window(1); + } + else if (gUnknown_0203CE54->unk828 == 4) + { + bag_menu_remove_window(2); + } + else + bag_menu_remove_window(3); +} + +void ItemMenu_UseOutOfBattle(u8 taskId) +{ + if (ItemId_GetFieldFunc(gSpecialVar_ItemId)) + { + bag_menu_remove_some_window(); + if (CalculatePlayerPartyCount() == 0 && ItemId_GetType(gSpecialVar_ItemId) == 1) + bag_menu_print_there_is_no_pokemon(taskId); + else + { + FillWindowPixelBuffer(1, 0); + schedule_bg_copy_tilemap_to_vram(0); + if (gUnknown_0203CE58.pocket != 3) + ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); + else + sub_80FDD10(taskId); + } + } +} + +void ItemMenu_Toss(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + bag_menu_remove_some_window(); + data[8] = 1; + if (data[2] == 1) + { + BagMenuConfirmToss(taskId); + } + else + { + CopyItemName(gSpecialVar_ItemId, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_TossHowManyVar1s); + FillWindowPixelBuffer(1, 0); + bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); + sub_81ABC3C(7); + gTasks[taskId].func = Task_ChooseHowManyToToss; + } +} + +void BagMenuConfirmToss(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + CopyItemName(gSpecialVar_ItemId, gStringVar1); + ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3); + StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems); + FillWindowPixelBuffer(1, 0); + bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); + bag_menu_yes_no(taskId, 5, &gUnknown_08614084); +} + +void BagMenuCancelToss(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + bag_menu_print_description_box_text(data[1]); + bag_menu_print_cursor_(data[0], 0); + set_callback3_to_bag(taskId); +} + +void Task_ChooseHowManyToToss(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE) + { + sub_81ABC54(gUnknown_0203CE54->unk817, data[8]); + } + else if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + bag_menu_remove_window(7); + BagMenuConfirmToss(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + bag_menu_remove_window(7); + BagMenuCancelToss(taskId); + } +} + +void BagMenuActuallyToss(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + CopyItemName(gSpecialVar_ItemId, gStringVar1); + ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3); + StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s); + FillWindowPixelBuffer(1, 0); + bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); + gTasks[taskId].func = Task_ActuallyToss; +} + +void Task_ActuallyToss(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]; + u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; + + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + PlaySE(SE_SELECT); + RemoveBagItem(gSpecialVar_ItemId, data[8]); + sub_81AE6C8(data[0], scrollPos, cursorPos); + sub_81AB9A8(gUnknown_0203CE58.pocket); + sub_81ABA88(gUnknown_0203CE58.pocket); + load_bag_item_list_buffers(gUnknown_0203CE58.pocket); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); + schedule_bg_copy_tilemap_to_vram(0); + set_callback3_to_bag(taskId); + } +} + +void ItemMenu_Register(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]; + u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; + + if (gSaveBlock1Ptr->registeredItem == gSpecialVar_ItemId) + gSaveBlock1Ptr->registeredItem = 0; + else + gSaveBlock1Ptr->registeredItem = gSpecialVar_ItemId; + sub_81AE6C8(data[0], scrollPos, cursorPos); + load_bag_item_list_buffers(gUnknown_0203CE58.pocket); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); + schedule_bg_copy_tilemap_to_vram(0); + ItemMenu_Cancel(taskId); +} + +void ItemMenu_Give(u8 taskId) +{ + bag_menu_remove_some_window(); + if (!itemid_80BF6D8_mail_related(gSpecialVar_ItemId)) + { + DisplayItemMessage(taskId, 1, gText_CantWriteMail, sub_81AD350); + } + else if (!itemid_is_unique(gSpecialVar_ItemId)) + { + if (CalculatePlayerPartyCount() == 0) + bag_menu_print_there_is_no_pokemon(taskId); + else + { + gUnknown_0203CE54->unk0 = sub_81B7F60; + unknown_ItemMenu_Confirm(taskId); + } + } + else + { + bag_menu_print_cant_be_held_msg(taskId); + } +} + +void bag_menu_print_there_is_no_pokemon(u8 taskId) +{ + DisplayItemMessage(taskId, 1, gText_NoPokemon, sub_81AD350); +} + +void bag_menu_print_cant_be_held_msg(u8 taskId) +{ + CopyItemName(gSpecialVar_ItemId, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_Var1CantBeHeld); + DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD350); +} + +void sub_81AD350(u8 taskId) +{ + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + bag_menu_inits_lists_menu(taskId); + } +} + +void ItemMenu_CheckTag(u8 taskId) +{ + gUnknown_0203CE54->unk0 = DoBerryTagScreen; + unknown_ItemMenu_Confirm(taskId); +} + +void ItemMenu_Cancel(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + bag_menu_remove_some_window(); + bag_menu_print_description_box_text(data[1]); + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(1); + bag_menu_print_cursor_(data[0], 0); + set_callback3_to_bag(taskId); +} + +void ItemMenu_UseInBattle(u8 taskId) +{ + if (ItemId_GetBattleFunc(gSpecialVar_ItemId)) + { + bag_menu_remove_some_window(); + ItemId_GetBattleFunc(gSpecialVar_ItemId)(taskId); + } +} + +void bag_menu_mail_related(void) +{ + GoToBagMenu(12, 5, NULL); +} + +void item_menu_type_2(u8 taskId) +{ + if (!itemid_80BF6D8_mail_related(gSpecialVar_ItemId)) + { + DisplayItemMessage(taskId, 1, gText_CantWriteMail, sub_81AD350); + } + else if (!sub_8122148(gSpecialVar_ItemId)) + { + CopyItemName(gSpecialVar_ItemId, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_Var1CantBeHeldHere); + DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD350); + } + else if (gUnknown_0203CE58.pocket != 4 && !itemid_is_unique(gSpecialVar_ItemId)) + { + unknown_ItemMenu_Confirm(taskId); + } + else + { + bag_menu_print_cant_be_held_msg(taskId); + } +} + +void item_menu_type_b(u8 taskId) +{ + if (ItemIsMail(gSpecialVar_ItemId) == TRUE) + DisplayItemMessage(taskId, 1, gText_CantWriteMail, sub_81AD350); + else if (gUnknown_0203CE58.pocket != 4 && !itemid_is_unique(gSpecialVar_ItemId)) + gTasks[taskId].func = unknown_ItemMenu_Confirm; + else + bag_menu_print_cant_be_held_msg(taskId); +} + +bool8 UseRegisteredKeyItemOnField(void) +{ + u8 taskId; + + if (InUnionRoom() == TRUE || InBattlePyramid() || InBattlePike() || InMultiBattleRoom() == TRUE) + return FALSE; + HideMapNamePopUpWindow(); + ChangeBgY_ScreenOff(0, 0, 0); + if (gSaveBlock1Ptr->registeredItem != ITEM_NONE) + { + if (CheckBagHasItem(gSaveBlock1Ptr->registeredItem, 1) == TRUE) + { + ScriptContext2_Enable(); + FreezeMapObjects(); + sub_808B864(); + sub_808BCF4(); + gSpecialVar_ItemId = gSaveBlock1Ptr->registeredItem; + taskId = CreateTask(ItemId_GetFieldFunc(gSaveBlock1Ptr->registeredItem), 8); + gTasks[taskId].data[3] = 1; + return TRUE; + } + else + gSaveBlock1Ptr->registeredItem = ITEM_NONE; + } + ScriptContext1_SetupScript(EventScript_2736B3); + return TRUE; +} + +void display_sell_item_ask_str(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (itemid_get_market_price(gSpecialVar_ItemId) == 0) + { + CopyItemName(gSpecialVar_ItemId, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_CantBuyKeyItem); + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + } + else + { + data[8] = 1; + if (data[2] == 1) + { + bag_menu_AddMoney_window(); + sub_81AD680(taskId); + } + else + { + CopyItemName(gSpecialVar_ItemId, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_HowManyToSell); + DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD730); + } + } +} + +void sub_81AD680(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + ConvertIntToDecimalStringN(gStringVar1, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8], 0, 6); + StringExpandPlaceholders(gStringVar4, gText_ICanPayVar1); + DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD6E4); +} + +void sub_81AD6E4(u8 taskId) +{ + bag_menu_yes_no(taskId, 6, &gUnknown_0861408C); +} + +void sub_81AD6FC(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + bag_menu_remove_money_window(); + bag_menu_RemoveBagItem_message_window(4); + bag_menu_print_cursor_(data[0], 0); + set_callback3_to_bag(taskId); +} + +void sub_81AD730(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u8 windowId = bag_menu_add_window(8); + + sub_81ABCC0(windowId, 1, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8]); + bag_menu_AddMoney_window(); + gTasks[taskId].func = sub_81AD794; +} + +void sub_81AD794(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE) + { + sub_81ABCC0(gUnknown_0203CE54->unk818, data[8], (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8]); + } + else if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + bag_menu_remove_window(8); + sub_81AD680(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + bag_menu_print_cursor_(data[0], 0); + bag_menu_remove_money_window(); + bag_menu_remove_window(8); + bag_menu_RemoveBagItem_message_window(4); + set_callback3_to_bag(taskId); + } +} + +void sub_81AD84C(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + CopyItemName(gSpecialVar_ItemId, gStringVar2); + ConvertIntToDecimalStringN(gStringVar1, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8], 0, 6); + StringExpandPlaceholders(gStringVar4, gText_TurnedOverVar1ForVar2); + DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD8C8); +} + +void sub_81AD8C8(u8 taskId) +{ + s16* data = gTasks[taskId].data; + u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]; + u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; + + PlaySE(SE_REGI); + RemoveBagItem(gSpecialVar_ItemId, data[8]); + AddMoney(&gSaveBlock1Ptr->money, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8]); + sub_81AE6C8(data[0], scrollPos, cursorPos); + sub_81AB9A8(gUnknown_0203CE58.pocket); + sub_81ABA88(gUnknown_0203CE58.pocket); + load_bag_item_list_buffers(gUnknown_0203CE58.pocket); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); + bag_menu_print_cursor_(data[0], 2); + PrintMoneyAmountInMoneyBox(gUnknown_0203CE54->unk819, GetMoney(&gSaveBlock1Ptr->money), 0); + gTasks[taskId].func = sub_81AD9C0; +} + +void sub_81AD9C0(u8 taskId) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + PlaySE(SE_SELECT); + bag_menu_remove_money_window(); + bag_menu_inits_lists_menu(taskId); + } +} + +void display_deposit_item_ask_str(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + data[8] = 1; + if (data[2] == 1) + { + sub_81ADB14(taskId); + } + else + { + CopyItemName(gSpecialVar_ItemId, gStringVar1); + StringExpandPlaceholders(gStringVar4, gText_DepositHowManyVar1); + FillWindowPixelBuffer(1, 0); + bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); + sub_81ABC3C(7); + gTasks[taskId].func = sub_81ADA7C; + } +} + +void sub_81ADA7C(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE) + { + sub_81ABC54(gUnknown_0203CE54->unk817, data[8]); + } + else if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + bag_menu_remove_window(7); + sub_81ADB14(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + bag_menu_print_description_box_text(data[1]); + bag_menu_print_cursor_(data[0], 0); + bag_menu_remove_window(7); + set_callback3_to_bag(taskId); + } +} + +void sub_81ADB14(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + FillWindowPixelBuffer(1, 0); + if (itemid_is_unique(gSpecialVar_ItemId)) + { + bag_menu_print(1, 1, gText_CantStoreImportantItems, 3, 1, 0, 0, 0, 0); + gTasks[taskId].func = sub_81ADC0C; + } + else if (AddPCItem(gSpecialVar_ItemId, data[8]) == TRUE) + { + CopyItemName(gSpecialVar_ItemId, gStringVar1); + ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3); + StringExpandPlaceholders(gStringVar4, gText_DepositedVar2Var1s); + bag_menu_print(1, 1, gStringVar4, 3, 1, 0, 0, 0, 0); + gTasks[taskId].func = Task_ActuallyToss; + } + else + { + bag_menu_print(1, 1, gText_NoRoomForItems, 3, 1, 0, 0, 0, 0); + gTasks[taskId].func = sub_81ADC0C; + } +} + +void sub_81ADC0C(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + PlaySE(SE_SELECT); + bag_menu_print_description_box_text(data[1]); + bag_menu_print_cursor_(data[0], 0); + set_callback3_to_bag(taskId); + } +} + +bool8 IsWallysBag(void) +{ + if (gUnknown_0203CE58.location == 10) + return TRUE; + return FALSE; +} + +void PrepareBagForWallyTutorial(void) +{ + u32 i; + + gUnknown_0203CE80 = AllocZeroed(sizeof(struct TempWallyStruct)); + memcpy(gUnknown_0203CE80->bagPocket_Items, gSaveBlock1Ptr->bagPocket_Items, sizeof(gSaveBlock1Ptr->bagPocket_Items)); + memcpy(gUnknown_0203CE80->bagPocket_PokeBalls, gSaveBlock1Ptr->bagPocket_PokeBalls, sizeof(gSaveBlock1Ptr->bagPocket_PokeBalls)); + gUnknown_0203CE80->pocket = gUnknown_0203CE58.pocket; + for (i = 0; i <= 4; i++) + { + gUnknown_0203CE80->cursorPosition[i] = gUnknown_0203CE58.cursorPosition[i]; + gUnknown_0203CE80->scrollPosition[i] = gUnknown_0203CE58.scrollPosition[i]; + } + ClearItemSlots(gSaveBlock1Ptr->bagPocket_Items, 30); + ClearItemSlots(gSaveBlock1Ptr->bagPocket_PokeBalls, 16); + ResetBagScrollPositions(); +} + +void RestoreBagAfterWallyTutorial(void) +{ + u32 i; + + memcpy(gSaveBlock1Ptr->bagPocket_Items, gUnknown_0203CE80->bagPocket_Items, sizeof(gUnknown_0203CE80->bagPocket_Items)); + memcpy(gSaveBlock1Ptr->bagPocket_PokeBalls, gUnknown_0203CE80->bagPocket_PokeBalls, sizeof(gUnknown_0203CE80->bagPocket_PokeBalls)); + gUnknown_0203CE58.pocket = gUnknown_0203CE80->pocket; + for (i = 0; i <= 4; i++) + { + gUnknown_0203CE58.cursorPosition[i] = gUnknown_0203CE80->cursorPosition[i]; + gUnknown_0203CE58.scrollPosition[i] = gUnknown_0203CE80->scrollPosition[i]; + } + Free(gUnknown_0203CE80); +} + +void DoWallyTutorialBagMenu(void) +{ + PrepareBagForWallyTutorial(); + AddBagItem(ITEM_POTION, 1); + AddBagItem(ITEM_POKE_BALL, 1); + GoToBagMenu(10, 0, SetCB2ToReshowScreenAfterMenu2); +} + +void Task_WallyTutorialBagMenu(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (!gPaletteFade.active) + { + switch (data[8]) + { + case 0x66: + PlaySE(SE_SELECT); + SwitchBagPocket(taskId, 1, 0); + data[8]++; + break; + case 0xCC: + PlaySE(SE_SELECT); + bag_menu_print_cursor_(data[0], 2); + gSpecialVar_ItemId = ITEM_POKE_BALL; + sub_81AC644(taskId); + data[8]++; + break; + case 0x132: + PlaySE(SE_SELECT); + bag_menu_remove_some_window(); + sub_81AE6C8(data[0], 0, 0); + RestoreBagAfterWallyTutorial(); + unknown_ItemMenu_Confirm(taskId); + break; + default: + data[8]++; + break; + } + } +} + +void unknown_ItemMenu_Show(u8 taskId) +{ + gSpecialVar_0x8005 = gSpecialVar_ItemId; + gSpecialVar_Result = 1; + bag_menu_remove_some_window(); + unknown_ItemMenu_Confirm(taskId); +} + +void bag_menu_leave_maybe_3(void) +{ + gFieldCallback = sub_819FA50; + SetMainCallback2(CB2_ReturnToField); +} + +void unknown_ItemMenu_Give2(u8 taskId) +{ + RemoveBagItem(gSpecialVar_ItemId, 1); + gSpecialVar_Result = 1; + bag_menu_remove_some_window(); + unknown_ItemMenu_Confirm(taskId); +} + +void bag_menu_leave_maybe_2(void) +{ + gFieldCallback = sub_818DEF4; + SetMainCallback2(CB2_ReturnToField); +} + +void unknown_ItemMenu_Confirm2(u8 taskId) +{ + gSpecialVar_Result = 1; + bag_menu_remove_some_window(); + unknown_ItemMenu_Confirm(taskId); +} + +void bag_menu_leave_maybe(void) +{ + gFieldCallback = sub_818E564; + SetMainCallback2(CB2_ReturnToField); +} + +void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2) +{ + struct WindowTemplate window = {0, 0, 0, 0, 0, 0, 0}; + u16 windowId; + int offset; + + window.width = 16; + window.height = 2; + windowId = AddWindow(&window); + FillWindowPixelBuffer(windowId, 0); + offset = GetStringCenterAlignXOffset(1, pocketName1, 0x40); + bag_menu_print(windowId, 1, pocketName1, offset, 1, 0, 0, -1, 1); + if (pocketName2) + { + offset = GetStringCenterAlignXOffset(1, pocketName2, 0x40); + bag_menu_print(windowId, 1, pocketName2, offset + 0x40, 1, 0, 0, -1, 1); + } + CpuCopy32((u8*)GetWindowAttribute(windowId, 7), gUnknown_0203CE54->unk844, 0x400); + RemoveWindow(windowId); +} + +void bag_menu_copy_pocket_name_to_window(u32 a) +{ + u8 (* r4)[32][32]; + u8* windowAttribute; + int b; + if (a > 8) + a = 8; + r4 = &gUnknown_0203CE54->unk844; + windowAttribute = (u8*)GetWindowAttribute(2, 7); + CpuCopy32(r4[0][a], windowAttribute, 0x100); + b = a + 16; + CpuCopy32(r4[0][b], windowAttribute + 0x100, 0x100); + CopyWindowToVram(2, 2); +} + +void setup_bag_menu_textboxes(void) +{ + u8 i; + + InitWindows(gUnknown_08614174); + DeactivateAllTextPrinters(); + sub_809882C(0, 1, -32); + copy_textbox_border_tile_patterns_to_vram(0, 10, -48); + sub_819A2BC(-64, 1); + LoadPalette(&gUnknown_0860F074, 0xF0, 0x20); + for (i = 0; i < 3; i++) + { + FillWindowPixelBuffer(i, 0); + PutWindowTilemap(i); + } + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(1); +} + +void bag_menu_print(u8 a, u8 b, const u8 *str, u8 c, u8 d, u8 e, u8 f, u8 g, u8 h) +{ + AddTextPrinterParameterized2(a, b, c, d, e, f, gUnknown_08614164[h], g, str); +} + +u8 sub_81AE124(u8 a) +{ + return gUnknown_0203CE54->unk810[a]; +} + +u8 bag_menu_add_window(u8 a) +{ + u8 *ptr = &gUnknown_0203CE54->unk810[a]; + if (*ptr == 0xFF) + { + *ptr = AddWindow(&gUnknown_086141AC[a]); + SetWindowBorderStyle(*ptr, 0, 1, 14); + schedule_bg_copy_tilemap_to_vram(1); + } + return *ptr; +} + +void bag_menu_remove_window(u8 a) +{ + u8 *ptr = &gUnknown_0203CE54->unk810[a]; + if (*ptr != 0xFF) + { + sub_8198070(*ptr, 0); + ClearWindowTilemap(*ptr); + RemoveWindow(*ptr); + schedule_bg_copy_tilemap_to_vram(1); + *ptr = 0xFF; + } +} + +u8 AddItemMessageWindow(u8 a) +{ + u8 *ptr = &gUnknown_0203CE54->unk810[a]; + if (*ptr == 0xFF) + *ptr = AddWindow(&gUnknown_086141AC[a]); + return *ptr; +} + +void bag_menu_RemoveBagItem_message_window(u8 a) +{ + u8 *ptr = &gUnknown_0203CE54->unk810[a]; + if (*ptr != 0xFF) + { + sub_8197DF8(*ptr, 0); + ClearWindowTilemap(*ptr); + RemoveWindow(*ptr); + schedule_bg_copy_tilemap_to_vram(1); + *ptr = 0xFF; + } +} + +void bag_menu_yes_no(u8 a, u8 b, const struct YesNoFuncTable *funcTable) +{ + CreateYesNoMenuWithCallbacks(a, &gUnknown_086141AC[b], 1, 0, 2, 1, 14, funcTable); +} + +void bag_menu_AddMoney_window(void) +{ + u8 windowId = bag_menu_add_window(9); + PrintMoneyAmountInMoneyBoxWithBorder(windowId, 1, 14, GetMoney(&gSaveBlock1Ptr->money)); + AddMoneyLabelObject(19, 11); +} + +void bag_menu_remove_money_window(void) +{ + bag_menu_remove_window(9); + RemoveMoneyLabelObject(); +} + +void bag_menu_prepare_tmhm_move_window(void) +{ + FillWindowPixelBuffer(3, 0); + blit_move_info_icon(3, 19, 0, 0); + blit_move_info_icon(3, 20, 0, 12); + blit_move_info_icon(3, 21, 0, 24); + blit_move_info_icon(3, 22, 0, 36); + CopyWindowToVram(3, 2); +} + +void PrintTMHMMoveData(u16 itemId) +{ + u8 i; + u16 moveId; + const u8* text; + + FillWindowPixelBuffer(4, 0); + if (itemId == ITEM_NONE) + { + for (i = 0; i < 4; i++) + bag_menu_print(4, 1, gText_ThreeDashes, 7, i * 12, 0, 0, -1, 4); + CopyWindowToVram(4, 2); + } + else + { + moveId = ItemIdToBattleMoveId(itemId); + blit_move_info_icon(4, gBattleMoves[moveId].type + 1, 0, 0); + if (gBattleMoves[moveId].power <= 1) + { + text = gText_ThreeDashes; + } + else + { + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].power, 1, 3); + text = gStringVar1; + } + bag_menu_print(4, 1, text, 7, 12, 0, 0, -1, 4); + if (gBattleMoves[moveId].accuracy == 0) + { + text = gText_ThreeDashes; + } + else + { + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].accuracy, 1, 3); + text = gStringVar1; + } + bag_menu_print(4, 1, text, 7, 24, 0, 0, -1, 4); + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveId].pp, 1, 3); + bag_menu_print(4, 1, gStringVar1, 7, 36, 0, 0, -1, 4); + CopyWindowToVram(4, 2); + } +} diff --git a/src/item_use.c b/src/item_use.c index b9d84ad95..3b6b286b7 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -1,6 +1,7 @@ #include "global.h" #include "item_use.h" #include "battle.h" +#include "main.h" #include "berry.h" #include "bike.h" #include "coins.h" @@ -90,6 +91,7 @@ extern u8* sub_806CF78(u16); extern void sub_81B89F0(void); extern u8 GetItemEffectType(u16); extern struct MapConnection *sub_8088A8C(s16, s16); +extern void (*gFieldCallback)(void); void MapPostLoadHook_UseItem(void); void sub_80AF6D4(void); @@ -113,13 +115,13 @@ void sub_80FE024(u8 taskId); void sub_80FE124(u8 taskId); void sub_80FE164(u8 taskId); -void DisplayItemMessage(u8 taskId, u8 a, u8* str, void(*callback)(u8 taskId)); +void DisplayItemMessage(u8 taskId, u8 a, const u8* str, void(*callback)(u8 taskId)); void DisplayItemMessageInBattlePyramid(u8 taskId, u8* str, void(*callback)(u8 taskId)); void DisplayItemMessageOnField(u8 taskId, u8* str, void(*callback)(u8 taskId)); void sub_81C6714(u8 taskId); void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId); void StartFishing(u8 a); -bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8); +bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8); u8 sub_80FD9B0(s16 a, s16 b); void sub_80FDA24(u8 a); void sub_80FD8E0(u8 taskId, s16 x, s16 y); @@ -363,7 +365,7 @@ void sub_80FD5CC(u8 taskId) DestroyTask(taskId); } -bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId) +bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *events, u8 taskId) { int distanceX, distanceY; s16 x, y, i, newDistanceX, newDistanceY; @@ -390,7 +392,7 @@ bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId) return FALSE; } -bool8 sub_80FD6D4(struct MapEvents *events, s16 x, s16 y) +bool8 sub_80FD6D4(const struct MapEvents *events, s16 x, s16 y) { u8 bgEventCount = events->bgEventCount; struct BgEvent *bgEvent = events->bgEvents; diff --git a/src/menu.c b/src/menu.c index d06f950d3..b20ab5164 100644 --- a/src/menu.c +++ b/src/menu.c @@ -63,7 +63,7 @@ static EWRAM_DATA void *gUnknown_0203CDAC[0x20] = {NULL}; const u16 gUnknown_0860F074[] = INCBIN_U16("graphics/interface/860F074.gbapal"); static const u8 gUnknown_0860F094[] = { 8, 4, 1 }; -static const struct WindowTemplate gUnknown_0860F098[] = +static const struct WindowTemplate gUnknown_0860F098[] = { { 0x00, 0x02, 0x0F, 0x1B, 0x04, 0x0F, 0x194 }, DUMMY_WIN_TEMPLATE @@ -76,7 +76,7 @@ static const struct WindowTemplate gUnknown_0860F0A8 = const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal"); const u8 gUnknown_0860F0D0[] = { 15, 1, 2 }; -const struct SomeUnkStruct_60F0D4 gUnknown_0860F0D4[] = +const struct SomeUnkStruct_60F0D4 gUnknown_0860F0D4[] = { { 12, 12, 0x00 }, { 32, 12, 0x20 }, @@ -151,7 +151,7 @@ u16 sub_8197224(void) u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor) { struct TextSubPrinter printer; - + printer.current_text_offset = str; printer.windowId = windowId; printer.fontId = fontId; @@ -165,9 +165,9 @@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, printer.fgColor = fgColor; printer.bgColor = bgColor; printer.shadowColor = shadowColor; - + gTextFlags.flag_1 = 0; - return AddTextPrinter(&printer, speed, callback); + return AddTextPrinter(&printer, speed, callback); } void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress) @@ -234,7 +234,7 @@ void sub_819746C(u8 windowId, bool8 copyToVram) void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { int i; - + FillBgTilemapBufferRect(bg, STD_WINDOW_BASE_TILE_NUM + 0, tilemapLeft - 1, @@ -256,7 +256,7 @@ void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height 1, 1, STD_WINDOW_PALETTE_NUM); - + for (i = tilemapTop; i < tilemapTop + height; i++) { FillBgTilemapBufferRect(bg, @@ -274,7 +274,7 @@ void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height 1, STD_WINDOW_PALETTE_NUM); } - + FillBgTilemapBufferRect(bg, STD_WINDOW_BASE_TILE_NUM + 6, tilemapLeft - 1, @@ -1941,7 +1941,7 @@ void box_print(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 spee printer.fgColor = color[1]; printer.bgColor = color[0]; printer.shadowColor = color[2]; - + AddTextPrinter(&printer, speed, NULL); } @@ -1962,7 +1962,7 @@ void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 left, u8 top, u8 le printer.fgColor = color[1]; printer.bgColor = color[0]; printer.shadowColor = color[2]; - + AddTextPrinter(&printer, speed, NULL); } @@ -2373,14 +2373,14 @@ void sub_819A344(u8 a0, u8 *a1, u8 a2) s32 flagCount; u8 *endOfString; u8 *string = a1; - + *(string++) = EXT_CTRL_CODE_BEGIN; *(string++) = EXT_CTRL_CODE_COLOR; *(string++) = a2; *(string++) = EXT_CTRL_CODE_BEGIN; *(string++) = EXT_CTRL_CODE_SHADOW; *(string++) = a2 + 1; - + switch (a0) { case 0: @@ -2388,9 +2388,9 @@ void sub_819A344(u8 a0, u8 *a1, u8 a2) break; case 1: if (IsNationalPokedexEnabled()) - string = ConvertIntToDecimalStringN(string, pokedex_count(1), 0, 3); + string = ConvertIntToDecimalStringN(string, GetNationalPokedexCount(1), 0, 3); else - string = ConvertIntToDecimalStringN(string, sub_80C0844(1), 0, 3); + string = ConvertIntToDecimalStringN(string, GetHoennPokedexCount(1), 0, 3); *string = EOS; break; case 2: diff --git a/src/secret_base.c b/src/secret_base.c index 63787c43c..df754f2a0 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -3,6 +3,7 @@ #include "global.h" #include "constants/decorations.h" #include "malloc.h" +#include "main.h" #include "task.h" #include "palette.h" #include "list_menu.h" @@ -39,6 +40,10 @@ #include "tv.h" #include "secret_base.h" +extern void (*gFieldCallback)(void); + +extern void mapldr_default(void); + // Static type declarations struct SecretBaseListMenuBuffer { @@ -244,7 +249,7 @@ void sub_80E8C98(void) void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile) { - struct MapData *mapData; + const struct MapData *mapData; s16 x; s16 y; @@ -773,7 +778,7 @@ void sub_80E9AD0(void) u16 i; u16 j; s16 tile; - struct MapEvents *events; + const struct MapEvents *events; events = gMapHeader.events; for (i = 0; i < events->bgEventCount; i ++) diff --git a/src/smokescreen.c b/src/smokescreen.c new file mode 100644 index 000000000..9b37cd234 --- /dev/null +++ b/src/smokescreen.c @@ -0,0 +1,71 @@ +#include "global.h" +#include "data2.h" +#include "decompress.h" +#include "sprite.h" +#include "util.h" + +static void sub_8075370(struct Sprite *); + +u8 sub_807521C(s16 x, s16 y, u8 a3) +{ + u8 mainSpriteId; + u8 spriteId1, spriteId2, spriteId3, spriteId4; + struct Sprite *mainSprite; + + if (GetSpriteTileStartByTag(gUnknown_0831C620.tag) == 0xFFFF) + { + LoadCompressedObjectPicUsingHeap(&gUnknown_0831C620); + LoadCompressedObjectPaletteUsingHeap(&gUnknown_0831C628); + } + + mainSpriteId = CreateInvisibleSpriteWithCallback(sub_8075370); + mainSprite = &gSprites[mainSpriteId]; + mainSprite->data[1] = a3; + + spriteId1 = CreateSprite(&gUnknown_0831C688, x - 16, y - 16, 2); + gSprites[spriteId1].data[0] = mainSpriteId; + mainSprite->data[0]++; + AnimateSprite(&gSprites[spriteId1]); + + spriteId2 = CreateSprite(&gUnknown_0831C688, x, y - 16, 2); + gSprites[spriteId2].data[0] = mainSpriteId; + mainSprite->data[0]++; + StartSpriteAnim(&gSprites[spriteId2], 1); + AnimateSprite(&gSprites[spriteId2]); + + spriteId3 = CreateSprite(&gUnknown_0831C688, x - 16, y, 2); + gSprites[spriteId3].data[0] = mainSpriteId; + mainSprite->data[0]++; + StartSpriteAnim(&gSprites[spriteId3], 2); + AnimateSprite(&gSprites[spriteId3]); + + spriteId4 = CreateSprite(&gUnknown_0831C688, x, y, 2); + gSprites[spriteId4].data[0] = mainSpriteId; + mainSprite->data[0]++; + StartSpriteAnim(&gSprites[spriteId4], 3); + AnimateSprite(&gSprites[spriteId4]); + + return mainSpriteId; +} + +static void sub_8075370(struct Sprite *sprite) +{ + if (!sprite->data[0]) + { + FreeSpriteTilesByTag(gUnknown_0831C620.tag); + FreeSpritePaletteByTag(gUnknown_0831C628.tag); + if (!sprite->data[1]) + DestroySprite(sprite); + else + sprite->callback = SpriteCallbackDummy; + } +} + +void sub_80753B4(struct Sprite *sprite) +{ + if (sprite->animEnded) + { + gSprites[sprite->data[0]].data[0]--; + DestroySprite(sprite); + } +} diff --git a/src/tv.c b/src/tv.c index d3fb20f79..112f2b041 100644 --- a/src/tv.c +++ b/src/tv.c @@ -1957,11 +1957,11 @@ void sub_80EDB44(void) show->rivalTrainer.badgeCount = nBadges; if (IsNationalPokedexEnabled()) { - show->rivalTrainer.dexCount = pokedex_count(0x01); + show->rivalTrainer.dexCount = GetNationalPokedexCount(0x01); } else { - show->rivalTrainer.dexCount = sub_80C0844(0x01); + show->rivalTrainer.dexCount = GetHoennPokedexCount(0x01); } show->rivalTrainer.location = gMapHeader.regionMapSectionId; show->rivalTrainer.mapDataId = gMapHeader.mapDataId; diff --git a/sym_common.txt b/sym_common.txt index d179df671..56a4063db 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -43,7 +43,8 @@ gUnknown_03005DA8: @ 3005DA8 .space 0x4 gFieldCallback: @ 3005DAC - .space 0x4 + + .include "item_menu.o" gUnknown_03005DB0: @ 3005DB0 .space 0x4 diff --git a/sym_ewram.txt b/sym_ewram.txt index 05118682e..4dd001bba 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -931,37 +931,9 @@ gUnknown_0203CE50: @ 203CE50 .space 0x4 gUnknown_0203CE54: @ 203CE54 - .space 0x4 - -gUnknown_0203CE58: @ 203CE58 - .space 0x5 - -gUnknown_0203CE5D: @ 203CE5D - .space 0x1 - -gUnknown_0203CE5E: @ 203CE5E - .space 0x2 - -gUnknown_0203CE60: @ 203CE60 - .space 0xA - -gUnknown_0203CE6A: @ 203CE6A - .space 0x6 - -gUnknown_0203CE70: @ 203CE70 - .space 0x4 - -gUnknown_0203CE74: @ 203CE74 - .space 0x4 - -gUnknown_0203CE78: @ 203CE78 - .space 0x4 - -gSpecialVar_ItemId: @ 203CE7C - .space 0x4 - -gUnknown_0203CE80: @ 203CE80 - .space 0x4 + .align 2 + + .include "src/item_menu.o" gUnknown_0203CE84: @ 203CE84 .space 0x8