|
|
|
@@ -5,32 +5,48 @@
|
|
|
|
|
* @brief Gibdo enemy
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define NENT_DEPRECATED
|
|
|
|
|
#include "global.h"
|
|
|
|
|
#include "enemy.h"
|
|
|
|
|
#include "object.h"
|
|
|
|
|
#include "functions.h"
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
Entity base;
|
|
|
|
|
u8 filler[0xc];
|
|
|
|
|
u16 field_0x74;
|
|
|
|
|
u8 field_0x76;
|
|
|
|
|
u8 field_0x77;
|
|
|
|
|
u16 field_0x78;
|
|
|
|
|
u16 field_0x7a;
|
|
|
|
|
u8 field_0x7c;
|
|
|
|
|
u8 field_0x7d;
|
|
|
|
|
u8 filler2[2];
|
|
|
|
|
Entity* field_0x80;
|
|
|
|
|
Entity* field_0x84;
|
|
|
|
|
} GibdoEntity;
|
|
|
|
|
|
|
|
|
|
// Gibudo
|
|
|
|
|
void sub_08037794(Entity*);
|
|
|
|
|
void sub_08037B10(Entity*);
|
|
|
|
|
void sub_0803797C(Entity*);
|
|
|
|
|
void sub_080379BC(Entity*);
|
|
|
|
|
void sub_08037C0C(Entity*, Entity*);
|
|
|
|
|
u32 sub_08037810(Entity*);
|
|
|
|
|
void sub_080377B0(Entity*);
|
|
|
|
|
u32 sub_080378B0(Entity*);
|
|
|
|
|
u32 sub_08037914(Entity*);
|
|
|
|
|
u32 sub_080379EC(Entity*);
|
|
|
|
|
void sub_08037A58(Entity*);
|
|
|
|
|
void sub_08037ACC(Entity*);
|
|
|
|
|
void sub_08037B48(Entity*);
|
|
|
|
|
void sub_08037A14(Entity*);
|
|
|
|
|
void sub_08037794(GibdoEntity*);
|
|
|
|
|
void sub_08037B10(GibdoEntity*);
|
|
|
|
|
void sub_0803797C(GibdoEntity*);
|
|
|
|
|
void sub_080379BC(GibdoEntity*);
|
|
|
|
|
void Gibdo_MoveObjectsToStalfos(GibdoEntity*, Entity*);
|
|
|
|
|
u32 sub_08037810(GibdoEntity*);
|
|
|
|
|
void sub_080377B0(GibdoEntity*);
|
|
|
|
|
u32 sub_080378B0(GibdoEntity*);
|
|
|
|
|
u32 sub_08037914(GibdoEntity*);
|
|
|
|
|
u32 sub_080379EC(GibdoEntity*);
|
|
|
|
|
void sub_08037A58(GibdoEntity*);
|
|
|
|
|
void sub_08037ACC(GibdoEntity*);
|
|
|
|
|
void Gibdo_CreateObjects(GibdoEntity*);
|
|
|
|
|
void sub_08037A14(GibdoEntity*);
|
|
|
|
|
|
|
|
|
|
extern void sub_0804A4E4(Entity*, Entity*);
|
|
|
|
|
u32 sub_0804A044(Entity*, Entity*, u32);
|
|
|
|
|
|
|
|
|
|
extern void (*const gGibdo[6])(Entity*);
|
|
|
|
|
extern void (*const gUnk_080CF2AC[9])(Entity*);
|
|
|
|
|
void (*const gGibdo[6])(Entity*);
|
|
|
|
|
void (*const gUnk_080CF2AC[9])(GibdoEntity*);
|
|
|
|
|
extern Entity* gUnk_020000B0;
|
|
|
|
|
|
|
|
|
|
void Gibdo(Entity* this) {
|
|
|
|
@@ -38,35 +54,33 @@ void Gibdo(Entity* this) {
|
|
|
|
|
SetChildOffset(this, 0, 1, -0x15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Gibdo_OnTick(Entity* this) {
|
|
|
|
|
gUnk_080CF2AC[this->action](this);
|
|
|
|
|
void Gibdo_OnTick(GibdoEntity* this) {
|
|
|
|
|
gUnk_080CF2AC[super->action](this);
|
|
|
|
|
}
|
|
|
|
|
// Non-matching
|
|
|
|
|
NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* this)) {
|
|
|
|
|
|
|
|
|
|
void sub_080374A4(GibdoEntity* this) {
|
|
|
|
|
u8 x;
|
|
|
|
|
if (this->bitfield == 0x87) {
|
|
|
|
|
if (this->action == 0x6) {
|
|
|
|
|
if (super->bitfield == 0x87) {
|
|
|
|
|
if (super->action == 0x6) {
|
|
|
|
|
sub_08037ACC(this);
|
|
|
|
|
}
|
|
|
|
|
this->action = 0x8;
|
|
|
|
|
this->actionDelay = 0x3c;
|
|
|
|
|
COLLISION_OFF(this);
|
|
|
|
|
sub_08037B48(this);
|
|
|
|
|
super->action = 0x8;
|
|
|
|
|
super->actionDelay = 0x3c;
|
|
|
|
|
COLLISION_OFF(super);
|
|
|
|
|
Gibdo_CreateObjects(this);
|
|
|
|
|
} else {
|
|
|
|
|
if (this->action != 0x6) {
|
|
|
|
|
if (this->hitType == 0x27) {
|
|
|
|
|
if (this->bitfield == 0x80) {
|
|
|
|
|
sub_08037A14(this);
|
|
|
|
|
}
|
|
|
|
|
if (super->action != 0x6) {
|
|
|
|
|
if (super->hitType == 0x27 && super->bitfield == 0x80) {
|
|
|
|
|
sub_08037A14(this);
|
|
|
|
|
} else {
|
|
|
|
|
if ((u8)(this->action - 1) < 2) {
|
|
|
|
|
this->action = 1;
|
|
|
|
|
x = DirectionTurnAround(DirectionRoundUp(this->knockbackDirection));
|
|
|
|
|
this->direction = x;
|
|
|
|
|
this->animationState = x >> 3;
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState);
|
|
|
|
|
if ((u8)(super->action - 1) < 2) {
|
|
|
|
|
super->action = 1;
|
|
|
|
|
x = DirectionRoundUp(DirectionTurnAround(super->knockbackDirection));
|
|
|
|
|
super->direction = x;
|
|
|
|
|
super->animationState = x >> 3;
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState);
|
|
|
|
|
if (sub_08037810(this) != 0) {
|
|
|
|
|
this->actionDelay = 4;
|
|
|
|
|
super->actionDelay = 4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -74,41 +88,40 @@ NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* th
|
|
|
|
|
sub_08037A58(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this->field_0x43 != 0) {
|
|
|
|
|
sub_0804A9FC(this, 0x1c);
|
|
|
|
|
if (super->field_0x43 != 0) {
|
|
|
|
|
sub_0804A9FC(super, 0x1c);
|
|
|
|
|
}
|
|
|
|
|
sub_0804AA30(this, gGibdo);
|
|
|
|
|
}
|
|
|
|
|
END_NONMATCH
|
|
|
|
|
|
|
|
|
|
void nullsub_162(Entity* this) {
|
|
|
|
|
sub_0804AA30(super, gGibdo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037558(Entity* this) {
|
|
|
|
|
sub_0804A720(this);
|
|
|
|
|
this->animationState = Random() & 0x3;
|
|
|
|
|
this->field_0x76.HALF.LO = 0;
|
|
|
|
|
this->field_0x76.HALF.HI = 0;
|
|
|
|
|
void nullsub_162(GibdoEntity* this) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037558(GibdoEntity* this) {
|
|
|
|
|
sub_0804A720(super);
|
|
|
|
|
super->animationState = Random() & 0x3;
|
|
|
|
|
this->field_0x76 = 0;
|
|
|
|
|
this->field_0x77 = 0;
|
|
|
|
|
sub_08037794(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037580(Entity* this) {
|
|
|
|
|
void sub_08037580(GibdoEntity* this) {
|
|
|
|
|
if (sub_08037810(this) == 0) {
|
|
|
|
|
if (!(--this->field_0x74.HWORD)) {
|
|
|
|
|
if (!(--this->field_0x74)) {
|
|
|
|
|
sub_080377B0(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_080375A4(Entity* this) {
|
|
|
|
|
void sub_080375A4(GibdoEntity* this) {
|
|
|
|
|
if (sub_080378B0(this) == 0) {
|
|
|
|
|
if (sub_08037810(this) == 0) {
|
|
|
|
|
if (!(--this->field_0x74.HWORD)) {
|
|
|
|
|
if (!(--this->field_0x74)) {
|
|
|
|
|
sub_08037794(this);
|
|
|
|
|
} else {
|
|
|
|
|
UpdateAnimationSingleFrame(this);
|
|
|
|
|
if (ProcessMovement(this) == 0) {
|
|
|
|
|
if (!(--this->field_0xf)) {
|
|
|
|
|
UpdateAnimationSingleFrame(super);
|
|
|
|
|
if (ProcessMovement(super) == 0) {
|
|
|
|
|
if (!(--super->field_0xf)) {
|
|
|
|
|
sub_080379BC(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -117,30 +130,30 @@ void sub_080375A4(Entity* this) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_080375F8(Entity* this) {
|
|
|
|
|
void sub_080375F8(GibdoEntity* this) {
|
|
|
|
|
if (sub_080378B0(this) == 0) {
|
|
|
|
|
if (!(--this->actionDelay)) {
|
|
|
|
|
this->action = 4;
|
|
|
|
|
this->actionDelay = 0x18;
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState + 4);
|
|
|
|
|
if (!(--super->actionDelay)) {
|
|
|
|
|
super->action = 4;
|
|
|
|
|
super->actionDelay = 0x18;
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState + 4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037624(Entity* this) {
|
|
|
|
|
void sub_08037624(GibdoEntity* this) {
|
|
|
|
|
if (sub_080378B0(this) == 0) {
|
|
|
|
|
if (sub_08037914(this) == 0) {
|
|
|
|
|
if (!(--this->field_0x74.HWORD)) {
|
|
|
|
|
if (!(--this->field_0x74)) {
|
|
|
|
|
sub_08037794(this);
|
|
|
|
|
} else {
|
|
|
|
|
UpdateAnimationSingleFrame(this);
|
|
|
|
|
UpdateAnimationSingleFrame(this);
|
|
|
|
|
if (ProcessMovement(this) == 0) {
|
|
|
|
|
if (!(--this->field_0xf)) {
|
|
|
|
|
UpdateAnimationSingleFrame(super);
|
|
|
|
|
UpdateAnimationSingleFrame(super);
|
|
|
|
|
if (ProcessMovement(super) == 0) {
|
|
|
|
|
if (!(--super->field_0xf)) {
|
|
|
|
|
sub_080379BC(this);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!(--this->actionDelay)) {
|
|
|
|
|
if (!(--super->actionDelay)) {
|
|
|
|
|
sub_0803797C(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -149,172 +162,172 @@ void sub_08037624(Entity* this) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037690(Entity* this) {
|
|
|
|
|
UpdateAnimationSingleFrame(this);
|
|
|
|
|
if ((this->frame & 0x80) != 0) {
|
|
|
|
|
this->field_0x76.HALF.HI = 0x14;
|
|
|
|
|
void sub_08037690(GibdoEntity* this) {
|
|
|
|
|
UpdateAnimationSingleFrame(super);
|
|
|
|
|
if ((super->frame & 0x80) != 0) {
|
|
|
|
|
this->field_0x77 = 0x14;
|
|
|
|
|
sub_08037794(this);
|
|
|
|
|
} else {
|
|
|
|
|
if ((this->frame & 1) != 0) {
|
|
|
|
|
this->hitType = 0x27;
|
|
|
|
|
ProcessMovement(this);
|
|
|
|
|
if ((super->frame & 1) != 0) {
|
|
|
|
|
super->hitType = 0x27;
|
|
|
|
|
ProcessMovement(super);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_080376D0(Entity* this) {
|
|
|
|
|
void sub_080376D0(GibdoEntity* this) {
|
|
|
|
|
u8* x;
|
|
|
|
|
if (sub_080379EC(this) == 0) {
|
|
|
|
|
ResetPlayer();
|
|
|
|
|
gPlayerState.mobility = gPlayerState.mobility | 0x80;
|
|
|
|
|
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
|
|
|
|
|
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
|
|
|
|
|
UpdateAnimationSingleFrame(this);
|
|
|
|
|
if ((this->frame & 0x1) != 0) {
|
|
|
|
|
if (--this->field_0x7c.BYTES.byte0 == 0) {
|
|
|
|
|
CopyPositionAndSpriteOffset(&gPlayerEntity, super);
|
|
|
|
|
UpdateAnimationSingleFrame(super);
|
|
|
|
|
if ((super->frame & 0x1) != 0) {
|
|
|
|
|
if (--this->field_0x7c == 0) {
|
|
|
|
|
sub_08037A58(this);
|
|
|
|
|
} else {
|
|
|
|
|
this->frame ^= 1;
|
|
|
|
|
super->frame ^= 1;
|
|
|
|
|
sub_08037B10(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_0803773C(Entity* this) {
|
|
|
|
|
UpdateAnimationSingleFrame(this);
|
|
|
|
|
if ((this->frame & 0x80) != 0) {
|
|
|
|
|
void sub_0803773C(GibdoEntity* this) {
|
|
|
|
|
UpdateAnimationSingleFrame(super);
|
|
|
|
|
if ((super->frame & 0x80) != 0) {
|
|
|
|
|
sub_08037794(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Turn into Stalfos
|
|
|
|
|
void sub_0803775C(Entity* this) {
|
|
|
|
|
void sub_0803775C(GibdoEntity* this) {
|
|
|
|
|
Entity* x;
|
|
|
|
|
if (!(--this->actionDelay)) {
|
|
|
|
|
if (!(--super->actionDelay)) {
|
|
|
|
|
x = CreateEnemy(STALFOS, 0);
|
|
|
|
|
if (x != 0) {
|
|
|
|
|
sub_0804A4E4(this, x);
|
|
|
|
|
sub_08037C0C(this, x);
|
|
|
|
|
sub_0804A4E4(super, x);
|
|
|
|
|
Gibdo_MoveObjectsToStalfos(this, x);
|
|
|
|
|
}
|
|
|
|
|
DeleteEntity(this);
|
|
|
|
|
DeleteEntity(super);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037794(Entity* this) {
|
|
|
|
|
this->action = 1;
|
|
|
|
|
this->field_0x74.HWORD = 0x1e;
|
|
|
|
|
this->hitType = 0x26;
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState);
|
|
|
|
|
void sub_08037794(GibdoEntity* this) {
|
|
|
|
|
super->action = 1;
|
|
|
|
|
this->field_0x74 = 0x1e;
|
|
|
|
|
super->hitType = 0x26;
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_080377B0(Entity* this) {
|
|
|
|
|
void sub_080377B0(GibdoEntity* this) {
|
|
|
|
|
u32 r1;
|
|
|
|
|
u32 r2;
|
|
|
|
|
this->action = 2;
|
|
|
|
|
this->field_0xf = 8;
|
|
|
|
|
super->action = 2;
|
|
|
|
|
super->field_0xf = 8;
|
|
|
|
|
r1 = Random();
|
|
|
|
|
this->field_0x74.HWORD = (r1 & 0x38) + 0x78;
|
|
|
|
|
this->speed = 0x40;
|
|
|
|
|
this->field_0x74 = (r1 & 0x38) + 0x78;
|
|
|
|
|
super->speed = 0x40;
|
|
|
|
|
r2 = Random();
|
|
|
|
|
if (!sub_08049FA0(this) && (r2 & 3)) {
|
|
|
|
|
this->direction = DirectionRoundUp(sub_08049EE4(this));
|
|
|
|
|
if (!sub_08049FA0(super) && (r2 & 3)) {
|
|
|
|
|
super->direction = DirectionRoundUp(sub_08049EE4(super));
|
|
|
|
|
} else {
|
|
|
|
|
this->direction = DirectionRound(r2);
|
|
|
|
|
super->direction = DirectionRound(r2);
|
|
|
|
|
}
|
|
|
|
|
this->animationState = this->direction / 8;
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState + 4);
|
|
|
|
|
super->animationState = super->direction / 8;
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState + 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 sub_08037810(Entity* this) {
|
|
|
|
|
u32 sub_08037810(GibdoEntity* this) {
|
|
|
|
|
u32 x;
|
|
|
|
|
u32 y;
|
|
|
|
|
if (this->field_0x76.HALF.LO == 0) {
|
|
|
|
|
if (sub_08049FDC(this, 1) != 0) {
|
|
|
|
|
if (EntityWithinDistance(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
|
|
|
|
|
x = GetFacingDirection(this, gUnk_020000B0);
|
|
|
|
|
if (((x - this->direction + 6) & 0x1f) <= 0xc) {
|
|
|
|
|
this->action = 3;
|
|
|
|
|
this->actionDelay = 0x18;
|
|
|
|
|
this->field_0xf = 0x8;
|
|
|
|
|
this->speed = 0xc0;
|
|
|
|
|
this->direction = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0));
|
|
|
|
|
this->animationState = this->direction >> 3;
|
|
|
|
|
this->field_0x74.HWORD = 300;
|
|
|
|
|
this->field_0x78.HWORD = gUnk_020000B0->x.HALF.HI;
|
|
|
|
|
this->field_0x7a.HWORD = gUnk_020000B0->y.HALF.HI;
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState);
|
|
|
|
|
if (this->field_0x76 == 0) {
|
|
|
|
|
if (sub_08049FDC(super, 1) != 0) {
|
|
|
|
|
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
|
|
|
|
|
x = GetFacingDirection(super, gUnk_020000B0);
|
|
|
|
|
if (((x - super->direction + 6) & 0x1f) <= 0xc) {
|
|
|
|
|
super->action = 3;
|
|
|
|
|
super->actionDelay = 0x18;
|
|
|
|
|
super->field_0xf = 0x8;
|
|
|
|
|
super->speed = 0xc0;
|
|
|
|
|
super->direction = DirectionRoundUp(GetFacingDirection(super, gUnk_020000B0));
|
|
|
|
|
super->animationState = super->direction >> 3;
|
|
|
|
|
this->field_0x74 = 300;
|
|
|
|
|
this->field_0x78 = gUnk_020000B0->x.HALF.HI;
|
|
|
|
|
this->field_0x7a = gUnk_020000B0->y.HALF.HI;
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this->field_0x76.HALF.LO--;
|
|
|
|
|
this->field_0x76--;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 sub_080378B0(Entity* this) {
|
|
|
|
|
if (this->field_0x76.HALF.HI == 0) {
|
|
|
|
|
u32 sub_080378B0(GibdoEntity* this) {
|
|
|
|
|
if (this->field_0x77 == 0) {
|
|
|
|
|
if (sub_08049DF4(1) != 0) {
|
|
|
|
|
if (sub_0804A044(this, gUnk_020000B0, 0xa) == this->direction)
|
|
|
|
|
if (EntityWithinDistance(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
|
|
|
|
|
this->action = 5;
|
|
|
|
|
this->speed = 0x100;
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState + 8);
|
|
|
|
|
if (sub_0804A044(super, gUnk_020000B0, 0xa) == super->direction)
|
|
|
|
|
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
|
|
|
|
|
super->action = 5;
|
|
|
|
|
super->speed = 0x100;
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState + 8);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this->field_0x76.HALF.HI--;
|
|
|
|
|
this->field_0x77--;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 sub_08037914(Entity* this) {
|
|
|
|
|
if (sub_08049FDC(this, 1) != 0) {
|
|
|
|
|
if (EntityWithinDistance(gUnk_020000B0, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x28) == 0) {
|
|
|
|
|
this->field_0x78.HWORD = gUnk_020000B0->x.HALF_U.HI;
|
|
|
|
|
this->field_0x7a.HWORD = gUnk_020000B0->y.HALF_U.HI;
|
|
|
|
|
u32 sub_08037914(GibdoEntity* this) {
|
|
|
|
|
if (sub_08049FDC(super, 1) != 0) {
|
|
|
|
|
if (EntityWithinDistance(gUnk_020000B0, this->field_0x78, this->field_0x7a, 0x28) == 0) {
|
|
|
|
|
this->field_0x78 = gUnk_020000B0->x.HALF_U.HI;
|
|
|
|
|
this->field_0x7a = gUnk_020000B0->y.HALF_U.HI;
|
|
|
|
|
sub_0803797C(this);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if (EntityWithinDistance(this, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x8) == 0) {
|
|
|
|
|
if (EntityWithinDistance(super, this->field_0x78, this->field_0x7a, 0x8) == 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
this->field_0x76.HALF.LO = 0x3c;
|
|
|
|
|
this->field_0x76 = 0x3c;
|
|
|
|
|
}
|
|
|
|
|
sub_08037794(this);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
NONMATCH("asm/non_matching/gibdo/sub_0803797C.inc", void sub_0803797C(Entity* this)) {
|
|
|
|
|
u32 z;
|
|
|
|
|
|
|
|
|
|
void sub_0803797C(GibdoEntity* this) {
|
|
|
|
|
u32 m;
|
|
|
|
|
this->actionDelay = 0x18;
|
|
|
|
|
this->field_0xf = 0x8;
|
|
|
|
|
z = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x78.HWORD, this->field_0x7a.HWORD);
|
|
|
|
|
m = (z + 4) & 0x18;
|
|
|
|
|
this->direction = m;
|
|
|
|
|
super->actionDelay = 0x18;
|
|
|
|
|
super->field_0xf = 8;
|
|
|
|
|
m = super->direction =
|
|
|
|
|
(sub_080045D4(super->x.HALF.HI, super->y.HALF.HI, this->field_0x78, this->field_0x7a) + 4) & 0x18;
|
|
|
|
|
;
|
|
|
|
|
m = m / 8;
|
|
|
|
|
if (m != this->animationState) {
|
|
|
|
|
this->animationState = m;
|
|
|
|
|
InitAnimationForceUpdate(this, m + 4);
|
|
|
|
|
if (m != super->animationState) {
|
|
|
|
|
super->animationState = m;
|
|
|
|
|
InitAnimationForceUpdate(super, m + 4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_NONMATCH
|
|
|
|
|
|
|
|
|
|
void sub_080379BC(Entity* this) {
|
|
|
|
|
void sub_080379BC(GibdoEntity* this) {
|
|
|
|
|
u32 r;
|
|
|
|
|
this->actionDelay = 0x18;
|
|
|
|
|
this->field_0xf = 0x8;
|
|
|
|
|
super->actionDelay = 0x18;
|
|
|
|
|
super->field_0xf = 0x8;
|
|
|
|
|
r = Random();
|
|
|
|
|
this->animationState = ((this->animationState + (r & 2)) - 1) & 3;
|
|
|
|
|
this->direction = DirectionFromAnimationState(this->animationState);
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState + 4);
|
|
|
|
|
super->animationState = ((super->animationState + (r & 2)) - 1) & 3;
|
|
|
|
|
super->direction = DirectionFromAnimationState(super->animationState);
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState + 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 sub_080379EC(Entity* this) {
|
|
|
|
|
u32 sub_080379EC(GibdoEntity* this) {
|
|
|
|
|
if (sub_0807953C() != 0) {
|
|
|
|
|
if (!(--this->actionDelay)) {
|
|
|
|
|
if (!(--super->actionDelay)) {
|
|
|
|
|
sub_08037A58(this);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
@@ -322,96 +335,113 @@ u32 sub_080379EC(Entity* this) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037A14(Entity* this) {
|
|
|
|
|
this->action = 6;
|
|
|
|
|
this->actionDelay = 0x18;
|
|
|
|
|
this->spritePriority.b0 = (this->spritePriority.b0 & (this->actionDelay - 0x20));
|
|
|
|
|
this->spritePriority.b0 |= 3;
|
|
|
|
|
this->flags2 &= 0xfe;
|
|
|
|
|
this->field_0x7c.BYTES.byte0 = 5;
|
|
|
|
|
CopyPosition(this, this->field_0x4c);
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState + 0xc);
|
|
|
|
|
}
|
|
|
|
|
// Take Damage maybe?
|
|
|
|
|
void sub_08037A58(Entity* this) {
|
|
|
|
|
sub_08037ACC(this);
|
|
|
|
|
this->action = 7;
|
|
|
|
|
this->spritePriority.b0 = 4;
|
|
|
|
|
if (this->iframes == 0) {
|
|
|
|
|
this->iframes = 0xec;
|
|
|
|
|
}
|
|
|
|
|
this->hitType = 0x26;
|
|
|
|
|
this->flags2 |= 1;
|
|
|
|
|
this->iframes = 0xf4;
|
|
|
|
|
this->knockbackDirection = DirectionFromAnimationState(this->animationState) ^ 0x10;
|
|
|
|
|
this->knockbackDuration = 8;
|
|
|
|
|
this->field_0x46 = 0x180;
|
|
|
|
|
this->field_0x76.HALF.LO = 0x3c;
|
|
|
|
|
InitAnimationForceUpdate(this, this->animationState + 0x10);
|
|
|
|
|
void sub_08037A14(GibdoEntity* this) {
|
|
|
|
|
super->action = 6;
|
|
|
|
|
super->actionDelay = 0x18;
|
|
|
|
|
super->spritePriority.b0 = (super->spritePriority.b0 & (super->actionDelay - 0x20));
|
|
|
|
|
super->spritePriority.b0 |= 3;
|
|
|
|
|
super->flags2 &= 0xfe;
|
|
|
|
|
this->field_0x7c = 5;
|
|
|
|
|
CopyPosition(super, super->field_0x4c);
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState + 0xc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037ACC(Entity* this) {
|
|
|
|
|
// Take Damage maybe?
|
|
|
|
|
void sub_08037A58(GibdoEntity* this) {
|
|
|
|
|
sub_08037ACC(this);
|
|
|
|
|
super->action = 7;
|
|
|
|
|
super->spritePriority.b0 = 4;
|
|
|
|
|
if (super->iframes == 0) {
|
|
|
|
|
super->iframes = 0xec;
|
|
|
|
|
}
|
|
|
|
|
super->hitType = 0x26;
|
|
|
|
|
super->flags2 |= 1;
|
|
|
|
|
super->iframes = 0xf4;
|
|
|
|
|
super->knockbackDirection = DirectionFromAnimationState(super->animationState) ^ 0x10;
|
|
|
|
|
super->knockbackDuration = 8;
|
|
|
|
|
super->field_0x46 = 0x180;
|
|
|
|
|
this->field_0x76 = 0x3c;
|
|
|
|
|
InitAnimationForceUpdate(super, super->animationState + 0x10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sub_08037ACC(GibdoEntity* this) {
|
|
|
|
|
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
|
|
|
|
|
COLLISION_ON(&gPlayerEntity);
|
|
|
|
|
gPlayerEntity.iframes = 0x1e;
|
|
|
|
|
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState);
|
|
|
|
|
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(super->animationState);
|
|
|
|
|
gPlayerEntity.knockbackDuration = 4;
|
|
|
|
|
gPlayerEntity.field_0x46 = 0x180;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Damage player maybe?
|
|
|
|
|
void sub_08037B10(Entity* this) {
|
|
|
|
|
void sub_08037B10(GibdoEntity* this) {
|
|
|
|
|
u32 h;
|
|
|
|
|
gPlayerEntity.iframes = 0xc;
|
|
|
|
|
h = ModHealth(-8);
|
|
|
|
|
SoundReqClipped(&gPlayerEntity, 0x7a);
|
|
|
|
|
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
|
|
|
|
|
if (h == 0) {
|
|
|
|
|
sub_08037A58(this);
|
|
|
|
|
this->field_0x76.HALF.LO = 0xf0;
|
|
|
|
|
this->field_0x76 = 0xf0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void sub_08037B48(Entity* this) {
|
|
|
|
|
|
|
|
|
|
void Gibdo_CreateObjects(GibdoEntity* this) {
|
|
|
|
|
Entity* E;
|
|
|
|
|
E = CreateObject(OBJECT_2A, 3, 0);
|
|
|
|
|
if (E != 0) {
|
|
|
|
|
E->type2 = this->actionDelay;
|
|
|
|
|
E->type2 = super->actionDelay;
|
|
|
|
|
E->spritePriority.b0 = 3;
|
|
|
|
|
E->spriteOffsetX = 0;
|
|
|
|
|
E->spriteOffsetY = 0xfc;
|
|
|
|
|
E->parent = this;
|
|
|
|
|
E->parent = super;
|
|
|
|
|
}
|
|
|
|
|
*(Entity**)&this->field_0x80.HWORD = E;
|
|
|
|
|
this->field_0x80 = E;
|
|
|
|
|
E = CreateObject(OBJECT_2A, 3, 0);
|
|
|
|
|
if (E != 0) {
|
|
|
|
|
E->type2 = this->actionDelay;
|
|
|
|
|
E->type2 = super->actionDelay;
|
|
|
|
|
E->spritePriority.b0 = 3;
|
|
|
|
|
E->spriteOffsetX = 0xfd;
|
|
|
|
|
E->spriteOffsetY = 0xf8;
|
|
|
|
|
E->parent = this;
|
|
|
|
|
E->parent = super;
|
|
|
|
|
}
|
|
|
|
|
*(Entity**)&this->cutsceneBeh.HWORD = E;
|
|
|
|
|
this->field_0x84 = E;
|
|
|
|
|
E = CreateObject(OBJECT_2A, 3, 0);
|
|
|
|
|
if (E != 0) {
|
|
|
|
|
E->type2 = this->actionDelay;
|
|
|
|
|
E->type2 = super->actionDelay;
|
|
|
|
|
E->spritePriority.b0 = 3;
|
|
|
|
|
E->spriteOffsetX = 0x5;
|
|
|
|
|
E->spriteOffsetY = 0xf5;
|
|
|
|
|
E->parent = this;
|
|
|
|
|
E->parent = super;
|
|
|
|
|
}
|
|
|
|
|
this->child = E;
|
|
|
|
|
super->child = E;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NONMATCH("asm/non_matching/gibdo/sub_08037C0C.inc", void sub_08037C0C(Entity* this, Entity* that)) {
|
|
|
|
|
if (this->field_0x80.HWORD != 0) {
|
|
|
|
|
this->actionDelay = 0xf;
|
|
|
|
|
this->parent = that;
|
|
|
|
|
void Gibdo_MoveObjectsToStalfos(GibdoEntity* this, Entity* that) {
|
|
|
|
|
Entity* ent = this->field_0x80;
|
|
|
|
|
if (ent != NULL) {
|
|
|
|
|
ent->actionDelay = 0xf;
|
|
|
|
|
ent->parent = that;
|
|
|
|
|
}
|
|
|
|
|
if (this->cutsceneBeh.HWORD != 0) {
|
|
|
|
|
this->actionDelay = 0xf;
|
|
|
|
|
this->parent = that;
|
|
|
|
|
|
|
|
|
|
ent = this->field_0x84;
|
|
|
|
|
if (ent != NULL) {
|
|
|
|
|
ent->actionDelay = 0xf;
|
|
|
|
|
ent->parent = that;
|
|
|
|
|
}
|
|
|
|
|
if (this->child != 0) {
|
|
|
|
|
this->actionDelay = 0xf;
|
|
|
|
|
this->parent = that;
|
|
|
|
|
|
|
|
|
|
ent = super->child;
|
|
|
|
|
if (ent != NULL) {
|
|
|
|
|
ent->actionDelay = 0xf;
|
|
|
|
|
ent->parent = that;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_NONMATCH
|
|
|
|
|
|
|
|
|
|
void (*const gGibdo[6])(Entity*) = {
|
|
|
|
|
(EntityActionPtr)Gibdo_OnTick, (EntityActionPtr)sub_080374A4, sub_08001324, sub_0804A7D4, sub_08001242,
|
|
|
|
|
(EntityActionPtr)nullsub_162,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void (*const gUnk_080CF2AC[9])(GibdoEntity*) = {
|
|
|
|
|
sub_08037558, sub_08037580, sub_080375A4, sub_080375F8, sub_08037624,
|
|
|
|
|
sub_08037690, sub_080376D0, sub_0803773C, sub_0803775C,
|
|
|
|
|
};
|
|
|
|
|