Skip to content

Commit

Permalink
Rewrote GetItemIconPicOrPalette (again) to factor in customized HM co…
Browse files Browse the repository at this point in the history
…unts (#4487)

* GetItemIconPicOrPalette factors custom HM counts

* remove the extra else
  • Loading branch information
Sneed69 authored May 9, 2024
1 parent 5538095 commit 0a64ab1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/item_icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,16 @@ u8 AddCustomItemIconSprite(const struct SpriteTemplate *customSpriteTemplate, u1
const void *GetItemIconPicOrPalette(u16 itemId, u8 which)
{
if (itemId == ITEM_LIST_END)
itemId = ITEMS_COUNT; // Use last icon, the "return to field" arrow
else if (itemId >= ITEMS_COUNT)
itemId = 0;
else if (itemId >= ITEM_TM01 && itemId <= ITEM_HM08 && which)
return gTypesInfo[gMovesInfo[gItemsInfo[itemId].secondaryId].type].paletteTMHM;
else if (itemId >= ITEM_TM01 && itemId < ITEM_HM01)
return gItemIcon_TM;
else if (itemId >= ITEM_HM01 && itemId <= ITEM_HM08)
return gItemIconTable[ITEMS_COUNT][which]; // Use last icon, the "return to field" arrow
if (itemId >= ITEMS_COUNT)
return gItemIconTable[0][which];
if (itemId >= ITEM_TM01 && itemId < ITEM_HM01 + NUM_HIDDEN_MACHINES)
{
if (which)
return gTypesInfo[gMovesInfo[gItemsInfo[itemId].secondaryId].type].paletteTMHM;
if (itemId < ITEM_TM01 + NUM_TECHNICAL_MACHINES)
return gItemIcon_TM;
return gItemIcon_HM;

}
return gItemIconTable[itemId][which];
}

0 comments on commit 0a64ab1

Please sign in to comment.