diff --git a/include/createObject.h b/include/createObject.h new file mode 100644 index 00000000..03f3632e --- /dev/null +++ b/include/createObject.h @@ -0,0 +1,8 @@ +#ifndef CREATEOBJECT_H +#define CREATEOBJECT_H + +// maybe a dedicated (create)Effect.h/c +void CreateDust(Entity* parent); +void CreateDustSmall(Entity* parent); + +#endif // CREATEOBJECT_H diff --git a/include/enemy.h b/include/enemy.h index 22a62f78..0b3e8ecb 100644 --- a/include/enemy.h +++ b/include/enemy.h @@ -109,6 +109,5 @@ extern void Enemy66(Entity*); extern u32 GetNextFunction(Entity*); extern void EnemyFunctionHandler(Entity*, void (*const func[])(Entity*)); -extern void sub_0804AA30(Entity*, void (*const func[])(Entity*)); extern void sub_08001324(Entity*); #endif diff --git a/include/functions.h b/include/functions.h index 48bcdd13..2b7a7888 100644 --- a/include/functions.h +++ b/include/functions.h @@ -7,8 +7,8 @@ #include "manager.h" #include "position.h" #include "player.h" -#include "structures.h" #include "room.h" +#include "structures.h" // Identified - to be sorted into header files extern void SoundReq(u32); @@ -17,7 +17,7 @@ extern u32 __modsi3(u32, u32); extern void DoFade(u32, u32); extern u32 CheckKinstoneFused(u32); extern void ForceEquipItem(u32, u8); -extern void LoadRoomEntityList(); +extern void LoadRoomEntityList(EntityData* listPtr); extern u32 GetAnimationState(Entity*); extern void SetChildOffset(Entity*, s32, s32, s32); extern Entity* CreatePlayerItem(u32, u32, u32, u32); @@ -29,7 +29,6 @@ extern void SetDirtTile(u32); extern void LoadRoomTileEntities(); // tba extern Entity* CreateDeathFx(Entity*, u32, u32); extern void UpdateAnimationVariableFrames(Entity*, u32); -extern void CopyPositionAndSpriteOffset(Entity*, Entity*); extern u8* GetSpriteSubEntryOffsetDataPointer(u32, u32); extern u32 LoadFixedGFX(Entity*, u32); extern Entity* CreateItemEntity(u32, u32, u32); @@ -42,19 +41,15 @@ extern Manager* GetEmptyManager(void); extern void LoadGfxGroup(u32); extern void EnqueueSFX(u32); extern void ResetPlayer(void); -extern void CreateDust(Entity*); extern u32 IsItemEquipped(u32); extern void DeleteManager(Manager*); extern bool32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY); -extern u32 CheckIsDungeon(); extern u32 GetTileTypeByEntity(Entity*); // Unidentified extern u32 sub_0806ED78(Entity*); -extern void sub_0806920C(Entity*); extern u32 sub_0805ACC0(Entity*); extern u32 sub_0801E99C(Entity*); -extern void sub_0806924C(Entity*); extern Entity* sub_080873AC(Entity*, u32, u32); extern void sub_08078778(Entity*); extern void sub_080787A8(Entity*, u32); diff --git a/include/game.h b/include/game.h new file mode 100644 index 00000000..dec15e21 --- /dev/null +++ b/include/game.h @@ -0,0 +1,6 @@ +#ifndef GAME_H +#define GAME_H + +u32 CheckIsDungeon(void); + +#endif // GAME_H diff --git a/include/position.h b/include/position.h index 4635a097..87d5b128 100644 --- a/include/position.h +++ b/include/position.h @@ -7,6 +7,7 @@ void CopyPosition(Entity*, Entity*); void PositionEntityOnTop(Entity*, Entity*); void PositionRelative(Entity*, Entity*, s32, s32); +void CopyPositionAndSpriteOffset(Entity* param_1, Entity* param_2); void sub_0806FA90(Entity*, Entity*, s32, s32); void ResolveEntityOnTop(Entity*, Entity*); void sub_0806FAD8(Entity*, Entity*); diff --git a/src/code_08018C58.c b/src/code_08018C58.c index fd918e31..14caf9cd 100644 --- a/src/code_08018C58.c +++ b/src/code_08018C58.c @@ -1,5 +1,4 @@ #include "global.h" -#include "entity.h" extern u32 SetTileType(u32 tileID, u32 tilePos, u32 layerID); diff --git a/src/code_080300AC.c b/src/code_080300AC.c index 5f33b435..16514810 100644 --- a/src/code_080300AC.c +++ b/src/code_080300AC.c @@ -1,5 +1,4 @@ #include "global.h" -#include "entity.h" #include "dma.h" #include "functions.h" diff --git a/src/code_0805436C.c b/src/code_0805436C.c index be879f99..1361e996 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -1,5 +1,4 @@ #include "global.h" -#include "entity.h" #include "player.h" #include "room.h" #include "menu.h" diff --git a/src/createEnemy.c b/src/createEnemy.c index d2c08c81..73eb5e5c 100644 --- a/src/createEnemy.c +++ b/src/createEnemy.c @@ -1,6 +1,5 @@ -#include "entity.h" #include "global.h" -#include "functions.h" +#include "entity.h" Entity* CreateEnemy(u32 subtype, u32 form) { Entity* enemy; diff --git a/src/createNPC.c b/src/createNPC.c index 6289166f..7e57e92e 100644 --- a/src/createNPC.c +++ b/src/createNPC.c @@ -1,6 +1,5 @@ #include "global.h" #include "entity.h" -#include "functions.h" Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) { Entity* entity; diff --git a/src/createObject.c b/src/createObject.c index f0a79d43..dc8de778 100644 --- a/src/createObject.c +++ b/src/createObject.c @@ -2,7 +2,7 @@ #include "entity.h" #include "position.h" #include "room.h" -#include "functions.h" +#include "createObject.h" Entity* CreateObject(u32 subtype, u32 form, u32 parameter) { Entity* entity; diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 43b1a2c2..99cb1f3c 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -1,8 +1,8 @@ #include "enemy.h" #include "random.h" +#include "createObject.h" #include "functions.h" -extern void CreateDustSmall(Entity*); extern void sub_08078930(Entity*); extern void sub_08078954(Entity*); diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 66752186..8ee6aaa2 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -3,7 +3,6 @@ #include "player.h" #include "room.h" #include "trig.h" -#include "structures.h" #include "fileScreen.h" #include "random.h" #include "functions.h" diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index fb16c1ee..2175ad92 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -3,6 +3,7 @@ #include "textbox.h" #include "save.h" #include "random.h" +#include "createObject.h" #include "functions.h" extern bool32 sub_080544B4(u32); diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index 6df8075a..7fba14ed 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -1,7 +1,6 @@ #include "global.h" #include "entity.h" #include "enemy.h" -#include "room.h" #include "random.h" #include "functions.h" diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 50826bc9..e778ebe4 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -1,6 +1,8 @@ #include "enemy.h" #include "entity.h" #include "random.h" +#include "createObject.h" +#include "game.h" #include "functions.h" extern u32 sub_080002E0(u16, u32); diff --git a/src/enemy/rope.c b/src/enemy/rope.c index d270c688..877f87c6 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -1,6 +1,5 @@ #include "global.h" #include "entity.h" -#include "sprite.h" #include "enemy.h" #include "random.h" #include "functions.h" diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 64584892..be13ab0b 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -1,11 +1,11 @@ #include "global.h" #include "entity.h" #include "enemy.h" -#include "functions.h" #include "npc.h" -#include "structures.h" #include "player.h" #include "save.h" +#include "createObject.h" +#include "functions.h" extern void sub_080293DC(Entity*); extern void sub_080296D8(Entity*); diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index e2223166..3907e270 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -1,7 +1,8 @@ #include "entity.h" #include "player.h" -#include "functions.h" #include "screen.h" +#include "createObject.h" +#include "functions.h" typedef struct { s8 h, v; diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index 195838af..0c37302c 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -1,10 +1,10 @@ #include "global.h" #include "entity.h" #include "enemy.h" -#include "structures.h" #include "player.h" #include "save.h" #include "random.h" +#include "createObject.h" #include "functions.h" extern void (*const gUnk_080CEB74[])(Entity*); diff --git a/src/ezloNag.c b/src/ezloNag.c index 7d537a44..46c94d43 100644 --- a/src/ezloNag.c +++ b/src/ezloNag.c @@ -1,5 +1,4 @@ #include "global.h" -#include "entity.h" #include "functions.h" #include "textbox.h" #include "structures.h" diff --git a/src/flags.c b/src/flags.c index 6f1d5d56..2129ae01 100644 --- a/src/flags.c +++ b/src/flags.c @@ -2,7 +2,6 @@ #include "room.h" #include "flags.h" #include "area.h" -#include "room.h" extern u32 ReadBit(u32*, u32); extern u32 CheckBits(u32*, u32, u32); diff --git a/src/game.c b/src/game.c index 3db89d90..0b6488a5 100644 --- a/src/game.c +++ b/src/game.c @@ -300,7 +300,7 @@ u32 sub_08052654() { return (gArea >> 7) & 1; } -u32 CheckIsDungeon() { +u32 CheckIsDungeon(void) { return (gArea >> 2) & 1; } diff --git a/src/input.c b/src/input.c index c187d598..6c1179f4 100644 --- a/src/input.c +++ b/src/input.c @@ -1,5 +1,4 @@ #include "global.h" -#include "entity.h" #include "readKeyInput.h" static void StoreKeyInput(Input*, u32); diff --git a/src/intro.c b/src/intro.c index a0eb8db7..4fd85e48 100644 --- a/src/intro.c +++ b/src/intro.c @@ -1,5 +1,4 @@ #include "global.h" -#include "menu.h" #include "main.h" #include "entity.h" #include "dma.h" diff --git a/src/manager/manager15.c b/src/manager/manager15.c index 60ca8f5a..f1de0895 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -78,7 +78,7 @@ extern Entity gUnk_080E4C08; void sub_0805A370(Manager15* this) { if (this->manager.unk_0d) { - LoadRoomEntityList(&gUnk_080E4C08); + LoadRoomEntityList((EntityData*)&gUnk_080E4C08); this->manager.action = 3; SoundReq(0x80100000); } diff --git a/src/manager/manager1E.c b/src/manager/manager1E.c index 298e7860..fad34ef4 100644 --- a/src/manager/manager1E.c +++ b/src/manager/manager1E.c @@ -1,7 +1,6 @@ #include "global.h" #include "manager.h" #include "flags.h" -#include "player.h" #include "functions.h" typedef struct { diff --git a/src/manager/manager39.c b/src/manager/manager39.c index 8c1c1532..b8bd327c 100644 --- a/src/manager/manager39.c +++ b/src/manager/manager39.c @@ -4,6 +4,7 @@ #include "area.h" #include "textbox.h" #include "dma.h" +#include "game.h" #include "functions.h" typedef struct { diff --git a/src/manager/managerC.c b/src/manager/managerC.c index 972fc67b..5cf482c5 100644 --- a/src/manager/managerC.c +++ b/src/manager/managerC.c @@ -3,7 +3,6 @@ #include "flags.h" #include "structures.h" #include "room.h" -#include "area.h" #include "screen.h" #include "trig.h" #include "functions.h" diff --git a/src/npc.c b/src/npc.c index d7f38b6a..4a94399b 100644 --- a/src/npc.c +++ b/src/npc.c @@ -1,5 +1,4 @@ #include "global.h" -#include "functions.h" #include "entity.h" #include "npc.h" diff --git a/src/npc/anju.c b/src/npc/anju.c index e21afba1..e0fb08c8 100644 --- a/src/npc/anju.c +++ b/src/npc/anju.c @@ -1,10 +1,6 @@ #include "global.h" #include "entity.h" #include "player.h" -#include "room.h" -#include "flags.h" -#include "sprite.h" -#include "textbox.h" #include "npc.h" #include "script.h" #include "functions.h" diff --git a/src/npc/carlov.c b/src/npc/carlov.c index a96b916e..92d632ed 100644 --- a/src/npc/carlov.c +++ b/src/npc/carlov.c @@ -1,15 +1,9 @@ #include "global.h" #include "entity.h" -#include "player.h" #include "room.h" -#include "flags.h" -#include "sprite.h" -#include "textbox.h" #include "npc.h" -#include "structures.h" -#include "functions.h" #include "script.h" - +#include "functions.h" void Carlov(Entity* this) { if (this->action == 0) { diff --git a/src/npc/cow.c b/src/npc/cow.c index aed9ff0a..9eb67a7b 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -5,6 +5,9 @@ #include "npc.h" #include "functions.h" +void sub_0806920C(Entity* ent); +void sub_0806924C(Entity* ent); + extern void (*gUnk_08111914[])(Entity*); extern void (*gUnk_08111928[])(Entity*); extern Dialog gUnk_08111938[]; diff --git a/src/npc/dampe.c b/src/npc/dampe.c index ab2fa586..150acbe1 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -3,7 +3,6 @@ #include "player.h" #include "room.h" #include "flags.h" -#include "sprite.h" #include "textbox.h" #include "npc.h" #include "functions.h" diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 0f997c34..27d0df3d 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -7,6 +7,7 @@ #include "save.h" #include "script.h" #include "random.h" +#include "createObject.h" #include "structures.h" #include "functions.h" diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index 1f5d36af..ae5f1e0e 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -1,10 +1,7 @@ #include "global.h" #include "entity.h" #include "player.h" -#include "room.h" #include "flags.h" -#include "sprite.h" -#include "textbox.h" #include "npc.h" #include "structures.h" #include "functions.h" diff --git a/src/npc/moblinLady.c b/src/npc/moblinLady.c index 79152daf..d63d4d87 100644 --- a/src/npc/moblinLady.c +++ b/src/npc/moblinLady.c @@ -1,13 +1,7 @@ #include "global.h" #include "entity.h" -#include "player.h" -#include "room.h" -#include "flags.h" -#include "sprite.h" -#include "textbox.h" #include "npc.h" #include "script.h" -#include "functions.h" void MoblinLady(Entity* this) { if (this->action == 0) { diff --git a/src/npc/smith.c b/src/npc/smith.c index 477e7383..6b55c1f7 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -7,7 +7,7 @@ #include "npc.h" #include "functions.h" -extern void sub_08078850(u32, u32, u32, u32*); +extern void sub_08078850(Entity*, u32, u32, u32*); extern void (*const gUnk_08110360[])(Entity*); extern void (*const gUnk_0811036C[])(Entity*); diff --git a/src/object/archway.c b/src/object/archway.c index a33b7dd3..2f1124ca 100644 --- a/src/object/archway.c +++ b/src/object/archway.c @@ -1,7 +1,6 @@ #include "global.h" #include "entity.h" -#include "sprite.h" -#include "functions.h" +#include "game.h" void Archway(Entity* this) { u32 v1; diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 790d1251..3f7e6006 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -1,6 +1,5 @@ #include "global.h" #include "entity.h" -#include "flags.h" extern void sub_080842D8(Entity*); extern void sub_08078828(Entity*); diff --git a/src/object/cloud.c b/src/object/cloud.c index 45616754..0b7e7c0a 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -60,7 +60,7 @@ void sub_0809F5B0(Entity* this) { if (--this->actionDelay == 0) { SoundReq(115); SetGlobalFlag(KUMOTATSUMAKI); - LoadRoomEntityList(&gUnk_080DD750); + LoadRoomEntityList((EntityData*)&gUnk_080DD750); DeleteThisEntity(); } } diff --git a/src/object/floatingBlock.c b/src/object/floatingBlock.c index 661cec72..7e1ad599 100644 --- a/src/object/floatingBlock.c +++ b/src/object/floatingBlock.c @@ -1,6 +1,5 @@ #include "global.h" #include "entity.h" -#include "functions.h" void FloatingBlock(Entity* this) { if (this->action == 0) { diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index 804772b7..2f08f996 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -1,5 +1,6 @@ #include "global.h" #include "entity.h" +#include "game.h" #include "functions.h" extern void (*const gUnk_08122254[])(Entity*); diff --git a/src/object/objectA.c b/src/object/objectA.c index 3679e4bb..0e63b26f 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -2,6 +2,7 @@ #include "entity.h" #include "room.h" #include "flags.h" +#include "createObject.h" #include "functions.h" extern Hitbox gUnk_080FD170; diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c index 7fcbb9a0..7de61338 100644 --- a/src/object/pinwheel.c +++ b/src/object/pinwheel.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "flags.h" -#include "functions.h" +#include "createObject.h" extern u32 ReadBit(u32*, u32); diff --git a/src/object/windTribeFlag.c b/src/object/windTribeFlag.c index 14f64fba..bc9d0fa3 100644 --- a/src/object/windTribeFlag.c +++ b/src/object/windTribeFlag.c @@ -1,7 +1,6 @@ #include "global.h" #include "entity.h" #include "random.h" -#include "functions.h" void WindTribeFlag(Entity* this) { if (this->action == 0) { diff --git a/src/player.c b/src/player.c index 7dfcbb93..d6359f59 100644 --- a/src/player.c +++ b/src/player.c @@ -2,10 +2,11 @@ #include "entity.h" #include "player.h" #include "textbox.h" -#include "functions.h" #include "readKeyInput.h" #include "area.h" #include "save.h" +#include "game.h" +#include "functions.h" extern const void (*const gUnk_0811B9E0[])(Entity*); extern const void (*const gUnk_0811BA60[])(Entity*); diff --git a/src/position.c b/src/position.c index 628042c3..b5f83468 100644 --- a/src/position.c +++ b/src/position.c @@ -1,7 +1,6 @@ #include "global.h" #include "entity.h" #include "position.h" -#include "functions.h" extern u8 gUnk_08114F78[]; extern u8 gUnk_08114F80[]; diff --git a/src/room.c b/src/room.c index 55625d0a..9c94aa9f 100644 --- a/src/room.c +++ b/src/room.c @@ -4497,7 +4497,7 @@ void sub_0804E3C4() { } r = Random(); index = gUnk_080F0D58[index][r & 0x1f]; - LoadRoomEntityList(gUnk_080F0CB8[index & 0xF]); + LoadRoomEntityList((EntityData*)gUnk_080F0CB8[index & 0xF]); index >>= 4; r >>= 8; index = gUnk_080F0E08[index][r & 0x1F]; diff --git a/src/script.c b/src/script.c index 26aff076..8e9c6c75 100644 --- a/src/script.c +++ b/src/script.c @@ -703,7 +703,7 @@ void ScriptCommand_CallWithArg(Entity* entity, ScriptExecutionContext* context) } void ScriptCommand_LoadRoomEntityList(Entity* entity, ScriptExecutionContext* context) { - LoadRoomEntityList(GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer)); + LoadRoomEntityList((EntityData*)GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer)); } void ScriptCommand_TestBit(Entity* entity, ScriptExecutionContext* context) { diff --git a/src/sub_0801D754.c b/src/sub_0801D754.c index a6f103f5..8b1b2b20 100644 --- a/src/sub_0801D754.c +++ b/src/sub_0801D754.c @@ -1,5 +1,4 @@ #include "global.h" -#include "functions.h" extern const u8 gUnk_020176E0[]; diff --git a/src/sub_0807C998.c b/src/sub_0807C998.c index 7c2afd37..608f7680 100644 --- a/src/sub_0807C998.c +++ b/src/sub_0807C998.c @@ -1,5 +1,4 @@ #include "global.h" -#include "entity.h" extern void sub_0807C960(); extern u16 gMetatilesBottom[];