From bbbfe658704c5245df6daa1b7418003dc9169916 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Sun, 3 Jan 2021 00:12:01 +0100 Subject: Port nerf of rain particles from miami --- src/core/config.h | 1 + src/render/Weather.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'src') diff --git a/src/core/config.h b/src/core/config.h index 9f4ccd1f..8b18ffef 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -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 diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index bf3e51b4..771f85de 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -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) -- cgit v1.2.3