diff options
author | scnorton <scnorton@biociphers.org> | 2017-05-23 10:16:08 -0400 |
---|---|---|
committer | scnorton <scnorton@biociphers.org> | 2017-05-24 16:15:12 -0400 |
commit | 48a3b78f82095fb2bd77db7c1c296158deacd76e (patch) | |
tree | 618b9d5e42587620ff1975e585166cb492ee2b13 /src/field_map_obj.c | |
parent | 9c3a25305cfa90021caae4f3a64e5de5ebc6cd45 (diff) |
IsMetatileDirectionallyImpassable, CheckForCollisionBetweenFieldObjects
Diffstat (limited to 'src/field_map_obj.c')
-rwxr-xr-x | src/field_map_obj.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 1f48c9aad..c94b5a180 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -3440,3 +3440,34 @@ bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *mapObject, s16 x, } return 0; } + +bool8 IsMetatileDirectionallyImpassable(struct MapObject *mapObject, s16 x, s16 y, u8 direction) +{ + if (gUnknown_08375684[direction - 1](mapObject->mapobj_unk_1E) || gUnknown_08375694[direction - 1](MapGridGetMetatileBehaviorAt(x, y))) + { + return 1; + } + return 0; +} + +bool8 CheckForCollisionBetweenFieldObjects(struct MapObject *mapObject, s16 x, s16 y) +{ + struct MapObject *mapObject2; + u8 i; + for (i=0; i<16; i++) + { + mapObject2 = &gMapObjects[i]; + if (mapObject2->active && mapObject2 != mapObject) + { + if ((mapObject2->coords2.x != x || mapObject2->coords2.y != y) && (mapObject2->coords3.x != x || mapObject2->coords3.y != y)) + { + continue; + } + if (AreZCoordsCompatible(mapObject->mapobj_unk_0B_0, mapObject2->mapobj_unk_0B_0)) + { + return 1; + } + } + } + return 0; +} |