Added LoadPlayerObjectEventPalette to load gender pals

This commit is contained in:
Eduardo Quezada 2023-06-18 01:53:48 -04:00
parent c391c66249
commit 03a4793324
4 changed files with 21 additions and 4 deletions

View file

@ -144,6 +144,7 @@ const struct ObjectEventGraphicsInfo *GetObjectEventGraphicsInfo(u16 graphicsId)
void SetObjectInvisibility(u8 localId, u8 mapNum, u8 mapGroup, bool8 invisible);
void FreeAndReserveObjectSpritePalettes(void);
u8 LoadObjectEventPalette(u16 paletteTag);
u8 LoadPlayerObjectEventPalette(u8 gender);
void SetObjectEventSpritePosByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y);
void ResetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup);
void SetObjectSubpriority(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority);

View file

@ -2664,6 +2664,22 @@ u8 LoadObjectEventPalette(u16 paletteTag)
return LoadSpritePaletteIfTagExists(&sObjectEventSpritePalettes[i]);
}
u8 LoadPlayerObjectEventPalette(u8 gender)
{
u16 paletteTag;
switch (gender)
{
default:
case MALE:
paletteTag = FLDEFF_PAL_TAG_BRENDAN;
break;
case FEMALE:
paletteTag = FLDEFF_PAL_TAG_MAY;
break;
}
LoadObjectEventPalette(paletteTag);
}
// Unused
static void LoadObjectEventPaletteSet(u16 *paletteTags)
{

View file

@ -3137,7 +3137,7 @@ u8 FldEff_NPCFlyOut(void)
u8 spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_BIRD], 0x78, 0, 1);
struct Sprite *sprite = &gSprites[spriteId];
sprite->oam.paletteNum = LoadObjectEventPalette(gSaveBlock2Ptr->playerGender ? FLDEFF_PAL_TAG_MAY : FLDEFF_PAL_TAG_BRENDAN);
sprite->oam.paletteNum = LoadPlayerObjectEventPalette(gSaveBlock2Ptr->playerGender);
sprite->oam.priority = 1;
sprite->callback = SpriteCB_NPCFlyOut;
sprite->data[1] = gFieldEffectArguments[0];
@ -3319,7 +3319,7 @@ static u8 CreateFlyBirdSprite(void)
struct Sprite *sprite;
spriteId = CreateSprite(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_BIRD], 0xff, 0xb4, 0x1);
sprite = &gSprites[spriteId];
sprite->oam.paletteNum = LoadObjectEventPalette(gSaveBlock2Ptr->playerGender ? FLDEFF_PAL_TAG_MAY : FLDEFF_PAL_TAG_BRENDAN);
sprite->oam.paletteNum = LoadPlayerObjectEventPalette(gSaveBlock2Ptr->playerGender);
sprite->oam.priority = 1;
sprite->callback = SpriteCB_FlyBirdLeaveBall;
return spriteId;

View file

@ -269,7 +269,7 @@ u8 CreateWarpArrowSprite(void)
{
sprite = &gSprites[spriteId];
// Can use either gender's palette, so try to use the one that should be loaded
sprite->oam.paletteNum = LoadObjectEventPalette(gSaveBlock2Ptr->playerGender ? FLDEFF_PAL_TAG_MAY : FLDEFF_PAL_TAG_BRENDAN);
sprite->oam.paletteNum = LoadPlayerObjectEventPalette(gSaveBlock2Ptr->playerGender);
sprite->oam.priority = 1;
sprite->coordOffsetEnabled = TRUE;
sprite->invisible = TRUE;
@ -1168,7 +1168,7 @@ u32 FldEff_SurfBlob(void)
sprite->coordOffsetEnabled = TRUE;
sprite->tPlayerObjId = gFieldEffectArguments[2];
// Can use either gender's palette, so try to use the one that should be loaded
sprite->oam.paletteNum = LoadObjectEventPalette(gSaveBlock2Ptr->playerGender ? FLDEFF_PAL_TAG_MAY : FLDEFF_PAL_TAG_BRENDAN);
sprite->oam.paletteNum = LoadPlayerObjectEventPalette(gSaveBlock2Ptr->playerGender);
sprite->data[3] = -1;
sprite->data[6] = -1;
sprite->data[7] = -1;