From 3690519a7c891eb22c0029a2cd6e0776e02a5780 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 25 Jun 2016 20:39:06 +0200 Subject: [PATCH 1/2] disable auto weather - bugging out ACE weather --- addons/weather/Cfg3DEN.hpp | 76 +++++++++++++++++++++++++++++ addons/weather/CfgEventhandlers.hpp | 6 +++ addons/weather/config.cpp | 1 + addons/weather/init3DEN.sqf | 19 ++++++++ 4 files changed, 102 insertions(+) create mode 100644 addons/weather/Cfg3DEN.hpp create mode 100644 addons/weather/init3DEN.sqf diff --git a/addons/weather/Cfg3DEN.hpp b/addons/weather/Cfg3DEN.hpp new file mode 100644 index 00000000000..ec87fcc632d --- /dev/null +++ b/addons/weather/Cfg3DEN.hpp @@ -0,0 +1,76 @@ + +// point of this file is to disable "auto-weather" +// we want this, because it breaks weather commands we use in this component + +// we hide the settings name and remove the tooltip +#define ALWAYS_ENABLE_WEATHER_SETTING control = QGVAR(disabledCheckbox);\ + displayName = "";\ + tooltip = "" + +class Cfg3DEN { + class Attributes { + class Title; + class Checkbox: Title { + class Controls { + class Title; + class Value; + }; + }; + + class GVAR(disabledCheckbox): Checkbox { + // setting is still in the menu, because they have to appear somewhere + // we can however set the size to 0 + w = 0; + h = 0; + attributeLoad = ""; + attributeSave = ""; + class Controls: Controls { + // the control has to have a "Title" and a "Value", otherwise the game crashes + class Title: Title { + // these also have to have a size of 0 or they would appear over the settings below + w = 0; + h = 0; + }; + // We change the "Value"s type to the same of the "Title", so it's not selectable + class Value: Title { + // hard coded. has to be 100, otherwise the game crashes + idc = 100; + }; + }; + }; + }; + class Mission { + class Intel { + class AttributeCategories { + class Rain { + class Attributes { + class RainForced { + ALWAYS_ENABLE_WEATHER_SETTING; + }; + }; + }; + class Lightnings { + class Attributes { + class LightningsForced { + ALWAYS_ENABLE_WEATHER_SETTING; + }; + }; + }; + class Waves { + class Attributes { + class WavesForced { + ALWAYS_ENABLE_WEATHER_SETTING; + }; + }; + }; + class Wind { + class Attributes { + class WindForced { + ALWAYS_ENABLE_WEATHER_SETTING; + }; + }; + }; + }; + }; + }; +}; diff --git a/addons/weather/CfgEventhandlers.hpp b/addons/weather/CfgEventhandlers.hpp index 74dfaab9133..f913c4c22bb 100644 --- a/addons/weather/CfgEventhandlers.hpp +++ b/addons/weather/CfgEventhandlers.hpp @@ -17,3 +17,9 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayLoad_EventHandlers { + class Display3DEN { + ADDON = QUOTE(call COMPILE_FILE(init3DEN)); + }; +}; diff --git a/addons/weather/config.cpp b/addons/weather/config.cpp index f8b8130d371..d271a69169f 100644 --- a/addons/weather/config.cpp +++ b/addons/weather/config.cpp @@ -15,6 +15,7 @@ class CfgPatches { }; #include "CfgEventhandlers.hpp" +#include "Cfg3DEN.hpp" #include "CfgWorlds.hpp" #include "RscTitles.hpp" #include "CfgVehicles.hpp" diff --git a/addons/weather/init3DEN.sqf b/addons/weather/init3DEN.sqf new file mode 100644 index 00000000000..5355b26cc3c --- /dev/null +++ b/addons/weather/init3DEN.sqf @@ -0,0 +1,19 @@ +// point of this file is to disable "auto-weather" +// we want this, because it breaks weather commands we use in this component +#include "script_component.hpp" + +// cannot create checkboxes which have the default value true +// 3den uses inverted checkboxes instead, but those only change in appearence +// we have to auto set these settings manually - on mission creation +// we also want this on mission load, just to reach as many missions as possible +private _fnc_disableAutoWeather = { + set3DENMissionAttributes [ + ["Intel", "IntelRainIsForced", true], + ["Intel", "IntelLightningIsForced", true], + ["Intel", "IntelWavesIsForced", true], + ["Intel", "IntelWindIsForced", true] + ]; +}; + +add3DENEventHandler ["onMissionNew", _fnc_disableAutoWeather]; +add3DENEventHandler ["onMissionLoad", _fnc_disableAutoWeather]; From 1db1c410729addd8cc889c10d725ffc2d00a2288 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 25 Jun 2016 21:46:24 +0200 Subject: [PATCH 2/2] only disable auto-weather settings by default, but keep them toggleable --- addons/weather/Cfg3DEN.hpp | 76 ------------------------------------- addons/weather/config.cpp | 1 - addons/weather/init3DEN.sqf | 12 ++---- 3 files changed, 4 insertions(+), 85 deletions(-) delete mode 100644 addons/weather/Cfg3DEN.hpp diff --git a/addons/weather/Cfg3DEN.hpp b/addons/weather/Cfg3DEN.hpp deleted file mode 100644 index ec87fcc632d..00000000000 --- a/addons/weather/Cfg3DEN.hpp +++ /dev/null @@ -1,76 +0,0 @@ - -// point of this file is to disable "auto-weather" -// we want this, because it breaks weather commands we use in this component - -// we hide the settings name and remove the tooltip -#define ALWAYS_ENABLE_WEATHER_SETTING control = QGVAR(disabledCheckbox);\ - displayName = "";\ - tooltip = "" - -class Cfg3DEN { - class Attributes { - class Title; - class Checkbox: Title { - class Controls { - class Title; - class Value; - }; - }; - - class GVAR(disabledCheckbox): Checkbox { - // setting is still in the menu, because they have to appear somewhere - // we can however set the size to 0 - w = 0; - h = 0; - attributeLoad = ""; - attributeSave = ""; - class Controls: Controls { - // the control has to have a "Title" and a "Value", otherwise the game crashes - class Title: Title { - // these also have to have a size of 0 or they would appear over the settings below - w = 0; - h = 0; - }; - // We change the "Value"s type to the same of the "Title", so it's not selectable - class Value: Title { - // hard coded. has to be 100, otherwise the game crashes - idc = 100; - }; - }; - }; - }; - class Mission { - class Intel { - class AttributeCategories { - class Rain { - class Attributes { - class RainForced { - ALWAYS_ENABLE_WEATHER_SETTING; - }; - }; - }; - class Lightnings { - class Attributes { - class LightningsForced { - ALWAYS_ENABLE_WEATHER_SETTING; - }; - }; - }; - class Waves { - class Attributes { - class WavesForced { - ALWAYS_ENABLE_WEATHER_SETTING; - }; - }; - }; - class Wind { - class Attributes { - class WindForced { - ALWAYS_ENABLE_WEATHER_SETTING; - }; - }; - }; - }; - }; - }; -}; diff --git a/addons/weather/config.cpp b/addons/weather/config.cpp index d271a69169f..f8b8130d371 100644 --- a/addons/weather/config.cpp +++ b/addons/weather/config.cpp @@ -15,7 +15,6 @@ class CfgPatches { }; #include "CfgEventhandlers.hpp" -#include "Cfg3DEN.hpp" #include "CfgWorlds.hpp" #include "RscTitles.hpp" #include "CfgVehicles.hpp" diff --git a/addons/weather/init3DEN.sqf b/addons/weather/init3DEN.sqf index 5355b26cc3c..1bae6c4d955 100644 --- a/addons/weather/init3DEN.sqf +++ b/addons/weather/init3DEN.sqf @@ -1,19 +1,15 @@ -// point of this file is to disable "auto-weather" +// point of this file is to disable "auto-weather" by default // we want this, because it breaks weather commands we use in this component #include "script_component.hpp" -// cannot create checkboxes which have the default value true +// cannot create checkboxes which have the default value "true" // 3den uses inverted checkboxes instead, but those only change in appearence // we have to auto set these settings manually - on mission creation -// we also want this on mission load, just to reach as many missions as possible -private _fnc_disableAutoWeather = { +add3DENEventHandler ["onMissionNew", { set3DENMissionAttributes [ ["Intel", "IntelRainIsForced", true], ["Intel", "IntelLightningIsForced", true], ["Intel", "IntelWavesIsForced", true], ["Intel", "IntelWindIsForced", true] ]; -}; - -add3DENEventHandler ["onMissionNew", _fnc_disableAutoWeather]; -add3DENEventHandler ["onMissionLoad", _fnc_disableAutoWeather]; +}];