Better handling of disabling followers

This commit is contained in:
Eduardo Quezada 2024-02-19 13:11:53 -03:00
parent 1a4bc69c5a
commit 70924c64b4
3 changed files with 12 additions and 8 deletions

View file

@ -444,7 +444,9 @@ struct SpeciesInfo /*0x8C*/
/* 0x88 */ const struct Evolution *evolutions;
/* 0x84 */ const u16 *formSpeciesIdTable;
/* 0x84 */ const struct FormChange *formChangeTable;
#if OW_FOLLOWERS_ENABLED
struct ObjectEventGraphicsInfo followerData;
#endif
};
struct MoveInfo

View file

@ -291,7 +291,9 @@ const struct SpeciesInfo gSpeciesInfo[] =
.backAnimId = BACK_ANIM_NONE,
PALETTES(CircledQuestionMark),
ICON(QuestionMark, 0),
#if OW_FOLLOWERS_ENABLED
.followerData = {TAG_NONE, OBJ_EVENT_PAL_TAG_SUBSTITUTE, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 2, SHADOW_SIZE_M, FALSE, COMP, TRACKS_FOOT, &gObjectEventBaseOam_32x32, sOamTables_32x32, sAnimTable_Following, sPicTable_Substitute, gDummySpriteAffineAnimTable},
#endif
LEARNSETS(None),
},

View file

@ -1836,7 +1836,8 @@ struct ObjectEvent * GetFollowerObject(void)
// Return graphicsInfo for a pokemon species & form
static const struct ObjectEventGraphicsInfo * SpeciesToGraphicsInfo(u16 species, u8 form)
{
const struct ObjectEventGraphicsInfo *graphicsInfo;
const struct ObjectEventGraphicsInfo *graphicsInfo = NULL;
#if OW_FOLLOWERS_ENABLED
switch (species)
{
case SPECIES_UNOWN: // Letters >A are defined as species >= NUM_SPECIES, so are not contiguous with A
@ -1852,8 +1853,8 @@ static const struct ObjectEventGraphicsInfo * SpeciesToGraphicsInfo(u16 species,
return &gSpeciesInfo[SPECIES_NONE].followerData;
else if (graphicsInfo->tileTag != TAG_NONE && species >= NUM_SPECIES)
return &gSpeciesInfo[SPECIES_NONE].followerData;
else
return graphicsInfo;
#endif
return graphicsInfo;
}
// Find, or load, the palette for the specified pokemon info
@ -2023,9 +2024,10 @@ void UpdateFollowingPokemon(void)
// 1. GetFollowerInfo returns FALSE
// 2. Map is indoors and gfx is larger than 32x32
// 3. flag is set
if (!GetFollowerInfo(&species, &form, &shiny) ||
(gMapHeader.mapType == MAP_TYPE_INDOOR && SpeciesToGraphicsInfo(species, 0)->oam->size > ST_OAM_SIZE_2) ||
FlagGet(FLAG_TEMP_HIDE_FOLLOWER))
if (OW_FOLLOWERS_ENABLED == FALSE
|| !GetFollowerInfo(&species, &form, &shiny)
|| (gMapHeader.mapType == MAP_TYPE_INDOOR && SpeciesToGraphicsInfo(species, 0)->oam->size > ST_OAM_SIZE_2)
|| FlagGet(FLAG_TEMP_HIDE_FOLLOWER))
{
RemoveFollowingPokemon();
return;
@ -2080,8 +2082,6 @@ void RemoveFollowingPokemon(void)
// Determine whether follower *should* be visible
static bool32 IsFollowerVisible(void)
{
if (OW_FOLLOWERS_ENABLED == FALSE)
return FALSE;
return
!(TestPlayerAvatarFlags(FOLLOWER_INVISIBLE_FLAGS)
|| MetatileBehavior_IsSurfableWaterOrUnderwater(gObjectEvents[gPlayerAvatar.objectEventId].previousMetatileBehavior)