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

Generate heal location constants automatically #685

Merged
merged 1 commit into from
Feb 21, 2025
Merged
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
9 changes: 0 additions & 9 deletions data/maps/CeladonCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,14 +403,5 @@
"quantity": 1,
"underfoot": false
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_CELADON_CITY",
"x": 48,
"y": 12,
"respawn_map": "MAP_CELADON_CITY_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_CELADON_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/CeruleanCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "CeruleanCity_BikeShop_EventScript_Bicycle"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_CERULEAN_CITY",
"x": 22,
"y": 20,
"respawn_map": "MAP_CERULEAN_CITY_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_CERULEAN_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/CinnabarIsland/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "CinnabarIsland_EventScript_PokemonLabSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_CINNABAR_ISLAND",
"x": 14,
"y": 12,
"respawn_map": "MAP_CINNABAR_ISLAND_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_CINNABAR_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/FiveIsland/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "FiveIsland_EventScript_IslandSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_FIVE_ISLAND",
"x": 18,
"y": 7,
"respawn_map": "MAP_FIVE_ISLAND_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_FIVE_ISLAND_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/FourIsland/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "FourIsland_EventScript_LoreleisHouseSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_FOUR_ISLAND",
"x": 18,
"y": 21,
"respawn_map": "MAP_FOUR_ISLAND_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_FOUR_ISLAND_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/FuchsiaCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,5 @@
"quantity": 1,
"underfoot": false
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_FUCHSIA_CITY",
"x": 25,
"y": 32,
"respawn_map": "MAP_FUCHSIA_CITY_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_FUCHSIA_NURSE"
}
]
}
11 changes: 1 addition & 10 deletions data/maps/IndigoPlateau_Exterior/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,5 @@
}
],
"coord_events": [],
"bg_events": [],
"heal_locations": [
{
"id": "HEAL_LOCATION_INDIGO_PLATEAU",
"x": 11,
"y": 7,
"respawn_map": "MAP_INDIGO_PLATEAU_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_LEAGUE_NURSE"
}
]
"bg_events": []
}
9 changes: 0 additions & 9 deletions data/maps/LavenderTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "LavenderTown_EventScript_VolunteerHouseSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_LAVENDER_TOWN",
"x": 6,
"y": 6,
"respawn_map": "MAP_LAVENDER_TOWN_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_LAVENDER_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/OneIsland/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "OneIsland_EventScript_PokemonNetCenterSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_ONE_ISLAND",
"x": 14,
"y": 6,
"respawn_map": "MAP_ONE_ISLAND_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_ONE_ISLAND_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/PalletTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "PalletTown_EventScript_TrainerTips"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_PALLET_TOWN",
"x": 6,
"y": 8,
"respawn_map": "MAP_PALLET_TOWN_PLAYERS_HOUSE_1F",
"respawn_npc": "LOCALID_MOM"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/PewterCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,5 @@
"quantity": 1,
"underfoot": false
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_PEWTER_CITY",
"x": 17,
"y": 26,
"respawn_map": "MAP_PEWTER_CITY_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_PEWTER_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/Route10/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,5 @@
"quantity": 1,
"underfoot": false
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_ROUTE10",
"x": 13,
"y": 21,
"respawn_map": "MAP_ROUTE10_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_ROUTE10_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/Route4/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,5 @@
"quantity": 1,
"underfoot": false
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_ROUTE4",
"x": 12,
"y": 6,
"respawn_map": "MAP_ROUTE4_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_ROUTE4_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/SaffronCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "SaffronCity_EventScript_TrainerFanClubSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_SAFFRON_CITY",
"x": 24,
"y": 39,
"respawn_map": "MAP_SAFFRON_CITY_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_SAFFRON_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/SevenIsland/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "SevenIsland_EventScript_IslandSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_SEVEN_ISLAND",
"x": 12,
"y": 4,
"respawn_map": "MAP_SEVEN_ISLAND_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_SEVEN_ISLAND_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/SixIsland/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,5 @@
"quantity": 1,
"underfoot": false
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_SIX_ISLAND",
"x": 11,
"y": 12,
"respawn_map": "MAP_SIX_ISLAND_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_SIX_ISLAND_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/ThreeIsland/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,5 @@
"quantity": 1,
"underfoot": false
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_THREE_ISLAND",
"x": 14,
"y": 28,
"respawn_map": "MAP_THREE_ISLAND_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_THREE_ISLAND_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/TwoIsland/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "TwoIsland_EventScript_FastCurrentSign"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_TWO_ISLAND",
"x": 21,
"y": 8,
"respawn_map": "MAP_TWO_ISLAND_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_TWO_ISLAND_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/VermilionCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,5 @@
"quantity": 1,
"underfoot": false
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_VERMILION_CITY",
"x": 15,
"y": 7,
"respawn_map": "MAP_VERMILION_CITY_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_VERMILION_NURSE"
}
]
}
9 changes: 0 additions & 9 deletions data/maps/ViridianCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,5 @@
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "ViridianCity_EventScript_GymDoor"
}
],
"heal_locations": [
{
"id": "HEAL_LOCATION_VIRIDIAN_CITY",
"x": 26,
"y": 27,
"respawn_map": "MAP_VIRIDIAN_CITY_POKEMON_CENTER_1F",
"respawn_npc": "LOCALID_VIRIDIAN_NURSE"
}
]
}
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
28 changes: 0 additions & 28 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 @@ -28,3 +28,13 @@ $(DATA_SRC_SUBDIR)/items.h: $(DATA_SRC_SUBDIR)/items.json $(DATA_SRC_SUBDIR)/ite
$(JSONPROC) $^ $@

$(C_BUILDDIR)/item.o: c_dep += $(DATA_SRC_SUBDIR)/items.h

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 @@ -34,11 +33,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 firered $< $(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 firered $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h
@echo "$(MAPJSON) event_constants firered <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 firered $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h
@echo "$(MAPJSON) event_constants firered <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