Trainer Tower data structures (Generation III)

From Bulbapedia, the community-driven Pokémon encyclopedia.
Revision as of 18:12, 29 September 2011 by KelvSYC (talk | contribs) (Created page with "There are a number of data structures in the international releases of Pokémon FireRed and Pokémon LeafGreen that govern the Trainer Tower. All memory addresses re...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

There are a number of data structures in the international releases of Pokémon FireRed and Pokémon LeafGreen that govern the Trainer Tower.

All memory addresses refer to the addresses used in the US version of the games.

Overview

In the Japanese release of Pokémon FireRed and Pokemon LeafGreen, players could scan in e-Reader cards from the Battle-e FireRed and LeafGreen series to customize the layout of Trainer Tower. In the international releases, the data from all 32 of the regular cards are folded into the game ROM; none of the Japanese promotional cards are present. The four battle modes (Single, Double, Knockout, and Mixed) each have a hard-coded order of eight trainers, exactly as if their corresponding cards have been scanned.

Note that not all 32 cards are used in international releases; notably, all 8 of the Knockout battle cards are used in the Knockout mode, some of which are reused in Mixed mode. A few singles and doubles cards are also reused in Trainer Tower.

The card data is stored in memory location 0x0847ABAC (FireRed) and 0x0847A488 (LeafGreen).

Cards

Each Trainer Card is stored as a 992-byte structure, laid out as follows:

Offset Size Type Name
0x00 1 uint8_t Card Number
0x01 1 Currently unknown
0x02 1 uint8_t Battle Type - 0 for single battles, 1 for double battles, and 2 for knockout battles
0x03 1 uint8_t Reward Item - This is the reward item that is obtained when players defeat Trainer Hill, provided that this card represents the first trainer. The values are indices in a special 15-entry array.
0x04 984 Trainer Data[3] The data for up to three trainers and their Pokémon.
0x3DC 4 Currently unknown

Trainer Data is a 328-byte structure, laid out as follows:

Offset Size Type Name 0x00 11 char[11] Trainer Name
0x0B 3 Currently unknown
0x0E 48 Easy Chat Quote[3] Challenge, win, and lose quotes (in that order) - each of these are built in accordance to the easy chat system.
0x3E 2 Padding bytes resulting from alignment
0x40 264 Trainer's Pokemon[6] Trainer's Pokémon Lineup

Trainer's Pokémon is a 44-byte structure, laid out as follows:

Offset Size Type Name
0x00 2 uint16_t Species - see List of Pokémon by index number (Generation III) for values.
0x02 2 uint16_t Held Item - see List of items by index number (Generation III) for values.
0x04 8 uint16_t[4] Moves - see List of moves for values.
0x0C 20 Currently unknown
0x20 11 char[11] Nickname - Note that none of the Pokémon on any of these cards are actually nicknamed; the species name is placed here instead.
0x2B 1 Currently unknown

Floor Plan

The floor plan is simply a list of eight pointers to the various cards that will be used in each mode. There are four such lists, one for each mode. Their locations are as follows:

Mode FireRed LeafGreen
Single 0x084827B4 0x08482090
Double 0x084827D4 0x084820B0
Knockout 0x084827F4 0x084820D0
Mixed 0x08482814 0x084820F0

Reward Items

The reward items used on each card corresponds to indices in an array of 15 items (as indices to the master item list). This array is stored in location 0x0847A2B4 (FireRed) and 0x08479B90 (LeafGreen). For convenience, it is reproduced here.

0 1 2 3
0 HP Up Protein Iron Carbos
4 Calcium Zinc BrightPowder White Herb
8 Mental Herb Choice Band King's Rock Scope Lens
C Metal Coat Dragon Scale Up-Grade