summaryrefslogtreecommitdiff
path: root/include/pokemon.h
blob: 912df49f8e76bf513baf476d303f0bf0ab83ae45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#ifndef GUARD_POKEMON_H
#define GUARD_POKEMON_H

#include "file_system.h"
#include "item.h"
#include "constants/move.h"


#define OFFENSE_NRM 0
#define OFFENSE_SP 1

struct Offense {
    /* 0x18: att   */
    /* 0x19: spatt */
    /* 0x1a: def   */
    /* 0x1b: spdef */

    u8 att[2];
    u8 def[2];
};

struct unkPokeSubStruct_4 {
    u8 unk4;
    u8 unk5;
    u16 fill6;
};

struct unkPokeSubStruct_C
{
    u8 unk0;
    u8 fill1[3];
};

struct PokemonStruct
{
    // size: 0x58
    u16 unk0; // recruited??
    u8 unk2;
    u8 unkHasNextStage;  // set to a random value?
    struct unkPokeSubStruct_4 unk4;
    /* 0x8 */ s16 speciesNum; // species #
    struct unkPokeSubStruct_C unkC[2];
    /* 0x14 */ s16 IQ;
    /* 0x16 */ u16 pokeHP; // HP
    /* 0x18 */ struct Offense offense;
    u32 unk1C;
    u32 IQSkills;
    u8 unk24;
    u8 fill25[3];
    struct HeldItem heldItem;
    struct PokemonMove moves[MAX_MON_MOVES];
    /* 0x4C */ u8 name[POKEMON_NAME_LENGTH];
};


struct unkStruct_808E6F4
{
    s16 unk0;
    u8 unk2;
};

struct EvolveStage
{
    s16 speciesNum;
    u8 unkHasNextStage;
};


struct unkStruct_8094184
{
    struct PokemonMove moves[MAX_MON_MOVES];
    u8 unk20;
};

struct PokemonStruct2
{
    // size 0x68
    u16 unk0;  // corresponds to unk0 inPokemonStruct
    u8 unk2;   // unk2
    u8 unkHasNextStage;   // unk3
    struct unkPokeSubStruct_4 unk4;  // unk4
    u16 IQ;    // IQ (other offset)
    u16 unkA;
    u16 unkC;
    s16 speciesNum;  // speciesNum (other offset)
    u16 unk10;  // pokeHP
    u16 unk12;  // pokeHP
    struct Offense offense;  // offense (other offset)
    u32 unk18;  // unk1C
    struct unkStruct_8094184 moves;
    /* 40 */ struct ItemSlot itemSlot;  // heldItem
    u32 unk44;  // some struct
    u32 unk48;  // some struct (same type as 44)
    u32 IQSkills;  // unk20
    u8 unk50;   // unk24
    u8 fill51[3];
    struct unkStruct_808E6F4 unk54;
    u8 name[POKEMON_NAME_LENGTH];  // name (other offset)
};

struct unkStruct_203B45C
{
    /* 0x0 */ struct PokemonStruct pokemon[NUM_SPECIES];
    /* 0x8DF8 */ struct PokemonStruct2 pokemon2[4];
    /* 0x8F88 */ struct PokemonStruct team[MAX_TEAM_MEMBERS];
};

struct EvolveStruct1
{
    /* 0x34 */ s16 evolve_from;
    /* 0x36 */ s16 evolve_type;
};

struct EvolveNeeds
{
    /* 0x38 */ u16 evolve_need1;
    /* 0x3A */ u16 evolve_need2;
};

struct unkEvolve
{
    /* 0x0 */ struct EvolveStruct1 conditions;
    /* 0x4 */ struct EvolveNeeds needs;
};


