Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move heal locations data to their associated map.json #2034

Open
wants to merge 3 commits into
base: porymap-6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions data/maps/BattleFrontier_OutsideEast/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -525,5 +525,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "Common_EventScript_ShowPokemonCenterSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST",
"x": 3,
"y": 52
}
]
}
7 changes: 7 additions & 0 deletions data/maps/DewfordTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "DewfordTown_EventScript_HallSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_DEWFORD_TOWN",
"x": 2,
"y": 11
}
]
}
12 changes: 12 additions & 0 deletions data/maps/EverGrandeCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,17 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
"script": "Common_EventScript_ShowPokemonCenterSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_EVER_GRANDE_CITY",
"x": 27,
"y": 49
},
{
"id": "HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE",
"x": 18,
"y": 6
}
]
}
7 changes: 7 additions & 0 deletions data/maps/FallarborTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,12 @@
"item": "ITEM_NUGGET",
"flag": "FLAG_HIDDEN_ITEM_FALLARBOR_TOWN_NUGGET"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_FALLARBOR_TOWN",
"x": 14,
"y": 8
}
]
}
7 changes: 7 additions & 0 deletions data/maps/FortreeCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,5 +232,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
"script": "Common_EventScript_ShowPokemartSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_FORTREE_CITY",
"x": 5,
"y": 7
}
]
}
7 changes: 7 additions & 0 deletions data/maps/LavaridgeTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,12 @@
"item": "ITEM_ICE_HEAL",
"flag": "FLAG_HIDDEN_ITEM_LAVARIDGE_TOWN_ICE_HEAL"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_LAVARIDGE_TOWN",
"x": 9,
"y": 7
}
]
}
7 changes: 7 additions & 0 deletions data/maps/LilycoveCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -518,5 +518,12 @@
"item": "ITEM_POKE_BALL",
"flag": "FLAG_HIDDEN_ITEM_LILYCOVE_CITY_POKE_BALL"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_LILYCOVE_CITY",
"x": 24,
"y": 15
}
]
}
12 changes: 12 additions & 0 deletions data/maps/LittlerootTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,17 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "LittlerootTown_EventScript_MaysHouseSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE",
"x": 5,
"y": 9
},
{
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE",
"x": 14,
"y": 9
}
]
}
7 changes: 7 additions & 0 deletions data/maps/LittlerootTown_BrendansHouse_2F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "PlayersHouse_2F_EventScript_GameCube"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F",
"x": 4,
"y": 2
}
]
}
7 changes: 7 additions & 0 deletions data/maps/LittlerootTown_MaysHouse_2F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "LittlerootTown_MaysHouse_2F_EventScript_PC"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F",
"x": 4,
"y": 2
}
]
}
7 changes: 7 additions & 0 deletions data/maps/MauvilleCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "MauvilleCity_EventScript_GameCornerSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_MAUVILLE_CITY",
"x": 22,
"y": 6
}
]
}
7 changes: 7 additions & 0 deletions data/maps/MossdeepCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,5 +481,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "MossdeepCity_EventScript_WhiteRock"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_MOSSDEEP_CITY",
"x": 28,
"y": 17
}
]
}
7 changes: 7 additions & 0 deletions data/maps/OldaleTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
"script": "Common_EventScript_ShowPokemartSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_OLDALE_TOWN",
"x": 6,
"y": 17
}
]
}
7 changes: 7 additions & 0 deletions data/maps/PacifidlogTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
"script": "Common_EventScript_ShowPokemonCenterSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_PACIFIDLOG_TOWN",
"x": 8,
"y": 16
}
]
}
7 changes: 7 additions & 0 deletions data/maps/PetalburgCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,12 @@
"item": "ITEM_RARE_CANDY",
"flag": "FLAG_HIDDEN_ITEM_PETALBURG_CITY_RARE_CANDY"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_PETALBURG_CITY",
"x": 20,
"y": 17
}
]
}
7 changes: 7 additions & 0 deletions data/maps/RustboroCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -597,5 +597,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "RustboroCity_EventScript_CuttersHouseSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_RUSTBORO_CITY",
"x": 16,
"y": 39
}
]
}
7 changes: 7 additions & 0 deletions data/maps/SlateportCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -681,5 +681,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
"script": "SlateportCity_EventScript_BerryCrushRankingsSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_SLATEPORT_CITY",
"x": 19,
"y": 20
}
]
}
7 changes: 7 additions & 0 deletions data/maps/SootopolisCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -392,5 +392,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "SootopolisCity_EventScript_CitySign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_SOOTOPOLIS_CITY",
"x": 43,
"y": 32
}
]
}
7 changes: 7 additions & 0 deletions data/maps/SouthernIsland_Exterior/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "SouthernIsland_Exterior_EventScript_Sign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR",
"x": 15,
"y": 20
}
]
}
7 changes: 7 additions & 0 deletions data/maps/VerdanturfTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,12 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "VerdanturfTown_EventScript_RusturfTunnelSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_VERDANTURF_TOWN",
"x": 16,
"y": 4
}
]
}
4 changes: 2 additions & 2 deletions include/heal_location.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

