Hopefully fix fog light flicker precision#4906
Merged
qaisjp merged 4 commits intomultitheftauto:masterfrom May 10, 2026
Merged
Conversation
…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.
There was a problem hiding this comment.
Pull request overview
Adjusts CWeatherSA::ResyncInterpolationWithGameClock to compute InterpolationValue using a double-precision path intended to match the game engine’s own interpolation calculation more closely, reducing precision-triggered wrap behavior that can manifest as light flicker during fog blending.
Changes:
- Reworks the interpolation calculation to mirror the engine’s
(seconds * k + minutes) * kdouble math path. - Adds a float-rounding correction intended to ensure the stored float does not exceed the computed double value.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adjust weather interpolation resync precision in
CWeatherSA::ResyncInterpolationWithGameClock.This keeps
InterpolationValuealigned 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
setWeatherBlendedinto fog.Verify car lights, traffic lights, and other 2dfx lights no longer flash each second during the blend.
Checklist