mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-06 17:43:19 +01:00
fix updating last used ball when run out of item id
This commit is contained in:
parent
d28ac33b0e
commit
542f0accf5
@ -729,6 +729,12 @@ u8 GetMegaIndicatorSpriteId(u32 healthboxSpriteId)
|
||||
return gSprites[spriteId].hOther_IndicatorSpriteId;
|
||||
}
|
||||
|
||||
static void InitLastUsedBallAssets(void)
|
||||
{
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
}
|
||||
|
||||
u8 CreateBattlerHealthboxSprites(u8 battlerId)
|
||||
{
|
||||
s16 data6 = 0;
|
||||
@ -3195,6 +3201,14 @@ bool32 CanThrowLastUsedBall(void)
|
||||
|
||||
void TryAddLastUsedBallItemSprites(void)
|
||||
{
|
||||
if (gSaveBlock2Ptr->lastUsedBall != ITEM_NONE && !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1))
|
||||
{
|
||||
// we're out of the last used ball, so just set it to the first ball in the bag
|
||||
// we have to compact the bag first bc it is typically only compacted when you open it
|
||||
CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]);
|
||||
gSaveBlock2Ptr->lastUsedBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId;
|
||||
}
|
||||
|
||||
if (CanThrowBall() != 0
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
|| !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1))
|
||||
|
Loading…
Reference in New Issue
Block a user