From 4d028be8769450b68a27f6be5536722a4eae4040 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 15 May 2016 18:08:54 +0100 Subject: [PATCH] Cleanup zeus display modules Replaces display size and position defines with macros for readability and compactness. Changes naming convention of functions and displays to distinguish categories and make more readable. Converts the global set skill module to use display events rather than waiting in a loop for the module to be set and confirmed. --- addons/zeus/CfgEventHandlers.hpp | 2 +- addons/zeus/CfgVehicles.hpp | 143 +++++++--------- addons/zeus/UI_RscAttributes.hpp | 159 ----------------- addons/zeus/XEH_PREP.hpp | 6 +- addons/zeus/XEH_postInit.sqf | 4 + addons/zeus/config.cpp | 4 +- .../functions/fnc_moduleGlobalSetSkill.sqf | 27 +++ ...SetSkill.sqf => fnc_ui_globalSetSkill.sqf} | 20 +-- ...butes_vehCargo.sqf => fnc_ui_vehCargo.sqf} | 0 .../functions/fnc_zeus_globalSetSkill.sqf | 43 ----- addons/zeus/script_component.hpp | 8 + addons/zeus/ui/RscAttributes.hpp | 160 ++++++++++++++++++ 12 files changed, 267 insertions(+), 309 deletions(-) delete mode 100644 addons/zeus/UI_RscAttributes.hpp create mode 100644 addons/zeus/functions/fnc_moduleGlobalSetSkill.sqf rename addons/zeus/functions/{fnc_zeusAttributes_globalSetSkill.sqf => fnc_ui_globalSetSkill.sqf} (83%) rename addons/zeus/functions/{fnc_zeusAttributes_vehCargo.sqf => fnc_ui_vehCargo.sqf} (100%) delete mode 100644 addons/zeus/functions/fnc_zeus_globalSetSkill.sqf create mode 100644 addons/zeus/ui/RscAttributes.hpp diff --git a/addons/zeus/CfgEventHandlers.hpp b/addons/zeus/CfgEventHandlers.hpp index 7df1664c23..6af3e0ef56 100644 --- a/addons/zeus/CfgEventHandlers.hpp +++ b/addons/zeus/CfgEventHandlers.hpp @@ -13,7 +13,7 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index 8e7e131391..c658e43278 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -86,6 +86,26 @@ class CfgVehicles { scope = 1; scopeCurator = 2; }; + class GVAR(moduleAddSpareTrack): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleAddSpareTrack_DisplayName); + function = QFUNC(moduleAddSpareTrack); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo + class ModuleDescription { + description = CSTRING(ModuleAddSpareTrack_Description); + sync[] = {}; + }; + }; + class GVAR(moduleAddSpareWheel): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleAddSpareWheel_DisplayName); + function = QFUNC(moduleAddSpareWheel); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo + class ModuleDescription { + description = CSTRING(ModuleAddSpareWheel_Description); + sync[] = {}; + }; + }; class GVAR(moduleCaptive): GVAR(moduleBase) { curatorCanAttach = 1; displayName = CSTRING(ModuleCaptive_DisplayName); @@ -96,6 +116,44 @@ class CfgVehicles { sync[] = {}; }; }; + class GVAR(moduleSetMedic): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedic_DisplayName); + function = QFUNC(moduleSetMedic); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; + class GVAR(moduleSetMedicalFacility): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedicalFacility_DisplayName); + function = QFUNC(moduleSetMedicalFacility); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; + class GVAR(moduleSetMedicalVehicle): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedicalVehicle_DisplayName); + function = QFUNC(moduleSetMedicalVehicle); + icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); + class ModuleDescription { + description = ""; + sync[] = {}; + }; + }; + class GVAR(moduleGlobalSetSkill): GVAR(moduleBase) { + displayName = "Global Set AI Skill"; + // icon = "\a3\Modules_F_Curator\Data\iconEndMission_ca.paa"; + // portrait = "\a3\Modules_F_Curator\Data\portraitEndMission_ca.paa"; + curatorInfoType = QGVAR(RscGlobalSetSkill); + class Arguments {}; + class Attributes {};//todo, make it a threden as well + }; class GVAR(moduleSurrender): GVAR(moduleBase) { curatorCanAttach = 1; displayName = CSTRING(ModuleSurrender_DisplayName); @@ -116,89 +174,4 @@ class CfgVehicles { sync[] = {}; }; }; - class GVAR(moduleSetMedic): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedic_DisplayName); - function = QFUNC(moduleSetMedic); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); - class ModuleDescription { - description = ""; - sync[] = {}; - }; - }; - class GVAR(moduleSetMedicalVehicle): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedicalVehicle_DisplayName); - function = QFUNC(moduleSetMedicalVehicle); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); - class ModuleDescription { - description = ""; - sync[] = {}; - }; - }; - class GVAR(moduleSetMedicalFacility): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedicalFacility_DisplayName); - function = QFUNC(moduleSetMedicalFacility); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); - class ModuleDescription { - description = ""; - sync[] = {}; - }; - }; - - class GVAR(moduleAddSpareTrack): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleAddSpareTrack_DisplayName); - function = QFUNC(moduleAddSpareTrack); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo - class ModuleDescription { - description = CSTRING(ModuleAddSpareTrack_Description); - sync[] = {}; - }; - }; - class GVAR(moduleAddSpareWheel): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleAddSpareWheel_DisplayName); - function = QFUNC(moduleAddSpareWheel); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo - class ModuleDescription { - description = CSTRING(ModuleAddSpareWheel_Description); - sync[] = {}; - }; - }; - - // class GVAR(moduleSetSuppression): GVAR(moduleBase) { - // curatorCanAttach = 1; - // displayName = CSTRING(ModuleSetSupp_DisplayName); - // function = QFUNC(moduleSetSuppression); - // class ModuleDescription { - // description = "Set group of units to supressed."; - // sync[] = {}; - // }; - // }; - // class GVAR(moduleDisableSuppression): GVAR(moduleBase) { - // curatorCanAttach = 1; - // displayName = CSTRING(ModuleDisableSupp_DisplayName); - // function = QFUNC(moduleDisableSuppression); - // class ModuleDescription { - // description = "Remove suppression for units in group"; - // sync[] = {}; - // }; - // }; - class GVAR(zeus_globalSetSkill): GVAR(moduleBase) { - author = ECSTRING(common,ACETeam); - category = "ACE"; - scope = 1; - scopeCurator = 2; - isTriggerActivated = 0; - displayName = "Global Set AI Skill"; - // icon = "\a3\Modules_F_Curator\Data\iconEndMission_ca.paa"; - // portrait = "\a3\Modules_F_Curator\Data\portraitEndMission_ca.paa"; - function = QFUNC(zeus_globalSetSkill); - curatorInfoType = QGVAR(RscDisplayAttributes_globalSetSkill); - curatorCost = 0; - class Arguments {}; - class Attributes {};//todo, make it a threden as well - }; }; diff --git a/addons/zeus/UI_RscAttributes.hpp b/addons/zeus/UI_RscAttributes.hpp deleted file mode 100644 index 24007c9f5d..0000000000 --- a/addons/zeus/UI_RscAttributes.hpp +++ /dev/null @@ -1,159 +0,0 @@ -class RscControlsGroup; -class RscControlsGroupNoScrollbars; -class RscText; -class RscListbox; -class RscEdit; -class RscXSliderH; -class RscCheckBox; - -class RscDisplayAttributes { - class Controls { - class Background; - class Title; - class Content: RscControlsGroup { - class controls; - }; - class ButtonOK; - class ButtonCancel; - }; -}; -class GVAR(RscDisplayAttributes_globalSetSkill): RscDisplayAttributes { - onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscDisplayAttributes_globalSetSkill)))] call FUNC(zeusAttributes)); - onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscDisplayAttributes_globalSetSkill)))] call FUNC(zeusAttributes)); - class Controls: Controls { - class Background: Background {}; - class Title: Title {}; - class Content: Content { - class Controls { - class globalSetSkill: RscControlsGroupNoScrollbars { - onSetFocus = QUOTE(_this call FUNC(zeusAttributes_globalSetSkill)); - idc = 26422; - x = "0"; - y = "0"; - w = "26 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "6.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - class controls { - class Title1: RscText { - idc = -1; - text = "Skill: General"; - toolTip = "Global AI Set Skill: general,commanding,courage"; - x = "0 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "10 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0,0,0,0.5}; - }; - class Value1: RscXSliderH { - idc = 16184; - x = "10.1 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "15.9 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Title2: Title1 { - idc = -1; - text = "Skill: aimingAccuracy"; - toolTip = "Global AI Set Skill: aimingAccuracy"; - y = "1.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Value2: Value1 { - idc = 16185; - y = "1.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Title3: Title1 { - idc = -1; - text = "Skill: weaponHandling"; - toolTip = "Global AI Set Skill: aimingShake,aimingSpeed,reloadSpeed"; - y = "2.2 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Value3: Value1 { - idc = 16186; - y = "2.2 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Title4: Title1 { - idc = -1; - text = "Skill: spotting"; - toolTip = "Global AI Set Skill: spotDistance,spotTime"; - y = "3.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Value4: Value1 { - idc = 16187; - y = "3.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Title5: Title1 { - idc = -1; - text = "Seek Cover"; - toolTip = "Global AI Set Skill: AI Seek Cover"; - y = "4.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Value5: RscCheckBox { - idc = 16188; - x = "10.1 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "4.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "1 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Title6: Title5 { - idc = -1; - text = "AUTOCOMBAT"; - toolTip = "Global AI Set Skill: Ai Switch To Combat Mode"; - y = "5.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class Value6: Value5 { - idc = 16189; - y = "5.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - }; - }; - }; - }; - class ButtonOK: ButtonOK {}; - class ButtonCancel: ButtonCancel {}; - }; -}; - -class GVAR(cargoAttribute): RscControlsGroupNoScrollbars { - onSetFocus = QUOTE(_this call FUNC(zeusAttributes_vehCargo)); - idc = 80085; - x = "7 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "10 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "26 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - h = "3 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - class controls { - class Title: RscText { - idc = -1; - text = "Cargo:"; - x = "0 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - h = "3 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0,0,0,0.5}; - }; - class Background: RscText { - idc = -1; - x = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "16 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - h = "2.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {1,1,1,0.1}; - }; - class Cargo: RscListBox { - idc = 80086; - x = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "16 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - h = "3 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - - }; -}; - -class RscDisplayAttributesVehicle: RscDisplayAttributes { - class Controls: Controls { - class Content: Content { - class Controls: controls { - class Cargo: GVAR(cargoAttribute) { }; - }; - }; - }; -}; \ No newline at end of file diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp index 96fc87be01..dc937c2608 100644 --- a/addons/zeus/XEH_PREP.hpp +++ b/addons/zeus/XEH_PREP.hpp @@ -8,6 +8,7 @@ PREP(handleZeusUnitAssigned); PREP(moduleAddSpareTrack); PREP(moduleAddSpareWheel); PREP(moduleCaptive); +PREP(moduleGlobalSetSkill); PREP(moduleSetMedic); PREP(moduleSetMedicalVehicle); PREP(moduleSetMedicalFacility); @@ -15,7 +16,6 @@ PREP(moduleSurrender); PREP(moduleUnconscious); PREP(moduleZeusSettings); PREP(setSkillsLocal); -PREP(zeus_globalSetSkill); +PREP(ui_globalSetSkill); +PREP(ui_vehCargo); PREP(zeusAttributes); -PREP(zeusAttributes_globalSetSkill); -PREP(zeusAttributes_vehCargo); diff --git a/addons/zeus/XEH_postInit.sqf b/addons/zeus/XEH_postInit.sqf index 187b46c669..c05983b00f 100644 --- a/addons/zeus/XEH_postInit.sqf +++ b/addons/zeus/XEH_postInit.sqf @@ -1,5 +1,9 @@ #include "script_component.hpp" +if (isServer) then { + ["ServerUpdateAISettings",FUNC(moduleGlobalSetSkill)] call EFUNC(common,addEventHandler); +}; + ["UpdateAISettings", { TRACE_1("UpdateAISettings EH",_this); { diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index 71e6c2b8fe..b069ff8e90 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {QGVAR(zeus_globalSetSkill)}; + units[] = {QGVAR(moduleGlobalSetSkill)}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; @@ -42,4 +42,4 @@ class ACE_Curator { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "ACE_Settings.hpp" -#include "UI_RscAttributes.hpp" +#include "ui\RscAttributes.hpp" diff --git a/addons/zeus/functions/fnc_moduleGlobalSetSkill.sqf b/addons/zeus/functions/fnc_moduleGlobalSetSkill.sqf new file mode 100644 index 0000000000..d654801894 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleGlobalSetSkill.sqf @@ -0,0 +1,27 @@ +#include "script_component.hpp" + +params ["_logic"]; +TRACE_1("params",_logic); + +[QGVAR(aiSkill_set), true, false, true] call ace_common_fnc_setSetting; +if (!GVAR(aiSkill_set)) exitWith { + TRACE_1("Setting must be forced off", GVAR(aiSkill_set)); +}; + +private _val = _logic getVariable ["aiSkill_general", -1]; +if (_val != -1) then { [QGVAR(aiSkill_general), _val, false, true] call ace_common_fnc_setSetting; }; +_val = _logic getVariable ["aiSkill_aimingAccuracy", -1]; +if (_val != -1) then { [QGVAR(aiSkill_aimingAccuracy), _val, false, true] call ace_common_fnc_setSetting; }; +_val = _logic getVariable ["aiSkill_weaponHandling", -1]; +if (_val != -1) then { [QGVAR(aiSkill_weaponHandling), _val, false, true] call ace_common_fnc_setSetting; }; +_val = _logic getVariable ["aiSkill_spotting", -1]; +if (_val != -1) then { [QGVAR(aiSkill_spotting), _val, false, true] call ace_common_fnc_setSetting; }; +_val = _logic getVariable ["aiSkill_COVER", -1]; +if (!(_val isEqualTo -1)) then { [QGVAR(aiSkill_COVER), _val, false, true] call ace_common_fnc_setSetting; }; +_val = _logic getVariable ["aiSkill_AUTOCOMBAT", -1]; +if (!(_val isEqualTo -1)) then { [QGVAR(aiSkill_AUTOCOMBAT), _val, false, true] call ace_common_fnc_setSetting; }; + +["UpdateAISettings", []] call ace_common_fnc_globalEvent; +deleteVehicle _logic; + +TRACE_6("ai settings updated",GVAR(aiSkill_general),GVAR(aiSkill_aimingAccuracy),GVAR(aiSkill_weaponHandling),GVAR(aiSkill_spotting),GVAR(aiSkill_COVER),GVAR(aiSkill_AUTOCOMBAT)); diff --git a/addons/zeus/functions/fnc_zeusAttributes_globalSetSkill.sqf b/addons/zeus/functions/fnc_ui_globalSetSkill.sqf similarity index 83% rename from addons/zeus/functions/fnc_zeusAttributes_globalSetSkill.sqf rename to addons/zeus/functions/fnc_ui_globalSetSkill.sqf index 329102d599..3b7c0b3e5f 100644 --- a/addons/zeus/functions/fnc_zeusAttributes_globalSetSkill.sqf +++ b/addons/zeus/functions/fnc_ui_globalSetSkill.sqf @@ -8,7 +8,7 @@ TRACE_1("params",_control); //Generic Init: private _display = ctrlparent _control; private _ctrlButtonOK = _display displayctrl 1; //IDC_OK -private _logic = missionNamespace getVariable ["BIS_fnc_initCuratorAttributes_target", objnull]; +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); TRACE_1("logicObject",_logic); _control ctrlRemoveAllEventHandlers "setFocus"; @@ -22,7 +22,7 @@ _fnc_sliderMove = { case (16186): {GVAR(aiSkill_weaponHandling)}; case (16187): {GVAR(aiSkill_spotting)}; }; - _slider ctrlSetTooltip format ["%1 (was %2)", sliderPosition _slider, _curVal]; + _slider ctrlSetTooltip format ["%1%3 (was %2%3)", round(sliderPosition _slider * 100), round(_curVal * 100), "%"]; }; //Specific on-load stuff: @@ -50,18 +50,6 @@ _fnc_sliderMove = { (_display displayCtrl 16189) cbSetChecked GVAR(aiSkill_AUTOCOMBAT); - - -private _fnc_onUnload = { - params [["_display", displayNull, [displayNull]]]; - TRACE_1("_fnc_onUnload params",_display); - - private _logic = missionnamespace getVariable ["BIS_fnc_initCuratorAttributes_target", objnull]; - if (isNull _logic) exitWith {}; - - _logic setVariable ["closed", true]; -}; - private _fnc_onConfirm = { params [["_ctrlButtonOK", controlNull, [controlNull]]]; TRACE_1("_fnc_onConfirm params",_this); @@ -78,8 +66,8 @@ private _fnc_onConfirm = { _logic setVariable ["aiSkill_spotting", sliderPosition (_display displayCtrl 16187), true]; _logic setVariable ["aiSkill_COVER", cbChecked (_display displayCtrl 16188), true]; _logic setVariable ["aiSkill_AUTOCOMBAT", cbChecked (_display displayCtrl 16189), true]; - _logic setVariable ["set", true, true]; + + ["ServerUpdateAISettings", [_logic]] call EFUNC(common,serverEvent); }; -_display displayaddeventhandler ["unload", _fnc_onUnload]; _ctrlButtonOK ctrladdeventhandler ["buttonclick", _fnc_onConfirm]; diff --git a/addons/zeus/functions/fnc_zeusAttributes_vehCargo.sqf b/addons/zeus/functions/fnc_ui_vehCargo.sqf similarity index 100% rename from addons/zeus/functions/fnc_zeusAttributes_vehCargo.sqf rename to addons/zeus/functions/fnc_ui_vehCargo.sqf diff --git a/addons/zeus/functions/fnc_zeus_globalSetSkill.sqf b/addons/zeus/functions/fnc_zeus_globalSetSkill.sqf deleted file mode 100644 index 763947292f..0000000000 --- a/addons/zeus/functions/fnc_zeus_globalSetSkill.sqf +++ /dev/null @@ -1,43 +0,0 @@ -#include "script_component.hpp" - -params ["_logic"]; -TRACE_1("params",_logic); - -if (!isServer) exitWith {}; - -[{ - params ["_logic"]; - (isNull _logic) || {_logic getVariable ["closed", false]} -}, { - params ["_logic"]; - if (isNull _logic) exitWith {TRACE_1("null",_logic);}; - - if (_logic getVariable ["set", false]) then { - - [QGVAR(aiSkill_set), true, false, true] call ace_common_fnc_setSetting; - if (!GVAR(aiSkill_set)) exitWith { - TRACE_1("Setting must be forced off", GVAR(aiSkill_set)); - }; - - private _val = _logic getVariable ["aiSkill_general", -1]; - if (_val != -1) then { [QGVAR(aiSkill_general), _val, false, true] call ace_common_fnc_setSetting; }; - _val = _logic getVariable ["aiSkill_aimingAccuracy", -1]; - if (_val != -1) then { [QGVAR(aiSkill_aimingAccuracy), _val, false, true] call ace_common_fnc_setSetting; }; - _val = _logic getVariable ["aiSkill_weaponHandling", -1]; - if (_val != -1) then { [QGVAR(aiSkill_weaponHandling), _val, false, true] call ace_common_fnc_setSetting; }; - _val = _logic getVariable ["aiSkill_spotting", -1]; - if (_val != -1) then { [QGVAR(aiSkill_spotting), _val, false, true] call ace_common_fnc_setSetting; }; - _val = _logic getVariable ["aiSkill_COVER", -1]; - if (!(_val isEqualTo -1)) then { [QGVAR(aiSkill_COVER), _val, false, true] call ace_common_fnc_setSetting; }; - _val = _logic getVariable ["aiSkill_AUTOCOMBAT", -1]; - if (!(_val isEqualTo -1)) then { [QGVAR(aiSkill_AUTOCOMBAT), _val, false, true] call ace_common_fnc_setSetting; }; - - ["UpdateAISettings", []] call ace_common_fnc_globalEvent; - - TRACE_6("ai settings updated",GVAR(aiSkill_general),GVAR(aiSkill_aimingAccuracy),GVAR(aiSkill_weaponHandling),GVAR(aiSkill_spotting),GVAR(aiSkill_COVER),GVAR(aiSkill_AUTOCOMBAT)); - } else { - TRACE_1("closed but not set",_logic); - }; - - deleteVehicle _logic; -}, [_logic]] call ace_common_fnc_waitUntilAndExecute; diff --git a/addons/zeus/script_component.hpp b/addons/zeus/script_component.hpp index cb0fa29be3..953418761f 100644 --- a/addons/zeus/script_component.hpp +++ b/addons/zeus/script_component.hpp @@ -15,3 +15,11 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +// UI grid +#define SIZEX ((safezoneW / safezoneH) min 1.2) +#define SIZEY (SIZEX / 1.2) +#define W_PART(num) (num * (SIZEX / 40)) +#define H_PART(num) (num * (SIZEY / 25)) +#define X_PART(num) (W_PART(num) + (safezoneX + (safezoneW - SIZEX)/2)) +#define Y_PART(num) (H_PART(num) + (safezoneY + (safezoneH - SIZEY)/2)) diff --git a/addons/zeus/ui/RscAttributes.hpp b/addons/zeus/ui/RscAttributes.hpp new file mode 100644 index 0000000000..ad0a09246c --- /dev/null +++ b/addons/zeus/ui/RscAttributes.hpp @@ -0,0 +1,160 @@ +class RscControlsGroup; +class RscControlsGroupNoScrollbars; +class RscText; +class RscListbox; +class RscEdit; +class RscXSliderH; +class RscCheckBox; + +class RscDisplayAttributes { + class Controls { + class Background; + class Title; + class Content: RscControlsGroup { + class controls; + }; + class ButtonOK; + class ButtonCancel; + }; +}; + +class GVAR(RscGlobalSetSkill): RscDisplayAttributes { + onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscGlobalSetSkill)))] call FUNC(zeusAttributes)); + onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscGlobalSetSkill)))] call FUNC(zeusAttributes)); + class Controls: Controls { + class Background: Background {}; + class Title: Title {}; + class Content: Content { + class Controls { + class globalSetSkill: RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_globalSetSkill)); + idc = 26422; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(6.5); + class controls { + class Title1: RscText { + idc = -1; + text = "Skill: General"; + toolTip = "Global AI Set Skill: general,commanding,courage"; + x = 0; + y = 0; + w = W_PART(10); + h = H_PART(1); + colorBackground[] = {0,0,0,0.5}; + }; + class Value1: RscXSliderH { + idc = 16184; + x = W_PART(10.1); + y = 0; + w = W_PART(15.9); + h = H_PART(1); + }; + class Title2: Title1 { + idc = -1; + text = "Skill: aimingAccuracy"; + toolTip = "Global AI Set Skill: aimingAccuracy"; + y = H_PART(1.1); + }; + class Value2: Value1 { + idc = 16185; + y = H_PART(1.1); + }; + class Title3: Title1 { + idc = -1; + text = "Skill: weaponHandling"; + toolTip = "Global AI Set Skill: aimingShake,aimingSpeed,reloadSpeed"; + y = H_PART(2.2); + }; + class Value3: Value1 { + idc = 16186; + y = H_PART(2.2); + }; + class Title4: Title1 { + idc = -1; + text = "Skill: spotting"; + toolTip = "Global AI Set Skill: spotDistance,spotTime"; + y = H_PART(3.3); + }; + class Value4: Value1 { + idc = 16187; + y = H_PART(3.3); + }; + class Title5: Title1 { + idc = -1; + text = "Seek Cover"; + toolTip = "Global AI Set Skill: AI Seek Cover"; + y = H_PART(4.4); + }; + class Value5: RscCheckBox { + idc = 16188; + x = W_PART(10.1); + y = H_PART(4.4); + w = W_PART(1); + h = H_PART(1); + }; + class Title6: Title5 { + idc = -1; + text = "AUTOCOMBAT"; + toolTip = "Global AI Set Skill: Ai Switch To Combat Mode"; + y = H_PART(5.5); + }; + class Value6: Value5 { + idc = 16189; + y = H_PART(5.5); + }; + }; + }; + }; + }; + class ButtonOK: ButtonOK {}; + class ButtonCancel: ButtonCancel {}; + }; +}; + +class GVAR(cargoAttribute): RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_vehCargo)); + idc = 80085; + x = X_PART(7); + y = Y_PART(10); + w = W_PART(26); + h = H_PART(3); + class controls { + class Title: RscText { + idc = -1; + text = "Cargo:"; + x = 0; + y = 0; + w = W_PART(10); + h = H_PART(3); + colorBackground[] = {0,0,0,0.5}; + }; + class Background: RscText { + idc = -1; + x = W_PART(10); + y = 0; + w = W_PART(16); + h = H_PART(2.5); + colorBackground[] = {1,1,1,0.1}; + }; + class Cargo: RscListBox { + idc = 80086; + x = W_PART(10); + y = 0; + w = W_PART(16); + h = H_PART(3); + }; + + }; +}; + +class RscDisplayAttributesVehicle: RscDisplayAttributes { + class Controls: Controls { + class Content: Content { + class Controls: controls { + class Cargo: GVAR(cargoAttribute) { }; + }; + }; + }; +};