From a08f11cab32bf4e2557f33fd275ec8c7b4f165c9 Mon Sep 17 00:00:00 2001 From: scnorton Date: Wed, 6 Sep 2017 09:29:59 -0400 Subject: [PATCH] sub_808D438 --- asm/field_map_obj.s | 11 ----------- include/field_map_obj.h | 2 ++ include/field_player_avatar.h | 10 ++++++++++ include/rom4.h | 7 +++++++ src/field_map_obj.c | 17 +++++++++++++++-- 5 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 include/field_player_avatar.h create mode 100644 include/rom4.h diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 0ea219238..321f556f1 100644 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,17 +5,6 @@ .text - thumb_func_start sub_808D438 -sub_808D438: @ 808D438 - push {lr} - bl strange_npc_table_clear - bl npcs_clear_ids_and_state - bl ClearPlayerAvatarInfo - bl sub_808D450 - pop {r0} - bx r0 - thumb_func_end sub_808D438 - thumb_func_start sub_808D450 sub_808D450: @ 808D450 push {r4-r6,lr} diff --git a/include/field_map_obj.h b/include/field_map_obj.h index e40f09062..30490d4c6 100644 --- a/include/field_map_obj.h +++ b/include/field_map_obj.h @@ -9,4 +9,6 @@ extern struct MapObject gUnknown_02037350[16]; // Exported ROM declarations +void sub_808D438(void); + #endif //POKEEMERALD_FIELD_MAP_OBJ_H diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h new file mode 100644 index 000000000..8438add26 --- /dev/null +++ b/include/field_player_avatar.h @@ -0,0 +1,10 @@ +// +// Created by Scott Norton on 9/6/17. +// + +#ifndef POKEEMERALD_FIELD_PLAYER_AVATAR_H +#define POKEEMERALD_FIELD_PLAYER_AVATAR_H + +void ClearPlayerAvatarInfo(void); + +#endif //POKEEMERALD_FIELD_PLAYER_AVATAR_H diff --git a/include/rom4.h b/include/rom4.h new file mode 100644 index 000000000..956160afb --- /dev/null +++ b/include/rom4.h @@ -0,0 +1,7 @@ + +#ifndef POKEEMERALD_ROM4_H +#define POKEEMERALD_ROM4_H + +void strange_npc_table_clear(void); + +#endif //POKEEMERALD_ROM4_H diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 193182775..fd4a19397 100644 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -1,6 +1,9 @@ // Includes #include "global.h" +#include "sprite.h" +#include "rom4.h" +#include "field_player_avatar.h" #include "field_map_obj.h" // Static struct declarations @@ -9,11 +12,13 @@ // Static ROM declarations +void sub_808D450(void); + // ROM data // Code -void npc_clear_ids_and_state(struct MapObject *mapObject) +/*static*/ void npc_clear_ids_and_state(struct MapObject *mapObject) { memset(mapObject, 0, sizeof(struct MapObject)); mapObject->localId = 0xFF; @@ -22,7 +27,7 @@ void npc_clear_ids_and_state(struct MapObject *mapObject) mapObject->mapobj_unk_1C = -1; } -void npcs_clear_ids_and_state(void) +static void npcs_clear_ids_and_state(void) { u8 i; for (i = 0; i < ARRAY_COUNT(gUnknown_02037350); i ++) @@ -30,3 +35,11 @@ void npcs_clear_ids_and_state(void) npc_clear_ids_and_state(&gUnknown_02037350[i]); } } + +void sub_808D438(void) +{ + strange_npc_table_clear(); + npcs_clear_ids_and_state(); + ClearPlayerAvatarInfo(); + sub_808D450(); +}