diff --git a/asm/field_specials.s b/asm/field_specials.s index 6200123ac..7e3185556 100644 --- a/asm/field_specials.s +++ b/asm/field_specials.s @@ -4894,7 +4894,7 @@ sub_813A46C: @ 813A46C lsrs r0, 24 mov r1, sp movs r2, 0 - bl sub_81AE860 + bl ListMenuGetScrollAndRow ldr r1, =gUnknown_0203AB68 mov r0, sp ldrh r0, [r0] @@ -4903,7 +4903,7 @@ sub_813A46C: @ 813A46C lsls r0, 24 lsrs r0, 24 mov r1, sp - bl sub_81AE838 + bl ListMenuGetCurrentItemArrayId ldrh r0, [r4, 0x1E] ldr r5, =gUnknown_0203AB6A ldrh r1, [r5] @@ -5007,7 +5007,7 @@ sub_813A570: @ 813A570 lsls r0, 24 lsrs r0, 24 mov r1, sp - bl sub_81AE838 + bl ListMenuGetCurrentItemArrayId ldrh r0, [r4, 0x1E] mov r1, sp ldrh r1, [r1] @@ -5019,7 +5019,7 @@ sub_813A570: @ 813A570 lsrs r0, 24 movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldr r0, =gUnknown_0203AB64 ldr r0, [r0] bl Free @@ -6012,7 +6012,7 @@ sub_813ADD4: @ 813ADD4 adds r4, 0x16 add r1, sp, 0x14 adds r2, r4, 0 - bl sub_81AE860 + bl ListMenuGetScrollAndRow ldrh r0, [r6, 0x22] lsls r0, 24 lsrs r0, 24 @@ -6173,7 +6173,7 @@ sub_813AF48: @ 813AF48 lsrs r0, 24 movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldr r0, =gUnknown_0203AB64 ldr r0, [r0] bl Free diff --git a/asm/learn_move.s b/asm/learn_move.s index 56f6f84c7..a33bd11b6 100644 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -903,7 +903,7 @@ sub_8160EA0: @ 8160EA0 ldrb r0, [r0] ldr r1, =gUnknown_0203BC38 adds r2, r1, 0x2 - bl sub_81AE6C8 + bl DestroyListMenuTask bl FreeAllWindowBuffers ldr r0, [r4] bl Free @@ -988,7 +988,7 @@ sub_8160F50: @ 8160F50 ldr r4, =gUnknown_0203BC38 adds r2, r4, 0x2 adds r1, r4, 0 - bl sub_81AE860 + bl ListMenuGetScrollAndRow movs r0, 0x2 negs r0, r0 cmp r5, r0 diff --git a/asm/list_menu.s b/asm/list_menu.s index 58719093c..89309262f 100644 --- a/asm/list_menu.s +++ b/asm/list_menu.s @@ -5,917 +5,8 @@ .text - thumb_func_start ListMenuDummyTask -@ void ListMenuDummyTask(u8 taskId) -ListMenuDummyTask: @ 81AE458 - bx lr - thumb_func_end ListMenuDummyTask - thumb_func_start DoMysteryGiftListMenu -@ int DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, int a3, int a4, int a5) -DoMysteryGiftListMenu: @ 81AE45C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r12, r0 - str r1, [sp] - ldr r0, [sp, 0x28] - lsls r2, 24 - lsrs r6, r2, 24 - mov r10, r6 - lsls r3, 16 - lsrs r7, r3, 16 - str r7, [sp, 0x4] - lsls r0, 16 - mov r8, r0 - lsrs r0, 16 - mov r9, r0 - ldr r5, =gUnknown_0203CE84 - ldrb r4, [r5, 0x4] - cmp r4, 0x1 - beq _081AE4F4 - cmp r4, 0x1 - ble _081AE492 - cmp r4, 0x2 - beq _081AE558 -_081AE492: - mov r0, r12 - bl AddWindow - strb r0, [r5, 0x5] - cmp r6, 0x1 - beq _081AE4B0 - cmp r6, 0x2 - bne _081AE4C0 - ldrb r0, [r5, 0x5] - mov r1, r9 - lsls r2, r1, 24 - lsrs r2, 24 - adds r1, r7, 0 - bl sub_809882C -_081AE4B0: - ldrb r0, [r5, 0x5] - mov r3, r8 - lsrs r2, r3, 20 - lsls r2, 24 - lsrs r2, 24 - ldr r1, [sp, 0x4] - bl sub_8098858 -_081AE4C0: - ldr r0, =gMultiuseListMenuTemplate - adds r2, r0, 0 - ldr r1, [sp] - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldr r4, =gUnknown_0203CE84 - ldrb r1, [r4, 0x5] - strb r1, [r0, 0x10] - movs r1, 0 - movs r2, 0 - bl ListMenuInit - strb r0, [r4, 0x6] - ldrb r0, [r4, 0x5] - movs r1, 0x1 - bl CopyWindowToVram - movs r0, 0x1 - strb r0, [r4, 0x4] - b _081AE570 - .pool -_081AE4F4: - ldrb r0, [r5, 0x6] - bl ListMenuHandleInputGetItemId - str r0, [r5] - ldr r1, =gMain - ldrh r0, [r1, 0x2E] - ands r4, r0 - cmp r4, 0 - beq _081AE50A - movs r0, 0x2 - strb r0, [r5, 0x4] -_081AE50A: - ldrh r1, [r1, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081AE51E - movs r0, 0x2 - negs r0, r0 - str r0, [r5] - movs r0, 0x2 - strb r0, [r5, 0x4] -_081AE51E: - ldrb r0, [r5, 0x4] - cmp r0, 0x2 - bne _081AE570 - cmp r6, 0 - bne _081AE534 - ldrb r0, [r5, 0x5] - bl ClearWindowTilemap - b _081AE546 - .pool -_081AE534: - mov r4, r10 - cmp r4, 0 - blt _081AE546 - cmp r4, 0x2 - bgt _081AE546 - ldrb r0, [r5, 0x5] - movs r1, 0 - bl sub_819746C -_081AE546: - ldr r0, =gUnknown_0203CE84 - ldrb r0, [r0, 0x5] - movs r1, 0x1 - bl CopyWindowToVram - b _081AE570 - .pool -_081AE558: - ldrb r0, [r5, 0x6] - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldrb r0, [r5, 0x5] - bl RemoveWindow - movs r0, 0 - strb r0, [r5, 0x4] - ldr r0, [r5] - b _081AE574 -_081AE570: - movs r0, 0x1 - negs r0, r0 -_081AE574: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end DoMysteryGiftListMenu - thumb_func_start ListMenuInit -@ u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow) -ListMenuInit: @ 81AE584 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 16 - lsrs r2, 16 - bl ListMenuInitInternal - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldrb r0, [r5, 0x10] - bl PutWindowTilemap - ldrb r0, [r5, 0x10] - movs r1, 0x2 - bl CopyWindowToVram - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end ListMenuInit - - thumb_func_start Unused_ListMenuInit2 -@ u8 Unused_ListMenuInit2(struct ListMenuTemplate *listMenuTemplate, int a2, u16 scrollOffset, u16 selectedRow) -Unused_ListMenuInit2: @ 81AE5B0 - push {r4-r7,lr} - sub sp, 0x8 - adds r6, r0, 0 - adds r4, r1, 0 - adds r1, r2, 0 - adds r2, r3, 0 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 16 - lsrs r2, 16 - bl ListMenuInitInternal - lsls r0, 24 - lsrs r7, r0, 24 - ldrb r0, [r4, 0x4] - cmp r0, 0xFF - beq _081AE5F0 - adds r5, r4, 0 -_081AE5D4: - ldrb r0, [r6, 0x10] - ldrb r1, [r5] - ldrb r2, [r5, 0x1] - ldrb r3, [r5, 0x2] - ldrb r4, [r5, 0x3] - str r4, [sp] - ldrb r4, [r5, 0x4] - str r4, [sp, 0x4] - bl PutWindowRectTilemapOverridePalette - adds r5, 0x8 - ldrb r0, [r5, 0x4] - cmp r0, 0xFF - bne _081AE5D4 -_081AE5F0: - ldrb r0, [r6, 0x10] - movs r1, 0x2 - bl CopyWindowToVram - adds r0, r7, 0 - add sp, 0x8 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end Unused_ListMenuInit2 - - thumb_func_start ListMenuHandleInputGetItemId -@ int ListMenuHandleInputGetItemId(u8 taskId) -ListMenuHandleInputGetItemId: @ 81AE604 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r3, r1, r0 - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081AE638 - ldrh r0, [r3, 0x18] - ldrh r1, [r3, 0x1A] - adds r0, r1 - ldr r1, [r3] - lsls r0, 3 - adds r0, r1 - ldr r0, [r0, 0x4] - b _081AE6C2 - .pool -_081AE638: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081AE646 - movs r0, 0x2 - negs r0, r0 - b _081AE6C2 -_081AE646: - ldrh r1, [r2, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081AE65A - adds r0, r3, 0 - movs r1, 0x1 - movs r2, 0x1 - movs r3, 0 - b _081AE6BA -_081AE65A: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081AE66A - adds r0, r3, 0 - movs r1, 0x1 - movs r2, 0x1 - b _081AE6B8 -_081AE66A: - ldrb r0, [r3, 0x16] - lsrs r0, 6 - cmp r0, 0x1 - beq _081AE680 - cmp r0, 0x1 - ble _081AE67A - cmp r0, 0x2 - beq _081AE68C -_081AE67A: - movs r2, 0 - movs r0, 0 - b _081AE6A0 -_081AE680: - movs r0, 0x20 - ands r0, r1 - lsls r0, 16 - lsrs r2, r0, 16 - movs r0, 0x10 - b _081AE69A -_081AE68C: - movs r0, 0x80 - lsls r0, 2 - ands r0, r1 - lsls r0, 16 - lsrs r2, r0, 16 - movs r0, 0x80 - lsls r0, 1 -_081AE69A: - ands r0, r1 - lsls r0, 16 - lsrs r0, 16 -_081AE6A0: - cmp r2, 0 - beq _081AE6AE - ldrb r2, [r3, 0xE] - adds r0, r3, 0 - movs r1, 0x1 - movs r3, 0 - b _081AE6BA -_081AE6AE: - cmp r0, 0 - beq _081AE6BE - ldrb r2, [r3, 0xE] - adds r0, r3, 0 - movs r1, 0x1 -_081AE6B8: - movs r3, 0x1 -_081AE6BA: - bl ListMenuChangeSelection -_081AE6BE: - movs r0, 0x1 - negs r0, r0 -_081AE6C2: - pop {r1} - bx r1 - thumb_func_end ListMenuHandleInputGetItemId - - thumb_func_start sub_81AE6C8 -sub_81AE6C8: @ 81AE6C8 - push {r4,lr} - adds r3, r1, 0 - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r1, r0, r1 - cmp r3, 0 - beq _081AE6E4 - ldrh r0, [r1, 0x18] - strh r0, [r3] -_081AE6E4: - cmp r2, 0 - beq _081AE6EC - ldrh r0, [r1, 0x1A] - strh r0, [r2] -_081AE6EC: - ldrb r0, [r1, 0x1E] - cmp r0, 0xFF - beq _081AE6FC - ldrb r1, [r1, 0x17] - lsrs r1, 6 - subs r1, 0x2 - bl ListMenuRemoveCursorObject -_081AE6FC: - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AE6C8 - - thumb_func_start sub_81AE70C -sub_81AE70C: @ 81AE70C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldrb r0, [r4, 0x10] - ldrb r2, [r4, 0x15] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - bl FillWindowPixelBuffer - ldrh r1, [r4, 0x18] - ldrh r3, [r4, 0xE] - adds r0, r4, 0 - movs r2, 0 - bl ListMenuPrintEntries - adds r0, r4, 0 - bl ListMenuDrawCursor - ldrb r0, [r4, 0x10] - movs r1, 0x2 - bl CopyWindowToVram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AE70C - - thumb_func_start sub_81AE750 -sub_81AE750: @ 81AE750 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - lsrs r1, 20 - ldrb r6, [r4, 0x14] - movs r5, 0xF - adds r0, r5, 0 - ands r0, r6 - orrs r0, r1 - strb r0, [r4, 0x14] - ands r2, r5 - ldrb r1, [r4, 0x15] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - orrs r0, r2 - lsrs r3, 20 - ands r0, r5 - orrs r0, r3 - strb r0, [r4, 0x15] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AE750 - - thumb_func_start sub_81AE794 -sub_81AE794: @ 81AE794 - push {r4,r5,lr} - adds r3, r1, 0 - adds r5, r2, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldrb r0, [r4, 0x10] - movs r1, 0x1 - adds r2, r3, 0 - bl SetWindowAttribute - ldrb r0, [r4, 0x10] - movs r1, 0x2 - adds r2, r5, 0 - bl SetWindowAttribute - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AE794 - - thumb_func_start sub_81AE7D0 -sub_81AE7D0: @ 81AE7D0 - push {r4-r7,lr} - sub sp, 0x20 - mov r12, r2 - ldr r5, [sp, 0x34] - lsls r3, 16 - lsrs r3, 16 - adds r4, r3, 0 - mov r3, sp - ldm r0!, {r2,r6,r7} - stm r3!, {r2,r6,r7} - ldm r0!, {r2,r6,r7} - stm r3!, {r2,r6,r7} - mov r0, sp - movs r3, 0 - strh r1, [r0, 0x18] - mov r1, r12 - strh r1, [r0, 0x1A] - strb r3, [r0, 0x1C] - strb r3, [r0, 0x1D] - cmp r4, 0x40 - bne _081AE804 - movs r1, 0 - movs r2, 0x1 - movs r3, 0 - bl ListMenuChangeSelection -_081AE804: - cmp r4, 0x80 - bne _081AE814 - mov r0, sp - movs r1, 0 - movs r2, 0x1 - movs r3, 0x1 - bl ListMenuChangeSelection -_081AE814: - cmp r5, 0 - beq _081AE81E - mov r0, sp - ldrh r0, [r0, 0x18] - strh r0, [r5] -_081AE81E: - ldr r2, [sp, 0x38] - cmp r2, 0 - beq _081AE82A - mov r0, sp - ldrh r0, [r0, 0x1A] - strh r0, [r2] -_081AE82A: - movs r0, 0x1 - negs r0, r0 - add sp, 0x20 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81AE7D0 - - thumb_func_start sub_81AE838 -sub_81AE838: @ 81AE838 - push {lr} - adds r2, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - cmp r2, 0 - beq _081AE856 - ldrh r0, [r1, 0x1A] - ldrh r1, [r1, 0x18] - adds r0, r1 - strh r0, [r2] -_081AE856: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AE838 - - thumb_func_start sub_81AE860 -sub_81AE860: @ 81AE860 - push {lr} - adds r3, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - cmp r3, 0 - beq _081AE87A - ldrh r0, [r1, 0x18] - strh r0, [r3] -_081AE87A: - cmp r2, 0 - beq _081AE882 - ldrh r0, [r1, 0x1A] - strh r0, [r2] -_081AE882: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AE860 - - thumb_func_start ListMenuGetYCoordForPrintingArrowCursor -@ u8 ListMenuGetYCoordForPrintingArrowCursor(u8 taskId) -ListMenuGetYCoordForPrintingArrowCursor: @ 81AE88C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldrb r0, [r4, 0x17] - lsls r0, 26 - lsrs r0, 26 - movs r1, 0x1 - bl GetFontAttribute - ldrb r1, [r4, 0x16] - lsls r1, 26 - lsrs r1, 29 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x1A] - adds r2, r1, 0 - muls r2, r0 - adds r1, r2, 0 - ldrb r0, [r4, 0x14] - lsls r0, 28 - lsrs r0, 28 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end ListMenuGetYCoordForPrintingArrowCursor - - thumb_func_start ListMenuInitInternal -@ u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow) -ListMenuInitInternal: @ 81AE8D4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - ldr r0, =ListMenuDummyTask - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r0, 2 - add r0, r8 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - adds r0, r7, 0 - ldm r4!, {r1-r3} - stm r0!, {r1-r3} - ldm r4!, {r1-r3} - stm r0!, {r1-r3} - movs r1, 0 - strh r5, [r7, 0x18] - strh r6, [r7, 0x1A] - strb r1, [r7, 0x1C] - strb r1, [r7, 0x1D] - movs r0, 0xFF - strb r0, [r7, 0x1E] - strb r1, [r7, 0x1F] - ldr r3, =gUnknown_03006300 - ldrb r1, [r7, 0x14] - movs r5, 0xF - lsrs r1, 4 - ldrb r4, [r3] - movs r2, 0x10 - negs r2, r2 - adds r0, r2, 0 - ands r0, r4 - orrs r0, r1 - strb r0, [r3] - ldrb r1, [r7, 0x15] - lsls r1, 28 - lsrs r1, 24 - ands r0, r5 - orrs r0, r1 - strb r0, [r3] - ldrb r0, [r7, 0x15] - lsrs r0, 4 - ands r5, r0 - ldrb r0, [r3, 0x1] - ands r2, r0 - orrs r2, r5 - strb r2, [r3, 0x1] - ldrb r1, [r7, 0x16] - lsls r1, 29 - lsrs r1, 17 - ldr r0, [r3] - ldr r2, =0xfffc0fff - ands r0, r2 - orrs r0, r1 - str r0, [r3] - ldrb r0, [r7, 0x17] - lsls r0, 26 - lsrs r0, 26 - strb r0, [r3, 0x3] - ldrh r0, [r7, 0xC] - ldrh r1, [r7, 0xE] - cmp r0, r1 - bcs _081AE96C - strh r0, [r7, 0xE] -_081AE96C: - ldrb r0, [r7, 0x10] - ldrb r2, [r7, 0x15] - lsls r2, 28 - lsrs r1, r2, 4 - orrs r1, r2 - lsrs r1, 24 - bl FillWindowPixelBuffer - ldrh r1, [r7, 0x18] - ldrh r3, [r7, 0xE] - adds r0, r7, 0 - movs r2, 0 - bl ListMenuPrintEntries - adds r0, r7, 0 - bl ListMenuDrawCursor - adds r0, r7, 0 - movs r1, 0x1 - bl ListMenuCallSelectionChangedCallback - mov r0, r8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end ListMenuInitInternal - - thumb_func_start ListMenuPrint -@ void ListMenuPrint(struct ListMenu *listMenu, u8 *str, u8 x, u8 y) -ListMenuPrint: @ 81AE9B4 - push {r4-r7,lr} - sub sp, 0x18 - adds r4, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r12, r3 - ldr r5, =gUnknown_03006300 - ldrb r1, [r5, 0x3] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _081AEA20 - add r1, sp, 0x14 - ldr r2, [r5] - lsls r0, r2, 24 - lsrs r0, 28 - movs r3, 0 - strb r0, [r1] - lsls r0, r2, 28 - lsrs r0, 28 - strb r0, [r1, 0x1] - lsls r0, r2, 20 - lsrs r0, 28 - strb r0, [r1, 0x2] - ldrb r0, [r4, 0x10] - lsls r1, r2, 1 - lsrs r1, 25 - lsls r2, 14 - lsrs r2, 26 - str r2, [sp] - str r3, [sp, 0x4] - add r2, sp, 0x14 - str r2, [sp, 0x8] - movs r2, 0x1 - negs r2, r2 - str r2, [sp, 0xC] - str r6, [sp, 0x10] - adds r2, r7, 0 - mov r3, r12 - bl AddTextPrinterParameterized2 - ldrb r1, [r5, 0x3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r5, 0x3] - b _081AEA5E - .pool -_081AEA20: - add r2, sp, 0x14 - ldrb r1, [r4, 0x15] - lsls r0, r1, 28 - lsrs r0, 28 - strb r0, [r2] - ldrb r0, [r4, 0x14] - lsrs r0, 4 - strb r0, [r2, 0x1] - adds r0, r2, 0 - lsls r1, 24 - lsrs r1, 28 - strb r1, [r0, 0x2] - ldrb r0, [r4, 0x10] - ldrb r1, [r4, 0x17] - lsls r1, 26 - lsrs r1, 26 - ldrb r2, [r4, 0x16] - lsls r2, 29 - lsrs r2, 29 - str r2, [sp] - str r3, [sp, 0x4] - add r2, sp, 0x14 - str r2, [sp, 0x8] - movs r2, 0x1 - negs r2, r2 - str r2, [sp, 0xC] - str r6, [sp, 0x10] - adds r2, r7, 0 - mov r3, r12 - bl AddTextPrinterParameterized2 -_081AEA5E: - add sp, 0x18 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end ListMenuPrint - - thumb_func_start ListMenuPrintEntries -@ void ListMenuPrintEntries(struct ListMenu *listMenu, u16 startIndex, u16 yOffset, u16 count) -ListMenuPrintEntries: @ 81AEA68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r4, r0, 0 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp] - lsls r3, 16 - lsrs r3, 16 - mov r10, r3 - ldrb r0, [r4, 0x17] - lsls r0, 26 - lsrs r0, 26 - movs r1, 0x1 - bl GetFontAttribute - ldrb r1, [r4, 0x16] - lsls r1, 26 - lsrs r1, 29 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - movs r0, 0 - mov r8, r0 - cmp r8, r10 - bge _081AEB10 -_081AEAAA: - ldr r0, [r4] - mov r2, r9 - lsls r1, r2, 3 - adds r0, r1, r0 - ldr r2, [r0, 0x4] - movs r0, 0x3 - negs r0, r0 - adds r5, r1, 0 - cmp r2, r0 - beq _081AEAC2 - ldrb r6, [r4, 0x12] - b _081AEAC4 -_081AEAC2: - ldrb r6, [r4, 0x11] -_081AEAC4: - ldr r0, [sp] - add r0, r8 - ldr r2, [sp, 0x4] - adds r1, r0, 0 - muls r1, r2 - ldrb r0, [r4, 0x14] - lsls r0, 28 - lsrs r0, 28 - adds r0, r1 - lsls r0, 24 - lsrs r2, r0, 24 - adds r7, r2, 0 - ldr r3, [r4, 0x8] - cmp r3, 0 - beq _081AEAEE - ldrb r0, [r4, 0x10] - ldr r1, [r4] - adds r1, r5, r1 - ldr r1, [r1, 0x4] - bl _call_via_r3 -_081AEAEE: - ldr r0, [r4] - adds r0, r5, r0 - ldr r1, [r0] - adds r0, r4, 0 - adds r2, r6, 0 - adds r3, r7, 0 - bl ListMenuPrint - mov r0, r9 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - movs r0, 0x1 - add r8, r0 - cmp r8, r10 - blt _081AEAAA -_081AEB10: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end ListMenuPrintEntries thumb_func_start ListMenuDrawCursor @ void ListMenuDrawCursor(struct ListMenu *listMenu) diff --git a/asm/player_pc.s b/asm/player_pc.s index 8a329a2fe..6fe4b3b85 100644 --- a/asm/player_pc.s +++ b/asm/player_pc.s @@ -1021,7 +1021,7 @@ sub_816B674: @ 816B674 mov r8, r1 adds r1, r7, 0 mov r2, r8 - bl sub_81AE860 + bl ListMenuGetScrollAndRow movs r0, 0x2 negs r0, r0 cmp r6, r0 @@ -1050,7 +1050,7 @@ _0816B6EA: ldrb r0, [r4, 0xA] adds r1, r7, 0 mov r2, r8 - bl sub_81AE6C8 + bl DestroyListMenuTask movs r0, 0 bl schedule_bg_copy_tilemap_to_vram mov r1, r8 @@ -1129,7 +1129,7 @@ sub_816B798: @ 816B798 ldrb r0, [r4, 0xA] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask movs r0, 0 bl schedule_bg_copy_tilemap_to_vram bl sub_81D1EC0 @@ -2476,7 +2476,7 @@ sub_816C30C: @ 816C30C ldr r1, =gUnknown_0203BCBA subs r4, r1, 0x2 adds r2, r4, 0 - bl sub_81AE860 + bl ListMenuGetScrollAndRow ldrh r1, [r4, 0x2] ldrh r0, [r4] adds r1, r0 @@ -2497,7 +2497,7 @@ _0816C35C: ldrb r0, [r4, 0xA] ldr r1, =gUnknown_0203BCBA subs r2, r1, 0x2 - bl sub_81AE860 + bl ListMenuGetScrollAndRow movs r0, 0x2 negs r0, r0 cmp r6, r0 @@ -2584,7 +2584,7 @@ sub_816C400: @ 816C400 ldrb r0, [r5, 0xA] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldr r0, =gUnknown_0203BCC4 ldr r0, [r0] movs r1, 0xCD @@ -2691,7 +2691,7 @@ sub_816C4FC: @ 816C4FC ldrb r0, [r4, 0xA] ldr r1, =gUnknown_0203BCBA subs r2, r1, 0x2 - bl sub_81AE860 + bl ListMenuGetScrollAndRow b _0816C57E .pool _0816C530: @@ -2702,7 +2702,7 @@ _0816C530: ldr r1, =gUnknown_0203BCBA subs r4, r1, 0x2 adds r2, r4, 0 - bl sub_81AE860 + bl ListMenuGetScrollAndRow ldr r0, =gUnknown_0203BCC4 ldr r0, [r0] movs r1, 0xCD @@ -2776,7 +2776,7 @@ sub_816C5A0: @ 816C5A0 ldrb r0, [r2, 0xA] adds r1, r4, 0x2 adds r2, r4, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask cmp r5, 0 bne _0816C60A ldr r1, =gUnknown_0203BCC4 @@ -3359,7 +3359,7 @@ sub_816CB04: @ 816CB04 ldrb r0, [r5, 0xA] adds r1, r4, 0x2 adds r2, r4, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask bl sub_816C110 bl sub_816C140 bl sub_816BD04 diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 14dc569fe..3b41afb55 100644 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -3469,7 +3469,7 @@ sub_81C5B4C: @ 81C5B4C ldr r4, =gUnknown_0203CF38 subs r2, r4, 0x2 adds r1, r4, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldr r0, =gUnknown_0203CF2C ldr r0, [r0] ldr r0, [r0] @@ -3545,7 +3545,7 @@ _081C5C12: adds r1, r4, 0 adds r1, 0x8 adds r2, r4, 0x6 - bl sub_81AE860 + bl ListMenuGetScrollAndRow ldrh r1, [r4, 0x8] ldrh r0, [r4, 0x6] adds r1, r0 @@ -3572,7 +3572,7 @@ _081C5C5C: mov r8, r1 mov r2, r8 subs r2, 0x2 - bl sub_81AE860 + bl ListMenuGetScrollAndRow movs r0, 0x2 negs r0, r0 cmp r6, r0 @@ -4642,7 +4642,7 @@ sub_81C65CC: @ 81C65CC ldrb r0, [r4] adds r1, r6, 0 adds r2, r7, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask bl sub_81C5924 bl sub_81C59BC bl sub_81C5314 @@ -4953,7 +4953,7 @@ sub_81C68B0: @ 81C68B0 ldrb r0, [r4] ldr r1, =gUnknown_0203CF38 subs r2, r1, 0x2 - bl sub_81AE860 + bl ListMenuGetScrollAndRow b _081C6940 .pool _081C68F8: @@ -4964,7 +4964,7 @@ _081C68F8: ldr r4, =gUnknown_0203CF38 subs r2, r4, 0x2 adds r1, r4, 0 - bl sub_81AE860 + bl ListMenuGetScrollAndRow movs r0, 0 bl sub_81C7028 subs r4, 0x8 @@ -5054,7 +5054,7 @@ _081C69A8: ldrb r0, [r5] adds r1, r7, 0 mov r2, r8 - bl sub_81AE6C8 + bl DestroyListMenuTask movs r3, 0x2 ldrsh r0, [r5, r3] cmp r0, r4 @@ -5109,7 +5109,7 @@ sub_81C6A14: @ 81C6A14 ldrb r0, [r4] adds r1, r5, 0 adds r2, r7, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask movs r0, 0x2 ldrsh r2, [r4, r0] ldrh r0, [r5] diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index b069ec58e..4d50a5271 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -1192,7 +1192,7 @@ sub_8012F64: @ 8012F64 ldrb r0, [r4, 0x12] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldrb r0, [r4, 0x10] bl ClearWindowTilemap ldrb r0, [r4, 0xF] @@ -2394,7 +2394,7 @@ _08013A8C: ldrb r0, [r6, 0xE] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldrb r0, [r6, 0xC] bl ClearWindowTilemap ldrb r0, [r6, 0xB] @@ -4511,7 +4511,7 @@ _08014E16: ldrb r0, [r5, 0x12] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask movs r0, 0 bl CopyBgTilemapBufferToVram ldrb r0, [r5, 0xF] @@ -4567,7 +4567,7 @@ _08014EA8: ldrb r0, [r5, 0x12] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask movs r0, 0 bl CopyBgTilemapBufferToVram ldrb r0, [r5, 0xF] @@ -4923,7 +4923,7 @@ _08015204: ldrb r0, [r7, 0xE] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask movs r0, 0 bl CopyBgTilemapBufferToVram ldrb r0, [r7, 0xD] @@ -5292,7 +5292,7 @@ _08015564: ldrb r0, [r5, 0xE] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask movs r0, 0 bl CopyBgTilemapBufferToVram ldrb r0, [r5, 0xB] @@ -8545,7 +8545,7 @@ _08017228: ldrb r0, [r4] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldrb r0, [r5] movs r1, 0x1 bl sub_819746C @@ -8565,7 +8565,7 @@ _08017264: ldrb r0, [r6] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldrb r0, [r5] movs r1, 0x1 bl sub_819746C @@ -8669,7 +8669,7 @@ _0801733E: ldrb r0, [r4] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldrb r0, [r6] bl RemoveWindow mov r7, r9 @@ -8691,7 +8691,7 @@ _08017368: ldrb r0, [r1] movs r1, 0 movs r2, 0 - bl sub_81AE6C8 + bl DestroyListMenuTask ldrb r0, [r6] bl RemoveWindow mov r3, r9 diff --git a/asm/shop.s b/asm/shop.s index c42af8ef1..ae60eb364 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -1985,7 +1985,7 @@ _080E0AEA: adds r1, r2, r3 subs r3, 0x2 adds r2, r3 - bl sub_81AE860 + bl ListMenuGetScrollAndRow movs r0, 0x2 negs r0, r0 cmp r5, r0 diff --git a/include/list_menu.h b/include/list_menu.h index 77d00bf97..d25549845 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -4,6 +4,10 @@ #define LIST_NOTHING_CHOSEN -1 #define LIST_B_PRESSED -2 +#define LIST_NO_MULTIPLE_SCROLL 0 +#define LIST_MULTIPLE_SCROLL_DPAD 1 +#define LIST_MULTIPLE_SCROLL_L_R 2 + // Exported type declarations // Exported RAM declarations @@ -20,27 +24,27 @@ struct ListMenuTemplate { const struct ListMenuItem *items; void (* moveCursorFunc)(u32, bool8, struct ListMenu *); - void (* unk_08)(u8, s32, u8); + void (* unk_08)(u8 windowId, s32 itemId, u8 y); u16 totalItems; u16 maxShowed; - u8 unk_10; + u8 windowId; u8 unk_11; u8 unk_12; u8 cursor_Y; - u32 upText_Y:4; // x1, x2, x4, x8 = xF - u32 cursorColor:4; // x10, x20, x40, x80 = xF0 - u32 fillColor:4; // x100, x200, x400, x800 = xF00 - u32 cursorShadowColor:4; // x1000, x2000, x4000, x8000 = xF000 - u32 unk_16_0:1; // x10000 - u32 spaceBetweenItems:6; // x20000, x40000, x80000, x100000, x200000, x400000 = x7E0000 - u32 unk_16_7:1; // x800000 - u32 unk_17_0:6; // x1000000, x2000000, x4000000, x8000000, x10000000, x20000000 = x3F000000 - u32 cursorKind:2; // x40000000, x80000000 + u8 upText_Y:4; // x1, x2, x4, x8 = xF + u8 cursorPal:4; // x10, x20, x40, x80 = xF0 + u8 fillPal:4; // x1, x2, x4, x8 = xF + u8 cursorShadowPal:4; // x10, x20, x40, x80 = xF0 + u8 lettersSpacing:3; + u8 unk_16_3:3; + u8 scrollMultiple:2; // x40, x80 = xC0 + u8 fontId:6; // x1, x2, x4, x8, x10, x20 = x3F + u8 cursorKind:2; // x40, x80 }; struct ListMenu { - struct ListMenuTemplate _template; + struct ListMenuTemplate template; u16 scrollOffset; u16 selectedRow; u8 unk_1C; @@ -53,10 +57,10 @@ extern struct ListMenuTemplate gMultiuseListMenuTemplate; // Exported ROM declarations -u8 ListMenuInit(struct ListMenuTemplate *template, u16 cursorPage, u16 cursorPosition); +u8 ListMenuInit(struct ListMenuTemplate *template, u16 scrollOffset, u16 selectedRow); s32 ListMenuHandleInputGetItemId(u8 listTaskId); -void sub_81AE860(u8 listTaskId, u16 *a1, u16 *a2); -void sub_81AE6C8(u8 listTaskId, u16 *a1, u16 *a2); -u8 ListMenuGetYCoordForPrintingArrowCursor(u8); +void ListMenuGetScrollAndRow(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow); +void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow); +u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId); #endif //GUARD_LIST_MENU_H diff --git a/include/menu_indicators.h b/include/menu_indicators.h index b82e48725..b4cea11c7 100644 --- a/include/menu_indicators.h +++ b/include/menu_indicators.h @@ -18,5 +18,6 @@ u8 AddScrollIndicatorArrowPairParametrized(u8, u8, u8, u8, s32, u16, u16, u16 *) void RemoveScrollIndicatorArrowPair(u8); u8 AddScrollIndicatorArrowPair(const struct ArrowStruct*, void*); void sub_81AF15C(u8, u8, u8); +void ListMenuRemoveCursorObject(u8 taskId, u32 cursorKind); #endif //GUARD_MENU_INDICATORS_H diff --git a/ld_script.txt b/ld_script.txt index 7dcf21569..88306e790 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -247,6 +247,7 @@ SECTIONS { src/menu.o(.text); asm/battle_frontier_2.o(.text); src/item_menu.o(.text); + src/list_menu.o(.text); asm/list_menu.o(.text); asm/menu_indicators.o(.text); src/unk_text_util.o(.text); diff --git a/src/daycare.c b/src/daycare.c index 36e8b208d..f4bd84af3 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -41,7 +41,7 @@ extern const u8 gDaycareText_PlayOther[]; extern u8 GetCursorSelectionMonId(void); extern u16 ItemIdToBattleMoveId(u16); extern s32 ListMenuHandleInputGetItemId(u8); -extern void sub_81AE6C8(u8, u16*, u16*); +extern void DestroyListMenuTask(u8, u16*, u16*); extern void sub_819746C(u8, bool8); extern void NewMenuHelpers_DrawStdWindowFrame(u8, bool8); extern void sub_81B9328(void); @@ -89,7 +89,7 @@ static const struct ListMenuTemplate sDaycareListMenuLevelTemplate = .cursorShadowColor = 3, .unk_16_0 = TRUE, .spaceBetweenItems = 0, - .unk_16_7 = FALSE, + .scrollMultiple = LIST_NO_MULTIPLE_SCROLL, .unk_17_0 = 1, .cursorKind = 0 }; @@ -1271,7 +1271,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId) gSpecialVar_Result = 2; break; } - sub_81AE6C8(gTasks[taskId].tMenuListTaskId, NULL, NULL); + DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL); sub_819746C(gTasks[taskId].tWindowId, TRUE); RemoveWindow(gTasks[taskId].tWindowId); DestroyTask(taskId); @@ -1280,7 +1280,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId) else if (gMain.newKeys & B_BUTTON) { gSpecialVar_Result = 2; - sub_81AE6C8(gTasks[taskId].tMenuListTaskId, NULL, NULL); + DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL); sub_819746C(gTasks[taskId].tWindowId, TRUE); RemoveWindow(gTasks[taskId].tWindowId); DestroyTask(taskId); diff --git a/src/decoration.c b/src/decoration.c index e4d867a34..899851c6a 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -801,7 +801,7 @@ void sub_8127330(u8 taskId) sDecorPCBuffer->items[i].name = sDecorPCBuffer->names[i]; sDecorPCBuffer->items[i].id = -2; gMultiuseListMenuTemplate = gUnknown_085A6BD0; - gMultiuseListMenuTemplate.unk_10 = sDecorMenuWindowIndices[1]; + gMultiuseListMenuTemplate.windowId = sDecorMenuWindowIndices[1]; gMultiuseListMenuTemplate.totalItems = sDecorPCBuffer->unk_520; gMultiuseListMenuTemplate.items = sDecorPCBuffer->items; gMultiuseListMenuTemplate.maxShowed = sDecorPCBuffer->unk_521; @@ -892,7 +892,7 @@ void sub_812764C(u8 taskId) if (!gPaletteFade.active) { input = ListMenuHandleInputGetItemId(data[13]); - sub_81AE860(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); + ListMenuGetScrollAndRow(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); switch (input) { case -1: @@ -905,7 +905,7 @@ void sub_812764C(u8 taskId) PlaySE(SE_SELECT); gCurDecorationIndex = input; sub_8127554(); - sub_81AE6C8(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); + DestroyListMenuTask(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); sub_8126A58(1); sub_81277A8(); free(sDecorPCBuffer); @@ -1074,7 +1074,7 @@ void sub_8127A8C(u8 taskId) data = gTasks[taskId].data; sub_8127554(); sub_81277A8(); - sub_81AE6C8(data[13], NULL, NULL); + DestroyListMenuTask(data[13], NULL, NULL); free(sDecorPCBuffer); sub_8126E44(taskId); } diff --git a/src/item_menu.c b/src/item_menu.c index 9090a39c5..a51894ea1 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -830,7 +830,7 @@ void task_close_bag_menu_2(u8 taskId) s16* data = gTasks[taskId].data; if (!gPaletteFade.active) { - sub_81AE6C8(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); if (gUnknown_0203CE54->unk0 != 0) SetMainCallback2(gUnknown_0203CE54->unk0); else @@ -915,7 +915,7 @@ void bag_menu_inits_lists_menu(u8 taskId) 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); + DestroyListMenuTask(data[0], scrollPos, cursorPos); sub_81AB9A8(gUnknown_0203CE58.pocket); sub_81ABA88(gUnknown_0203CE58.pocket); load_bag_item_list_buffers(gUnknown_0203CE58.pocket); @@ -967,7 +967,7 @@ void Task_BagMenu(u8 taskId) { if (sub_81AC2C0() == 1) { - sub_81AE860(data[0], scrollPos, cursorPos); + ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos); if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - 1) { PlaySE(SE_SELECT); @@ -979,7 +979,7 @@ void Task_BagMenu(u8 taskId) else { int r4 = ListMenuHandleInputGetItemId(data[0]); - sub_81AE860(data[0], scrollPos, cursorPos); + ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos); switch (r4) { case -1: @@ -1063,7 +1063,7 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3) { ClearWindowTilemap(0); ClearWindowTilemap(1); - sub_81AE6C8(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + DestroyListMenuTask(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(); @@ -1125,7 +1125,7 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3) adds r1, r2, r1\n\ adds r3, 0x8\n\ adds r2, r3\n\ - bl sub_81AE6C8\n\ + bl DestroyListMenuTask\n\ movs r0, 0\n\ bl schedule_bg_copy_tilemap_to_vram\n\ ldr r3, =gSprites\n\ @@ -1340,13 +1340,13 @@ void sub_81AC3C0(u8 taskId) if (gMain.newKeys & SELECT_BUTTON) { PlaySE(SE_SELECT); - sub_81AE860(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]); + ListMenuGetScrollAndRow(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]); + ListMenuGetScrollAndRow(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) @@ -1381,7 +1381,7 @@ void sub_81AC498(u8 taskId) { sub_80D702C(gBagPockets[gUnknown_0203CE58.pocket].itemSlots, data[1], realPos); gUnknown_0203CE54->unk81A = -1; - sub_81AE6C8(data[0], scrollPos, cursorPos); + DestroyListMenuTask(data[0], scrollPos, cursorPos); if (data[1] < realPos) gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]--; load_bag_item_list_buffers(gUnknown_0203CE58.pocket); @@ -1399,7 +1399,7 @@ void sub_81AC590(u8 taskId) u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]; gUnknown_0203CE54->unk81A = -1; - sub_81AE6C8(data[0], scrollPos, cursorPos); + DestroyListMenuTask(data[0], scrollPos, cursorPos); if (data[1] < (*scrollPos + *cursorPos)) gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]--; load_bag_item_list_buffers(gUnknown_0203CE58.pocket); @@ -1771,7 +1771,7 @@ void Task_ActuallyToss(u8 taskId) { PlaySE(SE_SELECT); RemoveBagItem(gSpecialVar_ItemId, data[8]); - sub_81AE6C8(data[0], scrollPos, cursorPos); + DestroyListMenuTask(data[0], scrollPos, cursorPos); sub_81AB9A8(gUnknown_0203CE58.pocket); sub_81ABA88(gUnknown_0203CE58.pocket); load_bag_item_list_buffers(gUnknown_0203CE58.pocket); @@ -1791,7 +1791,7 @@ void ItemMenu_Register(u8 taskId) gSaveBlock1Ptr->registeredItem = 0; else gSaveBlock1Ptr->registeredItem = gSpecialVar_ItemId; - sub_81AE6C8(data[0], scrollPos, cursorPos); + DestroyListMenuTask(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); @@ -2039,7 +2039,7 @@ void sub_81AD8C8(u8 taskId) 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); + DestroyListMenuTask(data[0], scrollPos, cursorPos); sub_81AB9A8(gUnknown_0203CE58.pocket); sub_81ABA88(gUnknown_0203CE58.pocket); load_bag_item_list_buffers(gUnknown_0203CE58.pocket); @@ -2212,7 +2212,7 @@ void Task_WallyTutorialBagMenu(u8 taskId) case 0x132: PlaySE(SE_SELECT); bag_menu_remove_some_window(); - sub_81AE6C8(data[0], 0, 0); + DestroyListMenuTask(data[0], 0, 0); RestoreBagAfterWallyTutorial(); unknown_ItemMenu_Confirm(taskId); break; diff --git a/src/list_menu.c b/src/list_menu.c new file mode 100644 index 000000000..6df5d5d3a --- /dev/null +++ b/src/list_menu.c @@ -0,0 +1,378 @@ +#include "global.h" +#include "menu.h" +#include "list_menu.h" +#include "window.h" +#include "text_window.h" +#include "main.h" +#include "task.h" +#include "menu_indicators.h" + +struct ListMenuStruct +{ + s32 field_0; + u8 field_4; + u8 field_5; + u8 field_6; +}; + +struct UnknownListMenuStruct +{ + u8 x; + u8 y; + u8 width; + u8 height; + u8 palNum; +}; + +extern struct ListMenuStruct gUnknown_0203CE84; + +// this file's functions +u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); +bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAndCallCallback, u8 count, bool8 movingDown); +void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count); +void ListMenuDrawCursor(struct ListMenu *list); +void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 a2); + +// code +void ListMenuDummyTask(u8 taskId) +{ + +} + +s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum) +{ + switch (gUnknown_0203CE84.field_4) + { + case 0: + default: + gUnknown_0203CE84.field_5 = AddWindow(windowTemplate); + switch (arg2) + { + case 2: + sub_809882C(gUnknown_0203CE84.field_5, tileNum, palNum); + case 1: + sub_8098858(gUnknown_0203CE84.field_5, tileNum, palNum / 16); + break; + } + gMultiuseListMenuTemplate = *listMenuTemplate; + gMultiuseListMenuTemplate.windowId = gUnknown_0203CE84.field_5; + gUnknown_0203CE84.field_6 = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); + CopyWindowToVram(gUnknown_0203CE84.field_5, 1); + gUnknown_0203CE84.field_4 = 1; + break; + case 1: + gUnknown_0203CE84.field_0 = ListMenuHandleInputGetItemId(gUnknown_0203CE84.field_6); + if (gMain.newKeys & A_BUTTON) + gUnknown_0203CE84.field_4 = 2; + if (gMain.newKeys & B_BUTTON) + { + gUnknown_0203CE84.field_0 = LIST_B_PRESSED; + gUnknown_0203CE84.field_4 = 2; + } + if (gUnknown_0203CE84.field_4 == 2) + { + if (arg2 == 0) + ClearWindowTilemap(gUnknown_0203CE84.field_5); + else + { + switch (arg2) + { + case 0: // can never be reached, because of the if statement above + sub_819746C(gUnknown_0203CE84.field_5, FALSE); + break; + case 2: + case 1: + sub_819746C(gUnknown_0203CE84.field_5, FALSE); + break; + } + } + + CopyWindowToVram(gUnknown_0203CE84.field_5, 1); + } + break; + case 2: + DestroyListMenuTask(gUnknown_0203CE84.field_6, NULL, NULL); + RemoveWindow(gUnknown_0203CE84.field_5); + gUnknown_0203CE84.field_4 = 0; + return gUnknown_0203CE84.field_0; + } + + return -1; +} + +u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow) +{ + u8 taskId = ListMenuInitInternal(listMenuTemplate, scrollOffset, selectedRow); + PutWindowTilemap(listMenuTemplate->windowId); + CopyWindowToVram(listMenuTemplate->windowId, 2); + + return taskId; +} + +// unused +u8 ListMenuInitWithWindows(struct ListMenuTemplate *listMenuTemplate, struct UnknownListMenuStruct *arg1, u16 scrollOffset, u16 selectedRow) +{ + s32 i; + + u8 taskId = ListMenuInitInternal(listMenuTemplate, scrollOffset, selectedRow); + for (i = 0; arg1[i].palNum != 0xFF; i++) + { + PutWindowRectTilemapOverridePalette(listMenuTemplate->windowId, + arg1[i].x, + arg1[i].y, + arg1[i].width, + arg1[i].height, + arg1[i].palNum); + } + CopyWindowToVram(listMenuTemplate->windowId, 2); + + return taskId; +} + +s32 ListMenuHandleInputGetItemId(u8 listTaskId) +{ + struct ListMenu *list = (void*) gTasks[listTaskId].data; + + if (gMain.newKeys & A_BUTTON) + { + return list->template.items[list->scrollOffset + list->selectedRow].id; + } + else if (gMain.newKeys & B_BUTTON) + { + return LIST_B_PRESSED; + } + else if (gMain.newAndRepeatedKeys & DPAD_UP) + { + ListMenuChangeSelection(list, TRUE, 1, FALSE); + return LIST_NOTHING_CHOSEN; + } + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + ListMenuChangeSelection(list, TRUE, 1, TRUE); + return LIST_NOTHING_CHOSEN; + } + else // try to move by one window scroll + { + bool16 rightButton, leftButton; + switch (list->template.scrollMultiple) + { + case LIST_NO_MULTIPLE_SCROLL: + default: + leftButton = FALSE; + rightButton = FALSE; + break; + case LIST_MULTIPLE_SCROLL_DPAD: + leftButton = gMain.newAndRepeatedKeys & DPAD_LEFT; + rightButton = gMain.newAndRepeatedKeys & DPAD_RIGHT; + break; + case LIST_MULTIPLE_SCROLL_L_R: + leftButton = gMain.newAndRepeatedKeys & L_BUTTON; + rightButton = gMain.newAndRepeatedKeys & R_BUTTON; + break; + } + + if (leftButton) + { + ListMenuChangeSelection(list, TRUE, list->template.maxShowed, FALSE); + return LIST_NOTHING_CHOSEN; + } + else if (rightButton) + { + ListMenuChangeSelection(list, TRUE, list->template.maxShowed, TRUE); + return LIST_NOTHING_CHOSEN; + } + else + { + return LIST_NOTHING_CHOSEN; + } + } +} + +void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow) +{ + struct ListMenu *list = (void*) gTasks[listTaskId].data; + + if (scrollOffset != NULL) + *scrollOffset = list->scrollOffset; + if (selectedRow != NULL) + *selectedRow = list->selectedRow; + + if (list->unk_1E != 0xFF) + ListMenuRemoveCursorObject(list->unk_1E, list->template.cursorKind - 2); + + DestroyTask(listTaskId); +} + +void sub_81AE70C(u8 listTaskId) +{ + struct ListMenu *list = (void*) gTasks[listTaskId].data; + + FillWindowPixelBuffer(list->template.windowId, (list->template.fillPal << 4) | (list->template.fillPal)); + ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed); + ListMenuDrawCursor(list); + CopyWindowToVram(list->template.windowId, 2); +} + +// unused +void ChangeListMenuPals(u8 listTaskId, u8 cursorPal, u8 fillPal, u8 cursorShadowPal) +{ + struct ListMenu *list = (void*) gTasks[listTaskId].data; + + list->template.cursorPal = cursorPal; + list->template.fillPal = fillPal; + list->template.cursorShadowPal = cursorShadowPal; +} + +// unused +void ChangeListMenuCoords(u8 listTaskId, u8 x, u8 y) +{ + struct ListMenu *list = (void*) gTasks[listTaskId].data; + + SetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT, x); + SetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP, y); +} + +// unused +s32 ListMenuTestInput(struct ListMenuTemplate *template, u32 scrollOffset, u32 selectedRow, u16 keys, u16 *newScrollOffset, u16 *newSelectedRow) +{ + struct ListMenu list; + + list.template = *template; + list.scrollOffset = scrollOffset; + list.selectedRow = selectedRow; + list.unk_1C = 0; + list.unk_1D = 0; + + if (keys == DPAD_UP) + ListMenuChangeSelection(&list, FALSE, 1, FALSE); + if (keys == DPAD_DOWN) + ListMenuChangeSelection(&list, FALSE, 1, TRUE); + + if (newScrollOffset != NULL) + *newScrollOffset = list.scrollOffset; + if (newSelectedRow != NULL) + *newSelectedRow = list.selectedRow; + + return LIST_NOTHING_CHOSEN; +} + +void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId) +{ + struct ListMenu *list = (void*) gTasks[listTaskId].data; + + if (arrayId != NULL) + *arrayId = list->scrollOffset + list->selectedRow; +} + +void ListMenuGetScrollAndRow(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow) +{ + struct ListMenu *list = (void*) gTasks[listTaskId].data; + + if (scrollOffset != NULL) + *scrollOffset = list->scrollOffset; + if (selectedRow != NULL) + *selectedRow = list->selectedRow; +} + +u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId) +{ + struct ListMenu *list = (void*) gTasks[listTaskId].data; + u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3; + + return list->selectedRow * yMultiplier + list->template.upText_Y; +} + +struct ListMenuPals +{ + u8 field_0_0:4; + u8 field_0_4:4; + u8 field_1_0:4; + u8 lettersSpacing:6; + u8 field_2_2:6; + u8 fontId:7; + u8 field_3_7:1; +}; + +extern struct ListMenuPals gUnknown_03006300; + +u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow) +{ + u8 listTaskId = CreateTask(ListMenuDummyTask, 0); + struct ListMenu *list = (void*) gTasks[listTaskId].data; + + list->template = *listMenuTemplate; + list->scrollOffset = scrollOffset; + list->selectedRow = selectedRow; + list->unk_1C = 0; + list->unk_1D = 0; + list->unk_1E = 0xFF; + list->unk_1F = 0; + + gUnknown_03006300.field_0_0 = list->template.cursorPal; + gUnknown_03006300.field_0_4 = list->template.fillPal; + gUnknown_03006300.field_1_0 = list->template.cursorShadowPal; + gUnknown_03006300.lettersSpacing = list->template.lettersSpacing; + gUnknown_03006300.fontId = list->template.fontId; + gUnknown_03006300.field_3_7 = 0; + + if (list->template.totalItems < list->template.maxShowed) + list->template.maxShowed = list->template.totalItems; + + FillWindowPixelBuffer(list->template.windowId, (list->template.fillPal << 4) | (list->template.fillPal)); + ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed); + ListMenuDrawCursor(list); + ListMenuCallSelectionChangedCallback(list, 1); + + return listTaskId; +} + +void ListMenuPrint(struct ListMenu *list, const u8 *str, u8 x, u8 y) +{ + u8 colors[3]; + if (gUnknown_03006300.field_3_7) + { + colors[0] = gUnknown_03006300.field_0_4; + colors[1] = gUnknown_03006300.field_0_0; + colors[2] = gUnknown_03006300.field_1_0; + AddTextPrinterParameterized2(list->template.windowId, + gUnknown_03006300.fontId, + x, y, + gUnknown_03006300.lettersSpacing, + 0, colors, TEXT_SPEED_FF, str); + + gUnknown_03006300.field_3_7 = 0; + } + else + { + colors[0] = list->template.fillPal; + colors[1] = list->template.cursorPal; + colors[2] = list->template.cursorShadowPal; + AddTextPrinterParameterized2(list->template.windowId, + list->template.fontId, + x, y, + list->template.lettersSpacing, + 0, colors, TEXT_SPEED_FF, str); + } +} + +void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count) +{ + s32 i; + u8 x, y; + u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3; + + for (i = 0; i < count; i++) + { + if (list->template.items[startIndex].id != -3) + x = list->template.unk_12; + else + x = list->template.unk_11; + + y = (yOffset + i) * yMultiplier + list->template.upText_Y; + if (list->template.unk_08 != NULL) + list->template.unk_08(list->template.windowId, list->template.items[startIndex].id, y); + + ListMenuPrint(list, list->template.items[startIndex].name, x, y); + startIndex++; + } +} diff --git a/src/pokeblock.c b/src/pokeblock.c index b9a1f6bf3..4c467017f 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -319,17 +319,17 @@ static const struct ListMenuTemplate sPokeblockListMenuTemplate = .unk_08 = NULL, .totalItems = 0, .maxShowed = 0, - .unk_10 = 1, + .windowId = 1, .unk_11 = 0, .unk_12 = 1, .cursor_Y = 0, .upText_Y = 1, - .cursorColor = 2, - .fillColor = 0, - .cursorShadowColor = 3, + .cursorPal = 2, + .fillPal = 0, + .cursorShadowPal = 3, .unk_16_0 = FALSE, .spaceBetweenItems = 32, - .unk_16_7 = FALSE, + .scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD, .unk_17_0 = 1, .cursorKind = 1 }; @@ -869,7 +869,7 @@ static void Task_FreeDataAndExitPokeblockCase(u8 taskId) if (sPokeblockMenu->caseId == PBLOCK_CASE_FEEDER || sPokeblockMenu->caseId == PBLOCK_CASE_GIVE) gFieldCallback = sub_80AF168; - sub_81AE6C8(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + DestroyListMenuTask(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); sub_8136418(); ResetSpriteData(); FreeAllSpritePalettes(); @@ -893,7 +893,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId) { if (gMain.newKeys & SELECT_BUTTON) { - sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); if (sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos != sPokeblockMenu->itemsNo - 1) { PlaySE(SE_SELECT); @@ -908,7 +908,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId) u16 oldPosition = sSavedPokeblockData.lastItemPos; s32 itemId = ListMenuHandleInputGetItemId(data[0]); - sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); if (oldPosition != sSavedPokeblockData.lastItemPos) { HandlePokeblockMenuCursor(oldPosition, 5); @@ -945,7 +945,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId) if (gMain.newKeys & SELECT_BUTTON) { PlaySE(SE_SELECT); - sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); HandlePokeblocksSwap(taskId, FALSE); } else @@ -954,7 +954,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId) u16 var = sSavedPokeblockData.lastItemPos; s32 itemId = ListMenuHandleInputGetItemId(data[0]); - sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); if (i != sSavedPokeblockData.lastItemPage || var != sSavedPokeblockData.lastItemPos) { for (i = 0; i < 9; i++) @@ -996,7 +996,7 @@ static void HandlePokeblocksSwap(u8 taskId, bool8 noSwap) u16 swappedFromId = sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos; sPokeblockMenu->isSwapping = FALSE; - sub_81AE6C8(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + DestroyListMenuTask(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); if (!noSwap && data[2] != swappedFromId && data[2] != swappedFromId - 1) { @@ -1112,7 +1112,7 @@ static void HandleErasePokeblock(u8 taskId) lastPos = &sSavedPokeblockData.lastItemPos; data = gTasks[taskId].data; - sub_81AE6C8(data[0], lastPage, lastPos); + DestroyListMenuTask(data[0], lastPage, lastPos); HandlePokeblockMenuCursor(*lastPos, 5); SetMenuItemsCountAndMaxShowed(); sub_81362E0(); diff --git a/src/secret_base.c b/src/secret_base.c index df754f2a0..29bbc4245 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -913,7 +913,7 @@ void game_continue(u8 taskId) data[3] = 8; } gMultiuseListMenuTemplate = gUnknown_0858D07C; - gMultiuseListMenuTemplate.unk_10 = data[6]; + gMultiuseListMenuTemplate.windowId = data[6]; gMultiuseListMenuTemplate.totalItems = data[0]; gMultiuseListMenuTemplate.items = gUnknown_0203A020->items; gMultiuseListMenuTemplate.maxShowed = data[3]; @@ -953,14 +953,14 @@ void sub_80E9E90(u8 taskId) data = gTasks[taskId].data; input = ListMenuHandleInputGetItemId(data[5]); - sub_81AE860(data[5], &data[2], &data[1]); + ListMenuGetScrollAndRow(data[5], &data[2], &data[1]); switch (input) { case -1: break; case -2: PlaySE(SE_SELECT); - sub_81AE6C8(data[5], NULL, NULL); + DestroyListMenuTask(data[5], NULL, NULL); RemoveScrollIndicatorArrowPair(data[8]); sub_819746C(data[6], 0); ClearWindowTilemap(data[6]); @@ -1042,7 +1042,7 @@ void sub_80EA08C(u8 taskId) data = gTasks[taskId].data; sub_8197434(0, 0); - sub_81AE6C8(data[5], &data[2], &data[1]); + DestroyListMenuTask(data[5], &data[2], &data[1]); gSaveBlock1Ptr->secretBases[data[4]].sbr_field_1_6 = 0; game_continue(taskId); sub_812225C(&data[2], &data[1], data[3], data[0]); @@ -1061,7 +1061,7 @@ void sub_80EA13C(u8 taskId) data = gTasks[taskId].data; sub_8197434(0, 0); - sub_81AE6C8(data[5], &data[2], &data[1]); + DestroyListMenuTask(data[5], &data[2], &data[1]); sub_80E9E00(taskId); gTasks[taskId].func = sub_80E9E90; }