diff --git a/asm/item_menu.s b/asm/item_menu.s index fe0a8167e3..1da71d4663 100644 --- a/asm/item_menu.s +++ b/asm/item_menu.s @@ -5,191 +5,6 @@ .text - thumb_func_start Task_BagMenu -Task_BagMenu: @ 81ABD28 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r0, 2 - add r0, r9 - lsls r0, 3 - str r0, [sp] - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - ldr r5, =gUnknown_0203CE58 - ldrb r0, [r5, 0x5] - lsls r0, 1 - adds r1, r5, 0 - adds r1, 0x12 - adds r7, r0, r1 - subs r1, 0xA - adds r0, r1 - mov r8, r0 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081ABD66 - b _081ABEB2 -_081ABD66: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081ABD74 - b _081ABEB2 -_081ABD74: - bl GetSwitchBagPocketDirection - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081ABDB8 - cmp r0, 0x2 - beq _081ABDC0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - cmp r0, 0 - beq _081ABE10 - bl sub_81AC2C0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081ABDA4 - b _081ABEB2 -_081ABDA4: - b _081ABDCC - .pool -_081ABDB8: - movs r1, 0x1 - negs r1, r1 - mov r0, r9 - b _081ABDC4 -_081ABDC0: - mov r0, r9 - movs r1, 0x1 -_081ABDC4: - movs r2, 0 - bl SwitchBagPocket - b _081ABEB2 -_081ABDCC: - ldrb r0, [r6] - adds r1, r7, 0 - mov r2, r8 - bl sub_81AE860 - ldrh r2, [r7] - mov r3, r8 - ldrh r0, [r3] - adds r2, r0 - ldr r0, =gUnknown_0203CE54 - ldr r0, [r0] - ldr r1, =gUnknown_0203CE58 - ldr r3, =0x00000829 - adds r0, r3 - ldrb r1, [r1, 0x5] - adds r0, r1 - ldrb r0, [r0] - subs r0, 0x1 - cmp r2, r0 - beq _081ABEB2 - movs r0, 0x5 - bl PlaySE - mov r0, r9 - bl bag_menu_swap_items - b _081ABEB2 - .pool -_081ABE10: - ldrb r0, [r6] - bl ListMenuHandleInputGetItemId - adds r4, r0, 0 - ldrb r0, [r6] - adds r1, r7, 0 - mov r2, r8 - bl sub_81AE860 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _081ABE32 - adds r0, 0x1 - cmp r4, r0 - bne _081ABE68 - b _081ABEB2 -_081ABE32: - ldrb r0, [r5, 0x4] - cmp r0, 0x5 - bne _081ABE40 - movs r0, 0x20 - bl PlaySE - b _081ABEB2 -_081ABE40: - movs r0, 0x5 - bl PlaySE - ldr r0, =gSpecialVar_ItemId - mov r1, r10 - strh r1, [r0] - ldr r0, =gTasks + 0x8 - subs r0, 0x8 - ldr r3, [sp] - adds r0, r3, r0 - ldr r1, =unknown_ItemMenu_Confirm - str r1, [r0] - b _081ABEB2 - .pool -_081ABE68: - movs r0, 0x5 - bl PlaySE - bl sub_81AB824 - ldrb r0, [r6] - movs r1, 0x2 - bl bag_menu_print_cursor_ - strh r4, [r6, 0x2] - ldrb r0, [r5, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 16 - lsrs r4, 16 - adds r1, r4, 0 - bl BagGetQuantityByPocketPosition - strh r0, [r6, 0x4] - ldrb r0, [r5, 0x5] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl BagGetItemIdByPocketPosition - ldr r1, =gSpecialVar_ItemId - strh r0, [r1] - ldr r1, =gUnknown_08614054 - ldrb r0, [r5, 0x4] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - mov r0, r9 - bl _call_via_r1 -_081ABEB2: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end Task_BagMenu - thumb_func_start set_callback3_to_bag set_callback3_to_bag: @ 81ABECC push {r4,lr} diff --git a/src/item_menu.c b/src/item_menu.c index f623753dc6..2ee586ce5e 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -771,7 +771,7 @@ void sub_81ABCC0(int a, int b, int c) PrintMoneyAmount(a, 0x26, 1, c, 0); } -/* void Task_BagMenu(u8 taskId) +void Task_BagMenu(u8 taskId) { s16* data = gTasks[taskId].data; u16* ScrollPos = &gUnknown_0203CE58.unk12[gUnknown_0203CE58.pocket]; @@ -807,17 +807,19 @@ void sub_81ABCC0(int a, int b, int c) sub_81AE860(data[0], ScrollPos, CursorPos); switch (r4) { - default: + case -1: + break; + case -2: if (gUnknown_0203CE58.unk4 == 5) { PlaySE(SE_HAZURE); - return; + break; } - PlaySE(SE_SELECT); - gSpecialVar_ItemId = select; - gTasks[taskId].func = unknown_ItemMenu_Confirm; - return; - case -2: + PlaySE(SE_SELECT); + gSpecialVar_ItemId = select; + gTasks[taskId].func = unknown_ItemMenu_Confirm; + break; + default: PlaySE(SE_SELECT); sub_81AB824(); bag_menu_print_cursor_(data[0], 2); @@ -825,13 +827,18 @@ void sub_81ABCC0(int a, int b, int c) data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, r4); gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, r4); gUnknown_08614054[gUnknown_0203CE58.unk4](taskId); - case -1: - break; - - - } - } } -} */ +} + +void set_callback3_to_bag(u8 taskId) +{ + bag_menu_add_pocket_scroll_arrow_indicators_maybe(); + bag_menu_add_list_scroll_arrow_indicators_maybe(); + ClearWindowTilemap(3); + ClearWindowTilemap(4); + PutWindowTilemap(1); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = Task_BagMenu; +}