Skip to content

Hopefully fix fog light flicker precision#4906

Open
Zephkek wants to merge 4 commits intomultitheftauto:masterfrom
Zephkek:fix/4901-fog-light-flicker-precision
Open

Hopefully fix fog light flicker precision#4906
Zephkek wants to merge 4 commits intomultitheftauto:masterfrom
Zephkek:fix/4901-fog-light-flicker-precision

Conversation

@Zephkek
Copy link
Copy Markdown
Contributor

@Zephkek Zephkek commented May 8, 2026

Summary

Adjust weather interpolation resync precision in CWeatherSA::ResyncInterpolationWithGameClock.
This keeps InterpolationValue aligned with the engine comparison path and removes fog transition light flicker.

Motivation

Fog to sunny flicker was fixed, but lights still flickered when blending into fog.
This change prevents precision mismatches that can trigger the wrap branch and spike light related weather values.

Test plan

Test in-game on v26595 with fast clock and repeated setWeatherBlended into fog.
Verify car lights, traffic lights, and other 2dfx lights no longer flash each second during the blend.

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 3 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.
…into fix/4803-vehicle-corona-shadow-flicker
Compute interpolation in double and step one float ULP down when needed to preserve the engine v0 >= InterpolationValue invariant and prevent precision-induced 2dfx light flicker.
@Zephkek Zephkek changed the title Fix/4901 fog light flicker precision Hopefully fix fog light flicker precision May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant