Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document pokemon.c and Pokemon data structs #47

Merged
merged 11 commits into from
Sep 14, 2023
  •  
  •  
  •  
155 changes: 110 additions & 45 deletions include/constants/pokemon.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,58 @@
#ifndef POKEPLATINUM_CONSTANTS_POKEMON_H
#define POKEPLATINUM_CONSTANTS_POKEMON_H

// Pokemon types
#define TYPE_NONE 255
#define TYPE_NORMAL 0
#define TYPE_FIGHTING 1
#define TYPE_FLYING 2
#define TYPE_POISON 3
#define TYPE_GROUND 4
#define TYPE_ROCK 5
#define TYPE_BUG 6
#define TYPE_GHOST 7
#define TYPE_STEEL 8
#define TYPE_MYSTERY 9
#define TYPE_FIRE 10
#define TYPE_WATER 11
#define TYPE_GRASS 12
#define TYPE_ELECTRIC 13
#define TYPE_PSYCHIC 14
#define TYPE_ICE 15
#define TYPE_DRAGON 16
#define TYPE_DARK 17
#define NUMBER_OF_MON_TYPES 18
/**
* @brief Pokemon Types
* (Can't make this an enum yet due to issues with csv2bin)
*/
// enum PokemonType {
#define TYPE_NORMAL 0
#define TYPE_FIGHTING 1
#define TYPE_FLYING 2
#define TYPE_POISON 3
#define TYPE_GROUND 4
#define TYPE_ROCK 5
#define TYPE_BUG 6
#define TYPE_GHOST 7
#define TYPE_STEEL 8
#define TYPE_MYSTERY 9
#define TYPE_FIRE 10
#define TYPE_WATER 11
#define TYPE_GRASS 12
#define TYPE_ELECTRIC 13
#define TYPE_PSYCHIC 14
#define TYPE_ICE 15
#define TYPE_DRAGON 16
#define TYPE_DARK 17
#define NUMBER_OF_MON_TYPES 18
#define TYPE_NONE 255
// };

/**
* @brief Pokemon Stats
*/
enum PokemonStats {
STAT_HP = 0,
STAT_ATTACK,
STAT_DEFENSE,
STAT_SPEED,
STAT_SPECIAL_ATTACK,
STAT_SPECIAL_DEFENSE
};

#define MAX_PARTY_SIZE 6
#define NUM_BOOSTABLE_STATS 8

