Pokémon Gold and Silver:Notes

From Data Crystal
Jump to: navigation, search

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)


Wild Pokémon

Wild Pokémon data isn't stored in the map's header. Instead, the game has 7 tables.

Table Gold/Silver location Crystal location
 ??? | 92488
 ??? | 2A5E9
 ??? | 2B274
 ??? | 2B11D
 ??? | 2B7F7
 ??? | 2B8D0
 ??? | 2B92F

Random encounter

Structure of an entry :

1 byte  - Map group
1 byte  - Map ID

1 byte  - Encounter rate at morning
1 byte  - Encounter rate at day
1 byte  - Encounter rate at night

Repeated 7 times :
1 byte  - Level of Pokémon, encountered at morning
1 byte  - Species of Pokémon, encountered at morning

Repeated 7 times :
1 byte  - Level of Pokémon, encountered at day
1 byte  - Species of Pokémon, encountered at day

Repeated 7 times :
1 byte  - Level of Pokémon, encountered at night
1 byte  - Species of Pokémon, encountered at night

The list is $FF-terminated. Maps where the encounter rates and encountered Pokémon don't depend on the time simply duplicate entries.

When RNG decides it's time for an encounter, the game browses the table. If it finds an entry that begins with the map's group and ID, it performs a RNG check against the corresponding encounter rate.

If the check passes, the game picks an encounter in the corresponding table.

Fishing

The game picks one table depending on the map's fishing group and the Rod used.

Then what does it do ?


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


Internal Data for Pokémon Gold and Silver

ROM MapRAM MapText TableNotesTutorials