diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 0f021ac94..3abd53321 100755 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,36 +5,6 @@ .text - thumb_func_start sub_808F608 -sub_808F608: @ 808F608 - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - lsls r1, 16 - lsrs r0, r1, 16 - lsls r2, 16 - lsls r3, 16 - cmp r2, r3 - ble _0808F626 - movs r2, 0x4 - lsls r0, r4, 16 - cmp r0, 0 - bge _0808F630 - movs r2, 0x3 - b _0808F630 -_0808F626: - movs r2, 0x1 - lsls r0, 16 - cmp r0, 0 - bge _0808F630 - movs r2, 0x2 -_0808F630: - adds r0, r2, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_808F608 - thumb_func_start sub_808F638 sub_808F638: @ 808F638 push {lr} diff --git a/src/field_map_obj.c b/src/field_map_obj.c index f86e544a8..fd3cc7967 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -1832,3 +1832,26 @@ bool8 FieldObjectIsTrainerAndCloseToPlayer(struct MapObject *mapObject) } return TRUE; } + +u8 sub_808F608(s16 x1, s16 x2, s16 y1, s16 y2) +{ + u8 retval; + + if (y1 > y2) + { + retval = DIR_EAST; + if (x1 < 0) + { + retval = DIR_WEST; + } + } + else + { + retval = DIR_SOUTH; + if (x2 < 0) + { + retval = DIR_NORTH; + } + } + return retval; +}