Add bugfix to LoadObjectEventPalette

This commit is contained in:
GriffinR 2023-01-18 10:33:39 -05:00
parent 33f3a7c11a
commit a203c03eac

View file

@ -1998,7 +1998,12 @@ static void LoadObjectEventPalette(u16 paletteTag)
{
u16 i = FindObjectEventPaletteIndexByTag(paletteTag);
if (i != OBJ_EVENT_PAL_TAG_NONE) // always true
// FindObjectEventPaletteIndexByTag returns 0xFF on failure, not OBJ_EVENT_PAL_TAG_NONE.
#ifdef BUGFIX
if (i != 0xFF)
#else
if (i != OBJ_EVENT_PAL_TAG_NONE)
#endif
LoadSpritePaletteIfTagExists(&sObjectEventSpritePalettes[i]);
}
@ -2021,6 +2026,7 @@ static u8 LoadSpritePaletteIfTagExists(const struct SpritePalette *spritePalette
void PatchObjectPalette(u16 paletteTag, u8 paletteSlot)
{
// paletteTag is assumed to exist in sObjectEventSpritePalettes
u8 paletteIndex = FindObjectEventPaletteIndexByTag(paletteTag);
LoadPalette(sObjectEventSpritePalettes[paletteIndex].data, 16 * paletteSlot + 0x100, 0x20);