struct HealLocation
{
s8 group;
s8 map;
s8 mapGroup;
s8 mapNum;
u16 x;
u16 y;
};
Expand Down
5 changes: 5 additions & 0 deletions map_data_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ INCLUDECONSTS_OUTDIR := include/constants

AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h
AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/heal_locations.h

MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json))
MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS))
MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS))
MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS))
MAP_JSONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/map.json,$(MAP_DIRS))

$(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.inc $(LAYOUTS_DIR)/layouts_table.inc $(MAPS_DIR)/headers.inc $(MAPS_DIR)/groups.inc $(MAPS_DIR)/connections.inc $(MAP_CONNECTIONS) $(MAP_HEADERS)
$(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@
Expand All @@ -31,3 +33,6 @@ $(MAPS_OUTDIR)/connections.inc $(MAPS_OUTDIR)/groups.inc $(MAPS_OUTDIR)/events.i

$(LAYOUTS_OUTDIR)/layouts.inc $(LAYOUTS_OUTDIR)/layouts_table.inc $(INCLUDECONSTS_OUTDIR)/layouts.h: $(LAYOUTS_DIR)/layouts.json
$(MAPJSON) layouts emerald $< $(LAYOUTS_OUTDIR) $(INCLUDECONSTS_OUTDIR)

$(DATA_SRC_SUBDIR)/heal_locations.h: $(MAP_JSONS)
@$(MAPJSON) heal_locations emerald $^ $(DATA_SRC_SUBDIR)/heal_locations.h
1 change: 1 addition & 0 deletions src/data/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
heal_locations.h
wild_encounters.h
region_map/region_map_entries.h
region_map/porymap_config.json
25 changes: 0 additions & 25 deletions src/data/heal_locations.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/heal_location.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ u32 GetHealLocationIndexByMap(u16 mapGroup, u16 mapNum)

for (i = 0; i < ARRAY_COUNT(sHealLocations); i++)
{
if (sHealLocations[i].group == mapGroup && sHealLocations[i].map == mapNum)
if (sHealLocations[i].mapGroup == mapGroup && sHealLocations[i].mapNum == mapNum)
return i + 1;
}
return HEAL_LOCATION_NONE;
Expand Down
6 changes: 3 additions & 3 deletions src/overworld.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ void SetWarpDestinationToHealLocation(u8 healLocationId)
{
const struct HealLocation *healLocation = GetHealLocation(healLocationId);
if (healLocation)
SetWarpDestination(healLocation->group, healLocation->map, WARP_ID_NONE, healLocation->x, healLocation->y);
SetWarpDestination(healLocation->mapGroup, healLocation->mapNum, WARP_ID_NONE, healLocation->x, healLocation->y);
}

void SetWarpDestinationToLastHealLocation(void)
Expand All @@ -671,7 +671,7 @@ void SetLastHealLocationWarp(u8 healLocationId)
{
const struct HealLocation *healLocation = GetHealLocation(healLocationId);
if (healLocation)
SetWarpData(&gSaveBlock1Ptr->lastHealLocation, healLocation->group, healLocation->map, WARP_ID_NONE, healLocation->x, healLocation->y);
SetWarpData(&gSaveBlock1Ptr->lastHealLocation, healLocation->mapGroup, healLocation->mapNum, WARP_ID_NONE, healLocation->x, healLocation->y);
}

void UpdateEscapeWarp(s16 x, s16 y)
Expand Down Expand Up @@ -729,7 +729,7 @@ void SetContinueGameWarpToHealLocation(u8 healLocationId)
{
const struct HealLocation *healLocation = GetHealLocation(healLocationId);
if (healLocation)
SetWarpData(&gSaveBlock1Ptr->continueGameWarp, healLocation->group, healLocation->map, WARP_ID_NONE, healLocation->x, healLocation->y);
SetWarpData(&gSaveBlock1Ptr->continueGameWarp, healLocation->mapGroup, healLocation->mapNum, WARP_ID_NONE, healLocation->x, healLocation->y);
}

void SetContinueGameWarpToDynamicWarp(int unused)
Expand Down
Loading