diff --git a/include/field_weather.h b/include/field_weather.h index 48118c9a69..6968649831 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -50,8 +50,8 @@ struct Weather u8 fadeScreenCounter; bool8 readyForInit; u8 taskId; - u8 unknown_6CA; - u8 unknown_6CB; + u8 fadeInFirstFrame; + u8 fadeInTimer; u16 initStep; u16 finishStep; u8 currWeather; @@ -71,7 +71,7 @@ struct Weather u8 cloudSpritesCreated; // Snow u16 snowflakeVisibleCounter; - u16 unknown_6E2; + u16 snowflakeTimer; u8 snowflakeSpriteCount; u8 targetSnowflakeSpriteCount; // Thunderstorm @@ -90,7 +90,7 @@ struct Weather u8 fogHSpritesCreated; // Ash u16 ashBaseSpritesX; - u16 unknown_6FE; + u16 ashUnused; u8 ashSpritesCreated; // Sandstorm u32 sandstormXOffset; @@ -152,7 +152,6 @@ void FadeScreen(u8 mode, s8 delay); bool8 IsWeatherNotFadingIn(void); void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex); void ApplyWeatherGammaShiftToPal(u8 paletteIndex); -u8 sub_80ABF20(void); void LoadCustomWeatherSpritePalette(const u16 *palette); void ResetDroughtWeatherPaletteLoading(void); bool8 LoadDroughtWeatherPalettes(void); diff --git a/src/field_weather.c b/src/field_weather.c index 67051377c4..6fc1d331a3 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -365,8 +365,8 @@ static void UpdateWeatherGammaShift(void) static void FadeInScreenWithWeather(void) { - if (++gWeatherPtr->unknown_6CB > 1) - gWeatherPtr->unknown_6CA = 0; + if (++gWeatherPtr->fadeInTimer > 1) + gWeatherPtr->fadeInFirstFrame = FALSE; switch (gWeatherPtr->currWeather) { @@ -793,8 +793,8 @@ void FadeScreen(u8 mode, s8 delay) BeginNormalPaletteFade(PALETTES_ALL, delay, 16, 0, fadeColor); gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN; - gWeatherPtr->unknown_6CA = 1; - gWeatherPtr->unknown_6CB = 0; + gWeatherPtr->fadeInFirstFrame = TRUE; + gWeatherPtr->fadeInTimer = 0; Weather_SetBlendCoeffs(gWeatherPtr->currBlendEVA, gWeatherPtr->currBlendEVB); gWeatherPtr->readyForInit = TRUE; } @@ -813,7 +813,7 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex) switch (gWeatherPtr->palProcessingState) { case WEATHER_PAL_STATE_SCREEN_FADING_IN: - if (gWeatherPtr->unknown_6CA != 0) + if (gWeatherPtr->fadeInFirstFrame) { if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL) MarkFogSpritePalToLighten(paletteIndex); @@ -848,12 +848,13 @@ void ApplyWeatherGammaShiftToPal(u8 paletteIndex) ApplyGammaShift(paletteIndex, 1, gWeatherPtr->gammaIndex); } -u8 sub_80ABF20(void) +// Unused +static bool8 IsFirstFrameOfWeatherFadeIn(void) { if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_SCREEN_FADING_IN) - return gWeatherPtr->unknown_6CA; + return gWeatherPtr->fadeInFirstFrame; else - return 0; + return FALSE; } void LoadCustomWeatherSpritePalette(const u16 *palette) diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 1069bc9a29..e0103c5a33 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -941,13 +941,14 @@ static void InitSnowflakeSpriteMovement(struct Sprite *sprite) static void WaitSnowflakeSprite(struct Sprite *sprite) { - if (gWeatherPtr->unknown_6E2 > 18) + // Timer is never incremented + if (gWeatherPtr->snowflakeTimer > 18) { sprite->invisible = FALSE; sprite->callback = UpdateSnowflakeSprite; sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); sprite->tPosY = sprite->pos1.y * 128; - gWeatherPtr->unknown_6E2 = 0; + gWeatherPtr->snowflakeTimer = 0; } } @@ -1519,7 +1520,7 @@ void Ash_InitVars(void) gWeatherPtr->weatherGfxLoaded = FALSE; gWeatherPtr->gammaTargetIndex = 0; gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->unknown_6FE = 20; + gWeatherPtr->ashUnused = 20; // Never read if (!gWeatherPtr->ashSpritesCreated) { Weather_SetBlendCoeffs(0, 16);