• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[TUTORIAL] Adding new map sections for name popups and region map

36
Posts
13
Years
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
Code:
#define MAPSEC_NONE                         0xD5
as the end of a list of mapsec definitions. Add your own to the end of the list like so:
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");
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:
Code:
[MAPSEC_NEW_AREA]          = {0, 0, 1, 1, sMapName_NewArea},
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:
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,
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:
Spoiler:

has been corrupted into this:
Spoiler:

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:

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:

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:
 
Last edited:
11
Posts
4
Years
  • Age 32
  • Seen Jul 24, 2021
thanks so much for this tutorial. follow your step i can fix a error whit the porymap region editor
 
12
Posts
3
Years
  • Age 26
  • Seen Jan 30, 2023
Thanks, this was great! I was wondering, how does one change the mapgroup of a new map?
 
438
Posts
6
Years
  • Age 37
  • Seen Apr 20, 2024
I tried that in pokefirered (except of popup style) and it does show the map header, but it doesn't show the map name.
The name will not show up if your new MAPSEC constant is larger than MAPSEC_NONE due to this code. There are a few other places in code where constants are compared to MAPSEC_NONE, so increasing the value of MAPSEC_NONE is likely better than editing the code.
 
Last edited:

elbandito

The1nOnlyKidda the demigod of all things (that oth
6
Posts
13
Years
  • Age 33
  • UK
  • Seen Dec 1, 2023
For those who are using Fire Red what Anon822 has said is pretty close to true, the only difference is in FR the GetMapName function doesn't reference MAPSEC_NONE

Go to src > region_map.c

You will need to find the following function:

Spoiler:


Now all you need to do is replace the first if:

if ((idx = mapsec - MAPSECS_KANTO) <= MAPSEC_SPECIAL_AREA - MAPSECS_KANTO)

With:

if ((idx = mapsec - MAPSECS_KANTO) < MAPSEC_NONE - MAPSECS_KANTO)

This will make sure that all your new maps names will display as long as the new map name is before MAPSEC_NONE.
 
Back
Top