Add gBallItemIds Array (#7905)

This commit is contained in:
Marky 2025-10-10 10:09:19 +01:00 committed by GitHub
parent d646b975ae
commit daedfd5e62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 6 deletions

View File

@ -45,6 +45,7 @@ enum {
extern const struct CompressedSpriteSheet gBallSpriteSheets[];
extern const struct SpritePalette gBallSpritePalettes[];
extern const struct SpriteTemplate gBallSpriteTemplates[];
extern const u16 gBallItemIds[];
#define POKEBALL_PLAYER_SENDOUT 0xFF
#define POKEBALL_OPPONENT_SENDOUT 0xFE

View File

@ -3156,12 +3156,10 @@ static void DebugAction_PCBag_Fill_PocketItems(u8 taskId)
static void DebugAction_PCBag_Fill_PocketPokeBalls(u8 taskId)
{
u16 ballId;
for (ballId = BALL_STRANGE; ballId < POKEBALL_COUNT; ballId++)
for (enum PokeBall ballId = BALL_STRANGE; ballId < POKEBALL_COUNT; ballId++)
{
if (CheckBagHasSpace(ballId, MAX_BAG_ITEM_CAPACITY))
AddBagItem(ballId, MAX_BAG_ITEM_CAPACITY);
AddBagItem(gBallItemIds[ballId], MAX_BAG_ITEM_CAPACITY);
}
}

View File

@ -235,9 +235,9 @@ bool32 HasAtLeastOneBerry(void)
bool32 HasAtLeastOnePokeBall(void)
{
for (u32 ballId = BALL_STRANGE; ballId < POKEBALL_COUNT; ballId++)
for (enum PokeBall ballId = BALL_STRANGE; ballId < POKEBALL_COUNT; ballId++)
{
if (CheckBagHasItem(ballId, 1) == TRUE)
if (CheckBagHasItem(gBallItemIds[ballId], 1) == TRUE)
return TRUE;
}
return FALSE;

View File

@ -544,6 +544,38 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] =
#define tBattler data[3]
#define tOpponentBattler data[4]
const u16 gBallItemIds[POKEBALL_COUNT] =
{
[BALL_STRANGE] = ITEM_STRANGE_BALL,
[BALL_POKE] = ITEM_POKE_BALL,
[BALL_GREAT] = ITEM_GREAT_BALL,
[BALL_ULTRA] = ITEM_ULTRA_BALL,
[BALL_MASTER] = ITEM_MASTER_BALL,
[BALL_PREMIER] = ITEM_PREMIER_BALL,
[BALL_HEAL] = ITEM_HEAL_BALL,
[BALL_NET] = ITEM_NET_BALL,
[BALL_NEST] = ITEM_NEST_BALL,
[BALL_DIVE] = ITEM_DIVE_BALL,
[BALL_DUSK] = ITEM_DUSK_BALL,
[BALL_TIMER] = ITEM_TIMER_BALL,
[BALL_QUICK] = ITEM_QUICK_BALL,
[BALL_REPEAT] = ITEM_REPEAT_BALL,
[BALL_LUXURY] = ITEM_LUXURY_BALL,
[BALL_LEVEL] = ITEM_LEVEL_BALL,
[BALL_LURE] = ITEM_LURE_BALL,
[BALL_MOON] = ITEM_MOON_BALL,
[BALL_FRIEND] = ITEM_FRIEND_BALL,
[BALL_LOVE] = ITEM_LOVE_BALL,
[BALL_FAST] = ITEM_FAST_BALL,
[BALL_HEAVY] = ITEM_HEAVY_BALL,
[BALL_DREAM] = ITEM_DREAM_BALL,
[BALL_SAFARI] = ITEM_SAFARI_BALL,
[BALL_SPORT] = ITEM_SPORT_BALL,
[BALL_PARK] = ITEM_PARK_BALL,
[BALL_BEAST] = ITEM_BEAST_BALL,
[BALL_CHERISH] = ITEM_CHERISH_BALL,
};
u8 DoPokeballSendOutAnimation(u32 battler, s16 pan, u8 kindOfThrow)
{
u8 taskId;