From e42498ab40f72a136a20c277442a209d00701934 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Fri, 17 Jun 2022 18:06:37 -0300 Subject: [PATCH] Add bugfix from bugs_and_glitches.md to BUGFIX Item flicker fix now in `BUGFIX` Supersedes and resolves #1680 Fixes #1215 Fixes #1514 --- src/item_menu_icons.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index b1e163499..c436f0feb 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -544,7 +544,20 @@ void AddBagItemIconSprite(u16 itemId, u8 id) void RemoveBagItemIconSprite(u8 id) { - RemoveBagSprite(id + ITEMMENUSPRITE_ITEM); + #ifdef BUGFIX + u8 *spriteId = &gBagMenu->spriteIds[ITEMMENUSPRITE_ITEM]; + + if (spriteId[id ^ 1] != SPRITE_NONE) + gSprites[spriteId[id ^ 1]].invisible = TRUE; + + if (spriteId[id] != SPRITE_NONE) + { + DestroySpriteAndFreeResources(&gSprites[spriteId[id]]); + spriteId[id] = SPRITE_NONE; + } + #else + RemoveBagSprite(id + ITEMMENUSPRITE_ITEM); + #endif } void CreateItemMenuSwapLine(void)