diff --git a/asm/intro.s b/asm/intro.s index 41d16e0..fbf3807 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -5,1493 +5,6 @@ .text - thumb_func_start sub_081472DC -sub_081472DC: @ 0x081472DC - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldrh r0, [r4, #0xe] - adds r1, r0, #3 - movs r5, #0 - strh r1, [r4, #0xe] - lsls r0, r1, #0x10 - cmp r0, #0 - blt _08147354 - ldrh r0, [r4, #0x24] - strh r0, [r4, #0xe] - ldr r2, _08147310 @ =gRngVal - ldr r1, [r2] - ldr r0, _08147314 @ =0x00196225 - muls r0, r1, r0 - ldr r1, _08147318 @ =0x3C6EF35F - adds r0, r0, r1 - str r0, [r2] - movs r1, #3 - bl __umodsi3 - cmp r0, #0 - beq _08147320 - ldr r0, _0814731C @ =0x0000FFCE - b _08147322 - .align 2, 0 -_08147310: .4byte gRngVal -_08147314: .4byte 0x00196225 -_08147318: .4byte 0x3C6EF35F -_0814731C: .4byte 0x0000FFCE -_08147320: - ldr r0, _08147348 @ =0x0000FF9C -_08147322: - strh r0, [r4, #0x10] - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - ldr r2, _0814734C @ =gUnk_08387220 - ldrh r1, [r2, #4] - strh r1, [r0, #0xc] - ldrh r1, [r2, #6] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _08147350 @ =sub_081473E0 - str r0, [r4, #0x1c] - b _081473D2 - .align 2, 0 -_08147348: .4byte 0x0000FF9C -_0814734C: .4byte gUnk_08387220 -_08147350: .4byte sub_081473E0 -_08147354: - ldrh r0, [r4, #0xa] - adds r1, r0, r1 - strh r1, [r4, #0xa] - ldrb r0, [r4] - cmp r0, #0 - beq _0814739A - lsls r1, r1, #0x10 - asrs r1, r1, #0x16 - ldr r2, _081473D8 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _0814739A - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _0814739A - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _0814739A - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_0814739A: - ldr r6, [r4, #0x20] - ldrb r5, [r4, #3] - lsls r0, r5, #2 - adds r0, r0, r5 - lsls r0, r0, #3 - adds r0, #0x48 - adds r4, r6, r0 - ldr r1, _081473DC @ =0x000005CC - adds r0, r6, r1 - adds r0, r0, r5 - ldrb r0, [r0] - cmp r0, #1 - beq _081473D2 - ldr r0, [r4] - cmp r0, #0 - beq _081473C8 - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _081473C8 - movs r0, #0xff - strb r0, [r4, #0x1b] -_081473C8: - ldr r1, _081473DC @ =0x000005CC - adds r0, r6, r1 - adds r0, r0, r5 - movs r1, #1 - strb r1, [r0] -_081473D2: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_081473D8: .4byte gUnk_08387348 -_081473DC: .4byte 0x000005CC - - thumb_func_start sub_081473E0 -sub_081473E0: @ 0x081473E0 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldrh r1, [r4, #0x10] - adds r1, #9 - strh r1, [r4, #0x10] - ldrh r0, [r4, #0xe] - ldrh r3, [r4, #0xa] - adds r2, r0, r3 - strh r2, [r4, #0xa] - ldrh r0, [r4, #0xc] - adds r0, r0, r1 - strh r0, [r4, #0xc] - ldrb r0, [r4] - cmp r0, #0 - beq _08147438 - lsls r1, r2, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147470 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _08147438 - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _08147438 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _08147438 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_08147438: - movs r0, #0xc - ldrsh r1, [r4, r0] - ldr r0, _08147474 @ =0x00001DFF - cmp r1, r0 - ble _08147480 - movs r1, #0 - adds r0, #1 - strh r0, [r4, #0xc] - strh r1, [r4, #0x10] - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - ldr r2, _08147478 @ =gUnk_08387220 - ldrh r1, [r2] - strh r1, [r0, #0xc] - ldrh r1, [r2, #2] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _0814747C @ =sub_081472DC - str r0, [r4, #0x1c] - b _081474B8 - .align 2, 0 -_08147470: .4byte gUnk_08387348 -_08147474: .4byte 0x00001DFF -_08147478: .4byte gUnk_08387220 -_0814747C: .4byte sub_081472DC -_08147480: - ldr r6, [r4, #0x20] - ldrb r5, [r4, #3] - lsls r0, r5, #2 - adds r0, r0, r5 - lsls r0, r0, #3 - adds r0, #0x48 - adds r4, r6, r0 - ldr r1, _081474C0 @ =0x000005CC - adds r0, r6, r1 - adds r0, r0, r5 - ldrb r0, [r0] - cmp r0, #1 - beq _081474B8 - ldr r0, [r4] - cmp r0, #0 - beq _081474AE - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _081474AE - movs r0, #0xff - strb r0, [r4, #0x1b] -_081474AE: - ldr r3, _081474C0 @ =0x000005CC - adds r0, r6, r3 - adds r0, r0, r5 - movs r1, #1 - strb r1, [r0] -_081474B8: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_081474C0: .4byte 0x000005CC - - thumb_func_start sub_081474C4 -sub_081474C4: @ 0x081474C4 - push {r4, r5, r6, r7, lr} - adds r5, r0, #0 - adds r7, r5, #0 - adds r7, #0x24 - movs r1, #3 - ldrsb r1, [r5, r1] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #3 - adds r0, #0x48 - ldr r1, [r5, #0x20] - adds r6, r1, r0 - ldrh r1, [r5, #0xe] - movs r2, #0xe - ldrsh r0, [r5, r2] - cmp r0, #0 - bge _081474F4 - adds r0, r1, #3 - strh r0, [r5, #0xe] - lsls r0, r0, #0x10 - cmp r0, #0 - ble _081474F4 - movs r0, #0 - strh r0, [r5, #0xe] -_081474F4: - ldrh r0, [r5, #0xe] - ldrh r2, [r5, #0xa] - adds r1, r0, r2 - strh r1, [r5, #0xa] - ldrb r0, [r5] - cmp r0, #0 - beq _0814753C - lsls r1, r1, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147574 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _0814753C - adds r0, r5, #0 - bl sub_08146B68 - adds r0, r5, #0 - bl sub_08146BEC - adds r4, r0, #0 - cmp r4, #0 - beq _0814753C - adds r0, r5, #0 - adds r1, r4, #0 - bl sub_081497B4 - cmp r0, #0 - beq _0814753C - adds r0, r5, #0 - adds r1, r4, #0 - bl sub_08149814 -_0814753C: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _0814756E - ldrh r0, [r7] - movs r4, #0 - strh r0, [r5, #0xe] - ldrh r0, [r7, #2] - strh r0, [r5, #0x10] - ldr r1, _08147578 @ =gUnk_08387230 - ldrh r0, [r1, #8] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0xa] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - movs r0, #0x97 - lsls r0, r0, #2 - bl m4aSongNumStart - strb r4, [r7, #4] - ldr r0, _0814757C @ =sub_08147580 - str r0, [r5, #0x1c] -_0814756E: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_08147574: .4byte gUnk_08387348 -_08147578: .4byte gUnk_08387230 -_0814757C: .4byte sub_08147580 - - thumb_func_start sub_08147580 -sub_08147580: @ 0x08147580 - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - adds r6, r4, #0 - adds r6, #0x24 - ldrh r1, [r4, #0x10] - adds r1, #9 - strh r1, [r4, #0x10] - ldrh r0, [r4, #0xe] - ldrh r3, [r4, #0xa] - adds r2, r0, r3 - strh r2, [r4, #0xa] - ldrh r0, [r4, #0xc] - adds r0, r0, r1 - strh r0, [r4, #0xc] - ldrb r0, [r4] - cmp r0, #0 - beq _081475DC - lsls r1, r2, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147614 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _081475DC - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _081475DC - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _081475DC - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_081475DC: - movs r0, #0xc - ldrsh r1, [r4, r0] - ldr r0, _08147618 @ =0x00001DFF - cmp r1, r0 - ble _08147624 - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - movs r2, #0 - movs r1, #0xf0 - lsls r1, r1, #5 - strh r1, [r4, #0xc] - strh r2, [r4, #0x10] - ldr r2, _0814761C @ =gUnk_08387230 - ldrh r1, [r2, #0x14] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0x16] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _08147620 @ =sub_08147858 - str r0, [r4, #0x1c] - b _0814769E - .align 2, 0 -_08147614: .4byte gUnk_08387348 -_08147618: .4byte 0x00001DFF -_0814761C: .4byte gUnk_08387230 -_08147620: .4byte sub_08147858 -_08147624: - ldrb r0, [r6, #4] - adds r0, #1 - strb r0, [r6, #4] - movs r7, #0xff - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - ldrb r6, [r6, #5] - cmp r0, r6 - blo _08147664 - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - ldr r2, _0814765C @ =gUnk_08387230 - ldrh r1, [r2, #0xc] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0xe] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _08147660 @ =sub_081476A8 - str r0, [r4, #0x1c] - b _0814769E - .align 2, 0 -_0814765C: .4byte gUnk_08387230 -_08147660: .4byte sub_081476A8 -_08147664: - ldr r6, [r4, #0x20] - ldrb r5, [r4, #3] - lsls r0, r5, #2 - adds r0, r0, r5 - lsls r0, r0, #3 - adds r0, #0x48 - adds r4, r6, r0 - ldr r1, _081476A4 @ =0x000005CC - adds r0, r6, r1 - adds r0, r0, r5 - ldrb r0, [r0] - cmp r0, #1 - beq _0814769E - ldr r0, [r4] - cmp r0, #0 - beq _08147694 - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147694 - ldrb r0, [r4, #0x1b] - orrs r0, r7 - strb r0, [r4, #0x1b] -_08147694: - ldr r3, _081476A4 @ =0x000005CC - adds r0, r6, r3 - adds r0, r0, r5 - movs r1, #1 - strb r1, [r0] -_0814769E: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_081476A4: .4byte 0x000005CC - - thumb_func_start sub_081476A8 -sub_081476A8: @ 0x081476A8 - push {r4, r5, r6, lr} - adds r4, r0, #0 - movs r1, #3 - ldrsb r1, [r4, r1] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #3 - adds r0, #0x48 - ldr r1, [r4, #0x20] - adds r6, r1, r0 - ldrh r1, [r4, #0x10] - adds r1, #9 - strh r1, [r4, #0x10] - ldrh r0, [r4, #0xe] - ldrh r3, [r4, #0xa] - adds r2, r0, r3 - strh r2, [r4, #0xa] - ldrh r0, [r4, #0xc] - adds r0, r0, r1 - strh r0, [r4, #0xc] - ldrb r0, [r4] - cmp r0, #0 - beq _08147710 - lsls r1, r2, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147738 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _08147710 - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _08147710 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _08147710 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_08147710: - movs r0, #0xc - ldrsh r1, [r4, r0] - ldr r0, _0814773C @ =0x00001DFF - cmp r1, r0 - ble _08147748 - movs r1, #0 - adds r0, #1 - strh r0, [r4, #0xc] - strh r1, [r4, #0x10] - ldr r1, _08147740 @ =gUnk_08387230 - ldrh r0, [r1, #0x14] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0x16] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _08147744 @ =sub_08147858 - b _08147764 - .align 2, 0 -_08147738: .4byte gUnk_08387348 -_0814773C: .4byte 0x00001DFF -_08147740: .4byte gUnk_08387230 -_08147744: .4byte sub_08147858 -_08147748: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147766 - ldr r1, _0814776C @ =gUnk_08387230 - ldrh r0, [r1, #0x10] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0x12] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _08147770 @ =sub_08147774 -_08147764: - str r0, [r4, #0x1c] -_08147766: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_0814776C: .4byte gUnk_08387230 -_08147770: .4byte sub_08147774 - - thumb_func_start sub_08147774 -sub_08147774: @ 0x08147774 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldrh r1, [r4, #0x10] - adds r1, #9 - strh r1, [r4, #0x10] - ldrh r0, [r4, #0xe] - ldrh r3, [r4, #0xa] - adds r2, r0, r3 - strh r2, [r4, #0xa] - ldrh r0, [r4, #0xc] - adds r0, r0, r1 - strh r0, [r4, #0xc] - ldrb r0, [r4] - cmp r0, #0 - beq _081477CC - lsls r1, r2, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147804 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _081477CC - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _081477CC - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _081477CC - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_081477CC: - movs r0, #0xc - ldrsh r1, [r4, r0] - ldr r0, _08147808 @ =0x00001DFF - cmp r1, r0 - ble _08147814 - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - movs r2, #0 - movs r1, #0xf0 - lsls r1, r1, #5 - strh r1, [r4, #0xc] - strh r2, [r4, #0x10] - ldr r2, _0814780C @ =gUnk_08387230 - ldrh r1, [r2, #0x14] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0x16] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _08147810 @ =sub_08147858 - str r0, [r4, #0x1c] - b _0814784C - .align 2, 0 -_08147804: .4byte gUnk_08387348 -_08147808: .4byte 0x00001DFF -_0814780C: .4byte gUnk_08387230 -_08147810: .4byte sub_08147858 -_08147814: - ldr r6, [r4, #0x20] - ldrb r5, [r4, #3] - lsls r0, r5, #2 - adds r0, r0, r5 - lsls r0, r0, #3 - adds r0, #0x48 - adds r4, r6, r0 - ldr r1, _08147854 @ =0x000005CC - adds r0, r6, r1 - adds r0, r0, r5 - ldrb r0, [r0] - cmp r0, #1 - beq _0814784C - ldr r0, [r4] - cmp r0, #0 - beq _08147842 - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147842 - movs r0, #0xff - strb r0, [r4, #0x1b] -_08147842: - ldr r3, _08147854 @ =0x000005CC - adds r0, r6, r3 - adds r0, r0, r5 - movs r1, #1 - strb r1, [r0] -_0814784C: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_08147854: .4byte 0x000005CC - - thumb_func_start sub_08147858 -sub_08147858: @ 0x08147858 - push {r4, r5, r6, lr} - adds r4, r0, #0 - movs r1, #3 - ldrsb r1, [r4, r1] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #3 - adds r0, #0x48 - ldr r1, [r4, #0x20] - adds r6, r1, r0 - ldrh r1, [r4, #0xe] - movs r2, #0xe - ldrsh r0, [r4, r2] - cmp r0, #0 - bge _08147884 - adds r0, r1, #3 - strh r0, [r4, #0xe] - lsls r0, r0, #0x10 - cmp r0, #0 - ble _08147884 - movs r0, #0 - strh r0, [r4, #0xe] -_08147884: - ldrh r0, [r4, #0xe] - ldrh r2, [r4, #0xa] - adds r1, r0, r2 - strh r1, [r4, #0xa] - ldrb r0, [r4] - cmp r0, #0 - beq _081478CC - lsls r1, r1, #0x10 - asrs r1, r1, #0x16 - ldr r2, _081478F0 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _081478CC - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _081478CC - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _081478CC - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_081478CC: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _081478EA - ldr r1, _081478F4 @ =gUnk_08387230 - ldrh r0, [r1, #4] - strh r0, [r6, #0xc] - ldrh r0, [r1, #6] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _081478F8 @ =sub_081474C4 - str r0, [r4, #0x1c] -_081478EA: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_081478F0: .4byte gUnk_08387348 -_081478F4: .4byte gUnk_08387230 -_081478F8: .4byte sub_081474C4 - - thumb_func_start sub_081478FC -sub_081478FC: @ 0x081478FC - push {r4, r5, r6, lr} - adds r4, r0, #0 - adds r6, r4, #0 - adds r6, #0x24 - ldrh r0, [r4, #0xe] - ldrh r2, [r4, #0xa] - adds r1, r0, r2 - strh r1, [r4, #0xa] - ldrb r0, [r4] - cmp r0, #0 - beq _0814794C - lsls r1, r1, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147998 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _0814794C - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _0814794C - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _0814794C - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_0814794C: - ldrh r0, [r6, #6] - adds r0, #1 - strh r0, [r6, #6] - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - ldrh r1, [r6, #8] - cmp r0, r1 - blo _081479A4 - movs r0, #0 - strh r0, [r6, #6] - ldrb r2, [r6, #0xb] - cmp r2, #0 - beq _081479A4 - ldrb r0, [r6, #0xa] - adds r1, r0, #1 - strb r1, [r6, #0xa] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, r2 - bhs _081479A4 - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - ldr r2, _0814799C @ =gUnk_08387248 - ldrh r1, [r2, #8] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0xa] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _081479A0 @ =sub_081479E8 - str r0, [r4, #0x1c] - b _081479DC - .align 2, 0 -_08147998: .4byte gUnk_08387348 -_0814799C: .4byte gUnk_08387248 -_081479A0: .4byte sub_081479E8 -_081479A4: - ldr r6, [r4, #0x20] - ldrb r5, [r4, #3] - lsls r0, r5, #2 - adds r0, r0, r5 - lsls r0, r0, #3 - adds r0, #0x48 - adds r4, r6, r0 - ldr r2, _081479E4 @ =0x000005CC - adds r0, r6, r2 - adds r0, r0, r5 - ldrb r0, [r0] - cmp r0, #1 - beq _081479DC - ldr r0, [r4] - cmp r0, #0 - beq _081479D2 - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _081479D2 - movs r0, #0xff - strb r0, [r4, #0x1b] -_081479D2: - ldr r1, _081479E4 @ =0x000005CC - adds r0, r6, r1 - adds r0, r0, r5 - movs r1, #1 - strb r1, [r0] -_081479DC: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_081479E4: .4byte 0x000005CC - - thumb_func_start sub_081479E8 -sub_081479E8: @ 0x081479E8 - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - adds r7, r4, #0 - adds r7, #0x24 - movs r1, #3 - ldrsb r1, [r4, r1] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #3 - adds r0, #0x48 - ldr r1, [r4, #0x20] - adds r6, r1, r0 - ldrh r1, [r4, #0xe] - movs r2, #0xe - ldrsh r0, [r4, r2] - cmp r0, #0 - bge _08147A18 - adds r0, r1, #3 - strh r0, [r4, #0xe] - lsls r0, r0, #0x10 - cmp r0, #0 - ble _08147A18 - movs r0, #0 - strh r0, [r4, #0xe] -_08147A18: - ldrh r0, [r4, #0xe] - ldrh r2, [r4, #0xa] - adds r1, r0, r2 - strh r1, [r4, #0xa] - ldrb r0, [r4] - cmp r0, #0 - beq _08147A60 - lsls r1, r1, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147A8C @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _08147A60 - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _08147A60 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _08147A60 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_08147A60: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147A86 - ldrh r0, [r7] - strh r0, [r4, #0xe] - ldrh r0, [r7, #2] - strh r0, [r4, #0x10] - ldr r1, _08147A90 @ =gUnk_08387248 - ldrh r0, [r1, #0xc] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0xe] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _08147A94 @ =sub_08147A98 - str r0, [r4, #0x1c] -_08147A86: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_08147A8C: .4byte gUnk_08387348 -_08147A90: .4byte gUnk_08387248 -_08147A94: .4byte sub_08147A98 - - thumb_func_start sub_08147A98 -sub_08147A98: @ 0x08147A98 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldrh r1, [r4, #0x10] - adds r1, #9 - strh r1, [r4, #0x10] - ldrh r0, [r4, #0xe] - ldrh r3, [r4, #0xa] - adds r2, r0, r3 - strh r2, [r4, #0xa] - ldrh r0, [r4, #0xc] - adds r0, r0, r1 - strh r0, [r4, #0xc] - ldrb r0, [r4] - cmp r0, #0 - beq _08147AF0 - lsls r1, r2, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147B28 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _08147AF0 - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _08147AF0 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _08147AF0 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_08147AF0: - movs r0, #0xc - ldrsh r1, [r4, r0] - ldr r0, _08147B2C @ =0x00001DFF - cmp r1, r0 - ble _08147B38 - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - movs r2, #0 - movs r1, #0xf0 - lsls r1, r1, #5 - strh r1, [r4, #0xc] - strh r2, [r4, #0x10] - ldr r2, _08147B30 @ =gUnk_08387248 - ldrh r1, [r2, #0x10] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0x12] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _08147B34 @ =sub_08147B7C - str r0, [r4, #0x1c] - b _08147B70 - .align 2, 0 -_08147B28: .4byte gUnk_08387348 -_08147B2C: .4byte 0x00001DFF -_08147B30: .4byte gUnk_08387248 -_08147B34: .4byte sub_08147B7C -_08147B38: - ldr r6, [r4, #0x20] - ldrb r5, [r4, #3] - lsls r0, r5, #2 - adds r0, r0, r5 - lsls r0, r0, #3 - adds r0, #0x48 - adds r4, r6, r0 - ldr r1, _08147B78 @ =0x000005CC - adds r0, r6, r1 - adds r0, r0, r5 - ldrb r0, [r0] - cmp r0, #1 - beq _08147B70 - ldr r0, [r4] - cmp r0, #0 - beq _08147B66 - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147B66 - movs r0, #0xff - strb r0, [r4, #0x1b] -_08147B66: - ldr r3, _08147B78 @ =0x000005CC - adds r0, r6, r3 - adds r0, r0, r5 - movs r1, #1 - strb r1, [r0] -_08147B70: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_08147B78: .4byte 0x000005CC - - thumb_func_start sub_08147B7C -sub_08147B7C: @ 0x08147B7C - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - adds r7, r4, #0 - adds r7, #0x24 - movs r1, #3 - ldrsb r1, [r4, r1] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #3 - adds r0, #0x48 - ldr r1, [r4, #0x20] - adds r6, r1, r0 - ldrh r1, [r4, #0xe] - movs r2, #0xe - ldrsh r0, [r4, r2] - cmp r0, #0 - bge _08147BAC - adds r0, r1, #3 - strh r0, [r4, #0xe] - lsls r0, r0, #0x10 - cmp r0, #0 - ble _08147BAC - movs r0, #0 - strh r0, [r4, #0xe] -_08147BAC: - ldrh r0, [r4, #0xe] - ldrh r2, [r4, #0xa] - adds r1, r0, r2 - strh r1, [r4, #0xa] - ldrb r0, [r4] - cmp r0, #0 - beq _08147BF4 - lsls r1, r1, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147C1C @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _08147BF4 - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _08147BF4 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _08147BF4 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_08147BF4: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147C16 - ldrh r0, [r7] - strh r0, [r4, #0xe] - ldr r1, _08147C20 @ =gUnk_08387248 - ldrh r0, [r1, #4] - strh r0, [r6, #0xc] - ldrh r0, [r1, #6] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _08147C24 @ =sub_081478FC - str r0, [r4, #0x1c] -_08147C16: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_08147C1C: .4byte gUnk_08387348 -_08147C20: .4byte gUnk_08387248 -_08147C24: .4byte sub_081478FC - - thumb_func_start sub_08147C28 -sub_08147C28: @ 0x08147C28 - push {r4, r5, r6, r7, lr} - adds r5, r0, #0 - adds r7, r5, #0 - adds r7, #0x24 - movs r1, #3 - ldrsb r1, [r5, r1] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #3 - adds r0, #0x48 - ldr r1, [r5, #0x20] - adds r6, r1, r0 - ldrh r1, [r5, #0xe] - movs r2, #0xe - ldrsh r0, [r5, r2] - cmp r0, #0 - bge _08147C58 - adds r0, r1, #3 - strh r0, [r5, #0xe] - lsls r0, r0, #0x10 - cmp r0, #0 - ble _08147C58 - movs r0, #0 - strh r0, [r5, #0xe] -_08147C58: - ldrh r0, [r5, #0xe] - ldrh r2, [r5, #0xa] - adds r1, r0, r2 - strh r1, [r5, #0xa] - ldrb r0, [r5] - cmp r0, #0 - beq _08147CA0 - lsls r1, r1, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147CD8 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _08147CA0 - adds r0, r5, #0 - bl sub_08146B68 - adds r0, r5, #0 - bl sub_08146BEC - adds r4, r0, #0 - cmp r4, #0 - beq _08147CA0 - adds r0, r5, #0 - adds r1, r4, #0 - bl sub_081497B4 - cmp r0, #0 - beq _08147CA0 - adds r0, r5, #0 - adds r1, r4, #0 - bl sub_08149814 -_08147CA0: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147CD0 - ldrh r0, [r7] - movs r4, #0 - strh r0, [r5, #0xe] - ldrh r0, [r7, #2] - strh r0, [r5, #0x10] - ldr r1, _08147CDC @ =gUnk_0838725C - ldrh r0, [r1, #8] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0xa] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _08147CE0 @ =0x0000025D - bl m4aSongNumStart - strb r4, [r7, #4] - ldr r0, _08147CE4 @ =sub_08147CE8 - str r0, [r5, #0x1c] -_08147CD0: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_08147CD8: .4byte gUnk_08387348 -_08147CDC: .4byte gUnk_0838725C -_08147CE0: .4byte 0x0000025D -_08147CE4: .4byte sub_08147CE8 - - thumb_func_start sub_08147CE8 -sub_08147CE8: @ 0x08147CE8 - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - adds r6, r4, #0 - adds r6, #0x24 - ldrh r1, [r4, #0x10] - adds r1, #9 - strh r1, [r4, #0x10] - ldrh r0, [r4, #0xe] - ldrh r3, [r4, #0xa] - adds r2, r0, r3 - strh r2, [r4, #0xa] - ldrh r0, [r4, #0xc] - adds r0, r0, r1 - strh r0, [r4, #0xc] - ldrb r0, [r4] - cmp r0, #0 - beq _08147D44 - lsls r1, r2, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147D7C @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _08147D44 - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _08147D44 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _08147D44 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_08147D44: - movs r0, #0xc - ldrsh r1, [r4, r0] - ldr r0, _08147D80 @ =0x00001DFF - cmp r1, r0 - ble _08147D8C - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - movs r2, #0 - movs r1, #0xf0 - lsls r1, r1, #5 - strh r1, [r4, #0xc] - strh r2, [r4, #0x10] - ldr r2, _08147D84 @ =gUnk_0838725C - ldrh r1, [r2, #0x14] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0x16] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _08147D88 @ =sub_08147FC0 - str r0, [r4, #0x1c] - b _08147E06 - .align 2, 0 -_08147D7C: .4byte gUnk_08387348 -_08147D80: .4byte 0x00001DFF -_08147D84: .4byte gUnk_0838725C -_08147D88: .4byte sub_08147FC0 -_08147D8C: - ldrb r0, [r6, #4] - adds r0, #1 - strb r0, [r6, #4] - movs r7, #0xff - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - ldrb r6, [r6, #5] - cmp r0, r6 - blo _08147DCC - movs r0, #3 - ldrsb r0, [r4, r0] - lsls r1, r0, #2 - adds r1, r1, r0 - lsls r1, r1, #3 - adds r1, #0x48 - ldr r0, [r4, #0x20] - adds r0, r0, r1 - ldr r2, _08147DC4 @ =gUnk_0838725C - ldrh r1, [r2, #0xc] - strh r1, [r0, #0xc] - ldrh r1, [r2, #0xe] - strb r1, [r0, #0x1a] - bl sub_08155128 - ldr r0, _08147DC8 @ =sub_08147E10 - str r0, [r4, #0x1c] - b _08147E06 - .align 2, 0 -_08147DC4: .4byte gUnk_0838725C -_08147DC8: .4byte sub_08147E10 -_08147DCC: - ldr r6, [r4, #0x20] - ldrb r5, [r4, #3] - lsls r0, r5, #2 - adds r0, r0, r5 - lsls r0, r0, #3 - adds r0, #0x48 - adds r4, r6, r0 - ldr r1, _08147E0C @ =0x000005CC - adds r0, r6, r1 - adds r0, r0, r5 - ldrb r0, [r0] - cmp r0, #1 - beq _08147E06 - ldr r0, [r4] - cmp r0, #0 - beq _08147DFC - adds r0, r4, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147DFC - ldrb r0, [r4, #0x1b] - orrs r0, r7 - strb r0, [r4, #0x1b] -_08147DFC: - ldr r3, _08147E0C @ =0x000005CC - adds r0, r6, r3 - adds r0, r0, r5 - movs r1, #1 - strb r1, [r0] -_08147E06: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_08147E0C: .4byte 0x000005CC - - thumb_func_start sub_08147E10 -sub_08147E10: @ 0x08147E10 - push {r4, r5, r6, lr} - adds r4, r0, #0 - movs r1, #3 - ldrsb r1, [r4, r1] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #3 - adds r0, #0x48 - ldr r1, [r4, #0x20] - adds r6, r1, r0 - ldrh r1, [r4, #0x10] - adds r1, #9 - strh r1, [r4, #0x10] - ldrh r0, [r4, #0xe] - ldrh r3, [r4, #0xa] - adds r2, r0, r3 - strh r2, [r4, #0xa] - ldrh r0, [r4, #0xc] - adds r0, r0, r1 - strh r0, [r4, #0xc] - ldrb r0, [r4] - cmp r0, #0 - beq _08147E78 - lsls r1, r2, #0x10 - asrs r1, r1, #0x16 - ldr r2, _08147EA0 @ =gUnk_08387348 - lsls r0, r0, #4 - adds r0, r0, r2 - ldrb r0, [r0, #2] - lsrs r0, r0, #1 - adds r1, r1, r0 - cmp r1, #0 - bgt _08147E78 - adds r0, r4, #0 - bl sub_08146B68 - adds r0, r4, #0 - bl sub_08146BEC - adds r5, r0, #0 - cmp r5, #0 - beq _08147E78 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_081497B4 - cmp r0, #0 - beq _08147E78 - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08149814 -_08147E78: - movs r0, #0xc - ldrsh r1, [r4, r0] - ldr r0, _08147EA4 @ =0x00001DFF - cmp r1, r0 - ble _08147EB0 - movs r1, #0 - adds r0, #1 - strh r0, [r4, #0xc] - strh r1, [r4, #0x10] - ldr r1, _08147EA8 @ =gUnk_0838725C - ldrh r0, [r1, #0x14] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0x16] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _08147EAC @ =sub_08147FC0 - b _08147ECC - .align 2, 0 -_08147EA0: .4byte gUnk_08387348 -_08147EA4: .4byte 0x00001DFF -_08147EA8: .4byte gUnk_0838725C -_08147EAC: .4byte sub_08147FC0 -_08147EB0: - adds r0, r6, #0 - bl sub_08155128 - cmp r0, #0 - bne _08147ECE - ldr r1, _08147ED4 @ =gUnk_0838725C - ldrh r0, [r1, #0x10] - strh r0, [r6, #0xc] - ldrh r0, [r1, #0x12] - strb r0, [r6, #0x1a] - adds r0, r6, #0 - bl sub_08155128 - ldr r0, _08147ED8 @ =sub_08147EDC -_08147ECC: - str r0, [r4, #0x1c] -_08147ECE: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_08147ED4: .4byte gUnk_0838725C -_08147ED8: .4byte sub_08147EDC - thumb_func_start sub_08147EDC sub_08147EDC: @ 0x08147EDC push {r4, r5, r6, lr} diff --git a/include/intro.h b/include/intro.h index 2a91a4d..57f4968 100644 --- a/include/intro.h +++ b/include/intro.h @@ -41,7 +41,7 @@ struct Unk_08145B64_5EC { struct Unk_08145B64_5EC *unk18; void (*unk1C)(struct Unk_08145B64_5EC *); struct Unk_08145B64 *unk20; - union Unk_08145B64_5EC_24 { + union Unk_08145B64_5EC_24 { // TODO: I'm confused s16 pat1[6]; struct Unk_08145B64_5EC_24_Pat2 { u8 unk0; @@ -54,6 +54,16 @@ struct Unk_08145B64_5EC { u8 unk9; u8 unkA; } pat2; + struct Unk_08145B64_5EC_24_Pat3 { + u16 unk0; + u16 unk2; + u8 unk4; + u8 unk5; + u16 unk6; + u16 unk8; + u8 unkA; + u8 unkB; + } pat3; } unk24; u32 filler30; }; /* size = 0x34 */ diff --git a/src/intro.c b/src/intro.c index 12dc19b..3a92dad 100644 --- a/src/intro.c +++ b/src/intro.c @@ -22,6 +22,19 @@ void sub_08146FB0(struct Unk_08145B64_5EC *); void sub_08147014(struct Unk_08145B64_5EC *); void sub_081470EC(struct Unk_08145B64_5EC *); void sub_08147154(struct Unk_08145B64_5EC *); +void sub_081473E0(struct Unk_08145B64_5EC *); +void sub_081474C4(struct Unk_08145B64_5EC *); +void sub_08147580(struct Unk_08145B64_5EC *); +void sub_081476A8(struct Unk_08145B64_5EC *); +void sub_08147774(struct Unk_08145B64_5EC *); +void sub_08147858(struct Unk_08145B64_5EC *); +void sub_081479E8(struct Unk_08145B64_5EC *); +void sub_08147A98(struct Unk_08145B64_5EC *); +void sub_08147B7C(struct Unk_08145B64_5EC *); +void sub_08147CE8(struct Unk_08145B64_5EC *); +void sub_08147E10(struct Unk_08145B64_5EC *); +void sub_08147EDC(struct Unk_08145B64_5EC *); +void sub_08147FC0(struct Unk_08145B64_5EC *); bool32 sub_08148CD8(struct Unk_08145B64 *); void sub_081494E4(struct Unk_08145B64 *); void sub_08149628(struct Unk_08145B64 *); @@ -40,6 +53,10 @@ void sub_081498B4(struct Unk_08145B64_5EC *); void sub_08149910(struct Unk_08145B64_5EC *); extern const u16 gUnk_08387208[][2]; +extern const u16 gUnk_08387220[][2]; +extern const u16 gUnk_08387230[][2]; +extern const u16 gUnk_08387248[][2]; +extern const u16 gUnk_0838725C[][2]; extern const struct Unk_08387348 gUnk_08387348[]; extern const u8 gUnk_083877A8[][8]; extern const u16 gUnk_083877D2[2]; @@ -771,3 +788,491 @@ void sub_081471E8(struct Unk_08145B64_5EC *a1) { v5->unk5CC[unk3] = 1; } } + +void sub_081472DC(struct Unk_08145B64_5EC *a1) { + struct Sprite *sprite; + struct Unk_08145B64 *v5; + u8 unk3; + + a1->unkE += 3; + if (a1->unkE >= 0) { + struct Sprite *sprite; + + a1->unkE = a1->unk24.pat1[0]; + if (Rand32() % 3) + a1->unk10 = -0x32; + else + a1->unk10 = -0x64; + sprite = &a1->unk20->unk48[a1->unk3]; + sprite->animId = gUnk_08387220[1][0]; + sprite->variant = gUnk_08387220[1][1]; + sub_08155128(sprite); + a1->unk1C = sub_081473E0; + } else { + a1->unkA += a1->unkE; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + v5 = a1->unk20; + unk3 = a1->unk3; + sprite = &v5->unk48[unk3]; + if (v5->unk5CC[unk3] != 1) { + if (sprite->tilesVram && !sub_08155128(&v5->unk48[unk3])) + sprite->unk1B = 0xFF; + v5->unk5CC[unk3] = 1; + } + } +} + +void sub_081473E0(struct Unk_08145B64_5EC *a1) { + struct Sprite *sprite; + struct Unk_08145B64 *v5; + u8 unk3; + + a1->unk10 += 9; + a1->unkA += a1->unkE; + a1->unkC += a1->unk10; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (a1->unkC >= 0x1E00) { + struct Sprite *sprite; + + a1->unkC = 0x1E00; + a1->unk10 = 0; + sprite = &a1->unk20->unk48[a1->unk3]; + sprite->animId = gUnk_08387220[0][0]; + sprite->variant = gUnk_08387220[0][1]; + sub_08155128(sprite); + a1->unk1C = sub_081472DC; + } else { + v5 = a1->unk20; + unk3 = a1->unk3; + sprite = &v5->unk48[unk3]; + if (v5->unk5CC[unk3] != 1) { + if (sprite->tilesVram && !sub_08155128(&v5->unk48[unk3])) + sprite->unk1B = 0xFF; + v5->unk5CC[unk3] = 1; + } + } +} + +void sub_081474C4(struct Unk_08145B64_5EC *a1) { + union Unk_08145B64_5EC_24 *unk24 = &a1->unk24; + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + if (a1->unkE < 0) { + a1->unkE += 3; + if (a1->unkE > 0) + a1->unkE = 0; + } + a1->unkA += a1->unkE; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (!sub_08155128(sprite)) { + a1->unkE = unk24->pat3.unk0; + a1->unk10 = unk24->pat3.unk2; + sprite->animId = gUnk_08387230[2][0]; + sprite->variant = gUnk_08387230[2][1]; + sub_08155128(sprite); + m4aSongNumStart(604); + unk24->pat3.unk4 = 0; + a1->unk1C = sub_08147580; + } +} + +void sub_08147580(struct Unk_08145B64_5EC *a1) { + union Unk_08145B64_5EC_24 *unk24 = &a1->unk24; + + a1->unk10 += 9; + a1->unkA += a1->unkE; + a1->unkC += a1->unk10; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (a1->unkC >= 0x1E00) { + struct Sprite *sprite; + + sprite = &a1->unk20->unk48[a1->unk3]; + a1->unkC = 0x1E00; + a1->unk10 = 0; + sprite->animId = gUnk_08387230[5][0]; + sprite->variant = gUnk_08387230[5][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147858; + } else if (++unk24->pat3.unk4 >= unk24->pat3.unk5) { + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + sprite->animId = gUnk_08387230[3][0]; + sprite->variant = gUnk_08387230[3][1]; + sub_08155128(sprite); + a1->unk1C = sub_081476A8; + } else { + struct Unk_08145B64 *v5 = a1->unk20; + u8 unk3 = a1->unk3; + struct Sprite *sprite = &v5->unk48[unk3]; + + if (v5->unk5CC[unk3] != 1) { + if (sprite->tilesVram && !sub_08155128(&v5->unk48[unk3])) + sprite->unk1B = 0xFF; + v5->unk5CC[unk3] = 1; + } + } +} + +void sub_081476A8(struct Unk_08145B64_5EC *a1) { + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + a1->unk10 += 9; + a1->unkA += a1->unkE; + a1->unkC += a1->unk10; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (a1->unkC >= 0x1E00) { + a1->unkC = 0x1E00; + a1->unk10 = 0; + sprite->animId = gUnk_08387230[5][0]; + sprite->variant = gUnk_08387230[5][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147858; + } else if (!sub_08155128(sprite)) { + sprite->animId = gUnk_08387230[4][0]; + sprite->variant = gUnk_08387230[4][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147774; + } +} + +void sub_08147774(struct Unk_08145B64_5EC *a1) { + struct Sprite *sprite; + struct Unk_08145B64 *v5; + u8 unk3; + + a1->unk10 += 9; + a1->unkA += a1->unkE; + a1->unkC += a1->unk10; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (a1->unkC >= 0x1E00) { + struct Sprite *sprite; + + sprite = &a1->unk20->unk48[a1->unk3]; + a1->unkC = 0x1E00; + a1->unk10 = 0; + sprite->animId = gUnk_08387230[5][0]; + sprite->variant = gUnk_08387230[5][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147858; + } else { + v5 = a1->unk20; + unk3 = a1->unk3; + sprite = &v5->unk48[unk3]; + if (v5->unk5CC[unk3] != 1) { + if (sprite->tilesVram && !sub_08155128(&v5->unk48[unk3])) + sprite->unk1B = 0xFF; + v5->unk5CC[unk3] = 1; + } + } +} + +void sub_08147858(struct Unk_08145B64_5EC *a1) { + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + if (a1->unkE < 0) { + a1->unkE += 3; + if (a1->unkE > 0) + a1->unkE = 0; + } + a1->unkA += a1->unkE; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (!sub_08155128(sprite)) { + sprite->animId = gUnk_08387230[1][0]; + sprite->variant = gUnk_08387230[1][1]; + sub_08155128(sprite); + a1->unk1C = sub_081474C4; + } +} + +void sub_081478FC(struct Unk_08145B64_5EC *a1) { + union Unk_08145B64_5EC_24 *unk24 = &a1->unk24; + + a1->unkA += a1->unkE; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (++unk24->pat3.unk6 >= unk24->pat3.unk8 + && (unk24->pat3.unk6 = 0, unk24->pat3.unkB != 0) + && unk24->pat3.unkA++ < unk24->pat3.unkB) { + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + sprite->animId = gUnk_08387248[2][0]; + sprite->variant = gUnk_08387248[2][1]; + sub_08155128(sprite); + a1->unk1C = sub_081479E8; + } else { + struct Unk_08145B64 *v5 = a1->unk20; + u8 unk3 = a1->unk3; + struct Sprite *sprite = &v5->unk48[unk3]; + + if (v5->unk5CC[unk3] != 1) { + if (sprite->tilesVram && !sub_08155128(&v5->unk48[unk3])) + sprite->unk1B = 0xFF; + v5->unk5CC[unk3] = 1; + } + } +} + +void sub_081479E8(struct Unk_08145B64_5EC *a1) { + union Unk_08145B64_5EC_24 *unk24 = &a1->unk24; + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + if (a1->unkE < 0) { + a1->unkE += 3; + if (a1->unkE > 0) + a1->unkE = 0; + } + a1->unkA += a1->unkE; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (!sub_08155128(sprite)) { + a1->unkE = unk24->pat3.unk0; + a1->unk10 = unk24->pat3.unk2; + sprite->animId = gUnk_08387248[3][0]; + sprite->variant = gUnk_08387248[3][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147A98; + } +} + +void sub_08147A98(struct Unk_08145B64_5EC *a1) { + struct Sprite *sprite; + struct Unk_08145B64 *v5; + u8 unk3; + + a1->unk10 += 9; + a1->unkA += a1->unkE; + a1->unkC += a1->unk10; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (a1->unkC >= 0x1E00) { + struct Sprite *sprite; + + sprite = &a1->unk20->unk48[a1->unk3]; + a1->unkC = 0x1E00; + a1->unk10 = 0; + sprite->animId = gUnk_08387248[4][0]; + sprite->variant = gUnk_08387248[4][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147B7C; + } else { + v5 = a1->unk20; + unk3 = a1->unk3; + sprite = &v5->unk48[unk3]; + if (v5->unk5CC[unk3] != 1) { + if (sprite->tilesVram && !sub_08155128(&v5->unk48[unk3])) + sprite->unk1B = 0xFF; + v5->unk5CC[unk3] = 1; + } + } +} + +void sub_08147B7C(struct Unk_08145B64_5EC *a1) { + union Unk_08145B64_5EC_24 *unk24 = &a1->unk24; + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + if (a1->unkE < 0) { + a1->unkE += 3; + if (a1->unkE > 0) + a1->unkE = 0; + } + a1->unkA += a1->unkE; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (!sub_08155128(sprite)) { + a1->unkE = unk24->pat3.unk0; + sprite->animId = gUnk_08387248[1][0]; + sprite->variant = gUnk_08387248[1][1]; + sub_08155128(sprite); + a1->unk1C = sub_081478FC; + } +} + +void sub_08147C28(struct Unk_08145B64_5EC *a1) { + union Unk_08145B64_5EC_24 *unk24 = &a1->unk24; + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + if (a1->unkE < 0) { + a1->unkE += 3; + if (a1->unkE > 0) + a1->unkE = 0; + } + a1->unkA += a1->unkE; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (!sub_08155128(sprite)) { + a1->unkE = unk24->pat3.unk0; + a1->unk10 = unk24->pat3.unk2; + sprite->animId = gUnk_0838725C[2][0]; + sprite->variant = gUnk_0838725C[2][1]; + sub_08155128(sprite); + m4aSongNumStart(605); + unk24->pat3.unk4 = 0; + a1->unk1C = sub_08147CE8; + } +} + +void sub_08147CE8(struct Unk_08145B64_5EC *a1) { + union Unk_08145B64_5EC_24 *unk24 = &a1->unk24; + + a1->unk10 += 9; + a1->unkA += a1->unkE; + a1->unkC += a1->unk10; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (a1->unkC >= 0x1E00) { + struct Sprite *sprite; + + sprite = &a1->unk20->unk48[a1->unk3]; + a1->unkC = 0x1E00; + a1->unk10 = 0; + sprite->animId = gUnk_0838725C[5][0]; + sprite->variant = gUnk_0838725C[5][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147FC0; + } else if (++unk24->pat3.unk4 >= unk24->pat3.unk5) { + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + sprite->animId = gUnk_0838725C[3][0]; + sprite->variant = gUnk_0838725C[3][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147E10; + } else { + struct Unk_08145B64 *v5 = a1->unk20; + u8 unk3 = a1->unk3; + struct Sprite *sprite = &v5->unk48[unk3]; + + if (v5->unk5CC[unk3] != 1) { + if (sprite->tilesVram && !sub_08155128(&v5->unk48[unk3])) + sprite->unk1B = 0xFF; + v5->unk5CC[unk3] = 1; + } + } +} + +void sub_08147E10(struct Unk_08145B64_5EC *a1) { + struct Sprite *sprite = &a1->unk20->unk48[a1->unk3]; + + a1->unk10 += 9; + a1->unkA += a1->unkE; + a1->unkC += a1->unk10; + if (a1->unk0 + && (a1->unkA >> 6) + (gUnk_08387348[a1->unk0].unk2 >> 1) <= 0) { + struct Sprite *sprite; + + sub_08146B68(a1); + sprite = sub_08146BEC(a1); + if (sprite && sub_081497B4(a1, sprite)) + sub_08149814(a1, sprite); + } + if (a1->unkC >= 0x1E00) { + a1->unkC = 0x1E00; + a1->unk10 = 0; + sprite->animId = gUnk_0838725C[5][0]; + sprite->variant = gUnk_0838725C[5][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147FC0; + } else if (!sub_08155128(sprite)) { + sprite->animId = gUnk_0838725C[4][0]; + sprite->variant = gUnk_0838725C[4][1]; + sub_08155128(sprite); + a1->unk1C = sub_08147EDC; + } +}