diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/code_8041AD0.c | 9 | ||||
-rw-r--r-- | src/code_8057824.c | 2 | ||||
-rw-r--r-- | src/dungeon_ai.c | 1 | ||||
-rw-r--r-- | src/dungeon_ai_1.c | 2 | ||||
-rw-r--r-- | src/dungeon_ai_attack.c | 1 | ||||
-rw-r--r-- | src/dungeon_ai_attack_1.c | 2 | ||||
-rw-r--r-- | src/dungeon_ai_item_weight.c | 2 | ||||
-rw-r--r-- | src/dungeon_ai_items.c | 2 | ||||
-rw-r--r-- | src/dungeon_ai_movement.c | 2 | ||||
-rw-r--r-- | src/dungeon_capabilities_1.c | 2 | ||||
-rw-r--r-- | src/dungeon_pokemon_attributes.c | 171 | ||||
-rw-r--r-- | src/dungeon_pokemon_attributes_1.c | 161 | ||||
-rw-r--r-- | src/dungeon_visibility.c | 2 | ||||
-rw-r--r-- | src/items.c | 1 | ||||
-rw-r--r-- | src/pokemon_3.c | 1 | ||||
-rw-r--r-- | src/targeting_flags.c | 3 |
16 files changed, 183 insertions, 181 deletions
diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index 0091e9a..e1d3a1a 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -1,7 +1,9 @@ #include "global.h" +#include "constants/direction.h" +#include "constants/type.h" #include "dungeon_entity.h" #include "dungeon_global_data.h" -#include "constants/direction.h" +#include "dungeon_pokemon_attributes.h" struct unkStruct_80420E8 { @@ -16,7 +18,6 @@ extern void sub_804151C(struct DungeonEntity *r0, u32 r1, u8 r2); extern void sub_80416E0(struct DungeonEntity *r0, u32, u32); extern u8 sub_8042768(struct DungeonEntity *r0); extern void sub_806CDD4(struct DungeonEntity *r0, u8, u32); -extern u8 HasType(struct DungeonEntity *r0, u8); extern u32 sub_806F62C(u32); extern void PlaySoundEffect(u32); extern u8 sub_803F428(struct DungeonEntity *r0); @@ -343,10 +344,10 @@ void sub_8041DD8(struct DungeonEntity *r0, s16 r1) u32 temp; temp = r1; - if(HasType(r0, 0xE) != 0) + if(HasType(r0, TYPE_GHOST) != 0) sub_804151C(r0, temp, 1); else - sub_804151C(r0, 0xE, 1); + sub_804151C(r0, TYPE_GHOST, 1); } void nullsub_89(void) diff --git a/src/code_8057824.c b/src/code_8057824.c index 172f949..d763925 100644 --- a/src/code_8057824.c +++ b/src/code_8057824.c @@ -2,6 +2,7 @@ #include "dungeon_global_data.h" #include "dungeon_entity.h" #include "constants/move.h" +#include "moves.h" extern u32 gUnknown_80FCF74; extern u32 gUnknown_80FCF80; @@ -30,7 +31,6 @@ extern void sub_806F370(struct DungeonEntity *r0, struct DungeonEntity *r1, u32, extern u32 gUnknown_80FD018; extern s16 sub_8057600(void*, u32); -extern u32 GetMoveType(void*); bool32 sub_8057824(struct DungeonEntity *param_1, struct DungeonEntity *param_2) { diff --git a/src/dungeon_ai.c b/src/dungeon_ai.c index 263ef16..b2e3b2e 100644 --- a/src/dungeon_ai.c +++ b/src/dungeon_ai.c @@ -4,7 +4,6 @@ #include "constants/ability.h" #include "constants/tactic.h" #include "dungeon_pokemon_attributes.h" -#include "dungeon_pokemon_attributes_1.h" #include "dungeon_util.h" extern void CheckRunAwayVisualFlag(struct DungeonEntity *, bool8 showRunAwayEffect); diff --git a/src/dungeon_ai_1.c b/src/dungeon_ai_1.c index 4550c83..78c899f 100644 --- a/src/dungeon_ai_1.c +++ b/src/dungeon_ai_1.c @@ -3,7 +3,7 @@ #include "constants/status.h" #include "constants/targeting.h" -#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_pokemon_attributes.h" const u8 gTargetingData[3][2][2][2] = { { diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index f0362ed..6e202b5 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -16,7 +16,6 @@ #include "dungeon_global_data.h" #include "dungeon_map_access.h" #include "dungeon_pokemon_attributes.h" -#include "dungeon_pokemon_attributes_1.h" #include "dungeon_random.h" #include "dungeon_random_1.h" #include "dungeon_util.h" diff --git a/src/dungeon_ai_attack_1.c b/src/dungeon_ai_attack_1.c index e846b4b..8a186ea 100644 --- a/src/dungeon_ai_attack_1.c +++ b/src/dungeon_ai_attack_1.c @@ -4,7 +4,7 @@ #include "constants/iq_skill.h" #include "dungeon_global_data.h" #include "dungeon_map_access.h" -#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" bool8 IsTargetStraightAhead(struct DungeonEntity *pokemon, struct DungeonEntity *targetPokemon, s32 facingDir, s32 maxRange) diff --git a/src/dungeon_ai_item_weight.c b/src/dungeon_ai_item_weight.c index 829bc2d..0fe019f 100644 --- a/src/dungeon_ai_item_weight.c +++ b/src/dungeon_ai_item_weight.c @@ -5,7 +5,7 @@ #include "constants/targeting.h" #include "dungeon_ai_1.h" #include "dungeon_map_access.h" -#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" #include "moves.h" #include "number_util.h" diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index 5e60708..183d143 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -15,7 +15,7 @@ #include "dungeon_entity.h" #include "dungeon_global_data.h" #include "dungeon_map_access.h" -#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_random_1.h" #include "dungeon_util.h" diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c index d0e5f7d..5fa6d87 100644 --- a/src/dungeon_ai_movement.c +++ b/src/dungeon_ai_movement.c @@ -12,7 +12,7 @@ #include "dungeon_ai_items.h" #include "dungeon_capabilities_1.h" #include "dungeon_global_data.h" -#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_util.h" #include "dungeon_util_1.h" diff --git a/src/dungeon_capabilities_1.c b/src/dungeon_capabilities_1.c index bbe48bc..e6ec6fa 100644 --- a/src/dungeon_capabilities_1.c +++ b/src/dungeon_capabilities_1.c @@ -11,7 +11,7 @@ #include "dungeon_items.h" #include "dungeon_map_access.h" #include "dungeon_movement.h" -#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" #include "map.h" diff --git a/src/dungeon_pokemon_attributes.c b/src/dungeon_pokemon_attributes.c index 9f01c2b..bd3a1f6 100644 --- a/src/dungeon_pokemon_attributes.c +++ b/src/dungeon_pokemon_attributes.c @@ -1,15 +1,27 @@ #include "global.h" #include "dungeon_pokemon_attributes.h" -#include "dungeon_util.h" #include "constants/ability.h" +#include "constants/dungeon.h" +#include "constants/iq_skill.h" +#include "constants/move_id.h" #include "constants/status.h" +#include "constants/tactic.h" +#include "constants/type.h" +#include "dungeon_global_data.h" +#include "dungeon_items.h" +#include "dungeon_util.h" +#include "dungeon_visibility.h" +#include "moves.h" +#include "pokemon.h" +#include "pokemon_3.h" + +const s16 gItemMasterMinWildLevel[] = {16}; extern u8 gAvailablePokemonNames[]; extern u32 gUnknown_80FC31C; extern u32 gUnknown_80FCEFC; extern u32 gUnknown_80FC2FC; - extern bool8 sub_805744C(struct DungeonEntity *, struct PokemonMove *, u32); extern void SetMessageArgument(char[], struct DungeonEntity*, u32); extern void sub_80522F4(struct DungeonEntity *r1, struct DungeonEntity *r2, u32); @@ -90,3 +102,158 @@ bool8 HasAbility(struct DungeonEntity *pokemon, u8 ability) return FALSE; } } + +bool8 HasType(struct DungeonEntity *pokemon, u8 type) +{ + struct DungeonEntityData *pokemonData = pokemonData = pokemon->entityData; + if (type == TYPE_NONE) + { + return FALSE; + } + if (pokemonData->type1 == type) + { + return TRUE; + } + if (pokemonData->type2 == type) + { + return TRUE; + } + return FALSE; +} + +bool8 CanSeeInvisible(struct DungeonEntity *pokemon) +{ + struct DungeonEntityData *pokemonData = pokemon->entityData; + if (pokemonData->eyesightStatus != EYESIGHT_STATUS_EYEDROPS) + { + if (!HasItem(pokemon, ITEM_ID_GOGGLE_SPECS)) + return FALSE; + else + return TRUE; + } + else + return TRUE; +} + +bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic) +{ + struct DungeonEntityData *pokemonData = pokemon->entityData; + if (pokemonData->isLeader) + { + bool8 isGoTheOtherWay = tactic == TACTIC_GO_THE_OTHER_WAY; + return isGoTheOtherWay; + } + return pokemonData->tactic == tactic; +} + +bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill) +{ + return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill); +} + +bool8 HasIQSkillPair(struct DungeonEntity *pokemon, u8 IQSkill1, u8 IQSkill2) +{ + return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill1 | 1 << IQSkill2); +} + +void LoadIQSkills(struct DungeonEntity *pokemon) +{ + u8 *iVar2; + s32 IQSkill; + struct DungeonEntityData *pokemonData; + + pokemonData = pokemon->entityData; + if (pokemonData->isEnemy) { + iVar2 = pokemonData->IQSkillsEnabled; + SetIQSkill(iVar2, IQ_SKILL_STATUS_CHECKER); + SetIQSkill(iVar2, IQ_SKILL_PP_CHECKER); + SetIQSkill(iVar2, IQ_SKILL_ITEM_CATCHER); + if (pokemonData->isBoss) + SetIQSkill(iVar2, IQ_SKILL_SELF_CURER); + if (pokemonData->level >= *gItemMasterMinWildLevel) + SetIQSkill(iVar2, IQ_SKILL_ITEM_MASTER); + pokemonData->tactic = TACTIC_GO_AFTER_FOES; + } + else { + pokemonData->IQSkillsEnabled[0] = 0; + pokemonData->IQSkillsEnabled[1] = 0; + pokemonData->IQSkillsEnabled[2] = 0; + for(IQSkill = IQ_SKILL_TYPE_ADVANTAGE_MASTER; IQSkill < NUM_IQ_SKILLS; IQSkill++) + { + if (HasIQForSkill(pokemonData->IQ,IQSkill) && + IsIQSkillSet(pokemonData->IQSkillsSelected, 1 << IQSkill)) + { + SetIQSkill(pokemonData->IQSkillsEnabled,IQSkill); + } + } + } +} + +bool8 CanSeeTeammate(struct DungeonEntity * pokemon) +{ + struct DungeonEntity *teamMember; + s32 memberIdx; + + if (pokemon->entityData->isEnemy) { + return FALSE; + } + else + { + for(memberIdx = 0; memberIdx < MAX_TEAM_MEMBERS; memberIdx++) + { + teamMember = gDungeonGlobalData->teamPokemon[memberIdx]; + if (EntityExists(pokemon) && (pokemon != teamMember) && (CanSee(pokemon,teamMember))) + { + return TRUE; + } + } + return FALSE; + } +} + +u8 GetMoveTypeForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove) +{ + if (pokeMove->moveID == MOVE_HIDDEN_POWER) + return pokemon->entityData->hiddenPowerType; + else + return GetMoveType(pokeMove); +} + +s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove) +{ + if(pokeMove->moveID == MOVE_HIDDEN_POWER) + return (pokemon->entityData->hiddenPowerPower + pokeMove->powerBoost); + else + return (GetMovePower(pokeMove) + pokeMove->powerBoost); +} + +bool8 ToolboxEnabled(struct DungeonEntityData *pokemon) +{ + if(!IsToolboxEnabled(pokemon->entityID)) + return FALSE; + return TRUE; +} + +static inline bool8 sub_8071A8C_sub(struct DungeonEntityData *pokemonData) +{ + if(pokemonData->joinLocation == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON || + pokemonData->joinLocation == DUNGEON_RESCUE_TEAM_BASE) + return TRUE; + else + return FALSE; +} + +bool8 sub_8071A8C(struct DungeonEntity *pokemon) +{ + struct DungeonEntityData *pokemonData; + if(EntityExists(pokemon)) + { + pokemonData = pokemon->entityData; + if(pokemonData->clientType != CLIENT_TYPE_CLIENT) + { + if(!sub_8071A8C_sub(pokemonData)) + return TRUE; + } + } + return FALSE; +} diff --git a/src/dungeon_pokemon_attributes_1.c b/src/dungeon_pokemon_attributes_1.c deleted file mode 100644 index c7d3a13..0000000 --- a/src/dungeon_pokemon_attributes_1.c +++ /dev/null @@ -1,161 +0,0 @@ -#include "global.h" -#include "dungeon_pokemon_attributes_1.h" - -#include "constants/dungeon.h" -#include "constants/iq_skill.h" -#include "constants/move_id.h" -#include "constants/status.h" -#include "constants/tactic.h" -#include "dungeon_global_data.h" -#include "dungeon_items.h" -#include "dungeon_util.h" -#include "pokemon.h" -#include "pokemon_3.h" - -const s16 gItemMasterMinWildLevel[] = {16}; - -extern bool8 IsIQSkillSet(u8 *, u32); -extern void SetIQSkill(u8 *param_1, u32 skillIndex); -extern bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex); - -extern bool8 CanSee(struct DungeonEntity *, struct DungeonEntity *); - -extern u8 GetMoveType(struct PokemonMove *move); -extern s32 GetMovePower(struct PokemonMove *move); - -bool8 CanSeeInvisible(struct DungeonEntity *pokemon) -{ - struct DungeonEntityData *pokemonData = pokemon->entityData; - if (pokemonData->eyesightStatus != EYESIGHT_STATUS_EYEDROPS) - { - if (!HasItem(pokemon, ITEM_ID_GOGGLE_SPECS)) - return FALSE; - else - return TRUE; - } - else - return TRUE; -} - -bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic) -{ - struct DungeonEntityData *pokemonData = pokemon->entityData; - if (pokemonData->isLeader) - { - bool8 isGoTheOtherWay = tactic == TACTIC_GO_THE_OTHER_WAY; - return isGoTheOtherWay; - } - return pokemonData->tactic == tactic; -} - -bool8 HasIQSkill(struct DungeonEntity *pokemon, u8 IQSkill) -{ - return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill); -} - -bool8 HasIQSkillPair(struct DungeonEntity *pokemon, u8 IQSkill1, u8 IQSkill2) -{ - return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill1 | 1 << IQSkill2); -} - -void LoadIQSkills(struct DungeonEntity *pokemon) -{ - u8 *iVar2; - s32 IQSkill; - struct DungeonEntityData *pokemonData; - - pokemonData = pokemon->entityData; - if (pokemonData->isEnemy) { - iVar2 = pokemonData->IQSkillsEnabled; - SetIQSkill(iVar2, IQ_SKILL_STATUS_CHECKER); - SetIQSkill(iVar2, IQ_SKILL_PP_CHECKER); - SetIQSkill(iVar2, IQ_SKILL_ITEM_CATCHER); - if (pokemonData->isBoss) - SetIQSkill(iVar2, IQ_SKILL_SELF_CURER); - if (pokemonData->level >= *gItemMasterMinWildLevel) - SetIQSkill(iVar2, IQ_SKILL_ITEM_MASTER); - pokemonData->tactic = TACTIC_GO_AFTER_FOES; - } - else { - pokemonData->IQSkillsEnabled[0] = 0; - pokemonData->IQSkillsEnabled[1] = 0; - pokemonData->IQSkillsEnabled[2] = 0; - for(IQSkill = IQ_SKILL_TYPE_ADVANTAGE_MASTER; IQSkill < NUM_IQ_SKILLS; IQSkill++) - { - if (HasIQForSkill(pokemonData->IQ,IQSkill) && - IsIQSkillSet(pokemonData->IQSkillsSelected, 1 << IQSkill)) - { - SetIQSkill(pokemonData->IQSkillsEnabled,IQSkill); - } - } - } -} - -bool8 CanSeeTeammate(struct DungeonEntity * pokemon) -{ - struct DungeonEntity *teamMember; - s32 memberIdx; - - if (pokemon->entityData->isEnemy) { - return FALSE; - } - else - { - for(memberIdx = 0; memberIdx < MAX_TEAM_MEMBERS; memberIdx++) - { - teamMember = gDungeonGlobalData->teamPokemon[memberIdx]; - if (EntityExists(pokemon) && (pokemon != teamMember) && (CanSee(pokemon,teamMember))) - { - return TRUE; - } - } - return FALSE; - } -} - -u8 GetMoveTypeForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove) -{ - if (pokeMove->moveID == MOVE_HIDDEN_POWER) - return pokemon->entityData->hiddenPowerType; - else - return GetMoveType(pokeMove); -} - -s32 CalculateMovePower(struct DungeonEntity *pokemon, struct PokemonMove *pokeMove) -{ - if(pokeMove->moveID == MOVE_HIDDEN_POWER) - return (pokemon->entityData->hiddenPowerPower + pokeMove->powerBoost); - else - return (GetMovePower(pokeMove) + pokeMove->powerBoost); -} - -bool8 ToolboxEnabled(struct DungeonEntityData *pokemon) -{ - if(!IsToolboxEnabled(pokemon->entityID)) - return FALSE; - return TRUE; -} - -static inline bool8 sub_8071A8C_sub(struct DungeonEntityData *pokemonData) -{ - if(pokemonData->joinLocation == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON || - pokemonData->joinLocation == DUNGEON_RESCUE_TEAM_BASE) - return TRUE; - else - return FALSE; -} - -bool8 sub_8071A8C(struct DungeonEntity *pokemon) -{ - struct DungeonEntityData *pokemonData; - if(EntityExists(pokemon)) - { - pokemonData = pokemon->entityData; - if(pokemonData->clientType != CLIENT_TYPE_CLIENT) - { - if(!sub_8071A8C_sub(pokemonData)) - return TRUE; - } - } - return FALSE; -} diff --git a/src/dungeon_visibility.c b/src/dungeon_visibility.c index 862e1a0..4a76b69 100644 --- a/src/dungeon_visibility.c +++ b/src/dungeon_visibility.c @@ -2,7 +2,7 @@ #include "dungeon_visibility.h" #include "constants/status.h" -#include "dungeon_pokemon_attributes_1.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_range.h" #include "dungeon_util.h" diff --git a/src/items.c b/src/items.c index 999fd7d..4b5a710 100644 --- a/src/items.c +++ b/src/items.c @@ -40,7 +40,6 @@ extern s32 sub_8090FEC(s32 a1, u8* a2, u8 a3); extern void sub_80073B8(u32); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); extern void sub_80078A4(u32, u32, u32, u32, u32); -extern u32 GetMoveType(void*); extern u8* GetUnformattedTypeString(s16); extern void sub_80073E0(u32); extern void xxx_format_and_draw(u32, u32, u8 *, u32, u32); diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 9d28f98..68c894b 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -47,7 +47,6 @@ extern s16 gUnknown_810AC66; // 0x8 // 2, 4, 6, 7, 8, 9, 0xA, 0xD, 0xF, 0x11 extern s32 gUnknown_810AC90[10]; -extern void SetIQSkill(u8 *, u32); extern void AddSprite(u16 *, u32, u32, u32); extern void xxx_save_poke_sub_4_80902F4(struct unkStruct_8094924*, struct unkPokeSubStruct_4*); diff --git a/src/targeting_flags.c b/src/targeting_flags.c index d342d51..f315cdf 100644 --- a/src/targeting_flags.c +++ b/src/targeting_flags.c @@ -3,10 +3,9 @@ #include "constants/move_id.h" #include "constants/type.h" +#include "dungeon_pokemon_attributes.h" #include "moves.h" -extern bool8 HasType(struct DungeonEntity *pokemon, u8 type); - s16 GetMoveTargetingFlagsForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *move, u32 isAI) { if (move->moveID == MOVE_CURSE && !isAI && !HasType(pokemon, TYPE_GHOST)) |