mirror of https://github.com/zeldaret/tmc.git
decompile CuccoChickAggr
This commit is contained in:
parent
49982391d0
commit
f40fbe6c96
|
@ -1,346 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start CuccoChickAggr
|
||||
CuccoChickAggr: @ 0x08022918
|
||||
push {r4, r5, lr}
|
||||
adds r5, r0, #0
|
||||
ldr r4, _08022930 @ =gUnk_080CBB64
|
||||
bl GetNextFunction
|
||||
lsls r0, r0, #2
|
||||
adds r0, r0, r4
|
||||
ldr r1, [r0]
|
||||
adds r0, r5, #0
|
||||
bl _call_via_r1
|
||||
pop {r4, r5, pc}
|
||||
.align 2, 0
|
||||
_08022930: .4byte gUnk_080CBB64
|
||||
|
||||
thumb_func_start sub_08022934
|
||||
sub_08022934: @ 0x08022934
|
||||
push {lr}
|
||||
ldr r2, _08022948 @ =gUnk_080CBB7C
|
||||
ldrb r1, [r0, #0xc]
|
||||
lsls r1, r1, #2
|
||||
adds r1, r1, r2
|
||||
ldr r1, [r1]
|
||||
bl _call_via_r1
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
_08022948: .4byte gUnk_080CBB7C
|
||||
|
||||
thumb_func_start sub_0802294C
|
||||
sub_0802294C: @ 0x0802294C
|
||||
push {lr}
|
||||
ldr r1, _08022958 @ =gUnk_080CBB64
|
||||
bl sub_0804AA30
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
_08022958: .4byte gUnk_080CBB64
|
||||
|
||||
thumb_func_start nullsub_132
|
||||
nullsub_132: @ 0x0802295C
|
||||
bx lr
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_08022960
|
||||
sub_08022960: @ 0x08022960
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
bl sub_0804A720
|
||||
adds r0, r4, #0
|
||||
bl sub_08022A88
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start sub_08022970
|
||||
sub_08022970: @ 0x08022970
|
||||
push {lr}
|
||||
adds r1, r0, #0
|
||||
ldrb r0, [r1, #0xe]
|
||||
subs r0, #1
|
||||
strb r0, [r1, #0xe]
|
||||
lsls r0, r0, #0x18
|
||||
cmp r0, #0
|
||||
bne _08022986
|
||||
adds r0, r1, #0
|
||||
bl sub_08022AA4
|
||||
_08022986:
|
||||
pop {pc}
|
||||
|
||||
thumb_func_start sub_08022988
|
||||
sub_08022988: @ 0x08022988
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
movs r1, #0x36
|
||||
ldrsh r0, [r4, r1]
|
||||
cmp r0, #0
|
||||
bne _080229A6
|
||||
adds r0, r4, #0
|
||||
bl sub_08022B20
|
||||
cmp r0, #0
|
||||
beq _080229A6
|
||||
adds r0, r4, #0
|
||||
bl sub_08022B0C
|
||||
b _080229F6
|
||||
_080229A6:
|
||||
ldrb r0, [r4, #0xf]
|
||||
cmp r0, #0
|
||||
beq _080229C6
|
||||
subs r0, #1
|
||||
strb r0, [r4, #0xf]
|
||||
lsls r0, r0, #0x18
|
||||
cmp r0, #0
|
||||
bne _080229F6
|
||||
movs r0, #1
|
||||
strb r0, [r4, #0x1e]
|
||||
movs r0, #0x80
|
||||
lsls r0, r0, #9
|
||||
str r0, [r4, #0x20]
|
||||
movs r0, #0xd6
|
||||
bl sub_08004488
|
||||
_080229C6:
|
||||
adds r0, r4, #0
|
||||
bl sub_080AEF88
|
||||
movs r1, #0x80
|
||||
lsls r1, r1, #6
|
||||
adds r0, r4, #0
|
||||
bl sub_08003FC4
|
||||
adds r1, r0, #0
|
||||
cmp r1, #0
|
||||
bne _080229F6
|
||||
ldrb r0, [r4, #0xe]
|
||||
subs r0, #1
|
||||
strb r0, [r4, #0xe]
|
||||
lsls r0, r0, #0x18
|
||||
cmp r0, #0
|
||||
bne _080229F0
|
||||
adds r0, r4, #0
|
||||
bl sub_08022A88
|
||||
b _080229F6
|
||||
_080229F0:
|
||||
movs r0, #4
|
||||
strb r0, [r4, #0xf]
|
||||
strb r1, [r4, #0x1e]
|
||||
_080229F6:
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start sub_080229F8
|
||||
sub_080229F8: @ 0x080229F8
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
movs r1, #0xa0
|
||||
lsls r1, r1, #6
|
||||
bl sub_08003FC4
|
||||
cmp r0, #0
|
||||
bne _08022A3C
|
||||
ldrb r0, [r4, #0xe]
|
||||
subs r0, #1
|
||||
strb r0, [r4, #0xe]
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r1, r0, #0x18
|
||||
cmp r1, #0
|
||||
bne _08022A30
|
||||
movs r0, #4
|
||||
strb r0, [r4, #0xc]
|
||||
movs r0, #6
|
||||
strb r0, [r4, #0xe]
|
||||
movs r0, #8
|
||||
strb r0, [r4, #0xf]
|
||||
strb r1, [r4, #0x1e]
|
||||
movs r0, #0xc0
|
||||
strh r0, [r4, #0x24]
|
||||
adds r0, r4, #0
|
||||
bl sub_08022B44
|
||||
b _08022A3C
|
||||
_08022A30:
|
||||
movs r0, #0x80
|
||||
lsls r0, r0, #9
|
||||
str r0, [r4, #0x20]
|
||||
movs r0, #0xd6
|
||||
bl sub_08004488
|
||||
_08022A3C:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_08022A40
|
||||
sub_08022A40: @ 0x08022A40
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrb r0, [r4, #0xf]
|
||||
cmp r0, #0
|
||||
beq _08022A58
|
||||
subs r0, #1
|
||||
strb r0, [r4, #0xf]
|
||||
lsls r0, r0, #0x18
|
||||
cmp r0, #0
|
||||
bne _08022A86
|
||||
movs r0, #1
|
||||
strb r0, [r4, #0x1e]
|
||||
_08022A58:
|
||||
adds r0, r4, #0
|
||||
bl sub_080AEF88
|
||||
movs r1, #0x80
|
||||
lsls r1, r1, #6
|
||||
adds r0, r4, #0
|
||||
bl sub_08003FC4
|
||||
cmp r0, #0
|
||||
bne _08022A86
|
||||
ldrb r0, [r4, #0xe]
|
||||
subs r0, #1
|
||||
strb r0, [r4, #0xe]
|
||||
lsls r0, r0, #0x18
|
||||
cmp r0, #0
|
||||
bne _08022A80
|
||||
adds r0, r4, #0
|
||||
bl sub_08022A88
|
||||
b _08022A86
|
||||
_08022A80:
|
||||
adds r0, r4, #0
|
||||
bl sub_08022B44
|
||||
_08022A86:
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start sub_08022A88
|
||||
sub_08022A88: @ 0x08022A88
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
movs r5, #0
|
||||
movs r0, #1
|
||||
strb r0, [r4, #0xc]
|
||||
bl Random
|
||||
movs r1, #0xf
|
||||
ands r0, r1
|
||||
adds r0, #8
|
||||
strb r0, [r4, #0xe]
|
||||
strb r5, [r4, #0x1e]
|
||||
pop {r4, r5, pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_08022AA4
|
||||
sub_08022AA4: @ 0x08022AA4
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
bl Random
|
||||
adds r5, r0, #0
|
||||
movs r0, #2
|
||||
strb r0, [r4, #0xc]
|
||||
movs r1, #3
|
||||
adds r0, r5, #0
|
||||
ands r0, r1
|
||||
adds r0, #1
|
||||
strb r0, [r4, #0xe]
|
||||
movs r0, #1
|
||||
strb r0, [r4, #0xf]
|
||||
movs r0, #0x80
|
||||
strh r0, [r4, #0x24]
|
||||
adds r0, r4, #0
|
||||
bl sub_08049FA0
|
||||
cmp r0, #0
|
||||
bne _08022AE0
|
||||
lsrs r0, r5, #8
|
||||
movs r1, #3
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
beq _08022AE0
|
||||
adds r0, r4, #0
|
||||
bl sub_08049EE4
|
||||
b _08022AE6
|
||||
_08022AE0:
|
||||
lsrs r0, r5, #0x10
|
||||
movs r1, #0x1f
|
||||
ands r0, r1
|
||||
_08022AE6:
|
||||
strb r0, [r4, #0x15]
|
||||
ldrb r1, [r4, #0x15]
|
||||
movs r0, #0xf
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
beq _08022B08
|
||||
lsrs r1, r1, #4
|
||||
movs r0, #1
|
||||
eors r1, r0
|
||||
ands r1, r0
|
||||
lsls r1, r1, #6
|
||||
ldrb r2, [r4, #0x18]
|
||||
movs r0, #0x41
|
||||
rsbs r0, r0, #0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r4, #0x18]
|
||||
_08022B08:
|
||||
pop {r4, r5, pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_08022B0C
|
||||
sub_08022B0C: @ 0x08022B0C
|
||||
push {lr}
|
||||
movs r1, #3
|
||||
strb r1, [r0, #0xc]
|
||||
strb r1, [r0, #0xe]
|
||||
movs r1, #8
|
||||
strb r1, [r0, #0xf]
|
||||
bl sub_08022B44
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_08022B20
|
||||
sub_08022B20: @ 0x08022B20
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
movs r0, #2
|
||||
bl sub_08049DF4
|
||||
cmp r0, #0
|
||||
beq _08022B40
|
||||
ldr r1, _08022B3C @ =gPlayerEntity
|
||||
adds r0, r4, #0
|
||||
movs r2, #0x24
|
||||
movs r3, #0x24
|
||||
bl sub_080041A0
|
||||
b _08022B42
|
||||
.align 2, 0
|
||||
_08022B3C: .4byte gPlayerEntity
|
||||
_08022B40:
|
||||
movs r0, #0
|
||||
_08022B42:
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start sub_08022B44
|
||||
sub_08022B44: @ 0x08022B44
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
movs r0, #0xc0
|
||||
lsls r0, r0, #8
|
||||
str r0, [r4, #0x20]
|
||||
ldr r1, _08022B84 @ =gPlayerEntity
|
||||
adds r0, r4, #0
|
||||
bl GetFacingDirection
|
||||
adds r1, r0, #0
|
||||
strb r1, [r4, #0x15]
|
||||
movs r0, #0xf
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
beq _08022B7A
|
||||
lsls r1, r1, #0x18
|
||||
lsrs r1, r1, #0x1c
|
||||
movs r0, #1
|
||||
eors r1, r0
|
||||
ands r1, r0
|
||||
lsls r1, r1, #6
|
||||
ldrb r2, [r4, #0x18]
|
||||
movs r0, #0x41
|
||||
rsbs r0, r0, #0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r4, #0x18]
|
||||
_08022B7A:
|
||||
movs r0, #0xd6
|
||||
bl sub_08004488
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_08022B84: .4byte gPlayerEntity
|
|
@ -3,12 +3,6 @@
|
|||
|
||||
.section .rodata
|
||||
|
||||
gUnk_080CBB64:: @ 080CBB64
|
||||
.incbin "baserom.gba", 0x0CBB64, 0x0000018
|
||||
|
||||
gUnk_080CBB7C:: @ 080CBB7C
|
||||
.incbin "baserom.gba", 0x0CBB7C, 0x0000014
|
||||
|
||||
gUnk_080CBB90:: @ 080CBB90
|
||||
.incbin "baserom.gba", 0x0CBB90, 0x0000010
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ SECTIONS {
|
|||
src/enemy/doorMimic.o(.text);
|
||||
src/enemy/rockChuchu.o(.text);
|
||||
src/enemy/spinyChuchu.o(.text);
|
||||
asm/cuccoChickAggr.o(.text);
|
||||
src/enemy/cuccoChickAggr.o(.text);
|
||||
asm/moldorm.o(.text);
|
||||
asm/enemyE.o(.text);
|
||||
asm/moldworm.o(.text);
|
||||
|
@ -928,6 +928,7 @@ SECTIONS {
|
|||
data/animations/rockChuchu.o(.rodata);
|
||||
src/enemy/spinyChuchu.o(.rodata);
|
||||
data/animations/spinyChuchu.o(.rodata);
|
||||
src/enemy/cuccoChickAggr.o(.rodata);
|
||||
data/data_080CBB64.o(.rodata);
|
||||
src/enemy.o(.rodata);
|
||||
data/data_080D3D94.o(.rodata);
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
|
||||
void sub_08022A88(Entity*);
|
||||
void sub_08022AA4(Entity*);
|
||||
void sub_08022B0C(Entity*);
|
||||
u32 sub_08022B20(Entity*);
|
||||
void sub_08022B44(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CBB64[])(Entity*);
|
||||
extern void (*const gUnk_080CBB7C[])(Entity*);
|
||||
|
||||
void CuccoChickAggr(Entity* this) {
|
||||
gUnk_080CBB64[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void sub_08022934(Entity* this) {
|
||||
gUnk_080CBB7C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0802294C(Entity* this) {
|
||||
sub_0804AA30(this, gUnk_080CBB64);
|
||||
}
|
||||
|
||||
void nullsub_132(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08022960(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
sub_08022A88(this);
|
||||
}
|
||||
|
||||
void sub_08022970(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08022AA4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022988(Entity* this) {
|
||||
if (this->height.HALF.HI == 0 && sub_08022B20(this)) {
|
||||
sub_08022B0C(this);
|
||||
} else {
|
||||
if (this->field_0xf) {
|
||||
if (--this->field_0xf)
|
||||
return;
|
||||
|
||||
this->frameIndex = 1;
|
||||
this->field_0x20 = 0x10000;
|
||||
sub_08004488(0xd6);
|
||||
}
|
||||
|
||||
sub_080AEF88(this);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08022A88(this);
|
||||
} else {
|
||||
this->field_0xf = 4;
|
||||
this->frameIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080229F8(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x2800) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 4;
|
||||
this->actionDelay = 6;
|
||||
this->field_0xf = 8;
|
||||
this->frameIndex = 0;
|
||||
this->nonPlanarMovement = 0xc0;
|
||||
sub_08022B44(this);
|
||||
} else {
|
||||
this->field_0x20 = 0x10000;
|
||||
sub_08004488(0xd6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022A40(Entity* this) {
|
||||
if (this->field_0xf) {
|
||||
if (--this->field_0xf)
|
||||
return;
|
||||
|
||||
this->frameIndex = 1;
|
||||
}
|
||||
|
||||
sub_080AEF88(this);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08022A88(this);
|
||||
} else {
|
||||
sub_08022B44(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022A88(Entity* this) {
|
||||
this->action = 1;
|
||||
this->actionDelay = (Random() & 0xf) + 8;
|
||||
this->frameIndex = 0;
|
||||
}
|
||||
|
||||
void sub_08022AA4(Entity* this) {
|
||||
u32 rand = Random();
|
||||
|
||||
this->action = 2;
|
||||
this->actionDelay = (rand & 3) + 1;
|
||||
this->field_0xf = 1;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
|
||||
if (!sub_08049FA0(this) && (rand >> 8) & 3) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
} else {
|
||||
this->direction = (rand >> 0x10) & 0x1f;
|
||||
}
|
||||
|
||||
if (this->direction & 0xf)
|
||||
this->spriteSettings.b.flipX = (this->direction >> 4) ^ 1;
|
||||
}
|
||||
|
||||
void sub_08022B0C(Entity* this) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 3;
|
||||
this->field_0xf = 8;
|
||||
sub_08022B44(this);
|
||||
}
|
||||
|
||||
u32 sub_08022B20(Entity* this) {
|
||||
if (!sub_08049DF4(2))
|
||||
return 0;
|
||||
|
||||
return sub_080041A0(this, &gPlayerEntity, 0x24, 0x24);
|
||||
}
|
||||
|
||||
void sub_08022B44(Entity *this){
|
||||
this->field_0x20 = 0xc000;
|
||||
this->direction = GetFacingDirection(this,&gPlayerEntity);
|
||||
|
||||
if (this->direction & 0xf)
|
||||
this->spriteSettings.b.flipX = (this->direction >> 4)^1;
|
||||
|
||||
sub_08004488(0xd6);
|
||||
}
|
||||
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CBB64[])(Entity*) = {
|
||||
sub_08022934,
|
||||
sub_0802294C,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
nullsub_132,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CBB7C[])(Entity*) = {
|
||||
sub_08022960,
|
||||
sub_08022970,
|
||||
sub_08022988,
|
||||
sub_080229F8,
|
||||
sub_08022A40,
|
||||
};
|
||||
// clang-format on
|
Loading…
Reference in New Issue