Use more specific enum names for throwable Balls

This commit is contained in:
sphericalice 2021-12-05 23:17:44 +00:00
parent 3db871c49a
commit 5c02facde4
2 changed files with 15 additions and 15 deletions

View File

@ -35,10 +35,10 @@ u8 CanUseDigOrEscapeRopeOnCurMap(void);
u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId); u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId);
enum { enum {
BALL_FAIL_TWO_PRESENT_MONS, BALL_THROW_UNABLE_TWO_MONS,
BALL_FAIL_NO_ROOM, BALL_THROW_UNABLE_NO_ROOM,
BALL_FAIL_SEMI_INVULNERABLE, BALL_THROW_UNABLE_SEMI_INVULNERABLE,
BALL_SUCCESS, BALL_THROW_ABLE,
}; };
bool32 CanThrowBall(void); bool32 CanThrowBall(void);

View File

@ -936,33 +936,33 @@ void ItemUseOutOfBattle_EvolutionStone(u8 taskId)
SetUpItemUseCallback(taskId); SetUpItemUseCallback(taskId);
} }
static u32 GetBallThrowFailState(void) static u32 GetBallThrowableState(void)
{ {
if (IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) if (IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
&& IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))) && IsBattlerAlive(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)))
return BALL_FAIL_TWO_PRESENT_MONS; return BALL_THROW_UNABLE_TWO_MONS;
else if (IsPlayerPartyAndPokemonStorageFull() == TRUE) else if (IsPlayerPartyAndPokemonStorageFull() == TRUE)
return BALL_FAIL_NO_ROOM; return BALL_THROW_UNABLE_NO_ROOM;
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4 #if B_SEMI_INVULNERABLE_CATCH >= GEN_4
else if (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE) else if (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE)
return BALL_FAIL_SEMI_INVULNERABLE; return BALL_THROW_UNABLE_SEMI_INVULNERABLE;
#endif #endif
return BALL_SUCCESS; return BALL_THROW_ABLE;
} }
bool32 CanThrowBall(void) bool32 CanThrowBall(void)
{ {
return (GetBallThrowFailState() == BALL_SUCCESS); return (GetBallThrowableState() == BALL_THROW_ABLE);
} }
static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two Pokémon out there!\p"); static const u8 sText_CantThrowPokeBall_TwoMons[] = _("Cannot throw a ball!\nThere are two Pokémon out there!\p");
static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p"); static const u8 sText_CantThrowPokeBall_SemiInvulnerable[] = _("Cannot throw a ball!\nThere's no Pokémon in sight!\p");
void ItemUseInBattle_PokeBall(u8 taskId) void ItemUseInBattle_PokeBall(u8 taskId)
{ {
switch (GetBallThrowFailState()) switch (GetBallThrowableState())
{ {
case BALL_SUCCESS: case BALL_THROW_ABLE:
default: default:
RemoveBagItem(gSpecialVar_ItemId, 1); RemoveBagItem(gSpecialVar_ItemId, 1);
if (!InBattlePyramid()) if (!InBattlePyramid())
@ -970,20 +970,20 @@ void ItemUseInBattle_PokeBall(u8 taskId)
else else
CloseBattlePyramidBag(taskId); CloseBattlePyramidBag(taskId);
break; break;
case BALL_FAIL_TWO_PRESENT_MONS: case BALL_THROW_UNABLE_TWO_MONS:
if (!InBattlePyramid()) if (!InBattlePyramid())
DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_TwoMons, CloseItemMessage); DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_TwoMons, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_TwoMons, Task_CloseBattlePyramidBagMessage);
break; break;
case BALL_FAIL_NO_ROOM: case BALL_THROW_UNABLE_NO_ROOM:
if (!InBattlePyramid()) if (!InBattlePyramid())
DisplayItemMessage(taskId, 1, gText_BoxFull, CloseItemMessage); DisplayItemMessage(taskId, 1, gText_BoxFull, CloseItemMessage);
else else
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
break; break;
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4 #if B_SEMI_INVULNERABLE_CATCH >= GEN_4
case BALL_FAIL_SEMI_INVULNERABLE: case BALL_THROW_UNABLE_SEMI_INVULNERABLE:
if (!InBattlePyramid()) if (!InBattlePyramid())
DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage); DisplayItemMessage(taskId, 1, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage);
else else