From db9460c67092fc4950578e4aaa5216600488e0ce Mon Sep 17 00:00:00 2001 From: FosterProgramming Date: Thu, 13 Nov 2025 11:36:26 +0100 Subject: [PATCH] Fix wrong palette for types sprites in hgss dex after catching mon (#8153) Co-authored-by: Bassoonian --- src/pokedex_plus_hgss.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pokedex_plus_hgss.c b/src/pokedex_plus_hgss.c index d02eb0eda1..03cf7bb8d2 100644 --- a/src/pokedex_plus_hgss.c +++ b/src/pokedex_plus_hgss.c @@ -4088,6 +4088,12 @@ static void UNUSED HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused) #define tPersonalityLo data[14] #define tPersonalityHi data[15] +// Types palettes need to be loaded at a different slot than anticipated by gTypesInfo +// to avoid overlapping with caught mon sprite palette slot +// Normal type info palette slots: 13, 14 and 15 +// Caught mon palette slot: 15 +#define TYPE_INFO_PALETTE_NUM_OFFSET -1 + void Task_DisplayCaughtMonDexPageHGSS(u8 taskId) { u8 spriteId; @@ -4349,9 +4355,9 @@ static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId) sprite = &gSprites[sPokedexView->typeIconSpriteIds[spriteArrayId]]; StartSpriteAnim(sprite, typeId); if (typeId < NUMBER_OF_MON_TYPES) - sprite->oam.paletteNum = gTypesInfo[typeId].palette; + sprite->oam.paletteNum = gTypesInfo[typeId].palette + TYPE_INFO_PALETTE_NUM_OFFSET; else - sprite->oam.paletteNum = sContestCategoryToOamPaletteNum[typeId - NUMBER_OF_MON_TYPES]; + sprite->oam.paletteNum = sContestCategoryToOamPaletteNum[typeId - NUMBER_OF_MON_TYPES] + TYPE_INFO_PALETTE_NUM_OFFSET; sprite->x = x + 16; sprite->y = y + 8; SetSpriteInvisibility(spriteArrayId, FALSE); @@ -4392,7 +4398,8 @@ static void CreateTypeIconSprites(void) u8 i; LoadCompressedSpriteSheet(&gSpriteSheet_MoveTypes); - LoadPalette(gMoveTypes_Pal, 0x1D0, 0x60); + u32 paletteNum = gTypesInfo[TYPE_NORMAL].palette + TYPE_INFO_PALETTE_NUM_OFFSET; + LoadPalette(gMoveTypes_Pal, OBJ_PLTT_ID(paletteNum), 3 * PLTT_SIZE_4BPP); for (i = 0; i < 2; i++) { if (sPokedexView->typeIconSpriteIds[i] == 0xFF) @@ -4572,6 +4579,7 @@ static u16 CreateSizeScreenTrainerPic(u16 species, s16 x, s16 y, s8 paletteSlot) return CreateTrainerPicSprite(species, TRUE, x, y, paletteSlot, TAG_NONE); } +#undef TYPE_INFO_PALETTE_NUM_OFFSET //************************************ //* *