Commit 13fddf7
authored
Fix vehicle corona/shadow flicker on fogless to foggy weather blend (#4901)
#### 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 #4882
still behave correctly.
#### Checklist
* [x] Your code should follow the [coding
guidelines](https://wiki.multitheftauto.com/index.php?title=Coding_guidelines).
* [x] Smaller pull requests are easier to review. If your pull request
is beefy, your pull request should be reviewable commit-by-commit.1 parent 7f23f61 commit 13fddf7
2 files changed
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | | - | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
0 commit comments