Fixed lag and icons getting stuck when giving an item from the bag
This commit is contained in:
parent
1f559df27d
commit
9114f3d1dc
@ -569,6 +569,7 @@ EWRAM_DATA static bool8 sIsMonBeingMoved = 0;
|
|||||||
EWRAM_DATA static u8 sMovingMonOrigBoxId = 0;
|
EWRAM_DATA static u8 sMovingMonOrigBoxId = 0;
|
||||||
EWRAM_DATA static u8 sMovingMonOrigBoxPos = 0;
|
EWRAM_DATA static u8 sMovingMonOrigBoxPos = 0;
|
||||||
EWRAM_DATA static bool8 sAutoActionOn = 0;
|
EWRAM_DATA static bool8 sAutoActionOn = 0;
|
||||||
|
EWRAM_DATA static bool8 sJustOpenedBag = 0;
|
||||||
|
|
||||||
// Main tasks
|
// Main tasks
|
||||||
static void EnterPokeStorage(u8);
|
static void EnterPokeStorage(u8);
|
||||||
@ -3100,6 +3101,7 @@ static void Task_TakeItemForMoving(u8 taskId)
|
|||||||
StartCursorAnim(CURSOR_ANIM_OPEN);
|
StartCursorAnim(CURSOR_ANIM_OPEN);
|
||||||
TakeItemFromMon(sInPartyMenu ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetCursorPosition());
|
TakeItemFromMon(sInPartyMenu ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetCursorPosition());
|
||||||
sStorage->state++;
|
sStorage->state++;
|
||||||
|
sJustOpenedBag = FALSE;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (!IsItemIconAnimActive())
|
if (!IsItemIconAnimActive())
|
||||||
@ -3619,6 +3621,7 @@ static void Task_GiveItemFromBag(u8 taskId)
|
|||||||
sWhichToReshow = SCREEN_CHANGE_ITEM_FROM_BAG - 1;
|
sWhichToReshow = SCREEN_CHANGE_ITEM_FROM_BAG - 1;
|
||||||
sStorage->screenChangeType = SCREEN_CHANGE_ITEM_FROM_BAG;
|
sStorage->screenChangeType = SCREEN_CHANGE_ITEM_FROM_BAG;
|
||||||
SetPokeStorageTask(Task_ChangeScreen);
|
SetPokeStorageTask(Task_ChangeScreen);
|
||||||
|
sJustOpenedBag = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -6968,8 +6971,6 @@ static void SetDisplayMonData(void *pokemon, u8 mode)
|
|||||||
{
|
{
|
||||||
if (sStorage->displayMonSpecies == SPECIES_NIDORAN_F || sStorage->displayMonSpecies == SPECIES_NIDORAN_M)
|
if (sStorage->displayMonSpecies == SPECIES_NIDORAN_F || sStorage->displayMonSpecies == SPECIES_NIDORAN_M)
|
||||||
gender = MON_GENDERLESS;
|
gender = MON_GENDERLESS;
|
||||||
|
|
||||||
SetMonFormPSS(pokemon);
|
|
||||||
|
|
||||||
StringCopyPadded(sStorage->displayMonNameText, sStorage->displayMonName, CHAR_SPACE, 5);
|
StringCopyPadded(sStorage->displayMonNameText, sStorage->displayMonName, CHAR_SPACE, 5);
|
||||||
|
|
||||||
@ -7019,6 +7020,7 @@ static void SetDisplayMonData(void *pokemon, u8 mode)
|
|||||||
StringCopyPadded(sStorage->displayMonItemName, ItemId_GetName(sStorage->displayMonItemId), CHAR_SPACE, 8);
|
StringCopyPadded(sStorage->displayMonItemName, ItemId_GetName(sStorage->displayMonItemId), CHAR_SPACE, 8);
|
||||||
else
|
else
|
||||||
StringFill(sStorage->displayMonItemName, CHAR_SPACE, 8);
|
StringFill(sStorage->displayMonItemName, CHAR_SPACE, 8);
|
||||||
|
SetMonFormPSS(pokemon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10110,15 +10112,19 @@ void UpdateSpeciesSpritePSS(struct BoxPokemon *boxMon)
|
|||||||
LoadDisplayMonGfx(species, pid);
|
LoadDisplayMonGfx(species, pid);
|
||||||
|
|
||||||
// Recreate icon sprite
|
// Recreate icon sprite
|
||||||
if (sInPartyMenu)
|
if (!sJustOpenedBag)
|
||||||
{
|
{
|
||||||
DestroyAllPartyMonIcons();
|
if (sInPartyMenu)
|
||||||
CreatePartyMonsSprites(TRUE);
|
{
|
||||||
}
|
DestroyAllPartyMonIcons();
|
||||||
else
|
CreatePartyMonsSprites(TRUE);
|
||||||
{
|
}
|
||||||
DestroyBoxMonIcon(sStorage->boxMonsSprites[sCursorPosition]);
|
else
|
||||||
CreateBoxMonIconAtPos(sCursorPosition);
|
{
|
||||||
SetBoxMonIconObjMode(sCursorPosition, GetMonData(boxMon, MON_DATA_HELD_ITEM) == ITEM_NONE);
|
DestroyBoxMonIcon(sStorage->boxMonsSprites[sCursorPosition]);
|
||||||
|
CreateBoxMonIconAtPos(sCursorPosition);
|
||||||
|
SetBoxMonIconObjMode(sCursorPosition, GetMonData(boxMon, MON_DATA_HELD_ITEM) == ITEM_NONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
sJustOpenedBag = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user