Skip to content

Commit 5f9f173

Browse files
Generate heal location constants automatically, move data back to a single file.
1 parent 65be523 commit 5f9f173

File tree

28 files changed

+224
-278
lines changed

28 files changed

+224
-278
lines changed

data/maps/CeladonCity/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -403,14 +403,5 @@
403403
"quantity": 1,
404404
"underfoot": false
405405
}
406-
],
407-
"heal_locations": [
408-
{
409-
"id": "HEAL_LOCATION_CELADON_CITY",
410-
"x": 48,
411-
"y": 12,
412-
"respawn_map": "MAP_CELADON_CITY_POKEMON_CENTER_1F",
413-
"respawn_npc": "LOCALID_CELADON_NURSE"
414-
}
415406
]
416407
}

data/maps/CeruleanCity/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,5 @@
420420
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
421421
"script": "CeruleanCity_BikeShop_EventScript_Bicycle"
422422
}
423-
],
424-
"heal_locations": [
425-
{
426-
"id": "HEAL_LOCATION_CERULEAN_CITY",
427-
"x": 22,
428-
"y": 20,
429-
"respawn_map": "MAP_CERULEAN_CITY_POKEMON_CENTER_1F",
430-
"respawn_npc": "LOCALID_CERULEAN_NURSE"
431-
}
432423
]
433424
}

data/maps/CinnabarIsland/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,5 @@
166166
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
167167
"script": "CinnabarIsland_EventScript_PokemonLabSign"
168168
}
169-
],
170-
"heal_locations": [
171-
{
172-
"id": "HEAL_LOCATION_CINNABAR_ISLAND",
173-
"x": 14,
174-
"y": 12,
175-
"respawn_map": "MAP_CINNABAR_ISLAND_POKEMON_CENTER_1F",
176-
"respawn_npc": "LOCALID_CINNABAR_NURSE"
177-
}
178169
]
179170
}

data/maps/FiveIsland/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,5 @@
103103
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
104104
"script": "FiveIsland_EventScript_IslandSign"
105105
}
106-
],
107-
"heal_locations": [
108-
{
109-
"id": "HEAL_LOCATION_FIVE_ISLAND",
110-
"x": 18,
111-
"y": 7,
112-
"respawn_map": "MAP_FIVE_ISLAND_POKEMON_CENTER_1F",
113-
"respawn_npc": "LOCALID_FIVE_ISLAND_NURSE"
114-
}
115106
]
116107
}

data/maps/FourIsland/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,5 @@
282282
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
283283
"script": "FourIsland_EventScript_LoreleisHouseSign"
284284
}
285-
],
286-
"heal_locations": [
287-
{
288-
"id": "HEAL_LOCATION_FOUR_ISLAND",
289-
"x": 18,
290-
"y": 21,
291-
"respawn_map": "MAP_FOUR_ISLAND_POKEMON_CENTER_1F",
292-
"respawn_npc": "LOCALID_FOUR_ISLAND_NURSE"
293-
}
294285
]
295286
}

data/maps/FuchsiaCity/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,5 @@
435435
"quantity": 1,
436436
"underfoot": false
437437
}
438-
],
439-
"heal_locations": [
440-
{
441-
"id": "HEAL_LOCATION_FUCHSIA_CITY",
442-
"x": 25,
443-
"y": 32,
444-
"respawn_map": "MAP_FUCHSIA_CITY_POKEMON_CENTER_1F",
445-
"respawn_npc": "LOCALID_FUCHSIA_NURSE"
446-
}
447438
]
448439
}

data/maps/IndigoPlateau_Exterior/map.json

+1-10
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,5 @@
6262
}
6363
],
6464
"coord_events": [],
65-
"bg_events": [],
66-
"heal_locations": [
67-
{
68-
"id": "HEAL_LOCATION_INDIGO_PLATEAU",
69-
"x": 11,
70-
"y": 7,
71-
"respawn_map": "MAP_INDIGO_PLATEAU_POKEMON_CENTER_1F",
72-
"respawn_npc": "LOCALID_LEAGUE_NURSE"
73-
}
74-
]
65+
"bg_events": []
7566
}

data/maps/LavenderTown/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,5 @@
152152
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
153153
"script": "LavenderTown_EventScript_VolunteerHouseSign"
154154
}
155-
],
156-
"heal_locations": [
157-
{
158-
"id": "HEAL_LOCATION_LAVENDER_TOWN",
159-
"x": 6,
160-
"y": 6,
161-
"respawn_map": "MAP_LAVENDER_TOWN_POKEMON_CENTER_1F",
162-
"respawn_npc": "LOCALID_LAVENDER_NURSE"
163-
}
164155
]
165156
}

