Skip to content

Fix vehicle corona/shadow flicker on fogless to foggy weather blend#4901

Merged
FileEX merged 2 commits intomultitheftauto:masterfrom
Zephkek:fix/4803-vehicle-corona-shadow-flicker
May 7, 2026
Merged

Fix vehicle corona/shadow flicker on fogless to foggy weather blend#4901
FileEX merged 2 commits intomultitheftauto:masterfrom
Zephkek:fix/4803-vehicle-corona-shadow-flicker

Conversation

@Zephkek
Copy link
Copy Markdown
Contributor

@Zephkek Zephkek commented May 6, 2026

Summary

Include CClock::ms_nGameClockSeconds in CWeatherSA::ResyncInterpolationWithGameClock so CWeather::InterpolationValue matches the value CWeather::Update derives (seconds/3600 + minutes/60).

Motivation

Follow-up to #4882. Residual flicker on vehicle coronas and shadows during fogless to foggy weather blends (e.g. SUNNY_COUNTRYSIDE to FOGGY_SF reported by rx).

The previous resync snapped InterpolationValue to minute/60 only. CTimeCycle::CalcColoursForPoint then blended m_CurrentColours between the weather pair using that snapped value, so:

  • m_CurrentColours.m_fSpriteBrightness (read by CEntity::ProcessLightsForEntity at 0x6FCF83 for vehicle corona intensity)
  • m_CurrentColours.m_wShadowStrength (read by CShadows::StoreShadowForVehicle at 0x70BDB9 for vehicle shadow intensity)

both updated in per-game-minute steps. With fast game clocks one game-minute is a fraction of a real second, so the steps surfaced as visible flicker on cars. CWeather::Foggyness itself was already smooth (it uses v0), which is why building lights and most other weather-driven values were fixed by #4882.

Adding seconds keeps the wrap-suppression intact (v0 >= InterpolationValue still holds, equal) and lets m_CurrentColours interpolate smoothly each frame.

Test plan

  1. On a fast-clock server, set weather with setWeatherBlended from a fogless weather (e.g. 14 SUNNY_COUNTRYSIDE) to a foggy one (e.g. 9 FOGGY_SF).
  2. Drive past a parked vehicle and watch its coronas and ground shadow during the blend hour.
  3. Expected: brightness/shadow strength change smoothly, no per-tick flicker.
  4. Confirm building lights, sky, and reflective surfaces from Fix #4803 building light flicker via pre-CWeather::Update hook  #4882 still behave correctly.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Zephkek added 2 commits May 6, 2026 19:17
…ultitheftauto#4803)

ResyncInterpolationWithGameClock snapped CWeather::InterpolationValue
to minute/60, dropping the seconds component. CTimeCycle::CalcColoursForPoint
then blended m_CurrentColours per game-minute instead of per frame, so
m_fSpriteBrightness (vehicle coronas) and m_wShadowStrength (vehicle
shadows) ticked visibly when the game clock runs fast.

Match the value CWeather::Update derives at 0x72B897
(seconds/3600 + minutes/60) so the wrap-suppression still holds and
m_CurrentColours interpolates smoothly each frame.
@FileEX FileEX added the bugfix Solution to a bug of any kind label May 7, 2026
@FileEX FileEX added this to the 1.7 (Current) milestone May 7, 2026
@FileEX FileEX merged commit 13fddf7 into multitheftauto:master May 7, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants