From 15aba9a07633092ad340a5f11df962e2aaf6703d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 16 Sep 2017 17:24:26 -0400 Subject: [PATCH] Hidden1 --- asm/field_map_obj.s | 96 --------------------------------------------- src/field_map_obj.c | 34 ++++++++++++++++ 2 files changed, 34 insertions(+), 96 deletions(-) diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 12941a438a..92b6022f6b 100755 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,102 +5,6 @@ .text - thumb_func_start FieldObjectCB_Hidden1 -@ void FieldObjectCB_Hidden1(struct obj *object) -FieldObjectCB_Hidden1: @ 8092628 - push {r4,lr} - adds r3, r0, 0 - movs r1, 0x3C - ldrsh r0, [r3, r1] - ldr r4, =gMapObjects - cmp r0, 0 - bne _08092668 - movs r0, 0x2E - ldrsh r1, [r3, r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x3] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0, 0x3] - adds r2, r3, 0 - adds r2, 0x42 - ldrb r1, [r2] - movs r0, 0x3F - ands r0, r1 - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r3, 0x5] - movs r1, 0xC - orrs r0, r1 - strb r0, [r3, 0x5] - ldrh r0, [r3, 0x3C] - adds r0, 0x1 - strh r0, [r3, 0x3C] -_08092668: - movs r0, 0x2E - ldrsh r1, [r3, r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r2, =sub_809268C - adds r1, r3, 0 - bl FieldObjectStep - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end FieldObjectCB_Hidden1 - - thumb_func_start sub_809268C -sub_809268C: @ 809268C - push {r4,lr} - ldr r3, =gUnknown_0850DA9C - 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_809268C - - thumb_func_start sub_80926AC -sub_80926AC: @ 80926AC - push {lr} - bl npc_reset - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_80926AC - - thumb_func_start sub_80926B8 -@ bool8 sub_80926B8(struct npc_state *fieldObject, struct obj *object) -sub_80926B8: @ 80926B8 - push {r4,lr} - adds r4, r1, 0 - bl FieldObjectExecRegularAnim - lsls r0, 24 - cmp r0, 0 - beq _080926CA - movs r0, 0 - strh r0, [r4, 0x30] -_080926CA: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80926B8 - thumb_func_start FieldObjectCB_WalkInPlace1 FieldObjectCB_WalkInPlace1: @ 80926D4 push {lr} diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 7b62e6d051..80c376a2fa 100755 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -3407,6 +3407,40 @@ void FieldObjectCB_MountainDisguise(struct Sprite *sprite) FieldObjectStep(&gMapObjects[sprite->data0], sprite, sub_80925AC); } +extern bool8 (*const gUnknown_0850DA9C[])(struct MapObject *, struct Sprite *); +bool8 sub_809268C(struct MapObject *, struct Sprite *); + +void FieldObjectCB_Hidden1(struct Sprite *sprite) +{ + if (!sprite->data7) + { + gMapObjects[sprite->data0].mapobj_bit_26 = TRUE; + sprite->subspriteMode = 2; + sprite->oam.priority = 3; + sprite->data7 ++; + } + FieldObjectStep(&gMapObjects[sprite->data0], sprite, sub_809268C); +} + +bool8 sub_809268C(struct MapObject *mapObject, struct Sprite *sprite) +{ + return gUnknown_0850DA9C[sprite->data1](mapObject, sprite); +} + +bool8 sub_80926AC (struct MapObject *mapObject, struct Sprite *sprite) +{ + npc_reset(mapObject, sprite); + return FALSE; +} +bool8 sub_80926B8 (struct MapObject *mapObject, struct Sprite *sprite) +{ + if (FieldObjectExecRegularAnim(mapObject, sprite)) + { + sprite->data1 = 0; + } + return FALSE; +} + asm(".section .text.get_face_direction_anim_id"); void FieldObjectClearAnimIfSpecialAnimActive(struct MapObject *);