From a9726d2b608865ccdea491a3c4b2521f9fdedb4a Mon Sep 17 00:00:00 2001 From: ulteq Date: Wed, 22 Apr 2015 19:46:27 +0200 Subject: [PATCH] Simplified the wind direction change calculation --- addons/weather/functions/fnc_getWind.sqf | 2 ++ addons/weather/functions/fnc_serverController.sqf | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/weather/functions/fnc_getWind.sqf b/addons/weather/functions/fnc_getWind.sqf index 33750b77dd..5f050d74b3 100644 --- a/addons/weather/functions/fnc_getWind.sqf +++ b/addons/weather/functions/fnc_getWind.sqf @@ -28,4 +28,6 @@ TRACE_2("Dir: Current/Change",Round(_dir),Round(_dirChange)); TRACE_2("Spd: Current/Change",Round(_spd * 10) / 10,Round(_spdChange * 10) / 10); TRACE_3("Period/Position/Percent",Round(_period),Round(_periodPosition),Round(_periodPercent * 100) / 100); +// TODO: Add some deterministic noise + [-_spd * sin(_dir), -_spd * cos(_dir), 0] diff --git a/addons/weather/functions/fnc_serverController.sqf b/addons/weather/functions/fnc_serverController.sqf index 6bc0f4a9bc..5e6928d5b1 100644 --- a/addons/weather/functions/fnc_serverController.sqf +++ b/addons/weather/functions/fnc_serverController.sqf @@ -53,10 +53,10 @@ if(GVAR(wind_period_count) > GVAR(wind_next_period)) then { _windDirection = (360 + GVAR(wind_direction_reference) + _windDirectionVariance) % 360; _windDirectionChange = _windDirection - GVAR(current_wind_direction); if (_windDirectionChange > 180) then { - _windDirectionChange = 360 - _windDirectionChange; + _windDirectionChange = _windDirectionChange - 360; }; if (_windDirectionChange < -180) then { - _windDirectionChange = -360 - _windDirectionChange; + _windDirectionChange = 360 + _windDirectionChange; }; _windMaxDiff = GVAR(mean_wind_speed) - GVAR(max_wind_speed);