data/maps/OneIsland/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,5 @@
118118
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
119119
"script": "OneIsland_EventScript_PokemonNetCenterSign"
120120
}
121-
],
122-
"heal_locations": [
123-
{
124-
"id": "HEAL_LOCATION_ONE_ISLAND",
125-
"x": 14,
126-
"y": 6,
127-
"respawn_map": "MAP_ONE_ISLAND_POKEMON_CENTER_1F",
128-
"respawn_npc": "LOCALID_ONE_ISLAND_NURSE"
129-
}
130121
]
131122
}

data/maps/PalletTown/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,5 @@
165165
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
166166
"script": "PalletTown_EventScript_TrainerTips"
167167
}
168-
],
169-
"heal_locations": [
170-
{
171-
"id": "HEAL_LOCATION_PALLET_TOWN",
172-
"x": 6,
173-
"y": 8,
174-
"respawn_map": "MAP_PALLET_TOWN_PLAYERS_HOUSE_1F",
175-
"respawn_npc": "LOCALID_MOM"
176-
}
177168
]
178169
}

data/maps/PewterCity/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,5 @@
295295
"quantity": 1,
296296
"underfoot": false
297297
}
298-
],
299-
"heal_locations": [
300-
{
301-
"id": "HEAL_LOCATION_PEWTER_CITY",
302-
"x": 17,
303-
"y": 26,
304-
"respawn_map": "MAP_PEWTER_CITY_POKEMON_CENTER_1F",
305-
"respawn_npc": "LOCALID_PEWTER_NURSE"
306-
}
307298
]
308299
}

data/maps/Route10/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,5 @@
280280
"quantity": 1,
281281
"underfoot": false
282282
}
283-
],
284-
"heal_locations": [
285-
{
286-
"id": "HEAL_LOCATION_ROUTE10",
287-
"x": 13,
288-
"y": 21,
289-
"respawn_map": "MAP_ROUTE10_POKEMON_CENTER_1F",
290-
"respawn_npc": "LOCALID_ROUTE10_NURSE"
291-
}
292283
]
293284
}

data/maps/Route4/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,5 @@
190190
"quantity": 1,
191191
"underfoot": false
192192
}
193-
],
194-
"heal_locations": [
195-
{
196-
"id": "HEAL_LOCATION_ROUTE4",
197-
"x": 12,
198-
"y": 6,
199-
"respawn_map": "MAP_ROUTE4_POKEMON_CENTER_1F",
200-
"respawn_npc": "LOCALID_ROUTE4_NURSE"
201-
}
202193
]
203194
}

data/maps/SaffronCity/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,5 @@
430430
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
431431
"script": "SaffronCity_EventScript_TrainerFanClubSign"
432432
}
433-
],
434-
"heal_locations": [
435-
{
436-
"id": "HEAL_LOCATION_SAFFRON_CITY",
437-
"x": 24,
438-
"y": 39,
439-
"respawn_map": "MAP_SAFFRON_CITY_POKEMON_CENTER_1F",
440-
"respawn_npc": "LOCALID_SAFFRON_NURSE"
441-
}
442433
]
443434
}

data/maps/SevenIsland/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,5 @@
110110
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
111111
"script": "SevenIsland_EventScript_IslandSign"
112112
}
113-
],
114-
"heal_locations": [
115-
{
116-
"id": "HEAL_LOCATION_SEVEN_ISLAND",
117-
"x": 12,
118-
"y": 4,
119-
"respawn_map": "MAP_SEVEN_ISLAND_POKEMON_CENTER_1F",
120-
"respawn_npc": "LOCALID_SEVEN_ISLAND_NURSE"
121-
}
122113
]
123114
}

data/maps/SixIsland/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,5 @@
100100
"quantity": 1,
101101
"underfoot": false
102102
}
103-
],
104-
"heal_locations": [
105-
{
106-
"id": "HEAL_LOCATION_SIX_ISLAND",
107-
"x": 11,
108-
"y": 12,
109-
"respawn_map": "MAP_SIX_ISLAND_POKEMON_CENTER_1F",
110-
"respawn_npc": "LOCALID_SIX_ISLAND_NURSE"
111-
}
112103
]
113104
}

data/maps/ThreeIsland/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,5 @@
394394
"quantity": 1,
395395
"underfoot": false
396396
}
397-
],
398-
"heal_locations": [
399-
{
400-
"id": "HEAL_LOCATION_THREE_ISLAND",
401-
"x": 14,
402-
"y": 28,
403-
"respawn_map": "MAP_THREE_ISLAND_POKEMON_CENTER_1F",
404-
"respawn_npc": "LOCALID_THREE_ISLAND_NURSE"
405-
}
406397
]
407398
}

data/maps/TwoIsland/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,5 @@
204204
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
205205
"script": "TwoIsland_EventScript_FastCurrentSign"
206206
}
207-
],
208-
"heal_locations": [
209-
{
210-
"id": "HEAL_LOCATION_TWO_ISLAND",
211-
"x": 21,
212-
"y": 8,
213-
"respawn_map": "MAP_TWO_ISLAND_POKEMON_CENTER_1F",
214-
"respawn_npc": "LOCALID_TWO_ISLAND_NURSE"
215-
}
216207
]
217208
}

