From d6bac9895d4681c0916541e1aac27c2dba955a53 Mon Sep 17 00:00:00 2001 From: Ariel A <24759293+aarant@users.noreply.github.com> Date: Sat, 3 Sep 2022 15:23:49 -0400 Subject: [PATCH] Fixed shadow palette during contests. --- src/contest_util.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/contest_util.c b/src/contest_util.c index d8726d860f..6289f2cdc5 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -2505,6 +2505,12 @@ void SetLinkContestPlayerGfx(void) } } +// copied from event_object_movement +#define OBJ_EVENT_PAL_TAG_BRENDAN 0x1100 +#define OBJ_EVENT_PAL_TAG_MAY 0x1110 +#define OBJ_EVENT_PAL_TAG_RS_BRENDAN 0x1122 +#define OBJ_EVENT_PAL_TAG_RS_MAY 0x1123 + void LoadLinkContestPlayerPalettes(void) { int i; @@ -2513,28 +2519,28 @@ void LoadLinkContestPlayerPalettes(void) struct Sprite *sprite; static const u8 sContestantLocalIds[CONTESTANT_COUNT] = { 3, 4, 5, 14 }; - gReservedSpritePaletteCount = 12; + // gReservedSpritePaletteCount = 12; + // TODO: Does dynamically allocating link player palettes break link contests? if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) { for (i = 0; i < gNumLinkContestPlayers; i++) { objectEventId = GetObjectEventIdByLocalIdAndMap(sContestantLocalIds[i], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); sprite = &gSprites[gObjectEvents[objectEventId].spriteId]; - sprite->oam.paletteNum = 6 + i; version = (u8)gLinkPlayers[i].version; if (version == VERSION_RUBY || version == VERSION_SAPPHIRE) { if (gLinkPlayers[i].gender == MALE) - LoadPalette(gObjectEventPal_RubySapphireBrendan, 0x160 + i * 0x10, 0x20); + sprite->oam.paletteNum = LoadObjectEventPalette(OBJ_EVENT_PAL_TAG_RS_BRENDAN); else - LoadPalette(gObjectEventPal_RubySapphireMay, 0x160 + i * 0x10, 0x20); + sprite->oam.paletteNum = LoadObjectEventPalette(OBJ_EVENT_PAL_TAG_RS_MAY); } else { if (gLinkPlayers[i].gender == MALE) - LoadPalette(gObjectEventPal_Brendan, 0x160 + i * 0x10, 0x20); + sprite->oam.paletteNum = LoadObjectEventPalette(OBJ_EVENT_PAL_TAG_BRENDAN); else - LoadPalette(gObjectEventPal_May, 0x160 + i * 0x10, 0x20); + sprite->oam.paletteNum = LoadObjectEventPalette(OBJ_EVENT_PAL_TAG_MAY); } } }