mirror of https://github.com/zeldaret/tmc.git
decompile RockChuchu
This commit is contained in:
parent
1b0a1a71b3
commit
b952c82b59
237
asm/rockChuchu.s
237
asm/rockChuchu.s
|
@ -1,237 +0,0 @@
|
||||||
.include "asm/macros.inc"
|
|
||||||
|
|
||||||
.include "constants/constants.inc"
|
|
||||||
|
|
||||||
.syntax unified
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
|
|
||||||
thumb_func_start RockChuchu
|
|
||||||
RockChuchu: @ 0x0802222C
|
|
||||||
push {lr}
|
|
||||||
ldr r1, _08022238 @ =gUnk_080CB948
|
|
||||||
bl EnemyFunctionHandler
|
|
||||||
pop {pc}
|
|
||||||
.align 2, 0
|
|
||||||
_08022238: .4byte gUnk_080CB948
|
|
||||||
|
|
||||||
thumb_func_start sub_0802223C
|
|
||||||
sub_0802223C: @ 0x0802223C
|
|
||||||
push {lr}
|
|
||||||
ldr r2, _08022250 @ =gUnk_080CB960
|
|
||||||
ldrb r1, [r0, #0xc]
|
|
||||||
lsls r1, r1, #2
|
|
||||||
adds r1, r1, r2
|
|
||||||
ldr r1, [r1]
|
|
||||||
bl _call_via_r1
|
|
||||||
pop {pc}
|
|
||||||
.align 2, 0
|
|
||||||
_08022250: .4byte gUnk_080CB960
|
|
||||||
|
|
||||||
thumb_func_start sub_08022254
|
|
||||||
sub_08022254: @ 0x08022254
|
|
||||||
push {r4, r5, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
adds r0, #0x45
|
|
||||||
ldrb r0, [r0]
|
|
||||||
cmp r0, #0
|
|
||||||
beq _08022344
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x41
|
|
||||||
ldrb r1, [r0]
|
|
||||||
movs r0, #0x7f
|
|
||||||
ands r0, r1
|
|
||||||
subs r0, #4
|
|
||||||
cmp r0, #0x18
|
|
||||||
bhi _08022356
|
|
||||||
lsls r0, r0, #2
|
|
||||||
ldr r1, _0802227C @ =_08022280
|
|
||||||
adds r0, r0, r1
|
|
||||||
ldr r0, [r0]
|
|
||||||
mov pc, r0
|
|
||||||
.align 2, 0
|
|
||||||
_0802227C: .4byte _08022280
|
|
||||||
_08022280: @ jump table
|
|
||||||
.4byte _080222E4 @ case 0
|
|
||||||
.4byte _080222E4 @ case 1
|
|
||||||
.4byte _080222E4 @ case 2
|
|
||||||
.4byte _08022356 @ case 3
|
|
||||||
.4byte _080222E4 @ case 4
|
|
||||||
.4byte _080222E4 @ case 5
|
|
||||||
.4byte _080222E4 @ case 6
|
|
||||||
.4byte _080222E4 @ case 7
|
|
||||||
.4byte _080222E4 @ case 8
|
|
||||||
.4byte _080222E4 @ case 9
|
|
||||||
.4byte _08022356 @ case 10
|
|
||||||
.4byte _08022356 @ case 11
|
|
||||||
.4byte _080222E4 @ case 12
|
|
||||||
.4byte _080222E4 @ case 13
|
|
||||||
.4byte _080222E4 @ case 14
|
|
||||||
.4byte _08022356 @ case 15
|
|
||||||
.4byte _08022356 @ case 16
|
|
||||||
.4byte _08022356 @ case 17
|
|
||||||
.4byte _080222F2 @ case 18
|
|
||||||
.4byte _08022356 @ case 19
|
|
||||||
.4byte _080222E4 @ case 20
|
|
||||||
.4byte _080222E4 @ case 21
|
|
||||||
.4byte _080222E4 @ case 22
|
|
||||||
.4byte _08022356 @ case 23
|
|
||||||
.4byte _080222F2 @ case 24
|
|
||||||
_080222E4:
|
|
||||||
ldr r0, _08022340 @ =gPlayerState
|
|
||||||
adds r0, #0xac
|
|
||||||
ldrh r1, [r0]
|
|
||||||
movs r0, #8
|
|
||||||
ands r0, r1
|
|
||||||
cmp r0, #0
|
|
||||||
beq _08022356
|
|
||||||
_080222F2:
|
|
||||||
adds r0, r4, #0
|
|
||||||
movs r1, #4
|
|
||||||
movs r2, #0
|
|
||||||
bl CreateFx
|
|
||||||
movs r0, #1
|
|
||||||
movs r1, #1
|
|
||||||
bl CreateEnemy
|
|
||||||
adds r5, r0, #0
|
|
||||||
cmp r5, #0
|
|
||||||
beq _08022356
|
|
||||||
movs r0, #1
|
|
||||||
strb r0, [r5, #0xb]
|
|
||||||
adds r1, r5, #0
|
|
||||||
adds r1, #0x3d
|
|
||||||
movs r0, #0xf8
|
|
||||||
strb r0, [r1]
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r1, r5, #0
|
|
||||||
bl sub_0804A4E4
|
|
||||||
movs r0, #2
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
ldrb r1, [r4, #0x10]
|
|
||||||
movs r0, #0x7f
|
|
||||||
ands r0, r1
|
|
||||||
strb r0, [r4, #0x10]
|
|
||||||
ldrb r1, [r4, #0x18]
|
|
||||||
movs r0, #4
|
|
||||||
rsbs r0, r0, #0
|
|
||||||
ands r0, r1
|
|
||||||
strb r0, [r4, #0x18]
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x3e
|
|
||||||
ldrb r0, [r0]
|
|
||||||
strb r0, [r4, #0x15]
|
|
||||||
str r5, [r4, #0x54]
|
|
||||||
b _08022356
|
|
||||||
.align 2, 0
|
|
||||||
_08022340: .4byte gPlayerState
|
|
||||||
_08022344:
|
|
||||||
adds r0, r4, #0
|
|
||||||
adds r0, #0x3f
|
|
||||||
ldrb r0, [r0]
|
|
||||||
cmp r0, #0x94
|
|
||||||
beq _08022356
|
|
||||||
adds r0, r4, #0
|
|
||||||
movs r1, #2
|
|
||||||
bl InitializeAnimation
|
|
||||||
_08022356:
|
|
||||||
ldr r1, _08022360 @ =gUnk_080CB948
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl sub_0804AA30
|
|
||||||
pop {r4, r5, pc}
|
|
||||||
.align 2, 0
|
|
||||||
_08022360: .4byte gUnk_080CB948
|
|
||||||
|
|
||||||
thumb_func_start nullsub_131
|
|
||||||
nullsub_131: @ 0x08022364
|
|
||||||
bx lr
|
|
||||||
.align 2, 0
|
|
||||||
|
|
||||||
thumb_func_start sub_08022368
|
|
||||||
sub_08022368: @ 0x08022368
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
bl sub_0804A720
|
|
||||||
movs r0, #1
|
|
||||||
strb r0, [r4, #0xc]
|
|
||||||
bl Random
|
|
||||||
strb r0, [r4, #0xe]
|
|
||||||
adds r0, r4, #0
|
|
||||||
movs r1, #1
|
|
||||||
bl sub_08049F84
|
|
||||||
strb r0, [r4, #0x15]
|
|
||||||
adds r0, r4, #0
|
|
||||||
movs r1, #0
|
|
||||||
bl InitializeAnimation
|
|
||||||
pop {r4, pc}
|
|
||||||
.align 2, 0
|
|
||||||
|
|
||||||
thumb_func_start sub_08022390
|
|
||||||
sub_08022390: @ 0x08022390
|
|
||||||
push {r4, lr}
|
|
||||||
adds r4, r0, #0
|
|
||||||
movs r1, #1
|
|
||||||
bl sub_08049FDC
|
|
||||||
cmp r0, #0
|
|
||||||
beq _080223D4
|
|
||||||
ldrb r1, [r4, #0xe]
|
|
||||||
adds r0, r1, #1
|
|
||||||
strb r0, [r4, #0xe]
|
|
||||||
movs r0, #0xf
|
|
||||||
ands r0, r1
|
|
||||||
cmp r0, #0
|
|
||||||
bne _080223C0
|
|
||||||
adds r0, r4, #0
|
|
||||||
movs r1, #1
|
|
||||||
bl sub_08049F84
|
|
||||||
strb r0, [r4, #0x15]
|
|
||||||
bl Random
|
|
||||||
movs r1, #4
|
|
||||||
ands r0, r1
|
|
||||||
strb r0, [r4, #0xf]
|
|
||||||
_080223C0:
|
|
||||||
ldrb r0, [r4, #0xf]
|
|
||||||
cmp r0, #0
|
|
||||||
bne _080223CE
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl sub_080AEF88
|
|
||||||
b _080223DA
|
|
||||||
_080223CE:
|
|
||||||
subs r0, #1
|
|
||||||
strb r0, [r4, #0xf]
|
|
||||||
b _080223DA
|
|
||||||
_080223D4:
|
|
||||||
bl Random
|
|
||||||
strb r0, [r4, #0xe]
|
|
||||||
_080223DA:
|
|
||||||
adds r0, r4, #0
|
|
||||||
bl GetNextFrame
|
|
||||||
pop {r4, pc}
|
|
||||||
.align 2, 0
|
|
||||||
|
|
||||||
thumb_func_start sub_080223E4
|
|
||||||
sub_080223E4: @ 0x080223E4
|
|
||||||
push {lr}
|
|
||||||
adds r3, r0, #0
|
|
||||||
ldr r2, [r3, #0x54]
|
|
||||||
cmp r2, #0
|
|
||||||
beq _0802240A
|
|
||||||
adds r1, r2, #0
|
|
||||||
adds r1, #0x41
|
|
||||||
movs r0, #0x94
|
|
||||||
strb r0, [r1]
|
|
||||||
subs r1, #4
|
|
||||||
movs r0, #0x10
|
|
||||||
strb r0, [r1]
|
|
||||||
adds r1, #5
|
|
||||||
movs r0, #0xc
|
|
||||||
strb r0, [r1]
|
|
||||||
ldrb r1, [r3, #0x15]
|
|
||||||
adds r0, r2, #0
|
|
||||||
adds r0, #0x3e
|
|
||||||
strb r1, [r0]
|
|
||||||
_0802240A:
|
|
||||||
adds r0, r3, #0
|
|
||||||
bl DeleteEntity
|
|
||||||
pop {pc}
|
|
||||||
.align 2, 0
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
.include "asm/macros.inc"
|
||||||
|
.include "constants/constants.inc"
|
||||||
|
|
||||||
|
.section .rodata
|
||||||
|
|
||||||
|
gUnk_080CB96C:: @ 080CB96C
|
||||||
|
.incbin "baserom.gba", 0x0CB96C, 0x0000029
|
||||||
|
|
||||||
|
gUnk_080CB995:: @ 080CB995
|
||||||
|
.incbin "baserom.gba", 0x0CB995, 0x0000041
|
||||||
|
|
||||||
|
gUnk_080CB9D6:: @ 080CB9D6
|
||||||
|
.incbin "baserom.gba", 0x0CB9D6, 0x0000042
|
||||||
|
|
||||||
|
gUnk_080CBA18:: @ 080CBA18
|
||||||
|
.incbin "baserom.gba", 0x0CBA18, 0x0000010
|
|
@ -3,24 +3,6 @@
|
||||||
|
|
||||||
.section .rodata
|
.section .rodata
|
||||||
|
|
||||||
gUnk_080CB948:: @ 080CB948
|
|
||||||
.incbin "baserom.gba", 0x0CB948, 0x0000018
|
|
||||||
|
|
||||||
gUnk_080CB960:: @ 080CB960
|
|
||||||
.incbin "baserom.gba", 0x0CB960, 0x000000C
|
|
||||||
|
|
||||||
gUnk_080CB96C:: @ 080CB96C
|
|
||||||
.incbin "baserom.gba", 0x0CB96C, 0x0000029
|
|
||||||
|
|
||||||
gUnk_080CB995:: @ 080CB995
|
|
||||||
.incbin "baserom.gba", 0x0CB995, 0x0000041
|
|
||||||
|
|
||||||
gUnk_080CB9D6:: @ 080CB9D6
|
|
||||||
.incbin "baserom.gba", 0x0CB9D6, 0x0000042
|
|
||||||
|
|
||||||
gUnk_080CBA18:: @ 080CBA18
|
|
||||||
.incbin "baserom.gba", 0x0CBA18, 0x0000010
|
|
||||||
|
|
||||||
gUnk_080CBA28:: @ 080CBA28
|
gUnk_080CBA28:: @ 080CBA28
|
||||||
.incbin "baserom.gba", 0x0CBA28, 0x0000018
|
.incbin "baserom.gba", 0x0CBA28, 0x0000018
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,8 @@ typedef struct {
|
||||||
/*0xa9*/ u8 field_0xa9;
|
/*0xa9*/ u8 field_0xa9;
|
||||||
/*0xaa*/ u8 field_0xaa;
|
/*0xaa*/ u8 field_0xaa;
|
||||||
/*0xab*/ u8 field_0xab;
|
/*0xab*/ u8 field_0xab;
|
||||||
/*0xac*/ u32 field_0xac;
|
/*0xac*/ u16 field_0xac;
|
||||||
|
/*0xae*/ u16 field_0xae;
|
||||||
} PlayerState;
|
} PlayerState;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,7 @@ SECTIONS {
|
||||||
src/enemy/beetle.o(.text);
|
src/enemy/beetle.o(.text);
|
||||||
src/enemy/keese.o(.text);
|
src/enemy/keese.o(.text);
|
||||||
src/enemy/doorMimic.o(.text);
|
src/enemy/doorMimic.o(.text);
|
||||||
asm/rockChuchu.o(.text);
|
src/enemy/rockChuchu.o(.text);
|
||||||
asm/spinyChuchu.o(.text);
|
asm/spinyChuchu.o(.text);
|
||||||
asm/cuccoChickAggr.o(.text);
|
asm/cuccoChickAggr.o(.text);
|
||||||
asm/moldorm.o(.text);
|
asm/moldorm.o(.text);
|
||||||
|
@ -924,6 +924,8 @@ SECTIONS {
|
||||||
data/animations/keese.o(.rodata);
|
data/animations/keese.o(.rodata);
|
||||||
src/enemy/doorMimic.o(.rodata);
|
src/enemy/doorMimic.o(.rodata);
|
||||||
data/animations/doorMimic.o(.rodata);
|
data/animations/doorMimic.o(.rodata);
|
||||||
|
src/enemy/rockChuchu.o(.rodata);
|
||||||
|
data/animations/rockChuchu.o(.rodata);
|
||||||
data/data_080CB948.o(.rodata);
|
data/data_080CB948.o(.rodata);
|
||||||
src/enemy.o(.rodata);
|
src/enemy.o(.rodata);
|
||||||
data/data_080D3D94.o(.rodata);
|
data/data_080D3D94.o(.rodata);
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
#include "enemy.h"
|
||||||
|
#include "entity.h"
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
|
extern void sub_0804A4E4(Entity*, Entity*);
|
||||||
|
|
||||||
|
extern void (*const gUnk_080CB948[])(Entity*);
|
||||||
|
extern void (*const gUnk_080CB960[])(Entity*);
|
||||||
|
|
||||||
|
void RockChuchu(Entity* this) {
|
||||||
|
EnemyFunctionHandler(this, gUnk_080CB948);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0802223C(Entity* this) {
|
||||||
|
gUnk_080CB960[this->action](this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08022254(Entity* this) {
|
||||||
|
Entity* ent;
|
||||||
|
|
||||||
|
if (this->currentHealth) {
|
||||||
|
switch (this->bitfield & 0x7f) {
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 8:
|
||||||
|
case 9:
|
||||||
|
case 10:
|
||||||
|
case 0xb:
|
||||||
|
case 0xc:
|
||||||
|
case 0xd:
|
||||||
|
case 0x10:
|
||||||
|
case 0x11:
|
||||||
|
case 0x12:
|
||||||
|
case 0x18:
|
||||||
|
case 0x19:
|
||||||
|
case 0x1a:
|
||||||
|
if ((gPlayerState.field_0xac & 8) == 0)
|
||||||
|
break;
|
||||||
|
case 0x16:
|
||||||
|
case 0x1c:
|
||||||
|
CreateFx(this, 4, 0);
|
||||||
|
ent = CreateEnemy(1, 1);
|
||||||
|
if (ent) {
|
||||||
|
ent->entityType.parameter = 1;
|
||||||
|
ent->hurtBlinkTime = -8;
|
||||||
|
sub_0804A4E4(this, ent);
|
||||||
|
this->action = 2;
|
||||||
|
this->flags &= ~0x80;
|
||||||
|
this->spriteSettings.b.draw = 0;
|
||||||
|
this->direction = this->field_0x3e;
|
||||||
|
this->attachedEntity = ent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this->damageType != 0x94)
|
||||||
|
InitializeAnimation(this, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_0804AA30(this, gUnk_080CB948);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nullsub_131(Entity* this) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08022368(Entity* this) {
|
||||||
|
sub_0804A720(this);
|
||||||
|
this->action = 1;
|
||||||
|
this->actionDelay = Random();
|
||||||
|
this->direction = sub_08049F84(this, 1);
|
||||||
|
InitializeAnimation(this, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08022390(Entity* this) {
|
||||||
|
if (sub_08049FDC(this, 1)) {
|
||||||
|
if ((this->actionDelay++ & 0xf) == 0) {
|
||||||
|
this->direction = sub_08049F84(this, 1);
|
||||||
|
this->field_0xf = Random() & 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->field_0xf == 0) {
|
||||||
|
sub_080AEF88(this);
|
||||||
|
} else {
|
||||||
|
this->field_0xf = this->field_0xf - 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this->actionDelay = Random();
|
||||||
|
}
|
||||||
|
|
||||||
|
GetNextFrame(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080223E4(Entity* this) {
|
||||||
|
Entity* ent;
|
||||||
|
|
||||||
|
ent = this->attachedEntity;
|
||||||
|
if (ent) {
|
||||||
|
ent->bitfield = 0x94;
|
||||||
|
ent->hurtBlinkTime = 0x10;
|
||||||
|
ent->field_0x42 = 0xc;
|
||||||
|
ent->field_0x3e = this->direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteEntity(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
void (*const gUnk_080CB948[])(Entity*) = {
|
||||||
|
sub_0802223C,
|
||||||
|
sub_08022254,
|
||||||
|
sub_08001324,
|
||||||
|
sub_0804A7D4,
|
||||||
|
sub_08001242,
|
||||||
|
nullsub_131,
|
||||||
|
};
|
||||||
|
|
||||||
|
void (*const gUnk_080CB960[])(Entity*) = {
|
||||||
|
sub_08022368,
|
||||||
|
sub_08022390,
|
||||||
|
sub_080223E4,
|
||||||
|
};
|
||||||
|
// clang-format on
|
Loading…
Reference in New Issue