From 3df4cb13b8e79d2e408d5cab0857b88abc167827 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sat, 15 Feb 2025 20:47:14 +0100 Subject: [PATCH 01/25] add initial prototype of line compass --- addons/linecompass/$PBOPREFIX$ | 1 + addons/linecompass/CfgEventHandlers.hpp | 16 ++ addons/linecompass/CfgRscTitles.hpp | 222 +++++++++++++++ addons/linecompass/XEH_PREP.hpp | 6 + addons/linecompass/XEH_postInit.sqf | 5 + addons/linecompass/XEH_preInit.sqf | 85 ++++++ addons/linecompass/XEH_preStart.sqf | 3 + addons/linecompass/config.cpp | 16 ++ .../functions/fnc_addLineMarker.sqf | 19 ++ addons/linecompass/functions/fnc_draw3d.sqf | 253 ++++++++++++++++++ .../functions/fnc_getAlphaFromX.sqf | 21 ++ .../linecompass/functions/fnc_hideCompass.sqf | 19 ++ .../functions/fnc_removeLineMarker.sqf | 17 ++ .../linecompass/functions/fnc_showCompass.sqf | 23 ++ addons/linecompass/script_component.hpp | 21 ++ addons/linecompass/stringtable.xml | 16 ++ 16 files changed, 743 insertions(+) create mode 100644 addons/linecompass/$PBOPREFIX$ create mode 100644 addons/linecompass/CfgEventHandlers.hpp create mode 100644 addons/linecompass/CfgRscTitles.hpp create mode 100644 addons/linecompass/XEH_PREP.hpp create mode 100644 addons/linecompass/XEH_postInit.sqf create mode 100644 addons/linecompass/XEH_preInit.sqf create mode 100644 addons/linecompass/XEH_preStart.sqf create mode 100644 addons/linecompass/config.cpp create mode 100644 addons/linecompass/functions/fnc_addLineMarker.sqf create mode 100644 addons/linecompass/functions/fnc_draw3d.sqf create mode 100644 addons/linecompass/functions/fnc_getAlphaFromX.sqf create mode 100644 addons/linecompass/functions/fnc_hideCompass.sqf create mode 100644 addons/linecompass/functions/fnc_removeLineMarker.sqf create mode 100644 addons/linecompass/functions/fnc_showCompass.sqf create mode 100644 addons/linecompass/script_component.hpp create mode 100644 addons/linecompass/stringtable.xml diff --git a/addons/linecompass/$PBOPREFIX$ b/addons/linecompass/$PBOPREFIX$ new file mode 100644 index 0000000..23fb6ed --- /dev/null +++ b/addons/linecompass/$PBOPREFIX$ @@ -0,0 +1 @@ +z\diwako_dui\addons\linecompass diff --git a/addons/linecompass/CfgEventHandlers.hpp b/addons/linecompass/CfgEventHandlers.hpp new file mode 100644 index 0000000..c96fa2b --- /dev/null +++ b/addons/linecompass/CfgEventHandlers.hpp @@ -0,0 +1,16 @@ +//diwako_dui_indicators eventhandlers +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/linecompass/CfgRscTitles.hpp b/addons/linecompass/CfgRscTitles.hpp new file mode 100644 index 0000000..d17aad8 --- /dev/null +++ b/addons/linecompass/CfgRscTitles.hpp @@ -0,0 +1,222 @@ +#define LINE(var, idcValue) \ +class Line##var : Line1 {\ + idc = idcValue;\ + x = QUOTE(PX(0.15 + 2.5 * (var - 1)));\ +} + +#define BEARING(var,textVar,textSize, idcValue) \ +class Bearing##var : Bearing1 {\ + idc = idcValue;\ + sizeEx = QUOTE(PY(textSize));\ + x = QUOTE(PX(-0.25 + 7.5 * (var - 1)));\ + text = textVar;\ +} + +class RscControlsGroupNoScrollbars; +class RscPicture; +class RscText; +class RscTitles { + class GVAR(Compass) { + idd = -1; + duration = 1e10; + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(Compass),_this select 0)];); + class Controls { + class CtrlGroup : RscControlsGroupNoScrollbars { + idc = 7000; + x = QUOTE(0.5 - PX(46.25)); + y = QUOTE(PY(103) + safeZoneY); + w = QUOTE(PX(92.5)); + h = QUOTE(PY(5)); + + class Controls { + class Needle : RscPicture { + idc = 7001; + text = "\a3\ui_f\data\map\markers\military\triangle_ca.paa"; + angle = 180; + x = QUOTE(PX(46.25 - 1)); + y = QUOTE(PY(1.6)); + w = QUOTE(PX(2)); + h = QUOTE(PY(1)); + }; + class CtrlGroup : RscControlsGroupNoScrollbars { + idc = 7100; + x = 0; + y = 0; + w = QUOTE(PX(272.5)); // 360° + 185° + h = QUOTE(PY(5)); + + class Controls { + class Line1 : RscPicture { + idc = 7101; + text = "#(argb,8,8,3)color(1,1,1,1)"; + x = QUOTE(PX(0.15)); + y = QUOTE(PY(0.6)); + w = QUOTE(PX(2.2)); + h = QUOTE(PY(0.3)); + }; + LINE(2,7102); + LINE(3,7103); + LINE(4,7104); + LINE(5,7105); + LINE(6,7106); + LINE(7,7107); + LINE(8,7108); + LINE(9,7109); + LINE(10,7110); + LINE(11,7111); + LINE(12,7112); + LINE(13,7113); + LINE(14,7114); + LINE(15,7115); + LINE(16,7116); + LINE(17,7117); + LINE(18,7118); + LINE(19,7119); + LINE(20,7120); + LINE(21,7121); + LINE(22,7122); + LINE(23,7123); + LINE(24,7124); + LINE(25,7125); + LINE(26,7126); + LINE(27,7127); + LINE(28,7128); + LINE(29,7129); + LINE(30,7130); + LINE(31,7131); + LINE(32,7132); + LINE(33,7133); + LINE(34,7134); + LINE(35,7135); + LINE(36,7136); + LINE(37,7137); + LINE(38,7138); + LINE(39,7139); + LINE(40,7140); + LINE(41,7141); + LINE(42,7142); + LINE(43,7143); + LINE(44,7144); + LINE(45,7145); + LINE(46,7146); + LINE(47,7147); + LINE(48,7148); + LINE(49,7149); + LINE(50,7150); + LINE(51,7151); + LINE(52,7152); + LINE(53,7153); + LINE(54,7154); + LINE(55,7155); + LINE(56,7156); + LINE(57,7157); + LINE(58,7158); + LINE(59,7159); + LINE(60,7160); + LINE(61,7161); + LINE(62,7162); + LINE(63,7163); + LINE(64,7164); + LINE(65,7165); + LINE(66,7166); + LINE(67,7167); + LINE(68,7168); + LINE(69,7169); + LINE(70,7170); + LINE(71,7171); + LINE(72,7172); + LINE(73,7173); + LINE(74,7174); + LINE(75,7175); + LINE(76,7176); + LINE(77,7177); + LINE(78,7178); + LINE(79,7179); + LINE(80,7180); + LINE(81,7181); + LINE(82,7182); + LINE(83,7183); + LINE(84,7184); + LINE(85,7185); + LINE(86,7186); + LINE(87,7187); + LINE(88,7188); + LINE(89,7189); + LINE(90,7190); + LINE(91,7191); + LINE(92,7192); + LINE(93,7193); + LINE(94,7194); + LINE(95,7195); + LINE(96,7196); + LINE(97,7197); + LINE(98,7198); + LINE(99,7199); + LINE(100,7200); + LINE(101,7201); + LINE(102,7202); + LINE(103,7203); + LINE(104,7204); + LINE(105,7205); + LINE(106,7206); + LINE(107,7207); + LINE(108,7208); + LINE(109,7209); + class Bearing1 : RscText { + idc = 7301; + text = "W"; + font = "PuristaMedium"; + sizeEx = QUOTE(PY(2.4)); + style = 0x02; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + shadow = 0; + x = QUOTE(PX(-0.25)); + y = QUOTE(PY(2)); + w = QUOTE(PX(3)); + h = QUOTE(PY(1.5)); + }; + BEARING(2,"285",1.8,7302); + BEARING(3,"300",1.8,7303); + BEARING(4,"NW",2.4,7304); + BEARING(5,"330",1.8,7305); + BEARING(6,"345",1.8,7306); + BEARING(7,"N",2.4,7307); + BEARING(8,"015",1.8,7308); + BEARING(9,"030",1.8,7309); + BEARING(10,"NE",2.4,7310); + BEARING(11,"060",1.8,7311); + BEARING(12,"075",1.8,7312); + BEARING(13,"E",2.4,7313); + BEARING(14,"105",1.8,7314); + BEARING(15,"120",1.8,7315); + BEARING(16,"SE",2.4,7316); + BEARING(17,"150",1.8,7317); + BEARING(18,"165",1.8,7318); + BEARING(19,"S",2.4,7319); + BEARING(20,"195",1.8,7320); + BEARING(21,"210",1.8,7321); + BEARING(22,"SW",2.4,7322); + BEARING(23,"240",1.8,7323); + BEARING(24,"255",1.8,7324); + BEARING(25,"W",2.4,7325); + BEARING(26,"285",1.8,7326); + BEARING(27,"300",1.8,7327); + BEARING(28,"NW",2.4,7328); + BEARING(29,"330",1.8,7329); + BEARING(30,"345",1.8,7330); + BEARING(31,"N",2.4,7331); + BEARING(32,"015",1.8,7332); + BEARING(33,"030",1.8,7333); + BEARING(34,"NO",2.4,7334); + BEARING(35,"060",1.8,7335); + BEARING(36,"075",1.8,7336); + BEARING(37,"O",2.4,7337); + }; + }; + }; + }; + }; + }; + +}; diff --git a/addons/linecompass/XEH_PREP.hpp b/addons/linecompass/XEH_PREP.hpp new file mode 100644 index 0000000..4b6904a --- /dev/null +++ b/addons/linecompass/XEH_PREP.hpp @@ -0,0 +1,6 @@ +PREP(addLineMarker); +PREP(draw3d); +PREP(getAlphaFromX); +PREP(hideCompass); +PREP(removeLineMarker); +PREP(showCompass); diff --git a/addons/linecompass/XEH_postInit.sqf b/addons/linecompass/XEH_postInit.sqf new file mode 100644 index 0000000..130ce21 --- /dev/null +++ b/addons/linecompass/XEH_postInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" +if (is3DEN || (!hasInterface || {side player == sideLogic}) && {player isKindOf "VirtualSpectator_F"}) exitWith {}; +// waitUntil {!isNull findDisplay 46}; // TODO +call FUNC(showCompass); +GVAR(drawEh) = addMissionEventHandler ["Draw3D", {call FUNC(draw3D)}]; diff --git a/addons/linecompass/XEH_preInit.sqf b/addons/linecompass/XEH_preInit.sqf new file mode 100644 index 0000000..8ab4f58 --- /dev/null +++ b/addons/linecompass/XEH_preInit.sqf @@ -0,0 +1,85 @@ +#include "script_component.hpp" +ADDON = false; +#include "XEH_PREP.hpp" + +GVAR(drawEh) = -1; + +GVAR(lineMarkers) = createHashMap; + +// Use pools to store the controls for the markers +GVAR(lineMarkerControlPool) = []; +GVAR(iconMarkerControlPool) = []; + +// Caches for alpha values +GVAR(lineAlphaCache) = []; +GVAR(lineAlphaCache) resize 109; +GVAR(bearingAlphaCache) = []; +GVAR(bearingAlphaCache) resize 37; + +GVAR(GroupColor) = [0, 0.87, 0, 1]; +GVAR(SideColor) = [0, 0.4, 0.8, 1]; +GVAR(WaypointColor) = [0.9, 0.66, 0.01, 1]; +GVAR(CompassAvailableShown) = false; +GVAR(DrawBearing) = 2; + +GVAR(UnitDistance) = 15; + +[ + QGVAR(CompassAvailableShown), + "CHECKBOX", + "Show Only When Compass is Available", + "Line Compass", + GVAR(CompassAvailableShown), + 1, + {}, + true +] call CBA_fnc_addSetting; + +[ + QGVAR(GroupColor), + "COLOR", + "Group Color", + "Line Compass", + GVAR(GroupColor) +] call CBA_fnc_addSetting; + +[ + QGVAR(SideColor), + "COLOR", + "Side Color", + "Line Compass", + GVAR(SideColor) +] call CBA_fnc_addSetting; + +[ + QGVAR(WaypointColor), + "COLOR", + "Waypoint Color", + "Line Compass", + GVAR(WaypointColor), + nil, + { + params ["_value"]; + if (customWaypointPosition isNotEqualTo []) then { + ["MOVE", _value, customWaypointPosition] call FUNC(addLineMarker); + }; + } +] call CBA_fnc_addSetting; + +[ + QGVAR(DrawBearing), + "LIST", + "Directions Drawn", + "Line Compass", + [[0, 1, 2], ["None", "Bearing", "All"], 2] +] call CBA_fnc_addSetting; + +GVAR(fingerTime) = time; + +["ace_finger_fingered", { + params ["_player", "_pos", "_dir"]; + ["Fingering", GVAR(WaypointColor), _pos] call FUNC(addLineMarker); + GVAR(fingerTime) = time + 2.5; +}] call CBA_fnc_addEventhandler; + +ADDON = true; diff --git a/addons/linecompass/XEH_preStart.sqf b/addons/linecompass/XEH_preStart.sqf new file mode 100644 index 0000000..468c4ce --- /dev/null +++ b/addons/linecompass/XEH_preStart.sqf @@ -0,0 +1,3 @@ +//diwako_dui_indicators prestart +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/linecompass/config.cpp b/addons/linecompass/config.cpp new file mode 100644 index 0000000..8c75c5b --- /dev/null +++ b/addons/linecompass/config.cpp @@ -0,0 +1,16 @@ +#include "script_component.hpp" +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"diwako_dui_main"}; + author = "joko // Jonas"; + VERSION_CONFIG; + license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike"; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgRscTitles.hpp" diff --git a/addons/linecompass/functions/fnc_addLineMarker.sqf b/addons/linecompass/functions/fnc_addLineMarker.sqf new file mode 100644 index 0000000..add4b5f --- /dev/null +++ b/addons/linecompass/functions/fnc_addLineMarker.sqf @@ -0,0 +1,19 @@ +#include "..\script_component.hpp" +/* + Line Compass + + Author: joko // Jonas, NetFusion + + Description: + Add a compass line marker to the compass hub. + + Parameter(s): + 0: Id + 1: Color + 2: Position + + Returns: + None +*/ +params ["_id", "_color", "_position"]; +GVAR(lineMarkers) set [_id, [_color, _position]]; diff --git a/addons/linecompass/functions/fnc_draw3d.sqf b/addons/linecompass/functions/fnc_draw3d.sqf new file mode 100644 index 0000000..8335996 --- /dev/null +++ b/addons/linecompass/functions/fnc_draw3d.sqf @@ -0,0 +1,253 @@ +#include "..\script_component.hpp" +/* + Line Compass + + Author: NetFusion, joko // Jonas + + Description: + Draw3D + + Parameter(s): + None + + Returns: + None +*/ + +if (GVAR(CompassAvailableShown) && {floor(time % 1) == 0}) then { + if (!GVAR(CompassShown) && { "ItemCompass" in (assignedItems player) }) then { + call FUNC(ShowCompass); + } else { + if (GVAR(CompassShown) && { !("ItemCompass" in (assignedItems player)) }) then { + call FUNC(HideCompass); + }; + }; +}; + +// Exit if the compass is not visible +private _dialog = uiNamespace getVariable QGVAR(Compass); +if (isNull _dialog) exitWith {}; + +if (customWaypointPosition isNotEqualTo GVAR(customWaypointPosition)) then { + if (customWaypointPosition isEqualTo []) then { + "MOVE" call FUNC(removeLineMarker); + } else { + ["MOVE", GVAR(WaypointColor), customWaypointPosition] call FUNC(addLineMarker); + }; + GVAR(customWaypointPosition) = customWaypointPosition; +}; + +if (GVAR(fingerTime) != -1 && { GVAR(fingerTime) <= time }) then { + "Fingering" call FUNC(removeLineMarker); + GVAR(fingerTime) = -1; +}; + +private _viewDirectionVector = (positionCameraToWorld [0, 0, 0]) vectorDiff (positionCameraToWorld [0, 0, -1]); +private _viewDirection = ((_viewDirectionVector select 0) atan2 (_viewDirectionVector select 1) + 360) % 360; +private _currentPosition = getPosVisual player; + +// Shift the control group to view direction +private _control = _dialog displayCtrl 7100; +_control ctrlSetPosition [PX(_viewDirection * -0.5), PY(1)]; +_control ctrlCommit 0; + +// Alpha +private _lineAngleOffset = 2.5 - (_viewDirection % 5); +private _lineIndexVisibilityOffset = floor (_viewDirection / 5); +for "_i" from 0 to 37 do { + private _idc = _i + _lineIndexVisibilityOffset; + private _control = _dialog displayCtrl (7101 + _idc); + private _newAlpha = (_i * 5 + _lineAngleOffset) call FUNC(getAlphaFromX); + private _oldAlpha = GVAR(lineAlphaCache) select _idc; + + if (_newAlpha != _oldAlpha) then { + GVAR(lineAlphaCache) set [_idc, _newAlpha]; + _control ctrlSetTextColor [1, 1, 1, _newAlpha]; + _control ctrlCommit 0; + }; +}; + +private _bearingOffset = 2.5 - (_viewDirection % 15); +for "_i" from 0 to 13 do { + private _idc = _i + floor (_viewDirection / 15); + private _control = _dialog displayCtrl (7301 + _idc); + private _newAlpha = (_i * 15 + _bearingOffset) call FUNC(getAlphaFromX); + private _oldAlpha = GVAR(bearingAlphaCache) select _idc; + if (GVAR(DrawBearing) == 1) then { + private _idcMod = _idc mod 3; + if (_idcMod != 0) then { + _newAlpha = 0; + }; + } else { + if (GVAR(DrawBearing) == 0) then { + _newAlpha = 0; + }; + }; + if (_newAlpha != _oldAlpha) then { + GVAR(bearingAlphaCache) set [_idc, _newAlpha]; + _control ctrlSetTextColor [1, 1, 1, _newAlpha]; + _control ctrlCommit 0; + }; +}; + +// Line marker +private _nextLineMarkerControl = 0; +private _overlapCacheLineIndices = []; + +{ + + private _lineMarker = _y; + if (!(isNil "_lineMarker")) then { + private _markerPosition = _lineMarker select 1; + private _relativeVectorToMarker = _markerPosition vectorDiff _currentPosition; + private _angleToMarker = ((_relativeVectorToMarker select 0) atan2 (_relativeVectorToMarker select 1) + 360) % 360; + + private _control = GVAR(lineMarkerControlPool) select _nextLineMarkerControl; + if (isNil "_control" || {isNull _control}) then { + _control = _dialog ctrlCreate ["RscPicture", 7401 + _nextLineMarkerControl, _dialog displayCtrl 7100]; + _control ctrlSetText "#(argb,8,8,3)color(1,1,1,1)"; + GVAR(lineMarkerControlPool) set [_nextLineMarkerControl, _control]; + }; + + private _lineIndex = floor (_angleToMarker / 5) + 18; + if (_viewDirection >= 270 && _lineIndex < 36) then { + _lineIndex = _lineIndex + 72; + }; + if (_viewDirection <= 90 && _lineIndex > 72) then { + _lineIndex = _lineIndex - 72; + }; + + private _offset = (_angleToMarker % 5) - 2.5; + _control setVariable [QGVAR(color), _lineMarker select 0]; + _control setVariable [QGVAR(offset), _offset]; + _control setVariable [QGVAR(lineIndex), _lineIndex]; + + // Shift + private _otherMarkerControl = _overlapCacheLineIndices param [_lineIndex, nil]; + if (!(isNil "_otherMarkerControl")) then { + // Compare + private _otherOffset = _otherMarkerControl getVariable QGVAR(offset); + if (abs _otherOffset < abs _offset) then { + // Swap + _offset = _otherOffset; + private _tmp = _otherMarkerControl; + _otherMarkerControl = _control; + _control = _tmp; + } else { + _overlapCacheLineIndices set [_lineIndex, _control]; + }; + + // Direction + private _shiftDirection = if (_offset == 0) then { + 1 + } else { + _offset / abs _offset // 1 or -1 + }; + + // Shift + private _shiftedLineIndex = _lineIndex; + + while {!(isNil "_otherMarkerControl")} do { + _shiftedLineIndex = _shiftedLineIndex + _shiftDirection; + _otherMarkerControl setVariable [QGVAR(lineIndex), _shiftedLineIndex]; + + private _tmp = _otherMarkerControl; + _otherMarkerControl = _overlapCacheLineIndices param [_shiftedLineIndex, nil]; + _overlapCacheLineIndices set [_shiftedLineIndex, _tmp]; + }; + } else { + _overlapCacheLineIndices set [_lineIndex, _control]; + }; + + _nextLineMarkerControl = _nextLineMarkerControl + 1; + }; + +} forEach GVAR(lineMarkers); + +// Remove the unused controls +if (_nextLineMarkerControl < count GVAR(lineMarkerControlPool)) then { + for "_i" from _nextLineMarkerControl to (count GVAR(lineMarkerControlPool) - 1) do { + private _control = GVAR(lineMarkerControlPool) select _nextLineMarkerControl; + ctrlDelete _control; + GVAR(lineMarkerControlPool) deleteAt _nextLineMarkerControl; + }; +}; + +{ + if (ctrlShown _x) then { + private _lineIndex = _x getVariable QGVAR(lineIndex); + _x ctrlSetPosition [PX(_lineIndex * 2.5 + 0.15), PY(0.6), PX(2.2), PY(0.3)]; + + private _color = _x getVariable QGVAR(color); + _color set [3, (2.5 + ((_lineIndex - floor (_viewDirection / 5)) * 5) - (_viewDirection % 5)) call FUNC(getAlphaFromX)]; + _x ctrlSetTextColor _color; + _x ctrlCommit 0; + }; +} forEach GVAR(lineMarkerControlPool); + +// Icon marker +private _nextIconMarkerControl = 0; + +{ + + // Check if the unit is not the player himself and alive. + if (_x != player && alive _x && (isNull objectParent player || {!(_x in crew objectParent player)})) then { + private _unitPosition = getPosVisual _x; + private _relativeVectorToUnit = _unitPosition vectorDiff _currentPosition; + private _angleToUnit = ((_relativeVectorToUnit select 0) atan2 (_relativeVectorToUnit select 1) + 360) % 360; + + private _control = GVAR(iconMarkerControlPool) select _nextIconMarkerControl; + if (isNil "_control" || {isNull _control}) then { + _control = _dialog ctrlCreate ["RscPicture", 7501 + _nextIconMarkerControl, _dialog displayCtrl 7100]; + GVAR(iconMarkerControlPool) set [_nextIconMarkerControl, _control]; + }; + + private _compassAngle = _angleToUnit + 90; + if (_viewDirection >= 270 && _compassAngle < 180) then { + _compassAngle = _compassAngle + 360; + }; + if (_viewDirection <= 90 && _compassAngle > 360) then { + _compassAngle = _compassAngle - 360; + }; + + private _icon = "a3\ui_f\data\map\Markers\Military\dot_ca.paa"; + private _size = 3.6; + if (leader _x == _x) then { + _icon = "a3\ui_f\data\gui\cfg\ranks\corporal_gs.paa"; + _size = 1.3; + }; + if (_x getUnitTrait "medic" || _x getVariable ["ace_medical_medicClass", 0] != 0) then { + _icon = "a3\ui_f\data\map\vehicleicons\pictureheal_ca.paa"; + _size = 2; + }; + if !(isNil {_x getVariable QGVAR(UnitIcon)}) then { + private _data = _x getVariable [QGVAR(UnitIcon), [_icon, _size]]; + _icon = _data param [0, _icon, [""]]; + _size = _data param [1, _size, [0]]; + }; + _size = [PX(_size), PY(_size)]; + + _control ctrlSetText _icon; + + private _color = [GVAR(SideColor), GVAR(GroupColor)] select (group player == group _x); + _color set [3, ((1 - 0.2 * ((player distance _x) - (GVAR(UnitDistance) - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; + _control ctrlSetTextColor _color; + + private _positionCenter = [PX(_compassAngle * 0.5) - ((_size select 0) / 2), PY(0.75) - ((_size select 1) / 2)]; + _positionCenter append _size; + _control ctrlSetPosition _positionCenter; + + _control ctrlCommit 0; + + _nextIconMarkerControl = _nextIconMarkerControl + 1; + }; + +} forEach units group player; + +if (_nextIconMarkerControl < count GVAR(iconMarkerControlPool)) then { + for "_i" from _nextIconMarkerControl to (count GVAR(iconMarkerControlPool) - 1) do { + private _control = GVAR(iconMarkerControlPool) select _nextIconMarkerControl; + ctrlDelete _control; + GVAR(iconMarkerControlPool) deleteAt _nextIconMarkerControl; + }; +}; diff --git a/addons/linecompass/functions/fnc_getAlphaFromX.sqf b/addons/linecompass/functions/fnc_getAlphaFromX.sqf new file mode 100644 index 0000000..fde573c --- /dev/null +++ b/addons/linecompass/functions/fnc_getAlphaFromX.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Authors: joko // Jonas + * get Alpha from X Position. + * + * Arguments: + * 0: X Position + * + * Return Value: + * Alpha Value + * + * Example: + * 10 call dui_linecompass_fnc_getAlphaFromX + * + * Public: No + */ + +params [["_value", 0, [0]]]; +TRACE_1("fnc_getAlphaFromX",_this); + +(3 - (abs (_value - 92.5) / 30)) max 0 diff --git a/addons/linecompass/functions/fnc_hideCompass.sqf b/addons/linecompass/functions/fnc_hideCompass.sqf new file mode 100644 index 0000000..7ae2652 --- /dev/null +++ b/addons/linecompass/functions/fnc_hideCompass.sqf @@ -0,0 +1,19 @@ +#include "..\script_component.hpp" +/* + * Authors: joko // Jonas + * + * + * Arguments: + * + * + * Return Value: + * + * + * Example: + * 10 call dui_linecompass_fnc_getAlphaFromX + * + * Public: No + */ + +([QGVAR(Compass)] call BIS_fnc_rscLayer) cutFadeOut 0; +GVAR(CompassShown) = false; diff --git a/addons/linecompass/functions/fnc_removeLineMarker.sqf b/addons/linecompass/functions/fnc_removeLineMarker.sqf new file mode 100644 index 0000000..23db87e --- /dev/null +++ b/addons/linecompass/functions/fnc_removeLineMarker.sqf @@ -0,0 +1,17 @@ +#include "..\script_component.hpp" +/* + Line Compass + + Author: joko // Jonas + + Description: + Remove a Position from the Compass + + Parameter(s): + 0: Marker ID + + Returns: + None +*/ +params ["_id"]; +GVAR(lineMarkers) deleteAt _id; diff --git a/addons/linecompass/functions/fnc_showCompass.sqf b/addons/linecompass/functions/fnc_showCompass.sqf new file mode 100644 index 0000000..759432e --- /dev/null +++ b/addons/linecompass/functions/fnc_showCompass.sqf @@ -0,0 +1,23 @@ +#include "..\script_component.hpp" +/* + * Authors: joko // Jonas + * + * + * Arguments: + * + * + * Return Value: + * + * + * Example: + * 10 call dui_linecompass_fnc_getAlphaFromX + * + * Public: No + */ + +// Reset the cache +GVAR(lineAlphaCache) = GVAR(lineAlphaCache) apply {1}; +GVAR(bearingAlphaCache) = GVAR(bearingAlphaCache) apply {1}; +GVAR(CompassShown) = true; +// Show the compass and make sure it is not shown if the map is open +([QGVAR(Compass)] call BIS_fnc_rscLayer) cutRsc [QGVAR(Compass), "PLAIN", 0, false]; diff --git a/addons/linecompass/script_component.hpp b/addons/linecompass/script_component.hpp new file mode 100644 index 0000000..b209416 --- /dev/null +++ b/addons/linecompass/script_component.hpp @@ -0,0 +1,21 @@ +#define COMPONENT linecompass +#define COMPONENT_BEAUTIFIED Line Compass +#include "\z\diwako_dui\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +#define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_INDICATORS + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_INDICATORS + #define DEBUG_SETTINGS DEBUG_SETTINGS_INDICATORS +#endif + + +#include "\z\diwako_dui\addons\main\script_macros.hpp" + +// UI Based Macros +#define PYN 108 +#define PX(X) ((X)/PYN*safeZoneH/(4/3)) +#define PY(Y) ((Y)/PYN*safeZoneH) diff --git a/addons/linecompass/stringtable.xml b/addons/linecompass/stringtable.xml new file mode 100644 index 0000000..be0ff9c --- /dev/null +++ b/addons/linecompass/stringtable.xml @@ -0,0 +1,16 @@ + + + + + + Line Compass + + + Show line compass + + + Show line compass + + + + From 4e914172ceeed5629756abfa2aaf09076268e880 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sat, 15 Feb 2025 22:55:43 +0100 Subject: [PATCH 02/25] Use DUI Color expect default color for Dots Render diwako_dui_special_track Fix ACE Fingering use Profile Colors for Lines --- addons/linecompass/CfgRscTitles.hpp | 4 +- addons/linecompass/XEH_PREP.hpp | 3 +- addons/linecompass/XEH_preInit.sqf | 71 +++---------------- addons/linecompass/config.cpp | 2 +- .../functions/fnc_addLineMarker.sqf | 15 ---- addons/linecompass/functions/fnc_draw3d.sqf | 61 ++++++---------- .../functions/fnc_getAlphaFromX.sqf | 17 ----- .../linecompass/functions/fnc_getUnitIcon.sqf | 22 ++++++ .../linecompass/functions/fnc_hideCompass.sqf | 15 ---- .../functions/fnc_removeLineMarker.sqf | 13 ---- .../linecompass/functions/fnc_showCompass.sqf | 15 ---- addons/linecompass/settings.inc.sqf | 57 +++++++++++++++ addons/main/XEH_PREP.hpp | 6 +- .../functions/fnc_getCompass.sqf | 0 .../{radar => main}/functions/fnc_getGPS.sqf | 0 addons/radar/XEH_PREP.hpp | 6 +- addons/radar/functions/fnc_cacheLoop.sqf | 2 +- addons/radar/functions/fnc_compassPFH.sqf | 4 +- 18 files changed, 126 insertions(+), 187 deletions(-) create mode 100644 addons/linecompass/functions/fnc_getUnitIcon.sqf create mode 100644 addons/linecompass/settings.inc.sqf rename addons/{radar => main}/functions/fnc_getCompass.sqf (100%) rename addons/{radar => main}/functions/fnc_getGPS.sqf (100%) diff --git a/addons/linecompass/CfgRscTitles.hpp b/addons/linecompass/CfgRscTitles.hpp index d17aad8..4b58460 100644 --- a/addons/linecompass/CfgRscTitles.hpp +++ b/addons/linecompass/CfgRscTitles.hpp @@ -37,6 +37,7 @@ class RscTitles { y = QUOTE(PY(1.6)); w = QUOTE(PX(2)); h = QUOTE(PY(1)); + colorBackground[] = { "profileNamespace getVariable ['igui_bcg_RGB_R', 0]", "profileNamespace getVariable ['igui_bcg_RGB_G', 0]", "profileNamespace getVariable ['igui_bcg_RGB_B', 0]", 0}; }; class CtrlGroup : RscControlsGroupNoScrollbars { idc = 7100; @@ -53,6 +54,7 @@ class RscTitles { y = QUOTE(PY(0.6)); w = QUOTE(PX(2.2)); h = QUOTE(PY(0.3)); + colorBackground[] = { "profileNamespace getVariable ['igui_bcg_RGB_R', 0]", "profileNamespace getVariable ['igui_bcg_RGB_G', 0]", "profileNamespace getVariable ['igui_bcg_RGB_B', 0]", 0}; }; LINE(2,7102); LINE(3,7103); @@ -169,7 +171,7 @@ class RscTitles { sizeEx = QUOTE(PY(2.4)); style = 0x02; colorBackground[] = {0,0,0,0}; - colorText[] = {1,1,1,1}; + colorText[] = { "profileNamespace getVariable ['igui_bcg_RGB_R', 0]", "profileNamespace getVariable ['igui_bcg_RGB_G', 0]", "profileNamespace getVariable ['igui_bcg_RGB_B', 0]", 0}; shadow = 0; x = QUOTE(PX(-0.25)); y = QUOTE(PY(2)); diff --git a/addons/linecompass/XEH_PREP.hpp b/addons/linecompass/XEH_PREP.hpp index 4b6904a..e614c28 100644 --- a/addons/linecompass/XEH_PREP.hpp +++ b/addons/linecompass/XEH_PREP.hpp @@ -1,6 +1,7 @@ PREP(addLineMarker); PREP(draw3d); PREP(getAlphaFromX); +PREP(getUnitIcon); PREP(hideCompass); PREP(removeLineMarker); -PREP(showCompass); +PREP(showCompass); \ No newline at end of file diff --git a/addons/linecompass/XEH_preInit.sqf b/addons/linecompass/XEH_preInit.sqf index 8ab4f58..352c1f0 100644 --- a/addons/linecompass/XEH_preInit.sqf +++ b/addons/linecompass/XEH_preInit.sqf @@ -16,70 +16,21 @@ GVAR(lineAlphaCache) resize 109; GVAR(bearingAlphaCache) = []; GVAR(bearingAlphaCache) resize 37; -GVAR(GroupColor) = [0, 0.87, 0, 1]; -GVAR(SideColor) = [0, 0.4, 0.8, 1]; -GVAR(WaypointColor) = [0.9, 0.66, 0.01, 1]; -GVAR(CompassAvailableShown) = false; -GVAR(DrawBearing) = 2; +if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { -GVAR(UnitDistance) = 15; + ["ace_finger_fingered", { -[ - QGVAR(CompassAvailableShown), - "CHECKBOX", - "Show Only When Compass is Available", - "Line Compass", - GVAR(CompassAvailableShown), - 1, - {}, - true -] call CBA_fnc_addSetting; + params ["_player", "_pos", "_dir"]; -[ - QGVAR(GroupColor), - "COLOR", - "Group Color", - "Line Compass", - GVAR(GroupColor) -] call CBA_fnc_addSetting; + private _key = format ["ACE_Fingering_%1_%2", _player, time]; + [_key, GVAR(WaypointColor), _pos] call FUNC(addLineMarker); -[ - QGVAR(SideColor), - "COLOR", - "Side Color", - "Line Compass", - GVAR(SideColor) -] call CBA_fnc_addSetting; + [{ + _this call FUNC(removeLineMarker); + }, _key] call CBA_fnc_waitAndExecute; + }] call CBA_fnc_addEventhandler; +}; -[ - QGVAR(WaypointColor), - "COLOR", - "Waypoint Color", - "Line Compass", - GVAR(WaypointColor), - nil, - { - params ["_value"]; - if (customWaypointPosition isNotEqualTo []) then { - ["MOVE", _value, customWaypointPosition] call FUNC(addLineMarker); - }; - } -] call CBA_fnc_addSetting; - -[ - QGVAR(DrawBearing), - "LIST", - "Directions Drawn", - "Line Compass", - [[0, 1, 2], ["None", "Bearing", "All"], 2] -] call CBA_fnc_addSetting; - -GVAR(fingerTime) = time; - -["ace_finger_fingered", { - params ["_player", "_pos", "_dir"]; - ["Fingering", GVAR(WaypointColor), _pos] call FUNC(addLineMarker); - GVAR(fingerTime) = time + 2.5; -}] call CBA_fnc_addEventhandler; +#include "settings.inc.sqf" ADDON = true; diff --git a/addons/linecompass/config.cpp b/addons/linecompass/config.cpp index 8c75c5b..219a5f7 100644 --- a/addons/linecompass/config.cpp +++ b/addons/linecompass/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"diwako_dui_main"}; + requiredAddons[] = {"diwako_dui_main", "diwako_dui_radar"}; author = "joko // Jonas"; VERSION_CONFIG; license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike"; diff --git a/addons/linecompass/functions/fnc_addLineMarker.sqf b/addons/linecompass/functions/fnc_addLineMarker.sqf index add4b5f..be9d5be 100644 --- a/addons/linecompass/functions/fnc_addLineMarker.sqf +++ b/addons/linecompass/functions/fnc_addLineMarker.sqf @@ -1,19 +1,4 @@ #include "..\script_component.hpp" -/* - Line Compass - Author: joko // Jonas, NetFusion - - Description: - Add a compass line marker to the compass hub. - - Parameter(s): - 0: Id - 1: Color - 2: Position - - Returns: - None -*/ params ["_id", "_color", "_position"]; GVAR(lineMarkers) set [_id, [_color, _position]]; diff --git a/addons/linecompass/functions/fnc_draw3d.sqf b/addons/linecompass/functions/fnc_draw3d.sqf index 8335996..5565eeb 100644 --- a/addons/linecompass/functions/fnc_draw3d.sqf +++ b/addons/linecompass/functions/fnc_draw3d.sqf @@ -1,24 +1,16 @@ #include "..\script_component.hpp" -/* - Line Compass - Author: NetFusion, joko // Jonas - - Description: - Draw3D - - Parameter(s): - None - - Returns: - None -*/ +if (EGVAR(main,toggled_off) || !GVAR(Enabled)) exitWith { + if (GVAR(CompassShown)) exitWith { + call FUNC(HideCompass); + }; +}; if (GVAR(CompassAvailableShown) && {floor(time % 1) == 0}) then { - if (!GVAR(CompassShown) && { "ItemCompass" in (assignedItems player) }) then { + if (!GVAR(CompassShown) && { call EFUNC(main,getCompass) isNotEqualTo "" }) then { call FUNC(ShowCompass); } else { - if (GVAR(CompassShown) && { !("ItemCompass" in (assignedItems player)) }) then { + if (GVAR(CompassShown) && { call EFUNC(main,getCompass) isEqualTo "" }) then { call FUNC(HideCompass); }; }; @@ -30,18 +22,13 @@ if (isNull _dialog) exitWith {}; if (customWaypointPosition isNotEqualTo GVAR(customWaypointPosition)) then { if (customWaypointPosition isEqualTo []) then { - "MOVE" call FUNC(removeLineMarker); + "VANILLA_MOVE" call FUNC(removeLineMarker); } else { - ["MOVE", GVAR(WaypointColor), customWaypointPosition] call FUNC(addLineMarker); + ["VANILLA_MOVE", GVAR(WaypointColor), customWaypointPosition] call FUNC(addLineMarker); }; GVAR(customWaypointPosition) = customWaypointPosition; }; -if (GVAR(fingerTime) != -1 && { GVAR(fingerTime) <= time }) then { - "Fingering" call FUNC(removeLineMarker); - GVAR(fingerTime) = -1; -}; - private _viewDirectionVector = (positionCameraToWorld [0, 0, 0]) vectorDiff (positionCameraToWorld [0, 0, -1]); private _viewDirection = ((_viewDirectionVector select 0) atan2 (_viewDirectionVector select 1) + 360) % 360; private _currentPosition = getPosVisual player; @@ -54,6 +41,7 @@ _control ctrlCommit 0; // Alpha private _lineAngleOffset = 2.5 - (_viewDirection % 5); private _lineIndexVisibilityOffset = floor (_viewDirection / 5); + for "_i" from 0 to 37 do { private _idc = _i + _lineIndexVisibilityOffset; private _control = _dialog displayCtrl (7101 + _idc); @@ -202,6 +190,8 @@ private _nextIconMarkerControl = 0; GVAR(iconMarkerControlPool) set [_nextIconMarkerControl, _control]; }; + _control ctrlSetShadow GVAR(IconOutline); + private _compassAngle = _angleToUnit + 90; if (_viewDirection >= 270 && _compassAngle < 180) then { _compassAngle = _compassAngle + 360; @@ -210,27 +200,18 @@ private _nextIconMarkerControl = 0; _compassAngle = _compassAngle - 360; }; - private _icon = "a3\ui_f\data\map\Markers\Military\dot_ca.paa"; - private _size = 3.6; - if (leader _x == _x) then { - _icon = "a3\ui_f\data\gui\cfg\ranks\corporal_gs.paa"; - _size = 1.3; - }; - if (_x getUnitTrait "medic" || _x getVariable ["ace_medical_medicClass", 0] != 0) then { - _icon = "a3\ui_f\data\map\vehicleicons\pictureheal_ca.paa"; - _size = 2; - }; - if !(isNil {_x getVariable QGVAR(UnitIcon)}) then { - private _data = _x getVariable [QGVAR(UnitIcon), [_icon, _size]]; - _icon = _data param [0, _icon, [""]]; - _size = _data param [1, _size, [0]]; - }; + (_x call FUNC(getUnitIcon)) params [["_icon", "a3\ui_f\data\map\Markers\Military\dot_ca.paa", [""]], ["_size", 2, [0]]]; _size = [PX(_size), PY(_size)]; _control ctrlSetText _icon; - private _color = [GVAR(SideColor), GVAR(GroupColor)] select (group player == group _x); - _color set [3, ((1 - 0.2 * ((player distance _x) - (GVAR(UnitDistance) - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; + private _color = +(_x getVariable [QEGVAR(main,compass_color), [1, 1, 1]]); + + if (_color isEqualTo [1, 1, 1]) then { + _color = GVAR(DefaultIconColor); + }; + + _color set [3, ((1 - 0.2 * ((player distance _x) - (diwako_dui_compassRange - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; _control ctrlSetTextColor _color; private _positionCenter = [PX(_compassAngle * 0.5) - ((_size select 0) / 2), PY(0.75) - ((_size select 1) / 2)]; @@ -242,7 +223,7 @@ private _nextIconMarkerControl = 0; _nextIconMarkerControl = _nextIconMarkerControl + 1; }; -} forEach units group player; +} forEach ((units group player) + diwako_dui_special_track); if (_nextIconMarkerControl < count GVAR(iconMarkerControlPool)) then { for "_i" from _nextIconMarkerControl to (count GVAR(iconMarkerControlPool) - 1) do { diff --git a/addons/linecompass/functions/fnc_getAlphaFromX.sqf b/addons/linecompass/functions/fnc_getAlphaFromX.sqf index fde573c..4d1ad6d 100644 --- a/addons/linecompass/functions/fnc_getAlphaFromX.sqf +++ b/addons/linecompass/functions/fnc_getAlphaFromX.sqf @@ -1,21 +1,4 @@ #include "..\script_component.hpp" -/* - * Authors: joko // Jonas - * get Alpha from X Position. - * - * Arguments: - * 0: X Position - * - * Return Value: - * Alpha Value - * - * Example: - * 10 call dui_linecompass_fnc_getAlphaFromX - * - * Public: No - */ params [["_value", 0, [0]]]; -TRACE_1("fnc_getAlphaFromX",_this); - (3 - (abs (_value - 92.5) / 30)) max 0 diff --git a/addons/linecompass/functions/fnc_getUnitIcon.sqf b/addons/linecompass/functions/fnc_getUnitIcon.sqf new file mode 100644 index 0000000..51ba955 --- /dev/null +++ b/addons/linecompass/functions/fnc_getUnitIcon.sqf @@ -0,0 +1,22 @@ +#include "..\script_component.hpp" + +params ["_unit"]; + +if !(isNil {_unit getVariable QGVAR(UnitIcon)}) exitWith { + _unit getVariable QGVAR(UnitIcon); +}; + +private _icon = "a3\ui_f\data\map\Markers\Military\dot_ca.paa"; +private _size = 3.6; + +if (leader _unit == _unit) then { + _icon = "a3\ui_f\data\gui\cfg\ranks\corporal_gs.paa"; + _size = 1.3; +}; + +if (_unit getUnitTrait "medic" || _unit getVariable ["ace_medical_medicClass", 0] != 0) then { + _icon = "a3\ui_f\data\map\vehicleicons\pictureheal_ca.paa"; + _size = 2; +}; + +[_icon, _size]; diff --git a/addons/linecompass/functions/fnc_hideCompass.sqf b/addons/linecompass/functions/fnc_hideCompass.sqf index 7ae2652..e89b143 100644 --- a/addons/linecompass/functions/fnc_hideCompass.sqf +++ b/addons/linecompass/functions/fnc_hideCompass.sqf @@ -1,19 +1,4 @@ #include "..\script_component.hpp" -/* - * Authors: joko // Jonas - * - * - * Arguments: - * - * - * Return Value: - * - * - * Example: - * 10 call dui_linecompass_fnc_getAlphaFromX - * - * Public: No - */ ([QGVAR(Compass)] call BIS_fnc_rscLayer) cutFadeOut 0; GVAR(CompassShown) = false; diff --git a/addons/linecompass/functions/fnc_removeLineMarker.sqf b/addons/linecompass/functions/fnc_removeLineMarker.sqf index 23db87e..a4343b6 100644 --- a/addons/linecompass/functions/fnc_removeLineMarker.sqf +++ b/addons/linecompass/functions/fnc_removeLineMarker.sqf @@ -1,17 +1,4 @@ #include "..\script_component.hpp" -/* - Line Compass - Author: joko // Jonas - - Description: - Remove a Position from the Compass - - Parameter(s): - 0: Marker ID - - Returns: - None -*/ params ["_id"]; GVAR(lineMarkers) deleteAt _id; diff --git a/addons/linecompass/functions/fnc_showCompass.sqf b/addons/linecompass/functions/fnc_showCompass.sqf index 759432e..bab755c 100644 --- a/addons/linecompass/functions/fnc_showCompass.sqf +++ b/addons/linecompass/functions/fnc_showCompass.sqf @@ -1,19 +1,4 @@ #include "..\script_component.hpp" -/* - * Authors: joko // Jonas - * - * - * Arguments: - * - * - * Return Value: - * - * - * Example: - * 10 call dui_linecompass_fnc_getAlphaFromX - * - * Public: No - */ // Reset the cache GVAR(lineAlphaCache) = GVAR(lineAlphaCache) apply {1}; diff --git a/addons/linecompass/settings.inc.sqf b/addons/linecompass/settings.inc.sqf new file mode 100644 index 0000000..c482d01 --- /dev/null +++ b/addons/linecompass/settings.inc.sqf @@ -0,0 +1,57 @@ +private _cat = format ["%1 - %2",localize "STR_dui_mod", localize "STR_dui_addon_linecompass"]; + +private _curCat = localize "STR_dui_cat_general"; + +[ + QGVAR(Enabled), + "CHECKBOX", + "Enabled", + [_cat, _curCat], + GVAR(CompassAvailableShown), + 1, + {}, + false +] call CBA_fnc_addSetting; + +[ + QGVAR(CompassAvailableShown), + "CHECKBOX", + "Show Only When Compass is Available", + [_cat, _curCat], + GVAR(CompassAvailableShown), + 1, + {}, + true +] call CBA_fnc_addSetting; + +[ + QGVAR(DrawBearing), + "LIST", + "Directions Drawn", + [_cat, _curCat], + [[0, 1, 2], ["None", "Bearing", "All"], 2] +] call CBA_fnc_addSetting; + +[ + QGVAR(IconOutline), + "LIST", + "Icon Outline", + [_cat, _curCat], + [[0, 1, 2], ["None", "Shadow", "Outline"], 2] +] call CBA_fnc_addSetting; + +[ + QGVAR(DefaultIconColor), + "COLOR", + "Default Icon Color", + [_cat, _curCat], + [0, 0.87, 0, 1] +] call CBA_fnc_addSetting; + +[ + QGVAR(WaypointColor), + "COLOR", + "Default Icon Color", + [_cat, _curCat], + [0.9, 0.66, 0.01, 1] +] call CBA_fnc_addSetting; diff --git a/addons/main/XEH_PREP.hpp b/addons/main/XEH_PREP.hpp index ae4efcc..6767337 100644 --- a/addons/main/XEH_PREP.hpp +++ b/addons/main/XEH_PREP.hpp @@ -1,4 +1,6 @@ +PREP(cacheLoop); PREP(canHudBeShown); -PREP(toHex); +PREP(getCompass); +PREP(getGPS); PREP(isInCrew); -PREP(cacheLoop); +PREP(toHex); \ No newline at end of file diff --git a/addons/radar/functions/fnc_getCompass.sqf b/addons/main/functions/fnc_getCompass.sqf similarity index 100% rename from addons/radar/functions/fnc_getCompass.sqf rename to addons/main/functions/fnc_getCompass.sqf diff --git a/addons/radar/functions/fnc_getGPS.sqf b/addons/main/functions/fnc_getGPS.sqf similarity index 100% rename from addons/radar/functions/fnc_getGPS.sqf rename to addons/main/functions/fnc_getGPS.sqf diff --git a/addons/radar/XEH_PREP.hpp b/addons/radar/XEH_PREP.hpp index b06d14f..487cff2 100644 --- a/addons/radar/XEH_PREP.hpp +++ b/addons/radar/XEH_PREP.hpp @@ -3,9 +3,7 @@ PREP(compass); PREP(compassPFH); PREP(displayUnitOnCompass); PREP(getIcon); +PREP(incomingFinger); PREP(rangeButton); PREP(setCustomCode); -PREP(sortNameList); -PREP(getCompass); -PREP(getGPS); -PREP(incomingFinger); +PREP(sortNameList); \ No newline at end of file diff --git a/addons/radar/functions/fnc_cacheLoop.sqf b/addons/radar/functions/fnc_cacheLoop.sqf index caae0fb..53550d1 100644 --- a/addons/radar/functions/fnc_cacheLoop.sqf +++ b/addons/radar/functions/fnc_cacheLoop.sqf @@ -101,7 +101,7 @@ if (diwako_dui_enable_compass) then { }; private _compassCtrl = _compassDisplay displayCtrl IDC_COMPASS; - private _compass = [_player] call FUNC(getCompass); + private _compass = [_player] call EFUNC(main,getCompass); _compassCtrl ctrlSetText (diwako_dui_compass_style select (GVAR(show_cardinal_points) && {_compass isNotEqualTo ""})); if (_compass isNotEqualTo "") then { diff --git a/addons/radar/functions/fnc_compassPFH.sqf b/addons/radar/functions/fnc_compassPFH.sqf index a12c9bf..5dbc5a7 100644 --- a/addons/radar/functions/fnc_compassPFH.sqf +++ b/addons/radar/functions/fnc_compassPFH.sqf @@ -30,7 +30,7 @@ if ([_player] call EFUNC(main,canHudBeShown)) then { private _camDirVec = positionCameraToWorld [0,0,0] vectorFromTo (positionCameraToWorld [0,0,1]); private _dir = _camDirVec call CBA_fnc_vectDir; // private _dir = (getCameraViewDirection _player) call CBA_fnc_vectDir; - private _hasCompass = ([_player] call FUNC(getCompass)) isNotEqualTo ""; + private _hasCompass = ([_player] call EFUNC(main,getCompass)) isNotEqualTo ""; _compassCtrl ctrlSetAngle [[0,-_dir] select _hasCompass, 0.5, 0.5, true]; @@ -39,7 +39,7 @@ if ([_player] call EFUNC(main,canHudBeShown)) then { {diwako_dui_enable_compass_dir isEqualTo 1 && {!(isNull objectParent _player)} || {diwako_dui_enable_compass_dir isEqualTo 2} || {diwako_dui_enable_compass_dir isEqualTo 3 && {private _veh = (vehicle _player); _veh isNotEqualTo _player && {(driver _veh) isEqualTo _player}}} || - {diwako_dui_enable_compass_dir isEqualTo 4 && {([_player] call FUNC(getGPS)) isNotEqualTo ""}} + {diwako_dui_enable_compass_dir isEqualTo 4 && {([_player] call EFUNC(main,getGPS)) isNotEqualTo ""}} }}) then { private _dirCalc = (round _dir) mod 360; private _maxDegrees = GVAR(maxDegrees); From 4ed9f867aa9e8cff302dfc5bd3cc815df9ff5a68 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sat, 15 Feb 2025 23:20:39 +0100 Subject: [PATCH 03/25] make line compass movable via layout editor fix diwako_dui_special_track can be nil fix line compass didnt reenable when disabled --- addons/linecompass/CfgRscTitles.hpp | 8 ++--- addons/linecompass/CfgUIGrids.hpp | 30 +++++++++++++++++++ addons/linecompass/XEH_PREP.hpp | 2 +- addons/linecompass/XEH_postInit.sqf | 2 +- addons/linecompass/config.cpp | 1 + .../{fnc_draw3d.sqf => fnc_onDraw.sqf} | 9 ++++++ addons/linecompass/script_component.hpp | 10 +++++++ addons/linecompass/settings.inc.sqf | 6 +++- 8 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 addons/linecompass/CfgUIGrids.hpp rename addons/linecompass/functions/{fnc_draw3d.sqf => fnc_onDraw.sqf} (96%) diff --git a/addons/linecompass/CfgRscTitles.hpp b/addons/linecompass/CfgRscTitles.hpp index 4b58460..edc1bc5 100644 --- a/addons/linecompass/CfgRscTitles.hpp +++ b/addons/linecompass/CfgRscTitles.hpp @@ -23,10 +23,10 @@ class RscTitles { class Controls { class CtrlGroup : RscControlsGroupNoScrollbars { idc = 7000; - x = QUOTE(0.5 - PX(46.25)); - y = QUOTE(PY(103) + safeZoneY); - w = QUOTE(PX(92.5)); - h = QUOTE(PY(5)); + x = QUOTE(GET_POS_X); + y = QUOTE(GET_POS_Y); + w = QUOTE(GET_POS_W); + h = QUOTE(GET_POS_H); class Controls { class Needle : RscPicture { diff --git a/addons/linecompass/CfgUIGrids.hpp b/addons/linecompass/CfgUIGrids.hpp new file mode 100644 index 0000000..e5c6549 --- /dev/null +++ b/addons/linecompass/CfgUIGrids.hpp @@ -0,0 +1,30 @@ +class CfgUIGrids { + class IGUI { + class Presets { + class Arma3 { + class Variables { + ADDON[] = { + { + QUOTE(POS_X), + QUOTE(POS_Y), + QUOTE(POS_W), + QUOTE(POS_H) + }, + "(((safezoneW / safezoneH) min 1.2) / 40)", + "((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)" + }; + }; + }; + }; + + class Variables { + class ADDON { + displayName = "$STR_dui_linecompass_UIGrids_name"; + description = "$STR_dui_linecompass_UIGrids_description"; + preview = "#(argb,8,8,3)color(0,0,0,0.75)"; + saveToProfile[] = {0,1,2,3}; + canResize = 0; + }; + }; + }; +}; diff --git a/addons/linecompass/XEH_PREP.hpp b/addons/linecompass/XEH_PREP.hpp index e614c28..d51fa1c 100644 --- a/addons/linecompass/XEH_PREP.hpp +++ b/addons/linecompass/XEH_PREP.hpp @@ -1,7 +1,7 @@ PREP(addLineMarker); -PREP(draw3d); PREP(getAlphaFromX); PREP(getUnitIcon); PREP(hideCompass); +PREP(onDraw); PREP(removeLineMarker); PREP(showCompass); \ No newline at end of file diff --git a/addons/linecompass/XEH_postInit.sqf b/addons/linecompass/XEH_postInit.sqf index 130ce21..d5ca930 100644 --- a/addons/linecompass/XEH_postInit.sqf +++ b/addons/linecompass/XEH_postInit.sqf @@ -2,4 +2,4 @@ if (is3DEN || (!hasInterface || {side player == sideLogic}) && {player isKindOf "VirtualSpectator_F"}) exitWith {}; // waitUntil {!isNull findDisplay 46}; // TODO call FUNC(showCompass); -GVAR(drawEh) = addMissionEventHandler ["Draw3D", {call FUNC(draw3D)}]; +GVAR(drawEh) = addMissionEventHandler ["Draw3D", {call FUNC(onDraw)}]; diff --git a/addons/linecompass/config.cpp b/addons/linecompass/config.cpp index 219a5f7..b0509b5 100644 --- a/addons/linecompass/config.cpp +++ b/addons/linecompass/config.cpp @@ -12,5 +12,6 @@ class CfgPatches { }; }; +#include "CfgUIGrids.hpp" #include "CfgEventHandlers.hpp" #include "CfgRscTitles.hpp" diff --git a/addons/linecompass/functions/fnc_draw3d.sqf b/addons/linecompass/functions/fnc_onDraw.sqf similarity index 96% rename from addons/linecompass/functions/fnc_draw3d.sqf rename to addons/linecompass/functions/fnc_onDraw.sqf index 5565eeb..acd9d03 100644 --- a/addons/linecompass/functions/fnc_draw3d.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -33,6 +33,10 @@ private _viewDirectionVector = (positionCameraToWorld [0, 0, 0]) vectorDiff (pos private _viewDirection = ((_viewDirectionVector select 0) atan2 (_viewDirectionVector select 1) + 360) % 360; private _currentPosition = getPosVisual player; +private _parentControl = _dialog displayCtrl 7000; +_parentControl ctrlSetPosition [GET_POS_X, GET_POS_Y, GET_POS_W, GET_POS_H]; +_parentControl ctrlCommit 0; + // Shift the control group to view direction private _control = _dialog displayCtrl 7100; _control ctrlSetPosition [PX(_viewDirection * -0.5), PY(1)]; @@ -176,6 +180,11 @@ if (_nextLineMarkerControl < count GVAR(lineMarkerControlPool)) then { // Icon marker private _nextIconMarkerControl = 0; +private _units = units group player; +if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType [] }) then { + _units append diwako_dui_special_track; +}; + { // Check if the unit is not the player himself and alive. diff --git a/addons/linecompass/script_component.hpp b/addons/linecompass/script_component.hpp index b209416..f5bd12d 100644 --- a/addons/linecompass/script_component.hpp +++ b/addons/linecompass/script_component.hpp @@ -19,3 +19,13 @@ #define PYN 108 #define PX(X) ((X)/PYN*safeZoneH/(4/3)) #define PY(Y) ((Y)/PYN*safeZoneH) + + +#define POS_X 0.5 - PX(46.25) +#define POS_Y PY(103) + safeZoneY +#define POS_W PX(92.5) +#define POS_H PY(5) +#define GET_POS_X profileNamespace getVariable ['igui_diwako_dui_linecompass_x', POS_X] +#define GET_POS_Y profileNamespace getVariable ['igui_diwako_dui_linecompass_y', POS_Y] +#define GET_POS_W profileNamespace getVariable ['igui_diwako_dui_linecompass_w', POS_W] +#define GET_POS_H profileNamespace getVariable ['igui_diwako_dui_linecompass_h', POS_H] diff --git a/addons/linecompass/settings.inc.sqf b/addons/linecompass/settings.inc.sqf index c482d01..3d82b65 100644 --- a/addons/linecompass/settings.inc.sqf +++ b/addons/linecompass/settings.inc.sqf @@ -9,7 +9,11 @@ private _curCat = localize "STR_dui_cat_general"; [_cat, _curCat], GVAR(CompassAvailableShown), 1, - {}, + { + params ["_value"]; + + if (_value) then { call FUNC(showCompass); }; + }, false ] call CBA_fnc_addSetting; From fb727a8d47681a989a19820a1c8e84f779b52618 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 00:34:27 +0100 Subject: [PATCH 04/25] Move Data Collection to a cacheLoop Stop DrawEH when disabled Reset when UI Reset setting is enabled import public facing Params fix Ace Fingering not showing up --- addons/linecompass/XEH_PREP.hpp | 1 + addons/linecompass/XEH_postInit.sqf | 6 +- addons/linecompass/XEH_preInit.sqf | 8 +- .../functions/fnc_addLineMarker.sqf | 2 +- .../linecompass/functions/fnc_cacheLoop.sqf | 56 ++++++ .../linecompass/functions/fnc_getUnitIcon.sqf | 2 +- .../linecompass/functions/fnc_hideCompass.sqf | 4 + addons/linecompass/functions/fnc_onDraw.sqf | 162 +++++++----------- .../functions/fnc_removeLineMarker.sqf | 3 +- .../linecompass/functions/fnc_showCompass.sqf | 2 + addons/linecompass/settings.inc.sqf | 2 +- addons/main/XEH_preInit.sqf | 4 + 12 files changed, 145 insertions(+), 107 deletions(-) create mode 100644 addons/linecompass/functions/fnc_cacheLoop.sqf diff --git a/addons/linecompass/XEH_PREP.hpp b/addons/linecompass/XEH_PREP.hpp index d51fa1c..f803698 100644 --- a/addons/linecompass/XEH_PREP.hpp +++ b/addons/linecompass/XEH_PREP.hpp @@ -1,4 +1,5 @@ PREP(addLineMarker); +PREP(cacheLoop); PREP(getAlphaFromX); PREP(getUnitIcon); PREP(hideCompass); diff --git a/addons/linecompass/XEH_postInit.sqf b/addons/linecompass/XEH_postInit.sqf index d5ca930..18f1b61 100644 --- a/addons/linecompass/XEH_postInit.sqf +++ b/addons/linecompass/XEH_postInit.sqf @@ -1,5 +1,5 @@ #include "script_component.hpp" + if (is3DEN || (!hasInterface || {side player == sideLogic}) && {player isKindOf "VirtualSpectator_F"}) exitWith {}; -// waitUntil {!isNull findDisplay 46}; // TODO -call FUNC(showCompass); -GVAR(drawEh) = addMissionEventHandler ["Draw3D", {call FUNC(onDraw)}]; + +[{ call FUNC(cacheLoop);}, [], 0.1] call CBA_fnc_waitUntil; diff --git a/addons/linecompass/XEH_preInit.sqf b/addons/linecompass/XEH_preInit.sqf index 352c1f0..979ab6e 100644 --- a/addons/linecompass/XEH_preInit.sqf +++ b/addons/linecompass/XEH_preInit.sqf @@ -16,6 +16,8 @@ GVAR(lineAlphaCache) resize 109; GVAR(bearingAlphaCache) = []; GVAR(bearingAlphaCache) resize 37; +GVAR(UnitsToRender) = []; + if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { ["ace_finger_fingered", { @@ -23,11 +25,13 @@ if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { params ["_player", "_pos", "_dir"]; private _key = format ["ACE_Fingering_%1_%2", _player, time]; - [_key, GVAR(WaypointColor), _pos] call FUNC(addLineMarker); + private _color = +GVAR(WaypointColor); + + [_key, _color, _pos] call FUNC(addLineMarker); [{ _this call FUNC(removeLineMarker); - }, _key] call CBA_fnc_waitAndExecute; + }, _key, 2.5] call CBA_fnc_waitAndExecute; }] call CBA_fnc_addEventhandler; }; diff --git a/addons/linecompass/functions/fnc_addLineMarker.sqf b/addons/linecompass/functions/fnc_addLineMarker.sqf index be9d5be..8389aee 100644 --- a/addons/linecompass/functions/fnc_addLineMarker.sqf +++ b/addons/linecompass/functions/fnc_addLineMarker.sqf @@ -1,4 +1,4 @@ #include "..\script_component.hpp" -params ["_id", "_color", "_position"]; +params [["_id", "", [""]], ["_color", GVAR(WaypointColor), [[]], [3, 4]], ["_position", [0,0,0], [[]], 3]]; GVAR(lineMarkers) set [_id, [_color, _position]]; diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf new file mode 100644 index 0000000..094e1d7 --- /dev/null +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -0,0 +1,56 @@ +#include "..\script_component.hpp" + +[{ call FUNC(cacheLoop);}, [], 0.1] call CBA_fnc_waitUntil; + +if (EGVAR(main,toggled_off) || !GVAR(Enabled)) exitWith { + if (GVAR(CompassShown)) then { + call FUNC(HideCompass); + }; +}; + +if (EGVAR(main,toggled_off) || !GVAR(Enabled)) then { + if (!GVAR(CompassShown)) then { + call FUNC(ShowCompass); + }; +}; + +if (GVAR(CompassAvailableShown) && {floor(time % 1) == 0}) then { + if (!GVAR(CompassShown) && { call EFUNC(main,getCompass) isNotEqualTo "" }) then { + call FUNC(ShowCompass); + } else { + if (GVAR(CompassShown) && { call EFUNC(main,getCompass) isEqualTo "" }) then { + call FUNC(HideCompass); + }; + }; +}; + +if (customWaypointPosition isNotEqualTo GVAR(customWaypointPosition)) then { + if (customWaypointPosition isEqualTo []) then { + "VANILLA_MOVE" call FUNC(removeLineMarker); + } else { + ["VANILLA_MOVE", GVAR(WaypointColor), customWaypointPosition] call FUNC(addLineMarker); + }; + GVAR(customWaypointPosition) = customWaypointPosition; +}; + + +private _unitsToRender = units group player; +if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType [] }) then { + _unitsToRender append diwako_dui_special_track; +}; + +GVAR(RenderData) = _unitsToRender apply { + + (_x call FUNC(getUnitIcon)) params [["_icon", "a3\ui_f\data\map\Markers\Military\dot_ca.paa", [""]], ["_size", 2, [0]]]; + _size = [PX(_size), PY(_size)]; + private _color = +(_x getVariable [QEGVAR(main,compass_color), [1, 1, 1]]); + if (_color isEqualTo [1, 1, 1]) then { + _color = GVAR(DefaultIconColor); + }; + [ + _x, + _color, + _icon, + _size + ]; +}; diff --git a/addons/linecompass/functions/fnc_getUnitIcon.sqf b/addons/linecompass/functions/fnc_getUnitIcon.sqf index 51ba955..6291882 100644 --- a/addons/linecompass/functions/fnc_getUnitIcon.sqf +++ b/addons/linecompass/functions/fnc_getUnitIcon.sqf @@ -2,7 +2,7 @@ params ["_unit"]; -if !(isNil {_unit getVariable QGVAR(UnitIcon)}) exitWith { +if !(_unit isNil QGVAR(UnitIcon)) exitWith { _unit getVariable QGVAR(UnitIcon); }; diff --git a/addons/linecompass/functions/fnc_hideCompass.sqf b/addons/linecompass/functions/fnc_hideCompass.sqf index e89b143..f61e2ba 100644 --- a/addons/linecompass/functions/fnc_hideCompass.sqf +++ b/addons/linecompass/functions/fnc_hideCompass.sqf @@ -2,3 +2,7 @@ ([QGVAR(Compass)] call BIS_fnc_rscLayer) cutFadeOut 0; GVAR(CompassShown) = false; + +removeMissionEventHandler ["Draw3D", GVAR(drawEh)]; + +GVAR(drawEh) = -1; diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index acd9d03..8413caa 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -1,34 +1,10 @@ #include "..\script_component.hpp" -if (EGVAR(main,toggled_off) || !GVAR(Enabled)) exitWith { - if (GVAR(CompassShown)) exitWith { - call FUNC(HideCompass); - }; -}; - -if (GVAR(CompassAvailableShown) && {floor(time % 1) == 0}) then { - if (!GVAR(CompassShown) && { call EFUNC(main,getCompass) isNotEqualTo "" }) then { - call FUNC(ShowCompass); - } else { - if (GVAR(CompassShown) && { call EFUNC(main,getCompass) isEqualTo "" }) then { - call FUNC(HideCompass); - }; - }; -}; // Exit if the compass is not visible private _dialog = uiNamespace getVariable QGVAR(Compass); if (isNull _dialog) exitWith {}; -if (customWaypointPosition isNotEqualTo GVAR(customWaypointPosition)) then { - if (customWaypointPosition isEqualTo []) then { - "VANILLA_MOVE" call FUNC(removeLineMarker); - } else { - ["VANILLA_MOVE", GVAR(WaypointColor), customWaypointPosition] call FUNC(addLineMarker); - }; - GVAR(customWaypointPosition) = customWaypointPosition; -}; - private _viewDirectionVector = (positionCameraToWorld [0, 0, 0]) vectorDiff (positionCameraToWorld [0, 0, -1]); private _viewDirection = ((_viewDirectionVector select 0) atan2 (_viewDirectionVector select 1) + 360) % 360; private _currentPosition = getPosVisual player; @@ -87,73 +63,70 @@ private _nextLineMarkerControl = 0; private _overlapCacheLineIndices = []; { + _y params ["_color", "_markerPosition"]; - private _lineMarker = _y; - if (!(isNil "_lineMarker")) then { - private _markerPosition = _lineMarker select 1; - private _relativeVectorToMarker = _markerPosition vectorDiff _currentPosition; - private _angleToMarker = ((_relativeVectorToMarker select 0) atan2 (_relativeVectorToMarker select 1) + 360) % 360; - - private _control = GVAR(lineMarkerControlPool) select _nextLineMarkerControl; - if (isNil "_control" || {isNull _control}) then { - _control = _dialog ctrlCreate ["RscPicture", 7401 + _nextLineMarkerControl, _dialog displayCtrl 7100]; - _control ctrlSetText "#(argb,8,8,3)color(1,1,1,1)"; - GVAR(lineMarkerControlPool) set [_nextLineMarkerControl, _control]; - }; + private _relativeVectorToMarker = _markerPosition vectorDiff _currentPosition; + private _angleToMarker = ((_relativeVectorToMarker select 0) atan2 (_relativeVectorToMarker select 1) + 360) % 360; - private _lineIndex = floor (_angleToMarker / 5) + 18; - if (_viewDirection >= 270 && _lineIndex < 36) then { - _lineIndex = _lineIndex + 72; - }; - if (_viewDirection <= 90 && _lineIndex > 72) then { - _lineIndex = _lineIndex - 72; - }; + private _control = GVAR(lineMarkerControlPool) select _nextLineMarkerControl; + if (isNil "_control" || {isNull _control}) then { + _control = _dialog ctrlCreate ["RscPicture", 7401 + _nextLineMarkerControl, _dialog displayCtrl 7100]; + _control ctrlSetText "#(argb,8,8,3)color(1,1,1,1)"; + GVAR(lineMarkerControlPool) set [_nextLineMarkerControl, _control]; + }; - private _offset = (_angleToMarker % 5) - 2.5; - _control setVariable [QGVAR(color), _lineMarker select 0]; - _control setVariable [QGVAR(offset), _offset]; - _control setVariable [QGVAR(lineIndex), _lineIndex]; + private _lineIndex = floor (_angleToMarker / 5) + 18; + if (_viewDirection >= 270 && _lineIndex < 36) then { + _lineIndex = _lineIndex + 72; + }; + if (_viewDirection <= 90 && _lineIndex > 72) then { + _lineIndex = _lineIndex - 72; + }; - // Shift - private _otherMarkerControl = _overlapCacheLineIndices param [_lineIndex, nil]; - if (!(isNil "_otherMarkerControl")) then { - // Compare - private _otherOffset = _otherMarkerControl getVariable QGVAR(offset); - if (abs _otherOffset < abs _offset) then { - // Swap - _offset = _otherOffset; - private _tmp = _otherMarkerControl; - _otherMarkerControl = _control; - _control = _tmp; - } else { - _overlapCacheLineIndices set [_lineIndex, _control]; - }; - - // Direction - private _shiftDirection = if (_offset == 0) then { - 1 - } else { - _offset / abs _offset // 1 or -1 - }; - - // Shift - private _shiftedLineIndex = _lineIndex; - - while {!(isNil "_otherMarkerControl")} do { - _shiftedLineIndex = _shiftedLineIndex + _shiftDirection; - _otherMarkerControl setVariable [QGVAR(lineIndex), _shiftedLineIndex]; - - private _tmp = _otherMarkerControl; - _otherMarkerControl = _overlapCacheLineIndices param [_shiftedLineIndex, nil]; - _overlapCacheLineIndices set [_shiftedLineIndex, _tmp]; - }; + private _offset = (_angleToMarker % 5) - 2.5; + _control setVariable [QGVAR(color), _color]; + _control setVariable [QGVAR(offset), _offset]; + _control setVariable [QGVAR(lineIndex), _lineIndex]; + + // Shift + private _otherMarkerControl = _overlapCacheLineIndices param [_lineIndex, nil]; + if (!(isNil "_otherMarkerControl")) then { + // Compare + private _otherOffset = _otherMarkerControl getVariable QGVAR(offset); + if (abs _otherOffset < abs _offset) then { + // Swap + _offset = _otherOffset; + private _tmp = _otherMarkerControl; + _otherMarkerControl = _control; + _control = _tmp; } else { _overlapCacheLineIndices set [_lineIndex, _control]; }; - _nextLineMarkerControl = _nextLineMarkerControl + 1; + // Direction + private _shiftDirection = if (_offset == 0) then { + 1 + } else { + _offset / abs _offset // 1 or -1 + }; + + // Shift + private _shiftedLineIndex = _lineIndex; + + while {!(isNil "_otherMarkerControl")} do { + _shiftedLineIndex = _shiftedLineIndex + _shiftDirection; + _otherMarkerControl setVariable [QGVAR(lineIndex), _shiftedLineIndex]; + + private _tmp = _otherMarkerControl; + _otherMarkerControl = _overlapCacheLineIndices param [_shiftedLineIndex, nil]; + _overlapCacheLineIndices set [_shiftedLineIndex, _tmp]; + }; + } else { + _overlapCacheLineIndices set [_lineIndex, _control]; }; + _nextLineMarkerControl = _nextLineMarkerControl + 1; + } forEach GVAR(lineMarkers); // Remove the unused controls @@ -167,12 +140,13 @@ if (_nextLineMarkerControl < count GVAR(lineMarkerControlPool)) then { { if (ctrlShown _x) then { - private _lineIndex = _x getVariable QGVAR(lineIndex); - _x ctrlSetPosition [PX(_lineIndex * 2.5 + 0.15), PY(0.6), PX(2.2), PY(0.3)]; + private _lineIndex = _x getVariable QGVAR(lineIndex); private _color = _x getVariable QGVAR(color); - _color set [3, (2.5 + ((_lineIndex - floor (_viewDirection / 5)) * 5) - (_viewDirection % 5)) call FUNC(getAlphaFromX)]; - _x ctrlSetTextColor _color; + private _alpha = (2.5 + ((_lineIndex - floor (_viewDirection / 5)) * 5) - (_viewDirection % 5)) call FUNC(getAlphaFromX); + + _x ctrlSetPosition [PX(_lineIndex * 2.5 + 0.15), PY(0.6), PX(2.2), PY(0.3)]; + _x ctrlSetTextColor [_color select 0, _color select 1, _color select 2, (_color select 3) * _alpha]; _x ctrlCommit 0; }; } forEach GVAR(lineMarkerControlPool); @@ -186,10 +160,11 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType }; { + _x params ["_unit", "_color", "_icon", "_size"]; // Check if the unit is not the player himself and alive. - if (_x != player && alive _x && (isNull objectParent player || {!(_x in crew objectParent player)})) then { - private _unitPosition = getPosVisual _x; + if (!isNull _unit && _unit != player && alive _unit && (isNull objectParent player || {!(_unit in crew objectParent player)})) then { + private _unitPosition = getPosVisual _unit; private _relativeVectorToUnit = _unitPosition vectorDiff _currentPosition; private _angleToUnit = ((_relativeVectorToUnit select 0) atan2 (_relativeVectorToUnit select 1) + 360) % 360; @@ -209,18 +184,9 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType _compassAngle = _compassAngle - 360; }; - (_x call FUNC(getUnitIcon)) params [["_icon", "a3\ui_f\data\map\Markers\Military\dot_ca.paa", [""]], ["_size", 2, [0]]]; - _size = [PX(_size), PY(_size)]; - _control ctrlSetText _icon; - private _color = +(_x getVariable [QEGVAR(main,compass_color), [1, 1, 1]]); - - if (_color isEqualTo [1, 1, 1]) then { - _color = GVAR(DefaultIconColor); - }; - - _color set [3, ((1 - 0.2 * ((player distance _x) - (diwako_dui_compassRange - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; + _color set [3, ((1 - 0.2 * ((player distance _unit) - (diwako_dui_compassRange - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; _control ctrlSetTextColor _color; private _positionCenter = [PX(_compassAngle * 0.5) - ((_size select 0) / 2), PY(0.75) - ((_size select 1) / 2)]; @@ -232,7 +198,7 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType _nextIconMarkerControl = _nextIconMarkerControl + 1; }; -} forEach ((units group player) + diwako_dui_special_track); +} forEach GVAR(RenderData); if (_nextIconMarkerControl < count GVAR(iconMarkerControlPool)) then { for "_i" from _nextIconMarkerControl to (count GVAR(iconMarkerControlPool) - 1) do { diff --git a/addons/linecompass/functions/fnc_removeLineMarker.sqf b/addons/linecompass/functions/fnc_removeLineMarker.sqf index a4343b6..8b7dbab 100644 --- a/addons/linecompass/functions/fnc_removeLineMarker.sqf +++ b/addons/linecompass/functions/fnc_removeLineMarker.sqf @@ -1,4 +1,5 @@ #include "..\script_component.hpp" -params ["_id"]; +params [["_id", "", [""]]]; + GVAR(lineMarkers) deleteAt _id; diff --git a/addons/linecompass/functions/fnc_showCompass.sqf b/addons/linecompass/functions/fnc_showCompass.sqf index bab755c..48c2549 100644 --- a/addons/linecompass/functions/fnc_showCompass.sqf +++ b/addons/linecompass/functions/fnc_showCompass.sqf @@ -6,3 +6,5 @@ GVAR(bearingAlphaCache) = GVAR(bearingAlphaCache) apply {1}; GVAR(CompassShown) = true; // Show the compass and make sure it is not shown if the map is open ([QGVAR(Compass)] call BIS_fnc_rscLayer) cutRsc [QGVAR(Compass), "PLAIN", 0, false]; + +GVAR(drawEh) = addMissionEventHandler ["Draw3D", {call FUNC(onDraw)}]; diff --git a/addons/linecompass/settings.inc.sqf b/addons/linecompass/settings.inc.sqf index 3d82b65..f23ff26 100644 --- a/addons/linecompass/settings.inc.sqf +++ b/addons/linecompass/settings.inc.sqf @@ -49,7 +49,7 @@ private _curCat = localize "STR_dui_cat_general"; "COLOR", "Default Icon Color", [_cat, _curCat], - [0, 0.87, 0, 1] + [0.5, 0.87, 0.5, 1] ] call CBA_fnc_addSetting; [ diff --git a/addons/main/XEH_preInit.sqf b/addons/main/XEH_preInit.sqf index 299116b..29a8cfa 100644 --- a/addons/main/XEH_preInit.sqf +++ b/addons/main/XEH_preInit.sqf @@ -106,6 +106,10 @@ private _fontIndex = GVAR(availableFonts) findIf {_x isEqualTo "RobotoCondensed" profileNamespace setVariable ['igui_diwako_dui_nametags_y', nil]; profileNamespace setVariable ['igui_diwako_dui_nametags_w', nil]; profileNamespace setVariable ['igui_diwako_dui_nametags_h', nil]; + profileNamespace setVariable ['igui_diwako_dui_linecompass_x', nil]; + profileNamespace setVariable ['igui_diwako_dui_linecompass_y', nil]; + profileNamespace setVariable ['igui_diwako_dui_linecompass_w', nil]; + profileNamespace setVariable ['igui_diwako_dui_linecompass_h', nil]; saveProfileNamespace; [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; From ef23809350155d4f62389ca8d47a7a6880d39c03 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 12:25:33 +0100 Subject: [PATCH 05/25] remove unused variable --- addons/linecompass/XEH_preInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/linecompass/XEH_preInit.sqf b/addons/linecompass/XEH_preInit.sqf index 979ab6e..1650cc7 100644 --- a/addons/linecompass/XEH_preInit.sqf +++ b/addons/linecompass/XEH_preInit.sqf @@ -22,7 +22,7 @@ if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { ["ace_finger_fingered", { - params ["_player", "_pos", "_dir"]; + params ["_player", "_pos"]; private _key = format ["ACE_Fingering_%1_%2", _player, time]; private _color = +GVAR(WaypointColor); From fd1e620810e304faca6c44448ffab77c31812ad9 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 13:50:18 +0100 Subject: [PATCH 06/25] add support for buddy icons fix Custom Waypoints other stuff --- .hemtt/missions/dui.vr/initPlayerLocal.sqf | 1 + .hemtt/missions/dui.vr/mission.sqm | 196 +++++++++++++++--- addons/linecompass/UI/buddy_dot.paa | Bin 0 -> 5625 bytes addons/linecompass/XEH_postInit.sqf | 2 +- addons/linecompass/XEH_preInit.sqf | 8 +- .../functions/fnc_addLineMarker.sqf | 2 +- .../linecompass/functions/fnc_cacheLoop.sqf | 26 ++- .../linecompass/functions/fnc_getUnitIcon.sqf | 12 +- addons/linecompass/functions/fnc_onDraw.sqf | 12 +- addons/linecompass/settings.inc.sqf | 35 +++- addons/linecompass/stringtable.xml | 25 ++- addons/main/XEH_preInit.sqf | 7 + addons/radar/XEH_preInit.sqf | 6 - 13 files changed, 261 insertions(+), 71 deletions(-) create mode 100644 addons/linecompass/UI/buddy_dot.paa diff --git a/.hemtt/missions/dui.vr/initPlayerLocal.sqf b/.hemtt/missions/dui.vr/initPlayerLocal.sqf index 1c98dd1..ba0edde 100644 --- a/.hemtt/missions/dui.vr/initPlayerLocal.sqf +++ b/.hemtt/missions/dui.vr/initPlayerLocal.sqf @@ -12,6 +12,7 @@ diwako_dui_special_track = [shall,shall2,shall3,farted]; diwako_dui_special_track pushBack hank; hank setVariable ["diwako_dui_radar_customIcon", "yes.paa"]; +hank setVariable ["diwako_dui_linecompass_customIcon", ["yes.paa", 2]]; hank setVariable ["diwako_dui_nametags_customGroup", "Custom group name"]; [] spawn { diff --git a/.hemtt/missions/dui.vr/mission.sqm b/.hemtt/missions/dui.vr/mission.sqm index 98933ca..c9212ab 100644 --- a/.hemtt/missions/dui.vr/mission.sqm +++ b/.hemtt/missions/dui.vr/mission.sqm @@ -12,10 +12,10 @@ class EditorData }; class Camera { - pos[]={3204.5291,15.601435,2938.3145}; - dir[]={-0.5854485,-0.41458815,0.69669157}; - up[]={-0.26672325,0.91000748,0.31740433}; - aside[]={0.76558614,-1.8469291e-07,0.64334267}; + pos[]={3191.7058,11.738412,2948.6514}; + dir[]={-0.66102594,-0.59916627,0.45173571}; + up[]={-0.49468899,0.80062276,0.338063}; + aside[]={0.56422389,-8.6030923e-08,0.82563102}; }; }; binarizationWanted=0; @@ -41,7 +41,6 @@ addons[]= "ace_smallarms", "ace_nightvision", "A3_Weapons_F_Items", - "ace_medical_engine", "ace_medical_treatment", "A3_Characters_F_Mark", "ace_attach", @@ -66,7 +65,7 @@ class AddonsMetaData { class List { - items=29; + items=28; class Item0 { className="A3_Soft_F_Beta"; @@ -159,111 +158,104 @@ class AddonsMetaData url="https://ace3.acemod.org/"; }; class Item13 - { - className="ace_medical_engine"; - name="ACE3 - Medical Engine"; - author="ACE-Team"; - url="https://ace3.acemod.org/"; - }; - class Item14 { className="ace_medical_treatment"; name="ACE3 - Medical Treatment"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item15 + class Item14 { className="A3_Characters_F_Mark"; name="Arma 3 Marksmen - Characters and Clothing"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item16 + class Item15 { className="ace_attach"; name="ACE3 - Attach"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item17 + class Item16 { className="ace_chemlights"; - name="ace_chemlights"; + name="ACE3 - Chemlights"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item18 + class Item17 { className="ace_explosives"; name="ACE3 - Explosives"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item19 + class Item18 { className="A3_Weapons_F_Tank"; name="Arma 3 Tank - Weapons and Accessories"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item20 + class Item19 { className="ace_hearing"; name="ACE3 - Hearing"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item21 + class Item20 { className="A3_Weapons_F_Orange"; name="Arma 3 Orange - Weapons and Accessories"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item22 + class Item21 { className="ace_arsenal"; name="ACE3 - Arsenal"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item23 + class Item22 { className="A3_Armor_F_Beta"; name="Arma 3 Beta - Armored Land Vehicles"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item24 + class Item23 { className="ace_vehicle_damage"; name="ACE3 - Vehicle Damage"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item25 + class Item24 { className="A3_Air_F"; name="Arma 3 Alpha - Aircraft"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item26 + class Item25 { className="A3_Static_F"; name="Arma 3 Alpha - Turrets"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item27 + class Item26 { className="A3_Soft_F"; name="Arma 3 Alpha - Unarmored Land Vehicles"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item28 + class Item27 { className="A3_Drones_F"; name="Arma 3 Beta - Drones"; @@ -311,6 +303,26 @@ class CustomAttributes class data { singleType="ARRAY"; + class value + { + items=2; + class Item0 + { + class data + { + singleType="STRING"; + value="diwako_dui_linecompass_waypointcolor"; + }; + }; + class Item1 + { + class data + { + singleType="STRING"; + value="diwako_dui_linecompass_acefingeringcolor"; + }; + }; + }; }; }; class Item2 @@ -318,6 +330,134 @@ class CustomAttributes class data { singleType="ARRAY"; + class value + { + items=2; + class Item0 + { + class data + { + singleType="ARRAY"; + class value + { + items=2; + class Item0 + { + class data + { + singleType="ARRAY"; + class value + { + items=4; + class Item0 + { + class data + { + singleType="SCALAR"; + value=0; + }; + }; + class Item1 + { + class data + { + singleType="SCALAR"; + value=0; + }; + }; + class Item2 + { + class data + { + singleType="SCALAR"; + value=0.87; + }; + }; + class Item3 + { + class data + { + singleType="SCALAR"; + value=1; + }; + }; + }; + }; + }; + class Item1 + { + class data + { + singleType="SCALAR"; + value=1; + }; + }; + }; + }; + }; + class Item1 + { + class data + { + singleType="ARRAY"; + class value + { + items=2; + class Item0 + { + class data + { + singleType="ARRAY"; + class value + { + items=4; + class Item0 + { + class data + { + singleType="SCALAR"; + value=0.89999998; + }; + }; + class Item1 + { + class data + { + singleType="SCALAR"; + value=0.66000003; + }; + }; + class Item2 + { + class data + { + singleType="SCALAR"; + value=0; + }; + }; + class Item3 + { + class data + { + singleType="SCALAR"; + value=1; + }; + }; + }; + }; + }; + class Item1 + { + class data + { + singleType="SCALAR"; + value=1; + }; + }; + }; + }; + }; + }; }; }; class Item3 diff --git a/addons/linecompass/UI/buddy_dot.paa b/addons/linecompass/UI/buddy_dot.paa new file mode 100644 index 0000000000000000000000000000000000000000..afc795fc6f2ea57a95bee2ebe8c4db430620a0ea GIT binary patch literal 5625 zcmeHLeN^<`q4711TTP@JmC&*lPGZWKDO!GoF%zPg)q)a@z%cJV?;S|vAGWjG*?;yu2j=|F zeed%;zvt_H-s?x^&P_;~J$F%p3;>?r_WVi-CnwCOnBby#Zo-52Q_S?@h4I=mAiIU%%J>kALlu0sO)ESFLKOS`|tNfFKC!!9P@`g__4s zp;(PU@x(kctnjiw2GmKkTC3GtaSL0m`Fm@pjqzcY)t0wG z;*IcqgI=QYj7Cg^DX5RT>r$6k@PbR5LI<|P_ag`-=ftj z-t9@=Njiy+@{M8vPIl2$E(@X<9c$Zv_*YomZ>M-rZ0~cHd`8``THUw*sQ0@z9ogxj zxEw?U8T$iwO7z!Ltl+I;Js56;uVzsT`XArqmDFBkgU>%g(tqk7%J;Bix5QV?FidD? z@}#j}l=}m!#?laesmjOl^Gqv9Hl(rS5Djwnb+uf-6a+ z!zp)?s|j$eV?xD{gGJ4R%gJgrJOJ;dx*7uC%q%oCMV7S6!mzX#li^^O#}-^{bmzZ{ z^5lEHWG9&)bcN~@S?y>tPsQ0lCiy?A+#()>#M9y3TjMEzqyD$&M+ou_cN7Kt{O9LK zRPh}_rFu!eXw$MjzPy&|2UZk2W%ito?`tCw;nExD@aw%7bBl@yN#NHn6NK)ej?i_j zYuE#gVf?;va;~_`JIP0%#6@AFt5k9G@J%PFs$6eDJo35GU8+HKrS5l^q^@_l z?vZa^qI-91$A%N>s)zzXXk$t;7gp~+T;rzt7&WQJpI{X$*#iomgf8IfMPAB}?Fx(d z7$i1@Z(<`UpQNOL{qX}hiq_{A45j=1{QQ`zo_RH-rwrqX@nu;cLq-0J`0X&7V`w{DaZJeYrtAy zvM*ku$P!rd!A#fIPRd6w>7)N{TmAamOwW<@*pV4h|H5=gTy_G%EwbjYy*>Z z?CR5!er!laC2YuBSKWP}PvUGvb>7D6q62{$8c-LU5lHliO!ghsLeCXh7|SuY@h^2l zxggx)@5AIlQBha_N?fVCZL7;}Uy&BrHc8iWNq2Ii22z$S78vC_M)oc{)2Htv$j#g2 z*!?l($6&z7E>;izDv7@W7g=(CYo{?FPqLra@B{UO!`>rJvCA+0!vDkCTl_^_Nz97T zk(*Ap5G-`0pR8sbJw^8{R`l63HgLnb)mIM7`|$oTv3UnNONg*f1M&kT^|JXI3Dv^8A?maD?4yLYAPyzRQFN78r~^3?`eCv^>1zT78oDEr(Y zZ-(;yK70?8n^%0Y2jii^e2oxHH;=vNsoNp-CxwFN$?5Z4WxenGvDj>wZ+&m}{`SL1 zy~{JEjLaA>`4i(`agbaeMcg{-Kco-y_=g%j-8&kozLb>YvZptY6Qe=8#b z$VkKHhMnP%)rzv^&vy&+$A3n%z+N=xtaS^e<6{q~RAg75nSW``v2?4ZP^$nSTY zdE`VIFDzT{8q5CtW!I|eJF{957sSPxZX)@*_ay#2F5&{1SO1q8Qv7W;?Lhn&d6r*_ zz4I3Tx;Aos3+a^j1M)u;l=aZjYx2z{t<4%^eT9b1yY7+)YtX*HjOYLsy2$+eaBQJY zQi2|U@>}^$I~E&o3-|e-^sfGx?icNS`}^dPl}2ta`0H!j#%-A{5snN^Y<&Ah?y{`b z+K`9|QSed^lKy4Axm3#p~++sXJpFEK~7TRrv0k@CZ&_8sd3W`fOB00onbf~PVo7^)BpPT z5|Y(Q>+Pp*DsL3@%3HM7O}fhx3nhI@r82s6di&x>C#V&Kl)7J2u+ZkMD(9!Ffxe z05S(;E9{CmibabiiV=rB_$fDDnul;4_|5asS?Dycca-3fjr|oDF@Oew&FF9R2hUr` z0pN1bu@q}8IPYp6`uJ;Az&t{Z#urnZG$eCp^(Q!=bvMf8m_L&sM&A6hj_%i%qrH=` zJ{xvP`Km1!!Se`AKHIUgkn%T~MCgjx)KvJ-81&!v1+QV3CAn|tY4fM~#Ig9h4udN4 zu|B@G@*lytXXd6RDSpUzz<3Xo4>(Vz;e0RoPmKfqacDJfbd*T)(IY}=x5Mel;NGYD z6$*=$G~+PFswDqly>BP4TRAjW@(*vtf$(O&8DEy-rNRDax+%Wehi$Z9zWB@?efzUV z1GIWSFT>3$Nj?iUG86gMm*ad#`*9Rp1=YTpS-yP5_XH;R&&ob~jY;%;rP6L&|7E-Y z+-6U2yCx8Brb22>dC9g6Y9e96%O_LB;^E)VBRCxNIa4LJ$$lzE4* zKWl9^k_?(vdvw#J=Qf442gIuPz3sjJ1|z%X+sSs(7Y`gae|LVrxBvdv@-l$SK~e!k7c*a z8&e;o=V+Ufu3;Pj!=XqQ7emL0C7E`yzdrvmyu(*LF$R+o1hqPjOdqD#v%YIi)OM@& z6630ENi1z{#A}=>C26s?CwY(e_(?o;mdB3cSe8sRau)D6)wrXdTwxc*V{GE}ziw`d zY-q$gTU_Beq7ldI@AO?$EZN&_%;}2g^V>#TAS8`noRVyGgQFnXkQclZ56uW%1ng{F zJ%?qHuCikryBlz<-tgVC_aR&L83D&?zf9)3*;(pt*05ak88Q+4ZN{gOe*!OxS5v1m zZL@V9wO!*Lz-!N9+z;c-0iEVR8Xt~fl+SvfFS+ne$$5%#j5Wr&e@?%`7|f3uO2cV>MX1#UB-K8;P8N)9ztrtQ`D8AR z8GnjDTI1fn0HDqIlb4i{o*md3r?;>y%lO8O{5b^2E}RF8=a>}y)`9L7dJjAgZukDyktg@0UtmksrHngX` z*hKBwRMHkcoPMU6-onshXhZ$$&Cz~{|8Z8N&lk%d#$yV{q^e5VaWS5+#BZef_Jr8& zrqurW2EzUhRR)J8Me~9CL=YbJ%+HRKFbc!{CLSctOH)u(-isjfdq!@T>>H1&Syq?yneuVGP4EUzFSh zXlGdQxAb{)tKv};OwsN{w)o_;Op22G^?x*2a*)J?45fzU90a#=Xlhiyan5i*;6ZURWg zuN6G-pvQbUHD&pmITNkjSiP0jdOm0?Fkf1Xf<)#l4WCN?xaKJJN{>?f#BfPVq2{$X+e literal 0 HcmV?d00001 diff --git a/addons/linecompass/XEH_postInit.sqf b/addons/linecompass/XEH_postInit.sqf index 18f1b61..b553e88 100644 --- a/addons/linecompass/XEH_postInit.sqf +++ b/addons/linecompass/XEH_postInit.sqf @@ -2,4 +2,4 @@ if (is3DEN || (!hasInterface || {side player == sideLogic}) && {player isKindOf "VirtualSpectator_F"}) exitWith {}; -[{ call FUNC(cacheLoop);}, [], 0.1] call CBA_fnc_waitUntil; +FUNC(cacheLoop) call CBA_fnc_directCall; diff --git a/addons/linecompass/XEH_preInit.sqf b/addons/linecompass/XEH_preInit.sqf index 1650cc7..d027617 100644 --- a/addons/linecompass/XEH_preInit.sqf +++ b/addons/linecompass/XEH_preInit.sqf @@ -16,6 +16,8 @@ GVAR(lineAlphaCache) resize 109; GVAR(bearingAlphaCache) = []; GVAR(bearingAlphaCache) resize 37; +GVAR(customWaypointPosition) = customWaypointPosition; + GVAR(UnitsToRender) = []; if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { @@ -24,10 +26,8 @@ if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { params ["_player", "_pos"]; - private _key = format ["ACE_Fingering_%1_%2", _player, time]; - private _color = +GVAR(WaypointColor); - - [_key, _color, _pos] call FUNC(addLineMarker); + private _key = format ["ACE_Fingering_%1", hashValue _player]; + [_key, _pos, GVAR(ACEFingeringColor)] call FUNC(addLineMarker); [{ _this call FUNC(removeLineMarker); diff --git a/addons/linecompass/functions/fnc_addLineMarker.sqf b/addons/linecompass/functions/fnc_addLineMarker.sqf index 8389aee..4db05b8 100644 --- a/addons/linecompass/functions/fnc_addLineMarker.sqf +++ b/addons/linecompass/functions/fnc_addLineMarker.sqf @@ -1,4 +1,4 @@ #include "..\script_component.hpp" -params [["_id", "", [""]], ["_color", GVAR(WaypointColor), [[]], [3, 4]], ["_position", [0,0,0], [[]], 3]]; +params [["_id", "", [""]], ["_position", [0,0,0], [[]], 3], ["_color", GVAR(WaypointColor), [[]], [3, 4]]]; GVAR(lineMarkers) set [_id, [_color, _position]]; diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index 094e1d7..446e995 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -1,14 +1,18 @@ #include "..\script_component.hpp" -[{ call FUNC(cacheLoop);}, [], 0.1] call CBA_fnc_waitUntil; +[{ call FUNC(cacheLoop); }, [], 0.1] call CBA_fnc_waitAndExecute; -if (EGVAR(main,toggled_off) || !GVAR(Enabled)) exitWith { +private _player = call CBA_fnc_currentUnit; + +private _canShow = [_player] call EFUNC(main,canHudBeShown); + +if (!_canShow || !GVAR(Enabled)) exitWith { if (GVAR(CompassShown)) then { call FUNC(HideCompass); }; }; -if (EGVAR(main,toggled_off) || !GVAR(Enabled)) then { +if (_canShow && GVAR(Enabled)) then { if (!GVAR(CompassShown)) then { call FUNC(ShowCompass); }; @@ -26,9 +30,9 @@ if (GVAR(CompassAvailableShown) && {floor(time % 1) == 0}) then { if (customWaypointPosition isNotEqualTo GVAR(customWaypointPosition)) then { if (customWaypointPosition isEqualTo []) then { - "VANILLA_MOVE" call FUNC(removeLineMarker); + "CUSTOM_WAYPOINT_POSITION" call FUNC(removeLineMarker); } else { - ["VANILLA_MOVE", GVAR(WaypointColor), customWaypointPosition] call FUNC(addLineMarker); + ["CUSTOM_WAYPOINT_POSITION", customWaypointPosition, GVAR(CustomWaypointColor)] call FUNC(addLineMarker); }; GVAR(customWaypointPosition) = customWaypointPosition; }; @@ -41,16 +45,26 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType GVAR(RenderData) = _unitsToRender apply { - (_x call FUNC(getUnitIcon)) params [["_icon", "a3\ui_f\data\map\Markers\Military\dot_ca.paa", [""]], ["_size", 2, [0]]]; + ([_x, _player] call FUNC(getUnitIcon)) params [["_icon", "a3\ui_f\data\map\Markers\Military\dot_ca.paa", [""]], ["_size", 2, [0]]]; _size = [PX(_size), PY(_size)]; + private _color = +(_x getVariable [QEGVAR(main,compass_color), [1, 1, 1]]); if (_color isEqualTo [1, 1, 1]) then { _color = GVAR(DefaultIconColor); }; + [ _x, _color, _icon, _size ]; + +}; + +private _dialog = uiNamespace getVariable QGVAR(Compass); +if (!isNull _dialog) then { + private _parentControl = _dialog displayCtrl 7000; + _parentControl ctrlSetPosition [GET_POS_X, GET_POS_Y, GET_POS_W, GET_POS_H]; + _parentControl ctrlCommit 0; }; diff --git a/addons/linecompass/functions/fnc_getUnitIcon.sqf b/addons/linecompass/functions/fnc_getUnitIcon.sqf index 6291882..f0afe4d 100644 --- a/addons/linecompass/functions/fnc_getUnitIcon.sqf +++ b/addons/linecompass/functions/fnc_getUnitIcon.sqf @@ -1,9 +1,9 @@ #include "..\script_component.hpp" -params ["_unit"]; +params ["_unit", "_player"]; -if !(_unit isNil QGVAR(UnitIcon)) exitWith { - _unit getVariable QGVAR(UnitIcon); +if !(_unit isNil QGVAR(customIcon)) exitWith { + _unit getVariable QGVAR(customIcon); }; private _icon = "a3\ui_f\data\map\Markers\Military\dot_ca.paa"; @@ -19,4 +19,10 @@ if (_unit getUnitTrait "medic" || _unit getVariable ["ace_medical_medicClass", 0 _size = 2; }; +// Buddy +if (_player == (_unit getVariable [QEGVAR(buddy,buddy), objNull])) then { + _icon = QPATHTOF(UI\buddy_dot.paa); + _size = 1.6; +}; + [_icon, _size]; diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index 8413caa..0898d60 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -9,10 +9,6 @@ private _viewDirectionVector = (positionCameraToWorld [0, 0, 0]) vectorDiff (pos private _viewDirection = ((_viewDirectionVector select 0) atan2 (_viewDirectionVector select 1) + 360) % 360; private _currentPosition = getPosVisual player; -private _parentControl = _dialog displayCtrl 7000; -_parentControl ctrlSetPosition [GET_POS_X, GET_POS_Y, GET_POS_W, GET_POS_H]; -_parentControl ctrlCommit 0; - // Shift the control group to view direction private _control = _dialog displayCtrl 7100; _control ctrlSetPosition [PX(_viewDirection * -0.5), PY(1)]; @@ -154,7 +150,9 @@ if (_nextLineMarkerControl < count GVAR(lineMarkerControlPool)) then { // Icon marker private _nextIconMarkerControl = 0; -private _units = units group player; +private _player = call CBA_fnc_currentUnit; + +private _units = units group _player; if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType [] }) then { _units append diwako_dui_special_track; }; @@ -163,7 +161,7 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType _x params ["_unit", "_color", "_icon", "_size"]; // Check if the unit is not the player himself and alive. - if (!isNull _unit && _unit != player && alive _unit && (isNull objectParent player || {!(_unit in crew objectParent player)})) then { + if (!isNull _unit && _unit != _player && alive _unit && (isNull objectParent _player || {!(_unit in crew objectParent _player)})) then { private _unitPosition = getPosVisual _unit; private _relativeVectorToUnit = _unitPosition vectorDiff _currentPosition; private _angleToUnit = ((_relativeVectorToUnit select 0) atan2 (_relativeVectorToUnit select 1) + 360) % 360; @@ -186,7 +184,7 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType _control ctrlSetText _icon; - _color set [3, ((1 - 0.2 * ((player distance _unit) - (diwako_dui_compassRange - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; + _color set [3, ((1 - 0.2 * ((_player distance _unit) - (diwako_dui_compassRange - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; _control ctrlSetTextColor _color; private _positionCenter = [PX(_compassAngle * 0.5) - ((_size select 0) / 2), PY(0.75) - ((_size select 1) / 2)]; diff --git a/addons/linecompass/settings.inc.sqf b/addons/linecompass/settings.inc.sqf index f23ff26..7ccb1dd 100644 --- a/addons/linecompass/settings.inc.sqf +++ b/addons/linecompass/settings.inc.sqf @@ -5,13 +5,12 @@ private _curCat = localize "STR_dui_cat_general"; [ QGVAR(Enabled), "CHECKBOX", - "Enabled", + "STR_dui_linecompass_enabled", [_cat, _curCat], GVAR(CompassAvailableShown), - 1, + 0, { params ["_value"]; - if (_value) then { call FUNC(showCompass); }; }, false @@ -20,7 +19,7 @@ private _curCat = localize "STR_dui_cat_general"; [ QGVAR(CompassAvailableShown), "CHECKBOX", - "Show Only When Compass is Available", + "STR_dui_linecompass_compass_required", [_cat, _curCat], GVAR(CompassAvailableShown), 1, @@ -31,7 +30,7 @@ private _curCat = localize "STR_dui_cat_general"; [ QGVAR(DrawBearing), "LIST", - "Directions Drawn", + "STR_dui_linecompass_draw_directions", [_cat, _curCat], [[0, 1, 2], ["None", "Bearing", "All"], 2] ] call CBA_fnc_addSetting; @@ -39,15 +38,15 @@ private _curCat = localize "STR_dui_cat_general"; [ QGVAR(IconOutline), "LIST", - "Icon Outline", + "STR_dui_linecompass_icon_outline", [_cat, _curCat], - [[0, 1, 2], ["None", "Shadow", "Outline"], 2] + [[0, 1, 2], ["None", "Shadow", "Outline"], 0] ] call CBA_fnc_addSetting; [ QGVAR(DefaultIconColor), "COLOR", - "Default Icon Color", + "STR_dui_linecompass_default_icon_color", [_cat, _curCat], [0.5, 0.87, 0.5, 1] ] call CBA_fnc_addSetting; @@ -55,7 +54,23 @@ private _curCat = localize "STR_dui_cat_general"; [ QGVAR(WaypointColor), "COLOR", - "Default Icon Color", + "STR_dui_linecompass_default_waypoint_color", + [_cat, _curCat], + [0, 0, 0.87, 1] +] call CBA_fnc_addSetting; + +[ + QGVAR(CustomWaypointColor), + "COLOR", + "STR_dui_linecompass_default_waypoint_color", + [_cat, _curCat], + [0, 0, 0.87, 1] +] call CBA_fnc_addSetting; + +[ + QGVAR(ACEFingeringColor), + "COLOR", + "STR_dui_linecompass_ace_fingering_color", [_cat, _curCat], - [0.9, 0.66, 0.01, 1] + [1, 0.66, 0, 1] ] call CBA_fnc_addSetting; diff --git a/addons/linecompass/stringtable.xml b/addons/linecompass/stringtable.xml index be0ff9c..9b477ac 100644 --- a/addons/linecompass/stringtable.xml +++ b/addons/linecompass/stringtable.xml @@ -1,15 +1,30 @@ - + Line Compass - - Show line compass + + Enabled - - Show line compass + + Show Only When Compass is Available + + + Directions Drawn + + + Icon Outline + + + Default Icon Color + + + Default Waypoint Color + + + ACE Pointing Color diff --git a/addons/main/XEH_preInit.sqf b/addons/main/XEH_preInit.sqf index 29a8cfa..a7d7db3 100644 --- a/addons/main/XEH_preInit.sqf +++ b/addons/main/XEH_preInit.sqf @@ -9,6 +9,13 @@ GVAR(inFeatureCamera) = false; private _curCat = localize "STR_dui_cat_general"; +// compass whitelist, these need to be lowercase!! +GVAR(compassWhitelist) = "getText (_x >> 'simulation') == 'ItemCompass'" configClasses (configFile >> "CfgWeapons") apply {configName _x}; + +// GPS whitelist (GPS devices + UAV terminals) +GVAR(gpsWhitelist) = "getText (_x >> 'simulation') == 'ItemGPS' || inheritsFrom _x == (configFile >> 'CfgWeapons' >> 'UavTerminal_base')" configClasses (configFile >> "CfgWeapons") apply {configName _x}; + + // Blacklisted fonts GVAR(availableFonts) = '!(configName _x in [ "EtelkaMonospaceProBold", diff --git a/addons/radar/XEH_preInit.sqf b/addons/radar/XEH_preInit.sqf index 0c50234..47c048e 100644 --- a/addons/radar/XEH_preInit.sqf +++ b/addons/radar/XEH_preInit.sqf @@ -16,12 +16,6 @@ GVAR(showRank) = false; GVAR(setCompass) = true; GVAR(setNamelist) = true; -// compass whitelist, these need to be lowercase!! -GVAR(compassWhitelist) = "getText (_x >> 'simulation') == 'ItemCompass'" configClasses (configFile >> "CfgWeapons") apply {configName _x}; - -// GPS whitelist (GPS devices + UAV terminals) -GVAR(gpsWhitelist) = "getText (_x >> 'simulation') == 'ItemGPS' || inheritsFrom _x == (configFile >> 'CfgWeapons' >> 'UavTerminal_base')" configClasses (configFile >> "CfgWeapons") apply {configName _x}; - // some compasses have less then 360 degrees GVAR(oddDirectionCompasses) = [] call CBA_fnc_createNamespace; GVAR(oddDirectionCompasses) setVariable ["gm_ge_army_conat2", 6400]; From 90dc47a1120e878af7f2700a12cbaf6d6340e492 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 14:10:33 +0100 Subject: [PATCH 07/25] move to Top by Default --- addons/linecompass/script_component.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/linecompass/script_component.hpp b/addons/linecompass/script_component.hpp index f5bd12d..4d26a2c 100644 --- a/addons/linecompass/script_component.hpp +++ b/addons/linecompass/script_component.hpp @@ -20,9 +20,8 @@ #define PX(X) ((X)/PYN*safeZoneH/(4/3)) #define PY(Y) ((Y)/PYN*safeZoneH) - #define POS_X 0.5 - PX(46.25) -#define POS_Y PY(103) + safeZoneY +#define POS_Y safeZoneY #define POS_W PX(92.5) #define POS_H PY(5) #define GET_POS_X profileNamespace getVariable ['igui_diwako_dui_linecompass_x', POS_X] From 44fe91d522b45e0e3541703b60d2a4d4eee73419 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 16:03:48 +0100 Subject: [PATCH 08/25] review changes --- addons/linecompass/CfgEventHandlers.hpp | 2 +- addons/linecompass/XEH_preInit.sqf | 45 ++++++++++--------- addons/linecompass/config.cpp | 2 +- .../linecompass/functions/fnc_cacheLoop.sqf | 6 +-- addons/linecompass/functions/fnc_onDraw.sqf | 32 ++++++------- addons/linecompass/script_component.hpp | 5 ++- 6 files changed, 49 insertions(+), 43 deletions(-) diff --git a/addons/linecompass/CfgEventHandlers.hpp b/addons/linecompass/CfgEventHandlers.hpp index c96fa2b..3ea224c 100644 --- a/addons/linecompass/CfgEventHandlers.hpp +++ b/addons/linecompass/CfgEventHandlers.hpp @@ -1,4 +1,4 @@ -//diwako_dui_indicators eventhandlers +//diwako_dui_linecompass eventhandlers class Extended_PreStart_EventHandlers { class ADDON { init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); diff --git a/addons/linecompass/XEH_preInit.sqf b/addons/linecompass/XEH_preInit.sqf index d027617..65bfc65 100644 --- a/addons/linecompass/XEH_preInit.sqf +++ b/addons/linecompass/XEH_preInit.sqf @@ -2,37 +2,40 @@ ADDON = false; #include "XEH_PREP.hpp" -GVAR(drawEh) = -1; +if (hasInterface) then { -GVAR(lineMarkers) = createHashMap; + GVAR(drawEh) = -1; -// Use pools to store the controls for the markers -GVAR(lineMarkerControlPool) = []; -GVAR(iconMarkerControlPool) = []; + GVAR(lineMarkers) = createHashMap; -// Caches for alpha values -GVAR(lineAlphaCache) = []; -GVAR(lineAlphaCache) resize 109; -GVAR(bearingAlphaCache) = []; -GVAR(bearingAlphaCache) resize 37; + // Use pools to store the controls for the markers + GVAR(lineMarkerControlPool) = []; + GVAR(iconMarkerControlPool) = []; -GVAR(customWaypointPosition) = customWaypointPosition; + // Caches for alpha values + GVAR(lineAlphaCache) = []; + GVAR(lineAlphaCache) resize 109; + GVAR(bearingAlphaCache) = []; + GVAR(bearingAlphaCache) resize 37; -GVAR(UnitsToRender) = []; + GVAR(customWaypointPosition) = customWaypointPosition; -if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { + GVAR(UnitsToRender) = []; - ["ace_finger_fingered", { + if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { - params ["_player", "_pos"]; + ["ace_finger_fingered", { - private _key = format ["ACE_Fingering_%1", hashValue _player]; - [_key, _pos, GVAR(ACEFingeringColor)] call FUNC(addLineMarker); + params ["_player", "_pos"]; - [{ - _this call FUNC(removeLineMarker); - }, _key, 2.5] call CBA_fnc_waitAndExecute; - }] call CBA_fnc_addEventhandler; + private _key = format ["ACE_Fingering_%1", hashValue _player]; + [_key, _pos, GVAR(ACEFingeringColor)] call FUNC(addLineMarker); + + [{ + _this call FUNC(removeLineMarker); + }, _key, 2.5] call CBA_fnc_waitAndExecute; + }] call CBA_fnc_addEventhandler; + }; }; #include "settings.inc.sqf" diff --git a/addons/linecompass/config.cpp b/addons/linecompass/config.cpp index b0509b5..505694e 100644 --- a/addons/linecompass/config.cpp +++ b/addons/linecompass/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"diwako_dui_main", "diwako_dui_radar"}; + requiredAddons[] = {"diwako_dui_main"}; author = "joko // Jonas"; VERSION_CONFIG; license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike"; diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index 446e995..f3cbb38 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" -[{ call FUNC(cacheLoop); }, [], 0.1] call CBA_fnc_waitAndExecute; +[{ call FUNC(cacheLoop); }, [], 0.5] call CBA_fnc_waitAndExecute; private _player = call CBA_fnc_currentUnit; @@ -38,7 +38,7 @@ if (customWaypointPosition isNotEqualTo GVAR(customWaypointPosition)) then { }; -private _unitsToRender = units group player; +private _unitsToRender = units group _player; if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType [] }) then { _unitsToRender append diwako_dui_special_track; }; @@ -50,7 +50,7 @@ GVAR(RenderData) = _unitsToRender apply { private _color = +(_x getVariable [QEGVAR(main,compass_color), [1, 1, 1]]); if (_color isEqualTo [1, 1, 1]) then { - _color = GVAR(DefaultIconColor); + _color = +GVAR(DefaultIconColor); }; [ diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index 0898d60..ed7f489 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -33,20 +33,26 @@ for "_i" from 0 to 37 do { private _bearingOffset = 2.5 - (_viewDirection % 15); for "_i" from 0 to 13 do { + private _idc = _i + floor (_viewDirection / 15); private _control = _dialog displayCtrl (7301 + _idc); private _newAlpha = (_i * 15 + _bearingOffset) call FUNC(getAlphaFromX); private _oldAlpha = GVAR(bearingAlphaCache) select _idc; - if (GVAR(DrawBearing) == 1) then { - private _idcMod = _idc mod 3; - if (_idcMod != 0) then { - _newAlpha = 0; + + switch (GVAR(DrawBearing)) do { + case 1: { + private _idcMod = _idc mod 3; + if (_idcMod != 0) then { + _newAlpha = 0; + }; + break; }; - } else { - if (GVAR(DrawBearing) == 0) then { + case 2: { _newAlpha = 0; + break; }; }; + if (_newAlpha != _oldAlpha) then { GVAR(bearingAlphaCache) set [_idc, _newAlpha]; _control ctrlSetTextColor [1, 1, 1, _newAlpha]; @@ -86,7 +92,7 @@ private _overlapCacheLineIndices = []; // Shift private _otherMarkerControl = _overlapCacheLineIndices param [_lineIndex, nil]; - if (!(isNil "_otherMarkerControl")) then { + if !(isNil "_otherMarkerControl") then { // Compare private _otherOffset = _otherMarkerControl getVariable QGVAR(offset); if (abs _otherOffset < abs _offset) then { @@ -109,7 +115,7 @@ private _overlapCacheLineIndices = []; // Shift private _shiftedLineIndex = _lineIndex; - while {!(isNil "_otherMarkerControl")} do { + while {!isNil "_otherMarkerControl"} do { _shiftedLineIndex = _shiftedLineIndex + _shiftDirection; _otherMarkerControl setVariable [QGVAR(lineIndex), _shiftedLineIndex]; @@ -128,9 +134,7 @@ private _overlapCacheLineIndices = []; // Remove the unused controls if (_nextLineMarkerControl < count GVAR(lineMarkerControlPool)) then { for "_i" from _nextLineMarkerControl to (count GVAR(lineMarkerControlPool) - 1) do { - private _control = GVAR(lineMarkerControlPool) select _nextLineMarkerControl; - ctrlDelete _control; - GVAR(lineMarkerControlPool) deleteAt _nextLineMarkerControl; + ctrlDelete GVAR(lineMarkerControlPool) deleteAt _nextLineMarkerControl; }; }; @@ -161,7 +165,7 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType _x params ["_unit", "_color", "_icon", "_size"]; // Check if the unit is not the player himself and alive. - if (!isNull _unit && _unit != _player && alive _unit && (isNull objectParent _player || {!(_unit in crew objectParent _player)})) then { + if (alive _unit && _unit != _player && (isNull objectParent _player || {!(_unit in crew objectParent _player)})) then { private _unitPosition = getPosVisual _unit; private _relativeVectorToUnit = _unitPosition vectorDiff _currentPosition; private _angleToUnit = ((_relativeVectorToUnit select 0) atan2 (_relativeVectorToUnit select 1) + 360) % 360; @@ -200,8 +204,6 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType if (_nextIconMarkerControl < count GVAR(iconMarkerControlPool)) then { for "_i" from _nextIconMarkerControl to (count GVAR(iconMarkerControlPool) - 1) do { - private _control = GVAR(iconMarkerControlPool) select _nextIconMarkerControl; - ctrlDelete _control; - GVAR(iconMarkerControlPool) deleteAt _nextIconMarkerControl; + ctrlDelete GVAR(iconMarkerControlPool) deleteAt _nextIconMarkerControl; }; }; diff --git a/addons/linecompass/script_component.hpp b/addons/linecompass/script_component.hpp index 4d26a2c..a680d75 100644 --- a/addons/linecompass/script_component.hpp +++ b/addons/linecompass/script_component.hpp @@ -21,9 +21,10 @@ #define PY(Y) ((Y)/PYN*safeZoneH) #define POS_X 0.5 - PX(46.25) -#define POS_Y safeZoneY -#define POS_W PX(92.5) #define POS_H PY(5) +#define POS_Y safeZoneY - POS_H +#define POS_W PX(92.5) + #define GET_POS_X profileNamespace getVariable ['igui_diwako_dui_linecompass_x', POS_X] #define GET_POS_Y profileNamespace getVariable ['igui_diwako_dui_linecompass_y', POS_Y] #define GET_POS_W profileNamespace getVariable ['igui_diwako_dui_linecompass_w', POS_W] From 76f9d223239ca9651482c4ea1e14743940852d30 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 16:07:10 +0100 Subject: [PATCH 09/25] make linter happy --- addons/linecompass/functions/fnc_onDraw.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index ed7f489..5e3c252 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -134,7 +134,7 @@ private _overlapCacheLineIndices = []; // Remove the unused controls if (_nextLineMarkerControl < count GVAR(lineMarkerControlPool)) then { for "_i" from _nextLineMarkerControl to (count GVAR(lineMarkerControlPool) - 1) do { - ctrlDelete GVAR(lineMarkerControlPool) deleteAt _nextLineMarkerControl; + ctrlDelete (GVAR(lineMarkerControlPool) deleteAt _nextLineMarkerControl); }; }; @@ -204,6 +204,6 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType if (_nextIconMarkerControl < count GVAR(iconMarkerControlPool)) then { for "_i" from _nextIconMarkerControl to (count GVAR(iconMarkerControlPool) - 1) do { - ctrlDelete GVAR(iconMarkerControlPool) deleteAt _nextIconMarkerControl; + ctrlDelete (GVAR(iconMarkerControlPool) deleteAt _nextIconMarkerControl); }; }; From cd0fdec048f6804a347a220aabb9562f9fd1851d Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 17:46:36 +0100 Subject: [PATCH 10/25] revert mission.sqm changes --- .hemtt/missions/dui.vr/mission.sqm | 196 +++++------------------------ 1 file changed, 28 insertions(+), 168 deletions(-) diff --git a/.hemtt/missions/dui.vr/mission.sqm b/.hemtt/missions/dui.vr/mission.sqm index c9212ab..98933ca 100644 --- a/.hemtt/missions/dui.vr/mission.sqm +++ b/.hemtt/missions/dui.vr/mission.sqm @@ -12,10 +12,10 @@ class EditorData }; class Camera { - pos[]={3191.7058,11.738412,2948.6514}; - dir[]={-0.66102594,-0.59916627,0.45173571}; - up[]={-0.49468899,0.80062276,0.338063}; - aside[]={0.56422389,-8.6030923e-08,0.82563102}; + pos[]={3204.5291,15.601435,2938.3145}; + dir[]={-0.5854485,-0.41458815,0.69669157}; + up[]={-0.26672325,0.91000748,0.31740433}; + aside[]={0.76558614,-1.8469291e-07,0.64334267}; }; }; binarizationWanted=0; @@ -41,6 +41,7 @@ addons[]= "ace_smallarms", "ace_nightvision", "A3_Weapons_F_Items", + "ace_medical_engine", "ace_medical_treatment", "A3_Characters_F_Mark", "ace_attach", @@ -65,7 +66,7 @@ class AddonsMetaData { class List { - items=28; + items=29; class Item0 { className="A3_Soft_F_Beta"; @@ -158,104 +159,111 @@ class AddonsMetaData url="https://ace3.acemod.org/"; }; class Item13 + { + className="ace_medical_engine"; + name="ACE3 - Medical Engine"; + author="ACE-Team"; + url="https://ace3.acemod.org/"; + }; + class Item14 { className="ace_medical_treatment"; name="ACE3 - Medical Treatment"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item14 + class Item15 { className="A3_Characters_F_Mark"; name="Arma 3 Marksmen - Characters and Clothing"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item15 + class Item16 { className="ace_attach"; name="ACE3 - Attach"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item16 + class Item17 { className="ace_chemlights"; - name="ACE3 - Chemlights"; + name="ace_chemlights"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item17 + class Item18 { className="ace_explosives"; name="ACE3 - Explosives"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item18 + class Item19 { className="A3_Weapons_F_Tank"; name="Arma 3 Tank - Weapons and Accessories"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item19 + class Item20 { className="ace_hearing"; name="ACE3 - Hearing"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item20 + class Item21 { className="A3_Weapons_F_Orange"; name="Arma 3 Orange - Weapons and Accessories"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item21 + class Item22 { className="ace_arsenal"; name="ACE3 - Arsenal"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item22 + class Item23 { className="A3_Armor_F_Beta"; name="Arma 3 Beta - Armored Land Vehicles"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item23 + class Item24 { className="ace_vehicle_damage"; name="ACE3 - Vehicle Damage"; author="ACE-Team"; url="https://ace3.acemod.org/"; }; - class Item24 + class Item25 { className="A3_Air_F"; name="Arma 3 Alpha - Aircraft"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item25 + class Item26 { className="A3_Static_F"; name="Arma 3 Alpha - Turrets"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item26 + class Item27 { className="A3_Soft_F"; name="Arma 3 Alpha - Unarmored Land Vehicles"; author="Bohemia Interactive"; url="https://www.arma3.com"; }; - class Item27 + class Item28 { className="A3_Drones_F"; name="Arma 3 Beta - Drones"; @@ -303,26 +311,6 @@ class CustomAttributes class data { singleType="ARRAY"; - class value - { - items=2; - class Item0 - { - class data - { - singleType="STRING"; - value="diwako_dui_linecompass_waypointcolor"; - }; - }; - class Item1 - { - class data - { - singleType="STRING"; - value="diwako_dui_linecompass_acefingeringcolor"; - }; - }; - }; }; }; class Item2 @@ -330,134 +318,6 @@ class CustomAttributes class data { singleType="ARRAY"; - class value - { - items=2; - class Item0 - { - class data - { - singleType="ARRAY"; - class value - { - items=2; - class Item0 - { - class data - { - singleType="ARRAY"; - class value - { - items=4; - class Item0 - { - class data - { - singleType="SCALAR"; - value=0; - }; - }; - class Item1 - { - class data - { - singleType="SCALAR"; - value=0; - }; - }; - class Item2 - { - class data - { - singleType="SCALAR"; - value=0.87; - }; - }; - class Item3 - { - class data - { - singleType="SCALAR"; - value=1; - }; - }; - }; - }; - }; - class Item1 - { - class data - { - singleType="SCALAR"; - value=1; - }; - }; - }; - }; - }; - class Item1 - { - class data - { - singleType="ARRAY"; - class value - { - items=2; - class Item0 - { - class data - { - singleType="ARRAY"; - class value - { - items=4; - class Item0 - { - class data - { - singleType="SCALAR"; - value=0.89999998; - }; - }; - class Item1 - { - class data - { - singleType="SCALAR"; - value=0.66000003; - }; - }; - class Item2 - { - class data - { - singleType="SCALAR"; - value=0; - }; - }; - class Item3 - { - class data - { - singleType="SCALAR"; - value=1; - }; - }; - }; - }; - }; - class Item1 - { - class data - { - singleType="SCALAR"; - value=1; - }; - }; - }; - }; - }; - }; }; }; class Item3 From dfbeffcaff5a685f57bb6b6a6caabbbc77f7c2ba Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 18:56:25 +0100 Subject: [PATCH 11/25] remove unused code in OnDraw Fix Position was wrong from experimenting --- addons/linecompass/functions/fnc_onDraw.sqf | 5 ----- addons/linecompass/script_component.hpp | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index 5e3c252..51f775a 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -156,11 +156,6 @@ private _nextIconMarkerControl = 0; private _player = call CBA_fnc_currentUnit; -private _units = units group _player; -if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType [] }) then { - _units append diwako_dui_special_track; -}; - { _x params ["_unit", "_color", "_icon", "_size"]; diff --git a/addons/linecompass/script_component.hpp b/addons/linecompass/script_component.hpp index a680d75..c7b33cb 100644 --- a/addons/linecompass/script_component.hpp +++ b/addons/linecompass/script_component.hpp @@ -22,7 +22,7 @@ #define POS_X 0.5 - PX(46.25) #define POS_H PY(5) -#define POS_Y safeZoneY - POS_H +#define POS_Y safeZoneY #define POS_W PX(92.5) #define GET_POS_X profileNamespace getVariable ['igui_diwako_dui_linecompass_x', POS_X] From 3478ab3761c612980690af1fd474a26ac3e1cbb7 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 19:19:23 +0100 Subject: [PATCH 12/25] use math to generate the IDCs fix Bearings not getting Drawn --- addons/linecompass/CfgRscTitles.hpp | 306 +++++++++--------- .../linecompass/functions/fnc_cacheLoop.sqf | 3 +- addons/linecompass/functions/fnc_onDraw.sqf | 22 +- addons/linecompass/script_component.hpp | 6 + 4 files changed, 171 insertions(+), 166 deletions(-) diff --git a/addons/linecompass/CfgRscTitles.hpp b/addons/linecompass/CfgRscTitles.hpp index edc1bc5..f65f800 100644 --- a/addons/linecompass/CfgRscTitles.hpp +++ b/addons/linecompass/CfgRscTitles.hpp @@ -1,12 +1,12 @@ -#define LINE(var, idcValue) \ +#define LINE(var) \ class Line##var : Line1 {\ - idc = idcValue;\ + idc = LINE_IDC_START + var - 1;\ x = QUOTE(PX(0.15 + 2.5 * (var - 1)));\ } -#define BEARING(var,textVar,textSize, idcValue) \ +#define BEARING(var,textVar,textSize) \ class Bearing##var : Bearing1 {\ - idc = idcValue;\ + idc = BEARING_IDC_START+ var - 1 ;\ sizeEx = QUOTE(PY(textSize));\ x = QUOTE(PX(-0.25 + 7.5 * (var - 1)));\ text = textVar;\ @@ -22,7 +22,7 @@ class RscTitles { onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(Compass),_this select 0)];); class Controls { class CtrlGroup : RscControlsGroupNoScrollbars { - idc = 7000; + idc = CONTAINER_IDC; x = QUOTE(GET_POS_X); y = QUOTE(GET_POS_Y); w = QUOTE(GET_POS_W); @@ -30,7 +30,7 @@ class RscTitles { class Controls { class Needle : RscPicture { - idc = 7001; + idc = NEEDLE_IDC; text = "\a3\ui_f\data\map\markers\military\triangle_ca.paa"; angle = 180; x = QUOTE(PX(46.25 - 1)); @@ -40,7 +40,7 @@ class RscTitles { colorBackground[] = { "profileNamespace getVariable ['igui_bcg_RGB_R', 0]", "profileNamespace getVariable ['igui_bcg_RGB_G', 0]", "profileNamespace getVariable ['igui_bcg_RGB_B', 0]", 0}; }; class CtrlGroup : RscControlsGroupNoScrollbars { - idc = 7100; + idc = HOLDER_IDC; x = 0; y = 0; w = QUOTE(PX(272.5)); // 360° + 185° @@ -48,7 +48,7 @@ class RscTitles { class Controls { class Line1 : RscPicture { - idc = 7101; + idc = LINE_IDC_START + 1; text = "#(argb,8,8,3)color(1,1,1,1)"; x = QUOTE(PX(0.15)); y = QUOTE(PY(0.6)); @@ -56,116 +56,116 @@ class RscTitles { h = QUOTE(PY(0.3)); colorBackground[] = { "profileNamespace getVariable ['igui_bcg_RGB_R', 0]", "profileNamespace getVariable ['igui_bcg_RGB_G', 0]", "profileNamespace getVariable ['igui_bcg_RGB_B', 0]", 0}; }; - LINE(2,7102); - LINE(3,7103); - LINE(4,7104); - LINE(5,7105); - LINE(6,7106); - LINE(7,7107); - LINE(8,7108); - LINE(9,7109); - LINE(10,7110); - LINE(11,7111); - LINE(12,7112); - LINE(13,7113); - LINE(14,7114); - LINE(15,7115); - LINE(16,7116); - LINE(17,7117); - LINE(18,7118); - LINE(19,7119); - LINE(20,7120); - LINE(21,7121); - LINE(22,7122); - LINE(23,7123); - LINE(24,7124); - LINE(25,7125); - LINE(26,7126); - LINE(27,7127); - LINE(28,7128); - LINE(29,7129); - LINE(30,7130); - LINE(31,7131); - LINE(32,7132); - LINE(33,7133); - LINE(34,7134); - LINE(35,7135); - LINE(36,7136); - LINE(37,7137); - LINE(38,7138); - LINE(39,7139); - LINE(40,7140); - LINE(41,7141); - LINE(42,7142); - LINE(43,7143); - LINE(44,7144); - LINE(45,7145); - LINE(46,7146); - LINE(47,7147); - LINE(48,7148); - LINE(49,7149); - LINE(50,7150); - LINE(51,7151); - LINE(52,7152); - LINE(53,7153); - LINE(54,7154); - LINE(55,7155); - LINE(56,7156); - LINE(57,7157); - LINE(58,7158); - LINE(59,7159); - LINE(60,7160); - LINE(61,7161); - LINE(62,7162); - LINE(63,7163); - LINE(64,7164); - LINE(65,7165); - LINE(66,7166); - LINE(67,7167); - LINE(68,7168); - LINE(69,7169); - LINE(70,7170); - LINE(71,7171); - LINE(72,7172); - LINE(73,7173); - LINE(74,7174); - LINE(75,7175); - LINE(76,7176); - LINE(77,7177); - LINE(78,7178); - LINE(79,7179); - LINE(80,7180); - LINE(81,7181); - LINE(82,7182); - LINE(83,7183); - LINE(84,7184); - LINE(85,7185); - LINE(86,7186); - LINE(87,7187); - LINE(88,7188); - LINE(89,7189); - LINE(90,7190); - LINE(91,7191); - LINE(92,7192); - LINE(93,7193); - LINE(94,7194); - LINE(95,7195); - LINE(96,7196); - LINE(97,7197); - LINE(98,7198); - LINE(99,7199); - LINE(100,7200); - LINE(101,7201); - LINE(102,7202); - LINE(103,7203); - LINE(104,7204); - LINE(105,7205); - LINE(106,7206); - LINE(107,7207); - LINE(108,7208); - LINE(109,7209); + LINE(2); + LINE(3); + LINE(4); + LINE(5); + LINE(6); + LINE(7); + LINE(8); + LINE(9); + LINE(10); + LINE(11); + LINE(12); + LINE(13); + LINE(14); + LINE(15); + LINE(16); + LINE(17); + LINE(18); + LINE(19); + LINE(20); + LINE(21); + LINE(22); + LINE(23); + LINE(24); + LINE(25); + LINE(26); + LINE(27); + LINE(28); + LINE(29); + LINE(30); + LINE(31); + LINE(32); + LINE(33); + LINE(34); + LINE(35); + LINE(36); + LINE(37); + LINE(38); + LINE(39); + LINE(40); + LINE(41); + LINE(42); + LINE(43); + LINE(44); + LINE(45); + LINE(46); + LINE(47); + LINE(48); + LINE(49); + LINE(50); + LINE(51); + LINE(52); + LINE(53); + LINE(54); + LINE(55); + LINE(56); + LINE(57); + LINE(58); + LINE(59); + LINE(60); + LINE(61); + LINE(62); + LINE(63); + LINE(64); + LINE(65); + LINE(66); + LINE(67); + LINE(68); + LINE(69); + LINE(70); + LINE(71); + LINE(72); + LINE(73); + LINE(74); + LINE(75); + LINE(76); + LINE(77); + LINE(78); + LINE(79); + LINE(80); + LINE(81); + LINE(82); + LINE(83); + LINE(84); + LINE(85); + LINE(86); + LINE(87); + LINE(88); + LINE(89); + LINE(90); + LINE(91); + LINE(92); + LINE(93); + LINE(94); + LINE(95); + LINE(96); + LINE(97); + LINE(98); + LINE(99); + LINE(100); + LINE(101); + LINE(102); + LINE(103); + LINE(104); + LINE(105); + LINE(106); + LINE(107); + LINE(108); + LINE(109); class Bearing1 : RscText { - idc = 7301; + idc = BEARING_IDC_START; text = "W"; font = "PuristaMedium"; sizeEx = QUOTE(PY(2.4)); @@ -178,42 +178,42 @@ class RscTitles { w = QUOTE(PX(3)); h = QUOTE(PY(1.5)); }; - BEARING(2,"285",1.8,7302); - BEARING(3,"300",1.8,7303); - BEARING(4,"NW",2.4,7304); - BEARING(5,"330",1.8,7305); - BEARING(6,"345",1.8,7306); - BEARING(7,"N",2.4,7307); - BEARING(8,"015",1.8,7308); - BEARING(9,"030",1.8,7309); - BEARING(10,"NE",2.4,7310); - BEARING(11,"060",1.8,7311); - BEARING(12,"075",1.8,7312); - BEARING(13,"E",2.4,7313); - BEARING(14,"105",1.8,7314); - BEARING(15,"120",1.8,7315); - BEARING(16,"SE",2.4,7316); - BEARING(17,"150",1.8,7317); - BEARING(18,"165",1.8,7318); - BEARING(19,"S",2.4,7319); - BEARING(20,"195",1.8,7320); - BEARING(21,"210",1.8,7321); - BEARING(22,"SW",2.4,7322); - BEARING(23,"240",1.8,7323); - BEARING(24,"255",1.8,7324); - BEARING(25,"W",2.4,7325); - BEARING(26,"285",1.8,7326); - BEARING(27,"300",1.8,7327); - BEARING(28,"NW",2.4,7328); - BEARING(29,"330",1.8,7329); - BEARING(30,"345",1.8,7330); - BEARING(31,"N",2.4,7331); - BEARING(32,"015",1.8,7332); - BEARING(33,"030",1.8,7333); - BEARING(34,"NO",2.4,7334); - BEARING(35,"060",1.8,7335); - BEARING(36,"075",1.8,7336); - BEARING(37,"O",2.4,7337); + BEARING(2,"285",1.8); + BEARING(3,"300",1.8); + BEARING(4,"NW",2.4); + BEARING(5,"330",1.8); + BEARING(6,"345",1.8); + BEARING(7,"N",2.4); + BEARING(8,"015",1.8); + BEARING(9,"030",1.8); + BEARING(10,"NE",2.4); + BEARING(11,"060",1.8); + BEARING(12,"075",1.8); + BEARING(13,"E",2.4); + BEARING(14,"105",1.8); + BEARING(15,"120",1.8); + BEARING(16,"SE",2.4); + BEARING(17,"150",1.8); + BEARING(18,"165",1.8); + BEARING(19,"S",2.4); + BEARING(20,"195",1.8); + BEARING(21,"210",1.8); + BEARING(22,"SW",2.4); + BEARING(23,"240",1.8); + BEARING(24,"255",1.8); + BEARING(25,"W",2.4); + BEARING(26,"285",1.8); + BEARING(27,"300",1.8); + BEARING(28,"NW",2.4); + BEARING(29,"330",1.8); + BEARING(30,"345",1.8); + BEARING(31,"N",2.4); + BEARING(32,"015",1.8); + BEARING(33,"030",1.8); + BEARING(34,"NO",2.4); + BEARING(35,"060",1.8); + BEARING(36,"075",1.8); + BEARING(37,"O",2.4); }; }; }; diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index f3cbb38..936dabb 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -64,7 +64,8 @@ GVAR(RenderData) = _unitsToRender apply { private _dialog = uiNamespace getVariable QGVAR(Compass); if (!isNull _dialog) then { - private _parentControl = _dialog displayCtrl 7000; + + private _parentControl = _dialog displayCtrl CONTAINER_IDC; _parentControl ctrlSetPosition [GET_POS_X, GET_POS_Y, GET_POS_W, GET_POS_H]; _parentControl ctrlCommit 0; }; diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index 51f775a..804ff6e 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -10,9 +10,9 @@ private _viewDirection = ((_viewDirectionVector select 0) atan2 (_viewDirectionV private _currentPosition = getPosVisual player; // Shift the control group to view direction -private _control = _dialog displayCtrl 7100; -_control ctrlSetPosition [PX(_viewDirection * -0.5), PY(1)]; -_control ctrlCommit 0; +private _holderControl = _dialog displayCtrl HOLDER_IDC; +_holderControl ctrlSetPosition [PX(_viewDirection * -0.5), PY(1)]; +_holderControl ctrlCommit 0; // Alpha private _lineAngleOffset = 2.5 - (_viewDirection % 5); @@ -20,7 +20,7 @@ private _lineIndexVisibilityOffset = floor (_viewDirection / 5); for "_i" from 0 to 37 do { private _idc = _i + _lineIndexVisibilityOffset; - private _control = _dialog displayCtrl (7101 + _idc); + private _control = _dialog displayCtrl (LINE_IDC_START + _idc); private _newAlpha = (_i * 5 + _lineAngleOffset) call FUNC(getAlphaFromX); private _oldAlpha = GVAR(lineAlphaCache) select _idc; @@ -35,21 +35,19 @@ private _bearingOffset = 2.5 - (_viewDirection % 15); for "_i" from 0 to 13 do { private _idc = _i + floor (_viewDirection / 15); - private _control = _dialog displayCtrl (7301 + _idc); + private _control = _dialog displayCtrl (BEARING_IDC_START + _idc); private _newAlpha = (_i * 15 + _bearingOffset) call FUNC(getAlphaFromX); private _oldAlpha = GVAR(bearingAlphaCache) select _idc; switch (GVAR(DrawBearing)) do { + case 0: { + _newAlpha = 0; + }; case 1: { private _idcMod = _idc mod 3; if (_idcMod != 0) then { _newAlpha = 0; }; - break; - }; - case 2: { - _newAlpha = 0; - break; }; }; @@ -72,7 +70,7 @@ private _overlapCacheLineIndices = []; private _control = GVAR(lineMarkerControlPool) select _nextLineMarkerControl; if (isNil "_control" || {isNull _control}) then { - _control = _dialog ctrlCreate ["RscPicture", 7401 + _nextLineMarkerControl, _dialog displayCtrl 7100]; + _control = _dialog ctrlCreate ["RscPicture", 7401 + _nextLineMarkerControl, _holderControl]; _control ctrlSetText "#(argb,8,8,3)color(1,1,1,1)"; GVAR(lineMarkerControlPool) set [_nextLineMarkerControl, _control]; }; @@ -167,7 +165,7 @@ private _player = call CBA_fnc_currentUnit; private _control = GVAR(iconMarkerControlPool) select _nextIconMarkerControl; if (isNil "_control" || {isNull _control}) then { - _control = _dialog ctrlCreate ["RscPicture", 7501 + _nextIconMarkerControl, _dialog displayCtrl 7100]; + _control = _dialog ctrlCreate ["RscPicture", 7501 + _nextIconMarkerControl, _holderControl]; GVAR(iconMarkerControlPool) set [_nextIconMarkerControl, _control]; }; diff --git a/addons/linecompass/script_component.hpp b/addons/linecompass/script_component.hpp index c7b33cb..177f071 100644 --- a/addons/linecompass/script_component.hpp +++ b/addons/linecompass/script_component.hpp @@ -29,3 +29,9 @@ #define GET_POS_Y profileNamespace getVariable ['igui_diwako_dui_linecompass_y', POS_Y] #define GET_POS_W profileNamespace getVariable ['igui_diwako_dui_linecompass_w', POS_W] #define GET_POS_H profileNamespace getVariable ['igui_diwako_dui_linecompass_h', POS_H] + +#define LINE_IDC_START 7101 +#define BEARING_IDC_START 7301 +#define CONTAINER_IDC 7000 +#define HOLDER_IDC 7100 +#define NEEDLE_IDC 7001 From 462443ff2cee2b32e2ee7f80bc75e292271ea44c Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Sun, 16 Feb 2025 19:59:33 +0100 Subject: [PATCH 13/25] Add Ability to Swap Order Fix Line1 IDC fix 2 Typos in bearings fix some settings stuff --- addons/linecompass/CfgRscTitles.hpp | 8 ++--- .../linecompass/functions/fnc_cacheLoop.sqf | 33 +++++++++++++++++++ addons/linecompass/functions/fnc_onDraw.sqf | 10 ++++-- addons/linecompass/script_component.hpp | 6 ++-- addons/linecompass/settings.inc.sqf | 16 ++++++--- addons/linecompass/stringtable.xml | 12 +++++++ 6 files changed, 72 insertions(+), 13 deletions(-) diff --git a/addons/linecompass/CfgRscTitles.hpp b/addons/linecompass/CfgRscTitles.hpp index f65f800..dae41f1 100644 --- a/addons/linecompass/CfgRscTitles.hpp +++ b/addons/linecompass/CfgRscTitles.hpp @@ -6,7 +6,7 @@ class Line##var : Line1 {\ #define BEARING(var,textVar,textSize) \ class Bearing##var : Bearing1 {\ - idc = BEARING_IDC_START+ var - 1 ;\ + idc = BEARING_IDC_START + var - 1 ;\ sizeEx = QUOTE(PY(textSize));\ x = QUOTE(PX(-0.25 + 7.5 * (var - 1)));\ text = textVar;\ @@ -48,7 +48,7 @@ class RscTitles { class Controls { class Line1 : RscPicture { - idc = LINE_IDC_START + 1; + idc = LINE_IDC_START; text = "#(argb,8,8,3)color(1,1,1,1)"; x = QUOTE(PX(0.15)); y = QUOTE(PY(0.6)); @@ -210,10 +210,10 @@ class RscTitles { BEARING(31,"N",2.4); BEARING(32,"015",1.8); BEARING(33,"030",1.8); - BEARING(34,"NO",2.4); + BEARING(34,"NE",2.4); BEARING(35,"060",1.8); BEARING(36,"075",1.8); - BEARING(37,"O",2.4); + BEARING(37,"E",2.4); }; }; }; diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index 936dabb..febbe2d 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -68,4 +68,37 @@ if (!isNull _dialog) then { private _parentControl = _dialog displayCtrl CONTAINER_IDC; _parentControl ctrlSetPosition [GET_POS_X, GET_POS_Y, GET_POS_W, GET_POS_H]; _parentControl ctrlCommit 0; + + private _yPos1 = PY(0.6); + private _yPos2 = PY(2); + + for "_i" from 0 to 108 do { + + private _ctrl = _dialog displayCtrl (LINE_IDC_START + _i); + private _pos = ctrlPosition _ctrl; + _pos set [1, [_yPos1, _yPos2] select GVAR(SwapOrder)]; + _ctrl ctrlSetPosition _pos; + _ctrl ctrlCommit 0; + }; + + + _yPos1 = PY(2); + _yPos2 = PY(0.3); + + for "_i" from 0 to 36 do { + + private _ctrl = _dialog displayCtrl (BEARING_IDC_START + _i); + private _pos = ctrlPosition _ctrl; + _pos set [1, [_yPos1, _yPos2] select GVAR(SwapOrder)]; + _ctrl ctrlSetPosition _pos; + _ctrl ctrlCommit 0; + }; + + private _ctrl = _dialog displayCtrl NEEDLE_IDC; + + private _pos = ctrlPosition _ctrl; + _pos set [1, [PY(1.6), PY(3)] select GVAR(SwapOrder)]; + _ctrl ctrlSetPosition _pos; + _ctrl ctrlCommit 0; + }; diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index 804ff6e..57f4f9d 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -136,6 +136,10 @@ if (_nextLineMarkerControl < count GVAR(lineMarkerControlPool)) then { }; }; +private _yPos = [PY(0.6), PY(2)] select GVAR(SwapOrder); +private _hPos = PX(2.2); +private _wPos = PY(0.3); + { if (ctrlShown _x) then { @@ -143,7 +147,7 @@ if (_nextLineMarkerControl < count GVAR(lineMarkerControlPool)) then { private _color = _x getVariable QGVAR(color); private _alpha = (2.5 + ((_lineIndex - floor (_viewDirection / 5)) * 5) - (_viewDirection % 5)) call FUNC(getAlphaFromX); - _x ctrlSetPosition [PX(_lineIndex * 2.5 + 0.15), PY(0.6), PX(2.2), PY(0.3)]; + _x ctrlSetPosition [PX(_lineIndex * 2.5 + 0.15), _yPos, _hPos, _wPos]; _x ctrlSetTextColor [_color select 0, _color select 1, _color select 2, (_color select 3) * _alpha]; _x ctrlCommit 0; }; @@ -154,6 +158,8 @@ private _nextIconMarkerControl = 0; private _player = call CBA_fnc_currentUnit; +private _yOffSet = [PY(0.75), PY(2.15)] select GVAR(SwapOrder); + { _x params ["_unit", "_color", "_icon", "_size"]; @@ -184,7 +190,7 @@ private _player = call CBA_fnc_currentUnit; _color set [3, ((1 - 0.2 * ((_player distance _unit) - (diwako_dui_compassRange - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; _control ctrlSetTextColor _color; - private _positionCenter = [PX(_compassAngle * 0.5) - ((_size select 0) / 2), PY(0.75) - ((_size select 1) / 2)]; + private _positionCenter = [PX(_compassAngle * 0.5) - ((_size select 0) / 2), _yOffSet - ((_size select 1) / 2)]; _positionCenter append _size; _control ctrlSetPosition _positionCenter; diff --git a/addons/linecompass/script_component.hpp b/addons/linecompass/script_component.hpp index 177f071..ea6e2b8 100644 --- a/addons/linecompass/script_component.hpp +++ b/addons/linecompass/script_component.hpp @@ -30,8 +30,8 @@ #define GET_POS_W profileNamespace getVariable ['igui_diwako_dui_linecompass_w', POS_W] #define GET_POS_H profileNamespace getVariable ['igui_diwako_dui_linecompass_h', POS_H] -#define LINE_IDC_START 7101 -#define BEARING_IDC_START 7301 #define CONTAINER_IDC 7000 -#define HOLDER_IDC 7100 #define NEEDLE_IDC 7001 +#define HOLDER_IDC 7100 +#define LINE_IDC_START 7101 +#define BEARING_IDC_START 7301 diff --git a/addons/linecompass/settings.inc.sqf b/addons/linecompass/settings.inc.sqf index 7ccb1dd..2a7d207 100644 --- a/addons/linecompass/settings.inc.sqf +++ b/addons/linecompass/settings.inc.sqf @@ -7,7 +7,7 @@ private _curCat = localize "STR_dui_cat_general"; "CHECKBOX", "STR_dui_linecompass_enabled", [_cat, _curCat], - GVAR(CompassAvailableShown), + false, 0, { params ["_value"]; @@ -21,7 +21,7 @@ private _curCat = localize "STR_dui_cat_general"; "CHECKBOX", "STR_dui_linecompass_compass_required", [_cat, _curCat], - GVAR(CompassAvailableShown), + true, 1, {}, true @@ -32,7 +32,7 @@ private _curCat = localize "STR_dui_cat_general"; "LIST", "STR_dui_linecompass_draw_directions", [_cat, _curCat], - [[0, 1, 2], ["None", "Bearing", "All"], 2] + [[0, 1, 2], ["STR_dui_linecompass_draw_bearings_none", "STR_dui_linecompass_draw_bearings_bearings", "STR_dui_linecompass_draw_bearings_all"], 2] ] call CBA_fnc_addSetting; [ @@ -40,7 +40,7 @@ private _curCat = localize "STR_dui_cat_general"; "LIST", "STR_dui_linecompass_icon_outline", [_cat, _curCat], - [[0, 1, 2], ["None", "Shadow", "Outline"], 0] + [[0, 1, 2], ["STR_dui_namelist_text_shadow_0", "STR_dui_namelist_text_shadow_1", "STR_dui_namelist_text_shadow_2"], 0] ] call CBA_fnc_addSetting; [ @@ -74,3 +74,11 @@ private _curCat = localize "STR_dui_cat_general"; [_cat, _curCat], [1, 0.66, 0, 1] ] call CBA_fnc_addSetting; + +[ + QGVAR(SwapOrder), + "CHECKBOX", + "STR_dui_linecompass_swap_order", + [_cat, _curCat], + false +] call CBA_fnc_addSetting; diff --git a/addons/linecompass/stringtable.xml b/addons/linecompass/stringtable.xml index 9b477ac..e1232b2 100644 --- a/addons/linecompass/stringtable.xml +++ b/addons/linecompass/stringtable.xml @@ -26,6 +26,18 @@ ACE Pointing Color + + None + + + Quarter Bearings + + + All + + + Swap Order + From 5fc008762fde96a65fc707164f39215a1df4e024 Mon Sep 17 00:00:00 2001 From: diwako Date: Mon, 17 Feb 2025 13:27:23 +0100 Subject: [PATCH 14/25] fix getCompass call --- addons/linecompass/functions/fnc_cacheLoop.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index febbe2d..a79b799 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -19,10 +19,10 @@ if (_canShow && GVAR(Enabled)) then { }; if (GVAR(CompassAvailableShown) && {floor(time % 1) == 0}) then { - if (!GVAR(CompassShown) && { call EFUNC(main,getCompass) isNotEqualTo "" }) then { + if (!GVAR(CompassShown) && { [_player] call EFUNC(main,getCompass) isNotEqualTo "" }) then { call FUNC(ShowCompass); } else { - if (GVAR(CompassShown) && { call EFUNC(main,getCompass) isEqualTo "" }) then { + if (GVAR(CompassShown) && { [_player] call EFUNC(main,getCompass) isEqualTo "" }) then { call FUNC(HideCompass); }; }; From a53124451dbd038acb911adc4e0c7ff808ee2043 Mon Sep 17 00:00:00 2001 From: diwako Date: Mon, 17 Feb 2025 13:43:41 +0100 Subject: [PATCH 15/25] adapt string tables, optimize the swap option --- .../linecompass/functions/fnc_cacheLoop.sqf | 12 +++++----- addons/linecompass/settings.inc.sqf | 24 ++++++++++--------- addons/linecompass/stringtable.xml | 17 ++++++++++++- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index a79b799..7001e20 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -69,27 +69,27 @@ if (!isNull _dialog) then { _parentControl ctrlSetPosition [GET_POS_X, GET_POS_Y, GET_POS_W, GET_POS_H]; _parentControl ctrlCommit 0; - private _yPos1 = PY(0.6); - private _yPos2 = PY(2); + private _yPosNum = [0.6, 2] select GVAR(SwapOrder); + private _yPos = PY(_yPosNum); for "_i" from 0 to 108 do { private _ctrl = _dialog displayCtrl (LINE_IDC_START + _i); private _pos = ctrlPosition _ctrl; - _pos set [1, [_yPos1, _yPos2] select GVAR(SwapOrder)]; + _pos set [1, _yPos]; _ctrl ctrlSetPosition _pos; _ctrl ctrlCommit 0; }; - _yPos1 = PY(2); - _yPos2 = PY(0.3); + _yPosNum = [2, 0.3] select GVAR(SwapOrder); + _yPos = PY(_yPosNum); for "_i" from 0 to 36 do { private _ctrl = _dialog displayCtrl (BEARING_IDC_START + _i); private _pos = ctrlPosition _ctrl; - _pos set [1, [_yPos1, _yPos2] select GVAR(SwapOrder)]; + _pos set [1, _yPos]; _ctrl ctrlSetPosition _pos; _ctrl ctrlCommit 0; }; diff --git a/addons/linecompass/settings.inc.sqf b/addons/linecompass/settings.inc.sqf index 2a7d207..87b240a 100644 --- a/addons/linecompass/settings.inc.sqf +++ b/addons/linecompass/settings.inc.sqf @@ -46,7 +46,7 @@ private _curCat = localize "STR_dui_cat_general"; [ QGVAR(DefaultIconColor), "COLOR", - "STR_dui_linecompass_default_icon_color", + ["STR_dui_linecompass_default_icon_color", "STR_dui_linecompass_default_icon_color_desc"], [_cat, _curCat], [0.5, 0.87, 0.5, 1] ] call CBA_fnc_addSetting; @@ -54,7 +54,7 @@ private _curCat = localize "STR_dui_cat_general"; [ QGVAR(WaypointColor), "COLOR", - "STR_dui_linecompass_default_waypoint_color", + ["STR_dui_linecompass_default_waypoint_color", "STR_dui_linecompass_default_waypoint_color_desc"], [_cat, _curCat], [0, 0, 0.87, 1] ] call CBA_fnc_addSetting; @@ -62,23 +62,25 @@ private _curCat = localize "STR_dui_cat_general"; [ QGVAR(CustomWaypointColor), "COLOR", - "STR_dui_linecompass_default_waypoint_color", + ["STR_dui_linecompass_custom_waypoint_color", "STR_dui_linecompass_custom_waypoint_color_desc"], [_cat, _curCat], [0, 0, 0.87, 1] ] call CBA_fnc_addSetting; -[ - QGVAR(ACEFingeringColor), - "COLOR", - "STR_dui_linecompass_ace_fingering_color", - [_cat, _curCat], - [1, 0.66, 0, 1] -] call CBA_fnc_addSetting; +if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { + [ + QGVAR(ACEFingeringColor), + "COLOR", + "STR_dui_linecompass_ace_fingering_color", + [_cat, _curCat], + [1, 0.66, 0, 1] + ] call CBA_fnc_addSetting; +}; [ QGVAR(SwapOrder), "CHECKBOX", - "STR_dui_linecompass_swap_order", + ["STR_dui_linecompass_swap_order", "STR_dui_linecompass_swap_order_desc"], [_cat, _curCat], false ] call CBA_fnc_addSetting; diff --git a/addons/linecompass/stringtable.xml b/addons/linecompass/stringtable.xml index e1232b2..86a0b58 100644 --- a/addons/linecompass/stringtable.xml +++ b/addons/linecompass/stringtable.xml @@ -20,9 +20,21 @@ Default Icon Color + + Default color for icons without fire team assignment + Default Waypoint Color + + Waypoint given by squad leader or mission + + + Custom Waypoint Color + + + Waypoint created when shift+click is on the map is used + ACE Pointing Color @@ -36,7 +48,10 @@ All - Swap Order + Bearing above line + + + When enabled the bearing information, such as cardinal directions, will be displayed above the line of the compass From e5e5b5c27071055fa71557f59d30f0e09901f7cd Mon Sep 17 00:00:00 2001 From: diwako Date: Mon, 17 Feb 2025 13:52:13 +0100 Subject: [PATCH 16/25] up version --- addons/main/script_version.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/main/script_version.hpp b/addons/main/script_version.hpp index 3723c6f..ee26f76 100644 --- a/addons/main/script_version.hpp +++ b/addons/main/script_version.hpp @@ -1,4 +1,4 @@ #define MAJOR 1 -#define MINOR 11 -#define PATCHLVL 1 +#define MINOR 12 +#define PATCHLVL 0 #define BUILD 0 From 7f6d4089001f896768a5c3bfcd0549d732853a8d Mon Sep 17 00:00:00 2001 From: diwako Date: Mon, 17 Feb 2025 16:35:01 +0100 Subject: [PATCH 17/25] update hemtt linting options --- .hemtt/project.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.hemtt/project.toml b/.hemtt/project.toml index 82f6c22..31684e4 100644 --- a/.hemtt/project.toml +++ b/.hemtt/project.toml @@ -34,3 +34,9 @@ folder = "diwako_dui" [lints.stringtables.sorted] options.only-lang = true + +[lints.sqf.var_all_caps] +enabled = true +options.ignore = [ + "ACRE_IS_SPECTATOR" +] \ No newline at end of file From 64f4f5775b6b40a33de2b2f89d9bb8bdee865d7d Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Mon, 17 Feb 2025 18:22:04 +0100 Subject: [PATCH 18/25] Fix Compass Blinking --- addons/linecompass/functions/fnc_cacheLoop.sqf | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index 7001e20..9d8b0d3 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -4,30 +4,20 @@ private _player = call CBA_fnc_currentUnit; -private _canShow = [_player] call EFUNC(main,canHudBeShown); +private _shouldShowCompass = GVAR(Enabled) && { [_player] call EFUNC(main,canHudBeShown) } && { GVAR(CompassAvailableShown) && [_player] call EFUNC(main,getCompass) isNotEqualTo "" }; -if (!_canShow || !GVAR(Enabled)) exitWith { +if (!_shouldShowCompass) exitWith { if (GVAR(CompassShown)) then { call FUNC(HideCompass); }; }; -if (_canShow && GVAR(Enabled)) then { +if (_shouldShowCompass) then { if (!GVAR(CompassShown)) then { call FUNC(ShowCompass); }; }; -if (GVAR(CompassAvailableShown) && {floor(time % 1) == 0}) then { - if (!GVAR(CompassShown) && { [_player] call EFUNC(main,getCompass) isNotEqualTo "" }) then { - call FUNC(ShowCompass); - } else { - if (GVAR(CompassShown) && { [_player] call EFUNC(main,getCompass) isEqualTo "" }) then { - call FUNC(HideCompass); - }; - }; -}; - if (customWaypointPosition isNotEqualTo GVAR(customWaypointPosition)) then { if (customWaypointPosition isEqualTo []) then { "CUSTOM_WAYPOINT_POSITION" call FUNC(removeLineMarker); From ffbb93f95c1eb823d5a63e4f84a8117bd15e60d8 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Mon, 17 Feb 2025 18:22:12 +0100 Subject: [PATCH 19/25] readd Radar as Requirement --- addons/linecompass/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/linecompass/config.cpp b/addons/linecompass/config.cpp index 505694e..b0509b5 100644 --- a/addons/linecompass/config.cpp +++ b/addons/linecompass/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"diwako_dui_main"}; + requiredAddons[] = {"diwako_dui_main", "diwako_dui_radar"}; author = "joko // Jonas"; VERSION_CONFIG; license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike"; From 578434b8ad939ea363094be451c677a5b0fece55 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Mon, 17 Feb 2025 18:22:32 +0100 Subject: [PATCH 20/25] change behavior to when Unit is rendered --- addons/linecompass/functions/fnc_onDraw.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index 57f4f9d..8c175ce 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -164,7 +164,7 @@ private _yOffSet = [PY(0.75), PY(2.15)] select GVAR(SwapOrder); _x params ["_unit", "_color", "_icon", "_size"]; // Check if the unit is not the player himself and alive. - if (alive _unit && _unit != _player && (isNull objectParent _player || {!(_unit in crew objectParent _player)})) then { + if (!isNull _unit) then { private _unitPosition = getPosVisual _unit; private _relativeVectorToUnit = _unitPosition vectorDiff _currentPosition; private _angleToUnit = ((_relativeVectorToUnit select 0) atan2 (_relativeVectorToUnit select 1) + 360) % 360; From acb8bf16e830c27f7dfa02c712c7cdb47255b84f Mon Sep 17 00:00:00 2001 From: diwako Date: Wed, 19 Feb 2025 13:14:48 +0100 Subject: [PATCH 21/25] add stringtable for ui editor --- addons/linecompass/CfgUIGrids.hpp | 4 ++-- addons/linecompass/stringtable.xml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/linecompass/CfgUIGrids.hpp b/addons/linecompass/CfgUIGrids.hpp index e5c6549..397ff53 100644 --- a/addons/linecompass/CfgUIGrids.hpp +++ b/addons/linecompass/CfgUIGrids.hpp @@ -19,8 +19,8 @@ class CfgUIGrids { class Variables { class ADDON { - displayName = "$STR_dui_linecompass_UIGrids_name"; - description = "$STR_dui_linecompass_UIGrids_description"; + displayName = "$STR_dui_addon_linecompass"; + description = "$STR_dui_linecompass_UIGrids_desc"; preview = "#(argb,8,8,3)color(0,0,0,0.75)"; saveToProfile[] = {0,1,2,3}; canResize = 0; diff --git a/addons/linecompass/stringtable.xml b/addons/linecompass/stringtable.xml index 86a0b58..6eba0f8 100644 --- a/addons/linecompass/stringtable.xml +++ b/addons/linecompass/stringtable.xml @@ -53,6 +53,9 @@ When enabled the bearing information, such as cardinal directions, will be displayed above the line of the compass + + Line Compass UI element, drag and drop it to reposition it. You can reset the position in CBA settings if something goes wrong! + From d7d73f97d5d2bf7845fcc34486afe174eebe8a4a Mon Sep 17 00:00:00 2001 From: diwako Date: Wed, 19 Feb 2025 20:55:32 +0100 Subject: [PATCH 22/25] do not render player controlled unit --- addons/linecompass/functions/fnc_cacheLoop.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index 9d8b0d3..50399b1 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -28,7 +28,7 @@ if (customWaypointPosition isNotEqualTo GVAR(customWaypointPosition)) then { }; -private _unitsToRender = units group _player; +private _unitsToRender = units group _player - [_player]; if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType [] }) then { _unitsToRender append diwako_dui_special_track; }; From 1deeb9b8cd35f960253982efacdb52bc93808536 Mon Sep 17 00:00:00 2001 From: diwako Date: Wed, 19 Feb 2025 20:55:53 +0100 Subject: [PATCH 23/25] add ui editor preview --- addons/linecompass/CfgUIGrids.hpp | 2 +- addons/linecompass/UI/line_compass_ui_editor.paa | Bin 0 -> 4762 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 addons/linecompass/UI/line_compass_ui_editor.paa diff --git a/addons/linecompass/CfgUIGrids.hpp b/addons/linecompass/CfgUIGrids.hpp index 397ff53..515df00 100644 --- a/addons/linecompass/CfgUIGrids.hpp +++ b/addons/linecompass/CfgUIGrids.hpp @@ -21,7 +21,7 @@ class CfgUIGrids { class ADDON { displayName = "$STR_dui_addon_linecompass"; description = "$STR_dui_linecompass_UIGrids_desc"; - preview = "#(argb,8,8,3)color(0,0,0,0.75)"; + preview = QPATHTO_T(UI\line_compass_ui_editor.paa); saveToProfile[] = {0,1,2,3}; canResize = 0; }; diff --git a/addons/linecompass/UI/line_compass_ui_editor.paa b/addons/linecompass/UI/line_compass_ui_editor.paa new file mode 100644 index 0000000000000000000000000000000000000000..c8d2074bbf1ea8376c3169be1084b66a0d1d4e4c GIT binary patch literal 4762 zcmc&%4NzNGc0T9*=!ZWEAsOss*AF2`$Y2Ly@Ytz@Bob^$!dM{^#$G`H=QX>t$u5rT zPTYAyGXANZ+Fnq=zXD;`q$yc`n#PpH2w>yRp*=Gb%9hJP}4UYO*zbPT=l}xNiGD zpI)#5HOg0pEIwq5dtDl@7l11%1&TY3PUmF-smeAcYczl+)8$EakT`&Q%mEdxmec6* z+#qb!!~LHJ5b?%ccCiDT6k)sF5@BoGh!X?IveG0QMIUg*^RlH$>mZTJm5aE{20p7S zP@y4mkBR8BMp5y@QJaceCno0brkKTTw5w+0R@>(T*4cTD=J&_q)>Wee*4Vr%3A)>T zCT=b69k8BRX0vk-+hNpfb5>9-#2AL*ie!c2#Mm_YGViwg(0s>kG6@)E1r%7$WdpZ8 zPIOD7ZzR~IrHEg#tqHc8 zZ01K>^D=fA8-_H?{VqsFqu-4>GF+*BlS}POYhEGxrpy~vlOj|!kuQZ zRJ-28j{rmN)>PLQ^*G*{lFUr#W@+hsrodvYySeFM5!socy>$&iquZx7uj-b8+zG?bNpfOP$!bk)Mzvi-xyBUpi#qgjx?In`-o+49=NB_pg&U-5-4;$sDXYJW{MmNn*^Z!qK$VpA?vnVf zka_jdJ(Bc(){m=3b`j&4kw@N3UOfwDVL5Joy1G^|u2^&cJ96y@S4ZkO{}&t_$Xj`k z{|Gq1Su~ctT9e2rkLcjiqqzlhj)|^L$$w}gImNjBG-Z1KH(u!P##W1^^e??0MIwM& za_DA(IAN@oIN>J0J#=DkTb9|@g06FHNn~tY4`UcQuwiV`a@!JC;-9Xztt$ z?S-}_bVIOiNL?&k)K;DwVfmSN&qMw!E*Vl&TdHe)@77(~Sw9x)sMB^DoS)KrFr#PX zadR|46&LIo-WMOwe_YWmKf1&^=V*OMbg=x0Gwoj>3H+V8&QL0Uv+M_NK6C8NZNGDA z)JzJA4;ee;Y=fI}wz{U;lrXPKDn{q&juo3$qZOZhXWXkqC`X@Ur zqQh!4&=a?J*!0>6yJPP)Wnp>rd2VSmm!3X*P|DFp)c;AnPD0slxg}Ln5tN{>4w-CQ zuf?Cco>WqRSus^^kgXi3nE961r03w8#Nx z&8h5ANUHaZFk%_$L<2PGLv}mJ6Ga&9IZ(&YIf!i%mwJbyI8n_(GwDcVF)?UNNa2=} znmeebY=dJ+`Vl#$)DE!-4(nG9{+@|V(lUjd8;h*&+3>q=>^QS5`h7we<#C;*g7PEj zmK>Hs!(q}Vq^vr;JW2a+0ms_ml{s`igEx34EK|A^$srK~YKccevLYcpUknMM-eq*d`dg9 z;}#RfL3-7wNZVxHVwfbP`=yRLRE)pZWv+|Qa6r1ij2m%?J?YDFRP16SIe|58j4`KW zjmeY~T}zdJy!x|v0IOg8ck-TC9UAWXB7jwA&k=C8z3swVEm$Jw77l3tRVc^fhT+?h zO4s&@cva?Lw2CkmNruceYVc64J8}pO-04Fu*GvGR$8x#~Jg@n&!XmBrDn)EsTn(yA zy!Ifc4RP;WaB0}`^73nZ)yw}-w`9O9Y=R{RJ3_x4<7b9*Qigy2&V|3vdVI~A(HNh; z__6vAcFT7(J3S+dk2zV!ZA}vpN6M?3WYwbD)G59({pj(GN5tz*dh0JYZ}v&l8_Y{? z)@*wUO~(5TWLbu2NX^Uzl|N9Eew(omhWO4w8@skZVr-Rd`ha+;$BkhGsQjZg9WFEUkMUcDV} z(yv^!=;Eh*#Xiduf3OI1NuPQ=>!t<5l z>t^^Polj`nKRD`JhuNv@ctUAkJ5@1l`79o7C&e{3l=dNLN#XusL!*C!ClAH8XFuzb zJlU(eI^Al-LU=nTTJ0kddqz~r#bCQ0B>a|Q@G-gl2YGV!q0REtKJqXH@CNXohr&_B zV9?tWr;B@|bO48dQ0nMD9bE);np&<2K4hpM9JY|BAl>{*>1zt>GWl(XYo+SH)g99=Cc=4baCYX(DY~*c#sE z%U>SVagjO0Cn+nKkfqY_!F^YJi_z3=<#!$z*;7<*mZRe>pP(Y8*+pEx-(fcD5wz1{{68bq^dm{0%SKmES_)r-CjN!zzu z7oX&hxf^!<H;wU)O%GIjY&rOrOY>B<$HQHTGOC~R+V=C>uK#%3m#t+- zMy{RVpDW5+6Uq(bRJ*IWSy87Ne*VO{ODQv7Uhw5;dwTZm=6{jhhHRTAklS4A;d(?J z$$}tg$Xgs*wy@;gX^R36^x-kHFAWImPG@JTrFp|VfLbg^^msRZWt zk@ZgwD;mllG76t{!`nn-ua}|}%s3a~Z}N>!^xl=HtiSIKlr8>Bo|&T-@E;6P3Hch0 zvYvy5_?!G5NSfdOkFx#+XASf6-;?pFzkBEY&*k&_UQ^^b(U_3WaS8_1FTj7sXWjGi zmGwia=jY`sIH=jPfDcJM33(~AD^?2+_#3Q3C;lCZS zeZ>FDeJ1fx;!SWO-T>qySQ*Njps%m*JI7t%eBt>OFDm&{073o$6auRUMZX%4=Q}^| zzp>|M#2?RAw(aciApS9#Oh@?2X-mZk3%RHo@Bf27-?Tr>SC&1@Rp)zTeLk!h{wDvs z#!gZL0D)Y4_p2lk3gv5`vEnxPn+C!!lKD!S zCe|ysL{8Ih!R=&yYGwDyPK7_-d5E-~1MBXV5m;YC

