Dungeon ai movement functions clean-up

This commit is contained in:
DizzyEggg
2025-11-06 22:07:17 +01:00
parent 2ea67885ee
commit 275b3e59f6
5 changed files with 116 additions and 170 deletions

View File

@@ -4,11 +4,6 @@
#include "structs/dungeon_entity.h"
void AIMovement(Entity *pokemon, bool8 showRunAwayEffect);
bool8 CanTakeItem(Entity *pokemon);
bool8 ChooseTargetPosition(Entity *pokemon);
void DecideMovement(Entity *pokemon, bool8 showRunAwayEffect);
bool8 AvoidEnemies(Entity *pokemon);
bool8 Wander(Entity *pokemon);
void sub_807BB78(Entity *pokemon);
#endif

View File

@@ -3,6 +3,17 @@
#include "structs/str_position.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
// Actual function in Sky. TODO: Find other uses of it and sync with Sky.
static inline s32 GetVisibilityRange(void)
{
s32 visibilityRange = gDungeon->unk181e8.visibilityRange;
if (visibilityRange == 0)
return 2;
return visibilityRange;
}
bool8 IsPositionActuallyInSight(DungeonPos *origin, DungeonPos *target);
bool8 IsPositionInSight(DungeonPos *origin, DungeonPos *target);

View File

@@ -125,7 +125,7 @@ static inline bool8 ItemSticky(Item *item)
static inline bool8 ItemExists(Item *item)
{
return (item->flags & ITEM_FLAG_EXISTS);
return (item->flags & ITEM_FLAG_EXISTS) != 0; // != 0 is necessary for Blue matching
}
static inline bool8 ItemSet(Item *item)