From 9b4c61658a6a5d164ba67d6434be94540601cc83 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 17 Sep 2017 10:58:24 -0400 Subject: [PATCH] npc_set_direction_and_anim__an_proceed --- asm/field_map_obj.s | 59 --------------------------------------- include/map_obj_8097404.h | 2 ++ src/field_map_obj.c | 23 +++++++++++++++ 3 files changed, 25 insertions(+), 59 deletions(-) diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 7ef8e24c61..958e66bd68 100755 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,65 +5,6 @@ .text - thumb_func_start npc_set_direction_and_anim__an_proceed -npc_set_direction_and_anim__an_proceed: @ 8094D80 - push {r4-r6,lr} - adds r6, r0, 0 - adds r5, r1, 0 - adds r4, r2, 0 - adds r1, r3, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - movs r2, 0 - bl obj_anim_image_set_and_seek - adds r0, r6, 0 - adds r1, r4, 0 - bl FieldObjectSetDirection - movs r0, 0x1 - strh r0, [r5, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end npc_set_direction_and_anim__an_proceed - - thumb_func_start sub_8094DAC -sub_8094DAC: @ 8094DAC - push {lr} - ldrb r2, [r0, 0x18] - lsrs r2, 4 - adds r3, r1, 0 - adds r3, 0x2A - ldrb r3, [r3] - bl npc_set_direction_and_anim__an_proceed - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_8094DAC - - thumb_func_start sub_8094DC4 -sub_8094DC4: @ 8094DC4 - push {r4,lr} - adds r4, r1, 0 - adds r0, r4, 0 - bl sub_80979BC - lsls r0, 24 - cmp r0, 0 - bne _08094DD8 - movs r0, 0 - b _08094DDE -_08094DD8: - movs r0, 0x2 - strh r0, [r4, 0x32] - movs r0, 0x1 -_08094DDE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8094DC4 - thumb_func_start sub_8094DE4 sub_8094DE4: @ 8094DE4 push {r4,r5,lr} diff --git a/include/map_obj_8097404.h b/include/map_obj_8097404.h index 1fc653163a..08b69f49a7 100644 --- a/include/map_obj_8097404.h +++ b/include/map_obj_8097404.h @@ -22,5 +22,7 @@ void sub_809783C(struct Sprite *, u8, u8, u8); void DoShadowFieldEffect(struct MapObject *); u8 sub_809785C(struct Sprite *); u8 sub_80978E4(struct Sprite *); +void obj_anim_image_set_and_seek(struct Sprite *, u8, u8); +bool8 sub_80979BC(struct Sprite *); #endif //GUARD_MAP_OBJ_8097404_H diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 5fd92199f9..e1ba386e0f 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -4487,3 +4487,26 @@ an_walk_any_2_macro(sub_8094C80, do_run_anim, npc_obj_ministep_stop_on_arrival, an_walk_any_2_macro(sub_8094CC0, do_run_anim, npc_obj_ministep_stop_on_arrival, DIR_NORTH) an_walk_any_2_macro(sub_8094D00, do_run_anim, npc_obj_ministep_stop_on_arrival, DIR_WEST) an_walk_any_2_macro(sub_8094D40, do_run_anim, npc_obj_ministep_stop_on_arrival, DIR_EAST) + +void npc_set_direction_and_anim__an_proceed(struct MapObject *mapObject, struct Sprite *sprite, u8 direction, u8 animNum) +{ + obj_anim_image_set_and_seek(sprite, animNum, 0); + FieldObjectSetDirection(mapObject, direction); + sprite->data2 = 1; +} + +bool8 sub_8094DAC(struct MapObject *mapObject, struct Sprite *sprite) +{ + npc_set_direction_and_anim__an_proceed(mapObject, sprite, mapObject->placeholder18, sprite->animNum); + return FALSE; +} + +bool8 sub_8094DC4(struct MapObject *mapObject, struct Sprite *sprite) +{ + if (sub_80979BC(sprite)) + { + sprite->data2 = 2; + return TRUE; + } + return FALSE; +}