mirror of
https://github.com/zeldaret/tmc
synced 2026-08-20 22:24:01 -04:00
Merge branch 'master' of https://github.com/zeldaret/tmc
This commit is contained in:
@@ -0,0 +1,570 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 sub_080002D4(s32, s32, u32);
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern void sub_08001324(Entity*);
|
||||
extern u32 sub_080044EC(Entity*, u32);
|
||||
extern u32 sub_08031E04(Entity*);
|
||||
extern void sub_08031E48(Entity*, Entity*);
|
||||
extern void sub_08032290(Entity*);
|
||||
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*);
|
||||
extern void SetChildOffset(Entity*, s32, s32, s32);
|
||||
extern u32 Random(void);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u8 gEntCount;
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CE56C[])(Entity*);
|
||||
extern void (*const gUnk_080CE584[])(Entity*);
|
||||
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 u16 gUnk_080CE5F0[5];
|
||||
extern u8 gUnk_080CE5FA[20]; // Directions
|
||||
|
||||
void AcroBandit(Entity* this) {
|
||||
s32 index;
|
||||
|
||||
index = sub_080012DC(this);
|
||||
|
||||
if (index) {
|
||||
if ((this->field_0x3a & 1) == 0)
|
||||
sub_08032338(this);
|
||||
|
||||
gUnk_080012C8[index](this);
|
||||
} else {
|
||||
gUnk_080CE56C[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080318C4(Entity* this) {
|
||||
gUnk_080CE584[this->entityType.form](this);
|
||||
}
|
||||
|
||||
void sub_080318DC(Entity* this) {
|
||||
Entity* brother;
|
||||
|
||||
if (this->bitfield != 0x80 && this->bitfield != 0x81) {
|
||||
if (this->entityType.form == 1) {
|
||||
if (this->action < 7 && this->field_0x42) {
|
||||
brother = this->attachedEntity;
|
||||
if (brother) {
|
||||
brother->parent = this->parent;
|
||||
do {
|
||||
brother->action = 5;
|
||||
brother->spritePriority.b1 = 1;
|
||||
if (brother->hurtBlinkTime == 0)
|
||||
brother->hurtBlinkTime = -12;
|
||||
} while (brother = brother->attachedEntity, brother != NULL);
|
||||
}
|
||||
if (this->parent) {
|
||||
this->parent->attachedEntity = this->attachedEntity;
|
||||
} else {
|
||||
if (this->attachedEntity)
|
||||
this->parent = this;
|
||||
}
|
||||
|
||||
this->action = 9;
|
||||
this->spritePriority.b1 = 1;
|
||||
if (this->field_0x3e < 0x10) {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
} else {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
InitializeAnimation(this, 14);
|
||||
}
|
||||
|
||||
if (this->currentHealth == 0) {
|
||||
this->field_0x3e = ((this->field_0x3e + (7 & Random())) - 4) & 0x1f;
|
||||
this->field_0x42 += this->entityType.parameter * 3;
|
||||
sub_08032338(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x42 && this->frames.all & 0x10) {
|
||||
if (this->entityType.form == 0) {
|
||||
this->action = 8;
|
||||
} else {
|
||||
this->action = 9;
|
||||
}
|
||||
if (this->field_0x3e < 0x10) {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
} else {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
this->spritePriority.b1 = 1;
|
||||
InitializeAnimation(this, 14);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x43)
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
|
||||
sub_0804AA30(this, gUnk_080CE56C);
|
||||
}
|
||||
|
||||
void sub_08031A60(Entity* this) {
|
||||
if (this->hurtBlinkTime > 0)
|
||||
sub_08003FC4(this, 0x1800);
|
||||
|
||||
sub_08001324(this);
|
||||
}
|
||||
|
||||
void nullsub_154(void) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
void sub_08031A88(Entity* this) {
|
||||
gUnk_080CE58C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08031AA0(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = '\x01';
|
||||
this->field_0x74.HWORD = this->x.HALF.HI;
|
||||
this->field_0x76.HWORD = this->y.HALF.HI;
|
||||
this->field_0x78.HALF.HI = Random();
|
||||
}
|
||||
|
||||
void sub_08031AC8(Entity* this)
|
||||
|
||||
{
|
||||
u32 rand;
|
||||
s32 x, y;
|
||||
|
||||
if (this->actionDelay) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
rand = Random();
|
||||
x = this->field_0x74.HWORD + ((s32)rand % 5) * 0x10 - 0x20;
|
||||
y = this->field_0x76.HWORD + ((s32)(rand >> 4) % 5) * 0x10 - 0x20;
|
||||
if (sub_080002D4(x, y, this->collisionLayer) == 0) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->x.HALF.HI = x;
|
||||
this->y.HALF.HI = y;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031B48(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f0) {
|
||||
this->frames.all = 0;
|
||||
this->flags |= 0x80;
|
||||
} else {
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 0x3;
|
||||
this->actionDelay = gUnk_080CE5B0[Random() & 7];
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031B98(Entity* this) {
|
||||
if (sub_08031E04(this)) {
|
||||
this->action = 5;
|
||||
if (this->x.HALF.HI > gUnk_020000B0->x.HALF.HI) {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
} else {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
InitializeAnimation(this, 3);
|
||||
} else {
|
||||
if (this->frames.b.f0 && this->actionDelay) {
|
||||
// this->frames.b.f0 = 0;
|
||||
this->frames.all &= 0xfe;
|
||||
this->actionDelay--;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 4;
|
||||
this->flags &= 0x7f;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031C1C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3) {
|
||||
this->action = '\x01';
|
||||
this->actionDelay = gUnk_080CE5B8[Random() & 7];
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#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();
|
||||
tmp &= 3;
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
a->entityType.parameter = 0;
|
||||
a->parent = NULL;
|
||||
a->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, a);
|
||||
|
||||
b = CreateEnemy(0x2e, 1);
|
||||
a->attachedEntity = b;
|
||||
b->entityType.parameter = 1;
|
||||
b->parent = a;
|
||||
b->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, b);
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
b->attachedEntity = a;
|
||||
a->entityType.parameter = 2;
|
||||
a->parent = b;
|
||||
a->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, a);
|
||||
|
||||
b = CreateEnemy(0x2e, 1);
|
||||
a->attachedEntity = b;
|
||||
b->entityType.parameter = 3;
|
||||
b->parent = a;
|
||||
b->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, b);
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
b->attachedEntity = a;
|
||||
a->entityType.parameter = 4;
|
||||
a->parent = b;
|
||||
a->attachedEntity = NULL;
|
||||
a->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, a);
|
||||
|
||||
this->action = 6;
|
||||
this->actionDelay = 20;
|
||||
this->spritePriority.b0 = 7;
|
||||
InitializeAnimation(this, 7);
|
||||
}
|
||||
} else {
|
||||
if (this->frames.b.f0) {
|
||||
this->frames.all = 0;
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_08031C58(Entity* this) {
|
||||
asm(".include \"asm/non_matching/acroBandits/sub_08031C58.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_08031D70(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (--this->actionDelay == '\0') {
|
||||
this->action = 7;
|
||||
this->flags &= 0x7f;
|
||||
this->actionDelay = 5;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031DA0(Entity* this) {
|
||||
if ((this->actionDelay & 0xf) == 0) {
|
||||
if (this->actionDelay == 0x50) {
|
||||
DeleteEntity(this);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0xb4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031DC4(Entity* this) {
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0xb4;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.all & 0xf) == 2) {
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
u32 sub_08031E04(Entity* this) {
|
||||
Entity* ent;
|
||||
union SplitHWord* tmp;
|
||||
int x, y;
|
||||
|
||||
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);
|
||||
}
|
||||
#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);
|
||||
child->field_0x6c.HALF.LO = this->field_0x6c.HALF.LO;
|
||||
child->field_0x70.HALF.LO = this->field_0x70.HALF.LO;
|
||||
child->field_0x70.HALF.HI = this->field_0x70.HALF.HI;
|
||||
child->filler4[0] = this->filler4[0];
|
||||
child->filler4[1] = this->filler4[1];
|
||||
child->field_0x7c.WORD = (s32)this;
|
||||
}
|
||||
|
||||
void sub_08031E90(Entity* this) {
|
||||
gUnk_080CE5C8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08031EA8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spritePriority.b1 = 1;
|
||||
this->field_0x20 = 0x40000;
|
||||
this->height.HALF.HI = (4 - this->entityType.parameter) * 0xe;
|
||||
this->field_0x78.HALF.HI = Random();
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
|
||||
void sub_08031EE8(Entity* this) {
|
||||
int draw;
|
||||
|
||||
this->height.WORD -= this->field_0x20;
|
||||
this->field_0x20 -= 0x1800;
|
||||
|
||||
if (this->height.HALF.HI < 1) {
|
||||
draw = this->spriteSettings.b.draw;
|
||||
if (!draw)
|
||||
sub_08004488(299);
|
||||
|
||||
this->spriteSettings.b.draw = 1;
|
||||
}
|
||||
|
||||
draw = this->spriteSettings.b.draw;
|
||||
if (draw == 1)
|
||||
GetNextFrame(this);
|
||||
|
||||
if (this->field_0x20 < 1) {
|
||||
this->action = 2;
|
||||
this->flags |= 0x80;
|
||||
InitializeAnimation(this, 5);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031F54(Entity* this) {
|
||||
sub_08003FC4(this, gUnk_080CE5F0[this->entityType.parameter]);
|
||||
if (this->entityType.parameter * -0xe <= this->height.HALF.HI) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 20;
|
||||
this->height.HALF.HI = this->entityType.parameter * -0xe;
|
||||
if (this->parent != NULL)
|
||||
this->spritePriority.b1 = 0;
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031FB0(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3 && (this->parent || --this->actionDelay == 0)) {
|
||||
this->action = 4;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
*(u8*)&this->field_0x76 = 0;
|
||||
if (this->attachedEntity) {
|
||||
InitializeAnimation(this, 9);
|
||||
} else {
|
||||
InitializeAnimation(this, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032008(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
if (sub_080322A4(this) == 0) {
|
||||
parent = this->parent;
|
||||
if (parent == 0) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if ((++this->field_0x78.HALF.HI & 7) == 0) {
|
||||
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||
}
|
||||
this->field_0x76.HALF.LO = 0;
|
||||
} else {
|
||||
if (this->field_0x76.HALF.LO) {
|
||||
(this->field_0x76.HALF.LO)--;
|
||||
sub_08004596(this, this->field_0x7a.HALF.LO);
|
||||
} else {
|
||||
this->field_0x76.HALF.LO = 0x10;
|
||||
if (sub_08049FA0(this) == 0 && (Random() & 1)) {
|
||||
this->field_0x7a.HALF.LO = sub_08049EE4(this);
|
||||
} else {
|
||||
this->field_0x7a.HALF.LO = Random() & 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->direction & 0xf) {
|
||||
this->spriteSettings.b.flipX = !(!(this->direction & 0x10) ^ 1);
|
||||
}
|
||||
|
||||
sub_080AEF88(this);
|
||||
} else {
|
||||
if (this->field_0x76.HALF.HI == 0) {
|
||||
if (sub_0806FCB8(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) {
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
this->direction = GetFacingDirection(this, parent);
|
||||
sub_080322E8(this);
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
} else {
|
||||
this->direction = GetFacingDirection(this, parent);
|
||||
sub_080322E8(this);
|
||||
sub_0806F69C(this);
|
||||
if (this->x.HALF.HI == parent->x.HALF.HI && this->y.HALF.HI == parent->y.HALF.HI)
|
||||
this->field_0x76.HALF.HI = 0;
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032148(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x2000))
|
||||
return;
|
||||
|
||||
sub_08032290(this);
|
||||
}
|
||||
|
||||
void sub_08032160(Entity* this) {
|
||||
Entity* tmp;
|
||||
u32 dir;
|
||||
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 7;
|
||||
dir = gUnk_080CE5FA[this->field_0x74.HALF.LO * 5 + this->entityType.parameter];
|
||||
this->direction = dir;
|
||||
if (dir >= 0x10) {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
} else {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
}
|
||||
this->nonPlanarMovement = 0xf0;
|
||||
this->field_0x20 = 0x12000;
|
||||
this->spritePriority.b1 = 1;
|
||||
InitializeAnimation(this, 12);
|
||||
}
|
||||
|
||||
if (this->attachedEntity == NULL) {
|
||||
for (tmp = this->parent; tmp != NULL; tmp = tmp->parent) {
|
||||
if (tmp->currentHealth != 0)
|
||||
tmp->actionDelay = 0;
|
||||
}
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080321E8(Entity* this) {
|
||||
sub_080AEFE0(this);
|
||||
|
||||
if (sub_080044EC(this, 0x2000) == 0)
|
||||
this->action = 8;
|
||||
}
|
||||
|
||||
void sub_08032204(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
this->frames.all = 0;
|
||||
this->frameDuration = (Random() & 0x30) + 30;
|
||||
} else {
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 9;
|
||||
InitializeAnimation(this, 13);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032248(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
if (this->frames.all & 0x80) {
|
||||
((Entity*)this->field_0x7c.WORD)->actionDelay--;
|
||||
|
||||
DeleteEntity(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
|
||||
if ((this->frames.all & 0xf) == 2)
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032290(Entity* this) {
|
||||
this->action = 6;
|
||||
this->actionDelay = 12;
|
||||
InitializeAnimation(this, 11);
|
||||
}
|
||||
|
||||
u32 sub_080322A4(Entity* this) {
|
||||
if (this->attachedEntity != NULL && (this->attachedEntity->height.HALF.HI + 8) >= this->height.HALF.HI) {
|
||||
if (this->height.HALF.HI) {
|
||||
this->action = 5;
|
||||
this->height.HALF.HI = this->attachedEntity->height.HALF.HI + 8;
|
||||
InitializeAnimation(this, 11);
|
||||
return 1;
|
||||
} else {
|
||||
sub_08032290(this);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_080322E8(Entity* this) {
|
||||
u8 tmp;
|
||||
if (this->field_0x78.HALF.LO) {
|
||||
if (--this->field_0x78.HALF.LO == 0) {
|
||||
u32 flipX = this->spriteSettings.b.flipX;
|
||||
this->spriteSettings.b.flipX = flipX ^ 1;
|
||||
}
|
||||
} else {
|
||||
tmp = this->direction;
|
||||
if (tmp & 0xF) {
|
||||
tmp >>= 4;
|
||||
tmp ^= 1;
|
||||
if (tmp != this->spriteSettings.b.flipX) {
|
||||
this->field_0x78.HALF.LO = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032338(Entity *this) {
|
||||
if ((((Entity*)this->field_0x7c.WORD)->actionDelay += 15) != 80)
|
||||
this->field_0x6c.HALF.LO = 0;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
extern void sub_080A2CC0();
|
||||
extern void sub_0806F69C();
|
||||
extern void sub_08004488();
|
||||
extern Entity* GetCurrentRoomProperty();
|
||||
|
||||
void BladeTrap(Entity* ent) {
|
||||
u16 uVar1;
|
||||
Entity* pEVar2;
|
||||
u16* puVar3;
|
||||
if (ent->action == 0) {
|
||||
ent->action = 1;
|
||||
pEVar2 = GetCurrentRoomProperty((u8)(ent->entityType).form);
|
||||
ent->attachedEntity = pEVar2;
|
||||
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->field_0x74);
|
||||
}
|
||||
if ((ent->direction & 0x80) == 0) {
|
||||
sub_0806F69C(ent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
puVar3 = &(ent->field_0x74.HWORD);
|
||||
uVar1 = *puVar3;
|
||||
*puVar3 = uVar1 - 1;
|
||||
if ((*puVar3) == 0) {
|
||||
if ((u16)(ent->direction & 0x80) == 0) {
|
||||
sub_08004488(0x74);
|
||||
}
|
||||
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, puVar3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern u32 GetNextFunction(Entity*);
|
||||
extern void sub_0802AD54(Entity*);
|
||||
extern void sub_0802B048(Entity*);
|
||||
extern void sub_0806F4E8(Entity*);
|
||||
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CD0F0[])(Entity*);
|
||||
extern void (*const gUnk_080CD120[])(Entity*);
|
||||
extern void (*const gUnk_080CD134[])(Entity*);
|
||||
extern void (*const gUnk_080CD108[])(Entity*);
|
||||
extern void (*const gUnk_080CD140[])(Entity*);
|
||||
|
||||
void BombPeahat(Entity* this) {
|
||||
s32 iVar1;
|
||||
u32 uVar2;
|
||||
|
||||
if (((this->entityType).form == 2) && (iVar1 = sub_080012DC(this), iVar1)) {
|
||||
gUnk_080012C8[iVar1](this);
|
||||
} else {
|
||||
gUnk_080CD0F0[GetNextFunction(this)](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802A84C(Entity* this) {
|
||||
switch (this->entityType.form) {
|
||||
default:
|
||||
gUnk_080CD108[this->action](this);
|
||||
sub_0802AD54(this);
|
||||
return;
|
||||
case 2:
|
||||
gUnk_080CD120[this->action](this);
|
||||
sub_0802B048(this);
|
||||
return;
|
||||
case 3:
|
||||
gUnk_080CD134[this->action](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802A8AC(Entity *this) {
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
if (this->entityType.form < 2) {
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802A8C8(Entity* this)
|
||||
{
|
||||
gUnk_080CD140[this->previousActionFlag](this);
|
||||
}
|
||||
|
||||
void sub_0802A8E0(Entity *this)
|
||||
{
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 0x3c;
|
||||
}
|
||||
|
||||
void sub_0802A8EC(Entity *this)
|
||||
{
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_0802A8F4(Entity *this)
|
||||
{
|
||||
sub_0806F3E4(this);
|
||||
}
|
||||
|
||||
void sub_0802A8FC(Entity *this)
|
||||
{
|
||||
if ((gPlayerState.field_0x1c & 0xf) == 0) {
|
||||
this->currentHealth = gPlayerState.field_0x1c & 0xf;
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_143(Entity* this){}
|
||||
|
||||
void sub_0802A91C(Entity *this)
|
||||
{
|
||||
this->currentHealth = 0;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void EnemyFunctionHandler(Entity*, void (*const funcs[])(Entity*));
|
||||
extern void SetChildOffset(Entity*, u32, u32, u32);
|
||||
extern void sub_0804A9FC(Entity*, u32);
|
||||
extern void sub_0804AA30(Entity*, void (*const funcs[][])(Entity*));
|
||||
extern void sub_0803C5F0(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CFF78[])(Entity*);
|
||||
extern void (*const gUnk_080CFF90[])(Entity*);
|
||||
|
||||
void BowMoblin(Entity *this)
|
||||
{
|
||||
EnemyFunctionHandler(this, gUnk_080CFF78);
|
||||
SetChildOffset(this, 0, 1, -0x18);
|
||||
}
|
||||
|
||||
void sub_0803C180(Entity *this)
|
||||
{
|
||||
gUnk_080CFF90[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0803C198(Entity *this)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this,0x1c);
|
||||
}
|
||||
sub_0804AA30(this, &gUnk_080CFF78);
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
sub_0803C5F0(this);
|
||||
pEVar1 = this->attachedEntity;
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->field_0xf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_168(Entity* this){}
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void EnemyFunctionHandler(Entity*, void (*const funcs[])(Entity*));
|
||||
extern void DeleteThisEntity();
|
||||
|
||||
extern void (*const gUnk_080CB570[])(Entity*);
|
||||
extern void (*const gUnk_080CB588[])(Entity*);
|
||||
|
||||
void HangingSeed(Entity *this)
|
||||
{
|
||||
EnemyFunctionHandler(this, gUnk_080CB570);
|
||||
}
|
||||
|
||||
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 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_08(Entity* this){}
|
||||
@@ -0,0 +1,246 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
|
||||
extern void (*const gUnk_080CE7B0[])(Entity*);
|
||||
extern void (*const gUnk_080CE7C8[])(Entity*);
|
||||
extern u8 gUnk_080CE7E0[];
|
||||
extern u16 gUnk_080CE7F0[];
|
||||
extern s8 gUnk_080CE810[];
|
||||
|
||||
u32 sub_080325E8(Entity* this);
|
||||
void sub_08032650(Entity* this);
|
||||
void sub_0803269C(Entity* this, u32 direction);
|
||||
void sub_080326FC(Entity* this);
|
||||
u32 sub_0803271C(Entity* this);
|
||||
void sub_08032740(Entity* this);
|
||||
void sub_0803275C(Entity* this);
|
||||
void sub_08032784(Entity* this);
|
||||
void sub_08032794(Entity* this);
|
||||
void sub_080327C8(Entity* this);
|
||||
void sub_080327E0(Entity* this);
|
||||
|
||||
void Keaton(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CE7B0);
|
||||
SetChildOffset(this, 0, 1, -18);
|
||||
}
|
||||
|
||||
void sub_080323DC(Entity* this) {
|
||||
gUnk_080CE7C8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080323F4(Entity* this) {
|
||||
u32 var;
|
||||
|
||||
if ((u8)(this->action - 3) >= 2) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0xC;
|
||||
var = ((this->field_0x3e + 4) & 0x18) ^ 0x10;
|
||||
this->direction = var;
|
||||
InitAnimationForceUpdate(this, var >> 3);
|
||||
} else if (this->bitfield == 0xCC) {
|
||||
if (this->field_0x43 == 0) {
|
||||
sub_0803275C(this);
|
||||
}
|
||||
}
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1C);
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CE7B0);
|
||||
}
|
||||
|
||||
void nullsub_155(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08032468(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->animationState = 0;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
sub_080326FC(this);
|
||||
sub_08032740(this);
|
||||
}
|
||||
|
||||
void sub_0803248C(Entity* this) {
|
||||
if (sub_080325E8(this) == 0) {
|
||||
if (sub_0803271C(this) == 0) {
|
||||
this->actionDelay--;
|
||||
if (this->actionDelay == 0) {
|
||||
sub_08032650(this);
|
||||
}
|
||||
if (sub_080AEF88(this) == 0) {
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080324CC(Entity* this) {
|
||||
if (sub_080325E8(this) == 0) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
sub_080326FC(this);
|
||||
sub_08032740(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080324FC(Entity* this) {
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
if (this->actionDelay == 0) {
|
||||
this->field_0xf = 0x1E;
|
||||
this->animationState = this->direction / 8;
|
||||
InitAnimationForceUpdate(this, this->animationState + 4);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
this->field_0xf--;
|
||||
if (this->field_0xf == 0) {
|
||||
this->action = 4;
|
||||
this->nonPlanarMovement = 0x1E0;
|
||||
this->field_0x76.HWORD = 0x46;
|
||||
this->field_0x78.HWORD = 0;
|
||||
*(((u8*)&this->field_0x7a) + 1) = 0;
|
||||
sub_080327C8(this);
|
||||
} else {
|
||||
if ((this->field_0xf & 0x3) == 0) {
|
||||
sub_08032794(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032574(Entity* this) {
|
||||
if (this->attachedEntity && (this->attachedEntity->bitfield & 0x80)) {
|
||||
sub_0803275C(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (--this->field_0x76.HWORD == 0 || !sub_080AEFE0(this)) {
|
||||
sub_0803275C(this);
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->field_0x76.HWORD & 0x7) == 0) {
|
||||
sub_08032794(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080325C4(Entity* this) {
|
||||
this->actionDelay--;
|
||||
if ((this->actionDelay == 0) && (sub_080325E8(this) == 0)) {
|
||||
sub_08032784(this);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_080325E8(Entity* this) {
|
||||
if (((sub_08049FA0(this) != 0) && (sub_08049FDC(this, 1) != 0)) &&
|
||||
(sub_080041A0(this, gUnk_020000B0, 0x68, 0x40) != 0)) {
|
||||
if (((GetFacingDirection(this, gUnk_020000B0) - ((this->frames.all & 0x18)) + 2) & 0x1F) < 5) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0xC;
|
||||
this->direction = this->frames.all & 0x18;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_08032650(Entity* this) {
|
||||
u32 uVar3;
|
||||
|
||||
uVar3 = Random();
|
||||
this->actionDelay = gUnk_080CE7E0[uVar3 & 0xf];
|
||||
if (!((sub_08049FA0(this) == 0) && ((uVar3 >> 8 & 1) == 0))) {
|
||||
this->direction = (uVar3 >> 0x10) & 0x18;
|
||||
} else {
|
||||
this->direction = (sub_08049EE4(this) + 4) & 0x18;
|
||||
}
|
||||
sub_0803269C(this, this->direction);
|
||||
}
|
||||
|
||||
void sub_0803269C(Entity* this, u32 param_2) {
|
||||
u32 uVar1;
|
||||
|
||||
if (((param_2 - 3) & 7) < 3) {
|
||||
uVar1 = ((param_2 + 4) & 0x18) >> 3;
|
||||
if (((this->animationState - uVar1) & 3) > 1) {
|
||||
this->animationState = uVar1;
|
||||
InitAnimationForceUpdate(this, (this->animIndex & 0xFC) + uVar1);
|
||||
}
|
||||
} else {
|
||||
uVar1 = ((param_2 + 4) & 0x18) >> 3;
|
||||
if (uVar1 != this->animationState) {
|
||||
this->animationState = uVar1;
|
||||
InitAnimationForceUpdate(this, (this->animIndex & 0xFC) + uVar1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080326FC(Entity* this) {
|
||||
this->field_0x74.HWORD = gUnk_080CE7F0[Random() & 0xF];
|
||||
}
|
||||
|
||||
u32 sub_0803271C(Entity* this) {
|
||||
this->field_0x74.HWORD--;
|
||||
if (this->field_0x74.HWORD == 0) {
|
||||
sub_08032784(this);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_08032740(Entity* this) {
|
||||
this->action = 1;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
sub_08032650(this);
|
||||
}
|
||||
|
||||
void sub_0803275C(Entity* this) {
|
||||
this->action = 5;
|
||||
this->actionDelay = 0x2D;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
sub_0803269C(this, this->direction);
|
||||
sub_080327E0(this);
|
||||
}
|
||||
|
||||
void sub_08032784(Entity* this) {
|
||||
this->action = 2;
|
||||
InitAnimationForceUpdate(this, this->animationState + 8);
|
||||
}
|
||||
|
||||
void sub_08032794(Entity* this) {
|
||||
Entity* target;
|
||||
s8* temp;
|
||||
|
||||
target = CreateFx(this, 0x11, 0x40);
|
||||
if (target != NULL) {
|
||||
temp = &gUnk_080CE810[this->animationState * 2];
|
||||
PositionRelative(this, target, temp[0] << 0x10, temp[1] << 0x10);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080327C8(Entity* this) {
|
||||
Entity* child;
|
||||
|
||||
child = sub_0804A98C(this, 11, 0);
|
||||
if (child != NULL) {
|
||||
child->parent = this;
|
||||
this->attachedEntity = child;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080327E0(Entity* this) {
|
||||
if (this->attachedEntity != NULL) {
|
||||
this->attachedEntity->parent = NULL;
|
||||
this->attachedEntity = NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void sub_0804AA30(Entity*, void *);
|
||||
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*);
|
||||
extern u32 sub_0806FCB8(Entity*, s32, s32, u32);
|
||||
extern u32 sub_08049FA0(Entity*);
|
||||
extern u32 sub_08049EE4(Entity*);
|
||||
|
||||
extern void (*gUnk_080CB69C[])(Entity*);
|
||||
extern void (*gUnk_080CB6B4[])(Entity*);
|
||||
extern void (*gUnk_080CB6C4[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CB6D0[];
|
||||
extern u16 gUnk_080CB6D6[];
|
||||
extern u8 gUnk_080CB6F6[];
|
||||
|
||||
void Keese(Entity *this)
|
||||
{
|
||||
gUnk_080CB69C[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void sub_08021D80(Entity *this)
|
||||
{
|
||||
gUnk_080CB6B4[this->action](this);
|
||||
}
|
||||
|
||||
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_08021DCC(Entity *this)
|
||||
{
|
||||
this->previousActionFlag = 2;
|
||||
}
|
||||
|
||||
void sub_08021DD4(Entity *this)
|
||||
{
|
||||
sub_0806F4E8(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_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 {
|
||||
iVar1 = sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70);
|
||||
if (iVar1 != 0) {
|
||||
sub_08021EF0(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_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))) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0x1e;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
else {
|
||||
if (sub_08049FA0(this) != 0) {
|
||||
this->direction = Random() & 0x1f;
|
||||
}
|
||||
else {
|
||||
this->direction = sub_08049EE4(this);
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,394 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "trig.h"
|
||||
#include "random.h"
|
||||
#include "player.h"
|
||||
|
||||
#include "lakitu.h"
|
||||
|
||||
void Lakitu(Entity *this) {
|
||||
EnemyFunctionHandler(this, gUnk_080D0110);
|
||||
|
||||
SetChildOffset(this, 0, 1, -16);
|
||||
}
|
||||
|
||||
void Lakitu_DoAction(Entity *this) {
|
||||
if (this->action != 0 && this->action != 7) {
|
||||
sub_0803CAD0(this);
|
||||
}
|
||||
|
||||
LakituActionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0803C784(Entity *this) {
|
||||
if ((this->bitfield & 0x7f) == 0x1d) {
|
||||
this->field_0x20 = 0x20000;
|
||||
|
||||
sub_0803CBAC(this);
|
||||
}
|
||||
else {
|
||||
if (this->damageType == 0x43) {
|
||||
Entity *fx = CreateFx(this, 2, 0);
|
||||
|
||||
if (fx != NULL) {
|
||||
u32 angle = (this->field_0x3e ^ 0x10) << 3;
|
||||
s32 sine;
|
||||
|
||||
sine = gSineTable[angle];
|
||||
if (sine < 0) {
|
||||
sine += 0x1f;
|
||||
}
|
||||
|
||||
fx->x.HALF.HI += sine >> 5;
|
||||
|
||||
sine = gSineTable[angle + 0x40];
|
||||
if (sine < 0) {
|
||||
sine += 0x1f;
|
||||
}
|
||||
|
||||
fx->y.HALF.HI -= sine >> 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x43) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
|
||||
sub_0804AA30(this, gUnk_080D0110);
|
||||
}
|
||||
|
||||
void sub_0803C820(Entity *this) {
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080D0148[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803C844(Entity *this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 0x3c;
|
||||
}
|
||||
|
||||
void sub_0803C850(Entity *this) {
|
||||
Entity *cloud = this->attachedEntity;
|
||||
if (cloud != NULL) {
|
||||
cloud->spriteOffsetX = this->spriteOffsetX;
|
||||
}
|
||||
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_0803C86C(Entity *this) {
|
||||
sub_0803CBAC(this);
|
||||
this->attachedEntity = NULL;
|
||||
}
|
||||
|
||||
void Lakitu_Initialize(Entity *this) {
|
||||
Entity *cloud = sub_0804A98C(this, 17, 0);
|
||||
if (cloud == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
cloud->parent = this;
|
||||
this->attachedEntity = cloud;
|
||||
|
||||
sub_0804A720(this);
|
||||
|
||||
this->action = HIDDEN;
|
||||
|
||||
this->height.HALF.HI = -2;
|
||||
|
||||
this->spriteOffsetY = 0xff;
|
||||
|
||||
this->field_0x74.HWORD = this->x.HALF.HI;
|
||||
this->field_0x76.HWORD = this->y.HALF.HI;
|
||||
}
|
||||
|
||||
void Lakitu_Hide(Entity *this) {
|
||||
sub_0803CA84(this, 0);
|
||||
|
||||
if (sub_0803CA4C(this)) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Lakitu_EndHide(Entity *this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
|
||||
if (this->frames.b.f3) {
|
||||
this->action = IDLE;
|
||||
this->actionDelay = 0x3c;
|
||||
|
||||
this->damageType = 0x42;
|
||||
|
||||
InitAnimationForceUpdate(this, this->animationState + 4);
|
||||
}
|
||||
}
|
||||
|
||||
void Lakitu_Idle(Entity *this) {
|
||||
if (sub_0803CB04(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sub_0803CA4C(this)) {
|
||||
this->action = BEGIN_HIDE;
|
||||
|
||||
this->damageType = 0x43;
|
||||
InitAnimationForceUpdate(this, this->animationState + 0xc);
|
||||
}
|
||||
else {
|
||||
sub_0803CA84(this, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void Lakitu_BeginHide(Entity *this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
|
||||
if (this->frames.b.f3 != 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
}
|
||||
}
|
||||
|
||||
void Lakitu_Lightning(Entity *this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
|
||||
if (this->frames.b.f3 == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Lakitu_SpawnLightning(this);
|
||||
|
||||
this->action = LIGHTNING_DELAY;
|
||||
this->damageType = 0x42;
|
||||
|
||||
if ((Random() & 1) && !this->field_0x78.HALF.HI) {
|
||||
this->actionDelay = 0xf;
|
||||
|
||||
this->field_0x78.HALF.HI = TRUE;
|
||||
}
|
||||
else {
|
||||
this->actionDelay = 0x1e;
|
||||
|
||||
this->field_0x78.HALF.HI = FALSE;
|
||||
|
||||
InitAnimationForceUpdate(this->attachedEntity, this->animationState);
|
||||
}
|
||||
}
|
||||
|
||||
void Lakitu_LightningDelay(Entity *this) {
|
||||
this->actionDelay--;
|
||||
|
||||
if (this->actionDelay != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->field_0x78.HALF.HI == 1) {
|
||||
sub_0803CB34(this);
|
||||
}
|
||||
else {
|
||||
this->action = IDLE;
|
||||
this->actionDelay = 0xb4;
|
||||
|
||||
InitAnimationForceUpdate(this, this->animationState + 4);
|
||||
}
|
||||
}
|
||||
|
||||
void Lakitu_Cloudless(Entity *this) {
|
||||
if (sub_08003FC4(this, 0x1800) == 0 && this->animIndex <= 19) {
|
||||
InitAnimationForceUpdate(this, this->animationState + 20);
|
||||
|
||||
this->spritePriority.b1 = 0;
|
||||
}
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_0803CC08(this);
|
||||
}
|
||||
|
||||
bool32 sub_0803CA4C(Entity *this) {
|
||||
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
|
||||
if (sub_080041A0(this, &gPlayerEntity, 0x70, 0x50)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_0803CA84(Entity *this, u32 unkParameter) {
|
||||
u32 altAnimState = GetFacingDirection(this, &gPlayerEntity);
|
||||
|
||||
if (((altAnimState - 3) & 7) > 2 || ((this->animationState - (altAnimState >> 3)) & 3) > 1) {
|
||||
u32 intermediate = (altAnimState + 4) & 0x18;
|
||||
altAnimState = intermediate >> 3;
|
||||
|
||||
if (altAnimState != this->animationState) {
|
||||
this->animationState = altAnimState;
|
||||
|
||||
InitAnimationForceUpdate(this, altAnimState + unkParameter);
|
||||
InitAnimationForceUpdate(this->attachedEntity, altAnimState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803CAD0(Entity *this) {
|
||||
if (sub_0806FCB8(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) {
|
||||
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x74.HWORD, this->field_0x76.HWORD);
|
||||
|
||||
sub_080AEFE0(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_0803CB04(Entity *this) {
|
||||
bool32 returnValue;
|
||||
u8 delay;
|
||||
|
||||
delay = --this->actionDelay;
|
||||
if (delay != 0) {
|
||||
returnValue = 0;
|
||||
}
|
||||
else {
|
||||
sub_0803CB34(this);
|
||||
this->field_0x78.HALF.HI = delay;
|
||||
|
||||
InitAnimationForceUpdate(this->attachedEntity, this->animationState + 4);
|
||||
returnValue = 1;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
void sub_0803CB34(Entity *this) {
|
||||
this->action = LIGHTNING_THROW;
|
||||
this->damageType = 0xa6;
|
||||
|
||||
this->field_0x78.HALF.LO = GetFacingDirection(this, &gPlayerEntity);
|
||||
|
||||
InitAnimationForceUpdate(this, this->animationState + 8);
|
||||
}
|
||||
|
||||
void Lakitu_SpawnLightning(Entity *this) {
|
||||
Entity *lightning;
|
||||
const OffsetCoords *offset;
|
||||
|
||||
lightning = sub_0804A98C(this, 18, 0);
|
||||
|
||||
if (lightning == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
offset = &gUnk_080D0154[this->animationState];
|
||||
|
||||
lightning->direction = this->field_0x78.HALF.LO;
|
||||
|
||||
PositionRelative(this, lightning, offset->x << 16, offset->y << 16);
|
||||
|
||||
sub_08004488(0x193);
|
||||
}
|
||||
|
||||
void sub_0803CBAC(Entity *this) {
|
||||
Entity *cloud;
|
||||
|
||||
cloud = this->attachedEntity;
|
||||
if (cloud != NULL) {
|
||||
cloud->flags |= 0x80;
|
||||
cloud->damageType = 0x43;
|
||||
}
|
||||
|
||||
this->action = CLOUDLESS;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
|
||||
this->spritePriority.b1 = 1;
|
||||
|
||||
this->flags2 &= 0x7b;
|
||||
|
||||
this->damageType = 0x42;
|
||||
|
||||
InitAnimationForceUpdate(this, this->animationState + 16);
|
||||
}
|
||||
|
||||
void sub_0803CC08(Entity *this) {
|
||||
Entity *cloud;
|
||||
Entity *fx;
|
||||
|
||||
cloud = this->attachedEntity;
|
||||
if (cloud == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((u32)(cloud->height.HALF.HI - this->height.HALF.HI) > 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->field_0x20 >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sub_0806FCB8(this, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) {
|
||||
return;
|
||||
}
|
||||
|
||||
fx = CreateFx(this, 2, 0);
|
||||
if (fx != NULL) {
|
||||
fx->x.HALF.HI += 6;
|
||||
fx->y.HALF.HI += 6;
|
||||
}
|
||||
|
||||
fx = CreateFx(this, 2, 0);
|
||||
if (fx != NULL) {
|
||||
fx->x.HALF.HI -= 6;
|
||||
fx->y.HALF.HI += 6;
|
||||
}
|
||||
|
||||
fx = CreateFx(this, 2, 0);
|
||||
if (fx != NULL) {
|
||||
fx->x.HALF.HI += 6;
|
||||
fx->y.HALF.HI -= 6;
|
||||
}
|
||||
|
||||
fx = CreateFx(this, 2, 0);
|
||||
if (fx != NULL) {
|
||||
fx->x.HALF.HI -= 6;
|
||||
fx->y.HALF.HI -= 6;
|
||||
}
|
||||
|
||||
this->attachedEntity = NULL;
|
||||
DeleteEntity(cloud);
|
||||
}
|
||||
|
||||
void (*const gUnk_080D0110[])(Entity *) = {
|
||||
Lakitu_DoAction,
|
||||
sub_0803C784,
|
||||
sub_08001324,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
sub_0803C820,
|
||||
};
|
||||
|
||||
void (*const LakituActionFuncs[])(Entity *) = {
|
||||
Lakitu_Initialize,
|
||||
Lakitu_Hide,
|
||||
Lakitu_EndHide,
|
||||
Lakitu_Idle,
|
||||
Lakitu_BeginHide,
|
||||
Lakitu_Lightning,
|
||||
Lakitu_LightningDelay,
|
||||
Lakitu_Cloudless,
|
||||
};
|
||||
|
||||
void (*const gUnk_080D0148[])(Entity *) = {
|
||||
sub_0803C844,
|
||||
sub_0803C850,
|
||||
sub_0803C86C,
|
||||
};
|
||||
|
||||
const OffsetCoords gUnk_080D0154[] = {
|
||||
{ 0x00, 0xEE },
|
||||
{ 0x12, 0x00 },
|
||||
{ 0x00, 0x08 },
|
||||
{ 0xEE, 0x00 },
|
||||
};
|
||||
@@ -0,0 +1,174 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
|
||||
extern u32 GetNextFunction(Entity *);
|
||||
|
||||
extern void sub_0804A7D4(Entity *);
|
||||
extern void sub_08001242(Entity *);
|
||||
|
||||
extern void (*const gUnk_080D0418[6])(Entity *);
|
||||
extern void (*const gUnk_080D0430[3])(Entity *);
|
||||
extern void (*const gUnk_080D043C[3])(Entity *);
|
||||
|
||||
extern bool32 sub_0806F3E4(Entity *);
|
||||
extern bool32 sub_0806F520(Entity *);
|
||||
|
||||
extern void sub_0800449C(Entity *, u32);
|
||||
extern void sub_0803CE14(Entity *);
|
||||
extern void sub_0803CE3C(Entity *);
|
||||
extern Entity *GetCurrentRoomProperty(u8);
|
||||
extern void sub_0806F4E8(Entity *);
|
||||
extern void sub_0806F69C(Entity *);
|
||||
extern void sub_08079D84(void);
|
||||
extern void sub_080A2CC0(Entity *, Entity **, u16 *);
|
||||
|
||||
void LakituCloud(Entity *this) {
|
||||
gUnk_080D0418[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void sub_0803CCD4(Entity *this) {
|
||||
gUnk_080D0430[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0803CCEC(Entity *this) {
|
||||
this->field_0x42 = 0;
|
||||
sub_0803CCD4(this);
|
||||
}
|
||||
|
||||
void sub_0803CCFC(Entity *this) {
|
||||
if (sub_0806F520(this) == 0) {
|
||||
if (this->previousActionFlag == 2) {
|
||||
sub_0803CE3C(this);
|
||||
}
|
||||
}
|
||||
else {
|
||||
gUnk_080D043C[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803CD2C(Entity *this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 0x3c;
|
||||
}
|
||||
|
||||
void sub_0803CD38(Entity *this) {
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_0803CD40(Entity *this) {
|
||||
if (!sub_0806F3E4(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ModHealth(-2);
|
||||
|
||||
sub_0800449C(&gPlayerEntity, 122);
|
||||
sub_08079D84();
|
||||
|
||||
sub_0803CE3C(this);
|
||||
}
|
||||
|
||||
void sub_0803CD6C(Entity *this) {
|
||||
Entity *lakitu;
|
||||
|
||||
this->action = 1;
|
||||
this->height.HALF.HI = -2;
|
||||
|
||||
// Set parent to lakitu
|
||||
lakitu = GetCurrentRoomProperty(this->entityType.form);
|
||||
this->attachedEntity = lakitu;
|
||||
this->parent = lakitu;
|
||||
|
||||
this->field_0x78.HWORD = this->x.HALF.HI;
|
||||
this->field_0x7a.HWORD = this->y.HALF.HI;
|
||||
|
||||
InitAnimationForceUpdate(this, 4);
|
||||
|
||||
sub_0803CE14(this);
|
||||
}
|
||||
|
||||
void sub_0803CDA8(Entity *this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
|
||||
if ((this->direction & 0x80) == 0) {
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
|
||||
if (--this->field_0x74.HWORD << 0x10 == 0) {
|
||||
sub_0803CE14(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803CDD8(Entity *this) {
|
||||
u8 one;
|
||||
u8 draw;
|
||||
|
||||
draw = this->spriteSettings.b.draw;
|
||||
one = 1;
|
||||
this->spriteSettings.b.draw = draw ^ one;
|
||||
|
||||
this->actionDelay--;
|
||||
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
|
||||
this->flags |= 0x80;
|
||||
|
||||
this->spriteSettings.b.draw = one;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803CE14(Entity *this) {
|
||||
u8 direction;
|
||||
|
||||
sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD);
|
||||
|
||||
direction = this->direction;
|
||||
if (direction & 0x80) {
|
||||
return;
|
||||
}
|
||||
|
||||
direction = direction / 8 + 4;
|
||||
|
||||
InitAnimationForceUpdate(this, direction);
|
||||
}
|
||||
|
||||
void sub_0803CE3C(Entity *this) {
|
||||
CreateFx(this, 2, 0);
|
||||
|
||||
this->action = 2;
|
||||
this->actionDelay = 60;
|
||||
|
||||
this->flags &= 0x7f;
|
||||
|
||||
this->field_0x3a &= 0xfb;
|
||||
|
||||
this->x.HALF.HI = this->field_0x78.HWORD;
|
||||
this->y.HALF.HI = this->field_0x7a.HWORD;
|
||||
|
||||
this->attachedEntity = this->parent;
|
||||
|
||||
sub_0803CE14(this);
|
||||
}
|
||||
|
||||
void (*const gUnk_080D0418[])(Entity *) = {
|
||||
sub_0803CCD4,
|
||||
sub_0803CCD4,
|
||||
sub_0803CCEC,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
sub_0803CCFC,
|
||||
};
|
||||
|
||||
void (*const gUnk_080D0430[])(Entity *) = {
|
||||
sub_0803CD6C,
|
||||
sub_0803CDA8,
|
||||
sub_0803CDD8,
|
||||
};
|
||||
|
||||
void (*const gUnk_080D043C[])(Entity *) = {
|
||||
sub_0803CD2C,
|
||||
sub_0803CD38,
|
||||
sub_0803CD40,
|
||||
};
|
||||
@@ -0,0 +1,179 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#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);
|
||||
extern void sub_0804A720(Entity*);
|
||||
bool32 sub_0801FE68(Entity*, s32);
|
||||
extern void sub_0801FED4(Entity*);
|
||||
extern u32 sub_080002D4(s32, s32, u32);
|
||||
extern u32 sub_080002BC(s32, s32, u32);
|
||||
extern u32 sub_08049FDC(Entity*, u32);
|
||||
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 s16 gSineTable[];
|
||||
void Leever(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CA49C);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void sub_0801FC28(Entity* this) {
|
||||
gUnk_080CA4B4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0801FC40(Entity* this) {
|
||||
if (this->bitfield == 0x80) {
|
||||
if (this->action == 3) {
|
||||
this->field_0x74.HWORD = 1;
|
||||
}
|
||||
} else {
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CA49C);
|
||||
}
|
||||
|
||||
void sub_0801FC7C(Entity* this) {
|
||||
if ((this->entityType).form == 0) {
|
||||
sub_0804A7D4(this);
|
||||
} else {
|
||||
CreateDeathFx(this, 0xf1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FC9C(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->actionDelay = Random();
|
||||
}
|
||||
|
||||
void sub_0801FCB0(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
if (sub_0801FE68(this, Random() & 0x1f) != 0) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA4C8[Random() & 1]) & 0x1f;
|
||||
InitializeAnimation(this, 0);
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
} else {
|
||||
this->actionDelay = (Random() & 0x18) + 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FD2C(Entity* this) {
|
||||
|
||||
GetNextFrame(this);
|
||||
|
||||
if (this->frames.b.f3 != 0) {
|
||||
this->action = 3;
|
||||
if (this->entityType.form == 0) {
|
||||
this->field_0x74.HWORD = 0xb4;
|
||||
} else {
|
||||
this->field_0x74.HWORD = 0x6e;
|
||||
}
|
||||
InitializeAnimation(this, 2);
|
||||
} else if (this->frames.b.f0 != 0) {
|
||||
this->frames.all &= 0xfe;
|
||||
this->flags |= 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FD80(Entity* this) {
|
||||
|
||||
sub_0801FED4(this);
|
||||
GetNextFrame(this);
|
||||
|
||||
if (--this->field_0x74.HWORD == 0) {
|
||||
this->action = 4;
|
||||
this->flags &= 0x7f;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FDB4(Entity* this) {
|
||||
sub_0801FED4(this);
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0xf0;
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) {
|
||||
u32 uVar3;
|
||||
u16* puVar4;
|
||||
|
||||
if (sub_080002D4(x, y, gUnk_020000B0->collisionLayer) != 0) {
|
||||
return 0;
|
||||
} else {
|
||||
uVar3 = sub_080002BC(x, y, gUnk_020000B0->collisionLayer);
|
||||
for (puVar4 = gUnk_080CA4CA; *puVar4 != (u16)-1;) {
|
||||
if (*puVar4++ == uVar3) {
|
||||
ent->x.HALF.HI = (x & 0xfff0) + 8;
|
||||
ent->y.HALF.HI = (y & 0xfff0) + 8;
|
||||
ent->collisionLayer = gUnk_020000B0->collisionLayer;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_0801FE68(Entity* ent, s32 arg2) {
|
||||
s32 sin, cos;
|
||||
s32 x, y;
|
||||
u32 i;
|
||||
|
||||
if (sub_08049FDC(ent, 1) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
x = gUnk_020000B0->x.WORD;
|
||||
y = gUnk_020000B0->y.WORD;
|
||||
sin = gSineTable[arg2 * 8] << 11;
|
||||
cos = gSineTable[arg2 * 8 + 0x40] << 11;
|
||||
for (i = 0; i < 8; i++) {
|
||||
x += sin;
|
||||
y += -cos;
|
||||
if (sub_0801FDE4(ent, x >> 0x10, y >> 0x10) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
extern u32 sub_0800132C(Entity*, Entity*);
|
||||
|
||||
void sub_0801FED4(Entity* this) {
|
||||
s16 sVar2;
|
||||
|
||||
if (sub_08049FDC(this, 1) == 0) {
|
||||
this->field_0x74.HWORD = 1;
|
||||
}
|
||||
sVar2 = (this->frames.all & 0xf) * 0x20;
|
||||
this->nonPlanarMovement = sVar2;
|
||||
if (this->entityType.form == 0) {
|
||||
if ((this->field_0xf++ & 0xf) == 0) {
|
||||
sub_08004596(this, sub_0800132C(this, gUnk_020000B0));
|
||||
}
|
||||
} else {
|
||||
this->nonPlanarMovement = sVar2 + 0x40;
|
||||
if ((this->field_0xf++ & 0x7) == 0) {
|
||||
sub_08004596(this, sub_0800132C(this, gUnk_020000B0));
|
||||
}
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void EnemyFunctionHandler(Entity*, void (*const func[])(Entity*));
|
||||
extern void sub_0804A7D4(Entity*);
|
||||
extern void sub_0804A720(Entity*);
|
||||
extern void sub_08045678(Entity*);
|
||||
extern void sub_08045678(Entity*);
|
||||
|
||||
extern void (*const gUnk_080D1868[])(Entity*);
|
||||
extern void (*const gUnk_080D1880[])(Entity*);
|
||||
|
||||
void MiniFireballGuy(Entity *this)
|
||||
{
|
||||
EnemyFunctionHandler(this, gUnk_080D1868);
|
||||
}
|
||||
|
||||
void sub_080455BC(Entity *this)
|
||||
{
|
||||
gUnk_080D1880[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080455D4(Entity *this)
|
||||
{
|
||||
sub_0804AA30(this, gUnk_080D1868);
|
||||
}
|
||||
|
||||
void sub_080455E4(Entity *this)
|
||||
{
|
||||
if ((this != this->parent) && (this->parent != NULL)) {
|
||||
this->field_0x6c.HALF.LO &= 0x7f;
|
||||
this->parent->attachedEntity = this->attachedEntity;
|
||||
this->attachedEntity->parent = this->parent;
|
||||
}
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
|
||||
void nullsub_23(Entity* this) {}
|
||||
|
||||
void sub_08045618(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->field_0x3c = this->field_0x3c | 0x10;
|
||||
sub_0804A720(this);
|
||||
InitializeAnimation(this, 1);
|
||||
sub_08045678(this);
|
||||
}
|
||||
|
||||
void sub_08045654(Entity *this)
|
||||
{
|
||||
sub_080AEFE0(this);
|
||||
GetNextFrame(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
sub_08045678(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08045678(Entity *this)
|
||||
{
|
||||
|
||||
this->field_0x20 = 0x1c000;
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
this->actionDelay = Random() & 3;
|
||||
if ((sub_08049FA0(this) == 0) && (Random() & 3)) {
|
||||
this->direction = (sub_08049EE4(this) - 4 + (Random() & 8)) & 0x18;
|
||||
}
|
||||
else {
|
||||
this->direction = Random() & 0x18;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
#include "global.h"
|
||||
#include "entity.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 void(*gOctorok[2]);
|
||||
extern void (*gOctorokIdle[4])(Entity*);
|
||||
extern void (*gUnk_080CA158[4])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CA170[8];
|
||||
// Main
|
||||
void Octorok(Entity* ent) {
|
||||
EnemyFunctionHandler(ent, gOctorok);
|
||||
SetChildOffset(ent, 0, 1, -16);
|
||||
}
|
||||
|
||||
// Idle
|
||||
void sub_0801EAD0(Entity* ent) {
|
||||
gOctorokIdle[ent->action](ent);
|
||||
}
|
||||
|
||||
// Touch player
|
||||
void sub_0801EAE8(Entity* ent) {
|
||||
if (ent->field_0x43 != 0) {
|
||||
sub_0804A9FC(ent, 28);
|
||||
}
|
||||
sub_0804AA30(ent, gOctorok);
|
||||
}
|
||||
|
||||
// Death
|
||||
void sub_0801EB0C(Entity* ent) {
|
||||
if ((ent->entityType).form == 0) {
|
||||
sub_0804A7D4(ent);
|
||||
} else {
|
||||
CreateDeathFx(ent, 241, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EB2C(Entity* ent) {
|
||||
s32 iVar1;
|
||||
|
||||
if ((ent->previousActionFlag < 3) && (iVar1 = sub_0806F520(ent), iVar1 == 0)) {
|
||||
sub_0801ECFC(ent);
|
||||
InitializeAnimation(ent, ent->animationState);
|
||||
} else {
|
||||
gUnk_080CA158[ent->previousActionFlag](ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801EB68(Entity* ent) {
|
||||
ent->previousActionFlag = 1;
|
||||
ent->field_0x1d = 60;
|
||||
}
|
||||
|
||||
void sub_0801EB74(Entity* ent) {
|
||||
sub_0806F4E8(ent);
|
||||
}
|
||||
|
||||
void sub_0801EB7C(Entity* ent) {
|
||||
sub_0806F3E4(ent);
|
||||
}
|
||||
|
||||
void sub_0801EB84(Entity* ent) {
|
||||
ent->flags = ent->flags & 127;
|
||||
UpdateAnimationVariableFrames(ent, 2);
|
||||
}
|
||||
|
||||
void nullsub_3() {
|
||||
}
|
||||
|
||||
void sub_0801EB9C(Entity* ent) {
|
||||
if ((ent->flags & 128) != 0) {
|
||||
ent->flags = ent->flags | 128;
|
||||
ent->field_0x3a = ent->field_0x3a & 251;
|
||||
} else {
|
||||
ent->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);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_0801EBC8(Entity* ent) {
|
||||
asm(".include \"asm/octorok/sub_0801EBC8.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0801EBF4(Entity* ent) {
|
||||
u32 uVar2;
|
||||
|
||||
if (--ent->actionDelay == 0) {
|
||||
ent->action = 2;
|
||||
uVar2 = Random();
|
||||
ent->actionDelay = gUnk_080CA170[uVar2 & 3];
|
||||
sub_0801ED14(ent);
|
||||
}
|
||||
GetNextFrame(ent);
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "structures.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void sub_080293DC(Entity*);
|
||||
extern void sub_080296D8(Entity*);
|
||||
extern void sub_08029770(Entity*);
|
||||
extern void sub_080297F0(Entity*);
|
||||
extern void sub_080296C8(Entity*);
|
||||
extern void sub_0802969C(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CCC00[])(Entity*);
|
||||
extern void (*const gUnk_080CCC18[])(Entity*);
|
||||
extern void (*const gUnk_080CCC3C[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CCC34[];
|
||||
extern u8 gUnk_080CCC47[];
|
||||
extern BoundingBox gUnk_080FD260;
|
||||
|
||||
void RupeeLike(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
if (this->entityType.parameter == 0) {
|
||||
uVar1 = (u8)sub_080043E8(this);
|
||||
if (uVar1 != 0) {
|
||||
if (this->action == 4) {
|
||||
sub_080296D8(this);
|
||||
}
|
||||
sub_08001290(this, uVar1);
|
||||
} else {
|
||||
gUnk_080CCC00[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
} else {
|
||||
sub_080293DC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029300(Entity* this) {
|
||||
gUnk_080CCC18[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08029318(Entity* this) {
|
||||
if (this->damageType == 0x8e) {
|
||||
sub_08029770(this);
|
||||
} else {
|
||||
if (this->action == 4) {
|
||||
sub_080296D8(this);
|
||||
}
|
||||
if (*(u8*)(*(u32*)&this->field_0x4c + 8) == 1) {
|
||||
if (this->action == 2) {
|
||||
InitializeAnimation(this, 0);
|
||||
InitializeAnimation(this->attachedEntity, 4);
|
||||
}
|
||||
this->action = 4;
|
||||
this->actionDelay = 0x3c;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x82.HALF.HI = 0x41;
|
||||
this->flags2 &= 0xfc;
|
||||
this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1;
|
||||
sub_08004488(0x104);
|
||||
} else {
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
}
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CCC00);
|
||||
}
|
||||
|
||||
void sub_080293B4(Entity* this) {
|
||||
CreateDeathFx(this, 0xff, gUnk_080CCC34[this->cutsceneBeh.HALF.LO * 3 + this->entityType.form]);
|
||||
}
|
||||
|
||||
void nullsub_141() {
|
||||
}
|
||||
|
||||
void sub_080293DC(Entity* this) {
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
this->y.HALF.HI++;
|
||||
this->height.HALF.HI--;
|
||||
gUnk_080CCC3C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0802940C(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateEnemy(0x17, this->entityType.form);
|
||||
if (ent != NULL) {
|
||||
sub_0804A720(this);
|
||||
ent->parent = this;
|
||||
ent->entityType.parameter = 1;
|
||||
this->attachedEntity = ent;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
this->cutsceneBeh.HALF.LO = 0;
|
||||
this->field_0x82.HALF.LO = this->palette.b.b0;
|
||||
sub_080297F0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802944C(Entity* this) {
|
||||
sub_080296C8(this);
|
||||
if ((this->field_0x80.HALF.HI != 0) && sub_08049FDC(this, 1)) {
|
||||
sub_08029770(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029474(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
sub_080296C8(this);
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 8;
|
||||
bVar1 = GetFacingDirection(this, &gPlayerEntity);
|
||||
this->direction = bVar1;
|
||||
this->animationState = (bVar1 << 0x18) >> 0x1c;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
InitializeAnimation(this->attachedEntity, this->animationState + 4);
|
||||
} else {
|
||||
if (this->frames.all == 1) {
|
||||
this->frames.all = 0;
|
||||
this->flags |= 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080294D4(Entity* this) {
|
||||
if (sub_08049FDC(this, 1) != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 8;
|
||||
sub_08004596(this, GetFacingDirection(this, &gPlayerEntity));
|
||||
sub_0802969C(this);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
sub_080296C8(this);
|
||||
} else {
|
||||
this->action = 6;
|
||||
this->flags &= 0x7f;
|
||||
InitializeAnimation(this, 3);
|
||||
InitializeAnimation(this->attachedEntity, 7);
|
||||
}
|
||||
}
|
||||
|
||||
extern s8 gUnk_080CCC44[];
|
||||
|
||||
void sub_0802953C(Entity* this) {
|
||||
u8* pbVar3;
|
||||
|
||||
sub_080296C8(this);
|
||||
sub_080296C8(this);
|
||||
if (sub_0807953C() != 0) {
|
||||
this->field_0xf++;
|
||||
}
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
}
|
||||
if (((this->field_0xf > 0x2d) || (gUnk_02002A40.stats.rupees == 0)) && (this->actionDelay == 0)) {
|
||||
sub_080296D8(this);
|
||||
} else {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
|
||||
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
|
||||
gPlayerEntity.spriteOffsetX = pbVar3[0];
|
||||
gPlayerEntity.spriteOffsetY = pbVar3[1] - 1;
|
||||
gPlayerEntity.spritePriority.b1 = 0;
|
||||
if (--this->field_0x82.HALF.HI == 0) {
|
||||
this->field_0x82.HALF.HI = 0x41;
|
||||
if (gUnk_02002A40.stats.rupees != 0) {
|
||||
ModRupees(gUnk_080CCC44[this->entityType.form]);
|
||||
this->cutsceneBeh.HALF.LO = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029610(Entity* this) {
|
||||
if (--this->field_0xf == 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
sub_080296C8(this);
|
||||
}
|
||||
|
||||
void sub_08029630(Entity* this) {
|
||||
sub_080296C8(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->field_0x80.HALF.HI = 1;
|
||||
this->attachedEntity->spriteSettings.b.draw = FALSE;
|
||||
sub_080297F0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029660(Entity* this) {
|
||||
u32 temp;
|
||||
this->action = 1;
|
||||
this->spriteIndex = 0xd1;
|
||||
temp = gUnk_080CCC47[this->entityType.form];
|
||||
this->palette.b.b0 = temp;
|
||||
}
|
||||
|
||||
void sub_08029688(Entity* this) {
|
||||
if (this->parent->next == NULL) {
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802969C(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
if ((this->direction & 0xf) != 0) {
|
||||
|
||||
bVar1 = this->direction >> 4;
|
||||
if (bVar1 != this->animationState) {
|
||||
this->animationState = bVar1;
|
||||
InitializeAnimation(this, bVar1);
|
||||
InitializeAnimation(this->attachedEntity, bVar1 + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080296C8(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(this->attachedEntity);
|
||||
}
|
||||
|
||||
void sub_080296D8(Entity* this) {
|
||||
gPlayerState.jumpStatus = 0x41;
|
||||
gPlayerState.flags.all &= 0xffffffef;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
gPlayerEntity.field_0x20 = 0x18000;
|
||||
gPlayerEntity.hurtBlinkTime = 0xa6;
|
||||
gPlayerEntity.height.HALF.HI = -2;
|
||||
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||
gPlayerEntity.spritePriority.b1 = this->field_0x80.HALF.LO;
|
||||
gPlayerEntity.spriteOffsetY = 0;
|
||||
gPlayerEntity.nonPlanarMovement = 0x140;
|
||||
this->action = 5;
|
||||
this->field_0xf = 0x3c;
|
||||
this->flags2 |= 3;
|
||||
if ((s8)this->hurtBlinkTime == 0) {
|
||||
this->hurtBlinkTime = 0xf4;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029770(Entity* this) {
|
||||
u32 temp;
|
||||
if (LoadFixedGFX(this, 0x73) != 0) {
|
||||
this->action = 2;
|
||||
this->flags = this->flags & 0x7f;
|
||||
this->spriteIndex = 0xd1;
|
||||
this->spritePriority.b1 = 3;
|
||||
temp = this->field_0x82.HALF.LO;
|
||||
this->palette.b.b0 = temp;
|
||||
this->damageType = 0x8d;
|
||||
this->boundingBox = &gUnk_080FD260;
|
||||
InitializeAnimation(this, 2);
|
||||
this->attachedEntity->spriteSettings.b.draw = TRUE;
|
||||
InitializeAnimation(this->attachedEntity, 6);
|
||||
sub_080A29BC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080297F0(Entity* this) {
|
||||
u32 temp;
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x78;
|
||||
this->flags = this->flags | 0x80;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->damageType = 0x8e;
|
||||
sub_080AE068(this);
|
||||
this->spriteIndex = 0x143;
|
||||
temp = gUnk_080CCC47[this->entityType.form];
|
||||
this->palette.b.b0 = temp;
|
||||
this->spriteVramOffset = 9;
|
||||
InitializeAnimation(this, 0x54);
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
typedef struct {
|
||||
void* field_0x0;
|
||||
void* entityCount;
|
||||
u8 freezeTime;
|
||||
} EntityHandler;
|
||||
|
||||
extern void EnemyFunctionHandler(Entity*, void*);
|
||||
extern void SetChildOffset(Entity*, u32, u32, u32);
|
||||
extern void sub_0804AA30(Entity*, void*);
|
||||
extern void sub_0804A9FC(Entity*, u32);
|
||||
extern void sub_0804A720(Entity*);
|
||||
extern void sub_08044FF8(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern u32 sub_0806FA04(u32, u32);
|
||||
extern u32 sub_08049FA0(Entity*);
|
||||
extern u32 sub_08049EE4(Entity*);
|
||||
extern u32 sub_080AEF88(void);
|
||||
|
||||
extern void (*gUnk_080D16BC[])(Entity*);
|
||||
extern void (*gUnk_080D16A4[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080D16D0;
|
||||
extern EntityHandler gUnk_03003DB8;
|
||||
|
||||
void Slime(Entity* this)
|
||||
|
||||
{
|
||||
EnemyFunctionHandler(this, &gUnk_080D16A4);
|
||||
SetChildOffset(this, 0, 1, -12);
|
||||
}
|
||||
|
||||
void sub_08044F70(Entity* this) {
|
||||
gUnk_080D16BC[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08044F88(Entity* this) {
|
||||
if ((this->currentHealth != 0) && (this->cutsceneBeh.HALF.LO != this->currentHealth)) {
|
||||
this->action = 4;
|
||||
} else {
|
||||
sub_0804AA30(this, &gUnk_080D16A4);
|
||||
}
|
||||
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 28);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_171() {
|
||||
}
|
||||
|
||||
void sub_08044FC8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->nonPlanarMovement = 128;
|
||||
sub_0804A720(this);
|
||||
InitializeAnimation(this, 0);
|
||||
sub_08044FF8(this);
|
||||
}
|
||||
|
||||
void sub_08044FF8(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
this->action = 2;
|
||||
bVar1 = Random();
|
||||
this->actionDelay = (bVar1 & 31) + 30;
|
||||
this->cutsceneBeh.HALF.LO = this->currentHealth;
|
||||
}
|
||||
|
||||
void sub_08045018(Entity* this) {
|
||||
u32 cVar1;
|
||||
u32 param3;
|
||||
u32 iVar3;
|
||||
u32 randValue;
|
||||
|
||||
GetNextFrame(this);
|
||||
param3 = this->actionDelay -= 1;
|
||||
if (param3 == 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 1;
|
||||
if (0 < this->nonPlanarMovement) {
|
||||
this->actionDelay = sub_0806FA04(4096, this->nonPlanarMovement) >> 8;
|
||||
}
|
||||
iVar3 = sub_08049FA0(this);
|
||||
if ((iVar3 == 0) && (randValue = Random(), (randValue & 3) != 0)) {
|
||||
cVar1 = sub_08049EE4(this);
|
||||
this->direction = (cVar1 + 0xfc + (Random() & 8)) & 24;
|
||||
return;
|
||||
}
|
||||
this->direction = Random() & 24;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08045088(Entity* this) {
|
||||
u8 bVar1;
|
||||
|
||||
sub_080AEF88();
|
||||
GetNextFrame(this);
|
||||
bVar1 = this->actionDelay -= 1;
|
||||
if (bVar1 == 0) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_080450A8(Entity* this)
|
||||
|
||||
{
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
s32 iVar3;
|
||||
s32 iVar4;
|
||||
Entity* pEVar5;
|
||||
Entity** ppEVar6;
|
||||
s32 dividend;
|
||||
u32 uVar7;
|
||||
Entity* local_r6_72;
|
||||
u32 divisor;
|
||||
u8* pcVar8;
|
||||
Entity* local_2c[4];
|
||||
|
||||
ppEVar6 = local_2c;
|
||||
bVar1 = (&gUnk_080D16D0)[(this->entityType).form];
|
||||
divisor = (u32)bVar1;
|
||||
if ((int)gUnk_03003DB8.entityCount < (int)(72 - divisor)) {
|
||||
uVar7 = divisor;
|
||||
if (bVar1 != 0) {
|
||||
do {
|
||||
uVar2 = CreateEnemy(87, this->entityType.form);
|
||||
*ppEVar6 = uVar2;
|
||||
ppEVar6 = ppEVar6 + 1;
|
||||
uVar7 = uVar7 - 1;
|
||||
} while (uVar7 != 0);
|
||||
}
|
||||
pcVar8 = "\x06";
|
||||
iVar4 = 0;
|
||||
if (bVar1 != 0) {
|
||||
do {
|
||||
local_r6_72 = local_2c[iVar4];
|
||||
dividend = iVar4 + 1;
|
||||
iVar3 = Div(dividend, divisor);
|
||||
local_r6_72->attachedEntity = local_2c[iVar3];
|
||||
iVar4 = Div(iVar4 + divisor + -1, divisor);
|
||||
local_r6_72->parent = local_2c[iVar4];
|
||||
(local_r6_72->entityType).parameter = 1;
|
||||
local_r6_72->height.WORD = 0;
|
||||
local_r6_72->hurtBlinkTime = 240;
|
||||
sub_08045178(this, local_r6_72, *pcVar8, pcVar8[1]);
|
||||
pcVar8 = pcVar8 + 2;
|
||||
iVar4 = dividend;
|
||||
} while (dividend < divisor);
|
||||
}
|
||||
pEVar5 = CreateFx(this, 2, 0);
|
||||
if (pEVar5 != NULL) {
|
||||
CopyPosition(this, pEVar5);
|
||||
}
|
||||
DeleteEnemy(this);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_080450A8(Entity* this) {
|
||||
asm(".include \"asm/non_matching/slime/sub_080450A8.inc\"");
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern u32 GetNextFunction(Entity*);
|
||||
extern u32 sub_0806F520(Entity*);
|
||||
extern void sub_0806F4E8(Entity*);
|
||||
extern u32 sub_0806F3E4();
|
||||
extern void sub_0804A7D4(Entity*);
|
||||
extern void sub_0804A720(Entity*);
|
||||
extern void sub_080317F8(Entity*);
|
||||
|
||||
extern void (*gUnk_080CE530[])(Entity*);
|
||||
extern void (*gUnk_080CE548[])(Entity*);
|
||||
extern void (*gUnk_080CE554[])(Entity*);
|
||||
|
||||
void SmallPesto(Entity *this)
|
||||
{
|
||||
gUnk_080CE530[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void sub_08031680(Entity *this)
|
||||
{
|
||||
gUnk_080CE548[this->action](this);
|
||||
}
|
||||
|
||||
void nullsub_152(){}
|
||||
|
||||
void sub_0803169C(Entity *this)
|
||||
{
|
||||
s32 iVar1;
|
||||
|
||||
GetNextFrame(this);
|
||||
iVar1 = sub_0806F520(this);
|
||||
if (iVar1 == 0) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
this->flags = this->flags | 0x80;
|
||||
this->nonPlanarMovement = 0x40;
|
||||
this->field_0xf = 1;
|
||||
}
|
||||
else {
|
||||
gUnk_080CE554[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080316DC(Entity *this)
|
||||
{
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 0x3c;
|
||||
}
|
||||
|
||||
void sub_080316E8(Entity *this)
|
||||
{
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_080316F0(Entity *this)
|
||||
{
|
||||
if (sub_0806F3E4()) {
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031704(Entity *this)
|
||||
{
|
||||
sub_0804A720(this);
|
||||
sub_080317F8(this);
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080CDED0[])(Entity*);
|
||||
extern void (*const gUnk_080CDEE8[])(Entity*);
|
||||
|
||||
void Tektite(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CDED0);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void sub_0802F138(Entity* this) {
|
||||
gUnk_080CDEE8[this->action](this);
|
||||
}
|
||||
|
||||
extern u8 gUnk_080CDEF8[];
|
||||
|
||||
void sub_0802F150(Entity* this) {
|
||||
u32 bVar1;
|
||||
u32 uVar2;
|
||||
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CDED0);
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
switch (this->bitfield & 0x3f) {
|
||||
case 0x14:
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
if ((this->entityType).form != 0) {
|
||||
this->actionDelay = 0xc0;
|
||||
} else {
|
||||
this->actionDelay = gUnk_080CDEF8[Random() & 3];
|
||||
}
|
||||
this->field_0xf = 0;
|
||||
*(u8*)&this->field_0x7c = 0;
|
||||
if (this->height.HALF.HI != 0) {
|
||||
this->field_0x20 >>= 2;
|
||||
} else {
|
||||
this->field_0x20 = 0;
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
break;
|
||||
case 0xe:
|
||||
case 0x15:
|
||||
this->currentHealth = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_16(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802F1F0(Entity* this) {
|
||||
sub_08001242(this);
|
||||
if (this->height.HALF.HI != 0) {
|
||||
sub_08003FC4(this, this->field_0x80.HWORD);
|
||||
}
|
||||
}
|
||||
|
||||
extern u8 gUnk_080CDEF8[];
|
||||
|
||||
void sub_0802F210(Entity* this) {
|
||||
u32 temp;
|
||||
u32 temp2;
|
||||
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = gUnk_080CDEF8[Random() & 3];
|
||||
this->actionDelay = (Random() & 0x1f) + this->actionDelay;
|
||||
this->field_0xf = 0;
|
||||
*(u8*)&this->field_0x7c = 0;
|
||||
|
||||
this->field_0x80.HWORD = this->entityType.form == 0 ? 0x1800 : 0x2800;
|
||||
|
||||
this->field_0x82.HWORD = this->entityType.form == 0 ? 0x2800 : 0x3000;
|
||||
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void sub_0802F284(Entity* this) {
|
||||
if (this->actionDelay > 0x60) {
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else if (this->field_0xf != 0) {
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x10;
|
||||
this->field_0xf = this->entityType.form;
|
||||
this->field_0x20 = this->field_0x82.HWORD << 4;
|
||||
sub_0802F45C(this);
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
} else if ((this->frames.b.f3) != 0) {
|
||||
this->field_0xf = 0x40;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
extern u8 gUnk_080CDEF8[];
|
||||
|
||||
void sub_0802F300(Entity* this) {
|
||||
s32 temp;
|
||||
u32 rand;
|
||||
|
||||
GetNextFrame(this);
|
||||
sub_080AEF88(this);
|
||||
temp = this->height.HALF.HI;
|
||||
rand = Random() & 0xf;
|
||||
|
||||
if (sub_080044EC(this, this->field_0x80.HWORD) == 1) {
|
||||
this->action = 3;
|
||||
this->previousActionFlag = 0;
|
||||
if (this->entityType.form != 0) {
|
||||
rand = 0;
|
||||
}
|
||||
|
||||
if (rand == 0) {
|
||||
this->actionDelay = 0xc0;
|
||||
} else {
|
||||
this->actionDelay = gUnk_080CDEF8[rand & 3] + rand;
|
||||
}
|
||||
this->field_0xf = 0;
|
||||
InitializeAnimation(this, 3);
|
||||
return;
|
||||
} else if (this->collisions != 0) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
} else if ((sub_080002B8(this) & 0xf0) == 0x50) {
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 0x10;
|
||||
if (this->field_0xf != 0) {
|
||||
this->field_0xf--;
|
||||
sub_0802F45C(this);
|
||||
}
|
||||
}
|
||||
|
||||
if ((this->previousActionFlag == 0) && (temp < this->height.HALF.HI)) {
|
||||
InitializeAnimation(this, 4);
|
||||
this->previousActionFlag = 1;
|
||||
}
|
||||
|
||||
if (temp < -0xc) {
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
} else {
|
||||
this->spriteRendering.b3 = 2;
|
||||
this->spriteOrientation.flipY = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802F3F4(Entity* this) {
|
||||
|
||||
GetNextFrame(this);
|
||||
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
if ((*(u8*)&this->field_0x7c.HALF.LO < 2) && ((this->entityType.form % 2) != 0)) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x10;
|
||||
this->field_0xf = this->entityType.form;
|
||||
this->field_0x20 = this->field_0x82.HWORD << 4;
|
||||
(*(u8*)&this->field_0x7c.HALF.LO)++;
|
||||
sub_0802F45C(this);
|
||||
InitializeAnimation(this, 2);
|
||||
} else {
|
||||
this->action = 1;
|
||||
*(u8*)&this->field_0x7c.HALF.LO = 0;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802F45C(Entity* this) {
|
||||
u32 temp;
|
||||
|
||||
if (sub_08049FA0(this) == 0) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
} else if (sub_08049FDC(this, 1) != 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
} else {
|
||||
temp = (Random() & 0xf) + 0x18;
|
||||
this->direction = (temp + this->direction) & 0x1f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern void sub_08038168(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CF4A0)(Entity*);
|
||||
extern void (*const gUnk_080CF4B8[])(Entity*);
|
||||
|
||||
void TektiteGolden(Entity* this) {
|
||||
EnemyFunctionHandler(this, &gUnk_080CF4A0);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void sub_08037EE8(Entity* this) {
|
||||
gUnk_080CF4B8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08037F00(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
sub_0804AA30(this, &gUnk_080CF4A0);
|
||||
if (this->bitfield == 0x94) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = 0x14;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
if (this->height.HALF.HI != 0) {
|
||||
this->field_0x20 >>= 2;
|
||||
} else {
|
||||
this->field_0x20 = 0;
|
||||
}
|
||||
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08037F58(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
if ((this->field_0x3a & 2) == 0) {
|
||||
SetGlobalFlag(this->entityType.parameter);
|
||||
}
|
||||
if ((this->entityType).form != 0) {
|
||||
uVar1 = 0x59;
|
||||
} else {
|
||||
uVar1 = 0x58;
|
||||
}
|
||||
CreateDeathFx(this, 0xff, uVar1);
|
||||
}
|
||||
|
||||
void sub_08037F84(Entity* this) {
|
||||
sub_08001242(this);
|
||||
if (this->height.HALF.HI != 0) {
|
||||
sub_08003FC4(this, 0x3000);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08037FA0(Entity* this) {
|
||||
|
||||
if (CheckGlobalFlag(this->entityType.parameter)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = (Random() & 0x1f) + 0x20;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void sub_08037Fe0(Entity* this) {
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else if (this->field_0xf != 0) {
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 6;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x20 = 0x38000;
|
||||
sub_08038168(this);
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
} else if ((this->frames.b.f3) != 0) {
|
||||
this->field_0xf = 0x40;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08038048(Entity* this) {
|
||||
s32 temp;
|
||||
u32 rand;
|
||||
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
sub_080AEF88(this);
|
||||
temp = this->height.HALF.HI;
|
||||
rand = Random() & 0xf;
|
||||
|
||||
if (sub_080044EC(this, 0x3000) == 1) {
|
||||
this->action = 3;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = 0x14;
|
||||
InitializeAnimation(this, 3);
|
||||
return;
|
||||
} else if (this->collisions != 0) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
} else if ((sub_080002B8(this) & 0xf0) == 0x50) {
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = rand + 0x10;
|
||||
sub_08038168(this);
|
||||
}
|
||||
|
||||
if ((this->previousActionFlag == 0) && (temp < this->height.HALF.HI)) {
|
||||
InitializeAnimation(this, 4);
|
||||
this->previousActionFlag = 1;
|
||||
}
|
||||
|
||||
if (temp < -0xc) {
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
} else {
|
||||
this->spriteRendering.b3 = 2;
|
||||
this->spriteOrientation.flipY = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08038110(Entity* this) {
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
if (this->field_0x80.HALF.LO < 5) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 8;
|
||||
this->field_0x20 = 0x38000;
|
||||
sub_08038168(this);
|
||||
InitializeAnimation(this, 2);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
this->actionDelay = 0xc0;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08038168(Entity* this) {
|
||||
u32 temp;
|
||||
|
||||
if (sub_08049FA0(this) == 0) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
} else if (sub_08049FDC(this, 1) != 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
} else {
|
||||
temp = (Random() & 0xf) + 0x18;
|
||||
this->direction = (temp + this->direction) & 0x1f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "structures.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080CEB74[])(Entity*);
|
||||
extern void (*const gUnk_080CEB8C[])(Entity*);
|
||||
extern void (*const gUnk_080CEB98[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CEBA4[];
|
||||
|
||||
void Wisp(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CEB74);
|
||||
}
|
||||
|
||||
void sub_0803354C(Entity* this) {
|
||||
gUnk_080CEB8C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08033564(Entity* this) {
|
||||
u32 bits;
|
||||
Entity* ent;
|
||||
|
||||
bits = this->bitfield;
|
||||
if ((bits & 0x80) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((s32)bits & 0x3f) {
|
||||
case 0:
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
this->flags &= 0x7f;
|
||||
this->field_0x7c.HALF.LO = 0x27c;
|
||||
gPlayerState.flags.all |= 0x4000;
|
||||
gUnk_02002A40.stats.filler2[4] = this->entityType.form + 1;
|
||||
gUnk_02002A40.stats.field_0x20 = 600;
|
||||
if (this->entityType.form == 0) {
|
||||
break;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
case 0xe:
|
||||
case 0x15:
|
||||
this->currentHealth = 0;
|
||||
break;
|
||||
case 0x14:
|
||||
this->flags &= 0x7f;
|
||||
this->hurtBlinkTime = 0;
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
ent = CreateFx(this, 2, 0);
|
||||
if (ent != NULL) {
|
||||
this->attachedEntity = ent;
|
||||
this->actionDelay = 0xe;
|
||||
CopyPosition(this, ent);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803362C(Entity* this) {
|
||||
if (sub_0806F520() != 0) {
|
||||
gUnk_080CEB98[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033650(Entity* this) {
|
||||
this->previousActionFlag = 2;
|
||||
}
|
||||
|
||||
void sub_08033658(Entity* this) {
|
||||
sub_0806F4E8();
|
||||
}
|
||||
|
||||
void sub_08033660(Entity* this) {
|
||||
if (sub_0806F3E4(this)) {
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033674(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->actionDelay = 0;
|
||||
this->action = 1;
|
||||
this->field_0x1c = 1;
|
||||
this->field_0x80.HWORD = this->x.HALF.HI;
|
||||
this->field_0x82.HWORD = this->y.HALF.HI;
|
||||
sub_08033744(this);
|
||||
InitializeAnimation(this, this->entityType.parameter);
|
||||
}
|
||||
|
||||
void sub_080336A8(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08033744(this);
|
||||
} else if (this->collisions != 0) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_080336DC(Entity* this) {
|
||||
switch ((u16)-- this->field_0x7c.HALF.LO) {
|
||||
case 0x24:
|
||||
this->x.HALF.HI = this->field_0x80.HWORD;
|
||||
this->y.HALF.HI = this->field_0x82.HWORD;
|
||||
break;
|
||||
case 0x18:
|
||||
sub_080A29BC(this);
|
||||
break;
|
||||
case 0xc:
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
break;
|
||||
case 0x0:
|
||||
this->action = 1;
|
||||
this->flags |= 0x80;
|
||||
sub_08033744(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033744(Entity* this) {
|
||||
u32 temp;
|
||||
u32 rand = (u32)Random() % 256;
|
||||
|
||||
// 8 potential options
|
||||
this->actionDelay = gUnk_080CEBA4[(rand & 0x70) >> 4];
|
||||
|
||||
// 4 potential options
|
||||
temp = ((rand & 0xc) * 2);
|
||||
|
||||
// 75% chance to pass
|
||||
if ((sub_08049FA0(this) == 0) && ((rand % 4) != 0)) {
|
||||
temp = sub_08049EE4(this);
|
||||
|
||||
// 50% chance to pass
|
||||
if ((rand & 0x80) != 0) {
|
||||
temp += 0x4;
|
||||
temp &= 0x18;
|
||||
} else {
|
||||
temp += 0x1c;
|
||||
temp &= 0x18;
|
||||
}
|
||||
}
|
||||
this->direction = temp;
|
||||
}
|
||||
Reference in New Issue
Block a user