From b925954515a0e86462d21b12865b3f2c2dbd0415 Mon Sep 17 00:00:00 2001 From: Zhengwen Jiang Date: Fri, 12 May 2023 02:20:37 -0500 Subject: [PATCH] more code_08128D48 --- asm/code_08032E98.s | 4 +- asm/code_08128BEC.s | 1596 +-------------------------------------- include/code_08128D48.h | 121 +++ include/pause_fade.h | 68 -- linker.ld | 3 +- src/code_08128D48.c | 651 ++++++++++++++++ src/pause_fade.c | 343 +-------- 7 files changed, 781 insertions(+), 2005 deletions(-) create mode 100644 include/code_08128D48.h create mode 100644 src/code_08128D48.c diff --git a/asm/code_08032E98.s b/asm/code_08032E98.s index f5ed57a..0c81e06 100644 --- a/asm/code_08032E98.s +++ b/asm/code_08032E98.s @@ -13419,7 +13419,7 @@ sub_08039504: @ 0x08039504 movs r0, #0xd4 lsls r0, r0, #1 mov ip, r0 - ldr r7, _08039580 @ =gUnk_020382D8 + ldr r7, _08039580 @ =gUnk_020382D0 + 8 ldr r6, _08039584 @ =gKirbys movs r5, #0x8c lsls r5, r5, #1 @@ -13449,7 +13449,7 @@ _08039570: .4byte 0xFFFFFBFF _08039574: .4byte gUnk_0203AD10 _08039578: .4byte gUnk_0203AD30 _0803957C: .4byte sub_08039F74 -_08039580: .4byte gUnk_020382D8 +_08039580: .4byte gUnk_020382D0 + 8 _08039584: .4byte gKirbys _08039588: ldr r2, _080395B4 @ =gKirbys diff --git a/asm/code_08128BEC.s b/asm/code_08128BEC.s index 060cfff..8eba4c4 100644 --- a/asm/code_08128BEC.s +++ b/asm/code_08128BEC.s @@ -5,1598 +5,6 @@ .text - thumb_func_start sub_081295A0 -sub_081295A0: @ 0x081295A0 - push {r4, r5, r6, lr} - ldr r0, _081295BC @ =gCurTask - ldr r2, [r0] - ldrh r1, [r2, #0x12] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _081295C0 - ldrh r0, [r2, #6] - lsls r0, r0, #2 - movs r1, #0x80 - lsls r1, r1, #0x12 - adds r0, r0, r1 - b _081295C8 - .align 2, 0 -_081295BC: .4byte gCurTask -_081295C0: - ldrh r1, [r2, #6] - movs r0, #0xc0 - lsls r0, r0, #0x12 - adds r0, r1, r0 -_081295C8: - adds r4, r0, #0 - movs r1, #0xab - lsls r1, r1, #2 - adds r0, r4, r1 - ldrb r1, [r0] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _081295DE - movs r2, #0 - b _081295FC -_081295DE: - ldr r0, _081295F0 @ =gUnk_0203AD10 - ldr r0, [r0] - movs r1, #2 - ands r0, r1 - cmp r0, #0 - beq _081295F8 - ldr r0, _081295F4 @ =gUnk_020382D0 - ldrh r2, [r0, #0x10] - b _081295FC - .align 2, 0 -_081295F0: .4byte gUnk_0203AD10 -_081295F4: .4byte gUnk_020382D0 -_081295F8: - ldr r0, _0812962C @ =gPressedKeys - ldrh r2, [r0] -_081295FC: - movs r0, #0xab - lsls r0, r0, #2 - adds r5, r4, r0 - ldrb r1, [r5] - movs r0, #4 - ands r0, r1 - cmp r0, #0 - beq _081296CC - movs r0, #1 - ands r0, r2 - cmp r0, #0 - beq _08129634 - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08129622 - ldr r0, _08129630 @ =0x0000021E - bl m4aSongNumStart -_08129622: - ldrb r1, [r5] - movs r0, #1 - orrs r0, r1 - strb r0, [r5] - b _08129796 - .align 2, 0 -_0812962C: .4byte gPressedKeys -_08129630: .4byte 0x0000021E -_08129634: - movs r0, #2 - ands r0, r2 - lsls r0, r0, #0x10 - lsrs r6, r0, #0x10 - cmp r6, #0 - beq _08129660 - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _0812964E - ldr r0, _0812965C @ =0x0000021F - bl m4aSongNumStart -_0812964E: - ldrb r0, [r5] - movs r1, #0xfb - ands r1, r0 - movs r0, #0xbf - ands r1, r0 - strb r1, [r5] - b _08129796 - .align 2, 0 -_0812965C: .4byte 0x0000021F -_08129660: - movs r0, #0x40 - ands r0, r2 - lsls r0, r0, #0x10 - lsrs r5, r0, #0x10 - cmp r5, #0 - beq _08129698 - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _0812967A - ldr r0, _08129688 @ =0x0000021D - bl m4aSongNumStart -_0812967A: - ldr r1, _0812968C @ =0x000002AE - adds r0, r4, r1 - strh r6, [r0] - ldr r0, _08129690 @ =gCurTask - ldr r1, [r0] - ldr r0, _08129694 @ =sub_08129F28 - b _08129794 - .align 2, 0 -_08129688: .4byte 0x0000021D -_0812968C: .4byte 0x000002AE -_08129690: .4byte gCurTask -_08129694: .4byte sub_08129F28 -_08129698: - movs r0, #0x80 - ands r2, r0 - cmp r2, #0 - bne _081296A2 - b _08129796 -_081296A2: - ands r0, r1 - cmp r0, #0 - bne _081296AE - ldr r0, _081296BC @ =0x0000021D - bl m4aSongNumStart -_081296AE: - ldr r1, _081296C0 @ =0x000002AE - adds r0, r4, r1 - strh r5, [r0] - ldr r0, _081296C4 @ =gCurTask - ldr r1, [r0] - ldr r0, _081296C8 @ =sub_08129C34 - b _08129794 - .align 2, 0 -_081296BC: .4byte 0x0000021D -_081296C0: .4byte 0x000002AE -_081296C4: .4byte gCurTask -_081296C8: .4byte sub_08129C34 -_081296CC: - movs r5, #1 - ands r5, r2 - cmp r5, #0 - beq _0812973C - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08129718 - ldr r0, _081296F4 @ =0x0000021E - bl m4aSongNumStart - ldr r1, _081296F8 @ =0x000002AD - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, #0 - bne _08129700 - ldr r0, _081296FC @ =0x000002B2 - adds r1, r4, r0 - movs r0, #1 - b _08129716 - .align 2, 0 -_081296F4: .4byte 0x0000021E -_081296F8: .4byte 0x000002AD -_081296FC: .4byte 0x000002B2 -_08129700: - cmp r0, #1 - bne _08129710 - ldr r0, _0812970C @ =0x000002B2 - adds r1, r4, r0 - movs r0, #3 - b _08129716 - .align 2, 0 -_0812970C: .4byte 0x000002B2 -_08129710: - ldr r0, _08129730 @ =0x000002B2 - adds r1, r4, r0 - movs r0, #5 -_08129716: - strb r0, [r1] -_08129718: - movs r1, #0xab - lsls r1, r1, #2 - adds r2, r4, r1 - ldrb r1, [r2] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129734 - movs r0, #4 - orrs r0, r1 - movs r1, #0x40 - b _08129736 - .align 2, 0 -_08129730: .4byte 0x000002B2 -_08129734: - movs r0, #1 -_08129736: - orrs r0, r1 - strb r0, [r2] - b _08129796 -_0812973C: - movs r0, #0x40 - ands r0, r2 - lsls r0, r0, #0x10 - lsrs r6, r0, #0x10 - cmp r6, #0 - beq _08129774 - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08129756 - ldr r0, _08129764 @ =0x0000021D - bl m4aSongNumStart -_08129756: - ldr r1, _08129768 @ =0x000002AE - adds r0, r4, r1 - strh r5, [r0] - ldr r0, _0812976C @ =gCurTask - ldr r1, [r0] - ldr r0, _08129770 @ =sub_081298B4 - b _08129794 - .align 2, 0 -_08129764: .4byte 0x0000021D -_08129768: .4byte 0x000002AE -_0812976C: .4byte gCurTask -_08129770: .4byte sub_081298B4 -_08129774: - movs r0, #0x80 - ands r2, r0 - cmp r2, #0 - beq _08129796 - ands r0, r1 - cmp r0, #0 - bne _08129788 - ldr r0, _081297D4 @ =0x0000021D - bl m4aSongNumStart -_08129788: - ldr r1, _081297D8 @ =0x000002AE - adds r0, r4, r1 - strh r6, [r0] - ldr r0, _081297DC @ =gCurTask - ldr r1, [r0] - ldr r0, _081297E0 @ =sub_08129A6C -_08129794: - str r0, [r1, #8] -_08129796: - adds r0, r4, #0 - bl sub_081297F8 - movs r1, #0xab - lsls r1, r1, #2 - adds r0, r4, r1 - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _081297F2 - movs r0, #4 - ands r0, r1 - cmp r0, #0 - beq _081297E4 - movs r1, #0x8a - lsls r1, r1, #1 - adds r0, r4, r1 - bl sub_081288DC - movs r1, #0xac - lsls r1, r1, #1 - adds r0, r4, r1 - bl sub_081288DC - movs r1, #0xce - lsls r1, r1, #1 - adds r0, r4, r1 - bl sub_081288DC - b _081297F2 - .align 2, 0 -_081297D4: .4byte 0x0000021D -_081297D8: .4byte 0x000002AE -_081297DC: .4byte gCurTask -_081297E0: .4byte sub_08129A6C -_081297E4: - adds r0, r4, #4 - bl sub_081288DC - adds r0, r4, #0 - adds r0, #0x8c - bl sub_081288DC -_081297F2: - pop {r4, r5, r6} - pop {r0} - bx r0 - - thumb_func_start sub_081297F8 -sub_081297F8: @ 0x081297F8 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldr r0, _0812982C @ =0x000002B3 - adds r2, r4, r0 - ldrb r0, [r2] - adds r1, r0, #1 - strb r1, [r2] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #5 - bls _081298A0 - movs r0, #0 - strb r0, [r2] - movs r1, #0xab - lsls r1, r1, #2 - adds r0, r4, r1 - ldrb r1, [r0] - movs r0, #2 - ands r0, r1 - cmp r0, #0 - beq _08129834 - ldr r1, _08129830 @ =0x000002B2 - adds r0, r4, r1 - ldrb r0, [r0] - b _0812983C - .align 2, 0 -_0812982C: .4byte 0x000002B3 -_08129830: .4byte 0x000002B2 -_08129834: - ldr r1, _08129874 @ =0x000002B2 - adds r0, r4, r1 - ldrb r0, [r0] - adds r0, #1 -_0812983C: - lsls r0, r0, #5 - ldr r1, _08129878 @ =gUnk_082DE69C - adds r5, r0, r1 - movs r0, #0xab - lsls r0, r0, #2 - adds r2, r4, r0 - ldrb r0, [r2] - movs r1, #2 - eors r0, r1 - strb r0, [r2] - ldr r6, _0812987C @ =gUnk_03002440 - ldr r3, [r6] - movs r0, #0x80 - lsls r0, r0, #0xa - ands r0, r3 - cmp r0, #0 - beq _08129880 - movs r1, #0xac - lsls r1, r1, #2 - adds r0, r4, r1 - ldrb r1, [r0] - lsls r1, r1, #0x1c - lsrs r1, r1, #0x18 - adds r0, r5, #0 - movs r2, #0x10 - bl sub_0815828C - b _081298A0 - .align 2, 0 -_08129874: .4byte 0x000002B2 -_08129878: .4byte gUnk_082DE69C -_0812987C: .4byte gUnk_03002440 -_08129880: - ldr r2, _081298A8 @ =0x040000D4 - str r5, [r2] - movs r1, #0xac - lsls r1, r1, #2 - adds r0, r4, r1 - ldrb r0, [r0] - lsls r0, r0, #5 - ldr r1, _081298AC @ =gObjPalette - adds r0, r0, r1 - str r0, [r2, #4] - ldr r0, _081298B0 @ =0x80000010 - str r0, [r2, #8] - ldr r0, [r2, #8] - movs r0, #2 - orrs r3, r0 - str r3, [r6] -_081298A0: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_081298A8: .4byte 0x040000D4 -_081298AC: .4byte gObjPalette -_081298B0: .4byte 0x80000010 - - thumb_func_start sub_081298B4 -sub_081298B4: @ 0x081298B4 - push {r4, r5, r6, lr} - ldr r0, _081298D0 @ =gCurTask - ldr r2, [r0] - ldrh r1, [r2, #0x12] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _081298D4 - ldrh r0, [r2, #6] - lsls r0, r0, #2 - movs r1, #0x80 - lsls r1, r1, #0x12 - adds r0, r0, r1 - b _081298DC - .align 2, 0 -_081298D0: .4byte gCurTask -_081298D4: - ldrh r1, [r2, #6] - movs r0, #0xc0 - lsls r0, r0, #0x12 - adds r0, r1, r0 -_081298DC: - adds r6, r0, #0 - movs r1, #0xab - lsls r1, r1, #2 - adds r0, r6, r1 - ldrb r1, [r0] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129960 - ldr r0, [r6, #0x2c] - adds r0, #8 - str r0, [r6, #0x2c] - ldr r0, [r6, #0x30] - adds r0, #4 - str r0, [r6, #0x30] - ldrh r1, [r6, #0x18] - ldr r2, _08129958 @ =0x0000F83F - adds r0, r2, #0 - ands r0, r1 - movs r1, #0xb0 - lsls r1, r1, #2 - adds r5, r1, #0 - orrs r0, r5 - strh r0, [r6, #0x18] - ldr r0, _0812995C @ =0x000002B1 - adds r4, r6, r0 - ldrb r0, [r4] - adds r1, r6, #0 - adds r1, #0x23 - strb r0, [r1] - adds r3, r6, #0 - adds r3, #0x5c - ldrh r1, [r3] - adds r0, r2, #0 - ands r0, r1 - orrs r0, r5 - strh r0, [r3] - ldrb r0, [r4] - adds r1, r6, #0 - adds r1, #0x67 - strb r0, [r1] - adds r1, #0x4d - ldr r0, [r1] - subs r0, #8 - str r0, [r1] - adds r1, #4 - ldr r0, [r1] - subs r0, #4 - str r0, [r1] - adds r3, #0x44 - ldrh r1, [r3] - adds r0, r2, #0 - ands r0, r1 - movs r1, #0xa0 - lsls r1, r1, #2 - adds r4, r1, #0 - orrs r0, r4 - strh r0, [r3] - movs r0, #0xac - lsls r0, r0, #2 - b _081299C6 - .align 2, 0 -_08129958: .4byte 0x0000F83F -_0812995C: .4byte 0x000002B1 -_08129960: - ldr r0, [r6, #0x2c] - subs r0, #8 - str r0, [r6, #0x2c] - ldr r0, [r6, #0x30] - subs r0, #4 - str r0, [r6, #0x30] - ldrh r1, [r6, #0x18] - ldr r2, _081299F8 @ =0x0000F83F - adds r0, r2, #0 - ands r0, r1 - movs r1, #0xa0 - lsls r1, r1, #2 - adds r5, r1, #0 - orrs r0, r5 - strh r0, [r6, #0x18] - movs r0, #0xac - lsls r0, r0, #2 - adds r4, r6, r0 - ldrb r0, [r4] - adds r1, r6, #0 - adds r1, #0x23 - strb r0, [r1] - adds r3, r6, #0 - adds r3, #0x5c - ldrh r1, [r3] - adds r0, r2, #0 - ands r0, r1 - orrs r0, r5 - strh r0, [r3] - ldrb r0, [r4] - adds r1, r6, #0 - adds r1, #0x67 - strb r0, [r1] - adds r1, #0x4d - ldr r0, [r1] - adds r0, #8 - str r0, [r1] - adds r1, #4 - ldr r0, [r1] - adds r0, #4 - str r0, [r1] - adds r3, #0x44 - ldrh r1, [r3] - adds r0, r2, #0 - ands r0, r1 - movs r1, #0xb0 - lsls r1, r1, #2 - adds r4, r1, #0 - orrs r0, r4 - strh r0, [r3] - ldr r0, _081299FC @ =0x000002B1 -_081299C6: - adds r3, r6, r0 - ldrb r0, [r3] - adds r1, r6, #0 - adds r1, #0xab - strb r0, [r1] - adds r1, #0x39 - ldrh r0, [r1] - ands r2, r0 - orrs r2, r4 - strh r2, [r1] - ldrb r0, [r3] - adds r1, #0xb - strb r0, [r1] - movs r1, #0xab - lsls r1, r1, #2 - adds r0, r6, r1 - ldrb r1, [r0] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129A04 - ldr r0, _08129A00 @ =0x000002B2 - adds r1, r6, r0 - movs r0, #1 - b _08129A0A - .align 2, 0 -_081299F8: .4byte 0x0000F83F -_081299FC: .4byte 0x000002B1 -_08129A00: .4byte 0x000002B2 -_08129A04: - ldr r0, _08129A5C @ =0x000002B2 - adds r1, r6, r0 - movs r0, #3 -_08129A0A: - strb r0, [r1] - adds r0, r6, #0 - bl sub_081297F8 - movs r1, #0xab - lsls r1, r1, #2 - adds r4, r6, r1 - ldrb r1, [r4] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08129A30 - adds r0, r6, #4 - bl sub_081288DC - adds r0, r6, #0 - adds r0, #0x8c - bl sub_081288DC -_08129A30: - ldr r0, _08129A60 @ =0x000002AE - adds r1, r6, r0 - ldrh r0, [r1] - adds r0, #1 - strh r0, [r1] - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - cmp r0, #9 - bls _08129A56 - ldr r0, _08129A64 @ =gCurTask - ldr r1, [r0] - ldr r0, _08129A68 @ =sub_081295A0 - str r0, [r1, #8] - ldrb r0, [r4] - movs r1, #0x10 - eors r0, r1 - movs r1, #0x20 - eors r0, r1 - strb r0, [r4] -_08129A56: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_08129A5C: .4byte 0x000002B2 -_08129A60: .4byte 0x000002AE -_08129A64: .4byte gCurTask -_08129A68: .4byte sub_081295A0 - - thumb_func_start sub_08129A6C -sub_08129A6C: @ 0x08129A6C - push {r4, r5, lr} - ldr r0, _08129A88 @ =gCurTask - ldr r2, [r0] - ldrh r1, [r2, #0x12] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129A8C - ldrh r0, [r2, #6] - lsls r0, r0, #2 - movs r1, #0x80 - lsls r1, r1, #0x12 - adds r0, r0, r1 - b _08129A94 - .align 2, 0 -_08129A88: .4byte gCurTask -_08129A8C: - ldrh r1, [r2, #6] - movs r0, #0xc0 - lsls r0, r0, #0x12 - adds r0, r1, r0 -_08129A94: - adds r5, r0, #0 - movs r1, #0xab - lsls r1, r1, #2 - adds r0, r5, r1 - ldrb r1, [r0] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129AE0 - ldr r0, [r5, #0x2c] - adds r0, #8 - str r0, [r5, #0x2c] - ldr r0, [r5, #0x30] - adds r0, #4 - str r0, [r5, #0x30] - ldr r2, _08129ADC @ =0x000002B1 - adds r1, r5, r2 - ldrb r0, [r1] - adds r2, r5, #0 - adds r2, #0x23 - strb r0, [r2] - ldrb r0, [r1] - adds r1, r5, #0 - adds r1, #0x67 - strb r0, [r1] - adds r1, #0x4d - ldr r0, [r1] - subs r0, #8 - str r0, [r1] - adds r1, #4 - ldr r0, [r1] - subs r0, #4 - str r0, [r1] - movs r0, #0xac - lsls r0, r0, #2 - b _08129B14 - .align 2, 0 -_08129ADC: .4byte 0x000002B1 -_08129AE0: - ldr r0, [r5, #0x2c] - subs r0, #8 - str r0, [r5, #0x2c] - ldr r0, [r5, #0x30] - subs r0, #4 - str r0, [r5, #0x30] - movs r2, #0xac - lsls r2, r2, #2 - adds r1, r5, r2 - ldrb r0, [r1] - adds r2, r5, #0 - adds r2, #0x23 - strb r0, [r2] - ldrb r0, [r1] - adds r1, r5, #0 - adds r1, #0x67 - strb r0, [r1] - adds r1, #0x4d - ldr r0, [r1] - adds r0, #8 - str r0, [r1] - adds r1, #4 - ldr r0, [r1] - adds r0, #4 - str r0, [r1] - ldr r0, _08129B3C @ =0x000002B1 -_08129B14: - adds r1, r5, r0 - ldrb r0, [r1] - adds r2, #0x88 - strb r0, [r2] - ldrb r0, [r1] - adds r1, r5, #0 - adds r1, #0xef - strb r0, [r1] - movs r1, #0xab - lsls r1, r1, #2 - adds r0, r5, r1 - ldrb r1, [r0] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129B44 - ldr r2, _08129B40 @ =0x000002B2 - adds r1, r5, r2 - movs r0, #1 - b _08129B4A - .align 2, 0 -_08129B3C: .4byte 0x000002B1 -_08129B40: .4byte 0x000002B2 -_08129B44: - ldr r0, _08129BBC @ =0x000002B2 - adds r1, r5, r0 - movs r0, #3 -_08129B4A: - strb r0, [r1] - adds r0, r5, #0 - bl sub_081297F8 - movs r1, #0xab - lsls r1, r1, #2 - adds r4, r5, r1 - ldrb r1, [r4] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08129B70 - adds r0, r5, #4 - bl sub_081288DC - adds r0, r5, #0 - adds r0, #0x8c - bl sub_081288DC -_08129B70: - ldr r2, _08129BC0 @ =0x000002AE - adds r1, r5, r2 - ldrh r0, [r1] - adds r0, #1 - movs r2, #0 - strh r0, [r1] - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - cmp r0, #9 - bls _08129C20 - ldrb r1, [r4] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129BC8 - ldrh r2, [r5, #0x18] - ldr r1, _08129BC4 @ =0x0000F83F - adds r0, r1, #0 - ands r0, r2 - movs r2, #0xb0 - lsls r2, r2, #2 - adds r4, r2, #0 - orrs r0, r4 - strh r0, [r5, #0x18] - adds r3, r5, #0 - adds r3, #0x5c - ldrh r2, [r3] - adds r0, r1, #0 - ands r0, r2 - orrs r0, r4 - strh r0, [r3] - adds r3, #0x44 - ldrh r2, [r3] - adds r0, r1, #0 - ands r0, r2 - movs r2, #0xa0 - lsls r2, r2, #2 - b _08129BF4 - .align 2, 0 -_08129BBC: .4byte 0x000002B2 -_08129BC0: .4byte 0x000002AE -_08129BC4: .4byte 0x0000F83F -_08129BC8: - ldrh r2, [r5, #0x18] - ldr r1, _08129C28 @ =0x0000F83F - adds r0, r1, #0 - ands r0, r2 - movs r2, #0xa0 - lsls r2, r2, #2 - adds r4, r2, #0 - orrs r0, r4 - strh r0, [r5, #0x18] - adds r3, r5, #0 - adds r3, #0x5c - ldrh r2, [r3] - adds r0, r1, #0 - ands r0, r2 - orrs r0, r4 - strh r0, [r3] - adds r3, #0x44 - ldrh r2, [r3] - adds r0, r1, #0 - ands r0, r2 - movs r2, #0xb0 - lsls r2, r2, #2 -_08129BF4: - adds r4, r2, #0 - orrs r0, r4 - strh r0, [r3] - adds r2, r5, #0 - adds r2, #0xe4 - ldrh r0, [r2] - ands r1, r0 - orrs r1, r4 - strh r1, [r2] - ldr r0, _08129C2C @ =gCurTask - ldr r1, [r0] - ldr r0, _08129C30 @ =sub_081295A0 - str r0, [r1, #8] - movs r0, #0xab - lsls r0, r0, #2 - adds r2, r5, r0 - ldrb r0, [r2] - movs r1, #0x10 - eors r0, r1 - movs r1, #0x20 - eors r0, r1 - strb r0, [r2] -_08129C20: - pop {r4, r5} - pop {r0} - bx r0 - .align 2, 0 -_08129C28: .4byte 0x0000F83F -_08129C2C: .4byte gCurTask -_08129C30: .4byte sub_081295A0 - - thumb_func_start sub_08129C34 -sub_08129C34: @ 0x08129C34 - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #4 - ldr r0, _08129C5C @ =gCurTask - ldr r2, [r0] - ldrh r1, [r2, #0x12] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129C60 - ldrh r0, [r2, #6] - lsls r0, r0, #2 - movs r1, #0x80 - lsls r1, r1, #0x12 - adds r0, r0, r1 - b _08129C68 - .align 2, 0 -_08129C5C: .4byte gCurTask -_08129C60: - ldrh r1, [r2, #6] - movs r0, #0xc0 - lsls r0, r0, #0x12 - adds r0, r1, r0 -_08129C68: - adds r7, r0, #0 - ldr r1, _08129E7C @ =0x000002AD - adds r0, r7, r1 - ldrb r1, [r0] - lsls r0, r1, #1 - adds r0, r0, r1 - ldr r1, _08129E80 @ =gUnk_08363AA0 - adds r5, r0, r1 - ldrb r0, [r5] - lsls r1, r0, #4 - adds r1, r1, r0 - lsls r1, r1, #2 - movs r2, #0x9e - lsls r2, r2, #1 - adds r2, r2, r7 - mov sb, r2 - add r1, sb - ldr r0, [r1] - adds r0, #0x10 - str r0, [r1] - ldrb r0, [r5] - lsls r1, r0, #4 - adds r1, r1, r0 - lsls r1, r1, #2 - movs r3, #0xa0 - lsls r3, r3, #1 - adds r3, r3, r7 - mov r8, r3 - add r1, r8 - ldr r0, [r1] - adds r0, #8 - str r0, [r1] - ldrb r0, [r5] - lsls r1, r0, #4 - adds r1, r1, r0 - lsls r1, r1, #2 - adds r1, r7, r1 - movs r4, #0x94 - lsls r4, r4, #1 - adds r1, r1, r4 - ldrh r2, [r1] - ldr r0, _08129E84 @ =0x0000F83F - ands r0, r2 - strh r0, [r1] - ldrb r1, [r5] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - movs r2, #0xc0 - lsls r2, r2, #2 - adds r3, r2, #0 - orrs r1, r3 - strh r1, [r0] - ldrb r1, [r5] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - ldr r1, _08129E88 @ =0x000002B1 - adds r1, r1, r7 - mov ip, r1 - ldrb r1, [r1] - ldr r2, _08129E8C @ =0x00000133 - mov sl, r2 - add r0, sl - strb r1, [r0] - ldrb r1, [r5] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r2, [r0] - ldr r1, _08129E84 @ =0x0000F83F - ands r1, r2 - strh r1, [r0] - ldrb r1, [r5] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - orrs r3, r1 - strh r3, [r0] - ldrb r1, [r5] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - mov r3, ip - ldrb r1, [r3] - add r0, sl - strb r1, [r0] - ldrb r1, [r5, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - add r0, sb - ldr r1, [r0] - subs r1, #8 - str r1, [r0] - ldrb r1, [r5, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - add r0, r8 - ldr r1, [r0] - subs r1, #4 - str r1, [r0] - ldrb r1, [r5, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r2, [r0] - ldr r1, _08129E84 @ =0x0000F83F - ands r1, r2 - strh r1, [r0] - ldrb r1, [r5, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - movs r2, #0xa0 - lsls r2, r2, #2 - adds r3, r2, #0 - orrs r1, r3 - strh r1, [r0] - ldrb r1, [r5, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - movs r1, #0xac - lsls r1, r1, #2 - adds r6, r7, r1 - ldrb r1, [r6] - add r0, sl - strb r1, [r0] - ldrb r1, [r5, #1] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r2, [r0] - ldr r1, _08129E84 @ =0x0000F83F - ands r1, r2 - strh r1, [r0] - ldrb r1, [r5, #1] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - orrs r3, r1 - strh r3, [r0] - ldrb r1, [r5, #1] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - ldrb r1, [r6] - add r0, sl - strb r1, [r0] - ldrb r1, [r5, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - add sb, r0 - mov r2, sb - ldr r0, [r2] - subs r0, #8 - str r0, [r2] - ldrb r1, [r5, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - add r8, r0 - mov r3, r8 - ldr r0, [r3] - subs r0, #4 - str r0, [r3] - ldrb r1, [r5, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r2, [r0] - ldr r1, _08129E84 @ =0x0000F83F - ands r1, r2 - strh r1, [r0] - ldrb r1, [r5, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - movs r3, #0xb0 - lsls r3, r3, #2 - adds r2, r3, #0 - orrs r1, r2 - strh r1, [r0] - ldrb r1, [r5, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - mov r3, ip - ldrb r1, [r3] - add r0, sl - strb r1, [r0] - ldrb r1, [r5, #2] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - ldr r3, _08129E84 @ =0x0000F83F - ands r3, r1 - strh r3, [r0] - ldrb r1, [r5, #2] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - orrs r2, r1 - strh r2, [r0] - ldrb r1, [r5, #2] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - mov r2, ip - ldrb r1, [r2] - add r0, sl - strb r1, [r0] - ldrb r0, [r5, #1] - cmp r0, #0 - bne _08129E94 - ldr r3, _08129E90 @ =0x000002B2 - adds r1, r7, r3 - movs r0, #1 - b _08129EAA - .align 2, 0 -_08129E7C: .4byte 0x000002AD -_08129E80: .4byte gUnk_08363AA0 -_08129E84: .4byte 0x0000F83F -_08129E88: .4byte 0x000002B1 -_08129E8C: .4byte 0x00000133 -_08129E90: .4byte 0x000002B2 -_08129E94: - cmp r0, #1 - bne _08129EA4 - ldr r0, _08129EA0 @ =0x000002B2 - adds r1, r7, r0 - movs r0, #3 - b _08129EAA - .align 2, 0 -_08129EA0: .4byte 0x000002B2 -_08129EA4: - ldr r2, _08129F14 @ =0x000002B2 - adds r1, r7, r2 - movs r0, #5 -_08129EAA: - strb r0, [r1] - adds r0, r7, #0 - bl sub_081297F8 - movs r3, #0xab - lsls r3, r3, #2 - adds r0, r7, r3 - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08129EE0 - movs r1, #0x8a - lsls r1, r1, #1 - adds r0, r7, r1 - bl sub_081288DC - movs r2, #0xac - lsls r2, r2, #1 - adds r0, r7, r2 - bl sub_081288DC - movs r3, #0xce - lsls r3, r3, #1 - adds r0, r7, r3 - bl sub_081288DC -_08129EE0: - ldr r0, _08129F18 @ =0x000002AE - adds r1, r7, r0 - ldrh r0, [r1] - adds r0, #1 - strh r0, [r1] - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - cmp r0, #9 - bls _08129F02 - ldr r0, _08129F1C @ =gCurTask - ldr r1, [r0] - ldr r0, _08129F20 @ =sub_081295A0 - str r0, [r1, #8] - ldrb r1, [r5, #1] - ldr r2, _08129F24 @ =0x000002AD - adds r0, r7, r2 - strb r1, [r0] -_08129F02: - add sp, #4 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_08129F14: .4byte 0x000002B2 -_08129F18: .4byte 0x000002AE -_08129F1C: .4byte gCurTask -_08129F20: .4byte sub_081295A0 -_08129F24: .4byte 0x000002AD - - thumb_func_start sub_08129F28 -sub_08129F28: @ 0x08129F28 - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #4 - ldr r0, _08129F50 @ =gCurTask - ldr r2, [r0] - ldrh r1, [r2, #0x12] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _08129F54 - ldrh r0, [r2, #6] - lsls r0, r0, #2 - movs r1, #0x80 - lsls r1, r1, #0x12 - adds r0, r0, r1 - b _08129F5C - .align 2, 0 -_08129F50: .4byte gCurTask -_08129F54: - ldrh r1, [r2, #6] - movs r0, #0xc0 - lsls r0, r0, #0x12 - adds r0, r1, r0 -_08129F5C: - adds r7, r0, #0 - ldr r1, _0812A16C @ =0x000002AD - adds r0, r7, r1 - ldrb r1, [r0] - lsls r0, r1, #1 - adds r0, r0, r1 - ldr r1, _0812A170 @ =gUnk_08363AA0 - adds r6, r0, r1 - ldrb r0, [r6] - lsls r1, r0, #4 - adds r1, r1, r0 - lsls r1, r1, #2 - movs r2, #0x9e - lsls r2, r2, #1 - adds r2, r2, r7 - mov sb, r2 - add r1, sb - ldr r0, [r1] - adds r0, #8 - str r0, [r1] - ldrb r0, [r6] - lsls r1, r0, #4 - adds r1, r1, r0 - lsls r1, r1, #2 - movs r3, #0xa0 - lsls r3, r3, #1 - adds r3, r3, r7 - mov r8, r3 - add r1, r8 - ldr r0, [r1] - adds r0, #4 - str r0, [r1] - ldrb r0, [r6] - lsls r1, r0, #4 - adds r1, r1, r0 - lsls r1, r1, #2 - adds r1, r7, r1 - movs r4, #0x94 - lsls r4, r4, #1 - adds r1, r1, r4 - ldrh r2, [r1] - ldr r5, _0812A174 @ =0x0000F83F - mov ip, r5 - mov r0, ip - ands r0, r2 - strh r0, [r1] - ldrb r1, [r6] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - movs r2, #0xb0 - lsls r2, r2, #2 - adds r3, r2, #0 - orrs r1, r3 - strh r1, [r0] - ldrb r1, [r6] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - ldr r1, _0812A178 @ =0x000002B1 - adds r5, r7, r1 - ldrb r1, [r5] - ldr r2, _0812A17C @ =0x00000133 - mov sl, r2 - add r0, sl - strb r1, [r0] - ldrb r1, [r6] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r2, [r0] - mov r1, ip - ands r1, r2 - strh r1, [r0] - ldrb r1, [r6] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - orrs r3, r1 - strh r3, [r0] - ldrb r1, [r6] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - ldrb r1, [r5] - add r0, sl - strb r1, [r0] - ldrb r1, [r6, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - add r0, sb - ldr r1, [r0] - adds r1, #8 - str r1, [r0] - ldrb r1, [r6, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - add r0, r8 - ldr r1, [r0] - adds r1, #4 - str r1, [r0] - ldrb r1, [r6, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r2, [r0] - mov r1, ip - ands r1, r2 - strh r1, [r0] - ldrb r1, [r6, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - movs r2, #0xc0 - lsls r2, r2, #2 - adds r3, r2, #0 - orrs r1, r3 - strh r1, [r0] - ldrb r1, [r6, #1] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - ldrb r1, [r5] - add r0, sl - strb r1, [r0] - ldrb r1, [r6, #1] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r2, [r0] - mov r1, ip - ands r1, r2 - strh r1, [r0] - ldrb r1, [r6, #1] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - orrs r3, r1 - strh r3, [r0] - ldrb r1, [r6, #1] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - ldrb r1, [r5] - add r0, sl - strb r1, [r0] - ldrb r1, [r6, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - add sb, r0 - mov r3, sb - ldr r0, [r3] - subs r0, #0x10 - str r0, [r3] - ldrb r1, [r6, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - add r8, r0 - mov r5, r8 - ldr r0, [r5] - subs r0, #8 - str r0, [r5] - ldrb r1, [r6, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r2, [r0] - mov r1, ip - ands r1, r2 - strh r1, [r0] - ldrb r1, [r6, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - movs r3, #0xa0 - lsls r3, r3, #2 - adds r2, r3, #0 - orrs r1, r2 - strh r1, [r0] - ldrb r1, [r6, #2] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - movs r5, #0xac - lsls r5, r5, #2 - adds r3, r7, r5 - ldrb r1, [r3] - add r0, sl - strb r1, [r0] - ldrb r1, [r6, #2] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - mov r5, ip - ands r5, r1 - strh r5, [r0] - ldrb r1, [r6, #2] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - adds r0, r0, r4 - ldrh r1, [r0] - orrs r2, r1 - strh r2, [r0] - ldrb r1, [r6, #2] - adds r1, #3 - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r0, r7, r0 - ldrb r1, [r3] - add r0, sl - strb r1, [r0] - ldrb r0, [r6, #2] - cmp r0, #0 - bne _0812A184 - ldr r2, _0812A180 @ =0x000002B2 - adds r1, r7, r2 - movs r0, #1 - b _0812A19A - .align 2, 0 -_0812A16C: .4byte 0x000002AD -_0812A170: .4byte gUnk_08363AA0 -_0812A174: .4byte 0x0000F83F -_0812A178: .4byte 0x000002B1 -_0812A17C: .4byte 0x00000133 -_0812A180: .4byte 0x000002B2 -_0812A184: - cmp r0, #1 - bne _0812A194 - ldr r3, _0812A190 @ =0x000002B2 - adds r1, r7, r3 - movs r0, #3 - b _0812A19A - .align 2, 0 -_0812A190: .4byte 0x000002B2 -_0812A194: - ldr r5, _0812A204 @ =0x000002B2 - adds r1, r7, r5 - movs r0, #5 -_0812A19A: - strb r0, [r1] - adds r0, r7, #0 - bl sub_081297F8 - movs r1, #0xab - lsls r1, r1, #2 - adds r0, r7, r1 - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _0812A1D0 - movs r2, #0x8a - lsls r2, r2, #1 - adds r0, r7, r2 - bl sub_081288DC - movs r3, #0xac - lsls r3, r3, #1 - adds r0, r7, r3 - bl sub_081288DC - movs r5, #0xce - lsls r5, r5, #1 - adds r0, r7, r5 - bl sub_081288DC -_0812A1D0: - ldr r0, _0812A208 @ =0x000002AE - adds r1, r7, r0 - ldrh r0, [r1] - adds r0, #1 - strh r0, [r1] - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - cmp r0, #9 - bls _0812A1F2 - ldr r0, _0812A20C @ =gCurTask - ldr r1, [r0] - ldr r0, _0812A210 @ =sub_081295A0 - str r0, [r1, #8] - ldrb r1, [r6, #2] - ldr r2, _0812A214 @ =0x000002AD - adds r0, r7, r2 - strb r1, [r0] -_0812A1F2: - add sp, #4 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_0812A204: .4byte 0x000002B2 -_0812A208: .4byte 0x000002AE -_0812A20C: .4byte gCurTask -_0812A210: .4byte sub_081295A0 -_0812A214: .4byte 0x000002AD - thumb_func_start sub_0812A218 sub_0812A218: @ 0x0812A218 push {r4, r5, r6, lr} @@ -15963,13 +14371,13 @@ _08131654: adds r0, r3, #0 adds r0, #0xb8 strh r1, [r0] - ldr r0, _08131698 @ =gUnk_020382E8 + ldr r0, _08131698 @ =gUnk_020382D0 + 0x18 adds r2, r2, r0 ldrh r1, [r2] b _081316BE .align 2, 0 _08131694: .4byte gUnk_0203AD10 -_08131698: .4byte gUnk_020382E8 +_08131698: .4byte gUnk_020382D0 + 0x18 _0813169C: ldr r0, _081316E0 @ =gPrevInput ldrh r1, [r0] diff --git a/include/code_08128D48.h b/include/code_08128D48.h new file mode 100644 index 0000000..c1b323d --- /dev/null +++ b/include/code_08128D48.h @@ -0,0 +1,121 @@ +#ifndef GUARD_CODE_08128D48_H +#define GUARD_CODE_08128D48_H + +#include "global.h" +#include "data.h" + +struct Unk_08128D48_0_4 { + u16 srcVramOffset; + u8 unk2; + u8 delay; +}; /* size = 4 */ + +struct Unk_08128D48_0 { + u16 dstVramOffset; + u8 numTiles; + u8 numFrames; + struct Unk_08128D48_0_4 frames[0]; +}; /* size = 4 */ + +struct Unk_08128D48 { + const struct Unk_08128D48_0_4 *frames; + u32 dstVram; + u8 numFrames; + u16 sizeTiles; + u8 currentTilesetIndex; + u8 delayCounter; +}; /* size = 0x10 */ + +struct Unk_08128E28_0 { + u8 paletteOffset; + u8 numPalettes; + u8 paletteSize; // in halfwords + u16 data[0]; // one single entry (numPalettes entries in total): + // u16 delay; + // u16 palette[paletteSize]; +}; /* size = 4 */ + +struct Unk_08128E28 { + const u16 *data; + u16 currentDataOffset; // in halfwords + u8 paletteOffset; + u8 paletteSize; // in halfwords + u8 numPalettes; + u8 currentPaletteIndex; + u8 delayCounter; +}; /* size = 0xC */ + +struct Unk_08128F44_4 { + struct Sprite unk0; + s32 unk28; + s32 unk2C; + u16 unk30; + u16 unk32; + u16 unk34; + u16 unk36; + s32 *unk38; + struct Unk_08128F44_4 *unk3C; + struct Unk_08128F44_4 *unk40; +}; /* size = 0x44 */ + +struct Unk_08128F44 { + const struct Unk_02021590 *unk0; // 6 structs + struct Unk_08128F44_4 unk4[10][1]; // TODO: UB: out-of-bounds access + u8 unk2AC; + u8 unk2AD; + u16 unk2AE; + u8 unk2B0; + u8 unk2B1; + u8 unk2B2; + u8 unk2B3; + s16 unk2B4; + s16 unk2B6; +}; /* size = 0x2B8 */ + +struct Unk_0812A77C_40 { + struct Unk_08128F44_4 unk0[2]; + u32 unk88; + struct Task *unk8C; + u16 unk90; + u8 unk92; + u16 unk94; + u16 unk96; + u16 unk98; + u16 unk9A; + s16 unk9C; + u16 unk9E; + u16 unkA0; + u8 fillerA2[2]; + u16 unkA4; + u16 unkA6; + u16 unkA8; + u16 unkAA; + u8 unkAC; + u8 unkAD; + u16 unkAE; +}; /* size = 0xB0 */ + +struct Unk_0812A77C { + struct Task *unk0; + struct Task *unk4; + s32 unk8[2]; + u8 unk10[4]; + struct Task *unk14[10]; + u8 unk3C; + struct Unk_0812A77C_40 unk40[4]; + struct Unk_08128F44_4 unk300[4]; // guessed + struct Unk_08128F44_4 unk410[4]; + struct Unk_08128F44_4 unk520; // guessed + struct Unk_08128F44_4 unk564[2]; + u16 unk5EC; + u8 filler5EE[2]; + u16 unk5F0; + u16 unk5F2; + u8 unk5F4; + u16 unk5F6; +}; /* size = 0x5F8 */ + +// pause_area_map +void sub_081288DC(struct Unk_08128F44_4 *); + +#endif diff --git a/include/pause_fade.h b/include/pause_fade.h index 42e19d3..7ae4673 100644 --- a/include/pause_fade.h +++ b/include/pause_fade.h @@ -9,74 +9,6 @@ struct PauseFadeStruct { u8 unk3; }; /* size = 4 */ -struct Unk_08128D48_0_4 { - u16 srcVramOffset; - u8 unk2; - u8 delay; -}; /* size = 4 */ - -struct Unk_08128D48_0 { - u16 dstVramOffset; - u8 numTiles; - u8 numFrames; - struct Unk_08128D48_0_4 frames[0]; -}; /* size = 4 */ - -struct Unk_08128D48 { - const struct Unk_08128D48_0_4 *frames; - u32 dstVram; - u8 numFrames; - u16 sizeTiles; - u8 currentTilesetIndex; - u8 delayCounter; -}; /* size = 0x10 */ - -struct Unk_08128E28_0 { - u8 paletteOffset; - u8 numPalettes; - u8 paletteSize; // in halfwords - u16 data[0]; // one single entry (numPalettes entries in total): - // u16 delay; - // u16 palette[paletteSize]; -}; /* size = 4 */ - -struct Unk_08128E28 { - const u16 *data; - u16 currentDataOffset; // in halfwords - u8 paletteOffset; - u8 paletteSize; // in halfwords - u8 numPalettes; - u8 currentPaletteIndex; - u8 delayCounter; -}; /* size = 0xC */ - -struct Unk_08128F44_4 { - struct Sprite unk0; - s32 unk28; - s32 unk2C; - u16 unk30; - u16 unk32; - u16 unk34; - u16 unk36; - s32 *unk38; - struct Unk_08128F44_4 *unk3C; - struct Unk_08128F44_4 *unk40; -}; /* size = 0x44 */ - -struct Unk_08128F44 { - const struct Unk_02021590 *unk0; // 6 structs - struct Unk_08128F44_4 unk4[10]; - u8 unk2AC; - u8 unk2AD; - u16 unk2AE; - u8 unk2B0; - u8 unk2B1; - u8 unk2B2; - u8 unk2B3; - s16 unk2B4; - s16 unk2B6; -}; /* size = 0x2B8 */ - void CreatePauseFade(s8 arg0, u32 arg1); void CreatePauseFadeSetBldCnt(s8 arg0, u32 arg1); void sub_08128BEC(s8 a1, u32 a2, u16 a3); diff --git a/linker.ld b/linker.ld index 36c6eef..907a282 100644 --- a/linker.ld +++ b/linker.ld @@ -53,8 +53,6 @@ SECTIONS { . = 0x000382A0; gUnk_020382A0 = .; . = 0x000382C8; gUnk_020382C8 = .; . = 0x000382D0; gUnk_020382D0 = .; - . = 0x000382D8; gUnk_020382D8 = .; - . = 0x000382E8; gUnk_020382E8 = .; . = 0x00038580; gUnk_02038580 = .; . = 0x00038590; gUnk_02038590 = .; . = 0x00038960; gUnk_02038960 = .; @@ -356,6 +354,7 @@ SECTIONS { asm/pause_world_map.o(.text); asm/pause_area_map.o(.text); src/pause_fade.o(.text); + src/code_08128D48.o(.text); asm/code_08128BEC.o(.text); src/logo.o(.text); asm/code_08138B44.o(.text); diff --git a/src/code_08128D48.c b/src/code_08128D48.c new file mode 100644 index 0000000..effe9f3 --- /dev/null +++ b/src/code_08128D48.c @@ -0,0 +1,651 @@ +#include "code_08128D48.h" +#include "task.h" +#include "pause_fade.h" +#include "palette.h" + +void sub_08128DB0(void); +void sub_08128E8C(void); + +// apply a set of tilesets during animation (?) +struct Task *sub_08128D48(const struct Unk_08128D48_0 *a1) { + struct Task *t = TaskCreate(sub_08128DB0, sizeof(struct Unk_08128D48), 0x100, 0, NULL); + struct Unk_08128D48 *var = TaskGetStructPtr(t); + + var->frames = a1->frames; + var->dstVram = VRAM + a1->dstVramOffset; + var->numFrames = a1->numFrames; + var->sizeTiles = 0x20 * a1->numTiles; + var->currentTilesetIndex = 0; + var->delayCounter = 0xFF; + return t; +} + +void sub_08128DB0(void) { + struct Unk_08128D48 *var = TaskGetStructPtr(gCurTask); + const struct Unk_08128D48_0_4 *p = &var->frames[var->currentTilesetIndex]; + + if (var->delayCounter < p->delay) + ++var->delayCounter; + else { + ++var->currentTilesetIndex; + var->delayCounter = 0; + if (var->currentTilesetIndex >= var->numFrames) + var->currentTilesetIndex = 0; + ++var; --var; + p = &var->frames[var->currentTilesetIndex]; + CpuCopy32((void *)VRAM + p->srcVramOffset, (void *)var->dstVram, var->sizeTiles); + } +} + +// apply a set of palettes during animation (?) +struct Task *sub_08128E28(const struct Unk_08128E28_0 *a1) { + struct Task *t = TaskCreate(sub_08128E8C, sizeof(struct Unk_08128E28), 0x100, 0, NULL); + struct Unk_08128E28 *var = TaskGetStructPtr(t); + + var->data = a1->data; + var->currentDataOffset = 0; + var->paletteOffset = a1->paletteOffset; + var->paletteSize = a1->paletteSize; + var->numPalettes = a1->numPalettes; + var->currentPaletteIndex = 0; + var->delayCounter = 0xFF; + return t; +} + +void sub_08128E8C(void) { + struct Unk_08128E28 *var = TaskGetStructPtr(gCurTask); + const u16 *p = &var->data[var->currentDataOffset]; + + if (var->delayCounter < p[0]) + ++var->delayCounter; + else { + ++var->currentPaletteIndex; + var->delayCounter = 0; + var->currentDataOffset += var->paletteSize + 1; + if (var->currentPaletteIndex >= var->numPalettes) { + var->currentPaletteIndex = 0; + var->currentDataOffset = 0; + } + ++var; --var; + p = &var->data[var->currentDataOffset]; + if (gUnk_03002440 & 0x10000) + sub_08158334(p+1, var->paletteOffset, var->paletteSize); + else { + DmaCopy16(3, p+1, gBgPalette + var->paletteOffset, var->paletteSize * sizeof(u16)); + gUnk_03002440 |= 1; + } + } +} + +void sub_081295A0(void); +void sub_081297F8(struct Unk_08128F44 *); +void sub_081298B4(void); +void sub_08129A6C(void); +void sub_08129C34(void); +void sub_08129F28(void); +void sub_0812A39C(void); + +extern const u8 gUnk_08363AA0[]; + +struct Task *sub_08128F44(const struct Unk_02021590 *a1, u8 a2, u8 a3, s16 a4, s16 a5, u8 a6) { + struct Task *t = TaskCreate(sub_0812A39C, sizeof(struct Unk_08128F44), 0x100, 0, NULL); + struct Unk_08128F44 *tmp = TaskGetStructPtr(t), *var = tmp; +#ifndef NONMATCHING + register struct Unk_08128F44_4 *var1 asm("r6"), *var2 asm("r4"); +#else + struct Unk_08128F44_4 *var1, *var2; +#endif + + var->unk0 = a1; + var->unk2AC = 0x10; + var->unk2AD = 0; + var->unk2AE = 0; + var->unk2B0 = a2; + var->unk2B1 = a3; + var->unk2B2 = 1; + var->unk2B3 = 0; + var->unk2B4 = a4; + var->unk2B6 = a5; + if (a6) var->unk2AC |= 0x80; + if (gUnk_03002440 & 0x20000) + sub_0815828C(&gUnk_082DE69C[0x10 * var->unk2B2], 0x10 * var->unk2B0, 0x10); + else { + DmaCopy16(3, &gUnk_082DE69C[0x10 * var->unk2B2], &gObjPalette[0x10 * var->unk2B0], 0x10 * sizeof(u16)); + gUnk_03002440 |= 2; + } + if (gUnk_03002440 & 0x20000) + sub_0815828C(gUnk_082DE69C, 0x10 * var->unk2B1, 0x10); + else { + DmaCopy16(3, gUnk_082DE69C, &gObjPalette[0x10 * var->unk2B1], 0x10 * sizeof(u16)); + gUnk_03002440 |= 2; + } + CpuFill32(0, &var->unk4[0][0], sizeof(struct Unk_08128F44_4)); + var->unk4[0][0].unk0.tilesVram = 0x6010000; + var->unk4[0][0].unk0.unk14 = 0x280; + var->unk4[0][0].unk0.animId = var->unk0[0].animId; + var->unk4[0][0].unk0.variant = var->unk0[0].variant; + var->unk4[0][0].unk0.unk16 = 0; + var->unk4[0][0].unk0.unk1B = 0xFF; + var->unk4[0][0].unk0.unk1C = 0x10; + var->unk4[0][0].unk0.palId = var->unk2B0; + var->unk4[0][0].unk0.x = ({var->unk2B4 + 0;}); + var->unk4[0][0].unk0.y = ({var->unk2B6 + 0;}); + var->unk4[0][0].unk0.unk8 = 0xC0000; + var->unk4[0][0].unk28 = 4 * var->unk2B4; + var->unk4[0][0].unk2C = 4 * var->unk2B6; + var->unk4[0][0].unk30 = 0; + var->unk4[0][0].unk32 = 0; + var->unk4[0][0].unk34 = 0x10; + var->unk4[0][0].unk36 = 0; + var->unk4[0][0].unk38 = 0; + var->unk4[0][0].unk3C = NULL; + var->unk4[0][0].unk40 = NULL; + CpuFill32(0, &var->unk4[1][0], sizeof(struct Unk_08128F44_4)); + var->unk4[1][0].unk0.tilesVram = 0x6010000; + var->unk4[1][0].unk0.unk14 = 0x280; + var->unk4[1][0].unk0.animId = var->unk0[1].animId; + var->unk4[1][0].unk0.variant = var->unk0[1].variant; + var->unk4[1][0].unk0.unk16 = 0; + var->unk4[1][0].unk0.unk1B = 0xFF; + var->unk4[1][0].unk0.unk1C = 0x10; + var->unk4[1][0].unk0.palId = var->unk2B0; + var->unk4[1][0].unk0.x = 0; + var->unk4[1][0].unk0.y = 0; + var->unk4[1][0].unk0.unk8 = 0xC0000; + var->unk4[1][0].unk28 = 0; + var->unk4[1][0].unk2C = 0; + var->unk4[1][0].unk30 = 0; + var->unk4[1][0].unk32 = 0; + var->unk4[1][0].unk34 = 0x10; + var->unk4[1][0].unk36 = 0; + var->unk4[1][0].unk38 = 0; + var->unk4[1][0].unk3C = NULL; + var->unk4[1][0].unk40 = NULL; + var->unk4[0][0].unk40 = &var->unk4[1][0]; + var->unk4[1][0].unk3C = &var->unk4[0][0]; + var->unk4[1][0].unk34 &= ~0x10; + CpuFill32(0, var1 = &var->unk4[2][0], sizeof(struct Unk_08128F44_4)); + var1->unk0.tilesVram = 0x6010000; + var1->unk0.unk14 = 0x2C0; + var1->unk0.animId = var->unk0[0].animId; + var1->unk0.variant = var->unk0[0].variant; + var1->unk0.unk16 = 0; + var1->unk0.unk1B = 0xFF; + var1->unk0.unk1C = 0x10; + var1->unk0.palId = var->unk2B1; + var1->unk0.x = ({var->unk2B4 + 0x14;}); + var1->unk0.y = ({var->unk2B6 + 0xA;}); + var1->unk0.unk8 = 0xC0000; + var1->unk28 = 4 * (var->unk2B4 + 0x14); + var1->unk2C = 4 * (var->unk2B6 + 0xA); + var1->unk30 = 0; + var1->unk32 = 0; + var1->unk34 = 0x10; + var1->unk36 = 0; + var1->unk38 = 0; + var1->unk3C = NULL; + var1->unk40 = NULL; + CpuFill32(0, var2 = &var->unk4[3][0], sizeof(struct Unk_08128F44_4)); + var2->unk0.tilesVram = 0x6010000; + var2->unk0.unk14 = 0x2C0; + var2->unk0.animId = var->unk0[2].animId; + var2->unk0.variant = var->unk0[2].variant; + var2->unk0.unk16 = 0; + var2->unk0.unk1B = 0xFF; + var2->unk0.unk1C = 0x10; + var2->unk0.palId = var->unk2B1; + var2->unk0.x = 0; + var2->unk0.y = 0; + var2->unk0.unk8 = 0xC0000; + var2->unk28 = 0; + var2->unk2C = 0; + var2->unk30 = 0; + var2->unk32 = 0; + var2->unk34 = 0x10; + var2->unk36 = 0; + var2->unk38 = 0; + var2->unk3C = NULL; + var2->unk40 = NULL; + var1->unk40 = var2; + var2->unk3C = var1; + var2->unk34 &= ~0x10; + CpuFill32(0, var1 = &var->unk4[4][0], sizeof(struct Unk_08128F44_4)); + var1->unk0.tilesVram = 0x6010000; + var1->unk0.unk14 = 0x280; + var1->unk0.animId = var->unk0[0].animId; + var1->unk0.variant = var->unk0[0].variant; + var1->unk0.unk16 = 0; + var1->unk0.unk1B = 0xFF; + var1->unk0.unk1C = 0x10; + var1->unk0.palId = var->unk2B0; + var1->unk0.x = ({var->unk2B4 - 0x14;}); + var1->unk0.y = ({var->unk2B6 - 5;}); + var1->unk0.unk8 = 0xC0000; + var1->unk28 = 4 * (var->unk2B4 - 0x14); + var1->unk2C = 4 * (var->unk2B6 - 5); + var1->unk30 = 0; + var1->unk32 = 0; + var1->unk34 = 0x10; + var1->unk36 = 0; + var1->unk38 = 0; + var1->unk3C = NULL; + var1->unk40 = NULL; + CpuFill32(0, var2 = &var->unk4[7][0], sizeof(struct Unk_08128F44_4)); + var2->unk0.tilesVram = 0x6010000; + var2->unk0.unk14 = 0x280; + var2->unk0.animId = var->unk0[3].animId; + var2->unk0.variant = var->unk0[3].variant; + var2->unk0.unk16 = 0; + var2->unk0.unk1B = 0xFF; + var2->unk0.unk1C = 0x10; + var2->unk0.palId = var->unk2B0; + var2->unk0.x = 0; + var2->unk0.y = 0; + var2->unk0.unk8 = 0xC0000; + var2->unk28 = 0; + var2->unk2C = 0; + var2->unk30 = 0; + var2->unk32 = 0; + var2->unk34 = 0x10; + var2->unk36 = 0; + var2->unk38 = 0; + var2->unk3C = NULL; + var2->unk40 = NULL; + var1->unk40 = var2; + var2->unk3C = var1; + var2->unk34 &= ~0x10; + CpuFill32(0, var1 = &var->unk4[5][0], sizeof(struct Unk_08128F44_4)); + var1->unk0.tilesVram = 0x6010000; + var1->unk0.unk14 = 0x2C0; + var1->unk0.animId = var->unk0[0].animId; + var1->unk0.variant = var->unk0[0].variant; + var1->unk0.unk16 = 0; + var1->unk0.unk1B = 0xFF; + var1->unk0.unk1C = 0x10; + var1->unk0.palId = var->unk2B1; + var1->unk0.x = ({var->unk2B4 + 0;}); + var1->unk0.y = ({var->unk2B6 + 5;}); + var1->unk0.unk8 = 0xC0000; + var1->unk28 = 4 * var->unk2B4; + var1->unk2C = 4 * (var->unk2B6 + 5); + var1->unk30 = 0; + var1->unk32 = 0; + var1->unk34 = 0x10; + var1->unk36 = 0; + var1->unk38 = 0; + var1->unk3C = NULL; + var1->unk40 = NULL; + CpuFill32(0, var2 = &var->unk4[8][0], sizeof(struct Unk_08128F44_4)); + var2->unk0.tilesVram = 0x6010000; + var2->unk0.unk14 = 0x2C0; + var2->unk0.animId = var->unk0[4].animId; + var2->unk0.variant = var->unk0[4].variant; + var2->unk0.unk16 = 0; + var2->unk0.unk1B = 0xFF; + var2->unk0.unk1C = 0x10; + var2->unk0.palId = var->unk2B1; + var2->unk0.x = 0; + var2->unk0.y = 0; + var2->unk0.unk8 = 0xC0000; + var2->unk28 = 0; + var2->unk2C = 0; + var2->unk30 = 0; + var2->unk32 = 0; + var2->unk34 = 0x10; + var2->unk36 = 0; + var2->unk38 = 0; + var2->unk3C = NULL; + var2->unk40 = NULL; + var1->unk40 = var2; + var2->unk3C = var1; + var2->unk34 &= ~0x10; + CpuFill32(0, var1 = &var->unk4[6][0], sizeof(struct Unk_08128F44_4)); + var1->unk0.tilesVram = 0x6010000; + var1->unk0.unk14 = 0x300; + var1->unk0.animId = var->unk0[0].animId; + var1->unk0.variant = var->unk0[0].variant; + var1->unk0.unk16 = 0; + var1->unk0.unk1B = 0xFF; + var1->unk0.unk1C = 0x10; + var1->unk0.palId = var->unk2B1; + var1->unk0.x = ({var->unk2B4 + 0x14;}); + var1->unk0.y = ({var->unk2B6 + 0xF;}); + var1->unk0.unk8 = 0xC0000; + var1->unk28 = 4 * (var->unk2B4 + 0x14); + var1->unk2C = 4 * (var->unk2B6 + 0xF); + var1->unk30 = 0; + var1->unk32 = 0; + var1->unk34 = 0x10; + var1->unk36 = 0; + var1->unk38 = 0; + var1->unk3C = NULL; + var1->unk40 = NULL; + CpuFill32(0, var2 = &var->unk4[9][0], sizeof(struct Unk_08128F44_4)); + var2->unk0.tilesVram = 0x6010000; + var2->unk0.unk14 = 0x300; + var2->unk0.animId = var->unk0[5].animId; + var2->unk0.variant = var->unk0[5].variant; + var2->unk0.unk16 = 0; + var2->unk0.unk1B = 0xFF; + var2->unk0.unk1C = 0x10; + var2->unk0.palId = var->unk2B1; + var2->unk0.x = 0; + var2->unk0.y = 0; + var2->unk0.unk8 = 0xC0000; + var2->unk28 = 0; + var2->unk2C = 0; + var2->unk30 = 0; + var2->unk32 = 0; + var2->unk34 = 0x10; + var2->unk36 = 0; + var2->unk38 = 0; + var2->unk3C = NULL; + var2->unk40 = NULL; + var1->unk40 = var2; + var2->unk3C = var1; + var2->unk34 &= ~0x10; + return t; +} + +void sub_081295A0(void) { + struct Unk_08128F44 *tmp = TaskGetStructPtr(gCurTask), *var = tmp; + u16 r2; + + if (var->unk2AC & 1) + r2 = 0; + else if (gUnk_0203AD10 & 2) + r2 = gUnk_020382D0.unk8[1][0]; + else + r2 = gPressedKeys; + if (var->unk2AC & 4) { + if (r2 & 1) { + if (!(var->unk2AC & 0x80)) + m4aSongNumStart(0x21E); + var->unk2AC |= 1; + } + else if (r2 & 2) { + if (!(var->unk2AC & 0x80)) + m4aSongNumStart(0x21F); + var->unk2AC &= ~4; + var->unk2AC &= ~0x40; + } + else if (r2 & 0x40) { + if (!(var->unk2AC & 0x80)) + m4aSongNumStart(0x21D); + var->unk2AE = 0; + gCurTask->main = sub_08129F28; + } + else if (r2 & 0x80) { + if (!(var->unk2AC & 0x80)) + m4aSongNumStart(0x21D); + var->unk2AE = 0; + gCurTask->main = sub_08129C34; + } + } + else { + if (r2 & 1) { + if (!(var->unk2AC & 0x80)) { + m4aSongNumStart(0x21E); + if (var->unk2AD == 0) + var->unk2B2 = 1; + else if (var->unk2AD == 1) + var->unk2B2 = 3; + else + var->unk2B2 = 5; + } + if (var->unk2AC & 0x10) { + var->unk2AC |= 4; + var->unk2AC |= 0x40; + } + else { + var->unk2AC |= 1; + } + } + else if (r2 & 0x40) { + if (!(var->unk2AC & 0x80)) + m4aSongNumStart(0x21D); + var->unk2AE = 0; + gCurTask->main = sub_081298B4; + } + else if (r2 & 0x80) { + if (!(var->unk2AC & 0x80)) + m4aSongNumStart(0x21D); + var->unk2AE = 0; + gCurTask->main = sub_08129A6C; + } + } + sub_081297F8(var); + if (!(var->unk2AC & 0x80)) { + if (var->unk2AC & 4) { + sub_081288DC(&var->unk4[4][0]); + sub_081288DC(&var->unk4[5][0]); + sub_081288DC(&var->unk4[6][0]); + } + else { + sub_081288DC(&var->unk4[0][0]); + sub_081288DC(&var->unk4[2][0]); + } + } +} + +void sub_081297F8(struct Unk_08128F44 *a1) { + const u16 *p; + + if (a1->unk2B3++ > 5) { + a1->unk2B3 = 0; + p = gUnk_082DE69C + 0x10 * (a1->unk2AC & 2 ? a1->unk2B2 : a1->unk2B2 + 1); + a1->unk2AC ^= 2; + if (gUnk_03002440 & 0x20000) + sub_0815828C(p, 0x10 * a1->unk2B0, 0x10); + else { + DmaCopy16(3, p, gObjPalette + 0x10 * a1->unk2B0, 0x10 * sizeof(u16)); + gUnk_03002440 |= 2; + } + } +} + +void sub_081298B4(void) { + struct Unk_08128F44 *tmp = TaskGetStructPtr(gCurTask), *var = tmp; + + if (var->unk2AC & 0x10) { + var->unk4[0][0].unk28 += 8; + var->unk4[0][0].unk2C += 4; + var->unk4[0][0].unk0.unk14 &= ~0x7C0; + var->unk4[0][0].unk0.unk14 |= 0x2C0; + var->unk4[0][0].unk0.palId = var->unk2B1; + var->unk4[1][0].unk0.unk14 &= ~0x7C0; + var->unk4[1][0].unk0.unk14 |= 0x2C0; + var->unk4[1][0].unk0.palId = var->unk2B1; + var->unk4[2][0].unk28 -= 8; + var->unk4[2][0].unk2C -= 4; + var->unk4[2][0].unk0.unk14 &= ~0x7C0; + var->unk4[2][0].unk0.unk14 |= 0x280; + var->unk4[2][0].unk0.palId = var->unk2B0; + var->unk4[3][0].unk0.unk14 &= ~0x7C0; + var->unk4[3][0].unk0.unk14 |= 0x280; + var->unk4[3][0].unk0.palId = var->unk2B0; + } + else { + var->unk4[0][0].unk28 -= 8; + var->unk4[0][0].unk2C -= 4; + var->unk4[0][0].unk0.unk14 &= ~0x7C0; + var->unk4[0][0].unk0.unk14 |= 0x280; + var->unk4[0][0].unk0.palId = var->unk2B0; + var->unk4[1][0].unk0.unk14 &= ~0x7C0; + var->unk4[1][0].unk0.unk14 |= 0x280; + var->unk4[1][0].unk0.palId = var->unk2B0; + var->unk4[2][0].unk28 += 8; + var->unk4[2][0].unk2C += 4; + var->unk4[2][0].unk0.unk14 &= ~0x7C0; + var->unk4[2][0].unk0.unk14 |= 0x2C0; + var->unk4[2][0].unk0.palId = var->unk2B1; + var->unk4[3][0].unk0.unk14 &= ~0x7C0; + var->unk4[3][0].unk0.unk14 |= 0x2C0; + var->unk4[3][0].unk0.palId = var->unk2B1; + } + if (var->unk2AC & 0x10) + var->unk2B2 = 1; + else + var->unk2B2 = 3; + sub_081297F8(var); + if (!(var->unk2AC & 0x80)) { + sub_081288DC(&var->unk4[0][0]); + sub_081288DC(&var->unk4[2][0]); + } + if (++var->unk2AE > 9) { + gCurTask->main = sub_081295A0; + var->unk2AC ^= 0x10; + var->unk2AC ^= 0x20; + } +} + +void sub_08129A6C(void) { + struct Unk_08128F44 *tmp = TaskGetStructPtr(gCurTask), *var = tmp; + + if (var->unk2AC & 0x10) { + var->unk4[0][0].unk28 += 8; + var->unk4[0][0].unk2C += 4; + var->unk4[0][0].unk0.palId = var->unk2B1; + var->unk4[1][0].unk0.palId = var->unk2B1; + var->unk4[2][0].unk28 -= 8; + var->unk4[2][0].unk2C -= 4; + var->unk4[2][0].unk0.palId = var->unk2B0; + var->unk4[3][0].unk0.palId = var->unk2B0; + } + else { + var->unk4[0][0].unk28 -= 8; + var->unk4[0][0].unk2C -= 4; + var->unk4[0][0].unk0.palId = var->unk2B0; + var->unk4[1][0].unk0.palId = var->unk2B0; + var->unk4[2][0].unk28 += 8; + var->unk4[2][0].unk2C += 4; + var->unk4[2][0].unk0.palId = var->unk2B1; + var->unk4[3][0].unk0.palId = var->unk2B1; + } + if (var->unk2AC & 0x10) + var->unk2B2 = 1; + else + var->unk2B2 = 3; + sub_081297F8(var); + if (!(var->unk2AC & 0x80)) { + sub_081288DC(&var->unk4[0][0]); + sub_081288DC(&var->unk4[2][0]); + } + if (++var->unk2AE > 9) { + if (var->unk2AC & 0x10) { + var->unk4[0][0].unk0.unk14 &= ~0x7C0; + var->unk4[0][0].unk0.unk14 |= 0x2C0; + var->unk4[1][0].unk0.unk14 &= ~0x7C0; + var->unk4[1][0].unk0.unk14 |= 0x2C0; + var->unk4[2][0].unk0.unk14 &= ~0x7C0; + var->unk4[2][0].unk0.unk14 |= 0x280; + var->unk4[3][0].unk0.unk14 &= ~0x7C0; + var->unk4[3][0].unk0.unk14 |= 0x280; + } + else { + var->unk4[0][0].unk0.unk14 &= ~0x7C0; + var->unk4[0][0].unk0.unk14 |= 0x280; + var->unk4[1][0].unk0.unk14 &= ~0x7C0; + var->unk4[1][0].unk0.unk14 |= 0x280; + var->unk4[2][0].unk0.unk14 &= ~0x7C0; + var->unk4[2][0].unk0.unk14 |= 0x2C0; + var->unk4[3][0].unk0.unk14 &= ~0x7C0; + var->unk4[3][0].unk0.unk14 |= 0x2C0; + } + gCurTask->main = sub_081295A0; + var->unk2AC ^= 0x10; + var->unk2AC ^= 0x20; + } +} + +void sub_08129C34(void) { + struct Unk_08128F44 *tmp = TaskGetStructPtr(gCurTask), *var = tmp; + const u8 *p = gUnk_08363AA0 + 3 * var->unk2AD; + + var->unk4[p[0]][4].unk28 += 0x10; + var->unk4[p[0]][4].unk2C += 8; + var->unk4[p[0]][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[0]][4].unk0.unk14 |= 0x300; + var->unk4[p[0]][4].unk0.palId = var->unk2B1; + var->unk4[p[0] + 3][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[0] + 3][4].unk0.unk14 |= 0x300; + var->unk4[p[0] + 3][4].unk0.palId = var->unk2B1; + var->unk4[p[1]][4].unk28 -= 8; + var->unk4[p[1]][4].unk2C -= 4; + var->unk4[p[1]][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[1]][4].unk0.unk14 |= 0x280; + var->unk4[p[1]][4].unk0.palId = var->unk2B0; + var->unk4[p[1] + 3][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[1] + 3][4].unk0.unk14 |= 0x280; + var->unk4[p[1] + 3][4].unk0.palId = var->unk2B0; + var->unk4[p[2]][4].unk28 -= 8; + var->unk4[p[2]][4].unk2C -= 4; + var->unk4[p[2]][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[2]][4].unk0.unk14 |= 0x2C0; + var->unk4[p[2]][4].unk0.palId = var->unk2B1; + var->unk4[p[2] + 3][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[2] + 3][4].unk0.unk14 |= 0x2C0; + var->unk4[p[2] + 3][4].unk0.palId = var->unk2B1; + if (p[1] == 0) + var->unk2B2 = 1; + else if (p[1] == 1) + var->unk2B2 = 3; + else + var->unk2B2 = 5; + sub_081297F8(var); + if (!(var->unk2AC & 0x80)) { + sub_081288DC(&var->unk4[4][0]); + sub_081288DC(&var->unk4[5][0]); + sub_081288DC(&var->unk4[6][0]); + } + if (++var->unk2AE > 9) { + gCurTask->main = sub_081295A0; + var->unk2AD = p[1]; + } +} + +void sub_08129F28(void) { + struct Unk_08128F44 *tmp = TaskGetStructPtr(gCurTask), *var = tmp; + const u8 *p = gUnk_08363AA0 + 3 * var->unk2AD; + + var->unk4[p[0]][4].unk28 += 8; + var->unk4[p[0]][4].unk2C += 4; + var->unk4[p[0]][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[0]][4].unk0.unk14 |= 0x2C0; + var->unk4[p[0]][4].unk0.palId = var->unk2B1; + var->unk4[p[0] + 3][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[0] + 3][4].unk0.unk14 |= 0x2C0; + var->unk4[p[0] + 3][4].unk0.palId = var->unk2B1; + var->unk4[p[1]][4].unk28 += 8; + var->unk4[p[1]][4].unk2C += 4; + var->unk4[p[1]][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[1]][4].unk0.unk14 |= 0x300; + var->unk4[p[1]][4].unk0.palId = var->unk2B1; + var->unk4[p[1] + 3][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[1] + 3][4].unk0.unk14 |= 0x300; + var->unk4[p[1] + 3][4].unk0.palId = var->unk2B1; + var->unk4[p[2]][4].unk28 -= 0x10; + var->unk4[p[2]][4].unk2C -= 8; + var->unk4[p[2]][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[2]][4].unk0.unk14 |= 0x280; + var->unk4[p[2]][4].unk0.palId = var->unk2B0; + var->unk4[p[2] + 3][4].unk0.unk14 &= ~0x7C0; + var->unk4[p[2] + 3][4].unk0.unk14 |= 0x280; + var->unk4[p[2] + 3][4].unk0.palId = var->unk2B0; + if (p[2] == 0) + var->unk2B2 = 1; + else if (p[2] == 1) + var->unk2B2 = 3; + else + var->unk2B2 = 5; + sub_081297F8(var); + if (!(var->unk2AC & 0x80)) { + sub_081288DC(&var->unk4[4][0]); + sub_081288DC(&var->unk4[5][0]); + sub_081288DC(&var->unk4[6][0]); + } + if (++var->unk2AE > 9) { + gCurTask->main = sub_081295A0; + var->unk2AD = p[2]; + } +} diff --git a/src/pause_fade.c b/src/pause_fade.c index 92d71c1..ee73707 100644 --- a/src/pause_fade.c +++ b/src/pause_fade.c @@ -2,15 +2,11 @@ #include "task.h" #include "main.h" #include "pause_fade.h" -#include "palette.h" // TODO: determine file boundaries -void PauseFadeMain(void); -void sub_08128C5C(void); -void sub_08128DB0(void); -void sub_08128E8C(void); -void sub_0812A39C(void); +static void PauseFadeMain(void); +static void sub_08128C5C(void); void CreatePauseFade(s8 arg0, u32 arg1) { struct Task* task = TaskCreate(PauseFadeMain, sizeof(struct PauseFadeStruct), 0x100, TASK_x0004, NULL); @@ -68,7 +64,7 @@ void CreatePauseFadeSetBldCnt(s8 arg0, u32 arg1) { gBldRegs.bldY = fade2->unk0 >> 4; } -void PauseFadeMain(void) { +static void PauseFadeMain(void) { struct PauseFadeStruct* fade = TaskGetStructPtr(gCurTask); fade->unk0 += fade->unk2; gBldRegs.bldY = (fade->unk0 & 0x1f0) >> 4; @@ -107,7 +103,7 @@ void sub_08128BEC(s8 a1, u32 a2, u16 a3) { pf->unk3 |= 2; } -void sub_08128C5C(void) { +static void sub_08128C5C(void) { struct PauseFadeStruct *tmp = TaskGetStructPtr(gCurTask), *pf = tmp; if (pf->unk3 & 2) { @@ -140,334 +136,3 @@ void sub_08128C5C(void) { if (gBldRegs.bldAlpha == BLDALPHA_BLEND(0, 0)) pf->unk3 |= 0x80; } - -// apply a set of tilesets during animation (?) -struct Task *sub_08128D48(const struct Unk_08128D48_0 *a1) { - struct Task *t = TaskCreate(sub_08128DB0, sizeof(struct Unk_08128D48), 0x100, 0, NULL); - struct Unk_08128D48 *var = TaskGetStructPtr(t); - - var->frames = a1->frames; - var->dstVram = VRAM + a1->dstVramOffset; - var->numFrames = a1->numFrames; - var->sizeTiles = 0x20 * a1->numTiles; - var->currentTilesetIndex = 0; - var->delayCounter = 0xFF; - return t; -} - -void sub_08128DB0(void) { - struct Unk_08128D48 *var = TaskGetStructPtr(gCurTask); - const struct Unk_08128D48_0_4 *p = &var->frames[var->currentTilesetIndex]; - - if (var->delayCounter < p->delay) - ++var->delayCounter; - else { - ++var->currentTilesetIndex; - var->delayCounter = 0; - if (var->currentTilesetIndex >= var->numFrames) - var->currentTilesetIndex = 0; - ++var; --var; - p = &var->frames[var->currentTilesetIndex]; - CpuCopy32((void *)VRAM + p->srcVramOffset, (void *)var->dstVram, var->sizeTiles); - } -} - -// apply a set of palettes during animation (?) -struct Task *sub_08128E28(const struct Unk_08128E28_0 *a1) { - struct Task *t = TaskCreate(sub_08128E8C, sizeof(struct Unk_08128E28), 0x100, 0, NULL); - struct Unk_08128E28 *var = TaskGetStructPtr(t); - - var->data = a1->data; - var->currentDataOffset = 0; - var->paletteOffset = a1->paletteOffset; - var->paletteSize = a1->paletteSize; - var->numPalettes = a1->numPalettes; - var->currentPaletteIndex = 0; - var->delayCounter = 0xFF; - return t; -} - -void sub_08128E8C(void) { - struct Unk_08128E28 *var = TaskGetStructPtr(gCurTask); - const u16 *p = &var->data[var->currentDataOffset]; - - if (var->delayCounter < p[0]) - ++var->delayCounter; - else { - ++var->currentPaletteIndex; - var->delayCounter = 0; - var->currentDataOffset += var->paletteSize + 1; - if (var->currentPaletteIndex >= var->numPalettes) { - var->currentPaletteIndex = 0; - var->currentDataOffset = 0; - } - ++var; --var; - p = &var->data[var->currentDataOffset]; - if (gUnk_03002440 & 0x10000) - sub_08158334(p+1, var->paletteOffset, var->paletteSize); - else { - DmaCopy16(3, p+1, gBgPalette + var->paletteOffset, var->paletteSize * sizeof(u16)); - gUnk_03002440 |= 1; - } - } -} - -struct Task *sub_08128F44(const struct Unk_02021590 *a1, u8 a2, u8 a3, s16 a4, s16 a5, u8 a6) { - struct Task *t = TaskCreate(sub_0812A39C, sizeof(struct Unk_08128F44), 0x100, 0, NULL); - struct Unk_08128F44 *tmp = TaskGetStructPtr(t), *var = tmp; -#ifndef NONMATCHING - register struct Unk_08128F44_4 *var1 asm("r6"), *var2 asm("r4"); -#else - struct Unk_08128F44_4 *var1, *var2; -#endif - - var->unk0 = a1; - var->unk2AC = 0x10; - var->unk2AD = 0; - var->unk2AE = 0; - var->unk2B0 = a2; - var->unk2B1 = a3; - var->unk2B2 = 1; - var->unk2B3 = 0; - var->unk2B4 = a4; - var->unk2B6 = a5; - if (a6) var->unk2AC |= 0x80; - if (gUnk_03002440 & 0x20000) - sub_0815828C(&gUnk_082DE69C[0x10 * var->unk2B2], 0x10 * var->unk2B0, 0x10); - else { - DmaCopy16(3, &gUnk_082DE69C[0x10 * var->unk2B2], &gObjPalette[0x10 * var->unk2B0], 0x10 * sizeof(u16)); - gUnk_03002440 |= 2; - } - if (gUnk_03002440 & 0x20000) - sub_0815828C(gUnk_082DE69C, 0x10 * var->unk2B1, 0x10); - else { - DmaCopy16(3, gUnk_082DE69C, &gObjPalette[0x10 * var->unk2B1], 0x10 * sizeof(u16)); - gUnk_03002440 |= 2; - } - CpuFill32(0, &var->unk4[0], sizeof(struct Unk_08128F44_4)); - var->unk4[0].unk0.tilesVram = 0x6010000; - var->unk4[0].unk0.unk14 = 0x280; - var->unk4[0].unk0.animId = var->unk0[0].animId; - var->unk4[0].unk0.variant = var->unk0[0].variant; - var->unk4[0].unk0.unk16 = 0; - var->unk4[0].unk0.unk1B = 0xFF; - var->unk4[0].unk0.unk1C = 0x10; - var->unk4[0].unk0.palId = var->unk2B0; - var->unk4[0].unk0.x = ({var->unk2B4 + 0;}); - var->unk4[0].unk0.y = ({var->unk2B6 + 0;}); - var->unk4[0].unk0.unk8 = 0xC0000; - var->unk4[0].unk28 = 4 * var->unk2B4; - var->unk4[0].unk2C = 4 * var->unk2B6; - var->unk4[0].unk30 = 0; - var->unk4[0].unk32 = 0; - var->unk4[0].unk34 = 0x10; - var->unk4[0].unk36 = 0; - var->unk4[0].unk38 = 0; - var->unk4[0].unk3C = NULL; - var->unk4[0].unk40 = NULL; - CpuFill32(0, &var->unk4[1], sizeof(struct Unk_08128F44_4)); - var->unk4[1].unk0.tilesVram = 0x6010000; - var->unk4[1].unk0.unk14 = 0x280; - var->unk4[1].unk0.animId = var->unk0[1].animId; - var->unk4[1].unk0.variant = var->unk0[1].variant; - var->unk4[1].unk0.unk16 = 0; - var->unk4[1].unk0.unk1B = 0xFF; - var->unk4[1].unk0.unk1C = 0x10; - var->unk4[1].unk0.palId = var->unk2B0; - var->unk4[1].unk0.x = 0; - var->unk4[1].unk0.y = 0; - var->unk4[1].unk0.unk8 = 0xC0000; - var->unk4[1].unk28 = 0; - var->unk4[1].unk2C = 0; - var->unk4[1].unk30 = 0; - var->unk4[1].unk32 = 0; - var->unk4[1].unk34 = 0x10; - var->unk4[1].unk36 = 0; - var->unk4[1].unk38 = 0; - var->unk4[1].unk3C = NULL; - var->unk4[1].unk40 = NULL; - var->unk4[0].unk40 = &var->unk4[1]; - var->unk4[1].unk3C = &var->unk4[0]; - var->unk4[1].unk34 &= ~0x10; - CpuFill32(0, var1 = &var->unk4[2], sizeof(struct Unk_08128F44_4)); - var1->unk0.tilesVram = 0x6010000; - var1->unk0.unk14 = 0x2C0; - var1->unk0.animId = var->unk0[0].animId; - var1->unk0.variant = var->unk0[0].variant; - var1->unk0.unk16 = 0; - var1->unk0.unk1B = 0xFF; - var1->unk0.unk1C = 0x10; - var1->unk0.palId = var->unk2B1; - var1->unk0.x = ({var->unk2B4 + 0x14;}); - var1->unk0.y = ({var->unk2B6 + 0xA;}); - var1->unk0.unk8 = 0xC0000; - var1->unk28 = 4 * (var->unk2B4 + 0x14); - var1->unk2C = 4 * (var->unk2B6 + 0xA); - var1->unk30 = 0; - var1->unk32 = 0; - var1->unk34 = 0x10; - var1->unk36 = 0; - var1->unk38 = 0; - var1->unk3C = NULL; - var1->unk40 = NULL; - CpuFill32(0, var2 = &var->unk4[3], sizeof(struct Unk_08128F44_4)); - var2->unk0.tilesVram = 0x6010000; - var2->unk0.unk14 = 0x2C0; - var2->unk0.animId = var->unk0[2].animId; - var2->unk0.variant = var->unk0[2].variant; - var2->unk0.unk16 = 0; - var2->unk0.unk1B = 0xFF; - var2->unk0.unk1C = 0x10; - var2->unk0.palId = var->unk2B1; - var2->unk0.x = 0; - var2->unk0.y = 0; - var2->unk0.unk8 = 0xC0000; - var2->unk28 = 0; - var2->unk2C = 0; - var2->unk30 = 0; - var2->unk32 = 0; - var2->unk34 = 0x10; - var2->unk36 = 0; - var2->unk38 = 0; - var2->unk3C = NULL; - var2->unk40 = NULL; - var1->unk40 = var2; - var2->unk3C = var1; - var2->unk34 &= ~0x10; - CpuFill32(0, var1 = &var->unk4[4], sizeof(struct Unk_08128F44_4)); - var1->unk0.tilesVram = 0x6010000; - var1->unk0.unk14 = 0x280; - var1->unk0.animId = var->unk0[0].animId; - var1->unk0.variant = var->unk0[0].variant; - var1->unk0.unk16 = 0; - var1->unk0.unk1B = 0xFF; - var1->unk0.unk1C = 0x10; - var1->unk0.palId = var->unk2B0; - var1->unk0.x = ({var->unk2B4 - 0x14;}); - var1->unk0.y = ({var->unk2B6 - 5;}); - var1->unk0.unk8 = 0xC0000; - var1->unk28 = 4 * (var->unk2B4 - 0x14); - var1->unk2C = 4 * (var->unk2B6 - 5); - var1->unk30 = 0; - var1->unk32 = 0; - var1->unk34 = 0x10; - var1->unk36 = 0; - var1->unk38 = 0; - var1->unk3C = NULL; - var1->unk40 = NULL; - CpuFill32(0, var2 = &var->unk4[7], sizeof(struct Unk_08128F44_4)); - var2->unk0.tilesVram = 0x6010000; - var2->unk0.unk14 = 0x280; - var2->unk0.animId = var->unk0[3].animId; - var2->unk0.variant = var->unk0[3].variant; - var2->unk0.unk16 = 0; - var2->unk0.unk1B = 0xFF; - var2->unk0.unk1C = 0x10; - var2->unk0.palId = var->unk2B0; - var2->unk0.x = 0; - var2->unk0.y = 0; - var2->unk0.unk8 = 0xC0000; - var2->unk28 = 0; - var2->unk2C = 0; - var2->unk30 = 0; - var2->unk32 = 0; - var2->unk34 = 0x10; - var2->unk36 = 0; - var2->unk38 = 0; - var2->unk3C = NULL; - var2->unk40 = NULL; - var1->unk40 = var2; - var2->unk3C = var1; - var2->unk34 &= ~0x10; - CpuFill32(0, var1 = &var->unk4[5], sizeof(struct Unk_08128F44_4)); - var1->unk0.tilesVram = 0x6010000; - var1->unk0.unk14 = 0x2C0; - var1->unk0.animId = var->unk0[0].animId; - var1->unk0.variant = var->unk0[0].variant; - var1->unk0.unk16 = 0; - var1->unk0.unk1B = 0xFF; - var1->unk0.unk1C = 0x10; - var1->unk0.palId = var->unk2B1; - var1->unk0.x = ({var->unk2B4 + 0;}); - var1->unk0.y = ({var->unk2B6 + 5;}); - var1->unk0.unk8 = 0xC0000; - var1->unk28 = 4 * var->unk2B4; - var1->unk2C = 4 * (var->unk2B6 + 5); - var1->unk30 = 0; - var1->unk32 = 0; - var1->unk34 = 0x10; - var1->unk36 = 0; - var1->unk38 = 0; - var1->unk3C = NULL; - var1->unk40 = NULL; - CpuFill32(0, var2 = &var->unk4[8], sizeof(struct Unk_08128F44_4)); - var2->unk0.tilesVram = 0x6010000; - var2->unk0.unk14 = 0x2C0; - var2->unk0.animId = var->unk0[4].animId; - var2->unk0.variant = var->unk0[4].variant; - var2->unk0.unk16 = 0; - var2->unk0.unk1B = 0xFF; - var2->unk0.unk1C = 0x10; - var2->unk0.palId = var->unk2B1; - var2->unk0.x = 0; - var2->unk0.y = 0; - var2->unk0.unk8 = 0xC0000; - var2->unk28 = 0; - var2->unk2C = 0; - var2->unk30 = 0; - var2->unk32 = 0; - var2->unk34 = 0x10; - var2->unk36 = 0; - var2->unk38 = 0; - var2->unk3C = NULL; - var2->unk40 = NULL; - var1->unk40 = var2; - var2->unk3C = var1; - var2->unk34 &= ~0x10; - CpuFill32(0, var1 = &var->unk4[6], sizeof(struct Unk_08128F44_4)); - var1->unk0.tilesVram = 0x6010000; - var1->unk0.unk14 = 0x300; - var1->unk0.animId = var->unk0[0].animId; - var1->unk0.variant = var->unk0[0].variant; - var1->unk0.unk16 = 0; - var1->unk0.unk1B = 0xFF; - var1->unk0.unk1C = 0x10; - var1->unk0.palId = var->unk2B1; - var1->unk0.x = ({var->unk2B4 + 0x14;}); - var1->unk0.y = ({var->unk2B6 + 0xF;}); - var1->unk0.unk8 = 0xC0000; - var1->unk28 = 4 * (var->unk2B4 + 0x14); - var1->unk2C = 4 * (var->unk2B6 + 0xF); - var1->unk30 = 0; - var1->unk32 = 0; - var1->unk34 = 0x10; - var1->unk36 = 0; - var1->unk38 = 0; - var1->unk3C = NULL; - var1->unk40 = NULL; - CpuFill32(0, var2 = &var->unk4[9], sizeof(struct Unk_08128F44_4)); - var2->unk0.tilesVram = 0x6010000; - var2->unk0.unk14 = 0x300; - var2->unk0.animId = var->unk0[5].animId; - var2->unk0.variant = var->unk0[5].variant; - var2->unk0.unk16 = 0; - var2->unk0.unk1B = 0xFF; - var2->unk0.unk1C = 0x10; - var2->unk0.palId = var->unk2B1; - var2->unk0.x = 0; - var2->unk0.y = 0; - var2->unk0.unk8 = 0xC0000; - var2->unk28 = 0; - var2->unk2C = 0; - var2->unk30 = 0; - var2->unk32 = 0; - var2->unk34 = 0x10; - var2->unk36 = 0; - var2->unk38 = 0; - var2->unk3C = NULL; - var2->unk40 = NULL; - var1->unk40 = var2; - var2->unk3C = var1; - var2->unk34 &= ~0x10; - return t; -}