Fixed all field effects with gendered palette tags (warp arrow, surf blob, bird)
This commit is contained in:
parent
30c366eec3
commit
483d4b3448
5 changed files with 19 additions and 8 deletions
|
@ -128,4 +128,9 @@
|
|||
#define FLDEFF_PAL_TAG_HOF_MONITOR 0x1010
|
||||
#define FLDEFF_PAL_TAG_UNKNOWN 0x1011
|
||||
|
||||
|
||||
// Duplicates of event_object_movement tags
|
||||
#define FLDEFF_PAL_TAG_MAY 0x1110 // OBJ_EVENT_PAL_TAG_MAY
|
||||
#define FLDEFF_PAL_TAG_BRENDAN 0x1100 // OBJ_EVENT_PAL_TAG_BRENDAN
|
||||
|
||||
#endif // GUARD_FIELD_EFFECT_CONSTANTS_H
|
||||
|
|
|
@ -114,6 +114,7 @@ void ObjectEventTurnByLocalIdAndMap(u8, u8, u8, u8);
|
|||
const struct ObjectEventGraphicsInfo *GetObjectEventGraphicsInfo(u8 graphicsId);
|
||||
void SetObjectInvisibility(u8, u8, u8, bool8);
|
||||
void FreeAndReserveObjectSpritePalettes(void);
|
||||
u8 LoadObjectEventPalette(u16 paletteTag);
|
||||
void SetObjectEventSpritePosByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y);
|
||||
void ResetObjectSubpriority(u8, u8, u8);
|
||||
void SetObjectSubpriority(u8, u8, u8, u8);
|
||||
|
|
|
@ -147,7 +147,6 @@ static void UpdateObjectEventVisibility(struct ObjectEvent *, struct Sprite *);
|
|||
static void MakeSpriteTemplateFromObjectEventTemplate(struct ObjectEventTemplate *, struct SpriteTemplate *, const struct SubspriteTable **);
|
||||
static void GetObjectEventMovingCameraOffset(s16 *, s16 *);
|
||||
static struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
|
||||
static void LoadObjectEventPalette(u16);
|
||||
static void RemoveObjectEventIfOutsideView(struct ObjectEvent *);
|
||||
static void SpawnObjectEventOnReturnToField(u8, s16, s16);
|
||||
static void SetPlayerAvatarObjectEventIdAndObjectId(u8, u8);
|
||||
|
@ -2364,12 +2363,12 @@ void FreeAndReserveObjectSpritePalettes(void)
|
|||
gReservedSpritePaletteCount = 12;
|
||||
}
|
||||
|
||||
static void LoadObjectEventPalette(u16 paletteTag)
|
||||
u8 LoadObjectEventPalette(u16 paletteTag)
|
||||
{
|
||||
u16 i = FindObjectEventPaletteIndexByTag(paletteTag);
|
||||
|
||||
if (i != OBJ_EVENT_PAL_TAG_NONE) // always true
|
||||
LoadSpritePaletteIfTagExists(&sObjectEventSpritePalettes[i]);
|
||||
if (i == 0xFF)
|
||||
return i;
|
||||
return LoadSpritePaletteIfTagExists(&sObjectEventSpritePalettes[i]);
|
||||
}
|
||||
|
||||
// Unused
|
||||
|
@ -2383,9 +2382,9 @@ static void LoadObjectEventPaletteSet(u16 *paletteTags)
|
|||
|
||||
static u8 LoadSpritePaletteIfTagExists(const struct SpritePalette *spritePalette)
|
||||
{
|
||||
u8 paletteNum;
|
||||
if (IndexOfSpritePaletteTag(spritePalette->tag) != 0xFF)
|
||||
return 0xFF;
|
||||
u8 paletteNum = IndexOfSpritePaletteTag(spritePalette->tag);
|
||||
if (paletteNum != 0xFF) // don't load twice; return
|
||||
return paletteNum;
|
||||
paletteNum = LoadSpritePalette(spritePalette);
|
||||
return paletteNum;
|
||||
}
|
||||
|
|
|
@ -3123,6 +3123,7 @@ u8 FldEff_NPCFlyOut(void)
|
|||
sprite->oam.priority = 1;
|
||||
sprite->callback = SpriteCB_NPCFlyOut;
|
||||
sprite->data[1] = gFieldEffectArguments[0];
|
||||
sprite->oam.paletteNum = LoadObjectEventPalette(gSaveBlock2Ptr->playerGender ? FLDEFF_PAL_TAG_MAY : FLDEFF_PAL_TAG_BRENDAN);
|
||||
PlaySE(SE_M_FLY);
|
||||
return spriteId;
|
||||
}
|
||||
|
@ -3303,6 +3304,7 @@ static u8 CreateFlyBirdSprite(void)
|
|||
sprite = &gSprites[spriteId];
|
||||
sprite->oam.priority = 1;
|
||||
sprite->callback = SpriteCB_FlyBirdLeaveBall;
|
||||
sprite->oam.paletteNum = LoadObjectEventPalette(gSaveBlock2Ptr->playerGender ? FLDEFF_PAL_TAG_MAY : FLDEFF_PAL_TAG_BRENDAN);
|
||||
return spriteId;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,6 +259,8 @@ u8 CreateWarpArrowSprite(void)
|
|||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
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.priority = 1;
|
||||
sprite->coordOffsetEnabled = TRUE;
|
||||
sprite->invisible = TRUE;
|
||||
|
@ -1153,6 +1155,8 @@ u32 FldEff_SurfBlob(void)
|
|||
sprite = &gSprites[spriteId];
|
||||
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->data[3] = -1;
|
||||
sprite->data[6] = -1;
|
||||
sprite->data[7] = -1;
|
||||
|
|
Loading…
Reference in a new issue