From 951acc8c31029327775e90e21ba6c92c24ff8b3b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 16 Sep 2017 21:29:04 -0400 Subject: CheckForCollisionBetweenFieldObjects --- src/field_map_obj.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 74c71333c..9855321d3 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -3741,6 +3741,28 @@ bool8 IsMetatileDirectionallyImpassable(struct MapObject *mapObject, s16 x, s16 return FALSE; } +bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *mapObject, s16 x, s16 y) +{ + u8 i; + struct MapObject *curObject; + + for (i = 0; i < NUM_FIELD_OBJECTS; i ++) + { + curObject = &gMapObjects[i]; + if (curObject->active && curObject != mapObject) + { + if ((curObject->coords2.x == x && curObject->coords2.y == y) || (curObject->coords3.x == x && curObject->coords3.y == y)) + { + if (AreZCoordsCompatible(mapObject->mapobj_unk_0B_0, curObject->mapobj_unk_0B_0)) + { + return TRUE; + } + } + } + } + return FALSE; +} + asm(".section .text.get_face_direction_anim_id"); void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *); -- cgit v1.2.3