- 36
- Posts
- 14
- Years
- England, UK
- Seen Jun 14, 2022
Adding map sections is largely simple, although comes with a notable caveat that takes a bit of tinkering to get used to. Let's say we've added a map in PoryMap imaginatively called NewArea.
To create a new map section for this map, allowing proper name popups and a place on the regional map:
Step 1
In include/constants/region_map_sections.h, at line 217 you'll find
as the end of a list of mapsec definitions. Add your own to the end of the list like so:
Step 2
Assign the map to the new mapsec. This can be done easily in PoryMap (don't forget to reload the project after the edit above), or in the source code it's in data/maps/NewArea/map.json and you'll want a line that reads
Step 3
The in-game name of the map is defined in src/data/region_map/region_map_entries.h. Add your name at the end of the list, after TRAINER HILL:
Linking the map to this name and defining the map's position on the global map is done in one go. Later in that file, add a new entry to gRegionMapEntries. If you don't want the map to appear on the region map, use:
The first two numbers in the list are the x and y coordinates on the region map, so to place it directly below Littleroot Town, for example, use:
Step 4
The style of the popup window is defined in src/map_name_popup.c. Add an entry to gRegionMapSectionId_To_PopUpThemeIdMapping; for example, I've chosen the wooden style:
Don't forget the subtraction of KANTO_MAPSEC_COUNT, following suit from Emerald's other new maps.
Step 5
Now, the caveat. If you look at the region map in-game, you should see the area added directly underneath Littleroot Town... but also added everywhere else otherwise undefined on the map! Opening the region map in PoryMap, you should see that the map as it looked before:
has been corrupted into this:
This is due to the fact the region layout is hardcoded in binary in graphics/pokenav/region_map_section_layout.bin. Open this file with a hex editor; I recommend HxD for a functioning Search & Replace function. Looking back again to Step 1, this binary file still uses 0xD5 as NONE, which we've now changed to mean NEW AREA:
In PoryMap, first select the square you actually want to be the new area and change it to something that isn't used on the map – for example, NAVEL_ROCK2, which is defined as 0xD3. Now fix the corruption by changing all of the 0xD5 to 0xD6:
Of course, one of entries should still be 0xD5 to represent the actual NEW AREA underneath Littleroot Town. We changed this before in order for it to 'survive' the conversion to the null 0xD6, because PoryMap doesn't even allow you to select null squares on the map. Instead, you can now just change NAVEL_ROCK2 to NEW_AREA with a fixed map:
To create a new map section for this map, allowing proper name popups and a place on the regional map:
Step 1
In include/constants/region_map_sections.h, at line 217 you'll find
Code:
#define MAPSEC_NONE 0xD5
Code:
#define MAPSEC_NEW_AREA 0xD5
#define MAPSEC_NONE 0xD6
Step 2
Assign the map to the new mapsec. This can be done easily in PoryMap (don't forget to reload the project after the edit above), or in the source code it's in data/maps/NewArea/map.json and you'll want a line that reads
Code:
"region_map_section": "MAPSEC_NEW_AREA",
Step 3
The in-game name of the map is defined in src/data/region_map/region_map_entries.h. Add your name at the end of the list, after TRAINER HILL:
Code:
static const u8 sMapName_TrainerHill[] = _("TRAINER HILL");
static const u8 sMapName_NewArea[] = _("NEW AREA");
Code:
[MAPSEC_NEW_AREA] = {0, 0, 1, 1, sMapName_NewArea},
Code:
[MAPSEC_NEW_AREA] = {4, 12, 1, 1, sMapName_NewArea},
Step 4
The style of the popup window is defined in src/map_name_popup.c. Add an entry to gRegionMapSectionId_To_PopUpThemeIdMapping; for example, I've chosen the wooden style:
Code:
[MAPSEC_LITTLEROOT_GROVE - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_WOOD,
Step 5
Now, the caveat. If you look at the region map in-game, you should see the area added directly underneath Littleroot Town... but also added everywhere else otherwise undefined on the map! Opening the region map in PoryMap, you should see that the map as it looked before:
Spoiler:
![[PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map [PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map](https://i.imgur.com/QyVu6r8.png)
has been corrupted into this:
Spoiler:
![[PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map [PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map](https://i.imgur.com/Jf8W75F.png)
This is due to the fact the region layout is hardcoded in binary in graphics/pokenav/region_map_section_layout.bin. Open this file with a hex editor; I recommend HxD for a functioning Search & Replace function. Looking back again to Step 1, this binary file still uses 0xD5 as NONE, which we've now changed to mean NEW AREA:
Spoiler:
![[PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map [PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map](https://i.imgur.com/3GzD1iS.png)
In PoryMap, first select the square you actually want to be the new area and change it to something that isn't used on the map – for example, NAVEL_ROCK2, which is defined as 0xD3. Now fix the corruption by changing all of the 0xD5 to 0xD6:
Spoiler:
![[PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map [PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map](https://i.imgur.com/R5dkmZV.png)
Of course, one of entries should still be 0xD5 to represent the actual NEW AREA underneath Littleroot Town. We changed this before in order for it to 'survive' the conversion to the null 0xD6, because PoryMap doesn't even allow you to select null squares on the map. Instead, you can now just change NAVEL_ROCK2 to NEW_AREA with a fixed map:
Spoiler:
![[PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map [PokeCommunity.com] [TUTORIAL] Adding new map sections for name popups and region map](https://i.imgur.com/YS9cHI9.png)
Last edited: