93 {
94 #ifdef WEATHER_DATA_LOGGING
95 if ( !dayInit )
96 {
97 g_Game.GetWorld().GetDate(startYear, startMonth, startDay, startHour, startMinute);
98 dayInit = true;
99 }
100 #endif
101
102 float phmnTime = 5;
103 float phmnLength = 10;
104 float phmnValue = 0;
105
108
111
113 {
115 }
116
117 switch (type)
118 {
119
121 {
122 #ifdef WEATHER_DATA_LOGGING
123 overcastChangeCount++;
124 #endif
125
126 float windDirection, windMag;
127
128
129 phmnValue = Math.RandomFloatInclusive( 0.2, 0.7 );
132
133
134
135 m_Chance = Math.RandomIntInclusive( 0, 100 );
136
137
138 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
139 {
141 }
142
143 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
144 {
146 }
147
148 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
149 {
152 }
153
154
156 {
158 if (
m_LastWeather == WorldDataWeatherConstants.CLEAR_WEATHER )
160 }
162 {
164 if (
m_LastWeather == WorldDataWeatherConstants.BAD_WEATHER )
166 }
167 else
168 {
170 if (
m_LastWeather == WorldDataWeatherConstants.CLOUDY_WEATHER )
172 }
173
176
179
180
181
183 {
185 #ifdef WEATHER_DATA_LOGGING
186 clearWeatherCount++;
187 #endif
188
189 phmnValue = Math.RandomFloatInclusive( 0.0, 0.3 );
192 }
193
195 {
197 #ifdef WEATHER_DATA_LOGGING
198 cloudyWeatherCount++;
199 #endif
200
201 phmnValue = Math.RandomFloatInclusive( 0.3, 0.6 );
204 }
205
207 {
209 #ifdef WEATHER_DATA_LOGGING
210 badWeatherCount++;
211 #endif
212
213 phmnValue = Math.RandomFloatInclusive( 0.6, 1.0 );
216 }
217
218 m_Weather.GetOvercast().Set( phmnValue, phmnTime, phmnLength );
219
223
225
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()));
228
229 #ifdef WEATHER_DATA_LOGGING
230 int testYear = 0;
231 int testMonth = 0;
232 int testDay = 0;
233 int testHour = 0;
234 int testMinute = 0;
235 g_Game.GetWorld().GetDate(testYear, testMonth, testDay, testHour, testMinute);
236
237 if ( testDay - startDay > currentDay && testHour - startHour >= 0 && testMinute - startMinute >= 0 )
238 {
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);
247
248 currentDay++;
250 if ( currentDay == daysToRun )
251 {
253 }
254
255 overcastChangeCount = 0;
256 badWeatherCount = 0;
257 cloudyWeatherCount = 0;
258 clearWeatherCount = 0;
259 }
260 #endif
261
262 return true;
263 }
264
266 {
267 float actualOvercast =
m_Weather.GetOvercast().GetActual();
268
269 m_Chance = Math.RandomIntInclusive( 0, 100 );
270 phmnValue = 0.2;
271 phmnTime = 90;
272 phmnLength = 30;
273
275 {
277 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain::ForceEnd:: (%1) %2 -> 0",
g_Game.GetDayTime(), actual));
278 return true;
279 }
280
282 {
283 phmnValue = Math.RandomFloatInclusive( 0.8, 1.0 );
285 phmnLength = 0;
286
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));
289 return true;
290 }
291
292
293 if ( actualOvercast < 0.75 )
294 {
296 {
297 phmnValue = Math.RandomFloatInclusive( 0.1, 0.3 );
299 phmnLength = 0;
300 }
302 {
303 phmnValue = Math.RandomFloatInclusive( 0.2, 0.5 );
305 phmnLength = 0;
306 }
308 {
309 phmnValue = Math.RandomFloatInclusive( 0.0, 0.2 );
311 phmnLength = 0;
312 }
313 else
314 {
315 phmnValue = 0;
318 }
319 }
320 else
321 {
323 {
324 phmnValue = Math.RandomFloatInclusive( 0.5, 0.7 );
326 phmnLength = 0;
327 }
329 {
330 phmnValue = Math.RandomFloatInclusive( 0.2, 0.4 );
332 phmnLength = 0;
333 }
335 {
336 phmnValue = Math.RandomFloatInclusive( 0.4, 0.6 );
338 phmnLength = 0;
339 }
340 else
341 {
342 phmnValue = 0;
345 }
346 }
347
348 m_Weather.GetRain().Set( phmnValue, phmnTime, phmnLength );
349
350 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Rain:: (%1) %2",
g_Game.GetDayTime(), actual));
351
352 return true;
353 }
354
356 {
357 float fogMin = 0.0;
358 float fogMax = 0.15;
359 float fogTime = 1800.0;
360
361 float fogyMorning = Math.RandomFloatInclusive( 0.0, 1.0 );
362
363 if ( fogyMorning > 0.85 )
364 {
365 if ( (
g_Game.GetDayTime() > 4 &&
g_Game.GetDayTime() < 7 ) )
366 {
367 fogMin = 0.10;
368 fogMax = 0.35;
369 fogTime = 300;
370 }
371 }
372
373 if (
m_Weather.GetOvercast().GetActual() < 0.3 )
374 {
375 fogMin = 0.0;
376 fogMax = 0.08;
377 fogTime = 900.0;
378 }
379
380 m_Weather.GetFog().Set( Math.RandomFloatInclusive( fogMin, fogMax ), fogTime, 0);
381
382 Debug.WeatherLog(
string.Format(
"Chernarus::Weather::Fog:: (%1) %2",
g_Game.GetDayTime(), actual));
383
384 return true;
385 }
386
388 {
391
392 return true;
393 }
394 }
395
396 return false;
397 }
override void CalculateVolFog(float lerpValue, float windMagnitude, float changeTime)
override void CalculateWind(int newWeather, bool suddenChange, out float magnitude, out float direction)
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.