mirror of
https://github.com/zeldaret/tmc
synced 2026-08-01 08:17:33 -04:00
Merge branch 'master' of https://github.com/zeldaret/tmc
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "sprite.h"
|
||||
|
||||
extern u32 CheckIsDungeon();
|
||||
|
||||
void Archway(Entity *this)
|
||||
{
|
||||
u32 v1;
|
||||
u32 v2;
|
||||
u32 v3;
|
||||
|
||||
if (this->action == 0) {
|
||||
v1 = this->action = 1;
|
||||
v2 = this->spriteSettings.raw;
|
||||
v1 = v1 - 0x5;
|
||||
v1 = v1 & v2;
|
||||
this->spriteSettings.raw = v1 | 1;
|
||||
this->frameIndex = this->entityType.parameter;
|
||||
this->collisionLayer = 2;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
v3 = CheckIsDungeon();
|
||||
if (v3 != 0) {
|
||||
this->spritePriority.b0 = (this->spritePriority.b0 & 0xf8) | 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_08121EA4[])(Entity*);
|
||||
extern const u8 gUnk_08121EB0[];
|
||||
extern const u8 gUnk_08121EB3[];
|
||||
|
||||
void BackgroundCloud(Entity* this) {
|
||||
gUnk_08121EA4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0808F658(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spriteOrientation.flipY = 3;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = this->entityType.form;
|
||||
this->frameIndex = this->entityType.form;
|
||||
this->direction = 8;
|
||||
this->nonPlanarMovement = gUnk_08121EB0[(this->entityType).form];
|
||||
this->field_0x78.HWORD = gRoomControls.roomOriginX - 0x60;
|
||||
this->field_0x7a.HWORD = gRoomControls.roomOriginX + gRoomControls.filler2[3] + 0x60;
|
||||
this->animationState = 0;
|
||||
this->x.HALF.HI += (Random() & 0xf) << 4;
|
||||
this->actionDelay = 0;
|
||||
this->previousActionFlag = 0;
|
||||
}
|
||||
|
||||
void sub_0808F6E0(Entity* this) {
|
||||
sub_0806F69C(this);
|
||||
|
||||
if ((s16)this->x.HALF.HI < (s16)this->field_0x78.HWORD ||
|
||||
(s16)this->x.HALF.HI > (s16)this->field_0x7a.HWORD)
|
||||
this->action = 2;
|
||||
}
|
||||
|
||||
void sub_0808F70C(Entity* this) {
|
||||
if (this->previousActionFlag == 0) {
|
||||
this->previousActionFlag = 1;
|
||||
this->actionDelay = ((Random() & 7) << 3) + 31;
|
||||
|
||||
if ((this->direction & 0x10)) {
|
||||
this->x.HALF.HI = this->field_0x7a.HWORD;
|
||||
} else {
|
||||
this->x.HALF.HI = this->field_0x78.HWORD;
|
||||
}
|
||||
|
||||
if (this->entityType.form == 2)
|
||||
this->y.HALF.HI = gUnk_08121EB3[this->entityType.parameter * 2 + (Random() & 1)];
|
||||
}
|
||||
|
||||
if (this->previousActionFlag == 1) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0800449C(Entity*, u32);
|
||||
extern u32 sub_0806FC80(Entity*, Entity*, s32);
|
||||
extern void sub_0809CDF0(Entity*);
|
||||
|
||||
extern void (*const gUnk_08123E20[])(Entity*);
|
||||
|
||||
void BakerOven(Entity* this) {
|
||||
gUnk_08123E20[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809CC74(Entity* this) {
|
||||
u32 i;
|
||||
Entity* ent;
|
||||
|
||||
this->action = 1;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
|
||||
if (this->entityType.form == 0) {
|
||||
this->spritePriority.b0 = 5;
|
||||
/* Create steam clouds */
|
||||
for (i = 0; i < 3; i++) {
|
||||
ent = CreateObject(0x92, 1, i);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
PositionRelative(this, ent, (((i + 1) / 2) * 0x100000) - 0x80000, -0xe0000);
|
||||
}
|
||||
}
|
||||
sub_0809CDF0(this);
|
||||
} else {
|
||||
if (this->entityType.parameter & 1) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->actionDelay = 20;
|
||||
} else {
|
||||
this->action = 2;
|
||||
this->actionDelay = (this->entityType.parameter & 2) ? 20 : 18;
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809CD0C(Entity* this) {
|
||||
u8* frames;
|
||||
|
||||
if (this->entityType.form) {
|
||||
GetNextFrame(this);
|
||||
frames = &this->frames.all;
|
||||
if (*frames & 1) {
|
||||
*frames &= 0xfe;
|
||||
this->y.HALF.HI++;
|
||||
}
|
||||
|
||||
if ((*frames & 0x80) && this->frameDuration == 1) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
|
||||
/* Damage minish link if he touches a steam cloud */
|
||||
if (this->field_0xf == 0 && gPlayerEntity.hurtBlinkTime == 0 && this->frameIndex &&
|
||||
sub_0806FC80(this, &gPlayerEntity, 4)) {
|
||||
this->field_0xf++;
|
||||
ModHealth(-2);
|
||||
sub_0800449C(&gPlayerEntity, 0x7a);
|
||||
gPlayerEntity.hurtBlinkTime = 16;
|
||||
gPlayerEntity.field_0x3e = 16;
|
||||
gPlayerEntity.field_0x42 = 12;
|
||||
gPlayerEntity.field_0x46 = 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809CDB4(Entity* this) {
|
||||
/* Reset cloud position and start animation. */
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 30;
|
||||
this->field_0xf = 0;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI - 0xe;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809CDF0(Entity* this) {
|
||||
u32 y;
|
||||
|
||||
this->field_0x80.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3f) |
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4 & 0x3f) << 6);
|
||||
|
||||
y = this->field_0x80.HWORD;
|
||||
SetTile(0x402e, y - 0x01, this->collisionLayer);
|
||||
SetTile(0x4022, y - 0x00, this->collisionLayer);
|
||||
SetTile(0x4022, y + 0x01, this->collisionLayer);
|
||||
SetTile(0x4026, y - 0x41, this->collisionLayer);
|
||||
SetTile(0x4026, y - 0x40, this->collisionLayer);
|
||||
SetTile(0x4024, y - 0x3f, this->collisionLayer);
|
||||
SetTile(0x4026, y - 0x81, this->collisionLayer);
|
||||
SetTile(0x4026, y - 0x80, this->collisionLayer);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "entity.h"
|
||||
#include "global.h"
|
||||
|
||||
extern void (*gUnk_08123384[])(Entity*);
|
||||
|
||||
void Bell(Entity* ent) {
|
||||
gUnk_08123384[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_08097D90(Entity* ent) {
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.draw = 1;
|
||||
ent->collisionLayer = 1;
|
||||
ent->spritePriority.b0 = 0;
|
||||
UpdateSpriteForCollisionLayer(ent);
|
||||
InitAnimationForceUpdate(ent, 0);
|
||||
}
|
||||
|
||||
void sub_08097DCC(Entity* ent) {
|
||||
UpdateAnimationSingleFrame(ent);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern void sub_080842D8(Entity*);
|
||||
extern void sub_08078828(Entity*);
|
||||
extern void sub_08083E20(Entity*);
|
||||
|
||||
extern void (*const gUnk_0811F7E8[])(Entity*);
|
||||
extern void (*const gUnk_0811F808[])(Entity*);
|
||||
extern void (*const gUnk_0811F818[])(Entity*);
|
||||
|
||||
extern u32 gUnk_0811F8B0;
|
||||
void ChestSpawner(Entity* this)
|
||||
{
|
||||
gUnk_0811F7E8[this->entityType.form](this);
|
||||
}
|
||||
|
||||
void sub_08083DF0(Entity* this) {
|
||||
gUnk_0811F808[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08083E08(Entity *this)
|
||||
{
|
||||
gUnk_0811F818[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08083E20(Entity *this)
|
||||
{
|
||||
this->action = 3;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spriteRendering.alphaBlend = 0;
|
||||
sub_080842D8(this);
|
||||
sub_08078828(this);
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "player.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern void sub_0809F7BC(Entity*);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0809F814(u32);
|
||||
extern void sub_0809F7F4(Entity*);
|
||||
extern void LoadRoomEntityList();
|
||||
extern void DeleteThisEntity();
|
||||
extern u32 CheckRoomFlag(u32);
|
||||
extern void sub_08078A90(u32);
|
||||
extern void sub_08078B48(void);
|
||||
extern u32 Random(void);
|
||||
extern void sub_0806F69C(Entity*);
|
||||
extern void (*gUnk_08124798[])(Entity*);
|
||||
extern void (*gUnk_081247A0[])(Entity*);
|
||||
extern void (*gUnk_081247AC[])(Entity*);
|
||||
extern Entity* CreateObject(u32, u32, u32);
|
||||
extern void PositionEntityOnTop(Entity*, Entity*);
|
||||
extern void sub_0807BB68(u32*, u32, u32);
|
||||
|
||||
extern u8 gUnk_02034490;
|
||||
extern u32 gScreenTransition;
|
||||
extern void* gUnk_080DD750;
|
||||
extern Entity gPlayerEntity;
|
||||
extern PlayerState gPlayerState;
|
||||
extern u8 gUnk_081247C0[];
|
||||
extern u16 gUnk_081247C8[];
|
||||
extern u32 gUnk_081247D0;
|
||||
|
||||
void Cloud(Entity* this) {
|
||||
gUnk_08124798[(this->entityType).form](this);
|
||||
}
|
||||
|
||||
void sub_0809F4DC(Entity* this) {
|
||||
if ((this->entityType).parameter == 0) {
|
||||
gUnk_081247A0[this->action](this);
|
||||
} else {
|
||||
gUnk_081247AC[this->action](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F514(Entity* this) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 120;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->field_0x68.HALF.LO = 12;
|
||||
gRoomControls.cameraTarget = this;
|
||||
gUnk_02034490 = 255;
|
||||
sub_0809F7BC(this);
|
||||
}
|
||||
|
||||
void sub_0809F548(Entity* this) {
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 90;
|
||||
PlaySFX(285);
|
||||
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
|
||||
} else {
|
||||
if ((gScreenTransition & 7) == 0) {
|
||||
sub_0809F7BC(this);
|
||||
}
|
||||
sub_0809F7F4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F5B0(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
PlaySFX(115);
|
||||
SetGlobalFlag(KUMOTATSUMAKI);
|
||||
LoadRoomEntityList(&gUnk_080DD750);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F5DC(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->field_0x68.HALF.LO = 12;
|
||||
}
|
||||
|
||||
void sub_0809F5F0(Entity* this) {
|
||||
u32 iVar1;
|
||||
|
||||
iVar1 = CheckRoomFlag(this->actionDelay);
|
||||
if (iVar1 != 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 120;
|
||||
sub_08078A90(3);
|
||||
sub_08078B48();
|
||||
gRoomControls.cameraTarget = this;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F61C(Entity* this) {
|
||||
|
||||
if ((gRoomControls.unk6 & 4) == 0) {
|
||||
if (this->actionDelay == 30) {
|
||||
SetLocalFlag(this->entityType.parameter);
|
||||
}
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 120;
|
||||
PlaySFX(285);
|
||||
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
|
||||
} else {
|
||||
if ((gScreenTransition & 7) == 0) {
|
||||
sub_0809F7BC(this);
|
||||
}
|
||||
sub_0809F7F4(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F69C(Entity* this) {
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 30;
|
||||
this->action = 4;
|
||||
gRoomControls.cameraTarget = &gPlayerEntity;
|
||||
PlaySFX(115);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F6CC(Entity* this) {
|
||||
|
||||
if (((gRoomControls.unk6 & 4) == 0) && (--this->actionDelay == 0)) {
|
||||
gPlayerState.field_0x8b = 1;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F700(Entity* this) {
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = (Random() & 30) + 8;
|
||||
this->flags = this->flags | 12;
|
||||
}
|
||||
if ((gScreenTransition & 3) == 0) {
|
||||
uVar2 = Random();
|
||||
this->spriteOffsetX = gUnk_081247C0[uVar2 & 7];
|
||||
this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7];
|
||||
}
|
||||
sub_0806F69C(this);
|
||||
if (--this->actionDelay == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
Entity* sub_0809F770(Entity* this) {
|
||||
Entity* cloud;
|
||||
int uVar1;
|
||||
|
||||
cloud = CreateObject(163, 1, 0);
|
||||
if (cloud) {
|
||||
PositionEntityOnTop(this, cloud);
|
||||
uVar1 = Random();
|
||||
cloud->x.HALF.HI += ((uVar1 >> 0) & 31) - 16;
|
||||
cloud->y.HALF.HI += ((uVar1 >> 8) & 31) - 16;
|
||||
cloud->frameIndex = (uVar1 >> 16) & 3;
|
||||
cloud->direction = 0xFF;
|
||||
}
|
||||
return cloud;
|
||||
}
|
||||
|
||||
void sub_0809F7BC(Entity* this) {
|
||||
Entity* cloud;
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
|
||||
for (uVar2 = 0; uVar2 < 8; uVar2++) {
|
||||
cloud = sub_0809F770(this);
|
||||
if (cloud != NULL) {
|
||||
uVar1 = Random();
|
||||
cloud->nonPlanarMovement = gUnk_081247C8[uVar1 & 3];
|
||||
cloud->direction = (u8)(uVar1 >> 8) & 31;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F7F4(Entity* this) {
|
||||
if (--this->field_0x68.HALF.LO == 0) {
|
||||
this->field_0x68.HALF.LO = 12;
|
||||
PlaySFX(388);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809F814(u32 r0) {
|
||||
sub_0807BB68(&gUnk_081247D0, r0, 1);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern void sub_0809EE34(Entity*);
|
||||
extern void sub_0809EFB0(Entity*);
|
||||
extern void sub_0809EE08(Entity*);
|
||||
extern void sub_0809F08C(void);
|
||||
extern void sub_0809EE44(Entity*);
|
||||
extern void sub_0809EE24(Entity*);
|
||||
|
||||
extern void (*const gUnk_081243D4[])(Entity*);
|
||||
|
||||
void Fan(Entity *this)
|
||||
{
|
||||
gUnk_081243D4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809ED30(Entity *this)
|
||||
{
|
||||
this->direction = (this->entityType.form ^ 2) << 3;
|
||||
sub_0809EE34(this);
|
||||
sub_0809EFB0(this);
|
||||
InitializeAnimation(this, this->entityType.form);
|
||||
}
|
||||
|
||||
void sub_0809ED54(Entity *this)
|
||||
{
|
||||
u16 uVar1;
|
||||
u32 iVar2;
|
||||
|
||||
if (((this->cutsceneBeh.HWORD == 0) || CheckFlags(this->cutsceneBeh.HWORD)) &&
|
||||
((this->entityType.parameter != 1 ||
|
||||
(--this->field_0x74.HWORD == 0)))) {
|
||||
sub_0809EE08(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809ED88(Entity *this)
|
||||
{
|
||||
sub_0809F08C();
|
||||
sub_0809EE44(this);
|
||||
if (this->field_0x86 != 0) {
|
||||
if (this->cutsceneBeh.HWORD == this->field_0x86) {
|
||||
if (CheckFlags(this->cutsceneBeh.HWORD)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!CheckFlags(this->cutsceneBeh.HWORD)) {
|
||||
return;
|
||||
}
|
||||
sub_0809EE24(this);
|
||||
}
|
||||
else if (((this->entityType).parameter == 1) &&
|
||||
(--this->field_0x74.HWORD == 0)) {
|
||||
sub_0809EE24(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809EDE4(Entity *this)
|
||||
{
|
||||
sub_0809F08C();
|
||||
sub_0809EE44(this);
|
||||
if (this->frames.b.f3) {
|
||||
sub_0809EE34(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809EE08(Entity *this)
|
||||
{
|
||||
this->action = 2;
|
||||
this->field_0x74.HWORD = *((u8 *)&this->field_0x7c + 3) << 2;
|
||||
InitializeAnimation(this, this->entityType.form);
|
||||
}
|
||||
|
||||
void sub_0809EE24(Entity *this)
|
||||
{
|
||||
this->action = 3;
|
||||
InitializeAnimation(this, this->entityType.form + 4);
|
||||
}
|
||||
|
||||
void sub_0809EE34(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->field_0x74.HWORD = this->actionDelay << 2;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
|
||||
void SetTile(u32 tileIndex, s32 tilePosition, s32 layerIndex);
|
||||
void sub_0808D618(Entity* ent);
|
||||
|
||||
extern RoomControls gRoomControls;
|
||||
extern s16 gUnk_08121750[];
|
||||
extern s16 gUnk_0812176A[];
|
||||
|
||||
void GiantLeaf(Entity* ent) {
|
||||
if (ent->action == 0) {
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.draw = 1;
|
||||
ent->spriteRendering.b3 = 3;
|
||||
ent->spritePriority.b0 = 7;
|
||||
ent->frameIndex = ent->entityType.form;
|
||||
sub_0808D618(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808D618(Entity* ent) {
|
||||
u32 tilePos;
|
||||
s16* arr;
|
||||
u32 i;
|
||||
|
||||
arr = (ent->entityType.form != 0) ? gUnk_0812176A : gUnk_08121750;
|
||||
tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) |
|
||||
((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64);
|
||||
|
||||
for (i = 0; i < 13; i++) {
|
||||
SetTile(16500, tilePos + arr[i], 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,651 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "screen.h"
|
||||
#include "greatFairy.h"
|
||||
#include "structures.h"
|
||||
|
||||
enum {
|
||||
BEHAVIORS,
|
||||
WINGS,
|
||||
WAKE,
|
||||
MINI,
|
||||
MINIAFFINE,
|
||||
DROPLET,
|
||||
RIPPLE,
|
||||
BIGRIPPLE,
|
||||
FORM8,
|
||||
FORM9,
|
||||
};
|
||||
|
||||
// Main
|
||||
void GreatFairy(Entity* this) {
|
||||
u8 bVar1;
|
||||
|
||||
if (this->action == 0) {
|
||||
bVar1 = __modsi3(this->entityType.form, 11);
|
||||
this->entityType.parameter = bVar1;
|
||||
}
|
||||
GreatFairy_Main[(this->entityType).parameter](this);
|
||||
}
|
||||
|
||||
// Behaviors
|
||||
void GreatFairy_CallBehavior(Entity* this) {
|
||||
GreatFairy_Behaviors[this->action](this);
|
||||
|
||||
if ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) < 168) {
|
||||
|
||||
gRoomControls.cameraTarget = this;
|
||||
gRoomControls.unk5 = 2;
|
||||
} else {
|
||||
gRoomControls.cameraTarget = &gPlayerEntity;
|
||||
gRoomControls.unk5 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Init
|
||||
void GreatFairy_Init(Entity* this) {
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->actionDelay = 0;
|
||||
this->cutsceneBeh.HWORD = 290;
|
||||
}
|
||||
|
||||
void GreatFairy_DormantUpdate(Entity* this) {
|
||||
u16* pFrame; // r1@2
|
||||
s32 frame; // r1@4
|
||||
Entity* ripple; // r5@16
|
||||
|
||||
if (!CheckRoomFlag(0))
|
||||
return;
|
||||
|
||||
pFrame = &this->cutsceneBeh.HWORD;
|
||||
if (*pFrame != 0) {
|
||||
--*pFrame;
|
||||
}
|
||||
switch (*pFrame) {
|
||||
case 0x96:
|
||||
case 0x82:
|
||||
goto e;
|
||||
case 0x0:
|
||||
this->action = 2;
|
||||
break;
|
||||
e:
|
||||
case 0xd2:
|
||||
case 0xaa:
|
||||
case 0x121:
|
||||
ripple = GreatFairy_CreateForm(this, RIPPLE, 0);
|
||||
if (ripple) {
|
||||
PositionRelative(this, ripple, (s32)GreatFairy_RippleOffsets[this->actionDelay] << 16,
|
||||
(s32)GreatFairy_RippleOffsets[this->actionDelay + 1] << 16);
|
||||
this->actionDelay += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GreatFairy_CreateBigRipple(Entity* this) {
|
||||
Entity* ripple;
|
||||
|
||||
ripple = GreatFairy_CreateForm(this, BIGRIPPLE, 0);
|
||||
if (ripple != NULL) {
|
||||
PositionRelative(this, ripple, 0, 0x80000);
|
||||
this->action = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Great Fairy spawning in update
|
||||
void GreatFairy_SpawningUpdate(Entity* this) {
|
||||
Entity* mini;
|
||||
u32 var;
|
||||
|
||||
if (gRoomVars.greatFairyState & 1) {
|
||||
mini = GreatFairy_CreateForm(this, WAKE, 0); //???
|
||||
if (mini != NULL) {
|
||||
CopyPosition(this, mini);
|
||||
DoFade(6, 4);
|
||||
PlaySFX(325);
|
||||
this->action = 4;
|
||||
this->actionDelay = 0x3c;
|
||||
var = this->spriteSettings.raw & ~0x3;
|
||||
this->spriteSettings.raw = (this->spriteSettings.raw & var) | 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GreatFairy_MiniUpdate(Entity* this) {
|
||||
Entity* target;
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->actionDelay != 0) {
|
||||
--this->actionDelay;
|
||||
} else {
|
||||
target = GreatFairy_CreateForm(this, WINGS, 0);
|
||||
if (target != NULL) {
|
||||
PositionRelative(this, target, 0, -0x140000);
|
||||
this->action = 5;
|
||||
this->actionDelay = 120;
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is the great fairy's "normal" form
|
||||
void GreatFairy_FinalUpdate(Entity* this) {
|
||||
Entity* target;
|
||||
|
||||
if (this->actionDelay != 0) {
|
||||
--this->actionDelay;
|
||||
} else {
|
||||
if ((this->field_0xf == 0) && (target = GreatFairy_CreateForm(this, FORM9, 0), target != NULL)) {
|
||||
PositionRelative(this, target, 0, -0x4C0000);
|
||||
target->parent = this;
|
||||
this->field_0xf = 1;
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void GreatFairy_WingsCallBehavior(Entity* this) {
|
||||
GreatFairy_WingsBehaviors[this->action](this);
|
||||
}
|
||||
|
||||
void GreatFairy_WingsInit(Entity* this) {
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->spritePriority.b0 = 5;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spriteRendering.alphaBlend = 1;
|
||||
gScreen.controls.layerFXControl = 0xF40;
|
||||
gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 8);
|
||||
this->nonPlanarMovement = 1024;
|
||||
sub_0805EC9C(this, 1024, 256, 0);
|
||||
}
|
||||
|
||||
void GreatFairy_WingsUpdate(Entity* this) {
|
||||
s32 iVar1;
|
||||
|
||||
iVar1 = this->nonPlanarMovement -= 32;
|
||||
if (iVar1 * 65536 >> 16 == 256) {
|
||||
this->action = 2;
|
||||
sub_0805EC60(this);
|
||||
gRoomVars.greatFairyState |= 32;
|
||||
gUnk_02033280 |= 4;
|
||||
} else {
|
||||
sub_0805EC9C(this, this->nonPlanarMovement, 256, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_116(Entity* this) {
|
||||
}
|
||||
|
||||
// The wake that appears beneath the Great Fairy as she stands in the water
|
||||
void GreatFairy_WakeCallBehavior(Entity* this) {
|
||||
GreatFairy_WakeBehaviors[this->action](this);
|
||||
}
|
||||
|
||||
void GreatFairy_WakeInit(Entity* this) {
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spritePriority.b0 = 6;
|
||||
}
|
||||
|
||||
void GreatFairy_WakeUpdate(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
// The miniature sprite that emerges from the water when Great Fairy is spawned
|
||||
void GreatFairy_MiniCallBehavior(Entity* this) {
|
||||
GreatFairy_MiniBehaviors[this->action](this);
|
||||
}
|
||||
|
||||
void GreatFairy_MiniInit(Entity* this) {
|
||||
Entity* aff;
|
||||
|
||||
aff = GreatFairy_CreateForm(this, MINIAFFINE, 0);
|
||||
if (aff != NULL) {
|
||||
CopyPosition(this, aff);
|
||||
aff->parent = this;
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Spawns a droplet of water once it reaches a certain height
|
||||
void GreatFairy_MiniRisingUpdate(Entity* this) {
|
||||
Entity* target;
|
||||
|
||||
GetNextFrame(this);
|
||||
this->height.WORD -= 0x8000;
|
||||
if (this->height.HALF.HI == -20) {
|
||||
this->action = 2;
|
||||
PlaySFX(321);
|
||||
} else {
|
||||
if (((this->height.HALF.HI == -10) && (this->field_0xf == 0)) &&
|
||||
(target = GreatFairy_CreateForm(this, DROPLET, 0), target != NULL)) {
|
||||
PositionRelative(this, target, 0, 0x40000);
|
||||
this->field_0xf = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Deletes itself
|
||||
void GreatFairy_MiniRemoveMe(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
sub_080873D0(this);
|
||||
if ((gRoomVars.greatFairyState & 1) != 0) {
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Same as mini Great Fairy except it is able to stretch
|
||||
void GreatFairy_MiniAffineCallBehavior(Entity* this) {
|
||||
GreatFairy_MiniAffineBehaviors[this->action](this);
|
||||
}
|
||||
|
||||
void GreatFairy_MiniAffineInit(Entity* this) {
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->spritePriority.b0 = 6;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
}
|
||||
|
||||
// Getting ready for affine transformation
|
||||
void GreatFairy_MiniAffineInit2(Entity* this) {
|
||||
Entity* parent = this->parent;
|
||||
|
||||
CopyPosition(parent, this);
|
||||
|
||||
if (this->height.HALF.HI == -20) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 90;
|
||||
this->nonPlanarMovement = 4096;
|
||||
this->spriteRendering.b0 = 3;
|
||||
sub_0805EC9C(this, 256, 256, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Mini great fairy stretch
|
||||
void GreatFairy_MiniAffineUpdate(Entity* this) {
|
||||
s32 iVar2;
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
gRoomVars.greatFairyState |= 1;
|
||||
this->action = 3;
|
||||
sub_0805EC60(this);
|
||||
} else {
|
||||
iVar2 = this->nonPlanarMovement -= 24;
|
||||
sub_0805EC9C(this, 256, iVar2 * 0x10000 >> 20, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// The droplet that falls off of the mini Great Fairy emerging from the water
|
||||
void GreatFairy_DropletCallBehavior(Entity* this) {
|
||||
GreatFairy_DropletBehaviors[this->action](this);
|
||||
}
|
||||
|
||||
void GreatFairy_DropletInit(Entity* this) {
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->height.HALF.HI = 0;
|
||||
this->spritePriority.b0 = 5;
|
||||
PlaySFX(320);
|
||||
}
|
||||
|
||||
void GreatFairy_DropletUpdate(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3) {
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Ripples that appear before the great fairy emerges
|
||||
void GreatFairy_RippleCallBehavior(Entity* this) {
|
||||
GreatFairy_RippleBehaviors[this->action](this);
|
||||
}
|
||||
|
||||
void GreatFairy_RippleInit(Entity* this) {
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spritePriority.b0 = 6;
|
||||
}
|
||||
|
||||
void GreatFairy_RippleUpdate(Entity* this) {
|
||||
if ((gRoomVars.greatFairyState & 2) != 0) {
|
||||
DeleteEntity(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Big ripple that appears in the spot where the fairy emerges from
|
||||
void GreatFairy_BigRippleCallBehavior(Entity* this) {
|
||||
GreatFairy_BigRippleBehaviors[this->action](this);
|
||||
}
|
||||
|
||||
void GreatFairy_BigRippleInit(Entity* this) {
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->actionDelay = 120;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spritePriority.b0 = 5;
|
||||
PlaySFX(249);
|
||||
}
|
||||
|
||||
void GreatFairy_BigRippleUpdate(Entity* this) {
|
||||
Entity* target;
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->actionDelay != 0) {
|
||||
--this->actionDelay;
|
||||
} else {
|
||||
target = GreatFairy_CreateForm(this, MINI, 0);
|
||||
if (target != NULL) {
|
||||
PositionRelative(this, target, 0, -0x80000);
|
||||
gRoomVars.greatFairyState |= 2;
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Energy bands that surround the mini Great Fairy as it is transforming
|
||||
void GreatFairy_EnergyCallBehavior(Entity* this) {
|
||||
GreatFairy_EnergyBehaviors[this->action](this);
|
||||
}
|
||||
|
||||
void GreatFairy_EnergyInit(Entity* this) {
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spritePriority.b0 = 5;
|
||||
}
|
||||
|
||||
void GreatFairy_EnergyUpdate(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3) {
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08087114(Entity* this) {
|
||||
if ((this->entityType).parameter == 0) {
|
||||
GreatFairy_Form1Behaviors[this->action](this);
|
||||
} else {
|
||||
GreatFairy_Form2Behaviors[this->action](this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
extern u8 gUnk_0812079C;
|
||||
|
||||
void sub_08087150(Entity* this) {
|
||||
u32 temp;
|
||||
|
||||
GreatFairy_InitializeAnimation();
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->spriteOrientation.flipY = 0;
|
||||
this->spriteRendering.b0 = 0;
|
||||
this->spritePriority.b0 = 3;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->direction = 0x10;
|
||||
temp = gUnk_0812079C;
|
||||
this->palette.raw = ((temp & 0xf) << 4) | 0xf;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_08087150(Entity* this) {
|
||||
asm(".include \"asm/greatFairy/sub_08087150.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void nullsub_516(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080871A8(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 60;
|
||||
gRoomVars.greatFairyState |= 4;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080871D0(Entity* this) {
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
gRoomVars.greatFairyState |= 8;
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080871F8(Entity* this) {
|
||||
Entity* temp = this->attachedEntity;
|
||||
|
||||
if ((temp->x.HALF.HI == this->x.HALF.HI) && (temp->y.HALF.HI - 0x20 == this->y.HALF.HI)) {
|
||||
this->action = 2;
|
||||
} else {
|
||||
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, temp->x.HALF.HI, temp->y.HALF.HI - 0x20);
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08087240(Entity* this) {
|
||||
if ((gRoomVars.greatFairyState & 4) != 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 20;
|
||||
this->direction = 16;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08087264(Entity* this) {
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808727C(Entity* this) {
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08087294(Entity* this) {
|
||||
gUnk_081207A4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080872AC(Entity* this) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->spriteRendering.b3 = 0;
|
||||
this->field_0x68.HWORD = this->x.HALF.HI;
|
||||
this->field_0x6a.HWORD = this->y.HALF.HI;
|
||||
this->direction = (u8)Random() & 0x1F;
|
||||
this->nonPlanarMovement = 32;
|
||||
GreatFairy_InitializeAnimation(this);
|
||||
}
|
||||
|
||||
void sub_080872F8(Entity* this) {
|
||||
s32 temp;
|
||||
sub_0806F69C(this);
|
||||
GetNextFrame(this);
|
||||
if (((u16)(this->field_0x68.HWORD - this->x.HALF.HI) > 0xc) ||
|
||||
((u16)(this->field_0x6a.HWORD - this->y.HALF.HI) > 0xc)) {
|
||||
this->direction =
|
||||
sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, (s16)this->field_0x68.HWORD, (s16)this->field_0x6a.HWORD);
|
||||
this->direction = (this->direction + gUnk_081207AC[Random() & 3]) & 0x1f;
|
||||
}
|
||||
temp = gSineTable[this->actionDelay + 0x40];
|
||||
this->height.HALF.HI = (temp >> 6) - 8;
|
||||
this->actionDelay++;
|
||||
}
|
||||
|
||||
void GreatFairy_InitializeAnimation(Entity* this) {
|
||||
s32 temp;
|
||||
|
||||
this->action = 1;
|
||||
temp = this->entityType.form;
|
||||
this->entityType.parameter = temp % 11;
|
||||
this->collisionLayer = 2;
|
||||
InitializeAnimation(this, this->entityType.parameter);
|
||||
sub_0805E3A0(this, 2);
|
||||
}
|
||||
|
||||
Entity* GreatFairy_CreateForm(Entity* this, u32 curForm, u32 parameter) {
|
||||
s32 nextForm;
|
||||
Entity* ent;
|
||||
|
||||
nextForm = this->entityType.form;
|
||||
nextForm /= 11;
|
||||
|
||||
ent = CreateObject(0x1b, (u8)nextForm * 11 + curForm, parameter);
|
||||
return ent;
|
||||
}
|
||||
|
||||
void sub_080873D0(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
ent = GreatFairy_CreateForm(this, 8, 0);
|
||||
if (ent != NULL) {
|
||||
CopyPosition(this, ent);
|
||||
this->actionDelay = 0x30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080873FC(void) {
|
||||
Entity* ent;
|
||||
|
||||
PlaySFX(0xf7);
|
||||
gRoomControls.cameraTarget = NULL;
|
||||
|
||||
while (ent = FindEntityInListBySubtype(0x6, 0x1b, 0x6), ent != NULL) {
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08087424(Entity* arg0, struct_08087424* arg1) {
|
||||
Entity* ent;
|
||||
|
||||
sub_080791D0();
|
||||
ent = CreateObject(0x64, 0, 0);
|
||||
if (ent != NULL) {
|
||||
ent->parent = &gPlayerEntity;
|
||||
CopyPosition(&gPlayerEntity, ent);
|
||||
sub_0805E3A0(ent, 2);
|
||||
}
|
||||
|
||||
switch (arg1->unk4) {
|
||||
case 0:
|
||||
gUnk_02002A40.stats.arrowCount = arg1->unk4;
|
||||
break;
|
||||
case 1:
|
||||
gUnk_02002A40.stats.bombCount = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808747C(u32 arg0, u32 arg1) {
|
||||
u32 iVar1;
|
||||
|
||||
iVar1 = FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0);
|
||||
if (iVar1 != 0) {
|
||||
iVar1 = 1;
|
||||
}
|
||||
*(u32*)(arg1 + 0x14) = iVar1;
|
||||
}
|
||||
|
||||
//clang-format off
|
||||
void (*const GreatFairy_Main[])(Entity*) = {
|
||||
GreatFairy_CallBehavior,
|
||||
GreatFairy_WingsCallBehavior,
|
||||
GreatFairy_WakeCallBehavior,
|
||||
GreatFairy_MiniCallBehavior,
|
||||
GreatFairy_MiniAffineCallBehavior,
|
||||
GreatFairy_DropletCallBehavior,
|
||||
GreatFairy_RippleCallBehavior,
|
||||
GreatFairy_BigRippleCallBehavior,
|
||||
GreatFairy_EnergyCallBehavior,
|
||||
sub_08087114,
|
||||
sub_08087294
|
||||
};
|
||||
|
||||
void (*const GreatFairy_Behaviors[])(Entity*) = {
|
||||
GreatFairy_Init,
|
||||
GreatFairy_DormantUpdate,
|
||||
GreatFairy_CreateBigRipple,
|
||||
GreatFairy_SpawningUpdate,
|
||||
GreatFairy_MiniUpdate,
|
||||
GreatFairy_FinalUpdate
|
||||
};
|
||||
|
||||
const s16 GreatFairy_RippleOffsets[10] = {
|
||||
0, 0,
|
||||
-32, -8,
|
||||
16, 20,
|
||||
24, -12,
|
||||
-16, 24
|
||||
};
|
||||
|
||||
|
||||
void (*const GreatFairy_WingsBehaviors[])(Entity*) = {
|
||||
GreatFairy_WingsInit,
|
||||
GreatFairy_WingsUpdate,
|
||||
nullsub_116
|
||||
};
|
||||
|
||||
void (*const GreatFairy_WakeBehaviors[])(Entity*) = {
|
||||
GreatFairy_WakeInit,
|
||||
GreatFairy_WakeUpdate
|
||||
};
|
||||
|
||||
void (*const GreatFairy_MiniBehaviors[])(Entity*) = {
|
||||
GreatFairy_MiniInit,
|
||||
GreatFairy_MiniRisingUpdate,
|
||||
GreatFairy_MiniRemoveMe
|
||||
};
|
||||
|
||||
void (*const GreatFairy_MiniAffineBehaviors[])(Entity*) = {
|
||||
GreatFairy_MiniAffineInit,
|
||||
GreatFairy_MiniAffineInit2,
|
||||
GreatFairy_MiniAffineUpdate,
|
||||
DeleteEntity
|
||||
};
|
||||
|
||||
void (*const GreatFairy_DropletBehaviors[])(Entity*) = {
|
||||
GreatFairy_DropletInit,
|
||||
GreatFairy_DropletUpdate
|
||||
};
|
||||
|
||||
void (*const GreatFairy_RippleBehaviors[])(Entity*) = {
|
||||
GreatFairy_RippleInit,
|
||||
GreatFairy_RippleUpdate
|
||||
};
|
||||
|
||||
void (*const GreatFairy_BigRippleBehaviors[])(Entity*) = {
|
||||
GreatFairy_BigRippleInit,
|
||||
GreatFairy_BigRippleUpdate
|
||||
};
|
||||
|
||||
void (*const GreatFairy_EnergyBehaviors[])(Entity*) = {
|
||||
GreatFairy_EnergyInit,
|
||||
GreatFairy_EnergyUpdate
|
||||
};
|
||||
void (*const GreatFairy_Form1Behaviors[])(Entity*) = {
|
||||
sub_08087150,
|
||||
nullsub_516,
|
||||
sub_080871A8,
|
||||
sub_080871D0
|
||||
};
|
||||
|
||||
void (*const GreatFairy_Form2Behaviors[])(Entity*) = {
|
||||
sub_08087150,
|
||||
sub_080871F8,
|
||||
sub_08087240,
|
||||
sub_08087264,
|
||||
sub_0808727C
|
||||
};
|
||||
|
||||
//clang-format on
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void DeleteThisEntity();
|
||||
extern void sub_08080CB4(Entity*);
|
||||
extern int sub_08017850(Entity*);
|
||||
extern void CreateItemEntity(u32, u32, u32);
|
||||
|
||||
static void sub_0808E6A0(Entity*);
|
||||
static void sub_0808E6E4(Entity*);
|
||||
static void sub_0808E714(Entity*);
|
||||
static void sub_0808E764(Entity*);
|
||||
|
||||
static void (*const gHeartContainerActions[])(Entity*) = {
|
||||
sub_0808E6A0,
|
||||
sub_0808E6E4,
|
||||
sub_0808E714,
|
||||
sub_0808E764,
|
||||
};
|
||||
|
||||
extern BoundingBox gUnk_08121C58;
|
||||
|
||||
void HeartContainer(Entity* this) {
|
||||
gHeartContainerActions[this->action](this);
|
||||
}
|
||||
|
||||
static void sub_0808E6A0(Entity* this) {
|
||||
if (CheckFlags(this->cutsceneBeh.HWORD)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->entityType.form = 0x62;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->boundingBox = &gUnk_08121C58;
|
||||
this->collisionLayer = 3;
|
||||
this->scriptedScene = 3;
|
||||
}
|
||||
|
||||
static void sub_0808E6E4(Entity* this) {
|
||||
if (CheckFlags(this->field_0x86)) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spriteRendering.b0 = 3;
|
||||
sub_0808E714(this);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0808E714(Entity* this) {
|
||||
int var0 = 0x400 - this->field_0xf * 8;
|
||||
if (var0 > 0x100) {
|
||||
this->field_0xf++;
|
||||
sub_0805EC9C(this, var0, var0, 0);
|
||||
} else {
|
||||
this->action = 3;
|
||||
this->field_0x3c |= 0x10;
|
||||
sub_0805EC60(this);
|
||||
PlaySFX(0x141);
|
||||
}
|
||||
sub_08080CB4(this);
|
||||
}
|
||||
|
||||
static void sub_0808E764(Entity* this) {
|
||||
sub_08080CB4(this);
|
||||
if (!(gPlayerState.flags.all & 0x80) && sub_08017850(this)) {
|
||||
SetFlag(this->cutsceneBeh.HWORD);
|
||||
CreateItemEntity(0x62, 0, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
Executable
+187
@@ -0,0 +1,187 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
#include "room.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ u16 unk0;
|
||||
/*0x02*/ u16 unk2;
|
||||
/*0x04*/ u8 unk4;
|
||||
/*0x05*/ u8 unk5;
|
||||
/*0x06*/ u8 unk6;
|
||||
/*0x07*/ u8 unk7;
|
||||
/*0x08*/ u8 *unk8;
|
||||
} unk_DoorProperty;
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ u8 filler0[0x8];
|
||||
/*0x08*/ u32 unk8;
|
||||
} unk_80868EC;
|
||||
|
||||
static void sub_080868EC(Entity* entity, unk_80868EC* arg1);
|
||||
static bool32 sub_080867CC(u32);
|
||||
static void sub_0808681C(Entity*);
|
||||
static u8 sub_08086954(Entity*);
|
||||
|
||||
extern u32 sub_080562CC(u32, u32, u32, u32);
|
||||
extern void sub_08078AC0(u32, u32, u32);
|
||||
extern void* GetCurrentRoomProperty(u8);
|
||||
|
||||
extern void (*const gUnk_081206B4[])(Entity*);
|
||||
extern BoundingBox gUnk_081206AC; // TODO: should be const
|
||||
|
||||
void HouseDoorExterior(Entity* this) {
|
||||
gUnk_081206B4[this->entityType.parameter](this);
|
||||
}
|
||||
|
||||
void sub_080866D8(Entity* this) {
|
||||
unk_DoorProperty* prop;
|
||||
Entity* entity;
|
||||
u32 i;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
*((u32 *)(&this->field_0x68)) = 0;
|
||||
this->field_0x6c.HALF.LO = this->actionDelay;
|
||||
sub_0805E3A0(this, 6);
|
||||
}
|
||||
|
||||
prop = GetCurrentRoomProperty(this->field_0x6c.HALF.LO);
|
||||
for (i = 0; prop->unk0 != 0xFFFF && i < 32; prop++, i++) {
|
||||
int mask = 1 << i;
|
||||
if ((*((u32 *)(&this->field_0x68)) & mask) == 0 &&
|
||||
sub_080867CC(prop->unk5) &&
|
||||
sub_080562CC(prop->unk0, prop->unk2, 32, 32)) {
|
||||
entity = CreateObject(0x19, prop->unk7, prop->unk6);
|
||||
if (entity) {
|
||||
entity->field_0x6c.HALF.LO = i;
|
||||
entity->x.HALF.HI = gRoomControls.roomOriginX + prop->unk0 + 16;
|
||||
entity->y.HALF.HI = gRoomControls.roomOriginY + prop->unk2 + 32;
|
||||
entity->parent = this;
|
||||
entity->field_0x68.HWORD = prop->unk0;
|
||||
entity->field_0x6a.HWORD = prop->unk2;
|
||||
entity->collisionLayer = prop->unk4;
|
||||
entity->previousActionFlag = prop->unk5;
|
||||
UpdateSpriteForCollisionLayer(entity);
|
||||
*((u32 *)(&this->field_0x68)) |= mask;
|
||||
if (prop->unk8) {
|
||||
*((u32 **)(&entity->cutsceneBeh)) = StartCutscene(entity, prop->unk8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 sub_080867CC(u32 arg0) {
|
||||
if (arg0 == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
if (arg0 != 2) {
|
||||
return TRUE;
|
||||
}
|
||||
return CheckGlobalFlag(TATEKAKE_HOUSE);
|
||||
}
|
||||
|
||||
void sub_080867E4(Entity* this) {
|
||||
if (!sub_080562CC(this->field_0x68.HWORD, this->field_0x6a.HWORD, 32, 32)) {
|
||||
*((u32 *)(&this->parent->field_0x68)) = *((u32 *)(&this->parent->field_0x68)) & ~(1 << this->field_0x6c.HALF.LO);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
sub_0808681C(this);
|
||||
}
|
||||
|
||||
static void sub_0808681C(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->actionDelay = 8;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->frameIndex = 0;
|
||||
this->boundingBox = &gUnk_081206AC;
|
||||
if (this->previousActionFlag == 1) {
|
||||
this->action = 2;
|
||||
this->frameIndex = 1;
|
||||
}
|
||||
if (this->flags & 0x2) {
|
||||
this->action = 2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!sub_08086954(this)) {
|
||||
this->action++;
|
||||
this->frameIndex = 1;
|
||||
sub_08078AC0(16, 0, 1);
|
||||
PlaySFX(0x111);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->flags & 0x2) {
|
||||
ExecuteScriptCommandSet(this, *(u32 **)&this->cutsceneBeh);
|
||||
sub_080868EC(this, *(void **)&this->cutsceneBeh);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080868B0(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->boundingBox = &gUnk_081206AC;
|
||||
this->actionDelay = 8;
|
||||
}
|
||||
ExecuteScriptCommandSet(this, *(u32 **)&this->cutsceneBeh);
|
||||
sub_080868EC(this, *(void **)&this->cutsceneBeh);
|
||||
}
|
||||
|
||||
static void sub_080868EC(Entity* entity, unk_80868EC* arg1) {
|
||||
u32 var0 = arg1->unk8;
|
||||
arg1->unk8 = 0;
|
||||
while (var0 != 0) {
|
||||
u32 rightMostSetBit = var0 & (~var0 + 1);
|
||||
var0 ^= rightMostSetBit;
|
||||
switch (rightMostSetBit) {
|
||||
case 0x80:
|
||||
entity->frameIndex = 0;
|
||||
break;
|
||||
case 0x100:
|
||||
entity->frameIndex = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (entity->frameIndex == 0) {
|
||||
sub_0800445C(entity);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808692C(Entity* this) {
|
||||
this->flags &= 0xFD;
|
||||
this->entityType.parameter = 2;
|
||||
this->action = this->frameIndex == 0 ? 1 : 2;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = 8;
|
||||
}
|
||||
|
||||
static u8 sub_08086954(Entity* this) {
|
||||
if (sub_0800445C(this)) {
|
||||
if (sub_0806ED9C(this, 6, 20) >= 0 &&
|
||||
gPlayerEntity.animationState == 0 &&
|
||||
(u16)gPlayerState.field_0x90.HALF.LO == 0x400 &&
|
||||
gPlayerState.jumpStatus == 0) {
|
||||
this->actionDelay--;
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = 8;
|
||||
}
|
||||
return this->actionDelay;
|
||||
}
|
||||
|
||||
// TODO: Second arg is some unknown struct.
|
||||
void sub_080869A4(Entity* entityA, u32* entityB) {
|
||||
entityB[5] = 0;
|
||||
if (!sub_08086954(entityA)) {
|
||||
entityA->actionDelay = 8;
|
||||
entityB[5] = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "room.h"
|
||||
|
||||
extern void sub_080A0960(Entity*, u32);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0801AF18(u8*, u32, u32);
|
||||
|
||||
extern void (*const gUnk_08124950[])(Entity*);
|
||||
extern u8 gUnk_08124960;
|
||||
extern u8 gUnk_0812497A;
|
||||
|
||||
void JailBars(Entity *this)
|
||||
{
|
||||
gUnk_08124950[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A08C4(Entity *this)
|
||||
{
|
||||
if (CheckFlags(this->field_0x86) == 0) {
|
||||
this->action = 1;
|
||||
sub_080A0960(this, 0);
|
||||
}
|
||||
else {
|
||||
this->action = 3;
|
||||
InitializeAnimation(this,1);
|
||||
sub_080A0960(this, 1);
|
||||
}
|
||||
this->spriteSettings.b.draw = 3; // ???
|
||||
this->collisionLayer = 1;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
}
|
||||
|
||||
void sub_080A0910(Entity *this)
|
||||
{
|
||||
if (CheckFlags(this->field_0x86) != 0) {
|
||||
this->action = 2;
|
||||
sub_080A0960(this, 1);
|
||||
PlaySFX(0x10b);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A0938(Entity *this)
|
||||
{
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->action = 3;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_127(Entity* this) {}
|
||||
|
||||
void sub_080A0960(Entity *this, u32 arg1)
|
||||
{
|
||||
u8 *puVar1;
|
||||
|
||||
puVar1 = &gUnk_08124960;
|
||||
if (arg1 == 1) {
|
||||
puVar1 = &gUnk_0812497A;
|
||||
}
|
||||
sub_0801AF18(puVar1, COORD_TO_TILE(this), 1);
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0809EB30(Entity*);
|
||||
extern void sub_0809EAD8(Entity*);
|
||||
extern void sub_0809EABC(Entity*);
|
||||
extern void sub_08004488(u32);
|
||||
extern void sub_080A2CC0(Entity*, Entity**, u16*);
|
||||
extern Entity* GetCurrentRoomProperty(u32);
|
||||
extern void SetTile(u32, u32, u32);
|
||||
extern void sub_0806F69C(Entity*);
|
||||
|
||||
extern void (*const gUnk_081243B4[])(Entity*);
|
||||
extern void (*const gUnk_081243BC[])(Entity*);
|
||||
extern void (*const gUnk_081243C4[])(Entity*);
|
||||
|
||||
extern BoundingBox gUnk_080FD150;
|
||||
|
||||
void LightableSwitch(Entity* this) {
|
||||
gUnk_081243B4[this->entityType.form](this);
|
||||
sub_0809EB30(this);
|
||||
}
|
||||
|
||||
void sub_0809EA1C(Entity* this) {
|
||||
gUnk_081243BC[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809EA34(Entity* this) {
|
||||
this->action = 1;
|
||||
this->flags = this->flags | 0x80;
|
||||
this->frameIndex = 0;
|
||||
this->field_0x3c = 7;
|
||||
this->field_0x40 = 0x48;
|
||||
this->damageType = 0x28;
|
||||
this->flags2 = 10;
|
||||
this->boundingBox = &gUnk_080FD150;
|
||||
sub_0809EAD8(this);
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
sub_0809EABC(this);
|
||||
}
|
||||
|
||||
void sub_0809EA80(Entity* this) {
|
||||
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
if (CheckFlags(this->field_0x86) != 0) {
|
||||
ClearFlag(this->field_0x86);
|
||||
} else {
|
||||
SetFlag(this->field_0x86);
|
||||
}
|
||||
sub_08004488(0x110);
|
||||
}
|
||||
sub_0809EABC(this);
|
||||
}
|
||||
|
||||
void sub_0809EABC(Entity* this) {
|
||||
bool32 anySet;
|
||||
u32 f;
|
||||
|
||||
f = CheckFlags(this->field_0x86);
|
||||
anySet = (-f | f) >> 0x1F;
|
||||
if (this->frameIndex != anySet) {
|
||||
this->frameIndex = anySet;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809EAD8(Entity* this) {
|
||||
u8 bVar1;
|
||||
Entity* pEVar2;
|
||||
|
||||
if (this->entityType.parameter != 0) {
|
||||
|
||||
this->attachedEntity = GetCurrentRoomProperty(this->entityType.parameter);
|
||||
sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD);
|
||||
|
||||
} else {
|
||||
SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809EB30(Entity* this) {
|
||||
u16 uVar1;
|
||||
u16* puVar2;
|
||||
|
||||
if (this->entityType.parameter != 0) {
|
||||
if ((this->direction & 0x80) == 0) {
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
puVar2 = &this->field_0x74.HWORD;
|
||||
if (!--*puVar2) {
|
||||
sub_080A2CC0(this, &this->attachedEntity, puVar2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809EB68(Entity* this) {
|
||||
gUnk_081243C4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809EB80(Entity* this) {
|
||||
|
||||
this->action = 1;
|
||||
this->flags = this->flags | 0x80;
|
||||
this->frameIndex = 3;
|
||||
this->field_0x3c = 7;
|
||||
this->field_0x40 = 0x48;
|
||||
this->damageType = 0x28;
|
||||
this->flags2 = 10;
|
||||
this->boundingBox = &gUnk_080FD150;
|
||||
sub_0809EAD8(this);
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
if (CheckFlags(this->cutsceneBeh.HWORD) != 0) {
|
||||
this->action = 3;
|
||||
this->frameIndex = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809EBD8(Entity* this) {
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x10;
|
||||
this->frameIndex = 2;
|
||||
SetFlag(this->field_0x86);
|
||||
sub_08004488(0x110);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809EC08(Entity* this) {
|
||||
|
||||
if (CheckFlags(this->cutsceneBeh.HWORD) != 0) {
|
||||
this->action = 3;
|
||||
|
||||
} else {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->frameIndex = 3;
|
||||
ClearFlag(this->field_0x86);
|
||||
sub_08004488(0x110);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_126(Entity* this) { }
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
extern Entity* GetCurrentRoomProperty(u32);
|
||||
extern void sub_080A2CC0(Entity*, Entity**, u16*);
|
||||
|
||||
extern u16 gUnk_08123318[];
|
||||
|
||||
void LilypadSmall(Entity *this)
|
||||
{
|
||||
u32 rand;
|
||||
u16 *psVar4;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x5a;
|
||||
rand = Random();
|
||||
this->field_0xf = rand;
|
||||
this->frameIndex = (rand >> 0x10) & 3;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->attachedEntity = GetCurrentRoomProperty(this->entityType.parameter);
|
||||
sub_080A2CC0(this, &this->attachedEntity, &this->field_0x70.HALF.LO);
|
||||
}
|
||||
sub_080A2BE4(this, sub_08097ADC(this));
|
||||
sub_08097B24(this);
|
||||
psVar4 = (u16 *)&this->field_0x70;
|
||||
if (--*psVar4 == 0) {
|
||||
sub_080A2CC0(this, &this->attachedEntity, psVar4);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_08097ADC(Entity *this)
|
||||
{
|
||||
if ((gPlayerState.flags.all & 0x80) == 0) {
|
||||
return 0;
|
||||
} else if (sub_080041A0(this,&gPlayerEntity,8,8) == 0) {
|
||||
return 0;
|
||||
} else if (sub_08079F8C() == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
gPlayerState.field_0x14 = 1;
|
||||
if (gPlayerEntity.height.HALF.HI != 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08097B24(Entity *this)
|
||||
{
|
||||
u32 temp;
|
||||
u32 temp2;
|
||||
u16 *temp3;
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 0x5a;
|
||||
this->frameIndex = (this->frameIndex + 1) & 3;
|
||||
}
|
||||
temp3 = gUnk_08123318;
|
||||
temp2 = ++this->field_0xf;
|
||||
|
||||
temp = temp3[(temp2 >> 5) & 7];
|
||||
sub_0805EC9C(this, temp, temp, 0);
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "random.h"
|
||||
|
||||
extern Entity gPlayerEntity;
|
||||
extern u16 gScreenTransition[];
|
||||
|
||||
extern void (*MaskActionFuncs[])(Entity *);
|
||||
|
||||
extern void DeleteThisEntity();
|
||||
|
||||
extern bool32 CheckFlags(u16);
|
||||
extern void SetFlag(u16);
|
||||
extern void ClearFlag(u16);
|
||||
|
||||
extern void SetTile(u32, u16, u32);
|
||||
|
||||
extern void sub_08000148(u16, u16, u32);
|
||||
extern s16 sub_080001DA(u16, u32);
|
||||
extern u16 sub_080002E0(u16, u32);
|
||||
|
||||
extern void sub_08004488(u32);
|
||||
extern void sub_080044EC(Entity *, u16);
|
||||
extern void sub_0805457C(Entity *, s32);
|
||||
|
||||
|
||||
void Mask(Entity *this) {
|
||||
MaskActionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080929A4(Entity *this) {
|
||||
if (this->entityType.parameter & 0xC0) {
|
||||
if (CheckFlags(this->field_0x86)) {
|
||||
s32 field_0x0a;
|
||||
|
||||
switch (this->entityType.parameter & 0xC0) {
|
||||
case 0x40:
|
||||
field_0x0a = gScreenTransition[0x5];
|
||||
|
||||
switch (field_0x0a) {
|
||||
case 0x44D ... 0x44F:
|
||||
case 0x182:
|
||||
DeleteThisEntity();
|
||||
goto switchEnd;
|
||||
}
|
||||
|
||||
ClearFlag(this->field_0x86);
|
||||
break;
|
||||
case 0x80:
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
switchEnd:
|
||||
}
|
||||
}
|
||||
|
||||
this->action = 1;
|
||||
this->field_0x20 = 0x18000;
|
||||
|
||||
this->field_0x78.HWORD = ((Random() & 7) << 10) | 0x2000;
|
||||
|
||||
this->field_0xf = this->actionDelay >> 1;
|
||||
this->actionDelay = 0;
|
||||
|
||||
this->frameIndex = this->entityType.parameter & 0x3f;
|
||||
|
||||
this->field_0x7c.HALF.HI = COORD_TO_TILE(this);
|
||||
this->field_0x7c.HALF.LO = sub_080001DA(this->field_0x7c.HALF.HI, 1);
|
||||
|
||||
this->field_0x7a.HWORD = sub_080002E0(this->field_0x7c.HALF.HI, 1);
|
||||
|
||||
SetTile(0x4022, this->field_0x7c.HALF.HI, 1);
|
||||
}
|
||||
|
||||
// Probably related to knocking it down
|
||||
void sub_08092A94(Entity *this) {
|
||||
// Check for the first frame of bonking animation
|
||||
if (gPlayerEntity.action != 6) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gPlayerEntity.animationState != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if link is close enough to the mask
|
||||
if (this->y.HALF.HI + 40 < gPlayerEntity.y.HALF.HI) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->x.HALF.HI - gPlayerEntity.x.HALF.HI >= this->field_0xf || this->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -this->field_0xf) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Presumably, make the mask fall
|
||||
SetTile((u16)this->field_0x7c.HALF.LO, this->field_0x7c.HALF.HI, 1);
|
||||
|
||||
sub_08000148(this->field_0x7a.HWORD, this->field_0x7c.HALF.HI, 1);
|
||||
|
||||
this->action = 2;
|
||||
|
||||
this->height.HALF.HI -= 0x20;
|
||||
this->y.HALF.HI += 0x20;
|
||||
|
||||
this->spriteRendering.b3 = 2;
|
||||
}
|
||||
|
||||
// Probably falling down
|
||||
void sub_08092B0C(Entity *this) {
|
||||
if (this->actionDelay == 1) {
|
||||
this->action = 3;
|
||||
|
||||
this->actionDelay = 0;
|
||||
switch (this->entityType.parameter & 0xC0)
|
||||
{
|
||||
case 0x80:
|
||||
sub_08004488(0x72);
|
||||
case 0x40:
|
||||
SetFlag(this->field_0x86);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
CreateFx(this, 5, 0);
|
||||
|
||||
sub_0805457C(this, 3);
|
||||
}
|
||||
else {
|
||||
sub_080044EC(this, this->field_0x78.HWORD);
|
||||
|
||||
if (this->height.HALF.HI == 0) {
|
||||
this->actionDelay++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mask_Delete(Entity *this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern u32 sub_08083734(Entity*, u32);
|
||||
extern void sub_080A080C(Entity*);
|
||||
extern void sub_0806F69C(Entity*);
|
||||
extern void sub_08004488(u32);
|
||||
extern void sub_080A0870(Entity*);
|
||||
extern void PlaySFX(u32);
|
||||
extern u32 sub_080001DA(u32, u32);
|
||||
extern void SetTile(u32, u32, u32);
|
||||
|
||||
extern void (*const gUnk_0812493C[])(Entity*);
|
||||
|
||||
extern BoundingBox gUnk_080FD180;
|
||||
|
||||
void MetalDoor(Entity* this) {
|
||||
gUnk_0812493C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A0684(Entity *this)
|
||||
{
|
||||
if ((this->cutsceneBeh.HWORD != 0xffff) && CheckFlags(this->cutsceneBeh.HWORD)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->nonPlanarMovement = 0x300;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->frameIndex = 0;
|
||||
this->spriteSettings.b.flipY = 1;
|
||||
this->boundingBox = &gUnk_080FD180;
|
||||
this->spritePriority.b0 = 5;
|
||||
this->field_0x70.HALF.LO = this->x.HALF.HI;
|
||||
this->field_0x70.HALF.HI = this->y.HALF.HI;
|
||||
this->field_0x74.HWORD = COORD_TO_TILE(this);
|
||||
}
|
||||
|
||||
void sub_080A0718(Entity *this)
|
||||
{
|
||||
if (sub_08083734(this, 2) != 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0xc;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->direction = 0;
|
||||
this->y.HALF.HI += 0x24;
|
||||
sub_080A080C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A074C(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
Entity *ent;
|
||||
|
||||
sub_0806F69C(this);
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 3;
|
||||
this->height.HALF.HI = 0;
|
||||
this->x.HALF.HI = this->field_0x70.HALF.LO;
|
||||
this->y.HALF.HI = this->field_0x70.HALF.HI;
|
||||
ent = CreateFx(this, 0x11, 0x40);
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI += 0xc;
|
||||
ent->y.HALF.HI -= 0xc;
|
||||
}
|
||||
ent = CreateFx(this, 0x11, 0x40);
|
||||
if (ent != NULL) {
|
||||
ent->x.HALF.HI -= 0xc;
|
||||
ent->y.HALF.HI -= 0xc;
|
||||
}
|
||||
sub_08004488(0x10b);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A07BC(Entity *this)
|
||||
{
|
||||
if (CheckFlags(this->field_0x86)) {
|
||||
this->action = 4;
|
||||
this->actionDelay = 0xc;
|
||||
this->direction = 0x10;
|
||||
this->y.HALF.HI += 2;
|
||||
sub_080A0870(this);
|
||||
PlaySFX(0x10b);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A07F0(Entity *this)
|
||||
{
|
||||
|
||||
sub_0806F69C(this);
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A080C(Entity *this)
|
||||
{
|
||||
this->field_0x76.HWORD = sub_080001DA(this->field_0x74.HWORD - 1, this->collisionLayer);
|
||||
this->field_0x78.HWORD = sub_080001DA(this->field_0x74.HWORD, this->collisionLayer);
|
||||
this->field_0x7a.HWORD = sub_080001DA(this->field_0x74.HWORD + 1, this->collisionLayer);
|
||||
SetTile(0x4022, this->field_0x74.HWORD - 1, this->collisionLayer);
|
||||
SetTile(0x4022, this->field_0x74.HWORD, this->collisionLayer);
|
||||
SetTile(0x4022, this->field_0x74.HWORD + 1, this->collisionLayer);
|
||||
}
|
||||
|
||||
void sub_080A0870(Entity *this)
|
||||
{
|
||||
SetTile(this->field_0x76.HWORD, this->field_0x74.HWORD - 1, this->collisionLayer);
|
||||
SetTile(this->field_0x78.HWORD, this->field_0x74.HWORD, this->collisionLayer);
|
||||
SetTile(this->field_0x7a.HWORD, this->field_0x74.HWORD + 1, this->collisionLayer);
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "room.h"
|
||||
|
||||
extern u32 sub_08091DDC(Entity*);
|
||||
extern u32 sub_080002B4(Entity*, u32, u32);
|
||||
extern u32 sub_08007DD6(u32, u32);
|
||||
extern void sub_08017744(Entity*);
|
||||
extern u32 sub_080002B8(Entity*);
|
||||
extern void sub_08091C0C(Entity*);
|
||||
|
||||
typedef struct {
|
||||
u16 field_0x0;
|
||||
u16 field_0x2;
|
||||
u8 field_0x4;
|
||||
u8 field_0x5;
|
||||
u8 field_0x6;
|
||||
u8 field_0x7;
|
||||
} struct_030010EC;
|
||||
|
||||
extern void (*const gUnk_081223A8[])(Entity*);
|
||||
|
||||
extern struct_030010EC gUnk_030010EC[];
|
||||
extern BoundingBox gUnk_080FD310;
|
||||
|
||||
extern const s8 gUnk_081223C8[];
|
||||
extern const u32 gUnk_081223D8[];
|
||||
|
||||
void Minecart(Entity* this) {
|
||||
gUnk_081223A8[this->action](this);
|
||||
this->bitfield = 0;
|
||||
}
|
||||
|
||||
void sub_080916EC(Entity* this) {
|
||||
struct_030010EC* unk = &gUnk_030010EC[this->actionDelay];
|
||||
|
||||
*(struct_030010EC**)&this->cutsceneBeh.HWORD = unk;
|
||||
if ((gRoomControls.roomID != unk->field_0x4) || (gPlayerState.flags.all & 0x1000) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->x.HALF.HI = gRoomControls.roomOriginX + ((unk->field_0x0 & 0x3f) << 4) + 8;
|
||||
this->y.HALF.HI = gRoomControls.roomOriginY + ((unk->field_0x0 & 0xfc << 4) >> 2) + 8;
|
||||
this->animationState = unk->field_0x5;
|
||||
this->entityType.parameter = unk->field_0x6;
|
||||
this->action = 1;
|
||||
this->boundingBox = &gUnk_080FD310;
|
||||
this->flags |= 0x80;
|
||||
this->damageType = 1;
|
||||
this->field_0x3c = 0x47;
|
||||
this->field_0x40 = 0x44;
|
||||
this->flags2 = 0x80;
|
||||
this->direction = this->animationState << 3;
|
||||
this->nonPlanarMovement = 0x700;
|
||||
this->spritePriority.b1 = 3;
|
||||
InitAnimationForceUpdate(this, this->entityType.parameter + 4 + this->animationState);
|
||||
SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer);
|
||||
}
|
||||
|
||||
void sub_080917DC(Entity* this) {
|
||||
|
||||
if ((this->bitfield & 0x7f) == 0x1d) {
|
||||
this->field_0x20 = 0x2a000;
|
||||
this->action = 7;
|
||||
InitAnimationForceUpdate(this, this->entityType.parameter + 4 + this->animationState);
|
||||
PlaySFX(0x13b);
|
||||
} else {
|
||||
if (sub_0800445C(this) != 0) {
|
||||
if (((gPlayerState.flags.all & 0x40080) == 0) && (gPlayerState.field_0x1c == 0) &&
|
||||
(gPlayerState.heldObject == 0) && (gPlayerState.jumpStatus == 0)) {
|
||||
this->actionDelay++;
|
||||
} else {
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
if ((this->entityType).parameter == 0) {
|
||||
if (8 < this->actionDelay) {
|
||||
this->action = this->action + 1;
|
||||
gPlayerState.jumpStatus = 0x81;
|
||||
gPlayerState.flags.all |= 0x4000000;
|
||||
gPlayerEntity.field_0x20 = 0x20000;
|
||||
gPlayerEntity.nonPlanarMovement = 0x100;
|
||||
gPlayerEntity.flags &= 0x7f;
|
||||
ResetPlayer();
|
||||
sub_0807A108();
|
||||
PlaySFX(0x7c);
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080918A4(Entity *this)
|
||||
{
|
||||
if (sub_080041A0(this, &gPlayerEntity, 2, 2) != 0) {
|
||||
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
|
||||
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
|
||||
if (gPlayerEntity.height.HALF.HI > -0x10) {
|
||||
if ((s32)gPlayerEntity.field_0x20 > -1) {
|
||||
return;
|
||||
}
|
||||
gPlayerEntity.animationState = this->animationState << 1;
|
||||
gPlayerState.flags.all = (gPlayerState.flags.all ^ 0x4000000) | 0x1000;
|
||||
this->action++;
|
||||
this->field_0xf = 1;
|
||||
this->flags |= 0x20;
|
||||
this->damageType = 0x97;
|
||||
this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x20;
|
||||
this->flags2 = gPlayerEntity.flags2;
|
||||
this->field_0x40 = 0x18;
|
||||
this->field_0x44 = 8;
|
||||
sub_0801766C(this);
|
||||
sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer);
|
||||
PlaySFX(0x137);
|
||||
}
|
||||
}
|
||||
else {
|
||||
gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, this);
|
||||
}
|
||||
if (gPlayerEntity.field_0x20 < 0) {
|
||||
gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080919AC(Entity *this)
|
||||
{
|
||||
u32 iVar2;
|
||||
u32 uVar3;
|
||||
|
||||
gRoomControls.unk5 = 7;
|
||||
if ((gPlayerState.flags.all & 0x1000) == 0) {
|
||||
this->action = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((gPlayerEntity.frames.all & 0xf) == 0) {
|
||||
this->flags = this->flags & 0x7f;
|
||||
CopyPosition(this,&gPlayerEntity);
|
||||
if ((gPlayerEntity.frames.all & 0xf0) == 0x10) {
|
||||
this->spriteOffsetY = 1;
|
||||
} else {
|
||||
this->spriteOffsetY = 0;
|
||||
}
|
||||
} else {
|
||||
this->flags = this->flags | 0x80;
|
||||
gPlayerEntity.nonPlanarMovement = 0;
|
||||
sub_0806F69C(this);
|
||||
CopyPosition(this,&gPlayerEntity);
|
||||
gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1;
|
||||
if (!sub_08091DDC(this)) {
|
||||
if ((gScreenTransition.frameCount & 0xf) == 0) {
|
||||
PlaySFX(0x138);
|
||||
}
|
||||
|
||||
if (--this->field_0xf == 0xff) {
|
||||
PlaySFX(0x7b);
|
||||
this->field_0xf = 0x3c;
|
||||
}
|
||||
|
||||
uVar3 = sub_080002B4(this, gUnk_081223C8[this->animationState * 2], gUnk_081223C8[this->animationState * 2 + 1]);
|
||||
iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[this->animationState]);
|
||||
if (iVar2 == 0) {
|
||||
this->direction = this->direction ^ 0x10;
|
||||
this->animationState = this->animationState ^ 2;
|
||||
} else {
|
||||
switch (uVar3) {
|
||||
case 0x64:
|
||||
this->flags = this->flags & 0xdf;
|
||||
this->damageType = 1;
|
||||
this->field_0x3c = 0x47;
|
||||
this->field_0x40 = 0x44;
|
||||
this->flags2 = 0x80;
|
||||
this->action = 6;
|
||||
sub_08017744(this);
|
||||
gPlayerState.jumpStatus = 0x41;
|
||||
gPlayerState.flags.all = (gPlayerState.flags.all ^ 0x1000) | 0x4000000;
|
||||
gPlayerEntity.field_0x20 = 0x20000;
|
||||
gPlayerEntity.nonPlanarMovement = 0x200;
|
||||
gPlayerEntity.animationState = this->animationState << 1;
|
||||
gPlayerEntity.direction = this->direction;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
sub_08004168(this);
|
||||
InitAnimationForceUpdate(this, this->animationState + 0xc);
|
||||
PlaySFX(0x78);
|
||||
PlaySFX(0x139);
|
||||
return;
|
||||
case 0x67:
|
||||
case 0x68:
|
||||
case 0x69:
|
||||
case 0x6a:
|
||||
case 0x6c:
|
||||
case 0x6d:
|
||||
case 0x6e:
|
||||
case 0x6f:
|
||||
if (uVar3 == sub_080002B8(this)) {
|
||||
sub_08091C0C(this);
|
||||
gPlayerEntity.animationState = this->animationState << 1;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gPlayerEntity.animationState = this->animationState << 1;
|
||||
if (this->animIndex == this->animationState) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
else {
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void (*MineralWaterSourceActionFuncs[])(Entity *);
|
||||
|
||||
typedef struct {
|
||||
u8 field_0x00;
|
||||
u8 field_0x01;
|
||||
u8 field_0x02;
|
||||
u8 field_0x03;
|
||||
} UnkStruct_MineralWater;
|
||||
|
||||
extern UnkStruct_MineralWater MineralWaterSourceParameters[];
|
||||
|
||||
extern bool32 sub_0806FBD8(Entity *);
|
||||
|
||||
void MineralWaterSource(Entity *this) {
|
||||
MineralWaterSourceActionFuncs[this->action](this);
|
||||
}
|
||||
|
||||
void MineralWaterSource_Init(Entity *this) {
|
||||
UnkStruct_MineralWater *unknownParameters;
|
||||
|
||||
if (!sub_0806FBD8(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
unknownParameters = &MineralWaterSourceParameters[this->entityType.form];
|
||||
|
||||
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->flags |= 0x80;
|
||||
|
||||
this->field_0x3c = 7;
|
||||
this->damageType = 145;
|
||||
this->flags2 = 2;
|
||||
|
||||
this->action = 1;
|
||||
}
|
||||
|
||||
void sub_080973DC(Entity *this) {
|
||||
this->bitfield = 0;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void (* const gUnk_081247F8[])(Entity*);
|
||||
|
||||
void MinishLight(Entity* this)
|
||||
{
|
||||
gUnk_081247F8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809F840(Entity* this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->frameIndex = 0;
|
||||
this->actionDelay = 0x20;
|
||||
this->field_0xf = 0;
|
||||
|
||||
if (this->entityType.parameter != 0)
|
||||
{
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
}
|
||||
|
||||
void sub_0809F868(Entity* this)
|
||||
{
|
||||
if (--this->actionDelay == 0) {
|
||||
if (this->field_0xf == 0) {
|
||||
if (++this->frameIndex == 3) {
|
||||
this->field_0xf = 1;
|
||||
}
|
||||
} else {
|
||||
if (--this->frameIndex == 0) {
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
}
|
||||
this->actionDelay = 32;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern u32 Random();
|
||||
extern bool32 CheckIsDungeon();
|
||||
extern void sub_080AE068(Entity*);
|
||||
extern void LoadFixedGFX(Entity*, u32);
|
||||
|
||||
extern void (*const gUnk_08122254[])(Entity*);
|
||||
|
||||
void MinishSizedEntrance(Entity* this)
|
||||
{
|
||||
gUnk_08122254[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08090EC0(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->frameIndex = (this->entityType).parameter;
|
||||
if (CheckIsDungeon()) {
|
||||
this->frameIndex += 4;
|
||||
sub_080AE068(this);
|
||||
LoadFixedGFX(this, 0x184);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void CopyPosition();
|
||||
extern void sub_08086A6C();
|
||||
extern s32 sub_080044EC();
|
||||
extern void sub_080AEF88();
|
||||
extern void DeleteThisEntity();
|
||||
extern u32 Random(void);
|
||||
|
||||
extern void (*gUnk_081206C4[99])(Entity*);
|
||||
|
||||
extern BoundingBox gUnk_080FD1A8;
|
||||
|
||||
// Main
|
||||
void Object1A(Entity* ent) {
|
||||
gUnk_081206C4[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_080869DC(Entity* ent) {
|
||||
Entity* itemEntity;
|
||||
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.draw = 0;
|
||||
ent->boundingBox = &gUnk_080FD1A8;
|
||||
ent->field_0x3c |= 16;
|
||||
itemEntity = CreateObject(0, ent->entityType.form, 0);
|
||||
if (itemEntity != NULL) {
|
||||
itemEntity->actionDelay = 10;
|
||||
itemEntity->parent = ent;
|
||||
ent->attachedEntity = itemEntity;
|
||||
CopyPosition(ent, itemEntity);
|
||||
sub_08086A6C(ent);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08086A28(Entity* ent) {
|
||||
s32 iVar1;
|
||||
|
||||
if (ent->attachedEntity->next == NULL) {
|
||||
ent->action = 2;
|
||||
} else {
|
||||
iVar1 = sub_080044EC(ent, 10240);
|
||||
if (iVar1 == 0) {
|
||||
ent->action = 2;
|
||||
}
|
||||
sub_080AEF88(ent);
|
||||
CopyPosition(ent, ent->attachedEntity);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08086A5C(Entity* ent) {
|
||||
ent->attachedEntity->parent = NULL;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_08086A6C(Entity* ent) {
|
||||
u32 uVar1;
|
||||
|
||||
uVar1 = Random();
|
||||
ent->field_0x20 = 163840;
|
||||
ent->direction = (uVar1 >> 16) & 31;
|
||||
ent->nonPlanarMovement = uVar1 & 480;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern u32 CheckRectOnScreen(s16, s16, u32, u32);
|
||||
extern void DeleteThisEntity();
|
||||
|
||||
void Object1C(Entity *this)
|
||||
{
|
||||
s32 iVar1;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
}
|
||||
iVar1 = CheckRectOnScreen(this->field_0x80.HWORD, this->field_0x82.HWORD, 0x10, 0x10);
|
||||
if (iVar1 == 0) {
|
||||
this->parent->field_0x20 &= ~(1 << this->entityType.parameter);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
void DeleteThisEntity();
|
||||
|
||||
extern void (*gUnk_081208A0[])(Entity*);
|
||||
|
||||
void Object1D(Entity *this)
|
||||
{
|
||||
gUnk_081208A0[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080874F8(Entity* this)
|
||||
{
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void nullsub_117(Entity* this){}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern void (*const gUnk_08120DD0[])(Entity*);
|
||||
|
||||
void Object2A(Entity* this) {
|
||||
gUnk_08120DD0[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08089B18(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
if (this->entityType.parameter != 0) {
|
||||
this->actionDelay = this->entityType.parameter;
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
switch (this->entityType.form) {
|
||||
case 1:
|
||||
this->y.HALF.HI -= 8;
|
||||
this->actionDelay = 0x28;
|
||||
break;
|
||||
case 2:
|
||||
this->actionDelay = 0xf;
|
||||
sub_08004168(this);
|
||||
break;
|
||||
case 3:
|
||||
CopyPosition(this->parent, this);
|
||||
break;
|
||||
case 4:
|
||||
if (!CheckFlags(this->field_0x86)) {
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
this->previousActionFlag = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
sub_08004488(0x124);
|
||||
}
|
||||
Executable
+543
@@ -0,0 +1,543 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
#include "main.h"
|
||||
#include "menu.h"
|
||||
#include "npc.h"
|
||||
#include "position.h"
|
||||
#include "readKeyInput.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern int sub_0807A094(int);
|
||||
extern void LoadPalettes(const u8*, int, int);
|
||||
extern u32 sub_080041EC(int, int);
|
||||
extern u32 sub_080045DA(int, int);
|
||||
|
||||
static bool32 sub_0808E950(void);
|
||||
static void sub_0808EABC(Entity*);
|
||||
static Entity* sub_0808EC80(int);
|
||||
static u32 sub_0808EF6C(Entity*);
|
||||
static void sub_0808EFF0(Entity*);
|
||||
|
||||
typedef struct {
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
} PACKED struct_08121CD4;
|
||||
|
||||
typedef struct {
|
||||
u16 unk0;
|
||||
u16 unk2;
|
||||
u16 unk4;
|
||||
u8 unk6_0 : 3;
|
||||
u8 unk6_3 : 3;
|
||||
u8 unk6_6 : 2;
|
||||
u8 unk7;
|
||||
} struct_08121D54;
|
||||
|
||||
extern void (*const gUnk_08121C64[])(Entity*);
|
||||
extern void (*const gUnk_08121CCC[])(Entity*);
|
||||
extern const int gUnk_08133368[];
|
||||
extern const u8 gGlobalGfxAndPalettes[];
|
||||
extern const struct_08121CD4 gUnk_08121CD4[][4];
|
||||
extern const u8 gUnk_08121D10[];
|
||||
extern const u8 gUnk_08121D38[][8];
|
||||
extern const u16 gUnk_08121D18[][8];
|
||||
extern const u8 gUnk_08121D48[];
|
||||
extern const struct_08121D54 gUnk_08121D54[];
|
||||
|
||||
void Object48(Entity* this) {
|
||||
if (this->currentHealth == 0) {
|
||||
sub_0808EFF0(this);
|
||||
}
|
||||
gUnk_08121C64[this->entityType.form](this);
|
||||
if (this->animIndex < 64) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808E7D8(Entity* this) {
|
||||
gUnk_08121CCC[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0808E7F0(Entity* this) {
|
||||
sub_080AE008(this, 1, 2);
|
||||
this->palette.b.b0 = 0xF;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->entityType.parameter = 0xFF;
|
||||
this->action = 1;
|
||||
}
|
||||
|
||||
void sub_0808E818(Entity* this) {
|
||||
u32 var0;
|
||||
u32 var1;
|
||||
|
||||
if (!sub_0808E950()) {
|
||||
int var2 = -1;
|
||||
this->entityType.parameter = var2;
|
||||
this->field_0x68.HWORD = var2;
|
||||
this->field_0x6a.HWORD = var2;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->entityType.parameter != gUnk_02019EE0.unk6) {
|
||||
this->entityType.parameter = gUnk_02019EE0.unk6;
|
||||
this->field_0x68.HWORD = CheckGlobalFlag(EZERO_1ST) == 0 ? 0x400 : 0x100;
|
||||
this->field_0x70.BYTES.byte0 = 4;
|
||||
this->animationState = 2;
|
||||
var1 = gUnk_08133368[sub_0807A094(1) - 22] & 0xFFFFFF;
|
||||
LoadPalettes(&gGlobalGfxAndPalettes[var1], 31, 1);
|
||||
}
|
||||
|
||||
if (gUnk_02032EC0.transitionType == 0) {
|
||||
if (gUnk_03000FF0.heldKeys & L_BUTTON) {
|
||||
switch (gUnk_03000FF0.newKeys) {
|
||||
case DPAD_UP:
|
||||
this->animationState = 0;
|
||||
break;
|
||||
case DPAD_RIGHT:
|
||||
this->animationState = 1;
|
||||
break;
|
||||
case DPAD_DOWN:
|
||||
this->animationState = 2;
|
||||
break;
|
||||
case DPAD_LEFT:
|
||||
this->animationState = 3;
|
||||
break;
|
||||
case B_BUTTON:
|
||||
this->field_0x70.BYTES.byte0 = this->field_0x70.BYTES.byte0 ? 0 : 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->spriteSettings.b.flipX = this->animationState == 3;
|
||||
var0 = this->field_0x68.HWORD + this->field_0x70.BYTES.byte0 + this->animationState;
|
||||
if (this->field_0x6a.HWORD != var0) {
|
||||
this->field_0x6a.HWORD = var0;
|
||||
this->spriteIndex = var0 >> 8;
|
||||
InitAnimationForceUpdate(this, (u8)var0);
|
||||
}
|
||||
|
||||
this->spriteSettings.b.draw = 2;
|
||||
}
|
||||
|
||||
static bool32 sub_0808E950(void) {
|
||||
bool32 result = FALSE;
|
||||
switch (gUnk_02032EC0.transitionType) {
|
||||
case 0:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
result = gUnk_02019EE0.unk8[gUnk_02019EE0.unk6] == 1;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void sub_0808E988(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->spriteIndex = 0x142;
|
||||
this->entityType.parameter = 0xFF;
|
||||
sub_080AE008(this, 1, 3);
|
||||
}
|
||||
|
||||
if (sub_0808E950()) {
|
||||
int i;
|
||||
for (i = 6; i != 0; i--) {
|
||||
if (GetInventoryValue(i)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != 0) {
|
||||
if (this->entityType.parameter != i) {
|
||||
InitAnimationForceUpdate(this, i);
|
||||
}
|
||||
this->spriteSettings.b.draw = 2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
|
||||
void sub_0808E9F4(Entity* this) {
|
||||
if (sub_0808E950() && gUnk_02002A40.unk6) {
|
||||
this->spriteSettings.b.draw = 2;
|
||||
} else {
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808EA28(Entity* this) {
|
||||
u32 var0;
|
||||
u32 var1;
|
||||
|
||||
if (this->entityType.form == 3) {
|
||||
if (((struct_02000000 *)0x2000000)->gameLanguage > 1) {
|
||||
this->spriteSettings.b.draw = 2;
|
||||
} else {
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->entityType.form == gUnk_02019EE0.unk6) {
|
||||
var0 = 12;
|
||||
var1 = 1;
|
||||
} else {
|
||||
if (gUnk_02032EC0.transitionType == 5 && this->entityType.form == gUnk_02019EE0.unk7) {
|
||||
var0 = 13;
|
||||
var1 = 2;
|
||||
} else {
|
||||
var0 = 14;
|
||||
var1 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
this->palette.b.b0 = var0;
|
||||
this->spriteRendering.b3 = var1;
|
||||
sub_0808EABC(this);
|
||||
gUnk_02019EE0.unk0 |= sub_0808EF6C(this);
|
||||
}
|
||||
|
||||
void sub_0808EABC(Entity* this) {
|
||||
int var0 = -72;
|
||||
int var1 = this->entityType.form * 32 + 40;
|
||||
int var2 = gUnk_02019EE0.unk6 == this->entityType.form;
|
||||
switch (gUnk_02032EC0.transitionType) {
|
||||
case 0:
|
||||
var0 = 24;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
if (var2) {
|
||||
var0 = 42;
|
||||
var1 = 56;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
switch (gMenu.unk10[this->entityType.form]) {
|
||||
case 0:
|
||||
var0 = 42;
|
||||
var1 = 40;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
var0 = 20;
|
||||
var1 = 144;
|
||||
var1 -= (gMenu.unk16 - gMenu.unk10[this->entityType.form]) * 32;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (var2) {
|
||||
var0 = 26;
|
||||
var1 = 42;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (var2) {
|
||||
var0 = 8;
|
||||
var1 = 35;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this->field_0x68.HWORD = var0;
|
||||
this->field_0x6a.HWORD = var1;
|
||||
}
|
||||
|
||||
void sub_0808EB74(Entity* this) {
|
||||
Entity* entity = sub_0808EC80(gUnk_02019EE0.unk6);
|
||||
if (entity) {
|
||||
this->x.WORD = entity->x.WORD;
|
||||
this->y.WORD = entity->y.WORD;
|
||||
this->spriteRendering.b3 = entity->spriteRendering.b3;
|
||||
sub_0806FAD8(entity, this);
|
||||
} else {
|
||||
this->x.HALF.HI = 0xF000;
|
||||
this->y.HALF.HI = 0xF000;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808EBB8(Entity* this) {
|
||||
u32 var0;
|
||||
u32 x, y;
|
||||
Entity* entity;
|
||||
|
||||
switch (gUnk_02032EC0.transitionType) {
|
||||
case 4:
|
||||
var0 = gMenu.field_0x1 + 4;
|
||||
break;
|
||||
case 5:
|
||||
var0 = 2;
|
||||
break;
|
||||
case 6:
|
||||
var0 = gMenu.field_0x1 == 0 ? 7 : 6;
|
||||
break;
|
||||
case 7:
|
||||
var0 = 4;
|
||||
break;
|
||||
case 2:
|
||||
var0 = 1;
|
||||
break;
|
||||
default:
|
||||
var0 = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
x = y = 0xF000;
|
||||
switch (var0) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
y = ((struct_02000000 *)0x2000000)->gameLanguage * 16 + 24;
|
||||
x = 112;
|
||||
break;
|
||||
case 2:
|
||||
var0 = gUnk_02019EE0.unk7;
|
||||
if (var0 == 4) {
|
||||
var0 = 7;
|
||||
}
|
||||
// Fall through
|
||||
default:
|
||||
entity = sub_0808EC80(var0);
|
||||
if (entity) {
|
||||
sub_0806FAD8(entity, this);
|
||||
this->spriteRendering.b3 = entity->spriteRendering.b3;
|
||||
x = entity->x.HALF.HI;
|
||||
y = entity->y.HALF.HI;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
this->x.HALF.HI = x;
|
||||
this->y.HALF.HI = y;
|
||||
}
|
||||
|
||||
static Entity* sub_0808EC80(int form) {
|
||||
Entity* entityA = &gUnk_03003DA0;
|
||||
Entity* entityB = entityA->next;
|
||||
while (entityB != entityA) {
|
||||
if ((entityB->entityType.type == 0x6 && entityB->entityType.subtype == 0x48) &&
|
||||
form == entityB->entityType.form) {
|
||||
return entityB;
|
||||
}
|
||||
entityB = entityB->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void sub_0808ECBC(Entity* this) {
|
||||
int var0;
|
||||
int var1;
|
||||
int var2;
|
||||
const struct_08121CD4* var3;
|
||||
|
||||
var0 = gMenu.field_0x1;
|
||||
switch (gUnk_02032EC0.transitionType) {
|
||||
case 4:
|
||||
var1 = 1;
|
||||
break;
|
||||
case 5:
|
||||
var0 = gUnk_02019EE0.unk7;
|
||||
var1 = 2;
|
||||
break;
|
||||
case 6:
|
||||
var1 = 3;
|
||||
break;
|
||||
case 7:
|
||||
var1 = 4;
|
||||
break;
|
||||
default:
|
||||
var1 = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
var2 = this->entityType.form - 4;
|
||||
var3 = &gUnk_08121CD4[var1][var2];
|
||||
this->field_0x68.HWORD = var3->unk1;
|
||||
this->field_0x6a.HWORD = var3->unk2;
|
||||
if (var3->unk0 == var0) {
|
||||
this->palette.b.b0 = 13;
|
||||
} else {
|
||||
this->palette.b.b0 = 14;
|
||||
}
|
||||
|
||||
gUnk_02019EE0.unk0 |= sub_0808EF6C(this);
|
||||
}
|
||||
|
||||
void sub_0808ED64(Entity* this) {
|
||||
int y = 255;
|
||||
if (gUnk_02032EC0.transitionType == 1 && gMenu.unk10[1] != 5) {
|
||||
this->x.HALF.HI = gMenu.unk10[0] * 16 + 28;
|
||||
y = gMenu.unk10[1] * 16 + 58;
|
||||
}
|
||||
this->y.HALF.HI = y;
|
||||
}
|
||||
|
||||
void sub_0808ED98(Entity* this) {
|
||||
int y;
|
||||
if (gUnk_02032EC0.transitionType != 1) {
|
||||
this->field_0x68.HWORD = 27;
|
||||
y = -10;
|
||||
} else {
|
||||
u32 var0 = gMenu.unk13;
|
||||
if (var0 > 5) {
|
||||
var0 = 5;
|
||||
}
|
||||
this->field_0x68.HWORD = var0 * 8 + 27;
|
||||
y = 24;
|
||||
}
|
||||
|
||||
this->y.HALF.HI = y;
|
||||
this->field_0x6a.HWORD = y;
|
||||
this->field_0xf++;
|
||||
this->spriteOffsetY = gUnk_08121D10[(this->field_0xf / 4) & 0x7];
|
||||
sub_0808EF6C(this);
|
||||
}
|
||||
|
||||
void sub_0808EE00(Entity* this) {
|
||||
int var0, var1, var2;
|
||||
|
||||
var0 = ((struct_02000000 *)0x2000000)->gameLanguage != 0;
|
||||
var1 = this->entityType.form - 10;
|
||||
this->frameIndex = gUnk_08121D38[var0][var1];
|
||||
this->x.HALF.HI = gUnk_08121D18[var0][var1];
|
||||
this->field_0x68.HWORD = gUnk_08121D18[var0][var1];
|
||||
var1 -= var0;
|
||||
if (gUnk_02032EC0.transitionType != 1) {
|
||||
var1 = 128;
|
||||
var2 = 176;
|
||||
} else {
|
||||
var2 = 140;
|
||||
}
|
||||
|
||||
this->field_0x6a.HWORD = var2;
|
||||
this->palette.b.b0 = gMenu.unk10[1] == 5 && var1 == gMenu.field_0x12 ? 11 : 9;
|
||||
gUnk_02019EE0.unk0 |= sub_0808EF6C(this);
|
||||
}
|
||||
|
||||
void nullsub_522(Entity* this) {
|
||||
|
||||
}
|
||||
|
||||
void sub_0808EE98(Entity* this) {
|
||||
this->actionDelay = gUnk_02032EC0.transitionType;
|
||||
this->frameIndex = gUnk_08121D48[this->actionDelay];
|
||||
if (this->actionDelay != 2) {
|
||||
this->field_0x68.HWORD = 96;
|
||||
} else {
|
||||
this->field_0x68.HWORD = -96;
|
||||
}
|
||||
sub_0808EF6C(this);
|
||||
}
|
||||
|
||||
void sub_0808EED8(Entity* this) {
|
||||
int var0;
|
||||
if (gUnk_02032EC0.transitionType != 3) {
|
||||
this->spriteSettings.b.draw = 0;
|
||||
} else {
|
||||
this->spriteSettings.b.draw = 2;
|
||||
var0 = this->entityType.form - 19;
|
||||
this->palette.b.b0 = gMenu.field_0x1 == var0 ? 4 : 3;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808EF24(Entity* this) {
|
||||
int var0;
|
||||
if (gUnk_02032EC0.transitionType != 3) {
|
||||
this->spriteSettings.b.draw = 0;
|
||||
} else {
|
||||
this->spriteSettings.b.draw = 2;
|
||||
if (this->entityType.form == 21) {
|
||||
var0 = ((struct_02000000 *)0x2000000)->messageSpeed;
|
||||
} else {
|
||||
var0 = ((struct_02000000 *)0x2000000)->brightnessPref;
|
||||
}
|
||||
this->frameIndex = this->lastFrameIndex + var0;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 sub_0808EF6C(Entity* this) {
|
||||
int var0;
|
||||
u32 var1;
|
||||
int var2;
|
||||
u32 var3;
|
||||
int var4;
|
||||
s16 var5;
|
||||
s16 var6;
|
||||
int var7;
|
||||
|
||||
var6 = this->field_0x68.HWORD;
|
||||
var0 = var6 - this->x.HALF.HI;
|
||||
var1 = var0;
|
||||
if (var0 < 0) {
|
||||
var1 = -var0;
|
||||
}
|
||||
if (var1 < 2) {
|
||||
this->x.WORD = var6 << 16;
|
||||
var0 = 0;
|
||||
}
|
||||
|
||||
var5 = this->field_0x6a.HWORD;
|
||||
var2 = var5 - this->y.HALF.HI;
|
||||
var3 = var2;
|
||||
if (var2 < 0) {
|
||||
var3 = -var2;
|
||||
}
|
||||
if (var3 < 2) {
|
||||
this->y.WORD = var5 << 16;
|
||||
var2 = 0;
|
||||
}
|
||||
|
||||
if ((var0 | var2) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var4 = var7 = sub_080041EC(var0, var2);
|
||||
var4 += 128;
|
||||
var7 = var4 + var7 * 16;
|
||||
if (this->field_0x6c.HWORD < var7) {
|
||||
var7 = this->field_0x6c.HWORD;
|
||||
}
|
||||
this->nonPlanarMovement = var7;
|
||||
this->direction = sub_080045DA(var0, var2) >> 3;
|
||||
sub_0806F69C(this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void sub_0808EFF0(Entity* this) {
|
||||
const struct_08121D54* var0;
|
||||
int var1;
|
||||
|
||||
this->spriteSettings.b.draw = 2;
|
||||
this->nonPlanarMovement = 0x400;
|
||||
this->currentHealth = 1;
|
||||
this->frameIndex = 0xFF;
|
||||
this->animIndex = 0xFF;
|
||||
var0 = &gUnk_08121D54[this->entityType.form];
|
||||
this->x.HALF.HI = var0->unk2;
|
||||
this->field_0x68.HWORD = var0->unk2;
|
||||
this->y.HALF.HI = var0->unk4;
|
||||
this->field_0x6a.HWORD = var0->unk4;
|
||||
this->spriteRendering.b3 = var0->unk6_0;
|
||||
this->spritePriority.b0 = var0->unk6_3;
|
||||
this->spriteOrientation.flipY = var0->unk6_6;
|
||||
this->field_0x6c.HWORD = var0->unk0;
|
||||
var1 = var0->unk7;
|
||||
if (var1 & 0x80) {
|
||||
var1 &= 0x7F;
|
||||
this->frameIndex = var1;
|
||||
this->lastFrameIndex = var1;
|
||||
} else {
|
||||
InitAnimationForceUpdate(this, var1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "position.h"
|
||||
#include "random.h"
|
||||
#include "structures.h"
|
||||
|
||||
static void sub_0808F2B0(Entity*);
|
||||
static void sub_0808F14C(Entity*);
|
||||
static void sub_0808F244(Entity*);
|
||||
|
||||
extern void sub_0806FCF4(Entity*, u32, u32, u32);
|
||||
extern void sub_0808F5EC(Entity*);
|
||||
extern bool32 sub_0806F3E4(Entity *);
|
||||
|
||||
extern void (*const gUnk_08121E5C[])(Entity*);
|
||||
extern void (*const gUnk_08121E88[])(Entity*);
|
||||
extern void (*const gUnk_08121E98[])(Entity*);
|
||||
extern const u16 gUnk_08121EA0[];
|
||||
|
||||
void Object49(Entity* this) {
|
||||
gUnk_08121E5C[this->entityType.form](this);
|
||||
}
|
||||
|
||||
void sub_0808F0B8(Entity* this) {
|
||||
gUnk_08121E88[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0808F0D0(Entity* this) {
|
||||
u32 offsetX;
|
||||
u32 offsetY;
|
||||
Entity* ent;
|
||||
u32 uVar3;
|
||||
|
||||
ent = CreateObjectWithParent(this, 0x49, 2, 0);
|
||||
this->attachedEntity = ent;
|
||||
if (ent == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->height.HALF.HI = -0xc0;
|
||||
offsetX = Random() % 64;
|
||||
if ((Random() & 1) != 0) {
|
||||
offsetX = -offsetX;
|
||||
}
|
||||
this->x.HALF.HI = this->parent->x.HALF.HI + offsetX;
|
||||
offsetY = Random() % 32;
|
||||
if ((Random() & 1) != 0) {
|
||||
offsetY = -offsetY;
|
||||
}
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI + offsetY;
|
||||
*(u32*)&this->field_0x74 = 0x240;
|
||||
*(u32*)&this->field_0x78 = 0x140;
|
||||
InitializeAnimation(this, 3);
|
||||
sub_0808F14C(this);
|
||||
}
|
||||
|
||||
static void sub_0808F14C(Entity* this) {
|
||||
sub_0808F2B0(this);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
this->action++;
|
||||
PlaySFX(0x84);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F170(Entity *this)
|
||||
{
|
||||
*(u32 *)&this->field_0x74 -= 0x20;
|
||||
*(u32 *)&this->field_0x78 += 0x20;
|
||||
sub_0806FCF4(this, *(u32 *)&this->field_0x78, 8, 2);
|
||||
if (*(u32 *)&this->field_0x78 > 0x1ff) {
|
||||
this->action++;
|
||||
}
|
||||
sub_0808F2B0(this);
|
||||
}
|
||||
|
||||
void sub_0808F1A4(Entity *this)
|
||||
{
|
||||
*(u32 *)&this->field_0x78 += 0x10;
|
||||
*(u32 *)&this->field_0x74 += 0x10;
|
||||
sub_0806FCF4(this, *(u32 *)&this->field_0x78, 8, 2);
|
||||
if (*(u32 *)&this->field_0x78 > 0x3ff) {
|
||||
this->attachedEntity->action = 0xff;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
else {
|
||||
sub_0808F2B0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F1E0(Entity *this)
|
||||
{
|
||||
gUnk_08121E98[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0808F1F8(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
|
||||
this->spriteRendering.b0 = 3;
|
||||
this->action++;
|
||||
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
|
||||
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
|
||||
this->spritePriority.b0 = 7;
|
||||
InitializeAnimation(this, 1);
|
||||
sub_0808F244(this);
|
||||
}
|
||||
|
||||
static void sub_0808F244(Entity *this)
|
||||
{
|
||||
|
||||
this->spriteSettings.b.draw = this->parent->spriteSettings.b.draw;
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI + 3;
|
||||
this->x.HALF.HI = (*(s8*)&this->attachedEntity->spriteOffsetX + this->attachedEntity->x.HALF.HI);
|
||||
this->height.WORD = 0;
|
||||
*(u32 *)&this->field_0x74 = 0x80 - this->parent->height.HALF.HI;
|
||||
*(u32 *)&this->field_0x78 = 0x100 - this->parent->height.HALF.HI;
|
||||
*(u32 *)&this->field_0x70.WORD = *((u8 *)&this->parent->field_0x7c + 3);
|
||||
sub_0808F2B0(this);
|
||||
if ((this->parent->field_0x6c.HALF.HI & 2) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0808F2B0(Entity *this)
|
||||
{
|
||||
sub_0805EC9C(this, *(u32 *)&this->field_0x74, *(u32 *)&this->field_0x78, this->field_0x70.WORD);
|
||||
}
|
||||
|
||||
void sub_0808F2C0(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
|
||||
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->height.WORD = 0;
|
||||
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI + 3;
|
||||
this->x.HALF.HI = this->parent->x.HALF.HI;
|
||||
InitializeAnimation(this,3);
|
||||
}
|
||||
if (this->parent->height.HALF.HI == 0) {
|
||||
*(u32 *)&this->field_0x74 = *(u32 *)&this->parent->field_0x74;
|
||||
*(u32 *)&this->field_0x78 = *(u32 *)&this->parent->field_0x78;
|
||||
}
|
||||
else {
|
||||
*(u32 *)&this->field_0x74 = 0x200 - this->parent->height.HALF.HI;
|
||||
*(u32 *)&this->field_0x78 = this->parent->height.HALF.HI * -2 + 0x300;
|
||||
}
|
||||
*(u32 *)&this->field_0x70 = 0;
|
||||
sub_0808F2B0(this);
|
||||
sub_0806FCF4(this,*(u32 *)&this->field_0x78,8,2);
|
||||
if (this->action == 0xff) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F370(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (this->parent->previousActionFlag == 1) {
|
||||
this->action = 1;
|
||||
this->field_0x70.WORD = 0;
|
||||
sub_0808F5EC(this);
|
||||
}
|
||||
} else {
|
||||
u8 flag = this->parent->previousActionFlag - 1;
|
||||
if (flag < 5) {
|
||||
if (this->field_0x70.WORD == 0) {
|
||||
if (--(*(u32 *)&this->field_0x74) == -1) {
|
||||
this->field_0x70.WORD = gUnk_08121EA0[Random() & 1];
|
||||
}
|
||||
} else {
|
||||
if (--this->field_0x70.WORD == 0) {
|
||||
sub_0808F5EC(this);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this->action = 0;
|
||||
*(u32 *)&this->field_0x74 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F3DC(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->action = 1;
|
||||
this->actionDelay = 120;
|
||||
InitializeAnimation(this, this->entityType.form + 1);
|
||||
// TODO: This block of code might supposed to be a switch statement.
|
||||
if (this->entityType.form != 8) {
|
||||
if (this->entityType.form == 7) {
|
||||
sub_0806FAD8(this->attachedEntity, this);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this->damageType = this->attachedEntity->damageType;
|
||||
this->attachedEntity->damageType = 0x7E;
|
||||
}
|
||||
ResolveEntityOnTop(this->attachedEntity, this);
|
||||
} else {
|
||||
if (*(u32 *)&this->parent->field_0x74 == 0) {
|
||||
if (this->entityType.form == 8) {
|
||||
this->attachedEntity->damageType = this->damageType;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (this->entityType.form == 5 && this->frames.b.f0) {
|
||||
Entity* entity = CreateObjectWithParent(this->attachedEntity, 0x49, 8, 0);
|
||||
if (entity) {
|
||||
entity->parent = this->parent;
|
||||
entity->attachedEntity = this->parent->parent;
|
||||
}
|
||||
}
|
||||
|
||||
GetNextFrame(this);
|
||||
CopyPositionAndSpriteOffset(this->attachedEntity, this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F498(Entity* this) {
|
||||
u32 var0;
|
||||
|
||||
if (this->action != 0) {
|
||||
if (sub_0806F3E4(this)) {
|
||||
if (gScreenTransition.frameCount % 16 == 0) {
|
||||
PlaySFX(0xEF);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0xFF) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (gPlayerState.field_0x1c != 1) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
sub_0801D2B4(this, var0);
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F554(Entity* this) {
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
this->spriteOffsetY -= 24;
|
||||
if ((s8)this->parent->spriteOffsetX != 0) {
|
||||
this->spriteOffsetX += (s8)this->parent->spriteOffsetX / 2;
|
||||
}
|
||||
|
||||
if (this->action != 0) {
|
||||
if (*(u32 *)&this->cutsceneBeh) {
|
||||
if (--(*(u32 *)&this->cutsceneBeh) == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
|
||||
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
|
||||
this->spritePriority.b0 = 0;
|
||||
InitializeAnimation(this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F5EC(Entity* this) {
|
||||
Entity* entity = CreateObjectWithParent(this->attachedEntity, 0x49, 5, 0);
|
||||
if (entity) {
|
||||
entity->parent = this;
|
||||
entity->attachedEntity = this->attachedEntity;
|
||||
}
|
||||
|
||||
entity = CreateObjectWithParent(this->attachedEntity, 0x49, 6, 0);
|
||||
if (entity) {
|
||||
entity->parent = this;
|
||||
entity->attachedEntity = this->attachedEntity;
|
||||
}
|
||||
|
||||
entity = CreateObjectWithParent(this->attachedEntity, 0x49, 7, 0);
|
||||
if (entity) {
|
||||
entity->parent = this;
|
||||
entity->attachedEntity = this->attachedEntity;
|
||||
}
|
||||
|
||||
*(u32 *)&this->field_0x74 = 600;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
void Object7E(Entity *this) {
|
||||
|
||||
if (this->parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->frameIndex = 0x28;
|
||||
if (this->entityType.form == 0) {
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
} else if (this->entityType.form == 2) {
|
||||
this->spriteSettings.b.flipX = TRUE;
|
||||
}
|
||||
}
|
||||
PositionRelative(this->parent, this, 0, 0x80000);
|
||||
this->height.HALF.HI = 0;
|
||||
if ((this->entityType).form != 0) {
|
||||
this->spriteSettings.b.draw = this->attachedEntity->spriteSettings.b.draw;
|
||||
this->frameIndex = this->attachedEntity->frameIndex + 0x1f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
|
||||
void sub_08099ECC(Entity*);
|
||||
extern void sub_0805E4E0(Entity*, u32);
|
||||
extern void sub_0805B390(u32);
|
||||
extern void CopyPosition(Entity*, Entity*);
|
||||
|
||||
extern void (*const gUnk_081237F8[])(Entity*);
|
||||
|
||||
void Object86(Entity* this) {
|
||||
gUnk_081237F8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08099DD0(Entity* this) {
|
||||
this->collisionLayer = 1;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->previousActionFlag = 0;
|
||||
if (GetInventoryValue(0x46)) {
|
||||
this->action = 4;
|
||||
this->frameIndex = 0;
|
||||
} else {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08099E10(Entity* this) {
|
||||
if (CheckLocalFlag(0x74)) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.all == 1) && (this->previousActionFlag == 0)) {
|
||||
this->frames.all = 0;
|
||||
sub_08099ECC(this);
|
||||
}
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08099E58(Entity *this)
|
||||
{
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3) {
|
||||
this->frames.b.f3 = 0;
|
||||
this->actionDelay++;
|
||||
if (this->actionDelay == 3) {
|
||||
this->action = 3;
|
||||
this->frameIndex = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08099E8C(Entity *this)
|
||||
{
|
||||
if (sub_080041A0(this, &gPlayerEntity, 0xc, 0xc)) {
|
||||
if (this->previousActionFlag == 0) {
|
||||
sub_08099ECC(this);
|
||||
sub_0805E4E0(this, 0x1e);
|
||||
}
|
||||
if (CheckLocalFlag(0x75)) {
|
||||
sub_0805B390(0x7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_534(Entity* this) {}
|
||||
|
||||
void sub_08099ECC(Entity *this)
|
||||
{
|
||||
this->previousActionFlag = 1;
|
||||
CopyPosition(this, &gPlayerEntity);
|
||||
gPlayerState.playerAction = 3;
|
||||
gPlayerState.field_0x34[4] = 0;
|
||||
gPlayerState.flags.all |= 0x8000;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
|
||||
extern BoundingBox gUnk_080FD168;
|
||||
|
||||
extern void SetTile(u32, u32, u32);
|
||||
extern void CopyPosition(Entity*, Entity*);
|
||||
|
||||
void Object9E(Entity *this)
|
||||
{
|
||||
Entity *ent;
|
||||
u32 tilePos;
|
||||
u8 *layer;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->spritePriority.b0 = 6;
|
||||
if ((this->entityType).form == 0) {
|
||||
this->flags = this->flags | 0x80;
|
||||
this->frameIndex = 1;
|
||||
layer = &this->collisionLayer;
|
||||
*layer = 1;
|
||||
this->field_0x3c = 7;
|
||||
this->field_0x40 = 0x48;
|
||||
this->damageType = 0x7a;
|
||||
this->flags2 = 1;
|
||||
this->boundingBox = &gUnk_080FD168;
|
||||
tilePos = COORD_TO_TILE(this);
|
||||
SetTile(0x4066, tilePos - 1, *layer);
|
||||
SetTile(0x4065, tilePos, *layer);
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
ent = CreateObject(0x9e,1,0);
|
||||
if (ent != NULL) {
|
||||
this->attachedEntity = ent;
|
||||
CopyPosition(this, ent);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->frameIndex = 0;
|
||||
this->collisionLayer = 2;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern BoundingBox gUnk_080FD170;
|
||||
|
||||
extern u8 gUnk_02000070;
|
||||
|
||||
void ObjectA(Entity *this) {
|
||||
u32 uVar2;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->boundingBox = &gUnk_080FD170;
|
||||
if (this->collisionLayer == 1) {
|
||||
uVar2 = 0x26;
|
||||
} else {
|
||||
uVar2 = 0x34;
|
||||
}
|
||||
this->field_0x70.HALF.LO = uVar2;
|
||||
if (CheckFlags(this->field_0x86) != 0) {
|
||||
SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
if ((gRoomControls.unk2 & 1) != 0) {
|
||||
gUnk_02000070 = 0;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
sub_080787CC(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);
|
||||
sub_080526F8(-1);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void CreateItemEntity(u32, u32, u32);
|
||||
extern void DeleteThisEntity();
|
||||
extern void sub_08080CB4(Entity*);
|
||||
|
||||
extern void (*gUnk_08124824[])(Entity*);
|
||||
|
||||
extern Entity gPlayerEntity;
|
||||
|
||||
void ObjectA8(Entity *this)
|
||||
{
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
switch(this->bitfield & 0x7f) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 0xb:
|
||||
case 0xc:
|
||||
case 0x1e:
|
||||
case 0x1f:
|
||||
this->action = 5;
|
||||
this->attachedEntity = &gPlayerEntity;
|
||||
CreateItemEntity((this->entityType).form, 0, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
gUnk_08124824[this->action](this);
|
||||
sub_08080CB4(this);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void sub_080A0640(Entity*);
|
||||
extern void PositionRelative(Entity*, Entity*, s32, s32);
|
||||
extern void CopyPosition(Entity*, Entity*);
|
||||
|
||||
extern void (*const gUnk_081248C4[])(Entity*);
|
||||
|
||||
void ObjectAF(Entity* this) {
|
||||
gUnk_081248C4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080A05A4(Entity* this) {
|
||||
if ((this->entityType).form != 2) {
|
||||
this->action = 1;
|
||||
this->spritePriority.b0 = 6;
|
||||
sub_080A0640(this);
|
||||
InitializeAnimation(this, 1);
|
||||
} else {
|
||||
this->action = 2;
|
||||
this->y.HALF.HI++;
|
||||
this->height.HALF.HI = 0;
|
||||
this->spriteOffsetY--;
|
||||
InitializeAnimation(this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A05F4(Entity* this) {
|
||||
if (this->parent == NULL) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 2);
|
||||
} else {
|
||||
if (this->parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
sub_080A0640(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A0624(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A0640(Entity* this) {
|
||||
if (this->entityType.form == 0) {
|
||||
PositionRelative(*(Entity**)(this->parent->otherEntity + 0x4), this, 0, 0x80000);
|
||||
} else {
|
||||
CopyPosition(this->parent, this);
|
||||
}
|
||||
this->height.HALF.HI = 0;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void sub_0806F69C(Entity*);
|
||||
extern u32 sub_080AE4CC(Entity*, u32, u32, u32);
|
||||
|
||||
extern void* gUnk_02027EB4;
|
||||
extern void* gUnk_0200D654;
|
||||
|
||||
#if 0
|
||||
|
||||
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;
|
||||
}
|
||||
else {
|
||||
pEVar3 = &gUnk_02027EB4;
|
||||
}
|
||||
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->actionDelay == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_081246EC[])(Entity*);
|
||||
|
||||
void PalaceArchway(Entity* this) {
|
||||
gUnk_081246EC[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809F2A0(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->frameIndex = this->entityType.parameter;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 7;
|
||||
SetTile(0x4069, COORD_TO_TILE(this), this->collisionLayer);
|
||||
}
|
||||
|
||||
void nullsub_537() {}
|
||||
Executable
+303
@@ -0,0 +1,303 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "flags.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
|
||||
static void sub_08082824(Entity*);
|
||||
static void sub_08082850(Entity*, Entity*);
|
||||
static void sub_08082608(Entity*);
|
||||
|
||||
extern void (*const gUnk_0811F090[])(Entity*);
|
||||
extern void (*const gUnk_0811F0A8[])(Entity*);
|
||||
extern void (*const gUnk_0811F0C4[])(Entity*);
|
||||
|
||||
extern BoundingBox gUnk_080FD338; // TODO: should be const
|
||||
extern BoundingBox gUnk_080FD340; // TODO: should be const
|
||||
|
||||
extern u32 sub_08016A30(Entity*);
|
||||
extern u32 sub_080001DA(u32, u32);
|
||||
extern u32 GetTileTypeByEntity(Entity*);
|
||||
extern void sub_08078930(Entity*);
|
||||
extern u32 sub_080002B8(Entity*);
|
||||
extern void sub_08016A6C(Entity*);
|
||||
extern u32 sub_0800442E(Entity*);
|
||||
|
||||
void Pot(Entity* this) {
|
||||
gUnk_0811F090[this->action](this);
|
||||
this->bitfield = 0;
|
||||
}
|
||||
|
||||
void sub_0808222C(Entity* this) {
|
||||
if (this->entityType.parameter == 1 && CheckFlags(this->field_0x86)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
this->action = 1;
|
||||
this->boundingBox = &gUnk_080FD338;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->y.HALF.HI += 3;
|
||||
this->field_0x16 = 0;
|
||||
this->flags |= 0x80;
|
||||
this->currentHealth = 1;
|
||||
this->field_0x3c = 7;
|
||||
this->damageType = 0x6E;
|
||||
this->flags2 = 0x84;
|
||||
this->field_0x1c = 0x12;
|
||||
if (this->collisionLayer == 0) {
|
||||
sub_08016A30(this);
|
||||
}
|
||||
|
||||
this->field_0x70.HALF.LO = sub_080001DA(COORD_TO_TILE(this), this->collisionLayer);
|
||||
if ((u16)this->field_0x70.HALF.LO == 0x4000) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer);
|
||||
InitializeAnimation(this, 5);
|
||||
}
|
||||
|
||||
void sub_08082310(Entity* this) {
|
||||
u32 tileType;
|
||||
u32 var0 = this->bitfield & 0x7F;
|
||||
switch (var0) {
|
||||
case 0x13:
|
||||
this->action = 3;
|
||||
this->previousActionFlag = 0;
|
||||
break;
|
||||
case 0x1D:
|
||||
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
this->action = 5;
|
||||
this->field_0x20 = 0x2A000;
|
||||
this->spriteOffsetY = 0;
|
||||
this->spriteSettings.b.shadow = 1;
|
||||
this->spritePriority.b1 = 3;
|
||||
this->flags &= 0x7F;
|
||||
sub_08082824(this);
|
||||
break;
|
||||
default:
|
||||
tileType = GetTileTypeByEntity(this);
|
||||
if (tileType != 0x4000) {
|
||||
switch (tileType) {
|
||||
case 0x4004:
|
||||
case 0x4003:
|
||||
case 0x4002:
|
||||
case 0x4001:
|
||||
this->direction = (tileType - 0x4001) * 8;
|
||||
this->actionDelay = 32;
|
||||
this->action = 4;
|
||||
if (gPlayerState.flags.all & 0x80) {
|
||||
this->nonPlanarMovement >>= 1;
|
||||
this->actionDelay = 64;
|
||||
}
|
||||
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
sub_08004488(0x10F);
|
||||
break;
|
||||
case 0x4067:
|
||||
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
default:
|
||||
if (sub_080002B8(this) == 13) {
|
||||
CreateFx(this, 0, 0);
|
||||
} else if (tileType == 0x4005) {
|
||||
gPlayerState.field_0xab = 4;
|
||||
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
}
|
||||
sub_08082850(this, NULL);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
sub_08078930(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080824F8(Entity* this) {
|
||||
gUnk_0811F0A8[this->previousActionFlag](this);
|
||||
}
|
||||
|
||||
void sub_08082510(Entity* this) {
|
||||
this->flags |= 0x80;
|
||||
this->boundingBox = &gUnk_080FD340;
|
||||
this->field_0x3c = 7;
|
||||
this->damageType = 1;
|
||||
this->flags2 = gPlayerEntity.flags2;
|
||||
this->spriteOffsetY = 0;
|
||||
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
this->previousActionFlag++;
|
||||
}
|
||||
|
||||
|
||||
void nullsub_511(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08082588(Entity* this) {
|
||||
this->spritePriority.b1 = 3;
|
||||
}
|
||||
|
||||
void sub_0808259C(Entity* this) {
|
||||
switch (sub_080043E8(this)) {
|
||||
case 2:
|
||||
CreateFx(this, 11, 0);
|
||||
break;
|
||||
case 1:
|
||||
CreateFx(this, 0, 0);
|
||||
break;
|
||||
case 3:
|
||||
CreateFx(this, 12, 0);
|
||||
break;
|
||||
default:
|
||||
sub_08082850(this, &gPlayerEntity);
|
||||
return;
|
||||
}
|
||||
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_080825E8(Entity* this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_080825F0(Entity* this) {
|
||||
if (gPlayerState.heldObject == 0) {
|
||||
sub_08082608(this);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_08082608(Entity* this) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
}
|
||||
|
||||
void sub_08082614(Entity* this) {
|
||||
u32 tileType;
|
||||
|
||||
sub_0800445C(this);
|
||||
if (--this->actionDelay != 0xFF) {
|
||||
sub_0806F69C(this);
|
||||
sub_08016A6C(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sub_0800442E(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->action = 1;
|
||||
if (gPlayerState.flags.all & 0x80) {
|
||||
this->nonPlanarMovement <<= 1;
|
||||
}
|
||||
|
||||
this->field_0x70.HALF.LO = sub_080001DA(COORD_TO_TILE(this), this->collisionLayer);
|
||||
tileType = GetTileTypeByEntity(this);
|
||||
switch (tileType) {
|
||||
case 0x71:
|
||||
case 0x72:
|
||||
sub_08082850(this, NULL);
|
||||
break;
|
||||
default:
|
||||
SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer);
|
||||
sub_08078930(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080826E4(Entity* this) {
|
||||
gUnk_0811F0C4[this->previousActionFlag](this);
|
||||
}
|
||||
|
||||
void sub_080826FC(Entity* this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 48;
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
|
||||
void sub_0808270C(Entity* this) {
|
||||
if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (this->bitfield & 0x7F) != 0x13) {
|
||||
this->spriteOffsetX = 0;
|
||||
this->action = 1;
|
||||
SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer);
|
||||
} else {
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08082778(Entity* this) {
|
||||
if (this->actionDelay == 0) {
|
||||
this->actionDelay = 1;
|
||||
this->spriteOffsetX = 0;
|
||||
this->spriteOffsetY = -2;
|
||||
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
|
||||
}
|
||||
|
||||
if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (this->bitfield & 0x7F) != 0x13) {
|
||||
sub_08082850(this, NULL);
|
||||
} else {
|
||||
sub_0806F3E4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080827F8(Entity* this) {
|
||||
if (gPlayerState.field_0x1c == 0) {
|
||||
sub_08082850(this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_512(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08082818(Entity* this) {
|
||||
sub_08082850(this, NULL);
|
||||
}
|
||||
|
||||
static void sub_08082824(Entity* this) {
|
||||
if (this->field_0x20 < 0) {
|
||||
this->spriteSettings.b.flipY = 1;
|
||||
}
|
||||
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
sub_08082850(this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_08082850(Entity* this, Entity* parent) {
|
||||
u32 parameter = sub_0808288C(this, this->entityType.form, this->field_0x7c.BYTES.byte1, this->entityType.parameter);
|
||||
Entity* fxEntity = CreateFx(this, 5, parameter);
|
||||
if (fxEntity) {
|
||||
fxEntity->parent = parent;
|
||||
}
|
||||
|
||||
if (this->entityType.parameter == 1) {
|
||||
SetFlag(this->field_0x86);
|
||||
}
|
||||
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) {
|
||||
Entity* entity;
|
||||
u32 result = 0;
|
||||
switch (form) {
|
||||
case 0xFF:
|
||||
result = 0;
|
||||
break;
|
||||
case 0:
|
||||
result = 0x80;
|
||||
break;
|
||||
default:
|
||||
entity = CreateObjectWithParent(this, 0, form, arg2);
|
||||
if (entity) {
|
||||
if (arg3 == 2) {
|
||||
entity->actionDelay = 5;
|
||||
entity->field_0x86 = this->field_0x86;
|
||||
} else {
|
||||
entity->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern u32* GetLayerByIndex(u32);
|
||||
extern void sub_08085394(Entity*);
|
||||
extern void sub_0808543C(Entity*);
|
||||
extern void sub_08004488(u32);
|
||||
extern u32 sub_080854A8(Entity*);
|
||||
extern void SetTile(u32, u32, u32);
|
||||
|
||||
extern void (*const gUnk_081205D0[])(Entity*);
|
||||
|
||||
extern s8 gUnk_080B4488[][2];
|
||||
extern u16 gUnk_081205E0[];
|
||||
|
||||
void Railtrack(Entity* this) {
|
||||
gUnk_081205D0[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080851AC(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spritePriority.b0 = 7;
|
||||
if ((this->entityType.parameter & 1) != 0) {
|
||||
this->field_0x7c.HALF.LO = -1;
|
||||
} else {
|
||||
this->field_0x7c.HALF.LO = 1;
|
||||
}
|
||||
this->animationState = this->entityType.parameter & 2;
|
||||
if ((this->entityType).form == 3) {
|
||||
uVar1 = CheckFlags(this->field_0x86);
|
||||
this->field_0x7a.HWORD = uVar1;
|
||||
if ((u16)(uVar1 & -1) != 0) {
|
||||
this->animationState = (this->animationState + 2) & 3;
|
||||
this->action = 3;
|
||||
}
|
||||
}
|
||||
InitializeAnimation(this, this->animationState);
|
||||
this->field_0x70.WORD = (u32)GetLayerByIndex(this->collisionLayer) + 4 + (COORD_TO_TILE(this) * 2);
|
||||
sub_08085394(this);
|
||||
}
|
||||
|
||||
void sub_08085264(Entity* this) {
|
||||
if (CheckFlags(this->field_0x86)) {
|
||||
this->action = 2;
|
||||
this->field_0xf = 8;
|
||||
if (this->entityType.form == 1) {
|
||||
ClearFlag(this->field_0x86);
|
||||
}
|
||||
this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
sub_0808543C(this);
|
||||
sub_08004488(0x151);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080852B4(Entity* this) {
|
||||
if (--this->field_0xf == 0) {
|
||||
this->action = 3;
|
||||
this->field_0xf = this->actionDelay;
|
||||
this->field_0x7a.HWORD = CheckFlags(this->field_0x86);
|
||||
this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
sub_08085394(this);
|
||||
sub_08004488(0x151);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08085308(Entity* this) {
|
||||
if (sub_080854A8(this) == 0) {
|
||||
switch (this->entityType.form) {
|
||||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (CheckFlags(this->field_0x86) == 0) {
|
||||
this->action = 1;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (CheckFlags(this->field_0x86) == *(u16*)&this->field_0x7a) {
|
||||
this->field_0xf = 0xff;
|
||||
} else {
|
||||
this->field_0xf = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (--this->field_0xf == 0) {
|
||||
this->action = 2;
|
||||
this->field_0xf = 8;
|
||||
this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
sub_0808543C(this);
|
||||
sub_08004488(0x151);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void sub_08085394(Entity *this)
|
||||
{
|
||||
u32 uVar1;
|
||||
u16 *layerData;
|
||||
u32 iVar3;
|
||||
u32 uVar4;
|
||||
u8 *pbVar5;
|
||||
|
||||
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
|
||||
|
||||
NAKED
|
||||
void sub_08085394(Entity* this) {
|
||||
asm(".include \"asm/non_matching/railtrack/sub_08085394.inc\"");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
if (var0 != *(var1 - var2[0])) {
|
||||
return TRUE;
|
||||
}
|
||||
if (var0 != *var1) {
|
||||
return TRUE;
|
||||
}
|
||||
if (var0 != *(var1 + var2[0])) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern u32 Random(void);
|
||||
extern void CopyPosition(Entity*, Entity*);
|
||||
extern void sub_0806F69C(Entity*);
|
||||
extern void DeleteEntity(Entity*);
|
||||
|
||||
extern void (*const gUnk_08121060[])(Entity*);
|
||||
extern void (*const gUnk_08121070[])(Entity*);
|
||||
|
||||
extern s8 gUnk_08121068[];
|
||||
|
||||
void Smoke(Entity* this) {
|
||||
gUnk_08121060[this->entityType.form](this);
|
||||
}
|
||||
|
||||
void sub_0808A40C(Entity *this)
|
||||
{
|
||||
Entity *ent;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x28;
|
||||
}
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 0x40 - (Random() & 0x1f);
|
||||
ent = CreateObject(0x2d, 1, 0);
|
||||
if (ent != NULL) {
|
||||
CopyPosition(this,ent);
|
||||
ent->x.HALF.HI += gUnk_08121068[(Random() & 7)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808A46C(Entity *this)
|
||||
{
|
||||
gUnk_08121070[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0808A484(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->nonPlanarMovement = 0x40;
|
||||
this->direction = 6;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spritePriority.b0 = 0;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
InitializeAnimation(this, 0x28);
|
||||
}
|
||||
|
||||
void sub_0808A4D0(Entity *this)
|
||||
{
|
||||
GetNextFrame(this);
|
||||
sub_0806F69C(this);
|
||||
if (this->frames.b.f3) {
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "textbox.h"
|
||||
|
||||
extern void sub_080787B4(Entity*);
|
||||
|
||||
extern void (*const gUnk_081228B0[])(Entity*);
|
||||
|
||||
extern BoundingBox gUnk_081228A8;
|
||||
extern u16 gUnk_081228B8[];
|
||||
|
||||
void SwordsmanNewsletter(Entity* this) {
|
||||
gUnk_081228B0[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080933D8(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->frameIndex = this->entityType.form;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
this->boundingBox = &gUnk_081228A8;
|
||||
sub_080787B4(this);
|
||||
}
|
||||
|
||||
void sub_080933FC(Entity *this)
|
||||
{
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
TextboxNoOverlap(gUnk_081228B8[this->entityType.form], this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void InitializeAnimation(Entity*, u32);
|
||||
extern void PlaySFX(u32);
|
||||
extern void DeleteThisEntity();
|
||||
extern void GetNextFrame(Entity*);
|
||||
|
||||
extern void (*const ThoughtBubble_Behaviors[])(Entity*);
|
||||
|
||||
extern u16 ThoughtBubble_SFX[];
|
||||
|
||||
void ThoughtBubble(Entity* this)
|
||||
{
|
||||
ThoughtBubble_Behaviors[this->action](this);
|
||||
}
|
||||
|
||||
void ThoughtBubble_Init(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
if (this->actionDelay == 0) {
|
||||
this->actionDelay = 0x2d;
|
||||
}
|
||||
this->spriteOrientation.flipY = 1;
|
||||
InitializeAnimation(this, this->entityType.parameter);
|
||||
PlaySFX(ThoughtBubble_SFX[this->entityType.parameter]);
|
||||
}
|
||||
|
||||
void ThoughtBubble_Update(Entity *this)
|
||||
{
|
||||
if (this->parent != NULL) {
|
||||
this->x.HALF.HI = this->parent->x.HALF.HI;
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI;
|
||||
this->height.HALF.HI = this->parent->height.HALF.HI;
|
||||
}
|
||||
if ((this->entityType).parameter != 2) {
|
||||
if (--this->actionDelay == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "player.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 gScreenTransition;
|
||||
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;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
}
|
||||
|
||||
void sub_0809E86C(Entity* this) {
|
||||
|
||||
if (sub_0800419C(this, &gPlayerEntity, 0x30, 0x30)) {
|
||||
if (CheckGlobalFlag(EZERO_1ST)) {
|
||||
if (((gScreenTransition & 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.draw = 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;
|
||||
UpdateSpriteForCollisionLayer(fx);
|
||||
}
|
||||
i += sizeof(s16);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809E96C(Entity *this)
|
||||
{
|
||||
CreateMinishEntrance(COORD_TO_TILE_OFFSET(this, 0x20, 0x8));
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "player.h"
|
||||
|
||||
void SetTile(u32 tileIndex, s32 tilePosition, s32 layerIndex);
|
||||
s32 GetTileType(s32 tilePosition, s32 layerIndex);
|
||||
void sub_08078B48();
|
||||
void DeleteThisEntity();
|
||||
|
||||
extern void (*gUnk_08124C08[])(Entity*);
|
||||
|
||||
void Well(Entity* ent) {
|
||||
gUnk_08124C08[ent->action](ent);
|
||||
}
|
||||
|
||||
void sub_080A0EB0(Entity* ent) {
|
||||
u32 tilePos;
|
||||
|
||||
ent->action = 1;
|
||||
tilePos = COORD_TO_TILE(ent);
|
||||
ent->field_0x80.HWORD = tilePos;
|
||||
SetTile(16509, ent->field_0x80.HWORD, 1);
|
||||
}
|
||||
|
||||
void sub_080A0EF0(Entity* ent) {
|
||||
s32 tileIndex;
|
||||
|
||||
tileIndex = GetTileType(ent->field_0x80.HWORD, 1);
|
||||
if (tileIndex != 0x407D) {
|
||||
sub_08078B48();
|
||||
gPlayerEntity.x.WORD = ent->x.WORD;
|
||||
gPlayerEntity.y.HALF.HI = ent->y.HALF.HI + 4;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
void WindTribeFlag(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->collisionLayer = 2;
|
||||
if ((this->entityType).form == 0) {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
}
|
||||
else {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
InitializeAnimation(this,0);
|
||||
}
|
||||
else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
if (this->frameDuration == 0xff) {
|
||||
this->frameDuration = (Random() & 0xf) + 0x10;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0807DD64(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern void sub_08078850(Entity*, u32, u32, u8*);
|
||||
extern void PlaySFX(u32);
|
||||
extern Entity* CreateFx (Entity*, u32, u32);
|
||||
|
||||
extern u8 gUnk_08125010;
|
||||
|
||||
void Windcrest(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->frameIndex = 0;
|
||||
sub_0807DD64(this);
|
||||
}
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
}
|
||||
|
||||
void sub_080A2124(Entity *this)
|
||||
{
|
||||
sub_08078850(this, 1, 0xe, &gUnk_08125010);
|
||||
}
|
||||
|
||||
void Windcrest_Unlock(Entity *this)
|
||||
{
|
||||
PlaySFX(0x72);
|
||||
gUnk_02002A40.windcrests = gUnk_02002A40.windcrests | 1 << (this->entityType.parameter + 0x18);
|
||||
CreateFx(this, 0x46, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user