Thread: Development: New map names in FR
View Single Post
Old February 22nd, 2011 (7:48 AM). Edited July 28th, 2011 by Jambo51.
Jambo51's Avatar
Jambo51 Jambo51 is offline
Glory To Arstotzka
Join Date: Jun 2009
Gender: Male
Nature: Quiet
Posts: 731
This post contains all the needed offsets and steps required to extend the number of available map names.
You can now have a maximum of 0xFC map names, which is a vast improvement on the previous number of 0x6C.
You MUST leave 1 map name byte (0xFD) for the background in the World Map, and the other 2 (0xFE and 0xFF) are needed to maintain support for trading with RSE. Currently, without a fairly drastic rewrite of the routines and map headers, it is impossible to support any more map names than 0xFC (253).

Anything in normal type is for a simple extension after the end of the existing map names, that is, using 0xC5 - 0xFC.
Anything in bold type is for using map names 0x0 - 0x57. This requires some thinking to implement!

Limiting Bytes:

* Layer 2 Flag Reader: 0xC3882 - 0x47 (C5 - 7E: Total Names - First Non City)
*^&! Name Reader 1: 0xC4D8A - 0x6C (C4 - 58: Total Names - No of Hoenn Names)
Not 100% Sure: 0xC35E6 - 0x6D (C5 - 58)
^ Catch Location Check: 0x13B844 - 0x6C (C4 - 58)
* Sevii Islands Check 1: 0xC0080 - 0xC5
* Sevii Islands Check 2: 0xC00CC - 0xC5
* Name on WM 1: 0xC0BE6 - 0xC5
* Name on WM 2: 0xC067A - 0xC5
* Layer 1 Flag Reader: 0xC482C - 0xC5
* Black/Grey Bar: 0xC0B32 - 0xC5

Map Data Readings:
0xC3538 - 0xC5
0xC3570 - 0xC5
0xC3598 - 0xC5
0xC35CC - 0xC5
0xC41D0 - 0xC5

*0x080C0BEC sub r0, #0x58; This needs to be removed to fix name loading.

In order to extend the table to include values below 0x58, there are MANY steps required, including some ASM.

World Map Location Data:
After some fairly extensive research, I can confirm that there appears to be NO layer 2 location data. It simply reads layer 1's location data. The table of data is at 0x083F1E60.

This uses the SAME routine as the World Map's movement bytes routine, so all you need to do is repoint and appropriately extend the table.

World Map Movement Bytes:
This is the data which controls how the player's head symbol moves along a route as the player travels.
Located at 0x083F2178 and lasting for 0x318 bytes again.

To allow the game to support more at the lower end, you need to insert 0x160 bytes before the repointed table. Then navigate to 0x080C3CA0 and replace the first 2 bytes with 00's.

Flight Data Controller Data:
This is hard to explain, but is important nonetheless. This data controls how the game shows the map, and indeed, whether or not it has a flight spot attached to it.

Located at 0x083F2EE0 and lasting for 0x144 bytes.

To change for use from map name 0x0 instead of map name 0x58, open up the rom in a hex editor, and navigate to 0x080C5280 and replace the first 4 bytes with 00's. This changes the code, allowing it to use map names beginning from 0x0 instead of 0x58. The repoint the table mentioned above, and BEFORE the repointed table, place 0x108 0x00 bytes. Then change the original pointer to the location where the 00's start.

Names data:
Speaks for itself. The actual names of the world map.
The table is stored at 0x083F1CAC and contains 0x6D entries at 4 bytes a piece. Meaning the table contains a total of 0x1B4 bytes.

To make this support map names below 0x58, you need to navigate to 0x080C4D86 and replace the following 2 bytes with 00's. This removes the lower limit on map names. Then repoint the table for the names, and put in the extra 0x58 names.

World Map Flag Data:
The first table for the WM flag data is at 0x080C3654. This is just for layer 1. The limiting word (yes, word) is 0xFFFF0000. This can be different based on whether or not you have used A-Map to hack the world map. A-Map modifies the limiting word of the table, changing it from 00 00 77 77. So use the appropriate one for your rom. DO NOT CHANGE THIS. All you need to do to extend this table (and the following table) is simply insert a new flag slot over the top of the end of the table, and then put the limiting word at the end of the table. You obviously need to repoint the table to extend it however. It's 0xDC bytes long. So copy and paste away.

In other words, end the table with FF FF 00 00.

The second table for WM flags is at 0x080C38C8. This table starts at Viridian Forest, rather than Pallet Town, so it considerably shorter, coming in at 0x90 bytes. This is layer 2's table. This controls when the small dots become bigger dots, as well as the colour of the text on the WM screen. They also control whether or not the map's name has a white background or a black background on the WM. I have no idea why, but I can confirm that is the case.

What I elected to do with these, was to create full tables instead of shortened tables for the 2 layers of flags.
So I repointed layer 1's table, and inserted 0x58 entries before it in the table. This allows for layer 1 flags to be assigned to any map name.

For layer 2, I inserted 0x7E entries before the existing table (after repointing of course), and made the routine read the entirety of both tables.

To modify the routines, navigate to 0x080C3880, and change the following bytes to 00 00 C4 28. Then go to 0x080C35E4, and change the next few bytes to 00 00 C4 28. The go to 0x080C35EC, and change the byte here to 0x63. That should be it.
Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
Reply With Quote