diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-09-13 20:22:38 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-09-13 20:22:38 -0400 |
commit | 6b906d95b986611d148780e8c8fc0be367569ca2 (patch) | |
tree | 38f17fbb32df34403e2ad306d096fdc142252e47 /src | |
parent | a04666e2d3f04e0f8158ce2a769042f696846830 (diff) |
Three more running-past-facing-direction callbacks
Diffstat (limited to 'src')
-rwxr-xr-x | src/field_map_obj.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 4b92a792d..00ccb4493 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -1903,3 +1903,75 @@ u8 GetNorthEastRunningPastFacingDirection(s16 dx1, s16 dy1, s16 dx2, s16 dy2) } return direction; } + +u8 GetNorthWestRunningPastFacingDirection(s16 dx1, s16 dy1, s16 dx2, s16 dy2) +{ + u8 direction; + + direction = GetRegularRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_SOUTH) + { + direction = GetEastWestRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_WEST) + { + direction = DIR_NORTH; + } + } + else if (direction == DIR_WEST) + { + direction = GetNorthSouthRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_SOUTH) + { + direction = DIR_NORTH; + } + } + return direction; +} + +u8 GetSouthEastRunningPastFacingDirection(s16 dx1, s16 dy1, s16 dx2, s16 dy2) +{ + u8 direction; + + direction = GetRegularRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_NORTH) + { + direction = GetEastWestRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_EAST) + { + direction = DIR_SOUTH; + } + } + else if (direction == DIR_EAST) + { + direction = GetNorthSouthRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_NORTH) + { + direction = DIR_SOUTH; + } + } + return direction; +} + +u8 GetSouthWestRunningPastFacingDirection(s16 dx1, s16 dy1, s16 dx2, s16 dy2) +{ + u8 direction; + + direction = GetRegularRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_NORTH) + { + direction = GetEastWestRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_WEST) + { + direction = DIR_SOUTH; + } + } + else if (direction == DIR_WEST) + { + direction = GetNorthSouthRunningPastFacingDirection(dx1, dy1, dx2, dy2); + if (direction == DIR_NORTH) + { + direction = DIR_SOUTH; + } + } + return direction; +} |