From 34950dbd13f9ec9e4616b3cb33a9b1aae912eee2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 16 Sep 2017 17:34:41 -0400 Subject: [PATCH] remaining field object step callbacks --- asm/field_map_obj.s | 331 ---------------------------------------- include/field_map_obj.h | 5 +- src/field_map_obj.c | 66 ++++++++ 3 files changed, 70 insertions(+), 332 deletions(-) diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 92b6022f6b..8ea5a8b764 100755 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,337 +5,6 @@ .text - thumb_func_start FieldObjectCB_WalkInPlace1 -FieldObjectCB_WalkInPlace1: @ 80926D4 - push {lr} - adds r1, r0, 0 - movs r0, 0x2E - ldrsh r2, [r1, r0] - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - ldr r2, =gMapObjects - adds r0, r2 - ldr r2, =sub_80926F8 - bl FieldObjectStep - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectCB_WalkInPlace1 - - thumb_func_start sub_80926F8 -sub_80926F8: @ 80926F8 - push {r4,lr} - ldr r3, =gUnknown_0850DAA0 - movs r4, 0x30 - ldrsh r2, [r1, r4] - lsls r2, 2 - adds r2, r3 - ldr r2, [r2] - bl _call_via_r2 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80926F8 - - thumb_func_start sub_8092718 -sub_8092718: @ 8092718 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl npc_reset - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl GetStepInPlaceDelay16AnimId - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl FieldObjectSetRegularAnim - movs r0, 0x1 - strh r0, [r5, 0x30] - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8092718 - - thumb_func_start FieldObjectCB_WalkInPlace4 -FieldObjectCB_WalkInPlace4: @ 8092744 - push {lr} - adds r1, r0, 0 - movs r0, 0x2E - ldrsh r2, [r1, r0] - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - ldr r2, =gMapObjects - adds r0, r2 - ldr r2, =sub_8092768 - bl FieldObjectStep - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectCB_WalkInPlace4 - - thumb_func_start sub_8092768 -sub_8092768: @ 8092768 - push {r4,lr} - ldr r3, =gUnknown_0850DAA8 - movs r4, 0x30 - ldrsh r2, [r1, r4] - lsls r2, 2 - adds r2, r3 - ldr r2, [r2] - bl _call_via_r2 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8092768 - - thumb_func_start sub_8092788 -sub_8092788: @ 8092788 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl npc_reset - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl GetStepInPlaceDelay32AnimId - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl FieldObjectSetRegularAnim - movs r0, 0x1 - strh r0, [r5, 0x30] - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8092788 - - thumb_func_start FieldObjectCB_WalkInPlace2 -FieldObjectCB_WalkInPlace2: @ 80927B4 - push {lr} - adds r1, r0, 0 - movs r0, 0x2E - ldrsh r2, [r1, r0] - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - ldr r2, =gMapObjects - adds r0, r2 - ldr r2, =sub_80927D8 - bl FieldObjectStep - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectCB_WalkInPlace2 - - thumb_func_start sub_80927D8 -sub_80927D8: @ 80927D8 - push {r4,lr} - ldr r3, =gUnknown_0850DAB0 - movs r4, 0x30 - ldrsh r2, [r1, r4] - lsls r2, 2 - adds r2, r3 - ldr r2, [r2] - bl _call_via_r2 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80927D8 - - thumb_func_start sub_80927F8 -@ bool8 sub_80927F8(struct npc_state *fieldObject, struct obj *object) -sub_80927F8: @ 80927F8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl npc_reset - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl GetStepInPlaceDelay8AnimId - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl FieldObjectSetRegularAnim - movs r0, 0x1 - strh r0, [r5, 0x30] - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80927F8 - - thumb_func_start FieldObjectCB_WalkInPlace3 -FieldObjectCB_WalkInPlace3: @ 8092824 - push {lr} - adds r1, r0, 0 - movs r0, 0x2E - ldrsh r2, [r1, r0] - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - ldr r2, =gMapObjects - adds r0, r2 - ldr r2, =sub_8092848 - bl FieldObjectStep - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectCB_WalkInPlace3 - - thumb_func_start sub_8092848 -sub_8092848: @ 8092848 - push {r4,lr} - ldr r3, =gUnknown_0850DAB8 - movs r4, 0x30 - ldrsh r2, [r1, r4] - lsls r2, 2 - adds r2, r3 - ldr r2, [r2] - bl _call_via_r2 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8092848 - - thumb_func_start sub_8092868 -sub_8092868: @ 8092868 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl npc_reset - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl GetStepInPlaceDelay4AnimId - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl FieldObjectSetRegularAnim - movs r0, 0x1 - strh r0, [r5, 0x30] - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8092868 - - thumb_func_start FieldObjectCB_Hidden2 -FieldObjectCB_Hidden2: @ 8092894 - push {lr} - adds r1, r0, 0 - movs r0, 0x2E - ldrsh r2, [r1, r0] - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - ldr r2, =gMapObjects - adds r0, r2 - ldr r2, =sub_80928B8 - bl FieldObjectStep - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectCB_Hidden2 - - thumb_func_start sub_80928B8 -sub_80928B8: @ 80928B8 - push {r4,lr} - ldr r3, =gUnknown_0850DAC0 - movs r4, 0x30 - ldrsh r2, [r1, r4] - lsls r2, 2 - adds r2, r3 - ldr r2, [r2] - bl _call_via_r2 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80928B8 - - thumb_func_start sub_80928D8 -sub_80928D8: @ 80928D8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl npc_reset - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl GetFaceDirectionAnimId - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl FieldObjectSetRegularAnim - ldrb r0, [r4, 0x1] - movs r1, 0x20 - orrs r0, r1 - strb r0, [r4, 0x1] - movs r0, 0x1 - strh r0, [r5, 0x30] - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80928D8 - - thumb_func_start sub_809290C -sub_809290C: @ 809290C - push {r4,lr} - adds r4, r1, 0 - bl FieldObjectExecRegularAnim - lsls r0, 24 - cmp r0, 0 - bne _0809291E - movs r0, 0 - b _08092924 -_0809291E: - movs r0, 0x2 - strh r0, [r4, 0x30] - movs r0, 0x1 -_08092924: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_809290C - - thumb_func_start sub_809292C -sub_809292C: @ 809292C - ldrb r2, [r0] - movs r1, 0x3 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - movs r0, 0 - bx lr - thumb_func_end sub_809292C - thumb_func_start npc_reset @ void npc_reset(struct npc_state *fieldObject, struct obj *object) npc_reset: @ 809293C diff --git a/include/field_map_obj.h b/include/field_map_obj.h index f603e9a8ea..03ba36e87a 100755 --- a/include/field_map_obj.h +++ b/include/field_map_obj.h @@ -63,7 +63,10 @@ void sub_808EB08(struct MapObject *, s16, s16); void sub_808F254(u8, u8, u8); void FieldObjectStep(struct MapObject *, struct Sprite *, bool8(struct MapObject *, struct Sprite *)); u8 GetOppositeDirection(u8); -u8 GetStepInPlaceDelay16AnimId(u8); +u8 GetStepInPlaceDelay4AnimId(u32); +u8 GetStepInPlaceDelay8AnimId(u32); +u8 GetStepInPlaceDelay16AnimId(u32); +u8 GetStepInPlaceDelay32AnimId(u32); u8 npc_block_way(struct MapObject *, s16, s16, u32); // Exported data declarations diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 80c376a2fa..5d5747be93 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -3441,6 +3441,72 @@ bool8 sub_80926B8 (struct MapObject *mapObject, struct Sprite *sprite) return FALSE; } +field_object_step(WalkInPlace1, gUnknown_0850DAA0) + +bool8 sub_8092718(struct MapObject *mapObject, struct Sprite *sprite) +{ + npc_reset(mapObject, sprite); + FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay16AnimId(mapObject->mapobj_unk_18)); + sprite->data1 = 1; + return TRUE; +} + +field_object_step(WalkInPlace4, gUnknown_0850DAA8) + +bool8 sub_8092788(struct MapObject *mapObject, struct Sprite *sprite) +{ + npc_reset(mapObject, sprite); + FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay32AnimId(mapObject->mapobj_unk_18)); + sprite->data1 = 1; + return TRUE; +} + +field_object_step(WalkInPlace2, gUnknown_0850DAB0) + +bool8 sub_80927F8(struct MapObject *mapObject, struct Sprite *sprite) +{ + npc_reset(mapObject, sprite); + FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay8AnimId(mapObject->mapobj_unk_18)); + sprite->data1 = 1; + return TRUE; +} + +field_object_step(WalkInPlace3, gUnknown_0850DAB8) + +bool8 sub_8092868(struct MapObject *mapObject, struct Sprite *sprite) +{ + npc_reset(mapObject, sprite); + FieldObjectSetRegularAnim(mapObject, sprite, GetStepInPlaceDelay4AnimId(mapObject->mapobj_unk_18)); + sprite->data1 = 1; + return TRUE; +} + +field_object_step(Hidden2, gUnknown_0850DAC0) + +bool8 sub_80928D8(struct MapObject *mapObject, struct Sprite *sprite) +{ + npc_reset(mapObject, sprite); + FieldObjectSetRegularAnim(mapObject, sprite, GetFaceDirectionAnimId(mapObject->mapobj_unk_18)); + mapObject->mapobj_bit_13 = TRUE; + sprite->data1 = 1; + return TRUE; +} +bool8 sub_809290C(struct MapObject *mapObject, struct Sprite *sprite) +{ + if (FieldObjectExecRegularAnim(mapObject, sprite)) + { + sprite->data1 = 2; + return TRUE; + } + return FALSE; +} + +bool8 sub_809292C(struct MapObject *mapObject, struct Sprite *sprite) +{ + mapObject->mapobj_bit_1 = FALSE; + return FALSE; +} + asm(".section .text.get_face_direction_anim_id"); void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);