+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Pokemon Gold - Map Connections
Pages: [1]
Author Topic: Pokemon Gold - Map Connections  (Read 1 times)
Darkdata
Guest
« on: June 28, 2010, 09:44:06 pm »

Can someone please explain to me how they work? My last couple of hours in Megamap/HexEditor have been the most frustrating I've had in a while.

Also, if someone has a translation for these: that would be nice.
Lin
Guest
« Reply #1 on: June 28, 2010, 09:59:36 pm »

Map connections are the biggest pain in the ass. My notes may not be 100%, as I didn't update them often. Connections are also at the end of the secondary map header.

==Secondary header format==
1 byte - Border block
1 byte - Height in blocks
1 byte - Width in blocks
3 bytes - Map block data pointer
1 byte - Bank of script/event data
2 bytes - Pointer to room script, using event/script bank byte
2 bytes - Pointer to event data, using event/script bank byte
1 byte - The map connections
[Follow connection format for each map]

==Connection format==
12 bytes per connection
1 byte - Bank of map (Starts at 1)
1 byte - Map number (Starts at 1)
2 bytes - Pointer using the other map tile data bank pointing to the other map tile data (ROM)
2 bytes - Backwards memory pointer pointing to the top left block of the other map
1 byte - Other map height
1 byte - Other map width
1 byte - Y offset of map
1 byte - X offset of map
2 bytes - Backwards memory pointer pointing to the block you can stand at to see the next map
All maps memory address (Starting) - 0xC700 + (width of current map + 0x06) * (0x03)

Also, those words are in German. Just throw them into Google Translator.
Darkdata
Guest
« Reply #2 on: June 28, 2010, 10:09:09 pm »

Thank you Lin! I most certainly agree that they are the biggest pain in the ass.

Edit: And it still crashes when the character crosses the border/Will not align right.

Biggest pain ever...
« Last Edit: June 28, 2010, 10:52:49 pm by Darkdata »
Tauwasser
Guest
« Reply #3 on: June 29, 2010, 09:38:17 am »

Quote from: Lin on June 28, 2010, 09:59:36 pm
Map connections are the biggest pain in the ass. My notes may not be 100%, as I didn't update them often. Connections are also at the end of the secondary map header.

==Secondary header format==
1 byte - Border block
1 byte - Height in blocks
1 byte - Width in blocks
3 bytes - Map block data pointer
1 byte - Bank of script/event data
2 bytes - Pointer to room script, using event/script bank byte
2 bytes - Pointer to event data, using event/script bank byte
1 byte - The map connections, bits 0 to 3 set for existing connection, reset for no connection in north, south, west, east resp.
[Follow connection format for each map]

==Connection format==
12 bytes per connection
1 byte - Bank of map
1 byte - Map number
2 bytes - Pointer to upper left corner of viewing area of connected map in connected map's map data
2 bytes - Viewing area location
1 byte - Dimension of viewing area
1 byte - Connected map's width
1 byte - Y offset of map in half blocks
1 byte - X offset of map in half blocks
2 bytes - Viewing area destination
2 bytes - Backwards memory pointer pointing to the block you can stand at to see the next map
All maps memory address (Starting) - 0xC700 + (width of current map + 0x06) * (0x03)

I fixed this. Basically, the viewing area location points to ram where the viewing area should start on the current map including it's 3 border blocks in all directions. Viewing area destination points to the upper left block after changing maps. Dimension of viewing area is the viewing area's width for horizontal connections (north, south) and it's height for vertical connections (west, east). X and Y offsets are in half-blocks (2×2 tiles where the player fits into).

Equations for the most-common connection modes can be found (in German) at RHWiki.

cYa,

Tauwasser
Darkdata
Guest
« Reply #4 on: June 29, 2010, 02:12:51 pm »

Ah, I think I got it now. At least it is not crashing the game upon border crossing anyway...

So, now all I have to do is look up how to change the town map cord's for each town. Guess I'll have to go back to scaning the ram to try and find it...
Tauwasser
Guest
« Reply #5 on: June 29, 2010, 02:39:08 pm »

Town map coordinates are in the name table as far as I remember... [X][Y][Pnt to Name].

cYa,

Tauwasser
Darkdata
Guest
« Reply #6 on: June 29, 2010, 02:52:40 pm »

Quote from: Tauwasser on June 29, 2010, 02:39:08 pm
Town map coordinates are in the name table as far as I remember... [X][Y][Pnt to Name].

cYa,

Tauwasser

Indeed they are!
C540 - X RAM / C541 - Y RAM
0x092386 - Where it starts.
Format [Cord -X][Cord - Y][2B Pointer to name]
Names start at 0x0924FE


As soon as I posted my reply I figured it out. Hah.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC