Decompile CrenelBeanSprout

This commit is contained in:
octorock 2022-02-22 23:15:13 +01:00
parent 62b8e59af1
commit 4df984bcf7
11 changed files with 395 additions and 1157 deletions

View File

@ -1,996 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start CrenalBeanSprout
CrenalBeanSprout: @ 0x0809631C
push {lr}
ldr r2, _08096330 @ =gUnk_08123168
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08096330: .4byte gUnk_08123168
thumb_func_start sub_08096334
sub_08096334: @ 0x08096334
push {r4, r5, r6, lr}
adds r5, r0, #0
movs r0, #1
strb r0, [r5, #0xc]
movs r4, #0
movs r6, #0x80
strh r6, [r5, #0x24]
ldr r0, _08096358 @ =gUnk_080FD2A8
str r0, [r5, #0x48]
ldrb r0, [r5, #0xa]
cmp r0, #1
bne _0809634E
b _08096494
_0809634E:
cmp r0, #1
bgt _0809635C
cmp r0, #0
beq _08096368
b _0809650A
.align 2, 0
_08096358: .4byte gUnk_080FD2A8
_0809635C:
cmp r0, #2
bne _08096362
b _080964A6
_08096362:
cmp r0, #3
beq _080963FC
b _0809650A
_08096368:
movs r0, #0x1a
bl CheckGlobalFlag
cmp r0, #0
beq _080963DA
movs r0, #0x1b
bl CheckGlobalFlag
cmp r0, #0
bne _080963A4
ldr r0, _0809639C @ =gPlayerEntity
movs r3, #0x80
lsls r3, r3, #9
adds r1, r5, #0
movs r2, #0
bl PositionRelative
ldr r0, _080963A0 @ =0x00004022
adds r1, r5, #0
adds r1, #0x38
ldrb r2, [r1]
movs r1, #0xdc
bl SetTile
b _0809650A
.align 2, 0
_0809639C: .4byte gPlayerEntity
_080963A0: .4byte 0x00004022
_080963A4:
ldrb r0, [r5, #0xb]
bl CheckLocalFlag
cmp r0, #0
bne _080963C8
adds r0, r5, #0
movs r1, #0xa
bl InitializeAnimation
ldrh r0, [r5, #0x32]
adds r0, #4
strh r0, [r5, #0x32]
movs r0, #4
strb r0, [r5, #0xc]
ldr r0, _080963C4 @ =0x0000403B
b _080964C4
.align 2, 0
_080963C4: .4byte 0x0000403B
_080963C8:
strb r4, [r5, #0xb]
movs r0, #2
strb r0, [r5, #0xf]
adds r0, r5, #0
bl sub_080969A4
bl DeleteThisEntity
b _0809650A
_080963DA:
ldr r1, _080963F8 @ =gRoomControls
ldrh r0, [r1, #6]
adds r0, #0xd0
strh r0, [r5, #0x2e]
ldrh r0, [r1, #8]
adds r0, #0x44
strh r0, [r5, #0x32]
movs r0, #4
strb r0, [r5, #0xc]
ldrb r1, [r5, #0xa]
adds r1, #3
adds r0, r5, #0
bl InitializeAnimation
b _0809651A
.align 2, 0
_080963F8: .4byte gRoomControls
_080963FC:
movs r0, #0x1a
bl CheckGlobalFlag
cmp r0, #0
beq _08096450
movs r0, #0x1b
bl CheckGlobalFlag
cmp r0, #0
bne _0809644C
ldr r0, _08096444 @ =gPlayerEntity
adds r1, r0, #0
adds r1, #0x29
ldrb r2, [r1]
lsls r2, r2, #0x1d
lsrs r2, r2, #0x1d
subs r2, #1
adds r4, r5, #0
adds r4, #0x29
movs r1, #7
ands r2, r1
ldrb r3, [r4]
movs r1, #8
rsbs r1, r1, #0
ands r1, r3
orrs r1, r2
strb r1, [r4]
adds r1, r0, #0
adds r1, #0x79
strb r6, [r1]
ldr r3, _08096448 @ =0xFFE80000
adds r1, r5, #0
movs r2, #0
bl PositionRelative
b _08096450
.align 2, 0
_08096444: .4byte gPlayerEntity
_08096448: .4byte 0xFFE80000
_0809644C:
bl DeleteThisEntity
_08096450:
adds r0, r5, #0
movs r1, #0x6b
movs r2, #1
movs r3, #0
bl CreateObjectWithParent
adds r1, r0, #0
str r1, [r5, #0x54]
cmp r1, #0
beq _0809646E
ldr r2, _0809648C @ =0xFFE40000
ldr r3, _08096490 @ =0xFFD80000
adds r0, r5, #0
bl PositionRelative
_0809646E:
movs r0, #0x10
strb r0, [r5, #0x16]
ldrb r0, [r5, #0x19]
movs r1, #3
orrs r0, r1
strb r0, [r5, #0x19]
adds r0, r5, #0
movs r1, #0xc
bl InitializeAnimation
adds r0, r5, #0
bl sub_0809651C
b _0809651A
.align 2, 0
_0809648C: .4byte 0xFFE40000
_08096490: .4byte 0xFFD80000
_08096494:
ldrb r0, [r5, #0x19]
movs r1, #3
orrs r0, r1
strb r0, [r5, #0x19]
adds r0, r5, #0
movs r1, #6
bl SetDefaultPriority
b _0809650A
_080964A6:
ldrb r0, [r5, #0xb]
bl CheckLocalFlag
cmp r0, #0
bne _080964F8
adds r0, r5, #0
movs r1, #0xb
bl InitializeAnimation
ldrh r0, [r5, #0x32]
adds r0, #4
strh r0, [r5, #0x32]
movs r0, #4
strb r0, [r5, #0xc]
ldr r0, _080964F0 @ =0x00004032
_080964C4:
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _080964F4 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl SetTile
b _0809651A
.align 2, 0
_080964F0: .4byte 0x00004032
_080964F4: .4byte gRoomControls
_080964F8:
strb r4, [r5, #0xb]
movs r0, #3
strb r0, [r5, #0xf]
adds r0, r5, #0
bl sub_080969A4
bl DeleteThisEntity
b _0809651A
_0809650A:
ldrb r1, [r5, #0xa]
adds r1, #3
adds r0, r5, #0
bl InitializeAnimation
adds r0, r5, #0
bl sub_0809651C
_0809651A:
pop {r4, r5, r6, pc}
thumb_func_start sub_0809651C
sub_0809651C: @ 0x0809651C
push {r4, r5, r6, r7, lr}
adds r6, r0, #0
ldrb r3, [r6, #0xa]
movs r0, #1
ands r0, r3
cmp r0, #0
beq _080965D6
cmp r3, #3
bne _0809653C
adds r0, r6, #0
bl sub_08078930
adds r0, r6, #0
bl sub_0800445C
b _080965C8
_0809653C:
ldr r0, [r6, #0x50]
ldr r2, _0809655C @ =0xFFE40000
ldr r3, _08096560 @ =0xFFD80000
adds r1, r6, #0
bl PositionRelative
ldr r1, [r6, #0x50]
ldrb r0, [r1, #0xc]
cmp r0, #2
bne _08096586
ldrb r0, [r1, #0xd]
cmp r0, #1
beq _08096564
cmp r0, #2
beq _08096580
b _08096570
.align 2, 0
_0809655C: .4byte 0xFFE40000
_08096560: .4byte 0xFFD80000
_08096564:
ldr r0, _0809657C @ =gPlayerState
ldrb r1, [r0, #0xd]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _08096580
_08096570:
adds r0, r6, #0
movs r1, #4
bl InitializeAnimation
b _08096586
.align 2, 0
_0809657C: .4byte gPlayerState
_08096580:
adds r0, r6, #0
bl GetNextFrame
_08096586:
ldr r0, [r6, #0x50]
adds r0, #0x29
ldrb r1, [r0]
lsls r1, r1, #0x1d
lsrs r1, r1, #0x1d
subs r1, #1
adds r3, r6, #0
adds r3, #0x29
movs r0, #7
ands r1, r0
ldrb r2, [r3]
movs r0, #8
rsbs r0, r0, #0
ands r0, r2
orrs r0, r1
strb r0, [r3]
ldr r4, [r6, #0x50]
ldrb r2, [r4, #0x19]
lsrs r2, r2, #6
lsls r2, r2, #6
ldrb r3, [r6, #0x19]
movs r1, #0x3f
adds r0, r1, #0
ands r0, r3
orrs r0, r2
strb r0, [r6, #0x19]
ldrb r0, [r4, #0x1b]
lsrs r0, r0, #6
lsls r0, r0, #6
ldrb r2, [r6, #0x1b]
ands r1, r2
orrs r1, r0
strb r1, [r6, #0x1b]
_080965C8:
adds r0, r6, #0
movs r1, #0xcc
movs r2, #0xcc
movs r3, #0
bl sub_0805EC9C
b _080966F6
_080965D6:
ldr r1, _080965FC @ =gPlayerState
ldrb r2, [r1, #0x1a]
movs r0, #0x80
orrs r0, r2
strb r0, [r1, #0x1a]
movs r0, #5
strb r0, [r1, #5]
ldrb r1, [r1, #0xd]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _08096600
lsls r1, r3, #0x18
lsrs r1, r1, #0x19
adds r1, #3
adds r0, r6, #0
bl InitializeAnimation
b _08096606
.align 2, 0
_080965FC: .4byte gPlayerState
_08096600:
adds r0, r6, #0
bl GetNextFrame
_08096606:
ldr r0, _08096664 @ =gPlayerEntity
ldrb r0, [r0, #0x14]
movs r1, #6
ands r1, r0
ldr r4, _08096668 @ =gUnk_08123184
adds r0, r1, r4
ldrb r0, [r0]
lsls r0, r0, #0x18
asrs r0, r0, #0x18
ldrh r2, [r6, #0x2e]
adds r0, r0, r2
movs r2, #0x10
rsbs r2, r2, #0
adds r3, r2, #0
ands r0, r3
movs r2, #8
adds r5, r6, #0
adds r5, #0x70
movs r7, #0
orrs r0, r2
strh r0, [r5]
adds r1, #1
adds r1, r1, r4
movs r0, #0
ldrsb r0, [r1, r0]
ldrh r1, [r6, #0x32]
adds r0, r0, r1
ands r0, r3
orrs r0, r2
adds r1, r6, #0
adds r1, #0x72
strh r0, [r1]
ldrh r0, [r5]
ldrh r1, [r1]
adds r4, r6, #0
adds r4, #0x38
ldrb r2, [r4]
bl sub_080002BC
cmp r0, #0x19
bne _08096670
ldr r0, _0809666C @ =gUnk_0200AF00
adds r0, #0x2f
movs r1, #3
strb r1, [r0]
b _08096676
.align 2, 0
_08096664: .4byte gPlayerEntity
_08096668: .4byte gUnk_08123184
_0809666C: .4byte gUnk_0200AF00
_08096670:
ldr r0, _080966F8 @ =gUnk_0200AF00
adds r0, #0x2f
strb r7, [r0]
_08096676:
ldr r0, _080966FC @ =gPlayerEntity
movs r3, #0x80
lsls r3, r3, #9
adds r1, r6, #0
movs r2, #0
bl PositionRelative
adds r0, r6, #0
bl sub_080002B8
cmp r0, #0x19
bne _0809669C
ldrb r1, [r4]
movs r0, #0xdc
bl sub_0807BA8C
adds r0, r6, #0
bl sub_08096A78
_0809669C:
ldr r2, _08096700 @ =gPlayerState
adds r0, r2, #0
adds r0, #0x92
ldrh r1, [r0]
movs r0, #0xc0
ands r0, r1
cmp r0, #0
beq _080966F6
ldr r0, _080966F8 @ =gUnk_0200AF00
adds r0, #0x2f
ldrb r0, [r0]
cmp r0, #3
bne _080966F6
movs r0, #0
strb r0, [r2, #5]
movs r0, #5
strb r0, [r6, #0xc]
adds r0, #0xfb
strh r0, [r6, #0x24]
movs r0, #0x80
lsls r0, r0, #0xa
str r0, [r6, #0x20]
adds r2, r6, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
movs r1, #8
orrs r0, r1
strb r0, [r2]
ldrb r1, [r6, #0x18]
movs r0, #0x31
rsbs r0, r0, #0
ands r0, r1
movs r1, #0x10
orrs r0, r1
strb r0, [r6, #0x18]
ldrb r1, [r4]
movs r0, #0xdc
bl sub_0807BA8C
movs r0, #0x79
bl SoundReq
_080966F6:
pop {r4, r5, r6, r7, pc}
.align 2, 0
_080966F8: .4byte gUnk_0200AF00
_080966FC: .4byte gPlayerEntity
_08096700: .4byte gPlayerState
thumb_func_start sub_08096704
sub_08096704: @ 0x08096704
push {lr}
ldr r2, _08096718 @ =gUnk_0812318C
ldrb r1, [r0, #0xd]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08096718: .4byte gUnk_0812318C
thumb_func_start sub_0809671C
sub_0809671C: @ 0x0809671C
push {r4, lr}
adds r4, r0, #0
movs r0, #0x1a
bl SetGlobalFlag
ldrb r0, [r4, #0xd]
adds r0, #1
strb r0, [r4, #0xd]
pop {r4, pc}
.align 2, 0
thumb_func_start nullsub_121
nullsub_121: @ 0x08096730
bx lr
.align 2, 0
thumb_func_start sub_08096734
sub_08096734: @ 0x08096734
push {lr}
movs r0, #0x1a
bl ClearGlobalFlag
pop {pc}
.align 2, 0
thumb_func_start sub_08096740
sub_08096740: @ 0x08096740
push {r4, lr}
adds r4, r0, #0
movs r0, #0x10
movs r1, #0
bl InitScreenShake
movs r1, #0
movs r0, #1
strb r0, [r4, #0xc]
strb r1, [r4, #0xd]
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08096758
sub_08096758: @ 0x08096758
push {r4, lr}
adds r4, r0, #0
bl UpdateAnimationSingleFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _0809677C
ldrb r0, [r4, #0xc]
adds r0, #1
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #0xa
bl InitializeAnimation
_0809677C:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08096780
sub_08096780: @ 0x08096780
push {r4, r5, lr}
adds r5, r0, #0
ldr r1, _080967D4 @ =gUnk_0812319C
ldrb r0, [r5, #0xa]
lsrs r0, r0, #1
lsls r0, r0, #1
adds r0, r0, r1
ldrh r4, [r0]
adds r0, r5, #0
bl GetTileTypeByEntity
cmp r4, r0
bne _080967DC
adds r0, r5, #0
bl GetNextFrame
ldr r2, _080967D8 @ =gPlayerState
ldrb r0, [r2, #0xb]
movs r1, #0x80
orrs r0, r1
strb r0, [r2, #0xb]
ldrb r0, [r2, #0xa]
orrs r0, r1
strb r0, [r2, #0xa]
ldrb r0, [r2, #7]
orrs r1, r0
strb r1, [r2, #7]
ldrb r0, [r5, #0xe]
subs r0, #1
strb r0, [r5, #0xe]
lsls r0, r0, #0x18
lsrs r1, r0, #0x18
cmp r1, #0
bne _080967E0
movs r0, #6
strb r0, [r5, #0xc]
strb r1, [r5, #0xd]
adds r0, r5, #0
bl CreateDust
b _080967E0
.align 2, 0
_080967D4: .4byte gUnk_0812319C
_080967D8: .4byte gPlayerState
_080967DC:
movs r0, #0xc0
strb r0, [r5, #0xe]
_080967E0:
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_080967E4
sub_080967E4: @ 0x080967E4
push {r4, r5, lr}
adds r4, r0, #0
adds r0, #0x70
ldrh r5, [r0]
movs r0, #0x2e
ldrsh r2, [r4, r0]
cmp r5, r2
bne _08096802
adds r0, r4, #0
adds r0, #0x72
ldrh r1, [r0]
movs r3, #0x32
ldrsh r0, [r4, r3]
cmp r1, r0
beq _0809681C
_08096802:
movs r0, #0x32
ldrsh r1, [r4, r0]
adds r0, r4, #0
adds r0, #0x72
ldrh r3, [r0]
adds r0, r2, #0
adds r2, r5, #0
bl CalculateDirectionTo
strb r0, [r4, #0x15]
adds r0, r4, #0
bl LinearMoveUpdate
_0809681C:
movs r1, #0x80
lsls r1, r1, #7
adds r0, r4, #0
bl GravityUpdate
cmp r0, #0
bne _08096830
adds r0, r4, #0
bl sub_08096A78
_08096830:
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_08096834
sub_08096834: @ 0x08096834
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xd]
cmp r0, #2
beq _08096842
bl sub_08078B48
_08096842:
ldr r0, _08096854 @ =gUnk_081231A0
ldrb r1, [r4, #0xd]
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r4, #0
bl _call_via_r1
pop {r4, pc}
.align 2, 0
_08096854: .4byte gUnk_081231A0
thumb_func_start sub_08096858
sub_08096858: @ 0x08096858
push {r4, r5, r6, lr}
adds r5, r0, #0
ldrb r0, [r5, #0xb]
bl SetLocalFlag
movs r3, #0
movs r0, #0xf
strb r0, [r5, #0xe]
ldr r1, _080968BC @ =gUnk_081231AC
ldrb r2, [r5, #0xa]
lsls r2, r2, #0x18
lsrs r0, r2, #0x19
adds r0, r0, r1
ldrb r0, [r0]
strb r0, [r5, #0xf]
strb r3, [r5, #0xb]
ldrb r1, [r5, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
strb r0, [r5, #0x18]
ldrb r0, [r5, #0xd]
adds r0, #1
strb r0, [r5, #0xd]
cmp r2, #0
bne _080968C4
movs r0, #0xe7
lsls r0, r0, #1
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _080968C0 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl sub_0807B7D8
b _080968F0
.align 2, 0
_080968BC: .4byte gUnk_081231AC
_080968C0: .4byte gRoomControls
_080968C4:
ldr r0, _080968F8 @ =0x000001CD
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _080968FC @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl sub_0807B7D8
_080968F0:
ldr r0, _08096900 @ =0x000001DB
bl SoundReq
pop {r4, r5, r6, pc}
.align 2, 0
_080968F8: .4byte 0x000001CD
_080968FC: .4byte gRoomControls
_08096900: .4byte 0x000001DB
thumb_func_start sub_08096904
sub_08096904: @ 0x08096904
push {r4, r5, r6, lr}
adds r5, r0, #0
ldrb r0, [r5, #0xe]
subs r0, #1
strb r0, [r5, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _08096984
ldrh r0, [r5, #0x32]
subs r0, #0x10
strh r0, [r5, #0x32]
ldr r1, _08096974 @ =gUnk_081231AE
ldrb r0, [r5, #0xb]
lsls r0, r0, #1
adds r0, r0, r1
ldrh r0, [r0]
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _08096978 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl sub_0807B7D8
ldrb r0, [r5, #0xb]
adds r0, #1
strb r0, [r5, #0xb]
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
ldrb r1, [r5, #0xf]
cmp r0, r1
bne _08096980
ldr r2, _0809697C @ =gPlayerState
ldrb r1, [r2, #0xb]
movs r0, #0x7f
ands r0, r1
strb r0, [r2, #0xb]
ldrb r0, [r5, #0xd]
adds r0, #1
strb r0, [r5, #0xd]
movs r0, #0x3c
b _08096982
.align 2, 0
_08096974: .4byte gUnk_081231AE
_08096978: .4byte gRoomControls
_0809697C: .4byte gPlayerState
_08096980:
movs r0, #0xf
_08096982:
strb r0, [r5, #0xe]
_08096984:
pop {r4, r5, r6, pc}
.align 2, 0
thumb_func_start sub_08096988
sub_08096988: @ 0x08096988
push {lr}
adds r1, r0, #0
ldrb r0, [r1, #0xe]
cmp r0, #0
beq _080969A2
subs r0, #1
strb r0, [r1, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _080969A2
movs r0, #0x72
bl SoundReq
_080969A2:
pop {pc}
thumb_func_start sub_080969A4
sub_080969A4: @ 0x080969A4
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
adds r5, r0, #0
ldrb r0, [r5, #0xa]
cmp r0, #0
bne _080969E8
movs r0, #0xe7
lsls r0, r0, #1
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _080969E4 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r4, r5, #0
adds r4, #0x38
ldrb r2, [r4]
bl sub_0807B7D8
b _08096A14
.align 2, 0
_080969E4: .4byte gRoomControls
_080969E8:
ldr r0, _08096A6C @ =0x000001CD
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _08096A70 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r4, r5, #0
adds r4, #0x38
ldrb r2, [r4]
bl sub_0807B7D8
_08096A14:
ldrb r0, [r5, #0xb]
ldrb r1, [r5, #0xf]
cmp r0, r1
beq _08096A64
ldr r2, _08096A74 @ =gUnk_081231B4
mov r8, r2
ldr r7, _08096A70 @ =gRoomControls
movs r6, #0x3f
_08096A24:
ldrh r0, [r5, #0x32]
subs r0, #0x10
strh r0, [r5, #0x32]
ldrb r0, [r5, #0xb]
lsls r0, r0, #1
add r0, r8
ldrh r0, [r0]
movs r3, #0x2e
ldrsh r1, [r5, r3]
ldrh r2, [r7, #6]
subs r1, r1, r2
asrs r1, r1, #4
ands r1, r6
movs r3, #0x32
ldrsh r2, [r5, r3]
ldrh r3, [r7, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r6
lsls r2, r2, #6
orrs r1, r2
ldrb r2, [r4]
bl sub_0807B7D8
ldrb r0, [r5, #0xb]
adds r0, #1
strb r0, [r5, #0xb]
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
ldrb r1, [r5, #0xf]
cmp r0, r1
bne _08096A24
_08096A64:
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7, pc}
.align 2, 0
_08096A6C: .4byte 0x000001CD
_08096A70: .4byte gRoomControls
_08096A74: .4byte gUnk_081231B4
thumb_func_start sub_08096A78
sub_08096A78: @ 0x08096A78
push {r4, r5, r6, lr}
adds r4, r0, #0
movs r0, #0x1b
bl SetGlobalFlag
ldrb r1, [r4, #0xa]
lsrs r1, r1, #1
adds r1, #8
adds r0, r4, #0
bl InitAnimationForceUpdate
adds r0, r4, #0
bl sub_08004168
ldrh r0, [r4, #0x32]
adds r0, #4
strh r0, [r4, #0x32]
movs r0, #3
strb r0, [r4, #0xc]
ldr r0, _08096ACC @ =0x0000403B
movs r2, #0x2e
ldrsh r1, [r4, r2]
ldr r3, _08096AD0 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r5, #0x3f
ands r1, r5
movs r6, #0x32
ldrsh r2, [r4, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r5
lsls r2, r2, #6
orrs r1, r2
adds r4, #0x38
ldrb r2, [r4]
bl SetTile
pop {r4, r5, r6, pc}
.align 2, 0
_08096ACC: .4byte 0x0000403B
_08096AD0: .4byte gRoomControls

View File

@ -44782,72 +44782,47 @@
"size": 16
},
{
"path": "animations/gSpriteAnimations_CrenalBeanSprout_0.bin",
"path": "animations/gSpriteAnimations_CrenelBeanSprout_0.bin",
"start": 1192378,
"size": 5,
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_CrenalBeanSprout_3.bin",
"path": "animations/gSpriteAnimations_CrenelBeanSprout_3.bin",
"start": 1192383,
"size": 13,
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_CrenalBeanSprout_6.bin",
"path": "animations/gSpriteAnimations_CrenelBeanSprout_6.bin",
"start": 1192396,
"size": 9,
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_CrenalBeanSprout_8.bin",
"path": "animations/gSpriteAnimations_CrenelBeanSprout_8.bin",
"start": 1192405,
"size": 17,
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_CrenalBeanSprout_10.bin",
"path": "animations/gSpriteAnimations_CrenelBeanSprout_10.bin",
"start": 1192422,
"size": 21,
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_CrenalBeanSprout_1.bin",
"path": "animations/gSpriteAnimations_CrenelBeanSprout_1.bin",
"start": 1192443,
"size": 9,
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_CrenalBeanSprout_12.bin",
"path": "animations/gSpriteAnimations_CrenelBeanSprout_12.bin",
"start": 1192452,
"size": 4,
"type": "animation"
},
{
"path": "crenalBeanSprout/gUnk_08123184.bin",
"start": 1192324,
"size": 8
},
{
"path": "crenalBeanSprout/gUnk_0812319C.bin",
"start": 1192348,
"size": 4
},
{
"path": "crenalBeanSprout/gUnk_081231AC.bin",
"start": 1192364,
"size": 2
},
{
"path": "crenalBeanSprout/gUnk_081231AE.bin",
"start": 1192366,
"size": 6
},
{
"path": "crenalBeanSprout/gUnk_081231B4.bin",
"start": 1192372,
"size": 6
},
{
"path": "mineralWaterSource/MineralWaterSourceParameters.bin",
"start": 1192608,
@ -45592,46 +45567,6 @@
"start": 1199820,
"size": 4
},
{
"path": "gyorgBossObject/gUnk_08124F08.bin",
"start": 1199880,
"size": 32
},
{
"path": "gyorgBossObject/gUnk_08124F28.bin",
"start": 1199912,
"size": 32
},
{
"path": "gyorgBossObject/gUnk_08124F48.bin",
"start": 1199944,
"size": 32
},
{
"path": "gyorgBossObject/gUnk_08124F68.bin",
"start": 1199976,
"size": 32
},
{
"path": "gyorgBossObject/gUnk_08124F88.bin",
"start": 1200008,
"size": 32
},
{
"path": "gyorgBossObject/gUnk_08124FA8.bin",
"start": 1200040,
"size": 32
},
{
"path": "gyorgBossObject/gUnk_08124FC8.bin",
"start": 1200072,
"size": 20
},
{
"path": "gyorgBossObject/gUnk_08124FDC.bin",
"start": 1200092,
"size": 20
},
{
"path": "windcrest/gUnk_08125010.bin",
"start": 1200144,

View File

@ -1,41 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
@ .align 2
gSpriteAnimations_CrenalBeanSprout_0:: @ 081231BA
.include "animations/gSpriteAnimations_CrenalBeanSprout_0.s"
gSpriteAnimations_CrenalBeanSprout_3:: @ 081231BF
.include "animations/gSpriteAnimations_CrenalBeanSprout_3.s"
gSpriteAnimations_CrenalBeanSprout_6:: @ 081231CC
.include "animations/gSpriteAnimations_CrenalBeanSprout_6.s"
gSpriteAnimations_CrenalBeanSprout_8:: @ 081231D5
.include "animations/gSpriteAnimations_CrenalBeanSprout_8.s"
gSpriteAnimations_CrenalBeanSprout_10:: @ 081231E6
.include "animations/gSpriteAnimations_CrenalBeanSprout_10.s"
gSpriteAnimations_CrenalBeanSprout_1:: @ 081231FB
.include "animations/gSpriteAnimations_CrenalBeanSprout_1.s"
gSpriteAnimations_CrenalBeanSprout_12:: @ 08123204
.include "animations/gSpriteAnimations_CrenalBeanSprout_12.s"
gSpriteAnimations_CrenalBeanSprout:: @ 08123208
.4byte gSpriteAnimations_CrenalBeanSprout_0
.4byte gSpriteAnimations_CrenalBeanSprout_1
.4byte gSpriteAnimations_CrenalBeanSprout_0
.4byte gSpriteAnimations_CrenalBeanSprout_3
.4byte gSpriteAnimations_CrenalBeanSprout_1
.4byte gSpriteAnimations_CrenalBeanSprout_3
.4byte gSpriteAnimations_CrenalBeanSprout_6
.4byte gSpriteAnimations_CrenalBeanSprout_6
.4byte gSpriteAnimations_CrenalBeanSprout_8
.4byte gSpriteAnimations_CrenalBeanSprout_8
.4byte gSpriteAnimations_CrenalBeanSprout_10
.4byte gSpriteAnimations_CrenalBeanSprout_10
.4byte gSpriteAnimations_CrenalBeanSprout_12

View File

@ -0,0 +1,41 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
@ .align 2
gSpriteAnimations_CrenelBeanSprout_0:: @ 081231BA
.include "animations/gSpriteAnimations_CrenelBeanSprout_0.s"
gSpriteAnimations_CrenelBeanSprout_3:: @ 081231BF
.include "animations/gSpriteAnimations_CrenelBeanSprout_3.s"
gSpriteAnimations_CrenelBeanSprout_6:: @ 081231CC
.include "animations/gSpriteAnimations_CrenelBeanSprout_6.s"
gSpriteAnimations_CrenelBeanSprout_8:: @ 081231D5
.include "animations/gSpriteAnimations_CrenelBeanSprout_8.s"
gSpriteAnimations_CrenelBeanSprout_10:: @ 081231E6
.include "animations/gSpriteAnimations_CrenelBeanSprout_10.s"
gSpriteAnimations_CrenelBeanSprout_1:: @ 081231FB
.include "animations/gSpriteAnimations_CrenelBeanSprout_1.s"
gSpriteAnimations_CrenelBeanSprout_12:: @ 08123204
.include "animations/gSpriteAnimations_CrenelBeanSprout_12.s"
gSpriteAnimations_CrenelBeanSprout:: @ 08123208
.4byte gSpriteAnimations_CrenelBeanSprout_0
.4byte gSpriteAnimations_CrenelBeanSprout_1
.4byte gSpriteAnimations_CrenelBeanSprout_0
.4byte gSpriteAnimations_CrenelBeanSprout_3
.4byte gSpriteAnimations_CrenelBeanSprout_1
.4byte gSpriteAnimations_CrenelBeanSprout_3
.4byte gSpriteAnimations_CrenelBeanSprout_6
.4byte gSpriteAnimations_CrenelBeanSprout_6
.4byte gSpriteAnimations_CrenelBeanSprout_8
.4byte gSpriteAnimations_CrenelBeanSprout_8
.4byte gSpriteAnimations_CrenelBeanSprout_10
.4byte gSpriteAnimations_CrenelBeanSprout_10
.4byte gSpriteAnimations_CrenelBeanSprout_12

View File

@ -1,40 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08123168:: @ 08123168
.4byte sub_08096334
.4byte sub_0809651C
.4byte sub_08096704
.4byte sub_08096758
.4byte sub_08096780
.4byte sub_080967E4
.4byte sub_08096834
gUnk_08123184:: @ 08123184
.incbin "crenalBeanSprout/gUnk_08123184.bin"
gUnk_0812318C:: @ 0812318C
.4byte sub_0809671C
.4byte nullsub_121
.4byte sub_08096734
.4byte sub_08096740
gUnk_0812319C:: @ 0812319C
.incbin "crenalBeanSprout/gUnk_0812319C.bin"
gUnk_081231A0:: @ 081231A0
.4byte sub_08096858
.4byte sub_08096904
.4byte sub_08096988
gUnk_081231AC:: @ 081231AC
.incbin "crenalBeanSprout/gUnk_081231AC.bin"
gUnk_081231AE:: @ 081231AE
.incbin "crenalBeanSprout/gUnk_081231AE.bin"
gUnk_081231B4:: @ 081231B4
.incbin "crenalBeanSprout/gUnk_081231B4.bin"

View File

@ -1095,7 +1095,7 @@ gSpritePtrs:: @ 080029B4
.4byte 00000000
.4byte 00000000
.4byte gSpriteAnimations_CrenalBeanSprout
.4byte gSpriteAnimations_CrenelBeanSprout
.4byte 00000000
.4byte 00000000
.4byte 00000000

View File

@ -321,7 +321,7 @@ typedef enum {
SPRITE_WATERDROP,
SPRITE_WALLMASTER,
SPRITE_DIRTBALLPROJECTILE,
SPRITE_CRENALBEANSPROUT,
SPRITE_CRENELBEANSPROUT,
SPRITE_BOMBPEAHAT,
SPRITE_SPARK,
SPRITE_CHASER,

View File

@ -137,7 +137,7 @@ typedef enum {
OBJECT_68,
OBJECT_69,
OBJECT_6A,
CRENAL_BEAN_SPROUT,
CRENEL_BEAN_SPROUT,
MINECART_DOOR,
OBJECT_ON_PILLAR,
MINERAL_WATER_SOURCE,
@ -333,7 +333,7 @@ void Object67(Entity*);
void Object68(Entity*);
void Object69(Entity*);
void Object6A(Entity*);
void CrenalBeanSprout(Entity*);
void CrenelBeanSprout();
void MinecartDoor(Entity*);
void ObjectOnPillar();
void MineralWaterSource(Entity*);

View File

@ -754,7 +754,7 @@ SECTIONS {
asm/object/object68.o(.text);
asm/object/object69.o(.text);
src/object/object6A.o(.text);
asm/object/crenalBeanSprout.o(.text);
src/object/crenelBeanSprout.o(.text);
asm/object/minecartDoor.o(.text);
src/object/objectOnPillar.o(.text);
src/object/mineralWaterSource.o(.text);
@ -1499,8 +1499,8 @@ SECTIONS {
src/object/object6A.o(.rodata);
data/const/object/object6A.o(.rodata);
data/animations/object/object6A.o(.rodata);
data/const/object/crenalBeanSprout.o(.rodata);
data/animations/object/crenalBeanSprout.o(.rodata);
src/object/crenelBeanSprout.o(.rodata);
data/animations/object/crenelBeanSprout.o(.rodata);
data/const/object/minecartDoor.o(.rodata);
src/object/objectOnPillar.o(.rodata);
data/const/object/mineralWaterSource.o(.rodata);

View File

@ -109,7 +109,7 @@ void (*const gObjectFunctions[])(Entity*) = {
[OBJECT_68] = Object68,
[OBJECT_69] = Object69,
[OBJECT_6A] = Object6A,
[CRENAL_BEAN_SPROUT] = CrenalBeanSprout,
[CRENEL_BEAN_SPROUT] = CrenelBeanSprout,
[MINECART_DOOR] = MinecartDoor,
[OBJECT_ON_PILLAR] = ObjectOnPillar,
[MINERAL_WATER_SOURCE] = MineralWaterSource,

View File

@ -0,0 +1,339 @@
/**
* @file crenelBeanSprout.c
* @ingroup Objects
*
* @brief Crenel Bean Sprout object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[8];
/*0x70*/ u16 unk_70;
/*0x72*/ u16 unk_72;
} CrenelBeanSproutEntity;
extern u32 sub_080002BC(s32, s32, u32);
extern Hitbox gUnk_080FD2A8;
void sub_080969A4(CrenelBeanSproutEntity*);
void sub_08096A78(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Init(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action1(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action2(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action3(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action4(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action5(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action6(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action2SubAction0(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action2SubAction1(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action2SubAction2(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action2SubAction3(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action6SubAction0(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action6SubAction1(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Action6SubAction2(CrenelBeanSproutEntity*);
void CrenelBeanSprout(CrenelBeanSproutEntity* this) {
static void (*const CrenelBeanSprout_Actions[])(CrenelBeanSproutEntity*) = {
CrenelBeanSprout_Init, CrenelBeanSprout_Action1, CrenelBeanSprout_Action2, CrenelBeanSprout_Action3,
CrenelBeanSprout_Action4, CrenelBeanSprout_Action5, CrenelBeanSprout_Action6,
};
CrenelBeanSprout_Actions[super->action](this);
}
void CrenelBeanSprout_Init(CrenelBeanSproutEntity* this) {
Entity* obj;
u32 tmp;
super->action = 1;
tmp = super->speed = 0x80;
super->hitbox = (Hitbox*)&gUnk_080FD2A8;
switch (super->type) {
case 0:
if (CheckGlobalFlag(WATERBEAN_OUT)) {
if (CheckGlobalFlag(WATERBEAN_PUT) == 0) {
PositionRelative(&gPlayerEntity, super, 0, 0x10000);
SetTile(0x4022, 0xdc, super->collisionLayer);
} else {
if (CheckLocalFlag(super->type2) == 0) {
InitializeAnimation(super, 10);
super->y.HALF.HI += 4;
super->action = 4;
SetTile(0x403b, COORD_TO_TILE(super), super->collisionLayer);
return;
}
super->type2 = 0;
super->field_0xf = 2;
sub_080969A4(this);
DeleteThisEntity();
}
} else {
super->x.HALF.HI = gRoomControls.origin_x + 0xd0;
super->y.HALF.HI = gRoomControls.origin_y + 0x44;
super->action = 4;
InitializeAnimation(super, super->type + 3);
return;
}
break;
case 3:
if (CheckGlobalFlag(WATERBEAN_OUT)) {
if (CheckGlobalFlag(WATERBEAN_PUT) == 0) {
super->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1;
*(((u8*)&gPlayerEntity) + 0x79) = tmp;
PositionRelative(&gPlayerEntity, super, 0, -0x180000);
} else {
DeleteThisEntity();
}
}
obj = CreateObjectWithParent(super, CRENEL_BEAN_SPROUT, 1, 0);
super->child = obj;
if (obj != NULL) {
PositionRelative(super, obj, -0x1c0000, -0x280000);
}
super->field_0x16 = 0x10;
super->spriteRendering.b0 = 3;
InitializeAnimation(super, 0xc);
CrenelBeanSprout_Action1(this);
return;
break;
case 1:
super->spriteRendering.b0 = 3;
SetDefaultPriority(super, 6);
break;
case 2:
if (CheckLocalFlag((u32)super->type2) == 0) {
InitializeAnimation(super, 0xb);
super->y.HALF.HI += 4;
super->action = 4;
SetTile(0x4032, COORD_TO_TILE(super), super->collisionLayer);
return;
} else {
super->type2 = 0;
super->field_0xf = 3;
sub_080969A4(this);
DeleteThisEntity();
return;
}
break;
}
InitializeAnimation(super, super->type + 3);
CrenelBeanSprout_Action1(this);
}
void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
static const u8 gUnk_08123184[] = {
0, 240, 16, 0, 0, 16, 240, 0,
};
Entity* parent;
u32 tmp;
if ((super->type & 1) != 0) {
if (super->type == 3) {
sub_08078930(super);
sub_0800445C(super);
} else {
PositionRelative(super->parent, super, -0x1c0000, -0x280000);
if (super->parent->action == 2) {
switch (super->parent->subAction) {
case 1:
if ((gPlayerState.field_0xd & 0x80) != 0) {
InitializeAnimation(super, 4);
} else {
GetNextFrame(super);
}
break;
case 2:
GetNextFrame(super);
break;
default:
InitializeAnimation(super, 4);
break;
}
}
super->spritePriority.b0 = super->parent->spritePriority.b0 - 1;
parent = super->parent;
super->spriteRendering.b3 = parent->spriteRendering.b3;
super->spriteOrientation.flipY = parent->spriteOrientation.flipY;
}
sub_0805EC9C(super, 0xcc, 0xcc, 0);
} else {
gPlayerState.mobility |= 0x80;
gPlayerState.heldObject = 5;
if ((gPlayerState.field_0xd & 0x80) != 0) {
InitializeAnimation(super, (super->type >> 1) + 3);
} else {
GetNextFrame(super);
}
tmp = gPlayerEntity.animationState & 6;
this->unk_70 = ((super->x.HALF.HI + (s8)gUnk_08123184[tmp]) & -0x10) | 8;
this->unk_72 = ((super->y.HALF.HI + (s8)gUnk_08123184[(tmp) + 1]) & -0x10) | 8;
if (sub_080002BC(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) {
gUnk_0200AF00.filler25[10] = 3;
} else {
gUnk_0200AF00.filler25[10] = 0;
}
PositionRelative(&gPlayerEntity, super, 0, 0x10000);
if (sub_080002B8(super) == 0x19) {
sub_0807BA8C(0xdc, super->collisionLayer);
sub_08096A78(this);
}
if ((gPlayerState.field_0x92 & 0xc0) == 0) {
return;
}
if (gUnk_0200AF00.filler25[10] != 3) {
return;
}
gPlayerState.heldObject = 0;
super->action = 5;
super->speed = 0x100;
super->zVelocity = 0x20000;
super->spritePriority.b1 = 1;
super->spriteSettings.shadow = 1;
sub_0807BA8C(0xdc, super->collisionLayer);
SoundReq(SFX_PLY_VO5);
}
}
void CrenelBeanSprout_Action2(CrenelBeanSproutEntity* this) {
static void (*const CrenelBeanSprout_Action2SubActions[])(CrenelBeanSproutEntity*) = {
CrenelBeanSprout_Action2SubAction0,
CrenelBeanSprout_Action2SubAction1,
CrenelBeanSprout_Action2SubAction2,
CrenelBeanSprout_Action2SubAction3,
};
CrenelBeanSprout_Action2SubActions[super->subAction](this);
}
void CrenelBeanSprout_Action2SubAction0(CrenelBeanSproutEntity* this) {
SetGlobalFlag(WATERBEAN_OUT);
super->subAction++;
}
void CrenelBeanSprout_Action2SubAction1(CrenelBeanSproutEntity* this) {
}
void CrenelBeanSprout_Action2SubAction2(CrenelBeanSproutEntity* this) {
ClearGlobalFlag(WATERBEAN_OUT);
}
void CrenelBeanSprout_Action2SubAction3(CrenelBeanSproutEntity* this) {
InitScreenShake(0x10, 0);
super->action = 1;
super->subAction = 0;
}
void CrenelBeanSprout_Action3(CrenelBeanSproutEntity* this) {
UpdateAnimationSingleFrame(super);
if ((super->frame & 0x80) != 0) {
super->action++;
InitializeAnimation(super, 10);
}
}
void CrenelBeanSprout_Action4(CrenelBeanSproutEntity* this) {
static const u16 gUnk_0812319C[] = { 0x403c, 0x4033 };
if (gUnk_0812319C[super->type >> 1] == GetTileTypeByEntity(super)) {
GetNextFrame(super);
gPlayerState.keepFacing |= 0x80;
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x7 |= 0x80;
if (--super->actionDelay == 0) {
super->action = 6;
super->subAction = 0;
CreateDust(super);
}
} else {
super->actionDelay = 0xc0;
}
}
void CrenelBeanSprout_Action5(CrenelBeanSproutEntity* this) {
if ((this->unk_70 != super->x.HALF.HI) || (this->unk_72 != super->y.HALF.HI)) {
super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_70, this->unk_72);
LinearMoveUpdate(super);
}
if (GravityUpdate(super, 0x4000) == 0) {
sub_08096A78(this);
}
}
void CrenelBeanSprout_Action6(CrenelBeanSproutEntity* this) {
static void (*const CrenelBeanSprout_Action6SubActions[])(CrenelBeanSproutEntity*) = {
CrenelBeanSprout_Action6SubAction0,
CrenelBeanSprout_Action6SubAction1,
CrenelBeanSprout_Action6SubAction2,
};
if (super->subAction != 2) {
sub_08078B48();
}
CrenelBeanSprout_Action6SubActions[super->subAction](this);
}
void CrenelBeanSprout_Action6SubAction0(CrenelBeanSproutEntity* this) {
static const u8 gUnk_081231AC[] = {
2,
3,
};
SetLocalFlag(super->type2);
super->actionDelay = 0x0f;
super->field_0xf = gUnk_081231AC[super->type >> 1];
super->type2 = 0;
super->spriteSettings.draw = 0;
super->subAction++;
if (super->type == 0) {
sub_0807B7D8(0x1ce, COORD_TO_TILE(super), super->collisionLayer);
} else {
sub_0807B7D8(0x1cd, COORD_TO_TILE(super), super->collisionLayer);
}
SoundReq(SFX_1DB);
}
void CrenelBeanSprout_Action6SubAction1(CrenelBeanSproutEntity* this) {
static const u16 gUnk_081231AE[] = { 0x1cc, 0x1cb, 0x1c9 };
if (--super->actionDelay == 0) {
super->y.HALF.HI += -0x10;
sub_0807B7D8(gUnk_081231AE[super->type2], COORD_TO_TILE(super), super->collisionLayer);
super->type2++;
if (super->type2 == super->field_0xf) {
gPlayerState.keepFacing &= 0x7f;
super->subAction++;
super->actionDelay = 0x3c;
} else {
super->actionDelay = 0x0f;
}
}
}
void CrenelBeanSprout_Action6SubAction2(CrenelBeanSproutEntity* this) {
if ((super->actionDelay != 0) && (--super->actionDelay == 0)) {
SoundReq(SFX_SECRET);
}
}
void sub_080969A4(CrenelBeanSproutEntity* this) {
static const u16 gUnk_081231B4[] = { 0x1cc, 0x1cb, 0x1c9 };
if (super->type == 0) {
sub_0807B7D8(0x1ce, COORD_TO_TILE(super), super->collisionLayer);
} else {
sub_0807B7D8(0x1cd, COORD_TO_TILE(super), super->collisionLayer);
}
while (super->type2 != super->field_0xf) {
super->y.HALF.HI -= 0x10;
sub_0807B7D8(gUnk_081231B4[super->type2], COORD_TO_TILE(super), super->collisionLayer);
super->type2++;
}
}
void sub_08096A78(CrenelBeanSproutEntity* this) {
SetGlobalFlag(WATERBEAN_PUT);
InitAnimationForceUpdate(super, (super->type >> 1) + 8);
sub_08004168(super);
super->y.HALF.HI += 4;
super->action = 3;
SetTile(0x403b, COORD_TO_TILE(super), super->collisionLayer);
}