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;
80 float startingOvercast =
Math.RandomFloat(0.2,0.75);
81 m_Weather.GetOvercast().Set(startingOvercast,0,5);
140 #ifdef WEATHER_DATA_LOGGING
143 GetGame().GetWorld().GetDate(startYear, startMonth, startDay, startHour, startMinute);
149 float phmnLength = 10;
152 int year, month, day, hour, minute;
153 GetGame().GetWorld().GetDate(year, month, day, hour, minute);
165 #ifdef WEATHER_DATA_LOGGING
166 overcastChangeCount++;
169 float windDirection, windMag;
172 phmnValue =
Math.RandomFloatInclusive( 0.1, 0.4 );
181 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
186 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
192 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
203 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
210 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
217 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
224 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
239 #ifdef WEATHER_DATA_LOGGING
243 phmnValue =
Math.RandomFloatInclusive( 0.0, 0.3 );
251 #ifdef WEATHER_DATA_LOGGING
252 cloudyWeatherCount++;
255 phmnValue =
Math.RandomFloatInclusive( 0.3, 0.7 );
264 phmnValue =
Math.RandomFloatInclusive( 0.7, 1.0 );
268 #ifdef WEATHER_DATA_LOGGING
274 #ifdef WEATHER_DATA_LOGGING
283 #ifdef WEATHER_DATA_LOGGING
299 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
310 m_Weather.GetRain().Set(
Math.RandomFloatInclusive( 0.4, 0.8 ), phmnTime, 0);
313 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Overcast:: (%1) overcast: %2",
g_Game.GetDayTime(), actual));
314 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Overcast::Rain:: (%1) %2",
g_Game.GetDayTime(),
m_Weather.GetRain().GetActual()));
316 #ifdef WEATHER_DATA_LOGGING
322 GetGame().GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
324 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
327 FPrintln(file,
"================================================================");
328 FPrintln(file,
" ================== Day " + (currentDay + 1) +
" ================== ");
329 FPrintln(file,
"================================================================");
330 FPrintln(file,
"Overcast Change Count: " + overcastChangeCount);
331 FPrintln(file,
"Bad Weather Change Count: " + badWeatherCount);
332 FPrintln(file,
"Sudden Change Count: " + suddenChangeCount);
333 FPrintln(file,
"Storm Count: " + stormCount);
334 FPrintln(file,
"Sudden Storm Count: " + suddenStormCount);
335 FPrintln(file,
"Cloudy Weather Count: " + cloudyWeatherCount);
336 FPrintln(file,
"Clear Weather Count: " + clearWeatherCount);
340 if ( currentDay == daysToRun )
345 overcastChangeCount = 0;
346 suddenChangeCount = 0;
348 suddenStormCount = 0;
350 cloudyWeatherCount = 0;
351 clearWeatherCount = 0;
360 float actualOvercast =
m_Weather.GetOvercast().GetActual();
370 Debug.WeatherLog (
string.Format(
"Enoch::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
384 phmnValue =
Math.RandomFloatInclusive( 0.8, 1.0 );
389 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
390 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain::ForceStorm:: (%1) %2 -> %3",
g_Game.GetDayTime(), actual, phmnValue));
395 if ( actualOvercast < 0.75 )
399 phmnValue =
Math.RandomFloatInclusive( 0.1, 0.3 );
405 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
411 phmnValue =
Math.RandomFloatInclusive( 0.05, 0.2 );
426 phmnValue =
Math.RandomFloatInclusive( 0.4, 0.6 );
432 phmnValue =
Math.RandomFloatInclusive( 0.2, 0.4 );
438 phmnValue =
Math.RandomFloatInclusive( 0.6, 0.8 );
450 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
452 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
458 if (( hour >= 2 ) && ( hour <= 5 ))
467 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));
483 protected override void CalculateWind(
int newWeather,
bool suddenChange, out
float magnitude, out
float direction)
488 float windChance =
Math.RandomIntInclusive( 0, 100 );
490 if ( newWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
492 if ( windChance < 10 )
494 magnitude =
Math.RandomFloatInclusive( 2 , 4 );
495 direction =
Math.RandomFloatInclusive( -2.3 , -1.8);
497 else if ( windChance < 50 )
499 magnitude =
Math.RandomFloatInclusive( 4 , 8 );
500 direction =
Math.RandomFloatInclusive( -3.14 , -2.3);
504 magnitude =
Math.RandomFloatInclusive( 6 , 12 );
505 direction =
Math.RandomFloatInclusive( 2.3 , 3.14);
509 else if ( newWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
511 if ( windChance < 45 )
513 magnitude =
Math.RandomFloatInclusive( 5 , 10 );
514 direction =
Math.RandomFloatInclusive( -1.8 , -1.0);
516 else if ( windChance < 90 )
518 magnitude =
Math.RandomFloatInclusive( 8 , 12 );
519 direction =
Math.RandomFloatInclusive( -1.0, -0.7);
523 magnitude =
Math.RandomFloatInclusive( 10 , 14 );
524 direction =
Math.RandomFloatInclusive( -2.4 , -1.8);
531 magnitude =
Math.RandomFloatInclusive( 17 , 20 );
532 direction =
Math.RandomFloatInclusive( -0.2 , 1.0);
534 else if ( windChance < 45 )
536 magnitude =
Math.RandomFloatInclusive( 6 , 12 );
537 direction =
Math.RandomFloatInclusive( -0.6, 0);
539 else if ( windChance < 90 )
541 magnitude =
Math.RandomFloatInclusive( 7 , 10 );
542 direction =
Math.RandomFloatInclusive( 1.3 , 1.9);
546 magnitude =
Math.RandomFloatInclusive( 4 , 8 );
547 direction =
Math.RandomFloatInclusive( -1.8, -1.3 );
552 protected override void CalculateVolFog(
float lerpValue,
float windMagnitude,
float changeTime)
554 float distanceDensity, heigthDensity, heightBias;
555 int year, month, day, hour, minute;
556 GetGame().GetWorld().GetDate(year, month, day, hour, minute);
558 if ( hour < 6 && hour >= 3 )
560 heightBias =
m_Weather.GetDynVolFogHeightBias();
564 bool foggyMorning =
Math.RandomIntInclusive(0,1);
578 distanceDensity =
Math.Lerp( 0.01, 0.03, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
579 heigthDensity =
Math.Lerp( 0.9, 1, lerpValue);
583 distanceDensity =
Math.Lerp( 0.5, 0.1, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
584 heigthDensity =
Math.Lerp( 0.2, 1, lerpValue);
587 else if ( hour < 18 && hour >= 6 )
589 distanceDensity =
Math.Lerp( 0.01, 0.05, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
590 heigthDensity =
Math.Lerp( 0.9, 1, lerpValue);
595 distanceDensity =
Math.Lerp( 0.01, 0.03, lerpValue ) *
Math.Clamp(1 - (windMagnitude /
m_Weather.GetWindMaximumSpeed()), 0.1, 1);
596 heigthDensity =
Math.Lerp( 0.9, 1, lerpValue);
600 m_Weather.SetDynVolFogDistanceDensity(distanceDensity, changeTime);
601 m_Weather.SetDynVolFogHeightDensity(heigthDensity, changeTime);
602 m_Weather.SetDynVolFogHeightBias(heightBias, changeTime);