summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-03-30 00:56:23 -0700
committerGitHub <noreply@github.com>2022-03-30 00:56:23 -0700
commitced56e2fa30db327ffe98f27455702133f40fcf8 (patch)
tree9bc7eb383d88bb2023a6fd69c982915931a33d30 /src
parent6000b4f2d3bc4ef482496560e3a47b3ca2b7e2b8 (diff)
parenta633efd88ca533b8d601eb9a673c5eb7e68dd19d (diff)
Merge pull request #478 from notyourav/msm
header cleanup
Diffstat (limited to 'src')
-rw-r--r--src/code_08049DF4.c1
-rw-r--r--src/collision.c10
-rw-r--r--src/createEnemy.c2
-rw-r--r--src/enemy/acroBandits.c19
-rw-r--r--src/enemy/bladeTrap.c6
-rw-r--r--src/enemy/bombarossa.c5
-rw-r--r--src/enemy/enemy64.c11
-rw-r--r--src/enemy/gyorgMale.c6
-rw-r--r--src/enemy/helmasaur.c1
-rw-r--r--src/enemy/keese.c3
-rw-r--r--src/enemy/lakitu.c3
-rw-r--r--src/enemy/lakituCloud.c6
-rw-r--r--src/enemy/leever.c2
-rw-r--r--src/enemy/likeLike.c1
-rw-r--r--src/enemy/mazaalMacro.c2
-rw-r--r--src/enemy/miniSlime.c2
-rw-r--r--src/enemy/mulldozer.c1
-rw-r--r--src/enemy/octorok.c2
-rw-r--r--src/enemy/octorokGolden.c8
-rw-r--r--src/enemy/peahat.c3
-rw-r--r--src/enemy/pesto.c1
-rw-r--r--src/enemy/puffstool.c1
-rw-r--r--src/enemy/rockChuchu.c2
-rw-r--r--src/enemy/rollobite.c5
-rw-r--r--src/enemy/rope.c2
-rw-r--r--src/enemy/ropeGolden.c3
-rw-r--r--src/enemy/rupeeLike.c4
-rw-r--r--src/enemy/scissorsBeetle.c1
-rw-r--r--src/enemy/sensorBladeTrap.c3
-rw-r--r--src/enemy/slime.c3
-rw-r--r--src/enemy/sluggula.c2
-rw-r--r--src/enemy/smallPesto.c2
-rw-r--r--src/enemy/spark.c1
-rw-r--r--src/enemy/torchTrap.c4
-rw-r--r--src/enemy/treeItem.c1
-rw-r--r--src/enemy/vaatiArm.c262
-rw-r--r--src/enemy/vaatiWrath.c2
-rw-r--r--src/entity.c2
-rw-r--r--src/game.c34
-rw-r--r--src/interrupts.c6
-rw-r--r--src/manager/manager22.c22
-rw-r--r--src/menu/figurine_menu.c1
-rw-r--r--src/npc/bigGoron.c7
-rw-r--r--src/npc/cat.c1
-rw-r--r--src/npc/forestMinish.c4
-rw-r--r--src/npc/mayorHagen.c1
-rw-r--r--src/npc/melari.c1
-rw-r--r--src/npc/minishEzlo.c2
-rw-r--r--src/npc/npc23.c4
-rw-r--r--src/npc/npc5.c1
-rw-r--r--src/npc/phonograph.c1
-rw-r--r--src/npc/pita.c4
-rw-r--r--src/npcUtils.c2
-rw-r--r--src/object/bigPushableLever.c2
-rw-r--r--src/object/bird.c10
-rw-r--r--src/object/board.c2
-rw-r--r--src/object/book.c1
-rw-r--r--src/object/button.c2
-rw-r--r--src/object/fairy.c1
-rw-r--r--src/object/fan.c3
-rw-r--r--src/object/floatingPlatform.c12
-rw-r--r--src/object/fourElements.c1
-rw-r--r--src/object/gyorgBossObject.c4
-rw-r--r--src/object/heartContainer.c1
-rw-r--r--src/object/itemOnGround.c1
-rw-r--r--src/object/lavaPlatform.c12
-rw-r--r--src/object/lightableSwitch.c15
-rw-r--r--src/object/lilypadSmall.c12
-rw-r--r--src/object/macroShoes.c1
-rw-r--r--src/object/object30.c1
-rw-r--r--src/object/object96.c1
-rw-r--r--src/object/object98.c5
-rw-r--r--src/object/objectA8.c1
-rw-r--r--src/object/objectB2.c1
-rw-r--r--src/object/pressurePlate.c1
-rw-r--r--src/object/pushableLever.c2
-rw-r--r--src/object/treeHidingPortal.c11
-rw-r--r--src/object/warpPoint.c2
-rw-r--r--src/object/windTribeTeleporter.c1
-rw-r--r--src/objectUtils.c4
-rw-r--r--src/player.c18
-rw-r--r--src/playerItem/playerItemGustBig.c1
-rw-r--r--src/playerUtils.c15
-rw-r--r--src/projectile/dekuSeedProjectile.c1
-rw-r--r--src/projectile/guardLineOfSight.c1
-rw-r--r--src/room.c4
-rw-r--r--src/roomInit.c8
-rw-r--r--src/script.c2
-rw-r--r--src/staffroll.c3
-rw-r--r--src/text.c7
90 files changed, 355 insertions, 301 deletions
diff --git a/src/code_08049DF4.c b/src/code_08049DF4.c
index 06b77524..91029146 100644
--- a/src/code_08049DF4.c
+++ b/src/code_08049DF4.c
@@ -6,6 +6,7 @@
#include "map.h"
#include "player.h"
#include "room.h"
+#include "enemy.h"
extern Entity* gUnk_020000B0;
extern Entity* (*const gUnk_080D3BE8[])(void);
diff --git a/src/collision.c b/src/collision.c
index 911b3f11..11d94675 100644
--- a/src/collision.c
+++ b/src/collision.c
@@ -207,7 +207,7 @@ bool32 IsColliding(Entity* this, Entity* that) {
}
bool32 IsCollidingPlayer(Entity* this) {
- if (sub_08079F8C())
+ if (PlayerCanBeMoved())
return IsColliding(this, &gPlayerEntity);
return FALSE;
}
@@ -528,7 +528,7 @@ s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org == &gPlayerEntity) {
- if (sub_08079F8C() &&
+ if (PlayerCanBeMoved() &&
#ifdef EU
(gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 &&
#else
@@ -568,7 +568,7 @@ s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
kind = org->kind;
if (kind == 1) {
- if (sub_08079F8C()) {
+ if (PlayerCanBeMoved()) {
if (((((direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1F)) > 0xA) {
x = 0x11aa;
return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]);
@@ -622,7 +622,7 @@ s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org == &gPlayerEntity) {
- if (sub_08079F8C() &&
+ if (PlayerCanBeMoved() &&
#ifdef EU
(gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 &&
#else
@@ -651,7 +651,7 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
}
s32 sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
- if (org == &gPlayerEntity && sub_08079F8C())
+ if (org == &gPlayerEntity && PlayerCanBeMoved())
sub_08004484(tgt, org);
return 0;
}
diff --git a/src/createEnemy.c b/src/createEnemy.c
index 36c4d4d4..6c97985c 100644
--- a/src/createEnemy.c
+++ b/src/createEnemy.c
@@ -1,7 +1,7 @@
#include "enemy.h"
/** Unsets bitfield 0x80 before calling GetNextFunction, so that the enemyFunction 1 is not called. */
-void EnemyFunctionHandlerAfterCollision(Entity* entity, void (*fntable[])()) {
+void EnemyFunctionHandlerAfterCollision(Entity* entity, void (*const fntable[])()) {
u32 idx;
entity->contactFlags &= ~0x80;
idx = GetNextFunction(entity);
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c
index 0fd0c667..3adbbea4 100644
--- a/src/enemy/acroBandits.c
+++ b/src/enemy/acroBandits.c
@@ -11,6 +11,13 @@
extern Entity* gUnk_020000B0;
extern void (*const gUnk_080012C8[])(Entity*);
+static void sub_08031E48(Entity* this, Entity* child);
+static void sub_08032290(Entity* this);
+static bool32 sub_080322A4(Entity* this);
+static void sub_08032338(Entity* this);
+static void sub_080322E8(Entity* this);
+static bool32 sub_08031E04(Entity* this);
+
void AcroBandit_OnTick(Entity* this);
void AcroBandit_OnCollision(Entity* this);
void AcroBandit_OnKnockback(Entity* this);
@@ -319,7 +326,7 @@ void AcroBandit_Type0Action8(Entity* this) {
}
}
-bool32 sub_08031E04(Entity* this) {
+static bool32 sub_08031E04(Entity* this) {
static const s8 gUnk_080CE5C0[] = { -32, 0, 0, 32, 32, 0, 0, 0 };
Entity* ent;
const s8* tmp;
@@ -332,7 +339,7 @@ bool32 sub_08031E04(Entity* this) {
return EntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
}
-void sub_08031E48(Entity* this, Entity* child) {
+static void sub_08031E48(Entity* this, Entity* child) {
CopyPosition(this, child);
child->field_0x6c.HALF.LO = this->field_0x6c.HALF.LO;
child->field_0x70.HALF.LO = this->field_0x70.HALF.LO;
@@ -534,13 +541,13 @@ void AcroBandit_Type1Action9(Entity* this) {
}
}
-void sub_08032290(Entity* this) {
+static void sub_08032290(Entity* this) {
this->action = 6;
this->timer = 12;
InitializeAnimation(this, 11);
}
-bool32 sub_080322A4(Entity* this) {
+static bool32 sub_080322A4(Entity* this) {
if (this->child != NULL && (this->child->z.HALF.HI + 8) >= this->z.HALF.HI) {
if (this->z.HALF.HI) {
this->action = 5;
@@ -555,7 +562,7 @@ bool32 sub_080322A4(Entity* this) {
return FALSE;
}
-void sub_080322E8(Entity* this) {
+static void sub_080322E8(Entity* this) {
if (this->field_0x78.HALF.LO) {
if (--this->field_0x78.HALF.LO == 0) {
u32 flipX = this->spriteSettings.flipX;
@@ -573,7 +580,7 @@ void sub_080322E8(Entity* this) {
}
}
-void sub_08032338(Entity* this) {
+static void sub_08032338(Entity* this) {
if ((((Entity*)this->field_0x7c.WORD)->timer += 15) != 80)
this->field_0x6c.HALF.LO = 0;
}
diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c
index d534242a..86fe70d0 100644
--- a/src/enemy/bladeTrap.c
+++ b/src/enemy/bladeTrap.c
@@ -8,13 +8,13 @@
#include "sound.h"
#include "entity.h"
#include "room.h"
-#include "functions.h"
+#include "object.h"
void BladeTrap(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->child = GetCurrentRoomProperty(this->type);
- sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
+ UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
}
if (!(this->direction & 0x80)) {
LinearMoveUpdate(this);
@@ -24,6 +24,6 @@ void BladeTrap(Entity* this) {
if (!(this->direction & 0x80)) {
EnqueueSFX(SFX_METAL_CLINK);
}
- sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
+ UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
}
}
diff --git a/src/enemy/bombarossa.c b/src/enemy/bombarossa.c
index f873f5c4..fb2c8f31 100644
--- a/src/enemy/bombarossa.c
+++ b/src/enemy/bombarossa.c
@@ -3,7 +3,6 @@
#include "enemy.h"
#include "room.h"
#include "object.h"
-#include "functions.h"
typedef struct {
Entity base;
@@ -27,7 +26,7 @@ void Bombarossa_OnTick(BombarossaEntity* this) {
InitializeAnimation(super, 0);
if (super->type != 0) {
super->child = GetCurrentRoomProperty(super->type);
- sub_080A2CC0(super, (u16**)&super->child, &this->unk_0x76);
+ UpdateRailMovement(super, (u16**)&super->child, &this->unk_0x76);
}
}
@@ -68,7 +67,7 @@ void sub_0803350C(BombarossaEntity* this) {
}
if (--this->unk_0x76 == 0) {
- sub_080A2CC0(super, (u16**)&super->child, &this->unk_0x76);
+ UpdateRailMovement(super, (u16**)&super->child, &this->unk_0x76);
}
}
diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c
index 9f3f242d..529bce1e 100644
--- a/src/enemy/enemy64.c
+++ b/src/enemy/enemy64.c
@@ -309,7 +309,7 @@ void Enemy64_Action4(Enemy64Entity* this) {
void Enemy64_Action4_SubAction0(Enemy64Entity* this) {
SoundReq(SFX_BOSS_DIE);
- if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) {
+ if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
SetPlayerControl(CONTROL_2);
super->subAction = 2;
super->timer = 0x1e;
@@ -320,7 +320,7 @@ void Enemy64_Action4_SubAction0(Enemy64Entity* this) {
}
void Enemy64_Action4_SubAction1(Enemy64Entity* this) {
- if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) {
+ if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
SetPlayerControl(CONTROL_2);
super->subAction = 2;
super->timer = 1;
@@ -438,7 +438,7 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) {
tmpX = super->x.HALF.HI;
tmpY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
- if (((this->unk_7c & 1) != 0) && sub_08079F8C()) {
+ if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI;
gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI;
}
@@ -447,7 +447,8 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) {
void sub_080499F0(Enemy64Entity* this) {
u32 tmp;
- if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (sub_08079F8C())) && ((this->unk_7c & 1) == 0)) {
+ if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (PlayerCanBeMoved())) &&
+ ((this->unk_7c & 1) == 0)) {
if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24) &&
((this->unk_7c & 2) == 0)) {
tmp = sub_080045DA((s32)gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
@@ -491,7 +492,7 @@ void sub_08049B20(Enemy64Entity* this) {
tmpX = super->x.HALF.HI;
tmpY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
- if (((this->unk_7c & 1) != 0) && sub_08079F8C()) {
+ if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI;
gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI;
}
diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c
index 975424f7..a0c05067 100644
--- a/src/enemy/gyorgMale.c
+++ b/src/enemy/gyorgMale.c
@@ -1035,7 +1035,7 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) {
oldY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
- if (sub_08079F8C()) {
+ if (PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY;
}
@@ -1053,7 +1053,7 @@ void sub_08047E58(GyorgMaleEntity* this) {
oldY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
- if (sub_08079F8C()) {
+ if (PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY;
}
@@ -1126,7 +1126,7 @@ void sub_08048004(GyorgMaleEntity* this) {
COLLISION_OFF(super);
if (gPlayerEntity.z.HALF.HI != 0)
return;
- if (!sub_08079F8C())
+ if (!PlayerCanBeMoved())
return;
if (this->unk_7c & 1) {
u32 b = super->spriteRendering.b3;
diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c
index 609a4b07..bce46d65 100644
--- a/src/enemy/helmasaur.c
+++ b/src/enemy/helmasaur.c
@@ -8,6 +8,7 @@
#include "enemy.h"
#include "object.h"
#include "functions.h"
+#include "collision.h"
extern u32 sub_0804A024(Entity*, u32, u32);
diff --git a/src/enemy/keese.c b/src/enemy/keese.c
index 424432a5..a493142b 100644
--- a/src/enemy/keese.c
+++ b/src/enemy/keese.c
@@ -6,7 +6,8 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
+#include "player.h"
extern void GenericKnockback2(Entity*);
extern void Keese_StartFly(Entity*);
diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c
index a4c2e6a0..784c21a5 100644
--- a/src/enemy/lakitu.c
+++ b/src/enemy/lakitu.c
@@ -7,7 +7,8 @@
#include "global.h"
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
+#include "player.h"
extern void (*const LakituActionFuncs[])(Entity*);
diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c
index 98ee064d..6e2c7091 100644
--- a/src/enemy/lakituCloud.c
+++ b/src/enemy/lakituCloud.c
@@ -9,9 +9,11 @@
#include "asm.h"
#include "entity.h"
#include "player.h"
-#include "functions.h"
#include "effects.h"
#include "enemy.h"
+#include "physics.h"
+#include "room.h"
+#include "object.h"
extern void (*const LakituCloud_Functions[6])(Entity*);
extern void (*const gUnk_080D0430[3])(Entity*);
@@ -118,7 +120,7 @@ void sub_0803CDD8(Entity* this) {
void sub_0803CE14(Entity* this) {
u8 direction;
- sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
+ UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
direction = this->direction;
if (direction & 0x80) {
diff --git a/src/enemy/leever.c b/src/enemy/leever.c
index fe7095da..fd041835 100644
--- a/src/enemy/leever.c
+++ b/src/enemy/leever.c
@@ -6,7 +6,7 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
extern u32 sub_080B1B18(s32, s32, u32);
extern u32 sub_080B1AB4(s32, s32, u32);
diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c
index bca36368..0e7abeb9 100644
--- a/src/enemy/likeLike.c
+++ b/src/enemy/likeLike.c
@@ -9,7 +9,6 @@
#include "message.h"
#include "save.h"
#include "object.h"
-#include "functions.h"
#include "item.h"
extern bool32 ItemIsShield(u32);
diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c
index 4dbf53d6..c672248d 100644
--- a/src/enemy/mazaalMacro.c
+++ b/src/enemy/mazaalMacro.c
@@ -144,7 +144,7 @@ void sub_08034E68(Entity* this) {
sub_08035120(this);
}
if (gRoomTransition.field_0x39 == 0) {
- if (sub_08079F8C()) {
+ if (PlayerCanBeMoved()) {
this->action = 3;
scriptExecutionContext = StartCutscene(this, (u16*)script_MazaalMacroDefeated);
*(ScriptExecutionContext**)&this->cutsceneBeh = scriptExecutionContext;
diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c
index 80e0666e..2231c83e 100644
--- a/src/enemy/miniSlime.c
+++ b/src/enemy/miniSlime.c
@@ -6,7 +6,7 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
void sub_08045374(Entity*);
diff --git a/src/enemy/mulldozer.c b/src/enemy/mulldozer.c
index adaa991a..89e0a002 100644
--- a/src/enemy/mulldozer.c
+++ b/src/enemy/mulldozer.c
@@ -9,7 +9,6 @@
#include "global.h"
#include "collision.h"
#include "enemy.h"
-#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c
index e36bc8af..267b0acf 100644
--- a/src/enemy/octorok.c
+++ b/src/enemy/octorok.c
@@ -6,7 +6,7 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
void Octorok_Pause(Entity*);
bool32 Octorok_FacesPlayer(Entity*);
diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c
index c630053d..7af19a82 100644
--- a/src/enemy/octorokGolden.c
+++ b/src/enemy/octorokGolden.c
@@ -1,6 +1,7 @@
-#include "entity.h"
+#include "collision.h"
+#include "map.h"
#include "enemy.h"
-#include "functions.h"
+#include "player.h"
void (*const OctorokGolden_Functions[])(Entity*);
void (*const gUnk_080CF484[])(Entity*);
@@ -10,6 +11,7 @@ const u8 gUnk_080CF498[];
void sub_08037E14(Entity* this);
bool32 sub_08037E90(Entity* this);
+static void sub_08037D54(Entity* this);
void OctorokGolden(Entity* this) {
u32 index;
@@ -68,7 +70,7 @@ void sub_08037D0C(Entity* this) {
}
}
-void sub_08037D54(Entity* this) {
+static void sub_08037D54(Entity* this) {
UpdateAnimationVariableFrames(this, 2);
if (this->frame & 0x1) {
diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c
index 9b2c8787..2af3a5ff 100644
--- a/src/enemy/peahat.c
+++ b/src/enemy/peahat.c
@@ -6,7 +6,8 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "room.h"
+#include "physics.h"
extern void (*const Peahat_Functions[])(Entity*);
extern void (*const gPeahatPropellerFunctions[])(Entity*);
diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c
index 4da32bcb..05920fac 100644
--- a/src/enemy/pesto.c
+++ b/src/enemy/pesto.c
@@ -9,7 +9,6 @@
#include "collision.h"
#include "object.h"
#include "game.h"
-#include "functions.h"
#include "save.h"
#include "playeritem.h"
diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c
index aac1c3e7..f07f5bc0 100644
--- a/src/enemy/puffstool.c
+++ b/src/enemy/puffstool.c
@@ -8,7 +8,6 @@
#include "enemy.h"
#include "collision.h"
#include "object.h"
-#include "functions.h"
extern u8 gUnk_080B37A0[];
extern u8 gUnk_080B3E80[];
diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c
index 89f62eb5..893ec8b6 100644
--- a/src/enemy/rockChuchu.c
+++ b/src/enemy/rockChuchu.c
@@ -6,7 +6,7 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "player.h"
extern void (*const RockChuchu_Functions[])(Entity*);
extern void (*const gUnk_080CB960[])(Entity*);
diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c
index 3308f3b6..a8fd55e8 100644
--- a/src/enemy/rollobite.c
+++ b/src/enemy/rollobite.c
@@ -6,7 +6,10 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
+#include "player.h"
+#include "room.h"
+#include "collision.h"
extern void (*const Rollobite_Functions[])(Entity*);
extern void (*const gRollobiteActions[])(Entity*);
diff --git a/src/enemy/rope.c b/src/enemy/rope.c
index c62edf1e..c21b7540 100644
--- a/src/enemy/rope.c
+++ b/src/enemy/rope.c
@@ -6,7 +6,7 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
extern void (*const Rope_Functions[6])(Entity*);
extern void (*const gUnk_080CE460[4])(Entity*);
diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c
index 5bb3796b..757f5438 100644
--- a/src/enemy/ropeGolden.c
+++ b/src/enemy/ropeGolden.c
@@ -7,8 +7,9 @@
#include "global.h"
#include "entity.h"
-#include "functions.h"
#include "enemy.h"
+#include "physics.h"
+#include "player.h"
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const RopeGolden_Functions[6])(Entity*);
diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c
index 9a9fc7cd..3209e1c4 100644
--- a/src/enemy/rupeeLike.c
+++ b/src/enemy/rupeeLike.c
@@ -6,14 +6,12 @@
*/
#include "global.h"
-#include "asm.h"
-#include "sound.h"
#include "entity.h"
#include "enemy.h"
#include "object.h"
-#include "functions.h"
#include "save.h"
#include "hitbox.h"
+#include "room.h"
extern void sub_080293DC(Entity*);
extern void sub_080296D8(Entity*);
diff --git a/src/enemy/scissorsBeetle.c b/src/enemy/scissorsBeetle.c
index b4be1979..34ebb195 100644
--- a/src/enemy/scissorsBeetle.c
+++ b/src/enemy/scissorsBeetle.c
@@ -2,7 +2,6 @@
#include "collision.h"
#include "entity.h"
#include "enemy.h"
-#include "functions.h"
typedef struct {
Entity base;
diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c
index 7ca53a62..3736305c 100644
--- a/src/enemy/sensorBladeTrap.c
+++ b/src/enemy/sensorBladeTrap.c
@@ -6,7 +6,8 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
+#include "collision.h"
extern u32 sub_0804A024(Entity*, u32, u32);
diff --git a/src/enemy/slime.c b/src/enemy/slime.c
index 70f43914..57301468 100644
--- a/src/enemy/slime.c
+++ b/src/enemy/slime.c
@@ -6,7 +6,8 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
+#include "room.h"
typedef struct {
s8 h, v;
diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c
index 5dc003ef..9648e71a 100644
--- a/src/enemy/sluggula.c
+++ b/src/enemy/sluggula.c
@@ -6,7 +6,7 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
void sub_08023E10(Entity*);
void sub_08023E54(Entity*);
diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c
index a5d7b38f..9f1eaebd 100644
--- a/src/enemy/smallPesto.c
+++ b/src/enemy/smallPesto.c
@@ -6,7 +6,7 @@
*/
#include "enemy.h"
-#include "functions.h"
+#include "physics.h"
extern void sub_080317F8(Entity*);
diff --git a/src/enemy/spark.c b/src/enemy/spark.c
index 6326654d..8eaeac39 100644
--- a/src/enemy/spark.c
+++ b/src/enemy/spark.c
@@ -8,7 +8,6 @@
#include "collision.h"
#include "enemy.h"
#include "object.h"
-#include "functions.h"
extern void (*const Spark_Functions[])(Entity*);
extern void (*const gUnk_080CD24C[])(Entity*);
diff --git a/src/enemy/torchTrap.c b/src/enemy/torchTrap.c
index 527a87b7..dc3c07cf 100644
--- a/src/enemy/torchTrap.c
+++ b/src/enemy/torchTrap.c
@@ -1,7 +1,9 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
-#include "functions.h"
+#include "room.h"
+#include "physics.h"
+#include "player.h"
typedef struct {
Entity base;
diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c
index 00005671..95ed60f7 100644
--- a/src/enemy/treeItem.c
+++ b/src/enemy/treeItem.c
@@ -12,7 +12,6 @@
static bool32 ShouldSpawnTreeItem(Entity*);
-extern u32 GetRandomByWeight(const u8*);
extern void sub_08049CF4(Entity*);
const u8 gTreeItemDropTables[][16] = {
diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c
index e032cdaa..1512c92f 100644
--- a/src/enemy/vaatiArm.c
+++ b/src/enemy/vaatiArm.c
@@ -29,71 +29,72 @@ typedef struct VaatiArm_HeapStruct {
VaatiArm_HeapStruct1 s1[5];
} VaatiArm_HeapStruct;
-u32 sub_080437DC(Entity*);
-u32 sub_08043C98(Entity*);
-void VaatiArm_OnTick(Entity*);
-void VaatiArm_OnCollision(Entity*);
-void sub_080425B4(Entity*);
-void sub_08042818(Entity*);
-void sub_08042870(Entity*);
-void sub_08042A3C(Entity*);
-void sub_08042C14(Entity*);
-void sub_0804325C(Entity*);
-void sub_08043420(Entity*);
-void sub_08043680(Entity*);
-void VaatiArm_OnGrabbed(Entity*);
-void sub_08042654(Entity*);
-void sub_0804259C(Entity*);
-void sub_08043A10(Entity*);
-void sub_08043ABC(Entity*);
-void sub_08043BC8(Entity*);
-void sub_08043EB8(Entity*);
-void sub_08044000(Entity*);
-void sub_08044078(Entity*);
-void sub_080440CC(Entity*);
-void sub_08043CD4(Entity*);
-void sub_08042894(Entity*);
-void sub_080428AC(Entity*);
-void sub_080428FC(Entity*);
-void sub_08042944(Entity*);
-void sub_08042970(Entity*);
-void sub_080429D4(Entity*);
-void sub_080429FC(Entity*);
-void sub_08043BF0(Entity*);
-void sub_08042A6C(Entity*);
-void sub_08042A88(Entity*);
-void sub_08042AEC(Entity*);
-void sub_08042B20(Entity*);
-void sub_08043C40(Entity*, VaatiArm_HeapStruct1*);
-void sub_08043A78(Entity*);
-void sub_08042C34(Entity*);
-void sub_08042D24(Entity*);
-void sub_08042D6C(Entity*);
-void sub_08042E30(Entity*);
-void sub_08042EF4(Entity*);
-void sub_08042FD8(Entity*);
-void sub_08043048(Entity*);
-void sub_080430D0(Entity*);
-void sub_08043130(Entity*);
-void sub_080431E8(Entity*);
-void sub_08043B9C(Entity*);
+static u32 sub_080437DC(Entity*);
+static u32 sub_08043C98(Entity*);
+static void VaatiArm_OnTick(Entity*);
+static void VaatiArm_OnCollision(Entity*);
+static void sub_080425B4(Entity*);
+static void sub_08042818(Entity*);
+static void sub_08042870(Entity*);
+static void sub_08042A3C(Entity*);
+static void sub_08042C14(Entity*);
+static void sub_0804325C(Entity*);
+static void sub_08043420(Entity*);
+static void sub_08043680(Entity*);
+static void VaatiArm_OnGrabbed(Entity*);
+static void sub_08042654(Entity*);
+static void sub_0804259C(Entity*);
+static void sub_08043A10(Entity*);
+static void sub_08043ABC(Entity*);
+static void sub_08043BC8(Entity*);
+static void sub_08043EB8(Entity*);
+static void sub_08044000(Entity*);
+static void sub_08044078(Entity*);
+static void sub_080440CC(Entity*);
+static void sub_08043CD4(Entity*);
+static void sub_08042894(Entity*);
+static void sub_080428AC(Entity*);
+static void sub_080428FC(Entity*);
+static void sub_08042944(Entity*);
+static void sub_08042970(Entity*);
+static void sub_080429D4(Entity*);
+static void sub_080429FC(Entity*);
+static void sub_08043BF0(Entity*);
+static void sub_08042A6C(Entity*);
+static void sub_08042A88(Entity*);
+static void sub_08042AEC(Entity*);
+static void sub_08042B20(Entity*);
+static void sub_08043C40(Entity*, VaatiArm_HeapStruct1*);
+static void sub_08043A78(Entity*);
+static void sub_08042C34(Entity*);
+static void sub_08042D24(Entity*);
+static void sub_08042D6C(Entity*);
+static void sub_08042E30(Entity*);
+static void sub_08042EF4(Entity*);
+static void sub_08042FD8(Entity*);
+static void sub_08043048(Entity*);
+static void sub_080430D0(Entity*);
+static void sub_08043130(Entity*);
+static void sub_080431E8(Entity*);
+static void sub_08043B9C(Entity*);
+static void sub_08043DB0(Entity*);
+static void sub_08043B7C(Entity*);
+static void sub_08043D08(Entity*);
+static void sub_080432A8(Entity*);
+static void sub_0804334C(Entity*);
+static void sub_08043440(Entity*);
+static void sub_08043490(Entity*);
+static void sub_08043520(Entity*);
+static void sub_0804355C(Entity*);
+static void sub_08043580(Entity*);
+static void sub_080435F4(Entity*);
+static void sub_08043698(Entity*);
+static void sub_080436C0(Entity*);
+static void sub_08043700(Entity*);
+static void sub_08043738(Entity*);
+static void sub_08043770(Entity*);
+
void sub_0804AA1C(Entity*);
-void sub_08043DB0(Entity*);
-void sub_08043B7C(Entity*);
-void sub_08043D08(Entity*);
-void sub_080432A8(Entity*);
-void sub_0804334C(Entity*);
-void sub_08043440(Entity*);
-void sub_08043490(Entity*);
-void sub_08043520(Entity*);
-void sub_0804355C(Entity*);
-void sub_08043580(Entity*);
-void sub_080435F4(Entity*);
-void sub_08043698(Entity*);
-void sub_080436C0(Entity*);
-void sub_08043700(Entity*);
-void sub_08043738(Entity*);
-void sub_08043770(Entity*);
void (*const VaatiArm_Functions[])(Entity*) = {
VaatiArm_OnTick, VaatiArm_OnCollision, GenericKnockback, GenericDeath, GenericConfused, VaatiArm_OnGrabbed,
@@ -175,22 +176,22 @@ void VaatiArm(Entity* this) {
VaatiArm_Functions[GetNextFunction(this)](this);
}
-void VaatiArm_OnTick(Entity* this) {
+static void VaatiArm_OnTick(Entity* this) {
gUnk_080D1248[this->type](this);
}
-void VaatiArm_OnCollision(Entity* this) {
+static void VaatiArm_OnCollision(Entity* this) {
EnemyFunctionHandlerAfterCollision(this, VaatiArm_Functions);
}
-void VaatiArm_OnGrabbed(Entity* this) {
+static void VaatiArm_OnGrabbed(Entity* this) {
}
-void sub_0804259C(Entity* this) {
+static void sub_0804259C(Entity* this) {
gUnk_080D125C[this->action](this);
}
-void sub_080425B4(Entity* this) {
+static void sub_080425B4(Entity* this) {
if (sub_080437DC(this)) {
this->field_0x7c.BYTES.byte0 = 0;
this->field_0x7c.BYTES.byte1 = 0;
@@ -219,7 +220,7 @@ void sub_080425B4(Entity* this) {
}
}
-void sub_08042654(Entity* this) {
+static void sub_08042654(Entity* this) {
u32 uVar8;
int index;
VaatiArm_HeapStruct1* ptr;
@@ -289,7 +290,7 @@ void sub_08042654(Entity* this) {
sub_08043A10(this);
}
-void sub_08042818(Entity* this) {
+static void sub_08042818(Entity* this) {
VaatiArm_HeapStruct1* ptr;
sub_08043CD4(this);
@@ -307,18 +308,18 @@ void sub_08042818(Entity* this) {
sub_08043A10(this);
}
-void sub_08042870(Entity* this) {
+static void sub_08042870(Entity* this) {
sub_08043CD4(this);
gUnk_080D1290[this->subAction](this);
sub_08043A10(this);
}
-void sub_08042894(Entity* this) {
+static void sub_08042894(Entity* this) {
this->subAction = 1;
((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D12AC[this->type2];
}
-void sub_080428AC(Entity* this) {
+static void sub_080428AC(Entity* this) {
u8 bVar1;
VaatiArm_HeapStruct1* pVVar3;
@@ -340,7 +341,7 @@ void sub_080428AC(Entity* this) {
sub_08043BF0(this);
}
-void sub_080428FC(Entity* this) {
+static void sub_080428FC(Entity* this) {
u32 uVar2;
VaatiArm_HeapStruct1* ptr;
@@ -357,7 +358,7 @@ void sub_080428FC(Entity* this) {
}
}
-void sub_08042944(Entity* this) {
+static void sub_08042944(Entity* this) {
VaatiArm_HeapStruct1* pVVar1;
pVVar1 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0];
@@ -370,7 +371,7 @@ void sub_08042944(Entity* this) {
sub_08043BF0(this);
}
-void sub_08042970(Entity* this) {
+static void sub_08042970(Entity* this) {
u32 uVar2;
VaatiArm_HeapStruct1* pVVar3;
@@ -390,7 +391,7 @@ void sub_08042970(Entity* this) {
sub_08043BF0(this);
}
-void sub_080429D4(Entity* this) {
+static void sub_080429D4(Entity* this) {
s16 sVar2;
VaatiArm_HeapStruct1* pVVar3;
@@ -402,7 +403,7 @@ void sub_080429D4(Entity* this) {
}
}
-void sub_080429FC(Entity* this) {
+static void sub_080429FC(Entity* this) {
VaatiArm_HeapStruct1* pVVar1;
pVVar1 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0];
@@ -415,7 +416,7 @@ void sub_080429FC(Entity* this) {
}
}
-void sub_08042A3C(Entity* this) {
+static void sub_08042A3C(Entity* this) {
Entity* entity;
gUnk_080D12B8[this->subAction](this);
@@ -424,14 +425,14 @@ void sub_08042A3C(Entity* this) {
entity->z.HALF.HI += this->field_0x78.HALF.LO;
}
-void sub_08042A6C(Entity* this) {
+static void sub_08042A6C(Entity* this) {
this->subAction = 1;
this->field_0x78.HALF.LO = 0;
this->field_0x7c.BYTES.byte2 = 1;
((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk0a = 0x200;
}
-void sub_08042A88(Entity* this) {
+static void sub_08042A88(Entity* this) {
VaatiArm_HeapStruct1* pVVar4;
pVVar4 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0];
@@ -452,7 +453,7 @@ void sub_08042A88(Entity* this) {
}
}
-void sub_08042AEC(Entity* this) {
+static void sub_08042AEC(Entity* this) {
if (--this->timer == 0) {
this->subAction = 3;
this->timer = 4;
@@ -462,7 +463,7 @@ void sub_08042AEC(Entity* this) {
}
}
-void sub_08042B20(Entity* this) {
+static void sub_08042B20(Entity* this) {
VaatiArm_HeapStruct1* ptr;
Entity* object;
Entity* entity;
@@ -510,12 +511,12 @@ void sub_08042B20(Entity* this) {
}
}
-void sub_08042C14(Entity* this) {
+static void sub_08042C14(Entity* this) {
gUnk_080D12D0[this->subAction](this);
sub_08043A78(this);
}
-void sub_08042C34(Entity* this) {
+static void sub_08042C34(Entity* this) {
u32 random;
int y;
u32 i;
@@ -572,7 +573,7 @@ void sub_08042C34(Entity* this) {
}
}
-void sub_08042D24(Entity* this) {
+static void sub_08042D24(Entity* this) {
Entity* entity;
if (--this->timer == 0) {
@@ -588,7 +589,7 @@ void sub_08042D24(Entity* this) {
}
}
-void sub_08042D6C(Entity* this) {
+static void sub_08042D6C(Entity* this) {
Entity* object;
Entity* entity;
u32 i;
@@ -622,7 +623,7 @@ void sub_08042D6C(Entity* this) {
}
}
-void sub_08042E30(Entity* this) {
+static void sub_08042E30(Entity* this) {
short sVar3;
u32 uVar6;
VaatiArm_HeapStruct1* pVVar9;
@@ -660,7 +661,7 @@ void sub_08042E30(Entity* this) {
UpdateAnimationSingleFrame(this);
}
-void sub_08042EF4(Entity* this) {
+static void sub_08042EF4(Entity* this) {
VaatiArm_HeapStruct1* ptr;
Entity* entity;
u32 temp;
@@ -700,7 +701,7 @@ void sub_08042EF4(Entity* this) {
}
}
-void sub_08042FD8(Entity* this) {
+static void sub_08042FD8(Entity* this) {
Entity* entity;
UpdateAnimationSingleFrame(this);
@@ -727,7 +728,7 @@ void sub_08042FD8(Entity* this) {
}
}
-void sub_08043048(Entity* this) {
+static void sub_08043048(Entity* this) {
VaatiArm_HeapStruct1* ptr;
u32 i;
@@ -754,7 +755,7 @@ void sub_08043048(Entity* this) {
}
}
-void sub_080430D0(Entity* this) {
+static void sub_080430D0(Entity* this) {
VaatiArm_HeapStruct1* ptr;
if (sub_08043C98(this) == 0) {
@@ -775,7 +776,7 @@ void sub_080430D0(Entity* this) {
}
}
-void sub_08043130(Entity* this) {
+static void sub_08043130(Entity* this) {
VaatiArm_HeapStruct1* ptr;
Entity* entity;
u32 i;
@@ -817,7 +818,7 @@ void sub_08043130(Entity* this) {
}
}
-void sub_080431E8(Entity* this) {
+static void sub_080431E8(Entity* this) {
u32 i;
VaatiArm_HeapStruct1* ptr;
@@ -838,7 +839,7 @@ void sub_080431E8(Entity* this) {
}
}
-void sub_0804325C(Entity* this) {
+static void sub_0804325C(Entity* this) {
Entity* entity;
sub_08043CD4(this);
@@ -855,9 +856,9 @@ void sub_0804325C(Entity* this) {
}
}
-ASM_FUNC("asm/non_matching/vaati/sub_080432A8.inc", void sub_080432A8(Entity* this))
+static ASM_FUNC("asm/non_matching/vaati/sub_080432A8.inc", void sub_080432A8(Entity* this))
-NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* this)) {
+ static NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* this)) {
int bVar1;
Entity* entity;
VaatiArm_HeapStruct1* s;
@@ -904,12 +905,12 @@ NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* th
}
END_NONMATCH
-void sub_08043420(Entity* this) {
+static void sub_08043420(Entity* this) {
gUnk_080D1320[this->subAction](this);
sub_08043ABC(this);
}
-void sub_08043440(Entity* this) {
+static void sub_08043440(Entity* this) {
u32 i;
int iVar4;
u8* ptr;
@@ -942,7 +943,7 @@ void sub_08043440(Entity* this) {
}
}
-void sub_08043490(Entity* this) {
+static void sub_08043490(Entity* this) {
Entity* entity;
Entity* entity2;
Entity* entity3;
@@ -970,7 +971,7 @@ void sub_08043490(Entity* this) {
UpdateAnimationSingleFrame(this);
}
-void sub_08043520(Entity* this) {
+static void sub_08043520(Entity* this) {
Entity* entity;
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
@@ -982,7 +983,7 @@ void sub_08043520(Entity* this) {
}
}
-void sub_0804355C(Entity* this) {
+static void sub_0804355C(Entity* this) {
sub_08043DB0(this);
if (--this->field_0x7a.HWORD == 0) {
this->subAction = 4;
@@ -990,7 +991,7 @@ void sub_0804355C(Entity* this) {
UpdateAnimationSingleFrame(this);
}
-void sub_08043580(Entity* this) {
+static void sub_08043580(Entity* this) {
Entity* entity;
u32 i;
@@ -1013,7 +1014,7 @@ void sub_08043580(Entity* this) {
}
}
-void sub_080435F4(Entity* this) {
+static void sub_080435F4(Entity* this) {
Entity* entity;
u32 i;
VaatiArm_HeapStruct1* ptr;
@@ -1038,11 +1039,11 @@ void sub_080435F4(Entity* this) {
}
}
-void sub_08043680(Entity* this) {
+static void sub_08043680(Entity* this) {
gUnk_080D1348[this->subAction](this);
}
-void sub_08043698(Entity* this) {
+static void sub_08043698(Entity* this) {
Entity* entity;
u32 i;
@@ -1067,19 +1068,19 @@ static inline void deleteThing(Entity* this, const u32 index) {
}
}
-void sub_080436C0(Entity* this) {
+static void sub_080436C0(Entity* this) {
deleteThing(this, 1);
}
-void sub_08043700(Entity* this) {
+static void sub_08043700(Entity* this) {
deleteThing(this, 2);
}
-void sub_08043738(Entity* this) {
+static void sub_08043738(Entity* this) {
deleteThing(this, 3);
}
-void sub_08043770(Entity* this) {
+static void sub_08043770(Entity* this) {
Entity* entity;
if (--this->timer == 0) {
@@ -1101,7 +1102,7 @@ void sub_08043770(Entity* this) {
}
}
-u32 sub_080437DC(Entity* this) {
+static u32 sub_080437DC(Entity* this) {
u16 temp;
VaatiArm_HeapStruct* heapStruct;
Entity* entity;
@@ -1159,9 +1160,9 @@ u32 sub_080437DC(Entity* this) {
return 1;
}
-ASM_FUNC("asm/non_matching/vaati/sub_0804393C.inc", void sub_0804393C(Entity* this))
+static ASM_FUNC("asm/non_matching/vaati/sub_0804393C.inc", void sub_0804393C(Entity* this))
-void sub_08043A10(Entity* this) {
+ static void sub_08043A10(Entity* this) {
sub_08043B7C(this);
sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[4]);
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->y.HALF.HI -= 8;
@@ -1177,7 +1178,7 @@ void sub_08043A10(Entity* this) {
}
}
-void sub_08043A78(Entity* this) {
+static void sub_08043A78(Entity* this) {
this->field_0x7c.BYTES.byte0 = 0;
sub_08043B7C(this);
sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]);
@@ -1187,7 +1188,7 @@ void sub_08043A78(Entity* this) {
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteOffsetY--;
}
-void sub_08043ABC(Entity* this) {
+static void sub_08043ABC(Entity* this) {
this->field_0x7c.BYTES.byte0 = 0;
sub_08043B7C(this);
sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]);
@@ -1198,22 +1199,22 @@ void sub_08043ABC(Entity* this) {
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteOffsetY--;
}
-ASM_FUNC("asm/non_matching/vaati/sub_08043B08.inc", void sub_08043B08(Entity* this))
+static ASM_FUNC("asm/non_matching/vaati/sub_08043B08.inc", void sub_08043B08(Entity* this))
-void sub_08043B7C(Entity* this) {
+ static void sub_08043B7C(Entity* this) {
sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[1]);
sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]);
sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]);
}
-void sub_08043B9C(Entity* this) {
+static void sub_08043B9C(Entity* this) {
u32 index = ((((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk00.HALF.HI + 4) & 0xff) >> 3;
if (gUnk_080D13B7[index] != this->frameIndex - 1) {
InitAnimationForceUpdate(this, gUnk_080D13B7[index]);
}
}
-void sub_08043BC8(Entity* this) {
+static void sub_08043BC8(Entity* this) {
VaatiArm_HeapStruct1* pVVar2;
const Coords* ptr;
@@ -1226,7 +1227,7 @@ void sub_08043BC8(Entity* this) {
pVVar2->unk0e = 0x28;
}
-void sub_08043BF0(Entity* this) {
+static void sub_08043BF0(Entity* this) {
u8 bVar1;
u32 uVar2;
VaatiArm_HeapStruct1* ptr;
@@ -1250,7 +1251,7 @@ void sub_08043BF0(Entity* this) {
}
}
-void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) {
+static void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) {
u8* iVar3;
int offset;
const u8* puVar6;
@@ -1281,7 +1282,7 @@ void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) {
}
}
-u32 sub_08043C98(Entity* this) {
+static u32 sub_08043C98(Entity* this) {
#if defined EU || defined JP
Entity* e1 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
if ((e1->contactFlags == 0x9d)) {
@@ -1303,7 +1304,7 @@ u32 sub_08043C98(Entity* this) {
#endif
}
-void sub_08043CD4(Entity* this) {
+static void sub_08043CD4(Entity* this) {
u32 i;
for (i = 0; i < 5; i++) {
if (((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->contactFlags == 0x9d) {
@@ -1314,7 +1315,7 @@ void sub_08043CD4(Entity* this) {
}
}
-void sub_08043D08(Entity* this) {
+static void sub_08043D08(Entity* this) {
Entity* entity;
Entity* fx;
u32 i;
@@ -1341,7 +1342,7 @@ void sub_08043D08(Entity* this) {
EnqueueSFX(SFX_HIT);
}
-void sub_08043DB0(Entity* this) {
+static void sub_08043DB0(Entity* this) {
s32 cVar1;
Entity* pEVar2;
Entity* pEVar3;
@@ -1381,7 +1382,7 @@ void sub_08043DB0(Entity* this) {
}
}
-void sub_08043EB8(Entity* this) {
+static void sub_08043EB8(Entity* this) {
u32 i;
Entity* pEVar4;
VaatiArm_HeapStruct1* ptr;
@@ -1421,7 +1422,8 @@ void sub_08043EB8(Entity* this) {
ptr->unk0c = gUnk_080D1419[i];
}
}
-NONMATCH("asm/non_matching/vaati/sub_08044000.inc", void sub_08044000(Entity* this)) {
+
+static NONMATCH("asm/non_matching/vaati/sub_08044000.inc", void sub_08044000(Entity* this)) {
Entity* entity;
u32 i;
VaatiArm_HeapStruct1* ptr;
@@ -1442,7 +1444,7 @@ NONMATCH("asm/non_matching/vaati/sub_08044000.inc", void sub_08044000(Entity* th
}
END_NONMATCH
-void sub_08044078(Entity* this) {
+static void sub_08044078(Entity* this) {
if (this->action == 0) {
this->action = 1;
if (this->type != 3 ||
@@ -1456,7 +1458,7 @@ void sub_08044078(Entity* this) {
GetNextFrame(this);
}
-void sub_080440CC(Entity* this) {
+static void sub_080440CC(Entity* this) {
if (this->action == 0) {
this->action = 1;
if ((gRoomTransition.field_0x38 & 1) != 0 &&
diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c
index 44c2569b..4b05b5e1 100644
--- a/src/enemy/vaatiWrath.c
+++ b/src/enemy/vaatiWrath.c
@@ -561,7 +561,7 @@ void VaatiWrathType0ActionD(Entity* this) {
void sub_08041BE8(Entity* this) {
Entity* entity;
- if (sub_08079F8C()) {
+ if (PlayerCanBeMoved()) {
this->subAction = 1;
this->timer = 120;
this->updatePriority = PRIO_NO_BLOCK;
diff --git a/src/entity.c b/src/entity.c
index be882d66..f85ccb3f 100644
--- a/src/entity.c
+++ b/src/entity.c
@@ -203,7 +203,7 @@ void UpdateEntities(void) {
UpdatePlayerInput();
UpdatePriority();
ClearHitboxList();
- sub_0806F0A4();
+ CollideFollowers();
f = ram_UpdateEntities;
f(0);
ClearAllDeletedEntities();
diff --git a/src/game.c b/src/game.c
index 6578ea67..6ebd0579 100644
--- a/src/game.c
+++ b/src/game.c
@@ -123,7 +123,7 @@ extern void sub_080186D4(void);
extern void sub_0806F364(void);
extern void sub_08052FF4(u32 area, u32 room);
extern void CloneMapData(void);
-extern void sub_0807C740(void);
+extern void InitializeCamera(void);
extern void SetBGDefaults(void);
extern void LoadItemGfx(void);
@@ -137,7 +137,7 @@ static void UpdateWindcrests(void);
static void UpdateFakeScroll(void);
static void UpdatePlayerMapCoords(void);
static void sub_08052C3C(void);
-static void sub_0805340C(void);
+static void UpdateTimerCallbacks(void);
static void sub_08051D98(void);
static void sub_08051DCC(void);
static bool32 CheckGameOver(void);
@@ -155,7 +155,7 @@ static void sub_080534E4(u32* a1);
static void InitAllRoomResInfo(void);
static void InitRoomResInfo(RoomResInfo* info, RoomHeader* hdr, u32 area, u32 room);
static void sub_080532E4(void);
-static void sub_08053460(void);
+static void ResetTimerFlags(void);
typedef struct {
u8 _0;
@@ -406,7 +406,7 @@ static void GameMain_Update(void) {
if (CheckInitPauseMenu() || CheckInitPortal()) {
return;
}
- sub_0805340C();
+ UpdateTimerCallbacks();
// leave early if player is now entering a portal
if (gMain.substate != GAMEMAIN_UPDATE) {
@@ -499,7 +499,7 @@ static void InitializeEntities(void) {
CallRoomProp6();
InitializePlayer();
gUnk_03004030.unk_00 = NULL;
- sub_0807C740();
+ InitializeCamera();
gUpdateVisibleTiles = 1;
LoadRoomBgm();
SetColor(0, 0);
@@ -648,7 +648,7 @@ void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4) {
sub_08052FF4(a1, a2);
gRoomControls.scroll_x = gRoomControls.origin_x + a3;
gRoomControls.scroll_y = gRoomControls.origin_y + a4;
- sub_0807C740();
+ InitializeCamera();
gUpdateVisibleTiles = 1;
gUsedPalettes = 0;
gScreen.lcd.displayControl |= tmp;
@@ -950,8 +950,8 @@ static void InitializePlayer(void) {
[PL_SPAWN_MINISH] = PLAYER_MINISH,
[PL_SPAWN_DROP] = PLAYER_INIT,
[PL_SPAWN_WALKING] = PLAYER_ROOMTRANSITION,
- [PL_SPAWN_STEP_IN] = PLAYER_080720DC,
- [PL_SPAWN_SPECIAL] = PLAYER_08074C44,
+ [PL_SPAWN_STEP_IN] = PLAYER_ROOM_EXIT,
+ [PL_SPAWN_SLEEPING] = PLAYER_SLEEP,
[PL_SPAWN_DROP_MINISH] = PLAYER_MINISH,
[PL_SPAWN_STAIRS_ASCEND] = PLAYER_USEENTRANCE,
[PL_SPAWN_STAIRS_DESCEND] = PLAYER_USEENTRANCE,
@@ -1503,7 +1503,7 @@ void LoadAuxiliaryRoom(u32 area, u32 room) {
sub_08052FF4(area, room);
gRoomControls.camera_target = NULL;
CloneMapData();
- sub_0807C740();
+ InitializeCamera();
}
void sub_08052FF4(u32 area, u32 room) {
@@ -1637,7 +1637,7 @@ static void sub_0805329C(void) {
sub_080532E4();
break;
default:
- sub_08053460();
+ ResetTimerFlags();
break;
}
}
@@ -1690,7 +1690,7 @@ void sub_080533CC(void) {
gUsedPalettes |= 8;
}
-static void sub_0805340C(void) {
+static void UpdateTimerCallbacks(void) {
static void (*const sHandlers[])(u32*) = {
sub_08053434, DummyHandler, sub_080534E4, DummyHandler, DummyHandler, DummyHandler, DummyHandler, DummyHandler,
};
@@ -1710,13 +1710,13 @@ static void DummyHandler(u32* a1) {
static void sub_08053434(u32* a1) {
if (gArea.locationIndex == 29 && *a1) {
if (!--*a1) {
- sub_08053460();
+ ResetTimerFlags();
MenuFadeIn(5, 6);
}
}
}
-static void sub_08053460(void) {
+static void ResetTimerFlags(void) {
static const u16 sClearFlags[] = { FLAG_BANK_10, LV6_GUFUU1_GISHIKI, FLAG_BANK_10, LV6_GUFUU1_DEMO,
FLAG_BANK_10, LV6_ZELDA_DISCURSE, FLAG_BANK_10, LV6_00_ESCAPE,
FLAG_BANK_10, LV6_GUFUU2_DEAD, FLAG_BANK_G, ENDING,
@@ -1730,7 +1730,7 @@ static void sub_08053460(void) {
ClearFlagArray(sClearFlags);
}
-void sub_08053494(void) {
+void StartDarkNutTimer(void) {
gSave.timers[0] = 10800;
}
@@ -1762,7 +1762,7 @@ static void ResetTmpFlags(void) {
FLAG_BANK_2, SHOP00_ITEM_01, FLAG_BANK_2, SHOP01_CAFE_01,
0xFFFF };
- sub_08053460();
+ ResetTimerFlags();
ClearFlagArray(sClearFlags);
if (!CheckGlobalFlag(WATERBEAN_PUT))
@@ -2084,7 +2084,7 @@ void sub_08053DB4(void) {
if (gFadeControl.active == 0) {
u8* ptr = gMenu.field_0xc;
sub_08052FF4(gMenu.field_0xc[4], gMenu.field_0xc[5]);
- sub_0807C740();
+ InitializeCamera();
gUpdateVisibleTiles = 1;
gRoomControls.scroll_x = (s8)ptr[6] + gRoomControls.scroll_x;
gRoomControls.scroll_y = (s8)ptr[7] + gRoomControls.scroll_y;
@@ -2143,7 +2143,7 @@ void sub_08053F20(void) {
DeleteAllEntities();
ptr = gMenu.field_0xc;
sub_08052FF4(gMenu.field_0xc[8], gMenu.field_0xc[9]);
- sub_0807C740();
+ InitializeCamera();
gUpdateVisibleTiles = 1;
gRoomControls.scroll_x = (s8)ptr[10] + gRoomControls.scroll_x;
gRoomControls.scroll_y = (s8)ptr[0xb] + gRoomControls.scroll_y;
diff --git a/src/interrupts.c b/src/interrupts.c
index 1ea6b512..0477426a 100644
--- a/src/interrupts.c
+++ b/src/interrupts.c
@@ -18,6 +18,8 @@ extern Entity* gPlayerClones[3];
extern u16 gUnk_080B2CD8[];
void ram_IntrMain(void);
+static void sub_080171F0(void);
+static void HandlePlayerLife(Entity* this);
struct {
u8 ready;
@@ -223,7 +225,7 @@ void PlayerUpdate(Entity* this) {
}
// Responsible for some life things like low health beep and initiating the death sequence
-void HandlePlayerLife(Entity* this) {
+static void HandlePlayerLife(Entity* this) {
u32 temp;
gUnk_0200AF00.unk_2f = 0;
@@ -308,7 +310,7 @@ void HandlePlayerLife(Entity* this) {
}
}
-void sub_080171F0(void) {
+static void sub_080171F0(void) {
if (gPlayerState.mobility != 0)
ResetPlayerItem();
if (gPlayerState.field_0x14 != 0)
diff --git a/src/manager/manager22.c b/src/manager/manager22.c
index df516e8d..9f456551 100644
--- a/src/manager/manager22.c
+++ b/src/manager/manager22.c
@@ -27,7 +27,7 @@ void Manager22_Main(Manager22* this) {
s32 sVar1;
u32 uVar3;
- if (gArea.unk_0b == 0) {
+ if (gArea.lightType == 0) {
sub_0801E104();
gScreen.lcd.displayControl &= ~(DISPCNT_BG3_ON | DISPCNT_WIN0_ON);
DeleteThisEntity();
@@ -46,7 +46,7 @@ void Manager22_Main(Manager22* this) {
sub_0805BA78();
sub_0805BAD4();
}
- if (gArea.unk_0b == 2) {
+ if (gArea.lightType == 2) {
gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON;
} else {
if (CheckRectOnScreen(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x,
@@ -56,7 +56,7 @@ void Manager22_Main(Manager22* this) {
gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON;
}
uVar3 = this->manager.unk_0e;
- if (((gPlayerState.flags & PL_USE_LANTERN)) && (gArea.unk_0b)) {
+ if (((gPlayerState.flags & PL_USE_LANTERN)) && (gArea.lightType)) {
if (uVar3 < 0x48) {
uVar3 += 4;
sub_0801E154(uVar3);
@@ -127,13 +127,13 @@ extern u16 gUnk_08108CA8[];
void sub_0805BAD4() {
static const u16 gUnk_08108CA8[] = { 0x10, 0x10f, 0x20e, 0x30d, 0x40c, 0x50b, 0x60a, 0x709, 0x808,
0x907, 0xa06, 0xb05, 0xc04, 0xd03, 0xe02, 0xf01, 0x1000, 0x00 };
- if (gArea.unk_0b) {
+ if (gArea.lightType != 0) {
gScreen.controls.alphaBlend = gUnk_08108CA8[(gArea.lightLevel << 0x10) >> 0x14];
}
}
void sub_0805BB00(s32 lightLevel, s32 param_2) {
- if (gArea.unk_0b == 0) {
+ if (gArea.lightType == 0) {
Manager* pManager = GetEmptyManager();
if (pManager != 0) {
pManager->type = 9;
@@ -146,9 +146,9 @@ void sub_0805BB00(s32 lightLevel, s32 param_2) {
gScreen.controls.layerFXControl = 0x3e48;
gRoomVars.lightLevel = lightLevel;
if (param_2) {
- gArea.unk_0b = 1;
+ gArea.lightType = 1;
} else {
- gArea.unk_0b = 2;
+ gArea.lightType = 2;
}
}
@@ -173,7 +173,7 @@ s32 UpdateLightLevel() {
s32 iVar1;
iVar1 = 0;
- if (gArea.unk_0b && gRoomVars.lightLevel < (s16)gArea.lightLevel) {
+ if (gArea.lightType && gRoomVars.lightLevel < (s16)gArea.lightLevel) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
iVar1 = sub_0805BA78();
if (iVar1) {
@@ -187,7 +187,7 @@ s32 sub_0805BC04(void) {
s32 iVar1;
iVar1 = 0;
- if (gArea.unk_0b && gRoomVars.lightLevel > (short)gArea.lightLevel) {
+ if (gArea.lightType && gRoomVars.lightLevel > (short)gArea.lightLevel) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
iVar1 = sub_0805BA78();
if (iVar1) {
@@ -198,8 +198,8 @@ s32 sub_0805BC04(void) {
}
void sub_0805BC4C() {
- if (gArea.unk_0b != 0) {
- gArea.unk_0b = 0;
+ if (gArea.lightType != 0) {
+ gArea.lightType = 0;
gScreen.lcd.displayControl &= ~(DISPCNT_BG3_ON | DISPCNT_WIN0_ON);
}
}
diff --git a/src/menu/figurine_menu.c b/src/menu/figurine_menu.c
index 22e9decc..1c9f6557 100644
--- a/src/menu/figurine_menu.c
+++ b/src/menu/figurine_menu.c
@@ -10,6 +10,7 @@
#include "object.h"
#include "game.h"
#include "functions.h"
+#include "message.h"
extern const struct {
u8 filler[7];
diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c
index 26749520..7f75c55b 100644
--- a/src/npc/bigGoron.c
+++ b/src/npc/bigGoron.c
@@ -5,14 +5,13 @@
#include "item.h"
extern void (*gUnk_081140D4[])(Entity*);
-
extern u16 gUnk_081140CC[];
+extern u8 gMapDataTopSpecial[];
void sub_0806D520(Entity*, u32);
-
void sub_0806D41C(Entity* this);
-extern u8 gMapDataTopSpecial[];
+static void sub_0806D02C(Entity* this);
typedef struct {
u8 filler[0x40];
@@ -96,7 +95,7 @@ Entity* sub_0806D00C(Entity* this) {
return entity;
}
-void sub_0806D02C(Entity* this) {
+static void sub_0806D02C(Entity* this) {
s32 tmp1;
s32 tmp2;
sub_0806D164(this);
diff --git a/src/npc/cat.c b/src/npc/cat.c
index d7be469c..b93d13e1 100644
--- a/src/npc/cat.c
+++ b/src/npc/cat.c
@@ -4,6 +4,7 @@
#include "save.h"
#include "message.h"
#include "npc.h"
+#include "enemy.h"
extern void sub_08067C44(Entity*);
diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c
index 0227e6ba..567e8328 100644
--- a/src/npc/forestMinish.c
+++ b/src/npc/forestMinish.c
@@ -12,6 +12,8 @@ extern Dialog gUnk_08109DC8[];
extern u16 gUnk_0810A35A[];
extern u16 gUnk_0810A362[];
+static void sub_080600F0(Entity* this);
+
void ForestMinish(Entity* this) {
switch (this->action) {
case 0:
@@ -66,7 +68,7 @@ void ForestMinish_Head(Entity* this) {
sub_0807000C(this);
}
-void sub_080600F0(Entity* this) {
+static void sub_080600F0(Entity* this) {
u32 uVar1;
u32 uVar2;
diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c
index 1c2bfd5e..a68d2b72 100644
--- a/src/npc/mayorHagen.c
+++ b/src/npc/mayorHagen.c
@@ -3,7 +3,6 @@
#include "player.h"
#include "flags.h"
#include "npc.h"
-#include "functions.h"
#include "item.h"
extern u32 gUnk_08113F44;
diff --git a/src/npc/melari.c b/src/npc/melari.c
index c6b29640..9bc4b8a4 100644
--- a/src/npc/melari.c
+++ b/src/npc/melari.c
@@ -1,5 +1,4 @@
#include "npc.h"
-#include "functions.h"
#include "item.h"
extern void sub_08068780(Entity*);
diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c
index 8eaccbcf..130c58c9 100644
--- a/src/npc/minishEzlo.c
+++ b/src/npc/minishEzlo.c
@@ -1,6 +1,6 @@
#include "entity.h"
-#include "functions.h"
#include "sound.h"
+#include "script.h"
extern SpriteLoadData gUnk_0810C48C;
diff --git a/src/npc/npc23.c b/src/npc/npc23.c
index ee98b803..c0b01efb 100644
--- a/src/npc/npc23.c
+++ b/src/npc/npc23.c
@@ -63,7 +63,7 @@ void nullsub_110(void) {
void sub_080663D4(Entity* this) {
if (this->x.HALF.HI == this->field_0x7c.HALF_U.HI - 8) {
- if (gPlayerEntity.action != PLAYER_080720DC) {
+ if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
this->action = 4;
this->direction = 0;
this->speed = 0;
@@ -94,7 +94,7 @@ void sub_0806643C(Entity* this) {
}
void sub_08066474(void) {
- if (gPlayerEntity.action != PLAYER_080720DC) {
+ if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
gPauseMenuOptions.disabled = 0;
}
}
diff --git a/src/npc/npc5.c b/src/npc/npc5.c
index 27459f66..163f8c88 100644
--- a/src/npc/npc5.c
+++ b/src/npc/npc5.c
@@ -2,6 +2,7 @@
#include "message.h"
#include "npc.h"
#include "hitbox.h"
+#include "collision.h"
typedef struct {
u8 unk_0; // u8
diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c
index 8643cf95..44be7575 100644
--- a/src/npc/phonograph.c
+++ b/src/npc/phonograph.c
@@ -5,6 +5,7 @@
#include "screen.h"
#include "common.h"
#include "flags.h"
+#include "message.h"
#ifdef EU
void sub_0806EABC(Entity* this);
diff --git a/src/npc/pita.c b/src/npc/pita.c
index 397128de..c4272f5c 100644
--- a/src/npc/pita.c
+++ b/src/npc/pita.c
@@ -1,4 +1,3 @@
-#include "functions.h"
#include "npc.h"
#include "item.h"
@@ -7,7 +6,6 @@ extern Hitbox gUnk_0810C428;
extern u8 gUnk_0810C430[4];
extern u8 gUnk_0810C435[];
extern u8 gUnk_0810C43D[];
-extern u32 GetRandomByWeight(const u8*);
void Pita(Entity* this) {
if (this->action == 0) {
@@ -25,7 +23,7 @@ void Pita(Entity* this) {
}
/** Reset the players baked goods? */
-void sub_08062EB8(void) {
+void RemoveAllBakedGoods(void) {
SetInventoryValue(ITEM_BRIOCHE, 0);
SetInventoryValue(ITEM_CROISSANT, 0);
SetInventoryValue(ITEM_PIE, 0);
diff --git a/src/npcUtils.c b/src/npcUtils.c
index 813f8772..c6cf4c74 100644
--- a/src/npcUtils.c
+++ b/src/npcUtils.c
@@ -274,7 +274,7 @@ s32 sub_0806F078(Entity* ent, s32 a2) {
return 0;
}
-void sub_0806F0A4(void) {
+void CollideFollowers(void) {
LinkedList* entityList = gEntityLists + 7;
Entity* currentEntity;
u32 val;
diff --git a/src/object/bigPushableLever.c b/src/object/bigPushableLever.c
index 23aa475f..b36a0c00 100644
--- a/src/object/bigPushableLever.c
+++ b/src/object/bigPushableLever.c
@@ -57,7 +57,7 @@ void BigPushableLever_Idle(BigPushableLeverEntity* this) {
SetTile(this->tileIndexLower, this->tilePositionLower, super->collisionLayer);
EnqueueSFX(SFX_132);
RequestPriorityDuration(super, 0x1e);
- if (sub_08079F8C()) {
+ if (PlayerCanBeMoved()) {
gPlayerState.pushedObject = 0x98;
gPlayerState.queued_action = 5;
gPlayerState.flags |= PL_BUSY;
diff --git a/src/object/bird.c b/src/object/bird.c
index 78798b49..44af688e 100644
--- a/src/object/bird.c
+++ b/src/object/bird.c
@@ -4,6 +4,7 @@
#include "item.h"
#include "message.h"
#include "game.h"
+#include "collision.h"
extern u16 script_EzloTalkOcarina[];
@@ -211,10 +212,11 @@ void Bird_Type8(Entity* this) {
this->speed = 0x300;
}
- if ((gPlayerEntity.flags & 0x80) != 0 && (gMessage.doTextBox & 0x7f) == 0 && gPlayerEntity.action != 28 &&
- gPlayerEntity.action != 6 && gPlayerEntity.action != 9 && gPlayerState.framestate != 24 &&
- gPlayerState.framestate != 11 && gPlayerState.framestate != 8 && sub_08079F8C() &&
- (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) {
+ if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 &&
+ gPlayerEntity.action != PLAYER_SLEEP && gPlayerEntity.action != PLAYER_BOUNCE &&
+ gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB &&
+ gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE &&
+ PlayerCanBeMoved() && (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) {
s32 z = gPlayerEntity.z.HALF.HI - this->z.HALF.HI - 8;
if ((u16)z < 0x20 && gPlayerEntity.health != 0) {
pEVar5 = CreateObject(0x95, 10, 0);
diff --git a/src/object/board.c b/src/object/board.c
index 7c3607c3..18e7ff97 100644
--- a/src/object/board.c
+++ b/src/object/board.c
@@ -58,7 +58,7 @@ void sub_08098BE0(BoardEntity* this) {
}
void sub_08098BE8(BoardEntity* this) {
- if ((gPlayerState.flags & PL_MINISH) && sub_08098C30(this, &gPlayerEntity) && sub_08079F8C() &&
+ if ((gPlayerState.flags & PL_MINISH) && sub_08098C30(this, &gPlayerEntity) && PlayerCanBeMoved() &&
gPlayerEntity.z.HALF.HI == 0) {
gPlayerState.field_0x14 = 1;
sub_0807AAF8(&gPlayerEntity, this->tile);
diff --git a/src/object/book.c b/src/object/book.c
index 05af98ed..01f3a15e 100644
--- a/src/object/book.c
+++ b/src/object/book.c
@@ -3,6 +3,7 @@
#include "message.h"
#include "item.h"
#include "npc.h"
+#include "collision.h"
extern void (*const BookActionFuncs[])(Entity*);
extern s8 const gUnk_08123D94[];
diff --git a/src/object/button.c b/src/object/button.c
index 20a34d21..c16a1334 100644
--- a/src/object/button.c
+++ b/src/object/button.c
@@ -165,7 +165,7 @@ Entity* sub_08081D74(Entity* this) {
u32 sub_08081E0C(Entity* this) {
Entity* tmp = &gPlayerEntity;
- if (tmp->z.HALF.HI != 0 || !sub_08079F8C()) {
+ if (tmp->z.HALF.HI != 0 || !PlayerCanBeMoved()) {
return 0;
} else {
return EntityInRectRadius(this, tmp, 5, 6);
diff --git a/src/object/fairy.c b/src/object/fairy.c
index 76fdb2df..988d56e7 100644
--- a/src/object/fairy.c
+++ b/src/object/fairy.c
@@ -11,6 +11,7 @@
#include "functions.h"
#include "item.h"
#include "hitbox.h"
+#include "collision.h"
typedef struct {
/*0x00*/ Entity base;
diff --git a/src/object/fan.c b/src/object/fan.c
index 51815c83..b9a98d01 100644
--- a/src/object/fan.c
+++ b/src/object/fan.c
@@ -6,6 +6,7 @@
#include "functions.h"
#include "sound.h"
#include "object.h"
+#include "collision.h"
typedef struct {
Entity base;
@@ -113,7 +114,7 @@ void sub_0809EE44(FanEntity* this) {
if (uVar4 != 0) {
pEVar1 = &gPlayerEntity;
if (sub_0809EF78(this, pEVar1)) {
- if (sub_08079F8C()) {
+ if (PlayerCanBeMoved()) {
sub_08079E58(super->speed, super->direction);
}
}
diff --git a/src/object/floatingPlatform.c b/src/object/floatingPlatform.c
index 74ab1231..f762a719 100644
--- a/src/object/floatingPlatform.c
+++ b/src/object/floatingPlatform.c
@@ -29,7 +29,7 @@ void sub_080860D8(FloatingPlatformEntity* this) {
super->frameIndex = super->type;
super->spritePriority.b0 = 7;
super->child = (Entity*)GetCurrentRoomProperty(super->type2);
- sub_080A2CC0(super, (u16**)&super->child, &this->unk70);
+ UpdateRailMovement(super, (u16**)&super->child, &this->unk70);
}
void sub_0808611C(FloatingPlatformEntity* this) {
@@ -41,15 +41,15 @@ void sub_0808611C(FloatingPlatformEntity* this) {
super->parent->timer++;
}
- sub_080A2BE4(super, iVar2);
+ SyncPlayerToPlatform(super, iVar2);
} else if (super->timer == 0) {
- sub_080A2BE4(super, iVar2);
+ SyncPlayerToPlatform(super, iVar2);
} else {
- sub_080A2BE4(super, FALSE);
+ SyncPlayerToPlatform(super, FALSE);
}
if (--this->unk70 == 0) {
- sub_080A2CC0(super, (u16**)&super->child, &this->unk70);
+ UpdateRailMovement(super, (u16**)&super->child, &this->unk70);
}
}
@@ -58,7 +58,7 @@ bool32 sub_08086168(FloatingPlatformEntity* this) {
const u8* ptr;
ptr = gUnk_08120658 + super->type * 2;
- if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && sub_08079F8C())) {
+ if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && PlayerCanBeMoved())) {
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI == 0) {
return TRUE;
diff --git a/src/object/fourElements.c b/src/object/fourElements.c
index 8fd25f49..fb26c54b 100644
--- a/src/object/fourElements.c
+++ b/src/object/fourElements.c
@@ -12,6 +12,7 @@
#include "hitbox.h"
#include "screen.h"
#include "message.h"
+#include "collision.h"
typedef struct {
/*0x00*/ Entity base;
diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c
index b0f0920b..047c9a40 100644
--- a/src/object/gyorgBossObject.c
+++ b/src/object/gyorgBossObject.c
@@ -225,7 +225,7 @@ void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this) {
}
this->unk_6c = 0;
gRoomTransition.field_0x39 = 0;
- if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) {
+ if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
super->action = 9;
super->timer = 0;
super->subtimer = 0xF0;
@@ -479,7 +479,7 @@ u32 sub_080A20B8(GyorgBossObjectEntity* this, GyorgMaleEntity* other) {
if (other == NULL) {
return 1;
}
- if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) {
+ if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
return other->unk_7c == 0 && gPlayerState.field_0x14 != 0;
}
return 0;
diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c
index 89f7cc8e..b195e6f6 100644
--- a/src/object/heartContainer.c
+++ b/src/object/heartContainer.c
@@ -3,6 +3,7 @@
#include "flags.h"
#include "functions.h"
#include "item.h"
+#include "collision.h"
static void sub_0808E6A0(Entity*);
static void sub_0808E6E4(Entity*);
diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c
index b356c38a..f9806ec8 100644
--- a/src/object/itemOnGround.c
+++ b/src/object/itemOnGround.c
@@ -8,6 +8,7 @@
#include "itemMetaData.h"
#include "functions.h"
#include "hitbox.h"
+#include "collision.h"
void sub_08081150(Entity*);
u8 sub_0808147C(u32);
diff --git a/src/object/lavaPlatform.c b/src/object/lavaPlatform.c
index 830ba02e..4459128b 100644
--- a/src/object/lavaPlatform.c
+++ b/src/object/lavaPlatform.c
@@ -18,11 +18,11 @@ typedef struct {
/*0x72*/ u16 wobbleTime; /**< Time the player can stand on the platform. */
/*0x74*/ u16 respawnTime; /**< Time until the platform respawns after it has sunk. */
/*0x76*/ u16 unk_76;
- /*0x78*/ Entity* unk_78; // Typed same as second argument of sub_080A2CC0
+ /*0x78*/ Entity* unk_78; // Typed same as second argument of UpdateRailMovement
} LavaPlatformEntity;
typedef struct {
- /*0x00*/ Entity* unk_78; // Typed same as second argument of sub_080A2CC0
+ /*0x00*/ Entity* unk_78; // Typed same as second argument of UpdateRailMovement
/*0x04*/ s16 x;
/*0x06*/ s16 y;
/*0x08*/ u8 collisionLayer;
@@ -246,7 +246,7 @@ void LavaPlatform_SpawnPlatforms(LavaPlatformEntity* this) {
platform->respawnTime = entry->respawnTime;
platform->unk_78 = entry->unk_78;
UpdateSpriteForCollisionLayer((Entity*)platform);
- sub_080A2CC0(&platform->base, (u16**)&platform->unk_78, &platform->unk_76);
+ UpdateRailMovement(&platform->base, (u16**)&platform->unk_78, &platform->unk_76);
}
entry++;
}
@@ -282,7 +282,7 @@ void sub_0809264C(LavaPlatformEntity* this) {
bool32 LavaPlatform_IsPlayerOnPlatform(LavaPlatformEntity* this) {
if ((gPlayerState.flags & PL_MINISH) == 0 && EntityInRectRadius(super, &gPlayerEntity, 0x10, 0x10) &&
- sub_08079F8C()) {
+ PlayerCanBeMoved()) {
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI == 0) {
super->subtimer = 1;
@@ -294,12 +294,12 @@ bool32 LavaPlatform_IsPlayerOnPlatform(LavaPlatformEntity* this) {
}
void sub_080926E4(LavaPlatformEntity* this) {
- sub_080A2BE4(super, super->subtimer);
+ SyncPlayerToPlatform(super, super->subtimer);
if (super->action == 1) {
(super->parent)->x.HALF.HI = super->x.HALF.HI;
(super->parent)->y.HALF.HI = super->y.HALF.HI;
}
if (--this->unk_76 == 0) {
- sub_080A2CC0(super, (u16**)&this->unk_78, &this->unk_76);
+ UpdateRailMovement(super, (u16**)&this->unk_78, &this->unk_76);
}
}
diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c
index dcf5ca1e..a3680f93 100644
--- a/src/object/lightableSwitch.c
+++ b/src/object/lightableSwitch.c
@@ -6,11 +6,16 @@
#include "flags.h"
#include "functions.h"
#include "hitbox.h"
+#include "object.h"
extern void (*const gUnk_081243B4[])(Entity*);
extern void (*const gUnk_081243BC[])(Entity*);
extern void (*const gUnk_081243C4[])(Entity*);
+static void sub_0809EB30(Entity* this);
+static void sub_0809EAD8(Entity* this);
+static void sub_0809EABC(Entity* this);
+
void LightableSwitch(Entity* this) {
gUnk_081243B4[this->type](this);
sub_0809EB30(this);
@@ -47,7 +52,7 @@ void sub_0809EA80(Entity* this) {
sub_0809EABC(this);
}
-void sub_0809EABC(Entity* this) {
+static void sub_0809EABC(Entity* this) {
bool32 anySet = 0;
if (CheckFlags(this->field_0x86.HWORD)) {
@@ -58,21 +63,21 @@ void sub_0809EABC(Entity* this) {
}
}
-void sub_0809EAD8(Entity* this) {
+static void sub_0809EAD8(Entity* this) {
u8 bVar1;
Entity* pEVar2;
if (this->type2 != 0) {
this->child = GetCurrentRoomProperty(this->type2);
- sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
+ UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
} else {
SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer);
}
}
-void sub_0809EB30(Entity* this) {
+static void sub_0809EB30(Entity* this) {
u16 uVar1;
u16* puVar2;
@@ -82,7 +87,7 @@ void sub_0809EB30(Entity* this) {
}
puVar2 = &this->field_0x74.HWORD;
if (!--*puVar2) {
- sub_080A2CC0(this, (u16**)&this->child, puVar2);
+ UpdateRailMovement(this, (u16**)&this->child, puVar2);
}
}
}
diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c
index 3f72f3e3..6cbd40e4 100644
--- a/src/object/lilypadSmall.c
+++ b/src/object/lilypadSmall.c
@@ -4,7 +4,7 @@
extern u16 gUnk_08123318[];
static void sub_08097B24(Entity* this);
-static bool32 sub_08097ADC(Entity* this);
+static bool32 CheckMovePlayer(Entity* this);
void LilypadSmall(Entity* this) {
u32 rand;
@@ -19,22 +19,22 @@ void LilypadSmall(Entity* this) {
this->spriteSettings.draw = TRUE;
this->spritePriority.b0 = 7;
this->child = GetCurrentRoomProperty(this->type2);
- sub_080A2CC0(this, (u16**)&this->child, &this->field_0x70.HALF.LO);
+ UpdateRailMovement(this, (u16**)&this->child, &this->field_0x70.HALF.LO);
}
- sub_080A2BE4(this, sub_08097ADC(this));
+ SyncPlayerToPlatform(this, CheckMovePlayer(this));
sub_08097B24(this);
psVar4 = (u16*)&this->field_0x70;
if (--*psVar4 == 0) {
- sub_080A2CC0(this, (u16**)&this->child, psVar4);
+ UpdateRailMovement(this, (u16**)&this->child, psVar4);
}
}
-static bool32 sub_08097ADC(Entity* this) {
+static bool32 CheckMovePlayer(Entity* this) {
if (!(gPlayerState.flags & PL_MINISH)) {
return FALSE;
} else if (EntityInRectRadius(this, &gPlayerEntity, 8, 8) == 0) {
return FALSE;
- } else if (!sub_08079F8C()) {
+ } else if (!PlayerCanBeMoved()) {
return FALSE;
} else {
gPlayerState.field_0x14 = 1;
diff --git a/src/object/macroShoes.c b/src/object/macroShoes.c
index 36cc84e5..1de5ee00 100644
--- a/src/object/macroShoes.c
+++ b/src/object/macroShoes.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "asm.h"
-void sub_0800445C(Entity*);
void MacroShoes_Init(Entity*);
void MacroShoes_Idle(Entity*);
diff --git a/src/object/object30.c b/src/object/object30.c
index 4f6f1d33..5dc2cff7 100644
--- a/src/object/object30.c
+++ b/src/object/object30.c
@@ -10,6 +10,7 @@
#include "object.h"
#include "functions.h"
#include "item.h"
+#include "collision.h"
typedef struct {
/*0x00*/ Entity base;
diff --git a/src/object/object96.c b/src/object/object96.c
index fde07cb0..ab630662 100644
--- a/src/object/object96.c
+++ b/src/object/object96.c
@@ -7,6 +7,7 @@
#include "item.h"
#include "flags.h"
#include "effects.h"
+#include "collision.h"
typedef struct _struct_gUnk_08123FB0 {
void (*const funcEnt)(Entity*);
diff --git a/src/object/object98.c b/src/object/object98.c
index d39d7ea2..96626eeb 100644
--- a/src/object/object98.c
+++ b/src/object/object98.c
@@ -3,6 +3,7 @@
#include "projectile.h"
#include "room.h"
#include "functions.h"
+#include "object.h"
typedef struct {
Entity base;
@@ -48,7 +49,7 @@ void sub_0809E360(Object98Entity* this) {
SetDefaultPriority(super, 0);
if (super->type != 0) {
super->child = (Entity*)GetCurrentRoomProperty(super->type);
- sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
+ UpdateRailMovement(super, (u16**)&super->child, &this->unk74);
}
}
}
@@ -62,7 +63,7 @@ void sub_0809E3E4(Object98Entity* this) {
}
if (--this->unk74 == 0) {
- sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
+ UpdateRailMovement(super, (u16**)&super->child, &this->unk74);
}
}
}
diff --git a/src/object/objectA8.c b/src/object/objectA8.c
index 4f2c0c13..83f9d422 100644
--- a/src/object/objectA8.c
+++ b/src/object/objectA8.c
@@ -11,6 +11,7 @@
#include "functions.h"
#include "item.h"
#include "hitbox.h"
+#include "collision.h"
typedef struct {
/*0x00*/ Entity base;
diff --git a/src/object/objectB2.c b/src/object/objectB2.c
index a791b9fb..dae02bf1 100644
--- a/src/object/objectB2.c
+++ b/src/object/objectB2.c
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
+#include "collision.h"
extern u8 gUnk_02027EB4[];
extern u8 gUnk_0200D654[];
diff --git a/src/object/pressurePlate.c b/src/object/pressurePlate.c
index 4536eeda..bcbe72d1 100644
--- a/src/object/pressurePlate.c
+++ b/src/object/pressurePlate.c
@@ -2,6 +2,7 @@
#include "object.h"
#include "functions.h"
#include "hitbox.h"
+#include "collision.h"
typedef struct {
Entity base;
diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c
index 8142a0f9..bdd17fa9 100644
--- a/src/object/pushableLever.c
+++ b/src/object/pushableLever.c
@@ -56,7 +56,7 @@ void PushableLever_Idle(PushableLeverEntity* this) {
SetTile(this->tileIndex, this->tilePosition, super->collisionLayer);
EnqueueSFX(SFX_16A);
RequestPriorityDuration(super, 0x1e);
- if (sub_08079F8C()) {
+ if (PlayerCanBeMoved()) {
gPlayerState.pushedObject = 0x90;
gPlayerState.queued_action = 5;
gPlayerState.flags |= PL_BUSY;
diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c
index 696f469e..6756d82f 100644
--- a/src/object/treeHidingPortal.c
+++ b/src/object/treeHidingPortal.c
@@ -6,6 +6,7 @@
#include "room.h"
#include "functions.h"
#include "effects.h"
+#include "object.h"
extern const s16 gUnk_080B4468[];
@@ -14,6 +15,10 @@ void sub_0809E86C(Entity* this);
void sub_0809E8BC(Entity* this);
void sub_0809E8EC(Entity* this);
+static void sub_0809E96C(Entity* this);
+static u32 sub_0809E9A0(void);
+static void sub_0809E918(Entity* this);
+
void TreeHidingPortal(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0809E83C,
@@ -69,7 +74,7 @@ void sub_0809E8EC(Entity* this) {
}
}
-void sub_0809E918(Entity* this) {
+static void sub_0809E918(Entity* this) {
static const s16 gUnk_08124364[] = {
0, -4, 8, -4, 16, -4, 22, -4, -8, -4, -16, -4, -22, -4, 0, -12, 0, 4, 8, -12,
8, 4, -8, -12, -8, 4, 8, -16, -8, -16, 12, -16, -12, -16, 16, -14, -16, -14, -1000, 0,
@@ -88,11 +93,11 @@ void sub_0809E918(Entity* this) {
}
}
-void sub_0809E96C(Entity* this) {
+static void sub_0809E96C(Entity* this) {
CreateMinishEntrance(COORD_TO_TILE_OFFSET(this, 0x20, 0x8));
}
-u32 sub_0809E9A0(void) {
+static u32 sub_0809E9A0(void) {
u32 rv;
const s16* ptr;
diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c
index 84949f45..c558ce37 100644
--- a/src/object/warpPoint.c
+++ b/src/object/warpPoint.c
@@ -205,7 +205,7 @@ void sub_0808B73C(Entity* this) {
u32 sub_0808B7C8(Entity* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.framestate != PL_STATE_DIE && gPlayerEntity.health != 0 &&
- sub_08079F8C() && EntityInRectRadius(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) {
+ PlayerCanBeMoved() && EntityInRectRadius(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) {
if (this->timer == 0 && gPlayerEntity.action == PLAYER_08072C9C) {
ResetPlayerAnimationAndAction();
}
diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c
index c76a6190..5e4cb50e 100644
--- a/src/object/windTribeTeleporter.c
+++ b/src/object/windTribeTeleporter.c
@@ -10,6 +10,7 @@
#include "object.h"
#include "functions.h"
#include "hitbox.h"
+#include "collision.h"
typedef struct {
/*0x00*/ Entity base;
diff --git a/src/objectUtils.c b/src/objectUtils.c
index 2640c180..42ef2df5 100644
--- a/src/objectUtils.c
+++ b/src/objectUtils.c
@@ -261,7 +261,7 @@ void CreateSparkle(Entity* entity) {
}
}
-NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void sub_080A2BE4(Entity* this, bool32 param_2)) {
+NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void SyncPlayerToPlatform(Entity* this, bool32 param_2)) {
s16 oldValue;
s32 diff;
u16 newValue;
@@ -307,7 +307,7 @@ NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void sub_080A2BE4(Enti
}
END_NONMATCH
-void sub_080A2CC0(Entity* this, u16** param_2, u16* param_3) {
+void UpdateRailMovement(Entity* this, u16** param_2, u16* param_3) {
u16* ptr = *param_2;
if (ptr != NULL) {
if (*ptr == 0xfe) {
diff --git a/src/player.c b/src/player.c
index 835d7ec3..18dbb005 100644
--- a/src/player.c
+++ b/src/player.c
@@ -63,7 +63,7 @@ static EntityAction sub_08071DB8;
static EntityAction PlayerEmptyBottle;
static EntityAction PlayerFrozen;
static EntityAction sub_0807204C;
-static EntityAction sub_080720DC;
+static EntityAction PlayerRoomExit;
static EntityAction PlayerPull;
static EntityAction PlayerLava;
EntityAction PlayerWarp; // why is this defined in playerUtils.c? We may never know : (
@@ -76,7 +76,7 @@ static EntityAction PlayerRoll;
static EntityAction PlayerWaitForScroll;
static EntityAction PlayerInHole;
static EntityAction sub_08072C9C;
-static EntityAction sub_08074C44;
+static EntityAction PlayerSleep;
static EntityAction PlayerClimb;
static EntityAction PlayerUseEntrance;
static EntityAction PlayerParachute;
@@ -152,7 +152,7 @@ static EntityAction PlayerFrozenUpdate;
static EntityAction sub_08072064;
static EntityAction sub_08072098;
-// PLAYER_080720DC
+// PLAYER_ROOM_EXIT
static EntityAction sub_08072100;
static EntityAction sub_08072168;
@@ -229,7 +229,7 @@ static EntityAction sub_08074018;
static EntityAction sub_08074060;
static EntityAction sub_080740D8;
-// PLAYER_08074C44
+// PLAYER_SLEEP
static EntityAction sub_08074C68;
static EntityAction sub_08074CF8;
static EntityAction sub_08074F00;
@@ -317,7 +317,7 @@ void DoPlayerAction(Entity* this) {
[PLAYER_EMPTYBOTTLE] = PlayerEmptyBottle,
[PLAYER_FROZEN] = PlayerFrozen,
[PLAYER_0807204C] = sub_0807204C,
- [PLAYER_080720DC] = sub_080720DC,
+ [PLAYER_ROOM_EXIT] = PlayerRoomExit,
[PLAYER_PULL] = PlayerPull,
[PLAYER_LAVA] = PlayerLava,
[PLAYER_WARP] = PlayerWarp,
@@ -330,7 +330,7 @@ void DoPlayerAction(Entity* this) {
[PLAYER_080728AC] = PlayerWaitForScroll,
[PLAYER_INHOLE] = PlayerInHole,
[PLAYER_08072C9C] = sub_08072C9C,
- [PLAYER_08074C44] = sub_08074C44,
+ [PLAYER_SLEEP] = PlayerSleep,
[PLAYER_CLIMB] = PlayerClimb,
[PLAYER_USEENTRANCE] = PlayerUseEntrance,
[PLAYER_PARACHUTE] = PlayerParachute,
@@ -1773,7 +1773,7 @@ static void sub_08072098(Entity* this) {
SetPlayerActionNormal();
}
-static void sub_080720DC(Entity* this) {
+static void PlayerRoomExit(Entity* this) {
static EntityAction* const gUnk_0811BB60[] = {
sub_08072100,
sub_08072168,
@@ -3787,7 +3787,7 @@ static void conveyer_push(Entity* this) {
LinearMoveUpdate(this);
}
-static void sub_08074C44(Entity* this) {
+static void PlayerSleep(Entity* this) {
static EntityAction* const gUnk_0811BC88[] = {
sub_08074C68,
sub_08074CF8,
@@ -4068,7 +4068,7 @@ void sub_080751E8(u32 a1, u32 a2, void* script) {
MemClear(&gPlayerScriptExecutionContext, sizeof(ScriptExecutionContext));
gPlayerScriptExecutionContext.scriptInstructionPointer = script;
((fixme*)&gPlayerEntity)->ctx = &gPlayerScriptExecutionContext;
- gPlayerState.queued_action = PLAYER_08074C44;
+ gPlayerState.queued_action = PLAYER_SLEEP;
gPlayerState.field_0x38 = 1;
gPlayerState.field_0x39 = 0;
gPlayerState.field_0x3a = a2;
diff --git a/src/playerItem/playerItemGustBig.c b/src/playerItem/playerItemGustBig.c
index 8430cbcf..ede960db 100644
--- a/src/playerItem/playerItemGustBig.c
+++ b/src/playerItem/playerItemGustBig.c
@@ -3,6 +3,7 @@
#include "player.h"
#include "functions.h"
#include "sound.h"
+#include "asm.h"
extern void sub_08078CD0(Entity*);
extern void sub_08018FA0(Entity*);
diff --git a/src/playerUtils.c b/src/playerUtils.c
index 00c8902d..c8179c97 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -15,6 +15,8 @@
#include "item.h"
#include "message.h"
+static void sub_08077E54(ItemBehavior* beh);
+
extern void sub_080752E8(ItemBehavior* behavior, u32 arg1); // item.c
extern void sub_0800857C(Entity*);
extern void SetDefaultPriorityForKind(Entity*);
@@ -498,7 +500,7 @@ void sub_08077E3C(ItemBehavior* ent, u32 idx) {
sub_08077E54(ent);
}
-void sub_08077E54(ItemBehavior* beh) {
+static void sub_08077E54(ItemBehavior* beh) {
beh->field_0x5[7] = gPlayerEntity.animIndex;
beh->field_0x12[0] = gPlayerEntity.frameIndex;
beh->field_0x5[8] = gPlayerEntity.frameDuration;
@@ -861,7 +863,7 @@ void CreateEzloHint(u32 hintId, u32 hintHeight) {
}
void sub_08078AC0(u32 param_1, u32 param_2, u32 param_3) {
- gPlayerState.queued_action = PLAYER_080720DC;
+ gPlayerState.queued_action = PLAYER_ROOM_EXIT;
gPlayerState.field_0x38 = param_1;
gPlayerState.field_0x39 = param_2 != 0;
gPlayerState.field_0x3a = param_3 != 0;
@@ -1272,11 +1274,12 @@ bool32 sub_08079F48(u32 param_1, u32 param_2) {
return TRUE;
}
-bool32 sub_08079F8C(void) {
+bool32 PlayerCanBeMoved(void) {
if ((gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS |
PL_PIT_IS_EXIT | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING)) != 0 ||
- gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == 3 || gPlayerEntity.action == 0xb) {
+ gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == PLAYER_FALL ||
+ gPlayerEntity.action == PLAYER_08071DB8) {
return FALSE;
} else {
return TRUE;
@@ -1309,7 +1312,7 @@ void DeleteClones(void) {
gPlayerClones[2] = NULL;
gPlayerState.flags &= ~PL_CLONING;
if (((gPlayerEntity.action != 0x17) || (gPlayerState.chargeState.action != 4)) &&
- ((u8)(gPlayerState.chargeState.action - 4) < 2)) {
+ (gPlayerState.chargeState.action == 4 || gPlayerState.chargeState.action == 5)) {
gPlayerState.chargeState.action = 1;
}
}
@@ -2010,7 +2013,7 @@ ASM_FUNC("asm/non_matching/playerUtils/sub_0807C5F4.inc", void sub_0807C5F4())
ASM_FUNC("asm/non_matching/playerUtils/sub_0807C69C.inc", void sub_0807C69C())
-ASM_FUNC("asm/non_matching/playerUtils/sub_0807C740.inc", void sub_0807C740())
+ASM_FUNC("asm/non_matching/playerUtils/sub_0807C740.inc", void InitializeCamera())
void sub_0807C810(void) {
struct_03004030* ptr;
diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c
index 588ad284..f4ca7fbf 100644
--- a/src/projectile/dekuSeedProjectile.c
+++ b/src/projectile/dekuSeedProjectile.c
@@ -1,6 +1,7 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
+#include "collision.h"
extern void (*const DekuSeedProjectile_Functions[])(Entity*);
extern void (*const DekuSeedProjectile_Actions[])(Entity*);
diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c
index 9fc3a49f..37027b06 100644
--- a/src/projectile/guardLineOfSight.c
+++ b/src/projectile/guardLineOfSight.c
@@ -4,6 +4,7 @@
#include "functions.h"
#include "projectile.h"
#include "hitbox.h"
+#include "collision.h"
extern u32 sub_080644C8(Entity*);
extern u8 gUnk_02027EB4[];
diff --git a/src/room.c b/src/room.c
index 339c238d..92c4057a 100644
--- a/src/room.c
+++ b/src/room.c
@@ -7,7 +7,7 @@
#include "object.h"
#include "game.h"
-extern void sub_0804B058(EntityData* dat);
+static void sub_0804B058(EntityData* dat);
extern void sub_0801AC98(void);
extern u32 sub_08049D1C(u32);
extern Entity* LoadRoomEntity(EntityData*);
@@ -179,7 +179,7 @@ void LoadRoom(void) {
sub_0801AC98();
}
-void sub_0804B058(EntityData* dat) {
+static void sub_0804B058(EntityData* dat) {
Entity* ent;
u32 uVar2;
diff --git a/src/roomInit.c b/src/roomInit.c
index 709cbcff..7f2b8d4e 100644
--- a/src/roomInit.c
+++ b/src/roomInit.c
@@ -35,6 +35,8 @@ void sub_080AF250();
void sub_0804C290();
void sub_0804C258();
+static void sub_0804C128(void);
+
extern void** gCurrentRoomProperties;
u32 sub_unk3_ArmosInteriors_RuinsEntranceNorth(u32 arg0) {
@@ -667,7 +669,7 @@ void sub_StateChange_HyruleCastle_3(void) {
u32 sub_unk3_HyruleCastle_4(void) {
if (!CheckLocalFlag(CASTLE_04_MEZAME)) {
- gRoomTransition.player_status.spawn_type = PL_SPAWN_SPECIAL;
+ gRoomTransition.player_status.spawn_type = PL_SPAWN_SLEEPING;
ClearGlobalFlag(ZELDA_CHASE);
}
return 1;
@@ -1074,7 +1076,7 @@ extern u8 gUnk_080D9338[];
extern u8 gUnk_080D9340[];
extern TileEntity gUnk_080D9328[];
-void sub_0804C128() {
+static void sub_0804C128(void) {
sub_080AF250(0);
if (gRoomVars.field_0x0 != 0) {
if ((gArea.unk_0c_1) == 0) {
@@ -5472,7 +5474,7 @@ void sub_StateChange_HouseInteriors3_Bakery(void) {
u32 sub_unk3_HouseInteriors3_Simon(void) {
if (CheckGlobalFlag(MAROYA_WAKEUP)) {
- gRoomTransition.player_status.spawn_type = PL_SPAWN_SPECIAL;
+ gRoomTransition.player_status.spawn_type = PL_SPAWN_SLEEPING;
}
return 1;
}
diff --git a/src/script.c b/src/script.c
index 64692f23..46ffb747 100644
--- a/src/script.c
+++ b/src/script.c
@@ -218,7 +218,7 @@ void StartPlayerScript(u16* script) {
gPlayerScriptExecutionContext.scriptInstructionPointer = script;
player = &gPlayerEntity;
*(ScriptExecutionContext**)&player->cutsceneBeh = &gPlayerScriptExecutionContext;
- gPlayerState.queued_action = PLAYER_08074C44;
+ gPlayerState.queued_action = PLAYER_SLEEP;
gPlayerState.field_0x3a = 0;
gPlayerState.field_0x39 = 0;
gPlayerState.field_0x38 = 0;
diff --git a/src/staffroll.c b/src/staffroll.c
index d2813369..529f7b51 100644
--- a/src/staffroll.c
+++ b/src/staffroll.c
@@ -97,8 +97,7 @@ void StaffrollTask_State1(void) {
}
void StaffrollTask_State1MenuType0(void) {
- gMenu.transitionTimer -= 1;
- if (gMenu.transitionTimer == 0) {
+ if (--gMenu.transitionTimer == 0) {
sub_080A3954();
}
}
diff --git a/src/text.c b/src/text.c
index 10b504f8..a56d23ea 100644
--- a/src/text.c
+++ b/src/text.c
@@ -41,6 +41,9 @@ u32 sub_0805EF8C(Token*);
u32 sub_0805EFB4(Token*);
u32 sub_0805F9A0(u32);
+static u32 sub_0805F8F8(u32 idx);
+static u32 sub_0805F7A0(u32 param_1);
+
typedef struct {
u16 unk0;
s8 unk2;
@@ -606,7 +609,7 @@ u32 sub_0805F76C(u8* param_1, WStruct* param_2) {
return uVar1;
}
-u32 sub_0805F7A0(u32 param_1) {
+static u32 sub_0805F7A0(u32 param_1) {
u32 uVar1;
u32 uVar2;
u32 uVar3;
@@ -707,7 +710,7 @@ void sub_0805F8E4(u32 r0, WStruct* r1) {
r1->unk1 = old;
}
-u32 sub_0805F8F8(u32 idx) {
+static u32 sub_0805F8F8(u32 idx) {
u8* temp = &gUnk_0810942E[idx].filler0[10][10];
return gUnk_0810926C[*temp];
}