Skip to content

Commit

Permalink
Misc. renames and cleanup, move data block structs
Browse files Browse the repository at this point in the history
  • Loading branch information
wildfire248 committed Sep 10, 2023
1 parent 70fe525 commit fc5b676
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 197 deletions.
40 changes: 30 additions & 10 deletions include/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ BOOL DecryptBoxMon(BoxPokemon *boxMon);
BOOL EncryptBoxMon(BoxPokemon *boxMon, BOOL encrypt);

void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID);

// TODO make this static?
void sub_02073E18(BoxPokemon *boxMon, 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);
Expand Down Expand Up @@ -385,7 +381,7 @@ u8 GetMonPersonalityShininess(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, int param3);
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);

/**
Expand All @@ -399,7 +395,7 @@ u8 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, int param2);
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);
Expand Down Expand Up @@ -443,7 +439,7 @@ u8 GetBoxMonForm(BoxPokemon *boxMon);
*/
BoxPokemon *GetBoxMon(Pokemon *mon);

u8 sub_02076B14(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);
Expand Down Expand Up @@ -568,9 +564,33 @@ u16 sub_020775C4(u16 param0);
void sub_020775EC(Pokemon *src, Pokemon *dest);
void sub_02077604(BoxPokemon *src, BoxPokemon *dest);
void sub_02077618(Pokemon *src, BoxPokemon *dest);
s8 sub_0207762C(Pokemon *mon, int param1);
s8 sub_02077634(BoxPokemon *boxMon, int param1);
s8 sub_02077648(u32 monPersonality, int param1);

/**
* @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 GetMonFlavorAffinity(Pokemon *mon, int flavor);

/**
* @brief Gets the affinitiy of a given BoxPokemon to a given flavor
*
* @param boxMon
* @param flavor
* @return 1 if liked flavor, -1 if disliked flavor, else 0
*/
s8 GetBoxMonFlavorAffinity(BoxPokemon *boxMon, 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 GetMonPersonalityFlavorAffinity(u32 monPersonality, int flavor);

/**
* @brief Gets all moves that the given pokemon species and form can learn by leveling up
Expand Down
93 changes: 89 additions & 4 deletions include/struct_defs/box_pokemon.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,95 @@
#ifndef POKEPLATINUM_BOX_POKEMON_H
#define POKEPLATINUM_BOX_POKEMON_H

#include "struct_defs/pokemon_data_block_b.h"
#include "struct_defs/pokemon_data_block_c.h"
#include "struct_defs/pokemon_data_block_d.h"
#include "struct_defs/pokemon_data_block_a.h"
/**
* @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;

typedef union {
PokemonDataBlockA blockA;
Expand Down
31 changes: 0 additions & 31 deletions include/struct_defs/pokemon_data_block_a.h

This file was deleted.

29 changes: 0 additions & 29 deletions include/struct_defs/pokemon_data_block_b.h

This file was deleted.

14 changes: 0 additions & 14 deletions include/struct_defs/pokemon_data_block_c.h

This file was deleted.

25 changes: 0 additions & 25 deletions include/struct_defs/pokemon_data_block_d.h

This file was deleted.

Loading

0 comments on commit fc5b676

Please sign in to comment.