Port nerf of rain particles from miami

This commit is contained in:
Filip Gawin 2021-01-03 00:12:01 +01:00 committed by shfil
parent 213a8eb905
commit bbbfe65870
2 changed files with 21 additions and 0 deletions

View File

@ -361,6 +361,7 @@ enum Config {
#undef NO_ISLAND_LOADING
#define PC_PARTICLE
#define VC_PED_PORTS // To not process collisions always. But should be tested if that's really beneficial
#define VC_RAIN_NERF // Reduces number of rain particles
#endif
#ifdef LIBRW

View File

@ -202,6 +202,7 @@ void CWeather::Update(void)
}
// Rain
#ifndef VC_RAIN_NERF
float fNewRain;
if (NewWeatherType == WEATHER_RAINY) {
// if raining for >1 hour, values: 0, 0.33, 0.66, 0.99, switching every ~16.5s
@ -223,6 +224,25 @@ void CWeather::Update(void)
else
Rain = Max(fNewRain, Rain - RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
}
#else
float fNewRain;
if (NewWeatherType == WEATHER_RAINY) {
// if raining for >1 hour, values: 0, 0.33, switching every ~16.5s
fNewRain = (((uint16)CTimer::GetTimeInMilliseconds() >> 14) & 1) * 0.33f;
if (OldWeatherType != WEATHER_RAINY) {
if (InterpolationValue < 0.4f)
// if rain has just started (<24 minutes), always 0.5
fNewRain = 0.5f;
else
// if rain is ongoing for >24 minutes, values: 0.25, 0.5, switching every ~16.5s
fNewRain = 0.25f + (((uint16)CTimer::GetTimeInMilliseconds() >> 14) & 1) * 0.25f;
}
fNewRain = Max(fNewRain, 0.5f);
}
else
fNewRain = 0.0f;
Rain = fNewRain;
#endif
// Clouds
if (OldWeatherType != WEATHER_SUNNY)