Skip to content

Commit

Permalink
Weather form changes actually changes form and not just follower grap…
Browse files Browse the repository at this point in the history
…hics
  • Loading branch information
AsparagusEduardo committed Jul 28, 2024
1 parent acc7355 commit 93e4a1f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/event_object_movement.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ void ClearObjectEventMovement(struct ObjectEvent *objectEvent, struct Sprite *sp
void ObjectEventClearHeldMovement(struct ObjectEvent *);
void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *);
struct Pokemon *GetFirstLiveMon(void);
u16 GetOverworldWeatherSpecies(u16 species);
void UpdateFollowingPokemon(void);
void RemoveFollowingPokemon(void);
struct ObjectEvent *GetFollowerObject(void);
Expand Down
2 changes: 2 additions & 0 deletions src/data/pokemon/form_change_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ static const struct FormChange sBurmyFormChangeTable[] = {

#if P_FAMILY_CHERUBI
static const struct FormChange sCherrimFormChangeTable[] = {
{FORM_CHANGE_OVERWORLD_WEATHER, SPECIES_CHERRIM_SUNSHINE, WEATHER_DROUGHT},
{FORM_CHANGE_OVERWORLD_WEATHER, SPECIES_CHERRIM_OVERCAST, WEATHER_NONE},
#if B_WEATHER_FORMS >= GEN_5
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM_SUNSHINE, B_WEATHER_SUN, ABILITY_FLOWER_GIFT},
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM_OVERCAST, ~B_WEATHER_SUN, ABILITY_FLOWER_GIFT},
Expand Down
2 changes: 1 addition & 1 deletion src/event_object_movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ static void RefreshFollowerGraphics(struct ObjectEvent *objEvent)
}
}

static u16 GetOverworldWeatherSpecies(u16 species)
u16 GetOverworldWeatherSpecies(u16 species)
{
u32 i;
u32 weather = GetCurrentWeather();
Expand Down
19 changes: 19 additions & 0 deletions src/field_weather.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,28 @@ void SetNextWeather(u8 weather)
gWeatherPtr->finishStep = 0;
}

static void UpdateWeatherForms(void)
{
s32 i;
for (i = 0; i < PARTY_SIZE; i++)
{
struct Pokemon *mon = &gPlayerParty[i];
u16 species = GetMonData(mon, MON_DATA_SPECIES);
u16 targetSpecies = GetOverworldWeatherSpecies(species);
if (species != targetSpecies)
{
SetMonData(mon, MON_DATA_SPECIES, &targetSpecies);
CalculateMonStats(mon);
}
}
}

void SetCurrentAndNextWeather(u8 weather)
{
PlayRainStoppingSoundEffect();
gWeatherPtr->currWeather = weather;
gWeatherPtr->nextWeather = weather;
UpdateWeatherForms();
}

void SetCurrentAndNextWeatherNoDelay(u8 weather)
Expand All @@ -212,6 +229,7 @@ void SetCurrentAndNextWeatherNoDelay(u8 weather)
gWeatherPtr->nextWeather = weather;
// Overrides the normal delay during screen fading.
gWeatherPtr->readyForInit = TRUE;
UpdateWeatherForms();
}

static void Task_WeatherInit(u8 taskId)
Expand Down Expand Up @@ -239,6 +257,7 @@ static void Task_WeatherMain(u8 taskId)
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_CHANGING_WEATHER;
gWeatherPtr->currWeather = gWeatherPtr->nextWeather;
gWeatherPtr->weatherChangeComplete = TRUE;
UpdateWeatherForms();
}
}
else
Expand Down

0 comments on commit 93e4a1f

Please sign in to comment.