Skip to content

Commit

Permalink
Merge pull request #2101 from GriffinRichards/heal-locations-file
Browse files Browse the repository at this point in the history
Generate heal location constants automatically
  • Loading branch information
GriffinRichards authored Feb 11, 2025
2 parents 678fdf9 + cdadd7d commit 07c897a
Show file tree
Hide file tree
Showing 28 changed files with 199 additions and 249 deletions.
7 changes: 0 additions & 7 deletions data/maps/BattleFrontier_OutsideEast/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,5 @@
"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: 0 additions & 7 deletions data/maps/DewfordTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,5 @@
"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: 0 additions & 12 deletions data/maps/EverGrandeCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,5 @@
"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: 0 additions & 7 deletions data/maps/FallarborTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,5 @@
"item": "ITEM_NUGGET",
"flag": "FLAG_HIDDEN_ITEM_FALLARBOR_TOWN_NUGGET"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_FALLARBOR_TOWN",
"x": 14,
"y": 8
}
]
}
7 changes: 0 additions & 7 deletions data/maps/FortreeCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,5 @@
"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: 0 additions & 7 deletions data/maps/LavaridgeTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,5 @@
"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: 0 additions & 7 deletions data/maps/LilycoveCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,5 @@
"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: 0 additions & 12 deletions data/maps/LittlerootTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,5 @@
"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: 0 additions & 7 deletions data/maps/LittlerootTown_BrendansHouse_2F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,5 @@
"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: 0 additions & 7 deletions data/maps/LittlerootTown_MaysHouse_2F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,5 @@
"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: 0 additions & 7 deletions data/maps/MauvilleCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,5 @@
"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: 0 additions & 7 deletions data/maps/MossdeepCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,5 @@
"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: 0 additions & 7 deletions data/maps/OldaleTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,5 @@
"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: 0 additions & 7 deletions data/maps/PacifidlogTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,5 @@
"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: 0 additions & 7 deletions data/maps/PetalburgCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,5 @@
"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: 0 additions & 7 deletions data/maps/RustboroCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -603,12 +603,5 @@
"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: 0 additions & 7 deletions data/maps/SlateportCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,12 +702,5 @@
"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: 0 additions & 7 deletions data/maps/SootopolisCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,5 @@
"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: 0 additions & 7 deletions data/maps/SouthernIsland_Exterior/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,5 @@
"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: 0 additions & 7 deletions data/maps/VerdanturfTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "VerdanturfTown_EventScript_RusturfTunnelSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_VERDANTURF_TOWN",
"x": 16,
"y": 4
}
]
}
1 change: 1 addition & 0 deletions include/constants/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ map_groups.h
layouts.h
region_map_sections.h
map_event_ids.h
heal_locations.h
30 changes: 0 additions & 30 deletions include/constants/heal_locations.h

This file was deleted.

10 changes: 10 additions & 0 deletions json_data_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ $(C_BUILDDIR)/region_map.o: c_dep += $(DATA_SRC_SUBDIR)/region_map/region_map_en
AUTO_GEN_TARGETS += include/constants/region_map_sections.h
include/constants/region_map_sections.h: $(DATA_SRC_SUBDIR)/region_map/region_map_sections.json $(DATA_SRC_SUBDIR)/region_map/region_map_sections.constants.json.txt
$(JSONPROC) $^ $@

AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/heal_locations.h
$(DATA_SRC_SUBDIR)/heal_locations.h: $(DATA_SRC_SUBDIR)/heal_locations.json $(DATA_SRC_SUBDIR)/heal_locations.json.txt
$(JSONPROC) $^ $@

$(C_BUILDDIR)/heal_location.o: c_dep += $(DATA_SRC_SUBDIR)/heal_locations.h

AUTO_GEN_TARGETS += include/constants/heal_locations.h
include/constants/heal_locations.h: $(DATA_SRC_SUBDIR)/heal_locations.json $(DATA_SRC_SUBDIR)/heal_locations.constants.json.txt
$(JSONPROC) $^ $@
12 changes: 4 additions & 8 deletions map_data_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ INCLUDECONSTS_OUTDIR := include/constants
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_event_ids.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))
Expand All @@ -35,11 +34,8 @@ $(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)

# Generate files that depends on data that's distributed across the map.json files.
# Generate constants for map events, which depend on data that's distributed across the map.json files.
# There's a lot of map.json files, so we print an abbreviated output with echo.
# We're also not using a pattern rule, and we only want this to run once for both targets,
# so we use a separate target 'event_constants'.
$(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h: .event_constants ;
.event_constants: $(MAP_JSONS)
@$(MAPJSON) event_constants emerald $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h
@echo "$(MAPJSON) event_constants emerald <MAP_JSONS> $(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h"
$(INCLUDECONSTS_OUTDIR)/map_event_ids.h: $(MAP_JSONS)
@$(MAPJSON) event_constants emerald $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h
@echo "$(MAPJSON) event_constants emerald <MAP_JSONS> $(INCLUDECONSTS_OUTDIR)/map_event_ids.h"
14 changes: 14 additions & 0 deletions src/data/heal_locations.constants.json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef GUARD_CONSTANTS_HEAL_LOCATIONS_H
#define GUARD_CONSTANTS_HEAL_LOCATIONS_H

{{ doNotModifyHeader }}

enum {
HEAL_LOCATION_NONE,
## for heal_location in heal_locations
{{ heal_location.id }},
## endfor
NUM_HEAL_LOCATIONS
};

#endif // GUARD_CONSTANTS_HEAL_LOCATIONS_H
Loading

0 comments on commit 07c897a

Please sign in to comment.