Pokémon Gold and Silver/Notes

From Data Crystal
< Pokémon Gold and Silver
Revision as of 16:26, 7 July 2017 by ISSOtm (talk | contribs) (→‎Map connections: Fixed missing <pre>.)
Jump to navigation Jump to search

Chip tiny.png The following article is a Notes Page for Pokémon Gold and Silver.

Map header

The map header is split in a few different parts, linked to by pointers :

Main header

1 byte  - Bank of second part
1 byte  - Tileset ID
1 byte  - Permission (?)
2 bytes - Pointer to secondary header (little-endian)
1 byte  - Location ID
1 byte  - Music ID
1 byte  - Upper nibble = 1 if no phone signal
          Lower nibble = Day/Night-type palette
1 byte  - Fishing group

Secondary header

1 byte  - ID of block displayed "outside" of map
1 byte  - Map height
1 byte  - Map width
1 byte  - Bank of block data
2 bytes - Pointer to block data (little-endian)
1 byte  - Bank of scripts and events headers
2 bytes - Pointer to scripts header
2 bytes - Pointer to events header
1 byte  - Bitfield of which map connections are enabled
          Bits : 0 - 0 - 0 - 0 - NORTH - SOUTH - WEST - EAST

Map connections

Map connections allow going from map A to map B simply by walking ; example : New Bark Town and Route 29 are connected through this mechanism.

Map connections are placed right after the secondary header, in this order : NORTH -> SOUTH -> WEST -> EAST (of current map).

A connection not enabled (bit not set in secondary header) is simply omitted. There can be none (example : all "interior" maps).

1 byte  - Connected map group
1 byte  - Connected map ID
2 bytes - Pointer to top-left block of map connection
2 bytes - Destination pointer (in the OverworldMap buffer) (?)
1 byte  - Length of the connection
1 byte  - Connected map's width
1 byte  - Top-left block of connection, vertical coordinate within target map (?)
1 byte  - Top-left block of connection, horizontal coordinate within target map (?)
2 bytes - Pointer to "window" (?)

Scripts header

1 byte  - Number of map triggers

(Then follow as many map triggers as specified)


1 byte  - Number of map callbacks

(Then follow as many map callbacks as specified)

Map trigger

What does this do ?

Structure : NULL-terminated list of pointers

Map callback

What does this do ?

Structure : Type ? (1 byte), then pointer to script (2 bytes)


Johto or Kanto ?

The game decides depending on the map's location in the Pokégear map

Obtain map's location

If location is S.S. Aqua
  Map is in Johto
End

If location is "Special map" (example : Pokémon Center 2F, which are all the same map)
  Consider location of previous map instead
End

If location <= $2E ($2E = Silver Cave, $2F = Pallet Town)
  Map is in Johto
Else
  If location == $58 (Victory Road)
    Map is in Johto
  Else
    Map is in Kanto
  End
End


Crystal

Battle Type

ID    Battle Type
--    -----------
00    Normal
01    
02    No Pokémon (guaranteed escape)
03    Tutorial battle
04    Hooked Pokémon
05    Suicune
06    Bug catching contest
07    Shiny Gyarados (14 ATK / 10 DEF / 10 SPEED / 10 SPC)
08    Headbutt
09    
0A    
0B    
0C    Entei, Raikou