mirror of
https://github.com/zeldaret/tmc
synced 2026-06-09 04:40:07 -04:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+5
-5
@@ -55,7 +55,7 @@ static void sub_08050624(u32);
|
||||
static void sub_0805066C(void);
|
||||
static void sub_080507FC(void);
|
||||
|
||||
extern void sub_0801D66C(const void* src, void* dest, u32 size);
|
||||
extern void _DmaCopy(const void* src, void* dest, u32 size);
|
||||
extern void sub_08056FEC(u32, struct_020227E8*);
|
||||
extern void sub_0805F46C(u32, struct_080FC844*);
|
||||
extern void sub_0801C4A0(u32, u32);
|
||||
@@ -83,7 +83,7 @@ void sub_08050318(u32 arg0, u32 arg1) {
|
||||
struct_080FC844 var0;
|
||||
|
||||
sub_08050384();
|
||||
sub_0801D66C(&gUnk_080FC844, &var0, sizeof(gUnk_080FC844));
|
||||
_DmaCopy(&gUnk_080FC844, &var0, sizeof(gUnk_080FC844));
|
||||
sub_08056FEC(arg1, &gUnk_020227E8);
|
||||
var0.unk10 |= gUnk_080FC85C[arg0][0] << 0xC;
|
||||
sub_0805F46C(gUnk_080FC85C[arg0][1], &var0);
|
||||
@@ -136,7 +136,7 @@ void sub_0805041C(u32 saveFileId) {
|
||||
if (saveFileId < 3) {
|
||||
((struct_02000000 *)0x2000000)->saveFileId = saveFileId;
|
||||
saveFile = &gSaveFiles[saveFileId];
|
||||
sub_0801D66C(saveFile, &gUnk_02002A40, sizeof(*saveFile));
|
||||
_DmaCopy(saveFile, &gUnk_02002A40, sizeof(*saveFile));
|
||||
}
|
||||
sub_080503E4(saveFileId);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ void sub_0805070C(void) {
|
||||
for (j = 0; j < 6; j++) {
|
||||
sub_0805F7DC(playerName[j], var0);
|
||||
}
|
||||
sub_0801D66C(var0->unk8, (void*)(OBJ_VRAM0 + 0x4000 + i * 0x200), 0x200);
|
||||
_DmaCopy(var0->unk8, (void*)(OBJ_VRAM0 + 0x4000 + i * 0x200), 0x200);
|
||||
}
|
||||
sub_0805F300(var0);
|
||||
}
|
||||
@@ -307,7 +307,7 @@ void sub_08050790(void) {
|
||||
sub_0805F7DC(var1, var0);
|
||||
var1++;
|
||||
}
|
||||
sub_0801D66C(gUnk_02000D00, (void*)(BG_VRAM + i * 0x400), 0x400);
|
||||
_DmaCopy(gUnk_02000D00, (void*)(BG_VRAM + i * 0x400), 0x400);
|
||||
}
|
||||
sub_0805F300(var0);
|
||||
}
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ void sub_08054524(void) {
|
||||
bVar1 = 0;
|
||||
}
|
||||
|
||||
sub_0801D66C(&gUnk_080015BC + gUnk_080FE1C6[bVar1] * 0x8, &gUnk_02034398, 0x20);
|
||||
_DmaCopy(&gUnk_080015BC + gUnk_080FE1C6[bVar1] * 0x8, &gUnk_02034398, 0x20);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
|
||||
void sub_080A29BC(Entity *parent)
|
||||
{
|
||||
CreateFx(parent, 2, 0);
|
||||
}
|
||||
|
||||
void sub_080A29C8(s32 xOff, s32 yOff, u32 layer)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
pEVar1 = CreateObject(0xf, 2, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->x.HALF.HI = gRoomControls.roomOriginX + xOff;
|
||||
pEVar1->y.HALF.HI = gRoomControls.roomOriginY + yOff;
|
||||
pEVar1->collisionLayer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A29FC(Entity *parent)
|
||||
{
|
||||
CreateFx(parent, 0x11, 0);
|
||||
}
|
||||
|
||||
void sub_080A2A08(Entity *parent)
|
||||
{
|
||||
CreateFx(parent, 0x6, 0);
|
||||
}
|
||||
|
||||
void sub_080A2A14(Entity *parent)
|
||||
{
|
||||
CreateFx(parent, 0xb, 0);
|
||||
}
|
||||
|
||||
Entity * sub_080A2A20(Entity *parent, u32 form, u32 parameter)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
pEVar1 = CreateObjectWithParent(parent, 0, form, parameter);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->actionDelay = 5;
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
|
||||
Entity * sub_080A2A3C(Entity *parent, u32 form, u32 subtype, u32 param_4)
|
||||
{
|
||||
Entity *ent;
|
||||
|
||||
ent = CreateObjectWithParent(parent, 0, form, subtype);
|
||||
if (ent != NULL) {
|
||||
ent->actionDelay = 5;
|
||||
ent->field_0x86 = param_4;
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
Entity * sub_080A2A64(Entity *parent)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
pEVar1 = CreateFx(parent, 0x20, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->spritePriority.b0 = 7;
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
+85
-12
@@ -1,21 +1,94 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
|
||||
extern Entity* GetEmptyEntity();
|
||||
extern void AppendEntityToList(Entity*, u8);
|
||||
|
||||
Entity* CreateObject(u32 subtype, u32 param1, u32 param2)
|
||||
Entity* CreateObject(u32 subtype, u32 form, u32 parameter) {
|
||||
Entity* ent;
|
||||
|
||||
{
|
||||
Entity* newEnt;
|
||||
|
||||
newEnt = GetEmptyEntity();
|
||||
if (newEnt != NULL) {
|
||||
(newEnt->entityType).type = 6;
|
||||
(newEnt->entityType).subtype = subtype;
|
||||
(newEnt->entityType).form = param1;
|
||||
(newEnt->entityType).parameter = param2;
|
||||
AppendEntityToList(newEnt, 6);
|
||||
ent = GetEmptyEntity();
|
||||
if (ent != NULL) {
|
||||
ent->entityType.type = 6;
|
||||
ent->entityType.subtype = subtype;
|
||||
ent->entityType.form = form;
|
||||
ent->entityType.parameter = parameter;
|
||||
AppendEntityToList(ent, 6);
|
||||
}
|
||||
return newEnt;
|
||||
return ent;
|
||||
}
|
||||
|
||||
Entity* CreateObjectWithParent(Entity* parentEnt, u32 subtype, u32 form, u32 parameter) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateObject(subtype, form, parameter);
|
||||
if (ent != NULL) {
|
||||
ent->parent = parentEnt;
|
||||
CopyPosition(parentEnt, ent);
|
||||
}
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
Entity* CreateFx(Entity* parentEnt, u32 form, u32 parameter) {
|
||||
return CreateObjectWithParent(parentEnt, 0xf, form, parameter);
|
||||
}
|
||||
|
||||
void CreateDust(Entity* parent) {
|
||||
CreateFx(parent, 2, 0);
|
||||
}
|
||||
|
||||
void CreateDustAt(s32 xOff, s32 yOff, u32 layer) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateObject(0xf, 2, 0);
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI = gRoomControls.roomOriginX + xOff;
|
||||
ent->y.HALF.HI = gRoomControls.roomOriginY + yOff;
|
||||
ent->collisionLayer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateDustSmall(Entity* parent) {
|
||||
CreateFx(parent, 0x11, 0);
|
||||
}
|
||||
|
||||
void CreateExplosionBroken(Entity* parent) {
|
||||
CreateFx(parent, 0x6, 0);
|
||||
}
|
||||
|
||||
void CreateWaterSplash(Entity* parent) {
|
||||
CreateFx(parent, 0xb, 0);
|
||||
}
|
||||
|
||||
Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateObjectWithParent(parent, 0, form, parameter);
|
||||
if (ent != NULL) {
|
||||
ent->actionDelay = 5;
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateObjectWithParent(parent, 0, form, subtype);
|
||||
if (ent != NULL) {
|
||||
ent->actionDelay = 5;
|
||||
ent->field_0x86 = param_4;
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
Entity* CreateWaterTrace(Entity* parent) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateFx(parent, 0x20, 0);
|
||||
if (ent != NULL) {
|
||||
ent->spritePriority.b0 = 7;
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
Entity* CreateObjectWithParent(Entity* parentEnt, u32 subtype, u32 param1, u32 param2) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateObject(subtype, param1, param2);
|
||||
if (ent != NULL) {
|
||||
ent->parent = parentEnt;
|
||||
CopyPosition(parentEnt, ent);
|
||||
}
|
||||
|
||||
return ent;
|
||||
}
|
||||
@@ -12,13 +12,12 @@ void _DmaFill32(u32 value, u8* dest, u32 size) {
|
||||
DmaFill32(3, value, dest, size);
|
||||
}
|
||||
|
||||
void _DmaZero(u8 *src, u32 size)
|
||||
{
|
||||
void _DmaZero(u8* src, u32 size) {
|
||||
u32 zero = 0;
|
||||
|
||||
switch (((u32)src | size) & 3) {
|
||||
case 0:
|
||||
_DmaFill32(0,src, size);
|
||||
_DmaFill32(0, src, size);
|
||||
break;
|
||||
case 2:
|
||||
_DmaFill16(0, src, size);
|
||||
@@ -28,6 +27,23 @@ void _DmaZero(u8 *src, u32 size)
|
||||
*src = zero;
|
||||
src++;
|
||||
size--;
|
||||
} while (size != 0);
|
||||
} while (size != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _DmaCopy(const u8* src, u8* dst, u32 size) {
|
||||
switch (((u32)src | (u32)dst | size) & 3) {
|
||||
case 0:
|
||||
DmaCopy32(3, src, dst, size);
|
||||
break;
|
||||
case 2:
|
||||
DmaCopy16(3, src, dst, size);
|
||||
break;
|
||||
default:
|
||||
do {
|
||||
*dst = *src;
|
||||
src++;
|
||||
dst++;
|
||||
} while (--size);
|
||||
}
|
||||
}
|
||||
|
||||
+16
-34
@@ -13,7 +13,6 @@ extern u32 sub_080322A4(Entity*);
|
||||
void sub_080322E8(Entity*);
|
||||
extern void sub_08032338(Entity*);
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
extern void sub_0804A9FC(Entity*, u32);
|
||||
extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*));
|
||||
extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
|
||||
extern u32 GetNextFunction(Entity*);
|
||||
@@ -29,7 +28,7 @@ extern void (*const gUnk_080CE58C[])(Entity*);
|
||||
extern void (*const gUnk_080CE5C8[])(Entity*);
|
||||
extern u8 gUnk_080CE5B0[8];
|
||||
extern u8 gUnk_080CE5B8[8];
|
||||
extern union SplitHWord gUnk_080CE5C0[4];
|
||||
extern s8 gUnk_080CE5C0[8];
|
||||
extern u16 gUnk_080CE5F0[5];
|
||||
extern u8 gUnk_080CE5FA[20]; // Directions
|
||||
|
||||
@@ -209,15 +208,14 @@ void sub_08031C1C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
|
||||
void sub_08031C58(Entity* this) {
|
||||
u8 tmp;
|
||||
Entity *a, *b;
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3) {
|
||||
if (gEntCount < 0x43) {
|
||||
tmp = Random();
|
||||
u32 tmp = Random();
|
||||
tmp &= 3;
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
@@ -225,30 +223,30 @@ void sub_08031C58(Entity* this) {
|
||||
a->parent = NULL;
|
||||
a->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, a);
|
||||
a->attachedEntity = CreateEnemy(0x2e, 1);
|
||||
|
||||
b = CreateEnemy(0x2e, 1);
|
||||
a->attachedEntity = b;
|
||||
b = a->attachedEntity;
|
||||
b->entityType.parameter = 1;
|
||||
b->parent = a;
|
||||
b->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, b);
|
||||
b->attachedEntity = CreateEnemy(0x2e, 1);
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
b->attachedEntity = a;
|
||||
a = b->attachedEntity;
|
||||
a->entityType.parameter = 2;
|
||||
a->parent = b;
|
||||
a->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, a);
|
||||
a->attachedEntity = CreateEnemy(0x2e, 1);
|
||||
|
||||
b = CreateEnemy(0x2e, 1);
|
||||
a->attachedEntity = b;
|
||||
b = a->attachedEntity;
|
||||
b->entityType.parameter = 3;
|
||||
b->parent = a;
|
||||
b->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, b);
|
||||
b->attachedEntity = CreateEnemy(0x2e, 1);
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
b->attachedEntity = a;
|
||||
a = b->attachedEntity;
|
||||
a->entityType.parameter = 4;
|
||||
a->parent = b;
|
||||
a->attachedEntity = NULL;
|
||||
@@ -267,12 +265,6 @@ void sub_08031C58(Entity* this) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_08031C58(Entity* this) {
|
||||
asm(".include \"asm/non_matching/acroBandits/sub_08031C58.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_08031D70(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
@@ -308,27 +300,17 @@ void sub_08031DC4(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
u32 sub_08031E04(Entity* this) {
|
||||
Entity* ent;
|
||||
union SplitHWord* tmp;
|
||||
int x, y;
|
||||
s8* tmp;
|
||||
|
||||
ent = sub_08049DF4(1);
|
||||
if (ent == NULL)
|
||||
return 0;
|
||||
|
||||
tmp = &gUnk_080CE5C0[this->frames.all & 6];
|
||||
x = ent->x.HALF.HI + tmp->HALF.LO;
|
||||
y = ent->y.HALF.HI + tmp->HALF.HI;
|
||||
return sub_0806FCB8(this, x, y, 0x50);
|
||||
return sub_0806FCB8(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
u32 sub_08031E04(Entity* this) {
|
||||
asm(".include \"asm/non_matching/acroBandits/sub_08031E04.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_08031E48(Entity* this, Entity* child) {
|
||||
CopyPosition(this, child);
|
||||
@@ -429,9 +411,9 @@ void sub_08032008(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
if (this->direction & 0xf) {
|
||||
this->spriteSettings.b.flipX = !(!(this->direction & 0x10) ^ 1);
|
||||
}
|
||||
if (this->direction & 0xf)
|
||||
this->spriteSettings.b.flipX = (this->direction >> 4 ^ 1);
|
||||
|
||||
|
||||
sub_080AEF88(this);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,360 @@
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
extern u32 sub_08049F64(Entity*, u32, u32);
|
||||
|
||||
u32 sub_08021D00();
|
||||
void sub_08021D44(Entity* this, u32 param_2);
|
||||
|
||||
extern void (*const gUnk_080CB590[])(Entity*);
|
||||
extern void (*const gUnk_080CB5A8[])(Entity*);
|
||||
extern void (*const gUnk_080CB5C8[])(Entity*);
|
||||
extern void (*const gUnk_080CB5D4[])(Entity*);
|
||||
|
||||
extern const s8 gUnk_080CB5DC[];
|
||||
extern const s8 gUnk_080CB5E4[];
|
||||
|
||||
void Beetle(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CB590);
|
||||
}
|
||||
|
||||
void sub_08021768(Entity* this) {
|
||||
gUnk_080CB5A8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08021780(Entity* this) {
|
||||
switch (this->bitfield) {
|
||||
case 0x80:
|
||||
if (gPlayerState.field_0xa8 == 24) {
|
||||
sub_08021768(this);
|
||||
} else {
|
||||
this->action = 5;
|
||||
this->actionDelay = 0xb4;
|
||||
this->field_0xf = 0;
|
||||
this->flags &= ~0x80;
|
||||
this->spritePriority.b0 = 3;
|
||||
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
|
||||
this->height.HALF.HI = -1;
|
||||
((u8*)&this->field_0x86)[1] = 1;
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
break;
|
||||
case 0x93:
|
||||
sub_08021768(this);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->currentHealth == 0)
|
||||
this->field_0x42 = 0;
|
||||
|
||||
sub_0804AA30(this, gUnk_080CB590);
|
||||
}
|
||||
|
||||
void sub_08021818(Entity* this) {
|
||||
if (this->entityType.form == 0) {
|
||||
sub_0804A7D4(this);
|
||||
} else {
|
||||
Entity* ent = this->parent;
|
||||
if (ent) {
|
||||
ent->field_0xf--;
|
||||
this->parent = NULL;
|
||||
}
|
||||
CreateDeathFx(this, 0xf0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021848(Entity* this) {
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080CB5C8[this->previousActionFlag](this);
|
||||
} else {
|
||||
this->action = 3;
|
||||
this->height.HALF.HI = 0;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802187C(Entity* this) {
|
||||
this->previousActionFlag = 2;
|
||||
}
|
||||
|
||||
void nullsub_130(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08021888(Entity* this) {
|
||||
if (sub_0806F3E4(this))
|
||||
sub_08021818(this);
|
||||
}
|
||||
|
||||
void sub_0802189C(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->field_0x1c = 1;
|
||||
InitializeAnimation(this, 3);
|
||||
}
|
||||
|
||||
void sub_080218B4(Entity* this) {
|
||||
gUnk_080CB5D4[this->entityType.parameter](this);
|
||||
}
|
||||
|
||||
void sub_080218CC(Entity* this) {
|
||||
if (this->previousActionFlag == 0) {
|
||||
this->previousActionFlag = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f;
|
||||
this->nonPlanarMovement = 0x100;
|
||||
this->field_0x20 = 0x12000;
|
||||
}
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
sub_080AEFE0(this);
|
||||
if (sub_080044EC(this, 0x1c00) == 0)
|
||||
this->frameDuration = 1;
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 2;
|
||||
this->actionDelay = (Random() & 0x38) + 8;
|
||||
this->field_0xf = 1;
|
||||
this->flags |= 0x80;
|
||||
this->nonPlanarMovement = 0x180;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021984(Entity* this) {
|
||||
if (this->previousActionFlag == 0) {
|
||||
this->previousActionFlag = 1;
|
||||
this->flags |= 0x80;
|
||||
this->spriteSettings.b.draw = 3;
|
||||
this->height.HALF.HI = -0x80;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
sub_08004488(0x12d);
|
||||
}
|
||||
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 16;
|
||||
this->field_0xf = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->nonPlanarMovement = 0x180;
|
||||
((u8*)&this->field_0x86)[0] = 60;
|
||||
InitializeAnimation(this, 0);
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021A10(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (sub_080041A0(this, &gPlayerEntity, 120, 80) && sub_08021D00(this) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = (Random() & 0x3f) + 30;
|
||||
sub_08021D44(this, this->direction);
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021A64(Entity* this) {
|
||||
if (!sub_08021D00(this)) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = (Random() & 0x1f) + 0x1e;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
if (--this->field_0xf == 0) {
|
||||
u32 tmp;
|
||||
|
||||
this->field_0xf = 8;
|
||||
tmp = sub_08049F84(this, 1);
|
||||
if (tmp == 0xff) {
|
||||
this->action = 7;
|
||||
InitializeAnimation(this, 1);
|
||||
return;
|
||||
}
|
||||
sub_08021D44(this, tmp);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021AD8(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
if (this->actionDelay) {
|
||||
u32 tmp;
|
||||
|
||||
this->actionDelay = 0;
|
||||
tmp = sub_08049F84(this, 1);
|
||||
if (tmp == 0xff) {
|
||||
this->action = 2;
|
||||
this->actionDelay = '\b';
|
||||
InitializeAnimation(this, 0);
|
||||
return;
|
||||
}
|
||||
this->direction = (u8)tmp;
|
||||
sub_08004488(0x7c);
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
if (!sub_08003FC4(this, 0x1800))
|
||||
this->frameDuration = 1;
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 20;
|
||||
((u8*)&this->field_0x86)[0] = 60;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021B64(Entity* this) {
|
||||
if (gPlayerState.flags.all & 4) {
|
||||
this->action = 3;
|
||||
this->height.WORD = 0;
|
||||
InitializeAnimation(this, 2);
|
||||
} else {
|
||||
int iVar4 = 1;
|
||||
if (gPlayerState.field_0xa8 != 11 && gPlayerState.field_0xa8 != 20) {
|
||||
if (sub_0807953C())
|
||||
iVar4 = this->entityType.form * 3 + 8;
|
||||
|
||||
iVar4 = this->actionDelay - iVar4;
|
||||
if (iVar4 < 0)
|
||||
iVar4 = 0;
|
||||
|
||||
this->actionDelay = (u8)iVar4;
|
||||
}
|
||||
|
||||
if (gPlayerState.flags.all & 0x110)
|
||||
iVar4 = 0;
|
||||
|
||||
if (iVar4 == 0) {
|
||||
this->action = 6;
|
||||
this->field_0x20 = 0x10000;
|
||||
((u8*)&this->field_0x86)[1] = 0;
|
||||
if (gPlayerEntity.direction != 0xff) {
|
||||
this->direction = 0x10 ^ gPlayerEntity.direction;
|
||||
} else {
|
||||
this->direction = (gPlayerEntity.animationState << 2) ^ 0x10;
|
||||
}
|
||||
InitializeAnimation(this, 5);
|
||||
} else {
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
gPlayerState.field_0x80 -= 0x50;
|
||||
gPlayerState.field_0xaa++;
|
||||
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
|
||||
this->x.HALF.HI += gUnk_080CB5E4[(this->field_0xf++ & 0xe) >> 1];
|
||||
this->height.HALF.HI--;
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021C58(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0)
|
||||
this->frameDuration = 1;
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 60;
|
||||
this->field_0xf = 1;
|
||||
this->flags |= 0x80;
|
||||
this->spritePriority.b0 = 4;
|
||||
((u8*)&this->field_0x86)[0] = 60;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021CD0(Entity* this) {
|
||||
if ((this->frames.all & 0x80) == 0)
|
||||
GetNextFrame(this);
|
||||
|
||||
if (sub_08049F84(this, 1) == 0xff)
|
||||
return;
|
||||
|
||||
this->action = 3;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
|
||||
u32 sub_08021D00(Entity* this) {
|
||||
u32 ret;
|
||||
|
||||
if (((u8*)&this->field_0x86)[0]) {
|
||||
((u8*)&this->field_0x86)[0]--;
|
||||
ret = 0;
|
||||
} else if (sub_08049F64(this, 1, 0x10) == 0) {
|
||||
ret = 0;
|
||||
} else {
|
||||
this->action = 4;
|
||||
this->actionDelay = 1;
|
||||
this->field_0x20 = 0x18000;
|
||||
InitializeAnimation(this, 4);
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sub_08021D44(Entity* this, u32 param_2) {
|
||||
param_2 += 4;
|
||||
param_2 &= 0x18;
|
||||
this->direction = param_2;
|
||||
if (param_2 & 8) {
|
||||
this->nonPlanarMovement = 0x180;
|
||||
} else {
|
||||
this->nonPlanarMovement = 0xc0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CB590[])(Entity*) = {
|
||||
sub_08021768,
|
||||
sub_08021780,
|
||||
sub_08001324,
|
||||
sub_08021818,
|
||||
sub_08001242,
|
||||
sub_08021848,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CB5A8[])(Entity*) = {
|
||||
sub_0802189C,
|
||||
sub_080218B4,
|
||||
sub_08021A10,
|
||||
sub_08021A64,
|
||||
sub_08021AD8,
|
||||
sub_08021B64,
|
||||
sub_08021C58,
|
||||
sub_08021CD0,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CB5C8[])(Entity*) = {
|
||||
sub_0802187C,
|
||||
nullsub_130,
|
||||
sub_08021888,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CB5D4[])(Entity*) = {
|
||||
sub_080218CC,
|
||||
sub_08021984,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CB5DC[] = {
|
||||
-1, -2, 1, 2, -3, 3, -4, 4,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CB5E4[] = {
|
||||
-1, -2, -1, 0, 1, 2, 1, 0,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -0,0 +1,764 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern void sub_08001318(Entity*);
|
||||
extern void sub_080043A8(Entity*);
|
||||
extern u32 sub_08049F1C(Entity*, Entity*, u32);
|
||||
extern u32 sub_08049F64(Entity*, u32, u32);
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
extern void sub_080AF160(Entity*);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
|
||||
void sub_0801F328(Entity*);
|
||||
void sub_0801F340(Entity*);
|
||||
void sub_0801F360(Entity*);
|
||||
void sub_0801F3AC(Entity*);
|
||||
void sub_0801F730(Entity*);
|
||||
void sub_0801F748(Entity*);
|
||||
void sub_0801F764(Entity*);
|
||||
void sub_0801FAE0(Entity*);
|
||||
void sub_0801FAF8(Entity*);
|
||||
void sub_0801FB14(Entity*);
|
||||
void sub_0801FB34(Entity*);
|
||||
void sub_0801FB68(Entity*);
|
||||
u32 sub_0801FBD0(Entity*);
|
||||
void sub_0801FBE4(Entity*);
|
||||
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CA21C[])(Entity*);
|
||||
extern void (*const gUnk_080CA234[])(Entity*);
|
||||
extern void (*const gUnk_080CA25C[])(Entity*);
|
||||
extern void (*const gUnk_080CA288[])(Entity*);
|
||||
|
||||
extern const s8 gUnk_080CA2B4[];
|
||||
|
||||
void Chuchu(Entity* this) {
|
||||
int index;
|
||||
|
||||
index = sub_080012DC(this);
|
||||
switch (index) {
|
||||
default:
|
||||
gUnk_080012C8[index](this);
|
||||
return;
|
||||
case 0:
|
||||
/* ... */
|
||||
break;
|
||||
case 2:
|
||||
this->field_0x3a &= 0xfe;
|
||||
if (index != this->field_0x80.HALF.HI) {
|
||||
switch (this->entityType.form) {
|
||||
case 0:
|
||||
if (this->flags & 0x80) {
|
||||
this->action = 6;
|
||||
this->flags &= ~0x80;
|
||||
this->nonPlanarMovement = 0x20;
|
||||
this->damageType = 0x5c;
|
||||
InitializeAnimation(this, 5);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* ... */
|
||||
break;
|
||||
case 2:
|
||||
sub_080043A8(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
this->field_0x80.HALF.HI = index;
|
||||
gUnk_080CA21C[GetNextFunction(this)](this);
|
||||
if (*(char*)(*(int*)&this->field_0x68 + 10) == 0x1c) {
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
} else if (this->entityType.form == 2) {
|
||||
sub_0801FB34(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EEE4(Entity* this) {
|
||||
switch (this->entityType.form) {
|
||||
case 0:
|
||||
sub_0801F3AC(this);
|
||||
gUnk_080CA234[this->action](this);
|
||||
break;
|
||||
case 1:
|
||||
sub_0801F764(this);
|
||||
gUnk_080CA25C[this->action](this);
|
||||
break;
|
||||
case 2:
|
||||
gUnk_080CA288[this->action](this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EF40(Entity* this) {
|
||||
u8 health;
|
||||
|
||||
if (this->entityType.form == 2) {
|
||||
if (this->bitfield == 0x8e || this->bitfield == 0x95) {
|
||||
this->flags &= ~0x80;
|
||||
this->currentHealth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
health = this->currentHealth;
|
||||
if (health) {
|
||||
if (this->bitfield == 0x94) {
|
||||
sub_0801FB68(this);
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
InitializeAnimation(this, 6);
|
||||
} else if (this->field_0x80.HALF.LO != health) {
|
||||
sub_0801FB68(this);
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
} else {
|
||||
sub_0804AA1C(this);
|
||||
this->field_0x20 = 0;
|
||||
InitializeAnimation(this, 9);
|
||||
}
|
||||
this->field_0x80.HALF.LO = this->currentHealth;
|
||||
sub_0804AA30(this, gUnk_080CA21C);
|
||||
}
|
||||
|
||||
void sub_0801EFD8(Entity* this) {
|
||||
if (sub_0806F520(this) == 0 && this->field_0x43) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
InitializeAnimation(this, 6);
|
||||
} else {
|
||||
if (this->animIndex != 8) {
|
||||
sub_0801FB68(this);
|
||||
InitializeAnimation(this, 8);
|
||||
}
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F02C(Entity* this) {
|
||||
if (this->animIndex == 6)
|
||||
GetNextFrame(this);
|
||||
sub_08001318(this);
|
||||
}
|
||||
|
||||
void sub_0801F048(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->entityType.form == 0) {
|
||||
sub_0804A7D4(this);
|
||||
} else if (this->entityType.form == 1) {
|
||||
CreateDeathFx(this, 0xf2, 0);
|
||||
} else {
|
||||
CreateDeathFx(this, 0xf1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F084(Entity* this) {
|
||||
if ((this->frames.all & 0x80) == 0)
|
||||
GetNextFrame(this);
|
||||
sub_08001242(this);
|
||||
}
|
||||
|
||||
void sub_0801F0A4(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->field_0x80.HALF.LO = this->currentHealth;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
}
|
||||
|
||||
void nullsub_4(Entity* this) {
|
||||
(void)this;
|
||||
}
|
||||
|
||||
void sub_0801F0C8(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 3;
|
||||
this->actionDelay = (Random() & 3) + 0xc;
|
||||
this->field_0xf = Random();
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->flags |= 0x80;
|
||||
this->spritePriority.b0 = 4;
|
||||
this->spritePriority.b1 = 3;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F12C(Entity* this) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
sub_0801F328(this);
|
||||
} else {
|
||||
if ((this->field_0xf++ & 7) == 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
if (sub_08049F64(this, 1, 0x38)) {
|
||||
this->action = 4;
|
||||
sub_0801FBE4(this);
|
||||
} else if (sub_08049F64(this, 1, 0x48)) {
|
||||
this->actionDelay = (Random() & 3) + 0xc;
|
||||
} else {
|
||||
sub_0801F328(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F1B0(Entity* this) {
|
||||
if (this->frames.all & 0x10) {
|
||||
if (this->frames.all & 1) {
|
||||
this->frames.all ^= 1;
|
||||
this->damageType = 90;
|
||||
sub_08004488(299);
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x4000) == 0)
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
sub_0801F328(this);
|
||||
} else {
|
||||
sub_0801F340(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F228(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_0801F250(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80)
|
||||
sub_0801F360(this);
|
||||
}
|
||||
|
||||
void sub_0801F270(Entity* this) {
|
||||
if ((this->field_0xf++ & 7) == 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
}
|
||||
|
||||
sub_080AF160(this);
|
||||
GetNextFrame(this);
|
||||
if (sub_0801FBD0(this))
|
||||
return;
|
||||
|
||||
if (--this->actionDelay)
|
||||
return;
|
||||
|
||||
if (this->field_0x80.HALF.HI == 0) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 4);
|
||||
} else {
|
||||
this->actionDelay = 8;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F2CC(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F2F8(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
sub_0801F340(this);
|
||||
sub_0804AA1C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F328(Entity* this) {
|
||||
this->action = 6;
|
||||
this->flags &= ~0x80;
|
||||
InitializeAnimation(this, 5);
|
||||
}
|
||||
|
||||
void sub_0801F340(Entity* this) {
|
||||
this->action = 5;
|
||||
this->actionDelay = 60;
|
||||
this->nonPlanarMovement = 0x20;
|
||||
this->damageType = 92;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
|
||||
void sub_0801F360(Entity* this) {
|
||||
this->action = 7;
|
||||
this->actionDelay = (Random() & 0x38) + 0xb4;
|
||||
this->field_0xf = Random();
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->spritePriority.b1 = 2;
|
||||
this->spritePriority.b0 = 6;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
|
||||
void sub_0801F3AC(Entity* this) {
|
||||
if (this->action == 9 || this->action == 0)
|
||||
return;
|
||||
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if (this->field_0x82.HALF.LO || sub_08049F64(this, 1, 0x48)) {
|
||||
if (this->action == 1) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->field_0x82.HALF.LO = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
} else if (this->action == 3) {
|
||||
sub_0801F328(this);
|
||||
}
|
||||
} else if (this->action == 3) {
|
||||
sub_0801F328(this);
|
||||
} else if (this->action == 7) {
|
||||
this->action = 8;
|
||||
InitializeAnimation(this, 7);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F428(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->actionDelay = Random();
|
||||
this->field_0x80.HALF.LO = this->currentHealth;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
if (this->entityType.parameter == 0)
|
||||
return;
|
||||
|
||||
this->action = 3;
|
||||
this->field_0xf = 30;
|
||||
this->flags |= 0x80;
|
||||
this->spritePriority.b1 = 3;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
|
||||
void sub_0801F48C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_0801F494(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 3;
|
||||
this->field_0xf = 30;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->flags |= 0x80;
|
||||
this->spritePriority.b0 = 4;
|
||||
this->spritePriority.b1 = 3;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F4EC(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (--this->field_0xf == 0)
|
||||
this->action = 4;
|
||||
}
|
||||
|
||||
void sub_0801F508(Entity* this) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
sub_0801F730(this);
|
||||
} else {
|
||||
u8 tmp = ++this->actionDelay & 7;
|
||||
if (tmp == 0 && sub_08049F64(this, 1, 0x38)) {
|
||||
if (Random() & 1) {
|
||||
this->action = 5;
|
||||
sub_0801FBE4(this);
|
||||
} else {
|
||||
this->field_0x82.HALF.HI = 120;
|
||||
sub_0801F730(this);
|
||||
}
|
||||
} else {
|
||||
if (tmp == 4) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F584(Entity* this) {
|
||||
if (this->frames.all & 0x10) {
|
||||
if (this->frames.all & 0x1) {
|
||||
this->frames.all ^= 1;
|
||||
this->damageType = 91;
|
||||
sub_08004488(299);
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x4000) == 0)
|
||||
GetNextFrame(this);
|
||||
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
sub_0801F730(this);
|
||||
} else {
|
||||
this->action = 6;
|
||||
this->field_0xf = 60;
|
||||
this->nonPlanarMovement = 0x20;
|
||||
this->damageType = 92;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F61C(Entity* this) {
|
||||
if (--this->field_0xf == 0)
|
||||
this->action = 4;
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_0801F638(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 8;
|
||||
this->field_0xf = 30;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->spritePriority.b1 = 2;
|
||||
this->spritePriority.b0 = 6;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F688(Entity* this) {
|
||||
if (this->field_0x82.HALF.HI)
|
||||
this->field_0x82.HALF.HI--;
|
||||
|
||||
if (sub_0801FBD0(this) || this->field_0x82.HALF.HI) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
sub_080AF160(this);
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
sub_0801F748(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F6CC(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F6F8(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 4;
|
||||
this->nonPlanarMovement = 0x20;
|
||||
sub_0804AA1C(this);
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F730(Entity* this) {
|
||||
this->action = 7;
|
||||
this->flags &= ~0x80;
|
||||
InitializeAnimation(this, 5);
|
||||
}
|
||||
|
||||
void sub_0801F748(Entity* this) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
|
||||
void sub_0801F764(Entity* this) {
|
||||
if (this->action == 10 || this->action == 0)
|
||||
return;
|
||||
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if (this->action == 1) {
|
||||
if (this->field_0x82.HALF.LO || sub_08049F64(this, 1, 0x48)) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->field_0x82.HALF.LO = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
} else if (this->action == 4) {
|
||||
sub_0801F730(this);
|
||||
} else if (this->action == 8) {
|
||||
this->action = 9;
|
||||
InitializeAnimation(this, 7);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F7D8(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->actionDelay = Random();
|
||||
this->field_0x80.HALF.LO = this->currentHealth;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
}
|
||||
|
||||
void sub_0801F7FC(Entity* this) {
|
||||
if (sub_08049FDC(this, 1) == 0)
|
||||
return;
|
||||
|
||||
if (this->field_0x82.HALF.LO || sub_08049F64(this, 1, 0x48)) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->field_0x82.HALF.LO = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F840(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
sub_0801FB14(this);
|
||||
this->flags |= 0x80;
|
||||
this->spritePriority.b0 = 4;
|
||||
this->spritePriority.b1 = 3;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F884(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->field_0xf) {
|
||||
this->field_0xf--;
|
||||
} else {
|
||||
Entity* ent = sub_0804A9FC(this, 0x1b);
|
||||
if (ent) {
|
||||
ent->entityType.parameter = 64;
|
||||
this->action = 4;
|
||||
this->damageType = 165;
|
||||
sub_08004488(0x193);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F8C0(Entity* this) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
sub_0801FAE0(this);
|
||||
} else if (sub_08049FDC(this, 1) == 0) {
|
||||
sub_0801F730(this);
|
||||
} else {
|
||||
u8 tmp = ++this->actionDelay & 7;
|
||||
if (tmp == 0 && sub_08049F1C(this, gUnk_020000B0, 0x38)) {
|
||||
this->action = 5;
|
||||
sub_0801FBE4(this);
|
||||
} else {
|
||||
if (tmp == 4) {
|
||||
this->direction = GetFacingDirection(this, gUnk_020000B0);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F940(Entity* this) {
|
||||
if (this->frames.all & 0x10) {
|
||||
if (this->frames.all & 1) {
|
||||
this->frames.all ^= 1;
|
||||
sub_08004488(299);
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x4000) == 0)
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
sub_0801FAE0(this);
|
||||
} else {
|
||||
this->action = 6;
|
||||
this->field_0xf = 60;
|
||||
this->nonPlanarMovement = 0x20;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801F9C4(Entity* this) {
|
||||
if (--this->field_0xf == 0)
|
||||
this->action = 4;
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_0801F9E0(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 8;
|
||||
this->field_0xf = 30;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->spritePriority.b1 = 2;
|
||||
this->spritePriority.b0 = 6;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FA30(Entity* this) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
sub_080AF160(this);
|
||||
GetNextFrame(this);
|
||||
} else if (sub_08049FDC(this, 1) == 0) {
|
||||
this->action = 9;
|
||||
InitializeAnimation(this, 7);
|
||||
} else {
|
||||
sub_0801FAF8(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FA78(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
InitializeAnimation(this, 4);
|
||||
sub_0804AA1C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FAAC(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
sub_0801FB14(this);
|
||||
this->nonPlanarMovement = 0x20;
|
||||
sub_0804AA1C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FAE0(Entity* this) {
|
||||
this->action = 7;
|
||||
this->flags &= ~0x80;
|
||||
InitializeAnimation(this, 5);
|
||||
}
|
||||
|
||||
void sub_0801FAF8(Entity* this) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
|
||||
void sub_0801FB14(Entity* this) {
|
||||
this->action = 3;
|
||||
this->field_0xf = 30;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
|
||||
void sub_0801FB34(Entity* this) {
|
||||
if (*(Entity**)&this->field_0x68) {
|
||||
sub_0806FA90(this, *(Entity**)&this->field_0x68, gUnk_080CA2B4[this->frames.all & 0xf], 1);
|
||||
(*(Entity**)&this->field_0x68)->spriteOffsetY--;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FB68(Entity* this) {
|
||||
switch (this->entityType.form) {
|
||||
case 0:
|
||||
this->action = 9;
|
||||
break;
|
||||
case 1:
|
||||
this->action = 10;
|
||||
this->flags |= 0x80;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spritePriority.b1 = 3;
|
||||
break;
|
||||
case 2:
|
||||
this->action = 10;
|
||||
this->damageType = 92;
|
||||
sub_0804AA1C(this);
|
||||
break;
|
||||
}
|
||||
|
||||
this->field_0x20 = 0;
|
||||
}
|
||||
|
||||
u32 sub_0801FBD0(Entity* this) {
|
||||
if (sub_080002B8(this) == 0x10) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FBE4(Entity* this) {
|
||||
this->nonPlanarMovement = 0x180;
|
||||
this->field_0x20 = 0x20000;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
InitializeAnimation(this, 3);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CA21C[])(Entity*) = {
|
||||
sub_0801EEE4,
|
||||
sub_0801EF40,
|
||||
sub_0801F02C,
|
||||
sub_0801F048,
|
||||
sub_0801F084,
|
||||
sub_0801EFD8,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA234[])(Entity*) = {
|
||||
sub_0801F0A4,
|
||||
nullsub_4,
|
||||
sub_0801F0C8,
|
||||
sub_0801F12C,
|
||||
sub_0801F1B0,
|
||||
sub_0801F228,
|
||||
sub_0801F250,
|
||||
sub_0801F270,
|
||||
sub_0801F2CC,
|
||||
sub_0801F2F8,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA25C[])(Entity*) = {
|
||||
sub_0801F428,
|
||||
sub_0801F48C,
|
||||
sub_0801F494,
|
||||
sub_0801F4EC,
|
||||
sub_0801F508,
|
||||
sub_0801F584,
|
||||
sub_0801F61C,
|
||||
sub_0801F638,
|
||||
sub_0801F688,
|
||||
sub_0801F6CC,
|
||||
sub_0801F6F8,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA288[])(Entity*) = {
|
||||
sub_0801F7D8,
|
||||
sub_0801F7FC,
|
||||
sub_0801F840,
|
||||
sub_0801F884,
|
||||
sub_0801F8C0,
|
||||
sub_0801F940,
|
||||
sub_0801F9C4,
|
||||
sub_0801F9E0,
|
||||
sub_0801FA30,
|
||||
sub_0801FA78,
|
||||
sub_0801FAAC,
|
||||
};
|
||||
// clang-format on
|
||||
@@ -0,0 +1,167 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
|
||||
void sub_08022A88(Entity*);
|
||||
void sub_08022AA4(Entity*);
|
||||
void sub_08022B0C(Entity*);
|
||||
u32 sub_08022B20(Entity*);
|
||||
void sub_08022B44(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CBB64[])(Entity*);
|
||||
extern void (*const gUnk_080CBB7C[])(Entity*);
|
||||
|
||||
void CuccoChickAggr(Entity* this) {
|
||||
gUnk_080CBB64[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void sub_08022934(Entity* this) {
|
||||
gUnk_080CBB7C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0802294C(Entity* this) {
|
||||
sub_0804AA30(this, gUnk_080CBB64);
|
||||
}
|
||||
|
||||
void nullsub_132(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08022960(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
sub_08022A88(this);
|
||||
}
|
||||
|
||||
void sub_08022970(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08022AA4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022988(Entity* this) {
|
||||
if (this->height.HALF.HI == 0 && sub_08022B20(this)) {
|
||||
sub_08022B0C(this);
|
||||
} else {
|
||||
if (this->field_0xf) {
|
||||
if (--this->field_0xf)
|
||||
return;
|
||||
|
||||
this->frameIndex = 1;
|
||||
this->field_0x20 = 0x10000;
|
||||
sub_08004488(0xd6);
|
||||
}
|
||||
|
||||
sub_080AEF88(this);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08022A88(this);
|
||||
} else {
|
||||
this->field_0xf = 4;
|
||||
this->frameIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080229F8(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x2800) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 4;
|
||||
this->actionDelay = 6;
|
||||
this->field_0xf = 8;
|
||||
this->frameIndex = 0;
|
||||
this->nonPlanarMovement = 0xc0;
|
||||
sub_08022B44(this);
|
||||
} else {
|
||||
this->field_0x20 = 0x10000;
|
||||
sub_08004488(0xd6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022A40(Entity* this) {
|
||||
if (this->field_0xf) {
|
||||
if (--this->field_0xf)
|
||||
return;
|
||||
|
||||
this->frameIndex = 1;
|
||||
}
|
||||
|
||||
sub_080AEF88(this);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08022A88(this);
|
||||
} else {
|
||||
sub_08022B44(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022A88(Entity* this) {
|
||||
this->action = 1;
|
||||
this->actionDelay = (Random() & 0xf) + 8;
|
||||
this->frameIndex = 0;
|
||||
}
|
||||
|
||||
void sub_08022AA4(Entity* this) {
|
||||
u32 rand = Random();
|
||||
|
||||
this->action = 2;
|
||||
this->actionDelay = (rand & 3) + 1;
|
||||
this->field_0xf = 1;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
|
||||
if (!sub_08049FA0(this) && (rand >> 8) & 3) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
} else {
|
||||
this->direction = (rand >> 0x10) & 0x1f;
|
||||
}
|
||||
|
||||
if (this->direction & 0xf)
|
||||
this->spriteSettings.b.flipX = (this->direction >> 4) ^ 1;
|
||||
}
|
||||
|
||||
void sub_08022B0C(Entity* this) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 3;
|
||||
this->field_0xf = 8;
|
||||
sub_08022B44(this);
|
||||
}
|
||||
|
||||
u32 sub_08022B20(Entity* this) {
|
||||
if (!sub_08049DF4(2))
|
||||
return 0;
|
||||
|
||||
return sub_080041A0(this, &gPlayerEntity, 0x24, 0x24);
|
||||
}
|
||||
|
||||
void sub_08022B44(Entity *this){
|
||||
this->field_0x20 = 0xc000;
|
||||
this->direction = GetFacingDirection(this,&gPlayerEntity);
|
||||
|
||||
if (this->direction & 0xf)
|
||||
this->spriteSettings.b.flipX = (this->direction >> 4)^1;
|
||||
|
||||
sub_08004488(0xd6);
|
||||
}
|
||||
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CBB64[])(Entity*) = {
|
||||
sub_08022934,
|
||||
sub_0802294C,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
nullsub_132,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CBB7C[])(Entity*) = {
|
||||
sub_08022960,
|
||||
sub_08022970,
|
||||
sub_08022988,
|
||||
sub_080229F8,
|
||||
sub_08022A40,
|
||||
};
|
||||
// clang-format on
|
||||
@@ -0,0 +1,754 @@
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
u8 field_0x0;
|
||||
u8 field_0x1;
|
||||
} PACKED stuct_080CAB14;
|
||||
|
||||
void sub_08021218();
|
||||
void sub_08021588();
|
||||
void sub_080213D0();
|
||||
void sub_08021390();
|
||||
void sub_0802159C();
|
||||
void sub_0804AA1C();
|
||||
void sub_080213F0();
|
||||
u32 sub_080214FC();
|
||||
void sub_08021540();
|
||||
void sub_08021600();
|
||||
void sub_080213B0();
|
||||
u32 sub_08049F64();
|
||||
u32 sub_0802169C();
|
||||
void sub_0802124C();
|
||||
void sub_08021644();
|
||||
void sub_08021414();
|
||||
void sub_08021400();
|
||||
u32 sub_08021274(u32, u32);
|
||||
u32 sub_08021664(Entity*, Entity*);
|
||||
u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
void sub_08021424(Entity*);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
|
||||
extern void (*const gUnk_080CAA98[])(Entity*);
|
||||
extern void (*const gUnk_080CAAB0[])(Entity*);
|
||||
|
||||
extern const s8 gUnk_080CAB00[];
|
||||
extern const s8 gUnk_080CAB04[];
|
||||
extern const u8 gUnk_080CAB08[];
|
||||
extern const s8 gUnk_080CAB0C[];
|
||||
extern const s8 gUnk_080CAB10[];
|
||||
extern const stuct_080CAB14 gUnk_080CAB14[];
|
||||
extern const u8 gUnk_080CAB3A[];
|
||||
extern const u8 gUnk_080CAB42[];
|
||||
extern const u8 gUnk_080CAB4A[];
|
||||
extern const u8 gUnk_080CAB52[];
|
||||
extern const u8 gUnk_080CAB68[];
|
||||
|
||||
extern void (*const gUnk_080CAB58[])(Entity*);
|
||||
|
||||
void DarkNut(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CAA98);
|
||||
SetChildOffset(this, 0, 1, -22);
|
||||
}
|
||||
|
||||
void sub_08020BA0(Entity* this) {
|
||||
gUnk_080CAAB0[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08020BB8(Entity* this) {
|
||||
switch (this->bitfield & 0x7f) {
|
||||
case 0x1c:
|
||||
this->action = 11;
|
||||
this->actionDelay = gUnk_080CAB0C[this->entityType.form];
|
||||
this->damageType = 81;
|
||||
sub_08021218(this, 8, (((this->field_0x3e ^ 0x10) + 4) & 0x18) >> 3);
|
||||
sub_08021588(this);
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
break;
|
||||
case 0x16:
|
||||
this->action = 11;
|
||||
this->actionDelay = gUnk_080CAB10[this->entityType.form];
|
||||
this->damageType = 81;
|
||||
sub_08021218(this, 8, (((this->field_0x3e ^ 0x10) + 4) & 0x18) >> 3);
|
||||
sub_08021588(this);
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
break;
|
||||
case 0x4b:
|
||||
if (this->action == 13 || this->action == 15 || this->action == 19 || this->action == 18)
|
||||
break;
|
||||
switch (this->field_0x78.HALF.HI) {
|
||||
case 8 ... 12:
|
||||
this->field_0x7a.HALF.LO = gUnk_080CAB04[this->entityType.form];
|
||||
break;
|
||||
case 4 ... 6:
|
||||
this->field_0x7a.HALF.LO = gUnk_080CAB00[this->entityType.form];
|
||||
break;
|
||||
default:
|
||||
this->field_0x7a.HALF.LO = 0;
|
||||
break;
|
||||
}
|
||||
this->action = 10;
|
||||
sub_08021218(this, 0xb, this->animationState);
|
||||
sub_08004488(0x15d);
|
||||
sub_08021588(this);
|
||||
break;
|
||||
case 0x4c:
|
||||
if (this->action == 15) {
|
||||
u8 bVar3 = 0xff;
|
||||
if (this->attachedEntity != NULL) {
|
||||
bVar3 = this->attachedEntity->bitfield & 0x7f;
|
||||
}
|
||||
if (bVar3 == 2) {
|
||||
sub_080213D0(this, gUnk_080CAB08[this->entityType.form]);
|
||||
} else {
|
||||
sub_080213D0(this, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (this->currentHealth != this->field_0x78.HALF.LO) {
|
||||
sub_08021588(this);
|
||||
sub_08021390(this);
|
||||
sub_0804AA1C(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
this->field_0x78.HALF.LO = this->currentHealth;
|
||||
sub_0804AA30(this, gUnk_080CAA98);
|
||||
}
|
||||
|
||||
void nullsub_129(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08020D70(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x78.HALF.LO = this->currentHealth;
|
||||
this->animationState = -1;
|
||||
sub_08021218(this, 0, 2);
|
||||
}
|
||||
|
||||
void sub_08020D9C(Entity* this) {
|
||||
if (sub_08049FDC(this, 1))
|
||||
sub_080213F0(this);
|
||||
}
|
||||
|
||||
void sub_08020DB4(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80)
|
||||
sub_08021390(this);
|
||||
}
|
||||
|
||||
void sub_08020DD4(Entity* this) {
|
||||
if (sub_080214FC(this)) {
|
||||
sub_080213F0(this);
|
||||
} else if (--this->field_0x76.HWORD == 0) {
|
||||
this->action = 5;
|
||||
sub_08021218(this, 5, this->animationState);
|
||||
} else {
|
||||
if (--this->actionDelay == 0)
|
||||
sub_08021540(this);
|
||||
sub_080AEF88(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020E28(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80)
|
||||
sub_080213B0(this);
|
||||
}
|
||||
|
||||
void sub_08020E48(Entity* this) {
|
||||
if (sub_080214FC(this)) {
|
||||
sub_080213F0(this);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80)
|
||||
sub_080213B0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020E78(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80)
|
||||
sub_08021390(this);
|
||||
}
|
||||
|
||||
void sub_08020E98(Entity* this) {
|
||||
if (sub_08049F64(this, 1, 0x38)) {
|
||||
if (sub_0802169C(this, gUnk_020000B0)) {
|
||||
this->action = 8;
|
||||
sub_08021218(this, 7, this->animationState);
|
||||
} else {
|
||||
this->direction = GetFacingDirection(gUnk_020000B0, this);
|
||||
if (sub_080AEF88(this) == 0) {
|
||||
this->action = 8;
|
||||
sub_08021218(this, 7, this->animationState);
|
||||
} else {
|
||||
this->direction ^= 0x10;
|
||||
sub_0802124C(this);
|
||||
sub_08021644(this);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (gUnk_020000B0 == NULL) {
|
||||
sub_08021414(this);
|
||||
} else {
|
||||
this->direction = GetFacingDirection(this, gUnk_020000B0);
|
||||
sub_080AEF88(this);
|
||||
sub_0802124C(this);
|
||||
sub_08021644(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020F28(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80)
|
||||
sub_08021400(this);
|
||||
}
|
||||
|
||||
void sub_08020F48(Entity* this) {
|
||||
if (sub_08049F64(this, 1, 0x48)) {
|
||||
if (sub_08021664(this, gUnk_020000B0)) {
|
||||
u32 uVar2 = sub_0804A044(this, gUnk_020000B0, 9);
|
||||
if (uVar2 == 0xff) {
|
||||
sub_08021424(this);
|
||||
} else {
|
||||
Entity* pEVar3;
|
||||
|
||||
this->action = 14;
|
||||
sub_08021218(this, 13, uVar2 >> 3);
|
||||
pEVar3 = sub_0804A98C(this, 0, 1);
|
||||
if (pEVar3) {
|
||||
pEVar3->parent = this;
|
||||
this->attachedEntity = pEVar3;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sub_08021424(this);
|
||||
}
|
||||
} else {
|
||||
sub_08021390(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020FAC(Entity* this) {
|
||||
if (this->frames.all & 0x80) {
|
||||
if (this->field_0x7a.HALF.LO) {
|
||||
this->field_0x7a.HALF.LO--;
|
||||
} else {
|
||||
this->hurtBlinkTime = -8;
|
||||
sub_08021390(this);
|
||||
}
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020FE4(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 12;
|
||||
sub_08021218(this, 9, this->animationState);
|
||||
sub_0804AA1C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021010(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->damageType = 0x56;
|
||||
sub_080213F0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021038(Entity* this) {
|
||||
if (this->attachedEntity == NULL && this->frames.all) {
|
||||
Entity* pEVar2 = (Entity*)sub_0804A98C(this, 0, 0);
|
||||
if (pEVar2) {
|
||||
pEVar2->parent = this;
|
||||
this->attachedEntity = pEVar2;
|
||||
}
|
||||
sub_08004488(270);
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80) {
|
||||
sub_08021588(this);
|
||||
if (this->field_0x7c.BYTES.byte0) {
|
||||
this->field_0x7c.BYTES.byte0--;
|
||||
} else {
|
||||
sub_08021390(this);
|
||||
}
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all == 4)
|
||||
this->damageType = 81;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080210A8(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
this->frames.all = 0;
|
||||
sub_08021588(this);
|
||||
sub_08004488(349);
|
||||
} else if (this->frames.all & 0x80) {
|
||||
sub_08021390(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080210E4(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
Entity* ent;
|
||||
|
||||
this->frames.all &= ~1;
|
||||
ent = sub_0804A98C(this, 0, 2);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
this->attachedEntity = ent;
|
||||
}
|
||||
|
||||
sub_08004488(270);
|
||||
}
|
||||
|
||||
sub_08021644(this);
|
||||
if ((this->frames.all & 0x10) &&
|
||||
(!sub_080AEF88(this) || (this->attachedEntity && (this->attachedEntity->bitfield & 0x80)))) {
|
||||
sub_080213D0(this, 0);
|
||||
} else {
|
||||
if (--this->field_0x76.HWORD == 0)
|
||||
sub_080213D0(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021170(Entity* this) {
|
||||
if (this->frames.all & 0x80) {
|
||||
if (this->field_0x7a.HALF.HI) {
|
||||
this->field_0x7a.HALF.HI--;
|
||||
} else {
|
||||
sub_08021390(this);
|
||||
}
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080211A0(Entity* this) {
|
||||
if (sub_080214FC(this)) {
|
||||
sub_08021390(this);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80)
|
||||
sub_080213B0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080211D0(Entity* this)
|
||||
|
||||
{
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_0802159C(this);
|
||||
|
||||
if (this->frames.all & 0x80)
|
||||
sub_08021390(this);
|
||||
}
|
||||
|
||||
void sub_080211F4(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_08021600(this);
|
||||
|
||||
if (this->frames.all & 0x80)
|
||||
sub_08021390(this);
|
||||
}
|
||||
|
||||
void sub_08021218(Entity* this, u32 param_2, u32 param_3) {
|
||||
const stuct_080CAB14* unk;
|
||||
|
||||
if (this->field_0x74.HALF.LO == param_2 && this->animationState == param_3)
|
||||
return;
|
||||
|
||||
this->animationState = param_3;
|
||||
this->field_0x74.HALF.LO = param_2;
|
||||
|
||||
unk = &gUnk_080CAB14[param_2];
|
||||
this->spriteIndex = unk->field_0x1;
|
||||
InitAnimationForceUpdate(this, unk->field_0x0 + param_3);
|
||||
}
|
||||
|
||||
void sub_0802124C(Entity* this) {
|
||||
u32 iVar1 = sub_08021274(this->animationState, this->direction);
|
||||
if (iVar1 != 0xff) {
|
||||
sub_08021218(this, this->field_0x74.HALF.LO, iVar1);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
NAKED
|
||||
u32 sub_08021274(u32 a, u32 b) {
|
||||
asm(".include \"asm/non_matching/darkNut/sub_08021274.inc\"");
|
||||
}
|
||||
|
||||
void sub_080212B0(Entity* this) {
|
||||
u8 tmp;
|
||||
|
||||
switch (this->field_0x74.HALF.HI) {
|
||||
default:
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
tmp = gUnk_080CAB3A[Random() & 7];
|
||||
break;
|
||||
case 1:
|
||||
this->field_0x74.HALF.HI = 2;
|
||||
tmp = gUnk_080CAB42[Random() & 7];
|
||||
break;
|
||||
case 2:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
tmp = gUnk_080CAB4A[Random() & 7];
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->entityType.form < 2 && tmp == 2)
|
||||
tmp = gUnk_080CAB52[Random() & 3];
|
||||
|
||||
this->attachedEntity = NULL;
|
||||
gUnk_080CAB58[tmp](this);
|
||||
}
|
||||
|
||||
void sub_08021328(Entity* this) {
|
||||
this->action = 13;
|
||||
this->field_0x7c.BYTES.byte0 = gUnk_080CAB68[this->entityType.form];
|
||||
sub_08021218(this, 0xc, this->animationState);
|
||||
}
|
||||
|
||||
void sub_0802134C(Entity* this) {
|
||||
this->action = 15;
|
||||
this->direction = this->animationState << 3;
|
||||
this->nonPlanarMovement = 0x200;
|
||||
this->field_0x76.HWORD = 0x78;
|
||||
sub_08021218(this, 0xe, this->animationState);
|
||||
}
|
||||
|
||||
void sub_08021370(Entity* this) {
|
||||
this->action = 18;
|
||||
sub_08021218(this, 0x10, this->animationState);
|
||||
}
|
||||
|
||||
void sub_08021380(Entity* this) {
|
||||
this->action = 19;
|
||||
sub_08021218(this, 0x11, this->animationState);
|
||||
}
|
||||
|
||||
void sub_08021390(Entity* this) {
|
||||
this->action = 7;
|
||||
this->nonPlanarMovement = 0x200;
|
||||
this->damageType = 0x56;
|
||||
sub_08021218(this, 6, this->animationState);
|
||||
}
|
||||
|
||||
void sub_080213B0(Entity* this) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 1;
|
||||
this->nonPlanarMovement = 0xc0;
|
||||
this->field_0x76.HWORD = 0xf0;
|
||||
sub_08021218(this, 3, this->animationState);
|
||||
}
|
||||
|
||||
void sub_080213D0(Entity* this, u32 param_2) {
|
||||
this->action = 16;
|
||||
this->field_0x7a.HALF.HI = param_2;
|
||||
sub_08021218(this, 0xf, this->animationState);
|
||||
sub_08021588(this);
|
||||
}
|
||||
|
||||
void sub_080213F0(Entity* this) {
|
||||
this->action = 6;
|
||||
sub_08021218(this, 1, this->animationState);
|
||||
}
|
||||
|
||||
void sub_08021400(Entity* this) {
|
||||
this->action = 9;
|
||||
this->nonPlanarMovement = 0x60;
|
||||
sub_08021218(this, 10, this->animationState);
|
||||
}
|
||||
|
||||
void sub_08021414(Entity* this) {
|
||||
this->action = 17;
|
||||
sub_08021218(this, 5, this->animationState);
|
||||
}
|
||||
|
||||
void sub_08021424(Entity* this) {
|
||||
s32 x, y;
|
||||
u32 tmp;
|
||||
|
||||
u32 dir = GetFacingDirection(this, gUnk_020000B0);
|
||||
tmp = sub_08021274(this->animationState, dir);
|
||||
if (tmp != 0xff) {
|
||||
sub_08021218(this, this->field_0x74.HALF.LO, tmp);
|
||||
} else {
|
||||
tmp = this->animationState;
|
||||
}
|
||||
|
||||
switch (tmp) {
|
||||
case 0:
|
||||
x = gUnk_020000B0->x.HALF.HI;
|
||||
y = gUnk_020000B0->y.HALF.HI + 0x2c;
|
||||
break;
|
||||
case 1:
|
||||
x = gUnk_020000B0->x.HALF.HI - 0x24;
|
||||
y = gUnk_020000B0->y.HALF.HI;
|
||||
break;
|
||||
case 2:
|
||||
x = gUnk_020000B0->x.HALF.HI;
|
||||
y = gUnk_020000B0->y.HALF.HI - 0x1d;
|
||||
break;
|
||||
default:
|
||||
x = gUnk_020000B0->x.HALF.HI + 0x24;
|
||||
y = gUnk_020000B0->y.HALF.HI;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(6 < (x - this->x.HALF.HI) + 3U) && !(4 < (y - this->y.HALF.HI) + 2U)) {
|
||||
sub_080212B0(this);
|
||||
} else {
|
||||
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
|
||||
if (!sub_080AEF88(this)) {
|
||||
sub_080212B0(this);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_080214FC(Entity* this) {
|
||||
u32 direction;
|
||||
|
||||
if (!sub_08049FDC(this, 1))
|
||||
return 0;
|
||||
|
||||
direction = GetFacingDirection(this, gUnk_020000B0);
|
||||
if (4 < (direction - (this->frames.all & 0x1f)) - 2)
|
||||
return 0;
|
||||
|
||||
this->animationState = ((direction + 4) & 0x18) >> 3;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void sub_08021540(Entity* this) {
|
||||
u32 tmp, tmp2;
|
||||
u32 rand;
|
||||
|
||||
rand = Random();
|
||||
if (!sub_08049FA0(this) && (rand & 1)) {
|
||||
tmp2 = (sub_08049EE4(this) + 4) & 0x18;
|
||||
} else {
|
||||
tmp2 = (rand >> 0x10) & 0x18;
|
||||
}
|
||||
this->direction = tmp2;
|
||||
|
||||
tmp = sub_08021274(this->animationState, tmp2);
|
||||
if (tmp != 0xff)
|
||||
sub_08021218(this, 3, tmp);
|
||||
|
||||
this->actionDelay = 30;
|
||||
}
|
||||
|
||||
void sub_08021588(Entity* this) {
|
||||
if (this->attachedEntity) {
|
||||
this->attachedEntity->parent = NULL;
|
||||
this->attachedEntity = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802159C(Entity* this) {
|
||||
if (this->frames.all == 1) {
|
||||
Entity* ent;
|
||||
|
||||
this->frames.all = 0;
|
||||
this->damageType = 0x51;
|
||||
ent = sub_0804A98C(this, 0, 3);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
this->attachedEntity = ent;
|
||||
}
|
||||
sub_08004488(0x116);
|
||||
} else if (this->frames.all == 2) {
|
||||
this->frames.all = 0;
|
||||
sub_08021588(this);
|
||||
} else if (this->frames.all & 0x20) {
|
||||
this->frames.all &= ~0x20;
|
||||
sub_08004488(0x115);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021600(Entity* this) {
|
||||
if (this->frames.all == 1) {
|
||||
Entity* ent;
|
||||
|
||||
this->frames.all = 0;
|
||||
this->damageType = 0x51;
|
||||
ent = sub_0804A98C(this, 0, 4);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
this->attachedEntity = ent;
|
||||
}
|
||||
sub_08004488(0x10e);
|
||||
} else if (this->frames.all == 2) {
|
||||
this->frames.all = 0;
|
||||
sub_08021588(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021644(Entity* this) {
|
||||
if (this->frames.all & 0x20) {
|
||||
this->frames.all &= ~0x20;
|
||||
sub_08004488(0x7d);
|
||||
}
|
||||
}
|
||||
|
||||
extern u32 sub_08049F1C(Entity*, Entity*, u32);
|
||||
|
||||
u32 sub_08021664(Entity* this, Entity* ent) {
|
||||
switch (this->animationState) {
|
||||
case 0:
|
||||
return sub_08049F1C(this, ent, 0x22);
|
||||
case 1:
|
||||
return sub_08049F1C(this, ent, 0x1a);
|
||||
case 2:
|
||||
return sub_08049F1C(this, ent, 0x13);
|
||||
case 3:
|
||||
return sub_08049F1C(this, ent, 0x1a);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_0802169C(Entity* this, Entity* ent) {
|
||||
u32 ret;
|
||||
|
||||
switch (this->animationState) {
|
||||
case 0:
|
||||
ret = 0x2c;
|
||||
break;
|
||||
case 2:
|
||||
ret = 0x1d;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
ret = 0x24;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sub_08049F1C(this, ent, ret)) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CAA98[])(Entity*) = {
|
||||
sub_08020BA0,
|
||||
sub_08020BB8,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
nullsub_129,
|
||||
};
|
||||
void (*const gUnk_080CAAB0[])(Entity*) = {
|
||||
sub_08020D70,
|
||||
sub_08020D9C,
|
||||
sub_08020DB4,
|
||||
sub_08020DD4,
|
||||
sub_08020E28,
|
||||
sub_08020E48,
|
||||
sub_08020E78,
|
||||
sub_08020E98,
|
||||
sub_08020F28,
|
||||
sub_08020F48,
|
||||
sub_08020FAC,
|
||||
sub_08020FE4,
|
||||
sub_08021010,
|
||||
sub_08021038,
|
||||
sub_080210A8,
|
||||
sub_080210E4,
|
||||
sub_08021170,
|
||||
sub_080211A0,
|
||||
sub_080211D0,
|
||||
sub_080211F4,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CAB00[] = {
|
||||
30, 30, 20, 10,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CAB04[] = {
|
||||
60, 60, 45, 30,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CAB08[] = {
|
||||
90, 90, 60, 30,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CAB0C[] = {
|
||||
90, 90, 60, 30,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CAB10[] = {
|
||||
90, 90, 45, 8,
|
||||
};
|
||||
|
||||
const stuct_080CAB14 gUnk_080CAB14[] = {
|
||||
{0x00, 0x62},
|
||||
{0x04, 0x62},
|
||||
{0x08, 0x62},
|
||||
{0x0C, 0x62},
|
||||
{0x10, 0x62},
|
||||
{0x14, 0x62},
|
||||
{0x18, 0x62},
|
||||
{0x1C, 0x62},
|
||||
{0x20, 0x62},
|
||||
{0x24, 0x62},
|
||||
{0x28, 0x62},
|
||||
{0x2C, 0x62},
|
||||
{0x00, 0x63},
|
||||
{0x04, 0x63},
|
||||
{0x08, 0x63},
|
||||
{0x0C, 0x63},
|
||||
{0x10, 0x63},
|
||||
{0x14, 0x63},
|
||||
{0x18, 0x63},
|
||||
};
|
||||
|
||||
const u8 gUnk_080CAB3A[] = {
|
||||
0, 1, 1, 0, 3, 0, 1, 0,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CAB42[] = {
|
||||
1, 1, 3, 0, 1, 2, 0, 0,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CAB4A[] = {
|
||||
0, 0, 3, 1, 2, 2, 3, 1,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CAB52[] = {
|
||||
0, 3, 1, 0, 0, 0
|
||||
};
|
||||
|
||||
void (*const gUnk_080CAB58[])(Entity*) = {
|
||||
sub_08021328,
|
||||
sub_0802134C,
|
||||
sub_08021370,
|
||||
sub_08021380,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CAB68[] = {
|
||||
90, 90, 45, 7,
|
||||
};
|
||||
// clang-format on
|
||||
@@ -0,0 +1,271 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern s16 sub_080001DA(u32, u32); // ?
|
||||
extern void sub_08049CF4();
|
||||
extern u32 sub_0806FBFC(u32, u32, u32, u32);
|
||||
void sub_080221C0();
|
||||
|
||||
typedef struct {
|
||||
s8 h;
|
||||
s8 v;
|
||||
} PACKED PosOffset;
|
||||
|
||||
extern void (*const gUnk_080CB734[])(Entity*);
|
||||
extern void (*const gUnk_080CB74C[])(Entity*);
|
||||
|
||||
#if NON_MATCHING
|
||||
extern const PosOffset gUnk_080CB764[];
|
||||
#else
|
||||
extern const s8 gUnk_080CB764[];
|
||||
#endif
|
||||
extern const PosOffset gUnk_080CB76C[4][6];
|
||||
extern const u16 gUnk_080CB79C[];
|
||||
extern const BoundingBox* const* const gUnk_080CB8A4[];
|
||||
|
||||
extern s16 gUnk_080B4488[];
|
||||
|
||||
void DoorMimic(Entity* this) {
|
||||
gUnk_080CB734[GetNextFunction(this)](this);
|
||||
this->boundingBox = (BoundingBox*)gUnk_080CB8A4[this->entityType.parameter][this->frameIndex];
|
||||
}
|
||||
|
||||
void sub_08021FDC(Entity* this) {
|
||||
gUnk_080CB74C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08021FF4(Entity* this) {
|
||||
sub_0804AA30(this, gUnk_080CB734);
|
||||
}
|
||||
|
||||
void sub_08022004(Entity* this) {
|
||||
SetTile((u16)this->field_0x7c.HALF.LO, (u16)this->field_0x7c.HALF.HI, this->collisionLayer);
|
||||
CreateFx(this, 5, 0);
|
||||
sub_08049CF4(this);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
void sub_08022034(Entity* this) {
|
||||
this->action = 1;
|
||||
this->entityType.parameter = this->entityType.form & 3;
|
||||
this->spritePriority.b0 = 5;
|
||||
this->field_0x78.HWORD = gUnk_080CB764[this->entityType.parameter].h + this->x.HALF.HI;
|
||||
this->field_0x7a.HWORD = gUnk_080CB764[this->entityType.parameter].v + this->y.HALF.HI;
|
||||
InitializeAnimation(this, this->entityType.parameter);
|
||||
sub_080221C0(this);
|
||||
}
|
||||
#else
|
||||
void sub_08022034(Entity* this) {
|
||||
this->action = 1;
|
||||
this->entityType.parameter = this->entityType.form & 3;
|
||||
this->spritePriority.b0 = 5;
|
||||
this->field_0x78.HWORD = gUnk_080CB764[this->entityType.parameter * 2] + this->x.HALF.HI;
|
||||
this->field_0x7a.HWORD = gUnk_080CB764[this->entityType.parameter * 2 + 1] + this->y.HALF.HI;
|
||||
InitializeAnimation(this, this->entityType.parameter);
|
||||
sub_080221C0(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0802209C(Entity* this) {
|
||||
if (this->actionDelay == 0) {
|
||||
if (sub_0806FBFC(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x12;
|
||||
InitializeAnimation(this, this->entityType.parameter + 4);
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = this->actionDelay - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080220D8(Entity* this) {
|
||||
if (--this->actionDelay == 0)
|
||||
this->action = 3;
|
||||
}
|
||||
|
||||
void sub_080220F0(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
const PosOffset* off;
|
||||
u32 i;
|
||||
|
||||
this->action = 4;
|
||||
this->actionDelay = 0x78;
|
||||
this->field_0x44 = 0;
|
||||
off = gUnk_080CB76C[this->entityType.parameter];
|
||||
for (i = 0; i < 6; i++, off++) {
|
||||
Entity* fx = CreateFx(this, 0x11, 0);
|
||||
if (fx) {
|
||||
fx->x.HALF.HI += off->h;
|
||||
fx->y.HALF.HI += off->v;
|
||||
}
|
||||
}
|
||||
sub_08004488(260);
|
||||
} else if (this->frames.all & 1) {
|
||||
this->field_0x44 = 4;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022174(Entity* this) {
|
||||
sub_0800445C(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 5;
|
||||
InitializeAnimation(this, this->entityType.parameter + 8);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022198(Entity* this) {
|
||||
sub_0800445C(this);
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x5a;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080221C0(Entity* this) {
|
||||
u32 tile = COORD_TO_TILE(this) + gUnk_080B4488[this->entityType.parameter];
|
||||
this->field_0x7c.HALF.HI = tile;
|
||||
this->field_0x7c.HALF.LO = sub_080001DA(tile, this->collisionLayer);
|
||||
SetTile(gUnk_080CB79C[this->entityType.parameter], tile, this->collisionLayer);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CB734[])(Entity*) = {
|
||||
sub_08021FDC,
|
||||
sub_08021FF4,
|
||||
sub_08001324,
|
||||
sub_08022004,
|
||||
sub_08001242,
|
||||
sub_08021FDC,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CB74C[])(Entity*) = {
|
||||
sub_08022034,
|
||||
sub_0802209C,
|
||||
sub_080220D8,
|
||||
sub_080220F0,
|
||||
sub_08022174,
|
||||
sub_08022198,
|
||||
};
|
||||
|
||||
#if NON_MATCHING
|
||||
const PosOffset gUnk_080CB764[] = {
|
||||
{-0x08, 0x00},
|
||||
{-0x10, -0x08},
|
||||
{-0x08, -0x10},
|
||||
{ 0x00, -0x08},
|
||||
};
|
||||
#else
|
||||
const s8 gUnk_080CB764[] = {
|
||||
-0x08, 0x00,
|
||||
-0x10, -0x08,
|
||||
-0x08, -0x10,
|
||||
0x00, -0x08,
|
||||
};
|
||||
#endif
|
||||
|
||||
const PosOffset gUnk_080CB76C[][6] = {
|
||||
{
|
||||
{-0x04, 0x1a},
|
||||
{ 0x04, 0x1a},
|
||||
{-0x0c, 0x10},
|
||||
{ 0x0c, 0x10},
|
||||
{-0x0c, 0x08},
|
||||
{ 0x0c, 0x08},
|
||||
},
|
||||
{
|
||||
{-0x1a, -0x04},
|
||||
{-0x1a, 0x04},
|
||||
{-0x10, -0x0c},
|
||||
{-0x10, 0x0c},
|
||||
{-0x08, -0x0c},
|
||||
{-0x08, 0x0c},
|
||||
},
|
||||
{
|
||||
{-0x04, -0x1a},
|
||||
{ 0x04, -0x1a},
|
||||
{-0x0c, -0x10},
|
||||
{ 0x0c, -0x10},
|
||||
{-0x0c, -0x08},
|
||||
{ 0x0c, -0x08},
|
||||
},
|
||||
{
|
||||
{ 0x1a, -0x04},
|
||||
{ 0x1a, 0x04},
|
||||
{ 0x10, -0x0c},
|
||||
{ 0x10, 0x0c},
|
||||
{ 0x08, -0x0c},
|
||||
{ 0x08, 0x0c},
|
||||
},
|
||||
};
|
||||
|
||||
const u16 gUnk_080CB79C[] = {
|
||||
0x4023,
|
||||
0x4025,
|
||||
0x4026,
|
||||
0x4024,
|
||||
};
|
||||
|
||||
|
||||
const BoundingBox gUnk_080CB7A4 = { 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x08, 0x06 };
|
||||
const BoundingBox gUnk_080CB7AC = { 0x00, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04 };
|
||||
const BoundingBox gUnk_080CB7B4 = { 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04 };
|
||||
const BoundingBox gUnk_080CB7BC = { 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0x08 };
|
||||
const BoundingBox gUnk_080CB7C4 = { 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0c };
|
||||
const BoundingBox gUnk_080CB7CC = { 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 };
|
||||
const BoundingBox gUnk_080CB7D4 = { 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04 };
|
||||
const BoundingBox gUnk_080CB7DC = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04 };
|
||||
const BoundingBox gUnk_080CB7E4 = { 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 };
|
||||
const BoundingBox gUnk_080CB7EC = { 0x00, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0c };
|
||||
|
||||
const BoundingBox *const gUnk_080CB7F4[] = {
|
||||
&gUnk_080CB7A4,
|
||||
&gUnk_080CB7AC,
|
||||
&gUnk_080CB7B4,
|
||||
&gUnk_080CB7BC,
|
||||
&gUnk_080CB7C4,
|
||||
&gUnk_080CB7C4,
|
||||
&gUnk_080CB7CC,
|
||||
&gUnk_080CB7D4,
|
||||
&gUnk_080CB7DC,
|
||||
&gUnk_080CB7E4,
|
||||
&gUnk_080CB7EC,
|
||||
&gUnk_080CB7EC,
|
||||
};
|
||||
|
||||
const BoundingBox gUnk_080CB824 = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 };
|
||||
const BoundingBox gUnk_080CB82C = { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08 };
|
||||
const BoundingBox gUnk_080CB834 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08 };
|
||||
const BoundingBox gUnk_080CB83C = { 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 };
|
||||
const BoundingBox gUnk_080CB844 = { 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08 };
|
||||
const BoundingBox gUnk_080CB84C = { 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 };
|
||||
const BoundingBox gUnk_080CB854 = { 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08 };
|
||||
const BoundingBox gUnk_080CB85C = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08 };
|
||||
const BoundingBox gUnk_080CB864 = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08 };
|
||||
const BoundingBox gUnk_080CB86C = { 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08 };
|
||||
|
||||
const BoundingBox *const gUnk_080CB874[] = {
|
||||
&gUnk_080CB84C,
|
||||
&gUnk_080CB854,
|
||||
&gUnk_080CB85C,
|
||||
&gUnk_080CB864,
|
||||
&gUnk_080CB86C,
|
||||
&gUnk_080CB86C,
|
||||
&gUnk_080CB824,
|
||||
&gUnk_080CB82C,
|
||||
&gUnk_080CB834,
|
||||
&gUnk_080CB83C,
|
||||
&gUnk_080CB844,
|
||||
&gUnk_080CB844,
|
||||
};
|
||||
|
||||
const BoundingBox *const *const gUnk_080CB8A4[] = {
|
||||
gUnk_080CB7F4,
|
||||
gUnk_080CB874,
|
||||
gUnk_080CB7F4,
|
||||
gUnk_080CB874,
|
||||
};
|
||||
// clang-format on
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08023000(Entity*, int);
|
||||
|
||||
extern void (*const gUnk_080CBBC8[])(Entity*);
|
||||
extern void (*const gUnk_080CBBDC[])(Entity*);
|
||||
|
||||
void EnemyE(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CBBC8);
|
||||
}
|
||||
|
||||
void sub_08022FB4(Entity* this) {
|
||||
gUnk_080CBBDC[this->action](this);
|
||||
}
|
||||
|
||||
void nullsub_133(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08022FD0(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
sub_08023000(this, 0);
|
||||
}
|
||||
|
||||
void sub_08022FEC(Entity* this) {
|
||||
sub_08023000(this, 0x80);
|
||||
}
|
||||
|
||||
void sub_08022FF8(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08022FFC(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08023000(Entity* this, int frames) {
|
||||
int tmp;
|
||||
|
||||
if (frames == 0x80) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
} else {
|
||||
InitAnimationForceUpdate(this, frames);
|
||||
}
|
||||
|
||||
tmp = 0x80;
|
||||
if (this->frameSpriteSettings == 0x40)
|
||||
tmp *= -1;
|
||||
|
||||
this->spriteRendering.b0 = 3;
|
||||
sub_0805EC9C(this, tmp, 0x80, 0);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CBBC8[])(Entity*) = {
|
||||
sub_08022FB4,
|
||||
nullsub_133,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CBBDC[])(Entity*) = {
|
||||
sub_08022FD0,
|
||||
sub_08022FEC,
|
||||
sub_08022FF8,
|
||||
sub_08022FFC,
|
||||
};
|
||||
// clang-format on
|
||||
+38
-26
@@ -1,39 +1,51 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void EnemyFunctionHandler(Entity*, void (*const funcs[])(Entity*));
|
||||
extern void DeleteThisEntity();
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080CB570[])(Entity*);
|
||||
extern void (*const gUnk_080CB588[])(Entity*);
|
||||
|
||||
void HangingSeed(Entity *this)
|
||||
{
|
||||
EnemyFunctionHandler(this, gUnk_080CB570);
|
||||
void HangingSeed(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CB570);
|
||||
}
|
||||
|
||||
void sub_080216E4(Entity *this)
|
||||
{
|
||||
gUnk_080CB588[this->action](this);
|
||||
void sub_080216E4(Entity* this) {
|
||||
gUnk_080CB588[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080216FC(Entity *this)
|
||||
{
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
CreateFx(this, 3, 0x80);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
void sub_080216FC(Entity* this) {
|
||||
if (this->bitfield & 0x80) {
|
||||
CreateFx(this, 3, 0x80);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_7(Entity* this){}
|
||||
|
||||
void sub_08021720(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->frameIndex = (this->entityType).form;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spritePriority.b0 = 3;
|
||||
void nullsub_7(Entity* this) {
|
||||
}
|
||||
|
||||
void nullsub_08(Entity* this){}
|
||||
void sub_08021720(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->frameIndex = this->entityType.form;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spritePriority.b0 = 3;
|
||||
}
|
||||
|
||||
void nullsub_08(Entity* this) {
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CB570[])(Entity*) = {
|
||||
sub_080216E4,
|
||||
sub_080216FC,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
nullsub_7,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CB588[])(Entity*) = {
|
||||
sub_08021720,
|
||||
nullsub_08,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
+109
-87
@@ -2,13 +2,14 @@
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08001328(Entity*);
|
||||
extern u32 sub_0806F520(Entity*);
|
||||
extern void sub_0806F4E8(Entity*);
|
||||
extern u32 sub_0806F3E4(Entity*);
|
||||
extern void sub_0804A7D4(Entity*);
|
||||
extern void sub_0804A720(Entity*);
|
||||
extern u32 Random();
|
||||
extern void sub_08021EF0(Entity*);
|
||||
extern void sub_080AEFB4(Entity*);
|
||||
extern void sub_08021F24(Entity*);
|
||||
@@ -20,98 +21,85 @@ extern void (*const gUnk_080CB69C[])(Entity*);
|
||||
extern void (*const gUnk_080CB6B4[])(Entity*);
|
||||
extern void (*const gUnk_080CB6C4[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CB6D0[];
|
||||
extern u16 gUnk_080CB6D6[];
|
||||
extern u8 gUnk_080CB6F6[];
|
||||
extern const s8 gUnk_080CB6D0[];
|
||||
extern const u16 gUnk_080CB6D6[];
|
||||
extern const u8 gUnk_080CB6F6[];
|
||||
|
||||
void Keese(Entity *this)
|
||||
{
|
||||
void Keese(Entity* this) {
|
||||
gUnk_080CB69C[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void sub_08021D80(Entity *this)
|
||||
{
|
||||
void sub_08021D80(Entity* this) {
|
||||
gUnk_080CB6B4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08021d98(Entity *this)
|
||||
{
|
||||
sub_0804AA30(this, gUnk_080CB69C);
|
||||
void sub_08021d98(Entity* this) {
|
||||
sub_0804AA30(this, gUnk_080CB69C);
|
||||
}
|
||||
|
||||
void sub_08021DA8(Entity *this)
|
||||
{
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080CB6C4[this->previousActionFlag](this);
|
||||
}
|
||||
void sub_08021DA8(Entity* this) {
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080CB6C4[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021DCC(Entity *this)
|
||||
{
|
||||
this->previousActionFlag = 2;
|
||||
void sub_08021DCC(Entity* this) {
|
||||
this->previousActionFlag = 2;
|
||||
}
|
||||
|
||||
void sub_08021DD4(Entity *this)
|
||||
{
|
||||
sub_0806F4E8(this);
|
||||
void sub_08021DD4(Entity* this) {
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_08021DDC(Entity *this)
|
||||
{
|
||||
if (sub_0806F3E4(this)) {
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
void sub_08021DDC(Entity* this) {
|
||||
if (sub_0806F3E4(this)) {
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021DF0(Entity *this)
|
||||
{
|
||||
|
||||
sub_0804A720(this);
|
||||
if ((this->entityType).form != 0) {
|
||||
this->spritePriority.b1 = 1;
|
||||
this->height.HALF.HI = -0x10;
|
||||
}
|
||||
this->direction = Random() & 0x1f;
|
||||
this->field_0x1c = 1;
|
||||
this->spritePriority.b0 = 3;
|
||||
this->collisionLayer = 3;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
sub_08021EF0(this);
|
||||
}
|
||||
void sub_08021DF0(Entity* this) {
|
||||
|
||||
void sub_08021E4C(Entity *this)
|
||||
{
|
||||
if (this->field_0x78.HWORD != 0) {
|
||||
this->field_0x78.HWORD--;
|
||||
}
|
||||
if (this->field_0x7a.HWORD != 0) {
|
||||
(this->field_0x7a.HWORD)--;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
sub_08021F24(this);
|
||||
}
|
||||
else {
|
||||
sub_080AEFB4(this);
|
||||
}
|
||||
this->spriteOffsetY = gUnk_080CB6D0[this->frames.all];
|
||||
}
|
||||
|
||||
void sub_08021EA4(Entity *this)
|
||||
{
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_0804A720(this);
|
||||
if ((this->entityType).form != 0) {
|
||||
this->spritePriority.b1 = 1;
|
||||
this->height.HALF.HI = -0x10;
|
||||
}
|
||||
this->direction = Random() & 0x1f;
|
||||
this->field_0x1c = 1;
|
||||
this->spritePriority.b0 = 3;
|
||||
this->collisionLayer = 3;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
sub_08021EF0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021EBC(Entity *this)
|
||||
{
|
||||
void sub_08021E4C(Entity* this) {
|
||||
if (this->field_0x78.HWORD != 0) {
|
||||
this->field_0x78.HWORD--;
|
||||
}
|
||||
if (this->field_0x7a.HWORD != 0) {
|
||||
(this->field_0x7a.HWORD)--;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
sub_08021F24(this);
|
||||
} else {
|
||||
sub_080AEFB4(this);
|
||||
}
|
||||
this->spriteOffsetY = gUnk_080CB6D0[this->frames.all];
|
||||
}
|
||||
|
||||
void sub_08021EA4(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08021EF0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021EBC(Entity* this) {
|
||||
s32 iVar1;
|
||||
|
||||
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
iVar1 = sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70);
|
||||
if (iVar1 != 0) {
|
||||
sub_08021EF0(this);
|
||||
@@ -119,37 +107,71 @@ void sub_08021EBC(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08021EF0(Entity *this)
|
||||
{
|
||||
u32 uVar1;
|
||||
|
||||
this->action = 1;
|
||||
this->field_0x78.HWORD = gUnk_080CB6D6[Random() & 0xf];
|
||||
this->field_0x7a.HWORD = 0x3c;
|
||||
InitializeAnimation(this, 0);
|
||||
void sub_08021EF0(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
this->action = 1;
|
||||
this->field_0x78.HWORD = gUnk_080CB6D6[Random() & 0xf];
|
||||
this->field_0x7a.HWORD = 0x3c;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void sub_08021F24(Entity *this)
|
||||
{
|
||||
void sub_08021F24(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
|
||||
if (this->field_0x78.HWORD == 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = gUnk_080CB6F6[Random() & 0xf];
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
else if (!this->field_0x7a.HWORD && !(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
|
||||
} else if (!this->field_0x7a.HWORD &&
|
||||
!(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0x1e;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (sub_08049FA0(this) != 0) {
|
||||
this->direction = Random() & 0x1f;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this->direction = sub_08049EE4(this);
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CB69C[])(Entity*) = {
|
||||
sub_08021D80,
|
||||
sub_08021d98,
|
||||
sub_08001328,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
sub_08021DA8,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CB6B4[])(Entity*) = {
|
||||
sub_08021DF0,
|
||||
sub_08021E4C,
|
||||
sub_08021EA4,
|
||||
sub_08021EBC,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CB6C4[])(Entity*) = {
|
||||
sub_08021DCC,
|
||||
sub_08021DD4,
|
||||
sub_08021DDC,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CB6D0[] = {
|
||||
1, -2, -5, -2, 1, 0,
|
||||
};
|
||||
|
||||
const u16 gUnk_080CB6D6[] = {
|
||||
180, 180, 300, 300, 300, 300, 300, 300,
|
||||
480, 480, 480, 480, 480, 480, 720, 720,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CB6F6[] = {
|
||||
30, 30, 45, 45, 45, 45, 45, 45,
|
||||
60, 60, 60, 60, 60, 60, 75, 75,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -14,7 +14,6 @@ extern void sub_0803CAD0(Entity *);
|
||||
// sub_0803C784
|
||||
extern void sub_0803CBAC(Entity *); // Also used in sub_0803C86C
|
||||
extern Entity *CreateFx(Entity*, u32, u32);
|
||||
extern void sub_0804A9FC(Entity *, u32);
|
||||
extern void sub_0804AA30(Entity *, void (*const funcs[])(Entity *));
|
||||
|
||||
// sub_0803C820
|
||||
|
||||
+36
-4
@@ -4,7 +4,6 @@
|
||||
#include "functions.h"
|
||||
|
||||
extern void SetChildOffset(Entity*, s32, s32, s32);
|
||||
extern void sub_0804A9FC(Entity*, u32);
|
||||
extern void sub_0804AA30(Entity*, void (*const func[])(Entity*));
|
||||
extern void sub_0804A7D4(Entity*);
|
||||
extern Entity* CreateDeathFx(Entity*, u32, u32);
|
||||
@@ -19,9 +18,10 @@ bool32 sub_0801FDE4(Entity*, s32, s32);
|
||||
extern void (*const gUnk_080CA49C[])(Entity*);
|
||||
extern void (*const gUnk_080CA4B4[])(Entity*);
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u8 gUnk_080CA4C8[];
|
||||
extern u16 gUnk_080CA4CA[];
|
||||
extern const u8 gUnk_080CA4C8[];
|
||||
extern const u16 gUnk_080CA4CA[];
|
||||
extern s16 gSineTable[];
|
||||
|
||||
void Leever(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CA49C);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
@@ -114,7 +114,7 @@ void sub_0801FDB4(Entity* this) {
|
||||
|
||||
u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) {
|
||||
u32 uVar3;
|
||||
u16* puVar4;
|
||||
const u16* puVar4;
|
||||
|
||||
if (sub_080002D4(x, y, gUnk_020000B0->collisionLayer) != 0) {
|
||||
return 0;
|
||||
@@ -177,3 +177,35 @@ void sub_0801FED4(Entity* this) {
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CA49C[])(Entity*) = {
|
||||
sub_0801FC28,
|
||||
sub_0801FC40,
|
||||
sub_08001324,
|
||||
sub_0801FC7C,
|
||||
sub_08001242,
|
||||
sub_0801FC28,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA4B4[])(Entity*) = {
|
||||
sub_0801FC9C,
|
||||
sub_0801FCB0,
|
||||
sub_0801FD2C,
|
||||
sub_0801FD80,
|
||||
sub_0801FDB4,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CA4C8[] = {
|
||||
0x06,
|
||||
0xFA,
|
||||
};
|
||||
|
||||
const u16 gUnk_080CA4CA[] = {
|
||||
0x000A,
|
||||
0x0009,
|
||||
0x000C,
|
||||
0x000B,
|
||||
0xFFFF,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -8,7 +8,6 @@ void sub_08045374(Entity*);
|
||||
extern u32 sub_0806FA04(u32, u32);
|
||||
extern void sub_0804A720();
|
||||
extern void sub_080452E4();
|
||||
extern void sub_0804A9FC();
|
||||
extern void sub_0804AA30();
|
||||
extern void ReplaceMonitoredEntity(Entity*, Entity*);
|
||||
extern void sub_0804A7D4(Entity*);
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08022EAC(Entity*);
|
||||
void sub_08022F14(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CBB90[])(Entity*);
|
||||
extern void (*const gUnk_080CBBA0[])(Entity*);
|
||||
extern void (*const gUnk_080CBBB4[])(Entity*);
|
||||
extern void (*const gUnk_080CBBBC[])(Entity*);
|
||||
|
||||
extern u8 gEntCount;
|
||||
extern const s8 gUnk_080CBBC4[];
|
||||
|
||||
void Moldorm(Entity* this) {
|
||||
gUnk_080CBB90[this->entityType.form](this);
|
||||
}
|
||||
|
||||
void sub_08022BA0(Entity* this) {
|
||||
this->field_0x78.HALF.HI++;
|
||||
this->field_0x74.HWORD = this->x.HALF.HI;
|
||||
this->field_0x76.HWORD = this->y.HALF.HI;
|
||||
EnemyFunctionHandler(this, gUnk_080CBBA0);
|
||||
sub_08022EAC(this);
|
||||
}
|
||||
|
||||
void sub_08022BD4(Entity* this) {
|
||||
gUnk_080CBBB4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08022BEC(Entity* this) {
|
||||
if (this->field_0x7a.HALF.LO != this->currentHealth)
|
||||
this->field_0x7a.HALF.HI = 30;
|
||||
|
||||
this->field_0x7a.HALF.LO = this->currentHealth;
|
||||
this->actionDelay = 1;
|
||||
this->direction = this->field_0x3e;
|
||||
|
||||
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
|
||||
this->frameIndex = this->animationState;
|
||||
|
||||
this->attachedEntity->hurtBlinkTime = this->hurtBlinkTime;
|
||||
(*(Entity**)&this->field_0x7c)->hurtBlinkTime = this->hurtBlinkTime;
|
||||
(*(Entity**)&this->field_0x80)->hurtBlinkTime = this->hurtBlinkTime;
|
||||
sub_0804AA30(this, gUnk_080CBBA0);
|
||||
}
|
||||
|
||||
void sub_08022C58(Entity* this) {
|
||||
Entity *tail0, *tail1, *tail2;
|
||||
|
||||
this->flags &= ~0x80;
|
||||
|
||||
if (gEntCount >= 0x45)
|
||||
return;
|
||||
|
||||
tail0 = CreateEnemy(0xd, 1);
|
||||
this->attachedEntity = tail0;
|
||||
tail0->spritePriority.b0 = 5;
|
||||
tail0->parent = this;
|
||||
CopyPosition(this, tail0);
|
||||
|
||||
tail1 = CreateEnemy(0xd, 2);
|
||||
tail0->attachedEntity = tail1;
|
||||
tail1->spritePriority.b0 = 5;
|
||||
tail1->parent = this;
|
||||
CopyPosition(this, tail1);
|
||||
|
||||
tail2 = CreateEnemy(0xd, 3);
|
||||
tail1->attachedEntity = tail2;
|
||||
tail2->spritePriority.b0 = 5;
|
||||
tail2->parent = this;
|
||||
CopyPosition(this, tail2);
|
||||
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
this->field_0xf = 1;
|
||||
this->flags = this->flags | 0x80;
|
||||
this->parent = this;
|
||||
this->attachedEntity = tail0;
|
||||
*(Entity**)&this->field_0x7c = tail1;
|
||||
*(Entity**)&this->field_0x80 = tail2;
|
||||
|
||||
this->direction = Random() & 0x1f;
|
||||
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
|
||||
this->frameIndex = this->animationState;
|
||||
this->field_0x7a.HALF.LO = this->currentHealth;
|
||||
}
|
||||
|
||||
void sub_08022D40(Entity* this) {
|
||||
if (this->field_0x7a.HALF.HI) {
|
||||
if (this->field_0x7a.HALF.HI-- & 1) {
|
||||
this->animationState = (this->animationState + 1) & 7;
|
||||
this->frameIndex = this->animationState;
|
||||
}
|
||||
} else {
|
||||
sub_08022F14(this);
|
||||
sub_080AEF88(this);
|
||||
|
||||
if (this->collisions) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
|
||||
this->frameIndex = this->animationState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022D90(Entity* this) {
|
||||
if (this->parent->next) {
|
||||
Entity* parent;
|
||||
|
||||
gUnk_080CBBBC[this->action](this);
|
||||
parent = this->parent;
|
||||
this->spriteOrientation.flipY = parent->spriteOrientation.flipY;
|
||||
this->spriteRendering.b3 = parent->spriteRendering.b3;
|
||||
this->collisionLayer = parent->collisionLayer;
|
||||
} else {
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022DE8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->field_0x7c.BYTES.byte0 = 0x88;
|
||||
this->field_0x7c.BYTES.byte1 = 0x88;
|
||||
this->field_0x7c.BYTES.byte2 = 0x88;
|
||||
this->field_0x7c.BYTES.byte3 = 0x88;
|
||||
this->field_0x80.HALF.LO = 0x88;
|
||||
this->field_0x80.HALF.HI = 0x88;
|
||||
this->field_0x82.HALF.LO = 0x88;
|
||||
this->field_0x82.HALF.HI = 0x88;
|
||||
this->animationState = this->parent->animationState;
|
||||
*(u32*)&this->cutsceneBeh = this->animationState * 0x11111111;
|
||||
|
||||
if (this->entityType.form != 3) {
|
||||
this->frameIndex = this->entityType.form + 7;
|
||||
} else {
|
||||
this->frameIndex = this->animationState + 10;
|
||||
}
|
||||
}
|
||||
|
||||
NAKED
|
||||
void sub_08022E40(Entity* this) {
|
||||
asm(".include \"asm/non_matching/moldorm/sub_08022E40.inc\"");
|
||||
}
|
||||
|
||||
NAKED
|
||||
void sub_08022EAC(Entity* this) {
|
||||
asm(".include \"asm/non_matching/moldorm/sub_08022EAC.inc\"");
|
||||
}
|
||||
|
||||
void sub_08022F14(Entity* this) {
|
||||
if (sub_08049FA0(this) == 0) {
|
||||
u32 bVar6 = (sub_08049EE4(this) - this->direction) & 0x1f;
|
||||
if (8 < ((bVar6 + 4) & 0x1f)) {
|
||||
this->field_0xf = 8;
|
||||
if (bVar6 < 0x10) {
|
||||
this->field_0x78.HALF.LO = 1;
|
||||
} else {
|
||||
this->field_0x78.HALF.LO = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 4;
|
||||
|
||||
if (--this->field_0xf == 0) {
|
||||
this->field_0xf = 8;
|
||||
this->field_0x78.HALF.LO = gUnk_080CBBC4[Random() & 1];
|
||||
}
|
||||
|
||||
this->direction += this->field_0x78.HALF.LO;
|
||||
this->direction &= 0x1f;
|
||||
|
||||
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
|
||||
this->frameIndex = this->animationState;
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CBB90[])(Entity*) = {
|
||||
sub_08022BA0,
|
||||
sub_08022D90,
|
||||
sub_08022D90,
|
||||
sub_08022D90,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CBBA0[])(Entity*) = {
|
||||
sub_08022BD4,
|
||||
sub_08022BEC,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CBBB4[])(Entity*) = {
|
||||
sub_08022C58,
|
||||
sub_08022D40,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CBBBC[])(Entity*) = {
|
||||
sub_08022DE8,
|
||||
sub_08022E40,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CBBC4[] = {
|
||||
1, -1, 0, 0,
|
||||
};
|
||||
// clang-format off
|
||||
+197
-60
@@ -1,119 +1,256 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void EnemyFunctionHandler();
|
||||
extern void SetChildOffset();
|
||||
extern void sub_0804AA30();
|
||||
extern void sub_0804A9FC();
|
||||
extern void sub_0804A7D4();
|
||||
extern void CreateDeathFx();
|
||||
extern void sub_0801ECFC();
|
||||
extern u32 sub_0806F520();
|
||||
extern void sub_0806F4E8();
|
||||
extern void sub_0806F3E4();
|
||||
extern void UpdateAnimationVariableFrames();
|
||||
extern void sub_0804A720();
|
||||
extern u32 Random();
|
||||
extern void sub_0801ED14();
|
||||
extern u32 sub_0801EDEC();
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
|
||||
extern void(*gOctorok[2]);
|
||||
extern void (*gOctorokIdle[4])(Entity*);
|
||||
extern void (*gUnk_080CA158[4])(Entity*);
|
||||
extern void (*const gOctorok[6])(Entity*);
|
||||
extern void (*const gOctorokIdle[4])(Entity*);
|
||||
extern void (*const gUnk_080CA158[6])(Entity*);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern const u8 gUnk_080CA170[4];
|
||||
extern const u8 gUnk_080CA174[2];
|
||||
extern const u8 gUnk_080CA176[8];
|
||||
extern const s8 gUnk_080CA17E[2];
|
||||
|
||||
extern u8 gUnk_080CA170[8];
|
||||
// Main
|
||||
void Octorok(Entity* ent) {
|
||||
EnemyFunctionHandler(ent, gOctorok);
|
||||
SetChildOffset(ent, 0, 1, -16);
|
||||
void Octorok(Entity* this) {
|
||||
EnemyFunctionHandler(this, gOctorok);
|
||||
SetChildOffset(this, 0, 1, -16);
|
||||
}
|
||||
|
||||
// Idle
|
||||
void sub_0801EAD0(Entity* ent) {
|
||||
gOctorokIdle[ent->action](ent);
|
||||
void sub_0801EAD0(Entity* this) {
|
||||
gOctorokIdle[this->action](this);
|
||||
}
|
||||
|
||||
// Touch player
|
||||
void sub_0801EAE8(Entity* ent) {
|
||||
if (ent->field_0x43 != 0) {
|
||||
sub_0804A9FC(ent, 28);
|
||||
void sub_0801EAE8(Entity* this) {
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 28);
|
||||
}
|
||||
sub_0804AA30(ent, gOctorok);
|
||||
sub_0804AA30(this, gOctorok);
|
||||
}
|
||||
|
||||
// Death
|
||||
void sub_0801EB0C(Entity* ent) {
|
||||
if ((ent->entityType).form == 0) {
|
||||
sub_0804A7D4(ent);
|
||||
void sub_0801EB0C(Entity* this) {
|
||||
if ((this->entityType).form == 0) {
|
||||
sub_0804A7D4(this);
|
||||
} else {
|
||||
CreateDeathFx(ent, 241, 0);
|
||||
CreateDeathFx(this, 241, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EB2C(Entity* ent) {
|
||||
void sub_0801EB2C(Entity* this) {
|
||||
s32 iVar1;
|
||||
|
||||
if ((ent->previousActionFlag < 3) && (iVar1 = sub_0806F520(ent), iVar1 == 0)) {
|
||||
sub_0801ECFC(ent);
|
||||
InitializeAnimation(ent, ent->animationState);
|
||||
if ((this->previousActionFlag < 3) && (iVar1 = sub_0806F520(this), iVar1 == 0)) {
|
||||
sub_0801ECFC(this);
|
||||
InitializeAnimation(this, this->animationState);
|
||||
} else {
|
||||
gUnk_080CA158[ent->previousActionFlag](ent);
|
||||
gUnk_080CA158[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EB68(Entity* ent) {
|
||||
ent->previousActionFlag = 1;
|
||||
ent->field_0x1d = 60;
|
||||
void sub_0801EB68(Entity* this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 60;
|
||||
}
|
||||
|
||||
void sub_0801EB74(Entity* ent) {
|
||||
sub_0806F4E8(ent);
|
||||
void sub_0801EB74(Entity* this) {
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_0801EB7C(Entity* ent) {
|
||||
sub_0806F3E4(ent);
|
||||
void sub_0801EB7C(Entity* this) {
|
||||
sub_0806F3E4(this);
|
||||
}
|
||||
|
||||
void sub_0801EB84(Entity* ent) {
|
||||
ent->flags = ent->flags & 127;
|
||||
UpdateAnimationVariableFrames(ent, 2);
|
||||
void sub_0801EB84(Entity* this) {
|
||||
this->flags &= 0x7f;
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
}
|
||||
|
||||
void nullsub_3() {
|
||||
void nullsub_3(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0801EB9C(Entity* ent) {
|
||||
if ((ent->flags & 128) != 0) {
|
||||
ent->flags = ent->flags | 128;
|
||||
ent->field_0x3a = ent->field_0x3a & 251;
|
||||
void sub_0801EB9C(Entity* this) {
|
||||
if (this->flags & 0x80) {
|
||||
this->flags |= 0x80;
|
||||
this->field_0x3a &= 0xfb;
|
||||
} else {
|
||||
ent->currentHealth = 0;
|
||||
this->currentHealth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Init
|
||||
#ifdef NON_MATCHING
|
||||
void sub_0801EBC8(Entity* ent) {
|
||||
sub_0804A720();
|
||||
ent->animationState = (ent->entityType).form == 2 ? (ent->entityType).form : Random() & 3;
|
||||
ent->filler[0] = 18;
|
||||
sub_0801ECFC(ent);
|
||||
InitializeAnimation(ent, ent->animationState);
|
||||
void sub_0801EBC8(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
if (this->entityType.form == 2) {
|
||||
this->animationState = this->entityType.form;
|
||||
} else {
|
||||
this->animationState = Random() & 3;
|
||||
}
|
||||
this->field_0x1c = 18;
|
||||
sub_0801ECFC(this);
|
||||
InitializeAnimation(this, this->animationState);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_0801EBC8(Entity* ent) {
|
||||
asm(".include \"asm/octorok/sub_0801EBC8.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0801EBF4(Entity* ent) {
|
||||
void sub_0801EBF4(Entity* this) {
|
||||
u32 uVar2;
|
||||
|
||||
if (--ent->actionDelay == 0) {
|
||||
ent->action = 2;
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 2;
|
||||
uVar2 = Random();
|
||||
ent->actionDelay = gUnk_080CA170[uVar2 & 3];
|
||||
sub_0801ED14(ent);
|
||||
this->actionDelay = gUnk_080CA170[uVar2 & 3];
|
||||
sub_0801ED14(this);
|
||||
}
|
||||
GetNextFrame(ent);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_0801EC2C(Entity* this) {
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
if (sub_0801EDEC(this) && gUnk_080CA174[this->entityType.form] <= (Random() & 3)) {
|
||||
this->action = 3;
|
||||
InitializeAnimation(this, this->animationState + 4);
|
||||
} else {
|
||||
sub_0801ECFC(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EC80(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
Entity* ent = sub_0804A98C(this, 1, 0);
|
||||
if (ent) {
|
||||
const s8* off;
|
||||
ent->direction = this->direction;
|
||||
off = &gUnk_080CA176[this->direction / 4];
|
||||
ent->x.HALF.HI += off[0];
|
||||
ent->y.HALF.HI += off[1];
|
||||
ent->height.HALF.HI = -3;
|
||||
this->frames.all &= 0xfe;
|
||||
sub_08004488(0x18d);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80)
|
||||
sub_0801ECFC(this);
|
||||
}
|
||||
|
||||
void sub_0801ECFC(Entity* this) {
|
||||
this->action = 1;
|
||||
this->actionDelay = (Random() & 0x38) + 0x18;
|
||||
}
|
||||
|
||||
void sub_0801ED14(Entity* this) {
|
||||
if (this->entityType.form != 2) {
|
||||
if (sub_08049FA0(this)) {
|
||||
if (this->entityType.form == 1 && (Random() & 3) == 0 && sub_08049FDC(this, 1)) {
|
||||
this->direction = (GetFacingDirection(this, gUnk_020000B0) + 4) & 0x18;
|
||||
} else {
|
||||
this->direction = Random() & 0x18;
|
||||
}
|
||||
} else if ((Random() & 3)) {
|
||||
this->direction = (sub_08049EE4(this) + gUnk_080CA17E[Random() & 1]) & 0x18;
|
||||
} else {
|
||||
this->direction = Random() & 0x18;
|
||||
}
|
||||
} else {
|
||||
if (sub_08049FDC(this, 1) == 0) {
|
||||
if (sub_08049FA0(this)) {
|
||||
this->direction = Random() & 0x18;
|
||||
} else if (Random() & 3) {
|
||||
this->direction = (sub_08049EE4(this) + gUnk_080CA17E[Random() & 1]) & 0x18;
|
||||
} else {
|
||||
this->direction = (GetFacingDirection(this, gUnk_020000B0) + 4) & 0x18;
|
||||
}
|
||||
} else {
|
||||
this->direction = (GetFacingDirection(this, gUnk_020000B0) + 4) & 0x18;
|
||||
}
|
||||
}
|
||||
this->animationState = this->direction >> 3;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
}
|
||||
|
||||
u32 sub_0801EDEC(Entity* this) {
|
||||
Entity* ent = sub_08049DF4(1);
|
||||
|
||||
if (ent == NULL)
|
||||
return 0;
|
||||
|
||||
if (((GetFacingDirection(this, ent) + 4) & 0x18) != this->direction)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gOctorok[])(Entity*) = {
|
||||
sub_0801EAD0,
|
||||
sub_0801EAE8,
|
||||
sub_08001324,
|
||||
sub_0801EB0C,
|
||||
sub_08001242,
|
||||
sub_0801EB2C,
|
||||
};
|
||||
|
||||
void (*const gOctorokIdle[])(Entity*) = {
|
||||
sub_0801EBC8,
|
||||
sub_0801EBF4,
|
||||
sub_0801EC2C,
|
||||
sub_0801EC80,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA158[])(Entity*) = {
|
||||
sub_0801EB68,
|
||||
sub_0801EB74,
|
||||
sub_0801EB7C,
|
||||
sub_0801EB84,
|
||||
nullsub_3,
|
||||
sub_0801EB9C,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CA170[] = {
|
||||
30,
|
||||
60,
|
||||
60,
|
||||
90,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CA174[] = {
|
||||
1,
|
||||
0,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CA176[] = {
|
||||
0x00,
|
||||
0xFD,
|
||||
0x04,
|
||||
0x00,
|
||||
0x00,
|
||||
0x02,
|
||||
0xFC,
|
||||
0x00,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CA17E[] = {
|
||||
0x04,
|
||||
0xFC,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -0,0 +1,400 @@
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080CA570[])(Entity*);
|
||||
extern void (*const gUnk_080CA588[])(Entity*);
|
||||
extern void (*const gUnk_080CA590[])(Entity*);
|
||||
extern void (*const gUnk_080CA5BC[])(Entity*);
|
||||
|
||||
extern const s8 gUnk_080CA5B8[];
|
||||
extern const s8 gUnk_080CA5D4[];
|
||||
|
||||
void sub_080205F8(Entity*);
|
||||
void sub_08020604(Entity*);
|
||||
|
||||
extern u32 sub_0800442E(Entity*);
|
||||
extern u32 sub_08049F1C(Entity*, Entity*, u32);
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
|
||||
void Peahat(Entity* this) {
|
||||
if (this->entityType.form == 0) {
|
||||
EnemyFunctionHandler(this, gUnk_080CA570);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
} else {
|
||||
gUnk_080CA588[this->action](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FF9C(Entity* this) {
|
||||
gUnk_080CA590[this->action](this);
|
||||
if (this->field_0x80.HALF.HI)
|
||||
this->height.HALF.HI = gUnk_080CA5B8[(this->field_0xf++ & 0x30) >> 4];
|
||||
}
|
||||
|
||||
void sub_0801FFDC(Entity* this) {
|
||||
if (this->field_0x82.HALF.LO) {
|
||||
if (this->bitfield == 0x94) {
|
||||
Entity* ent = CreateEnemy(3, 1);
|
||||
if (ent) {
|
||||
CopyPosition(this, ent);
|
||||
ent->height.HALF.HI -= 8;
|
||||
}
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
this->animationState = 2;
|
||||
this->action = 5;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->hurtBlinkTime = -30;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
} else if (this->bitfield == 0x9b) {
|
||||
this->animationState = 1;
|
||||
this->action = 5;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->hurtBlinkTime = -30;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
} else if (this->bitfield == 0x80) {
|
||||
if (this->animationState == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 30;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->direction = -1;
|
||||
this->field_0x82.HALF.HI = 0x78;
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x43)
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
|
||||
sub_0804AA30(this, gUnk_080CA570);
|
||||
}
|
||||
|
||||
void sub_08020088(Entity* this) {
|
||||
if (2 >= this->previousActionFlag && !sub_0806F520(this))
|
||||
return;
|
||||
|
||||
gUnk_080CA5BC[this->previousActionFlag](this);
|
||||
}
|
||||
|
||||
void sub_080200B4(Entity* this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 60;
|
||||
if (this->animationState == 0) {
|
||||
this->animationState = 1;
|
||||
this->action = 5;
|
||||
this->damageType = 0x71;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080200E4(Entity* this) {
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_080200EC(Entity* this) {
|
||||
sub_0806F3E4(this);
|
||||
}
|
||||
|
||||
void sub_080200F4(Entity* this) {
|
||||
this->flags &= ~0x80;
|
||||
}
|
||||
|
||||
void nullsub_5(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08020104(Entity* this) {
|
||||
if (this->flags & 0x80) {
|
||||
this->flags |= 0x80;
|
||||
this->field_0x3a &= 0xfb;
|
||||
} else {
|
||||
this->currentHealth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020130(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->actionDelay = 16;
|
||||
this->field_0xf = Random();
|
||||
this->direction = Random() & 0x1f;
|
||||
this->field_0x1c = 18;
|
||||
this->field_0x80.HALF.LO = (Random() & 1) ? 2 : -2;
|
||||
this->field_0x80.HALF.HI = 1;
|
||||
this->field_0x82.HALF.LO = 1;
|
||||
this->animationState = 0;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void sub_08020180(Entity* this) {
|
||||
if (this->field_0x82.HALF.HI)
|
||||
this->field_0x82.HALF.HI--;
|
||||
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if (this->field_0x82.HALF.HI == 0 && (this->field_0xf & 0xf) == 0 && sub_08049F1C(this, gUnk_020000B0, 0x30)) {
|
||||
this->action = 2;
|
||||
this->previousActionFlag = Random() & 3;
|
||||
this->actionDelay = 60;
|
||||
this->nonPlanarMovement = 160;
|
||||
}
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 16;
|
||||
sub_08020604(this);
|
||||
if ((Random() & 3) == 0) {
|
||||
this->field_0x80.HALF.LO = (Random() & 1) ? 2 : -2;
|
||||
}
|
||||
}
|
||||
|
||||
sub_080AEFE0(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_08020220(Entity* this) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if (--this->actionDelay) {
|
||||
UpdateAnimationVariableFrames(this, 4 - ((this->actionDelay >> 4) & 0x3));
|
||||
return;
|
||||
} else {
|
||||
this->action = 3;
|
||||
this->actionDelay = 120;
|
||||
this->nonPlanarMovement = 192;
|
||||
this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f;
|
||||
}
|
||||
} else {
|
||||
sub_080205F8(this);
|
||||
}
|
||||
|
||||
UpdateAnimationVariableFrames(this, 4);
|
||||
}
|
||||
|
||||
void sub_08020294(Entity* this) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_080205F8(this);
|
||||
}
|
||||
if (60 < this->actionDelay) {
|
||||
if (this->actionDelay & 1)
|
||||
this->nonPlanarMovement += 4;
|
||||
|
||||
if ((gScreenTransition.frameCount & 3) == 0)
|
||||
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||
}
|
||||
sub_080AEFE0(this);
|
||||
} else {
|
||||
sub_080205F8(this);
|
||||
}
|
||||
UpdateAnimationVariableFrames(this, 4);
|
||||
}
|
||||
|
||||
void sub_08020308(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
this->nonPlanarMovement = 128;
|
||||
this->field_0x82.HALF.HI = 120;
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
if (this->actionDelay & 1)
|
||||
this->nonPlanarMovement -= 8;
|
||||
|
||||
sub_080AEFE0(this);
|
||||
UpdateAnimationVariableFrames(this, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020350(Entity* this) {
|
||||
if (this->animationState != 2) {
|
||||
if (sub_080044EC(this, 0x1800) == 0) {
|
||||
this->action = 6;
|
||||
this->actionDelay = -0x10;
|
||||
this->field_0xf = 10;
|
||||
this->damageType = 113;
|
||||
}
|
||||
|
||||
if (this->direction == 0xff)
|
||||
this->direction = this->field_0x3e;
|
||||
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
sub_08003FC4(this, 0x1c00);
|
||||
if (this->height.HALF.HI == 0) {
|
||||
this->action = 7;
|
||||
this->actionDelay = -106;
|
||||
this->field_0xf = 10;
|
||||
this->damageType = 113;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080203C0(Entity* this) {
|
||||
if (this->field_0xf)
|
||||
if (--this->field_0xf == 0)
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
|
||||
if (!sub_0800442E(this) && --this->actionDelay)
|
||||
return;
|
||||
|
||||
this->action = 9;
|
||||
this->field_0x20 = 0x18000;
|
||||
this->direction = Random() & 0x1f;
|
||||
sub_0804AA1C(this);
|
||||
this->animationState = 5;
|
||||
InitializeAnimation(this, 5);
|
||||
}
|
||||
|
||||
void sub_0802041C(Entity* this) {
|
||||
if (this->field_0xf)
|
||||
if (--this->field_0xf == 0)
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
|
||||
if (!sub_0800442E(this) && --this->actionDelay)
|
||||
return;
|
||||
|
||||
this->action = 8;
|
||||
this->actionDelay = -16;
|
||||
this->direction = Random() & 0x1f;
|
||||
sub_0804AA1C(this);
|
||||
}
|
||||
|
||||
void sub_08020468(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 9;
|
||||
this->field_0x20 = 0x18000;
|
||||
this->animationState = 4;
|
||||
InitializeAnimation(this, 4);
|
||||
} else {
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->frames.all & 2) {
|
||||
this->frames.all &= 0xfd;
|
||||
this->direction = Random() & 0x1f;
|
||||
}
|
||||
|
||||
if (this->frames.all & 1) {
|
||||
sub_0800442E(this);
|
||||
} else {
|
||||
sub_080AEF88(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080204E0(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 1;
|
||||
this->damageType = 0x70;
|
||||
this->field_0x82.HALF.LO = 1;
|
||||
this->field_0x80.HALF.HI = 1;
|
||||
this->animationState = 0;
|
||||
InitializeAnimation(this, 0);
|
||||
} else {
|
||||
if (this->frames.all & 1) {
|
||||
sub_0800442E(this);
|
||||
} else {
|
||||
sub_08003FC4(this, 0x1c00);
|
||||
sub_080AEF88(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802053C(Entity* this) {
|
||||
this->action = 1;
|
||||
this->actionDelay = -16;
|
||||
this->field_0xf = 40;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->spriteSettings.b.shadow = 0;
|
||||
this->nonPlanarMovement = 0x20;
|
||||
this->direction = (Random() & 0x10) + 8;
|
||||
InitializeAnimation(this, 3);
|
||||
}
|
||||
|
||||
void sub_08020590(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (--this->actionDelay == '\0') {
|
||||
DeleteEntity(this);
|
||||
} else {
|
||||
if (this->actionDelay < 60)
|
||||
this->spriteSettings.b.draw ^= 1;
|
||||
|
||||
this->height.WORD -= 0xc000;
|
||||
sub_0806F69C(this);
|
||||
if (--this->field_0xf == 0) {
|
||||
this->field_0xf = 40;
|
||||
this->direction = (Random() & 0x10) + 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080205F8(Entity* this) {
|
||||
this->action = 4;
|
||||
this->actionDelay = 60;
|
||||
}
|
||||
|
||||
void sub_08020604(Entity *this){
|
||||
if (!sub_08049FA0(this) && (Random() & 3)) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
} else {
|
||||
this->direction += this->field_0x80.HALF.LO;
|
||||
this->direction &= 0x1f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CA570[])(Entity*) = {
|
||||
sub_0801FF9C,
|
||||
sub_0801FFDC,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
sub_08020088,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA588[])(Entity*) = {
|
||||
sub_0802053C,
|
||||
sub_08020590,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA590[])(Entity*) = {
|
||||
sub_08020130,
|
||||
sub_08020180,
|
||||
sub_08020220,
|
||||
sub_08020294,
|
||||
sub_08020308,
|
||||
sub_08020350,
|
||||
sub_080203C0,
|
||||
sub_0802041C,
|
||||
sub_08020468,
|
||||
sub_080204E0,
|
||||
};
|
||||
|
||||
const s8 gUnk_080CA5B8[] = {
|
||||
-5,
|
||||
-6,
|
||||
-7,
|
||||
-6,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA5BC[])(Entity*) = {
|
||||
sub_080200B4,
|
||||
sub_080200E4,
|
||||
sub_080200EC,
|
||||
sub_080200F4,
|
||||
nullsub_5,
|
||||
sub_08020104,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0804A4E4(Entity*, Entity*);
|
||||
|
||||
extern void (*const gUnk_080CB948[])(Entity*);
|
||||
extern void (*const gUnk_080CB960[])(Entity*);
|
||||
|
||||
void RockChuchu(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CB948);
|
||||
}
|
||||
|
||||
void sub_0802223C(Entity* this) {
|
||||
gUnk_080CB960[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08022254(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
if (this->currentHealth) {
|
||||
switch (this->bitfield & 0x7f) {
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 0xb:
|
||||
case 0xc:
|
||||
case 0xd:
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
case 0x12:
|
||||
case 0x18:
|
||||
case 0x19:
|
||||
case 0x1a:
|
||||
if ((gPlayerState.field_0xac & 8) == 0)
|
||||
break;
|
||||
case 0x16:
|
||||
case 0x1c:
|
||||
CreateFx(this, 4, 0);
|
||||
ent = CreateEnemy(1, 1);
|
||||
if (ent) {
|
||||
ent->entityType.parameter = 1;
|
||||
ent->hurtBlinkTime = -8;
|
||||
sub_0804A4E4(this, ent);
|
||||
this->action = 2;
|
||||
this->flags &= ~0x80;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->direction = this->field_0x3e;
|
||||
this->attachedEntity = ent;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this->damageType != 0x94)
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
|
||||
sub_0804AA30(this, gUnk_080CB948);
|
||||
}
|
||||
|
||||
void nullsub_131(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08022368(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->actionDelay = Random();
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void sub_08022390(Entity* this) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if ((this->actionDelay++ & 0xf) == 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
this->field_0xf = Random() & 4;
|
||||
}
|
||||
|
||||
if (this->field_0xf == 0) {
|
||||
sub_080AEF88(this);
|
||||
} else {
|
||||
this->field_0xf = this->field_0xf - 1;
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = Random();
|
||||
}
|
||||
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_080223E4(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
ent = this->attachedEntity;
|
||||
if (ent) {
|
||||
ent->bitfield = 0x94;
|
||||
ent->hurtBlinkTime = 0x10;
|
||||
ent->field_0x42 = 0xc;
|
||||
ent->field_0x3e = this->direction;
|
||||
}
|
||||
|
||||
DeleteEntity(this);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CB948[])(Entity*) = {
|
||||
sub_0802223C,
|
||||
sub_08022254,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
nullsub_131,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CB960[])(Entity*) = {
|
||||
sub_08022368,
|
||||
sub_08022390,
|
||||
sub_080223E4,
|
||||
};
|
||||
// clang-format on
|
||||
@@ -0,0 +1,324 @@
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080CA66C[])(Entity*);
|
||||
extern void (*const gUnk_080CA684[])(Entity*);
|
||||
extern void (*const gUnk_080CA6A4[])(Entity*);
|
||||
extern void (*const gUnk_080CA6BC[])(Entity*);
|
||||
|
||||
extern const u8 gUnk_080CA6CC[];
|
||||
extern const s8 gUnk_080CA6D4[];
|
||||
|
||||
void sub_08020A30(Entity*);
|
||||
void sub_08020A7C(Entity*);
|
||||
u32 sub_08020AD0(Entity*);
|
||||
u32 sub_08020B6C(Entity*);
|
||||
|
||||
extern void sub_080AE58C();
|
||||
extern void sub_080AE7E8();
|
||||
extern void sub_08078930();
|
||||
|
||||
void Rollobite(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CA66C);
|
||||
}
|
||||
|
||||
void sub_08020648(Entity* this) {
|
||||
sub_08020AD0(this);
|
||||
gUnk_080CA684[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08020668(Entity* this) {
|
||||
if (this->damageType == 34 && this->currentHealth != 0xff) {
|
||||
this->action = 4;
|
||||
this->field_0x20 = 0x20000;
|
||||
this->direction = -1;
|
||||
this->currentHealth = -1;
|
||||
this->damageType = 35;
|
||||
InitializeAnimation(this, this->animationState + 8);
|
||||
}
|
||||
|
||||
if (this->bitfield != 0x80) {
|
||||
u8 tmp = this->action - 4;
|
||||
if (tmp < 2) {
|
||||
this->action = 4;
|
||||
this->actionDelay = -76;
|
||||
this->direction = -1;
|
||||
InitializeAnimation(this, this->animationState + 0x10);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->bitfield == 0x93)
|
||||
sub_08020648(this);
|
||||
}
|
||||
|
||||
void sub_080206E0(Entity* this) {
|
||||
if (sub_08020AD0(this)) {
|
||||
this->field_0x42 = 0;
|
||||
} else {
|
||||
if (sub_08020B6C(this)) {
|
||||
this->field_0x42--;
|
||||
sub_080AE58C(this, this->field_0x3e, 10);
|
||||
sub_080AE7E8(this, this->field_0x46, this->field_0x3e, 10);
|
||||
} else {
|
||||
sub_08001324(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020734(Entity* this) {
|
||||
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
|
||||
this->action = 4;
|
||||
this->flags |= 0x80;
|
||||
this->direction = -1;
|
||||
InitializeAnimation(this, this->animationState + 0x10);
|
||||
} else {
|
||||
gUnk_080CA6A4[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802077C(Entity* this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 60;
|
||||
}
|
||||
|
||||
void sub_08020788(Entity* this) {
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_08020790(Entity* this) {
|
||||
sub_0806F3E4(this);
|
||||
}
|
||||
|
||||
void sub_08020798(Entity* this) {
|
||||
this->flags &= ~0x80;
|
||||
}
|
||||
|
||||
void nullsub_6(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080207A8(Entity* this) {
|
||||
this->action = 4;
|
||||
this->flags |= 0x80;
|
||||
this->spritePriority.b0 = 4;
|
||||
this->field_0x3a &= 0xfb;
|
||||
this->direction ^= 0x10;
|
||||
this->field_0x20 = 0x18000;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
InitializeAnimation(this, this->animationState + 0x10);
|
||||
}
|
||||
|
||||
void sub_080207F4(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->field_0x16 = 0x30;
|
||||
this->field_0x1c = 18;
|
||||
this->cutsceneBeh.HALF.LO = 0;
|
||||
this->direction = Random() & 0x18;
|
||||
sub_08020A30(this);
|
||||
}
|
||||
|
||||
void sub_08020820(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x1) {
|
||||
this->frames.all &= ~0x1;
|
||||
if (!sub_080AEF88(this))
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x10) {
|
||||
this->frames.all &= ~0x10;
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08020874(Entity* this) {
|
||||
gUnk_080CA6BC[this->previousActionFlag](this);
|
||||
}
|
||||
|
||||
void sub_0802088C(Entity* this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->flags &= ~0x80;
|
||||
this->cutsceneBeh.HALF.HI = gPlayerEntity.animationState;
|
||||
this->spritePriority.b1 = 0;
|
||||
}
|
||||
|
||||
void sub_080208B4(Entity* this) {
|
||||
s8 uVar1 = (this->cutsceneBeh.HALF.HI - gPlayerEntity.animationState) / 2;
|
||||
if (uVar1) {
|
||||
this->animationState = (this->animationState + uVar1) & 3;
|
||||
InitializeAnimation(this, this->animationState + 0x10);
|
||||
}
|
||||
this->cutsceneBeh.HALF.HI = gPlayerEntity.animationState;
|
||||
}
|
||||
|
||||
void sub_080208F0(Entity* this) {
|
||||
this->spritePriority.b1 = 3;
|
||||
}
|
||||
|
||||
void sub_08020904(Entity* this) {
|
||||
this->action = 4;
|
||||
this->flags |= 0x80;
|
||||
this->direction = -1;
|
||||
InitializeAnimation(this, this->animationState + 0x10);
|
||||
}
|
||||
|
||||
void sub_08020920(Entity* this) {
|
||||
if (--this->actionDelay == 0)
|
||||
sub_08020A30(this);
|
||||
}
|
||||
|
||||
void sub_08020938(Entity* this) {
|
||||
u32 unk;
|
||||
|
||||
if ((this->frames.all & 0x80) == 0)
|
||||
GetNextFrame(this);
|
||||
|
||||
unk = sub_080044EC(this, 0x2800);
|
||||
|
||||
if (unk == 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 5;
|
||||
InitializeAnimation(this, this->animationState + 12);
|
||||
}
|
||||
sub_08078930(this);
|
||||
} else {
|
||||
if (unk == 1)
|
||||
sub_08004488(260);
|
||||
|
||||
if ((this->direction & 0x80) == 0)
|
||||
sub_080AEFE0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080209A0(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->flags |= 0x80;
|
||||
this->nonPlanarMovement = 0x100;
|
||||
this->damageType = 34;
|
||||
sub_08020A30(this);
|
||||
this->direction = this->animationState << 3;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
} else {
|
||||
if ((this->frames.all & 1) == 0)
|
||||
sub_08078930(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080209F4(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x1c00) == 0) {
|
||||
this->action = 7;
|
||||
this->spritePriority.b0 = 7;
|
||||
}
|
||||
|
||||
if (this->frames.all == 0)
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_08020A28(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_08020A30(Entity* this) {
|
||||
if (this->cutsceneBeh.HALF.LO < 2) {
|
||||
this->actionDelay = gUnk_080CA6CC[Random() & 7];
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 60;
|
||||
this->cutsceneBeh.HALF.LO++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this->action = 1;
|
||||
this->cutsceneBeh.HALF.LO = 0;
|
||||
sub_08020A7C(this);
|
||||
}
|
||||
|
||||
void sub_08020A7C(Entity* this) {
|
||||
int tmp = Random();
|
||||
u32 state = (this->direction + gUnk_080CA6D4[tmp % 3]) & 0x18;
|
||||
|
||||
if (sub_08049FA0(this) == 0) {
|
||||
int tmp = (sub_08049EE4(this) + 4) & 0x18;
|
||||
if ((state ^ 0x10) == tmp)
|
||||
state ^= 0x10;
|
||||
}
|
||||
|
||||
this->direction = state;
|
||||
this->animationState = (u8)(state >> 3);
|
||||
InitializeAnimation(this, this->animationState);
|
||||
}
|
||||
|
||||
u32 sub_08020AD0(Entity* this) {
|
||||
if (sub_08020B6C(this) && this->height.HALF.HI == 0) {
|
||||
int tile = COORD_TO_TILE(this);
|
||||
int iVar1 = GetTileType(tile, this->collisionLayer);
|
||||
if ((iVar1 * 0x10000 - 0x710000U) >> 0x10 < 2) {
|
||||
this->action = 6;
|
||||
this->flags &= ~0x80;
|
||||
this->x.HALF.HI &= 0xfff0;
|
||||
this->x.HALF.HI += 8;
|
||||
this->y.HALF.HI &= 0xfff0;
|
||||
this->y.HALF.HI += 13;
|
||||
this->field_0x20 = 0x20000;
|
||||
InitializeAnimation(this, this->animationState + 0x14);
|
||||
SetTile(0x4034, tile, this->collisionLayer);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_08020B6C(Entity* this) {
|
||||
u32 tmp = this->animIndex - 0x10;
|
||||
if (tmp < 4) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CA66C[])(Entity*) = {
|
||||
sub_08020648,
|
||||
sub_08020668,
|
||||
sub_080206E0,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
sub_08020734,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA684[])(Entity*) = {
|
||||
sub_080207F4,
|
||||
sub_08020820,
|
||||
sub_08020874,
|
||||
sub_08020920,
|
||||
sub_08020938,
|
||||
sub_080209A0,
|
||||
sub_080209F4,
|
||||
sub_08020A28,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA6A4[])(Entity*) = {
|
||||
sub_0802077C,
|
||||
sub_08020788,
|
||||
sub_08020790,
|
||||
sub_08020798,
|
||||
nullsub_6,
|
||||
sub_080207A8,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CA6BC[])(Entity*) = {
|
||||
sub_0802088C,
|
||||
sub_080208B4,
|
||||
sub_080208F0,
|
||||
sub_08020904,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CA6CC[] = {
|
||||
0,6,9,0,6,6,0,7
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -262,7 +262,7 @@ void sub_08029770(Entity* this) {
|
||||
InitializeAnimation(this, 2);
|
||||
this->attachedEntity->spriteSettings.b.draw = TRUE;
|
||||
InitializeAnimation(this->attachedEntity, 6);
|
||||
sub_080A29BC(this);
|
||||
CreateDust(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ typedef struct {
|
||||
void sub_08044FF8(Entity*);
|
||||
void sub_08045178(Entity*, Entity*, int, int);
|
||||
|
||||
extern void sub_0804A9FC(Entity*, u32);
|
||||
extern void sub_0804A720(Entity*);
|
||||
extern u32 sub_0806FA04(u32, u32);
|
||||
extern u32 sub_08049FA0(Entity*);
|
||||
|
||||
@@ -0,0 +1,285 @@
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08001318(Entity*);
|
||||
extern u32 sub_08049F64(Entity*, u32, u32);
|
||||
extern void sub_0804A4E4(Entity*, Entity*);
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
|
||||
u32 sub_080228CC(Entity*);
|
||||
u32 sub_080228F0(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CBA28[])(Entity*);
|
||||
extern void (*const gUnk_080CBA40[])(Entity*);
|
||||
|
||||
extern const u8 gUnk_080CBA60[];
|
||||
|
||||
extern BoundingBox gUnk_080FD468;
|
||||
extern BoundingBox gUnk_080FD470;
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
|
||||
void SpinyChuchu(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CBA28);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void sub_08022434(Entity* this) {
|
||||
gUnk_080CBA40[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0802244C(Entity* this) {
|
||||
if (this->currentHealth) {
|
||||
if (this->damageType == 0x65) {
|
||||
switch (this->bitfield & 0x7f) {
|
||||
case 2:
|
||||
case 3:
|
||||
this->action = 2;
|
||||
this->field_0xf = 0x3c;
|
||||
this->damageType = 0x5c;
|
||||
this->boundingBox = &gUnk_080FD468;
|
||||
InitializeAnimation(this, 0);
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 0xb:
|
||||
case 0xc:
|
||||
case 0x16:
|
||||
case 0x18:
|
||||
case 0x19:
|
||||
case 0x1a:
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
this->action = 5;
|
||||
this->damageType = 0x5c;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
} else if (this->bitfield == 0x94) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
this->action = 5;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
|
||||
if (this->field_0x80.HALF.LO != this->currentHealth) {
|
||||
this->action = 5;
|
||||
this->damageType = 0x5c;
|
||||
InitializeAnimation(this, 1);
|
||||
} else {
|
||||
if (this->action == 3) {
|
||||
this->action = 4;
|
||||
InitializeAnimation(this, 3);
|
||||
sub_08004488(0x194);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
|
||||
this->field_0x80.HALF.LO = this->currentHealth;
|
||||
sub_0804AA30(this, gUnk_080CBA28);
|
||||
}
|
||||
|
||||
void sub_080225A0(Entity* this) {
|
||||
if (this->animIndex == 1)
|
||||
GetNextFrame(this);
|
||||
sub_08001318(this);
|
||||
}
|
||||
|
||||
void sub_080225BC(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
if (this->frames.all & 1) {
|
||||
sub_0804A7D4(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_9(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080225EC(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->field_0x80.HALF.LO = this->currentHealth;
|
||||
this->field_0x80.HALF.HI = 0x5a;
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 0);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->field_0xf = 0x3c;
|
||||
this->spriteSettings.b.draw = 3;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->height.HALF.HI = -0x80;
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022654(Entity* this) {
|
||||
switch (this->previousActionFlag) {
|
||||
case 0:
|
||||
if (--this->field_0xf)
|
||||
return;
|
||||
this->previousActionFlag = 1;
|
||||
PlaySFX(0x12d);
|
||||
InitializeAnimation(this, 0);
|
||||
/* fallthrough */
|
||||
case 1:
|
||||
if (sub_08003FC4(this, 0x1800))
|
||||
return;
|
||||
|
||||
this->previousActionFlag = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitializeAnimation(this, 5);
|
||||
sub_08004488(0x7d);
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
/* fallthrough */
|
||||
case 2:
|
||||
GetNextFrame(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->damageType = 0x65;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080226EC(Entity* this) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if (sub_080228CC(this)) {
|
||||
this->action = 3;
|
||||
this->damageType = 0x65;
|
||||
InitializeAnimation(this, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sub_080228F0(this)) {
|
||||
this->action = 6;
|
||||
this->field_0x20 = 0x12000;
|
||||
this->nonPlanarMovement = 0x140;
|
||||
this->direction = GetFacingDirection(this, gUnk_020000B0);
|
||||
this->damageType = 0x5a;
|
||||
InitializeAnimation(this, 4);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((this->actionDelay++ & 7) == 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
}
|
||||
|
||||
sub_080AEF88(this);
|
||||
}
|
||||
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_08022780(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 4;
|
||||
InitializeAnimation(this, 3);
|
||||
sub_08004488(0x194);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080227AC(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
this->boundingBox = &gUnk_080FD470;
|
||||
} else {
|
||||
this->boundingBox = &gUnk_080FD468;
|
||||
}
|
||||
|
||||
if (this->frames.all & 2) {
|
||||
this->frames.all &= ~2;
|
||||
this->damageType = 0x5c;
|
||||
}
|
||||
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 2;
|
||||
this->field_0xf = gUnk_080CBA60[Random() & 3];
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802281C(Entity* this) {
|
||||
sub_08003FC4(this, 0x1800);
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 2;
|
||||
this->nonPlanarMovement = 0x20;
|
||||
InitializeAnimation(this, 0);
|
||||
sub_0804AA1C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08022854(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
sub_080AEFE0(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
this->action = 7;
|
||||
this->damageType = 0x5c;
|
||||
InitializeAnimation(this, 5);
|
||||
sub_08004488(0x7d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802289C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 2;
|
||||
this->nonPlanarMovement = 0x20;
|
||||
this->field_0x80.HALF.HI = 0x78;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_080228CC(Entity* this) {
|
||||
if (this->field_0xf == 0) {
|
||||
if (sub_08049F64(this, 1, 0x28))
|
||||
return 1;
|
||||
} else {
|
||||
this->field_0xf--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_080228F0(Entity* this) {
|
||||
if (this->field_0x80.HALF.HI == 0) {
|
||||
if (sub_08049F64(this, 1, 0x40))
|
||||
return 1;
|
||||
} else {
|
||||
this->field_0x80.HALF.HI--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void (*const gUnk_080CBA28[])(Entity*) = {
|
||||
sub_08022434,
|
||||
sub_0802244C,
|
||||
sub_080225A0,
|
||||
sub_080225BC,
|
||||
sub_08001242,
|
||||
nullsub_9,
|
||||
};
|
||||
|
||||
void (*const gUnk_080CBA40[])(Entity*) = {
|
||||
sub_080225EC,
|
||||
sub_08022654,
|
||||
sub_080226EC,
|
||||
sub_08022780,
|
||||
sub_080227AC,
|
||||
sub_0802281C,
|
||||
sub_08022854,
|
||||
sub_0802289C,
|
||||
};
|
||||
|
||||
const u8 gUnk_080CBA60[] = {
|
||||
10, 20, 30, 20,
|
||||
};
|
||||
// clang-format on
|
||||
+1
-1
@@ -56,7 +56,7 @@ void nullsub_16(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802F1F0(Entity* this) {
|
||||
sub_08001242();
|
||||
sub_08001242(this);
|
||||
if (this->height.HALF.HI != 0) {
|
||||
sub_08003FC4(this, this->field_0x80.HWORD);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void sub_08037F58(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08037F84(Entity* this) {
|
||||
sub_08001242();
|
||||
sub_08001242(this);
|
||||
if (this->height.HALF.HI != 0) {
|
||||
sub_08003FC4(this, 0x3000);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,503 @@
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "screen.h"
|
||||
|
||||
typedef struct {
|
||||
s8 h, v;
|
||||
} PACKED PosOffset;
|
||||
|
||||
extern void (*const gUnk_080D1604[])(Entity*);
|
||||
extern PosOffset gUnk_080D1620[4];
|
||||
|
||||
extern void sub_08044E74(Entity*, u32);
|
||||
|
||||
void VaatiBall(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
parent = this->parent;
|
||||
if (this->action && this->action != 3) {
|
||||
this->x.WORD += parent->x.WORD - *(int*)&parent->field_0x78;
|
||||
this->y.WORD += parent->y.WORD - parent->field_0x7c.WORD;
|
||||
}
|
||||
|
||||
gUnk_080D1604[this->action](this);
|
||||
|
||||
if (this->cutsceneBeh.HALF.LO) {
|
||||
this->currentHealth = -1;
|
||||
}
|
||||
|
||||
if (this->bitfield & 0x80) {
|
||||
if ((this->bitfield & 0x3f) == 0 && this->action == 6) {
|
||||
ModHealth(-2);
|
||||
}
|
||||
|
||||
if (this->currentHealth < 0xfd) {
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->flags &= 0x7f;
|
||||
this->currentHealth = -1;
|
||||
parent->field_0x80.HALF.LO--;
|
||||
CreateDust(this);
|
||||
PlaySFX(0x1c3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804468C(Entity* this) {
|
||||
PosOffset* off;
|
||||
|
||||
this->collisionLayer = 3;
|
||||
this->spriteRendering.b3 = 2;
|
||||
this->spritePriority.b0 = 5;
|
||||
this->cutsceneBeh.HALF.LO = 0;
|
||||
switch (this->entityType.form) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
this->direction = (this->field_0x78.HALF.HI * 8) & 0x1f;
|
||||
this->field_0x78.HALF.LO = 0;
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
off = &gUnk_080D1620[this->field_0x78.HALF.HI & 3];
|
||||
PositionRelative(this->parent, this, off->h << 0x10, (off->v - 0x10) * 0x10000);
|
||||
this->height.HALF.HI = this->parent->height.HALF.HI;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
break;
|
||||
case 1:
|
||||
this->action = 3;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->field_0x82.HALF.HI = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804474C(Entity* this) {
|
||||
switch (this->parent->action) {
|
||||
case 3:
|
||||
this->action = 3;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 0;
|
||||
break;
|
||||
case 5:
|
||||
this->action = 5;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->field_0xf = 1;
|
||||
break;
|
||||
case 6:
|
||||
this->action = 6;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->field_0xf = 32;
|
||||
break;
|
||||
case 2:
|
||||
this->action = 2;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->damageType = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->action != 1) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
} else {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 2;
|
||||
this->direction++;
|
||||
this->direction &= 0x1f;
|
||||
}
|
||||
sub_0806F69C(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080447E0(Entity* this) {
|
||||
Entity* vaati = this->parent;
|
||||
|
||||
if (vaati->action == 1) {
|
||||
this->action = 1;
|
||||
this->damageType = 43;
|
||||
sub_08044E74(this, 0);
|
||||
if (this->flags & 0x80)
|
||||
this->spriteSettings.b.draw = 1;
|
||||
} else {
|
||||
this->field_0x76.HALF.HI++;
|
||||
this->field_0x76.HALF.HI &= 7;
|
||||
if (this->flags & 0x80) {
|
||||
if (this->field_0x76.HALF.HI & 1) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
} else {
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (vaati->field_0x74.HALF.LO == 2) {
|
||||
sub_08044E74(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern u32 sub_080045B4();
|
||||
extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
|
||||
extern void sub_08044DEC();
|
||||
|
||||
void sub_08044868(Entity* this) {
|
||||
Entity* vaati = this->parent;
|
||||
|
||||
switch (vaati->field_0x74.HALF.LO) {
|
||||
case 0xfe:
|
||||
if (this->field_0x82.HALF.HI && this->field_0x74.HALF.LO == 2)
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
case 0xff:
|
||||
if (this->field_0x82.HALF.HI) {
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (this->frames.all & 0x80) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
|
||||
this->nonPlanarMovement = 0x180;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
sub_0806F69C(this);
|
||||
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
this->x.HALF.HI = vaati->x.HALF.HI;
|
||||
this->y.HALF.HI = vaati->y.HALF.HI - 0x10;
|
||||
vaati->actionDelay++;
|
||||
} else {
|
||||
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->field_0x82.HALF.HI == 0) {
|
||||
this->field_0x82.HALF.HI++;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
}
|
||||
sub_08044DEC(this);
|
||||
if (*(u8*)&vaati->field_0x86 > 1) {
|
||||
u8 draw = this->spriteSettings.b.draw;
|
||||
if (draw == 1 && this->cutsceneBeh.HALF.LO == 0) {
|
||||
vaati = sub_0804A98C(this, 0x18, 0);
|
||||
if (vaati) {
|
||||
vaati->entityType.parameter = 1;
|
||||
vaati->parent = this;
|
||||
this->cutsceneBeh.HALF.LO = 1;
|
||||
this->damageType = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
this->actionDelay = 32;
|
||||
break;
|
||||
case 2:
|
||||
if (this->actionDelay)
|
||||
if (--this->actionDelay < 0x11)
|
||||
sub_0806F69C(this);
|
||||
break;
|
||||
case 3: {
|
||||
u8 draw;
|
||||
|
||||
sub_08044E74(this, 1);
|
||||
draw = this->spriteSettings.b.draw;
|
||||
if (draw == 1) {
|
||||
this->flags |= 0x80;
|
||||
} else {
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_080449F8(Entity* this) {
|
||||
Entity* vaati = this->parent;
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (vaati->action == 1) {
|
||||
sub_08044E74(this, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (vaati->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
sub_0806F69C(this);
|
||||
if (--this->actionDelay)
|
||||
break;
|
||||
|
||||
if (this->field_0x78.HALF.LO == 0) {
|
||||
this->field_0x78.HALF.LO++;
|
||||
this->nonPlanarMovement = 640;
|
||||
}
|
||||
|
||||
this->actionDelay = 4;
|
||||
this->direction++;
|
||||
this->direction &= 0x1f;
|
||||
if (vaati->field_0x80.HALF.LO == 0)
|
||||
vaati->field_0x74.HALF.LO = 1;
|
||||
break;
|
||||
case 1:
|
||||
switch (this->actionDelay) {
|
||||
case 2:
|
||||
if (vaati->field_0x80.HALF.LO == 0) {
|
||||
this->field_0xf = 0;
|
||||
sub_08044E74(this, 0);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
sub_0806F69C(this);
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
this->actionDelay = 2;
|
||||
break;
|
||||
case 3:
|
||||
sub_0806F69C(this);
|
||||
this->actionDelay = 2;
|
||||
break;
|
||||
case 4:
|
||||
sub_0806F69C(this);
|
||||
sub_0806F69C(this);
|
||||
this->actionDelay = 2;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this->field_0x74.HALF.LO == 0) {
|
||||
u8 draw;
|
||||
|
||||
this->field_0x74.HALF.LO++;
|
||||
draw = this->spriteSettings.b.draw;
|
||||
if (draw) {
|
||||
vaati = sub_0804A98C(this, 0x1c, 0);
|
||||
if (vaati) {
|
||||
vaati->y.HALF.HI += 4;
|
||||
vaati->parent = this;
|
||||
this->attachedEntity = vaati;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (this->field_0xf) {
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08044B04(Entity* this) {
|
||||
Entity* vaati = this->parent;
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (vaati->action == 1) {
|
||||
sub_08044E74(this, 0);
|
||||
this->actionDelay = 32;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (vaati->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
sub_0806F69C(this);
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = this->field_0x78.HALF.LO ? 4 : 2;
|
||||
this->direction++;
|
||||
this->direction &= 0x1f;
|
||||
}
|
||||
if (--this->field_0xf == 0) {
|
||||
if (this->actionDelay != 2) {
|
||||
this->field_0xf = 1;
|
||||
} else {
|
||||
if (++this->field_0x78.HALF.LO > 2) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
this->field_0x78.HALF.LO = 1;
|
||||
this->actionDelay = 4;
|
||||
this->field_0xf = 0;
|
||||
} else {
|
||||
this->field_0xf = 32;
|
||||
}
|
||||
|
||||
this->nonPlanarMovement = this->field_0x78.HALF.LO ? 640 : 1280;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 6;
|
||||
this->direction = (this->direction + 1) & 0x1f;
|
||||
if (++this->field_0xf == 0x30) {
|
||||
u32 direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
|
||||
this->nonPlanarMovement = 0;
|
||||
this->direction = (direction + 16) & 0x1f;
|
||||
this->actionDelay = 16;
|
||||
this->field_0xf = 16;
|
||||
this->field_0x74.HALF.LO++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this->field_0xf == 0) {
|
||||
switch (--this->actionDelay) {
|
||||
case 12:
|
||||
this->nonPlanarMovement = 1280;
|
||||
break;
|
||||
case 0:
|
||||
this->field_0x74.HALF.LO++;
|
||||
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
|
||||
this->nonPlanarMovement = 0;
|
||||
this->actionDelay = 4;
|
||||
this->field_0xf = 16;
|
||||
break;
|
||||
case 4:
|
||||
this->nonPlanarMovement = 640;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (--this->field_0xf == 0)
|
||||
this->nonPlanarMovement = 640;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (this->field_0xf) {
|
||||
if (--this->field_0xf == 0)
|
||||
this->nonPlanarMovement = 640;
|
||||
} else {
|
||||
if (this->actionDelay) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->nonPlanarMovement = 1280;
|
||||
PlaySFX(0x14f);
|
||||
}
|
||||
}
|
||||
if (this->field_0x78.HALF.HI == 3)
|
||||
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc))
|
||||
vaati->actionDelay++;
|
||||
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 3:
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->actionDelay = 80;
|
||||
this->flags &= 0x7f;
|
||||
PositionRelative(vaati, this, 0, -0x100000);
|
||||
if (this->field_0xf)
|
||||
this->spriteSettings.b.draw = 0;
|
||||
break;
|
||||
case 1:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 32;
|
||||
this->field_0xf = 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
/* ... */
|
||||
break;
|
||||
case 3:
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (this->field_0xf) {
|
||||
if (--this->field_0xf == 0) {
|
||||
sub_08044DEC(this);
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->actionDelay = 16;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
sub_0806F69C(this);
|
||||
if (--this->actionDelay == 0)
|
||||
this->field_0x74.HALF.LO++;
|
||||
break;
|
||||
case 2: {
|
||||
u8 draw;
|
||||
|
||||
sub_08044E74(this, 1);
|
||||
draw = this->spriteSettings.b.draw;
|
||||
if (draw == 1) {
|
||||
this->flags |= 0x80;
|
||||
} else {
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
vaati->actionDelay++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
extern u8 gUnk_080D1628[4][4];
|
||||
|
||||
void sub_08044DEC(Entity* this) {
|
||||
u32 off;
|
||||
|
||||
if (this->parent->field_0x80.HALF.LO > this->field_0x78.HALF.HI) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->currentHealth = -1;
|
||||
} else {
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
this->flags &= 0x7f;
|
||||
this->field_0x78.HALF.LO = 0;
|
||||
this->nonPlanarMovement = 0x300;
|
||||
off = this->parent->field_0x80.HALF.LO - 1;
|
||||
this->direction = gUnk_080D1628[off][this->field_0x78.HALF.HI];
|
||||
PositionRelative(this->parent, this, 0, -0x100000);
|
||||
}
|
||||
|
||||
void sub_08044E74(Entity* this, u32 state) {
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
|
||||
switch (state) {
|
||||
case 2:
|
||||
this->action = 2;
|
||||
this->direction += 0x18;
|
||||
this->direction &= 0x1f;
|
||||
PositionRelative(this->parent, this, 0, -0x100000);
|
||||
this->nonPlanarMovement = 12288;
|
||||
sub_0806F69C(this);
|
||||
this->direction += 0x8;
|
||||
this->direction &= 0x1f;
|
||||
this->nonPlanarMovement = 1280;
|
||||
sub_0806F69C(this);
|
||||
break;
|
||||
case 1:
|
||||
this->direction = (this->direction + 8) & 0x1f;
|
||||
break;
|
||||
case 0:
|
||||
if (this->field_0x78.HALF.LO) {
|
||||
switch (this->actionDelay) {
|
||||
case 3 ... 4:
|
||||
do {
|
||||
sub_0806F69C(this);
|
||||
} while (this->actionDelay-- != 3);
|
||||
break;
|
||||
case 1:
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
sub_0806F69C(this);
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (this->actionDelay == 2) {
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
this->actionDelay = 1;
|
||||
this->field_0x78.HALF.LO = 0;
|
||||
this->nonPlanarMovement = 1280;
|
||||
}
|
||||
+1
-1
@@ -109,7 +109,7 @@ void sub_080336DC(Entity* this) {
|
||||
this->y.HALF.HI = this->field_0x82.HWORD;
|
||||
break;
|
||||
case 0x18:
|
||||
sub_080A29BC(this);
|
||||
CreateDust(this);
|
||||
break;
|
||||
case 0xc:
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
|
||||
+3
-3
@@ -193,16 +193,16 @@ void sub_0805E92C(u32 param_1) {
|
||||
}
|
||||
|
||||
extern Entity gUnk_020369F0;
|
||||
extern void sub_0801D66C(const void* src, void* dest, size_t size); // dma copy
|
||||
extern void _DmaCopy(const void* src, void* dest, size_t size); // dma copy
|
||||
extern void sub_0805E98C(void);
|
||||
|
||||
void sub_0805E958(void) {
|
||||
sub_0801D66C(&gEntityLists, &gUnk_020369F0, 0x48);
|
||||
_DmaCopy(&gEntityLists, &gUnk_020369F0, 0x48);
|
||||
sub_0805E98C();
|
||||
}
|
||||
|
||||
void sub_0805E974(void) {
|
||||
sub_0801D66C(&gUnk_020369F0, &gEntityLists, 0x48);
|
||||
_DmaCopy(&gUnk_020369F0, &gEntityLists, 0x48);
|
||||
}
|
||||
|
||||
void sub_0805E98C(void) {
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ extern void sub_0804FF84(u32);
|
||||
extern u16 gPaletteBuffer[];
|
||||
extern void VBlankInterruptWait(void);
|
||||
extern void DisableInterruptsAndDMA(void);
|
||||
extern void sub_0801D66C(void*, u8*, int);
|
||||
extern void _DmaCopy(void*, u8*, int);
|
||||
extern void sub_08016B34(void);
|
||||
|
||||
static void sub_08055F70(void);
|
||||
@@ -99,12 +99,12 @@ static void sub_08055F70(void) {
|
||||
_DmaZero(gUnk_02000030, size);
|
||||
size = (u32)gUnk_080B2CD8 - (u32)sub_080B197C;
|
||||
if (size != 0) {
|
||||
sub_0801D66C(sub_080B197C, gUnk_030056F0, size);
|
||||
_DmaCopy(sub_080B197C, gUnk_030056F0, size);
|
||||
}
|
||||
|
||||
size = (u32)gUnk_080B2CD8_2 - (u32)gUnk_080B2CD8_3;
|
||||
if (size != 0) {
|
||||
sub_0801D66C(gUnk_080B2CD8_3, gUnk_02038560, size);
|
||||
_DmaCopy(gUnk_080B2CD8_3, gUnk_02038560, size);
|
||||
}
|
||||
|
||||
sub_0801DA90(0);
|
||||
|
||||
@@ -0,0 +1,495 @@
|
||||
#include "global.h"
|
||||
#include "flags.h"
|
||||
#include "screen.h"
|
||||
#include "manager.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
Manager manager;
|
||||
u8 unk_20;
|
||||
u8 unk_21;
|
||||
u8 unk_22;
|
||||
u8 unk_23;//used
|
||||
u16 unk_24;
|
||||
u16 unk_26;
|
||||
void* unk_28;
|
||||
u16 unk_2c;
|
||||
u8 unk_2e[0x6];
|
||||
s16 unk_34;
|
||||
s16 unk_36;
|
||||
s16 unk_38;
|
||||
s16 unk_3a;
|
||||
u16 unk_3c;
|
||||
u16 unk_3e;//used
|
||||
} Manager15;
|
||||
|
||||
extern void (*const gUnk_081085D8[])(Manager*);
|
||||
|
||||
void sub_0805A280(Manager* this) {
|
||||
gUnk_081085D8[this->unk_0a](this);
|
||||
}
|
||||
|
||||
|
||||
void sub_0805A89C(Manager15*);
|
||||
void sub_0805A8EC(Manager15*);
|
||||
void sub_0805AAF0(u32);
|
||||
|
||||
void sub_0805A298(Manager15* this) {
|
||||
if (this->manager.action == 0) {
|
||||
sub_0805A89C(this);
|
||||
if (!CheckLocalFlag(this->unk_3e)) {
|
||||
this->unk_23 = 1;
|
||||
} else {
|
||||
this->unk_23 = 2;
|
||||
}
|
||||
sub_0805AAF0(this->unk_23);
|
||||
gScreen.lcd.displayControl |= 0x4800;
|
||||
}
|
||||
sub_0805A8EC(this);
|
||||
}
|
||||
|
||||
extern void (*const gUnk_081085F8[])(Manager15*);
|
||||
|
||||
void sub_0805A2E4(Manager15* this) {
|
||||
if (this->manager.action == 0) {
|
||||
sub_0805A89C(this);
|
||||
this->unk_23 = 1;
|
||||
sub_0805AAF0(1);
|
||||
if (!CheckLocalFlag(this->unk_3e)) {
|
||||
this->manager.action = 1;
|
||||
gScreen.lcd.displayControl &= 0xB7FF;
|
||||
} else {
|
||||
if (CheckLocalFlag(0x48)) {
|
||||
this->manager.action = 4;
|
||||
} else {
|
||||
this->manager.action = 3;
|
||||
}
|
||||
gScreen.lcd.displayControl |= 0x4800;
|
||||
}
|
||||
} else {
|
||||
gUnk_081085F8[this->manager.action](this);
|
||||
}
|
||||
if (this->manager.next) {
|
||||
sub_0805A8EC(this);
|
||||
}
|
||||
}
|
||||
|
||||
extern Entity gUnk_080E4C08;
|
||||
|
||||
void sub_0805A370(Manager15* this) {
|
||||
if (this->manager.unk_0d) {
|
||||
LoadRoomEntityList(&gUnk_080E4C08);
|
||||
this->manager.action = 3;
|
||||
PlaySFX(0x80100000);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A394(Manager15* this) {
|
||||
Entity* ent;
|
||||
if ((ent = FindEntityInListBySubtype(0x3,0x13,0x4))) {
|
||||
if (ent->entityType.form != 4) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
SetLocalFlag(0x48);
|
||||
ClearRoomFlag(0);
|
||||
gScreen.lcd.displayControl &= 0xB7FF;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void nullsub_496(Manager15* this) {
|
||||
}
|
||||
|
||||
extern void (*const gUnk_0810860C[])(Manager15*);
|
||||
|
||||
void sub_0805A3D4(Manager15* this) {
|
||||
if (this->manager.action == 0) {
|
||||
sub_0805A89C(this);
|
||||
if (this->manager.unk_0a == 3) {
|
||||
this->unk_23 = 2;
|
||||
} else {
|
||||
this->unk_23 = 1;
|
||||
}
|
||||
sub_0805AAF0(this->unk_23);
|
||||
if (!CheckLocalFlag(this->unk_3e)) {
|
||||
ClearFlag(this->unk_3c);
|
||||
this->manager.action = 1;
|
||||
gScreen.lcd.displayControl &= 0xB7FF;
|
||||
} else {
|
||||
SetFlag(this->unk_3c);
|
||||
this->manager.action = 3;
|
||||
gScreen.lcd.displayControl |= 0x4800;
|
||||
}
|
||||
} else {
|
||||
gUnk_0810860C[this->manager.action](this);
|
||||
}
|
||||
sub_0805A8EC(this);
|
||||
}
|
||||
|
||||
void sub_0805A4CC(Manager15*, u32);
|
||||
|
||||
void sub_0805A464(Manager15* this) {
|
||||
if (CheckLocalFlag(this->unk_3e)) {
|
||||
this->manager.action = 2;
|
||||
sub_0805A4CC(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A480(Manager15* this) {
|
||||
if (this->manager.unk_0d != 0) {
|
||||
this->manager.action = 3;
|
||||
SetFlag(this->unk_3c);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A498(Manager15* this) {
|
||||
if (!CheckLocalFlag(this->unk_3e)) {
|
||||
this->manager.action = 4;
|
||||
sub_0805A4CC(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A4B4(Manager15* this) {
|
||||
if (this->manager.unk_0d != 0) {
|
||||
this->manager.action = 1;
|
||||
ClearFlag(this->unk_3c);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A4CC(Manager15* this, u32 unk_0) {
|
||||
Entity* tmp;
|
||||
tmp = CreateObject(0x8e, unk_0, 0);
|
||||
if (tmp) {
|
||||
tmp->x.HALF.HI = this->unk_38 + gRoomControls.roomOriginX;
|
||||
tmp->y.HALF.HI = this->unk_3a + gRoomControls.roomOriginY - 0x30;
|
||||
tmp->parent = (Entity*) this;
|
||||
this->manager.unk_0d = 0;
|
||||
}
|
||||
}
|
||||
|
||||
extern void (*const gUnk_08108620[])(Manager15*);
|
||||
void sub_0805AA58(Manager15*);
|
||||
void sub_0805A9CC(Manager15*);
|
||||
|
||||
void sub_0805A500(Manager15* this) {
|
||||
if (this->manager.action == 0) {
|
||||
sub_0805A89C(this);
|
||||
this->unk_28 = 0;
|
||||
if (CheckLocalFlag(0x36)) {
|
||||
this->unk_23 = 3;
|
||||
this->manager.action = 5;
|
||||
gScreen.lcd.displayControl |= 0x4800;
|
||||
} else {
|
||||
if (CheckLocalFlag(0x34)) {
|
||||
this->unk_23 = 4;
|
||||
this->manager.action = 3;
|
||||
gScreen.lcd.displayControl |= 0x4800;
|
||||
} else {
|
||||
this->unk_23 = 4;
|
||||
this->manager.action = 1;
|
||||
gScreen.lcd.displayControl &= 0xB7FF;
|
||||
}
|
||||
}
|
||||
sub_0805AAF0(this->unk_23);
|
||||
} else {
|
||||
gUnk_08108620[this->manager.action](this);
|
||||
}
|
||||
sub_0805AA58(this);
|
||||
sub_0805A9CC(this);
|
||||
if (gRoomControls.unk2 == 1) {
|
||||
gScreen.lcd.displayControl |= 0x80<<7;
|
||||
this->manager.unk_0d = 1;
|
||||
return;
|
||||
}
|
||||
if (!this->manager.unk_0d) return;
|
||||
this->manager.unk_0d = 0;
|
||||
if (this->unk_20 == gRoomControls.roomID) return;
|
||||
gScreen.lcd.displayControl &= 0xB7FF;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_0805A5FC(Manager15* this) {
|
||||
if (CheckLocalFlag(0x34)) {
|
||||
this->manager.action = 2;
|
||||
sub_0805A4CC(this,2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A618(Manager15* this) {
|
||||
if (this->manager.unk_0d) {
|
||||
this->manager.action = 3;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A628(Manager15* this) {
|
||||
if (CheckLocalFlag(0x36)) {
|
||||
this->manager.action = 4;
|
||||
this->unk_23 = 3;
|
||||
sub_0805A4CC(this,3);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A64C(Manager15* this) {
|
||||
if (this->manager.unk_0d) {
|
||||
this->manager.action = 5;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A65C(Manager15* this) {}
|
||||
void sub_0805A660(Manager15* this) {}
|
||||
|
||||
extern void (*const gUnk_08108638[])(Manager15*);
|
||||
void sub_0805A68C(Manager15*);
|
||||
|
||||
void sub_0805A664(Manager15* this) {
|
||||
gUnk_08108638[this->manager.action](this);
|
||||
sub_0805A8EC(this);
|
||||
sub_0805A68C(this);
|
||||
}
|
||||
|
||||
extern u32 sub_0806FBFC(u32, u32, u32, u32);
|
||||
|
||||
void sub_0805A68C(Manager15* this) {
|
||||
if (sub_0806FBFC(this->unk_38 - 0x18, this->unk_3a - 0x18, 0x30, 0x30)) {
|
||||
if (this->unk_2c <= 0x1007) {
|
||||
gScreen.controls.alphaBlend = ++this->unk_2c;
|
||||
this->unk_22 = 0;
|
||||
}
|
||||
} else {
|
||||
if (this->unk_2c > 0x1000) {
|
||||
this->unk_2c--;
|
||||
}
|
||||
gScreen.controls.alphaBlend=this->unk_2c;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0805A73C(Manager15*);
|
||||
|
||||
void sub_0805A6E8(Manager15* this) {
|
||||
u16 tmp;
|
||||
sub_0805A89C(this);
|
||||
this->unk_23 = 0;
|
||||
sub_0805AAF0(0);
|
||||
this->unk_38 += gRoomControls.roomOriginX;
|
||||
this->unk_3a += gRoomControls.roomOriginY;
|
||||
if (!sub_0805A73C(this)) {
|
||||
this->manager.action++;
|
||||
}
|
||||
this->unk_2c = 0x1000;
|
||||
tmp = gScreen.lcd.displayControl | 0x4800;
|
||||
gScreen.lcd.displayControl = tmp;
|
||||
}
|
||||
|
||||
u32 sub_0805A73C(Manager15* this) {
|
||||
return sub_0806FBFC(this->unk_38 - 0x6, this->unk_3a - 0x6, 0xC, 0xC);
|
||||
}
|
||||
|
||||
void sub_0805A758(Manager15* this) {
|
||||
if (!sub_0805A73C(this)) {
|
||||
this->manager.action++;
|
||||
}
|
||||
}
|
||||
|
||||
extern u8 gUnk_02034490;
|
||||
extern void sub_0805E4E0(Manager*, u32);
|
||||
extern void sub_08077B20(void);
|
||||
|
||||
void sub_0805A76C(Manager15* this) {
|
||||
if ((gPlayerEntity.currentHealth != 0)
|
||||
&& (gPlayerEntity.height.HALF.HI == 0)
|
||||
&& (!gPlayerState.field_0x2c)
|
||||
) {
|
||||
switch (gPlayerState.field_0xa9) {
|
||||
case 1:
|
||||
case 0:
|
||||
if (sub_0805A73C(this)) {
|
||||
this->manager.action++;
|
||||
sub_08004168(&gPlayerEntity);
|
||||
gPlayerEntity.animationState = 4;
|
||||
sub_0805E4E0(&this->manager, 0x258);
|
||||
sub_08078A90(0xFF);
|
||||
gUnk_02034490 = 1;
|
||||
gRoomControls.cameraTarget = 0;
|
||||
sub_08077B20();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A7E4(Manager15* this) {
|
||||
if (gPlayerState.playerAction != 0x12) {
|
||||
gPlayerState.playerAction = 0x12;
|
||||
gPlayerState.field_0x38 = 0;
|
||||
gPlayerState.field_0x39 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A804(Manager15* this) {
|
||||
switch (this->manager.action) {
|
||||
case 0:
|
||||
if (CheckLocalFlag(this->unk_3e)) {
|
||||
this->manager.action = 1;
|
||||
} else {
|
||||
this->manager.action = 2;
|
||||
}
|
||||
this->manager.unk_0d = 1;
|
||||
this->manager.unk_10 |= 0x20;
|
||||
sub_0805E3A0(this, 6);
|
||||
break;
|
||||
case 1:
|
||||
if (CheckLocalFlag(this->unk_3e)) break;
|
||||
this->manager.action = 2;
|
||||
sub_0805A4CC(this,4);
|
||||
break;
|
||||
case 2:
|
||||
if (this->manager.unk_0d) {
|
||||
this->manager.action = 3;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (!CheckLocalFlag(this->unk_3e)) break;
|
||||
this->manager.action = 4;
|
||||
sub_0805A4CC(this,4);
|
||||
break;
|
||||
case 4:
|
||||
if (this->manager.unk_0d) {
|
||||
this->manager.action = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805AAC8(Manager15*);
|
||||
extern void sub_08052D74(void*, void*, void*);
|
||||
|
||||
void sub_0805A89C(Manager15* this) {
|
||||
sub_0805E3A0(this, 6);
|
||||
this->manager.action = 1;
|
||||
this->manager.unk_10 |= 0x20;
|
||||
this->manager.unk_0e = 8;
|
||||
this->manager.unk_0f = 0x10;
|
||||
this->unk_21 = 0;
|
||||
this->unk_22 = 0;
|
||||
this->unk_20 = gRoomControls.roomID;
|
||||
this->unk_24 = gRoomControls.roomOriginX;
|
||||
this->unk_26 = gRoomControls.roomOriginY;
|
||||
sub_08052D74(this, sub_0805AAC8, 0);
|
||||
}
|
||||
|
||||
void sub_0805A94C(Manager15* this);
|
||||
|
||||
void sub_0805A8EC(Manager15* this) {
|
||||
sub_0805AA58(this);
|
||||
sub_0805A94C(this);
|
||||
if (gRoomControls.unk2 == 1) {
|
||||
gScreen.lcd.displayControl |= 0x4000;
|
||||
this->manager.unk_0d = 1;
|
||||
} else {
|
||||
if (!this->manager.unk_0d) return;
|
||||
this->manager.unk_0d = 0;
|
||||
if (this->unk_20 == gRoomControls.roomID) return;
|
||||
gScreen.lcd.displayControl &= 0xB7FF;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805A94C(Manager15* this) {
|
||||
int tmp1, tmp2;
|
||||
gScreen.affine.bg3xOffset = gRoomControls.roomScrollX - this->unk_24 + this->unk_34;
|
||||
gScreen.affine.bg3yOffset = gRoomControls.roomScrollY - this->unk_26 + this->unk_36;
|
||||
tmp1 = -gScreen.affine.bg3xOffset;
|
||||
tmp2 = tmp1 + 0x100;
|
||||
if (tmp1 < 0) tmp1 = 0;
|
||||
if (tmp1 > 0xF0) tmp1 = 0xF0;
|
||||
if (tmp2 < 0) tmp2 = 0;
|
||||
if (tmp2 > 0xF0) tmp2 = 0xF0;
|
||||
gScreen.controls.window1HorizontalDimensions = (tmp1 << 8 | tmp2);
|
||||
tmp1 = -gScreen.affine.bg3yOffset;
|
||||
tmp2 = tmp1 + 0x100;
|
||||
if (tmp1 < 0) tmp1 = 0;
|
||||
if (tmp1 > 0xA0) tmp1 = 0xA0;
|
||||
if (tmp2 < 0) tmp2 = 0;
|
||||
if (tmp2 > 0xA0) tmp2 = 0xA0;
|
||||
gScreen.controls.window1VerticalDimensions = (tmp1 << 8 | tmp2);
|
||||
}
|
||||
|
||||
extern u8 gUnk_02001A40[];
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_0805A9CC(Manager15* this) {
|
||||
int tmp1, tmp2;
|
||||
void* tmp3;
|
||||
gScreen.affine.bg3xOffset = gRoomControls.roomScrollX - this->unk_24 + this->unk_34;
|
||||
tmp1 = -gScreen.affine.bg3xOffset;
|
||||
tmp2 = tmp1 + 0x100;
|
||||
if (tmp1 < 0) tmp1 = 0;
|
||||
if (tmp1 > 0xF0) tmp1 = 0xF0;
|
||||
if (tmp2 < 0) tmp2 = 0;
|
||||
if (tmp2 > 0xF0) tmp2 = 0xF0;
|
||||
gScreen.controls.window1HorizontalDimensions = tmp1 << 8 | tmp2;
|
||||
tmp1 = gRoomControls.roomScrollY - this->unk_26 + this->unk_36;
|
||||
gScreen.affine.bg3yOffset = tmp1 & 0x3F;
|
||||
if (tmp1 < 0) tmp1 += 0x3F;
|
||||
tmp3 = (&gUnk_02001A40[(tmp1 >> 6 << 9)]);
|
||||
gScreen.affine.unk5 = (u32) tmp3;
|
||||
gScreen.controls.window1VerticalDimensions = 0xa0;
|
||||
if (this->unk_28 == tmp3) return;
|
||||
this->unk_28 = tmp3;
|
||||
gScreen.affine.unk4 = 1;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_0805A9CC(Manager15* this) {
|
||||
asm(".include \"asm/non_matching/manager15/sub_0805A9CC.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
extern struct {
|
||||
u8 unk_00[0x20];
|
||||
} gUnk_085A97A0[];
|
||||
extern u16 gUnk_081085B8[];
|
||||
extern void LoadPalettes(const u8*, u32, u32);
|
||||
|
||||
void sub_0805AA58(Manager15* this) {
|
||||
if (--this->manager.unk_0e == 0) {
|
||||
this->manager.unk_0e = 8;
|
||||
this->unk_21 += 1;
|
||||
this->unk_21 &= 3;
|
||||
LoadPalettes(gUnk_085A97A0[this->unk_21].unk_00,5,1);
|
||||
}
|
||||
if (--this->manager.unk_0f == 0) {
|
||||
this->manager.unk_0f = 0x10;
|
||||
this->unk_22 += 1;
|
||||
this->unk_22 &= 0xF;
|
||||
gScreen.controls.alphaBlend = gUnk_081085B8[this->unk_22];
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805AAC8(Manager15* this) {
|
||||
sub_0805AAF0(this->unk_23);
|
||||
sub_0805A280(&this->manager);
|
||||
}
|
||||
|
||||
|
||||
extern u16 gUnk_08108648[];
|
||||
|
||||
void sub_0805AADC(u32 unk0) {
|
||||
LoadGfxGroup(gUnk_08108648[unk0]);
|
||||
}
|
||||
|
||||
void sub_0805AAF0(u32 unk0) {
|
||||
sub_0805AADC(unk0);
|
||||
gScreen.controls.layerFXControl = 0x3E48;
|
||||
gScreen.controls.alphaBlend = 0x1008;
|
||||
gScreen.affine.bg3Control = 0x1E04;
|
||||
gScreen.affine.unk5 = &gUnk_02001A40;
|
||||
gScreen.affine.bg3xOffset = 0;
|
||||
gScreen.affine.bg3yOffset = 0;
|
||||
gScreen.affine.unk4 = 1;
|
||||
gScreen.controls.windowInsideControl = 0x3F3F;
|
||||
gScreen.controls.windowOutsideControl = 0x37;
|
||||
gScreen.controls.window1HorizontalDimensions = 0xF0;
|
||||
gScreen.controls.window1VerticalDimensions = 0xA0;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
#include "global.h"
|
||||
#include "manager.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct Manager30 {
|
||||
Manager manager;
|
||||
u8 unk_20[8];//unused
|
||||
u16 own_tile;
|
||||
u8 unk_2a[0x2];//unused
|
||||
u16 player_previous_tile;
|
||||
u16 player_current_tile;
|
||||
u8 unk_30[0x6];//unused
|
||||
u8 width;
|
||||
u8 height;
|
||||
s16 x;
|
||||
s16 y;
|
||||
u16 flag_succeeded;
|
||||
u16 flag_reset;
|
||||
} Manager30;
|
||||
|
||||
extern void sub_0807B7D8(u32, u32, u32);
|
||||
|
||||
enum {
|
||||
INIT,
|
||||
IN_PROGRESS,
|
||||
FAILED,
|
||||
SUCCEEDED
|
||||
};
|
||||
|
||||
/*
|
||||
* Tile puzzles (step on all blue tiles exactly once).
|
||||
*
|
||||
* The Manager's field 0xe is used for the remaining number of tiles to be changed.
|
||||
* field 0xf is used for the total number of tiles to be changed.
|
||||
*/
|
||||
void Manager30_Main(Manager30* this) {
|
||||
u32 i, j, tmp, tmp2;
|
||||
switch (this->manager.action) {
|
||||
default:
|
||||
break;
|
||||
case INIT:
|
||||
this->manager.action = IN_PROGRESS;
|
||||
this->manager.unk_0f = this->manager.unk_0e;
|
||||
this->own_tile = (((this->x >> 4) & 0x3fU) |
|
||||
((this->y >> 4) & 0x3fU) << 6);
|
||||
this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity));
|
||||
break;
|
||||
case 1:
|
||||
this->player_current_tile = COORD_TO_TILE((&gPlayerEntity));
|
||||
if (this->player_current_tile != this->player_previous_tile) {
|
||||
this->player_previous_tile = this->player_current_tile;
|
||||
switch (GetTileType(this->player_current_tile, this->manager.unk_0b)) {
|
||||
case 0x317:
|
||||
//stepped on a red tile again
|
||||
this->manager.action = FAILED;
|
||||
PlaySFX(0x6d);
|
||||
break;
|
||||
case 0x318:
|
||||
//stepped on a blue tile
|
||||
//turn the tile into a red tile
|
||||
sub_0807B7D8(0x317, this->player_current_tile, this->manager.unk_0b);
|
||||
PlaySFX(0x6b);
|
||||
//decrease the number of remaining tiles and check if we're done
|
||||
if (--this->manager.unk_0e == 0) {
|
||||
this->manager.action = SUCCEEDED;
|
||||
//set up delay for setting the flag/playing the success sfx
|
||||
this->manager.unk_0e = 0x40;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//fall through, can be reset in-progress
|
||||
case FAILED:
|
||||
if (!this->flag_reset) return;//can't be reset
|
||||
if (!CheckFlags(this->flag_reset)) return;//wait for the flag telling it to reset
|
||||
ClearFlag(this->flag_reset);//make sure the puzzle can be reset again later
|
||||
this->manager.action = IN_PROGRESS;
|
||||
this->manager.unk_0e = this->manager.unk_0f;
|
||||
for (i = 0; i < this->height; i++) {
|
||||
tmp = this->own_tile + (i << 6);
|
||||
for (j = 0; j < this->width; j++) {
|
||||
sub_0807BA8C(tmp + j, this->manager.unk_0b);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SUCCEEDED:
|
||||
if (this->manager.unk_0e == 0) return;
|
||||
tmp2 = --this->manager.unk_0e;
|
||||
if (tmp2) {
|
||||
if (tmp2 == 0x20) {
|
||||
SetFlag(this->flag_succeeded);
|
||||
}
|
||||
} else {
|
||||
PlaySFX(0x72);
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
-35
@@ -12,13 +12,14 @@ extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern void sub_080600F0(Entity*);
|
||||
extern s32 sub_0806EDD8(Entity*, u32, u32);
|
||||
extern u32 sub_0806F5B0(u32);
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern void sub_08060158(Entity*);
|
||||
extern u32 CheckKinstoneFused(u32);
|
||||
extern Entity* FindEntityInListBySubtype(u32, u32, u32);
|
||||
extern void sub_080A29BC(Entity* parent);
|
||||
extern void DeleteEntity(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void ModBombs(s32);
|
||||
@@ -114,40 +115,36 @@ void sub_0806014C(Entity* this) {
|
||||
sub_08060158(this);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void sub_08060158(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
u8 bVar2;
|
||||
s32 iVar4;
|
||||
u32 temp;
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
}
|
||||
else {
|
||||
this->actionDelay = 2;
|
||||
iVar4 = sub_0806EDD8(this, 0x20, 0x20);
|
||||
if (iVar4 < 0) {
|
||||
this->animationState = this->field_0x68.HALF.HI;
|
||||
iVar4 = this->field_0x68.HALF.HI << 2;
|
||||
}
|
||||
temp = (this->animationState >> 1) * 0x20 + (iVar4 >> 1) * 2;
|
||||
bVar1 = gUnk_08109C98[temp];
|
||||
bVar2 = gUnk_08109C98[temp + 1];
|
||||
if ((bVar2 & 0x80) != 0) {
|
||||
this->animationState = sub_0806F5B0(iVar4);
|
||||
}
|
||||
this->frames.all = bVar1;
|
||||
this->frameIndex = bVar2 & 0x7f;
|
||||
this->frameSpriteSettings = 1;
|
||||
this->animIndex = 0;
|
||||
this->frameDuration = 0xf0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
NAKED
|
||||
void sub_08060158(Entity* this) {
|
||||
asm(".include \"asm/non_matching/forestMinish/sub_08060158.inc\"");
|
||||
int index;
|
||||
u8* idx3;
|
||||
u8 tmp1, tmp2;
|
||||
|
||||
if (this->actionDelay) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
this->actionDelay = 2;
|
||||
index = sub_0806EDD8(this, 0x20, 0x20);
|
||||
if (index < 0) {
|
||||
int state = this->field_0x68.HALF.HI;
|
||||
this->animationState = state;
|
||||
index = state * 4;
|
||||
}
|
||||
|
||||
idx3 = gUnk_08109C98 + (this->animationState / 2) * 0x20 + (index >> 1) * 2;
|
||||
tmp1 = idx3[0];
|
||||
tmp2 = idx3[1];
|
||||
|
||||
if (tmp2 & 0x80) {
|
||||
this->animationState = sub_0806F5B0(index);
|
||||
}
|
||||
tmp2 &= 0x7f;
|
||||
this->frames.all = tmp1;
|
||||
this->frameIndex = tmp2;
|
||||
this->frameSpriteSettings = 1;
|
||||
this->animIndex = 0;
|
||||
this->frameDuration = 0xf0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080601D4(Entity* this) {
|
||||
@@ -238,7 +235,7 @@ void sub_08060318(void) {
|
||||
for (i = 2; i >= 0; i--) {
|
||||
ent = FindEntityInListBySubtype(8, 2, 2);
|
||||
if (ent != NULL) {
|
||||
sub_080A29BC(ent);
|
||||
CreateDust(ent);
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-12
@@ -29,18 +29,16 @@ extern Dialog gUnk_08110390[];
|
||||
extern u16 gUnk_081103D0[];
|
||||
extern u32 gUnk_081103E0;
|
||||
|
||||
#if NON_MATCHING // reg-alloc
|
||||
void Smith(Entity* this) {
|
||||
u32 iVar2;
|
||||
u32 iVar4;
|
||||
u32 index;
|
||||
|
||||
if ((this->flags & 2) != 0) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 4;
|
||||
this->interactType = 0;
|
||||
iVar4 = (this->animIndex == 0xc) ? 8 : 0;
|
||||
iVar2 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, iVar2 + iVar4);
|
||||
index = (this->animIndex == 0xc) ? 8 : 0;
|
||||
index += sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, index);
|
||||
sub_0806F118(this);
|
||||
}
|
||||
gUnk_0811036C[this->action](this);
|
||||
@@ -59,12 +57,6 @@ void Smith(Entity* this) {
|
||||
PlaySFX(gUnk_08110380[(Random() & 7)]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void Smith(Entity* this) {
|
||||
asm(".include \"asm/non_matching/smith/smith.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void Smith_Head(Entity* this) {
|
||||
u8 bVar1;
|
||||
|
||||
@@ -12,8 +12,7 @@ extern void (*const gUnk_0810FBFC[])(Entity*);
|
||||
void TingleSiblings(Entity* this) {
|
||||
if ((this->flags & 2) != 0) {
|
||||
sub_08064DE4(this);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sub_08064D78(this);
|
||||
}
|
||||
}
|
||||
@@ -40,4 +39,43 @@ void sub_08064DCC(Entity* this) {
|
||||
sub_08064EE8(this);
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
void sub_08064DE4(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings = this->spriteSettings & 0xfc | 1;
|
||||
this->animationState = '\x04';
|
||||
sub_0807DD50(this);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
GetFacingDirection(this, &gPlayerEntity);
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4());
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
sub_0801E99C(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
{
|
||||
u8 bVar1 = this->frames.all;
|
||||
u8 bVar5 = bVar1 & 0xf;
|
||||
this->frames.all = bVar5 ^ bVar1;
|
||||
if (bVar1 & 0xf) {
|
||||
Entity* fx = CreateFx(this, bVar5 == 3 ? 0x2a : 0x29, 0);
|
||||
if (fx && bVar5 == 2) {
|
||||
fx->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@@ -30,8 +30,8 @@ void MineralWaterSource_Init(Entity *this) {
|
||||
this->entityType.parameter = unknownParameters->field_0x00;
|
||||
this->field_0x40 = unknownParameters->field_0x03;
|
||||
|
||||
this->boundingBox->field_0x6 = unknownParameters->field_0x01;
|
||||
this->boundingBox->field_0x7 = unknownParameters->field_0x02;
|
||||
this->boundingBox->unknown[6] = unknownParameters->field_0x01;
|
||||
this->boundingBox->unknown[7] = unknownParameters->field_0x02;
|
||||
|
||||
this->flags |= 0x80;
|
||||
|
||||
|
||||
@@ -243,10 +243,10 @@ void sub_0808F498(Entity* this) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 64;
|
||||
var0 = this->entityType.parameter != 0 ? 44 : 43;
|
||||
this->x.HALF.HI -= this->parent->boundingBox->field_0x6;
|
||||
this->x.HALF.HI += (s32)Random() % (this->parent->boundingBox->field_0x6 * 2);
|
||||
this->y.HALF.HI -= this->parent->boundingBox->field_0x7;
|
||||
this->y.HALF.HI += (s32)Random() % (this->parent->boundingBox->field_0x7 * 2);
|
||||
this->x.HALF.HI -= this->parent->boundingBox->unknown[6];
|
||||
this->x.HALF.HI += (s32)Random() % (this->parent->boundingBox->unknown[6] * 2);
|
||||
this->y.HALF.HI -= this->parent->boundingBox->unknown[7];
|
||||
this->y.HALF.HI += (s32)Random() % (this->parent->boundingBox->unknown[7] * 2);
|
||||
sub_0801D2B4(this, var0);
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ void ObjectA(Entity *this) {
|
||||
} else if (this->interactType != 0) {
|
||||
SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
SetFlag(this->field_0x86);
|
||||
sub_080A29BC(this);
|
||||
CreateDust(this);
|
||||
sub_080526F8(-1);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
+24
-30
@@ -7,38 +7,32 @@ extern u32 sub_080AE4CC(Entity*, u32, u32, u32);
|
||||
extern void* gUnk_02027EB4;
|
||||
extern void* gUnk_0200D654;
|
||||
|
||||
#if 0
|
||||
void ObjectB2(Entity* this) {
|
||||
void* pEVar3;
|
||||
|
||||
void ObjectB2(Entity *this)
|
||||
{
|
||||
void* pEVar3;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x10;
|
||||
this->direction = (this->entityType).form << 3;
|
||||
if (this->collisionLayer == 2) {
|
||||
pEVar3 = &gUnk_0200D654;
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x10;
|
||||
this->direction = (this->entityType).form << 3;
|
||||
if (this->collisionLayer == 2) {
|
||||
pEVar3 = &gUnk_0200D654;
|
||||
} else {
|
||||
pEVar3 = &gUnk_02027EB4;
|
||||
}
|
||||
this->attachedEntity = pEVar3;
|
||||
InitializeAnimation(this, this->entityType.form);
|
||||
}
|
||||
else {
|
||||
pEVar3 = &gUnk_02027EB4;
|
||||
this->nonPlanarMovement = this->parent->nonPlanarMovement;
|
||||
sub_0806F69C(this);
|
||||
if (sub_080AE4CC(this->attachedEntity, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->attachedEntity = pEVar3;
|
||||
InitializeAnimation(this, this->entityType.form);
|
||||
}
|
||||
this->nonPlanarMovement = this->parent->nonPlanarMovement;
|
||||
sub_0806F69C(this);
|
||||
if (sub_080AE4CC(this->attachedEntity, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->nonPlanarMovement < 0x41) {
|
||||
this->spriteSettings.b.draw ^= 1;
|
||||
if (this->nonPlanarMovement < 0x41) {
|
||||
this->spriteSettings.b.draw ^= 1;
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
DeleteThisEntity();
|
||||
if (--this->actionDelay == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
#endif
|
||||
GetNextFrame(this);
|
||||
}
|
||||
+26
-34
@@ -101,55 +101,47 @@ void sub_08085308(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void sub_08085394(Entity *this)
|
||||
{
|
||||
void sub_08085394(Entity* this) {
|
||||
u32 uVar1;
|
||||
u16 *layerData;
|
||||
u32 iVar3;
|
||||
u32 uVar4;
|
||||
u8 *pbVar5;
|
||||
u16* layerData;
|
||||
u32 tile;
|
||||
s8 off;
|
||||
|
||||
uVar1 = gUnk_081205E0[this->animationState / 2];
|
||||
iVar3 = this->animationState / 2;
|
||||
layerData = *(u16 **)&this->field_0x70;
|
||||
uVar4 = COORD_TO_TILE(this);
|
||||
this->field_0x74.HWORD = layerData[gUnk_080B4488[iVar3]];
|
||||
pbVar5 = &this->collisionLayer;
|
||||
SetTile(uVar1, uVar4 - iVar3, *pbVar5);
|
||||
this->field_0x76 = layerData[0];
|
||||
SetTile(uVar1,uVar4, *pbVar5);
|
||||
*(u16 *)&this->field_0x78 = layerData[iVar3];
|
||||
SetTile(uVar1,uVar4 + iVar3, *pbVar5);
|
||||
}
|
||||
#endif
|
||||
off = gUnk_080B4488[this->animationState / 2][0];
|
||||
layerData = (u16*)this->field_0x70.WORD;
|
||||
tile = COORD_TO_TILE(this);
|
||||
|
||||
NAKED
|
||||
void sub_08085394(Entity* this) {
|
||||
asm(".include \"asm/non_matching/railtrack/sub_08085394.inc\"");
|
||||
this->field_0x74.HWORD = *(layerData - off);
|
||||
SetTile(uVar1, tile - off, this->collisionLayer);
|
||||
|
||||
this->field_0x76.HWORD = layerData[0x0];
|
||||
SetTile(uVar1, tile - 0x0, this->collisionLayer);
|
||||
|
||||
this->field_0x78.HWORD = layerData[off];
|
||||
SetTile(uVar1, tile + off, this->collisionLayer);
|
||||
}
|
||||
|
||||
void sub_0808543C(Entity *this)
|
||||
{
|
||||
s8 *cVar1;
|
||||
u32 uVar2;
|
||||
s8 temp;
|
||||
void sub_0808543C(Entity* this) {
|
||||
s8* cVar1;
|
||||
u32 uVar2;
|
||||
s8 temp;
|
||||
|
||||
temp = gUnk_080B4488[this->animationState / 2][0];
|
||||
uVar2 = COORD_TO_TILE(this);
|
||||
SetTile(this->field_0x74.HWORD, uVar2 - temp, this->collisionLayer);
|
||||
SetTile(this->field_0x76.HWORD, uVar2, this->collisionLayer);
|
||||
SetTile(this->field_0x78.HWORD, uVar2 + temp, this->collisionLayer);
|
||||
temp = gUnk_080B4488[this->animationState / 2][0];
|
||||
uVar2 = COORD_TO_TILE(this);
|
||||
SetTile(this->field_0x74.HWORD, uVar2 - temp, this->collisionLayer);
|
||||
SetTile(this->field_0x76.HWORD, uVar2, this->collisionLayer);
|
||||
SetTile(this->field_0x78.HWORD, uVar2 + temp, this->collisionLayer);
|
||||
}
|
||||
|
||||
u32 sub_080854A8(Entity *this) {
|
||||
u32 sub_080854A8(Entity* this) {
|
||||
u16 var0;
|
||||
u16* var1;
|
||||
s8* var2;
|
||||
|
||||
var0 = gUnk_081205E0[this->animationState / 2];
|
||||
var2 = gUnk_080B4488[this->animationState / 2];
|
||||
var1 = (u16 *)this->field_0x70.WORD;
|
||||
var1 = (u16*)this->field_0x70.WORD;
|
||||
if (var0 != *(var1 - var2[0])) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
extern void sub_0809E96C(Entity*);
|
||||
extern u32 sub_0800419C(Entity*, Entity*, u32, u32);
|
||||
extern void sub_080A2B80(Entity*);
|
||||
extern void CreateSparkle(Entity*);
|
||||
extern u32 sub_0809E9A0(void);
|
||||
extern void sub_08078A90(u32);
|
||||
extern void sub_0809E918(Entity*);
|
||||
@@ -37,7 +37,7 @@ void sub_0809E86C(Entity* this) {
|
||||
if (sub_0800419C(this, &gPlayerEntity, 0x30, 0x30)) {
|
||||
if (CheckGlobalFlag(EZERO_1ST)) {
|
||||
if (((gScreenTransition & 3) == 0)) {
|
||||
sub_080A2B80(this);
|
||||
CreateSparkle(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user