mirror of
https://github.com/pret/pokeruby.git
synced 2026-03-21 17:54:19 -05:00
Generate heal location constants automatically
This commit is contained in:
parent
cb26a6faeb
commit
c1ab4bb7d1
7
data/maps/BattleTower_Outside/map.json
vendored
7
data/maps/BattleTower_Outside/map.json
vendored
|
|
@ -96,12 +96,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "BattleTower_Outside_EventScript_16025A"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_BATTLE_TOWER_OUTSIDE",
|
||||
"x": 14,
|
||||
"y": 9
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/DewfordTown/map.json
vendored
7
data/maps/DewfordTown/map.json
vendored
|
|
@ -167,12 +167,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "DewfordTown_EventScript_14E0BD"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_DEWFORD_TOWN",
|
||||
"x": 2,
|
||||
"y": 11
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
12
data/maps/EverGrandeCity/map.json
vendored
12
data/maps/EverGrandeCity/map.json
vendored
|
|
@ -189,17 +189,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||
"script": "Common_EventScript_PokemonCenterSign"
|
||||
}
|
||||
],
|
||||
"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
data/maps/FallarborTown/map.json
vendored
7
data/maps/FallarborTown/map.json
vendored
|
|
@ -178,12 +178,5 @@
|
|||
"item": "ITEM_NUGGET",
|
||||
"flag": "FLAG_HIDDEN_ITEM_1C"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_FALLARBOR_TOWN",
|
||||
"x": 14,
|
||||
"y": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/FortreeCity/map.json
vendored
7
data/maps/FortreeCity/map.json
vendored
|
|
@ -229,12 +229,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||
"script": "Common_EventScript_PokemartSign"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_FORTREE_CITY",
|
||||
"x": 5,
|
||||
"y": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/LavaridgeTown/map.json
vendored
7
data/maps/LavaridgeTown/map.json
vendored
|
|
@ -255,12 +255,5 @@
|
|||
"item": "ITEM_ICE_HEAL",
|
||||
"flag": "FLAG_HIDDEN_ITEM_0"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_LAVARIDGE_TOWN",
|
||||
"x": 9,
|
||||
"y": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/LilycoveCity/map.json
vendored
7
data/maps/LilycoveCity/map.json
vendored
|
|
@ -457,12 +457,5 @@
|
|||
"item": "ITEM_POKE_BALL",
|
||||
"flag": "FLAG_HIDDEN_ITEM_4B"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_LILYCOVE_CITY",
|
||||
"x": 24,
|
||||
"y": 15
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
12
data/maps/LittlerootTown/map.json
vendored
12
data/maps/LittlerootTown/map.json
vendored
|
|
@ -235,17 +235,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "LittlerootTown_EventScript_14D834"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE",
|
||||
"x": 5,
|
||||
"y": 9
|
||||
},
|
||||
{
|
||||
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE",
|
||||
"x": 14,
|
||||
"y": 9
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,12 +237,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "LittlerootTown_BrendansHouse_2F_EventScript_152870"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F",
|
||||
"x": 4,
|
||||
"y": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,12 +250,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "LittlerootTown_MaysHouse_2F_EventScript_152C39"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F",
|
||||
"x": 4,
|
||||
"y": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/MauvilleCity/map.json
vendored
7
data/maps/MauvilleCity/map.json
vendored
|
|
@ -267,12 +267,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "MauvilleCity_EventScript_14C099"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_MAUVILLE_CITY",
|
||||
"x": 22,
|
||||
"y": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/MossdeepCity/map.json
vendored
7
data/maps/MossdeepCity/map.json
vendored
|
|
@ -320,12 +320,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "MossdeepCity_EventScript_14CFE4"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_MOSSDEEP_CITY",
|
||||
"x": 28,
|
||||
"y": 17
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/OldaleTown/map.json
vendored
7
data/maps/OldaleTown/map.json
vendored
|
|
@ -189,12 +189,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||
"script": "Common_EventScript_PokemartSign"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_OLDALE_TOWN",
|
||||
"x": 6,
|
||||
"y": 17
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/PacifidlogTown/map.json
vendored
7
data/maps/PacifidlogTown/map.json
vendored
|
|
@ -132,12 +132,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_NORTH",
|
||||
"script": "Common_EventScript_PokemonCenterSign"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_PACIFIDLOG_TOWN",
|
||||
"x": 8,
|
||||
"y": 16
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/PetalburgCity/map.json
vendored
7
data/maps/PetalburgCity/map.json
vendored
|
|
@ -287,12 +287,5 @@
|
|||
"item": "ITEM_RARE_CANDY",
|
||||
"flag": "FLAG_HIDDEN_ITEM_5F"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_PETALBURG_CITY",
|
||||
"x": 20,
|
||||
"y": 17
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/RustboroCity/map.json
vendored
7
data/maps/RustboroCity/map.json
vendored
|
|
@ -496,12 +496,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "RustboroCity_EventScript_14C440"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_RUSTBORO_CITY",
|
||||
"x": 16,
|
||||
"y": 39
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/SlateportCity/map.json
vendored
7
data/maps/SlateportCity/map.json
vendored
|
|
@ -608,12 +608,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "SlateportCity_EventScript_14BC3C"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_SLATEPORT_CITY",
|
||||
"x": 19,
|
||||
"y": 20
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/SootopolisCity/map.json
vendored
7
data/maps/SootopolisCity/map.json
vendored
|
|
@ -301,12 +301,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "SootopolisCity_EventScript_14D2F6"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_SOOTOPOLIS_CITY",
|
||||
"x": 43,
|
||||
"y": 32
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/SouthernIsland_Exterior/map.json
vendored
7
data/maps/SouthernIsland_Exterior/map.json
vendored
|
|
@ -64,12 +64,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "SouthernIsland_Exterior_EventScript_160B4A"
|
||||
}
|
||||
],
|
||||
"heal_locations": [
|
||||
{
|
||||
"id": "HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR",
|
||||
"x": 15,
|
||||
"y": 20
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
7
data/maps/VerdanturfTown/map.json
vendored
7
data/maps/VerdanturfTown/map.json
vendored
|
|
@ -192,12 +192,5 @@
|
|||
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
|
||||
"script": "VerdanturfTown_EventScript_14E8E5"
|
||||
}
|
||||
],
|
||||
"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
|
||||
region_map_sections.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_BATTLE_TOWER_OUTSIDE,
|
||||
HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR,
|
||||
};
|
||||
|
||||
#endif // GUARD_CONSTANTS_HEAL_LOCATIONS_H
|
||||
|
|
@ -16,3 +16,13 @@ $(BUILD_DIR)/src/region_map.o: C_DEP += $(DATA_SRC_SUBDIR)/region_map/region_map
|
|||
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,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))
|
||||
|
|
@ -34,12 +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 ruby $< $(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 ruby $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h $(DATA_SRC_SUBDIR)/heal_locations.h
|
||||
@echo "$(MAPJSON) event_constants ruby <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 ruby $^ $(INCLUDECONSTS_OUTDIR)/map_event_ids.h
|
||||
@echo "$(MAPJSON) event_constants ruby <MAP_JSONS> $(INCLUDECONSTS_OUTDIR)/map_event_ids.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_BATTLE_TOWER_OUTSIDE",
|
||||
"map": "MAP_BATTLE_TOWER_OUTSIDE",
|
||||
"x": 14,
|
||||
"y": 9
|
||||
},
|
||||
{
|
||||
"id": "HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR",
|
||||
"map": "MAP_SOUTHERN_ISLAND_EXTERIOR",
|
||||
"x": 15,
|
||||
"y": 20
|
||||
}
|
||||
]
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
ostringstream heal_locations_arr_text;
|
||||
ostringstream respawn_maps_arr_text;
|
||||
ostringstream respawn_npcs_arr_text;
|
||||
|
||||
string guard_name = "CONSTANTS_MAP_EVENT_IDS";
|
||||
ostringstream ids_file_text;
|
||||
ids_file_text << get_include_guard_start(guard_name) << warning;
|
||||
|
||||
// Get heal location data from each map
|
||||
for (const string &filepath : map_filepaths) {
|
||||
string err;
|
||||
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()) {
|
||||
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);
|
||||
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) {
|
||||
|
|
@ -771,21 +717,20 @@ int main(int argc, char *argv[]) {
|
|||
process_layouts(filepath, output_asm, output_c);
|
||||
}
|
||||
else if (mode == "event_constants") {
|
||||
if (argc < 6)
|
||||
FATAL_ERROR("USAGE: mapjson event_constants <game-version> <map_file> [additional_map_files] <output_ids_file> <output_heal_locations_file>");
|
||||
if (argc < 5)
|
||||
FATAL_ERROR("USAGE: mapjson event_constants <game-version> <map_file> [additional_map_files] <output_ids_file>");
|
||||
|
||||
infer_separator(argv[3]);
|
||||
|
||||
vector<string> filepaths;
|
||||
const int firstMapFileArg = 3;
|
||||
const int lastMapFileArg = argc - 3;
|
||||
const int lastMapFileArg = argc - 2;
|
||||
for (int i = firstMapFileArg; i <= lastMapFileArg; i++) {
|
||||
filepaths.push_back(argv[i]);
|
||||
}
|
||||
string output_ids_file(argv[argc - 2]);
|
||||
string output_heal_locations_file(argv[argc - 1]);
|
||||
string output_ids_file(argv[argc - 1]);
|
||||
|
||||
process_event_constants(filepaths, output_ids_file, output_heal_locations_file);
|
||||
process_event_constants(filepaths, output_ids_file);
|
||||
}
|
||||
else {
|
||||
FATAL_ERROR("ERROR: <mode> must be 'layouts', 'map', 'event_constants', or 'groups'.\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user