Generate MAPSEC constants from JSON

This commit is contained in:
GriffinR
2024-11-06 21:41:43 -05:00
parent da9c0239d9
commit b89fda79ea
6 changed files with 248 additions and 444 deletions

View File

@@ -0,0 +1,22 @@
{{ doNotModifyHeader }}
#ifndef GUARD_CONSTANTS_REGION_MAP_SECTIONS_H
#define GUARD_CONSTANTS_REGION_MAP_SECTIONS_H
enum {
## for map_section in map_sections
{{ map_section.id }},
## endfor
MAPSEC_NONE,
MAPSEC_COUNT
};
// Special location IDs that use the same value space as MAPSECs.
#define METLOC_SPECIAL_EGG 0xFD
#define METLOC_IN_GAME_TRADE 0xFE
#define METLOC_FATEFUL_ENCOUNTER 0xFF
#define KANTO_MAPSEC_START MAPSEC_PALLET_TOWN
#define KANTO_MAPSEC_END MAPSEC_SPECIAL_AREA
#define KANTO_MAPSEC_COUNT (KANTO_MAPSEC_END - KANTO_MAPSEC_START + 1)
#endif // GUARD_CONSTANTS_REGION_MAP_SECTIONS_H

File diff suppressed because it is too large Load Diff

View File

@@ -3,21 +3,25 @@
#define GUARD_DATA_REGION_MAP_REGION_MAP_ENTRIES_H
## for map_section in map_sections
{% if isEmptyString(getVar(map_section.name)) and not existsIn(map_section, "name_clone") %}{{ setVar(map_section.name, map_section.map_section) }}{% endif %}
{% if existsIn(map_section, "name") and isEmptyString(getVar(map_section.name)) and not existsIn(map_section, "name_clone") %}{{ setVar(map_section.name, map_section.id) }}{% endif %}
## endfor
## for map_section in map_sections
{% if getVar(map_section.name) == map_section.map_section %}
{% if existsIn(map_section, "name") %}
{% if getVar(map_section.name) == map_section.id %}
static const u8 sMapName_{{ cleanString(map_section.name) }}[] = _("{{ map_section.name }}");
{% endif %}
{% if existsIn(map_section, "name_clone") %}
static const u8 sMapName_{{ cleanString(map_section.name) }}_Clone[] = _("{{ map_section.name }}");
{% endif %}
{% endif %}
## endfor
const struct RegionMapLocation gRegionMapEntries[] = {
## for map_section in map_sections
[{{ map_section.map_section }}] = { {{ map_section.x }}, {{ map_section.y }}, {{ map_section.width }}, {{ map_section.height }}, sMapName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %} },
{% if existsIn(map_section, "x") and existsIn(map_section, "y") and existsIn(map_section, "width") and existsIn(map_section, "height") and existsIn(map_section, "name") %}
[{{ map_section.id }}] = { {{ map_section.x }}, {{ map_section.y }}, {{ map_section.width }}, {{ map_section.height }}, sMapName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %} },
{% endif %}
## endfor
};