From 5812bc4ebe83bb80294bbb40846ae6fb1c76e5bf Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 16 Sep 2017 18:33:38 -0400 Subject: [PATCH] npc_block_way__next_tile --- asm/field_map_obj.s | 45 ----------------------------------------- include/data3.h | 1 - include/field_map_obj.h | 1 + src/field_map_obj.c | 13 ++++++++++++ 4 files changed, 14 insertions(+), 46 deletions(-) diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index a6333af8f..e772aa178 100755 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,51 +5,6 @@ .text - thumb_func_start npc_running_behaviour_by_direction -npc_running_behaviour_by_direction: @ 8092B78 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0850DB53 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end npc_running_behaviour_by_direction - - thumb_func_start npc_block_way__next_tile -npc_block_way__next_tile: @ 8092B88 - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - lsls r5, r1, 24 - lsrs r5, 24 - ldrh r1, [r6, 0x10] - mov r0, sp - strh r1, [r0] - ldrh r0, [r6, 0x12] - mov r4, sp - adds r4, 0x2 - strh r0, [r4] - adds r0, r5, 0 - mov r1, sp - adds r2, r4, 0 - bl MoveCoords - mov r0, sp - movs r2, 0 - ldrsh r1, [r0, r2] - movs r0, 0 - ldrsh r2, [r4, r0] - adds r0, r6, 0 - adds r3, r5, 0 - bl npc_block_way - lsls r0, 24 - lsrs r0, 24 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end npc_block_way__next_tile - thumb_func_start npc_block_way @ u8 npc_block_way(struct npc_state *fieldObject, u16 x, u16 y, u8 direction) npc_block_way: @ 8092BC8 diff --git a/include/data3.h b/include/data3.h index b2b19b050..6d9bbd084 100755 --- a/include/data3.h +++ b/include/data3.h @@ -35,7 +35,6 @@ extern const u8 gUnknown_0850D8C4[5]; extern const u8 gUnknown_0850D8E8[4]; extern bool8 (*const gUnknown_0850DA64[])(struct MapObject *, struct Sprite *, u8, bool8(u8)); - extern const u8 gUnknown_0850DBA0[5]; #endif //GUARD_DATA3_H diff --git a/include/field_map_obj.h b/include/field_map_obj.h index 03ba36e87..a952cfac6 100755 --- a/include/field_map_obj.h +++ b/include/field_map_obj.h @@ -68,6 +68,7 @@ u8 GetStepInPlaceDelay8AnimId(u32); u8 GetStepInPlaceDelay16AnimId(u32); u8 GetStepInPlaceDelay32AnimId(u32); u8 npc_block_way(struct MapObject *, s16, s16, u32); +void MoveCoords(u8, s16 *, s16 *); // Exported data declarations diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 06fd36be3..93baccf36 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -3635,6 +3635,19 @@ void npc_set_running_behaviour_etc(struct MapObject *mapObject, u8 animPattern) gSprites[mapObject->spriteId].data1 = 0; } +dirn2anim(npc_running_behaviour_by_direction, gUnknown_0850DB53) + +bool8 npc_block_way__next_tile(struct MapObject *mapObject, u8 direction) +{ + s16 x; + s16 y; + + x = mapObject->coords2.x; + y = mapObject->coords2.y; + MoveCoords(direction, &x, &y); + return npc_block_way(mapObject, x, y, direction); +} + asm(".section .text.get_face_direction_anim_id"); void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);