2015-04-17 04:44:38 +00:00
|
|
|
/*
|
|
|
|
* Author: ACE2 Team
|
2015-04-20 11:54:22 +00:00
|
|
|
*
|
2015-04-17 04:44:38 +00:00
|
|
|
* Calculate current wind locally from the data broadcasted by the server
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Wind <ARRAY>
|
|
|
|
*/
|
2015-01-20 23:18:40 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-17 04:44:38 +00:00
|
|
|
private ["_dir","_dirInc","_dirRange","_period","_periodPercent","_periodPosition","_return","_spd","_spdInc","_spdRange"];
|
2015-01-20 23:18:40 +00:00
|
|
|
|
|
|
|
_return = [0,0,0];
|
|
|
|
if(!isNil "ACE_WIND_PARAMS") then {
|
2015-01-21 03:00:32 +00:00
|
|
|
_dir = ACE_WIND_PARAMS select 0;
|
|
|
|
_dirRange = (ACE_WIND_PARAMS select 1) - (ACE_WIND_PARAMS select 0);
|
|
|
|
_spd = ACE_WIND_PARAMS select 2;
|
|
|
|
_spdRange = (ACE_WIND_PARAMS select 3) - (ACE_WIND_PARAMS select 2);
|
|
|
|
_period = ACE_WIND_PARAMS select 4;
|
2015-01-20 23:18:40 +00:00
|
|
|
|
2015-01-21 03:00:32 +00:00
|
|
|
_periodPosition = (time - GVAR(wind_period_start_time)) min _period;
|
|
|
|
_periodPercent = _periodPosition/_period;
|
|
|
|
_spdInc = _spdRange * _periodPercent;
|
|
|
|
_dirInc = _dirRange * _periodPercent;
|
|
|
|
_spd = (_spd + _spdInc);
|
|
|
|
_dir = _dir + _dirInc;
|
|
|
|
if (_dir > 360) then {_dir = _dir - 360};
|
|
|
|
if (_dir < 0) then {_dir = _dir + 360};
|
2015-01-20 23:18:40 +00:00
|
|
|
|
2015-01-21 03:00:32 +00:00
|
|
|
_return = [_spd * sin _dir, _spd * cos _dir, 0];
|
2015-01-20 23:18:40 +00:00
|
|
|
};
|
|
|
|
_return;
|