summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/field_map_obj.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/field_map_obj.c b/src/field_map_obj.c
index a876797a4..cc81bcb29 100755
--- a/src/field_map_obj.c
+++ b/src/field_map_obj.c
@@ -121,7 +121,7 @@ void DoGroundEffects_OnFinishStep(struct MapObject *, struct Sprite *);
void npc_obj_transfer_image_anim_pause_flag(struct MapObject *, struct Sprite *);
void FieldObjectUpdateSubpriority(struct MapObject *, struct Sprite *);
-bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject *fieldObject, s16 x, s16 y);
+bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *fieldObject, s16 x, s16 y);
bool8 IsMetatileDirectionallyImpassable(struct MapObject *, s16, s16, u8);
bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *, s16, s16);
@@ -3657,7 +3657,7 @@ u8 npc_block_way(struct MapObject *mapObject, s16 x, s16 y, u32 dirn)
u8 direction;
direction = dirn;
- if (IsCoordOutsideFieldObjectMovementRect(mapObject, x, y))
+ if (IsCoordOutsideFieldObjectMovementRect((struct MapObject2 *)mapObject, x, y))
{
return 1;
}
@@ -3685,7 +3685,7 @@ u8 sub_8092C8C(struct MapObject *mapObject, s16 x, s16 y, u8 direction)
u8 retval;
retval = 0x00;
- if (IsCoordOutsideFieldObjectMovementRect(mapObject, x, y))
+ if (IsCoordOutsideFieldObjectMovementRect((struct MapObject2 *)mapObject, x, y))
{
retval |= 1;
}
@@ -3704,6 +3704,34 @@ u8 sub_8092C8C(struct MapObject *mapObject, s16 x, s16 y, u8 direction)
return retval;
}
+bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *mapObject, s16 x, s16 y)
+{
+ s16 left;
+ s16 right;
+ s16 top;
+ s16 bottom;
+
+ if (mapObject->mapobj_unk_19 != 0)
+ {
+ left = mapObject->coords1.x - mapObject->mapobj_unk_19;
+ right = mapObject->coords1.x + mapObject->mapobj_unk_19;
+ if (left > x || right < x)
+ {
+ return TRUE;
+ }
+ }
+ if (mapObject->mapobj_unk_19b != 0)
+ {
+ top = mapObject->coords1.y - mapObject->mapobj_unk_19b;
+ bottom = mapObject->coords1.y + mapObject->mapobj_unk_19b;
+ if (top > y || bottom < y)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
asm(".section .text.get_face_direction_anim_id");
void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);