Trainer data structure (Generation II): Difference between revisions

no edit summary
(added a few symbols and fixed an error)
No edit summary
 
(8 intermediate revisions by 8 users not shown)
Line 2: Line 2:
{{cleanup}}
{{cleanup}}


{| width="400" style="text-align: center; margin: auto; border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse;" cellspacing="1" cellpadding="2"
==NPC Trainer data==
! style="text-align: center; background: #ccf;" | Offset
 
! style="text-align: center; background: #ccf;" | Name
{|style="text-align: left; margin: auto; border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse; float: right; width: 250px; padding-left:5px;" cellspacing="1" cellpadding="2"
! style="text-align: center; background: #ccf;" | Length
! style="text-align: center; background: #{{johto color}};" | Name
! style="text-align: center; background: #ccf;" | Type
! style="text-align: center; background: #{{johto color}};" | Length
|-
| Name
| 2-8 bytes
|-
|-
| 0x15C7-0x15C8
|style="padding-left:20px;"| Name string
| ID number
|style="padding-left:10px;"| 1-7 bytes
| {{tt|Word|2 bytes}}
| Integer
|-
|-
| 0x15C9-0x15D0
|style="padding-left:20px;"| Terminator
| Name
|style="padding-left:10px;"| 1 byte
| 8 bytes
| String
|-
|-
| 0x15D1-0x15D3
| Custom move marker
| ''Padding''
| 1 byte
| 3 bytes
| Null
|}
 
==Notes==
 
===Strings===
 
Strings use a unique storage format as outlined in the following table. They are terminated with 0x50 and any extra characters after the termination character in the string have the value 0x00.
 
{| width="400" style="text-align: center; margin: auto; border: 1px solid #88a; background: #f8f8ff; padding: 0.5em; border-collapse: collapse;" cellspacing="1" cellpadding="2"
! style="text-align: center; background: #ccf;" | Padding
! style="text-align: center; background: #ccf;" | Hyphen
! style="text-align: center; background: #ccf;" | Terminator
! style="text-align: center; background: #ccf;" | Space
! style="text-align: center; background: #ccf;" | A
! style="text-align: center; background: #ccf;" | B
! style="text-align: center; background: #ccf;" | C
! style="text-align: center; background: #ccf;" | D
! style="text-align: center; background: #ccf;" | E
! style="text-align: center; background: #ccf;" | F
! style="text-align: center; background: #ccf;" | G
! style="text-align: center; background: #ccf;" | H
! style="text-align: center; background: #ccf;" | I
! style="text-align: center; background: #ccf;" | J
! style="text-align: center; background: #ccf;" | K
! style="text-align: center; background: #ccf;" | L
! style="text-align: center; background: #ccf;" | M
! style="text-align: center; background: #ccf;" | N
! style="text-align: center; background: #ccf;" | O
! style="text-align: center; background: #ccf;" | P
|-
|-
| 0x00
| Pokémon
| 0xe3
| 2-6 bytes
| 0x50
| 0x7f
| 0x80
| 0x81
| 0x82
| 0x83
| 0x84
| 0x85
| 0x86
| 0x87
| 0x88
| 0x89
| 0x8A
| 0x8B
| 0x8C
| 0x8D
| 0x8E
| 0x8F
|-
|-
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | Q
|style="padding-left:20px;"| Level
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | R
|style="padding-left:10px;"| 1 byte
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | S
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | T
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | U
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | V
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | W
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | X
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | Y
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | Z
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | a
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | b
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | c
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | d
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | e
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | f
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | g
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | h
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | i
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | j
|-
|-
| 0x90
|style="padding-left:20px;"| Species
| 0x91
|style="padding-left:10px;"| 1 byte
| 0x92
| 0x93
| 0x94
| 0x95
| 0x96
| 0x97
| 0x98
| 0x99
| 0xA0
| 0xA1
| 0xA2
| 0xA3
| 0xA4
| 0xA5
| 0xA6
| 0xA7
| 0xA8
| 0xA9
|-
|-
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | k
|style="padding-left:20px;"| Moveset
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | l
|style="padding-left:10px;"| 4 bytes
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | m
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | n
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | o
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | p
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | q
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | r
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | s
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | t
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | u
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | v
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | w
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | x
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | y
! style="text-align: center; border-top: 1px solid #88a; background: #ccf;" | z
! colspan="6" style="text-align: center; border-top: 1px solid #88a; background: #ccf;" |  
|-
|-
| 0xAA
| Terminator
| 0xAB
| 1 byte
| 0xAC
| 0xAD
| 0xAE
| 0xAF
| 0xB0
| 0xB1
| 0xB2
| 0xB3
| 0xB4
| 0xB5
| 0xB6
| 0xB7
| 0xB8
| 0xB9
|}
|}
The in-game Trainer data is remarkably compressed.
====Name====
This is a {{OBP|Character encoding|Generation II|string}} going anywhere from 2 to 8 bytes, containing the Trainer's name and ending in a 0x50 terminator. The rival's name is represented by a single byte - 0xE6.
====Custom move marker====
This is one byte marking whether the Pokémon in the party have custom moves or not. If not, it is set to 0 - if so, it is set to 1.
====Pokémon====
Depending on whether the custom move marker was set or not, each Pokémon's data is either 2 or 6 bytes long. If the move marker was set to 0, the Pokémon's data simply contains the Pokémon's level and species, in that order. Otherwise, it contains the full moveset after the level and species - 1 byte per move.
====Terminator====
This is a single byte (0xFF) which tells the processor to stop reading data.


{{Stub|Game}}
{{Stub|Game}}
{{data structure}}
{{data structure}}<br>
{{Project Games notice|data structure}}