Skip to content

Commit

Permalink
Heal locations to enum, add NONE
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Sep 26, 2024
1 parent e301b9a commit 3e27fc8
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 77 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ $(C_OBJECTS): $(BUILD_DIR)/%.o: %.c $$(C_DEP)
# Only .s files in data need preproc
$(BUILD_DIR)/data/%.o: data/%.s $$(ASM_DEP)
@echo "$(AS) <flags> -o $@ $<"
@$(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@
@$(PREPROC) $< charmap.txt | $(CPP) -I include | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@

$(BUILD_DIR)/%.o: %.s $$(ASM_DEP)
@echo "$(AS) <flags> -o $@ $<"
Expand Down
47 changes: 25 additions & 22 deletions include/constants/heal_locations.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
#ifndef GUARD_CONSTANTS_HEAL_LOCATIONS_H
#define GUARD_CONSTANTS_HEAL_LOCATIONS_H

#define HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F 1
#define HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F 2
#define HEAL_LOCATION_PETALBURG_CITY 3
#define HEAL_LOCATION_SLATEPORT_CITY 4
#define HEAL_LOCATION_MAUVILLE_CITY 5
#define HEAL_LOCATION_RUSTBORO_CITY 6
#define HEAL_LOCATION_FORTREE_CITY 7
#define HEAL_LOCATION_LILYCOVE_CITY 8
#define HEAL_LOCATION_MOSSDEEP_CITY 9
#define HEAL_LOCATION_SOOTOPOLIS_CITY 10
#define HEAL_LOCATION_EVER_GRANDE_CITY 11
#define HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE 12
#define HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE 13
#define HEAL_LOCATION_OLDALE_TOWN 14
#define HEAL_LOCATION_DEWFORD_TOWN 15
#define HEAL_LOCATION_LAVARIDGE_TOWN 16
#define HEAL_LOCATION_FALLARBOR_TOWN 17
#define HEAL_LOCATION_VERDANTURF_TOWN 18
#define HEAL_LOCATION_PACIFIDLOG_TOWN 19
#define HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE 20
#define HEAL_LOCATION_BATTLE_TOWER_OUTSIDE 21
#define HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR 22
enum {
HEAL_LOCATION_NONE,
HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F,
HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F,
HEAL_LOCATION_PETALBURG_CITY,
HEAL_LOCATION_SLATEPORT_CITY,
HEAL_LOCATION_MAUVILLE_CITY,
HEAL_LOCATION_RUSTBORO_CITY,
HEAL_LOCATION_FORTREE_CITY,
HEAL_LOCATION_LILYCOVE_CITY,
HEAL_LOCATION_MOSSDEEP_CITY,
HEAL_LOCATION_SOOTOPOLIS_CITY,
HEAL_LOCATION_EVER_GRANDE_CITY,
HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE,
HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE,
HEAL_LOCATION_OLDALE_TOWN,
HEAL_LOCATION_DEWFORD_TOWN,
HEAL_LOCATION_LAVARIDGE_TOWN,
HEAL_LOCATION_FALLARBOR_TOWN,
HEAL_LOCATION_VERDANTURF_TOWN,
HEAL_LOCATION_PACIFIDLOG_TOWN,
HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE,
HEAL_LOCATION_BATTLE_TOWER_OUTSIDE,
HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR,
};

#endif // GUARD_CONSTANTS_HEAL_LOCATIONS_H
6 changes: 3 additions & 3 deletions src/heal_location.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ u32 GetHealLocationIndexByMap(u16 mapGroup, u16 mapNum)
if (sHealLocations[i].mapGroup == mapGroup && sHealLocations[i].mapNum == mapNum)
return i + 1;
}
return 0;
return HEAL_LOCATION_NONE;
}

const struct HealLocation *GetHealLocationByMap(u16 mapGroup, u16 mapNum)
{
u32 index = GetHealLocationIndexByMap(mapGroup, mapNum);

if (index == 0)
if (index == HEAL_LOCATION_NONE)
return NULL;
else
return &sHealLocations[index - 1];
}

