From bbda7125f6286ea2fd47180018dbbe1a451fbf72 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 28 Oct 2017 21:43:06 -0400 Subject: [PATCH] Rename functions --- asm/rom4.s | 6 +++--- include/heal_location.h | 2 ++ src/heal_location.c | 18 +++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/asm/rom4.s b/asm/rom4.s index bf682fc51..bf354dbd0 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -841,7 +841,7 @@ sub_8084CCC: @ 8084CCC sub sp, 0x4 lsls r0, 24 lsrs r0, 24 - bl sub_8122CBC + bl GetHealLocationPointer adds r4, r0, 0 cmp r4, 0 beq _08084CFA @@ -885,7 +885,7 @@ Overworld_SetHealLocationWarp: @ 8084D1C sub sp, 0x8 lsls r0, 24 lsrs r0, 24 - bl sub_8122CBC + bl GetHealLocationPointer adds r5, r0, 0 cmp r5, 0 beq _08084D50 @@ -1187,7 +1187,7 @@ sub_8084F6C: @ 8084F6C sub sp, 0x8 lsls r0, 24 lsrs r0, 24 - bl sub_8122CBC + bl GetHealLocationPointer adds r5, r0, 0 cmp r5, 0 beq _08084FA0 diff --git a/include/heal_location.h b/include/heal_location.h index de29bf057..1f966f1ae 100644 --- a/include/heal_location.h +++ b/include/heal_location.h @@ -20,4 +20,6 @@ struct HealLocation // Exported ROM declarations +const struct HealLocation *GetHealLocationPointer(u32 loc); + #endif //GUARD_HEAL_LOCATION_H diff --git a/src/heal_location.c b/src/heal_location.c index 206acaf99..b2f50c1f9 100644 --- a/src/heal_location.c +++ b/src/heal_location.c @@ -15,7 +15,7 @@ // .rodata -const struct HealLocation gUnknown_0859F53C[] = { +static const struct HealLocation sSpawnLocations[] = { HEAL_LOCATION(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F, 4, 2), HEAL_LOCATION(LITTLEROOT_TOWN_MAYS_HOUSE_2F, 4, 2), HEAL_LOCATION(PETALBURG_CITY, 20, 17), @@ -40,17 +40,17 @@ const struct HealLocation gUnknown_0859F53C[] = { HEAL_LOCATION(BATTLE_FRONTIER_OUTSIDE_EAST, 3, 52) }; -#define NUM_HEAL_LOCATIONS (ARRAY_COUNT(gUnknown_0859F53C)) +#define NUM_HEAL_LOCATIONS (ARRAY_COUNT(sSpawnLocations)) // .text -u32 sub_8122C5C(u16 mapGroup, u16 mapNum) +static u32 GetHealLocationIndexFromMapGroupAndNum(u16 mapGroup, u16 mapNum) { u32 i; for (i = 0; i < NUM_HEAL_LOCATIONS; i ++) { - if (gUnknown_0859F53C[i].group == mapGroup && gUnknown_0859F53C[i].map == mapNum) + if (sSpawnLocations[i].group == mapGroup && sSpawnLocations[i].map == mapNum) { return i + 1; } @@ -58,19 +58,19 @@ u32 sub_8122C5C(u16 mapGroup, u16 mapNum) return 0; } -const struct HealLocation *sub_8122C94(u16 mapGroup, u16 mapNum) +const struct HealLocation *GetHealLocationPointerFromMapGroupAndNum(u16 mapGroup, u16 mapNum) { u32 loc; - loc = sub_8122C5C(mapGroup, mapNum); + loc = GetHealLocationIndexFromMapGroupAndNum(mapGroup, mapNum); if (loc == 0) { return NULL; } - return &gUnknown_0859F53C[loc - 1]; + return &sSpawnLocations[loc - 1]; } -const struct HealLocation *sub_8122CBC(u32 loc) +const struct HealLocation *GetHealLocationPointer(u32 loc) { if (loc == 0) { @@ -80,5 +80,5 @@ const struct HealLocation *sub_8122CBC(u32 loc) { return NULL; } - return &gUnknown_0859F53C[loc - 1]; + return &sSpawnLocations[loc - 1]; }