diff --git a/asm/item_menu.s b/asm/item_menu.s deleted file mode 100644 index 5ae0f99735..0000000000 --- a/asm/item_menu.s +++ /dev/null @@ -1,3823 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - 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, =sub_8177C14 - 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, =c2_exit_to_overworld_2_switch - 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, =c2_exit_to_overworld_2_switch - 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, =c2_exit_to_overworld_2_switch - 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/ld_script.txt b/ld_script.txt index 8e7d996d9a..48608473e7 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -251,7 +251,6 @@ SECTIONS { asm/menu.o(.text); asm/battle_frontier_2.o(.text); src/item_menu.o(.text); - asm/item_menu.o(.text); asm/list_menu.o(.text); asm/menu_indicators.o(.text); src/unk_text_util.o(.text); diff --git a/src/item_menu.c b/src/item_menu.c index 00ba284bd9..55d3f088c6 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -1,47 +1,59 @@ #include "global.h" +#include "battle_frontier_2.h" #include "bg.h" #include "constants/items.h" #include "constants/songs.h" #include "decompress.h" #include "event_data.h" +#include "field_player_avatar.h" #include "gpu_regs.h" #include "international_string_util.h" #include "item.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 "new_menu_helpers.h" +#include "overworld.h" #include "palette.h" +#include "pokemon.h" #include "rom_818CFC8.h" #include "scanline_effect.h" +#include "script.h" #include "sound.h" #include "sprite.h" #include "string.h" #include "string_util.h" #include "task.h" +#include "text_window.h" #include "menu_helpers.h" #include "window.h" struct bagStruct { - void *func; - u8 unk4; + void (*bagCallback)(void); + u8 location; u8 pocket; u8 unk6[2]; - u16 unk8[5]; - u16 unk12[5]; - void *unk1C; + u16 cursorPosition[5]; + u16 scrollPosition[5]; + u8 **pocketStringsPtr; }; struct unkBagStruct { - void* unk0; + MainCallback unk0; u8 unk4[0x800]; u8 unk804; - u8 filler4; + u8 unk805; u8 unk806[10]; - u8 unk810[10]; + u8 unk810[7]; + u8 unk817; + u8 unk818; + u8 unk819; u8 unk81A; u8 unk81B:4; u8 unk81B_1:2; @@ -50,11 +62,17 @@ struct unkBagStruct { u8 filler3[2]; u8 unk81E; u8 unk81F; - u8 filler5[9]; + u8* unk820; + u8 unk824; + u8 unk825; + u8 filler[2]; + u8 unk828; u8 unk829[5]; u8 unk82E[6]; s16 unk834; - u8 filler2[0x412]; + u8 filler4[0xE]; + u8 unk844[32][32]; + u8 filler2[4]; }; struct listBuffer1 { @@ -65,10 +83,25 @@ struct listBuffer2 { s8 name[65][24]; }; +struct unkWallyStruct { + struct ItemSlot bagPocket_Items[30]; + struct ItemSlot bagPocket_PokeBalls[16]; + u16 cursorPosition[5]; + u16 scrollPosition[5]; + u8 filler[0x2]; + u16 pocket; +}; + +struct unkStructTextFunc{ + u8* text; + TaskFunc func; +}; + extern struct bagStruct gUnknown_0203CE58; extern struct unkBagStruct *gUnknown_0203CE54; extern struct listBuffer1 *gUnknown_0203CE74; extern struct listBuffer2 *gUnknown_0203CE78; +extern struct unkWallyStruct *gUnknown_0203CE80; extern u16 gUnknown_0203CE6A[]; extern u16 gUnknown_0203CE60[]; extern void sub_8086194(void); @@ -95,6 +128,29 @@ extern void sub_80D6FB4(struct BagPocket*); extern void sub_80D6F64(struct BagPocket*); extern u8 GetLRKeysState(void); extern void sub_81AC23C(u8); +extern void sub_81AF15C(u8, u8, u8); +extern void sub_80D4FEC(u8); +extern void sub_80D4FC8(u8); +extern void sub_80D702C(struct ItemSlot*, s16, u16); +extern bool8 sub_8122148(u16); +extern void AddItemMenuActionTextPrinters (u8, u8, u8, u8, u8, u8, u8, struct unkStructTextFunc*, u8*); +extern void sub_8198DBC(u8, u8, u8, u8, u8, u8, u8, struct unkStructTextFunc*, u8*); +extern void sub_8199944(u8, u8, u8, u8, u8); +extern void sub_8199134(s8, s8); +extern void sub_80FDD10(u8); +extern bool8 AdjustQuantityAccordingToDPadInput(s16*, u16); +extern void sub_81B7F60(void); +extern bool8 itemid_80BF6D8_mail_related(u16); +extern void sub_8177C14(void); +extern void sub_808B864(void); +extern void sub_808BCF4(void); +extern void FreezeMapObjects(void); +extern bool8 InMultiBattleRoom(void); +extern void (*gFieldCallback)(void); +extern void sub_819FA50(void); +extern void sub_818DEF4(void); +extern void sub_818E564(void); +extern void sub_819A2BC(u8, u8); void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); void CB2_Bag(void); @@ -105,7 +161,7 @@ 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(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); @@ -139,6 +195,36 @@ 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, 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); extern u8 *gPocketNamesStringsTable[]; extern struct BgTemplate gUnknown_08613F90[]; @@ -164,12 +250,51 @@ extern u32 gUnknown_08614094[]; extern u32 gUnknown_0203CE5E[]; extern u16 gSpecialVar_ItemId; extern TaskFunc gUnknown_08614054[]; +extern u8 gText_MoveVar1Where[]; +extern u8 gUnknown_0861402C[]; +extern u8 gUnknown_08614030[]; +extern u8 gUnknown_08614034[]; +extern u8 gUnknown_08614038[]; +extern u8 gUnknown_0861403C[]; +extern u8 gUnknown_08614042[]; +extern u8 gUnknown_08614044[]; +extern u8 gUnknown_08614046[]; +extern u8 gUnknown_08614047[]; +extern u8 gUnknown_0861404B[]; +extern u8 gUnknown_0861404D[]; +extern u8 gUnknown_0861404F[]; +extern u8 gText_Var1IsSelected[]; +extern struct unkStructTextFunc gUnknown_08613FB4[]; +extern u8 gText_TossHowManyVar1s[]; +extern u8 gText_ConfirmTossItems[]; +extern struct YesNoFuncTable gUnknown_08614084; +extern u8 gText_ThrewAwayVar2Var1s[]; +extern u8 gText_CantWriteMail[]; +extern u8 gText_NoPokemon[]; +extern u8 gText_Var1CantBeHeld[]; +extern u8 gText_Var1CantBeHeldHere[]; +extern u8 EventScript_2736B3[]; +extern u8 gText_CantBuyKeyItem[]; +extern u8 gText_HowManyToSell[]; +extern u8 gText_ICanPayVar1[]; +extern struct YesNoFuncTable gUnknown_0861408C; +extern u8 gText_TurnedOverVar1ForVar2[]; +extern u8 gText_DepositHowManyVar1[]; +extern u8 gText_CantStoreImportantItems[]; +extern u8 gText_DepositedVar2Var1s[]; +extern u8 gText_NoRoomForItems[]; +extern struct WindowTemplate gUnknown_08614174[]; +extern u16 gUnknown_0860F074[]; +extern struct TextColor gUnknown_08614164[]; +extern struct WindowTemplate gUnknown_086141AC[]; +extern struct BattleMove gBattleMoves[]; +extern u8 gText_ThreeDashes[]; void ResetBagScrollPositions(void) { gUnknown_0203CE58.pocket = 0; - memset(gUnknown_0203CE58.unk8, 0, 10); - memset(gUnknown_0203CE58.unk12, 0, 10); + memset(gUnknown_0203CE58.cursorPosition, 0, 10); + memset(gUnknown_0203CE58.scrollPosition, 0, 10); } void CB2_BagMenuFromStartMenu(void) @@ -233,12 +358,12 @@ void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2) else { if (bagMenuType != 12) - gUnknown_0203CE58.unk4 = bagMenuType; + gUnknown_0203CE58.location = bagMenuType; if (postExitMenuMainCallback2) - gUnknown_0203CE58.func = postExitMenuMainCallback2; + gUnknown_0203CE58.bagCallback = postExitMenuMainCallback2; if (pocketId <= 4) gUnknown_0203CE58.pocket = pocketId; - temp = gUnknown_0203CE58.unk4 - 4; + temp = gUnknown_0203CE58.location - 4; if (temp <= 1) gUnknown_0203CE54->unk81B = 1; gUnknown_0203CE54->unk0 = 0; @@ -344,8 +469,8 @@ bool8 setup_bag_menu(void) gMain.state++; break; case 14: - taskId = sub_81AB1F0(gUnknown_0203CE58.unk4); - gTasks[taskId].data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203CE58.unk12[gUnknown_0203CE58.pocket], gUnknown_0203CE58.unk8[gUnknown_0203CE58.pocket]); + 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++; @@ -590,7 +715,7 @@ void bag_menu_print_description_box_text(int a) str = (u8*)ItemId_GetDescription(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a)); else { - StringCopy(gStringVar1, gReturnToXStringsTable[gUnknown_0203CE58.unk4]); + StringCopy(gStringVar1, gReturnToXStringsTable[gUnknown_0203CE58.location]); str = gStringVar4; StringExpandPlaceholders(str, gText_ReturnToVar1); } @@ -615,7 +740,7 @@ void bag_menu_print_cursor(u8 a, u8 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.unk12[gUnknown_0203CE58.pocket]); + 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) @@ -662,11 +787,11 @@ void task_close_bag_menu_2(u8 taskId) s16* data = gTasks[taskId].data; if (!gPaletteFade.active) { - sub_81AE6C8(data[0], &gUnknown_0203CE58.unk12[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.unk8[gUnknown_0203CE58.pocket]); + 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.func); + SetMainCallback2(gUnknown_0203CE58.bagCallback); sub_81AB824(); ResetSpriteData(); FreeAllSpritePalettes(); @@ -709,7 +834,7 @@ void sub_81ABA6C(void) void sub_81ABA88(u8 a) { - sub_812225C(&gUnknown_0203CE58.unk12[a], &gUnknown_0203CE58.unk8[a], gUnknown_0203CE54->unk82E[a], gUnknown_0203CE54->unk829[a]); + sub_812225C(&gUnknown_0203CE58.scrollPosition[a], &gUnknown_0203CE58.cursorPosition[a], gUnknown_0203CE54->unk82E[a], gUnknown_0203CE54->unk829[a]); } void sub_81ABAC4(void) @@ -723,12 +848,12 @@ void sub_81ABAE0(void) { u8 i; for (i = 0;i < 5;i++) - sub_8122298(&gUnknown_0203CE58.unk12[i], &gUnknown_0203CE58.unk8[i], gUnknown_0203CE54->unk82E[i], gUnknown_0203CE54->unk829[i], 8); + 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.unk12[a] + gUnknown_0203CE58.unk8[a]; + return gUnknown_0203CE58.scrollPosition[a] + gUnknown_0203CE58.cursorPosition[a]; } void DisplayItemMessage(u8 taskId, u8 fontId, u8 *str, void ( *callback)(u8 taskId)) @@ -744,14 +869,14 @@ void DisplayItemMessage(u8 taskId, u8 fontId, u8 *str, void ( *callback)(u8 task void bag_menu_inits_lists_menu(u8 taskId) { s16* data = gTasks[taskId].data; - u16* ScrollPos = &gUnknown_0203CE58.unk12[gUnknown_0203CE58.pocket]; - u16* CursorPos = &gUnknown_0203CE58.unk8[gUnknown_0203CE58.pocket]; + 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_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); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos); schedule_bg_copy_tilemap_to_vram(0); set_callback3_to_bag(taskId); } @@ -781,8 +906,8 @@ void sub_81ABCC0(int a, int b, int c) void Task_BagMenu(u8 taskId) { s16* data = gTasks[taskId].data; - u16* ScrollPos = &gUnknown_0203CE58.unk12[gUnknown_0203CE58.pocket]; - u16* CursorPos = &gUnknown_0203CE58.unk8[gUnknown_0203CE58.pocket]; + u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]; + u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; u16 select; if (sub_81221EC() != TRUE && !gPaletteFade.active) { @@ -799,8 +924,8 @@ void Task_BagMenu(u8 taskId) { if (sub_81AC2C0() == 1) { - sub_81AE860(data[0], ScrollPos, CursorPos); - if ((*ScrollPos + *CursorPos) != gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - 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); @@ -811,13 +936,13 @@ void Task_BagMenu(u8 taskId) else { int r4 = ListMenuHandleInputGetItemId(data[0]); - sub_81AE860(data[0], ScrollPos, CursorPos); + sub_81AE860(data[0], scrollPos, cursorPos); switch (r4) { case -1: break; case -2: - if (gUnknown_0203CE58.unk4 == 5) + if (gUnknown_0203CE58.location == 5) { PlaySE(SE_HAZURE); break; @@ -833,7 +958,7 @@ void Task_BagMenu(u8 taskId) data[1] = r4; data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, r4); gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, r4); - gUnknown_08614054[gUnknown_0203CE58.unk4](taskId); + gUnknown_08614054[gUnknown_0203CE58.location](taskId); } } } @@ -896,7 +1021,7 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3) { ClearWindowTilemap(0); ClearWindowTilemap(1); - sub_81AE6C8(data[0], &gUnknown_0203CE58.unk12[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.unk8[gUnknown_0203CE58.pocket]); + 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(); @@ -1100,9 +1225,9 @@ void sub_81AC10C(u8 taskId) if (!(++data[12] & 1)) { if (data[11] == 1) - bag_menu_copy_pocket_name_to_window(data[12] >> 1); + bag_menu_copy_pocket_name_to_window((u8)(data[12] >> 1)); else - bag_menu_copy_pocket_name_to_window(8 - (data[12] >> 1)); + bag_menu_copy_pocket_name_to_window((u8)(8 - (data[12] >> 1))); } if (data[12] == 16) data[13]++; @@ -1110,7 +1235,7 @@ void sub_81AC10C(u8 taskId) case 1: ChangeBagPocketId(&gUnknown_0203CE58.pocket, data[11]); load_bag_item_list_buffers(gUnknown_0203CE58.pocket); - data[0] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203CE58.unk12[gUnknown_0203CE58.pocket], gUnknown_0203CE58.unk8[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); @@ -1119,3 +1244,1151 @@ void sub_81AC10C(u8 taskId) 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(taskId); + break; + default: + PlaySE(SE_SELECT); + gUnknown_08613FB4[gUnknown_0203CE54->unk820[r4]].func(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(taskId); + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + gUnknown_08613FB4[4].func(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 = sub_8177C14; + 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; + else + { + 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 unkWallyStruct)); + 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(c2_exit_to_overworld_2_switch); +} + +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(c2_exit_to_overworld_2_switch); +} + +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(c2_exit_to_overworld_2_switch); +} + +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); +} + +// probably a fakematching + +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, 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, 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; + 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); + } +}