47 m_MinTemps = {-7,-7.4,-4.1,1.5,7,11.3,20.4,19.1,18,5.3,0.8,-3.6};
56 m_MaxTemps = {-2.5,-2.1,2.3,9,15.5,19.4,25,22,21,10.5,4.2,0.1};
67 m_CloudsTemperatureEffectModifier = -5.0;
69 m_TemperaturePerHeightReductionModifier = 0.01;
78 if (
g_Game.IsMultiplayer())
80 float startingOvercast =
Math.RandomFloat(0.2,0.75);
81 m_Weather.GetOvercast().Set(startingOvercast,0,5);
140 #ifdef WEATHER_DATA_LOGGING
143 g_Game.GetWorld().GetDate(startYear, startMonth, startDay, startHour, startMinute);
149 float phmnLength = 10;
152 int year, month, day, hour, minute;
153 g_Game.GetWorld().GetDate(year, month, day, hour, minute);
166 #ifdef WEATHER_DATA_LOGGING
167 overcastChangeCount++;
170 float windDirection, windMag;
173 phmnValue =
Math.RandomFloatInclusive( 0.1, 0.4 );
182 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
187 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
193 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
204 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
211 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
218 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
225 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
240 #ifdef WEATHER_DATA_LOGGING
244 phmnValue =
Math.RandomFloatInclusive( 0.0, 0.3 );
252 #ifdef WEATHER_DATA_LOGGING
253 cloudyWeatherCount++;
256 phmnValue =
Math.RandomFloatInclusive( 0.3, 0.7 );
265 phmnValue =
Math.RandomFloatInclusive( 0.7, 1.0 );
269 #ifdef WEATHER_DATA_LOGGING
275 #ifdef WEATHER_DATA_LOGGING
284 #ifdef WEATHER_DATA_LOGGING
300 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
311 m_Weather.GetRain().Set(
Math.RandomFloatInclusive( 0.4, 0.8 ), phmnTime, 0);
314 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
315 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Overcast::Rain:: (%1) %2",
g_Game.GetDayTime(),
m_Weather.GetRain().GetActual()));
317 #ifdef WEATHER_DATA_LOGGING
323 g_Game.GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
325 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
328 FPrintln(file,
"================================================================");
329 FPrintln(file,
" ================== Day " + (currentDay + 1) +
" ================== ");
330 FPrintln(file,
"================================================================");
331 FPrintln(file,
"Overcast Change Count: " + overcastChangeCount);
332 FPrintln(file,
"Bad Weather Change Count: " + badWeatherCount);
333 FPrintln(file,
"Sudden Change Count: " + suddenChangeCount);
334 FPrintln(file,
"Storm Count: " + stormCount);
335 FPrintln(file,
"Sudden Storm Count: " + suddenStormCount);
336 FPrintln(file,
"Cloudy Weather Count: " + cloudyWeatherCount);
337 FPrintln(file,
"Clear Weather Count: " + clearWeatherCount);
341 if ( currentDay == daysToRun )
346 overcastChangeCount = 0;
347 suddenChangeCount = 0;
349 suddenStormCount = 0;
351 cloudyWeatherCount = 0;
352 clearWeatherCount = 0;
361 float actualOvercast =
m_Weather.GetOvercast().GetActual();
371 Debug.WeatherLog (
string.Format(
"Enoch::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
385 phmnValue =
Math.RandomFloatInclusive( 0.8, 1.0 );
390 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
391 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
396 if ( actualOvercast < 0.75 )
400 phmnValue =
Math.RandomFloatInclusive( 0.1, 0.3 );
406 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
412 phmnValue =
Math.RandomFloatInclusive( 0.05, 0.2 );
427 phmnValue =
Math.RandomFloatInclusive( 0.4, 0.6 );
433 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
439 phmnValue =
Math.RandomFloatInclusive( 0.6, 0.8 );
451 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
453 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
459 if (( hour >= 2 ) && ( hour <= 5 ))
468 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));
484 protected override void CalculateWind(
int newWeather,
bool suddenChange, out
float magnitude, out
float direction)
489 float windChance =
Math.RandomIntInclusive( 0, 100 );
491 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
493 if ( windChance < 10 )
495 magnitude =
Math.RandomFloatInclusive( 2 , 4 );
496 direction =
Math.RandomFloatInclusive( -2.3 , -1.8);
498 else if ( windChance < 50 )
500 magnitude =
Math.RandomFloatInclusive( 4 , 8 );
501 direction =
Math.RandomFloatInclusive( -3.14 , -2.3);
505 magnitude =
Math.RandomFloatInclusive( 6 , 12 );
506 direction =
Math.RandomFloatInclusive( 2.3 , 3.14);
510 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
512 if ( windChance < 45 )
514 magnitude =
Math.RandomFloatInclusive( 5 , 10 );
515 direction =
Math.RandomFloatInclusive( -1.8 , -1.0);
517 else if ( windChance < 90 )
519 magnitude =
Math.RandomFloatInclusive( 8 , 12 );
520 direction =
Math.RandomFloatInclusive( -1.0, -0.7);
524 magnitude =
Math.RandomFloatInclusive( 10 , 14 );
525 direction =
Math.RandomFloatInclusive( -2.4 , -1.8);
532 magnitude =
Math.RandomFloatInclusive( 17 , 20 );
533 direction =
Math.RandomFloatInclusive( -0.2 , 1.0);
535 else if ( windChance < 45 )
537 magnitude =
Math.RandomFloatInclusive( 6 , 12 );
538 direction =
Math.RandomFloatInclusive( -0.6, 0);
540 else if ( windChance < 90 )
542 magnitude =
Math.RandomFloatInclusive( 7 , 10 );
543 direction =
Math.RandomFloatInclusive( 1.3 , 1.9);
547 magnitude =
Math.RandomFloatInclusive( 4 , 8 );
548 direction =
Math.RandomFloatInclusive( -1.8, -1.3 );
553 protected override void CalculateVolFog(
float lerpValue,
float windMagnitude,
float changeTime)
555 float distanceDensity, heigthDensity, heightBias;
556 int year, month, day, hour, minute;
557 g_Game.GetWorld().GetDate(year, month, day, hour, minute);
559 if ( hour < 6 && hour >= 3 )
561 heightBias =
m_Weather.GetDynVolFogHeightBias();
565 bool foggyMorning =
Math.RandomIntInclusive(0,1);
579 distanceDensity =
Math.Lerp( 0.01, 0.03, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
580 heigthDensity =
Math.Lerp( 0.9, 1, lerpValue);
584 distanceDensity =
Math.Lerp( 0.5, 0.1, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
585 heigthDensity =
Math.Lerp( 0.2, 1, lerpValue);
588 else if ( hour < 18 && hour >= 6 )
590 distanceDensity =
Math.Lerp( 0.01, 0.05, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
591 heigthDensity =
Math.Lerp( 0.9, 1, lerpValue);
596 distanceDensity =
Math.Lerp( 0.01, 0.03, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
597 heigthDensity =
Math.Lerp( 0.9, 1, lerpValue);
601 m_Weather.SetDynVolFogDistanceDensity(distanceDensity, changeTime);
602 m_Weather.SetDynVolFogHeightDensity(heigthDensity, changeTime);
603 m_Weather.SetDynVolFogHeightBias(heightBias, changeTime);