treeHidingPortal.c

This commit is contained in:
theo3
2020-07-07 19:19:42 -07:00
parent d49be370d4
commit 6f08201b71
5 changed files with 96 additions and 198 deletions
+88
View File
@@ -0,0 +1,88 @@
#include "global.h"
#include "entity.h"
#include "flags.h"
#include "link.h"
#include "room.h"
extern void sub_0809E96C(Entity*);
extern u32 sub_0800419C(Entity*, Entity*, u32, u32);
extern void sub_080A2B80(Entity*);
extern u32 sub_0809E9A0(void);
extern void sub_08078A90(u32);
extern void sub_0809E918(Entity*);
extern void PlaySFX(u32);
extern void CreateMinishEntrance(u32 tile);
extern void (*const gUnk_08124354[])(Entity*);
extern u32 gUnk_030010A0;
extern s16 gUnk_08124364[];
void TreeHidingPortal(Entity* this) {
gUnk_08124354[this->action](this);
}
void sub_0809E83C(Entity* this) {
if (CheckFlags(this->field_0x86)) {
sub_0809E96C(this);
DeleteThisEntity();
}
this->action = 1;
this->collisionLayer = 2;
UpdateSpriteOrderAndFlip(this);
}
void sub_0809E86C(Entity* this) {
if (sub_0800419C(this, &gLinkEntity, 0x30, 0x30)) {
if (CheckGlobalFlag(0x14)) {
if (((gUnk_030010A0 & 3) == 0)) {
sub_080A2B80(this);
}
}
}
if (sub_0809E9A0() == 0x54) {
this->action = 2;
this->actionDelay = 0xf;
sub_08078A90(1);
}
}
void sub_0809E8BC(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 3;
this->actionDelay = 0x3c;
this->spriteSettings.b.ss0 = 0;
sub_0809E96C(this);
sub_0809E918(this);
}
}
void sub_0809E8EC(Entity* this) {
if (--this->actionDelay == 0) {
SetFlag(this->field_0x86);
sub_08078A90(0);
PlaySFX(0x73);
DeleteThisEntity();
}
}
void sub_0809E918(Entity* this) {
Entity* fx;
s16* i = gUnk_08124364;
while (*i != -1000) {
fx = CreateFx(this, 3, 0);
if (fx != NULL) {
fx->x.HALF.HI += i[0];
fx->y.HALF.HI += i[1];
fx->collisionLayer = 2;
UpdateSpriteOrderAndFlip(fx);
}
i += sizeof(s16);
}
}
void sub_0809E96C(Entity *this)
{
CreateMinishEntrance(COORD_TO_TILE_OFFSET(this, 0x20, 0x8));
}