Decompile angryStatue

This commit is contained in:
Tal Hayon
2022-02-23 04:24:22 +02:00
parent 62b8e59af1
commit 060aa62e8f
5 changed files with 82 additions and 213 deletions
+80
View File
@@ -0,0 +1,80 @@
#include "entity.h"
#include "asm.h"
#include "room.h"
#include "sound.h"
#include "projectile.h"
#include "coord.h"
extern Hitbox gUnk_080FD178;
void sub_0809F144(Entity*);
void sub_0809F194(Entity*);
void sub_0809F1B0(Entity*);
void sub_0809F220(Entity*);
void sub_0809F254(Entity*);
void AngryStatue(Entity* this) {
static void (*const AngryStatue_Actions[])(Entity*) = {
sub_0809F144, sub_0809F194, sub_0809F1B0, sub_0809F220, sub_0809F254,
};
AngryStatue_Actions[this->action](this);
}
void sub_0809F144(Entity* this) {
this->action = 1;
this->hitbox = &gUnk_080FD178;
SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer);
InitializeAnimation(this, this->type);
}
void sub_0809F194(Entity* this) {
if (this->parent->field_0xf == 1) {
this->action = 2;
InitializeAnimation(this, this->type + 4);
}
}
void sub_0809F1B0(Entity* this) {
static const s8 gUnk_08124684[] = {
0, 12, 12, 2, 0, 12, -12, 2,
};
Entity* pEVar2;
const s8* ptr;
GetNextFrame(this);
if (this->frame & 1) {
this->frame &= 0xfe;
pEVar2 = CreateProjectile(CANNONBALL_PROJECTILE);
if (pEVar2 != NULL) {
pEVar2->type = this->type;
pEVar2->parent = this->parent;
ptr = &gUnk_08124684[this->type * 2];
PositionRelative(this, pEVar2, ptr[0] << 0x10, ptr[1] << 0x10);
EnqueueSFX(SFX_EC);
}
} else if ((this->frame & 0x80) != 0) {
this->action = 1;
InitializeAnimation(this, this->type);
}
}
void sub_0809F220(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 4;
this->actionDelay = 15;
InitializeAnimation(this, this->type);
} else {
this->parent->z.BYTES.byte2 |= 1 << this->type2;
}
}
void sub_0809F254(Entity* this) {
this->spriteSettings.draw ^= 1;
if (--this->actionDelay == 0) {
this->action = 1;
this->spriteSettings.draw = 1;
}
}