mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-28 03:34:22 -05:00
fix some functions using static inlines
This commit is contained in:
@@ -94,4 +94,19 @@ static inline bool8 MoveFlagExists(Move *move)
|
||||
return (move->moveFlags & MOVE_FLAG_EXISTS);
|
||||
}
|
||||
|
||||
static inline bool8 MoveFlagLinkChain(Move *move)
|
||||
{
|
||||
return (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN);
|
||||
}
|
||||
|
||||
static inline bool8 MoveFlagDisabled(Move *move)
|
||||
{
|
||||
return (move->moveFlags & MOVE_FLAG_DISABLED);
|
||||
}
|
||||
|
||||
static inline bool8 MoveFlagSealed(Move *move)
|
||||
{
|
||||
return (move->moveFlags2 & MOVE_FLAG_SEALED);
|
||||
}
|
||||
|
||||
#endif // GUARD_MOVES_H
|
||||
|
||||
@@ -58,7 +58,6 @@ void sub_8092404(u8 r0, u16 *r1, bool8 allowLeader, bool8 allowPartner)
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < NUM_MONSTERS; i++) {
|
||||
|
||||
if (PokemonFlag1(&gRecruitedPokemonRef->pokemon[i])
|
||||
&& (!IsMonTeamLeader(&gRecruitedPokemonRef->pokemon[i]) || allowLeader)
|
||||
&& (!IsMonPartner(&gRecruitedPokemonRef->pokemon[i]) || allowPartner)
|
||||
@@ -69,7 +68,6 @@ void sub_8092404(u8 r0, u16 *r1, bool8 allowLeader, bool8 allowPartner)
|
||||
r1[count] = i;
|
||||
count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
r1[count] = 0xFFFF;
|
||||
|
||||
@@ -97,7 +97,7 @@ bool8 sub_80571F0(Entity * pokemon, Move *move)
|
||||
bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance)
|
||||
{
|
||||
bool8 uVar2;
|
||||
if (!sub_8044B28() && EntityExists(pokemon) && EntityExists(target) &&
|
||||
if (!sub_8044B28() && EntityExists(pokemon) && EntityExists(target) &&
|
||||
(target->info->unk158 != 0) &&
|
||||
(target->info->HP != 0)) {
|
||||
if (chance != 0) {
|
||||
@@ -140,45 +140,25 @@ bool8 sub_8057308(Entity *pokemon, s32 chance)
|
||||
|
||||
bool8 CanAIUseMove(Entity *pokemon, s32 moveIndex, bool8 hasPPChecker)
|
||||
{
|
||||
EntityInfo *pokemonInfo = pokemon->info;
|
||||
Move *move = &pokemonInfo->moves.moves[moveIndex];
|
||||
s32 i;
|
||||
if (!(move->moveFlags & MOVE_FLAG_EXISTS))
|
||||
{
|
||||
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
|
||||
Move *move = &pokemonInfo->moves.moves[moveIndex];
|
||||
if (!MoveFlagExists(move))
|
||||
return FALSE;
|
||||
}
|
||||
if (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)
|
||||
{
|
||||
if (MoveFlagLinkChain(move) || MoveFlagDisabled(move) || MoveFlagSealed(move))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++) {
|
||||
if (CanMonsterUseMove(pokemon, move, hasPPChecker))
|
||||
return TRUE;
|
||||
move++;
|
||||
if (move >= &pokemonInfo->moves.moves[MAX_MON_MOVES])
|
||||
break;
|
||||
if (!(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN))
|
||||
break;
|
||||
}
|
||||
if (move->moveFlags & MOVE_FLAG_DISABLED ||
|
||||
move->moveFlags2 & MOVE_FLAG_SEALED)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
goto initMoveIndex;
|
||||
returnTrue:
|
||||
return TRUE;
|
||||
initMoveIndex:
|
||||
i = 0;
|
||||
goto checkMoveUsable;
|
||||
incMoveIndex:
|
||||
i++;
|
||||
checkMoveUsable:
|
||||
if (i >= MAX_MON_MOVES)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (CanMonsterUseMove(pokemon, move, hasPPChecker))
|
||||
{
|
||||
goto returnTrue;
|
||||
}
|
||||
move++;
|
||||
if ((u32) move >= (u32) &pokemonInfo->moves.struggleMoveFlags || !(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
goto incMoveIndex;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 CanMonsterUseMove(Entity *pokemon, Move *move, bool8 hasPPChecker)
|
||||
@@ -223,7 +203,7 @@ bool8 CanMonsterUseMove(Entity *pokemon, Move *move, bool8 hasPPChecker)
|
||||
bool8 sub_805744C(Entity * pokemon, Move *move, bool8 param_3)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
|
||||
entityInfo = pokemon->info;
|
||||
if (move->id != MOVE_REGULAR_ATTACK) {
|
||||
if (((move->moveFlags & MOVE_FLAG_DISABLED)) || ((move->moveFlags2 & MOVE_FLAG_EXISTS))) {
|
||||
|
||||
Reference in New Issue
Block a user