diff --git a/asm/menu_indicators.s b/asm/menu_indicators.s deleted file mode 100644 index b923b53d08..0000000000 --- a/asm/menu_indicators.s +++ /dev/null @@ -1,1442 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_81AF08C -sub_81AF08C: @ 81AF08C - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r3, r1, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r2, r1, r0 - cmp r3, 0x10 - bhi _081AF154 - lsls r0, r3, 2 - ldr r1, =_081AF0B8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081AF0B8: - .4byte _081AF0FC - .4byte _081AF0FC - .4byte _081AF100 - .4byte _081AF104 - .4byte _081AF108 - .4byte _081AF10C - .4byte _081AF110 - .4byte _081AF114 - .4byte _081AF118 - .4byte _081AF11C - .4byte _081AF122 - .4byte _081AF12A - .4byte _081AF130 - .4byte _081AF138 - .4byte _081AF140 - .4byte _081AF146 - .4byte _081AF14E -_081AF0FC: - ldr r0, [r2, 0x4] - b _081AF158 -_081AF100: - ldrh r0, [r2, 0xC] - b _081AF158 -_081AF104: - ldrh r0, [r2, 0xE] - b _081AF158 -_081AF108: - ldrb r0, [r2, 0x10] - b _081AF158 -_081AF10C: - ldrb r0, [r2, 0x11] - b _081AF158 -_081AF110: - ldrb r0, [r2, 0x12] - b _081AF158 -_081AF114: - ldrb r0, [r2, 0x13] - b _081AF158 -_081AF118: - ldrb r0, [r2, 0x14] - b _081AF124 -_081AF11C: - ldrb r0, [r2, 0x14] - lsrs r0, 4 - b _081AF158 -_081AF122: - ldrb r0, [r2, 0x15] -_081AF124: - lsls r0, 28 - lsrs r0, 28 - b _081AF158 -_081AF12A: - ldrb r0, [r2, 0x15] - lsrs r0, 4 - b _081AF158 -_081AF130: - ldrb r0, [r2, 0x16] - lsls r0, 29 - lsrs r0, 29 - b _081AF158 -_081AF138: - ldrb r0, [r2, 0x16] - lsls r0, 26 - lsrs r0, 29 - b _081AF158 -_081AF140: - ldrb r0, [r2, 0x16] - lsrs r0, 6 - b _081AF158 -_081AF146: - ldrb r0, [r2, 0x17] - lsls r0, 26 - lsrs r0, 26 - b _081AF158 -_081AF14E: - ldrb r0, [r2, 0x17] - lsrs r0, 6 - b _081AF158 -_081AF154: - movs r0, 0x1 - negs r0, r0 -_081AF158: - pop {r1} - bx r1 - thumb_func_end sub_81AF08C - - thumb_func_start sub_81AF15C -sub_81AF15C: @ 81AF15C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r3, r1, r0 - cmp r4, 0x10 - bhi _081AF25C - lsls r0, r4, 2 - ldr r1, =_081AF188 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081AF188: - .4byte _081AF1CC - .4byte _081AF1CC - .4byte _081AF1D0 - .4byte _081AF1D4 - .4byte _081AF1D8 - .4byte _081AF1DC - .4byte _081AF1E0 - .4byte _081AF1E4 - .4byte _081AF1E8 - .4byte _081AF1F4 - .4byte _081AF202 - .4byte _081AF20E - .4byte _081AF21C - .4byte _081AF228 - .4byte _081AF236 - .4byte _081AF244 - .4byte _081AF250 -_081AF1CC: - str r2, [r3, 0x4] - b _081AF25C -_081AF1D0: - strh r2, [r3, 0xC] - b _081AF25C -_081AF1D4: - strh r2, [r3, 0xE] - b _081AF25C -_081AF1D8: - strb r2, [r3, 0x10] - b _081AF25C -_081AF1DC: - strb r2, [r3, 0x11] - b _081AF25C -_081AF1E0: - strb r2, [r3, 0x12] - b _081AF25C -_081AF1E4: - strb r2, [r3, 0x13] - b _081AF25C -_081AF1E8: - movs r0, 0xF - ands r2, r0 - ldrb r1, [r3, 0x14] - movs r0, 0x10 - negs r0, r0 - b _081AF1FA -_081AF1F4: - lsls r2, 4 - ldrb r1, [r3, 0x14] - movs r0, 0xF -_081AF1FA: - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x14] - b _081AF25C -_081AF202: - movs r0, 0xF - ands r2, r0 - ldrb r1, [r3, 0x15] - movs r0, 0x10 - negs r0, r0 - b _081AF214 -_081AF20E: - lsls r2, 4 - ldrb r1, [r3, 0x15] - movs r0, 0xF -_081AF214: - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x15] - b _081AF25C -_081AF21C: - movs r0, 0x7 - ands r2, r0 - ldrb r1, [r3, 0x16] - movs r0, 0x8 - negs r0, r0 - b _081AF23C -_081AF228: - movs r0, 0x7 - ands r2, r0 - lsls r2, 3 - ldrb r1, [r3, 0x16] - movs r0, 0x39 - negs r0, r0 - b _081AF23C -_081AF236: - lsls r2, 6 - ldrb r1, [r3, 0x16] - movs r0, 0x3F -_081AF23C: - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x16] - b _081AF25C -_081AF244: - movs r0, 0x3F - ands r2, r0 - ldrb r1, [r3, 0x17] - movs r0, 0x40 - negs r0, r0 - b _081AF256 -_081AF250: - lsls r2, 6 - ldrb r1, [r3, 0x17] - movs r0, 0x3F -_081AF256: - ands r0, r1 - orrs r0, r2 - strb r0, [r3, 0x17] -_081AF25C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81AF15C - - thumb_func_start sub_81AF264 -sub_81AF264: @ 81AF264 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _081AF276 - cmp r0, 0x1 - beq _081AF28A - b _081AF2E4 -_081AF276: - ldrh r1, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _081AF2E4 -_081AF28A: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _081AF29A - cmp r0, 0x1 - beq _081AF2C0 - ldrh r2, [r4, 0x38] - b _081AF2DE -_081AF29A: - movs r0, 0x34 - ldrsh r3, [r4, r0] - ldr r1, =gSineTable - ldrh r2, [r4, 0x38] - lsls r0, r2, 24 - lsrs r0, 23 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - muls r0, r3 - cmp r0, 0 - bge _081AF2B4 - adds r0, 0xFF -_081AF2B4: - asrs r0, 8 - strh r0, [r4, 0x24] - b _081AF2DE - .pool -_081AF2C0: - movs r0, 0x34 - ldrsh r3, [r4, r0] - ldr r1, =gSineTable - ldrh r2, [r4, 0x38] - lsls r0, r2, 24 - lsrs r0, 23 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - muls r0, r3 - cmp r0, 0 - bge _081AF2DA - adds r0, 0xFF -_081AF2DA: - asrs r0, 8 - strh r0, [r4, 0x26] -_081AF2DE: - ldrh r0, [r4, 0x36] - adds r0, r2, r0 - strh r0, [r4, 0x38] -_081AF2E4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81AF264 - - thumb_func_start AddScrollIndicatorArrowObject -AddScrollIndicatorArrowObject: @ 81AF2F0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - adds r6, r0, 0 - ldr r5, [sp, 0x30] - lsls r6, 24 - lsrs r6, 24 - mov r8, r6 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r5, 16 - lsrs r5, 16 - mov r12, r5 - mov r4, sp - ldr r0, =gUnknown_08614244 - ldm r0!, {r5-r7} - stm r4!, {r5-r7} - ldm r0!, {r5-r7} - stm r4!, {r5-r7} - mov r0, sp - movs r4, 0 - strh r3, [r0] - mov r3, r12 - strh r3, [r0, 0x2] - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r3, r1 - adds r5, r3, 0 - adds r5, 0x3E - ldrb r1, [r5] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r5] - strh r4, [r3, 0x2E] - ldr r1, =gUnknown_086141FC - mov r5, r8 - lsls r6, r5, 2 - adds r6, r1 - ldrb r2, [r6] - lsls r1, r2, 28 - lsrs r1, 28 - strh r1, [r3, 0x30] - lsrs r2, 4 - strh r2, [r3, 0x32] - ldrb r1, [r6, 0x1] - strh r1, [r3, 0x34] - ldrh r1, [r6, 0x2] - strh r1, [r3, 0x36] - strh r4, [r3, 0x38] - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end AddScrollIndicatorArrowObject - - thumb_func_start AddScrollIndicatorArrowPair -AddScrollIndicatorArrowPair: @ 81AF380 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x14 - adds r6, r0, 0 - mov r9, r1 - ldr r0, =gUnknown_086142C8 - str r0, [sp, 0x4] - ldr r5, =0xffff0000 - ldr r0, [sp, 0x8] - ands r0, r5 - movs r1, 0x80 - lsls r1, 1 - orrs r0, r1 - ldrh r1, [r6, 0xA] - lsls r1, 16 - ldr r4, =0x0000ffff - ands r0, r4 - orrs r0, r1 - str r0, [sp, 0x8] - add r0, sp, 0x4 - bl LoadCompressedObjectPic - ldrh r2, [r6, 0xC] - cmp r2, r4 - bne _081AF3DC - ldr r0, =gUnknown_086142A8 - ldrb r1, [r6, 0xE] - lsls r1, 20 - movs r2, 0x80 - lsls r2, 17 - adds r1, r2 - lsrs r1, 16 - movs r2, 0x20 - bl LoadPalette - b _081AF3EE - .pool -_081AF3DC: - ldr r0, =gUnknown_086142A8 - str r0, [sp, 0xC] - add r0, sp, 0xC - ldr r1, [r0, 0x4] - ands r1, r5 - orrs r1, r2 - str r1, [r0, 0x4] - bl LoadSpritePalette -_081AF3EE: - ldr r0, =Task_ScrollIndicatorArrowPair - 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 - movs r0, 0 - strb r0, [r7] - mov r0, r9 - str r0, [r7, 0x4] - ldrh r0, [r6, 0x6] - strh r0, [r7, 0x8] - ldrh r0, [r6, 0x8] - strh r0, [r7, 0xA] - ldrh r0, [r6, 0xA] - strh r0, [r7, 0xE] - ldrh r0, [r6, 0xC] - strh r0, [r7, 0x10] - ldrb r0, [r6] - ldrb r1, [r6, 0x1] - ldrb r2, [r6, 0x2] - ldrh r3, [r6, 0xA] - ldrh r4, [r6, 0xC] - str r4, [sp] - bl AddScrollIndicatorArrowObject - strb r0, [r7, 0xC] - ldrb r0, [r6, 0x3] - ldrb r1, [r6, 0x4] - ldrb r2, [r6, 0x5] - ldrh r3, [r6, 0xA] - ldrh r4, [r6, 0xC] - str r4, [sp] - bl AddScrollIndicatorArrowObject - strb r0, [r7, 0xD] - ldrh r1, [r6, 0xC] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _081AF47C - ldr r5, =gSprites - ldrb r0, [r7, 0xC] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r3, [r6, 0xE] - lsls r3, 4 - ldrb r4, [r1, 0x5] - movs r2, 0xF - adds r0, r2, 0 - ands r0, r4 - orrs r0, r3 - strb r0, [r1, 0x5] - ldrb r1, [r7, 0xD] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r1, [r6, 0xE] - lsls r1, 4 - ldrb r3, [r0, 0x5] - ands r2, r3 - orrs r2, r1 - strb r2, [r0, 0x5] -_081AF47C: - mov r0, r8 - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end AddScrollIndicatorArrowPair - - thumb_func_start AddScrollIndicatorArrowPairParametrized -AddScrollIndicatorArrowPairParametrized: @ 81AF4A0 - push {r4,lr} - adds r4, r1, 0 - subs r0, 0x2 - cmp r0, 0x1 - bhi _081AF4C4 - ldr r0, =gUnknown_0203CE8C - movs r1, 0x2 - strb r1, [r0] - strb r4, [r0, 0x1] - strb r2, [r0, 0x2] - movs r1, 0x3 - strb r1, [r0, 0x3] - strb r4, [r0, 0x4] - strb r3, [r0, 0x5] - b _081AF4D6 - .pool -_081AF4C4: - ldr r0, =gUnknown_0203CE8C - movs r1, 0 - strb r1, [r0] - strb r2, [r0, 0x1] - strb r4, [r0, 0x2] - movs r1, 0x1 - strb r1, [r0, 0x3] - strb r3, [r0, 0x4] - strb r4, [r0, 0x5] -_081AF4D6: - adds r2, r0, 0 - movs r1, 0 - movs r0, 0 - strh r0, [r2, 0x6] - ldr r0, [sp, 0x8] - strh r0, [r2, 0x8] - ldr r0, [sp, 0xC] - strh r0, [r2, 0xA] - ldr r0, [sp, 0x10] - strh r0, [r2, 0xC] - strb r1, [r2, 0xE] - adds r0, r2, 0 - ldr r1, [sp, 0x14] - bl AddScrollIndicatorArrowPair - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end AddScrollIndicatorArrowPairParametrized - - thumb_func_start Task_ScrollIndicatorArrowPair -Task_ScrollIndicatorArrowPair: @ 81AF504 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - ldr r0, [r4, 0x4] - ldrh r5, [r0] - ldrh r0, [r4, 0x8] - cmp r5, r0 - bne _081AF548 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _081AF548 - ldr r3, =gSprites - ldrb r1, [r4, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - b _081AF55E - .pool -_081AF548: - ldr r3, =gSprites - ldrb r1, [r4, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 -_081AF55E: - strb r1, [r0] - ldrh r0, [r4, 0xA] - cmp r5, r0 - bne _081AF580 - ldrb r1, [r4, 0xD] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - b _081AF594 - .pool -_081AF580: - ldrb r1, [r4, 0xD] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 -_081AF594: - strb r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end Task_ScrollIndicatorArrowPair - - thumb_func_start Task_ScrollIndicatorArrowPairOnMainMenu -Task_ScrollIndicatorArrowPairOnMainMenu: @ 81AF59C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - movs r1, 0x1E - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _081AF5E8 - ldr r3, =gSprites - ldrb r1, [r4, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrb r1, [r4, 0xD] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - b _081AF612 - .pool -_081AF5E8: - ldr r3, =gSprites - ldrb r1, [r4, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r4, 0xD] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 -_081AF612: - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end Task_ScrollIndicatorArrowPairOnMainMenu - - thumb_func_start RemoveScrollIndicatorArrowPair -RemoveScrollIndicatorArrowPair: @ 81AF620 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldrh r0, [r5, 0xE] - ldr r4, =0x0000ffff - cmp r0, r4 - beq _081AF63E - bl FreeSpriteTilesByTag -_081AF63E: - ldrh r0, [r5, 0x10] - cmp r0, r4 - beq _081AF648 - bl FreeSpritePaletteByTag -_081AF648: - ldrb r1, [r5, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - ldrb r1, [r5, 0xD] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - adds r0, r6, 0 - bl DestroyTask - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end RemoveScrollIndicatorArrowPair - - thumb_func_start ListMenuAddCursorObjectInternal -ListMenuAddCursorObjectInternal: @ 81AF680 - push {lr} - cmp r1, 0 - beq _081AF68A - cmp r1, 0x1 - beq _081AF690 -_081AF68A: - bl ListMenuAddRedOutlineCursorObject - b _081AF694 -_081AF690: - bl ListMenuAddRedArrowCursorObject -_081AF694: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end ListMenuAddCursorObjectInternal - - thumb_func_start ListMenuUpdateCursorObject -@ void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 a4) -ListMenuUpdateCursorObject: @ 81AF69C - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 16 - lsrs r2, 16 - cmp r3, 0 - beq _081AF6B4 - cmp r3, 0x1 - beq _081AF6BA - b _081AF6BE -_081AF6B4: - bl ListMenuUpdateRedOutlineCursorObject - b _081AF6BE -_081AF6BA: - bl ListMenuUpdateRedArrowCursorObject -_081AF6BE: - pop {r0} - bx r0 - thumb_func_end ListMenuUpdateCursorObject - - thumb_func_start ListMenuRemoveCursorObject -ListMenuRemoveCursorObject: @ 81AF6C4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r1, 0 - beq _081AF6D4 - cmp r1, 0x1 - beq _081AF6DA - b _081AF6DE -_081AF6D4: - bl ListMenuRemoveRedOutlineCursorObject - b _081AF6DE -_081AF6DA: - bl ListMenuRemoveRedArrowCursorObject -_081AF6DE: - pop {r0} - bx r0 - thumb_func_end ListMenuRemoveCursorObject - - thumb_func_start Task_RedOutlineCursor -Task_RedOutlineCursor: @ 81AF6E4 - bx lr - thumb_func_end Task_RedOutlineCursor - - thumb_func_start ListMenuGetRedOutlineCursorSpriteCount -ListMenuGetRedOutlineCursorSpriteCount: @ 81AF6E8 - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - movs r3, 0x4 - cmp r0, 0x10 - bls _081AF708 - movs r2, 0x8 - subs r0, 0x8 - cmp r2, r0 - bge _081AF708 -_081AF700: - adds r3, 0x2 - adds r2, 0x8 - cmp r2, r0 - blt _081AF700 -_081AF708: - cmp r1, 0x10 - bls _081AF71C - movs r2, 0x8 - subs r1, 0x8 - cmp r2, r1 - bge _081AF71C -_081AF714: - adds r3, 0x2 - adds r2, 0x8 - cmp r2, r1 - blt _081AF714 -_081AF71C: - lsls r0, r3, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end ListMenuGetRedOutlineCursorSpriteCount - - thumb_func_start ListMenuSetUpRedOutlineCursorSpriteOamTable -ListMenuSetUpRedOutlineCursorSpriteOamTable: @ 81AF724 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r3, r2, 0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - ldr r0, =gUnknown_0861425C - ldr r0, [r0] - str r0, [r3] - movs r1, 0x88 - strb r1, [r3] - strb r1, [r3, 0x1] - ldr r0, =gUnknown_08614260 - ldr r0, [r0] - str r0, [r3, 0x4] - mov r2, r8 - adds r2, 0x80 - strb r2, [r3, 0x4] - strb r1, [r3, 0x5] - ldr r0, =gUnknown_08614274 - ldr r0, [r0] - str r0, [r3, 0x8] - strb r1, [r3, 0x8] - mov r4, r9 - adds r4, 0x80 - strb r4, [r3, 0x9] - ldr r0, =gUnknown_08614278 - ldr r0, [r0] - str r0, [r3, 0xC] - strb r2, [r3, 0xC] - strb r4, [r3, 0xD] - movs r0, 0x4 - mov r12, r0 - mov r2, r8 - cmp r2, 0x10 - bls _081AF7B8 - movs r2, 0x8 - mov r5, r8 - subs r5, 0x8 - cmp r2, r5 - bge _081AF7B8 - ldr r0, =gUnknown_08614264 - ldr r0, [r0] - str r0, [sp] - ldr r0, =gUnknown_08614270 - ldr r6, [r0] - adds r1, r3, 0 - adds r1, 0x10 - movs r7, 0x88 - mov r10, r7 -_081AF796: - ldr r0, [sp] - str r0, [r1] - adds r0, r2, 0 - subs r0, 0x78 - strb r0, [r1] - mov r7, r10 - strb r7, [r1, 0x1] - adds r1, 0x4 - str r6, [r1] - strb r0, [r1] - strb r4, [r1, 0x1] - adds r1, 0x4 - movs r0, 0x2 - add r12, r0 - adds r2, 0x8 - cmp r2, r5 - blt _081AF796 -_081AF7B8: - mov r2, r9 - cmp r2, 0x10 - bls _081AF7F6 - movs r1, 0x8 - mov r4, r9 - subs r4, 0x8 - cmp r1, r4 - bge _081AF7F6 - ldr r0, =gUnknown_08614268 - ldr r6, [r0] - ldr r0, =gUnknown_0861426C - ldr r5, [r0] - mov r7, r12 - lsls r0, r7, 2 - adds r2, r0, r3 - movs r7, 0x88 - mov r3, r8 - adds r3, 0x80 -_081AF7DC: - str r6, [r2] - strb r7, [r2] - adds r0, r1, 0 - subs r0, 0x78 - strb r0, [r2, 0x1] - adds r2, 0x4 - str r5, [r2] - strb r3, [r2] - strb r0, [r2, 0x1] - adds r2, 0x4 - adds r1, 0x8 - cmp r1, r4 - blt _081AF7DC -_081AF7F6: - 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 ListMenuSetUpRedOutlineCursorSpriteOamTable - - thumb_func_start ListMenuAddRedOutlineCursorObject -ListMenuAddRedOutlineCursorObject: @ 81AF828 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x28 - adds r6, r0, 0 - ldr r0, =gUnknown_08614338 - str r0, [sp, 0x18] - ldr r5, =0xffff0000 - add r0, sp, 0x18 - ldr r1, [r0, 0x4] - ands r1, r5 - movs r2, 0x80 - lsls r2, 1 - orrs r1, r2 - ldrh r2, [r6, 0x6] - lsls r2, 16 - ldr r3, =0x0000ffff - ands r1, r3 - orrs r1, r2 - str r1, [r0, 0x4] - bl LoadCompressedObjectPic - ldrh r2, [r6, 0x8] - ldr r7, =0x0000ffff - cmp r2, r7 - bne _081AF884 - ldr r0, =gUnknown_086142A8 - ldrb r1, [r6, 0xA] - lsls r1, 20 - movs r2, 0x80 - lsls r2, 17 - adds r1, r2 - lsrs r1, 16 - movs r2, 0x20 - bl LoadPalette - b _081AF896 - .pool -_081AF884: - ldr r0, =gUnknown_086142A8 - str r0, [sp, 0x20] - add r0, sp, 0x20 - ldr r1, [r0, 0x4] - ands r1, r5 - orrs r1, r2 - str r1, [r0, 0x4] - bl LoadSpritePalette -_081AF896: - ldr r0, =Task_RedOutlineCursor - movs r1, 0 - bl CreateTask - 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 r5, r0, r1 - ldrh r0, [r6, 0x6] - movs r3, 0 - mov r8, r3 - strh r0, [r5, 0xE] - ldrh r0, [r6, 0x8] - strh r0, [r5, 0x10] - ldrh r0, [r6, 0x2] - ldrh r1, [r6, 0x4] - bl ListMenuGetRedOutlineCursorSpriteCount - strb r0, [r5] - ldrb r0, [r5] - lsls r0, 2 - bl Alloc - adds r2, r0, 0 - str r2, [r5, 0x8] - str r2, [r5, 0x4] - ldrh r0, [r6, 0x2] - ldrh r1, [r6, 0x4] - bl ListMenuSetUpRedOutlineCursorSpriteOamTable - mov r1, sp - ldr r0, =gDummySpriteTemplate - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - mov r1, sp - ldrh r0, [r6, 0x6] - strh r0, [r1] - ldrh r0, [r6, 0x8] - strh r0, [r1, 0x2] - ldrb r1, [r6] - adds r1, 0x78 - ldrb r2, [r6, 0x1] - adds r2, 0x78 - mov r0, sp - movs r3, 0 - bl CreateSprite - strb r0, [r5, 0xC] - ldrb r1, [r5, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r7, =gSprites - adds r0, r7 - adds r1, r5, 0 - bl SetSubspriteTables - ldrb r0, [r5, 0xC] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] - ldrb r1, [r5, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - adds r0, 0x43 - mov r1, r8 - strb r1, [r0] - ldrb r1, [r5, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - adds r0, 0x42 - ldrb r2, [r0] - movs r1, 0x40 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldrh r1, [r6, 0x8] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _081AF96E - ldrb r0, [r5, 0xC] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - ldrb r2, [r6, 0xA] - lsls r2, 4 - ldrb r3, [r1, 0x5] - movs r0, 0xF - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] -_081AF96E: - adds r0, r4, 0 - add sp, 0x28 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end ListMenuAddRedOutlineCursorObject - - thumb_func_start ListMenuUpdateRedOutlineCursorObject -@ void ListMenuUpdateRedOutlineCursorObject(u8 taskId, u16 x, u16 y) -ListMenuUpdateRedOutlineCursorObject: @ 81AF994 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 16 - lsrs r2, 16 - lsls r3, r0, 2 - adds r3, r0 - lsls r3, 3 - ldr r0, =gTasks + 0x8 - adds r3, r0 - ldr r5, =gSprites - ldrb r4, [r3, 0xC] - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r5 - adds r1, 0x78 - strh r1, [r0, 0x20] - ldrb r1, [r3, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r2, 0x78 - strh r2, [r0, 0x22] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ListMenuUpdateRedOutlineCursorObject - - thumb_func_start ListMenuRemoveRedOutlineCursorObject -ListMenuRemoveRedOutlineCursorObject: @ 81AF9D8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r0, [r4, 0x8] - bl Free - ldrh r0, [r4, 0xE] - ldr r6, =0x0000ffff - cmp r0, r6 - beq _081AF9FC - bl FreeSpriteTilesByTag -_081AF9FC: - ldrh r0, [r4, 0x10] - cmp r0, r6 - beq _081AFA06 - bl FreeSpritePaletteByTag -_081AFA06: - ldrb r1, [r4, 0xC] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r5, 0 - bl DestroyTask - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end ListMenuRemoveRedOutlineCursorObject - - thumb_func_start ObjectCB_RedArrowCursor -ObjectCB_RedArrowCursor: @ 81AFA30 - push {lr} - adds r2, r0, 0 - ldr r1, =gSineTable - ldrh r3, [r2, 0x2E] - lsls r0, r3, 24 - lsrs r0, 23 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _081AFA48 - adds r0, 0x3F -_081AFA48: - asrs r0, 6 - strh r0, [r2, 0x24] - adds r0, r3, 0 - adds r0, 0x8 - strh r0, [r2, 0x2E] - pop {r0} - bx r0 - .pool - thumb_func_end ObjectCB_RedArrowCursor - - thumb_func_start Task_RedArrowCursor -Task_RedArrowCursor: @ 81AFA5C - bx lr - thumb_func_end Task_RedArrowCursor - - thumb_func_start ListMenuAddRedArrowCursorObject -ListMenuAddRedArrowCursorObject: @ 81AFA60 - push {r4-r7,lr} - sub sp, 0x28 - adds r5, r0, 0 - ldr r0, =gUnknown_08614378 - str r0, [sp, 0x18] - ldr r6, =0xffff0000 - add r0, sp, 0x18 - ldr r1, [r0, 0x4] - ands r1, r6 - movs r2, 0x80 - orrs r1, r2 - ldrh r2, [r5, 0x6] - lsls r2, 16 - ldr r4, =0x0000ffff - ands r1, r4 - orrs r1, r2 - str r1, [r0, 0x4] - bl LoadCompressedObjectPic - ldrh r2, [r5, 0x8] - cmp r2, r4 - bne _081AFAB4 - ldr r0, =gUnknown_086142A8 - ldrb r1, [r5, 0xA] - lsls r1, 20 - movs r2, 0x80 - lsls r2, 17 - adds r1, r2 - lsrs r1, 16 - movs r2, 0x20 - bl LoadPalette - b _081AFAC6 - .pool -_081AFAB4: - ldr r0, =gUnknown_086142A8 - str r0, [sp, 0x20] - add r0, sp, 0x20 - ldr r1, [r0, 0x4] - ands r1, r6 - orrs r1, r2 - str r1, [r0, 0x4] - bl LoadSpritePalette -_081AFAC6: - ldr r0, =Task_RedArrowCursor - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x2] - ldrh r0, [r5, 0x8] - strh r0, [r4, 0x4] - mov r1, sp - ldr r0, =gUnknown_08614290 - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - mov r1, sp - ldrh r0, [r5, 0x6] - strh r0, [r1] - ldrh r0, [r5, 0x8] - strh r0, [r1, 0x2] - ldrb r1, [r5] - ldrb r2, [r5, 0x1] - mov r0, sp - movs r3, 0 - bl CreateSprite - strb r0, [r4] - ldr r3, =gSprites - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r2, 0x8 - strh r2, [r0, 0x24] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - strh r2, [r0, 0x26] - ldrh r1, [r5, 0x8] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _081AFB46 - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r2, [r5, 0xA] - lsls r2, 4 - ldrb r3, [r1, 0x5] - movs r0, 0xF - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] -_081AFB46: - adds r0, r6, 0 - add sp, 0x28 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end ListMenuAddRedArrowCursorObject - - thumb_func_start ListMenuUpdateRedArrowCursorObject -@ void ListMenuUpdateRedArrowCursorObject(u8 taskId, u16 x, u16 y) -ListMenuUpdateRedArrowCursorObject: @ 81AFB68 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r3, r0, 2 - adds r3, r0 - lsls r3, 3 - ldr r0, =gTasks + 0x8 - adds r3, r0 - ldr r5, =gSprites - ldrb r4, [r3] - lsls r0, r4, 4 - adds r0, r4 - lsls r0, 2 - adds r0, r5 - strh r1, [r0, 0x20] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x22] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ListMenuUpdateRedArrowCursorObject - - thumb_func_start ListMenuRemoveRedArrowCursorObject -ListMenuRemoveRedArrowCursorObject: @ 81AFBA0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0x2] - ldr r6, =0x0000ffff - cmp r0, r6 - beq _081AFBBE - bl FreeSpriteTilesByTag -_081AFBBE: - ldrh r0, [r4, 0x4] - cmp r0, r6 - beq _081AFBC8 - bl FreeSpritePaletteByTag -_081AFBC8: - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r5, 0 - bl DestroyTask - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end ListMenuRemoveRedArrowCursorObject - - .align 2, 0 @ Don't pad with nop. diff --git a/data/menu_indicators.s b/data/menu_indicators.s deleted file mode 100644 index 24353b157f..0000000000 --- a/data/menu_indicators.s +++ /dev/null @@ -1,93 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_086141FC:: @ 86141FC - .byte 0, 2, 8, 0 - .byte 1, 2, -8, -1 - .byte 18, 2, 8, 0 - .byte 19, 2, -8, -1 - -gUnknown_0861420C:: @ 861420C - .2byte 0 - .2byte 0x4000 - .2byte 0 - .2byte 0 - -gUnknown_08614214:: @ 8614214 - obj_image_anim_frame 0, 30 - obj_image_anim_end - -gUnknown_0861421C:: @ 861421C - obj_image_anim_frame 0, 0x5e - obj_image_anim_end - -gUnknown_08614224:: @ 8614224 - obj_image_anim_frame 4, 30 - obj_image_anim_end - -gUnknown_0861422C:: @ 861422C - obj_image_anim_frame 4, 0x9e - obj_image_anim_end - -gUnknown_08614234:: @ 8614234 - .4byte gUnknown_08614214 - .4byte gUnknown_0861421C - .4byte gUnknown_08614224 - .4byte gUnknown_0861422C - -gUnknown_08614244:: @ 8614244 - spr_template 0, 0, gUnknown_0861420C, gUnknown_08614234, NULL, gDummySpriteAffineAnimTable, sub_81AF264 - -gUnknown_0861425C:: @ 861425C - .4byte 0x00000000 - -gUnknown_08614260:: @ 8614260 - .4byte 0x00100000 - -gUnknown_08614264:: @ 8614264 - .4byte 0x00200000 - -gUnknown_08614268:: @ 8614268 - .4byte 0x00300000 - -gUnknown_0861426C:: @ 861426C - .4byte 0x00400000 - -gUnknown_08614270:: @ 8614270 - .4byte 0x00500000 - -gUnknown_08614274:: @ 8614274 - .4byte 0x00600000 - -gUnknown_08614278:: @ 8614278 - .4byte 0x00700000 - -gUnknown_0861427C:: @ 861427C - .2byte 0 - .2byte 0x4000 - .2byte 0 - .2byte 0 - -gUnknown_08614284:: @ 8614284 - obj_image_anim_frame 0, 30 - obj_image_anim_end - -gUnknown_0861428C:: @ 861428C - .4byte gUnknown_08614284 - -gUnknown_08614290:: @ 8614290 - spr_template 0, 0, gUnknown_0861427C, gUnknown_0861428C, NULL, gDummySpriteAffineAnimTable, ObjectCB_RedArrowCursor - -gUnknown_086142A8:: @ 86142A8 - .incbin "graphics/interface/red_arrow.gbapal" - -gUnknown_086142C8:: @ 86142C8 - .incbin "graphics/interface/red_arrow_other.4bpp.lz" - -gUnknown_08614338:: @ 8614338 - .incbin "graphics/interface/selector_outline.4bpp.lz" - -gUnknown_08614378:: @ 8614378 - .incbin "graphics/interface/red_arrow.4bpp.lz" diff --git a/include/menu_indicators.h b/include/menu_indicators.h index 06158e3665..d9b4fc9d21 100644 --- a/include/menu_indicators.h +++ b/include/menu_indicators.h @@ -28,9 +28,9 @@ struct CursorStruct u8 unk1; u16 unk2; u16 unk4; - u16 unk6; - u16 unk8; - u8 unkA; + u16 tileTag; + u16 palTag; + u8 palNum; }; void Task_ScrollIndicatorArrowPairOnMainMenu(u8); diff --git a/include/sprite.h b/include/sprite.h index b5a1b6ae50..4723b66e1a 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -229,6 +229,7 @@ struct OamMatrix extern const struct OamData gDummyOamData; extern const union AnimCmd *const gDummySpriteAnimTable[]; extern const union AffineAnimCmd *const gDummySpriteAffineAnimTable[]; +extern const struct SpriteTemplate gDummySpriteTemplate; extern s16 gSpriteCoordOffsetX; extern s16 gSpriteCoordOffsetY; diff --git a/ld_script.txt b/ld_script.txt index a670f54a61..0bd3a34d85 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -246,7 +246,6 @@ SECTIONS { src/item_menu.o(.text); src/list_menu.o(.text); src/menu_indicators.o(.text); - asm/menu_indicators.o(.text); src/unk_text_util.o(.text); src/save_location.o(.text); src/item_icon.o(.text); @@ -521,7 +520,7 @@ SECTIONS { src/menu.o(.rodata); data/battle_frontier_2.o(.rodata); src/item_menu.o(.rodata); - data/menu_indicators.o(.rodata); + src/menu_indicators.o(.rodata); src/save_location.o(.rodata); src/item_icon.o(.rodata); data/party_menu.o(.rodata); diff --git a/src/menu_indicators.c b/src/menu_indicators.c index f8f277ec2f..af218aecfb 100644 --- a/src/menu_indicators.c +++ b/src/menu_indicators.c @@ -4,6 +4,7 @@ #include "trig.h" #include "decompress.h" #include "palette.h" +#include "malloc.h" struct UnkIndicatorsStruct { @@ -47,6 +48,30 @@ struct UnkIndicatorsStruct2 s16 field_1E; }; +struct UnkIndicatorsStruct3 +{ + struct SubspriteTable subspriteTable; + struct Subsprite *subspritesPtr; // not a const pointer + u8 field_C; + u8 field_D; + u16 tileTag; + u16 palTag; + u16 field_12; + u16 field_14; + u16 field_16; + u16 field_18; + u16 field_1A; + u16 field_1C; + s16 field_1E; +}; + +struct UnkIndicatorsStruct4 +{ + u8 field_0; + u16 tileTag; + u16 palTag; +}; + struct UnkSmallIndicatorsStruct { u8 field_0_0:4; @@ -55,11 +80,6 @@ struct UnkSmallIndicatorsStruct u16 field_2; }; -extern const struct SpriteTemplate gUnknown_08614244; -extern const struct UnkSmallIndicatorsStruct gUnknown_086141FC[]; -extern const u8 gUnknown_086142C8[]; -extern const u16 gUnknown_086142A8[]; - extern struct ArrowStruct gUnknown_0203CE8C; // this file's functions @@ -70,6 +90,201 @@ void ListMenuUpdateRedOutlineCursorObject(u8 taskId, u16 x, u16 y); void ListMenuUpdateRedArrowCursorObject(u8 taskId, u16 x, u16 y); void ListMenuRemoveRedOutlineCursorObject(u8 taskId); void ListMenuRemoveRedArrowCursorObject(u8 taskId); +void sub_81AF264(struct Sprite *sprite); +void ObjectCB_RedArrowCursor(struct Sprite *sprite); + +// const rom data +static const struct UnkSmallIndicatorsStruct gUnknown_086141FC[] = +{ + {0, 0, 2, 8}, + {1, 0, 2, -8}, + {2, 1, 2, 8}, + {3, 1, 2, -8}, +}; + +static const struct OamData sOamData_861420C = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_8614214[] = +{ + ANIMCMD_FRAME(0, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_861421C[] = +{ + ANIMCMD_FRAME(0, 30, 1, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8614224[] = +{ + ANIMCMD_FRAME(4, 30), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_861422C[] = +{ + ANIMCMD_FRAME(4, 30, 0, 1), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_8614234[] = +{ + sSpriteAnim_8614214, + sSpriteAnim_861421C, + sSpriteAnim_8614224, + sSpriteAnim_861422C +}; + +static const struct SpriteTemplate gUnknown_08614244 = +{ + .tileTag = 0, + .paletteTag = 0, + .oam = &sOamData_861420C, + .anims = sSpriteAnimTable_8614234, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81AF264, +}; + +static const struct Subsprite sSubsprite_861425C = +{ + .x = 0, + .y = 0, + .shape = 0, + .size = 0, + .tileOffset = 0, + .priority = 0, +}; + +static const struct Subsprite sSubsprite_8614260 = +{ + .x = 0, + .y = 0, + .shape = 0, + .size = 0, + .tileOffset = 1, + .priority = 0, +}; + +static const struct Subsprite sSubsprite_8614264 = +{ + .x = 0, + .y = 0, + .shape = 0, + .size = 0, + .tileOffset = 2, + .priority = 0, +}; + +static const struct Subsprite sSubsprite_8614268 = +{ + .x = 0, + .y = 0, + .shape = 0, + .size = 0, + .tileOffset = 3, + .priority = 0, +}; + +static const struct Subsprite sSubsprite_861426C = +{ + .x = 0, + .y = 0, + .shape = 0, + .size = 0, + .tileOffset = 4, + .priority = 0, +}; + +static const struct Subsprite sSubsprite_8614270 = +{ + .x = 0, + .y = 0, + .shape = 0, + .size = 0, + .tileOffset = 5, + .priority = 0, +}; + +static const struct Subsprite sSubsprite_8614274 = +{ + .x = 0, + .y = 0, + .shape = 0, + .size = 0, + .tileOffset = 6, + .priority = 0, +}; + +static const struct Subsprite sSubsprite_8614278 = +{ + .x = 0, + .y = 0, + .shape = 0, + .size = 0, + .tileOffset = 7, + .priority = 0, +}; + +static const struct OamData sOamData_861427C = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_8614284[] = +{ + ANIMCMD_FRAME(0, 30), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_861428C[] = +{ + sSpriteAnim_8614284 +}; + +static const struct SpriteTemplate gUnknown_08614290 = +{ + .tileTag = 0, + .paletteTag = 0, + .oam = &sOamData_861427C, + .anims = sSpriteAnimTable_861428C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = ObjectCB_RedArrowCursor, +}; + +static const u16 gUnknown_086142A8[] = INCBIN_U16("graphics/interface/red_arrow.gbapal"); +static const u8 gUnknown_086142C8[] = INCBIN_U8("graphics/interface/red_arrow_other.4bpp.lz"); +static const u8 gUnknown_08614338[] = INCBIN_U8("graphics/interface/selector_outline.4bpp.lz"); +static const u8 gUnknown_08614378[] = INCBIN_U8("graphics/interface/red_arrow.4bpp.lz"); // code s32 sub_81AF08C(u8 taskId, u8 field) @@ -385,3 +600,231 @@ void Task_RedOutlineCursor(u8 taskId) { } + +u8 ListMenuGetRedOutlineCursorSpriteCount(u16 arg0, u16 arg1) +{ + s32 i; + s32 count = 4; + + if (arg0 > 16) + { + for (i = 8; i < (arg0 - 8); i += 8) + count += 2; + } + if (arg1 > 16) + { + for (i = 8; i < (arg1 - 8); i += 8) + count += 2; + } + + return count; +} + +void ListMenuSetUpRedOutlineCursorSpriteOamTable(u16 arg0, u16 arg1, struct Subsprite *subsprites) +{ + s32 i, j, id = 0; + + subsprites[id] = sSubsprite_861425C; + subsprites[id].x = 136; + subsprites[id].y = 136; + id++; + + subsprites[id] = sSubsprite_8614260; + subsprites[id].x = arg0 + 128; + subsprites[id].y = 136; + id++; + + subsprites[id] = sSubsprite_8614274; + subsprites[id].x = 136; + subsprites[id].y = arg1 + 128; + id++; + + subsprites[id] = sSubsprite_8614278; + subsprites[id].x = arg0 + 128; + subsprites[id].y = arg1 + 128; + id++; + + if (arg0 > 16) + { + for (i = 8; i < arg0 - 8; i += 8) + { + subsprites[id] = sSubsprite_8614264; + subsprites[id].x = i - 120; + subsprites[id].y = 136; + id++; + + subsprites[id] = sSubsprite_8614270; + subsprites[id].x = i - 120; + subsprites[id].y = arg1 + 128; + id++; + } + } + + if (arg1 > 16) + { + for (j = 8; j < arg1 - 8; j += 8) + { + subsprites[id] = sSubsprite_8614268; + subsprites[id].x = 136; + subsprites[id].y = j - 120; + id++; + + subsprites[id] = sSubsprite_861426C; + subsprites[id].x = arg0 + 128; + subsprites[id].y = j - 120; + id++; + } + } +} + +u8 ListMenuAddRedOutlineCursorObject(struct CursorStruct *cursor) +{ + struct CompressedSpriteSheet spriteSheet; + struct SpritePalette spritePal; + struct UnkIndicatorsStruct3 *data; + struct SpriteTemplate spriteTemplate; + u8 taskId; + + spriteSheet.data = gUnknown_08614338; + spriteSheet.size = 0x100; + spriteSheet.tag = cursor->tileTag; + LoadCompressedObjectPic(&spriteSheet); + + if (cursor->palTag == 0xFFFF) + { + LoadPalette(gUnknown_086142A8, (16 * cursor->palNum) + 0x100, 0x20); + } + else + { + spritePal.data = gUnknown_086142A8; + spritePal.tag = cursor->palTag; + LoadSpritePalette(&spritePal); + } + + taskId = CreateTask(Task_RedOutlineCursor, 0); + data = (void*) gTasks[taskId].data; + + data->tileTag = cursor->tileTag; + data->palTag = cursor->palTag; + data->subspriteTable.subspriteCount = ListMenuGetRedOutlineCursorSpriteCount(cursor->unk2, cursor->unk4); + data->subspriteTable.subsprites = data->subspritesPtr = Alloc(data->subspriteTable.subspriteCount * 4); + ListMenuSetUpRedOutlineCursorSpriteOamTable(cursor->unk2, cursor->unk4, data->subspritesPtr); + + spriteTemplate = gDummySpriteTemplate; + spriteTemplate.tileTag = cursor->tileTag; + spriteTemplate.paletteTag = cursor->palTag; + + data->field_C = CreateSprite(&spriteTemplate, cursor->unk0 + 120, cursor->unk1 + 120, 0); + SetSubspriteTables(&gSprites[data->field_C], &data->subspriteTable); + gSprites[data->field_C].oam.priority = 0; + gSprites[data->field_C].subpriority = 0; + gSprites[data->field_C].subspriteTableNum = 0; + + if (cursor->palTag == 0xFFFF) + { + gSprites[data->field_C].oam.paletteNum = cursor->palNum; + } + + return taskId; +} + +void ListMenuUpdateRedOutlineCursorObject(u8 taskId, u16 x, u16 y) +{ + struct UnkIndicatorsStruct3 *data = (void*) gTasks[taskId].data; + + gSprites[data->field_C].pos1.x = x + 120; + gSprites[data->field_C].pos1.y = y + 120; +} + +void ListMenuRemoveRedOutlineCursorObject(u8 taskId) +{ + struct UnkIndicatorsStruct3 *data = (void*) gTasks[taskId].data; + + Free(data->subspritesPtr); + + if (data->tileTag != 0xFFFF) + FreeSpriteTilesByTag(data->tileTag); + if (data->palTag != 0xFFFF) + FreeSpritePaletteByTag(data->palTag); + + DestroySprite(&gSprites[data->field_C]); + DestroyTask(taskId); +} + +void ObjectCB_RedArrowCursor(struct Sprite *sprite) +{ + sprite->pos2.x = gSineTable[(u8)(sprite->data[0])] / 64; + sprite->data[0] += 8; +} + +void Task_RedArrowCursor(u8 taskId) +{ + +} + +u8 ListMenuAddRedArrowCursorObject(struct CursorStruct *cursor) +{ + struct CompressedSpriteSheet spriteSheet; + struct SpritePalette spritePal; + struct UnkIndicatorsStruct4 *data; + struct SpriteTemplate spriteTemplate; + u8 taskId; + + spriteSheet.data = gUnknown_08614378; + spriteSheet.size = 0x80; + spriteSheet.tag = cursor->tileTag; + LoadCompressedObjectPic(&spriteSheet); + + if (cursor->palTag == 0xFFFF) + { + LoadPalette(gUnknown_086142A8, (16 * cursor->palNum) + 0x100, 0x20); + } + else + { + spritePal.data = gUnknown_086142A8; + spritePal.tag = cursor->palTag; + LoadSpritePalette(&spritePal); + } + + taskId = CreateTask(Task_RedArrowCursor, 0); + data = (void*) gTasks[taskId].data; + + data->tileTag = cursor->tileTag; + data->palTag = cursor->palTag; + + spriteTemplate = gUnknown_08614290; + spriteTemplate.tileTag = cursor->tileTag; + spriteTemplate.paletteTag = cursor->palTag; + + data->field_0 = CreateSprite(&spriteTemplate, cursor->unk0, cursor->unk1, 0); + gSprites[data->field_0].pos2.x = 8; + gSprites[data->field_0].pos2.y = 8; + + if (cursor->palTag == 0xFFFF) + { + gSprites[data->field_0].oam.paletteNum = cursor->palNum; + } + + return taskId; +} + +void ListMenuUpdateRedArrowCursorObject(u8 taskId, u16 x, u16 y) +{ + struct UnkIndicatorsStruct4 *data = (void*) gTasks[taskId].data; + + gSprites[data->field_0].pos1.x = x; + gSprites[data->field_0].pos1.y = y; +} + +void ListMenuRemoveRedArrowCursorObject(u8 taskId) +{ + struct UnkIndicatorsStruct4 *data = (void*) gTasks[taskId].data; + + if (data->tileTag != 0xFFFF) + FreeSpriteTilesByTag(data->tileTag); + if (data->palTag != 0xFFFF) + FreeSpritePaletteByTag(data->palTag); + + DestroySprite(&gSprites[data->field_0]); + DestroyTask(taskId); +}