diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 028b36e48b..4d52d14643 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -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, @@ -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, @@ -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, @@ -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, @@ -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 diff --git a/include/inlines.h b/include/inlines.h index ff297313df..d077e63d04 100644 --- a/include/inlines.h +++ b/include/inlines.h @@ -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; diff --git a/include/overlay005/ov5_021E622C.h b/include/overlay005/ov5_021E622C.h index a8dfc82d16..e6ea3748cd 100644 --- a/include/overlay005/ov5_021E622C.h +++ b/include/overlay005/ov5_021E622C.h @@ -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" diff --git a/include/overlay006/ov6_02243258.h b/include/overlay006/ov6_02243258.h index 9f997e6f03..4e3536130a 100644 --- a/include/overlay006/ov6_02243258.h +++ b/include/overlay006/ov6_02243258.h @@ -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); diff --git a/include/overlay006/ov6_02246184.h b/include/overlay006/ov6_02246184.h index 9a5e704a3f..6892e250ef 100644 --- a/include/overlay006/ov6_02246184.h +++ b/include/overlay006/ov6_02246184.h @@ -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" diff --git a/include/overlay006/ov6_02247100.h b/include/overlay006/ov6_02247100.h index 632b5e211f..bb98b8cb07 100644 --- a/include/overlay006/ov6_02247100.h +++ b/include/overlay006/ov6_02247100.h @@ -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); diff --git a/include/overlay006/ov6_022489E4.h b/include/overlay006/ov6_022489E4.h index 4f208da876..d1310b85d7 100644 --- a/include/overlay006/ov6_022489E4.h +++ b/include/overlay006/ov6_022489E4.h @@ -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" diff --git a/include/overlay006/struct_ov6_02246254.h b/include/overlay006/struct_ov6_02246254.h index a2e0b235f1..0af49f85a9 100644 --- a/include/overlay006/struct_ov6_02246254.h +++ b/include/overlay006/struct_ov6_02246254.h @@ -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; diff --git a/include/overlay012/struct_ov12_02236030.h b/include/overlay012/struct_ov12_02236030.h index d72258f720..0228b1a1d2 100644 --- a/include/overlay012/struct_ov12_02236030.h +++ b/include/overlay012/struct_ov12_02236030.h @@ -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; diff --git a/include/overlay013/struct_ov13_02221ED0.h b/include/overlay013/struct_ov13_02221ED0.h index d4ba54c6d1..f15999867d 100644 --- a/include/overlay013/struct_ov13_02221ED0.h +++ b/include/overlay013/struct_ov13_02221ED0.h @@ -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 { diff --git a/include/overlay016/ov16_0223DF00.h b/include/overlay016/ov16_0223DF00.h index 8d21fb376c..0799f8aaa7 100644 --- a/include/overlay016/ov16_0223DF00.h +++ b/include/overlay016/ov16_0223DF00.h @@ -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" diff --git a/include/overlay016/ov16_0225177C.h b/include/overlay016/ov16_0225177C.h index c224321e6a..49eb22192c 100644 --- a/include/overlay016/ov16_0225177C.h +++ b/include/overlay016/ov16_0225177C.h @@ -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" diff --git a/include/overlay017/struct_ov17_022489C8.h b/include/overlay017/struct_ov17_022489C8.h index 7a5ae1353a..b7cb31cb11 100644 --- a/include/overlay017/struct_ov17_022489C8.h +++ b/include/overlay017/struct_ov17_022489C8.h @@ -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" diff --git a/include/overlay017/struct_ov17_0224E1F4.h b/include/overlay017/struct_ov17_0224E1F4.h index 99ed41d0d5..8a2903526a 100644 --- a/include/overlay017/struct_ov17_0224E1F4.h +++ b/include/overlay017/struct_ov17_0224E1F4.h @@ -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 { diff --git a/include/overlay019/ov19_021D0D80.h b/include/overlay019/ov19_021D0D80.h index 6b77b0b92b..6352cc9e37 100644 --- a/include/overlay019/ov19_021D0D80.h +++ b/include/overlay019/ov19_021D0D80.h @@ -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" diff --git a/include/overlay019/ov19_021DA270.h b/include/overlay019/ov19_021DA270.h index 3b13d65c31..e07a358916 100644 --- a/include/overlay019/ov19_021DA270.h +++ b/include/overlay019/ov19_021DA270.h @@ -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" diff --git a/include/overlay019/struct_ov19_021D5594.h b/include/overlay019/struct_ov19_021D5594.h index 502ca92e9d..273cf227d1 100644 --- a/include/overlay019/struct_ov19_021D5594.h +++ b/include/overlay019/struct_ov19_021D5594.h @@ -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; diff --git a/include/overlay021/struct_ov21_021E8E0C.h b/include/overlay021/struct_ov21_021E8E0C.h index c6c3d3e91a..a0283a07fd 100644 --- a/include/overlay021/struct_ov21_021E8E0C.h +++ b/include/overlay021/struct_ov21_021E8E0C.h @@ -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; diff --git a/include/overlay022/ov22_022578F4.h b/include/overlay022/ov22_022578F4.h index 7badcd2260..ef881e13d6 100644 --- a/include/overlay022/ov22_022578F4.h +++ b/include/overlay022/ov22_022578F4.h @@ -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" diff --git a/include/overlay022/ov22_02259098.h b/include/overlay022/ov22_02259098.h index 8ff74b4b22..504e9e1ef0 100644 --- a/include/overlay022/ov22_02259098.h +++ b/include/overlay022/ov22_02259098.h @@ -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" diff --git a/include/overlay076/struct_ov76_0223DE00.h b/include/overlay076/struct_ov76_0223DE00.h index 69c6e520a1..b33a17c826 100644 --- a/include/overlay076/struct_ov76_0223DE00.h +++ b/include/overlay076/struct_ov76_0223DE00.h @@ -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" diff --git a/include/overlay079/struct_ov79_021D38D0.h b/include/overlay079/struct_ov79_021D38D0.h index 08ca59b6f4..4b6834d0e6 100644 --- a/include/overlay079/struct_ov79_021D38D0.h +++ b/include/overlay079/struct_ov79_021D38D0.h @@ -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; diff --git a/include/overlay088/struct_ov88_0223C370.h b/include/overlay088/struct_ov88_0223C370.h index 6824883cce..d017504364 100644 --- a/include/overlay088/struct_ov88_0223C370.h +++ b/include/overlay088/struct_ov88_0223C370.h @@ -9,7 +9,7 @@ #include "struct_decls/struct_0202C878_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_0203CDB0_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/overlay094/ov94_0223D0C4.h b/include/overlay094/ov94_0223D0C4.h index e1925b0f70..a310a84074 100644 --- a/include/overlay094/ov94_0223D0C4.h +++ b/include/overlay094/ov94_0223D0C4.h @@ -4,8 +4,7 @@ #include "message.h" #include "struct_decls/struct_0200B358_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay094/struct_ov94_0223BA88_sub2.h" #include "overlay094/struct_ov94_0223FD4C_decl.h" diff --git a/include/overlay094/ov94_0223FB48.h b/include/overlay094/ov94_0223FB48.h index c0a8a2cc3e..d87ab77ce8 100644 --- a/include/overlay094/ov94_0223FB48.h +++ b/include/overlay094/ov94_0223FB48.h @@ -1,8 +1,7 @@ #ifndef POKEPLATINUM_OV94_0223FB48_H #define POKEPLATINUM_OV94_0223FB48_H -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "overlay094/struct_ov94_0223FD4C_decl.h" diff --git a/include/overlay094/struct_ov94_0223FD4C.h b/include/overlay094/struct_ov94_0223FD4C.h index e3975a1c18..7eb1a338d5 100644 --- a/include/overlay094/struct_ov94_0223FD4C.h +++ b/include/overlay094/struct_ov94_0223FD4C.h @@ -19,8 +19,7 @@ #include "struct_decls/struct_0202B370_decl.h" #include "struct_defs/struct_0203E0FC.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_defs/struct_02098D38.h" #include "overlay006/struct_ov6_02246254.h" diff --git a/include/overlay095/ov95_02246C20.h b/include/overlay095/ov95_02246C20.h index 2813450781..e0613b2b0e 100644 --- a/include/overlay095/ov95_02246C20.h +++ b/include/overlay095/ov95_02246C20.h @@ -6,7 +6,7 @@ #include "struct_decls/struct_0200B358_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021DA864.h" #include "overlay095/struct_ov95_02247004_decl.h" #include "overlay095/struct_ov95_022472C4_decl.h" diff --git a/include/overlay096/struct_ov96_0223BF40_t.h b/include/overlay096/struct_ov96_0223BF40_t.h index db86d0c439..ab9a6b8246 100644 --- a/include/overlay096/struct_ov96_0223BF40_t.h +++ b/include/overlay096/struct_ov96_0223BF40_t.h @@ -13,7 +13,7 @@ #include "strbuf.h" #include "struct_defs/struct_0205AA50.h" #include "struct_defs/struct_0206BC70.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021DA864.h" #include "overlay061/struct_ov61_0222C3B0.h" #include "overlay096/struct_ov96_0223B450.h" diff --git a/include/overlay104/ov104_0222DCE0.h b/include/overlay104/ov104_0222DCE0.h index 9b57d5a864..49ba5631a8 100644 --- a/include/overlay104/ov104_0222DCE0.h +++ b/include/overlay104/ov104_0222DCE0.h @@ -6,7 +6,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_0204B184.h" #include "struct_defs/struct_0204B1E8.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay006/battle_params.h" diff --git a/include/overlay104/ov104_02231F74.h b/include/overlay104/ov104_02231F74.h index 47a4e63d06..f63eaa669f 100644 --- a/include/overlay104/ov104_02231F74.h +++ b/include/overlay104/ov104_02231F74.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_0200B358_decl.h" #include "struct_decls/struct_0200D0F4_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay063/struct_ov63_0222BEC0_decl.h" #include "overlay063/struct_ov63_0222CCB8.h" #include "overlay104/struct_ov104_0222E930_decl.h" diff --git a/include/overlay104/ov104_0223B6F4.h b/include/overlay104/ov104_0223B6F4.h index c2479039f1..e6264d5d94 100644 --- a/include/overlay104/ov104_0223B6F4.h +++ b/include/overlay104/ov104_0223B6F4.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay006/battle_params.h" #include "overlay104/struct_ov104_02230BE4.h" diff --git a/include/overlay104/ov104_0223BCBC.h b/include/overlay104/ov104_0223BCBC.h index 8940803f1a..759c8beb34 100644 --- a/include/overlay104/ov104_0223BCBC.h +++ b/include/overlay104/ov104_0223BCBC.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV104_0223BCBC_H #define POKEPLATINUM_OV104_0223BCBC_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay006/battle_params.h" #include "overlay104/struct_ov104_02230BE4.h" diff --git a/include/overlay104/struct_ov104_0223B5C0.h b/include/overlay104/struct_ov104_0223B5C0.h index aacc35676d..5166a16fc8 100644 --- a/include/overlay104/struct_ov104_0223B5C0.h +++ b/include/overlay104/struct_ov104_0223B5C0.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_STRUCT_OV104_0223B5C0_H #include "struct_decls/struct_02030114_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay104/struct_ov104_0223A348.h" diff --git a/include/overlay105/ov105_02245CD0.h b/include/overlay105/ov105_02245CD0.h index bd40c01ee7..0697c4ac72 100644 --- a/include/overlay105/ov105_02245CD0.h +++ b/include/overlay105/ov105_02245CD0.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" void ov105_02245CD0(void); void ov105_02245D50(UnkStruct_02007768 * param0); diff --git a/include/overlay106/ov106_02243310.h b/include/overlay106/ov106_02243310.h index 1ced5bd9b2..ca4ed60edf 100644 --- a/include/overlay106/ov106_02243310.h +++ b/include/overlay106/ov106_02243310.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_OV106_02243310_H #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay106/struct_ov106_02243310.h" void ov106_02243310(UnkStruct_ov106_02243310 * param0, Pokemon * param1); diff --git a/include/overlay106/ov106_022435FC.h b/include/overlay106/ov106_022435FC.h index 0b078dc681..d26645329b 100644 --- a/include/overlay106/ov106_022435FC.h +++ b/include/overlay106/ov106_022435FC.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV106_022435FC_H #define POKEPLATINUM_OV106_022435FC_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay106/struct_ov106_02243310.h" #include "overlay106/struct_ov106_02243650_decl.h" diff --git a/include/overlay107/ov107_02249B1C.h b/include/overlay107/ov107_02249B1C.h index 0f716f9ea4..b8bc850dd9 100644 --- a/include/overlay107/ov107_02249B1C.h +++ b/include/overlay107/ov107_02249B1C.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV107_02249B1C_H #define POKEPLATINUM_OV107_02249B1C_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay107/struct_ov107_02249954.h" #include "overlay107/struct_ov107_02249B8C_decl.h" diff --git a/include/overlay108/ov108_0224351C.h b/include/overlay108/ov108_0224351C.h index c93452bd4a..33485c9f88 100644 --- a/include/overlay108/ov108_0224351C.h +++ b/include/overlay108/ov108_0224351C.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV108_0224351C_H #define POKEPLATINUM_OV108_0224351C_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay108/struct_ov108_02243030.h" #include "overlay108/struct_ov108_02243594_decl.h" diff --git a/include/overlay119/ov119_021D0D80.h b/include/overlay119/ov119_021D0D80.h index 3be5b69783..17468c0b78 100644 --- a/include/overlay119/ov119_021D0D80.h +++ b/include/overlay119/ov119_021D0D80.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_02014014_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207C690.h" #include "overlay119/struct_ov119_021D0FD0.h" #include "overlay119/struct_ov119_021D14DC.h" diff --git a/include/party.h b/include/party.h index 0c8ce86b67..82d9cfe140 100644 --- a/include/party.h +++ b/include/party.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_02079FEC_H #define POKEPLATINUM_UNK_02079FEC_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/pokemon.h b/include/pokemon.h new file mode 100644 index 0000000000..2909917856 --- /dev/null +++ b/include/pokemon.h @@ -0,0 +1,883 @@ +#ifndef POKEPLATINUM_UNK_02073C2C_H +#define POKEPLATINUM_UNK_02073C2C_H + +#include "struct_decls/struct_02002F38_decl.h" +#include "struct_decls/struct_02006C24_decl.h" +#include "struct_defs/struct_02007C10.h" +#include "struct_decls/struct_02007C7C_decl.h" +#include "struct_defs/struct_02008A90.h" +#include "struct_decls/struct_0200C6E4_decl.h" +#include "struct_decls/struct_0200C704_decl.h" +#include "struct_decls/struct_0200D0F4_decl.h" +#include "struct_decls/struct_02015F84_decl.h" +#include "struct_decls/struct_02025E6C_decl.h" +#include "struct_decls/struct_0202CC84_decl.h" +#include "struct_decls/struct_02078B40_decl.h" +#include "struct_decls/struct_party_decl.h" +#include "overlay005/struct_ov5_021DE5D0.h" + +#include + +/** + * @brief Pokemon Personal data structure. This contains data that is the same across all pokemon of the same species/form + */ +typedef struct PokemonPersonalData { + u8 baseHp; //!< The pokemons base HP stat + u8 baseAtk; //!< The pokemons base Attack stat + u8 baseDef; //!< The pokemons base Defense stat + u8 baseSpeed; //!< The pokemons base Speed stat + u8 baseSpAtk; //!< The pokemons base Special Attack stat + u8 baseSpDef; //!< The pokemons base Special Defense stat + u8 type1; //!< The pokemons first type + u8 type2; //!< The pokemons second type + u8 catchRate; //!< The pokemons catch rate + u8 baseExp; //!< A factor in determining experience yield when defeating this pokemon + u16 evHpYield : 2; //!< How many HP EVs will be gained when defeating this pokemon + u16 evAtkYield : 2; //!< How many Attack EVs will be gained when defeating this pokemon + u16 evDefYield : 2; //!< How many Defense EVs will be gained when defeating this pokemon + u16 evSpeedYield : 2; //!< How many Speed EVs will be gained when defeating this pokemon + u16 evSpAtkYield : 2; //!< How many Special Attack EVs will be gained when defeating this pokemon + u16 evSpDefYield : 2; //!< How many Special Defense EVs will be gained when defeating this pokemon + u16 padding : 4; + + u16 item1; //!< Common held item when this pokemon is encountered in the wild + u16 item2; //!< Rare held item when this pokemon is encountered in the wild + u8 gender; //!< The pokemons gender ratio, except for special values, a higher value will result in more females and a lower value will result in more males appearing + u8 hatchCycles; //!< How long eggs of this pokemon will take to hatch. In Gen.IV One cycle is 255 steps + u8 baseFriendship; //!< The pokemons base Friendship stat + u8 expRate; //!< The experience rate category of the pokemon. This sets which formula is used to determine the pokemons level based on its experience + u8 eggGroup1; //!< The pokemons first egg group + u8 eggGroup2; //!< The pokemons second egg group + u8 ability1; //!< The pokemons first possible ability + u8 ability2; //!< The pokemons second possible ability + u8 greatMarshFleeRate; //!< The pokemons base flee rate in the Great Marsh safari zone + u8 color : 7; //!< The pokemons color category + u8 inverse : 1; + u32 tmLearnsetMask1; //!< Bitflags for whether this pokemon can learn a TM (TM1 -> TM32) + u32 tmLearnsetMask2; //!< Bitflags for whether this pokemon can learn a TM (TM33 -> TM64) + u32 tmLearnsetMask3; //!< Bitflags for whether this pokemon can learn a TM (TM65 -> TM92, HM1 -> HM4) + u32 tmLearnsetMask4; //!< Bitflags for whether this pokemon can learn a TM (HM5 -> HM8, rest unused) +} PokemonPersonalData; + +/** + * @brief Block A of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockA { + u16 species; //!< The pokemons species + u16 heldItem; //!< The pokemons currently held item + u32 otID; //!< The pokemons Original Trainer ID + u32 exp; //!< The pokemons experience points + u8 friendship; //!< The pokemons friendship stat + u8 ability; //!< The pokemons ability + u8 unk_0E; + u8 originLanguage; //!< The language of the game this pokemon was caught in + u8 hpEV; //!< The pokemons HP EVs + u8 atkEV; //!< The pokemons Attack EVs + u8 defEV; //!< The pokemons Defense EVs + u8 speedEV; //!< The pokemons Speed EVs + u8 spAtkEV; //!< The pokemons Special Attack EVs + u8 spDefEV; //!< The pokemons Special Defense EVs + u8 cool; //!< The pokemons Cool contest stat + u8 beauty; //!< The pokemons Beauty contest stat + u8 cute; //!< The pokemons Cute contest stat + u8 smart; //!< The pokemons Smart contest stat + u8 tough; //!< The pokemons Tough contest stat + u8 sheen; //!< The pokemons Sheen + u32 unk_1C; +} PokemonDataBlockA; + +/** + * @brief Block B of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockB { + u16 moves[4]; //!< The ID of each move the pokemon knows + u8 moveCurrentPPs[4]; //!< The current PP of each move + u8 movePPUps[4]; //!< The number of PP Ups used on each move + u32 hpIV : 5; //!< The pokemons HP IVs + u32 atkIV : 5; //!< The pokemons Attack IVs + u32 defIV : 5; //!< The pokemons Defense IVs + u32 speedIV : 5; //!< The pokemons Speed IVs + u32 spAtkIV : 5; //!< The pokemons Special Attack IVs + u32 spDefIV : 5; //!< The pokemons Special Defense IVs + u32 isEgg : 1; //!< Whether this pokemon is an egg or not + u32 unk_10_31 : 1; + u32 unk_14; + u8 fatefulEncounter:1; //!< The pokemons "Fateful Encounter" flag + u8 gender : 2; //!< The pokemons gender + u8 form:5; //!< The pokemons form + u8 unk_19; + u16 unk_1A; + u16 unk_1C; + u16 unk_1E; +} PokemonDataBlockB; + +/** + * @brief Block C of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockC { + u16 unk_00[11]; + u8 unk_16; + u8 originGame; //!< The game this pokemon was caught in + u64 unk_18; +} PokemonDataBlockC; + +/** + * @brief Block D of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockD { + u16 unk_00[8]; + u8 unk_10; + u8 unk_11; + u8 unk_12; + u8 unk_13; + u8 unk_14; + u8 unk_15; + u16 unk_16; + u16 unk_18; + u8 pokerus; //!< The pokemons Pokerus value + u8 pokeball; //!< What pokeball this pokemon was caught in + u8 metLevel : 7; //!< What level this pokemon was originally met at + u8 otGender : 1; //!< The gender of this pokemons Original Trainer + u8 unk_1D; + u16 unk_1E; +} PokemonDataBlockD; + +typedef union { + PokemonDataBlockA blockA; + PokemonDataBlockB blockB; + PokemonDataBlockC blockC; + PokemonDataBlockD blockD; +} PokemonDataBlock; + +/** + * @brief Boxed Pokemon data structure + */ +typedef struct BoxPokemon { + u32 personality; //!< The personality value of the pokemon + u16 partyDecrypted : 1; //!< Whether the pokemons party data is currently decrypted + u16 boxDecrypted : 1; //!< Whether the pokemons boxed data is currently decrypted + u16 invalidData : 1; //!< Set if the pokemons data is invalid (failed checksum). This will make the mon appear as a Bad Egg in game + u16 unk_04_3 : 13; + u16 checksum; //!< Checksum for the pokemons data + PokemonDataBlock dataBlocks[4]; //!< Data blocks containing the pokemons boxed data, stored encrypted +} BoxPokemon; + +#include "struct_defs/struct_0202818C.h" +#include "struct_defs/struct_0202CA28.h" + +/** + * @brief Party Pokemon data structure + */ +typedef struct PartyPokemon { + u32 unk_00; + u8 level; //!< The pokemons level + u8 unk_05; + u16 unk_06; + u16 unk_08; + u16 unk_0A; + u16 unk_0C; + u16 unk_0E; + u16 unk_10; + u16 unk_12; + UnkStruct_0202818C unk_14; + UnkStruct_0202CA28 unk_4C; +} PartyPokemon; + +/** + * @brief The main Pokemon data structure + */ +typedef struct Pokemon { + BoxPokemon box; //!< Contains the pokemons boxed data + PartyPokemon party; //!< Contains the pokemons extra data while it is in the players party +} Pokemon; + +/** + * @brief Zeros out a Pokemon data structure, then encrypts the result + * + * @param mon + */ +void Pokemon_Init(Pokemon *mon); + +/** + * @brief Zeros out a BoxPokemon data structure, then encrypts the result + * + * @param boxMon + */ +void BoxPokemon_Init(BoxPokemon *boxMon); + +/** + * @brief Returns the size in bytes of a Pokemon struct as an int + * + * @return Size in bytes of a Pokemon struct + */ +int Pokemon_StructSize(void); + +/** + * @brief Allocates a Pokemon struct on the given heap, then calls ZeroMonData() on it + * + * @param heapID + * @return A new empty but encrypted Pokemon struct + */ +Pokemon *Pokemon_New(u32 heapID); + +/** + * @brief Decrypts a Pokemon data structure. PartyPokemon data is encrypted using the pokemons personality value, BoxPokemon data using a checksum value + * + * @param mon + * @return Whether the pokemons data was decrypted by this call. Passed to EncryptMon() to decide whether to reencrypt the data or not + */ +BOOL Pokemon_EnterDecryptionContext(Pokemon *mon); + +/** + * @brief Encrypts a Pokemon data structure. PartyPokemon data is encrypted using the pokemons personality value, BoxPokemon data using a checksum value + * + * @param mon + * @param encrypt Whether to encrypt the data or not. If this is false, the function does nothing and returns false. + * @return Whether the pokemons data was encrypted by this call. + */ +BOOL Pokemon_ExitDecryptionContext(Pokemon *mon, BOOL encrypt); + +/** + * @brief Decrypts a BoxPokemon data structure + * + * @param boxMon + * @return Whether the pokemons data was decrypted by this call. Passed to EncryptBoxMon() to decide whether to reencrypt the data or not + */ +BOOL BoxPokemon_EnterDecryptionContext(BoxPokemon *boxMon); + +/** + * @brief Encrypts a BoxPokemon data structure + * + * @param boxMon + * @param encrypt Whether to encrypt the data or not. If this is false, the function does nothing and returns false. + * @return Whether the pokemons data was encrypted by this call. + */ +BOOL BoxPokemon_ExitDecryptionContext(BoxPokemon *boxMon, BOOL encrypt); + +void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); +void sub_02074088(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); +u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2); +void sub_02074158(Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality); + +/** + * @brief Calculates and stores the current level and stats for a given Pokemon based on its IVs, EVs etc. + * + * @param mon + */ +void Pokemon_CalcLevelAndStats(Pokemon *mon); + +/** + * @brief Calculates and stores the current stats for a given Pokemon based on its IVs, EVs etc. + * + * @param mon + */ +void Pokemon_CalcStats(Pokemon *mon); + +/** + * @brief Gets a value from a Pokemon, storing it in dest if neccessary + * + * @param mon + * @param param + * @param[out] dest Pointer for storing longer data + * @return The requested value + */ +u32 Pokemon_GetValue(Pokemon *mon, enum PokemonDataParam param, void *dest); + +/** + * @brief Gets a value from a Pokemon, storing it in dest if neccessary + * + * @param boxMon + * @param param + * @param[out] dest Pointer for storing longer data + * @return The requested value + */ +u32 BoxPokemon_GetValue(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); + +/** + * @brief Sets a value in a Pokemon, reading it from value if neccessary + * + * @param mon + * @param param + * @param value + */ +void Pokemon_SetValue(Pokemon *mon, enum PokemonDataParam param, const void *value); + +/** + * @brief Sets a value in a BoxPokemon, reading it from value if neccessary + * + * @param boxMon + * @param param + * @param value + */ +void BoxPokemon_SetValue(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); + +/** + * @brief Increases some numerical fields in a Pokemon by the given value. Does nothing if the field is not supported + * + * @todo list of supported fields? + * + * @param mon + * @param param + * @param value + */ +void Pokemon_IncreaseValue(Pokemon *mon, enum PokemonDataParam param, int value); + +/** + * @brief Gets a PokemonPersonalData based on a pokemon species and form + * + * @param monSpecies + * @param monForm + * @param heapID The index of the heap that the PokemonPersonalData should be loaded into + * @return PokemonPersonalData* + */ +PokemonPersonalData *PokemonPersonalData_FromMonForm(int monSpecies, int monForm, int heapID); + +/** + * @brief Gets a PokemonPersonalData based on a pokemon species + * + * @param monSpecies + * @param heapID The index of the heap that the PokemonPersonalData should be loaded into + * @return PokemonPersonalData* + */ +PokemonPersonalData *PokemonPersonalData_FromMonSpecies(int monSpecies, int heapID); + +/** + * @brief Gets a value from a PokemonPersonalData structure + * + * @param monPersonalData + * @param param What value to get + * @return The requested value + */ +u32 PokemonPersonalData_GetValue(PokemonPersonalData *monPersonalData, enum PokemonPersonalDataParam param); + +/** + * @brief Frees a PokemonPersonalData structure from the heap + * + * @param monPersonalData + */ +void PokemonPersonalData_Free(PokemonPersonalData *monPersonalData); + +/** + * @brief Loads a PokemonPersonalData based on its species and form and gets a value from it + * + * @param monSpecies + * @param monForm + * @param param What value to get + * @return The requested value + */ +u32 PokemonPersonalData_GetFormValue(int monSpecies, int monForm, enum PokemonPersonalDataParam param); + +/** + * @brief Loads a PokemonPersonalData based on its species and gets a value from it + * + * @param monSpecies + * @param param What value to get + * @return The requested value + */ +u32 PokemonPersonalData_GetSpeciesValue(int monSpecies, enum PokemonPersonalDataParam param); + +/** + * @brief Gets how much progress a Pokemon has made towards its next level as a percentage + * + * @param mon + * @return how much progress a Pokemon has made towards its next level as a percentage + */ +u8 Pokemon_GetPercentToNextLevel(Pokemon *mon); + +/** + * @brief Gets how much experience is needed for the given Pokemon to level up + * + * @param boxMon + * @return The amount of exp. needed for the given Pokemon to level up + */ +u32 Pokemon_GetExpToNextLevel(Pokemon *mon); + +/** + * @brief Gets the amount of expeirence needed for the given Pokemon to reach its current level + * + * @param mon + * @return The amount of exp. needed for the given Pokemon to reach its current level + */ +u32 Pokemon_GetCurrentLevelBaseExp(Pokemon *mon); + +/** + * @brief Gets the amount of expeirence needed for a pokemon species to reach a specified level + * + * @param monSpecies + * @param monLevel + * @return The amount of exp. needed for the given pokemon species to reach the specified level + */ +u32 Pokemon_GetSpeciesBaseExpAt(int monSpecies, int monLevel); + +/** + * @copybrief GetMonSpeciesLevel() + * + * @param mon + * @return The pokemons level + */ +u32 Pokemon_GetLevel(Pokemon *mon); + +/** + * @copybrief GetMonSpeciesLevel() + * + * @param boxMon + * @return The pokemons level + */ +u32 BoxPokemon_GetLevel(BoxPokemon *boxMon); + +/** + * @brief Gets the level of a pokemon based on its species and exp + * + * @param monSpecies + * @param monExp + * @return The pokemons level + */ +u32 Pokemon_GetSpeciesLevelAt(u16 monSpecies, u32 monExp); + +/** + * @brief Gets the level of a pokemon based on its personal data and exp + * + * @param monPersonalData + * @param unused_monSpecies unused + * @param monExp + * @return The pokemons level + */ +u32 PokemonPersonalData_GetLevelAt(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp); + +/** + * @brief Gets the nature of a Pokemon based on its personality value + * + * @param mon + * @return The pokemons nature + */ +u8 Pokemon_GetNature(Pokemon *mon); + +/** + * @brief Gets the nature of a BoxPokemon based on its personality value + * + * @param boxMon + * @return The pokemons nature + */ +u8 BoxPokemon_GetNature(BoxPokemon *boxMon); + +/** + * @brief Gets the nature of a pokemon based on its personality value + * + * @param monPersonality + * @return The pokemons nature + */ +u8 Pokemon_GetNatureOf(u32 monPersonality); + +/** + * @brief Gets the affinitiy of a given pokemon nature to a given stat + * + * @param monNature + * @param statType + * @return 1 if stat is increased, -1 if stat is decreased, else 0 + */ +s8 Pokemon_GetStatAffinityOf(u8 monNature, u8 statType); + +void sub_02075C74(Pokemon *mon, u8 param1, u16 param2); + +/** + * @brief Gets the gender of a Pokemon based on its species and personality value + * + * @param boxMon + * @return The pokemons gender + */ +u8 Pokemon_GetGender(Pokemon *mon); + +/** + * @brief Gets the gender of a BoxPokemon based on its species and personality value + * + * @param boxMon + * @return The pokemons gender + */ +u8 BoxPokemon_GetGender(BoxPokemon *boxMon); + +/** + * @brief Gets the gender of a pokemon based on its species and personality value + * + * @param monSpecies + * @param monPersonality + * @return The pokemons gender + */ +u8 Pokemon_GetGenderOf(u16 monSpecies, u32 monPersonality); + +/** + * @brief Gets the gender of a pokemon based on its PokemonPersonalData and personality value + * + * @param monPersonalData + * @param unused_monSpecies unused + * @param monPersonality + * @return The pokemons gender + */ +u8 PokemonPersonalData_GetGenderOf(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality); + +/** + * @brief Gets whether a BoxPokemon is shiny based on its Original Trainer ID and its personality value + * + * @param mon + * @return Whether the pokemon is shiny or not + */ +u8 Pokemon_IsShiny(Pokemon *mon); + +/** + * @brief Gets whether a pokemon is shiny based on its Original Trainer ID and its personality value + * + * @param monOTID + * @param monPersonality + * @return Whether the pokemon is shiny or not + */ +u8 Pokemon_IsPersonalityShiny(u32 monOTID, u32 monPersonality); + +u32 sub_02075E64(u32 param0); +void sub_02075EF4(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); +void sub_02075F00(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); +void sub_02075F0C(UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, BOOL param3); +void sub_02075FB4(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); + +/** + * @brief Sanitizes a pokemon form. If the given form is greater than the max for the given species, returns zero, else returns the form unchanged + * + * @param monSpecies + * @param monForm + * @return The sanitized pokemon form + */ +u8 Pokemon_SanitizeFormId(u16 monSpecies, u8 monForm); + +u8 sub_020765AC(Pokemon *mon, u8 param1); +u8 sub_020765B8(Pokemon *mon, u8 param1); +u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, BOOL param2); +u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); +void sub_0207697C(UnkStruct_02008A90 *param0, u16 param1); +UnkStruct_0200D0F4 *sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID); +void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 *param2); + +/** + * @brief Returns the size in bytes of a Pokemon struct as a u32 + * + * @return Size in bytes of a Pokemon struct + */ +u32 Pokemon_GetStructSize(void); + +/** + * @brief Returns the size in bytes of a BoxPokemon struct as a u32 + * + * @return Size in bytes of a BoxPokemon struct + */ +u32 BoxPokemon_GetStructSize(void); + +/** + * @brief Gets the form of a Pokemon + * + * @param mon + * @return The pokemons form + */ +u8 Pokemon_GetForm(Pokemon *mon); + +/** + * @brief Gets the form of a BoxPokemon + * + * @param boxMon + * @return The pokemons form + */ +u8 BoxPokemon_GetForm(BoxPokemon *boxMon); + +/** + * @brief Gets the BoxPokemon data for a given Pokemon + * + * @param mon + * @return The BoxPokemon data for a given Pokemon + */ +BoxPokemon *Pokemon_GetBoxPokemon(Pokemon *mon); + +BOOL sub_02076B14(Pokemon *mon); +u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult); +u16 sub_02076F84(const u16 monSpecies); +u16 sub_02076FD4(const u16 monSpecies); + +/** + * @brief Adds a move to the moveset of a Pokemon + * + * @param mon + * @param moveID + * @return The given moveID if successful, 0xfffe if already known, 0xffff if there is no room for the move + */ +u16 Pokemon_AddMove(Pokemon *mon, u16 moveID); + +/** + * @brief Deletes the first move of a Pokemon and adds the given move to the end of its moveset + * + * @param mon + * @param moveID + */ +void Pokemon_ReplaceMove(Pokemon *mon, u16 moveID); + +/** + * @brief Sets the given moveSlot of a Pokemon, removing its PP Ups + * + * @param mon + * @param moveID + * @param moveSlot + */ +void Pokemon_ResetMoveSlot(Pokemon *mon, u16 moveID, u8 moveSlot); + +/** + * @brief Sets the given moveSlot of a Pokemon, retaining the PP Ups for that slot + * + * @param mon + * @param moveID + * @param moveSlot + */ +void Pokemon_SetMoveSlot(Pokemon *mon, u16 moveID, u8 moveSlot); + +u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID); + +/** + * @brief Swaps the places of two moves on a Pokemon + * + * @param mon + * @param moveSlot1 + * @param moveSlot2 + */ +void Pokemon_SwapMoveSlots(Pokemon *mon, int moveSlot1, int moveSlot2); + +/** + * @brief Swaps the places of two moves on a BoxPokemon + * + * @param boxMon + * @param moveSlot1 + * @param moveSlot2 + */ +void BoxPokemon_SwapMoveSlots(BoxPokemon *boxMon, int moveSlot1, int moveSlot2); + +/** + * @brief Deletes the given moveSlot of a Pokemon, shifting the ones above it down + * + * @param mon + * @param moveSlot + */ +void Pokemon_ClearMoveSlot(Pokemon *mon, u32 moveSlot); + +void Pokemon_FromBoxPokemon(BoxPokemon *boxMon, Pokemon *mon); + +/** + * @brief Gets the level of the highest level pokemon in the Party + * + * @param party + * @return The level of the highest level pokemon in the Party + */ +u8 Party_GetMaxLevel(Party *party); + +u16 sub_020775A4(u16 param0); +u16 sub_020775C4(u16 param0); +void Pokemon_Copy(Pokemon *src, Pokemon *dest); +void BoxPokemon_Copy(BoxPokemon *src, BoxPokemon *dest); +void BoxPokemon_FromPokemon(Pokemon *src, BoxPokemon *dest); + +/** + * @brief Gets the affinitiy of a given Pokemon to a given flavor + * + * @param mon + * @param flavor + * @return 1 if liked flavor, -1 if disliked flavor, else 0 + */ +s8 Pokemon_GetFlavorAffinity(Pokemon *mon, int flavor); + +/** + * @brief Gets the affinitiy of a given Pokemon personality to a given flavor + * + * @param monPersonality + * @param flavor + * @return 1 if liked flavor, -1 if disliked flavor, else 0 + */ +s8 Pokemon_GetFlavorAffinityOf(u32 monPersonality, int flavor); + +/** + * @brief Gets all moves that the given pokemon species and form can learn by leveling up + * + * @param monSpecies + * @param monForm + * @param[out] monLevelUpMoveIDs Pointer to a u16 array for storing the level up moves + * @return int + */ +int Pokemon_LoadLevelUpMoveIdsOf(int monSpecies, int monForm, u16 *monLevelUpMoveIDs); + +void sub_020776B0(Party *party); +u8 sub_02077758(Party *party, u8 param1); +void sub_020777B4(Party *party, s32 param1); +void sub_0207782C(Party *party); +BOOL sub_020778D8(Pokemon *mon); +BOOL sub_020778F8(Pokemon *mon); + +/** + * @brief Sets Arceus' form based on its held item. Has no effect if the given Pokemon is not an Arceus + * + * @param mon + */ +void Pokemon_SetArceusForm(Pokemon *mon); + +/** + * @brief Sets Arceus' form based on its held item. Has no effect if the given Pokemon is not an Arceus + * + * @param boxMon + */ +void BoxPokemon_SetArceusForm(BoxPokemon *boxMon); + +/** + * @brief Get Arceus' form given an items hold effect + * + * @param itemHoldEffect + * @return The form arceus should be in + */ +u8 Pokemon_GetArceusTypeOf(u16 itemHoldEffect); + +/** + * @brief Sets Giratina's form based on its held item. Has no effect if the given Pokemon is not a Giratina + * + * @param mon + * @return The form Giratina was set to, or -1 if the given BoxPokemon was not a Giratina + */ +int Pokemon_SetGiratinaForm(Pokemon *mon); + +/** + * @brief Sets Giratina's form based on its held item. Has no effect if the given BoxPokemon is not a Giratina + * + * @param boxMon + * @return The form Giratina was set to, or -1 if the given BoxPokemon was not a Giratina + */ +int BoxPokemon_SetGiratinaForm(BoxPokemon *boxMon); + +/** + * @brief Set Giratina to its Origin form. Has no effect if the given Pokemon is not a Giratina + * + * @param mon + */ +void Pokemon_SetGiratinaOriginForm(Pokemon *mon); + +/** + * @brief Iterates over all the Pokemon in Party, setting the form of any Giratina. + * If param1 is 1, always sets Giratina into Origin form, otherwise its form is based on held item + * + * @param party + * @param param1 + */ +void Party_SetGiratinaForm(Party *party, int param1); + +/** + * @brief Sets Shaymin to the given form. Has no effect if the given Pokemon is not a Shaymin + * + * @param mon + * @param monForm + */ +void Pokemon_SetShayminForm(Pokemon *mon, int monForm); + +/** + * @brief Sets Shaymin to the given form. Has no effect if the given BoxPokemon is not a Shaymin + * + * @param boxMon + * @param monForm + */ +void BoxPokemon_SetShayminForm(BoxPokemon *boxMon, int monForm); + +/** + * @brief Checks whether Shaymin is allowed to change into Sky Form. Always returns false if the given Pokemon is not a Shaymin + * + * @param mon + * @return Whether Shaymin is allowed to change into Sky Form + */ +BOOL Pokemon_CanShayminSkyForm(Pokemon *mon); + +/** + * @brief Iterates over all the Pokemon in Party, setting the form of any Shaymin to land form. + * + * @param party + */ +void Party_SetShayminLandForm(Party *party); + +/** + * @brief Sets all Shaymin in the party to Land form at night + * + * @todo Verify this, seems correct but not sure what param1 does to the calculation here (time zone offset?) + * + * @param party + * @param param1 + * @param rtcTime + * @return Whether Shaymin should be set to Land form + */ +BOOL Party_SetShayminForm(Party *party, int param1, const RTCTime *rtcTime); + +/** + * @brief Sets Rotom to the given form. Has no effect if the given Pokemon is not a Rotom + * If Rotom should learn a form specific move and there is no room, overwrites moveSlot with the new move + * + * @param mon + * @param monForm + * @param moveSlot + * @return Whether the given pokemon was a Rotom + */ +BOOL Pokemon_SetRotomForm(Pokemon *mon, int monForm, int moveSlot); + +/** + * @brief Loads a Level-Up move table based on a pokemon species and form into the pointed to array + * + * @param monSpecies + * @param monForm + * @param[out] monLevelUpMoves Pointer to a u16 array to store the move table + */ +void Pokemon_LoadLevelUpMovesOf(int monSpecies, int monForm, u16 *monLevelUpMoves); + +void sub_02077D3C(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); +void sub_02077DB4(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8); +BOOL sub_02077E3C(Pokemon *mon); +void sub_02077E64(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077F0C(Pokemon *mon, u32 param1, int param2); +BOOL Pokemon_CanLearnTM(Pokemon *mon, u8 tmID); +BOOL Pokemon_CanFormLearnTM(u16 monSpecies, int monForm, u8 tmID); + +/** + * @brief Sets the ability of a Pokemon based on its species, form and peronsality value + * + * @param mon + */ +void Pokemon_CalcAbility(Pokemon *mon); + +void sub_020780C4(Pokemon *mon, u32 monPersonality); + +/** + * @brief Gets a bitmask with a single bit set at the specified index. + * + * @param index + * @return A bitmask with a single bit set at the specified index. + */ +u32 Pokemon_GetFlagMaskOf(int index); + +/** + * @brief Gets the index of the lowest set bit of the given number + * + * @param num + * @return The index of the lowest set bit of the given number + */ +int Pokemon_GetLowestFlagIndex(u32 num); + +BOOL sub_02078804(u16 param0); +u16 sub_02078824(u8 index); +BOOL sub_02078838(Pokemon *mon); +BOOL sub_0207884C(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID); +int sub_020788D0(int param0); +void sub_0207893C(Pokemon *mon); +void sub_0207896C(BoxPokemon *boxMon); +void sub_020789BC(NARC *narc, UnkStruct_02007C10 *param1, u16 param2, u16 param3); +void sub_020789F4(NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *param2, u16 param3, int param4, int param5, int param6); +void sub_02078A4C(NARC *narc, u8 *param1, u16 param2, u16 param3); +void sub_02078A80(NARC *narc, s8 *param1, u16 param2); +void sub_02078AA4(NARC *narc, s8 *param1, u16 param2); +void sub_02078AC8(NARC *narc, u8 *param1, u16 param2); +BOOL sub_02078AEC(int param0, Pokemon *mon, int heapID); +void sub_02078B40(Pokemon *mon, UnkStruct_02078B40 *param1); +void sub_02078E0C(UnkStruct_02078B40 *param0, Pokemon *mon); + +#endif // POKEPLATINUM_UNK_02073C2C_H diff --git a/include/struct_decls/party_pokemon.h b/include/struct_decls/party_pokemon.h deleted file mode 100644 index 22a6e3a479..0000000000 --- a/include/struct_decls/party_pokemon.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_PARTY_POKEMON_DECL_H -#define POKEPLATINUM_PARTY_POKEMON_DECL_H - -typedef struct PartyPokemon_t PartyPokemon; - -#endif // POKEPLATINUM_PARTY_POKEMON_DECL_H diff --git a/include/struct_decls/struct_02075874_decl.h b/include/struct_decls/struct_02075874_decl.h deleted file mode 100644 index 316e92eddd..0000000000 --- a/include/struct_decls/struct_02075874_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02075874_DECL_H -#define POKEPLATINUM_STRUCT_02075874_DECL_H - -typedef struct UnkStruct_02075874_t UnkStruct_02075874; - -#endif // POKEPLATINUM_STRUCT_02075874_DECL_H diff --git a/include/struct_decls/struct_0207821C_decl.h b/include/struct_decls/struct_0207821C_decl.h deleted file mode 100644 index c4d6d0d24b..0000000000 --- a/include/struct_decls/struct_0207821C_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_DECL_H -#define POKEPLATINUM_STRUCT_0207821C_DECL_H - -typedef struct UnkStruct_0207821C_t UnkStruct_0207821C; - -#endif // POKEPLATINUM_STRUCT_0207821C_DECL_H diff --git a/include/struct_decls/struct_0207821C_sub1_decl.h b/include/struct_decls/struct_0207821C_sub1_decl.h deleted file mode 100644 index cdeca7ca8e..0000000000 --- a/include/struct_decls/struct_0207821C_sub1_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_SUB1_DECL_H -#define POKEPLATINUM_STRUCT_0207821C_SUB1_DECL_H - -typedef struct UnkStruct_0207821C_sub1_t UnkStruct_0207821C_sub1; - -#endif // POKEPLATINUM_STRUCT_0207821C_SUB1_DECL_H diff --git a/include/struct_defs/box_pokemon.h b/include/struct_defs/box_pokemon.h deleted file mode 100644 index 8eb698a3bb..0000000000 --- a/include/struct_defs/box_pokemon.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef POKEPLATINUM_BOX_POKEMON_H -#define POKEPLATINUM_BOX_POKEMON_H - -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" -#include "struct_defs/pokemon_substruct_0.h" - -typedef struct { - u32 unk_00; - u16 unk_04_0 : 1; - u16 unk_04_1 : 1; - u16 unk_04_2 : 1; - u16 unk_04_3 : 13; - u16 unk_06; - u8 unk_08[sizeof(PokemonSubstruct0) - + sizeof(PokemonSubstruct1) - + sizeof(PokemonSubstruct2) - + sizeof(PokemonSubstruct3)]; -} BoxPokemon; - -#endif // POKEPLATINUM_BOX_POKEMON_H diff --git a/include/struct_defs/party_pokemon.h b/include/struct_defs/party_pokemon.h deleted file mode 100644 index 3bfe7ce770..0000000000 --- a/include/struct_defs/party_pokemon.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef POKEPLATINUM_PARTY_POKEMON_DATA_T_H -#define POKEPLATINUM_PARTY_POKEMON_DATA_T_H - -#include "struct_defs/struct_0202818C.h" -#include "struct_defs/struct_0202CA28.h" - -struct PartyPokemon_t { - u32 unk_00; - u8 unk_04; - u8 unk_05; - u16 unk_06; - u16 unk_08; - u16 unk_0A; - u16 unk_0C; - u16 unk_0E; - u16 unk_10; - u16 unk_12; - UnkStruct_0202818C unk_14; - UnkStruct_0202CA28 unk_4C; -}; - -#endif // POKEPLATINUM_PARTY_POKEMON_DATA_T_H diff --git a/include/struct_defs/pokemon.h b/include/struct_defs/pokemon.h deleted file mode 100644 index 87342992d3..0000000000 --- a/include/struct_defs/pokemon.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_POKEMON_H -#define POKEPLATINUM_STRUCT_POKEMON_H - -#include "struct_defs/box_pokemon.h" -#include "struct_decls/party_pokemon.h" -#include "struct_defs/party_pokemon.h" - -typedef struct { - BoxPokemon box; - PartyPokemon party; -} Pokemon; - -#endif // POKEPLATINUM_STRUCT_POKEMON_H diff --git a/include/struct_defs/pokemon_substruct_0.h b/include/struct_defs/pokemon_substruct_0.h deleted file mode 100644 index ec2cf75f23..0000000000 --- a/include/struct_defs/pokemon_substruct_0.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_0_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_0_H - -typedef struct PokemonSubstruct0_t { - u16 species; - u16 item; - u32 unk_04; - u32 unk_08; - u8 friendship; - u8 unk_0D; - u8 unk_0E; - u8 unk_0F; - u8 unk_10; - u8 unk_11; - u8 unk_12; - u8 unk_13; - u8 unk_14; - u8 unk_15; - u8 unk_16; - u8 unk_17; - u8 unk_18; - u8 unk_19; - u8 unk_1A; - u8 unk_1B; - u32 unk_1C; -} PokemonSubstruct0; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_0_H diff --git a/include/struct_defs/pokemon_substruct_1.h b/include/struct_defs/pokemon_substruct_1.h deleted file mode 100644 index fc44f07dbe..0000000000 --- a/include/struct_defs/pokemon_substruct_1.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_1_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_1_H - -typedef struct PokemonSubstruct1_t { - u16 unk_00[4]; - u8 unk_08[4]; - u8 unk_0C[4]; - u32 unk_10_0 : 5; - u32 unk_10_5 : 5; - u32 unk_10_10 : 5; - u32 unk_10_15 : 5; - u32 unk_10_20 : 5; - u32 unk_10_25 : 5; - u32 unk_10_30 : 1; - u32 unk_10_31 : 1; - u32 unk_14; - u8 fatefulEncounter:1; - u8 unk_18_1 : 2; - u8 form:5; - u8 unk_19; - u16 unk_1A; - u16 unk_1C; - u16 unk_1E; -} PokemonSubstruct1; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_1_H diff --git a/include/struct_defs/pokemon_substruct_2.h b/include/struct_defs/pokemon_substruct_2.h deleted file mode 100644 index e4d18d0398..0000000000 --- a/include/struct_defs/pokemon_substruct_2.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_2_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_2_H - -typedef struct PokemonSubstruct2_t { - u16 unk_00[11]; - u8 unk_16; - u8 unk_17; - u64 unk_18; -} PokemonSubstruct2; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_2_H diff --git a/include/struct_defs/pokemon_substruct_3.h b/include/struct_defs/pokemon_substruct_3.h deleted file mode 100644 index 726c0cba09..0000000000 --- a/include/struct_defs/pokemon_substruct_3.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_3_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_3_H - -typedef struct PokemonSubstruct3_t { - u16 unk_00[8]; - u8 unk_10; - u8 unk_11; - u8 unk_12; - u8 unk_13; - u8 unk_14; - u8 unk_15; - u16 unk_16; - u16 unk_18; - u8 unk_1A; - u8 unk_1B; - u8 unk_1C_0 : 7; - u8 unk_1C_7 : 1; - u8 unk_1D; - u16 unk_1E; -} PokemonSubstruct3; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_3_H diff --git a/include/struct_defs/struct_020298D8.h b/include/struct_defs/struct_020298D8.h index 470a8d1bf4..a22bc76f83 100644 --- a/include/struct_defs/struct_020298D8.h +++ b/include/struct_defs/struct_020298D8.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02007C7C_decl.h" #include "struct_defs/union_02022594_020225E0.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay022/struct_ov22_022596B0.h" typedef struct { diff --git a/include/struct_defs/struct_0203DA00.h b/include/struct_defs/struct_0203DA00.h index 0c29abe7cd..1abf04a29a 100644 --- a/include/struct_defs/struct_0203DA00.h +++ b/include/struct_defs/struct_0203DA00.h @@ -6,7 +6,7 @@ #include "struct_decls/struct_02029C68_decl.h" #include "struct_decls/struct_02029D04_decl.h" #include "struct_decls/struct_0202CD88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_0203E2FC.h b/include/struct_defs/struct_0203E2FC.h index 085556b266..82d73255c1 100644 --- a/include/struct_defs/struct_0203E2FC.h +++ b/include/struct_defs/struct_0203E2FC.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_020711C8.h b/include/struct_defs/struct_020711C8.h index c81175b72f..4b08ff50d2 100644 --- a/include/struct_defs/struct_020711C8.h +++ b/include/struct_defs/struct_020711C8.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_020711C8_H #define POKEPLATINUM_STRUCT_020711C8_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_02075874.h b/include/struct_defs/struct_02075874.h deleted file mode 100644 index 1483a45efb..0000000000 --- a/include/struct_defs/struct_02075874.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02075874_H -#define POKEPLATINUM_STRUCT_02075874_H - -typedef struct UnkStruct_02075874_t { - u8 unk_00; - u8 unk_01; - u8 unk_02; - u8 unk_03; - u8 unk_04; - u8 unk_05; - u8 unk_06; - u8 unk_07; - u8 unk_08; - u8 unk_09; - u16 unk_0A_0 : 2; - u16 unk_0A_2 : 2; - u16 unk_0A_4 : 2; - u16 unk_0A_6 : 2; - u16 unk_0A_8 : 2; - u16 unk_0A_10 : 2; - u16 unk_0A_12 : 4; - u16 unk_0C; - u16 unk_0E; - u8 unk_10; - u8 unk_11; - u8 unk_12; - u8 unk_13; - u8 unk_14; - u8 unk_15; - u8 unk_16; - u8 unk_17; - u8 unk_18; - u8 unk_19_0 : 7; - u8 unk_19_7 : 1; - u32 unk_1C; - u32 unk_20; - u32 unk_24; - u32 unk_28; -} UnkStruct_02075874; - -#endif // POKEPLATINUM_STRUCT_02075874_H diff --git a/include/struct_defs/struct_0207821C.h b/include/struct_defs/struct_0207821C.h deleted file mode 100644 index c2152ade38..0000000000 --- a/include/struct_defs/struct_0207821C.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_H -#define POKEPLATINUM_STRUCT_0207821C_H - -#include "struct_defs/struct_0207821C_sub1.h" - -typedef struct UnkStruct_0207821C_t { - UnkStruct_0207821C_sub1 unk_00[7]; -} UnkStruct_0207821C; - -#endif // POKEPLATINUM_STRUCT_0207821C_H diff --git a/include/struct_defs/struct_0207821C_sub1.h b/include/struct_defs/struct_0207821C_sub1.h deleted file mode 100644 index 0667b23b59..0000000000 --- a/include/struct_defs/struct_0207821C_sub1.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_SUB1_H -#define POKEPLATINUM_STRUCT_0207821C_SUB1_H - -typedef struct UnkStruct_0207821C_sub1_t { - u16 unk_00; - u16 unk_02; - u16 unk_04; -} UnkStruct_0207821C_sub1; - -#endif // POKEPLATINUM_STRUCT_0207821C_SUB1_H diff --git a/include/struct_defs/struct_0207825C.h b/include/struct_defs/struct_0207825C.h deleted file mode 100644 index 0706391a7c..0000000000 --- a/include/struct_defs/struct_0207825C.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_H -#define POKEPLATINUM_STRUCT_0207825C_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C; - -#endif // POKEPLATINUM_STRUCT_0207825C_H diff --git a/include/struct_defs/struct_0207825C_1.h b/include/struct_defs/struct_0207825C_1.h deleted file mode 100644 index 4652ed3da2..0000000000 --- a/include/struct_defs/struct_0207825C_1.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_1_H -#define POKEPLATINUM_STRUCT_0207825C_1_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_1_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_1; - -#endif // POKEPLATINUM_STRUCT_0207825C_1_H diff --git a/include/struct_defs/struct_0207825C_10.h b/include/struct_defs/struct_0207825C_10.h deleted file mode 100644 index 923b95d896..0000000000 --- a/include/struct_defs/struct_0207825C_10.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_10_H -#define POKEPLATINUM_STRUCT_0207825C_10_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_10_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_10; - -#endif // POKEPLATINUM_STRUCT_0207825C_10_H diff --git a/include/struct_defs/struct_0207825C_11.h b/include/struct_defs/struct_0207825C_11.h deleted file mode 100644 index 98e1c25bdb..0000000000 --- a/include/struct_defs/struct_0207825C_11.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_11_H -#define POKEPLATINUM_STRUCT_0207825C_11_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_11_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_11; - -#endif // POKEPLATINUM_STRUCT_0207825C_11_H diff --git a/include/struct_defs/struct_0207825C_12.h b/include/struct_defs/struct_0207825C_12.h deleted file mode 100644 index 623c3881b4..0000000000 --- a/include/struct_defs/struct_0207825C_12.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_12_H -#define POKEPLATINUM_STRUCT_0207825C_12_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_12_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_12; - -#endif // POKEPLATINUM_STRUCT_0207825C_12_H diff --git a/include/struct_defs/struct_0207825C_13.h b/include/struct_defs/struct_0207825C_13.h deleted file mode 100644 index 6409bb316b..0000000000 --- a/include/struct_defs/struct_0207825C_13.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_13_H -#define POKEPLATINUM_STRUCT_0207825C_13_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_13_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_13; - -#endif // POKEPLATINUM_STRUCT_0207825C_13_H diff --git a/include/struct_defs/struct_0207825C_14.h b/include/struct_defs/struct_0207825C_14.h deleted file mode 100644 index d869f5348b..0000000000 --- a/include/struct_defs/struct_0207825C_14.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_14_H -#define POKEPLATINUM_STRUCT_0207825C_14_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_14_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_14; - -#endif // POKEPLATINUM_STRUCT_0207825C_14_H diff --git a/include/struct_defs/struct_0207825C_15.h b/include/struct_defs/struct_0207825C_15.h deleted file mode 100644 index 019984e9e9..0000000000 --- a/include/struct_defs/struct_0207825C_15.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_15_H -#define POKEPLATINUM_STRUCT_0207825C_15_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_15_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_15; - -#endif // POKEPLATINUM_STRUCT_0207825C_15_H diff --git a/include/struct_defs/struct_0207825C_16.h b/include/struct_defs/struct_0207825C_16.h deleted file mode 100644 index 7909704194..0000000000 --- a/include/struct_defs/struct_0207825C_16.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_16_H -#define POKEPLATINUM_STRUCT_0207825C_16_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_16_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_16; - -#endif // POKEPLATINUM_STRUCT_0207825C_16_H diff --git a/include/struct_defs/struct_0207825C_17.h b/include/struct_defs/struct_0207825C_17.h deleted file mode 100644 index 56aa5df332..0000000000 --- a/include/struct_defs/struct_0207825C_17.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_17_H -#define POKEPLATINUM_STRUCT_0207825C_17_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_17_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_17; - -#endif // POKEPLATINUM_STRUCT_0207825C_17_H diff --git a/include/struct_defs/struct_0207825C_18.h b/include/struct_defs/struct_0207825C_18.h deleted file mode 100644 index 0f25713c27..0000000000 --- a/include/struct_defs/struct_0207825C_18.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_18_H -#define POKEPLATINUM_STRUCT_0207825C_18_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_18_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_18; - -#endif // POKEPLATINUM_STRUCT_0207825C_18_H diff --git a/include/struct_defs/struct_0207825C_19.h b/include/struct_defs/struct_0207825C_19.h deleted file mode 100644 index 934782fcbc..0000000000 --- a/include/struct_defs/struct_0207825C_19.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_19_H -#define POKEPLATINUM_STRUCT_0207825C_19_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_19_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_19; - -#endif // POKEPLATINUM_STRUCT_0207825C_19_H diff --git a/include/struct_defs/struct_0207825C_2.h b/include/struct_defs/struct_0207825C_2.h deleted file mode 100644 index 838613f005..0000000000 --- a/include/struct_defs/struct_0207825C_2.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_2_H -#define POKEPLATINUM_STRUCT_0207825C_2_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_2_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_2; - -#endif // POKEPLATINUM_STRUCT_0207825C_2_H diff --git a/include/struct_defs/struct_0207825C_20.h b/include/struct_defs/struct_0207825C_20.h deleted file mode 100644 index 2af3a3223e..0000000000 --- a/include/struct_defs/struct_0207825C_20.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_20_H -#define POKEPLATINUM_STRUCT_0207825C_20_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_20_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_20; - -#endif // POKEPLATINUM_STRUCT_0207825C_20_H diff --git a/include/struct_defs/struct_0207825C_21.h b/include/struct_defs/struct_0207825C_21.h deleted file mode 100644 index 51de00b106..0000000000 --- a/include/struct_defs/struct_0207825C_21.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_21_H -#define POKEPLATINUM_STRUCT_0207825C_21_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_21_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_21; - -#endif // POKEPLATINUM_STRUCT_0207825C_21_H diff --git a/include/struct_defs/struct_0207825C_22.h b/include/struct_defs/struct_0207825C_22.h deleted file mode 100644 index 2a5816fbd0..0000000000 --- a/include/struct_defs/struct_0207825C_22.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_22_H -#define POKEPLATINUM_STRUCT_0207825C_22_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_22_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_22; - -#endif // POKEPLATINUM_STRUCT_0207825C_22_H diff --git a/include/struct_defs/struct_0207825C_23.h b/include/struct_defs/struct_0207825C_23.h deleted file mode 100644 index f6bba521dd..0000000000 --- a/include/struct_defs/struct_0207825C_23.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_23_H -#define POKEPLATINUM_STRUCT_0207825C_23_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_23_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_23; - -#endif // POKEPLATINUM_STRUCT_0207825C_23_H diff --git a/include/struct_defs/struct_0207825C_3.h b/include/struct_defs/struct_0207825C_3.h deleted file mode 100644 index f5dca58b52..0000000000 --- a/include/struct_defs/struct_0207825C_3.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_3_H -#define POKEPLATINUM_STRUCT_0207825C_3_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_3_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_3; - -#endif // POKEPLATINUM_STRUCT_0207825C_3_H diff --git a/include/struct_defs/struct_0207825C_4.h b/include/struct_defs/struct_0207825C_4.h deleted file mode 100644 index 038516c437..0000000000 --- a/include/struct_defs/struct_0207825C_4.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_4_H -#define POKEPLATINUM_STRUCT_0207825C_4_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_4_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_4; - -#endif // POKEPLATINUM_STRUCT_0207825C_4_H diff --git a/include/struct_defs/struct_0207825C_5.h b/include/struct_defs/struct_0207825C_5.h deleted file mode 100644 index 505d4ce7ac..0000000000 --- a/include/struct_defs/struct_0207825C_5.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_5_H -#define POKEPLATINUM_STRUCT_0207825C_5_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_5_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_5; - -#endif // POKEPLATINUM_STRUCT_0207825C_5_H diff --git a/include/struct_defs/struct_0207825C_6.h b/include/struct_defs/struct_0207825C_6.h deleted file mode 100644 index 8ee784725c..0000000000 --- a/include/struct_defs/struct_0207825C_6.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_6_H -#define POKEPLATINUM_STRUCT_0207825C_6_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_6_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_6; - -#endif // POKEPLATINUM_STRUCT_0207825C_6_H diff --git a/include/struct_defs/struct_0207825C_7.h b/include/struct_defs/struct_0207825C_7.h deleted file mode 100644 index 5367910557..0000000000 --- a/include/struct_defs/struct_0207825C_7.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_7_H -#define POKEPLATINUM_STRUCT_0207825C_7_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_7_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_7; - -#endif // POKEPLATINUM_STRUCT_0207825C_7_H diff --git a/include/struct_defs/struct_0207825C_8.h b/include/struct_defs/struct_0207825C_8.h deleted file mode 100644 index 5c50dbeef7..0000000000 --- a/include/struct_defs/struct_0207825C_8.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_8_H -#define POKEPLATINUM_STRUCT_0207825C_8_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_8_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_8; - -#endif // POKEPLATINUM_STRUCT_0207825C_8_H diff --git a/include/struct_defs/struct_0207825C_9.h b/include/struct_defs/struct_0207825C_9.h deleted file mode 100644 index f178803410..0000000000 --- a/include/struct_defs/struct_0207825C_9.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_9_H -#define POKEPLATINUM_STRUCT_0207825C_9_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_9_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_9; - -#endif // POKEPLATINUM_STRUCT_0207825C_9_H diff --git a/include/struct_defs/struct_02078B40.h b/include/struct_defs/struct_02078B40.h index 590adea3f9..d9993eb4a6 100644 --- a/include/struct_defs/struct_02078B40.h +++ b/include/struct_defs/struct_02078B40.h @@ -2,43 +2,43 @@ #define POKEPLATINUM_STRUCT_02078B40_H typedef struct UnkStruct_02078B40_t { - u32 unk_00; - u16 unk_04_0 : 1; - u16 unk_04_1 : 1; - u16 unk_04_2 : 1; + u32 personality; + u16 partyDecrypted : 1; + u16 boxDecrypted : 1; + u16 invalidData : 1; u16 : 13; - u16 unk_06; - u16 unk_08; - u32 unk_0C; - u32 unk_10; - u8 unk_14; - u8 unk_15; - u8 unk_16; - u8 unk_17; - u8 unk_18; - u8 unk_19; - u8 unk_1A; - u8 unk_1B; + u16 species; + u16 heldItem; + u32 otID; + u32 exp; + u8 friendship; + u8 ability; + u8 hpEV; + u8 atkEV; + u8 defEV; + u8 speedEV; + u8 spAtkEV; + u8 spDefEV; u16 unk_1C[4]; u8 unk_24[4]; u8 unk_28[4]; - u32 unk_2C_0 : 5; - u32 unk_2C_5 : 5; - u32 unk_2C_10 : 5; - u32 unk_2C_15 : 5; - u32 unk_2C_20 : 5; - u32 unk_2C_25 : 5; - u32 unk_2C_30 : 1; + u32 hpIV : 5; + u32 atkIV : 5; + u32 defIV : 5; + u32 speedIV : 5; + u32 spAtkIV : 5; + u32 spDefIV : 5; + u32 isEgg : 1; u32 unk_2C_31 : 1; - u8 unk_30_0 : 1; - u8 unk_30_1 : 2; - u8 unk_30_3 : 5; + u8 fatefulEncounter : 1; + u8 gender : 2; + u8 form : 5; u16 unk_32[11]; u16 unk_48[8]; - u8 unk_58; - u8 unk_59; + u8 pokeball; + u8 originLanguage; u32 unk_5C; - u8 unk_60; + u8 level; u8 unk_61; u16 unk_62; u16 unk_64; diff --git a/include/struct_defs/struct_0207AE68_t.h b/include/struct_defs/struct_0207AE68_t.h index 616bf70eb4..a16f458888 100644 --- a/include/struct_defs/struct_0207AE68_t.h +++ b/include/struct_defs/struct_0207AE68_t.h @@ -16,7 +16,7 @@ #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_02056B24_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0207C690.h" #include "struct_defs/struct_0207C8C4.h" diff --git a/include/struct_defs/struct_02090800.h b/include/struct_defs/struct_02090800.h index 07a8cd04c2..e3317b8381 100644 --- a/include/struct_defs/struct_02090800.h +++ b/include/struct_defs/struct_02090800.h @@ -3,7 +3,7 @@ #include "message.h" #include "struct_decls/struct_0200B358_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02090800_sub1.h" typedef struct { diff --git a/include/struct_defs/struct_02093800.h b/include/struct_defs/struct_02093800.h index 415923f0ba..b6ccd5489a 100644 --- a/include/struct_defs/struct_02093800.h +++ b/include/struct_defs/struct_02093800.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202A750_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" typedef struct { diff --git a/include/struct_defs/struct_02093BBC.h b/include/struct_defs/struct_02093BBC.h index 5f74591078..312f00c6db 100644 --- a/include/struct_defs/struct_02093BBC.h +++ b/include/struct_defs/struct_02093BBC.h @@ -5,7 +5,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_02029C88_decl.h" #include "struct_decls/struct_02029D04_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02095C60.h" typedef struct { diff --git a/include/struct_defs/struct_02095C48.h b/include/struct_defs/struct_02095C48.h index e9bc446193..9b977d4776 100644 --- a/include/struct_defs/struct_02095C48.h +++ b/include/struct_defs/struct_02095C48.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202A750_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_02094A58.h" #include "struct_defs/struct_02095C48_sub1.h" diff --git a/include/struct_defs/struct_02095C48_sub1.h b/include/struct_defs/struct_02095C48_sub1.h index be2ef96b0e..346d179876 100644 --- a/include/struct_defs/struct_02095C48_sub1.h +++ b/include/struct_defs/struct_02095C48_sub1.h @@ -3,7 +3,7 @@ #include "strbuf.h" #include "struct_decls/struct_02029C88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020954F0.h" #include "struct_defs/struct_02095C48_sub1_sub1.h" #include "overlay006/struct_ov6_02248BE8.h" diff --git a/include/struct_defs/struct_02097F18.h b/include/struct_defs/struct_02097F18.h index a4e21caf26..2a391df0fb 100644 --- a/include/struct_defs/struct_02097F18.h +++ b/include/struct_defs/struct_02097F18.h @@ -3,7 +3,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202CA1C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/struct_defs/struct_02098DE8.h b/include/struct_defs/struct_02098DE8.h index 66667a6f78..88262e40e3 100644 --- a/include/struct_defs/struct_02098DE8.h +++ b/include/struct_defs/struct_02098DE8.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_STRUCT_02098DE8_H #include "struct_defs/struct_0202A93C.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_020997B8.h b/include/struct_defs/struct_020997B8.h index 877324ca63..a9749bf510 100644 --- a/include/struct_defs/struct_020997B8.h +++ b/include/struct_defs/struct_020997B8.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_party.h b/include/struct_defs/struct_party.h index b4093e81b2..ef7cb32a90 100644 --- a/include/struct_defs/struct_party.h +++ b/include/struct_defs/struct_party.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_PARTY_H #define POKEPLATINUM_STRUCT_PARTY_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct Party { int capacity; diff --git a/include/unk_0200B358.h b/include/unk_0200B358.h index 3fd6c07471..1eec557bb4 100644 --- a/include/unk_0200B358.h +++ b/include/unk_0200B358.h @@ -4,7 +4,7 @@ #include "struct_decls/struct_0200B358_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_defs/trainer_data.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_0200DA60.h b/include/unk_0200DA60.h index 15a64875f7..b5a34b267e 100644 --- a/include/unk_0200DA60.h +++ b/include/unk_0200DA60.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" void sub_0200DA60(UnkStruct_02018340 * param0, u8 param1, u16 param2, u8 param3, u32 param4); u32 sub_0200DAA0(void); diff --git a/include/unk_0201D15C.h b/include/unk_0201D15C.h index fb74f74113..fb22c6c177 100644 --- a/include/unk_0201D15C.h +++ b/include/unk_0201D15C.h @@ -12,18 +12,18 @@ u16 sub_0201D278(u16 param0); u16 sub_0201D2A4(u16 param0); fx32 sub_0201D2B8(fx32 param0); fx32 sub_0201D2C4(fx32 param0); -u32 sub_0201D2D0(void); -void sub_0201D2DC(u32 param0); -u16 sub_0201D2E8(void); -u32 sub_0201D30C(u32 param0); -void sub_0201D318(u32 param0); -u32 sub_0201D35C(void); +u32 LCRNG_GetSeed(void); +void LCRNG_SetSeed(u32 seed); +u16 LCRNG_Next(void); +u32 ARNG_Next(u32 seed); +void MTRNG_SetSeed(u32 seed); +u32 MTRNG_Next(void); void sub_0201D470(MtxFx22 * param0, u16 param1, fx32 param2, fx32 param3, u8 param4); s32 sub_0201D4CC(s32 param0, s32 param1, s32 param2, s32 param3, u32 param4); s32 sub_0201D580(u16 param0, s32 param1); u32 sub_0201D5B8(const void * param0, u32 param1); -void sub_0201D5D4(void * param0, u32 param1, u32 param2); -void sub_0201D600(void * param0, u32 param1, u32 param2); +void EncryptData(void *data, u32 bytes, u32 seed); +void DecryptData(void *data, u32 bytes, u32 seed); u16 sub_0201D628(const void * param0, u32 param1); void sub_0201D640(int param0); diff --git a/include/unk_020261E4.h b/include/unk_020261E4.h index 6d66d04c1e..a1d641cc49 100644 --- a/include/unk_020261E4.h +++ b/include/unk_020261E4.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_02026224_decl.h" #include "struct_decls/struct_02026310_decl.h" #include "struct_defs/struct_0202818C.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" int sub_020261E4(void); diff --git a/include/unk_0202631C.h b/include/unk_0202631C.h index 10bb710a97..1207d7265b 100644 --- a/include/unk_0202631C.h +++ b/include/unk_0202631C.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_0202631C_H #include "struct_decls/struct_02026324_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" int sub_0202631C(void); diff --git a/include/unk_020298BC.h b/include/unk_020298BC.h index 3c56b27799..71deb4e282 100644 --- a/include/unk_020298BC.h +++ b/include/unk_020298BC.h @@ -9,7 +9,7 @@ #include "struct_decls/struct_0202A138_decl.h" #include "struct_decls/struct_0202A150_decl.h" #include "struct_decls/struct_0202A750_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay022/struct_ov22_02255040.h" #include "overlay061/struct_ov61_0222AE80.h" diff --git a/include/unk_0202DA40.h b/include/unk_0202DA40.h index 365c7f4ff7..f17d723b75 100644 --- a/include/unk_0202DA40.h +++ b/include/unk_0202DA40.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_0202DA40_H #include "struct_decls/struct_0202DA40_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" UnkStruct_0202DA40 * sub_0202DA40(UnkStruct_021C0794 * param0); diff --git a/include/unk_0202EEC0.h b/include/unk_0202EEC0.h index a263fe76a9..e730c6c799 100644 --- a/include/unk_0202EEC0.h +++ b/include/unk_0202EEC0.h @@ -2,8 +2,7 @@ #define POKEPLATINUM_UNK_0202EEC0_H #include "struct_decls/struct_02024440_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" int sub_0202EEC0(void); void sub_0202EEC8(UnkStruct_02024440 * param0); diff --git a/include/unk_0202F180.h b/include/unk_0202F180.h index 283b1db0ac..2a9466b47d 100644 --- a/include/unk_0202F180.h +++ b/include/unk_0202F180.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_0202F180_H #define POKEPLATINUM_UNK_0202F180_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" void sub_0202F180(UnkStruct_021C0794 * param0, const Pokemon * param1); diff --git a/include/unk_0203D1B8.h b/include/unk_0203D1B8.h index bb1cbaa2ff..00ef8de24f 100644 --- a/include/unk_0203D1B8.h +++ b/include/unk_0203D1B8.h @@ -13,7 +13,7 @@ #include "struct_defs/struct_020684D0.h" #include "struct_decls/struct_02070950_decl.h" #include "struct_defs/struct_02072014.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_0209747C_decl.h" #include "struct_defs/struct_02097728.h" #include "struct_defs/struct_02098C44.h" diff --git a/include/unk_02051D8C.h b/include/unk_02051D8C.h index 831189010e..817cdbe638 100644 --- a/include/unk_02051D8C.h +++ b/include/unk_02051D8C.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_0202B628_decl.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_0203CDB0_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207D99C_decl.h" #include "struct_defs/struct_0209C370.h" diff --git a/include/unk_02054884.h b/include/unk_02054884.h index 1ca58dc971..714b5a61f2 100644 --- a/include/unk_02054884.h +++ b/include/unk_02054884.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_02054884_H #define POKEPLATINUM_UNK_02054884_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_02056720.h b/include/unk_02056720.h index b87489e168..33e51773e8 100644 --- a/include/unk_02056720.h +++ b/include/unk_02056720.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_02056720_H #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" int sub_02056720(void); diff --git a/include/unk_0206CCB0.h b/include/unk_0206CCB0.h index e4b7a5b776..f9422c80b2 100644 --- a/include/unk_0206CCB0.h +++ b/include/unk_0206CCB0.h @@ -6,7 +6,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203CDB0_decl.h" #include "struct_decls/struct_0206D140_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay006/struct_ov6_022465F4_decl.h" diff --git a/include/unk_0207064C.h b/include/unk_0207064C.h index 0ade37cfbb..ecb4dd2b29 100644 --- a/include/unk_0207064C.h +++ b/include/unk_0207064C.h @@ -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 * sub_0207064C(u32 param0, UnkStruct_0203CDB0 * param1, Pokemon * param2, u16 param3, s16 param4, s16 param5); BOOL sub_02070680(UnkStruct_020508D4 * param0); diff --git a/include/unk_02073C2C.h b/include/unk_02073C2C.h deleted file mode 100644 index 3212350b37..0000000000 --- a/include/unk_02073C2C.h +++ /dev/null @@ -1,173 +0,0 @@ -#ifndef POKEPLATINUM_UNK_02073C2C_H -#define POKEPLATINUM_UNK_02073C2C_H - -#include "struct_decls/struct_02002F38_decl.h" -#include "struct_decls/struct_02006C24_decl.h" -#include "struct_defs/struct_02007C10.h" -#include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/struct_02008A90.h" -#include "struct_decls/struct_0200C6E4_decl.h" -#include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_0200D0F4_decl.h" -#include "struct_decls/struct_02015F84_decl.h" -#include "struct_decls/struct_02025E6C_decl.h" -#include "struct_decls/struct_0202CC84_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" -#include "struct_decls/struct_02075874_decl.h" -#include "struct_decls/struct_02078B40_decl.h" -#include "struct_decls/struct_party_decl.h" -#include "overlay005/struct_ov5_021DE5D0.h" - -#include - -void ZeroMonData(Pokemon * param0); -void ZeroBoxMonData(BoxPokemon * param0); -int PokemonStructSize(void); -Pokemon * AllocMonZeroed(u32 heapID); -BOOL sub_02073C88(Pokemon * param0); -BOOL sub_02073CD4(Pokemon * param0, BOOL param1); -BOOL sub_02073D20(BoxPokemon * param0); -BOOL sub_02073D48(BoxPokemon * param0, BOOL param1); -void sub_02073D80(Pokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7); -void sub_02073E18(BoxPokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7); -void sub_02074044(Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4); -void sub_02074088(Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u8 param6); -u32 sub_02074128(u16 param0, u8 param1, u8 param2); -void sub_02074158(Pokemon * param0, u16 param1, u8 param2, u32 param3, u32 param4); -void sub_0207418C(Pokemon * param0); -void sub_020741B8(Pokemon * param0); -u32 GetMonData(Pokemon * param0, int param1, void * param2); -u32 sub_02074570(BoxPokemon * param0, int param1, void * param2); -void sub_02074B30(Pokemon * param0, int param1, const void * param2); -void SetBoxMonData(BoxPokemon * param0, int param1, const void * param2); -void sub_0207536C(Pokemon * param0, int param1, int param2); -UnkStruct_02075874 * sub_02075874(int param0, int param1, int param2); -UnkStruct_02075874 * sub_02075894(int param0, int param1); -u32 sub_020758B0(UnkStruct_02075874 * param0, int param1); -void sub_020759B8(UnkStruct_02075874 * param0); -u32 sub_020759CC(int param0, int param1, int param2); -u32 sub_020759F0(int param0, int param1); -u8 sub_02075A10(Pokemon * param0); -u32 sub_02075A70(Pokemon * param0); -u32 sub_02075A78(BoxPokemon * param0); -u32 sub_02075AAC(Pokemon * param0); -u32 sub_02075AD0(int param0, int param1); -u32 sub_02075B38(Pokemon * param0); -u32 sub_02075B40(BoxPokemon * param0); -u32 sub_02075B78(u16 param0, u32 param1); -u32 sub_02075B9C(UnkStruct_02075874 * param0, u16 param1, u32 param2); -u8 sub_02075BCC(Pokemon * param0); -u8 sub_02075BD4(BoxPokemon * param0); -u8 GetNatureFromPersonality(u32 param0); -s8 sub_02075C60(u8 param0, u8 param1); -void sub_02075C74(Pokemon * param0, u8 param1, u16 param2); -u8 sub_02075D6C(Pokemon * param0); -u8 sub_02075D74(BoxPokemon * param0); -u8 sub_02075DAC(u16 param0, u32 param1); -u8 sub_02075DD0(UnkStruct_02075874 * param0, u16 param1, u32 param2); -u8 sub_02075E0C(Pokemon * param0); -u8 sub_02075E14(BoxPokemon * param0); -u8 sub_02075E38(u32 param0, u32 param1); -u32 sub_02075E64(u32 param0); -void sub_02075EF4(UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2); -void sub_02075F00(UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2); -void sub_02075F0C(UnkStruct_02008A90 * param0, BoxPokemon * param1, u8 param2, int param3); -void sub_02075FB4(UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6); -u8 SanitizeFormId(u16 param0, u8 param1); -u8 sub_020765AC(Pokemon * param0, u8 param1); -u8 sub_020765B8(Pokemon * param0, u8 param1); -u8 sub_020765C4(BoxPokemon * param0, u8 param1, int param2); -u8 sub_02076648(u16 param0, u8 param1, u8 param2, u8 param3, u32 param4); -void sub_0207697C(UnkStruct_02008A90 * param0, u16 param1); -UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int param8); -void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 * param2); -u32 sub_02076AF0(void); -u32 sub_02076AF4(void); -u8 sub_02076AF8(Pokemon * param0); -u8 sub_02076B00(BoxPokemon * param0); -BoxPokemon * sub_02076B10(Pokemon * param0); -u8 sub_02076B14(Pokemon * param0); -u16 sub_02076B94(Party * param0, Pokemon * param1, u8 param2, u16 param3, int * param4); -u16 sub_02076F84(const u16 param0); -u16 sub_02076FD4(const u16 param0); -void sub_02077020(BoxPokemon * param0); -u16 sub_020770C4(Pokemon * param0, u16 param1); -u16 sub_020770D4(BoxPokemon * param0, u16 param1); -void sub_02077134(Pokemon * param0, u16 param1); -void sub_02077144(BoxPokemon * param0, u16 param1); -void sub_020771F8(Pokemon * param0, u16 param1, u8 param2); -void sub_02077230(Pokemon * param0, u16 param1, u8 param2); -void sub_02077238(BoxPokemon * param0, u16 param1, u8 param2); -u16 sub_0207727C(Pokemon * param0, int * param1, u16 * param2); -void sub_02077344(Pokemon * param0, int param1, int param2); -void sub_0207734C(BoxPokemon * param0, int param1, int param2); -void sub_02077408(Pokemon * param0, u32 param1); -BOOL sub_0207749C(Pokemon * param0, u16 param1); -void sub_020774C8(BoxPokemon * param0, Pokemon * param1); -u8 sub_02077550(Party * param0); -u16 sub_020775A4(u16 param0); -u16 sub_020775C4(u16 param0); -void sub_020775EC(Pokemon * param0, Pokemon * param1); -void sub_02077604(BoxPokemon * param0, BoxPokemon * param1); -void sub_02077618(Pokemon * param0, BoxPokemon * param1); -s8 sub_0207762C(Pokemon * param0, int param1); -s8 sub_02077634(BoxPokemon * param0, int param1); -s8 sub_02077648(u32 param0, int param1); -int sub_02077660(int param0, int param1, u16 * param2); -void sub_020776B0(Party * param0); -u8 sub_02077758(Party * param0, u8 param1); -void sub_020777B4(Party * param0, s32 param1); -void sub_0207782C(Party * param0); -BOOL sub_020778D8(Pokemon * param0); -BOOL sub_020778E0(BoxPokemon * param0); -BOOL sub_020778F8(Pokemon * param0); -BOOL sub_02077900(BoxPokemon * param0); -void sub_02077928(Pokemon * param0); -void sub_02077930(BoxPokemon * param0); -u8 sub_02077988(u16 param0); -int sub_02077A00(Pokemon * param0); -int sub_02077A1C(BoxPokemon * param0); -void sub_02077A64(Pokemon * param0); -void sub_02077A9C(Party * param0, int param1); -void SetShayminForm(Pokemon * param0, int param1); -void SetBoxShayminForm(BoxPokemon * param0, int param1); -BOOL sub_02077B14(Pokemon * param0); -void sub_02077B8C(Party * param0); -BOOL sub_02077BD8(Party * param0, int param1, const RTCTime * param2); -BOOL SetRotomForm(Pokemon * param0, int param1, int param2); -void sub_02077D28(int param0, int param1, u16 * param2); -void sub_02077D3C(UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7); -void sub_02077DB4(UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7, u8 param8); -BOOL sub_02077E3C(Pokemon * param0); -void sub_02077E64(Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EA4(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EE4(Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EF8(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077F0C(Pokemon * param0, u32 param1, int param2); -BOOL sub_02077FB4(Pokemon * param0, u8 param1); -BOOL sub_02077FBC(BoxPokemon * param0, u8 param1); -BOOL sub_02077FE4(u16 param0, int param1, u8 param2); -void sub_0207803C(Pokemon * param0); -void sub_02078044(BoxPokemon * param0); -void sub_020780C4(Pokemon * param0, u32 param1); -u32 FlagIndex(int flag); -int sub_020787EC(u32 param0); -BOOL sub_02078804(u16 param0); -u16 sub_02078824(u8 param0); -BOOL sub_02078838(Pokemon * param0); -BOOL sub_0207884C(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2); -int sub_020788D0(int param0); -void sub_0207893C(Pokemon * param0); -void sub_0207896C(BoxPokemon * param0); -void sub_020789BC(NARC * param0, UnkStruct_02007C10 * param1, u16 param2, u16 param3); -void sub_020789F4(NARC * param0, UnkStruct_02015F84 * param1, UnkStruct_02007C7C * param2, u16 param3, int param4, int param5, int param6); -void sub_02078A4C(NARC * param0, u8 * param1, u16 param2, u16 param3); -void sub_02078A80(NARC * param0, s8 * param1, u16 param2); -void sub_02078AA4(NARC * param0, s8 * param1, u16 param2); -void sub_02078AC8(NARC * param0, u8 * param1, u16 param2); -BOOL sub_02078AEC(int param0, Pokemon * param1, int param2); -void sub_02078B40(Pokemon * param0, UnkStruct_02078B40 * param1); -void sub_02078E0C(UnkStruct_02078B40 * param0, Pokemon * param1); - -#endif // POKEPLATINUM_UNK_02073C2C_H diff --git a/include/unk_020797C8.h b/include/unk_020797C8.h index 7f4cadb620..9c2e1283e3 100644 --- a/include/unk_020797C8.h +++ b/include/unk_020797C8.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_020797C8_H #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" void sub_020797C8(UnkStruct_020797DC * param0); diff --git a/include/unk_02079D40.h b/include/unk_02079D40.h index 5d4122e5e5..a03f2148b4 100644 --- a/include/unk_02079D40.h +++ b/include/unk_02079D40.h @@ -1,8 +1,7 @@ #ifndef POKEPLATINUM_UNK_02079D40_H #define POKEPLATINUM_UNK_02079D40_H -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" u32 sub_02079D40(const BoxPokemon * param0); u32 sub_02079D80(Pokemon * param0); diff --git a/include/unk_0207A2A8.h b/include/unk_0207A2A8.h index 798fd42b8b..061a7732d0 100644 --- a/include/unk_0207A2A8.h +++ b/include/unk_0207A2A8.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_0207A2A8_H #include "struct_defs/struct_0202610C.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_02098700_decl.h" diff --git a/include/unk_0207AE68.h b/include/unk_0207AE68.h index 2cadaea0b8..fea8803d55 100644 --- a/include/unk_0207AE68.h +++ b/include/unk_0207AE68.h @@ -5,7 +5,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" diff --git a/include/unk_020819DC.h b/include/unk_020819DC.h index 585039f55f..d11864531d 100644 --- a/include/unk_020819DC.h +++ b/include/unk_020819DC.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_020819DC_H #define POKEPLATINUM_UNK_020819DC_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207F248.h" void sub_02081A24(UnkStruct_0207F248 * param0); diff --git a/include/unk_02084B70.h b/include/unk_02084B70.h index 8ba68caa6b..75e5d05f9e 100644 --- a/include/unk_02084B70.h +++ b/include/unk_02084B70.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_02084B70_H #define POKEPLATINUM_UNK_02084B70_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207F248.h" void sub_020852B8(UnkStruct_0207F248 * param0); diff --git a/include/unk_0208C324.h b/include/unk_0208C324.h index 8456ef9ab2..e35d1675fd 100644 --- a/include/unk_0208C324.h +++ b/include/unk_0208C324.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_0208C324_H #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0208D7BC.h" #include "struct_defs/struct_02098D38.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_02092494.h b/include/unk_02092494.h index bd379fd93d..e79e4f8688 100644 --- a/include/unk_02092494.h +++ b/include/unk_02092494.h @@ -2,8 +2,7 @@ #define POKEPLATINUM_UNK_02092494_H #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02090800.h" UnkStruct_02090800 * sub_02092494(Pokemon * param0, BOOL param1, int param2); diff --git a/include/unk_02094EDC.h b/include/unk_02094EDC.h index 953934fde4..ad99689ce7 100644 --- a/include/unk_02094EDC.h +++ b/include/unk_02094EDC.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02095C48.h" #include "overlay006/struct_ov6_02248BE8.h" #include "overlay016/struct_ov16_0223E0C8.h" diff --git a/include/unk_02096420.h b/include/unk_02096420.h index 7c5a9abbc5..509e9c43e1 100644 --- a/include/unk_02096420.h +++ b/include/unk_02096420.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_02096420_H #define POKEPLATINUM_UNK_02096420_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" u8 sub_02096420(Pokemon * param0, u16 param1, u16 param2, u32 param3); diff --git a/include/unk_02097624.h b/include/unk_02097624.h index e4c94eaa1e..c997203ae9 100644 --- a/include/unk_02097624.h +++ b/include/unk_02097624.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_02097624_H #include "struct_decls/struct_02028430_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02097728.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_02097B18.h b/include/unk_02097B18.h index 23be22f88e..11ebe4e557 100644 --- a/include/unk_02097B18.h +++ b/include/unk_02097B18.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_02097B18_H #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02097F18.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_020989DC.h b/include/unk_020989DC.h index 4d7eb0890d..aacdf27f60 100644 --- a/include/unk_020989DC.h +++ b/include/unk_020989DC.h @@ -3,7 +3,7 @@ #include "struct_defs/struct_0202A93C.h" #include "struct_defs/struct_0203D9B8.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "enums.h" diff --git a/include/unk_020997B8.h b/include/unk_020997B8.h index d1c73cbea5..08d94c5512 100644 --- a/include/unk_020997B8.h +++ b/include/unk_020997B8.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_020997B8_H #define POKEPLATINUM_UNK_020997B8_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020997B8.h" UnkStruct_020997B8 * sub_020997B8(u32 param0); diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index 50d95045a4..5e670a0cb6 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -287,7 +287,7 @@ Static main Object main.nef.p/src_unk_020722AC.c.o Object main.nef.p/src_unk_02073700.c.o Object main.nef.p/src_unk_02073838.c.o - Object main.nef.p/src_unk_02073C2C.c.o + Object main.nef.p/src_pokemon.c.o Object main.nef.p/src_move_table.c.o Object main.nef.p/src_unk_02079170.c.o Object main.nef.p/src_unk_020797C8.c.o diff --git a/src/enc_effects.c b/src/enc_effects.c index c01717fdb5..a472dc1b62 100644 --- a/src/enc_effects.c +++ b/src/enc_effects.c @@ -7,14 +7,14 @@ #include "constants/species.h" #include "constants/trainer.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay006/battle_params.h" #include "enc_effects.h" #include "unk_02054884.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay005/ov5_021DDBE8.h" // This needs to be moved to a constants file somewhere @@ -285,7 +285,7 @@ static u32 EncEffects_WildPokemonEffect (Party *wildParty, int mapHeaderID) u32 result = ENCEFF_NORMAL_WILD; Pokemon *wildPokemon = Party_FirstBattler(wildParty); - u32 wildSpecies = GetMonData(wildPokemon, MON_DATA_SPECIES, NULL); + u32 wildSpecies = Pokemon_GetValue(wildPokemon, MON_DATA_SPECIES, NULL); switch (wildSpecies) { case SPECIES_SHAYMIN: diff --git a/src/main.c b/src/main.c index a2849d42f4..7f560ad6d3 100644 --- a/src/main.c +++ b/src/main.c @@ -323,8 +323,8 @@ void sub_02001028 (void) v2 = v0.year + v0.month * 0x100 * v0.day * 0x10000 + v1.hour * 0x10000 + (v1.minute + v1.second) * 0x1000000 + Unk_021BF67C.unk_2C; - sub_0201D318(v2); - sub_0201D2DC(v2); + MTRNG_SetSeed(v2); + LCRNG_SetSeed(v2); } void sub_0200106C (void) diff --git a/src/meson.build b/src/meson.build index 1c16cd03dc..0e2fd68d10 100644 --- a/src/meson.build +++ b/src/meson.build @@ -274,7 +274,7 @@ pokeplatinum_c = files( 'unk_020722AC.c', 'unk_02073700.c', 'unk_02073838.c', - 'unk_02073C2C.c', + 'pokemon.c', 'unk_02079170.c', 'unk_020797C8.c', 'unk_02079D40.c', diff --git a/src/overlay005/ov5_021D1C30.c b/src/overlay005/ov5_021D1C30.c index 7dde76e012..197b9be617 100644 --- a/src/overlay005/ov5_021D1C30.c +++ b/src/overlay005/ov5_021D1C30.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_0203A790_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0203A55C.h" @@ -55,7 +55,7 @@ #include "unk_0206A8DC.h" #include "unk_0206AFE0.h" #include "unk_02071B10.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay005/ov5_021D1C30.h" #include "overlay005/ov5_021DB888.h" diff --git a/src/overlay005/ov5_021D5EB8.c b/src/overlay005/ov5_021D5EB8.c index 1cac6fafb6..5e24fa5a52 100644 --- a/src/overlay005/ov5_021D5EB8.c +++ b/src/overlay005/ov5_021D5EB8.c @@ -2240,7 +2240,7 @@ static void ov5_021D78A4 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v3 = (s32 *)v1->unk_08; - v6 = sub_0201D35C(); + v6 = MTRNG_Next(); v3[0] = 0; v4 = v6 % 3; @@ -2289,7 +2289,7 @@ static void ov5_021D7960 (UnkStruct_ov5_021D6FA8 * param0) v2[0] += 2; if (v2[0] > v2[1]) { - if ((sub_0201D35C() % 10) < 7) { + if ((MTRNG_Next() % 10) < 7) { v2[3] = 2; } else { v2[3] = 1; @@ -2442,7 +2442,7 @@ static void ov5_021D7C40 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v4 = (s32 *)v2->unk_08; - v5 = sub_0201D35C() % 4; + v5 = MTRNG_Next() % 4; sub_02021E50(v2->unk_04, v5); @@ -2451,7 +2451,7 @@ static void ov5_021D7C40 (UnkStruct_ov5_021DB4B8 * param0, int param1) v4[6] = 0; v4[8] = 0; - v1 = sub_0201D35C(); + v1 = MTRNG_Next(); v4[9] = 4 + (v1 % 60); @@ -2461,17 +2461,17 @@ static void ov5_021D7C40 (UnkStruct_ov5_021DB4B8 * param0, int param1) v4[1] = -1; } - v4[2] = 4 + (sub_0201D35C() % 2); - v4[3] = 1 + (sub_0201D35C() % 2); + v4[2] = 4 + (MTRNG_Next() % 2); + v4[3] = 1 + (MTRNG_Next() % 2); v4[0] = (s32) & v3->unk_B4[1]; v4[7] = (s32) & v3->unk_B4[2]; - v6.x = (-32 + (sub_0201D35C() % 414)) << FX32_SHIFT; + v6.x = (-32 + (MTRNG_Next() % 414)) << FX32_SHIFT; if ((v3->unk_B4[1] == 1) && (v0 >= (param1 / 2))) { - v6.y = (-40 - (sub_0201D35C() % 20)) << FX32_SHIFT; + v6.y = (-40 - (MTRNG_Next() % 20)) << FX32_SHIFT; } else { - v6.y = (-8 - (sub_0201D35C() % 20)) << FX32_SHIFT; + v6.y = (-8 - (MTRNG_Next() % 20)) << FX32_SHIFT; } ov5_021D630C(v2->unk_04, &v6); @@ -2682,7 +2682,7 @@ static void ov5_021D8098 (UnkStruct_ov5_021DB4B8 * param0, int param1) v4[5] = v5[v2]; v4[0] = 0; - v4[1] = 4 + (sub_0201D35C() % (46 - 4)); + v4[1] = 4 + (MTRNG_Next() % (46 - 4)); v7 = (v4[1] - 4) / (((46 - 4) / 3) + 1); sub_02021E50(v1->unk_04, v7); @@ -2694,7 +2694,7 @@ static void ov5_021D8098 (UnkStruct_ov5_021DB4B8 * param0, int param1) { VecFx32 v8 = ov5_021D7010(v1); - v8.x = -20 + (v7 * 20) + (sub_0201D35C() % 420); + v8.x = -20 + (v7 * 20) + (MTRNG_Next() % 420); v8.y = -8; v8.z = 0; v8.x <<= FX32_SHIFT; @@ -3214,7 +3214,7 @@ static void ov5_021D8B88 (UnkStruct_ov5_021DB4B8 * param0, int param1) v5 = v1->unk_08; v5[0] = 0; - v5[1] = 15 + (sub_0201D35C() % (35 - 15)); + v5[1] = 15 + (MTRNG_Next() % (35 - 15)); v6 = 3 - ((v5[1] - 15) / (((35 - 15) / 4) + 1)); @@ -3223,7 +3223,7 @@ static void ov5_021D8B88 (UnkStruct_ov5_021DB4B8 * param0, int param1) v5[3] = 0; v5[5] = v7[v2]; - v3 = sub_0201D35C() % 1000; + v3 = MTRNG_Next() % 1000; if (v3 == 777) { v6 = 4; @@ -3236,9 +3236,9 @@ static void ov5_021D8B88 (UnkStruct_ov5_021DB4B8 * param0, int param1) VecFx32 v9; v9 = ov5_021D7010(v1); - v9.x = 262 + (sub_0201D35C() % 24); + v9.x = 262 + (MTRNG_Next() % 24); v9.x <<= FX32_SHIFT; - v9.y = -64 + (sub_0201D35C() % 192); + v9.y = -64 + (MTRNG_Next() % 192); v9.y <<= FX32_SHIFT; ov5_021D630C(v1->unk_04, &v9); @@ -3545,8 +3545,8 @@ static void ov5_021D92C4 (UnkStruct_ov5_021DB4B8 * param0, int param1) v4 = (s32 *)v1->unk_08; v4[0] = 0; - v4[1] = 18 + (sub_0201D35C() % (24 - 18)); - v5 = sub_0201D35C() % 4; + v4[1] = 18 + (MTRNG_Next() % (24 - 18)); + v5 = MTRNG_Next() % 4; sub_02021E50(v1->unk_04, v5); @@ -3564,8 +3564,8 @@ static void ov5_021D92C4 (UnkStruct_ov5_021DB4B8 * param0, int param1) { VecFx32 v6 = ov5_021D7010(v1); - v6.x = 256 + (sub_0201D35C() % 24); - v6.y = -32 + (sub_0201D35C() % 168); + v6.x = 256 + (MTRNG_Next() % 24); + v6.y = -32 + (MTRNG_Next() % 168); v6.x <<= FX32_SHIFT; v6.y <<= FX32_SHIFT; v6.z = 0; @@ -3722,9 +3722,9 @@ static void ov5_021D9690 (UnkStruct_ov5_021DB4B8 * param0, int param1) v7 = (s32 *)v1->unk_08; v7[0] = 0; - v7[1] = 7 + (sub_0201D35C() % 5); + v7[1] = 7 + (MTRNG_Next() % 5); - v2 = sub_0201D35C() % 1000; + v2 = MTRNG_Next() % 1000; if ((v2 % 2) == 0) { v7[2] = 1; @@ -3733,15 +3733,15 @@ static void ov5_021D9690 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v7[3] = 1; - v7[4] = 3 + (sub_0201D35C() % 6); - v7[5] = 4 + (sub_0201D35C() % 5); + v7[4] = 3 + (MTRNG_Next() % 6); + v7[5] = 4 + (MTRNG_Next() % 5); - v5 = sub_0201D35C() % 0x14; + v5 = MTRNG_Next() % 0x14; { v6 = ov5_021D7010(v1); - v6.x = -64 + (sub_0201D35C() % 384); - v6.y = -8 + (sub_0201D35C() % 256); + v6.x = -64 + (MTRNG_Next() % 384); + v6.y = -8 + (MTRNG_Next() % 256); v6.x <<= FX32_SHIFT; v6.y <<= FX32_SHIFT; v6.z = 0; @@ -3757,15 +3757,15 @@ static void ov5_021D9690 (UnkStruct_ov5_021DB4B8 * param0, int param1) if (v2 < 0) { v2 *= -1; - v4 = v3 - (sub_0201D35C() % v2); + v4 = v3 - (MTRNG_Next() % v2); } else { - v4 = v3 + (sub_0201D35C() % v2); + v4 = v3 + (MTRNG_Next() % v2); } if ((v3 <= v6.y) && (v4 >= v6.y)) { v7[1] *= 2; } else { - v5 = sub_0201D35C() % 4; + v5 = MTRNG_Next() % 4; } sub_02021E50(v1->unk_04, v5); @@ -3824,8 +3824,8 @@ static void ov5_021D97E8 (UnkStruct_0201CD38 * param0, void * param1) ov5_021D64E4(v2[1], 16); if (v2[1] >= 10) { - v2[2] = 10 + (sub_0201D35C() % 20); - v2[3] = 5 + (sub_0201D35C() % 3); + v2[2] = 10 + (MTRNG_Next() % 20); + v2[3] = 5 + (MTRNG_Next() % 3); v2[4] = 1; v0->unk_BA2 = 3; } @@ -3838,8 +3838,8 @@ static void ov5_021D97E8 (UnkStruct_0201CD38 * param0, void * param1) G2_SetBG2Offset(0, 32); ov5_021D64E4(v2[1], 16); - v2[2] = 10 + (sub_0201D35C() % 20); - v2[3] = 5 + (sub_0201D35C() % 3); + v2[2] = 10 + (MTRNG_Next() % 20); + v2[3] = 5 + (MTRNG_Next() % 3); v2[4] = 1; v0->unk_BA2 = 3; @@ -3854,16 +3854,16 @@ static void ov5_021D97E8 (UnkStruct_0201CD38 * param0, void * param1) v2[1]--; if (v2[1] <= v2[3]) { - v2[2] = 10 + (sub_0201D35C() % 15); - v2[3] = 7 + (sub_0201D35C() % 3); + v2[2] = 10 + (MTRNG_Next() % 15); + v2[3] = 7 + (MTRNG_Next() % 3); v2[4] = 0; } } else { v2[1]++; if (v2[1] >= v2[3]) { - v2[2] = 10 + (sub_0201D35C() % 20); - v2[3] = 5 + (sub_0201D35C() % 3); + v2[2] = 10 + (MTRNG_Next() % 20); + v2[3] = 5 + (MTRNG_Next() % 3); v2[4] = 1; } } @@ -4283,7 +4283,7 @@ static void ov5_021DA0A8 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v3 = (s32 *)v1->unk_08; - v8 = sub_0201D35C(); + v8 = MTRNG_Next(); v3[0] = 0; v6 = v8 % 3; @@ -4326,7 +4326,7 @@ static void ov5_021DA1A8 (UnkStruct_ov5_021D6FA8 * param0) v2[0] += 2; if (v2[0] > v2[1]) { - if ((sub_0201D35C() % 10) < 5) { + if ((MTRNG_Next() % 10) < 5) { v2[3] = 2; } else { v2[3] = 1; @@ -4522,14 +4522,14 @@ static void ov5_021DA5A0 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v5 = (s32 *)v2->unk_08; - v4 = sub_0201D35C() % 4; + v4 = MTRNG_Next() % 4; sub_02021E50(v2->unk_04, v4); v5[4] = 10; v5[5] = 0; - v1 = sub_0201D35C(); + v1 = MTRNG_Next(); if ((v1 % 2) == 0) { v5[1] = 1; @@ -4537,20 +4537,20 @@ static void ov5_021DA5A0 (UnkStruct_ov5_021DB4B8 * param0, int param1) v5[1] = -1; } - v5[3] = 1 + (sub_0201D35C() % 1); + v5[3] = 1 + (MTRNG_Next() % 1); v5[0] = (s32) & v3->unk_B4[1]; v5[6] = (s32) & v3->unk_B4[5]; - v5[7] = 10 + (sub_0201D35C() % 20); + v5[7] = 10 + (MTRNG_Next() % 20); { VecFx32 v6 = ov5_021D7010(v2); - v6.x = -32 + (sub_0201D35C() % 414); + v6.x = -32 + (MTRNG_Next() % 414); if ((v3->unk_B4[1] == 1) && (v0 >= (param1 / 2))) { - v6.y = -40 - (sub_0201D35C() % 20); + v6.y = -40 - (MTRNG_Next() % 20); } else { - v6.y = -8 - (sub_0201D35C() % 20); + v6.y = -8 - (MTRNG_Next() % 20); } v6.x <<= FX32_SHIFT; @@ -4628,10 +4628,10 @@ static void ov5_021DA748 (UnkStruct_0201CD38 * param0, void * param1) case 0: v1[1] = 1; v1[5] = 0; - v1[6] = 200 + (sub_0201D35C() % 480); + v1[6] = 200 + (MTRNG_Next() % 480); v1[7] = 0; - if ((sub_0201D35C() % 3) != 0) { + if ((MTRNG_Next() % 3) != 0) { v1[2] = 36; sub_02005748(1597); @@ -4659,9 +4659,9 @@ static void ov5_021DA748 (UnkStruct_0201CD38 * param0, void * param1) v1[7] = 0; if (v1[2] == 200) { - v1[4] = (sub_0201D35C() % 15); + v1[4] = (MTRNG_Next() % 15); } else { - v1[4] = ((v1[6] * 50) / 100) + (sub_0201D35C() % 120); + v1[4] = ((v1[6] * 50) / 100) + (MTRNG_Next() % 120); } } @@ -4768,33 +4768,33 @@ static void ov5_021DA9DC (UnkStruct_ov5_021DB4B8 * param0, int param1) } v2 = (s32 *)v1->unk_08; - v4 = sub_0201D35C() % 0xe; + v4 = MTRNG_Next() % 0xe; sub_02021E50(v1->unk_04, v4); v3 = v4 / 4; v3++; - v2[0] = 8 + (sub_0201D35C() % 25); + v2[0] = 8 + (MTRNG_Next() % 25); v2[0] *= v3; v2[1] = 16 / v3; v2[2] = 0; - v2[3] = sub_0201D35C() % 2; + v2[3] = MTRNG_Next() % 2; v2[4] = 1; switch (v3) { case 1: case 2: - v5.x = -128 + (sub_0201D35C() % 512); - v5.y = 8 + (sub_0201D35C() % 192); + v5.x = -128 + (MTRNG_Next() % 512); + v5.y = 8 + (MTRNG_Next() % 192); break; case 3: - v5.x = -128 + (sub_0201D35C() % 512); - v5.y = 64 + (sub_0201D35C() % 128); + v5.x = -128 + (MTRNG_Next() % 512); + v5.y = 64 + (MTRNG_Next() % 128); break; case 4: - v5.x = -128 + (sub_0201D35C() % 512); - v5.y = 160 + (sub_0201D35C() % 32); + v5.x = -128 + (MTRNG_Next() % 512); + v5.y = 160 + (MTRNG_Next() % 32); break; } diff --git a/src/overlay005/ov5_021DB888.c b/src/overlay005/ov5_021DB888.c index 0c505fed9a..75b10c946b 100644 --- a/src/overlay005/ov5_021DB888.c +++ b/src/overlay005/ov5_021DB888.c @@ -648,7 +648,7 @@ static BOOL ov5_021DBCE0 (UnkStruct_ov5_021DBA58 * param0) ov5_021DBC40(param0, param0->unk_10[v3], Unk_ov5_021F8E34); v4 = 1; } else { - if (((sub_0201D2E8() % 100) < 50) && (ov5_021DBEB8(param0->unk_10[v3]) == 0)) { + if (((LCRNG_Next() % 100) < 50) && (ov5_021DBEB8(param0->unk_10[v3]) == 0)) { ov5_021DBECC(param0->unk_10[v3], 0x31); ov5_021DBC40(param0, param0->unk_10[v3], Unk_ov5_021F8E3C); diff --git a/src/overlay005/ov5_021DDBE8.c b/src/overlay005/ov5_021DDBE8.c index 1ecb0b16e5..e39d142a77 100644 --- a/src/overlay005/ov5_021DDBE8.c +++ b/src/overlay005/ov5_021DDBE8.c @@ -11,7 +11,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020203AC_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay005/struct_ov5_021DE6BC_decl.h" #include "overlay005/struct_ov5_021DE79C_decl.h" #include "overlay005/struct_ov5_021DE928_decl.h" @@ -54,7 +54,7 @@ #include "unk_02020020.h" #include "unk_020218BC.h" #include "unk_02054884.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay005/ov5_021D0D80.h" #include "overlay005/ov5_021DDBE8.h" #include "overlay005/ov5_021E2338.h" @@ -1421,8 +1421,8 @@ u32 CutInEffects_ForBattle (const BattleParams * param0) v3 = Party_FirstBattler(param0->parties[0]); v4 = Party_FirstBattler(param0->parties[1]); - v5 = GetMonData(v3, MON_DATA_161, NULL); - v6 = GetMonData(v4, MON_DATA_161, NULL); + v5 = Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL); + v6 = Pokemon_GetValue(v4, MON_DATA_LEVEL, NULL); v0 = v6 - v5; switch (param0->unk_12C) { diff --git a/src/overlay005/ov5_021DFB54.c b/src/overlay005/ov5_021DFB54.c index 7986ae6388..e603ac26e3 100644 --- a/src/overlay005/ov5_021DFB54.c +++ b/src/overlay005/ov5_021DFB54.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_0205E884_decl.h" #include "struct_decls/struct_02061830_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay005/struct_ov5_021D1BEC_decl.h" #include "overlay009/struct_ov9_0224F6EC_decl.h" #include "overlay101/struct_ov101_021D5D90_decl.h" diff --git a/src/overlay005/ov5_021E622C.c b/src/overlay005/ov5_021E622C.c index a468b7a215..04e8cf0302 100644 --- a/src/overlay005/ov5_021E622C.c +++ b/src/overlay005/ov5_021E622C.c @@ -9,8 +9,7 @@ #include "struct_decls/struct_02026310_decl.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_0202CD88_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" @@ -29,7 +28,7 @@ #include "unk_0202CC64.h" #include "unk_0202CD50.h" #include "unk_020559DC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "item.h" #include "unk_02092494.h" @@ -1987,7 +1986,7 @@ u8 ov5_021E6238 (UnkStruct_02026310 * param0) for (v1 = 0; v1 < 2; v1++) { v2 = sub_02026220(sub_02026218(param0, v1)); - if (sub_02074570(v2, MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL) != 0) { v0++; } } @@ -2005,7 +2004,7 @@ int ov5_021E6270 (UnkStruct_02026310 * param0) for (v0 = 0; v0 < 2; v0++) { v1 = sub_02026220(sub_02026218(param0, v0)); - if (sub_02074570(v1, MON_DATA_SPECIES, NULL) == 0) { + if (BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL) == 0) { return v0; } } @@ -2015,7 +2014,7 @@ int ov5_021E6270 (UnkStruct_02026310 * param0) static int ov5_021E62B0 (BoxPokemon * param0) { - int v0 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); + int v0 = BoxPokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); return Item_IsMail(v0); } @@ -2030,14 +2029,14 @@ static void ov5_021E62C4 (Party * param0, int param1, UnkStruct_02026218 * param UnkStruct_02025E6C * v6 = sub_02025E38(param3); v2 = sub_02025EF0(v6); - GetMonData(v1, MON_DATA_117, v3); + Pokemon_GetValue(v1, MON_DATA_117, v3); - if (ov5_021E62B0(sub_02076B10(v1))) { - GetMonData(v1, MON_DATA_170, sub_02026230(v4)); + if (ov5_021E62B0(Pokemon_GetBoxPokemon(v1))) { + Pokemon_GetValue(v1, MON_DATA_170, sub_02026230(v4)); } - sub_02077618(v1, v5); - SetBoxShayminForm(v5, 0); + BoxPokemon_FromPokemon(v1, v5); + BoxPokemon_SetShayminForm(v5, 0); sub_02026258(param2, 0); Party_RemovePokemonBySlotIndex(param0, param1); @@ -2067,8 +2066,8 @@ static void ov5_021E638C (UnkStruct_02026310 * param0) v2 = sub_02026220(v0); v3 = sub_02026220(v1); - if (sub_02074570(v2, MON_DATA_SPECIES, NULL) == 0) { - if (sub_02074570(v3, MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL) == 0) { + if (BoxPokemon_GetValue(v3, MON_DATA_SPECIES, NULL) != 0) { sub_020262A8(v0, v1); sub_020262F4(v1); } @@ -2087,7 +2086,7 @@ static void ov5_021E63E0 (Pokemon * param0) while ((v4 = sub_0207727C(param0, &v1, &v3)) != 0) { if (v4 == 0xffff) { - sub_02077134(param0, v3); + Pokemon_ReplaceMove(param0, v3); } } } else { @@ -2095,34 +2094,34 @@ static void ov5_021E63E0 (Pokemon * param0) } } - sub_0207418C(param0); + Pokemon_CalcLevelAndStats(param0); } static int ov5_021E6444 (Party * param0, UnkStruct_02026218 * param1, UnkStruct_0200B358 * param2) { - Pokemon * v0 = AllocMonZeroed(4); + Pokemon * v0 = Pokemon_New(4); BoxPokemon * v1 = sub_02026220(param1); UnkStruct_02026224 * v2 = sub_02026224(param1); u32 v3; u16 v4; sub_0200B5CC(param2, 0, v1); - v4 = sub_02074570(v1, MON_DATA_SPECIES, NULL); - sub_020774C8(v1, v0); + v4 = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + Pokemon_FromBoxPokemon(v1, v0); - if (GetMonData(v0, MON_DATA_161, NULL) != 100) { - v3 = GetMonData(v0, MON_DATA_EXP, NULL); + if (Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL) != 100) { + v3 = Pokemon_GetValue(v0, MON_DATA_EXP, NULL); v3 += sub_02026228(param1); - sub_02074B30(v0, 8, (u8 *)&v3); + Pokemon_SetValue(v0, 8, (u8 *)&v3); ov5_021E63E0(v0); } if (ov5_021E62B0(v1)) { - sub_02074B30(v0, 170, sub_02026230(v2)); + Pokemon_SetValue(v0, 170, sub_02026230(v2)); } Party_AddPokemon(param0, v0); - ZeroBoxMonData(v1); + BoxPokemon_Init(v1); sub_02026258(param1, 0); Heap_FreeToHeap(v0); @@ -2142,18 +2141,18 @@ u16 ov5_021E64F8 (Party * param0, UnkStruct_0200B358 * param1, UnkStruct_0202631 int ov5_021E6520 (BoxPokemon * param0, u32 param1) { - Pokemon * v0 = AllocMonZeroed(4); - BoxPokemon * v1 = sub_02076B10(v0); + Pokemon * v0 = Pokemon_New(4); + BoxPokemon * v1 = Pokemon_GetBoxPokemon(v0); int v2; u32 v3; - sub_02077604(param0, v1); + BoxPokemon_Copy(param0, v1); - v3 = sub_02074570(v1, MON_DATA_EXP, NULL); + v3 = BoxPokemon_GetValue(v1, MON_DATA_EXP, NULL); v3 += param1; - SetBoxMonData(v1, 8, (u8 *)&v3); - v2 = sub_02075B40(v1); + BoxPokemon_SetValue(v1, 8, (u8 *)&v3); + v2 = BoxPokemon_GetLevel(v1); Heap_FreeToHeap(v0); return v2; @@ -2165,7 +2164,7 @@ int ov5_021E6568 (UnkStruct_02026218 * param0) BoxPokemon * v2; v2 = sub_02026220(param0); - v0 = sub_02075B40(v2); + v0 = BoxPokemon_GetLevel(v2); v1 = ov5_021E6520(v2, sub_02026228(param0)); return v1 - v0; @@ -2224,7 +2223,7 @@ u8 ov5_021E6640 (UnkStruct_02026310 * param0, int param1, UnkStruct_0200B358 * p UnkStruct_02026218 * v0 = sub_02026218(param0, param1); BoxPokemon * v1 = sub_02026220(v0); - if (sub_02074570(v1, MON_DATA_SPECIES, NULL)) { + if (BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL)) { return ov5_021E65B0(v0, param2); } @@ -2246,28 +2245,28 @@ static int ov5_021E6684 (UnkStruct_02026310 * param0) ov5_021E6668(param0, v4); for (v0 = 0; v0 < 2; v0++) { - if (sub_02075D74(v4[v0]) == 1) { + if (BoxPokemon_GetGender(v4[v0]) == 1) { v2 = v0; } } for (v3 = 0, v0 = 0; v0 < 2; v0++) { - if ((v1[v0] = sub_02074570(v4[v0], MON_DATA_SPECIES, NULL)) == 132) { + if ((v1[v0] = BoxPokemon_GetValue(v4[v0], MON_DATA_SPECIES, NULL)) == 132) { v3++; v2 = v0; } } if (v3 == 2) { - if (sub_0201D2E8() >= (0xffff / 2)) { + if (LCRNG_Next() >= (0xffff / 2)) { v2 = 0; } else { v2 = 1; } } - if (sub_02074570(v4[v2], MON_DATA_HELD_ITEM, NULL) == 229) { - if (sub_0201D2E8() >= (0xffff / 2)) { + if (BoxPokemon_GetValue(v4[v2], MON_DATA_HELD_ITEM, NULL) == 229) { + if (LCRNG_Next() >= (0xffff / 2)) { return -1; } } else { @@ -2284,17 +2283,17 @@ void ov5_021E6720 (UnkStruct_02026310 * param0) int v4 = 0; if ((v2 = ov5_021E6684(param0)) < 0) { - sub_02026270(param0, sub_0201D35C()); + sub_02026270(param0, MTRNG_Next()); } else { BoxPokemon * v5 = ov5_021E622C(param0, v2); - v0 = sub_02074570(v5, MON_DATA_PERSONALITY, NULL); - v3 = GetNatureFromPersonality(v0); + v0 = BoxPokemon_GetValue(v5, MON_DATA_PERSONALITY, NULL); + v3 = Pokemon_GetNatureOf(v0); while (TRUE) { - v1 = sub_0201D35C(); + v1 = MTRNG_Next(); - if ((v3 == GetNatureFromPersonality(v1)) && (v1 != 0)) { + if ((v3 == Pokemon_GetNatureOf(v1)) && (v1 != 0)) { break; } @@ -2336,12 +2335,12 @@ static void ov5_021E67B0 (Pokemon * param0, UnkStruct_02026310 * param1) } for (v1 = 0; v1 < 3; v1++) { - v0[v1] = v2[sub_0201D2E8() % (6 - v1)]; + v0[v1] = v2[LCRNG_Next() % (6 - v1)]; ov5_021E6778(v2, v1); } for (v1 = 0; v1 < 3; v1++) { - v3[v1] = sub_0201D2E8() % 2; + v3[v1] = LCRNG_Next() % 2; } for (v1 = 0; v1 < 3; v1++) { @@ -2349,28 +2348,28 @@ static void ov5_021E67B0 (Pokemon * param0, UnkStruct_02026310 * param1) switch (v0[v1]) { case 0: - v4 = sub_02074570(v5, MON_DATA_HP_IV, NULL); - sub_02074B30(param0, 70, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_HP_IV, NULL); + Pokemon_SetValue(param0, 70, (u8 *)&v4); break; case 1: - v4 = sub_02074570(v5, MON_DATA_ATK_IV, NULL); - sub_02074B30(param0, 71, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_ATK_IV, NULL); + Pokemon_SetValue(param0, 71, (u8 *)&v4); break; case 2: - v4 = sub_02074570(v5, MON_DATA_DEF_IV, NULL); - sub_02074B30(param0, 72, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_DEF_IV, NULL); + Pokemon_SetValue(param0, 72, (u8 *)&v4); break; case 3: - v4 = sub_02074570(v5, MON_DATA_SPEED_IV, NULL); - sub_02074B30(param0, 73, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_SPEED_IV, NULL); + Pokemon_SetValue(param0, 73, (u8 *)&v4); break; case 4: - v4 = sub_02074570(v5, MON_DATA_SPATK_IV, NULL); - sub_02074B30(param0, 74, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_SPATK_IV, NULL); + Pokemon_SetValue(param0, 74, (u8 *)&v4); break; case 5: - v4 = sub_02074570(v5, MON_DATA_SPDEF_IV, NULL); - sub_02074B30(param0, 75, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_SPDEF_IV, NULL); + Pokemon_SetValue(param0, 75, (u8 *)&v4); break; } } @@ -2382,7 +2381,7 @@ static u8 ov5_021E68D8 (Pokemon * param0, u16 * param1) v2 = 0; v1 = 0; - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); for (v3 = 0; v3 < 1909; v3++) { if (Unk_ov5_021F9FA2[v3] == (20000 + v0)) { @@ -2412,13 +2411,13 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa MI_CpuClearFast(v7, sizeof(UnkStruct_ov5_021E6948)); - v3 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v6 = GetMonData(param0, MON_DATA_FORM, NULL); - v4 = sub_02077660(v3, v6, v7->unk_30); + v3 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v6 = Pokemon_GetValue(param0, MON_DATA_FORM, NULL); + v4 = Pokemon_LoadLevelUpMoveIdsOf(v3, v6, v7->unk_30); for (v0 = 0; v0 < 4; v0++) { - v7->unk_00[v0] = sub_02074570(param1, 54 + v0, NULL); - v7->unk_20[v0] = sub_02074570(param2, 54 + v0, NULL); + v7->unk_00[v0] = BoxPokemon_GetValue(param1, 54 + v0, NULL); + v7->unk_20[v0] = BoxPokemon_GetValue(param2, 54 + v0, NULL); } v5 = ov5_021E68D8(param0, v7->unk_94); @@ -2427,8 +2426,8 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa if (v7->unk_00[v0] != 0) { for (v1 = 0; v1 < v5; v1++) { if (v7->unk_00[v0] == v7->unk_94[v1]) { - if (sub_020770C4(param0, v7->unk_00[v0]) == 0xffff) { - sub_02077134(param0, v7->unk_00[v0]); + if (Pokemon_AddMove(param0, v7->unk_00[v0]) == 0xffff) { + Pokemon_ReplaceMove(param0, v7->unk_00[v0]); } break; } @@ -2442,9 +2441,9 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa if (v7->unk_00[v0] != 0) { for (v1 = 0; v1 < 100; v1++) { if (v7->unk_00[v0] == Item_MoveForTMHM(328 + v1)) { - if (sub_02077FE4(v3, v6, v1)) { - if (sub_020770C4(param0, v7->unk_00[v0]) == 0xffff) { - sub_02077134(param0, v7->unk_00[v0]); + if (Pokemon_CanFormLearnTM(v3, v6, v1)) { + if (Pokemon_AddMove(param0, v7->unk_00[v0]) == 0xffff) { + Pokemon_ReplaceMove(param0, v7->unk_00[v0]); } } } @@ -2472,8 +2471,8 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa for (v1 = 0; v1 < v4; v1++) { if (v7->unk_30[v1] != 0) { if (v7->unk_10[v0] == v7->unk_30[v1]) { - if (sub_020770C4(param0, v7->unk_10[v0]) == 0xffff) { - sub_02077134(param0, v7->unk_10[v0]); + if (Pokemon_AddMove(param0, v7->unk_10[v0]) == 0xffff) { + Pokemon_ReplaceMove(param0, v7->unk_10[v0]); } break; } @@ -2520,8 +2519,8 @@ static u16 ov5_021E6B54 (u16 param0, UnkStruct_02026310 * param1) return param0; } - v0 = sub_02074570(v4[0], MON_DATA_HELD_ITEM, NULL); - v1 = sub_02074570(v4[1], MON_DATA_HELD_ITEM, NULL); + v0 = BoxPokemon_GetValue(v4[0], MON_DATA_HELD_ITEM, NULL); + v1 = BoxPokemon_GetValue(v4[1], MON_DATA_HELD_ITEM, NULL); if ((v0 != Unk_ov5_021F9F6C[v2][1]) && (v1 != Unk_ov5_021F9F6C[v2][1])) { param0 = Unk_ov5_021F9F6C[v2][2]; @@ -2537,12 +2536,12 @@ static void ov5_021E6BD0 (Pokemon * param0, UnkStruct_02026310 * param1) ov5_021E6668(param1, v2); - v0 = sub_02074570(v2[0], MON_DATA_HELD_ITEM, NULL); - v1 = sub_02074570(v2[1], MON_DATA_HELD_ITEM, NULL); + v0 = BoxPokemon_GetValue(v2[0], MON_DATA_HELD_ITEM, NULL); + v1 = BoxPokemon_GetValue(v2[1], MON_DATA_HELD_ITEM, NULL); if ((v0 == 236) || (v1 == 236)) { - if (sub_020770C4(param0, 344) == 0xffff) { - sub_02077134(param0, 344); + if (Pokemon_AddMove(param0, 344) == 0xffff) { + Pokemon_ReplaceMove(param0, 344); } } } @@ -2557,10 +2556,10 @@ static u16 ov5_021E6C20 (UnkStruct_02026310 * param0, u8 param1[]) v2 = 0; for (v1 = 0; v1 < 2; v1++) { - if ((v0[v1] = sub_02074570(v6[v1], MON_DATA_SPECIES, NULL)) == 132) { + if ((v0[v1] = BoxPokemon_GetValue(v6[v1], MON_DATA_SPECIES, NULL)) == 132) { param1[0] = v1 ^ 1; param1[1] = v1; - } else if (sub_02075D74(v6[v1]) == 1) { + } else if (BoxPokemon_GetGender(v6[v1]) == 1) { param1[0] = v1; param1[1] = v1 ^ 1; } @@ -2589,7 +2588,7 @@ static u16 ov5_021E6C20 (UnkStruct_02026310 * param0, u8 param1[]) v4 = 489; } - if ((v0[param1[1]] == 132) && (sub_02075D74(v6[param1[0]]) != 1)) { + if ((v0[param1[1]] == 132) && (BoxPokemon_GetGender(v6[param1[0]]) != 1)) { v5 = param1[1]; param1[1] = param1[0]; param1[0] = v5; @@ -2602,7 +2601,7 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * { u8 v0, v1, v2; u16 v3; - u8 v4 = sub_020759F0(param1, 19); + u8 v4 = PokemonPersonalData_GetSpeciesValue(param1, 19); Strbuf* v5; sub_02073D80(param0, param1, 1, 32, 0, 0, 0, 0); @@ -2610,19 +2609,19 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * v0 = 0; v3 = 4; - sub_02074B30(param0, 155, &v3); - sub_02074B30(param0, 9, &v4); - sub_02074B30(param0, 156, &v0); + Pokemon_SetValue(param0, 155, &v3); + Pokemon_SetValue(param0, 9, &v4); + Pokemon_SetValue(param0, 156, &v0); if (param2) { - sub_02074B30(param0, 152, ¶m2); + Pokemon_SetValue(param0, 152, ¶m2); } v2 = 1; - sub_02074B30(param0, 76, &v2); + Pokemon_SetValue(param0, 76, &v2); v5 = sub_0200B32C(494, 4); - sub_02074B30(param0, 119, v5); + Pokemon_SetValue(param0, 119, v5); Strbuf_Free(v5); if (param4 == 4) { @@ -2630,9 +2629,9 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * u32 v7 = sub_02025F30(param3); Strbuf* v8 = sub_02025F04(param3, 32); - sub_02074B30(param0, 145, v8); - sub_02074B30(param0, 7, &v6); - sub_02074B30(param0, 157, &v7); + Pokemon_SetValue(param0, 145, v8); + Pokemon_SetValue(param0, 7, &v6); + Pokemon_SetValue(param0, 157, &v7); Strbuf_Free(v8); } @@ -2645,18 +2644,18 @@ void ov5_021E6DE8 (Pokemon * param0, u16 param1, UnkStruct_02026310 * param2, u3 u16 v1; u32 v2; Strbuf* v3; - u8 v4 = sub_020759F0(param1, 19); + u8 v4 = PokemonPersonalData_GetSpeciesValue(param1, 19); v2 = sub_02026248(param2); if (sub_02026280(param2)) { int v5; - if (sub_02075E38(param3, v2) == 0) { + if (Pokemon_IsPersonalityShiny(param3, v2) == 0) { for (v5 = 0; v5 < 4; v5++) { - v2 = sub_0201D30C(v2); + v2 = ARNG_Next(v2); - if (sub_02075E38(param3, v2)) { + if (Pokemon_IsPersonalityShiny(param3, v2)) { break; } } @@ -2670,14 +2669,14 @@ void ov5_021E6DE8 (Pokemon * param0, u16 param1, UnkStruct_02026310 * param2, u3 v0 = 0; v1 = 4; - sub_02074B30(param0, 155, &v1); - sub_02074B30(param0, 9, &v4); - sub_02074B30(param0, 156, &v0); - sub_02074B30(param0, 112, ¶m4); + Pokemon_SetValue(param0, 155, &v1); + Pokemon_SetValue(param0, 9, &v4); + Pokemon_SetValue(param0, 156, &v0); + Pokemon_SetValue(param0, 112, ¶m4); v3 = sub_0200B32C(494, 4); - sub_02074B30(param0, 119, v3); + Pokemon_SetValue(param0, 119, v3); Strbuf_Free(v3); } @@ -2685,7 +2684,7 @@ void ov5_021E6EA8 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_02025E { u16 v0; u8 v1[2], v2; - Pokemon * v3 = AllocMonZeroed(4); + Pokemon * v3 = Pokemon_New(4); v0 = ov5_021E6C20(param0, v1); v0 = ov5_021E6B54(v0, param0); @@ -2693,7 +2692,7 @@ void ov5_021E6EA8 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_02025E { u32 v4 = sub_02025F20(param2); BoxPokemon * v5 = ov5_021E622C(param0, v1[0]); - u8 v6 = sub_02074570(v5, MON_DATA_FORM, NULL); + u8 v6 = BoxPokemon_GetValue(v5, MON_DATA_FORM, NULL); ov5_021E6DE8(v3, v0, param0, v4, v6); } @@ -2708,7 +2707,7 @@ void ov5_021E6EA8 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_02025E } v2 = 1; - sub_02074B30(v3, 76, &v2); + Pokemon_SetValue(v3, 76, &v2); Party_AddPokemon(param1, v3); ov5_021E6B40(param0); @@ -2724,8 +2723,8 @@ static int ov5_021E6F6C (Party * param0) v2 = Party_GetCurrentCount(param0); for (v0 = 0; v0 < v2; v0++) { - if (GetMonData(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_173, NULL) == 0) { - v1 = GetMonData(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_10, NULL); + if (Pokemon_GetValue(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_173, NULL) == 0) { + v1 = Pokemon_GetValue(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_ABILITY, NULL); if ((v1 == 40) || (v1 == 49)) { return 2; @@ -2757,12 +2756,12 @@ static u8 ov5_021E6FF0 (BoxPokemon ** param0) u32 v2[2], v3[2], v4, v5; for (v5 = 0; v5 < 2; v5++) { - v1[v5] = sub_02074570(param0[v5], MON_DATA_SPECIES, NULL); - v2[v5] = sub_02074570(param0[v5], MON_DATA_OT_ID, NULL); - v4 = sub_02074570(param0[v5], MON_DATA_PERSONALITY, NULL); - v3[v5] = sub_02075DAC(v1[v5], v4); - v0[v5][0] = sub_020759F0(v1[v5], 22); - v0[v5][1] = sub_020759F0(v1[v5], 23); + v1[v5] = BoxPokemon_GetValue(param0[v5], MON_DATA_SPECIES, NULL); + v2[v5] = BoxPokemon_GetValue(param0[v5], MON_DATA_OT_ID, NULL); + v4 = BoxPokemon_GetValue(param0[v5], MON_DATA_PERSONALITY, NULL); + v3[v5] = Pokemon_GetGenderOf(v1[v5], v4); + v0[v5][0] = PokemonPersonalData_GetSpeciesValue(v1[v5], 22); + v0[v5][1] = PokemonPersonalData_GetSpeciesValue(v1[v5], 23); } if ((v0[0][0] == 15) || (v0[1][0] == 15)) { @@ -2863,7 +2862,7 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD v2 = 0; for (v0 = 0; v0 < 2; v0++) { - if (sub_02074570(v8[v0], MON_DATA_172, NULL) != 0) { + if (BoxPokemon_GetValue(v8[v0], MON_DATA_172, NULL) != 0) { sub_02026260(sub_02026218(param0, v0), 1); v2++; } @@ -2872,7 +2871,7 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD if ((sub_02026234(param0) == 0) && (v2 == 2)) { if ((sub_02026228(sub_02026218(param0, 1)) & 0xff) == 0xff) { v3 = ov5_021E70FC(param0); - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); v4 = (v4 * 100) / 0xffff; if (v3 > v4) { @@ -2891,12 +2890,12 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD for (v0 = 0; v0 < Party_GetCurrentCount(param1); v0++) { Pokemon * v9 = Party_GetPokemonBySlotIndex(param1, v0); - if (GetMonData(v9, MON_DATA_IS_EGG, NULL)) { - if (GetMonData(v9, MON_DATA_3, NULL)) { + if (Pokemon_GetValue(v9, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v9, MON_DATA_3, NULL)) { continue; } - v1 = GetMonData(v9, MON_DATA_FRIENDSHIP, NULL); + v1 = Pokemon_GetValue(v9, MON_DATA_FRIENDSHIP, NULL); if (v1 != 0) { if (v1 >= v7) { @@ -2905,7 +2904,7 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD v1--; } - sub_02074B30(v9, 9, (u8 *)&v1); + Pokemon_SetValue(v9, 9, (u8 *)&v1); } else { return 1; } @@ -2925,8 +2924,8 @@ Pokemon * ov5_021E7278 (Party * param0) for (v0 = 0; v0 < v2; v0++) { v1 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) - && (GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) == 0)) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) + && (Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) == 0)) { return v1; } } @@ -2941,12 +2940,12 @@ void ov5_021E72BC (UnkStruct_02026310 * param0, UnkStruct_0200B358 * param1) ov5_021E6668(param0, v0); - if (sub_02074570(v0[0], MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v0[0], MON_DATA_SPECIES, NULL) != 0) { sub_0200B5CC(param1, 0, v0[0]); sub_0200B5EC(param1, 2, v0[0]); } - if (sub_02074570(v0[1], MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v0[1], MON_DATA_SPECIES, NULL) != 0) { sub_0200B5CC(param1, 1, v0[1]); } } @@ -2965,12 +2964,12 @@ void ov5_021E7308 (UnkStruct_02026310 * param0, u32 param1, u32 param2, u32 para v2 = ov5_021E6520(v1, sub_02026228(v0)); sub_0200B60C(param5, param2, v2, 3, 0, 1); - v3 = sub_02074570(v1, MON_DATA_111, NULL); + v3 = BoxPokemon_GetValue(v1, MON_DATA_GENDER, NULL); if (v3 != 2) { - v4 = sub_02074570(v1, MON_DATA_SPECIES, NULL); + v4 = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); - if (((v4 == 29) || (v4 == 32)) && (sub_02074570(v1, MON_DATA_77, NULL) == 0)) { + if (((v4 == 29) || (v4 == 32)) && (BoxPokemon_GetValue(v1, MON_DATA_77, NULL) == 0)) { v3 = 2; } } @@ -2982,8 +2981,8 @@ u16 ov5_021E73A0 (Party * param0, int param1, UnkStruct_0200B358 * param2) { Pokemon * v0 = Party_GetPokemonBySlotIndex(param0, param1); - sub_0200B5CC(param2, 0, sub_02076B10(v0)); - return GetMonData(v0, MON_DATA_SPECIES, NULL); + sub_0200B5CC(param2, 0, Pokemon_GetBoxPokemon(v0)); + return Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); } u8 ov5_021E73C8 (UnkStruct_02026310 * param0) @@ -3036,39 +3035,39 @@ static void ov5_021E742C (Pokemon * param0, int param1) u8 v5[6], v6; u8 v7, v8, v9, v10, v11, v12, v13, v14; Strbuf* v15 = Strbuf_Init(7 + 1, param1); - Pokemon * v16 = AllocMonZeroed(param1); + Pokemon * v16 = Pokemon_New(param1); - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); for (v7 = 0; v7 < 4; v7++) { - v1[v7] = GetMonData(param0, MON_DATA_MOVE1 + v7, NULL); - v2[v7] = GetMonData(param0, MON_DATA_58 + v7, NULL); + v1[v7] = Pokemon_GetValue(param0, MON_DATA_MOVE1 + v7, NULL); + v2[v7] = Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP + v7, NULL); } - v3 = GetMonData(param0, MON_DATA_PERSONALITY, NULL); + v3 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL); for (v7 = 0; v7 < 6; v7++) { - v5[v7] = GetMonData(param0, MON_DATA_HP_IV + v7, NULL); + v5[v7] = Pokemon_GetValue(param0, MON_DATA_HP_IV + v7, NULL); } - v8 = GetMonData(param0, MON_DATA_LANGUAGE, NULL); - v9 = GetMonData(param0, MON_DATA_MET_GAME, NULL); - v10 = GetMonData(param0, MON_DATA_11, NULL); - v6 = GetMonData(param0, MON_DATA_POKERUS, NULL); - v12 = GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL); + v8 = Pokemon_GetValue(param0, MON_DATA_LANGUAGE, NULL); + v9 = Pokemon_GetValue(param0, MON_DATA_MET_GAME, NULL); + v10 = Pokemon_GetValue(param0, MON_DATA_11, NULL); + v6 = Pokemon_GetValue(param0, MON_DATA_POKERUS, NULL); + v12 = Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL); - GetMonData(param0, MON_DATA_145, v15); + Pokemon_GetValue(param0, MON_DATA_145, v15); - v14 = GetMonData(param0, MON_DATA_OT_GENDER, NULL); - v4 = GetMonData(param0, MON_DATA_OT_ID, NULL); - v13 = GetMonData(param0, MON_DATA_FORM, NULL); + v14 = Pokemon_GetValue(param0, MON_DATA_OT_GENDER, NULL); + v4 = Pokemon_GetValue(param0, MON_DATA_OT_ID, NULL); + v13 = Pokemon_GetValue(param0, MON_DATA_FORM, NULL); if (v0 == 490) { - int v17 = GetMonData(param0, MON_DATA_152, NULL); + int v17 = Pokemon_GetValue(param0, MON_DATA_152, NULL); if (v17 == sub_02017070(2, 1)) { - while (sub_02075E38(v4, v3)) { - v3 = sub_0201D30C(v3); + while (Pokemon_IsPersonalityShiny(v4, v3)) { + v3 = ARNG_Next(v3); } } } @@ -3076,54 +3075,54 @@ static void ov5_021E742C (Pokemon * param0, int param1) sub_02073D80(v16, v0, 1, 32, 1, v3, 0, 0); for (v7 = 0; v7 < 4; v7++) { - sub_02074B30(v16, 54 + v7, &(v1[v7])); - sub_02074B30(v16, 58 + v7, &(v2[v7])); + Pokemon_SetValue(v16, 54 + v7, &(v1[v7])); + Pokemon_SetValue(v16, 58 + v7, &(v2[v7])); } for (v7 = 0; v7 < 6; v7++) { - sub_02074B30(v16, 70 + v7, &(v5[v7])); + Pokemon_SetValue(v16, 70 + v7, &(v5[v7])); } - sub_02074B30(v16, 12, &v8); - sub_02074B30(v16, 122, &v9); - sub_02074B30(v16, 11, &v10); + Pokemon_SetValue(v16, 12, &v8); + Pokemon_SetValue(v16, 122, &v9); + Pokemon_SetValue(v16, 11, &v10); v11 = 120; - sub_02074B30(v16, 9, &v11); - sub_02074B30(v16, 154, &v6); - sub_02074B30(v16, 110, &v12); - sub_02074B30(v16, 145, v15); - sub_02074B30(v16, 157, &v14); - sub_02074B30(v16, 7, &v4); - sub_02074B30(v16, 112, &v13); + Pokemon_SetValue(v16, 9, &v11); + Pokemon_SetValue(v16, 154, &v6); + Pokemon_SetValue(v16, 110, &v12); + Pokemon_SetValue(v16, 145, v15); + Pokemon_SetValue(v16, 157, &v14); + Pokemon_SetValue(v16, 7, &v4); + Pokemon_SetValue(v16, 112, &v13); { u16 v18; u8 v19, v20, v21; - v18 = GetMonData(param0, MON_DATA_152, NULL); - v19 = GetMonData(param0, MON_DATA_146, NULL); - v20 = GetMonData(param0, MON_DATA_147, NULL); - v21 = GetMonData(param0, MON_DATA_148, NULL); + v18 = Pokemon_GetValue(param0, MON_DATA_152, NULL); + v19 = Pokemon_GetValue(param0, MON_DATA_146, NULL); + v20 = Pokemon_GetValue(param0, MON_DATA_147, NULL); + v21 = Pokemon_GetValue(param0, MON_DATA_148, NULL); - sub_02074B30(v16, 152, &v18); - sub_02074B30(v16, 146, &v19); - sub_02074B30(v16, 147, &v20); - sub_02074B30(v16, 148, &v21); + Pokemon_SetValue(v16, 152, &v18); + Pokemon_SetValue(v16, 146, &v19); + Pokemon_SetValue(v16, 147, &v20); + Pokemon_SetValue(v16, 148, &v21); - v18 = GetMonData(param0, MON_DATA_153, NULL); - v19 = GetMonData(param0, MON_DATA_149, NULL); - v20 = GetMonData(param0, MON_DATA_150, NULL); - v21 = GetMonData(param0, MON_DATA_151, NULL); + v18 = Pokemon_GetValue(param0, MON_DATA_153, NULL); + v19 = Pokemon_GetValue(param0, MON_DATA_149, NULL); + v20 = Pokemon_GetValue(param0, MON_DATA_150, NULL); + v21 = Pokemon_GetValue(param0, MON_DATA_151, NULL); - sub_02074B30(v16, 153, &v18); - sub_02074B30(v16, 149, &v19); - sub_02074B30(v16, 150, &v20); - sub_02074B30(v16, 151, &v21); + Pokemon_SetValue(v16, 153, &v18); + Pokemon_SetValue(v16, 149, &v19); + Pokemon_SetValue(v16, 150, &v20); + Pokemon_SetValue(v16, 151, &v21); } - sub_020775EC(v16, param0); + Pokemon_Copy(v16, param0); Strbuf_Free(v15); Heap_FreeToHeap(v16); } @@ -3141,16 +3140,16 @@ void ov5_021E771C (Pokemon * param0, int param1) v3 = 0; ov5_021E742C(param0, param1); - sub_02074B30(param0, 76, &v0); + Pokemon_SetValue(param0, 76, &v0); - v4 = GetMonData(param0, MON_DATA_SPECIES, NULL); + v4 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); MessageLoader_GetSpeciesName(v4, 0, v5); - sub_02074B30(param0, 117, v5); - sub_02074B30(param0, 77, &v1); - sub_02074B30(param0, 155, &v2); - sub_02074B30(param0, 156, &v3); - sub_0207418C(param0); + Pokemon_SetValue(param0, 117, v5); + Pokemon_SetValue(param0, 77, &v1); + Pokemon_SetValue(param0, 155, &v2); + Pokemon_SetValue(param0, 156, &v3); + Pokemon_CalcLevelAndStats(param0); } u32 ov5_021E7790 (BoxPokemon ** param0) diff --git a/src/overlay005/ov5_021EB1A0.c b/src/overlay005/ov5_021EB1A0.c index 417632cb89..394d15f27e 100644 --- a/src/overlay005/ov5_021EB1A0.c +++ b/src/overlay005/ov5_021EB1A0.c @@ -582,7 +582,7 @@ void ov5_021EB7F8 (UnkStruct_02061AB4 * param0) v0 = sub_02062ACC(param0, (sizeof(UnkStruct_ov5_021EB7F8))); v0->unk_00 = -1; - v0->unk_02 = sub_0201D2E8() % 16; + v0->unk_02 = LCRNG_Next() % 16; ov5_021ECF04(param0, &v0->unk_04); @@ -663,7 +663,7 @@ void ov5_021EB8B8 (UnkStruct_02061AB4 * param0) if (v2->unk_01 >= 32) { v2->unk_01 = 0; - v2->unk_02 = sub_0201D2E8() % 16; + v2->unk_02 = LCRNG_Next() % 16; } } diff --git a/src/overlay005/ov5_021EE7D4.c b/src/overlay005/ov5_021EE7D4.c index f15cda2ec7..3fd5fd84f1 100644 --- a/src/overlay005/ov5_021EE7D4.c +++ b/src/overlay005/ov5_021EE7D4.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_0200B358_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_02098700_decl.h" #include "struct_defs/struct_0203CDB0.h" @@ -12,7 +12,7 @@ #include "unk_020507CC.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02098700.h" #include "overlay005/ov5_021EE7D4.h" @@ -50,13 +50,13 @@ static int ov5_021EE7D4 (Pokemon * param0) u16 v4, v5, v6; u16 v7, v8; - v0 = GetMonData(param0, MON_DATA_PERSONALITY, NULL) & 0xffff; - v1 = GetMonData(param0, MON_DATA_HP_IV, NULL) & 0xf; - v2 = GetMonData(param0, MON_DATA_ATK_IV, NULL) & 0xf; - v3 = GetMonData(param0, MON_DATA_DEF_IV, NULL) & 0xf; - v4 = GetMonData(param0, MON_DATA_SPEED_IV, NULL) & 0xf; - v5 = GetMonData(param0, MON_DATA_SPATK_IV, NULL) & 0xf; - v6 = GetMonData(param0, MON_DATA_SPDEF_IV, NULL) & 0xf; + v0 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL) & 0xffff; + v1 = Pokemon_GetValue(param0, MON_DATA_HP_IV, NULL) & 0xf; + v2 = Pokemon_GetValue(param0, MON_DATA_ATK_IV, NULL) & 0xf; + v3 = Pokemon_GetValue(param0, MON_DATA_DEF_IV, NULL) & 0xf; + v4 = Pokemon_GetValue(param0, MON_DATA_SPEED_IV, NULL) & 0xf; + v5 = Pokemon_GetValue(param0, MON_DATA_SPATK_IV, NULL) & 0xf; + v6 = Pokemon_GetValue(param0, MON_DATA_SPDEF_IV, NULL) & 0xf; v7 = ((v2 ^ v3) * v1) ^ (v0 & 0xff); v8 = ((v5 ^ v6) * v4) ^ (v0 >> 8); @@ -109,7 +109,7 @@ u8 ov5_021EE920 (UnkStruct_0203CDB0 * param0, u16 param1) u32 v5; v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_0C), param1); - v3 = GetMonData(v0, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); v1 = ov5_021EE7D4(v0); v4 = ov5_021EE8A8(v3, v1); v2 = sub_0206B0B4(sub_020507E4(param0->unk_0C)); @@ -174,7 +174,7 @@ void ov5_021EEA84 (UnkStruct_0203CDB0 * param0, u8 param1, u8 param2, u16 param3 vu16 v2; v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_0C), param3); - v1 = GetMonData(v0, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); v2 = ov5_021EE7D4(v0); ov5_021EE9E8(param0, param1, param2, v1, v2); diff --git a/src/overlay005/ov5_021F08CC.c b/src/overlay005/ov5_021F08CC.c index 24a16fbff2..2ae8725998 100644 --- a/src/overlay005/ov5_021F08CC.c +++ b/src/overlay005/ov5_021F08CC.c @@ -11,7 +11,7 @@ #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_0205E884_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay101/struct_ov101_021D5D90_decl.h" #include "struct_defs/struct_0203CDB0.h" @@ -241,7 +241,7 @@ static int ov5_021F0A80 (UnkStruct_ov5_021F0D6C * param0, UnkStruct_0205E884 * p static int ov5_021F0AB8 (UnkStruct_ov5_021F0D6C * param0, UnkStruct_0205E884 * param1, UnkStruct_02061AB4 * param2) { - param0->unk_14 = ((sub_0201D2E8() % 4) + 1) * 30; + param0->unk_14 = ((LCRNG_Next() % 4) + 1) * 30; param0->unk_18 = Unk_ov5_021FFA00[param0->unk_1C]; param0->unk_0C = 4; diff --git a/src/overlay005/ov5_021F6454.c b/src/overlay005/ov5_021F6454.c index 65f4ded7aa..3925386290 100644 --- a/src/overlay005/ov5_021F6454.c +++ b/src/overlay005/ov5_021F6454.c @@ -18,7 +18,7 @@ #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_02061830_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay005/struct_ov5_021F6704_decl.h" @@ -56,7 +56,7 @@ #include "unk_02061804.h" #include "unk_020677F4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "overlay005/ov5_021EB1A0.h" @@ -465,12 +465,12 @@ BOOL ov5_021F6B3C (UnkStruct_0203E724 * param0) v2 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v3->unk_0C), v4); - v1[0] = GetMonData(v2, MON_DATA_HP_IV, NULL); - v1[1] = GetMonData(v2, MON_DATA_ATK_IV, NULL); - v1[2] = GetMonData(v2, MON_DATA_DEF_IV, NULL); - v1[3] = GetMonData(v2, MON_DATA_SPEED_IV, NULL); - v1[4] = GetMonData(v2, MON_DATA_SPATK_IV, NULL); - v1[5] = GetMonData(v2, MON_DATA_SPDEF_IV, NULL); + v1[0] = Pokemon_GetValue(v2, MON_DATA_HP_IV, NULL); + v1[1] = Pokemon_GetValue(v2, MON_DATA_ATK_IV, NULL); + v1[2] = Pokemon_GetValue(v2, MON_DATA_DEF_IV, NULL); + v1[3] = Pokemon_GetValue(v2, MON_DATA_SPEED_IV, NULL); + v1[4] = Pokemon_GetValue(v2, MON_DATA_SPATK_IV, NULL); + v1[5] = Pokemon_GetValue(v2, MON_DATA_SPDEF_IV, NULL); *v5 = 0; @@ -486,7 +486,7 @@ BOOL ov5_021F6B3C (UnkStruct_0203E724 * param0) *v6 = v0; *v7 = v1[v0]; } else if (v1[*v6] == v1[v0]) { - if ((sub_0201D2E8() % 2) == 0) { + if ((LCRNG_Next() % 2) == 0) { *v6 = v0; *v7 = v1[v0]; } @@ -515,7 +515,7 @@ BOOL ov5_021F6C60 (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v2; v3++) { v0 = Party_GetPokemonBySlotIndex(v1, v3); - v8[v3] = GetMonData(v0, MON_DATA_HELD_ITEM, NULL); + v8[v3] = Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); if (v8[v3] == 112) { v9++; @@ -535,27 +535,27 @@ BOOL ov5_021F6C60 (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v2; v3++) { if (v8[v3] == 112) { v0 = Party_GetPokemonBySlotIndex(v1, v3); - sub_02074B30(v0, 6, &v7); + Pokemon_SetValue(v0, 6, &v7); } } } for (v3 = 0; v3 < v2; v3++) { v0 = Party_GetPokemonBySlotIndex(v1, v3); - v6 = GetMonData(v0, MON_DATA_FORM, NULL); + v6 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); if (v6 > 0) { - v5 = GetMonData(v0, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); switch (v5) { case 487: - sub_02077A00(v0); + Pokemon_SetGiratinaForm(v0); break; case 479: - SetRotomForm(v0, 0, 0); + Pokemon_SetRotomForm(v0, 0, 0); break; case 492: - SetShayminForm(v0, 0); + Pokemon_SetShayminForm(v0, 0); break; } } @@ -585,7 +585,7 @@ BOOL ov5_021F6D80 (UnkStruct_0203E724 * param0) return 0; } - v5 = GetMonData(v0, MON_DATA_HELD_ITEM, NULL); + v5 = Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); if (v5 == 112) { v6 = sub_0207D570(sub_0207D990(v7->unk_0C), 112, 1, 4); @@ -596,23 +596,23 @@ BOOL ov5_021F6D80 (UnkStruct_0203E724 * param0) } v4 = 0; - sub_02074B30(v0, 6, &v4); + Pokemon_SetValue(v0, 6, &v4); } - v3 = GetMonData(v0, MON_DATA_FORM, NULL); + v3 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); if (v3 > 0) { - v2 = GetMonData(v0, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); switch (v2) { case 487: - sub_02077A00(v0); + Pokemon_SetGiratinaForm(v0); break; case 479: - SetRotomForm(v0, 0, 0); + Pokemon_SetRotomForm(v0, 0, 0); break; case 492: - SetShayminForm(v0, 0); + Pokemon_SetShayminForm(v0, 0); break; } } @@ -628,7 +628,7 @@ BOOL ov5_021F6E50 (UnkStruct_0203E724 * param0) u16 v3 = inline_02049538(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v1->unk_0C), v2); - sub_02074B30(v0, 112, &v3); + Pokemon_SetValue(v0, 112, &v3); return 0; } @@ -650,9 +650,9 @@ BOOL ov5_021F6E9C (UnkStruct_0203E724 * param0) for (v4 = 0; v4 < v3; v4++) { v6 = Party_GetPokemonBySlotIndex(v7, v4); - v0 = GetMonData(v6, MON_DATA_SPECIES, NULL); - v1 = GetMonData(v6, MON_DATA_FORM, NULL); - v2 = GetMonData(v6, MON_DATA_IS_EGG, NULL); + v0 = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v6, MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(v6, MON_DATA_IS_EGG, NULL); if ((v0 == 479) && (v1 != 0) && (v2 == 0)) { if (*v10 == 0xff) { @@ -682,7 +682,7 @@ BOOL ov5_021F6F44 (UnkStruct_0203E724 * param0) v5 = Party_GetFromSavedata(v6->unk_0C); v4 = Party_GetPokemonBySlotIndex(v5, v7); - SetRotomForm(v4, v10, v8); + Pokemon_SetRotomForm(v4, v10, v8); sub_0202736C(sub_02027560(v6->unk_0C), v4); return 0; @@ -698,9 +698,9 @@ BOOL ov5_021F6FC0 (UnkStruct_0203E724 * param0) u16 * v6 = inline_0204FCAC(param0); v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v5); - v0 = GetMonData(v3, MON_DATA_SPECIES, NULL); + v0 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { switch (v0) { case 10: case 11: @@ -738,12 +738,12 @@ static void ov5_021F70CC (Pokemon * param0, int * param1, int * param2) int v4; int v5; - v0 = GetMonData(param0, MON_DATA_HP_IV, NULL); - v1 = GetMonData(param0, MON_DATA_ATK_IV, NULL); - v2 = GetMonData(param0, MON_DATA_DEF_IV, NULL); - v3 = GetMonData(param0, MON_DATA_SPEED_IV, NULL); - v4 = GetMonData(param0, MON_DATA_SPATK_IV, NULL); - v5 = GetMonData(param0, MON_DATA_SPDEF_IV, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_HP_IV, NULL); + v1 = Pokemon_GetValue(param0, MON_DATA_ATK_IV, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_DEF_IV, NULL); + v3 = Pokemon_GetValue(param0, MON_DATA_SPEED_IV, NULL); + v4 = Pokemon_GetValue(param0, MON_DATA_SPATK_IV, NULL); + v5 = Pokemon_GetValue(param0, MON_DATA_SPDEF_IV, NULL); if (param1 != NULL) { *param1 = ((v0 & 2) >> 1) | ((v1 & 2) >> 0) | ((v2 & 2) << 1) | ((v3 & 2) << 2) | ((v4 & 2) << 3) | ((v5 & 2) << 4); @@ -769,7 +769,7 @@ BOOL ov5_021F71B8 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v2->unk_0C), 0); v0 = sub_0202783C(v2->unk_0C); - sub_020278DC(v0, GetMonData(v1, MON_DATA_SPECIES, NULL), GetMonData(v1, MON_DATA_FORM, NULL), GetMonData(v1, MON_DATA_IS_EGG, NULL)); + sub_020278DC(v0, Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), Pokemon_GetValue(v1, MON_DATA_FORM, NULL), Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL)); return 0; } @@ -803,7 +803,7 @@ BOOL ov5_021F7270 (UnkStruct_0203E724 * param0) v1 = Party_GetFromSavedata(v2->unk_0C); v0 = Party_GetPokemonBySlotIndex(v1, v3); - *v4 = GetMonData(v0, MON_DATA_FORM, NULL); + *v4 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); return 0; } diff --git a/src/overlay005/ov5_021F77A8.c b/src/overlay005/ov5_021F77A8.c index b28bf5e0ca..6a469e85ec 100644 --- a/src/overlay005/ov5_021F77A8.c +++ b/src/overlay005/ov5_021F77A8.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_0207D3C0_decl.h" #include "overlay005/struct_ov5_021DC1A4_decl.h" #include "overlay005/struct_ov5_021F7ED8_decl.h" @@ -35,7 +35,7 @@ #include "unk_0203E724.h" #include "unk_0203E880.h" #include "unk_02054884.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "overlay005/ov5_021DC018.h" @@ -816,8 +816,8 @@ static u8 ov5_021F7A74 (Pokemon * param0, u8 param1) u16 v0; u32 v1, v2; - v2 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(param0, MON_DATA_FORM, NULL); v0 = v2; switch (v2) { @@ -872,10 +872,10 @@ static u16 ov5_021F7B60 (Pokemon * param0, u16 param1) u32 v5; u16 v6[4]; - v5 = GetMonData(param0, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); for (v2 = 0; v2 < 4; v2++) { - v6[v2] = GetMonData(param0, MON_DATA_MOVE1 + v2, NULL); + v6[v2] = Pokemon_GetValue(param0, MON_DATA_MOVE1 + v2, NULL); } for (v0 = 0; v0 < 5; v0++) { @@ -934,7 +934,7 @@ BOOL ov5_021F7C04 (UnkStruct_0203E724 * param0) if (v14 != 0xff) { for (v5 = 0; v5 < 4; v5++) { - v11[v5] = GetMonData(v6, (54 + v5), NULL); + v11[v5] = Pokemon_GetValue(v6, (54 + v5), NULL); } for (v2 = 0; v2 < 5; v2++) { diff --git a/src/overlay006/ov6_02240C9C.c b/src/overlay006/ov6_02240C9C.c index c99a22de56..862e6bf985 100644 --- a/src/overlay006/ov6_02240C9C.c +++ b/src/overlay006/ov6_02240C9C.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0202D7B0.h" @@ -40,7 +40,7 @@ #include "unk_0206A8DC.h" #include "unk_0206AFE0.h" #include "roaming_pokemon.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "party.h" #include "overlay005/ov5_021EFB0C.h" @@ -270,7 +270,7 @@ BOOL ov6_02240D5C (UnkStruct_0203CDB0 * param0) v16 = Party_FirstBattler(v11); v14.unk_04 = 1; - v14.unk_0C = GetMonData(v16, MON_DATA_161, NULL); + v14.unk_0C = Pokemon_GetValue(v16, MON_DATA_LEVEL, NULL); } } @@ -649,7 +649,7 @@ BOOL ov6_022413E4 (UnkStruct_0203CDB0 * param0, BattleParams ** param1) v15 = Party_FirstBattler(v10); v13.unk_04 = 1; - v13.unk_0C = GetMonData(v15, MON_DATA_161, NULL); + v13.unk_0C = Pokemon_GetValue(v15, MON_DATA_LEVEL, NULL); } } @@ -1054,7 +1054,7 @@ static void ov6_02241A90 (Pokemon * param0, u8 * param1) { u16 v0; - v0 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); if ((v0 == 224) || (v0 == 320)) { (*param1) = ((*param1) * 2) / 3; @@ -1081,7 +1081,7 @@ static u8 ov6_02241AE4 (Pokemon * param0, const UnkStruct_ov6_022422D0 * param1) if (param1->unk_0D == 0) { if (param1->unk_0E == 28) { if (inline_020564D0(2) == 0) { - v0 = (u32)GetMonData(param0, MON_DATA_PERSONALITY, NULL); + v0 = (u32)Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL); v0 = v0 % 25; return (u8)v0; } @@ -1107,7 +1107,7 @@ static u8 ov6_02241B40 (const UnkStruct_ov6_0224222C * param0, const UnkStruct_o } v0 = v3 - v2 + 1; - v1 = sub_0201D2E8() % v0; + v1 = LCRNG_Next() % v0; if (param1->unk_0D == 0) { if ((param1->unk_0E == 55) || (param1->unk_0E == 72) || (param1->unk_0E == 46)) { @@ -1131,8 +1131,8 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c u8 v4; Pokemon * v5; - v5 = AllocMonZeroed(11); - ZeroMonData(v5); + v5 = Pokemon_New(11); + Pokemon_Init(v5); v2 = 0; @@ -1140,7 +1140,7 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c if (param4->unk_0E == 56) { u32 v6; - v6 = sub_020759F0(param0, 18); + v6 = PokemonPersonalData_GetSpeciesValue(param0, 18); switch (v6) { case 0: @@ -1149,13 +1149,13 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c break; default: if (inline_020564D0(3) > 0) { - v3 = GetMonData(param5, MON_DATA_111, NULL); + v3 = Pokemon_GetValue(param5, MON_DATA_GENDER, NULL); v2 = 1; } } } else if (param4->unk_0E == 28) { if (inline_020564D0(2) == 0) { - v4 = sub_02075BCC(param5); + v4 = Pokemon_GetNature(param5); v2 = 1; } } @@ -1168,7 +1168,7 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c do { if (param4->unk_0E == 56) { - v7 = sub_02075DAC(param0, v1); + v7 = Pokemon_GetGenderOf(param0, v1); GF_ASSERT(v7 != 2); if (v7 != v3) { @@ -1177,7 +1177,7 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c v1 = sub_02075E64(param3); } } else if (param4->unk_0E == 28) { - v8 = GetNatureFromPersonality(v1); + v8 = Pokemon_GetNatureOf(v1); if (v8 == v4) { break; @@ -1202,14 +1202,14 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru BOOL v2; Pokemon * v3; - v3 = AllocMonZeroed(11); - ZeroMonData(v3); + v3 = Pokemon_New(11); + Pokemon_Init(v3); v0 = 1; { u32 v4; - v4 = sub_020759F0(param0, 18); + v4 = PokemonPersonalData_GetSpeciesValue(param0, 18); switch (v4) { case 0: @@ -1223,7 +1223,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru if (param3->unk_0D == 0) { if (param3->unk_0E == 56) { if (inline_020564D0(3) > 0) { - v1 = GetMonData(param4, MON_DATA_111, NULL); + v1 = Pokemon_GetValue(param4, MON_DATA_GENDER, NULL); if (v1 == 1) { v1 = 0; @@ -1234,7 +1234,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru } sub_02074088(v3, param0, param1, 32, v1, ov6_02241AE4(param4, param3), 0); - sub_02074B30(v3, 7, ¶m3->unk_00); + Pokemon_SetValue(v3, 7, ¶m3->unk_00); v2 = ov6_02242514(param2, param3, v3, param5); GF_ASSERT(v2); @@ -1246,7 +1246,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru } sub_02074044(v3, param0, param1, 32, ov6_02241AE4(param4, param3)); - sub_02074B30(v3, 7, ¶m3->unk_00); + Pokemon_SetValue(v3, 7, ¶m3->unk_00); v2 = ov6_02242514(param2, param3, v3, param5); GF_ASSERT(v2); @@ -1490,8 +1490,8 @@ static BOOL ov6_0224219C (const UnkStruct_ov6_0224222C * param0, const u8 param1 v1 = 0; for (v2 = 0; v2 < param1; v2++) { - v3 = sub_020759F0(param0[v2].unk_00, 6); - v4 = sub_020759F0(param0[v2].unk_00, 7); + v3 = PokemonPersonalData_GetSpeciesValue(param0[v2].unk_00, 6); + v4 = PokemonPersonalData_GetSpeciesValue(param0[v2].unk_00, 7); if ((v3 == param2) || (v4 == param2)) { v0[v1++] = v2; @@ -1502,7 +1502,7 @@ static BOOL ov6_0224219C (const UnkStruct_ov6_0224222C * param0, const u8 param1 return 0; } - *param3 = v0[sub_0201D2E8() % v1]; + *param3 = v0[LCRNG_Next() % v1]; return 1; } @@ -1564,7 +1564,7 @@ static BOOL ov6_022422D0 (const UnkStruct_ov6_022422D0 * param0, Pokemon * param if (param0->unk_0D == 0) { if ((param0->unk_0E == 51) || (param0->unk_0E == 22)) { - v0 = GetMonData(param1, MON_DATA_161, NULL); + v0 = Pokemon_GetValue(param1, MON_DATA_LEVEL, NULL); if (v0 <= 5) { return 0; @@ -1620,7 +1620,7 @@ static void ov6_0224239C (const u32 param0, UnkStruct_0206C638 * param1, BattleP BOOL v6; Pokemon * v7; - v7 = AllocMonZeroed(4); + v7 = Pokemon_New(4); v0 = sub_0202D93C(param1, 4); v1 = sub_0202D93C(param1, 6); v2 = sub_0202D93C(param1, 2); @@ -1629,9 +1629,9 @@ static void ov6_0224239C (const u32 param0, UnkStruct_0206C638 * param1, BattleP v5 = sub_0202D93C(param1, 5); sub_02074158(v7, v0, v1, v2, v3); - sub_02074B30(v7, 7, ¶m0); - sub_02074B30(v7, 160, &v4); - sub_02074B30(v7, 163, &v5); + Pokemon_SetValue(v7, 7, ¶m0); + Pokemon_SetValue(v7, 160, &v4); + Pokemon_SetValue(v7, 163, &v5); v6 = Party_AddPokemon(param2->parties[1], v7); @@ -1694,7 +1694,7 @@ static BOOL ov6_02242514 (const int param0, const UnkStruct_ov6_022422D0 * param int v3; v1 = 0; - v3 = GetMonData(param2, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(param2, MON_DATA_SPECIES, NULL); if (v3 == 422) { v1 = 1; @@ -1717,11 +1717,11 @@ static BOOL ov6_02242514 (const int param0, const UnkStruct_ov6_022422D0 * param v1 = 1; v4 = Unk_ov6_02248FF0[param1->unk_11].unk_00; - v2 = Unk_ov6_02248FF0[param1->unk_11].unk_04[sub_0201D2E8() % v4]; + v2 = Unk_ov6_02248FF0[param1->unk_11].unk_04[LCRNG_Next() % v4]; } if (v1) { - sub_02074B30(param2, 112, (u8 *)&v2); + Pokemon_SetValue(param2, 112, (u8 *)&v2); } } @@ -1758,9 +1758,9 @@ static u8 ov6_022425D4 (const UnkStruct_ov6_0224222C * param0, const UnkStruct_o static void ov6_02242634 (UnkStruct_0203CDB0 * param0, Pokemon * param1, UnkStruct_ov6_02242634 * param2, UnkStruct_ov6_022422D0 * param3) { - if (GetMonData(param1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(param1, MON_DATA_IS_EGG, NULL) == 0) { param3->unk_0D = 0; - param3->unk_0E = GetMonData(param1, MON_DATA_10, NULL); + param3->unk_0E = Pokemon_GetValue(param1, MON_DATA_ABILITY, NULL); } else { param3->unk_0D = 1; param3->unk_0E = 123; diff --git a/src/overlay006/ov6_022426AC.c b/src/overlay006/ov6_022426AC.c index ef3a39ffba..9feb027bc3 100644 --- a/src/overlay006/ov6_022426AC.c +++ b/src/overlay006/ov6_022426AC.c @@ -22,7 +22,7 @@ #include "heap.h" #include "unk_0201D15C.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay006/ov6_022426AC.h" typedef struct UnkStruct_ov6_022426B8_t { @@ -73,7 +73,7 @@ void ov6_022426C0 (UnkStruct_ov6_022426B8 * param0, const int param1) int v2; u8 v3; - v3 = sub_020759F0(param1, 18); + v3 = PokemonPersonalData_GetSpeciesValue(param1, 18); switch (v3) { case 0: @@ -86,7 +86,7 @@ void ov6_022426C0 (UnkStruct_ov6_022426B8 * param0, const int param1) v2 = 2; break; default: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { v2 = 0; } else { v2 = 1; diff --git a/src/overlay006/ov6_02243258.c b/src/overlay006/ov6_02243258.c index e5a7099f11..ddfbd3db7a 100644 --- a/src/overlay006/ov6_02243258.c +++ b/src/overlay006/ov6_02243258.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_02022550_decl.h" #include "struct_decls/struct_02061AB4_decl.h" #include "struct_decls/struct_020711EC_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay101/struct_ov101_021D5D90_decl.h" #include "struct_defs/struct_02008A90.h" @@ -38,7 +38,7 @@ #include "unk_0205E7D0.h" #include "unk_02061804.h" #include "unk_020711EC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay005/ov5_021F0EB0.h" #include "overlay006/ov6_02243258.h" @@ -2069,7 +2069,7 @@ static void * ov6_0224509C (Pokemon * param0, UnkStruct_02008A90 * param1, u32 p GF_ASSERT(v0 != NULL); { - int v1 = GetMonData(param0, MON_DATA_PERSONALITY, NULL); + int v1 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL); sub_02013750(param1->unk_00, param1->unk_02, param2, v0, v1, 0, 2, param1->unk_06); } diff --git a/src/overlay006/ov6_02246034.c b/src/overlay006/ov6_02246034.c index 86ba911233..21a9862cad 100644 --- a/src/overlay006/ov6_02246034.c +++ b/src/overlay006/ov6_02246034.c @@ -3,7 +3,7 @@ #include "inlines.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0202D7B0.h" @@ -15,7 +15,7 @@ #include "unk_020507CC.h" #include "unk_0206AFE0.h" #include "roaming_pokemon.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay006/ov6_02246034.h" @@ -35,12 +35,12 @@ void ov6_02246034 (UnkStruct_0203CDB0 * param0, BattleParams * param1) v5 = param1->parties[1]; v6 = Party_GetPokemonBySlotIndex(v5, 0); v3 = sub_0202D834(param0->unk_0C); - v2 = GetMonData(v6, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); v4 = ov6_02246148(v3, v2); if (v4 != NULL) { - v0 = (u16)(GetMonData(v6, MON_DATA_163, NULL)); - v1 = (u8)(GetMonData(v6, MON_DATA_160, NULL)); + v0 = (u16)(Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL)); + v1 = (u8)(Pokemon_GetValue(v6, MON_DATA_160, NULL)); if (((param1->unk_14 == 0x1) && (v0 == 0))) { sub_0202D914(&v4); diff --git a/src/overlay006/ov6_02246184.c b/src/overlay006/ov6_02246184.c index cae40cf818..6c7acf3ce2 100644 --- a/src/overlay006/ov6_02246184.c +++ b/src/overlay006/ov6_02246184.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay006/struct_ov6_02246204_decl.h" @@ -18,7 +18,7 @@ #include "unk_0202F180.h" #include "map_header.h" #include "unk_020559DC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02092494.h" #include "overlay006/ov6_02246184.h" @@ -71,7 +71,7 @@ UnkStruct_ov6_02246204 * ov6_02246184 (u32 param0, u32 param1) v0->unk_00 = sub_02006FE8(115, param1, 0, param0, 0); v0->unk_10 = param0; v0->unk_0C = param1; - v0->unk_04 = AllocMonZeroed(param0); + v0->unk_04 = Pokemon_New(param0); v0->unk_08 = sub_02025E6C(param0); sub_02025E8C(v0->unk_08); @@ -120,15 +120,15 @@ void ov6_02246254 (UnkStruct_0203CDB0 * param0, UnkStruct_ov6_02246204 * param1, int v4; v1 = Party_GetPokemonBySlotIndex(v0, param2); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); ov6_0224630C(param1->unk_04, param1->unk_00, v3, param1->unk_0C, param1->unk_10, param0->unk_1C->unk_00); - sub_020775EC(v1, param4); - sub_020775EC(param1->unk_04, param5); + Pokemon_Copy(v1, param4); + Pokemon_Copy(param1->unk_04, param5); - param3->unk_00 = sub_02076B10(param4); - param3->unk_04 = sub_02076B10(param5); + param3->unk_00 = Pokemon_GetBoxPokemon(param4); + param3->unk_04 = Pokemon_GetBoxPokemon(param5); param3->unk_08 = param1->unk_08; param3->unk_10 = 1; param3->unk_14 = sub_02025E44(param0->unk_0C); @@ -164,36 +164,36 @@ static void ov6_0224630C (Pokemon * param0, UnkStruct_ov6_0224630C * param1, u32 v0 = ov6_022462E4(param4, param3); - sub_02074B30(param0, 119, v0); + Pokemon_SetValue(param0, 119, v0); Strbuf_Free(v0); v1 = 1; - sub_02074B30(param0, 77, &v1); - sub_02074B30(param0, 70, ¶m1->unk_04); - sub_02074B30(param0, 71, ¶m1->unk_08); - sub_02074B30(param0, 72, ¶m1->unk_0C); - sub_02074B30(param0, 73, ¶m1->unk_10); - sub_02074B30(param0, 74, ¶m1->unk_14); - sub_02074B30(param0, 75, ¶m1->unk_18); - sub_02074B30(param0, 19, ¶m1->unk_24); - sub_02074B30(param0, 20, ¶m1->unk_28); - sub_02074B30(param0, 21, ¶m1->unk_2C); - sub_02074B30(param0, 22, ¶m1->unk_30); - sub_02074B30(param0, 23, ¶m1->unk_34); - sub_02074B30(param0, 6, ¶m1->unk_3C); + Pokemon_SetValue(param0, 77, &v1); + Pokemon_SetValue(param0, 70, ¶m1->unk_04); + Pokemon_SetValue(param0, 71, ¶m1->unk_08); + Pokemon_SetValue(param0, 72, ¶m1->unk_0C); + Pokemon_SetValue(param0, 73, ¶m1->unk_10); + Pokemon_SetValue(param0, 74, ¶m1->unk_14); + Pokemon_SetValue(param0, 75, ¶m1->unk_18); + Pokemon_SetValue(param0, 19, ¶m1->unk_24); + Pokemon_SetValue(param0, 20, ¶m1->unk_28); + Pokemon_SetValue(param0, 21, ¶m1->unk_2C); + Pokemon_SetValue(param0, 22, ¶m1->unk_30); + Pokemon_SetValue(param0, 23, ¶m1->unk_34); + Pokemon_SetValue(param0, 6, ¶m1->unk_3C); v0 = ov6_022462E4(param4, 4 + param3); - sub_02074B30(param0, 145, v0); + Pokemon_SetValue(param0, 145, v0); Strbuf_Free(v0); - sub_02074B30(param0, 157, ¶m1->unk_40); - sub_02074B30(param0, 12, ¶m1->unk_48); + Pokemon_SetValue(param0, 157, ¶m1->unk_40); + Pokemon_SetValue(param0, 12, ¶m1->unk_48); v2 = sub_0203A138(param5); sub_0209304C(param0, NULL, 1, v2, param4); - sub_0207418C(param0); + Pokemon_CalcLevelAndStats(param0); - GF_ASSERT(sub_02075E0C(param0) == 0); + GF_ASSERT(Pokemon_IsShiny(param0) == 0); } diff --git a/src/overlay006/ov6_022465FC.c b/src/overlay006/ov6_022465FC.c index 3efc0e4fbe..d57bd133cd 100644 --- a/src/overlay006/ov6_022465FC.c +++ b/src/overlay006/ov6_022465FC.c @@ -151,7 +151,7 @@ static int ov6_0224673C (UnkStruct_0203CDB0 * param0, const u8 * param1) return v0[0]; } - return v0[sub_0201D35C() % v2]; + return v0[MTRNG_Next() % v2]; } static int ov6_0224678C (UnkStruct_0202440C * param0, int param1, int param2, BOOL param3, BOOL param4, u8 * param5) diff --git a/src/overlay006/ov6_02246A30.c b/src/overlay006/ov6_02246A30.c index ae9f6d7ea4..f94dfd960d 100644 --- a/src/overlay006/ov6_02246A30.c +++ b/src/overlay006/ov6_02246A30.c @@ -193,5 +193,5 @@ int ov6_02246B40 (UnkStruct_0203CDB0 * param0) return 0; } - return v0[sub_0201D35C() % v1]; + return v0[MTRNG_Next() % v1]; } diff --git a/src/overlay006/ov6_02247100.c b/src/overlay006/ov6_02247100.c index f22a85a519..3b0eb12d43 100644 --- a/src/overlay006/ov6_02247100.c +++ b/src/overlay006/ov6_02247100.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_0203A790_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0.h" #include "struct_defs/struct_02049FA8.h" diff --git a/src/overlay006/ov6_022489E4.c b/src/overlay006/ov6_022489E4.c index aa1d9a4d48..5f6a2dd428 100644 --- a/src/overlay006/ov6_022489E4.c +++ b/src/overlay006/ov6_022489E4.c @@ -2,7 +2,7 @@ #include #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020954F0.h" #include "struct_defs/struct_02095C48.h" @@ -13,7 +13,7 @@ #include "strbuf.h" #include "unk_0202CC64.h" #include "unk_02034198.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay006/ov6_022489E4.h" typedef struct { @@ -85,7 +85,7 @@ void ov6_02248AC8 (int param0, int param1, void * param2, void * param3) int v2; u8 * v3; - v1 = PokemonStructSize(); + v1 = Pokemon_StructSize(); v3 = param2; v2 = v3[v1]; @@ -100,7 +100,7 @@ BOOL ov6_02248AF0 (UnkStruct_02095C48 * param0, int param1, const Pokemon * para int v1; int v2; - v1 = PokemonStructSize(); + v1 = Pokemon_StructSize(); v0 = Heap_AllocFromHeap(20, v1 + 1); MI_CpuCopy8(param2, v0, v1); v0[v1] = param1; @@ -122,7 +122,7 @@ void ov6_02248B30 (int param0, int param1, void * param2, void * param3) u8 * v3; int v4; - v1 = PokemonStructSize(); + v1 = Pokemon_StructSize(); v2 = v1 * 4; v3 = param2; @@ -140,7 +140,7 @@ BOOL ov6_02248B70 (UnkStruct_02095C48 * param0, Pokemon ** param1) int v3; int v4; - v1 = PokemonStructSize(); + v1 = Pokemon_StructSize(); v2 = v1 * 4; v0 = param0->unk_569; diff --git a/src/overlay008/ov8_02249960.c b/src/overlay008/ov8_02249960.c index 971c882f9d..a56d66eca8 100644 --- a/src/overlay008/ov8_02249960.c +++ b/src/overlay008/ov8_02249960.c @@ -3929,14 +3929,14 @@ void ov8_0224C198 (UnkStruct_0203CDB0 * param0) if (v6 != 2) { const u8 * v9 = Unk_ov8_0224C6F8[v6]; - int v10 = sub_0201D35C() % v8->unk_08; + int v10 = MTRNG_Next() % v8->unk_08; v1->unk_02 = v10 + v8->unk_04; do { do { - v1->unk_04 = sub_0201D35C() % v8->unk_14; - v1->unk_06 = sub_0201D35C() % v8->unk_18; + v1->unk_04 = MTRNG_Next() % v8->unk_14; + v1->unk_06 = MTRNG_Next() % v8->unk_18; } while (v9[(v1->unk_06 * v8->unk_14) + v1->unk_04] == 1); v1->unk_04 += v8->unk_0C; diff --git a/src/overlay009/ov9_02249960.c b/src/overlay009/ov9_02249960.c index 5d742b4cf8..27f91b32e7 100644 --- a/src/overlay009/ov9_02249960.c +++ b/src/overlay009/ov9_02249960.c @@ -3307,7 +3307,7 @@ static int ov9_0224B964 (UnkStruct_ov101_021D5D90 * param0, void * param1) v2->unk_10.z += v6->z; } - v2->unk_04 = sub_0201D2E8() % ((FX32_ONE * 8)); + v2->unk_04 = LCRNG_Next() % ((FX32_ONE * 8)); v2->unk_08 = 0x800; if ((v2->unk_04 & 0x1)) { diff --git a/src/overlay010/ov10_0221F800.c b/src/overlay010/ov10_0221F800.c index 71507ff161..cee7564ac7 100644 --- a/src/overlay010/ov10_0221F800.c +++ b/src/overlay010/ov10_0221F800.c @@ -19,7 +19,7 @@ #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0200D0F4.h" @@ -74,7 +74,7 @@ #include "unk_020366A0.h" #include "unk_020393C8.h" #include "map_header.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "unk_02079D40.h" #include "party.h" @@ -804,8 +804,8 @@ static u8 ov10_02220014 (UnkStruct_ov10_0221FB28 * param0) ov10_02221440(param0, 2, 0, 0); ov10_02221440(param0, 3, 0, 0); } else if (param0->unk_B76 < 24) { - v0 = (sub_0201D2E8() % param0->unk_B70) - (param0->unk_B70 / 2); - v1 = (sub_0201D2E8() % param0->unk_B71) - (param0->unk_B71 / 2); + v0 = (LCRNG_Next() % param0->unk_B70) - (param0->unk_B70 / 2); + v1 = (LCRNG_Next() % param0->unk_B71) - (param0->unk_B71 / 2); if (((v0 < 0) && (param0->unk_B6C < 0)) || ((v0 > 0) && (param0->unk_B6C > 0))) { v0 *= -1; @@ -1541,7 +1541,7 @@ static void ov10_022211F0 (UnkStruct_ov10_0221FB28 * param0, Party * param1, u16 if (v3 > v1) { v0 = Party_GetPokemonBySlotIndex(param1, v1); - if ((GetMonData(v0, MON_DATA_SPECIES, NULL) == 0) || (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0)) { + if ((Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL) == 0) || (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0)) { continue; } @@ -2044,27 +2044,27 @@ static void ov10_02221D14 (UnkStruct_ov10_0221FB28 * param0, Party * param1, u8 v0 = Party_GetPokemonBySlotIndex(param1, v1); param0->unk_214[v1 + param2].unk_00 = sub_02079D80(v0); - param0->unk_214[v1 + param2].unk_04 = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); + param0->unk_214[v1 + param2].unk_04 = (u16)Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); if (param0->unk_214[v1 + param2].unk_04 == 0) { continue; } - param0->unk_214[v1 + param2].unk_0F = (u16)GetMonData(v0, MON_DATA_IS_EGG, NULL); - param0->unk_214[v1 + param2].unk_06 = (u16)GetMonData(v0, MON_DATA_163, NULL); - param0->unk_214[v1 + param2].unk_08 = (u16)GetMonData(v0, MON_DATA_164, NULL); - param0->unk_214[v1 + param2].unk_0C = (u16)GetMonData(v0, MON_DATA_161, NULL); - param0->unk_214[v1 + param2].unk_0A = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); - param0->unk_214[v1 + param2].unk_10 = (u8)GetMonData(v0, MON_DATA_162, NULL); - param0->unk_214[v1 + param2].unk_11 = (u8)GetMonData(v0, MON_DATA_FORM, NULL); + param0->unk_214[v1 + param2].unk_0F = (u16)Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); + param0->unk_214[v1 + param2].unk_06 = (u16)Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_214[v1 + param2].unk_08 = (u16)Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL); + param0->unk_214[v1 + param2].unk_0C = (u16)Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL); + param0->unk_214[v1 + param2].unk_0A = (u16)Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); + param0->unk_214[v1 + param2].unk_10 = (u8)Pokemon_GetValue(v0, MON_DATA_162, NULL); + param0->unk_214[v1 + param2].unk_11 = (u8)Pokemon_GetValue(v0, MON_DATA_FORM, NULL); - if (GetMonData(v0, MON_DATA_176, NULL) == 1) { + if (Pokemon_GetValue(v0, MON_DATA_176, NULL) == 1) { param0->unk_214[v1 + param2].unk_0E = 0; } else { param0->unk_214[v1 + param2].unk_0E = 1; } - param0->unk_214[v1 + param2].unk_0D = sub_02075D6C(v0); + param0->unk_214[v1 + param2].unk_0D = Pokemon_GetGender(v0); param0->unk_214[v1 + param2].unk_14 = (u8)sub_0208E9F0(v0); } } @@ -2273,7 +2273,7 @@ static void ov10_02222400 (UnkStruct_ov10_0221FB28 * param0, MessageLoader * par v2 = MessageLoader_GetNewStrbuf(param1, 8 + param5); - sub_0200B5CC(param3, 0, sub_02076B10(v0)); + sub_0200B5CC(param3, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param3, param4, v2); Strbuf_Free(v2); sub_0201D78C(v1, 0, param4, 0, 0, 0xff, ((u32)(((15 & 0xff) << 16) | ((14 & 0xff) << 8) | ((0 & 0xff) << 0))), NULL); diff --git a/src/overlay012/ov12_0221FC20.c b/src/overlay012/ov12_0221FC20.c index aeb3109d1b..cbfd0cf59c 100644 --- a/src/overlay012/ov12_0221FC20.c +++ b/src/overlay012/ov12_0221FC20.c @@ -48,7 +48,7 @@ #include "unk_0201DBEC.h" #include "unk_0201F834.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay012/ov12_0221FC20.h" #include "overlay012/ov12_022237EC.h" #include "overlay012/ov12_02225864.h" diff --git a/src/overlay012/ov12_02226B84.c b/src/overlay012/ov12_02226B84.c index da0ffb8dea..6d695dfdd7 100644 --- a/src/overlay012/ov12_02226B84.c +++ b/src/overlay012/ov12_02226B84.c @@ -3539,18 +3539,18 @@ static void ov12_0222A624 (UnkStruct_ov12_0222A624 * param0) G2_SetWnd0InsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3, 1); G2_SetWndOutsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3 | GX_WND_PLANEMASK_OBJ, 1); G2_SetWnd0Position(0, 160, 128, 192); - param0->unk_3C = 35 + (sub_0201D2E8() % 5); + param0->unk_3C = 35 + (LCRNG_Next() % 5); } else { GX_SetVisibleWnd(GX_WNDMASK_W0); G2_SetWnd0InsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3, 1); G2_SetWndOutsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3 | GX_WND_PLANEMASK_OBJ, 1); G2_SetWnd0Position(128, 96 - 10, 256, 192); - param0->unk_3C = 35 + (sub_0201D2E8() % 5); + param0->unk_3C = 35 + (LCRNG_Next() % 5); } break; case 5: case 6: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { if (param0->unk_38 == 0) { param0->unk_38++; sub_0200D5DC(param0->unk_1C, 0, +4); @@ -3565,7 +3565,7 @@ static void ov12_0222A624 (UnkStruct_ov12_0222A624 * param0) break; case 10: case 11: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { if (param0->unk_38 == 1) { param0->unk_38++; sub_0200D5DC(param0->unk_1C, 0, +4); @@ -3580,7 +3580,7 @@ static void ov12_0222A624 (UnkStruct_ov12_0222A624 * param0) break; case 15: case 16: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { if (param0->unk_38 == 2) { param0->unk_38++; sub_0200D5DC(param0->unk_1C, 0, +4); @@ -3595,7 +3595,7 @@ static void ov12_0222A624 (UnkStruct_ov12_0222A624 * param0) break; case 22: case 23: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { if (param0->unk_38 == 3) { param0->unk_38++; sub_0200D5DC(param0->unk_1C, 0, +8); diff --git a/src/overlay012/ov12_0222D6B0.c b/src/overlay012/ov12_0222D6B0.c index 894ffac4e0..fd017df47c 100644 --- a/src/overlay012/ov12_0222D6B0.c +++ b/src/overlay012/ov12_0222D6B0.c @@ -533,7 +533,7 @@ static void ov12_0222DC98 (UnkStruct_0201CD38 * param0, void * param1) UnkStruct_ov12_02235350 v1; int v2; - v2 = 10 + (sub_0201D2E8() % 10); + v2 = 10 + (LCRNG_Next() % 10); sub_0200D550(v0->unk_10, &v1.unk_00, &v1.unk_02); ov12_02225BC8(&v0->unk_14, v1.unk_00, Unk_ov12_0223A14A[v0->unk_0F].unk_00, v1.unk_02, Unk_ov12_0223A14A[v0->unk_0F].unk_02, v2); @@ -670,16 +670,16 @@ void ov12_0222DEFC (UnkStruct_ov12_0221FCDC * param0, UnkStruct_0200C6E4 * param v2->unk_14[v1].unk_0C = 0; v2->unk_14[v1].unk_0D = 0; - v2->unk_14[v1].unk_0E = 10 + (sub_0201D2E8() % 10) + v1; - v2->unk_14[v1].unk_0F = (sub_0201D2E8() % 6); + v2->unk_14[v1].unk_0E = 10 + (LCRNG_Next() % 10) + v1; + v2->unk_14[v1].unk_0F = (LCRNG_Next() % 6); v2->unk_14[v1].unk_38 = 1.0f; v2->unk_14[v1].unk_00 = v2->unk_08; v2->unk_14[v1].unk_04 = v2->unk_0C; v2->unk_14[v1].unk_08 = v2->unk_10; v2->unk_14[v1].unk_3C = &v2->unk_514[v1]; - v4 = Unk_ov12_0223A19A[v0][1] + (sub_0201D2E8() % Unk_ov12_0223A19A[v0][3]); - v5 = Unk_ov12_0223A19A[v0][0] + (sub_0201D2E8() % Unk_ov12_0223A19A[v0][2]); + v4 = Unk_ov12_0223A19A[v0][1] + (LCRNG_Next() % Unk_ov12_0223A19A[v0][3]); + v5 = Unk_ov12_0223A19A[v0][0] + (LCRNG_Next() % Unk_ov12_0223A19A[v0][2]); sub_0200D4C4(v6, v4, v5); sub_0200D6A4(v6, 2); @@ -987,7 +987,7 @@ void ov12_0222E61C (UnkStruct_ov12_0221FCDC * param0, UnkStruct_0200C6E4 * param v0->unk_22[0] = 0; for (v1 = 1; v1 < 4; v1++) { - v0->unk_22[v1] = (sub_0201D2E8() % 4) + (v1 * 5); + v0->unk_22[v1] = (LCRNG_Next() % 4) + (v1 * 5); v0->unk_2C[v1] = sub_0200CE6C(v0->unk_00.unk_08, v0->unk_00.unk_10, &v4); } diff --git a/src/overlay012/ov12_0222E91C.c b/src/overlay012/ov12_0222E91C.c index 5c08de4cc1..94686bee8e 100644 --- a/src/overlay012/ov12_0222E91C.c +++ b/src/overlay012/ov12_0222E91C.c @@ -23,7 +23,7 @@ #include "unk_02018340.h" #include "unk_0201F834.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay012/ov12_0221FC20.h" #include "overlay012/ov12_02225864.h" #include "overlay012/ov12_0222D6B0.h" diff --git a/src/overlay012/ov12_02235E94.c b/src/overlay012/ov12_02235E94.c index f93ea54e32..8ae51dfc82 100644 --- a/src/overlay012/ov12_02235E94.c +++ b/src/overlay012/ov12_02235E94.c @@ -32,7 +32,7 @@ #include "heap.h" #include "unk_0201D15C.h" #include "unk_0202C9F4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02097B18.h" #include "overlay012/ov12_0221FC20.h" #include "overlay012/ov12_022237EC.h" @@ -369,7 +369,7 @@ UnkStruct_ov12_02235FE0 * ov12_02236004 (int param0, const UnkStruct_ov12_022360 void ov12_02236030 (UnkStruct_ov12_02235FE0 * param0, const UnkStruct_ov12_02236030 * param1) { param0->unk_04 = *param1; - param0->unk_9C = GetMonData(param0->unk_04.unk_08, MON_DATA_162, NULL); + param0->unk_9C = Pokemon_GetValue(param0->unk_04.unk_08, MON_DATA_162, NULL); GF_ASSERT(param0->unk_9C < 12 + 1); @@ -379,11 +379,11 @@ void ov12_02236030 (UnkStruct_ov12_02235FE0 * param0, const UnkStruct_ov12_02236 if (param0->unk_04.unk_04 != 0) { param0->unk_98 = param0->unk_04.unk_04; } else { - param0->unk_98 = GetMonData(param0->unk_04.unk_08, MON_DATA_POKEBALL, NULL); + param0->unk_98 = Pokemon_GetValue(param0->unk_04.unk_08, MON_DATA_POKEBALL, NULL); } } else { param0->unk_94 = 1; - GetMonData(param0->unk_04.unk_08, MON_DATA_171, ¶m0->unk_A0); + Pokemon_GetValue(param0->unk_04.unk_08, MON_DATA_171, ¶m0->unk_A0); } } @@ -1632,7 +1632,7 @@ static BOOL ov12_02236F24 (UnkStruct_ov12_02237C54 * param0) int v0; if (ov12_02235EB0(param0->unk_90.unk_00) == 1) { - v0 = (sub_0201D2E8() % 20) + 10; + v0 = (LCRNG_Next() % 20) + 10; sub_0200D7C0(param0->unk_30, 0x2000 * v0); } @@ -1743,7 +1743,7 @@ static BOOL ov12_022371E4 (UnkStruct_ov12_02237C54 * param0) int v0; if (ov12_02235EB0(param0->unk_90.unk_00) == 1) { - v0 = (sub_0201D2E8() % 20) + 10; + v0 = (LCRNG_Next() % 20) + 10; sub_0200D7C0(param0->unk_30, 0x2000 * v0); } @@ -2037,7 +2037,7 @@ UnkStruct_ov12_02237C54 * ov12_02237728 (UnkStruct_ov12_02237728 * param0) { int v1; - v1 = sub_0201D2E8() % 2; + v1 = LCRNG_Next() % 2; if (v1) { v0->unk_22 = +1; diff --git a/src/overlay012/ov12_022380BC.c b/src/overlay012/ov12_022380BC.c index 743972427d..868756b59a 100644 --- a/src/overlay012/ov12_022380BC.c +++ b/src/overlay012/ov12_022380BC.c @@ -13,7 +13,7 @@ #include "narc.h" #include "unk_0200762C.h" #include "unk_020131EC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay012/ov12_022380BC.h" static void ov12_022380DC(UnkStruct_ov12_022380DC * param0, int param1, int param2, int param3); diff --git a/src/overlay013/ov13_0221FC20.c b/src/overlay013/ov13_0221FC20.c index 9e7fbf29eb..7560ccd729 100644 --- a/src/overlay013/ov13_0221FC20.c +++ b/src/overlay013/ov13_0221FC20.c @@ -34,7 +34,7 @@ #include "gx_layers.h" #include "unk_02022594.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -394,7 +394,7 @@ static u8 ov13_0221FFDC (UnkStruct_ov13_022213F0 * param0) if ((ov13_022213F0(param0, v0->unk_11) == 1) && (Item_LoadParam(v0->unk_22, 23, v0->unk_0C) == 0)) { ov13_02221A54(v0->unk_08, v0->unk_22, v0->unk_33, v0->unk_0C); param0->unk_04[v0->unk_11].unk_00 = ov16_0223DFAC(v0->unk_08, v0->unk_28, v0->unk_2C[v0->unk_11]); - v0->unk_20 = GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_163, NULL); + v0->unk_20 = Pokemon_GetValue(param0->unk_04[v0->unk_11].unk_00, MON_DATA_CURRENT_HP, NULL); v0->unk_20 -= param0->unk_04[v0->unk_11].unk_10; param0->unk_2075 = 25; } else { @@ -887,7 +887,7 @@ static u8 ov13_022208A4 (UnkStruct_ov13_022213F0 * param0) ov13_02224144(param0); if (param0->unk_2076 == 5) { - param0->unk_207C[0] = (u16)GetMonData(param0->unk_04[v0->unk_11].unk_00, 58 + v0->unk_34, NULL); + param0->unk_207C[0] = (u16)Pokemon_GetValue(param0->unk_04[v0->unk_11].unk_00, 58 + v0->unk_34, NULL); param0->unk_2078 = 2; } else { param0->unk_04[v0->unk_11].unk_17_3 = sub_0208E9F0(param0->unk_04[v0->unk_11].unk_00); @@ -897,7 +897,7 @@ static u8 ov13_022208A4 (UnkStruct_ov13_022213F0 * param0) ov13_022234A8(param0, v0->unk_11); } - param0->unk_207A = GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_163, NULL); + param0->unk_207A = Pokemon_GetValue(param0->unk_04[v0->unk_11].unk_00, MON_DATA_CURRENT_HP, NULL); param0->unk_2078 = 4; } @@ -954,7 +954,7 @@ static u8 ov13_02220A4C (UnkStruct_ov13_022213F0 * param0) continue; } - param0->unk_207C[v1] = (u16)GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_58 + v1, NULL); + param0->unk_207C[v1] = (u16)Pokemon_GetValue(param0->unk_04[v0->unk_11].unk_00, MON_DATA_MOVE1_CUR_PP + v1, NULL); } ov13_02224144(param0); @@ -1206,62 +1206,62 @@ static void ov13_02220F98 (UnkStruct_ov13_022213F0 * param0) for (v0 = 0; v0 < Party_GetCurrentCount(param0->unk_00->unk_00); v0++) { param0->unk_04[v0].unk_00 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_00, v0); - param0->unk_04[v0].unk_04 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SPECIES, NULL); + param0->unk_04[v0].unk_04 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SPECIES, NULL); if (param0->unk_04[v0].unk_04 == 0) { continue; } - param0->unk_04[v0].unk_06 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_165, NULL); - param0->unk_04[v0].unk_08 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_166, NULL); - param0->unk_04[v0].unk_0A = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_167, NULL); - param0->unk_04[v0].unk_0C = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_168, NULL); - param0->unk_04[v0].unk_0E = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_169, NULL); - param0->unk_04[v0].unk_10 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_163, NULL); - param0->unk_04[v0].unk_12 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_164, NULL); - param0->unk_04[v0].unk_14 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_177, NULL); - param0->unk_04[v0].unk_15 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_178, NULL); - param0->unk_04[v0].unk_16_0 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_161, NULL); - - if (GetMonData(param0->unk_04[v0].unk_00, MON_DATA_176, NULL) == 1) { + param0->unk_04[v0].unk_06 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_ATK, NULL); + param0->unk_04[v0].unk_08 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_DEF, NULL); + param0->unk_04[v0].unk_0A = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SPEED, NULL); + param0->unk_04[v0].unk_0C = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SP_ATK, NULL); + param0->unk_04[v0].unk_0E = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SP_DEF, NULL); + param0->unk_04[v0].unk_10 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_CURRENT_HP, NULL); + param0->unk_04[v0].unk_12 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_MAX_HP, NULL); + param0->unk_04[v0].unk_14 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_177, NULL); + param0->unk_04[v0].unk_15 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_178, NULL); + param0->unk_04[v0].unk_16_0 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_LEVEL, NULL); + + if (Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_176, NULL) == 1) { param0->unk_04[v0].unk_16_7 = 0; } else { param0->unk_04[v0].unk_16_7 = 1; } - param0->unk_04[v0].unk_17_0 = sub_02075D6C(param0->unk_04[v0].unk_00); + param0->unk_04[v0].unk_17_0 = Pokemon_GetGender(param0->unk_04[v0].unk_00); param0->unk_04[v0].unk_17_3 = sub_0208E9F0(param0->unk_04[v0].unk_00); - param0->unk_04[v0].unk_17_7 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_IS_EGG, NULL); - param0->unk_04[v0].unk_18 = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_10, NULL); - param0->unk_04[v0].unk_1A = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_HELD_ITEM, NULL); - param0->unk_04[v0].unk_1C = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_EXP, NULL); - param0->unk_04[v0].unk_20 = sub_02075AD0(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0); + param0->unk_04[v0].unk_17_7 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_IS_EGG, NULL); + param0->unk_04[v0].unk_18 = (u16)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_ABILITY, NULL); + param0->unk_04[v0].unk_1A = (u16)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_HELD_ITEM, NULL); + param0->unk_04[v0].unk_1C = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_EXP, NULL); + param0->unk_04[v0].unk_20 = Pokemon_GetSpeciesBaseExpAt(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0); if (param0->unk_04[v0].unk_16_0 == 100) { param0->unk_04[v0].unk_24 = param0->unk_04[v0].unk_20; } else { - param0->unk_04[v0].unk_24 = sub_02075AD0(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0 + 1); + param0->unk_04[v0].unk_24 = Pokemon_GetSpeciesBaseExpAt(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0 + 1); } - param0->unk_04[v0].unk_28 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_COOL, NULL); - param0->unk_04[v0].unk_29 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_BEAUTY, NULL); - param0->unk_04[v0].unk_2A = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_CUTE, NULL); - param0->unk_04[v0].unk_2B = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SMART, NULL); - param0->unk_04[v0].unk_2C = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_TOUGH, NULL); - param0->unk_04[v0].unk_2D = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_162, NULL); - param0->unk_04[v0].unk_2E = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_FORM, NULL); + param0->unk_04[v0].unk_28 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_COOL, NULL); + param0->unk_04[v0].unk_29 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_BEAUTY, NULL); + param0->unk_04[v0].unk_2A = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_CUTE, NULL); + param0->unk_04[v0].unk_2B = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SMART, NULL); + param0->unk_04[v0].unk_2C = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_TOUGH, NULL); + param0->unk_04[v0].unk_2D = (u16)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_162, NULL); + param0->unk_04[v0].unk_2E = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_FORM, NULL); for (v1 = 0; v1 < 4; v1++) { UnkStruct_ov13_022236B8 * v2 = ¶m0->unk_04[v0].unk_30[v1]; - v2->unk_00 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1 + v1, NULL); + v2->unk_00 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_MOVE1 + v1, NULL); if (v2->unk_00 == 0) { continue; } - v2->unk_02 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_58 + v1, NULL); - v2->unk_03 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_62 + v1, NULL); + v2->unk_02 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_CUR_PP + v1, NULL); + v2->unk_03 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_PP_UPS + v1, NULL); v2->unk_03 = MoveTable_CalcMaxPP(v2->unk_00, v2->unk_03); v2->unk_04 = MoveTable_LoadParam(v2->unk_00, MOVEATTRIBUTE_TYPE); v2->unk_05 = MoveTable_LoadParam(v2->unk_00, MOVEATTRIBUTE_CLASS); @@ -1620,7 +1620,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) if (v0->unk_10 == 0) { v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 77); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1628,7 +1628,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) if ((param0->unk_00->unk_2C[param0->unk_00->unk_11] == param0->unk_00->unk_14) || (param0->unk_00->unk_2C[param0->unk_00->unk_11] == param0->unk_00->unk_15)) { v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 76); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1643,7 +1643,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) v0 = ¶m0->unk_04[param0->unk_00->unk_11]; v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 93); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1653,7 +1653,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) v0 = ¶m0->unk_04[param0->unk_2072]; v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 78); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; diff --git a/src/overlay013/ov13_02221A88.c b/src/overlay013/ov13_02221A88.c index a97ad167d9..7565e53792 100644 --- a/src/overlay013/ov13_02221A88.c +++ b/src/overlay013/ov13_02221A88.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0205AA50.h" #include "overlay013/struct_ov13_0221FC20.h" #include "overlay013/struct_ov13_022213F0.h" @@ -19,7 +19,7 @@ #include "unk_02018340.h" #include "unk_0201D670.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -318,7 +318,7 @@ static void ov13_02221C54 (UnkStruct_ov13_022213F0 * param0, u32 param1, u32 par v2 = Strbuf_Init(12, param0->unk_00->unk_0C); v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, Unk_ov13_02228EC4[param3]); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v1->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v1->unk_00)); sub_0200C388(param0->unk_1FA8, v2, v3); if (param2 == 0) { @@ -1204,7 +1204,7 @@ static void ov13_02223550 (UnkStruct_ov13_022213F0 * param0, u32 param1) v2 = Strbuf_Init(12, param0->unk_00->unk_0C); v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, Unk_ov13_02228EC4[param1]); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v1->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v1->unk_00)); sub_0200C388(param0->unk_1FA8, v2, v3); Strbuf_Free(v3); @@ -1564,7 +1564,7 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) v1 = param0->unk_00; v2 = Item_Load(v1->unk_22, 0, v1->unk_0C); v0 = ov16_0223DFAC(v1->unk_08, v1->unk_28, v1->unk_2C[v1->unk_11]); - v4 = GetMonData(v0, MON_DATA_163, NULL); + v4 = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); v5 = 0; if (Item_Get(v2, 15) != 0) { @@ -1597,12 +1597,12 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) if ((param0->unk_04[v1->unk_11].unk_10 == 0) && (v4 != 0)) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 88); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (param0->unk_04[v1->unk_11].unk_10 != v4) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 82); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B60C(param0->unk_1FA8, 1, v4 - param0->unk_04[v1->unk_11].unk_10, 3, 0, 1); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); @@ -1610,42 +1610,42 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) MessageLoader_GetStrbuf(param0->unk_1FA4, 87, param0->unk_1FAC); } else if (v5 == 0x1) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 92); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x2) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 83); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x4) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 85); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x8) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 86); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x10) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 84); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x20) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 90); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x40) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 91); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 89); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } @@ -1663,7 +1663,7 @@ void ov13_0222449C (UnkStruct_ov13_022213F0 * param0) v0 = ov16_0223DFAC(v1->unk_08, v1->unk_28, v1->unk_2C[v1->unk_11]); v2 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 95); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B630(param0->unk_1FA8, 1, 373); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v2); Strbuf_Free(v2); diff --git a/src/overlay013/ov13_022264F4.c b/src/overlay013/ov13_022264F4.c index a5a75cab3a..b03e62e5dd 100644 --- a/src/overlay013/ov13_022264F4.c +++ b/src/overlay013/ov13_022264F4.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.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_decls/battle_system.h" @@ -38,7 +38,7 @@ #include "gx_layers.h" #include "unk_02022594.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "item.h" @@ -415,7 +415,7 @@ static u8 ov13_02226A5C (UnkStruct_ov13_02227244 * param0) v3 = ov16_0223DFAC(v0->unk_00, v0->unk_10, v1); v4 = MessageLoader_GetNewStrbuf(param0->unk_10, 46); - sub_0200B5CC(param0->unk_14, 0, sub_02076B10(v3)); + sub_0200B5CC(param0->unk_14, 0, Pokemon_GetBoxPokemon(v3)); sub_0200B630(param0->unk_14, 1, 373); sub_0200C388(param0->unk_14, param0->unk_18, v4); Strbuf_Free(v4); diff --git a/src/overlay014/ov14_0221FC20.c b/src/overlay014/ov14_0221FC20.c index d684ad3304..5bbe2c577e 100644 --- a/src/overlay014/ov14_0221FC20.c +++ b/src/overlay014/ov14_0221FC20.c @@ -8,12 +8,12 @@ #include "battle/battle_context.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/battle_system.h" #include "battle/ai_context.h" #include "battle/battle_context.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay014/ov14_0221FC20.h" #include "overlay016/ov16_0223DF00.h" @@ -327,7 +327,7 @@ void ov14_0221FC20 (BattleSystem * param0, BattleContext * param1, u8 param2, u8 v1 = BattleSystem_CheckStruggling(param0, param1, param2, 0, 0xffffffff); for (v0 = 0; v0 < LEARNED_MOVES_MAX; v0++) { - if (v1 & FlagIndex(v0)) { + if (v1 & Pokemon_GetFlagMaskOf(v0)) { param1->aiContext.moveCurPP[v0] = 0; } @@ -1337,7 +1337,7 @@ static void ov14_02220D8C (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_163, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((v2 != v4) && (v2 != v5) && (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 494)) { param1->aiContext.calcTemp++; } } @@ -1375,8 +1375,8 @@ static void ov14_02220EA8 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v0].ability == 23) || (param1->battleMons[v0].ability == 42) || (param1->battleMons[v0].ability == 71)) { param1->aiContext.calcTemp = param1->battleMons[v0].ability; } else { - v2 = sub_020759F0(param1->battleMons[v0].species, 24); - v3 = sub_020759F0(param1->battleMons[v0].species, 25); + v2 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[v0].species, 24); + v3 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[v0].species, 25); if ((v2) && (v3)) { if (BattleSystem_RandNext(param0) & 1) { @@ -1420,8 +1420,8 @@ static void ov14_02220F88 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v0].ability == 23) || (param1->battleMons[v0].ability == 42) || (param1->battleMons[v0].ability == 71)) { v3 = param1->battleMons[v0].ability; } else { - v4 = sub_020759F0(param1->battleMons[v0].species, 24); - v5 = sub_020759F0(param1->battleMons[v0].species, 25); + v4 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[v0].species, 24); + v5 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[v0].species, 25); if ((v4) && (v5)) { if ((v4 != v2) && (v5 != v2)) { @@ -1555,7 +1555,7 @@ static void ov14_022211AC (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_163, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v1, MON_DATA_160, NULL) & v7)) { + if ((v2 != v4) && (v2 != v5) && (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && (Pokemon_GetValue(v1, MON_DATA_160, NULL) & v7)) { ov14_02222D24(param1, v8); return; } @@ -1592,7 +1592,7 @@ static void ov14_022212A0 (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_163, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && ((GetMonData(v1, MON_DATA_160, NULL) & v7) == 0)) { + if ((v2 != v4) && (v2 != v5) && (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && ((Pokemon_GetValue(v1, MON_DATA_160, NULL) & v7) == 0)) { ov14_02222D24(param1, v8); return; } @@ -2235,7 +2235,7 @@ static void ov14_02221D88 (BattleSystem * param0, BattleContext * param1) v4 = ov16_0223DFAC(param0, v0, v3); if (v3 != param1->selectedPartySlot[v0]) { - if (GetMonData(v4, MON_DATA_163, NULL) != GetMonData(v4, MON_DATA_164, NULL)) { + if (Pokemon_GetValue(v4, MON_DATA_CURRENT_HP, NULL) != Pokemon_GetValue(v4, MON_DATA_MAX_HP, NULL)) { ov14_02222D24(param1, v2); break; } @@ -2262,7 +2262,7 @@ static void ov14_02221E18 (BattleSystem * param0, BattleContext * param1) if (v3 != param1->selectedPartySlot[v0]) { for (v4 = 0; v4 < 4; v4++) { - if (GetMonData(v5, MON_DATA_58 + v4, NULL) != GetMonData(v5, MON_DATA_66 + v4, NULL)) { + if (Pokemon_GetValue(v5, MON_DATA_MOVE1_CUR_PP + v4, NULL) != Pokemon_GetValue(v5, MON_DATA_MOVE1_MAX_PP + v4, NULL)) { ov14_02222D24(param1, v2); break; } @@ -2406,16 +2406,16 @@ static void ov14_022220CC (BattleSystem * param0, BattleContext * param1) if (v0 != param1->selectedPartySlot[v4]) { v10 = ov16_0223DFAC(param0, v4, v0); - if ((GetMonData(v10, MON_DATA_163, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((Pokemon_GetValue(v10, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { for (v1 = 0; v1 < 4; v1++) { - v8[v1] = GetMonData(v10, MON_DATA_MOVE1 + v1, NULL); + v8[v1] = Pokemon_GetValue(v10, MON_DATA_MOVE1 + v1, NULL); } for (v1 = 0; v1 < 6; v1++) { - v9[v1] = GetMonData(v10, MON_DATA_HP_IV + v1, NULL); + v9[v1] = Pokemon_GetValue(v10, MON_DATA_HP_IV + v1, NULL); } - v6 = ov14_02222D7C(param0, param1, param1->aiContext.attacker, &v8[0], &v7[0], GetMonData(v10, MON_DATA_HELD_ITEM, NULL), &v9[0], GetMonData(v10, MON_DATA_10, NULL), MON_DATA_PERSONALITY, v2); + v6 = ov14_02222D7C(param0, param1, param1->aiContext.attacker, &v8[0], &v7[0], Pokemon_GetValue(v10, MON_DATA_HELD_ITEM, NULL), &v9[0], Pokemon_GetValue(v10, MON_DATA_ABILITY, NULL), MON_DATA_PERSONALITY, v2); if (v6 > v5) { ov14_02222D24(param1, v3); @@ -2697,7 +2697,7 @@ static void ov14_022227A4 (BattleSystem * param0, BattleContext * param1) v2 = ov14_02222D34(param1, v0); - if (param1->battlersSwitchingMask & FlagIndex(v2)) { + if (param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v2)) { ov14_02222D24(param1, v1); } } @@ -2718,7 +2718,7 @@ static void ov14_022227F4 (BattleSystem * param0, BattleContext * param1) v2 = ov14_02222D34(param1, v0); - if ((param1->battlersSwitchingMask & FlagIndex(v2)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v2)) == 0) { ov14_02222D24(param1, v1); } } @@ -3423,14 +3423,14 @@ static BOOL ov14_0222342C (BattleSystem * param0, BattleContext * param1, int pa for (v0 = 0; v0 < ov16_0223DF60(param0, param2); v0++) { v5 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v5, MON_DATA_163, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[param2])) { + if ((Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[param2])) { for (v1 = 0; v1 < 4; v1++) { - v2 = GetMonData(v5, MON_DATA_MOVE1 + v1, NULL); + v2 = Pokemon_GetValue(v5, MON_DATA_MOVE1 + v1, NULL); v3 = ov16_0225BE3C(param0, param1, v5, v2); if (v2) { v4 = 0; - ov16_022552D4(param1, v2, v3, GetMonData(v5, MON_DATA_10, NULL), Battler_Ability(param1, param2 ^ 1), ov16_02258AB8(param1, param2 ^ 1), ov16_02252060(param1, param2 ^ 1, 27, NULL), ov16_02252060(param1, param2 ^ 1, 28, NULL), &v4); + ov16_022552D4(param1, v2, v3, Pokemon_GetValue(v5, MON_DATA_ABILITY, NULL), Battler_Ability(param1, param2 ^ 1), ov16_02258AB8(param1, param2 ^ 1), ov16_02252060(param1, param2 ^ 1, 27, NULL), ov16_02252060(param1, param2 ^ 1, 28, NULL), &v4); if (v4 & 0x2) { if ((BattleSystem_RandNext(param0) % 3) < 2) { @@ -3515,16 +3515,16 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v9; v0 < v10; v0++) { v12 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v12, MON_DATA_163, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { + if ((Pokemon_GetValue(v12, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { for (v1 = 0; v1 < 4; v1++) { - v6 = GetMonData(v12, MON_DATA_MOVE1 + v1, NULL); + v6 = Pokemon_GetValue(v12, MON_DATA_MOVE1 + v1, NULL); v7 = ov16_0225BE3C(param0, param1, v12, v6); if ((v6) && (param1->aiContext.moveTable[v6].power)) { v8 = 0; if (param1->battleMons[v2].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_10, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, Pokemon_GetValue(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); } if (v8 & 0x2) { @@ -3537,7 +3537,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa v8 = 0; if (param1->battleMons[v3].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_10, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, Pokemon_GetValue(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); } if (v8 & 0x2) { @@ -3554,16 +3554,16 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v9; v0 < v10; v0++) { v12 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v12, MON_DATA_163, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { + if ((Pokemon_GetValue(v12, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { for (v1 = 0; v1 < 4; v1++) { - v6 = GetMonData(v12, MON_DATA_MOVE1 + v1, NULL); + v6 = Pokemon_GetValue(v12, MON_DATA_MOVE1 + v1, NULL); v7 = ov16_0225BE3C(param0, param1, v12, v6); if ((v6) && (param1->aiContext.moveTable[v6].power)) { v8 = 0; if (param1->battleMons[v2].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_10, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, Pokemon_GetValue(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); } if (v8 == 0) { @@ -3576,7 +3576,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa v8 = 0; if (param1->battleMons[v3].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_10, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, Pokemon_GetValue(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); } if (v8 == 0) { @@ -3605,7 +3605,7 @@ static BOOL ov14_02223B34 (BattleSystem * param0, BattleContext * param1, int pa v3 = BattleSystem_BattlerSlot(param0, param2) ^ 1; v2 = ov16_0223E1C4(param0, v3); - if ((param1->battlersSwitchingMask & FlagIndex(v2)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v2)) == 0) { for (v0 = 0; v0 < 4; v0++) { v4 = param1->battleMons[param2].moves[v0]; v5 = ov14_0222327C(param0, param1, param2, v4); @@ -3633,7 +3633,7 @@ static BOOL ov14_02223B34 (BattleSystem * param0, BattleContext * param1, int pa v2 = BattleSystem_Partner(param0, v2); - if ((param1->battlersSwitchingMask & FlagIndex(v2)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v2)) == 0) { for (v0 = 0; v0 < 4; v0++) { v4 = param1->battleMons[param2].moves[v0]; v5 = ov14_0222327C(param0, param1, param2, v4); @@ -3710,8 +3710,8 @@ static BOOL ov14_02223C8C (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v6; v0 < v7; v0++) { v8 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v8, MON_DATA_163, NULL) != 0) && (GetMonData(v8, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v8, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v1]) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v1]) && (v0 != param1->aiSwitchedPartySlot[v2])) { - v4 = GetMonData(v8, MON_DATA_10, NULL); + if ((Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v1]) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v1]) && (v0 != param1->aiSwitchedPartySlot[v2])) { + v4 = Pokemon_GetValue(v8, MON_DATA_ABILITY, NULL); if ((v5 == v4) && (BattleSystem_RandNext(param0) & 1)) { param1->aiSwitchedPartySlot[param2] = v0; @@ -3755,20 +3755,20 @@ static BOOL ov14_02223E10 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v7; v0 < v8; v0++) { v9 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v9, MON_DATA_163, NULL) != 0) && (GetMonData(v9, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v9, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { + if ((Pokemon_GetValue(v9, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v9, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v9, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { v6 = 0; v5 = ov14_0222327C(param0, param1, param1->moveHitBattler[param2], param1->moveHit[param2]); - ov16_022552D4(param1, param1->moveHit[param2], v5, Battler_Ability(param1, param1->moveHitBattler[param2]), GetMonData(v9, MON_DATA_10, NULL), ov16_0225B0FC(param1, GetMonData(v9, MON_DATA_HELD_ITEM, NULL), 1), GetMonData(v9, MON_DATA_177, NULL), GetMonData(v9, MON_DATA_178, NULL), &v6); + ov16_022552D4(param1, param1->moveHit[param2], v5, Battler_Ability(param1, param1->moveHitBattler[param2]), Pokemon_GetValue(v9, MON_DATA_ABILITY, NULL), ov16_0225B0FC(param1, Pokemon_GetValue(v9, MON_DATA_HELD_ITEM, NULL), 1), Pokemon_GetValue(v9, MON_DATA_177, NULL), Pokemon_GetValue(v9, MON_DATA_178, NULL), &v6); if (v6 & param3) { for (v1 = 0; v1 < 4; v1++) { - v4 = GetMonData(v9, MON_DATA_MOVE1 + v1, NULL); + v4 = Pokemon_GetValue(v9, MON_DATA_MOVE1 + v1, NULL); v5 = ov16_0225BE3C(param0, param1, v9, v4); if (v4) { v6 = 0; - ov16_022552D4(param1, v4, v5, GetMonData(v9, MON_DATA_10, NULL), Battler_Ability(param1, param1->moveHitBattler[param2]), ov16_02258AB8(param1, param1->moveHitBattler[param2]), ov16_02252060(param1, param1->moveHitBattler[param2], 27, NULL), ov16_02252060(param1, param1->moveHitBattler[param2], 28, NULL), &v6); + ov16_022552D4(param1, v4, v5, Pokemon_GetValue(v9, MON_DATA_ABILITY, NULL), Battler_Ability(param1, param1->moveHitBattler[param2]), ov16_02258AB8(param1, param1->moveHitBattler[param2]), ov16_02252060(param1, param1->moveHitBattler[param2], 27, NULL), ov16_02252060(param1, param1->moveHitBattler[param2], 28, NULL), &v6); if (v6 & 0x2) { if ((BattleSystem_RandNext(param0) % param4) == 0) { @@ -3864,7 +3864,7 @@ static BOOL ov14_022241A4 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v5; v0 < v6; v0++) { v7 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v7, MON_DATA_163, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { + if ((Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { v1++; } } @@ -3940,7 +3940,7 @@ int ov14_022243BC (BattleSystem * param0, int param1) for (v0 = v4; v0 < v5; v0++) { v6 = ov16_0223DFAC(param0, param1, v0); - if ((GetMonData(v6, MON_DATA_163, NULL) != 0) && (v0 != v7->selectedPartySlot[v1]) && (v0 != v7->selectedPartySlot[v2]) && (v0 != v7->aiSwitchedPartySlot[v1]) && (v0 != v7->aiSwitchedPartySlot[v2])) { + if ((Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL) != 0) && (v0 != v7->selectedPartySlot[v1]) && (v0 != v7->selectedPartySlot[v2]) && (v0 != v7->aiSwitchedPartySlot[v1]) && (v0 != v7->aiSwitchedPartySlot[v2])) { break; } } @@ -3990,7 +3990,7 @@ BOOL ov14_022244B0 (BattleSystem * param0, int param1) for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, v0); - if ((GetMonData(v7, MON_DATA_163, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { v1++; } } @@ -4019,37 +4019,37 @@ BOOL ov14_022244B0 (BattleSystem * param0, int param1) } } else if (ov16_0225B0FC(v8, v2, 15)) { if (v8->battleMons[param1].status & 0x7) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(5); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(5); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 16)) { if ((v8->battleMons[param1].status & 0x8) || (v8->battleMons[param1].status & 0x80)) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(4); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(4); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 17)) { if (v8->battleMons[param1].status & 0x10) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(3); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(3); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 18)) { if (v8->battleMons[param1].status & 0x20) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(2); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(2); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 19)) { if (v8->battleMons[param1].status & 0x40) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(1); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(1); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 20)) { if (v8->battleMons[param1].statusVolatile & 0x7) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(0); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(0); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } diff --git a/src/overlay016/battle_controller.c b/src/overlay016/battle_controller.c index 1bbcbe0e85..4f11599027 100644 --- a/src/overlay016/battle_controller.c +++ b/src/overlay016/battle_controller.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/trainer_data.h" #include "battle/ai_context.h" @@ -32,7 +32,7 @@ #include "heap.h" #include "unk_02025E68.h" #include "unk_02034198.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -369,7 +369,7 @@ static void BattleController_CommandSelectionInput (BattleSystem *battleSys, Bat break; } - if (battleCtx->battlersSwitchingMask & FlagIndex(i)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(i)) { battleCtx->curCommandState[i] = COMMAND_SELECTION_WAIT; battleCtx->battlerActions[i][BATTLE_ACTION_PICK_COMMAND] = BATTLE_CONTROL_AFTER_MOVE; break; @@ -860,7 +860,7 @@ static void BattleController_CheckPreMoveActions(BattleSystem *battleSys, Battle while (battleCtx->turnStartCheckTemp < maxBattlers) { battler = battleCtx->battlerActionOrder[battleCtx->turnStartCheckTemp]; - if (battleCtx->battlersSwitchingMask & FlagIndex(battler)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(battler)) { battleCtx->turnStartCheckTemp++; continue; } @@ -1349,7 +1349,7 @@ static void BattleController_CheckMonConditions(BattleSystem *battleSys, BattleC while (battleCtx->monConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->monConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & FlagIndex(battler)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(battler)) { battleCtx->monConditionCheckTemp++; continue; } @@ -1573,13 +1573,13 @@ static void BattleController_CheckMonConditions(BattleSystem *battleSys, BattleC if (BattleContext_MoveFailed(battleCtx, battler)) { i = BATTLE_SUBSEQ_UPROAR_END; battleCtx->battleMons[battler].statusVolatile &= ~VOLATILE_CONDITION_UPROAR; - battleCtx->fieldConditionsMask &= ((FlagIndex(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); + battleCtx->fieldConditionsMask &= ((Pokemon_GetFlagMaskOf(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); } else if (battleCtx->battleMons[battler].statusVolatile & VOLATILE_CONDITION_UPROAR) { i = BATTLE_SUBSEQ_UPROAR_CONTINUES; } else { i = BATTLE_SUBSEQ_UPROAR_END; battleCtx->battleMons[battler].statusVolatile &= ~VOLATILE_CONDITION_UPROAR; - battleCtx->fieldConditionsMask &= ((FlagIndex(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); + battleCtx->fieldConditionsMask &= ((Pokemon_GetFlagMaskOf(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); } battleCtx->msgBattlerTemp = battler; @@ -1806,7 +1806,7 @@ static void BattleController_CheckSideConditions(BattleSystem *battleSys, Battle case SIDE_COND_CHECK_FUTURE_SIGHT: while (battleCtx->sideConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->sideConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & FlagIndex(battler)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(battler)) { battleCtx->sideConditionCheckTemp++; continue; } @@ -1837,7 +1837,7 @@ static void BattleController_CheckSideConditions(BattleSystem *battleSys, Battle case SIDE_COND_CHECK_PERISH_SONG: while (battleCtx->sideConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->sideConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & FlagIndex(battler)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(battler)) { battleCtx->sideConditionCheckTemp++; continue; } @@ -1959,7 +1959,7 @@ static void ov16_0224DDA8 (BattleSystem * param0, BattleContext * param1) if ((param1->aiContext.usedItemCondition[param1->attacker >> 1] & 1) && (param1->aiContext.usedItemCondition[param1->attacker >> 1] & 0x3e)) { param1->msgTemp = 6; } else { - param1->msgTemp = sub_020787EC(param1->aiContext.usedItemCondition[param1->attacker >> 1]); + param1->msgTemp = Pokemon_GetLowestFlagIndex(param1->aiContext.usedItemCondition[param1->attacker >> 1]); } v1 = (0 + 268); @@ -2196,7 +2196,7 @@ static int ov16_0224E13C (BattleSystem * param0, BattleContext * param1, int * p v0 = ((BattleSystem_RandNext(param0) & 0xff) * (param1->battleMons[param1->attacker].level + v3)) >> 8; if (v0 < v3) { - v0 = BattleSystem_CheckStruggling(param0, param1, param1->attacker, FlagIndex(param1->moveSlot[param1->attacker]), 0xffffffff); + v0 = BattleSystem_CheckStruggling(param0, param1, param1->attacker, Pokemon_GetFlagMaskOf(param1->moveSlot[param1->attacker]), 0xffffffff); if (v0 == 0xf) { param2[0] = (0 + 255); @@ -2205,7 +2205,7 @@ static int ov16_0224E13C (BattleSystem * param0, BattleContext * param1, int * p do { v1 = BattleSystem_RandNext(param0) & 3; - } while (v0 & FlagIndex(v1)); + } while (v0 & Pokemon_GetFlagMaskOf(v1)); param1->moveSlot[param1->attacker] = v1; param1->moveTemp = param1->battleMons[param1->attacker].moves[param1->moveSlot[param1->attacker]]; @@ -2301,7 +2301,7 @@ static BOOL ov16_0224E458 (BattleSystem * param0, BattleContext * param1) } else { param1->moveStatusFlags |= 0x200; } - } else if ((param1->battleMons[param1->attacker].ppCur[v1] == 0) && ((param1->battleStatusMask & 0x200) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0x1000) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0xc00) == 0) && ((param1->fieldConditionsMask & (FlagIndex(param1->attacker) << 8)) == 0) && (v1 < 4)) { + } else if ((param1->battleMons[param1->attacker].ppCur[v1] == 0) && ((param1->battleStatusMask & 0x200) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0x1000) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0xc00) == 0) && ((param1->fieldConditionsMask & (Pokemon_GetFlagMaskOf(param1->attacker) << 8)) == 0) && (v1 < 4)) { param1->moveStatusFlags |= 0x200; } @@ -2574,7 +2574,7 @@ static BOOL ov16_0224E784 (BattleSystem * param0, BattleContext * param1) break; case 13: if (param1->battleMons[param1->attacker].statusVolatile & 0xf0000) { - param1->msgBattlerTemp = sub_020787EC((param1->battleMons[param1->attacker].statusVolatile & 0xf0000) >> 16); + param1->msgBattlerTemp = Pokemon_GetLowestFlagIndex((param1->battleMons[param1->attacker].statusVolatile & 0xf0000) >> 16); if (BattleSystem_RandNext(param0) & 1) { BattleSystem_LoadScript(param1, 1, (0 + 107)); @@ -3218,13 +3218,13 @@ static void ov16_0224F8EC (BattleSystem * param0, BattleContext * param1) if (param1->aiContext.moveTable[param1->moveCur].class == 0) { param1->turnFlags[param1->defender].physicalDamageTakenFrom[param1->attacker] = param1->damage; param1->turnFlags[param1->defender].physicalDamageLastAttacker = param1->attacker; - param1->turnFlags[param1->defender].physicalDamageAttackerMask |= FlagIndex(param1->attacker); + param1->turnFlags[param1->defender].physicalDamageAttackerMask |= Pokemon_GetFlagMaskOf(param1->attacker); param1->selfTurnFlags[param1->defender].physicalDamageTaken = param1->damage; param1->selfTurnFlags[param1->defender].physicalDamageLastAttacker = param1->attacker; } else if (param1->aiContext.moveTable[param1->moveCur].class == 1) { param1->turnFlags[param1->defender].specialDamageTakenFrom[param1->attacker] = param1->damage; param1->turnFlags[param1->defender].specialDamageLastAttacker = param1->attacker; - param1->turnFlags[param1->defender].specialDamageAttackerMask |= FlagIndex(param1->attacker); + param1->turnFlags[param1->defender].specialDamageAttackerMask |= Pokemon_GetFlagMaskOf(param1->attacker); param1->selfTurnFlags[param1->defender].specialDamageTaken = param1->damage; param1->selfTurnFlags[param1->defender].specialDamageLastAttacker = param1->attacker; } @@ -3495,7 +3495,7 @@ static void ov16_0224FEE4 (BattleSystem * param0, BattleContext * param1) while (param1->afterMoveEffectTemp < BattleSystem_MaxBattlers(param0)) { v4 = param1->monSpeedOrder[param1->afterMoveEffectTemp]; - if (param1->battlersSwitchingMask & FlagIndex(v4)) { + if (param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v4)) { param1->afterMoveEffectTemp++; continue; } @@ -3604,7 +3604,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) do { v0 = param1->monSpeedOrder[param1->battlerCounter++]; - if (((param1->battlersSwitchingMask & FlagIndex(v0)) == 0) && (param1->battleMons[v0].curHP)) { + if (((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v0)) == 0) && (param1->battleMons[v0].curHP)) { v2 = BattleSystem_BattlerData(param0, v0); if (((v3 & 0x1) && ((ov16_02263AE4(v2) & 0x1) == 0)) || ((v3 & 0x1) == 0) && (ov16_02263AE4(v2) & 0x1)) { @@ -3626,7 +3626,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) do { v4 = param1->monSpeedOrder[param1->battlerCounter++]; - if (((param1->battlersSwitchingMask & FlagIndex(v4)) == 0) && (param1->battleMons[v4].curHP)) { + if (((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v4)) == 0) && (param1->battleMons[v4].curHP)) { if (v4 != param1->attacker) { ov16_02255F94(param0, param1); param1->defender = v4; @@ -3645,7 +3645,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) static void ov16_02250438 (BattleSystem * param0, BattleContext * param1) { if (param1->battleStatusMask & 0xf0000000) { - param1->faintedMon = sub_020787EC((param1->battleStatusMask & 0xf0000000) >> 28); + param1->faintedMon = Pokemon_GetLowestFlagIndex((param1->battleStatusMask & 0xf0000000) >> 28); param1->battleStatusMask &= (0xf0000000 ^ 0xffffffff); BattleSystem_LoadScript(param1, 1, (0 + 277)); @@ -3871,8 +3871,8 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont for (v5 = 0; v5 < Party_GetCurrentCount(v9); v5++) { v10 = Party_GetPokemonBySlotIndex(v9, v5); - if ((GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { - if (v6 = GetMonData(v10, MON_DATA_163, NULL)) { + if ((Pokemon_GetValue(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if (v6 = Pokemon_GetValue(v10, MON_DATA_CURRENT_HP, NULL)) { v8++; if (param1->selectedPartySlot[v1 ^ 2] != v5) { @@ -3883,7 +3883,7 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont } if (v7 == 0) { - param1->battlersSwitchingMask |= FlagIndex(v1); + param1->battlersSwitchingMask |= Pokemon_GetFlagMaskOf(v1); param1->selectedPartySlot[v1] = 6; } else { param1->commandNext = v4; @@ -3907,13 +3907,13 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont for (v12 = 0; v12 < Party_GetCurrentCount(v14); v12++) { v15 = Party_GetPokemonBySlotIndex(v14, v12); - if ((GetMonData(v15, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v15, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v13 += GetMonData(v15, MON_DATA_163, NULL); + if ((Pokemon_GetValue(v15, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v15, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v13 += Pokemon_GetValue(v15, MON_DATA_CURRENT_HP, NULL); } } if (v13 == 0) { - param1->battlersSwitchingMask |= FlagIndex(v1); + param1->battlersSwitchingMask |= Pokemon_GetFlagMaskOf(v1); param1->selectedPartySlot[v1] = 6; } else { param1->commandNext = v4; @@ -3972,8 +3972,8 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte for (v4 = 0; v4 < Party_GetCurrentCount(v6); v4++) { v7 = Party_GetPokemonBySlotIndex(v6, v4); - if ((GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v5 += GetMonData(v7, MON_DATA_163, NULL); + if ((Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v5 += Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL); } } @@ -4000,16 +4000,16 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte for (v9 = 0; v9 < Party_GetCurrentCount(v11); v9++) { v13 = Party_GetPokemonBySlotIndex(v11, v9); - if ((GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v10 += GetMonData(v13, MON_DATA_163, NULL); + if ((Pokemon_GetValue(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v10 += Pokemon_GetValue(v13, MON_DATA_CURRENT_HP, NULL); } } for (v9 = 0; v9 < Party_GetCurrentCount(v12); v9++) { v13 = Party_GetPokemonBySlotIndex(v12, v9); - if ((GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v10 += GetMonData(v13, MON_DATA_163, NULL); + if ((Pokemon_GetValue(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v10 += Pokemon_GetValue(v13, MON_DATA_CURRENT_HP, NULL); } } @@ -4037,8 +4037,8 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte for (v15 = 0; v15 < Party_GetCurrentCount(v17); v15++) { v18 = Party_GetPokemonBySlotIndex(v17, v15); - if ((GetMonData(v18, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v18, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v16 += GetMonData(v18, MON_DATA_163, NULL); + if ((Pokemon_GetValue(v18, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v18, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v16 += Pokemon_GetValue(v18, MON_DATA_CURRENT_HP, NULL); } } @@ -4120,7 +4120,7 @@ static BOOL BattleController_CheckRange (BattleSystem *battleSys, BattleContext if (battleType & 0x2) { if (*range == 0x100) { - if ((battleCtx->battlersSwitchingMask & FlagIndex(BattleSystem_Partner(battleSys, battler))) == 0) { + if ((battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(BattleSystem_Partner(battleSys, battler))) == 0) { return 1; } else { return 0; @@ -4161,16 +4161,16 @@ static BOOL BattleController_CheckAnyFainted (BattleContext * param0, int param1 int v1; v0 = 0; - v1 = FlagIndex(param0->monSpeedOrder[v0]) << 24; + v1 = Pokemon_GetFlagMaskOf(param0->monSpeedOrder[v0]) << 24; if (param0->battleStatusMask & 0xf000000) { while ((param0->battleStatusMask & v1) == 0) { v0++; - v1 = FlagIndex(param0->monSpeedOrder[v0]) << 24; + v1 = Pokemon_GetFlagMaskOf(param0->monSpeedOrder[v0]) << 24; } param0->battleStatusMask &= (v1 ^ 0xffffffff); - param0->faintedMon = sub_020787EC(v1 >> 24); + param0->faintedMon = Pokemon_GetLowestFlagIndex(v1 >> 24); if (param3 == 1) { BattleSystem_LoadScript(param0, 1, (0 + 6)); @@ -4202,7 +4202,7 @@ static BOOL BattleController_CheckExpPayout (BattleContext * param0, int param1, } param0->battleStatusMask2 &= (v0 ^ 0xffffffff); - param0->faintedMon = sub_020787EC(v0 >> 28); + param0->faintedMon = Pokemon_GetLowestFlagIndex(v0 >> 28); BattleSystem_LoadScript(param0, 1, (0 + 276)); diff --git a/src/overlay016/ov16_0223B140.c b/src/overlay016/ov16_0223B140.c index a37b03746d..4c02f4ebab 100644 --- a/src/overlay016/ov16_0223B140.c +++ b/src/overlay016/ov16_0223B140.c @@ -16,7 +16,7 @@ #include "overlay016/struct_ov16_0225BFFC_decl.h" #include "struct_defs/struct_02008A90.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207A778.h" #include "struct_defs/battle_system.h" #include "struct_defs/struct_0207C690.h" @@ -75,7 +75,7 @@ #include "unk_020366A0.h" #include "unk_02038F8C.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A6DC.h" #include "unk_0207AE68.h" @@ -802,7 +802,7 @@ static void ov16_0223BCB4 (UnkStruct_020067E8 * param0) ov16_0223CE20(v0->unk_00); - sub_0201D2DC(v0->unk_2430); + LCRNG_SetSeed(v0->unk_2430); if (ov16_0223F450(v0)) { sub_020057A4(1796, 0); @@ -978,7 +978,7 @@ static void ov16_0223C210 (BattleSystem * param0) for (v1 = 0; v1 < param0->maxBattlers; v1++) { v2 = ov16_0225B45C(param0, v3, 2, v1); v4 = ov16_0223DFAC(param0, v1, v2); - ov16_0225C038(param0, param0->battlers[v1], GetMonData(v4, MON_DATA_POKEBALL, NULL), v2); + ov16_0225C038(param0, param0->battlers[v1], Pokemon_GetValue(v4, MON_DATA_POKEBALL, NULL), v2); } ov16_0223DECC(); @@ -1086,7 +1086,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) param0->unk_2464[v0] = param1->unk_178[v0]; } - param0->unk_2430 = sub_0201D2D0(); + param0->unk_2430 = LCRNG_GetSeed(); param0->unk_2444 = param1->unk_174; param0->unk_2448 = param1->unk_174; param0->battleStatusMask = param1->unk_164; @@ -1134,8 +1134,8 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v0 = 0; v0 < 4; v0++) { for (v1 = 0; v1 < Party_GetCurrentCount(param1->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param1->parties[v0], v1); - v5 = sub_02075D6C(v3); - sub_02074B30(v3, 111, &v5); + v5 = Pokemon_GetGender(v3); + Pokemon_SetValue(v3, 111, &v5); } } } @@ -1166,7 +1166,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1193,7 +1193,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1221,11 +1221,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = Party_GetPokemonBySlotIndex(param0->parties[v0 & 1], v1); if (v0 > 1) { - if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1249,7 +1249,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1281,11 +1281,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = ov16_0223DFAC(param0, v0, v1); if (v0 == 2) { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL)) && (v8 != v1)) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL)) && (v8 != v1)) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1318,7 +1318,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1347,11 +1347,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = Party_GetPokemonBySlotIndex(param0->parties[v0 & 1], v1); if (v0 > 1) { - if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1378,7 +1378,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1392,7 +1392,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) if (param0->battleType & 0x200) { v3 = Party_GetPokemonBySlotIndex(param0->parties[1], 0); - GetMonData(v3, MON_DATA_144, (u8 *)¶m0->trainers[1].unk_14); + Pokemon_GetValue(v3, MON_DATA_144, (u8 *)¶m0->trainers[1].unk_14); } if (param0->battleType & 0x1) { @@ -1603,7 +1603,7 @@ static void ov16_0223CF8C (UnkStruct_0201CD38 * param0, void * param1) if (v2 != NULL) { if (sub_0208C104(v2->unk_28, v2->unk_2C, (8 * 6)) == 1) { - v5 |= FlagIndex(v3); + v5 |= Pokemon_GetFlagMaskOf(v3); } } } diff --git a/src/overlay016/ov16_0223DF00.c b/src/overlay016/ov16_0223DF00.c index 2c7f611acc..e6a6729209 100644 --- a/src/overlay016/ov16_0223DF00.c +++ b/src/overlay016/ov16_0223DF00.c @@ -34,7 +34,7 @@ #include "struct_defs/struct_0201D738.h" #include "struct_defs/struct_020279FC.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/trainer_data.h" #include "struct_defs/battle_system.h" #include "overlay006/battle_params.h" @@ -63,7 +63,7 @@ #include "unk_0202F1D4.h" #include "unk_02056720.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "party.h" #include "item.h" @@ -588,11 +588,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v6 = 0; if (Item_LoadParam(param4, 15, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0x7) { v3 &= (0x7 ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -608,11 +608,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 16, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0xf88) { v3 &= ((0x8 | 0x80 | 0xf00) ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -625,11 +625,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 17, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0x10) { v3 &= (0x10 ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -642,11 +642,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 18, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0x20) { v3 &= (0x20 ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -659,11 +659,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 19, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0x40) { v3 &= (0x40 ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -780,11 +780,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (Item_LoadParam(param4, 36, 5)) { v3 = Item_LoadParam(param4, 55, 5); - if (GetMonData(v1, MON_DATA_58 + param3, NULL) != GetMonData(v1, MON_DATA_66 + param3, NULL)) { - sub_0207536C(v1, MON_DATA_58 + param3, v3); + if (Pokemon_GetValue(v1, MON_DATA_MOVE1_CUR_PP + param3, NULL) != Pokemon_GetValue(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { + Pokemon_IncreaseValue(v1, MON_DATA_MOVE1_CUR_PP + param3, v3); if ((v4 == param2) || (v5 == param2)) { - if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & FlagIndex(param3)) == 0)) { + if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & Pokemon_GetFlagMaskOf(param3)) == 0)) { ov16_02252A14(v0, param1, 31 + param3, v3); } } @@ -797,11 +797,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v3 = Item_LoadParam(param4, 55, 5); for (param3 = 0; param3 < 4; param3++) { - if (GetMonData(v1, MON_DATA_58 + param3, NULL) != GetMonData(v1, MON_DATA_66 + param3, NULL)) { - sub_0207536C(v1, MON_DATA_58 + param3, v3); + if (Pokemon_GetValue(v1, MON_DATA_MOVE1_CUR_PP + param3, NULL) != Pokemon_GetValue(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { + Pokemon_IncreaseValue(v1, MON_DATA_MOVE1_CUR_PP + param3, v3); if ((v4 == param2) || (v5 == param2)) { - if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & FlagIndex(param3)) == 0)) { + if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & Pokemon_GetFlagMaskOf(param3)) == 0)) { ov16_02252A14(v0, param1, 31 + param3, v3); } } @@ -815,29 +815,29 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v3 = 0; if (Item_LoadParam(param4, 23, 5)) { - if (GetMonData(v1, MON_DATA_163, NULL) == 0) { + if (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) == 0) { v3 = 1; } } else { - v3 = GetMonData(v1, MON_DATA_163, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL); } - if ((v3) && (GetMonData(v1, MON_DATA_163, NULL) != GetMonData(v1, MON_DATA_164, NULL))) { + if ((v3) && (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) != Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL))) { v3 = Item_LoadParam(param4, 54, 5); switch (v3) { case 255: - v3 = GetMonData(v1, MON_DATA_164, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL); break; case 254: - v3 = GetMonData(v1, MON_DATA_164, NULL) / 2; + v3 = Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL) / 2; if (v3 == 0) { v3 = 1; } break; case 253: - v3 = GetMonData(v1, MON_DATA_164, NULL) * 25 / 100; + v3 = Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL) * 25 / 100; if (v3 == 0) { v3 = 1; @@ -847,7 +847,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i break; } - sub_0207536C(v1, MON_DATA_163, v3); + Pokemon_IncreaseValue(v1, MON_DATA_CURRENT_HP, v3); if (!Item_LoadParam(param4, 23, 5)) { if (Battler_Side(param0, param1)) { @@ -864,41 +864,41 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 45, 5)) { - if ((GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) < 100) && (v2 == 1)) { + if ((Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) < 100) && (v2 == 1)) { v6 = Item_LoadParam(param4, 56, 5); } } if (Item_LoadParam(param4, 46, 5)) { - if ((GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) >= 100) && (GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) < 200) && (v2 == 1)) { + if ((Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) >= 100) && (Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) < 200) && (v2 == 1)) { v6 = Item_LoadParam(param4, 57, 5); } } if (Item_LoadParam(param4, 47, 5)) { - if ((GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) >= 200) && (v2 == 1)) { + if ((Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) >= 200) && (v2 == 1)) { v6 = Item_LoadParam(param4, 58, 5); } } if (v6) { if (v6 > 0) { - if (GetMonData(v1, MON_DATA_POKEBALL, NULL) == 11) { + if (Pokemon_GetValue(v1, MON_DATA_POKEBALL, NULL) == 11) { v6++; } - if (GetMonData(v1, MON_DATA_152, NULL) == ov16_0223E24C(param0)) { + if (Pokemon_GetValue(v1, MON_DATA_152, NULL) == ov16_0223E24C(param0)) { v6++; } - v3 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); if (Item_LoadParam(param4, 1, 5) == 53) { v6 = v6 * 150 / 100; } } - sub_0207536C(v1, MON_DATA_FRIENDSHIP, v6); + Pokemon_IncreaseValue(v1, MON_DATA_FRIENDSHIP, v6); if ((v4 == param2) || (v5 == param2)) { ov16_02252A14(v0, param1, 44, v6); @@ -957,13 +957,13 @@ u8 ov16_0223EC58 (BattleSystem * param0, int param1, u8 param2) if (((BattleSystem_BattlerSlot(param0, param1) == 4) && ((param0->battleType & 0x8) == 0))) { if (param0->battleType & 0x4) { - if ((param2 & FlagIndex(BattleSystem_Partner(param0, param1))) == 0) { + if ((param2 & Pokemon_GetFlagMaskOf(BattleSystem_Partner(param0, param1))) == 0) { return 1; } } else { v0 = ov16_0225B45C(param0, param0->battleCtx, 12, 0) & 0xffff; - if (((ov16_0225B45C(param0, param0->battleCtx, 8, 0) == 14) && (v0 > 16)) || (param2 & FlagIndex(0))) { + if (((ov16_0225B45C(param0, param0->battleCtx, 8, 0) == 14) && (v0 > 16)) || (param2 & Pokemon_GetFlagMaskOf(0))) { return 0; } else { return 1; @@ -987,8 +987,8 @@ u16 ov16_0223ECC4 (BattleParams * param0, int * param1, int * param2) while (param0->unk_150) { for (param1[0] = 0; param1[0] < 6; param1[0]++) { - if (param0->unk_150 & FlagIndex(param1[0])) { - param0->unk_150 &= (FlagIndex(param1[0]) ^ 0xffffffff); + if (param0->unk_150 & Pokemon_GetFlagMaskOf(param1[0])) { + param0->unk_150 &= (Pokemon_GetFlagMaskOf(param1[0]) ^ 0xffffffff); break; } } @@ -1087,9 +1087,9 @@ void ov16_0223EE70 (BattleSystem * param0) for (v0 = 0; v0 < ov16_0223DF60(param0, 0); v0++) { v2 = ov16_0223DFAC(param0, 0, v0); - v3 = GetMonData(v2, MON_DATA_SPECIES_EGG, NULL); + v3 = Pokemon_GetValue(v2, MON_DATA_SPECIES_EGG, NULL); - if ((v3 == 412) && (param0->unk_2414[0] & FlagIndex(v0))) { + if ((v3 == 412) && (param0->unk_2414[0] & Pokemon_GetFlagMaskOf(v0))) { switch (ov16_0223E22C(param0)) { default: case 2: @@ -1119,20 +1119,20 @@ void ov16_0223EE70 (BattleSystem * param0) break; } - sub_02074B30(v2, 112, &v1); + Pokemon_SetValue(v2, 112, &v1); } } } void ov16_0223EF2C (BattleSystem * param0, int param1, int param2) { - param0->unk_2414[param1] |= FlagIndex(param2); + param0->unk_2414[param1] |= Pokemon_GetFlagMaskOf(param2); } void ov16_0223EF48 (BattleSystem * param0, Pokemon * param1) { if (param0->unk_98) { - sub_02056A48(param0->unk_98, sub_02076B10(param1)); + sub_02056A48(param0->unk_98, Pokemon_GetBoxPokemon(param1)); } } @@ -1678,7 +1678,7 @@ u32 ov16_0223F904 (Party * param0, UnkStruct_02025E6C * param1) u8 v3; v3 = sub_02025F58(param1); - v1 = sub_02077550(param0) * 4 * v0[v3]; + v1 = Party_GetMaxLevel(param0) * 4 * v0[v3]; v2 = sub_02025F74(param1); if (v1 > v2) { @@ -1704,7 +1704,7 @@ void ov16_0223F938 (BattleSystem * param0, int param1) } } - if (((v0 & 0x1) == 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) == 412)) { + if (((v0 & 0x1) == 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) == 412)) { sub_0202736C(param0->unk_60, v1); } } diff --git a/src/overlay016/ov16_022405FC.c b/src/overlay016/ov16_022405FC.c index f62fc2bfcc..bd9f45a76c 100644 --- a/src/overlay016/ov16_022405FC.c +++ b/src/overlay016/ov16_022405FC.c @@ -30,8 +30,7 @@ #include "struct_defs/struct_020127E8.h" #include "struct_defs/struct_0201EE28.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/struct_02075874.h" +#include "pokemon.h" #include "struct_defs/trainer_data.h" #include "struct_defs/battle_system.h" #include "struct_defs/struct_0208737C.h" @@ -70,7 +69,7 @@ #include "unk_02022594.h" #include "strbuf.h" #include "unk_02025E68.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02079170.h" #include "unk_020797C8.h" @@ -844,7 +843,7 @@ static BOOL ov16_02240A7C (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v2; v0++) { v3 = BattleSystem_BattlerData(param0, v0); - if ((v3->unk_191 & 0x1) && ((param1->battlersSwitchingMask & FlagIndex(v0)) == 0)) { + if ((v3->unk_191 & 0x1) && ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v0)) == 0)) { ov16_02264EF8(param0, param1, v0); } } @@ -1306,7 +1305,7 @@ static BOOL ov16_02241288 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v2; v0++) { v3 = BattleSystem_BattlerData(param0, v0); - if (((v3->unk_191 & 0x1) == 0) && ((param1->battlersSwitchingMask & FlagIndex(v0)) == 0)) { + if (((v3->unk_191 & 0x1) == 0) && ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v0)) == 0)) { ov16_02265314(param0, v0); } } @@ -1618,7 +1617,7 @@ static BOOL ov16_022418C0 (BattleSystem * param0, BattleContext * param1) if (param1->battleMons[v1].curHP == 0) { param1->faintedMon = v1; - param1->battleStatusMask |= (FlagIndex(v1) << 24); + param1->battleStatusMask |= (Pokemon_GetFlagMaskOf(v1) << 24); param1->totalFainted[v1]++; ov16_0224B850(param0, param1, v1); @@ -1632,8 +1631,8 @@ static BOOL ov16_02241924 (BattleSystem * param0, BattleContext * param1) ov16_02248AF0(param1, 1); ov16_02265D98(param0, param1, param1->faintedMon); - param1->battleStatusMask &= (FlagIndex(param1->faintedMon) << 24) ^ 0xffffffff; - param1->battleStatusMask2 |= FlagIndex(param1->faintedMon) << 28; + param1->battleStatusMask &= (Pokemon_GetFlagMaskOf(param1->faintedMon) << 24) ^ 0xffffffff; + param1->battleStatusMask2 |= Pokemon_GetFlagMaskOf(param1->faintedMon) << 28; param1->battlerActions[param1->faintedMon][0] = 39; ov16_02254744(param0, param1, param1->faintedMon); @@ -1917,12 +1916,12 @@ static BOOL ov16_02241D34 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(ov16_0223DF20(param0, 0)); v3++) { v10 = ov16_0223DFAC(param0, 0, v3); - if ((GetMonData(v10, MON_DATA_SPECIES, NULL)) && (GetMonData(v10, MON_DATA_163, NULL))) { - if (param1->monsGainingExp[(param1->faintedMon >> 1) & 1] & FlagIndex(v3)) { + if ((Pokemon_GetValue(v10, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v10, MON_DATA_CURRENT_HP, NULL))) { + if (param1->monsGainingExp[(param1->faintedMon >> 1) & 1] & Pokemon_GetFlagMaskOf(v3)) { v5++; } - v7 = GetMonData(v10, MON_DATA_HELD_ITEM, NULL); + v7 = Pokemon_GetValue(v10, MON_DATA_HELD_ITEM, NULL); v9 = ov16_0225B0FC(param1, v7, 1); if (v9 == 51) { @@ -1931,7 +1930,7 @@ static BOOL ov16_02241D34 (BattleSystem * param0, BattleContext * param1) } } - v8 = sub_020759F0(param1->battleMons[param1->faintedMon].species, 9); + v8 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[param1->faintedMon].species, 9); v8 = (v8 * param1->battleMons[param1->faintedMon].level) / 7; if (v6) { @@ -2013,7 +2012,7 @@ static BOOL ov16_02241F34 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v3; v0++) { if (param1->battlerStatusFlags[v0] & 0x1) { - v2 |= FlagIndex(v0); + v2 |= Pokemon_GetFlagMaskOf(v0); BattleIO_ShowPartyScreen(param0, param1, v0, 1, 0, 6); } } @@ -2022,12 +2021,12 @@ static BOOL ov16_02241F34 (BattleSystem * param0, BattleContext * param1) if (BattleSystem_BattleType(param0) == ((0x4 | 0x1) | 0x2)) { v1 = BattleSystem_Partner(param0, v0); - if (((v2 & FlagIndex(v0)) == 0) && ((v2 & FlagIndex(v1)) == 0)) { - v2 |= FlagIndex(v0); + if (((v2 & Pokemon_GetFlagMaskOf(v0)) == 0) && ((v2 & Pokemon_GetFlagMaskOf(v1)) == 0)) { + v2 |= Pokemon_GetFlagMaskOf(v0); BattleIO_LinkWaitMessage(param0, v0); } } else { - if ((v2 & FlagIndex(v0)) == 0) { + if ((v2 & Pokemon_GetFlagMaskOf(v0)) == 0) { BattleIO_LinkWaitMessage(param0, v0); } } @@ -2063,8 +2062,8 @@ static BOOL ov16_0224200C (BattleSystem * param0, BattleContext * param1) param1->switchedPartySlot[v0] = param1->ioBuffer[v0][0] - 1; v2--; - if ((param1->battleStatusMask2 & (FlagIndex(v0) << 24)) == 0) { - param1->battleStatusMask2 |= (FlagIndex(v0) << 24); + if ((param1->battleStatusMask2 & (Pokemon_GetFlagMaskOf(v0) << 24)) == 0) { + param1->battleStatusMask2 |= (Pokemon_GetFlagMaskOf(v0) << 24); BattleIO_LinkWaitMessage(param0, v0); } } @@ -2109,7 +2108,7 @@ static BOOL ov16_02242134 (BattleSystem * param0, BattleContext * param1) } param1->battlerStatusFlags[v0] &= 0x1 ^ 0xffffffff; - param1->battlersSwitchingMask &= (FlagIndex(v0) ^ 0xffffffff); + param1->battlersSwitchingMask &= (Pokemon_GetFlagMaskOf(v0) ^ 0xffffffff); param1->selectedPartySlot[v0] = param1->switchedPartySlot[v0]; param1->switchedPartySlot[v0] = 6; @@ -2251,7 +2250,7 @@ static BOOL ov16_0224230C (BattleSystem * param0, BattleContext * param1) v3[0] = v4; break; case ((6 + 1) + 9): - v3[0] = FlagIndex(v2); + v3[0] = Pokemon_GetFlagMaskOf(v2); break; case ((6 + 1) + 10): GF_ASSERT(0); @@ -2516,7 +2515,7 @@ static BOOL ov16_02242A14 (BattleSystem * param0, BattleContext * param1) v5 = v6; break; case ((6 + 1) + 9): - v5 = FlagIndex(v3); + v5 = Pokemon_GetFlagMaskOf(v3); break; case ((6 + 1) + 10): GF_ASSERT(0); @@ -2701,7 +2700,7 @@ static BOOL ov16_02242CA4 (BattleSystem * param0, BattleContext * param1) v3[0] = v5; break; case ((6 + 1) + 9): - v3[0] = FlagIndex(v4[0]); + v3[0] = Pokemon_GetFlagMaskOf(v4[0]); break; case ((6 + 1) + 10): v4[0] = v3[0]; @@ -2779,7 +2778,7 @@ static BOOL ov16_02242DBC (BattleSystem * param0, BattleContext * param1) v5 = v7; break; case ((6 + 1) + 9): - v5 = FlagIndex(v6[0]); + v5 = Pokemon_GetFlagMaskOf(v6[0]); break; case ((6 + 1) + 10): v6[0] = v5; @@ -3765,7 +3764,7 @@ static BOOL ov16_02243DBC (BattleSystem * param0, BattleContext * param1) param1->battleMons[param1->attacker].ppCur[v2] = 5; } - param1->battleMons[param1->attacker].moveEffectsData.mimickedMoveSlot |= FlagIndex(v2); + param1->battleMons[param1->attacker].moveEffectsData.mimickedMoveSlot |= Pokemon_GetFlagMaskOf(v2); if (param1->msgMoveTemp == 387) { param1->battleMons[param1->attacker].moveEffectsData.lastResortCount = 0; @@ -4045,7 +4044,7 @@ static BOOL ov16_022445D4 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < 4; v0++) { if ((ov16_02255918(param1->battleMons[param1->attacker].moves[v0])) || (param1->battleMons[param1->attacker].moves[v0] == 264) || (param1->battleMons[param1->attacker].moves[v0] == 253) || (param1->battleMons[param1->attacker].moves[v0] == 448) || (ov16_0225582C(param1, param1->battleMons[param1->attacker].moves[v0]))) { - v1 |= FlagIndex(v0); + v1 |= Pokemon_GetFlagMaskOf(v0); } } @@ -4056,7 +4055,7 @@ static BOOL ov16_022445D4 (BattleSystem * param0, BattleContext * param1) } else { do { v0 = BattleSystem_RandNext(param0) % 4; - } while ((v1 & FlagIndex(v0))); + } while ((v1 & Pokemon_GetFlagMaskOf(v0))); param1->msgMoveTemp = param1->battleMons[param1->attacker].moves[v0]; } @@ -4149,7 +4148,7 @@ static BOOL ov16_02244798 (BattleSystem * param0, BattleContext * param1) if (v0 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if ((param1->battlersSwitchingMask & FlagIndex(v1)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v1)) == 0) { if (ov16_02255AB4(param1, param1->attacker, v1, 43) == 0) { param1->battleMons[v1].status = 0; param1->battleMons[v1].statusVolatile &= (0x8000000 ^ 0xffffffff); @@ -4168,7 +4167,7 @@ static BOOL ov16_02244798 (BattleSystem * param0, BattleContext * param1) if (v0 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if ((param1->battlersSwitchingMask & FlagIndex(v1)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v1)) == 0) { param1->battleMons[v1].status = 0; param1->battleMons[v1].statusVolatile &= (0x8000000 ^ 0xffffffff); } @@ -4198,7 +4197,7 @@ static BOOL ov16_022448E8 (BattleSystem * param0, BattleContext * param1) if ((Battler_Side(param0, param1->attacker)) && ((v2 & (0x4 | 0x80)) == 0)) { ov16_02248AF0(param1, v0); - } else if (param1->sideConditions[v3].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->attacker])) { + } else if (param1->sideConditions[v3].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->attacker])) { ov16_02248AF0(param1, v0); } else if ((Battler_Ability(param1, param1->attacker) == 121) || (Battler_Ability(param1, param1->defender) == 121)) { ov16_02248AF0(param1, v0); @@ -4336,7 +4335,7 @@ static BOOL ov16_02244BC4 (BattleSystem * param0, BattleContext * param1) for (v7 = v8; v7 < v9; v7++) { v3 = Party_GetPokemonBySlotIndex(v2, v7); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { v5++; } } @@ -4352,7 +4351,7 @@ static BOOL ov16_02244BC4 (BattleSystem * param0, BattleContext * param1) } while ((v7 == v11) || (v7 == v12)); v3 = Party_GetPokemonBySlotIndex(v2, v7); - } while ((GetMonData(v3, MON_DATA_SPECIES, NULL) == 0) || (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 1) || (GetMonData(v3, MON_DATA_163, NULL) == 0)); + } while ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL) == 0) || (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 1) || (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL) == 0)); param1->switchedPartySlot[param1->defender] = v7; } else { @@ -4671,7 +4670,7 @@ static BOOL ov16_022455F8 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[param1->msgBattlerTemp].gender == param1->battleMons[param1->sideEffectMon].gender) || (param1->battleMons[param1->sideEffectMon].statusVolatile & 0xf0000) || (param1->battleMons[param1->msgBattlerTemp].gender == 2) || (param1->battleMons[param1->sideEffectMon].gender == 2)) { ov16_02248AF0(param1, v0); } else { - param1->battleMons[param1->sideEffectMon].statusVolatile |= FlagIndex(param1->msgBattlerTemp) << 16; + param1->battleMons[param1->sideEffectMon].statusVolatile |= Pokemon_GetFlagMaskOf(param1->msgBattlerTemp) << 16; } return 0; @@ -4979,7 +4978,7 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) while (TRUE) { v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); - if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((GetMonData(v5, MON_DATA_163, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v5, MON_DATA_160, NULL) == 0))) { + if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (Pokemon_GetValue(v5, MON_DATA_160, NULL) == 0))) { break; } @@ -4988,14 +4987,14 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) } v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); - v2 = GetMonData(v5, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v5, MON_DATA_FORM, NULL); - v4 = GetMonData(v5, MON_DATA_161, NULL); + v2 = Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v5, MON_DATA_FORM, NULL); + v4 = Pokemon_GetValue(v5, MON_DATA_LEVEL, NULL); - param1->damage = sub_020759CC(v2, v3, 1); + param1->damage = PokemonPersonalData_GetFormValue(v2, v3, 1); param1->damage *= param1->aiContext.moveTable[param1->moveCur].power; param1->damage *= ((v4 * 2 / 5) + 2); - param1->damage /= sub_020759CC(param1->battleMons[param1->defender].species, param1->battleMons[param1->defender].formNum, 2); + param1->damage /= PokemonPersonalData_GetFormValue(param1->battleMons[param1->defender].species, param1->battleMons[param1->defender].formNum, 2); param1->damage /= 50; param1->damage += 2; param1->damage *= param1->criticalMul; @@ -5016,7 +5015,7 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) while (TRUE) { v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); - if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((GetMonData(v5, MON_DATA_163, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v5, MON_DATA_160, NULL) == 0))) { + if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (Pokemon_GetValue(v5, MON_DATA_160, NULL) == 0))) { break; } @@ -5062,7 +5061,7 @@ static BOOL ov16_02246004 (BattleSystem * param0, BattleContext * param1) if (v2 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if (((param1->battlersSwitchingMask & FlagIndex(v1)) == 0) && (param1->battlerActions[v1][0] != 39) && (param1->battleMons[v1].curHP) && (param1->turnFlags[param1->attacker].helpingHand == 0) && (param1->turnFlags[v1].helpingHand == 0)) { + if (((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v1)) == 0) && (param1->battlerActions[v1][0] != 39) && (param1->battleMons[v1].curHP) && (param1->turnFlags[param1->attacker].helpingHand == 0) && (param1->turnFlags[v1].helpingHand == 0)) { param1->msgBattlerTemp = v1; param1->turnFlags[v1].helpingHand = 1; } else { @@ -5093,7 +5092,7 @@ static BOOL ov16_022460A8 (BattleSystem * param0, BattleContext * param1) if ((Battler_Side(param0, param1->attacker)) && ((v2 & (0x4 | 0x80)) == 0)) { ov16_02248AF0(param1, v0); - } else if ((param1->sideConditions[v3].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->attacker])) || (param1->sideConditions[v4].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->defender]))) { + } else if ((param1->sideConditions[v3].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->attacker])) || (param1->sideConditions[v4].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->defender]))) { ov16_02248AF0(param1, v0); } else if (((param1->battleMons[param1->attacker].heldItem == 0) && (param1->battleMons[param1->defender].heldItem == 0)) || (ov16_022559DC(param1, param1->attacker) == 0) || (ov16_022559DC(param1, param1->defender) == 0)) { ov16_02248AF0(param1, v0); @@ -5145,9 +5144,9 @@ static BOOL ov16_022461F4 (BattleSystem * param0, BattleContext * param1) if (v3 != param1->selectedPartySlot[param1->attacker]) { v7 = ov16_0223DFAC(param0, param1->attacker, v3); - if ((GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { for (v4 = 0; v4 < 4; v4++) { - v2 = GetMonData(v7, MON_DATA_MOVE1 + v4, NULL); + v2 = Pokemon_GetValue(v7, MON_DATA_MOVE1 + v4, NULL); if ((ov16_02255918(v2) == 0) && (ov16_0225B02C(param0, param1, param1->attacker, v2) == 1)) { v1[v6] = v2; @@ -5229,7 +5228,7 @@ static BOOL ov16_022463E8 (BattleSystem * param0, BattleContext * param1) { ov16_02248AF0(param1, 1); - if (((param1->turnFlags[param1->attacker].physicalDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].physicalDamageAttackerMask & FlagIndex(param1->defender))) || ((param1->turnFlags[param1->attacker].specialDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].specialDamageAttackerMask & FlagIndex(param1->defender)))) { + if (((param1->turnFlags[param1->attacker].physicalDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].physicalDamageAttackerMask & Pokemon_GetFlagMaskOf(param1->defender))) || ((param1->turnFlags[param1->attacker].specialDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].specialDamageAttackerMask & Pokemon_GetFlagMaskOf(param1->defender)))) { param1->powerMul = 20; } else { param1->powerMul = 10; @@ -5300,7 +5299,7 @@ static BOOL ov16_0224650C (BattleSystem * param0, BattleContext * param1) param1->msgBuffer.params[1] = BattleSystem_NicknameTag(param1, param1->defender); param1->msgBuffer.params[2] = param1->battleMons[param1->defender].heldItem; param1->battleMons[param1->defender].heldItem = 0; - param1->sideConditions[v1].knockedOffItemsMask |= FlagIndex(param1->selectedPartySlot[param1->defender]); + param1->sideConditions[v1].knockedOffItemsMask |= Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->defender]); } else { ov16_02248AF0(param1, v0); } @@ -6202,13 +6201,13 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) for (v1 = 0; v1 < ov16_0223DF60(param0, 0); v1++) { v8 = ov16_0223DFAC(param0, 0, v1); - v4 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); - v5 = GetMonData(v8, MON_DATA_HELD_ITEM, NULL); - v6 = GetMonData(v8, MON_DATA_10, NULL); + v4 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_HELD_ITEM, NULL); + v6 = Pokemon_GetValue(v8, MON_DATA_ABILITY, NULL); if ((v6 == 53) && (v4 != 0) && (v4 != 494) && (v5 == 0) && ((BattleSystem_RandNext(param0) % 10) == 0)) { v0 = BattleSystem_RandNext(param0) % 100; - v7 = (GetMonData(v8, MON_DATA_161, NULL) - 1) / 10; + v7 = (Pokemon_GetValue(v8, MON_DATA_LEVEL, NULL) - 1) / 10; if (v7 >= 10) { v7 = 9; @@ -6216,10 +6215,10 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < 9; v2++) { if (Unk_ov16_0226EAA8[v2] > v0) { - sub_02074B30(v8, 6, (u8 *)&Unk_ov16_0226E66C[v7 + v2]); + Pokemon_SetValue(v8, 6, (u8 *)&Unk_ov16_0226E66C[v7 + v2]); break; } else if ((v0 >= 98) && (v0 <= 99)) { - sub_02074B30(v8, 6, (u8 *)&Unk_ov16_0226E590[v7 + (99 - v0)]); + Pokemon_SetValue(v8, 6, (u8 *)&Unk_ov16_0226E590[v7 + (99 - v0)]); break; } } @@ -6228,7 +6227,7 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) if ((v6 == 118) && (v4 != 0) && (v4 != 494) && (v5 == 0)) { v2 = 0; v3 = 10; - v7 = GetMonData(v8, MON_DATA_161, NULL); + v7 = Pokemon_GetValue(v8, MON_DATA_LEVEL, NULL); while (v7 > v3) { v2++; @@ -6239,7 +6238,7 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) if (BattleSystem_RandNext(param0) % 100 < Unk_ov16_0226EAB4[v2]) { v2 = 94; - sub_02074B30(v8, 6, (u8 *)&v2); + Pokemon_SetValue(v8, 6, (u8 *)&v2); } } } @@ -7043,8 +7042,8 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(v8); v3++) { v6 = Party_GetPokemonBySlotIndex(v8, v3); - if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_163, NULL); + if ((Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v4 += Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL); } } @@ -7054,8 +7053,8 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(v9); v3++) { v6 = Party_GetPokemonBySlotIndex(v9, v3); - if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_163, NULL); + if ((Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v4 += Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL); } } } @@ -7074,8 +7073,8 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(v10); v3++) { v6 = Party_GetPokemonBySlotIndex(v10, v3); - if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_163, NULL); + if ((Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v4 += Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL); } } @@ -7240,8 +7239,8 @@ static BOOL ov16_02248708 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v1].curHP) && (param1->selectedPartySlot[v1] != 6)) { v3 = ov16_0223DFAC(param0, v1, param1->selectedPartySlot[v1]); - v4 = GetMonData(v3, MON_DATA_10, NULL); - v5 = GetMonData(v3, MON_DATA_160, NULL); + v4 = Pokemon_GetValue(v3, MON_DATA_ABILITY, NULL); + v5 = Pokemon_GetValue(v3, MON_DATA_160, NULL); if ((param1->battleMons[v1].ability != 30) && (ov16_022577A4(param1, v4, v5) == 0)) { ov16_02248AF0(param1, v2); @@ -7441,7 +7440,7 @@ static BOOL ov16_02248A34 (BattleSystem * param0, BattleContext * param1) v2 = ov16_02248AD0(param1); v3 = ov16_02248B10(param0, param1, v1); - param1->calcTemp = sub_020759CC(v0, v3[0], v2); + param1->calcTemp = PokemonPersonalData_GetFormValue(v0, v3[0], v2); return 0; } @@ -7663,10 +7662,10 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) for (v1 = v2->unk_30[6]; v1 < ov16_0223DF60(v2->unk_00, v6); v1++) { v3 = ov16_0223DFAC(v2->unk_00, v6, v1); - v9 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v9 = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); v10 = Item_LoadParam(v9, 1, 5); - if ((v10 == 51) || (v2->unk_04->monsGainingExp[v5] & FlagIndex(v1))) { + if ((v10 == 51) || (v2->unk_04->monsGainingExp[v5] & Pokemon_GetFlagMaskOf(v1))) { break; } } @@ -7685,10 +7684,10 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) u32 v11; u32 v12; - v9 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v9 = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); v10 = Item_LoadParam(v9, 1, 5); - if (((v8 & 0x1) == 0) && ((v2->unk_04->battleMons[1].curHP + v2->unk_04->battleMons[3].curHP) == 0) && (GetMonData(v3, MON_DATA_163, NULL)) && (v2->unk_04->expJinglePlayed == 0)) { + if (((v8 & 0x1) == 0) && ((v2->unk_04->battleMons[1].curHP + v2->unk_04->battleMons[3].curHP) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL)) && (v2->unk_04->expJinglePlayed == 0)) { sub_0200549C(1127); v2->unk_04->expJinglePlayed = 1; ov16_0223F460(v2->unk_00, 2); @@ -7697,8 +7696,8 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v11 = 0; v4.id = 1; - if ((GetMonData(v3, MON_DATA_163, NULL)) && (GetMonData(v3, MON_DATA_161, NULL) != 100)) { - if (v2->unk_04->monsGainingExp[v5] & FlagIndex(v1)) { + if ((Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL)) && (Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL) != 100)) { + if (v2->unk_04->monsGainingExp[v5] & Pokemon_GetFlagMaskOf(v1)) { v11 = v2->unk_04->gainedExp; } @@ -7715,7 +7714,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) } if (ov16_02259B38(v2->unk_00, v3) == 0) { - if (GetMonData(v3, MON_DATA_LANGUAGE, NULL) != Unk_020E4C44) { + if (Pokemon_GetValue(v3, MON_DATA_LANGUAGE, NULL) != Unk_020E4C44) { v11 = v11 * 170 / 100; } else { v11 = v11 * 150 / 100; @@ -7724,15 +7723,15 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v4.id = 2; } - v12 = GetMonData(v3, MON_DATA_EXP, NULL); - v2->unk_30[3] = v12 - sub_02075AAC(v3); + v12 = Pokemon_GetValue(v3, MON_DATA_EXP, NULL); + v2->unk_30[3] = v12 - Pokemon_GetCurrentLevelBaseExp(v3); v12 += v11; if (v1 == v2->unk_04->selectedPartySlot[v6]) { v2->unk_04->battleMons[v6].exp = v12; } - sub_02074B30(v3, 8, (u8 *)&v12); + Pokemon_SetValue(v3, 8, (u8 *)&v12); ov16_022499C0(ov16_0223DF20(v2->unk_00, v6), v1, v2->unk_04->battleMons[v2->unk_04->faintedMon].species, v2->unk_04->battleMons[v2->unk_04->faintedMon].formNum); } @@ -7791,22 +7790,22 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) int v14[6] = {164, 165, 166, 168, 169, 167}; UnkStruct_ov16_02248E74 * v15; - v13 = GetMonData(v3, MON_DATA_161, NULL); + v13 = Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL); v2->unk_04->unk_17C = Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_02248E74)); v15 = (UnkStruct_ov16_02248E74 *)v2->unk_04->unk_17C; for (v0 = 0; v0 < 6; v0++) { - v15->unk_00[v0] = GetMonData(v3, v14[v0], NULL); + v15->unk_00[v0] = Pokemon_GetValue(v3, v14[v0], NULL); } sub_02075C74(v3, 0, ov16_0223E24C(v2->unk_00)); - sub_020741B8(v3); + Pokemon_CalcStats(v3); if (v2->unk_04->selectedPartySlot[v6] == v1) { ov16_02251C94(v2->unk_00, v2->unk_04, v6, v2->unk_04->selectedPartySlot[v6]); } - v2->unk_04->levelUpMons |= FlagIndex(v1); + v2->unk_04->levelUpMons |= Pokemon_GetFlagMaskOf(v1); ov16_022661CC(v2->unk_00, v2->unk_04, v6); v4.id = 3; @@ -7876,7 +7875,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v4.id = 948; v4.tags = 7; - v4.params[0] = GetMonData(v3, v20[v0], NULL) - v22->unk_00[v0]; + v4.params[0] = Pokemon_GetValue(v3, v20[v0], NULL) - v22->unk_00[v0]; v4.digits = 2; ov16_0223FB78(v2->unk_00, v21, v7, &v4, 80, 16 * v0, 0x2, 28, 0); @@ -7900,7 +7899,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) for (v0 = 0; v0 < 6; v0++) { v4.id = 949; v4.tags = 7; - v4.params[0] = GetMonData(v3, v24[v0], NULL); + v4.params[0] = Pokemon_GetValue(v3, v24[v0], NULL); v4.digits = 3; ov16_0223FB78(v2->unk_00, v25, v7, &v4, 72, 16 * v0, 0x2, 36, 0); @@ -8065,7 +8064,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v4.id = 1190; v4.tags = 10; v4.params[0] = v6 | (v1 << 8); - v4.params[1] = GetMonData(v3, 54 + v2->unk_30[5], NULL); + v4.params[1] = Pokemon_GetValue(v3, 54 + v2->unk_30[5], NULL); v2->unk_30[0] = ov16_0223FB24(v2->unk_00, v7, &v4, ov16_0223EDF0(v2->unk_00)); v2->unk_28++; break; @@ -8083,8 +8082,8 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v2->unk_30[0] = ov16_0223FB24(v2->unk_00, v7, &v4, ov16_0223EDF0(v2->unk_00)); v0 = 0; - sub_02074B30(v3, 62 + v2->unk_30[5], &v0); - sub_02077230(v3, v2->unk_30[4], v2->unk_30[5]); + Pokemon_SetValue(v3, 62 + v2->unk_30[5], &v0); + Pokemon_SetMoveSlot(v3, v2->unk_30[4], v2->unk_30[5]); if (v2->unk_04->selectedPartySlot[v6] == v1) { ov16_02251C94(v2->unk_00, v2->unk_04, v6, v2->unk_04->selectedPartySlot[v6]); @@ -8098,7 +8097,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) } break; case 37: - v2->unk_04->monsGainingExp[v5] &= (FlagIndex(v1) ^ 0xffffffff); + v2->unk_04->monsGainingExp[v5] &= (Pokemon_GetFlagMaskOf(v1) ^ 0xffffffff); v2->unk_30[6] = v1 + 1; v2->unk_28 = 0; break; @@ -8120,17 +8119,17 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) int v5; int v6; Pokemon * v7; - UnkStruct_02075874 * v8; + PokemonPersonalData * v8; - v8 = sub_02075874(param2, param3, 5); + v8 = PokemonPersonalData_FromMonForm(param2, param3, 5); v7 = Party_GetPokemonBySlotIndex(param0, param1); - v4 = GetMonData(v7, MON_DATA_HELD_ITEM, NULL); + v4 = Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL); v5 = Item_LoadParam(v4, 1, 5); v6 = Item_LoadParam(v4, 2, 5); v3 = 0; for (v0 = 0; v0 < 6; v0++) { - v2[v0] = GetMonData(v7, MON_DATA_HP_EV + v0, NULL); + v2[v0] = Pokemon_GetValue(v7, MON_DATA_HP_EV + v0, NULL); v3 += v2[v0]; } @@ -8141,42 +8140,42 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) switch (v0) { case 0: - v1 = sub_020758B0(v8, 10); + v1 = PokemonPersonalData_GetValue(v8, 10); if (v5 == 122) { v1 += v6; } break; case 1: - v1 = sub_020758B0(v8, 11); + v1 = PokemonPersonalData_GetValue(v8, 11); if (v5 == 117) { v1 += v6; } break; case 2: - v1 = sub_020758B0(v8, 12); + v1 = PokemonPersonalData_GetValue(v8, 12); if (v5 == 118) { v1 += v6; } break; case 3: - v1 = sub_020758B0(v8, 13); + v1 = PokemonPersonalData_GetValue(v8, 13); if (v5 == 121) { v1 += v6; } break; case 4: - v1 = sub_020758B0(v8, 14); + v1 = PokemonPersonalData_GetValue(v8, 14); if (v5 == 119) { v1 += v6; } break; case 5: - v1 = sub_020758B0(v8, 15); + v1 = PokemonPersonalData_GetValue(v8, 15); if (v5 == 120) { v1 += v6; @@ -8184,7 +8183,7 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) break; } - if (sub_02077758(param0, FlagIndex(param1))) { + if (sub_02077758(param0, Pokemon_GetFlagMaskOf(param1))) { v1 = v1 * 2; } @@ -8202,10 +8201,10 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) v2[v0] += v1; v3 += v1; - sub_02074B30(v7, 13 + v0, (u8 *)&v2[v0]); + Pokemon_SetValue(v7, 13 + v0, (u8 *)&v2[v0]); } - sub_020759B8(v8); + PokemonPersonalData_Free(v8); } static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) @@ -8223,7 +8222,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v5 = ov16_0223E000(v2->unk_00); v1 = 1; - if (v2->unk_04->battlersSwitchingMask & FlagIndex(v1)) { + if (v2->unk_04->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v1)) { v1 = 3; } @@ -8389,7 +8388,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) sub_02003178(v4, (0x1 | 0x2 | 0x4 | 0x8), 0xffff, 1, 0, 16, 0x0); sub_0200872C(v5, 0, 16, 0, 0x0); v2->unk_28 = 32; - } else if (ov16_0223F9E0(v2->unk_00, GetMonData(v3, MON_DATA_SPECIES, NULL))) { + } else if (ov16_0223F9E0(v2->unk_00, Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL))) { sub_02015738(ov16_0223E220(v2->unk_00), 1); sub_02003178(v4, (0x1 | 0x4), 0xffff, 1, 0, 16, 0x0); sub_0200872C(v5, 0, 16, 0, 0x0); @@ -8541,7 +8540,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) sub_0200F344(1, 0x0); v3 = ov16_0223DFAC(v2->unk_00, v1, v2->unk_04->selectedPartySlot[v1]); - v16 = sub_0208712C(5, 1, GetMonData(v3, MON_DATA_SPECIES, NULL), 10, ov16_0223EDA4(v2->unk_00)); + v16 = sub_0208712C(5, 1, Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), 10, ov16_0223EDA4(v2->unk_00)); v2->unk_50[1] = v16; if (ov16_0223DF60(v2->unk_00, 0) < 6) { @@ -8550,9 +8549,9 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v16->unk_44 = 1174 + ov16_0223F240(v2->unk_00); } - v16->unk_08 = GetMonData(v3, MON_DATA_FORM, NULL); + v16->unk_08 = Pokemon_GetValue(v3, MON_DATA_FORM, NULL); v16->unk_48 = ov16_0223E228(v2->unk_00); - v16->unk_10 = GetMonData(v3, MON_DATA_111, NULL); + v16->unk_10 = Pokemon_GetValue(v3, MON_DATA_GENDER, NULL); v2->unk_50[0] = sub_020067E8(&Unk_020F2DAC, v16, 5); v2->unk_28 = 21; @@ -8587,7 +8586,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v3 = ov16_0223DFAC(v2->unk_00, v1, v2->unk_04->selectedPartySlot[v1]); if (v19->unk_14 == 0) { - sub_02074B30(v3, 120, v19->unk_18); + Pokemon_SetValue(v3, 120, v19->unk_18); ov16_0223F24C(v2->unk_00, (1 + 48)); } @@ -8640,15 +8639,15 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) sub_02079A94(v24, v26); for (v27 = 0; v27 < 4; v27++) { - v28 = GetMonData(v3, MON_DATA_66 + v27, NULL); - sub_02074B30(v3, 58 + v27, &v28); + v28 = Pokemon_GetValue(v3, MON_DATA_MOVE1_MAX_PP + v27, NULL); + Pokemon_SetValue(v3, 58 + v27, &v28); } - if (sub_02077A00(v3) != -1) { + if (Pokemon_SetGiratinaForm(v3) != -1) { ov16_0223F9A0(v2->unk_00, v1); } - sub_020798A0(v24, v26, sub_02076B10(v3)); + sub_020798A0(v24, v26, Pokemon_GetBoxPokemon(v3)); if (v2->unk_28 == 22) { if (v25 == v26) { @@ -8816,10 +8815,10 @@ static int ov16_0224A724 (BattleSystem * param0, BattleContext * param1) } if (param1->msgItemTemp == 5) { - v3 = sub_020759F0(param1->battleMons[param1->defender].species, 8); + v3 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[param1->defender].species, 8); v3 = v3 * Unk_ov16_0226E638[param1->safariCatchCount][0] / Unk_ov16_0226E638[param1->safariCatchCount][1]; } else { - v3 = sub_020759F0(param1->battleMons[param1->defender].species, 8); + v3 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[param1->defender].species, 8); } v4 = 10; @@ -9771,10 +9770,10 @@ static void ov16_0224B520 (BattleSystem * param0, UnkStruct_ov16_0224B7CC * para param1->unk_50[0] = sub_02012744(1, 5); - if (GetMonData(param2, MON_DATA_176, NULL) == 0) { + if (Pokemon_GetValue(param2, MON_DATA_176, NULL) == 0) { v13 = 2; } else { - v13 = GetMonData(param2, MON_DATA_111, NULL); + v13 = Pokemon_GetValue(param2, MON_DATA_GENDER, NULL); } if (v13 == 0) { @@ -9785,8 +9784,8 @@ static void ov16_0224B520 (BattleSystem * param0, UnkStruct_ov16_0224B7CC * para v6 = MessageLoader_GetNewStrbuf(v4, 946); } - sub_0200B5CC(v5, 0, sub_02076B10(param2)); - sub_0200B60C(v5, 1, GetMonData(param2, MON_DATA_161, NULL), 3, 0, 1); + sub_0200B5CC(v5, 0, Pokemon_GetBoxPokemon(param2)); + sub_0200B60C(v5, 1, Pokemon_GetValue(param2, MON_DATA_LEVEL, NULL), 3, 0, 1); sub_0200C388(v5, v7, v6); Strbuf_Free(v6); sub_0201A7A0(&v9); diff --git a/src/overlay016/ov16_0225177C.c b/src/overlay016/ov16_0225177C.c index 978c94c62d..91a4c770ab 100644 --- a/src/overlay016/ov16_0225177C.c +++ b/src/overlay016/ov16_0225177C.c @@ -3,7 +3,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" #include "struct_decls/struct_02098700_decl.h" @@ -22,7 +22,7 @@ #include "strbuf.h" #include "unk_02025E68.h" #include "unk_020366A0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02079170.h" #include "party.h" @@ -191,27 +191,27 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC int v2; UnkStruct_02098700 * v3; - battleCtx->battleMons[battler].species = GetMonData(v0, MON_DATA_SPECIES, 0); - battleCtx->battleMons[battler].attack = GetMonData(v0, MON_DATA_165, 0); - battleCtx->battleMons[battler].defense = GetMonData(v0, MON_DATA_166, 0); - battleCtx->battleMons[battler].speed = GetMonData(v0, MON_DATA_167, 0); - battleCtx->battleMons[battler].spAttack = GetMonData(v0, MON_DATA_168, 0); - battleCtx->battleMons[battler].spDefense = GetMonData(v0, MON_DATA_169, 0); + battleCtx->battleMons[battler].species = Pokemon_GetValue(v0, MON_DATA_SPECIES, 0); + battleCtx->battleMons[battler].attack = Pokemon_GetValue(v0, MON_DATA_ATK, 0); + battleCtx->battleMons[battler].defense = Pokemon_GetValue(v0, MON_DATA_DEF, 0); + battleCtx->battleMons[battler].speed = Pokemon_GetValue(v0, MON_DATA_SPEED, 0); + battleCtx->battleMons[battler].spAttack = Pokemon_GetValue(v0, MON_DATA_SP_ATK, 0); + battleCtx->battleMons[battler].spDefense = Pokemon_GetValue(v0, MON_DATA_SP_DEF, 0); for (v1 = 0; v1 < 4; v1++) { - battleCtx->battleMons[battler].moves[v1] = GetMonData(v0, MON_DATA_MOVE1 + v1, 0); - battleCtx->battleMons[battler].ppCur[v1] = GetMonData(v0, MON_DATA_58 + v1, 0); - battleCtx->battleMons[battler].ppUps[v1] = GetMonData(v0, MON_DATA_62 + v1, 0); + battleCtx->battleMons[battler].moves[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1 + v1, 0); + battleCtx->battleMons[battler].ppCur[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1_CUR_PP + v1, 0); + battleCtx->battleMons[battler].ppUps[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); } - battleCtx->battleMons[battler].hpIV = GetMonData(v0, MON_DATA_HP_IV, 0); - battleCtx->battleMons[battler].attackIV = GetMonData(v0, MON_DATA_ATK_IV, 0); - battleCtx->battleMons[battler].defenseIV = GetMonData(v0, MON_DATA_DEF_IV, 0); - battleCtx->battleMons[battler].speedIV = GetMonData(v0, MON_DATA_SPEED_IV, 0); - battleCtx->battleMons[battler].spAttackIV = GetMonData(v0, MON_DATA_SPATK_IV, 0); - battleCtx->battleMons[battler].spDefenseIV = GetMonData(v0, MON_DATA_SPDEF_IV, 0); - battleCtx->battleMons[battler].isEgg = GetMonData(v0, MON_DATA_IS_EGG, 0); - battleCtx->battleMons[battler].hasNickname = GetMonData(v0, MON_DATA_77, 0); + battleCtx->battleMons[battler].hpIV = Pokemon_GetValue(v0, MON_DATA_HP_IV, 0); + battleCtx->battleMons[battler].attackIV = Pokemon_GetValue(v0, MON_DATA_ATK_IV, 0); + battleCtx->battleMons[battler].defenseIV = Pokemon_GetValue(v0, MON_DATA_DEF_IV, 0); + battleCtx->battleMons[battler].speedIV = Pokemon_GetValue(v0, MON_DATA_SPEED_IV, 0); + battleCtx->battleMons[battler].spAttackIV = Pokemon_GetValue(v0, MON_DATA_SPATK_IV, 0); + battleCtx->battleMons[battler].spDefenseIV = Pokemon_GetValue(v0, MON_DATA_SPDEF_IV, 0); + battleCtx->battleMons[battler].isEgg = Pokemon_GetValue(v0, MON_DATA_IS_EGG, 0); + battleCtx->battleMons[battler].hasNickname = Pokemon_GetValue(v0, MON_DATA_77, 0); if ((battleCtx->battleStatusMask & 0x100) == 0) { for (v1 = 0; v1 < 0x8; v1++) { @@ -230,36 +230,36 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC battleCtx->battleMons[battler].friskAnnounced = 0; battleCtx->battleMons[battler].moldBreakerAnnounced = 0; battleCtx->battleMons[battler].pressureAnnounced = 0; - battleCtx->battleMons[battler].type1 = GetMonData(v0, MON_DATA_177, 0); - battleCtx->battleMons[battler].type2 = GetMonData(v0, MON_DATA_178, 0); - battleCtx->battleMons[battler].gender = sub_02075D6C(v0); - battleCtx->battleMons[battler].isShiny = sub_02075E0C(v0); + battleCtx->battleMons[battler].type1 = Pokemon_GetValue(v0, MON_DATA_177, 0); + battleCtx->battleMons[battler].type2 = Pokemon_GetValue(v0, MON_DATA_178, 0); + battleCtx->battleMons[battler].gender = Pokemon_GetGender(v0); + battleCtx->battleMons[battler].isShiny = Pokemon_IsShiny(v0); if (BattleSystem_BattleType(battleSys) & (0x20 | 0x200)) { battleCtx->battleMons[battler].ability = 0; battleCtx->battleMons[battler].status = 0; battleCtx->battleMons[battler].heldItem = 0; } else { - battleCtx->battleMons[battler].ability = GetMonData(v0, MON_DATA_10, 0); - battleCtx->battleMons[battler].status = GetMonData(v0, MON_DATA_160, 0); - battleCtx->battleMons[battler].heldItem = GetMonData(v0, MON_DATA_HELD_ITEM, 0); + battleCtx->battleMons[battler].ability = Pokemon_GetValue(v0, MON_DATA_ABILITY, 0); + battleCtx->battleMons[battler].status = Pokemon_GetValue(v0, MON_DATA_160, 0); + battleCtx->battleMons[battler].heldItem = Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, 0); } if ((BattleSystem_BattleType(battleSys) & (0x20 | 0x200)) && (Battler_Side(battleSys, battler) == 0)) { battleCtx->battleMons[battler].formNum = 0; } else { - battleCtx->battleMons[battler].formNum = GetMonData(v0, MON_DATA_FORM, 0); + battleCtx->battleMons[battler].formNum = Pokemon_GetValue(v0, MON_DATA_FORM, 0); } - battleCtx->battleMons[battler].level = GetMonData(v0, MON_DATA_161, 0); - battleCtx->battleMons[battler].friendship = GetMonData(v0, MON_DATA_FRIENDSHIP, 0); - battleCtx->battleMons[battler].curHP = GetMonData(v0, MON_DATA_163, 0); - battleCtx->battleMons[battler].maxHP = GetMonData(v0, MON_DATA_164, 0); - battleCtx->battleMons[battler].exp = GetMonData(v0, MON_DATA_EXP, 0); - battleCtx->battleMons[battler].pid = GetMonData(v0, MON_DATA_PERSONALITY, 0); - battleCtx->battleMons[battler].OTId = GetMonData(v0, MON_DATA_OT_ID, 0); - battleCtx->battleMons[battler].OTGender = GetMonData(v0, MON_DATA_OT_GENDER, 0); - battleCtx->battleMons[battler].capturedBall = GetMonData(v0, MON_DATA_POKEBALL, 0); + battleCtx->battleMons[battler].level = Pokemon_GetValue(v0, MON_DATA_LEVEL, 0); + battleCtx->battleMons[battler].friendship = Pokemon_GetValue(v0, MON_DATA_FRIENDSHIP, 0); + battleCtx->battleMons[battler].curHP = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, 0); + battleCtx->battleMons[battler].maxHP = Pokemon_GetValue(v0, MON_DATA_MAX_HP, 0); + battleCtx->battleMons[battler].exp = Pokemon_GetValue(v0, MON_DATA_EXP, 0); + battleCtx->battleMons[battler].pid = Pokemon_GetValue(v0, MON_DATA_PERSONALITY, 0); + battleCtx->battleMons[battler].OTId = Pokemon_GetValue(v0, MON_DATA_OT_ID, 0); + battleCtx->battleMons[battler].OTGender = Pokemon_GetValue(v0, MON_DATA_OT_GENDER, 0); + battleCtx->battleMons[battler].capturedBall = Pokemon_GetValue(v0, MON_DATA_POKEBALL, 0); sub_02098988(battleCtx->battleMons[battler].formNum); v3 = sub_02098700(5); @@ -269,15 +269,15 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC sub_020987BC(v3); sub_02098718(v3); - GetMonData(v0, MON_DATA_117, &battleCtx->battleMons[battler].nickname[0]); - GetMonData(v0, MON_DATA_144, &battleCtx->battleMons[battler].OTName[0]); + Pokemon_GetValue(v0, MON_DATA_117, &battleCtx->battleMons[battler].nickname[0]); + Pokemon_GetValue(v0, MON_DATA_144, &battleCtx->battleMons[battler].OTName[0]); battleCtx->battleMons[battler].timesDamaged = 0; battleCtx->battleMons[battler].trainerMessageFlags = 0; v2 = Battler_Side(battleSys, battler); - if (battleCtx->sideConditions[v2].knockedOffItemsMask & FlagIndex(battleCtx->selectedPartySlot[battler])) { + if (battleCtx->sideConditions[v2].knockedOffItemsMask & Pokemon_GetFlagMaskOf(battleCtx->selectedPartySlot[battler])) { battleCtx->battleMons[battler].heldItem = 0; battleCtx->battleMons[battler].moveEffectsData.canUnburden = 0; } else { @@ -293,26 +293,26 @@ void ov16_02251C94 (BattleSystem * param0, BattleContext * param1, int param2, i int v1; int v2; - param1->battleMons[param2].attack = GetMonData(v0, MON_DATA_165, 0); - param1->battleMons[param2].defense = GetMonData(v0, MON_DATA_166, 0); - param1->battleMons[param2].speed = GetMonData(v0, MON_DATA_167, 0); - param1->battleMons[param2].spAttack = GetMonData(v0, MON_DATA_168, 0); - param1->battleMons[param2].spDefense = GetMonData(v0, MON_DATA_169, 0); - param1->battleMons[param2].level = GetMonData(v0, MON_DATA_161, 0); - param1->battleMons[param2].friendship = GetMonData(v0, MON_DATA_FRIENDSHIP, 0); - param1->battleMons[param2].curHP = GetMonData(v0, MON_DATA_163, 0); - param1->battleMons[param2].maxHP = GetMonData(v0, MON_DATA_164, 0); + param1->battleMons[param2].attack = Pokemon_GetValue(v0, MON_DATA_ATK, 0); + param1->battleMons[param2].defense = Pokemon_GetValue(v0, MON_DATA_DEF, 0); + param1->battleMons[param2].speed = Pokemon_GetValue(v0, MON_DATA_SPEED, 0); + param1->battleMons[param2].spAttack = Pokemon_GetValue(v0, MON_DATA_SP_ATK, 0); + param1->battleMons[param2].spDefense = Pokemon_GetValue(v0, MON_DATA_SP_DEF, 0); + param1->battleMons[param2].level = Pokemon_GetValue(v0, MON_DATA_LEVEL, 0); + param1->battleMons[param2].friendship = Pokemon_GetValue(v0, MON_DATA_FRIENDSHIP, 0); + param1->battleMons[param2].curHP = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, 0); + param1->battleMons[param2].maxHP = Pokemon_GetValue(v0, MON_DATA_MAX_HP, 0); if ((param1->battleMons[param2].statusVolatile & 0x200000) == 0) { for (v1 = 0; v1 < 4; v1++) { - if ((param1->battleMons[param2].moveEffectsData.mimickedMoveSlot & FlagIndex(v1)) == 0) { - param1->battleMons[param2].moves[v1] = GetMonData(v0, MON_DATA_MOVE1 + v1, 0); - param1->battleMons[param2].ppCur[v1] = GetMonData(v0, MON_DATA_58 + v1, 0); - param1->battleMons[param2].ppUps[v1] = GetMonData(v0, MON_DATA_62 + v1, 0); + if ((param1->battleMons[param2].moveEffectsData.mimickedMoveSlot & Pokemon_GetFlagMaskOf(v1)) == 0) { + param1->battleMons[param2].moves[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1 + v1, 0); + param1->battleMons[param2].ppCur[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1_CUR_PP + v1, 0); + param1->battleMons[param2].ppUps[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); } } - param1->battleMons[param2].exp = GetMonData(v0, MON_DATA_EXP, 0); + param1->battleMons[param2].exp = Pokemon_GetValue(v0, MON_DATA_EXP, 0); } } @@ -1499,8 +1499,8 @@ void ov16_022535F0 (BattleSystem * param0, BattleContext * param1, int param2) v1 = BattleSystem_BattleType(param0); while (v0 <= 2) { - if (((param1->battlersSwitchingMask & FlagIndex(v0)) == 0) && ((param1->battlersSwitchingMask & FlagIndex(param2)) == 0) && (param1->battleMons[param2].curHP)) { - param1->monsGainingExp[(param2 >> 1) & 1] |= FlagIndex(param1->selectedPartySlot[v0]); + if (((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v0)) == 0) && ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(param2)) == 0) && (param1->battleMons[param2].curHP)) { + param1->monsGainingExp[(param2 >> 1) & 1] |= Pokemon_GetFlagMaskOf(param1->selectedPartySlot[v0]); } v0 += 2; @@ -1972,7 +1972,7 @@ BOOL BattleSystem_CheckTrainerMessage (BattleSystem * param0, BattleContext * pa for (v3 = 0; v3 < Party_GetCurrentCount(v5); v3++) { v6 = Party_GetPokemonBySlotIndex(v5, v3); - if (GetMonData(v6, MON_DATA_163, NULL)) { + if (Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL)) { v4++; } } @@ -2003,7 +2003,7 @@ BOOL BattleSystem_CheckTrainerMessage (BattleSystem * param0, BattleContext * pa for (v7 = 0; v7 < Party_GetCurrentCount(v9); v7++) { v10 = Party_GetPokemonBySlotIndex(v9, v7); - if (GetMonData(v10, MON_DATA_163, NULL)) { + if (Pokemon_GetValue(v10, MON_DATA_CURRENT_HP, NULL)) { v8++; } } @@ -2092,8 +2092,8 @@ void BattleContext_InitCounters (BattleSystem * param0, BattleContext * param1) v0 = BattleSystem_BattleType(param0); if ((v0 & 0x2) == 0) { - param1->battlersSwitchingMask |= FlagIndex(2); - param1->battlersSwitchingMask |= FlagIndex(3); + param1->battlersSwitchingMask |= Pokemon_GetFlagMaskOf(2); + param1->battlersSwitchingMask |= Pokemon_GetFlagMaskOf(3); } param1->safariCatchCount = 6; @@ -2141,8 +2141,8 @@ void ov16_0225433C (BattleSystem * param0, BattleContext * param1, int param2) } for (v0 = 0; v0 < v1; v0++) { - if (param1->battleMons[v0].statusVolatile & (FlagIndex(param2) << 16)) { - param1->battleMons[v0].statusVolatile &= ((FlagIndex(param2) << 16) ^ 0xffffffff); + if (param1->battleMons[v0].statusVolatile & (Pokemon_GetFlagMaskOf(param2) << 16)) { + param1->battleMons[v0].statusVolatile &= ((Pokemon_GetFlagMaskOf(param2) << 16) ^ 0xffffffff); } if ((param1->battleMons[v0].statusVolatile & 0xe000) && (param1->battleMons[v0].moveEffectsData.bindTarget == param2)) { @@ -2184,7 +2184,7 @@ void ov16_0225433C (BattleSystem * param0, BattleContext * param1, int param2) param1->conversion2Battler[param2] = 0; param1->conversion2Type[param2] = 0; param1->metronomeMove[param2] = 0; - param1->fieldConditionsMask &= ((FlagIndex(param2) << 8) ^ 0xffffffff); + param1->fieldConditionsMask &= ((Pokemon_GetFlagMaskOf(param2) << 8) ^ 0xffffffff); if (param1->battleMons[param2].moveEffectsMask & 0x800000) { v0 = param1->battleMons[param2].attack; @@ -2226,8 +2226,8 @@ void ov16_02254744 (BattleSystem * param0, BattleContext * param1, int param2) param1->battleMons[v0].statusVolatile &= (0x4000000 ^ 0xffffffff); } - if (param1->battleMons[v0].statusVolatile & (FlagIndex(param2) << 16)) { - param1->battleMons[v0].statusVolatile &= ((FlagIndex(param2) << 16) ^ 0xffffffff); + if (param1->battleMons[v0].statusVolatile & (Pokemon_GetFlagMaskOf(param2) << 16)) { + param1->battleMons[v0].statusVolatile &= ((Pokemon_GetFlagMaskOf(param2) << 16) ^ 0xffffffff); } if ((param1->battleMons[v0].statusVolatile & 0xe000) && (param1->battleMons[v0].moveEffectsData.bindTarget == param2)) { @@ -2265,7 +2265,7 @@ void ov16_02254744 (BattleSystem * param0, BattleContext * param1, int param2) param1->conversion2Battler[param2] = 0; param1->conversion2Type[param2] = 0; param1->metronomeMove[param2] = 0; - param1->fieldConditionsMask &= ((FlagIndex(param2) << 8) ^ 0xffffffff); + param1->fieldConditionsMask &= ((Pokemon_GetFlagMaskOf(param2) << 8) ^ 0xffffffff); for (v0 = 0; v0 < v1; v0++) { if ((v0 != param2) && (Battler_Side(param0, v0) != Battler_Side(param0, param2))) { @@ -2318,39 +2318,39 @@ int BattleSystem_CheckStruggling (BattleSystem *battleSys, BattleContext *battle for (v0 = 0; v0 < 4; v0++) { if ((battleCtx->battleMons[battler].moves[v0] == 0) && (struggleChecksMask & 0x1)) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].ppCur[v0] == 0) && (struggleChecksMask & 0x2)) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].moves[v0] == battleCtx->battleMons[battler].moveEffectsData.disabledMove) && (struggleChecksMask & 0x4)) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].moves[v0] == battleCtx->movePrevByBattler[battler]) && (struggleChecksMask & 0x8) && (battleCtx->battleMons[battler].statusVolatile & 0x80000000)) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].moveEffectsData.tauntedTurns) && (struggleChecksMask & 0x10) && (battleCtx->aiContext.moveTable[battleCtx->battleMons[battler].moves[v0]].power == 0)) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((ov16_02255EF4(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x20)) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((ov16_02256044(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x40)) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((ov16_02256078(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x80)) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].moveEffectsData.encoredMove) && (battleCtx->battleMons[battler].moveEffectsData.encoredMove != battleCtx->battleMons[battler].moves[v0])) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if (((v1 == 55) || (v1 == 115) || (v1 == 125)) && (struggleChecksMask & 0x200)) { @@ -2358,7 +2358,7 @@ int BattleSystem_CheckStruggling (BattleSystem *battleSys, BattleContext *battle battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove = 0; } else { if ((battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove) && (battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove != battleCtx->battleMons[battler].moves[v0])) { - moveFlags |= FlagIndex(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } } } @@ -2371,49 +2371,49 @@ BOOL BattleSystem_CanUseMove (BattleSystem *battleSys, BattleContext *battleCtx, { BOOL result = TRUE; - if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x4) & FlagIndex(moveSlot)) { + if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x4) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 10; msgOut->id = 609; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x8) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x8) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 2; msgOut->id = 612; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x10) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x10) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 10; msgOut->id = 613; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x20) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x20) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 10; msgOut->id = 616; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x40) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x40) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 10; msgOut->id = 1001; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x80) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x80) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 34; msgOut->id = 1057; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = 377; msgOut->params[2] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x200) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x200) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 24; msgOut->id = 911; msgOut->params[0] = battleCtx->battleMons[battler].heldItem; msgOut->params[1] = battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x2) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x2) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 0; msgOut->id = 823; result = FALSE; @@ -2898,7 +2898,7 @@ int BattleSystem_CountAbility (BattleSystem * param0, BattleContext * param1, in case 4: for (v1 = 0; v1 < v2; v1++) { if ((Battler_Side(param0, v1) != Battler_Side(param0, param3)) && (param1->battleMons[v1].curHP) && (Battler_Ability(param1, v1) == param4)) { - v0 |= FlagIndex(v1); + v0 |= Pokemon_GetFlagMaskOf(v1); } } break; @@ -3028,7 +3028,7 @@ BOOL ov16_02255980 (BattleSystem * param0, BattleContext * param1, int param2) v0 = 0; v1 = Battler_Side(param0, param2); - if ((param1->battleMons[param2].heldItem) && ((param1->sideConditions[v1].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param2])) == 0) && (Item_IsMail(param1->battleMons[param2].heldItem) == 0)) { + if ((param1->battleMons[param2].heldItem) && ((param1->sideConditions[v1].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param2])) == 0) && (Item_IsMail(param1->battleMons[param2].heldItem) == 0)) { v0 = 1; } @@ -3137,7 +3137,7 @@ BOOL ov16_02255B10 (BattleSystem * param0, BattleContext * param1, int param2) for (v6 = v7; v6 < v8; v6++) { v2 = Party_GetPokemonBySlotIndex(v1, v6); - if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v2, MON_DATA_163, NULL)) && (v10 != v6) && (v11 != v6)) { + if ((Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v2, MON_DATA_CURRENT_HP, NULL)) && (v10 != v6) && (v11 != v6)) { v4++; } } @@ -4534,7 +4534,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 0; - if (sub_02077648(param1->battleMons[param2].pid, 0) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 0) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4548,7 +4548,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 1; - if (sub_02077648(param1->battleMons[param2].pid, 1) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 1) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4562,7 +4562,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 2; - if (sub_02077648(param1->battleMons[param2].pid, 2) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 2) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4576,7 +4576,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 3; - if (sub_02077648(param1->battleMons[param2].pid, 3) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 3) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4590,7 +4590,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 4; - if (sub_02077648(param1->battleMons[param2].pid, 4) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 4) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4943,7 +4943,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 0; - if (sub_02077648(param1->battleMons[param2].pid, 0) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 0) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4957,7 +4957,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 1; - if (sub_02077648(param1->battleMons[param2].pid, 1) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 1) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4971,7 +4971,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 2; - if (sub_02077648(param1->battleMons[param2].pid, 2) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 2) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4985,7 +4985,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 3; - if (sub_02077648(param1->battleMons[param2].pid, 3) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 3) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4999,7 +4999,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 4; - if (sub_02077648(param1->battleMons[param2].pid, 4) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 4) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -5203,7 +5203,7 @@ BOOL ov16_022588BC (BattleSystem * param0, BattleContext * param1, int * param2) switch (v2) { case 116: - if ((param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v4].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->attacker])) == 0) && (param1->moveCur != 282) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && ((param1->battleStatusMask2 & 0x10) == 0) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { + if ((param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v4].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->attacker])) == 0) && (param1->moveCur != 282) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && ((param1->battleStatusMask2 & 0x10) == 0) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { param2[0] = (0 + 216); v0 = 1; } @@ -5476,7 +5476,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 0; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 0) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 0) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5490,7 +5490,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 1; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 1) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 1) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5504,7 +5504,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 2; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 2) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 2) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5518,7 +5518,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 3; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 3) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 3) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5532,7 +5532,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 4; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 4) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 4) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5755,7 +5755,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 0; - if (sub_02077648(param1->battleMons[param1->defender].pid, 0) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 0) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5765,7 +5765,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 1; - if (sub_02077648(param1->battleMons[param1->defender].pid, 1) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 1) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5775,7 +5775,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 2; - if (sub_02077648(param1->battleMons[param1->defender].pid, 2) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 2) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5785,7 +5785,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 3; - if (sub_02077648(param1->battleMons[param1->defender].pid, 3) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 3) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5795,7 +5795,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 4; - if (sub_02077648(param1->battleMons[param1->defender].pid, 4) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 4) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -6007,7 +6007,7 @@ void ov16_02259A5C (BattleSystem * param0, BattleContext * param1, Pokemon * par v2 = ov16_0223E22C(param0); if (BattleSystem_BattleType(param0) & 0x200) { - v3 = GetMonData(param2, MON_DATA_POKEBALL, NULL); + v3 = Pokemon_GetValue(param2, MON_DATA_POKEBALL, NULL); } else { v3 = param1->msgItemTemp; } @@ -6063,9 +6063,9 @@ BOOL ov16_02259B38 (BattleSystem * param0, Pokemon * param1) v2 = sub_02025F30(v0); v3 = sub_02025EF0(v0); - GetMonData(param1, MON_DATA_144, &v4[0]); + Pokemon_GetValue(param1, MON_DATA_144, &v4[0]); - if ((v1 == GetMonData(param1, MON_DATA_OT_ID, NULL)) && (v2 == GetMonData(param1, MON_DATA_OT_GENDER, NULL)) && (sub_02002238(v3, &v4[0], 7) == 0)) { + if ((v1 == Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL)) && (v2 == Pokemon_GetValue(param1, MON_DATA_OT_GENDER, NULL)) && (sub_02002238(v3, &v4[0], 7) == 0)) { return 1; } @@ -6158,7 +6158,7 @@ BOOL ov16_02259B9C (BattleSystem * param0, BattleContext * param1, int * param2) } if ((param1->battleMons[param1->msgBattlerTemp].species == 493) && (param1->battleMons[param1->msgBattlerTemp].curHP) && (Battler_Ability(param1, param1->msgBattlerTemp) == 121)) { - v1 = sub_02077988(Item_LoadParam(param1->battleMons[param1->msgBattlerTemp].heldItem, 1, 5)); + v1 = Pokemon_GetArceusTypeOf(Item_LoadParam(param1->battleMons[param1->msgBattlerTemp].heldItem, 1, 5)); if (param1->battleMons[param1->msgBattlerTemp].formNum != v1) { param1->battleMons[param1->msgBattlerTemp].formNum = v1; @@ -6175,7 +6175,7 @@ BOOL ov16_02259B9C (BattleSystem * param0, BattleContext * param1, int * param2) int v4; int v5; - v3 = AllocMonZeroed(5); + v3 = Pokemon_New(5); if (BattleSystem_BattleType(param0) & 0x2) { v4 = param1->battlerActions[param1->msgBattlerTemp][1]; @@ -6183,21 +6183,21 @@ BOOL ov16_02259B9C (BattleSystem * param0, BattleContext * param1, int * param2) v4 = param1->msgBattlerTemp ^ 1; } - sub_020775EC(ov16_0223DFAC(param0, v4, param1->selectedPartySlot[v4]), v3); + Pokemon_Copy(ov16_0223DFAC(param0, v4, param1->selectedPartySlot[v4]), v3); v5 = 0; - sub_02074B30(v3, 6, &v5); + Pokemon_SetValue(v3, 6, &v5); v5 = 0; - sub_02074B30(v3, 112, &v5); - sub_02077A00(v3); + Pokemon_SetValue(v3, 112, &v5); + Pokemon_SetGiratinaForm(v3); - param1->battleMons[param1->msgBattlerTemp].attack = GetMonData(v3, MON_DATA_165, 0); - param1->battleMons[param1->msgBattlerTemp].defense = GetMonData(v3, MON_DATA_166, 0); - param1->battleMons[param1->msgBattlerTemp].speed = GetMonData(v3, MON_DATA_167, 0); - param1->battleMons[param1->msgBattlerTemp].spAttack = GetMonData(v3, MON_DATA_168, 0); - param1->battleMons[param1->msgBattlerTemp].spDefense = GetMonData(v3, MON_DATA_169, 0); - param1->battleMons[param1->msgBattlerTemp].ability = GetMonData(v3, MON_DATA_10, 0); + param1->battleMons[param1->msgBattlerTemp].attack = Pokemon_GetValue(v3, MON_DATA_ATK, 0); + param1->battleMons[param1->msgBattlerTemp].defense = Pokemon_GetValue(v3, MON_DATA_DEF, 0); + param1->battleMons[param1->msgBattlerTemp].speed = Pokemon_GetValue(v3, MON_DATA_SPEED, 0); + param1->battleMons[param1->msgBattlerTemp].spAttack = Pokemon_GetValue(v3, MON_DATA_SP_ATK, 0); + param1->battleMons[param1->msgBattlerTemp].spDefense = Pokemon_GetValue(v3, MON_DATA_SP_DEF, 0); + param1->battleMons[param1->msgBattlerTemp].ability = Pokemon_GetValue(v3, MON_DATA_ABILITY, 0); param1->battleMons[param1->msgBattlerTemp].formNum = 0; param1->battleStatusMask2 |= 0x4000000; @@ -7082,7 +7082,7 @@ BOOL ov16_0225B228 (BattleSystem * param0, BattleContext * param1, int * param2) v0 = 1; } - if ((v4 == 116) && (param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v6].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->attacker])) == 0) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { + if ((v4 == 116) && (param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v6].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->attacker])) == 0) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { param2[0] = (0 + 216); v0 = 1; } @@ -7692,13 +7692,13 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) for (v0 = v17; v0 < v18; v0++) { v19 = ov16_0223DFAC(param0, param1, v0); - v7 = GetMonData(v19, MON_DATA_SPECIES_EGG, NULL); + v7 = Pokemon_GetValue(v19, MON_DATA_SPECIES_EGG, NULL); - if ((v7 != 0) && (v7 != 494) && (GetMonData(v19, MON_DATA_163, NULL)) && ((v10 & FlagIndex(v0)) == 0) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { + if ((v7 != 0) && (v7 != 494) && (Pokemon_GetValue(v19, MON_DATA_CURRENT_HP, NULL)) && ((v10 & Pokemon_GetFlagMaskOf(v0)) == 0) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { v3 = ov16_02252060(v20, v2, 27, NULL); v4 = ov16_02252060(v20, v2, 28, NULL); - v5 = GetMonData(v19, MON_DATA_177, NULL); - v6 = GetMonData(v19, MON_DATA_178, NULL); + v5 = Pokemon_GetValue(v19, MON_DATA_177, NULL); + v6 = Pokemon_GetValue(v19, MON_DATA_178, NULL); v11 = ov16_022558CC(v5, v3, v4); v11 += ov16_022558CC(v6, v3, v4); @@ -7707,7 +7707,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) v13 = v0; } } else { - v10 |= FlagIndex(v0); + v10 |= Pokemon_GetFlagMaskOf(v0); } } @@ -7715,12 +7715,12 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) v19 = ov16_0223DFAC(param0, param1, v13); for (v0 = 0; v0 < 4; v0++) { - v8 = GetMonData(v19, MON_DATA_MOVE1 + v0, NULL); + v8 = Pokemon_GetValue(v19, MON_DATA_MOVE1 + v0, NULL); v9 = ov16_0225BE3C(param0, v20, v19, v8); if (v8) { v16 = 0; - ov16_022552D4(v20, v8, v9, GetMonData(v19, MON_DATA_10, NULL), Battler_Ability(v20, v2), ov16_02258AB8(v20, v2), ov16_02252060(v20, v2, 27, NULL), ov16_02252060(v20, v2, 28, NULL), &v16); + ov16_022552D4(v20, v8, v9, Pokemon_GetValue(v19, MON_DATA_ABILITY, NULL), Battler_Ability(v20, v2), ov16_02258AB8(v20, v2), ov16_02252060(v20, v2, 27, NULL), ov16_02252060(v20, v2, 28, NULL), &v16); if (v16 & 0x2) { break; @@ -7729,7 +7729,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) } if (v0 == 4) { - v10 |= FlagIndex(v13); + v10 |= Pokemon_GetFlagMaskOf(v13); } else { return v13; } @@ -7743,11 +7743,11 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) for (v0 = v17; v0 < v18; v0++) { v19 = ov16_0223DFAC(param0, param1, v0); - v7 = GetMonData(v19, MON_DATA_SPECIES_EGG, NULL); + v7 = Pokemon_GetValue(v19, MON_DATA_SPECIES_EGG, NULL); - if ((v7 != 0) && (v7 != 494) && (GetMonData(v19, MON_DATA_163, NULL)) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { + if ((v7 != 0) && (v7 != 494) && (Pokemon_GetValue(v19, MON_DATA_CURRENT_HP, NULL)) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { for (v1 = 0; v1 < 4; v1++) { - v8 = GetMonData(v19, MON_DATA_MOVE1 + v1, NULL); + v8 = Pokemon_GetValue(v19, MON_DATA_MOVE1 + v1, NULL); v9 = ov16_0225BE3C(param0, v20, v19, v8); if ((v8) && (v20->aiContext.moveTable[v8].power != 1)) { @@ -7785,10 +7785,10 @@ int ov16_0225BE3C (BattleSystem * param0, BattleContext * param1, Pokemon * para switch (param3) { case 363: - v0 = ov16_0225B0FC(param1, GetMonData(param2, MON_DATA_HELD_ITEM, NULL), 12); + v0 = ov16_0225B0FC(param1, Pokemon_GetValue(param2, MON_DATA_HELD_ITEM, NULL), 12); break; case 449: - switch (ov16_0225B0FC(param1, GetMonData(param2, MON_DATA_HELD_ITEM, NULL), 1)) { + switch (ov16_0225B0FC(param1, Pokemon_GetValue(param2, MON_DATA_HELD_ITEM, NULL), 1)) { case 131: v0 = 1; break; @@ -7843,7 +7843,7 @@ int ov16_0225BE3C (BattleSystem * param0, BattleContext * param1, Pokemon * para } break; case 237: - v0 = ((GetMonData(param2, MON_DATA_HP_IV, NULL) & 1) >> 0) | ((GetMonData(param2, MON_DATA_ATK_IV, NULL) & 1) << 1) | ((GetMonData(param2, MON_DATA_DEF_IV, NULL) & 1) << 2) | ((GetMonData(param2, MON_DATA_SPEED_IV, NULL) & 1) << 3) | ((GetMonData(param2, MON_DATA_SPATK_IV, NULL) & 1) << 4) | ((GetMonData(param2, MON_DATA_SPDEF_IV, NULL) & 1) << 5); + v0 = ((Pokemon_GetValue(param2, MON_DATA_HP_IV, NULL) & 1) >> 0) | ((Pokemon_GetValue(param2, MON_DATA_ATK_IV, NULL) & 1) << 1) | ((Pokemon_GetValue(param2, MON_DATA_DEF_IV, NULL) & 1) << 2) | ((Pokemon_GetValue(param2, MON_DATA_SPEED_IV, NULL) & 1) << 3) | ((Pokemon_GetValue(param2, MON_DATA_SPATK_IV, NULL) & 1) << 4) | ((Pokemon_GetValue(param2, MON_DATA_SPDEF_IV, NULL) & 1) << 5); v0 = (v0 * 15 / 63) + 1; if (v0 >= 9) { diff --git a/src/overlay016/ov16_0225BFFC.c b/src/overlay016/ov16_0225BFFC.c index 72c834e6d3..7d81bea51d 100644 --- a/src/overlay016/ov16_0225BFFC.c +++ b/src/overlay016/ov16_0225BFFC.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" #include "overlay016/struct_ov16_0225BFFC_decl.h" @@ -67,7 +67,7 @@ #include "unk_020131EC.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay012/ov12_02235E94.h" #include "overlay012/ov12_022380BC.h" @@ -611,27 +611,27 @@ static void ov16_0225C47C (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para if ((v0->unk_18 & 0x200000) == 0) { for (v1 = 0; v1 < 4; v1++) { - if ((v0->unk_01_4 & FlagIndex(v1)) == 0) { - sub_02074B30(v2, 54 + v1, (u8 *)&v0->unk_0E[v1]); - sub_02074B30(v2, 58 + v1, (u8 *)&v0->unk_12[v1]); + if ((v0->unk_01_4 & Pokemon_GetFlagMaskOf(v1)) == 0) { + Pokemon_SetValue(v2, 54 + v1, (u8 *)&v0->unk_0E[v1]); + Pokemon_SetValue(v2, 58 + v1, (u8 *)&v0->unk_12[v1]); } } } - if ((v0->unk_08 & FlagIndex(v0->unk_01_0)) == 0) { - sub_02074B30(v2, 6, (u8 *)&v0->unk_0C); + if ((v0->unk_08 & Pokemon_GetFlagMaskOf(v0->unk_01_0)) == 0) { + Pokemon_SetValue(v2, 6, (u8 *)&v0->unk_0C); } - sub_02074B30(v2, 163, (u8 *)&v0->unk_02); - sub_02074B30(v2, 160, (u8 *)&v0->unk_04); + Pokemon_SetValue(v2, 163, (u8 *)&v0->unk_02); + Pokemon_SetValue(v2, 160, (u8 *)&v0->unk_04); if (v0->unk_26) { - sub_02074B30(v2, 112, (u8 *)&v0->unk_1C); + Pokemon_SetValue(v2, 112, (u8 *)&v0->unk_1C); } if (v0->unk_24) { - sub_02074B30(v2, 10, (u8 *)&v0->unk_20); - sub_0207418C(v2); + Pokemon_SetValue(v2, 10, (u8 *)&v0->unk_20); + Pokemon_CalcLevelAndStats(v2); } ov16_02266ABC(param0, param1->unk_190, v0->unk_00); @@ -680,11 +680,11 @@ static void ov16_0225C5E0 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para if (v0->unk_01 == 104) { v4 = 0; } else { - v4 = GetMonData(v1, MON_DATA_10, NULL); + v4 = Pokemon_GetValue(v1, MON_DATA_ABILITY, NULL); } if ((v0->unk_02 != 215) || ((v0->unk_02 == 215) && (v4 != 43))) { - sub_02074B30(v1, 160, (u8 *)&v5); + Pokemon_SetValue(v1, 160, (u8 *)&v5); } } @@ -972,11 +972,11 @@ static void ov16_0225CA74 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para for (v3 = 0; v3 < Party_GetCurrentCount(v1); v3++) { v2 = Party_GetPokemonBySlotIndex(v1, v3); - if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { + if ((Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0)) { if (Battler_Side(param0, v4)) { - v6 += GetMonData(v2, MON_DATA_163, NULL); + v6 += Pokemon_GetValue(v2, MON_DATA_CURRENT_HP, NULL); } else { - v5 += GetMonData(v2, MON_DATA_163, NULL); + v5 += Pokemon_GetValue(v2, MON_DATA_CURRENT_HP, NULL); } } } diff --git a/src/overlay016/ov16_0225CBB8.c b/src/overlay016/ov16_0225CBB8.c index a69056aeca..3b33c15499 100644 --- a/src/overlay016/ov16_0225CBB8.c +++ b/src/overlay016/ov16_0225CBB8.c @@ -15,7 +15,7 @@ #include "struct_decls/struct_0200C704_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" #include "overlay012/struct_ov12_0221FCDC_decl.h" @@ -132,7 +132,7 @@ #include "unk_02018340.h" #include "unk_0201D670.h" #include "unk_02025E68.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -393,7 +393,7 @@ void ov16_0225CBDC (BattleSystem * param0, UnkStruct_ov16_0225BFFC * param1, Unk v4->unk_2C = param2->unk_01_3; v4->unk_18 = param2->unk_08; v4->unk_1C = param1->unk_191; - v4->unk_24 = GetNatureFromPersonality(param2->unk_04); + v4->unk_24 = Pokemon_GetNatureOf(param2->unk_04); v4->unk_28 = param2->unk_01_2; if ((v4->unk_13 == 2) && (BattleSystem_BattleStatus(param0) & 0x40)) { @@ -446,7 +446,7 @@ void ov16_0225CE1C (BattleSystem * param0, UnkStruct_ov16_0225BFFC * param1, Unk v1->unk_82 = param1->unk_191; v1->unk_88 = param2->unk_08; v1->unk_8C = param2->unk_0C; - v1->unk_8D = GetNatureFromPersonality(param2->unk_04); + v1->unk_8D = Pokemon_GetNatureOf(param2->unk_04); v1->unk_8E = param2->unk_10; v1->unk_92 = param2->unk_01_2; v1->unk_94 = 0; @@ -496,7 +496,7 @@ void ov16_0225CF70 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * param1, Unk v2->unk_82 = param1->unk_191; v2->unk_88 = param2->unk_08; v2->unk_8C = param2->unk_0C; - v2->unk_8D = GetNatureFromPersonality(param2->unk_04); + v2->unk_8D = Pokemon_GetNatureOf(param2->unk_04); v2->unk_8E = param2->unk_10; v2->unk_92 = param2->unk_01_2; v2->unk_94 = param2->unk_14; @@ -3231,7 +3231,7 @@ static void ov16_02260B04 (UnkStruct_0201CD38 * param0, void * param1) v3 = ov16_0223ED6C(v0->unk_00); v2 = ov16_02252060(BattleSystem_Context(v0->unk_00), v0->unk_09, 0, NULL); - v1 = sub_020759F0(v2, 26); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 26); v1 = v1 * Unk_ov16_0226F194[v3][0] / Unk_ov16_0226F194[v3][1]; if ((BattleSystem_RandNext(v0->unk_00) % 255) <= v1) { @@ -3402,7 +3402,7 @@ static void ov16_02260DB0 (UnkStruct_0201CD38 * param0, void * param1) v6 = 0; for (v4 = 0; v4 < 4; v4++) { - if ((v0->unk_22 & FlagIndex(v4)) == 0) { + if ((v0->unk_22 & Pokemon_GetFlagMaskOf(v4)) == 0) { v5[v6] = v4 + 1; v6++; } @@ -4004,11 +4004,11 @@ static void ov16_022611DC (UnkStruct_0201CD38 * param0, void * param1) v18->unk_25 = ov16_0226825C(BattleSystem_BattlerSlot(v0->unk_00, v20), BattleSystem_BattleType(v0->unk_00)); v19 = ov16_0223DFAC(v0->unk_00, v20, v21); - v18->unk_28 = GetMonData(v19, MON_DATA_163, NULL) - v0->unk_08->unk_04->unk_20; - v18->unk_2C = GetMonData(v19, MON_DATA_164, NULL); + v18->unk_28 = Pokemon_GetValue(v19, MON_DATA_CURRENT_HP, NULL) - v0->unk_08->unk_04->unk_20; + v18->unk_2C = Pokemon_GetValue(v19, MON_DATA_MAX_HP, NULL); v18->unk_30 = v0->unk_08->unk_04->unk_20; - if (GetMonData(v19, MON_DATA_160, NULL) == 0) { + if (Pokemon_GetValue(v19, MON_DATA_160, NULL) == 0) { v18->unk_4A = 0; } @@ -4072,7 +4072,7 @@ static void ov16_022611DC (UnkStruct_0201CD38 * param0, void * param1) v34 = v0->unk_08->unk_04->unk_2C[v0->unk_08->unk_04->unk_11]; v33 = ov16_0223DFAC(v0->unk_00, v28, v34); - if (GetMonData(v33, MON_DATA_160, NULL) == 0) { + if (Pokemon_GetValue(v33, MON_DATA_160, NULL) == 0) { v27->unk_4A = 0; } @@ -4289,7 +4289,7 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) v7 = v0->unk_09; } - v9 = AllocMonZeroed(5); + v9 = Pokemon_New(5); for (v3 = 0; v3 < 6; v3++) { Party_AddPokemon(v0->unk_04->unk_00, v9); @@ -4300,14 +4300,14 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) for (v3 = 0; v3 < ov16_0223DF60(v0->unk_00, v6); v3++) { v9 = ov16_0223DFAC(v0->unk_00, v6, v0->unk_1C[v6][v3]); v10 = Party_GetPokemonBySlotIndex(v0->unk_04->unk_00, v3 * 2); - sub_020775EC(v9, v10); + Pokemon_Copy(v9, v10); v0->unk_04->unk_2C[v3 * 2] = v0->unk_1C[v6][v3]; } for (v3 = 0; v3 < ov16_0223DF60(v0->unk_00, v7); v3++) { v9 = ov16_0223DFAC(v0->unk_00, v7, v0->unk_1C[v7][v3]); v10 = Party_GetPokemonBySlotIndex(v0->unk_04->unk_00, v3 * 2 + 1); - sub_020775EC(v9, v10); + Pokemon_Copy(v9, v10); v0->unk_04->unk_2C[v3 * 2 + 1] = v0->unk_1C[v7][v3]; } @@ -4348,7 +4348,7 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) v0->unk_04->unk_28 = v0->unk_09; v0->unk_04->unk_32 = v0->unk_17; - if ((v0->unk_18 & FlagIndex(v0->unk_09)) == 0) { + if ((v0->unk_18 & Pokemon_GetFlagMaskOf(v0->unk_09)) == 0) { v0->unk_04->unk_14 = v0->unk_0C[v0->unk_09]; } else { v0->unk_04->unk_14 = 6; @@ -4356,7 +4356,7 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) if (BattleSystem_BattleType(v0->unk_00) & 0x8) { v0->unk_04->unk_15 = 6; - } else if ((v0->unk_18 & FlagIndex(BattleSystem_Partner(v0->unk_00, v0->unk_09))) == 0) { + } else if ((v0->unk_18 & Pokemon_GetFlagMaskOf(BattleSystem_Partner(v0->unk_00, v0->unk_09))) == 0) { v0->unk_04->unk_15 = v0->unk_0C[BattleSystem_Partner(v0->unk_00, v0->unk_09)]; } else { v0->unk_04->unk_15 = 6; @@ -4425,7 +4425,7 @@ static void ov16_02262258 (UnkStruct_0201CD38 * param0, void * param1) for (v1 = 0; v1 < Party_GetCurrentCount(v2); v1++) { v3 = ov16_0223DFAC(v0->unk_00, v0->unk_09, v1); - if ((GetMonData(v3, MON_DATA_163, NULL)) && (v0->unk_0C[v4] != v1) && (v0->unk_0C[v5] != v1)) { + if ((Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL)) && (v0->unk_0C[v4] != v1) && (v0->unk_0C[v5] != v1)) { break; } } @@ -4475,11 +4475,11 @@ static void ov16_0226232C (UnkStruct_0201CD38 * param0, void * param1) } else { v3 = ov16_0223DFAC(v0->unk_00, v0->unk_09, v1 - 1); - if (GetMonData(v3, MON_DATA_163, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL) == 0) { ov16_02264730(v0->unk_00); } - if (GetMonData(v3, MON_DATA_SPECIES_EGG, NULL) == 494) { + if (Pokemon_GetValue(v3, MON_DATA_SPECIES_EGG, NULL) == 494) { ov16_02264730(v0->unk_00); } } @@ -6158,7 +6158,7 @@ static void ov16_02264270 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para int v2 = 0; for (v0 = 0; v0 < BattleSystem_MaxBattlers(param0); v0++) { - if (param2->unk_01 & FlagIndex(v0)) { + if (param2->unk_01 & Pokemon_GetFlagMaskOf(v0)) { if (Battler_Side(param0, v0)) { v2++; } else { diff --git a/src/overlay016/ov16_0226485C.c b/src/overlay016/ov16_0226485C.c index 6e468e407c..732aa5d035 100644 --- a/src/overlay016/ov16_0226485C.c +++ b/src/overlay016/ov16_0226485C.c @@ -7,7 +7,7 @@ #include "struct_decls/battle_system.h" #include "battle/battle_context.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207A81C.h" #include "struct_defs/battle_system.h" #include "battle/battle_context.h" @@ -60,7 +60,7 @@ #include "unk_0202F1D4.h" #include "unk_02034198.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "unk_0207A6DC.h" @@ -545,8 +545,8 @@ void ov16_022651DC (BattleSystem * param0, BattleContext * param1, int param2, i int v3; v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); - v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 12; v0.unk_01 = param1->battleMons[param2].level; @@ -561,8 +561,8 @@ void ov16_022651DC (BattleSystem * param0, BattleContext * param1, int param2, i v0.unk_07_5 = param1->battleMons[param2].gender; } - v0.unk_08 = param1->battleMons[param2].exp - sub_02075AD0(v2, v3); - v0.unk_0C = sub_02075AD0(v2, v3 + 1) - sub_02075AD0(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); + v0.unk_0C = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); v0.unk_07_7 = ov16_0223F9E0(param0, param1->battleMons[param2].species); v0.unk_10 = ov16_0223ED8C(param0); v0.unk_14 = param3; @@ -596,7 +596,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < BattleSystem_MaxBattlers(battleSys); v1++) { if (BattleSystem_CanPickCommand(battleCtx, v1) == 0) { - v10 |= FlagIndex(v1); + v10 |= Pokemon_GetFlagMaskOf(v1); } } @@ -617,11 +617,11 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < Party_GetCurrentCount(v7); v1++) { v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]); - v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_163, NULL)) { - if (GetMonData(v8, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_160, NULL)) { v0.unk_08[0][v6] = 3; } else { v0.unk_08[0][v6] = 1; @@ -633,7 +633,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl if (v9 & (0x4 | 0x20 | 0x80 | 0x200)) { v0.unk_02[v6] = 0; } else { - v0.unk_02[v6] = sub_02075A10(v8); + v0.unk_02[v6] = Pokemon_GetPercentToNextLevel(v8); } v6++; @@ -652,11 +652,11 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < Party_GetCurrentCount(v7); v1++) { v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]); - v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_163, NULL)) { - if (GetMonData(v8, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { v0.unk_08[1][v6] = 1; @@ -680,11 +680,11 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < Party_GetCurrentCount(v7); v1++) { v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]); - v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_163, NULL)) { - if (GetMonData(v8, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { v0.unk_08[1][v6] = 1; @@ -703,11 +703,11 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < Party_GetCurrentCount(v7); v1++) { v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]); - v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_163, NULL)) { - if (GetMonData(v8, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { v0.unk_08[1][v6] = 1; @@ -844,11 +844,11 @@ void BattleIO_ShowBagScreen (BattleSystem *battleSys, BattleContext *battleCtx, } if (BattleSystem_BattleType(battleSys) == (0x2 | 0x8 | 0x40)) { - if (((battleCtx->battlersSwitchingMask & FlagIndex(1)) == 0) && ((battleCtx->battlersSwitchingMask & FlagIndex(3)) == 0)) { + if (((battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(1)) == 0) && ((battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(3)) == 0)) { v0.unk_01 = 1; v0.unk_02 = 0; v0.unk_03 = 0; - } else if ((battleCtx->battlersSwitchingMask & FlagIndex(1)) == 0) { + } else if ((battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(1)) == 0) { v0.unk_01 = 0; if (battleCtx->battleMons[1].moveEffectsMask & (0x40 | 0x80 | 0x40000 | 0x20000000)) { @@ -994,8 +994,8 @@ void ov16_02265C38 (BattleSystem * param0, BattleContext * param1, int param2) int v3; v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); - v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 24; v0.unk_01 = param1->battleMons[param2].level; @@ -1009,8 +1009,8 @@ void ov16_02265C38 (BattleSystem * param0, BattleContext * param1, int param2) v0.unk_07 = param1->battleMons[param2].gender; } - v0.unk_0C = param1->battleMons[param2].exp - sub_02075AD0(v2, v3); - v0.unk_10 = sub_02075AD0(v2, v3 + 1) - sub_02075AD0(v2, v3); + v0.unk_0C = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); + v0.unk_10 = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C35C)); } @@ -1023,13 +1023,13 @@ void ov16_02265D14 (BattleSystem * param0, BattleContext * param1, int param2, i int v3; v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); - v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 25; v0.unk_04 = param3; - v0.unk_08 = param1->battleMons[param2].exp - sub_02075AD0(v2, v3); - v0.unk_0C = sub_02075AD0(v2, v3 + 1) - sub_02075AD0(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); + v0.unk_0C = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C370)); } @@ -1232,8 +1232,8 @@ void ov16_022661CC (BattleSystem * param0, BattleContext * param1, int param2) int v3; v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); - v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 38; v0.unk_01 = param1->battleMons[param2].level; @@ -1248,8 +1248,8 @@ void ov16_022661CC (BattleSystem * param0, BattleContext * param1, int param2) v0.unk_07_5 = param1->battleMons[param2].gender; } - v0.unk_08 = param1->battleMons[param2].exp - sub_02075AD0(v2, v3); - v0.unk_0C = sub_02075AD0(v2, v3 + 1) - sub_02075AD0(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); + v0.unk_0C = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); v0.unk_07_7 = ov16_0223F9E0(param0, param1->battleMons[param2].species); v0.unk_10 = ov16_0223ED8C(param0); @@ -1505,7 +1505,7 @@ void ov16_0226683C (BattleSystem * param0, BattleContext * param1) for (v1 = 0; v1 < BattleSystem_MaxBattlers(param0); v1++) { if (param1->battlerActions[v1][0] == 16) { - v0.unk_01 |= FlagIndex(v1); + v0.unk_01 |= Pokemon_GetFlagMaskOf(v1); } } @@ -1744,11 +1744,11 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[v1][v0]); - v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); + v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_163, NULL)) { - if (GetMonData(v7, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { param2->unk_02[v4] = 1; @@ -1766,11 +1766,11 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[v2][v0]); - v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); + v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_163, NULL)) { - if (GetMonData(v7, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { param2->unk_02[v4] = 1; @@ -1794,11 +1794,11 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[param4][v0]); - v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); + v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_163, NULL)) { - if (GetMonData(v7, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { param2->unk_02[v4] = 1; diff --git a/src/overlay016/ov16_02266F1C.c b/src/overlay016/ov16_02266F1C.c index 638823832d..657097ab69 100644 --- a/src/overlay016/ov16_02266F1C.c +++ b/src/overlay016/ov16_02266F1C.c @@ -14,8 +14,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0200D0F4.h" #include "struct_defs/struct_0205AA50.h" @@ -35,7 +34,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208C098.h" #include "overlay016/ov16_0223DF00.h" #include "overlay016/ov16_02266F1C.h" @@ -961,7 +960,7 @@ static void ov16_02267864 (UnkStruct_ov16_022674C4 * param0) v5 = Strbuf_Init((12 + (5 * 2)), 5); v6 = MessageLoader_GetNewStrbuf(v4, 964); v7 = ov16_0223DFAC(param0->unk_0C, param0->unk_24, param0->unk_26); - v8 = sub_02076B10(v7); + v8 = Pokemon_GetBoxPokemon(v7); sub_0200B5CC(v9, 0, v8); sub_0200C388(v9, v5, v6); diff --git a/src/overlay016/ov16_0226871C.c b/src/overlay016/ov16_0226871C.c index e2e5757f27..31d41d3d5a 100644 --- a/src/overlay016/ov16_0226871C.c +++ b/src/overlay016/ov16_0226871C.c @@ -18,8 +18,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/battle_system.h" #include "overlay016/struct_ov16_0226DC24_decl.h" #include "overlay016/struct_ov16_0226DEEC_decl.h" @@ -61,7 +60,7 @@ #include "unk_020218BC.h" #include "unk_02022594.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02079D40.h" #include "unk_0207C908.h" @@ -1438,7 +1437,7 @@ static void ov16_02268FCC (UnkStruct_0201CD38 * param0, void * param1) break; } - v2->unk_05 += sub_0201D2E8() % 8; + v2->unk_05 += LCRNG_Next() % 8; v2->unk_07 = 2; v2->unk_03++; break; @@ -2166,7 +2165,7 @@ static void ov16_0226A12C (UnkStruct_ov16_02268A14 * param0, int param1, int par } v6 = ov16_0223DFAC(param0->unk_00, v12, v0->unk_00[v12].unk_00); - v7 = sub_02076B10(v6); + v7 = Pokemon_GetBoxPokemon(v6); sub_0200B5CC(v8, 0, v7); sub_0200C388(v8, v4, v5); diff --git a/src/overlay017/ov17_0223B140.c b/src/overlay017/ov17_0223B140.c index bc9dbbd5ed..759fa4dea7 100644 --- a/src/overlay017/ov17_0223B140.c +++ b/src/overlay017/ov17_0223B140.c @@ -43,7 +43,7 @@ #include "strbuf.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" @@ -242,7 +242,7 @@ int ov17_0223B140 (UnkStruct_020067E8 * param0, int * param1) int v4; for (v4 = 0; v4 < 4; v4++) { - v3[v4] = GetMonData(v0->unk_00->unk_00.unk_00[v0->unk_00->unk_00.unk_113], MON_DATA_MOVE1 + v4, NULL); + v3[v4] = Pokemon_GetValue(v0->unk_00->unk_00.unk_00[v0->unk_00->unk_00.unk_113], MON_DATA_MOVE1 + v4, NULL); } ov17_02240A80(v0->unk_7E4, v3); @@ -609,7 +609,7 @@ static void ov17_0223BA10 (UnkStruct_ov17_02246F24 * param0, NARC * param1) int v0, v1, v2; for (v0 = 0; v0 < 4; v0++) { - v2 = GetMonData(param0->unk_00->unk_00.unk_00[param0->unk_00->unk_00.unk_113], MON_DATA_MOVE1 + v0, NULL); + v2 = Pokemon_GetValue(param0->unk_00->unk_00.unk_00[param0->unk_00->unk_00.unk_113], MON_DATA_MOVE1 + v0, NULL); if (v2 != 0) { v1 = MoveTable_LoadParam(v2, MOVEATTRIBUTE_CONTEST_TYPE); diff --git a/src/overlay017/ov17_0223DAD0.c b/src/overlay017/ov17_0223DAD0.c index 5526731adb..2d09d0c4d9 100644 --- a/src/overlay017/ov17_0223DAD0.c +++ b/src/overlay017/ov17_0223DAD0.c @@ -49,7 +49,7 @@ #include "unk_020279FC.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" #include "overlay011/ov11_0221F840.h" @@ -723,7 +723,7 @@ static void ov17_0223E458 (UnkStruct_ov17_0224DF54 * param0) ov17_0224CFB8(param0); for (v0 = 0; v0 < 4; v0++) { - param0->unk_14.unk_A14[v0] = ov17_0224CFA8(GetMonData(param0->unk_00->unk_00.unk_00[v0], MON_DATA_SPECIES, NULL)); + param0->unk_14.unk_A14[v0] = ov17_0224CFA8(Pokemon_GetValue(param0->unk_00->unk_00.unk_00[v0], MON_DATA_SPECIES, NULL)); } } diff --git a/src/overlay017/ov17_0223F118.c b/src/overlay017/ov17_0223F118.c index 123c07806c..ce39870df6 100644 --- a/src/overlay017/ov17_0223F118.c +++ b/src/overlay017/ov17_0223F118.c @@ -37,7 +37,7 @@ #include "unk_0201E86C.h" #include "gx_layers.h" #include "unk_02024220.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay017/ov17_0223F118.h" #include "overlay017/ov17_02252A70.h" @@ -221,14 +221,14 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) s32 v6, v7; for (v0 = 0; v0 < 4; v0++) { - v5 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_HELD_ITEM, NULL); + v5 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_HELD_ITEM, NULL); v6 = 100; switch (param0->unk_00.unk_10F) { case 0: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); switch (v5) { case 260: @@ -241,9 +241,9 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) } break; case 1: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); switch (v5) { case 261: @@ -256,9 +256,9 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) } break; case 2: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); switch (v5) { case 262: @@ -271,9 +271,9 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) } break; case 3: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); switch (v5) { case 263: @@ -286,9 +286,9 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) } break; case 4: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); switch (v5) { case 264: @@ -306,7 +306,7 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) return; } - v4 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_SHEEN, NULL); + v4 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_SHEEN, NULL); v7 = v1 + ((v2 + v3 + v4) / 2); v7 = v7 * v6 / 100; diff --git a/src/overlay017/ov17_0223F7E4.c b/src/overlay017/ov17_0223F7E4.c index 9cf23e52da..5a2910fc00 100644 --- a/src/overlay017/ov17_0223F7E4.c +++ b/src/overlay017/ov17_0223F7E4.c @@ -43,7 +43,7 @@ #include "unk_0201E86C.h" #include "unk_02022594.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02094EDC.h" #include "overlay017/ov17_0223F118.h" @@ -785,7 +785,7 @@ static void ov17_0223FCAC (UnkStruct_ov17_0223F7E4 * param0, int param1, int par param0->unk_2C9 = 0xff; for (v2 = 0; v2 < 4; v2++) { - v0[v2] = GetMonData(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v2, NULL); + v0[v2] = Pokemon_GetValue(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v2, NULL); if (v0[v2] != 0) { v1[v2] = v8->unk_12C[v2]; @@ -889,7 +889,7 @@ static int ov17_0223FFF4 (UnkStruct_ov17_0223F7E4 * param0, int param1, int para case 1: case 2: case 3: - v1 = GetMonData(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + param1, NULL); + v1 = Pokemon_GetValue(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + param1, NULL); if ((v1 == 0) || (param0->unk_2C9 == (param1 - 0))) { return 0xffffffff; @@ -1239,7 +1239,7 @@ static void ov17_02240658 (UnkStruct_0201CD38 * param0, void * param1) v1 = v0->unk_04->unk_24; for (v10 = 0; v10 < 4; v10++) { - v9[v10] = GetMonData(v0->unk_04->unk_00->unk_00[v0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v10, NULL); + v9[v10] = Pokemon_GetValue(v0->unk_04->unk_00->unk_00[v0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v10, NULL); } switch (v0->unk_2CC.unk_04_val1.unk_14) { @@ -1572,7 +1572,7 @@ static int ov17_02240D04 (UnkStruct_ov17_0223F7E4 * param0, int param1) v2 = &Unk_ov17_02253558[param0->unk_2C8]; for (v4 = 0; v4 < 4; v4++) { - v7[v4] = GetMonData(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v4, NULL); + v7[v4] = Pokemon_GetValue(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v4, NULL); } if (param1 == 1) { diff --git a/src/overlay017/ov17_022413D8.c b/src/overlay017/ov17_022413D8.c index df1483f7eb..db4dacd0c3 100644 --- a/src/overlay017/ov17_022413D8.c +++ b/src/overlay017/ov17_022413D8.c @@ -44,7 +44,7 @@ #include "unk_0201D670.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208C098.h" #include "unk_02094EDC.h" #include "overlay012/is_form_symmetrical.h" @@ -490,8 +490,8 @@ void ov17_02241524 (UnkStruct_ov17_0223F88C * param0, int param1) { u32 v0, v1; - v0 = GetMonData(param0->unk_00->unk_00[param1], MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0->unk_00->unk_00[param1], MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param0->unk_00->unk_00[param1], MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(param0->unk_00->unk_00[param1], MON_DATA_FORM, NULL); if (IsFormSymmetrical(v0, v1) == 1) { sub_02007DEC(param0->unk_08[param1], 35, 1); @@ -515,8 +515,8 @@ void ov17_022415E4 (UnkStruct_ov17_0223F88C * param0) { u32 v1, v2; - v1 = GetMonData(param0->unk_00->unk_00[v0], MON_DATA_SPECIES, NULL); - v2 = GetMonData(param0->unk_00->unk_00[v0], MON_DATA_FORM, NULL); + v1 = Pokemon_GetValue(param0->unk_00->unk_00[v0], MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(param0->unk_00->unk_00[v0], MON_DATA_FORM, NULL); if (IsFormSymmetrical(v1, v2) == 1) { sub_02007DEC(param0->unk_08[v0], 35, 1); @@ -1381,13 +1381,13 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U case 0: break; case 1: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param0->unk_304.unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param0->unk_304.unk_00])); break; case 2: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 3: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 4: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); @@ -1399,44 +1399,44 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); break; case 7: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 8: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200B630(param0->unk_0C.unk_48, 1, param2->unk_02); break; case 9: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 10: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200BB74(param0->unk_0C.unk_48, 1, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); break; case 11: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 12: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); sub_0200B630(param0->unk_0C.unk_48, 1, param2->unk_02); break; case 13: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 14: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 15: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 16: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 17: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); @@ -1444,15 +1444,15 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; case 18: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 19: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 20: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 21: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); @@ -1460,15 +1460,15 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; case 22: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 23: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 24: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 25: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); @@ -1479,7 +1479,7 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 27: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200BB74(param0->unk_0C.unk_48, 1, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); sub_0200B630(param0->unk_0C.unk_48, 2, param2->unk_02); break; @@ -1495,7 +1495,7 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; } - sub_0200B5CC(param0->unk_0C.unk_48, 1 + v1, sub_02076B10(param0->unk_0C.unk_00->unk_00[v0->unk_01[v1]])); + sub_0200B5CC(param0->unk_0C.unk_48, 1 + v1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[v0->unk_01[v1]])); } } break; @@ -1583,7 +1583,7 @@ void ov17_02242EE4 (UnkStruct_ov17_02246F24 * param0, int param1) v0 = Strbuf_Init(12, 21); - GetMonData(param0->unk_0C.unk_00->unk_00[param1], MON_DATA_119, v0); + Pokemon_GetValue(param0->unk_0C.unk_00->unk_00[param1], MON_DATA_119, v0); if (param1 == param0->unk_00->unk_00.unk_113) { v1 = ((u32)(((1 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); @@ -2127,8 +2127,8 @@ void ov17_022439C8 (UnkStruct_02095C48 * param0, int param1, int param2, UnkStru { int v0, v1; - v0 = GetMonData(param0->unk_00.unk_00[param1], MON_DATA_177, NULL); - v1 = GetMonData(param0->unk_00.unk_00[param1], MON_DATA_178, NULL); + v0 = Pokemon_GetValue(param0->unk_00.unk_00[param1], MON_DATA_177, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[param1], MON_DATA_178, NULL); if ((v0 == 7) || (v1 == 7)) { param3->unk_07 = 1; diff --git a/src/overlay017/ov17_02243C28.c b/src/overlay017/ov17_02243C28.c index 5e12452d29..efcc4c087a 100644 --- a/src/overlay017/ov17_02243C28.c +++ b/src/overlay017/ov17_02243C28.c @@ -31,7 +31,7 @@ #include "unk_0200762C.h" #include "unk_0200D9E8.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02094EDC.h" #include "overlay012/ov12_0221FC20.h" #include "overlay017/ov17_0223F7E4.h" @@ -680,17 +680,17 @@ static void ov17_022444BC (UnkStruct_0201CD38 * param0, void * param1) MI_CpuClear8(&v3, sizeof(UnkStruct_ov16_02265BBC)); MI_CpuClear8(&v4, sizeof(UnkStruct_ov16_02264408)); - v6 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_SPECIES, NULL); - v7 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_111, NULL); - v8 = sub_02075E0C(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D]); - v9 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_FORM, NULL); - v14 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_PERSONALITY, NULL); + v6 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_SPECIES, NULL); + v7 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_GENDER, NULL); + v8 = Pokemon_IsShiny(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D]); + v9 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_FORM, NULL); + v14 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_PERSONALITY, NULL); - v10 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_SPECIES, NULL); - v11 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_111, NULL); - v12 = sub_02075E0C(v0->unk_00->unk_0C.unk_00->unk_00[v16]); - v13 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_FORM, NULL); - v15 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_PERSONALITY, NULL); + v10 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_SPECIES, NULL); + v11 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_GENDER, NULL); + v12 = Pokemon_IsShiny(v0->unk_00->unk_0C.unk_00->unk_00[v16]); + v13 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_FORM, NULL); + v15 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_PERSONALITY, NULL); v3.unk_00 = 0; v3.unk_01 = 0; @@ -889,7 +889,7 @@ static void ov17_022449B8 (UnkStruct_0201CD38 * param0, void * param1) v1 = ov17_0223FAF8(v0->unk_00->unk_7E4); if (v1 != 0xffffffff) { - v0->unk_10.unk_00 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_MOVE1 + v1, NULL); + v0->unk_10.unk_00 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_MOVE1 + v1, NULL); sub_02005748(1501); v0->unk_0C++; } diff --git a/src/overlay017/ov17_02246ECC.c b/src/overlay017/ov17_02246ECC.c index 80e6bee633..654324bdd3 100644 --- a/src/overlay017/ov17_02246ECC.c +++ b/src/overlay017/ov17_02246ECC.c @@ -6,7 +6,7 @@ #include "overlay017/struct_ov17_022472F8.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" @@ -1281,7 +1281,7 @@ static void ov17_02246F24 (UnkStruct_ov17_02246F24 * param0, UnkStruct_ov17_0224 MI_CpuClear8(param1, sizeof(UnkStruct_ov17_02246F9C)); for (v0 = 0; v0 < 4; v0++) { - param1->unk_00[v0].unk_00 = GetMonData(param0->unk_00->unk_00.unk_00[param2], MON_DATA_MOVE1 + v0, NULL); + param1->unk_00[v0].unk_00 = Pokemon_GetValue(param0->unk_00->unk_00.unk_00[param2], MON_DATA_MOVE1 + v0, NULL); if (ov17_02243A98(¶m0->unk_220, param2, param1->unk_00[v0].unk_00) == 1) { param1->unk_00[v0].unk_0A = MoveTable_LoadParam(param1->unk_00[v0].unk_00, MOVEATTRIBUTE_CONTEST_EFFECT); diff --git a/src/overlay017/ov17_022476F8.c b/src/overlay017/ov17_022476F8.c index d33ed22f4c..09a505798e 100644 --- a/src/overlay017/ov17_022476F8.c +++ b/src/overlay017/ov17_022476F8.c @@ -28,7 +28,7 @@ #include "unk_0201D670.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay017/ov17_022476F8.h" typedef struct { @@ -196,7 +196,7 @@ static void ov17_0224792C (UnkStruct_ov17_02247A48 * param0, int param1, const U break; case 1: sub_0200B48C(param0->unk_0C.unk_3C, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_0C.unk_3C, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_3C, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); diff --git a/src/overlay017/ov17_02247A48.c b/src/overlay017/ov17_02247A48.c index 635906b281..4af4a56425 100644 --- a/src/overlay017/ov17_02247A48.c +++ b/src/overlay017/ov17_02247A48.c @@ -43,7 +43,7 @@ #include "unk_0200DA60.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" #include "overlay012/ov12_02235E94.h" @@ -1086,8 +1086,8 @@ static void ov17_02248AA4 (UnkStruct_0201CD38 * param0, void * param1) ov22_0225B158(v0->unk_00->unk_F18[v0->unk_0E].unk_00, v0->unk_00->unk_F18[v0->unk_0E].unk_04, v0->unk_00->unk_F18[v0->unk_0E].unk_08, v1); if (v0->unk_04 >= FX32_ONE) { - v2 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_SPECIES, NULL); - v3 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_FORM, NULL); sub_02077D3C(v0->unk_00->unk_00->unk_14C[v0->unk_0E], 0, v2, v3, 0, 127, NULL, 22); v0->unk_0C++; } diff --git a/src/overlay017/ov17_0224A0FC.c b/src/overlay017/ov17_0224A0FC.c index f4be019b4a..3ebefbce58 100644 --- a/src/overlay017/ov17_0224A0FC.c +++ b/src/overlay017/ov17_0224A0FC.c @@ -55,7 +55,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" #include "overlay017/ov17_0223DAD0.h" @@ -1900,7 +1900,7 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U case 0: break; case 1: - sub_0200B5CC(param0->unk_14.unk_88, 0, sub_02076B10(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 0, Pokemon_GetBoxPokemon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; case 2: v0 = sub_02095848(param0->unk_00->unk_00.unk_110, param0->unk_00->unk_00.unk_111, param0->unk_00->unk_155); @@ -1911,10 +1911,10 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U break; case 4: sub_0200B48C(param0->unk_14.unk_88, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_14.unk_88, 1, sub_02076B10(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 1, Pokemon_GetBoxPokemon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; case 5: - sub_0200B5CC(param0->unk_14.unk_88, 0, sub_02076B10(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 0, Pokemon_GetBoxPokemon(param0->unk_14.unk_00->unk_00[param2->unk_00])); sub_0200B60C(param0->unk_14.unk_88, 1, param2->unk_04, 1, 0, 1); break; case 6: @@ -1922,7 +1922,7 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U sub_0200BBA8(param0->unk_14.unk_88, 0, v0); sub_0200B60C(param0->unk_14.unk_88, 1, param2->unk_04, 1, 0, 1); sub_0200B48C(param0->unk_14.unk_88, 2, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_14.unk_88, 3, sub_02076B10(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 3, Pokemon_GetBoxPokemon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); diff --git a/src/overlay017/ov17_0224CFB8.c b/src/overlay017/ov17_0224CFB8.c index 7ad359bb1c..c8acbbd6e6 100644 --- a/src/overlay017/ov17_0224CFB8.c +++ b/src/overlay017/ov17_0224CFB8.c @@ -35,7 +35,7 @@ #include "heap.h" #include "unk_02018340.h" #include "unk_02034198.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02094EDC.h" #include "overlay017/ov17_0223DAD0.h" #include "overlay017/ov17_022492DC.h" diff --git a/src/overlay017/ov17_02250744.c b/src/overlay017/ov17_02250744.c index 69ffd1cd1a..5b1cd14f0d 100644 --- a/src/overlay017/ov17_02250744.c +++ b/src/overlay017/ov17_02250744.c @@ -34,7 +34,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" @@ -226,12 +226,12 @@ static void ov17_022507F0 (UnkStruct_ov17_0224FCA0 * param0, int param1, const U break; case 2: sub_0200B48C(param0->unk_10.unk_B8, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_10.unk_B8, 1, sub_02076B10(param0->unk_10.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_10.unk_B8, 1, Pokemon_GetBoxPokemon(param0->unk_10.unk_00->unk_00[param2->unk_00])); break; case 3: sub_0200B60C(param0->unk_10.unk_B8, 0, param2->unk_04, 1, 0, 1); sub_0200B48C(param0->unk_10.unk_B8, 1, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_10.unk_B8, 2, sub_02076B10(param0->unk_10.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_10.unk_B8, 2, Pokemon_GetBoxPokemon(param0->unk_10.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); @@ -343,7 +343,7 @@ void ov17_02250B00 (UnkStruct_ov17_0224FCA0 * param0) for (v3 = 0; v3 < 4; v3++) { v4 = param0->unk_39A.unk_30[v3]; - GetMonData(param0->unk_10.unk_00->unk_00[v4], MON_DATA_119, v2); + Pokemon_GetValue(param0->unk_10.unk_00->unk_00[v4], MON_DATA_119, v2); sub_0201ADA4(¶m0->unk_10.unk_24[1 + v3], 0x0); sub_0201ADA4(¶m0->unk_10.unk_24[5 + v3], 0x0); sub_0201D78C(¶m0->unk_10.unk_24[1 + v3], 0, v2, 0, 3, 0, ((u32)(((1 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))), NULL); diff --git a/src/overlay017/ov17_02251D6C.c b/src/overlay017/ov17_02251D6C.c index 146bc83c73..7f8acc61fe 100644 --- a/src/overlay017/ov17_02251D6C.c +++ b/src/overlay017/ov17_02251D6C.c @@ -28,7 +28,7 @@ #include "unk_0200F174.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay017/ov17_0223F118.h" #include "overlay017/ov17_0224F18C.h" #include "overlay017/ov17_02250744.h" @@ -677,8 +677,8 @@ static void ov17_0225266C (UnkStruct_0201CD38 * param0, void * param1) { int v1, v2; - v1 = GetMonData(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_SPECIES, NULL); - v2 = GetMonData(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_FORM, NULL); + v1 = Pokemon_GetValue(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_FORM, NULL); sub_02077D3C(v0->unk_00->unk_00->unk_14C[v0->unk_11], 0, v1, v2, 0, 127, NULL, 24); } v0->unk_10++; diff --git a/src/overlay019/ov19_021D0D80.c b/src/overlay019/ov19_021D0D80.c index e83926b7fd..0274627792 100644 --- a/src/overlay019/ov19_021D0D80.c +++ b/src/overlay019/ov19_021D0D80.c @@ -12,9 +12,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_02023FCC_decl.h" #include "struct_decls/struct_0202CC84_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" -#include "struct_decls/struct_02075874_decl.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207CB08_decl.h" @@ -58,7 +56,7 @@ #include "unk_020279FC.h" #include "unk_0202CC64.h" #include "unk_0202D778.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "unk_0207A274.h" @@ -1208,7 +1206,7 @@ static void ov19_021D2308 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) case 3: switch (param0->unk_1B8) { case UnkEnum_021DFB94_46: - if ((ov19_021D5F7C(¶m0->unk_00) == 112) && (sub_02074570(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + if ((ov19_021D5F7C(¶m0->unk_00) == 112) && (BoxPokemon_GetValue(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, 112); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -1248,7 +1246,7 @@ static void ov19_021D2308 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) ov19_021D5408(¶m0->unk_00, 24); ov19_021D6594(param0->unk_114, 24); (*param1) = 7; - } else if ((param0->unk_00.unk_112 == 112) && (sub_02074570(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + } else if ((param0->unk_00.unk_112 == 112) && (BoxPokemon_GetValue(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, 112); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -1835,7 +1833,7 @@ static BOOL ov19_021D2DD0 (const UnkStruct_ov19_021D4DF0 * param0) v4 = v3 + (v6->unk_0C[v1] - v2); v0 = sub_02079C9C(param0->unk_00, 0xffffffff, v4); - if (sub_02074570(v0, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v0, MON_DATA_172, NULL)) { return 0; } } @@ -2177,13 +2175,13 @@ static BOOL ov19_021D34E4 (UnkStruct_ov19_021D5DF8 * param0) for (v1 = 0, v2 = 0; v1 < v3; v1++) { v0 = Party_GetPokemonBySlotIndex(param0->unk_124, v1); - v4 = sub_02073C88(v0); + v4 = Pokemon_EnterDecryptionContext(v0); - if ((GetMonData(v0, MON_DATA_173, NULL) == 0) && (GetMonData(v0, MON_DATA_163, NULL) != 0)) { + if ((Pokemon_GetValue(v0, MON_DATA_173, NULL) == 0) && (Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL) != 0)) { v2++; } - sub_02073CD4(v0, v4); + Pokemon_ExitDecryptionContext(v0, v4); if (v2 >= 2) { return 0; @@ -2431,7 +2429,7 @@ static void ov19_021D3978 (UnkStruct_0201CD38 * param0, void * param1) for (v2 = v0->unk_03; v2 < v4; v2++) { v1 = sub_02079C9C(v0->unk_14, v0->unk_02, v2); - if (sub_02074570(v1, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v1, MON_DATA_172, NULL)) { for (v3 = 0; v3 < (NELEMS(Unk_ov19_021DFDF0)); v3++) { if (ov19_021D3AC8(v1, Unk_ov19_021DFDF0[v3])) { v0->unk_08[v3]++; @@ -2486,20 +2484,20 @@ static BOOL ov19_021D3AC8 (BoxPokemon * param0, u16 param1) BOOL v0, v1; v0 = 0; - v1 = sub_02073D20(param0); + v1 = BoxPokemon_EnterDecryptionContext(param0); - if (sub_02074570(param0, MON_DATA_173, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_173, NULL) == 0) { int v2; for (v2 = 0; v2 < 4; v2++) { - if (sub_02074570(param0, MON_DATA_MOVE1 + v2, NULL) == param1) { + if (BoxPokemon_GetValue(param0, MON_DATA_MOVE1 + v2, NULL) == param1) { v0 = 1; break; } } } - sub_02073D48(param0, v1); + BoxPokemon_ExitDecryptionContext(param0, v1); return v0; } @@ -2643,7 +2641,7 @@ static void ov19_021D3D44 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) Heap_FreeToHeap(param0->unk_214); Overlay_UnloadByID(FS_OVERLAY_ID(overlay84)); - if ((v1 == 112) && (sub_02074570(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + if ((v1 == 112) && (BoxPokemon_GetValue(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { (void)0; } else if (v1 != 0) { sub_0207D60C(sub_0207D990(param0->unk_11C), v1, 1, 9); @@ -2667,7 +2665,7 @@ static void ov19_021D3D44 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) if (ov19_021D6600(param0->unk_114, 2)) { if (v1 == 0) { ov19_021D0EC0(param0); - } else if ((v1 == 112) && (sub_02074570(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + } else if ((v1 == 112) && (BoxPokemon_GetValue(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, v1); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -3322,7 +3320,7 @@ static void ov19_021D4BE0 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_02042434 param0->unk_194 = MessageLoader_Init(0, 26, 202, 9); param0->unk_198 = MessageLoader_Init(0, 26, 610, 9); param0->unk_19C = sub_0200B358(9); - param0->unk_1A0 = Heap_AllocFromHeap(9, PokemonStructSize()); + param0->unk_1A0 = Heap_AllocFromHeap(9, Pokemon_StructSize()); GF_ASSERT(param0->unk_19C); param0->unk_128 = sub_0208712C(9, 2, 0, 8, param0->unk_1A4); @@ -3407,7 +3405,7 @@ static void ov19_021D4DF0 (UnkStruct_ov19_021D5DF8 * param0) static void ov19_021D4E30 (UnkStruct_ov19_021D5594 * param0) { - param0->unk_00 = Heap_AllocFromHeap(9, (5 * 6) * sub_02076AF4()); + param0->unk_00 = Heap_AllocFromHeap(9, (5 * 6) * BoxPokemon_GetStructSize()); param0->unk_08 = 0; param0->unk_0B = 0; } @@ -3826,7 +3824,7 @@ static BOOL ov19_021D52F4 (UnkStruct_ov19_021D5DF8 * param0) } if (v2->unk_00) { - if (sub_02074570(v2->unk_00, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v2->unk_00, MON_DATA_172, NULL)) { v2->unk_0A = 1; if (!(ov19_021D5E38(v0) & 6)) { @@ -3890,11 +3888,11 @@ static void ov19_021D5420 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D UnkStruct_ov19_021D3CFC * v1 = ¶m1->unk_08; if (ov19_021D5E10(param1) == 0) { - MI_CpuCopy32(v1->unk_00, v0->unk_00, sub_02076AF4()); + MI_CpuCopy32(v1->unk_00, v0->unk_00, BoxPokemon_GetStructSize()); sub_02079968(param0->unk_120, 0xffffffff, v1->unk_07); v0->unk_0B = 0; } else { - MI_CpuCopy32(v1->unk_00, v0->unk_00, sub_02076AF0()); + MI_CpuCopy32(v1->unk_00, v0->unk_00, Pokemon_GetStructSize()); Party_RemovePokemonBySlotIndex(param0->unk_124, v1->unk_08); v0->unk_0B = 1; } @@ -3919,7 +3917,7 @@ static void ov19_021D54A4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D v11->unk_0A = 1; v7 = ov19_021D5E24(param1); - v9 = sub_02076AF4(); + v9 = BoxPokemon_GetStructSize(); v8 = 0; v12 = (void *)(v11->unk_00); @@ -3931,7 +3929,7 @@ static void ov19_021D54A4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D for (v0 = v2; v0 <= v3; v0++) { v10 = sub_02079C9C(param0->unk_120, 0xffffffff, v6); - if (sub_02074570(v10, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v10, MON_DATA_172, NULL)) { MI_CpuCopy32(v10, v12, v9); sub_02079968(param0->unk_120, 0xffffffff, v6); (u8 *)v12 += v9; @@ -3980,18 +3978,18 @@ static void ov19_021D55C4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D BOOL v5; if (ov19_021D5E10(param1) == 0) { - v4 = sub_02074570(v0->unk_00, MON_DATA_FORM, NULL); + v4 = BoxPokemon_GetValue(v0->unk_00, MON_DATA_FORM, NULL); sub_02079914(param0->unk_120, 0xffffffff, v1->unk_07, v0->unk_00); v2 = sub_02079C9C(param0->unk_120, 0xffffffff, v1->unk_07); - if ((sub_02074570(v2, MON_DATA_SPECIES, NULL) == 492) && (v4 == 1)) { + if ((BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL) == 492) && (v4 == 1)) { v3 = 1; } } else { if (v0->unk_0B) { Party_AddPokemon(param0->unk_124, (Pokemon *)(v0->unk_00)); } else { - sub_020774C8(v0->unk_00, param0->unk_1A0); + Pokemon_FromBoxPokemon(v0->unk_00, param0->unk_1A0); Party_AddPokemon(param0->unk_124, param0->unk_1A0); } @@ -4019,7 +4017,7 @@ static void ov19_021D56AC (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D v3 = ov19_021D5F3C(param1); v2 = v7->unk_09; - v5 = sub_02076AF4(); + v5 = BoxPokemon_GetStructSize(); v0 = v7->unk_00; for (v1 = 0; v1 < v7->unk_08; v1++) { @@ -4043,7 +4041,7 @@ static void ov19_021D5734 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D UnkStruct_ov19_021D3CFC * v3; v2 = ¶m1->unk_14; - v0 = sub_02076AF0(); + v0 = Pokemon_GetStructSize(); v1 = (u8 *)(v2->unk_00) + v0; v3 = ¶m1->unk_08; @@ -4055,7 +4053,7 @@ static void ov19_021D5734 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D v2->unk_0B = 0; } else { if (v2->unk_0B == 0) { - sub_020774C8(v1, param0->unk_1A0); + Pokemon_FromBoxPokemon(v1, param0->unk_1A0); } else { MI_CpuCopy32(v1, param0->unk_1A0, v0); } @@ -4113,7 +4111,7 @@ static void ov19_021D5834 (UnkStruct_ov19_021D5DF8 * param0) v1 = &v0->unk_08; v2 = &v0->unk_14; - ZeroBoxMonData(v2->unk_00); + BoxPokemon_Init(v2->unk_00); v1->unk_0B = 1; ov19_021D52F4(param0); } @@ -4144,27 +4142,27 @@ static void ov19_021D5888 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 static void ov19_021D58AC (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1, UnkStruct_ov19_021D5DF8 * param2) { UnkStruct_ov19_021D5BAC * v0 = &(param0->unk_4C); - BOOL v1 = sub_02073D20(param1); - UnkStruct_02075874 * v2; + BOOL v1 = BoxPokemon_EnterDecryptionContext(param1); + PokemonPersonalData * v2; v0->unk_00 = param1; - v0->unk_04 = sub_02074570(param1, MON_DATA_SPECIES, NULL); - v0->unk_06 = sub_02074570(param1, MON_DATA_HELD_ITEM, NULL); + v0->unk_04 = BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + v0->unk_06 = BoxPokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); v0->unk_08 = sub_0207A294(sub_0207A274(param2->unk_11C), v0->unk_04); - v0->unk_0F = sub_02074570(param1, MON_DATA_173, NULL); - v2 = sub_02075894(v0->unk_04, 9); - v0->unk_0A = sub_02075B9C(v2, v0->unk_04, sub_02074570(param1, MON_DATA_EXP, NULL)); - v0->unk_0B = sub_02074570(param1, MON_DATA_11, NULL); - v0->unk_0C = sub_02074570(param1, MON_DATA_177, NULL); - v0->unk_0D = sub_02074570(param1, MON_DATA_178, NULL); - - if ((v0->unk_0F == 0) && sub_02074570(param1, MON_DATA_176, NULL)) { - v0->unk_0E = sub_02075DD0(v2, v0->unk_04, sub_02074570(param1, MON_DATA_PERSONALITY, NULL)); + v0->unk_0F = BoxPokemon_GetValue(param1, MON_DATA_173, NULL); + v2 = PokemonPersonalData_FromMonSpecies(v0->unk_04, 9); + v0->unk_0A = PokemonPersonalData_GetLevelAt(v2, v0->unk_04, BoxPokemon_GetValue(param1, MON_DATA_EXP, NULL)); + v0->unk_0B = BoxPokemon_GetValue(param1, MON_DATA_11, NULL); + v0->unk_0C = BoxPokemon_GetValue(param1, MON_DATA_177, NULL); + v0->unk_0D = BoxPokemon_GetValue(param1, MON_DATA_178, NULL); + + if ((v0->unk_0F == 0) && BoxPokemon_GetValue(param1, MON_DATA_176, NULL)) { + v0->unk_0E = PokemonPersonalData_GetGenderOf(v2, v0->unk_04, BoxPokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL)); } else { v0->unk_0E = 255; } - sub_02074570(param1, MON_DATA_119, v0->unk_14); + BoxPokemon_GetValue(param1, MON_DATA_119, v0->unk_14); if (v0->unk_0F == 0) { MessageLoader_GetStrbuf(param2->unk_190, v0->unk_04, v0->unk_18); @@ -4180,15 +4178,15 @@ static void ov19_021D58AC (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 } { - u32 v3 = sub_02075BD4(param1); + u32 v3 = BoxPokemon_GetNature(param1); MessageLoader_GetStrbuf(param2->unk_194, v3, v0->unk_20); - v3 = sub_02074570(param1, MON_DATA_10, NULL); + v3 = BoxPokemon_GetValue(param1, MON_DATA_ABILITY, NULL); MessageLoader_GetStrbuf(param2->unk_198, v3, v0->unk_24); } - sub_020759B8(v2); - sub_02073D48(param1, v1); + PokemonPersonalData_Free(v2); + BoxPokemon_ExitDecryptionContext(param1, v1); } static void ov19_021D59F4 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1, UnkStruct_ov19_021D5DF8 * param2) @@ -4209,28 +4207,28 @@ static void ov19_021D59F4 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 } Strbuf_Copy(v1->unk_2C, v0->unk_20); - sub_020774C8(param1, param2->unk_1A0); - - v2 = sub_02073C88(param2->unk_1A0); - - v1->unk_0A = GetMonData(param2->unk_1A0, MON_DATA_164, NULL); - v1->unk_0C = GetMonData(param2->unk_1A0, MON_DATA_165, NULL); - v1->unk_0E = GetMonData(param2->unk_1A0, MON_DATA_166, NULL); - v1->unk_10 = GetMonData(param2->unk_1A0, MON_DATA_168, NULL); - v1->unk_12 = GetMonData(param2->unk_1A0, MON_DATA_169, NULL); - v1->unk_14 = GetMonData(param2->unk_1A0, MON_DATA_167, NULL); - v1->unk_16 = GetMonData(param2->unk_1A0, MON_DATA_COOL, NULL); - v1->unk_18 = GetMonData(param2->unk_1A0, MON_DATA_BEAUTY, NULL); - v1->unk_1A = GetMonData(param2->unk_1A0, MON_DATA_CUTE, NULL); - v1->unk_1C = GetMonData(param2->unk_1A0, MON_DATA_SMART, NULL); - v1->unk_1E = GetMonData(param2->unk_1A0, MON_DATA_TOUGH, NULL); - v1->unk_20[0] = GetMonData(param2->unk_1A0, MON_DATA_MOVE1, NULL); - v1->unk_20[1] = GetMonData(param2->unk_1A0, MON_DATA_MOVE2, NULL); - v1->unk_20[2] = GetMonData(param2->unk_1A0, MON_DATA_MOVE3, NULL); - v1->unk_20[3] = GetMonData(param2->unk_1A0, MON_DATA_MOVE4, NULL); - v1->unk_07 = GetMonData(param2->unk_1A0, MON_DATA_FORM, NULL); - - sub_02073CD4(param2->unk_1A0, v2); + Pokemon_FromBoxPokemon(param1, param2->unk_1A0); + + v2 = Pokemon_EnterDecryptionContext(param2->unk_1A0); + + v1->unk_0A = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MAX_HP, NULL); + v1->unk_0C = Pokemon_GetValue(param2->unk_1A0, MON_DATA_ATK, NULL); + v1->unk_0E = Pokemon_GetValue(param2->unk_1A0, MON_DATA_DEF, NULL); + v1->unk_10 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_SP_ATK, NULL); + v1->unk_12 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_SP_DEF, NULL); + v1->unk_14 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_SPEED, NULL); + v1->unk_16 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_COOL, NULL); + v1->unk_18 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_BEAUTY, NULL); + v1->unk_1A = Pokemon_GetValue(param2->unk_1A0, MON_DATA_CUTE, NULL); + v1->unk_1C = Pokemon_GetValue(param2->unk_1A0, MON_DATA_SMART, NULL); + v1->unk_1E = Pokemon_GetValue(param2->unk_1A0, MON_DATA_TOUGH, NULL); + v1->unk_20[0] = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MOVE1, NULL); + v1->unk_20[1] = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MOVE2, NULL); + v1->unk_20[2] = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MOVE3, NULL); + v1->unk_20[3] = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MOVE4, NULL); + v1->unk_07 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_FORM, NULL); + + Pokemon_ExitDecryptionContext(param2->unk_1A0, v2); param0->unk_A4.unk_02[param0->unk_A4.unk_00] = 1; } @@ -4266,7 +4264,7 @@ static void ov19_021D5BAC (UnkStruct_ov19_021D4DF0 * param0) v1 = param0->unk_74.unk_22; v0->unk_0B = v1; - SetBoxMonData(v0->unk_00, 11, &(v1)); + BoxPokemon_SetValue(v0->unk_00, 11, &(v1)); if ((ov19_021D5E10(param0) == 0) && (ov19_021D5E38(param0) == 1)) { sub_02024804(); @@ -4291,20 +4289,20 @@ static void ov19_021D5BE8 (UnkStruct_ov19_021D4DF0 * param0, u16 param1, UnkStru sub_02079C50(param2->unk_120, 0xffffffff, v1, 6, ¶m1); } - SetBoxMonData(v0->unk_00, 6, ¶m1); + BoxPokemon_SetValue(v0->unk_00, 6, ¶m1); { - int v2 = sub_02074570(v0->unk_00, MON_DATA_SPECIES, NULL); + int v2 = BoxPokemon_GetValue(v0->unk_00, MON_DATA_SPECIES, NULL); if (v2 == 493) { - sub_02077930(v0->unk_00); - v0->unk_0C = sub_02074570(v0->unk_00, MON_DATA_177, NULL); - v0->unk_0D = sub_02074570(v0->unk_00, MON_DATA_178, NULL); + BoxPokemon_SetArceusForm(v0->unk_00); + v0->unk_0C = BoxPokemon_GetValue(v0->unk_00, MON_DATA_177, NULL); + v0->unk_0D = BoxPokemon_GetValue(v0->unk_00, MON_DATA_178, NULL); } else if (v2 == 487) { int v3; - sub_02077A1C(v0->unk_00); - v3 = sub_02074570(v0->unk_00, MON_DATA_10, NULL); + BoxPokemon_SetGiratinaForm(v0->unk_00); + v3 = BoxPokemon_GetValue(v0->unk_00, MON_DATA_ABILITY, NULL); MessageLoader_GetStrbuf(param2->unk_198, v3, v0->unk_24); } } @@ -4693,24 +4691,24 @@ static u32 ov19_021D5FD0 (UnkStruct_ov19_021D4DF0 * param0, int param1, void * p { if (ov19_021D5E38(param0) == 1) { if (ov19_021D5E10(param0) == 0) { - return sub_02074570(param0->unk_4C.unk_00, param1, param2); + return BoxPokemon_GetValue(param0->unk_4C.unk_00, param1, param2); } } else { UnkStruct_ov19_021D5594 * v0 = ¶m0->unk_14; if (v0->unk_0B == 0) { - return sub_02074570(param0->unk_4C.unk_00, param1, param2); + return BoxPokemon_GetValue(param0->unk_4C.unk_00, param1, param2); } } - return GetMonData(param0->unk_4C.unk_00, param1, param2); + return Pokemon_GetValue(param0->unk_4C.unk_00, param1, param2); } static u32 ov19_021D6014 (UnkStruct_ov19_021D4DF0 * param0, int param1, void * param2) { if (ov19_021D5E10(param0) == 0) { - return sub_02074570(param0->unk_4C.unk_00, param1, param2); + return BoxPokemon_GetValue(param0->unk_4C.unk_00, param1, param2); } else { - return GetMonData(param0->unk_08.unk_00, param1, param2); + return Pokemon_GetValue(param0->unk_08.unk_00, param1, param2); } } diff --git a/src/overlay019/ov19_021D79F8.c b/src/overlay019/ov19_021D79F8.c index 1d23f4a632..81c31c2330 100644 --- a/src/overlay019/ov19_021D79F8.c +++ b/src/overlay019/ov19_021D79F8.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020218BC_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "overlay019/struct_ov19_021D5DF8_decl.h" #include "overlay019/struct_ov19_021D61B0_decl.h" @@ -23,7 +23,7 @@ #include "unk_02018340.h" #include "unk_0201D670.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02079D40.h" #include "overlay019/ov19_021D0D80.h" @@ -396,7 +396,7 @@ static void ov19_021D803C (UnkStruct_ov19_021D8318 * param0, UnkStruct_ov19_021D if (param1->unk_00 == NULL) { v1 = sub_02079C9C(v0, param0->unk_30, v3); - if (sub_02074570(v1, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v1, MON_DATA_172, NULL)) { ov19_021DA548(param0->unk_58F0, v1, param0->unk_5814[v3], param0->unk_57D8[v3], param0->unk_CD8[v3], param2, 40 + 24 * v2, 2, ov19_021D85B4(v3), v4, param1); } } @@ -433,7 +433,7 @@ static void ov19_021D813C (UnkStruct_ov19_021D8318 * param0, u32 param1) for (v2 = 0; v2 < (5 * 6); v2++) { v1 = sub_02079C9C(v0, param1, v2); - v3 = sub_02074570(v1, MON_DATA_SPECIES, NULL); + v3 = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v3) { param0->unk_5814[v2] = v3; @@ -601,7 +601,7 @@ void ov19_021D84E0 (UnkStruct_ov19_021D8318 * param0) for (v0 = 0; v0 < (5 * 6); v0++) { v2 = sub_02079C9C(param0->unk_58F8->unk_00, v1, v0); - if (sub_02074570(v2, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v2, MON_DATA_172, NULL)) { if (param0->unk_A8[param0->unk_02][v0].unk_00 == NULL) { int v3, v4, v5; @@ -665,7 +665,7 @@ static void ov19_021D85C4 (UnkStruct_ov19_021D8318 * param0, UnkStruct_ov19_021D for (v3 = 0; v3 < 5; v3++) { for (v2 = 0; v2 < 6; v2++) { v0 = sub_02079C9C(param1->unk_40->unk_00, param2, v4); - v1 = sub_02074570((BoxPokemon *)v0, MON_DATA_SPECIES, NULL); + v1 = BoxPokemon_GetValue((BoxPokemon *)v0, MON_DATA_SPECIES, NULL); if (v1 != 0) { ov19_021DA428(param1, v0, 112 + param0->unk_585C + 24 * v2 + param4, 40 + 24 * v3, 2, ov19_021D85B4(v4), v5, param5); diff --git a/src/overlay019/ov19_021DA270.c b/src/overlay019/ov19_021DA270.c index 7c2d948249..58f57a357e 100644 --- a/src/overlay019/ov19_021DA270.c +++ b/src/overlay019/ov19_021DA270.c @@ -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_021D61B0_decl.h" #include "overlay019/struct_ov19_021D4DF0.h" @@ -15,7 +15,7 @@ #include "unk_02006E3C.h" #include "heap.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay019/ov19_021D0D80.h" #include "overlay019/ov19_021D61B0.h" @@ -129,16 +129,16 @@ void ov19_021DA428 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, s32 p u8 v4; u8 v5; - v5 = sub_02073D20(param1); + v5 = BoxPokemon_EnterDecryptionContext(param1); ov19_021D783C(&v1, NULL, ov19_021D77D0(param0->unk_44), param0->unk_10, param0->unk_04, param4); - v2 = sub_02074570(param1, MON_DATA_SPECIES, NULL); - v3 = sub_02074570(param1, MON_DATA_IS_EGG, NULL); - v4 = sub_02074570(param1, MON_DATA_FORM, NULL); + v2 = BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + v3 = BoxPokemon_GetValue(param1, MON_DATA_IS_EGG, NULL); + v4 = BoxPokemon_GetValue(param1, MON_DATA_FORM, NULL); param7->unk_28 = sub_02079D40((BoxPokemon *)param1); param7->unk_2C = sub_02079EDC(v2, v4, v3); - param7->unk_30 = sub_02074570(param1, MON_DATA_HELD_ITEM, NULL); - param7->unk_2E = sub_02074570(param1, MON_DATA_11, NULL); + param7->unk_30 = BoxPokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); + param7->unk_2E = BoxPokemon_GetValue(param1, MON_DATA_11, NULL); NNS_G2dInitImageProxy(&(param7->unk_04)); NARC_ReadFromMember(param0->unk_48, param7->unk_28, 0, ((4 * 4) * 0x20 + 0x80), param0->unk_4C); @@ -156,7 +156,7 @@ void ov19_021DA428 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, s32 p sub_02021E90(param7->unk_00, 2 + param7->unk_2C); ov19_021DA63C(param0, param7, ov19_021D5EC8(param0->unk_40)); - sub_02073D48(param1, v5); + BoxPokemon_ExitDecryptionContext(param1, v5); } void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 param2, u32 param3, u8 * param4, s32 param5, s32 param6, u32 param7, u32 param8, u32 param9, UnkStruct_ov19_021DCD18 * param10) @@ -166,16 +166,16 @@ void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 p BOOL v2; u8 v3, v4; - v2 = sub_02073D20(param1); - v3 = sub_02074570(param1, MON_DATA_IS_EGG, NULL); - v4 = sub_02074570(param1, MON_DATA_FORM, NULL); + v2 = BoxPokemon_EnterDecryptionContext(param1); + v3 = BoxPokemon_GetValue(param1, MON_DATA_IS_EGG, NULL); + v4 = BoxPokemon_GetValue(param1, MON_DATA_FORM, NULL); ov19_021D783C(&v1, NULL, ov19_021D77D0(param0->unk_44), param0->unk_10, param0->unk_04, param7); param10->unk_28 = param3; param10->unk_2C = sub_02079EDC(param2, v4, v3); - param10->unk_30 = sub_02074570(param1, MON_DATA_HELD_ITEM, NULL); - param10->unk_2E = sub_02074570(param1, MON_DATA_11, NULL); + param10->unk_30 = BoxPokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); + param10->unk_2E = BoxPokemon_GetValue(param1, MON_DATA_11, NULL); NNS_G2dInitImageProxy(&(param10->unk_04)); NNS_G2dGetUnpackedCharacterData(param4, &v0); @@ -192,7 +192,7 @@ void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 p sub_02021E90(param10->unk_00, 2 + param10->unk_2C); ov19_021DA63C(param0, param10, ov19_021D5EC8(param0->unk_40)); - sub_02073D48(param1, v2); + BoxPokemon_ExitDecryptionContext(param1, v2); } void ov19_021DA63C (UnkStruct_ov19_021DA384 * param0, UnkStruct_ov19_021DCD18 * param1, u32 param2) diff --git a/src/overlay019/ov19_021DA92C.c b/src/overlay019/ov19_021DA92C.c index 95b54a7dd7..578bf93bb4 100644 --- a/src/overlay019/ov19_021DA92C.c +++ b/src/overlay019/ov19_021DA92C.c @@ -28,7 +28,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0207C908.h" #include "overlay019/ov19_021D0D80.h" #include "overlay019/ov19_021D61B0.h" diff --git a/src/overlay019/ov19_021DB8E4.c b/src/overlay019/ov19_021DB8E4.c index 990e36d84c..146207629d 100644 --- a/src/overlay019/ov19_021DB8E4.c +++ b/src/overlay019/ov19_021DB8E4.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020218BC_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "overlay019/struct_ov19_021D61B0_decl.h" @@ -27,7 +27,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "item.h" #include "overlay019/ov19_021D0D80.h" @@ -250,14 +250,14 @@ void ov19_021DBBA8 (UnkStruct_ov19_021DBA9C * param0, u32 param1, u32 param2, NN for (v3 = 0, v4 = 0; v3 < 5; v3++) { for (v2 = 0; v2 < 6; v2++) { v1 = sub_02079C9C(v0, param1, v4++); - v7 = sub_02073D20(v1); - v5 = sub_02074570(v1, MON_DATA_SPECIES, NULL); + v7 = BoxPokemon_EnterDecryptionContext(v1); + v5 = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v5) { - if (sub_02074570(v1, MON_DATA_IS_EGG, NULL) == 0) { - u16 v9 = sub_02074570(v1, MON_DATA_FORM, NULL); + if (BoxPokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + u16 v9 = BoxPokemon_GetValue(v1, MON_DATA_FORM, NULL); - v6 = sub_020759CC(v5, v9, 27); + v6 = PokemonPersonalData_GetFormValue(v5, v9, 27); } else { v6 = (v5 != 490) ? 8 : 1; } @@ -273,7 +273,7 @@ void ov19_021DBBA8 (UnkStruct_ov19_021DBA9C * param0, u32 param1, u32 param2, NN sub_0201A6D0(&(param0->unk_3C), 10 + v2 * 2, 11 + v3 * 2, 2, 2, v6); } - sub_02073D48(v1, v7); + BoxPokemon_ExitDecryptionContext(v1, v7); } } diff --git a/src/overlay019/ov19_021DC5F0.c b/src/overlay019/ov19_021DC5F0.c index ebc2443ae7..43209cdd96 100644 --- a/src/overlay019/ov19_021DC5F0.c +++ b/src/overlay019/ov19_021DC5F0.c @@ -5,8 +5,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020218BC_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021D5DF8_decl.h" #include "overlay019/struct_ov19_021D61B0_decl.h" diff --git a/src/overlay019/ov19_021DEC04.c b/src/overlay019/ov19_021DEC04.c index 56f6341b23..e5487117b4 100644 --- a/src/overlay019/ov19_021DEC04.c +++ b/src/overlay019/ov19_021DEC04.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021D61B0_decl.h" #include "overlay019/struct_ov19_021DEC04_decl.h" diff --git a/src/overlay021/ov21_021D0D80.c b/src/overlay021/ov21_021D0D80.c index f28223d38b..44e9ecd320 100644 --- a/src/overlay021/ov21_021D0D80.c +++ b/src/overlay021/ov21_021D0D80.c @@ -53,7 +53,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_0202631C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02098988.h" #include "unk_0209ACBC.h" #include "overlay021/ov21_021D0D80.h" diff --git a/src/overlay021/ov21_021D1FA4.c b/src/overlay021/ov21_021D1FA4.c index 5a78d924b1..39208e18ca 100644 --- a/src/overlay021/ov21_021D1FA4.c +++ b/src/overlay021/ov21_021D1FA4.c @@ -39,7 +39,7 @@ #include "unk_02018340.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay021/ov21_021D1FA4.h" #include "overlay021/ov21_021D4C0C.h" #include "overlay021/ov21_021D4EE4.h" @@ -175,7 +175,7 @@ void ov21_021D2188 (UnkStruct_ov21_021D13FC * param0, int param1, int param2, in } if (param2 == -1) { - param2 = sub_02075DAC(param1, 0); + param2 = Pokemon_GetGenderOf(param1, 0); } sub_02075FB4(&v0, param1, param2, param3, param4, param5, param6); diff --git a/src/overlay021/ov21_021DE668.c b/src/overlay021/ov21_021DE668.c index 64f53d7e98..184f7b6cf6 100644 --- a/src/overlay021/ov21_021DE668.c +++ b/src/overlay021/ov21_021DE668.c @@ -36,7 +36,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02098988.h" #include "overlay021/ov21_021D0D80.h" #include "overlay021/ov21_021D1F90.h" @@ -641,8 +641,8 @@ static void ov21_021DF098 (UnkStruct_ov21_021DF374 * param0, UnkStruct_ov21_021D int v4, v5; int v6 = ov21_021D33D4(param2->unk_04, v3); - v4 = sub_020759CC(v3, v6, 6); - v5 = sub_020759CC(v3, v6, 7); + v4 = PokemonPersonalData_GetFormValue(v3, v6, 6); + v5 = PokemonPersonalData_GetFormValue(v3, v6, 7); v4 = ov21_021DF180(v4); v5 = ov21_021DF180(v5); diff --git a/src/overlay021/ov21_021DF734.c b/src/overlay021/ov21_021DF734.c index 04eb08a3fe..9f6ee3d56b 100644 --- a/src/overlay021/ov21_021DF734.c +++ b/src/overlay021/ov21_021DF734.c @@ -30,7 +30,7 @@ #include "unk_02018340.h" #include "unk_0201F834.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay021/ov21_021D0D80.h" #include "overlay021/ov21_021D1FA4.h" #include "overlay021/ov21_021D3208.h" @@ -803,7 +803,7 @@ static int ov21_021E02F0 (int param0, const UnkStruct_ov21_021DF844 * param1) int v0; int v1; - v0 = sub_020759F0(param0, 18); + v0 = PokemonPersonalData_GetSpeciesValue(param0, 18); if (v0 == 0) { return 1; diff --git a/src/overlay021/ov21_021E8D48.c b/src/overlay021/ov21_021E8D48.c index 360fbf6383..9873902bf9 100644 --- a/src/overlay021/ov21_021E8D48.c +++ b/src/overlay021/ov21_021E8D48.c @@ -13,7 +13,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay021/struct_ov21_021D4C0C_decl.h" #include "struct_defs/struct_02008A90.h" @@ -47,7 +47,7 @@ #include "gx_layers.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02098988.h" #include "overlay021/ov21_021D0D80.h" #include "overlay021/ov21_021D1F90.h" @@ -153,8 +153,8 @@ UnkStruct_ov21_021E8D48 * ov21_021E8D48 (const UnkStruct_ov21_021E8E0C * param0) u32 v1; u32 v2; - v1 = GetMonData(param0->unk_10, MON_DATA_SPECIES, NULL); - v2 = GetMonData(param0->unk_10, MON_DATA_FORM, NULL); + v1 = Pokemon_GetValue(param0->unk_10, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(param0->unk_10, MON_DATA_FORM, NULL); if (v1 == 487) { sub_02098988(v2); @@ -205,8 +205,8 @@ static void ov21_021E8E0C (UnkStruct_ov21_021E8D48 * param0, const UnkStruct_ov2 NARC * v1 = NARC_ctor(NARC_INDEX_RESOURCE__ENG__ZUKAN__ZUKAN, param1->unk_0C); int v2; - param0->unk_220 = GetMonData(param1->unk_10, MON_DATA_SPECIES, NULL); - v2 = GetMonData(param1->unk_10, MON_DATA_FORM, NULL); + param0->unk_220 = Pokemon_GetValue(param1->unk_10, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(param1->unk_10, MON_DATA_FORM, NULL); param0->unk_00 = param1->unk_00; param0->unk_19C = sub_020095C4(32, ¶m0->unk_10, param1->unk_0C); @@ -603,8 +603,8 @@ static void ov21_021E95F8 (UnkStruct_ov21_021E968C * param0, UnkStruct_020218BC UnkStruct_ov19_021DA864 v1; int v2, v3; - v2 = sub_020759F0(param4, 6); - v3 = sub_020759F0(param4, 7); + v2 = PokemonPersonalData_GetSpeciesValue(param4, 6); + v3 = PokemonPersonalData_GetSpeciesValue(param4, 7); v2 = ov21_021DF180(v2); v3 = ov21_021DF180(v3); diff --git a/src/overlay022/ov22_02255D44.c b/src/overlay022/ov22_02255D44.c index 2bdc31215e..2b66620340 100644 --- a/src/overlay022/ov22_02255D44.c +++ b/src/overlay022/ov22_02255D44.c @@ -12,7 +12,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_02029C68_decl.h" #include "struct_decls/struct_02029C88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/struct_02015958.h" diff --git a/src/overlay022/ov22_022578F4.c b/src/overlay022/ov22_022578F4.c index 7b06445ea4..e67dd63c4c 100644 --- a/src/overlay022/ov22_022578F4.c +++ b/src/overlay022/ov22_022578F4.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/union_02022594_020225E0.h" diff --git a/src/overlay022/ov22_02257F50.c b/src/overlay022/ov22_02257F50.c index e294c3ded3..45a393b072 100644 --- a/src/overlay022/ov22_02257F50.c +++ b/src/overlay022/ov22_02257F50.c @@ -148,8 +148,8 @@ void ov22_0225804C (int param0, int param1, int * param2, int * param3, int para case 0: *param2 = (8 + 2); *param3 = (16 + 2); - *param2 += (sub_0201D35C() % ((112 - (2 * 2)) - param4)); - *param3 += (sub_0201D35C() % ((129 - (2 * 2)) - param5)); + *param2 += (MTRNG_Next() % ((112 - (2 * 2)) - param4)); + *param3 += (MTRNG_Next() % ((129 - (2 * 2)) - param5)); break; case 1: case 2: diff --git a/src/overlay022/ov22_022589E0.c b/src/overlay022/ov22_022589E0.c index 51577515a5..55c2f51011 100644 --- a/src/overlay022/ov22_022589E0.c +++ b/src/overlay022/ov22_022589E0.c @@ -245,8 +245,8 @@ static void ov22_02258BB8 (UnkStruct_ov22_02258A48 * param0) if (v0->unk_20 == 1) { ov22_02259698(v0->unk_10, &v7, &v8); - v9 = ((8 + 2)) + (sub_0201D35C() % ((112 - (2 * 2)) - v7)); - v10 = ((16 + 2)) + (sub_0201D35C() % ((129 - (2 * 2)) - v8)); + v9 = ((8 + 2)) + (MTRNG_Next() % ((112 - (2 * 2)) - v7)); + v10 = ((16 + 2)) + (MTRNG_Next() % ((129 - (2 * 2)) - v8)); } else { v9 = v0->unk_1C; v10 = v0->unk_1E; diff --git a/src/overlay022/ov22_02259098.c b/src/overlay022/ov22_02259098.c index f3b52e3658..ca4ff85794 100644 --- a/src/overlay022/ov22_02259098.c +++ b/src/overlay022/ov22_02259098.c @@ -4,7 +4,7 @@ #include "data_021BF67C.h" #include "struct_decls/struct_02007768_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/union_02022594_020225E0.h" @@ -16,7 +16,7 @@ #include "unk_0200762C.h" #include "heap.h" #include "unk_02022594.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay022/ov22_02255094.h" #include "overlay022/ov22_02259098.h" @@ -42,7 +42,7 @@ void ov22_022590C0 (UnkStruct_020298D8 * param0, UnkStruct_02007768 * param1, Po void ov22_022590D4 (UnkStruct_020298D8 * param0, UnkStruct_02007768 * param1, Pokemon * param2, UnkStruct_02008A90 * param3, int param4, BOOL param5) { - int v0 = GetMonData(param2, MON_DATA_SPECIES, NULL); + int v0 = Pokemon_GetValue(param2, MON_DATA_SPECIES, NULL); sub_02075F00(param3, param2, 2); param0->unk_00 = sub_02007C34(param1, param3, 192, 56, 0, 0, NULL, NULL); diff --git a/src/overlay022/ov22_0225AF8C.c b/src/overlay022/ov22_0225AF8C.c index fe48e94e28..d3ec1dbe48 100644 --- a/src/overlay022/ov22_0225AF8C.c +++ b/src/overlay022/ov22_0225AF8C.c @@ -6,7 +6,7 @@ #include "struct_decls/struct_02029C88_decl.h" #include "struct_decls/struct_0202A138_decl.h" #include "struct_decls/struct_0202A150_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "overlay022/struct_ov22_02254DE0.h" @@ -25,7 +25,7 @@ #include "unk_02018340.h" #include "unk_0202298C.h" #include "unk_020298BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay022/ov22_02254DE0.h" #include "overlay022/ov22_02255094.h" #include "overlay022/ov22_022578F4.h" @@ -243,7 +243,7 @@ static UnkStruct_ov22_0225B1BC * ov22_0225B1BC (const UnkStruct_ov22_0225B4E4 * memset(v0, 0, sizeof(UnkStruct_ov22_0225B1BC)); v0->unk_29C = param0->unk_68; - v0->unk_298 = AllocMonZeroed(param0->unk_68); + v0->unk_298 = Pokemon_New(param0->unk_68); sub_0202A61C(param0->unk_00, v0->unk_298); ov22_0225B2D4(v0, param0); @@ -273,7 +273,7 @@ static UnkStruct_ov22_0225B1BC * ov22_0225B258 (const UnkStruct_ov22_0225B4E4 * memset(v0, 0, sizeof(UnkStruct_ov22_0225B1BC)); v0->unk_29C = param0->unk_68; - v0->unk_298 = AllocMonZeroed(param0->unk_68); + v0->unk_298 = Pokemon_New(param0->unk_68); sub_0202A61C(param0->unk_00, v0->unk_298); diff --git a/src/overlay022/ov22_0225B660.c b/src/overlay022/ov22_0225B660.c index 3918606b8f..eff0a09c6e 100644 --- a/src/overlay022/ov22_0225B660.c +++ b/src/overlay022/ov22_0225B660.c @@ -10,8 +10,7 @@ #include "strbuf.h" #include "struct_decls/struct_02029C68_decl.h" #include "struct_decls/struct_02029C88_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay022/struct_ov22_0225B1BC_decl.h" #include "struct_defs/struct_02041DC8.h" @@ -34,7 +33,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_020298BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02094EDC.h" #include "overlay022/ov22_02255094.h" #include "overlay022/ov22_0225AF8C.h" @@ -350,9 +349,9 @@ static void ov22_0225BC18 (UnkStruct_ov22_0225B85C * param0) sub_0202A524(param0->unk_04, v2); sub_0200B48C(v1, 3, v2, v4, 1, GAME_LANGUAGE); - v5 = AllocMonZeroed(13); + v5 = Pokemon_New(13); sub_0202A560(param0->unk_04, v5); - v6 = sub_02076B10(v5); + v6 = Pokemon_GetBoxPokemon(v5); sub_0200B5CC(v1, 4, v6); Heap_FreeToHeap(v5); diff --git a/src/overlay023/ov23_0223E140.c b/src/overlay023/ov23_0223E140.c index 8f81054bd8..0e4416ca91 100644 --- a/src/overlay023/ov23_0223E140.c +++ b/src/overlay023/ov23_0223E140.c @@ -982,7 +982,7 @@ static int ov23_0223E8CC (u16 param0, u16 param1) return -1; } - v6 = sub_0201D2E8() % v5; + v6 = LCRNG_Next() % v5; v5 = 0; for (v0 = 0; v0 < 250; v0++) { diff --git a/src/overlay023/ov23_0224340C.c b/src/overlay023/ov23_0224340C.c index b764c71d1c..6c5e9999c8 100644 --- a/src/overlay023/ov23_0224340C.c +++ b/src/overlay023/ov23_0224340C.c @@ -2367,7 +2367,7 @@ static void ov23_022451C8 (UnkStruct_0201CD38 * param0, void * param1) sub_02006E60(50, 8, v0->unk_10, 2, 0, 32 * 24 * 2, 0, 4); } else { u16 v2[] = {11, 12, 13, 14}; - u16 v3 = sub_0201D2E8() % 4; + u16 v3 = LCRNG_Next() % 4; sub_02006E60(50, v2[v3], v0->unk_10, 2, 0, 32 * 24 * 2, 0, 4); } @@ -4087,7 +4087,7 @@ static BOOL ov23_02247568 (UnkStruct_02018340 * param0, UnkStruct_ov23_022471D8 param1->unk_124++; - v11.x = (128 - (10 / 2) + (sub_0201D2E8() % 10)) * FX32_ONE; + v11.x = (128 - (10 / 2) + (LCRNG_Next() % 10)) * FX32_ONE; v11.y = param1->unk_120 * FX32_ONE; sub_02021C50(Unk_ov23_02257764->unk_25C[0], &v11); diff --git a/src/overlay023/ov23_02248F1C.c b/src/overlay023/ov23_02248F1C.c index ef5e3393d8..27ed82f846 100644 --- a/src/overlay023/ov23_02248F1C.c +++ b/src/overlay023/ov23_02248F1C.c @@ -210,8 +210,8 @@ static void ov23_022491CC (int param0[][2], int param1[][3]) param1[v0][1] = 0; param1[v0][2] = 0; - Unk_ov23_0225776C[v0][0] = sub_0201D2E8() % 500 + 50; - Unk_ov23_0225776C[v0][1] = sub_0201D2E8() % 500 + 50; + Unk_ov23_0225776C[v0][0] = LCRNG_Next() % 500 + 50; + Unk_ov23_0225776C[v0][1] = LCRNG_Next() % 500 + 50; } } diff --git a/src/overlay023/ov23_0224DC40.c b/src/overlay023/ov23_0224DC40.c index f1ae2bed3f..634468623d 100644 --- a/src/overlay023/ov23_0224DC40.c +++ b/src/overlay023/ov23_0224DC40.c @@ -314,7 +314,7 @@ static void ov23_0224DE3C (UnkStruct_ov23_0224E280 * param0) v1 = MessageLoader_Init(0, 26, 633, 4); for (v2 = 0; v2 < 4; v2++) { - u32 v5 = sub_0201D35C() % 12; + u32 v5 = MTRNG_Next() % 12; for (v3 = 0; v3 < v2; v3++) { if ((v4[v3] == v5)) { diff --git a/src/overlay028/ov28_022561C0.c b/src/overlay028/ov28_022561C0.c index c2d38b4b7d..cd77c8907d 100644 --- a/src/overlay028/ov28_022561C0.c +++ b/src/overlay028/ov28_022561C0.c @@ -16,7 +16,7 @@ #include "unk_0200D9E8.h" #include "heap.h" #include "unk_0202631C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay025/ov25_02253CE0.h" #include "overlay025/ov25_02255ACC.h" #include "overlay028/ov28_0225697C.h" diff --git a/src/overlay032/ov32_022561C0.c b/src/overlay032/ov32_022561C0.c index b9aa5c0867..6bf509b8ea 100644 --- a/src/overlay032/ov32_022561C0.c +++ b/src/overlay032/ov32_022561C0.c @@ -4,8 +4,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay025/struct_ov25_0225424C_decl.h" #include "overlay032/struct_ov32_02256470_decl.h" @@ -15,7 +14,7 @@ #include "unk_0200D9E8.h" #include "heap.h" #include "unk_02022594.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "overlay025/ov25_02253CE0.h" @@ -207,17 +206,17 @@ static void ov32_022563C8 (UnkStruct_ov32_02256470_1 * param0, Party * param1) for (v1 = 0; v1 < param0->unk_00; v1++) { v0 = Party_GetPokemonBySlotIndex(param1, v1); - v2 = sub_02073C88(v0); + v2 = Pokemon_EnterDecryptionContext(v0); param0->unk_04[v1].unk_00 = sub_02079D40((const BoxPokemon *)v0); - param0->unk_04[v1].unk_04 = GetMonData(v0, MON_DATA_SPECIES, NULL); - param0->unk_04[v1].unk_06 = GetMonData(v0, MON_DATA_163, NULL); - param0->unk_04[v1].unk_08 = GetMonData(v0, MON_DATA_164, NULL); - param0->unk_04[v1].unk_0A = GetMonData(v0, MON_DATA_HELD_ITEM, NULL); - param0->unk_04[v1].unk_0C = (GetMonData(v0, MON_DATA_160, NULL) != 0); - param0->unk_04[v1].unk_0E = GetMonData(v0, MON_DATA_IS_EGG, NULL); - param0->unk_04[v1].unk_0F = GetMonData(v0, MON_DATA_FORM, NULL); - - sub_02073CD4(v0, v2); + param0->unk_04[v1].unk_04 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + param0->unk_04[v1].unk_06 = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_04[v1].unk_08 = Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL); + param0->unk_04[v1].unk_0A = Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); + param0->unk_04[v1].unk_0C = (Pokemon_GetValue(v0, MON_DATA_160, NULL) != 0); + param0->unk_04[v1].unk_0E = Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); + param0->unk_04[v1].unk_0F = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); + + Pokemon_ExitDecryptionContext(v0, v2); } } diff --git a/src/overlay033/ov33_022561C0.c b/src/overlay033/ov33_022561C0.c index 9fcecf4613..a45179caf7 100644 --- a/src/overlay033/ov33_022561C0.c +++ b/src/overlay033/ov33_022561C0.c @@ -4,8 +4,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay025/struct_ov25_0225424C_decl.h" #include "overlay033/struct_ov33_02256474_decl.h" @@ -16,7 +15,7 @@ #include "heap.h" #include "unk_02022594.h" #include "unk_020244AC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "overlay025/ov25_02253CE0.h" @@ -88,11 +87,11 @@ static BOOL ov33_0225621C (UnkStruct_ov33_0225621C * param0, UnkStruct_ov25_0225 for (v2 = 0; v2 < param0->unk_04.unk_00; v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - param0->unk_04.unk_04[v4].unk_04 = GetMonData(v1, MON_DATA_SPECIES, NULL); - param0->unk_04.unk_04[v4].unk_08 = GetMonData(v1, MON_DATA_FORM, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + param0->unk_04.unk_04[v4].unk_04 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + param0->unk_04.unk_04[v4].unk_08 = Pokemon_GetValue(v1, MON_DATA_FORM, NULL); param0->unk_04.unk_04[v4].unk_00 = sub_02079D40((const BoxPokemon *)v1); - v3 = ov33_0225630C(GetMonData(v1, MON_DATA_FRIENDSHIP, NULL)); + v3 = ov33_0225630C(Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL)); switch (v3) { case 0: diff --git a/src/overlay033/ov33_02256474.c b/src/overlay033/ov33_02256474.c index 0f89a8751b..5db74dd6a1 100644 --- a/src/overlay033/ov33_02256474.c +++ b/src/overlay033/ov33_02256474.c @@ -24,7 +24,7 @@ #include "heap.h" #include "unk_02018340.h" #include "unk_0201D15C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay025/ov25_02253CE0.h" #include "overlay025/ov25_02254560.h" @@ -293,7 +293,7 @@ static void ov33_02256634 (UnkStruct_ov33_02256474 * param0, const UnkStruct_ov3 GF_ASSERT(0); } - param0->unk_134[v5].unk_30 = sub_020759CC(param1->unk_04[v5].unk_04, param1->unk_04[v5].unk_08, 28); + param0->unk_134[v5].unk_30 = PokemonPersonalData_GetFormValue(param1->unk_04[v5].unk_04, param1->unk_04[v5].unk_08, 28); param0->unk_134[v5].unk_31 = 0; param0->unk_134[v5].unk_32 = 0; @@ -309,8 +309,8 @@ static void ov33_022567D4 (VecFx32 * param0) { fx32 v0, v1; - v0 = (-32 + (sub_0201D35C() & 63)) * FX32_ONE; - v1 = (-32 + (sub_0201D35C() & 63)) * FX32_ONE; + v0 = (-32 + (MTRNG_Next() & 63)) * FX32_ONE; + v1 = (-32 + (MTRNG_Next() & 63)) * FX32_ONE; VEC_Set(param0, v0, v1, 0); VEC_Normalize(param0, param0); diff --git a/src/overlay040/ov40_022561C0.c b/src/overlay040/ov40_022561C0.c index 07eedc8005..2acf86fffe 100644 --- a/src/overlay040/ov40_022561C0.c +++ b/src/overlay040/ov40_022561C0.c @@ -6,7 +6,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_02026218_decl.h" #include "struct_decls/struct_02026310_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay025/struct_ov25_0225424C_decl.h" #include "overlay040/struct_ov40_0225645C_decl.h" @@ -16,7 +16,7 @@ #include "heap.h" #include "unk_02022594.h" #include "unk_020261E4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay005/ov5_021E622C.h" #include "overlay025/ov25_02253CE0.h" @@ -217,14 +217,14 @@ static void ov40_022563D0 (UnkStruct_ov40_0225645C_1 * param0, UnkStruct_0202631 for (v2 = 0; v2 < param0->unk_00; v2++) { v0 = sub_02026218(param1, v2); v1 = sub_02026220(v0); - v3 = sub_02073D20(v1); + v3 = BoxPokemon_EnterDecryptionContext(v1); param0->unk_04[v2] = sub_02079D40(v1); - param0->unk_1C[v2] = sub_02074570(v1, MON_DATA_SPECIES, NULL); - param0->unk_20[v2] = sub_02074570(v1, MON_DATA_FORM, NULL); + param0->unk_1C[v2] = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + param0->unk_20[v2] = BoxPokemon_GetValue(v1, MON_DATA_FORM, NULL); param0->unk_0C[v2] = ov5_021E6590(v0); - param0->unk_14[v2] = sub_02075D74(v1); + param0->unk_14[v2] = BoxPokemon_GetGender(v1); - sub_02073D48(v1, v3); + BoxPokemon_ExitDecryptionContext(v1, v3); } } diff --git a/src/overlay040/ov40_0225645C.c b/src/overlay040/ov40_0225645C.c index 0ee6c99334..8f1467481c 100644 --- a/src/overlay040/ov40_0225645C.c +++ b/src/overlay040/ov40_0225645C.c @@ -18,7 +18,7 @@ #include "unk_0200D9E8.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay025/ov25_02253CE0.h" #include "overlay025/ov25_02254560.h" @@ -394,7 +394,7 @@ static void ov40_02256848 (UnkStruct_ov40_0225645C * param0, const UnkStruct_ov4 ov25_02255938(param0->unk_24[2], 1 + sub_02079EDC(1, 0, 1)); if (param1->unk_00 > 0) { - if (sub_020759CC(param1->unk_1C[0], param1->unk_20[0], 28)) { + if (PokemonPersonalData_GetFormValue(param1->unk_1C[0], param1->unk_20[0], 28)) { ov25_022558C4(param0->unk_24[0], 6); } else { ov25_022558C4(param0->unk_24[0], 7); diff --git a/src/overlay041/ov41_022567B0.c b/src/overlay041/ov41_022567B0.c index 866157b52c..cc199befdd 100644 --- a/src/overlay041/ov41_022567B0.c +++ b/src/overlay041/ov41_022567B0.c @@ -374,7 +374,7 @@ static void ov41_02256B8C (UnkStruct_0201CD38 * param0, void * param1) ov25_02255950(v0->unk_24[0], v0->unk_68); if (v0->unk_60) { - v0->unk_6C = sub_0201D35C() & 7; + v0->unk_6C = MTRNG_Next() & 7; if (v0->unk_6A > 6656) { v0->unk_6A = 6656; diff --git a/src/overlay042/ov42_022561C0.c b/src/overlay042/ov42_022561C0.c index 1928b72c5f..a3d7aff106 100644 --- a/src/overlay042/ov42_022561C0.c +++ b/src/overlay042/ov42_022561C0.c @@ -152,7 +152,7 @@ static BOOL ov42_02256310 (UnkStruct_ov42_0225621C * param0) case 0: if (ov42_02256398()) { - param0->unk_08.unk_00 = sub_0201D35C() & 1; + param0->unk_08.unk_00 = MTRNG_Next() & 1; ov42_022564A0(param0->unk_0C, 2); param0->unk_01++; } diff --git a/src/overlay044/ov44_022561C0.c b/src/overlay044/ov44_022561C0.c index 679adf6198..34eab1a4f3 100644 --- a/src/overlay044/ov44_022561C0.c +++ b/src/overlay044/ov44_022561C0.c @@ -4,8 +4,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay025/struct_ov25_0225424C_decl.h" #include "overlay025/struct_ov25_02255B34_decl.h" @@ -16,7 +15,7 @@ #include "unk_0200D9E8.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "overlay005/ov5_021E622C.h" @@ -88,13 +87,13 @@ static BOOL ov44_0225621C (UnkStruct_ov44_0225621C * param0, UnkStruct_ov25_0225 for (v2 = 0; v2 < param0->unk_04.unk_30; v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL)) { continue; } param0->unk_04.unk_00[v3] = sub_02079D40((const BoxPokemon *)v1); - param0->unk_04.unk_18[v3] = GetMonData(v1, MON_DATA_SPECIES, NULL); - param0->unk_04.unk_24[v3] = GetMonData(v1, MON_DATA_FORM, NULL); + param0->unk_04.unk_18[v3] = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + param0->unk_04.unk_24[v3] = Pokemon_GetValue(v1, MON_DATA_FORM, NULL); param0->unk_48[v3] = (BoxPokemon *)v1; v3++; } diff --git a/src/overlay044/ov44_022565BC.c b/src/overlay044/ov44_022565BC.c index 98d4302326..54f4d22287 100644 --- a/src/overlay044/ov44_022565BC.c +++ b/src/overlay044/ov44_022565BC.c @@ -17,7 +17,7 @@ #include "unk_02006E3C.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay025/ov25_02253CE0.h" #include "overlay025/ov25_02254560.h" @@ -330,7 +330,7 @@ static void ov44_02256954 (UnkStruct_ov44_022565BC * param0, u32 param1, u32 par if (param1 == 5) { v1 = 4; } else { - if (sub_020759CC(param3, param4, 28)) { + if (PokemonPersonalData_GetFormValue(param3, param4, 28)) { v1 = 4; } else { v1 = 5; diff --git a/src/overlay057/ov57_021D0D80.c b/src/overlay057/ov57_021D0D80.c index 0bea5f8445..60a892b737 100644 --- a/src/overlay057/ov57_021D0D80.c +++ b/src/overlay057/ov57_021D0D80.c @@ -33,7 +33,7 @@ #include "unk_0202B37C.h" #include "unk_0205C980.h" #include "unk_0206B9D8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay057/ov57_021D0F30.h" @@ -137,7 +137,7 @@ static int ov57_021D0E34 (UnkStruct_020067E8 * param0, int * param1) if (!sub_02025D10(v1) || !sub_02025D40(v1)) { sub_02025DE8(sub_02025CD8(v0)); sub_02025CE4(v1); - sub_02077B8C(Party_GetFromSavedata(v0)); + Party_SetShayminLandForm(Party_GetFromSavedata(v0)); } sub_02017434(sub_02025E5C(v0)); @@ -404,11 +404,11 @@ static void ov57_021D0EAC (int param0, UnkStruct_021C0794 * param1, BOOL param2) sub_02025D84(v3); v4 = sub_0202B4A0(param1); - sub_0202B40C(v4, 1, sub_0201D35C()); + sub_0202B40C(v4, 1, MTRNG_Next()); sub_0206C008(param1); v2 = sub_02025E38(param1); - v0 = sub_0201D35C(); + v0 = MTRNG_Next(); if (param2) { sub_02025F1C(v2, v0); diff --git a/src/overlay062/ov62_02239D60.c b/src/overlay062/ov62_02239D60.c index 6d246f93e9..6761cb7846 100644 --- a/src/overlay062/ov62_02239D60.c +++ b/src/overlay062/ov62_02239D60.c @@ -10,7 +10,6 @@ #include "struct_decls/struct_0200C704_decl.h" #include "strbuf.h" #include "struct_decls/struct_02023FCC_decl.h" -#include "struct_decls/struct_02075874_decl.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -46,7 +45,7 @@ #include "unk_02023FCC.h" #include "unk_0202440C.h" #include "unk_02030A80.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02079D40.h" #include "unk_0208B284.h" @@ -1178,7 +1177,7 @@ static void ov62_0223AFEC (UnkStruct_0208C06C * param0) static void ov62_0223B050 (UnkStruct_0208C06C * param0) { UnkStruct_ov62_02239DBC * v0 = param0->unk_860; - UnkStruct_02075874 * v1; + PokemonPersonalData * v1; UnkStruct_02008A90 v2; u8 v3; u8 v4; @@ -1204,15 +1203,15 @@ static void ov62_0223B050 (UnkStruct_0208C06C * param0) v7 = 494; } - v1 = sub_02075894(v7, 102); - v3 = sub_02075DAC(v7, v8); - v4 = sub_02075E38(v5, v8); + v1 = PokemonPersonalData_FromMonSpecies(v7, 102); + v3 = Pokemon_GetGenderOf(v7, v8); + v4 = Pokemon_IsPersonalityShiny(v5, v8); v9 = sub_02076648(v7, v3, v10, v6, v8); v9 = 0; sub_02075FB4(&v2, v7, v3, v10, v4, v6, v8); v0->unk_32C = sub_02007C34(param0->unk_14.unk_50, &v2, 42, 91 + v9, 0, 0, NULL, NULL); - sub_020759B8(v1); + PokemonPersonalData_Free(v1); } static void ov62_0223B124 (UnkStruct_0208C06C * param0, int param1) diff --git a/src/overlay062/ov62_02248408.c b/src/overlay062/ov62_02248408.c index 2aabb205b5..24872b1f0e 100644 --- a/src/overlay062/ov62_02248408.c +++ b/src/overlay062/ov62_02248408.c @@ -7,7 +7,7 @@ #include "struct_defs/struct_0202F298.h" #include "struct_defs/struct_0202F298_sub1.h" #include "struct_defs/struct_0202F41C.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay006/battle_params.h" #include "unk_02002B7C.h" @@ -18,7 +18,7 @@ #include "unk_0202440C.h" #include "unk_020244AC.h" #include "unk_0202F1D4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay062/ov62_02248408.h" @@ -71,18 +71,18 @@ void ov62_02248408 (UnkStruct_0202F264 * param0, BattleParams * param1, int para for (v11 = 0; v11 < v12; v11++) { v13 = Party_GetPokemonBySlotIndex(param1->parties[v4], v11); - if (GetMonData(v13, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v13, MON_DATA_172, NULL) == 0) { break; } MI_CpuClear16(v8, sizeof(u16) * v9); - GetMonData(v13, MON_DATA_117, v8); + Pokemon_GetValue(v13, MON_DATA_117, v8); Strbuf_Clear(v6); Strbuf_CopyChars(v6, v8); if (sub_02002DB4(0, v6, v7) == 0) { - sub_02074B30(v13, 179, NULL); + Pokemon_SetValue(v13, 179, NULL); continue; } } diff --git a/src/overlay064/ov64_0222DCE0.c b/src/overlay064/ov64_0222DCE0.c index 8cc304ad94..9b39b1bbb8 100644 --- a/src/overlay064/ov64_0222DCE0.c +++ b/src/overlay064/ov64_0222DCE0.c @@ -85,7 +85,7 @@ #include "unk_0203909C.h" #include "unk_020507CC.h" #include "unk_0205C980.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0207D3B8.h" #include "unk_0208694C.h" #include "unk_020890F4.h" diff --git a/src/overlay065/ov65_0222DCE0.c b/src/overlay065/ov65_0222DCE0.c index 05a6bfa1c5..d56a147a8e 100644 --- a/src/overlay065/ov65_0222DCE0.c +++ b/src/overlay065/ov65_0222DCE0.c @@ -20,7 +20,7 @@ #include "struct_decls/struct_0202B628_decl.h" #include "struct_decls/struct_0202C878_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay065/struct_ov65_0222EBE0_decl.h" @@ -98,7 +98,7 @@ #include "unk_0203909C.h" #include "unk_020393C8.h" #include "unk_020507CC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_0207DFAC.h" @@ -668,11 +668,11 @@ static int ov65_0222DF88 (UnkStruct_ov65_0222EBE0 * param0) for (v3 = 0; v3 < v2; v3++) { v1 = Party_GetPokemonBySlotIndex(v0, v3); - if (GetMonData(v1, MON_DATA_163, NULL) == 0) { + if (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) == 0) { continue; } - if (GetMonData(v1, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL)) { continue; } @@ -1820,8 +1820,8 @@ static void ov65_0222F4C4 (UnkStruct_ov65_0222EBE0 * param0, int param1) for (v5 = 0; v5 < v4; v5++) { Pokemon * v6 = Party_GetPokemonBySlotIndex(v2, v5); - param0->unk_04->unk_00.unk_00[v5] = GetMonData(v6, MON_DATA_SPECIES, NULL); - param0->unk_04->unk_00.unk_0C[v5] = GetMonData(v6, MON_DATA_HELD_ITEM, NULL); + param0->unk_04->unk_00.unk_00[v5] = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + param0->unk_04->unk_00.unk_0C[v5] = Pokemon_GetValue(v6, MON_DATA_HELD_ITEM, NULL); } param0->unk_04->unk_00.unk_18 = sub_02025FCC(v0); diff --git a/src/overlay065/ov65_02235060.c b/src/overlay065/ov65_02235060.c index 39d4a47192..13058e11e6 100644 --- a/src/overlay065/ov65_02235060.c +++ b/src/overlay065/ov65_02235060.c @@ -905,7 +905,7 @@ static void ov65_02235E84 (UnkStruct_ov65_02235130 * param0, UnkStruct_ov65_0223 { param1->unk_10 = ov65_022361C8; param1->unk_18 = ov65_02235EF4; - param1->unk_08 = 256 + (sub_0201D35C() % 1024); + param1->unk_08 = 256 + (MTRNG_Next() % 1024); param1->unk_0C = 3; ov65_02236250(param0, 0, param1); @@ -1083,9 +1083,9 @@ static BOOL ov65_022361C8 (UnkStruct_ov65_02235130 * param0, UnkStruct_ov65_0223 param1->unk_08--; if (param1->unk_08 <= 0) { - param1->unk_08 = 256 + (sub_0201D35C() % 1024); + param1->unk_08 = 256 + (MTRNG_Next() % 1024); - v0 = sub_0201D35C() % 4; + v0 = MTRNG_Next() % 4; v1 = ov63_0222BF90(param1->unk_00, 4); ov65_02236230(param0, 0, v0, v1); diff --git a/src/overlay066/ov66_0222DDF0.c b/src/overlay066/ov66_0222DDF0.c index 9024982bd3..d350e8b519 100644 --- a/src/overlay066/ov66_0222DDF0.c +++ b/src/overlay066/ov66_0222DDF0.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_0202C878_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_02030EC4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207E060_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -61,7 +61,7 @@ #include "unk_0202C858.h" #include "unk_0202CD50.h" #include "unk_02030EA4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207E060.h" #include "overlay066/ov66_0222DDF0.h" @@ -2350,9 +2350,9 @@ static void ov66_0222F7C8 (UnkStruct_ov66_0222F6C4 * param0, UnkStruct_021C0794 for (v8 = 0; v8 < 6; v8++) { if (v8 < v7) { v6 = Party_GetPokemonBySlotIndex(v1, v8); - param0->unk_20.unk_20[v8] = GetMonData(v6, MON_DATA_SPECIES, NULL); - param0->unk_20.unk_2C[v8] = GetMonData(v6, MON_DATA_FORM, NULL); - param0->unk_20.unk_32[v8] = GetMonData(v6, MON_DATA_IS_EGG, NULL); + param0->unk_20.unk_20[v8] = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + param0->unk_20.unk_2C[v8] = Pokemon_GetValue(v6, MON_DATA_FORM, NULL); + param0->unk_20.unk_32[v8] = Pokemon_GetValue(v6, MON_DATA_IS_EGG, NULL); } else { param0->unk_20.unk_20[v8] = 495; } @@ -3423,7 +3423,7 @@ static u32 ov66_02230828 (const UnkStruct_ov66_022307D4 * param0) v1 += param0->unk_00[v0]; } - v3 = sub_0201D35C() % v1; + v3 = MTRNG_Next() % v1; v2 = 0; for (v0 = 0; v0 < (27 / 3); v0++) { diff --git a/src/overlay070/ov70_0225C9B4.c b/src/overlay070/ov70_0225C9B4.c index 936f197d0d..02f0d1b3a0 100644 --- a/src/overlay070/ov70_0225C9B4.c +++ b/src/overlay070/ov70_0225C9B4.c @@ -712,7 +712,7 @@ static u8 ov70_0225D194 (const u8 * param0, u32 param1) { int v0; - v0 = sub_0201D35C() % param1; + v0 = MTRNG_Next() % param1; return param0[v0]; } diff --git a/src/overlay070/ov70_0225D9A4.c b/src/overlay070/ov70_0225D9A4.c index 60b123c3d5..d9d2abdd81 100644 --- a/src/overlay070/ov70_0225D9A4.c +++ b/src/overlay070/ov70_0225D9A4.c @@ -88,7 +88,7 @@ #include "unk_020279FC.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0207C908.h" #include "overlay066/ov66_0222DDF0.h" #include "overlay066/ov66_02231428.h" diff --git a/src/overlay070/ov70_02260B44.c b/src/overlay070/ov70_02260B44.c index 80c1a249de..404567671c 100644 --- a/src/overlay070/ov70_02260B44.c +++ b/src/overlay070/ov70_02260B44.c @@ -449,11 +449,11 @@ void ov70_0226111C (UnkStruct_ov70_02260BB8 * param0, UnkStruct_ov70_022610B8 * break; case 5: param1->unk_C0[param2] = 0; - param1->unk_CD[param2] = sub_0201D35C() % param1->unk_CC; + param1->unk_CD[param2] = MTRNG_Next() % param1->unk_CC; break; case 6: param1->unk_C0[param2] = 0; - param1->unk_CD[param2] = sub_0201D35C() % param1->unk_CC; + param1->unk_CD[param2] = MTRNG_Next() % param1->unk_CC; break; } @@ -1059,7 +1059,7 @@ static void ov70_02261C60 (UnkStruct_ov70_02260BB8 * param0, UnkStruct_ov70_0226 v1 = ov70_02261498(¶m1->unk_C0[v0], ¶m1->unk_7C[v0], param1->unk_DC); if (v1 == 1) { - param1->unk_CD[v0] = sub_0201D35C() % param1->unk_CC; + param1->unk_CD[v0] = MTRNG_Next() % param1->unk_CC; param1->unk_C0[v0] = 0; } diff --git a/src/overlay070/ov70_022630A4.c b/src/overlay070/ov70_022630A4.c index ac3d01c3de..8c018e436e 100644 --- a/src/overlay070/ov70_022630A4.c +++ b/src/overlay070/ov70_022630A4.c @@ -555,7 +555,7 @@ static void ov70_02263270 (UnkStruct_ov70_02263270 * param0) param0->unk_00 = 0; param0->unk_04 = 0; param0->unk_05 = 1; - param0->unk_06 = sub_0201D35C() % 4; + param0->unk_06 = MTRNG_Next() % 4; param0->unk_07 = 1; } @@ -584,7 +584,7 @@ static fx32 ov70_02263290 (UnkStruct_ov70_02263270 * param0) if (param0->unk_07 == 1) { param0->unk_04 = 0; param0->unk_05 = 1; - param0->unk_06 = sub_0201D35C() % 4; + param0->unk_06 = MTRNG_Next() % 4; } else { param0->unk_05 = 0; } diff --git a/src/overlay070/ov70_02266E9C.c b/src/overlay070/ov70_02266E9C.c index 828a696430..0db03ebbbc 100644 --- a/src/overlay070/ov70_02266E9C.c +++ b/src/overlay070/ov70_02266E9C.c @@ -2337,7 +2337,7 @@ static void ov70_02268EEC (UnkStruct_ov70_02268E44 * param0, UnkStruct_ov70_0225 } } else { do { - v1 = sub_0201D35C() % param2; + v1 = MTRNG_Next() % param2; v2 = v1; v4 = ov70_0225E064(param1, v2); } while (v4 == 1); diff --git a/src/overlay073/ov73_021D0D80.c b/src/overlay073/ov73_021D0D80.c index e85cf05234..bdd6a9c04b 100644 --- a/src/overlay073/ov73_021D0D80.c +++ b/src/overlay073/ov73_021D0D80.c @@ -60,7 +60,7 @@ #include "unk_02025E68.h" #include "unk_020277A4.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208694C.h" FS_EXTERN_OVERLAY(overlay57); diff --git a/src/overlay076/ov76_0223B870.c b/src/overlay076/ov76_0223B870.c index bd91509004..0884accbd7 100644 --- a/src/overlay076/ov76_0223B870.c +++ b/src/overlay076/ov76_0223B870.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay076/const_ov76_0223EF3C.h" @@ -51,7 +51,7 @@ #include "unk_0202419C.h" #include "unk_02024220.h" #include "unk_0202C9F4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "unk_02097B18.h" #include "overlay012/ov12_02225864.h" @@ -595,9 +595,9 @@ void ov76_0223C188 (UnkStruct_ov76_0223DE00 * param0) param0->unk_2FC[v0] = sub_0200CE6C(param0->unk_D4.unk_08, param0->unk_D4.unk_0C, &v6); - v2 = GetMonData(v5, MON_DATA_SPECIES, NULL); - v1 = GetMonData(v5, MON_DATA_IS_EGG, NULL); - v4 = GetMonData(v5, MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v5, MON_DATA_IS_EGG, NULL); + v4 = Pokemon_GetValue(v5, MON_DATA_FORM, NULL); v3 = sub_02079EDC(v2, v4, v1); sub_02021F24(param0->unk_2FC[v0]->unk_00, v3); @@ -873,12 +873,12 @@ void ov76_0223C80C (UnkStruct_ov76_0223DE00 * param0, int param1, int param2) if (v1 != 0xff) { v3 = param2 + 1; - sub_02074B30(param0->unk_00->unk_04[v1], 162, (u8 *)&v3); + Pokemon_SetValue(param0->unk_00->unk_04[v1], 162, (u8 *)&v3); } if (v2 != 0xff) { v4 = param1 + 1; - sub_02074B30(param0->unk_00->unk_04[v2], 162, (u8 *)&v4); + Pokemon_SetValue(param0->unk_00->unk_04[v2], 162, (u8 *)&v4); } v0 = param0->unk_04[param1].unk_00; diff --git a/src/overlay076/ov76_0223D338.c b/src/overlay076/ov76_0223D338.c index b357e9f8ea..9790e7a0ad 100644 --- a/src/overlay076/ov76_0223D338.c +++ b/src/overlay076/ov76_0223D338.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_0202CD88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay076/const_ov76_0223EF3C.h" @@ -50,7 +50,7 @@ #include "unk_02023FCC.h" #include "unk_0202C9F4.h" #include "unk_0202CD50.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02097B18.h" #include "overlay012/ov12_02235E94.h" #include "overlay076/ov76_0223B140.h" @@ -112,20 +112,20 @@ void ov76_0223D3CC (UnkStruct_ov76_0223DE00 * param0) if (param0->unk_04[param0->unk_3C4[0]].unk_00 != 0xff) { v2 = param0->unk_00->unk_04[param0->unk_04[param0->unk_3C4[0]].unk_00]; - sub_020775EC(v2, param0->unk_428); + Pokemon_Copy(v2, param0->unk_428); return; } for (v0 = 0; v0 < param0->unk_00->unk_00; v0++) { v2 = param0->unk_00->unk_04[v0]; - v1 = GetMonData(v2, MON_DATA_IS_EGG, NULL); + v1 = Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL); if (v1 != 0) { continue; } - sub_020775EC(v2, param0->unk_428); + Pokemon_Copy(v2, param0->unk_428); break; } } @@ -718,7 +718,7 @@ void ov76_0223DD88 (UnkStruct_ov76_0223DE00 * param0) sub_02075EF4(&v0, param0->unk_428, 2); - v2 = GetMonData(param0->unk_428, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(param0->unk_428, MON_DATA_SPECIES, NULL); v3 = sub_020765AC(param0->unk_428, 2); param0->unk_D4.unk_D8 = v3; @@ -731,8 +731,8 @@ static void ov76_0223DE00 (UnkStruct_ov76_0223DE00 * param0) int v0; int v1; - v0 = GetMonData(param0->unk_428, MON_DATA_SPECIES, NULL); - v1 = sub_02075BCC(param0->unk_428); + v0 = Pokemon_GetValue(param0->unk_428, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetNature(param0->unk_428); sub_02007B98(param0->unk_D4.unk_D4, 1); sub_020789F4(param0->unk_42C, param0->unk_D4.unk_188, param0->unk_D4.unk_D4, v0, 2, 0, 0); @@ -865,7 +865,7 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) v0.unk_18 = 1; v0.unk_1C = param0->unk_D4.unk_08; v0.unk_20 = param0->unk_D4.unk_14; - v0.unk_10 = GetMonData(param0->unk_428, MON_DATA_POKEBALL, NULL); + v0.unk_10 = Pokemon_GetValue(param0->unk_428, MON_DATA_POKEBALL, NULL); param0->unk_D4.unk_158 = ov12_02237728(&v0); param0->unk_3DC++; @@ -882,8 +882,8 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) v1 = param0->unk_3C4[0] + 1; ov76_0223B848(&v2, param0); - sub_02074B30(param0->unk_428, 162, (u8 *)&v1); - sub_02074B30(param0->unk_428, 171, &v2); + Pokemon_SetValue(param0->unk_428, 162, (u8 *)&v1); + Pokemon_SetValue(param0->unk_428, 171, &v2); param0->unk_D4.unk_154 = ov12_02236004(53, &v3); ov12_02236320(param0->unk_D4.unk_154); @@ -955,7 +955,7 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) v5.unk_18 = 1; v5.unk_1C = param0->unk_D4.unk_08; v5.unk_20 = param0->unk_D4.unk_14; - v5.unk_10 = GetMonData(param0->unk_428, MON_DATA_POKEBALL, NULL); + v5.unk_10 = Pokemon_GetValue(param0->unk_428, MON_DATA_POKEBALL, NULL); param0->unk_D4.unk_158 = ov12_02237728(&v5); @@ -1015,7 +1015,7 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) if (param0->unk_264[param0->unk_3C4[0]].unk_00 != 0xff) { v8 = param0->unk_00->unk_04[param0->unk_264[param0->unk_3C4[0]].unk_00]; - sub_02074B30(v8, 171, sub_0202CA28(param0->unk_00->unk_20, param0->unk_3C4[0])); + Pokemon_SetValue(v8, 171, sub_0202CA28(param0->unk_00->unk_20, param0->unk_3C4[0])); } } param0->unk_3D4 = 8; @@ -1244,7 +1244,7 @@ void ov76_0223E91C (UnkStruct_ov76_0223DE00 * param0, int param1) v1 = param0->unk_04[param1].unk_00; if (v1 != 0xff) { - sub_02074B30(param0->unk_00->unk_04[v1], 162, (u8 *)&v2); + Pokemon_SetValue(param0->unk_00->unk_04[v1], 162, (u8 *)&v2); } param0->unk_04[param1].unk_00 = 0xff; diff --git a/src/overlay077/ov77_021D25B0.c b/src/overlay077/ov77_021D25B0.c index d4bd12b39f..0e3465c22e 100644 --- a/src/overlay077/ov77_021D25B0.c +++ b/src/overlay077/ov77_021D25B0.c @@ -959,9 +959,9 @@ static int ov77_021D2D08 (UnkStruct_020067E8 * param0, int * param1) Unk_021BF67C.unk_65 = 0; GXLayers_SwapDisplay(); - v0->unk_14 = sub_0201D2D0(); + v0->unk_14 = LCRNG_GetSeed(); - sub_0201D2DC(0); + LCRNG_SetSeed(0); return 1; } @@ -1023,7 +1023,7 @@ static int ov77_021D2E60 (UnkStruct_020067E8 * param0, int * param1) sub_0200F2C0(); } - sub_0201D2DC(v0->unk_14); + LCRNG_SetSeed(v0->unk_14); sub_02006830(param0); Heap_Destroy(76); sub_02000EC4(FS_OVERLAY_ID(overlay77), &Unk_ov77_021D742C); diff --git a/src/overlay077/ov77_021D6670.c b/src/overlay077/ov77_021D6670.c index 122df12677..3c43d88484 100644 --- a/src/overlay077/ov77_021D6670.c +++ b/src/overlay077/ov77_021D6670.c @@ -303,8 +303,8 @@ static void ov77_021D6A44 (UnkStruct_ov77_021D6ADC * param0, const u8 param1, co VecFx32 v3; v3 = *sub_02021D28(v1->unk_04); - v3.x = FX32_ONE * (64 + (sub_0201D2E8() % 128)); - v3.y = FX32_ONE * (v2 + (sub_0201D2E8() % 64)); + v3.x = FX32_ONE * (64 + (LCRNG_Next() % 128)); + v3.y = FX32_ONE * (v2 + (LCRNG_Next() % 64)); sub_02021C50(v1->unk_04, &v3); } @@ -394,8 +394,8 @@ static void ov77_021D6BAC (UnkStruct_ov77_021D6734 * param0, const u8 param1, in VecFx32 v3; v3 = *sub_02021D28(v2->unk_04); - v3.x = FX32_ONE * ((16 - 6) + (sub_0201D2E8() % 224)); - v3.y = FX32_ONE * (192 + (64 - 6) + (sub_0201D2E8() % 56)); + v3.x = FX32_ONE * ((16 - 6) + (LCRNG_Next() % 224)); + v3.y = FX32_ONE * (192 + (64 - 6) + (LCRNG_Next() % 56)); sub_02021C50(v2->unk_04, &v3); } diff --git a/src/overlay077/ov77_021D6C70.c b/src/overlay077/ov77_021D6C70.c index 2297a4146c..0921daa9c5 100644 --- a/src/overlay077/ov77_021D6C70.c +++ b/src/overlay077/ov77_021D6C70.c @@ -16,7 +16,7 @@ #include "heap.h" #include "unk_02020020.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay077/ov77_021D6C70.h" typedef struct UnkStruct_ov77_021D6CFC_t { diff --git a/src/overlay078/ov78_021D0D80.c b/src/overlay078/ov78_021D0D80.c index 9486361f49..4c8a4573f5 100644 --- a/src/overlay078/ov78_021D0D80.c +++ b/src/overlay078/ov78_021D0D80.c @@ -71,7 +71,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay078/ov78_021D0D80.h" typedef struct { @@ -663,7 +663,7 @@ static void ov78_021D1468 (UnkStruct_02007C7C ** param0, UnkStruct_ov78_021D107C UnkStruct_02008A90 v0; int v1; - v1 = sub_02075DAC(param2, 0); + v1 = Pokemon_GetGenderOf(param2, 0); sub_02075FB4(&v0, param2, v1, 2, 0, NULL, NULL); diff --git a/src/overlay079/ov79_021D2268.c b/src/overlay079/ov79_021D2268.c index 6ffdac3e1f..5905734884 100644 --- a/src/overlay079/ov79_021D2268.c +++ b/src/overlay079/ov79_021D2268.c @@ -54,7 +54,7 @@ #include "strbuf.h" #include "unk_02034198.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208C098.h" #include "unk_020989DC.h" #include "unk_02098FFC.h" @@ -527,13 +527,13 @@ static void ov79_021D27AC (UnkStruct_ov79_021D2928 * param0) static void ov79_021D27D8 (UnkStruct_ov79_021D2928 * param0) { param0->unk_30.unk_00 = param0->unk_10->unk_00; - param0->unk_30.unk_04 = GetMonData(param0->unk_10->unk_00, MON_DATA_SPECIES, NULL); - param0->unk_30.unk_07 = sub_02075D6C(param0->unk_10->unk_00); - param0->unk_30.unk_06 = sub_02075BCC(param0->unk_10->unk_00); - param0->unk_30.unk_08 = sub_020759CC(param0->unk_30.unk_04, GetMonData(param0->unk_10->unk_00, MON_DATA_FORM, NULL), 28) ^ 1; + param0->unk_30.unk_04 = Pokemon_GetValue(param0->unk_10->unk_00, MON_DATA_SPECIES, NULL); + param0->unk_30.unk_07 = Pokemon_GetGender(param0->unk_10->unk_00); + param0->unk_30.unk_06 = Pokemon_GetNature(param0->unk_10->unk_00); + param0->unk_30.unk_08 = PokemonPersonalData_GetFormValue(param0->unk_30.unk_04, Pokemon_GetValue(param0->unk_10->unk_00, MON_DATA_FORM, NULL), 28) ^ 1; param0->unk_30.unk_0C = Strbuf_Init(12, param0->unk_00); - GetMonData(param0->unk_10->unk_00, MON_DATA_119, param0->unk_30.unk_0C); + Pokemon_GetValue(param0->unk_10->unk_00, MON_DATA_119, param0->unk_30.unk_0C); param0->unk_30.unk_09 = sub_02098EAC(param0->unk_10->unk_04, param0->unk_30.unk_06); } @@ -690,7 +690,7 @@ static int ov79_021D2AF0 (UnkStruct_ov79_021D2928 * param0, UnkStruct_ov79_021D2 { u32 v0; - v0 = GetMonData(param0->unk_30.unk_00, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param0->unk_30.unk_00, MON_DATA_FORM, NULL); switch (param0->unk_30.unk_09) { case 1: diff --git a/src/overlay079/ov79_021D3768.c b/src/overlay079/ov79_021D3768.c index be65817311..74c7672616 100644 --- a/src/overlay079/ov79_021D3768.c +++ b/src/overlay079/ov79_021D3768.c @@ -12,7 +12,7 @@ #include "gx_layers.h" #include "unk_02020020.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay079/ov79_021D3768.h" static void ov79_021D3870(UnkStruct_ov79_021D3820 * param0, int param1); diff --git a/src/overlay081/ov81_021D1610.c b/src/overlay081/ov81_021D1610.c index 3ea67c3e9d..26add406a5 100644 --- a/src/overlay081/ov81_021D1610.c +++ b/src/overlay081/ov81_021D1610.c @@ -2,7 +2,7 @@ #include #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0202BC58.h" #include "struct_defs/struct_0202BCC8.h" @@ -22,7 +22,7 @@ #include "strbuf.h" #include "unk_0202B604.h" #include "map_header.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "overlay081/ov81_021D1610.h" @@ -822,10 +822,10 @@ static void ov81_021D285C (UnkStruct_ov81_021D1610 * param0, UnkStruct_0205AA50 static void ov81_021D28C8 (UnkStruct_ov81_021D1610 * param0, u16 param1, u8 param2, u8 param3) { - Pokemon * v0 = AllocMonZeroed(42); + Pokemon * v0 = Pokemon_New(42); sub_02074088(v0, param1, 1, 32, param2, 0, 0); - sub_0200B538(param0->unk_54, param3, sub_02076B10(v0)); + sub_0200B538(param0->unk_54, param3, Pokemon_GetBoxPokemon(v0)); Heap_FreeToHeap(v0); } diff --git a/src/overlay083/ov83_0223D6A8.c b/src/overlay083/ov83_0223D6A8.c index 090f31a35b..4cc490b3ba 100644 --- a/src/overlay083/ov83_0223D6A8.c +++ b/src/overlay083/ov83_0223D6A8.c @@ -1326,9 +1326,9 @@ void ov83_0223EDDC (UnkStruct_ov83_0223ED3C * param0, int param1, int param2) ov83_0223F054(v0); } - v1 = sub_0201D35C(); - v10 = v9.unk_10 + (sub_0201D35C() % v9.unk_11); - v11 = v9.unk_12 + (sub_0201D35C() % v9.unk_13); + v1 = MTRNG_Next(); + v10 = v9.unk_10 + (MTRNG_Next() % v9.unk_11); + v11 = v9.unk_12 + (MTRNG_Next() % v9.unk_13); v11 += v10; @@ -1344,7 +1344,7 @@ void ov83_0223EDDC (UnkStruct_ov83_0223ED3C * param0, int param1, int param2) v4 += 96 * FX32_ONE; v5 += 96 * FX32_ONE; - v6 = v9.unk_00 + (sub_0201D35C() % v9.unk_04); + v6 = v9.unk_00 + (MTRNG_Next() % v9.unk_04); ov83_0223F1C0(v0, v9.unk_17, v2, v3, v7, v4, v5, v8, FX32_CONST(0.10f), v6, v9.unk_08, v9.unk_18, v9.unk_14, ¶m0->unk_08[v9.unk_15], v9.unk_16, param0->unk_04, param0->unk_0C, v9.unk_19, v9.unk_1A); v0->unk_7C = param0->unk_410; diff --git a/src/overlay083/ov83_0223F7F4.c b/src/overlay083/ov83_0223F7F4.c index 2e2d2b7d9d..1c29ed2e93 100644 --- a/src/overlay083/ov83_0223F7F4.c +++ b/src/overlay083/ov83_0223F7F4.c @@ -344,7 +344,7 @@ void ov83_0223FBBC (UnkStruct_ov83_0223FBA4 * param0, int param1, s32 param2, BO } if (param0->unk_04 < 0) { - v1 = sub_0201D35C(); + v1 = MTRNG_Next(); v2 = (v1 % 5); if (v2 <= param0->unk_08) { diff --git a/src/overlay086/ov86_0223B140.c b/src/overlay086/ov86_0223B140.c index f42ebcbbe4..c7d9046e40 100644 --- a/src/overlay086/ov86_0223B140.c +++ b/src/overlay086/ov86_0223B140.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02007C10.h" #include "struct_defs/struct_02008900.h" @@ -60,7 +60,7 @@ #include "strbuf.h" #include "unk_02025E68.h" #include "unk_0202CBE4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay086/ov86_0223B140.h" @@ -328,7 +328,7 @@ int ov86_0223B140 (UnkStruct_020067E8 * param0, int * param1) v2 = Party_GetCurrentCount(v0->unk_0C->unk_04); for (v1 = 0; v1 < v2; v1++) { - if (GetMonData(Party_GetPokemonBySlotIndex(v0->unk_0C->unk_04, v1), MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(Party_GetPokemonBySlotIndex(v0->unk_0C->unk_04, v1), MON_DATA_IS_EGG, NULL) == 0) { v0->unk_2C8[v0->unk_04] = v1; v0->unk_04++; } @@ -861,15 +861,15 @@ static void ov86_0223BAC8 (UnkStruct_ov86_0223B3C8 * param0, NNSG2dCellDataBank v11 = Party_GetPokemonBySlotIndex(param0->unk_0C->unk_04, param0->unk_2C8[v12]); sub_02075EF4(&v1, (Pokemon *)v11, 2); - param0->unk_2E0[v12] = GetMonData((Pokemon *)v11, MON_DATA_SPECIES, NULL); - param0->unk_2F8[v12] = GetMonData((Pokemon *)v11, MON_DATA_FORM, NULL); + param0->unk_2E0[v12] = Pokemon_GetValue((Pokemon *)v11, MON_DATA_SPECIES, NULL); + param0->unk_2F8[v12] = Pokemon_GetValue((Pokemon *)v11, MON_DATA_FORM, NULL); - sub_02013720(v1.unk_00, v1.unk_02, 63, &v0[0], param0->unk_310, GetMonData((Pokemon *)v11, MON_DATA_PERSONALITY, NULL), 1, 2, param0->unk_2E0[v12]); + sub_02013720(v1.unk_00, v1.unk_02, 63, &v0[0], param0->unk_310, Pokemon_GetValue((Pokemon *)v11, MON_DATA_PERSONALITY, NULL), 1, 2, param0->unk_2E0[v12]); DC_FlushRange(param0->unk_310, 3200); GX_LoadOBJ(param0->unk_310, v12 * 2 * 3200, 3200); - sub_02013720(v1.unk_00, v1.unk_02, 63, &v0[1], param0->unk_310, GetMonData((Pokemon *)v11, MON_DATA_PERSONALITY, NULL), 1, 2, param0->unk_2E0[v12]); + sub_02013720(v1.unk_00, v1.unk_02, 63, &v0[1], param0->unk_310, Pokemon_GetValue((Pokemon *)v11, MON_DATA_PERSONALITY, NULL), 1, 2, param0->unk_2E0[v12]); DC_FlushRange(param0->unk_310, 3200); GX_LoadOBJ(param0->unk_310, v12 * 2 * 3200 + 3200, 3200); @@ -1303,10 +1303,10 @@ static void ov86_0223C47C (UnkStruct_ov86_0223C3E4 * param0, int param1) static void ov86_0223C4DC (UnkStruct_ov86_0223C3E4 * param0) { - sub_0200B538(param0->unk_14, 0, sub_02076B10(param0->unk_24)); - sub_0200B60C(param0->unk_14, 1, sub_02075B38(param0->unk_24), 3, 0, 1); + sub_0200B538(param0->unk_14, 0, Pokemon_GetBoxPokemon(param0->unk_24)); + sub_0200B60C(param0->unk_14, 1, Pokemon_GetLevel(param0->unk_24), 3, 0, 1); - switch (sub_02075D6C(param0->unk_24)) { + switch (Pokemon_GetGender(param0->unk_24)) { case 0: MessageLoader_GetStrbuf(param0->unk_20, 1, param0->unk_18); break; @@ -1329,7 +1329,7 @@ static void ov86_0223C54C (UnkStruct_ov86_0223C3E4 * param0) switch (v0) { case 0: case 1: - sub_0200B8C8(param0->unk_14, 0, GetMonData(param0->unk_24, MON_DATA_153, NULL)); + sub_0200B8C8(param0->unk_14, 0, Pokemon_GetValue(param0->unk_24, MON_DATA_153, NULL)); break; } @@ -1355,7 +1355,7 @@ static void ov86_0223C58C (UnkStruct_0201CD38 * param0, void * param1) v0->unk_34++; break; case 1: - GetMonData(v0->unk_24, MON_DATA_119, v0->unk_1C); + Pokemon_GetValue(v0->unk_24, MON_DATA_119, v0->unk_1C); ov86_0223C47C(v0, 48); ov86_0223C4DC(v0); ov86_0223C47C(v0, 64); @@ -1364,7 +1364,7 @@ static void ov86_0223C58C (UnkStruct_0201CD38 * param0, void * param1) v0->unk_34++; break; case 2: - sub_0200B5EC(v0->unk_14, 0, sub_02076B10(v0->unk_24)); + sub_0200B5EC(v0->unk_14, 0, Pokemon_GetBoxPokemon(v0->unk_24)); MessageLoader_GetStrbuf(v0->unk_20, 4, v0->unk_18); sub_0200C388(v0->unk_14, v0->unk_1C, v0->unk_18); ov86_0223C47C(v0, 96); @@ -1729,9 +1729,9 @@ static UnkStruct_0201CD38 * ov86_0223CD94 (UnkStruct_ov86_0223B3C8 * param0) s16 v7, v8, v9; v2 = Heap_AllocFromHeap(63, sizeof(UnkStruct_ov86_0223CD94)); - v5 = sub_0201D2E8(); + v5 = LCRNG_Next(); - sub_0201D2DC(13716); + LCRNG_SetSeed(13716); for (v3 = 0, v6 = 0; v3 < 48; v3++) { v2->unk_08[v3].unk_00 = v0[v6]; @@ -1740,9 +1740,9 @@ static UnkStruct_0201CD38 * ov86_0223CD94 (UnkStruct_ov86_0223B3C8 * param0) v6 = 0; } - v7 = -4096 + (sub_0201D2E8() % 8192); - v8 = 4096 + (sub_0201D2E8() % 8192); - v9 = -328 + (sub_0201D2E8() % 656); + v7 = -4096 + (LCRNG_Next() % 8192); + v8 = 4096 + (LCRNG_Next() % 8192); + v9 = -328 + (LCRNG_Next() % 656); for (v4 = 0; v4 < 4; v4++) { v2->unk_08[v3].unk_08[v4].x = v7 + v1[v4].x; @@ -1751,21 +1751,21 @@ static UnkStruct_0201CD38 * ov86_0223CD94 (UnkStruct_ov86_0223B3C8 * param0) v2->unk_08[v3].unk_20.x = 0; v2->unk_08[v3].unk_20.y = 0; v2->unk_08[v3].unk_20.z = 0; - v2->unk_08[v3].unk_26.x = 512 + sub_0201D2E8() % 512; - v2->unk_08[v3].unk_26.y = 512 + sub_0201D2E8() % 512; - v2->unk_08[v3].unk_26.z = 512 + sub_0201D2E8() % 512; + v2->unk_08[v3].unk_26.x = 512 + LCRNG_Next() % 512; + v2->unk_08[v3].unk_26.y = 512 + LCRNG_Next() % 512; + v2->unk_08[v3].unk_26.z = 512 + LCRNG_Next() % 512; MTX_Identity44(&v2->unk_08[v3].unk_2C); } - v4 = sub_0201D2E8() & 7; + v4 = LCRNG_Next() & 7; while (v4--) { VEC_Fx16Add(&v2->unk_08[v3].unk_20, &v2->unk_08[v3].unk_26, &v2->unk_08[v3].unk_20); } } - sub_0201D2DC(v5); + LCRNG_SetSeed(v5); v2->unk_00 = 0; v2->unk_04 = 0; @@ -1921,11 +1921,11 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co BOOL v0; int v1 = 6; - v0 = sub_02073C88(param1); + v0 = Pokemon_EnterDecryptionContext(param1); do { { - int v2 = GetMonData(param1, MON_DATA_MET_GAME, NULL); + int v2 = Pokemon_GetValue(param1, MON_DATA_MET_GAME, NULL); if ((v2 == 1) || (v2 == 2) || (v2 == 3)) { v1 = 4; @@ -1943,7 +1943,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } } - if (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL)) { + if (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL)) { v1 = 6; break; } @@ -1952,7 +1952,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co u32 v3, v4; v3 = sub_02025F20(param2); - v4 = GetMonData(param1, MON_DATA_OT_ID, NULL); + v4 = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); if (v3 != v4) { v1 = 2; @@ -1960,7 +1960,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } sub_02025EF4(param2, param0->unk_1C48); - GetMonData(param1, MON_DATA_145, param0->unk_1C4C); + Pokemon_GetValue(param1, MON_DATA_145, param0->unk_1C4C); if (Strbuf_Compare(param0->unk_1C48, param0->unk_1C4C)) { v1 = 2; @@ -1968,10 +1968,10 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } } - if (GetMonData(param1, MON_DATA_153, NULL) >= 2000) { + if (Pokemon_GetValue(param1, MON_DATA_153, NULL) >= 2000) { v1 = 6; } else { - if (GetMonData(param1, MON_DATA_147, NULL) == 0) { + if (Pokemon_GetValue(param1, MON_DATA_147, NULL) == 0) { v1 = 0; } else { v1 = 1; @@ -1979,7 +1979,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } } while (0); - sub_02073CD4(param1, v0); + Pokemon_ExitDecryptionContext(param1, v0); return v1; } diff --git a/src/overlay087/ov87_021D106C.c b/src/overlay087/ov87_021D106C.c index 40bd2c0f5a..2606da42c4 100644 --- a/src/overlay087/ov87_021D106C.c +++ b/src/overlay087/ov87_021D106C.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay087/struct_ov87_021D0D80_decl.h" #include "struct_defs/struct_02008A90.h" @@ -42,7 +42,7 @@ #include "gx_layers.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay087/ov87_021D106C.h" typedef struct UnkStruct_ov87_021D106C_t { @@ -114,7 +114,7 @@ UnkStruct_ov87_021D106C * ov87_021D106C (UnkStruct_ov87_021D0D80 * param0, const v0->unk_1F0 = sub_0200B358(61); v0->unk_1F4 = Strbuf_Init(256, 61); v0->unk_1F8 = Strbuf_Init(256, 61); - v0->unk_1FC = AllocMonZeroed(61); + v0->unk_1FC = Pokemon_New(61); sub_02017798(ov87_021D11AC, v0); } @@ -411,7 +411,7 @@ static void ov87_021D1640 (UnkStruct_ov87_021D106C * param0) MessageLoader_GetStrbuf(param0->unk_1E8, v1->unk_10, param0->unk_1F4); sub_0201D738(v2, 0, param0->unk_1F4, 94, 0, 0xff, NULL); - switch (sub_02075DAC(v1->unk_10, v1->unk_08)) { + switch (Pokemon_GetGenderOf(v1->unk_10, v1->unk_08)) { case 0: MessageLoader_GetStrbuf(param0->unk_1E4, 3, param0->unk_1F4); break; @@ -552,7 +552,7 @@ static void ov87_021D1970 (UnkStruct_ov87_021D106C * param0) for (v3 = 0; v3 < v2->unk_14; v3++) { sub_02073D80(param0->unk_1FC, v2->unk_20[v3].unk_10, v2->unk_20[v3].unk_12, 32, 1, v2->unk_20[v3].unk_08, 1, v2->unk_20[v3].unk_0C); - sub_02074B30(param0->unk_1FC, 112, (void *)(&(v2->unk_20[v3].unk_13))); + Pokemon_SetValue(param0->unk_1FC, 112, (void *)(&(v2->unk_20[v3].unk_13))); sub_02075EF4(&v1, param0->unk_1FC, 2); sub_02013720(v1.unk_00, v1.unk_02, 61, &v0, param0->unk_200, v2->unk_20[v3].unk_08, 0, 2, v2->unk_20[v3].unk_10); diff --git a/src/overlay088/ov88_0223B140.c b/src/overlay088/ov88_0223B140.c index de5e74c46f..e776b6f9d1 100644 --- a/src/overlay088/ov88_0223B140.c +++ b/src/overlay088/ov88_0223B140.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_0202B628_decl.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_02095E80_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -91,7 +91,7 @@ #include "unk_020393C8.h" #include "unk_020507CC.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "item.h" @@ -516,7 +516,7 @@ static void ov88_0223B710 (UnkStruct_0200B358 * param0, Party * param1, int para int v0; for (v0 = 0; v0 < Party_GetCurrentCount(param1); v0++) { - sub_0200B5CC(param0, v0 + param2, sub_02076B10(Party_GetPokemonBySlotIndex(param1, v0))); + sub_0200B5CC(param0, v0 + param2, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param1, v0))); } } @@ -586,13 +586,13 @@ static int ov88_0223B914 (UnkStruct_02095E80 * param0) for (v0 = 0; v0 < Party_GetCurrentCount(param0->unk_08->unk_08); v0++) { Pokemon * v4 = Party_GetPokemonBySlotIndex(param0->unk_08->unk_08, v0); - v2 = GetMonData(v4, MON_DATA_SPECIES_EGG, NULL); + v2 = Pokemon_GetValue(v4, MON_DATA_SPECIES_EGG, NULL); if (v2 == 492) { - v1 = GetMonData(v4, MON_DATA_FORM, NULL); + v1 = Pokemon_GetValue(v4, MON_DATA_FORM, NULL); if (v1 != 0) { - SetShayminForm(v4, 0); + Pokemon_SetShayminForm(v4, 0); } } } @@ -768,21 +768,21 @@ static void ov88_0223BD18 (Pokemon * param0, UnkStruct_ov88_0223C8AC * param1) { int v0, v1; - v0 = sub_02073C88(param0); + v0 = Pokemon_EnterDecryptionContext(param0); - param1->unk_04 = GetMonData(param0, MON_DATA_POKEBALL, NULL); - param1->unk_00 = GetMonData(param0, MON_DATA_SPECIES, NULL); - param1->unk_06 = GetMonData(param0, MON_DATA_FORM, NULL); - param1->unk_05 = GetMonData(param0, MON_DATA_IS_EGG, NULL); - param1->unk_08 = GetMonData(param0, MON_DATA_111, NULL); - param1->unk_0C = GetMonData(param0, MON_DATA_162, NULL); + param1->unk_04 = Pokemon_GetValue(param0, MON_DATA_POKEBALL, NULL); + param1->unk_00 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + param1->unk_06 = Pokemon_GetValue(param0, MON_DATA_FORM, NULL); + param1->unk_05 = Pokemon_GetValue(param0, MON_DATA_IS_EGG, NULL); + param1->unk_08 = Pokemon_GetValue(param0, MON_DATA_GENDER, NULL); + param1->unk_0C = Pokemon_GetValue(param0, MON_DATA_162, NULL); - v1 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); + v1 = Pokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); - sub_02073CD4(param0, v0); + Pokemon_ExitDecryptionContext(param0, v0); if (param1->unk_00 != 0) { - param1->unk_0A = sub_020759CC(param1->unk_00, param1->unk_06, 28); + param1->unk_0A = PokemonPersonalData_GetFormValue(param1->unk_00, param1->unk_06, 28); } if (v1 != 0) { @@ -1285,8 +1285,8 @@ static int ov88_0223C800 (int param0, Pokemon * param1, u8 * param2, UnkStruct_0 sub_02075EF4(param3, param1, 2); { - int v0 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - int v1 = GetMonData(param1, MON_DATA_SPECIES, NULL); + int v0 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + int v1 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); sub_020136A4(param3->unk_00, param3->unk_02, 26, 0, 0, 10, 10, param2, v0, 0, 2, v1); } @@ -1302,7 +1302,7 @@ static void ov88_0223C860 (UnkStruct_0205AA50 * param0, Party * param1, int para v0 = Strbuf_Init(20, 26); - GetMonData(Party_GetPokemonBySlotIndex(param1, param2), MON_DATA_119, v0); + Pokemon_GetValue(Party_GetPokemonBySlotIndex(param1, param2), MON_DATA_119, v0); sub_0201ADA4(param0, 0); ov88_0223EC78(param0, v0, param3, 0, param4, 1); Strbuf_Free(v0); @@ -1312,7 +1312,7 @@ static int ov88_0223C8AC (UnkStruct_ov88_0223C8AC * param0, Party * param1, int { if ((param0->unk_00 == 29) || (param0->unk_00 == 32)) { Pokemon * v0 = Party_GetPokemonBySlotIndex(param1, param2); - int v1 = GetMonData(v0, MON_DATA_77, NULL); + int v1 = Pokemon_GetValue(v0, MON_DATA_77, NULL); if (v1 == 0) { return 2; @@ -1373,7 +1373,7 @@ static void ov88_0223C8D8 (UnkStruct_0205AA50 * param0, int param1, Party * para MessageLoader_GetStrbuf(param4->unk_184, 41, v0); ov88_0223EC78(¶m0[28 + param1], v0, 9, 0xff, 6, 0); - v3 = GetMonData(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_161, NULL); + v3 = Pokemon_GetValue(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_LEVEL, NULL); Strbuf_FormatInt(v0, v3, 3, 0, 1); ov88_0223EC78(¶m0[28 + param1], v0, 9, 0, 24 + 6, 0); Strbuf_Free(v0); @@ -1383,7 +1383,7 @@ static void ov88_0223C8D8 (UnkStruct_0205AA50 * param0, int param1, Party * para ov88_0223EC78(¶m0[30 + param1], param4->unk_190, 7, 0, 3, 0); - v2 = GetMonData(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_HELD_ITEM, NULL); + v2 = Pokemon_GetValue(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_HELD_ITEM, NULL); sub_0201ADA4(¶m0[32 + param1], 0); v1 = Strbuf_Init(20, 26); @@ -2099,7 +2099,7 @@ static int ov88_0223DA3C (UnkStruct_02095E80 * param0) v0.unk_0B_4 = 0; v0.unk_0B_6 = 0; - sub_0200B5CC(param0->unk_17C, 0, sub_02076B10(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); + sub_0200B5CC(param0->unk_17C, 0, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[22], 16, 1, param0->unk_184, param0->unk_17C); @@ -2309,8 +2309,8 @@ static void ov88_0223DFF4 (UnkStruct_02095E80 * param0) static int ov88_0223E110 (UnkStruct_02095E80 * param0) { sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); - sub_0200B5CC(param0->unk_17C, 0, sub_02076B10(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); - sub_0200B5CC(param0->unk_17C, 1, sub_02076B10(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[1] - 6))); + sub_0200B5CC(param0->unk_17C, 0, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); + sub_0200B5CC(param0->unk_17C, 1, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[1] - 6))); ov88_0223ECBC(¶m0->unk_49C[23], 21, 1, param0->unk_184, param0->unk_17C); param0->unk_226C = ov88_0223E20C; @@ -2447,7 +2447,7 @@ static int ov88_0223E4BC (UnkStruct_02095E80 * param0) v0.unk_0B_4 = 0; v0.unk_0B_6 = 0; - sub_0200B5CC(param0->unk_17C, 0, sub_02076B10(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[0] - 6))); + sub_0200B5CC(param0->unk_17C, 0, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[0] - 6))); sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[22], 16, 1, param0->unk_184, param0->unk_17C); @@ -2496,14 +2496,14 @@ static void ov88_0223E694 (Party * param0, Party * param1, int param2, int param { Pokemon * v0, * v1; - v0 = AllocMonZeroed(26); - v1 = AllocMonZeroed(26); + v0 = Pokemon_New(26); + v1 = Pokemon_New(26); - sub_020775EC(Party_GetPokemonBySlotIndex(param0, param2), v0); - sub_020775EC(Party_GetPokemonBySlotIndex(param1, param3), v1); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0, param2), v0); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param1, param3), v1); - if (GetMonData(v1, MON_DATA_SPECIES, NULL) == 493) { - if (GetMonData(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((GetMonData(v1, MON_DATA_153, NULL) == 86) && (GetMonData(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { + if (Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL) == 493) { + if (Pokemon_GetValue(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(v1, MON_DATA_153, NULL) == 86) && (Pokemon_GetValue(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { UnkStruct_020507E4 * v2 = sub_020507E4(param4->unk_10); if (sub_0206B5F8(v2) == 0) { @@ -2512,17 +2512,17 @@ static void ov88_0223E694 (Party * param0, Party * param1, int param2, int param } } - sub_02074B30(v1, 111, NULL); + Pokemon_SetValue(v1, 111, NULL); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { u8 v3 = 70; - sub_02074B30(v1, 9, &v3); + Pokemon_SetValue(v1, 9, &v3); } sub_0209304C(v1, sub_02032EE8(sub_0203608C()), 5, 0, 11); sub_0207893C(v1); - sub_020775EC(v0, param4->unk_3C); - sub_020775EC(v1, param4->unk_40); + Pokemon_Copy(v0, param4->unk_3C); + Pokemon_Copy(v1, param4->unk_40); sub_02025E80(sub_02032EE8(sub_0203608C() ^ 1), param4->unk_38); param4->unk_2C = param2; @@ -2533,8 +2533,8 @@ static void ov88_0223E694 (Party * param0, Party * param1, int param2, int param } sub_0202F180(param4->unk_10, v1); - sub_020775EC(v1, Party_GetPokemonBySlotIndex(param0, param2)); - sub_020775EC(v0, Party_GetPokemonBySlotIndex(param1, param3)); + Pokemon_Copy(v1, Party_GetPokemonBySlotIndex(param0, param2)); + Pokemon_Copy(v0, Party_GetPokemonBySlotIndex(param1, param3)); ov88_0223E7F0(param4->unk_1C, v1); sub_0202CF28(param4->unk_20, (1 + 18)); Heap_FreeToHeap(v0); @@ -2547,8 +2547,8 @@ static void ov88_0223E7F0 (UnkStruct_0202B628 * param0, Pokemon * param1) UnkStruct_02025E6C * v1 = sub_02032EE8(sub_0203608C() ^ 1); u16 v2[10 + 1]; - GetMonData(param1, MON_DATA_117, v2); - v0 = sub_0202C11C((u16 *)sub_02025EF0(v1), sub_02025F30(v1), v2, sub_02075D6C(param1), 26); + Pokemon_GetValue(param1, MON_DATA_117, v2); + v0 = sub_0202C11C((u16 *)sub_02025EF0(v1), sub_02025F30(v1), v2, Pokemon_GetGender(param1), 26); sub_0202B758(param0, v0, 4); } @@ -2611,7 +2611,7 @@ static int ov88_0223E914 (UnkStruct_02095E80 * param0) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_2270, v0); - if (GetMonData(v2, MON_DATA_3, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_3, NULL)) { return 1; } } @@ -2621,7 +2621,7 @@ static int ov88_0223E914 (UnkStruct_02095E80 * param0) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_2274, v0); - if (GetMonData(v2, MON_DATA_3, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_3, NULL)) { return 2; } } diff --git a/src/overlay091/ov91_021D0D80.c b/src/overlay091/ov91_021D0D80.c index c1e0955656..f55932700d 100644 --- a/src/overlay091/ov91_021D0D80.c +++ b/src/overlay091/ov91_021D0D80.c @@ -56,7 +56,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_0207C908.h" #include "unk_0208C098.h" @@ -756,13 +756,13 @@ static int ov91_021D13E4 (UnkStruct_ov91_021D0ED8 * param0) u32 v0; v0 = ov91_021D1DD0(param0); - sub_02074B30(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, &v0); + Pokemon_SetValue(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, &v0); v0 = 0; - sub_02074B30(param0->unk_00->unk_00, 62 + param0->unk_00->unk_17, &v0); + Pokemon_SetValue(param0->unk_00->unk_00, 62 + param0->unk_00->unk_17, &v0); v0 = MoveTable_CalcMaxPP(ov91_021D1DD0(param0), 0); - sub_02074B30(param0->unk_00->unk_00, 58 + param0->unk_00->unk_17, &v0); + Pokemon_SetValue(param0->unk_00->unk_00, 58 + param0->unk_00->unk_17, &v0); param0->unk_00->unk_16 = 0; @@ -1107,35 +1107,35 @@ static void ov91_021D1C10 (UnkStruct_ov91_021D0ED8 * param0, u32 param1) switch (param1) { case 0: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); break; case 1: sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 2: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); break; case 3: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 4: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 5: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DE0(param0)); break; case 6: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 7: sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 8: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 9: @@ -1158,7 +1158,7 @@ static u16 ov91_021D1DD0 (UnkStruct_ov91_021D0ED8 * param0) static u16 ov91_021D1DE0 (UnkStruct_ov91_021D0ED8 * param0) { - return (u16)GetMonData(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, NULL); + return (u16)Pokemon_GetValue(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, NULL); } static void ov91_021D1DF8 (UnkStruct_ov91_021D0ED8 * param0, u32 param1) @@ -1196,7 +1196,7 @@ static u8 ov91_021D1EA0 (UnkStruct_ov91_021D0ED8 * param0) u8 v0; for (v0 = 0; v0 < 4; v0++) { - if (GetMonData(param0->unk_00->unk_00, MON_DATA_MOVE1 + v0, NULL) == 0) { + if (Pokemon_GetValue(param0->unk_00->unk_00, MON_DATA_MOVE1 + v0, NULL) == 0) { break; } } diff --git a/src/overlay094/ov94_0223D0C4.c b/src/overlay094/ov94_0223D0C4.c index 6d1f3710e0..732dacaf04 100644 --- a/src/overlay094/ov94_0223D0C4.c +++ b/src/overlay094/ov94_0223D0C4.c @@ -9,8 +9,7 @@ #include "struct_decls/struct_0200B358_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay094/const_ov94_02245FD8.h" @@ -41,7 +40,7 @@ #include "strbuf.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "item.h" #include "overlay094/ov94_0223BCB0.h" @@ -92,7 +91,7 @@ int ov94_0223D0C4 (UnkStruct_ov94_0223FD4C * param0, int param1) ov94_0223D2E8(param0); ov94_0223D438(param0); ov94_0223D3DC(param0); - ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], sub_02076B10((Pokemon *)param0->unk_12C.unk_00.unk_00), ¶m0->unk_12C.unk_EC); + ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], Pokemon_GetBoxPokemon((Pokemon *)param0->unk_12C.unk_00.unk_00), ¶m0->unk_12C.unk_EC); v0 = (Pokemon *)param0->unk_12C.unk_00.unk_00; @@ -506,7 +505,7 @@ static void ov94_0223D88C (UnkStruct_ov94_0223FD4C * param0, int param1, int par { Strbuf* v0; - sub_0200B538(param0->unk_B8C, 0, sub_02076B10(param5)); + sub_0200B538(param0->unk_B8C, 0, Pokemon_GetBoxPokemon(param5)); v0 = MessageLoader_GetNewStrbuf(param0->unk_B90, param1); sub_0200C388(param0->unk_B8C, param0->unk_BAC, v0); sub_0201ADA4(¶m0->unk_F5C, 0xf0f); @@ -530,12 +529,12 @@ void ov94_0223D910 (MessageLoader * param0, MessageLoader * param1, UnkStruct_02 Strbuf* v5 = Strbuf_Init((8 + 1) * 2, 62); int v6, v7, v8, v9, v10; - sub_02074570(param4, MON_DATA_119, v4); + BoxPokemon_GetValue(param4, MON_DATA_119, v4); v10 = param5->unk_00; v6 = param5->unk_02; v7 = param5->unk_03; - v8 = sub_02074570(param4, MON_DATA_HELD_ITEM, NULL); + v8 = BoxPokemon_GetValue(param4, MON_DATA_HELD_ITEM, NULL); v3 = MessageLoader_GetNewStrbuf(param0, 70); v1 = MessageLoader_GetNewStrbuf(param0, Unk_ov94_02245FD8[v6]); @@ -581,7 +580,7 @@ void ov94_0223DA78 (MessageLoader * param0, UnkStruct_0205AA50 param1[], u16 * p Strbuf_CopyChars(v0, param2); v2 = MessageLoader_GetNewStrbuf(param0, 172); - GetMonData(param3, MON_DATA_145, v3); + Pokemon_GetValue(param3, MON_DATA_145, v3); ov94_02245900(¶m1[0], v1, 0, 0, 0, (u32)(((15 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); ov94_02245900(¶m1[1], v0, 0, 0, 0, (u32)(((15 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); @@ -602,8 +601,8 @@ void ov94_0223DB2C (Pokemon * param0) sub_02075EF4(&v0, param0, 2); { - int v2 = GetMonData(param0, MON_DATA_PERSONALITY, NULL); - int v3 = GetMonData(param0, MON_DATA_SPECIES, NULL); + int v2 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL); + int v3 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); sub_020136A4(v0.unk_00, v0.unk_02, 62, 0, 0, 10, 10, v1, v2, 0, 2, v3); } diff --git a/src/overlay094/ov94_0223DC04.c b/src/overlay094/ov94_0223DC04.c index 32d615ee37..34ab1f2ba5 100644 --- a/src/overlay094/ov94_0223DC04.c +++ b/src/overlay094/ov94_0223DC04.c @@ -7,7 +7,7 @@ #include "message.h" #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0205AA50.h" #include "overlay094/struct_ov94_0223BA88.h" @@ -31,7 +31,7 @@ #include "strbuf.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay094/ov94_0223BCB0.h" #include "overlay094/ov94_0223D0C4.h" #include "overlay094/ov94_0223DC04.h" @@ -80,7 +80,7 @@ int ov94_0223DC04 (UnkStruct_ov94_0223FD4C * param0, int param1) ov94_0223DE04(param0); ov94_0223DED8(param0); ov94_0223DE7C(param0); - ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], sub_02076B10((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00), ¶m0->unk_250[param0->unk_11C].unk_EC); + ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], Pokemon_GetBoxPokemon((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00), ¶m0->unk_250[param0->unk_11C].unk_EC); v0 = (Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00; diff --git a/src/overlay094/ov94_0223E46C.c b/src/overlay094/ov94_0223E46C.c index e1c632a05f..662ef5020d 100644 --- a/src/overlay094/ov94_0223E46C.c +++ b/src/overlay094/ov94_0223E46C.c @@ -39,7 +39,7 @@ #include "unk_0202DA40.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay094/ov94_0223B140.h" #include "overlay094/ov94_0223BCB0.h" #include "overlay094/ov94_0223E46C.h" @@ -428,7 +428,7 @@ static int ov94_0223EA84 (UnkStruct_ov94_0223FD4C * param0) break; case 1: if (param0->unk_B7A.unk_00 != 0) { - param0->unk_10E4->unk_20 = sub_020759F0(param0->unk_B7A.unk_00, 18); + param0->unk_10E4->unk_20 = PokemonPersonalData_GetSpeciesValue(param0->unk_B7A.unk_00, 18); if (ov94_02241B80(¶m0->unk_B7A, param0->unk_10E4->unk_20)) { sub_02005748(1500); @@ -843,7 +843,7 @@ static int ov94_0223F2B0 (UnkStruct_ov94_0223FD4C * param0) sub_0201ADA4(¶m0->unk_FCC[1], 0x0); ov94_02242158(¶m0->unk_FCC[1], param0->unk_B94, v0, 0, 0, (u32)(((1 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); - param0->unk_10E4->unk_20 = sub_020759F0(v0, 18); + param0->unk_10E4->unk_20 = PokemonPersonalData_GetSpeciesValue(v0, 18); ov94_02242AC4(¶m0->unk_111C, param0->unk_10E4->unk_06 + param0->unk_10E4->unk_04, param0->unk_10E4->unk_0A, param0->unk_10E4->unk_08); if (ov94_02241B80(¶m0->unk_B7A, param0->unk_10E4->unk_20)) { diff --git a/src/overlay094/ov94_0223FB48.c b/src/overlay094/ov94_0223FB48.c index 5c2f197f0d..0b6680338a 100644 --- a/src/overlay094/ov94_0223FB48.c +++ b/src/overlay094/ov94_0223FB48.c @@ -8,8 +8,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" @@ -42,7 +41,7 @@ #include "strbuf.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02079D40.h" #include "party.h" @@ -749,7 +748,7 @@ static int ov94_02240688 (UnkStruct_ov94_0223FD4C * param0) v2 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, param0->unk_112); - if (GetMonData(v2, MON_DATA_162, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_162, NULL)) { v1 = 1; param0->unk_2C = 14; } @@ -841,7 +840,7 @@ static int ov94_022408E8 (UnkStruct_ov94_0223FD4C * param0) v2 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, param0->unk_112); - if (GetMonData(v2, MON_DATA_162, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_162, NULL)) { v1 = 1; param0->unk_2C = 11; } @@ -1069,7 +1068,7 @@ static void ov94_02240DF8 (int param0, int param1, int param2, int param3, UnkSt static void ov94_02240E50 (BoxPokemon * param0, UnkStruct_ov94_0223BA88_sub2 * param1) { - param1->unk_03 = sub_02075B40(param0); + param1->unk_03 = BoxPokemon_GetLevel(param0); } static void ov94_02240E5C (void * param0) @@ -1094,23 +1093,23 @@ static void ov94_02240EAC (BoxPokemon * param0, UnkStruct_02022550 * param1, Unk { int v0, v1, v2, v3; - sub_02073D20(param0); + BoxPokemon_EnterDecryptionContext(param0); - v0 = sub_02074570(param0, MON_DATA_172, NULL); - *param3 = sub_02074570(param0, MON_DATA_SPECIES, NULL); + v0 = BoxPokemon_GetValue(param0, MON_DATA_172, NULL); + *param3 = BoxPokemon_GetValue(param0, MON_DATA_SPECIES, NULL); - v3 = sub_02074570(param0, MON_DATA_FORM, NULL); - v2 = sub_02074570(param0, MON_DATA_IS_EGG, NULL); - v1 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); + v3 = BoxPokemon_GetValue(param0, MON_DATA_FORM, NULL); + v2 = BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL); + v1 = BoxPokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); param6->unk_00 = *param3; - param6->unk_02 = sub_02074570(param0, MON_DATA_111, NULL) + 1; + param6->unk_02 = BoxPokemon_GetValue(param0, MON_DATA_GENDER, NULL) + 1; if (v2) { param6->unk_03 = 0; } - sub_02073D48(param0, 1); + BoxPokemon_ExitDecryptionContext(param0, 1); if (v0) { ov94_02240DF8(*param3, v3, v2, param4, param1, param5, param7); @@ -1167,12 +1166,12 @@ static void ov94_02240FA0 (UnkStruct_ov94_0223FD4C * param0, int param1) for (v1 = 0; v1 < v8; v1++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, v1); - v4 = sub_02076B10(v3); + v4 = Pokemon_GetBoxPokemon(v3); ov94_02240E50(v4, ¶m0->unk_1108->unk_00[v1]); ov94_02240EAC(v4, param0->unk_E28[v1], param0->unk_EA0[v1], &v0[v1], v1, v6, ¶m0->unk_1108->unk_00[v1], &v7[v1]); - if (GetMonData(v3, MON_DATA_162, NULL)) { + if (Pokemon_GetValue(v3, MON_DATA_162, NULL)) { sub_02021CAC(param0->unk_F18[v1], 1); } else { sub_02021CAC(param0->unk_F18[v1], 0); @@ -1221,7 +1220,7 @@ BoxPokemon * ov94_022411DC (Party * param0, UnkStruct_020797DC * param1, int par return NULL; } - return sub_02076B10(Party_GetPokemonBySlotIndex(param0, param3)); + return Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0, param3)); } return sub_02079C9C(param1, param2, param3); @@ -1255,13 +1254,13 @@ static int ov94_0224123C (BoxPokemon * param0) { int v0, v1 = 0, v2; - v2 = sub_02073D20(param0); + v2 = BoxPokemon_EnterDecryptionContext(param0); for (v0 = 0; v0 < 10; v0++) { - v1 += sub_02074570(param0, Unk_ov94_02245E34[v0], NULL); + v1 += BoxPokemon_GetValue(param0, Unk_ov94_02245E34[v0], NULL); } - sub_02073D48(param0, v2); + BoxPokemon_ExitDecryptionContext(param0, v2); if (v1) { return 1; @@ -1275,14 +1274,14 @@ static int ov94_02241278 (BoxPokemon * param0) int v0; int v1, v2; - v0 = sub_02073D20(param0); + v0 = BoxPokemon_EnterDecryptionContext(param0); { - v1 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v2 = sub_02074570(param0, MON_DATA_FORM, NULL); + v1 = BoxPokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v2 = BoxPokemon_GetValue(param0, MON_DATA_FORM, NULL); } - sub_02073D48(param0, v0); + BoxPokemon_ExitDecryptionContext(param0, v0); if (v2 > 0) { switch (v1) { @@ -1301,13 +1300,13 @@ static int ov94_022412C8 (BoxPokemon * param0) int v0; int v1; - v0 = sub_02073D20(param0); + v0 = BoxPokemon_EnterDecryptionContext(param0); { - v1 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); + v1 = BoxPokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); } - sub_02073D48(param0, v0); + BoxPokemon_ExitDecryptionContext(param0, v0); switch (v1) { case 112: @@ -1325,11 +1324,11 @@ static int ov94_022412F4 (Party * param0, UnkStruct_020797DC * param1, int param return 0; } - if (!sub_02074570(v0, MON_DATA_172, NULL)) { + if (!BoxPokemon_GetValue(v0, MON_DATA_172, NULL)) { return 0; } - if (sub_02074570(v0, MON_DATA_173, NULL)) { + if (BoxPokemon_GetValue(v0, MON_DATA_173, NULL)) { return 2; } @@ -1371,9 +1370,9 @@ static int ov94_02241384 (BoxPokemon * param0, UnkStruct_ov94_0223BA88_sub3 * pa { UnkStruct_ov94_0223BA88_sub2 v0; - v0.unk_00 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v0.unk_02 = sub_02074570(param0, MON_DATA_111, NULL) + 1; - v0.unk_03 = sub_02075B40(param0); + v0.unk_00 = BoxPokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v0.unk_02 = BoxPokemon_GetValue(param0, MON_DATA_GENDER, NULL) + 1; + v0.unk_03 = BoxPokemon_GetLevel(param0); return ov94_02241328(&v0, param1); } @@ -1384,18 +1383,18 @@ static void ov94_022413BC (UnkStruct_ov94_0223BA88 * param0, UnkStruct_ov94_0223 UnkStruct_ov94_0223BA88_sub3 v1; BoxPokemon * v2; - v0.unk_00 = sub_02074570(param1->unk_114, MON_DATA_SPECIES, NULL); - v0.unk_02 = sub_02074570(param1->unk_114, MON_DATA_111, NULL) + 1; - v0.unk_03 = sub_02075B40(param1->unk_114); + v0.unk_00 = BoxPokemon_GetValue(param1->unk_114, MON_DATA_SPECIES, NULL); + v0.unk_02 = BoxPokemon_GetValue(param1->unk_114, MON_DATA_GENDER, NULL) + 1; + v0.unk_03 = BoxPokemon_GetLevel(param1->unk_114); param0->unk_EC = v0; ov94_022425A8(param0, param1); - v2 = sub_02076B10((Pokemon *)param1->unk_250[param1->unk_11C].unk_00.unk_00); + v2 = Pokemon_GetBoxPokemon((Pokemon *)param1->unk_250[param1->unk_11C].unk_00.unk_00); - v1.unk_00 = sub_02074570(v2, MON_DATA_SPECIES, NULL); - v1.unk_02 = sub_02074570(v2, MON_DATA_111, NULL) + 1; + v1.unk_00 = BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL); + v1.unk_02 = BoxPokemon_GetValue(v2, MON_DATA_GENDER, NULL) + 1; v1.unk_03 = 0; v1.unk_04 = 0; @@ -1417,7 +1416,7 @@ static void ov94_02241464 (UnkStruct_ov94_0223BA88_sub2 * param0, UnkStruct_0202 BOOL ov94_02241498 (Pokemon * param0) { - int v0 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); + int v0 = Pokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); if (Item_IsMail(v0)) { return 1; diff --git a/src/overlay094/ov94_022414B8.c b/src/overlay094/ov94_022414B8.c index 63f42fbf7f..a4bd3ca535 100644 --- a/src/overlay094/ov94_022414B8.c +++ b/src/overlay094/ov94_022414B8.c @@ -11,8 +11,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" #include "struct_decls/struct_02026324_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay094/const_ov94_02245FD8.h" #include "overlay094/const_ov94_02245FD4.h" @@ -49,7 +48,7 @@ #include "unk_020279FC.h" #include "unk_0202C858.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay094/ov94_0223BCB0.h" #include "overlay094/ov94_0223FB48.h" #include "overlay094/ov94_022414B8.h" @@ -650,7 +649,7 @@ static int ov94_02241BAC (UnkStruct_ov94_0223FD4C * param0) sub_0201A8FC(¶m0->unk_F9C[1]); param0->unk_B74.unk_00 = v0; sub_02005748(1500); - param0->unk_10E4->unk_20 = sub_020759F0(v0, 18); + param0->unk_10E4->unk_20 = PokemonPersonalData_GetSpeciesValue(v0, 18); if (ov94_02241B80(¶m0->unk_B74, param0->unk_10E4->unk_20)) { param0->unk_2C = 10; @@ -1013,10 +1012,10 @@ static void ov94_022423FC (MessageLoader * param0, UnkStruct_0200B358 * param1, Strbuf* v3 = Strbuf_Init(10 + 1, 62); int v4, v5, v6; - sub_02074570(param3, MON_DATA_119, v2); + BoxPokemon_GetValue(param3, MON_DATA_119, v2); - v4 = sub_02074570(param3, MON_DATA_111, NULL) + 1; - v5 = sub_02075B40(param3); + v4 = BoxPokemon_GetValue(param3, MON_DATA_GENDER, NULL) + 1; + v5 = BoxPokemon_GetLevel(param3); v0 = MessageLoader_GetNewStrbuf(param0, 100); sub_0200B60C(param1, 3, v5, 3, 0, 1); @@ -1038,7 +1037,7 @@ static void ov94_022423FC (MessageLoader * param0, UnkStruct_0200B358 * param1, ov94_02245900(¶m2[1], v3, 70, 0, 0, Unk_ov94_02246920[v4 - 1]); } - param4->unk_00 = sub_02074570(param3, MON_DATA_SPECIES, NULL); + param4->unk_00 = BoxPokemon_GetValue(param3, MON_DATA_SPECIES, NULL); param4->unk_02 = v4; param4->unk_03 = v5; @@ -1086,12 +1085,12 @@ void ov94_022425A8 (UnkStruct_ov94_0223BA88 * param0, UnkStruct_ov94_0223FD4C * u16 * v0; if (ov94_022411D0(param1->unk_110)) { - SetShayminForm((Pokemon *)(param1->unk_114), 0); + Pokemon_SetShayminForm((Pokemon *)(param1->unk_114), 0); - MI_CpuCopyFast(param1->unk_114, param0->unk_00.unk_00, PokemonStructSize()); + MI_CpuCopyFast(param1->unk_114, param0->unk_00.unk_00, Pokemon_StructSize()); } else { - SetBoxShayminForm(param1->unk_114, 0); - sub_020774C8(param1->unk_114, (Pokemon *)param0->unk_00.unk_00); + BoxPokemon_SetShayminForm(param1->unk_114, 0); + Pokemon_FromBoxPokemon(param1->unk_114, (Pokemon *)param0->unk_00.unk_00); } sub_020021D0(param0->unk_10C, sub_02025EF0(param1->unk_00->unk_1C), 8); diff --git a/src/overlay094/ov94_02242AD0.c b/src/overlay094/ov94_02242AD0.c index ab7e83705b..6f9fcc585e 100644 --- a/src/overlay094/ov94_02242AD0.c +++ b/src/overlay094/ov94_02242AD0.c @@ -11,7 +11,7 @@ #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_0202DA40_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay084/struct_ov84_0223BA5C.h" #include "overlay094/struct_ov94_0223BA88.h" @@ -43,7 +43,7 @@ #include "unk_020507CC.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "overlay094/ov94_0223B140.h" @@ -794,10 +794,10 @@ static int ov94_02243398 (UnkStruct_ov94_0223FD4C * param0) param0->unk_36 = 0; if (sub_0202DA60(param0->unk_00->unk_00)) { - Pokemon * v1 = AllocMonZeroed(62); + Pokemon * v1 = Pokemon_New(62); sub_0202DA70(param0->unk_00->unk_00, v1); - sub_0200B5CC(param0->unk_B8C, 0, sub_02076B10(v1)); + sub_0200B5CC(param0->unk_B8C, 0, Pokemon_GetBoxPokemon(v1)); param0->unk_28 = 2; param0->unk_2C = 34; @@ -814,10 +814,10 @@ static int ov94_02243398 (UnkStruct_ov94_0223FD4C * param0) param0->unk_36 = 0; if (sub_0202DA60(param0->unk_00->unk_00)) { - Pokemon * v2 = AllocMonZeroed(62); + Pokemon * v2 = Pokemon_New(62); sub_0202DA70(param0->unk_00->unk_00, v2); - sub_0200B5CC(param0->unk_B8C, 0, sub_02076B10(v2)); + sub_0200B5CC(param0->unk_B8C, 0, Pokemon_GetBoxPokemon(v2)); param0->unk_28 = 3; param0->unk_2C = 34; @@ -1250,9 +1250,9 @@ static int ov94_02243AE8 (UnkStruct_ov94_0223FD4C * param0) static void ov94_02243B08 (UnkStruct_ov94_0223FD4C * param0, int param1) { if (param0->unk_110 != 18) { - Pokemon * v0 = AllocMonZeroed(62); + Pokemon * v0 = Pokemon_New(62); - sub_020774C8(sub_02079C9C(param0->unk_00->unk_0C, param0->unk_110, param0->unk_112), v0); + Pokemon_FromBoxPokemon(sub_02079C9C(param0->unk_00->unk_0C, param0->unk_110, param0->unk_112), v0); sub_0202DA7C(param0->unk_00->unk_00, v0, param0->unk_110); sub_02079968(param0->unk_00->unk_0C, param0->unk_110, param0->unk_112); Heap_FreeToHeap(v0); @@ -1276,7 +1276,7 @@ static void ov94_02243B08 (UnkStruct_ov94_0223FD4C * param0, int param1) static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, int param2, int param3) { - int v0 = GetMonData(param1, MON_DATA_HELD_ITEM, NULL); + int v0 = Pokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); sub_0202F180(param0->unk_00->unk_20, param1); param2 = 18; @@ -1288,8 +1288,8 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i if (param3) { u8 v1 = 70; - if (GetMonData(param1, MON_DATA_SPECIES, NULL) == 493) { - if (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((GetMonData(param1, MON_DATA_153, NULL) == 86) && (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { + if (Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 493) { + if (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(param1, MON_DATA_153, NULL) == 86) && (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { UnkStruct_020507E4 * v2 = sub_020507E4(param0->unk_00->unk_20); if (sub_0206B5F8(v2) == 0) { @@ -1298,8 +1298,8 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i } } - sub_02074B30(param1, 9, &v1); - sub_02074B30(param1, 111, NULL); + Pokemon_SetValue(param1, 9, &v1); + Pokemon_SetValue(param1, 111, NULL); ov94_02243DE8(param0->unk_00->unk_00, 0); } @@ -1316,7 +1316,7 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i int v4 = 0; sub_020799F0(param0->unk_00->unk_0C, ¶m2, &v4); - sub_020798A0(param0->unk_00->unk_0C, param2, sub_02076B10(param1)); + sub_020798A0(param0->unk_00->unk_0C, param2, Pokemon_GetBoxPokemon(param1)); param0->unk_124.unk_00 = param2; param0->unk_124.unk_04 = v4; @@ -1335,8 +1335,8 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i param2 = 0; } - if (GetMonData(param1, MON_DATA_SPECIES, NULL) == 493) { - if (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((GetMonData(param1, MON_DATA_153, NULL) == 86) && (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { + if (Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 493) { + if (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(param1, MON_DATA_153, NULL) == 86) && (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { UnkStruct_020507E4 * v0 = sub_020507E4(param0->unk_00->unk_20); if (sub_0206B5F8(v0) == 0) { @@ -1347,10 +1347,10 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i { u8 v1 = 70; - sub_02074B30(param1, 9, &v1); + Pokemon_SetValue(param1, 9, &v1); } - sub_02074B30(param1, 111, NULL); + Pokemon_SetValue(param1, 111, NULL); if (param2 == 18) { int v2; @@ -1364,7 +1364,7 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i int v3 = 0; sub_020799F0(param0->unk_00->unk_0C, ¶m2, &v3); - sub_020798A0(param0->unk_00->unk_0C, param2, sub_02076B10(param1)); + sub_020798A0(param0->unk_00->unk_0C, param2, Pokemon_GetBoxPokemon(param1)); param0->unk_124.unk_00 = param2; param0->unk_124.unk_04 = v3; @@ -1401,8 +1401,8 @@ static void ov94_02243E48 (UnkStruct_0202B628 * param0, UnkStruct_ov94_0223BA88 u16 v1[10 + 1]; Pokemon * v2 = (Pokemon *)param1->unk_00.unk_00; - GetMonData(v2, MON_DATA_117, v1); - v0 = sub_0202C1EC(param1->unk_10C, param1->unk_F6, v1, sub_02075D6C(v2), 62); + Pokemon_GetValue(v2, MON_DATA_117, v1); + v0 = sub_0202C1EC(param1->unk_10C, param1->unk_F6, v1, Pokemon_GetGender(v2), 62); sub_0202B758(param0, v0, 4); } diff --git a/src/overlay094/ov94_022444C8.c b/src/overlay094/ov94_022444C8.c index 89d39ffa9c..3029fe225b 100644 --- a/src/overlay094/ov94_022444C8.c +++ b/src/overlay094/ov94_022444C8.c @@ -3,8 +3,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0208BE5C.h" #include "overlay094/struct_ov94_0223BA88.h" @@ -15,7 +14,7 @@ #include "unk_02025E68.h" #include "unk_0202DA40.h" #include "unk_02056720.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "unk_0207AE68.h" @@ -38,11 +37,11 @@ static const UnkStruct_0208BE5C Unk_ov94_0224636C = { int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) { - param0->unk_1104 = AllocMonZeroed(62); + param0->unk_1104 = Pokemon_New(62); switch (param0->unk_24) { case 7: - param0->unk_E8.unk_00 = (BoxPokemon *)sub_02076B10((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_00 = (BoxPokemon *)Pokemon_GetBoxPokemon((Pokemon *)param0->unk_12C.unk_00.unk_00); param0->unk_E8.unk_04 = param0->unk_E8.unk_00; param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; @@ -50,7 +49,7 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) param0->unk_E8.unk_10 = 2; break; case 8: - param0->unk_E8.unk_04 = (BoxPokemon *)sub_02076B10((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_04 = (BoxPokemon *)Pokemon_GetBoxPokemon((Pokemon *)param0->unk_12C.unk_00.unk_00); param0->unk_E8.unk_00 = param0->unk_E8.unk_04; param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; @@ -58,9 +57,9 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) param0->unk_E8.unk_10 = 4; break; case 10: - param0->unk_E8.unk_04 = sub_02076B10((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_04 = Pokemon_GetBoxPokemon((Pokemon *)param0->unk_12C.unk_00.unk_00); sub_0202DA70(param0->unk_00->unk_00, param0->unk_1104); - param0->unk_E8.unk_00 = sub_02076B10(param0->unk_1104); + param0->unk_E8.unk_00 = Pokemon_GetBoxPokemon(param0->unk_1104); param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; param0->unk_E8.unk_0C = 3; @@ -68,8 +67,8 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) break; case 9: sub_0202DA70(param0->unk_00->unk_00, param0->unk_1104); - param0->unk_E8.unk_00 = sub_02076B10(param0->unk_1104); - param0->unk_E8.unk_04 = (BoxPokemon *)sub_02076B10((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00); + param0->unk_E8.unk_00 = Pokemon_GetBoxPokemon(param0->unk_1104); + param0->unk_E8.unk_04 = (BoxPokemon *)Pokemon_GetBoxPokemon((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00); param0->unk_120 = ov94_02244870(¶m0->unk_250[param0->unk_11C]); param0->unk_E8.unk_08 = param0->unk_120; param0->unk_E8.unk_0C = 3; @@ -95,7 +94,7 @@ int ov94_02244678 (UnkStruct_ov94_0223FD4C * param0, int param1) if (param0->unk_24 == 9) { Pokemon * v1 = ov94_022448AC(param0, param0->unk_24); - int v2 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + int v2 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); int v3; int v4; @@ -110,12 +109,12 @@ int ov94_02244678 (UnkStruct_ov94_0223FD4C * param0, int param1) } } else if ((param0->unk_24 == 8) || (param0->unk_24 == 10)) { Pokemon * v1 = ov94_022448AC(param0, param0->unk_24); - Pokemon * v5 = AllocMonZeroed(62); + Pokemon * v5 = Pokemon_New(62); sub_0202DA70(param0->unk_00->unk_00, v5); - if ((GetMonData(v1, MON_DATA_SPECIES, NULL) != GetMonData(v5, MON_DATA_SPECIES, NULL)) || (GetMonData(v1, MON_DATA_PERSONALITY, NULL) != GetMonData(v5, MON_DATA_PERSONALITY, NULL))) { - int v6 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + if ((Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL) != Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL)) || (Pokemon_GetValue(v1, MON_DATA_PERSONALITY, NULL) != Pokemon_GetValue(v5, MON_DATA_PERSONALITY, NULL))) { + int v6 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); int v7; int v8; @@ -194,12 +193,12 @@ static void ov94_022448E8 (UnkStruct_ov94_0223FD4C * param0) Pokemon * v0 = ov94_022448AC(param0, param0->unk_24); if (param0->unk_124.unk_00 == 18) { - sub_020775EC(v0, Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, param0->unk_124.unk_04)); + Pokemon_Copy(v0, Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, param0->unk_124.unk_04)); } else { int v1 = 0, v2 = 0; sub_02079968(param0->unk_00->unk_0C, param0->unk_124.unk_00, param0->unk_124.unk_04); sub_020799F0(param0->unk_00->unk_0C, &v1, &v2); - sub_020798A0(param0->unk_00->unk_0C, v1, sub_02076B10(v0)); + sub_020798A0(param0->unk_00->unk_0C, v1, Pokemon_GetBoxPokemon(v0)); } } diff --git a/src/overlay095/ov95_02246C20.c b/src/overlay095/ov95_02246C20.c index c8dbeb6d86..0701e0986b 100644 --- a/src/overlay095/ov95_02246C20.c +++ b/src/overlay095/ov95_02246C20.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay095/struct_ov95_02247004_decl.h" #include "overlay095/struct_ov95_022472C4_decl.h" #include "overlay095/struct_ov95_02247628_decl.h" @@ -42,7 +42,7 @@ #include "strbuf.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay095/ov95_02246C20.h" #include "overlay095/ov95_02247B6C.h" #include "overlay095/ov95_02248590.h" @@ -177,10 +177,10 @@ int ov95_02246C20 (UnkStruct_020067E8 * param0, int * param1) v0->unk_18 = sub_020095C4(64, &v0->unk_1C, 57); sub_0200964C(&(v0->unk_1C), 0, (192 + 40 << FX32_SHIFT)); - v0->unk_1B0 = sub_02074570((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_SPECIES, NULL); - v0->unk_1B2 = sub_02074570((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_FORM, NULL); - v0->unk_1B4 = sub_02074570((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_SPECIES, NULL); - v0->unk_1B6 = sub_02074570((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_FORM, NULL); + v0->unk_1B0 = BoxPokemon_GetValue((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_SPECIES, NULL); + v0->unk_1B2 = BoxPokemon_GetValue((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_FORM, NULL); + v0->unk_1B4 = BoxPokemon_GetValue((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_SPECIES, NULL); + v0->unk_1B6 = BoxPokemon_GetValue((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_FORM, NULL); v0->unk_1B8 = NULL; sub_02017798(NULL, NULL); @@ -203,10 +203,10 @@ int ov95_02246C20 (UnkStruct_020067E8 * param0, int * param1) static BOOL ov95_02246DEC (BoxPokemon * param0) { - int v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - int v1 = sub_02074570(param0, MON_DATA_FORM, NULL); + int v0 = BoxPokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + int v1 = BoxPokemon_GetValue(param0, MON_DATA_FORM, NULL); - return sub_020759CC(v0, v1, 28) == 0; + return PokemonPersonalData_GetFormValue(v0, v1, 28) == 0; } int ov95_02246E1C (UnkStruct_020067E8 * param0, int * param1) @@ -574,12 +574,12 @@ void ov95_022473E8 (UnkStruct_ov95_02247628 * param0, int param1, u32 param2, u3 u16 v8; v5 = (BoxPokemon *)((param1 == 0) ? param0->unk_00->unk_00 : param0->unk_00->unk_04); - v6 = sub_02073D20(v5); + v6 = BoxPokemon_EnterDecryptionContext(v5); sub_02075F0C(&v0, v5, 2, 0); - v7 = sub_02074570(v5, MON_DATA_PERSONALITY, NULL); - v8 = sub_02074570(v5, MON_DATA_SPECIES, NULL); + v7 = BoxPokemon_GetValue(v5, MON_DATA_PERSONALITY, NULL); + v8 = BoxPokemon_GetValue(v5, MON_DATA_SPECIES, NULL); if (param4) { v4.unk_08 *= 2; @@ -589,7 +589,7 @@ void ov95_022473E8 (UnkStruct_ov95_02247628 * param0, int param1, u32 param2, u3 DC_FlushRange(v3, v2); sub_0201958C(param0->unk_08, param2, v3, v2, 0); - sub_02073D48(v5, v6); + BoxPokemon_ExitDecryptionContext(v5, v6); Heap_FreeToHeap(v3); } diff --git a/src/overlay095/ov95_02247B6C.c b/src/overlay095/ov95_02247B6C.c index 17f8332de4..630e918386 100644 --- a/src/overlay095/ov95_02247B6C.c +++ b/src/overlay095/ov95_02247B6C.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay095/struct_ov95_02247628_decl.h" #include "overlay095/struct_ov95_0224773C_decl.h" #include "overlay095/struct_ov95_02247958_decl.h" @@ -42,7 +42,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay095/ov95_02246C20.h" #include "overlay095/ov95_022476F0.h" #include "overlay095/ov95_02247B6C.h" @@ -360,7 +360,7 @@ static int ov95_02247F04 (UnkStruct_ov95_02247C6C * param0, int * param1) { const BoxPokemon * v6 = ov95_02247634(param0->unk_00); - if (sub_02074570((BoxPokemon *)v6, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)v6, MON_DATA_IS_EGG, NULL) == 0) { u8 v7; sub_02007B98(param0->unk_10, 1); diff --git a/src/overlay095/ov95_02248590.c b/src/overlay095/ov95_02248590.c index a2bce723cd..442aa96eb3 100644 --- a/src/overlay095/ov95_02248590.c +++ b/src/overlay095/ov95_02248590.c @@ -226,7 +226,7 @@ void * ov95_02248590 (UnkStruct_ov95_02247628 * param0) v0->unk_CC = NULL; v0->unk_160 = NULL; v0->unk_164 = NULL; - v0->unk_BC = sub_0201D35C(); + v0->unk_BC = MTRNG_Next(); v0->unk_D0 = 0; v0->unk_168 = 0; @@ -259,7 +259,7 @@ void ov95_022485FC (void * param0) ov95_022490A4(v1->unk_164); } - sub_0201D318(v1->unk_BC); + MTRNG_SetSeed(v1->unk_BC); Heap_FreeToHeap(v1); } @@ -618,11 +618,11 @@ static void ov95_02248CA8 (UnkStruct_ov95_02248688 * param0) sub_02006EE0(93, 14, NNS_G2D_VRAM_TYPE_2DMAIN, 0, 58, &v0); sub_02006EE0(93, 14, NNS_G2D_VRAM_TYPE_2DSUB, 0, 58, &v0); ov95_022475C4(&v2, ¶m0->unk_0C, &v1, &v0, 1); - sub_0201D318(UnkEnum_ov95_02248CA8_00); + MTRNG_SetSeed(UnkEnum_ov95_02248CA8_00); for (v3 = 0; v3 < 20; v3++) { - v4 = 12 + (sub_0201D35C() % 232); - v5 = -28 + (sub_0201D35C() % 452); + v4 = 12 + (MTRNG_Next() % 232); + v5 = -28 + (MTRNG_Next() % 452); param0->unk_1C[v3][0] = ov95_022475E4(param0->unk_00, &v2, v4, v5, 0, NNS_G2D_VRAM_TYPE_2DMAIN); param0->unk_1C[v3][1] = ov95_022475E4(param0->unk_00, &v2, v4, v5 + 56, 0, NNS_G2D_VRAM_TYPE_2DMAIN); diff --git a/src/overlay095/ov95_0224B3D8.c b/src/overlay095/ov95_0224B3D8.c index dd0e12ba9d..b406ab3a38 100644 --- a/src/overlay095/ov95_0224B3D8.c +++ b/src/overlay095/ov95_0224B3D8.c @@ -12,7 +12,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay095/struct_ov95_02247628_decl.h" #include "overlay095/struct_ov95_0224773C_decl.h" #include "overlay095/struct_ov95_02247958_decl.h" @@ -43,7 +43,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay095/ov95_02246C20.h" #include "overlay095/ov95_022476F0.h" #include "overlay095/ov95_0224B3D8.h" @@ -373,7 +373,7 @@ static int ov95_0224B71C (UnkStruct_ov95_0224B4D4 * param0, int * param1) if (ov95_0224BC00(param0)) { const BoxPokemon * v0 = ov95_0224763C(param0->unk_00); - if (sub_02074570((BoxPokemon *)v0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)v0, MON_DATA_IS_EGG, NULL) == 0) { u8 v1; sub_02078A4C(param0->unk_84, &v1, ov95_02247660(param0->unk_00), 1); diff --git a/src/overlay097/ov97_0222D30C.c b/src/overlay097/ov97_0222D30C.c index 7ac71c71a5..d236ee71d8 100644 --- a/src/overlay097/ov97_0222D30C.c +++ b/src/overlay097/ov97_0222D30C.c @@ -13,7 +13,7 @@ #include "strbuf.h" #include "struct_decls/struct_0202442C_decl.h" #include "struct_decls/struct_02025CCC_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay077/const_ov77_021D742C.h" @@ -69,7 +69,7 @@ #include "unk_020363E8.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay097/ov97_0222D04C.h" #include "overlay097/ov97_0222D30C.h" #include "overlay097/ov97_02232054.h" @@ -405,7 +405,7 @@ static BOOL ov97_0222D5C8 (UnkStruct_0202DF40 * param0) int v1; v0 = (Pokemon *)¶m0->unk_04.val1.unk_04; - v1 = GetMonData(v0, MON_DATA_152, NULL); + v1 = Pokemon_GetValue(v0, MON_DATA_152, NULL); if (((v1 >= 3) && (v1 <= 14)) || ((v1 >= 64) && (v1 <= 71))) { return 1; @@ -1370,15 +1370,15 @@ static void ov97_0222E814 (UnkStruct_ov97_0222E398 * param0) } { if (v0 > 50) { - param0->unk_88[v0].unk_30 = 210 + 50 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 50 + v0 + LCRNG_Next() % 5; } else if (v0 > 40) { - param0->unk_88[v0].unk_30 = 210 + 40 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 40 + v0 + LCRNG_Next() % 5; } else if (v0 > 30) { - param0->unk_88[v0].unk_30 = 210 + 30 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 30 + v0 + LCRNG_Next() % 5; } else if (v0 > 25) { - param0->unk_88[v0].unk_30 = 210 + 20 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 20 + v0 + LCRNG_Next() % 5; } else if (v0 > 20) { - param0->unk_88[v0].unk_30 = 210 + 10 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 10 + v0 + LCRNG_Next() % 5; } else { int v2[] = { 1, @@ -1416,7 +1416,7 @@ static void ov97_0222E814 (UnkStruct_ov97_0222E398 * param0) param0->unk_88[v0].unk_44 = param0->unk_88[v0].unk_38; v1 = *( VecFx32 *)sub_02021D28(param0->unk_88[v0].unk_0C); - v1.x = FX32_CONST(16 + (sub_0201D2E8() % (256 - 32))); + v1.x = FX32_CONST(16 + (LCRNG_Next() % (256 - 32))); v1.y = FX32_CONST(0); sub_02021C50(param0->unk_88[v0].unk_0C, &v1); @@ -1447,13 +1447,13 @@ static void ov97_0222EA68 (UnkStruct_ov97_0222E398 * param0) param0->unk_88[v0].unk_08 = 0; if (v0 > 30) { - param0->unk_88[v0].unk_30 = 15 + (sub_0201D2E8() % 10); + param0->unk_88[v0].unk_30 = 15 + (LCRNG_Next() % 10); } else if (v0 > 20) { - param0->unk_88[v0].unk_30 = 10 + (sub_0201D2E8() % 10); + param0->unk_88[v0].unk_30 = 10 + (LCRNG_Next() % 10); } else if (v0 > 10) { - param0->unk_88[v0].unk_30 = 10 + (sub_0201D2E8() % 5); + param0->unk_88[v0].unk_30 = 10 + (LCRNG_Next() % 5); } else { - param0->unk_88[v0].unk_30 = 5 + (sub_0201D2E8() % 5); + param0->unk_88[v0].unk_30 = 5 + (LCRNG_Next() % 5); } param0->unk_88[v0].unk_30 = 0; @@ -1461,8 +1461,8 @@ static void ov97_0222EA68 (UnkStruct_ov97_0222E398 * param0) param0->unk_88[v0].unk_44 = param0->unk_88[v0].unk_38; { - int v2 = sub_0201D2E8() % 360; - int v3 = 64 + (sub_0201D2E8() % 32); + int v2 = LCRNG_Next() % 360; + int v3 = 64 + (LCRNG_Next() % 32); v1.x = param0->unk_88[v0].unk_10.x + (sub_0201D250(v2) * v3); v1.y = param0->unk_88[v0].unk_10.y + (sub_0201D264(v2) * v3); @@ -1490,30 +1490,30 @@ static void ov97_0222EBD0 (UnkStruct_ov97_0222E398 * param0) param0->unk_1848[v0].unk_2C = 4 + (v0 % 2); param0->unk_1848[v0].unk_34 = 0; param0->unk_1848[v0].unk_04 = 0; - param0->unk_1848[v0].unk_3C = 2 + (sub_0201D2E8() % 4); + param0->unk_1848[v0].unk_3C = 2 + (LCRNG_Next() % 4); param0->unk_1848[v0].unk_1C = FX32_CONST((v0 / 30) + 4); if (v0 > 60) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 70 + (sub_0201D2E8() % 10); + param0->unk_1848[v0].unk_30 = 70 + (LCRNG_Next() % 10); } else if (v0 > 50) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 60 + (sub_0201D2E8() % 10); + param0->unk_1848[v0].unk_30 = 60 + (LCRNG_Next() % 10); } else if (v0 > 40) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 50 + (sub_0201D2E8() % 5); + param0->unk_1848[v0].unk_30 = 50 + (LCRNG_Next() % 5); } else if (v0 > 30) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 40 + (sub_0201D2E8() % 10); + param0->unk_1848[v0].unk_30 = 40 + (LCRNG_Next() % 10); } else if (v0 > 20) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 30 + (sub_0201D2E8() % 10); + param0->unk_1848[v0].unk_30 = 30 + (LCRNG_Next() % 10); } else if (v0 > 10) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 20 + (sub_0201D2E8() % 5); + param0->unk_1848[v0].unk_30 = 20 + (LCRNG_Next() % 5); } else { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 10 + (sub_0201D2E8() % 5); + param0->unk_1848[v0].unk_30 = 10 + (LCRNG_Next() % 5); } param0->unk_1848[v0].unk_40 = param0->unk_1848[v0].unk_38; diff --git a/src/overlay097/ov97_02233B18.c b/src/overlay097/ov97_02233B18.c index 613df34bbf..5aa059f492 100644 --- a/src/overlay097/ov97_02233B18.c +++ b/src/overlay097/ov97_02233B18.c @@ -26,8 +26,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_defs/struct_0203CC84.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0208BE5C.h" #include "struct_defs/struct_02099F80.h" #include "overlay019/struct_ov19_021DA864.h" @@ -71,7 +70,7 @@ #include "unk_02025E08.h" #include "unk_020279FC.h" #include "unk_0202EEC0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "item.h" #include "unk_0209A74C.h" @@ -398,7 +397,7 @@ static void ov97_02233D10 (UnkStruct_ov97_02234A2C * param0) UnkStruct_02024440 * v7; v7 = sub_02024440(param0->unk_10); - v4 = sub_02076B10(&v6); + v4 = Pokemon_GetBoxPokemon(&v6); for (v0 = 0; v0 < 6; v0++) { v2 = param0->unk_42C[v0].unk_04; diff --git a/src/overlay097/ov97_02236380.c b/src/overlay097/ov97_02236380.c index 93c8420a95..3119d8b30b 100644 --- a/src/overlay097/ov97_02236380.c +++ b/src/overlay097/ov97_02236380.c @@ -2,11 +2,11 @@ #include #include "data_021BF67C.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay097/box_pokemon_gba.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "item.h" #include "overlay097/ov97_02236380.h" #include "overlay097/ov97_022392E4.h" @@ -1314,7 +1314,7 @@ u32 ov97_02236E00 (BoxPokemonGBA * param0) v0 = ov97_02236DD0(GetGBABoxMonData(param0, 11, 0)); v1 = GetGBABoxMonData(param0, 25, 0); - return sub_02075B78(v0, v1); + return Pokemon_GetSpeciesLevelAt(v0, v1); } static int ov97_02236E28 (BoxPokemonGBA * param0, BoxPokemon * param1) @@ -1324,23 +1324,23 @@ static int ov97_02236E28 (BoxPokemonGBA * param0, BoxPokemon * param1) u16 v2; int v3; - v2 = sub_02074570(param1, MON_DATA_SPECIES, NULL); + v2 = BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL); v3 = GetGBABoxMonData(param0, 46, NULL); - v1 = sub_020759F0(v2, 25); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 25); if (v1) { for (v0 = 0; v0 < (sizeof(Unk_ov97_0223ECA0) / 2); v0++) { if (Unk_ov97_0223ECA0[v0] == v2) { - v1 = sub_020759F0(v2, 24); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 24); break; } } if ((v0 == (sizeof(Unk_ov97_0223ECA0) / 2)) && ((v3 & 1) == 0)) { - v1 = sub_020759F0(v2, 24); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 24); } } else { - v1 = sub_020759F0(v2, 24); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 24); } return v1; @@ -1355,17 +1355,17 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) u8 v5[10 + 1]; u16 v6[12]; - ZeroBoxMonData(param1); + BoxPokemon_Init(param1); - v0 = sub_02073D20(param1); + v0 = BoxPokemon_EnterDecryptionContext(param1); v1 = GetGBABoxMonData(param0, 0, NULL); - SetBoxMonData(param1, 0, (u8 *)&v1); + BoxPokemon_SetValue(param1, 0, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 11, NULL); v1 = ov97_02236DD0(v1); - SetBoxMonData(param1, 5, (u8 *)&v1); + BoxPokemon_SetValue(param1, 5, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 12, NULL); @@ -1373,61 +1373,61 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) v1 = Item_FromGBAID(v1); } - SetBoxMonData(param1, 6, (u8 *)&v1); + BoxPokemon_SetValue(param1, 6, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 1, NULL); - SetBoxMonData(param1, 7, (u8 *)&v1); + BoxPokemon_SetValue(param1, 7, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 25, NULL); - SetBoxMonData(param1, 8, (u8 *)&v1); + BoxPokemon_SetValue(param1, 8, (u8 *)&v1); v1 = 70; - SetBoxMonData(param1, 9, (u8 *)&v1); + BoxPokemon_SetValue(param1, 9, (u8 *)&v1); v1 = ov97_02236E28(param0, param1); - SetBoxMonData(param1, 10, (u8 *)&v1); + BoxPokemon_SetValue(param1, 10, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 8, NULL); - SetBoxMonData(param1, 11, (u8 *)&v1); + BoxPokemon_SetValue(param1, 11, (u8 *)&v1); v4 = GetGBABoxMonData(param0, 3, NULL); - SetBoxMonData(param1, 12, (u8 *)&v4); + BoxPokemon_SetValue(param1, 12, (u8 *)&v4); v1 = GetGBABoxMonData(param0, 26, NULL); - SetBoxMonData(param1, 13, (u8 *)&v1); + BoxPokemon_SetValue(param1, 13, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 27, NULL); - SetBoxMonData(param1, 14, (u8 *)&v1); + BoxPokemon_SetValue(param1, 14, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 28, NULL); - SetBoxMonData(param1, 15, (u8 *)&v1); + BoxPokemon_SetValue(param1, 15, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 29, NULL); - SetBoxMonData(param1, 16, (u8 *)&v1); + BoxPokemon_SetValue(param1, 16, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 30, NULL); - SetBoxMonData(param1, 17, (u8 *)&v1); + BoxPokemon_SetValue(param1, 17, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 31, NULL); - SetBoxMonData(param1, 18, (u8 *)&v1); + BoxPokemon_SetValue(param1, 18, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 22, NULL); - SetBoxMonData(param1, 19, (u8 *)&v1); + BoxPokemon_SetValue(param1, 19, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 23, NULL); - SetBoxMonData(param1, 20, (u8 *)&v1); + BoxPokemon_SetValue(param1, 20, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 24, NULL); - SetBoxMonData(param1, 21, (u8 *)&v1); + BoxPokemon_SetValue(param1, 21, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 33, NULL); - SetBoxMonData(param1, 22, (u8 *)&v1); + BoxPokemon_SetValue(param1, 22, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 47, NULL); - SetBoxMonData(param1, 23, (u8 *)&v1); + BoxPokemon_SetValue(param1, 23, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 48, NULL); - SetBoxMonData(param1, 24, (u8 *)&v1); + BoxPokemon_SetValue(param1, 24, (u8 *)&v1); for (v2 = 0; v2 < 4; v2++) { v1 = GetGBABoxMonData(param0, 13 + v2, NULL); @@ -1436,44 +1436,44 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) (void)0; } - SetBoxMonData(param1, 54 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 54 + v2, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 21, NULL); v1 = (v1 & (0x3 << (v2 * 2))) >> (v2 * 2); - SetBoxMonData(param1, 62 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 62 + v2, (u8 *)&v1); - v1 = sub_02074570(param1, 66 + v2, NULL); - SetBoxMonData(param1, 58 + v2, (u8 *)&v1); + v1 = BoxPokemon_GetValue(param1, 66 + v2, NULL); + BoxPokemon_SetValue(param1, 58 + v2, (u8 *)&v1); } v1 = GetGBABoxMonData(param0, 39, NULL); - SetBoxMonData(param1, 70, (u8 *)&v1); + BoxPokemon_SetValue(param1, 70, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 40, NULL); - SetBoxMonData(param1, 71, (u8 *)&v1); + BoxPokemon_SetValue(param1, 71, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 41, NULL); - SetBoxMonData(param1, 72, (u8 *)&v1); + BoxPokemon_SetValue(param1, 72, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 42, NULL); - SetBoxMonData(param1, 73, (u8 *)&v1); + BoxPokemon_SetValue(param1, 73, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 43, NULL); - SetBoxMonData(param1, 74, (u8 *)&v1); + BoxPokemon_SetValue(param1, 74, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 44, NULL); - SetBoxMonData(param1, 75, (u8 *)&v1); + BoxPokemon_SetValue(param1, 75, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 45, NULL); - SetBoxMonData(param1, 76, (u8 *)&v1); + BoxPokemon_SetValue(param1, 76, (u8 *)&v1); v3 = GetGBABoxMonData(param0, 50, NULL); if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 78 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 78 + v2, (u8 *)&v1); } } @@ -1482,7 +1482,7 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 82 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 82 + v2, (u8 *)&v1); } } @@ -1491,7 +1491,7 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 86 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 86 + v2, (u8 *)&v1); } } @@ -1500,7 +1500,7 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 90 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 90 + v2, (u8 *)&v1); } } @@ -1509,60 +1509,60 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 94 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 94 + v2, (u8 *)&v1); } } v1 = GetGBABoxMonData(param0, 67, NULL); - SetBoxMonData(param1, 98, (u8 *)&v1); + BoxPokemon_SetValue(param1, 98, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 68, NULL); - SetBoxMonData(param1, 99, (u8 *)&v1); + BoxPokemon_SetValue(param1, 99, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 69, NULL); - SetBoxMonData(param1, 100, (u8 *)&v1); + BoxPokemon_SetValue(param1, 100, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 70, NULL); - SetBoxMonData(param1, 101, (u8 *)&v1); + BoxPokemon_SetValue(param1, 101, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 71, NULL); - SetBoxMonData(param1, 102, (u8 *)&v1); + BoxPokemon_SetValue(param1, 102, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 72, NULL); - SetBoxMonData(param1, 103, (u8 *)&v1); + BoxPokemon_SetValue(param1, 103, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 73, NULL); - SetBoxMonData(param1, 104, (u8 *)&v1); + BoxPokemon_SetValue(param1, 104, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 74, NULL); - SetBoxMonData(param1, 105, (u8 *)&v1); + BoxPokemon_SetValue(param1, 105, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 75, NULL); - SetBoxMonData(param1, 106, (u8 *)&v1); + BoxPokemon_SetValue(param1, 106, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 76, NULL); - SetBoxMonData(param1, 107, (u8 *)&v1); + BoxPokemon_SetValue(param1, 107, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 77, NULL); - SetBoxMonData(param1, 108, (u8 *)&v1); + BoxPokemon_SetValue(param1, 108, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 78, NULL); - SetBoxMonData(param1, 109, (u8 *)&v1); + BoxPokemon_SetValue(param1, 109, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 80, NULL); - SetBoxMonData(param1, 110, (u8 *)&v1); + BoxPokemon_SetValue(param1, 110, (u8 *)&v1); - v1 = sub_02075D74(param1); - SetBoxMonData(param1, 111, (u8 *)&v1); + v1 = BoxPokemon_GetGender(param1); + BoxPokemon_SetValue(param1, 111, (u8 *)&v1); - if (sub_02074570(param1, MON_DATA_SPECIES, NULL) == 201) { + if (BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 201) { v1 = GetGBABoxMonData(param0, 0, NULL); v1 = (((v1 & 0x3000000) >> 18) | ((v1 & 0x30000) >> 12) | ((v1 & 0x300) >> 6) | (v1 & 0x3)) % 28; - SetBoxMonData(param1, 112, (u8 *)&v1); + BoxPokemon_SetValue(param1, 112, (u8 *)&v1); } - if (sub_02074570(param1, MON_DATA_SPECIES, NULL) == 386) { + if (BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 386) { switch (Unk_021BF67C.unk_66) { default: case 2: @@ -1580,40 +1580,40 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) break; } - SetBoxMonData(param1, 112, (u8 *)&v1); + BoxPokemon_SetValue(param1, 112, (u8 *)&v1); } GetGBABoxMonData(param0, 2, &v5[0]); ov97_0223936C(&v5[0], &v6[0], 12, v4); - SetBoxMonData(param1, 118, &v6[0]); + BoxPokemon_SetValue(param1, 118, &v6[0]); if (GetGBABoxMonData(param0, 3, NULL) != Unk_020E4C44) { v1 = 1; - SetBoxMonData(param1, 77, &v1); + BoxPokemon_SetValue(param1, 77, &v1); } v1 = GetGBABoxMonData(param0, 37, NULL); - SetBoxMonData(param1, 122, &v1); + BoxPokemon_SetValue(param1, 122, &v1); GetGBABoxMonData(param0, 7, &v5[0]); ov97_0223936C(&v5[0], &v6[0], 8, v4); - SetBoxMonData(param1, 144, &v6[0]); + BoxPokemon_SetValue(param1, 144, &v6[0]); v1 = GetGBABoxMonData(param0, 35, NULL); - SetBoxMonData(param1, 153, &v1); + BoxPokemon_SetValue(param1, 153, &v1); v1 = GetGBABoxMonData(param0, 34, NULL); - SetBoxMonData(param1, 154, &v1); + BoxPokemon_SetValue(param1, 154, &v1); v1 = GetGBABoxMonData(param0, 38, NULL); - SetBoxMonData(param1, 155, &v1); + BoxPokemon_SetValue(param1, 155, &v1); v1 = GetGBABoxMonData(param0, 36, NULL); - SetBoxMonData(param1, 156, &v1); + BoxPokemon_SetValue(param1, 156, &v1); v1 = GetGBABoxMonData(param0, 49, NULL); - SetBoxMonData(param1, 157, &v1); - sub_02073D48(param1, v0); + BoxPokemon_SetValue(param1, 157, &v1); + BoxPokemon_ExitDecryptionContext(param1, v0); } diff --git a/src/overlay097/ov97_02237694.c b/src/overlay097/ov97_02237694.c index 96458d246e..625cd22823 100644 --- a/src/overlay097/ov97_02237694.c +++ b/src/overlay097/ov97_02237694.c @@ -11,7 +11,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_02008A90.h" @@ -52,7 +52,7 @@ #include "strbuf.h" #include "unk_020244AC.h" #include "unk_02033200.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "item.h" #include "overlay097/ov97_02237694.h" @@ -579,12 +579,12 @@ static void ov97_02237EF8 (UnkStruct_02022550 * param0, Pokemon * param1, int pa u32 v2; UnkStruct_ov97_0223F550 * v3 = &Unk_ov97_0223F550; - v0 = sub_02075D6C(param1); - v1 = sub_02075E0C(param1); + v0 = Pokemon_GetGender(param1); + v1 = Pokemon_IsShiny(param1); sub_02075FB4(param5, param2, v0, 2, v1, param3, 0); - v2 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); + v2 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); sub_020136A4(param5->unk_00, param5->unk_02, v3->unk_08, 0, 0, 10, 10, param4, v2, 0, 2, param2); DC_FlushRange(param4, 0x20 * 10 * 10); @@ -625,7 +625,7 @@ static void ov97_02237FF4 (UnkStruct_ov97_0223F550 * param0, int param1, UnkStru switch (param1) { case 1: case 13: - ov97_02237EF8(param0->unk_26C, v0, GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_FORM, 0), param0->unk_278, ¶m0->unk_EF8); + ov97_02237EF8(param0->unk_26C, v0, Pokemon_GetValue(v0, MON_DATA_SPECIES, 0), Pokemon_GetValue(v0, MON_DATA_FORM, 0), param0->unk_278, ¶m0->unk_EF8); break; case 2: ov97_02237EF8(param0->unk_26C, v0, 494, 0, param0->unk_278, ¶m0->unk_EF8); diff --git a/src/overlay099/ov99_021D4134.c b/src/overlay099/ov99_021D4134.c index 5f6304dfd7..ca55e2f83f 100644 --- a/src/overlay099/ov99_021D4134.c +++ b/src/overlay099/ov99_021D4134.c @@ -235,8 +235,8 @@ void ov99_021D44CC (UnkStruct_ov99_021D2CB0 * param0, UnkStruct_0200D0F4 * param if (param0->unk_1114.unk_02 == 0) { if (param0->unk_1114.unk_06 % 3 == 0) { - if (sub_0201D2E8() & 1) { - param0->unk_1114.unk_00 = sub_0201D2E8() % 10; + if (LCRNG_Next() & 1) { + param0->unk_1114.unk_00 = LCRNG_Next() % 10; param0->unk_1114.unk_06++; } else { param0->unk_1114.unk_00 = 40; @@ -257,7 +257,7 @@ void ov99_021D44CC (UnkStruct_ov99_021D2CB0 * param0, UnkStruct_0200D0F4 * param if (param0->unk_1114.unk_04 != -1) { param0->unk_1114.unk_04++; - if ((param0->unk_1114.unk_04 > 16) && (sub_0201D2E8() % 5 == 0)) { + if ((param0->unk_1114.unk_04 > 16) && (LCRNG_Next() % 5 == 0)) { v1 = 1; param0->unk_1114.unk_04 = -1; } else { diff --git a/src/overlay100/ov100_021D13E4.c b/src/overlay100/ov100_021D13E4.c index e0dd61c9e2..0af0ebf6a0 100644 --- a/src/overlay100/ov100_021D13E4.c +++ b/src/overlay100/ov100_021D13E4.c @@ -328,7 +328,7 @@ static void ov100_021D1A54 (UnkStruct_ov100_021D1808 * param0) param0->unk_0C.unk_D4[v0].unk_24 = 0; param0->unk_0C.unk_D4[v0].unk_28[0] = 1; param0->unk_0C.unk_D4[v0].unk_28[1] = 1; - param0->unk_0C.unk_D4[v0].unk_28[2] = sub_0201D2E8() % 10; + param0->unk_0C.unk_D4[v0].unk_28[2] = LCRNG_Next() % 10; param0->unk_0C.unk_D4[v0].unk_28[3] = 0; param0->unk_0C.unk_D4[v0].unk_40 = sub_0200D9E8(ov100_021D4438, ¶m0->unk_0C.unk_D4[v0], 4096 - 1); } @@ -361,7 +361,7 @@ static void ov100_021D1A54 (UnkStruct_ov100_021D1808 * param0) param0->unk_0C.unk_0C[v0].unk_24 = 0; param0->unk_0C.unk_0C[v0].unk_28[0] = 1; param0->unk_0C.unk_0C[v0].unk_28[1] = 1; - param0->unk_0C.unk_0C[v0].unk_28[2] = sub_0201D2E8() % 10; + param0->unk_0C.unk_0C[v0].unk_28[2] = LCRNG_Next() % 10; param0->unk_0C.unk_0C[v0].unk_28[3] = 0; param0->unk_0C.unk_0C[v0].unk_40 = sub_0200D9E8(ov100_021D4438, ¶m0->unk_0C.unk_0C[v0], 4096); } diff --git a/src/overlay100/ov100_021D1C44.c b/src/overlay100/ov100_021D1C44.c index db6b387583..5f6b3451e7 100644 --- a/src/overlay100/ov100_021D1C44.c +++ b/src/overlay100/ov100_021D1C44.c @@ -238,7 +238,7 @@ static void ov100_021D2250 (UnkStruct_ov100_021D1C98 * param0) param0->unk_08.unk_0C[v0].unk_24 = v0; param0->unk_08.unk_0C[v0].unk_28[0] = 1; param0->unk_08.unk_0C[v0].unk_28[1] = 1; - param0->unk_08.unk_0C[v0].unk_28[2] = sub_0201D2E8() % 10; + param0->unk_08.unk_0C[v0].unk_28[2] = LCRNG_Next() % 10; param0->unk_08.unk_0C[v0].unk_28[3] = 0; param0->unk_08.unk_0C[v0].unk_40 = sub_0200D9E8(ov100_021D4414, ¶m0->unk_08.unk_0C[v0], 4096); } diff --git a/src/overlay100/ov100_021D400C.c b/src/overlay100/ov100_021D400C.c index c4e5c61cd1..950f87e870 100644 --- a/src/overlay100/ov100_021D400C.c +++ b/src/overlay100/ov100_021D400C.c @@ -153,7 +153,7 @@ static void ov100_021D42B0 (UnkStruct_ov100_021D4104 * param0) if (v3 == 0) { param0->unk_28[2]++; param0->unk_28[2] %= NELEMS(v2); - param0->unk_28[2] = sub_0201D2E8() % NELEMS(v2); + param0->unk_28[2] = LCRNG_Next() % NELEMS(v2); param0->unk_0C = 3; } @@ -172,8 +172,8 @@ static void ov100_021D4318 (UnkStruct_ov100_021D4104 * param0) if (param0->unk_20 < 12) { param0->unk_24++; param0->unk_24 %= 3; - param0->unk_28[0] = (sub_0201D2E8() % param0->unk_24) + 1; - param0->unk_28[1] = (sub_0201D2E8() % param0->unk_24) + 1; + param0->unk_28[0] = (LCRNG_Next() % param0->unk_24) + 1; + param0->unk_28[1] = (LCRNG_Next() % param0->unk_24) + 1; param0->unk_0C = 2; } diff --git a/src/overlay101/ov101_021D1A28.c b/src/overlay101/ov101_021D1A28.c index 75d0ac8f9b..88397cd581 100644 --- a/src/overlay101/ov101_021D1A28.c +++ b/src/overlay101/ov101_021D1A28.c @@ -228,7 +228,7 @@ static void ov101_021D1A68 (UnkStruct_ov101_021D13C8 * param0) fx32 v2; for (v0 = 0; v0 < 3; v0++) { - v1 = (int)sub_0201D2E8() % 21; + v1 = (int)LCRNG_Next() % 21; param0->unk_A8[v0] = v1; param0->unk_90[v0] = (FX32_ONE * ((21 * 32))) - ((FX32_ONE * ((v1) * 32))); param0->unk_90[v0] %= (FX32_ONE * ((21 * 32))); @@ -2738,7 +2738,7 @@ static fx32 ov101_021D4024 (UnkStruct_ov101_021D13C8 * param0, UnkEnum_ov101_021 static u32 ov101_021D405C (UnkStruct_ov101_021D13C8 * param0) { - u32 v0 = ((u32)sub_0201D2E8()) % 100; + u32 v0 = ((u32)LCRNG_Next()) % 100; return v0; } @@ -3063,7 +3063,7 @@ static UnkEnum_ov101_021D4550 ov101_021D4550 (UnkStruct_ov101_021D13C8 * param0) static void ov101_021D45B0 (UnkStruct_ov101_021D13C8 * param0) { - param0->unk_34 = sub_0201D2E8() % 6; + param0->unk_34 = LCRNG_Next() % 6; } static void ov101_021D45C4 (UnkStruct_ov101_021D13C8 * param0) diff --git a/src/overlay104/ov104_0222DCE0.c b/src/overlay104/ov104_0222DCE0.c index 355c55cfe7..ee1726b6a6 100644 --- a/src/overlay104/ov104_0222DCE0.c +++ b/src/overlay104/ov104_0222DCE0.c @@ -7,7 +7,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202C878_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -34,7 +34,7 @@ #include "unk_02034198.h" #include "unk_02038F8C.h" #include "map_header.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0208C098.h" #include "unk_02092494.h" @@ -196,8 +196,8 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para if (param3 == 0) { do { - v2 = (sub_0201D2E8() | sub_0201D2E8() << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (sub_02075E38(param2, v2) == 1)); + v2 = (LCRNG_Next() | LCRNG_Next() << 16); + } while ((v4.unk_0B != Pokemon_GetNatureOf(v2)) || (Pokemon_IsPersonalityShiny(param2, v2) == 1)); param0->unk_10 = v2; } else { @@ -215,7 +215,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { v1++; } } @@ -227,7 +227,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { param0->unk_18_val2[v0] = v1; } } @@ -235,16 +235,16 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para param0->unk_1E_val2 = 0; param0->unk_1F = Unk_020E4C44; - v0 = sub_020759F0(param0->unk_00_val1_0, 25); + v0 = PokemonPersonalData_GetSpeciesValue(param0->unk_00_val1_0, 25); if (v0) { if (param0->unk_10 & 1) { param0->unk_20 = v0; } else { - param0->unk_20 = sub_020759F0(param0->unk_00_val1_0, 24); + param0->unk_20 = PokemonPersonalData_GetSpeciesValue(param0->unk_00_val1_0, 24); } } else { - param0->unk_20 = sub_020759F0(param0->unk_00_val1_0, 24); + param0->unk_20 = PokemonPersonalData_GetSpeciesValue(param0->unk_00_val1_0, 24); } param0->unk_21 = v3; @@ -261,7 +261,7 @@ void ov104_0222DF40 (const UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * par u16 v5; u32 v6; - ZeroMonData(param1); + Pokemon_Init(param1); if (param2 == 120) { v4 = 50; @@ -274,48 +274,48 @@ void ov104_0222DF40 (const UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * par v1 = (param0->unk_14_val2 & 0x3FFFFFFF); sub_02073D80(param1, param0->unk_00_val1_0, v4, v1, 1, param0->unk_10, 2, 0); - sub_02074B30(param1, 175, &v1); - sub_0207418C(param1); + Pokemon_SetValue(param1, 175, &v1); + Pokemon_CalcLevelAndStats(param1); v2 = param0->unk_00_val1_11; - sub_02074B30(param1, 112, &v2); - sub_02074B30(param1, 6, ¶m0->unk_02); + Pokemon_SetValue(param1, 112, &v2); + Pokemon_SetValue(param1, 6, ¶m0->unk_02); for (v0 = 0; v0 < 4; v0++) { v5 = param0->unk_04[v0]; - sub_02074B30(param1, 54 + v0, &v5); + Pokemon_SetValue(param1, 54 + v0, &v5); v2 = (param0->unk_1E_val2 >> (v0 * 2)) & 0x3; - sub_02074B30(param1, 62 + v0, &v2); + Pokemon_SetValue(param1, 62 + v0, &v2); - v3 = (u8)GetMonData(param1, MON_DATA_66 + v0, NULL); - sub_02074B30(param1, 58 + v0, &v3); + v3 = (u8)Pokemon_GetValue(param1, MON_DATA_MOVE1_MAX_PP + v0, NULL); + Pokemon_SetValue(param1, 58 + v0, &v3); } v6 = param0->unk_0C; - sub_02074B30(param1, 7, &v6); + Pokemon_SetValue(param1, 7, &v6); v2 = param0->unk_18_val1_00; - sub_02074B30(param1, 13, &v2); + Pokemon_SetValue(param1, 13, &v2); v2 = param0->unk_18_val1_01; - sub_02074B30(param1, 14, &v2); + Pokemon_SetValue(param1, 14, &v2); v2 = param0->unk_18_val1_02; - sub_02074B30(param1, 15, &v2); + Pokemon_SetValue(param1, 15, &v2); v2 = param0->unk_18_val1_03; - sub_02074B30(param1, 16, &v2); + Pokemon_SetValue(param1, 16, &v2); v2 = param0->unk_18_val1_04; - sub_02074B30(param1, 17, &v2); + Pokemon_SetValue(param1, 17, &v2); v2 = param0->unk_18_val1_05; - sub_02074B30(param1, 18, &v2); + Pokemon_SetValue(param1, 18, &v2); - sub_02074B30(param1, 10, ¶m0->unk_20); - sub_02074B30(param1, 9, ¶m0->unk_21); + Pokemon_SetValue(param1, 10, ¶m0->unk_20); + Pokemon_SetValue(param1, 9, ¶m0->unk_21); if (param0->unk_14_val1_30) { MessageLoader * v7; @@ -324,15 +324,15 @@ void ov104_0222DF40 (const UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * par v7 = MessageLoader_Init(1, 26, 412, 4); v8 = MessageLoader_GetNewStrbuf(v7, param0->unk_00_val1_0); - sub_02074B30(param1, 119, v8); + Pokemon_SetValue(param1, 119, v8); Strbuf_Free(v8); MessageLoader_Free(v7); } else { - sub_02074B30(param1, 117, param0->unk_22); + Pokemon_SetValue(param1, 117, param0->unk_22); } - sub_02074B30(param1, 12, ¶m0->unk_1F); - sub_0207418C(param1); + Pokemon_SetValue(param1, 12, ¶m0->unk_1F); + Pokemon_CalcLevelAndStats(param1); } u16 ov104_0222E10C (u8 param0) @@ -359,7 +359,7 @@ void ov104_0222E134 (UnkStruct_021C0794 * param0, Pokemon * param1) int v4 = 0; UnkStruct_02025E6C * v5 = sub_02025E38(param0); - v0 = GetMonData(param1, MON_DATA_OT_ID, NULL); + v0 = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); sub_02077EE4(param1, sub_02025E38(param0), 4, 0, 0, 11); v3 = sub_0203A138(562); @@ -368,8 +368,8 @@ void ov104_0222E134 (UnkStruct_021C0794 * param0, Pokemon * param1) v2 = MessageLoader_Init(0, 26, 363, 11); v1 = MessageLoader_GetNewStrbuf(v2, 0); - sub_02074B30(param1, 145, v1); - sub_02074B30(param1, 7, &v0); + Pokemon_SetValue(param1, 145, v1); + Pokemon_SetValue(param1, 7, &v0); Strbuf_Free(v1); MessageLoader_Free(v2); @@ -465,7 +465,7 @@ u32 ov104_0222E2F0 (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, int para { u32 v0, v1, v2; - v0 = sub_0201D2E8() | (sub_0201D2E8() << 16); + v0 = LCRNG_Next() | (LCRNG_Next() << 16); v2 = ov104_0222DD6C(param0, param1, v0, param4, param3, param2, 0, param5, param6); return v2; @@ -531,7 +531,7 @@ BOOL ov104_0222E3E4 (UnkStruct_0204B184 * param0, const u16 param1[], const u16 v2 = 0; while (v0 != param4) { - v5 = (sub_0201D2E8() % param0->unk_02); + v5 = (LCRNG_Next() % param0->unk_02); v1 = param0->unk_04[v5]; ov104_0222DCF4(&v3[v0], v1, 179); diff --git a/src/overlay104/ov104_0222ECE8.c b/src/overlay104/ov104_0222ECE8.c index 00bfdb50de..043285ff6d 100644 --- a/src/overlay104/ov104_0222ECE8.c +++ b/src/overlay104/ov104_0222ECE8.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_020305B8_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay104/struct_ov104_0223ADA0.h" @@ -19,7 +19,7 @@ #include "unk_0203061C.h" #include "unk_02034198.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222ECE8.h" #include "overlay104/ov104_0223A7F4.h" @@ -285,7 +285,7 @@ BOOL ov104_0222EE60 (UnkStruct_ov104_0223B5C0 * param0) v1 = 0; v3 = 512; - v4 = PokemonStructSize(); + v4 = Pokemon_StructSize(); v6 = Party_GetFromSavedata(param0->unk_6FC); v5 = Party_GetPokemonBySlotIndex(v6, param0->unk_260[0]); @@ -313,7 +313,7 @@ void ov104_0222EEA8 (int param0, int param1, void * param2, void * param3) return; } - v2 = PokemonStructSize(); + v2 = Pokemon_StructSize(); MI_CpuCopy8(&v4[0], v3->unk_D8C, v2); return; @@ -670,8 +670,8 @@ BOOL ov104_0222F238 (UnkStruct_ov104_0223ADA0 * param0) for (v1 = 0; v1 < v0; v1++) { v8 = Party_GetPokemonBySlotIndex(param0->unk_4D4, v1); - v7[v1] = GetMonData(v8, MON_DATA_ATK_IV, NULL); - v6[v1] = GetMonData(v8, MON_DATA_PERSONALITY, NULL); + v7[v1] = Pokemon_GetValue(v8, MON_DATA_ATK_IV, NULL); + v6[v1] = Pokemon_GetValue(v8, MON_DATA_PERSONALITY, NULL); } for (v1 = 0; v1 < v0; v1++) { @@ -1081,7 +1081,7 @@ BOOL ov104_0222F758 (UnkStruct_ov104_0223BA10 * param0) v1 = 0; v3 = 512; v5 = ov104_0223B7A8(param0->unk_10, 0); - v4 = PokemonStructSize(); + v4 = Pokemon_StructSize(); for (v0 = 0; v0 < v5; v0++) { v6 = Party_GetPokemonBySlotIndex(param0->unk_28, v0); @@ -1113,8 +1113,8 @@ void ov104_0222F7BC (int param0, int param1, void * param2, void * param3) } v0 = ov104_0223B7A8(v5->unk_10, 0); - v3 = PokemonStructSize(); - v4 = AllocMonZeroed(11); + v3 = Pokemon_StructSize(); + v4 = Pokemon_New(11); for (v1 = 0; v1 < v0; v1++) { MI_CpuCopy8(&v6[v3 * v1], v4, v3); @@ -1380,7 +1380,7 @@ BOOL ov104_0222FAD0 (UnkStruct_ov104_0223BFFC * param0) v1 = 0; v3 = 512; v5 = ov104_0223BD70(param0->unk_10, 0); - v4 = PokemonStructSize(); + v4 = Pokemon_StructSize(); for (v0 = 0; v0 < v5; v0++) { v6 = Party_GetPokemonBySlotIndex(param0->unk_70, v0); @@ -1412,8 +1412,8 @@ void ov104_0222FB34 (int param0, int param1, void * param2, void * param3) } v0 = ov104_0223BD70(v5->unk_10, 0); - v3 = PokemonStructSize(); - v4 = AllocMonZeroed(11); + v3 = Pokemon_StructSize(); + v4 = Pokemon_New(11); for (v1 = 0; v1 < v0; v1++) { MI_CpuCopy8(&v6[v3 * v1], v4, v3); diff --git a/src/overlay104/ov104_0222FBE4.c b/src/overlay104/ov104_0222FBE4.c index 6ced988323..0670456905 100644 --- a/src/overlay104/ov104_0222FBE4.c +++ b/src/overlay104/ov104_0222FBE4.c @@ -17,7 +17,7 @@ #include "struct_decls/struct_0202440C_decl.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202B370_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay063/struct_ov63_0222BEC0_decl.h" #include "overlay063/struct_ov63_0222D77C_decl.h" @@ -1995,7 +1995,7 @@ static BOOL ov104_0223102C (UnkStruct_ov104_0222E930 * param0) u16 * v0 = ov104_0222FBE4(param0); u16 v1 = ov104_0222FC00(param0); - *v0 = (sub_0201D2E8() % v1); + *v0 = (LCRNG_Next() % v1); return 1; } diff --git a/src/overlay104/ov104_02231F74.c b/src/overlay104/ov104_02231F74.c index b1680d22ea..2bce5ba3e2 100644 --- a/src/overlay104/ov104_02231F74.c +++ b/src/overlay104/ov104_02231F74.c @@ -14,7 +14,7 @@ #include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay063/struct_ov63_0222BEC0_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" #include "overlay104/struct_ov104_022320B4_decl.h" @@ -60,7 +60,7 @@ #include "strbuf.h" #include "unk_02025E08.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "unk_0207E0B8.h" #include "unk_0209B6F8.h" @@ -1120,8 +1120,8 @@ void ov104_02232CE0 (UnkStruct_ov104_0223C4CC * param0, Pokemon * param1, int pa u32 v9, v10; v4 = Heap_AllocFromHeap(param2, (10 * 10 * ((8 / 2) * 8))); - v9 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - v10 = GetMonData(param1, MON_DATA_SPECIES, NULL); + v9 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + v10 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); sub_02075EF4(&v3, param1, 2); sub_020136A4(v3.unk_00, v3.unk_02, param2, 0, 0, 10, 10, v4, v9, 0, 2, v10); diff --git a/src/overlay104/ov104_022332B4.c b/src/overlay104/ov104_022332B4.c index 265d9c3a45..8236b8037a 100644 --- a/src/overlay104/ov104_022332B4.c +++ b/src/overlay104/ov104_022332B4.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay104/struct_ov104_0222E930_decl.h" #include "constdata/const_020EA358.h" @@ -23,7 +23,7 @@ #include "unk_02018340.h" #include "unk_0202FF4C.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209B6F8.h" #include "unk_0209BA80.h" @@ -305,9 +305,9 @@ BOOL ov104_022334DC (UnkStruct_ov104_0222E930 * param0) *v15 = v4->unk_3F0[v13].unk_04[v14]; break; case 17: - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); ov104_0222DF40(&v4->unk_3F0[v13], v3, ov104_0223ADA0(v4)); - *v15 = GetMonData(v3, MON_DATA_177, NULL); + *v15 = Pokemon_GetValue(v3, MON_DATA_177, NULL); Heap_FreeToHeap(v3); break; case 18: @@ -317,13 +317,13 @@ BOOL ov104_022334DC (UnkStruct_ov104_0222E930 * param0) v0[v10] = 0; } - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); for (v10 = 0; v10 < v5; v10++) { ov104_0222DF40(&v4->unk_3F0[v10], v3, ov104_0223ADA0(v4)); - v7 = GetMonData(v3, MON_DATA_177, NULL); - v8 = GetMonData(v3, MON_DATA_178, NULL); + v7 = Pokemon_GetValue(v3, MON_DATA_177, NULL); + v8 = Pokemon_GetValue(v3, MON_DATA_178, NULL); if (v7 == v8) { v8 = 0xff; @@ -404,7 +404,7 @@ BOOL ov104_022334DC (UnkStruct_ov104_0222E930 * param0) for (v10 = 0; v10 < v6; v10++) { v3 = Party_GetPokemonBySlotIndex(v4->unk_4D4, v10); - sub_0200B538(param0->unk_00->unk_44, v10, sub_02076B10(v3)); + sub_0200B538(param0->unk_00->unk_44, v10, Pokemon_GetBoxPokemon(v3)); } break; case 35: diff --git a/src/overlay104/ov104_022339B4.c b/src/overlay104/ov104_022339B4.c index db92a636ff..8f54c86980 100644 --- a/src/overlay104/ov104_022339B4.c +++ b/src/overlay104/ov104_022339B4.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_0202FF58.h" @@ -22,7 +22,7 @@ #include "unk_020507CC.h" #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0222ECE8.h" @@ -188,7 +188,7 @@ static void ov104_02233BAC (UnkStruct_ov104_0223ADA0 * param0) } for (v0 = 0; v0 < 6; v0++) { - v4 = AllocMonZeroed(11); + v4 = Pokemon_New(11); ov104_0222DF40(¶m0->unk_280[v0], v4, ov104_0223ADA0(param0)); ov104_0222E1C0(param0->unk_4F8, param0->unk_4D4, v4); Heap_FreeToHeap(v4); @@ -209,7 +209,7 @@ static void ov104_02233D80 (UnkStruct_ov104_0223ADA0 * param0, u8 param1, u8 par u32 v3; UnkStruct_ov104_0223A348_sub2 v4; - v0 = (sub_0201D2E8() % 6); + v0 = (LCRNG_Next() % 6); if (param2 == 0) { v1 = param0->unk_254[param1]; @@ -272,7 +272,7 @@ static void ov104_02233F1C (UnkStruct_ov104_0223ADA0 * param0) ov104_0222E330(v4, v6, v5, v7, NULL, 4, 11, 179); - v1 = AllocMonZeroed(11); + v1 = Pokemon_New(11); for (v0 = 0; v0 < 4; v0++) { ov104_0222DF40(&v4[v0], v1, ov104_0223ADA0(param0)); @@ -291,7 +291,7 @@ static void ov104_02233F1C (UnkStruct_ov104_0223ADA0 * param0) ov104_0222E330(v4, v6, v5, v7, NULL, 4, 11, 179); - v1 = AllocMonZeroed(11); + v1 = Pokemon_New(11); for (v0 = 0; v0 < 4; v0++) { ov104_0222DF40(&v4[v0], v1, ov104_0223ADA0(param0)); @@ -417,10 +417,10 @@ void ov104_02234148 (UnkStruct_ov104_0223ADA0 * param0, u8 param1) v6[0] = param0->unk_4E8[v0]; sub_0202FF84(param0->unk_4F4, 4, v0, v6); - v5[0] = GetMonData(v12, MON_DATA_ATK_IV, NULL); + v5[0] = Pokemon_GetValue(v12, MON_DATA_ATK_IV, NULL); sub_0202FF84(param0->unk_4F4, 5, v0, v5); - v7[0] = GetMonData(v12, MON_DATA_PERSONALITY, NULL); + v7[0] = Pokemon_GetValue(v12, MON_DATA_PERSONALITY, NULL); sub_0202FF84(param0->unk_4F4, 6, v0, v7); } @@ -432,10 +432,10 @@ void ov104_02234148 (UnkStruct_ov104_0223ADA0 * param0, u8 param1) v6[0] = param0->unk_3D2[v0]; sub_0202FF84(param0->unk_4F4, 7, v0, v6); - v5[0] = GetMonData(v12, MON_DATA_ATK_IV, NULL); + v5[0] = Pokemon_GetValue(v12, MON_DATA_ATK_IV, NULL); sub_0202FF84(param0->unk_4F4, 8, v0, v5); - v7[0] = GetMonData(v12, MON_DATA_PERSONALITY, NULL); + v7[0] = Pokemon_GetValue(v12, MON_DATA_PERSONALITY, NULL); sub_0202FF84(param0->unk_4F4, 9, v0, v7); } @@ -499,7 +499,7 @@ void ov104_0223449C (UnkStruct_ov104_0223ADA0 * param0) sub_0207A008(param0->unk_4D4); - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); for (v0 = 0; v0 < v1; v0++) { ov104_0222DF40(¶m0->unk_280[param0->unk_4DC[v0]], v3, ov104_0223ADA0(param0)); @@ -536,8 +536,8 @@ void ov104_02234570 (UnkStruct_ov104_0223ADA0 * param0) for (v0 = 0; v0 < v1; v0++) { v6 = Party_GetPokemonBySlotIndex(param0->unk_4D4, v0); - v4[v0] = GetMonData(v6, MON_DATA_SPECIES, NULL); - v5[v0] = GetMonData(v6, MON_DATA_HELD_ITEM, NULL); + v4[v0] = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + v5[v0] = Pokemon_GetValue(v6, MON_DATA_HELD_ITEM, NULL); } v2 = v1; @@ -545,8 +545,8 @@ void ov104_02234570 (UnkStruct_ov104_0223ADA0 * param0) for (v0 = 0; v0 < v1; v0++) { v6 = Party_GetPokemonBySlotIndex(param0->unk_4D8, v0); - v4[v0 + v2] = GetMonData(v6, MON_DATA_SPECIES, NULL); - v5[v0 + v2] = GetMonData(v6, MON_DATA_HELD_ITEM, NULL); + v4[v0 + v2] = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + v5[v0 + v2] = Pokemon_GetValue(v6, MON_DATA_HELD_ITEM, NULL); param0->unk_254[v0] = param0->unk_3D2[v0]; } @@ -590,7 +590,7 @@ void ov104_0223470C (UnkStruct_ov104_0223ADA0 * param0) sub_0207A008(param0->unk_4D8); - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { ov104_0222DF40(¶m0->unk_3F0[v0], v3, ov104_0223ADA0(param0)); diff --git a/src/overlay104/ov104_02234838.c b/src/overlay104/ov104_02234838.c index cfd1207fbc..b1acae2a2e 100644 --- a/src/overlay104/ov104_02234838.c +++ b/src/overlay104/ov104_02234838.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_0202440C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" @@ -23,7 +23,7 @@ #include "unk_02030108.h" #include "unk_02051D8C.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209B6F8.h" #include "unk_0209BA80.h" @@ -258,7 +258,7 @@ BOOL ov104_02234A1C (UnkStruct_ov104_0222E930 * param0) for (v7 = 0; v7 < v5; v7++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_260[v7]); - sub_02074B30(v1, 6, &v3->unk_728[v7]); + Pokemon_SetValue(v1, 6, &v3->unk_728[v7]); } break; case 28: @@ -297,7 +297,7 @@ BOOL ov104_02234A1C (UnkStruct_ov104_0222E930 * param0) case 15: v2 = Party_GetFromSavedata(v0->unk_08); v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_260[0]); - *v11 = GetMonData(v1, MON_DATA_SPECIES, NULL); + *v11 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); break; case 35: ov104_022356A0(v3); @@ -414,7 +414,7 @@ BOOL ov104_02234D6C (UnkStruct_ov104_0222E930 * param0) v4 = sub_0209B978(param0->unk_00->unk_00); v2 = Party_GetFromSavedata(v5->unk_08); v3 = Party_GetPokemonBySlotIndex(v2, v4->unk_260[0]); - v1 = GetMonData(v3, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); if (v4->unk_04 == 0) { v0 = sub_0202440C(v5->unk_08); diff --git a/src/overlay104/ov104_02234DB4.c b/src/overlay104/ov104_02234DB4.c index 9aa1f55fe8..8c7ad4bb73 100644 --- a/src/overlay104/ov104_02234DB4.c +++ b/src/overlay104/ov104_02234DB4.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02030114_decl.h" #include "struct_decls/struct_0203026C_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_0204B184.h" @@ -20,7 +20,7 @@ #include "unk_020507CC.h" #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0222ECE8.h" @@ -63,7 +63,7 @@ UnkStruct_ov104_0223B5C0 * ov104_02234DB4 (UnkStruct_021C0794 * param0, u16 para v10->unk_6FC = param0; v10->unk_00 = 11; v10->unk_264 = sub_02079FF4(11); - v10->unk_D8C = AllocMonZeroed(11); + v10->unk_D8C = Pokemon_New(11); v0 = v10->unk_6F8; v1 = sub_0203026C(param0); @@ -114,7 +114,7 @@ UnkStruct_ov104_0223B5C0 * ov104_02234DB4 (UnkStruct_021C0794 * param0, u16 para for (v5 = 0; v5 < v4; v5++) { v9 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v10->unk_6FC), v10->unk_260[v5]); - v10->unk_728[v5] = GetMonData(v9, MON_DATA_HELD_ITEM, NULL); + v10->unk_728[v5] = Pokemon_GetValue(v9, MON_DATA_HELD_ITEM, NULL); } v10->unk_10 = 0; @@ -186,7 +186,7 @@ static void ov104_022350B8 (UnkStruct_ov104_0223B5C0 * param0) } v6 = Party_GetPokemonBySlotIndex(param0->unk_264, 0); - ov104_0223B0C8(1, param0->unk_6F4, v0, param0->unk_05, GetMonData(v6, MON_DATA_SPECIES, NULL), param0->unk_268, v3); + ov104_0223B0C8(1, param0->unk_6F4, v0, param0->unk_05, Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL), param0->unk_268, v3); return; } @@ -267,7 +267,7 @@ void ov104_0223526C (UnkStruct_ov104_0223B5C0 * param0, u8 param1) sub_0203012C(param0->unk_6F8, 1); v10 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_6FC), param0->unk_260[0]); - v9 = GetMonData(v10, MON_DATA_SPECIES, NULL); + v9 = Pokemon_GetValue(v10, MON_DATA_SPECIES, NULL); v8 = sub_02030698(v4, sub_0205E55C(param0->unk_04), sub_0205E6A8(sub_0205E55C(param0->unk_04))); v1[0] = param0->unk_05; @@ -313,7 +313,7 @@ void ov104_0223526C (UnkStruct_ov104_0223B5C0 * param0, u8 param1) sub_02030140(param0->unk_6F8, 4, v0, 0, v2); } - sub_020306E4(v4, sub_0205E55C(param0->unk_04), sub_0205E6A8(sub_0205E55C(param0->unk_04)), GetMonData(v10, MON_DATA_SPECIES, NULL)); + sub_020306E4(v4, sub_0205E55C(param0->unk_04), sub_0205E6A8(sub_0205E55C(param0->unk_04)), Pokemon_GetValue(v10, MON_DATA_SPECIES, NULL)); return; } diff --git a/src/overlay104/ov104_022358E8.c b/src/overlay104/ov104_022358E8.c index a752cb9a65..63b1da6fbe 100644 --- a/src/overlay104/ov104_022358E8.c +++ b/src/overlay104/ov104_022358E8.c @@ -2,7 +2,7 @@ #include #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" @@ -23,7 +23,7 @@ #include "unk_02034198.h" #include "unk_02051D8C.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209B6F8.h" #include "unk_0209BA80.h" @@ -350,7 +350,7 @@ BOOL ov104_02235BC0 (UnkStruct_ov104_0222E930 * param0) for (v8 = 0; v8 < 3; v8++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_24[v8]); - sub_02074B30(v1, 6, &v3->unk_36A[v8]); + Pokemon_SetValue(v1, 6, &v3->unk_36A[v8]); } break; case 19: diff --git a/src/overlay104/ov104_022361B4.c b/src/overlay104/ov104_022361B4.c index 49e8871f81..a567d7b028 100644 --- a/src/overlay104/ov104_022361B4.c +++ b/src/overlay104/ov104_022361B4.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_020302DC_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay104/struct_ov104_022320B4_decl.h" @@ -38,7 +38,7 @@ #include "unk_020507CC.h" #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0222E63C.h" @@ -136,7 +136,7 @@ UnkStruct_ov104_0223BA10 * ov104_022361B4 (UnkStruct_021C0794 * param0, u16 para for (v7 = 0; v7 < 3; v7++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v9->unk_04), v9->unk_24[v7]); - v9->unk_36A[v7] = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v9->unk_36A[v7] = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); } v2 = Party_GetFromSavedata(v9->unk_04); @@ -148,12 +148,12 @@ UnkStruct_ov104_0223BA10 * ov104_022361B4 (UnkStruct_021C0794 * param0, u16 para v3 = Party_GetPokemonBySlotIndex(v9->unk_28, v7); v0 = 0; - sub_02074B30(v3, 6, &v0); + Pokemon_SetValue(v3, 6, &v0); - if (GetMonData(v3, MON_DATA_161, NULL) > 50) { - v1 = sub_02075AD0(GetMonData(v3, MON_DATA_SPECIES, NULL), 50); - sub_02074B30(v3, 8, &v1); - sub_0207418C(v3); + if (Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL) > 50) { + v1 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), 50); + Pokemon_SetValue(v3, 8, &v1); + Pokemon_CalcLevelAndStats(v3); } } @@ -190,10 +190,10 @@ static void ov104_02236528 (UnkStruct_ov104_0223BA10 * param0) for (v1 = 0; v1 < v0; v1++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_28, v1); - param0->unk_394[v1][0] = GetMonData(v3, MON_DATA_58, NULL); - param0->unk_394[v1][1] = GetMonData(v3, MON_DATA_59, NULL); - param0->unk_394[v1][2] = GetMonData(v3, MON_DATA_60, NULL); - param0->unk_394[v1][3] = GetMonData(v3, MON_DATA_61, NULL); + param0->unk_394[v1][0] = Pokemon_GetValue(v3, MON_DATA_MOVE1_CUR_PP, NULL); + param0->unk_394[v1][1] = Pokemon_GetValue(v3, MON_DATA_MOVE2_CUR_PP, NULL); + param0->unk_394[v1][2] = Pokemon_GetValue(v3, MON_DATA_MOVE3_CUR_PP, NULL); + param0->unk_394[v1][3] = Pokemon_GetValue(v3, MON_DATA_MOVE4_CUR_PP, NULL); } ov104_0223B760(param0->unk_10, ov104_0223BB60(param0), param0->unk_30, (7 * 2)); @@ -235,7 +235,7 @@ static void ov104_022365F8 (UnkStruct_ov104_0223BA10 * param0) ov104_0222E330(v4, v6, v5, NULL, v7, 4, 11, 179); - v2 = AllocMonZeroed(11); + v2 = Pokemon_New(11); for (v1 = 0; v1 < 4; v1++) { ov104_0222DF40(&v4[v1], v2, ov104_0223BA10(param0)); @@ -262,25 +262,25 @@ static void ov104_022366A4 (UnkStruct_ov104_0223BA10 * param0) v5 = Party_GetPokemonBySlotIndex(param0->unk_28, v4); v2 = (u16)sub_02030398(param0->unk_08, 2, v4, 0, NULL); - sub_02074B30(v5, 163, &v2); + Pokemon_SetValue(v5, 163, &v2); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 0, NULL); - sub_02074B30(v5, 58, &v3); + Pokemon_SetValue(v5, 58, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 1, NULL); - sub_02074B30(v5, 59, &v3); + Pokemon_SetValue(v5, 59, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 2, NULL); - sub_02074B30(v5, 60, &v3); + Pokemon_SetValue(v5, 60, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 3, NULL); - sub_02074B30(v5, 61, &v3); + Pokemon_SetValue(v5, 61, &v3); v1 = (u32)sub_02030398(param0->unk_08, 4, v4, 0, NULL); - sub_02074B30(v5, 160, &v1); + Pokemon_SetValue(v5, 160, &v1); v2 = (u16)sub_02030398(param0->unk_08, 5, v4, 0, NULL); - sub_02074B30(v5, 6, &v2); + Pokemon_SetValue(v5, 6, &v2); } return; @@ -409,25 +409,25 @@ void ov104_02236848 (UnkStruct_ov104_0223BA10 * param0, u8 param1) for (v0 = 0; v0 < v8; v0++) { v11 = Party_GetPokemonBySlotIndex(param0->unk_28, v0); - v5[0] = GetMonData(v11, MON_DATA_163, NULL); + v5[0] = Pokemon_GetValue(v11, MON_DATA_CURRENT_HP, NULL); sub_02030308(param0->unk_08, 2, v0, 0, v5); - v4[0] = GetMonData(v11, MON_DATA_58, NULL); + v4[0] = Pokemon_GetValue(v11, MON_DATA_MOVE1_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 0, v4); - v4[0] = GetMonData(v11, MON_DATA_59, NULL); + v4[0] = Pokemon_GetValue(v11, MON_DATA_MOVE2_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 1, v4); - v4[0] = GetMonData(v11, MON_DATA_60, NULL); + v4[0] = Pokemon_GetValue(v11, MON_DATA_MOVE3_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 2, v4); - v4[0] = GetMonData(v11, MON_DATA_61, NULL); + v4[0] = Pokemon_GetValue(v11, MON_DATA_MOVE4_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 3, v4); - v6[0] = GetMonData(v11, MON_DATA_160, NULL); + v6[0] = Pokemon_GetValue(v11, MON_DATA_160, NULL); sub_02030308(param0->unk_08, 4, v0, 0, v6); - v5[0] = GetMonData(v11, MON_DATA_HELD_ITEM, NULL); + v5[0] = Pokemon_GetValue(v11, MON_DATA_HELD_ITEM, NULL); sub_02030308(param0->unk_08, 5, v0, 0, v5); } @@ -536,10 +536,10 @@ void ov104_02236C50 (UnkStruct_ov104_0223BA10 * param0) for (v2 = v0; v2 < (v1 + v0); v2++) { v4 = Party_GetPokemonBySlotIndex(param0->unk_28, v2); - param0->unk_394[v2 - v0][0] = GetMonData(v4, MON_DATA_58, NULL); - param0->unk_394[v2 - v0][1] = GetMonData(v4, MON_DATA_59, NULL); - param0->unk_394[v2 - v0][2] = GetMonData(v4, MON_DATA_60, NULL); - param0->unk_394[v2 - v0][3] = GetMonData(v4, MON_DATA_61, NULL); + param0->unk_394[v2 - v0][0] = Pokemon_GetValue(v4, MON_DATA_MOVE1_CUR_PP, NULL); + param0->unk_394[v2 - v0][1] = Pokemon_GetValue(v4, MON_DATA_MOVE2_CUR_PP, NULL); + param0->unk_394[v2 - v0][2] = Pokemon_GetValue(v4, MON_DATA_MOVE3_CUR_PP, NULL); + param0->unk_394[v2 - v0][3] = Pokemon_GetValue(v4, MON_DATA_MOVE4_CUR_PP, NULL); } ov104_0223BA24(param0->unk_28); @@ -582,12 +582,12 @@ int ov104_02236D10 (UnkStruct_ov104_0223BA10 * param0) for (v5 = v2; v5 < (v0 + v2); v5++) { v9 = Party_GetPokemonBySlotIndex(param0->unk_28, v5); - if (GetMonData(v9, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v9, MON_DATA_172, NULL) == 0) { continue; } - v3 = GetMonData(v9, MON_DATA_163, NULL); - v4 = GetMonData(v9, MON_DATA_164, NULL); + v3 = Pokemon_GetValue(v9, MON_DATA_CURRENT_HP, NULL); + v4 = Pokemon_GetValue(v9, MON_DATA_MAX_HP, NULL); if (v3 > 0) { v10[0]++; @@ -602,17 +602,17 @@ int ov104_02236D10 (UnkStruct_ov104_0223BA10 * param0) } } - if (GetMonData(v9, MON_DATA_160, NULL) == 0) { + if (Pokemon_GetValue(v9, MON_DATA_160, NULL) == 0) { v10[4]++; } } else { param0->unk_12 = 1; } - v8 += GetMonData(v9, MON_DATA_58, NULL); - v8 += GetMonData(v9, MON_DATA_59, NULL); - v8 += GetMonData(v9, MON_DATA_60, NULL); - v8 += GetMonData(v9, MON_DATA_61, NULL); + v8 += Pokemon_GetValue(v9, MON_DATA_MOVE1_CUR_PP, NULL); + v8 += Pokemon_GetValue(v9, MON_DATA_MOVE2_CUR_PP, NULL); + v8 += Pokemon_GetValue(v9, MON_DATA_MOVE3_CUR_PP, NULL); + v8 += Pokemon_GetValue(v9, MON_DATA_MOVE4_CUR_PP, NULL); } for (v5 = 0; v5 < v1; v5++) { diff --git a/src/overlay104/ov104_02237378.c b/src/overlay104/ov104_02237378.c index ec255ca648..d4103e0173 100644 --- a/src/overlay104/ov104_02237378.c +++ b/src/overlay104/ov104_02237378.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" #include "overlay104/struct_ov104_022320B4_decl.h" @@ -35,7 +35,7 @@ #include "unk_02030494.h" #include "unk_020329E0.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209B6F8.h" #include "unk_0209BA80.h" @@ -186,12 +186,12 @@ BOOL ov104_02237460 (UnkStruct_ov104_0222E930 * param0) for (v1 = 0; v1 < v0; v1++) { v11 = Party_GetPokemonBySlotIndex(v9->unk_70, v1); - v7 = GetMonData(v11, MON_DATA_161, NULL); + v7 = Pokemon_GetValue(v11, MON_DATA_LEVEL, NULL); v7 -= 3; - v6 = sub_02075AD0(GetMonData(v11, MON_DATA_SPECIES, NULL), v7); + v6 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v11, MON_DATA_SPECIES, NULL), v7); - sub_02074B30(v11, 8, &v6); - sub_0207418C(v11); + Pokemon_SetValue(v11, 8, &v6); + Pokemon_CalcLevelAndStats(v11); } } @@ -201,23 +201,23 @@ BOOL ov104_02237460 (UnkStruct_ov104_0222E930 * param0) v11 = Party_GetPokemonBySlotIndex(v9->unk_70, v1); v5 = v9->unk_94[v1]; - sub_02074B30(v11, 164, &v5); - sub_02074B30(v11, 163, &v5); + Pokemon_SetValue(v11, 164, &v5); + Pokemon_SetValue(v11, 163, &v5); v5 = v9->unk_A4[v1]; - sub_02074B30(v11, 165, &v5); + Pokemon_SetValue(v11, 165, &v5); v5 = v9->unk_B4[v1]; - sub_02074B30(v11, 166, &v5); + Pokemon_SetValue(v11, 166, &v5); v5 = v9->unk_C4[v1]; - sub_02074B30(v11, 167, &v5); + Pokemon_SetValue(v11, 167, &v5); v5 = v9->unk_D4[v1]; - sub_02074B30(v11, 168, &v5); + Pokemon_SetValue(v11, 168, &v5); v5 = v9->unk_E4[v1]; - sub_02074B30(v11, 169, &v5); + Pokemon_SetValue(v11, 169, &v5); } sub_020520A4(v10); @@ -266,12 +266,12 @@ static void ov104_02237634 (UnkStruct_ov104_02238240 * param0, UnkStruct_ov104_0 for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param1->unk_70, v0); - param1->unk_94[v0] = GetMonData(v2, MON_DATA_164, NULL); - param1->unk_A4[v0] = GetMonData(v2, MON_DATA_165, NULL); - param1->unk_B4[v0] = GetMonData(v2, MON_DATA_166, NULL); - param1->unk_C4[v0] = GetMonData(v2, MON_DATA_167, NULL); - param1->unk_D4[v0] = GetMonData(v2, MON_DATA_168, NULL); - param1->unk_E4[v0] = GetMonData(v2, MON_DATA_169, NULL); + param1->unk_94[v0] = Pokemon_GetValue(v2, MON_DATA_MAX_HP, NULL); + param1->unk_A4[v0] = Pokemon_GetValue(v2, MON_DATA_ATK, NULL); + param1->unk_B4[v0] = Pokemon_GetValue(v2, MON_DATA_DEF, NULL); + param1->unk_C4[v0] = Pokemon_GetValue(v2, MON_DATA_SPEED, NULL); + param1->unk_D4[v0] = Pokemon_GetValue(v2, MON_DATA_SP_ATK, NULL); + param1->unk_E4[v0] = Pokemon_GetValue(v2, MON_DATA_SP_DEF, NULL); } return; @@ -368,7 +368,7 @@ BOOL ov104_02237748 (UnkStruct_ov104_0222E930 * param0) v1 = Party_GetPokemonBySlotIndex(v3->unk_74, 0); } - *v20 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + *v20 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); break; case 16: *v20 = v3->unk_13; @@ -378,7 +378,7 @@ BOOL ov104_02237748 (UnkStruct_ov104_0222E930 * param0) for (v11 = 0; v11 < 3; v11++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_2C[v11]); - sub_02074B30(v1, 6, &v3->unk_412[v11]); + Pokemon_SetValue(v1, 6, &v3->unk_412[v11]); } break; case 19: diff --git a/src/overlay104/ov104_02237DD8.c b/src/overlay104/ov104_02237DD8.c index c14d0fe84a..3ff31446a9 100644 --- a/src/overlay104/ov104_02237DD8.c +++ b/src/overlay104/ov104_02237DD8.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_020304A0_decl.h" #include "struct_decls/struct_020305B8_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -29,7 +29,7 @@ #include "unk_020507CC.h" #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0222ECE8.h" @@ -206,7 +206,7 @@ UnkStruct_ov104_0223BFFC * ov104_02237DD8 (UnkStruct_021C0794 * param0, u16 para for (v7 = 0; v7 < 3; v7++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v9->unk_04), v9->unk_2C[v7]); - v9->unk_412[v7] = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v9->unk_412[v7] = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); } v2 = Party_GetFromSavedata(v9->unk_04); @@ -218,12 +218,12 @@ UnkStruct_ov104_0223BFFC * ov104_02237DD8 (UnkStruct_021C0794 * param0, u16 para v3 = Party_GetPokemonBySlotIndex(v9->unk_70, v7); v0 = 0; - sub_02074B30(v3, 6, &v0); + Pokemon_SetValue(v3, 6, &v0); - if (GetMonData(v3, MON_DATA_161, NULL) > 50) { - v1 = sub_02075AD0(GetMonData(v3, MON_DATA_SPECIES, NULL), 50); - sub_02074B30(v3, 8, &v1); - sub_0207418C(v3); + if (Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL) > 50) { + v1 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), 50); + Pokemon_SetValue(v3, 8, &v1); + Pokemon_CalcLevelAndStats(v3); } } @@ -303,7 +303,7 @@ static void ov104_02238114 (UnkStruct_ov104_0223BFFC * param0) ov104_0222E330(v4, v6, v5, NULL, v7, 4, 11, 179); - v2 = AllocMonZeroed(11); + v2 = Pokemon_New(11); for (v1 = 0; v1 < 4; v1++) { ov104_0222DF40(&v4[v1], v2, ov104_0223BFFC(param0)); @@ -328,7 +328,7 @@ static void ov104_022381C4 (UnkStruct_ov104_0223BFFC * param0) v3 = Party_GetPokemonBySlotIndex(param0->unk_70, v2); v1 = (u16)sub_0203054C(param0->unk_08, 4, v2, 0, NULL); - sub_02074B30(v3, 6, &v1); + Pokemon_SetValue(v3, 6, &v1); } return; @@ -435,7 +435,7 @@ void ov104_02238278 (UnkStruct_ov104_0223BFFC * param0, u8 param1) for (v0 = 0; v0 < v6; v0++) { v7 = Party_GetPokemonBySlotIndex(param0->unk_70, v0); - v3[0] = GetMonData(v7, MON_DATA_HELD_ITEM, NULL); + v3[0] = Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL); sub_020304CC(param0->unk_08, 4, v0, 0, v3); } @@ -586,17 +586,17 @@ static int ov104_02238584 (UnkStruct_ov104_0223BFFC * param0, Party * param1, Pa for (v3 = 0; v3 < param3; v3++) { v5 = Party_GetPokemonBySlotIndex(param1, v3); - if (GetMonData(v5, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v5, MON_DATA_172, NULL) == 0) { continue; } - v0 = GetMonData(v5, MON_DATA_163, NULL); + v0 = Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL); if (v0 == 0) { v1++; } - if (GetMonData(v5, MON_DATA_160, NULL) != 0) { + if (Pokemon_GetValue(v5, MON_DATA_160, NULL) != 0) { v2++; } } @@ -605,17 +605,17 @@ static int ov104_02238584 (UnkStruct_ov104_0223BFFC * param0, Party * param1, Pa for (v3 = 0; v3 < param3; v3++) { v5 = Party_GetPokemonBySlotIndex(param2, v3); - if (GetMonData(v5, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v5, MON_DATA_172, NULL) == 0) { continue; } - v0 = GetMonData(v5, MON_DATA_163, NULL); + v0 = Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL); if (v0 == 0) { v1++; } - if (GetMonData(v5, MON_DATA_160, NULL) != 0) { + if (Pokemon_GetValue(v5, MON_DATA_160, NULL) != 0) { v2++; } } @@ -793,7 +793,7 @@ void ov104_022388DC (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov104_0223C4CC v3 = Party_GetPokemonBySlotIndex(param0->unk_70, v2); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == 0) { sub_02021CAC(param0->unk_50[v2]->unk_00, 0); } } @@ -803,7 +803,7 @@ void ov104_022388DC (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov104_0223C4CC v3 = Party_GetPokemonBySlotIndex(param0->unk_74, v2); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == 0) { sub_02021CAC(param0->unk_60[v2]->unk_00, 0); } } @@ -848,7 +848,7 @@ void ov104_022389F4 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov104_0223C4CC } v3 = Party_GetPokemonBySlotIndex(param0->unk_70, param3); - v0 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v0 = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); if (param4 == 1) { if (v0 == 0) { @@ -865,7 +865,7 @@ void ov104_022389F4 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov104_0223C4CC } v3 = Party_GetPokemonBySlotIndex(param0->unk_74, param3); - v0 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v0 = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); if (param4 == 1) { if (v0 == 0) { @@ -1111,12 +1111,12 @@ static void ov104_02238BBC (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v3 = Party_GetPokemonBySlotIndex(param1, v0); - v1 = GetMonData(v3, MON_DATA_164, NULL); + v1 = Pokemon_GetValue(v3, MON_DATA_MAX_HP, NULL); v2 = (v1 * 1.2); v2 -= v1; v2 = (v1 - v2); - sub_02074B30(v3, 163, &v2); + Pokemon_SetValue(v3, 163, &v2); } return; @@ -1132,15 +1132,15 @@ static void ov104_02238C18 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v6 = Party_GetPokemonBySlotIndex(param1, v0); - v3 = GetMonData(v6, MON_DATA_177, NULL); - v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_10, NULL); + v3 = Pokemon_GetValue(v6, MON_DATA_177, NULL); + v4 = Pokemon_GetValue(v6, MON_DATA_178, NULL); + v5 = Pokemon_GetValue(v6, MON_DATA_ABILITY, NULL); if ((v3 == 3) || (v4 == 3) || (v3 == 8) || (v4 == 8) || (v5 == 17)) { v1++; } else { v2 = 0x8; - sub_02074B30(v6, 160, &v2); + Pokemon_SetValue(v6, 160, &v2); } } @@ -1161,15 +1161,15 @@ static void ov104_02238C9C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v6 = Party_GetPokemonBySlotIndex(param1, v0); - v3 = GetMonData(v6, MON_DATA_177, NULL); - v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_10, NULL); + v3 = Pokemon_GetValue(v6, MON_DATA_177, NULL); + v4 = Pokemon_GetValue(v6, MON_DATA_178, NULL); + v5 = Pokemon_GetValue(v6, MON_DATA_ABILITY, NULL); if ((v3 == 4) || (v4 == 4) || (v5 == 7)) { v1++; } else { v2 = 0x40; - sub_02074B30(v6, 160, &v2); + Pokemon_SetValue(v6, 160, &v2); } } @@ -1190,15 +1190,15 @@ static void ov104_02238D14 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v6 = Party_GetPokemonBySlotIndex(param1, v0); - v3 = GetMonData(v6, MON_DATA_177, NULL); - v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_10, NULL); + v3 = Pokemon_GetValue(v6, MON_DATA_177, NULL); + v4 = Pokemon_GetValue(v6, MON_DATA_178, NULL); + v5 = Pokemon_GetValue(v6, MON_DATA_ABILITY, NULL); if ((v3 == 10) || (v4 == 10) || (v5 == 41)) { v1++; } else { v2 = 0x10; - sub_02074B30(v6, 160, &v2); + Pokemon_SetValue(v6, 160, &v2); } } @@ -1221,7 +1221,7 @@ static void ov104_02238D8C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v1 = 0; v1 < param2; v1++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - v4 = GetMonData(v5, MON_DATA_10, NULL); + v4 = Pokemon_GetValue(v5, MON_DATA_ABILITY, NULL); if ((v4 == 15) || (v4 == 72)) { v2++; @@ -1231,8 +1231,8 @@ static void ov104_02238D8C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v0 = 0; } } else { - v3 = (sub_0201D2E8() % 4 + 2); - sub_02074B30(v5, 160, &v3); + v3 = (LCRNG_Next() % 4 + 2); + Pokemon_SetValue(v5, 160, &v3); break; } } @@ -1256,9 +1256,9 @@ static void ov104_02238E08 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v1 = 0; v1 < param2; v1++) { v7 = Party_GetPokemonBySlotIndex(param1, v0); - v4 = GetMonData(v7, MON_DATA_177, NULL); - v5 = GetMonData(v7, MON_DATA_178, NULL); - v6 = GetMonData(v7, MON_DATA_10, NULL); + v4 = Pokemon_GetValue(v7, MON_DATA_177, NULL); + v5 = Pokemon_GetValue(v7, MON_DATA_178, NULL); + v6 = Pokemon_GetValue(v7, MON_DATA_ABILITY, NULL); if ((v4 == 15) || (v5 == 15) || (v6 == 40)) { v2++; @@ -1269,7 +1269,7 @@ static void ov104_02238E08 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u } } else { v3 = 0x20; - sub_02074B30(v7, 160, &v3); + Pokemon_SetValue(v7, 160, &v3); break; } @@ -1306,7 +1306,7 @@ static void ov104_02238E9C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - sub_02074B30(v5, 6, &v3); + Pokemon_SetValue(v5, 6, &v3); } return; @@ -1336,7 +1336,7 @@ static void ov104_02238EF8 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - sub_02074B30(v5, 6, &v3); + Pokemon_SetValue(v5, 6, &v3); } return; @@ -1350,7 +1350,7 @@ static void ov104_02238F54 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v3 = Party_GetPokemonBySlotIndex(param1, v0); - v2 = GetMonData(v3, MON_DATA_161, NULL); + v2 = Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL); v2 += 3; if (v2 > 100) { @@ -1358,10 +1358,10 @@ static void ov104_02238F54 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v2 = 100; } - v1 = sub_02075AD0(GetMonData(v3, MON_DATA_SPECIES, NULL), v2); + v1 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), v2); - sub_02074B30(v3, 8, &v1); - sub_0207418C(v3); + Pokemon_SetValue(v3, 8, &v1); + Pokemon_CalcLevelAndStats(v3); } return; @@ -1510,10 +1510,10 @@ void ov104_02239054 (Party * param0, Party * param1, int param2, int param3) Pokemon * v2; v2 = Party_GetPokemonBySlotIndex(param0, param2); - v0 = GetMonData(v2, MON_DATA_HELD_ITEM, NULL); + v0 = Pokemon_GetValue(v2, MON_DATA_HELD_ITEM, NULL); v1 = Party_GetPokemonBySlotIndex(param1, param3); - sub_02074B30(v1, 6, &v0); + Pokemon_SetValue(v1, 6, &v0); return; } diff --git a/src/overlay104/ov104_02239130.c b/src/overlay104/ov104_02239130.c index 9e41373666..b2d9ded3bb 100644 --- a/src/overlay104/ov104_02239130.c +++ b/src/overlay104/ov104_02239130.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_0202440C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" diff --git a/src/overlay104/ov104_0223A0C4.c b/src/overlay104/ov104_0223A0C4.c index fa58f6f7f6..302c783ca0 100644 --- a/src/overlay104/ov104_0223A0C4.c +++ b/src/overlay104/ov104_0223A0C4.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -24,7 +24,7 @@ #include "unk_020329E0.h" #include "unk_02049D08.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0223A0C4.h" @@ -844,7 +844,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 if (param4 == 0) { do { v2 = (sub_0204AEC0(param0) | sub_0204AEC0(param0) << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (sub_02075E38(param3, v2) == 1)); + } while ((v4.unk_0B != Pokemon_GetNatureOf(v2)) || (Pokemon_IsPersonalityShiny(param3, v2) == 1)); param1->unk_10 = v2; } else { @@ -862,7 +862,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { v1++; } } @@ -874,7 +874,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { param1->unk_18_val2[v0] = v1; } } @@ -882,16 +882,16 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 param1->unk_1E_val2 = 0; param1->unk_1F = Unk_020E4C44; - v0 = sub_020759F0(param1->unk_00_val1_0, 25); + v0 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 25); if (v0) { if (param1->unk_10 & 1) { param1->unk_20 = v0; } else { - param1->unk_20 = sub_020759F0(param1->unk_00_val1_0, 24); + param1->unk_20 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 24); } } else { - param1->unk_20 = sub_020759F0(param1->unk_00_val1_0, 24); + param1->unk_20 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 24); } param1->unk_21 = v3; @@ -919,19 +919,19 @@ BattleParams * ov104_0223A580 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223 v3->unk_128 = 18; v3->unk_12C = 18; - v6 = AllocMonZeroed(param0->unk_04); + v6 = Pokemon_New(param0->unk_04); v1 = 50; Party_InitWithCapacity(v3->parties[0], param0->unk_0E); for (v0 = 0; v0 < param0->unk_0E; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v5, param0->unk_2A[v0]), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v5, param0->unk_2A[v0]), v6); - if (GetMonData(v6, MON_DATA_161, NULL) > v1) { - v2 = sub_02075AD0(GetMonData(v6, MON_DATA_SPECIES, NULL), v1); + if (Pokemon_GetValue(v6, MON_DATA_LEVEL, NULL) > v1) { + v2 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL), v1); - sub_02074B30(v6, 8, &v2); - sub_0207418C(v6); + Pokemon_SetValue(v6, 8, &v2); + Pokemon_CalcLevelAndStats(v6); } sub_0205213C(v3, v6, 0); @@ -966,7 +966,7 @@ static void ov104_0223A6AC (BattleParams * param0, UnkStruct_ov104_0223A348 * pa Pokemon * v2; ov104_0222E284(param0, ¶m1->unk_00, param2, param3, param4); - v2 = AllocMonZeroed(param4); + v2 = Pokemon_New(param4); for (v0 = 0; v0 < param2; v0++) { ov104_0222DF40(¶m1->unk_30[v0], v2, 120); diff --git a/src/overlay104/ov104_0223A7F4.c b/src/overlay104/ov104_0223A7F4.c index 50666edf36..6883b9b226 100644 --- a/src/overlay104/ov104_0223A7F4.c +++ b/src/overlay104/ov104_0223A7F4.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0204B184.h" #include "struct_defs/struct_0204B1E8.h" @@ -21,7 +21,7 @@ #include "unk_020329E0.h" #include "unk_02034198.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02096420.h" #include "overlay104/ov104_0222DCE0.h" @@ -126,7 +126,7 @@ static int ov104_0223A7F4 (u8 param0, int param1, int param2) v2 = Unk_ov104_022401FC[param1].unk_00; } - v0 = v2 + (sub_0201D2E8() % v1); + v0 = v2 + (LCRNG_Next() % v1); return v0; } @@ -231,10 +231,10 @@ BOOL ov104_0223A918 (const u16 param0[], const u16 param1[], int param2, int par while (v1 != param3) { if ((v1 >= param3 - v6) && (v7->unk_07 == 1)) { v2 = (v7 + 1)->unk_04 - (v7 + 1)->unk_02; - v3 = (v7 + 1)->unk_04 - (sub_0201D2E8() % (v2 + 1)); + v3 = (v7 + 1)->unk_04 - (LCRNG_Next() % (v2 + 1)); v0 = (v7 + 1)->unk_06; } else { - v3 = v7->unk_04 - (sub_0201D2E8() % (v2 + 1)); + v3 = v7->unk_04 - (LCRNG_Next() % (v2 + 1)); v0 = v7->unk_06; } @@ -366,10 +366,10 @@ BattleParams * ov104_0223ABA0 (UnkStruct_ov104_0223ADA0 * param0, UnkStruct_ov10 v4->unk_12C = 19; Party_InitWithCapacity(v4->parties[0], v2); - v5 = AllocMonZeroed(11); + v5 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_4D4, v0), v5); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_4D4, v0), v5); sub_0205213C(v4, v5, 0); } @@ -386,10 +386,10 @@ BattleParams * ov104_0223ABA0 (UnkStruct_ov104_0223ADA0 * param0, UnkStruct_ov10 v4->trainerData[v0].unk_0C = ov104_0223AEE4(param0); } - v5 = AllocMonZeroed(11); + v5 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_4D8, v0), v5); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_4D8, v0), v5); sub_0205213C(v4, v5, 1); } @@ -409,10 +409,10 @@ BattleParams * ov104_0223ABA0 (UnkStruct_ov104_0223ADA0 * param0, UnkStruct_ov10 ov104_0222E284(v4, &v6, v3, 3, 11); Party_InitWithCapacity(v4->parties[3], ov104_0223AA74(param0->unk_04, 0)); - v5 = AllocMonZeroed(11); + v5 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_4D8, (v3 + v0)), v5); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_4D8, (v3 + v0)), v5); sub_0205213C(v4, v5, 3); } @@ -456,7 +456,7 @@ void ov104_0223ADB0 (UnkStruct_ov104_0223ADA0 * param0) ov104_0222E330(param0->unk_280, param0->unk_254, param0->unk_260, param0->unk_268, NULL, 6, 11, 179); sub_0207A008(param0->unk_4D4); - v1 = AllocMonZeroed(11); + v1 = Pokemon_New(11); for (v0 = 0; v0 < 6; v0++) { ov104_0222DF40(¶m0->unk_280[v0], v1, ov104_0223ADA0(param0)); @@ -482,7 +482,7 @@ void ov104_0223AE30 (UnkStruct_ov104_0223ADA0 * param0) ov104_0222E330(v3, param0->unk_584, param0->unk_590, param0->unk_598, NULL, 2, 11, 179); - v2 = AllocMonZeroed(11); + v2 = Pokemon_New(11); for (v0 = 0; v0 < 2; v0++) { ov104_0222DF40(&v3[v0], v2, ov104_0223ADA0(param0)); diff --git a/src/overlay104/ov104_0223AF58.c b/src/overlay104/ov104_0223AF58.c index 20dc97bce1..22adcc77a6 100644 --- a/src/overlay104/ov104_0223AF58.c +++ b/src/overlay104/ov104_0223AF58.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0204B184.h" @@ -19,7 +19,7 @@ #include "unk_020329E0.h" #include "unk_02034198.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02096420.h" #include "overlay104/ov104_0222DCE0.h" @@ -1376,7 +1376,7 @@ void ov104_0223AF58 (u8 param0, u8 param1, u8 param2, u8 param3, u16 param4[]) v3 = ov104_0223B644(param2); do { - v1 = (sub_0201D2E8() % (8 + 4)); + v1 = (LCRNG_Next() % (8 + 4)); if (v1 < 8) { param4[v2 + v4] = Unk_ov104_0224041C[v3][v1]; @@ -1413,7 +1413,7 @@ void ov104_0223AFB4 (u8 param0, u8 param1, int param2, u8 param3, u8 param4, u16 } do { - v5 = (sub_0201D2E8() % (NELEMS(Unk_ov104_022404BC))); + v5 = (LCRNG_Next() % (NELEMS(Unk_ov104_022404BC))); v1 = v5; while (TRUE) { @@ -1441,7 +1441,7 @@ void ov104_0223AFB4 (u8 param0, u8 param1, int param2, u8 param3, u8 param4, u16 if (v5 == v1) { while (TRUE) { - v6 = (sub_0201D2E8() % 8); + v6 = (LCRNG_Next() % 8); if (v4 != Unk_ov104_0224041C[v8][v6]) { param5[v7 + v3] = Unk_ov104_0224041C[v8][v6]; @@ -1519,7 +1519,7 @@ void ov104_0223B0C8 (u8 param0, u8 param1, u8 param2, u8 param3, u16 param4, u16 } v5 = (v0->unk_02 - v0->unk_00) + 1; - v4 = v0->unk_00 + (sub_0201D2E8() % v5); + v4 = v0->unk_00 + (LCRNG_Next() % v5); v4 -= 1; v6 = v4; @@ -1597,10 +1597,10 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 v8->unk_12C = 22; Party_InitWithCapacity(v8->parties[0], v4); - v9 = AllocMonZeroed(11); + v9 = Pokemon_New(11); for (v1 = 0; v1 < v4; v1++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v13, param0->unk_260[v1]), v9); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v13, param0->unk_260[v1]), v9); sub_0205213C(v8, v9, 0); } @@ -1627,7 +1627,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0223B518(¶m0->unk_290[v6], v7, param0->unk_18[v6], ¶m0->unk_268[v6], v5, 11, 180); - v9 = AllocMonZeroed(11); + v9 = Pokemon_New(11); for (v1 = 0; v1 < v5; v1++) { while (TRUE) { @@ -1638,7 +1638,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0222DF40(¶m0->unk_290[v6], v9, ov104_0223B57C(param0, v7)); - sub_0207803C(v9); + Pokemon_CalcAbility(v9); sub_0205213C(v8, v9, 1); } @@ -1658,7 +1658,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0222E284(v8, &v10, v5, 3, 11); Party_InitWithCapacity(v8->parties[3], v5); - v9 = AllocMonZeroed(11); + v9 = Pokemon_New(11); while (TRUE) { if (ov104_0223B4A4(param0, v6) == 0) { @@ -1668,7 +1668,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0222DF40(¶m0->unk_290[v6], v9, ov104_0223B57C(param0, v7)); - sub_0207803C(v9); + Pokemon_CalcAbility(v9); sub_0205213C(v8, v9, 3); Heap_FreeToHeap(v9); break; @@ -1685,7 +1685,7 @@ static BOOL ov104_0223B4A4 (UnkStruct_ov104_0223B5C0 * param0, u8 param1) param0->unk_290[param1].unk_10 += ((24 + 1) * 10001); } - return sub_02075E38(param0->unk_290[param1].unk_0C, param0->unk_290[param1].unk_10); + return Pokemon_IsPersonalityShiny(param0->unk_290[param1].unk_0C, param0->unk_290[param1].unk_10); } static u32 ov104_0223B4D4 (u8 param0) @@ -1810,7 +1810,7 @@ u8 ov104_0223B5C0 (UnkStruct_ov104_0223B5C0 * param0) v2 = Party_GetFromSavedata(param0->unk_6FC); v3 = Party_GetPokemonBySlotIndex(v2, param0->unk_260[0]); - v1 = GetMonData(v3, MON_DATA_161, NULL); + v1 = Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL); return v1 / 10; } @@ -1869,11 +1869,11 @@ u16 ov104_0223B64C (UnkStruct_ov104_0223B5C0 * param0) v0 = Party_GetFromSavedata(param0->unk_6FC); v1 = Party_GetPokemonBySlotIndex(v0, param0->unk_260[0]); - v2 = GetMonData(v1, MON_DATA_161, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); if (ov104_0223B500(param0->unk_04) == 2) { v1 = Party_GetPokemonBySlotIndex(v0, param0->unk_260[1]); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); if (v2 > v3) { return v2; diff --git a/src/overlay104/ov104_0223B6F4.c b/src/overlay104/ov104_0223B6F4.c index 685d16d879..f6569b1c1c 100644 --- a/src/overlay104/ov104_0223B6F4.c +++ b/src/overlay104/ov104_0223B6F4.c @@ -6,7 +6,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0204B184.h" @@ -25,7 +25,7 @@ #include "unk_02034198.h" #include "unk_02051D8C.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02096420.h" #include "overlay104/ov104_0222DCE0.h" @@ -94,7 +94,7 @@ static int ov104_0223B6F4 (u8 param0, int param1, int param2) v2 = Unk_ov104_02241258[v4].unk_00; } - v0 = v2 + (sub_0201D2E8() % v1); + v0 = v2 + (LCRNG_Next() % v1); return v0; } @@ -189,10 +189,10 @@ BattleParams * ov104_0223B810 (UnkStruct_ov104_0223BA10 * param0, UnkStruct_ov10 v4 = 2; } - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_28, (v4 + v0)), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_28, (v4 + v0)), v6); sub_0205213C(v5, v6, 0); } @@ -210,10 +210,10 @@ BattleParams * ov104_0223B810 (UnkStruct_ov104_0223BA10 * param0, UnkStruct_ov10 v5->trainerData[v0].unk_0C = ov104_0223BB10(param0); } - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_2C, v0), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_2C, v0), v6); sub_0205213C(v5, v6, 1); } @@ -233,10 +233,10 @@ BattleParams * ov104_0223B810 (UnkStruct_ov104_0223BA10 * param0, UnkStruct_ov10 ov104_0222E284(v5, &v7, v3, 3, 11); Party_InitWithCapacity(v5->parties[3], ov104_0223B7DC(param0->unk_10, 0)); - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_2C, (v3 + v0)), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_2C, (v3 + v0)), v6); sub_0205213C(v5, v6, 3); } @@ -290,17 +290,17 @@ void ov104_0223BA24 (Party * param0) for (v0 = 0; v0 < v2; v0++) { v4 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v4, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v4, MON_DATA_172, NULL) == 0) { continue; } - if (GetMonData(v4, MON_DATA_163, NULL) == 0) { + if (Pokemon_GetValue(v4, MON_DATA_CURRENT_HP, NULL) == 0) { v3 = 1; - sub_02074B30(v4, 163, &v3); + Pokemon_SetValue(v4, 163, &v3); } v3 = 0; - sub_02074B30(v4, 160, &v3); + Pokemon_SetValue(v4, 160, &v3); } return; @@ -328,7 +328,7 @@ void ov104_0223BAB8 (UnkStruct_ov104_0223BA10 * param0) sub_0207A008(param0->unk_2C); v2 = ov104_0223B7DC(param0->unk_10, 1); - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { ov104_0222DF40(¶m0->unk_288[v0], v3, ov104_0223BA10(param0)); diff --git a/src/overlay104/ov104_0223BCBC.c b/src/overlay104/ov104_0223BCBC.c index 351dc567ac..a970577ed5 100644 --- a/src/overlay104/ov104_0223BCBC.c +++ b/src/overlay104/ov104_0223BCBC.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0204B184.h" @@ -20,7 +20,7 @@ #include "unk_020329E0.h" #include "unk_02034198.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02096420.h" #include "overlay104/ov104_0222DCE0.h" @@ -97,7 +97,7 @@ static int ov104_0223BCBC (u8 param0, int param1, int param2) v2 = Unk_ov104_02241298[param1].unk_00; } - v0 = v2 + (sub_0201D2E8() % v1); + v0 = v2 + (LCRNG_Next() % v1); return v0; } @@ -202,10 +202,10 @@ BattleParams * ov104_0223BDD8 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov10 v4 = 2; } - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v12, (v4 + v0)), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v12, (v4 + v0)), v6); sub_0205213C(v5, v6, 0); } @@ -222,10 +222,10 @@ BattleParams * ov104_0223BDD8 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov10 v5->trainerData[v0].unk_0C = ov104_0223C0D0(param0); } - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v13, v0), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v13, v0), v6); sub_0205213C(v5, v6, 1); } @@ -245,10 +245,10 @@ BattleParams * ov104_0223BDD8 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov10 ov104_0222E284(v5, &v7, v3, 3, 11); Party_InitWithCapacity(v5->parties[3], ov104_0223BDA4(param0->unk_10, 0)); - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v13, (v3 + v0)), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v13, (v3 + v0)), v6); sub_0205213C(v5, v6, 3); } @@ -319,7 +319,7 @@ void ov104_0223C04C (UnkStruct_ov104_0223BFFC * param0) sub_0207A008(param0->unk_74); v3 = ov104_0223BDA4(param0->unk_10, 1); - v5 = AllocMonZeroed(11); + v5 = Pokemon_New(11); for (v1 = 0; v1 < v3; v1++) { ov104_0222DF40(¶m0->unk_330[v1], v5, ov104_0223BFFC(param0)); @@ -328,7 +328,7 @@ void ov104_0223C04C (UnkStruct_ov104_0223BFFC * param0) v6 = Party_GetPokemonBySlotIndex(param0->unk_74, v1); v0 = 0; - sub_02074B30(v6, 6, &v0); + Pokemon_SetValue(v6, 6, &v0); } Heap_FreeToHeap(v5); diff --git a/src/overlay105/ov105_02241AE0.c b/src/overlay105/ov105_02241AE0.c index 4e373309b3..5efd38bb43 100644 --- a/src/overlay105/ov105_02241AE0.c +++ b/src/overlay105/ov105_02241AE0.c @@ -15,8 +15,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_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" #include "overlay105/struct_ov105_02241FF4_decl.h" @@ -69,7 +68,7 @@ #include "unk_02034198.h" #include "unk_020363E8.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0208C324.h" @@ -2166,12 +2165,12 @@ static BOOL ov105_02244424 (UnkStruct_ov105_02241FF4 * param0) ov104_0222E5D0(param0->unk_20, 0); v1 = Party_GetPokemonBySlotIndex(param0->unk_31C, (2 + param0->unk_324[0])); - v2 = sub_02076B10(v1); + v2 = Pokemon_GetBoxPokemon(v1); ov105_02244F00(param0, 1, v2); v1 = Party_GetPokemonBySlotIndex(param0->unk_320, param0->unk_324[1]); - v2 = sub_02076B10(v1); + v2 = Pokemon_GetBoxPokemon(v1); ov105_02244F00(param0, 2, v2); ov105_0224628C(¶m0->unk_50[5], sub_02027B50(param0->unk_138)); @@ -2771,7 +2770,7 @@ static void ov105_02244FF8 (UnkStruct_ov105_02241FF4 * param0, UnkStruct_0205AA5 u16 v6[(10 + 1)]; v5 = Party_GetPokemonBySlotIndex(param9, param2); - GetMonData(v5, MON_DATA_179, v6); + Pokemon_GetValue(v5, MON_DATA_179, v6); sub_0201ADA4(param1, param7); v4 = Strbuf_Init((10 + 1), 93); @@ -2779,7 +2778,7 @@ static void ov105_02244FF8 (UnkStruct_ov105_02241FF4 * param0, UnkStruct_0205AA5 sub_0201D78C(param1, param8, v4, param3, param4, 0xff, (u32)((((param5) & 0xff) << 16) | (((param6) & 0xff) << 8) | (((param7) & 0xff) << 0)), NULL); v0 = sub_0201C294(param1) - 1; - v1 = GetMonData(v5, MON_DATA_111, NULL); + v1 = Pokemon_GetValue(v5, MON_DATA_GENDER, NULL); v2 = (v1 == 0) ? 25 : 26; v3 = (v1 == 0) ? ((u32)(((7 & 0xff) << 16) | ((8 & 0xff) << 8) | (((0 & 0xff) << 0)))) : ((u32)(((3 & 0xff) << 16) | ((4 & 0xff) << 8) | (((0 & 0xff) << 0)))); @@ -3089,10 +3088,10 @@ static void ov105_022455C4 (UnkStruct_ov105_02241FF4 * param0, u8 param1, Pokemo sub_02007DEC(param0->unk_12C[param1], 6, 0); - v0 = GetMonData(param2, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); - if (sub_020759CC(v0, v1, 28) == 0) { + if (PokemonPersonalData_GetFormValue(v0, v1, 28) == 0) { ov105_02245DB8(param0->unk_12C[param1], param5); } @@ -3172,14 +3171,14 @@ void ov105_022456A8 (UnkStruct_ov105_02241FF4 * param0, u16 param1, u16 param2) for (v0 = 0; v0 < param0->unk_11; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_31C, param0->unk_324[v0]); - param0->unk_33C[v0 + v1] = GetMonData(v2, MON_DATA_SPECIES, NULL); + param0->unk_33C[v0 + v1] = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); } v1 += param0->unk_11; for (v0 = 0; v0 < param0->unk_11; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_31C, param0->unk_324[v0]); - param0->unk_33C[v0 + v1] = GetMonData(v2, MON_DATA_111, NULL); + param0->unk_33C[v0 + v1] = Pokemon_GetValue(v2, MON_DATA_GENDER, NULL); } v1 += param0->unk_11; diff --git a/src/overlay105/ov105_02245CD0.c b/src/overlay105/ov105_02245CD0.c index 9bee59eee9..0ac9752a0c 100644 --- a/src/overlay105/ov105_02245CD0.c +++ b/src/overlay105/ov105_02245CD0.c @@ -3,14 +3,14 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "unk_0200762C.h" #include "gx_layers.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" void ov105_02245CD0(void); void ov105_02245D50(UnkStruct_02007768 * param0); diff --git a/src/overlay106/ov106_02241AE0.c b/src/overlay106/ov106_02241AE0.c index 597eac4a27..a50e0824e0 100644 --- a/src/overlay106/ov106_02241AE0.c +++ b/src/overlay106/ov106_02241AE0.c @@ -14,7 +14,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay106/struct_ov106_02243118_decl.h" @@ -62,7 +62,7 @@ #include "unk_02034198.h" #include "unk_020363E8.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0208C324.h" @@ -1148,7 +1148,7 @@ static void ov106_02242AC4 (UnkStruct_ov106_02243118 * param0, UnkStruct_0205AA5 u16 v6[(10 + 1)]; v5 = Party_GetPokemonBySlotIndex(param0->unk_290, 0); - GetMonData(v5, MON_DATA_179, v6); + Pokemon_GetValue(v5, MON_DATA_179, v6); sub_0201ADA4(param1, param6); v4 = Strbuf_Init((10 + 1), 98); @@ -1565,7 +1565,7 @@ void ov106_0224313C (UnkStruct_ov106_02243118 * param0, u16 param1, u16 param2) param0->unk_2A0[2] = param0->unk_18; v2 = Party_GetPokemonBySlotIndex(param0->unk_290, 0); - param0->unk_2A0[3] = GetMonData(v2, MON_DATA_161, NULL); + param0->unk_2A0[3] = Pokemon_GetValue(v2, MON_DATA_LEVEL, NULL); return; } diff --git a/src/overlay106/ov106_02243310.c b/src/overlay106/ov106_02243310.c index 21d2bd0c5e..0f86c45127 100644 --- a/src/overlay106/ov106_02243310.c +++ b/src/overlay106/ov106_02243310.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021DA864.h" #include "overlay022/struct_ov22_022559F8.h" diff --git a/src/overlay106/ov106_022435FC.c b/src/overlay106/ov106_022435FC.c index c9ff1db132..b7fd384ffd 100644 --- a/src/overlay106/ov106_022435FC.c +++ b/src/overlay106/ov106_022435FC.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay106/struct_ov106_02243650_decl.h" #include "overlay106/struct_ov106_02243310.h" diff --git a/src/overlay107/ov107_02241AE0.c b/src/overlay107/ov107_02241AE0.c index 48b44d6823..06e4c89cd5 100644 --- a/src/overlay107/ov107_02241AE0.c +++ b/src/overlay107/ov107_02241AE0.c @@ -18,8 +18,7 @@ #include "struct_decls/struct_020302DC_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_0203068C_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" #include "overlay107/struct_ov107_02241D6C_decl.h" @@ -71,7 +70,7 @@ #include "unk_020363E8.h" #include "unk_020393C8.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0208C098.h" #include "unk_02096420.h" @@ -873,7 +872,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } if (param0->unk_16 == 0) { - if (GetMonData(v7, MON_DATA_163, NULL) == GetMonData(v7, MON_DATA_164, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL) == Pokemon_GetValue(v7, MON_DATA_MAX_HP, NULL)) { param0->unk_0A = ov107_02243918(param0, 37, 1); param0->unk_08 = 7; break; @@ -885,7 +884,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) break; } } else { - if ((GetMonData(v7, MON_DATA_163, NULL) == GetMonData(v7, MON_DATA_164, NULL)) && (ov107_02245210(v7) == 0)) { + if ((Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL) == Pokemon_GetValue(v7, MON_DATA_MAX_HP, NULL)) && (ov107_02245210(v7) == 0)) { param0->unk_0A = ov107_02243918(param0, 37, 1); param0->unk_08 = 7; break; @@ -1078,7 +1077,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) break; } - if (GetMonData(v7, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL) == 0) { if (ov104_0223BA14(param0->unk_09) == 0) { ov107_02244120(param0); ov107_02249DBC(¶m0->unk_50[6], sub_02027B50(param0->unk_1C8)); @@ -1094,8 +1093,8 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) return 1; } } else { - ov107_02244A8C(param0, 0, sub_02076B10(v7)); - sub_0200B744(param0->unk_24, 1, GetMonData(v7, MON_DATA_HELD_ITEM, NULL)); + ov107_02244A8C(param0, 0, Pokemon_GetBoxPokemon(v7)); + sub_0200B744(param0->unk_24, 1, Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL)); param0->unk_0A = ov107_02243918(param0, 60, 1); param0->unk_08 = 16; } @@ -1499,12 +1498,12 @@ static void ov107_02242F5C (UnkStruct_ov107_02241D6C * param0) v19 = Party_GetPokemonBySlotIndex(param0->unk_43C, v15); - if (GetMonData(v19, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v19, MON_DATA_HELD_ITEM, NULL) == 0) { ov107_02249BAC(param0->unk_404[v15], 0); } - v2 = GetMonData(v19, MON_DATA_163, NULL); - v3 = GetMonData(v19, MON_DATA_164, NULL); + v2 = Pokemon_GetValue(v19, MON_DATA_CURRENT_HP, NULL); + v3 = Pokemon_GetValue(v19, MON_DATA_MAX_HP, NULL); v4 = ov107_022450E8(param0, sub_0208C104(v2, v3, 48)); v5 = ov107_02245114(param0, sub_0208C104(v2, v3, 48)); @@ -2040,7 +2039,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #6 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -2063,7 +2062,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 mov r3, #0x40 bl ov107_02243B5C add r0, r6, #0 - bl sub_02075BCC + bl Pokemon_GetNature add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -2088,7 +2087,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -2113,7 +2112,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa5 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2141,7 +2140,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa6 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2170,7 +2169,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa8 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2198,7 +2197,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa9 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2227,7 +2226,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa7 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2303,11 +2302,11 @@ static void ov107_02243C18 (UnkStruct_ov107_02241D6C * param0, UnkStruct_0205AA5 v2 = 137; v3 = 12 + (param2 * 24); - sub_0200B630(param0->unk_24, param2, GetMonData(param5, param6, NULL)); + sub_0200B630(param0->unk_24, param2, Pokemon_GetValue(param5, param6, NULL)); param0->unk_0A = ov107_02243860(param0, param1, param3, v0, v1, 0xff, 1, 2, 0, 0); - ov107_02244A74(param0, 4, GetMonData(param5, param7, NULL), MON_DATA_3, 0); - ov107_02244A74(param0, 5, GetMonData(param5, param8, NULL), MON_DATA_3, 0); + ov107_02244A74(param0, 4, Pokemon_GetValue(param5, param7, NULL), MON_DATA_3, 0); + ov107_02244A74(param0, 5, Pokemon_GetValue(param5, param8, NULL), MON_DATA_3, 0); param0->unk_0A = ov107_02243890(param0, param1, param4, v2, v3, 0xff, 1, 2, 0, 0, 1); return; @@ -2359,9 +2358,9 @@ static void ov107_02243CFC (UnkStruct_ov107_02241D6C * param0, UnkStruct_0205AA5 v4 = 0; } - sub_0200C5BC(param0->unk_1C4, GetMonData(v7, MON_DATA_163, NULL), 3, 1, param1, v1, v2); + sub_0200C5BC(param0->unk_1C4, Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL), 3, 1, param1, v1, v2); sub_0200C578(param0->unk_1C4, 0, param1, v5, v6); - sub_0200C5BC(param0->unk_1C4, GetMonData(v7, MON_DATA_164, NULL), 3, 0, param1, v3, v4); + sub_0200C5BC(param0->unk_1C4, Pokemon_GetValue(v7, MON_DATA_MAX_HP, NULL), 3, 0, param1, v3, v4); return; } @@ -2409,8 +2408,8 @@ static void ov107_02243DE4 (UnkStruct_ov107_02241D6C * param0, UnkStruct_0205AA5 v4 = 0; } - sub_0200C648(param0->unk_1C4, 1, GetMonData(v7, MON_DATA_161, NULL), 3, 0, param1, v1, v2); - v0 = GetMonData(v7, MON_DATA_111, NULL); + sub_0200C648(param0->unk_1C4, 1, Pokemon_GetValue(v7, MON_DATA_LEVEL, NULL), 3, 0, param1, v1, v2); + v0 = Pokemon_GetValue(v7, MON_DATA_GENDER, NULL); ov107_02244B8C(param0, param1, v3, v4, 0, v0); return; @@ -3346,8 +3345,8 @@ static BOOL ov107_02244E44 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par v5 = ov107_02249C98(param0->unk_14, param1); v6 = Party_GetPokemonBySlotIndex(param0->unk_43C, v5); - v0 = GetMonData(v6, MON_DATA_163, NULL); - v1 = GetMonData(v6, MON_DATA_164, NULL); + v0 = Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL); + v1 = Pokemon_GetValue(v6, MON_DATA_MAX_HP, NULL); v2 = ov107_022450E8(param0, sub_0208C104(v0, v1, 48)); v3 = ov107_02245114(param0, sub_0208C104(v0, v1, 48)); @@ -3380,7 +3379,7 @@ static BOOL ov107_02244E44 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par } if (param0->unk_414 == NULL) { - ov107_02243F4C(param0, ¶m0->unk_50[3], v5, GetMonData(v6, MON_DATA_163, NULL)); + ov107_02243F4C(param0, ¶m0->unk_50[3], v5, Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL)); ov107_02249BEC(param0->unk_420[v5], v3); ov107_02249C1C(param0->unk_3F4[v5], v2); param0->unk_0E_2 = 0; @@ -3568,19 +3567,19 @@ static BOOL ov107_02245210 (Pokemon * param0) v0 = 0; - if (GetMonData(param0, MON_DATA_58, NULL) != GetMonData(param0, MON_DATA_66, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP, NULL) != Pokemon_GetValue(param0, MON_DATA_MOVE1_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_59, NULL) != GetMonData(param0, MON_DATA_67, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_MOVE2_CUR_PP, NULL) != Pokemon_GetValue(param0, MON_DATA_MOVE2_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_60, NULL) != GetMonData(param0, MON_DATA_68, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_MOVE3_CUR_PP, NULL) != Pokemon_GetValue(param0, MON_DATA_MOVE3_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_61, NULL) != GetMonData(param0, MON_DATA_69, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_MOVE4_CUR_PP, NULL) != Pokemon_GetValue(param0, MON_DATA_MOVE4_MAX_PP, NULL)) { v0 = 1; } @@ -3818,7 +3817,7 @@ static void ov107_022454F8 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par v1 = Party_GetPokemonBySlotIndex(param0->unk_43C, ov107_02249C98(param0->unk_14, param1)); v0 = ov107_02249CAC(param0->unk_1CC, param0->unk_09, 0); - ov107_02244A8C(param0, 0, sub_02076B10(v1)); + ov107_02244A8C(param0, 0, Pokemon_GetBoxPokemon(v1)); ov107_02249DBC(¶m0->unk_50[6], sub_02027B50(param0->unk_1C8)); param0->unk_0A = ov107_02243918(param0, Unk_ov107_02249E00[param2 - 1], 1); @@ -3850,10 +3849,10 @@ static void ov107_022455A0 (UnkStruct_ov107_02241D6C * param0, u8 param1, u16 pa v0 = Party_GetPokemonBySlotIndex(param0->unk_43C, ov107_02249C98(param0->unk_14, param1)); - sub_02074B30(v0, 6, ¶m2); + Pokemon_SetValue(v0, 6, ¶m2); ov107_02249BAC(param0->unk_404[ov107_02249C98(param0->unk_14, param1)], 1); - ov107_02244A8C(param0, 0, sub_02076B10(v0)); + ov107_02244A8C(param0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B70C(param0->unk_24, 1, param2); param0->unk_0A = ov107_02243918(param0, 59, 1); @@ -4334,7 +4333,7 @@ static void ov107_02245C00 (UnkStruct_ov107_02241D6C * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_43C, v0); - v2 = ov104_0222E240(GetMonData(v3, MON_DATA_163, NULL), GetMonData(v3, MON_DATA_164, NULL)); + v2 = ov104_0222E240(Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL), Pokemon_GetValue(v3, MON_DATA_MAX_HP, NULL)); if (param0->unk_3F4[v0] != NULL) { ov107_02249C1C(param0->unk_3F4[v0], v2); diff --git a/src/overlay107/ov107_02245EB0.c b/src/overlay107/ov107_02245EB0.c index 629f1b2663..73bc3ff964 100644 --- a/src/overlay107/ov107_02245EB0.c +++ b/src/overlay107/ov107_02245EB0.c @@ -18,8 +18,7 @@ #include "struct_decls/struct_020302DC_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_0203068C_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" #include "overlay107/struct_ov107_02246170_decl.h" @@ -71,7 +70,7 @@ #include "unk_020363E8.h" #include "unk_020393C8.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209BA80.h" #include "overlay104/ov104_0222DCE0.h" @@ -564,7 +563,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) v8 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param0->unk_0D)); ov107_02248BEC(param0); - ov107_02248104(param0, 0, sub_02076B10(v8)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v8)); param0->unk_0A = ov107_022477CC(param0, 20, 1); param0->unk_08 = 15; @@ -577,7 +576,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) v8 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param0->unk_0D)); ov107_02248BEC(param0); - ov107_02248104(param0, 0, sub_02076B10(v8)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v8)); param0->unk_0A = ov107_022477CC(param0, 21, 1); ov107_02247DF0(param0); @@ -1699,7 +1698,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #6 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -1722,7 +1721,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 mov r3, #0x48 bl ov107_02247A14 add r0, r6, #0 - bl sub_02075BCC + bl Pokemon_GetNature add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -1748,7 +1747,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -1774,7 +1773,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa5 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1803,7 +1802,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa6 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1831,7 +1830,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa8 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1860,7 +1859,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa9 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1889,7 +1888,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa7 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1950,7 +1949,7 @@ asm static void ov107_02247AD0 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 ldr r1, [sp, #0x38] mov r2, #0 add r7, r3, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r4, #0x24] add r1, r5, #0 @@ -1979,7 +1978,7 @@ asm static void ov107_02247AD0 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 ldr r0, [sp, #0x34] ldr r1, [sp, #0x3c] mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #0 str r0, [sp] @@ -1990,7 +1989,7 @@ asm static void ov107_02247AD0 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 ldr r0, [sp, #0x34] ldr r1, [sp, #0x40] mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #0 str r0, [sp] @@ -2045,9 +2044,9 @@ static void ov107_02247B78 (UnkStruct_ov107_02246170 * param0, UnkStruct_0205AA5 v3 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v2); - sub_0200C5BC(param0->unk_144, GetMonData(v3, MON_DATA_163, NULL), 3, 1, param1, v0 + (64 * v2), 1); + sub_0200C5BC(param0->unk_144, Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL), 3, 1, param1, v0 + (64 * v2), 1); sub_0200C578(param0->unk_144, 0, param1, 24 + v0 + (64 * v2), 1); - sub_0200C5BC(param0->unk_144, GetMonData(v3, MON_DATA_164, NULL), 3, 0, param1, 32 + v0 + (64 * v2), 1); + sub_0200C5BC(param0->unk_144, Pokemon_GetValue(v3, MON_DATA_MAX_HP, NULL), 3, 0, param1, 32 + v0 + (64 * v2), 1); } sub_0201A9A4(param1); @@ -2076,9 +2075,9 @@ static void ov107_02247C64 (UnkStruct_ov107_02246170 * param0, UnkStruct_0205AA5 for (v4 = 0; v4 < v3; v4++) { v5 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v4); - sub_0200C648(param0->unk_144, 1, GetMonData(v5, MON_DATA_161, NULL), 3, 0, param1, v1 + (64 * v4), 1); + sub_0200C648(param0->unk_144, 1, Pokemon_GetValue(v5, MON_DATA_LEVEL, NULL), 3, 0, param1, v1 + (64 * v4), 1); - v0 = GetMonData(v5, MON_DATA_111, NULL); + v0 = Pokemon_GetValue(v5, MON_DATA_GENDER, NULL); ov107_022481FC(param0, param1, v2 + (64 * v4), 1, 0, v0); } @@ -3098,7 +3097,7 @@ static void ov107_02248A8C (UnkStruct_ov107_02246170 * param0, u8 param1) ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, sub_02076B10(v0)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v0)); param0->unk_0A = ov107_022477CC(param0, 47, 1); @@ -3138,7 +3137,7 @@ static void ov107_02248B50 (UnkStruct_ov107_02246170 * param0, u8 param1) ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, sub_02076B10(v0)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v0)); param0->unk_0A = ov107_022477CC(param0, 70, 1); @@ -3557,7 +3556,7 @@ static void ov107_02249024 (UnkStruct_ov107_02246170 * param0, u8 param1) v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); - ov107_02248104(param0, 0, sub_02076B10(v0)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v0)); param0->unk_0A = ov107_022477CC(param0, 20, 1); param0->unk_3CC[ov107_02249C98(param0->unk_14, param1)] = 1; @@ -3581,7 +3580,7 @@ static void ov107_022490E8 (UnkStruct_ov107_02246170 * param0, u8 param1, u8 par ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v1 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, sub_02076B10(v1)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v1)); if (param2 == 1) { param0->unk_0A = ov107_022477CC(param0, 31, 1); @@ -3598,17 +3597,17 @@ static void ov107_022490E8 (UnkStruct_ov107_02246170 * param0, u8 param1, u8 par } if (param0->unk_3D0[ov107_02249C98(param0->unk_14, param1)] == 0) { - v0 = sub_02075AD0(GetMonData(v1, MON_DATA_SPECIES, NULL), 50); - sub_02074B30(v1, 8, &v0); - sub_0207418C(v1); + v0 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), 50); + Pokemon_SetValue(v1, 8, &v0); + Pokemon_CalcLevelAndStats(v1); } else if (param0->unk_3D0[ov107_02249C98(param0->unk_14, param1)] == 1) { - v0 = sub_02075AD0(GetMonData(v1, MON_DATA_SPECIES, NULL), 55); - sub_02074B30(v1, 8, &v0); - sub_0207418C(v1); + v0 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), 55); + Pokemon_SetValue(v1, 8, &v0); + Pokemon_CalcLevelAndStats(v1); } else { - v0 = sub_02075AD0(GetMonData(v1, MON_DATA_SPECIES, NULL), 45); - sub_02074B30(v1, 8, &v0); - sub_0207418C(v1); + v0 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), 45); + Pokemon_SetValue(v1, 8, &v0); + Pokemon_CalcLevelAndStats(v1); } ov107_02247B78(param0, ¶m0->unk_50[3]); @@ -3655,7 +3654,7 @@ static void ov107_022492A8 (UnkStruct_ov107_02246170 * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v0); - v2 = ov104_0222E240(GetMonData(v3, MON_DATA_163, NULL), GetMonData(v3, MON_DATA_164, NULL)); + v2 = ov104_0222E240(Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL), Pokemon_GetValue(v3, MON_DATA_MAX_HP, NULL)); if (param0->unk_368[v0] != NULL) { ov107_02249C1C(param0->unk_368[v0], v2); diff --git a/src/overlay107/ov107_02249604.c b/src/overlay107/ov107_02249604.c index e717bb005e..93b530ca2d 100644 --- a/src/overlay107/ov107_02249604.c +++ b/src/overlay107/ov107_02249604.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02009DC8_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay019/struct_ov19_021DA864.h" diff --git a/src/overlay107/ov107_02249B1C.c b/src/overlay107/ov107_02249B1C.c index ab4d8856f9..5633d896ee 100644 --- a/src/overlay107/ov107_02249B1C.c +++ b/src/overlay107/ov107_02249B1C.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay107/struct_ov107_02249B8C_decl.h" #include "overlay107/struct_ov107_02249954.h" diff --git a/src/overlay108/ov108_02241AE0.c b/src/overlay108/ov108_02241AE0.c index dea438198b..e089f300e8 100644 --- a/src/overlay108/ov108_02241AE0.c +++ b/src/overlay108/ov108_02241AE0.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_020304A0_decl.h" #include "struct_decls/struct_020305B8_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay108/struct_ov108_02241DB0_decl.h" @@ -60,7 +60,7 @@ #include "unk_02034198.h" #include "unk_020363E8.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209BA80.h" #include "overlay104/ov104_0223BCBC.h" @@ -339,7 +339,7 @@ int ov108_02241AE0 (UnkStruct_020067E8 * param0, int * param1) (*v1->unk_24) = ov108_02242B1C(v1); - v1->unk_16 = (sub_0201D2E8() % (4 * 4)); + v1->unk_16 = (LCRNG_Next() % (4 * 4)); ov108_0224237C(v1); @@ -1108,7 +1108,7 @@ static void ov108_02242964 (UnkStruct_ov108_02241DB0 * param0, int param1) param0->unk_10 = 0; if (param0->unk_0C == 1) { - param0->unk_0D = (sub_0201D2E8() % (4 * 4)); + param0->unk_0D = (LCRNG_Next() % (4 * 4)); } else { param0->unk_0D++; } @@ -1267,7 +1267,7 @@ void ov108_02242AE8 (UnkStruct_ov108_02241DB0 * param0, u16 param1, u16 param2) static u16 ov108_02242B1C (UnkStruct_ov108_02241DB0 * param0) { - return sub_0201D2E8(); + return LCRNG_Next(); } void ov108_02242B24 (int param0, int param1, void * param2, void * param3) @@ -1516,7 +1516,7 @@ static void ov108_02242E10 (UnkStruct_ov108_02241DB0 * param0) v2 += param0->unk_30[2]; } - v4 = (sub_0201D2E8() % v3); + v4 = (LCRNG_Next() % v3); v4 += v2; v6 = v4; v0 = 0; @@ -1561,7 +1561,7 @@ static u8 ov108_02242EF4 (UnkStruct_ov108_02241DB0 * param0, u8 param1) u16 v2; v0 = 0; - v2 = (sub_0201D2E8() % 100); + v2 = (LCRNG_Next() % 100); for (v1 = 0; v1 < 4; v1++) { v0 += Unk_ov108_022436B0[param1][v1]; @@ -1590,7 +1590,7 @@ static void ov108_02242F38 (UnkStruct_ov108_02241DB0 * param0) for (v2 = 0; v2 < v0; v2++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_3C8, v2); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == 0) { ov108_022435A8(param0->unk_39C[v2], 0); } else { ov108_022435A8(param0->unk_39C[v2], 1); @@ -1600,7 +1600,7 @@ static void ov108_02242F38 (UnkStruct_ov108_02241DB0 * param0) for (v2 = 0; v2 < v1; v2++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_3CC, v2); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == 0) { ov108_022435A8(param0->unk_3AC[v2], 0); } else { ov108_022435A8(param0->unk_3AC[v2], 1); diff --git a/src/overlay108/ov108_02243030.c b/src/overlay108/ov108_02243030.c index 45e2f54e2b..ff4a45a9f5 100644 --- a/src/overlay108/ov108_02243030.c +++ b/src/overlay108/ov108_02243030.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay019/struct_ov19_021DA864.h" diff --git a/src/overlay108/ov108_0224351C.c b/src/overlay108/ov108_0224351C.c index 28d86d9948..8237263cec 100644 --- a/src/overlay108/ov108_0224351C.c +++ b/src/overlay108/ov108_0224351C.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay108/struct_ov108_02243594_decl.h" #include "overlay108/struct_ov108_02243030.h" diff --git a/src/overlay109/ov109_021D0D80.c b/src/overlay109/ov109_021D0D80.c index 3718e43051..33580221aa 100644 --- a/src/overlay109/ov109_021D0D80.c +++ b/src/overlay109/ov109_021D0D80.c @@ -15,7 +15,7 @@ #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0200D0F4.h" @@ -74,7 +74,7 @@ #include "unk_02038ED4.h" #include "unk_020393C8.h" #include "unk_02073838.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_02092494.h" @@ -1301,7 +1301,7 @@ static int ov109_021D1918 (UnkStruct_ov109_021D0F70 * param0) BOOL v1; v0 = Unk_ov109_021D5BE4[param0->unk_2C.unk_04][0]; - v0 += sub_0201D2E8() % (Unk_ov109_021D5BE4[param0->unk_2C.unk_04][1] - v0 + 1); + v0 += LCRNG_Next() % (Unk_ov109_021D5BE4[param0->unk_2C.unk_04][1] - v0 + 1); if (v0 < Unk_ov109_021D5BE4[param0->unk_2C.unk_04][0]) { v0 = Unk_ov109_021D5BE4[param0->unk_2C.unk_04][0]; @@ -3536,7 +3536,7 @@ static void ov109_021D3B70 (UnkStruct_ov109_021D0F70 * param0, int param1) v5 = Party_GetPokemonBySlotIndex(v3, v1); sub_0209304C(v5, sub_02032EE8(sub_0203608C()), 5, 0, 11); - sub_020775EC(v5, v4); + Pokemon_Copy(v5, v4); } static int ov109_021D3BC4 (UnkStruct_ov109_021D0F70 * param0) @@ -3607,8 +3607,8 @@ static BOOL ov109_021D3C94 (Party * param0) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v2, MON_DATA_IS_EGG, NULL)) { - if (GetMonData(v2, MON_DATA_3, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_3, NULL)) { return 1; } } diff --git a/src/overlay111/ov111_021D0D80.c b/src/overlay111/ov111_021D0D80.c index 388b822e75..c3b04cfc48 100644 --- a/src/overlay111/ov111_021D0D80.c +++ b/src/overlay111/ov111_021D0D80.c @@ -1715,7 +1715,7 @@ static void ov111_021D26EC (UnkStruct_ov111_021D0F7C * param0) for (v0 = 0; v0 < 2; v0++) { while (TRUE) { - v1 = (sub_0201D2E8() % 9); + v1 = (LCRNG_Next() % 9); if (param0->unk_3C4[v1] == 176) { param0->unk_3C4[v1] = 4; @@ -1732,12 +1732,12 @@ static void ov111_021D271C (UnkStruct_ov111_021D0F7C * param0) int v0, v1, v2, v3, v4; u8 v5; - v5 = (sub_0201D2E8() % 4); + v5 = (LCRNG_Next() % 4); v3 = 0; for (v0 = 0; v0 < 9; v0++) { while (TRUE) { - v4 = (sub_0201D2E8() % 9); + v4 = (LCRNG_Next() % 9); if (param0->unk_3C4[v4] == 176) { v3 = 0; @@ -1813,14 +1813,14 @@ static void ov111_021D27D4 (UnkStruct_ov111_021D0F7C * param0, u8 param1) v2[v0] = 0xff; } - v3 = (sub_0201D2E8() % 4); + v3 = (LCRNG_Next() % 4); for (v0 = 0; v0 < 4; v0++) { if (v0 == v3) { param0->unk_3CE[v0] = 92; } else { while (TRUE) { - v2[v0] = (sub_0201D2E8() % (NELEMS(Unk_ov111_021D37E4))); + v2[v0] = (LCRNG_Next() % (NELEMS(Unk_ov111_021D37E4))); for (v1 = 0; v1 < v0; v1++) { if (v2[v1] == v2[v0]) { diff --git a/src/overlay113/ov113_0225C700.c b/src/overlay113/ov113_0225C700.c index fab8470110..d3dfbdeb7f 100644 --- a/src/overlay113/ov113_0225C700.c +++ b/src/overlay113/ov113_0225C700.c @@ -18,7 +18,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -80,7 +80,7 @@ #include "unk_02025E08.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay066/ov66_0222DDF0.h" #include "overlay066/ov66_02231428.h" @@ -1351,10 +1351,10 @@ static void ov113_0225DD4C (int param0, UnkStruct_021C0794 * param1, UnkStruct_o for (v3 = 0; v3 < v1; v3++) { v2 = Party_GetPokemonBySlotIndex(v0, v3); - param2[v3].unk_02 = GetMonData(v2, MON_DATA_SPECIES_EGG, NULL); - param2[v3].unk_04 = GetMonData(v2, MON_DATA_PERSONALITY, NULL); - param2[v3].unk_08 = GetMonData(v2, MON_DATA_FORM, NULL); - param2[v3].unk_00 = ov113_0226072C(param0, GetMonData(v2, MON_DATA_OT_ID, NULL)); + param2[v3].unk_02 = Pokemon_GetValue(v2, MON_DATA_SPECIES_EGG, NULL); + param2[v3].unk_04 = Pokemon_GetValue(v2, MON_DATA_PERSONALITY, NULL); + param2[v3].unk_08 = Pokemon_GetValue(v2, MON_DATA_FORM, NULL); + param2[v3].unk_00 = ov113_0226072C(param0, Pokemon_GetValue(v2, MON_DATA_OT_ID, NULL)); } } diff --git a/src/overlay113/ov113_0225E368.c b/src/overlay113/ov113_0225E368.c index d8fed3e62b..73ed8d491c 100644 --- a/src/overlay113/ov113_0225E368.c +++ b/src/overlay113/ov113_0225E368.c @@ -32,7 +32,7 @@ #include "unk_0201C970.h" #include "unk_0201D15C.h" #include "unk_02020020.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay113/ov113_0225E368.h" #include "overlay113/ov113_02260620.h" @@ -1036,7 +1036,7 @@ static u8 ov113_0225EEF8 (const UnkStruct_ov113_02260818 * param0) { u8 v0; - v0 = GetNatureFromPersonality(param0->unk_04); + v0 = Pokemon_GetNatureOf(param0->unk_04); return Unk_ov113_02260D30[v0]; } diff --git a/src/overlay114/ov114_0225C700.c b/src/overlay114/ov114_0225C700.c index bff07f3e4c..4e66ec40d1 100644 --- a/src/overlay114/ov114_0225C700.c +++ b/src/overlay114/ov114_0225C700.c @@ -1910,7 +1910,7 @@ static int ov114_0225DA2C (const u8 * param0, u32 param1) u32 v1; int v2; - v0 = sub_0201D35C() % 100; + v0 = MTRNG_Next() % 100; v1 = 0; for (v2 = 0; v2 < param1; v2++) { diff --git a/src/overlay115/ov115_02260CEC.c b/src/overlay115/ov115_02260CEC.c index 0b57c0d78e..2126e2f26c 100644 --- a/src/overlay115/ov115_02260CEC.c +++ b/src/overlay115/ov115_02260CEC.c @@ -2180,7 +2180,7 @@ static void ov115_022626E0 (UnkStruct_ov115_022622F8 * param0, UnkStruct_ov115_0 param0->unk_04.unk_04.z = -param0->unk_04.unk_04.z; if (param4) { - v3 = sub_0201D35C(); + v3 = MTRNG_Next(); if (MATH_ABS(param0->unk_04.unk_04.x) <= MATH_ABS(param0->unk_04.unk_04.z)) { v1 = FX_Mul(param0->unk_04.unk_04.z, (FX32_CONST(1.0f))); diff --git a/src/overlay116/ov116_02260440.c b/src/overlay116/ov116_02260440.c index f7ae810013..293ea15ae4 100644 --- a/src/overlay116/ov116_02260440.c +++ b/src/overlay116/ov116_02260440.c @@ -38,7 +38,7 @@ static void ov116_02260440 (int param0, int param1, void * param2, void * param3 v0->unk_14 = *((UnkStruct_ov116_0226048C *)param2); - sub_0201D2DC(v0->unk_14.unk_04); + LCRNG_SetSeed(v0->unk_14.unk_04); ov116_022617D4(v0); } diff --git a/src/overlay116/ov116_022604C4.c b/src/overlay116/ov116_022604C4.c index bdfbebbb67..f5ab3d2111 100644 --- a/src/overlay116/ov116_022604C4.c +++ b/src/overlay116/ov116_022604C4.c @@ -63,7 +63,7 @@ static u32 ov116_022617E4(UnkStruct_ov116_0226139C * param0); static void ov116_022604C4 (UnkStruct_ov116_0226139C * param0) { - param0->unk_78 = sub_0201D2D0(); + param0->unk_78 = LCRNG_GetSeed(); ov116_022612CC(param0); sub_02017798(ov116_02261794, param0); @@ -680,7 +680,7 @@ static void ov116_022610FC (UnkStruct_ov116_0226139C * param0) v0 = sub_0201E530(); } - sub_0201D2DC(param0->unk_78); + LCRNG_SetSeed(param0->unk_78); ov116_02261F3C(param0->unk_04); ov116_02261DF0(param0->unk_04); diff --git a/src/overlay116/ov116_02262A8C.c b/src/overlay116/ov116_02262A8C.c index 647a8a1287..9276c5e7a4 100644 --- a/src/overlay116/ov116_02262A8C.c +++ b/src/overlay116/ov116_02262A8C.c @@ -1118,18 +1118,18 @@ static const UnkStruct_ov116_02267C88 Unk_ov116_02267C88[][4] = { static inline u32 inline_ov116_02263E20 (void) { - u32 v0 = sub_0201D2D0(); + u32 v0 = LCRNG_GetSeed(); u32 v1; - v1 = sub_0201D2E8(); - sub_0201D2DC(v0); + v1 = LCRNG_Next(); + LCRNG_SetSeed(v0); return v1; } static inline s8 inline_ov116_02263E20_1 (void) { - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { return +1; } else { return -1; diff --git a/src/overlay117/ov117_02263AF0.c b/src/overlay117/ov117_02263AF0.c index 0f7798bba8..b0daccd04a 100644 --- a/src/overlay117/ov117_02263AF0.c +++ b/src/overlay117/ov117_02263AF0.c @@ -454,7 +454,7 @@ static void ov117_02263BA4 (UnkStruct_02018340 * param0, UnkStruct_ov117_02263DA if (param1->unk_10 == 0) { v7 = 0; } else { - v7 = (sub_0201D2E8() & 7) + 1; + v7 = (LCRNG_Next() & 7) + 1; if (param1->unk_28 & 1) { v7 = -v7; @@ -841,11 +841,11 @@ static void ov117_02264214 (UnkStruct_ov117_02261280 * param0, UnkStruct_ov117_0 sub_0200D364(v1, v6); sub_0200D324(v1->unk_00); - v10->unk_04 = sub_0201D2E8() % 0x2000 + 0x2000; - v10->unk_08 = sub_0201D2E8() % 0x4000 + 0x2000; - v10->unk_0C = (sub_0201D2E8() % 360) << FX32_SHIFT; - v10->unk_10 = sub_0201D2E8() % 0x14000 + 0xa000; - v10->unk_14 = sub_0201D2E8() % 15 + 20; + v10->unk_04 = LCRNG_Next() % 0x2000 + 0x2000; + v10->unk_08 = LCRNG_Next() % 0x4000 + 0x2000; + v10->unk_0C = (LCRNG_Next() % 360) << FX32_SHIFT; + v10->unk_10 = LCRNG_Next() % 0x14000 + 0xa000; + v10->unk_14 = LCRNG_Next() % 15 + 20; param1->unk_04[v7].unk_00 = v1; @@ -866,14 +866,14 @@ static void ov117_02264214 (UnkStruct_ov117_02261280 * param0, UnkStruct_ov117_0 } sub_0200D500(v1, 128, 96, ((192 + 160) << FX32_SHIFT)); - sub_0200D364(v1, 28 + sub_0201D2E8() % 3); + sub_0200D364(v1, 28 + LCRNG_Next() % 3); sub_0200D324(v1->unk_00); - v11->unk_04 = sub_0201D2E8() % 0x2000 + 0x2000; - v11->unk_08 = sub_0201D2E8() % 0x4000 + 0x2000; - v11->unk_0C = (sub_0201D2E8() % 360) << FX32_SHIFT; - v11->unk_10 = sub_0201D2E8() % 0x14000 + 0x10000; - v11->unk_14 = sub_0201D2E8() % 15 + 20; + v11->unk_04 = LCRNG_Next() % 0x2000 + 0x2000; + v11->unk_08 = LCRNG_Next() % 0x4000 + 0x2000; + v11->unk_0C = (LCRNG_Next() % 360) << FX32_SHIFT; + v11->unk_10 = LCRNG_Next() % 0x14000 + 0x10000; + v11->unk_14 = LCRNG_Next() % 15 + 20; param1->unk_868[v8].unk_00 = v1; } @@ -894,11 +894,11 @@ static void ov117_02264214 (UnkStruct_ov117_02261280 * param0, UnkStruct_ov117_0 sub_0200D364(v1, 11); sub_0200D324(v1->unk_00); - v12->unk_04 = sub_0201D2E8() % 0x2000 + 0x2000; - v12->unk_08 = sub_0201D2E8() % 0x4000 + 0x2000; - v12->unk_0C = (sub_0201D2E8() % 360) << FX32_SHIFT; - v12->unk_10 = sub_0201D2E8() % 0x14000 + 0x10000; - v12->unk_14 = sub_0201D2E8() % 15 + 20; + v12->unk_04 = LCRNG_Next() % 0x2000 + 0x2000; + v12->unk_08 = LCRNG_Next() % 0x4000 + 0x2000; + v12->unk_0C = (LCRNG_Next() % 360) << FX32_SHIFT; + v12->unk_10 = LCRNG_Next() % 0x14000 + 0x10000; + v12->unk_14 = LCRNG_Next() % 15 + 20; param1->unk_928[v8].unk_00 = v1; } @@ -2456,8 +2456,8 @@ static void ov117_0226639C (UnkStruct_ov117_02261280 * param0, UnkStruct_ov117_0 sub_0200D810(param2->unk_00[v2], GX_OAM_MODE_XLU); sub_0200D3F4(param2->unk_00[v2], 1); - param2->unk_08[v2] = sub_0201D2E8() % 0x1000 + 0x1000; - param2->unk_10[v2] = sub_0201D2E8() % 0x400 + 0x400; + param2->unk_08[v2] = LCRNG_Next() % 0x1000 + 0x1000; + param2->unk_10[v2] = LCRNG_Next() % 0x400 + 0x400; if (v2 & 1) { param2->unk_08[v2] *= -1; diff --git a/src/overlay118/ov118_021D0D80.c b/src/overlay118/ov118_021D0D80.c index 63bd836278..db7e0dee27 100644 --- a/src/overlay118/ov118_021D0D80.c +++ b/src/overlay118/ov118_021D0D80.c @@ -6,7 +6,7 @@ #include "struct_decls/struct_02014014_decl.h" #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207F248.h" @@ -24,7 +24,7 @@ #include "unk_0202419C.h" #include "unk_0202631C.h" #include "unk_0203CC84.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207E0B8.h" #include "unk_020819DC.h" @@ -78,16 +78,16 @@ int ov118_021D0DBC (UnkStruct_0207F248 * param0) switch (v0->unk_00) { case 0: { - v0->unk_0C = GetMonData(v1, MON_DATA_SPECIES, NULL); + v0->unk_0C = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); switch (v0->unk_0C) { case 487: - sub_02077A00(v1); + Pokemon_SetGiratinaForm(v1); v0->unk_08 = 65; v0->unk_10 = 0; break; case 492: - SetShayminForm(v1, 1); + Pokemon_SetShayminForm(v1, 1); v0->unk_08 = 35; v0->unk_10 = 1; break; @@ -146,7 +146,7 @@ int ov118_021D0DBC (UnkStruct_0207F248 * param0) v2 = MessageLoader_GetNewStrbuf(param0->unk_69C, 202); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v2); Strbuf_Free(v2); sub_02082708(param0, 0xffffffff, 1); diff --git a/src/overlay119/ov119_021D0D80.c b/src/overlay119/ov119_021D0D80.c index 0baef6b4c9..4ed6c6daea 100644 --- a/src/overlay119/ov119_021D0D80.c +++ b/src/overlay119/ov119_021D0D80.c @@ -10,8 +10,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02007C10.h" #include "struct_defs/struct_02008A90.h" @@ -53,7 +52,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_02024220.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay119/ov119_021D0D80.h" void ov119_021D0D80(void); @@ -323,7 +322,7 @@ int ov119_021D1158 (UnkStruct_0205AA50 * param0, int param1, Pokemon * param2, i v3 = sub_0200B358(71); v1 = MessageLoader_GetNewStrbuf(v5, param1); v2 = Strbuf_Init(255, 71); - v4 = sub_02076B10(param2); + v4 = Pokemon_GetBoxPokemon(param2); sub_0200B538(v3, 0, v4); sub_0200C388(v3, v2, v1); @@ -759,13 +758,13 @@ void ov119_021D1858 (UnkStruct_ov119_021D0FD0 * param0) int v4; v2 = param0->unk_00->unk_0C.unk_00; - v3 = GetMonData(v2, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); v4 = sub_020765AC(v2, 2); { int v5 = 0; - sub_02074B30(v2, 76, &v5); + Pokemon_SetValue(v2, 76, &v5); } sub_02075EF4(&v0, v2, 2); @@ -779,8 +778,8 @@ void ov119_021D18C0 (UnkStruct_ov119_021D0FD0 * param0) int v0; int v1; - v0 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); - v1 = sub_02075BCC(param0->unk_00->unk_0C.unk_00); + v0 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetNature(param0->unk_00->unk_0C.unk_00); sub_02007B98(param0->unk_70, 1); sub_020789F4(param0->unk_04.unk_3C, param0->unk_04.unk_54, param0->unk_70, v0, 2, 0, 0); diff --git a/src/overlay119/ov119_021D191C.c b/src/overlay119/ov119_021D191C.c index 89e1a561e1..2b2e89dabe 100644 --- a/src/overlay119/ov119_021D191C.c +++ b/src/overlay119/ov119_021D191C.c @@ -17,7 +17,7 @@ #include "unk_0201F834.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay119/ov119_021D0D80.h" #include "overlay119/ov119_021D191C.h" @@ -137,8 +137,8 @@ static BOOL ov119_021D1930 (UnkStruct_ov119_021D0FD0 * param0) int v7; int v8; - v7 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); - v8 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_FORM, NULL); + v7 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); + v8 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_FORM, NULL); sub_02005844(v7, v8); param0->unk_04.unk_08 = ov119_021D1158(¶m0->unk_04.unk_14[0], 0, param0->unk_00->unk_0C.unk_00, param0->unk_04.unk_0C); } @@ -287,8 +287,8 @@ static BOOL ov119_021D1BD0 (UnkStruct_ov119_021D0FD0 * param0) int v3; int v4; - v3 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); - v4 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_FORM, NULL); + v3 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); + v4 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_FORM, NULL); sub_02005844(v3, v4); param0->unk_04.unk_08 = ov119_021D1158(¶m0->unk_04.unk_14[0], 0, param0->unk_00->unk_0C.unk_00, param0->unk_04.unk_0C); } diff --git a/src/party.c b/src/party.c index 2506f0987a..e451998bcc 100644 --- a/src/party.c +++ b/src/party.c @@ -3,12 +3,12 @@ #include "struct_decls/struct_021C0794_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_party.h" #include "heap.h" #include "unk_020244AC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #define PARTY_ASSERT_SLOT(party, slot) { \ @@ -48,7 +48,7 @@ void Party_InitWithCapacity (Party * party, int capacity) party->capacity = capacity; for (i = 0; i < 6; i++) { - ZeroMonData(&party->pokemon[i]); + Pokemon_Init(&party->pokemon[i]); } } @@ -75,7 +75,7 @@ BOOL Party_RemovePokemonBySlotIndex (Party * party, int slot) party->pokemon[i] = party->pokemon[i + 1]; } - ZeroMonData(&party->pokemon[i]); + Pokemon_Init(&party->pokemon[i]); party->currentCount--; return TRUE; @@ -103,7 +103,7 @@ void sub_0207A128 (Party * party, int slot, Pokemon * param2) PARTY_ASSERT_SLOT(party, slot); - v0 = GetMonData(&(party->pokemon[slot]), MON_DATA_172, NULL) - GetMonData(param2, MON_DATA_172, NULL); + v0 = Pokemon_GetValue(&(party->pokemon[slot]), MON_DATA_172, NULL) - Pokemon_GetValue(param2, MON_DATA_172, NULL); party->pokemon[slot] = *param2; party->currentCount += v0; } @@ -136,7 +136,7 @@ BOOL Party_HasSpecies (const Party * party, int species) int i; for (i = 0; i < party->currentCount; i++) { - if (GetMonData((Pokemon *)&party->pokemon[i], MON_DATA_SPECIES, NULL) == species) { + if (Pokemon_GetValue((Pokemon *)&party->pokemon[i], MON_DATA_SPECIES, NULL) == species) { break; } } diff --git a/src/poffin.c b/src/poffin.c index 0e773bd1f6..1172f172c4 100644 --- a/src/poffin.c +++ b/src/poffin.c @@ -88,7 +88,7 @@ static void MakePoffinFoul (Poffin * poffin, u8 param1) v0 = 0; do { - v1 = sub_0201D2E8() % 5; + v1 = LCRNG_Next() % 5; if (poffin->attributes[v1 + 1] != 0) { continue; diff --git a/src/pokemon.c b/src/pokemon.c new file mode 100644 index 0000000000..ddceed7dc4 --- /dev/null +++ b/src/pokemon.c @@ -0,0 +1,4866 @@ +#include +#include + +#include "inlines.h" + +#include "struct_decls/struct_02002F38_decl.h" +#include "struct_decls/struct_02006C24_decl.h" +#include "struct_decls/struct_02007C7C_decl.h" +#include "struct_decls/struct_0200C6E4_decl.h" +#include "struct_decls/struct_0200C704_decl.h" +#include "struct_decls/struct_02015F84_decl.h" +#include "struct_decls/struct_02023790_decl.h" +#include "struct_decls/struct_02025E6C_decl.h" +#include "struct_decls/struct_0202CC84_decl.h" +#include "struct_decls/struct_party_decl.h" + +#include "struct_defs/struct_02007C10.h" +#include "struct_defs/struct_02008A90.h" +#include "struct_defs/struct_0200D0F4.h" +#include "struct_defs/struct_0202818C.h" +#include "struct_defs/struct_0202CA28.h" +#include "pokemon.h" +#include "struct_defs/struct_020789BC.h" +#include "struct_defs/struct_020789F4.h" +#include "struct_defs/struct_02078B40.h" +#include "overlay005/struct_ov5_021DE5D0.h" +#include "overlay104/struct_ov104_0223F9E0.h" + +#include "unk_020021B0.h" +#include "unk_02005474.h" +#include "unk_02006224.h" +#include "narc.h" +#include "message.h" +#include "unk_0200B29C.h" +#include "unk_0200C6E4.h" +#include "unk_0201378C.h" +#include "unk_02015F84.h" +#include "unk_02017038.h" +#include "heap.h" +#include "unk_0201D15C.h" +#include "unk_020218BC.h" +#include "strbuf.h" +#include "unk_02025E68.h" +#include "unk_02028124.h" +#include "unk_0202C9F4.h" +#include "pokemon.h" +#include "move_table.h" +#include "unk_02079170.h" +#include "party.h" +#include "item.h" +#include "unk_02092494.h" + +#include "constants/pokemon.h" +#include "constants/species.h" +#include "constants/items.h" +#include "constants/moves.h" + +// Columns: Spicy, Dry, Sweet, Bitter, Sour +// TODO enum here? +static const s8 sNatureFlavorAffinities[][5] = { + { 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x1, 0x0, 0x0, 0x0, -0x1 }, + { 0x1, 0x0, -0x1, 0x0, 0x0 }, + { 0x1, -0x1, 0x0, 0x0, 0x0 }, + { 0x1, 0x0, 0x0, -0x1, 0x0 }, + { -0x1, 0x0, 0x0, 0x0, 0x1 }, + { 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x0, 0x0, -0x1, 0x0, 0x1 }, + { 0x0, -0x1, 0x0, 0x0, 0x1 }, + { 0x0, 0x0, 0x0, -0x1, 0x1 }, + { -0x1, 0x0, 0x1, 0x0, 0x0 }, + { 0x0, 0x0, 0x1, 0x0, -0x1 }, + { 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x0, -0x1, 0x1, 0x0, 0x0 }, + { 0x0, 0x0, 0x1, -0x1, 0x0 }, + { -0x1, 0x1, 0x0, 0x0, 0x0 }, + { 0x0, 0x1, 0x0, 0x0, -0x1 }, + { 0x0, 0x1, -0x1, 0x0, 0x0 }, + { 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x0, 0x1, 0x0, -0x1, 0x0 }, + { -0x1, 0x0, 0x0, 0x1, 0x0 }, + { 0x0, 0x0, 0x0, 0x1, -0x1 }, + { 0x0, 0x0, -0x1, 0x1, 0x0 }, + { 0x0, -0x1, 0x0, 0x1, 0x0 }, + { 0x0, 0x0, 0x0, 0x0, 0x0 }, +}; + +typedef struct PokemonEvolutionMethod { + u16 type; + u16 param; + u16 targetSpecies; +} PokemonEvolutionMethod; + +typedef struct PokemonEvolutionData { + PokemonEvolutionMethod methods[7]; +} PokemonEvolutionData; + +static enum PokemonDataBlockID { + DATA_BLOCK_A = 0, + DATA_BLOCK_B, + DATA_BLOCK_C, + DATA_BLOCK_D +}; + +static void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +static u32 Pokemon_GetDataInternal(Pokemon *mon, enum PokemonDataParam param, void *dest); +static u32 BoxPokemon_GetDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); +static void Pokemon_SetDataInternal(Pokemon *mon, enum PokemonDataParam param, const void *value); +static void BoxPokemon_SetDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); +static void Pokemon_IncreaseDataInternal(Pokemon *mon, enum PokemonDataParam param, int value); +static void BoxPokemon_IncreaseDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, int value); +static u32 BoxPokemon_GetExpToNextLevel(BoxPokemon *boxMon); +static void Pokemon_LoadExperienceTableOf(int monExpRate, u32 *monExpTable); +static u32 Pokemon_GetExpRateBaseExpAt(int monExpRate, int monLevel); +static u16 Pokemon_GetNatureStatValue(u8 monNature, u16 monStatValue, u8 statType); +static u8 BoxPokemon_IsShiny(BoxPokemon *boxMon); +static inline BOOL Pokemon_InlineIsPersonalityShiny(u32 monOTID, u32 monPersonality); +static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); +static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); +static void BoxPokemon_SetDefaultMoves(BoxPokemon *boxMon); +static u16 BoxPokemon_AddMove(BoxPokemon *boxMon, u16 moveID); +static void BoxPokemon_ReplaceMove(BoxPokemon *boxMon, u16 moveID); +static void BoxPokemon_SetMoveSlot(BoxPokemon *boxMon, u16 moveID, u8 moveSlot); +static BOOL Pokemon_HasMove(Pokemon *mon, u16 moveID); +static s8 BoxPokemon_GetFlavorAffinity(BoxPokemon *boxMon, int flavor); +static BOOL sub_020778E0(BoxPokemon *boxMon); +static BOOL sub_02077900(BoxPokemon *boxMon); +static void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +static void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +static BOOL BoxPokemon_CanLearnTM(BoxPokemon *boxMon, u8 tmID); +static void BoxPokemon_CalcAbility(BoxPokemon *boxMon); +static void PokemonPersonalData_LoadSpecies(int monSpecies, PokemonPersonalData *monPersonalData); +static void PokemonPersonalData_LoadForm(int monSpecies, int monForm, PokemonPersonalData *monPersonalData); +static void PokemonEvolutionData_LoadSpecies(int monSpecies, PokemonEvolutionData *monEvolutionData); +static void Pokemon_EncryptData(void *data, u32 bytes, u32 seed); +static void Pokemon_DecryptData(void *data, u32 bytes, u32 seed); +static u16 Pokemon_GetDataChecksum(void *data, u32 bytes); +static void *BoxPokemon_GetDataBlock(BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID); +static int Pokemon_GetFormNarcIndex(int monSpecies, int monForm); +static inline int Pokemon_GetLowestBitInverse(int num); + +void Pokemon_Init(Pokemon *mon) +{ + MI_CpuClearFast(mon, sizeof(Pokemon)); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); +} + +void BoxPokemon_Init(BoxPokemon *boxMon) +{ + MI_CpuClearFast(boxMon, sizeof(BoxPokemon)); + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); +} + +int Pokemon_StructSize(void) +{ + return sizeof(Pokemon); +} + +Pokemon *Pokemon_New(u32 heapID) +{ + Pokemon * mon = Heap_AllocFromHeap(heapID, sizeof(Pokemon)); + Pokemon_Init(mon); + return mon; +} + +BOOL Pokemon_EnterDecryptionContext(Pokemon *mon) +{ + BOOL wasDecrypted = FALSE; + + if (mon->box.partyDecrypted == FALSE) { + wasDecrypted = TRUE; + GF_ASSERT(mon->box.boxDecrypted == FALSE); + + mon->box.partyDecrypted = TRUE; + mon->box.boxDecrypted = TRUE; + + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + } + + return wasDecrypted; +} + +BOOL Pokemon_ExitDecryptionContext(Pokemon *mon, BOOL encrypt) +{ + BOOL wasEncrypted = FALSE; + + if (mon->box.partyDecrypted == TRUE && encrypt == TRUE) { + wasEncrypted = TRUE; + mon->box.partyDecrypted = FALSE; + mon->box.boxDecrypted = FALSE; + + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + } + + return wasEncrypted; +} + +BOOL BoxPokemon_EnterDecryptionContext(BoxPokemon *boxMon) +{ + BOOL wasDecrypted = FALSE; + + if (boxMon->boxDecrypted == FALSE) { + wasDecrypted = TRUE; + boxMon->boxDecrypted = TRUE; + Pokemon_DecryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + } + + return wasDecrypted; +} + +BOOL BoxPokemon_ExitDecryptionContext(BoxPokemon *boxMon, BOOL encrypt) +{ + BOOL wasEncrypted = FALSE; + + if (boxMon->boxDecrypted == TRUE && encrypt == TRUE) { + wasEncrypted = TRUE; + + boxMon->boxDecrypted = FALSE; + boxMon->checksum = Pokemon_GetDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + } + + return wasEncrypted; +} + +void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +{ + Pokemon_Init(mon); + + sub_02073E18(&mon->box, monSpecies, monLevel, monIVs, useMonPersonalityParam, monPersonality, monOTIDSource, monOTID); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), 0); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_SetValue(mon, MON_DATA_LEVEL, &monLevel); + + UnkStruct_0202818C *v1 = sub_0202818C(0); + + Pokemon_SetValue(mon, MON_DATA_170, v1); + Heap_FreeToHeap(v1); + + u32 zero = 0; + Pokemon_SetValue(mon, MON_DATA_162, &zero); + + UnkStruct_0202CA28 v2; + MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); + + Pokemon_SetValue(mon, MON_DATA_171, &v2); + Pokemon_CalcLevelAndStats(mon); +} + +static void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +{ + BoxPokemon_Init(boxMon); + + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + + if (!useMonPersonalityParam) { + monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); + } + + BoxPokemon_SetValue(boxMon, MON_DATA_PERSONALITY, &monPersonality); + + // TODO likely should be an enum + if (monOTIDSource == 2) { + do { + monOTID = (LCRNG_Next() | (LCRNG_Next() << 16)); + } while (Pokemon_InlineIsPersonalityShiny(monOTID, monPersonality)); + } else if (monOTIDSource != 1) { + monOTID = 0; + } + + BoxPokemon_SetValue(boxMon, MON_DATA_OT_ID, &monOTID); + BoxPokemon_SetValue(boxMon, MON_DATA_LANGUAGE, &Unk_020E4C44); + BoxPokemon_SetValue(boxMon, MON_DATA_SPECIES, &monSpecies); + BoxPokemon_SetValue(boxMon, MON_DATA_179, NULL); + + u32 v1, v2; // TODO rename, these are used/reused as temp vars through the whole function. + + v1 = Pokemon_GetSpeciesBaseExpAt(monSpecies, monLevel); + BoxPokemon_SetValue(boxMon, MON_DATA_EXP, &v1); + + v1 = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_BASE_FRIENDSHIP); + BoxPokemon_SetValue(boxMon, MON_DATA_FRIENDSHIP, &v1); + + BoxPokemon_SetValue(boxMon, MON_DATA_MET_LEVEL, &monLevel); + BoxPokemon_SetValue(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); + + v1 = ITEM_POKE_BALL; + BoxPokemon_SetValue(boxMon, MON_DATA_POKEBALL, &v1); + + if (monIVs < 32) { + BoxPokemon_SetValue(boxMon, MON_DATA_HP_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_ATK_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_DEF_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_SPEED_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_SPATK_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_SPDEF_IV, &monIVs); + } else { + v1 = LCRNG_Next(); + v2 = (v1 & (0x1f << 0)) >> 0; + BoxPokemon_SetValue(boxMon, MON_DATA_HP_IV, &v2); + + v2 = (v1 & (0x1f << 5)) >> 5; + BoxPokemon_SetValue(boxMon, MON_DATA_ATK_IV, &v2); + + v2 = (v1 & (0x1f << 10)) >> 10; + BoxPokemon_SetValue(boxMon, MON_DATA_DEF_IV, &v2); + + v1 = LCRNG_Next(); + v2 = (v1 & (0x1f << 0)) >> 0; + BoxPokemon_SetValue(boxMon, MON_DATA_SPEED_IV, &v2); + + v2 = (v1 & (0x1f << 5)) >> 5; + BoxPokemon_SetValue(boxMon, MON_DATA_SPATK_IV, &v2); + + v2 = (v1 & (0x1f << 10)) >> 10; + BoxPokemon_SetValue(boxMon, MON_DATA_SPDEF_IV, &v2); + } + + v1 = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_ABILITY_1); + v2 = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_ABILITY_2); + + // TODO enum value + if (v2 != 0) { + if (monPersonality & 1) { + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &v2); + } else { + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &v1); + } + } else { + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &v1); + } + + v1 = BoxPokemon_GetGender(boxMon); + + BoxPokemon_SetValue(boxMon, MON_DATA_GENDER, &v1); + BoxPokemon_SetDefaultMoves(boxMon); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); +} + +void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature) +{ + u32 monPersonality; + + do { + monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); + } while (monNature != Pokemon_GetNatureOf(monPersonality)); + + // TODO monOTIDSource probably an enum? + sub_02073D80(mon, monSpecies, monLevel, monIVs, TRUE, monPersonality, 0, 0); +} + +void sub_02074088(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6) +{ + u32 monPersonality; + u16 unownLetter; + + // TODO enum value + if (param6 && param6 < 29) { + do { + monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); + unownLetter = (((monPersonality & 0x3000000) >> 18) | ((monPersonality & 0x30000) >> 12) | ((monPersonality & 0x300) >> 6) | (monPersonality & 0x3)) % 28; + } while (param5 != Pokemon_GetNatureOf(monPersonality) || param4 != Pokemon_GetGenderOf(monSpecies, monPersonality) || unownLetter != param6 - 1); + } else { + monPersonality = sub_02074128(monSpecies, param4, param5); + } + + // TODO monOTIDSource probably an enum? + sub_02073D80(mon, monSpecies, monLevel, monIVs, TRUE, monPersonality, 0, 0); +} + +static enum PokemonGenderRatio { + GENDER_ALWAYS_MALE = 0, + GENDER_ALWAYS_FEMALE = 254, + GENDER_NONE = 255 +}; + +u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2) +{ + u8 monGenderChance = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_GENDER); + + u32 result; + switch (monGenderChance) { + case GENDER_ALWAYS_MALE: + case GENDER_ALWAYS_FEMALE: + case GENDER_NONE: + result = param2; + break; + default: + // TODO gender enum value? + if (param1 == 0) { + result = 25 * ((monGenderChance / 25) + 1); + result += param2; + } else { + result = param2; + } + break; + } + + return result; +} + +void sub_02074158(Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality) +{ + // TODO monOTIDSource probably an enum? + sub_02073D80(mon, monSpecies, monLevel, 0, TRUE, monPersonality, 0, 0); + Pokemon_SetValue(mon, MON_DATA_COMBINED_IVS, &monCombinedIVs); + Pokemon_CalcLevelAndStats(mon); +} + +void Pokemon_CalcLevelAndStats(Pokemon *mon) +{ + BOOL reencrypt = Pokemon_EnterDecryptionContext(mon); + int monLevel = Pokemon_GetLevel(mon); + + Pokemon_SetValue(mon, MON_DATA_LEVEL, &monLevel); + Pokemon_CalcStats(mon); + Pokemon_ExitDecryptionContext(mon, reencrypt); +} + +void Pokemon_CalcStats(Pokemon *mon) +{ + int monMaxHp; + int monCurrentHp; + int monHpIV, monAtkIV, monDefIV, monSpeedIV, monSpAtkIV, monSpDefIV; + int monHpEV, monAtkEV, monDefEV, monSpeedEV, monSpAtkEV, monSpDefEV; + + BOOL reencrypt = Pokemon_EnterDecryptionContext(mon); + + int monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); + + monMaxHp = Pokemon_GetValue(mon, MON_DATA_MAX_HP, NULL); + monCurrentHp = Pokemon_GetValue(mon, MON_DATA_CURRENT_HP, NULL); + + monHpIV = Pokemon_GetValue(mon, MON_DATA_HP_IV, NULL); + monHpEV = Pokemon_GetValue(mon, MON_DATA_HP_EV, NULL); + monAtkIV = Pokemon_GetValue(mon, MON_DATA_ATK_IV, NULL); + monAtkEV = Pokemon_GetValue(mon, MON_DATA_ATK_EV, NULL); + monDefIV = Pokemon_GetValue(mon, MON_DATA_DEF_IV, NULL); + monDefEV = Pokemon_GetValue(mon, MON_DATA_DEF_EV, NULL); + monSpeedIV = Pokemon_GetValue(mon, MON_DATA_SPEED_IV, NULL); + monSpeedEV = Pokemon_GetValue(mon, MON_DATA_SPEED_EV, NULL); + monSpAtkIV = Pokemon_GetValue(mon, MON_DATA_SPATK_IV, NULL); + monSpAtkEV = Pokemon_GetValue(mon, MON_DATA_SPATK_EV, NULL); + monSpDefIV = Pokemon_GetValue(mon, MON_DATA_SPDEF_IV, NULL); + monSpDefEV = Pokemon_GetValue(mon, MON_DATA_SPDEF_EV, NULL); + + int monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + int monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(0, sizeof(PokemonPersonalData)); + + PokemonPersonalData_LoadForm(monSpecies, monForm, monPersonalData); + + int newMaxHp; + if (monSpecies == SPECIES_SHEDINJA) { + newMaxHp = 1; + } else { + newMaxHp = ((2 * monPersonalData->baseHp + monHpIV + monHpEV / 4) * monLevel / 100 + monLevel + 10); + } + + Pokemon_SetValue(mon, MON_DATA_MAX_HP, &newMaxHp); + + // TODO inline func maybe + int newAtk = ((2 * monPersonalData->baseAtk + monAtkIV + monAtkEV / 4) * monLevel / 100 + 5); + newAtk = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newAtk, STAT_ATTACK); + + Pokemon_SetValue(mon, MON_DATA_ATK, &newAtk); + + int newDef = ((2 * monPersonalData->baseDef + monDefIV + monDefEV / 4) * monLevel / 100 + 5); + newDef = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newDef, STAT_DEFENSE); + + Pokemon_SetValue(mon, MON_DATA_DEF, &newDef); + + int newSpeed = ((2 * monPersonalData->baseSpeed + monSpeedIV + monSpeedEV / 4) * monLevel / 100 + 5); + newSpeed = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newSpeed, STAT_SPEED); + + Pokemon_SetValue(mon, MON_DATA_SPEED, &newSpeed); + + int newSpAtk = ((2 * monPersonalData->baseSpAtk + monSpAtkIV + monSpAtkEV / 4) * monLevel / 100 + 5); + newSpAtk = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newSpAtk, STAT_SPECIAL_ATTACK); + + Pokemon_SetValue(mon, MON_DATA_SP_ATK, &newSpAtk); + + int newSpDef = ((2 * monPersonalData->baseSpDef + monSpDefIV + monSpDefEV / 4) * monLevel / 100 + 5); + newSpDef = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newSpDef, STAT_SPECIAL_DEFENSE); + + Pokemon_SetValue(mon, MON_DATA_SP_DEF, &newSpDef); + Heap_FreeToHeap(monPersonalData); + + if (monCurrentHp != 0 || monMaxHp == 0) { + if (monSpecies == SPECIES_SHEDINJA) { + monCurrentHp = 1; + } else if (monCurrentHp == 0) { + monCurrentHp = newMaxHp; + } else { + monCurrentHp += newMaxHp - monMaxHp; + } + } + + if (monCurrentHp) { + Pokemon_SetValue(mon, MON_DATA_CURRENT_HP, &monCurrentHp); + } + + Pokemon_ExitDecryptionContext(mon, reencrypt); +} + +u32 Pokemon_GetValue(Pokemon *mon, enum PokemonDataParam param, void *dest) +{ + if (mon->box.partyDecrypted == FALSE) { + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + + u16 checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + + if (checksum != mon->box.checksum) { + GF_ASSERT(checksum == mon->box.checksum); + mon->box.invalidData = TRUE; + } + } + + u32 result = Pokemon_GetDataInternal(mon, param, dest); + + if (mon->box.partyDecrypted == FALSE) { + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + } + + return result; +} + +static u32 Pokemon_GetDataInternal(Pokemon *mon, enum PokemonDataParam param, void *dest) +{ + u32 result = 0; + + switch (param) { + case MON_DATA_160: + result = mon->party.unk_00; + break; + case MON_DATA_LEVEL: + result = mon->party.level; + break; + case MON_DATA_162: + result = mon->party.unk_05; + break; + case MON_DATA_CURRENT_HP: + result = mon->party.unk_06; + break; + case MON_DATA_MAX_HP: + result = mon->party.unk_08; + break; + case MON_DATA_ATK: + result = mon->party.unk_0A; + break; + case MON_DATA_DEF: + result = mon->party.unk_0C; + break; + case MON_DATA_SPEED: + result = mon->party.unk_0E; + break; + case MON_DATA_SP_ATK: + result = mon->party.unk_10; + break; + case MON_DATA_SP_DEF: + result = mon->party.unk_12; + break; + case MON_DATA_170: + sub_020281A0(&mon->party.unk_14, dest); + result = 1; + break; + case MON_DATA_171: + sub_0202CA10(&mon->party.unk_4C, dest); + result = 1; + break; + default: + result = BoxPokemon_GetDataInternal(&mon->box, param, dest); + break; + } + + return result; +} + +u32 BoxPokemon_GetValue(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) +{ + if (boxMon->boxDecrypted == FALSE) { + Pokemon_DecryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + u16 checksum = Pokemon_GetDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + + if (checksum != boxMon->checksum) { + GF_ASSERT(checksum == boxMon->checksum); + boxMon->invalidData = TRUE; + } + } + + u32 result = BoxPokemon_GetDataInternal(boxMon, param, dest); + + if (boxMon->boxDecrypted == FALSE) { + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + } + + return result; +} + +static u32 BoxPokemon_GetDataInternal (BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) +{ + u32 result = 0; + + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); + + switch (param) { + default: + result = 0; + break; + case MON_DATA_PERSONALITY: + result = boxMon->personality; + break; + case MON_DATA_1: + result = boxMon->partyDecrypted; + break; + case MON_DATA_2: + result = boxMon->boxDecrypted; + break; + case MON_DATA_3: + result = boxMon->invalidData; + break; + case MON_DATA_4: + result = boxMon->checksum; + break; + case MON_DATA_172: + result = (monDataBlockA->species != SPECIES_NONE); + break; + case MON_DATA_173: + if (boxMon->invalidData) { + result = boxMon->invalidData; + } else { + result = monDataBlockB->isEgg; + } + break; + case MON_DATA_SPECIES_EGG: + result = monDataBlockA->species; + + if (result == SPECIES_NONE) { + break; + } else if (monDataBlockB->isEgg || boxMon->invalidData) { + result = SPECIES_EGG; + } + break; + case MON_DATA_LEVEL: + result = Pokemon_GetSpeciesLevelAt(monDataBlockA->species, monDataBlockA->exp); + break; + case MON_DATA_SPECIES: + if (boxMon->invalidData) { + result = SPECIES_EGG; + } else { + result = monDataBlockA->species; + } + break; + case MON_DATA_HELD_ITEM: + result = monDataBlockA->heldItem; + break; + case MON_DATA_OT_ID: + result = monDataBlockA->otID; + break; + case MON_DATA_EXP: + result = monDataBlockA->exp; + break; + case MON_DATA_FRIENDSHIP: + result = monDataBlockA->friendship; + break; + case MON_DATA_ABILITY: + result = monDataBlockA->ability; + break; + case MON_DATA_11: + result = monDataBlockA->unk_0E; + break; + case MON_DATA_LANGUAGE: + result = monDataBlockA->originLanguage; + break; + case MON_DATA_HP_EV: + result = monDataBlockA->hpEV; + break; + case MON_DATA_ATK_EV: + result = monDataBlockA->atkEV; + break; + case MON_DATA_DEF_EV: + result = monDataBlockA->defEV; + break; + case MON_DATA_SPEED_EV: + result = monDataBlockA->speedEV; + break; + case MON_DATA_SPATK_EV: + result = monDataBlockA->spAtkEV; + break; + case MON_DATA_SPDEF_EV: + result = monDataBlockA->spDefEV; + break; + case MON_DATA_COOL: + result = monDataBlockA->cool; + break; + case MON_DATA_BEAUTY: + result = monDataBlockA->beauty; + break; + case MON_DATA_CUTE: + result = monDataBlockA->cute; + break; + case MON_DATA_SMART: + result = monDataBlockA->smart; + break; + case MON_DATA_TOUGH: + result = monDataBlockA->tough; + break; + case MON_DATA_SHEEN: + result = monDataBlockA->sheen; + break; + case MON_DATA_25: + case MON_DATA_26: + case MON_DATA_27: + case MON_DATA_28: + case MON_DATA_29: + case MON_DATA_30: + case MON_DATA_31: + case MON_DATA_32: + case MON_DATA_33: + case MON_DATA_34: + case MON_DATA_35: + case MON_DATA_36: + case MON_DATA_37: + case MON_DATA_38: + case MON_DATA_39: + case MON_DATA_40: + case MON_DATA_41: + case MON_DATA_42: + case MON_DATA_43: + case MON_DATA_44: + case MON_DATA_45: + case MON_DATA_46: + case MON_DATA_47: + case MON_DATA_48: + case MON_DATA_49: + case MON_DATA_50: + case MON_DATA_51: + case MON_DATA_52: + case MON_DATA_53: + { + // TODO is there a way to make this more intuitave? + u64 bitMask = 1; + result = ((monDataBlockA->unk_1C & (bitMask << param - MON_DATA_25)) != 0); + break; + } + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + result = monDataBlockB->moves[param - MON_DATA_MOVE1]; + break; + case MON_DATA_MOVE1_CUR_PP: + case MON_DATA_MOVE2_CUR_PP: + case MON_DATA_MOVE3_CUR_PP: + case MON_DATA_MOVE4_CUR_PP: + result = monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP]; + break; + case MON_DATA_MOVE1_PP_UPS: + case MON_DATA_MOVE2_PP_UPS: + case MON_DATA_MOVE3_PP_UPS: + case MON_DATA_MOVE4_PP_UPS: + result = monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS]; + break; + case MON_DATA_MOVE1_MAX_PP: + case MON_DATA_MOVE2_MAX_PP: + case MON_DATA_MOVE3_MAX_PP: + case MON_DATA_MOVE4_MAX_PP: + result = MoveTable_CalcMaxPP(monDataBlockB->moves[param - MON_DATA_MOVE1_MAX_PP], monDataBlockB->movePPUps[param - MON_DATA_MOVE1_MAX_PP]); + break; + case MON_DATA_HP_IV: + result = monDataBlockB->hpIV; + break; + case MON_DATA_ATK_IV: + result = monDataBlockB->atkIV; + break; + case MON_DATA_DEF_IV: + result = monDataBlockB->defIV; + break; + case MON_DATA_SPEED_IV: + result = monDataBlockB->speedIV; + break; + case MON_DATA_SPATK_IV: + result = monDataBlockB->spAtkIV; + break; + case MON_DATA_SPDEF_IV: + result = monDataBlockB->spDefIV; + break; + case MON_DATA_IS_EGG: + if (boxMon->invalidData) { + result = boxMon->invalidData; + } else { + result = monDataBlockB->isEgg; + } + break; + case MON_DATA_77: + result = monDataBlockB->unk_10_31; + break; + case MON_DATA_78: + case MON_DATA_79: + case MON_DATA_80: + case MON_DATA_81: + case MON_DATA_82: + case MON_DATA_83: + case MON_DATA_84: + case MON_DATA_85: + case MON_DATA_86: + case MON_DATA_87: + case MON_DATA_88: + case MON_DATA_89: + case MON_DATA_90: + case MON_DATA_91: + case MON_DATA_92: + case MON_DATA_93: + case MON_DATA_94: + case MON_DATA_95: + case MON_DATA_96: + case MON_DATA_97: + case MON_DATA_CHAMPION_RIBBON: + case MON_DATA_WINNING_RIBBON: + case MON_DATA_VICTORY_RIBBON: + case MON_DATA_ARTIST_RIBBON: + case MON_DATA_EFFORT_RIBBON: + case MON_DATA_MARINE_RIBBON: + case MON_DATA_LAND_RIBBON: + case MON_DATA_SKY_RIBBON: + case MON_DATA_COUNTRY_RIBBON: + case MON_DATA_NATIONAL_RIBBON: + case MON_DATA_EARTH_RIBBON: + case MON_DATA_WORLD_RIBBON: + { + // TODO is there a way to make this more intuitave? + u64 bitMask = 1; + result = ((monDataBlockB->unk_14 & (bitMask << param - MON_DATA_78)) != 0); + break; + } + case MON_DATA_FATEFUL_ENCOUNTER: + result = monDataBlockB->fatefulEncounter; + break; + case MON_DATA_GENDER: + result = Pokemon_GetGenderOf(monDataBlockA->species, boxMon->personality); + monDataBlockB->gender = result; + boxMon->checksum = Pokemon_GetDataChecksum(&boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + break; + case MON_DATA_FORM: + result = monDataBlockB->form; + break; + case MON_DATA_113: + result = monDataBlockB->unk_19; + break; + case MON_DATA_114: + result = monDataBlockB->unk_1A; + break; + case MON_DATA_117: + if (boxMon->invalidData) { + // TODO confirm this should be SPECIES_BAD_EGG (lines up with checksum failure check but not throughly checked this call tree) + MessageLoader_GetSpeciesName(SPECIES_BAD_EGG, 0, dest); + } else { + u16 *v6 = dest; + + for (result = 0; result < 10; result++) { + v6[result] = monDataBlockC->unk_00[result]; + } + + v6[result] = 0xffff; + } + break; + case MON_DATA_120: + result = monDataBlockB->unk_10_31; + case MON_DATA_119: + if (boxMon->invalidData) { + // TODO confirm this should be SPECIES_BAD_EGG (lines up with checksum failure check but not throughly checked this call tree) + Strbuf *strbuf = sub_0200B32C(SPECIES_BAD_EGG, 0); + + Strbuf_Copy(dest, strbuf); + Strbuf_Free(strbuf); + } else { + Strbuf_CopyChars(dest, monDataBlockC->unk_00); + } + break; + case MON_DATA_121: + result = monDataBlockC->unk_16; + break; + case MON_DATA_MET_GAME: + result = monDataBlockC->originGame; + break; + case MON_DATA_123: + case MON_DATA_124: + case MON_DATA_125: + case MON_DATA_126: + case MON_DATA_127: + case MON_DATA_128: + case MON_DATA_129: + case MON_DATA_130: + case MON_DATA_131: + case MON_DATA_132: + case MON_DATA_133: + case MON_DATA_134: + case MON_DATA_135: + case MON_DATA_136: + case MON_DATA_137: + case MON_DATA_138: + case MON_DATA_139: + case MON_DATA_140: + case MON_DATA_141: + case MON_DATA_142: + case MON_DATA_143: + { + // TODO is there a way to make this more intuitave? + u64 bitMask = 1; + result = ((monDataBlockC->unk_18 & (bitMask << param - MON_DATA_123)) != 0); + break; + } + case MON_DATA_144: + u16 *v8 = dest; + + for (result = 0; result < 7; result++) { + v8[result] = monDataBlockD->unk_00[result]; + } + + v8[result] = 0xffff; + break; + case MON_DATA_145: + Strbuf_CopyChars(dest, monDataBlockD->unk_00); + break; + case MON_DATA_146: + result = monDataBlockD->unk_10; + break; + case MON_DATA_147: + result = monDataBlockD->unk_11; + break; + case MON_DATA_148: + result = monDataBlockD->unk_12; + break; + case MON_DATA_149: + result = monDataBlockD->unk_13; + break; + case MON_DATA_150: + result = monDataBlockD->unk_14; + break; + case MON_DATA_151: + result = monDataBlockD->unk_15; + break; + case MON_DATA_152: + case MON_DATA_115: + // TODO enum value? + if (monDataBlockD->unk_16 == 3002 && monDataBlockB->unk_1C) { + result = monDataBlockB->unk_1C; + } else { + result = monDataBlockD->unk_16; + } + break; + case MON_DATA_153: + case MON_DATA_116: + // TODO enum value? + if (monDataBlockD->unk_18 == 3002 && monDataBlockB->unk_1E) { + result = monDataBlockB->unk_1E; + } else { + result = monDataBlockD->unk_18; + } + break; + case MON_DATA_POKERUS: + result = monDataBlockD->pokerus; + break; + case MON_DATA_POKEBALL: + result = monDataBlockD->pokeball; + break; + case MON_DATA_MET_LEVEL: + result = monDataBlockD->metLevel; + break; + case MON_DATA_OT_GENDER: + result = monDataBlockD->otGender; + break; + case MON_DATA_158: + result = monDataBlockD->unk_1D; + break; + case MON_DATA_159: + result = monDataBlockD->unk_1E; + break; + case MON_DATA_COMBINED_IVS: + result = (monDataBlockB->hpIV << 0) | (monDataBlockB->atkIV << 5) | (monDataBlockB->defIV << 10) | (monDataBlockB->speedIV << 15) | (monDataBlockB->spAtkIV << 20) | (monDataBlockB->spDefIV << 25); + break; + case MON_DATA_176: + if ((monDataBlockA->species == SPECIES_NIDORAN_F || monDataBlockA->species == SPECIES_NIDORAN_M) && monDataBlockB->unk_10_31 == FALSE) { + result = 0; + } else { + result = 1; + } + break; + case MON_DATA_177: + case MON_DATA_178: + // TODO enum values + if (monDataBlockA->species == SPECIES_ARCEUS && monDataBlockA->ability == 121) { + result = Pokemon_GetArceusTypeOf(Item_LoadParam(monDataBlockA->heldItem, 1, 0)); + } else { + result = PokemonPersonalData_GetFormValue(monDataBlockA->species, monDataBlockB->form, 6 + (param - 177)); + } + break; + case MON_DATA_179: + MessageLoader_GetSpeciesName(monDataBlockA->species, 0, dest); + break; + } + + return result; +} + +void Pokemon_SetValue(Pokemon *mon, enum PokemonDataParam param, const void *value) +{ + if (mon->box.partyDecrypted == FALSE) { + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + u16 checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + + if (checksum != mon->box.checksum) { + GF_ASSERT(checksum == mon->box.checksum); + mon->box.invalidData = TRUE; + Pokemon_EncryptData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + return; + } + } + + Pokemon_SetDataInternal(mon, param, value); + + if (mon->box.partyDecrypted == FALSE) { + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + } +} + +static void Pokemon_SetDataInternal(Pokemon *mon, enum PokemonDataParam param, const void *value) +{ + // TODO can this be restructured better? + u32 *u32Value = value; + u16 *u16Value = value; + u8 *u8Value = value; + + switch (param) { + case MON_DATA_160: + mon->party.unk_00 = u32Value[0]; + break; + case MON_DATA_LEVEL: + mon->party.level = u8Value[0]; + break; + case MON_DATA_162: + mon->party.unk_05 = u8Value[0]; + break; + case MON_DATA_CURRENT_HP: + mon->party.unk_06 = u16Value[0]; + break; + case MON_DATA_MAX_HP: + mon->party.unk_08 = u16Value[0]; + break; + case MON_DATA_ATK: + mon->party.unk_0A = u16Value[0]; + break; + case MON_DATA_DEF: + mon->party.unk_0C = u16Value[0]; + break; + case MON_DATA_SPEED: + mon->party.unk_0E = u16Value[0]; + break; + case MON_DATA_SP_ATK: + mon->party.unk_10 = u16Value[0]; + break; + case MON_DATA_SP_DEF: + mon->party.unk_12 = u16Value[0]; + break; + case MON_DATA_170: + sub_020281A0(value, &mon->party.unk_14); + break; + case MON_DATA_171: + sub_0202CA10(value, &mon->party.unk_4C); + break; + default: + BoxPokemon_SetDataInternal(&mon->box, param, value); + break; + } +} + +void BoxPokemon_SetValue(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value) +{ + if (boxMon->boxDecrypted == FALSE) { + Pokemon_DecryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + u16 checksum = Pokemon_GetDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + + if (checksum != boxMon->checksum) { + GF_ASSERT(checksum == boxMon->checksum); + boxMon->invalidData = TRUE; + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + return; + } + } + + BoxPokemon_SetDataInternal(boxMon, param, value); + + if (boxMon->boxDecrypted == FALSE) { + boxMon->checksum = Pokemon_GetDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + } +} + +static void BoxPokemon_SetDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value) +{ + // TODO can this be restructured better? + u32 *u32Value = value; + u16 *u16Value = value; + u8 *u8Value = value; + + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); + + switch (param) { + case MON_DATA_PERSONALITY: + boxMon->personality = u32Value[0]; + break; + case MON_DATA_1: + GF_ASSERT(0); + boxMon->partyDecrypted = u8Value[0]; + break; + case MON_DATA_2: + GF_ASSERT(0); + boxMon->boxDecrypted = u8Value[0]; + break; + case MON_DATA_3: + boxMon->invalidData = u8Value[0]; + break; + case MON_DATA_4: + boxMon->checksum = u16Value[0]; + break; + case MON_DATA_SPECIES: + monDataBlockA->species = u16Value[0]; + break; + case MON_DATA_HELD_ITEM: + monDataBlockA->heldItem = u16Value[0]; + break; + case MON_DATA_OT_ID: + monDataBlockA->otID = u32Value[0]; + break; + case MON_DATA_EXP: + monDataBlockA->exp = u32Value[0]; + break; + case MON_DATA_FRIENDSHIP: + monDataBlockA->friendship = u8Value[0]; + break; + case MON_DATA_ABILITY: + monDataBlockA->ability = u8Value[0]; + break; + case MON_DATA_11: + monDataBlockA->unk_0E = u8Value[0]; + break; + case MON_DATA_LANGUAGE: + monDataBlockA->originLanguage = u8Value[0]; + break; + case MON_DATA_HP_EV: + monDataBlockA->hpEV = u8Value[0]; + break; + case MON_DATA_ATK_EV: + monDataBlockA->atkEV = u8Value[0]; + break; + case MON_DATA_DEF_EV: + monDataBlockA->defEV = u8Value[0]; + break; + case MON_DATA_SPEED_EV: + monDataBlockA->speedEV = u8Value[0]; + break; + case MON_DATA_SPATK_EV: + monDataBlockA->spAtkEV = u8Value[0]; + break; + case MON_DATA_SPDEF_EV: + monDataBlockA->spDefEV = u8Value[0]; + break; + case MON_DATA_COOL: + monDataBlockA->cool = u8Value[0]; + break; + case MON_DATA_BEAUTY: + monDataBlockA->beauty = u8Value[0]; + break; + case MON_DATA_CUTE: + monDataBlockA->cute = u8Value[0]; + break; + case MON_DATA_SMART: + monDataBlockA->smart = u8Value[0]; + break; + case MON_DATA_TOUGH: + monDataBlockA->tough = u8Value[0]; + break; + case MON_DATA_SHEEN: + monDataBlockA->sheen = u8Value[0]; + break; + case MON_DATA_25: + case MON_DATA_26: + case MON_DATA_27: + case MON_DATA_28: + case MON_DATA_29: + case MON_DATA_30: + case MON_DATA_31: + case MON_DATA_32: + case MON_DATA_33: + case MON_DATA_34: + case MON_DATA_35: + case MON_DATA_36: + case MON_DATA_37: + case MON_DATA_38: + case MON_DATA_39: + case MON_DATA_40: + case MON_DATA_41: + case MON_DATA_42: + case MON_DATA_43: + case MON_DATA_44: + case MON_DATA_45: + case MON_DATA_46: + case MON_DATA_47: + case MON_DATA_48: + case MON_DATA_49: + case MON_DATA_50: + case MON_DATA_51: + case MON_DATA_52: + case MON_DATA_53: + { + u64 bitMask = 1 << (param - MON_DATA_25); + + if (u8Value[0]) { + monDataBlockA->unk_1C |= bitMask; + } else { + monDataBlockA->unk_1C &= (bitMask ^ 0xffffffff); + } + break; + } + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + monDataBlockB->moves[param - MON_DATA_MOVE1] = u16Value[0]; + break; + case MON_DATA_MOVE1_CUR_PP: + case MON_DATA_MOVE2_CUR_PP: + case MON_DATA_MOVE3_CUR_PP: + case MON_DATA_MOVE4_CUR_PP: + monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP] = u8Value[0]; + break; + case MON_DATA_MOVE1_PP_UPS: + case MON_DATA_MOVE2_PP_UPS: + case MON_DATA_MOVE3_PP_UPS: + case MON_DATA_MOVE4_PP_UPS: + monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS] = u8Value[0]; + break; + case MON_DATA_MOVE1_MAX_PP: + case MON_DATA_MOVE2_MAX_PP: + case MON_DATA_MOVE3_MAX_PP: + case MON_DATA_MOVE4_MAX_PP: + break; + case MON_DATA_HP_IV: + monDataBlockB->hpIV = u8Value[0]; + break; + case MON_DATA_ATK_IV: + monDataBlockB->atkIV = u8Value[0]; + break; + case MON_DATA_DEF_IV: + monDataBlockB->defIV = u8Value[0]; + break; + case MON_DATA_SPEED_IV: + monDataBlockB->speedIV = u8Value[0]; + break; + case MON_DATA_SPATK_IV: + monDataBlockB->spAtkIV = u8Value[0]; + break; + case MON_DATA_SPDEF_IV: + monDataBlockB->spDefIV = u8Value[0]; + break; + case MON_DATA_IS_EGG: + monDataBlockB->isEgg = u8Value[0]; + break; + case MON_DATA_77: + monDataBlockB->unk_10_31 = u8Value[0]; + break; + case MON_DATA_78: + case MON_DATA_79: + case MON_DATA_80: + case MON_DATA_81: + case MON_DATA_82: + case MON_DATA_83: + case MON_DATA_84: + case MON_DATA_85: + case MON_DATA_86: + case MON_DATA_87: + case MON_DATA_88: + case MON_DATA_89: + case MON_DATA_90: + case MON_DATA_91: + case MON_DATA_92: + case MON_DATA_93: + case MON_DATA_94: + case MON_DATA_95: + case MON_DATA_96: + case MON_DATA_97: + case MON_DATA_CHAMPION_RIBBON: + case MON_DATA_WINNING_RIBBON: + case MON_DATA_VICTORY_RIBBON: + case MON_DATA_ARTIST_RIBBON: + case MON_DATA_EFFORT_RIBBON: + case MON_DATA_MARINE_RIBBON: + case MON_DATA_LAND_RIBBON: + case MON_DATA_SKY_RIBBON: + case MON_DATA_COUNTRY_RIBBON: + case MON_DATA_NATIONAL_RIBBON: + case MON_DATA_EARTH_RIBBON: + case MON_DATA_WORLD_RIBBON: + { + u64 bitMask = 1 << (param - MON_DATA_78); + + if (u8Value[0]) { + monDataBlockB->unk_14 |= bitMask; + } else { + monDataBlockB->unk_14 &= (bitMask ^ 0xffffffff); + } + break; + } + case MON_DATA_FATEFUL_ENCOUNTER: + monDataBlockB->fatefulEncounter = u8Value[0]; + break; + case MON_DATA_GENDER: + monDataBlockB->gender = Pokemon_GetGenderOf(monDataBlockA->species, boxMon->personality); + break; + case MON_DATA_FORM: + monDataBlockB->form = u8Value[0]; + break; + case MON_DATA_113: + monDataBlockB->unk_19 = u8Value[0]; + break; + case MON_DATA_114: + monDataBlockB->unk_1A = u16Value[0]; + break; + case MON_DATA_118: + { + u16 v10[10 + 1]; + + MessageLoader_GetSpeciesName(monDataBlockA->species, 0, &v10[0]); + monDataBlockB->unk_10_31 = sub_0200220C(v10, &u16Value[0]); + } + case MON_DATA_117: + for (int i = 0; i < NELEMS(monDataBlockC->unk_00); i++) { + monDataBlockC->unk_00[i] = u16Value[i]; + } + break; + case MON_DATA_120: + { + u16 v11[10 + 1]; + u16 v12[10 + 1]; + + MessageLoader_GetSpeciesName(monDataBlockA->species, 0, &v11[0]); + Strbuf_ToChars(value, &v12[0], NELEMS(v12)); + + monDataBlockB->unk_10_31 = sub_0200220C(v11, v12); + } + case MON_DATA_119: + Strbuf_ToChars(value, monDataBlockC->unk_00, NELEMS(monDataBlockC->unk_00)); + break; + case MON_DATA_121: + monDataBlockC->unk_16 = u8Value[0]; + break; + case MON_DATA_MET_GAME: + monDataBlockC->originGame = u8Value[0]; + break; + case MON_DATA_123: + case MON_DATA_124: + case MON_DATA_125: + case MON_DATA_126: + case MON_DATA_127: + case MON_DATA_128: + case MON_DATA_129: + case MON_DATA_130: + case MON_DATA_131: + case MON_DATA_132: + case MON_DATA_133: + case MON_DATA_134: + case MON_DATA_135: + case MON_DATA_136: + case MON_DATA_137: + case MON_DATA_138: + case MON_DATA_139: + case MON_DATA_140: + case MON_DATA_141: + case MON_DATA_142: + case MON_DATA_143: + { + u64 bitMask = 1 << (param - MON_DATA_123); + + if (u8Value[0]) { + monDataBlockC->unk_18 |= bitMask; + } else { + monDataBlockC->unk_18 &= (bitMask ^ 0xffffffffffffffff); + } + break; + } + case MON_DATA_144: + for (int i = 0; i < NELEMS(monDataBlockD->unk_00); i++) { + monDataBlockD->unk_00[i] = u16Value[i]; + } + break; + case MON_DATA_145: + Strbuf_ToChars(value, monDataBlockD->unk_00, NELEMS(monDataBlockD->unk_00)); + break; + case MON_DATA_146: + monDataBlockD->unk_10 = u8Value[0]; + break; + case MON_DATA_147: + monDataBlockD->unk_11 = u8Value[0]; + break; + case MON_DATA_148: + monDataBlockD->unk_12 = u8Value[0]; + break; + case MON_DATA_149: + monDataBlockD->unk_13 = u8Value[0]; + break; + case MON_DATA_150: + monDataBlockD->unk_14 = u8Value[0]; + break; + case MON_DATA_151: + monDataBlockD->unk_15 = u8Value[0]; + break; + case MON_DATA_152: + case MON_DATA_115: + if (u16Value[0] == 0 || sub_0201708C(u16Value[0]) == 1) { + monDataBlockD->unk_16 = u16Value[0]; + monDataBlockB->unk_1C = u16Value[0]; + } else { + monDataBlockD->unk_16 = 3002; + monDataBlockB->unk_1C = u16Value[0]; + } + break; + case MON_DATA_153: + case MON_DATA_116: + if (u16Value[0] == 0 || sub_0201708C(u16Value[0]) == 1) { + monDataBlockD->unk_18 = u16Value[0]; + monDataBlockB->unk_1E = u16Value[0]; + } else { + monDataBlockD->unk_18 = 3002; + monDataBlockB->unk_1E = u16Value[0]; + } + break; + case MON_DATA_POKERUS: + monDataBlockD->pokerus = u8Value[0]; + break; + case MON_DATA_POKEBALL: + monDataBlockD->pokeball = u8Value[0]; + break; + case MON_DATA_MET_LEVEL: + monDataBlockD->metLevel = u8Value[0]; + break; + case MON_DATA_OT_GENDER: + monDataBlockD->otGender = u8Value[0]; + break; + case MON_DATA_158: + monDataBlockD->unk_1D = u8Value[0]; + break; + case MON_DATA_159: + monDataBlockD->unk_1E = u16Value[0]; + break; + case MON_DATA_COMBINED_IVS: + monDataBlockB->hpIV = (u32Value[0] >> 0) & 0x1f; + monDataBlockB->atkIV = (u32Value[0] >> 5) & 0x1f; + monDataBlockB->defIV = (u32Value[0] >> 10) & 0x1f; + monDataBlockB->speedIV = (u32Value[0] >> 15) & 0x1f; + monDataBlockB->spAtkIV = (u32Value[0] >> 20) & 0x1f; + monDataBlockB->spDefIV = (u32Value[0] >> 25) & 0x1f; + break; + case MON_DATA_176: + case MON_DATA_177: + case MON_DATA_178: + break; + case MON_DATA_179: + { + Strbuf *strbuf; + + strbuf = sub_0200B32C(monDataBlockA->species, 0); + + Strbuf_ToChars(strbuf, monDataBlockC->unk_00, NELEMS(monDataBlockC->unk_00)); + Strbuf_Free(strbuf); + } + break; + } +} + +void Pokemon_IncreaseValue(Pokemon *mon, enum PokemonDataParam param, int value) +{ + if (mon->box.partyDecrypted == FALSE) { + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + + u16 checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + + if (checksum != mon->box.checksum) { + GF_ASSERT(checksum == mon->box.checksum); + Pokemon_EncryptData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + return; + } + } + + Pokemon_IncreaseDataInternal(mon, param, value); + + if (mon->box.partyDecrypted == FALSE) { + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + } +} + +static void Pokemon_IncreaseDataInternal(Pokemon *mon, enum PokemonDataParam param, int value) +{ + switch (param) { + case MON_DATA_CURRENT_HP: + if (mon->party.unk_06 + value > mon->party.unk_08) { + mon->party.unk_06 = mon->party.unk_08; + } else { + mon->party.unk_06 += value; + } + break; + case MON_DATA_160: + case MON_DATA_LEVEL: + case MON_DATA_162: + case MON_DATA_MAX_HP: + case MON_DATA_ATK: + case MON_DATA_DEF: + case MON_DATA_SPEED: + case MON_DATA_SP_ATK: + case MON_DATA_SP_DEF: + case MON_DATA_170: + GF_ASSERT(0); + break; + default: + BoxPokemon_IncreaseDataInternal(&mon->box, param, value); + break; + } +} + +static void BoxPokemon_IncreaseDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, int value) +{ + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); + + // TODO consts for various maximum values? + switch (param) { + case MON_DATA_EXP: + if (monDataBlockA->exp + value > Pokemon_GetSpeciesBaseExpAt(monDataBlockA->species, 100)) { + monDataBlockA->exp = Pokemon_GetSpeciesBaseExpAt(monDataBlockA->species, 100); + } else { + monDataBlockA->exp += value; + } + break; + case MON_DATA_FRIENDSHIP: + int newValue; + + newValue = monDataBlockA->friendship; + + if (newValue + value > 255) { + newValue = 255; + } + + if (newValue + value < 0) { + newValue = 0; + } else { + newValue += value; + } + + monDataBlockA->friendship = newValue; + break; + case MON_DATA_HP_EV: + monDataBlockA->hpEV += value; + break; + case MON_DATA_ATK_EV: + monDataBlockA->atkEV += value; + break; + case MON_DATA_DEF_EV: + monDataBlockA->defEV += value; + break; + case MON_DATA_SPEED_EV: + monDataBlockA->speedEV += value; + break; + case MON_DATA_SPATK_EV: + monDataBlockA->spAtkEV += value; + break; + case MON_DATA_SPDEF_EV: + monDataBlockA->spDefEV += value; + break; + case MON_DATA_COOL: + if (monDataBlockA->cool + value > 255) { + monDataBlockA->cool = 255; + } else { + monDataBlockA->cool += value; + } + break; + case MON_DATA_BEAUTY: + if (monDataBlockA->beauty + value > 255) { + monDataBlockA->beauty = 255; + } else { + monDataBlockA->beauty += value; + } + break; + case MON_DATA_CUTE: + if (monDataBlockA->cute + value > 255) { + monDataBlockA->cute = 255; + } else { + monDataBlockA->cute += value; + } + break; + case MON_DATA_SMART: + if (monDataBlockA->smart + value > 255) { + monDataBlockA->smart = 255; + } else { + monDataBlockA->smart += value; + } + break; + case MON_DATA_TOUGH: + if (monDataBlockA->tough + value > 255) { + monDataBlockA->tough = 255; + } else { + monDataBlockA->tough += value; + } + break; + case MON_DATA_SHEEN: + if (monDataBlockA->sheen + value > 255) { + monDataBlockA->sheen = 255; + } else { + monDataBlockA->sheen += value; + } + break; + case MON_DATA_MOVE1_CUR_PP: + case MON_DATA_MOVE2_CUR_PP: + case MON_DATA_MOVE3_CUR_PP: + case MON_DATA_MOVE4_CUR_PP: + if (monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP] + value > MoveTable_CalcMaxPP(monDataBlockB->moves[param - MON_DATA_MOVE1_CUR_PP], monDataBlockB->movePPUps[param - MON_DATA_MOVE1_CUR_PP])) { + monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP] = MoveTable_CalcMaxPP(monDataBlockB->moves[param - MON_DATA_MOVE1_CUR_PP], monDataBlockB->movePPUps[param - MON_DATA_MOVE1_CUR_PP]); + } else { + monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP] += value; + } + break; + case MON_DATA_MOVE1_PP_UPS: + case MON_DATA_MOVE2_PP_UPS: + case MON_DATA_MOVE3_PP_UPS: + case MON_DATA_MOVE4_PP_UPS: + if (monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS] + value > 3) { + monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS] = 3; + } else { + monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS] += value; + } + break; + case MON_DATA_MOVE1_MAX_PP: + case MON_DATA_MOVE2_MAX_PP: + case MON_DATA_MOVE3_MAX_PP: + case MON_DATA_MOVE4_MAX_PP: + break; + case MON_DATA_HP_IV: + if (monDataBlockB->hpIV + value > 31) { + monDataBlockB->hpIV = 31; + } else { + monDataBlockB->hpIV += value; + } + break; + case MON_DATA_ATK_IV: + if (monDataBlockB->atkIV + value > 31) { + monDataBlockB->atkIV = 31; + } else { + monDataBlockB->atkIV += value; + } + break; + case MON_DATA_DEF_IV: + if (monDataBlockB->defIV + value > 31) { + monDataBlockB->defIV = 31; + } else { + monDataBlockB->defIV += value; + } + break; + case MON_DATA_SPEED_IV: + if (monDataBlockB->speedIV + value > 31) { + monDataBlockB->speedIV = 31; + } else { + monDataBlockB->speedIV += value; + } + break; + case MON_DATA_SPATK_IV: + if (monDataBlockB->spAtkIV + value > 31) { + monDataBlockB->spAtkIV = 31; + } else { + monDataBlockB->spAtkIV += value; + } + break; + case MON_DATA_SPDEF_IV: + if (monDataBlockB->spDefIV + value > 31) { + monDataBlockB->spDefIV = 31; + } else { + monDataBlockB->spDefIV += value; + } + break; + case MON_DATA_PERSONALITY: + case MON_DATA_1: + case MON_DATA_2: + case MON_DATA_4: + case MON_DATA_SPECIES: + case MON_DATA_HELD_ITEM: + case MON_DATA_OT_ID: + case MON_DATA_ABILITY: + case MON_DATA_11: + case MON_DATA_LANGUAGE: + case MON_DATA_25: + case MON_DATA_26: + case MON_DATA_27: + case MON_DATA_28: + case MON_DATA_29: + case MON_DATA_30: + case MON_DATA_31: + case MON_DATA_32: + case MON_DATA_33: + case MON_DATA_34: + case MON_DATA_35: + case MON_DATA_36: + case MON_DATA_37: + case MON_DATA_38: + case MON_DATA_39: + case MON_DATA_40: + case MON_DATA_41: + case MON_DATA_42: + case MON_DATA_43: + case MON_DATA_44: + case MON_DATA_45: + case MON_DATA_46: + case MON_DATA_47: + case MON_DATA_48: + case MON_DATA_49: + case MON_DATA_50: + case MON_DATA_51: + case MON_DATA_52: + case MON_DATA_53: + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + case MON_DATA_IS_EGG: + case MON_DATA_77: + case MON_DATA_78: + case MON_DATA_79: + case MON_DATA_80: + case MON_DATA_81: + case MON_DATA_82: + case MON_DATA_83: + case MON_DATA_84: + case MON_DATA_85: + case MON_DATA_86: + case MON_DATA_87: + case MON_DATA_88: + case MON_DATA_89: + case MON_DATA_90: + case MON_DATA_91: + case MON_DATA_92: + case MON_DATA_93: + case MON_DATA_94: + case MON_DATA_95: + case MON_DATA_96: + case MON_DATA_97: + case MON_DATA_CHAMPION_RIBBON: + case MON_DATA_WINNING_RIBBON: + case MON_DATA_VICTORY_RIBBON: + case MON_DATA_ARTIST_RIBBON: + case MON_DATA_EFFORT_RIBBON: + case MON_DATA_MARINE_RIBBON: + case MON_DATA_LAND_RIBBON: + case MON_DATA_SKY_RIBBON: + case MON_DATA_COUNTRY_RIBBON: + case MON_DATA_NATIONAL_RIBBON: + case MON_DATA_EARTH_RIBBON: + case MON_DATA_WORLD_RIBBON: + case MON_DATA_FATEFUL_ENCOUNTER: + case MON_DATA_GENDER: + case MON_DATA_FORM: + case MON_DATA_113: + case MON_DATA_114: + case MON_DATA_117: + case MON_DATA_119: + case MON_DATA_120: + case MON_DATA_121: + case MON_DATA_MET_GAME: + case MON_DATA_123: + case MON_DATA_124: + case MON_DATA_125: + case MON_DATA_126: + case MON_DATA_127: + case MON_DATA_128: + case MON_DATA_129: + case MON_DATA_130: + case MON_DATA_131: + case MON_DATA_132: + case MON_DATA_133: + case MON_DATA_134: + case MON_DATA_135: + case MON_DATA_136: + case MON_DATA_137: + case MON_DATA_138: + case MON_DATA_139: + case MON_DATA_140: + case MON_DATA_141: + case MON_DATA_142: + case MON_DATA_143: + case MON_DATA_144: + case MON_DATA_145: + case MON_DATA_146: + case MON_DATA_147: + case MON_DATA_148: + case MON_DATA_149: + case MON_DATA_150: + case MON_DATA_151: + case MON_DATA_152: + case MON_DATA_153: + case MON_DATA_POKERUS: + case MON_DATA_POKEBALL: + case MON_DATA_MET_LEVEL: + case MON_DATA_OT_GENDER: + case MON_DATA_158: + case MON_DATA_159: + case MON_DATA_COMBINED_IVS: + case MON_DATA_176: + case MON_DATA_177: + case MON_DATA_178: + case MON_DATA_179: + default: + GF_ASSERT(0); + break; + } +} + +PokemonPersonalData *PokemonPersonalData_FromMonForm(int monSpecies, int monForm, int heapID) +{ + PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); + PokemonPersonalData_LoadForm(monSpecies, monForm, monPersonalData); + + return monPersonalData; +} + +PokemonPersonalData *PokemonPersonalData_FromMonSpecies(int monSpecies, int heapID) +{ + PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); + PokemonPersonalData_LoadSpecies(monSpecies, monPersonalData); + + return monPersonalData; +} + +u32 PokemonPersonalData_GetValue(PokemonPersonalData *monPersonalData, enum PokemonPersonalDataParam param) +{ + u32 result; + + GF_ASSERT(monPersonalData); + + switch (param) { + case MON_DATA_PERSONAL_BASE_HP: + result = monPersonalData->baseHp; + break; + case MON_DATA_PERSONAL_BASE_ATK: + result = monPersonalData->baseAtk; + break; + case MON_DATA_PERSONAL_BASE_DEF: + result = monPersonalData->baseDef; + break; + case MON_DATA_PERSONAL_BASE_SPEED: + result = monPersonalData->baseSpeed; + break; + case MON_DATA_PERSONAL_BASE_SP_ATK: + result = monPersonalData->baseSpAtk; + break; + case MON_DATA_PERSONAL_BASE_SP_DEF: + result = monPersonalData->baseSpDef; + break; + case MON_DATA_PERSONAL_TYPE_1: + result = monPersonalData->type1; + break; + case MON_DATA_PERSONAL_TYPE_2: + result = monPersonalData->type2; + break; + case MON_DATA_PERSONAL_CATCH_RATE: + result = monPersonalData->catchRate; + break; + case MON_DATA_PERSONAL_BASE_EXP: + result = monPersonalData->baseExp; + break; + case MON_DATA_PERSONAL_EV_HP_YIELD: + result = monPersonalData->evHpYield; + break; + case MON_DATA_PERSONAL_EV_ATK_YIELD: + result = monPersonalData->evAtkYield; + break; + case MON_DATA_PERSONAL_EV_DEF_YIELD: + result = monPersonalData->evDefYield; + break; + case MON_DATA_PERSONAL_EV_SPEED_YIELD: + result = monPersonalData->evSpeedYield; + break; + case MON_DATA_PERSONAL_EV_SP_ATK_YIELD: + result = monPersonalData->evSpAtkYield; + break; + case MON_DATA_PERSONAL_EV_SP_DEF_YIELD: + result = monPersonalData->evSpDefYield; + break; + case MON_DATA_PERSONAL_ITEM1: + result = monPersonalData->item1; + break; + case MON_DATA_PERSONAL_ITEM2: + result = monPersonalData->item2; + break; + case MON_DATA_PERSONAL_GENDER: + result = monPersonalData->gender; + break; + case MON_DATA_PERSONAL_HATCH_CYCLE: + result = monPersonalData->hatchCycles; + break; + case MON_DATA_PERSONAL_BASE_FRIENDSHIP: + result = monPersonalData->baseFriendship; + break; + case MON_DATA_PERSONAL_EXP_RATE: + result = monPersonalData->expRate; + break; + case MON_DATA_PERSONAL_EGG_GROUP_1: + result = monPersonalData->eggGroup1; + break; + case MON_DATA_PERSONAL_EGG_GROUP_2: + result = monPersonalData->eggGroup2; + break; + case MON_DATA_PERSONAL_ABILITY_1: + result = monPersonalData->ability1; + break; + case MON_DATA_PERSONAL_ABILITY_2: + result = monPersonalData->ability2; + break; + case MON_DATA_PERSONAL_GREAT_MARSH_FLEE_RATE: + result = monPersonalData->greatMarshFleeRate; + break; + case MON_DATA_PERSONAL_COLOR: + result = monPersonalData->color; + break; + case MON_DATA_PERSONAL_INVERSE: + result = monPersonalData->inverse; + break; + case MON_DATA_PERSONAL_TM_LEARNSET_MASK_1: + result = monPersonalData->tmLearnsetMask1; + break; + case MON_DATA_PERSONAL_TM_LEARNSET_MASK_2: + result = monPersonalData->tmLearnsetMask2; + break; + case MON_DATA_PERSONAL_TM_LEARNSET_MASK_3: + result = monPersonalData->tmLearnsetMask3; + break; + case MON_DATA_PERSONAL_TM_LEARNSET_MASK_4: + result = monPersonalData->tmLearnsetMask4; + break; + } + + return result; +} + +void PokemonPersonalData_Free(PokemonPersonalData *monPersonalData) +{ + GF_ASSERT(monPersonalData); + Heap_FreeToHeap(monPersonalData); +} + +u32 PokemonPersonalData_GetFormValue(int monSpecies, int monForm, enum PokemonPersonalDataParam param) +{ + monSpecies = Pokemon_GetFormNarcIndex(monSpecies, monForm); + + PokemonPersonalData *monPersonalData = PokemonPersonalData_FromMonSpecies(monSpecies, 0); + u32 result = PokemonPersonalData_GetValue(monPersonalData, param); + + PokemonPersonalData_Free(monPersonalData); + + return result; +} + +u32 PokemonPersonalData_GetSpeciesValue(int monSpecies, enum PokemonPersonalDataParam param) +{ + PokemonPersonalData *monPersonalData = PokemonPersonalData_FromMonSpecies(monSpecies, 0); + u32 result = PokemonPersonalData_GetValue(monPersonalData, param); + + PokemonPersonalData_Free(monPersonalData); + + return result; +} + +u8 Pokemon_GetPercentToNextLevel(Pokemon *mon) +{ + BOOL recrypt = Pokemon_EnterDecryptionContext(mon); + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u8 monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); + u32 monCurrentLevelExp = Pokemon_GetSpeciesBaseExpAt(monSpecies, monLevel); + u32 monNextLevelExp = Pokemon_GetSpeciesBaseExpAt(monSpecies, monLevel + 1); + u32 monExp = Pokemon_GetValue(mon, MON_DATA_EXP, NULL); + + Pokemon_ExitDecryptionContext(mon, recrypt); + u8 monPercentToNextLevel = ((monExp - monCurrentLevelExp) * 100) / (monNextLevelExp - monCurrentLevelExp); + + return monPercentToNextLevel; +} + +u32 Pokemon_GetExpToNextLevel(Pokemon *mon) +{ + return BoxPokemon_GetExpToNextLevel(&mon->box); +} + +static u32 BoxPokemon_GetExpToNextLevel(BoxPokemon *boxMon) +{ + u16 monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + u16 monNextlevel = BoxPokemon_GetLevel(boxMon) + 1; + u32 monExp = BoxPokemon_GetValue(boxMon, MON_DATA_EXP, NULL); + + return Pokemon_GetSpeciesBaseExpAt(monSpecies, monNextlevel) - monExp; +} + +u32 Pokemon_GetCurrentLevelBaseExp(Pokemon *mon) +{ + return Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL), Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL)); +} + +u32 Pokemon_GetSpeciesBaseExpAt(int monSpecies, int monLevel) +{ + return Pokemon_GetExpRateBaseExpAt(PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_EXP_RATE), monLevel); +} + +static void Pokemon_LoadExperienceTableOf(int monExpRate, u32 *monExpTable) +{ + // TODO const for table size, enum for exp rate types + GF_ASSERT(monExpRate < 8); + NARC_ReadWholeMemberByIndexPair(monExpTable, NARC_INDEX_POKETOOL__PERSONAL__PL_GROWTBL, monExpRate); +} + +static u32 Pokemon_GetExpRateBaseExpAt(int monExpRate, int monLevel) +{ + // TODO const for table size, enum for exp rate types + GF_ASSERT(monExpRate < 8); + GF_ASSERT(monLevel <= 101); + + u32 *expTable = Heap_AllocFromHeap(0, 101 * 4); + Pokemon_LoadExperienceTableOf(monExpRate, expTable); + + u32 result = expTable[monLevel]; + Heap_FreeToHeap(expTable); + + return result; +} + +u32 Pokemon_GetLevel(Pokemon *mon) +{ + return BoxPokemon_GetLevel(&mon->box); +} + +u32 BoxPokemon_GetLevel(BoxPokemon *boxMon) +{ + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + u32 monExp = BoxPokemon_GetValue(boxMon, MON_DATA_EXP, NULL); + + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); + + return Pokemon_GetSpeciesLevelAt(monSpecies, monExp); +} + +u32 Pokemon_GetSpeciesLevelAt(u16 monSpecies, u32 monExp) +{ + PokemonPersonalData *monPersonalData = PokemonPersonalData_FromMonSpecies(monSpecies, 0); + + u32 monLevel = PokemonPersonalData_GetLevelAt(monPersonalData, monSpecies, monExp); + PokemonPersonalData_Free(monPersonalData); + + return monLevel; +} + +u32 PokemonPersonalData_GetLevelAt(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp) +{ + // TODO const for table size, enum for exp rate types + static u32 monExpTable[101]; + + int monExpRate = PokemonPersonalData_GetValue(monPersonalData, MON_DATA_PERSONAL_EXP_RATE); + Pokemon_LoadExperienceTableOf(monExpRate, monExpTable); + + int i; + for (i = 1; i < 101; i++) { + if (monExpTable[i] > monExp) { + break; + } + } + + return i - 1; +} + +u8 Pokemon_GetNature(Pokemon *mon) +{ + return BoxPokemon_GetNature(&mon->box); +} + +u8 BoxPokemon_GetNature(BoxPokemon *boxMon) +{ + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); + + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); + + return Pokemon_GetNatureOf(monPersonality); +} + +u8 Pokemon_GetNatureOf(u32 monPersonality) +{ + // TODO const for nature count/enum for natures? + return (u8)(monPersonality % 25); +} + +// TODO enum here? +static const s8 sNatureStatAffinities[][5] = { + {0, 0, 0, 0, 0}, + {1, -1, 0, 0, 0}, + {1, 0, -1, 0, 0}, + {1, 0, 0, -1, 0}, + {1, 0, 0, 0, -1}, + {-1, 1, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 1, -1, 0, 0}, + {0, 1, 0, -1, 0}, + {0, 1, 0, 0, -1}, + {-1, 0, 1, 0, 0}, + {0, -1, 1, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 1, -1, 0}, + {0, 0, 1, 0, -1}, + {-1, 0, 0, 1, 0}, + {0, -1, 0, 1, 0}, + {0, 0, -1, 1, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 1, -1}, + {-1, 0, 0, 0, 1}, + {0, -1, 0, 0, 1}, + {0, 0, -1, 0, 1}, + {0, 0, 0, -1, 1}, + {0, 0, 0, 0, 0} +}; + +static u16 Pokemon_GetNatureStatValue(u8 monNature, u16 monStatValue, u8 statType) +{ + if (statType < STAT_ATTACK || statType > STAT_SPECIAL_DEFENSE) { + return monStatValue; + } + + u16 result; + switch (sNatureStatAffinities[monNature][statType - 1]) { + case 1: + result = monStatValue * 110; + result /= 100; + break; + case -1: + result = monStatValue * 90; + result /= 100; + break; + default: + result = monStatValue; + break; + } + + return result; +} + +s8 Pokemon_GetStatAffinityOf(u8 monNature, u8 statType) +{ + return sNatureStatAffinities[monNature][statType - 1]; +} + +static const s8 Unk_020F05A0[][3] = { + {5, 3, 2}, // ??? in overlay16 + {5, 3, 2}, // unused? + {1, 1, 0}, // unused? + {3, 2, 1}, // ??? in overlay16 + {1, 1, 0}, // ??? in unk_02084B70.c + {1, 1, 1}, // walking 128 steps + {-1, -1, -1}, // fainting (opponent level difference < 30) + {-5, -5, -10}, // letting poison tick mon to 1HP + {-5, -5, -10}, // fainting (opponent level difference >= 30) + {3, 2, 1} // ??? in unk_020933F8.c +}; + +void sub_02075C74(Pokemon *mon, u8 param1, u16 param2) +{ + // TODO enum value (param 1 is method of gaining/losing friendship) + if (param1 == 5) { + if (LCRNG_Next() & 1) { + return; + } + } + + u16 monSpeciesEgg = Pokemon_GetValue(mon, MON_DATA_SPECIES_EGG, NULL); + + if (monSpeciesEgg == SPECIES_NONE || monSpeciesEgg == SPECIES_EGG) { + return; + } + + u16 monHeldItem = Pokemon_GetValue(mon, MON_DATA_HELD_ITEM, NULL); + u8 itemHoldEffect = Item_LoadParam(monHeldItem, ITEM_PARAM_HOLD_EFFECT, 0); + u8 v4 = 0; + s16 monFriendship = Pokemon_GetValue(mon, MON_DATA_FRIENDSHIP, NULL); + + if (monFriendship >= 100) { + v4++; + } + + if (monFriendship >= 200) { + v4++; + } + + s8 v3 = Unk_020F05A0[param1][v4]; + + if (v3 > 0 && Pokemon_GetValue(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) { + v3++; + } + + if (v3 > 0 && Pokemon_GetValue(mon, MON_DATA_152, NULL) == param2) { + v3++; + } + + if (v3 > 0) { + if (itemHoldEffect == HOLD_EFFECT_FRIENDSHIP_UP) { + v3 = v3 * 150 / 100; + } + } + + monFriendship += v3; + + if (monFriendship < 0) { + monFriendship = 0; + } + + if (monFriendship > 255) { + monFriendship = 255; + } + + Pokemon_SetValue(mon, MON_DATA_FRIENDSHIP, &monFriendship); +} + +u8 Pokemon_GetGender(Pokemon *mon) +{ + return BoxPokemon_GetGender(&mon->box); +} + +u8 BoxPokemon_GetGender(BoxPokemon *boxMon) +{ + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + u16 monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); + + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); + + return Pokemon_GetGenderOf(monSpecies, monPersonality); +} + +u8 Pokemon_GetGenderOf(u16 monSpecies, u32 monPersonality) +{ + PokemonPersonalData *monPersonalData = PokemonPersonalData_FromMonSpecies(monSpecies, 0); + u8 monGender = PokemonPersonalData_GetGenderOf(monPersonalData, monSpecies, monPersonality); + + PokemonPersonalData_Free(monPersonalData); + + return monGender; +} + +u8 PokemonPersonalData_GetGenderOf(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality) +{ + u8 monGender = PokemonPersonalData_GetValue(monPersonalData, MON_DATA_PERSONAL_GENDER); + + switch (monGender) { + case GENDER_ALWAYS_MALE: + return MON_GENDER_MALE; + case GENDER_ALWAYS_FEMALE: + return MON_GENDER_FEMALE; + case GENDER_NONE: + return MON_GENDER_NONE; + } + + if (monGender > (monPersonality & 0xff)) { + return MON_GENDER_FEMALE; + } else { + return MON_GENDER_MALE; + } +} + +// TODO return bool +u8 Pokemon_IsShiny(Pokemon *mon) +{ + return BoxPokemon_IsShiny(&mon->box); +} + +// TODO return bool +static u8 BoxPokemon_IsShiny(BoxPokemon *boxMon) +{ + u32 monOTID = BoxPokemon_GetValue(boxMon, MON_DATA_OT_ID, NULL); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); + + return Pokemon_IsPersonalityShiny(monOTID, monPersonality); +} + +static inline BOOL Pokemon_InlineIsPersonalityShiny(u32 monOTID, u32 monPersonality) { + return (((monOTID & 0xffff0000) >> 16) ^ (monOTID & 0xffff) ^ ((monPersonality & 0xffff0000) >> 16) ^ (monPersonality & 0xffff)) < 8; +} + +u8 Pokemon_IsPersonalityShiny(u32 monOTID, u32 monPersonality) +{ + return Pokemon_InlineIsPersonalityShiny(monOTID, monPersonality); +} + +u32 sub_02075E64(u32 param0) +{ + param0 = (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff)) >> 3; + + int i; + u16 v2 = LCRNG_Next() & 0x7; + u16 v3 = LCRNG_Next() & 0x7; + + for (i = 0; i < 13; i++) { + if (param0 & Pokemon_GetFlagMaskOf(i)) { + if (LCRNG_Next() & 1) { + v2 |= Pokemon_GetFlagMaskOf(i + 3); + } else { + v3 |= Pokemon_GetFlagMaskOf(i + 3); + } + } else { + if (LCRNG_Next() & 1) { + v2 |= Pokemon_GetFlagMaskOf(i + 3); + v3 |= Pokemon_GetFlagMaskOf(i + 3); + } + } + } + + u32 result = v2 | (v3 << 16); + + return result; +} + +void sub_02075EF4(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) +{ + sub_02075F0C(param0, &mon->box, param2, FALSE); +} + +void sub_02075F00(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) +{ + sub_02075F0C(param0, &mon->box, param2, TRUE); +} + +void sub_02075F0C(UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, BOOL param3) +{ + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + + u16 monSpeciesEgg = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES_EGG, NULL); + u8 monGender = BoxPokemon_GetGender(boxMon); + u8 monShininess = BoxPokemon_IsShiny(boxMon); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); + + u8 monForm; + if (monSpeciesEgg == SPECIES_EGG) { + if (BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { + monForm = 1; + } else { + monForm = 0; + } + } else { + monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); + } + + if (param3 == TRUE) { + sub_02076300(param0, monSpeciesEgg, monGender, param2, monShininess, monForm, monPersonality); + } else { + sub_02075FB4(param0, monSpeciesEgg, monGender, param2, monShininess, monForm, monPersonality); + } + + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); +} + +void sub_02075FB4(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) +{ + // TODO enum values? + param0->unk_06 = 0; + param0->unk_08 = 0; + param0->unk_0C = 0; + monForm = Pokemon_SanitizeFormId(monSpecies, monForm); + + switch (monSpecies) { + case SPECIES_BURMY: + param0->unk_00 = 117; + param0->unk_02 = 72 + (param3 / 2) + monForm * 2; + param0->unk_04 = 166 + monShininess + monForm * 2; + break; + case SPECIES_WORMADAM: + param0->unk_00 = 117; + param0->unk_02 = 78 + (param3 / 2) + monForm * 2; + param0->unk_04 = 172 + monShininess + monForm * 2; + break; + case SPECIES_SHELLOS: + param0->unk_00 = 117; + param0->unk_02 = 84 + param3 + monForm; + param0->unk_04 = 178 + monShininess + monForm * 2; + break; + case SPECIES_GASTRODON: + param0->unk_00 = 117; + param0->unk_02 = 88 + param3 + monForm; + param0->unk_04 = 182 + monShininess + monForm * 2; + break; + case SPECIES_CHERRIM: + param0->unk_00 = 117; + param0->unk_02 = 92 + param3 + monForm; + param0->unk_04 = 186 + (monShininess * 2) + monForm; + break; + case SPECIES_ARCEUS: + param0->unk_00 = 117; + param0->unk_02 = 96 + (param3 / 2) + monForm * 2; + param0->unk_04 = 190 + monShininess + monForm * 2; + break; + case SPECIES_CASTFORM: + param0->unk_00 = 117; + param0->unk_02 = 64 + (param3 * 2) + monForm; + param0->unk_04 = 158 + (monShininess * 4) + monForm; + break; + case SPECIES_DEOXYS: + param0->unk_00 = 117; + param0->unk_02 = 0 + (param3 / 2) + monForm * 2; + param0->unk_04 = 154 + monShininess; + break; + case SPECIES_UNOWN: + param0->unk_00 = 117; + param0->unk_02 = 8 + (param3 / 2) + monForm * 2; + param0->unk_04 = 156 + monShininess; + break; + case SPECIES_EGG: + param0->unk_00 = 117; + param0->unk_02 = 132 + monForm; + param0->unk_04 = 226 + monForm; + break; + case SPECIES_BAD_EGG: + param0->unk_00 = 117; + param0->unk_02 = 132; + param0->unk_04 = 226; + break; + case SPECIES_SHAYMIN: + param0->unk_00 = 117; + param0->unk_02 = 134 + (param3 / 2) + monForm * 2; + param0->unk_04 = 228 + monShininess + monForm * 2; + break; + case SPECIES_ROTOM: + param0->unk_00 = 117; + param0->unk_02 = 138 + (param3 / 2) + monForm * 2; + param0->unk_04 = 232 + monShininess + monForm * 2; + break; + case SPECIES_GIRATINA: + param0->unk_00 = 117; + param0->unk_02 = 150 + (param3 / 2) + monForm * 2; + param0->unk_04 = 244 + monShininess + monForm * 2; + break; + default: + param0->unk_00 = 4; + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + + if (monSpecies == SPECIES_SPINDA && param3 == 2) { + param0->unk_06 = 327; + param0->unk_08 = 0; + param0->unk_0C = monPersonality; + } + + break; + } +} + +u8 Pokemon_SanitizeFormId(u16 monSpecies, u8 monForm) +{ + // TODO enum values? + switch (monSpecies) { + case SPECIES_BURMY: + if (monForm > 2) { + monForm = 0; + } + break; + case SPECIES_WORMADAM: + + if (monForm > 2) { + monForm = 0; + } + break; + case SPECIES_SHELLOS: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_GASTRODON: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_CHERRIM: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_ARCEUS: + if (monForm > 17) { + monForm = 0; + } + break; + case SPECIES_CASTFORM: + if (monForm > 3) { + monForm = 0; + } + break; + case SPECIES_DEOXYS: + if (monForm > 3) { + monForm = 0; + } + break; + case SPECIES_UNOWN: + if (monForm >= 28) { + monForm = 0; + } + break; + case SPECIES_EGG: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_SHAYMIN: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_ROTOM: + if (monForm > 5) { + monForm = 0; + } + break; + case SPECIES_GIRATINA: + if (monForm > 1) { + monForm = 0; + } + break; + } + + return monForm; +} + +static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) +{ + // TODO enum values? + param0->unk_06 = 0; + param0->unk_08 = 0; + param0->unk_0C = 0; + + monForm = Pokemon_SanitizeFormId(monSpecies, monForm); + + switch (monSpecies) { + case SPECIES_BURMY: + param0->unk_00 = 166; + param0->unk_02 = 72 + (param3 / 2) + monForm * 2; + param0->unk_04 = 146 + monShininess + monForm * 2; + break; + case SPECIES_WORMADAM: + param0->unk_00 = 166; + param0->unk_02 = 78 + (param3 / 2) + monForm * 2; + param0->unk_04 = 152 + monShininess + monForm * 2; + break; + case SPECIES_SHELLOS: + param0->unk_00 = 166; + param0->unk_02 = 84 + param3 + monForm; + param0->unk_04 = 158 + monShininess + monForm * 2; + break; + case SPECIES_GASTRODON: + param0->unk_00 = 166; + param0->unk_02 = 88 + param3 + monForm; + param0->unk_04 = 162 + monShininess + monForm * 2; + break; + case SPECIES_CHERRIM: + param0->unk_00 = 166; + param0->unk_02 = 92 + param3 + monForm; + param0->unk_04 = 166 + (monShininess * 2) + monForm; + break; + case SPECIES_ARCEUS: + param0->unk_00 = 166; + param0->unk_02 = 96 + (param3 / 2) + monForm * 2; + param0->unk_04 = 170 + monShininess + monForm * 2; + break; + case SPECIES_CASTFORM: + param0->unk_00 = 166; + param0->unk_02 = 64 + (param3 * 2) + monForm; + param0->unk_04 = 138 + (monShininess * 4) + monForm; + break; + case SPECIES_DEOXYS: + param0->unk_00 = 166; + param0->unk_02 = 0 + (param3 / 2) + monForm * 2; + param0->unk_04 = 134 + monShininess; + break; + case SPECIES_UNOWN: + param0->unk_00 = 166; + param0->unk_02 = 8 + (param3 / 2) + monForm * 2; + param0->unk_04 = 136 + monShininess; + break; + case SPECIES_EGG: + param0->unk_00 = 166; + param0->unk_02 = 132 + monForm; + param0->unk_04 = 206 + monForm; + break; + case SPECIES_BAD_EGG: + param0->unk_00 = 166; + param0->unk_02 = 132; + param0->unk_04 = 206; + break; + case SPECIES_SHAYMIN: + if (monForm > 0) { + param0->unk_00 = 117; + param0->unk_02 = 134 + (param3 / 2) + monForm * 2; + param0->unk_04 = 230 + monShininess; + } else { + param0->unk_00 = 165; + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + } + break; + case SPECIES_ROTOM: + if (monForm > 0) { + param0->unk_00 = 117; + param0->unk_02 = 138 + (param3 / 2) + monForm * 2; + param0->unk_04 = 232 + monShininess + monForm * 2; + } else { + param0->unk_00 = 165; + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + } + break; + case SPECIES_GIRATINA: + if (monForm > 0) { + param0->unk_00 = 117; + param0->unk_02 = 150 + (param3 / 2) + monForm * 2; + param0->unk_04 = 244 + monShininess + monForm * 2; + } else { + param0->unk_00 = 165; + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + } + break; + default: + param0->unk_00 = 165; + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + + if (monSpecies == SPECIES_SPINDA && param3 == 2) { + param0->unk_06 = 327; + param0->unk_08 = 0; + param0->unk_0C = monPersonality; + } + + break; + } +} + +u8 sub_020765AC(Pokemon *mon, u8 param1) +{ + return sub_020765C4(&mon->box, param1, FALSE); +} + +u8 sub_020765B8(Pokemon *mon, u8 param1) +{ + return sub_020765C4(&mon->box, param1, TRUE); +} + +u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, BOOL param2) +{ + u16 monSpeciesEgg = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES_EGG, NULL); + u8 monGender = BoxPokemon_GetGender(boxMon); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); + + u8 monForm; + // TODO enum values? + if (monSpeciesEgg == SPECIES_EGG) { + if (BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { + monForm = 1; + } else { + monForm = 0; + } + } else { + monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); + } + + if (param2 == TRUE) { + return sub_020767BC(monSpeciesEgg, monGender, param1, monForm, monPersonality); + } + + return sub_02076648(monSpeciesEgg, monGender, param1, monForm, monPersonality); +} + +u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) +{ + // TODO enum values? + monForm = Pokemon_SanitizeFormId(monSpecies, monForm); + + int narcIndex; + int memberIndex; + switch (monSpecies) { + case SPECIES_BURMY: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 72 + (param2 / 2) + monForm * 2; + break; + case SPECIES_WORMADAM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 78 + (param2 / 2) + monForm * 2; + break; + case SPECIES_SHELLOS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 84 + param2 + monForm; + break; + case SPECIES_GASTRODON: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 88 + param2 + monForm; + break; + case SPECIES_CHERRIM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 92 + param2 + monForm; + break; + case SPECIES_ARCEUS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 96 + (param2 / 2) + monForm * 2; + break; + case SPECIES_CASTFORM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 64 + param2 * 2 + monForm; + break; + case SPECIES_DEOXYS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 0 + (param2 / 2) + monForm * 2; + break; + case SPECIES_UNOWN: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 8 + (param2 / 2) + monForm * 2; + break; + case SPECIES_EGG: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 132 + monForm; + break; + case SPECIES_BAD_EGG: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 132; + break; + case SPECIES_SHAYMIN: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 136 + (param2 / 2) + monForm * 2; + break; + case SPECIES_ROTOM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 140 + (param2 / 2) + monForm * 2; + break; + case SPECIES_GIRATINA: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 152 + (param2 / 2) + monForm * 2; + break; + default: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT; + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); + break; + } + + u8 result; + NARC_ReadWholeMemberByIndexPair(&result, narcIndex, memberIndex); + return result; +} + +static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) +{ + // TODO enum values? + monForm = Pokemon_SanitizeFormId(monSpecies, monForm); + + int narcIndex; + int memberIndex; + switch (monSpecies) { + case SPECIES_BURMY: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 72 + (param2 / 2) + monForm * 2; + break; + case SPECIES_WORMADAM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 78 + (param2 / 2) + monForm * 2; + break; + case SPECIES_SHELLOS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 84 + param2 + monForm; + break; + case SPECIES_GASTRODON: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 88 + param2 + monForm; + break; + case SPECIES_CHERRIM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 92 + param2 + monForm; + break; + case SPECIES_ARCEUS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 96 + (param2 / 2) + monForm * 2; + break; + case SPECIES_CASTFORM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 64 + param2 * 2 + monForm; + break; + case SPECIES_DEOXYS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 0 + (param2 / 2) + monForm * 2; + break; + case SPECIES_UNOWN: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 8 + (param2 / 2) + monForm * 2; + break; + case SPECIES_EGG: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 132 + monForm; + break; + case SPECIES_BAD_EGG: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 132; + break; + case SPECIES_SHAYMIN: + if (monForm > 0) { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 136 + (param2 / 2) + monForm * 2; + } else { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); + } + break; + case SPECIES_ROTOM: + if (monForm > 0) { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 140 + (param2 / 2) + monForm * 2; + } else { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); + } + break; + case SPECIES_GIRATINA: + if (monForm > 0) { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 152 + (param2 / 2) + monForm * 2; + } else { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); + } + break; + default: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); + break; + } + + u8 result; + NARC_ReadWholeMemberByIndexPair(&result, narcIndex, memberIndex); + return result; +} + +void sub_0207697C(UnkStruct_02008A90 *param0, u16 param1) +{ + param0->unk_00 = 60; + param0->unk_02 = param1 * 2; + param0->unk_04 = param1 * 2 + 1; + param0->unk_06 = 0; + param0->unk_08 = 0; + param0->unk_0C = 0; +} + +static const UnkStruct_ov104_0223F9E0 Unk_020F05E4 = { + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + NNS_G2D_VRAM_TYPE_2DMAIN, + {0x4E2F, 0x4E2A, 0x4E27, 0x4E27, 0xffffffff, 0xffffffff}, + 0x2, + 0x1 +}; + +static const int Unk_020F0588[] = { + 0x0, + 0x0, + 0x1, + 0x0, + 0x0, + 0x1 +}; + +UnkStruct_0200D0F4 *sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID) +{ + UnkStruct_ov104_0223F9E0 v0; + UnkStruct_0200D0F4 *v1; + NARC *narc; + UnkStruct_ov5_021DE5D0 v3; + int v4 = 1; + + sub_02076AAC(param5, param6, &v3); + + // TODO enum values? + if (param5 == 102) { + v4 = 2; + } + + narc = NARC_ctor(v3.unk_00, heapID); + + sub_0200CC3C(param0, param1, narc, v3.unk_04, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 20015 + param7); + sub_0200CDC4(param2, 2, param0, param1, narc, v3.unk_08, 0, v4, NNS_G2D_VRAM_TYPE_2DMAIN, 20010 + param7); + sub_0200CE24(param0, param1, narc, v3.unk_0C, 0, 20007 + param7); + sub_0200CE54(param0, param1, narc, v3.unk_10, 0, 20007 + param7); + NARC_dtor(narc); + + v0 = Unk_020F05E4; + + // TODO enum values? + v0.unk_14[0] = 20015 + param7; + v0.unk_14[1] = 20010 + param7; + v0.unk_14[2] = 20007 + param7; + v0.unk_14[3] = 20007 + param7; + v0.unk_08 = Unk_020F0588[param7]; + + v1 = sub_0200CE6C(param0, param1, &v0); + + sub_02021F24(v1->unk_00, 0); + sub_0200D4C4(v1, param3, param4); + sub_0200D330(v1); + sub_0200D390(v1, 1); + + return v1; +} + +void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 *param2) +{ + // TODO enum values? + if (param1 == 2) { + param2->unk_00 = 60; + param2->unk_04 = 0 + param0 * 5; + param2->unk_08 = 1 + param0 * 5; + param2->unk_0C = 2 + param0 * 5; + param2->unk_10 = 3 + param0 * 5; + param2->unk_14 = 4 + param0 * 5; + } else { + param2->unk_00 = 6; + param0 = sub_020788D0(param0); + param2->unk_04 = 0 + param0 * 5; + param2->unk_08 = 1 + param0 * 5; + param2->unk_0C = 2 + param0 * 5; + param2->unk_10 = 3 + param0 * 5; + param2->unk_14 = 4 + param0 * 5; + } +} + +u32 Pokemon_GetStructSize(void) +{ + return (u32)sizeof(Pokemon); +} + +u32 BoxPokemon_GetStructSize(void) +{ + return (u32)sizeof(BoxPokemon); +} + +u8 Pokemon_GetForm(Pokemon *mon) +{ + return BoxPokemon_GetForm(&mon->box); +} + +u8 BoxPokemon_GetForm(BoxPokemon *boxMon) +{ + return BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); +} + +BoxPokemon *Pokemon_GetBoxPokemon(Pokemon *mon) +{ + return &mon->box; +} + +BOOL sub_02076B14(Pokemon *mon) +{ + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u8 monNextLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL) + 1; + u32 monExp = Pokemon_GetValue(mon, MON_DATA_EXP, NULL); + int monExpRate = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_EXP_RATE); + // TODO const value? + u32 maxExp = Pokemon_GetExpRateBaseExpAt(monExpRate, 100); + + if (monExp > maxExp) { + monExp = maxExp; + Pokemon_SetValue(mon, MON_DATA_EXP, &monExp); + } + + // TODO const value? + if (monNextLevel > 100) { + return FALSE; + } + + maxExp = Pokemon_GetExpRateBaseExpAt(monExpRate, monNextLevel); + + if (monExp >= maxExp) { + Pokemon_SetValue(mon, MON_DATA_LEVEL, &monNextLevel); + return TRUE; + } + + return FALSE; +} + +// TODO return species enum (TODO: replace species id defines with enum) +u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult) +{ + u16 targetSpecies = SPECIES_NONE; + + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u16 monHeldItem = Pokemon_GetValue(mon, MON_DATA_HELD_ITEM, NULL); + u32 monPersonality = Pokemon_GetValue(mon, MON_DATA_PERSONALITY, NULL); + u8 monBeauty = Pokemon_GetValue(mon, MON_DATA_BEAUTY, NULL); + + int i; + u16 monFriendship; + + u16 monPersonalityUpper = (monPersonality & 0xffff0000) >> 16; + u8 itemHoldEffect = Item_LoadParam(monHeldItem, ITEM_PARAM_HOLD_EFFECT, 0); + + if (monSpecies != SPECIES_KADABRA) { + if (itemHoldEffect == HOLD_EFFECT_NO_EVOLVE && evoTypeList != 3) { + return 0; + } + } + + int v11; + if (evoTypeResult == NULL) { + evoTypeResult = &v11; + } + + PokemonEvolutionData *monEvolutionData = Heap_AllocFromHeap(0, sizeof(PokemonEvolutionData)); + PokemonEvolutionData_LoadSpecies(monSpecies, monEvolutionData); + + // TODO enum? + switch (evoTypeList) { + case 0: + u8 monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); + monFriendship = Pokemon_GetValue(mon, MON_DATA_FRIENDSHIP, NULL); + + for (i = 0; i < 7; i++) { + switch (monEvolutionData->methods[i].type) { + case 1: // high friendship + if (220 <= monFriendship) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 1; + } + break; + case 2: // high friendship && daytime + if (sub_02013948() == 0 && 220 <= monFriendship) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 2; + } + break; + case 3: // high friendship && nighttime + if (sub_02013948() == 1 && 220 <= monFriendship) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 3; + } + break; + case 4: // above level param + if (monEvolutionData->methods[i].param <= monLevel) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 4; + } + break; + case 8: // tyrogue evo to hitmonlee: above level param && attack > defense + if (monEvolutionData->methods[i].param <= monLevel) { + if (Pokemon_GetValue(mon, MON_DATA_ATK, NULL) > Pokemon_GetValue(mon, MON_DATA_DEF, NULL)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 8; + } + } + break; + case 9: // tyrogue evo to hitmontop: above level param && attack == defense + if (monEvolutionData->methods[i].param <= monLevel) { + if (Pokemon_GetValue(mon, MON_DATA_ATK, NULL) == Pokemon_GetValue(mon, MON_DATA_DEF, NULL)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 9; + } + } + break; + case 10: // tyrogue evo to hitmonchan: above level param && attack < defense + if (monEvolutionData->methods[i].param <= monLevel) { + if (Pokemon_GetValue(mon, MON_DATA_ATK, NULL) < Pokemon_GetValue(mon, MON_DATA_DEF, NULL)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 10; + } + } + break; + case 11: // wurmple evo to silcoon: above level param && upper16 of personality % 10 < 5 + if (monEvolutionData->methods[i].param <= monLevel) { + if (monPersonalityUpper % 10 < 5) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 11; + } + } + break; + case 12: // wurmple evo to cascoon: above level param && upper16 of personality % 10 >= 5 + if (monEvolutionData->methods[i].param <= monLevel) { + if (monPersonalityUpper % 10 >= 5) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 12; + } + } + break; + case 13: // nincada evo to ninjask: above level param + if (monEvolutionData->methods[i].param <= monLevel) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 13; + } + break; + case 14: // nincada evo to shedinja: ??? + evoTypeResult[0] = 14; + break; + case 15: // feebas evo: beauty > param + if (monEvolutionData->methods[i].param <= monBeauty) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 15; + } + break; + case 18: // happiny evo: hold param && daytime + if (sub_02013948() == 0 && monEvolutionData->methods[i].param == monHeldItem) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 18; + } + break; + case 19: // sneasel and gligar evo: hold param && nighttime + if (sub_02013948() == 1 && monEvolutionData->methods[i].param == monHeldItem) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 19; + } + break; + case 20: // lickitung, tangela etc. evo: after param learned + if (Pokemon_HasMove(mon, monEvolutionData->methods[i].param) == 1) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 20; + } + break; + case 21: // mantyke evo: have param in party + if (party != NULL) { + if (Party_HasSpecies(party, monEvolutionData->methods[i].param) == 1) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 21; + } + } + break; + case 22: // burmy evo to mothim: above level param && male + if (Pokemon_GetValue(mon, MON_DATA_GENDER, NULL) == 0 && monEvolutionData->methods[i].param <= monLevel) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 22; + } + break; + case 23: // burmy evo to wormadam, combee evo to vespiquen: above level param && female + if (Pokemon_GetValue(mon, MON_DATA_GENDER, NULL) == 1 && monEvolutionData->methods[i].param <= monLevel) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 23; + } + break; + case 24: // magneton and nosepass evo: custom check + if (monEvolutionData->methods[i].type == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 24; + } + break; + case 25: // eevee evo to leafeon: custom check + if (monEvolutionData->methods[i].type == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 25; + } + break; + case 26: // eevee evo to glaceon: custom check + if (monEvolutionData->methods[i].type == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 26; + } + break; + } + + if (targetSpecies) { + break; + } + } + break; + case 1: + for (i = 0; i < 7; i++) { + switch (monEvolutionData->methods[i].type) { + case 5: // kadabra etc. evo: trade + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 5; + break; + case 6: // poliwhirl evo to politoed etc.: trade holding param + if (monEvolutionData->methods[i].param == monHeldItem) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 6; + } + break; + } + + if (targetSpecies) { + break; + } + } + break; + case 2: + case 3: + for (i = 0; i < 7; i++) { + // use param + if (monEvolutionData->methods[i].type == 7 && monEvolutionData->methods[i].param == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 0; + break; + } + // kirlia evo to gallade: use param && male + if (monEvolutionData->methods[i].type == 16 && Pokemon_GetValue(mon, MON_DATA_GENDER, NULL) == 0 && monEvolutionData->methods[i].param == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 0; + break; + } + // snorunt evo to froslass: use param && female + if (monEvolutionData->methods[i].type == 17 && Pokemon_GetValue(mon, MON_DATA_GENDER, NULL) == 1 && monEvolutionData->methods[i].param == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 0; + break; + } + + if (targetSpecies) { + break; + } + } + break; + } + + Heap_FreeToHeap(monEvolutionData); + return targetSpecies; +} + +u16 sub_02076F84(const u16 monSpecies) +{ + u16 result = 0; + GF_ASSERT(NATIONAL_DEX_COUNT + 1 > monSpecies); + + FSFile file; + FS_InitFile(&file); + FS_OpenFile(&file, "poketool/personal/pms.narc"); + FS_SeekFile(&file, monSpecies * 2, FS_SEEK_SET); + FS_ReadFile(&file, &result, 2); + FS_CloseFile(&file); + + return result; +} + +u16 sub_02076FD4(const u16 monSpecies) +{ + switch (monSpecies) { + case SPECIES_WOBBUFFET: + case SPECIES_MARILL: + case SPECIES_MR_MIME: + case SPECIES_SUDOWOODO: + case SPECIES_SNORLAX: + case SPECIES_MANTINE: + case SPECIES_ROSELIA: + case SPECIES_CHANSEY: + case SPECIES_CHIMECHO: + return monSpecies; + break; + } + + return sub_02076F84(monSpecies); +} + +static void BoxPokemon_SetDefaultMoves(BoxPokemon *boxMon) +{ + BOOL reencrypt; + // TODO const value? + u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); + + reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + + u16 monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, 0); + int monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, 0); + u8 monLevel = BoxPokemon_GetLevel(boxMon); + + Pokemon_LoadLevelUpMovesOf(monSpecies, monForm, monLevelUpMoves); + + int i = 0; + + // TODO const values for sentinels? + while (monLevelUpMoves[i] != 0xffff) { + if ((monLevelUpMoves[i] & 0xfe00) <= monLevel << 9) { + u16 monLevelUpMoveID = monLevelUpMoves[i] & 0x1ff; + u16 moveID = BoxPokemon_AddMove(boxMon, monLevelUpMoveID); + + if (moveID == 0xffff) { + BoxPokemon_ReplaceMove(boxMon, monLevelUpMoveID); + } + } else { + break; + } + + i++; + } + + Heap_FreeToHeap(monLevelUpMoves); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); +} + +u16 Pokemon_AddMove(Pokemon *mon, u16 moveID) +{ + BoxPokemon *boxMon = Pokemon_GetBoxPokemon(mon); + return BoxPokemon_AddMove(boxMon, moveID); +} + +static u16 BoxPokemon_AddMove(BoxPokemon *boxMon, u16 moveID) +{ + // TODO const values for sentinels? + u16 result = 0xffff; + + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + + for (int i = 0; i < 4; i++) { + u16 slotMove; + if ((slotMove = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1 + i, NULL)) == 0) { + BoxPokemon_SetMoveSlot(boxMon, moveID, i); + result = moveID; + break; + } else { + if (slotMove == moveID) { + result = 0xfffe; + break; + } + } + } + + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); + + return result; +} + +void Pokemon_ReplaceMove (Pokemon *mon, u16 moveID) +{ + BoxPokemon *boxMon = Pokemon_GetBoxPokemon(mon); + BoxPokemon_ReplaceMove(boxMon, moveID); +} + +static void BoxPokemon_ReplaceMove(BoxPokemon *boxMon, u16 moveID) +{ + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + + u16 moveIDs[4]; + u8 movePPs[4]; + u8 movePPUps[4]; + + for (int i = 0; i < 3; i++) { + moveIDs[i] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE2 + i, NULL); + movePPs[i] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE2_CUR_PP + i, NULL); + movePPUps[i] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE2_PP_UPS + i, NULL); + } + + moveIDs[3] = moveID; + movePPs[3] = MoveTable_LoadParam(moveID, MOVEATTRIBUTE_PP); + movePPUps[3] = 0; + + for (int i = 0; i < 4; i++) { + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1 + i, &moveIDs[i]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + i, &movePPs[i]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps[i]); + } + + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); +} + +void Pokemon_ResetMoveSlot(Pokemon *mon, u16 moveID, u8 moveSlot) +{ + Pokemon_SetMoveSlot(mon, moveID, moveSlot); + + u32 moveMaxPP; + u32 movePPUps = 0; + Pokemon_SetValue(mon, MON_DATA_MOVE1_PP_UPS + moveSlot, &movePPUps); + + moveMaxPP = MoveTable_CalcMaxPP(moveID, 0); + Pokemon_SetValue(mon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); + + return; +} + +void Pokemon_SetMoveSlot(Pokemon *mon, u16 moveID, u8 moveSlot) +{ + BoxPokemon_SetMoveSlot(&mon->box, moveID, moveSlot); +} + +static void BoxPokemon_SetMoveSlot(BoxPokemon *boxMon, u16 moveID, u8 moveSlot) +{ + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1 + moveSlot, &moveID); + + u8 movePPUps = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot, NULL); + u8 moveMaxPP = MoveTable_CalcMaxPP(moveID, movePPUps); + + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); +} + +u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID) +{ + u16 result = 0x0; + // TODO const value? + u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); + + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + int monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + u8 monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); + + Pokemon_LoadLevelUpMovesOf(monSpecies, monForm, monLevelUpMoves); + + // TODO const values for sentinels? + if (monLevelUpMoves[index[0]] == 0xffff) { + Heap_FreeToHeap(monLevelUpMoves); + return 0x0; + } + + while ((monLevelUpMoves[index[0]] & 0xfe00) != monLevel << 9) { + index[0]++; + + if (monLevelUpMoves[index[0]] == 0xffff) { + Heap_FreeToHeap(monLevelUpMoves); + return 0x0; + } + } + + if ((monLevelUpMoves[index[0]] & 0xfe00) == monLevel << 9) { + moveID[0] = monLevelUpMoves[index[0]] & 0x1ff; + index[0]++; + + result = Pokemon_AddMove(mon, moveID[0]); + } + + Heap_FreeToHeap(monLevelUpMoves); + + return result; +} + +void Pokemon_SwapMoveSlots(Pokemon *mon, int moveSlot1, int moveSlot2) +{ + BoxPokemon_SwapMoveSlots(&mon->box, moveSlot1, moveSlot2); +} + +void BoxPokemon_SwapMoveSlots(BoxPokemon *boxMon, int moveSlot1, int moveSlot2) +{ + u16 moveIDs[2]; + u8 movePPs[2]; + u8 movePPUps[2]; + + moveIDs[0] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1 + moveSlot1, NULL); + movePPs[0] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot1, NULL); + movePPUps[0] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, NULL); + moveIDs[1] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1 + moveSlot2, NULL); + movePPs[1] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot2, NULL); + movePPUps[1] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, NULL); + + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1 + moveSlot1, &moveIDs[1]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot1, &movePPs[1]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, &movePPUps[1]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1 + moveSlot2, &moveIDs[0]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot2, &movePPs[0]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, &movePPUps[0]); +} + +void Pokemon_ClearMoveSlot(Pokemon *mon, u32 moveSlot) +{ + u16 moveID; + u8 movePP; + u8 movePPUps; + + for (u32 i = moveSlot; i < 3; i++) { + moveID = Pokemon_GetValue(mon, MON_DATA_MOVE1 + i + 1, NULL); + movePP = Pokemon_GetValue(mon, MON_DATA_MOVE1_CUR_PP + i + 1, NULL); + movePPUps = Pokemon_GetValue(mon, MON_DATA_MOVE1_PP_UPS + i + 1, NULL); + + Pokemon_SetValue(mon, MON_DATA_MOVE1 + i, &moveID); + Pokemon_SetValue(mon, MON_DATA_MOVE1_CUR_PP + i, &movePP); + Pokemon_SetValue(mon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps); + } + + moveID = 0; + movePP = 0; + movePPUps = 0; + + Pokemon_SetValue(mon, MON_DATA_MOVE4, &moveID); + Pokemon_SetValue(mon, MON_DATA_MOVE4_CUR_PP, &movePP); + Pokemon_SetValue(mon, MON_DATA_MOVE4_PP_UPS, &movePPUps); +} + +static BOOL Pokemon_HasMove(Pokemon *mon, u16 moveID) +{ + int i; + for (i = 0; i < 4; i++) { + if (Pokemon_GetValue(mon, MON_DATA_MOVE1 + i, NULL) == moveID) { + break; + } + } + + return i != 4; +} + +void Pokemon_FromBoxPokemon(BoxPokemon *boxMon, Pokemon *mon) +{ + u32 zero = 0; + + mon->box = *boxMon; + if (mon->box.boxDecrypted) { + mon->box.partyDecrypted = TRUE; + } + + Pokemon_SetValue(mon, MON_DATA_160, &zero); + Pokemon_SetValue(mon, MON_DATA_CURRENT_HP, &zero); + Pokemon_SetValue(mon, MON_DATA_MAX_HP, &zero); + + UnkStruct_0202818C *v1 = sub_0202818C(0); + Pokemon_SetValue(mon, MON_DATA_170, v1); + Heap_FreeToHeap(v1); + + Pokemon_SetValue(mon, MON_DATA_162, &zero); + + UnkStruct_0202CA28 v2; + MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); + Pokemon_SetValue(mon, MON_DATA_171, &v2); + + Pokemon_CalcLevelAndStats(mon); +} + +u8 Party_GetMaxLevel(Party *party) +{ + int currentPartyCount = Party_GetCurrentCount(party); + + u8 result = 1; + + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); + + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL) && Pokemon_GetValue(mon, MON_DATA_IS_EGG, NULL) == 0) { + u8 monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); + + if (monLevel > result) { + result = monLevel; + } + } + } + + return result; +} + +u16 sub_020775A4(u16 param0) +{ + u16 result; + + NARC_ReadFromMemberByIndexPair(&result, NARC_INDEX_POKETOOL__PL_POKEZUKAN, 0, param0 * 2, 2); + + return result; +} + +u16 sub_020775C4(u16 param0) +{ + u16 result = 0; + + // TODO enum value? + if (param0 <= 210) { + NARC_ReadFromMemberByIndexPair(&result, NARC_INDEX_POKETOOL__SHINZUKAN, 0, param0 * 2, 2); + } + + return result; +} + +void Pokemon_Copy(Pokemon *src, Pokemon *dest) +{ + *dest = *src; + return; +} + +void BoxPokemon_Copy(BoxPokemon *src, BoxPokemon *dest) +{ + *dest = *src; + return; +} + +void BoxPokemon_FromPokemon(Pokemon *src, BoxPokemon *dest) +{ + *dest = src->box; + return; +} + +// TODO enums +s8 Pokemon_GetFlavorAffinity(Pokemon *mon, int flavor) +{ + return BoxPokemon_GetFlavorAffinity(&mon->box, flavor); +} + +// TODO enums +static s8 BoxPokemon_GetFlavorAffinity(BoxPokemon *boxMon, int flavor) +{ + return Pokemon_GetFlavorAffinityOf(BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL), flavor); +} + +// TODO enums +s8 Pokemon_GetFlavorAffinityOf(u32 monPersonality, int flavor) +{ + u8 monNature = Pokemon_GetNatureOf(monPersonality); + return sNatureFlavorAffinities[monNature][flavor]; +} + +int Pokemon_LoadLevelUpMoveIdsOf(int monSpecies, int monForm, u16 *monLevelUpMoveIDs) +{ + u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); + + Pokemon_LoadLevelUpMovesOf(monSpecies, monForm, monLevelUpMoves); + + int result = 0; + + // TODO const values for sentinels? + while (monLevelUpMoves[result] != 0xffff) { + monLevelUpMoveIDs[result] = monLevelUpMoves[result] & 0x1ff; + result++; + } + + Heap_FreeToHeap(monLevelUpMoves); + return result; +} + +void sub_020776B0(Party *party) +{ + int currentPartyCount = Party_GetCurrentCount(party); + u16 rand = LCRNG_Next(); + + if (rand == 16384 || rand == 32768 || rand == 49152) { + int partySlot; + Pokemon *mon; + do { + partySlot = LCRNG_Next() % currentPartyCount; + mon = Party_GetPokemonBySlotIndex(party, partySlot); + + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL) && Pokemon_GetValue(mon, MON_DATA_IS_EGG, NULL) == 0) { + break; + } else { + partySlot = currentPartyCount; + } + } while (partySlot == currentPartyCount); + + if (sub_02077758(party, Pokemon_GetFlagMaskOf(partySlot)) == 0) { + u8 monPokerus; + do { + monPokerus = LCRNG_Next() & 0xff; + } while ((monPokerus & 0x7) == 0); + + if (monPokerus & 0xf0) { + monPokerus &= 0x7; + } + + monPokerus |= (monPokerus << 4); + monPokerus &= 0xf3; + monPokerus++; + + Pokemon_SetValue(mon, MON_DATA_POKERUS, &monPokerus); + } + } +} + +u8 sub_02077758(Party *party, u8 param1) +{ + int partySlot = 0; + int v1 = 1; + + u8 result = 0; + if (param1) { + do { + if (param1 & 1) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, partySlot); + + if (Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL)) { + result |= v1; + } + } + + partySlot++; + v1 = v1 << 1; + param1 = param1 >> 1; + } while (param1 != 0); + } else { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, partySlot); + + if (Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL)) { + result++; + } + } + + return result; +} + +void sub_020777B4(Party *party, s32 param1) +{ + int currentPartyCount = Party_GetCurrentCount(party); + + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); + + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL)) { + u8 monPokerus = Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL); + + if (monPokerus & 0xf) { + if (((monPokerus & 0xf) < param1) || (param1 > 4)) { + monPokerus &= 0xf0; + } else { + monPokerus -= param1; + } + + if (monPokerus == 0) { + monPokerus = 0x10; + } + + Pokemon_SetValue(mon, MON_DATA_POKERUS, &monPokerus); + } + } + } +} + +void sub_0207782C(Party *party) +{ + int currentPartyCount = Party_GetCurrentCount(party); + + if (LCRNG_Next() % 3 == 0) { + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); + + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL)) { + u8 monPokerus = Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL); + + if (monPokerus & 0xf) { + if (i != 0) { + mon = Party_GetPokemonBySlotIndex(party, i - 1); + + if ((Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { + Pokemon_SetValue(mon, MON_DATA_POKERUS, &monPokerus); + } + } + + if (i < currentPartyCount - 1) { + mon = Party_GetPokemonBySlotIndex(party, i + 1); + + if ((Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { + Pokemon_SetValue(mon, MON_DATA_POKERUS, &monPokerus); + i++; + } + } + } + } + } + } +} + +BOOL sub_020778D8(Pokemon *mon) +{ + return sub_020778E0(&mon->box); +} + +static BOOL sub_020778E0(BoxPokemon *boxMon) +{ + return (BoxPokemon_GetValue(boxMon, MON_DATA_POKERUS, NULL) & 0xf) != 0; +} + +BOOL sub_020778F8(Pokemon *mon) +{ + return sub_02077900(&mon->box); +} + +static BOOL sub_02077900(BoxPokemon *boxMon) +{ + u8 monPokerus = BoxPokemon_GetValue(boxMon, MON_DATA_POKERUS, NULL); + + if (monPokerus & 0xf) { + return 0; + } + + return (monPokerus & 0xf0) != 0; +} + +void Pokemon_SetArceusForm(Pokemon *mon) +{ + BoxPokemon_SetArceusForm(&mon->box); +} + +void BoxPokemon_SetArceusForm(BoxPokemon *boxMon) +{ + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + int monAbility = BoxPokemon_GetValue(boxMon, MON_DATA_ABILITY, NULL); + int monHeldItem = BoxPokemon_GetValue(boxMon, MON_DATA_HELD_ITEM, NULL); + + // TODO enum values + if (monSpecies == SPECIES_ARCEUS && monAbility == 121) { + int monForm = Pokemon_GetArceusTypeOf(Item_LoadParam(monHeldItem, 1, 0)); + BoxPokemon_SetValue(boxMon, MON_DATA_FORM, &monForm); + } +} + +u8 Pokemon_GetArceusTypeOf(u16 itemHoldEffect) +{ + u8 type; + + switch (itemHoldEffect) { + case HOLD_EFFECT_ARCEUS_FIRE: + type = TYPE_FIRE; + break; + case HOLD_EFFECT_ARCEUS_WATER: + type = TYPE_WATER; + break; + case HOLD_EFFECT_ARCEUS_ELECTRIC: + type = TYPE_ELECTRIC; + break; + case HOLD_EFFECT_ARCEUS_GRASS: + type = TYPE_GRASS; + break; + case HOLD_EFFECT_ARCEUS_ICE: + type = TYPE_ICE; + break; + case HOLD_EFFECT_ARCEUS_FIGHT: + type = TYPE_FIGHTING; + break; + case HOLD_EFFECT_ARCEUS_POISON: + type = TYPE_POISON; + break; + case HOLD_EFFECT_ARCEUS_GROUND: + type = TYPE_GROUND; + break; + case HOLD_EFFECT_ARCEUS_FLYING: + type = TYPE_FLYING; + break; + case HOLD_EFFECT_ARCEUS_PSYCHIC: + type = TYPE_PSYCHIC; + break; + case HOLD_EFFECT_ARCEUS_BUG: + type = TYPE_BUG; + break; + case HOLD_EFFECT_ARCEUS_ROCK: + type = TYPE_ROCK; + break; + case HOLD_EFFECT_ARCEUS_GHOST: + type = TYPE_GHOST; + break; + case HOLD_EFFECT_ARCEUS_DRAGON: + type = TYPE_DRAGON; + break; + case HOLD_EFFECT_ARCEUS_DARK: + type = TYPE_DARK; + break; + case HOLD_EFFECT_ARCEUS_STEEL: + type = TYPE_STEEL; + break; + default: + type = TYPE_NORMAL; + break; + } + + return type; +} + +int Pokemon_SetGiratinaForm(Pokemon *mon) +{ + int result = BoxPokemon_SetGiratinaForm(&mon->box); + + // TODO enum value? + if (result != -1) { + Pokemon_CalcLevelAndStats(mon); + } + + return result; +} + +int BoxPokemon_SetGiratinaForm(BoxPokemon *boxMon) +{ + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + int monHeldItem = BoxPokemon_GetValue(boxMon, MON_DATA_HELD_ITEM, NULL); + + // TODO enum? + if (monSpecies == SPECIES_GIRATINA) { + int monForm = (monHeldItem == ITEM_GRISEOUS_ORB) ? 1 : 0; + + BoxPokemon_SetValue(boxMon, MON_DATA_FORM, &monForm); + BoxPokemon_CalcAbility(boxMon); + + return monForm; + } + + return -1; +} + +void Pokemon_SetGiratinaOriginForm(Pokemon *mon) +{ + // TODO enum? + int monForm = 1; + + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL) == SPECIES_GIRATINA) { + BoxPokemon_SetValue(&mon->box, MON_DATA_FORM, &monForm); + BoxPokemon_CalcAbility(&mon->box); + Pokemon_CalcLevelAndStats(mon); + } +} + +void Party_SetGiratinaForm(Party *party, int param1) +{ + int currentPartyCount = Party_GetCurrentCount(party); + + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); + + if (param1) { + Pokemon_SetGiratinaOriginForm(mon); + } else { + Pokemon_SetGiratinaForm(mon); + } + } +} + +void Pokemon_SetShayminForm(Pokemon *mon, int monForm) +{ + BoxPokemon_SetShayminForm(&mon->box, monForm); + Pokemon_CalcLevelAndStats(mon); +} + +void BoxPokemon_SetShayminForm(BoxPokemon *boxMon, int monForm) +{ + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + + if (monSpecies == SPECIES_SHAYMIN) { + // TODO enum? + GF_ASSERT(monForm <= 1); + + BoxPokemon_SetValue(boxMon, MON_DATA_FORM, &monForm); + BoxPokemon_CalcAbility(boxMon); + } +} + +BOOL Pokemon_CanShayminSkyForm(Pokemon *mon) +{ + u32 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u32 monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + u32 v2 = Pokemon_GetValue(mon, MON_DATA_160, NULL); + u32 monCurrentHP = Pokemon_GetValue(mon, MON_DATA_CURRENT_HP, NULL); + u32 monFatefulEncounter = Pokemon_GetValue(mon, MON_DATA_FATEFUL_ENCOUNTER, NULL); + + RTCTime rtcTime; + sub_02013880(&rtcTime); + + return (monSpecies == SPECIES_SHAYMIN + && monForm == 0 + && monCurrentHP > 0 + && monFatefulEncounter == TRUE + && (v2 & 0x20) == 0 + && rtcTime.hour >= 4 + && rtcTime.hour < 20); +} + +void Party_SetShayminLandForm(Party *party) +{ + int currentPartyCount = Party_GetCurrentCount(party); + + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); + int monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + int monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + + if (monSpecies == SPECIES_SHAYMIN && monForm == 1) { + // TODO enum? + int zero = 0; + Pokemon_SetShayminForm(mon, zero); + } + } +} + +BOOL Party_SetShayminForm(Party *party, int param1, const RTCTime *rtcTime) +{ + if (rtcTime->hour >= 20 || rtcTime->hour < 4) { + s32 hours = rtcTime->hour; + + if (hours < 4) { + hours += 24; + } + + hours -= 20; + s32 minutes = rtcTime->minute + hours * 60; + + param1++; + + if (minutes < param1) { + Party_SetShayminLandForm(party); + return TRUE; + } + + return FALSE; + } else { + s32 minutes = rtcTime->minute + (rtcTime->hour - 4) * 60; + + if (minutes < param1) { + Party_SetShayminLandForm(party); + return TRUE; + } + + return FALSE; + } +} + +BOOL Pokemon_SetRotomForm(Pokemon *mon, int monForm, int moveSlot) +{ + int monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + + if (monSpecies != SPECIES_ROTOM) { + return FALSE; + } + + int currentMonForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + + static const u16 rotomFormMoves[] = { + MOVE_NONE, + MOVE_OVERHEAT, + MOVE_HYDRO_PUMP, + MOVE_BLIZZARD, + MOVE_AIR_SLASH, + MOVE_LEAF_STORM + }; + + int newFormMoveID = rotomFormMoves[monForm]; + + int i; + for (i = 0; i < 4; i++) { + int j; + int moveID = Pokemon_GetValue(mon, MON_DATA_MOVE1 + i, NULL); + + for (j = 1; j < NELEMS(rotomFormMoves); j++) { + if (moveID != MOVE_NONE && moveID == rotomFormMoves[j]) { + if (newFormMoveID != MOVE_NONE) { + Pokemon_ResetMoveSlot(mon, newFormMoveID, i); + newFormMoveID = MOVE_NONE; + break; + } else { + Pokemon_ClearMoveSlot(mon, i); + i--; + break; + } + } + } + } + + if (newFormMoveID != MOVE_NONE) { + for (i = 0; i < 4; i++) { + if (Pokemon_GetValue(mon, MON_DATA_MOVE1 + i, NULL) == MOVE_NONE) { + Pokemon_ResetMoveSlot(mon, newFormMoveID, i); + break; + } + } + + if (i == 4) { + Pokemon_ResetMoveSlot(mon, newFormMoveID, moveSlot); + } + } + + if (Pokemon_GetValue(mon, MON_DATA_MOVE1, NULL) == MOVE_NONE) { + Pokemon_ResetMoveSlot(mon, MOVE_THUNDER_SHOCK, 0); + } + + Pokemon_SetValue(mon, MON_DATA_FORM, &monForm); + Pokemon_CalcAbility(mon); + Pokemon_CalcLevelAndStats(mon); + + return TRUE; +} + +/* TODO: + This function is annoying. + It's used in exactly one other file (`unk_020997B8.c`), so it has to be public. + The data structure of the NARC uses bitmasks that should probably be a struct, + and calling code uses sentinel values that should probably be consts, + but then we'd be polluting namespace for the sake of two .c files. + Could define in each .c file, but then there's risk of these becoming desynced (This is the worse option imo). +*/ +void Pokemon_LoadLevelUpMovesOf(int monSpecies, int monForm, u16 *monLevelUpMoves) +{ + monSpecies = Pokemon_GetFormNarcIndex(monSpecies, monForm); + NARC_ReadWholeMemberByIndexPair(monLevelUpMoves, NARC_INDEX_POKETOOL__PERSONAL__WOTBL, monSpecies); +} + +void sub_02077D3C(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7) +{ + if (monSpecies == SPECIES_CHATOT) { + if (sub_020064C8(param1) == 0) { + sub_020063D4(1); + sub_020059D0(param1, monSpecies, param4, param5, param7, param3); + } else { + if (param6) { + sub_020063D4(1); + } + + sub_020063E4(param0, NULL, param5, param4); + } + } else { + sub_020059D0(param1, monSpecies, param4, param5, param7, param3); + } +} + +void sub_02077DB4(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8) +{ + if (monSpecies == SPECIES_CHATOT) { + if (sub_020064C8(param1) == 0) { + sub_020063D4(1); + sub_02005F4C(param1, monSpecies, param4, param5, param7, param8, param3); + } else { + if (param6) { + sub_020063D4(1); + } + + sub_02006438(param0, NULL, param5, param4, param8); + } + } else { + sub_02005F4C(param1, monSpecies, param4, param5, param7, param8, param3); + } +} + +BOOL sub_02077E3C(Pokemon *mon) +{ + int monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + int monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + + return sub_02005844(monSpecies, monForm); +} + +void sub_02077E64(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +{ + sub_02077EA4(&mon->box, param1, monPokeball, param3, param4, param5); + + if (monPokeball == ITEM_HEAL_BALL) { + int monMaxHP = Pokemon_GetValue(mon, MON_DATA_MAX_HP, NULL); + Pokemon_SetValue(mon, MON_DATA_CURRENT_HP, &monMaxHP); + + monMaxHP = 0; + Pokemon_SetValue(mon, MON_DATA_160, &monMaxHP); + } +} + +static void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +{ + sub_0209305C(boxMon, param1, 0, param3, param5); + BoxPokemon_SetValue(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); + BoxPokemon_SetValue(boxMon, MON_DATA_POKEBALL, &monPokeball); + BoxPokemon_SetValue(boxMon, MON_DATA_158, ¶m4); +} + +void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +{ + sub_02077EF8(&mon->box, param1, monPokeball, param3, param4, param5); +} + +static void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +{ + sub_02077EA4(boxMon, param1, monPokeball, param3, param4, param5); +} + +static const u16 sHeldItemChance[][2] = { + {45, 95}, + {20, 80} +}; + +void sub_02077F0C(Pokemon *mon, u32 param1, int param2) +{ + if (param1 & (0x1 | 0x80)) { + return; + } + + u32 rand = LCRNG_Next() % 100; + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u16 monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + u16 monItem1 = PokemonPersonalData_GetFormValue(monSpecies, monForm, MON_DATA_PERSONAL_ITEM1); + u16 monItem2 = PokemonPersonalData_GetFormValue(monSpecies, monForm, MON_DATA_PERSONAL_ITEM2); + + if (monItem1 == monItem2 && monItem1 != 0) { + Pokemon_SetValue(mon, MON_DATA_HELD_ITEM, &monItem1); + return; + } + + if (rand < sHeldItemChance[param2][0]) { + return; + } else if (rand < sHeldItemChance[param2][1]) { + Pokemon_SetValue(mon, MON_DATA_HELD_ITEM, &monItem1); + } else { + Pokemon_SetValue(mon, MON_DATA_HELD_ITEM, &monItem2); + } +} + +BOOL Pokemon_CanLearnTM(Pokemon *mon, u8 tmID) +{ + return BoxPokemon_CanLearnTM(&mon->box, tmID); +} + +static BOOL BoxPokemon_CanLearnTM(BoxPokemon *boxMon, u8 tmID) +{ + u16 monSpeciesEgg = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES_EGG, NULL); + int monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); + + return Pokemon_CanFormLearnTM(monSpeciesEgg, monForm, tmID); +} + +BOOL Pokemon_CanFormLearnTM(u16 monSpecies, int monForm, u8 tmID) +{ + if (monSpecies == SPECIES_EGG) { + return FALSE; + } + + u32 tmFlag; + u8 monPersonalDataAttribute; + if (tmID < 32) { + tmFlag = (1 << tmID); + monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_1; + } else if (tmID < 64) { + tmFlag = (1 << (tmID - 32)); + monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_2; + } else if (tmID < 96) { + tmFlag = (1 << (tmID - 64)); + monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_3; + } else { + tmFlag = (1 << (tmID - 96)); + monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_4; + } + + return (PokemonPersonalData_GetFormValue(monSpecies, monForm, monPersonalDataAttribute) & tmFlag) != 0; +} + +void Pokemon_CalcAbility(Pokemon *mon) +{ + BoxPokemon_CalcAbility(&mon->box); +} + +static void BoxPokemon_CalcAbility(BoxPokemon *boxMon) +{ + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); + int monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); + int monAbility1 = PokemonPersonalData_GetFormValue(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_1); + int monAbility2 = PokemonPersonalData_GetFormValue(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_2); + + // TODO enum value? + if (monAbility2 != 0) { + if (monPersonality & 1) { + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &monAbility2); + } else { + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &monAbility1); + } + } else { + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &monAbility1); + } + + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); +} + +void sub_020780C4(Pokemon *mon, u32 monPersonality) +{ + Pokemon *newMon = Pokemon_New(0); + + Pokemon_Copy(mon, newMon); + + PokemonDataBlockA *newMonBlockA = BoxPokemon_GetDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_A); + PokemonDataBlockB *newMonBlockB = BoxPokemon_GetDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_B); + PokemonDataBlockC *newMonBlockC = BoxPokemon_GetDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_C); + PokemonDataBlockD *newMonBlockD = BoxPokemon_GetDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_D); + PokemonDataBlockA *monBlockA = BoxPokemon_GetDataBlock(&mon->box, monPersonality, DATA_BLOCK_A); + PokemonDataBlockB *monBlockB = BoxPokemon_GetDataBlock(&mon->box, monPersonality, DATA_BLOCK_B); + PokemonDataBlockC *monBlockC = BoxPokemon_GetDataBlock(&mon->box, monPersonality, DATA_BLOCK_C); + PokemonDataBlockD *monBlockD = BoxPokemon_GetDataBlock(&mon->box, monPersonality, DATA_BLOCK_D); + + Pokemon_DecryptData(&newMon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, newMon->box.checksum); + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + + mon->box.personality = monPersonality; + + *monBlockA = *newMonBlockA; + *monBlockB = *newMonBlockB; + *monBlockC = *newMonBlockC; + *monBlockD = *newMonBlockD; + + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Heap_FreeToHeap(newMon); +} + +static void PokemonPersonalData_LoadSpecies(int monSpecies, PokemonPersonalData *monPersonalData) +{ + NARC_ReadWholeMemberByIndexPair(monPersonalData, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, monSpecies); +} + +static void PokemonPersonalData_LoadForm(int monSpecies, int monForm, PokemonPersonalData *monPersonalData) +{ + monSpecies = Pokemon_GetFormNarcIndex(monSpecies, monForm); + NARC_ReadWholeMemberByIndexPair(monPersonalData, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, monSpecies); +} + +static void PokemonEvolutionData_LoadSpecies(int monSpecies, PokemonEvolutionData *monEvolutionData) +{ + NARC_ReadWholeMemberByIndexPair(monEvolutionData, NARC_INDEX_POKETOOL__PERSONAL__EVO, monSpecies); +} + +static void Pokemon_EncryptData(void *data, u32 bytes, u32 seed) +{ + EncryptData(data, bytes, seed); +} + +static void Pokemon_DecryptData(void *data, u32 bytes, u32 seed) +{ + DecryptData(data, bytes, seed); +} + +static u16 Pokemon_GetDataChecksum(void *data, u32 bytes) +{ + int i; + u16 checksum = 0; + + u16 *dataWords = data; + + for (i = 0; i < bytes / 2; i++) { + checksum += dataWords[i]; + } + + return checksum; +} + +#define DATA_BLOCK_SHUFFLE_CASE(v1, v2, v3, v4) \ +{ \ + PokemonDataBlock *dataBlocks = boxMon->dataBlocks; \ + switch (dataBlockID) \ + { \ + case DATA_BLOCK_A: \ + result = &dataBlocks[v1]; \ + break; \ + case DATA_BLOCK_B: \ + result = &dataBlocks[v2]; \ + break; \ + case DATA_BLOCK_C: \ + result = &dataBlocks[v3]; \ + break; \ + case DATA_BLOCK_D: \ + result = &dataBlocks[v4]; \ + break; \ + } \ + break; \ +} + +static void *BoxPokemon_GetDataBlock(BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID) +{ + personality = (personality & 0x3e000) >> 13; + GF_ASSERT(personality <= 31); + + void *result; + switch (personality) { + case 0: + case 24: + DATA_BLOCK_SHUFFLE_CASE(0,1,2,3) + case 1: + case 25: + DATA_BLOCK_SHUFFLE_CASE(0,1,3,2) + case 2: + case 26: + DATA_BLOCK_SHUFFLE_CASE(0,2,1,3) + case 3: + case 27: + DATA_BLOCK_SHUFFLE_CASE(0,3,1,2) + case 4: + case 28: + DATA_BLOCK_SHUFFLE_CASE(0,2,3,1) + case 5: + case 29: + DATA_BLOCK_SHUFFLE_CASE(0,3,2,1) + case 6: + case 30: + DATA_BLOCK_SHUFFLE_CASE(1,0,2,3) + case 7: + case 31: + DATA_BLOCK_SHUFFLE_CASE(1,0,3,2) + case 8: + DATA_BLOCK_SHUFFLE_CASE(2,0,1,3) + case 9: + DATA_BLOCK_SHUFFLE_CASE(3,0,1,2) + case 10: + DATA_BLOCK_SHUFFLE_CASE(2,0,3,1) + case 11: + DATA_BLOCK_SHUFFLE_CASE(3,0,2,1) + case 12: + DATA_BLOCK_SHUFFLE_CASE(1,2,0,3) + case 13: + DATA_BLOCK_SHUFFLE_CASE(1,3,0,2) + case 14: + DATA_BLOCK_SHUFFLE_CASE(2,1,0,3) + case 15: + DATA_BLOCK_SHUFFLE_CASE(3,1,0,2) + case 16: + DATA_BLOCK_SHUFFLE_CASE(2,3,0,1) + case 17: + DATA_BLOCK_SHUFFLE_CASE(3,2,0,1) + case 18: + DATA_BLOCK_SHUFFLE_CASE(1,2,3,0) + case 19: + DATA_BLOCK_SHUFFLE_CASE(1,3,2,0) + case 20: + DATA_BLOCK_SHUFFLE_CASE(2,1,3,0) + case 21: + DATA_BLOCK_SHUFFLE_CASE(3,1,2,0) + case 22: + DATA_BLOCK_SHUFFLE_CASE(2,3,1,0) + case 23: + DATA_BLOCK_SHUFFLE_CASE(3,2,1,0) + } + + return result; +} + +static int Pokemon_GetFormNarcIndex(int monSpecies, int monForm) +{ + // TODO enum values? + switch (monSpecies) { + case SPECIES_DEOXYS: + if (monForm && monForm <= 3) { + monSpecies = (496 - 1) + monForm; + } + break; + case SPECIES_WORMADAM: + if (monForm && monForm <= 2) { + monSpecies = (499 - 1) + monForm; + } + break; + case SPECIES_GIRATINA: + if (monForm && monForm <= 1) { + monSpecies = (501 - 1) + monForm; + } + break; + case SPECIES_SHAYMIN: + if (monForm && monForm <= 1) { + monSpecies = (502 - 1) + monForm; + } + break; + case SPECIES_ROTOM: + if (monForm && monForm <= 5) { + monSpecies = (503 - 1) + monForm; + } + break; + default: + break; + } + + return monSpecies; +} + +u32 Pokemon_GetFlagMaskOf(int index) +{ + int i; + u32 bitMask = 1; + + GF_ASSERT(index < 32); + + for (i = 0; i < index; i++) { + bitMask <<= 1; + } + + return bitMask; +} + +int Pokemon_GetLowestFlagIndex(u32 num) +{ + int i; + u32 bit = 1; + + for (i = 0; i < 32; i++) { + if (num & bit) { + break; + } + + bit <<= 1; + } + + return i; +} + +static const u16 Unk_020F05BE[18] = { + 0x96, + 0x97, + 0xF9, + 0xFA, + 0xFB, + 0x17E, + 0x17F, + 0x180, + 0x181, + 0x182, + 0x1E3, + 0x1E4, + 0x1E7, + 0x1E9, + 0x1EA, + 0x1EB, + 0x1EC, + 0x1ED +}; + +BOOL sub_02078804(u16 param0) +{ + for (u32 i = 0; i < NELEMS(Unk_020F05BE); i++) { + if (param0 == Unk_020F05BE[i]) { + return 1; + } + } + + return 0; +} + +u16 sub_02078824(u8 index) +{ + if (index >= NELEMS(Unk_020F05BE)) { + index = 0; + } + + return Unk_020F05BE[index]; +} + +BOOL sub_02078838(Pokemon *mon) +{ + u16 monSpecies = (u16)Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + return sub_02078804(monSpecies); +} + +BOOL sub_0207884C(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID) +{ + u32 v0 = sub_02025F20(param1); + u32 monOTID = BoxPokemon_GetValue(boxMon, MON_DATA_OT_ID, NULL); + u32 v2 = sub_02025F30(param1); + u32 monOtGender = BoxPokemon_GetValue(boxMon, MON_DATA_OT_GENDER, NULL); + Strbuf *v4 = sub_02025F04(param1, heapID); + // TODO enum/const value? + Strbuf *v5 = Strbuf_Init(8, heapID); + BOOL v6 = FALSE; + + BoxPokemon_GetValue(boxMon, MON_DATA_145, v5); + + if (v0 == monOTID && v2 == monOtGender && Strbuf_Compare(v4, v5) == 0) { + v6 = TRUE; + } + + Strbuf_Free(v5); + Strbuf_Free(v4); + + return v6; +} + +int sub_020788D0(int param0) +{ + // TODO enum values? + switch (param0) { + case 0: + case 1: + break; + case 63: + param0 = 2; + break; + case 90: + case 91: + case 92: + case 93: + case 94: + param0 = 3 + (param0 - 90); + break; + case 103: + case 104: + param0 = 8 + (param0 - 103); + break; + default: + if (sub_020793AC(param0) == 1) { + param0 = 1; + } else { + param0 = 0; + } + break; + } + + return param0; +} + +void sub_0207893C(Pokemon *mon) +{ + u8 zero = 0; + + UnkStruct_0202CA28 v1; + MI_CpuClearFast(&v1, sizeof(UnkStruct_0202CA28)); + + Pokemon_SetValue(mon, MON_DATA_162, &zero); + Pokemon_SetValue(mon, MON_DATA_171, &v1); +} + +void sub_0207896C(BoxPokemon *boxMon) +{ + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + + for (int i = 0; i < 4; i++) { + if (BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1 + i, NULL)) { + u8 moveMaxPP = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_MAX_PP + i, NULL); + + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + i, &moveMaxPP); + } + } + + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); +} + +static inline int Pokemon_GetLowestBitInverse(int num) +{ + int result = (num & 0x1) ? 0 : 1; + return result; +} + +void sub_020789BC(NARC *narc, UnkStruct_02007C10 *param1, u16 param2, u16 param3) +{ + int v1 = Pokemon_GetLowestBitInverse(param3); + + UnkStruct_020789BC v0; + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + MI_CpuCopy8(&v0.unk_00[v1].unk_03[0], param1, sizeof(UnkStruct_02007C10) * 10); +} + +void sub_020789F4(NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *param2, u16 param3, int param4, int param5, int param6) +{ + int v3 = (param4 == 2) ? 0 : 1; + + UnkStruct_020789BC v1; + NARC_ReadFromMember(narc, 0, param3 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v1); + + UnkStruct_020789F4 v0; + v0.unk_00 = v1.unk_00[v3].unk_01; + v0.unk_02 = v1.unk_00[v3].unk_02; + v0.unk_04 = param5; + + sub_02015FCC(param1, param2, &v0, param6); +} + +void sub_02078A4C(NARC *narc, u8 *param1, u16 param2, u16 param3) +{ + int v1 = Pokemon_GetLowestBitInverse(param3); + + UnkStruct_020789BC v0; + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + + *param1 = v0.unk_00[v1].unk_00; +} + +void sub_02078A80(NARC *narc, s8 *param1, u16 param2) +{ + UnkStruct_020789BC v0; + + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + *param1 = v0.unk_56; +} + +void sub_02078AA4(NARC *narc, s8 *param1, u16 param2) +{ + UnkStruct_020789BC v0; + + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + *param1 = v0.unk_57; +} + +void sub_02078AC8(NARC *narc, u8 *param1, u16 param2) +{ + UnkStruct_020789BC v0; + + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + *param1 = v0.unk_58; +} + +BOOL sub_02078AEC(int param0, Pokemon *mon, int heapID) +{ + int v0 = param0; + + if (v0 == 0) { + return FALSE; + } + + NARC *narc = NARC_ctor(NARC_INDEX_APPLICATION__CUSTOM_BALL__EDIT__PL_CB_DATA, heapID); + v0 = v0 - 1; + int one = 1; + + UnkStruct_0202CA28 v2; + NARC_ReadFromMember(narc, 0, v0 * sizeof(UnkStruct_0202CA28), sizeof(UnkStruct_0202CA28), &v2); + Pokemon_SetValue(mon, MON_DATA_162, &one); + Pokemon_SetValue(mon, MON_DATA_171, &v2); + NARC_dtor(narc); + + return TRUE; +} + +void sub_02078B40(Pokemon *mon, UnkStruct_02078B40 *param1) +{ + if (mon->box.partyDecrypted == FALSE) { + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + } + + BoxPokemon *boxMon = Pokemon_GetBoxPokemon(mon); + + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); + + param1->personality = boxMon->personality; + param1->partyDecrypted = FALSE; + param1->boxDecrypted = FALSE; + param1->invalidData = boxMon->invalidData; + param1->species = monDataBlockA->species; + param1->heldItem = monDataBlockA->heldItem; + param1->otID = monDataBlockA->otID; + param1->exp = monDataBlockA->exp; + param1->friendship = monDataBlockA->friendship; + param1->ability = monDataBlockA->ability; + param1->hpEV = monDataBlockA->hpEV; + param1->atkEV = monDataBlockA->atkEV; + param1->defEV = monDataBlockA->defEV; + param1->speedEV = monDataBlockA->speedEV; + param1->spAtkEV = monDataBlockA->spAtkEV; + param1->spDefEV = monDataBlockA->spDefEV; + param1->originLanguage = monDataBlockA->originLanguage; + + int i; + for (i = 0; i < 4; i++) { + param1->unk_1C[i] = monDataBlockB->moves[i]; + param1->unk_24[i] = monDataBlockB->moveCurrentPPs[i]; + param1->unk_28[i] = monDataBlockB->movePPUps[i]; + } + + param1->hpIV = monDataBlockB->hpIV; + param1->atkIV = monDataBlockB->atkIV; + param1->defIV = monDataBlockB->defIV; + param1->speedIV = monDataBlockB->speedIV; + param1->spAtkIV = monDataBlockB->spAtkIV; + param1->spDefIV = monDataBlockB->spDefIV; + param1->isEgg = monDataBlockB->isEgg; + param1->unk_2C_31 = monDataBlockB->unk_10_31; + param1->fatefulEncounter = monDataBlockB->fatefulEncounter; + param1->gender = monDataBlockB->gender; + param1->form = monDataBlockB->form; + + for (i = 0; i < 10 + 1; i++) { + param1->unk_32[i] = monDataBlockC->unk_00[i]; + } + + for (i = 0; i < 7 + 1; i++) { + param1->unk_48[i] = monDataBlockD->unk_00[i]; + } + + param1->pokeball = monDataBlockD->pokeball; + + param1->unk_5C = mon->party.unk_00; + param1->level = mon->party.level; + param1->unk_61 = mon->party.unk_05; + param1->unk_62 = mon->party.unk_06; + param1->unk_64 = mon->party.unk_08; + param1->unk_66 = mon->party.unk_0A; + param1->unk_68 = mon->party.unk_0C; + param1->unk_6A = mon->party.unk_0E; + param1->unk_6C = mon->party.unk_10; + param1->unk_6E = mon->party.unk_12; + + if (mon->box.partyDecrypted == FALSE) { + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + } +} + +void sub_02078E0C(UnkStruct_02078B40 *param0, Pokemon *mon) +{ + MI_CpuClearFast(mon, sizeof(Pokemon)); + + BoxPokemon *boxMon = Pokemon_GetBoxPokemon(mon); + + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, param0->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, param0->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, param0->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, param0->personality, DATA_BLOCK_D); + + boxMon->personality = param0->personality; + boxMon->partyDecrypted = FALSE; + boxMon->boxDecrypted = FALSE; + boxMon->invalidData = param0->invalidData; + + monDataBlockA->species = param0->species; + monDataBlockA->heldItem = param0->heldItem; + monDataBlockA->otID = param0->otID; + monDataBlockA->exp = param0->exp; + monDataBlockA->friendship = param0->friendship; + monDataBlockA->ability = param0->ability; + monDataBlockA->hpEV = param0->hpEV; + monDataBlockA->atkEV = param0->atkEV; + monDataBlockA->defEV = param0->defEV; + monDataBlockA->speedEV = param0->speedEV; + monDataBlockA->spAtkEV = param0->spAtkEV; + monDataBlockA->spDefEV = param0->spDefEV; + monDataBlockA->originLanguage = param0->originLanguage; + + int i; + for (i = 0; i < 4; i++) { + monDataBlockB->moves[i] = param0->unk_1C[i]; + monDataBlockB->moveCurrentPPs[i] = param0->unk_24[i]; + monDataBlockB->movePPUps[i] = param0->unk_28[i]; + } + + monDataBlockB->hpIV = param0->hpIV; + monDataBlockB->atkIV = param0->atkIV; + monDataBlockB->defIV = param0->defIV; + monDataBlockB->speedIV = param0->speedIV; + monDataBlockB->spAtkIV = param0->spAtkIV; + monDataBlockB->spDefIV = param0->spDefIV; + monDataBlockB->isEgg = param0->isEgg; + monDataBlockB->unk_10_31 = param0->unk_2C_31; + monDataBlockB->fatefulEncounter = param0->fatefulEncounter; + monDataBlockB->gender = param0->gender; + monDataBlockB->form = param0->form; + + for (i = 0; i < 10 + 1; i++) { + monDataBlockC->unk_00[i] = param0->unk_32[i]; + } + + for (i = 0; i < 7 + 1; i++) { + monDataBlockD->unk_00[i] = param0->unk_48[i]; + } + + monDataBlockD->pokeball = param0->pokeball; + + mon->party.unk_00 = param0->unk_5C; + mon->party.level = param0->level; + mon->party.unk_05 = param0->unk_61; + mon->party.unk_06 = param0->unk_62; + mon->party.unk_08 = param0->unk_64; + mon->party.unk_0A = param0->unk_66; + mon->party.unk_0C = param0->unk_68; + mon->party.unk_0E = param0->unk_6A; + mon->party.unk_10 = param0->unk_6C; + mon->party.unk_12 = param0->unk_6E; + + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); +} diff --git a/src/roaming_pokemon.c b/src/roaming_pokemon.c index 301a7a4a70..bdf26d6c34 100644 --- a/src/roaming_pokemon.c +++ b/src/roaming_pokemon.c @@ -6,7 +6,7 @@ #include "constants/species.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_0202D7B0.h" @@ -17,7 +17,7 @@ #include "unk_02025E68.h" #include "unk_0202D7A8.h" #include "roaming_pokemon.h" -#include "unk_02073C2C.h" +#include "pokemon.h" typedef struct { u16 unk_00; @@ -291,15 +291,15 @@ void RoamingPokemon_ActivateSlot (UnkStruct_021C0794 * saveData, const u8 slot) sub_0202D980(v1, 6, level); v4 = sub_02025E38(saveData); - v0 = AllocMonZeroed(4); + v0 = Pokemon_New(4); - ZeroMonData(v0); + Pokemon_Init(v0); sub_02073D80(v0, species, level, 32, 0, 0, 1, sub_02025F24(v4)); sub_0202D980(v1, 7, 0); sub_0202D980(v1, 8, 1); - sub_0202D980(v1, 2, GetMonData(v0, MON_DATA_175, NULL)); - sub_0202D980(v1, 3, GetMonData(v0, MON_DATA_PERSONALITY, NULL)); - sub_0202D980(v1, 5, GetMonData(v0, MON_DATA_164, NULL)); + sub_0202D980(v1, 2, Pokemon_GetValue(v0, MON_DATA_COMBINED_IVS, NULL)); + sub_0202D980(v1, 3, Pokemon_GetValue(v0, MON_DATA_PERSONALITY, NULL)); + sub_0202D980(v1, 5, Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL)); Heap_FreeToHeap(v0); previouslyVisitedMap = sub_0202D8BC(v2); diff --git a/src/unk_02006224.c b/src/unk_02006224.c index 9cc46d7423..f7eab59e2b 100644 --- a/src/unk_02006224.c +++ b/src/unk_02006224.c @@ -85,7 +85,7 @@ BOOL sub_0200629C (const UnkStruct_0202CC84 * param0, u32 param1, int param2, in sub_02006350(); sub_02004BCC(14); - v0 = (sub_0201D2E8() % 8192); + v0 = (LCRNG_Next() % 8192); sub_0202CCB4(v3, sub_0202CCB0(param0)); { diff --git a/src/unk_0200B358.c b/src/unk_0200B358.c index 6f7ec54707..fc951100bc 100644 --- a/src/unk_0200B358.c +++ b/src/unk_0200B358.c @@ -7,7 +7,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202B4A0_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -24,7 +24,7 @@ #include "unk_02025E68.h" #include "unk_020277A4.h" #include "unk_0202B37C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_020996D0.h" @@ -209,7 +209,7 @@ void sub_0200B538 (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) u32 v1; v0 = MessageLoader_Init(1, 26, 412, param0->unk_04); - v1 = sub_02074570(param2, MON_DATA_SPECIES, NULL); + v1 = BoxPokemon_GetValue(param2, MON_DATA_SPECIES, NULL); MessageLoader_GetStrbuf(v0, v1, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); @@ -220,7 +220,7 @@ void sub_0200B578 (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { u32 v0; - v0 = sub_02074570(param2, MON_DATA_SPECIES, NULL); + v0 = BoxPokemon_GetValue(param2, MON_DATA_SPECIES, NULL); sub_0200B594(param0, param1, v0); } @@ -237,13 +237,13 @@ void sub_0200B594 (UnkStruct_0200B358 * param0, u32 param1, u32 param2) void sub_0200B5CC (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { - sub_02074570(param2, MON_DATA_119, param0->unk_0C); + BoxPokemon_GetValue(param2, MON_DATA_119, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); } void sub_0200B5EC (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { - sub_02074570(param2, MON_DATA_145, param0->unk_0C); + BoxPokemon_GetValue(param2, MON_DATA_145, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); } diff --git a/src/unk_0200DA60.c b/src/unk_0200DA60.c index 8b6a727324..a1df00dc08 100644 --- a/src/unk_0200DA60.c +++ b/src/unk_0200DA60.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02009DC8_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/struct_0200D0F4.h" @@ -32,7 +32,7 @@ #include "unk_0201CCF0.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay005/ov5_021D2F14.h" typedef struct { diff --git a/src/unk_02014D38.c b/src/unk_02014D38.c index fb5f01c48d..708e07608c 100644 --- a/src/unk_02014D38.c +++ b/src/unk_02014D38.c @@ -282,7 +282,7 @@ u32 sub_02014EE4 (UnkStruct_02014EC4 * param0) } if (v1) { - int v2 = sub_0201D2E8() % v1; + int v2 = LCRNG_Next() % v1; for (v0 = 0; v0 < 32; v0++) { if (((param0->unk_04 >> v0) & 1) == 0) { diff --git a/src/unk_0201D15C.c b/src/unk_0201D15C.c index f3e922c3ec..76fa13413c 100644 --- a/src/unk_0201D15C.c +++ b/src/unk_0201D15C.c @@ -10,7 +10,7 @@ typedef struct { MATHCRC16Table unk_00; } UnkStruct_021BFB10; -static u16 sub_0201D608(u32 * param0); +static u16 LCRNG_NextFrom(u32 *seed); fx32 sub_0201D15C (u16 param0) { @@ -85,78 +85,78 @@ fx32 sub_0201D2C4 (fx32 param0) return sub_0201D264(v0); } -u32 Unk_021BFB14; +u32 gLCRNG_State; -u32 sub_0201D2D0 (void) +u32 LCRNG_GetSeed (void) { - return Unk_021BFB14; + return gLCRNG_State; } -void sub_0201D2DC (u32 param0) +void LCRNG_SetSeed (u32 seed) { - Unk_021BFB14 = param0; + gLCRNG_State = seed; } -u16 sub_0201D2E8 (void) +u16 LCRNG_Next (void) { - Unk_021BFB14 = Unk_021BFB14 * 1103515245L + 24691; - return (u16)(Unk_021BFB14 / 65536L); + gLCRNG_State = gLCRNG_State * 1103515245L + 24691; + return (u16)(gLCRNG_State / 65536L); } -u32 sub_0201D30C (u32 param0) +u32 ARNG_Next (u32 seed) { - return param0 * 1812433253L + 1; + return seed * 1812433253L + 1; } -static u32 Unk_021BFB18[624]; -static int Unk_02100834 = 624 + 1; -static u32 Unk_02100838[2] = {0x0UL, 0x9908b0dfUL}; +static u32 sMTRNG_State[624]; +static int sMTRNG_Size = 624 + 1; +static u32 sMTRNG_Xor[2] = {0x0UL, 0x9908b0dfUL}; -void sub_0201D318 (u32 param0) +void MTRNG_SetSeed (u32 seed) { - Unk_021BFB18[0] = param0 & 0xffffffff; + sMTRNG_State[0] = seed & 0xffffffff; - for (Unk_02100834 = 1; Unk_02100834 < 624; Unk_02100834++) { - Unk_021BFB18[Unk_02100834] = (1812433253UL * (Unk_021BFB18[Unk_02100834 - 1] ^ (Unk_021BFB18[Unk_02100834 - 1] >> 30)) + Unk_02100834); - Unk_021BFB18[Unk_02100834] &= 0xffffffff; + for (sMTRNG_Size = 1; sMTRNG_Size < 624; sMTRNG_Size++) { + sMTRNG_State[sMTRNG_Size] = (1812433253UL * (sMTRNG_State[sMTRNG_Size - 1] ^ (sMTRNG_State[sMTRNG_Size - 1] >> 30)) + sMTRNG_Size); + sMTRNG_State[sMTRNG_Size] &= 0xffffffff; } } -u32 sub_0201D35C (void) +u32 MTRNG_Next (void) { - u32 v0; + u32 result; - if (Unk_02100834 >= 624) { - int v1; + if (sMTRNG_Size >= 624) { + int i; - if (Unk_02100834 == 624 + 1) { - sub_0201D318(5489UL); + if (sMTRNG_Size == 624 + 1) { + MTRNG_SetSeed(5489UL); } - for (v1 = 0; v1 < 624 - 397; v1++) { - v0 = (Unk_021BFB18[v1] & 0x80000000UL) | (Unk_021BFB18[v1 + 1] & 0x7fffffffUL); - Unk_021BFB18[v1] = Unk_021BFB18[v1 + 397] ^ (v0 >> 1) ^ Unk_02100838[v0 & 0x1UL]; + for (i = 0; i < 624 - 397; i++) { + result = (sMTRNG_State[i] & 0x80000000UL) | (sMTRNG_State[i + 1] & 0x7fffffffUL); + sMTRNG_State[i] = sMTRNG_State[i + 397] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL]; } - for (; v1 < 624 - 1; v1++) { - v0 = (Unk_021BFB18[v1] & 0x80000000UL) | (Unk_021BFB18[v1 + 1] & 0x7fffffffUL); - Unk_021BFB18[v1] = Unk_021BFB18[v1 + (397 - 624)] ^ (v0 >> 1) ^ Unk_02100838[v0 & 0x1UL]; + for (; i < 624 - 1; i++) { + result = (sMTRNG_State[i] & 0x80000000UL) | (sMTRNG_State[i + 1] & 0x7fffffffUL); + sMTRNG_State[i] = sMTRNG_State[i + (397 - 624)] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL]; } - v0 = (Unk_021BFB18[624 - 1] & 0x80000000UL) | (Unk_021BFB18[0] & 0x7fffffffUL); + result = (sMTRNG_State[624 - 1] & 0x80000000UL) | (sMTRNG_State[0] & 0x7fffffffUL); - Unk_021BFB18[624 - 1] = Unk_021BFB18[397 - 1] ^ (v0 >> 1) ^ Unk_02100838[v0 & 0x1UL]; - Unk_02100834 = 0; + sMTRNG_State[624 - 1] = sMTRNG_State[397 - 1] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL]; + sMTRNG_Size = 0; } - v0 = Unk_021BFB18[Unk_02100834++]; + result = sMTRNG_State[sMTRNG_Size++]; - v0 ^= (v0 >> 11); - v0 ^= (v0 << 7) & 0x9d2c5680UL; - v0 ^= (v0 << 15) & 0xefc60000UL; - v0 ^= (v0 >> 18); + result ^= (result >> 11); + result ^= (result << 7) & 0x9d2c5680UL; + result ^= (result << 15) & 0xefc60000UL; + result ^= (result >> 18); - return v0; + return result; } void sub_0201D470 (MtxFx22 * param0, u16 param1, fx32 param2, fx32 param3, u8 param4) @@ -229,25 +229,25 @@ u32 sub_0201D5B8 (const void * param0, u32 param1) return v0; } -void sub_0201D5D4 (void * param0, u32 param1, u32 param2) +void EncryptData (void *data, u32 bytes, u32 seed) { - int v0; - u16 * v1 = (u16 *)param0; + int i; + u16 *dataWords = (u16 *)data; - for (v0 = 0; v0 < param1 / 2; v0++) { - v1[v0] ^= sub_0201D608(¶m2); + for (i = 0; i < bytes / 2; i++) { + dataWords[i] ^= LCRNG_NextFrom(&seed); } } -void sub_0201D600 (void * param0, u32 param1, u32 param2) +void DecryptData (void *data, u32 bytes, u32 seed) { - sub_0201D5D4(param0, param1, param2); + EncryptData(data, bytes, seed); } -static u16 sub_0201D608 (u32 * param0) +static u16 LCRNG_NextFrom (u32 *seed) { - param0[0] = param0[0] * 1103515245L + 24691; - return (u16)(param0[0] / 65536L); + seed[0] = seed[0] * 1103515245L + 24691; + return (u16)(seed[0] / 65536L); } static UnkStruct_021BFB10 * Unk_021BFB10 = NULL; diff --git a/src/unk_020244AC.c b/src/unk_020244AC.c index 074831f634..05a260d1f1 100644 --- a/src/unk_020244AC.c +++ b/src/unk_020244AC.c @@ -1163,7 +1163,7 @@ int sub_02025574 (UnkStruct_021C0794 * param0, int param1, void * param2) sub_020259F8(param0, param1, &v3, &v4, &v6); do { - v5 = sub_0201D30C(v3); + v5 = ARNG_Next(v3); } while (v5 == 0xffffffff); sub_02025A18(param0, param1, v5, v3, v6 ^ 1); diff --git a/src/unk_020261E4.c b/src/unk_020261E4.c index f755549fba..14ead71474 100644 --- a/src/unk_020261E4.c +++ b/src/unk_020261E4.c @@ -4,11 +4,11 @@ #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_0202818C.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "unk_020244AC.h" #include "unk_020261E4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" typedef struct UnkStruct_02026224_t { UnkStruct_0202818C unk_00; @@ -39,8 +39,8 @@ void sub_020261EC (UnkStruct_02026310 * param0) { memset(param0, 0, sizeof(UnkStruct_02026310)); - ZeroBoxMonData(¶m0->unk_00[0].unk_00); - ZeroBoxMonData(¶m0->unk_00[1].unk_00); + BoxPokemon_Init(¶m0->unk_00[0].unk_00); + BoxPokemon_Init(¶m0->unk_00[1].unk_00); param0->unk_D8 = 0; param0->unk_DC = 0; @@ -114,8 +114,8 @@ BOOL sub_02026280 (UnkStruct_02026310 * param0) { int v0, v1; - v0 = sub_02074570(¶m0->unk_00[0].unk_00, MON_DATA_LANGUAGE, NULL); - v1 = sub_02074570(¶m0->unk_00[1].unk_00, MON_DATA_LANGUAGE, NULL); + v0 = BoxPokemon_GetValue(¶m0->unk_00[0].unk_00, MON_DATA_LANGUAGE, NULL); + v1 = BoxPokemon_GetValue(¶m0->unk_00[1].unk_00, MON_DATA_LANGUAGE, NULL); if (v0 != v1) { return 1; @@ -147,7 +147,7 @@ void sub_020262C0 (UnkStruct_02026224 * param0) void sub_020262F4 (UnkStruct_02026218 * param0) { - ZeroBoxMonData(¶m0->unk_00); + BoxPokemon_Init(¶m0->unk_00); param0->unk_68 = 0; sub_020262C0(¶m0->unk_08); } diff --git a/src/unk_0202631C.c b/src/unk_0202631C.c index 2f0950731d..51575e8acb 100644 --- a/src/unk_0202631C.c +++ b/src/unk_0202631C.c @@ -3,13 +3,13 @@ #include "inlines.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "heap.h" #include "unk_020244AC.h" #include "unk_0202631C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020986CC.h" typedef struct UnkStruct_02026324_t { @@ -464,7 +464,7 @@ static BOOL sub_020268D8 (const UnkStruct_02026324 * param0, u32 param1) static void sub_020268FC (UnkStruct_02026324 * param0, u16 param1, Pokemon * param2) { - u8 v0 = GetMonData(param2, MON_DATA_FORM, NULL); + u8 v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); u32 v1; if (param1 == 386) { @@ -571,38 +571,38 @@ static void sub_02026A60 (UnkStruct_02026324 * param0, u16 param1, Pokemon * par switch (param1) { case 201: - v0 = sub_02076AF8(param2); + v0 = Pokemon_GetForm(param2); sub_0202643C(param0, v0); break; case 412: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020267B8(param0, param1, v0); break; case 413: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020267B8(param0, param1, v0); break; case 422: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020265E8(param0, param1, v0); break; case 423: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020265E8(param0, param1, v0); break; case 386: sub_020268FC(param0, param1, param2); break; case 492: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020265E8(param0, param1, v0); break; case 487: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020265E8(param0, param1, v0); break; case 479: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_02026A00(param0, param1, v0); break; default: @@ -630,7 +630,7 @@ static u32 sub_02026BAC (const UnkStruct_02026324 * param0, u16 param1, int para u32 v0, v1; u32 v2; - if (sub_020759F0(param1, 18) == 255) { + if (PokemonPersonalData_GetSpeciesValue(param1, 18) == 255) { if (param2 == 0) { return 2; } else { @@ -1069,9 +1069,9 @@ u32 sub_02027288 (const UnkStruct_02026324 * param0) void sub_020272A4 (UnkStruct_02026324 * param0, Pokemon * param1) { - u16 v0 = GetMonData(param1, MON_DATA_SPECIES, NULL); - u32 v1 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - u32 v2 = sub_02075D6C(param1); + u16 v0 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + u32 v1 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + u32 v2 = Pokemon_GetGender(param1); u32 v3; inline_02026DD0(param0); @@ -1097,10 +1097,10 @@ void sub_020272A4 (UnkStruct_02026324 * param0, Pokemon * param1) void sub_0202736C (UnkStruct_02026324 * param0, Pokemon * param1) { - u16 v0 = GetMonData(param1, MON_DATA_SPECIES, NULL); - u32 v1 = GetMonData(param1, MON_DATA_LANGUAGE, NULL); - u32 v2 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - u32 v3 = sub_02075D6C(param1); + u16 v0 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + u32 v1 = Pokemon_GetValue(param1, MON_DATA_LANGUAGE, NULL); + u32 v2 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + u32 v3 = Pokemon_GetGender(param1); u32 v4; inline_02026DD0(param0); diff --git a/src/unk_02028124.c b/src/unk_02028124.c index b1a332e314..2fbe3c012b 100644 --- a/src/unk_02028124.c +++ b/src/unk_02028124.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -18,7 +18,7 @@ #include "unk_02025E08.h" #include "unk_02025E68.h" #include "unk_02028124.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" @@ -112,9 +112,9 @@ void sub_020281AC (UnkStruct_0202818C * param0, u8 param1, u8 param2, UnkStruct_ for (v0 = param2, v1 = 0; v0 < Party_GetCurrentCount(v9); v0++) { v10 = Party_GetPokemonBySlotIndex(v9, v0); - v4 = GetMonData(v10, MON_DATA_SPECIES, NULL); - v6 = GetMonData(v10, MON_DATA_IS_EGG, NULL); - v7 = GetMonData(v10, MON_DATA_FORM, NULL); + v4 = Pokemon_GetValue(v10, MON_DATA_SPECIES, NULL); + v6 = Pokemon_GetValue(v10, MON_DATA_IS_EGG, NULL); + v7 = Pokemon_GetValue(v10, MON_DATA_FORM, NULL); v5 = sub_02079D80(v10); v2 = sub_02079EDC(v4, v7, v6); diff --git a/src/unk_0202854C.c b/src/unk_0202854C.c index c3da5d823d..bde574f802 100644 --- a/src/unk_0202854C.c +++ b/src/unk_0202854C.c @@ -199,7 +199,7 @@ void sub_02028658 (UnkStruct_021C0794 * param0, int param1) } } - v0->unk_90 = sub_0201D30C(v0->unk_90 + param1); + v0->unk_90 = ARNG_Next(v0->unk_90 + param1); v0->unk_9AC_0 = 1; } diff --git a/src/unk_020298BC.c b/src/unk_020298BC.c index 3af3807f9e..2fb47b4618 100644 --- a/src/unk_020298BC.c +++ b/src/unk_020298BC.c @@ -4,7 +4,7 @@ #include "inlines.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_02014A84.h" @@ -20,7 +20,7 @@ #include "strbuf.h" #include "unk_020244AC.h" #include "unk_020298BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay022/ov22_02259098.h" typedef struct UnkStruct_0202A138_t { @@ -124,12 +124,12 @@ static void sub_020298D8 (UnkStruct_020298D8 * param0, u8 * param1, u8 * param2, static void sub_0202992C (UnkStruct_0202A138 * param0, Pokemon * param1, u8 param2, u8 param3, s8 param4) { - param0->unk_08 = GetMonData(param1, MON_DATA_SPECIES, NULL); - GetMonData(param1, MON_DATA_117, param0->unk_0A); + param0->unk_08 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + Pokemon_GetValue(param1, MON_DATA_117, param0->unk_0A); - param0->unk_00 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - param0->unk_04 = GetMonData(param1, MON_DATA_OT_ID, NULL); - param0->unk_33 = GetMonData(param1, MON_DATA_FORM, NULL); + param0->unk_00 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + param0->unk_04 = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); + param0->unk_33 = Pokemon_GetValue(param1, MON_DATA_FORM, NULL); param0->unk_31 = param2; param0->unk_32 = param3; @@ -154,8 +154,8 @@ static void sub_020299C0 (UnkStruct_0202A138 * param0, const Strbuf *param1, int static void sub_020299D8 (const UnkStruct_0202A138 * param0, Pokemon * param1) { sub_02073D80(param1, param0->unk_08, 0, 0, 1, param0->unk_00, 1, param0->unk_04); - sub_02074B30(param1, 117, param0->unk_0A); - sub_02074B30(param1, 112, ¶m0->unk_33); + Pokemon_SetValue(param1, 117, param0->unk_0A); + Pokemon_SetValue(param1, 112, ¶m0->unk_33); } static void sub_02029A18 (UnkStruct_0202A150 * param0, u8 param1, u8 param2, u8 param3, u8 param4) diff --git a/src/unk_0202B37C.c b/src/unk_0202B37C.c index e5f1982fef..37c5e3ac5e 100644 --- a/src/unk_0202B37C.c +++ b/src/unk_0202B37C.c @@ -45,7 +45,7 @@ void sub_0202B3D8 (UnkStruct_0202B4A0 * param0, u32 param1) for (v0 = 0; v0 < 6; v0++) { for (v1 = 0; v1 < param1; v1++) { - param0->unk_00[v0].unk_28 = sub_0201D30C(param0->unk_00[v0].unk_28); + param0->unk_00[v0].unk_28 = ARNG_Next(param0->unk_00[v0].unk_28); } } } @@ -58,7 +58,7 @@ u32 sub_0202B400 (UnkStruct_0202B4A0 * param0, int param1) void sub_0202B40C (UnkStruct_0202B4A0 * param0, int param1, u32 param2) { param0->unk_00[param1].unk_24 = param2; - param0->unk_00[param1].unk_28 = sub_0201D30C(param2); + param0->unk_00[param1].unk_28 = ARNG_Next(param2); } u32 sub_0202B428 (UnkStruct_0202B4A0 * param0) diff --git a/src/unk_0202CD50.c b/src/unk_0202CD50.c index 1ca0384162..f4ba9acb16 100644 --- a/src/unk_0202CD50.c +++ b/src/unk_0202CD50.c @@ -49,7 +49,7 @@ static void sub_0202CD94 (UnkStruct_0202CD88 * param0, int param1) } param0->unk_1B8.unk_00 = sub_0201D5B8(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32)) & 0xffff; - sub_0201D5D4(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32), param0->unk_1B8.unk_00 + (param0->unk_1B8.unk_02 << 16)); + EncryptData(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32), param0->unk_1B8.unk_00 + (param0->unk_1B8.unk_02 << 16)); } static void sub_0202CDC0 (UnkStruct_0202CD88 * param0, int param1) @@ -58,7 +58,7 @@ static void sub_0202CDC0 (UnkStruct_0202CD88 * param0, int param1) return; } - sub_0201D600(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32), param0->unk_1B8.unk_00 + (param0->unk_1B8.unk_02 << 16)); + DecryptData(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32), param0->unk_1B8.unk_00 + (param0->unk_1B8.unk_02 << 16)); } static u32 sub_0202CDE0 (const UnkStruct_0202CD88 * param0, int param1) diff --git a/src/unk_0202D7A8.c b/src/unk_0202D7A8.c index a68b87e97d..ec911eeab3 100644 --- a/src/unk_0202D7A8.c +++ b/src/unk_0202D7A8.c @@ -22,8 +22,8 @@ void sub_0202D7B0 (UnkStruct_0202D7B0 * param0) { memset(param0, 0, sizeof(UnkStruct_0202D7B0)); - param0->unk_00 = sub_0201D35C(); - param0->unk_04 = sub_0201D35C(); + param0->unk_00 = MTRNG_Next(); + param0->unk_04 = MTRNG_Next(); param0->unk_08.unk_00 = 0; param0->unk_08.unk_04 = 0xffff; param0->unk_08.unk_06 = 0xffff; diff --git a/src/unk_0202DA40.c b/src/unk_0202DA40.c index 0d50ec7f53..0d57b630dd 100644 --- a/src/unk_0202DA40.c +++ b/src/unk_0202DA40.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "unk_020244AC.h" diff --git a/src/unk_0202DF8C.c b/src/unk_0202DF8C.c index 48edc3347f..2d4a968f75 100644 --- a/src/unk_0202DF8C.c +++ b/src/unk_0202DF8C.c @@ -4,7 +4,7 @@ #include "inlines.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0202DF8C.h" @@ -14,7 +14,7 @@ #include "strbuf.h" #include "unk_0202DF8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" static int inline inline_0202E1A8(const UnkStruct_0202DF8C * param0, int param1); @@ -52,24 +52,24 @@ void sub_0202DFA8 (UnkStruct_0202DF8C * param0, const Party * param1, const RTCD for (v4 = 0, v5 = 0; v4 < v3; v4++) { v1 = Party_GetPokemonBySlotIndex(param1, v4); - v6 = sub_02073C88(v1); - - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v0->unk_00[v5].unk_00 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v0->unk_00[v5].unk_02 = GetMonData(v1, MON_DATA_161, NULL); - v0->unk_00[v5].unk_03 = GetMonData(v1, MON_DATA_FORM, NULL); - v0->unk_00[v5].unk_04 = GetMonData(v1, MON_DATA_PERSONALITY, NULL); - v0->unk_00[v5].unk_08 = GetMonData(v1, MON_DATA_OT_ID, NULL); - v0->unk_00[v5].unk_32[0] = GetMonData(v1, MON_DATA_MOVE1, NULL); - v0->unk_00[v5].unk_32[1] = GetMonData(v1, MON_DATA_MOVE2, NULL); - v0->unk_00[v5].unk_32[2] = GetMonData(v1, MON_DATA_MOVE3, NULL); - v0->unk_00[v5].unk_32[3] = GetMonData(v1, MON_DATA_MOVE4, NULL); + v6 = Pokemon_EnterDecryptionContext(v1); + + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v0->unk_00[v5].unk_00 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v0->unk_00[v5].unk_02 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); + v0->unk_00[v5].unk_03 = Pokemon_GetValue(v1, MON_DATA_FORM, NULL); + v0->unk_00[v5].unk_04 = Pokemon_GetValue(v1, MON_DATA_PERSONALITY, NULL); + v0->unk_00[v5].unk_08 = Pokemon_GetValue(v1, MON_DATA_OT_ID, NULL); + v0->unk_00[v5].unk_32[0] = Pokemon_GetValue(v1, MON_DATA_MOVE1, NULL); + v0->unk_00[v5].unk_32[1] = Pokemon_GetValue(v1, MON_DATA_MOVE2, NULL); + v0->unk_00[v5].unk_32[2] = Pokemon_GetValue(v1, MON_DATA_MOVE3, NULL); + v0->unk_00[v5].unk_32[3] = Pokemon_GetValue(v1, MON_DATA_MOVE4, NULL); if (v2) { - GetMonData(v1, MON_DATA_119, v2); + Pokemon_GetValue(v1, MON_DATA_119, v2); Strbuf_ToChars(v2, v0->unk_00[v5].unk_0C, 11); - GetMonData(v1, MON_DATA_145, v2); + Pokemon_GetValue(v1, MON_DATA_145, v2); Strbuf_ToChars(v2, v0->unk_00[v5].unk_22, 8); } else { v0->unk_00[v5].unk_0C[0] = 0xffff; @@ -79,7 +79,7 @@ void sub_0202DFA8 (UnkStruct_0202DF8C * param0, const Party * param1, const RTCD v5++; } - sub_02073CD4(v1, v6); + Pokemon_ExitDecryptionContext(v1, v6); } v0->unk_168 = param2->year; diff --git a/src/unk_0202EEC0.c b/src/unk_0202EEC0.c index 5ec35e3b67..f59b57d66b 100644 --- a/src/unk_0202EEC0.c +++ b/src/unk_0202EEC0.c @@ -1,12 +1,11 @@ #include #include -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "unk_0201378C.h" #include "unk_0202EEC0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" typedef struct UnkStruct_02024440_t { Pokemon unk_00[6]; @@ -28,8 +27,8 @@ void sub_0202EEC8 (UnkStruct_02024440 * param0) MI_CpuClearFast(param0, sizeof(UnkStruct_02024440)); for (v0 = 0; v0 < 6; v0++) { - ZeroMonData(¶m0->unk_00[v0]); - GF_ASSERT(GetMonData(¶m0->unk_00[v0], MON_DATA_172, NULL) == 0); + Pokemon_Init(¶m0->unk_00[v0]); + GF_ASSERT(Pokemon_GetValue(¶m0->unk_00[v0], MON_DATA_172, NULL) == 0); } } @@ -40,8 +39,8 @@ void sub_0202EF04 (UnkStruct_02024440 * param0) MI_CpuClearFast(param0->unk_00, sizeof(Pokemon) * 6); for (v0 = 0; v0 < 6; v0++) { - ZeroMonData(¶m0->unk_00[v0]); - GF_ASSERT(GetMonData(¶m0->unk_00[v0], MON_DATA_172, NULL) == 0); + Pokemon_Init(¶m0->unk_00[v0]); + GF_ASSERT(Pokemon_GetValue(¶m0->unk_00[v0], MON_DATA_172, NULL) == 0); } } @@ -76,7 +75,7 @@ static int sub_0202EF40 (UnkStruct_02024440 * param0, u32 param1) void sub_0202EFA4 (UnkStruct_02024440 * param0, BoxPokemon * param1, int param2) { - sub_020774C8(param1, ¶m0->unk_00[param2]); + Pokemon_FromBoxPokemon(param1, ¶m0->unk_00[param2]); } void sub_0202EFB8 (UnkStruct_02024440 * param0, u32 param1) @@ -101,7 +100,7 @@ int sub_0202F028 (const UnkStruct_02024440 * param0) int v0, v1; for (v1 = 0, v0 = 0; v0 < 6; v0++) { - if (GetMonData((Pokemon *)¶m0->unk_00[v0], MON_DATA_172, NULL)) { + if (Pokemon_GetValue((Pokemon *)¶m0->unk_00[v0], MON_DATA_172, NULL)) { v1++; } } diff --git a/src/unk_0202F180.c b/src/unk_0202F180.c index 2d35e19d94..ea9cf0fee1 100644 --- a/src/unk_0202F180.c +++ b/src/unk_0202F180.c @@ -2,22 +2,21 @@ #include #include "struct_decls/struct_02026324_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "unk_0202631C.h" #include "unk_0202CD50.h" #include "unk_0202F180.h" #include "unk_02056720.h" -#include "unk_02073C2C.h" +#include "pokemon.h" void sub_0202F180 (UnkStruct_021C0794 * param0, const Pokemon * param1) { - if (GetMonData((Pokemon *)param1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue((Pokemon *)param1, MON_DATA_IS_EGG, NULL) == 0) { UnkStruct_02026324 * v0 = sub_02027560(param0); - sub_0202D040(sub_0202CD88(param0), v0, GetMonData((Pokemon *)param1, MON_DATA_SPECIES, NULL)); + sub_0202D040(sub_0202CD88(param0), v0, Pokemon_GetValue((Pokemon *)param1, MON_DATA_SPECIES, NULL)); sub_0202736C(v0, (Pokemon *)param1); sub_02056A48(sub_02056B24(param0), (const BoxPokemon *)param1); } diff --git a/src/unk_0202F1D4.c b/src/unk_0202F1D4.c index 41e788b6db..ad7f0db98a 100644 --- a/src/unk_0202F1D4.c +++ b/src/unk_0202F1D4.c @@ -12,7 +12,7 @@ #include "struct_defs/struct_0202FAA8.h" #include "struct_defs/struct_0202FD30.h" #include "struct_defs/struct_02030A80.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02078B40.h" #include "struct_defs/struct_party.h" #include "overlay006/battle_params.h" @@ -29,7 +29,7 @@ #include "unk_0202631C.h" #include "unk_020279FC.h" #include "unk_0202F1D4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" UnkStruct_0202F264 * Unk_021C07A4 = NULL; @@ -302,9 +302,9 @@ static void sub_0202F510 (UnkStruct_021C0794 * param0, UnkStruct_0202F41C * para for (v1 = 0; v1 < v3; v1++) { v7 = &(param2->unk_1150[v5].unk_04[v1]); - if ((v7->unk_2C_30 == 0) && (v7->unk_04_2 == 0)) { - param1->unk_00[v4] = v7->unk_06; - param1->unk_18[v4] = v7->unk_30_3; + if ((v7->isEgg == 0) && (v7->invalidData == 0)) { + param1->unk_00[v4] = v7->species; + param1->unk_18[v4] = v7->form; } v4++; @@ -393,11 +393,11 @@ static BOOL sub_0202F794 (UnkStruct_021C0794 * param0, const UnkStruct_0202F264 for (v4 = 0; v4 < 6; v4++) { v6 = &(v0->unk_1150[v3].unk_04[v4]); - if (v6->unk_06 > 495) { + if (v6->species > 495) { return 0; } - if (v6->unk_08 > 467) { + if (v6->heldItem > 467) { return 0; } @@ -415,12 +415,12 @@ static BOOL sub_0202F794 (UnkStruct_021C0794 * param0, const UnkStruct_0202F264 void sub_0202F858 (void * param0, u32 param1, u32 param2) { - sub_0201D5D4(param0, param1, param2); + EncryptData(param0, param1, param2); } static void sub_0202F860 (void * param0, u32 param1, u32 param2) { - sub_0201D600(param0, param1, param2); + DecryptData(param0, param1, param2); } void sub_0202F868 (int param0, int param1, u8 param2) @@ -601,13 +601,13 @@ static void sub_0202FD30 (UnkStruct_0202FD30 * param0, Party * param1) Pokemon * v1; u8 v2 = 0; - v1 = AllocMonZeroed(11); + v1 = Pokemon_New(11); Party_InitWithCapacity(param1, param0->unk_00); for (v0 = 0; v0 < param0->unk_02; v0++) { sub_02078E0C(¶m0->unk_04[v0], v1); - sub_02074B30(v1, 162, &v2); + Pokemon_SetValue(v1, 162, &v2); Party_AddPokemon(param1, v1); } diff --git a/src/unk_02030A80.c b/src/unk_02030A80.c index 8ac5086b6e..a7dd858bbb 100644 --- a/src/unk_02030A80.c +++ b/src/unk_02030A80.c @@ -25,7 +25,7 @@ #include "unk_0202C858.h" #include "unk_02030A80.h" #include "unk_0205C980.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020996D0.h" UnkStruct_02030A80 * sub_02030A80 (int param0) @@ -112,7 +112,7 @@ int sub_02030BCC (const UnkStruct_02030A80 * param0) return 0; } - return SanitizeFormId(param0->unk_1C, param0->unk_1B_1); + return Pokemon_SanitizeFormId(param0->unk_1C, param0->unk_1B_1); } int sub_02030BEC (const UnkStruct_02030A80 * param0) diff --git a/src/unk_02030CE8.c b/src/unk_02030CE8.c index 46726c8e1d..3a2e60d44d 100644 --- a/src/unk_02030CE8.c +++ b/src/unk_02030CE8.c @@ -138,7 +138,7 @@ u32 sub_02030E48 (UnkStruct_021C0794 * param0, UnkStruct_ov96_0223B574 * param1) sub_02030DD0(param0, param1); - v0 = sub_0201D2E8() % 1000; + v0 = LCRNG_Next() % 1000; param1->unk_58 = v0; param1->unk_5A = 0xffff; diff --git a/src/unk_0203A9C8.c b/src/unk_0203A9C8.c index efbe7d9f5f..6091846924 100644 --- a/src/unk_0203A9C8.c +++ b/src/unk_0203A9C8.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_02026324_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_decls/struct_0207CB08_decl.h" @@ -90,7 +90,7 @@ #include "unk_0207064C.h" #include "unk_0207070C.h" #include "unk_02071D40.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0207AE68.h" @@ -1341,7 +1341,7 @@ static BOOL sub_0203BC5C (UnkStruct_020508D4 * param0) Heap_FreeToHeap(v1->unk_260); - if ((Item_IsMail(v10) == 1) && (GetMonData(v8, MON_DATA_HELD_ITEM, NULL) == 0)) { + if ((Item_IsMail(v10) == 1) && (Pokemon_GetValue(v8, MON_DATA_HELD_ITEM, NULL) == 0)) { UnkStruct_02097728 * v11; UnkStruct_0203C540 * v12; diff --git a/src/unk_0203D1B8.c b/src/unk_0203D1B8.c index 074109badf..d694574868 100644 --- a/src/unk_0203D1B8.c +++ b/src/unk_0203D1B8.c @@ -13,7 +13,7 @@ #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" @@ -108,7 +108,7 @@ #include "unk_0206AFE0.h" #include "unk_0206B70C.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0207AE68.h" @@ -1004,8 +1004,8 @@ static void sub_0203DB38 (UnkStruct_ov88_0223C370 * param0, UnkStruct_0203CDB0 * param0->unk_1C = param1->unk_9C; param0->unk_20 = sub_0202CD88(param1->unk_0C); param0->unk_38 = Heap_AllocFromHeap(32, sub_02025E68()); - param0->unk_3C = Heap_AllocFromHeap(32, sub_02076AF0()); - param0->unk_40 = Heap_AllocFromHeap(32, sub_02076AF0()); + param0->unk_3C = Heap_AllocFromHeap(32, Pokemon_GetStructSize()); + param0->unk_40 = Heap_AllocFromHeap(32, Pokemon_GetStructSize()); param0->unk_00 = param1; param0->unk_34 = 0; } @@ -1060,8 +1060,8 @@ BOOL sub_0203DBF0 (UnkStruct_020508D4 * param0) break; case 4: v2->unk_48.unk_08 = v2->unk_04.unk_38; - v2->unk_48.unk_00 = sub_02076B10(v2->unk_04.unk_3C); - v2->unk_48.unk_04 = sub_02076B10(v2->unk_04.unk_40); + v2->unk_48.unk_00 = Pokemon_GetBoxPokemon(v2->unk_04.unk_3C); + v2->unk_48.unk_04 = Pokemon_GetBoxPokemon(v2->unk_04.unk_40); v2->unk_48.unk_14 = sub_02025E44(v1->unk_0C); v2->unk_48.unk_10 = 1; @@ -1089,7 +1089,7 @@ BOOL sub_0203DBF0 (UnkStruct_020508D4 * param0) break; case 5: { - int v3 = GetMonData(v2->unk_04.unk_40, MON_DATA_HELD_ITEM, NULL); + int v3 = Pokemon_GetValue(v2->unk_04.unk_40, MON_DATA_HELD_ITEM, NULL); int v4; int v5; @@ -1104,7 +1104,7 @@ BOOL sub_0203DBF0 (UnkStruct_020508D4 * param0) break; case 6: if (sub_0207B0D0(v2->unk_60)) { - sub_020775EC(v2->unk_04.unk_40, Party_GetPokemonBySlotIndex(v2->unk_04.unk_08, v2->unk_04.unk_2C)); + Pokemon_Copy(v2->unk_04.unk_40, Party_GetPokemonBySlotIndex(v2->unk_04.unk_08, v2->unk_04.unk_2C)); sub_0207B0E0(v2->unk_60); Heap_Destroy(26); v2->unk_00 = 7; @@ -1265,7 +1265,7 @@ static void sub_0203DF68 (UnkStruct_020508D4 * param0) int v4; v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v1->unk_04); - sub_02074B30(v3, 118, (u8 *)&v1->unk_0C->unk_1C); + Pokemon_SetValue(v3, 118, (u8 *)&v1->unk_0C->unk_1C); } break; case 5: @@ -1300,8 +1300,8 @@ void sub_0203DFE8 (UnkStruct_020508D4 * param0, int param1, int param2, int para switch (param1) { case 1: v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v1->unk_0C), v2->unk_04); - v2->unk_0C->unk_10 = GetMonData(v0, MON_DATA_111, NULL); - v2->unk_0C->unk_08 = GetMonData(v0, MON_DATA_FORM, NULL); + v2->unk_0C->unk_10 = Pokemon_GetValue(v0, MON_DATA_GENDER, NULL); + v2->unk_0C->unk_08 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); if (param5 != NULL) { Strbuf_CopyChars(v2->unk_10, param5); @@ -1642,21 +1642,21 @@ static u8 sub_0203E484 (UnkStruct_021C0794 * param0, u8 param1) u8 v3[12]; u8 v4, v5, v6, v7; - v2 = sub_0201D2D0(); + v2 = LCRNG_GetSeed(); - sub_0201D2DC(sub_0202B428(v1)); + LCRNG_SetSeed(sub_0202B428(v1)); MI_CpuCopy8(v0, v3, sizeof(v3)); for (v4 = 0; v4 < 12; v4++) { for (v5 = v4 + 1; v5 < 12; v5++) { - v6 = sub_0201D2E8() % 12; + v6 = LCRNG_Next() % 12; v7 = v3[v4]; v3[v4] = v3[v6]; v3[v6] = v7; } } - sub_0201D2DC(v2); + LCRNG_SetSeed(v2); return v3[param1]; } diff --git a/src/unk_0203E880.c b/src/unk_0203E880.c index 136aecdd4f..580a1e1ae2 100644 --- a/src/unk_0203E880.c +++ b/src/unk_0203E880.c @@ -1017,23 +1017,23 @@ void sub_0203F310 (UnkStruct_0203CDB0 * param0) { u8 v0; - v0 = (sub_0201D2E8() % (NELEMS(Unk_02100AE0))); + v0 = (LCRNG_Next() % (NELEMS(Unk_02100AE0))); if (param0->unk_1C->unk_00 != Unk_02100AE0[v0][0]) { sub_0203F1B0(param0, (730 + Unk_02100AE0[v0][1])); } - v0 = (sub_0201D2E8() % (NELEMS(Unk_02100AE0))); + v0 = (LCRNG_Next() % (NELEMS(Unk_02100AE0))); if (param0->unk_1C->unk_00 != Unk_02100AE0[v0][0]) { sub_0203F1B0(param0, (730 + Unk_02100AE0[v0][1])); } if (param0->unk_1C->unk_00 != 256) { - v0 = (sub_0201D2E8() % (NELEMS(Unk_02100AD4))); + v0 = (LCRNG_Next() % (NELEMS(Unk_02100AD4))); sub_0203F1B0(param0, (730 + Unk_02100AD4[v0])); - v0 = (sub_0201D2E8() % (NELEMS(Unk_02100AD4))); + v0 = (LCRNG_Next() % (NELEMS(Unk_02100AD4))); sub_0203F1B0(param0, (730 + Unk_02100AD4[v0])); } diff --git a/src/unk_0203F6C4.c b/src/unk_0203F6C4.c index 3b23f2a397..f5d18893ac 100644 --- a/src/unk_0203F6C4.c +++ b/src/unk_0203F6C4.c @@ -33,8 +33,7 @@ #include "struct_decls/struct_0205E884_decl.h" #include "struct_decls/struct_02061830_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -185,7 +184,7 @@ #include "unk_02071CD0.h" #include "unk_02071D40.h" #include "unk_020722AC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "unk_020797C8.h" #include "party.h" @@ -3632,7 +3631,7 @@ static BOOL sub_0204174C (UnkStruct_0203E724 * param0) u16 * v2 = inline_0204FCAC(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - *v2 = sub_02076AF8(v0); + *v2 = Pokemon_GetForm(v0); return 0; } @@ -4135,7 +4134,7 @@ static BOOL sub_02041F14 (UnkStruct_0203E724 * param0) sub_0200DAA4(param0->unk_34->unk_08, 3, 1024 - (18 + 12) - 9, 11, 0, 4); *v1 = sub_0200EC48(param0->unk_34->unk_08, 3, 10, 5, 11, 1024 - (18 + 12) - 9, v0, 4); - sub_020451B4(param0->unk_34, GetMonData(v0, MON_DATA_SPECIES, NULL)); + sub_020451B4(param0->unk_34, Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL)); return 0; } @@ -4599,8 +4598,8 @@ static BOOL sub_02042718 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v2->unk_0C), v3); - GetMonData(v1, MON_DATA_117, v0); - sub_0203DFE8(param0->unk_28, 1, GetMonData(v1, MON_DATA_SPECIES, NULL), 10, v3, v0, inline_0204FCAC(param0)); + Pokemon_GetValue(v1, MON_DATA_117, v0); + sub_0203DFE8(param0->unk_28, 1, Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), 10, v3, v0, inline_0204FCAC(param0)); return 1; } @@ -6157,7 +6156,7 @@ static BOOL sub_02044398 (UnkStruct_0203E724 * param0) u16 * v1 = inline_0204FCAC(param0); u16 v2 = inline_02049538(param0); - *v1 = (sub_0201D2E8() % v2); + *v1 = (LCRNG_Next() % v2); return 1; } @@ -6168,7 +6167,7 @@ static BOOL sub_020443D0 (UnkStruct_0203E724 * param0) u16 * v1 = inline_0204FCAC(param0); u16 v2 = inline_02049538(param0); - *v1 = (sub_0201D2E8() % v2); + *v1 = (LCRNG_Next() % v2); return 1; } @@ -6603,7 +6602,7 @@ static BOOL sub_02044BE8 (UnkStruct_0203E724 * param0) u16 v2, v3, v4, v5; v2 = sub_02026EAC(v0); - v3 = sub_0201D2E8() % v2; + v3 = LCRNG_Next() % v2; *v1 = 25; for (v4 = 1, v5 = 0; v4 <= 493; v4++) { @@ -6735,12 +6734,12 @@ static BOOL sub_02044E40 (UnkStruct_0203E724 * param0) v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v2); - v3[0] = GetMonData(v0, MON_DATA_HP_EV, NULL); - v3[1] = GetMonData(v0, MON_DATA_ATK_EV, NULL); - v3[2] = GetMonData(v0, MON_DATA_DEF_EV, NULL); - v3[3] = GetMonData(v0, MON_DATA_SPEED_EV, NULL); - v3[4] = GetMonData(v0, MON_DATA_SPATK_EV, NULL); - v3[5] = GetMonData(v0, MON_DATA_SPDEF_EV, NULL); + v3[0] = Pokemon_GetValue(v0, MON_DATA_HP_EV, NULL); + v3[1] = Pokemon_GetValue(v0, MON_DATA_ATK_EV, NULL); + v3[2] = Pokemon_GetValue(v0, MON_DATA_DEF_EV, NULL); + v3[3] = Pokemon_GetValue(v0, MON_DATA_SPEED_EV, NULL); + v3[4] = Pokemon_GetValue(v0, MON_DATA_SPATK_EV, NULL); + v3[5] = Pokemon_GetValue(v0, MON_DATA_SPDEF_EV, NULL); *v1 = (v3[0] + v3[1] + v3[2] + v3[3] + v3[4] + v3[5]); return 0; @@ -6774,8 +6773,8 @@ static BOOL sub_02044F24 (UnkStruct_0203E724 * param0) u16 v4, v5; v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v3); - v4 = GetMonData(v0, MON_DATA_SPECIES, NULL); - v5 = GetMonData(v0, MON_DATA_FORM, NULL); + v4 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); *v1 = ov5_021F0E90(v4, v5); *v2 = ov5_021F0E84(v4); @@ -6901,9 +6900,9 @@ static BOOL sub_02045198 (UnkStruct_0203E724 * param0) static void sub_020451B4 (UnkStruct_0203CDB0 * param0, u16 param1) { UnkStruct_02026324 * v0 = sub_02027560(param0->unk_0C); - Pokemon * v1 = AllocMonZeroed(32); + Pokemon * v1 = Pokemon_New(32); - ZeroMonData(v1); + Pokemon_Init(v1); sub_02073D80(v1, param1, 50, 32, 0, 0, 0, 0); sub_020272A4(v0, v1); Heap_FreeToHeap(v1); @@ -7023,11 +7022,11 @@ static BOOL sub_02045384 (UnkStruct_0203E724 * param0) for (v2 = 0; v2 < v4; v2++) { v5 = Party_GetPokemonBySlotIndex(v1, v2); - v3 = GetMonData(v5, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL); if (v3 == 386) { - sub_02074B30(v5, 112, &v0); - sub_0207418C(v5); + Pokemon_SetValue(v5, 112, &v0); + Pokemon_CalcLevelAndStats(v5); sub_0202736C(v6, v5); } } @@ -7048,9 +7047,9 @@ static BOOL sub_02045404 (UnkStruct_0203E724 * param0) for (v1 = 0; v1 < v9; v1++) { v0 = Party_GetPokemonBySlotIndex(v8, v1); - v2 = GetMonData(v0, MON_DATA_SPECIES, NULL); - v6 = GetMonData(v0, MON_DATA_111, NULL); - v5 = GetMonData(v0, MON_DATA_IS_EGG, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v6 = Pokemon_GetValue(v0, MON_DATA_GENDER, NULL); + v5 = Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); if ((v2 == 415) && (v5 == 0)) { if (v6 == 0) { @@ -7175,7 +7174,7 @@ static BOOL sub_02045650 (UnkStruct_0203E724 * param0) return 0; } - v5 = sub_0201D2E8() % v4; + v5 = LCRNG_Next() % v4; for (v3 = 0; v3 < (49 - 34 + 1); v3++) { if (v2[v3] == 1) { @@ -7417,7 +7416,7 @@ static BOOL sub_020459BC (UnkStruct_0203E724 * param0) v2 = 270; } else if (v6 >= 30) { v2 = 268; - } else if (sub_0201D2E8() % 100 < 25) { + } else if (LCRNG_Next() % 100 < 25) { v2 = 269; } else { static const u16 v9[] = { @@ -7441,7 +7440,7 @@ static BOOL sub_020459BC (UnkStruct_0203E724 * param0) 0x214 }; - v2 = sub_0201D2E8() % 6; + v2 = LCRNG_Next() % 6; v2 = v9[v2 + (v5 * 6)]; } @@ -7653,7 +7652,7 @@ static BOOL sub_02045D70 (UnkStruct_0203E724 * param0) v1 = 100; } - v0 = sub_0201D2E8() % 101; + v0 = LCRNG_Next() % 101; if (v0 <= v1) { *v2 = 1; @@ -8103,7 +8102,7 @@ BOOL sub_0204645C (UnkStruct_0203E724 * param0) *v6 = 0xfff; *v7 = 0xfff; *v8 = 0xfff; - v0 = (sub_0201D2E8() % (NELEMS(Unk_020EAB96))); + v0 = (LCRNG_Next() % (NELEMS(Unk_020EAB96))); *v5 = Unk_020EAB96[v0]; v1 = sub_02046524(v0, 0xfff, 0xfff, 0xfff); @@ -8135,7 +8134,7 @@ static u8 sub_02046524 (u16 param0, u16 param1, u16 param2, u16 param3) v1 = 0; while (TRUE) { - v0 = (sub_0201D2E8() % ((NELEMS(Unk_020EAB96)) + 1)); + v0 = (LCRNG_Next() % ((NELEMS(Unk_020EAB96)) + 1)); if (v0 == (NELEMS(Unk_020EAB96))) { break; @@ -8164,7 +8163,7 @@ static u8 sub_02046568 (u16 param0, u16 param1, u16 param2, u16 param3) v1 = 0; while (TRUE) { - v0 = (sub_0201D2E8() % ((NELEMS(Unk_020EAB8C)) + 1)); + v0 = (LCRNG_Next() % ((NELEMS(Unk_020EAB8C)) + 1)); if (v0 == (NELEMS(Unk_020EAB8C))) { break; @@ -8297,8 +8296,8 @@ static u32 sub_0204676C (UnkStruct_021C0794 * param0) for (v0 = 0; v0 < v5; v0++) { v1 = Party_GetPokemonBySlotIndex(v4, v0); - if ((GetMonData(v1, MON_DATA_SPECIES, NULL) == 479) && (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0)) { - v3 |= 1 << GetMonData(v1, MON_DATA_FORM, NULL); + if ((Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL) == 479) && (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0)) { + v3 |= 1 << Pokemon_GetValue(v1, MON_DATA_FORM, NULL); } } } @@ -8313,8 +8312,8 @@ static u32 sub_0204676C (UnkStruct_021C0794 * param0) v7 = sub_02026218(v6, v0); v2 = sub_02026220(v7); - if ((sub_02074570(v2, 5, NULL) == 479) && (sub_02074570(v2, MON_DATA_IS_EGG, NULL) == 0)) { - v3 |= 1 << sub_02074570(v2, MON_DATA_FORM, NULL); + if ((BoxPokemon_GetValue(v2, 5, NULL) == 479) && (BoxPokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0)) { + v3 |= 1 << BoxPokemon_GetValue(v2, MON_DATA_FORM, NULL); } } } @@ -8329,8 +8328,8 @@ static u32 sub_0204676C (UnkStruct_021C0794 * param0) for (v0 = 0; v0 < (5 * 6); v0++) { v2 = sub_02079C9C(v8, v9, v0); - if ((sub_02074570(v2, 5, NULL) == 479) && (sub_02074570(v2, MON_DATA_IS_EGG, NULL) == 0)) { - v3 |= 1 << sub_02074570(v2, MON_DATA_FORM, NULL); + if ((BoxPokemon_GetValue(v2, 5, NULL) == 479) && (BoxPokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0)) { + v3 |= 1 << BoxPokemon_GetValue(v2, MON_DATA_FORM, NULL); } } } @@ -8455,7 +8454,7 @@ static BOOL sub_020469D0 (UnkStruct_0203E724 * param0) u16 v2 = inline_02049538(param0); v1 = Party_GetFromSavedata(param0->unk_34->unk_0C); - sub_02077A9C(v1, v2); + Party_SetGiratinaForm(v1, v2); { int v3, v4; Pokemon * v5; @@ -8465,7 +8464,7 @@ static BOOL sub_020469D0 (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v4; v3++) { v5 = Party_GetPokemonBySlotIndex(v1, v3); - if ((GetMonData(v5, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v5, MON_DATA_SPECIES, NULL) == 487)) { + if ((Pokemon_GetValue(v5, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL) == 487)) { sub_0202736C(sub_02027560(v0->unk_0C), v5); } } @@ -8486,11 +8485,11 @@ static BOOL sub_02046A4C (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v2; v3++) { v4 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v3); - if (GetMonData(v4, MON_DATA_IS_EGG, NULL) == 0) { - v0 = GetMonData(v4, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v4, MON_DATA_IS_EGG, NULL) == 0) { + v0 = Pokemon_GetValue(v4, MON_DATA_SPECIES, NULL); if (v0 == 486) { - v1 = GetMonData(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL); + v1 = Pokemon_GetValue(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL); if (v1 == 1) { *v5 = 1; diff --git a/src/unk_02046C7C.c b/src/unk_02046C7C.c index 8a35ca8c4f..7a0a83cb43 100644 --- a/src/unk_02046C7C.c +++ b/src/unk_02046C7C.c @@ -7,7 +7,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0_sub2_t.h" #include "struct_defs/struct_0203E724_t.h" diff --git a/src/unk_020474B8.c b/src/unk_020474B8.c index ccef5b9516..9802e24593 100644 --- a/src/unk_020474B8.c +++ b/src/unk_020474B8.c @@ -8,8 +8,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_defs/struct_0203CDB0.h" @@ -31,7 +30,7 @@ #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" #include "unk_02071CFC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "item.h" @@ -446,7 +445,7 @@ BOOL sub_02047D00 (UnkStruct_0203E724 * param0) u16 v6; v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - v6 = GetMonData(v1, MON_DATA_MOVE1 + v5, NULL); + v6 = Pokemon_GetValue(v1, MON_DATA_MOVE1 + v5, NULL); sub_0200B630(*v2, v3, v6); return 0; diff --git a/src/unk_020480A8.c b/src/unk_020480A8.c index 5dfc4c6d03..892b757401 100644 --- a/src/unk_020480A8.c +++ b/src/unk_020480A8.c @@ -5,8 +5,7 @@ #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_defs/struct_0203CDB0.h" @@ -16,7 +15,7 @@ #include "unk_020480A8.h" #include "unk_020507CC.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" @@ -56,8 +55,8 @@ BOOL sub_020480D8 (UnkStruct_0203E724 * param0) for (v11 = 0, v12 = 0, v9 = 0; v9 < v8; v9++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v9); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v15 = (GetMonData(v1, MON_DATA_OT_ID, NULL) & 0xffff); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v15 = (Pokemon_GetValue(v1, MON_DATA_OT_ID, NULL) & 0xffff); v16 = sub_02048268(v7, v15); @@ -71,11 +70,11 @@ BOOL sub_020480D8 (UnkStruct_0203E724 * param0) for (v13 = 0, v14 = 0, v18 = 0; v18 < 18; v18++) { for (v17 = 0; v17 < (5 * 6); v17++) { v2 = sub_02079C9C(v3, v18, v17); - v19 = sub_02074570(v2, MON_DATA_SPECIES, NULL); + v19 = BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL); if (v19) { - if (sub_02074570(v2, MON_DATA_IS_EGG, NULL) == 0) { - v15 = (sub_02074570(v2, MON_DATA_OT_ID, NULL) & 0xffff); + if (BoxPokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0) { + v15 = (BoxPokemon_GetValue(v2, MON_DATA_OT_ID, NULL) & 0xffff); v16 = sub_02048268(v7, v15); diff --git a/src/unk_02048BD0.c b/src/unk_02048BD0.c index 97f3740de2..97ceac7bff 100644 --- a/src/unk_02048BD0.c +++ b/src/unk_02048BD0.c @@ -104,7 +104,7 @@ BOOL sub_02048BD0 (UnkStruct_0203E724 * param0) sub_0202B444(v1, 0, 1, v14); sub_0202B470(v1, 0, sub_02025F30(v15)); sub_0202B494(v1, 0, GAME_LANGUAGE); - sub_0202B40C(v1, 0, sub_0201D35C()); + sub_0202B40C(v1, 0, MTRNG_Next()); Strbuf_Free(v14); sub_0202B384(v1, 0, 1); sub_0206D424(param0->unk_34); diff --git a/src/unk_02048DD8.c b/src/unk_02048DD8.c index 16c8bdf637..caec252d5b 100644 --- a/src/unk_02048DD8.c +++ b/src/unk_02048DD8.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0202E7D8.h" @@ -37,7 +37,7 @@ #include "unk_02054884.h" #include "unk_02056720.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay006/ov6_022465FC.h" #include "overlay006/ov6_02246A30.h" @@ -290,7 +290,7 @@ static void sub_02049268 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * para Party * v0 = Party_GetFromSavedata(param0->unk_0C); Pokemon * v1 = sub_02054A74(v0); - sub_0200B538(param1, 0, sub_02076B10(v1)); + sub_0200B538(param1, 0, Pokemon_GetBoxPokemon(v1)); } static void sub_02049288 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param1) diff --git a/src/unk_02049D08.c b/src/unk_02049D08.c index 4e003fad39..9605c8b3e5 100644 --- a/src/unk_02049D08.c +++ b/src/unk_02049D08.c @@ -12,7 +12,7 @@ #include "struct_decls/struct_0202D764_decl.h" #include "struct_decls/struct_0203068C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -41,7 +41,7 @@ #include "unk_0206AFE0.h" #include "unk_0206B9D8.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" typedef struct { @@ -176,14 +176,14 @@ BOOL sub_02049EC4 (u16 param0, UnkStruct_021C0794 * param1, u8 param2) for (v0 = 0, v2 = 0; v0 < v3; v0++) { v7 = Party_GetPokemonBySlotIndex(v6, v0); - v4 = GetMonData(v7, MON_DATA_SPECIES, NULL); - v5 = GetMonData(v7, MON_DATA_HELD_ITEM, NULL); + v4 = Pokemon_GetValue(v7, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL); if (param2 == 0) { v5 = 0; } - if (GetMonData(v7, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v7, MON_DATA_IS_EGG, NULL) != 0) { continue; } @@ -447,8 +447,8 @@ BOOL sub_0204A378 (UnkStruct_0204AFC4 * param0, void ** param1, UnkStruct_021C07 for (v0 = 0; v0 < param0->unk_0E; v0++) { param0->unk_2A[v0] = v1->unk_2C[v0] - 1; v3 = Party_GetPokemonBySlotIndex(v2, param0->unk_2A[v0]); - param0->unk_2E[v0] = GetMonData(v3, MON_DATA_SPECIES, NULL); - param0->unk_36[v0] = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + param0->unk_2E[v0] = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); + param0->unk_36[v0] = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); } Heap_FreeToHeap(*param1); @@ -467,8 +467,8 @@ int sub_0204A410 (UnkStruct_0204AFC4 * param0, UnkStruct_021C0794 * param1) for (v0 = 0; v0 < param0->unk_0E; v0++) { v5 = Party_GetPokemonBySlotIndex(v4, param0->unk_2A[v0]); - v2[v0] = GetMonData(v5, MON_DATA_SPECIES, NULL); - v3[v0] = GetMonData(v5, MON_DATA_HELD_ITEM, NULL); + v2[v0] = Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL); + v3[v0] = Pokemon_GetValue(v5, MON_DATA_HELD_ITEM, NULL); if (v0 == 0) { continue; @@ -960,11 +960,11 @@ static u16 sub_0204AC54 (UnkStruct_021C0794 * param0, u8 param1, UnkStruct_0204A for (v2 = 0; v2 < param2->unk_0E; v2++) { v4 = Party_GetPokemonBySlotIndex(v3, param2->unk_2A[v2]); - if (GetMonData(v4, param1, NULL)) { + if (Pokemon_GetValue(v4, param1, NULL)) { continue; } - sub_02074B30(v4, param1, &v0); + Pokemon_SetValue(v4, param1, &v0); sub_0206DDB8(param0, v4, param1); ++v1; } @@ -998,28 +998,28 @@ static void sub_0204ACFC (UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * para { int v0; - param0->unk_00_val1_0 = GetMonData(param1, MON_DATA_SPECIES, NULL); - param0->unk_00_val1_11 = GetMonData(param1, MON_DATA_FORM, NULL); - param0->unk_02 = GetMonData(param1, MON_DATA_HELD_ITEM, NULL); + param0->unk_00_val1_0 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + param0->unk_00_val1_11 = Pokemon_GetValue(param1, MON_DATA_FORM, NULL); + param0->unk_02 = Pokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); for (v0 = 0; v0 < 4; v0++) { - param0->unk_04[v0] = GetMonData(param1, MON_DATA_MOVE1 + v0, NULL); - param0->unk_1E_val2 |= ((GetMonData(param1, MON_DATA_62 + v0, NULL))<< (v0 * 2)); + param0->unk_04[v0] = Pokemon_GetValue(param1, MON_DATA_MOVE1 + v0, NULL); + param0->unk_1E_val2 |= ((Pokemon_GetValue(param1, MON_DATA_MOVE1_PP_UPS + v0, NULL))<< (v0 * 2)); } - param0->unk_1F = GetMonData(param1, MON_DATA_LANGUAGE, NULL); - param0->unk_0C = GetMonData(param1, MON_DATA_OT_ID, NULL); - param0->unk_10 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - param0->unk_14_val2 = GetMonData(param1, MON_DATA_175, NULL); + param0->unk_1F = Pokemon_GetValue(param1, MON_DATA_LANGUAGE, NULL); + param0->unk_0C = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); + param0->unk_10 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + param0->unk_14_val2 = Pokemon_GetValue(param1, MON_DATA_COMBINED_IVS, NULL); for (v0 = 0; v0 < 6; v0++) { - param0->unk_18_val2[v0] = GetMonData(param1, MON_DATA_HP_EV + v0, NULL); + param0->unk_18_val2[v0] = Pokemon_GetValue(param1, MON_DATA_HP_EV + v0, NULL); } - param0->unk_20 = GetMonData(param1, MON_DATA_10, NULL); - param0->unk_21 = GetMonData(param1, MON_DATA_FRIENDSHIP, NULL); + param0->unk_20 = Pokemon_GetValue(param1, MON_DATA_ABILITY, NULL); + param0->unk_21 = Pokemon_GetValue(param1, MON_DATA_FRIENDSHIP, NULL); - GetMonData(param1, MON_DATA_117, param0->unk_22); + Pokemon_GetValue(param1, MON_DATA_117, param0->unk_22); } static void sub_0204AE20 (UnkStruct_0204AFC4 * param0, UnkStruct_021C0794 * param1, int param2) @@ -1071,7 +1071,7 @@ u8 sub_0204AE84 (u16 param0) u16 sub_0204AEC0 (UnkStruct_0204AFC4 * param0) { if (param0->unk_0F == 6) { - return sub_0201D2E8(); + return LCRNG_Next(); } param0->unk_08 = sub_0206BFF0(param0->unk_08); diff --git a/src/unk_0204AEE8.c b/src/unk_0204AEE8.c index 936b78feca..1866f07175 100644 --- a/src/unk_0204AEE8.c +++ b/src/unk_0204AEE8.c @@ -8,7 +8,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_02026324_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -32,7 +32,7 @@ #include "unk_02034198.h" #include "unk_02049D08.h" #include "unk_0204AEE8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" static BOOL sub_0204B470(UnkStruct_0204AFC4 * param0, UnkStruct_0204B184 * param1, u16 param2, UnkStruct_ov104_0223A348_sub2 * param3, u8 param4, u16 * param5, u16 * param6, UnkStruct_0204B404 * param7, int param8); @@ -210,7 +210,7 @@ void sub_0204B060 (UnkStruct_0204AFC4 * param0, UnkStruct_021C0794 * param1) v1 = Party_GetFromSavedata(param1); for (v0 = 0; v0 < 2; v0++) { - param0->unk_83E[1 + v0] = GetMonData(Party_GetPokemonBySlotIndex(v1, param0->unk_2A[v0]), MON_DATA_SPECIES, NULL); + param0->unk_83E[1 + v0] = Pokemon_GetValue(Party_GetPokemonBySlotIndex(v1, param0->unk_2A[v0]), MON_DATA_SPECIES, NULL); } param0->unk_83E[3] = sub_0202D3B4(param0->unk_74, 3, 0); @@ -345,7 +345,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s if (param4 == 0) { do { v2 = (sub_0204AEC0(param0) | sub_0204AEC0(param0) << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (sub_02075E38(param3, v2) == 1)); + } while ((v4.unk_0B != Pokemon_GetNatureOf(v2)) || (Pokemon_IsPersonalityShiny(param3, v2) == 1)); param1->unk_10 = v2; } else { @@ -363,7 +363,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { v1++; } } @@ -375,7 +375,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { param1->unk_18_val2[v0] = v1; } } @@ -383,16 +383,16 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s param1->unk_1E_val2 = 0; param1->unk_1F = Unk_020E4C44; - v0 = sub_020759F0(param1->unk_00_val1_0, 25); + v0 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 25); if (v0) { if (param1->unk_10 & 1) { param1->unk_20 = v0; } else { - param1->unk_20 = sub_020759F0(param1->unk_00_val1_0, 24); + param1->unk_20 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 24); } } else { - param1->unk_20 = sub_020759F0(param1->unk_00_val1_0, 24); + param1->unk_20 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 24); } param1->unk_21 = v3; diff --git a/src/unk_0204B830.c b/src/unk_0204B830.c index 841093184c..a153c915fc 100644 --- a/src/unk_0204B830.c +++ b/src/unk_0204B830.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" @@ -39,7 +39,7 @@ #include "unk_02054884.h" #include "unk_02056720.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_020923C0.h" @@ -202,89 +202,89 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) v4 = (Pokemon *)&v0->val1.unk_04; v14 = (u8 *)&v0->val1.unk_F0; - v12 = GetMonData(v4, MON_DATA_152, NULL); - v8 = GetMonData(v4, MON_DATA_PERSONALITY, NULL); - v7 = GetMonData(v4, MON_DATA_OT_ID, NULL); - v9 = sub_0201D30C((u32)OS_GetTick()); + v12 = Pokemon_GetValue(v4, MON_DATA_152, NULL); + v8 = Pokemon_GetValue(v4, MON_DATA_PERSONALITY, NULL); + v7 = Pokemon_GetValue(v4, MON_DATA_OT_ID, NULL); + v9 = ARNG_Next((u32)OS_GetTick()); if (v8 == 0x0) { (void)0; } else if (v8 == 0x1) { - while (sub_02075E38(v7, v9)) { - v9 = sub_0201D30C(v9); + while (Pokemon_IsPersonalityShiny(v7, v9)) { + v9 = ARNG_Next(v9); } } else { v9 = v8; } sub_020780C4(v4, v9); - v10 = sub_02075D6C(v4); + v10 = Pokemon_GetGender(v4); - sub_02074B30(v4, 111, (u8 *)&v10); - v10 = GetMonData(v4, MON_DATA_HP_IV, 0) + GetMonData(v4, MON_DATA_ATK_IV, 0) + GetMonData(v4, MON_DATA_DEF_IV, 0) + GetMonData(v4, MON_DATA_SPEED_IV, 0) + GetMonData(v4, MON_DATA_SPATK_IV, 0) + GetMonData(v4, MON_DATA_SPDEF_IV, 0); + Pokemon_SetValue(v4, 111, (u8 *)&v10); + v10 = Pokemon_GetValue(v4, MON_DATA_HP_IV, 0) + Pokemon_GetValue(v4, MON_DATA_ATK_IV, 0) + Pokemon_GetValue(v4, MON_DATA_DEF_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPEED_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPATK_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPDEF_IV, 0); if (v10 == 0) { - v8 = sub_0201D2E8(); + v8 = LCRNG_Next(); v9 = (v8 & (0x1F << 0)) >> 0; - sub_02074B30(v4, 70, (u8 *)&v9); + Pokemon_SetValue(v4, 70, (u8 *)&v9); v9 = (v8 & (0x1F << 5)) >> 5; - sub_02074B30(v4, 71, (u8 *)&v9); + Pokemon_SetValue(v4, 71, (u8 *)&v9); v9 = (v8 & (0x1F << 10)) >> 10; - sub_02074B30(v4, 72, (u8 *)&v9); + Pokemon_SetValue(v4, 72, (u8 *)&v9); - v8 = sub_0201D2E8(); + v8 = LCRNG_Next(); v9 = (v8 & (0x1F << 0)) >> 0; - sub_02074B30(v4, 73, (u8 *)&v9); + Pokemon_SetValue(v4, 73, (u8 *)&v9); v9 = (v8 & (0x1F << 5)) >> 5; - sub_02074B30(v4, 74, (u8 *)&v9); + Pokemon_SetValue(v4, 74, (u8 *)&v9); v9 = (v8 & (0x1F << 10)) >> 10; - sub_02074B30(v4, 75, (u8 *)&v9); + Pokemon_SetValue(v4, 75, (u8 *)&v9); } v13 = sub_0202D79C(param0->unk_0C); - if (GetMonData(v4, MON_DATA_46, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_46, 0)) { v13[sub_02092444(73)] = v14[0]; } - if (GetMonData(v4, MON_DATA_47, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_47, 0)) { v13[sub_02092444(74)] = v14[1]; } - if (GetMonData(v4, MON_DATA_48, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_48, 0)) { v13[sub_02092444(75)] = v14[2]; } - if (GetMonData(v4, MON_DATA_49, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_49, 0)) { v13[sub_02092444(76)] = v14[3]; } - if (GetMonData(v4, MON_DATA_50, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_50, 0)) { v13[sub_02092444(77)] = v14[4]; } - if (GetMonData(v4, MON_DATA_51, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_51, 0)) { v13[sub_02092444(78)] = v14[5]; } - if (GetMonData(v4, MON_DATA_52, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_52, 0)) { v13[sub_02092444(79)] = v14[6]; } - if (GetMonData(v4, MON_DATA_MARINE_RIBBON, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_MARINE_RIBBON, 0)) { v13[sub_02092444(25)] = v14[7]; } - if (GetMonData(v4, MON_DATA_LAND_RIBBON, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_LAND_RIBBON, 0)) { v13[sub_02092444(26)] = v14[8]; } - if (GetMonData(v4, MON_DATA_SKY_RIBBON, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_SKY_RIBBON, 0)) { v13[sub_02092444(27)] = v14[9]; } @@ -293,12 +293,12 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) u32 v16 = sub_02025F20(v1); u32 v17 = sub_02025F30(v1); - v6 = AllocMonZeroed(32); + v6 = Pokemon_New(32); - sub_020775EC(v4, v6); - sub_02074B30(v6, 145, v15); - sub_02074B30(v6, 7, &v16); - sub_02074B30(v6, 157, &v17); + Pokemon_Copy(v4, v6); + Pokemon_SetValue(v6, 145, v15); + Pokemon_SetValue(v6, 7, &v16); + Pokemon_SetValue(v6, 157, &v17); v4 = v6; Strbuf_Free(v15); @@ -306,15 +306,15 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) sub_0209304C(v4, v1, 4, sub_02017070(2, v12), 32); - if (GetMonData(v4, MON_DATA_SPECIES, NULL) == 493) { - if (GetMonData(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) { + if (Pokemon_GetValue(v4, MON_DATA_SPECIES, NULL) == 493) { + if (Pokemon_GetValue(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) { if (sub_0206B5F8(v2) == 0) { sub_0206B608(v2, 1); } } } - sub_0207418C(v4); + Pokemon_CalcLevelAndStats(v4); v3 = Party_GetFromSavedata(param0->unk_0C); v5 = Party_AddPokemon(v3, v4); @@ -339,7 +339,7 @@ static void sub_0204BDEC (UnkStruct_0204B830 * param0, u16 * param1, u16 * param v1 = (Pokemon *)&v0->val1.unk_04; sub_0200B498(param0->unk_04, 0, sub_02025E38(param0->unk_00->unk_0C)); - sub_0200B578(param0->unk_04, 1, sub_02076B10(v1)); + sub_0200B578(param0->unk_04, 1, Pokemon_GetBoxPokemon(v1)); } static void sub_0204BE2C (UnkStruct_0204B830 * param0, u16 * param1, u16 * param2) @@ -364,7 +364,7 @@ static void sub_0204BE44 (UnkStruct_0204B830 * param0, u16 * param1, u16 * param v1 = (Pokemon *)v0->val2.unk_04; sub_0200B498(param0->unk_04, 0, sub_02025E38(param0->unk_00->unk_0C)); - sub_0200B538(param0->unk_04, 1, sub_02076B10(v1)); + sub_0200B538(param0->unk_04, 1, Pokemon_GetBoxPokemon(v1)); } static BOOL sub_0204BE84 (UnkStruct_0203CDB0 * param0, void * param1) diff --git a/src/unk_0204C500.c b/src/unk_0204C500.c index 5bddf58b13..4b13d2e4e4 100644 --- a/src/unk_0204C500.c +++ b/src/unk_0204C500.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_02026324_decl.h" #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_defs/struct_0203E724_t.h" @@ -23,7 +23,7 @@ #include "unk_020507CC.h" #include "unk_020562F8.h" #include "unk_0206A8DC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02092494.h" @@ -48,7 +48,7 @@ BOOL sub_0204C500 (UnkStruct_0203E724 * param0) BOOL sub_0204C554 (UnkStruct_0203E724 * param0) { UnkStruct_02024440 * v0 = sub_02024440(param0->unk_34->unk_0C); - Pokemon * v1 = AllocMonZeroed(32); + Pokemon * v1 = Pokemon_New(32); u16 * v2 = inline_0204FCAC(param0); if (sub_0202F028(v0) == 6) { @@ -65,7 +65,7 @@ BOOL sub_0204C59C (UnkStruct_0203E724 * param0) { UnkStruct_02024440 * v0 = sub_02024440(param0->unk_34->unk_0C); UnkStruct_020797DC * v1 = sub_02024420(param0->unk_34->unk_0C); - Pokemon * v2 = AllocMonZeroed(32); + Pokemon * v2 = Pokemon_New(32); UnkStruct_02025E6C * v3 = sub_02025E38(param0->unk_34->unk_0C); UnkStruct_02026324 * v4 = sub_02027560(param0->unk_34->unk_0C); BOOL v5; @@ -74,7 +74,7 @@ BOOL sub_0204C59C (UnkStruct_0203E724 * param0) for (v6 = 0; v6 < 6; v6++) { sub_0202F000(v0, v6, v2); sub_0209304C(v2, v3, 2, 0, 32); - v5 = sub_02079868(v1, sub_02076B10(v2)); + v5 = sub_02079868(v1, Pokemon_GetBoxPokemon(v2)); GF_ASSERT(v5); sub_0202F180(param0->unk_34->unk_0C, v2); } diff --git a/src/unk_0204CDDC.c b/src/unk_0204CDDC.c index bc863b5389..8372c823d8 100644 --- a/src/unk_0204CDDC.c +++ b/src/unk_0204CDDC.c @@ -46,7 +46,7 @@ BOOL sub_0204CE1C (UnkStruct_0203E724 * param0) u16 * v3 = inline_0204FCAC(param0); u16 v4 = inline_02049538(param0); - v2 = sub_0201D2E8() % 100; + v2 = LCRNG_Next() % 100; if (v2 < 15) { v0 = 0; @@ -136,7 +136,7 @@ BOOL sub_0204CF68 (UnkStruct_0203E724 * param0) { u16 * v0 = inline_0204FCAC(param0); - *v0 = (sub_0201D2E8() % (NELEMS(Unk_020EBF64))); + *v0 = (LCRNG_Next() % (NELEMS(Unk_020EBF64))); return 0; } diff --git a/src/unk_0204CFFC.c b/src/unk_0204CFFC.c index f24457b436..e7b304d025 100644 --- a/src/unk_0204CFFC.c +++ b/src/unk_0204CFFC.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" @@ -23,7 +23,7 @@ #include "unk_02054884.h" #include "unk_0205DFC4.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "item.h" @@ -56,8 +56,8 @@ BOOL sub_0204D08C (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), *v2); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - *v3 = GetMonData(v1, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + *v3 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); } else { *v3 = 0; } @@ -75,7 +75,7 @@ BOOL sub_0204D0E8 (UnkStruct_0203E724 * param0) u16 v5, v6; v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), *v3); - v5 = GetMonData(v1, MON_DATA_OT_ID, NULL); + v5 = Pokemon_GetValue(v1, MON_DATA_OT_ID, NULL); v6 = sub_02025F20(v2); if (v5 == v6) { @@ -103,8 +103,8 @@ BOOL sub_0204D154 (UnkStruct_0203E724 * param0) v1 = Party_GetCurrentCount(v3); if (v1 < 6) { - v4 = AllocMonZeroed(11); - ZeroMonData(v4); + v4 = Pokemon_New(11); + Pokemon_Init(v4); v0 = sub_02017070(1, v8); ov5_021E6CF0(v4, v7, 1, v6, 3, v0); @@ -140,11 +140,11 @@ BOOL sub_0204D234 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); *v2 = 0; - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) != 0) { return 0; } - if ((GetMonData(v1, MON_DATA_MOVE1, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE2, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE3, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE4, NULL) == v3)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE1, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE2, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE3, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE4, NULL) == v3)) { *v2 = 1; } @@ -165,11 +165,11 @@ BOOL sub_0204D2D8 (UnkStruct_0203E724 * param0) for (v5 = 0, *v2 = 6; v5 < v6; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) != 0) { continue; } - if ((GetMonData(v1, MON_DATA_MOVE1, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE2, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE3, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE4, NULL) == v3)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE1, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE2, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE3, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE4, NULL) == v3)) { *v2 = v5; break; } @@ -206,8 +206,8 @@ BOOL sub_0204D3DC (UnkStruct_0203E724 * param0) for (v4 = 0, v6 = 0; v4 < v5; v4++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v1, MON_DATA_161, NULL) <= v3) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL) <= v3) { v6++; } } @@ -228,8 +228,8 @@ BOOL sub_0204D470 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); *v2 = 0; - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - *v2 = GetMonData(v1, MON_DATA_161, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + *v2 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); } return 0; @@ -252,12 +252,12 @@ BOOL sub_0204D4CC (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) != 0) { *v2 = 0; return 0; } - *v2 = sub_02075BCC(v1); + *v2 = Pokemon_GetNature(v1); return 0; } @@ -276,8 +276,8 @@ BOOL sub_0204D540 (UnkStruct_0203E724 * param0) for (v5 = 0; v5 < v4; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - if (sub_02075BCC(v1) == v3) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetNature(v1) == v3) { *v2 = v5; break; } @@ -295,7 +295,7 @@ BOOL sub_0204D5CC (UnkStruct_0203E724 * param0) u16 v3 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - *v2 = GetMonData(v1, MON_DATA_FRIENDSHIP, NULL); + *v2 = Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL); return 0; } @@ -310,18 +310,18 @@ BOOL sub_0204D614 (UnkStruct_0203E724 * param0) u32 v5 = sub_0203A138(param0->unk_34->unk_1C->unk_00); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - v4 = GetMonData(v1, MON_DATA_FRIENDSHIP, NULL); + v4 = Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL); if (v2 > 0) { - if (Item_LoadParam(GetMonData(v1, MON_DATA_HELD_ITEM, NULL), 1, 11) == 53) { + if (Item_LoadParam(Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL), 1, 11) == 53) { v2 = v2 * 150 / 100; } - if (GetMonData(v1, MON_DATA_POKEBALL, NULL) == 11) { + if (Pokemon_GetValue(v1, MON_DATA_POKEBALL, NULL) == 11) { v2++; } - if (GetMonData(v1, MON_DATA_152, NULL) == v5) { + if (Pokemon_GetValue(v1, MON_DATA_152, NULL) == v5) { v2++; } } @@ -332,7 +332,7 @@ BOOL sub_0204D614 (UnkStruct_0203E724 * param0) v4 = 255; } - sub_02074B30(v1, 9, &v4); + Pokemon_SetValue(v1, 9, &v4); return 0; } @@ -345,7 +345,7 @@ BOOL sub_0204D6E4 (UnkStruct_0203E724 * param0) u16 v4; v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - v4 = GetMonData(v1, MON_DATA_FRIENDSHIP, NULL); + v4 = Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL); if (v2 > v4) { v4 = 0; @@ -353,7 +353,7 @@ BOOL sub_0204D6E4 (UnkStruct_0203E724 * param0) v4 -= v2; } - sub_02074B30(v1, 9, &v4); + Pokemon_SetValue(v1, 9, &v4); return 0; } @@ -365,7 +365,7 @@ BOOL sub_0204D74C (UnkStruct_0203E724 * param0) u16 * v3 = inline_0204FCAC(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - *v3 = GetMonData(v0, MON_DATA_COOL + v2, NULL); + *v3 = Pokemon_GetValue(v0, MON_DATA_COOL + v2, NULL); return 0; } @@ -387,8 +387,8 @@ BOOL sub_0204D7D4 (UnkStruct_0203E724 * param0) u16 v4 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - *v2 = GetMonData(v1, MON_DATA_177, NULL); - *v3 = GetMonData(v1, MON_DATA_178, NULL); + *v2 = Pokemon_GetValue(v1, MON_DATA_177, NULL); + *v3 = Pokemon_GetValue(v1, MON_DATA_178, NULL); return 0; } @@ -418,7 +418,7 @@ BOOL sub_0204D86C (UnkStruct_0203E724 * param0) for (v2 = 0, v1 = 0; v2 < v0; v2++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { v1++; } } @@ -445,8 +445,8 @@ BOOL sub_0204D8C4 (UnkStruct_0203E724 * param0) v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v3, MON_DATA_163, NULL) != 0) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL) != 0) { v1++; } } @@ -470,8 +470,8 @@ BOOL sub_0204D94C (UnkStruct_0203E724 * param0) for (v2 = 0, v1 = 0; v2 < v0; v2++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v3, MON_DATA_163, NULL) != 0) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL) != 0) { v1++; } } @@ -495,7 +495,7 @@ BOOL sub_0204D9C8 (UnkStruct_0203E724 * param0) for (v2 = 0, v1 = 0; v2 < v0; v2++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL)) { v1++; } } @@ -520,7 +520,7 @@ BOOL sub_0204DA20 (UnkStruct_0203E724 * param0) for (v0 = 0; v0 < v1; v0++) { v4 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v5->unk_0C), v0); - v3 = GetMonData(v4, MON_DATA_POKERUS, NULL); + v3 = Pokemon_GetValue(v4, MON_DATA_POKERUS, NULL); if (v3 != 0) { *v2 = 1; @@ -538,7 +538,7 @@ BOOL sub_0204DA84 (UnkStruct_0203E724 * param0) u16 * v2 = inline_0204FCAC(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - *v2 = GetMonData(v0, MON_DATA_111, NULL); + *v2 = Pokemon_GetValue(v0, MON_DATA_GENDER, NULL); return 0; } @@ -553,26 +553,26 @@ BOOL sub_0204DACC (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) != 0) { *v2 = 0; return 0; } v4 = 0; - if ((GetMonData(v1, MON_DATA_MOVE1, NULL) != 0)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE1, NULL) != 0)) { v4++; } - if ((GetMonData(v1, MON_DATA_MOVE2, NULL) != 0)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE2, NULL) != 0)) { v4++; } - if ((GetMonData(v1, MON_DATA_MOVE3, NULL) != 0)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE3, NULL) != 0)) { v4++; } - if ((GetMonData(v1, MON_DATA_MOVE4, NULL) != 0)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE4, NULL) != 0)) { v4++; } @@ -590,7 +590,7 @@ BOOL sub_0204DB74 (UnkStruct_0203E724 * param0) u16 v5 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - sub_02077408(v1, v5); + Pokemon_ClearMoveSlot(v1, v5); return 0; } @@ -604,7 +604,7 @@ BOOL sub_0204DBB8 (UnkStruct_0203E724 * param0) u16 v4 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - *v2 = GetMonData(v1, MON_DATA_MOVE1 + v4, NULL); + *v2 = Pokemon_GetValue(v1, MON_DATA_MOVE1 + v4, NULL); return 0; } @@ -617,7 +617,7 @@ BOOL sub_0204DC18 (UnkStruct_0203E724 * param0) u16 v3 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - *v2 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + *v2 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); return 0; } @@ -632,7 +632,7 @@ BOOL sub_0204DC60 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v2); v3 = 0; - sub_02074B30(v1, 6, &v3); + Pokemon_SetValue(v1, 6, &v3); return 0; } @@ -654,8 +654,8 @@ BOOL sub_0204DC98 (UnkStruct_0203E724 * param0) for (v5 = 0; v5 < v6; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v7 = GetMonData(v1, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v7 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v4 == v7) { *v3 = 1; @@ -689,8 +689,8 @@ BOOL sub_0204DD28 (UnkStruct_0203E724 * param0) for (v5 = 0; v5 < v7; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v8 = GetMonData(v1, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v8 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v4 == 0) { v9[v5] = v8; @@ -729,8 +729,8 @@ BOOL sub_0204DE00 (UnkStruct_0203E724 * param0) for (v5 = 0; v5 < v6; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v7 = GetMonData(v1, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v7 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v4 == v7) { *v3 = v5; @@ -752,7 +752,7 @@ BOOL sub_0204DE94 (UnkStruct_0203E724 * param0) v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v2); for (v3 = 0, v4 = 0; v3 < 80; v3++) { - if (GetMonData(v0, sub_020923C0(v3, 0), NULL) != 0) { + if (Pokemon_GetValue(v0, sub_020923C0(v3, 0), NULL) != 0) { v4++; } } @@ -776,8 +776,8 @@ BOOL sub_0204DF08 (UnkStruct_0203E724 * param0) for (v4 = 0; v4 < v6; v4++) { v0 = Party_GetPokemonBySlotIndex(v1, v4); - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v0, sub_020923C0(v3, 0), NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v0, sub_020923C0(v3, 0), NULL) != 0) { v5++; break; } @@ -799,7 +799,7 @@ BOOL sub_0204DFB0 (UnkStruct_0203E724 * param0) u8 v4 = 1; v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v2); - *v1 = GetMonData(v0, sub_020923C0(v3, 0), NULL); + *v1 = Pokemon_GetValue(v0, sub_020923C0(v3, 0), NULL); return 0; } @@ -813,7 +813,7 @@ BOOL sub_0204E01C (UnkStruct_0203E724 * param0) v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - sub_02074B30(v0, sub_020923C0(v2, 0), &v3); + Pokemon_SetValue(v0, sub_020923C0(v2, 0), &v3); sub_0206DDB8(param0->unk_34->unk_0C, v0, sub_020923C0(v2, 0)); return 0; @@ -833,8 +833,8 @@ BOOL sub_0204E094 (UnkStruct_0203E724 * param0) for (v4 = 0; v4 < v5; v4++) { v0 = Party_GetPokemonBySlotIndex(v1, v4); - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { - if (GetMonData(v0, MON_DATA_3, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_3, NULL) != 0) { *v2 = 1; return 0; } @@ -869,11 +869,11 @@ BOOL sub_0204E12C (UnkStruct_0203E724 * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v5->unk_0C), v0); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - v2 = GetMonData(v3, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { + v2 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); if (v7 == v2) { - if (GetMonData(v3, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) { + if (Pokemon_GetValue(v3, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) { *v6 = v0; break; } @@ -900,7 +900,7 @@ BOOL sub_0204E1D0 (UnkStruct_0203E724 * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v0); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == v5) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == v5) { *v6 = 1; break; } diff --git a/src/unk_0204EDA4.c b/src/unk_0204EDA4.c index 751b6efd6e..0672b431d7 100644 --- a/src/unk_0204EDA4.c +++ b/src/unk_0204EDA4.c @@ -4,7 +4,7 @@ #include "inlines.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203E724_t.h" #include "struct_defs/struct_020997B8.h" diff --git a/src/unk_0204F13C.c b/src/unk_0204F13C.c index c1be8d26b7..c759e3aebb 100644 --- a/src/unk_0204F13C.c +++ b/src/unk_0204F13C.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_020308A0_decl.h" #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -43,7 +43,7 @@ #include "unk_0204FA34.h" #include "unk_020508D4.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0207D3B8.h" @@ -176,10 +176,10 @@ static BOOL sub_0204F268 (u16 param0, UnkStruct_021C0794 * param1) for (v0 = 0, v2 = 0; v0 < v3; v0++) { v7 = Party_GetPokemonBySlotIndex(v6, v0); - v4 = GetMonData(v7, MON_DATA_SPECIES, NULL); - v5 = GetMonData(v7, MON_DATA_161, NULL); + v4 = Pokemon_GetValue(v7, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(v7, MON_DATA_LEVEL, NULL); - if (GetMonData(v7, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v7, MON_DATA_IS_EGG, NULL) != 0) { continue; } diff --git a/src/unk_02050A74.c b/src/unk_02050A74.c index fee93142f3..25b7ba2c7b 100644 --- a/src/unk_02050A74.c +++ b/src/unk_02050A74.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_0202440C_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" @@ -46,7 +46,7 @@ #include "unk_0206A8DC.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "unk_020797C8.h" #include "party.h" @@ -596,7 +596,7 @@ void sub_020512E4 (UnkStruct_020508D4 * param0, u16 param1, u8 param2, int * par v4 = 1; v3 = Party_GetPokemonBySlotIndex(v1->parties[1], 0); - sub_02074B30(v3, 110, &v4); + Pokemon_SetValue(v3, 110, &v4); if (param4) { v1->unk_164 |= 0x8; @@ -933,7 +933,7 @@ static void sub_020518B0 (UnkStruct_0203CDB0 * param0, BattleParams * param1) } else if (v2 == 0x4) { v0 = Party_GetPokemonBySlotIndex(param1->parties[1], 0); - if (sub_0207A294(0, GetMonData(v0, MON_DATA_SPECIES, 0))) { + if (sub_0207A294(0, Pokemon_GetValue(v0, MON_DATA_SPECIES, 0))) { sub_0202CFEC(sub_0202CD88(param0->unk_0C), 9); } else { sub_0202CFEC(sub_0202CD88(param0->unk_0C), 10); @@ -947,7 +947,7 @@ static void sub_020518B0 (UnkStruct_0203CDB0 * param0, BattleParams * param1) if (v2 == 0x4) { v0 = Party_GetPokemonBySlotIndex(param1->parties[1], 0); - if (sub_0207A294(0, GetMonData(v0, MON_DATA_SPECIES, 0))) { + if (sub_0207A294(0, Pokemon_GetValue(v0, MON_DATA_SPECIES, 0))) { sub_0202CFEC(sub_0202CD88(param0->unk_0C), 9); } else { sub_0202CFEC(sub_0202CD88(param0->unk_0C), 10); @@ -985,7 +985,7 @@ static void sub_02051988 (UnkStruct_0203CDB0 * param0, BattleParams * param1) if (param0->unk_78.unk_02 >= 5) { v0 = Party_GetPokemonBySlotIndex(param1->parties[1], 0); - v3 = sub_0202BECC(sub_02025E5C(param0->unk_0C), GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_111, 0), param1->unk_138, 11); + v3 = sub_0202BECC(sub_02025E5C(param0->unk_0C), Pokemon_GetValue(v0, MON_DATA_SPECIES, 0), Pokemon_GetValue(v0, MON_DATA_GENDER, 0), param1->unk_138, 11); sub_0202B758(param0->unk_9C, v3, 2); } } else if (v2 == 0x4) { @@ -993,7 +993,7 @@ static void sub_02051988 (UnkStruct_0203CDB0 * param0, BattleParams * param1) v4 = param1->unk_148; v0 = Party_GetPokemonBySlotIndex(param1->parties[v4], 0); - v3 = sub_0202BE4C(sub_02025E5C(param0->unk_0C), GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_111, 0), param1->unk_138, 11); + v3 = sub_0202BE4C(sub_02025E5C(param0->unk_0C), Pokemon_GetValue(v0, MON_DATA_SPECIES, 0), Pokemon_GetValue(v0, MON_DATA_GENDER, 0), param1->unk_138, 11); sub_0202B758(param0->unk_9C, v3, 2); } @@ -1022,7 +1022,7 @@ void sub_02051ABC (UnkStruct_020508D4 * param0, u16 param1, u8 param2, int * par Pokemon * v3; v3 = Party_GetPokemonBySlotIndex(v1->parties[1], 0); - sub_02077A64(v3); + Pokemon_SetGiratinaOriginForm(v3); } if (param4) { diff --git a/src/unk_02051D8C.c b/src/unk_02051D8C.c index 304faa6d38..cfca4a803f 100644 --- a/src/unk_02051D8C.c +++ b/src/unk_02051D8C.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0202B628_decl.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_0203A790_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" #include "struct_decls/struct_0207D99C_decl.h" @@ -57,7 +57,7 @@ #include "unk_0206A8DC.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_0208C324.h" @@ -178,7 +178,7 @@ BattleParams * sub_02051F4C (int param0, const UnkStruct_0203CDB0 * param1) v4->unk_138 = sub_02055BA8(param1); sub_0207D570(v4->unk_E0, 4, 20, param0); - v5 = AllocMonZeroed(param0); + v5 = Pokemon_New(param0); sub_02073D80(v5, sub_0206B08C(sub_020507E4(param1->unk_0C)), 5, 32, 0, 0, 2, 0); Party_AddPokemon(v4->parties[0], v5); @@ -319,17 +319,17 @@ void sub_02052348 (BattleParams * param0, const UnkStruct_0203CDB0 * param1, int param0->unk_12C = 9; sub_02052184(param0, v2, 0); - v8 = AllocMonZeroed(11); + v8 = Pokemon_New(11); Party_InitWithCapacity(param0->parties[0], Party_GetCurrentCount(v3)); for (v0 = 0; v0 < Party_GetCurrentCount(v3); v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v3, v0), v8); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v3, v0), v8); - if ((GetMonData(v8, MON_DATA_161, NULL) != param2) && (param2 != 0)) { - v1 = sub_02075AD0(GetMonData(v8, MON_DATA_SPECIES, NULL), param2); + if ((Pokemon_GetValue(v8, MON_DATA_LEVEL, NULL) != param2) && (param2 != 0)) { + v1 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v8, MON_DATA_SPECIES, NULL), param2); - sub_02074B30(v8, 8, &v1); - sub_0207418C(v8); + Pokemon_SetValue(v8, 8, &v1); + Pokemon_CalcLevelAndStats(v8); } sub_0205213C(param0, v8, 0); @@ -388,11 +388,11 @@ void sub_020524E4 (BattleParams * param0, const UnkStruct_0203CDB0 * param1, con if (v10 == 0) { sub_02052164(param0, param2, 0); } else { - v9 = AllocMonZeroed(11); + v9 = Pokemon_New(11); Party_InitWithCapacity(param0->parties[0], v10); for (v8 = 0; v8 < v10; v8++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param2, param3[v8] - 1), v9); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param2, param3[v8] - 1), v9); sub_0205213C(param0, v9, 0); } diff --git a/src/unk_020528D0.c b/src/unk_020528D0.c index b4f130d568..f05df5bcf4 100644 --- a/src/unk_020528D0.c +++ b/src/unk_020528D0.c @@ -42,7 +42,7 @@ #include "unk_020553DC.h" #include "unk_02055808.h" #include "unk_02070428.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" typedef struct { @@ -220,7 +220,7 @@ BOOL sub_02052B2C (UnkStruct_020508D4 * param0) case 0: { if ((v0 != NULL) && (v0->unk_0C != NULL)) { - sub_02077A9C(Party_GetFromSavedata(v0->unk_0C), 0); + Party_SetGiratinaForm(Party_GetFromSavedata(v0->unk_0C), 0); } } diff --git a/src/unk_02054884.c b/src/unk_02054884.c index 6ea1b3d68c..3a8ffeb6cd 100644 --- a/src/unk_02054884.c +++ b/src/unk_02054884.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -11,17 +11,17 @@ #include "unk_02025E08.h" #include "unk_0202F180.h" #include "unk_02054884.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay005/ov5_021E622C.h" BOOL sub_02054884 (Pokemon * param0) { - if (GetMonData(param0, MON_DATA_163, NULL) == 0) { + if (Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL) == 0) { return 0; } - if (GetMonData(param0, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_IS_EGG, NULL)) { return 0; } @@ -38,14 +38,14 @@ BOOL sub_020548B0 (int param0, UnkStruct_021C0794 * param1, u16 param2, u8 param v4 = sub_02025E38(param1); v3 = Party_GetFromSavedata(param1); - v1 = AllocMonZeroed(param0); + v1 = Pokemon_New(param0); - ZeroMonData(v1); + Pokemon_Init(v1); sub_02073D80(v1, param2, param3, 32, 0, 0, 0, 0); sub_02077E64(v1, v4, 4, param5, param6, param0); v2 = param4; - sub_02074B30(v1, 6, &v2); + Pokemon_SetValue(v1, 6, &v2); v0 = Party_AddPokemon(v3, v1); if (v0) { @@ -63,9 +63,9 @@ BOOL sub_02054930 (int param0, UnkStruct_021C0794 * param1, u16 param2, u8 param BOOL v1; UnkStruct_02025E6C * v2 = sub_02025E38(param1); Party * v3 = Party_GetFromSavedata(param1); - Pokemon * v4 = AllocMonZeroed(32); + Pokemon * v4 = Pokemon_New(32); - ZeroMonData(v4); + Pokemon_Init(v4); v0 = sub_02017070(param4, param5); ov5_021E6CF0(v4, param2, param3, v2, 4, v0); @@ -78,7 +78,7 @@ BOOL sub_02054930 (int param0, UnkStruct_021C0794 * param1, u16 param2, u8 param void sub_02054988 (Party * param0, int param1, int param2, u16 param3) { - sub_020771F8(Party_GetPokemonBySlotIndex(param0, param1), param3, param2); + Pokemon_ResetMoveSlot(Party_GetPokemonBySlotIndex(param0, param1), param3, param2); } int sub_020549A0 (Party * param0, u16 param1) @@ -91,11 +91,11 @@ int sub_020549A0 (Party * param0, u16 param1) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v2, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) != 0) { continue; } - if ((GetMonData(v2, MON_DATA_MOVE1, NULL) == param1) || (GetMonData(v2, MON_DATA_MOVE2, NULL) == param1) || (GetMonData(v2, MON_DATA_MOVE3, NULL) == param1) || (GetMonData(v2, MON_DATA_MOVE4, NULL) == param1)) { + if ((Pokemon_GetValue(v2, MON_DATA_MOVE1, NULL) == param1) || (Pokemon_GetValue(v2, MON_DATA_MOVE2, NULL) == param1) || (Pokemon_GetValue(v2, MON_DATA_MOVE3, NULL) == param1) || (Pokemon_GetValue(v2, MON_DATA_MOVE4, NULL) == param1)) { return v0; break; } @@ -152,7 +152,7 @@ Pokemon * sub_02054A74 (const Party * param0) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0) { return v2; } } @@ -180,8 +180,8 @@ void sub_02054AC4 (Party * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - sub_02074B30(v3, 25, &v2); + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { + Pokemon_SetValue(v3, 25, &v2); } } } @@ -199,14 +199,14 @@ int sub_02054B04 (Party * param0, u16 param1) v4 = Party_GetPokemonBySlotIndex(param0, v2); if (sub_02054884(v4)) { - if (GetMonData(v4, MON_DATA_160, NULL) & (0x80 | 0x8)) { - u32 v5 = GetMonData(v4, MON_DATA_163, NULL); + if (Pokemon_GetValue(v4, MON_DATA_160, NULL) & (0x80 | 0x8)) { + u32 v5 = Pokemon_GetValue(v4, MON_DATA_CURRENT_HP, NULL); if (v5 > 1) { v5--; } - sub_02074B30(v4, 163, &v5); + Pokemon_SetValue(v4, 163, &v5); if (v5 == 1) { v1++; @@ -229,10 +229,10 @@ int sub_02054B04 (Party * param0, u16 param1) BOOL sub_02054B94 (Pokemon * param0) { - if ((GetMonData(param0, MON_DATA_160, NULL) & (0x80 | 0x8)) && (GetMonData(param0, MON_DATA_163, NULL) == 1)) { + if ((Pokemon_GetValue(param0, MON_DATA_160, NULL) & (0x80 | 0x8)) && (Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL) == 1)) { u32 v0 = 0; - sub_02074B30(param0, 160, &v0); + Pokemon_SetValue(param0, 160, &v0); return 1; } diff --git a/src/unk_020559DC.c b/src/unk_020559DC.c index b5586f814c..5a4cbe421c 100644 --- a/src/unk_020559DC.c +++ b/src/unk_020559DC.c @@ -27,7 +27,7 @@ #include "unk_0206B9D8.h" #include "unk_0206C2D0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" static void sub_02055AC0(UnkStruct_0203CDB0 * param0, s32 param1); @@ -147,7 +147,7 @@ static void sub_02055B64 (UnkStruct_0203CDB0 * param0, s32 param1, const RTCTime Party * v1; v1 = Party_GetFromSavedata(param0->unk_0C); - sub_02077BD8(v1, param1, param2); + Party_SetShayminForm(v1, param1, param2); } } diff --git a/src/unk_020562F8.c b/src/unk_020562F8.c index 7f3366fd49..bde534635e 100644 --- a/src/unk_020562F8.c +++ b/src/unk_020562F8.c @@ -6,7 +6,7 @@ #include "struct_decls/struct_02024440_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020564B4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0.h" #include "overlay006/battle_params.h" @@ -21,7 +21,7 @@ #include "unk_02054D00.h" #include "unk_020562F8.h" #include "unk_0205DAC8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" typedef struct { u16 unk_00; @@ -141,13 +141,13 @@ static void sub_0205642C (UnkStruct_0203CDB0 * param0, UnkStruct_020564B4 * para UnkStruct_02024440 * v4; v4 = sub_02024440(param0->unk_0C); - v3 = AllocMonZeroed(4); + v3 = Pokemon_New(4); for (v0 = 0; v0 < 6; v0++) { param1->unk_30[v0] = 0; sub_0202F000(v4, v0, v3); - v2 = GetMonData(v3, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); param1->unk_00[v0].unk_00 = v2; sub_02056400(v2, v1); @@ -160,8 +160,8 @@ static void sub_0205642C (UnkStruct_0203CDB0 * param0, UnkStruct_020564B4 * para param1->unk_00[v0].unk_03 = v1[3]; param1->unk_00[v0].unk_04 = v1[2]; - param1->unk_00[v0].unk_06 = GetMonData(v3, MON_DATA_177, NULL); - param1->unk_00[v0].unk_07 = GetMonData(v3, MON_DATA_178, NULL); + param1->unk_00[v0].unk_06 = Pokemon_GetValue(v3, MON_DATA_177, NULL); + param1->unk_00[v0].unk_07 = Pokemon_GetValue(v3, MON_DATA_178, NULL); } Heap_FreeToHeap(v3); @@ -274,7 +274,7 @@ static void sub_02056624 (UnkStruct_0203CDB0 * param0, BattleParams * param1, Un static BattleParams * sub_0205664C (UnkStruct_0203CDB0 * param0, UnkStruct_020564B4 * param1) { BattleParams * v0; - Pokemon * v1 = AllocMonZeroed(32); + Pokemon * v1 = Pokemon_New(32); UnkStruct_02024440 * v2 = sub_02024440(param0->unk_0C); int v3 = sub_020563BC(param0); diff --git a/src/unk_02056720.c b/src/unk_02056720.c index 03d5c63829..d7ef8fe97f 100644 --- a/src/unk_02056720.c +++ b/src/unk_02056720.c @@ -1,12 +1,12 @@ #include #include -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "unk_020244AC.h" #include "unk_02056720.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" typedef struct UnkStruct_02056B24_t { @@ -302,9 +302,9 @@ void sub_02056A48 (UnkStruct_02056B24 * param0, const BoxPokemon * param1) v0 = 12 - 1; } - param0->unk_B8[v0].unk_00 = sub_02074570((BoxPokemon *)param1, MON_DATA_SPECIES, NULL); + param0->unk_B8[v0].unk_00 = BoxPokemon_GetValue((BoxPokemon *)param1, MON_DATA_SPECIES, NULL); param0->unk_B8[v0].unk_02 = sub_02079E44(param1); - param0->unk_B8[v0].unk_04 = sub_02074570((BoxPokemon *)param1, MON_DATA_FORM, NULL); + param0->unk_B8[v0].unk_04 = BoxPokemon_GetValue((BoxPokemon *)param1, MON_DATA_FORM, NULL); } int sub_02056AAC (const UnkStruct_02056B24 * param0) diff --git a/src/unk_0205A0D8.c b/src/unk_0205A0D8.c index 99a35bd30c..54337667d3 100644 --- a/src/unk_0205A0D8.c +++ b/src/unk_0205A0D8.c @@ -9,7 +9,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -50,7 +50,7 @@ #include "unk_0205E7D0.h" #include "unk_02061804.h" #include "unk_020655F4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0207D3B8.h" @@ -520,7 +520,7 @@ static BOOL sub_0205A324 (UnkStruct_020508D4 * param0) } break; case 36: - sub_0200B538(v0->unk_28, 1, sub_02076B10(Party_GetPokemonBySlotIndex(v0->unk_50, v0->unk_84))); + sub_0200B538(v0->unk_28, 1, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(v0->unk_50, v0->unk_84))); MessageLoader_GetStrbuf(v0->unk_2C, 18, v0->unk_0C); sub_0200C388(v0->unk_28, v0->unk_10, v0->unk_0C); v0->unk_30 = sub_0205AA50(v0, v0->unk_10); @@ -758,7 +758,7 @@ static void sub_0205AC80 (UnkStruct_0205A0D8 * param0, BOOL param1) v0 = Party_GetFromSavedata(param0->unk_24->unk_0C); v2 = param0->unk_4C; - v4 = sub_02076AF0(); + v4 = Pokemon_GetStructSize(); v1 = (UnkStruct_0205AD20 *)(v2 + v4 * 3); v1->unk_00 = param1; @@ -809,7 +809,7 @@ static BOOL sub_0205AD20 (UnkStruct_0205A0D8 * param0) { UnkStruct_0205AD20 * v0; - v0 = (UnkStruct_0205AD20 *)((u8 *)(param0->unk_48) + (sub_02076AF0() * 3)); + v0 = (UnkStruct_0205AD20 *)((u8 *)(param0->unk_48) + (Pokemon_GetStructSize() * 3)); return v0->unk_00; } @@ -844,7 +844,7 @@ static void sub_0205AD80 (UnkStruct_0205A0D8 * param0) u32 v0; int v1; - v0 = sub_02076AF0(); + v0 = Pokemon_GetStructSize(); Party_InitWithCapacity(param0->unk_50, 3); for (v1 = 0; v1 < 3; v1++) { @@ -858,7 +858,7 @@ static void sub_0205ADAC (UnkStruct_0205A0D8 * param0) u8 * v1, * v2; int v3; - v0 = sub_02076AF0(); + v0 = Pokemon_GetStructSize(); v1 = ¶m0->unk_4C[param0->unk_85 * v0]; v2 = ¶m0->unk_48[param0->unk_84 * v0]; @@ -880,14 +880,14 @@ static void sub_0205ADF8 (UnkStruct_0205A0D8 * param0, int param1) MessageLoader * v4; v4 = MessageLoader_Init(1, 26, 412, 4); - v3 = sub_02076AF0(); + v3 = Pokemon_GetStructSize(); sub_0201A7E8(param0->unk_24->unk_08, v0, 3, 21, 9, 10, 8, 13, 10); sub_0200DAA4(param0->unk_24->unk_08, 3, 1, 11, 0, 4); sub_0201ADA4(v0, 15); for (v1 = 0; v1 < 3; v1++) { - v2 = GetMonData((Pokemon *)(¶m0->unk_48[v1 * v3]), MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue((Pokemon *)(¶m0->unk_48[v1 * v3]), MON_DATA_SPECIES, NULL); MessageLoader_GetStrbuf(v4, v2, param0->unk_0C); sub_0201D738(v0, 0, param0->unk_0C, 16, v1 * 16, 0xff, NULL); @@ -988,7 +988,7 @@ void sub_0205B0C0 (int param0, int param1, void * param2, void * param3) int sub_0205B0E4 (void) { - return sub_02076AF0() * 3 + sizeof(UnkStruct_0205AD20); + return Pokemon_GetStructSize() * 3 + sizeof(UnkStruct_0205AD20); } u8 * sub_0205B0F4 (int param0, void * param1, int param2) diff --git a/src/unk_0205B33C.c b/src/unk_0205B33C.c index b278773ee8..d7f06b0328 100644 --- a/src/unk_0205B33C.c +++ b/src/unk_0205B33C.c @@ -935,27 +935,27 @@ static int sub_0205BAE8 (UnkStruct_0205B43C * param0, int param1) return Unk_020ED548[v0]; break; case 5: - return Unk_020ED560[sub_0201D2E8() % 2][v0]; + return Unk_020ED560[LCRNG_Next() % 2][v0]; break; case 6: - return Unk_020ED620[sub_0201D2E8() % 4][v0]; + return Unk_020ED620[LCRNG_Next() % 4][v0]; break; case 7: - return Unk_020ED550[sub_0201D2E8() % 2][v0]; + return Unk_020ED550[LCRNG_Next() % 2][v0]; break; case 8: case 1: - return Unk_020ED600[sub_0201D2E8() % 4][v0]; + return Unk_020ED600[LCRNG_Next() % 4][v0]; break; case 9: case 2: - return Unk_020ED640[sub_0201D2E8() % 4][v0]; + return Unk_020ED640[LCRNG_Next() % 4][v0]; break; case 10: case 3: case 12: case 13: - return Unk_020ED660[sub_0201D2E8() % 4][v0]; + return Unk_020ED660[LCRNG_Next() % 4][v0]; break; } diff --git a/src/unk_0205DFC4.c b/src/unk_0205DFC4.c index 9536bdc8b6..b2da15b6a2 100644 --- a/src/unk_0205DFC4.c +++ b/src/unk_0205DFC4.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -19,7 +19,7 @@ #include "unk_020508D4.h" #include "unk_0205DFC4.h" #include "unk_02061804.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay004/ov4_021D0D80.h" @@ -251,7 +251,7 @@ u16 sub_0205E1B4 (UnkStruct_021C0794 * param0) for (v1 = 0; v1 < v2; v1++) { v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0), v1); - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) == 0) { return v1; } } @@ -270,7 +270,7 @@ BOOL HasAllLegendaryTitansInParty (UnkStruct_021C0794 * param0) v2 = Party_GetCurrentCount(v4); for (v0 = 0; v0 < v2; v0++) { - v6[v0] = GetMonData(Party_GetPokemonBySlotIndex(v4, v0), MON_DATA_SPECIES, NULL); + v6[v0] = Pokemon_GetValue(Party_GetPokemonBySlotIndex(v4, v0), MON_DATA_SPECIES, NULL); } for (v0 = 0; v0 < 3; v0++) { diff --git a/src/unk_0206450C.c b/src/unk_0206450C.c index cd3344e3cf..1fc965e9e9 100644 --- a/src/unk_0206450C.c +++ b/src/unk_0206450C.c @@ -1250,13 +1250,13 @@ static int sub_020652EC (const int * param0, int param1) static int sub_0206530C (const int * param0, int param1) { - return param0[sub_0201D2E8() % sub_020652EC(param0, param1)]; + return param0[LCRNG_Next() % sub_020652EC(param0, param1)]; } static int sub_02065330 (int param0, int param1) { const int * v0 = sub_02065358(param0); - return v0[sub_0201D2E8() % sub_020652EC(v0, param1)]; + return v0[LCRNG_Next() % sub_020652EC(v0, param1)]; } static const int * sub_02065358 (int param0) diff --git a/src/unk_0206AFE0.c b/src/unk_0206AFE0.c index 32e2da8673..9f6a654399 100644 --- a/src/unk_0206AFE0.c +++ b/src/unk_0206AFE0.c @@ -253,8 +253,8 @@ void sub_0206B2C8 (UnkStruct_020507E4 * param0) { u16 v0, v1; - v0 = sub_0201D2E8(); - v1 = sub_0201D2E8(); + v0 = LCRNG_Next(); + v1 = LCRNG_Next(); sub_0206B280(param0, (v1 << 16) | v0); } @@ -285,7 +285,7 @@ void sub_0206B334 (UnkStruct_021C0794 * param0) UnkStruct_020507E4 * v0 = sub_020507E4(param0); u32 v1; - v1 = (sub_0201D2E8() % 98) + 2; + v1 = (LCRNG_Next() % 98) + 2; sub_0206B324(v0, v1); } @@ -436,13 +436,13 @@ static u8 sub_0206B4A4 (UnkStruct_020507E4 * param0) v3 = 0; } - v2 = (sub_0201D2E8() % 100); + v2 = (LCRNG_Next() % 100); if (v2 > Unk_020EFA70[v3]) { return 0xff; } - v2 = (sub_0201D2E8() % Unk_020EFA6C[v3]); + v2 = (LCRNG_Next() % Unk_020EFA6C[v3]); return v2; } @@ -465,7 +465,7 @@ void sub_0206B514 (UnkStruct_021C0794 * param0) void sub_0206B558 (UnkStruct_020507E4 * param0, u16 param1) { sub_0206AFE0(param0, (30 + (((0 + 0x4000) + 32) + 16)), param1); - sub_0206AFE0(param0, (42 + (((0 + 0x4000) + 32) + 16)), (sub_0201D2E8() % 5)); + sub_0206AFE0(param0, (42 + (((0 + 0x4000) + 32) + 16)), (LCRNG_Next() % 5)); } u16 sub_0206B588 (UnkStruct_020507E4 * param0) diff --git a/src/unk_0206C660.c b/src/unk_0206C660.c index c163ec6320..07188cda3a 100644 --- a/src/unk_0206C660.c +++ b/src/unk_0206C660.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay006/struct_ov6_02246204_decl.h" #include "struct_defs/struct_0203CDB0.h" @@ -13,7 +13,7 @@ #include "unk_020508D4.h" #include "unk_02055808.h" #include "unk_0206C660.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay006/ov6_02246184.h" #include "overlay095/ov95_02246C20.h" @@ -97,8 +97,8 @@ void sub_0206C740 (UnkStruct_020508D4 * param0, UnkStruct_ov6_02246204 * param1, v0->unk_04 = 0; v0->unk_00 = param1; v0->unk_08 = param2; - v0->unk_24 = AllocMonZeroed(param3); - v0->unk_28 = AllocMonZeroed(param3); + v0->unk_24 = Pokemon_New(param3); + v0->unk_28 = Pokemon_New(param3); sub_02050944(param0, sub_0206C680, v0); } diff --git a/src/unk_0206CCB0.c b/src/unk_0206CCB0.c index 91b5bf48c7..f99613f753 100644 --- a/src/unk_0206CCB0.c +++ b/src/unk_0206CCB0.c @@ -14,8 +14,7 @@ #include "struct_decls/struct_0202A750_decl.h" #include "struct_decls/struct_0202B4A0_decl.h" #include "struct_decls/struct_020507E4_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" #include "overlay006/struct_ov6_022465F4_decl.h" @@ -61,7 +60,7 @@ #include "roaming_pokemon.h" #include "unk_0206CCB0.h" #include "unk_02071CFC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_020923C0.h" @@ -475,17 +474,17 @@ static void sub_0206CE08 (int param0, u16 * param1, Pokemon * param2) { Strbuf* v0 = Strbuf_Init(64, param0); - GetMonData(param2, MON_DATA_119, v0); + Pokemon_GetValue(param2, MON_DATA_119, v0); Strbuf_ToChars(v0, param1, 10 + 1); Strbuf_Free(v0); } static void sub_0206CE38 (Pokemon * param0, u16 * param1, u8 * param2, u8 * param3, u8 * param4) { - *param1 = GetMonData(param0, MON_DATA_SPECIES, NULL); - *param2 = GetMonData(param0, MON_DATA_111, NULL); - *param3 = GetMonData(param0, MON_DATA_LANGUAGE, NULL); - *param4 = GetMonData(param0, MON_DATA_MET_GAME, NULL); + *param1 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + *param2 = Pokemon_GetValue(param0, MON_DATA_GENDER, NULL); + *param3 = Pokemon_GetValue(param0, MON_DATA_LANGUAGE, NULL); + *param4 = Pokemon_GetValue(param0, MON_DATA_MET_GAME, NULL); } static void sub_0206CE74 (UnkStruct_0200B358 * param0, int param1, u16 param2, u8 param3, u8 param4, u8 param5) @@ -506,12 +505,12 @@ static void sub_0206CEA4 (UnkStruct_0200B358 * param0, int param1, u16 param2) static void sub_0206CED0 (int param0, Pokemon * param1, u8 * param2, u16 * param3) { - *param2 = GetMonData(param1, MON_DATA_77, NULL); + *param2 = Pokemon_GetValue(param1, MON_DATA_77, NULL); if (*param2) { Strbuf* v0 = Strbuf_Init(64, param0); - GetMonData(param1, MON_DATA_119, v0); + Pokemon_GetValue(param1, MON_DATA_119, v0); Strbuf_ToChars(v0, param3, 10 + 1); Strbuf_Free(v0); } @@ -536,10 +535,10 @@ void sub_0206CF48 (UnkStruct_0202440C * param0, Pokemon * param1, int param2) v0->unk_00 = 1; v0->unk_1F = 0; - v0->unk_1E = sub_02075BCC(param1); + v0->unk_1E = Pokemon_GetNature(param1); sub_0206CE38(param1, &v0->unk_02, &v0->unk_04, &v0->unk_05, &v0->unk_06); - v0->unk_07 = GetMonData(param1, MON_DATA_77, NULL); + v0->unk_07 = Pokemon_GetValue(param1, MON_DATA_77, NULL); sub_0206CED0(param2, param1, &v0->unk_07, v0->unk_08); sub_02025C84(27); @@ -614,7 +613,7 @@ void sub_0206D048 (UnkStruct_0202440C * param0, Pokemon * param1) v0->unk_00 = 1; sub_0206CE38(param1, &v0->unk_02, &v0->unk_04, &v0->unk_05, &v0->unk_06); - v0->unk_07 = GetMonData(param1, MON_DATA_77, NULL); + v0->unk_07 = Pokemon_GetValue(param1, MON_DATA_77, NULL); sub_0206CED0(11, param1, &v0->unk_07, v0->unk_08); sub_02025C84(27); @@ -704,7 +703,7 @@ void sub_0206D160 (UnkStruct_0206D140 * param0, Pokemon * param1, int param2, in sub_0206CE38(param1, ¶m0->unk_06, ¶m0->unk_08, ¶m0->unk_09, ¶m0->unk_0A); - param0->unk_22 = GetMonData(param1, MON_DATA_POKEBALL, NULL); + param0->unk_22 = Pokemon_GetValue(param1, MON_DATA_POKEBALL, NULL); GF_ASSERT(param0->unk_22); sub_0206CED0(param4, param1, ¶m0->unk_0B, param0->unk_0C); @@ -1052,8 +1051,8 @@ void sub_0206D7C4 (UnkStruct_0203CDB0 * param0) for (v5 = 0; v5 < v4; v5++) { v6 = Party_GetPokemonBySlotIndex(v8, v5); - if (GetMonData(v6, MON_DATA_IS_EGG, NULL) == 0) { - v3 = GetMonData(v6, MON_DATA_111, NULL); + if (Pokemon_GetValue(v6, MON_DATA_IS_EGG, NULL) == 0) { + v3 = Pokemon_GetValue(v6, MON_DATA_GENDER, NULL); if (v3 == 0) { v0 = 1; @@ -1156,7 +1155,7 @@ void sub_0206D9B4 (UnkStruct_0202440C * param0, Pokemon * param1, u8 param2) UnkStruct_0206D9F4 * v1 = &v0.val14; v1->unk_06 = param2; - v1->unk_05 = sub_0201D35C() % 3; + v1->unk_05 = MTRNG_Next() % 3; sub_0206CE38(param1, &v1->unk_00, &v1->unk_02, &v1->unk_03, &v1->unk_04); sub_0202E43C(param0, 2, 21, (const u8 *)v1); @@ -1458,7 +1457,7 @@ static u8 sub_0206DE4C (Pokemon * param0) v0 = 0; for (v1 = 0; v1 < (NELEMS(Unk_020EFDDC)); v1++) { - if (GetMonData(param0, Unk_020EFDDC[v1], NULL) == 1) { + if (Pokemon_GetValue(param0, Unk_020EFDDC[v1], NULL) == 1) { v0++; } } @@ -2072,7 +2071,7 @@ static int sub_0206E870 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param GF_ASSERT(v1 > 0); if (v1 > 1) { - v1 = sub_0201D35C() % v1; + v1 = MTRNG_Next() % v1; } else { v1 = 0; } @@ -2703,8 +2702,8 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v5 = 0xff; v6 = 0xff; - v0 = (sub_0201D2E8() % 0xffff); - v2 = GetNatureFromPersonality(v0); + v0 = (LCRNG_Next() % 0xffff); + v2 = Pokemon_GetNatureOf(v0); sub_0200B6D8(param1, 0, v2); @@ -2714,7 +2713,7 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param if ((v0 % 2) == 0) { for (v1 = 0; v1 < 5; v1++) { - if (sub_02077648(v0, v1) == 1) { + if (Pokemon_GetFlavorAffinityOf(v0, v1) == 1) { v5 = v1; break; } @@ -2725,7 +2724,7 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param } for (v1 = 0; v1 < 5; v1++) { - if (sub_02075C60(v2, 1 + v1) > 0) { + if (Pokemon_GetStatAffinityOf(v2, 1 + v1) > 0) { v6 = v1; break; } @@ -2745,7 +2744,7 @@ static int sub_0206EDAC (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param UnkStruct_02025E6C * v7 = sub_02025E38(sub_0203D174(param0)); v1 = sub_0202D834(param0->unk_0C); - v2 = (sub_0201D2E8() % 29); + v2 = (LCRNG_Next() % 29); sub_02071D10(sub_0206C3C8(v2), 4, v6); sub_0200B48C(param1, 0, v6, 0, 1, GAME_LANGUAGE); @@ -2758,7 +2757,7 @@ static int sub_0206EDAC (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v4 = sub_0202D93C(v0, 4); v5 = sub_0202D93C(v0, 3); - sub_0206CE74(param1, 1, v4, sub_02075DAC(v4, v5), sub_02025FD8(v7), sub_02025FCC(v7)); + sub_0206CE74(param1, 1, v4, Pokemon_GetGenderOf(v4, v5), sub_02025FD8(v7), sub_02025FCC(v7)); break; } } @@ -2804,7 +2803,7 @@ static int sub_0206EEBC (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v2 = sub_0206EE9C(v5); if (v2 > 1) { - v3 = sub_0201D35C() % v2; + v3 = MTRNG_Next() % v2; } else { v3 = 0; } @@ -2857,13 +2856,13 @@ static int sub_0206EF7C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v0 = 0; if (sub_0206A954(sub_020507E4(param0->unk_0C)) == 1) { - v0 = (sub_0201D2E8() % 8); + v0 = (LCRNG_Next() % 8); } else if (inline_0208BE68(sub_020507E4(param0->unk_0C), 11) == 1) { - v0 = (sub_0201D2E8() % 5); + v0 = (LCRNG_Next() % 5); } else if (inline_0208BE68(sub_020507E4(param0->unk_0C), 10) == 1) { - v0 = (sub_0201D2E8() % 4); + v0 = (LCRNG_Next() % 4); } else if (inline_0208BE68(sub_020507E4(param0->unk_0C), 18) == 1) { - v0 = (sub_0201D2E8() % 2); + v0 = (LCRNG_Next() % 2); } return 0 + v0; @@ -2875,7 +2874,7 @@ static int sub_0206F01C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param u16 v1, v2, v3; const UnkStruct_02026324 * v4 = sub_02027560(param0->unk_0C); - v1 = (sub_0201D2E8() % (493 - 1)) + 1; + v1 = (LCRNG_Next() % (493 - 1)) + 1; for (v2 = 1; v2 <= 493; v2++) { if (sub_02026FE8(v4, v1) == 1) { @@ -2895,12 +2894,12 @@ static int sub_0206F01C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param sub_0200B48C(param1, 0, v0, 0, 1, GAME_LANGUAGE); Strbuf_Free(v0); - v1 = (sub_0201D2E8() % 3); + v1 = (LCRNG_Next() % 3); if (v1 == 0) { return 8; } else if (v1 == 1) { - v1 = (sub_0201D2E8() % 34) + 25; + v1 = (LCRNG_Next() % 34) + 25; sub_0200B60C(param1, 1, v1, 2, 0, 1); return 9; } else { @@ -2935,7 +2934,7 @@ static int sub_0206F118 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param { u16 v0; - v0 = (sub_0201D2E8() % 3); + v0 = (LCRNG_Next() % 3); if (v0 == 0) { return 11; @@ -2950,7 +2949,7 @@ static int sub_0206F13C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param { u16 v0; - v0 = (sub_0201D2E8() % 3); + v0 = (LCRNG_Next() % 3); if (v0 == 0) { return 14; @@ -2973,10 +2972,10 @@ static int sub_0206F160 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v4 = Party_GetFromSavedata(param0->unk_0C); v3 = Party_GetPokemonBySlotIndex(v4, sub_0205E1B4(param0->unk_0C)); - sub_0206CE74(param1, 0, GetMonData(v3, MON_DATA_SPECIES, NULL), GetMonData(v3, MON_DATA_111, NULL), sub_02025FD8(v5), sub_02025FCC(v5)); - sub_0200BFAC(param1, 1, (sub_0201D2E8() % 100)); + sub_0206CE74(param1, 0, Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), Pokemon_GetValue(v3, MON_DATA_GENDER, NULL), sub_02025FD8(v5), sub_02025FCC(v5)); + sub_0200BFAC(param1, 1, (LCRNG_Next() % 100)); - v1 = (sub_0201D2E8() % (493 - 2) + 1); + v1 = (LCRNG_Next() % (493 - 2) + 1); for (v2 = 1; v2 <= 493; v2++) { if (sub_02026FE8(v6, v1) == 1) { @@ -2993,7 +2992,7 @@ static int sub_0206F160 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param } } - sub_0200B630(param1, 3, (sub_0201D2E8() % 467 - 2) + 1); + sub_0200B630(param1, 3, (LCRNG_Next() % 467 - 2) + 1); return 17; } @@ -3032,7 +3031,7 @@ static int sub_0206F29C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param { u16 v0; - v0 = (sub_0201D2E8() % 9); + v0 = (LCRNG_Next() % 9); if (v0 == 0) { return 20; diff --git a/src/unk_0207064C.c b/src/unk_0207064C.c index d6344ec0b1..89b054942d 100644 --- a/src/unk_0207064C.c +++ b/src/unk_0207064C.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0.h" #include "struct_defs/struct_02049FA8.h" diff --git a/src/unk_020722AC.c b/src/unk_020722AC.c index 7858373f5c..8d930b0fd6 100644 --- a/src/unk_020722AC.c +++ b/src/unk_020722AC.c @@ -13,7 +13,7 @@ #include "strbuf.h" #include "struct_decls/struct_02028430_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_02073C2C.c b/src/unk_02073C2C.c deleted file mode 100644 index 7aa346f0e7..0000000000 --- a/src/unk_02073C2C.c +++ /dev/null @@ -1,5564 +0,0 @@ -#include -#include - -#include "inlines.h" - -#include "struct_decls/struct_02002F38_decl.h" -#include "struct_decls/struct_02006C24_decl.h" -#include "struct_decls/struct_02007C7C_decl.h" -#include "struct_decls/struct_0200C6E4_decl.h" -#include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_02015F84_decl.h" -#include "strbuf.h" -#include "struct_decls/struct_02025E6C_decl.h" -#include "struct_decls/struct_0202CC84_decl.h" -#include "struct_decls/party_pokemon.h" -#include "struct_decls/struct_party_decl.h" - -#include "struct_defs/struct_02007C10.h" -#include "struct_defs/struct_02008A90.h" -#include "struct_defs/struct_0200D0F4.h" -#include "struct_defs/struct_0202818C.h" -#include "struct_defs/struct_0202CA28.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" -#include "struct_defs/party_pokemon.h" -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" -#include "struct_defs/struct_02075874.h" -#include "struct_defs/struct_0207821C.h" -#include "struct_defs/struct_0207825C.h" -#include "struct_defs/struct_0207825C_1.h" -#include "struct_defs/struct_0207825C_10.h" -#include "struct_defs/struct_0207825C_11.h" -#include "struct_defs/struct_0207825C_12.h" -#include "struct_defs/struct_0207825C_13.h" -#include "struct_defs/struct_0207825C_14.h" -#include "struct_defs/struct_0207825C_15.h" -#include "struct_defs/struct_0207825C_16.h" -#include "struct_defs/struct_0207825C_17.h" -#include "struct_defs/struct_0207825C_18.h" -#include "struct_defs/struct_0207825C_19.h" -#include "struct_defs/struct_0207825C_2.h" -#include "struct_defs/struct_0207825C_20.h" -#include "struct_defs/struct_0207825C_21.h" -#include "struct_defs/struct_0207825C_22.h" -#include "struct_defs/struct_0207825C_23.h" -#include "struct_defs/struct_0207825C_3.h" -#include "struct_defs/struct_0207825C_4.h" -#include "struct_defs/struct_0207825C_5.h" -#include "struct_defs/struct_0207825C_6.h" -#include "struct_defs/struct_0207825C_7.h" -#include "struct_defs/struct_0207825C_8.h" -#include "struct_defs/struct_0207825C_9.h" -#include "struct_defs/struct_020789BC.h" -#include "struct_defs/struct_020789F4.h" -#include "struct_defs/struct_02078B40.h" -#include "overlay005/struct_ov5_021DE5D0.h" -#include "overlay104/struct_ov104_0223F9E0.h" - -#include "unk_020021B0.h" -#include "unk_02005474.h" -#include "unk_02006224.h" -#include "narc.h" -#include "message.h" -#include "unk_0200B29C.h" -#include "unk_0200C6E4.h" -#include "unk_0201378C.h" -#include "unk_02015F84.h" -#include "unk_02017038.h" -#include "heap.h" -#include "unk_0201D15C.h" -#include "unk_020218BC.h" -#include "strbuf.h" -#include "unk_02025E68.h" -#include "unk_02028124.h" -#include "unk_0202C9F4.h" -#include "unk_02073C2C.h" -#include "move_table.h" -#include "unk_02079170.h" -#include "party.h" -#include "item.h" -#include "unk_02092494.h" - -#include "constants/species.h" - -static const s8 Unk_020F0695[][5] = { - { 0x0, 0x0, 0x0, 0x0, 0x0 }, - { 0x1, 0x0, 0x0, 0x0, -0x1 }, - { 0x1, 0x0, -0x1, 0x0, 0x0 }, - { 0x1, -0x1, 0x0, 0x0, 0x0 }, - { 0x1, 0x0, 0x0, -0x1, 0x0 }, - { -0x1, 0x0, 0x0, 0x0, 0x1 }, - { 0x0, 0x0, 0x0, 0x0, 0x0 }, - { 0x0, 0x0, -0x1, 0x0, 0x1 }, - { 0x0, -0x1, 0x0, 0x0, 0x1 }, - { 0x0, 0x0, 0x0, -0x1, 0x1 }, - { -0x1, 0x0, 0x1, 0x0, 0x0 }, - { 0x0, 0x0, 0x1, 0x0, -0x1 }, - { 0x0, 0x0, 0x0, 0x0, 0x0 }, - { 0x0, -0x1, 0x1, 0x0, 0x0 }, - { 0x0, 0x0, 0x1, -0x1, 0x0 }, - { -0x1, 0x1, 0x0, 0x0, 0x0 }, - { 0x0, 0x1, 0x0, 0x0, -0x1 }, - { 0x0, 0x1, -0x1, 0x0, 0x0 }, - { 0x0, 0x0, 0x0, 0x0, 0x0 }, - { 0x0, 0x1, 0x0, -0x1, 0x0 }, - { -0x1, 0x0, 0x0, 0x1, 0x0 }, - { 0x0, 0x0, 0x0, 0x1, -0x1 }, - { 0x0, 0x0, -0x1, 0x1, 0x0 }, - { 0x0, -0x1, 0x0, 0x1, 0x0 }, - { 0x0, 0x0, 0x0, 0x0, 0x0 }, -}; - -void ZeroMonData(Pokemon * param0); -void ZeroBoxMonData(BoxPokemon * param0); -int PokemonStructSize(void); -Pokemon * AllocMonZeroed(u32 heapID); -BOOL sub_02073C88(Pokemon * param0); -BOOL sub_02073CD4(Pokemon * param0, BOOL param1); -BOOL sub_02073D20(BoxPokemon * param0); -BOOL sub_02073D48(BoxPokemon * param0, BOOL param1); -void sub_02073D80(Pokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7); -void sub_02073E18(BoxPokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7); -void sub_02074044(Pokemon *, u16 param0, u8 param1, u8 param2, u8 param3); -void sub_02074088(Pokemon *, u16 param0, u8 param1, u8 param2, u8 param3, u8 param4, u8 param5); -u32 sub_02074128(u16 param0, u8 param1, u8 param2); -void sub_02074158(Pokemon *, u16 param0, u8 param1, u32 param2, u32 param3); -void sub_0207418C(Pokemon * param0); -void sub_020741B8(Pokemon * param0); -u32 GetMonData(Pokemon * param0, int param1, void * param2); -static u32 sub_020744E8(Pokemon * param0, int param1, void * param2); -u32 sub_02074570(BoxPokemon * param0, int param1, void * param2); -static u32 sub_020745D0(BoxPokemon * param0, int param1, void * param2); -void sub_02074B30(Pokemon * param0, int param1, const void * param2); -static void sub_02074BC0(Pokemon * param0, int param1, const void * param2); -void SetBoxMonData(BoxPokemon * param0, int param1, const void * param2); -static void sub_02074CD8(BoxPokemon * param0, int param1, const void * param2); -void sub_0207536C(Pokemon * param0, int param1, int param2); -static void sub_020753F4(Pokemon * param0, int param1, int param2); -static void sub_02075454(BoxPokemon * param0, int param1, int param2); -u32 sub_020759CC(int param0, int param1, int param2); -u32 sub_020759F0(int param0, int param1); -u8 sub_02075A10(Pokemon * param0); -u32 sub_02075A70(Pokemon * param0); -u32 sub_02075A78(BoxPokemon * param0); -u32 sub_02075AAC(Pokemon * param0); -u32 sub_02075AD0(int param0, int param1); -void sub_02075AE4(int param0, u32 * param1); -u32 sub_02075B00(int param0, int param1); -u32 sub_02075B38(Pokemon * param0); -u32 sub_02075B40(BoxPokemon * param0); -u32 sub_02075B78(u16 param0, u32 param1); -u8 sub_02075BCC(Pokemon * param0); -u8 sub_02075BD4(BoxPokemon * param0); -u8 GetNatureFromPersonality(u32 param0); -u16 sub_02075C0C(u8 param0, u16 param1, u8 param2); -s8 sub_02075C60(u8 param0, u8 param1); -void sub_02075C74(Pokemon * param0, u8 param1, u16 param2); -u8 sub_02075D6C(Pokemon * param0); -u8 sub_02075D74(BoxPokemon * param0); -u8 sub_02075DAC(u16 param0, u32 param1); -u8 sub_02075E0C(Pokemon * param0); -u8 sub_02075E14(BoxPokemon * param0); -u8 sub_02075E38(u32 param0, u32 param1); -u32 sub_02075E64(u32 param0); -void sub_02075EF4(UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2); -void sub_02075F0C(UnkStruct_02008A90 * param0, BoxPokemon * param1, u8 param2, int param3); -void sub_02075FB4(UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6); -u8 SanitizeFormId(u16 param0, u8 param1); -u8 sub_020765AC(Pokemon * param0, u8 param1); -u8 sub_020765C4(BoxPokemon * param0, u8 param1, int param2); -u8 sub_02076648(u16 param0, u8 param1, u8 param2, u8 param3, u32 param4); -void sub_0207697C(UnkStruct_02008A90 * param0, u16 param1); -UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int param8); -void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 * param2); -u32 sub_02076AF0(void); -u32 sub_02076AF4(void); -u8 sub_02076AF8(Pokemon * param0); -u8 sub_02076B00(BoxPokemon * param0); -BoxPokemon * sub_02076B10(Pokemon * param0); -u8 sub_02076B14(Pokemon * param0); -u16 sub_02076B94(Party * param0, Pokemon * param1, u8 param2, u16 param3, int * param4); -void sub_02077020(BoxPokemon * param0); -u16 sub_020770C4(Pokemon * param0, u16 param1); -u16 sub_020770D4(BoxPokemon * param0, u16 param1); -void sub_02077134(Pokemon * param0, u16 param1); -void sub_02077144(BoxPokemon * param0, u16 param1); -void sub_020771F8(Pokemon * param0, u16 param1, u8 param2); -void sub_02077230(Pokemon * param0, u16 param1, u8 param2); -void sub_02077238(BoxPokemon * param0, u16 param1, u8 param2); -u16 sub_0207727C(Pokemon * param0, int * param1, u16 * param2); -void sub_02077344(Pokemon * param0, int param1, int param2); -void sub_0207734C(BoxPokemon * param0, int param1, int param2); -void sub_02077408(Pokemon * param0, u32 param1); -BOOL sub_0207749C(Pokemon * param0, u16 param1); -void sub_020774C8(BoxPokemon * param0, Pokemon * param1); -u8 sub_02077550(Party * param0); -u16 sub_020775A4(u16 param0); -u16 sub_020775C4(u16 param0); -void sub_020775EC(Pokemon * param0, Pokemon * param1); -void sub_02077604(BoxPokemon * param0, BoxPokemon * param1); -void sub_02077618(Pokemon * param0, BoxPokemon * param1); -s8 sub_0207762C(Pokemon * param0, int param1); -s8 sub_02077634(BoxPokemon * param0, int param1); -s8 sub_02077648(u32 param0, int param1); -void sub_020776B0(Party * param0); -u8 sub_02077758(Party * param0, u8 param1); -void sub_020777B4(Party * param0, s32 param1); -void sub_0207782C(Party * param0); -BOOL sub_020778D8(Pokemon * param0); -BOOL sub_020778E0(BoxPokemon * param0); -BOOL sub_020778F8(Pokemon * param0); -BOOL sub_02077900(BoxPokemon * param0); -void sub_02077928(Pokemon * param0); -void sub_02077930(BoxPokemon * param0); -u8 sub_02077988(u16 param0); -int sub_02077A00(Pokemon * param0); -int sub_02077A1C(BoxPokemon * param0); -void SetShayminForm(Pokemon * param0, int param1); -void SetBoxShayminForm(BoxPokemon * param0, int param1); -void sub_02077D28(int param0, int param1, u16 * param2); -void sub_02077D3C(UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7); -void sub_02077E64(Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EA4(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EE4(Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EF8(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077F0C(Pokemon * param0, u32 param1, int param2); -BOOL sub_02077FB4(Pokemon * param0, u8 param1); -BOOL sub_02077FBC(BoxPokemon * param0, u8 param1); -BOOL sub_02077FE4(u16 param0, int param1, u8 param2); -void sub_0207803C(Pokemon * param0); -void sub_02078044(BoxPokemon * param0); -void sub_020780C4(Pokemon * param0, u32 param1); -static void sub_020781F8(int param0, UnkStruct_02075874 * param1); -static void sub_02078208(int param0, int param1, UnkStruct_02075874 * param2); -static void sub_0207821C(int param0, UnkStruct_0207821C * param1); -static void sub_0207822C(void * param0, u32 param1, u32 param2); -static void sub_02078234(void * param0, u32 param1, u32 param2); -static u16 sub_0207823C(void * param0, u32 param1); -static void * sub_0207825C(BoxPokemon * param0, u32 param1, u8 param2); -static int sub_02078740(int param0, int param1); -u32 FlagIndex(int flag); -int sub_020787EC(u32 param0); -BOOL sub_02078804(u16 param0); -BOOL sub_02078838(Pokemon * param0); -int sub_020788D0(int param0); -static void sub_02076300(UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6); -static u8 sub_020767BC(u16 param0, u8 param1, u8 param2, u8 param3, u32 param4); - -void ZeroMonData (Pokemon * mon) -{ - MI_CpuClearFast(mon, sizeof(Pokemon)); - sub_0207822C(&mon->box.unk_08, sizeof(PokemonSubstruct0) * 4, mon->box.unk_06); - sub_0207822C(&mon->party, sizeof(PartyPokemon), mon->box.unk_00); -} - -void ZeroBoxMonData (BoxPokemon * boxMon) -{ - MI_CpuClearFast(boxMon, sizeof(BoxPokemon)); - sub_0207822C(boxMon->unk_08, sizeof(PokemonSubstruct0) * 4, boxMon->unk_06); -} - -int PokemonStructSize (void) -{ - return sizeof(Pokemon); -} - -Pokemon * AllocMonZeroed (u32 heapID) -{ - Pokemon * mon = Heap_AllocFromHeap(heapID, sizeof(Pokemon)); - ZeroMonData(mon); - return mon; -} - -BOOL sub_02073C88 (Pokemon * param0) -{ - BOOL v0; - - v0 = 0; - - if (param0->box.unk_04_0 == 0) { - v0 = 1; - GF_ASSERT(param0->box.unk_04_1 == 0); - - param0->box.unk_04_0 = 1; - param0->box.unk_04_1 = 1; - - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } - - return v0; -} - -BOOL sub_02073CD4 (Pokemon * param0, BOOL param1) -{ - BOOL v0; - - v0 = 0; - - if ((param0->box.unk_04_0 == 1) && (param1 == 1)) { - v0 = 1; - param0->box.unk_04_0 = 0; - param0->box.unk_04_1 = 0; - - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - param0->box.unk_06 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } - - return v0; -} - -BOOL sub_02073D20 (BoxPokemon * param0) -{ - BOOL v0; - - v0 = 0; - - if (param0->unk_04_1 == 0) { - v0 = 1; - param0->unk_04_1 = 1; - sub_02078234(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - } - - return v0; -} - -BOOL sub_02073D48 (BoxPokemon * param0, BOOL param1) -{ - BOOL v0; - - v0 = 0; - - if ((param0->unk_04_1 == 1) && (param1 == 1)) { - v0 = 1; - - param0->unk_04_1 = 0; - param0->unk_06 = sub_0207823C(param0->unk_08, sizeof(PokemonSubstruct0) * 4); - - sub_0207822C(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - } - - return v0; -} - -void sub_02073D80 (Pokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7) -{ - u32 v0; - UnkStruct_0202818C * v1; - UnkStruct_0202CA28 v2; - - ZeroMonData(param0); - - sub_02073E18((BoxPokemon *)¶m0->box, param1, param2, param3, param4, param5, param6, param7); - sub_0207822C(¶m0->party, sizeof(PartyPokemon), 0); - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02074B30(param0, 161, (u8 *)¶m2); - - v1 = sub_0202818C(0); - - sub_02074B30(param0, 170, v1); - Heap_FreeToHeap(v1); - - v0 = 0; - sub_02074B30(param0, 162, (u8 *)&v0); - - MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - - sub_02074B30(param0, 171, (UnkStruct_0202CA28 *)&v2); - sub_0207418C(param0); -} - -void sub_02073E18 (BoxPokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7) -{ - u16 v0; - u32 v1, v2; - BOOL v3; - - ZeroBoxMonData(param0); - - v3 = sub_02073D20(param0); - - if (!param4) { - param5 = (sub_0201D2E8() | (sub_0201D2E8() << 16)); - } - - SetBoxMonData(param0, 0, (u8 *)¶m5); - - if (param6 == 2) { - do { - param7 = (sub_0201D2E8() | (sub_0201D2E8() << 16)); - } while ((((param7 & 0xffff0000) >> 16) ^ (param7 & 0xffff) ^ ((param5 & 0xffff0000) >> 16) ^ (param5 & 0xffff)) < 8); - } else if (param6 != 1) { - param7 = 0; - } - - SetBoxMonData(param0, 7, (u8 *)¶m7); - SetBoxMonData(param0, 12, (u8 *)&Unk_020E4C44); - SetBoxMonData(param0, 5, (u8 *)¶m1); - SetBoxMonData(param0, 179, NULL); - - v1 = sub_02075AD0(param1, param2); - SetBoxMonData(param0, 8, (u8 *)&v1); - - v1 = sub_020759F0(param1, 20); - SetBoxMonData(param0, 9, (u8 *)&v1); - - SetBoxMonData(param0, 156, (u8 *)¶m2); - SetBoxMonData(param0, 122, (u8 *)&Unk_020E4C40); - - v1 = 4; - SetBoxMonData(param0, 155, (u8 *)&v1); - - if (param3 < 32) { - SetBoxMonData(param0, 70, (u8 *)¶m3); - SetBoxMonData(param0, 71, (u8 *)¶m3); - SetBoxMonData(param0, 72, (u8 *)¶m3); - SetBoxMonData(param0, 73, (u8 *)¶m3); - SetBoxMonData(param0, 74, (u8 *)¶m3); - SetBoxMonData(param0, 75, (u8 *)¶m3); - } else { - v1 = sub_0201D2E8(); - v2 = (v1 & (0x1f << 0)) >> 0; - SetBoxMonData(param0, 70, (u8 *)&v2); - - v2 = (v1 & (0x1f << 5)) >> 5; - SetBoxMonData(param0, 71, (u8 *)&v2); - - v2 = (v1 & (0x1f << 10)) >> 10; - SetBoxMonData(param0, 72, (u8 *)&v2); - - v1 = sub_0201D2E8(); - v2 = (v1 & (0x1f << 0)) >> 0; - SetBoxMonData(param0, 73, (u8 *)&v2); - - v2 = (v1 & (0x1f << 5)) >> 5; - SetBoxMonData(param0, 74, (u8 *)&v2); - - v2 = (v1 & (0x1f << 10)) >> 10; - SetBoxMonData(param0, 75, (u8 *)&v2); - } - - v1 = sub_020759F0(param1, 24); - v2 = sub_020759F0(param1, 25); - - if (v2 != 0) { - if (param5 & 1) { - SetBoxMonData(param0, 10, (u8 *)&v2); - } else { - SetBoxMonData(param0, 10, (u8 *)&v1); - } - } else { - SetBoxMonData(param0, 10, (u8 *)&v1); - } - - v1 = sub_02075D74(param0); - - SetBoxMonData(param0, 111, (u8 *)&v1); - sub_02077020(param0); - sub_02073D48(param0, v3); -} - -void sub_02074044 (Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4) -{ - u32 v0; - - do { - v0 = (sub_0201D2E8() | (sub_0201D2E8() << 16)); - } while (param4 != GetNatureFromPersonality(v0)); - - sub_02073D80(param0, param1, param2, param3, 1, v0, 0, 0); -} - -void sub_02074088 (Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u8 param6) -{ - u32 v0; - u32 v1; - u16 v2; - - if ((param6) && (param6 < 29)) { - do { - v0 = (sub_0201D2E8() | (sub_0201D2E8() << 16)); - v2 = (((v0 & 0x3000000) >> 18) | ((v0 & 0x30000) >> 12) | ((v0 & 0x300) >> 6) | (v0 & 0x3)) % 28; - } while ((param5 != GetNatureFromPersonality(v0)) || (param4 != sub_02075DAC(param1, v0)) || (v2 != (param6 - 1))); - } else { - v0 = sub_02074128(param1, param4, param5); - } - - sub_02073D80(param0, param1, param2, param3, 1, v0, 0, 0); -} - -u32 sub_02074128 (u16 param0, u8 param1, u8 param2) -{ - u8 v0; - u32 v1; - - v0 = sub_020759F0(param0, 18); - - switch (v0) { - case 0: - case 254: - case 255: - v1 = param2; - break; - default: - if (param1 == 0) { - v1 = 25 * ((v0 / 25) + 1); - v1 += param2; - } else { - v1 = param2; - } - break; - } - - return v1; -} - -void sub_02074158 (Pokemon * param0, u16 param1, u8 param2, u32 param3, u32 param4) -{ - sub_02073D80(param0, param1, param2, 0, 1, param4, 0, 0); - sub_02074B30(param0, 175, (u8 *)¶m3); - sub_0207418C(param0); -} - -void sub_0207418C (Pokemon * param0) -{ - int v0; - BOOL v1; - - v1 = sub_02073C88(param0); - v0 = sub_02075B38(param0); - - sub_02074B30(param0, 161, (u8 *)&v0); - sub_020741B8(param0); - sub_02073CD4(param0, v1); -} - -void sub_020741B8 (Pokemon * param0) -{ - int v0, v1, v2; - int v3, v4, v5, v6, v7; - int v8, v9, v10, v11, v12, v13; - int v14, v15, v16, v17, v18, v19; - int v20; - int v21; - int v22; - int v23, v24, v25; - UnkStruct_02075874 * v26; - BOOL v27; - - v27 = sub_02073C88(param0); - - v21 = GetMonData(param0, MON_DATA_161, 0); - v0 = GetMonData(param0, MON_DATA_164, 0); - v1 = GetMonData(param0, MON_DATA_163, 0); - v8 = GetMonData(param0, MON_DATA_HP_IV, 0); - v14 = GetMonData(param0, MON_DATA_HP_EV, 0); - v9 = GetMonData(param0, MON_DATA_ATK_IV, 0); - v15 = GetMonData(param0, MON_DATA_ATK_EV, 0); - v10 = GetMonData(param0, MON_DATA_DEF_IV, 0); - v16 = GetMonData(param0, MON_DATA_DEF_EV, 0); - v11 = GetMonData(param0, MON_DATA_SPEED_IV, 0); - v17 = GetMonData(param0, MON_DATA_SPEED_EV, 0); - v12 = GetMonData(param0, MON_DATA_SPATK_IV, 0); - v18 = GetMonData(param0, MON_DATA_SPATK_EV, 0); - v13 = GetMonData(param0, MON_DATA_SPDEF_IV, 0); - v19 = GetMonData(param0, MON_DATA_SPDEF_EV, 0); - v22 = GetMonData(param0, MON_DATA_FORM, 0); - v20 = GetMonData(param0, MON_DATA_SPECIES, 0); - v26 = Heap_AllocFromHeap(0, sizeof(UnkStruct_02075874)); - - sub_02078208(v20, v22, v26); - - if (v20 == 292) { - v2 = 1; - } else { - v2 = ((2 * v26->unk_00 + v8 + v14 / 4) * v21 / 100 + v21 + 10); - } - - sub_02074B30(param0, 164, (u8 *)&v2); - - v3 = ((2 * v26->unk_01 + v9 + v15 / 4) * v21 / 100 + 5); - v3 = sub_02075C0C(sub_02075BCC(param0), v3, 0x1); - - sub_02074B30(param0, 165, (u8 *)&v3); - - v4 = ((2 * v26->unk_02 + v10 + v16 / 4) * v21 / 100 + 5); - v4 = sub_02075C0C(sub_02075BCC(param0), v4, 0x2); - - sub_02074B30(param0, 166, (u8 *)&v4); - - v5 = ((2 * v26->unk_03 + v11 + v17 / 4) * v21 / 100 + 5); - v5 = sub_02075C0C(sub_02075BCC(param0), v5, 0x3); - - sub_02074B30(param0, 167, (u8 *)&v5); - - v6 = ((2 * v26->unk_04 + v12 + v18 / 4) * v21 / 100 + 5); - v6 = sub_02075C0C(sub_02075BCC(param0), v6, 0x4); - - sub_02074B30(param0, 168, (u8 *)&v6); - - v7 = ((2 * v26->unk_05 + v13 + v19 / 4) * v21 / 100 + 5); - v7 = sub_02075C0C(sub_02075BCC(param0), v7, 0x5); - - sub_02074B30(param0, 169, (u8 *)&v7); - Heap_FreeToHeap(v26); - - if ((v1 == 0) && (v0 != 0)) { - (void)0; - } else { - if (v20 == 292) { - v1 = 1; - } else if (v1 == 0) { - v1 = v2; - } else { - v1 += (v2 - v0); - } - } - - if (v1) { - sub_02074B30(param0, 163, (u8 *)&v1); - } - - sub_02073CD4(param0, v27); -} - -u32 GetMonData (Pokemon * param0, int param1, void * param2) -{ - u32 v0; - u16 v1; - - if (param0->box.unk_04_0 == 0) { - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - - v1 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v1 != param0->box.unk_06) { - GF_ASSERT((v1 == param0->box.unk_06)); - param0->box.unk_04_2 = 1; - } - } - - v0 = sub_020744E8(param0, param1, param2); - - if (param0->box.unk_04_0 == 0) { - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } - - return v0; -} - -static u32 sub_020744E8 (Pokemon * param0, int param1, void * param2) -{ - u32 v0 = 0; - - switch (param1) { - case 160: - v0 = param0->party.unk_00; - break; - case 161: - v0 = param0->party.unk_04; - break; - case 162: - v0 = param0->party.unk_05; - break; - case 163: - v0 = param0->party.unk_06; - break; - case 164: - v0 = param0->party.unk_08; - break; - case 165: - v0 = param0->party.unk_0A; - break; - case 166: - v0 = param0->party.unk_0C; - break; - case 167: - v0 = param0->party.unk_0E; - break; - case 168: - v0 = param0->party.unk_10; - break; - case 169: - v0 = param0->party.unk_12; - break; - case 170: - sub_020281A0(¶m0->party.unk_14, (UnkStruct_0202818C *)param2); - v0 = 1; - break; - case 171: - sub_0202CA10(¶m0->party.unk_4C, (UnkStruct_0202CA28 *)param2); - v0 = 1; - break; - default: - v0 = sub_020745D0((BoxPokemon *)¶m0->box, param1, param2); - break; - } - - return v0; -} - -u32 sub_02074570 (BoxPokemon * param0, int param1, void * param2) -{ - u16 v0; - u32 v1; - - if (param0->unk_04_1 == 0) { - sub_02078234(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - v0 = sub_0207823C(param0->unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v0 != param0->unk_06) { - GF_ASSERT((v0 == param0->unk_06)); - param0->unk_04_2 = 1; - } - } - - v1 = sub_020745D0(param0, param1, param2); - - if (param0->unk_04_1 == 0) { - sub_0207822C(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - } - - return v1; -} - -static u32 sub_020745D0 (BoxPokemon * param0, int param1, void * param2) -{ - u32 v0 = 0; - u64 v1; - PokemonSubstruct0 * v2; - PokemonSubstruct1 * v3; - PokemonSubstruct2 * v4; - PokemonSubstruct3 * v5; - - v2 = (PokemonSubstruct0 *)sub_0207825C(param0, param0->unk_00, 0); - v3 = (PokemonSubstruct1 *)sub_0207825C(param0, param0->unk_00, 1); - v4 = (PokemonSubstruct2 *)sub_0207825C(param0, param0->unk_00, 2); - v5 = (PokemonSubstruct3 *)sub_0207825C(param0, param0->unk_00, 3); - - switch (param1) { - default: - v0 = 0; - break; - case MON_DATA_PERSONALITY: - v0 = param0->unk_00; - break; - case MON_DATA_1: - v0 = param0->unk_04_0; - break; - case MON_DATA_2: - v0 = param0->unk_04_1; - break; - case MON_DATA_3: - v0 = param0->unk_04_2; - break; - case MON_DATA_4: - v0 = param0->unk_06; - break; - case MON_DATA_172: - v0 = (v2->species != SPECIES_NONE); - break; - case MON_DATA_173: - if (param0->unk_04_2) { - v0 = param0->unk_04_2; - } else { - v0 = v3->unk_10_30; - } - break; - case MON_DATA_SPECIES_EGG: - v0 = v2->species; - - if (v0 == 0) { - break; - } else if ((v3->unk_10_30) || (param0->unk_04_2)) { - v0 = 494; - } - break; - case MON_DATA_161: - v0 = sub_02075B78(v2->species, v2->unk_08); - break; - case MON_DATA_SPECIES: - if (param0->unk_04_2) { - v0 = 494; - } else { - v0 = v2->species; - } - break; - case MON_DATA_HELD_ITEM: - v0 = v2->item; - break; - case MON_DATA_OT_ID: - v0 = v2->unk_04; - break; - case MON_DATA_EXP: - v0 = v2->unk_08; - break; - case MON_DATA_FRIENDSHIP: - v0 = v2->friendship; - break; - case MON_DATA_10: - v0 = v2->unk_0D; - break; - case MON_DATA_11: - v0 = v2->unk_0E; - break; - case MON_DATA_LANGUAGE: - v0 = v2->unk_0F; - break; - case MON_DATA_HP_EV: - v0 = v2->unk_10; - break; - case MON_DATA_ATK_EV: - v0 = v2->unk_11; - break; - case MON_DATA_DEF_EV: - v0 = v2->unk_12; - break; - case MON_DATA_SPEED_EV: - v0 = v2->unk_13; - break; - case MON_DATA_SPATK_EV: - v0 = v2->unk_14; - break; - case MON_DATA_SPDEF_EV: - v0 = v2->unk_15; - break; - case MON_DATA_COOL: - v0 = v2->unk_16; - break; - case MON_DATA_BEAUTY: - v0 = v2->unk_17; - break; - case MON_DATA_CUTE: - v0 = v2->unk_18; - break; - case MON_DATA_SMART: - v0 = v2->unk_19; - break; - case MON_DATA_TOUGH: - v0 = v2->unk_1A; - break; - case MON_DATA_SHEEN: - v0 = v2->unk_1B; - break; - case MON_DATA_25: - case MON_DATA_26: - case MON_DATA_27: - case MON_DATA_28: - case MON_DATA_29: - case MON_DATA_30: - case MON_DATA_31: - case MON_DATA_32: - case MON_DATA_33: - case MON_DATA_34: - case MON_DATA_35: - case MON_DATA_36: - case MON_DATA_37: - case MON_DATA_38: - case MON_DATA_39: - case MON_DATA_40: - case MON_DATA_41: - case MON_DATA_42: - case MON_DATA_43: - case MON_DATA_44: - case MON_DATA_45: - case MON_DATA_46: - case MON_DATA_47: - case MON_DATA_48: - case MON_DATA_49: - case MON_DATA_50: - case MON_DATA_51: - case MON_DATA_52: - case MON_DATA_53: - v1 = 1; - v0 = ((v2->unk_1C & (v1 << param1 - 25)) != 0); - break; - case MON_DATA_MOVE1: - case MON_DATA_MOVE2: - case MON_DATA_MOVE3: - case MON_DATA_MOVE4: - v0 = v3->unk_00[param1 - 54]; - break; - case MON_DATA_58: - case MON_DATA_59: - case MON_DATA_60: - case MON_DATA_61: - v0 = v3->unk_08[param1 - 58]; - break; - case MON_DATA_62: - case MON_DATA_63: - case MON_DATA_64: - case MON_DATA_65: - v0 = v3->unk_0C[param1 - 62]; - break; - case MON_DATA_66: - case MON_DATA_67: - case MON_DATA_68: - case MON_DATA_69: - v0 = MoveTable_CalcMaxPP(v3->unk_00[param1 - 66], v3->unk_0C[param1 - 66]); - break; - case MON_DATA_HP_IV: - v0 = v3->unk_10_0; - break; - case MON_DATA_ATK_IV: - v0 = v3->unk_10_5; - break; - case MON_DATA_DEF_IV: - v0 = v3->unk_10_10; - break; - case MON_DATA_SPEED_IV: - v0 = v3->unk_10_15; - break; - case MON_DATA_SPATK_IV: - v0 = v3->unk_10_20; - break; - case MON_DATA_SPDEF_IV: - v0 = v3->unk_10_25; - break; - case MON_DATA_IS_EGG: - if (param0->unk_04_2) { - v0 = param0->unk_04_2; - } else { - v0 = v3->unk_10_30; - } - break; - case MON_DATA_77: - v0 = v3->unk_10_31; - break; - case MON_DATA_78: - case MON_DATA_79: - case MON_DATA_80: - case MON_DATA_81: - case MON_DATA_82: - case MON_DATA_83: - case MON_DATA_84: - case MON_DATA_85: - case MON_DATA_86: - case MON_DATA_87: - case MON_DATA_88: - case MON_DATA_89: - case MON_DATA_90: - case MON_DATA_91: - case MON_DATA_92: - case MON_DATA_93: - case MON_DATA_94: - case MON_DATA_95: - case MON_DATA_96: - case MON_DATA_97: - case MON_DATA_CHAMPION_RIBBON: - case MON_DATA_WINNING_RIBBON: - case MON_DATA_VICTORY_RIBBON: - case MON_DATA_ARTIST_RIBBON: - case MON_DATA_EFFORT_RIBBON: - case MON_DATA_MARINE_RIBBON: - case MON_DATA_LAND_RIBBON: - case MON_DATA_SKY_RIBBON: - case MON_DATA_COUNTRY_RIBBON: - case MON_DATA_NATIONAL_RIBBON: - case MON_DATA_EARTH_RIBBON: - case MON_DATA_WORLD_RIBBON: - v1 = 1; - v0 = ((v3->unk_14 & (v1 << param1 - 78)) != 0); - break; - case MON_DATA_FATEFUL_ENCOUNTER: - v0 = v3->fatefulEncounter; - break; - case MON_DATA_111: - v0 = sub_02075DAC(v2->species, param0->unk_00); - v3->unk_18_1 = v0; - param0->unk_06 = sub_0207823C(¶m0->unk_08, sizeof(PokemonSubstruct0) * 4); - break; - case MON_DATA_FORM: - v0 = v3->form; - break; - case MON_DATA_113: - v0 = v3->unk_19; - break; - case MON_DATA_114: - v0 = v3->unk_1A; - break; - case MON_DATA_117: - if (param0->unk_04_2) { - MessageLoader_GetSpeciesName(495, 0, param2); - } else { - { - u16 * v6 = param2; - - for (v0 = 0; v0 < 10; v0++) { - v6[v0] = v4->unk_00[v0]; - } - - v6[v0] = 0xffff; - } - } - break; - case MON_DATA_120: - v0 = v3->unk_10_31; - case MON_DATA_119: - if (param0->unk_04_2) { - Strbuf* v7 = sub_0200B32C(495, 0); - - Strbuf_Copy((Strbuf *)param2, v7); - Strbuf_Free(v7); - } else { - Strbuf_CopyChars((Strbuf *)param2, v4->unk_00); - } - break; - case MON_DATA_121: - v0 = v4->unk_16; - break; - case MON_DATA_MET_GAME: - v0 = v4->unk_17; - break; - case MON_DATA_123: - case MON_DATA_124: - case MON_DATA_125: - case MON_DATA_126: - case MON_DATA_127: - case MON_DATA_128: - case MON_DATA_129: - case MON_DATA_130: - case MON_DATA_131: - case MON_DATA_132: - case MON_DATA_133: - case MON_DATA_134: - case MON_DATA_135: - case MON_DATA_136: - case MON_DATA_137: - case MON_DATA_138: - case MON_DATA_139: - case MON_DATA_140: - case MON_DATA_141: - case MON_DATA_142: - case MON_DATA_143: - v1 = 1; - v0 = ((v4->unk_18 & (v1 << param1 - 123)) != 0); - break; - case MON_DATA_144: - { - u16 * v8 = param2; - - for (v0 = 0; v0 < 7; v0++) { - v8[v0] = v5->unk_00[v0]; - } - - v8[v0] = 0xffff; - break; - } - case MON_DATA_145: - Strbuf_CopyChars((Strbuf *)param2, v5->unk_00); - break; - case MON_DATA_146: - v0 = v5->unk_10; - break; - case MON_DATA_147: - v0 = v5->unk_11; - break; - case MON_DATA_148: - v0 = v5->unk_12; - break; - case MON_DATA_149: - v0 = v5->unk_13; - break; - case MON_DATA_150: - v0 = v5->unk_14; - break; - case MON_DATA_151: - v0 = v5->unk_15; - break; - case MON_DATA_152: - case MON_DATA_115: - if ((v5->unk_16 == 3002) && (v3->unk_1C)) { - v0 = v3->unk_1C; - } else { - v0 = v5->unk_16; - } - break; - case MON_DATA_153: - case MON_DATA_116: - if ((v5->unk_18 == 3002) && (v3->unk_1E)) { - v0 = v3->unk_1E; - } else { - v0 = v5->unk_18; - } - break; - case MON_DATA_POKERUS: - v0 = v5->unk_1A; - break; - case MON_DATA_POKEBALL: - v0 = v5->unk_1B; - break; - case MON_DATA_MET_LEVEL: - v0 = v5->unk_1C_0; - break; - case MON_DATA_OT_GENDER: - v0 = v5->unk_1C_7; - break; - case MON_DATA_158: - v0 = v5->unk_1D; - break; - case MON_DATA_159: - v0 = v5->unk_1E; - break; - case MON_DATA_175: - v0 = (v3->unk_10_0 << 0) | (v3->unk_10_5 << 5) | (v3->unk_10_10 << 10) | (v3->unk_10_15 << 15) | (v3->unk_10_20 << 20) | (v3->unk_10_25 << 25); - break; - case MON_DATA_176: - if (((v2->species == SPECIES_NIDORAN_F) || (v2->species == SPECIES_NIDORAN_M)) && (v3->unk_10_31 == 0)) { - v0 = 0; - } else { - v0 = 1; - } - break; - case MON_DATA_177: - case MON_DATA_178: - if ((v2->species == SPECIES_ARCEUS) && (v2->unk_0D == 121)) { - v0 = sub_02077988(Item_LoadParam(v2->item, 1, 0)); - } else { - v0 = sub_020759CC(v2->species, v3->form, 6 + (param1 - 177)); - } - break; - case MON_DATA_179: - MessageLoader_GetSpeciesName(v2->species, 0, param2); - break; - } - - return v0; -} - -void sub_02074B30 (Pokemon * param0, int param1, const void * param2) -{ - u16 v0; - - if (param0->box.unk_04_0 == 0) { - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - v0 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v0 != param0->box.unk_06) { - GF_ASSERT((v0 == param0->box.unk_06)); - param0->box.unk_04_2 = 1; - sub_0207822C(param0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - return; - } - } - - sub_02074BC0(param0, param1, param2); - - if (param0->box.unk_04_0 == 0) { - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - param0->box.unk_06 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } -} - -static void sub_02074BC0 (Pokemon * param0, int param1, const void * param2) -{ - u32 * v0 = (u32 *)param2; - u16 * v1 = (u16 *)param2; - u8 * v2 = (u8 *)param2; - - switch (param1) { - case 160: - param0->party.unk_00 = v0[0]; - break; - case 161: - param0->party.unk_04 = v2[0]; - break; - case 162: - param0->party.unk_05 = v2[0]; - break; - case 163: - param0->party.unk_06 = v1[0]; - break; - case 164: - param0->party.unk_08 = v1[0]; - break; - case 165: - param0->party.unk_0A = v1[0]; - break; - case 166: - param0->party.unk_0C = v1[0]; - break; - case 167: - param0->party.unk_0E = v1[0]; - break; - case 168: - param0->party.unk_10 = v1[0]; - break; - case 169: - param0->party.unk_12 = v1[0]; - break; - case 170: - sub_020281A0((UnkStruct_0202818C *)param2, ¶m0->party.unk_14); - break; - case 171: - sub_0202CA10((UnkStruct_0202CA28 *)param2, ¶m0->party.unk_4C); - break; - default: - sub_02074CD8((BoxPokemon *)¶m0->box, param1, param2); - break; - } -} - -void SetBoxMonData (BoxPokemon * param0, int param1, const void * param2) -{ - u16 v0; - - if (param0->unk_04_1 == 0) { - sub_02078234(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - v0 = sub_0207823C(param0->unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v0 != param0->unk_06) { - GF_ASSERT((v0 == param0->unk_06)); - param0->unk_04_2 = 1; - sub_0207822C(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - return; - } - } - - sub_02074CD8(param0, param1, param2); - - if (param0->unk_04_1 == 0) { - param0->unk_06 = sub_0207823C(param0->unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - } -} - -static void sub_02074CD8 (BoxPokemon * param0, int param1, const void * param2) -{ - int v0; - u64 v1; - u16 v2; - u32 * v3 = (u32 *)param2; - u16 * v4 = (u16 *)param2; - u8 * v5 = (u8 *)param2; - PokemonSubstruct0 * v6; - PokemonSubstruct1 * v7; - PokemonSubstruct2 * v8; - PokemonSubstruct3 * v9; - - v6 = (PokemonSubstruct0 *)sub_0207825C(param0, param0->unk_00, 0); - v7 = (PokemonSubstruct1 *)sub_0207825C(param0, param0->unk_00, 1); - v8 = (PokemonSubstruct2 *)sub_0207825C(param0, param0->unk_00, 2); - v9 = (PokemonSubstruct3 *)sub_0207825C(param0, param0->unk_00, 3); - - switch (param1) { - case MON_DATA_PERSONALITY: - param0->unk_00 = v3[0]; - break; - case MON_DATA_1: - GF_ASSERT(0); - param0->unk_04_0 = v5[0]; - break; - case MON_DATA_2: - GF_ASSERT(0); - param0->unk_04_1 = v5[0]; - break; - case MON_DATA_3: - param0->unk_04_2 = v5[0]; - break; - case MON_DATA_4: - param0->unk_06 = v4[0]; - break; - case MON_DATA_SPECIES: - v6->species = v4[0]; - break; - case MON_DATA_HELD_ITEM: - v6->item = v4[0]; - break; - case MON_DATA_OT_ID: - v6->unk_04 = v3[0]; - break; - case MON_DATA_EXP: - v6->unk_08 = v3[0]; - break; - case MON_DATA_FRIENDSHIP: - v6->friendship = v5[0]; - break; - case MON_DATA_10: - v6->unk_0D = v5[0]; - break; - case MON_DATA_11: - v6->unk_0E = v5[0]; - break; - case MON_DATA_LANGUAGE: - v6->unk_0F = v5[0]; - break; - case MON_DATA_HP_EV: - v6->unk_10 = v5[0]; - break; - case MON_DATA_ATK_EV: - v6->unk_11 = v5[0]; - break; - case MON_DATA_DEF_EV: - v6->unk_12 = v5[0]; - break; - case MON_DATA_SPEED_EV: - v6->unk_13 = v5[0]; - break; - case MON_DATA_SPATK_EV: - v6->unk_14 = v5[0]; - break; - case MON_DATA_SPDEF_EV: - v6->unk_15 = v5[0]; - break; - case MON_DATA_COOL: - v6->unk_16 = v5[0]; - break; - case MON_DATA_BEAUTY: - v6->unk_17 = v5[0]; - break; - case MON_DATA_CUTE: - v6->unk_18 = v5[0]; - break; - case MON_DATA_SMART: - v6->unk_19 = v5[0]; - break; - case MON_DATA_TOUGH: - v6->unk_1A = v5[0]; - break; - case MON_DATA_SHEEN: - v6->unk_1B = v5[0]; - break; - case MON_DATA_25: - case MON_DATA_26: - case MON_DATA_27: - case MON_DATA_28: - case MON_DATA_29: - case MON_DATA_30: - case MON_DATA_31: - case MON_DATA_32: - case MON_DATA_33: - case MON_DATA_34: - case MON_DATA_35: - case MON_DATA_36: - case MON_DATA_37: - case MON_DATA_38: - case MON_DATA_39: - case MON_DATA_40: - case MON_DATA_41: - case MON_DATA_42: - case MON_DATA_43: - case MON_DATA_44: - case MON_DATA_45: - case MON_DATA_46: - case MON_DATA_47: - case MON_DATA_48: - case MON_DATA_49: - case MON_DATA_50: - case MON_DATA_51: - case MON_DATA_52: - case MON_DATA_53: - v1 = 1 << (param1 - 25); - - if (v5[0]) { - v6->unk_1C |= v1; - } else { - v6->unk_1C &= (v1 ^ 0xffffffff); - } - break; - case MON_DATA_MOVE1: - case MON_DATA_MOVE2: - case MON_DATA_MOVE3: - case MON_DATA_MOVE4: - v7->unk_00[param1 - 54] = v4[0]; - break; - case MON_DATA_58: - case MON_DATA_59: - case MON_DATA_60: - case MON_DATA_61: - v7->unk_08[param1 - 58] = v5[0]; - break; - case MON_DATA_62: - case MON_DATA_63: - case MON_DATA_64: - case MON_DATA_65: - v7->unk_0C[param1 - 62] = v5[0]; - break; - case MON_DATA_66: - case MON_DATA_67: - case MON_DATA_68: - case MON_DATA_69: - break; - case MON_DATA_HP_IV: - v7->unk_10_0 = v5[0]; - break; - case MON_DATA_ATK_IV: - v7->unk_10_5 = v5[0]; - break; - case MON_DATA_DEF_IV: - v7->unk_10_10 = v5[0]; - break; - case MON_DATA_SPEED_IV: - v7->unk_10_15 = v5[0]; - break; - case MON_DATA_SPATK_IV: - v7->unk_10_20 = v5[0]; - break; - case MON_DATA_SPDEF_IV: - v7->unk_10_25 = v5[0]; - break; - case MON_DATA_IS_EGG: - v7->unk_10_30 = v5[0]; - break; - case MON_DATA_77: - v7->unk_10_31 = v5[0]; - break; - case MON_DATA_78: - case MON_DATA_79: - case MON_DATA_80: - case MON_DATA_81: - case MON_DATA_82: - case MON_DATA_83: - case MON_DATA_84: - case MON_DATA_85: - case MON_DATA_86: - case MON_DATA_87: - case MON_DATA_88: - case MON_DATA_89: - case MON_DATA_90: - case MON_DATA_91: - case MON_DATA_92: - case MON_DATA_93: - case MON_DATA_94: - case MON_DATA_95: - case MON_DATA_96: - case MON_DATA_97: - case MON_DATA_CHAMPION_RIBBON: - case MON_DATA_WINNING_RIBBON: - case MON_DATA_VICTORY_RIBBON: - case MON_DATA_ARTIST_RIBBON: - case MON_DATA_EFFORT_RIBBON: - case MON_DATA_MARINE_RIBBON: - case MON_DATA_LAND_RIBBON: - case MON_DATA_SKY_RIBBON: - case MON_DATA_COUNTRY_RIBBON: - case MON_DATA_NATIONAL_RIBBON: - case MON_DATA_EARTH_RIBBON: - case MON_DATA_WORLD_RIBBON: - v1 = 1 << (param1 - 78); - - if (v5[0]) { - v7->unk_14 |= v1; - } else { - v7->unk_14 &= (v1 ^ 0xffffffff); - } - break; - case MON_DATA_FATEFUL_ENCOUNTER: - v7->fatefulEncounter = v5[0]; - break; - case MON_DATA_111: - v7->unk_18_1 = sub_02075DAC(v6->species, param0->unk_00); - break; - case MON_DATA_FORM: - v7->form = v5[0]; - break; - case MON_DATA_113: - v7->unk_19 = v5[0]; - break; - case MON_DATA_114: - v7->unk_1A = v4[0]; - break; - case MON_DATA_118: - { - u16 v10[10 + 1]; - - MessageLoader_GetSpeciesName(v6->species, 0, &v10[0]); - v7->unk_10_31 = sub_0200220C(v10, &v4[0]); - } - case MON_DATA_117: - for (v0 = 0; v0 < NELEMS(v8->unk_00); v0++) { - v8->unk_00[v0] = v4[v0]; - } - break; - case MON_DATA_120: - { - u16 v11[10 + 1]; - u16 v12[10 + 1]; - - MessageLoader_GetSpeciesName(v6->species, 0, &v11[0]); - Strbuf_ToChars((Strbuf *)param2, &v12[0], NELEMS(v12)); - - v7->unk_10_31 = sub_0200220C(v11, v12); - } - case MON_DATA_119: - Strbuf_ToChars((Strbuf *)param2, v8->unk_00, NELEMS(v8->unk_00)); - break; - case MON_DATA_121: - v8->unk_16 = v5[0]; - break; - case MON_DATA_MET_GAME: - v8->unk_17 = v5[0]; - break; - case MON_DATA_123: - case MON_DATA_124: - case MON_DATA_125: - case MON_DATA_126: - case MON_DATA_127: - case MON_DATA_128: - case MON_DATA_129: - case MON_DATA_130: - case MON_DATA_131: - case MON_DATA_132: - case MON_DATA_133: - case MON_DATA_134: - case MON_DATA_135: - case MON_DATA_136: - case MON_DATA_137: - case MON_DATA_138: - case MON_DATA_139: - case MON_DATA_140: - case MON_DATA_141: - case MON_DATA_142: - case MON_DATA_143: - v1 = 1 << (param1 - 123); - - if (v5[0]) { - v8->unk_18 |= v1; - } else { - v8->unk_18 &= (v1 ^ 0xffffffffffffffff); - } - break; - case MON_DATA_144: - for (v0 = 0; v0 < NELEMS(v9->unk_00); v0++) { - v9->unk_00[v0] = v4[v0]; - } - break; - case MON_DATA_145: - Strbuf_ToChars((Strbuf *)param2, v9->unk_00, NELEMS(v9->unk_00)); - break; - case MON_DATA_146: - v9->unk_10 = v5[0]; - break; - case MON_DATA_147: - v9->unk_11 = v5[0]; - break; - case MON_DATA_148: - v9->unk_12 = v5[0]; - break; - case MON_DATA_149: - v9->unk_13 = v5[0]; - break; - case MON_DATA_150: - v9->unk_14 = v5[0]; - break; - case MON_DATA_151: - v9->unk_15 = v5[0]; - break; - case MON_DATA_152: - case MON_DATA_115: - if ((v4[0] == 0) || (sub_0201708C(v4[0]) == 1)) { - v9->unk_16 = v4[0]; - v7->unk_1C = v4[0]; - } else { - v9->unk_16 = 3002; - v7->unk_1C = v4[0]; - } - break; - case MON_DATA_153: - case MON_DATA_116: - if ((v4[0] == 0) || (sub_0201708C(v4[0]) == 1)) { - v9->unk_18 = v4[0]; - v7->unk_1E = v4[0]; - } else { - v9->unk_18 = 3002; - v7->unk_1E = v4[0]; - } - break; - case MON_DATA_POKERUS: - v9->unk_1A = v5[0]; - break; - case MON_DATA_POKEBALL: - v9->unk_1B = v5[0]; - break; - case MON_DATA_MET_LEVEL: - v9->unk_1C_0 = v5[0]; - break; - case MON_DATA_OT_GENDER: - v9->unk_1C_7 = v5[0]; - break; - case MON_DATA_158: - v9->unk_1D = v5[0]; - break; - case MON_DATA_159: - v9->unk_1E = v4[0]; - break; - case MON_DATA_175: - v7->unk_10_0 = (v3[0] >> 0) & 0x1f; - v7->unk_10_5 = (v3[0] >> 5) & 0x1f; - v7->unk_10_10 = (v3[0] >> 10) & 0x1f; - v7->unk_10_15 = (v3[0] >> 15) & 0x1f; - v7->unk_10_20 = (v3[0] >> 20) & 0x1f; - v7->unk_10_25 = (v3[0] >> 25) & 0x1f; - break; - case MON_DATA_176: - case MON_DATA_177: - case MON_DATA_178: - break; - case MON_DATA_179: - { - Strbuf* v13; - - v13 = sub_0200B32C(v6->species, 0); - - Strbuf_ToChars(v13, v8->unk_00, NELEMS(v8->unk_00)); - Strbuf_Free(v13); - } - break; - } -} - -void sub_0207536C (Pokemon * param0, int param1, int param2) -{ - u16 v0; - - if (param0->box.unk_04_0 == 0) { - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - - v0 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v0 != param0->box.unk_06) { - GF_ASSERT((v0 == param0->box.unk_06)); - sub_0207822C(param0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - return; - } - } - - sub_020753F4(param0, param1, param2); - - if (param0->box.unk_04_0 == 0) { - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - param0->box.unk_06 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } -} - -static void sub_020753F4 (Pokemon * param0, int param1, int param2) -{ - switch (param1) { - case 163: - if ((param0->party.unk_06 + param2) > param0->party.unk_08) { - param0->party.unk_06 = param0->party.unk_08; - } else { - param0->party.unk_06 += param2; - } - break; - case 160: - case 161: - case 162: - case 164: - case 165: - case 166: - case 167: - case 168: - case 169: - case 170: - GF_ASSERT(0); - break; - default: - sub_02075454((BoxPokemon *)¶m0->box, param1, param2); - break; - } -} - -static void sub_02075454 (BoxPokemon * param0, int param1, int param2) -{ - int v0; - u16 v1; - PokemonSubstruct0 * v2; - PokemonSubstruct1 * v3; - PokemonSubstruct2 * v4; - PokemonSubstruct3 * v5; - - v2 = (PokemonSubstruct0 *)sub_0207825C(param0, param0->unk_00, 0); - v3 = (PokemonSubstruct1 *)sub_0207825C(param0, param0->unk_00, 1); - v4 = (PokemonSubstruct2 *)sub_0207825C(param0, param0->unk_00, 2); - v5 = (PokemonSubstruct3 *)sub_0207825C(param0, param0->unk_00, 3); - - switch (param1) { - case MON_DATA_EXP: - if ((v2->unk_08 + param2) > sub_02075AD0(v2->species, 100)) { - v2->unk_08 = sub_02075AD0(v2->species, 100); - } else { - v2->unk_08 += param2; - } - break; - case MON_DATA_FRIENDSHIP: - { - int v6; - - v6 = v2->friendship; - - if ((v6 + param2) > 255) { - v6 = 255; - } - - if ((v6 + param2) < 0) { - v6 = 0; - } else { - v6 += param2; - } - - v2->friendship = v6; - } - break; - case MON_DATA_HP_EV: - v2->unk_10 += param2; - break; - case MON_DATA_ATK_EV: - v2->unk_11 += param2; - break; - case MON_DATA_DEF_EV: - v2->unk_12 += param2; - break; - case MON_DATA_SPEED_EV: - v2->unk_13 += param2; - break; - case MON_DATA_SPATK_EV: - v2->unk_14 += param2; - break; - case MON_DATA_SPDEF_EV: - v2->unk_15 += param2; - break; - case MON_DATA_COOL: - if ((v2->unk_16 + param2) > 255) { - v2->unk_16 = 255; - } else { - v2->unk_16 += param2; - } - break; - case MON_DATA_BEAUTY: - if ((v2->unk_17 + param2) > 255) { - v2->unk_17 = 255; - } else { - v2->unk_17 += param2; - } - break; - case MON_DATA_CUTE: - if ((v2->unk_18 + param2) > 255) { - v2->unk_18 = 255; - } else { - v2->unk_18 += param2; - } - break; - case MON_DATA_SMART: - if ((v2->unk_19 + param2) > 255) { - v2->unk_19 = 255; - } else { - v2->unk_19 += param2; - } - break; - case MON_DATA_TOUGH: - if ((v2->unk_1A + param2) > 255) { - v2->unk_1A = 255; - } else { - v2->unk_1A += param2; - } - break; - case MON_DATA_SHEEN: - if ((v2->unk_1B + param2) > 255) { - v2->unk_1B = 255; - } else { - v2->unk_1B += param2; - } - break; - case MON_DATA_58: - case MON_DATA_59: - case MON_DATA_60: - case MON_DATA_61: - if ((v3->unk_08[param1 - 58] + param2) > MoveTable_CalcMaxPP(v3->unk_00[param1 - 58], v3->unk_0C[param1 - 58])) { - v3->unk_08[param1 - 58] = MoveTable_CalcMaxPP(v3->unk_00[param1 - 58], v3->unk_0C[param1 - 58]); - } else { - v3->unk_08[param1 - 58] += param2; - } - break; - case MON_DATA_62: - case MON_DATA_63: - case MON_DATA_64: - case MON_DATA_65: - if ((v3->unk_0C[param1 - 62] + param2) > 3) { - v3->unk_0C[param1 - 62] = 3; - } else { - v3->unk_0C[param1 - 62] += param2; - } - break; - case MON_DATA_66: - case MON_DATA_67: - case MON_DATA_68: - case MON_DATA_69: - break; - case MON_DATA_HP_IV: - if ((v3->unk_10_0 + param2) > 31) { - v3->unk_10_0 = 31; - } else { - v3->unk_10_0 += param2; - } - break; - case MON_DATA_ATK_IV: - if ((v3->unk_10_5 + param2) > 31) { - v3->unk_10_5 = 31; - } else { - v3->unk_10_5 += param2; - } - break; - case MON_DATA_DEF_IV: - if ((v3->unk_10_10 + param2) > 31) { - v3->unk_10_10 = 31; - } else { - v3->unk_10_10 += param2; - } - break; - case MON_DATA_SPEED_IV: - if ((v3->unk_10_15 + param2) > 31) { - v3->unk_10_15 = 31; - } else { - v3->unk_10_15 += param2; - } - break; - case MON_DATA_SPATK_IV: - if ((v3->unk_10_20 + param2) > 31) { - v3->unk_10_20 = 31; - } else { - v3->unk_10_20 += param2; - } - break; - case MON_DATA_SPDEF_IV: - if ((v3->unk_10_25 + param2) > 31) { - v3->unk_10_25 = 31; - } else { - v3->unk_10_25 += param2; - } - break; - case MON_DATA_PERSONALITY: - case MON_DATA_1: - case MON_DATA_2: - case MON_DATA_4: - case MON_DATA_SPECIES: - case MON_DATA_HELD_ITEM: - case MON_DATA_OT_ID: - case MON_DATA_10: - case MON_DATA_11: - case MON_DATA_LANGUAGE: - case MON_DATA_25: - case MON_DATA_26: - case MON_DATA_27: - case MON_DATA_28: - case MON_DATA_29: - case MON_DATA_30: - case MON_DATA_31: - case MON_DATA_32: - case MON_DATA_33: - case MON_DATA_34: - case MON_DATA_35: - case MON_DATA_36: - case MON_DATA_37: - case MON_DATA_38: - case MON_DATA_39: - case MON_DATA_40: - case MON_DATA_41: - case MON_DATA_42: - case MON_DATA_43: - case MON_DATA_44: - case MON_DATA_45: - case MON_DATA_46: - case MON_DATA_47: - case MON_DATA_48: - case MON_DATA_49: - case MON_DATA_50: - case MON_DATA_51: - case MON_DATA_52: - case MON_DATA_53: - case MON_DATA_MOVE1: - case MON_DATA_MOVE2: - case MON_DATA_MOVE3: - case MON_DATA_MOVE4: - case MON_DATA_IS_EGG: - case MON_DATA_77: - case MON_DATA_78: - case MON_DATA_79: - case MON_DATA_80: - case MON_DATA_81: - case MON_DATA_82: - case MON_DATA_83: - case MON_DATA_84: - case MON_DATA_85: - case MON_DATA_86: - case MON_DATA_87: - case MON_DATA_88: - case MON_DATA_89: - case MON_DATA_90: - case MON_DATA_91: - case MON_DATA_92: - case MON_DATA_93: - case MON_DATA_94: - case MON_DATA_95: - case MON_DATA_96: - case MON_DATA_97: - case MON_DATA_CHAMPION_RIBBON: - case MON_DATA_WINNING_RIBBON: - case MON_DATA_VICTORY_RIBBON: - case MON_DATA_ARTIST_RIBBON: - case MON_DATA_EFFORT_RIBBON: - case MON_DATA_MARINE_RIBBON: - case MON_DATA_LAND_RIBBON: - case MON_DATA_SKY_RIBBON: - case MON_DATA_COUNTRY_RIBBON: - case MON_DATA_NATIONAL_RIBBON: - case MON_DATA_EARTH_RIBBON: - case MON_DATA_WORLD_RIBBON: - case MON_DATA_FATEFUL_ENCOUNTER: - case MON_DATA_111: - case MON_DATA_FORM: - case MON_DATA_113: - case MON_DATA_114: - case MON_DATA_117: - case MON_DATA_119: - case MON_DATA_120: - case MON_DATA_121: - case MON_DATA_MET_GAME: - case MON_DATA_123: - case MON_DATA_124: - case MON_DATA_125: - case MON_DATA_126: - case MON_DATA_127: - case MON_DATA_128: - case MON_DATA_129: - case MON_DATA_130: - case MON_DATA_131: - case MON_DATA_132: - case MON_DATA_133: - case MON_DATA_134: - case MON_DATA_135: - case MON_DATA_136: - case MON_DATA_137: - case MON_DATA_138: - case MON_DATA_139: - case MON_DATA_140: - case MON_DATA_141: - case MON_DATA_142: - case MON_DATA_143: - case MON_DATA_144: - case MON_DATA_145: - case MON_DATA_146: - case MON_DATA_147: - case MON_DATA_148: - case MON_DATA_149: - case MON_DATA_150: - case MON_DATA_151: - case MON_DATA_152: - case MON_DATA_153: - case MON_DATA_POKERUS: - case MON_DATA_POKEBALL: - case MON_DATA_MET_LEVEL: - case MON_DATA_OT_GENDER: - case MON_DATA_158: - case MON_DATA_159: - case MON_DATA_175: - case MON_DATA_176: - case MON_DATA_177: - case MON_DATA_178: - case MON_DATA_179: - default: - GF_ASSERT(0); - break; - } -} - -UnkStruct_02075874 * sub_02075874 (int param0, int param1, int param2) -{ - UnkStruct_02075874 * v0; - - v0 = Heap_AllocFromHeap(param2, sizeof(UnkStruct_02075874)); - sub_02078208(param0, param1, v0); - - return v0; -} - -UnkStruct_02075874 * sub_02075894 (int param0, int param1) -{ - UnkStruct_02075874 * v0; - - v0 = Heap_AllocFromHeap(param1, sizeof(UnkStruct_02075874)); - sub_020781F8(param0, v0); - - return v0; -} - -u32 sub_020758B0 (UnkStruct_02075874 * param0, int param1) -{ - u32 v0; - - GF_ASSERT(param0); - - switch (param1) { - case 0: - v0 = param0->unk_00; - break; - case 1: - v0 = param0->unk_01; - break; - case 2: - v0 = param0->unk_02; - break; - case 3: - v0 = param0->unk_03; - break; - case 4: - v0 = param0->unk_04; - break; - case 5: - v0 = param0->unk_05; - break; - case 6: - v0 = param0->unk_06; - break; - case 7: - v0 = param0->unk_07; - break; - case 8: - v0 = param0->unk_08; - break; - case 9: - v0 = param0->unk_09; - break; - case 10: - v0 = param0->unk_0A_0; - break; - case 11: - v0 = param0->unk_0A_2; - break; - case 12: - v0 = param0->unk_0A_4; - break; - case 13: - v0 = param0->unk_0A_6; - break; - case 14: - v0 = param0->unk_0A_8; - break; - case 15: - v0 = param0->unk_0A_10; - break; - case 16: - v0 = param0->unk_0C; - break; - case 17: - v0 = param0->unk_0E; - break; - case 18: - v0 = param0->unk_10; - break; - case 19: - v0 = param0->unk_11; - break; - case 20: - v0 = param0->unk_12; - break; - case 21: - v0 = param0->unk_13; - break; - case 22: - v0 = param0->unk_14; - break; - case 23: - v0 = param0->unk_15; - break; - case 24: - v0 = param0->unk_16; - break; - case 25: - v0 = param0->unk_17; - break; - case 26: - v0 = param0->unk_18; - break; - case 27: - v0 = param0->unk_19_0; - break; - case 28: - v0 = param0->unk_19_7; - break; - case 29: - v0 = param0->unk_1C; - break; - case 30: - v0 = param0->unk_20; - break; - case 31: - v0 = param0->unk_24; - break; - case 32: - v0 = param0->unk_28; - break; - } - - return v0; -} - -void sub_020759B8 (UnkStruct_02075874 * param0) -{ - GF_ASSERT(param0); - Heap_FreeToHeap(param0); -} - -u32 sub_020759CC (int param0, int param1, int param2) -{ - u32 v0; - UnkStruct_02075874 * v1; - - param0 = sub_02078740(param0, param1); - - v1 = sub_02075894(param0, 0); - v0 = sub_020758B0(v1, param2); - - sub_020759B8(v1); - - return v0; -} - -u32 sub_020759F0 (int param0, int param1) -{ - u32 v0; - UnkStruct_02075874 * v1; - - v1 = sub_02075894(param0, 0); - v0 = sub_020758B0(v1, param1); - - sub_020759B8(v1); - - return v0; -} - -u8 sub_02075A10 (Pokemon * param0) -{ - u16 v0; - u8 v1; - u32 v2; - u32 v3; - u32 v4; - u8 v5; - BOOL v6; - - v6 = sub_02073C88(param0); - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_161, NULL); - v2 = sub_02075AD0(v0, v1); - v4 = sub_02075AD0(v0, v1 + 1); - v3 = GetMonData(param0, MON_DATA_EXP, NULL); - - sub_02073CD4(param0, v6); - v5 = ((v3 - v2) * 100) / (v4 - v2); - - return v5; -} - -u32 sub_02075A70 (Pokemon * param0) -{ - return sub_02075A78(¶m0->box); -} - -u32 sub_02075A78 (BoxPokemon * param0) -{ - u16 v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - u16 v1 = sub_02075B40(param0) + 1; - u32 v2 = sub_02074570(param0, MON_DATA_EXP, NULL); - - return sub_02075AD0(v0, v1) - v2; -} - -u32 sub_02075AAC (Pokemon * param0) -{ - return sub_02075AD0(GetMonData(param0, MON_DATA_SPECIES, NULL), GetMonData(param0, MON_DATA_161, NULL)); -} - -u32 sub_02075AD0 (int param0, int param1) -{ - return sub_02075B00(sub_020759F0(param0, 21), param1); -} - -void sub_02075AE4 (int param0, u32 * param1) -{ - GF_ASSERT(param0 < 8); - NARC_ReadWholeMemberByIndexPair(param1, NARC_INDEX_POKETOOL__PERSONAL__PL_GROWTBL, param0); -} - -u32 sub_02075B00 (int param0, int param1) -{ - u32 v0; - u32 * v1; - - GF_ASSERT(param0 < 8); - GF_ASSERT(param1 <= 101); - - v1 = Heap_AllocFromHeap(0, 101 * 4); - sub_02075AE4(param0, v1); - - v0 = v1[param1]; - Heap_FreeToHeap(v1); - - return v0; -} - -u32 sub_02075B38 (Pokemon * param0) -{ - return sub_02075B40(¶m0->box); -} - -u32 sub_02075B40 (BoxPokemon * param0) -{ - int v0; - u32 v1; - BOOL v2; - - v2 = sub_02073D20(param0); - v0 = sub_02074570(param0, MON_DATA_SPECIES, 0); - v1 = sub_02074570(param0, MON_DATA_EXP, 0); - - sub_02073D48(param0, v2); - - return sub_02075B78(v0, v1); -} - -u32 sub_02075B78 (u16 param0, u32 param1) -{ - int v0; - u32 v1; - u32 * v2; - UnkStruct_02075874 * v3 = sub_02075894(param0, 0); - - v1 = sub_02075B9C(v3, param0, param1); - sub_020759B8(v3); - - return v1; -} - -u32 sub_02075B9C (UnkStruct_02075874 * param0, u16 param1, u32 param2) -{ - static u32 v0[101]; - int v1, v2; - - v1 = sub_020758B0(param0, 21); - sub_02075AE4(v1, v0); - - for (v2 = 1; v2 < 101; v2++) { - if (v0[v2] > param2) { - break; - } - } - - return v2 - 1; -} - -u8 sub_02075BCC (Pokemon * param0) -{ - return sub_02075BD4(¶m0->box); -} - -u8 sub_02075BD4 (BoxPokemon * param0) -{ - BOOL v0; - u32 v1; - - v0 = sub_02073D20(param0); - v1 = sub_02074570(param0, MON_DATA_PERSONALITY, 0); - - sub_02073D48(param0, v0); - - return GetNatureFromPersonality(v1); -} - -u8 GetNatureFromPersonality (u32 param0) -{ - return (u8)(param0 % 25); -} - -static const s8 Unk_020F0618[][5] = { - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x1, -1, 0x0, 0x0, 0x0}, - {0x1, 0x0, -1, 0x0, 0x0}, - {0x1, 0x0, 0x0, -1, 0x0}, - {0x1, 0x0, 0x0, 0x0, -1}, - {-1, 0x1, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x1, -1, 0x0, 0x0}, - {0x0, 0x1, 0x0, -1, 0x0}, - {0x0, 0x1, 0x0, 0x0, -1}, - {-1, 0x0, 0x1, 0x0, 0x0}, - {0x0, -1, 0x1, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x1, -1, 0x0}, - {0x0, 0x0, 0x1, 0x0, -1}, - {-1, 0x0, 0x0, 0x1, 0x0}, - {0x0, -1, 0x0, 0x1, 0x0}, - {0x0, 0x0, -1, 0x1, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x1, -1}, - {-1, 0x0, 0x0, 0x0, 0x1}, - {0x0, -1, 0x0, 0x0, 0x1}, - {0x0, 0x0, -1, 0x0, 0x1}, - {0x0, 0x0, 0x0, -1, 0x1}, - {0x0, 0x0, 0x0, 0x0, 0x0} -}; - -u16 sub_02075C0C (u8 param0, u16 param1, u8 param2) -{ - u16 v0; - - if ((param2 < 0x1) || (param2 > 0x5)) { - return param1; - } - - switch (Unk_020F0618[param0][param2 - 1]) { - case 1: - v0 = param1 * 110; - v0 /= 100; - break; - case -1: - v0 = param1 * 90; - v0 /= 100; - break; - default: - v0 = param1; - break; - } - - return v0; -} - -s8 sub_02075C60 (u8 param0, u8 param1) -{ - return Unk_020F0618[param0][param1 - 1]; -} - -static const s8 Unk_020F05A0[][3] = { - {0x5, 0x3, 0x2}, - {0x5, 0x3, 0x2}, - {0x1, 0x1, 0x0}, - {0x3, 0x2, 0x1}, - {0x1, 0x1, 0x0}, - {0x1, 0x1, 0x1}, - {-1, -1, -1}, - {-5, -5, -10}, - {-5, -5, -10}, - {0x3, 0x2, 0x1} -}; - -void sub_02075C74 (Pokemon * param0, u8 param1, u16 param2) -{ - u16 v0; - u16 v1; - s16 v2; - s8 v3; - u8 v4; - u8 v5; - - if (param1 == 5) { - if (sub_0201D2E8() & 1) { - return; - } - } - - v0 = GetMonData(param0, MON_DATA_SPECIES_EGG, NULL); - - if ((v0 == 0) || (v0 == 494)) { - return; - } - - v1 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); - v5 = Item_LoadParam(v1, 1, 0); - v4 = 0; - v2 = GetMonData(param0, MON_DATA_FRIENDSHIP, NULL); - - if (v2 >= 100) { - v4++; - } - - if (v2 >= 200) { - v4++; - } - - v3 = Unk_020F05A0[param1][v4]; - - if ((v3 > 0) && (GetMonData(param0, MON_DATA_POKEBALL, NULL) == 11)) { - v3++; - } - - if ((v3 > 0) && (GetMonData(param0, MON_DATA_152, NULL) == param2)) { - v3++; - } - - if (v3 > 0) { - if (v5 == 53) { - v3 = v3 * 150 / 100; - } - } - - v2 += v3; - - if (v2 < 0) { - v2 = 0; - } - - if (v2 > 255) { - v2 = 255; - } - - sub_02074B30(param0, 9, (u8 *)&v2); -} - -u8 sub_02075D6C (Pokemon * param0) -{ - return sub_02075D74((BoxPokemon *)¶m0->box); -} - -u8 sub_02075D74 (BoxPokemon * param0) -{ - u16 v0; - u32 v1; - int v2; - - v2 = sub_02073D20(param0); - v0 = sub_02074570(param0, MON_DATA_SPECIES, 0); - v1 = sub_02074570(param0, MON_DATA_PERSONALITY, 0); - - sub_02073D48(param0, v2); - - return sub_02075DAC(v0, v1); -} - -u8 sub_02075DAC (u16 param0, u32 param1) -{ - UnkStruct_02075874 * v0; - u8 v1; - - v0 = sub_02075894(param0, 0); - v1 = sub_02075DD0(v0, param0, param1); - - sub_020759B8(v0); - - return v1; -} - -u8 sub_02075DD0 (UnkStruct_02075874 * param0, u16 param1, u32 param2) -{ - u8 v0 = sub_020758B0(param0, 18); - - switch (v0) { - case 0: - return 0; - case 254: - return 1; - case 255: - return 2; - } - - if (v0 > (param2 & 0xff)) { - return 1; - } else { - return 0; - } -} - -u8 sub_02075E0C (Pokemon * param0) -{ - return sub_02075E14(¶m0->box); -} - -u8 sub_02075E14 (BoxPokemon * param0) -{ - u32 v0; - u32 v1; - - v0 = sub_02074570(param0, MON_DATA_OT_ID, 0); - v1 = sub_02074570(param0, MON_DATA_PERSONALITY, 0); - - return sub_02075E38(v0, v1); -} - -u8 sub_02075E38 (u32 param0, u32 param1) -{ - return (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff) ^ ((param1 & 0xffff0000) >> 16) ^ (param1 & 0xffff)) < 8; -} - -u32 sub_02075E64 (u32 param0) -{ - int v0; - u32 v1; - u16 v2; - u16 v3; - - param0 = (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff)) >> 3; - - v2 = sub_0201D2E8() & 0x7; - v3 = sub_0201D2E8() & 0x7; - - for (v0 = 0; v0 < 13; v0++) { - if (param0 & FlagIndex(v0)) { - if (sub_0201D2E8() & 1) { - v2 |= FlagIndex(v0 + 3); - } else { - v3 |= FlagIndex(v0 + 3); - } - } else { - if (sub_0201D2E8() & 1) { - v2 |= FlagIndex(v0 + 3); - v3 |= FlagIndex(v0 + 3); - } - } - } - - v1 = v2 | (v3 << 16); - - return v1; -} - -void sub_02075EF4 (UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2) -{ - sub_02075F0C(param0, ¶m1->box, param2, 0); -} - -void sub_02075F00 (UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2) -{ - sub_02075F0C(param0, ¶m1->box, param2, 1); -} - -void sub_02075F0C (UnkStruct_02008A90 * param0, BoxPokemon * param1, u8 param2, int param3) -{ - BOOL v0; - u16 v1; - u8 v2, v3, v4; - u32 v5; - - v0 = sub_02073D20(param1); - v1 = sub_02074570(param1, MON_DATA_SPECIES_EGG, NULL); - v2 = sub_02075D74(param1); - v3 = sub_02075E14(param1); - v5 = sub_02074570(param1, MON_DATA_PERSONALITY, NULL); - - if (v1 == 494) { - if (sub_02074570(param1, MON_DATA_SPECIES, NULL) == 490) { - v4 = 1; - } else { - v4 = 0; - } - } else { - v4 = sub_02074570(param1, MON_DATA_FORM, NULL); - } - - if (param3 == 1) { - sub_02076300(param0, v1, v2, param2, v3, v4, v5); - } else { - sub_02075FB4(param0, v1, v2, param2, v3, v4, v5); - } - - sub_02073D48(param1, v0); -} - -void sub_02075FB4 (UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6) -{ - param0->unk_06 = 0; - param0->unk_08 = 0; - param0->unk_0C = 0; - param5 = SanitizeFormId(param1, param5); - - switch (param1) { - case 412: - param0->unk_00 = 117; - param0->unk_02 = 72 + (param3 / 2) + param5 * 2; - param0->unk_04 = 166 + param4 + param5 * 2; - break; - case 413: - param0->unk_00 = 117; - param0->unk_02 = 78 + (param3 / 2) + param5 * 2; - param0->unk_04 = 172 + param4 + param5 * 2; - break; - case 422: - param0->unk_00 = 117; - param0->unk_02 = 84 + param3 + param5; - param0->unk_04 = 178 + param4 + param5 * 2; - break; - case 423: - param0->unk_00 = 117; - param0->unk_02 = 88 + param3 + param5; - param0->unk_04 = 182 + param4 + param5 * 2; - break; - case 421: - param0->unk_00 = 117; - param0->unk_02 = 92 + param3 + param5; - param0->unk_04 = 186 + (param4 * 2) + param5; - break; - case 493: - param0->unk_00 = 117; - param0->unk_02 = 96 + (param3 / 2) + param5 * 2; - param0->unk_04 = 190 + param4 + param5 * 2; - break; - case 351: - param0->unk_00 = 117; - param0->unk_02 = 64 + (param3 * 2) + param5; - param0->unk_04 = 158 + (param4 * 4) + param5; - break; - case 386: - param0->unk_00 = 117; - param0->unk_02 = 0 + (param3 / 2) + param5 * 2; - param0->unk_04 = 154 + param4; - break; - case 201: - param0->unk_00 = 117; - param0->unk_02 = 8 + (param3 / 2) + param5 * 2; - param0->unk_04 = 156 + param4; - break; - case 494: - param0->unk_00 = 117; - param0->unk_02 = 132 + param5; - param0->unk_04 = 226 + param5; - break; - case 495: - param0->unk_00 = 117; - param0->unk_02 = 132; - param0->unk_04 = 226; - break; - case 492: - param0->unk_00 = 117; - param0->unk_02 = 134 + (param3 / 2) + param5 * 2; - param0->unk_04 = 228 + param4 + param5 * 2; - break; - case 479: - param0->unk_00 = 117; - param0->unk_02 = 138 + (param3 / 2) + param5 * 2; - param0->unk_04 = 232 + param4 + param5 * 2; - break; - case 487: - param0->unk_00 = 117; - param0->unk_02 = 150 + (param3 / 2) + param5 * 2; - param0->unk_04 = 244 + param4 + param5 * 2; - break; - default: - param0->unk_00 = 4; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - - if ((param1 == 327) && (param3 == 2)) { - param0->unk_06 = 327; - param0->unk_08 = 0; - param0->unk_0C = param6; - } - - break; - } -} - -u8 SanitizeFormId (u16 param0, u8 param1) -{ - switch (param0) { - case 412: - if (param1 > 2) { - param1 = 0; - } - break; - case 413: - - if (param1 > 2) { - param1 = 0; - } - break; - case 422: - if (param1 > 1) { - param1 = 0; - } - break; - case 423: - if (param1 > 1) { - param1 = 0; - } - break; - case 421: - if (param1 > 1) { - param1 = 0; - } - break; - case 493: - if (param1 > 17) { - param1 = 0; - } - break; - case 351: - if (param1 > 3) { - param1 = 0; - } - break; - case 386: - if (param1 > 3) { - param1 = 0; - } - break; - case 201: - if (param1 >= 28) { - param1 = 0; - } - break; - case 494: - if (param1 > 1) { - param1 = 0; - } - break; - case 492: - if (param1 > 1) { - param1 = 0; - } - break; - case 479: - if (param1 > 5) { - param1 = 0; - } - break; - case 487: - if (param1 > 1) { - param1 = 0; - } - break; - } - - return param1; -} - -static void sub_02076300 (UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6) -{ - param0->unk_06 = 0; - param0->unk_08 = 0; - param0->unk_0C = 0; - - param5 = SanitizeFormId(param1, param5); - - switch (param1) { - case 412: - param0->unk_00 = 166; - param0->unk_02 = 72 + (param3 / 2) + param5 * 2; - param0->unk_04 = 146 + param4 + param5 * 2; - break; - case 413: - param0->unk_00 = 166; - param0->unk_02 = 78 + (param3 / 2) + param5 * 2; - param0->unk_04 = 152 + param4 + param5 * 2; - break; - case 422: - param0->unk_00 = 166; - param0->unk_02 = 84 + param3 + param5; - param0->unk_04 = 158 + param4 + param5 * 2; - break; - case 423: - param0->unk_00 = 166; - param0->unk_02 = 88 + param3 + param5; - param0->unk_04 = 162 + param4 + param5 * 2; - break; - case 421: - param0->unk_00 = 166; - param0->unk_02 = 92 + param3 + param5; - param0->unk_04 = 166 + (param4 * 2) + param5; - break; - case 493: - param0->unk_00 = 166; - param0->unk_02 = 96 + (param3 / 2) + param5 * 2; - param0->unk_04 = 170 + param4 + param5 * 2; - break; - case 351: - param0->unk_00 = 166; - param0->unk_02 = 64 + (param3 * 2) + param5; - param0->unk_04 = 138 + (param4 * 4) + param5; - break; - case 386: - param0->unk_00 = 166; - param0->unk_02 = 0 + (param3 / 2) + param5 * 2; - param0->unk_04 = 134 + param4; - break; - case 201: - param0->unk_00 = 166; - param0->unk_02 = 8 + (param3 / 2) + param5 * 2; - param0->unk_04 = 136 + param4; - break; - case 494: - param0->unk_00 = 166; - param0->unk_02 = 132 + param5; - param0->unk_04 = 206 + param5; - break; - case 495: - param0->unk_00 = 166; - param0->unk_02 = 132; - param0->unk_04 = 206; - break; - case 492: - if (param5 > 0) { - param0->unk_00 = 117; - param0->unk_02 = 134 + (param3 / 2) + param5 * 2; - param0->unk_04 = 230 + param4; - } else { - param0->unk_00 = 165; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - } - break; - case 479: - if (param5 > 0) { - param0->unk_00 = 117; - param0->unk_02 = 138 + (param3 / 2) + param5 * 2; - param0->unk_04 = 232 + param4 + param5 * 2; - } else { - param0->unk_00 = 165; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - } - break; - case 487: - if (param5 > 0) { - param0->unk_00 = 117; - param0->unk_02 = 150 + (param3 / 2) + param5 * 2; - param0->unk_04 = 244 + param4 + param5 * 2; - } else { - param0->unk_00 = 165; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - } - break; - default: - param0->unk_00 = 165; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - - if ((param1 == 327) && (param3 == 2)) { - param0->unk_06 = 327; - param0->unk_08 = 0; - param0->unk_0C = param6; - } - - break; - } -} - -u8 sub_020765AC (Pokemon * param0, u8 param1) -{ - return sub_020765C4(¶m0->box, param1, 0); -} - -u8 sub_020765B8 (Pokemon * param0, u8 param1) -{ - return sub_020765C4(¶m0->box, param1, 1); -} - -u8 sub_020765C4 (BoxPokemon * param0, u8 param1, int param2) -{ - u16 v0; - u8 v1; - u8 v2; - u32 v3; - - v0 = sub_02074570(param0, MON_DATA_SPECIES_EGG, NULL); - v1 = sub_02075D74(param0); - v3 = sub_02074570(param0, MON_DATA_PERSONALITY, NULL); - - if (v0 == 494) { - if (sub_02074570(param0, MON_DATA_SPECIES, NULL) == 490) { - v2 = 1; - } else { - v2 = 0; - } - } else { - v2 = sub_02074570(param0, MON_DATA_FORM, NULL); - } - - if (param2 == 1) { - return sub_020767BC(v0, v1, param1, v2, v3); - } - - return sub_02076648(v0, v1, param1, v2, v3); -} - -u8 sub_02076648 (u16 param0, u8 param1, u8 param2, u8 param3, u32 param4) -{ - int v0; - int v1; - u8 v2; - - param3 = SanitizeFormId(param0, param3); - - switch (param0) { - case 412: - v0 = 121; - v1 = 72 + (param2 / 2) + param3 * 2; - break; - case 413: - v0 = 121; - v1 = 78 + (param2 / 2) + param3 * 2; - break; - case 422: - v0 = 121; - v1 = 84 + param2 + param3; - break; - case 423: - v0 = 121; - v1 = 88 + param2 + param3; - break; - case 421: - v0 = 121; - v1 = 92 + param2 + param3; - break; - case 493: - v0 = 121; - v1 = 96 + (param2 / 2) + param3 * 2; - break; - case 351: - v0 = 121; - v1 = 64 + param2 * 2 + param3; - break; - case 386: - v0 = 121; - v1 = 0 + (param2 / 2) + param3 * 2; - break; - case 201: - v0 = 121; - v1 = 8 + (param2 / 2) + param3 * 2; - break; - case 494: - v0 = 121; - v1 = 132 + param3; - break; - case 495: - v0 = 121; - v1 = 132; - break; - case 492: - v0 = 121; - v1 = 136 + (param2 / 2) + param3 * 2; - break; - case 479: - v0 = 121; - v1 = 140 + (param2 / 2) + param3 * 2; - break; - case 487: - v0 = 121; - v1 = 152 + (param2 / 2) + param3 * 2; - break; - default: - v0 = 5; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - break; - } - - NARC_ReadWholeMemberByIndexPair(&v2, v0, v1); - - return v2; -} - -static u8 sub_020767BC (u16 param0, u8 param1, u8 param2, u8 param3, u32 param4) -{ - int v0; - int v1; - u8 v2; - - param3 = SanitizeFormId(param0, param3); - - switch (param0) { - case 412: - v0 = 168; - v1 = 72 + (param2 / 2) + param3 * 2; - break; - case 413: - v0 = 168; - v1 = 78 + (param2 / 2) + param3 * 2; - break; - case 422: - v0 = 168; - v1 = 84 + param2 + param3; - break; - case 423: - v0 = 168; - v1 = 88 + param2 + param3; - break; - case 421: - v0 = 168; - v1 = 92 + param2 + param3; - break; - case 493: - v0 = 168; - v1 = 96 + (param2 / 2) + param3 * 2; - break; - case 351: - v0 = 168; - v1 = 64 + param2 * 2 + param3; - break; - case 386: - v0 = 168; - v1 = 0 + (param2 / 2) + param3 * 2; - break; - case 201: - v0 = 168; - v1 = 8 + (param2 / 2) + param3 * 2; - break; - case 494: - v0 = 168; - v1 = 132 + param3; - break; - case 495: - v0 = 168; - v1 = 132; - break; - case 492: - if (param3 > 0) { - v0 = 121; - v1 = 136 + (param2 / 2) + param3 * 2; - } else { - v0 = 167; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - } - break; - case 479: - if (param3 > 0) { - v0 = 121; - v1 = 140 + (param2 / 2) + param3 * 2; - } else { - v0 = 167; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - } - break; - case 487: - if (param3 > 0) { - v0 = 121; - v1 = 152 + (param2 / 2) + param3 * 2; - } else { - v0 = 167; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - } - break; - default: - v0 = 167; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - break; - } - - NARC_ReadWholeMemberByIndexPair(&v2, v0, v1); - - return v2; -} - -void sub_0207697C (UnkStruct_02008A90 * param0, u16 param1) -{ - param0->unk_00 = 60; - param0->unk_02 = param1 * 2; - param0->unk_04 = param1 * 2 + 1; - param0->unk_06 = 0; - param0->unk_08 = 0; - param0->unk_0C = 0; -} - -static const UnkStruct_ov104_0223F9E0 Unk_020F05E4 = { - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - NNS_G2D_VRAM_TYPE_2DMAIN, - {0x4E2F, 0x4E2A, 0x4E27, 0x4E27, 0xffffffff, 0xffffffff}, - 0x2, - 0x1 -}; - -static const int Unk_020F0588[] = { - 0x0, - 0x0, - 0x1, - 0x0, - 0x0, - 0x1 -}; - -UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int param8) -{ - UnkStruct_ov104_0223F9E0 v0; - UnkStruct_0200D0F4 * v1; - NARC * v2; - UnkStruct_ov5_021DE5D0 v3; - int v4 = 1; - - sub_02076AAC(param5, param6, &v3); - - if (param5 == 102) { - v4 = 2; - } - - v2 = NARC_ctor(v3.unk_00, param8); - - sub_0200CC3C(param0, param1, v2, v3.unk_04, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 20015 + param7); - sub_0200CDC4(param2, 2, param0, param1, v2, v3.unk_08, 0, v4, NNS_G2D_VRAM_TYPE_2DMAIN, 20010 + param7); - sub_0200CE24(param0, param1, v2, v3.unk_0C, 0, 20007 + param7); - sub_0200CE54(param0, param1, v2, v3.unk_10, 0, 20007 + param7); - NARC_dtor(v2); - - v0 = Unk_020F05E4; - - v0.unk_14[0] = 20015 + param7; - v0.unk_14[1] = 20010 + param7; - v0.unk_14[2] = 20007 + param7; - v0.unk_14[3] = 20007 + param7; - v0.unk_08 = Unk_020F0588[param7]; - - v1 = sub_0200CE6C(param0, param1, &v0); - - sub_02021F24(v1->unk_00, 0); - sub_0200D4C4(v1, param3, param4); - sub_0200D330(v1); - sub_0200D390(v1, 1); - - return v1; -} - -void sub_02076AAC (int param0, int param1, UnkStruct_ov5_021DE5D0 * param2) -{ - if (param1 == 2) { - param2->unk_00 = 60; - param2->unk_04 = 0 + param0 * 5; - param2->unk_08 = 1 + param0 * 5; - param2->unk_0C = 2 + param0 * 5; - param2->unk_10 = 3 + param0 * 5; - param2->unk_14 = 4 + param0 * 5; - } else { - param2->unk_00 = 6; - param0 = sub_020788D0(param0); - param2->unk_04 = 0 + param0 * 5; - param2->unk_08 = 1 + param0 * 5; - param2->unk_0C = 2 + param0 * 5; - param2->unk_10 = 3 + param0 * 5; - param2->unk_14 = 4 + param0 * 5; - } -} - -u32 sub_02076AF0 (void) -{ - return (u32)sizeof(Pokemon); -} - -u32 sub_02076AF4 (void) -{ - return (u32)sizeof(BoxPokemon); -} - -u8 sub_02076AF8 (Pokemon * param0) -{ - return sub_02076B00((BoxPokemon *)¶m0->box); -} - -u8 sub_02076B00 (BoxPokemon * param0) -{ - return sub_02074570(param0, MON_DATA_FORM, NULL); -} - -BoxPokemon * sub_02076B10 (Pokemon * param0) -{ - return ¶m0->box; -} - -u8 sub_02076B14 (Pokemon * param0) -{ - u16 v0; - u8 v1; - u32 v2; - u32 v3; - int v4; - - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_161, NULL) + 1; - v2 = GetMonData(param0, MON_DATA_EXP, NULL); - v4 = sub_020759F0(v0, 21); - v3 = sub_02075B00(v4, 100); - - if (v2 > v3) { - v2 = v3; - sub_02074B30(param0, 8, (u8 *)&v2); - } - - if (v1 > 100) { - return 0; - } - - v3 = sub_02075B00(v4, v1); - - if (v2 >= v3) { - sub_02074B30(param0, 161, (u8 *)&v1); - return 1; - } - - return 0; -} - -u16 sub_02076B94 (Party * param0, Pokemon * param1, u8 param2, u16 param3, int * param4) -{ - u16 v0; - u16 v1; - u8 v2; - int v3; - u16 v4 = 0; - u16 v5; - u32 v6; - u8 v7; - u8 v8; - u16 v9 = 0; - UnkStruct_0207821C * v10; - int v11; - - v0 = GetMonData(param1, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param1, MON_DATA_HELD_ITEM, NULL); - v6 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - v8 = GetMonData(param1, MON_DATA_BEAUTY, NULL); - v9 = (v6 & 0xffff0000) >> 16; - v7 = Item_LoadParam(v1, 1, 0); - - if (v0 != 64) { - if ((v7 == 64) && (param2 != 3)) { - return 0; - } - } - - if (param4 == NULL) { - param4 = &v11; - } - - v10 = Heap_AllocFromHeap(0, sizeof(UnkStruct_0207821C)); - sub_0207821C(v0, v10); - - switch (param2) { - case 0: - v2 = GetMonData(param1, MON_DATA_161, NULL); - v5 = GetMonData(param1, MON_DATA_FRIENDSHIP, NULL); - - for (v3 = 0; v3 < 7; v3++) { - switch (v10->unk_00[v3].unk_00) { - case 1: - if (220 <= v5) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 1; - } - break; - case 2: - if ((sub_02013948() == 0) && (220 <= v5)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 2; - } - break; - case 3: - if ((sub_02013948() == 1) && (220 <= v5)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 3; - } - break; - case 4: - if (v10->unk_00[v3].unk_02 <= v2) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 4; - } - break; - case 8: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((GetMonData(param1, MON_DATA_165, NULL)) > (GetMonData(param1, MON_DATA_166, NULL))) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 8; - } - } - break; - case 9: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((GetMonData(param1, MON_DATA_165, NULL)) == (GetMonData(param1, MON_DATA_166, NULL))) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 9; - } - } - break; - case 10: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((GetMonData(param1, MON_DATA_165, NULL)) < (GetMonData(param1, MON_DATA_166, NULL))) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 10; - } - } - break; - case 11: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((v9 % 10) < 5) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 11; - } - } - break; - case 12: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((v9 % 10) >= 5) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 12; - } - } - break; - case 13: - if (v10->unk_00[v3].unk_02 <= v2) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 13; - } - break; - case 14: - param4[0] = 14; - break; - case 15: - if (v10->unk_00[v3].unk_02 <= v8) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 15; - } - break; - case 18: - if ((sub_02013948() == 0) && (v10->unk_00[v3].unk_02 == v1)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 18; - } - break; - case 19: - if ((sub_02013948() == 1) && (v10->unk_00[v3].unk_02 == v1)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 19; - } - break; - case 20: - if (sub_0207749C(param1, v10->unk_00[v3].unk_02) == 1) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 20; - } - break; - case 21: - if (param0 != NULL) { - if (Party_HasSpecies(param0, v10->unk_00[v3].unk_02) == 1) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 21; - } - } - break; - case 22: - if ((GetMonData(param1, MON_DATA_111, NULL) == 0) && (v10->unk_00[v3].unk_02 <= v2)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 22; - } - break; - case 23: - if ((GetMonData(param1, MON_DATA_111, NULL) == 1) && (v10->unk_00[v3].unk_02 <= v2)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 23; - } - break; - case 24: - if (v10->unk_00[v3].unk_00 == param3) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 24; - } - break; - case 25: - if (v10->unk_00[v3].unk_00 == param3) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 25; - } - break; - case 26: - if (v10->unk_00[v3].unk_00 == param3) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 26; - } - break; - } - - if (v4) { - break; - } - } - break; - case 1: - for (v3 = 0; v3 < 7; v3++) { - switch (v10->unk_00[v3].unk_00) { - case 5: - v4 = v10->unk_00[v3].unk_04; - param4[0] = 5; - break; - case 6: - if (v10->unk_00[v3].unk_02 == v1) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 6; - } - break; - } - - if (v4) { - break; - } - } - break; - case 2: - case 3: - for (v3 = 0; v3 < 7; v3++) { - if ((v10->unk_00[v3].unk_00 == 7) && (v10->unk_00[v3].unk_02 == param3)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 0; - break; - } - - if ((v10->unk_00[v3].unk_00 == 16) && (GetMonData(param1, MON_DATA_111, NULL) == 0) && (v10->unk_00[v3].unk_02 == param3)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 0; - break; - } - - if ((v10->unk_00[v3].unk_00 == 17) && (GetMonData(param1, MON_DATA_111, NULL) == 1) && (v10->unk_00[v3].unk_02 == param3)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 0; - break; - } - - if (v4) { - break; - } - } - break; - } - - Heap_FreeToHeap(v10); - return v4; -} - -u16 sub_02076F84 (const u16 param0) -{ - FSFile v0; - u16 v1 = 0; - - GF_ASSERT((493 + 1) > param0); - - FS_InitFile(&v0); - FS_OpenFile(&v0, "poketool/personal/pms.narc"); - FS_SeekFile(&v0, param0 * 2, FS_SEEK_SET); - FS_ReadFile(&v0, &v1, 2); - FS_CloseFile(&v0); - - return v1; -} - -u16 sub_02076FD4 (const u16 param0) -{ - switch (param0) { - case 202: - case 183: - case 122: - case 185: - case 143: - case 226: - case 315: - case 113: - case 358: - return param0; - break; - } - - return sub_02076F84(param0); -} - -void sub_02077020 (BoxPokemon * param0) -{ - BOOL v0; - int v1; - u16 v2; - u16 v3; - int v4; - u16 v5; - u8 v6; - u16 * v7 = Heap_AllocFromHeap(0, 44); - - v0 = sub_02073D20(param0); - v2 = sub_02074570(param0, MON_DATA_SPECIES, 0); - v4 = sub_02074570(param0, MON_DATA_FORM, 0); - v6 = sub_02075B40(param0); - - sub_02077D28(v2, v4, v7); - - v1 = 0; - - while (v7[v1] != 0xffff) { - if ((v7[v1] & 0xfe00) <= (v6 << 9)) { - v3 = v7[v1] & 0x1ff; - v5 = sub_020770D4(param0, v3); - - if (v5 == 0xffff) { - sub_02077144(param0, v3); - } - } else { - break; - } - - v1++; - } - - Heap_FreeToHeap(v7); - sub_02073D48(param0, v0); -} - -u16 sub_020770C4 (Pokemon * param0, u16 param1) -{ - BoxPokemon * v0 = sub_02076B10(param0); - return sub_020770D4(v0, param1); -} - -u16 sub_020770D4 (BoxPokemon * param0, u16 param1) -{ - int v0; - u8 v1; - u16 v2; - u16 v3; - BOOL v4; - - v3 = 0xffff; - - v4 = sub_02073D20(param0); - - for (v0 = 0; v0 < 4; v0++) { - if ((v2 = sub_02074570(param0, MON_DATA_MOVE1 + v0, NULL)) == 0) { - sub_02077238(param0, param1, v0); - v3 = param1; - break; - } else { - if (v2 == param1) { - v3 = 0xfffe; - break; - } - } - } - - sub_02073D48(param0, v4); - - return v3; -} - -void sub_02077134 (Pokemon * param0, u16 param1) -{ - BoxPokemon * v0 = sub_02076B10(param0); - sub_02077144(v0, param1); -} - -void sub_02077144 (BoxPokemon * param0, u16 param1) -{ - int v0; - u16 v1[4]; - u8 v2[4]; - u8 v3[4]; - BOOL v4; - - v4 = sub_02073D20(param0); - - for (v0 = 0; v0 < 3; v0++) { - v1[v0] = sub_02074570(param0, 55 + v0, NULL); - v2[v0] = sub_02074570(param0, 59 + v0, NULL); - v3[v0] = sub_02074570(param0, 63 + v0, NULL); - } - - v1[3] = param1; - v2[3] = MoveTable_LoadParam(param1, MOVEATTRIBUTE_PP); - v3[3] = 0; - - for (v0 = 0; v0 < 4; v0++) { - SetBoxMonData(param0, 54 + v0, (u8 *)&v1[v0]); - SetBoxMonData(param0, 58 + v0, (u8 *)&v2[v0]); - SetBoxMonData(param0, 62 + v0, (u8 *)&v3[v0]); - } - - sub_02073D48(param0, v4); -} - -void sub_020771F8 (Pokemon * param0, u16 param1, u8 param2) -{ - u32 v0, v1; - - sub_02077230(param0, param1, param2); - - v1 = 0; - sub_02074B30(param0, 62 + param2, &v1); - - v0 = MoveTable_CalcMaxPP(param1, 0); - sub_02074B30(param0, 58 + param2, (u8 *)&v0); - - return; -} - -void sub_02077230 (Pokemon * param0, u16 param1, u8 param2) -{ - sub_02077238(¶m0->box, param1, param2); -} - -void sub_02077238 (BoxPokemon * param0, u16 param1, u8 param2) -{ - u8 v0; - u8 v1; - - SetBoxMonData(param0, 54 + param2, (u8 *)¶m1); - - v1 = sub_02074570(param0, 62 + param2, NULL); - v0 = MoveTable_CalcMaxPP(param1, v1); - - SetBoxMonData(param0, 58 + param2, (u8 *)&v0); -} - -u16 sub_0207727C (Pokemon * param0, int * param1, u16 * param2) -{ - u16 v0 = 0x0; - u16 v1; - int v2; - u8 v3; - u16 * v4 = Heap_AllocFromHeap(0, 44); - - v1 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v2 = GetMonData(param0, MON_DATA_FORM, NULL); - v3 = GetMonData(param0, MON_DATA_161, NULL); - - sub_02077D28(v1, v2, v4); - - if (v4[param1[0]] == 0xffff) { - Heap_FreeToHeap(v4); - return 0x0; - } - - while ((v4[param1[0]] & 0xfe00) != (v3 << 9)) { - param1[0]++; - - if (v4[param1[0]] == 0xffff) { - Heap_FreeToHeap(v4); - return 0x0; - } - } - - if ((v4[param1[0]] & 0xfe00) == (v3 << 9)) { - param2[0] = v4[param1[0]] & 0x1ff; - param1[0]++; - - v0 = sub_020770C4(param0, param2[0]); - } - - Heap_FreeToHeap(v4); - - return v0; -} - -void sub_02077344 (Pokemon * param0, int param1, int param2) -{ - sub_0207734C(¶m0->box, param1, param2); -} - -void sub_0207734C (BoxPokemon * param0, int param1, int param2) -{ - u16 v0[2]; - u8 v1[2]; - u8 v2[2]; - - v0[0] = sub_02074570(param0, 54 + param1, NULL); - v1[0] = sub_02074570(param0, 58 + param1, NULL); - v2[0] = sub_02074570(param0, 62 + param1, NULL); - v0[1] = sub_02074570(param0, 54 + param2, NULL); - v1[1] = sub_02074570(param0, 58 + param2, NULL); - v2[1] = sub_02074570(param0, 62 + param2, NULL); - - SetBoxMonData(param0, 54 + param1, (u8 *)&v0[1]); - SetBoxMonData(param0, 58 + param1, (u8 *)&v1[1]); - SetBoxMonData(param0, 62 + param1, (u8 *)&v2[1]); - SetBoxMonData(param0, 54 + param2, (u8 *)&v0[0]); - SetBoxMonData(param0, 58 + param2, (u8 *)&v1[0]); - SetBoxMonData(param0, 62 + param2, (u8 *)&v2[0]); -} - -void sub_02077408 (Pokemon * param0, u32 param1) -{ - u32 v0; - u16 v1; - u8 v2; - u8 v3; - - for (v0 = param1; v0 < 3; v0++) { - v1 = GetMonData(param0, 54 + v0 + 1, NULL); - v2 = GetMonData(param0, 58 + v0 + 1, NULL); - v3 = GetMonData(param0, 62 + v0 + 1, NULL); - - sub_02074B30(param0, 54 + v0, (u8 *)&v1); - sub_02074B30(param0, 58 + v0, (u8 *)&v2); - sub_02074B30(param0, 62 + v0, (u8 *)&v3); - } - - v1 = 0; - v2 = 0; - v3 = 0; - - sub_02074B30(param0, 57, (u8 *)&v1); - sub_02074B30(param0, 61, (u8 *)&v2); - sub_02074B30(param0, 65, (u8 *)&v3); -} - -BOOL sub_0207749C (Pokemon * param0, u16 param1) -{ - int v0; - - for (v0 = 0; v0 < 4; v0++) { - if (GetMonData(param0, MON_DATA_MOVE1 + v0, NULL) == param1) { - break; - } - } - - return v0 != 4; -} - -void sub_020774C8 (BoxPokemon * param0, Pokemon * param1) -{ - u32 v0 = 0; - UnkStruct_0202818C * v1; - UnkStruct_0202CA28 v2; - - param1->box = *param0; - - if (param1->box.unk_04_1) { - param1->box.unk_04_0 = 1; - } - - sub_02074B30(param1, 160, (u8 *)&v0); - sub_02074B30(param1, 163, (u8 *)&v0); - sub_02074B30(param1, 164, (u8 *)&v0); - - v1 = sub_0202818C(0); - - sub_02074B30(param1, 170, v1); - Heap_FreeToHeap(v1); - sub_02074B30(param1, 162, (u8 *)&v0); - - MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - - sub_02074B30(param1, 171, (UnkStruct_0202CA28 *)&v2); - sub_0207418C(param1); -} - -u8 sub_02077550 (Party * param0) -{ - u8 v0, v1; - int v2, v3; - Pokemon * v4; - - v3 = Party_GetCurrentCount(param0); - v0 = 1; - - for (v2 = 0; v2 < v3; v2++) { - v4 = Party_GetPokemonBySlotIndex(param0, v2); - - if ((GetMonData(v4, MON_DATA_SPECIES, NULL)) && (GetMonData(v4, MON_DATA_IS_EGG, NULL) == 0)) { - v1 = GetMonData(v4, MON_DATA_161, NULL); - - if (v1 > v0) { - v0 = v1; - } - } - } - - return v0; -} - -u16 sub_020775A4 (u16 param0) -{ - u16 v0; - - NARC_ReadFromMemberByIndexPair(&v0, NARC_INDEX_POKETOOL__PL_POKEZUKAN, 0, param0 * 2, 2); - - return v0; -} - -u16 sub_020775C4 (u16 param0) -{ - u16 v0 = 0; - - if (param0 <= 210) { - NARC_ReadFromMemberByIndexPair(&v0, NARC_INDEX_POKETOOL__SHINZUKAN, 0, param0 * 2, 2); - } - - return v0; -} - -void sub_020775EC (Pokemon * param0, Pokemon * param1) -{ - *param1 = *param0; - return; -} - -void sub_02077604 (BoxPokemon * param0, BoxPokemon * param1) -{ - *param1 = *param0; - return; -} - -void sub_02077618 (Pokemon * param0, BoxPokemon * param1) -{ - *param1 = param0->box; - return; -} - -s8 sub_0207762C (Pokemon * param0, int param1) -{ - return sub_02077634(¶m0->box, param1); -} - -s8 sub_02077634 (BoxPokemon * param0, int param1) -{ - return sub_02077648(sub_02074570(param0, MON_DATA_PERSONALITY, NULL), param1); -} - -s8 sub_02077648 (u32 param0, int param1) -{ - u8 v0; - - v0 = GetNatureFromPersonality(param0); - return Unk_020F0695[v0][param1]; -} - -int sub_02077660 (int param0, int param1, u16 * param2) -{ - int v0; - u16 * v1 = Heap_AllocFromHeap(0, 44); - - sub_02077D28(param0, param1, v1); - - v0 = 0; - - while (v1[v0] != 0xffff) { - param2[v0] = v1[v0] & 0x1ff; - v0++; - } - - Heap_FreeToHeap(v1); - return v0; -} - -void sub_020776B0 (Party * param0) -{ - u16 v0; - u8 v1; - Pokemon * v2; - int v3; - int v4; - - v3 = Party_GetCurrentCount(param0); - v0 = sub_0201D2E8(); - - if ((v0 == 16384) || (v0 == 32768) || (v0 == 49152)) { - do { - v4 = sub_0201D2E8() % v3; - v2 = Party_GetPokemonBySlotIndex(param0, v4); - - if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { - break; - } else { - v4 = v3; - } - } while (v4 == v3); - - if (sub_02077758(param0, FlagIndex(v4)) == 0) { - do { - v1 = sub_0201D2E8() & 0xff; - } while ((v1 & 0x7) == 0); - - if (v1 & 0xf0) { - v1 &= 0x7; - } - - v1 |= (v1 << 4); - v1 &= 0xf3; - v1++; - - sub_02074B30(v2, 154, (u8 *)&v1); - } - } -} - -u8 sub_02077758 (Party * param0, u8 param1) -{ - int v0 = 0; - int v1 = 1; - u8 v2 = 0; - Pokemon * v3; - - if (param1) { - do { - if (param1 & 1) { - v3 = Party_GetPokemonBySlotIndex(param0, v0); - - if (GetMonData(v3, MON_DATA_POKERUS, NULL)) { - v2 |= v1; - } - } - - v0++; - v1 = v1 << 1; - param1 = param1 >> 1; - } while (param1 != 0); - } else { - v3 = Party_GetPokemonBySlotIndex(param0, v0); - - if (GetMonData(v3, MON_DATA_POKERUS, NULL)) { - v2++; - } - } - - return v2; -} - -void sub_020777B4 (Party * param0, s32 param1) -{ - int v0; - int v1; - u8 v2; - Pokemon * v3; - - v1 = Party_GetCurrentCount(param0); - - for (v0 = 0; v0 < v1; v0++) { - v3 = Party_GetPokemonBySlotIndex(param0, v0); - - if (GetMonData(v3, MON_DATA_SPECIES, NULL)) { - v2 = GetMonData(v3, MON_DATA_POKERUS, NULL); - - if (v2 & 0xf) { - if (((v2 & 0xf) < param1) || (param1 > 4)) { - v2 &= 0xf0; - } else { - v2 -= param1; - } - - if (v2 == 0) { - v2 = 0x10; - } - - sub_02074B30(v3, 154, (u8 *)&v2); - } - } - } -} - -void sub_0207782C (Party * param0) -{ - int v0; - int v1; - u8 v2; - Pokemon * v3; - - v1 = Party_GetCurrentCount(param0); - - if (sub_0201D2E8() % 3 == 0) { - for (v0 = 0; v0 < v1; v0++) { - v3 = Party_GetPokemonBySlotIndex(param0, v0); - - if (GetMonData(v3, MON_DATA_SPECIES, NULL)) { - v2 = GetMonData(v3, MON_DATA_POKERUS, NULL); - - if (v2 & 0xf) { - if (v0 != 0) { - v3 = Party_GetPokemonBySlotIndex(param0, v0 - 1); - - if ((GetMonData(v3, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { - sub_02074B30(v3, 154, (u8 *)&v2); - } - } - - if (v0 < v1 - 1) { - v3 = Party_GetPokemonBySlotIndex(param0, v0 + 1); - - if ((GetMonData(v3, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { - sub_02074B30(v3, 154, (u8 *)&v2); - v0++; - } - } - } - } - } - } -} - -BOOL sub_020778D8 (Pokemon * param0) -{ - return sub_020778E0(¶m0->box); -} - -BOOL sub_020778E0 (BoxPokemon * param0) -{ - return (sub_02074570(param0, MON_DATA_POKERUS, NULL) & 0xf) != 0; -} - -BOOL sub_020778F8 (Pokemon * param0) -{ - return sub_02077900(¶m0->box); -} - -BOOL sub_02077900 (BoxPokemon * param0) -{ - u8 v0; - - v0 = sub_02074570(param0, MON_DATA_POKERUS, NULL); - - if (v0 & 0xf) { - return 0; - } - - return (v0 & 0xf0) != 0; -} - -void sub_02077928 (Pokemon * param0) -{ - sub_02077930(¶m0->box); -} - -void sub_02077930 (BoxPokemon * param0) -{ - int v0; - int v1; - int v2; - int v3; - - v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v1 = sub_02074570(param0, MON_DATA_10, NULL); - v2 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); - - if ((v0 == 493) && (v1 == 121)) { - v3 = sub_02077988(Item_LoadParam(v2, 1, 0)); - SetBoxMonData(param0, 112, &v3); - } -} - -u8 sub_02077988 (u16 param0) -{ - u8 v0; - - switch (param0) { - case 126: - v0 = 10; - break; - case 127: - v0 = 11; - break; - case 128: - v0 = 13; - break; - case 129: - v0 = 12; - break; - case 130: - v0 = 15; - break; - case 131: - v0 = 1; - break; - case 132: - v0 = 3; - break; - case 133: - v0 = 4; - break; - case 134: - v0 = 2; - break; - case 135: - v0 = 14; - break; - case 136: - v0 = 6; - break; - case 137: - v0 = 5; - break; - case 138: - v0 = 7; - break; - case 139: - v0 = 16; - break; - case 140: - v0 = 17; - break; - case 141: - v0 = 8; - break; - default: - v0 = 0; - break; - } - - return v0; -} - -int sub_02077A00 (Pokemon * param0) -{ - int v0; - - v0 = sub_02077A1C(¶m0->box); - - if (v0 != -1) { - sub_0207418C(param0); - } - - return v0; -} - -int sub_02077A1C (BoxPokemon * param0) -{ - int v0; - int v1; - int v2; - - v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v1 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); - - if (v0 == 487) { - v2 = (v1 == 112) ? 1 : 0; - - SetBoxMonData(param0, 112, &v2); - sub_02078044(param0); - - return v2; - } - - return -1; -} - -void sub_02077A64 (Pokemon * param0) -{ - int v0 = 1; - - if (GetMonData(param0, MON_DATA_SPECIES, NULL) == 487) { - SetBoxMonData(¶m0->box, 112, &v0); - sub_02078044(¶m0->box); - sub_0207418C(param0); - } -} - -void sub_02077A9C (Party * param0, int param1) -{ - int v0, v1; - Pokemon * v2; - - v1 = Party_GetCurrentCount(param0); - - for (v0 = 0; v0 < v1; v0++) { - v2 = Party_GetPokemonBySlotIndex(param0, v0); - - if (param1) { - sub_02077A64(v2); - } else { - sub_02077A00(v2); - } - } -} - -void SetShayminForm (Pokemon * param0, int param1) -{ - SetBoxShayminForm(¶m0->box, param1); - sub_0207418C(param0); -} - -void SetBoxShayminForm (BoxPokemon * param0, int param1) -{ - int v0; - - v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - - if (v0 == 492) { - GF_ASSERT(param1 <= 1); - - SetBoxMonData(param0, 112, ¶m1); - sub_02078044(param0); - } -} - -BOOL sub_02077B14 (Pokemon * param0) -{ - u32 v0, v1, v2, v3, v4; - RTCTime v5; - - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_FORM, NULL); - v2 = GetMonData(param0, MON_DATA_160, NULL); - v3 = GetMonData(param0, MON_DATA_163, NULL); - v4 = GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL); - - sub_02013880(&v5); - - if ((v0 == 492) && (v1 == 0) && (v3 > 0) && (v4 == 1) && ((v2 & 0x20) == 0) && ((v5.hour >= 4) && (v5.hour < 20))) { - return 1; - } - - return 0; -} - -void sub_02077B8C (Party * param0) -{ - int v0, v1, v2, v3; - Pokemon * v4; - int v5 = 0; - - v1 = Party_GetCurrentCount(param0); - - for (v0 = 0; v0 < v1; v0++) { - v4 = Party_GetPokemonBySlotIndex(param0, v0); - v2 = GetMonData(v4, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v4, MON_DATA_FORM, NULL); - - if ((v2 == 492) && (v3 == 1)) { - SetShayminForm(v4, v5); - } - } -} - -BOOL sub_02077BD8 (Party * param0, int param1, const RTCTime * param2) -{ - s32 v0, v1; - - if ((param2->hour >= 20) || (param2->hour < 4)) { - v0 = param2->hour; - - if (v0 < 4) { - v0 += 24; - } - - v0 -= 20; - v1 = param2->minute + v0 * 60; - - param1++; - - if (v1 < param1) { - sub_02077B8C(param0); - return 1; - } - - return 0; - } else { - v1 = param2->minute + (param2->hour - 4) * 60; - - if (v1 < param1) { - sub_02077B8C(param0); - return 1; - } - - return 0; - } -} - -BOOL SetRotomForm (Pokemon * param0, int param1, int param2) -{ - int v0, v1; - - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - - if (v0 != 479) { - return 0; - } - - v1 = GetMonData(param0, MON_DATA_FORM, NULL); - - { - int v2, v3, v4, v5; - static const u16 v6[] = { - 0, - 315, - 56, - 59, - 403, - 437 - }; - - v4 = v6[param1]; - - for (v2 = 0; v2 < 4; v2++) { - v5 = GetMonData(param0, MON_DATA_MOVE1 + v2, NULL); - - for (v3 = 1; v3 < NELEMS(v6); v3++) { - if ((v5 != 0) && (v5 == v6[v3])) { - if (v4 != 0) { - sub_020771F8(param0, v4, v2); - v4 = 0; - break; - } else { - sub_02077408(param0, v2); - v2--; - break; - } - } - } - } - - if (v4 != 0) { - for (v2 = 0; v2 < 4; v2++) { - if (GetMonData(param0, MON_DATA_MOVE1 + v2, NULL) == 0) { - sub_020771F8(param0, v4, v2); - break; - } - } - - if (v2 == 4) { - sub_020771F8(param0, v4, param2); - } - } - - if (GetMonData(param0, MON_DATA_MOVE1, NULL) == 0) { - sub_020771F8(param0, 84, 0); - } - } - - sub_02074B30(param0, 112, ¶m1); - sub_0207803C(param0); - sub_0207418C(param0); - - return 1; -} - -void sub_02077D28 (int param0, int param1, u16 * param2) -{ - param0 = sub_02078740(param0, param1); - NARC_ReadWholeMemberByIndexPair(param2, NARC_INDEX_POKETOOL__PERSONAL__WOTBL, param0); -} - -void sub_02077D3C (UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7) -{ - if (param2 == 441) { - if (sub_020064C8(param1) == 0) { - sub_020063D4(1); - sub_020059D0(param1, param2, param4, param5, param7, param3); - } else { - if (param6) { - sub_020063D4(1); - } - - sub_020063E4(param0, NULL, param5, param4); - } - } else { - sub_020059D0(param1, param2, param4, param5, param7, param3); - } -} - -void sub_02077DB4 (UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7, u8 param8) -{ - if (param2 == 441) { - if (sub_020064C8(param1) == 0) { - sub_020063D4(1); - sub_02005F4C(param1, param2, param4, param5, param7, param8, param3); - } else { - if (param6) { - sub_020063D4(1); - } - - sub_02006438(param0, NULL, param5, param4, param8); - } - } else { - sub_02005F4C(param1, param2, param4, param5, param7, param8, param3); - } -} - -BOOL sub_02077E3C (Pokemon * param0) -{ - int v0, v1; - - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_FORM, NULL); - - return sub_02005844(v0, v1); -} - -void sub_02077E64 (Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5) -{ - int v0; - - sub_02077EA4(¶m0->box, param1, param2, param3, param4, param5); - - if (param2 == 14) { - v0 = GetMonData(param0, MON_DATA_164, NULL); - sub_02074B30(param0, 163, &v0); - - v0 = 0; - sub_02074B30(param0, 160, &v0); - } -} - -void sub_02077EA4 (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5) -{ - sub_0209305C(param0, param1, 0, param3, param5); - SetBoxMonData(param0, 122, &Unk_020E4C40); - SetBoxMonData(param0, 155, ¶m2); - SetBoxMonData(param0, 158, ¶m4); -} - -void sub_02077EE4 (Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5) -{ - sub_02077EF8(¶m0->box, param1, param2, param3, param4, param5); -} - -void sub_02077EF8 (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5) -{ - int v0; - sub_02077EA4(param0, param1, param2, param3, param4, param5); -} - -static const u16 Unk_020F0574[][2] = { - {0x2D, 0x5F}, - {0x14, 0x50} -}; - -void sub_02077F0C (Pokemon * param0, u32 param1, int param2) -{ - int v0; - u32 v1; - u16 v2; - u16 v3; - u8 v4; - u16 v5, v6; - - if (param1 & ((0x1 | 0x80))) { - return; - } - - v1 = sub_0201D2E8() % 100; - v2 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v3 = GetMonData(param0, MON_DATA_FORM, NULL); - v5 = sub_020759CC(v2, v3, 16); - v6 = sub_020759CC(v2, v3, 17); - - if ((v5 == v6) && (v5 != 0)) { - sub_02074B30(param0, 6, &v5); - return; - } - - if (v1 < Unk_020F0574[param2][0]) { - return; - } else if (v1 < Unk_020F0574[param2][1]) { - sub_02074B30(param0, 6, &v5); - } else { - sub_02074B30(param0, 6, &v6); - } -} - -BOOL sub_02077FB4 (Pokemon * param0, u8 param1) -{ - return sub_02077FBC(¶m0->box, param1); -} - -BOOL sub_02077FBC (BoxPokemon * param0, u8 param1) -{ - u16 v0; - int v1; - - v0 = sub_02074570(param0, MON_DATA_SPECIES_EGG, NULL); - v1 = sub_02074570(param0, MON_DATA_FORM, NULL); - - return sub_02077FE4(v0, v1, param1); -} - -BOOL sub_02077FE4 (u16 param0, int param1, u8 param2) -{ - u32 v0; - u8 v1; - - if (param0 == 494) { - return 0; - } - - if (param2 < 32) { - v0 = (1 << param2); - v1 = 29; - } else if (param2 < 64) { - v0 = (1 << (param2 - 32)); - v1 = 30; - } else if (param2 < 96) { - v0 = (1 << (param2 - 64)); - v1 = 31; - } else { - v0 = (1 << (param2 - 96)); - v1 = 32; - } - - return (sub_020759CC(param0, param1, v1) & v0) != 0; -} - -void sub_0207803C (Pokemon * param0) -{ - sub_02078044(¶m0->box); -} - -void sub_02078044 (BoxPokemon * param0) -{ - BOOL v0; - int v1, v2; - int v3, v4; - u32 v5; - - v0 = sub_02073D20(param0); - v1 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v5 = sub_02074570(param0, MON_DATA_PERSONALITY, NULL); - v2 = sub_02074570(param0, MON_DATA_FORM, NULL); - v3 = sub_020759CC(v1, v2, 24); - v4 = sub_020759CC(v1, v2, 25); - - if (v4 != 0) { - if (v5 & 1) { - SetBoxMonData(param0, 10, (u8 *)&v4); - } else { - SetBoxMonData(param0, 10, (u8 *)&v3); - } - } else { - SetBoxMonData(param0, 10, (u8 *)&v3); - } - - sub_02073D48(param0, v0); -} - -void sub_020780C4 (Pokemon * param0, u32 param1) -{ - Pokemon * v0; - PokemonSubstruct0 * v1; - PokemonSubstruct1 * v2; - PokemonSubstruct2 * v3; - PokemonSubstruct3 * v4; - PokemonSubstruct0 * v5; - PokemonSubstruct1 * v6; - PokemonSubstruct2 * v7; - PokemonSubstruct3 * v8; - - v0 = AllocMonZeroed(0); - - sub_020775EC(param0, v0); - - v1 = (PokemonSubstruct0 *)sub_0207825C(&v0->box, param0->box.unk_00, 0); - v2 = (PokemonSubstruct1 *)sub_0207825C(&v0->box, param0->box.unk_00, 1); - v3 = (PokemonSubstruct2 *)sub_0207825C(&v0->box, param0->box.unk_00, 2); - v4 = (PokemonSubstruct3 *)sub_0207825C(&v0->box, param0->box.unk_00, 3); - v5 = (PokemonSubstruct0 *)sub_0207825C(¶m0->box, param1, 0); - v6 = (PokemonSubstruct1 *)sub_0207825C(¶m0->box, param1, 1); - v7 = (PokemonSubstruct2 *)sub_0207825C(¶m0->box, param1, 2); - v8 = (PokemonSubstruct3 *)sub_0207825C(¶m0->box, param1, 3); - - sub_02078234(&v0->box.unk_08, sizeof(PokemonSubstruct0) * 4, v0->box.unk_06); - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - - param0->box.unk_00 = param1; - - *v5 = *v1; - *v6 = *v2; - *v7 = *v3; - *v8 = *v4; - - param0->box.unk_06 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - Heap_FreeToHeap(v0); -} - -static void sub_020781F8 (int param0, UnkStruct_02075874 * param1) -{ - NARC_ReadWholeMemberByIndexPair(param1, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, param0); -} - -static void sub_02078208 (int param0, int param1, UnkStruct_02075874 * param2) -{ - param0 = sub_02078740(param0, param1); - NARC_ReadWholeMemberByIndexPair(param2, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, param0); -} - -static void sub_0207821C (int param0, UnkStruct_0207821C * param1) -{ - NARC_ReadWholeMemberByIndexPair(param1, NARC_INDEX_POKETOOL__PERSONAL__EVO, param0); -} - -static void sub_0207822C (void * param0, u32 param1, u32 param2) -{ - sub_0201D5D4(param0, param1, param2); -} - -static void sub_02078234 (void * param0, u32 param1, u32 param2) -{ - sub_0201D600(param0, param1, param2); -} - -static u16 sub_0207823C (void * param0, u32 param1) -{ - int v0; - u16 * v1 = (u16 *)param0; - u16 v2 = 0; - - for (v0 = 0; v0 < param1 / 2; v0++) { - v2 += v1[v0]; - } - - return v2; -} - -static void * sub_0207825C (BoxPokemon * param0, u32 param1, u8 param2) -{ - void * v0; - - param1 = (param1 & 0x3e000) >> 13; - - GF_ASSERT(param1 <= 31); - - switch (param1) { - case 0: - case 24: - { - UnkStruct_0207825C * v1 = (UnkStruct_0207825C *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v1->unk_00; - break; - case 1: - v0 = &v1->unk_20; - break; - case 2: - v0 = &v1->unk_40; - break; - case 3: - v0 = &v1->unk_60; - break; - } - break; - } - case 1: - case 25: - { - UnkStruct_0207825C_1 * v2 = (UnkStruct_0207825C_1 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v2->unk_00; - break; - case 1: - v0 = &v2->unk_20; - break; - case 2: - v0 = &v2->unk_60; - break; - case 3: - v0 = &v2->unk_40; - break; - } - break; - } - case 2: - case 26: - { - UnkStruct_0207825C_2 * v3 = (UnkStruct_0207825C_2 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v3->unk_00; - break; - case 1: - v0 = &v3->unk_40; - break; - case 2: - v0 = &v3->unk_20; - break; - case 3: - v0 = &v3->unk_60; - break; - } - break; - } - case 3: - case 27: - { - UnkStruct_0207825C_3 * v4 = (UnkStruct_0207825C_3 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v4->unk_00; - break; - case 1: - v0 = &v4->unk_60; - break; - case 2: - v0 = &v4->unk_20; - break; - case 3: - v0 = &v4->unk_40; - break; - } - break; - } - case 4: - case 28: - { - UnkStruct_0207825C_4 * v5 = (UnkStruct_0207825C_4 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v5->unk_00; - break; - case 1: - v0 = &v5->unk_40; - break; - case 2: - v0 = &v5->unk_60; - break; - case 3: - v0 = &v5->unk_20; - break; - } - break; - } - case 5: - case 29: - { - UnkStruct_0207825C_5 * v6 = (UnkStruct_0207825C_5 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v6->unk_00; - break; - case 1: - v0 = &v6->unk_60; - break; - case 2: - v0 = &v6->unk_40; - break; - case 3: - v0 = &v6->unk_20; - break; - } - break; - } - case 6: - case 30: - { - UnkStruct_0207825C_6 * v7 = (UnkStruct_0207825C_6 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v7->unk_20; - break; - case 1: - v0 = &v7->unk_00; - break; - case 2: - v0 = &v7->unk_40; - break; - case 3: - v0 = &v7->unk_60; - break; - } - break; - } - case 7: - case 31: - { - UnkStruct_0207825C_7 * v8 = (UnkStruct_0207825C_7 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v8->unk_20; - break; - case 1: - v0 = &v8->unk_00; - break; - case 2: - v0 = &v8->unk_60; - break; - case 3: - v0 = &v8->unk_40; - break; - } - break; - } - case 8: - { - UnkStruct_0207825C_8 * v9 = (UnkStruct_0207825C_8 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v9->unk_40; - break; - case 1: - v0 = &v9->unk_00; - break; - case 2: - v0 = &v9->unk_20; - break; - case 3: - v0 = &v9->unk_60; - break; - } - break; - } - case 9: - { - UnkStruct_0207825C_9 * v10 = (UnkStruct_0207825C_9 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v10->unk_60; - break; - case 1: - v0 = &v10->unk_00; - break; - case 2: - v0 = &v10->unk_20; - break; - case 3: - v0 = &v10->unk_40; - break; - } - break; - } - case 10: - { - UnkStruct_0207825C_10 * v11 = (UnkStruct_0207825C_10 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v11->unk_40; - break; - case 1: - v0 = &v11->unk_00; - break; - case 2: - v0 = &v11->unk_60; - break; - case 3: - v0 = &v11->unk_20; - break; - } - break; - } - case 11: - { - UnkStruct_0207825C_11 * v12 = (UnkStruct_0207825C_11 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v12->unk_60; - break; - case 1: - v0 = &v12->unk_00; - break; - case 2: - v0 = &v12->unk_40; - break; - case 3: - v0 = &v12->unk_20; - break; - } - break; - } - case 12: - { - UnkStruct_0207825C_12 * v13 = (UnkStruct_0207825C_12 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v13->unk_20; - break; - case 1: - v0 = &v13->unk_40; - break; - case 2: - v0 = &v13->unk_00; - break; - case 3: - v0 = &v13->unk_60; - break; - } - break; - } - case 13: - { - UnkStruct_0207825C_13 * v14 = (UnkStruct_0207825C_13 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v14->unk_20; - break; - case 1: - v0 = &v14->unk_60; - break; - case 2: - v0 = &v14->unk_00; - break; - case 3: - v0 = &v14->unk_40; - break; - } - break; - } - case 14: - { - UnkStruct_0207825C_14 * v15 = (UnkStruct_0207825C_14 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v15->unk_40; - break; - case 1: - v0 = &v15->unk_20; - break; - case 2: - v0 = &v15->unk_00; - break; - case 3: - v0 = &v15->unk_60; - break; - } - break; - } - case 15: - { - UnkStruct_0207825C_15 * v16 = (UnkStruct_0207825C_15 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v16->unk_60; - break; - case 1: - v0 = &v16->unk_20; - break; - case 2: - v0 = &v16->unk_00; - break; - case 3: - v0 = &v16->unk_40; - break; - } - break; - } - case 16: - { - UnkStruct_0207825C_16 * v17 = (UnkStruct_0207825C_16 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v17->unk_40; - break; - case 1: - v0 = &v17->unk_60; - break; - case 2: - v0 = &v17->unk_00; - break; - case 3: - v0 = &v17->unk_20; - break; - } - break; - } - case 17: - { - UnkStruct_0207825C_17 * v18 = (UnkStruct_0207825C_17 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v18->unk_60; - break; - case 1: - v0 = &v18->unk_40; - break; - case 2: - v0 = &v18->unk_00; - break; - case 3: - v0 = &v18->unk_20; - break; - } - break; - } - case 18: - { - UnkStruct_0207825C_18 * v19 = (UnkStruct_0207825C_18 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v19->unk_20; - break; - case 1: - v0 = &v19->unk_40; - break; - case 2: - v0 = &v19->unk_60; - break; - case 3: - v0 = &v19->unk_00; - break; - } - break; - } - case 19: - { - UnkStruct_0207825C_19 * v20 = (UnkStruct_0207825C_19 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v20->unk_20; - break; - case 1: - v0 = &v20->unk_60; - break; - case 2: - v0 = &v20->unk_40; - break; - case 3: - v0 = &v20->unk_00; - break; - } - break; - } - case 20: - { - UnkStruct_0207825C_20 * v21 = (UnkStruct_0207825C_20 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v21->unk_40; - break; - case 1: - v0 = &v21->unk_20; - break; - case 2: - v0 = &v21->unk_60; - break; - case 3: - v0 = &v21->unk_00; - break; - } - break; - } - case 21: - { - UnkStruct_0207825C_21 * v22 = (UnkStruct_0207825C_21 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v22->unk_60; - break; - case 1: - v0 = &v22->unk_20; - break; - case 2: - v0 = &v22->unk_40; - break; - case 3: - v0 = &v22->unk_00; - break; - } - break; - } - case 22: - { - UnkStruct_0207825C_22 * v23 = (UnkStruct_0207825C_22 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v23->unk_40; - break; - case 1: - v0 = &v23->unk_60; - break; - case 2: - v0 = &v23->unk_20; - break; - case 3: - v0 = &v23->unk_00; - break; - } - break; - } - case 23: - { - UnkStruct_0207825C_23 * v24 = (UnkStruct_0207825C_23 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v24->unk_60; - break; - case 1: - v0 = &v24->unk_40; - break; - case 2: - v0 = &v24->unk_20; - break; - case 3: - v0 = &v24->unk_00; - break; - } - break; - } - } - - return v0; -} - -static int sub_02078740 (int param0, int param1) -{ - switch (param0) { - case 386: - if ((param1) && (param1 <= 3)) { - param0 = (496 - 1) + param1; - } - break; - case 413: - if ((param1) && (param1 <= 2)) { - param0 = (499 - 1) + param1; - } - break; - case 487: - if ((param1) && (param1 <= 1)) { - param0 = (501 - 1) + param1; - } - break; - case 492: - if ((param1) && (param1 <= 1)) { - param0 = (502 - 1) + param1; - } - break; - case 479: - if ((param1) && (param1 <= 5)) { - param0 = (503 - 1) + param1; - } - break; - default: - break; - } - - return param0; -} - -u32 FlagIndex (int index) -{ - int i; // only matches when declared here - u32 flag = 1; - - GF_ASSERT(index < 32); - - for (i = 0; i < index; i++) { - flag <<= 1; - } - - return flag; -} - -int sub_020787EC (u32 param0) -{ - int v0; - u32 v1 = 1; - - for (v0 = 0; v0 < 32; v0++) { - if (param0 & v1) { - break; - } - - v1 <<= 1; - } - - return v0; -} - -static const u16 Unk_020F05BE[18] = { - 0x96, - 0x97, - 0xF9, - 0xFA, - 0xFB, - 0x17E, - 0x17F, - 0x180, - 0x181, - 0x182, - 0x1E3, - 0x1E4, - 0x1E7, - 0x1E9, - 0x1EA, - 0x1EB, - 0x1EC, - 0x1ED -}; - -BOOL sub_02078804 (u16 param0) -{ - u32 v0; - - for (v0 = 0; v0 < NELEMS(Unk_020F05BE); v0++) { - if (param0 == Unk_020F05BE[v0]) { - return 1; - } - } - - return 0; -} - -u16 sub_02078824 (u8 param0) -{ - if (param0 >= NELEMS(Unk_020F05BE)) { - param0 = 0; - } - - return Unk_020F05BE[param0]; -} - -BOOL sub_02078838 (Pokemon * param0) -{ - u16 v0 = (u16)GetMonData(param0, MON_DATA_SPECIES, NULL); - return sub_02078804(v0); -} - -BOOL sub_0207884C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2) -{ - u32 v0 = sub_02025F20(param1); - u32 v1 = sub_02074570(param0, MON_DATA_OT_ID, NULL); - u32 v2 = sub_02025F30(param1); - u32 v3 = sub_02074570(param0, MON_DATA_OT_GENDER, NULL); - Strbuf* v4 = sub_02025F04(param1, param2); - Strbuf* v5 = Strbuf_Init(8, param2); - BOOL v6 = 0; - - sub_02074570(param0, MON_DATA_145, v5); - - if ((v0 == v1) && (v2 == v3) && (Strbuf_Compare(v4, v5) == 0)) { - v6 = 1; - } - - Strbuf_Free(v5); - Strbuf_Free(v4); - - return v6; -} - -int sub_020788D0 (int param0) -{ - switch (param0) { - case 0: - case 1: - break; - case 63: - param0 = 2; - break; - case 90: - case 91: - case 92: - case 93: - case 94: - param0 = 3 + (param0 - 90); - break; - case 103: - case 104: - param0 = 8 + (param0 - 103); - break; - default: - if (sub_020793AC(param0) == 1) { - param0 = 1; - } else { - param0 = 0; - } - break; - } - - return param0; -} - -void sub_0207893C (Pokemon * param0) -{ - u8 v0; - UnkStruct_0202CA28 v1; - - v0 = 0; - - MI_CpuClearFast(&v1, sizeof(UnkStruct_0202CA28)); - - sub_02074B30(param0, 162, (u8 *)&v0); - sub_02074B30(param0, 171, (UnkStruct_0202CA28 *)&v1); -} - -void sub_0207896C (BoxPokemon * param0) -{ - BOOL v0; - int v1; - - v0 = sub_02073D20(param0); - - for (v1 = 0; v1 < 4; v1++) { - if (sub_02074570(param0, MON_DATA_MOVE1 + v1, NULL)) { - u8 v2 = sub_02074570(param0, 66 + v1, NULL); - - SetBoxMonData(param0, 58 + v1, &v2); - } - } - - sub_02073D48(param0, v0); -} - -static inline int inline_020789BC (int param0) -{ - int v0; - - v0 = (param0 & 0x1) ? 0 : 1; - return v0; -} - -void sub_020789BC (NARC * param0, UnkStruct_02007C10 * param1, u16 param2, u16 param3) -{ - UnkStruct_020789BC v0; - int v1; - - v1 = inline_020789BC(param3); - - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - MI_CpuCopy8(&v0.unk_00[v1].unk_03[0], param1, sizeof(UnkStruct_02007C10) * 10); -} - -void sub_020789F4 (NARC * param0, UnkStruct_02015F84 * param1, UnkStruct_02007C7C * param2, u16 param3, int param4, int param5, int param6) -{ - UnkStruct_020789F4 v0; - UnkStruct_020789BC v1; - int v2; - int v3; - - v3 = (param4 == 2) ? 0 : 1; - - NARC_ReadFromMember(param0, 0, param3 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v1); - - v0.unk_00 = v1.unk_00[v3].unk_01; - v0.unk_02 = v1.unk_00[v3].unk_02; - v0.unk_04 = param5; - - sub_02015FCC(param1, param2, &v0, param6); -} - -void sub_02078A4C (NARC * param0, u8 * param1, u16 param2, u16 param3) -{ - UnkStruct_020789BC v0; - int v1; - - v1 = inline_020789BC(param3); - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - - *param1 = v0.unk_00[v1].unk_00; -} - -void sub_02078A80 (NARC * param0, s8 * param1, u16 param2) -{ - UnkStruct_020789BC v0; - - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - *param1 = v0.unk_56; -} - -void sub_02078AA4 (NARC * param0, s8 * param1, u16 param2) -{ - UnkStruct_020789BC v0; - - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - *param1 = v0.unk_57; -} - -void sub_02078AC8 (NARC * param0, u8 * param1, u16 param2) -{ - UnkStruct_020789BC v0; - - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - *param1 = v0.unk_58; -} - -BOOL sub_02078AEC (int param0, Pokemon * param1, int param2) -{ - int v0; - int v1; - UnkStruct_0202CA28 v2; - NARC * v3; - - v0 = param0; - - if (v0 == 0) { - return 0; - } - - v3 = NARC_ctor(NARC_INDEX_APPLICATION__CUSTOM_BALL__EDIT__PL_CB_DATA, param2); - v0 = v0 - 1; - v1 = 1; - - NARC_ReadFromMember(v3, 0, v0 * sizeof(UnkStruct_0202CA28), sizeof(UnkStruct_0202CA28), &v2); - sub_02074B30(param1, 162, &v1); - sub_02074B30(param1, 171, &v2); - NARC_dtor(v3); - - return 1; -} - -void sub_02078B40 (Pokemon * param0, UnkStruct_02078B40 * param1) -{ - BoxPokemon * v0; - PokemonSubstruct0 * v1; - PokemonSubstruct1 * v2; - PokemonSubstruct2 * v3; - PokemonSubstruct3 * v4; - int v5; - u16 v6; - - if (param0->box.unk_04_0 == 0) { - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } - - v0 = sub_02076B10(param0); - v1 = (PokemonSubstruct0 *)sub_0207825C(v0, v0->unk_00, 0); - v2 = (PokemonSubstruct1 *)sub_0207825C(v0, v0->unk_00, 1); - v3 = (PokemonSubstruct2 *)sub_0207825C(v0, v0->unk_00, 2); - v4 = (PokemonSubstruct3 *)sub_0207825C(v0, v0->unk_00, 3); - - param1->unk_00 = v0->unk_00; - param1->unk_04_0 = 0; - param1->unk_04_1 = 0; - param1->unk_04_2 = v0->unk_04_2; - param1->unk_06 = v1->species; - param1->unk_08 = v1->item; - param1->unk_0C = v1->unk_04; - param1->unk_10 = v1->unk_08; - param1->unk_14 = v1->friendship; - param1->unk_15 = v1->unk_0D; - param1->unk_16 = v1->unk_10; - param1->unk_17 = v1->unk_11; - param1->unk_18 = v1->unk_12; - param1->unk_19 = v1->unk_13; - param1->unk_1A = v1->unk_14; - param1->unk_1B = v1->unk_15; - param1->unk_59 = v1->unk_0F; - - for (v5 = 0; v5 < 4; v5++) { - param1->unk_1C[v5] = v2->unk_00[v5]; - param1->unk_24[v5] = v2->unk_08[v5]; - param1->unk_28[v5] = v2->unk_0C[v5]; - } - - param1->unk_2C_0 = v2->unk_10_0; - param1->unk_2C_5 = v2->unk_10_5; - param1->unk_2C_10 = v2->unk_10_10; - param1->unk_2C_15 = v2->unk_10_15; - param1->unk_2C_20 = v2->unk_10_20; - param1->unk_2C_25 = v2->unk_10_25; - param1->unk_2C_30 = v2->unk_10_30; - param1->unk_2C_31 = v2->unk_10_31; - param1->unk_30_0 = v2->fatefulEncounter; - param1->unk_30_1 = v2->unk_18_1; - param1->unk_30_3 = v2->form; - - for (v5 = 0; v5 < 10 + 1; v5++) { - param1->unk_32[v5] = v3->unk_00[v5]; - } - - for (v5 = 0; v5 < 7 + 1; v5++) { - param1->unk_48[v5] = v4->unk_00[v5]; - } - - param1->unk_58 = v4->unk_1B; - - param1->unk_5C = param0->party.unk_00; - param1->unk_60 = param0->party.unk_04; - param1->unk_61 = param0->party.unk_05; - param1->unk_62 = param0->party.unk_06; - param1->unk_64 = param0->party.unk_08; - param1->unk_66 = param0->party.unk_0A; - param1->unk_68 = param0->party.unk_0C; - param1->unk_6A = param0->party.unk_0E; - param1->unk_6C = param0->party.unk_10; - param1->unk_6E = param0->party.unk_12; - - if (param0->box.unk_04_0 == 0) { - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } -} - -void sub_02078E0C (UnkStruct_02078B40 * param0, Pokemon * param1) -{ - BoxPokemon * v0; - PokemonSubstruct0 * v1; - PokemonSubstruct1 * v2; - PokemonSubstruct2 * v3; - PokemonSubstruct3 * v4; - int v5; - - MI_CpuClearFast(param1, sizeof(Pokemon)); - - v0 = sub_02076B10(param1); - v1 = (PokemonSubstruct0 *)sub_0207825C(v0, param0->unk_00, 0); - v2 = (PokemonSubstruct1 *)sub_0207825C(v0, param0->unk_00, 1); - v3 = (PokemonSubstruct2 *)sub_0207825C(v0, param0->unk_00, 2); - v4 = (PokemonSubstruct3 *)sub_0207825C(v0, param0->unk_00, 3); - - v0->unk_00 = param0->unk_00; - v0->unk_04_0 = 0; - v0->unk_04_1 = 0; - v0->unk_04_2 = param0->unk_04_2; - - v1->species = param0->unk_06; - v1->item = param0->unk_08; - v1->unk_04 = param0->unk_0C; - v1->unk_08 = param0->unk_10; - v1->friendship = param0->unk_14; - v1->unk_0D = param0->unk_15; - v1->unk_10 = param0->unk_16; - v1->unk_11 = param0->unk_17; - v1->unk_12 = param0->unk_18; - v1->unk_13 = param0->unk_19; - v1->unk_14 = param0->unk_1A; - v1->unk_15 = param0->unk_1B; - v1->unk_0F = param0->unk_59; - - for (v5 = 0; v5 < 4; v5++) { - v2->unk_00[v5] = param0->unk_1C[v5]; - v2->unk_08[v5] = param0->unk_24[v5]; - v2->unk_0C[v5] = param0->unk_28[v5]; - } - - v2->unk_10_0 = param0->unk_2C_0; - v2->unk_10_5 = param0->unk_2C_5; - v2->unk_10_10 = param0->unk_2C_10; - v2->unk_10_15 = param0->unk_2C_15; - v2->unk_10_20 = param0->unk_2C_20; - v2->unk_10_25 = param0->unk_2C_25; - v2->unk_10_30 = param0->unk_2C_30; - v2->unk_10_31 = param0->unk_2C_31; - v2->fatefulEncounter = param0->unk_30_0; - v2->unk_18_1 = param0->unk_30_1; - v2->form = param0->unk_30_3; - - for (v5 = 0; v5 < 10 + 1; v5++) { - v3->unk_00[v5] = param0->unk_32[v5]; - } - - for (v5 = 0; v5 < 7 + 1; v5++) { - v4->unk_00[v5] = param0->unk_48[v5]; - } - - v4->unk_1B = param0->unk_58; - - param1->party.unk_00 = param0->unk_5C; - param1->party.unk_04 = param0->unk_60; - param1->party.unk_05 = param0->unk_61; - param1->party.unk_06 = param0->unk_62; - param1->party.unk_08 = param0->unk_64; - param1->party.unk_0A = param0->unk_66; - param1->party.unk_0C = param0->unk_68; - param1->party.unk_0E = param0->unk_6A; - param1->party.unk_10 = param0->unk_6C; - param1->party.unk_12 = param0->unk_6E; - - sub_0207822C(¶m1->party, sizeof(PartyPokemon), param1->box.unk_00); - param1->box.unk_06 = sub_0207823C(¶m1->box.unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(¶m1->box.unk_08, sizeof(PokemonSubstruct0) * 4, param1->box.unk_06); -} diff --git a/src/unk_02079170.c b/src/unk_02079170.c index 922b777880..6aa3394c23 100644 --- a/src/unk_02079170.c +++ b/src/unk_02079170.c @@ -4,7 +4,7 @@ #include "constants/trainer.h" #include "struct_decls/struct_02006C24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/trainer_data.h" @@ -21,7 +21,7 @@ #include "unk_0201D15C.h" #include "strbuf.h" #include "unk_020277A4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "party.h" @@ -297,12 +297,12 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) u8 v6; Pokemon * v7; - v5 = sub_0201D2D0(); + v5 = LCRNG_GetSeed(); Party_InitWithCapacity(param0->parties[param1], 6); v0 = Heap_AllocFromHeap(param2, sizeof(UnkStruct_ov16_022431BC_3) * 6); - v7 = AllocMonZeroed(param2); + v7 = Pokemon_New(param2); sub_0207939C(param0->unk_18[param1], v0); @@ -326,10 +326,10 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v10 = (v8[v1].unk_04 & 0xfc00) >> 10; v4 = v8[v1].unk_00 + v8[v1].unk_02 + v9 + param0->unk_18[param1]; - sub_0201D2DC(v4); + LCRNG_SetSeed(v4); for (v2 = 0; v2 < param0->trainerData[param1].class; v2++) { - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); } v4 = (v4 << 8) + v3; @@ -337,7 +337,7 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) sub_02073D80(v7, v9, v8[v1].unk_02, v6, 1, v4, 2, 0); sub_02078AEC(v8[v1].unk_06, v7, param2); - sub_02074B30(v7, 112, &v10); + Pokemon_SetValue(v7, 112, &v10); Party_AddPokemon(param0->parties[param1], v7); } } @@ -355,10 +355,10 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v13 = (v11[v1].unk_04 & 0xfc00) >> 10; v4 = v11[v1].unk_00 + v11[v1].unk_02 + v12 + param0->unk_18[param1]; - sub_0201D2DC(v4); + LCRNG_SetSeed(v4); for (v2 = 0; v2 < param0->trainerData[param1].class; v2++) { - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); } v4 = (v4 << 8) + v3; @@ -367,11 +367,11 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) sub_02073D80(v7, v12, v11[v1].unk_02, v6, 1, v4, 2, 0); for (v2 = 0; v2 < 4; v2++) { - sub_02077230(v7, v11[v1].unk_06[v2], v2); + Pokemon_SetMoveSlot(v7, v11[v1].unk_06[v2], v2); } sub_02078AEC(v11[v1].unk_0E, v7, param2); - sub_02074B30(v7, 112, &v13); + Pokemon_SetValue(v7, 112, &v13); Party_AddPokemon(param0->parties[param1], v7); } } @@ -389,19 +389,19 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v16 = (v14[v1].unk_04 & 0xfc00) >> 10; v4 = v14[v1].unk_00 + v14[v1].unk_02 + v15 + param0->unk_18[param1]; - sub_0201D2DC(v4); + LCRNG_SetSeed(v4); for (v2 = 0; v2 < param0->trainerData[param1].class; v2++) { - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); } v4 = (v4 << 8) + v3; v6 = v14[v1].unk_00 * 31 / 255; sub_02073D80(v7, v15, v14[v1].unk_02, v6, 1, v4, 2, 0); - sub_02074B30(v7, 6, (u8 *)&v14[v1].unk_06); + Pokemon_SetValue(v7, 6, (u8 *)&v14[v1].unk_06); sub_02078AEC(v14[v1].unk_08, v7, param2); - sub_02074B30(v7, 112, &v16); + Pokemon_SetValue(v7, 112, &v16); Party_AddPokemon(param0->parties[param1], v7); } } @@ -419,24 +419,24 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v19 = (v17[v1].unk_04 & 0xfc00) >> 10; v4 = v17[v1].unk_00 + v17[v1].unk_02 + v18 + param0->unk_18[param1]; - sub_0201D2DC(v4); + LCRNG_SetSeed(v4); for (v2 = 0; v2 < param0->trainerData[param1].class; v2++) { - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); } v4 = (v4 << 8) + v3; v6 = v17[v1].unk_00 * 31 / 255; sub_02073D80(v7, v18, v17[v1].unk_02, v6, 1, v4, 2, 0); - sub_02074B30(v7, 6, (u8 *)&v17[v1].unk_06); + Pokemon_SetValue(v7, 6, (u8 *)&v17[v1].unk_06); for (v2 = 0; v2 < 4; v2++) { - sub_02077230(v7, v17[v1].unk_08[v2], v2); + Pokemon_SetMoveSlot(v7, v17[v1].unk_08[v2], v2); } sub_02078AEC(v17[v1].unk_10, v7, param2); - sub_02074B30(v7, 112, &v19); + Pokemon_SetValue(v7, 112, &v19); Party_AddPokemon(param0->parties[param1], v7); } } @@ -445,5 +445,5 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) Heap_FreeToHeap(v0); Heap_FreeToHeap(v7); - sub_0201D2DC(v5); + LCRNG_SetSeed(v5); } diff --git a/src/unk_020797C8.c b/src/unk_020797C8.c index b802e61e3e..9a9735c7c4 100644 --- a/src/unk_020797C8.c +++ b/src/unk_020797C8.c @@ -1,12 +1,10 @@ #include #include -#include "struct_defs/box_pokemon.h" - #include "message.h" #include "strbuf.h" #include "unk_020244AC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" typedef struct UnkStruct_020797DC_t { @@ -37,7 +35,7 @@ static void sub_020797DC (UnkStruct_020797DC * param0) for (v0 = 0; v0 < 18; v0++) { for (v1 = 0; v1 < (5 * 6); v1++) { - ZeroBoxMonData(&(param0->unk_04[v0][v1])); + BoxPokemon_Init(&(param0->unk_04[v0][v1])); } } @@ -90,14 +88,14 @@ BOOL sub_020798A0 (UnkStruct_020797DC * param0, u32 param1, BoxPokemon * param2) u32 v0; sub_0207896C(param2); - SetBoxShayminForm(param2, 0); + BoxPokemon_SetShayminForm(param2, 0); if (param1 == 0xffffffff) { param1 = param0->unk_00; } for (v0 = 0; v0 < (5 * 6); v0++) { - if (sub_02074570(&(param0->unk_04[param1][v0]), MON_DATA_SPECIES, NULL) == 0) { + if (BoxPokemon_GetValue(&(param0->unk_04[param1][v0]), MON_DATA_SPECIES, NULL) == 0) { param0->unk_04[param1][v0] = *param2; sub_02024804(); return 1; @@ -110,7 +108,7 @@ BOOL sub_020798A0 (UnkStruct_020797DC * param0, u32 param1, BoxPokemon * param2) BOOL sub_02079914 (UnkStruct_020797DC * param0, u32 param1, u32 param2, BoxPokemon * param3) { sub_0207896C(param3); - SetBoxShayminForm(param3, 0); + BoxPokemon_SetShayminForm(param3, 0); if (param1 == 0xffffffff) { param1 = param0->unk_00; @@ -134,7 +132,7 @@ void sub_02079968 (UnkStruct_020797DC * param0, u32 param1, u32 param2) } if ((param2 < (5 * 6)) && (param1 < 18)) { - ZeroBoxMonData(&(param0->unk_04[param1][param2])); + BoxPokemon_Init(&(param0->unk_04[param1][param2])); sub_02024804(); } else { GF_ASSERT(0); @@ -154,7 +152,7 @@ u32 sub_020799A0 (const UnkStruct_020797DC * param0) while (TRUE) { for (v1 = 0; v1 < (5 * 6); v1++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { return v0; } } @@ -184,7 +182,7 @@ BOOL sub_020799F0 (const UnkStruct_020797DC * param0, int * param1, int * param2 while (TRUE) { for ( ; v1 < (5 * 6); v1++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { *param1 = v0; *param2 = v1; return 1; @@ -214,7 +212,7 @@ u32 sub_02079A50 (const UnkStruct_020797DC * param0) for (v0 = 0; v0 < 18; v0++) { for (v1 = 0; v1 < (5 * 6); v1++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) != 0) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) != 0) { v2++; } } @@ -297,7 +295,7 @@ u32 sub_02079B54 (const UnkStruct_020797DC * param0, u32 param1) u32 v1 = 0; for (v0 = 0; v0 < (5 * 6); v0++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { v1++; } } @@ -321,8 +319,8 @@ u32 sub_02079B98 (const UnkStruct_020797DC * param0, u32 param1) u32 v1 = 0; for (v0 = 0; v0 < (5 * 6); v0++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_IS_EGG, NULL) == 0) { v1++; } } @@ -356,7 +354,7 @@ u32 sub_02079C08 (const UnkStruct_020797DC * param0, u32 param1, u32 param2, int param1 = param0->unk_00; } - return sub_02074570((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); + return BoxPokemon_GetValue((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); } void sub_02079C50 (UnkStruct_020797DC * param0, u32 param1, u32 param2, int param3, void * param4) @@ -368,7 +366,7 @@ void sub_02079C50 (UnkStruct_020797DC * param0, u32 param1, u32 param2, int para param1 = param0->unk_00; } - SetBoxMonData((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); + BoxPokemon_SetValue((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); sub_02024804(); } diff --git a/src/unk_02079D40.c b/src/unk_02079D40.c index f8efeea900..983e24eab0 100644 --- a/src/unk_02079D40.c +++ b/src/unk_02079D40.c @@ -1,10 +1,9 @@ #include #include -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" const u8 Unk_020F0780[] = { @@ -559,19 +558,19 @@ u32 sub_02079D40 (const BoxPokemon * param0) u32 v3; u32 v4; - v2 = sub_02073D20((BoxPokemon *)param0); - v0 = sub_02074570((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); - v4 = sub_02074570((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); + v2 = BoxPokemon_EnterDecryptionContext((BoxPokemon *)param0); + v0 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); + v4 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); v3 = sub_02079E44((BoxPokemon *)param0); v1 = sub_02079D8C(v0, v4, v3); - sub_02073D48((BoxPokemon *)param0, v2); + BoxPokemon_ExitDecryptionContext((BoxPokemon *)param0, v2); return v1; } u32 sub_02079D80 (Pokemon * param0) { - return sub_02079D40((const BoxPokemon *)sub_02076B10(param0)); + return sub_02079D40((const BoxPokemon *)Pokemon_GetBoxPokemon(param0)); } u32 sub_02079D8C (u32 param0, u32 param1, u32 param2) @@ -584,7 +583,7 @@ u32 sub_02079D8C (u32 param0, u32 param1, u32 param2) } } - param2 = SanitizeFormId(param0, param2); + param2 = Pokemon_SanitizeFormId(param0, param2); if (param2 != 0) { if (param0 == 386) { @@ -635,11 +634,11 @@ u16 sub_02079E44 (const BoxPokemon * param0) { u32 v0; - v0 = sub_02074570((BoxPokemon *)param0, MON_DATA_SPECIES_EGG, NULL); + v0 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_SPECIES_EGG, NULL); switch (v0) { case 201: - return sub_02076B00((BoxPokemon *)param0); + return BoxPokemon_GetForm((BoxPokemon *)param0); case 386: case 412: case 413: @@ -648,7 +647,7 @@ u16 sub_02079E44 (const BoxPokemon * param0) case 487: case 492: case 479: - return sub_02074570((BoxPokemon *)param0, MON_DATA_FORM, NULL); + return BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_FORM, NULL); default: return 0; } @@ -698,19 +697,19 @@ const u8 sub_02079F84 (const BoxPokemon * param0) u32 v2; u32 v3; - v0 = sub_02073D20((BoxPokemon *)param0); + v0 = BoxPokemon_EnterDecryptionContext((BoxPokemon *)param0); v2 = sub_02079E44(param0); - v1 = sub_02074570((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); - v3 = sub_02074570((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); + v1 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); + v3 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); - sub_02073D48((BoxPokemon *)param0, v0); + BoxPokemon_ExitDecryptionContext((BoxPokemon *)param0, v0); return sub_02079EDC(v1, v2, v3); } const u8 sub_02079FC4 (Pokemon * param0) { - return sub_02079F84((const BoxPokemon *)sub_02076B10(param0)); + return sub_02079F84((const BoxPokemon *)Pokemon_GetBoxPokemon(param0)); } u32 sub_02079FD0 (void) diff --git a/src/unk_0207A274.c b/src/unk_0207A274.c index 748cc8f854..b4311468d2 100644 --- a/src/unk_0207A274.c +++ b/src/unk_0207A274.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_021C0794_decl.h" #include "unk_0202631C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0207A274.h" u32 sub_0207A274 (UnkStruct_021C0794 * param0) diff --git a/src/unk_0207A2A8.c b/src/unk_0207A2A8.c index 88e372bb77..e9cd091fe2 100644 --- a/src/unk_0207A2A8.c +++ b/src/unk_0207A2A8.c @@ -1,14 +1,14 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_02098700_decl.h" #include "struct_defs/struct_0202610C.h" #include "unk_0202602C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A2A8.h" #include "unk_02098700.h" @@ -29,7 +29,7 @@ void sub_0207A2C0 (UnkStruct_02098700 * param0) BOOL sub_0207A2D0 (const UnkStruct_0202610C * param0, Pokemon * param1, const UnkStruct_02098700 * param2) { - u16 v0 = (u16)GetMonData(param1, MON_DATA_SPECIES, NULL); + u16 v0 = (u16)Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); int v1, v2, v3; if (param0 == NULL) { @@ -38,11 +38,11 @@ BOOL sub_0207A2D0 (const UnkStruct_0202610C * param0, Pokemon * param1, const Un v1 = sub_02026074(param0, 2); - if (GetMonData(param1, MON_DATA_161, NULL) > v1) { + if (Pokemon_GetValue(param1, MON_DATA_LEVEL, NULL) > v1) { return 0; } - if (GetMonData(param1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(param1, MON_DATA_IS_EGG, NULL) != 0) { return 0; } @@ -132,10 +132,10 @@ int sub_0207A3AC (const UnkStruct_0202610C * param0, Party * param1, const UnkSt return 5; } - v6[v4] = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); - v7[v4] = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); + v6[v4] = (u16)Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v7[v4] = (u16)Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); - v5 += GetMonData(v0, MON_DATA_161, NULL); + v5 += Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL); } } @@ -218,8 +218,8 @@ int sub_0207A594 (const UnkStruct_0202610C * param0, Party * param1, const UnkSt for (v4 = 0; v4 < v2; v4++) { v0 = Party_GetPokemonBySlotIndex(param1, v4); - v6[v4] = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); - v7[v4] = GetMonData(v0, MON_DATA_161, NULL); + v6[v4] = (u16)Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v7[v4] = Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL); if (sub_0207A2D0(param0, v0, param2) == 0) { v6[v4] = 0; diff --git a/src/unk_0207AE68.c b/src/unk_0207AE68.c index 13a22989f2..c97f7c7161 100644 --- a/src/unk_0207AE68.c +++ b/src/unk_0207AE68.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_02026324_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" @@ -61,7 +61,7 @@ #include "unk_0202CD50.h" #include "unk_020393C8.h" #include "unk_02056720.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207AE68.h" #include "unk_0207C63C.h" @@ -112,8 +112,8 @@ UnkStruct_0207AE68 * sub_0207AE68 (Party * param0, Pokemon * param1, int param2, v0->unk_24 = param0; v0->unk_28 = param1; - v0->unk_60 = GetMonData(param1, MON_DATA_SPECIES, NULL); - v0->unk_86 = GetMonData(param1, MON_DATA_FORM, NULL); + v0->unk_60 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + v0->unk_86 = Pokemon_GetValue(param1, MON_DATA_FORM, NULL); v0->unk_62 = param2; v0->unk_5C = param11; v0->unk_80 = NARC_ctor(NARC_INDEX_POKETOOL__POKE_EDIT__PL_POKE_DATA, param11); @@ -295,7 +295,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) } sub_0200590C(param0->unk_60, param0->unk_84, param0->unk_86); - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); if (param0->unk_7C & 0x2) { param0->unk_65 = sub_0207C584(param0, 917); @@ -404,11 +404,11 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) break; case 11: if ((sub_0200598C() == 0) && (sub_020160F4(param0->unk_44, 0) == 1) && (sub_02007C24(param0->unk_1C[1]) == 0)) { - sub_02074B30(param0->unk_28, 5, (u8 *)¶m0->unk_62); - sub_0207803C(param0->unk_28); - sub_0207418C(param0->unk_28); - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); - sub_0200B538(param0->unk_0C, 1, sub_02076B10(param0->unk_28)); + Pokemon_SetValue(param0->unk_28, 5, (u8 *)¶m0->unk_62); + Pokemon_CalcAbility(param0->unk_28); + Pokemon_CalcLevelAndStats(param0->unk_28); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); + sub_0200B538(param0->unk_0C, 1, Pokemon_GetBoxPokemon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 918); param0->unk_66 = 40; param0->unk_64++; @@ -420,10 +420,10 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) sub_0202736C(param0->unk_48, param0->unk_28); sub_0202CF28(param0->unk_50, (1 + 11)); sub_0202CFEC(param0->unk_50, 22); - sub_02056A48(param0->unk_54, sub_02076B10(param0->unk_28)); + sub_02056A48(param0->unk_54, Pokemon_GetBoxPokemon(param0->unk_28)); - if (GetMonData(param0->unk_28, MON_DATA_77, NULL) == 0) { - sub_02074B30(param0->unk_28, 179, NULL); + if (Pokemon_GetValue(param0->unk_28, MON_DATA_77, NULL) == 0) { + Pokemon_SetValue(param0->unk_28, 179, NULL); } param0->unk_64++; @@ -445,7 +445,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64 = 14; break; default: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, v3); param0->unk_65 = sub_0207C584(param0, 4); param0->unk_66 = 30; @@ -455,14 +455,14 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) } break; case 14: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1193); param0->unk_66 = 30; param0->unk_64++; break; case 16: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 1194); param0->unk_66 = 30; param0->unk_64++; @@ -562,7 +562,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) case 35: switch (sub_02002114(param0->unk_40, param0->unk_5C)) { case 0: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1198); param0->unk_66 = 30; @@ -587,8 +587,8 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64++; break; case 27: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); - sub_0200B630(param0->unk_0C, 1, GetMonData(param0->unk_28, 54 + param0->unk_6E, NULL)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); + sub_0200B630(param0->unk_0C, 1, Pokemon_GetValue(param0->unk_28, 54 + param0->unk_6E, NULL)); param0->unk_65 = sub_0207C584(param0, 1200); param0->unk_66 = 30; param0->unk_64++; @@ -599,12 +599,12 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64++; break; case 31: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1202); param0->unk_66 = 0; - sub_02074B30(param0->unk_28, 62 + param0->unk_6E, ¶m0->unk_66); - sub_02077230(param0->unk_28, param0->unk_6C, param0->unk_6E); + Pokemon_SetValue(param0->unk_28, 62 + param0->unk_6E, ¶m0->unk_66); + Pokemon_SetMoveSlot(param0->unk_28, param0->unk_6C, param0->unk_6E); param0->unk_66 = 30; param0->unk_64 = 37; break; @@ -668,7 +668,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) break; case 43: if ((sub_0200598C() == 0) && (sub_020160F4(param0->unk_44, 0) == 1) && (sub_02007C24(param0->unk_1C[0]) == 0)) { - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 919); param0->unk_66 = 20; param0->unk_64++; @@ -705,54 +705,54 @@ static void sub_0207C028 (UnkStruct_0207AE68 * param0) UnkStruct_0202818C * v3; UnkStruct_0202CA28 v4; - v1 = AllocMonZeroed(param0->unk_5C); - sub_020775EC(param0->unk_28, v1); + v1 = Pokemon_New(param0->unk_5C); + Pokemon_Copy(param0->unk_28, v1); v2 = 292; - sub_02074B30(v1, 5, &v2); + Pokemon_SetValue(v1, 5, &v2); v2 = 4; - sub_02074B30(v1, 155, &v2); + Pokemon_SetValue(v1, 155, &v2); v2 = 0; - sub_02074B30(v1, 6, &v2); - sub_02074B30(v1, 11, &v2); + Pokemon_SetValue(v1, 6, &v2); + Pokemon_SetValue(v1, 11, &v2); for (v0 = 25; v0 < 53 + 1; v0++) { - sub_02074B30(v1, v0, &v2); + Pokemon_SetValue(v1, v0, &v2); } for (v0 = 78; v0 < 109 + 1; v0++) { - sub_02074B30(v1, v0, &v2); + Pokemon_SetValue(v1, v0, &v2); } for (v0 = 123; v0 < 143 + 1; v0++) { - sub_02074B30(v1, v0, &v2); + Pokemon_SetValue(v1, v0, &v2); } - sub_02074B30(v1, 179, NULL); - sub_02074B30(v1, 77, &v2); - sub_02074B30(v1, 160, &v2); + Pokemon_SetValue(v1, 179, NULL); + Pokemon_SetValue(v1, 77, &v2); + Pokemon_SetValue(v1, 160, &v2); v3 = sub_0202818C(param0->unk_5C); - sub_02074B30(v1, 170, v3); + Pokemon_SetValue(v1, 170, v3); Heap_FreeToHeap(v3); - sub_02074B30(v1, 162, &v2); + Pokemon_SetValue(v1, 162, &v2); MI_CpuClearFast(&v4, sizeof(UnkStruct_0202CA28)); - sub_02074B30(v1, 171, (UnkStruct_0202CA28 *)&v4); - sub_0207803C(v1); + Pokemon_SetValue(v1, 171, (UnkStruct_0202CA28 *)&v4); + Pokemon_CalcAbility(v1); - v0 = sub_02075D6C(v1); - sub_02074B30(v1, 111, &v0); + v0 = Pokemon_GetGender(v1); + Pokemon_SetValue(v1, 111, &v0); - sub_0207418C(v1); + Pokemon_CalcLevelAndStats(v1); Party_AddPokemon(param0->unk_24, v1); sub_0202736C(param0->unk_48, v1); sub_0202CF28(param0->unk_50, (1 + 11)); sub_0202CFEC(param0->unk_50, 22); - sub_02056A48(param0->unk_54, sub_02076B10(v1)); + sub_02056A48(param0->unk_54, Pokemon_GetBoxPokemon(v1)); Heap_FreeToHeap(v1); sub_0207D60C(param0->unk_4C, 4, 1, param0->unk_5C); } @@ -762,7 +762,7 @@ static void sub_0207C028 (UnkStruct_0207AE68 * param0) case 18: case 19: v0 = 0; - sub_02074B30(param0->unk_28, 6, &v0); + Pokemon_SetValue(param0->unk_28, 6, &v0); break; } } @@ -952,11 +952,11 @@ static void sub_0207C498 (UnkStruct_0207AE68 * param0) sub_02075EF4(&v0, param0->unk_28, 2); param0->unk_1C[0] = sub_02007C34(param0->unk_18, &v0, 128, 80, 0, 0, NULL, NULL); - v1 = AllocMonZeroed(param0->unk_5C); + v1 = Pokemon_New(param0->unk_5C); - sub_020775EC(param0->unk_28, v1); - sub_02074B30(v1, 5, (u8 *)¶m0->unk_62); - sub_0207418C(v1); + Pokemon_Copy(param0->unk_28, v1); + Pokemon_SetValue(v1, 5, (u8 *)¶m0->unk_62); + Pokemon_CalcLevelAndStats(v1); sub_02075EF4(&v0, v1, 2); Heap_FreeToHeap(v1); diff --git a/src/unk_0207E0B8.c b/src/unk_0207E0B8.c index 63fdebd329..e5b7182644 100644 --- a/src/unk_0207E0B8.c +++ b/src/unk_0207E0B8.c @@ -7,7 +7,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "constdata/const_020F1E88.h" @@ -56,7 +56,7 @@ #include "unk_020393C8.h" #include "unk_0206B9D8.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A2A8.h" #include "item.h" @@ -1055,7 +1055,7 @@ u8 sub_0207EF14 (UnkStruct_0207F248 * param0, u8 param1) } v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param1); - v2 = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); + v2 = (u16)Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); if (v2 == 0) { return 0; @@ -1064,21 +1064,21 @@ u8 sub_0207EF14 (UnkStruct_0207F248 * param0, u8 param1) sub_02081ED8(param0, v0, param1); param0->unk_704[param1].unk_04 = v2; - param0->unk_704[param1].unk_06 = (u16)GetMonData(v0, MON_DATA_163, NULL); - param0->unk_704[param1].unk_08 = (u16)GetMonData(v0, MON_DATA_164, NULL); - param0->unk_704[param1].unk_0A = (u16)GetMonData(v0, MON_DATA_161, NULL); - param0->unk_704[param1].unk_0C = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); - param0->unk_704[param1].unk_12 = (u16)GetMonData(v0, MON_DATA_162, NULL); - param0->unk_704[param1].unk_10 = (u8)GetMonData(v0, MON_DATA_IS_EGG, NULL); - param0->unk_704[param1].unk_11 = (u8)GetMonData(v0, MON_DATA_FORM, NULL); - - if (GetMonData(v0, MON_DATA_176, NULL) == 1) { + param0->unk_704[param1].unk_06 = (u16)Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_704[param1].unk_08 = (u16)Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL); + param0->unk_704[param1].unk_0A = (u16)Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL); + param0->unk_704[param1].unk_0C = (u16)Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); + param0->unk_704[param1].unk_12 = (u16)Pokemon_GetValue(v0, MON_DATA_162, NULL); + param0->unk_704[param1].unk_10 = (u8)Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); + param0->unk_704[param1].unk_11 = (u8)Pokemon_GetValue(v0, MON_DATA_FORM, NULL); + + if (Pokemon_GetValue(v0, MON_DATA_176, NULL) == 1) { param0->unk_704[param1].unk_0E_12 = 0; } else { param0->unk_704[param1].unk_0E_12 = 1; } - param0->unk_704[param1].unk_0E_13 = sub_02075D6C(v0); + param0->unk_704[param1].unk_0E_13 = Pokemon_GetGender(v0); param0->unk_704[param1].unk_29 = 1; param0->unk_704[param1].unk_0E_0 = (u8)sub_0208E9F0(v0); @@ -1104,7 +1104,7 @@ static void sub_0207F094 (UnkStruct_0207F248 * param0, Pokemon * param1, u8 para v0 = sub_0207F134(param1, param0->unk_5A4->unk_2A); for (v1 = 0; v1 < 4; v1++) { - if (GetMonData(param1, MON_DATA_MOVE1 + v1, NULL) == 0) { + if (Pokemon_GetValue(param1, MON_DATA_MOVE1 + v1, NULL) == 0) { break; } } @@ -1122,34 +1122,34 @@ static u32 sub_0207F134 (Pokemon * param0, u8 param1) switch (param1) { case 0: - v0 = GetMonData(param0, MON_DATA_123, NULL); - v0 += GetMonData(param0, MON_DATA_124, NULL); - v0 += GetMonData(param0, MON_DATA_125, NULL); - v0 += GetMonData(param0, MON_DATA_126, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_123, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_124, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_125, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_126, NULL); break; case 1: - v0 = GetMonData(param0, MON_DATA_127, NULL); - v0 += GetMonData(param0, MON_DATA_128, NULL); - v0 += GetMonData(param0, MON_DATA_129, NULL); - v0 += GetMonData(param0, MON_DATA_130, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_127, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_128, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_129, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_130, NULL); break; case 2: - v0 = GetMonData(param0, MON_DATA_131, NULL); - v0 += GetMonData(param0, MON_DATA_132, NULL); - v0 += GetMonData(param0, MON_DATA_133, NULL); - v0 += GetMonData(param0, MON_DATA_134, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_131, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_132, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_133, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_134, NULL); break; case 3: - v0 = GetMonData(param0, MON_DATA_135, NULL); - v0 += GetMonData(param0, MON_DATA_136, NULL); - v0 += GetMonData(param0, MON_DATA_137, NULL); - v0 += GetMonData(param0, MON_DATA_138, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_135, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_136, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_137, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_138, NULL); break; case 4: - v0 = GetMonData(param0, MON_DATA_139, NULL); - v0 += GetMonData(param0, MON_DATA_140, NULL); - v0 += GetMonData(param0, MON_DATA_141, NULL); - v0 += GetMonData(param0, MON_DATA_142, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_139, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_140, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_141, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_142, NULL); } return v0; @@ -1376,7 +1376,7 @@ void sub_0207F8F8 (UnkStruct_0207F248 * param0, u8 param1) v1 = 0; } - if (GetMonData(v0, MON_DATA_163, 0) == 0) { + if (Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, 0) == 0) { v1 += 2; } else if (sub_0207F984(param0, param1) == 1) { v1 += 1; @@ -1752,7 +1752,7 @@ static u8 sub_020800B4 (UnkStruct_0207F248 * param0, u8 * param1) if (sub_0206C0D0(param0->unk_5A4->unk_1C) == 0) { if (param0->unk_704[param0->unk_B11].unk_10 == 0) { for (v3 = 0; v3 < 4; v3++) { - v1 = (u16)GetMonData(v0, MON_DATA_MOVE1 + v3, NULL); + v1 = (u16)Pokemon_GetValue(v0, MON_DATA_MOVE1 + v3, NULL); if (v1 == 0) { break; @@ -2464,7 +2464,7 @@ static int sub_02080BF4 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 64); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B60C(param0->unk_6A0, 1, param0->unk_B14[2], 3, 0, 1); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -2527,7 +2527,7 @@ static BOOL sub_02080F3C (UnkStruct_0207F248 * param0, u8 param1, s8 param2) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param1); v1 = param0->unk_704[param1].unk_06; - sub_02074B30(v0, 163, &v1); + Pokemon_SetValue(v0, 163, &v1); return 1; } @@ -2584,7 +2584,7 @@ static int sub_0208107C (UnkStruct_0207F248 * param0) v0 = Item_Load(param0->unk_5A4->unk_24, 0, 12); - if ((param0->unk_5A4->unk_24 == 466) && (sub_02077B14(Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11)) == 1)) { + if ((param0->unk_5A4->unk_24 == 466) && (Pokemon_CanShayminSkyForm(Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11)) == 1)) { param0->unk_5A4->unk_38 = 1; Heap_FreeToHeap(v0); sub_020819B4(param0); @@ -2654,9 +2654,9 @@ static int sub_02081224 (UnkStruct_0207F248 * param0) v4 = param0->unk_5A4->unk_1C; if (param0->unk_5A4->unk_24 == 112) { - if (GetMonData(v0, MON_DATA_SPECIES, NULL) != 487) { + if (Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL) != 487) { MessageLoader_GetStrbuf(param0->unk_69C, 203, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B744(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); v2 = 11; @@ -2681,13 +2681,13 @@ static int sub_02081224 (UnkStruct_0207F248 * param0) v2 = sub_02081408(param0, v0, &v3); MessageLoader_GetStrbuf(param0->unk_69C, 118, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); break; case 1: MessageLoader_GetStrbuf(param0->unk_69C, 78, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B744(param0->unk_6A0, 1, param0->unk_704[param0->unk_B11].unk_0C); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); v2 = 9; @@ -2714,11 +2714,11 @@ static int sub_02081408 (UnkStruct_0207F248 * param0, Pokemon * param1, int * pa v1 = param0->unk_5A4->unk_1C; sub_0207D60C(param0->unk_5A4->unk_04, param0->unk_5A4->unk_24, 1, 12); - sub_02074B30(param1, 6, &v0); - sub_02077928(param1); + Pokemon_SetValue(param1, 6, &v0); + Pokemon_SetArceusForm(param1); if ((v1 == NULL) || (v1->unk_1C->unk_00 < 573) || (v1->unk_1C->unk_00 > 583)) { - *param2 = sub_02077A00(param1); + *param2 = Pokemon_SetGiratinaForm(param1); } else { *param2 = -1; } @@ -2736,9 +2736,9 @@ static int sub_02081408 (UnkStruct_0207F248 * param0, Pokemon * param1, int * pa static void sub_020814A8 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 param2, u32 param3) { sub_0207D570(param0->unk_5A4->unk_04, (u16)param2, 1, 12); - sub_02074B30(param1, 6, ¶m3); - sub_02077928(param1); - sub_02077A00(param1); + Pokemon_SetValue(param1, 6, ¶m3); + Pokemon_SetArceusForm(param1); + Pokemon_SetGiratinaForm(param1); param0->unk_704[param0->unk_B11].unk_0C = (u16)param3; sub_02083040(param0, param0->unk_B11, param0->unk_704[param0->unk_B11].unk_0C); } @@ -2875,7 +2875,7 @@ static int sub_02081760 (UnkStruct_0207F248 * param0) if (v3 == 0) { MessageLoader_GetStrbuf(param0->unk_69C, 118, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); } else { diff --git a/src/unk_020819DC.c b/src/unk_020819DC.c index 1f0166e34f..88e8717bf2 100644 --- a/src/unk_020819DC.c +++ b/src/unk_020819DC.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0201D738.h" #include "struct_defs/struct_0205AA50.h" @@ -24,7 +24,7 @@ #include "unk_0201D670.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207E0B8.h" #include "unk_020819DC.h" @@ -249,7 +249,7 @@ void sub_02081E08 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 37); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); } @@ -275,7 +275,7 @@ void sub_02081ED8 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 param2) v0 = MessageLoader_GetNewStrbuf(param0->unk_69C, Unk_020F1EA0[param2][0]); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(param1)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(param1)); sub_0200C388(param0->unk_6A0, param0->unk_704[param2].unk_00, v0); Strbuf_Free(v0); } @@ -749,12 +749,12 @@ void sub_020829DC (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - v3[0] = (u16)GetMonData(v0, MON_DATA_164, NULL); - v3[1] = (u16)GetMonData(v0, MON_DATA_165, NULL); - v3[2] = (u16)GetMonData(v0, MON_DATA_166, NULL); - v3[3] = (u16)GetMonData(v0, MON_DATA_168, NULL); - v3[4] = (u16)GetMonData(v0, MON_DATA_169, NULL); - v3[5] = (u16)GetMonData(v0, MON_DATA_167, NULL); + v3[0] = (u16)Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL); + v3[1] = (u16)Pokemon_GetValue(v0, MON_DATA_ATK, NULL); + v3[2] = (u16)Pokemon_GetValue(v0, MON_DATA_DEF, NULL); + v3[3] = (u16)Pokemon_GetValue(v0, MON_DATA_SP_ATK, NULL); + v3[4] = (u16)Pokemon_GetValue(v0, MON_DATA_SP_DEF, NULL); + v3[5] = (u16)Pokemon_GetValue(v0, MON_DATA_SPEED, NULL); sub_0201A7E8(param0->unk_00, ¶m0->unk_254[0], 0, 1, 1, 14, 12, 0, 576); sub_0200DC48(¶m0->unk_254[0], 1, 1, 14); diff --git a/src/unk_02082C2C.c b/src/unk_02082C2C.c index d459c0f64d..b59dbb705f 100644 --- a/src/unk_02082C2C.c +++ b/src/unk_02082C2C.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0200C738.h" #include "struct_defs/struct_0207F248.h" @@ -22,7 +22,7 @@ #include "unk_0201E010.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "item.h" @@ -84,7 +84,7 @@ void sub_02082CEC (UnkStruct_0207F248 * param0, u8 param1, u16 param2, u16 param sub_0200D9B4(param0->unk_5A8, param0->unk_5AC, param4, sub_02079D80(v0), 0, 4 + param1); - v2 = GetMonData(v0, MON_DATA_IS_EGG, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); v1.unk_00 = 4 + param1; v1.unk_04 = param2; @@ -113,8 +113,8 @@ void sub_02082DA8 (UnkStruct_0207F248 * param0, u8 param1) BOOL v7; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param1); - v2 = GetMonData(v0, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v0, MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); v1 = NARC_ctor(NARC_INDEX_POKETOOL__ICONGRA__PL_POKE_ICON, 12); v4 = NNS_G2dGetImageLocation(sub_02021F98(param0->unk_704[param1].unk_24), NNS_G2D_VRAM_TYPE_2DMAIN); v5 = sub_0200723C(v1, sub_02079D80(v0), 0, 12, 1); diff --git a/src/unk_02083370.c b/src/unk_02083370.c index 7f1a79bc14..a3757fd464 100644 --- a/src/unk_02083370.c +++ b/src/unk_02083370.c @@ -3,7 +3,7 @@ #include "data_021BF67C.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0200D0F4.h" #include "struct_defs/struct_0203CDB0.h" @@ -25,7 +25,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "unk_0207070C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_0207E0B8.h" @@ -177,7 +177,7 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) if (param0->unk_704[param0->unk_B11].unk_0C == 0) { v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); MessageLoader_GetStrbuf(param0->unk_69C, 81, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); } else if (sub_0207D570(param0->unk_5A4->unk_04, param0->unk_704[param0->unk_B11].unk_0C, 1, 12) == 1) { u32 v4; @@ -185,11 +185,11 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v4 = 0; - sub_02074B30(v0, 6, &v4); - sub_02077928(v0); + Pokemon_SetValue(v0, 6, &v4); + Pokemon_SetArceusForm(v0); if ((v3 == NULL) || (v3->unk_1C->unk_00 < 573) || (v3->unk_1C->unk_00 > 583)) { - v1 = sub_02077A00(v0); + v1 = Pokemon_SetGiratinaForm(v0); if ((param0->unk_704[param0->unk_B11].unk_0C == 112) && (v1 == 0)) { v2 = 18; @@ -197,7 +197,7 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) } MessageLoader_GetStrbuf(param0->unk_69C, 82, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_704[param0->unk_B11].unk_0C); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); @@ -347,9 +347,9 @@ static int sub_020838F4 (void * param0) v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); v2 = 0; - sub_02074B30(v1, 6, &v2); - sub_02077928(v1); - sub_02077A00(v1); + Pokemon_SetValue(v1, 6, &v2); + Pokemon_SetArceusForm(v1); + Pokemon_SetGiratinaForm(v1); v0->unk_704[v0->unk_B11].unk_0C = 0; @@ -845,7 +845,7 @@ int sub_02084780 (UnkStruct_0207F248 * param0) { Pokemon * v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - if (GetMonData(v0, MON_DATA_162, NULL) == 0) { + if (Pokemon_GetValue(v0, MON_DATA_162, NULL) == 0) { MessageLoader_GetStrbuf(param0->unk_69C, 129, param0->unk_6A4); sub_02021CAC(param0->unk_5B0[22 + param0->unk_B11], 1); } else { diff --git a/src/unk_02084B70.c b/src/unk_02084B70.c index 318e8eaace..16ad3ac291 100644 --- a/src/unk_02084B70.c +++ b/src/unk_02084B70.c @@ -4,7 +4,7 @@ #include "data_021BF67C.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0.h" #include "struct_defs/struct_0207F248.h" @@ -21,7 +21,7 @@ #include "unk_0201D670.h" #include "strbuf.h" #include "map_header.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -225,7 +225,7 @@ static void sub_02084E58 (UnkStruct_0207F248 * param0, u16 param1, u32 param2) Strbuf* v1; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); switch (sub_02084B70(param1)) { case 4: @@ -442,13 +442,13 @@ static int sub_02085424 (void * param0) v0 = (UnkStruct_0207F248 *)param0; v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v2[0] = GetMonData(v1, MON_DATA_HP_EV, NULL); - v2[1] = GetMonData(v1, MON_DATA_ATK_EV, NULL); - v2[2] = GetMonData(v1, MON_DATA_DEF_EV, NULL); - v2[3] = GetMonData(v1, MON_DATA_SPEED_EV, NULL); - v2[4] = GetMonData(v1, MON_DATA_SPATK_EV, NULL); - v2[5] = GetMonData(v1, MON_DATA_SPDEF_EV, NULL); - v2[6] = GetMonData(v1, MON_DATA_FRIENDSHIP, NULL); + v2[0] = Pokemon_GetValue(v1, MON_DATA_HP_EV, NULL); + v2[1] = Pokemon_GetValue(v1, MON_DATA_ATK_EV, NULL); + v2[2] = Pokemon_GetValue(v1, MON_DATA_DEF_EV, NULL); + v2[3] = Pokemon_GetValue(v1, MON_DATA_SPEED_EV, NULL); + v2[4] = Pokemon_GetValue(v1, MON_DATA_SPATK_EV, NULL); + v2[5] = Pokemon_GetValue(v1, MON_DATA_SPDEF_EV, NULL); + v2[6] = Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL); sub_02096F14(v0->unk_5A4->unk_00, v0->unk_5A4->unk_24, v0->unk_B11, 0, sub_02086930(v0), 12); sub_0207EF14(v0, v0->unk_B11); @@ -456,8 +456,8 @@ static int sub_02085424 (void * param0) sub_020822BC(v0, v0->unk_B11); sub_02083014(v0, v0->unk_B11, v0->unk_704[v0->unk_B11].unk_0E_0); - if ((v2[0] != GetMonData(v1, MON_DATA_HP_EV, NULL)) || (v2[1] != GetMonData(v1, MON_DATA_ATK_EV, NULL)) || (v2[2] != GetMonData(v1, MON_DATA_DEF_EV, NULL)) || (v2[3] != GetMonData(v1, MON_DATA_SPEED_EV, NULL)) || (v2[4] != GetMonData(v1, MON_DATA_SPATK_EV, NULL)) || (v2[5] != GetMonData(v1, MON_DATA_SPDEF_EV, NULL))) { - if (v2[6] != GetMonData(v1, MON_DATA_FRIENDSHIP, NULL)) { + if ((v2[0] != Pokemon_GetValue(v1, MON_DATA_HP_EV, NULL)) || (v2[1] != Pokemon_GetValue(v1, MON_DATA_ATK_EV, NULL)) || (v2[2] != Pokemon_GetValue(v1, MON_DATA_DEF_EV, NULL)) || (v2[3] != Pokemon_GetValue(v1, MON_DATA_SPEED_EV, NULL)) || (v2[4] != Pokemon_GetValue(v1, MON_DATA_SPATK_EV, NULL)) || (v2[5] != Pokemon_GetValue(v1, MON_DATA_SPDEF_EV, NULL))) { + if (v2[6] != Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL)) { sub_02084E58(v0, v0->unk_5A4->unk_24, 0); } else { sub_02084E58(v0, v0->unk_5A4->unk_24, 1); @@ -485,7 +485,7 @@ static int sub_020855C4 (void * param0) sub_02096F14(v0->unk_5A4->unk_00, v0->unk_5A4->unk_24, v0->unk_B11, 0, sub_02086930(v0), 12); v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v3 = GetMonData(v1, MON_DATA_163, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL); if (v0->unk_704[v0->unk_B11].unk_06 == 0) { v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 70); @@ -495,7 +495,7 @@ static int sub_020855C4 (void * param0) v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 64); } - sub_0200B5CC(v0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(v0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200B60C(v0->unk_6A0, 1, v3 - v0->unk_704[v0->unk_B11].unk_06, 3, 0, 1); sub_0200C388(v0->unk_6A0, v0->unk_6A4, v2); Strbuf_Free(v2); @@ -522,7 +522,7 @@ static int sub_02085704 (void * param0) u32 v2; v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v2 = GetMonData(v1, MON_DATA_163, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL); if (v0->unk_704[v0->unk_B11].unk_06 != v2) { v0->unk_704[v0->unk_B11].unk_06++; @@ -596,10 +596,10 @@ int sub_02085804 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); sub_02096954(v0, param0->unk_5A4->unk_24, 0, sub_02086930(param0), 12); - v2 = GetMonData(v0, MON_DATA_163, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 70); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -615,7 +615,7 @@ int sub_02085804 (UnkStruct_0207F248 * param0) break; case 2: v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - v2 = GetMonData(v0, MON_DATA_163, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); param0->unk_704[param0->unk_B11].unk_06++; @@ -667,22 +667,22 @@ static int sub_02085A70 (void * param0) v0 = (UnkStruct_0207F248 *)param0; v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v0->unk_B14[0] = (u16)GetMonData(v1, MON_DATA_164, NULL); - v0->unk_B14[1] = (u16)GetMonData(v1, MON_DATA_165, NULL); - v0->unk_B14[2] = (u16)GetMonData(v1, MON_DATA_166, NULL); - v0->unk_B14[3] = (u16)GetMonData(v1, MON_DATA_168, NULL); - v0->unk_B14[4] = (u16)GetMonData(v1, MON_DATA_169, NULL); - v0->unk_B14[5] = (u16)GetMonData(v1, MON_DATA_167, NULL); + v0->unk_B14[0] = (u16)Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL); + v0->unk_B14[1] = (u16)Pokemon_GetValue(v1, MON_DATA_ATK, NULL); + v0->unk_B14[2] = (u16)Pokemon_GetValue(v1, MON_DATA_DEF, NULL); + v0->unk_B14[3] = (u16)Pokemon_GetValue(v1, MON_DATA_SP_ATK, NULL); + v0->unk_B14[4] = (u16)Pokemon_GetValue(v1, MON_DATA_SP_DEF, NULL); + v0->unk_B14[5] = (u16)Pokemon_GetValue(v1, MON_DATA_SPEED, NULL); sub_02096F14(v0->unk_5A4->unk_00, v0->unk_5A4->unk_24, v0->unk_B11, 0, sub_02086930(v0), 12); - v0->unk_704[v0->unk_B11].unk_0A = GetMonData(v1, MON_DATA_161, NULL); - v0->unk_704[v0->unk_B11].unk_06 = GetMonData(v1, MON_DATA_163, NULL); - v0->unk_704[v0->unk_B11].unk_08 = GetMonData(v1, MON_DATA_164, NULL); + v0->unk_704[v0->unk_B11].unk_0A = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); + v0->unk_704[v0->unk_B11].unk_06 = Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL); + v0->unk_704[v0->unk_B11].unk_08 = Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 193); - sub_0200B5CC(v0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(v0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200B60C(v0->unk_6A0, 1, v0->unk_704[v0->unk_B11].unk_0A, 3, 0, 1); sub_0200C388(v0->unk_6A0, v0->unk_6A4, v2); Strbuf_Free(v2); @@ -750,7 +750,7 @@ static int sub_02085C50 (void * param0) v0->unk_B13 = 6; break; case 0xffff: - sub_0200B5CC(v0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(v0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200B630(v0->unk_6A0, 1, v0->unk_5A4->unk_26); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 52); @@ -767,7 +767,7 @@ static int sub_02085C50 (void * param0) case 0xfffe: break; default: - sub_0200B5CC(v0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(v0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200B630(v0->unk_6A0, 1, v0->unk_5A4->unk_26); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 194); @@ -833,14 +833,14 @@ int sub_02085EF4 (UnkStruct_0207F248 * param0) param0->unk_B13 = 3; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); if (param0->unk_5A4->unk_28 == 4) { sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); return sub_02086008(param0); } - sub_0200B630(param0->unk_6A0, 1, GetMonData(v0, 54 + param0->unk_5A4->unk_28, NULL)); + sub_0200B630(param0->unk_6A0, 1, Pokemon_GetValue(v0, 54 + param0->unk_5A4->unk_28, NULL)); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 60); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -932,7 +932,7 @@ u8 sub_02086104 (UnkStruct_0207F248 * param0, Pokemon * param1) u8 v1; for (v1 = 0; v1 < 4; v1++) { - v0 = (u16)GetMonData(param1, MON_DATA_MOVE1 + v1, NULL); + v0 = (u16)Pokemon_GetValue(param1, MON_DATA_MOVE1 + v1, NULL); if (v0 == param0->unk_5A4->unk_26) { return 0xfd; @@ -943,7 +943,7 @@ u8 sub_02086104 (UnkStruct_0207F248 * param0, Pokemon * param1) } } - if (sub_02077FB4(param1, Item_TMHMNumber(param0->unk_5A4->unk_24)) == 0) { + if (Pokemon_CanLearnTM(param1, Item_TMHMNumber(param0->unk_5A4->unk_24)) == 0) { return 0xff; } @@ -963,7 +963,7 @@ int sub_0208615C (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v2 = sub_02086104(param0, v0); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); switch (v2) { @@ -1017,14 +1017,14 @@ int sub_020862F8 (UnkStruct_0207F248 * param0) Strbuf* v1; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); if (param0->unk_5A4->unk_28 == 4) { sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); return sub_0208648C(param0); } - sub_0200B630(param0->unk_6A0, 1, GetMonData(v0, 54 + param0->unk_5A4->unk_28, NULL)); + sub_0200B630(param0->unk_6A0, 1, Pokemon_GetValue(v0, 54 + param0->unk_5A4->unk_28, NULL)); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 60); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -1137,13 +1137,13 @@ static void sub_02086590 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 par u32 v0; v0 = param0->unk_5A4->unk_26; - sub_02074B30(param1, 54 + param2, &v0); + Pokemon_SetValue(param1, 54 + param2, &v0); v0 = 0; - sub_02074B30(param1, 62 + param2, &v0); + Pokemon_SetValue(param1, 62 + param2, &v0); v0 = MoveTable_CalcMaxPP(param0->unk_5A4->unk_26, 0); - sub_02074B30(param1, 58 + param2, &v0); + Pokemon_SetValue(param1, 58 + param2, &v0); if (param0->unk_5A4->unk_24 != 0) { if (Item_IsHMMove(param0->unk_5A4->unk_26) == 0) { @@ -1161,7 +1161,7 @@ static u8 sub_02086614 (UnkStruct_0207F248 * param0, u8 param1) u16 v2; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - v2 = (u16)GetMonData(v0, MON_DATA_MOVE1 + param1, NULL); + v2 = (u16)Pokemon_GetValue(v0, MON_DATA_MOVE1 + param1, NULL); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 162 + param1); sub_0200B630(param0->unk_6A0, 0, v2); @@ -1235,7 +1235,7 @@ int sub_02086774 (UnkStruct_0207F248 * param0) if (sub_02096F14(param0->unk_5A4->unk_00, param0->unk_5A4->unk_24, param0->unk_B11, (u8)v0, sub_02086930(param0), 12) == 1) { Pokemon * v1 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_02084E58(param0, param0->unk_5A4->unk_24, GetMonData(v1, MON_DATA_MOVE1 + v0, NULL)); + sub_02084E58(param0, param0->unk_5A4->unk_24, Pokemon_GetValue(v1, MON_DATA_MOVE1 + v0, NULL)); sub_0207D60C(param0->unk_5A4->unk_04, param0->unk_5A4->unk_24, 1, 12); sub_02005748(1516); } else { diff --git a/src/unk_0208694C.c b/src/unk_0208694C.c index 4e30c73ad0..cfabc38c30 100644 --- a/src/unk_0208694C.c +++ b/src/unk_0208694C.c @@ -14,7 +14,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_02087A10_decl.h" #include "constdata/const_020F2DAC.h" @@ -63,7 +63,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02079D40.h" #include "unk_0208694C.h" @@ -1090,9 +1090,9 @@ static void sub_02086E6C (UnkStruct_02087A10 * param0, UnkStruct_0208737C * para Strbuf* v0; if (param0->unk_04 == 0) { - v0 = MessageLoader_GetNewStrbuf(param0->unk_170, 0 + sub_0201D2E8() % 18); + v0 = MessageLoader_GetNewStrbuf(param0->unk_170, 0 + LCRNG_Next() % 18); } else if (param0->unk_04 == 1) { - v0 = MessageLoader_GetNewStrbuf(param0->unk_170, 18 + sub_0201D2E8() % 18); + v0 = MessageLoader_GetNewStrbuf(param0->unk_170, 18 + LCRNG_Next() % 18); } Strbuf_Copy(param1->unk_18, v0); @@ -1101,7 +1101,7 @@ static void sub_02086E6C (UnkStruct_02087A10 * param0, UnkStruct_0208737C * para } else if (param0->unk_00 == 3) { Strbuf* v1; - v1 = MessageLoader_GetNewStrbuf(param0->unk_170, 88 + (sub_0201D2E8() % 2)); + v1 = MessageLoader_GetNewStrbuf(param0->unk_170, 88 + (LCRNG_Next() % 2)); Strbuf_Copy(param1->unk_18, v1); Strbuf_Free(v1); @@ -1141,7 +1141,7 @@ static int sub_02086F3C (UnkStruct_020067E8 * param0, int * param1) u16 v3[10 + 1]; Pokemon * v4; - v4 = AllocMonZeroed(18); + v4 = Pokemon_New(18); sub_02073D80(v4, v0->unk_04, 5, 10, 10, 10, 10, 10); Heap_FreeToHeap(v4); } @@ -1419,9 +1419,9 @@ static void sub_0208737C (UnkStruct_02087A10 * param0, UnkStruct_020067E8 * para if (param0->unk_00 == 1) { Pokemon * v1; - v1 = AllocMonZeroed(18); + v1 = Pokemon_New(18); sub_02073D80(v1, param0->unk_04, 5, 10, 10, 10, 10, 10); - sub_0200B538(param0->unk_168, 0, sub_02076B10(v1)); + sub_0200B538(param0->unk_168, 0, Pokemon_GetBoxPokemon(v1)); Heap_FreeToHeap(v1); } @@ -1485,10 +1485,10 @@ static void sub_02087544 (UnkStruct_02087A10 * param0, UnkStruct_020067E8 * para } if ((param0->unk_158 == 0) || sub_02086F14(param0->unk_D8)) { - Pokemon * v4 = AllocMonZeroed(18); + Pokemon * v4 = Pokemon_New(18); sub_02073D80(v4, param0->unk_04, 1, 0, 0, 0, 0, 0); - sub_0200B538(param0->unk_168, 0, sub_02076B10(v4)); + sub_0200B538(param0->unk_168, 0, Pokemon_GetBoxPokemon(v4)); Heap_FreeToHeap(v4); } else { param0->unk_D8[param0->unk_158] = 0xffff; diff --git a/src/unk_0208C324.c b/src/unk_0208C324.c index 261869dc7c..5181b18092 100644 --- a/src/unk_0208C324.c +++ b/src/unk_0208C324.c @@ -7,8 +7,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "constdata/const_020F410C.h" @@ -49,7 +48,7 @@ #include "unk_020393C8.h" #include "unk_020507CC.h" #include "unk_0206A8DC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -887,8 +886,8 @@ static int sub_0208CF78 (UnkStruct_0208D7BC * param0) if (param0->unk_24C->unk_11 == 2) { v0 = sub_0208DD48(param0); - v1 = AllocMonZeroed(19); - sub_020774C8(v0, v1); + v1 = Pokemon_New(19); + Pokemon_FromBoxPokemon(v0, v1); } else { v1 = sub_0208DD48(param0); } @@ -897,41 +896,41 @@ static int sub_0208CF78 (UnkStruct_0208D7BC * param0) param0->unk_6A6 = 0; v2 = param0->unk_250.unk_45; - param0->unk_250.unk_45 = (u8)GetMonData(v1, MON_DATA_COOL, NULL); + param0->unk_250.unk_45 = (u8)Pokemon_GetValue(v1, MON_DATA_COOL, NULL); if (v2 != param0->unk_250.unk_45) { param0->unk_6A6 |= 1; } v2 = param0->unk_250.unk_46; - param0->unk_250.unk_46 = (u8)GetMonData(v1, MON_DATA_BEAUTY, NULL); + param0->unk_250.unk_46 = (u8)Pokemon_GetValue(v1, MON_DATA_BEAUTY, NULL); if (v2 != param0->unk_250.unk_46) { param0->unk_6A6 |= 2; } v2 = param0->unk_250.unk_47; - param0->unk_250.unk_47 = (u8)GetMonData(v1, MON_DATA_CUTE, NULL); + param0->unk_250.unk_47 = (u8)Pokemon_GetValue(v1, MON_DATA_CUTE, NULL); if (v2 != param0->unk_250.unk_47) { param0->unk_6A6 |= 4; } v2 = param0->unk_250.unk_48; - param0->unk_250.unk_48 = (u8)GetMonData(v1, MON_DATA_SMART, NULL); + param0->unk_250.unk_48 = (u8)Pokemon_GetValue(v1, MON_DATA_SMART, NULL); if (v2 != param0->unk_250.unk_48) { param0->unk_6A6 |= 8; } v2 = param0->unk_250.unk_49; - param0->unk_250.unk_49 = (u8)GetMonData(v1, MON_DATA_TOUGH, NULL); + param0->unk_250.unk_49 = (u8)Pokemon_GetValue(v1, MON_DATA_TOUGH, NULL); if (v2 != param0->unk_250.unk_49) { param0->unk_6A6 |= 16; } - param0->unk_250.unk_4A = (u8)GetMonData(v1, MON_DATA_SHEEN, NULL); + param0->unk_250.unk_4A = (u8)Pokemon_GetValue(v1, MON_DATA_SHEEN, NULL); if (param0->unk_24C->unk_11 == 2) { Heap_FreeToHeap(v1); @@ -1012,9 +1011,9 @@ static void sub_0208D1A4 (UnkStruct_0208D7BC * param0) static void sub_0208D1D4 (UnkStruct_0208D7BC * param0, BoxPokemon * param1, UnkStruct_0208D1D4 * param2) { - Pokemon * v0 = AllocMonZeroed(19); + Pokemon * v0 = Pokemon_New(19); - sub_020774C8(param1, v0); + Pokemon_FromBoxPokemon(param1, v0); sub_0208D200(param0, v0, param2); Heap_FreeToHeap(v0); } @@ -1026,11 +1025,11 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru u8 v2; BOOL v3; - v3 = sub_02073C88(param1); + v3 = Pokemon_EnterDecryptionContext(param1); - param2->unk_0C = (u16)GetMonData(param1, MON_DATA_SPECIES, NULL); + param2->unk_0C = (u16)Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); - v0 = sub_02076B10(param1); + v0 = Pokemon_GetBoxPokemon(param1); MessageLoader_GetStrbuf(param0->unk_688, 11, param0->unk_694); sub_0200B538(param0->unk_690, 0, v0); @@ -1044,65 +1043,65 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru sub_0200B5EC(param0->unk_690, 0, v0); sub_0200C388(param0->unk_690, param0->unk_250.unk_08, param0->unk_694); - param2->unk_0E = (u16)GetMonData(param1, MON_DATA_HELD_ITEM, NULL); - param2->unk_12_0 = (u8)GetMonData(param1, MON_DATA_161, NULL); - param2->unk_50_28 = GetMonData(param1, MON_DATA_IS_EGG, NULL); + param2->unk_0E = (u16)Pokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); + param2->unk_12_0 = (u8)Pokemon_GetValue(param1, MON_DATA_LEVEL, NULL); + param2->unk_50_28 = Pokemon_GetValue(param1, MON_DATA_IS_EGG, NULL); - if ((GetMonData(param1, MON_DATA_176, NULL) == 1) && (param2->unk_50_28 == 0)) { + if ((Pokemon_GetValue(param1, MON_DATA_176, NULL) == 1) && (param2->unk_50_28 == 0)) { param2->unk_12_7 = 0; } else { param2->unk_12_7 = 1; } - param2->unk_13_0 = sub_02075D6C(param1); - param2->unk_13_2 = (u8)GetMonData(param1, MON_DATA_POKEBALL, NULL); - param2->unk_10 = (u8)GetMonData(param1, MON_DATA_177, NULL); - param2->unk_11 = (u8)GetMonData(param1, MON_DATA_178, NULL); - param2->unk_14 = GetMonData(param1, MON_DATA_OT_ID, NULL); - param2->unk_18 = GetMonData(param1, MON_DATA_EXP, NULL); - param2->unk_44 = (u8)GetMonData(param1, MON_DATA_OT_GENDER, NULL); - param2->unk_1C = sub_02075AD0(param2->unk_0C, param2->unk_12_0); + param2->unk_13_0 = Pokemon_GetGender(param1); + param2->unk_13_2 = (u8)Pokemon_GetValue(param1, MON_DATA_POKEBALL, NULL); + param2->unk_10 = (u8)Pokemon_GetValue(param1, MON_DATA_177, NULL); + param2->unk_11 = (u8)Pokemon_GetValue(param1, MON_DATA_178, NULL); + param2->unk_14 = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); + param2->unk_18 = Pokemon_GetValue(param1, MON_DATA_EXP, NULL); + param2->unk_44 = (u8)Pokemon_GetValue(param1, MON_DATA_OT_GENDER, NULL); + param2->unk_1C = Pokemon_GetSpeciesBaseExpAt(param2->unk_0C, param2->unk_12_0); if (param2->unk_12_0 == 100) { param2->unk_20 = param2->unk_1C; } else { - param2->unk_20 = sub_02075AD0(param2->unk_0C, param2->unk_12_0 + 1); + param2->unk_20 = Pokemon_GetSpeciesBaseExpAt(param2->unk_0C, param2->unk_12_0 + 1); } - param2->unk_24 = (u16)GetMonData(param1, MON_DATA_163, NULL); - param2->unk_26 = (u16)GetMonData(param1, MON_DATA_164, NULL); - param2->unk_28 = (u16)GetMonData(param1, MON_DATA_165, NULL); - param2->unk_2A = (u16)GetMonData(param1, MON_DATA_166, NULL); - param2->unk_2C = (u16)GetMonData(param1, MON_DATA_168, NULL); - param2->unk_2E = (u16)GetMonData(param1, MON_DATA_169, NULL); - param2->unk_30 = (u16)GetMonData(param1, MON_DATA_167, NULL); - param2->unk_32 = (u8)GetMonData(param1, MON_DATA_10, NULL); - param2->unk_33 = sub_02075BCC(param1); + param2->unk_24 = (u16)Pokemon_GetValue(param1, MON_DATA_CURRENT_HP, NULL); + param2->unk_26 = (u16)Pokemon_GetValue(param1, MON_DATA_MAX_HP, NULL); + param2->unk_28 = (u16)Pokemon_GetValue(param1, MON_DATA_ATK, NULL); + param2->unk_2A = (u16)Pokemon_GetValue(param1, MON_DATA_DEF, NULL); + param2->unk_2C = (u16)Pokemon_GetValue(param1, MON_DATA_SP_ATK, NULL); + param2->unk_2E = (u16)Pokemon_GetValue(param1, MON_DATA_SP_DEF, NULL); + param2->unk_30 = (u16)Pokemon_GetValue(param1, MON_DATA_SPEED, NULL); + param2->unk_32 = (u8)Pokemon_GetValue(param1, MON_DATA_ABILITY, NULL); + param2->unk_33 = Pokemon_GetNature(param1); for (v1 = 0; v1 < 4; v1++) { - param2->unk_34[v1] = (u16)GetMonData(param1, MON_DATA_MOVE1 + v1, NULL); - param2->unk_3C[v1] = (u8)GetMonData(param1, MON_DATA_58 + v1, NULL); - v2 = (u8)GetMonData(param1, MON_DATA_62 + v1, NULL); + param2->unk_34[v1] = (u16)Pokemon_GetValue(param1, MON_DATA_MOVE1 + v1, NULL); + param2->unk_3C[v1] = (u8)Pokemon_GetValue(param1, MON_DATA_MOVE1_CUR_PP + v1, NULL); + v2 = (u8)Pokemon_GetValue(param1, MON_DATA_MOVE1_PP_UPS + v1, NULL); param2->unk_40[v1] = MoveTable_CalcMaxPP(param2->unk_34[v1], v2); } - param2->unk_45 = (u8)GetMonData(param1, MON_DATA_COOL, NULL); - param2->unk_46 = (u8)GetMonData(param1, MON_DATA_BEAUTY, NULL); - param2->unk_47 = (u8)GetMonData(param1, MON_DATA_CUTE, NULL); - param2->unk_48 = (u8)GetMonData(param1, MON_DATA_SMART, NULL); - param2->unk_49 = (u8)GetMonData(param1, MON_DATA_TOUGH, NULL); - param2->unk_4A = (u8)GetMonData(param1, MON_DATA_SHEEN, NULL); + param2->unk_45 = (u8)Pokemon_GetValue(param1, MON_DATA_COOL, NULL); + param2->unk_46 = (u8)Pokemon_GetValue(param1, MON_DATA_BEAUTY, NULL); + param2->unk_47 = (u8)Pokemon_GetValue(param1, MON_DATA_CUTE, NULL); + param2->unk_48 = (u8)Pokemon_GetValue(param1, MON_DATA_SMART, NULL); + param2->unk_49 = (u8)Pokemon_GetValue(param1, MON_DATA_TOUGH, NULL); + param2->unk_4A = (u8)Pokemon_GetValue(param1, MON_DATA_SHEEN, NULL); param2->unk_4B = 5; for (v1 = 0; v1 < 5; v1++) { - if (sub_0207762C(param1, v1) == 1) { + if (Pokemon_GetFlavorAffinity(param1, v1) == 1) { param2->unk_4B = v1; break; } } - param2->unk_4C = GetMonData(param1, MON_DATA_11, NULL); - param2->unk_4E = GetMonData(param1, MON_DATA_FORM, NULL); + param2->unk_4C = Pokemon_GetValue(param1, MON_DATA_11, NULL); + param2->unk_4E = Pokemon_GetValue(param1, MON_DATA_FORM, NULL); param2->unk_50_0 = sub_0208E9F0(param1); if (sub_020778F8(param1) == 1) { @@ -1117,7 +1116,7 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru param2->unk_50_30 = 0; } - if (sub_02075E0C(param1) == 1) { + if (Pokemon_IsShiny(param1) == 1) { param2->unk_50_29 = 1; } else { param2->unk_50_29 = 0; @@ -1130,13 +1129,13 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru param0->unk_6B1 = 0; for (v1 = 0; v1 < 80; v1++) { - if (GetMonData(param1, sub_020923C0(v1, 0), NULL) != 0) { + if (Pokemon_GetValue(param1, sub_020923C0(v1, 0), NULL) != 0) { param2->unk_54[v1 / 32] |= (1 << (v1 & 0x1f)); param0->unk_6B1++; } } - sub_02073CD4(param1, v3); + Pokemon_ExitDecryptionContext(param1, v3); } static void sub_0208D618 (UnkStruct_0208D7BC * param0) @@ -1525,10 +1524,10 @@ static s8 sub_0208DC1C (UnkStruct_0208D7BC * param0, s8 param1) return -1; } - v0 = (Pokemon *)((u32)param0->unk_24C->unk_00 + sub_02076AF0() * v1); + v0 = (Pokemon *)((u32)param0->unk_24C->unk_00 + Pokemon_GetStructSize() * v1); - if (GetMonData(v0, MON_DATA_SPECIES, NULL) != 0) { - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0) { if (sub_0208DBF4(param0) == 1) { break; } @@ -1557,8 +1556,8 @@ static s8 sub_0208DC84 (UnkStruct_0208D7BC * param0, s8 param1) v0 = Party_GetPokemonBySlotIndex(param0->unk_24C->unk_00, v1); - if (GetMonData(v0, MON_DATA_SPECIES, NULL) != 0) { - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0) { if (sub_0208DBF4(param0) == 1) { break; } @@ -1586,10 +1585,10 @@ static s8 sub_0208DCE0 (UnkStruct_0208D7BC * param0, s8 param1) return -1; } - v0 = (BoxPokemon *)((u32)param0->unk_24C->unk_00 + sub_02076AF4() * v1); + v0 = (BoxPokemon *)((u32)param0->unk_24C->unk_00 + BoxPokemon_GetStructSize() * v1); - if (sub_02074570(v0, MON_DATA_SPECIES, NULL) != 0) { - if (sub_02074570(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (BoxPokemon_GetValue(v0, MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0) { if (sub_0208DBF4(param0) == 1) { break; } @@ -1606,11 +1605,11 @@ void * sub_0208DD48 (UnkStruct_0208D7BC * param0) { switch (param0->unk_24C->unk_11) { case 0: - return (void *)((u32)param0->unk_24C->unk_00 + (sub_02076AF0() * param0->unk_24C->unk_14)); + return (void *)((u32)param0->unk_24C->unk_00 + (Pokemon_GetStructSize() * param0->unk_24C->unk_14)); case 1: return (void *)Party_GetPokemonBySlotIndex(param0->unk_24C->unk_00, param0->unk_24C->unk_14); case 2: - return (void *)((u32)param0->unk_24C->unk_00 + (sub_02076AF4() * param0->unk_24C->unk_14)); + return (void *)((u32)param0->unk_24C->unk_00 + (BoxPokemon_GetStructSize() * param0->unk_24C->unk_14)); } return NULL; @@ -1793,9 +1792,9 @@ static void sub_0208E0DC (UnkStruct_0208D7BC * param0) v0 = sub_0208DD48(param0); if (param0->unk_24C->unk_11 == 2) { - sub_0207734C(v0, param0->unk_6A5_0, param0->unk_6A5_4); + BoxPokemon_SwapMoveSlots(v0, param0->unk_6A5_0, param0->unk_6A5_4); } else { - sub_02077344(v0, param0->unk_6A5_0, param0->unk_6A5_4); + Pokemon_SwapMoveSlots(v0, param0->unk_6A5_0, param0->unk_6A5_4); } v1 = param0->unk_250.unk_34[param0->unk_6A5_0]; @@ -2218,9 +2217,9 @@ u32 sub_0208E9EC (void) u32 sub_0208E9F0 (Pokemon * param0) { - u32 v0 = GetMonData(param0, MON_DATA_160, NULL); + u32 v0 = Pokemon_GetValue(param0, MON_DATA_160, NULL); - if (GetMonData(param0, MON_DATA_163, NULL) == 0) { + if (Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL) == 0) { return 6; } else if ((v0 & (0x8 | 0x80)) != 0) { return 4; diff --git a/src/unk_0208EA44.c b/src/unk_0208EA44.c index e1b05185e5..c206411cee 100644 --- a/src/unk_0208EA44.c +++ b/src/unk_0208EA44.c @@ -15,7 +15,7 @@ #include "unk_0201DBEC.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02079D40.h" #include "unk_0207C908.h" @@ -672,7 +672,7 @@ void sub_0208F71C (UnkStruct_0208D7BC * param0) sub_0200D948(param0->unk_414, param0->unk_418, 19, v1, 0, 11); sub_0200D414(param0->unk_41C[19], sub_02079EDC(param0->unk_250.unk_0C, param0->unk_250.unk_4E, param0->unk_250.unk_50_28) + 7); - sub_02021D0C(param0->unk_41C[19], (sub_020759CC(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1)); + sub_02021D0C(param0->unk_41C[19], (PokemonPersonalData_GetFormValue(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1)); } void sub_0208F7A4 (UnkStruct_0208D7BC * param0) diff --git a/src/unk_0208FCF8.c b/src/unk_0208FCF8.c index eee31008ac..2a50f291a6 100644 --- a/src/unk_0208FCF8.c +++ b/src/unk_0208FCF8.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0205AA50.h" #include "struct_defs/struct_0208D7BC.h" @@ -17,7 +17,7 @@ #include "unk_02018340.h" #include "unk_0201D670.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_0207A274.h" #include "unk_0208C324.h" @@ -573,9 +573,9 @@ static void sub_020908CC (UnkStruct_0208D7BC * param0) if (param0->unk_24C->unk_11 == 2) { { - Pokemon * v3 = AllocMonZeroed(19); + Pokemon * v3 = Pokemon_New(19); - sub_020774C8(v1, v3); + Pokemon_FromBoxPokemon(v1, v3); sub_02090800(¶m0->unk_244[0], v3, v2); Heap_FreeToHeap(v3); } diff --git a/src/unk_020916B4.c b/src/unk_020916B4.c index b624e637f6..53a355514d 100644 --- a/src/unk_020916B4.c +++ b/src/unk_020916B4.c @@ -11,7 +11,7 @@ #include "gx_layers.h" #include "unk_02020020.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208C324.h" #include "unk_0208EA44.h" #include "unk_020916B4.h" @@ -349,7 +349,7 @@ void sub_02091F8C (UnkStruct_0208D7BC * param0) sub_020789BC(param0->unk_6A0, param0->unk_2B4.unk_08, param0->unk_250.unk_0C, 1); - param0->unk_2B4.unk_38 = sub_020759CC(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1; + param0->unk_2B4.unk_38 = PokemonPersonalData_GetFormValue(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1; param0->unk_2B4.unk_34 = sub_02007C34(param0->unk_2B4.unk_04, &v0, 52, 104, 0, 0, param0->unk_2B4.unk_08, NULL); sub_02007DEC(param0->unk_2B4.unk_34, 35, param0->unk_2B4.unk_38); diff --git a/src/unk_02092494.c b/src/unk_02092494.c index 980621fae6..0890880685 100644 --- a/src/unk_02092494.c +++ b/src/unk_02092494.c @@ -4,8 +4,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02090800.h" #include "message.h" @@ -15,7 +14,7 @@ #include "heap.h" #include "strbuf.h" #include "unk_02025E68.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02092494.h" static int sub_02092E8C(Pokemon * param0, BOOL param1, int param2); @@ -320,7 +319,7 @@ void sub_0209282C (UnkStruct_02090800 * param0) static void sub_02092878 (UnkStruct_02090800 * param0) { - int v0 = sub_02075BCC(param0->unk_0C); + int v0 = Pokemon_GetNature(param0->unk_0C); if (v0 > 24) { return; @@ -337,15 +336,15 @@ static void sub_020928A0 (UnkStruct_02090800 * param0, int param1) param0->unk_1C.unk_04 = Strbuf_Init((((2 * 18) * 2) * 8), param0->unk_00); MessageLoader_GetStrbuf(param0->unk_04, param1, v0); - sub_0200B60C(param0->unk_08, 0, GetMonData(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 1, GetMonData(param0->unk_0C, MON_DATA_150, NULL)); - sub_0200B60C(param0->unk_08, 2, GetMonData(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); - sub_0200B60C(param0->unk_08, 3, GetMonData(param0->unk_0C, MON_DATA_MET_LEVEL, NULL), 3, 0, 1); - sub_0200BECC(param0->unk_08, 4, GetMonData(param0->unk_0C, MON_DATA_153, NULL)); - sub_0200B60C(param0->unk_08, 5, GetMonData(param0->unk_0C, MON_DATA_146, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 6, GetMonData(param0->unk_0C, MON_DATA_147, NULL)); - sub_0200B60C(param0->unk_08, 7, GetMonData(param0->unk_0C, MON_DATA_148, NULL), 2, 0, 1); - sub_0200BECC(param0->unk_08, 8, GetMonData(param0->unk_0C, MON_DATA_152, NULL)); + sub_0200B60C(param0->unk_08, 0, Pokemon_GetValue(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 1, Pokemon_GetValue(param0->unk_0C, MON_DATA_150, NULL)); + sub_0200B60C(param0->unk_08, 2, Pokemon_GetValue(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); + sub_0200B60C(param0->unk_08, 3, Pokemon_GetValue(param0->unk_0C, MON_DATA_MET_LEVEL, NULL), 3, 0, 1); + sub_0200BECC(param0->unk_08, 4, Pokemon_GetValue(param0->unk_0C, MON_DATA_153, NULL)); + sub_0200B60C(param0->unk_08, 5, Pokemon_GetValue(param0->unk_0C, MON_DATA_146, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 6, Pokemon_GetValue(param0->unk_0C, MON_DATA_147, NULL)); + sub_0200B60C(param0->unk_08, 7, Pokemon_GetValue(param0->unk_0C, MON_DATA_148, NULL), 2, 0, 1); + sub_0200BECC(param0->unk_08, 8, Pokemon_GetValue(param0->unk_0C, MON_DATA_152, NULL)); sub_0200C388(param0->unk_08, param0->unk_1C.unk_04, v0); Strbuf_Free(v0); } @@ -357,12 +356,12 @@ static void sub_020929C0 (UnkStruct_02090800 * param0, int param1) param0->unk_1C.unk_04 = Strbuf_Init((((2 * 18) * 2) * 4), param0->unk_00); MessageLoader_GetStrbuf(param0->unk_04, param1, v0); - sub_0200B60C(param0->unk_08, 0, GetMonData(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 1, GetMonData(param0->unk_0C, MON_DATA_150, NULL)); - sub_0200B60C(param0->unk_08, 2, GetMonData(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); - sub_0200B60C(param0->unk_08, 3, GetMonData(param0->unk_0C, MON_DATA_MET_LEVEL, NULL), 3, 0, 1); + sub_0200B60C(param0->unk_08, 0, Pokemon_GetValue(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 1, Pokemon_GetValue(param0->unk_0C, MON_DATA_150, NULL)); + sub_0200B60C(param0->unk_08, 2, Pokemon_GetValue(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); + sub_0200B60C(param0->unk_08, 3, Pokemon_GetValue(param0->unk_0C, MON_DATA_MET_LEVEL, NULL), 3, 0, 1); - switch (GetMonData(param0->unk_0C, MON_DATA_MET_GAME, NULL)) { + switch (Pokemon_GetValue(param0->unk_0C, MON_DATA_MET_GAME, NULL)) { default: sub_0200BECC(param0->unk_08, 4, (sub_02017070(1, 7))); break; @@ -402,15 +401,15 @@ static void sub_02092B1C (UnkStruct_02090800 * param0, int param1, int param2) MessageLoader_GetStrbuf(param0->unk_04, param1, v0); if (param2 == 0) { - sub_0200B60C(param0->unk_08, 5, GetMonData(param0->unk_0C, MON_DATA_146, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 6, GetMonData(param0->unk_0C, MON_DATA_147, NULL)); - sub_0200B60C(param0->unk_08, 7, GetMonData(param0->unk_0C, MON_DATA_148, NULL), 2, 0, 1); - sub_0200BECC(param0->unk_08, 8, GetMonData(param0->unk_0C, MON_DATA_152, NULL)); + sub_0200B60C(param0->unk_08, 5, Pokemon_GetValue(param0->unk_0C, MON_DATA_146, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 6, Pokemon_GetValue(param0->unk_0C, MON_DATA_147, NULL)); + sub_0200B60C(param0->unk_08, 7, Pokemon_GetValue(param0->unk_0C, MON_DATA_148, NULL), 2, 0, 1); + sub_0200BECC(param0->unk_08, 8, Pokemon_GetValue(param0->unk_0C, MON_DATA_152, NULL)); } else { - sub_0200B60C(param0->unk_08, 5, GetMonData(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 6, GetMonData(param0->unk_0C, MON_DATA_150, NULL)); - sub_0200B60C(param0->unk_08, 7, GetMonData(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); - sub_0200BECC(param0->unk_08, 8, GetMonData(param0->unk_0C, MON_DATA_153, NULL)); + sub_0200B60C(param0->unk_08, 5, Pokemon_GetValue(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 6, Pokemon_GetValue(param0->unk_0C, MON_DATA_150, NULL)); + sub_0200B60C(param0->unk_08, 7, Pokemon_GetValue(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); + sub_0200BECC(param0->unk_08, 8, Pokemon_GetValue(param0->unk_0C, MON_DATA_153, NULL)); } sub_0200C388(param0->unk_08, param0->unk_1C.unk_04, v0); @@ -433,14 +432,14 @@ static void sub_02092C24 (UnkStruct_02090800 * param0) param0->unk_24.unk_04 = Strbuf_Init(((2 * 18) * 2), param0->unk_00); - v0[0] = (GetMonData(param0->unk_0C, MON_DATA_HP_IV, NULL)); - v0[1] = (GetMonData(param0->unk_0C, MON_DATA_ATK_IV, NULL)); - v0[2] = (GetMonData(param0->unk_0C, MON_DATA_DEF_IV, NULL)); - v0[3] = (GetMonData(param0->unk_0C, MON_DATA_SPEED_IV, NULL)); - v0[4] = (GetMonData(param0->unk_0C, MON_DATA_SPATK_IV, NULL)); - v0[5] = (GetMonData(param0->unk_0C, MON_DATA_SPDEF_IV, NULL)); + v0[0] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_HP_IV, NULL)); + v0[1] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_ATK_IV, NULL)); + v0[2] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_DEF_IV, NULL)); + v0[3] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_SPEED_IV, NULL)); + v0[4] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_SPATK_IV, NULL)); + v0[5] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_SPDEF_IV, NULL)); - switch ((GetMonData(param0->unk_0C, MON_DATA_PERSONALITY, NULL) % 6)) { + switch ((Pokemon_GetValue(param0->unk_0C, MON_DATA_PERSONALITY, NULL) % 6)) { default: case 0: v1 = 0; @@ -609,7 +608,7 @@ static void sub_02092E10 (UnkStruct_02090800 * param0) v1 = 0; for (v0 = 0; v0 < 5; v0++) { - if (sub_0207762C(param0->unk_0C, v0) == 1) { + if (Pokemon_GetFlavorAffinity(param0->unk_0C, v0) == 1) { v1 = v0 + 1; } } @@ -620,7 +619,7 @@ static void sub_02092E10 (UnkStruct_02090800 * param0) static void sub_02092E4C (UnkStruct_02090800 * param0) { - int v0 = GetMonData(param0->unk_0C, MON_DATA_FRIENDSHIP, NULL); + int v0 = Pokemon_GetValue(param0->unk_0C, MON_DATA_FRIENDSHIP, NULL); int v1; param0->unk_34.unk_04 = Strbuf_Init((((2 * 18) * 2) * 4), param0->unk_00); @@ -642,17 +641,17 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) { int v0 = 0; - if (GetMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { - if ((GetMonData(param0, MON_DATA_152, NULL) == 0)) { - if (GetMonData(param0, MON_DATA_153, NULL) == (sub_02017070(0, 55))) { + if (Pokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { + if ((Pokemon_GetValue(param0, MON_DATA_152, NULL) == 0)) { + if (Pokemon_GetValue(param0, MON_DATA_153, NULL) == (sub_02017070(0, 55))) { v0 = 15; - } else if ((GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { + } else if ((Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { if (param1 == 1) { v0 = 7; } else { v0 = 8; } - } else if (GetMonData(param0, MON_DATA_153, NULL) == (sub_02017070(1, 1))) { + } else if (Pokemon_GetValue(param0, MON_DATA_153, NULL) == (sub_02017070(1, 1))) { v0 = 2; } else { if (param1 == 1) { @@ -662,14 +661,14 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) } } } else { - if ((GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { - if (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 2)) { + if ((Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { + if (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 2)) { if (param1 == 1) { v0 = 13; } else { v0 = 14; } - } else if (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(2, 1)) { + } else if (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(2, 1)) { if (param1 == 1) { v0 = 11; } else { @@ -683,7 +682,7 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) } } } else { - if ((GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 1)) || (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 0)) || (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 9)) || (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 10)) || (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 11))) { + if ((Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 1)) || (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 0)) || (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 9)) || (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 10)) || (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 11))) { if (param1 == 1) { v0 = 5; } else { @@ -700,8 +699,8 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) } } else { if (param1 == 1) { - if ((GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { - if (GetMonData(param0, MON_DATA_152, NULL) == (sub_02017070(2, 1))) { + if ((Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { + if (Pokemon_GetValue(param0, MON_DATA_152, NULL) == (sub_02017070(2, 1))) { v0 = 20; } else { v0 = 18; @@ -710,7 +709,7 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) v0 = 16; } } else { - if ((GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { + if ((Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { v0 = 19; } else { v0 = 17; @@ -734,7 +733,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, param3 = (sub_02017070(2, 2)); } - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -746,7 +745,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_020932A4(param0, param1, param4); break; case 1: - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, (sub_02017070(1, 1)), 1); sub_020933C8(param0); @@ -767,7 +766,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, break; case 4: if (sub_0207884C(param0, param1, param4) == 1) { - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -776,7 +775,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_02093368(param0, 1); } } else { - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -789,7 +788,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_020933E8(param0); break; case 5: - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { (void)0; } else { sub_020932F0(param0, (sub_02017070(1, 2)), 1); @@ -804,17 +803,17 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, { int v0; - v0 = sub_02074570(param0, MON_DATA_153, NULL); - SetBoxMonData(param0, 152, &v0); + v0 = BoxPokemon_GetValue(param0, MON_DATA_153, NULL); + BoxPokemon_SetValue(param0, 152, &v0); - v0 = sub_02074570(param0, MON_DATA_149, NULL); - SetBoxMonData(param0, 146, &v0); + v0 = BoxPokemon_GetValue(param0, MON_DATA_149, NULL); + BoxPokemon_SetValue(param0, 146, &v0); - v0 = sub_02074570(param0, MON_DATA_150, NULL); - SetBoxMonData(param0, 147, &v0); + v0 = BoxPokemon_GetValue(param0, MON_DATA_150, NULL); + BoxPokemon_SetValue(param0, 147, &v0); - v0 = sub_02074570(param0, MON_DATA_151, NULL); - SetBoxMonData(param0, 148, &v0); + v0 = BoxPokemon_GetValue(param0, MON_DATA_151, NULL); + BoxPokemon_SetValue(param0, 148, &v0); } } @@ -830,9 +829,9 @@ static void sub_020932A4 (BoxPokemon * param0, UnkStruct_02025E6C * param1, int int v1 = sub_02025F30(param1); Strbuf* v2 = sub_02025F04(param1, param2); - SetBoxMonData(param0, 7, &v0); - SetBoxMonData(param0, 157, &v1); - SetBoxMonData(param0, 145, v2); + BoxPokemon_SetValue(param0, 7, &v0); + BoxPokemon_SetValue(param0, 157, &v1); + BoxPokemon_SetValue(param0, 145, v2); Strbuf_Free(v2); } @@ -843,15 +842,15 @@ static void sub_020932F0 (BoxPokemon * param0, int param1, int param2) sub_020138A4(&v0); if (param2 == 0) { - SetBoxMonData(param0, 152, ¶m1); - SetBoxMonData(param0, 146, &v0.year); - SetBoxMonData(param0, 147, &v0.month); - SetBoxMonData(param0, 148, &v0.day); + BoxPokemon_SetValue(param0, 152, ¶m1); + BoxPokemon_SetValue(param0, 146, &v0.year); + BoxPokemon_SetValue(param0, 147, &v0.month); + BoxPokemon_SetValue(param0, 148, &v0.day); } else { - SetBoxMonData(param0, 153, ¶m1); - SetBoxMonData(param0, 149, &v0.year); - SetBoxMonData(param0, 150, &v0.month); - SetBoxMonData(param0, 151, &v0.day); + BoxPokemon_SetValue(param0, 153, ¶m1); + BoxPokemon_SetValue(param0, 149, &v0.year); + BoxPokemon_SetValue(param0, 150, &v0.month); + BoxPokemon_SetValue(param0, 151, &v0.day); } } @@ -860,26 +859,26 @@ static void sub_02093368 (BoxPokemon * param0, int param1) int v0 = 0; if (param1 == 0) { - SetBoxMonData(param0, 152, &v0); - SetBoxMonData(param0, 146, &v0); - SetBoxMonData(param0, 147, &v0); - SetBoxMonData(param0, 148, &v0); + BoxPokemon_SetValue(param0, 152, &v0); + BoxPokemon_SetValue(param0, 146, &v0); + BoxPokemon_SetValue(param0, 147, &v0); + BoxPokemon_SetValue(param0, 148, &v0); } else { - SetBoxMonData(param0, 153, &v0); - SetBoxMonData(param0, 149, &v0); - SetBoxMonData(param0, 150, &v0); - SetBoxMonData(param0, 151, &v0); + BoxPokemon_SetValue(param0, 153, &v0); + BoxPokemon_SetValue(param0, 149, &v0); + BoxPokemon_SetValue(param0, 150, &v0); + BoxPokemon_SetValue(param0, 151, &v0); } } static void sub_020933C8 (BoxPokemon * param0) { - int v0 = sub_02074570(param0, MON_DATA_161, NULL); - SetBoxMonData(param0, 156, &v0); + int v0 = BoxPokemon_GetValue(param0, MON_DATA_LEVEL, NULL); + BoxPokemon_SetValue(param0, 156, &v0); } static void sub_020933E8 (BoxPokemon * param0) { int v0 = 1; - SetBoxMonData(param0, 110, &v0); + BoxPokemon_SetValue(param0, 110, &v0); } diff --git a/src/unk_020933F8.c b/src/unk_020933F8.c index af1316d90e..59e42ef18b 100644 --- a/src/unk_020933F8.c +++ b/src/unk_020933F8.c @@ -15,8 +15,7 @@ #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "constdata/const_020F55EC.h" @@ -56,7 +55,7 @@ #include "unk_02055808.h" #include "unk_0206A8DC.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_020923C0.h" #include "unk_020933F8.h" @@ -413,7 +412,7 @@ UnkStruct_02095C48 * sub_02093800 (const UnkStruct_02093800 * param0) Heap_Create(11, 20, (0x3000 + 0x1000)); v0 = sub_020937C4(); - v0->unk_19A4 = sub_0201D2D0(); + v0->unk_19A4 = LCRNG_GetSeed(); sub_02094E7C(v0); @@ -442,7 +441,7 @@ UnkStruct_02095C48 * sub_02093800 (const UnkStruct_02093800 * param0) v0->unk_148 = sub_02079FF4(20); for (v2 = 0; v2 < 4; v2++) { - v0->unk_00.unk_00[v2] = AllocMonZeroed(20); + v0->unk_00.unk_00[v2] = Pokemon_New(20); } for (v2 = 0; v2 < 4; v2++) { @@ -452,7 +451,7 @@ UnkStruct_02095C48 * sub_02093800 (const UnkStruct_02093800 * param0) sub_0202CD3C(v0->unk_14C[0], param0->unk_20); { - sub_020775EC(param0->unk_08, v0->unk_00.unk_00[0]); + Pokemon_Copy(param0->unk_08, v0->unk_00.unk_00[0]); v0->unk_00.unk_D8[0] = Strbuf_Init(8, 20); Strbuf_Copy(v0->unk_00.unk_D8[0], param0->unk_0C); @@ -506,7 +505,7 @@ static void sub_020939E0 (UnkStruct_02095C48 * param0, int param1, int param2) param0->unk_00.unk_D8[v1] = Strbuf_Init(8, 20); } - GetMonData(param0->unk_00.unk_00[v1], MON_DATA_145, param0->unk_00.unk_D8[v1]); + Pokemon_GetValue(param0->unk_00.unk_00[v1], MON_DATA_145, param0->unk_00.unk_D8[v1]); } for (v1 = 1; v1 < 4; v1++) { @@ -541,7 +540,7 @@ void sub_02093AD4 (UnkStruct_02095C48 * param0) Heap_FreeToHeap(param0->unk_14C[v0]); } - sub_0201D2DC(param0->unk_19A4); + LCRNG_SetSeed(param0->unk_19A4); sub_020937F8(param0); Heap_Destroy(20); } @@ -555,19 +554,19 @@ static int sub_02093B2C (Pokemon * param0, int param1) for (v1 = 0; v1 <= 3; v1++) { switch (param1) { case 0: - v2 = GetMonData(param0, MON_DATA_123 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_123 + v1, NULL); break; case 1: - v2 = GetMonData(param0, MON_DATA_127 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_127 + v1, NULL); break; case 2: - v2 = GetMonData(param0, MON_DATA_131 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_131 + v1, NULL); break; case 3: - v2 = GetMonData(param0, MON_DATA_135 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_135 + v1, NULL); break; case 4: - v2 = GetMonData(param0, MON_DATA_139 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_139 + v1, NULL); break; default: GF_ASSERT(0); @@ -1149,7 +1148,7 @@ void sub_02094680 (UnkStruct_02095C48 * param0, int param1, UnkStruct_0200B358 * int v1; v1 = sub_02095904(param1); - v0 = sub_02076B10(param0->unk_00.unk_00[v1]); + v0 = Pokemon_GetBoxPokemon(param0->unk_00.unk_00[v1]); sub_0200B5CC(param2, param3, v0); } @@ -1319,7 +1318,7 @@ BOOL sub_02094868 (UnkStruct_02095C48 * param0) v0 = sub_02095A3C(param0->unk_00.unk_110, param0->unk_00.unk_10F); - if (GetMonData(param0->unk_1974, v0, NULL) == 0) { + if (Pokemon_GetValue(param0->unk_1974, v0, NULL) == 0) { return 0; } @@ -1618,11 +1617,11 @@ void sub_02094C44 (UnkStruct_02095C48 * param0, UnkStruct_021C0794 * param1, u32 v2 = sub_02095A3C(param0->unk_00.unk_110, param0->unk_00.unk_10F); - if (GetMonData(param0->unk_1974, v2, NULL) == 0) { + if (Pokemon_GetValue(param0->unk_1974, v2, NULL) == 0) { v0 = 1; } - sub_02074B30(param0->unk_1974, v2, &v3); + Pokemon_SetValue(param0->unk_1974, v2, &v3); sub_0206DDB8(param0->unk_1970, param0->unk_1974, v2); } @@ -1704,19 +1703,19 @@ void sub_02094C44 (UnkStruct_02095C48 * param0, UnkStruct_021C0794 * param1, u32 static void sub_02094E7C (UnkStruct_02095C48 * param0) { - sub_0201D2DC((sub_020138C8() * (sub_0201D2D0() + 10)) & 0xffff); + LCRNG_SetSeed((sub_020138C8() * (LCRNG_GetSeed() + 10)) & 0xffff); } u16 sub_02094E98 (UnkStruct_02095C48 * param0) { - return sub_0201D2E8(); + return LCRNG_Next(); } u16 sub_02094EA0 (u32 param0, u32 * param1) { u32 v0; - v0 = sub_0201D30C(param0); + v0 = ARNG_Next(param0); *param1 = v0; return v0 / 65536L; diff --git a/src/unk_02094EDC.c b/src/unk_02094EDC.c index aa92ea451e..c07c81950c 100644 --- a/src/unk_02094EDC.c +++ b/src/unk_02094EDC.c @@ -3,8 +3,10 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02007C7C_decl.h" +#include "strbuf.h" +#include "pokemon.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/struct_020951B0.h" #include "struct_defs/struct_020954F0.h" @@ -23,7 +25,7 @@ #include "unk_0201D15C.h" #include "strbuf.h" #include "unk_020298BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" @@ -626,7 +628,7 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int for (v0 = 0; v0 < 4; v0++) { v1 = param0->unk_0C[v0]; - sub_02074B30(param1, 54 + v0, &v1); + Pokemon_SetValue(param1, 54 + v0, &v1); } { @@ -637,8 +639,8 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int v3 = MessageLoader_GetNewStrbuf(v5, param0->unk_16); v4 = MessageLoader_GetNewStrbuf(v5, param0->unk_18); - sub_02074B30(param1, 119, v3); - sub_02074B30(param1, 145, v4); + Pokemon_SetValue(param1, 119, v3); + Pokemon_SetValue(param1, 145, v4); Strbuf_Free(v3); Strbuf_Free(v4); @@ -655,12 +657,12 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int v10 = param0->unk_1E; v11 = param0->unk_1F; - sub_02074B30(param1, 19, &v6); - sub_02074B30(param1, 20, &v7); - sub_02074B30(param1, 21, &v8); - sub_02074B30(param1, 22, &v9); - sub_02074B30(param1, 23, &v10); - sub_02074B30(param1, 24, &v11); + Pokemon_SetValue(param1, 19, &v6); + Pokemon_SetValue(param1, 20, &v7); + Pokemon_SetValue(param1, 21, &v8); + Pokemon_SetValue(param1, 22, &v9); + Pokemon_SetValue(param1, 23, &v10); + Pokemon_SetValue(param1, 24, &v11); } } @@ -1051,7 +1053,7 @@ u32 sub_02095A74 (int param0, int param1) u32 v2; if ((param0 == 3) || (param1 == 1)) { - return sub_0201D2E8() % 12; + return LCRNG_Next() % 12; } MI_CpuClear8(v0, 12); @@ -1072,5 +1074,5 @@ u32 sub_02095A74 (int param0, int param1) v0[v1++] = 8; } - return v0[sub_0201D2E8() % v1]; + return v0[LCRNG_Next() % v1]; } diff --git a/src/unk_020961E8.c b/src/unk_020961E8.c index 40de9cdfca..3316c998b5 100644 --- a/src/unk_020961E8.c +++ b/src/unk_020961E8.c @@ -302,7 +302,7 @@ static void sub_020963C0 (UnkStruct_020961E8 * param0, int param1) param0->unk_418.unk_BB8 = v2; } - param0->unk_418.unk_BBC = sub_0201D2E8(); + param0->unk_418.unk_BBC = LCRNG_Next(); sub_0203597C(116, ¶m0->unk_418, sizeof(UnkStruct_ov59_021D30E0)); } diff --git a/src/unk_02096420.c b/src/unk_02096420.c index 07d795128f..2a2179ee91 100644 --- a/src/unk_02096420.c +++ b/src/unk_02096420.c @@ -1,11 +1,11 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -31,7 +31,7 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) return 0; } - v1[0] = GetMonData(param0, MON_DATA_160, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_160, NULL); if (Item_Get(v0, 15) != 0) { if ((v1[0] & 0x7) != 0) { @@ -68,7 +68,7 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) } } - v1[0] = GetMonData(param0, MON_DATA_163, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL); if (((Item_Get(v0, 23) != 0) || (Item_Get(v0, 24) != 0)) && (Item_Get(v0, 25) == 0)) { if (v1[0] == 0) { @@ -76,14 +76,14 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) return 1; } } else if (Item_Get(v0, 38) != 0) { - if ((v1[0] != 0) && (v1[0] < GetMonData(param0, MON_DATA_164, NULL))) { + if ((v1[0] != 0) && (v1[0] < Pokemon_GetValue(param0, MON_DATA_MAX_HP, NULL))) { Heap_FreeToHeap(v0); return 1; } } if (Item_Get(v0, 25) != 0) { - if (GetMonData(param0, MON_DATA_161, NULL) < 100) { + if (Pokemon_GetValue(param0, MON_DATA_LEVEL, NULL) < 100) { Heap_FreeToHeap(v0); return 1; } @@ -97,7 +97,7 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) } if ((Item_Get(v0, 34) != 0) || (Item_Get(v0, 35) != 0)) { - if ((GetMonData(param0, MON_DATA_62 + param2, NULL) < 3) && (MoveTable_CalcMaxPP(GetMonData(param0, MON_DATA_MOVE1 + param2, NULL), 0) >= 5)) { + if ((Pokemon_GetValue(param0, MON_DATA_MOVE1_PP_UPS + param2, NULL) < 3) && (MoveTable_CalcMaxPP(Pokemon_GetValue(param0, MON_DATA_MOVE1 + param2, NULL), 0) >= 5)) { Heap_FreeToHeap(v0); return 1; } @@ -119,14 +119,14 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) } } - v1[0] = GetMonData(param0, MON_DATA_HP_EV, NULL); - v1[1] = GetMonData(param0, MON_DATA_ATK_EV, NULL); - v1[2] = GetMonData(param0, MON_DATA_DEF_EV, NULL); - v1[3] = GetMonData(param0, MON_DATA_SPEED_EV, NULL); - v1[4] = GetMonData(param0, MON_DATA_SPATK_EV, NULL); - v1[5] = GetMonData(param0, MON_DATA_SPDEF_EV, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_HP_EV, NULL); + v1[1] = Pokemon_GetValue(param0, MON_DATA_ATK_EV, NULL); + v1[2] = Pokemon_GetValue(param0, MON_DATA_DEF_EV, NULL); + v1[3] = Pokemon_GetValue(param0, MON_DATA_SPEED_EV, NULL); + v1[4] = Pokemon_GetValue(param0, MON_DATA_SPATK_EV, NULL); + v1[5] = Pokemon_GetValue(param0, MON_DATA_SPDEF_EV, NULL); - if (GetMonData(param0, MON_DATA_SPECIES, NULL) != 292) { + if (Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL) != 292) { if (Item_Get(v0, 39) != 0) { v1[6] = Item_Get(v0, 48); @@ -282,7 +282,7 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param v2 = 0; v3 = 0; - v1[0] = GetMonData(param0, MON_DATA_160, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_160, NULL); v1[1] = v1[0]; if (Item_Get(v0, 15) != 0) { @@ -311,12 +311,12 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param } if (v1[0] != v1[1]) { - sub_02074B30(param0, 160, &v1[1]); + Pokemon_SetValue(param0, 160, &v1[1]); v2 = 1; } - v1[0] = GetMonData(param0, MON_DATA_163, NULL); - v1[1] = GetMonData(param0, MON_DATA_164, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL); + v1[1] = Pokemon_GetValue(param0, MON_DATA_MAX_HP, NULL); if (((Item_Get(v0, 23) != 0) || (Item_Get(v0, 24) != 0)) && (Item_Get(v0, 25) != 0)) { if (v1[0] == 0) { @@ -334,15 +334,15 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param v3 = 1; } - v1[2] = GetMonData(param0, MON_DATA_161, NULL); + v1[2] = Pokemon_GetValue(param0, MON_DATA_LEVEL, NULL); if (Item_Get(v0, 25) != 0) { if (v1[2] < 100) { - sub_0207536C(param0, MON_DATA_EXP, sub_02075A70(param0)); - sub_0207418C(param0); + Pokemon_IncreaseValue(param0, MON_DATA_EXP, Pokemon_GetExpToNextLevel(param0)); + Pokemon_CalcLevelAndStats(param0); if (v1[0] == 0) { - v1[3] = GetMonData(param0, MON_DATA_164, NULL); + v1[3] = Pokemon_GetValue(param0, MON_DATA_MAX_HP, NULL); sub_020970AC(param0, v1[0], v1[3], v1[3] - v1[1]); } @@ -386,22 +386,22 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param v3 = 1; } - v1[0] = GetMonData(param0, MON_DATA_HP_EV, NULL); - v1[1] = GetMonData(param0, MON_DATA_ATK_EV, NULL); - v1[2] = GetMonData(param0, MON_DATA_DEF_EV, NULL); - v1[3] = GetMonData(param0, MON_DATA_SPEED_EV, NULL); - v1[4] = GetMonData(param0, MON_DATA_SPATK_EV, NULL); - v1[5] = GetMonData(param0, MON_DATA_SPDEF_EV, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_HP_EV, NULL); + v1[1] = Pokemon_GetValue(param0, MON_DATA_ATK_EV, NULL); + v1[2] = Pokemon_GetValue(param0, MON_DATA_DEF_EV, NULL); + v1[3] = Pokemon_GetValue(param0, MON_DATA_SPEED_EV, NULL); + v1[4] = Pokemon_GetValue(param0, MON_DATA_SPATK_EV, NULL); + v1[5] = Pokemon_GetValue(param0, MON_DATA_SPDEF_EV, NULL); - if (GetMonData(param0, MON_DATA_SPECIES, NULL) != 292) { + if (Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL) != 292) { if (Item_Get(v0, 39) != 0) { v1[7] = Item_Get(v0, 48); v1[6] = sub_020970EC(v1[0], (v1[1] + v1[2] + v1[3] + v1[4] + v1[5]), v1[7]); if (v1[6] != -1) { v1[0] = v1[6]; - sub_02074B30(param0, 13, &v1[0]); - sub_0207418C(param0); + Pokemon_SetValue(param0, 13, &v1[0]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -417,8 +417,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[1] = v1[6]; - sub_02074B30(param0, 14, &v1[1]); - sub_0207418C(param0); + Pokemon_SetValue(param0, 14, &v1[1]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -433,8 +433,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[2] = v1[6]; - sub_02074B30(param0, 15, &v1[2]); - sub_0207418C(param0); + Pokemon_SetValue(param0, 15, &v1[2]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -449,8 +449,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[3] = v1[6]; - sub_02074B30(param0, 16, &v1[3]); - sub_0207418C(param0); + Pokemon_SetValue(param0, 16, &v1[3]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -465,8 +465,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[4] = v1[6]; - sub_02074B30(param0, 17, &v1[4]); - sub_0207418C(param0); + Pokemon_SetValue(param0, 17, &v1[4]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -481,8 +481,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[5] = v1[6]; - sub_02074B30(param0, 18, &v1[5]); - sub_0207418C(param0); + Pokemon_SetValue(param0, 18, &v1[5]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -496,7 +496,7 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param return 0; } - v1[0] = GetMonData(param0, MON_DATA_FRIENDSHIP, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_FRIENDSHIP, NULL); if (v1[0] < 100) { if (Item_Get(v0, 45) != 0) { @@ -538,14 +538,14 @@ static u8 sub_02096F34 (Pokemon * param0, u32 param1) u8 v1; u8 v2; - v0 = (u16)GetMonData(param0, MON_DATA_MOVE1 + param1, NULL); + v0 = (u16)Pokemon_GetValue(param0, MON_DATA_MOVE1 + param1, NULL); if (v0 == 0) { return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_58 + param1, NULL); - v2 = (u8)GetMonData(param0, MON_DATA_62 + param1, NULL); + v1 = (u8)Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); + v2 = (u8)Pokemon_GetValue(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); if (v1 < MoveTable_CalcMaxPP(v0, v2)) { return 1; @@ -560,14 +560,14 @@ static u8 sub_02096F84 (Pokemon * param0, u32 param1, u32 param2) u8 v1; u8 v2; - v0 = (u16)GetMonData(param0, MON_DATA_MOVE1 + param1, NULL); + v0 = (u16)Pokemon_GetValue(param0, MON_DATA_MOVE1 + param1, NULL); if (v0 == 0) { return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_58 + param1, NULL); - v2 = (u8)MoveTable_CalcMaxPP(v0, GetMonData(param0, MON_DATA_62 + param1, NULL)); + v1 = (u8)Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); + v2 = (u8)MoveTable_CalcMaxPP(v0, Pokemon_GetValue(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL)); if (v1 < v2) { if (param2 == 127) { @@ -580,7 +580,7 @@ static u8 sub_02096F84 (Pokemon * param0, u32 param1, u32 param2) } } - sub_02074B30(param0, 58 + param1, &v1); + Pokemon_SetValue(param0, 58 + param1, &v1); return 1; } @@ -594,19 +594,19 @@ static u8 sub_02097004 (Pokemon * param0, u32 param1, u32 param2) u8 v2; u8 v3; - v2 = GetMonData(param0, MON_DATA_62 + param1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); if (v2 == 3) { return 0; } - v0 = (u16)GetMonData(param0, MON_DATA_MOVE1 + param1, NULL); + v0 = (u16)Pokemon_GetValue(param0, MON_DATA_MOVE1 + param1, NULL); if (MoveTable_CalcMaxPP(v0, 0) < 5) { return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_58 + param1, NULL); + v1 = (u8)Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); v3 = (u8)MoveTable_CalcMaxPP(v0, v2); if (v2 + param2 > 3) { @@ -617,8 +617,8 @@ static u8 sub_02097004 (Pokemon * param0, u32 param1, u32 param2) v1 = v1 + MoveTable_CalcMaxPP(v0, v2) - v3; - sub_02074B30(param0, 62 + param1, &v2); - sub_02074B30(param0, 58 + param1, &v1); + Pokemon_SetValue(param0, 62 + param1, &v2); + Pokemon_SetValue(param0, 58 + param1, &v1); return 1; } @@ -641,7 +641,7 @@ static void sub_020970AC (Pokemon * param0, u32 param1, u32 param2, u32 param3) param1 += param3; } - sub_02074B30(param0, 163, ¶m1); + Pokemon_SetValue(param0, 163, ¶m1); } static s32 sub_020970EC (s32 param0, s32 param1, s32 param2) @@ -678,7 +678,7 @@ static u8 sub_02097144 (Pokemon * param0, ItemData * param1) s32 v0; s32 v1; - v0 = GetMonData(param0, MON_DATA_FRIENDSHIP, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_FRIENDSHIP, NULL); if (v0 >= 255) { return 0; @@ -724,15 +724,15 @@ static u8 sub_020971D0 (Pokemon * param0, s32 param1, s32 param2, u16 param3, u3 } if (param2 > 0) { - if (Item_LoadParam(GetMonData(param0, MON_DATA_HELD_ITEM, NULL), 1, param4) == 53) { + if (Item_LoadParam(Pokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL), 1, param4) == 53) { param2 = param2 * 150 / 100; } - if (GetMonData(param0, MON_DATA_POKEBALL, NULL) == 11) { + if (Pokemon_GetValue(param0, MON_DATA_POKEBALL, NULL) == 11) { param2++; } - if (GetMonData(param0, MON_DATA_152, NULL) == param3) { + if (Pokemon_GetValue(param0, MON_DATA_152, NULL) == param3) { param2++; } } @@ -747,7 +747,7 @@ static u8 sub_020971D0 (Pokemon * param0, s32 param1, s32 param2, u16 param3, u3 param2 = 0; } - sub_02074B30(param0, 9, ¶m2); + Pokemon_SetValue(param0, 9, ¶m2); return 1; } @@ -762,15 +762,15 @@ void sub_02097284 (Party * param0) for (v0 = 0; v0 < v2; v0++) { v4 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v4, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v4, MON_DATA_172, NULL) == 0) { continue; } - v3 = GetMonData(v4, MON_DATA_164, NULL); - sub_02074B30(v4, 163, &v3); + v3 = Pokemon_GetValue(v4, MON_DATA_MAX_HP, NULL); + Pokemon_SetValue(v4, 163, &v3); v3 = 0; - sub_02074B30(v4, 160, &v3); + Pokemon_SetValue(v4, 160, &v3); for (v1 = 0; v1 < 4; v1++) { if (sub_02096F34(v4, v1) == 1) { diff --git a/src/unk_02097624.c b/src/unk_02097624.c index 69e9707952..59dfddd48d 100644 --- a/src/unk_02097624.c +++ b/src/unk_02097624.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_020067E8_decl.h" #include "struct_decls/struct_02028430_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_02014A84.h" @@ -19,7 +19,7 @@ #include "unk_02025E08.h" #include "unk_02028124.h" #include "unk_0202CD50.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "item.h" #include "unk_0209747C.h" #include "overlay020/ov20_021D0D80.h" @@ -120,7 +120,7 @@ UnkStruct_02097728 * sub_020976BC (UnkStruct_021C0794 * param0, Pokemon * param1 v0->unk_10 = param0; v0->unk_14 = sub_0202818C(param2); - GetMonData(param1, MON_DATA_170, v0->unk_14); + Pokemon_GetValue(param1, MON_DATA_170, v0->unk_14); return v0; } @@ -160,7 +160,7 @@ int sub_02097750 (UnkStruct_02097728 * param0, Pokemon * param1) return 0; } - sub_02074B30(param1, 170, param0->unk_14); + Pokemon_SetValue(param1, 170, param0->unk_14); return 1; } @@ -187,11 +187,11 @@ int sub_02097788 (UnkStruct_02028430 * param0, Pokemon * param1, int param2) v2 = sub_0202818C(param2); - GetMonData(param1, MON_DATA_170, v2); + Pokemon_GetValue(param1, MON_DATA_170, v2); sub_02028480(param0, 0, v0, v2); sub_02028124(v2); - sub_02074B30(param1, 170, v2); - sub_02074B30(param1, 6, &v1); + Pokemon_SetValue(param1, 170, v2); + Pokemon_SetValue(param1, 6, &v1); Heap_FreeToHeap(v2); return v0; @@ -210,8 +210,8 @@ int sub_020977E4 (UnkStruct_02028430 * param0, u16 param1, Pokemon * param2, int v0 = Item_ForMailNumber(sub_02028314(v1)); - sub_02074B30(param2, 170, v1); - sub_02074B30(param2, 6, &v0); + Pokemon_SetValue(param2, 170, v1); + Pokemon_SetValue(param2, 6, &v0); sub_02028470(param0, 0, param1); Heap_FreeToHeap(v1); diff --git a/src/unk_02097B18.c b/src/unk_02097B18.c index 93c5e9441e..b040be1c23 100644 --- a/src/unk_02097B18.c +++ b/src/unk_02097B18.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_020067E8_decl.h" #include "struct_decls/struct_0202440C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "constdata/const_020F1E88.h" @@ -42,7 +42,7 @@ #include "unk_020508D4.h" #include "unk_02055808.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_02097B18.h" @@ -94,7 +94,7 @@ static int sub_02097B18 (UnkStruct_020067E8 * param0, int * param1) v1 = sub_02006840(param0); v0->unk_00 = v1; v0->unk_42C = NARC_ctor(NARC_INDEX_POKETOOL__POKE_EDIT__PL_POKE_DATA, 53); - v0->unk_428 = AllocMonZeroed(53); + v0->unk_428 = Pokemon_New(53); v0->unk_D4.unk_00 = 0xFF; v0->unk_418.unk_00 = 0; @@ -136,7 +136,7 @@ static int sub_02097B18 (UnkStruct_020067E8 * param0, int * param1) continue; } - v5 = GetMonData(v0->unk_00->unk_04[v4], MON_DATA_162, 0); + v5 = Pokemon_GetValue(v0->unk_00->unk_04[v4], MON_DATA_162, 0); if (v5 != 0) { v0->unk_04[v5 - 1].unk_00 = v4; @@ -398,8 +398,8 @@ static BOOL sub_02097F38 (UnkStruct_020508D4 * param0) if (v7->unk_22 != 7) { v8 = sub_02097F00(v0->unk_08, v7->unk_22); - sub_02074B30(v8, 162, (u8 *)&v13); - sub_02074B30(v8, 171, sub_0202CA28(v1->unk_20, v13 - 1)); + Pokemon_SetValue(v8, 162, (u8 *)&v13); + Pokemon_SetValue(v8, 171, sub_0202CA28(v1->unk_20, v13 - 1)); v9 = sub_0202CA28(v1->unk_20, v13 - 1); v10 = sub_0202CA64(v9, 0); diff --git a/src/unk_02098218.c b/src/unk_02098218.c index db5d884f0a..d0c0b58c46 100644 --- a/src/unk_02098218.c +++ b/src/unk_02098218.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "constdata/const_020F2DAC.h" #include "constdata/const_020F67FC.h" @@ -37,7 +37,7 @@ #include "unk_0203CC84.h" #include "unk_020508D4.h" #include "unk_02055808.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208694C.h" #include "unk_02092494.h" #include "unk_02098218.h" @@ -120,7 +120,7 @@ static int sub_02098304 (UnkStruct_020067E8 * param0, int * param1) { int v1; - v1 = GetMonData(v0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); sub_02078A4C(v0->unk_04.unk_3C, &v0->unk_6C, v1, 1); @@ -224,9 +224,9 @@ static BOOL sub_0209843C (UnkStruct_020508D4 * param0) int v6 = 11; int v7 = 0; - sub_02074B30(v2, 76, &v7); + Pokemon_SetValue(v2, 76, &v7); sub_0209304C(v2, v3, v4, v5, v6); - sub_02074B30(v2, 179, NULL); + Pokemon_SetValue(v2, 179, NULL); } { @@ -245,18 +245,18 @@ static BOOL sub_0209843C (UnkStruct_020508D4 * param0) UnkStruct_0203CDB0 * v8 = sub_02050A60(param0); int v9; - v9 = GetMonData(v0->unk_0C.unk_00, MON_DATA_SPECIES, 0); + v9 = Pokemon_GetValue(v0->unk_0C.unk_00, MON_DATA_SPECIES, 0); v0->unk_08 = sub_0208712C(11, 1, v9, 10, sub_02025E44(sub_0203D174(v8))); - v0->unk_08->unk_10 = GetMonData(v0->unk_0C.unk_00, MON_DATA_111, NULL); - v0->unk_08->unk_08 = GetMonData(v0->unk_0C.unk_00, MON_DATA_FORM, NULL); + v0->unk_08->unk_10 = Pokemon_GetValue(v0->unk_0C.unk_00, MON_DATA_GENDER, NULL); + v0->unk_08->unk_08 = Pokemon_GetValue(v0->unk_0C.unk_00, MON_DATA_FORM, NULL); sub_02050A38(param0, &Unk_020F2DAC, v0->unk_08); v0->unk_00++; } break; case 4: if (v0->unk_08->unk_14 == 0) { - sub_02074B30(v0->unk_0C.unk_00, 120, v0->unk_08->unk_18); + Pokemon_SetValue(v0->unk_0C.unk_00, 120, v0->unk_08->unk_18); { UnkStruct_0203CDB0 * v10 = sub_02050A60(param0); diff --git a/src/unk_020989DC.c b/src/unk_020989DC.c index adf61f523e..6fdd86e89c 100644 --- a/src/unk_020989DC.c +++ b/src/unk_020989DC.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_020067E8_decl.h" #include "struct_decls/struct_0200B358_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "constdata/const_020F1E88.h" @@ -26,7 +26,7 @@ #include "unk_02025E08.h" #include "unk_020279FC.h" #include "poffin.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_0208C324.h" @@ -504,14 +504,14 @@ void sub_02098EF8 (Poffin * param0, Pokemon * param1) u8 v8[7]; u8 v9[7]; - v2 = sub_02075BCC(param1); + v2 = Pokemon_GetNature(param1); v4 = Unk_020F685C[v2][0]; v5 = Unk_020F685C[v2][1]; Poffin_StoreAttributesToArray(param0, v8); for (v0 = 0; v0 < 6; v0++) { - v7[v0] = GetMonData(param1, MON_DATA_COOL + v0, NULL); + v7[v0] = Pokemon_GetValue(param1, MON_DATA_COOL + v0, NULL); } v1 = 0; @@ -534,13 +534,13 @@ void sub_02098EF8 (Poffin * param0, Pokemon * param1) v7[v0] = 255; } - sub_02074B30(param1, 19 + v0, &v7[v0]); + Pokemon_SetValue(param1, 19 + v0, &v7[v0]); } - v3 = GetMonData(param1, MON_DATA_FRIENDSHIP, NULL); + v3 = Pokemon_GetValue(param1, MON_DATA_FRIENDSHIP, NULL); if (v3 < 255) { ++v3; - sub_02074B30(param1, 9, &v3); + Pokemon_SetValue(param1, 9, &v3); } } diff --git a/src/unk_020997B8.c b/src/unk_020997B8.c index 5c420f9197..387e530a21 100644 --- a/src/unk_020997B8.c +++ b/src/unk_020997B8.c @@ -1,12 +1,12 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020997B8.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020997B8.h" UnkStruct_020997B8 * sub_020997B8 (u32 param0) @@ -32,18 +32,18 @@ u16 * sub_020997D8 (Pokemon * param0, u32 param1) u8 v5; u8 v6, v7, v8; - v3 = (u16)GetMonData(param0, MON_DATA_SPECIES, NULL); - v5 = (u8)GetMonData(param0, MON_DATA_FORM, NULL); - v4 = (u8)GetMonData(param0, MON_DATA_161, NULL); + v3 = (u16)Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v5 = (u8)Pokemon_GetValue(param0, MON_DATA_FORM, NULL); + v4 = (u8)Pokemon_GetValue(param0, MON_DATA_LEVEL, NULL); for (v7 = 0; v7 < 4; v7++) { - v2[v7] = (u16)GetMonData(param0, MON_DATA_MOVE1 + v7, NULL); + v2[v7] = (u16)Pokemon_GetValue(param0, MON_DATA_MOVE1 + v7, NULL); } v0 = Heap_AllocFromHeap(param1, (44 / 2) * 2); v1 = Heap_AllocFromHeap(param1, (44 / 2) * 2); - sub_02077D28(v3, v5, v0); + Pokemon_LoadLevelUpMovesOf(v3, v5, v0); v8 = 0; diff --git a/src/unk_0209BA80.c b/src/unk_0209BA80.c index 7ad8a8b447..d123778d9f 100644 --- a/src/unk_0209BA80.c +++ b/src/unk_0209BA80.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_02039A58.h" @@ -12,7 +12,7 @@ #include "unk_02032798.h" #include "unk_02034198.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209BA80.h" #include "overlay104/ov104_0222ECE8.h" @@ -282,13 +282,13 @@ BOOL sub_0209BC64 (UnkStruct_0209BBA4 * param0, u16 param1, u16 param2) } else { v2 = Party_GetPokemonBySlotIndex(v3, param1); - param0->unk_76[0] = GetMonData(v2, MON_DATA_SPECIES, NULL); - param0->unk_7E[0] = GetMonData(v2, MON_DATA_HELD_ITEM, NULL); + param0->unk_76[0] = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); + param0->unk_7E[0] = Pokemon_GetValue(v2, MON_DATA_HELD_ITEM, NULL); v2 = Party_GetPokemonBySlotIndex(v3, param2); - param0->unk_76[1] = GetMonData(v2, MON_DATA_SPECIES, NULL); - param0->unk_7E[1] = GetMonData(v2, MON_DATA_HELD_ITEM, NULL); + param0->unk_76[1] = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); + param0->unk_7E[1] = Pokemon_GetValue(v2, MON_DATA_HELD_ITEM, NULL); } param0->unk_08[0] = param0->unk_76[0];