mirror of https://github.com/zeldaret/tmc.git
decompile pesto
This commit is contained in:
parent
18e12b74f2
commit
17a0f00ddf
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
|
||||||
|
push {lr}
|
||||||
|
adds r2, r0, #0
|
||||||
|
ldrb r0, [r2, #0x15]
|
||||||
|
adds r1, r0, #2
|
||||||
|
movs r0, #0x1f
|
||||||
|
ands r1, r0
|
||||||
|
lsrs r1, r1, #2
|
||||||
|
ldrb r0, [r2, #0x14]
|
||||||
|
cmp r1, r0
|
||||||
|
beq _08024A12
|
||||||
|
strb r1, [r2, #0x14]
|
||||||
|
ldrb r1, [r2, #0x14]
|
||||||
|
adds r0, r2, #0
|
||||||
|
bl InitializeAnimation
|
||||||
|
_08024A12:
|
||||||
|
pop {pc}
|
||||||
|
|
||||||
|
.syntax divided
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
|
||||||
|
push {r4, r5, lr}
|
||||||
|
adds r3, r0, #0
|
||||||
|
movs r4, #1
|
||||||
|
cmp r1, #0
|
||||||
|
beq _08024C60
|
||||||
|
movs r0, #3
|
||||||
|
bl sub_08049DF4
|
||||||
|
rsbs r1, r0, #0
|
||||||
|
orrs r1, r0
|
||||||
|
lsrs r4, r1, #0x1f
|
||||||
|
b _08024C78
|
||||||
|
_08024C60:
|
||||||
|
ldr r2, [r3, #0x54]
|
||||||
|
cmp r2, #0
|
||||||
|
beq _08024C74
|
||||||
|
ldr r0, [r2, #4]
|
||||||
|
cmp r0, #0
|
||||||
|
beq _08024C74
|
||||||
|
movs r5, #0x36
|
||||||
|
ldrsh r0, [r2, r5]
|
||||||
|
cmp r0, #0
|
||||||
|
bge _08024C78
|
||||||
|
_08024C74:
|
||||||
|
str r1, [r3, #0x54]
|
||||||
|
movs r4, #0
|
||||||
|
_08024C78:
|
||||||
|
adds r0, r4, #0
|
||||||
|
pop {r4, r5, pc}
|
||||||
|
|
||||||
|
.syntax divided
|
|
@ -0,0 +1,133 @@
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
|
||||||
|
push {r4, r5, r6, r7, lr}
|
||||||
|
adds r4, r0, #0
|
||||||
|
adds r0, #0x83
|
||||||
|
ldrb r0, [r0]
|
||||||
|
cmp r0, #3
|
||||||
|
bne _08024F46
|
||||||
|
ldrb r0, [r4, #0xf]
|
||||||
|
adds r0, #1
|
||||||
|
movs r7, #0
|
||||||
|
movs r1, #0xff
|
||||||
|
ands r0, r1
|
||||||
|
movs r1, #0x1f
|
||||||
|
ands r0, r1
|
||||||
|
strb r0, [r4, #0xf]
|
||||||
|
bl sub_0807953C
|
||||||
|
cmp r0, #0
|
||||||
|
beq _08024E84
|
||||||
|
bl Random
|
||||||
|
adds r3, r4, #0
|
||||||
|
adds r3, #0x84
|
||||||
|
ldrb r2, [r3]
|
||||||
|
adds r2, #1
|
||||||
|
movs r1, #1
|
||||||
|
ands r1, r0
|
||||||
|
adds r2, r2, r1
|
||||||
|
strb r2, [r3]
|
||||||
|
_08024E84:
|
||||||
|
ldr r0, _08024EC8 @ =gUnk_02002A40
|
||||||
|
adds r0, #0xaa
|
||||||
|
ldrb r0, [r0]
|
||||||
|
adds r2, r4, #0
|
||||||
|
adds r2, #0x87
|
||||||
|
cmp r0, #0
|
||||||
|
beq _08024E9A
|
||||||
|
adds r5, r2, #0
|
||||||
|
ldrb r0, [r5]
|
||||||
|
cmp r0, #4
|
||||||
|
bne _08024ECC
|
||||||
|
_08024E9A:
|
||||||
|
adds r1, r4, #0
|
||||||
|
adds r1, #0x84
|
||||||
|
movs r0, #0x30
|
||||||
|
strb r0, [r1]
|
||||||
|
strb r7, [r2]
|
||||||
|
adds r0, r4, #0
|
||||||
|
bl sub_08024F50
|
||||||
|
adds r0, r4, #0
|
||||||
|
adds r0, #0x80
|
||||||
|
strb r7, [r0]
|
||||||
|
movs r1, #0x40
|
||||||
|
movs r0, #0x40
|
||||||
|
strh r0, [r4, #0x24]
|
||||||
|
strb r1, [r4, #0xe]
|
||||||
|
movs r0, #8
|
||||||
|
strb r0, [r4, #0xf]
|
||||||
|
adds r0, r4, #0
|
||||||
|
movs r1, #0
|
||||||
|
movs r2, #8
|
||||||
|
bl sub_08024A14
|
||||||
|
b _08024F46
|
||||||
|
.align 2, 0
|
||||||
|
_08024EC8: .4byte gUnk_02002A40
|
||||||
|
_08024ECC:
|
||||||
|
ldr r6, _08024F48 @ =gPlayerEntity
|
||||||
|
bl ResetPlayer
|
||||||
|
ldr r2, _08024F4C @ =gPlayerState
|
||||||
|
ldr r0, [r2, #0x30]
|
||||||
|
movs r1, #0x80
|
||||||
|
lsls r1, r1, #1
|
||||||
|
orrs r0, r1
|
||||||
|
str r0, [r2, #0x30]
|
||||||
|
ldrb r0, [r2, #0xa]
|
||||||
|
movs r1, #0x80
|
||||||
|
orrs r0, r1
|
||||||
|
strb r0, [r2, #0xa]
|
||||||
|
movs r0, #0xe
|
||||||
|
strb r0, [r2, #0xc]
|
||||||
|
adds r1, r2, #0
|
||||||
|
adds r1, #0x38
|
||||||
|
movs r0, #0x14
|
||||||
|
strb r0, [r1]
|
||||||
|
adds r1, #1
|
||||||
|
movs r0, #1
|
||||||
|
strb r0, [r1]
|
||||||
|
adds r0, r2, #0
|
||||||
|
adds r0, #0x3a
|
||||||
|
strb r7, [r0]
|
||||||
|
movs r3, #0x80
|
||||||
|
lsls r3, r3, #9
|
||||||
|
adds r0, r4, #0
|
||||||
|
adds r1, r6, #0
|
||||||
|
movs r2, #0
|
||||||
|
bl PositionRelative
|
||||||
|
adds r1, r6, #0
|
||||||
|
adds r1, #0x63
|
||||||
|
movs r0, #0x1a
|
||||||
|
strb r0, [r1]
|
||||||
|
movs r0, #4
|
||||||
|
strb r0, [r6, #0x14]
|
||||||
|
adds r2, r6, #0
|
||||||
|
adds r2, #0x29
|
||||||
|
ldrb r1, [r2]
|
||||||
|
subs r0, #0x3d
|
||||||
|
ands r0, r1
|
||||||
|
strb r0, [r2]
|
||||||
|
ldrb r0, [r4, #0xf]
|
||||||
|
cmp r0, #0
|
||||||
|
bne _08024F46
|
||||||
|
ldrb r0, [r5]
|
||||||
|
adds r0, #1
|
||||||
|
strb r0, [r5]
|
||||||
|
adds r1, r6, #0
|
||||||
|
adds r1, #0x3d
|
||||||
|
movs r0, #8
|
||||||
|
strb r0, [r1]
|
||||||
|
subs r0, #0xa
|
||||||
|
bl ModHealth
|
||||||
|
adds r0, r6, #0
|
||||||
|
movs r1, #0x7a
|
||||||
|
bl sub_0800449C
|
||||||
|
_08024F46:
|
||||||
|
pop {r4, r5, r6, r7, pc}
|
||||||
|
.align 2, 0
|
||||||
|
_08024F48: .4byte gPlayerEntity
|
||||||
|
_08024F4C: .4byte gPlayerState
|
||||||
|
|
||||||
|
.syntax divided
|
2234
asm/pesto.s
2234
asm/pesto.s
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,31 @@
|
||||||
|
.include "asm/macros.inc"
|
||||||
|
.include "constants/constants.inc"
|
||||||
|
|
||||||
|
.section .rodata
|
||||||
|
|
||||||
|
gUnk_080CBF30:: @ 080CBF30
|
||||||
|
.incbin "baserom.gba", 0x0CBF30, 0x0000009
|
||||||
|
|
||||||
|
gUnk_080CBF39:: @ 080CBF39
|
||||||
|
.incbin "baserom.gba", 0x0CBF39, 0x0000009
|
||||||
|
|
||||||
|
gUnk_080CBF42:: @ 080CBF42
|
||||||
|
.incbin "baserom.gba", 0x0CBF42, 0x0000009
|
||||||
|
|
||||||
|
gUnk_080CBF4B:: @ 080CBF4B
|
||||||
|
.incbin "baserom.gba", 0x0CBF4B, 0x0000009
|
||||||
|
|
||||||
|
gUnk_080CBF54:: @ 080CBF54
|
||||||
|
.incbin "baserom.gba", 0x0CBF54, 0x0000009
|
||||||
|
|
||||||
|
gUnk_080CBF5D:: @ 080CBF5D
|
||||||
|
.incbin "baserom.gba", 0x0CBF5D, 0x0000009
|
||||||
|
|
||||||
|
gUnk_080CBF66:: @ 080CBF66
|
||||||
|
.incbin "baserom.gba", 0x0CBF66, 0x0000009
|
||||||
|
|
||||||
|
gUnk_080CBF6F:: @ 080CBF6F
|
||||||
|
.incbin "baserom.gba", 0x0CBF6F, 0x0000009
|
||||||
|
|
||||||
|
gUnk_080CBF78:: @ 080CBF78
|
||||||
|
.incbin "baserom.gba", 0x0CBF78, 0x0000024
|
|
@ -3,51 +3,6 @@
|
||||||
|
|
||||||
.section .rodata
|
.section .rodata
|
||||||
|
|
||||||
gUnk_080CBEC4:: @ 080CBEC4
|
|
||||||
.incbin "baserom.gba", 0x0CBEC4, 0x0000018
|
|
||||||
|
|
||||||
gUnk_080CBEDC:: @ 080CBEDC
|
|
||||||
.incbin "baserom.gba", 0x0CBEDC, 0x000001C
|
|
||||||
|
|
||||||
gUnk_080CBEF8:: @ 080CBEF8
|
|
||||||
.incbin "baserom.gba", 0x0CBEF8, 0x0000018
|
|
||||||
|
|
||||||
gUnk_080CBF10:: @ 080CBF10
|
|
||||||
.incbin "baserom.gba", 0x0CBF10, 0x0000008
|
|
||||||
|
|
||||||
gUnk_080CBF18:: @ 080CBF18
|
|
||||||
.incbin "baserom.gba", 0x0CBF18, 0x0000008
|
|
||||||
|
|
||||||
gUnk_080CBF20:: @ 080CBF20
|
|
||||||
.incbin "baserom.gba", 0x0CBF20, 0x0000010
|
|
||||||
|
|
||||||
gUnk_080CBF30:: @ 080CBF30
|
|
||||||
.incbin "baserom.gba", 0x0CBF30, 0x0000009
|
|
||||||
|
|
||||||
gUnk_080CBF39:: @ 080CBF39
|
|
||||||
.incbin "baserom.gba", 0x0CBF39, 0x0000009
|
|
||||||
|
|
||||||
gUnk_080CBF42:: @ 080CBF42
|
|
||||||
.incbin "baserom.gba", 0x0CBF42, 0x0000009
|
|
||||||
|
|
||||||
gUnk_080CBF4B:: @ 080CBF4B
|
|
||||||
.incbin "baserom.gba", 0x0CBF4B, 0x0000009
|
|
||||||
|
|
||||||
gUnk_080CBF54:: @ 080CBF54
|
|
||||||
.incbin "baserom.gba", 0x0CBF54, 0x0000009
|
|
||||||
|
|
||||||
gUnk_080CBF5D:: @ 080CBF5D
|
|
||||||
.incbin "baserom.gba", 0x0CBF5D, 0x0000009
|
|
||||||
|
|
||||||
gUnk_080CBF66:: @ 080CBF66
|
|
||||||
.incbin "baserom.gba", 0x0CBF66, 0x0000009
|
|
||||||
|
|
||||||
gUnk_080CBF6F:: @ 080CBF6F
|
|
||||||
.incbin "baserom.gba", 0x0CBF6F, 0x0000009
|
|
||||||
|
|
||||||
gUnk_080CBF78:: @ 080CBF78
|
|
||||||
.incbin "baserom.gba", 0x0CBF78, 0x0000024
|
|
||||||
|
|
||||||
gUnk_080CBF9C:: @ 080CBF9C
|
gUnk_080CBF9C:: @ 080CBF9C
|
||||||
.incbin "baserom.gba", 0x0CBF9C, 0x0000018
|
.incbin "baserom.gba", 0x0CBF9C, 0x0000018
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ typedef struct Entity {
|
||||||
/*0x5c*/ Frame* animPtr;
|
/*0x5c*/ Frame* animPtr;
|
||||||
/*0x60*/ u16 spriteVramOffset;
|
/*0x60*/ u16 spriteVramOffset;
|
||||||
/*0x62*/ u8 spriteOffsetX;
|
/*0x62*/ u8 spriteOffsetX;
|
||||||
/*0x63*/ u8 spriteOffsetY;
|
/*0x63*/ s8 spriteOffsetY;
|
||||||
/*0x64*/ u32* otherEntity;
|
/*0x64*/ u32* otherEntity;
|
||||||
/*0x68*/ union SplitHWord field_0x68;
|
/*0x68*/ union SplitHWord field_0x68;
|
||||||
/*0x6a*/ union SplitHWord field_0x6a;
|
/*0x6a*/ union SplitHWord field_0x6a;
|
||||||
|
|
|
@ -342,7 +342,7 @@ SECTIONS {
|
||||||
src/enemy/enemyE.o(.text);
|
src/enemy/enemyE.o(.text);
|
||||||
src/enemy/moldworm.o(.text);
|
src/enemy/moldworm.o(.text);
|
||||||
src/enemy/sluggula.o(.text);
|
src/enemy/sluggula.o(.text);
|
||||||
asm/pesto.o(.text);
|
src/enemy/pesto.o(.text);
|
||||||
asm/puffstool.o(.text);
|
asm/puffstool.o(.text);
|
||||||
asm/chuchuBoss.o(.text);
|
asm/chuchuBoss.o(.text);
|
||||||
asm/likeLike.o(.text);
|
asm/likeLike.o(.text);
|
||||||
|
@ -936,6 +936,8 @@ SECTIONS {
|
||||||
data/animations/moldworm.o(.rodata);
|
data/animations/moldworm.o(.rodata);
|
||||||
src/enemy/sluggula.o(.rodata);
|
src/enemy/sluggula.o(.rodata);
|
||||||
data/animations/sluggula.o(.rodata);
|
data/animations/sluggula.o(.rodata);
|
||||||
|
src/enemy/pesto.o(.rodata);
|
||||||
|
data/animations/pesto.o(.rodata);
|
||||||
data/data_080CBEC4.o(.rodata);
|
data/data_080CBEC4.o(.rodata);
|
||||||
src/enemy.o(.rodata);
|
src/enemy.o(.rodata);
|
||||||
data/data_080D3D94.o(.rodata);
|
data/data_080D3D94.o(.rodata);
|
||||||
|
|
|
@ -0,0 +1,906 @@
|
||||||
|
#include "enemy.h"
|
||||||
|
#include "entity.h"
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
|
extern u32 sub_080002E0(u16, u32);
|
||||||
|
extern u32 CheckIsDungeon(void);
|
||||||
|
extern void sub_0800449C(Entity*, u32);
|
||||||
|
extern u32 sub_08049F1C(Entity*, Entity*, u32);
|
||||||
|
extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*));
|
||||||
|
extern u32 PlayerInRange(Entity*, u32, u32);
|
||||||
|
extern void sub_080AEFB4(Entity*);
|
||||||
|
extern Entity* FindNextEntityOfSameSubtype(Entity* ent, int listIndex);
|
||||||
|
|
||||||
|
void sub_080249F4(Entity*);
|
||||||
|
void sub_08024940(Entity*);
|
||||||
|
void sub_080249DC(Entity*);
|
||||||
|
void sub_08024A14(Entity*, u32, u32);
|
||||||
|
bool32 sub_08024AD8(Entity*);
|
||||||
|
bool32 sub_08024B38(Entity*);
|
||||||
|
bool32 sub_08024C48(Entity*, bool32);
|
||||||
|
void sub_08024C7C(Entity*);
|
||||||
|
void sub_08024C94(Entity*);
|
||||||
|
bool32 sub_08024CC0(Entity*);
|
||||||
|
void sub_08024D00(Entity*);
|
||||||
|
void sub_08024E00(Entity*, u32);
|
||||||
|
void sub_08024E1C(Entity*);
|
||||||
|
u32 sub_08024E34(void);
|
||||||
|
void sub_08024E4C(Entity*);
|
||||||
|
void sub_08024F50(Entity*);
|
||||||
|
|
||||||
|
extern Entity* gUnk_020000B0;
|
||||||
|
|
||||||
|
extern void (*const gUnk_080CBEC4[])(Entity*);
|
||||||
|
extern void (*const gUnk_080CBEDC[])(Entity*);
|
||||||
|
extern void (*const gUnk_080CBEF8[])(Entity*);
|
||||||
|
|
||||||
|
extern const u8 gUnk_080CBF10[];
|
||||||
|
extern const u16 gUnk_080CBF18[];
|
||||||
|
extern const u8 gUnk_080CBF20[];
|
||||||
|
|
||||||
|
void Pesto(Entity* this) {
|
||||||
|
gUnk_080CBEC4[GetNextFunction(this)](this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08023F44(Entity* this) {
|
||||||
|
gUnk_080CBEDC[this->action](this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08023F5C(Entity* this) {
|
||||||
|
if (this->damageType != 0x6e) {
|
||||||
|
if (this->bitfield == 0x80) {
|
||||||
|
*(u8*)&this->field_0x86 = 0x30;
|
||||||
|
|
||||||
|
if ((this->field_0x82.HALF.HI & 0xf) == 3 && this->action == 6) {
|
||||||
|
switch (this->field_0x80.HALF.LO) {
|
||||||
|
case 1:
|
||||||
|
this->height.HALF.HI = -0x10;
|
||||||
|
this->field_0x82.HALF.LO = 0;
|
||||||
|
this->field_0x78.HWORD = -0x10;
|
||||||
|
this->field_0x80.HALF.LO += 1;
|
||||||
|
/* fallthrough */
|
||||||
|
case 2:
|
||||||
|
this->field_0x82.HALF.HI &= ~0x80;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this->currentHealth = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_0804AA30(this, gUnk_080CBEC4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08023FE0(Entity* this) {
|
||||||
|
sub_08001324(this);
|
||||||
|
GetNextFrame(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08023FF0(Entity* this) {
|
||||||
|
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
|
||||||
|
this->action = 1;
|
||||||
|
this->previousActionFlag = 0;
|
||||||
|
this->flags |= 0x80;
|
||||||
|
this->damageType = 0x77;
|
||||||
|
this->actionDelay = 1;
|
||||||
|
this->nonPlanarMovement = 0x40;
|
||||||
|
} else {
|
||||||
|
gUnk_080CBEF8[this->previousActionFlag](this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024038(Entity* this) {
|
||||||
|
this->previousActionFlag = 1;
|
||||||
|
this->field_0x1d = 60;
|
||||||
|
GetNextFrame(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024048(Entity* this) {
|
||||||
|
sub_0806F4E8(this);
|
||||||
|
GetNextFrame(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024058(Entity* this) {
|
||||||
|
sub_0806F3E4(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024060(Entity* this) {
|
||||||
|
if (this->damageType != 0x6e) {
|
||||||
|
this->flags = this->flags & 0x7f;
|
||||||
|
this->damageType = 0x6e;
|
||||||
|
this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetNextFrame(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nullsub_138(Entity* this) {
|
||||||
|
/* ... */
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0802409C(Entity* this) {
|
||||||
|
this->currentHealth = 0;
|
||||||
|
InitializeAnimation(this, this->animationState);
|
||||||
|
CreateDust(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080240B8(Entity* this) {
|
||||||
|
u32 direction = (Random() & 0xc0) >> 3;
|
||||||
|
sub_0804A720(this);
|
||||||
|
this->action = 1;
|
||||||
|
this->previousActionFlag = 0;
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
if (direction & 8) {
|
||||||
|
this->y.HALF.HI += (direction & 0x10) ? -0x20 : 0x20;
|
||||||
|
} else {
|
||||||
|
this->x.HALF.HI += (direction & 0x10) ? -0x20 : 0x20;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (this->entityType.form) {
|
||||||
|
case 0:
|
||||||
|
this->field_0x78.HWORD = -0x10;
|
||||||
|
this->height.HALF.HI = -0x10;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
this->field_0x78.HWORD = -0x30;
|
||||||
|
this->height.HALF.HI = -0x30;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateSpriteForCollisionLayer(this);
|
||||||
|
if (CheckIsDungeon())
|
||||||
|
this->spriteOrientation.flipY = 1;
|
||||||
|
|
||||||
|
this->field_0x80.HALF.HI = Random() & 0x40;
|
||||||
|
this->field_0x82.HALF.LO = 0;
|
||||||
|
this->field_0x82.HALF.HI = 0x80;
|
||||||
|
*((u8*)&this->field_0x86 + 0) = 0;
|
||||||
|
*((u8*)&this->field_0x86 + 1) = 0;
|
||||||
|
this->actionDelay = 0;
|
||||||
|
this->field_0xf = 0x20;
|
||||||
|
this->field_0x3c |= 0x10;
|
||||||
|
this->field_0x1c = 2;
|
||||||
|
this->direction = direction;
|
||||||
|
sub_080249DC(this);
|
||||||
|
|
||||||
|
if (this->entityType.form == 1) {
|
||||||
|
Entity* ent;
|
||||||
|
|
||||||
|
this->field_0x82.HALF.HI = 0;
|
||||||
|
ent = sub_0804A98C(this, 6, this->field_0x82.HALF.HI);
|
||||||
|
if (ent) {
|
||||||
|
this->attachedEntity = ent;
|
||||||
|
ent->parent = this;
|
||||||
|
ent->y.HALF.HI += 0x10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080241C0(Entity* this) {
|
||||||
|
sub_08024940(this);
|
||||||
|
switch (this->field_0x80.HALF.LO) {
|
||||||
|
case 0:
|
||||||
|
if (PlayerInRange(this, 3, (gPlayerState.hurtBlinkSpeed != 0) ? 0xa0 : 0x40) && sub_08049FDC(this, 3) &&
|
||||||
|
gPlayerEntity.action != 0x1e) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
this->nonPlanarMovement = 0;
|
||||||
|
sub_08024A14(this, 3, 10);
|
||||||
|
} else if (--this->field_0xf == 0) {
|
||||||
|
sub_08024A14(this, 0, 0x20);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (--this->field_0xf == 0) {
|
||||||
|
if (this->entityType.form != 0) {
|
||||||
|
u8 tmp = this->field_0x82.HALF.HI & 0x80;
|
||||||
|
if (tmp) {
|
||||||
|
sub_08024C94(this);
|
||||||
|
this->field_0x82.HALF.HI |= 0x40;
|
||||||
|
} else {
|
||||||
|
this->action = 3;
|
||||||
|
this->field_0x80.HALF.LO = tmp;
|
||||||
|
this->field_0xf = 10;
|
||||||
|
sub_08024E00(this, 0);
|
||||||
|
sub_08024E1C(this);
|
||||||
|
sub_08024A14(this, 3, this->field_0xf);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sub_08024C94(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024298(Entity* this) {
|
||||||
|
sub_08024D00(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080242A0(Entity* this) {
|
||||||
|
sub_08024940(this);
|
||||||
|
if (sub_08024CC0(this)) {
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
this->direction = GetFacingDirection(this, gUnk_020000B0);
|
||||||
|
sub_08024E00(this, 1);
|
||||||
|
if (this->nonPlanarMovement != 0) {
|
||||||
|
this->nonPlanarMovement = 0;
|
||||||
|
} else {
|
||||||
|
sub_08024E1C(this);
|
||||||
|
}
|
||||||
|
} else if (--this->field_0xf == 0) {
|
||||||
|
sub_08024A14(this, 3, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sub_08049F1C(this, gUnk_020000B0, 0x20) && sub_08049FDC(this, 3)) {
|
||||||
|
this->action = 4;
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->actionDelay = 0x10;
|
||||||
|
this->nonPlanarMovement = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_0802433C(Entity* this) {
|
||||||
|
sub_08024940(this);
|
||||||
|
switch (this->field_0x80.HALF.LO) {
|
||||||
|
case 0:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
this->nonPlanarMovement = 0x100;
|
||||||
|
this->field_0xf = 8;
|
||||||
|
sub_08024E00(this, 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
this->action = 5;
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->nonPlanarMovement = 0x140;
|
||||||
|
this->actionDelay = 0xc0;
|
||||||
|
this->field_0xf = 8;
|
||||||
|
} else {
|
||||||
|
if (--this->field_0xf == 0)
|
||||||
|
sub_08024A14(this, 2, 4);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080243B8(Entity* this) {
|
||||||
|
sub_08024940(this);
|
||||||
|
switch (this->field_0x80.HALF.LO) {
|
||||||
|
case 0:
|
||||||
|
if (sub_08024C48(this, TRUE)) {
|
||||||
|
if (this->attachedEntity == NULL || this->attachedEntity->next == NULL) {
|
||||||
|
this->field_0x80.HALF.LO = 2;
|
||||||
|
this->actionDelay = 0x20;
|
||||||
|
this->nonPlanarMovement = 0x80;
|
||||||
|
this->field_0x82.HALF.HI = 0x80;
|
||||||
|
} else if (sub_08049F1C(this, gUnk_020000B0, 0xe)) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
this->actionDelay = 0x1e;
|
||||||
|
this->nonPlanarMovement = 0x100;
|
||||||
|
this->field_0x82.HALF.HI = 0x80;
|
||||||
|
this->attachedEntity->action = 2;
|
||||||
|
} else if (--this->actionDelay) {
|
||||||
|
if (--this->field_0xf == 0) {
|
||||||
|
sub_08024A14(this, 2, (this->actionDelay >> 6) + 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sub_08024C7C(this);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sub_08024C7C(this);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
this->actionDelay = 0x20;
|
||||||
|
this->nonPlanarMovement = 0x80;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
this->action = 6;
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->nonPlanarMovement = 0x80;
|
||||||
|
sub_08024B38(this);
|
||||||
|
|
||||||
|
if ((this->field_0x82.HALF.HI & 0x40) == 0) {
|
||||||
|
switch (this->field_0x82.HALF.HI & 0x3f) {
|
||||||
|
case 3:
|
||||||
|
this->actionDelay = 4;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
this->actionDelay = 0x14;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this->actionDelay = 0x30;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sub_08024A14(this, 2, 8);
|
||||||
|
} else {
|
||||||
|
this->actionDelay = 0x40;
|
||||||
|
sub_08024A14(this, 0, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080244E8(Entity* this) {
|
||||||
|
sub_08024940(this);
|
||||||
|
switch (this->field_0x80.HALF.LO) {
|
||||||
|
case 0:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
if (sub_080002E0(COORD_TO_TILE(this), 1) == 0) {
|
||||||
|
this->field_0x80.HALF.LO += 1;
|
||||||
|
this->field_0x82.HALF.LO += 1;
|
||||||
|
this->field_0xf = 0;
|
||||||
|
this->nonPlanarMovement = 0;
|
||||||
|
} else {
|
||||||
|
this->actionDelay = 0x30;
|
||||||
|
this->field_0xf = 4;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
if (--this->field_0xf == 0) {
|
||||||
|
sub_08024A14(this, 1, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (++this->height.HALF.HI >= -0x10) {
|
||||||
|
this->field_0x82.HALF.LO = 0;
|
||||||
|
this->field_0x78.HWORD = 0xfff0;
|
||||||
|
if (sub_08024AD8(this)) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
} else {
|
||||||
|
sub_08024C94(this);
|
||||||
|
this->field_0x82.HALF.HI |= 0x40;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (sub_08024AD8(this)) {
|
||||||
|
u32 tmp;
|
||||||
|
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
if (this->nonPlanarMovement) {
|
||||||
|
this->nonPlanarMovement = 0;
|
||||||
|
} else {
|
||||||
|
sub_08024E1C(this);
|
||||||
|
}
|
||||||
|
this->direction = GetFacingDirection(this, this->attachedEntity);
|
||||||
|
sub_08024E00(this, 0);
|
||||||
|
sub_080249DC(this);
|
||||||
|
} else if (--this->field_0xf == 0) {
|
||||||
|
sub_08024A14(this, 1, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (this->field_0x82.HALF.HI & 0x3f) {
|
||||||
|
case 3:
|
||||||
|
tmp = this->field_0x82.HALF.HI & 0x80;
|
||||||
|
if (tmp == 0) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
this->actionDelay = 0xc;
|
||||||
|
this->direction = 0x10;
|
||||||
|
this->nonPlanarMovement = tmp;
|
||||||
|
this->cutsceneBeh.HALF.LO = 0;
|
||||||
|
this->flags2 &= 0xfc;
|
||||||
|
sub_080249DC(this);
|
||||||
|
this->cutsceneBeh.HALF.HI = gPlayerEntity.spritePriority.b1;
|
||||||
|
gPlayerEntity.flags &= 0x7f;
|
||||||
|
gPlayerState.flags.all |= 0x100;
|
||||||
|
gPlayerState.field_0xa |= 0x80;
|
||||||
|
if (gPlayerState.swimState != 0) {
|
||||||
|
gPlayerState.swimState = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (sub_080041A0(this, this->attachedEntity, 6, 6)) {
|
||||||
|
Entity* ent;
|
||||||
|
|
||||||
|
this->field_0x80.HALF.LO += 1;
|
||||||
|
this->actionDelay = 0xc;
|
||||||
|
this->field_0x82.HALF.HI &= ~0x80;
|
||||||
|
CopyPosition(this->attachedEntity, this);
|
||||||
|
this->height.HALF.HI -= 0xe;
|
||||||
|
this->field_0x78.HWORD -= 0xe;
|
||||||
|
|
||||||
|
ent = sub_0804A98C(this, 6, this->field_0x82.HALF.HI);
|
||||||
|
if (ent) {
|
||||||
|
ent->parent = this;
|
||||||
|
ent->height.HALF.HI += 0xe;
|
||||||
|
ent->attachedEntity = this->attachedEntity;
|
||||||
|
CopyPosition(ent, ent->attachedEntity);
|
||||||
|
this->attachedEntity = ent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (sub_080041A0(this, this->attachedEntity, 6, 6)) {
|
||||||
|
Entity* ent;
|
||||||
|
|
||||||
|
this->field_0x80.HALF.LO += 1;
|
||||||
|
this->actionDelay = 0xc;
|
||||||
|
this->field_0x82.HALF.HI &= ~0x80;
|
||||||
|
ent = this->attachedEntity;
|
||||||
|
SetTile((u16)ent->field_0x70.HALF.LO, COORD_TO_TILE(ent), ent->collisionLayer);
|
||||||
|
DeleteEntity(ent);
|
||||||
|
this->height.HALF.HI -= 0xe;
|
||||||
|
this->field_0x78.HWORD -= 0xe;
|
||||||
|
|
||||||
|
ent = sub_0804A98C(this, 6, this->field_0x82.HALF.HI);
|
||||||
|
if (ent) {
|
||||||
|
ent->parent = this;
|
||||||
|
ent->height.HALF.HI += 0xe;
|
||||||
|
this->attachedEntity = ent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
sub_08024C94(this);
|
||||||
|
this->field_0x82.HALF.HI |= 0x40;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
this->field_0xf = 0;
|
||||||
|
this->nonPlanarMovement = 0;
|
||||||
|
this->field_0x82.HALF.LO++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this->height.HALF.HI -= 2;
|
||||||
|
if (-60 > this->height.HALF.HI) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if (this->height.HALF.HI < -0x30) {
|
||||||
|
this->height.HALF.HI++;
|
||||||
|
} else {
|
||||||
|
if (this->field_0x82.HALF.LO != 0) {
|
||||||
|
this->field_0x82.HALF.LO = 0;
|
||||||
|
this->field_0x78.HWORD = -0x30;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (this->field_0x82.HALF.HI) {
|
||||||
|
case 3:
|
||||||
|
if (0x2f < this->cutsceneBeh.HALF.LO) {
|
||||||
|
sub_08024F50(this);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1 ... 2:
|
||||||
|
this->field_0x80.HALF.LO += 1;
|
||||||
|
this->actionDelay = 0xc0;
|
||||||
|
this->field_0xf = 8;
|
||||||
|
this->nonPlanarMovement = 0x80;
|
||||||
|
sub_080249DC(this);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sub_08024C7C(this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
if (this->field_0x82.HALF.HI & 0x80) {
|
||||||
|
this->field_0x82.HALF.HI = 0xc0;
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->nonPlanarMovement = 0x40;
|
||||||
|
this->actionDelay = 0x40;
|
||||||
|
this->field_0xf = 8;
|
||||||
|
sub_08024A14(this, 0, 8);
|
||||||
|
} else {
|
||||||
|
this->actionDelay = 0x40;
|
||||||
|
this->field_0xf = 8;
|
||||||
|
}
|
||||||
|
} else if (--this->field_0xf == 0) {
|
||||||
|
sub_08024A14(this, 2, 8);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
if (gPlayerEntity.height.HALF.HI == 0) {
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->nonPlanarMovement = 0x80;
|
||||||
|
sub_08024B38(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->field_0x82.HALF.HI == 3) {
|
||||||
|
sub_08024E4C(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024940(Entity* this) {
|
||||||
|
u32 random = Random() & 0x70;
|
||||||
|
|
||||||
|
if (this->collisions != 0) {
|
||||||
|
sub_0800417E(this, this->collisions);
|
||||||
|
sub_080249F4(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->field_0x82.HALF.LO == 0) {
|
||||||
|
this->height.HALF.HI = this->field_0x78.HWORD;
|
||||||
|
if (random)
|
||||||
|
this->height.HALF.HI += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->entityType.parameter != 0 || CheckIsDungeon()) {
|
||||||
|
if (!sub_08049FA0(this)) {
|
||||||
|
this->direction = sub_08049EE4(this);
|
||||||
|
sub_080249F4(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->height.HALF.HI < -0x20) {
|
||||||
|
this->spritePriority.b0 = 0;
|
||||||
|
} else {
|
||||||
|
this->spritePriority.b0 = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_080AEFB4(this);
|
||||||
|
GetNextFrame(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_080249DC(Entity* this) {
|
||||||
|
u8 direction = ((this->direction + 2) & 0x1c) >> 2;
|
||||||
|
this->animationState = direction;
|
||||||
|
InitializeAnimation(this, this->animationState);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if NON_MATCHING
|
||||||
|
void sub_080249F4(Entity* this) {
|
||||||
|
u8 direction = ((this->direction + 2) & 0x1c) >> 2;
|
||||||
|
if (direction != this->animationState) {
|
||||||
|
this->animationState = direction;
|
||||||
|
InitializeAnimation(this, this->animationState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
void sub_080249F4(Entity* this) {
|
||||||
|
asm(".include \"asm/non_matching/pesto/sub_080249F4.inc\"");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void sub_08024A14(Entity* this, u32 param_2, u32 param_3) {
|
||||||
|
u8 unk = FALSE;
|
||||||
|
|
||||||
|
switch (param_2) {
|
||||||
|
case 0:
|
||||||
|
sub_08004596(this, sub_08049EE4(this));
|
||||||
|
unk = TRUE;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (sub_08024C48(this, FALSE)) {
|
||||||
|
sub_08004596(this, GetFacingDirection(this, this->attachedEntity));
|
||||||
|
unk = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (sub_08024C48(this, TRUE)) {
|
||||||
|
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||||
|
unk = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (sub_08024C48(this, TRUE)) {
|
||||||
|
this->direction = GetFacingDirection(this, gUnk_020000B0);
|
||||||
|
unk = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param_2 != 0 && !sub_08049FA0(this) && (Random() & 3)) {
|
||||||
|
unk = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!unk) {
|
||||||
|
sub_08024A14(this, 0, param_3);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_080249DC(this);
|
||||||
|
this->field_0xf = param_3;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool32 sub_08024AD8(Entity* this) {
|
||||||
|
if ((this->field_0x82.HALF.HI & 0x40) == 0) {
|
||||||
|
u8 unk = FALSE;
|
||||||
|
if ((this->field_0x82.HALF.HI & 0x3f) == 3) {
|
||||||
|
if (gPlayerState.hurtBlinkSpeed == 0) {
|
||||||
|
this->attachedEntity->parent = NULL;
|
||||||
|
this->attachedEntity = NULL;
|
||||||
|
this->field_0x82.HALF.HI = 0xc0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
unk = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sub_08024C48(this, unk) == 0) {
|
||||||
|
this->attachedEntity = NULL;
|
||||||
|
this->field_0x82.HALF.HI = 0xc0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return sub_08024B38(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool32 sub_08024B38(Entity* this) {
|
||||||
|
int iVar4 = 0;
|
||||||
|
Entity* ent;
|
||||||
|
|
||||||
|
if (gPlayerState.hurtBlinkSpeed != 0) {
|
||||||
|
if (gPlayerState.swimState == 1) {
|
||||||
|
if (gPlayerState.hurtBlinkSpeed > 3) {
|
||||||
|
gPlayerState.hurtBlinkSpeed -= 3;
|
||||||
|
} else {
|
||||||
|
gPlayerState.hurtBlinkSpeed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gPlayerState.hurtBlinkSpeed != 0) {
|
||||||
|
if (sub_08024C48(this, 1) && sub_08049F1C(this, gUnk_020000B0, 0xa0)) {
|
||||||
|
iVar4 = 1;
|
||||||
|
this->attachedEntity = gUnk_020000B0;
|
||||||
|
this->field_0x82.HALF.HI |= 3;
|
||||||
|
this->field_0x82.HALF.HI &= ~0x40;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iVar4 == 0) {
|
||||||
|
this->attachedEntity = NULL;
|
||||||
|
}
|
||||||
|
return iVar4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ent = FindEntityInListBySubtype(8, 2, 2);
|
||||||
|
if (ent) {
|
||||||
|
do {
|
||||||
|
if (ent->action != 2 && ent->height.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) {
|
||||||
|
iVar4 = 1;
|
||||||
|
this->attachedEntity = ent;
|
||||||
|
this->field_0x82.HALF.HI |= 1;
|
||||||
|
this->field_0x82.HALF.HI &= ~0x40;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (ent = FindNextEntityOfSameSubtype(ent, 2), ent != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iVar4 != 0) {
|
||||||
|
return iVar4;
|
||||||
|
}
|
||||||
|
|
||||||
|
ent = FindEntityInListBySubtype(6, 5, 6);
|
||||||
|
if (ent) {
|
||||||
|
do {
|
||||||
|
if (ent->action == 1 && sub_08049F1C(this, ent, 0xa0)) {
|
||||||
|
iVar4 = 1;
|
||||||
|
this->attachedEntity = ent;
|
||||||
|
this->field_0x82.HALF.HI |= 2;
|
||||||
|
this->field_0x82.HALF.HI &= ~0x40;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (ent = FindNextEntityOfSameSubtype(ent, 6), ent != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iVar4 == 0) {
|
||||||
|
this->attachedEntity = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return iVar4;
|
||||||
|
}
|
||||||
|
|
||||||
|
NAKED
|
||||||
|
bool32 sub_08024C48(Entity* this, bool32 unk) {
|
||||||
|
asm(".include \"asm/non_matching/pesto/sub_08024C48.inc\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024C7C(Entity* this) {
|
||||||
|
this->action = 1;
|
||||||
|
this->nonPlanarMovement = 0x40;
|
||||||
|
this->actionDelay = 0;
|
||||||
|
sub_08024A14(this, 0, 0x20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024C94(Entity* this) {
|
||||||
|
this->action = 2;
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->actionDelay = 0x40;
|
||||||
|
this->field_0xf = 0;
|
||||||
|
this->nonPlanarMovement = 0xc0;
|
||||||
|
this->field_0x82.HALF.HI = 0x80;
|
||||||
|
sub_08024A14(this, 3, this->field_0xf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool32 sub_08024CC0(Entity* this) {
|
||||||
|
bool32 uVar2;
|
||||||
|
|
||||||
|
uVar2 = 1;
|
||||||
|
if (!sub_08024C48(this, 1)) {
|
||||||
|
uVar2 = 0;
|
||||||
|
} else if (!sub_08049F1C(this, gUnk_020000B0, 0x50) || !sub_08049FDC(this, 3)) {
|
||||||
|
uVar2 = 0;
|
||||||
|
sub_08024C7C(this);
|
||||||
|
}
|
||||||
|
return uVar2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024D00(Entity* this) {
|
||||||
|
if (*(u8*)&this->field_0x86) {
|
||||||
|
(*(u8*)&this->field_0x86)--;
|
||||||
|
GetNextFrame(this);
|
||||||
|
} else {
|
||||||
|
sub_08024940(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((this->field_0x82.HALF.HI & 0x40) && sub_08024B38(this)) {
|
||||||
|
this->action = 6;
|
||||||
|
this->field_0x80.HALF.LO = 2;
|
||||||
|
} else if (sub_08024CC0(this)) {
|
||||||
|
switch (this->field_0x80.HALF.LO) {
|
||||||
|
case 0:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
this->field_0x80.HALF.LO++;
|
||||||
|
this->actionDelay = (Random() & 0xf) + 0x20;
|
||||||
|
|
||||||
|
this->direction += this->field_0x80.HALF.HI ? 4 : 0x1c;
|
||||||
|
this->direction &= 0x1f;
|
||||||
|
|
||||||
|
this->field_0x80.HALF.HI ^= 0x40;
|
||||||
|
sub_08024A14(this, 3, 0x10);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (--this->actionDelay == 0) {
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->actionDelay = (Random() & 0x1f) + 0x20;
|
||||||
|
} else {
|
||||||
|
if (--this->field_0xf == 0) {
|
||||||
|
this->direction += this->field_0x80.HALF.HI ? 1 : 0x1f;
|
||||||
|
this->direction &= 0x1f;
|
||||||
|
|
||||||
|
this->field_0xf = 0x10;
|
||||||
|
sub_080249DC(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024E00(Entity* this, u32 unk) {
|
||||||
|
this->actionDelay = gUnk_080CBF10[sub_08024E34() * 2 | unk];
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_08024E1C(Entity* this) {
|
||||||
|
this->nonPlanarMovement = gUnk_080CBF18[sub_08024E34()];
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 sub_08024E34(void) {
|
||||||
|
u32 idx = (Random() & 0x3c) >> 2;
|
||||||
|
return gUnk_080CBF20[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
#if NON_MATCHING
|
||||||
|
void sub_08024E4C(Entity* this) {
|
||||||
|
if (this->field_0x82.HALF.HI == 3) {
|
||||||
|
this->field_0xf++;
|
||||||
|
this->field_0xf &= 0xff;
|
||||||
|
this->field_0xf &= 0x1f;
|
||||||
|
|
||||||
|
if (sub_0807953C()) {
|
||||||
|
this->cutsceneBeh.HALF.LO += 1 + (Random() & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gUnk_02002A40.stats.health == 0 || *((u8*)&this->field_0x86 + 1) == 4) {
|
||||||
|
this->cutsceneBeh.HALF.LO = 0x30;
|
||||||
|
*((u8*)&this->field_0x86 + 1) = 0;
|
||||||
|
sub_08024F50(this);
|
||||||
|
this->field_0x80.HALF.LO = 0;
|
||||||
|
this->nonPlanarMovement = 0x40;
|
||||||
|
this->actionDelay = 0x40;
|
||||||
|
this->field_0xf = 8;
|
||||||
|
sub_08024A14(this, 0, 8);
|
||||||
|
} else {
|
||||||
|
Entity* player = &gPlayerEntity;
|
||||||
|
|
||||||
|
ResetPlayer();
|
||||||
|
gPlayerState.flags.all |= 0x100;
|
||||||
|
gPlayerState.field_0xa |= 0x80;
|
||||||
|
gPlayerState.playerAction = 0xe;
|
||||||
|
gPlayerState.field_0x38 = 0x14;
|
||||||
|
gPlayerState.field_0x39 = 1;
|
||||||
|
*(u8*)&gPlayerState.field_0x3a = 0;
|
||||||
|
PositionRelative(this, player, 0, 0x10000);
|
||||||
|
player->spriteOffsetY = 0x1a;
|
||||||
|
player->animationState = 4;
|
||||||
|
player->spritePriority.b1 = 0;
|
||||||
|
if (this->field_0xf == 0) {
|
||||||
|
(*((u8*)&this->field_0x86 + 1))++;
|
||||||
|
player->hurtBlinkTime = 8;
|
||||||
|
ModHealth(-2);
|
||||||
|
sub_0800449C(player, 0x7a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
NAKED
|
||||||
|
void sub_08024E4C(Entity* this) {
|
||||||
|
asm(".include \"asm/non_matching/pesto/sub_08024E4C.inc\"");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void sub_08024F50(Entity* this) {
|
||||||
|
gPlayerState.field_0xa = 0;
|
||||||
|
gPlayerState.flags.all &= 0xfffffeff;
|
||||||
|
CopyPosition(this, &gPlayerEntity);
|
||||||
|
gPlayerEntity.action = 1;
|
||||||
|
gPlayerEntity.flags |= 0x80;
|
||||||
|
gPlayerEntity.hurtBlinkTime = -0x3c;
|
||||||
|
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||||
|
gPlayerEntity.nonPlanarMovement = 0;
|
||||||
|
gPlayerEntity.spritePriority.b1 = this->cutsceneBeh.HALF.HI;
|
||||||
|
gPlayerEntity.height.HALF.HI = gPlayerEntity.spriteOffsetY;
|
||||||
|
gPlayerEntity.spriteOffsetY = 0;
|
||||||
|
this->flags2 |= 3;
|
||||||
|
this->field_0x82.HALF.HI = 0xc0;
|
||||||
|
this->field_0x80.HALF.LO += 2;
|
||||||
|
this->cutsceneBeh.HALF.LO = 0;
|
||||||
|
this->nonPlanarMovement = 0x80;
|
||||||
|
}
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
void (*const gUnk_080CBEC4[])(Entity*) = {
|
||||||
|
sub_08023F44,
|
||||||
|
sub_08023F5C,
|
||||||
|
sub_08023FE0,
|
||||||
|
sub_0804A7D4,
|
||||||
|
sub_08001242,
|
||||||
|
sub_08023FF0,
|
||||||
|
};
|
||||||
|
|
||||||
|
void (*const gUnk_080CBEDC[])(Entity*) = {
|
||||||
|
sub_080240B8,
|
||||||
|
sub_080241C0,
|
||||||
|
sub_08024298,
|
||||||
|
sub_080242A0,
|
||||||
|
sub_0802433C,
|
||||||
|
sub_080243B8,
|
||||||
|
sub_080244E8,
|
||||||
|
};
|
||||||
|
|
||||||
|
void (*const gUnk_080CBEF8[])(Entity*) = {
|
||||||
|
sub_08024038,
|
||||||
|
sub_08024048,
|
||||||
|
sub_08024058,
|
||||||
|
sub_08024060,
|
||||||
|
nullsub_138,
|
||||||
|
sub_0802409C,
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 gUnk_080CBF10[] = {
|
||||||
|
30, 60, 50, 90, 70, 100, 90, 120,
|
||||||
|
};
|
||||||
|
|
||||||
|
const u16 gUnk_080CBF18[] = {
|
||||||
|
0x80, 0xC0, 0x100, 0x140,
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 gUnk_080CBF20[] = {
|
||||||
|
0, 2, 1, 1, 3, 1, 2, 0,
|
||||||
|
1, 1, 2, 3, 2, 2, 1, 2,
|
||||||
|
};
|
||||||
|
// clang-format on
|
Loading…
Reference in New Issue