139 {
140 #ifdef WEATHER_DATA_LOGGING
141 if ( !dayInit )
142 {
143 g_Game.GetWorld().GetDate(startYear, startMonth, startDay, startHour, startMinute);
144 dayInit = true;
145 }
146 #endif
147
148 float phmnTime = 5;
149 float phmnLength = 10;
150 float phmnValue = 0;
151
152 int year, month, day, hour, minute;
153 g_Game.GetWorld().GetDate(year, month, day, hour, minute);
154
157
160
161 switch (type)
162 {
163
165 {
166 #ifdef WEATHER_DATA_LOGGING
167 overcastChangeCount++;
168 #endif
169
170 float windDirection, windMag;
171
172
173 phmnValue = Math.RandomFloatInclusive( 0.1, 0.4 );
176
177
178
179 m_Chance = Math.RandomIntInclusive( 0, 100 );
180
181
182 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
183 {
185 }
186
187 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
188 {
191 }
192
193 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
194 {
197 }
198
199
201 {
204 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
206 }
208 {
211 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
213 }
215 {
218 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
220 }
221 else
222 {
225 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
227 }
228
231
234
235
236
238 {
240 #ifdef WEATHER_DATA_LOGGING
241 clearWeatherCount++;
242 #endif
243
244 phmnValue = Math.RandomFloatInclusive( 0.0, 0.3 );
247 }
248
250 {
252 #ifdef WEATHER_DATA_LOGGING
253 cloudyWeatherCount++;
254 #endif
255
256 phmnValue = Math.RandomFloatInclusive( 0.3, 0.7 );
259 }
260
262 {
264
265 phmnValue = Math.RandomFloatInclusive( 0.7, 1.0 );
268
269 #ifdef WEATHER_DATA_LOGGING
270 badWeatherCount++;
271 #endif
272
274 {
275 #ifdef WEATHER_DATA_LOGGING
276 suddenChangeCount++;
277 badWeatherCount--;
278 #endif
279
282 }
283
284 #ifdef WEATHER_DATA_LOGGING
286 {
288 {
289 suddenChangeCount--;
290 suddenStormCount++;
291 }
292 else
293 { stormCount++;
294 badWeatherCount--;
295 }
296 }
297 #endif
298 }
299
300 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
301
302
306
308
310 {
311 m_Weather.GetRain().Set(Math.RandomFloatInclusive( 0.4, 0.8 ), phmnTime, 0);
312 }
313
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()));
316
317 #ifdef WEATHER_DATA_LOGGING
318 int testYear = 0;
319 int testMonth = 0;
320 int testDay = 0;
321 int testHour = 0;
322 int testMinute = 0;
323 g_Game.GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
324
325 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
326 {
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);
338
339 currentDay++;
341 if ( currentDay == daysToRun )
342 {
344 }
345
346 overcastChangeCount = 0;
347 suddenChangeCount = 0;
348 stormCount = 0;
349 suddenStormCount = 0;
350 badWeatherCount = 0;
351 cloudyWeatherCount = 0;
352 clearWeatherCount = 0;
353 }
354 #endif
355
356 return true;
357 }
358
360 {
361 float actualOvercast =
m_Weather.GetOvercast().GetActual();
362
363 m_Chance = Math.RandomIntInclusive( 0, 100 );
364 phmnValue = 0.2;
365 phmnTime = 90;
366 phmnLength = 30;
367
369 {
371 Debug.WeatherLog (
string.Format(
"Enoch::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
372 return true;
373 }
374
376 {
378 {
379 phmnValue = 0;
382 }
383 else
384 {
385 phmnValue = Math.RandomFloatInclusive( 0.8, 1.0 );
387 phmnLength = 0;
388 }
389
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));
392 return true;
393 }
394
395
396 if ( actualOvercast < 0.75 )
397 {
399 {
400 phmnValue = Math.RandomFloatInclusive( 0.1, 0.3 );
403 }
405 {
406 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
409 }
411 {
412 phmnValue = Math.RandomFloatInclusive( 0.05, 0.2 );
415 }
416 else
417 {
418 phmnValue = 0;
421 }
422 }
423 else
424 {
426 {
427 phmnValue = Math.RandomFloatInclusive( 0.4, 0.6 );
429 phmnLength = 0;
430 }
432 {
433 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
435 phmnLength = 0;
436 }
438 {
439 phmnValue = Math.RandomFloatInclusive( 0.6, 0.8 );
441 phmnLength = 0;
442 }
443 else
444 {
445 phmnValue = 0;
448 }
449 }
450
451 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
452
453 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
454 return true;
455 }
456
458 {
459 if (( hour >= 2 ) && ( hour <= 5 ))
460 {
462 }
463 else
464 {
466 }
467
468 Debug.WeatherLog(
string.Format(
"Enoch::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));
469
470 return true;
471 }
472
474 {
477
478 return true;
479 }
480 }
481 return false;
482 }
override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
float SUDDENCHANGE_TIME_MULTIPLIER
float SUDDENCHANGE_LENGTH_MULTIPLIER
float WIND_DIRECTION_TIME_MULTIPLIER
ref WorldDataWeatherSettings m_WeatherDefaultSettings
int m_BadWeatherChance
weather related
float WIND_MAGNITUDE_TIME_MULTIPLIER
proto void CloseFile(FileHandle file)
Close the File.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.