From db0b90b2559446986a5dd2c23df35f9f95755fe4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 26 Oct 2025 17:32:38 +0100 Subject: [PATCH] dungeon file externs --- include/dungeon_ai_attack.h | 3 +++ include/dungeon_ai_items.h | 4 ++++ include/dungeon_util.h | 1 + include/status_checks.h | 3 +-- include/targeting_flags.h | 9 --------- src/dungeon_action_execution.c | 7 ++----- src/dungeon_ai_attack.c | 3 --- src/dungeon_ai_items.c | 8 ++------ src/dungeon_entity_movement.c | 5 ++--- src/dungeon_main.c | 9 +-------- src/dungeon_menu_moves.c | 5 ----- src/dungeon_move.c | 2 +- src/dungeon_move_util.c | 2 +- src/dungeon_recruit_release_menu.c | 1 - src/friend_rescue.c | 3 --- 15 files changed, 18 insertions(+), 47 deletions(-) delete mode 100644 include/targeting_flags.h diff --git a/include/dungeon_ai_attack.h b/include/dungeon_ai_attack.h index 8f5b31c83..70781a844 100644 --- a/include/dungeon_ai_attack.h +++ b/include/dungeon_ai_attack.h @@ -21,5 +21,8 @@ bool8 IsAITargetEligible(s32 targetingFlags, Entity *user, Entity *target, Move s32 WeightMove(Entity *user, s32 targetingFlags, Entity *target, u32 moveType); bool8 TargetRegularAttack(Entity *pokemon, u32 *targetDir, bool8 checkPetrified); bool8 IsTargetInRange(Entity *pokemon, Entity *targetPokemon, s32 direction, s32 maxRange); +void HandleUseMoveAIAction(Entity *target); +void HandleUseOrbAction(Entity *pokemon); +s16 GetMoveTargetAndRangeForPokemon(Entity *pokemon, Move *move, bool32 isAI); #endif diff --git a/include/dungeon_ai_items.h b/include/dungeon_ai_items.h index 960b33009..f9b36c588 100644 --- a/include/dungeon_ai_items.h +++ b/include/dungeon_ai_items.h @@ -8,5 +8,9 @@ void AIDecideUseItem(Entity *pokemon); void GetPossibleAIThrownItemDirections(Entity *pokemon, s32 thrownAIFlag, Item *item, bool8 ignoreRollChance); void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, DungeonPos potentialTargets[], bool8 ignoreRollChance); void TargetThrownItem(Entity *pokemon, Entity *targetPokemon, Item *item, s32 targetingFlags, bool8 ignoreRollChance); +void HandleEatAIAction(Entity *pokemon); +void HandleThrowItemAIAction(Entity *pokemon); +void HandlePickUpAIAction(Entity *pokemon); +void MonTryPickUpItem(Entity *entity); #endif diff --git a/include/dungeon_util.h b/include/dungeon_util.h index 0d9c4bb71..38355ef68 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -35,6 +35,7 @@ bool8 sub_8045AAC(Entity *entity, DungeonPos *pos); bool8 CanTargetPosition(Entity *entity, DungeonPos *pos); void SubstitutePlaceholderStringTags(u8 *buffer, Entity *entity, u32 param_3); void sub_8045ACC(void); +s32 GetTeamMemberEntityIndex(Entity *pokemon); extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; diff --git a/include/status_checks.h b/include/status_checks.h index 22bd90d4a..071fcb388 100644 --- a/include/status_checks.h +++ b/include/status_checks.h @@ -3,8 +3,7 @@ #include "structs/dungeon_entity.h" -extern const s16 gConfusedAttackChance; - bool8 HasStatusThatPreventsActing(Entity *pokemon); +bool8 sub_80701A4(Entity *pokemon); #endif diff --git a/include/targeting_flags.h b/include/targeting_flags.h deleted file mode 100644 index 7960d5c0a..000000000 --- a/include/targeting_flags.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef GUARD_TARGETING_FLAGS_H -#define GUARD_TARGETING_FLAGS_H - -#include "constants/move.h" -#include "structs/dungeon_entity.h" - -s16 GetMoveTargetAndRangeForPokemon(Entity *pokemon, Move *move, bool32 isAI); - -#endif diff --git a/src/dungeon_action_execution.c b/src/dungeon_action_execution.c index 72292d3f0..d622e690f 100644 --- a/src/dungeon_action_execution.c +++ b/src/dungeon_action_execution.c @@ -39,17 +39,14 @@ #include "move_orb_effects_1.h" #include "move_orb_effects_3.h" #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 HandleUseMoveAIAction(Entity *target); void sub_8041888(u8 param_1); void sub_805EFB4(Entity *, u8); -void HandleUseOrbAction(Entity *); void sub_806A1E8(Entity *pokemon); -void HandlePickUpAIAction(Entity *pokemon); -void HandleThrowItemAIAction(Entity *pokemon); -void HandleEatAIAction(Entity *pokemon); EWRAM_DATA u8 gUnknown_202F32C = 0; EWRAM_DATA u8 gUnknown_202F32D = 0; diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index 3dc426d77..0b48ce4c1 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -27,7 +27,6 @@ #include "position_util.h" #include "status_checks.h" #include "structs/str_dungeon.h" -#include "targeting_flags.h" #include "dungeon_misc.h" #include "dungeon_pos_data.h" #include "dungeon_engine.h" @@ -45,8 +44,6 @@ EWRAM_DATA u8 gPotentialAttackTargetDirections[NUM_DIRECTIONS] = {0}; EWRAM_DATA s32 gPotentialAttackTargetWeights[NUM_DIRECTIONS] = {0}; EWRAM_DATA Entity *gPotentialTargets[NUM_DIRECTIONS] = {0}; -extern void sub_806A1B0(Entity *); - void ChooseAIMove(Entity *pokemon) { EntityInfo *pokemonInfo = GetEntInfo(pokemon); diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index 653798648..f7a002344 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -43,10 +43,6 @@ EWRAM_DATA u32 gAIThrownItemDirections[NUM_DIRECTIONS] = {0}; EWRAM_DATA bool8 gAIThrownItemDirectionIsUsed[NUM_DIRECTIONS] = {0}; EWRAM_DATA u32 gAIThrownItemProbabilities[NUM_DIRECTIONS] = {0}; -extern TeamInventory *gTeamInventoryRef; - -void sub_8073D14(Entity *); - void AIDecideUseItem(Entity *pokemon) { EntityInfo *pokemonInfo = GetEntInfo(pokemon); @@ -427,10 +423,10 @@ void HandleThrowItemAIAction(Entity *pokemon) void HandlePickUpAIAction(Entity *pokemon) { - sub_8073D14(pokemon); + MonTryPickUpItem(pokemon); } -void sub_8073D14(Entity *entity) +void MonTryPickUpItem(Entity *entity) { Item *groundItem; EntityInfo *_entityInfo; diff --git a/src/dungeon_entity_movement.c b/src/dungeon_entity_movement.c index cda0ccb77..a02a6941d 100644 --- a/src/dungeon_entity_movement.c +++ b/src/dungeon_entity_movement.c @@ -53,6 +53,7 @@ #include "dungeon_tilemap.h" #include "run_dungeon.h" #include "dungeon_8041AD0.h" +#include "dungeon_ai_items.h" static EWRAM_DATA s32 sSpeedMultiplier = 0; @@ -60,8 +61,6 @@ static void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr); static void nullsub_97(Entity *entity); static void TryInteractWithTile(Entity *entity); -extern void sub_8073D14(Entity *entity); - static inline void SetSpeedMultiplier(void) { if (gGameOptionsRef->dungeonSpeed != 0) @@ -392,7 +391,7 @@ static void TryInteractWithTile(Entity *entity) break; } case ENTITY_ITEM: - sub_8073D14(entity); + MonTryPickUpItem(entity); break; case ENTITY_NOTHING: case ENTITY_MONSTER: diff --git a/src/dungeon_main.c b/src/dungeon_main.c index ff49aaff6..22034d0c7 100644 --- a/src/dungeon_main.c +++ b/src/dungeon_main.c @@ -61,16 +61,9 @@ #include "dungeon_strings.h" #include "dungeon_entity_movement.h" #include "dungeon_8041AD0.h" +#include "status_checks.h" -void TryPointCameraToMonster(Entity *a0, u8 a1); -bool8 sub_80701A4(Entity *a0); -void ClearUnpaidFlagFromAllItems(void); -void sub_806A914(u8 a0, u8 a1, u8 a2); -u16 GetLeaderActionId(void); void sub_80978C8(s16 a0); -s32 GetTeamMemberEntityIndex(Entity *pokemon); -bool8 sub_8070F80(Entity * pokemon, s32 direction); -extern bool8 sub_8071A8C(Entity *pokemon); static EWRAM_DATA bool8 sInDiagonalMode = 0; static EWRAM_DATA bool8 sInRotateMode = 0; diff --git a/src/dungeon_menu_moves.c b/src/dungeon_menu_moves.c index 588e24eee..ae251cf4d 100644 --- a/src/dungeon_menu_moves.c +++ b/src/dungeon_menu_moves.c @@ -30,11 +30,6 @@ #include "text_2.h" #include "text_3.h" -extern s32 GetTeamMemberEntityIndex(Entity *pokemon); -extern void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 a1); -extern bool8 sub_8071A8C(Entity *pokemon); - - static void ShowMovesMenuWindows(Entity *entity, EntityInfo *entInfo, bool8 redColorForChargingMoves, WindowTemplates *windows, WindowHeader *header, u8 *arg5, s32 arg6, s32 arg7); static void AddMovesSubMenuOptions(Entity *entity, bool8 addLinkOptions, bool8 addUseMove); static void SetSubMenuOptionAction(ActionContainer *a0, s32 a1, s32 a2); diff --git a/src/dungeon_move.c b/src/dungeon_move.c index e1cb56fc0..d46ce46ce 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -38,11 +38,11 @@ #include "position_util.h" #include "sprite.h" #include "weather.h" -#include "targeting_flags.h" #include "text_util.h" #include "dungeon_pos_data.h" #include "dungeon_engine.h" #include "warp_target.h" +#include "dungeon_ai_attack.h" extern s16 GetDungeonExitReasonFromMoveOrItem(Move *move, s32 itemID); extern void sub_806A1E8(Entity *pokemon); diff --git a/src/dungeon_move_util.c b/src/dungeon_move_util.c index 36d9f37eb..da8aca992 100644 --- a/src/dungeon_move_util.c +++ b/src/dungeon_move_util.c @@ -36,7 +36,7 @@ #include "move_orb_effects_3.h" #include "move_orb_effects_5.h" #include "weather.h" -#include "targeting_flags.h" +#include "dungeon_ai_attack.h" #include "pokemon_types.h" #include "dungeon_run_end.h" #include "dungeon_pos_data.h" diff --git a/src/dungeon_recruit_release_menu.c b/src/dungeon_recruit_release_menu.c index ff7e93141..aa6de89d4 100644 --- a/src/dungeon_recruit_release_menu.c +++ b/src/dungeon_recruit_release_menu.c @@ -7,7 +7,6 @@ #include "dungeon_tilemap.h" #include "dungeon_8041AD0.h" #include "dungeon_action.h" -#include "code_8066D04.h" #include "dungeon_mon_sprite_render.h" #include "run_dungeon.h" #include "dungeon_items.h" diff --git a/src/friend_rescue.c b/src/friend_rescue.c index 9750c5134..7e53bc290 100644 --- a/src/friend_rescue.c +++ b/src/friend_rescue.c @@ -31,9 +31,6 @@ extern void SetFriendRescueMenuState(u32); -extern TeamInventory *gTeamInventoryRef; - - // NOTE: MenuItems and WindowTemplate defined in here.. #include "data/friend_rescue_menus.h"