From 4a29f6a3c32ea505e5a435e8a3e25e01b586677b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 20 Jan 2015 23:17:09 -0300 Subject: [PATCH] Set wind and rain syncing. Change ACE_wind from macro to global variable --- addons/main/script_macros.hpp | 11 ++++------- addons/weather/XEH_postInit.sqf | 10 +++++++--- addons/weather/XEH_preInit.sqf | 3 ++- addons/weather/functions/fnc_serverController.sqf | 2 +- addons/weather/script_component.hpp | 2 +- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 814c46d24b..3b59e8b373 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -52,7 +52,7 @@ #define ACE_NOZEROING discreteDistance[] = {}; \ discreteDistanceInitIndex = 0; \ weaponInfoType = "RscWeaponEmpty" - + #define ACE_NOTURRETZEROING discreteDistance[] = {}; \ discreteDistanceInitIndex = 0; \ turretInfoType = "RscWeaponEmpty" @@ -62,7 +62,7 @@ irDistance = 300 #define ACE_LASER_DISTANCE_VANILLA irDistance = 300 - + #define ACE_NOLASER irLaserPos = "laser pos"; \ irLaserEnd = "laser dir"; \ irDistance = 0 @@ -100,9 +100,6 @@ #define ACE_BWC ace_bwc = 1 -#define ACE_wind ([] call ace_ballistic_fnc_wind) - - // SCRIPTING MACROS // Items @@ -129,7 +126,7 @@ #define KNOCKOUT ace_common_fx_fnc_knockout #define RING ace_common_fx_fnc_ring -// Stamina +// Stamina #define INC_MASS ace_stamina_fnc_inc_mass // Does this work, due to BWC_CONFIG(NAME) ? @@ -164,7 +161,7 @@ } // Addaction defines for colored text -#define ACE_TEXT_ORANGE(Text) ("" + ##Text + "") +#define ACE_TEXT_ORANGE(Text) ("" + ##Text + "") #define ACE_TEXT_RED(Text) ("" + ##Text + "") #define ACE_TEXT_GREEN(Text) ("" + ##Text + "") #define ACE_TEXT_YELLOW(Text) ("" + ##Text + "") diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index 8ca681d0d1..e597bf95d7 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -4,9 +4,13 @@ "ACE_WIND_PARAMS" addPublicVariableEventHandler { GVAR(wind_period_start_time) = time; }; "ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = time; }; -_fnc_uptadeWind = { +simulWeatherSync; +_fnc_updateWind = { _wind = ([] call FUNC(getWind)); + ACE_wind = [_wind select 0, _wind select 1]; setWind [_wind select 0, _wind select 1, true]; + 2 setGusts 0; + //systemChat format ["w: %1 %2, ACE_wind: %1 %2", [wind select 0, wind select 1, ACE_wind select 0, ACE_wind select 1]]; // _nWind = wind; // _pW = [_nWind select 0, _nWind select 1, 0] call CBA_fnc_vect2polar; // _pAW = [_wind select 0, _wind select 1, 0] call CBA_fnc_vect2polar; @@ -14,7 +18,7 @@ _fnc_uptadeWind = { // diag_log text format["ACE_WIND,%1,%2,%3,%4,%5", time, _pW select 1, _pw select 0, _pAW select 1, _pAW select 0]; }; -[_fnc_uptadeWind, 1, []] call CBA_fnc_addPerFrameHandler; +[_fnc_updateWind, 1, []] call CBA_fnc_addPerFrameHandler; _fnc_updateRain = { if(GVAR(enableRain)) then { @@ -30,4 +34,4 @@ _fnc_updateRain = { }; }; -[_fnc_updateRain, 0, []] call CBA_fnc_addPerFrameHandler; \ No newline at end of file +[_fnc_updateRain, 2, []] call CBA_fnc_addPerFrameHandler; \ No newline at end of file diff --git a/addons/weather/XEH_preInit.sqf b/addons/weather/XEH_preInit.sqf index 26b854c4e7..567e7eb7c8 100644 --- a/addons/weather/XEH_preInit.sqf +++ b/addons/weather/XEH_preInit.sqf @@ -7,8 +7,9 @@ LOG(MSG_INIT); PREP(serverController); PREP(getWind); +ACE_wind = [0, 0]; -GVAR(enableRain) = false; +GVAR(enableRain) = true; GVAR(overcast_multiplier) = 1; diff --git a/addons/weather/functions/fnc_serverController.sqf b/addons/weather/functions/fnc_serverController.sqf index 1ab57c17c5..2adc6e1c38 100644 --- a/addons/weather/functions/fnc_serverController.sqf +++ b/addons/weather/functions/fnc_serverController.sqf @@ -6,7 +6,7 @@ if(GVAR(rain_period_count) > GVAR(rain_next_period)) then { if(overcast >= 0.7) then { _lastRain = GVAR(current_rain); _rainOverCast = ((overcast-0.7)/0.3); - GVAR(rain_next_period) = ceil((1+random(10))/(GVAR(overcast_multiplier))); + GVAR(rain_next_period) = ceil((1+random(10))/GVAR(overcast_multiplier)); GVAR(current_rain) = (GVAR(current_rain)+(((GVAR(current_rain)))*((_rainOverCast*(GVAR(overcast_multiplier)))/8)*GVAR(rain_current_range))); GVAR(current_rain) = (GVAR(current_rain) max 0.01) min 1; diff --git a/addons/weather/script_component.hpp b/addons/weather/script_component.hpp index c003631095..abfe607257 100644 --- a/addons/weather/script_component.hpp +++ b/addons/weather/script_component.hpp @@ -1,6 +1,6 @@ #define COMPONENT weather #include "\z\ace\addons\main\script_mod.hpp" -#define DEBUG_ENABLED_WEATHER +//#define DEBUG_ENABLED_WEATHER #ifdef DEBUG_ENABLED_WEATHER #define DEBUG_MODE_FULL #endif