Generate region_map_sections from JSON (#677)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
{{ 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
|
||||
};
|
||||
|
||||
// Values before KANTO_MAPSEC_START are assumed to have no data.
|
||||
#define KANTO_MAPSEC_START MAPSEC_PALLET_TOWN
|
||||
|
||||
// Values starting from SEVII_MAPSEC_START are assumed to have data in sSeviiMapsecs.
|
||||
#define SEVII_MAPSEC_START MAPSEC_ONE_ISLAND
|
||||
|
||||
// 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
|
||||
|
||||
#endif // GUARD_CONSTANTS_REGION_MAP_SECTIONS_H
|
||||
@@ -3,24 +3,30 @@
|
||||
#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
|
||||
|
||||
static const u8 *const sMapNames[] = {
|
||||
## for map_section in map_sections
|
||||
[{{ map_section.map_section }} - MAPSECS_KANTO] = sMapsecName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %},
|
||||
{% if existsIn(map_section, "name") %}
|
||||
[{{ map_section.id }} - KANTO_MAPSEC_START] = sMapsecName_{{ cleanString(map_section.name) }}{% if existsIn(map_section, "name_clone") %}_Clone{% endif %},
|
||||
{% endif %}
|
||||
## endfor
|
||||
};
|
||||
|
||||
static const u16 sMapSectionTopLeftCorners[MAPSEC_COUNT][2] = {
|
||||
## for map_section in map_sections
|
||||
[{{ map_section.map_section }} - MAPSECS_KANTO] = { {{ map_section.x }}, {{ map_section.y }} },
|
||||
{% if existsIn(map_section, "x") and existsIn(map_section, "y") %}
|
||||
[{{ map_section.id }} - KANTO_MAPSEC_START] = { {{ map_section.x }}, {{ map_section.y }} },
|
||||
{% endif %}
|
||||
## endfor
|
||||
};
|
||||
|
||||
static const u16 sMapSectionDimensions[MAPSEC_COUNT][2] = {
|
||||
## for map_section in map_sections
|
||||
[{{ map_section.map_section }} - MAPSECS_KANTO] = { {{ map_section.width }}, {{ map_section.height }} },
|
||||
{% if existsIn(map_section, "width") and existsIn(map_section, "height") %}
|
||||
[{{ map_section.id }} - KANTO_MAPSEC_START] = { {{ map_section.width }}, {{ map_section.height }} },
|
||||
{% endif %}
|
||||
## endfor
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,16 +3,18 @@
|
||||
#define GUARD_DATA_REGION_MAP_REGION_MAP_ENTRY_STRINGS_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 sMapsecName_{{ cleanString(map_section.name) }}[] = _("{{ map_section.name }}");
|
||||
{% endif %}
|
||||
{% if existsIn(map_section, "name_clone") %}
|
||||
static const u8 sMapsecName_{{ cleanString(map_section.name) }}_Clone[] = _("{{ map_section.name }}");
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
## endfor
|
||||
|
||||
#endif // GUARD_DATA_REGION_MAP_REGION_MAP_ENTRY_STRINGS_H
|
||||
|
||||
Reference in New Issue
Block a user