keese.c OK

This commit is contained in:
theo3 2020-07-15 17:30:26 -07:00
parent 842e10502e
commit 7d42d7c0de
3 changed files with 28 additions and 78 deletions

View File

@ -1,74 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_08021F24
sub_08021F24: @ 0x08021F24
push {r4, lr}
adds r4, r0, #0
adds r0, #0x78
ldrh r0, [r0]
cmp r0, #0
bne _08021F48
movs r0, #2
strb r0, [r4, #0xc]
bl Random
ldr r2, _08021F44 @ =gUnk_080CB6F6
movs r1, #0xf
ands r1, r0
adds r1, r1, r2
ldrb r0, [r1]
b _08021F6E
.align 2, 0
_08021F44: .4byte gUnk_080CB6F6
_08021F48:
adds r0, r4, #0
adds r0, #0x7a
ldrh r0, [r0]
cmp r0, #0
bne _08021F80
ldr r0, _08021F7C @ =gLinkEntity
movs r2, #0x2e
ldrsh r1, [r0, r2]
movs r3, #0x32
ldrsh r2, [r0, r3]
adds r0, r4, #0
movs r3, #0x70
bl sub_0806FCB8
cmp r0, #0
bne _08021F80
movs r0, #3
strb r0, [r4, #0xc]
movs r0, #0x1e
_08021F6E:
strb r0, [r4, #0xe]
adds r0, r4, #0
movs r1, #1
bl InitializeAnimation
b _08021FA4
.align 2, 0
_08021F7C: .4byte gLinkEntity
_08021F80:
adds r0, r4, #0
bl sub_08049FA0
cmp r0, #0
beq _08021F94
bl Random
movs r1, #0x1f
ands r0, r1
b _08021F9A
_08021F94:
adds r0, r4, #0
bl sub_08049EE4
_08021F9A:
strb r0, [r4, #0x15]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
_08021FA4:
pop {r4, pc}
.align 2, 0

View File

@ -333,7 +333,6 @@ SECTIONS {
src/enemy/hangingSeed.o(.text);
asm/beetle.o(.text);
src/enemy/keese.o(.text);
asm/keese.o(.text);
asm/doorMimic.o(.text);
asm/rockChuchu.o(.text);
asm/spinyChuchu.o(.text);

View File

@ -14,6 +14,8 @@ extern void sub_08021EF0(Entity*);
extern void sub_080AEFB4(Entity*);
extern void sub_08021F24(Entity*);
extern u32 sub_0806FCB8(Entity*, s32, s32, u32);
extern u32 sub_08049FA0(Entity*);
extern u32 sub_08049EE4(Entity*);
extern void (*gUnk_080CB69C[])(Entity*);
extern void (*gUnk_080CB6B4[])(Entity*);
@ -21,9 +23,7 @@ extern void (*gUnk_080CB6C4[])(Entity*);
extern u8 gUnk_080CB6D0[];
extern u16 gUnk_080CB6D6[];
extern u8 gUnk_080CB6D0[];
extern u8 gUnk_080CB6F6[];
void Keese(Entity *this)
{
@ -129,3 +129,28 @@ void sub_08021EF0(Entity *this)
this->field_0x7a = 0x3c;
InitializeAnimation(this, 0);
}
void sub_08021F24(Entity *this)
{
u32 bVar1;
if (this->field_0x78.HWORD == 0) {
this->action = 2;
this->actionDelay = gUnk_080CB6F6[Random() & 0xf];
InitializeAnimation(this, 1);
}
else if (!this->field_0x7a && !(sub_0806FCB8(this, gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI, 0x70))) {
this->action = 3;
this->actionDelay = 0x1e;
InitializeAnimation(this, 1);
}
else {
if (sub_08049FA0(this) != 0) {
this->direction = Random() & 0x1f;
}
else {
this->direction = sub_08049EE4(this);
}
InitializeAnimation(this, 0);
}
}