42 m_MinTemps = {-3,-2,0,4,9,14,18,17,13,11,9,0};
51 m_MaxTemps = {3,5,7,14,19,24,26,25,18,14,10,5};
63 m_CloudsTemperatureEffectModifier = 2.0;
64 m_TemperaturePerHeightReductionModifier = 0.012;
73 if (
g_Game.IsMultiplayer())
75 float startingOvercast =
Math.RandomFloat(0.2,0.75);
76 m_Weather.GetOvercast().Set(startingOvercast,0,5);
94 #ifdef WEATHER_DATA_LOGGING
97 g_Game.GetWorld().GetDate(startYear, startMonth, startDay, startHour, startMinute);
103 float phmnLength = 10;
122 #ifdef WEATHER_DATA_LOGGING
123 overcastChangeCount++;
126 float windDirection, windMag;
129 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.7 );
138 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
143 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
148 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
158 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
164 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
170 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
185 #ifdef WEATHER_DATA_LOGGING
189 phmnValue =
Math.RandomFloatInclusive( 0.0, 0.3 );
197 #ifdef WEATHER_DATA_LOGGING
198 cloudyWeatherCount++;
201 phmnValue =
Math.RandomFloatInclusive( 0.3, 0.6 );
209 #ifdef WEATHER_DATA_LOGGING
213 phmnValue =
Math.RandomFloatInclusive( 0.6, 1.0 );
218 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
226 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
227 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Overcast::Rain:: (%1) %2",
g_Game.GetDayTime(),
m_Weather.GetRain().GetActual()));
229 #ifdef WEATHER_DATA_LOGGING
235 g_Game.GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
237 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
240 FPrintln(file,
"================================================================");
241 FPrintln(file,
" ================== Day " + (currentDay + 1) +
" ================== ");
242 FPrintln(file,
"================================================================");
243 FPrintln(file,
"Overcast Change Count: " + overcastChangeCount);
244 FPrintln(file,
"Bad Weather Change Count: " + badWeatherCount);
245 FPrintln(file,
"Cloudy Weather Count: " + cloudyWeatherCount);
246 FPrintln(file,
"Clear Weather Count: " + clearWeatherCount);
250 if ( currentDay == daysToRun )
255 overcastChangeCount = 0;
257 cloudyWeatherCount = 0;
258 clearWeatherCount = 0;
267 float actualOvercast =
m_Weather.GetOvercast().GetActual();
277 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
283 phmnValue =
Math.RandomFloatInclusive( 0.8, 1.0 );
287 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
288 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
293 if ( actualOvercast < 0.75 )
297 phmnValue =
Math.RandomFloatInclusive( 0.1, 0.3 );
303 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.5 );
309 phmnValue =
Math.RandomFloatInclusive( 0.0, 0.2 );
324 phmnValue =
Math.RandomFloatInclusive( 0.5, 0.7 );
330 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
336 phmnValue =
Math.RandomFloatInclusive( 0.4, 0.6 );
348 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
350 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
359 float fogTime = 1800.0;
361 float fogyMorning =
Math.RandomFloatInclusive( 0.0, 1.0 );
363 if ( fogyMorning > 0.85 )
365 if ( (
g_Game.GetDayTime() > 4 &&
g_Game.GetDayTime() < 7 ) )
373 if (
m_Weather.GetOvercast().GetActual() < 0.3 )
380 m_Weather.GetFog().Set(
Math.RandomFloatInclusive( fogMin, fogMax ), fogTime, 0);
382 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));
399 protected override void CalculateWind(
int newWeather,
bool suddenChange, out
float magnitude, out
float direction)
404 float windChance =
Math.RandomIntInclusive( 0, 100 );
406 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
408 if ( windChance < 30 )
410 magnitude =
Math.RandomFloatInclusive( 6 , 10 );
411 direction =
Math.RandomFloatInclusive( -1.0 , -0.5);
413 else if ( windChance < 75 )
415 magnitude =
Math.RandomFloatInclusive( 8 , 12 );
416 direction =
Math.RandomFloatInclusive( -1.3 , -0.9);
420 magnitude =
Math.RandomFloatInclusive( 4 , 6 );
421 direction =
Math.RandomFloatInclusive( -0.6 , 0.0);
425 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
427 if ( windChance < 45 )
429 magnitude =
Math.RandomFloatInclusive( 6 , 10 );
430 direction =
Math.RandomFloatInclusive( -3.14 , -2.4);
432 else if ( windChance < 90 )
434 magnitude =
Math.RandomFloatInclusive( 8 , 12 );
435 direction =
Math.RandomFloatInclusive( -2.6, -2.0);
439 magnitude =
Math.RandomFloatInclusive( 10 , 14 );
440 direction =
Math.RandomFloatInclusive( -2.2 , -1.4);
447 magnitude =
Math.RandomFloatInclusive( 14 , 17 );
448 direction =
Math.RandomFloatInclusive( 0.9 , 1.45);
450 else if ( windChance < 45 )
452 magnitude =
Math.RandomFloatInclusive( 9 , 12 );
453 direction =
Math.RandomFloatInclusive( 1.45, 1.7);
455 else if ( windChance < 90 )
457 magnitude =
Math.RandomFloatInclusive( 7 , 10 );
458 direction =
Math.RandomFloatInclusive( 1.6 , 2);
462 magnitude =
Math.RandomFloatInclusive( 4 , 8 );
463 direction =
Math.RandomFloatInclusive( 1.9, 2.2 );
468 protected override void CalculateVolFog(
float lerpValue,
float windMagnitude,
float changeTime)
470 float distanceDensity, heigthDensity, heightBias;
471 int year, month, day, hour, minute;
472 g_Game.GetWorld().GetDate(year, month, day, hour, minute);
474 if ( hour < 9 && hour >= 5 )
476 distanceDensity =
Math.Lerp( 0.015, 0.05, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
477 heigthDensity =
Math.Lerp( 0.8, 1, lerpValue);
479 heightBias =
m_Weather.GetDynVolFogHeightBias();
483 int diceRoll =
Math.RandomIntInclusive(1,100);
489 else if (diceRoll < 85)
491 heightBias =
Math.RandomInt(80, 120);
495 heightBias =
Math.RandomInt(120, 200);
499 else if ( hour < 18 && hour >= 9 )
501 distanceDensity =
Math.Lerp( 0.01, 0.05, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
502 heigthDensity =
Math.Lerp( 0.9, 1, lerpValue);
507 distanceDensity =
Math.Lerp( 0.01, 0.03, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
508 heigthDensity =
Math.Lerp( 0.9, 1, lerpValue);
512 m_Weather.SetDynVolFogDistanceDensity(distanceDensity, changeTime);
513 m_Weather.SetDynVolFogHeightDensity(heigthDensity, changeTime);
514 m_Weather.SetDynVolFogHeightBias(heightBias, changeTime);