const struct HealLocation *GetHealLocation(u32 index)
{
if (index == 0)
if (index == HEAL_LOCATION_NONE)
return NULL;
else if (index > ARRAY_COUNT(sHealLocations))
return NULL;
Expand Down
102 changes: 51 additions & 51 deletions src/region_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,56 +1164,56 @@ static const u8 sFlyTargetIcons_ImageLZ[] = INCBIN_U8("graphics/pokenav/fly_targ

static const u8 sMapHealLocations[][3] =
{
{MAP_GROUP(MAP_LITTLEROOT_TOWN), MAP_NUM(MAP_LITTLEROOT_TOWN), HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F},
{MAP_GROUP(MAP_OLDALE_TOWN), MAP_NUM(MAP_OLDALE_TOWN), HEAL_LOCATION_OLDALE_TOWN},
{MAP_GROUP(MAP_DEWFORD_TOWN), MAP_NUM(MAP_DEWFORD_TOWN), HEAL_LOCATION_DEWFORD_TOWN},
{MAP_GROUP(MAP_LAVARIDGE_TOWN), MAP_NUM(MAP_LAVARIDGE_TOWN), HEAL_LOCATION_LAVARIDGE_TOWN},
{MAP_GROUP(MAP_FALLARBOR_TOWN), MAP_NUM(MAP_FALLARBOR_TOWN), HEAL_LOCATION_FALLARBOR_TOWN},
{MAP_GROUP(MAP_VERDANTURF_TOWN), MAP_NUM(MAP_VERDANTURF_TOWN), HEAL_LOCATION_VERDANTURF_TOWN},
{MAP_GROUP(MAP_PACIFIDLOG_TOWN), MAP_NUM(MAP_PACIFIDLOG_TOWN), HEAL_LOCATION_PACIFIDLOG_TOWN},
{MAP_GROUP(MAP_PETALBURG_CITY), MAP_NUM(MAP_PETALBURG_CITY), HEAL_LOCATION_PETALBURG_CITY},
{MAP_GROUP(MAP_SLATEPORT_CITY), MAP_NUM(MAP_SLATEPORT_CITY), HEAL_LOCATION_SLATEPORT_CITY},
{MAP_GROUP(MAP_MAUVILLE_CITY), MAP_NUM(MAP_MAUVILLE_CITY), HEAL_LOCATION_MAUVILLE_CITY},
{MAP_GROUP(MAP_RUSTBORO_CITY), MAP_NUM(MAP_RUSTBORO_CITY), HEAL_LOCATION_RUSTBORO_CITY},
{MAP_GROUP(MAP_FORTREE_CITY), MAP_NUM(MAP_FORTREE_CITY), HEAL_LOCATION_FORTREE_CITY},
{MAP_GROUP(MAP_LILYCOVE_CITY), MAP_NUM(MAP_LILYCOVE_CITY), HEAL_LOCATION_LILYCOVE_CITY},
{MAP_GROUP(MAP_MOSSDEEP_CITY), MAP_NUM(MAP_MOSSDEEP_CITY), HEAL_LOCATION_MOSSDEEP_CITY},
{MAP_GROUP(MAP_SOOTOPOLIS_CITY), MAP_NUM(MAP_SOOTOPOLIS_CITY), HEAL_LOCATION_SOOTOPOLIS_CITY},
{MAP_GROUP(MAP_EVER_GRANDE_CITY), MAP_NUM(MAP_EVER_GRANDE_CITY), HEAL_LOCATION_EVER_GRANDE_CITY},
{MAP_GROUP(MAP_ROUTE101), MAP_NUM(MAP_ROUTE101), 0},
{MAP_GROUP(MAP_ROUTE102), MAP_NUM(MAP_ROUTE102), 0},
{MAP_GROUP(MAP_ROUTE103), MAP_NUM(MAP_ROUTE103), 0},
{MAP_GROUP(MAP_ROUTE104), MAP_NUM(MAP_ROUTE104), 0},
{MAP_GROUP(MAP_ROUTE105), MAP_NUM(MAP_ROUTE105), 0},
{MAP_GROUP(MAP_ROUTE106), MAP_NUM(MAP_ROUTE106), 0},
{MAP_GROUP(MAP_ROUTE107), MAP_NUM(MAP_ROUTE107), 0},
{MAP_GROUP(MAP_ROUTE108), MAP_NUM(MAP_ROUTE108), 0},
{MAP_GROUP(MAP_ROUTE109), MAP_NUM(MAP_ROUTE109), 0},
{MAP_GROUP(MAP_ROUTE110), MAP_NUM(MAP_ROUTE110), 0},
{MAP_GROUP(MAP_ROUTE111), MAP_NUM(MAP_ROUTE111), 0},
{MAP_GROUP(MAP_ROUTE112), MAP_NUM(MAP_ROUTE112), 0},
{MAP_GROUP(MAP_ROUTE113), MAP_NUM(MAP_ROUTE113), 0},
{MAP_GROUP(MAP_ROUTE114), MAP_NUM(MAP_ROUTE114), 0},
{MAP_GROUP(MAP_ROUTE115), MAP_NUM(MAP_ROUTE115), 0},
{MAP_GROUP(MAP_ROUTE116), MAP_NUM(MAP_ROUTE116), 0},
{MAP_GROUP(MAP_ROUTE117), MAP_NUM(MAP_ROUTE117), 0},
{MAP_GROUP(MAP_ROUTE118), MAP_NUM(MAP_ROUTE118), 0},
{MAP_GROUP(MAP_ROUTE119), MAP_NUM(MAP_ROUTE119), 0},
{MAP_GROUP(MAP_ROUTE120), MAP_NUM(MAP_ROUTE120), 0},
{MAP_GROUP(MAP_ROUTE121), MAP_NUM(MAP_ROUTE121), 0},
{MAP_GROUP(MAP_ROUTE122), MAP_NUM(MAP_ROUTE122), 0},
{MAP_GROUP(MAP_ROUTE123), MAP_NUM(MAP_ROUTE123), 0},
{MAP_GROUP(MAP_ROUTE124), MAP_NUM(MAP_ROUTE124), 0},
{MAP_GROUP(MAP_ROUTE125), MAP_NUM(MAP_ROUTE125), 0},
{MAP_GROUP(MAP_ROUTE126), MAP_NUM(MAP_ROUTE126), 0},
{MAP_GROUP(MAP_ROUTE127), MAP_NUM(MAP_ROUTE127), 0},
{MAP_GROUP(MAP_ROUTE128), MAP_NUM(MAP_ROUTE128), 0},
{MAP_GROUP(MAP_ROUTE129), MAP_NUM(MAP_ROUTE129), 0},
{MAP_GROUP(MAP_ROUTE130), MAP_NUM(MAP_ROUTE130), 0},
{MAP_GROUP(MAP_ROUTE131), MAP_NUM(MAP_ROUTE131), 0},
{MAP_GROUP(MAP_ROUTE132), MAP_NUM(MAP_ROUTE132), 0},
{MAP_GROUP(MAP_ROUTE133), MAP_NUM(MAP_ROUTE133), 0},
{MAP_GROUP(MAP_ROUTE134), MAP_NUM(MAP_ROUTE134), 0},
[MAPSEC_LITTLEROOT_TOWN] = {MAP_GROUP(MAP_LITTLEROOT_TOWN), MAP_NUM(MAP_LITTLEROOT_TOWN), HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F},
[MAPSEC_OLDALE_TOWN] = {MAP_GROUP(MAP_OLDALE_TOWN), MAP_NUM(MAP_OLDALE_TOWN), HEAL_LOCATION_OLDALE_TOWN},
[MAPSEC_DEWFORD_TOWN] = {MAP_GROUP(MAP_DEWFORD_TOWN), MAP_NUM(MAP_DEWFORD_TOWN), HEAL_LOCATION_DEWFORD_TOWN},
[MAPSEC_LAVARIDGE_TOWN] = {MAP_GROUP(MAP_LAVARIDGE_TOWN), MAP_NUM(MAP_LAVARIDGE_TOWN), HEAL_LOCATION_LAVARIDGE_TOWN},
[MAPSEC_FALLARBOR_TOWN] = {MAP_GROUP(MAP_FALLARBOR_TOWN), MAP_NUM(MAP_FALLARBOR_TOWN), HEAL_LOCATION_FALLARBOR_TOWN},
[MAPSEC_VERDANTURF_TOWN] = {MAP_GROUP(MAP_VERDANTURF_TOWN), MAP_NUM(MAP_VERDANTURF_TOWN), HEAL_LOCATION_VERDANTURF_TOWN},
[MAPSEC_PACIFIDLOG_TOWN] = {MAP_GROUP(MAP_PACIFIDLOG_TOWN), MAP_NUM(MAP_PACIFIDLOG_TOWN), HEAL_LOCATION_PACIFIDLOG_TOWN},
[MAPSEC_PETALBURG_CITY] = {MAP_GROUP(MAP_PETALBURG_CITY), MAP_NUM(MAP_PETALBURG_CITY), HEAL_LOCATION_PETALBURG_CITY},
[MAPSEC_SLATEPORT_CITY] = {MAP_GROUP(MAP_SLATEPORT_CITY), MAP_NUM(MAP_SLATEPORT_CITY), HEAL_LOCATION_SLATEPORT_CITY},
[MAPSEC_MAUVILLE_CITY] = {MAP_GROUP(MAP_MAUVILLE_CITY), MAP_NUM(MAP_MAUVILLE_CITY), HEAL_LOCATION_MAUVILLE_CITY},
[MAPSEC_RUSTBORO_CITY] = {MAP_GROUP(MAP_RUSTBORO_CITY), MAP_NUM(MAP_RUSTBORO_CITY), HEAL_LOCATION_RUSTBORO_CITY},
[MAPSEC_FORTREE_CITY] = {MAP_GROUP(MAP_FORTREE_CITY), MAP_NUM(MAP_FORTREE_CITY), HEAL_LOCATION_FORTREE_CITY},
[MAPSEC_LILYCOVE_CITY] = {MAP_GROUP(MAP_LILYCOVE_CITY), MAP_NUM(MAP_LILYCOVE_CITY), HEAL_LOCATION_LILYCOVE_CITY},
[MAPSEC_MOSSDEEP_CITY] = {MAP_GROUP(MAP_MOSSDEEP_CITY), MAP_NUM(MAP_MOSSDEEP_CITY), HEAL_LOCATION_MOSSDEEP_CITY},
[MAPSEC_SOOTOPOLIS_CITY] = {MAP_GROUP(MAP_SOOTOPOLIS_CITY), MAP_NUM(MAP_SOOTOPOLIS_CITY), HEAL_LOCATION_SOOTOPOLIS_CITY},
[MAPSEC_EVER_GRANDE_CITY] = {MAP_GROUP(MAP_EVER_GRANDE_CITY), MAP_NUM(MAP_EVER_GRANDE_CITY), HEAL_LOCATION_EVER_GRANDE_CITY},
[MAPSEC_ROUTE_101] = {MAP_GROUP(MAP_ROUTE101), MAP_NUM(MAP_ROUTE101), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_102] = {MAP_GROUP(MAP_ROUTE102), MAP_NUM(MAP_ROUTE102), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_103] = {MAP_GROUP(MAP_ROUTE103), MAP_NUM(MAP_ROUTE103), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_104] = {MAP_GROUP(MAP_ROUTE104), MAP_NUM(MAP_ROUTE104), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_105] = {MAP_GROUP(MAP_ROUTE105), MAP_NUM(MAP_ROUTE105), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_106] = {MAP_GROUP(MAP_ROUTE106), MAP_NUM(MAP_ROUTE106), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_107] = {MAP_GROUP(MAP_ROUTE107), MAP_NUM(MAP_ROUTE107), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_108] = {MAP_GROUP(MAP_ROUTE108), MAP_NUM(MAP_ROUTE108), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_109] = {MAP_GROUP(MAP_ROUTE109), MAP_NUM(MAP_ROUTE109), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_110] = {MAP_GROUP(MAP_ROUTE110), MAP_NUM(MAP_ROUTE110), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_111] = {MAP_GROUP(MAP_ROUTE111), MAP_NUM(MAP_ROUTE111), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_112] = {MAP_GROUP(MAP_ROUTE112), MAP_NUM(MAP_ROUTE112), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_113] = {MAP_GROUP(MAP_ROUTE113), MAP_NUM(MAP_ROUTE113), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_114] = {MAP_GROUP(MAP_ROUTE114), MAP_NUM(MAP_ROUTE114), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_115] = {MAP_GROUP(MAP_ROUTE115), MAP_NUM(MAP_ROUTE115), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_116] = {MAP_GROUP(MAP_ROUTE116), MAP_NUM(MAP_ROUTE116), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_117] = {MAP_GROUP(MAP_ROUTE117), MAP_NUM(MAP_ROUTE117), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_118] = {MAP_GROUP(MAP_ROUTE118), MAP_NUM(MAP_ROUTE118), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_119] = {MAP_GROUP(MAP_ROUTE119), MAP_NUM(MAP_ROUTE119), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_120] = {MAP_GROUP(MAP_ROUTE120), MAP_NUM(MAP_ROUTE120), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_121] = {MAP_GROUP(MAP_ROUTE121), MAP_NUM(MAP_ROUTE121), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_122] = {MAP_GROUP(MAP_ROUTE122), MAP_NUM(MAP_ROUTE122), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_123] = {MAP_GROUP(MAP_ROUTE123), MAP_NUM(MAP_ROUTE123), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_124] = {MAP_GROUP(MAP_ROUTE124), MAP_NUM(MAP_ROUTE124), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_125] = {MAP_GROUP(MAP_ROUTE125), MAP_NUM(MAP_ROUTE125), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_126] = {MAP_GROUP(MAP_ROUTE126), MAP_NUM(MAP_ROUTE126), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_127] = {MAP_GROUP(MAP_ROUTE127), MAP_NUM(MAP_ROUTE127), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_128] = {MAP_GROUP(MAP_ROUTE128), MAP_NUM(MAP_ROUTE128), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_129] = {MAP_GROUP(MAP_ROUTE129), MAP_NUM(MAP_ROUTE129), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_130] = {MAP_GROUP(MAP_ROUTE130), MAP_NUM(MAP_ROUTE130), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_131] = {MAP_GROUP(MAP_ROUTE131), MAP_NUM(MAP_ROUTE131), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_132] = {MAP_GROUP(MAP_ROUTE132), MAP_NUM(MAP_ROUTE132), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_133] = {MAP_GROUP(MAP_ROUTE133), MAP_NUM(MAP_ROUTE133), HEAL_LOCATION_NONE},
[MAPSEC_ROUTE_134] = {MAP_GROUP(MAP_ROUTE134), MAP_NUM(MAP_ROUTE134), HEAL_LOCATION_NONE},
};

static const u8 *const sEverGrandeCityAreaNames[] =
Expand Down Expand Up @@ -1631,7 +1631,7 @@ void sub_80FC69C(void)
sub_8053538((FlagGet(FLAG_SYS_POKEMON_LEAGUE_FLY) && gRegionMapState->regionMap.everGrandeCityArea == 0) ? HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE : HEAL_LOCATION_EVER_GRANDE_CITY);
break;
default:
if (sMapHealLocations[gRegionMapState->regionMap.mapSectionId][2] != 0)
if (sMapHealLocations[gRegionMapState->regionMap.mapSectionId][2] != HEAL_LOCATION_NONE)
sub_8053538(sMapHealLocations[gRegionMapState->regionMap.mapSectionId][2]);
else
warp1_set_2(sMapHealLocations[gRegionMapState->regionMap.mapSectionId][0], sMapHealLocations[gRegionMapState->regionMap.mapSectionId][1], -1);
Expand Down

0 comments on commit 3e27fc8

Please sign in to comment.