enum {
enum PokemonGender {
MON_GENDER_MALE,
MON_GENDER_FEMALE,
MON_GENDER_NONE
};

/**
* @brief Pokemon Data Parameters
*/
enum PokemonDataParam {
MON_DATA_PERSONALITY,
MON_DATA_1,
MON_DATA_2,
Expand All @@ -37,7 +63,7 @@ enum {
MON_DATA_OT_ID,
MON_DATA_EXP,
MON_DATA_FRIENDSHIP,
MON_DATA_10,
MON_DATA_ABILITY,
MON_DATA_11,
MON_DATA_LANGUAGE,
MON_DATA_HP_EV,
Expand Down Expand Up @@ -85,18 +111,18 @@ enum {
MON_DATA_MOVE2,
MON_DATA_MOVE3,
MON_DATA_MOVE4,
MON_DATA_58,
MON_DATA_59,
MON_DATA_60,
MON_DATA_61,
MON_DATA_62,
MON_DATA_63,
MON_DATA_64,
MON_DATA_65,
MON_DATA_66,
MON_DATA_67,
MON_DATA_68,
MON_DATA_69,
MON_DATA_MOVE1_CUR_PP,
MON_DATA_MOVE2_CUR_PP,
MON_DATA_MOVE3_CUR_PP,
MON_DATA_MOVE4_CUR_PP,
MON_DATA_MOVE1_PP_UPS,
MON_DATA_MOVE2_PP_UPS,
MON_DATA_MOVE3_PP_UPS,
MON_DATA_MOVE4_PP_UPS,
MON_DATA_MOVE1_MAX_PP,
MON_DATA_MOVE2_MAX_PP,
MON_DATA_MOVE3_MAX_PP,
MON_DATA_MOVE4_MAX_PP,
MON_DATA_HP_IV,
MON_DATA_ATK_IV,
MON_DATA_DEF_IV,
Expand Down Expand Up @@ -138,7 +164,7 @@ enum {
MON_DATA_EARTH_RIBBON,
MON_DATA_WORLD_RIBBON,
MON_DATA_FATEFUL_ENCOUNTER,
MON_DATA_111,
MON_DATA_GENDER,
MON_DATA_FORM,
MON_DATA_113,
MON_DATA_114,
Expand Down Expand Up @@ -188,25 +214,64 @@ enum {
MON_DATA_158,
MON_DATA_159,
MON_DATA_160,
MON_DATA_161,
MON_DATA_LEVEL,
MON_DATA_162,
MON_DATA_163,
MON_DATA_164,
MON_DATA_165,
MON_DATA_166,
MON_DATA_167,
MON_DATA_168,
MON_DATA_169,
MON_DATA_CURRENT_HP,
MON_DATA_MAX_HP,
MON_DATA_ATK,
MON_DATA_DEF,
MON_DATA_SPEED,
MON_DATA_SP_ATK,
MON_DATA_SP_DEF,
MON_DATA_170,
MON_DATA_171,
MON_DATA_172,
MON_DATA_173,
MON_DATA_SPECIES_EGG,
MON_DATA_175,
MON_DATA_COMBINED_IVS,
MON_DATA_176,
MON_DATA_177,
MON_DATA_178,
MON_DATA_179,
};

/**
* @brief PokemonPersonalData Parameters
*/
enum PokemonPersonalDataParam {
MON_DATA_PERSONAL_BASE_HP = 0,
MON_DATA_PERSONAL_BASE_ATK,
MON_DATA_PERSONAL_BASE_DEF,
MON_DATA_PERSONAL_BASE_SPEED,
MON_DATA_PERSONAL_BASE_SP_ATK,
MON_DATA_PERSONAL_BASE_SP_DEF,
MON_DATA_PERSONAL_TYPE_1,
MON_DATA_PERSONAL_TYPE_2,
MON_DATA_PERSONAL_CATCH_RATE,
MON_DATA_PERSONAL_BASE_EXP,
MON_DATA_PERSONAL_EV_HP_YIELD,
MON_DATA_PERSONAL_EV_ATK_YIELD,
MON_DATA_PERSONAL_EV_DEF_YIELD,
MON_DATA_PERSONAL_EV_SPEED_YIELD,
MON_DATA_PERSONAL_EV_SP_ATK_YIELD,
MON_DATA_PERSONAL_EV_SP_DEF_YIELD,
MON_DATA_PERSONAL_ITEM1,
MON_DATA_PERSONAL_ITEM2,
MON_DATA_PERSONAL_GENDER,
MON_DATA_PERSONAL_HATCH_CYCLE,
MON_DATA_PERSONAL_BASE_FRIENDSHIP,
MON_DATA_PERSONAL_EXP_RATE,
MON_DATA_PERSONAL_EGG_GROUP_1,
MON_DATA_PERSONAL_EGG_GROUP_2,
MON_DATA_PERSONAL_ABILITY_1,
MON_DATA_PERSONAL_ABILITY_2,
MON_DATA_PERSONAL_GREAT_MARSH_FLEE_RATE,
MON_DATA_PERSONAL_COLOR,
MON_DATA_PERSONAL_INVERSE,
MON_DATA_PERSONAL_TM_LEARNSET_MASK_1,
MON_DATA_PERSONAL_TM_LEARNSET_MASK_2,
MON_DATA_PERSONAL_TM_LEARNSET_MASK_3,
MON_DATA_PERSONAL_TM_LEARNSET_MASK_4,
};

#endif // POKEPLATINUM_CONSTANTS_POKEMON_H
2 changes: 1 addition & 1 deletion include/inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ inline u16 inline_020564D0 (const u16 param0)
u16 v0;
u16 v1;
v0 = (0xffff / param0) + 1;
v1 = sub_0201D2E8() / v0;
v1 = LCRNG_Next() / v0;

GF_ASSERT((v1 < param0));
return v1;
Expand Down
3 changes: 1 addition & 2 deletions include/overlay005/ov5_021E622C.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "struct_decls/struct_02026218_decl.h"
#include "struct_decls/struct_02026310_decl.h"
#include "struct_decls/struct_0203CDB0_decl.h"
#include "struct_defs/pokemon.h"
#include "struct_defs/box_pokemon.h"
#include "pokemon.h"
#include "struct_decls/struct_party_decl.h"
#include "struct_decls/struct_021C0794_decl.h"

Expand Down
2 changes: 1 addition & 1 deletion include/overlay006/ov6_02243258.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "struct_decls/struct_0201CD38_decl.h"
#include "struct_decls/struct_0203CDB0_decl.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"

UnkStruct_0201CD38 * ov6_02243F88(UnkStruct_0203CDB0 * param0, u32 param1, Pokemon * param2, int param3);
int ov6_02243FBC(UnkStruct_0201CD38 * param0);
Expand Down
2 changes: 1 addition & 1 deletion include/overlay006/ov6_02246184.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEPLATINUM_OV6_02246184_H

#include "struct_decls/struct_0203CDB0_decl.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "overlay006/struct_ov6_02246204_decl.h"
#include "overlay006/struct_ov6_02246254.h"

Expand Down
2 changes: 1 addition & 1 deletion include/overlay006/ov6_02247100.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "struct_decls/struct_0203CDB0_decl.h"
#include "struct_decls/struct_020508D4_decl.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"

void * ov6_02247100(UnkStruct_0203CDB0 * param0, u32 param1);
BOOL ov6_02247120(UnkStruct_020508D4 * param0);
Expand Down
2 changes: 1 addition & 1 deletion include/overlay006/ov6_022489E4.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEPLATINUM_OV6_022489E4_H

#include "strbuf.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "struct_defs/struct_020954F0.h"
#include "struct_defs/struct_02095C48.h"
#include "overlay006/struct_ov6_02248BE8.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay006/struct_ov6_02246254.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "struct_decls/struct_02025E6C_decl.h"
#include "struct_defs/struct_020279FC.h"
#include "struct_defs/box_pokemon.h"
#include "pokemon.h"

typedef struct {
const BoxPokemon * unk_00;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay012/struct_ov12_02236030.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_OV12_02236030_H
#define POKEPLATINUM_STRUCT_OV12_02236030_H

#include "struct_defs/pokemon.h"
#include "pokemon.h"

typedef struct {
int unk_00;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay013/struct_ov13_02221ED0.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_OV13_02221ED0_H
#define POKEPLATINUM_STRUCT_OV13_02221ED0_H

#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "overlay013/struct_ov13_022236B8.h"

typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion include/overlay016/ov16_0223DF00.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "struct_defs/struct_020279FC.h"
#include "struct_decls/struct_0202CC84_decl.h"
#include "struct_defs/struct_0205AA50.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "struct_decls/struct_020797DC_decl.h"
#include "struct_decls/struct_party_decl.h"
#include "struct_defs/trainer_data.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay016/ov16_0225177C.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_OV16_0225177C_H
#define POKEPLATINUM_OV16_0225177C_H

#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "struct_decls/battle_system.h"
#include "battle/battle_context.h"
#include "battle/battle_mon.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay017/struct_ov17_022489C8.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_OV17_022489C8_H
#define POKEPLATINUM_STRUCT_OV17_022489C8_H

#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "overlay012/struct_ov12_02235FE0_decl.h"
#include "overlay012/struct_ov12_02236030.h"

Expand Down
2 changes: 1 addition & 1 deletion include/overlay017/struct_ov17_0224E1F4.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEPLATINUM_STRUCT_OV17_0224E1F4_H

#include "struct_decls/struct_02007C7C_decl.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "overlay017/struct_ov17_0224B09C.h"

typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion include/overlay019/ov19_021D0D80.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "struct_decls/struct_020067E8_decl.h"
#include "message.h"
#include "struct_decls/struct_0200B358_decl.h"
#include "struct_defs/box_pokemon.h"
#include "pokemon.h"
#include "struct_decls/struct_020797DC_decl.h"
#include "overlay019/struct_ov19_021D4DF0.h"
#include "overlay019/struct_ov19_021D4F5C.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay019/ov19_021DA270.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "struct_decls/struct_02006C24_decl.h"
#include "struct_decls/struct_020218BC_decl.h"
#include "struct_defs/box_pokemon.h"
#include "pokemon.h"
#include "overlay019/struct_ov19_021D4DF0.h"
#include "overlay019/struct_ov19_021D61B0_decl.h"
#include "overlay019/struct_ov19_021DA384.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay019/struct_ov19_021D5594.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_OV19_021D5594_H
#define POKEPLATINUM_STRUCT_OV19_021D5594_H

#include "struct_defs/box_pokemon.h"
#include "pokemon.h"

typedef struct {
BoxPokemon * unk_00;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay021/struct_ov21_021E8E0C.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "struct_decls/struct_02002F38_decl.h"
#include "struct_decls/struct_02007768_decl.h"
#include "struct_decls/struct_02018340_decl.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"

typedef struct {
UnkStruct_02018340 * unk_00;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay022/ov22_022578F4.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEPLATINUM_OV22_022578F4_H

#include "struct_defs/struct_02008A90.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "overlay022/struct_ov22_02257964.h"
#include "overlay022/struct_ov22_02259560.h"
#include "overlay022/struct_ov22_0225B388.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay022/ov22_02259098.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "struct_decls/struct_02007768_decl.h"
#include "struct_defs/struct_02008A90.h"
#include "struct_defs/struct_020298D8.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "overlay022/struct_ov22_022596B0.h"
#include "overlay022/struct_ov22_0225A0E4.h"

Expand Down
2 changes: 1 addition & 1 deletion include/overlay076/struct_ov76_0223DE00.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "struct_decls/struct_0200D0F4_decl.h"
#include "struct_defs/struct_0202CA28.h"
#include "struct_decls/struct_0202CA88_decl.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"
#include "struct_defs/struct_02097F18.h"
#include "overlay076/struct_ov76_0223B52C.h"
#include "overlay076/struct_ov76_0223BBAC.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay079/struct_ov79_021D38D0.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define POKEPLATINUM_STRUCT_OV79_021D38D0_H

#include "strbuf.h"
#include "struct_defs/pokemon.h"
#include "pokemon.h"

typedef struct {
Pokemon * unk_00;
Expand Down
Loading
Loading