diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index ff3c8c48dc..5801bbc5f3 100644 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,25 +5,6 @@ .text - thumb_func_start npc_clear_ids_and_state -npc_clear_ids_and_state: @ 808D3F0 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - movs r2, 0x24 - bl memset - movs r0, 0xFF - strb r0, [r4, 0x8] - movs r0, 0x1 - negs r0, r0 - strb r0, [r4, 0x9] - strb r0, [r4, 0xA] - strb r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - thumb_func_end npc_clear_ids_and_state - thumb_func_start npcs_clear_ids_and_state npcs_clear_ids_and_state: @ 808D410 push {r4,r5,lr} diff --git a/include/global.h b/include/global.h index c43b57e038..f9c5f68bea 100644 --- a/include/global.h +++ b/include/global.h @@ -9,6 +9,11 @@ // to help in decompiling #define asm_comment(x) asm volatile("@ -- " x " -- ") +#ifdef __APPLE__ +void memset(void *, int, size_t); +void memcpy(void *, const void *, size_t); +#endif // __APPLE__ + #define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0])) #define POKEMON_NAME_LENGTH 10 diff --git a/ld_script.txt b/ld_script.txt index d0ae744d1e..6e9a7e63c8 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -85,6 +85,7 @@ SECTIONS { asm/field_camera.o(.text); asm/field_door.o(.text); asm/field_player_avatar.o(.text); + src/field_map_obj.o(.text); asm/field_map_obj.o(.text); asm/field_ground_effect.o(.text); asm/map_obj_8097404.o(.text); diff --git a/src/field_map_obj.c b/src/field_map_obj.c index ec9a7c0029..9451863b4d 100644 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -13,4 +13,11 @@ // Code - +void npc_clear_ids_and_state(struct MapObject *mapObject) +{ + memset(mapObject, 0, sizeof(struct MapObject)); + mapObject->localId = 0xFF; + mapObject->mapNum = -1; + mapObject->mapGroup = -1; + mapObject->mapobj_unk_1C = -1; +}