From 511474cc15f8c7f52d4311b82898ee5c331b1260 Mon Sep 17 00:00:00 2001 From: scnorton Date: Fri, 8 Sep 2017 14:20:13 -0400 Subject: [PATCH] FieldObjectHandleDynamicGraphicsId --- asm/field_map_obj.s | 19 ------------------- src/field_map_obj.c | 10 +++++++++- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 8179cb0ec..b41d6607e 100644 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,25 +5,6 @@ .text - thumb_func_start FieldObjectHandleDynamicGraphicsId -@ void FieldObjectHandleDynamicGraphicsId(struct npc_state *fieldObject) -FieldObjectHandleDynamicGraphicsId: @ 808E6DC - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0x5] - cmp r0, 0xEF - bls _0808E6F2 - adds r0, 0x10 - lsls r0, 24 - lsrs r0, 24 - bl VarGetFieldObjectGraphicsId - strb r0, [r4, 0x5] -_0808E6F2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end FieldObjectHandleDynamicGraphicsId - thumb_func_start npc_by_local_id_and_map_set_field_1_bit_x20 npc_by_local_id_and_map_set_field_1_bit_x20: @ 808E6F8 push {r4,lr} diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 775a7b4e4..c8d25341f 100644 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -27,7 +27,7 @@ static void sub_808D450(void); static u8 GetFieldObjectIdByLocalId(u8); static u8 GetFieldObjectIdByLocalIdAndMapInternal(u8, u8, u8); static bool8 GetAvailableFieldObjectSlot(u16, u8, u8, u8 *); -/*static*/ void FieldObjectHandleDynamicGraphicsId(struct MapObject *); +static void FieldObjectHandleDynamicGraphicsId(struct MapObject *); static void RemoveFieldObjectInternal (struct MapObject *); /*static*/ u16 GetFieldObjectFlagIdByFieldObjectId(u8); /*static*/ const struct MapObjectGraphicsInfo *GetFieldObjectGraphicsInfo(u8); @@ -1027,3 +1027,11 @@ const struct MapObjectGraphicsInfo *GetFieldObjectGraphicsInfo(u8 graphicsId) } return gFieldObjectGraphicsInfoPointers[graphicsId]; } + +static void FieldObjectHandleDynamicGraphicsId(struct MapObject *mapObject) +{ + if (mapObject->graphicsId >= SPRITE_VAR) + { + mapObject->graphicsId = VarGetFieldObjectGraphicsId(mapObject->graphicsId - SPRITE_VAR); + } +}