Optimized so it only changes forms when moving items.

This commit is contained in:
Eduardo Quezada D'Ottone 2021-09-30 21:55:21 -03:00
parent b60aab1f6a
commit 0fd9d2c0d5

View File

@ -3799,9 +3799,16 @@ static void GiveChosenBagItem(void)
{
u8 pos = GetCursorPosition();
if (sInPartyMenu)
{
struct Pokemon *mon = &gPlayerParty[pos];
SetMonData(&gPlayerParty[pos], MON_DATA_HELD_ITEM, &itemId);
SetMonFormPSS(&mon->box);
}
else
{
SetCurrentBoxMonData(pos, MON_DATA_HELD_ITEM, &itemId);
SetMonFormPSS(&gPokemonStoragePtr->boxes[StorageGetCurrentBox()][pos]);
}
RemoveBagItem(itemId, 1);
}
@ -7020,7 +7027,6 @@ static void SetDisplayMonData(void *pokemon, u8 mode)
StringCopyPadded(sStorage->displayMonItemName, ItemId_GetName(sStorage->displayMonItemId), CHAR_SPACE, 8);
else
StringFill(sStorage->displayMonItemName, CHAR_SPACE, 8);
SetMonFormPSS(pokemon);
}
}
@ -8860,11 +8866,14 @@ static void TakeItemFromMon(u8 cursorArea, u8 cursorPos)
{
SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &itemId);
SetBoxMonIconObjMode(cursorPos, 1);
SetMonFormPSS(&gPokemonStoragePtr->boxes[StorageGetCurrentBox()][cursorPos]);
}
else
{
struct Pokemon *mon = &gPlayerParty[cursorPos];
SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &itemId);
SetPartyMonIconObjMode(cursorPos, 1);
SetMonFormPSS(&mon->box);
}
sStorage->movingItemId = sStorage->displayMonItemId;
@ -8899,12 +8908,15 @@ static void SwapItemsWithMon(u8 cursorArea, u8 cursorPos)
itemId = GetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM);
SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &sStorage->movingItemId);
sStorage->movingItemId = itemId;
SetMonFormPSS(&gPokemonStoragePtr->boxes[StorageGetCurrentBox()][cursorPos]);
}
else
{
struct Pokemon *mon = &gPlayerParty[cursorPos];
itemId = GetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM);
SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &sStorage->movingItemId);
sStorage->movingItemId = itemId;
SetMonFormPSS(&mon->box);
}
id = GetItemIconIdxByPosition(CURSOR_AREA_IN_HAND, 0);
@ -8926,11 +8938,14 @@ static void GiveItemToMon(u8 cursorArea, u8 cursorPos)
{
SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &sStorage->movingItemId);
SetBoxMonIconObjMode(cursorPos, 0);
SetMonFormPSS(&gPokemonStoragePtr->boxes[StorageGetCurrentBox()][cursorPos]);
}
else
{
struct Pokemon *mon = &gPlayerParty[cursorPos];
SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &sStorage->movingItemId);
SetPartyMonIconObjMode(cursorPos, 0);
SetMonFormPSS(&mon->box);
}
}
@ -8950,11 +8965,14 @@ static void MoveItemFromMonToBag(u8 cursorArea, u8 cursorPos)
{
SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &itemId);
SetBoxMonIconObjMode(cursorPos, 1);
SetMonFormPSS(&gPokemonStoragePtr->boxes[StorageGetCurrentBox()][cursorPos]);
}
else
{
struct Pokemon *mon = &gPlayerParty[cursorPos];
SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &itemId);
SetPartyMonIconObjMode(cursorPos, 1);
SetMonFormPSS(&mon->box);
}
}