This commit is contained in:
Nikolay Korolev 2020-04-08 14:25:23 +03:00
parent e556ffd3f6
commit 24fc11a137

View File

@ -210,10 +210,10 @@ void CWeather::Update(void)
else else
fNewRain = 0.0f; fNewRain = 0.0f;
if (Rain != fNewRain) { // ok to use comparasion if (Rain != fNewRain) { // ok to use comparasion
if (Rain > fNewRain) if (Rain < fNewRain)
Rain = max(fNewRain, Rain + RAIN_CHANGE_SPEED * CTimer::GetTimeStep()); Rain = min(fNewRain, Rain + RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
else else
Rain = min(fNewRain, Rain - RAIN_CHANGE_SPEED * CTimer::GetTimeStep()); Rain = max(fNewRain, Rain - RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
} }
// Clouds // Clouds
@ -431,8 +431,8 @@ void CWeather::RenderRainStreaks(void)
{ {
if (CTimer::GetIsCodePaused()) if (CTimer::GetIsCodePaused())
return; return;
int default_visibility = (64.0f - CTimeCycle::GetFogReduction()) / 64.0f * int(255 * Rain); int base_intensity = (64.0f - CTimeCycle::GetFogReduction()) / 64.0f * int(255 * Rain);
if (default_visibility == 0) if (base_intensity == 0)
return; return;
TempBufferIndicesStored = 0; TempBufferIndicesStored = 0;
TempBufferVerticesStored = 0; TempBufferVerticesStored = 0;
@ -444,13 +444,13 @@ void CWeather::RenderRainStreaks(void)
else{ else{
int intensity; int intensity;
if (secondsElapsed < STREAK_INTEROLATION_TIME) { if (secondsElapsed < STREAK_INTEROLATION_TIME) {
intensity = default_visibility * 0.5f * secondsElapsed / STREAK_INTEROLATION_TIME; intensity = base_intensity * 0.5f * secondsElapsed / STREAK_INTEROLATION_TIME;
} }
else if (secondsElapsed > (STREAK_LIFETIME - STREAK_INTEROLATION_TIME)) { else if (secondsElapsed > (STREAK_LIFETIME - STREAK_INTEROLATION_TIME)) {
intensity = (STREAK_LIFETIME - secondsElapsed) * default_visibility / STREAK_INTEROLATION_TIME; intensity = (STREAK_LIFETIME - secondsElapsed) * 0.5f * base_intensity / STREAK_INTEROLATION_TIME;
} }
else { else {
intensity = default_visibility; intensity = base_intensity * 0.5f;
} }
debug("intensity: %d\n", intensity); debug("intensity: %d\n", intensity);
CVector dir = Streaks[i].direction; CVector dir = Streaks[i].direction;