diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp index 0de614f190..eb70a8529d 100644 --- a/addons/zeus/XEH_PREP.hpp +++ b/addons/zeus/XEH_PREP.hpp @@ -19,6 +19,7 @@ PREP(moduleTeleportPlayers); PREP(moduleUnconscious); PREP(moduleZeusSettings); PREP(ui_attributeCargo); +//PREP(ui_attributePosition); PREP(ui_attributeRadius); PREP(ui_defendArea); PREP(ui_globalSetSkill); diff --git a/addons/zeus/functions/fnc_ui_attributePosition.sqf b/addons/zeus/functions/fnc_ui_attributePosition.sqf new file mode 100644 index 0000000000..95557a891b --- /dev/null +++ b/addons/zeus/functions/fnc_ui_attributePosition.sqf @@ -0,0 +1,60 @@ +/* + * Author: SilentSpike + * Initalises the `position` zeus module attribute + * + * Arguments: + * 0: position controls group + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; + +//Generic Init: +params ["_control"]; +private _display = ctrlParent _control; +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Specific on-load stuff: +private _map = _control controlsGroupCtrl 26469; + +// Centre map on the logic initially +_map ctrlMapAnimAdd [0, ctrlMapScale _map, _logic]; +ctrlMapAnimCommit _map; + +private _fnc_onDraw = { + params ["_map"]; + + private _display = ctrlParent _map; + private _pos = GETVAR(_display,GVAR(position),[]); + private _radius = GETVAR(_display,GVAR(radius),0); + + if !(_pos isEqualTo []) then { + // Works alongside radius attribute + if (_radius == 0) then { + _map drawIcon ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [0,0,0,1], _pos, 19, 19, 0, "", 0, 0]; + } else { + _map drawEllipse [_pos, _radius, _radius, 0, [0,0,0,1], ""]; + }; + }; +}; + +private _fnc_onMapClick = { + params ["_map","_button","_x","_y","_shift","_ctrl","_alt"]; + + if (_button == 0) then { + private _display = ctrlParent _map; + SETVAR(_display,GVAR(position),_pos); + }; +}; + +SETVAR(_display,GVAR(position),getPos _logic); +_map ctrlAddEventHandler ["draw",_fnc_onDraw]; +_map ctrlAddEventHandler ["mouseButtonDown",_fnc_onMapClick]; diff --git a/addons/zeus/functions/fnc_ui_attributeRadius.sqf b/addons/zeus/functions/fnc_ui_attributeRadius.sqf index 67ab0801fc..c26f8ac97d 100644 --- a/addons/zeus/functions/fnc_ui_attributeRadius.sqf +++ b/addons/zeus/functions/fnc_ui_attributeRadius.sqf @@ -24,7 +24,7 @@ _control ctrlRemoveAllEventHandlers "setFocus"; //Specific on-load stuff: private _edit = _control controlsGroupCtrl 26467; -_edit ctrlSetText "50"; +_edit ctrlSetText "100"; private _fnc_onKeyUp = { params ["_display"]; @@ -36,7 +36,6 @@ private _fnc_onKeyUp = { if (_radius == 0) then { _edit ctrlSetTooltip (localize LSTRING(AttributeRadiusInvalid)); _edit ctrlSetTextColor [1,0,0,1]; - SETVAR(_display,GVAR(radius),50); } else { _edit ctrlSetTooltip ""; _edit ctrlSetTextColor [1,1,1,1]; diff --git a/addons/zeus/functions/fnc_ui_defendArea.sqf b/addons/zeus/functions/fnc_ui_defendArea.sqf index fd56e316a7..210dfe61c6 100644 --- a/addons/zeus/functions/fnc_ui_defendArea.sqf +++ b/addons/zeus/functions/fnc_ui_defendArea.sqf @@ -66,8 +66,9 @@ private _fnc_onConfirm = { private _unit = effectiveCommander (attachedTo _logic); private _radius = GETVAR(_display,GVAR(radius),50); + private _position = GETVAR(_display,GVAR(position),getPos _logic); - [QGVAR(moduleDefendArea), _unit, [_unit,getPosASL _logic,_radius]] call EFUNC(common,targetEvent); + [QGVAR(moduleDefendArea), _unit, [_unit,_position,_radius]] call EFUNC(common,targetEvent); deleteVehicle _logic; }; diff --git a/addons/zeus/functions/fnc_ui_patrolArea.sqf b/addons/zeus/functions/fnc_ui_patrolArea.sqf index 74e9b4ce80..5eb324bdd7 100644 --- a/addons/zeus/functions/fnc_ui_patrolArea.sqf +++ b/addons/zeus/functions/fnc_ui_patrolArea.sqf @@ -66,8 +66,9 @@ private _fnc_onConfirm = { private _unit = effectiveCommander (attachedTo _logic); private _radius = GETVAR(_display,GVAR(radius),50); + private _position = GETVAR(_display,GVAR(position),getPos _logic); - [QGVAR(modulePatrolArea), _unit, [_unit,getPosASL _logic,_radius,5]] call EFUNC(common,targetEvent); + [QGVAR(modulePatrolArea), _unit, [_unit,_position,_radius,5]] call EFUNC(common,targetEvent); deleteVehicle _logic; }; diff --git a/addons/zeus/functions/fnc_ui_searchArea.sqf b/addons/zeus/functions/fnc_ui_searchArea.sqf index 7f92263ffa..c06f6d1290 100644 --- a/addons/zeus/functions/fnc_ui_searchArea.sqf +++ b/addons/zeus/functions/fnc_ui_searchArea.sqf @@ -66,9 +66,10 @@ private _fnc_onConfirm = { private _unit = effectiveCommander (attachedTo _logic); private _radius = GETVAR(_display,GVAR(radius),50); + private _position = GETVAR(_display,GVAR(position),getPos _logic); private _marker = QGVAR(ModuleSearchArea) + str(_unit); - createMarker [_marker, getPosASL _logic]; + createMarker [_marker, _position]; _marker setMarkerAlpha 0; _marker setMarkerShape "ELLIPSE"; _marker setMarkerSize [_radius,_radius]; diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index 30bd14bf10..c13851a0fc 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -447,6 +447,12 @@ Cargo: + + Task Position + + + Select a position to perform the task at + Task Radius diff --git a/addons/zeus/ui/RscAttributes.hpp b/addons/zeus/ui/RscAttributes.hpp index c5022b6974..c9ff3f3743 100644 --- a/addons/zeus/ui/RscAttributes.hpp +++ b/addons/zeus/ui/RscAttributes.hpp @@ -7,6 +7,7 @@ class RscEdit; class RscXSliderH; class RscCheckBox; class RscActivePicture; +class RscMapControl; class RscDisplayAttributes { class Controls { @@ -49,6 +50,34 @@ class GVAR(AttributeRadius): RscControlsGroupNoScrollbars { }; }; +class GVAR(AttributePosition): RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_attributePosition)); + idc = 26468; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(26); + class controls { + class Title1: RscText { + idc = -1; + text = CSTRING(AttributePosition); + toolTip = CSTRING(AttributePosition_desc); + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(1); + colorBackground[] = {0,0,0,0.5}; + }; + class Position: RscMapControl { + idc = 26469; + x = W_PART(0.5); + y = H_PART(1.1); + w = W_PART(25); + h = H_PART(24.8); + }; + }; +}; + class GVAR(RscDefendArea): RscDisplayAttributes { onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscDefendArea)))] call FUNC(zeusAttributes)); onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscDefendArea)))] call FUNC(zeusAttributes)); @@ -58,6 +87,7 @@ class GVAR(RscDefendArea): RscDisplayAttributes { class Content: Content { class Controls { class radius: GVAR(AttributeRadius) {}; + //class position: GVAR(AttributePosition) {}; }; }; class ButtonOK: ButtonOK { @@ -249,6 +279,7 @@ class GVAR(RscPatrolArea): RscDisplayAttributes { class Content: Content { class Controls { class radius: GVAR(AttributeRadius) {}; + //class position: GVAR(AttributePosition) {}; }; }; class ButtonOK: ButtonOK { @@ -267,6 +298,7 @@ class GVAR(RscSearchArea): RscDisplayAttributes { class Content: Content { class Controls { class radius: GVAR(AttributeRadius) {}; + //class position: GVAR(AttributePosition) {}; }; }; class ButtonOK: ButtonOK {