summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dungeon_ai_attack.c2
-rw-r--r--src/dungeon_ai_movement.c2
-rw-r--r--src/targeting.c11
3 files changed, 13 insertions, 2 deletions
diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c
index 0c48f24..416d4da 100644
--- a/src/dungeon_ai_attack.c
+++ b/src/dungeon_ai_attack.c
@@ -18,6 +18,7 @@
#include "dungeon_random_1.h"
#include "moves.h"
#include "status_checks.h"
+#include "targeting.h"
#define REGULAR_ATTACK_INDEX 4
@@ -30,7 +31,6 @@ struct MoveTargetResults
s32 moveWeight;
};
-extern void TargetTileInFront(struct DungeonEntity*);
extern s32 FindMoveTarget(struct MoveTargetResults*, struct DungeonEntity*, struct PokemonMove*);
extern bool8 IsMoveUsable(struct DungeonEntity*, s32, bool8);
extern bool8 TargetRegularAttack(struct DungeonEntity*, u32*, bool8);
diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c
index 88ed8cb..d0e5f7d 100644
--- a/src/dungeon_ai_movement.c
+++ b/src/dungeon_ai_movement.c
@@ -20,6 +20,7 @@
#include "map.h"
#include "pokemon.h"
#include "status_checks.h"
+#include "targeting.h"
extern char gAvailablePokemonNames[];
extern char *gPtrCouldntBeUsedMessage;
@@ -35,7 +36,6 @@ extern void sub_8041888(u32);
extern u8 sub_803F428(s16 *);
extern void sub_803E708(u32, u32);
extern struct DungeonEntity *GetLeaderEntity();
-extern void TargetTileInFront(struct DungeonEntity *);
u32 sub_8075818(struct DungeonEntity *entity)
{
diff --git a/src/targeting.c b/src/targeting.c
new file mode 100644
index 0000000..b77fb35
--- /dev/null
+++ b/src/targeting.c
@@ -0,0 +1,11 @@
+#include "global.h"
+#include "targeting.h"
+
+#include "dungeon_util.h"
+
+void TargetTileInFront(struct DungeonEntity *pokemon)
+{
+ struct DungeonEntityData *pokemonData = pokemon->entityData;
+ pokemonData->targetPosition.x = pokemon->posWorld.x + gAdjacentTileOffsets[pokemonData->action.facingDir].x;
+ pokemonData->targetPosition.y = pokemon->posWorld.y + gAdjacentTileOffsets[pokemonData->action.facingDir].y;
+}