Skip to content

Commit

Permalink
Generate MAPSEC constants from JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Nov 9, 2024
1 parent 0696597 commit a4f0d1b
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 189 deletions.
1 change: 1 addition & 0 deletions 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
region_map_sections.h
94 changes: 0 additions & 94 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) $^ $@

$(BUILD_DIR)/src/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) $^ $@
1 change: 1 addition & 0 deletions src/data/region_map/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
region_map_entries.h
porymap_config.json
18 changes: 18 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,18 @@
{{ 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

#endif // GUARD_CONSTANTS_REGION_MAP_SECTIONS_H
Loading

0 comments on commit a4f0d1b

Please sign in to comment.