pret / pokeemerald

Decompilation of Pokémon Emerald
2.29k stars 2.62k forks source link

Generate MAPSEC constants from JSON #2063

Closed GriffinRichards closed 3 days ago

GriffinRichards commented 2 weeks ago

We already have the names and order of the MAPSEC values in region_map_sections.json, so we can generate the constants automatically when we process this file. As a bonus we'll put them in an enum to ensure MAPSEC_NONE / MAPSEC_COUNT will be updated as values are added or removed.

The only necessary changes are to json_data_rules.mk and to the new region_map_sections.constants.json.txt file. The changes to region_map_sections.json and region_map_sections.json.txt are motivated by pokefirered (to support elements in that JSON file that will only specify id, and so will only output the constant and not any C data)