Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate MAPSEC constants from JSON #2063

Open
wants to merge 2 commits into
base: porymap-6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/constants/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Will be moved to build/ eventually
map_groups.h
layouts.h
layouts.h
region_map_sections.h
227 changes: 0 additions & 227 deletions include/constants/region_map_sections.h

This file was deleted.

4 changes: 4 additions & 0 deletions json_data_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ $(DATA_SRC_SUBDIR)/region_map/region_map_entries.h: $(DATA_SRC_SUBDIR)/region_ma
$(JSONPROC) $^ $@

$(C_BUILDDIR)/region_map.o: c_dep += $(DATA_SRC_SUBDIR)/region_map/region_map_entries.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
$(JSONPROC) $^ $@
22 changes: 22 additions & 0 deletions src/data/region_map/region_map_sections.constants.json.txt
Original file line number Diff line number Diff line change
@@ -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
Loading