From a25912e9fa9ee1da9292c2c87dfbc00e5c6e9c8b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 26 Oct 2025 17:55:23 +0100 Subject: [PATCH] remove more externs from dungeon files --- include/dungeon_ai.h | 1 + include/dungeon_message.h | 1 + include/dungeon_misc.h | 1 + include/dungeon_util.h | 5 +++++ src/dungeon_action_execution.c | 8 ++------ src/dungeon_damage.c | 9 ++------- src/dungeon_engine.c | 2 -- src/dungeon_generation.c | 4 ---- src/dungeon_leveling.c | 2 -- src/dungeon_map.c | 2 -- src/dungeon_menu_others.c | 4 ---- src/dungeon_misc.c | 20 ++------------------ src/dungeon_mon_spawn.c | 7 ++----- src/dungeon_move.c | 7 ------- src/dungeon_move_util.c | 3 --- src/dungeon_turn_effects.c | 4 +--- src/dungeon_vram.c | 6 ++---- src/run_dungeon.c | 10 ++-------- src/trap.c | 3 --- 19 files changed, 21 insertions(+), 78 deletions(-) diff --git a/include/dungeon_ai.h b/include/dungeon_ai.h index bed4431c0..72dab1808 100644 --- a/include/dungeon_ai.h +++ b/include/dungeon_ai.h @@ -4,5 +4,6 @@ #include "structs/dungeon_entity.h" void RunMonsterAI(Entity *pokemon, u32 unused); +void sub_8075BA4(Entity *param_1, u8 param_2); #endif diff --git a/include/dungeon_message.h b/include/dungeon_message.h index 54e7b1ab0..a69b2da2e 100644 --- a/include/dungeon_message.h +++ b/include/dungeon_message.h @@ -31,6 +31,7 @@ extern bool8 gUnknown_203B434; void sub_80521D0(void); void sub_8052210(bool8 a0); +void sub_805229C(void); // These functions display the string if certain conditions are met. The conditions differ depending on the function. The string is then saved to the message log. void LogMessageByIdWithPopupCheckUser(Entity *pokemon, const u8 *str); diff --git a/include/dungeon_misc.h b/include/dungeon_misc.h index 01823c666..1ce00a21b 100644 --- a/include/dungeon_misc.h +++ b/include/dungeon_misc.h @@ -55,6 +55,7 @@ void sub_806A1B0(Entity *pokemon); void sub_806A1E8(Entity *pokemon); void sub_806A240(Entity *pokemon, Entity *target); void TryPointCameraToMonster(Entity *pokemon, u8 param_2); +void nullsub_95(Entity *pokemon); void sub_806A338(void); void sub_806A390(Entity *pokemon); void sub_806A3D4(u8 *dst, s32 _a1, s32 id, bool32 _a3); diff --git a/include/dungeon_util.h b/include/dungeon_util.h index 38355ef68..1a31a9e94 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -17,9 +17,13 @@ bool8 EntityIsValid(Entity *pokemon); u32 GetEntityType(Entity *entity); u8 GetEntityRoom(Entity *entity); Tile *GetTileAtEntitySafe(Entity *entity); +void sub_804513C(void); +void sub_804522C(void); void UpdateEntityPixelPos(Entity *entity, PixelPos *pos); void SetEntityPixelPos(Entity *entity, s32 x, s32 y); void IncreaseEntityPixelPos(Entity *entity, s32 x, s32 y); +Entity *sub_80453AC(s32 _species); +Entity *sub_804550C(s32 _species); Item *GetItemInfo(Entity *entity); Item *GetItemData_1(Entity *entity); Trap *GetTrapInfo(Entity *entity); @@ -27,6 +31,7 @@ Trap* GetTrapData_1(Entity *entity); Entity *SpawnTrap(u8 trapID, DungeonPos *pos, u8 c); Entity *SpawnItemEntity(DungeonPos *pos); void sub_80457DC(Entity* ent); +bool8 ShouldMinimapDisplayEntity(Entity *ent); bool8 ShouldDisplayEntity(Entity *ent); bool8 CanSeeTarget(Entity *entity, Entity *targetEntity); bool8 CanTargetEntity(Entity *entity, Entity *targetEntity); diff --git a/src/dungeon_action_execution.c b/src/dungeon_action_execution.c index d622e690f..bb3d50d2a 100644 --- a/src/dungeon_action_execution.c +++ b/src/dungeon_action_execution.c @@ -41,12 +41,8 @@ #include "dungeon_entity_movement.h" #include "dungeon_ai_items.h" #include "dungeon_ai_attack.h" - -void sub_8075BA4(Entity *param_1, u8 param_2); -void nullsub_95(Entity *); -void sub_8041888(u8 param_1); -void sub_805EFB4(Entity *, u8); -void sub_806A1E8(Entity *pokemon); +#include "dungeon_ai.h" +#include "dungeon_main.h" EWRAM_DATA u8 gUnknown_202F32C = 0; EWRAM_DATA u8 gUnknown_202F32D = 0; diff --git a/src/dungeon_damage.c b/src/dungeon_damage.c index e18f29ae7..901e65496 100644 --- a/src/dungeon_damage.c +++ b/src/dungeon_damage.c @@ -47,13 +47,8 @@ #include "move_orb_actions_1.h" #include "move_orb_effects_2.h" #include "move_orb_effects_5.h" - -extern void sub_803ED30(s32, Entity *r0, u8, s32); -extern bool8 sub_806A458(Entity *); -extern bool8 sub_806A58C(s16 a0); -extern void sub_806A390(Entity *r0); -extern void sub_800DBBC(void); -extern void PointCameraToMonster(Entity *); +#include "dungeon_tilemap.h" +#include "effect_main.h" static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struct DamageStruct *r5, bool32 isFalseSwipe, bool32 giveExp, s16 dungeonExitReason_, s32 arg8); static bool8 sub_806E100(s48_16 *param_1, Entity *pokemon, Entity *target, u8 type, DamageStruct *dmgStruct); diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index 2ea014d0c..ad5c4024f 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -23,8 +23,6 @@ #include "dungeon_entity_movement.h" #include "dungeon_wind.h" -extern void sub_805F02C(void); - static void sub_8044454(void); static bool8 RunLeaderTurn(bool8); static void sub_8044574(void); diff --git a/src/dungeon_generation.c b/src/dungeon_generation.c index f1076645d..bf247b6f9 100644 --- a/src/dungeon_generation.c +++ b/src/dungeon_generation.c @@ -22,10 +22,6 @@ #include "dungeon_mon_spawn.h" #include "run_dungeon.h" -extern s32 sub_803DA20(s16 species); -extern void sub_8049840(void); -extern void sub_80498A8(s32, s32); - enum CardinalDirection { CARDINAL_DIR_RIGHT, diff --git a/src/dungeon_leveling.c b/src/dungeon_leveling.c index 359cda84f..304bffda6 100644 --- a/src/dungeon_leveling.c +++ b/src/dungeon_leveling.c @@ -32,8 +32,6 @@ static EWRAM_DATA s32 sNewAtkStats[2] = {0, 0}; static EWRAM_DATA s32 sNewDefStats[2] = {0, 0}; -void sub_8042A44(Entity *r0); - static const u8 gUnknown_8107010[8] = {0, 1, 1, 2, 1, 1, 0, 0}; static const u8 * const gUnknown_8107018[3] = { _(""), diff --git a/src/dungeon_map.c b/src/dungeon_map.c index b712dbdaa..a99f45c2c 100644 --- a/src/dungeon_map.c +++ b/src/dungeon_map.c @@ -23,8 +23,6 @@ #include "trap.h" #include "run_dungeon.h" -extern bool8 ShouldMinimapDisplayEntity(Entity *ent); - struct UnkStruct1 { u32 **unk0; diff --git a/src/dungeon_menu_others.c b/src/dungeon_menu_others.c index 488ec37c8..bb100322c 100644 --- a/src/dungeon_menu_others.c +++ b/src/dungeon_menu_others.c @@ -32,10 +32,6 @@ #include "text_3.h" #include "run_dungeon.h" -extern bool8 IsFloorwideFixedRoom(void); -extern u16 GetLeaderActionId(void); - - static void PrintOthersMenuOptions(void); static void ShowGameOptionsMenu(void); static void ShowQuickSaveGiveUpMenu(void); diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 90742c275..0645fdc78 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -55,24 +55,10 @@ #include "move_orb_effects_5.h" #include "dungeon_recruit_release_menu.h" #include "dungeon_8041AD0.h" +#include "dungeon_pokemon_sprites.h" static void EnsureCastformLoaded(void); static void EnsureDeoxysLoaded(void); - -extern bool8 sub_806A58C(s16 r0); -extern bool8 sub_8070F80(Entity * pokemon, s32 direction); -extern s32 sub_806A4DC(EntityInfo *info); -extern s16 sub_803D970(u32); -extern bool8 sub_80860A8(u8 id); -extern u8 sub_803D73C(s32 a0); -extern void DeletePokemonDungeonSprite(s32 id); -extern s32 sub_803DA20(s32 param_1); -extern Entity *sub_804550C(s16 a); -extern Entity *sub_80453AC(s16 id); - -extern u8 gUnknown_202F32C; - -bool8 sub_806A564(s16 r0); static bool8 sub_806A5A4(s16 r0); void OpenDungeonPaletteFile(void) @@ -1282,7 +1268,7 @@ void TryPointCameraToMonster(Entity *pokemon, u8 param_2) } } -void nullsub_95(void) +void nullsub_95(Entity *pokemon) {} void ReevaluateSnatchMonster(void) @@ -1512,8 +1498,6 @@ void sub_806A6E8(Entity *entity) } } -void DisplayMsgIfNewIqSkillLearned(EntityInfo *info, s32 pokeIq); - UNUSED static void DisplayMsgIfTeamMonsLearnedNewIqSkill(void) { s32 i; diff --git a/src/dungeon_mon_spawn.c b/src/dungeon_mon_spawn.c index 2308e5e07..113bc0baf 100644 --- a/src/dungeon_mon_spawn.c +++ b/src/dungeon_mon_spawn.c @@ -37,11 +37,8 @@ #include "dungeon_engine.h" #include "dungeon_leveling.h" #include "dungeon_8041AD0.h" - -extern bool8 sub_80860A8(u8 id); -extern u8 gUnknown_202F32C; -extern Entity *sub_804550C(s16 a); -extern Entity *sub_80453AC(s16 id); +#include "dungeon_cutscene.h" +#include "dungeon_action_execution.h" static s32 CalcSpeciesHPAtLevel(s32 species, s32 level); static s32 CalcSpeciesAtkAtLevel(s32 species, s32 level, s32 categoryIndex); diff --git a/src/dungeon_move.c b/src/dungeon_move.c index d46ce46ce..decdf3a18 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -44,13 +44,6 @@ #include "warp_target.h" #include "dungeon_ai_attack.h" -extern s16 GetDungeonExitReasonFromMoveOrItem(Move *move, s32 itemID); -extern void sub_806A1E8(Entity *pokemon); -extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); -extern void sub_8040DA0(Entity *entity, Move *move); -extern u16 GetEffectiveMoveId(u16 moveId, u8 weather, u8 hasSpecialEffect); -extern void sub_800EF10(u16 r0); -extern void sub_800E3AC(s32 a0, DungeonPos *pos, s32 a2); extern void sub_8041168(Entity *entity, Entity *entity2, Move *,DungeonPos *); static s32 TryHitTarget(Entity *attacker, Entity *target, Move *move, struct DamageStruct *dmgStruct, s16 unk_); diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index da8aca992..9f342f2de 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -44,12 +44,9 @@ #include "dungeon_damage.h" #include "dungeon_leveling.h" -extern void sub_806A1E8(Entity *pokemon); extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); extern void sub_8040DA0(Entity *entity, Move *move); extern u16 GetEffectiveMoveId(u16 moveId, u8 weather, u8 hasSpecialEffect); -extern void sub_800EF10(u16 r0); -extern void sub_800E3AC(s32 a0, DungeonPos *pos, s32 a2); extern void sub_8041168(Entity *entity, Entity *entity2, Move *,DungeonPos *); static u8 ToItemID(u32 itemID); diff --git a/src/dungeon_turn_effects.c b/src/dungeon_turn_effects.c index 05aa73222..8acbab2f6 100644 --- a/src/dungeon_turn_effects.c +++ b/src/dungeon_turn_effects.c @@ -42,9 +42,7 @@ #include "move_orb_effects_5.h" #include "dungeon_8041AD0.h" #include "dungeon_entity_movement.h" - -extern void sub_805229C(void); -extern void sub_805E804(void); +#include "dungeon_main.h" void ApplyEndOfTurnEffects(Entity *entity) { diff --git a/src/dungeon_vram.c b/src/dungeon_vram.c index e4677629c..54dcaa10e 100644 --- a/src/dungeon_vram.c +++ b/src/dungeon_vram.c @@ -33,6 +33,8 @@ #include "dungeon_engine.h" #include "dungeon_cutscene.h" #include "effect_main.h" +#include "dungeon_mon_sprite_render.h" +#include "dungeon_8041AD0.h" // File split is correct. This technical file deals with windows, advancing frames(v-blanks) and vram / pal set-up. @@ -47,10 +49,6 @@ extern struct DungeonPalFile *gUnknown_202EC94; extern RGB gUnknown_202ECA4[]; extern OpenedFile *gUnknown_202EC9C; -void sub_806CC10(); -void sub_804522C(); -void sub_8042E5C(); - static void sub_803E490(u32); static void sub_803EC94(void); static void sub_803ECE0(void); diff --git a/src/run_dungeon.c b/src/run_dungeon.c index 96ecec69b..3ebf50053 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -61,6 +61,7 @@ #include "dungeon_action_execution.h" #include "dungeon_8041AD0.h" #include "ground_main.h" +#include "dungeon_mon_sprite_render.h" EWRAM_INIT struct UnkStruct_203B414 *gUnknown_203B414 = NULL; EWRAM_INIT Dungeon *gDungeon = NULL; @@ -68,7 +69,6 @@ static EWRAM_INIT u8 *gSerializedData_203B41C = NULL; extern void sub_8068BDC(u8 r0); extern void sub_803D4AC(void); -extern void sub_804513C(void); extern void sub_8068F28(void); extern void IncrementThievingSuccesses(void); extern void sub_8043D60(void); @@ -84,16 +84,9 @@ extern void ReevaluateSnatchMonster(void); extern void sub_8051E3C(void); extern void sub_807FA18(void); extern void sub_806A974(void); -extern void DetermineAllMonsterShadow(void); extern void sub_8068F80(void); -extern bool8 TryForcedLoss(bool8); extern void sub_806A914(bool8 a0, bool8 a1, bool8 showRunAwayEffect); -extern u8 gUnknown_202F1A8; - -void EnforceMaxItemsAndMoney(void); -static void sub_8043FD0(void); - extern OpenedFile *gDungeonNameBannerPalette; // These functions are not part of dungeon's overlay5 and connect, in a way, overworld with dungeon. @@ -101,6 +94,7 @@ extern OpenedFile *gDungeonNameBannerPalette; static const s16 sDeoxysForms[4] = {MONSTER_DEOXYS_NORMAL, MONSTER_DEOXYS_ATTACK, MONSTER_DEOXYS_DEFENSE, MONSTER_DEOXYS_SPEED}; static void sub_8043CD8(void); +static void sub_8043FD0(void); // Actual function in Sky. Macro instead of static inline for matching #define GetForcedLossReason()(gDungeon->unk10) diff --git a/src/trap.c b/src/trap.c index 549588545..120bdfe23 100644 --- a/src/trap.c +++ b/src/trap.c @@ -39,9 +39,6 @@ #include "move_orb_effects_2.h" #include "move_orb_effects_4.h" -void sub_806A1E8(Entity *pokemon); -Entity *sub_8045684(u8, DungeonPos *, u8); - void sub_807FA18(void) { s32 x, y;