summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
Diffstat (limited to 'src/object')
-rw-r--r--src/object/archway.c3
-rw-r--r--src/object/backgroundCloud.c11
-rw-r--r--src/object/bakerOven.c4
-rw-r--r--src/object/bell.c2
-rw-r--r--src/object/bird.c10
-rw-r--r--src/object/button.c9
-rw-r--r--src/object/chestSpawner.c1
-rw-r--r--src/object/cloud.c21
-rw-r--r--src/object/fileScreenObjects.c10
-rw-r--r--src/object/floatingBlock.c1
-rw-r--r--src/object/giantLeaf.c3
-rw-r--r--src/object/greatFairy.c163
-rw-r--r--src/object/heartContainer.c6
-rw-r--r--src/object/houseDoorExterior.c6
-rw-r--r--src/object/itemOnGround.c7
-rw-r--r--src/object/jailBars.c2
-rw-r--r--src/object/lightableSwitch.c3
-rw-r--r--src/object/lilypadSmall.c3
-rw-r--r--src/object/mask.c23
-rw-r--r--src/object/metalDoor.c5
-rw-r--r--src/object/minecart.c8
-rw-r--r--src/object/minishSizedArchway.c3
-rw-r--r--src/object/minishSizedEntrance.c22
-rw-r--r--src/object/object1A.c1
-rw-r--r--src/object/object1C.c1
-rw-r--r--src/object/object1D.c2
-rw-r--r--src/object/object2A.c2
-rw-r--r--src/object/object49.c10
-rw-r--r--src/object/object7E.c2
-rw-r--r--src/object/object86.c11
-rw-r--r--src/object/object9E.c4
-rw-r--r--src/object/objectA.c1
-rw-r--r--src/object/objectA2.c1
-rw-r--r--src/object/objectA8.c8
-rw-r--r--src/object/objectAF.c1
-rw-r--r--src/object/objectB2.c2
-rw-r--r--src/object/pinwheel.c5
-rw-r--r--src/object/pot.c14
-rw-r--r--src/object/railtrack.c3
-rw-r--r--src/object/smoke.c3
-rw-r--r--src/object/thoughtBubble.c6
-rw-r--r--src/object/treeHidingPortal.c11
-rw-r--r--src/object/well.c6
-rw-r--r--src/object/windTribeFlag.c2
-rw-r--r--src/object/windcrest.c5
45 files changed, 179 insertions, 248 deletions
diff --git a/src/object/archway.c b/src/object/archway.c
index aa26762f..49f3f497 100644
--- a/src/object/archway.c
+++ b/src/object/archway.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "entity.h"
-#include "sprite.h"
-#include "functions.h"
+#include "game.h"
void Archway(Entity* this) {
if (this->action == 0) {
diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c
index df2625a3..aaee8cf2 100644
--- a/src/object/backgroundCloud.c
+++ b/src/object/backgroundCloud.c
@@ -1,5 +1,6 @@
#include "global.h"
#include "entity.h"
+#include "random.h"
#include "functions.h"
extern void (*const gUnk_08121EA4[])(Entity*);
@@ -24,7 +25,7 @@ void sub_0808F658(Entity* this) {
this->animationState = 0;
this->x.HALF.HI += (Random() & 0xf) << 4;
this->actionDelay = 0;
- this->previousActionFlag = 0;
+ this->subAction = 0;
}
void sub_0808F6E0(Entity* this) {
@@ -35,8 +36,8 @@ void sub_0808F6E0(Entity* this) {
}
void sub_0808F70C(Entity* this) {
- if (this->previousActionFlag == 0) {
- this->previousActionFlag = 1;
+ if (this->subAction == 0) {
+ this->subAction = 1;
this->actionDelay = ((Random() & 7) << 3) + 31;
if ((this->direction & 0x10)) {
@@ -49,10 +50,10 @@ void sub_0808F70C(Entity* this) {
this->y.HALF.HI = gUnk_08121EB3[this->type2 * 2 + (Random() & 1)];
}
- if (this->previousActionFlag == 1) {
+ if (this->subAction == 1) {
if (--this->actionDelay == 0) {
this->action = 1;
- this->previousActionFlag = 0;
+ this->subAction = 0;
}
}
}
diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c
index a64217f1..12cbf897 100644
--- a/src/object/bakerOven.c
+++ b/src/object/bakerOven.c
@@ -59,12 +59,12 @@ void sub_0809CD0C(Entity* this) {
}
/* Damage minish link if he touches a steam cloud */
- if (this->field_0xf == 0 && gPlayerEntity.hurtBlinkTime == 0 && this->frameIndex &&
+ if (this->field_0xf == 0 && gPlayerEntity.iframes == 0 && this->frameIndex &&
sub_0806FC80(this, &gPlayerEntity, 4)) {
this->field_0xf++;
ModHealth(-2);
sub_0800449C(&gPlayerEntity, 0x7a);
- gPlayerEntity.hurtBlinkTime = 16;
+ gPlayerEntity.iframes = 16;
gPlayerEntity.field_0x3e = 16;
gPlayerEntity.field_0x42 = 12;
gPlayerEntity.field_0x46 = 16;
diff --git a/src/object/bell.c b/src/object/bell.c
index 072b0798..3a1e7d41 100644
--- a/src/object/bell.c
+++ b/src/object/bell.c
@@ -1,5 +1,5 @@
-#include "entity.h"
#include "global.h"
+#include "entity.h"
extern void (*gUnk_08123384[])(Entity*);
diff --git a/src/object/bird.c b/src/object/bird.c
index 6d126380..fcf03eab 100644
--- a/src/object/bird.c
+++ b/src/object/bird.c
@@ -1,8 +1,10 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "flags.h"
-#include "functions.h"
#include "save.h"
+#include "random.h"
+#include "functions.h"
extern void (*const gUnk_08123EC0[])(Entity*);
extern void (*const gUnk_08123EEC[])(Entity*);
@@ -69,7 +71,7 @@ void sub_0809D048(Entity* this) {
}
void sub_0809D06C(Entity* this) {
- gUnk_08123EFC[this->previousActionFlag](this);
+ gUnk_08123EFC[this->subAction](this);
}
void sub_0809D084(Entity* this) {
@@ -80,7 +82,7 @@ void sub_0809D084(Entity* this) {
if (temp != 0) {
PositionRelative(this->parent, this, 0, 0x80000);
} else {
- this->previousActionFlag++;
+ this->subAction++;
this->field_0x20 = temp;
}
}
@@ -95,7 +97,7 @@ void sub_0809D0AC(Entity* this) {
this->height.WORD = 0;
this->collisionLayer = 1;
SetLocalFlag(0x45);
- SoundReq(0x72);
+ SoundReq(SFX_SECRET);
fx = CreateFx(this, 0x11, 0);
if (fx != NULL) {
sub_0806FAD8(this, fx);
diff --git a/src/object/button.c b/src/object/button.c
index 23a2ee8d..e545953c 100644
--- a/src/object/button.c
+++ b/src/object/button.c
@@ -47,7 +47,7 @@ void sub_08081FF8(Entity*);
void sub_08081BAC(Entity* this) {
if (sub_08081CB0(this)) {
- this->previousActionFlag = 0;
+ this->subAction = 0;
this->actionDelay = 0xA;
sub_0805E4E0(this, 0xA);
sub_08081FF8(this);
@@ -105,7 +105,6 @@ void sub_08081C98(Entity* this) {
}
Entity* sub_08081D74(Entity*);
-void sub_0807B7D8(u32, u32, u32);
u32 sub_080001DA(u32, u32);
u32 sub_08081CB0(Entity* this) {
@@ -142,8 +141,7 @@ u32 sub_08081D28(Entity* this) {
}
extern u32 sub_080002E0(u32, u32);
-extern Entity* gUnk_03004040[];
-extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
+extern Entity* gUnk_03004040[3];
u32 sub_08081E0C(Entity*);
Entity* sub_08081D74(Entity* this) {
@@ -171,8 +169,6 @@ Entity* sub_08081D74(Entity* this) {
return ent;
}
-extern u32 sub_08079F8C();
-
u32 sub_08081E0C(Entity* this) {
Entity* tmp = &gPlayerEntity;
if (tmp->height.HALF.HI != 0 || !sub_08079F8C()) {
@@ -273,7 +269,6 @@ u32 sub_08081F7C(Entity* this, u32 r7) {
return 1;
}
-extern Entity* gUnk_03004040[3];
extern void sub_080044AE(Entity*, u32, u32);
void sub_08081FF8(Entity* this) {
diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c
index 790d1251..3f7e6006 100644
--- a/src/object/chestSpawner.c
+++ b/src/object/chestSpawner.c
@@ -1,6 +1,5 @@
#include "global.h"
#include "entity.h"
-#include "flags.h"
extern void sub_080842D8(Entity*);
extern void sub_08078828(Entity*);
diff --git a/src/object/cloud.c b/src/object/cloud.c
index 6f10295a..56b55984 100644
--- a/src/object/cloud.c
+++ b/src/object/cloud.c
@@ -1,31 +1,20 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "room.h"
#include "player.h"
#include "flags.h"
+#include "random.h"
#include "functions.h"
#include "structures.h"
extern void sub_0809F7BC(Entity*);
-extern void SoundReq(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 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 void* gUnk_080DD750;
-extern Entity gPlayerEntity;
-extern PlayerState gPlayerState;
extern u8 gUnk_081247C0[];
extern u16 gUnk_081247C8[];
extern u32 gUnk_081247D0;
@@ -70,9 +59,9 @@ void sub_0809F548(Entity* this) {
void sub_0809F5B0(Entity* this) {
if (--this->actionDelay == 0) {
- SoundReq(115);
+ SoundReq(SFX_SECRET_BIG);
SetGlobalFlag(KUMOTATSUMAKI);
- LoadRoomEntityList(&gUnk_080DD750);
+ LoadRoomEntityList((EntityData*)&gUnk_080DD750);
DeleteThisEntity();
}
}
@@ -123,7 +112,7 @@ void sub_0809F69C(Entity* this) {
this->actionDelay = 30;
this->action = 4;
gRoomControls.cameraTarget = &gPlayerEntity;
- SoundReq(115);
+ SoundReq(SFX_SECRET_BIG);
}
}
diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c
index 2b4914e1..de79631a 100644
--- a/src/object/fileScreenObjects.c
+++ b/src/object/fileScreenObjects.c
@@ -1,18 +1,17 @@
#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 "structures.h"
+#include "coord.h"
#include "fileScreen.h"
+#include "utils.h"
+#include "structures.h"
+#include "functions.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*);
@@ -39,7 +38,6 @@ typedef struct {
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];
diff --git a/src/object/floatingBlock.c b/src/object/floatingBlock.c
index 661cec72..7e1ad599 100644
--- a/src/object/floatingBlock.c
+++ b/src/object/floatingBlock.c
@@ -1,6 +1,5 @@
#include "global.h"
#include "entity.h"
-#include "functions.h"
void FloatingBlock(Entity* this) {
if (this->action == 0) {
diff --git a/src/object/giantLeaf.c b/src/object/giantLeaf.c
index cf2fb1df..9badc65b 100644
--- a/src/object/giantLeaf.c
+++ b/src/object/giantLeaf.c
@@ -1,11 +1,10 @@
#include "global.h"
#include "entity.h"
#include "room.h"
+#include "functions.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[];
diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c
index 3d511b25..87afa483 100644
--- a/src/object/greatFairy.c
+++ b/src/object/greatFairy.c
@@ -1,12 +1,15 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "room.h"
#include "screen.h"
-#include "structures.h"
#include "greatFairy.h"
-#include "functions.h"
+#include "flags.h"
#include "save.h"
+#include "random.h"
#include "script.h"
+#include "structures.h"
+#include "functions.h"
enum {
BEHAVIORS,
@@ -23,11 +26,9 @@ enum {
// Main
void GreatFairy(Entity* this) {
- u8 bVar1;
-
if (this->action == 0) {
- bVar1 = __modsi3(this->type, 11);
- this->type2 = bVar1;
+ s32 temp = 11;
+ this->type2 = this->type % temp;
}
GreatFairy_Main[this->type2](this);
}
@@ -66,20 +67,18 @@ void GreatFairy_DormantUpdate(Entity* this) {
--*pFrame;
}
switch (*pFrame) {
- case 0x96:
- case 0x82:
- goto e;
- case 0x0:
+ case 0:
this->action = 2;
break;
- e:
- case 0xd2:
- case 0xaa:
- case 0x121:
+ case 130:
+ case 150:
+ case 170:
+ case 210:
+ case 289:
ripple = GreatFairy_CreateForm(this, RIPPLE, 0);
if (ripple) {
- PositionRelative(this, ripple, (s32)GreatFairy_RippleOffsets[this->actionDelay] << 16,
- (s32)GreatFairy_RippleOffsets[this->actionDelay + 1] << 16);
+ PositionRelative(this, ripple, (s32)GreatFairy_RippleOffsets[this->actionDelay] * 65536,
+ (s32)GreatFairy_RippleOffsets[this->actionDelay + 1] * 65536);
this->actionDelay += 2;
break;
}
@@ -108,9 +107,8 @@ void GreatFairy_SpawningUpdate(Entity* this) {
DoFade(6, 4);
SoundReq(325);
this->action = 4;
- this->actionDelay = 0x3c;
- var = this->spriteSettings.raw & ~0x3;
- this->spriteSettings.raw = (this->spriteSettings.raw & var) | 1;
+ this->actionDelay = 60;
+ this->spriteSettings.b.draw = 1;
}
}
}
@@ -164,10 +162,8 @@ void GreatFairy_WingsInit(Entity* this) {
}
void GreatFairy_WingsUpdate(Entity* this) {
- s32 iVar1;
-
- iVar1 = this->speed -= 32;
- if (iVar1 * 65536 >> 16 == 256) {
+ this->speed -= 32;
+ if (this->speed == 256) {
this->action = 2;
sub_0805EC60(this);
gRoomVars.greatFairyState |= 32;
@@ -221,7 +217,7 @@ void GreatFairy_MiniRisingUpdate(Entity* this) {
this->height.WORD -= 0x8000;
if (this->height.HALF.HI == -20) {
this->action = 2;
- SoundReq(321);
+ SoundReq(SFX_HEART_CONTAINER_SPAWN);
} else {
if (((this->height.HALF.HI == -10) && (this->field_0xf == 0)) &&
(target = GreatFairy_CreateForm(this, DROPLET, 0), target != NULL)) {
@@ -235,7 +231,7 @@ void GreatFairy_MiniRisingUpdate(Entity* this) {
void GreatFairy_MiniRemoveMe(Entity* this) {
GetNextFrame(this);
sub_080873D0(this);
- if ((gRoomVars.greatFairyState & 1) != 0) {
+ if (gRoomVars.greatFairyState & 1) {
DeleteEntity(this);
}
}
@@ -268,15 +264,13 @@ void GreatFairy_MiniAffineInit2(Entity* this) {
// 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->speed -= 24;
- sub_0805EC9C(this, 256, iVar2 * 0x10000 >> 20, 0);
+ this->speed -= 24;
+ sub_0805EC9C(this, 256, this->speed >> 4, 0);
}
}
@@ -290,12 +284,12 @@ void GreatFairy_DropletInit(Entity* this) {
this->spriteSettings.b.draw = 1;
this->height.HALF.HI = 0;
this->spritePriority.b0 = 5;
- SoundReq(320);
+ SoundReq(SFX_140);
}
void GreatFairy_DropletUpdate(Entity* this) {
GetNextFrame(this);
- if (this->frames.b.f3) {
+ if (this->frames.all & 0x80) {
DeleteEntity(this);
}
}
@@ -312,7 +306,7 @@ void GreatFairy_RippleInit(Entity* this) {
}
void GreatFairy_RippleUpdate(Entity* this) {
- if ((gRoomVars.greatFairyState & 2) != 0) {
+ if (gRoomVars.greatFairyState & 2) {
DeleteEntity(this);
} else {
GetNextFrame(this);
@@ -329,7 +323,7 @@ void GreatFairy_BigRippleInit(Entity* this) {
this->actionDelay = 120;
this->spriteSettings.b.draw = 1;
this->spritePriority.b0 = 5;
- SoundReq(249);
+ SoundReq(SFX_TELEPORTER);
}
void GreatFairy_BigRippleUpdate(Entity* this) {
@@ -361,7 +355,7 @@ void GreatFairy_EnergyInit(Entity* this) {
void GreatFairy_EnergyUpdate(Entity* this) {
GetNextFrame(this);
- if (this->frames.b.f3) {
+ if (this->frames.all & 0x80) {
DeleteEntity(this);
}
}
@@ -375,35 +369,25 @@ void sub_08087114(Entity* this) {
}
}
-#ifdef NON_MATCHING
-extern u8 gUnk_0812079C;
-
-void sub_08087150(Entity* this) {
+NONMATCH("asm/greatFairy/sub_08087150.inc", void sub_08087150(Entity* this)) {
u32 temp;
- GreatFairy_InitializeAnimation();
+ GreatFairy_InitializeAnimation(this);
this->spriteSettings.b.draw = TRUE;
this->spriteOrientation.flipY = 0;
this->spriteRendering.b0 = 0;
this->spritePriority.b0 = 3;
- this->speed = 0x80;
+ this->speed = 128;
this->direction = 0x10;
- temp = gUnk_0812079C;
+ temp = gUnk_0812079C[0];
this->palette.raw = ((temp & 0xf) << 4) | 0xf;
}
-#else
-NAKED
-void sub_08087150(Entity* this) {
- asm(".include \"asm/greatFairy/sub_08087150.inc\"");
-}
-#endif
+END_NONMATCH
void nullsub_516(Entity* this) {
}
void sub_080871A8(Entity* this) {
- u32 bVar1;
-
if (--this->actionDelay == 0) {
this->action = 3;
this->actionDelay = 60;
@@ -412,7 +396,6 @@ void sub_080871A8(Entity* this) {
}
void sub_080871D0(Entity* this) {
-
if (--this->actionDelay == 0) {
gRoomVars.greatFairyState |= 8;
DeleteEntity(this);
@@ -422,16 +405,16 @@ void sub_080871D0(Entity* 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)) {
+ if ((temp->x.HALF.HI == this->x.HALF.HI) && (temp->y.HALF.HI - 32 == 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);
+ this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, temp->x.HALF.HI, temp->y.HALF.HI - 32);
sub_0806F69C(this);
}
}
void sub_08087240(Entity* this) {
- if ((gRoomVars.greatFairyState & 4) != 0) {
+ if (gRoomVars.greatFairyState & 4) {
this->action = 3;
this->actionDelay = 20;
this->direction = 16;
@@ -446,7 +429,6 @@ void sub_08087264(Entity* this) {
}
void sub_0808727C(Entity* this) {
-
if (--this->actionDelay == 0) {
DeleteEntity(this);
}
@@ -477,17 +459,16 @@ void sub_080872F8(Entity* this) {
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];
+ temp = gSineTable[this->actionDelay + 64];
this->height.HALF.HI = (temp >> 6) - 8;
this->actionDelay++;
}
void GreatFairy_InitializeAnimation(Entity* this) {
- s32 temp;
+ s32 temp = 11;
this->action = 1;
- temp = this->type;
- this->type2 = temp % 11;
+ this->type2 = this->type % temp;
this->collisionLayer = 2;
InitializeAnimation(this, this->type2);
sub_0805E3A0(this, 2);
@@ -513,7 +494,7 @@ void sub_080873D0(Entity* this) {
ent = GreatFairy_CreateForm(this, 8, 0);
if (ent != NULL) {
CopyPosition(this, ent);
- this->actionDelay = 0x30;
+ this->actionDelay = 48;
}
}
}
@@ -521,10 +502,10 @@ void sub_080873D0(Entity* this) {
void sub_080873FC(void) {
Entity* ent;
- SoundReq(0xf7);
+ SoundReq(SFX_APPARATE);
gRoomControls.cameraTarget = NULL;
- while (ent = FindEntityInListBySubtype(0x6, 0x1b, 0x6), ent != NULL) {
+ while (ent = FindEntityByID(0x6, 0x1b, 0x6), ent != NULL) {
DeleteEntity(ent);
}
}
@@ -553,101 +534,87 @@ void sub_08087424(Entity* this, ScriptExecutionContext* context) {
void sub_0808747C(Entity* this, ScriptExecutionContext* context) {
u32 iVar1 = 0;
- iVar1 = (u32)FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0);
+ iVar1 = (u32)FindEntity(0x6, 0xf, 0x6, 0xb, 0x0);
if (iVar1 != 0) {
iVar1 = 1;
}
context->condition = iVar1;
}
-// clang-format off
void (*const GreatFairy_Main[])(Entity*) = {
- GreatFairy_CallBehavior,
+ GreatFairy_CallBehavior,
GreatFairy_WingsCallBehavior,
GreatFairy_WakeCallBehavior,
GreatFairy_MiniCallBehavior,
- GreatFairy_MiniAffineCallBehavior,
- GreatFairy_DropletCallBehavior,
- GreatFairy_RippleCallBehavior,
+ GreatFairy_MiniAffineCallBehavior,
+ GreatFairy_DropletCallBehavior,
+ GreatFairy_RippleCallBehavior,
GreatFairy_BigRippleCallBehavior,
- GreatFairy_EnergyCallBehavior,
- sub_08087114,
- sub_08087294
+ GreatFairy_EnergyCallBehavior,
+ sub_08087114,
+ sub_08087294,
};
void (*const GreatFairy_Behaviors[])(Entity*) = {
- GreatFairy_Init,
- GreatFairy_DormantUpdate,
- GreatFairy_CreateBigRipple,
- GreatFairy_SpawningUpdate,
- GreatFairy_MiniUpdate,
- GreatFairy_FinalUpdate
+ 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
+ 0, 0, -32, -8, 16, 20, 24, -12, -16, 24,
};
-
-void (*const GreatFairy_WingsBehaviors[])(Entity*) = {
+void (*const GreatFairy_WingsBehaviors[])(Entity*) = {
GreatFairy_WingsInit,
GreatFairy_WingsUpdate,
- nullsub_116
+ nullsub_116,
};
void (*const GreatFairy_WakeBehaviors[])(Entity*) = {
GreatFairy_WakeInit,
- GreatFairy_WakeUpdate
+ GreatFairy_WakeUpdate,
};
void (*const GreatFairy_MiniBehaviors[])(Entity*) = {
GreatFairy_MiniInit,
GreatFairy_MiniRisingUpdate,
- GreatFairy_MiniRemoveMe
+ GreatFairy_MiniRemoveMe,
};
void (*const GreatFairy_MiniAffineBehaviors[])(Entity*) = {
GreatFairy_MiniAffineInit,
GreatFairy_MiniAffineInit2,
GreatFairy_MiniAffineUpdate,
- DeleteEntity
+ DeleteEntity,
};
void (*const GreatFairy_DropletBehaviors[])(Entity*) = {
GreatFairy_DropletInit,
- GreatFairy_DropletUpdate
+ GreatFairy_DropletUpdate,
};
void (*const GreatFairy_RippleBehaviors[])(Entity*) = {
GreatFairy_RippleInit,
- GreatFairy_RippleUpdate
+ GreatFairy_RippleUpdate,
};
void (*const GreatFairy_BigRippleBehaviors[])(Entity*) = {
GreatFairy_BigRippleInit,
- GreatFairy_BigRippleUpdate
+ GreatFairy_BigRippleUpdate,
};
void (*const GreatFairy_EnergyBehaviors[])(Entity*) = {
GreatFairy_EnergyInit,
- GreatFairy_EnergyUpdate
+ GreatFairy_EnergyUpdate,
};
+
void (*const GreatFairy_Form1Behaviors[])(Entity*) = {
sub_08087150,
nullsub_516,
sub_080871A8,
- sub_080871D0
+ sub_080871D0,
};
void (*const GreatFairy_Form2Behaviors[])(Entity*) = {
- sub_08087150,
- sub_080871F8,
- sub_08087240,
- sub_08087264,
- sub_0808727C
+ sub_08087150, sub_080871F8, sub_08087240, sub_08087264, sub_0808727C,
};
-// clang-format on
diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c
index f6858b50..046eb0aa 100644
--- a/src/object/heartContainer.c
+++ b/src/object/heartContainer.c
@@ -1,11 +1,9 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
-extern void DeleteThisEntity();
-extern void sub_08080CB4(Entity*);
-extern u32 sub_08017850(Entity*);
static void sub_0808E6A0(Entity*);
static void sub_0808E6E4(Entity*);
static void sub_0808E714(Entity*);
@@ -54,7 +52,7 @@ static void sub_0808E714(Entity* this) {
this->action = 3;
this->field_0x3c |= 0x10;
sub_0805EC60(this);
- SoundReq(0x141);
+ SoundReq(SFX_HEART_CONTAINER_SPAWN);
}
sub_08080CB4(this);
}
diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c
index 0d9b6e81..2b6edaae 100644
--- a/src/object/houseDoorExterior.c
+++ b/src/object/houseDoorExterior.c
@@ -61,7 +61,7 @@ void sub_080866D8(Entity* this) {
entity->field_0x68.HWORD = prop->unk0;
entity->field_0x6a.HWORD = prop->unk2;
entity->collisionLayer = prop->unk4;
- entity->previousActionFlag = prop->unk5;
+ entity->subAction = prop->unk5;
UpdateSpriteForCollisionLayer(entity);
*((u32*)(&this->field_0x68)) |= mask;
if (prop->unk8) {
@@ -98,7 +98,7 @@ static void sub_0808681C(Entity* this) {
this->spriteSettings.b.draw = 1;
this->frameIndex = 0;
this->hitbox = &gUnk_081206AC;
- if (this->previousActionFlag == 1) {
+ if (this->subAction == 1) {
this->action = 2;
this->frameIndex = 1;
}
@@ -158,7 +158,7 @@ void sub_0808692C(Entity* this) {
this->flags &= 0xFD;
this->type2 = 2;
this->action = this->frameIndex == 0 ? 1 : 2;
- this->previousActionFlag = 0;
+ this->subAction = 0;
this->actionDelay = 8;
}
diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c
index b794b546..351b21bd 100644
--- a/src/object/itemOnGround.c
+++ b/src/object/itemOnGround.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
@@ -162,7 +163,7 @@ static void sub_080810FC(Entity* this) {
sub_08081598(this);
} else {
this->action = 2;
- this->previousActionFlag = 0;
+ this->subAction = 0;
this->flags |= 0x80;
this->flags2 = 0x11;
CopyPosition(&gPlayerEntity, this);
@@ -304,11 +305,11 @@ void sub_0808136C(Entity* this) {
}
static void sub_080813BC(Entity* this) {
- gUnk_0811E840[this->previousActionFlag](this);
+ gUnk_0811E840[this->subAction](this);
}
void sub_080813D4(Entity* this) {
- this->previousActionFlag = 1;
+ this->subAction = 1;
this->field_0x1d = 1;
this->spriteSettings.b.draw = 1;
}
diff --git a/src/object/jailBars.c b/src/object/jailBars.c
index d046c822..505ca8e2 100644
--- a/src/object/jailBars.c
+++ b/src/object/jailBars.c
@@ -2,9 +2,9 @@
#include "entity.h"
#include "flags.h"
#include "room.h"
+#include "functions.h"
extern void sub_080A0960(Entity*, u32);
-extern void SoundReq(u32);
extern void sub_0801AF18(u8*, u32, u32);
extern void (*const gUnk_08124950[])(Entity*);
diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c
index cfbf0ba5..cbeafdd7 100644
--- a/src/object/lightableSwitch.c
+++ b/src/object/lightableSwitch.c
@@ -7,10 +7,7 @@
extern void sub_0809EB30(Entity*);
extern void sub_0809EAD8(Entity*);
extern void sub_0809EABC(Entity*);
-extern void EnqueueSFX(u32);
extern void sub_080A2CC0(Entity*, Entity**, u16*);
-extern void SetTile(u32, u32, u32);
-extern void sub_0806F69C(Entity*);
extern void (*const gUnk_081243B4[])(Entity*);
extern void (*const gUnk_081243BC[])(Entity*);
diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c
index a96c49ad..ce0d8c08 100644
--- a/src/object/lilypadSmall.c
+++ b/src/object/lilypadSmall.c
@@ -1,7 +1,8 @@
#include "global.h"
#include "entity.h"
-#include "functions.h"
#include "player.h"
+#include "random.h"
+#include "functions.h"
extern void sub_080A2CC0(Entity*, Entity**, u16*);
diff --git a/src/object/mask.c b/src/object/mask.c
index e405df5f..b6d06206 100644
--- a/src/object/mask.c
+++ b/src/object/mask.c
@@ -2,26 +2,17 @@
#include "entity.h"
#include "room.h"
#include "random.h"
-
-extern Entity gPlayerEntity;
-extern u16 gScreenTransition[];
+#include "structures.h"
+#include "player.h"
+#include "flags.h"
+#include "functions.h"
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 EnqueueSFX(u32);
-extern void sub_080044EC(Entity*, u16);
extern void sub_0805457C(Entity*, s32);
void Mask(Entity* this) {
@@ -35,7 +26,7 @@ void sub_080929A4(Entity* this) {
switch (this->type2 & 0xC0) {
case 0x40:
- field_0x0a = gScreenTransition[0x5];
+ field_0x0a = gScreenTransition.field_0xa;
switch (field_0x0a) {
case 0x44D ... 0x44F:
@@ -69,7 +60,7 @@ void sub_080929A4(Entity* this) {
this->field_0x7a.HWORD = sub_080002E0(this->field_0x7c.HALF.HI, 1);
- SetTile(0x4022, this->field_0x7c.HALF.HI, 1);
+ SetTile(0x4022, this->field_0x7c.HALF_U.HI, 1);
}
// Probably related to knocking it down
@@ -94,7 +85,7 @@ void sub_08092A94(Entity* this) {
}
// Presumably, make the mask fall
- SetTile((u16)this->field_0x7c.HALF.LO, this->field_0x7c.HALF.HI, 1);
+ SetTile(this->field_0x7c.HALF_U.LO, this->field_0x7c.HALF_U.HI, 1);
sub_08000148(this->field_0x7a.HWORD, this->field_0x7c.HALF.HI, 1);
diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c
index 88ab3308..a2a18bff 100644
--- a/src/object/metalDoor.c
+++ b/src/object/metalDoor.c
@@ -2,15 +2,12 @@
#include "entity.h"
#include "room.h"
#include "flags.h"
+#include "functions.h"
extern u32 sub_08083734(Entity*, u32);
extern void sub_080A080C(Entity*);
-extern void sub_0806F69C(Entity*);
-extern void EnqueueSFX(u32);
extern void sub_080A0870(Entity*);
-extern void SoundReq(u32);
extern u32 sub_080001DA(u32, u32);
-extern void SetTile(u32, u32, u32);
extern void (*const gUnk_0812493C[])(Entity*);
diff --git a/src/object/minecart.c b/src/object/minecart.c
index 1e239be3..af74c357 100644
--- a/src/object/minecart.c
+++ b/src/object/minecart.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "functions.h"
#include "room.h"
@@ -7,7 +8,6 @@ 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 {
@@ -85,7 +85,7 @@ void sub_080917DC(Entity* this) {
gPlayerEntity.flags &= 0x7f;
ResetPlayer();
sub_0807A108();
- SoundReq(0x7c);
+ SoundReq(SFX_PLY_JUMP);
}
} else {
this->actionDelay = 0;
@@ -153,7 +153,7 @@ void sub_080919AC(Entity* this) {
}
if (--this->field_0xf == 0xff) {
- SoundReq(0x7b);
+ SoundReq(SFX_PLY_VO7);
this->field_0xf = 0x3c;
}
@@ -182,7 +182,7 @@ void sub_080919AC(Entity* this) {
gPlayerEntity.flags |= 0x80;
sub_08004168(this);
InitAnimationForceUpdate(this, this->animationState + 0xc);
- SoundReq(0x78);
+ SoundReq(SFX_PLY_VO4);
SoundReq(0x139);
return;
case 0x67:
diff --git a/src/object/minishSizedArchway.c b/src/object/minishSizedArchway.c
index cc1b63d3..240fdf95 100644
--- a/src/object/minishSizedArchway.c
+++ b/src/object/minishSizedArchway.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "entity.h"
-#include "sprite.h"
-#include "functions.h"
+#include "game.h"
void MinishSizedArchway(Entity* this) {
if (this->action == 0) {
diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c
index 78410c6c..03467f41 100644
--- a/src/object/minishSizedEntrance.c
+++ b/src/object/minishSizedEntrance.c
@@ -1,11 +1,13 @@
#include "global.h"
#include "entity.h"
+#include "game.h"
+#include "player.h"
+#include "functions.h"
-extern bool32 CheckIsDungeon();
-extern void sub_080AE068(Entity*);
-extern void LoadFixedGFX(Entity*, u32);
+extern void DoExitTransition(void*);
extern void (*const gUnk_08122254[])(Entity*);
+extern u16 gUnk_0812225C[];
void MinishSizedEntrance(Entity* this) {
gUnk_08122254[this->action](this);
@@ -22,3 +24,17 @@ void sub_08090EC0(Entity* this) {
LoadFixedGFX(this, 0x184);
}
}
+
+void sub_08090F00(Entity* this) {
+ if (this->type == 1) {
+ Entity* parent = this->parent;
+ u32 mask = 1 << this->field_0xf;
+ if (!(parent->field_0x20 & mask)) {
+ DeleteThisEntity();
+ }
+ }
+ if ((gPlayerState.flags.all & 0x80) && sub_080041A0(this, &gPlayerEntity, 4, 4) &&
+ (gPlayerEntity.height.HALF.HI == 0) && (((u16)gPlayerState.field_0x90.HALF.LO) & gUnk_0812225C[this->type2])) {
+ DoExitTransition((Entity*)GetCurrentRoomProperty(this->actionDelay));
+ }
+}
diff --git a/src/object/object1A.c b/src/object/object1A.c
index 837884a9..f028481d 100644
--- a/src/object/object1A.c
+++ b/src/object/object1A.c
@@ -1,5 +1,6 @@
#include "global.h"
#include "entity.h"
+#include "random.h"
#include "functions.h"
extern void sub_08086A6C();
diff --git a/src/object/object1C.c b/src/object/object1C.c
index c12a6c1d..0c80735a 100644
--- a/src/object/object1C.c
+++ b/src/object/object1C.c
@@ -2,7 +2,6 @@
#include "entity.h"
extern u32 CheckRectOnScreen(s16, s16, u32, u32);
-extern void DeleteThisEntity();
void Object1C(Entity* this) {
s32 iVar1;
diff --git a/src/object/object1D.c b/src/object/object1D.c
index 8442b227..f7343fbe 100644
--- a/src/object/object1D.c
+++ b/src/object/object1D.c
@@ -1,8 +1,6 @@
#include "global.h"
#include "entity.h"
-void DeleteThisEntity();
-
extern void (*gUnk_081208A0[])(Entity*);
void Object1D(Entity* this) {
diff --git a/src/object/object2A.c b/src/object/object2A.c
index ffd00460..dca66978 100644
--- a/src/object/object2A.c
+++ b/src/object/object2A.c
@@ -31,7 +31,7 @@ void sub_08089B18(Entity* this) {
case 4:
if (!CheckFlags(this->field_0x86.HWORD)) {
this->spriteSettings.b.draw = FALSE;
- this->previousActionFlag = 1;
+ this->subAction = 1;
return;
}
}
diff --git a/src/object/object49.c b/src/object/object49.c
index 16bf7bb9..82d39bd6 100644
--- a/src/object/object49.c
+++ b/src/object/object49.c
@@ -1,7 +1,8 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "functions.h"
-#include "position.h"
+#include "coord.h"
#include "random.h"
#include "structures.h"
@@ -11,7 +12,6 @@ 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*);
@@ -59,7 +59,7 @@ static void sub_0808F14C(Entity* this) {
sub_0808F2B0(this);
if (sub_08003FC4(this, 0x2000) == 0) {
this->action++;
- SoundReq(0x84);
+ SoundReq(SFX_WATER_SPLASH);
}
}
@@ -150,13 +150,13 @@ void sub_0808F2C0(Entity* this) {
void sub_0808F370(Entity* this) {
if (this->action == 0) {
- if (this->parent->previousActionFlag == 1) {
+ if (this->parent->subAction == 1) {
this->action = 1;
this->field_0x70.WORD = 0;
sub_0808F5EC(this);
}
} else {
- u8 flag = this->parent->previousActionFlag - 1;
+ u8 flag = this->parent->subAction - 1;
if (flag < 5) {
if (this->field_0x70.WORD == 0) {
if (--(*(u32*)&this->field_0x74) == -1) {
diff --git a/src/object/object7E.c b/src/object/object7E.c
index 6c89947e..c456a841 100644
--- a/src/object/object7E.c
+++ b/src/object/object7E.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "entity.h"
-#include "functions.h"
+#include "coord.h"
void Object7E(Entity* this) {
diff --git a/src/object/object86.c b/src/object/object86.c
index 9706e040..02e0b480 100644
--- a/src/object/object86.c
+++ b/src/object/object86.c
@@ -1,9 +1,10 @@
#include "global.h"
#include "entity.h"
+#include "coord.h"
#include "player.h"
#include "flags.h"
+#include "functions.h"
-extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
void sub_08099ECC(Entity*);
extern void sub_0805E4E0(Entity*, u32);
extern void sub_0805B390(u32);
@@ -18,7 +19,7 @@ void sub_08099DD0(Entity* this) {
this->collisionLayer = 1;
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
- this->previousActionFlag = 0;
+ this->subAction = 0;
if (GetInventoryValue(0x46)) {
this->action = 4;
this->frameIndex = 0;
@@ -31,7 +32,7 @@ void sub_08099DD0(Entity* this) {
void sub_08099E10(Entity* this) {
if (CheckLocalFlag(0x74)) {
GetNextFrame(this);
- if ((this->frames.all == 1) && (this->previousActionFlag == 0)) {
+ if ((this->frames.all == 1) && (this->subAction == 0)) {
this->frames.all = 0;
sub_08099ECC(this);
}
@@ -56,7 +57,7 @@ void sub_08099E58(Entity* this) {
void sub_08099E8C(Entity* this) {
if (sub_080041A0(this, &gPlayerEntity, 0xc, 0xc)) {
- if (this->previousActionFlag == 0) {
+ if (this->subAction == 0) {
sub_08099ECC(this);
sub_0805E4E0(this, 0x1e);
}
@@ -70,7 +71,7 @@ void nullsub_534(Entity* this) {
}
void sub_08099ECC(Entity* this) {
- this->previousActionFlag = 1;
+ this->subAction = 1;
CopyPosition(this, &gPlayerEntity);
gPlayerState.playerAction = 3;
gPlayerState.field_0x34[4] = 0;
diff --git a/src/object/object9E.c b/src/object/object9E.c
index 858ee01b..f8e89b4e 100644
--- a/src/object/object9E.c
+++ b/src/object/object9E.c
@@ -1,11 +1,11 @@
#include "global.h"
#include "entity.h"
+#include "coord.h"
#include "room.h"
+#include "functions.h"
extern Hitbox gUnk_080FD168;
-extern void SetTile(u32, u32, u32);
-
void Object9E(Entity* this) {
Entity* ent;
u32 tilePos;
diff --git a/src/object/objectA.c b/src/object/objectA.c
index 3679e4bb..0e63b26f 100644
--- a/src/object/objectA.c
+++ b/src/object/objectA.c
@@ -2,6 +2,7 @@
#include "entity.h"
#include "room.h"
#include "flags.h"
+#include "createObject.h"
#include "functions.h"
extern Hitbox gUnk_080FD170;
diff --git a/src/object/objectA2.c b/src/object/objectA2.c
index e79c07f8..0c3307d3 100644
--- a/src/object/objectA2.c
+++ b/src/object/objectA2.c
@@ -1,6 +1,7 @@
#include "global.h"
#include "object.h"
#include "menu.h"
+#include "random.h"
#include "structures.h"
#include "functions.h"
diff --git a/src/object/objectA8.c b/src/object/objectA8.c
index 4cca37f2..c1a5193a 100644
--- a/src/object/objectA8.c
+++ b/src/object/objectA8.c
@@ -1,14 +1,10 @@
#include "global.h"
#include "entity.h"
-
-extern Entity* CreateItemEntity(u32, u32, u32);
-extern void DeleteThisEntity();
-extern void sub_08080CB4(Entity*);
+#include "player.h"
+#include "functions.h"
extern void (*gUnk_08124824[])(Entity*);
-extern Entity gPlayerEntity;
-
void ObjectA8(Entity* this) {
if ((this->bitfield & 0x80) != 0) {
switch (this->bitfield & 0x7f) {
diff --git a/src/object/objectAF.c b/src/object/objectAF.c
index c1d32b60..b678d81b 100644
--- a/src/object/objectAF.c
+++ b/src/object/objectAF.c
@@ -1,5 +1,6 @@
#include "global.h"
#include "entity.h"
+#include "coord.h"
extern void sub_080A0640(Entity*);
diff --git a/src/object/objectB2.c b/src/object/objectB2.c
index c3eff1eb..0888ed38 100644
--- a/src/object/objectB2.c
+++ b/src/object/objectB2.c
@@ -1,7 +1,7 @@
#include "global.h"
#include "entity.h"
+#include "functions.h"
-extern void sub_0806F69C(Entity*);
extern u32 sub_080AE4CC(Entity*, u32, u32, u32);
extern void* gUnk_02027EB4;
diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c
index d6a24471..7de61338 100644
--- a/src/object/pinwheel.c
+++ b/src/object/pinwheel.c
@@ -1,10 +1,9 @@
#include "global.h"
#include "entity.h"
-#include "functions.h"
+#include "flags.h"
+#include "createObject.h"
extern u32 ReadBit(u32*, u32);
-extern void DeleteThisEntity();
-extern u32 CheckLocalFlag(u32);
extern u32 gUnk_020342F8;
extern u16 gUnk_08125050[];
diff --git a/src/object/pot.c b/src/object/pot.c
index f28fb9ee..d589662d 100644
--- a/src/object/pot.c
+++ b/src/object/pot.c
@@ -16,10 +16,8 @@ extern void (*const gUnk_0811F0C4[])(Entity*);
extern Hitbox gUnk_080FD338; // TODO: should be const
extern Hitbox gUnk_080FD340; // TODO: should be const
-extern u32 sub_08016A30(Entity*);
extern u32 sub_080001DA(u32, u32);
extern void sub_08078930(Entity*);
-extern u32 sub_080002B8(Entity*);
extern void sub_08016A6C(Entity*);
void Pot(Entity* this) {
@@ -62,7 +60,7 @@ void sub_08082310(Entity* this) {
switch (var0) {
case 0x13:
this->action = 3;
- this->previousActionFlag = 0;
+ this->subAction = 0;
break;
case 0x1D:
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
@@ -114,7 +112,7 @@ void sub_08082310(Entity* this) {
}
void sub_080824F8(Entity* this) {
- gUnk_0811F0A8[this->previousActionFlag](this);
+ gUnk_0811F0A8[this->subAction](this);
}
void sub_08082510(Entity* this) {
@@ -125,7 +123,7 @@ void sub_08082510(Entity* this) {
this->flags2 = gPlayerEntity.flags2;
this->spriteOffsetY = 0;
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
- this->previousActionFlag++;
+ this->subAction++;
}
void nullsub_511(Entity* this) {
@@ -166,7 +164,7 @@ void sub_080825F0(Entity* this) {
static void sub_08082608(Entity* this) {
this->action = 1;
- this->previousActionFlag = 0;
+ this->subAction = 0;
}
void sub_08082614(Entity* this) {
@@ -203,11 +201,11 @@ void sub_08082614(Entity* this) {
}
void sub_080826E4(Entity* this) {
- gUnk_0811F0C4[this->previousActionFlag](this);
+ gUnk_0811F0C4[this->subAction](this);
}
void sub_080826FC(Entity* this) {
- this->previousActionFlag = 1;
+ this->subAction = 1;
this->field_0x1d = 48;
this->actionDelay = 0;
}
diff --git a/src/object/railtrack.c b/src/object/railtrack.c
index 2e3a3d66..52a74bc3 100644
--- a/src/object/railtrack.c
+++ b/src/object/railtrack.c
@@ -2,13 +2,12 @@
#include "entity.h"
#include "room.h"
#include "flags.h"
+#include "functions.h"
extern u32* GetLayerByIndex(u32);
extern void sub_08085394(Entity*);
extern void sub_0808543C(Entity*);
-extern void EnqueueSFX(u32);
extern u32 sub_080854A8(Entity*);
-extern void SetTile(u32, u32, u32);
extern void (*const gUnk_081205D0[])(Entity*);
diff --git a/src/object/smoke.c b/src/object/smoke.c
index ade9d2cd..86c75efc 100644
--- a/src/object/smoke.c
+++ b/src/object/smoke.c
@@ -1,9 +1,8 @@
#include "global.h"
#include "entity.h"
+#include "random.h"
#include "functions.h"
-extern void sub_0806F69C(Entity*);
-
extern void (*const gUnk_08121060[])(Entity*);
extern void (*const gUnk_08121070[])(Entity*);
diff --git a/src/object/thoughtBubble.c b/src/object/thoughtBubble.c
index 596cb382..5e77d9e1 100644
--- a/src/object/thoughtBubble.c
+++ b/src/object/thoughtBubble.c
@@ -1,10 +1,6 @@
#include "global.h"
#include "entity.h"
-
-extern void InitializeAnimation(Entity*, u32);
-extern void SoundReq(u32);
-extern void DeleteThisEntity();
-extern void GetNextFrame(Entity*);
+#include "functions.h"
extern void (*const ThoughtBubble_Behaviors[])(Entity*);
diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c
index 912003b9..53f593bb 100644
--- a/src/object/treeHidingPortal.c
+++ b/src/object/treeHidingPortal.c
@@ -1,21 +1,20 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "flags.h"
#include "player.h"
#include "room.h"
+#include "structures.h"
+#include "functions.h"
extern void sub_0809E96C(Entity*);
-extern u32 sub_0800419C(Entity*, Entity*, u32, u32);
extern void CreateSparkle(Entity*);
extern u32 sub_0809E9A0(void);
-extern void sub_08078A90(u32);
extern void sub_0809E918(Entity*);
-extern void SoundReq(u32);
extern void CreateMinishEntrance(u32 tile);
extern void (*const gUnk_08124354[])(Entity*);
-extern u32 gScreenTransition;
extern s16 gUnk_08124364[];
void TreeHidingPortal(Entity* this) {
@@ -36,7 +35,7 @@ void sub_0809E86C(Entity* this) {
if (sub_0800419C(this, &gPlayerEntity, 0x30, 0x30)) {
if (CheckGlobalFlag(EZERO_1ST)) {
- if (((gScreenTransition & 3) == 0)) {
+ if (((gScreenTransition.frameCount & 3) == 0)) {
CreateSparkle(this);
}
}
@@ -62,7 +61,7 @@ void sub_0809E8EC(Entity* this) {
if (--this->actionDelay == 0) {
SetFlag(this->field_0x86.HWORD);
sub_08078A90(0);
- SoundReq(0x73);
+ SoundReq(SFX_SECRET_BIG);
DeleteThisEntity();
}
}
diff --git a/src/object/well.c b/src/object/well.c
index fda35fed..86710ac6 100644
--- a/src/object/well.c
+++ b/src/object/well.c
@@ -2,11 +2,7 @@
#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();
+#include "functions.h"
extern void (*gUnk_08124C08[])(Entity*);
diff --git a/src/object/windTribeFlag.c b/src/object/windTribeFlag.c
index 9c769808..bc9d0fa3 100644
--- a/src/object/windTribeFlag.c
+++ b/src/object/windTribeFlag.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "entity.h"
-#include "functions.h"
+#include "random.h"
void WindTribeFlag(Entity* this) {
if (this->action == 0) {
diff --git a/src/object/windcrest.c b/src/object/windcrest.c
index b4b7893a..b21c5ee0 100644
--- a/src/object/windcrest.c
+++ b/src/object/windcrest.c
@@ -1,11 +1,10 @@
#include "global.h"
+#include "audio.h"
#include "entity.h"
#include "save.h"
#include "script.h"
extern void sub_08078850(Entity*, u32, u32, u8*);
-extern void SoundReq(u32);
-extern Entity* CreateFx(Entity*, u32, u32);
extern u8 gUnk_08125010;
@@ -24,7 +23,7 @@ void sub_080A2124(Entity* this) {
}
void Windcrest_Unlock(Entity* this) {
- SoundReq(0x72);
+ SoundReq(SFX_SECRET);
gSave.windcrests = gSave.windcrests | 1 << (this->type2 + 0x18);
CreateFx(this, 0x46, 0);
}