data/maps/VermilionCity/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,5 @@
301301
"quantity": 1,
302302
"underfoot": false
303303
}
304-
],
305-
"heal_locations": [
306-
{
307-
"id": "HEAL_LOCATION_VERMILION_CITY",
308-
"x": 15,
309-
"y": 7,
310-
"respawn_map": "MAP_VERMILION_CITY_POKEMON_CENTER_1F",
311-
"respawn_npc": "LOCALID_VERMILION_NURSE"
312-
}
313304
]
314305
}

data/maps/ViridianCity/map.json

-9
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,5 @@
278278
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
279279
"script": "ViridianCity_EventScript_GymDoor"
280280
}
281-
],
282-
"heal_locations": [
283-
{
284-
"id": "HEAL_LOCATION_VIRIDIAN_CITY",
285-
"x": 26,
286-
"y": 27,
287-
"respawn_map": "MAP_VIRIDIAN_CITY_POKEMON_CENTER_1F",
288-
"respawn_npc": "LOCALID_VIRIDIAN_NURSE"
289-
}
290281
]
291282
}

include/constants/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ map_groups.h
33
layouts.h
44
region_map_sections.h
55
map_event_ids.h
6+
heal_locations.h

include/constants/heal_locations.h

-28
This file was deleted.

json_data_rules.mk

+10
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@ $(DATA_SRC_SUBDIR)/items.h: $(DATA_SRC_SUBDIR)/items.json $(DATA_SRC_SUBDIR)/ite
2828
$(JSONPROC) $^ $@
2929

3030
$(C_BUILDDIR)/item.o: c_dep += $(DATA_SRC_SUBDIR)/items.h
31+
32+
AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/heal_locations.h
33+
$(DATA_SRC_SUBDIR)/heal_locations.h: $(DATA_SRC_SUBDIR)/heal_locations.json $(DATA_SRC_SUBDIR)/heal_locations.json.txt
34+
$(JSONPROC) $^ $@
35+
36+
$(C_BUILDDIR)/heal_location.o: c_dep += $(DATA_SRC_SUBDIR)/heal_locations.h
37+
38+
AUTO_GEN_TARGETS += include/constants/heal_locations.h
39+
include/constants/heal_locations.h: $(DATA_SRC_SUBDIR)/heal_locations.json $(DATA_SRC_SUBDIR)/heal_locations.constants.json.txt
40+
$(JSONPROC) $^ $@

map_data_rules.mk

+4-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ INCLUDECONSTS_OUTDIR := include/constants
1212
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h
1313
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h
1414
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_event_ids.h
15-
AUTO_GEN_TARGETS += $(DATA_SRC_SUBDIR)/heal_locations.h
1615

1716
MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json))
1817
MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS))
@@ -34,11 +33,8 @@ $(MAPS_OUTDIR)/connections.inc $(MAPS_OUTDIR)/groups.inc $(MAPS_OUTDIR)/events.i
3433
$(LAYOUTS_OUTDIR)/layouts.inc $(LAYOUTS_OUTDIR)/layouts_table.inc $(INCLUDECONSTS_OUTDIR)/layouts.h: $(LAYOUTS_DIR)/layouts.json
3534
$(MAPJSON) layouts firered $< $(LAYOUTS_OUTDIR) $(INCLUDECONSTS_OUTDIR)
3635

37-
# Generate files that depends on data that's distributed across the map.json files.
36+
# Generate constants for map events, which depend on data that's distributed across the map.json files.
3837
# There's a lot of map.json files, so we print an abbreviated output with echo.
39-
# We're also not using a pattern rule, and we only want this to run once for both targets,
40-
# so we use a separate target 'event_constants'.
41-
$(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h: .event_constants ;
42-
.event_constants: $(MAP_JSONS)
43-
@$(MAPJSON) event_constants firered $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h
44-
@echo "$(MAPJSON) event_constants firered <MAP_JSONS> $(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h"
38+
$(INCLUDECONSTS_OUTDIR)/map_event_ids.h: $(MAP_JSONS)
39+
@$(MAPJSON) event_constants firered $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h
40+
@echo "$(MAPJSON) event_constants firered <MAP_JSONS> $(INCLUDECONSTS_OUTDIR)/map_event_ids.h"
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef GUARD_CONSTANTS_HEAL_LOCATIONS_H
2+
#define GUARD_CONSTANTS_HEAL_LOCATIONS_H
3+
4+
{{ doNotModifyHeader }}
5+
6+
enum {
7+
HEAL_LOCATION_NONE,
8+
## for heal_location in heal_locations
9+
{{ heal_location.id }},
10+
## endfor
11+
NUM_HEAL_LOCATIONS
12+
};
13+
14+
#endif // GUARD_CONSTANTS_HEAL_LOCATIONS_H

0 commit comments

Comments
 (0)