Generate heal location constants automatically, move data back to a single file.
This commit is contained in:
@@ -526,12 +526,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "Common_EventScript_ShowPokemonCenterSign"
|
"script": "Common_EventScript_ShowPokemonCenterSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST",
|
|
||||||
"x": 3,
|
|
||||||
"y": 52
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,12 +172,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "DewfordTown_EventScript_HallSign"
|
"script": "DewfordTown_EventScript_HallSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_DEWFORD_TOWN",
|
|
||||||
"x": 2,
|
|
||||||
"y": 11
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,17 +192,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||||
"script": "Common_EventScript_ShowPokemonCenterSign"
|
"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
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,12 +181,5 @@
|
|||||||
"item": "ITEM_NUGGET",
|
"item": "ITEM_NUGGET",
|
||||||
"flag": "FLAG_HIDDEN_ITEM_FALLARBOR_TOWN_NUGGET"
|
"flag": "FLAG_HIDDEN_ITEM_FALLARBOR_TOWN_NUGGET"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_FALLARBOR_TOWN",
|
|
||||||
"x": 14,
|
|
||||||
"y": 8
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,12 +232,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||||
"script": "Common_EventScript_ShowPokemartSign"
|
"script": "Common_EventScript_ShowPokemartSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_FORTREE_CITY",
|
|
||||||
"x": 5,
|
|
||||||
"y": 7
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,12 +260,5 @@
|
|||||||
"item": "ITEM_ICE_HEAL",
|
"item": "ITEM_ICE_HEAL",
|
||||||
"flag": "FLAG_HIDDEN_ITEM_LAVARIDGE_TOWN_ICE_HEAL"
|
"flag": "FLAG_HIDDEN_ITEM_LAVARIDGE_TOWN_ICE_HEAL"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_LAVARIDGE_TOWN",
|
|
||||||
"x": 9,
|
|
||||||
"y": 7
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -520,12 +520,5 @@
|
|||||||
"item": "ITEM_POKE_BALL",
|
"item": "ITEM_POKE_BALL",
|
||||||
"flag": "FLAG_HIDDEN_ITEM_LILYCOVE_CITY_POKE_BALL"
|
"flag": "FLAG_HIDDEN_ITEM_LILYCOVE_CITY_POKE_BALL"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_LILYCOVE_CITY",
|
|
||||||
"x": 24,
|
|
||||||
"y": 15
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,17 +268,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "LittlerootTown_EventScript_MaysHouseSign"
|
"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
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,12 +268,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "PlayersHouse_2F_EventScript_GameCube"
|
"script": "PlayersHouse_2F_EventScript_GameCube"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F",
|
|
||||||
"x": 4,
|
|
||||||
"y": 2
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,12 +268,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "LittlerootTown_MaysHouse_2F_EventScript_PC"
|
"script": "LittlerootTown_MaysHouse_2F_EventScript_PC"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F",
|
|
||||||
"x": 4,
|
|
||||||
"y": 2
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,12 +299,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "MauvilleCity_EventScript_GameCornerSign"
|
"script": "MauvilleCity_EventScript_GameCornerSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_MAUVILLE_CITY",
|
|
||||||
"x": 22,
|
|
||||||
"y": 6
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -487,12 +487,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "MossdeepCity_EventScript_WhiteRock"
|
"script": "MossdeepCity_EventScript_WhiteRock"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_MOSSDEEP_CITY",
|
|
||||||
"x": 28,
|
|
||||||
"y": 17
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,12 +195,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||||
"script": "Common_EventScript_ShowPokemartSign"
|
"script": "Common_EventScript_ShowPokemartSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_OLDALE_TOWN",
|
|
||||||
"x": 6,
|
|
||||||
"y": 17
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,12 +135,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||||
"script": "Common_EventScript_ShowPokemonCenterSign"
|
"script": "Common_EventScript_ShowPokemonCenterSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_PACIFIDLOG_TOWN",
|
|
||||||
"x": 8,
|
|
||||||
"y": 16
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,12 +331,5 @@
|
|||||||
"item": "ITEM_RARE_CANDY",
|
"item": "ITEM_RARE_CANDY",
|
||||||
"flag": "FLAG_HIDDEN_ITEM_PETALBURG_CITY_RARE_CANDY"
|
"flag": "FLAG_HIDDEN_ITEM_PETALBURG_CITY_RARE_CANDY"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_PETALBURG_CITY",
|
|
||||||
"x": 20,
|
|
||||||
"y": 17
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -603,12 +603,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "RustboroCity_EventScript_CuttersHouseSign"
|
"script": "RustboroCity_EventScript_CuttersHouseSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_RUSTBORO_CITY",
|
|
||||||
"x": 16,
|
|
||||||
"y": 39
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -702,12 +702,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||||
"script": "SlateportCity_EventScript_BerryCrushRankingsSign"
|
"script": "SlateportCity_EventScript_BerryCrushRankingsSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_SLATEPORT_CITY",
|
|
||||||
"x": 19,
|
|
||||||
"y": 20
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -409,12 +409,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "SootopolisCity_EventScript_CitySign"
|
"script": "SootopolisCity_EventScript_CitySign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_SOOTOPOLIS_CITY",
|
|
||||||
"x": 43,
|
|
||||||
"y": 32
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,12 +69,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "SouthernIsland_Exterior_EventScript_Sign"
|
"script": "SouthernIsland_Exterior_EventScript_Sign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR",
|
|
||||||
"x": 15,
|
|
||||||
"y": 20
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,12 +196,5 @@
|
|||||||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||||
"script": "VerdanturfTown_EventScript_RusturfTunnelSign"
|
"script": "VerdanturfTown_EventScript_RusturfTunnelSign"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"heal_locations": [
|
|
||||||
{
|
|
||||||
"id": "HEAL_LOCATION_VERDANTURF_TOWN",
|
|
||||||
"x": 16,
|
|
||||||
"y": 4
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
1
include/constants/.gitignore
vendored
1
include/constants/.gitignore
vendored
@@ -3,3 +3,4 @@ map_groups.h
|
|||||||
layouts.h
|
layouts.h
|
||||||
region_map_sections.h
|
region_map_sections.h
|
||||||
map_event_ids.h
|
map_event_ids.h
|
||||||
|
heal_locations.h
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
#ifndef GUARD_CONSTANTS_HEAL_LOCATIONS_H
|
|
||||||
#define GUARD_CONSTANTS_HEAL_LOCATIONS_H
|
|
||||||
|
|
||||||
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_SOUTHERN_ISLAND_EXTERIOR,
|
|
||||||
HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // GUARD_CONSTANTS_HEAL_LOCATIONS_H
|
|
||||||
@@ -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
|
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
|
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) $^ $@
|
$(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,7 +12,6 @@ INCLUDECONSTS_OUTDIR := include/constants
|
|||||||
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h
|
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_groups.h
|
||||||
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h
|
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/layouts.h
|
||||||
AUTO_GEN_TARGETS += $(INCLUDECONSTS_OUTDIR)/map_event_ids.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_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json))
|
||||||
MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS))
|
MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS))
|
||||||
@@ -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
|
$(LAYOUTS_OUTDIR)/layouts.inc $(LAYOUTS_OUTDIR)/layouts_table.inc $(INCLUDECONSTS_OUTDIR)/layouts.h: $(LAYOUTS_DIR)/layouts.json
|
||||||
$(MAPJSON) layouts emerald $< $(LAYOUTS_OUTDIR) $(INCLUDECONSTS_OUTDIR)
|
$(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.
|
# 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,
|
$(INCLUDECONSTS_OUTDIR)/map_event_ids.h: $(MAP_JSONS)
|
||||||
# so we use a separate target 'event_constants'.
|
@$(MAPJSON) event_constants emerald $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h
|
||||||
$(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h: .event_constants ;
|
@echo "$(MAPJSON) event_constants emerald <MAP_JSONS> $(INCLUDECONSTS_OUTDIR)/map_event_ids.h"
|
||||||
.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"
|
|
||||||
|
|||||||
14
src/data/heal_locations.constants.json.txt
Normal file
14
src/data/heal_locations.constants.json.txt
Normal file
@@ -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
|
||||||
136
src/data/heal_locations.json
Normal file
136
src/data/heal_locations.json
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
{
|
||||||
|
"heal_locations": [
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F",
|
||||||
|
"map": "MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F",
|
||||||
|
"x": 4,
|
||||||
|
"y": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F",
|
||||||
|
"map": "MAP_LITTLEROOT_TOWN_MAYS_HOUSE_2F",
|
||||||
|
"x": 4,
|
||||||
|
"y": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_PETALBURG_CITY",
|
||||||
|
"map": "MAP_PETALBURG_CITY",
|
||||||
|
"x": 20,
|
||||||
|
"y": 17
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_SLATEPORT_CITY",
|
||||||
|
"map": "MAP_SLATEPORT_CITY",
|
||||||
|
"x": 19,
|
||||||
|
"y": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_MAUVILLE_CITY",
|
||||||
|
"map": "MAP_MAUVILLE_CITY",
|
||||||
|
"x": 22,
|
||||||
|
"y": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_RUSTBORO_CITY",
|
||||||
|
"map": "MAP_RUSTBORO_CITY",
|
||||||
|
"x": 16,
|
||||||
|
"y": 39
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_FORTREE_CITY",
|
||||||
|
"map": "MAP_FORTREE_CITY",
|
||||||
|
"x": 5,
|
||||||
|
"y": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_LILYCOVE_CITY",
|
||||||
|
"map": "MAP_LILYCOVE_CITY",
|
||||||
|
"x": 24,
|
||||||
|
"y": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_MOSSDEEP_CITY",
|
||||||
|
"map": "MAP_MOSSDEEP_CITY",
|
||||||
|
"x": 28,
|
||||||
|
"y": 17
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_SOOTOPOLIS_CITY",
|
||||||
|
"map": "MAP_SOOTOPOLIS_CITY",
|
||||||
|
"x": 43,
|
||||||
|
"y": 32
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_EVER_GRANDE_CITY",
|
||||||
|
"map": "MAP_EVER_GRANDE_CITY",
|
||||||
|
"x": 27,
|
||||||
|
"y": 49
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE",
|
||||||
|
"map": "MAP_LITTLEROOT_TOWN",
|
||||||
|
"x": 5,
|
||||||
|
"y": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE",
|
||||||
|
"map": "MAP_LITTLEROOT_TOWN",
|
||||||
|
"x": 14,
|
||||||
|
"y": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_OLDALE_TOWN",
|
||||||
|
"map": "MAP_OLDALE_TOWN",
|
||||||
|
"x": 6,
|
||||||
|
"y": 17
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_DEWFORD_TOWN",
|
||||||
|
"map": "MAP_DEWFORD_TOWN",
|
||||||
|
"x": 2,
|
||||||
|
"y": 11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_LAVARIDGE_TOWN",
|
||||||
|
"map": "MAP_LAVARIDGE_TOWN",
|
||||||
|
"x": 9,
|
||||||
|
"y": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_FALLARBOR_TOWN",
|
||||||
|
"map": "MAP_FALLARBOR_TOWN",
|
||||||
|
"x": 14,
|
||||||
|
"y": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_VERDANTURF_TOWN",
|
||||||
|
"map": "MAP_VERDANTURF_TOWN",
|
||||||
|
"x": 16,
|
||||||
|
"y": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_PACIFIDLOG_TOWN",
|
||||||
|
"map": "MAP_PACIFIDLOG_TOWN",
|
||||||
|
"x": 8,
|
||||||
|
"y": 16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_EVER_GRANDE_CITY_POKEMON_LEAGUE",
|
||||||
|
"map": "MAP_EVER_GRANDE_CITY",
|
||||||
|
"x": 18,
|
||||||
|
"y": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR",
|
||||||
|
"map": "MAP_SOUTHERN_ISLAND_EXTERIOR",
|
||||||
|
"x": 15,
|
||||||
|
"y": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST",
|
||||||
|
"map": "MAP_BATTLE_FRONTIER_OUTSIDE_EAST",
|
||||||
|
"x": 3,
|
||||||
|
"y": 52
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
28
src/data/heal_locations.json.txt
Normal file
28
src/data/heal_locations.json.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{{ doNotModifyHeader }}
|
||||||
|
|
||||||
|
static const struct HealLocation sHealLocations[NUM_HEAL_LOCATIONS - 1] = {
|
||||||
|
## for heal_location in heal_locations
|
||||||
|
[{{ heal_location.id }} - 1] = {
|
||||||
|
.mapGroup = MAP_GROUP({{ heal_location.map }}),
|
||||||
|
.mapNum = MAP_NUM({{ heal_location.map }}),
|
||||||
|
.x = {{ heal_location.x }},
|
||||||
|
.y = {{ heal_location.y }},
|
||||||
|
},
|
||||||
|
## endfor
|
||||||
|
};
|
||||||
|
|
||||||
|
static const u16 sWhiteoutRespawnHealCenterMapIdxs[][2] = {
|
||||||
|
## for heal_location in heal_locations
|
||||||
|
{% if existsIn(heal_location, "respawn_map") %}
|
||||||
|
[{{ heal_location.id }} - 1] = { MAP_GROUP({{ heal_location.respawn_map }}), MAP_NUM({{ heal_location.respawn_map }})},
|
||||||
|
{% endif %}
|
||||||
|
## endfor
|
||||||
|
};
|
||||||
|
|
||||||
|
static const u8 sWhiteoutRespawnHealerNpcIds[] = {
|
||||||
|
## for heal_location in heal_locations
|
||||||
|
{% if existsIn(heal_location, "respawn_npc") %}
|
||||||
|
[{{ heal_location.id }} - 1] = {{ heal_location.respawn_npc }},
|
||||||
|
{% endif %}
|
||||||
|
## endfor
|
||||||
|
};
|
||||||
@@ -391,18 +391,13 @@ void process_map(string map_filepath, string layouts_filepath, string output_dir
|
|||||||
write_text_file(out_dir + "connections.inc", connections_text);
|
write_text_file(out_dir + "connections.inc", connections_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_event_constants(const vector<string> &map_filepaths, string output_ids_file, string output_heal_locations_file) {
|
void process_event_constants(const vector<string> &map_filepaths, string output_ids_file) {
|
||||||
string warning = get_generated_warning("data/maps/*/map.json", false);
|
string warning = get_generated_warning("data/maps/*/map.json", false);
|
||||||
|
|
||||||
ostringstream heal_locations_arr_text;
|
|
||||||
ostringstream respawn_maps_arr_text;
|
|
||||||
ostringstream respawn_npcs_arr_text;
|
|
||||||
|
|
||||||
string guard_name = "CONSTANTS_MAP_EVENT_IDS";
|
string guard_name = "CONSTANTS_MAP_EVENT_IDS";
|
||||||
ostringstream ids_file_text;
|
ostringstream ids_file_text;
|
||||||
ids_file_text << get_include_guard_start(guard_name) << warning;
|
ids_file_text << get_include_guard_start(guard_name) << warning;
|
||||||
|
|
||||||
// Get heal location data from each map
|
|
||||||
for (const string &filepath : map_filepaths) {
|
for (const string &filepath : map_filepaths) {
|
||||||
string err;
|
string err;
|
||||||
string map_json_text = read_text_file(filepath);
|
string map_json_text = read_text_file(filepath);
|
||||||
@@ -432,59 +427,10 @@ void process_event_constants(const vector<string> &map_filepaths, string output_
|
|||||||
if (!temp.empty()) {
|
if (!temp.empty()) {
|
||||||
ids_file_text << "// " << map_id << "\n" << temp << "\n";
|
ids_file_text << "// " << map_id << "\n" << temp << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process heal locations. Maps are not required to have a heal locations array, so we check if it exists first.
|
|
||||||
if (map_data.object_items().find("heal_locations") != map_data.object_items().end()) {
|
|
||||||
for (auto &heal_location : map_data["heal_locations"].array_items()) {
|
|
||||||
// Each array is indexed with the heal location's ID, e.g. '[HEAL_LOCATION_NAME - 1] = '
|
|
||||||
string index_text = "\t[" + json_to_string(heal_location, "id") + " - 1] =";
|
|
||||||
|
|
||||||
// Add element to main heal locations array
|
|
||||||
heal_locations_arr_text << index_text << "\n\t{\n"
|
|
||||||
<< "\t\t.mapGroup = MAP_GROUP(" << map_id << "),\n"
|
|
||||||
<< "\t\t.mapNum = MAP_NUM(" << map_id << "),\n"
|
|
||||||
<< "\t\t.x = " << json_to_string(heal_location, "x") << ",\n"
|
|
||||||
<< "\t\t.y = " << json_to_string(heal_location, "y") << ",\n"
|
|
||||||
<< "\t},\n";
|
|
||||||
|
|
||||||
// Add element to respawn map array (if field is present)
|
|
||||||
if (heal_location.object_items().find("respawn_map") != heal_location.object_items().end()) {
|
|
||||||
string respawn_map_id = json_to_string(heal_location, "respawn_map");
|
|
||||||
respawn_maps_arr_text << index_text << " {"
|
|
||||||
<< "MAP_GROUP(" << respawn_map_id << "), "
|
|
||||||
<< "MAP_NUM(" << respawn_map_id << ")"
|
|
||||||
<< "},\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add element to respawn NPC array (if field is present)
|
|
||||||
if (heal_location.object_items().find("respawn_npc") != heal_location.object_items().end()) {
|
|
||||||
respawn_npcs_arr_text << index_text << " " << json_to_string(heal_location, "respawn_npc") << ",\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write event ids file
|
|
||||||
ids_file_text << get_include_guard_end(guard_name);
|
ids_file_text << get_include_guard_end(guard_name);
|
||||||
write_text_file(output_ids_file, ids_file_text.str());
|
write_text_file(output_ids_file, ids_file_text.str());
|
||||||
|
|
||||||
|
|
||||||
// Write heal locations data file
|
|
||||||
ostringstream heal_locations_file_text;
|
|
||||||
heal_locations_file_text << warning;
|
|
||||||
|
|
||||||
string arr_body = heal_locations_arr_text.str();
|
|
||||||
heal_locations_file_text << "static const struct HealLocation sHealLocations[] =\n{\n" << arr_body << "};\n\n";
|
|
||||||
|
|
||||||
arr_body = respawn_maps_arr_text.str();
|
|
||||||
if (!arr_body.empty())
|
|
||||||
heal_locations_file_text << "static const u16 sWhiteoutRespawnHealCenterMapIdxs[][2] =\n{\n" << arr_body << "};\n\n";
|
|
||||||
|
|
||||||
arr_body = respawn_npcs_arr_text.str();
|
|
||||||
if (!arr_body.empty())
|
|
||||||
heal_locations_file_text << "static const u8 sWhiteoutRespawnHealerNpcIds[] =\n{\n" << arr_body << "};\n\n";
|
|
||||||
|
|
||||||
write_text_file(output_heal_locations_file, heal_locations_file_text.str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string generate_groups_text(Json groups_data) {
|
string generate_groups_text(Json groups_data) {
|
||||||
@@ -771,21 +717,20 @@ int main(int argc, char *argv[]) {
|
|||||||
process_layouts(filepath, output_asm, output_c);
|
process_layouts(filepath, output_asm, output_c);
|
||||||
}
|
}
|
||||||
else if (mode == "event_constants") {
|
else if (mode == "event_constants") {
|
||||||
if (argc < 6)
|
if (argc < 5)
|
||||||
FATAL_ERROR("USAGE: mapjson event_constants <game-version> <map_file> [additional_map_files] <output_ids_file> <output_heal_locations_file>");
|
FATAL_ERROR("USAGE: mapjson event_constants <game-version> <map_file> [additional_map_files] <output_ids_file>");
|
||||||
|
|
||||||
infer_separator(argv[3]);
|
infer_separator(argv[3]);
|
||||||
|
|
||||||
vector<string> filepaths;
|
vector<string> filepaths;
|
||||||
const int firstMapFileArg = 3;
|
const int firstMapFileArg = 3;
|
||||||
const int lastMapFileArg = argc - 3;
|
const int lastMapFileArg = argc - 2;
|
||||||
for (int i = firstMapFileArg; i <= lastMapFileArg; i++) {
|
for (int i = firstMapFileArg; i <= lastMapFileArg; i++) {
|
||||||
filepaths.push_back(argv[i]);
|
filepaths.push_back(argv[i]);
|
||||||
}
|
}
|
||||||
string output_ids_file(argv[argc - 2]);
|
string output_ids_file(argv[argc - 1]);
|
||||||
string output_heal_locations_file(argv[argc - 1]);
|
|
||||||
|
|
||||||
process_event_constants(filepaths, output_ids_file, output_heal_locations_file);
|
process_event_constants(filepaths, output_ids_file);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FATAL_ERROR("ERROR: <mode> must be 'layouts', 'map', 'event_constants', or 'groups'.\n");
|
FATAL_ERROR("ERROR: <mode> must be 'layouts', 'map', 'event_constants', or 'groups'.\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user