decompile SpinyChuchu

This commit is contained in:
Behemoth 2020-08-29 21:14:26 +02:00
parent 358985e215
commit 14791dcd97
5 changed files with 316 additions and 680 deletions

View File

@ -1,646 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start SpinyChuchu
SpinyChuchu: @ 0x08022414
push {r4, lr}
adds r4, r0, #0
ldr r1, _08022430 @ =gUnk_080CBA28
bl EnemyFunctionHandler
movs r3, #0x10
rsbs r3, r3, #0
adds r0, r4, #0
movs r1, #0
movs r2, #1
bl SetChildOffset
pop {r4, pc}
.align 2, 0
_08022430: .4byte gUnk_080CBA28
thumb_func_start sub_08022434
sub_08022434: @ 0x08022434
push {lr}
ldr r2, _08022448 @ =gUnk_080CBA40
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08022448: .4byte gUnk_080CBA40
thumb_func_start sub_0802244C
sub_0802244C: @ 0x0802244C
push {r4, r5, r6, r7, lr}
adds r4, r0, #0
adds r5, r4, #0
adds r5, #0x45
ldrb r0, [r5]
cmp r0, #0
bne _0802245C
b _08022582
_0802245C:
adds r0, r4, #0
adds r0, #0x3f
ldrb r1, [r0]
adds r6, r0, #0
cmp r1, #0x65
bne _08022522
adds r0, #2
ldrb r1, [r0]
movs r0, #0x7f
ands r0, r1
subs r0, #2
cmp r0, #0x18
bhi _08022540
lsls r0, r0, #2
ldr r1, _08022480 @ =_08022484
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_08022480: .4byte _08022484
_08022484: @ jump table
.4byte _080224E8 @ case 0
.4byte _080224E8 @ case 1
.4byte _08022540 @ case 2
.4byte _08022540 @ case 3
.4byte _08022540 @ case 4
.4byte _08022540 @ case 5
.4byte _08022508 @ case 6
.4byte _08022508 @ case 7
.4byte _08022508 @ case 8
.4byte _08022508 @ case 9
.4byte _08022508 @ case 10
.4byte _08022540 @ case 11
.4byte _08022540 @ case 12
.4byte _08022540 @ case 13
.4byte _08022540 @ case 14
.4byte _08022540 @ case 15
.4byte _08022540 @ case 16
.4byte _08022540 @ case 17
.4byte _08022540 @ case 18
.4byte _08022540 @ case 19
.4byte _08022508 @ case 20
.4byte _08022540 @ case 21
.4byte _08022508 @ case 22
.4byte _08022508 @ case 23
.4byte _08022508 @ case 24
_080224E8:
movs r0, #2
strb r0, [r4, #0xc]
movs r0, #0x3c
strb r0, [r4, #0xf]
movs r0, #0x5c
strb r0, [r6]
ldr r0, _08022504 @ =gUnk_080FD468
str r0, [r4, #0x48]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
b _08022540
.align 2, 0
_08022504: .4byte gUnk_080FD468
_08022508:
adds r0, r4, #0
movs r1, #0x1c
bl sub_0804A9FC
movs r0, #5
strb r0, [r4, #0xc]
movs r0, #0x5c
strb r0, [r6]
adds r0, r4, #0
movs r1, #1
bl InitializeAnimation
b _08022540
_08022522:
adds r0, r4, #0
adds r0, #0x41
ldrb r0, [r0]
cmp r0, #0x94
bne _08022540
adds r0, r4, #0
movs r1, #0x1c
bl sub_0804A9FC
movs r0, #5
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #1
bl InitializeAnimation
_08022540:
adds r0, r4, #0
adds r0, #0x80
adds r1, r4, #0
adds r1, #0x45
ldrb r2, [r0]
adds r5, r1, #0
adds r7, r0, #0
ldrb r0, [r5]
cmp r2, r0
beq _08022566
movs r0, #5
strb r0, [r4, #0xc]
movs r0, #0x5c
strb r0, [r6]
adds r0, r4, #0
movs r1, #1
bl InitializeAnimation
b _0802258E
_08022566:
ldrb r0, [r4, #0xc]
cmp r0, #3
bne _0802258E
movs r0, #4
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #3
bl InitializeAnimation
movs r0, #0xca
lsls r0, r0, #1
bl sub_08004488
b _0802258E
_08022582:
adds r0, r4, #0
movs r1, #1
bl InitializeAnimation
adds r7, r4, #0
adds r7, #0x80
_0802258E:
ldrb r0, [r5]
strb r0, [r7]
ldr r1, _0802259C @ =gUnk_080CBA28
adds r0, r4, #0
bl sub_0804AA30
pop {r4, r5, r6, r7, pc}
.align 2, 0
_0802259C: .4byte gUnk_080CBA28
thumb_func_start sub_080225A0
sub_080225A0: @ 0x080225A0
push {r4, lr}
adds r4, r0, #0
adds r0, #0x58
ldrb r0, [r0]
cmp r0, #1
bne _080225B2
adds r0, r4, #0
bl GetNextFrame
_080225B2:
adds r0, r4, #0
bl sub_08001318
pop {r4, pc}
.align 2, 0
thumb_func_start sub_080225BC
sub_080225BC: @ 0x080225BC
push {r4, lr}
adds r4, r0, #0
movs r1, #0xc0
lsls r1, r1, #5
bl sub_08003FC4
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #1
ands r0, r1
cmp r0, #0
beq _080225DE
adds r0, r4, #0
bl sub_0804A7D4
b _080225E4
_080225DE:
adds r0, r4, #0
bl GetNextFrame
_080225E4:
pop {r4, pc}
.align 2, 0
thumb_func_start nullsub_9
nullsub_9: @ 0x080225E8
bx lr
.align 2, 0
thumb_func_start sub_080225EC
sub_080225EC: @ 0x080225EC
push {r4, lr}
adds r4, r0, #0
bl sub_0804A720
adds r0, r4, #0
adds r0, #0x45
ldrb r1, [r0]
adds r0, #0x3b
strb r1, [r0]
adds r1, r4, #0
adds r1, #0x81
movs r0, #0x5a
strb r0, [r1]
ldrb r0, [r4, #0xe]
cmp r0, #0
bne _0802261A
movs r0, #2
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
b _0802264C
_0802261A:
movs r0, #1
strb r0, [r4, #0xc]
movs r0, #0x3c
strb r0, [r4, #0xf]
ldrb r0, [r4, #0x18]
movs r1, #3
orrs r0, r1
strb r0, [r4, #0x18]
ldrb r2, [r4, #0x19]
movs r1, #0x3f
adds r0, r1, #0
ands r0, r2
movs r2, #0x40
orrs r0, r2
strb r0, [r4, #0x19]
ldrb r0, [r4, #0x1b]
ands r1, r0
orrs r1, r2
strb r1, [r4, #0x1b]
ldr r0, _08022650 @ =0x0000FF80
strh r0, [r4, #0x36]
adds r0, r4, #0
movs r1, #6
bl InitializeAnimation
_0802264C:
pop {r4, pc}
.align 2, 0
_08022650: .4byte 0x0000FF80
thumb_func_start sub_08022654
sub_08022654: @ 0x08022654
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xd]
cmp r0, #1
beq _0802268C
cmp r0, #1
bgt _08022668
cmp r0, #0
beq _0802266E
b _080226E4
_08022668:
cmp r0, #2
beq _080226BE
b _080226E4
_0802266E:
ldrb r0, [r4, #0xf]
subs r0, #1
strb r0, [r4, #0xf]
lsls r0, r0, #0x18
cmp r0, #0
bne _080226E4
movs r0, #1
strb r0, [r4, #0xd]
ldr r0, _080226E8 @ =0x0000012D
bl PlaySFX
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
_0802268C:
movs r1, #0xc0
lsls r1, r1, #5
adds r0, r4, #0
bl sub_08003FC4
cmp r0, #0
bne _080226E4
movs r0, #2
strb r0, [r4, #0xd]
ldrb r1, [r4, #0x18]
subs r0, #6
ands r0, r1
movs r1, #1
orrs r0, r1
strb r0, [r4, #0x18]
adds r0, r4, #0
movs r1, #5
bl InitializeAnimation
movs r0, #0x7d
bl sub_08004488
adds r0, r4, #0
bl UpdateSpriteForCollisionLayer
_080226BE:
adds r0, r4, #0
bl GetNextFrame
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _080226E4
movs r0, #3
strb r0, [r4, #0xc]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x65
strb r0, [r1]
adds r0, r4, #0
movs r1, #2
bl InitializeAnimation
_080226E4:
pop {r4, pc}
.align 2, 0
_080226E8: .4byte 0x0000012D
thumb_func_start sub_080226EC
sub_080226EC: @ 0x080226EC
push {r4, lr}
adds r4, r0, #0
movs r1, #1
bl sub_08049FDC
cmp r0, #0
beq _08022776
adds r0, r4, #0
bl sub_080228CC
cmp r0, #0
beq _0802271A
movs r0, #3
strb r0, [r4, #0xc]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x65
strb r0, [r1]
adds r0, r4, #0
movs r1, #2
bl InitializeAnimation
b _0802277C
_0802271A:
adds r0, r4, #0
bl sub_080228F0
cmp r0, #0
beq _08022758
movs r0, #6
strb r0, [r4, #0xc]
movs r0, #0x90
lsls r0, r0, #9
str r0, [r4, #0x20]
movs r0, #0xa0
lsls r0, r0, #1
strh r0, [r4, #0x24]
ldr r0, _08022754 @ =gUnk_020000B0
ldr r1, [r0]
adds r0, r4, #0
bl GetFacingDirection
strb r0, [r4, #0x15]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x5a
strb r0, [r1]
adds r0, r4, #0
movs r1, #4
bl InitializeAnimation
b _0802277C
.align 2, 0
_08022754: .4byte gUnk_020000B0
_08022758:
ldrb r1, [r4, #0xe]
adds r0, r1, #1
strb r0, [r4, #0xe]
movs r0, #7
ands r0, r1
cmp r0, #0
bne _08022770
adds r0, r4, #0
movs r1, #1
bl sub_08049F84
strb r0, [r4, #0x15]
_08022770:
adds r0, r4, #0
bl sub_080AEF88
_08022776:
adds r0, r4, #0
bl GetNextFrame
_0802277C:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08022780
sub_08022780: @ 0x08022780
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _080227AA
movs r0, #4
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #3
bl InitializeAnimation
movs r0, #0xca
lsls r0, r0, #1
bl sub_08004488
_080227AA:
pop {r4, pc}
thumb_func_start sub_080227AC
sub_080227AC: @ 0x080227AC
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #1
ands r0, r1
cmp r0, #0
beq _080227CC
ldr r0, _080227C8 @ =gUnk_080FD470
b _080227CE
.align 2, 0
_080227C8: .4byte gUnk_080FD470
_080227CC:
ldr r0, _08022814 @ =gUnk_080FD468
_080227CE:
str r0, [r4, #0x48]
adds r2, r4, #0
adds r2, #0x5a
ldrb r1, [r2]
movs r3, #2
adds r0, r3, #0
ands r0, r1
cmp r0, #0
beq _080227EE
movs r0, #0xfd
ands r0, r1
strb r0, [r2]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x5c
strb r0, [r1]
_080227EE:
ldrb r1, [r2]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _08022812
strb r3, [r4, #0xc]
bl Random
ldr r2, _08022818 @ =gUnk_080CBA60
movs r1, #3
ands r1, r0
adds r1, r1, r2
ldrb r0, [r1]
strb r0, [r4, #0xf]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
_08022812:
pop {r4, pc}
.align 2, 0
_08022814: .4byte gUnk_080FD468
_08022818: .4byte gUnk_080CBA60
thumb_func_start sub_0802281C
sub_0802281C: @ 0x0802281C
push {r4, lr}
adds r4, r0, #0
movs r1, #0xc0
lsls r1, r1, #5
bl sub_08003FC4
adds r0, r4, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _08022852
movs r0, #2
strb r0, [r4, #0xc]
movs r0, #0x20
strh r0, [r4, #0x24]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
adds r0, r4, #0
bl sub_0804AA1C
_08022852:
pop {r4, pc}
thumb_func_start sub_08022854
sub_08022854: @ 0x08022854
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #1
ands r0, r1
cmp r0, #0
beq _08022898
adds r0, r4, #0
bl sub_080AEFE0
movs r1, #0xc0
lsls r1, r1, #5
adds r0, r4, #0
bl sub_08003FC4
cmp r0, #0
bne _08022898
movs r0, #7
strb r0, [r4, #0xc]
adds r1, r4, #0
adds r1, #0x3f
movs r0, #0x5c
strb r0, [r1]
adds r0, r4, #0
movs r1, #5
bl InitializeAnimation
movs r0, #0x7d
bl sub_08004488
_08022898:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0802289C
sub_0802289C: @ 0x0802289C
push {r4, lr}
adds r4, r0, #0
bl GetNextFrame
adds r0, r4, #0
adds r0, #0x5a
ldrb r1, [r0]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _080228CA
movs r0, #2
strb r0, [r4, #0xc]
movs r0, #0x20
strh r0, [r4, #0x24]
adds r1, r4, #0
adds r1, #0x81
movs r0, #0x78
strb r0, [r1]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
_080228CA:
pop {r4, pc}
thumb_func_start sub_080228CC
sub_080228CC: @ 0x080228CC
push {lr}
adds r1, r0, #0
ldrb r0, [r1, #0xf]
cmp r0, #0
bne _080228E8
adds r0, r1, #0
movs r1, #1
movs r2, #0x28
bl sub_08049F64
cmp r0, #0
beq _080228EC
movs r0, #1
b _080228EE
_080228E8:
subs r0, #1
strb r0, [r1, #0xf]
_080228EC:
movs r0, #0
_080228EE:
pop {pc}
thumb_func_start sub_080228F0
sub_080228F0: @ 0x080228F0
push {lr}
adds r1, r0, #0
adds r2, r1, #0
adds r2, #0x81
ldrb r0, [r2]
cmp r0, #0
bne _08022910
adds r0, r1, #0
movs r1, #1
movs r2, #0x40
bl sub_08049F64
cmp r0, #0
beq _08022914
movs r0, #1
b _08022916
_08022910:
subs r0, #1
strb r0, [r2]
_08022914:
movs r0, #0
_08022916:
pop {pc}

View File

@ -0,0 +1,28 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnk_080CBA64:: @ 080CBA64
.incbin "baserom.gba", 0x0CBA64, 0x0000041
gUnk_080CBAA5:: @ 080CBAA5
.incbin "baserom.gba", 0x0CBAA5, 0x0000040
gUnk_080CBAE5:: @ 080CBAE5
.incbin "baserom.gba", 0x0CBAE5, 0x0000018
gUnk_080CBAFD:: @ 080CBAFD
.incbin "baserom.gba", 0x0CBAFD, 0x0000024
gUnk_080CBB21:: @ 080CBB21
.incbin "baserom.gba", 0x0CBB21, 0x0000011
gUnk_080CBB32:: @ 080CBB32
.incbin "baserom.gba", 0x0CBB32, 0x000000D
gUnk_080CBB3F:: @ 080CBB3F
.incbin "baserom.gba", 0x0CBB3F, 0x0000005
gUnk_080CBB44:: @ 080CBB44
.incbin "baserom.gba", 0x0CBB44, 0x0000020

View File

@ -3,39 +3,6 @@
.section .rodata
gUnk_080CBA28:: @ 080CBA28
.incbin "baserom.gba", 0x0CBA28, 0x0000018
gUnk_080CBA40:: @ 080CBA40
.incbin "baserom.gba", 0x0CBA40, 0x0000020
gUnk_080CBA60:: @ 080CBA60
.incbin "baserom.gba", 0x0CBA60, 0x0000004
gUnk_080CBA64:: @ 080CBA64
.incbin "baserom.gba", 0x0CBA64, 0x0000041
gUnk_080CBAA5:: @ 080CBAA5
.incbin "baserom.gba", 0x0CBAA5, 0x0000040
gUnk_080CBAE5:: @ 080CBAE5
.incbin "baserom.gba", 0x0CBAE5, 0x0000018
gUnk_080CBAFD:: @ 080CBAFD
.incbin "baserom.gba", 0x0CBAFD, 0x0000024
gUnk_080CBB21:: @ 080CBB21
.incbin "baserom.gba", 0x0CBB21, 0x0000011
gUnk_080CBB32:: @ 080CBB32
.incbin "baserom.gba", 0x0CBB32, 0x000000D
gUnk_080CBB3F:: @ 080CBB3F
.incbin "baserom.gba", 0x0CBB3F, 0x0000005
gUnk_080CBB44:: @ 080CBB44
.incbin "baserom.gba", 0x0CBB44, 0x0000020
gUnk_080CBB64:: @ 080CBB64
.incbin "baserom.gba", 0x0CBB64, 0x0000018

View File

@ -336,7 +336,7 @@ SECTIONS {
src/enemy/keese.o(.text);
src/enemy/doorMimic.o(.text);
src/enemy/rockChuchu.o(.text);
asm/spinyChuchu.o(.text);
src/enemy/spinyChuchu.o(.text);
asm/cuccoChickAggr.o(.text);
asm/moldorm.o(.text);
asm/enemyE.o(.text);
@ -926,6 +926,8 @@ SECTIONS {
data/animations/doorMimic.o(.rodata);
src/enemy/rockChuchu.o(.rodata);
data/animations/rockChuchu.o(.rodata);
src/enemy/spinyChuchu.o(.rodata);
data/animations/spinyChuchu.o(.rodata);
data/data_080CBA28.o(.rodata);
src/enemy.o(.rodata);
data/data_080D3D94.o(.rodata);

285
src/enemy/spinyChuchu.c Normal file
View File

@ -0,0 +1,285 @@
#include "enemy.h"
#include "entity.h"
#include "functions.h"
extern void sub_08001318(Entity*);
extern u32 sub_08049F64(Entity*, u32, u32);
extern void sub_0804A4E4(Entity*, Entity*);
extern void sub_0804AA1C(Entity*);
u32 sub_080228CC(Entity*);
u32 sub_080228F0(Entity*);
extern void (*const gUnk_080CBA28[])(Entity*);
extern void (*const gUnk_080CBA40[])(Entity*);
extern const u8 gUnk_080CBA60[];
extern BoundingBox gUnk_080FD468;
extern BoundingBox gUnk_080FD470;
extern Entity* gUnk_020000B0;
void SpinyChuchu(Entity* this) {
EnemyFunctionHandler(this, gUnk_080CBA28);
SetChildOffset(this, 0, 1, -0x10);
}
void sub_08022434(Entity* this) {
gUnk_080CBA40[this->action](this);
}
void sub_0802244C(Entity* this) {
if (this->currentHealth) {
if (this->damageType == 0x65) {
switch (this->bitfield & 0x7f) {
case 2:
case 3:
this->action = 2;
this->field_0xf = 0x3c;
this->damageType = 0x5c;
this->boundingBox = &gUnk_080FD468;
InitializeAnimation(this, 0);
break;
case 8:
case 9:
case 10:
case 0xb:
case 0xc:
case 0x16:
case 0x18:
case 0x19:
case 0x1a:
sub_0804A9FC(this, 0x1c);
this->action = 5;
this->damageType = 0x5c;
InitializeAnimation(this, 1);
}
} else if (this->bitfield == 0x94) {
sub_0804A9FC(this, 0x1c);
this->action = 5;
InitializeAnimation(this, 1);
}
if (this->field_0x80.HALF.LO != this->currentHealth) {
this->action = 5;
this->damageType = 0x5c;
InitializeAnimation(this, 1);
} else {
if (this->action == 3) {
this->action = 4;
InitializeAnimation(this, 3);
sub_08004488(0x194);
}
}
} else {
InitializeAnimation(this, 1);
}
this->field_0x80.HALF.LO = this->currentHealth;
sub_0804AA30(this, gUnk_080CBA28);
}
void sub_080225A0(Entity* this) {
if (this->animIndex == 1)
GetNextFrame(this);
sub_08001318(this);
}
void sub_080225BC(Entity* this) {
sub_08003FC4(this, 0x1800);
if (this->frames.all & 1) {
sub_0804A7D4(this);
} else {
GetNextFrame(this);
}
}
void nullsub_9(Entity* this) {
}
void sub_080225EC(Entity* this) {
sub_0804A720(this);
this->field_0x80.HALF.LO = this->currentHealth;
this->field_0x80.HALF.HI = 0x5a;
if (this->actionDelay == 0) {
this->action = 2;
InitializeAnimation(this, 0);
} else {
this->action = 1;
this->field_0xf = 0x3c;
this->spriteSettings.b.draw = 3;
this->spriteRendering.b3 = 1;
this->spriteOrientation.flipY = 1;
this->height.HALF.HI = -0x80;
InitializeAnimation(this, 6);
}
}
void sub_08022654(Entity* this) {
switch (this->previousActionFlag) {
case 0:
if (--this->field_0xf)
return;
this->previousActionFlag = 1;
PlaySFX(0x12d);
InitializeAnimation(this, 0);
/* fallthrough */
case 1:
if (sub_08003FC4(this, 0x1800))
return;
this->previousActionFlag = 2;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 5);
sub_08004488(0x7d);
UpdateSpriteForCollisionLayer(this);
/* fallthrough */
case 2:
GetNextFrame(this);
if (--this->actionDelay == 0) {
this->action = 3;
this->damageType = 0x65;
InitializeAnimation(this, 2);
}
break;
}
}
void sub_080226EC(Entity* this) {
if (sub_08049FDC(this, 1)) {
if (sub_080228CC(this)) {
this->action = 3;
this->damageType = 0x65;
InitializeAnimation(this, 2);
return;
}
if (sub_080228F0(this)) {
this->action = 6;
this->field_0x20 = 0x12000;
this->nonPlanarMovement = 0x140;
this->direction = GetFacingDirection(this, gUnk_020000B0);
this->damageType = 0x5a;
InitializeAnimation(this, 4);
return;
}
if ((this->actionDelay++ & 7) == 0) {
this->direction = sub_08049F84(this, 1);
}
sub_080AEF88(this);
}
GetNextFrame(this);
}
void sub_08022780(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 0x80) {
this->action = 4;
InitializeAnimation(this, 3);
sub_08004488(0x194);
}
}
void sub_080227AC(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 1) {
this->boundingBox = &gUnk_080FD470;
} else {
this->boundingBox = &gUnk_080FD468;
}
if (this->frames.all & 2) {
this->frames.all &= ~2;
this->damageType = 0x5c;
}
if (this->frames.all & 0x80) {
this->action = 2;
this->field_0xf = gUnk_080CBA60[Random() & 3];
InitializeAnimation(this, 0);
}
}
void sub_0802281C(Entity* this) {
sub_08003FC4(this, 0x1800);
GetNextFrame(this);
if (this->frames.all & 0x80) {
this->action = 2;
this->nonPlanarMovement = 0x20;
InitializeAnimation(this, 0);
sub_0804AA1C(this);
}
}
void sub_08022854(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 1) {
sub_080AEFE0(this);
if (sub_08003FC4(this, 0x1800) == 0) {
this->action = 7;
this->damageType = 0x5c;
InitializeAnimation(this, 5);
sub_08004488(0x7d);
}
}
}
void sub_0802289C(Entity* this) {
GetNextFrame(this);
if (this->frames.all & 0x80) {
this->action = 2;
this->nonPlanarMovement = 0x20;
this->field_0x80.HALF.HI = 0x78;
InitializeAnimation(this, 0);
}
}
u32 sub_080228CC(Entity* this) {
if (this->field_0xf == 0) {
if (sub_08049F64(this, 1, 0x28))
return 1;
} else {
this->field_0xf--;
}
return 0;
}
u32 sub_080228F0(Entity* this) {
if (this->field_0x80.HALF.HI == 0) {
if (sub_08049F64(this, 1, 0x40))
return 1;
} else {
this->field_0x80.HALF.HI--;
}
return 0;
}
// clang-format off
void (*const gUnk_080CBA28[])(Entity*) = {
sub_08022434,
sub_0802244C,
sub_080225A0,
sub_080225BC,
sub_08001242,
nullsub_9,
};
void (*const gUnk_080CBA40[])(Entity*) = {
sub_080225EC,
sub_08022654,
sub_080226EC,
sub_08022780,
sub_080227AC,
sub_0802281C,
sub_08022854,
sub_0802289C,
};
const u8 gUnk_080CBA60[] = {
10, 20, 30, 20,
};
// clang-format on