more intro

This commit is contained in:
Zhengwen Jiang 2024-08-14 01:40:58 -05:00 committed by Egor Ananyin
parent 071b256822
commit d9b087b150
3 changed files with 234 additions and 602 deletions

View File

@ -5,603 +5,6 @@
.text
thumb_func_start sub_08146E3C
sub_08146E3C: @ 0x08146E3C
push {r4, r5, r6, lr}
adds r2, r0, #0
adds r3, r2, #0
adds r3, #0x24
ldrh r0, [r2, #0xe]
ldrh r1, [r2, #0xa]
adds r0, r0, r1
strh r0, [r2, #0xa]
ldr r5, [r2, #0x20]
ldr r1, _08146E98 @ =gUnk_083877E0
ldrb r4, [r3, #1]
lsls r0, r4, #1
adds r0, r0, r1
ldr r1, [r5]
ldrh r0, [r0]
cmp r1, r0
blo _08146EA4
adds r0, r4, #1
strb r0, [r3, #1]
movs r0, #0
strb r0, [r3, #0xa]
ldr r0, _08146E9C @ =sub_08149880
str r0, [r2, #0x1c]
ldrh r0, [r2, #0xe]
strh r0, [r3, #2]
ldrh r0, [r2, #0xe]
lsls r0, r0, #0x10
asrs r0, r0, #0x11
strh r0, [r2, #0xe]
movs r0, #3
ldrsb r0, [r2, r0]
lsls r1, r0, #2
adds r1, r1, r0
lsls r1, r1, #3
adds r1, #0x48
ldr r0, [r2, #0x20]
adds r0, r0, r1
ldr r2, _08146EA0 @ =gUnk_08387208
ldrh r1, [r2, #0xc]
strh r1, [r0, #0xc]
ldrh r1, [r2, #0xe]
strb r1, [r0, #0x1a]
bl sub_08155128
b _08146EDC
.align 2, 0
_08146E98: .4byte gUnk_083877E0
_08146E9C: .4byte sub_08149880
_08146EA0: .4byte gUnk_08387208
_08146EA4:
adds r6, r5, #0
ldrb r5, [r2, #3]
lsls r0, r5, #2
adds r0, r0, r5
lsls r0, r0, #3
adds r0, #0x48
adds r4, r6, r0
ldr r1, _08146EE4 @ =0x000005CC
adds r0, r6, r1
adds r0, r0, r5
ldrb r0, [r0]
cmp r0, #1
beq _08146EDC
ldr r0, [r4]
cmp r0, #0
beq _08146ED2
adds r0, r4, #0
bl sub_08155128
cmp r0, #0
bne _08146ED2
movs r0, #0xff
strb r0, [r4, #0x1b]
_08146ED2:
ldr r1, _08146EE4 @ =0x000005CC
adds r0, r6, r1
adds r0, r0, r5
movs r1, #1
strb r1, [r0]
_08146EDC:
pop {r4, r5, r6}
pop {r0}
bx r0
.align 2, 0
_08146EE4: .4byte 0x000005CC
thumb_func_start sub_08146EE8
sub_08146EE8: @ 0x08146EE8
push {r4, r5, r6, r7, lr}
adds r5, r0, #0
adds r4, r5, #0
adds r4, #0x24
ldr r2, [r5, #0x20]
ldr r1, _08146FA4 @ =gUnk_083877E0
ldrb r3, [r4, #1]
lsls r0, r3, #1
adds r0, r0, r1
ldr r1, [r2]
ldrh r0, [r0]
cmp r1, r0
blo _08146F9E
adds r0, r3, #1
strb r0, [r4, #1]
adds r0, r5, #0
bl sub_08146BEC
adds r6, r0, #0
ldr r1, [r5, #0x20]
ldr r2, _08146FA8 @ =0x000013EC
adds r0, r1, r2
ldr r3, [r0]
cmp r3, #0
beq _08146F48
adds r4, r1, #0
adds r4, #0x48
_08146F1E:
cmp r3, r5
beq _08146F42
movs r0, #3
ldrsb r0, [r3, r0]
lsls r1, r0, #2
adds r1, r1, r0
lsls r1, r1, #3
adds r1, r4, r1
movs r2, #3
ldrsb r2, [r5, r2]
lsls r0, r2, #2
adds r0, r0, r2
lsls r0, r0, #3
adds r0, r4, r0
ldr r1, [r1]
ldr r0, [r0]
cmp r1, r0
beq _08146F56
_08146F42:
ldr r3, [r3, #0x18]
cmp r3, #0
bne _08146F1E
_08146F48:
ldr r0, [r6]
cmp r0, #0
beq _08146F56
bl VramFree
movs r0, #0
str r0, [r6]
_08146F56:
ldr r3, [r5, #0x20]
movs r2, #0
ldr r7, _08146FAC @ =sub_08146FB0
movs r4, #3
ldrsb r4, [r5, r4]
_08146F60:
cmp r2, r4
beq _08146F7C
lsls r0, r2, #2
adds r0, r0, r2
lsls r0, r0, #3
adds r0, #0x48
adds r1, r3, r0
ldr r0, [r1]
cmp r0, #0
beq _08146F7C
ldrb r0, [r1, #0x1f]
ldrb r1, [r6, #0x1f]
cmp r0, r1
beq _08146F98
_08146F7C:
adds r0, r2, #1
lsls r0, r0, #0x18
lsrs r2, r0, #0x18
cmp r2, #0x1f
bls _08146F60
adds r0, r3, #0
adds r0, #0x12
ldrb r6, [r6, #0x1f]
adds r0, r0, r6
movs r1, #0xff
strb r1, [r0]
ldrb r0, [r3, #0x11]
subs r0, #1
strb r0, [r3, #0x11]
_08146F98:
movs r0, #0xff
strb r0, [r5, #3]
str r7, [r5, #0x1c]
_08146F9E:
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_08146FA4: .4byte gUnk_083877E0
_08146FA8: .4byte 0x000013EC
_08146FAC: .4byte sub_08146FB0
thumb_func_start sub_08146FB0
sub_08146FB0: @ 0x08146FB0
push {r4, r5, lr}
adds r4, r0, #0
adds r5, r4, #0
adds r5, #0x24
ldr r2, [r4, #0x20]
ldr r1, _08147008 @ =gUnk_083877E0
ldrb r3, [r5, #1]
lsls r0, r3, #1
adds r0, r0, r1
ldr r1, [r2]
ldrh r0, [r0]
cmp r1, r0
blo _08147000
adds r0, r3, #1
strb r0, [r5, #1]
ldr r0, [r4, #0x20]
adds r1, r4, #0
bl sub_081469D4
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, _0814700C @ =gUnk_08387208
ldrh r1, [r2, #0x10]
strh r1, [r0, #0xc]
ldrh r1, [r2, #0x12]
strb r1, [r0, #0x1a]
bl sub_08155128
ldrb r0, [r4, #3]
strb r0, [r5, #7]
movs r0, #1
strb r0, [r5, #6]
ldr r0, _08147010 @ =sub_08147014
str r0, [r4, #0x1c]
_08147000:
pop {r4, r5}
pop {r0}
bx r0
.align 2, 0
_08147008: .4byte gUnk_083877E0
_0814700C: .4byte gUnk_08387208
_08147010: .4byte sub_08147014
thumb_func_start sub_08147014
sub_08147014: @ 0x08147014
push {r4, r5, lr}
adds r5, r0, #0
adds r3, r5, #0
adds r3, #0x24
ldrh r0, [r3, #4]
adds r0, #1
strh r0, [r3, #4]
lsls r0, r0, #0x10
lsrs r0, r0, #0x10
cmp r0, #1
bls _08147046
movs r0, #0
strh r0, [r3, #4]
movs r1, #0
ldrb r0, [r3, #6]
cmp r0, #0
bne _08147038
movs r1, #1
_08147038:
strb r1, [r3, #6]
cmp r1, #0
beq _08147042
ldrb r0, [r3, #7]
b _08147044
_08147042:
movs r0, #0xff
_08147044:
strb r0, [r5, #3]
_08147046:
ldr r2, [r5, #0x20]
ldr r1, _08147070 @ =gUnk_083877E0
ldrb r4, [r3, #1]
lsls r0, r4, #1
adds r0, r0, r1
ldr r1, [r2]
ldrh r0, [r0]
cmp r1, r0
blo _08147068
adds r0, r4, #1
strb r0, [r3, #1]
ldrb r0, [r3, #7]
strb r0, [r5, #3]
movs r0, #1
strb r0, [r3, #6]
ldr r0, _08147074 @ =sub_081498B4
str r0, [r5, #0x1c]
_08147068:
pop {r4, r5}
pop {r0}
bx r0
.align 2, 0
_08147070: .4byte gUnk_083877E0
_08147074: .4byte sub_081498B4
thumb_func_start sub_08147078
sub_08147078: @ 0x08147078
push {r4, r5, lr}
adds r5, r0, #0
adds r2, r5, #0
adds r2, #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 r4, r1, r0
ldrb r0, [r2, #0xa]
adds r0, #1
strb r0, [r2, #0xa]
movs r1, #0xff
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
cmp r0, #0x18
bls _081470BC
movs r0, #0
strb r0, [r2, #0xa]
ldrb r0, [r2, #9]
adds r0, #1
strb r0, [r2, #9]
ands r0, r1
cmp r0, #3
bls _081470B4
ldr r0, _081470E0 @ =sub_08149910
str r0, [r5, #0x1c]
_081470B4:
movs r0, #0x96
lsls r0, r0, #2
bl m4aSongNumStart
_081470BC:
adds r0, r4, #0
bl sub_08155128
cmp r0, #0
bne _081470DA
ldr r1, _081470E4 @ =gUnk_08387208
ldrh r0, [r1]
strh r0, [r4, #0xc]
ldrh r0, [r1, #2]
strb r0, [r4, #0x1a]
adds r0, r4, #0
bl sub_08155128
ldr r0, _081470E8 @ =sub_081470EC
str r0, [r5, #0x1c]
_081470DA:
pop {r4, r5}
pop {r0}
bx r0
.align 2, 0
_081470E0: .4byte sub_08149910
_081470E4: .4byte gUnk_08387208
_081470E8: .4byte sub_081470EC
thumb_func_start sub_081470EC
sub_081470EC: @ 0x081470EC
push {r4, r5, lr}
adds r4, r0, #0
adds r5, r4, #0
adds r5, #0x24
ldr r2, [r4, #0x20]
ldr r1, _08147144 @ =gUnk_083877E0
ldrb r3, [r5, #1]
lsls r0, r3, #1
adds r0, r0, r1
ldr r1, [r2]
ldrh r0, [r0]
cmp r1, r0
blo _0814713C
adds r0, r3, #1
movs r1, #0
strb r0, [r5, #1]
strb r1, [r5, #0xa]
ldr r0, _08147148 @ =0x0000025A
bl m4aSongNumStart
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, _0814714C @ =gUnk_08387208
ldrh r1, [r2, #8]
strh r1, [r0, #0xc]
ldrh r1, [r2, #0xa]
strb r1, [r0, #0x1a]
bl sub_08155128
ldrh r0, [r5, #2]
lsls r0, r0, #1
strh r0, [r4, #0xe]
ldr r0, _08147150 @ =sub_08147154
str r0, [r4, #0x1c]
_0814713C:
pop {r4, r5}
pop {r0}
bx r0
.align 2, 0
_08147144: .4byte gUnk_083877E0
_08147148: .4byte 0x0000025A
_0814714C: .4byte gUnk_08387208
_08147150: .4byte sub_08147154
thumb_func_start sub_08147154
sub_08147154: @ 0x08147154
push {r4, r5, r6, lr}
adds r4, r0, #0
ldrh r0, [r4, #0xe]
ldrh r2, [r4, #0xa]
adds r1, r0, r2
strh r1, [r4, #0xa]
ldrb r0, [r4]
cmp r0, #0
beq _081471A0
lsls r1, r1, #0x10
asrs r1, r1, #0x16
ldr r2, _081471E0 @ =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 _081471A0
adds r0, r4, #0
bl sub_08146B68
adds r0, r4, #0
bl sub_08146BEC
adds r5, r0, #0
cmp r5, #0
beq _081471A0
adds r0, r4, #0
adds r1, r5, #0
bl sub_081497B4
cmp r0, #0
beq _081471A0
adds r0, r4, #0
adds r1, r5, #0
bl sub_08149814
_081471A0:
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, _081471E4 @ =0x000005CC
adds r0, r6, r1
adds r0, r0, r5
ldrb r0, [r0]
cmp r0, #1
beq _081471D8
ldr r0, [r4]
cmp r0, #0
beq _081471CE
adds r0, r4, #0
bl sub_08155128
cmp r0, #0
bne _081471CE
movs r0, #0xff
strb r0, [r4, #0x1b]
_081471CE:
ldr r2, _081471E4 @ =0x000005CC
adds r0, r6, r2
adds r0, r0, r5
movs r1, #1
strb r1, [r0]
_081471D8:
pop {r4, r5, r6}
pop {r0}
bx r0
.align 2, 0
_081471E0: .4byte gUnk_08387348
_081471E4: .4byte 0x000005CC
thumb_func_start sub_081471E8
sub_081471E8: @ 0x081471E8
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
adds r7, r0, #0
adds r5, r7, #0
adds r5, #0x24
ldrh r0, [r7, #0xe]
ldrh r1, [r7, #0xa]
adds r0, r0, r1
strh r0, [r7, #0xa]
ldrb r0, [r5, #1]
mov r8, r0
ldr r6, _081472CC @ =gSineTable
ldrh r0, [r5, #4]
lsls r0, r0, #0xa
ldrh r4, [r5, #2]
adds r1, r4, #0
bl __divsi3
ldr r1, _081472D0 @ =0x000003FF
ands r1, r0
movs r0, #0x80
lsls r0, r0, #1
adds r1, r1, r0
lsls r1, r1, #1
adds r1, r1, r6
movs r0, #0
ldrsh r1, [r1, r0]
movs r0, #0x64
muls r0, r1, r0
mov r1, r8
muls r1, r0, r1
adds r0, r1, #0
asrs r0, r0, #8
rsbs r0, r0, #0
lsls r4, r4, #4
adds r1, r4, #0
bl __divsi3
ldrh r1, [r7, #0xc]
adds r1, r1, r0
strh r1, [r7, #0xc]
ldrh r0, [r5, #4]
adds r0, #1
ldrh r1, [r5, #2]
bl __modsi3
strh r0, [r5, #4]
ldrb r0, [r7]
cmp r0, #0
beq _0814728A
ldrh r1, [r7, #0xa]
lsls r1, r1, #0x10
asrs r1, r1, #0x16
ldr r2, _081472D4 @ =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 _0814728A
adds r0, r7, #0
bl sub_08146B68
adds r0, r7, #0
bl sub_08146BEC
adds r4, r0, #0
cmp r4, #0
beq _0814728A
adds r0, r7, #0
adds r1, r4, #0
bl sub_081497B4
cmp r0, #0
beq _0814728A
adds r0, r7, #0
adds r1, r4, #0
bl sub_08149814
_0814728A:
ldr r6, [r7, #0x20]
ldrb r5, [r7, #3]
lsls r0, r5, #2
adds r0, r0, r5
lsls r0, r0, #3
adds r0, #0x48
adds r4, r6, r0
ldr r1, _081472D8 @ =0x000005CC
adds r0, r6, r1
adds r0, r0, r5
ldrb r0, [r0]
cmp r0, #1
beq _081472C2
ldr r0, [r4]
cmp r0, #0
beq _081472B8
adds r0, r4, #0
bl sub_08155128
cmp r0, #0
bne _081472B8
movs r0, #0xff
strb r0, [r4, #0x1b]
_081472B8:
ldr r1, _081472D8 @ =0x000005CC
adds r0, r6, r1
adds r0, r0, r5
movs r1, #1
strb r1, [r0]
_081472C2:
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_081472CC: .4byte gSineTable
_081472D0: .4byte 0x000003FF
_081472D4: .4byte gUnk_08387348
_081472D8: .4byte 0x000005CC
thumb_func_start sub_081472DC
sub_081472DC: @ 0x081472DC
push {r4, r5, r6, lr}

View File

@ -34,15 +34,28 @@ struct Unk_08145B64_5EC {
u16 filler8;
s16 unkA;
s16 unkC;
u16 unkE;
s16 unkE;
u16 unk10;
u16 filler12;
struct Unk_08145B64_5EC *unk14;
struct Unk_08145B64_5EC *unk18;
void (*unk1C)(struct Unk_08145B64_5EC *);
struct Unk_08145B64 *unk20;
s16 unk24[3];
u8 filler2A[0xA];
union Unk_08145B64_5EC_24 {
s16 pat1[6];
struct Unk_08145B64_5EC_24_Pat2 {
u8 unk0;
u8 unk1;
u16 unk2;
u16 unk4;
u8 unk6;
u8 unk7;
u8 unk8;
u8 unk9;
u8 unkA;
} pat2;
} unk24;
u32 filler30;
}; /* size = 0x34 */
struct Unk_08145B64 {

View File

@ -3,6 +3,7 @@
#include "intro.h"
#include "malloc_vram.h"
#include "random.h"
#include "trig.h"
void sub_08145D1C(struct Task *);
void sub_08145D94(void);
@ -17,6 +18,10 @@ void sub_0814669C(struct Unk_08145B64 *, const struct Unk_08387814 *);
void sub_0814682C(struct Unk_08145B64 *, struct Unk_08145B64_5EC *);
void sub_081469D4(struct Unk_08145B64 *, struct Unk_08145B64_5EC *);
void sub_08146CE4(struct Unk_08145B64_5EC *);
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 *);
bool32 sub_08148CD8(struct Unk_08145B64 *);
void sub_081494E4(struct Unk_08145B64 *);
void sub_08149628(struct Unk_08145B64 *);
@ -30,12 +35,17 @@ void nullsub_134(struct Unk_08145B64 *);
bool32 sub_081497B0(struct Unk_08145B64 *);
bool32 sub_081497B4(struct Unk_08145B64_5EC *, struct Sprite *);
bool32 sub_08149814(struct Unk_08145B64_5EC *, struct Sprite *);
void sub_08149880(struct Unk_08145B64_5EC *);
void sub_081498B4(struct Unk_08145B64_5EC *);
void sub_08149910(struct Unk_08145B64_5EC *);
extern const u16 gUnk_08387208[][2];
extern const struct Unk_08387348 gUnk_08387348[];
extern const u8 gUnk_083877A8[][8];
extern const u16 gUnk_083877D2[2];
extern const u16 gUnk_083877D6[2];
extern const u16 gUnk_083877DA[2];
extern const u16 gUnk_083877E0[];
extern const u16 gUnk_083877EE[];
extern const struct Unk_08387814 gUnk_08387814[];
extern const u8 gUnk_08387D54;
@ -529,11 +539,11 @@ void sub_08146D80(struct Unk_08145B64_5EC *a1) {
struct Sprite *sprite;
struct Unk_08145B64 *v5;
u8 unk3;
s16 *ptr = a1->unk24;
s16 *ptr = a1->unk24.pat1;
if (++ptr[2] >= ptr[1]) {
ptr[2] = 0;
m4aSongNumStart(a1->unk24[0]);
m4aSongNumStart(a1->unk24.pat1[0]);
}
a1->unkA += a1->unkE;
a1->unkC += a1->unk10;
@ -555,3 +565,209 @@ void sub_08146D80(struct Unk_08145B64_5EC *a1) {
v5->unk5CC[unk3] = 1;
}
}
void sub_08146E3C(struct Unk_08145B64_5EC *a1) {
union Unk_08145B64_5EC_24 *ptr;
struct Unk_08145B64 *unk20;
ptr = &a1->unk24;
a1->unkA += a1->unkE;
unk20 = a1->unk20;
if (a1->unk20->unk0 >= gUnk_083877E0[ptr->pat2.unk1]) {
struct Sprite *sprite;
++ptr->pat2.unk1;
ptr->pat2.unkA = 0;
a1->unk1C = sub_08149880;
ptr->pat2.unk2 = a1->unkE;
a1->unkE = a1->unkE >> 1;
sprite = &a1->unk20->unk48[a1->unk3];
sprite->animId = gUnk_08387208[3][0];
sprite->variant = gUnk_08387208[3][1];
sub_08155128(sprite);
} else {
struct Unk_08145B64 *unk20 = a1->unk20;
struct Sprite *sprite;
u8 v4 = a1->unk3;
sprite = &unk20->unk48[v4];
if (unk20->unk5CC[v4] != 1) {
if (sprite->tilesVram && !sub_08155128(&unk20->unk48[v4]))
sprite->unk1B = 0xFF;
unk20->unk5CC[v4] = 1;
}
}
}
static inline bool32 sub_08146EE8_helper(struct Unk_08145B64_5EC *a1) {
struct Unk_08145B64_5EC *current;
struct Unk_08145B64 *unk20 = a1->unk20;
for (current = unk20->unk13EC; current; current = current->unk18) {
if (current != a1 && unk20->unk48[current->unk3].tilesVram == unk20->unk48[a1->unk3].tilesVram)
return TRUE;
}
return FALSE;
}
static inline bool32 sub_08146EE8_helper_2(struct Unk_08145B64_5EC *a1, struct Unk_08145B64 *unk20, struct Sprite *sprite) {
u8 i;
for (i = 0; i < 0x20; ++i) {
if (i != a1->unk3) {
struct Sprite *sprite2 = &unk20->unk48[i];
if (sprite2->tilesVram && sprite2->palId == sprite->palId)
return TRUE;
}
}
return FALSE;
}
void sub_08146EE8(struct Unk_08145B64_5EC *a1) {
union Unk_08145B64_5EC_24 *ptr = &a1->unk24;
struct Sprite *sprite;
struct Unk_08145B64 *unk20;
if (a1->unk20->unk0 >= gUnk_083877E0[ptr->pat2.unk1]) {
++ptr->pat2.unk1;
sprite = sub_08146BEC(a1);
if (!sub_08146EE8_helper(a1) && sprite->tilesVram) {
VramFree(sprite->tilesVram);
sprite->tilesVram = 0;
}
unk20 = a1->unk20;
if (!sub_08146EE8_helper_2(a1, unk20, sprite)) {
unk20->unk12[sprite->palId] = 0xFF;
--unk20->unk11;
}
a1->unk3 = 0xFF;
a1->unk1C = sub_08146FB0;
}
}
void sub_08146FB0(struct Unk_08145B64_5EC *a1) {
union Unk_08145B64_5EC_24 *ptr = &a1->unk24;
struct Sprite *sprite;
if (a1->unk20->unk0 >= gUnk_083877E0[ptr->pat2.unk1]) {
++ptr->pat2.unk1;
sub_081469D4(a1->unk20, a1);
sprite = &a1->unk20->unk48[a1->unk3];
sprite->animId = gUnk_08387208[4][0];
sprite->variant = gUnk_08387208[4][1];
sub_08155128(sprite);
ptr->pat2.unk7 = a1->unk3;
ptr->pat2.unk6 = 1;
a1->unk1C = sub_08147014;
}
}
void sub_08147014(struct Unk_08145B64_5EC *a1) {
union Unk_08145B64_5EC_24 *ptr = &a1->unk24;
if (++ptr->pat2.unk4 > 1) {
ptr->pat2.unk4 = 0;
ptr->pat2.unk6 = !ptr->pat2.unk6;
if (ptr->pat2.unk6)
a1->unk3 = ptr->pat2.unk7;
else
a1->unk3 = 0xFF;
}
if (a1->unk20->unk0 >= gUnk_083877E0[ptr->pat2.unk1]) {
++ptr->pat2.unk1;
a1->unk3 = ptr->pat2.unk7;
ptr->pat2.unk6 = 1;
a1->unk1C = sub_081498B4;
}
}
void sub_08147078(struct Unk_08145B64_5EC *a1) {
union Unk_08145B64_5EC_24 *ptr = &a1->unk24;
struct Sprite *sprite = &a1->unk20->unk48[a1->unk3];
if (++ptr->pat2.unkA > 0x18) {
ptr->pat2.unkA = 0;
if (++ptr->pat2.unk9 > 3)
a1->unk1C = sub_08149910;
m4aSongNumStart(600);
}
if (!sub_08155128(sprite)) {
sprite->animId = gUnk_08387208[0][0];
sprite->variant = gUnk_08387208[0][1];
sub_08155128(sprite);
a1->unk1C = sub_081470EC;
}
}
void sub_081470EC(struct Unk_08145B64_5EC *a1) {
union Unk_08145B64_5EC_24 *ptr;
struct Sprite *sprite;
ptr = &a1->unk24;
if (a1->unk20->unk0 >= gUnk_083877E0[ptr->pat2.unk1]) {
++ptr->pat2.unk1;
ptr->pat2.unkA = 0;
m4aSongNumStart(602);
sprite = &a1->unk20->unk48[a1->unk3];
sprite->animId = gUnk_08387208[2][0];
sprite->variant = gUnk_08387208[2][1];
sub_08155128(sprite);
a1->unkE = 2 * ptr->pat2.unk2;
a1->unk1C = sub_08147154;
}
}
void sub_08147154(struct Unk_08145B64_5EC *a1) {
struct Sprite *sprite;
struct Unk_08145B64 *v5;
u8 unk3;
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_081471E8(struct Unk_08145B64_5EC *a1) {
union Unk_08145B64_5EC_24 *ptr = &a1->unk24;
struct Sprite *sprite;
struct Unk_08145B64 *v5;
u8 unk3;
a1->unkA += a1->unkE;
a1->unkC += -(ptr->pat2.unk1 * 100 * gSineTable[((ptr->pat2.unk4 * 0x400) / ptr->pat2.unk2 & 0x3FF) + 0x100] >> 8)
/ (0x10 * ptr->pat2.unk2);
ptr->pat2.unk4 = (ptr->pat2.unk4 + 1) % ptr->pat2.unk2;
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;
}
}