struct gPokemon
{
    /* 0x0 */ u8* species;
    /* 0x4 */ u8* category;
    /* 0x8 */ u8 overworld_palette;
    /* 0x9 */ u8 size;
    /* 0xC */ s32 move_speed;
    /* 0x10 */ u16 dialogue_sprites; // Bitwise flags for whether a dialogue sprite/portrait is available for each emotion.
    /* 0x12 */ bool8 unk12;
    /* 0x13 */ u8 types[2];
    /* 0x15 */ u8 walkable_tiles;
    /* 0x16 */ u8 friend_area;
    /* 0x17 */ u8 abilities[2];
    /* 0x19 */ u8 shadow_size;
    /* 0x1A */ u8 fill1A; // 0 for all Pokémon.
    /* 0x1B */ u8 unk1B; // 100 for all Pokémon.
    /* 0x1C */ bool8 isMoving; // Set to false for Pokémon who don't move unless they're the leader, like Kakuna.
    /* 0x1D */ u8 unk1D;
    /* 0x1E */ u16 base_hp;
    /* 0x20 */ s32 base_exp;
    /* 0x24 */ u16 base_att_spatt[2];
    /* 0x28 */ u16 base_def_spdef[2];
    /* 0x2C */ u16 lowkick_dmg;
    /* 0x2E */ u16 sizeorb_dmg;
    /* 0x30 */ u8 unk30; // 10 for all Pokémon.
    /* 0x31 */ u8 unk31; // 10 for all Pokémon.
    /* 0x32 */ u8 unk32; // 24 for all Pokémon.
    /* 0x33 */ bool8 toolboxEnabled; // If false, the AI can't use items. Doesn't seem to be used, as it's true for all Pokémon.
    /* 0x34 */ struct EvolveStruct1 pre;
    /* 0x38 */ struct EvolveNeeds need;
    /* 0x3C */ s16 dexInternal[2]; // dexNo and internalNo
    /* 0x40 */ s16 base_recruit;
    /* 0x42 */ s16 alphabetParent[2]; // alphabetNo and parentNo
};


// https://www.pokecommunity.com/showthread.php?t=407371
struct LevelData
{
    s32 expRequired;
    u8 gainHP;
    u8 gainUnused;
    u8 gainAtt;
    u8 gainSPAtt;
    u8 gainDef;
    u8 gainSPDef;
    u16 fillA;
};

struct unkStruct_808E218_arg
{
    u16 unk0[NUM_SPECIES];
    u32 count;
};

struct unkStruct_808E218
{
    // leveldata? (same size)
    struct unkStruct_808E6F4 unk0[3];
};

extern struct unkStruct_203B45C *gRecruitedPokemonRef;

void LoadMonsterParameters(void);
struct unkStruct_203B45C *GetRecruitedPokemon(void);
void InitializeRecruitedPokemon(void);


void CopySpeciesNametoBuffer(u8 * buffer, s16 index);
void CopyYellowSpeciesNametoBuffer(u8 *buffer, s16 index);
void CopyCyanSpeciesNametoBuffer(u8 *buffer, s16 index);
void PrintColoredPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon, s32 colorNum);
void PeekPokemonItem(s16 index_, struct HeldItem* item);
void GivePokemonItem(s16 index_, struct HeldItem* item);
bool8 IsPokemonRenamed(struct PokemonStruct* pokemon);

u8 *GetCategoryString(s16 index);
u8 GetPokemonSize(s16 index);
u8 GetShadowSize(s16 index);
char * GetMonSpecies(s16 index);
s32 GetMoveSpeed(s16 index);
u8 GetWalkableTiles(s16 index);
u8 GetUnk1B(s16 index);
bool8 GetIsMoving(s16 index);
u8 GetUnk1D(s16 index);
u16 GetLowKickDmg(s16 index);
u16 GetSizeOrbDmg(s16 index);
u8 GetFriendArea(s16 index);
u16 GetBaseHP(s16 index);
bool8 IsToolboxEnabled(s16 index);
u8 GetUnk12(s16 index);
s16 GetPokemonEvolveFrom(s16 index);
u16 GetPokemonAttSpatt(s16 index, u32 r1);
u16 GetPokemonDefSpdef(s16 index, u32 r1);
u8 GetPokemonType(s32 index, u32 typeIndex);
u8 GetPokemonAbility(s16 index, u32 abilityIndex);
s16 GetDexInternalNo(s16 index, u32 r1);
s16 GetBaseRecruit(s16 index);
s16 GetAlphabetParentNo(s16 index, s32 r1);
s16 GetInternalNo(s16 index);
s32 CalculateEXPGain(s16 index, s32 level);
s16 GetPokemonEvolveConditons(s16 index, struct unkEvolve *r1);
u8 GetPokemonOverworldPalette(s16 index, u32 r1);
bool8 IsPokemonDialogueSpriteAvail(s16 index, s32 r1);
struct OpenedFile *OpenPokemonDialogueSpriteFile(s16 index);
struct OpenedFile *GetDialogueSpriteDataPtr(s16 index);
s32 GetUnownIndex(s16 index);
void sub_808E6F4(struct unkStruct_808E6F4* a1);
s32 GetEvolutionSequence(struct PokemonStruct* pokemon, struct EvolveStage* a2);
void xxx_pokemonstruct_to_pokemon2_808DE50(struct PokemonStruct2* r0, struct PokemonStruct *r1, s32 r2);
void SavePokemonStruct(struct unkStruct_8094924* a1, struct PokemonStruct* pokemon);
void RestorePokemonStruct(struct unkStruct_8094924*, struct PokemonStruct*);


#endif // GUARD_POKEMON_H