mirror of
https://github.com/zeldaret/tmc
synced 2026-08-18 13:43:31 -04:00
decompile LikeLike and SpearMoblin
remove redundant function definitions
This commit is contained in:
@@ -16,7 +16,6 @@ extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*));
|
||||
extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
|
||||
extern u32 GetNextFunction(Entity*);
|
||||
extern void SetChildOffset(Entity*, s32, s32, s32);
|
||||
extern u32 Random(void);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u8 gEntCount;
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08078B48(void);
|
||||
|
||||
void sub_08027870(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CC19C[])(Entity*);
|
||||
extern void (*const gUnk_080CC1B0[])(Entity*);
|
||||
extern const u8 gUnk_080CC1B8[];
|
||||
extern void (*const gUnk_080CC1C8[])(Entity*);
|
||||
extern void (*const gUnk_080CC1DC[])(Entity*);
|
||||
extern void (*const gUnk_080CC20C[])(Entity*);
|
||||
extern const u8 gUnk_080CC234[];
|
||||
extern const u8 gUnk_080CC24F[];
|
||||
extern void (*const gUnk_080CC258[])(Entity*);
|
||||
extern void (*const gUnk_080CC264[])(Entity*);
|
||||
extern void (*const gUnk_080CC26C[])(Entity*);
|
||||
extern const u8 gUnk_080CC278[];
|
||||
extern const u16 gUnk_080CC27C[];
|
||||
extern const u16 gUnk_080CC29C[];
|
||||
extern const u16 gUnk_080CC2BC[];
|
||||
extern const s8 gUnk_080CC2DC[];
|
||||
|
||||
void sub_08025DC0(Entity*);
|
||||
void sub_08025CBC(Entity*);
|
||||
void sub_08025CD4(Entity*);
|
||||
void sub_08001242(Entity*);
|
||||
void sub_08025DD8(Entity*);
|
||||
void sub_08026060(Entity*);
|
||||
void sub_08026110(Entity*);
|
||||
void sub_080272D4(Entity*);
|
||||
void sub_0802720C(Entity*);
|
||||
void sub_0802720C(Entity*);
|
||||
void sub_08026090(Entity*);
|
||||
void sub_0802626C(Entity*);
|
||||
void sub_08026580(Entity*);
|
||||
void sub_08026634(Entity*);
|
||||
void sub_08026750(Entity*);
|
||||
void sub_0802686C(Entity*);
|
||||
void sub_080268C8(Entity*);
|
||||
void sub_0802694C(Entity*);
|
||||
void sub_08026C40(Entity*);
|
||||
void sub_08026E1C(Entity*);
|
||||
void sub_08026FA4(Entity*);
|
||||
void sub_08027064(Entity*);
|
||||
void sub_08026F1C(Entity*);
|
||||
void sub_080262A8(Entity*);
|
||||
void sub_08026328(Entity*);
|
||||
void sub_08026358(Entity*);
|
||||
void sub_080263B4(Entity*);
|
||||
void sub_08026414(Entity*);
|
||||
void sub_0802647C(Entity*);
|
||||
void sub_080264AC(Entity*);
|
||||
void sub_080264D4(Entity*);
|
||||
void sub_0802650C(Entity*);
|
||||
void sub_0802653C(Entity*);
|
||||
void sub_08026774(Entity*);
|
||||
void sub_080267D0(Entity*);
|
||||
void sub_08026808(Entity*);
|
||||
void sub_080268EC(Entity*);
|
||||
void sub_08026914(Entity*);
|
||||
void sub_08026968(Entity*);
|
||||
void sub_080269CC(Entity*);
|
||||
void sub_08026BE8(Entity*);
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CC19C[])(Entity*) = {
|
||||
sub_08025DC0,
|
||||
sub_08025DC0,
|
||||
sub_08025CBC,
|
||||
sub_08025CD4,
|
||||
sub_08001242,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC1B0[])(Entity*) = {
|
||||
sub_08025DD8,
|
||||
sub_08026060,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CC1B8[] = {
|
||||
0, 4,
|
||||
0, 0,
|
||||
0, 4,
|
||||
0, 0,
|
||||
1, 4,
|
||||
0, 0,
|
||||
2, 4,
|
||||
0, 0,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC1C8[])(Entity*) = {
|
||||
sub_08026110,
|
||||
sub_080272D4,
|
||||
sub_0802720C,
|
||||
sub_0802720C,
|
||||
sub_08026090,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC1DC[])(Entity*) = {
|
||||
sub_0802626C,
|
||||
sub_08026580,
|
||||
sub_08026634,
|
||||
sub_08026750,
|
||||
sub_0802686C,
|
||||
sub_080268C8,
|
||||
sub_0802694C,
|
||||
sub_08026C40,
|
||||
sub_08026E1C,
|
||||
sub_08026FA4,
|
||||
sub_08027064,
|
||||
sub_08026F1C,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC20C[])(Entity*) = {
|
||||
sub_080262A8,
|
||||
sub_08026328,
|
||||
sub_08026358,
|
||||
sub_080263B4,
|
||||
sub_08026414,
|
||||
sub_0802647C,
|
||||
sub_080264AC,
|
||||
sub_080264D4,
|
||||
sub_0802650C,
|
||||
sub_0802653C,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CC234[] = {
|
||||
0x3C, 0x1E, 0x1E, 0x1E,
|
||||
0x1E, 0x0F, 0x0F, 0x0F,
|
||||
0x04, 0x04, 0x04, 0x04,
|
||||
0x04, 0x04, 0x0A, 0x0A,
|
||||
0x0A, 0x0F, 0x0F, 0x0F,
|
||||
0x1E, 0x1E, 0x2D, 0x0A,
|
||||
0x5A, 0x1E, 0xFF,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CC24F[] = {
|
||||
2, 2, 4, 4,
|
||||
4, 6, 6, 8,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC258[])(Entity*) = {
|
||||
sub_08026774,
|
||||
sub_080267D0,
|
||||
sub_08026808,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC264[])(Entity*) = {
|
||||
sub_080268EC,
|
||||
sub_08026914,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC26C[])(Entity*) = {
|
||||
sub_08026968,
|
||||
sub_080269CC,
|
||||
sub_08026BE8,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CC278[] = {
|
||||
150, 180, 210, 250,
|
||||
};
|
||||
|
||||
const u16 gUnk_080CC27C[] = {
|
||||
0x80, 0x8, 0x100, 0x6,
|
||||
0x80, 0x18, 0x100, 0x8,
|
||||
0x180, 0x6, 0x100, 0x10,
|
||||
0x0, 0x0, 0xA0, 0x18,
|
||||
};
|
||||
|
||||
const u16 gUnk_080CC29C[] = {
|
||||
0x80, 0x8, 0x100, 0x4,
|
||||
0x80, 0xC, 0x80, 0x6,
|
||||
0x200, 0x6, 0x100, 0xC,
|
||||
0x0, 0x0, 0xA0, 0x14,
|
||||
};
|
||||
|
||||
const u16 gUnk_080CC2BC[] = {
|
||||
0x80, 0x8, 0x100, 0x0,
|
||||
0x60, 0x2, 0x80, 0x2,
|
||||
0x200, 0x6, 0x100, 0x8,
|
||||
0x0, 0x0, 0xA0, 0x10,
|
||||
};
|
||||
|
||||
|
||||
const s8 gUnk_080CC2DC[] = {
|
||||
-7, -9, -7,
|
||||
};
|
||||
// clang-format on
|
||||
@@ -0,0 +1,287 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "textbox.h"
|
||||
|
||||
extern bool32 sub_080544B4(u32);
|
||||
extern void sub_0807CAA0(u32, u32);
|
||||
|
||||
void sub_0802810C(Entity*);
|
||||
void sub_080281A0(Entity*);
|
||||
bool32 sub_080281E0(u32);
|
||||
void sub_08028224(u32);
|
||||
|
||||
extern void (*const gUnk_080CC6FC[])(Entity*);
|
||||
extern void (*const gUnk_080CC714[])(Entity*);
|
||||
|
||||
void LikeLike(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CC6FC);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void sub_08027D8C(Entity* this) {
|
||||
gUnk_080CC714[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08027DA4(Entity* this) {
|
||||
if (this->damageType == 1) {
|
||||
this->action = 3;
|
||||
this->flags &= ~0x80;
|
||||
this->damageType = 0x8c;
|
||||
} else {
|
||||
if (this->action == 7) {
|
||||
sub_0802810C(this);
|
||||
} else if (this->bitfield & 0x80) {
|
||||
u8 tmp = this->bitfield & ~0x80;
|
||||
if (!tmp) {
|
||||
this->action = 7;
|
||||
this->actionDelay = 0x5f;
|
||||
this->field_0xf = tmp;
|
||||
this->flags2 &= 0xfc;
|
||||
this->field_0x82.HALF.HI = gPlayerEntity.spritePriority.b1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->currentHealth == 0) {
|
||||
this->actionDelay = 0x20;
|
||||
}
|
||||
|
||||
if (this->field_0x43) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
|
||||
sub_0804AA30(this, gUnk_080CC6FC);
|
||||
}
|
||||
|
||||
void sub_08027E40(Entity* this) {
|
||||
if (this->actionDelay == 2 && this->field_0x80.HALF.LO != 0xff) {
|
||||
sub_0805E3A0(this, 3);
|
||||
sub_08028224(this->field_0x80.HALF.LO);
|
||||
}
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
|
||||
void nullsub_139(Entity* this) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
void sub_08027E70(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
|
||||
switch (this->entityType.form) {
|
||||
case 0:
|
||||
this->action = 3;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->flags = this->flags & 0x7f;
|
||||
this->actionDelay = 0;
|
||||
break;
|
||||
case 1:
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->actionDelay = 8;
|
||||
InitializeAnimation(this, 1);
|
||||
break;
|
||||
case 2:
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->actionDelay = 0;
|
||||
this->damageType = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
this->direction = 0;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
this->animationState = 0;
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
this->field_0x80.HALF.LO = 0xff;
|
||||
}
|
||||
|
||||
void sub_08027EFC(Entity* this) {
|
||||
if (this->damageType == 1)
|
||||
return;
|
||||
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if (!sub_08049FA0(this) && (Random() & 0x30)) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
} else {
|
||||
this->direction = this->field_0x82.HALF.LO;
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->field_0x82.HALF.LO = this->direction;
|
||||
this->actionDelay = 8;
|
||||
}
|
||||
ProcessMovement(this);
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
this->action = 6;
|
||||
this->flags &= ~0x80;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_12(Entity* this) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
void sub_08027F84(Entity* this) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
this->action = 5;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
CreateDust(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08027FB4(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
this->flags2 |= 1;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_08027FE0(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
this->action = 1;
|
||||
this->flags |= 0x80;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->actionDelay = 8;
|
||||
this->spritePriority.b1 = 1;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802802C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
this->action = 3;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->direction = 0;
|
||||
this->actionDelay = 0;
|
||||
CreateDust(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802805C(Entity* this) {
|
||||
u8* tmp;
|
||||
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
|
||||
if (sub_0807953C()) {
|
||||
u32 tmp2 = Random();
|
||||
u32 tmp3 = this->field_0xf + 1;
|
||||
tmp3 += (tmp2 & 1);
|
||||
this->field_0xf = tmp3;
|
||||
}
|
||||
|
||||
if (this->field_0xf >= 0x19 || gUnk_02002A40.stats.health == 0) {
|
||||
sub_0802810C(this);
|
||||
} else {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
|
||||
|
||||
tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
|
||||
gPlayerEntity.spriteOffsetX = tmp[0];
|
||||
gPlayerEntity.spriteOffsetY = tmp[1];
|
||||
gPlayerEntity.spritePriority.b1 = 0;
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_080281A0(this);
|
||||
}
|
||||
|
||||
if ((this->actionDelay & 3) == 0) {
|
||||
EnqueueSFX(0x104);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
void sub_0802810C(Entity* this) {
|
||||
gPlayerState.jumpStatus = 0x41;
|
||||
gPlayerState.field_0xa = 0;
|
||||
gPlayerState.flags.all &= 0xffffffef;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
gPlayerEntity.field_0x20 = 0x18000;
|
||||
gPlayerEntity.hurtBlinkTime = -60;
|
||||
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI;
|
||||
gPlayerEntity.height.HALF.HI = gPlayerEntity.spriteOffsetY;
|
||||
gPlayerEntity.spriteOffsetY = 0;
|
||||
this->action = 4;
|
||||
this->actionDelay = 0x50;
|
||||
this->field_0xf = 0;
|
||||
this->flags2 |= 2;
|
||||
if (this->hurtBlinkTime == 0) {
|
||||
this->hurtBlinkTime = -18;
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_0802810C(Entity* this) {
|
||||
asm(".include \"asm/non_matching/likeLike/sub_0802810C.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_080281A0(Entity* this) {
|
||||
this->field_0xf = 0x19;
|
||||
if (sub_080281E0(0xe)) {
|
||||
this->field_0x80.HALF.LO = 0xe;
|
||||
TextboxNoOverlapFollow(0x578);
|
||||
} else if (sub_080281E0(0xd)) {
|
||||
this->field_0x80.HALF.LO = 0xd;
|
||||
TextboxNoOverlapFollow(0x578);
|
||||
} else {
|
||||
ModHealth(-1);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_080281E0(u32 param_1) {
|
||||
bool32 ret = FALSE;
|
||||
if (GetInventoryValue(param_1) == 1) {
|
||||
if (sub_080544B4(gUnk_02002A40.stats.itemOnA)) {
|
||||
gUnk_02002A40.stats.itemOnA = 0;
|
||||
}
|
||||
|
||||
if (sub_080544B4(gUnk_02002A40.stats.itemOnB)) {
|
||||
gUnk_02002A40.stats.itemOnB = 0;
|
||||
}
|
||||
|
||||
sub_0807CAA0(param_1, 0);
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sub_08028224(u32 param_1) {
|
||||
sub_080A7C18(param_1, 0, 1);
|
||||
TextboxNoOverlapFollow(0x579);
|
||||
}
|
||||
|
||||
|
||||
void (*const gUnk_080CC6FC[])(Entity *) = {
|
||||
sub_08027D8C,
|
||||
sub_08027DA4,
|
||||
sub_08001324,
|
||||
sub_08027E40,
|
||||
sub_08001242,
|
||||
nullsub_139,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC714[])(Entity *) = {
|
||||
sub_08027E70,
|
||||
sub_08027EFC,
|
||||
nullsub_12,
|
||||
sub_08027F84,
|
||||
sub_08027FB4,
|
||||
sub_08027FE0,
|
||||
sub_0802802C,
|
||||
sub_0802805C,
|
||||
};
|
||||
+4
-2
@@ -10,7 +10,6 @@ extern u32 sub_0806F520();
|
||||
extern void sub_0806F4E8();
|
||||
extern void UpdateAnimationVariableFrames();
|
||||
extern void sub_0804A720();
|
||||
extern u32 Random();
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
|
||||
void Octorok_Pause();
|
||||
@@ -233,7 +232,10 @@ const u8 gOctorokSpitChanceModifier[] = {
|
||||
};
|
||||
|
||||
const u8 gOctorokNutOffset[] = {
|
||||
0, -3, 4, 0, 0, 2, -4, 0,
|
||||
0, -3,
|
||||
4, 0,
|
||||
0, 2,
|
||||
-4, 0,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CA17E[] = {
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern bool32 sub_0806FC80(Entity*, Entity*, u32);
|
||||
extern Entity* sub_080A7EE0(u32);
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
|
||||
void sub_08028604(Entity*);
|
||||
void sub_08028754(Entity*);
|
||||
void sub_08028784(Entity*);
|
||||
void sub_080287E0(Entity*);
|
||||
void sub_08028728(Entity*);
|
||||
bool32 sub_080286CC(Entity*);
|
||||
bool32 sub_080288A4(Entity*);
|
||||
void sub_08028858(Entity*);
|
||||
void sub_080288C0(Entity*);
|
||||
bool32 sub_08028828(u32, u32);
|
||||
void sub_080287B4(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CC790[])(Entity*);
|
||||
extern void (*const gUnk_080CC7A8[])(Entity*);
|
||||
extern const u8 gUnk_080CC7BC[];
|
||||
extern const s8 gUnk_080CC7C0[];
|
||||
extern const u8 gUnk_080CC7D0[];
|
||||
extern const u16 gUnk_080CC7D8[];
|
||||
|
||||
extern const BoundingBox* const gUnk_080CC944[];
|
||||
|
||||
void SpearMoblin(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CC790);
|
||||
SetChildOffset(this, 0, 1, -0x20);
|
||||
if (this->attachedEntity && this->attachedEntity->next) {
|
||||
CopyPosition(this, this->attachedEntity);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802826C(Entity* this) {
|
||||
gUnk_080CC7A8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08028284(Entity* this) {
|
||||
if (this->field_0x43 != 0)
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
|
||||
sub_0804AA30(this, gUnk_080CC790);
|
||||
if (this->bitfield & 0x80) {
|
||||
if (this->action != 4) {
|
||||
sub_08028754(this);
|
||||
} else {
|
||||
if ((this->bitfield & 0x3f) == 0) {
|
||||
this->field_0x7a.HALF.LO++;
|
||||
this->field_0x80.HALF.HI = 0x16;
|
||||
sub_08028784(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->attachedEntity->hurtBlinkTime = this->hurtBlinkTime;
|
||||
if (this->currentHealth == 0) {
|
||||
this->nonPlanarMovement = 0;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
sub_080287E0(this);
|
||||
DeleteEntity(this->attachedEntity);
|
||||
this->attachedEntity = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_13(Entity* this) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
void sub_08028314(Entity* this) {
|
||||
Entity* pEVar2;
|
||||
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->animationState = 0;
|
||||
this->field_0x7a.HALF.HI = 0;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
this->field_0x7a.HALF.LO = 0;
|
||||
this->field_0x82.HALF.LO = 1;
|
||||
|
||||
if (this->actionDelay) {
|
||||
this->animationState = this->entityType.parameter << 1;
|
||||
this->actionDelay = 0x1e;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->direction = this->animationState << 2;
|
||||
sub_080287E0(this);
|
||||
} else {
|
||||
this->animationState = 0x10;
|
||||
sub_08028604(this);
|
||||
}
|
||||
|
||||
pEVar2 = sub_080A7EE0(3);
|
||||
if (pEVar2 != NULL) {
|
||||
pEVar2->parent = this;
|
||||
this->attachedEntity = pEVar2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08028378(Entity* this) {
|
||||
if (this->field_0x80.HALF.HI != 0) {
|
||||
this->field_0x80.HALF.HI--;
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
if (++this->field_0x80.HALF.LO >= 0x10) {
|
||||
sub_08028728(this);
|
||||
} else {
|
||||
sub_08028604(this);
|
||||
}
|
||||
} else {
|
||||
if (sub_080286CC(this)) {
|
||||
this->field_0x7a.HALF.HI |= 1;
|
||||
}
|
||||
if (sub_080288A4(this)) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
this->animationState = DirectionRoundUp(this->direction) >> 2;
|
||||
this->field_0x82.HALF.HI++;
|
||||
sub_080287E0(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0xf >= 0xc) {
|
||||
if (this->field_0x7a.HALF.HI != 0) {
|
||||
sub_08028754(this);
|
||||
}
|
||||
} else {
|
||||
this->field_0xf++;
|
||||
}
|
||||
|
||||
sub_08028858(this);
|
||||
}
|
||||
|
||||
void sub_08028420(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
this->animationState = 0x10;
|
||||
sub_08028604(this);
|
||||
} else {
|
||||
if (sub_080286CC(this)) {
|
||||
this->field_0x7a.HALF.HI |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0xf >= 0xc) {
|
||||
if (this->field_0x7a.HALF.HI != 0) {
|
||||
sub_08028754(this);
|
||||
}
|
||||
} else {
|
||||
this->field_0xf++;
|
||||
}
|
||||
|
||||
sub_08028858(this);
|
||||
}
|
||||
|
||||
void sub_08028488(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
switch (this->field_0x82.HALF.LO) {
|
||||
case 3:
|
||||
this->action = 4;
|
||||
this->nonPlanarMovement = 0x180;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
EnqueueSFX(0x11e);
|
||||
break;
|
||||
case 2:
|
||||
this->action = 2;
|
||||
this->nonPlanarMovement = 0;
|
||||
this->actionDelay = (Random() & 7) * 3 + 0x40;
|
||||
break;
|
||||
case 4:
|
||||
this->direction = (this->direction + 0x10) & 0x18;
|
||||
/* fallthrough */
|
||||
case 1:
|
||||
default:
|
||||
this->action = 1;
|
||||
this->field_0x82.HALF.LO = 1;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->actionDelay = (Random() & 7) * 3 + 0x22;
|
||||
break;
|
||||
}
|
||||
|
||||
this->field_0xf = 0;
|
||||
this->animationState = DirectionRoundUp(this->direction) >> 2;
|
||||
sub_080287E0(this);
|
||||
}
|
||||
|
||||
sub_08028858(this);
|
||||
}
|
||||
|
||||
void sub_08028528(Entity* this) {
|
||||
Entity* ent = sub_08049DF4(1);
|
||||
const BoundingBox* box;
|
||||
|
||||
if (ent == NULL) {
|
||||
this->field_0xf = 0;
|
||||
sub_08028728(this);
|
||||
} else {
|
||||
sub_080288C0(this);
|
||||
box = gUnk_080CC944[this->animationState >> 1];
|
||||
this->boundingBox->unknown[0] = box->unknown[0];
|
||||
this->boundingBox->unknown[1] = box->unknown[1];
|
||||
this->boundingBox->unknown[6] = box->unknown[6];
|
||||
this->boundingBox->unknown[7] = box->unknown[7];
|
||||
|
||||
if (this->field_0x7a.HALF.LO != 0) {
|
||||
this->field_0x7a.HALF.LO = 0;
|
||||
this->field_0x80.HALF.HI = 0x16;
|
||||
sub_08028784(this);
|
||||
} else {
|
||||
if (++this->actionDelay == 0x20) {
|
||||
u32 direction;
|
||||
this->actionDelay = 0;
|
||||
direction = GetFacingDirection(this, ent);
|
||||
if (sub_08028828(this->direction, direction)) {
|
||||
this->direction = direction;
|
||||
}
|
||||
}
|
||||
|
||||
if ((this->actionDelay & 7) == 0) {
|
||||
EnqueueSFX(0xf0);
|
||||
CreateFx(this, 2, 0x40);
|
||||
}
|
||||
|
||||
if (++this->field_0x7a.HALF.HI == 0x80) {
|
||||
this->field_0x7a.HALF.LO++;
|
||||
}
|
||||
}
|
||||
|
||||
if (0x20 < this->field_0x7a.HALF.HI) {
|
||||
ProcessMovement(this);
|
||||
}
|
||||
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
void sub_08028604(Entity* this) {
|
||||
this->field_0xf = 0;
|
||||
if (this->field_0x82.HALF.LO == 1) {
|
||||
this->actionDelay = gUnk_080CC7BC[Random() & 3];
|
||||
this->nonPlanarMovement = 0x80;
|
||||
if (sub_08049FA0(this) != 0) {
|
||||
this->direction = gUnk_080CC7D0[Random() & 7] + 0x18 + this->direction & 0x18;
|
||||
} else {
|
||||
u32 iVar3 = sub_08049EE4(this);
|
||||
u32 uVar1;
|
||||
if (this->field_0x82.HALF.HI == '\0') {
|
||||
uVar1 = gUnk_080CC7C0[Random() & 0xf];
|
||||
} else {
|
||||
uVar1 = gUnk_080CC7C0[Random() & 7];
|
||||
this->actionDelay = this->actionDelay + 0x10;
|
||||
this->field_0x82.HALF.HI--;
|
||||
}
|
||||
this->direction = iVar3 + uVar1 + 4U & 0x18;
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = 0xc;
|
||||
this->nonPlanarMovement = 0;
|
||||
}
|
||||
|
||||
if (this->direction >> 2 != this->animationState) {
|
||||
this->animationState = this->direction >> 2;
|
||||
sub_080287E0(this);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_08028604(Entity* this) {
|
||||
asm(".include \"asm/non_matching/spearMoblin/sub_08028604.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
bool32 sub_080286CC(Entity* this) {
|
||||
if (this->field_0x80.HALF.HI == 0) {
|
||||
Entity* ent = sub_08049DF4(1);
|
||||
if (ent != NULL) {
|
||||
if (this->field_0x82.HALF.LO == 2 && sub_0806FC80(this, ent, 0x30))
|
||||
return TRUE;
|
||||
|
||||
if (sub_0806FC80(this, ent, 0x40) &&
|
||||
DirectionRoundUp(GetFacingDirection(this, ent)) >> 2 == this->animationState)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_08028728(Entity* this) {
|
||||
this->animationState = DirectionRoundUp(this->direction) >> 2;
|
||||
this->direction = this->animationState << 2;
|
||||
this->field_0x82.HALF.HI >>= 1;
|
||||
sub_080287B4(this);
|
||||
this->field_0x82.HALF.LO = 2;
|
||||
}
|
||||
|
||||
void sub_08028754(Entity* this) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->animationState = DirectionRoundUp(this->direction) >> 2;
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
sub_080287B4(this);
|
||||
this->field_0x82.HALF.LO = 3;
|
||||
}
|
||||
|
||||
void sub_08028784(Entity* this) {
|
||||
this->animationState = DirectionRoundUp(this->direction) >> 2;
|
||||
this->direction = this->animationState << 2;
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
sub_080287B4(this);
|
||||
this->actionDelay <<= 1;
|
||||
this->field_0x82.HALF.LO = 4;
|
||||
}
|
||||
|
||||
void sub_080287B4(Entity* this) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0x20;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
this->field_0x7a.HALF.HI = 0;
|
||||
this->nonPlanarMovement = 0;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
sub_080287E0(this);
|
||||
}
|
||||
|
||||
void sub_080287E0(Entity* this) {
|
||||
u32 sprite = this->animationState >> 1;
|
||||
switch (this->field_0x82.HALF.LO) {
|
||||
case 0:
|
||||
/* ... */
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
sprite += 4;
|
||||
break;
|
||||
case 3:
|
||||
sprite += 8;
|
||||
break;
|
||||
case 2:
|
||||
sprite += 0xc;
|
||||
break;
|
||||
}
|
||||
InitializeAnimation(this, sprite);
|
||||
}
|
||||
|
||||
bool32 sub_08028828(u32 arg0, u32 arg1) {
|
||||
if (DirectionRoundUp(arg1) == DirectionRoundUp(arg0)) {
|
||||
u32 angle1 = (arg1 + 5) & 7;
|
||||
u32 angle0 = (arg0 + 5) & 7;
|
||||
if (angle1 < 3 && angle0 < 3)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_08028858(Entity* this) {
|
||||
const BoundingBox* box;
|
||||
|
||||
sub_080288C0(this);
|
||||
box = gUnk_080CC944[this->animationState >> 1];
|
||||
this->boundingBox->unknown[0] = box->unknown[0];
|
||||
this->boundingBox->unknown[1] = box->unknown[1];
|
||||
this->boundingBox->unknown[6] = box->unknown[6];
|
||||
this->boundingBox->unknown[7] = box->unknown[7];
|
||||
|
||||
if (this->field_0x82.HALF.LO == 0) {
|
||||
this->nonPlanarMovement = 0;
|
||||
}
|
||||
|
||||
ProcessMovement(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
bool32 sub_080288A4(Entity* this) {
|
||||
return (this->collisions & gUnk_080CC7D8[this->animationState >> 1]) != 0;
|
||||
}
|
||||
|
||||
void sub_080288C0(Entity* this) {
|
||||
Entity* ent = this->attachedEntity;
|
||||
if (ent && (ent->bitfield & 0x80)) {
|
||||
this->field_0x3e = ent->field_0x3e;
|
||||
this->hurtBlinkTime = -ent->hurtBlinkTime;
|
||||
this->field_0x46 = ent->field_0x46;
|
||||
this->field_0x42 = ent->field_0x42;
|
||||
ent->field_0x42 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CC790[])(Entity*) = {
|
||||
sub_0802826C,
|
||||
sub_08028284,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
nullsub_13,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CC7A8[])(Entity*) = {
|
||||
sub_08028314,
|
||||
sub_08028378,
|
||||
sub_08028420,
|
||||
sub_08028488,
|
||||
sub_08028528,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CC7BC[] = {
|
||||
0x30, 0x60, 0x6C, 0x91,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CC7C0[] = {
|
||||
0xF8, 0x0C,
|
||||
0xF4, 0x08,
|
||||
0x04, 0xFA,
|
||||
0x06, 0xFC,
|
||||
0x00, 0xFD,
|
||||
0x01, 0x03,
|
||||
0xFF, 0x02,
|
||||
0x00, 0xFE,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CC7D0[] = {
|
||||
0x08, 0x10,
|
||||
0x08, 0x00,
|
||||
0x10, 0x08,
|
||||
0x10, 0x00,
|
||||
};
|
||||
|
||||
const u16 gUnk_080CC7D8[] = {
|
||||
0xE, 0xE000, 0xE0, 0xE00,
|
||||
};
|
||||
// clang-format on
|
||||
+1
-2
@@ -2,16 +2,15 @@
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*gUnk_081140D4[])(Entity*);
|
||||
|
||||
extern u16 gUnk_081140CC[];
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0806D0B0(Entity*);
|
||||
extern void sub_0807DD64(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0806D02C(Entity*);
|
||||
extern Entity* FindEntityInListByForm(u32, u32, u32, u32, u32);
|
||||
|
||||
@@ -15,7 +15,6 @@ extern void (*gUnk_08111914[])(Entity*);
|
||||
extern void (*gUnk_08111928[])(Entity*);
|
||||
extern Dialog gUnk_08111938[];
|
||||
extern void PlaySFX(u32);
|
||||
extern u32 Random();
|
||||
extern u32 UpdateFuseInteraction(Entity*);
|
||||
extern PlayerState gPlayerState;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ extern void sub_08060158(Entity*);
|
||||
extern u32 CheckKinstoneFused(u32);
|
||||
extern Entity* FindEntityInListBySubtype(u32, u32, u32);
|
||||
extern void DeleteEntity(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void ModBombs(s32);
|
||||
|
||||
extern SpriteLoadData gUnk_0810A348;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
extern void sub_08068780(Entity*);
|
||||
extern void sub_08078778(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
|
||||
@@ -8,7 +8,6 @@ extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern Entity* CreateFx(Entity*, u32, u32);
|
||||
extern void PlaySFX(u32);
|
||||
extern u32 Random(void);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
|
||||
@@ -35,7 +35,6 @@ extern void sub_08062048(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
extern void sub_08078778(Entity*);
|
||||
extern u32 sub_0806F5B0(u32);
|
||||
extern u32 Random(void);
|
||||
extern void ResolveEntityOnTop(Entity*, Entity*);
|
||||
extern void sub_08078850(Entity*, u32, u8, u32*);
|
||||
|
||||
|
||||
+4
-5
@@ -3,6 +3,7 @@
|
||||
#include "room.h"
|
||||
#include "player.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0809F7BC(Entity*);
|
||||
extern void PlaySFX(u32);
|
||||
@@ -13,7 +14,6 @@ extern void DeleteThisEntity();
|
||||
extern u32 CheckRoomFlag(u32);
|
||||
extern void sub_08078A90(u32);
|
||||
extern void sub_08078B48(void);
|
||||
extern u32 Random(void);
|
||||
extern void sub_0806F69C(Entity*);
|
||||
extern void (*gUnk_08124798[])(Entity*);
|
||||
extern void (*gUnk_081247A0[])(Entity*);
|
||||
@@ -23,7 +23,6 @@ extern void PositionEntityOnTop(Entity*, Entity*);
|
||||
extern void sub_0807BB68(u32*, u32, u32);
|
||||
|
||||
extern u8 gUnk_02034490;
|
||||
extern u32 gScreenTransition;
|
||||
extern void* gUnk_080DD750;
|
||||
extern Entity gPlayerEntity;
|
||||
extern PlayerState gPlayerState;
|
||||
@@ -62,7 +61,7 @@ void sub_0809F548(Entity* this) {
|
||||
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
|
||||
} else {
|
||||
if ((gScreenTransition & 7) == 0) {
|
||||
if ((gScreenTransition.frameCount & 7) == 0) {
|
||||
sub_0809F7BC(this);
|
||||
}
|
||||
sub_0809F7F4(this);
|
||||
@@ -110,7 +109,7 @@ void sub_0809F61C(Entity* this) {
|
||||
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
|
||||
} else {
|
||||
if ((gScreenTransition & 7) == 0) {
|
||||
if ((gScreenTransition.frameCount & 7) == 0) {
|
||||
sub_0809F7BC(this);
|
||||
}
|
||||
sub_0809F7F4(this);
|
||||
@@ -145,7 +144,7 @@ void sub_0809F700(Entity* this) {
|
||||
this->actionDelay = (Random() & 30) + 8;
|
||||
this->flags = this->flags | 12;
|
||||
}
|
||||
if ((gScreenTransition & 3) == 0) {
|
||||
if ((gScreenTransition.frameCount & 3) == 0) {
|
||||
uVar2 = Random();
|
||||
this->spriteOffsetX = gUnk_081247C0[uVar2 & 7];
|
||||
this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7];
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "screen.h"
|
||||
#include "greatFairy.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
|
||||
enum {
|
||||
BEHAVIORS,
|
||||
@@ -550,14 +551,14 @@ void sub_08087424(Entity* arg0, struct_08087424* arg1) {
|
||||
void sub_0808747C(u32 arg0, u32 arg1) {
|
||||
u32 iVar1;
|
||||
|
||||
iVar1 = FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0);
|
||||
iVar1 = (u32)FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0);
|
||||
if (iVar1 != 0) {
|
||||
iVar1 = 1;
|
||||
}
|
||||
*(u32*)(arg1 + 0x14) = iVar1;
|
||||
}
|
||||
|
||||
//clang-format off
|
||||
// clang-format off
|
||||
void (*const GreatFairy_Main[])(Entity*) = {
|
||||
GreatFairy_CallBehavior,
|
||||
GreatFairy_WingsCallBehavior,
|
||||
@@ -647,5 +648,4 @@ void (*const GreatFairy_Form2Behaviors[])(Entity*) = {
|
||||
sub_08087264,
|
||||
sub_0808727C
|
||||
};
|
||||
|
||||
//clang-format on
|
||||
// clang-format on
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern u32 Random();
|
||||
extern bool32 CheckIsDungeon();
|
||||
extern void sub_080AE068(Entity*);
|
||||
extern void LoadFixedGFX(Entity*, u32);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08086A6C();
|
||||
extern s32 sub_080044EC();
|
||||
extern void ProcessMovement();
|
||||
extern u32 Random(void);
|
||||
|
||||
extern void (*gUnk_081206C4[99])(Entity*);
|
||||
|
||||
@@ -33,12 +31,10 @@ void sub_080869DC(Entity* ent) {
|
||||
}
|
||||
|
||||
void sub_08086A28(Entity* ent) {
|
||||
s32 iVar1;
|
||||
|
||||
if (ent->attachedEntity->next == NULL) {
|
||||
ent->action = 2;
|
||||
} else {
|
||||
iVar1 = sub_080044EC(ent, 10240);
|
||||
u32 iVar1 = sub_080044EC(ent, 10240);
|
||||
if (iVar1 == 0) {
|
||||
ent->action = 2;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 Random(void);
|
||||
extern void sub_0806F69C(Entity*);
|
||||
|
||||
extern void (*const gUnk_08121060[])(Entity*);
|
||||
|
||||
Reference in New Issue
Block a user