ud0*SF;IGO5bN=40hGN-m m(7TK5r(9(J*1PAEGDc|#PVl{6axIFUBv`o?J#wLu$A1CTthZwT literal 0 HcmV?d00001 From 5947a1ac65c0c063448949dfbe87ea42e716c213 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Wed, 19 Feb 2025 23:57:30 +0100 Subject: [PATCH 24/25] Add Occlusion and Speaking it Unit Icons --- .../linecompass/functions/fnc_cacheLoop.sqf | 13 ++++++- addons/linecompass/functions/fnc_onDraw.sqf | 28 +++++++++++--- addons/linecompass/settings.inc.sqf | 37 +++++++++++++++++++ 3 files changed, 71 insertions(+), 7 deletions(-) diff --git a/addons/linecompass/functions/fnc_cacheLoop.sqf b/addons/linecompass/functions/fnc_cacheLoop.sqf index 50399b1..fc58f15 100644 --- a/addons/linecompass/functions/fnc_cacheLoop.sqf +++ b/addons/linecompass/functions/fnc_cacheLoop.sqf @@ -33,6 +33,8 @@ if !(isNil "diwako_dui_special_track" && { diwako_dui_special_track isEqualType _unitsToRender append diwako_dui_special_track; }; +_unitsToRender = _unitsToRender - [objNull]; + GVAR(RenderData) = _unitsToRender apply { ([_x, _player] call FUNC(getUnitIcon)) params [["_icon", "a3\ui_f\data\map\Markers\Military\dot_ca.paa", [""]], ["_size", 2, [0]]]; @@ -43,11 +45,20 @@ GVAR(RenderData) = _unitsToRender apply { _color = +GVAR(DefaultIconColor); }; + if (GVAR(enableOcclusion)) then { + private _vis = [vehicle _x, "VIEW"] checkVisibility [eyePos _player, AGLToASL (_x modelToWorldVisual (_x selectionPosition "Spine2"))]; + + if (_vis isNotEqualTo 0) then { + _x setVariable [QGVAR(lastSeen), time + 0.5]; + }; + }; + [ _x, _color, _icon, - _size + _size, + _x getVariable [QGVAR(lastSeen), time + 0.5] ]; }; diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index 8c175ce..57345fb 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -5,9 +5,11 @@ private _dialog = uiNamespace getVariable QGVAR(Compass); if (isNull _dialog) exitWith {}; -private _viewDirectionVector = (positionCameraToWorld [0, 0, 0]) vectorDiff (positionCameraToWorld [0, 0, -1]); +private _player = call CBA_fnc_currentUnit; + +private _viewDirectionVector = getCameraViewDirection _player; private _viewDirection = ((_viewDirectionVector select 0) atan2 (_viewDirectionVector select 1) + 360) % 360; -private _currentPosition = getPosVisual player; +private _currentPosition = getPosVisual _player; // Shift the control group to view direction private _holderControl = _dialog displayCtrl HOLDER_IDC; @@ -156,12 +158,10 @@ private _wPos = PY(0.3); // Icon marker private _nextIconMarkerControl = 0; -private _player = call CBA_fnc_currentUnit; - private _yOffSet = [PY(0.75), PY(2.15)] select GVAR(SwapOrder); { - _x params ["_unit", "_color", "_icon", "_size"]; + _x params ["_unit", "_color", "_icon", "_size", "_lastSeen"]; // Check if the unit is not the player himself and alive. if (!isNull _unit) then { @@ -185,9 +185,25 @@ private _yOffSet = [PY(0.75), PY(2.15)] select GVAR(SwapOrder); _compassAngle = _compassAngle - 360; }; + + if (GVAR(showSpeaking)) then { + _icon = [ + _icon, + "\A3\modules_f_curator\Data\portraitRadio_ca.paa", + "\A3\ui_f\data\GUI\RscCommon\RscDebugConsole\feedback_ca.paa" + ] select (_unit getVariable [QEGVAR(radar,isSpeaking), 0]) + }; + _control ctrlSetText _icon; - _color set [3, ((1 - 0.2 * ((_player distance _unit) - (diwako_dui_compassRange - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1]; + private _alpha = ((1 - 0.2 * ((_player distance _unit) - (diwako_dui_compassRange - 6))) min 1) * ((_compassAngle - _viewDirection) call FUNC(getAlphaFromX)) min 1; + + if (GVAR(enableOcclusion)) then { + private _lastSeenAlphaMultiplier = (((GVAR(cocclusionFadeSpeed) - (time - _lastSeen)) / GVAR(cocclusionFadeSpeed)) min 1) max 0; + _alpha = _alpha * _lastSeenAlphaMultiplier; + }; + + _color set [3, _alpha]; _control ctrlSetTextColor _color; private _positionCenter = [PX(_compassAngle * 0.5) - ((_size select 0) / 2), _yOffSet - ((_size select 1) / 2)]; diff --git a/addons/linecompass/settings.inc.sqf b/addons/linecompass/settings.inc.sqf index 87b240a..9872c6a 100644 --- a/addons/linecompass/settings.inc.sqf +++ b/addons/linecompass/settings.inc.sqf @@ -84,3 +84,40 @@ if (isClass(configFile >> "CfgPatches" >> "ace_finger")) then { [_cat, _curCat], false ] call CBA_fnc_addSetting; + +[ + QGVAR(enableOcclusion), + "CHECKBOX", + ["STR_dui_linecompass_enable_occlusion", "STR_dui_linecompass_enable_occlusion_desc"], + [_cat, _curCat], + false +] call CBA_fnc_addSetting; + +[ + QGVAR(cocclusionFadeSpeed), + "SLIDER", + ["STR_dui_linecompass_occlusion_fade_speed", "STR_dui_linecompass_occlusion_fade_speed_desc"], + [_cat, _curCat], + [0, 10, 3.5, 1], + false +] call CBA_fnc_addSetting; + +private _tfar = isClass (configFile >> "CfgPatches" >> "task_force_radio"); +private _acre = isClass (configFile >> "CfgPatches" >> "acre_main"); + +if (_acre || _tfar) then { + + [ + QGVAR(showSpeaking), + "CHECKBOX", + [localize "STR_dui_linecompass_show_speaking", localize "STR_dui_linecompass_show_speaking_desc"], + [CBA_SETTINGS_CAT, _curCat], + true, + false + ] call CBA_fnc_addSetting; + +} else { + + GVAR(showSpeaking) = false; + +}; From 16ce2760a128d189dba84ad34a14cc8b5a001424 Mon Sep 17 00:00:00 2001 From: Joko Date: Thu, 20 Feb 2025 19:06:21 +0100 Subject: [PATCH 25/25] Update addons/linecompass/functions/fnc_onDraw.sqf Co-authored-by: diwako --- addons/linecompass/functions/fnc_onDraw.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/linecompass/functions/fnc_onDraw.sqf b/addons/linecompass/functions/fnc_onDraw.sqf index 57345fb..acf2987 100644 --- a/addons/linecompass/functions/fnc_onDraw.sqf +++ b/addons/linecompass/functions/fnc_onDraw.sqf @@ -189,8 +189,8 @@ private _yOffSet = [PY(0.75), PY(2.15)] select GVAR(SwapOrder); if (GVAR(showSpeaking)) then { _icon = [ _icon, - "\A3\modules_f_curator\Data\portraitRadio_ca.paa", - "\A3\ui_f\data\GUI\RscCommon\RscDebugConsole\feedback_ca.paa" + "\A3\ui_f\data\GUI\RscCommon\RscDebugConsole\feedback_ca.paa", + "\A3\modules_f_curator\Data\portraitRadio_ca.paa" ] select (_unit getVariable [QEGVAR(radar,isSpeaking), 0]) };