From 3690519a7c891eb22c0029a2cd6e0776e02a5780 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 25 Jun 2016 20:39:06 +0200 Subject: [PATCH] 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 0000000000..ec87fcc632 --- /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 74dfaab913..f913c4c22b 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 f8b8130d37..d271a69169 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 0000000000..5355b26cc3 --- /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];