Fixed shadow palette during contests.

This commit is contained in:
Ariel A 2022-09-03 15:23:49 -04:00
parent f7759760e0
commit d6bac9895d

View file

@ -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) void LoadLinkContestPlayerPalettes(void)
{ {
int i; int i;
@ -2513,28 +2519,28 @@ void LoadLinkContestPlayerPalettes(void)
struct Sprite *sprite; struct Sprite *sprite;
static const u8 sContestantLocalIds[CONTESTANT_COUNT] = { 3, 4, 5, 14 }; 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) if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
{ {
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
{ {
objectEventId = GetObjectEventIdByLocalIdAndMap(sContestantLocalIds[i], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); objectEventId = GetObjectEventIdByLocalIdAndMap(sContestantLocalIds[i], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
sprite = &gSprites[gObjectEvents[objectEventId].spriteId]; sprite = &gSprites[gObjectEvents[objectEventId].spriteId];
sprite->oam.paletteNum = 6 + i;
version = (u8)gLinkPlayers[i].version; version = (u8)gLinkPlayers[i].version;
if (version == VERSION_RUBY || version == VERSION_SAPPHIRE) if (version == VERSION_RUBY || version == VERSION_SAPPHIRE)
{ {
if (gLinkPlayers[i].gender == MALE) if (gLinkPlayers[i].gender == MALE)
LoadPalette(gObjectEventPal_RubySapphireBrendan, 0x160 + i * 0x10, 0x20); sprite->oam.paletteNum = LoadObjectEventPalette(OBJ_EVENT_PAL_TAG_RS_BRENDAN);
else else
LoadPalette(gObjectEventPal_RubySapphireMay, 0x160 + i * 0x10, 0x20); sprite->oam.paletteNum = LoadObjectEventPalette(OBJ_EVENT_PAL_TAG_RS_MAY);
} }
else else
{ {
if (gLinkPlayers[i].gender == MALE) if (gLinkPlayers[i].gender == MALE)
LoadPalette(gObjectEventPal_Brendan, 0x160 + i * 0x10, 0x20); sprite->oam.paletteNum = LoadObjectEventPalette(OBJ_EVENT_PAL_TAG_BRENDAN);
else else
LoadPalette(gObjectEventPal_May, 0x160 + i * 0x10, 0x20); sprite->oam.paletteNum = LoadObjectEventPalette(OBJ_EVENT_PAL_TAG_MAY);
} }
} }
} }