Commit 57b07f4
authored
Fix weather flicker 4803 (multitheftauto#4870)
#### Summary
Re-apply MTA's blended weather state in `PreWorldProcessHandler` so it
runs after the engine's `CWeather::Update` but before
`CTimeCycle::CalcColoursForPoint` reads the weather globals for
rendering.
#### Motivation
Fixes multitheftauto#4803. When `setWeatherBlended`/`setTime` are used (e.g. race
resource restart/respawn), the sky and ambient lighting flicker for 1-2
frames in fullscreen.
The engine's `CWeather::Update` (at `0x53BFC2` in `CGame::Process`)
detects a clock wrap when `setTime` jumps the game clock past its
internal `InterpolationValue`. It then overwrites
`OldWeatherType`/`NewWeatherType` with its own weather-list pick.
`CalcColoursForPoint` (at `0x53C0DA`) reads these wrong values and
computes incorrect sky/ambient colors for that frame. MTA's
`CBlendedWeather::DoPulse` previously only ran in `DoPulses` during
`Render2dStuff`, which is after the frame was already rendered with the
wrong state.
Fullscreen-only because exclusive mode bypasses DWM composition, so
every frame including the glitch frames is presented directly. Windowed
mode's DWM triple buffering absorbs them.
#### Test plan
1. Join a server running the default race resource
2. Set fullscreen (any mode)
3. Use `setWeatherBlended` + `setTime` via script, then restart the race
resource to respawn
4. Observe no sky/lighting flicker on respawn
#### 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 95e0752 commit 57b07f4
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3902 | 3902 | | |
3903 | 3903 | | |
3904 | 3904 | | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
| 3908 | + | |
| 3909 | + | |
| 3910 | + | |
| 3911 | + | |
| 3912 | + | |
3905 | 3913 | | |
3906 | 3914 | | |
3907 | 3915 | | |
| |||
0 commit comments