summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2021-12-28 13:56:21 -0800
committerGitHub <noreply@github.com>2021-12-28 13:56:21 -0800
commit4d04c1c920dc6ab02de60a2774ed4cc5feb3d7b3 (patch)
treeb6226159f870a5974379851e986261eb8d1ce5fc /src
parent9456e38606b3ebfe388bd810a4187a5c06c97947 (diff)
parent3fd900f1bc81cbaf106de17f5b8d41e26de682a8 (diff)
Merge pull request #227 from notyourav/cl
cleanup
Diffstat (limited to 'src')
-rw-r--r--src/code_0805436C.c22
-rw-r--r--src/code_0805F9A0.c1
-rw-r--r--src/code_08077B98.c1
-rw-r--r--src/code_0808091C.c5
-rw-r--r--src/code_080A29BC.c59
-rw-r--r--src/collision.c3
-rw-r--r--src/coord.c6
-rw-r--r--src/debugScreen.c5
-rw-r--r--src/demoScreen.c2
-rw-r--r--src/enemy.c1
-rw-r--r--src/enemy/acroBandits.c5
-rw-r--r--src/enemy/beetle.c2
-rw-r--r--src/enemy/bladeTrap.c5
-rw-r--r--src/enemy/bobomb.c2
-rw-r--r--src/enemy/bombPeahat.c3
-rw-r--r--src/enemy/businessScrub.c8
-rw-r--r--src/enemy/chaser.c1
-rw-r--r--src/enemy/chuchu.c2
-rw-r--r--src/enemy/chuchuBoss.c2
-rw-r--r--src/enemy/code_080300AC.c (renamed from src/code_080300AC.c)0
-rw-r--r--src/enemy/doorMimic.c4
-rw-r--r--src/enemy/enemyE.c1
-rw-r--r--src/enemy/fallingBoulder.c2
-rw-r--r--src/enemy/fireballGuy.c2
-rw-r--r--src/enemy/gyorgMale.c1
-rw-r--r--src/enemy/hangingSeed.c1
-rw-r--r--src/enemy/lakituCloud.c2
-rw-r--r--src/enemy/likeLike.c2
-rw-r--r--src/enemy/madderpillar.c1
-rw-r--r--src/enemy/mazaalBracelet.c31
-rw-r--r--src/enemy/mazaalHand.c1
-rw-r--r--src/enemy/mazaalHead.c10
-rw-r--r--src/enemy/moldorm.c1
-rw-r--r--src/enemy/moldworm.c1
-rw-r--r--src/enemy/octorokBoss.c17
-rw-r--r--src/enemy/peahat.c2
-rw-r--r--src/enemy/pesto.c3
-rw-r--r--src/enemy/ropeGolden.c3
-rw-r--r--src/enemy/rupeeLike.c6
-rw-r--r--src/enemy/sensorBladeTrap.c2
-rw-r--r--src/enemy/slime.c2
-rw-r--r--src/enemy/smallPesto.c2
-rw-r--r--src/enemy/spark.c2
-rw-r--r--src/enemy/treeItem.c2
-rw-r--r--src/enemy/vaatiArm.c3
-rw-r--r--src/enemy/vaatiBall.c32
-rw-r--r--src/enemy/vaatiEyesMacro.c2
-rw-r--r--src/enemy/vaatiProjectile.c5
-rw-r--r--src/enemy/vaatiRebornEnemy.c1
-rw-r--r--src/enemy/vaatiTransfigured.c3
-rw-r--r--src/enemy/vaatiTransfiguredEye.c3
-rw-r--r--src/enemy/vaatiWrath.c13
-rw-r--r--src/enemy/vaatiWrathEye.c3
-rw-r--r--src/enemy/wallMaster2.c6
-rw-r--r--src/enemy/waterDrop.c3
-rw-r--r--src/entity.c23
-rw-r--r--src/ezloNag.c5
-rw-r--r--src/fade.c1
-rw-r--r--src/fileScreen.c3
-rw-r--r--src/flagDebug.c2
-rw-r--r--src/flags.c4
-rw-r--r--src/game.c (renamed from src/overworld.c)20
-rw-r--r--src/gba/m4a.c1
-rw-r--r--src/interrupts.c16
-rw-r--r--src/intro.c6
-rw-r--r--src/item/itemBomb.c2
-rw-r--r--src/item/itemBoomerang.c2
-rw-r--r--src/item/itemJarEmpty.c1
-rw-r--r--src/item/itemLantern.c2
-rw-r--r--src/item/itemMoleMitts.c6
-rw-r--r--src/item/itemOcarina.c4
-rw-r--r--src/item/itemPegasusBoots.c2
-rw-r--r--src/item/itemRocsCape.c4
-rw-r--r--src/item/itemSword.c4
-rw-r--r--src/main.c6
-rw-r--r--src/manager/manager10.c5
-rw-r--r--src/manager/manager11.c1
-rw-r--r--src/manager/manager12.c3
-rw-r--r--src/manager/manager14.c2
-rw-r--r--src/manager/manager15.c2
-rw-r--r--src/manager/manager19.c1
-rw-r--r--src/manager/manager1A.c1
-rw-r--r--src/manager/manager1E.c2
-rw-r--r--src/manager/manager2.c2
-rw-r--r--src/manager/manager20.c2
-rw-r--r--src/manager/manager21.c3
-rw-r--r--src/manager/manager23.c2
-rw-r--r--src/manager/manager24.c6
-rw-r--r--src/manager/manager25.c1
-rw-r--r--src/manager/manager26.c2
-rw-r--r--src/manager/manager27.c2
-rw-r--r--src/manager/manager28.c2
-rw-r--r--src/manager/manager2A.c2
-rw-r--r--src/manager/manager2B.c5
-rw-r--r--src/manager/manager2C.c1
-rw-r--r--src/manager/manager2D.c1
-rw-r--r--src/manager/manager2E.c2
-rw-r--r--src/manager/manager3.c3
-rw-r--r--src/manager/manager30.c3
-rw-r--r--src/manager/manager31.c1
-rw-r--r--src/manager/manager32.c3
-rw-r--r--src/manager/manager33.c2
-rw-r--r--src/manager/manager34.c2
-rw-r--r--src/manager/manager35.c6
-rw-r--r--src/manager/manager36.c3
-rw-r--r--src/manager/manager37.c4
-rw-r--r--src/manager/manager39.c5
-rw-r--r--src/manager/manager4.c1
-rw-r--r--src/manager/manager5.c2
-rw-r--r--src/manager/manager6.c1
-rw-r--r--src/manager/manager7.c4
-rw-r--r--src/manager/manager8.c2
-rw-r--r--src/manager/managerA.c3
-rw-r--r--src/manager/managerB.c7
-rw-r--r--src/manager/managerC.c2
-rw-r--r--src/manager/managerE.c3
-rw-r--r--src/manager/managerF.c7
-rw-r--r--src/message.c (renamed from src/textbox.c)7
-rw-r--r--src/npc/anju.c2
-rw-r--r--src/npc/beedle.c5
-rw-r--r--src/npc/bigGoron.c1
-rw-r--r--src/npc/bladeBrothers.c9
-rw-r--r--src/npc/brocco.c3
-rw-r--r--src/npc/carlov.c4
-rw-r--r--src/npc/carpenter.c4
-rw-r--r--src/npc/castleMaid.c3
-rw-r--r--src/npc/castorWildsStatue.c2
-rw-r--r--src/npc/cat.c12
-rw-r--r--src/npc/cow.c4
-rw-r--r--src/npc/cucco.c2
-rw-r--r--src/npc/cuccoChick.c2
-rw-r--r--src/npc/dampe.c4
-rw-r--r--src/npc/din.c3
-rw-r--r--src/npc/dog.c3
-rw-r--r--src/npc/drLeft.c1
-rw-r--r--src/npc/emma.c1
-rw-r--r--src/npc/epona.c7
-rw-r--r--src/npc/ezlo.c1
-rw-r--r--src/npc/farore.c5
-rw-r--r--src/npc/festari.c7
-rw-r--r--src/npc/forestMinish.c2
-rw-r--r--src/npc/gentari.c3
-rw-r--r--src/npc/ghostBrothers.c5
-rw-r--r--src/npc/gina.c3
-rw-r--r--src/npc/goron.c3
-rw-r--r--src/npc/goronMerchant.c5
-rw-r--r--src/npc/gregal.c2
-rw-r--r--src/npc/guard.c7
-rw-r--r--src/npc/hurdyGurdyMan.c2
-rw-r--r--src/npc/kid.c7
-rw-r--r--src/npc/kingDaltus.c2
-rw-r--r--src/npc/kingGustaf.c1
-rw-r--r--src/npc/librari.c4
-rw-r--r--src/npc/librarians.c4
-rw-r--r--src/npc/mailbox.c3
-rw-r--r--src/npc/malon.c1
-rw-r--r--src/npc/mama.c1
-rw-r--r--src/npc/marcy.c3
-rw-r--r--src/npc/mayorHagen.c4
-rw-r--r--src/npc/milkCart.c2
-rw-r--r--src/npc/minishEzlo.c3
-rw-r--r--src/npc/ministerPotho.c4
-rw-r--r--src/npc/moblinLady.c2
-rw-r--r--src/npc/mountainMinish.c4
-rw-r--r--src/npc/mutoh.c6
-rw-r--r--src/npc/nayru.c5
-rw-r--r--src/npc/npc23.c4
-rw-r--r--src/npc/npc26.c2
-rw-r--r--src/npc/npc4E.c5
-rw-r--r--src/npc/npc5.c13
-rw-r--r--src/npc/npc58.c1
-rw-r--r--src/npc/npc9.c3
-rw-r--r--src/npc/percy.c9
-rw-r--r--src/npc/picolyteBottle.c2
-rw-r--r--src/npc/pina.c3
-rw-r--r--src/npc/pita.c1
-rw-r--r--src/npc/postman.c14
-rw-r--r--src/npc/simon.c2
-rw-r--r--src/npc/smith.c4
-rw-r--r--src/npc/stamp.c3
-rw-r--r--src/npc/stockwell.c2
-rw-r--r--src/npc/sturgeon.c3
-rw-r--r--src/npc/talon.c2
-rw-r--r--src/npc/teachers.c1
-rw-r--r--src/npc/tingleSiblings.c2
-rw-r--r--src/npc/townMinish.c6
-rw-r--r--src/npc/townsperson.c1
-rw-r--r--src/npc/vaati.c3
-rw-r--r--src/npc/vaatiReborn.c4
-rw-r--r--src/npc/wheaton.c1
-rw-r--r--src/npc/windTribespeople.c10
-rw-r--r--src/npc/zelda.c5
-rw-r--r--src/npc/zeldaFollower.c1
-rw-r--r--src/npcDefinitions.c10
-rw-r--r--src/npcUtils.c5
-rw-r--r--src/object.c2
-rw-r--r--src/object/archway.c3
-rw-r--r--src/object/backgroundCloud.c3
-rw-r--r--src/object/bigVortex.c1
-rw-r--r--src/object/bird.c2
-rw-r--r--src/object/book.c5
-rw-r--r--src/object/button.c1
-rw-r--r--src/object/cloud.c6
-rw-r--r--src/object/fileScreenObjects.c4
-rw-r--r--src/object/fireplace.c3
-rw-r--r--src/object/greatFairy.c9
-rw-r--r--src/object/heartContainer.c3
-rw-r--r--src/object/hiddenLadderDown.c2
-rw-r--r--src/object/houseDoorExterior.c2
-rw-r--r--src/object/itemOnGround.c39
-rw-r--r--src/object/jailBars.c2
-rw-r--r--src/object/lightableSwitch.c5
-rw-r--r--src/object/lockedDoor.c10
-rw-r--r--src/object/mask.c1
-rw-r--r--src/object/metalDoor.c7
-rw-r--r--src/object/minecart.c4
-rw-r--r--src/object/minishLight.c1
-rw-r--r--src/object/minishSizedArchway.c3
-rw-r--r--src/object/minishSizedEntrance.c2
-rw-r--r--src/object/object1D.c1
-rw-r--r--src/object/object2A.c2
-rw-r--r--src/object/object49.c1
-rw-r--r--src/object/object6A.c4
-rw-r--r--src/object/object86.c2
-rw-r--r--src/object/objectA.c2
-rw-r--r--src/object/objectA2.c2
-rw-r--r--src/object/objectA8.c1
-rw-r--r--src/object/objectB2.c2
-rw-r--r--src/object/octorokBossObject.c4
-rw-r--r--src/object/pinwheel.c2
-rw-r--r--src/object/pot.c7
-rw-r--r--src/object/railtrack.c3
-rw-r--r--src/object/smoke.c2
-rw-r--r--src/object/swordsmanNewsletter.c2
-rw-r--r--src/object/thoughtBubble.c2
-rw-r--r--src/object/treeHidingPortal.c3
-rw-r--r--src/object/warpPoint.c8
-rw-r--r--src/object/well.c1
-rw-r--r--src/object/windcrest.c3
-rw-r--r--src/objectUtils.c1
-rw-r--r--src/player.c385
-rw-r--r--src/playerItem/playerItem11.c2
-rw-r--r--src/playerItem/playerItem12.c4
-rw-r--r--src/playerItem/playerItem14.c8
-rw-r--r--src/playerItem/playerItem15.c4
-rw-r--r--src/playerItem/playerItem3.c4
-rw-r--r--src/playerItem/playerItemBow.c2
-rw-r--r--src/playerItem/playerItemPacciCane.c2
-rw-r--r--src/playerItem/playerItemSwordBeam.c6
-rw-r--r--src/playerItemUtils.c6
-rw-r--r--src/projectile.c2
-rw-r--r--src/projectile/arrowProjectile.c3
-rw-r--r--src/projectile/ballAndChain.c1
-rw-r--r--src/projectile/boneProjectile.c4
-rw-r--r--src/projectile/cannonballProjectile.c2
-rw-r--r--src/projectile/dekuSeedProjectile.c2
-rw-r--r--src/projectile/dirtBallProjectile.c3
-rw-r--r--src/projectile/fireProjectile.c1
-rw-r--r--src/projectile/gleerokProjectile.c7
-rw-r--r--src/projectile/guardLineOfSight.c2
-rw-r--r--src/projectile/guruguruBarProjectile.c1
-rw-r--r--src/projectile/gyorgMaleEnergyProjectile.c1
-rw-r--r--src/projectile/gyorgTail.c2
-rw-r--r--src/projectile/iceProjectile.c1
-rw-r--r--src/projectile/lakituCloudProjectile.c2
-rw-r--r--src/projectile/lakituLightning.c1
-rw-r--r--src/projectile/mandiblesProjectile.c6
-rw-r--r--src/projectile/mazaalEnergyBeam.c2
-rw-r--r--src/projectile/octorokBossProjectile.c3
-rw-r--r--src/projectile/removableDust.c2
-rw-r--r--src/projectile/rockProjectile.c2
-rw-r--r--src/projectile/spiderWeb.c2
-rw-r--r--src/projectile/stalfosProjectile.c1
-rw-r--r--src/projectile/torchTrapProjectile.c2
-rw-r--r--src/projectile/v1DarkMagicProjectile.c4
-rw-r--r--src/projectile/v1FireProjectile.c4
-rw-r--r--src/projectile/v2Projectile.c5
-rw-r--r--src/projectile/v3ElectricProjectile.c2
-rw-r--r--src/projectile/v3HandProjectile.c1
-rw-r--r--src/projectile/v3TennisBallProjectile.c3
-rw-r--r--src/projectile/windProjectile.c1
-rw-r--r--src/room.c8
-rw-r--r--src/roomInit.c10
-rw-r--r--src/save.c4
-rw-r--r--src/script.c16
-rw-r--r--src/scroll.c (renamed from src/code_0807CC3C.c)6
-rw-r--r--src/sound.c (renamed from src/audio.c)8
-rw-r--r--src/sub_0807CA18.c2
-rw-r--r--src/sub_080A3B84.c1
289 files changed, 558 insertions, 1010 deletions
diff --git a/src/code_0805436C.c b/src/code_0805436C.c
index 62853444..d0df011a 100644
--- a/src/code_0805436C.c
+++ b/src/code_0805436C.c
@@ -4,17 +4,15 @@
#include "menu.h"
#include "area.h"
#include "utils.h"
-#include "structures.h"
#include "save.h"
+#include "item.h"
typedef struct {
u8 unk;
u8 filler[7];
} struct_080FD5B4;
-extern SaveFile gSave;
extern struct_080FD5B4 gUnk_080FD5B4[];
-extern ScreenTransition gScreenTransition;
extern u8 gUnk_0200AF13;
extern u8 gUnk_0200AF14;
@@ -96,16 +94,16 @@ u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
return bottleIndex;
}
-u32 ItemIsSword(u32 arg0) {
- switch (arg0) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 6:
- return 1;
+u32 ItemIsSword(u32 item) {
+ switch (item) {
+ case ITEM_SMITH_SWORD:
+ case ITEM_GREEN_SWORD:
+ case ITEM_RED_SWORD:
+ case ITEM_BLUE_SWORD:
+ case ITEM_FOURSWORD:
+ return TRUE;
default:
- return 0;
+ return FALSE;
}
}
diff --git a/src/code_0805F9A0.c b/src/code_0805F9A0.c
index a921491e..1ba583b5 100644
--- a/src/code_0805F9A0.c
+++ b/src/code_0805F9A0.c
@@ -2,6 +2,7 @@
#include "utils.h"
#include "structures.h"
#include "functions.h"
+#include "asm.h"
extern u16 gUnk_081092D4;
extern u8 gUnk_081094CE;
diff --git a/src/code_08077B98.c b/src/code_08077B98.c
index fddfcace..dc3d5a0a 100644
--- a/src/code_08077B98.c
+++ b/src/code_08077B98.c
@@ -10,7 +10,6 @@ typedef struct {
u8 field_0x1;
} UnkItemStruct;
-Entity* sub_08077C94(ItemBehavior*, u32);
void* sub_08077C54(UnkItemStruct* unk);
Entity* CreatePlayerBomb(ItemBehavior*, u32);
extern Entity* sub_0805E744();
diff --git a/src/code_0808091C.c b/src/code_0808091C.c
index 2b4dceb0..fd82dfa6 100644
--- a/src/code_0808091C.c
+++ b/src/code_0808091C.c
@@ -2,8 +2,7 @@
#include "entity.h"
#include "structures.h"
#include "functions.h"
-#include "overworld.h"
-#include "room.h"
+#include "game.h"
extern void sub_08080BC4(void);
@@ -97,7 +96,7 @@ void sub_080809D4(void) {
int x, y;
int var1, var0;
RoomControls* roomControls = &gRoomControls;
- roomControls->unk6 &= 0xFB;
+ roomControls->scroll_flags &= ~4;
target = roomControls->cameraTarget;
x = target->x.HALF.HI;
diff --git a/src/code_080A29BC.c b/src/code_080A29BC.c
deleted file mode 100644
index 17fb9fba..00000000
--- a/src/code_080A29BC.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "global.h"
-#include "entity.h"
-#include "room.h"
-#include "object.h"
-#include "effects.h"
-
-void sub_080A29C8(s32 xOff, s32 yOff, u32 layer) {
- Entity* pEVar1;
-
- pEVar1 = CreateObject(SPECIAL_FX, 2, 0);
- if (pEVar1 != NULL) {
- pEVar1->x.HALF.HI = gRoomControls.roomOriginX + xOff;
- pEVar1->y.HALF.HI = gRoomControls.roomOriginY + yOff;
- pEVar1->collisionLayer = layer;
- }
-}
-
-void sub_080A29FC(Entity* parent) {
- CreateFx(parent, FX_DASH, 0);
-}
-
-void sub_080A2A08(Entity* parent) {
- CreateFx(parent, FX_6, 0);
-}
-
-void sub_080A2A14(Entity* parent) {
- CreateFx(parent, FX_WATER_SPLASH, 0);
-}
-
-Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
- Entity* pEVar1;
-
- pEVar1 = CreateObjectWithParent(parent, GROUND_ITEM, form, parameter);
- if (pEVar1 != NULL) {
- pEVar1->actionDelay = 5;
- }
- return pEVar1;
-}
-
-Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) {
- Entity* ent;
-
- ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype);
- if (ent != NULL) {
- ent->actionDelay = 5;
- *(u32*)(&ent->field_0x86) = param_4;
- }
- return ent;
-}
-
-Entity* sub_080A2A64(Entity* parent) {
- Entity* pEVar1;
-
- pEVar1 = CreateFx(parent, FX_SPARKLE2, 0);
- if (pEVar1 != NULL) {
- pEVar1->spritePriority.b0 = 7;
- }
- return pEVar1;
-}
diff --git a/src/collision.c b/src/collision.c
index 61df2b48..d39cb4a2 100644
--- a/src/collision.c
+++ b/src/collision.c
@@ -6,8 +6,8 @@
#include "utils.h"
#include "functions.h"
#include "enemy.h"
-#include "effects.h"
#include "object.h"
+#include "game.h"
extern u8 gCollidableCount;
extern u8 gUnk_080B3740[];
@@ -317,7 +317,6 @@ Entity* sub_08017A90(Entity* a1, Entity* parent) {
}
typedef s32 (*CollisionHandler)(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
-s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
diff --git a/src/coord.c b/src/coord.c
index e982aa9d..87108481 100644
--- a/src/coord.c
+++ b/src/coord.c
@@ -1,11 +1,9 @@
#include "asm.h"
#include "area.h"
#include "player.h"
-#include "global.h"
-#include "entity.h"
#include "coord.h"
#include "utils.h"
-#include "audio.h"
+#include "sound.h"
#include "room.h"
#include "functions.h"
@@ -163,7 +161,7 @@ void sub_0806F62C(Entity* ent, u32 a, u32 b) {
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[(u8)b + 64], a), 256) << 8;
}
-void sub_0806F69C(Entity* ent) {
+void LinearMoveUpdate(Entity* ent) {
if ((ent->direction & 0x80) == 0) {
ent->x.WORD += FixedDiv(FixedMul(gSineTable[ent->direction * 8], ent->speed), 256) << 8;
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[ent->direction * 8 + 64], ent->speed), 256) << 8;
diff --git a/src/debugScreen.c b/src/debugScreen.c
index c3ddf710..b3300574 100644
--- a/src/debugScreen.c
+++ b/src/debugScreen.c
@@ -1,12 +1,11 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "utils.h"
#include "functions.h"
#include "main.h"
#include "menu.h"
#include "screen.h"
-#include "structures.h"
-#include "textbox.h"
+#include "message.h"
extern void (*const gUnk_08109A30[])();
diff --git a/src/demoScreen.c b/src/demoScreen.c
index efc3368d..e2d7c911 100644
--- a/src/demoScreen.c
+++ b/src/demoScreen.c
@@ -2,7 +2,7 @@
#include "functions.h"
#include "main.h"
#include "utils.h"
-#include "textbox.h"
+#include "message.h"
#include "fileScreen.h"
#include "screen.h"
diff --git a/src/enemy.c b/src/enemy.c
index af4a68de..e9d4f51d 100644
--- a/src/enemy.c
+++ b/src/enemy.c
@@ -1,4 +1,3 @@
-#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "definitions.h"
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c
index 865791d5..2fe6e41b 100644
--- a/src/enemy/acroBandits.c
+++ b/src/enemy/acroBandits.c
@@ -12,7 +12,6 @@ extern void sub_08032338(Entity*);
extern Entity* sub_08049DF4(u32);
extern Entity* gUnk_020000B0;
-extern u8 gEntCount;
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const gUnk_080CE56C[])(Entity*);
extern void (*const gUnk_080CE584[])(Entity*);
@@ -411,12 +410,12 @@ void sub_08032008(Entity* this) {
this->field_0x76.HALF.HI = 1;
this->direction = GetFacingDirection(this, parent);
sub_080322E8(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
} else {
this->direction = GetFacingDirection(this, parent);
sub_080322E8(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (this->x.HALF.HI == parent->x.HALF.HI && this->y.HALF.HI == parent->y.HALF.HI)
this->field_0x76.HALF.HI = 0;
}
diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c
index de27657c..e286f6f4 100644
--- a/src/enemy/beetle.c
+++ b/src/enemy/beetle.c
@@ -245,7 +245,7 @@ void sub_08021B64(Entity* this) {
InitializeAnimation(this, 5);
} else {
gPlayerState.field_0x1a[0] |= 0x80;
- gPlayerState.field_0x80 -= 0x50;
+ gPlayerState.speed_modifier -= 0x50;
gPlayerState.field_0xaa++;
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
this->x.HALF.HI += gUnk_080CB5E4[(this->field_0xf++ & 0xe) >> 1];
diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c
index 70fd869c..ceea0b5d 100644
--- a/src/enemy/bladeTrap.c
+++ b/src/enemy/bladeTrap.c
@@ -1,5 +1,4 @@
-#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "room.h"
#include "functions.h"
@@ -13,7 +12,7 @@ void BladeTrap(Entity* this) {
sub_080A2CC0(this, &this->child, &this->field_0x74);
}
if (!(this->direction & 0x80)) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
if (!(--this->field_0x74.HWORD)) {
diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c
index 32e72b86..94ba6b9d 100644
--- a/src/enemy/bobomb.c
+++ b/src/enemy/bobomb.c
@@ -1,5 +1,5 @@
#include "asm.h"
-#include "audio.h"
+#include "sound.h"
#include "enemy.h"
#include "object.h"
#include "functions.h"
diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c
index 71e0540d..45800c5c 100644
--- a/src/enemy/bombPeahat.c
+++ b/src/enemy/bombPeahat.c
@@ -1,5 +1,4 @@
#include "asm.h"
-#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "player.h"
@@ -280,7 +279,7 @@ ASM_FUNC("asm/non_matching/eu/sub_0802AC40.inc", void sub_0802AC40(Entity* this)
#else
void sub_0802AC40(Entity* this) {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (this->field_0x7a.HALF.LO) {
if (sub_0802B234(this) == 0) {
this->field_0x7a.HALF.LO = 0;
diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c
index e53d46e5..1bff3860 100644
--- a/src/enemy/businessScrub.c
+++ b/src/enemy/businessScrub.c
@@ -1,15 +1,11 @@
#include "asm.h"
#include "enemy.h"
-#include "audio.h"
-#include "entity.h"
-#include "flags.h"
-#include "textbox.h"
+#include "message.h"
#include "save.h"
#include "npc.h"
#include "functions.h"
-#include "effects.h"
+#include "game.h"
-extern void LoadObjPalette(Entity*, u32);
extern Entity* sub_08049DF4(u32);
extern bool32 sub_08056338(void);
extern void UnloadOBJPalette(Entity*);
diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c
index 869fbfc0..af6f4b86 100644
--- a/src/enemy/chaser.c
+++ b/src/enemy/chaser.c
@@ -1,5 +1,4 @@
#include "enemy.h"
-#include "entity.h"
#include "functions.h"
extern s32 sub_080012DC(Entity*);
diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c
index eb77023e..9f10023a 100644
--- a/src/enemy/chuchu.c
+++ b/src/enemy/chuchu.c
@@ -1,8 +1,6 @@
#include "asm.h"
#include "enemy.h"
-#include "entity.h"
#include "functions.h"
-#include "audio.h"
extern s32 sub_080012DC(Entity*);
extern void sub_08001318(Entity*);
diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c
index 4127be53..29c1611c 100644
--- a/src/enemy/chuchuBoss.c
+++ b/src/enemy/chuchuBoss.c
@@ -1,6 +1,4 @@
#include "enemy.h"
-#include "entity.h"
-#include "functions.h"
void sub_08027870(Entity*);
diff --git a/src/code_080300AC.c b/src/enemy/code_080300AC.c
index 612df34a..612df34a 100644
--- a/src/code_080300AC.c
+++ b/src/enemy/code_080300AC.c
diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c
index ab1531fb..af328474 100644
--- a/src/enemy/doorMimic.c
+++ b/src/enemy/doorMimic.c
@@ -1,8 +1,6 @@
-#include "audio.h"
+#include "sound.h"
#include "enemy.h"
-#include "entity.h"
#include "functions.h"
-#include "effects.h"
extern s16 sub_080001DA(u32, u32); // ?
extern void sub_08049CF4();
diff --git a/src/enemy/enemyE.c b/src/enemy/enemyE.c
index 6835be88..5f712d7d 100644
--- a/src/enemy/enemyE.c
+++ b/src/enemy/enemyE.c
@@ -1,5 +1,4 @@
#include "enemy.h"
-#include "entity.h"
#include "functions.h"
void sub_08023000(Entity*, int);
diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c
index 7e4ddde1..e7edf50f 100644
--- a/src/enemy/fallingBoulder.c
+++ b/src/enemy/fallingBoulder.c
@@ -110,7 +110,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E
if (y >= 5) {
sub_080AEFB4(this);
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (this->z.HALF.HI - y > 0x38) {
sub_0802C62C(this);
this->field_0x7a.HWORD = (Random() & 0x7f) | 0x80;
diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c
index ebeaaf1f..8b2fc55a 100644
--- a/src/enemy/fireballGuy.c
+++ b/src/enemy/fireballGuy.c
@@ -13,8 +13,6 @@ extern void (*const gUnk_080D1800[])(Entity*);
extern u8 gUnk_080D180C[4]; // Entity count per form
extern PosOffset gUnk_080D1810[4];
-extern u8 gEntCount;
-
void FireballGuy(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D17E8);
}
diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c
index 40497928..95aac9ab 100644
--- a/src/enemy/gyorgMale.c
+++ b/src/enemy/gyorgMale.c
@@ -3,7 +3,6 @@
#include "player.h"
#include "fileScreen.h"
#include "functions.h"
-#include "effects.h"
void (*const gUnk_080D1AFC[8])(Entity*);
void (*const gUnk_080D1B1C[7])(Entity*);
diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c
index 2b582b57..d63e3650 100644
--- a/src/enemy/hangingSeed.c
+++ b/src/enemy/hangingSeed.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "effects.h"
extern void (*const gHangingSeedFunctions[])(Entity*);
extern void (*const gUnk_080CB588[])(Entity*);
diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c
index bb9e6b76..ae2f5a7d 100644
--- a/src/enemy/lakituCloud.c
+++ b/src/enemy/lakituCloud.c
@@ -85,7 +85,7 @@ void sub_0803CDA8(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((this->direction & 0x80) == 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
if (--this->field_0x74.HWORD << 0x10 == 0) {
diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c
index edab8bed..f0b08684 100644
--- a/src/enemy/likeLike.c
+++ b/src/enemy/likeLike.c
@@ -1,5 +1,5 @@
#include "enemy.h"
-#include "textbox.h"
+#include "message.h"
#include "save.h"
#include "object.h"
#include "functions.h"
diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c
index 11742547..5750e102 100644
--- a/src/enemy/madderpillar.c
+++ b/src/enemy/madderpillar.c
@@ -1,7 +1,6 @@
#include "enemy.h"
#include "functions.h"
-extern u8 gEntCount;
extern Hitbox gUnk_080FD298;
extern Hitbox gUnk_080FD2A0;
diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c
index 584dd185..8076c212 100644
--- a/src/enemy/mazaalBracelet.c
+++ b/src/enemy/mazaalBracelet.c
@@ -85,7 +85,6 @@ void sub_0803B978(Entity*);
void sub_0803BA6C(Entity*);
void sub_0803BA80(Entity*);
-extern u8 gEntCount;
// these are not with the rest of this files constant data
extern Hitbox gUnk_080FD35C;
extern Hitbox gUnk_080FD364;
@@ -242,7 +241,7 @@ void sub_0803A364(Entity* this) {
break;
case 5:
if (sub_0803B4E4(this) == 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
return;
}
this->type2 = 0;
@@ -325,7 +324,7 @@ void sub_0803A548(Entity* this) {
index = ((this->parent->field_0xf >> 4) + 3);
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
if (sub_0803B4E4(this) == 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
@@ -339,7 +338,7 @@ void sub_0803A58C(Entity* this) {
if (sub_0803B4E4(this) != 0) {
sub_0803B59C(this);
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
@@ -408,7 +407,7 @@ void sub_0803A6E8(Entity* this) {
this->actionDelay = 10;
} else {
sub_0803B63C(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
y = this->parent->y.HALF.HI + 8;
if (y > this->y.HALF.HI) {
this->y.HALF.HI = y;
@@ -468,7 +467,7 @@ void sub_0803A7CC(Entity* this) {
this->action = 0xd;
InitAnimationForceUpdate(this->child, 6);
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
@@ -527,7 +526,7 @@ void sub_0803A90C(Entity* this) {
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
GetNextFrame(this);
sub_0803B55C(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->actionDelay--;
if (this->actionDelay == 0) {
this->action = 0x11;
@@ -550,7 +549,7 @@ void sub_0803A978(Entity* this) {
if ((++this->actionDelay & 3) == 0) {
sub_08004596(this, 0x10);
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (this->direction == 0x10) {
this->action = 0x12;
this->actionDelay = 3;
@@ -574,7 +573,7 @@ void sub_0803AA00(Entity* this) {
if ((++this->actionDelay & 3) == 0) {
sub_08004596(this, direction);
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if ((this->direction == direction) || (this->y.HALF.HI >= gPlayerEntity.y.HALF.HI)) {
this->action = 0x13;
this->spriteSettings.draw = 0;
@@ -594,7 +593,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t
index = ((this->parent->field_0xf >> 4) + 3);
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
if (sub_0803B870(this) == 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (sub_0803B6F4(this) != 0) {
this->action = 0x14;
this->speed = 0x40;
@@ -616,7 +615,7 @@ void sub_0803AB10(Entity* this) {
ptr = gUnk_080CED6C;
index = ((this->parent->field_0xf >> 4) + 3);
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
sub_0803B55C(this);
if ((this->child->frame & 0x80) != 0) {
this->action = 0x15;
@@ -667,7 +666,7 @@ void sub_0803AC1C(Entity* this) {
if (sub_0803B4E4(this)) {
sub_0803B59C(this);
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
@@ -685,7 +684,7 @@ void sub_0803AC60(Entity* this) {
this->subAction = 0;
this->actionDelay = 0x1e;
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
} else {
this->actionDelay = this->actionDelay - 1;
@@ -788,7 +787,7 @@ void sub_0803AE48(Entity* this) {
InitializeAnimation(this, 4);
} else {
if (sub_0803B4E4(this) == 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
}
@@ -1049,7 +1048,7 @@ void sub_0803B398(Entity* this) {
InitializeAnimation(this, 4);
InitAnimationForceUpdate(this->child, 0);
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
@@ -1214,7 +1213,7 @@ void sub_0803B724(Entity* param_1) {
pEVar1->x.HALF.HI = (random_value & 0x70) + temp + gRoomControls.roomOriginX;
pEVar1->y.HALF.HI = ((random_value >> 0x10) & 7) * 10 + 0x5c + gRoomControls.roomOriginY;
pEVar1->parent = param_1;
- sub_08016A30(pEVar1);
+ ResolveCollisionLayer(pEVar1);
param_1->field_0xf++;
param_1->cutsceneBeh.HALF.LO--;
}
diff --git a/src/enemy/mazaalHand.c b/src/enemy/mazaalHand.c
index c429e428..2a64cd24 100644
--- a/src/enemy/mazaalHand.c
+++ b/src/enemy/mazaalHand.c
@@ -1,4 +1,3 @@
-#include "global.h"
#include "entity.h"
void sub_08035194(Entity*);
diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c
index 2b59e960..64f9b1c1 100644
--- a/src/enemy/mazaalHead.c
+++ b/src/enemy/mazaalHead.c
@@ -5,8 +5,6 @@
extern void UnloadOBJPalette(Entity*);
-extern u8 gEntCount;
-
void sub_0803499C(Entity*);
void sub_08034420(Entity*);
void sub_08034830(Entity*);
@@ -220,7 +218,7 @@ void sub_08033FFC(Entity* this) {
gRoomControls.cameraTarget = &gPlayerEntity;
sub_08034420(this);
gPlayerState.controlMode = 1;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
SoundReq(BGM_BOSS_THEME);
}
}
@@ -243,7 +241,7 @@ void sub_0803414C(Entity* this) {
}
} else {
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
@@ -562,7 +560,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803473C.inc", void sub_0803473C(Entity* t
direction = 0x18;
}
this->direction = direction;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
END_NONMATCH
@@ -585,7 +583,7 @@ NONMATCH("asm/non_matching/mazaal/sub_080347B4.inc", void sub_080347B4(Entity* t
direction = 0x18;
}
this->direction = direction;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
END_NONMATCH
diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c
index 767254f9..33a1fa8b 100644
--- a/src/enemy/moldorm.c
+++ b/src/enemy/moldorm.c
@@ -9,7 +9,6 @@ extern void (*const gUnk_080CBBA0[])(Entity*);
extern void (*const gUnk_080CBBB4[])(Entity*);
extern void (*const gUnk_080CBBBC[])(Entity*);
-extern u8 gEntCount;
extern const s8 gUnk_080CBBC4[];
void Moldorm(Entity* this) {
diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c
index 3a0425ef..350fb3fc 100644
--- a/src/enemy/moldworm.c
+++ b/src/enemy/moldworm.c
@@ -14,7 +14,6 @@ void sub_0802390C(Entity*);
void sub_080239F0(Entity*);
bool32 sub_08023B38(Entity*);
-extern u8 gEntCount;
extern const u8 gUnk_080B37A0[];
extern void (*const gUnk_080CBC38[])(Entity*);
diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c
index 0730b642..b6e207d3 100644
--- a/src/enemy/octorokBoss.c
+++ b/src/enemy/octorokBoss.c
@@ -2,8 +2,7 @@
#include "functions.h"
#include "object.h"
#include "projectile.h"
-#include "structures.h"
-#include "overworld.h"
+#include "game.h"
extern void sub_08078AC0(u32, u32, u32);
extern u32 GetRandomByWeight(const u8*);
@@ -36,25 +35,25 @@ this->field_0x7c.BYTES.byte0 Boss Phase
3: frozen 2
4: unfrozen -> death
*/
-#define IS_FROZEN(this) (this->field_0x7c.BYTES.byte0 & 1)
-#define GET_BOSS_PHASE(this) (this->field_0x7c.BYTES.byte0)
+#define IS_FROZEN(this) ((this)->field_0x7c.BYTES.byte0 & 1)
+#define GET_BOSS_PHASE(this) ((this)->field_0x7c.BYTES.byte0)
/*
this->field_0x78.HALF.HI reused timer
*/
-#define GET_TIMER(this) this->field_0x78.HALF.HI
+#define GET_TIMER(this) ((this)->field_0x78.HALF.HI)
/*
this->field_0x78.HALF.LO turns until the next attack
*/
-#define GET_ATTACK_WAIT_TURNS(this) this->field_0x78.HALF.LO
+#define GET_ATTACK_WAIT_TURNS(this) ((this)->field_0x78.HALF.LO)
/*
this->field_0x7a.HALF.HI angle of legs
*/
-#define GET_ANGLE(this) this->field_0x7a.HWORD
-#define GET_ANGLE_HI(this) this->field_0x7a.HALF.HI
+#define GET_ANGLE(this) ((this)->field_0x7a.HWORD)
+#define GET_ANGLE_HI(this) ((this)->field_0x7a.HALF.HI)
/*
this->field_0x82.HWORD angular speed
*/
-#define GET_ANGULAR_VEL(this) this->field_0x82.HWORD
+#define GET_ANGULAR_VEL(this) ((this)->field_0x82.HWORD)
enum OctorokBossPart { WHOLE, LEG_BR, LEG_FR, LEG_FL, LEG_BL, MOUTH, TAIL_END, TAIL };
enum OctorokBossAction {
diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c
index 804ccba6..08ec53a4 100644
--- a/src/enemy/peahat.c
+++ b/src/enemy/peahat.c
@@ -343,7 +343,7 @@ void PeahatPropeller_Fly(Entity* this) {
this->spriteSettings.draw ^= 1;
this->z.WORD -= 0xc000;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (--this->field_0xf == 0) {
this->field_0xf = 40;
this->direction = (Random() & 0x10) + 8;
diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c
index fc987dd7..676ecfcf 100644
--- a/src/enemy/pesto.c
+++ b/src/enemy/pesto.c
@@ -1,6 +1,6 @@
#include "enemy.h"
#include "object.h"
-#include "overworld.h"
+#include "game.h"
#include "functions.h"
#include "save.h"
@@ -9,7 +9,6 @@ extern void SoundReqClipped(Entity*, u32);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
extern u32 PlayerInRange(Entity*, u32, u32);
extern void sub_080AEFB4(Entity*);
-extern Entity* FindNextDuplicateID(Entity* ent, int listIndex);
void sub_080249F4(Entity*);
void sub_08024940(Entity*);
diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c
index 1e63b5df..136d14c3 100644
--- a/src/enemy/ropeGolden.c
+++ b/src/enemy/ropeGolden.c
@@ -1,6 +1,5 @@
#include "global.h"
#include "entity.h"
-#include "sprite.h"
#include "functions.h"
#include "enemy.h"
@@ -9,8 +8,6 @@ extern void (*const gUnk_080CF4C8[6])(Entity*);
extern void (*const gUnk_080CF4E0[4])(Entity*);
extern s32 sub_080012DC(Entity*);
-extern void SetGlobalFlag(u32);
-extern u32 CheckGlobalFlag(u32);
extern u32 sub_0804A044(Entity*, Entity*, u32);
void sub_080383AC(Entity*);
diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c
index ee274ac7..7aacbee9 100644
--- a/src/enemy/rupeeLike.c
+++ b/src/enemy/rupeeLike.c
@@ -1,13 +1,11 @@
#include "global.h"
#include "asm.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "enemy.h"
-#include "npc.h"
-#include "player.h"
-#include "save.h"
#include "object.h"
#include "functions.h"
+#include "save.h"
extern void sub_080293DC(Entity*);
extern void sub_080296D8(Entity*);
diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c
index 40ad4f03..2e99de0e 100644
--- a/src/enemy/sensorBladeTrap.c
+++ b/src/enemy/sensorBladeTrap.c
@@ -1,6 +1,4 @@
#include "enemy.h"
-#include "audio.h"
-#include "functions.h"
extern u32 sub_0804A024(Entity*, u32, u32);
extern bool32 sub_080AE4CC(Entity*, u32, u32, u32);
diff --git a/src/enemy/slime.c b/src/enemy/slime.c
index 86069f50..06297e37 100644
--- a/src/enemy/slime.c
+++ b/src/enemy/slime.c
@@ -16,8 +16,6 @@ extern void (*const gUnk_080D16A4[])(Entity*);
extern u8 gUnk_080D16D0[4]; // Entity count per form
extern PosOffset gUnk_080D16D4[4];
-extern u8 gEntCount;
-
void Slime(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D16A4);
SetChildOffset(this, 0, 1, -12);
diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c
index b8fdc5db..ec6d93ca 100644
--- a/src/enemy/smallPesto.c
+++ b/src/enemy/smallPesto.c
@@ -94,7 +94,7 @@ void sub_08031770(Entity* this) {
void sub_080317B4(Entity* this) {
this->z.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
GetNextFrame(this);
}
diff --git a/src/enemy/spark.c b/src/enemy/spark.c
index cbbdb587..d96bdfaa 100644
--- a/src/enemy/spark.c
+++ b/src/enemy/spark.c
@@ -1,8 +1,6 @@
#include "enemy.h"
-#include "entity.h"
#include "object.h"
#include "functions.h"
-#include "effects.h"
extern void (*const gUnk_080CD234[])(Entity*);
extern void (*const gUnk_080CD24C[])(Entity*);
diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c
index ddc645dd..c1383be0 100644
--- a/src/enemy/treeItem.c
+++ b/src/enemy/treeItem.c
@@ -1,8 +1,6 @@
#include "global.h"
#include "enemy.h"
-#include "entity.h"
#include "object.h"
-#include "functions.h"
static bool32 ShouldSpawnTreeItem(Entity*);
diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c
index 7882441e..27a946f5 100644
--- a/src/enemy/vaatiArm.c
+++ b/src/enemy/vaatiArm.c
@@ -2,8 +2,6 @@
#include "object.h"
#include "functions.h"
-extern void DoExitTransition(ScreenTransitionData*);
-
typedef struct VaatiArm_HeapStruct1 {
union SplitHWord unk00;
u16 unk02;
@@ -165,7 +163,6 @@ const u16 gUnk_080D140E[] = { -0x6000, -0x5000, -0x4000 };
const u8 gUnk_080D1414[] = { 0, 0xc, 0xe, 0x10, 0x1c };
const u8 gUnk_080D1419[] = { 0, 0xa, 0xa, 0xa, 0x1c };
-extern u8 gEntCount;
extern const Hitbox gUnk_080FD450;
extern const Hitbox gUnk_080FD538;
diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c
index c060f5b9..68e5be20 100644
--- a/src/enemy/vaatiBall.c
+++ b/src/enemy/vaatiBall.c
@@ -1,9 +1,7 @@
#include "entity.h"
#include "enemy.h"
#include "player.h"
-#include "screen.h"
#include "object.h"
-#include "audio.h"
#include "functions.h"
typedef struct {
@@ -112,7 +110,7 @@ void sub_0804474C(Entity* this) {
this->direction++;
this->direction &= 0x1f;
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
UpdateAnimationSingleFrame(this);
}
}
@@ -164,7 +162,7 @@ void sub_08044868(Entity* this) {
}
break;
case 1:
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
this->field_0x74.HALF.LO++;
this->x.HALF.HI = vaati->x.HALF.HI;
@@ -200,7 +198,7 @@ void sub_08044868(Entity* this) {
case 2:
if (this->actionDelay)
if (--this->actionDelay < 0x11)
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
break;
case 3: {
u8 draw;
@@ -229,7 +227,7 @@ void sub_080449F8(Entity* this) {
switch (vaati->field_0x74.HALF.LO) {
case 0:
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (--this->actionDelay)
break;
@@ -254,17 +252,17 @@ void sub_080449F8(Entity* this) {
break;
case 1:
this->direction = (this->direction + 0x10) & 0x1f;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->direction = (this->direction + 0x10) & 0x1f;
this->actionDelay = 2;
break;
case 3:
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->actionDelay = 2;
break;
case 4:
- sub_0806F69C(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
+ LinearMoveUpdate(this);
this->actionDelay = 2;
break;
}
@@ -305,7 +303,7 @@ void sub_08044B04(Entity* this) {
switch (vaati->field_0x74.HALF.LO) {
case 0:
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
switch (this->field_0x74.HALF.LO) {
case 0:
if (--this->actionDelay == 0) {
@@ -420,7 +418,7 @@ void sub_08044B04(Entity* this) {
}
break;
case 1:
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (--this->actionDelay == 0)
this->field_0x74.HALF.LO++;
break;
@@ -472,11 +470,11 @@ void sub_08044E74(Entity* this, u32 state) {
this->direction &= 0x1f;
PositionRelative(this->parent, this, 0, -0x100000);
this->speed = 12288;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->direction += 0x8;
this->direction &= 0x1f;
this->speed = 1280;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
break;
case 1:
this->direction = (this->direction + 8) & 0x1f;
@@ -486,18 +484,18 @@ void sub_08044E74(Entity* this, u32 state) {
switch (this->actionDelay) {
case 3 ... 4:
do {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} while (this->actionDelay-- != 3);
break;
case 1:
this->direction = (this->direction + 0x10) & 0x1f;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->direction = (this->direction + 0x10) & 0x1f;
break;
}
} else {
if (this->actionDelay == 2) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
break;
diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c
index be77a617..89fb894f 100644
--- a/src/enemy/vaatiEyesMacro.c
+++ b/src/enemy/vaatiEyesMacro.c
@@ -43,8 +43,6 @@ const u8 gUnk_080CDE70[] = {
const s8 gUnk_080CDE90[] = { -2, -3, -4, -5, -6, -5, -4, -3 };
const u16 gUnk_080CDE98[] = { 0xc0, 0x100, 0x140, 0x180 };
-extern u8 gEntCount;
-
void VaatiEyesMacro(Entity* this) {
vaatiEyesMacroFunctions[GetNextFunction(this)](this);
SetChildOffset(this, 0, 1, -0x10);
diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c
index 2efae6f5..b708275f 100644
--- a/src/enemy/vaatiProjectile.c
+++ b/src/enemy/vaatiProjectile.c
@@ -2,7 +2,6 @@
#include "functions.h"
extern bool32 PlayerInRange(Entity*, u32, u32);
-extern void DoExitTransition(ScreenTransitionData*);
extern u32 sub_080002E0(u32, u32);
extern Entity* gUnk_020000B0;
extern const ScreenTransitionData gUnk_0813AB94;
@@ -131,7 +130,7 @@ void VaatiProjectileFunction0Action1(Entity* this) {
} else {
if (gUnk_020000B0 != NULL) {
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
GetNextFrame(this);
@@ -191,7 +190,7 @@ void VaatiProjectileFunction0Action6(Entity* this) {
void VaatiProjectileFunction0Action7(Entity* this) {
sub_0803E444(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
sub_0803E4D8(this);
if ((gRoomControls.roomOriginY + gRoomControls.height + -0x10) <= this->y.HALF.HI) {
SetInitializationPriority();
diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c
index f3ccf3bb..5891ed20 100644
--- a/src/enemy/vaatiRebornEnemy.c
+++ b/src/enemy/vaatiRebornEnemy.c
@@ -3,7 +3,6 @@
#include "functions.h"
extern void sub_080AEFB4(Entity*);
-extern u8 gEntCount;
void VaatiRebornEnemyType0PreAction(Entity*);
void VaatiRebornEnemyType1PreAction(Entity*);
diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c
index bd462e33..b4fc508f 100644
--- a/src/enemy/vaatiTransfigured.c
+++ b/src/enemy/vaatiTransfigured.c
@@ -37,7 +37,6 @@ typedef struct {
s8 x;
s8 y;
} PACKED xy;
-extern u8 gEntCount;
#ifdef EU
const u8 gUnk_080D0ABC[] = { 0xf0, 0xd0, 0xb0 };
@@ -288,7 +287,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
if (this->animationState > 2) {
this->action = 7;
this->actionDelay = 0xe0;
- sub_0807A108();
+ DeleteClones();
SoundReq(SFX_BOSS_HIT);
return;
}
diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c
index 78fa065e..67e795ac 100644
--- a/src/enemy/vaatiTransfiguredEye.c
+++ b/src/enemy/vaatiTransfiguredEye.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
-#include "audio.h"
-#include "textbox.h"
+#include "message.h"
#include "coord.h"
#include "functions.h"
diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c
index eef8e73e..23e49183 100644
--- a/src/enemy/vaatiWrath.c
+++ b/src/enemy/vaatiWrath.c
@@ -1,13 +1,10 @@
#include "enemy.h"
#include "object.h"
-#include "textbox.h"
-#include "structures.h"
+#include "message.h"
#include "functions.h"
#include "save.h"
#include "screen.h"
-extern u8 gEntCount;
-
void VaatiWrathType0PreAction(Entity*);
u32 sub_08041FCC(Entity*);
void sub_08042004(Entity*);
@@ -380,7 +377,7 @@ void VaatiWrathType0Action7(Entity* this) {
if (gRoomControls.roomOriginY + 0x48 != this->y.HALF.HI) {
this->speed = 0x100;
this->direction = ((gRoomControls.roomOriginY + 0x48) >= this->y.HALF.HI) ? 0x10 : 0;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else {
if (--this->actionDelay == 0) {
sub_08042050(this);
@@ -391,7 +388,7 @@ void VaatiWrathType0Action7(Entity* this) {
void VaatiWrathType0Action8(Entity* this) {
sub_08042004(this);
UpdateAnimationSingleFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (((gRoomControls.roomOriginX + 0x20) > this->x.HALF.HI) ||
((gRoomControls.roomOriginX + 0x140) < this->x.HALF.HI)) {
if (0x3f < this->speed) {
@@ -466,7 +463,7 @@ void VaatiWrathType0ActionA(Entity* this) {
void VaatiWrathType0ActionB(Entity* this) {
switch (this->subAction) {
case 0:
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
UpdateAnimationSingleFrame(this);
GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type1);
GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2);
@@ -527,7 +524,7 @@ void VaatiWrathType0ActionC(Entity* this) {
if (this->actionDelay) {
this->actionDelay--;
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (gRoomControls.roomOriginY + 0x48 == this->y.HALF.HI) {
this->subAction = 2;
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0x11);
diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c
index d8590edc..9cb316c7 100644
--- a/src/enemy/vaatiWrathEye.c
+++ b/src/enemy/vaatiWrathEye.c
@@ -1,5 +1,4 @@
#include "enemy.h"
-#include "structures.h"
#include "functions.h"
void sub_080485D8(Entity*);
@@ -82,7 +81,7 @@ void VaatiWrathEyeAction3(Entity* this) {
y = parent->y.HALF.HI + ptr[1];
direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
this->direction = direction;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->z.HALF.HI = this->parent->z.HALF.HI;
if ((this->x.HALF.HI == x) && (this->y.HALF.HI == y)) {
this->action = 4;
diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c
index 73deb8da..05778ce1 100644
--- a/src/enemy/wallMaster2.c
+++ b/src/enemy/wallMaster2.c
@@ -92,7 +92,7 @@ void sub_0802CD54(Entity* this) {
this->actionDelay = 60;
sub_0802CF64(this);
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
void sub_0802CDE8(Entity* this) {
@@ -101,7 +101,7 @@ void sub_0802CDE8(Entity* this) {
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
sub_0802CF8C(this);
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else {
this->action = 1;
this->actionDelay = 60;
@@ -120,7 +120,7 @@ void sub_0802CE68(Entity* this) {
gPlayerState.flags |= 0x100;
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
this->direction = GetFacingDirection(this, &gPlayerEntity);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
sub_0802CFD8(this);
GetNextFrame(this);
diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c
index fc63d632..8ee1a6db 100644
--- a/src/enemy/waterDrop.c
+++ b/src/enemy/waterDrop.c
@@ -2,7 +2,6 @@
#include "screen.h"
#include "object.h"
#include "structures.h"
-#include "functions.h"
void sub_0802A39C(Entity*);
void sub_0802A334(Entity*);
@@ -39,7 +38,7 @@ void sub_0802A2B4(Entity* this) {
this->spritePriority.b0 = 7;
EnqueueSFX(0x84);
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
sub_0802A39C(this);
diff --git a/src/entity.c b/src/entity.c
index 85979ca8..2902c057 100644
--- a/src/entity.c
+++ b/src/entity.c
@@ -1,11 +1,8 @@
#include "global.h"
#include "utils.h"
#include "functions.h"
-#include "entity.h"
#include "area.h"
-#include "room.h"
-#include "script.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
extern u8 gUnk_081091F8[];
@@ -18,12 +15,9 @@ void sub_0805EE88(void);
void ClearAllDeletedEntities(void);
void DeleteAllEntities(void);
void sub_0805E98C(void);
-extern void sub_080AE068();
extern void UnloadOBJPalette();
extern void sub_0806FE84();
-extern void sub_080788E0();
extern void sub_08078954();
-extern void sub_0805EC60();
extern void sub_08017744(Entity*);
extern void UnloadHitbox();
extern void sub_0804AA1C();
@@ -31,7 +25,6 @@ extern void sub_0804AA1C();
extern void _ClearAndUpdateEntities();
extern void UpdateEntities_arm(u32);
-void SetPriorityTimer(u32);
static void UpdatePriorityTimer(void);
static void ReleaseTransitionManager();
static void UnlinkEntity();
@@ -256,8 +249,6 @@ Entity* sub_0805E744(void) {
return NULL;
}
-Manager* GetEmptyManager(void);
-
typedef void* (*Getter)(void);
void* GetEmptyEntityByKind(u32 kind) {
@@ -277,8 +268,6 @@ void DeleteThisEntity(void) {
f();
}
-void DeleteManager(void*);
-
typedef void (*Deleter)(void*);
void DeleteEntityAny(Entity* ent) {
@@ -320,7 +309,6 @@ void DeleteEntity(Entity* ent) {
}
}
-extern Entity gPlayerEntity;
void ClearDeletedEntity(Entity*);
void ClearAllDeletedEntities(void) {
@@ -333,8 +321,6 @@ void ClearAllDeletedEntities(void) {
} while (ent++, ent < (&gPlayerEntity + 80));
}
-extern u8 gEntCount;
-
void ClearDeletedEntity(Entity* ent) {
DmaClear32(3, ent, sizeof(Entity));
gEntCount--;
@@ -357,8 +343,6 @@ void DeleteAllEntities(void) {
}
}
-extern Manager gUnk_02033290;
-
typedef struct Temp {
void* prev;
void* next;
@@ -376,8 +360,6 @@ Manager* GetEmptyManager(void) {
return NULL;
}
-extern u8 gManagerCount;
-
void DeleteManager(void* ent) {
Manager* manager = (Manager*)ent;
if (!manager->next)
@@ -399,7 +381,6 @@ void ReleaseTransitionManager(void* mgr) {
}
extern Entity gUnk_020369F0;
-void sub_0805E98C(void);
void sub_0805E958(void) {
MemCopy(&gEntityLists, &gUnk_020369F0, 0x48);
@@ -449,8 +430,6 @@ void DeleteSleepingEntities(void) {
} while (++list < &gEntityLists[9]);
}
-extern void sub_0805E374(Entity*);
-
void AppendEntityToList(Entity* entity, u32 listIndex) {
LinkedList* list;
diff --git a/src/ezloNag.c b/src/ezloNag.c
index 584b13fa..addcacd2 100644
--- a/src/ezloNag.c
+++ b/src/ezloNag.c
@@ -1,7 +1,6 @@
#include "global.h"
-#include "audio.h"
-#include "textbox.h"
-#include "structures.h"
+#include "sound.h"
+#include "message.h"
typedef struct {
s8 unk0;
diff --git a/src/fade.c b/src/fade.c
index 2d107df7..583294a3 100644
--- a/src/fade.c
+++ b/src/fade.c
@@ -2,7 +2,6 @@
#include "functions.h"
#include "screen.h"
#include "utils.h"
-#include "fade.h"
typedef struct {
u8 field_0x0;
diff --git a/src/fileScreen.c b/src/fileScreen.c
index 50f0a4bb..8d221ccd 100644
--- a/src/fileScreen.c
+++ b/src/fileScreen.c
@@ -1,10 +1,9 @@
#include "fileScreen.h"
#include "main.h"
-#include "player.h"
#include "utils.h"
#include "screen.h"
#include "menu.h"
-#include "textbox.h"
+#include "message.h"
#include "object.h"
#include "functions.h"
diff --git a/src/flagDebug.c b/src/flagDebug.c
index 4f03efd9..8adb562c 100644
--- a/src/flagDebug.c
+++ b/src/flagDebug.c
@@ -1,5 +1,3 @@
-#include "flags.h"
-
const char* const globalFlagNames[] = {
"BEGIN",
"LV0_CLEAR",
diff --git a/src/flags.c b/src/flags.c
index 8efa3d5b..ec58ec19 100644
--- a/src/flags.c
+++ b/src/flags.c
@@ -39,9 +39,9 @@ u32 CheckRoomFlag(u32 flag) {
return ReadBit(&gRoomVars.roomFlags, flag);
}
-u32 CheckLocalFlagsByBank(u32 flag, u32 offset, u32 length) {
+u32 CheckLocalFlagsByBank(u32 offset, u32 flag, u32 length) {
- return CheckBits(&gGlobalFlags, flag + offset, length);
+ return CheckBits(&gGlobalFlags, offset + flag, length);
}
u32 CheckLocalFlags(u32 flag, u32 length) {
diff --git a/src/overworld.c b/src/game.c
index fdd22b3e..72fd56c0 100644
--- a/src/overworld.c
+++ b/src/game.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "screen.h"
#include "entity.h"
#include "player.h"
@@ -11,16 +11,14 @@
#include "fileScreen.h"
#include "menu.h"
#include "functions.h"
-#include "structures.h"
#include "area.h"
-#include "textbox.h"
-#include "overworld.h"
+#include "message.h"
+#include "game.h"
extern u32 gUnk_03003FC0;
extern u8 gUnk_080FCA84[];
extern u8 gUnk_080FCAC8[];
-extern u32 gUsedPalettes;
extern u8 gUnk_02024090[];
extern u16 gUnk_080FCAD6[];
@@ -35,16 +33,12 @@ extern u8 gUnk_080FCAF8[];
extern u16 gUnk_020178E0[];
void sub_080520C4();
-void SetPopupState();
-u32 sub_08052724();
void CleanUpGFXSlots();
void sub_080ADE24();
void sub_0801C370(u32);
void sub_0801AE44(u32);
void GenerateAreaHint(void);
void ForceSetPlayerState(u32);
-void SetPlayerEventPriority(void);
-RoomResInfo* GetCurrentRoomInfo(void);
void UpdateRoomTracker(void);
void InitScriptData(void);
void sub_08054524(void);
@@ -432,10 +426,10 @@ u32 CheckHasMap(void) {
return (gArea.areaMetadata >> 3) & 1;
}
-s32 ModHealth(s32 deltaHealth) {
+s32 ModHealth(s32 delta) {
s32 newHealth;
- newHealth = gStats.health + deltaHealth;
+ newHealth = gStats.health + delta;
if (newHealth < 0) {
newHealth = 0;
}
@@ -447,11 +441,11 @@ s32 ModHealth(s32 deltaHealth) {
return newHealth;
}
-void ModRupees(s32 rupeeDelta) {
+void ModRupees(s32 delta) {
s32 newRupeeCount;
Stats* s = &gStats;
- newRupeeCount = s->rupees + rupeeDelta;
+ newRupeeCount = s->rupees + delta;
if (newRupeeCount < 0) {
newRupeeCount = 0;
} else {
diff --git a/src/gba/m4a.c b/src/gba/m4a.c
index 38c5c9d0..19978368 100644
--- a/src/gba/m4a.c
+++ b/src/gba/m4a.c
@@ -1,6 +1,5 @@
#include "global.h"
#include "gba/m4a.h"
-#include "gba/gba.h"
// ASCII encoding of 'Smsh' in reverse
// This is presumably short for SMASH, the developer of MKS4AGB.
diff --git a/src/interrupts.c b/src/interrupts.c
index c2855c46..253c0aa0 100644
--- a/src/interrupts.c
+++ b/src/interrupts.c
@@ -1,17 +1,14 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "main.h"
#include "player.h"
#include "structures.h"
#include "save.h"
-#include "textbox.h"
+#include "message.h"
#include "functions.h"
-#include "object.h"
-#include "utils.h"
-#include "npc.h"
-#include "effects.h"
#include "screen.h"
#include "gba/m4a.h"
+#include "object.h"
extern u8 gUnk_03003DE0;
extern u8 gUnk_03000C30;
@@ -29,13 +26,10 @@ extern void sub_080ADD70();
extern void sub_0801C25C();
extern void UpdateDisplayControls();
extern void LoadResources();
-extern void FadeVBlank();
extern void HandlePlayerLife();
extern void DoPlayerAction();
extern void sub_080171F0();
extern void sub_08078FB0();
-extern u32 CheckDontUpdate();
-extern void DrawEntity();
extern void sub_0807A050();
extern u32 sub_08079B24();
extern void sub_08079708();
@@ -227,7 +221,7 @@ void HandlePlayerLife(Entity* this) {
if (gPlayerState.flags & PL_BURNING)
ResetPlayer();
if ((gPlayerState.flags & PL_CLONING) && !gPlayerState.field_0xa0[0])
- sub_0807A108();
+ DeleteClones();
if (sub_08079B24() == 0)
sub_08079708(this);
@@ -308,7 +302,7 @@ void sub_080171F0(void) {
gPlayerState.field_0xa &= 0xf;
gPlayerState.keepFacing &= ~0x80;
gPlayerState.field_0x1a[0] = 0;
- gPlayerState.field_0x80 = 0;
+ gPlayerState.speed_modifier = 0;
gPlayerState.field_0xaa = 0;
MemClear(&gUnk_03003BE0, 0x8c);
gPlayerEntity.spriteOffsetY = gPlayerState.field_0x3f;
diff --git a/src/intro.c b/src/intro.c
index 3095dcb9..c9eb0f73 100644
--- a/src/intro.c
+++ b/src/intro.c
@@ -1,12 +1,10 @@
-#include "audio.h"
-#include "global.h"
+#include "sound.h"
#include "main.h"
#include "entity.h"
#include "utils.h"
#include "screen.h"
#include "object.h"
-#include "textbox.h"
-#include "structures.h"
+#include "message.h"
#include "functions.h"
typedef struct {
diff --git a/src/item/itemBomb.c b/src/item/itemBomb.c
index 0ed4d65a..c0ce310c 100644
--- a/src/item/itemBomb.c
+++ b/src/item/itemBomb.c
@@ -1,6 +1,6 @@
#include "item.h"
#include "coord.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
extern void (*const gUnk_0811BD98[])(ItemBehavior*, u32);
diff --git a/src/item/itemBoomerang.c b/src/item/itemBoomerang.c
index a5505136..eb6c67cc 100644
--- a/src/item/itemBoomerang.c
+++ b/src/item/itemBoomerang.c
@@ -3,8 +3,6 @@
extern void (*const gUnk_0811BD78[])(ItemBehavior*, u32);
-extern void ResetPlayerVelocity(void);
-
void ItemBoomerang(ItemBehavior* this, u32 arg1) {
gUnk_0811BD78[this->stateID](this, arg1);
}
diff --git a/src/item/itemJarEmpty.c b/src/item/itemJarEmpty.c
index a3658dab..4fcf4668 100644
--- a/src/item/itemJarEmpty.c
+++ b/src/item/itemJarEmpty.c
@@ -5,7 +5,6 @@
extern void (*const gUnk_0811BE28[])(ItemBehavior*, u32);
extern u8 gUnk_02002AC8[];
-extern void sub_08077BB8(ItemBehavior*);
void ItemJarEmpty(ItemBehavior* this, u32 arg1) {
gUnk_0811BE28[this->stateID](this, arg1);
diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c
index 88245ad8..9399ef1b 100644
--- a/src/item/itemLantern.c
+++ b/src/item/itemLantern.c
@@ -1,6 +1,6 @@
#include "item.h"
#include "functions.h"
-#include "audio.h"
+#include "sound.h"
#include "object.h"
extern void (*const gUnk_0811BD68[])(ItemBehavior*, u32);
diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c
index 4e528ce0..9bce54e5 100644
--- a/src/item/itemMoleMitts.c
+++ b/src/item/itemMoleMitts.c
@@ -1,7 +1,7 @@
#include "item.h"
#include "functions.h"
-#include "audio.h"
+#include "sound.h"
extern void (*const gUnk_0811BE04[])(ItemBehavior*, u32);
@@ -10,7 +10,7 @@ s32 sub_080774A0(void);
extern u8 gUnk_0811BE14[];
extern s32 sub_0800875A(Entity*, u32, ItemBehavior*);
-extern void sub_08079E08();
+extern void UpdatePlayerMovement();
void ItemMoleMitts(ItemBehavior* this, u32 arg1) {
gUnk_0811BE04[this->stateID](this, arg1);
@@ -89,7 +89,7 @@ void sub_08077448(ItemBehavior* this, u32 arg1) {
gPlayerEntity.direction = gPlayerEntity.animationState << 2 ^ 0x10;
gPlayerEntity.speed = 0x100;
if (((this->field_0x5[9] & 1) != 0) && (this->field_0x5[0] != 0)) {
- sub_08079E08();
+ UpdatePlayerMovement();
}
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c
index 1f418627..5913c477 100644
--- a/src/item/itemOcarina.c
+++ b/src/item/itemOcarina.c
@@ -1,14 +1,12 @@
#include "item.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
extern void (*const gOcarinaStates[4])(ItemBehavior*, u32);
extern void ResetPlayerVelocity(void);
-extern void SetPlayerEventPriority(void);
extern void CreateBird(void);
-extern void ResetPlayerEventPriority(void);
void ItemOcarina(ItemBehavior* this, u32 arg1) {
gOcarinaStates[this->stateID](this, arg1);
diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c
index e60d820c..cf2bd6ac 100644
--- a/src/item/itemPegasusBoots.c
+++ b/src/item/itemPegasusBoots.c
@@ -1,6 +1,6 @@
#include "asm.h"
#include "item.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
#include "effects.h"
diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c
index a24967e9..cad38c43 100644
--- a/src/item/itemRocsCape.c
+++ b/src/item/itemRocsCape.c
@@ -1,12 +1,10 @@
#include "item.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
void sub_08076758(ItemBehavior*, u32);
extern void sub_08077F84(void);
-extern bool32 sub_08077EFC(ItemBehavior*);
-
/*void ItemRocsCape(ItemBehavior* this, u32 arg1) {
if (this->stateID != 0) {
sub_08076758(this, arg1);
diff --git a/src/item/itemSword.c b/src/item/itemSword.c
index 4b9f1605..773403fa 100644
--- a/src/item/itemSword.c
+++ b/src/item/itemSword.c
@@ -1,6 +1,6 @@
#include "item.h"
#include "functions.h"
-#include "audio.h"
+#include "sound.h"
#include "object.h"
extern void (*const gUnk_0811BD44[])(ItemBehavior*, u32);
@@ -89,7 +89,7 @@ void sub_08075694(ItemBehavior* this, u32 arg1) {
gPlayerState.field_0x1a[1] &= 0xdf;
if ((gPlayerState.field_0xa0[0] == 0x04) && ((gPlayerState.flags & PL_CLONING) == 0)) {
gPlayerState.field_0xa0[0] = 0x01;
- sub_0807A108();
+ DeleteClones();
}
SoundReq(SFX_PLY_VO2);
}
diff --git a/src/main.c b/src/main.c
index 7cd2f92b..9cf1eafb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,12 +1,10 @@
-#include "audio.h"
-#include "asm.h"
+#include "sound.h"
#include "functions.h"
-#include "structures.h"
#include "main.h"
#include "screen.h"
#include "utils.h"
#include "save.h"
-#include "textbox.h"
+#include "message.h"
#include "interrupts.h"
extern u32 gRand;
diff --git a/src/manager/manager10.c b/src/manager/manager10.c
index 04e78cd5..adfbf44c 100644
--- a/src/manager/manager10.c
+++ b/src/manager/manager10.c
@@ -1,14 +1,14 @@
#include "global.h"
+#include "asm.h"
#include "manager.h"
#include "room.h"
#include "area.h"
-#include "audio.h"
+#include "sound.h"
#include "screen.h"
#include "utils.h"
#include "fileScreen.h"
#include "functions.h"
-void Manager10_Main(Manager10*);
void sub_080595E4(Manager10*);
void sub_08059608(Manager10*);
void sub_08059690(Manager10*);
@@ -18,7 +18,6 @@ u32 sub_0805986C(void);
void sub_08059894(const u16*, const u16*, u32);
u32 sub_080598F8(u32, u32, u32);
void sub_08059960(const u16*, const u16*, u16*, u8);
-void sub_08059994(void);
const u8 gUnk_08108390[6] = {
0x0F, 0x1E, 0x2D, 0x3C, 0x01, 0x01,
diff --git a/src/manager/manager11.c b/src/manager/manager11.c
index 4a079333..28cbfab9 100644
--- a/src/manager/manager11.c
+++ b/src/manager/manager11.c
@@ -1,4 +1,3 @@
-#include "global.h"
#include "manager.h"
#include "flags.h"
diff --git a/src/manager/manager12.c b/src/manager/manager12.c
index 6a1c5982..630e17e5 100644
--- a/src/manager/manager12.c
+++ b/src/manager/manager12.c
@@ -1,4 +1,5 @@
#include "area.h"
+#include "asm.h"
#include "manager.h"
#include "room.h"
#include "functions.h"
@@ -87,7 +88,7 @@ void sub_08059A58(Manager12* this) {
}
}
-#define COMMON(tmp2, tmp1) ((tmp2) >> 4 & 0x3f) | (((tmp1) + 0x188U) >> 4 & 0x3f) << 6
+#define COMMON(tmp2, tmp1) (((tmp2) >> 4 & 0x3f) | (((tmp1) + 0x188U) >> 4 & 0x3f) << 6)
void sub_08059B18(void) {
u32 loopVar;
u32 innerLoopVar;
diff --git a/src/manager/manager14.c b/src/manager/manager14.c
index 65bb296d..47baf87c 100644
--- a/src/manager/manager14.c
+++ b/src/manager/manager14.c
@@ -5,7 +5,6 @@
#include "flags.h"
#include "coord.h"
#include "main.h"
-#include "functions.h"
typedef struct {
Manager manager;
@@ -23,7 +22,6 @@ const u16 gUnk_0810859A[] = { 0x808, 0x907, 0xA06, 0x907 };
extern void sub_0805622C(u16*, u32, u32);
extern u16 gUnk_02017AA0[];
-void Manager14_Main(Manager14*);
void sub_08059E80(Manager14*);
void sub_08059EF8(Manager14*);
u32 sub_08059F9C(Manager14*);
diff --git a/src/manager/manager15.c b/src/manager/manager15.c
index 8dc10a8f..c23c24fd 100644
--- a/src/manager/manager15.c
+++ b/src/manager/manager15.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "flags.h"
#include "screen.h"
#include "manager.h"
diff --git a/src/manager/manager19.c b/src/manager/manager19.c
index 0207ab56..f967c62a 100644
--- a/src/manager/manager19.c
+++ b/src/manager/manager19.c
@@ -1,7 +1,6 @@
#include "manager.h"
#include "area.h"
#include "room.h"
-#include "functions.h"
#include "screen.h"
void sub_0805AFFC(Manager*);
diff --git a/src/manager/manager1A.c b/src/manager/manager1A.c
index b188ef08..dd047611 100644
--- a/src/manager/manager1A.c
+++ b/src/manager/manager1A.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "manager.h"
#include "flags.h"
-#include "entity.h"
#include "room.h"
#include "screen.h"
#include "utils.h"
diff --git a/src/manager/manager1E.c b/src/manager/manager1E.c
index b928f10e..0e272fa9 100644
--- a/src/manager/manager1E.c
+++ b/src/manager/manager1E.c
@@ -1,7 +1,7 @@
#include "global.h"
+#include "asm.h"
#include "manager.h"
#include "flags.h"
-#include "functions.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager2.c b/src/manager/manager2.c
index 3f74d209..0294a65f 100644
--- a/src/manager/manager2.c
+++ b/src/manager/manager2.c
@@ -1,8 +1,6 @@
#include "global.h"
-#include "entity.h"
#include "screen.h"
#include "functions.h"
-#include "room.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager20.c b/src/manager/manager20.c
index 4cf749dc..46f4fe20 100644
--- a/src/manager/manager20.c
+++ b/src/manager/manager20.c
@@ -1,9 +1,7 @@
#include "global.h"
#include "manager.h"
#include "flags.h"
-#include "entity.h"
#include "room.h"
-#include "functions.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager21.c b/src/manager/manager21.c
index f0cc377a..49003b50 100644
--- a/src/manager/manager21.c
+++ b/src/manager/manager21.c
@@ -3,7 +3,6 @@
#include "room.h"
#include "object.h"
#include "functions.h"
-#include "flags.h"
extern bool32 CheckRectOnScreen(u16, u16, u32, u32);
@@ -44,7 +43,7 @@ void Manager21_Main(Manager21* this) {
object->x.HALF.HI = gRoomControls.roomOriginX + spawnData->x;
object->y.HALF.HI = gRoomControls.roomOriginY + spawnData->y;
object->parent = (Entity*)this;
- sub_08016A30(object);
+ ResolveCollisionLayer(object);
this->field_0x20 |= 1 << count;
}
}
diff --git a/src/manager/manager23.c b/src/manager/manager23.c
index 494018a4..4fd43d8a 100644
--- a/src/manager/manager23.c
+++ b/src/manager/manager23.c
@@ -4,7 +4,7 @@
#include "functions.h"
#include "flags.h"
#include "object.h"
-#include "overworld.h"
+#include "game.h"
extern void (*const gUnk_08108CCC[])(Manager*);
diff --git a/src/manager/manager24.c b/src/manager/manager24.c
index 532fdfd0..1f200d47 100644
--- a/src/manager/manager24.c
+++ b/src/manager/manager24.c
@@ -1,10 +1,9 @@
#include "entity.h"
#include "functions.h"
#include "flags.h"
-#include "audio.h"
-#include "overworld.h"
+#include "sound.h"
+#include "game.h"
#include "object.h"
-#include "area.h"
extern void (*const gUnk_08108CDC[])(Manager24*);
@@ -16,7 +15,6 @@ extern u32 sub_080002C8(u16, u8);
extern void (*const gUnk_08108CE8[])(u32, u32);
u32 sub_0805C608(void);
-extern u32 CheckIsInteriorWithEnemies(void);
extern u8 gUnk_08108CFC[];
diff --git a/src/manager/manager25.c b/src/manager/manager25.c
index 3e0e7c9f..78003bc1 100644
--- a/src/manager/manager25.c
+++ b/src/manager/manager25.c
@@ -1,3 +1,4 @@
+#include "asm.h"
#include "manager.h"
#include "room.h"
#include "functions.h"
diff --git a/src/manager/manager26.c b/src/manager/manager26.c
index 3a143e21..e06d36d5 100644
--- a/src/manager/manager26.c
+++ b/src/manager/manager26.c
@@ -1,10 +1,8 @@
#include "global.h"
#include "manager.h"
-#include "entity.h"
#include "flags.h"
#include "room.h"
#include "object.h"
-#include "functions.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager27.c b/src/manager/manager27.c
index 1addc549..a8e66939 100644
--- a/src/manager/manager27.c
+++ b/src/manager/manager27.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
diff --git a/src/manager/manager28.c b/src/manager/manager28.c
index 4d4155c7..43e4e8d9 100644
--- a/src/manager/manager28.c
+++ b/src/manager/manager28.c
@@ -1,9 +1,7 @@
#include "global.h"
#include "asm.h"
#include "manager.h"
-#include "entity.h"
#include "room.h"
-#include "functions.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager2A.c b/src/manager/manager2A.c
index f82aabd7..a460dc16 100644
--- a/src/manager/manager2A.c
+++ b/src/manager/manager2A.c
@@ -1,7 +1,7 @@
+#include "asm.h"
#include "manager.h"
#include "room.h"
#include "flags.h"
-#include "functions.h"
typedef struct {
u8 field_0x0;
diff --git a/src/manager/manager2B.c b/src/manager/manager2B.c
index f4cc8868..112390f6 100644
--- a/src/manager/manager2B.c
+++ b/src/manager/manager2B.c
@@ -3,7 +3,6 @@
#include "room.h"
#include "functions.h"
#include "object.h"
-#include "audio.h"
typedef struct {
Manager manager;
@@ -27,8 +26,6 @@ typedef struct {
extern void (*const gUnk_08108D30[])(Manager2B*);
-extern u8 gEntCount;
-
void sub_0805D11C(Manager2B*);
void Manager2B_Main(Manager2B* this) {
@@ -50,7 +47,7 @@ void sub_0805D02C(Manager2B* this) {
object->x.HALF.HI = objectData[0] + gRoomControls.roomOriginX;
object->y.HALF.HI = objectData[1] + gRoomControls.roomOriginY;
object->parent = (Entity*)this;
- sub_08016A30(object);
+ ResolveCollisionLayer(object);
this->field_0x20[counter] = object;
counter += 1;
objectData += 3;
diff --git a/src/manager/manager2C.c b/src/manager/manager2C.c
index 1ff17776..f42c0844 100644
--- a/src/manager/manager2C.c
+++ b/src/manager/manager2C.c
@@ -1,4 +1,5 @@
#include "manager.h"
+#include "asm.h"
#include "functions.h"
#include "utils.h"
diff --git a/src/manager/manager2D.c b/src/manager/manager2D.c
index 92aebb64..20d448e6 100644
--- a/src/manager/manager2D.c
+++ b/src/manager/manager2D.c
@@ -1,3 +1,4 @@
+#include "asm.h"
#include "entity.h"
#include "functions.h"
diff --git a/src/manager/manager2E.c b/src/manager/manager2E.c
index 7dbb3aa5..1bfc410b 100644
--- a/src/manager/manager2E.c
+++ b/src/manager/manager2E.c
@@ -3,7 +3,7 @@
#include "manager.h"
#include "flags.h"
#include "functions.h"
-#include "audio.h"
+#include "sound.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager3.c b/src/manager/manager3.c
index 308de277..b31a3f1c 100644
--- a/src/manager/manager3.c
+++ b/src/manager/manager3.c
@@ -5,9 +5,8 @@
#include "area.h"
#include "room.h"
#include "player.h"
-#include "audio.h"
+#include "sound.h"
#include "object.h"
-#include "functions.h"
// Facilitates the usage of minish portals.
diff --git a/src/manager/manager30.c b/src/manager/manager30.c
index 94f3be33..ec5f9a52 100644
--- a/src/manager/manager30.c
+++ b/src/manager/manager30.c
@@ -1,5 +1,6 @@
#include "global.h"
-#include "audio.h"
+#include "asm.h"
+#include "sound.h"
#include "manager.h"
#include "flags.h"
#include "functions.h"
diff --git a/src/manager/manager31.c b/src/manager/manager31.c
index 1cc7beff..561319d8 100644
--- a/src/manager/manager31.c
+++ b/src/manager/manager31.c
@@ -3,7 +3,6 @@
#include "flags.h"
#include "asm.h"
#include "object.h"
-#include "room.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager32.c b/src/manager/manager32.c
index 9cb61068..1e6580d8 100644
--- a/src/manager/manager32.c
+++ b/src/manager/manager32.c
@@ -1,11 +1,10 @@
#include "manager.h"
#include "screen.h"
-#include "structures.h"
#include "room.h"
#include "functions.h"
#include "area.h"
#include "utils.h"
-#include "overworld.h"
+#include "game.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager33.c b/src/manager/manager33.c
index b0c7fa29..63f3c533 100644
--- a/src/manager/manager33.c
+++ b/src/manager/manager33.c
@@ -1,7 +1,7 @@
#include "manager.h"
#include "room.h"
#include "player.h"
-#include "audio.h"
+#include "sound.h"
#include "object.h"
void Manager33_Main(Manager* this) {
diff --git a/src/manager/manager34.c b/src/manager/manager34.c
index a3f83418..e811aaea 100644
--- a/src/manager/manager34.c
+++ b/src/manager/manager34.c
@@ -1,7 +1,7 @@
#include "manager.h"
#include "structures.h"
#include "functions.h"
-#include "audio.h"
+#include "sound.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager35.c b/src/manager/manager35.c
index cc9090d0..599cdd9f 100644
--- a/src/manager/manager35.c
+++ b/src/manager/manager35.c
@@ -17,8 +17,6 @@ typedef struct {
extern void (*const gUnk_08108D98[])(Manager35*);
-extern void RequestPriorityDuration(Entity*, u32);
-
void Manager35_Main(Manager35* this) {
gUnk_08108D98[this->manager.action](this);
}
@@ -57,7 +55,7 @@ void sub_0805DCC8(Manager35* this) {
void sub_0805DD24(Manager35* this) {
RequestPriorityDuration(0, 8);
- if ((gRoomControls.unk6 & 4) == 0 && --this->manager.unk_0e == 0) {
+ if ((gRoomControls.scroll_flags & 4) == 0 && --this->manager.unk_0e == 0) {
this->manager.action = 3;
SetFlag(this->field_0x3c);
if (this->field_0x36 == 0) {
@@ -73,7 +71,7 @@ void sub_0805DD68(Manager35* this) {
gRoomControls.cameraTarget = (Entity*)this->manager.parent;
}
} else {
- if ((gRoomControls.unk6 & 4) == 0) {
+ if ((gRoomControls.scroll_flags & 4) == 0) {
Entity* entity = *(Entity**)this->manager.unk_18;
if (entity != NULL) {
DeleteEntity(entity);
diff --git a/src/manager/manager36.c b/src/manager/manager36.c
index 96e8b1a3..ca9c5c24 100644
--- a/src/manager/manager36.c
+++ b/src/manager/manager36.c
@@ -1,7 +1,6 @@
#include "manager.h"
-#include "audio.h"
+#include "sound.h"
#include "script.h"
-#include "functions.h"
typedef struct {
u16 waitTime;
diff --git a/src/manager/manager37.c b/src/manager/manager37.c
index 0258dee6..8140ac22 100644
--- a/src/manager/manager37.c
+++ b/src/manager/manager37.c
@@ -2,8 +2,8 @@
#include "structures.h"
#include "functions.h"
#include "flags.h"
-#include "textbox.h"
-#include "audio.h"
+#include "message.h"
+#include "sound.h"
#include "save.h"
#include "object.h"
#include "area.h"
diff --git a/src/manager/manager39.c b/src/manager/manager39.c
index 96787a29..bf69d08a 100644
--- a/src/manager/manager39.c
+++ b/src/manager/manager39.c
@@ -2,9 +2,9 @@
#include "manager.h"
#include "screen.h"
#include "area.h"
-#include "textbox.h"
+#include "message.h"
#include "utils.h"
-#include "overworld.h"
+#include "game.h"
#include "functions.h"
typedef struct {
@@ -28,7 +28,6 @@ extern const u8 gUnk_08108E48[0x18];
extern const u8 gUnk_08108E60[];
extern void sub_0805F46C(void*, const void*);
-extern void ResetSystemPriority(void);
void sub_0805E140(Manager39*);
void sub_0805E18C(Manager39*); // unused?
diff --git a/src/manager/manager4.c b/src/manager/manager4.c
index 42eb1ad6..48223e88 100644
--- a/src/manager/manager4.c
+++ b/src/manager/manager4.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "asm.h"
#include "player.h"
#include "room.h"
#include "manager.h"
diff --git a/src/manager/manager5.c b/src/manager/manager5.c
index bc9293b7..59473ab7 100644
--- a/src/manager/manager5.c
+++ b/src/manager/manager5.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "manager.h"
#include "flags.h"
#include "functions.h"
diff --git a/src/manager/manager6.c b/src/manager/manager6.c
index f412a208..023e93e6 100644
--- a/src/manager/manager6.c
+++ b/src/manager/manager6.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "asm.h"
#include "player.h"
#include "manager.h"
#include "functions.h"
diff --git a/src/manager/manager7.c b/src/manager/manager7.c
index 59cf85b6..45ff72a4 100644
--- a/src/manager/manager7.c
+++ b/src/manager/manager7.c
@@ -1,8 +1,6 @@
-#include "global.h"
#include "manager.h"
+#include "asm.h"
#include "functions.h"
-#include "structures.h"
-#include "gba/gba.h"
typedef struct {
Manager manager;
diff --git a/src/manager/manager8.c b/src/manager/manager8.c
index 20298d1f..04a5b954 100644
--- a/src/manager/manager8.c
+++ b/src/manager/manager8.c
@@ -1,8 +1,6 @@
-#include "global.h"
#include "manager.h"
#include "screen.h"
#include "functions.h"
-#include "gba/gba.h"
typedef struct {
Manager manager;
diff --git a/src/manager/managerA.c b/src/manager/managerA.c
index 1d68eadc..0554ea1b 100644
--- a/src/manager/managerA.c
+++ b/src/manager/managerA.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "asm.h"
#include "entity.h"
#include "player.h"
#include "manager.h"
@@ -15,8 +16,6 @@ static void sub_080585B0(ManagerA*);
static u32 PlayerStateValid(ManagerA*);
static void sub_080585DC(ManagerA*);
-extern void sub_0801855C(void);
-
/**
* Ezlo hint manager
*/
diff --git a/src/manager/managerB.c b/src/manager/managerB.c
index 82182094..9bf28b87 100644
--- a/src/manager/managerB.c
+++ b/src/manager/managerB.c
@@ -1,12 +1,10 @@
#include "global.h"
#include "manager.h"
#include "flags.h"
-#include "entity.h"
#include "room.h"
#include "area.h"
#include "utils.h"
-#include "audio.h"
-#include "functions.h"
+#include "sound.h"
/*
* Manager B is used to create fights:
@@ -47,7 +45,6 @@ void ManagerB_Init(ManagerB* this) {
DeleteThisEntity();
}
}
-extern void sub_080186C0(u32);
void ManagerB_WaitForFlag(ManagerB* this) {
int tmp;
@@ -63,8 +60,6 @@ void ManagerB_WaitForFlag(ManagerB* this) {
}
}
-extern void sub_0801855C(void);
-
void ManagerB_WaitForDone(ManagerB* this) {
// check if all helpers are done
if (this->manager.unk_0e)
diff --git a/src/manager/managerC.c b/src/manager/managerC.c
index 1dae3225..8f467f8e 100644
--- a/src/manager/managerC.c
+++ b/src/manager/managerC.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "manager.h"
#include "flags.h"
#include "structures.h"
diff --git a/src/manager/managerE.c b/src/manager/managerE.c
index 1cdb8ab8..e11c664a 100644
--- a/src/manager/managerE.c
+++ b/src/manager/managerE.c
@@ -1,9 +1,8 @@
-#include "global.h"
#include "entity.h"
#include "manager.h"
#include "flags.h"
#include "room.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
void ManagerE_Main(ManagerE* this) {
diff --git a/src/manager/managerF.c b/src/manager/managerF.c
index c13e9588..15fa53fa 100644
--- a/src/manager/managerF.c
+++ b/src/manager/managerF.c
@@ -1,20 +1,17 @@
#include "global.h"
#include "manager.h"
#include "flags.h"
-#include "audio.h"
+#include "sound.h"
#include "room.h"
#include "player.h"
#include "functions.h"
#include "area.h"
-#include "textbox.h"
-#include "script.h"
+#include "message.h"
#include "utils.h"
#include "tiles.h"
#include "object.h"
#include "item.h"
-void sub_08058ECC(ManagerF*);
-
void sub_08058EE4(ManagerF*);
void sub_08058FB0(ManagerF*);
void sub_08059094(ManagerF*);
diff --git a/src/textbox.c b/src/message.c
index 208f0f7c..3560df71 100644
--- a/src/textbox.c
+++ b/src/message.c
@@ -1,11 +1,10 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
+#include "asm.h"
#include "room.h"
-#include "entity.h"
#include "utils.h"
#include "functions.h"
-#include "textbox.h"
-#include "structures.h"
+#include "message.h"
#include "save.h"
#define MESSAGE_ADVANCE_KEYS (A_BUTTON | B_BUTTON | DPAD_ANY | R_BUTTON)
diff --git a/src/npc/anju.c b/src/npc/anju.c
index 29a80185..375917e2 100644
--- a/src/npc/anju.c
+++ b/src/npc/anju.c
@@ -1,8 +1,6 @@
-#include "global.h"
#include "entity.h"
#include "player.h"
#include "npc.h"
-#include "script.h"
void Anju(Entity* this) {
switch (this->action) {
diff --git a/src/npc/beedle.c b/src/npc/beedle.c
index 1e303b7a..703773ff 100644
--- a/src/npc/beedle.c
+++ b/src/npc/beedle.c
@@ -1,11 +1,10 @@
#include "global.h"
#include "entity.h"
-#include "textbox.h"
-#include "player.h"
+#include "message.h"
#include "room.h"
#include "script.h"
#include "npc.h"
-#include "overworld.h"
+#include "game.h"
typedef struct {
u32 unk_00;
diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c
index 63c25922..0fb7c8bf 100644
--- a/src/npc/bigGoron.c
+++ b/src/npc/bigGoron.c
@@ -1,5 +1,4 @@
#include "npc.h"
-#include "structures.h"
#include "functions.h"
#include "screen.h"
diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c
index 66d0a733..d0620938 100644
--- a/src/npc/bladeBrothers.c
+++ b/src/npc/bladeBrothers.c
@@ -3,13 +3,11 @@
#include "flags.h"
#include "player.h"
#include "room.h"
-#include "textbox.h"
+#include "message.h"
#include "save.h"
#include "script.h"
#include "npc.h"
-#include "audio.h"
#include "functions.h"
-#include "effects.h"
extern void (*gUnk_081115C0[])(Entity*);
extern void (*gUnk_081115D0[])(Entity*);
@@ -93,8 +91,6 @@ void sub_08068A4C(Entity* this) {
}
void sub_08068AA4(Entity* this) {
- u8 bVar1;
-
this->action = 1;
if (this->type != 0) {
this->type2++;
@@ -176,9 +172,6 @@ static void sub_08068BEC(Entity* this, u32 unused) {
}
void sub_08068C28(Entity* this) {
- u8 bVar1;
- u32 uVar2;
-
this->actionDelay = gUnk_08111623[this->type];
if (this->type == 1) {
if (GetInventoryValue(0x48)) { // spin attack
diff --git a/src/npc/brocco.c b/src/npc/brocco.c
index 0ec333bb..b960237c 100644
--- a/src/npc/brocco.c
+++ b/src/npc/brocco.c
@@ -1,8 +1,7 @@
#include "entity.h"
-#include "textbox.h"
+#include "message.h"
#include "save.h"
#include "npc.h"
-#include "script.h"
void sub_08063544(Entity*);
void sub_0806362C(Entity*);
diff --git a/src/npc/carlov.c b/src/npc/carlov.c
index 83402406..6fc9ad81 100644
--- a/src/npc/carlov.c
+++ b/src/npc/carlov.c
@@ -1,9 +1,7 @@
-#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "room.h"
#include "npc.h"
-#include "script.h"
void Carlov(Entity* this) {
if (this->action == 0) {
diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c
index 97efd2c1..b2341e33 100644
--- a/src/npc/carpenter.c
+++ b/src/npc/carpenter.c
@@ -1,11 +1,7 @@
#include "global.h"
#include "entity.h"
-#include "sprite.h"
#include "player.h"
#include "npc.h"
-#include "script.h"
-#include "flags.h"
-#include "textbox.h"
extern SpriteLoadData gUnk_08110CA8[];
diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c
index bc6eb925..cfd0dd9e 100644
--- a/src/npc/castleMaid.c
+++ b/src/npc/castleMaid.c
@@ -2,7 +2,7 @@
#include "script.h"
#include "save.h"
#include "flags.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
#include "manager.h"
@@ -46,7 +46,6 @@ void Maid_Head(Entity* this) {
}
NONMATCH("asm/non_matching/castleMaid/sub_08064570.inc", void sub_08064570(Entity* this)) {
- u8 bVar1;
u32 tmp;
switch (this->action) {
diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c
index b621b86f..c0637c96 100644
--- a/src/npc/castorWildsStatue.c
+++ b/src/npc/castorWildsStatue.c
@@ -1,4 +1,4 @@
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "script.h"
#include "functions.h"
diff --git a/src/npc/cat.c b/src/npc/cat.c
index b670b5ab..09ec72d2 100644
--- a/src/npc/cat.c
+++ b/src/npc/cat.c
@@ -2,10 +2,8 @@
#include "entity.h"
#include "functions.h"
#include "save.h"
-#include "player.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
-#include "audio.h"
extern void sub_08067C44();
@@ -58,7 +56,6 @@ void Cat(Entity* ent) {
}
void sub_080677EC(Entity* this) {
- u8 bVar1;
u32 uVar2;
this->spriteSettings.draw = 1;
@@ -96,7 +93,7 @@ void sub_080678AC(Entity* this) {
u32 iVar1;
u16* psVar2;
- iVar1 = sub_08067D20();
+ iVar1 = sub_08067D20(this);
if (iVar1 != 0) {
sub_08067B80(this, 5);
} else {
@@ -116,7 +113,7 @@ void sub_080678AC(Entity* this) {
}
void sub_08067904(Entity* this) {
- if (sub_08067D20() != 0) {
+ if (sub_08067D20(this) != 0) {
sub_08067B80(this, 8);
return;
}
@@ -137,7 +134,7 @@ void sub_08067904(Entity* this) {
this->spriteSettings.flipX = 1;
}
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
UpdateAnimationSingleFrame(this);
}
@@ -346,7 +343,6 @@ u32 sub_08067D20(Entity* this) {
u32 sub_08067D74(Entity* this) {
Entity* entity;
int iVar2;
- s32 tmp;
if (this->type != 5) {
if (this->actionDelay != 0) {
diff --git a/src/npc/cow.c b/src/npc/cow.c
index 295e387a..5f0bcc0a 100644
--- a/src/npc/cow.c
+++ b/src/npc/cow.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "player.h"
#include "npc.h"
@@ -208,7 +208,7 @@ void sub_0806924C(Entity* ent) {
}
} else {
Cow_ShowDialogue(ent);
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_COW);
ent->interactType = 0;
diff --git a/src/npc/cucco.c b/src/npc/cucco.c
index 27f3fc5a..bca662c1 100644
--- a/src/npc/cucco.c
+++ b/src/npc/cucco.c
@@ -64,7 +64,7 @@ void sub_0806E65C(Entity* this) {
sub_0806E6A8(this);
}
} else {
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_CUCCO_CALL);
this->interactType = 0;
diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c
index 10a51b9f..0ccc0d17 100644
--- a/src/npc/cuccoChick.c
+++ b/src/npc/cuccoChick.c
@@ -57,7 +57,7 @@ void sub_0806E838(Entity* this) {
sub_0806E884(this);
}
} else {
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_CHEEP);
this->interactType = 0;
diff --git a/src/npc/dampe.c b/src/npc/dampe.c
index afb9ef63..31eb8c7b 100644
--- a/src/npc/dampe.c
+++ b/src/npc/dampe.c
@@ -3,10 +3,8 @@
#include "player.h"
#include "room.h"
#include "flags.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
-#include "functions.h"
-#include "script.h"
extern u16 gUnk_08113344[];
extern u16 gUnk_0811334A[];
diff --git a/src/npc/din.c b/src/npc/din.c
index 51026a2e..7ddc0a3f 100644
--- a/src/npc/din.c
+++ b/src/npc/din.c
@@ -1,9 +1,6 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
-#include "script.h"
-#include "functions.h"
-#include "save.h"
void Din(Entity* this) {
switch (this->action) {
diff --git a/src/npc/dog.c b/src/npc/dog.c
index 97fadf4b..bd88e5c3 100644
--- a/src/npc/dog.c
+++ b/src/npc/dog.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "functions.h"
#include "npc.h"
-#include "save.h"
extern void (*gUnk_08111D88[])(Entity*);
void sub_08069FE8(Entity*);
@@ -304,7 +303,7 @@ void sub_0806A028(Entity* this) {
sub_08069FBC(this);
sub_0806A080(this);
SoundReq(SFX_VO_DOG);
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
this->interactType = 0;
}
diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c
index bccfb259..a4942f0f 100644
--- a/src/npc/drLeft.c
+++ b/src/npc/drLeft.c
@@ -1,5 +1,4 @@
#include "npc.h"
-#include "functions.h"
extern void sub_08078850(Entity*, u32, u8, u32*);
extern u32 gUnk_081133B4;
diff --git a/src/npc/emma.c b/src/npc/emma.c
index ed4d6025..088f01a0 100644
--- a/src/npc/emma.c
+++ b/src/npc/emma.c
@@ -1,4 +1,3 @@
-#include "global.h"
#include "entity.h"
#include "script.h"
#include "functions.h"
diff --git a/src/npc/epona.c b/src/npc/epona.c
index 4c3d9174..b4840bbe 100644
--- a/src/npc/epona.c
+++ b/src/npc/epona.c
@@ -1,8 +1,7 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
-#include "textbox.h"
-#include "player.h"
+#include "message.h"
#include "npc.h"
#include "functions.h"
@@ -83,7 +82,7 @@ void sub_08065AA4(Entity* this) {
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
sub_08065A50(this);
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_EPONA);
this->interactType = 0;
diff --git a/src/npc/ezlo.c b/src/npc/ezlo.c
index 6a3a96da..77a69331 100644
--- a/src/npc/ezlo.c
+++ b/src/npc/ezlo.c
@@ -1,5 +1,4 @@
#include "npc.h"
-#include "script.h"
const u8 gUnk_08114134[];
const u8 gUnk_08114144[];
diff --git a/src/npc/farore.c b/src/npc/farore.c
index 0249171d..f9bfe746 100644
--- a/src/npc/farore.c
+++ b/src/npc/farore.c
@@ -1,11 +1,6 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
-#include "script.h"
-#include "functions.h"
-#include "save.h"
-
-extern u32 sub_08002632(Entity*);
void Farore(Entity* this) {
switch (this->action) {
diff --git a/src/npc/festari.c b/src/npc/festari.c
index 49dde08c..2af31802 100644
--- a/src/npc/festari.c
+++ b/src/npc/festari.c
@@ -2,15 +2,11 @@
#include "entity.h"
#include "functions.h"
#include "npc.h"
-#include "player.h"
-#include "script.h"
extern void sub_0805FF2C(Entity*, ScriptExecutionContext*);
extern void (*const gUnk_08109BBC[])(Entity*);
-extern void HandlePostScriptActions(Entity*, ScriptExecutionContext*);
-
void Festari(Entity* this) {
gUnk_08109BBC[this->action](this);
}
@@ -25,9 +21,6 @@ void sub_0805FE10(Entity* this) {
}
void sub_0805FE48(Entity* this) {
- u8 bVar1;
- u16 uVar2;
- u32 uVar3;
u32 uVar4;
if (this->interactType == 2) {
diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c
index 1ebe4176..988110f7 100644
--- a/src/npc/forestMinish.c
+++ b/src/npc/forestMinish.c
@@ -1,6 +1,5 @@
#include "npc.h"
#include "object.h"
-#include "structures.h"
#include "functions.h"
extern void sub_080600F0(Entity*);
@@ -229,7 +228,6 @@ void sub_08060340(void) {
}
u32 sub_08060354(void) {
- u32 iVar1;
s32 iVar2;
iVar2 = gSave.unk50 - gSave.unk48C[1];
diff --git a/src/npc/gentari.c b/src/npc/gentari.c
index d4938806..bf7818c1 100644
--- a/src/npc/gentari.c
+++ b/src/npc/gentari.c
@@ -1,9 +1,6 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
-#include "player.h"
-#include "script.h"
-#include "functions.h"
void Gentari(Entity* this) {
switch (this->action) {
diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c
index de04427b..192509ff 100644
--- a/src/npc/ghostBrothers.c
+++ b/src/npc/ghostBrothers.c
@@ -2,9 +2,8 @@
#include "functions.h"
#include "save.h"
#include "screen.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
-#include "script.h"
extern void (*const gUnk_0811017C[])(Entity*);
@@ -25,8 +24,6 @@ void sub_08065BF4(Entity* this) {
}
NONMATCH("asm/non_matching/ghostBrothers/sub_08065C0C.inc", void sub_08065C0C(Entity* this)) {
- u8 bVar1;
- u32 uVar2;
u16* puVar3;
switch (this->action) {
diff --git a/src/npc/gina.c b/src/npc/gina.c
index f12537b5..0f4973b8 100644
--- a/src/npc/gina.c
+++ b/src/npc/gina.c
@@ -2,9 +2,6 @@
#include "entity.h"
#include "player.h"
#include "npc.h"
-#include "flags.h"
-#include "functions.h"
-#include "script.h"
void Gina(Entity* this) {
switch (this->action) {
diff --git a/src/npc/goron.c b/src/npc/goron.c
index d48cda07..22a217ca 100644
--- a/src/npc/goron.c
+++ b/src/npc/goron.c
@@ -1,8 +1,7 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
-#include "textbox.h"
-#include "script.h"
+#include "message.h"
#include "effects.h"
#include "npc.h"
diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c
index f4640890..503717a6 100644
--- a/src/npc/goronMerchant.c
+++ b/src/npc/goronMerchant.c
@@ -1,11 +1,8 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
-#include "structures.h"
-#include "textbox.h"
-#include "room.h"
+#include "message.h"
#include "flags.h"
-#include "script.h"
#include "save.h"
#include "npc.h"
diff --git a/src/npc/gregal.c b/src/npc/gregal.c
index 9177592b..f7038e95 100644
--- a/src/npc/gregal.c
+++ b/src/npc/gregal.c
@@ -3,8 +3,6 @@
#include "functions.h"
#include "npc.h"
-void ChangeObjPalette(Entity*, u32);
-
extern void (*gUnk_08113D8C[])(Entity*);
extern void sub_08078850(Entity*, u32, u8, u32*);
diff --git a/src/npc/guard.c b/src/npc/guard.c
index 67c4fa2e..50f559c7 100644
--- a/src/npc/guard.c
+++ b/src/npc/guard.c
@@ -2,10 +2,9 @@
#include "entity.h"
#include "player.h"
#include "flags.h"
-#include "textbox.h"
+#include "message.h"
#include "room.h"
#include "script.h"
-#include "structures.h"
#include "functions.h"
#include "npc.h"
@@ -28,10 +27,8 @@ extern void (*const gUnk_0810F544[])(Entity*);
extern void (*const gUnk_0810F550[])(Entity*);
// entity count
-extern u8 gEntCount;
extern SpriteLoadData gUnk_0810F524[];
extern void* gUnk_0810F6BC[];
-extern ScreenTransition gScreenTransition;
void Guard(Entity* this) {
if ((this->flags & 2) != 0) {
@@ -113,7 +110,6 @@ void sub_08063E6C(Entity* this) {
}
void sub_08063E90(Entity* this) {
- Entity* ent;
u32 temp, idx;
u32 unk;
@@ -166,7 +162,6 @@ void sub_08063F78(Entity* this) {
}
void Guard_Head(Entity* this) {
- u8 bVar1;
u32 uVar2;
u32 pbVar3;
u32 uVar4;
diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c
index 52277dff..b36176cb 100644
--- a/src/npc/hurdyGurdyMan.c
+++ b/src/npc/hurdyGurdyMan.c
@@ -2,13 +2,11 @@
#include "functions.h"
#include "save.h"
#include "npc.h"
-#include "script.h"
extern Dialog gUnk_081144FC[];
extern SpriteLoadData gUnk_081144F0;
-extern u32 sub_08002632(Entity*);
extern u16* gUnk_08001A7C[];
void HurdyGurdyMan(Entity* this) {
diff --git a/src/npc/kid.c b/src/npc/kid.c
index c109baae..c5b5872a 100644
--- a/src/npc/kid.c
+++ b/src/npc/kid.c
@@ -1,8 +1,6 @@
#include "functions.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
-#include "script.h"
-#include "save.h"
extern void (*const gUnk_0810BE0C[])(Entity*);
void sub_080621AC(Entity*);
@@ -28,8 +26,6 @@ extern Dialog gUnk_0810BE10[];
extern u8 gUnk_0810C0A0[];
-extern SpriteLoadData* gUnk_0810BDC4[];
-
void Kid(Entity* this) {
if ((this->flags & 2) != 0) {
sub_080621AC(this);
@@ -338,7 +334,6 @@ NONMATCH("asm/non_matching/kid/sub_08062948.inc", void sub_08062948(Entity* this
u16 uVar2;
u32 uVar3;
s32 iVar4;
- s16* psVar5;
if (context->unk_18 == 0) {
context->unk_18 += 1;
diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c
index 4bc618b3..e159c531 100644
--- a/src/npc/kingDaltus.c
+++ b/src/npc/kingDaltus.c
@@ -2,8 +2,6 @@
#include "script.h"
#include "functions.h"
#include "npc.h"
-#include "flags.h"
-#include "textbox.h"
extern u16 gUnk_081104F8[];
diff --git a/src/npc/kingGustaf.c b/src/npc/kingGustaf.c
index a40a19f6..ae33c16c 100644
--- a/src/npc/kingGustaf.c
+++ b/src/npc/kingGustaf.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
-#include "script.h"
#include "screen.h"
void KingGustaf(Entity* this) {
diff --git a/src/npc/librari.c b/src/npc/librari.c
index 509d790e..f3cb382c 100644
--- a/src/npc/librari.c
+++ b/src/npc/librari.c
@@ -1,10 +1,6 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
-#include "flags.h"
-#include "textbox.h"
-#include "functions.h"
-#include "script.h"
extern u16 gUnk_08112D48[];
diff --git a/src/npc/librarians.c b/src/npc/librarians.c
index 9b134e7a..95d1fd2f 100644
--- a/src/npc/librarians.c
+++ b/src/npc/librarians.c
@@ -2,8 +2,8 @@
#include "script.h"
#include "functions.h"
#include "flags.h"
-#include "textbox.h"
-#include "audio.h"
+#include "message.h"
+#include "sound.h"
extern u16 gUnk_08113078[];
diff --git a/src/npc/mailbox.c b/src/npc/mailbox.c
index a4afd083..9dc5df22 100644
--- a/src/npc/mailbox.c
+++ b/src/npc/mailbox.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "entity.h"
-#include "textbox.h"
-#include "functions.h"
+#include "message.h"
#include "effects.h"
#include "npc.h"
diff --git a/src/npc/malon.c b/src/npc/malon.c
index 85ba2cd1..deb17fe7 100644
--- a/src/npc/malon.c
+++ b/src/npc/malon.c
@@ -2,7 +2,6 @@
#include "entity.h"
#include "script.h"
#include "npc.h"
-#include "functions.h"
extern void (*gUnk_0810FF5C[])(Entity* this);
extern void (*gUnk_0810FF64[])(Entity* this);
diff --git a/src/npc/mama.c b/src/npc/mama.c
index d5ea5950..57290d94 100644
--- a/src/npc/mama.c
+++ b/src/npc/mama.c
@@ -1,6 +1,5 @@
#include "entity.h"
#include "script.h"
-#include "functions.h"
#include "save.h"
#include "npc.h"
diff --git a/src/npc/marcy.c b/src/npc/marcy.c
index 01c94bc4..c187fd76 100644
--- a/src/npc/marcy.c
+++ b/src/npc/marcy.c
@@ -1,8 +1,7 @@
#include "entity.h"
#include "functions.h"
-#include "script.h"
#include "flags.h"
-#include "textbox.h"
+#include "message.h"
extern u16 gUnk_0810C34C[];
diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c
index 1c569e92..bf56dd1d 100644
--- a/src/npc/mayorHagen.c
+++ b/src/npc/mayorHagen.c
@@ -3,10 +3,6 @@
#include "player.h"
#include "flags.h"
#include "npc.h"
-#include "structures.h"
-#include "functions.h"
-#include "save.h"
-#include "script.h"
extern void sub_08078850();
extern u32 gUnk_08113F44;
diff --git a/src/npc/milkCart.c b/src/npc/milkCart.c
index 7b32235f..1493d385 100644
--- a/src/npc/milkCart.c
+++ b/src/npc/milkCart.c
@@ -1,6 +1,4 @@
-#include "global.h"
#include "entity.h"
-#include "functions.h"
#include "npc.h"
extern void (*gMilkCartBehaviors[2])(Entity*);
diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c
index 0d2d017b..3ae0b056 100644
--- a/src/npc/minishEzlo.c
+++ b/src/npc/minishEzlo.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "functions.h"
-#include "script.h"
-#include "audio.h"
+#include "sound.h"
extern SpriteLoadData gUnk_0810C48C;
diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c
index 5ee2e07d..70e012eb 100644
--- a/src/npc/ministerPotho.c
+++ b/src/npc/ministerPotho.c
@@ -1,8 +1,6 @@
#include "entity.h"
-#include "functions.h"
#include "flags.h"
-#include "textbox.h"
-#include "script.h"
+#include "message.h"
#include "npc.h"
extern void (*const gUnk_08110644[])(Entity*);
diff --git a/src/npc/moblinLady.c b/src/npc/moblinLady.c
index d63d4d87..7aa448f1 100644
--- a/src/npc/moblinLady.c
+++ b/src/npc/moblinLady.c
@@ -1,7 +1,5 @@
-#include "global.h"
#include "entity.h"
#include "npc.h"
-#include "script.h"
void MoblinLady(Entity* this) {
if (this->action == 0) {
diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c
index b7c0f08a..ed76f1e1 100644
--- a/src/npc/mountainMinish.c
+++ b/src/npc/mountainMinish.c
@@ -1,7 +1,7 @@
#include "entity.h"
#include "script.h"
#include "functions.h"
-#include "textbox.h"
+#include "message.h"
#include "flags.h"
#include "npc.h"
@@ -10,8 +10,6 @@ extern SpriteLoadData gUnk_08111358;
extern void (*const gUnk_08111368[])(Entity*);
void sub_08067EF0(Entity*);
-extern SpriteLoadData gUnk_08111358;
-
extern u16 gUnk_0811130E[];
void MountainMinish(Entity* this) {
diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c
index 7cae63d1..7d0751c7 100644
--- a/src/npc/mutoh.c
+++ b/src/npc/mutoh.c
@@ -2,12 +2,8 @@
#include "entity.h"
#include "player.h"
#include "flags.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
-#include "structures.h"
-#include "functions.h"
-#include "save.h"
-#include "script.h"
extern SpriteLoadData gUnk_08110C00;
extern u16 gUnk_08110C0C[];
diff --git a/src/npc/nayru.c b/src/npc/nayru.c
index bfc4a3a3..9e3bea24 100644
--- a/src/npc/nayru.c
+++ b/src/npc/nayru.c
@@ -1,11 +1,6 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
-#include "script.h"
-#include "functions.h"
-#include "save.h"
-
-extern u32 sub_08002632(Entity*);
void Nayru(Entity* this) {
switch (this->action) {
diff --git a/src/npc/npc23.c b/src/npc/npc23.c
index 003c5bd9..df0786e4 100644
--- a/src/npc/npc23.c
+++ b/src/npc/npc23.c
@@ -1,10 +1,8 @@
#include "entity.h"
-#include "script.h"
#include "player.h"
#include "structures.h"
#include "functions.h"
-#include "structures.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
extern void (*const gUnk_081104C8[])(Entity*);
diff --git a/src/npc/npc26.c b/src/npc/npc26.c
index 81ce55b7..3a4fbf75 100644
--- a/src/npc/npc26.c
+++ b/src/npc/npc26.c
@@ -1,7 +1,5 @@
#include "global.h"
#include "entity.h"
-#include "functions.h"
-#include "script.h"
#include "npc.h"
static void (*const gUnk_081106D4[])(Entity*);
diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c
index 920e7c12..23afefed 100644
--- a/src/npc/npc4E.c
+++ b/src/npc/npc4E.c
@@ -1,9 +1,7 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
-#include "script.h"
-#include "functions.h"
-#include "audio.h"
+#include "sound.h"
#include "save.h"
#include "flags.h"
#include "object.h"
@@ -196,7 +194,6 @@ void sub_0806DC7C() {
}
void sub_0806DCA0() {
- u16 uVar1;
const u16* tiles = gUnk_081141F4;
while (*tiles != 0) {
u32 tile = *tiles;
diff --git a/src/npc/npc5.c b/src/npc/npc5.c
index 97d3c819..05d2c7e0 100644
--- a/src/npc/npc5.c
+++ b/src/npc/npc5.c
@@ -1,5 +1,5 @@
#include "functions.h"
-#include "textbox.h"
+#include "message.h"
#include "npc.h"
extern void (*const gUnk_0810AC1C[])(Entity*);
@@ -161,6 +161,7 @@ void sub_08060B5C(Entity* this) {
void sub_08060BA0(Entity* this) {
Entity* r5;
+ //! @bug: r5 is uninitialized
if (sub_08061230(this) != 0) {
return;
@@ -263,7 +264,7 @@ void sub_08060DF4(Entity* this) {
void sub_08060DFC(Entity* this) {
u32 uVar1;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
sub_08060E94(this);
uVar1 = GravityUpdate(this, 0x2000);
if (uVar1 == 0) {
@@ -406,9 +407,7 @@ NONMATCH("asm/non_matching/npc5/sub_08061170.inc", bool32 sub_08061170(Entity* t
END_NONMATCH
NONMATCH("asm/non_matching/npc5/sub_080611D4.inc", u32 sub_080611D4(Entity* this)) {
- u8 bVar1;
u32 uVar2;
- u8* pbVar3;
u32 x;
s32 a;
@@ -420,8 +419,7 @@ NONMATCH("asm/non_matching/npc5/sub_080611D4.inc", u32 sub_080611D4(Entity* this
b = gUnk_0810AC4C[x].unk_1;
// asm("d");
uVar2 = sub_080002B4(this, a, b);
-// asm("b");
-code4:
+ // asm("b");
if ((gUnk_0810AC54[0] != uVar2 || (this->animationState != gUnk_0810AC54[1] >> 2))) {
// asm ("e");
if (gUnk_0810AC54[2] == 0) {
@@ -473,7 +471,6 @@ u32 sub_08061230(Entity* this) {
}
NONMATCH("asm/non_matching/npc5/sub_08061358.inc", void sub_08061358(Entity* this)) {
- u8 bVar1;
u32 uVar2;
s32 iVar3;
u8 bVar4;
@@ -629,7 +626,6 @@ NONMATCH("asm/non_matching/npc5/sub_08061464.inc", void sub_08061464(Entity* thi
sub_08061630(this, iVar10, iVar9 + -8, param_a);
}
}
-_08061612:
bVar1 = ((UnkHeap*)this->myHeap)->unk_0;
if ((bVar1 & 8) == 0) {
this->action = 3;
@@ -843,7 +839,6 @@ void sub_08061AFC(Entity* this) {
}
NONMATCH("asm/non_matching/npc5/sub_08061B18.inc", void sub_08061B18(Entity* this)) {
- u8 bVar1;
u16* puVar2;
typedef struct {
diff --git a/src/npc/npc58.c b/src/npc/npc58.c
index 5cebcb57..c9b9ab72 100644
--- a/src/npc/npc58.c
+++ b/src/npc/npc58.c
@@ -1,5 +1,4 @@
#include "entity.h"
-#include "functions.h"
#include "npc.h"
extern void sub_0806FFBC(Entity*, u32, u32, u32);
diff --git a/src/npc/npc9.c b/src/npc/npc9.c
index 0c514fd3..df8cc07e 100644
--- a/src/npc/npc9.c
+++ b/src/npc/npc9.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "entity.h"
-#include "textbox.h"
-#include "functions.h"
+#include "message.h"
#include "npc.h"
extern void (*const gUnk_0810C290[])(Entity*);
diff --git a/src/npc/percy.c b/src/npc/percy.c
index 90e10b28..db53c99d 100644
--- a/src/npc/percy.c
+++ b/src/npc/percy.c
@@ -1,25 +1,16 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
-#include "textbox.h"
#include "functions.h"
-#include "flags.h"
-#include "script.h"
-#include "save.h"
-#include "effects.h"
extern void sub_0806B41C(Entity*);
extern void sub_0806B3CC(Entity*);
-extern u32 sub_08002632(Entity*);
-
extern u16* gUnk_08001A7C[40];
extern u16 gUnk_08112E54[4];
extern Dialog gUnk_08112E2C[5];
extern SpriteLoadData gUnk_08112E1C;
-extern SpriteLoadData gUnk_08112E1C;
-
void Percy_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, (this->frameSpriteSettings & 0x3f) + 0x13);
SetExtraSpriteFrame(this, 1, (this->frame & 0x7f) + 0xb);
diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c
index fa39f1b9..962ca337 100644
--- a/src/npc/picolyteBottle.c
+++ b/src/npc/picolyteBottle.c
@@ -2,7 +2,7 @@
#include "script.h"
#include "structures.h"
#include "functions.h"
-#include "textbox.h"
+#include "message.h"
#include "object.h"
extern ScreenTransitionData gUnk_0813AD4C;
diff --git a/src/npc/pina.c b/src/npc/pina.c
index 4d60768c..a36763ae 100644
--- a/src/npc/pina.c
+++ b/src/npc/pina.c
@@ -1,8 +1,7 @@
#include "entity.h"
#include "functions.h"
-#include "textbox.h"
+#include "message.h"
#include "save.h"
-#include "script.h"
#include "npc.h"
void sub_08063B68(Entity* this);
diff --git a/src/npc/pita.c b/src/npc/pita.c
index 97abf77d..b5a2e065 100644
--- a/src/npc/pita.c
+++ b/src/npc/pita.c
@@ -34,6 +34,7 @@ bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {
u32 tmp;
u32 tmp2;
+ //! @bug: tmp is uninitialized, in practice player must have an item here
if (GetInventoryValue(0x68) != 0) {
tmp = 0;
}
diff --git a/src/npc/postman.c b/src/npc/postman.c
index d8cdb5aa..f72ec6d3 100644
--- a/src/npc/postman.c
+++ b/src/npc/postman.c
@@ -1,16 +1,8 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "functions.h"
#include "npc.h"
-#include "textbox.h"
-#include "player.h"
-#include "room.h"
-#include "structures.h"
-#include "save.h"
-#include "script.h"
-#include "flags.h"
-#include "effects.h"
extern void sub_08060528(Entity*);
extern void sub_080604DC(Entity*);
@@ -37,7 +29,6 @@ void Postman(Entity* this) {
}
void sub_08060428(Entity* this) {
- u8 bVar1;
void* data;
this->actionDelay = 0x5a;
@@ -54,7 +45,6 @@ void sub_08060428(Entity* this) {
void sub_0806045C(Entity* this) {
u8 bVar1;
- u32 uVar2;
u32 bVar3;
s32 temp;
@@ -92,8 +82,6 @@ void sub_080604C8(Entity* this) {
}
void sub_080604DC(Entity* this) {
- u8 bVar1;
- int iVar2;
Entity* ent;
if (this->spriteSettings.draw == 1 && CheckOnScreen(this)) {
diff --git a/src/npc/simon.c b/src/npc/simon.c
index 3fffc8cc..c5e40ce5 100644
--- a/src/npc/simon.c
+++ b/src/npc/simon.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "room.h"
#include "flags.h"
diff --git a/src/npc/smith.c b/src/npc/smith.c
index 307bd0bd..764a2aa8 100644
--- a/src/npc/smith.c
+++ b/src/npc/smith.c
@@ -1,5 +1,4 @@
#include "npc.h"
-#include "functions.h"
extern void sub_08078850(Entity*, u32, u32, u32*);
@@ -65,7 +64,6 @@ void sub_080660EC(Entity* this) {
void sub_08066118(Entity* this) {
s32 uVar1;
- u32 iVar2;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
if (uVar1 < 0) {
@@ -105,8 +103,6 @@ void sub_080661B0(Entity* this) {
}
void sub_080661BC(Entity* this) {
- u32 sVar1;
-
if (this->animIndex == 0xc) {
UpdateAnimationSingleFrame(this);
if (this->frame & 0x80) {
diff --git a/src/npc/stamp.c b/src/npc/stamp.c
index 2b5888a8..645fe1cc 100644
--- a/src/npc/stamp.c
+++ b/src/npc/stamp.c
@@ -1,8 +1,7 @@
#include "global.h"
#include "entity.h"
-#include "textbox.h"
+#include "message.h"
#include "functions.h"
-#include "script.h"
#include "effects.h"
#include "npc.h"
diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c
index e6beed01..40ad8706 100644
--- a/src/npc/stockwell.c
+++ b/src/npc/stockwell.c
@@ -1,7 +1,7 @@
#include "entity.h"
#include "script.h"
#include "room.h"
-#include "textbox.h"
+#include "message.h"
#include "functions.h"
#include "npc.h"
diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c
index 147382a8..ef135a92 100644
--- a/src/npc/sturgeon.c
+++ b/src/npc/sturgeon.c
@@ -1,10 +1,7 @@
#include "entity.h"
#include "functions.h"
#include "npc.h"
-#include "textbox.h"
#include "object.h"
-#include "flags.h"
-#include "script.h"
extern u16 gUnk_0810FA54[];
diff --git a/src/npc/talon.c b/src/npc/talon.c
index a7bc1e81..d991ab1f 100644
--- a/src/npc/talon.c
+++ b/src/npc/talon.c
@@ -53,7 +53,7 @@ void sub_0806559C(Entity* this) {
sub_0806ED78(this);
if (this->interactType != 0) {
this->interactType = 0;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
}
diff --git a/src/npc/teachers.c b/src/npc/teachers.c
index 645361d2..d99151da 100644
--- a/src/npc/teachers.c
+++ b/src/npc/teachers.c
@@ -4,7 +4,6 @@
#include "save.h"
#include "script.h"
#include "npc.h"
-#include "functions.h"
extern SpriteLoadData gUnk_08113910[];
diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c
index 18587c36..490f15ee 100644
--- a/src/npc/tingleSiblings.c
+++ b/src/npc/tingleSiblings.c
@@ -1,8 +1,6 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
-#include "textbox.h"
-#include "script.h"
#include "functions.h"
extern void sub_08064DE4(Entity*);
diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c
index 3d89d6f4..557b7341 100644
--- a/src/npc/townMinish.c
+++ b/src/npc/townMinish.c
@@ -2,10 +2,6 @@
#include "entity.h"
#include "npc.h"
#include "functions.h"
-#include "textbox.h"
-#include "flags.h"
-#include "save.h"
-#include "script.h"
extern u32 sub_080002C0();
extern void sub_0806ACC4(Entity*);
@@ -63,8 +59,6 @@ void sub_0806AC3C(Entity* this) {
}
if (unk != this->field_0x68.HALF.HI) {
- s32 temp;
-
if (((unk - this->field_0x68.HALF.HI) & 0x1f) <= 0xf) {
this->field_0x68.HALF.HI--;
} else {
diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c
index 3b674b37..17cd48e5 100644
--- a/src/npc/townsperson.c
+++ b/src/npc/townsperson.c
@@ -1,5 +1,4 @@
#include "npc.h"
-#include "structures.h"
#include "functions.h"
typedef struct {
diff --git a/src/npc/vaati.c b/src/npc/vaati.c
index 751a1be6..9db43d90 100644
--- a/src/npc/vaati.c
+++ b/src/npc/vaati.c
@@ -1,8 +1,7 @@
#include "global.h"
#include "entity.h"
#include "script.h"
-#include "audio.h"
-#include "structures.h"
+#include "sound.h"
#include "functions.h"
extern void sub_08095CB0(Entity*);
diff --git a/src/npc/vaatiReborn.c b/src/npc/vaatiReborn.c
index 89c9ce8f..3ed28ca8 100644
--- a/src/npc/vaatiReborn.c
+++ b/src/npc/vaatiReborn.c
@@ -1,9 +1,5 @@
#include "global.h"
#include "npc.h"
-#include "coord.h"
-#include "flags.h"
-#include "audio.h"
-#include "textbox.h"
#include "functions.h"
void VaatiRebornAction0(Entity* this);
diff --git a/src/npc/wheaton.c b/src/npc/wheaton.c
index ba154f41..3182eda3 100644
--- a/src/npc/wheaton.c
+++ b/src/npc/wheaton.c
@@ -1,5 +1,4 @@
#include "npc.h"
-#include "script.h"
extern Hitbox gUnk_0810C3C0;
diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c
index a0d979eb..ff20d96d 100644
--- a/src/npc/windTribespeople.c
+++ b/src/npc/windTribespeople.c
@@ -1,13 +1,7 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "npc.h"
-#include "textbox.h"
-#include "flags.h"
-#include "structures.h"
-#include "functions.h"
-#include "save.h"
-#include "script.h"
extern void sub_0806C7D4(Entity*);
@@ -33,8 +27,6 @@ extern u16 gUnk_08113B16[];
extern u8 gUnk_08113B38[];
-extern SpriteLoadData gUnk_08113A1C[];
-
void WindTribespeople(Entity* this) {
gUnk_08113A7C[this->action](this);
}
diff --git a/src/npc/zelda.c b/src/npc/zelda.c
index 4631a31e..b66b879a 100644
--- a/src/npc/zelda.c
+++ b/src/npc/zelda.c
@@ -1,13 +1,10 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "functions.h"
-#include "room.h"
#include "flags.h"
-#include "script.h"
#include "npc.h"
-extern Entity* DeepFindEntityByID(u32, u32);
void sub_08068680(Entity*, Entity*);
void sub_08068694(Entity*, Entity*);
extern Entity* GetEntityByType(u32, u32);
diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c
index 93d1ca3f..fc0890fb 100644
--- a/src/npc/zeldaFollower.c
+++ b/src/npc/zeldaFollower.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
-#include "script.h"
#include "utils.h"
extern void sub_08068318(Entity*);
diff --git a/src/npcDefinitions.c b/src/npcDefinitions.c
index 8851bb07..b6db7f31 100644
--- a/src/npcDefinitions.c
+++ b/src/npcDefinitions.c
@@ -180,11 +180,11 @@ const NPCDefinition gNPCDefinition_52[] = {
};
#endif
-#define MULTI_FORM(definition_ptr) \
- { \
- { 2, 0, 0, 0, 0, 0, 0 }, { \
- .definition = definition_ptr \
- } \
+#define MULTI_FORM(definition_ptr) \
+ { \
+ { 2, 0, 0, 0, 0, 0, 0 }, { \
+ .definition = (definition_ptr) \
+ } \
}
const NPCDefinition gNPCDefinitions[] = {
diff --git a/src/npcUtils.c b/src/npcUtils.c
index a1dca14f..e4739226 100644
--- a/src/npcUtils.c
+++ b/src/npcUtils.c
@@ -19,9 +19,6 @@ typedef struct {
} NPCData;
extern NPCData* gUnk_08001A7C[];
-u32 sub_0800445C(Entity*);
-void sub_08077B20(void);
-void sub_0806F69C(Entity*);
u32 sub_080041DC(Entity*, u32, u32);
u32 sub_0806EF88(Entity*);
@@ -161,7 +158,7 @@ u32 sub_0806EE70(Entity* ent) {
ent->field_0x46 = 0;
sub_0806EF14(ent);
}
- sub_0806F69C(ent);
+ LinearMoveUpdate(ent);
sub_0806EF4C(ent, xy);
tmp1 = sub_080041DC(ent, xy[0], xy[1]);
tmp2 = ent->speed;
diff --git a/src/object.c b/src/object.c
index 9a1f983e..819cb970 100644
--- a/src/object.c
+++ b/src/object.c
@@ -1,6 +1,4 @@
-#include "global.h"
#include "entity.h"
-#include "manager.h"
#include "object.h"
void (*const gObjectFunctions[])(Entity*) = {
diff --git a/src/object/archway.c b/src/object/archway.c
index d0ed7559..e05095d5 100644
--- a/src/object/archway.c
+++ b/src/object/archway.c
@@ -1,6 +1,5 @@
-#include "global.h"
#include "entity.h"
-#include "overworld.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 edd764d2..8d3263bc 100644
--- a/src/object/backgroundCloud.c
+++ b/src/object/backgroundCloud.c
@@ -1,5 +1,4 @@
#include "object.h"
-#include "functions.h"
extern void (*const gUnk_08121EA4[])(Entity*);
extern const u8 gUnk_08121EB0[];
@@ -27,7 +26,7 @@ void sub_0808F658(Entity* this) {
}
void sub_0808F6E0(Entity* this) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if ((s16)this->x.HALF.HI < (s16)this->field_0x78.HWORD || (s16)this->x.HALF.HI > (s16)this->field_0x7a.HWORD)
this->action = 2;
diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c
index 9118cb67..a26b7aae 100644
--- a/src/object/bigVortex.c
+++ b/src/object/bigVortex.c
@@ -3,7 +3,6 @@
#include "flags.h"
#include "object.h"
#include "functions.h"
-#include "effects.h"
extern void sub_08098E3C(Entity*);
extern void sub_08098E88(Entity*);
diff --git a/src/object/bird.c b/src/object/bird.c
index 9a131075..07a696cf 100644
--- a/src/object/bird.c
+++ b/src/object/bird.c
@@ -43,7 +43,7 @@ void sub_0809CF54(Entity* this) {
void sub_0809CFEC(Entity* this) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
GravityUpdate(this, *(s16*)&this->field_0x68.HWORD);
if (this->actionDelay != 0) {
if (--this->actionDelay == 0) {
diff --git a/src/object/book.c b/src/object/book.c
index 25faf3ab..2ad7a40b 100644
--- a/src/object/book.c
+++ b/src/object/book.c
@@ -1,7 +1,6 @@
#include "object.h"
#include "functions.h"
-#include "script.h"
-#include "textbox.h"
+#include "message.h"
extern void (*const BookActionFuncs[])(Entity*);
extern s8 const gUnk_08123D94[];
@@ -117,7 +116,7 @@ void sub_0809B524(Entity* this) {
}
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
void sub_0809B56C(Entity* this) {
diff --git a/src/object/button.c b/src/object/button.c
index 1db2cafb..21c31891 100644
--- a/src/object/button.c
+++ b/src/object/button.c
@@ -39,7 +39,6 @@ void sub_08081B84(Entity* this) {
}
u32 sub_08081CB0(Entity*);
-void RequestPriorityDuration(Entity*, u32);
void sub_08081FF8(Entity*);
void sub_08081BAC(Entity* this) {
diff --git a/src/object/cloud.c b/src/object/cloud.c
index 22494391..5ff9bf6b 100644
--- a/src/object/cloud.c
+++ b/src/object/cloud.c
@@ -81,7 +81,7 @@ void sub_0809F5F0(Entity* this) {
void sub_0809F61C(Entity* this) {
- if ((gRoomControls.unk6 & 4) == 0) {
+ if ((gRoomControls.scroll_flags & 4) == 0) {
if (this->actionDelay == 30) {
SetLocalFlag(this->type2);
}
@@ -112,7 +112,7 @@ void sub_0809F69C(Entity* this) {
void sub_0809F6CC(Entity* this) {
- if (((gRoomControls.unk6 & 4) == 0) && (--this->actionDelay == 0)) {
+ if (((gRoomControls.scroll_flags & 4) == 0) && (--this->actionDelay == 0)) {
gPlayerState.controlMode = 1;
DeleteThisEntity();
}
@@ -132,7 +132,7 @@ void sub_0809F700(Entity* this) {
this->spriteOffsetX = gUnk_081247C0[uVar2 & 7];
this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7];
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (--this->actionDelay == 0) {
DeleteThisEntity();
}
diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c
index 345e8a2b..ab9e6567 100644
--- a/src/object/fileScreenObjects.c
+++ b/src/object/fileScreenObjects.c
@@ -1,9 +1,7 @@
#include "object.h"
#include "main.h"
#include "menu.h"
-#include "npc.h"
#include "fileScreen.h"
-#include "structures.h"
#include "functions.h"
extern int sub_0807A094(int);
@@ -506,7 +504,7 @@ static u32 sub_0808EF6C(Entity* this) {
}
this->speed = var7;
this->direction = sub_080045DA(var0, var2) >> 3;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
return 1;
}
diff --git a/src/object/fireplace.c b/src/object/fireplace.c
index 1fda4e9f..a4513cb8 100644
--- a/src/object/fireplace.c
+++ b/src/object/fireplace.c
@@ -1,10 +1,9 @@
#include "object.h"
-#include "script.h"
#include "functions.h"
extern void (*gUnk_08123D98[])(Entity*);
-void sub_0809B7A0(Entity* e);
+void sub_0809B7A0(Entity* this);
void sub_0809B7DC(Entity* this);
void sub_0809B7C0(Entity* this);
diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c
index ccb1adbf..a8c02b02 100644
--- a/src/object/greatFairy.c
+++ b/src/object/greatFairy.c
@@ -1,7 +1,6 @@
#include "object.h"
#include "save.h"
#include "script.h"
-#include "structures.h"
#include "functions.h"
#include "screen.h"
@@ -422,7 +421,7 @@ void sub_080871F8(Entity* this) {
this->action = 2;
} else {
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, temp->x.HALF.HI, temp->y.HALF.HI - 32);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
@@ -437,7 +436,7 @@ void sub_08087240(Entity* this) {
void sub_08087264(Entity* this) {
if (this->actionDelay != 0) {
this->actionDelay--;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
}
@@ -464,7 +463,7 @@ void sub_080872AC(Entity* this) {
void sub_080872F8(Entity* this) {
s32 temp;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
GetNextFrame(this);
if (((u16)(this->field_0x68.HWORD - this->x.HALF.HI) > 0xc) ||
((u16)(this->field_0x6a.HWORD - this->y.HALF.HI) > 0xc)) {
@@ -526,7 +525,7 @@ void sub_080873FC(void) {
void sub_08087424(Entity* this, ScriptExecutionContext* context) {
Entity* ent;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
ent = CreateObject(OBJECT_64, 0, 0);
if (ent != NULL) {
ent->parent = &gPlayerEntity;
diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c
index b0fb32e1..433fb87e 100644
--- a/src/object/heartContainer.c
+++ b/src/object/heartContainer.c
@@ -1,5 +1,4 @@
-#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
diff --git a/src/object/hiddenLadderDown.c b/src/object/hiddenLadderDown.c
index 7d1c7abd..55831a80 100644
--- a/src/object/hiddenLadderDown.c
+++ b/src/object/hiddenLadderDown.c
@@ -1,7 +1,7 @@
#include "global.h"
+#include "asm.h"
#include "entity.h"
#include "functions.h"
-#include "room.h"
#include "flags.h"
extern void (*const gUnk_08122604[])(Entity*);
diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c
index 137b19a5..77736989 100644
--- a/src/object/houseDoorExterior.c
+++ b/src/object/houseDoorExterior.c
@@ -3,7 +3,7 @@
#include "flags.h"
#include "room.h"
#include "script.h"
-#include "audio.h"
+#include "sound.h"
#include "object.h"
#include "functions.h"
#include "npc.h"
diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c
index c062d75b..d0874cba 100644
--- a/src/object/itemOnGround.c
+++ b/src/object/itemOnGround.c
@@ -1,10 +1,11 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "flags.h"
#include "player.h"
#include "object.h"
#include "functions.h"
+#include "item.h"
void sub_08081150(Entity*);
u8 sub_0808147C(u32);
@@ -87,7 +88,7 @@ void sub_08080F20(Entity* this) {
DeleteThisEntity();
}
- if (this->type != 0x60) {
+ if (this->type != ITEM_FAIRY) {
this->spriteSettings.draw = 1;
this->spritePriority.b1 = 3;
this->spriteSettings.shadow = 0;
@@ -97,16 +98,16 @@ void sub_08080F20(Entity* this) {
this->health = 0xFF;
this->hitbox = &gUnk_080FD1A8;
switch (this->type) {
- case 0x3f:
- case 0x54:
- case 0x55:
- case 0x56:
- case 0x57:
- case 0x58:
- case 0x5c:
- case 0x5d:
- case 0x5e:
- case 0x5f:
+ case ITEM_SHELLS:
+ case ITEM_RUPEE1:
+ case ITEM_RUPEE5:
+ case ITEM_RUPEE20:
+ case ITEM_RUPEE50:
+ case ITEM_RUPEE100:
+ case ITEM_KINSTONE:
+ case ITEM_BOMBS5:
+ case ITEM_ARROWS5:
+ case ITEM_HEART:
this->flags2 = 0x17;
break;
default:
@@ -124,12 +125,11 @@ void sub_08080F20(Entity* this) {
gUnk_0811E7E8[this->field_0x68.HALF.HI](this);
} else {
Entity* entity = CreateObject(FAIRY, 0x60, 0);
- if (entity) {
+ if (entity != NULL) {
entity->actionDelay = 0;
if (this->actionDelay == 1) {
entity->type2 = 2;
}
-
CopyPosition(this, entity);
DeleteThisEntity();
}
@@ -153,12 +153,12 @@ void sub_080810A8(Entity* this) {
}
if (this->collisionLayer == 2) {
- sub_08016A30(this);
+ ResolveCollisionLayer(this);
}
}
void sub_080810FC(Entity* this) {
- if (this->type != 0x5F) {
+ if (this->type != ITEM_HEART) {
sub_08081598(this);
} else {
this->action = 2;
@@ -188,7 +188,7 @@ void sub_08081188(Entity* this) {
this->action = 2;
COLLISION_ON(this);
if (this->collisionLayer == 2) {
- sub_08016A30(this);
+ ResolveCollisionLayer(this);
}
}
@@ -212,7 +212,7 @@ void sub_080811EC(Entity* this) {
if (this->field_0x68.HALF.HI != 6) {
sub_080AEFE0(this);
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
GravityUpdate(this, 0x2800);
@@ -271,7 +271,8 @@ void sub_080812E8(Entity* this) {
#ifdef EU
if ((playerState->swimState & 0x80) && sub_080177A0(this, &gPlayerEntity)) {
#else
- if ((playerState->swimState & 0x80) && !(playerState->flags & 0x80) && sub_080177A0(this, &gPlayerEntity)) {
+ if ((playerState->swimState & 0x80) && (playerState->flags & PL_MINISH) == 0 &&
+ sub_080177A0(this, &gPlayerEntity)) {
#endif
sub_080810FC(this);
}
diff --git a/src/object/jailBars.c b/src/object/jailBars.c
index da5844e5..84b44b61 100644
--- a/src/object/jailBars.c
+++ b/src/object/jailBars.c
@@ -2,7 +2,7 @@
#include "entity.h"
#include "flags.h"
#include "room.h"
-#include "audio.h"
+#include "sound.h"
extern void sub_080A0960(Entity*, u32);
extern void sub_0801AF18(u8*, u32, u32);
diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c
index 54716b5e..639ffa17 100644
--- a/src/object/lightableSwitch.c
+++ b/src/object/lightableSwitch.c
@@ -1,5 +1,6 @@
#include "global.h"
-#include "audio.h"
+#include "asm.h"
+#include "sound.h"
#include "entity.h"
#include "room.h"
#include "flags.h"
@@ -83,7 +84,7 @@ void sub_0809EB30(Entity* this) {
if (this->type2 != 0) {
if ((this->direction & 0x80) == 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
puVar2 = &this->field_0x74.HWORD;
if (!--*puVar2) {
diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c
index fccc8b5f..6f23a9d8 100644
--- a/src/object/lockedDoor.c
+++ b/src/object/lockedDoor.c
@@ -1,10 +1,11 @@
#include "global.h"
+#include "asm.h"
#include "entity.h"
#include "flags.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
#include "effects.h"
-#include "overworld.h"
+#include "game.h"
void sub_08083338(Entity*);
void sub_080834B4(Entity*);
@@ -37,7 +38,6 @@ extern Hitbox gHitbox_2;
extern u32 sub_080001DA(u32, u32);
extern void sub_08078850(Entity*, u32, u32, u32);
-extern void RequestPriorityDuration(Entity*, u32);
typedef struct PACKED {
s8 x;
@@ -153,7 +153,7 @@ void sub_080834B4(Entity* this) {
}
void sub_080834EC(Entity* this) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (--this->actionDelay == 0) {
if (this->type & 0x80) {
sub_08083638(this);
@@ -171,7 +171,7 @@ void sub_08083518(Entity* this) {
}
void sub_08083540(Entity* this) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (!--this->actionDelay) {
if (this->type & 0x10) {
this->type &= ~0x10;
diff --git a/src/object/mask.c b/src/object/mask.c
index 854cd5c2..be794b54 100644
--- a/src/object/mask.c
+++ b/src/object/mask.c
@@ -1,5 +1,4 @@
#include "object.h"
-#include "structures.h"
#include "functions.h"
extern void (*MaskActionFuncs[])(Entity*);
diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c
index 531d41b9..ed89d276 100644
--- a/src/object/metalDoor.c
+++ b/src/object/metalDoor.c
@@ -1,8 +1,9 @@
#include "global.h"
+#include "asm.h"
#include "entity.h"
#include "room.h"
#include "flags.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
#include "effects.h"
@@ -50,7 +51,7 @@ void sub_080A074C(Entity* this) {
u8 bVar1;
Entity* ent;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (--this->actionDelay == 0) {
this->action = 3;
@@ -84,7 +85,7 @@ void sub_080A07BC(Entity* this) {
void sub_080A07F0(Entity* this) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (--this->actionDelay == 0) {
DeleteThisEntity();
diff --git a/src/object/minecart.c b/src/object/minecart.c
index 619e1a7b..39d1ce44 100644
--- a/src/object/minecart.c
+++ b/src/object/minecart.c
@@ -80,7 +80,7 @@ void sub_080917DC(Entity* this) {
gPlayerEntity.speed = 0x100;
gPlayerEntity.flags &= ~PL_MINISH;
ResetPlayer();
- sub_0807A108();
+ DeleteClones();
SoundReq(SFX_PLY_JUMP);
}
} else {
@@ -140,7 +140,7 @@ void sub_080919AC(Entity* this) {
} else {
COLLISION_ON(this);
gPlayerEntity.speed = 0;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1;
if (!sub_08091DDC(this)) {
diff --git a/src/object/minishLight.c b/src/object/minishLight.c
index d7fc7bb4..a316e499 100644
--- a/src/object/minishLight.c
+++ b/src/object/minishLight.c
@@ -1,4 +1,3 @@
-#include "global.h"
#include "entity.h"
extern void (*const gUnk_081247F8[])(Entity*);
diff --git a/src/object/minishSizedArchway.c b/src/object/minishSizedArchway.c
index ad001c83..d087c8dc 100644
--- a/src/object/minishSizedArchway.c
+++ b/src/object/minishSizedArchway.c
@@ -1,6 +1,5 @@
-#include "global.h"
#include "entity.h"
-#include "overworld.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 5b891dd0..36d8e27a 100644
--- a/src/object/minishSizedEntrance.c
+++ b/src/object/minishSizedEntrance.c
@@ -1,5 +1,5 @@
#include "object.h"
-#include "overworld.h"
+#include "game.h"
#include "functions.h"
extern void (*const gUnk_08122254[])(Entity*);
diff --git a/src/object/object1D.c b/src/object/object1D.c
index f7343fbe..f1e13a00 100644
--- a/src/object/object1D.c
+++ b/src/object/object1D.c
@@ -1,4 +1,3 @@
-#include "global.h"
#include "entity.h"
extern void (*gUnk_081208A0[])(Entity*);
diff --git a/src/object/object2A.c b/src/object/object2A.c
index 9e36b439..5ef7ba3e 100644
--- a/src/object/object2A.c
+++ b/src/object/object2A.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "functions.h"
#include "flags.h"
diff --git a/src/object/object49.c b/src/object/object49.c
index 4b4be720..43dcda88 100644
--- a/src/object/object49.c
+++ b/src/object/object49.c
@@ -1,5 +1,4 @@
#include "object.h"
-#include "structures.h"
#include "functions.h"
static void sub_0808F2B0(Entity*);
diff --git a/src/object/object6A.c b/src/object/object6A.c
index 340a36b0..13b93cce 100644
--- a/src/object/object6A.c
+++ b/src/object/object6A.c
@@ -2,7 +2,7 @@
#include "object.h"
#include "area.h"
#include "script.h"
-#include "textbox.h"
+#include "message.h"
#include "functions.h"
#include "screen.h"
@@ -556,7 +556,7 @@ void sub_08095288(Object6AEntity* this) {
} else {
sub_0805EC9C(super, 0x100, 0x100, super->actionDelay << 8);
super->actionDelay += 10;
- sub_0806F69C(super);
+ LinearMoveUpdate(super);
}
}
p = super->child;
diff --git a/src/object/object86.c b/src/object/object86.c
index 62d30b6b..e6968b42 100644
--- a/src/object/object86.c
+++ b/src/object/object86.c
@@ -1,8 +1,6 @@
#include "object.h"
-#include "functions.h"
void sub_08099ECC(Entity*);
-extern void RequestPriorityDuration(Entity*, u32);
extern void sub_0805B390(u32);
extern void (*const gUnk_081237F8[])(Entity*);
diff --git a/src/object/objectA.c b/src/object/objectA.c
index 8578c1be..c302382e 100644
--- a/src/object/objectA.c
+++ b/src/object/objectA.c
@@ -4,7 +4,7 @@
#include "flags.h"
#include "object.h"
#include "functions.h"
-#include "overworld.h"
+#include "game.h"
extern Hitbox gHitbox_2;
diff --git a/src/object/objectA2.c b/src/object/objectA2.c
index c3ad215b..f8f212f5 100644
--- a/src/object/objectA2.c
+++ b/src/object/objectA2.c
@@ -40,7 +40,7 @@ void sub_0809F318(Entity* this) {
}
void sub_0809F374(Entity* this) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
#ifndef EU
if (gSaveHeader->gameLanguage < 2) {
if (sub_080044EC(this, 0x2000) < 2) {
diff --git a/src/object/objectA8.c b/src/object/objectA8.c
index fbba13c3..ef00c9df 100644
--- a/src/object/objectA8.c
+++ b/src/object/objectA8.c
@@ -1,4 +1,3 @@
-#include "global.h"
#include "entity.h"
#include "player.h"
#include "functions.h"
diff --git a/src/object/objectB2.c b/src/object/objectB2.c
index 75150bab..b40c73b6 100644
--- a/src/object/objectB2.c
+++ b/src/object/objectB2.c
@@ -23,7 +23,7 @@ void ObjectB2(Entity* this) {
InitializeAnimation(this, this->type);
}
this->speed = this->parent->speed;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (sub_080AE4CC(this->child, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) {
DeleteThisEntity();
}
diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c
index 6e69a7db..9a50f902 100644
--- a/src/object/octorokBossObject.c
+++ b/src/object/octorokBossObject.c
@@ -1,6 +1,6 @@
#include "functions.h"
#include "object.h"
-#include "overworld.h"
+#include "game.h"
extern void sub_0807B9B8(s32, s32, s32);
@@ -38,7 +38,7 @@ enum OctorokBossObjectType {
TYPE8, // OctorokBoss_Hit_SubAction1
TYPE9 // OctorokBoss_Hit_SubAction4
};
-#define GET_HELPER(this) (*(HelperStruct**)&this->cutsceneBeh)
+#define GET_HELPER(this) (*(HelperStruct**)&(this)->cutsceneBeh)
extern u32 sub_0806FC80(Entity*, Entity*, s32);
diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c
index b44f5a8c..519b96a3 100644
--- a/src/object/pinwheel.c
+++ b/src/object/pinwheel.c
@@ -3,8 +3,6 @@
#include "flags.h"
#include "object.h"
-extern u32 ReadBit(u32*, u32);
-
extern u32 gUnk_020342F8;
extern u16 gUnk_08125050[];
extern void (*gUnk_0812505C[])(Entity*);
diff --git a/src/object/pot.c b/src/object/pot.c
index d7a7ae96..bf94a8be 100644
--- a/src/object/pot.c
+++ b/src/object/pot.c
@@ -1,12 +1,11 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "flags.h"
#include "player.h"
#include "room.h"
#include "object.h"
#include "functions.h"
-#include "effects.h"
void sub_08082824(Entity*);
static void sub_08082850(Entity*, Entity*);
@@ -45,7 +44,7 @@ void sub_0808222C(Entity* this) {
this->flags2 = 0x84;
this->field_0x1c = 0x12;
if (this->collisionLayer == 0) {
- sub_08016A30(this);
+ ResolveCollisionLayer(this);
}
this->field_0x70.HALF.LO = sub_080001DA(COORD_TO_TILE(this), this->collisionLayer);
@@ -175,7 +174,7 @@ void sub_08082614(Entity* this) {
sub_0800445C(this);
if (--this->actionDelay != 0xFF) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
sub_08016A6C(this);
return;
}
diff --git a/src/object/railtrack.c b/src/object/railtrack.c
index 223a5603..d92a9546 100644
--- a/src/object/railtrack.c
+++ b/src/object/railtrack.c
@@ -1,5 +1,6 @@
#include "global.h"
-#include "audio.h"
+#include "asm.h"
+#include "sound.h"
#include "entity.h"
#include "room.h"
#include "flags.h"
diff --git a/src/object/smoke.c b/src/object/smoke.c
index d603ea1c..7fed0867 100644
--- a/src/object/smoke.c
+++ b/src/object/smoke.c
@@ -43,7 +43,7 @@ void sub_0808A484(Entity* this) {
void sub_0808A4D0(Entity* this) {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (this->frame & 0x80) {
DeleteEntity(this);
}
diff --git a/src/object/swordsmanNewsletter.c b/src/object/swordsmanNewsletter.c
index 1cca2ba0..d71fd1f8 100644
--- a/src/object/swordsmanNewsletter.c
+++ b/src/object/swordsmanNewsletter.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "entity.h"
-#include "textbox.h"
+#include "message.h"
extern void sub_080787B4(Entity*);
diff --git a/src/object/thoughtBubble.c b/src/object/thoughtBubble.c
index e90cfbd7..57ba5cae 100644
--- a/src/object/thoughtBubble.c
+++ b/src/object/thoughtBubble.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "entity.h"
-#include "audio.h"
+#include "sound.h"
extern void (*const ThoughtBubble_Behaviors[])(Entity*);
diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c
index 69db7173..d88f1c8e 100644
--- a/src/object/treeHidingPortal.c
+++ b/src/object/treeHidingPortal.c
@@ -1,10 +1,9 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "flags.h"
#include "player.h"
#include "room.h"
-#include "structures.h"
#include "functions.h"
#include "effects.h"
diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c
index bd5fc8cf..bfa09ca0 100644
--- a/src/object/warpPoint.c
+++ b/src/object/warpPoint.c
@@ -1,9 +1,6 @@
#include "global.h"
#include "object.h"
-#include "player.h"
-#include "flags.h"
-#include "overworld.h"
-#include "audio.h"
+#include "game.h"
#include "functions.h"
extern Hitbox gHitbox_1;
@@ -11,7 +8,6 @@ extern Hitbox gHitbox_1;
extern void sub_0807CAC8(u32);
extern u32 sub_0807CAEC(u32);
-void WarpPoint(Entity*);
void sub_0808B474(Entity*);
void sub_0808B530(Entity*);
void sub_0808B564(Entity*);
@@ -212,7 +208,7 @@ 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) {
if (this->actionDelay == 0 && gPlayerEntity.action == PLAYER_08072C9C) {
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
return 1;
}
diff --git a/src/object/well.c b/src/object/well.c
index 86710ac6..dfc61a9c 100644
--- a/src/object/well.c
+++ b/src/object/well.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "asm.h"
#include "entity.h"
#include "room.h"
#include "player.h"
diff --git a/src/object/windcrest.c b/src/object/windcrest.c
index 3ebaef24..15828253 100644
--- a/src/object/windcrest.c
+++ b/src/object/windcrest.c
@@ -1,9 +1,8 @@
#include "global.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "save.h"
#include "script.h"
-#include "functions.h"
#include "effects.h"
extern void sub_08078850(Entity*, u32, u32, u8*);
diff --git a/src/objectUtils.c b/src/objectUtils.c
index 3fb4da3c..86fe0a2c 100644
--- a/src/objectUtils.c
+++ b/src/objectUtils.c
@@ -3,7 +3,6 @@
#include "coord.h"
#include "room.h"
#include "object.h"
-#include "effects.h"
#include "functions.h"
#include "definitions.h"
diff --git a/src/player.c b/src/player.c
index 53cbe00b..3a12ef17 100644
--- a/src/player.c
+++ b/src/player.c
@@ -1,27 +1,41 @@
#include "global.h"
#include "asm.h"
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "player.h"
-#include "textbox.h"
+#include "message.h"
#include "utils.h"
#include "area.h"
#include "item.h"
#include "save.h"
#include "object.h"
#include "functions.h"
-#include "object.h"
-#include "effects.h"
#include "hitbox.h"
-#include "overworld.h"
+#include "game.h"
#include "screen.h"
#include "main.h"
+#define GRAVITY_RATE 0x2000
+#define SLOPE_SPEED_MODIFIER 0x50
+
+#define JUMP_SPEED_FWD 0x100
+#define BOUNCE_SPEED_FWD 0x100
+#define BOUNCE_SPEED_Z 0x20000
+#define HOLE_SPEED_FWD 0x78
+#define HOLE_SPEED_Z 0x1a000
+#define PULL_SPEED 0x80
+#define PUSH_SPEED 0x80
+#define ROLL_SPEED 0x200
+
+#define PIT_DAMAGE 0x2
+
+#define DEFAULT_ANIM 0x100
+
typedef void(EntityAction)(Entity*);
static EntityAction PlayerInit;
static EntityAction PlayerNormal;
-static EntityAction PlayerInit;
+// static EntityAction PlayerInit;
static EntityAction PlayerFall;
static EntityAction PlayerJump;
static EntityAction PlayerPush;
@@ -44,7 +58,7 @@ static EntityAction PlayerUsePortal;
static EntityAction PlayerTalkEzlo;
static EntityAction PlayerRoomTransition;
static EntityAction PlayerRoll;
-static EntityAction sub_080728AC;
+static EntityAction PlayerWaitForScroll;
static EntityAction PlayerInHole;
static EntityAction sub_08072C9C;
static EntityAction sub_08074C44;
@@ -182,7 +196,7 @@ static EntityAction sub_080737BC;
static EntityAction sub_0807380C;
static EntityAction sub_08073884;
-// sub_08073904... ?
+// DoJump... ?
static EntityAction sub_08073924;
static EntityAction sub_08073968;
static EntityAction sub_080739EC;
@@ -221,9 +235,8 @@ static EntityAction sub_080751B4;
static void sub_080717F8(Entity*);
static void ResetPlayerPriority();
-static void sub_080728AC(Entity*);
-static void BreakOut();
-static void sub_08073AD4();
+static void BreakOut(Entity* this);
+static void sub_08073AD4(Entity* this);
static void sub_08073B60(Entity*);
static void sub_08074244(Entity*, u32, u32);
static void hide(Entity*);
@@ -237,8 +250,7 @@ void SurfaceAction_AutoLadder(Entity*);
extern void RespawnPlayer();
extern void sub_080797EC();
-extern void sub_08079E08();
-extern void ResetPlayerVelocity();
+extern void UpdatePlayerMovement();
extern void sub_08077698();
extern void sub_08079258();
extern void EnablePlayerDraw();
@@ -246,7 +258,6 @@ extern u32 sub_08079B24();
extern void sub_08079708();
extern void sub_080792D8();
extern Entity* CreatePlayerBomb();
-extern void sub_080791BC();
extern u32 sub_0806F854();
extern u32 sub_08019840();
extern void sub_08079744();
@@ -259,14 +270,13 @@ extern void sub_08078F24();
extern void sub_0807B068();
extern u32 sub_080001DA();
extern u32 sub_0807A2F8();
-extern u32 CheckIsOverworld();
extern u32 sub_0806F730();
extern u32 sub_08007DD6();
extern u32 GetSurfaceCalcType();
-extern void sub_08074808();
-extern void sub_08073904(Entity*);
+extern void sub_08074808(Entity* this);
+extern void DoJump(Entity*);
extern void SetZeldaFollowTarget(Entity*);
-extern u32 ItemIsSword(u32);
+u32 ItemIsSword(u32 item);
extern u32 sub_0807A2B8();
extern u32 sub_08079550(u32);
extern u32 sub_080782C0();
@@ -274,6 +284,8 @@ extern u32 sub_080793E4(u32);
extern void sub_08008AC6(Entity*);
extern u32 sub_08079C30(Entity*);
extern void sub_08077AEC();
+extern u32 RunQueuedAction();
+extern void UpdatePlayerSkills();
extern ScreenTransitionData gUnk_0813AB58;
extern ScreenTransitionData gUnk_0813AD88[];
@@ -312,7 +324,7 @@ void DoPlayerAction(Entity* this) {
[PLAYER_TALKEZLO] = PlayerTalkEzlo,
[PLAYER_ROOMTRANSITION] = PlayerRoomTransition,
[PLAYER_ROLL] = PlayerRoll,
- [PLAYER_080728AC] = sub_080728AC,
+ [PLAYER_080728AC] = PlayerWaitForScroll,
[PLAYER_INHOLE] = PlayerInHole,
[PLAYER_08072C9C] = sub_08072C9C,
[PLAYER_08074C44] = sub_08074C44,
@@ -337,20 +349,20 @@ static void PlayerInit(Entity* this) {
this->hitbox = (Hitbox*)&gPlayerHitbox;
this->spriteIndex = 1;
#ifndef EU
- gPlayerState.animation = 0x100;
+ gPlayerState.animation = DEFAULT_ANIM;
#endif
sub_0806FDA0(this);
LoadSwapGFX(this, 1, 2);
InitAnimationForceUpdate(this, 2);
if (this->collisionLayer == 0) {
- sub_08016A30(this);
+ ResolveCollisionLayer(this);
}
if (IsItemEquipped(ITEM_LANTERN_ON) != 2) {
sub_08077728();
}
- sub_0807A108();
- sub_0807AEE4();
+ DeleteClones();
+ UpdatePlayerSkills();
if (RunQueuedAction() == 0) {
sub_0807921C();
@@ -358,10 +370,10 @@ static void PlayerInit(Entity* this) {
if (gPlayerState.swimState != 0) {
Entity* ent;
gPlayerState.swimState = 1;
- sub_08079938();
+ ResolvePlayerAnimation();
gPlayerState.framestate = PL_STATE_SWIM;
sub_0807ACCC(this);
- ent = FindEntity(0x6, 0xf, 0x6, 0xb, 0x0);
+ ent = FindEntity(OBJECT, SPECIAL_FX, 0x6, FX_WATER_SPLASH, 0x0);
if (ent != NULL) {
DeleteEntity(ent);
}
@@ -376,10 +388,10 @@ static void sub_08070BEC(Entity* this, u32 r0) {
if (r0 & 1)
sub_080797EC();
else
- sub_08079938();
+ ResolvePlayerAnimation();
if (r0 & 2)
- sub_08079E08();
+ UpdatePlayerMovement();
}
static void PlayerFall(Entity* this) {
@@ -414,15 +426,15 @@ static void PlayerFallInit(Entity* this) {
COLLISION_OFF(this);
this->spritePriority.b1 = 0;
ResetPlayer();
- sub_0807A108();
+ DeleteClones();
SoundReq(SFX_PLY_VO7);
SoundReq(SFX_FALL_HOLE);
}
static void PlayerFallUpdate(Entity* this) {
UpdateAnimationSingleFrame(this);
- if ((this->frame & 0x80) != 0) {
- if ((gSave.stats.health != 0) && ((gPlayerState.flags & 0x8000) != 0)) {
+ if (this->frame & 0x80) {
+ if ((gSave.stats.health != 0) && (gPlayerState.flags & 0x8000)) {
gPlayerState.flags &= ~(PL_BUSY | PL_DROWNING);
this->spriteSettings.draw = 0;
} else {
@@ -430,7 +442,7 @@ static void PlayerFallUpdate(Entity* this) {
RespawnPlayer();
gPlayerState.field_0xa = 0;
this->iframes = 32;
- ModHealth(-2);
+ ModHealth(-PIT_DAMAGE);
}
}
}
@@ -447,19 +459,19 @@ static void PlayerBounce(Entity* this) {
static void PlayerBounceInit(Entity* this) {
COLLISION_OFF(this);
this->direction = DirectionTurnAround(Direction8FromAnimationState(AnimationStateWalk(this->animationState)));
- this->speed = 0x100;
+ this->speed = BOUNCE_SPEED_FWD;
this->knockbackDuration = 0;
this->subAction++;
this->actionDelay = gPlayerState.field_0x38;
this->spriteIndex = 1;
if ((gPlayerState.flags & PL_MINISH) == 0) {
- this->zVelocity = 0x20000;
+ this->zVelocity = BOUNCE_SPEED_Z;
gPlayerState.animation = 0x114;
InitScreenShake(16, 0);
} else {
gPlayerState.animation = 0xc18;
- this->zVelocity = 0x18000;
+ this->zVelocity = (BOUNCE_SPEED_Z * 3) / 4;
}
gPlayerState.jumpStatus = 0x80;
@@ -472,10 +484,10 @@ static void PlayerBounceInit(Entity* this) {
static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void PlayerBounceUpdate(Entity* this)) {
UpdateAnimationSingleFrame(this);
sub_080085B0(this);
- sub_08079E08();
+ UpdatePlayerMovement();
UpdateFloorType();
- if (RunQueuedAction() || GravityUpdate(this, 0x2000))
+ if (RunQueuedAction() || GravityUpdate(this, GRAVITY_RATE))
return;
gPlayerState.jumpStatus = 0;
@@ -485,7 +497,7 @@ static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void PlayerBounceUpd
if (gPlayerState.swimState != 0) {
gPlayerState.jumpStatus = 0;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
return;
}
@@ -498,8 +510,8 @@ static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void PlayerBounceUpd
if ((gPlayerState.field_0x14 == 0) && sub_08008B22()) {
gPlayerState.field_0x11 = 7;
- sub_08079938();
- sub_080791BC();
+ ResolvePlayerAnimation();
+ SetPlayerActionNormal();
return;
}
@@ -508,14 +520,14 @@ static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void PlayerBounceUpd
this->subAction++;
if ((gPlayerState.flags & PL_MINISH) == 0)
- gPlayerState.animation = 0x100;
+ gPlayerState.animation = DEFAULT_ANIM;
}
END_NONMATCH
static void sub_08070E7C(Entity* this) {
if (--this->actionDelay == 0) {
gPlayerState.jumpStatus = 0;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
}
@@ -542,7 +554,7 @@ static void sub_08070EDC(Entity* this) {
this->subAction = 1;
if ((gPlayerState.flags & PL_MINISH) == 0)
- sub_08079938();
+ ResolvePlayerAnimation();
else
gPlayerState.animation = 0xc18;
}
@@ -551,7 +563,7 @@ static void sub_08070f24(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((gMessage.doTextBox & 0x7f) == 0) {
this->updatePriority = this->updatePriorityPrev;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
}
@@ -625,7 +637,7 @@ static void sub_08071038(Entity* this) {
this->knockbackDuration = 0;
this->iframes = 248;
gPlayerState.jumpStatus = 0;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
}
@@ -653,7 +665,6 @@ static void PlayerJumpInit(Entity* this) {
if ((gPlayerState.heldObject | gPlayerState.field_0x1a[1]) == 0) {
if ((gPlayerState.flags & PL_MINISH) == 0) {
ResetPlayer();
-
if (gPlayerState.flags & PL_NO_CAP) {
gPlayerState.animation = 0x420;
} else {
@@ -669,8 +680,8 @@ static void PlayerJumpInit(Entity* this) {
asm("lsl r0, r0, #0x4");
this->zVelocity = (temp - 4) * 64 * 64;
- this->speed = 256;
- sub_0807A108();
+ this->speed = JUMP_SPEED_FWD;
+ DeleteClones();
SoundReq(SFX_PLY_JUMP);
SoundReq(SFX_PLY_VO4);
}
@@ -686,16 +697,16 @@ static void sub_08071130(Entity* this) {
return;
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
- if (GravityUpdate(this, 0x2000))
+ if (GravityUpdate(this, GRAVITY_RATE))
return;
gPlayerState.jumpStatus = 0;
- sub_0800455E(this);
+ ResetCollisionLayer(this);
if (*(Entity**)&this->field_0x74 != NULL)
- sub_0800455E(*(Entity**)&this->field_0x74);
+ ResetCollisionLayer(*(Entity**)&this->field_0x74);
sub_08008790(this, 7);
@@ -709,7 +720,7 @@ static void sub_08071130(Entity* this) {
if ((sub_08079D48() == 0) || (gPlayerState.swimState != 0)) {
gPlayerState.jumpStatus = 0;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
return;
}
@@ -739,7 +750,7 @@ static void sub_08071208(Entity* this) {
if (--this->actionDelay == 0xff) {
gPlayerState.jumpStatus = 0;
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
}
@@ -830,7 +841,7 @@ static void PlayerUsePortal(Entity* this) {
DoFade(7, 16);
SoundReq(SFX_F8);
} else {
- sub_0804ACF8();
+ RespawnAsMinish();
}
}
@@ -846,11 +857,11 @@ static void PortalJumpOnUpdate(Entity* this) {
if ((this->x.HALF.HI != x) || (this->y.HALF.HI != y)) {
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gArea.curPortalX, gArea.curPortalY);
- this->speed = 256;
- sub_08079E08();
+ this->speed = JUMP_SPEED_FWD;
+ UpdatePlayerMovement();
}
- sub_08073904(this);
+ DoJump(this);
UpdateAnimationSingleFrame(this);
if (gPlayerState.jumpStatus == 0) {
@@ -886,7 +897,7 @@ static void PortalStandUpdate(Entity* this) {
this->direction = gPlayerState.field_0xd;
this->animationState = Direction8ToAnimationState(this->direction);
this->zVelocity = 0x20000;
- this->speed = 256;
+ this->speed = JUMP_SPEED_FWD;
this->action = PLAYER_MINISH;
this->subAction = 7;
this->field_0xf = 0;
@@ -907,7 +918,7 @@ static void PortalStandUpdate(Entity* this) {
} else {
sub_08077698(this);
}
- sub_08079938();
+ ResolvePlayerAnimation();
}
static void PortalActivateInit(Entity* this) {
@@ -953,7 +964,7 @@ static ASM_FUNC("asm/non_matching/player/PortalShrinkUpdate.inc", void PortalShr
static void PortalEnterUpdate(Entity* this) {
if (this->actionDelay == 0) {
- if (GravityUpdate(this, 0x2000))
+ if (GravityUpdate(this, GRAVITY_RATE))
return;
this->spriteSettings.draw = FALSE;
@@ -991,16 +1002,14 @@ static void sub_080717F8(Entity* this) {
0, -22, 22, 0, 0, 22, -22, 0,
};
- u32 x;
- u32 y;
this->animationState = gArea.curPortalExitDirection << 1;
this->x.HALF.HI = gArea.curPortalX + sOffsets[gArea.curPortalExitDirection * 2];
this->y.HALF.HI = gArea.curPortalY + sOffsets[gArea.curPortalExitDirection * 2 + 1];
gArea.unk1A = 0xb4;
gUnk_02034490[0] = 0;
- this->action = 9;
+ this->action = PLAYER_MINISH;
this->subAction = 0;
- gPlayerState.flags = (gPlayerState.flags & ~PL_USE_PORTAL) | 0x80;
+ gPlayerState.flags = (gPlayerState.flags & ~PL_USE_PORTAL) | PL_MINISH;
sub_0805EC60(this);
ResetPlayerEventPriority();
}
@@ -1049,7 +1058,7 @@ static void PlayerTalkEzloInit(Entity* this) {
return;
}
- if (!GravityUpdate(this, 0x2000))
+ if (!GravityUpdate(this, GRAVITY_RATE))
gPlayerState.jumpStatus = 0;
}
@@ -1076,7 +1085,6 @@ static void sub_08071990(Entity* this) {
if ((gMessage.doTextBox & 0x7f) == 0) {
this->subAction++;
-
if ((gPlayerState.flags & PL_MINISH) == 0) {
if (this->animationState == IdleEast)
gPlayerState.animation = 0x3cd;
@@ -1120,7 +1128,7 @@ static void sub_08071A4C(Entity* this) {
}
static void ResetPlayerPriority(void) {
- gPriorityHandler.sys_priority = 0;
+ gPriorityHandler.sys_priority = PRIO_MIN;
gPlayerEntity.updatePriority = gPlayerEntity.updatePriorityPrev;
}
@@ -1136,16 +1144,15 @@ static void PlayerPush(Entity* this) {
}
static void PlayerPushInit(Entity* this) {
- u32 speed;
-
this->subAction++;
gPlayerState.flags |= PL_BUSY;
if (this->type == 1) {
+ // scripted push?
this->speed = 0;
this->actionDelay = 0;
this->field_0xf = 1;
} else {
- this->speed = (gPlayerState.flags & PL_MINISH) ? 64 : 128;
+ this->speed = (gPlayerState.flags & PL_MINISH) ? PUSH_SPEED / 2 : PUSH_SPEED;
}
PlayerPushUpdate(this);
}
@@ -1156,11 +1163,25 @@ static void PlayerPushUpdate(Entity* this) {
u16 speed;
} PushFrame;
- static const PushFrame sPushFrames[] = { { 5, 0x0 }, { 1, 0x100 }, { 5, 0x0 }, { 1, 0x100 }, { 2, 0x0 },
- { 1, 0x100 }, { 2, 0x0 }, { 1, 0x100 }, { 3, 0x0 }, { 1, 0x100 },
- { 8, 0x60 }, { 8, 0x60 }, { 8, 0x60 }, { 8, 0x40 }, { 0xFF, 0x0 } };
+ static const PushFrame sPushFrames[] = {
+ { 5, 0 },
+ { 1, PUSH_SPEED * 2 },
+ { 5, 0 },
+ { 1, PUSH_SPEED * 2 },
+ { 2, 0 },
+ { 1, PUSH_SPEED * 2 },
+ { 2, 0 },
+ { 1, PUSH_SPEED * 2 },
+ { 3, 0 },
+ { 1, PUSH_SPEED * 2 },
+ { 8, PUSH_SPEED * 3 / 4 },
+ { 8, PUSH_SPEED * 3 / 4 },
+ { 8, PUSH_SPEED * 3 / 4 },
+ { 8, PUSH_SPEED / 2 },
+ { 0xFF, 0 },
+ };
- gPlayerState.field_0x80 = 0;
+ gPlayerState.speed_modifier = 0;
UpdateAnimationSingleFrame(this);
if (this->type == 1) {
if (--this->field_0xf == 0) {
@@ -1179,7 +1200,7 @@ static void PlayerPushUpdate(Entity* this) {
this->subAction++;
}
}
- sub_08079E08();
+ UpdatePlayerMovement();
}
static void sub_08071B60(Entity* this) {
@@ -1187,7 +1208,7 @@ static void sub_08071B60(Entity* this) {
gPlayerState.flags &= ~PL_BUSY;
this->type = 0;
this->knockbackDuration = 0;
- sub_080728AC(this);
+ PlayerWaitForScroll(this);
this->field_0xf = 6;
if ((gPlayerState.flags & PL_MINISH) == 0) {
gPlayerState.animation = 0x104;
@@ -1215,7 +1236,7 @@ static void PlayerMinishDieInit(Entity* this) {
if (gPlayerState.flags & (0x10 | 0x100))
return;
- if (GravityUpdate(this, 0x2000)) {
+ if (GravityUpdate(this, GRAVITY_RATE)) {
if (gPlayerState.flags & PL_NO_CAP)
gPlayerState.animation = 0x420;
else
@@ -1229,7 +1250,7 @@ static void PlayerMinishDieInit(Entity* this) {
gPlayerState.floor_type == SURFACE_MINISH_DOOR_BACK || gPlayerState.floor_type == SURFACE_A) {
EnablePlayerDraw(this);
RespawnPlayer();
- this->action = 10;
+ this->action = PLAYER_MINISHDIE;
}
temp = 0xc1a;
} else {
@@ -1299,12 +1320,12 @@ static void sub_08071D04(Entity* this) {
static void sub_08071D80(Entity* this) {
UpdateAnimationSingleFrame(this);
gPlayerState.field_0x14 = 1;
- sub_08073904(this);
+ DoJump(this);
if ((gPlayerState.jumpStatus & 7) == 3) {
gPlayerState.jumpStatus = 0;
this->iframes = 226;
ResetPlayerEventPriority();
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
}
@@ -1323,7 +1344,7 @@ static void sub_08071DD0(Entity* this) {
if (gPlayerState.field_0x39 != 0) {
gPlayerState.field_0x39 = 0;
this->subAction = 2;
- gPlayerState.animation = 0x100;
+ gPlayerState.animation = DEFAULT_ANIM;
} else {
this->subAction = 1;
gPlayerState.animation = 0x114;
@@ -1336,7 +1357,7 @@ static void sub_08071E04(Entity* this) {
if (gPlayerState.floor_type == SURFACE_PIT) {
gPlayerState.field_0x11 = 7;
gPlayerState.flags |= PL_FALLING;
- sub_080791BC();
+ SetPlayerActionNormal();
return;
}
}
@@ -1354,17 +1375,17 @@ static void sub_08071E04(Entity* this) {
this->actionDelay -= 1;
if ((s8)this->actionDelay < 1)
- sub_080791BC();
+ SetPlayerActionNormal();
}
static void sub_08071E74(Entity* this) {
u32 temp;
- GravityUpdate(this, 0x2000);
- sub_08079E08();
+ GravityUpdate(this, GRAVITY_RATE);
+ UpdatePlayerMovement();
temp = this->actionDelay--;
if (temp == 0)
- sub_080791BC();
+ SetPlayerActionNormal();
}
static void PlayerEmptyBottle(Entity* this) {
@@ -1426,7 +1447,7 @@ static void PlayerFrozenInit(Entity* this) {
}
static void PlayerFrozenUpdate(Entity* this) {
- if (GravityUpdate(this, 0x2000) == 0) {
+ if (GravityUpdate(this, GRAVITY_RATE) == 0) {
UpdateSpriteForCollisionLayer(this);
gPlayerState.jumpStatus = 0;
if (gPlayerState.field_0x14 == 0) {
@@ -1461,7 +1482,7 @@ static void BreakOut(Entity* this) {
this->spriteOffsetX = 0;
gPlayerState.flags &= ~(PL_FROZEN | PL_BUSY);
CreateFx(this, FX_ICE, 0);
- sub_080791BC();
+ SetPlayerActionNormal();
}
static void sub_0807204C(Entity* this) {
@@ -1493,7 +1514,7 @@ static void sub_08072098(Entity* this) {
if (this->health != 0)
COLLISION_ON(this);
- sub_080791BC();
+ SetPlayerActionNormal();
}
static void sub_080720DC(Entity* this) {
@@ -1529,12 +1550,12 @@ static void sub_08072168(Entity* this) {
u32 i;
UpdateAnimationSingleFrame(this);
- i = (u16)sub_0806F854(this, 0, -12) ? 0x4000 : 0x2000;
+ i = (u16)sub_0806F854(this, 0, -12) ? GRAVITY_RATE * 2 : GRAVITY_RATE;
GravityUpdate(this, i);
if (gPlayerState.field_0x3a) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else {
- sub_08079E08();
+ UpdatePlayerMovement();
}
gPlayerState.field_0xd = this->direction;
sub_08019840();
@@ -1542,7 +1563,7 @@ static void sub_08072168(Entity* this) {
this->knockbackDuration = 0;
COLLISION_ON(this);
UpdateSpriteForCollisionLayer(this);
- sub_080791BC();
+ SetPlayerActionNormal();
}
}
@@ -1559,7 +1580,7 @@ static void PlayerPull(Entity* this) {
static void sub_08072214(Entity* this) {
this->subAction = 1;
- this->speed = 128;
+ this->speed = PULL_SPEED;
this->actionDelay = gPlayerState.field_0x38;
this->direction = Direction8FromAnimationState(AnimationStateTurnAround(this->animationState));
if ((gPlayerState.flags & PL_NO_CAP) == 0) {
@@ -1572,8 +1593,8 @@ static void sub_08072214(Entity* this) {
}
static void sub_08072260(Entity* this) {
- gPlayerState.field_0x80 = 0;
- sub_08079E08();
+ gPlayerState.speed_modifier = 0;
+ UpdatePlayerMovement();
UpdateAnimationSingleFrame(this);
if (--this->actionDelay == 0) {
gPlayerState.flags &= ~PL_BUSY;
@@ -1583,7 +1604,7 @@ static void sub_08072260(Entity* this) {
gPlayerState.animation = 0x944;
}
this->knockbackDuration = 0;
- sub_080791BC();
+ SetPlayerActionNormal();
}
}
@@ -1626,7 +1647,7 @@ static void sub_08072354(Entity* this) {
sub_0806F854(this, 0, -12);
UpdateAnimationSingleFrame(this);
sub_08079744(this);
- if (GravityUpdate(this, 0x2000))
+ if (GravityUpdate(this, GRAVITY_RATE))
return;
this->spritePriority.b1 = 0;
@@ -1679,11 +1700,11 @@ static void sub_0807246C(Entity* this) {
static void sub_08072490(Entity* this) {
if (--this->actionDelay != 0xff) {
UpdateAnimationSingleFrame(this);
- sub_08079E08();
+ UpdatePlayerMovement();
} else {
this->iframes = 60;
ModHealth(-8);
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
}
@@ -1697,14 +1718,14 @@ static void PlayerRoomTransition(Entity* this) {
static void sub_080724DC(Entity* this) {
this->knockbackDuration = 0;
- sub_0807A108();
+ DeleteClones();
if (sub_080002B8(this) != 0x29) {
if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swimState != 0)) {
sub_0807AE20(this);
}
if (gRoomControls.unk2 == 0) {
this->updatePriority = this->updatePriorityPrev;
- sub_080728AC(this);
+ PlayerWaitForScroll(this);
} else if (gPlayerState.field_0x1c == 0) {
UpdateAnimationSingleFrame(this);
}
@@ -1725,12 +1746,12 @@ static void sub_080724DC(Entity* this) {
static void sub_0807258C(Entity* this) {
if (gRoomControls.unk2 == 0) {
if (sub_0807A894(this) == 0x29) {
- sub_08079E08();
+ UpdatePlayerMovement();
if (sub_080797C4() != 0) {
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
this->updatePriority = this->updatePriorityPrev;
- sub_080728AC(this);
+ PlayerWaitForScroll(this);
} else {
UpdateAnimationSingleFrame(this);
}
@@ -1738,7 +1759,7 @@ static void sub_0807258C(Entity* this) {
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
this->updatePriority = this->updatePriorityPrev;
- sub_080728AC(this);
+ PlayerWaitForScroll(this);
}
}
if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swimState != 0)) {
@@ -1794,7 +1815,7 @@ static void PlayerRollUpdate(Entity* this) {
if (RunQueuedAction())
return;
- sub_080728AC(this);
+ PlayerWaitForScroll(this);
return;
}
@@ -1822,7 +1843,7 @@ static void PlayerRollUpdate(Entity* this) {
if (gPlayerState.flags & (PL_FALLING | PL_HIDDEN | 0x10)) {
gPlayerState.flags &= ~PL_ROLLING;
- sub_080728AC(this);
+ PlayerWaitForScroll(this);
return;
}
@@ -1833,21 +1854,21 @@ static void PlayerRollUpdate(Entity* this) {
switch (this->frame & 0xf) {
case 0:
if ((this->frame & 0xf) == 0) {
- this->speed = 0x200;
+ this->speed = ROLL_SPEED;
}
break;
case 1:
- this->speed += 0x20;
+ this->speed += ROLL_SPEED / 16;
break;
case 2:
- this->speed = 0x300;
+ this->speed = (ROLL_SPEED * 3 / 2);
break;
case 3:
this->speed = 0;
break;
}
sub_08078F24();
- sub_08079E08();
+ UpdatePlayerMovement();
}
if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) {
// dont take damage
@@ -1857,7 +1878,7 @@ static void PlayerRollUpdate(Entity* this) {
sub_08077698(this);
}
if ((this->frame & 0x80) || (gPlayerState.field_0x3[1] != 0)) {
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
if (this->frame & 0x80) {
gPlayerState.flags &= ~(PL_RELEASED | PL_ROLLING);
@@ -1865,8 +1886,8 @@ static void PlayerRollUpdate(Entity* this) {
UpdateAnimationSingleFrame(this);
}
-static void sub_080728AC(Entity* this) {
- sub_08079938();
+static void PlayerWaitForScroll(Entity* this) {
+ ResolvePlayerAnimation();
if (gPlayerState.flags & PL_MINISH)
sub_0807B068(this);
else
@@ -1879,10 +1900,10 @@ static void sub_080728AC(Entity* this) {
if ((gPlayerState.flags & PL_MINISH) == 0)
gPlayerEntity.spritePriority.b1 = 1;
- if ((gRoomControls.unk6 & 4) == 0) {
+ if ((gRoomControls.scroll_flags & 4) == 0) {
if (gPlayerState.flags & PL_HIDDEN)
COLLISION_ON(this);
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
}
if ((gPlayerState.flags & 2) == 0) {
UpdateFloorType();
@@ -1950,8 +1971,8 @@ static void sub_08072ACC(Entity* this) {
} else if (this->field_0xf > 7) {
COLLISION_ON(this);
this->direction = gPlayerState.field_0xd;
- this->zVelocity = 0x1a000;
- this->speed = 120;
+ this->zVelocity = HOLE_SPEED_Z;
+ this->speed = HOLE_SPEED_FWD;
this->spritePriority.b0 = 4;
this->spritePriority.b1 = 1;
gPlayerState.jumpStatus = 0x41;
@@ -2003,8 +2024,8 @@ static void sub_08072B5C(Entity* this) {
static void sub_08072C48(Entity* this) {
UpdateAnimationSingleFrame(this);
- sub_0806F69C(this);
- if (GravityUpdate(this, 0x2000))
+ LinearMoveUpdate(this);
+ if (GravityUpdate(this, GRAVITY_RATE))
return;
sub_08008790(this, 7);
@@ -2012,7 +2033,7 @@ static void sub_08072C48(Entity* this) {
if (sub_08008B22()) {
gPlayerState.field_0x11 = 7;
if (!(gPlayerState.flags & PL_MINISH)) {
- sub_080791BC();
+ SetPlayerActionNormal();
}
}
} else {
@@ -2044,7 +2065,7 @@ static void sub_08072CC0(Entity* this) {
static void sub_08072CFC(Entity* this) {
sub_080042BA(this, 2);
if (--this->field_0xf != 0xff) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
return;
}
@@ -2074,12 +2095,11 @@ static const u16* const sTileTable[] = {
static NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(Entity* this)) {
u32 bVar1;
u32 uVar2;
- u32 iVar3;
UpdateAnimationSingleFrame(this);
sub_0806F854(this, 0, -12);
if (this->actionDelay != 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else {
uVar2 = sub_0806F730(this);
uVar2 = GetTileType(uVar2, this->collisionLayer);
@@ -2098,9 +2118,9 @@ static NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(En
break;
case 3:
if (this->actionDelay == 0) {
- sub_08079E08();
+ UpdatePlayerMovement();
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
break;
case 2:
@@ -2121,18 +2141,18 @@ static NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(En
}
if (this->actionDelay != 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else {
- sub_08079E08();
+ UpdatePlayerMovement();
}
this->actionDelay = 0;
}
this->actionDelay = bVar1;
- if (!GravityUpdate(this, 0x2000)) {
+ if (!GravityUpdate(this, GRAVITY_RATE)) {
COLLISION_ON(this);
if (this->collisionLayer == 1) {
- sub_0800455E(this);
+ ResetCollisionLayer(this);
} else {
sub_08004542(this);
}
@@ -2141,7 +2161,7 @@ static NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(En
if (sub_08008B22() == 0) {
gPlayerState.field_0x11 = 7;
if (!(gPlayerState.flags & PL_MINISH)) {
- sub_080791BC();
+ SetPlayerActionNormal();
}
}
} else {
@@ -2251,7 +2271,7 @@ static void sub_08073094(Entity* this) {
this->spritePriority.b1 = 0;
this->speed = sSpeeds[this->frame & 0xf];
- sub_08079E08();
+ UpdatePlayerMovement();
if (!sub_08019840()) {
gPlayerState.pushedObject ^= 0x80;
if ((gPlayerState.floor_type != SURFACE_AUTO_LADDER) && (gPlayerState.floor_type != SURFACE_2C)) {
@@ -2274,7 +2294,7 @@ static void sub_08073094(Entity* this) {
break;
case SURFACE_WATER:
sub_08074808(this);
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
break;
default:
sub_0807921C();
@@ -2342,7 +2362,7 @@ static void sub_080731D8(Entity* this) {
gPlayerState.animation = 260;
}
gRoomControls.cameraTarget = NULL;
- sub_0807A108();
+ DeleteClones();
ResetPlayer();
}
@@ -2350,7 +2370,7 @@ static void sub_080732D0(Entity* this) {
UpdateAnimationSingleFrame(this);
if (sub_080002B8(this) != 40) {
this->direction = DirectionNorth;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else {
this->subAction++;
this->y.HALF.LO = 0;
@@ -2377,17 +2397,17 @@ static void sub_0807332C(Entity* this) {
} else {
this->animationState = 6;
if (this->direction <= DirectionWest) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
return;
}
this->direction = (this->direction - 1) & 0x1F;
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
return;
}
if (gPlayerState.field_0x38 != 0) {
gRoomControls.cameraTarget = this;
- sub_080791BC();
+ SetPlayerActionNormal();
} else {
gMain.transition = 3;
*(&gMain.pauseInterval + 1) = 1;
@@ -2412,7 +2432,7 @@ static void sub_080733BC(Entity* this) {
}
}
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (this->field_0x7c.HALF_U.HI == this->y.HALF.HI) {
gRoomControls.cameraTarget = this;
sub_0807921C();
@@ -2450,7 +2470,7 @@ static void sub_08073468(Entity* this) {
}
static void sub_080734D4(Entity* this) {
- GravityUpdate(this, -0x1000);
+ GravityUpdate(this, -(GRAVITY_RATE / 2));
if (this->zVelocity > 0 || gPlayerState.field_0x38 == 1) {
this->zVelocity = 0x49000;
this->subAction++;
@@ -2458,7 +2478,7 @@ static void sub_080734D4(Entity* this) {
}
static void sub_08073504(Entity* this) {
- GravityUpdate(this, this->zVelocity < 0 ? 0x800 : 0x4000);
+ GravityUpdate(this, this->zVelocity < 0 ? GRAVITY_RATE / 4 : GRAVITY_RATE * 2);
if (this->zVelocity < 0 && this->z.HALF.HI > -32) {
this->subAction++;
*((u32*)&this->field_0x80.HWORD) = this->direction << 8;
@@ -2497,7 +2517,7 @@ static NONMATCH("asm/non_matching/player/sub_08073584.inc", void sub_08073584(En
(gPlayerState.flags & PL_PARACHUTE) == 0) {
gPlayerState.jumpStatus |= 0x40;
sub_0807921C();
- sub_08073904(this);
+ DoJump(this);
gPlayerState.animation = 1840;
return;
}
@@ -2521,7 +2541,7 @@ static NONMATCH("asm/non_matching/player/sub_08073584.inc", void sub_08073584(En
}
}
this->direction = (*(u32*)&this->field_0x80 >> 8) & 0x1F;
- sub_08079E08();
+ UpdatePlayerMovement();
state = 4 * this->animationState;
dir = this->direction;
if (this->animationState == 0) {
@@ -2595,7 +2615,7 @@ static void sub_080737BC(Entity* this) {
u32 tmp;
UpdateAnimationSingleFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->z.WORD += 0x4C00;
if (DirectionIsHorizontal(this->direction))
pos = this->x.HALF.HI;
@@ -2624,7 +2644,7 @@ static void sub_0807380C(Entity* this) {
}
gPlayerState.animation = sAnims[this->animationState >> 1];
if (this->z.HALF.HI < -16) {
- GravityUpdate(this, 0x200);
+ GravityUpdate(this, GRAVITY_RATE / 16);
} else {
if (--this->actionDelay == 0) {
this->subAction = 7;
@@ -2655,11 +2675,11 @@ void sub_08073884(Entity* this) {
else
InitParachuteRoom();
}
- GravityUpdate(this, -0x1800);
+ GravityUpdate(this, -((GRAVITY_RATE * 3) / 4));
UpdateAnimationSingleFrame(this);
}
-void sub_08073904(Entity* this) {
+void DoJump(Entity* this) {
static EntityAction* const sStates[] = {
sub_08073924, sub_08073968, sub_080739EC, sub_08073A94, sub_08073B8C, sub_08073C30,
};
@@ -2709,13 +2729,13 @@ static void sub_080739EC(Entity* this) {
gPlayerState.field_0xd = this->direction;
if (gPlayerState.jumpStatus & 0x80)
this->collisions = 0;
- v = 0x2000;
+ v = GRAVITY_RATE;
} else {
if ((u16)sub_0806F854(this, 0, -12)) {
gPlayerState.jumpStatus |= 8;
- v = 0x4000;
+ v = GRAVITY_RATE * 2;
} else {
- v = 0x2000;
+ v = GRAVITY_RATE;
if (gPlayerState.jumpStatus & 0x10)
v /= 2;
}
@@ -2775,10 +2795,10 @@ static void sub_08073B60(Entity* this) {
gPlayerState.field_0x1a[1] = 0;
gPlayerState.field_0x3[1] = 0;
gPlayerState.jumpStatus = 0;
- sub_08079938();
+ ResolvePlayerAnimation();
sub_080085B0(this);
if ((gPlayerState.flags & PL_USE_PORTAL) == 0) {
- sub_080791BC();
+ SetPlayerActionNormal();
}
}
@@ -2795,7 +2815,7 @@ void sub_08073B8C(Entity* this) {
--this->actionDelay;
return;
}
- GravityUpdate(this, 0x4000);
+ GravityUpdate(this, GRAVITY_RATE * 2);
if (this->z.HALF.HI >= -8) {
if (!gPlayerState.field_0x14 && (sub_0807A2B8() || !sub_08079D48())) {
COLLISION_ON(this);
@@ -2865,7 +2885,7 @@ static void sub_08073D20(Entity* this) {
return;
}
if (!RunQueuedAction()) {
- sub_08073904(this);
+ DoJump(this);
UpdateFloorType();
if (gPlayerState.jumpStatus)
gPlayerState.framestate = PL_STATE_CAPE;
@@ -2891,19 +2911,19 @@ static void sub_08073D20(Entity* this) {
}
if (!sub_08019840()) {
sub_08077698(this);
- if (!GravityUpdate(this, 0x2000))
+ if (!GravityUpdate(this, GRAVITY_RATE))
gPlayerState.jumpStatus = 0;
if ((gPlayerState.field_0x7 & 0x80) == 0 && !gPlayerState.field_0xa) {
if (this->iframes <= 8) {
if (gPlayerState.swimState) {
gPlayerState.framestate = PL_STATE_SWIM;
sub_0807ACCC(this);
- sub_08079E08();
+ UpdatePlayerMovement();
} else {
this->direction = gPlayerState.field_0xd;
if ((gPlayerState.field_0xd & 0x80) == 0) {
gPlayerState.framestate = PL_STATE_WALK;
- sub_08079E08(1);
+ UpdatePlayerMovement();
}
}
}
@@ -2945,7 +2965,7 @@ static void sub_08073F4C(Entity* this) {
if (this->x.HALF.HI != x || this->y.HALF.HI != y) {
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gArea.curPortalX, gArea.curPortalY);
this->speed = 0x100;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else {
COLLISION_OFF(this);
this->actionDelay = 30;
@@ -2969,7 +2989,7 @@ static void sub_08073FD0(Entity* this) {
SoundReq(SFX_PLY_JUMP);
}
}
- GravityUpdate(this, 0x2000);
+ GravityUpdate(this, GRAVITY_RATE);
if (this->zVelocity == 0) {
this->subAction++;
SoundReq(SFX_PLY_GROW);
@@ -2988,7 +3008,7 @@ static void sub_08074018(Entity* this) {
}
static void sub_08074060(Entity* this) {
- if (!GravityUpdate(this, 0x2000)) {
+ if (!GravityUpdate(this, GRAVITY_RATE)) {
this->hitbox = (Hitbox*)&gPlayerHitbox;
this->direction = DirectionSouth;
this->animationState = IdleSouth;
@@ -3042,13 +3062,15 @@ static NONMATCH("asm/non_matching/player/sub_080740D8.inc", void sub_080740D8(En
v6 = this->y.HALF.HI;
v1 = v6 + v5->offset_y - gRoomControls.roomOriginY;
break;
+ default:
+ break;
}
if (sub_080086B4(v2, v1, gUnk_080082DC))
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
else
this->field_0xf = 1;
- if (!GravityUpdate(this, 0x2000))
+ if (!GravityUpdate(this, GRAVITY_RATE))
sub_0807921C();
}
END_NONMATCH
@@ -3075,11 +3097,11 @@ void SurfaceAction_Pit(Entity* this) {
}
void SurfaceAction_SlopeGndGndVertical(Entity* this) {
- sub_08074244(this, 8, 0x18);
+ sub_08074244(this, DirectionEast, DirectionWest);
}
void SurfaceAction_SlopeGndGndHorizontal(Entity* this) {
- sub_08074244(this, 0, 0x10);
+ sub_08074244(this, DirectionNorth, DirectionSouth);
}
static void sub_08074244(Entity* this, u32 a1, u32 a2) {
@@ -3096,7 +3118,7 @@ static void sub_08074244(Entity* this, u32 a1, u32 a2) {
tmp = 4 * this->animationState;
}
if (a1 != tmp || a2 != tmp) {
- gPlayerState.field_0x80 -= 80;
+ gPlayerState.speed_modifier -= SLOPE_SPEED_MODIFIER;
}
}
}
@@ -3170,7 +3192,7 @@ void SurfaceAction_14(Entity* this) {
this->speed = 0x300;
this->direction = 16;
gPlayerState.field_0xa |= 0x80;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->speed = spd;
}
}
@@ -3199,6 +3221,7 @@ void SurfaceAction_CloneTile(Entity* this) {
n = 3;
break;
default:
+ //! @bug: n is not initialized
break;
}
for (i = 0; i < n; ++i) {
@@ -3206,7 +3229,7 @@ void SurfaceAction_CloneTile(Entity* this) {
break;
}
if (n > i) {
- Entity* e = CreateObjectWithParent(this, 0x10, i, 0);
+ Entity* e = CreateObjectWithParent(this, OBJECT_10, i, 0);
gPlayerClones[i] = e;
if (e != NULL) {
CopyPosition(this, e);
@@ -3361,7 +3384,7 @@ void SurfaceAction_Ladder(Entity* this) {
}
void SurfaceAction_2C(Entity* this) {
- if (GetInventoryValue(68) == 1) {
+ if (GetInventoryValue(ITEM_GRIP_RING) == 1) {
SurfaceAction_AutoLadder(this);
} else {
this->y.HALF.HI &= 0xFFF0;
@@ -3405,7 +3428,7 @@ void SurfaceAction_22(Entity* this) {
void SurfaceAction_Dust(Entity* this) {
if (!sub_080741C4()) {
- gPlayerState.field_0x80 -= 128;
+ gPlayerState.speed_modifier -= 128;
if (gPlayerState.field_0x11 == 1 || (gPlayerState.field_0x92 & 0xF00) != 0) {
if (gPlayerState.floor_type == SURFACE_DUST)
CreateObjectWithParent(this, OBJECT_21, 1, 0);
@@ -3474,7 +3497,7 @@ static void sub_08074BF8(Entity* this) {
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.field_0x27[0]++;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
}
static void sub_08074C44(Entity* this) {
@@ -3520,7 +3543,7 @@ static void sub_08074CF8(Entity* this) {
sub_08074D34(this, *(ScriptExecutionContext**)&this->cutsceneBeh.HWORD);
if ((this->field_0x82.HWORD & 1) != 0)
this->animationState = v3;
- GravityUpdate(this, 0x2000);
+ GravityUpdate(this, GRAVITY_RATE);
UpdateAnimationSingleFrame(this);
}
@@ -3529,11 +3552,13 @@ void sub_08074D34(Entity* this, ScriptExecutionContext* ctx) {
u32 bit = (~ctx->postScriptActions + 1) & ctx->postScriptActions;
ctx->postScriptActions ^= bit;
switch (bit) {
+ default:
+ break;
case 0x1:
if (gPlayerState.flags & PL_NO_CAP)
gPlayerState.animation = 0x400;
else
- gPlayerState.animation = 0x100;
+ gPlayerState.animation = DEFAULT_ANIM;
break;
case 0x2:
if (gPlayerState.flags & PL_NO_CAP)
@@ -3640,7 +3665,7 @@ void sub_08074F8C(Entity* this) {
if (!gPlayerState.field_0x39) {
gPlayerState.animation = 1024;
} else {
- gPlayerState.animation = 256;
+ gPlayerState.animation = DEFAULT_ANIM;
}
}
}
@@ -3674,14 +3699,14 @@ void sub_0807501C(Entity* this) {
void sub_0807508C(Entity* this) {
UpdateAnimationSingleFrame(this);
- if (GravityUpdate(this, 0x2000)) {
- sub_0806F69C(this);
+ if (GravityUpdate(this, GRAVITY_RATE)) {
+ LinearMoveUpdate(this);
} else {
if (!gPlayerState.field_0x39) {
gPlayerState.animation = 1024;
} else {
gPlayerState.flags &= ~PL_NO_CAP;
- gPlayerState.animation = 256;
+ gPlayerState.animation = DEFAULT_ANIM;
}
if (--this->actionDelay == 0) {
this->animationState = IdleSouth;
@@ -3740,7 +3765,7 @@ void sub_080751B4(Entity* this) {
this->animationState = IdleSouth;
this->subAction = 1;
this->field_0x68.HALF.LO = 0;
- gPlayerState.animation = 256;
+ gPlayerState.animation = DEFAULT_ANIM;
}
}
@@ -3762,7 +3787,7 @@ NONMATCH("asm/non_matching/player/sub_080751E8.inc", void sub_080751E8(u32 a1, u
gPlayerState.field_0x38 = 1;
gPlayerState.field_0x39 = 0;
gPlayerState.field_0x3a = a2;
- gPlayerState.flags |= 8;
+ gPlayerState.flags |= PL_NO_CAP;
if (!a1) {
gPlayerState.field_0x39 = 0;
tmp = &script_BedInLinksRoom;
@@ -3778,7 +3803,7 @@ NONMATCH("asm/non_matching/player/sub_080751E8.inc", void sub_080751E8(u32 a1, u
e2 = CreateSpeechBubbleSleep(&gPlayerEntity, -14, -28);
*(Entity**)&gPlayerEntity.field_0x6c.HWORD = e2;
if (e2 != NULL) {
- SetDefaultPriority(e2, 3);
+ SetDefaultPriority(e2, PRIO_NO_BLOCK);
}
}
END_NONMATCH
@@ -3788,7 +3813,7 @@ void sub_0807529C(Entity* this) {
}
void sub_080752AC(Entity* this, ScriptExecutionContext* ctx) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (!ctx->unk_18) {
if (sub_080002B8(this) != 41) {
ctx->unk_18 = 1;
diff --git a/src/playerItem/playerItem11.c b/src/playerItem/playerItem11.c
index 242dc616..d8f3a3a7 100644
--- a/src/playerItem/playerItem11.c
+++ b/src/playerItem/playerItem11.c
@@ -2,7 +2,7 @@
#include "entity.h"
#include "player.h"
#include "functions.h"
-#include "audio.h"
+#include "sound.h"
extern void sub_08078CD0(Entity*);
extern void sub_08018FA0(Entity*);
diff --git a/src/playerItem/playerItem12.c b/src/playerItem/playerItem12.c
index 855fcef8..f2fc617a 100644
--- a/src/playerItem/playerItem12.c
+++ b/src/playerItem/playerItem12.c
@@ -1,7 +1,7 @@
#include "asm.h"
#include "entity.h"
#include "functions.h"
-#include "audio.h"
+#include "sound.h"
extern void (*const gUnk_0811B98C[])(Entity*);
@@ -24,7 +24,7 @@ void sub_0807037C(Entity* this) {
void sub_08070398(Entity* this) {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (GravityUpdate(this, 0x2000) == 0) {
DeleteThisEntity();
}
diff --git a/src/playerItem/playerItem14.c b/src/playerItem/playerItem14.c
index 0d241609..e48fd10b 100644
--- a/src/playerItem/playerItem14.c
+++ b/src/playerItem/playerItem14.c
@@ -1,8 +1,6 @@
#include "entity.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
-#include "player.h"
-#include "room.h"
#include "effects.h"
extern void (*const gUnk_08109AC8[])(Entity*);
@@ -30,7 +28,7 @@ void sub_0805FBE8(Entity* this) {
*(u32*)&this->field_0x6c = 0x3c;
InitializeAnimation(this, (this->animationState >> 1) + 0xc);
sub_0801766C(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
sub_0805FC74(this);
SoundReq(SFX_ITEM_SWORD_BEAM);
}
@@ -40,7 +38,7 @@ void sub_0805FC74(Entity* this) {
if (--*(int*)&this->field_0x6c != -1) {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->actionDelay++;
if (this->type2 == 0) {
sub_0800451C(this);
diff --git a/src/playerItem/playerItem15.c b/src/playerItem/playerItem15.c
index e90cf433..16d0e35c 100644
--- a/src/playerItem/playerItem15.c
+++ b/src/playerItem/playerItem15.c
@@ -1,5 +1,5 @@
#include "entity.h"
-#include "audio.h"
+#include "sound.h"
#include "coord.h"
#include "functions.h"
@@ -26,7 +26,7 @@ void sub_080A3084(Entity* this) {
this->direction = this->animationState << 2;
*(u32*)&this->field_0x6c = 0x3c;
sub_0801766C(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
SoundReq(SFX_ITEM_SWORD_BEAM);
} else {
this->actionDelay = 0x06;
diff --git a/src/playerItem/playerItem3.c b/src/playerItem/playerItem3.c
index 83fdea5a..beaf69a0 100644
--- a/src/playerItem/playerItem3.c
+++ b/src/playerItem/playerItem3.c
@@ -1,5 +1,5 @@
#include "entity.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
extern void (*const gUnk_080B77FC[])(Entity*);
@@ -47,7 +47,7 @@ void sub_0801B7A8(Entity* this) {
this->speed += 8;
}
this->direction = GetFacingDirection(this, &gPlayerEntity);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (sub_0800419C(this, &gPlayerEntity, 2, 2) != 0) {
DeleteThisEntity();
}
diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c
index c1295acd..1365afaf 100644
--- a/src/playerItem/playerItemBow.c
+++ b/src/playerItem/playerItemBow.c
@@ -27,7 +27,7 @@ void sub_08019410(Entity* this) {
void sub_08019444(Entity* this) {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (GravityUpdate(this, 0x2000) == 0) {
DeleteThisEntity();
}
diff --git a/src/playerItem/playerItemPacciCane.c b/src/playerItem/playerItemPacciCane.c
index 0b26c6fd..0e15c369 100644
--- a/src/playerItem/playerItemPacciCane.c
+++ b/src/playerItem/playerItemPacciCane.c
@@ -1,5 +1,5 @@
#include "entity.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
extern void (*const gUnk_0811B9D8[])(Entity*);
diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c
index d3e13b2f..0d72189d 100644
--- a/src/playerItem/playerItemSwordBeam.c
+++ b/src/playerItem/playerItemSwordBeam.c
@@ -2,7 +2,7 @@
#include "player.h"
#include "coord.h"
#include "functions.h"
-#include "audio.h"
+#include "sound.h"
#include "effects.h"
extern void (*const gUnk_080B43F4[])(Entity*);
@@ -56,7 +56,7 @@ void sub_08019498(Entity* this) {
InitializeAnimation(this, gUnk_080B43FC[this->animationState >> 1]);
sub_0801766C(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
sub_08019580(this);
SoundReq(SFX_ITEM_SWORD_BEAM);
}
@@ -64,7 +64,7 @@ void sub_08019498(Entity* this) {
void sub_08019580(Entity* this) {
if (--*(int*)&this->field_0x6c != -1) {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
this->actionDelay += 0x01;
if (this->type2 == 0) {
sub_0800451C(this);
diff --git a/src/playerItemUtils.c b/src/playerItemUtils.c
index de1d4989..be571896 100644
--- a/src/playerItemUtils.c
+++ b/src/playerItemUtils.c
@@ -1,12 +1,12 @@
#include "entity.h"
#include "functions.h"
-#include "room.h"
#include "save.h"
#include "utils.h"
-#include "audio.h"
+#include "sound.h"
#include "flags.h"
-#include "textbox.h"
+#include "message.h"
#include "object.h"
+#include "player.h"
Entity* GiveItemWithCutscene(u32, u32, u32);
Entity* sub_080A276C(Entity*, u32, u32);
diff --git a/src/projectile.c b/src/projectile.c
index c1891eb7..aaddbb1b 100644
--- a/src/projectile.c
+++ b/src/projectile.c
@@ -3,7 +3,7 @@
#include "hitbox.h"
#define MULTI_FORM(definition_ptr) \
- { 0xffff, 0, { .definition = definition_ptr }, 0, 0, 0 }
+ { 0xffff, 0, { .definition = (definition_ptr) }, 0, 0, 0 }
const ProjectileDefinition gProjectileDefinition_0[];
const ProjectileDefinition gProjectileDefinition_6[];
diff --git a/src/projectile/arrowProjectile.c b/src/projectile/arrowProjectile.c
index 845a839b..bdb0a214 100644
--- a/src/projectile/arrowProjectile.c
+++ b/src/projectile/arrowProjectile.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "audio.h"
#include "object.h"
extern s32 sub_080AF090(Entity*);
@@ -75,7 +74,7 @@ void ArrowProjectile_Action2(Entity* this) {
this->actionDelay = 0x20;
InitializeAnimation(this, this->animIndex + 2);
EnqueueSFX(0x18a);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else if (--this->actionDelay == 0) {
DeleteThisEntity();
}
diff --git a/src/projectile/ballAndChain.c b/src/projectile/ballAndChain.c
index bee0f066..281b04b6 100644
--- a/src/projectile/ballAndChain.c
+++ b/src/projectile/ballAndChain.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "functions.h"
-extern u8 gEntCount;
bool32 sub_080AB12C(Entity* this);
extern void (*const gUnk_0812A494[])(Entity*);
diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c
index d778558d..20c6e090 100644
--- a/src/projectile/boneProjectile.c
+++ b/src/projectile/boneProjectile.c
@@ -65,7 +65,7 @@ void BoneProjectile_Action2(Entity* this) {
void BoneProjectile_Action3(Entity* this) {
this->spriteSettings.draw ^= 1;
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
GetNextFrame(this);
if (sub_080044EC(this, 0x1800) == 0) {
DeleteEntity(this);
@@ -74,7 +74,7 @@ void BoneProjectile_Action3(Entity* this) {
void BoneProjectile_Action4(Entity* this) {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (GravityUpdate(this, 0x1800) == 0) {
DeleteEntity(this);
}
diff --git a/src/projectile/cannonballProjectile.c b/src/projectile/cannonballProjectile.c
index 25d79adf..449240e1 100644
--- a/src/projectile/cannonballProjectile.c
+++ b/src/projectile/cannonballProjectile.c
@@ -1,7 +1,5 @@
#include "entity.h"
#include "enemy.h"
-#include "functions.h"
-#include "effects.h"
extern void CreateItemOnGround(Entity*);
extern s32 sub_080AF090(Entity*);
diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c
index 120f2009..d84d0409 100644
--- a/src/projectile/dekuSeedProjectile.c
+++ b/src/projectile/dekuSeedProjectile.c
@@ -1,8 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "audio.h"
-#include "flags.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c
index 791dd040..a4a0d8e1 100644
--- a/src/projectile/dirtBallProjectile.c
+++ b/src/projectile/dirtBallProjectile.c
@@ -1,10 +1,9 @@
-#include "audio.h"
+#include "sound.h"
#include "entity.h"
#include "enemy.h"
#include "player.h"
#include "coord.h"
#include "functions.h"
-#include "effects.h"
extern void sub_08078954(Entity*);
diff --git a/src/projectile/fireProjectile.c b/src/projectile/fireProjectile.c
index 8526b91a..c44a9b89 100644
--- a/src/projectile/fireProjectile.c
+++ b/src/projectile/fireProjectile.c
@@ -2,7 +2,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c
index 6a25ec3e..7de99ca5 100644
--- a/src/projectile/gleerokProjectile.c
+++ b/src/projectile/gleerokProjectile.c
@@ -3,9 +3,6 @@
#include "enemy.h"
#include "player.h"
#include "functions.h"
-#include "asm.h"
-#include "audio.h"
-#include "effects.h"
extern void sub_0806F5BC(Entity*, u32, u32);
extern u32 sub_080041DC(Entity*, u32, u32);
@@ -96,7 +93,7 @@ void GleerokProjectile_Action1(Entity* this) {
}
} else {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if ((this->type != 2) && (--this->field_0xf == 0xff)) {
this->field_0xf = 0x1e;
sub_08004596(this, GetFacingDirection(this, &gPlayerEntity));
@@ -122,7 +119,7 @@ void GleerokProjectile_Action2(Entity* this) {
this->action = 3;
InitializeAnimation(this, 0x55);
} else {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
sub_080A90D8(this);
}
} else {
diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c
index a4a87308..02ecc3cd 100644
--- a/src/projectile/guardLineOfSight.c
+++ b/src/projectile/guardLineOfSight.c
@@ -61,7 +61,7 @@ void GuardLineOfSight(Entity* this) {
if (--this->actionDelay == 0) {
DeleteThisEntity();
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (sub_080AE4CC(&gUnk_02027EB4, this->x.HALF.HI, this->y.HALF.HI, 2) != 0) {
DeleteThisEntity();
}
diff --git a/src/projectile/guruguruBarProjectile.c b/src/projectile/guruguruBarProjectile.c
index de504cf5..fc88e2cf 100644
--- a/src/projectile/guruguruBarProjectile.c
+++ b/src/projectile/guruguruBarProjectile.c
@@ -1,6 +1,5 @@
#include "entity.h"
-#include "enemy.h"
#include "coord.h"
void sub_080AABB0(Entity*);
diff --git a/src/projectile/gyorgMaleEnergyProjectile.c b/src/projectile/gyorgMaleEnergyProjectile.c
index 65c67ba1..08946bc8 100644
--- a/src/projectile/gyorgMaleEnergyProjectile.c
+++ b/src/projectile/gyorgMaleEnergyProjectile.c
@@ -2,7 +2,6 @@
#include "enemy.h"
#include "coord.h"
#include "player.h"
-#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/projectile/gyorgTail.c b/src/projectile/gyorgTail.c
index 556087f7..c36bc6ad 100644
--- a/src/projectile/gyorgTail.c
+++ b/src/projectile/gyorgTail.c
@@ -1,7 +1,7 @@
#include "entity.h"
#include "asm.h"
#include "coord.h"
-#include "audio.h"
+#include "sound.h"
#include "functions.h"
extern u8 gEntCount;
diff --git a/src/projectile/iceProjectile.c b/src/projectile/iceProjectile.c
index 6e9a4ef7..52364a53 100644
--- a/src/projectile/iceProjectile.c
+++ b/src/projectile/iceProjectile.c
@@ -2,7 +2,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c
index 9fff58bd..ce7d2d21 100644
--- a/src/projectile/lakituCloudProjectile.c
+++ b/src/projectile/lakituCloudProjectile.c
@@ -1,8 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "player.h"
-#include "effects.h"
extern void SoundReqClipped(Entity*, u32);
extern void sub_08079D84(void);
diff --git a/src/projectile/lakituLightning.c b/src/projectile/lakituLightning.c
index 755d7bba..e6bb2cef 100644
--- a/src/projectile/lakituLightning.c
+++ b/src/projectile/lakituLightning.c
@@ -1,6 +1,5 @@
#include "entity.h"
#include "enemy.h"
-#include "effects.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c
index 43551110..e5b27454 100644
--- a/src/projectile/mandiblesProjectile.c
+++ b/src/projectile/mandiblesProjectile.c
@@ -2,9 +2,7 @@
#include "enemy.h"
#include "coord.h"
#include "functions.h"
-#include "audio.h"
-#include "asm.h"
-#include "overworld.h"
+#include "game.h"
extern Entity* sub_08049DF4(u32);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
@@ -202,7 +200,7 @@ void MandiblesProjectile_Action4(Entity* this) {
DeleteThisEntity();
}
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
UpdateAnimationSingleFrame(this);
}
diff --git a/src/projectile/mazaalEnergyBeam.c b/src/projectile/mazaalEnergyBeam.c
index 8d617ba3..6e284ccf 100644
--- a/src/projectile/mazaalEnergyBeam.c
+++ b/src/projectile/mazaalEnergyBeam.c
@@ -1,5 +1,5 @@
#include "entity.h"
-#include "audio.h"
+#include "sound.h"
#include "coord.h"
extern void (*const MazaalEnergyBeam_Actions[])(Entity*);
diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c
index d04903b5..b5ed8193 100644
--- a/src/projectile/octorokBossProjectile.c
+++ b/src/projectile/octorokBossProjectile.c
@@ -1,9 +1,6 @@
#include "entity.h"
#include "enemy.h"
-#include "asm.h"
#include "functions.h"
-#include "audio.h"
-#include "effects.h"
#include "projectile.h"
void OctorokBossProjectile_Action2(Entity*);
diff --git a/src/projectile/removableDust.c b/src/projectile/removableDust.c
index 5fbf3c76..58107064 100644
--- a/src/projectile/removableDust.c
+++ b/src/projectile/removableDust.c
@@ -2,8 +2,6 @@
#include "enemy.h"
#include "coord.h"
#include "functions.h"
-#include "flags.h"
-#include "utils.h"
#include "object.h"
extern u32 sub_080002C8(u16, u8);
diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c
index 5ad1b0ef..7254631b 100644
--- a/src/projectile/rockProjectile.c
+++ b/src/projectile/rockProjectile.c
@@ -54,7 +54,7 @@ void RockProjectile_Action1(Entity* this) {
}
void RockProjectile_Action2(Entity* this) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
GetNextFrame(this);
if (GravityUpdate(this, 0x1800) == 0) {
DeleteEntity(this);
diff --git a/src/projectile/spiderWeb.c b/src/projectile/spiderWeb.c
index 7323ae0a..6df74e1c 100644
--- a/src/projectile/spiderWeb.c
+++ b/src/projectile/spiderWeb.c
@@ -1,9 +1,7 @@
#include "entity.h"
#include "enemy.h"
-#include "audio.h"
#include "functions.h"
#include "object.h"
-#include "flags.h"
extern void sub_0806FBB4(Entity*);
extern u32 sub_080002D4(s32, s32, u32);
diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c
index 92868e26..709907e0 100644
--- a/src/projectile/stalfosProjectile.c
+++ b/src/projectile/stalfosProjectile.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "effects.h"
extern void (*const StalfosProjectile_Functions[])(Entity*);
extern void (*const StalfosProjectile_Actions[])(Entity*);
diff --git a/src/projectile/torchTrapProjectile.c b/src/projectile/torchTrapProjectile.c
index 6603329c..046d8062 100644
--- a/src/projectile/torchTrapProjectile.c
+++ b/src/projectile/torchTrapProjectile.c
@@ -32,7 +32,7 @@ void TorchTrapProjectile_Action1(Entity* this) {
this->actionDelay -= 1;
} else {
if (sub_080AF090(this) == 0) {
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
} else {
this->action = 2;
}
diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c
index 2cbc6dd2..27fe3c98 100644
--- a/src/projectile/v1DarkMagicProjectile.c
+++ b/src/projectile/v1DarkMagicProjectile.c
@@ -2,9 +2,7 @@
#include "enemy.h"
#include "coord.h"
#include "player.h"
-#include "audio.h"
#include "functions.h"
-#include "asm.h"
extern void SoundReqClipped(Entity*, u32);
@@ -124,7 +122,7 @@ void V1DarkMagicProjectile_Action1(Entity* this) {
uVar2 = GetFacingDirection(this, &gPlayerEntity);
sub_08004596(this, uVar2);
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
break;
case 1:
if ((this->parent == NULL) || (this->parent->next == NULL)) {
diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c
index 6c7efb5e..013369fd 100644
--- a/src/projectile/v1FireProjectile.c
+++ b/src/projectile/v1FireProjectile.c
@@ -2,8 +2,6 @@
#include "enemy.h"
#include "player.h"
#include "functions.h"
-#include "audio.h"
-#include "asm.h"
extern void sub_0806F5BC(Entity*, u32, u32);
extern u32 sub_080041DC(Entity*, u32, u32);
@@ -75,7 +73,7 @@ void V1FireProjectile_Init(Entity* this) {
void V1FireProjectile_Action1(Entity* this) {
GetNextFrame(this);
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
if (GravityUpdate(this, 0) == 0) {
this->action = 2;
this->actionDelay = 0xf;
diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c
index 0ed8e9cf..b2c1ae7b 100644
--- a/src/projectile/v2Projectile.c
+++ b/src/projectile/v2Projectile.c
@@ -2,9 +2,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "asm.h"
-#include "audio.h"
-#include "effects.h"
extern void (*const V2Projectile_Functions[])(Entity*);
extern void (*const gUnk_0812A7EC[])(Entity*);
@@ -121,7 +118,7 @@ void sub_080ABF04(Entity* this) {
if (CheckOnScreen(this) == 0) {
DeleteThisEntity();
}
- sub_0806F69C(this);
+ LinearMoveUpdate(this);
GetNextFrame(this);
}
diff --git a/src/projectile/v3ElectricProjectile.c b/src/projectile/v3ElectricProjectile.c
index 5dd25ca4..556cc709 100644
--- a/src/projectile/v3ElectricProjectile.c
+++ b/src/projectile/v3ElectricProjectile.c
@@ -1,9 +1,7 @@
#include "entity.h"
#include "enemy.h"
-#include "audio.h"
#include "player.h"
#include "coord.h"
-#include "functions.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/projectile/v3HandProjectile.c b/src/projectile/v3HandProjectile.c
index b965161c..d308b7d9 100644
--- a/src/projectile/v3HandProjectile.c
+++ b/src/projectile/v3HandProjectile.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "player.h"
-#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/projectile/v3TennisBallProjectile.c b/src/projectile/v3TennisBallProjectile.c
index 7affd779..296c830b 100644
--- a/src/projectile/v3TennisBallProjectile.c
+++ b/src/projectile/v3TennisBallProjectile.c
@@ -1,8 +1,5 @@
#include "entity.h"
#include "enemy.h"
-#include "audio.h"
-#include "functions.h"
-#include "effects.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/projectile/windProjectile.c b/src/projectile/windProjectile.c
index ff77862f..b5b1133b 100644
--- a/src/projectile/windProjectile.c
+++ b/src/projectile/windProjectile.c
@@ -1,7 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
-#include "audio.h"
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
diff --git a/src/room.c b/src/room.c
index 629e05e6..d752abfb 100644
--- a/src/room.c
+++ b/src/room.c
@@ -5,7 +5,7 @@
#include "functions.h"
#include "utils.h"
#include "object.h"
-#include "overworld.h"
+#include "game.h"
extern void sub_0804B058(EntityData* dat);
extern void sub_0801AC98();
@@ -80,8 +80,8 @@ NONMATCH("asm/loadRoomEntity.s", Entity* LoadRoomEntity(EntityData* dat)) {
v5->collisionLayer = 2;
return v5;
}
- if ((gRoomControls.unk6 & 2) == 0) {
- sub_08016A30(v5);
+ if ((gRoomControls.scroll_flags & 2) == 0) {
+ ResolveCollisionLayer(v5);
}
}
v5->collisionLayer = 1;
@@ -320,7 +320,7 @@ static void LoadSmallChestTile(TileEntity* tile) {
for (i = 0; i < 8; ++i, ++t) {
if (!t->_4) {
MemCopy(tile, t, sizeof(TileEntity));
- if ((t->_6 & 1) && (gRoomControls.unk6 & 2) && !CheckLocalFlag(t->_1)) {
+ if ((t->_6 & 1) && (gRoomControls.scroll_flags & 2) && !CheckLocalFlag(t->_1)) {
Entity* e = CreateObject(OBJECT_52, t->_1, 0);
if (e != NULL) {
sub_0806F704(e, t->_4);
diff --git a/src/roomInit.c b/src/roomInit.c
index c6ffda37..8c0557c2 100644
--- a/src/roomInit.c
+++ b/src/roomInit.c
@@ -4,24 +4,18 @@
#include "utils.h"
#include "functions.h"
-#include "structures.h"
-#include "audio.h"
+#include "sound.h"
#include "effects.h"
#include "screen.h"
#include "flags.h"
#include "item.h"
#include "save.h"
-#include "script.h"
-#include "screen.h"
#include "area.h"
-#include "room.h"
-#include "overworld.h"
+#include "game.h"
-#include "entity.h"
#include "npc.h"
-#include "player.h"
static void sub_0804E150(void);
diff --git a/src/save.c b/src/save.c
index a5b8caea..aa401f10 100644
--- a/src/save.c
+++ b/src/save.c
@@ -1,10 +1,10 @@
#include "save.h"
#include "gba/eeprom.h"
-#include "audio.h"
+#include "sound.h"
#include "menu.h"
#include "main.h"
#include "functions.h"
-#include "overworld.h"
+#include "game.h"
typedef struct SaveFileStatus {
u16 checksum1;
diff --git a/src/script.c b/src/script.c
index c59c267b..b2648251 100644
--- a/src/script.c
+++ b/src/script.c
@@ -2,13 +2,12 @@
#include "main.h"
#include "screen.h"
#include "area.h"
-#include "overworld.h"
+#include "game.h"
#include "object.h"
#include "npc.h"
#include "functions.h"
-#include "structures.h"
void InitScriptForEntity(Entity*, ScriptExecutionContext*, u16*);
void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script);
@@ -225,12 +224,12 @@ void StartPlayerScript(u16* script) {
gPlayerState.field_0x38 = 0;
}
-ScriptExecutionContext* StartCutscene2(Entity* entity, u16* script) {
+UNUSED ScriptExecutionContext* StartCutscene2(Entity* entity, u16* script) {
ScriptExecutionContext* context;
context = CreateScriptExecutionContext();
if (context) {
- entity->flags |= 2;
+ entity->flags |= ENT_SCRIPTED;
*(ScriptExecutionContext**)&entity->field_0x3c = context;
context->scriptInstructionPointer = script;
}
@@ -457,7 +456,7 @@ void sub_0807DF50(void) {
gUnk_02034490[0] = 0;
gUnk_0200AF00.filler0[1] = 0;
RecoverUI(0);
- sub_080791D0();
+ ResetPlayerAnimationAndAction();
sub_08079184();
}
@@ -984,7 +983,7 @@ void ScriptCommand_WaitForPlayerEnterRoom(Entity* entity, ScriptExecutionContext
}
void ScriptCommand_WaitFor_1(Entity* entity, ScriptExecutionContext* context) {
- if (gRoomControls.unk6 & 4) {
+ if (gRoomControls.scroll_flags & 4) {
gActiveScriptInfo.commandSize = 0;
} else {
gActiveScriptInfo.flags |= 1;
@@ -1293,7 +1292,7 @@ void ScriptCommand_WalkForward(Entity* entity, ScriptExecutionContext* context)
}
void sub_0807EC44(Entity* entity, ScriptExecutionContext* context) {
- sub_0806F69C(entity);
+ LinearMoveUpdate(entity);
if (--context->unk_12) {
gActiveScriptInfo.commandSize = 0;
}
@@ -1890,8 +1889,6 @@ void sub_0807F78C(Entity* entity, ScriptExecutionContext* context) {
void sub_0807F7C4(Entity* entity, ScriptExecutionContext* context) {
u32 item = context->intVariable;
- u32 msg;
- u32 price;
if (context->intVariable == 0)
item = gRoomVars.shopItemType;
@@ -1902,7 +1899,6 @@ void sub_0807F7C4(Entity* entity, ScriptExecutionContext* context) {
void sub_0807F800(Entity* entity, ScriptExecutionContext* context) {
u32 item = context->intVariable;
- u32 msg;
u32 price;
if (context->intVariable == 0)
diff --git a/src/code_0807CC3C.c b/src/scroll.c
index 25458be5..d6079438 100644
--- a/src/code_0807CC3C.c
+++ b/src/scroll.c
@@ -1,11 +1,5 @@
#include "global.h"
-#include "structures.h"
-#include "functions.h"
-#include "script.h"
-#include "entity.h"
-#include "save.h"
-// these three functions use gRoomControls, maybe once that is understood better, these can be decompiled easier
ASM_FUNC("asm/non_matching/code_0807CC3C/sub_0807D280.inc", void sub_0807D280(u32 unk_1, u32 unk_2))
ASM_FUNC("asm/non_matching/code_0807CC3C/sub_0807D46C.inc", void sub_0807D46C(u32 unk_1, u32 unk_2))
diff --git a/src/audio.c b/src/sound.c
index 16e22303..32dc20c4 100644
--- a/src/audio.c
+++ b/src/sound.c
@@ -1,11 +1,11 @@
#include "global.h"
#include "main.h"
#include "gba/m4a.h"
-#include "audio.h"
+#include "sound.h"
#include "utils.h"
-#define IS_BGM(song) (song) - 1 <= NUM_BGM - 1
-#define IS_SFX(song) (song) - 1 > NUM_BGM - 1
+#define IS_BGM(song) ((song)-1 <= NUM_BGM - 1)
+#define IS_SFX(song) ((song)-1 > NUM_BGM - 1)
static s32 fade(s32 target, s32 current);
static void doPlaySound(u32 sound);
@@ -44,7 +44,7 @@ void SetSfxVolume(u32 volume) {
gSoundPlayingInfo.volumeSfx = volume;
}
-void SoundReq(Sound sound) {
+void SoundReq(u32 sound) {
u32 song;
SoundPlayingInfo* ptr;
if (gMain.field_0x7)
diff --git a/src/sub_0807CA18.c b/src/sub_0807CA18.c
index d74a54c3..9c823e2d 100644
--- a/src/sub_0807CA18.c
+++ b/src/sub_0807CA18.c
@@ -1,10 +1,8 @@
#include "global.h"
-#include "structures.h"
#include "save.h"
#include "utils.h"
extern void sub_0807C960();
-extern void LoadPalettes(const u8*, s32, s32);
extern u16 gMetatilesBottom[];
extern u16 gMetatilesTop[];
diff --git a/src/sub_080A3B84.c b/src/sub_080A3B84.c
index e796dff0..cbf667ea 100644
--- a/src/sub_080A3B84.c
+++ b/src/sub_080A3B84.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "functions.h"
#include "menu.h"
-#include "structures.h"
#include "screen.h"
extern void (*const gUnk_081280C4[])();