diff --git a/mod/functions/fn_compass.sqf b/mod/functions/fn_compass.sqf index 350cdd9..d6cfdcf 100644 --- a/mod/functions/fn_compass.sqf +++ b/mod/functions/fn_compass.sqf @@ -54,7 +54,6 @@ diwako_dui_compass_pfHandle = [{ _dirCtrl ctrlSetText ""; }; - private _usedCtrls = []; private _ctrls = _ctrlGrp getVariable ["diwako_dui_ctrlArr",[]]; private _playerDir = getDir _player; @@ -63,12 +62,11 @@ diwako_dui_compass_pfHandle = [{ _usedCtrls pushBack ([_x, _display, _dir, _playerDir, _player, _ctrlGrp] call diwako_dui_fnc_displayUnitOnCompass); } forEach _grp; - private _unusedCtrls = _ctrls - _usedCtrls; { ctrlDelete _x; - } forEach _unusedCtrls; + } forEach (_ctrls - _usedCtrls); - (_display displayCtrl IDC_COMPASS_CTRLGRP) setVariable ["diwako_dui_ctrlArr",_usedCtrls]; + _ctrlGrp setVariable ["diwako_dui_ctrlArr",_usedCtrls]; if !(isNil "diwako_dui_custom_code") then { /* diff --git a/mod/functions/fn_displayUnitOnCompass.sqf b/mod/functions/fn_displayUnitOnCompass.sqf index 24e43f2..701b5f3 100644 --- a/mod/functions/fn_displayUnitOnCompass.sqf +++ b/mod/functions/fn_displayUnitOnCompass.sqf @@ -52,7 +52,7 @@ if (diwako_dui_enable_occlusion && {_fade > 0}) then { }; }; -private _ctrl = _ctrlGrp getVariable [("diwako_dui_ctrl_unit_" + str _unitID), controlNull]; +private _ctrl = _ctrlGrp getVariable [format ["diwako_dui_ctrl_unit_%1", _unitID], controlNull]; if (_fade <= 0) exitWith { if (isNull _ctrl) exitWith {controlNull}; @@ -65,7 +65,7 @@ private _divisor = linearConversion [35,50,_circleRange,2.25,2.75,false] / diwak if (isNull _ctrl) then { _ctrl = _display ctrlCreate ["RscPicture", -1, _ctrlGrp]; - _ctrlGrp setVariable [("diwako_dui_ctrl_unit_" + str _unitID), _ctrl]; + _ctrlGrp setVariable [format ["diwako_dui_ctrl_unit_%1", _unitID], _ctrl]; private _ctrlArr = _ctrlGrp getVariable ["ctrl_diw_ctrlArr", nil]; if (isNil "_ctrlArr") then { @@ -76,19 +76,17 @@ if (isNull _ctrl) then { }; ctrlPosition _ctrlGrp params ["_left", "_top", "_width", "_height"]; -private _center = [_left + _width/2, _top + _height/2]; private _dist = _distance / linearConversion [15,50,_circleRange,40,145,false]; private _iconScale = diwako_dui_compass_icon_scale; private _newWidth = (44 * pixelW) /_divisor * _iconScale; private _newHeight = (44 * pixelH) /_divisor * _iconScale; -private _ctrlPos = [ + +_ctrl ctrlSetPosition [ _width/2 + _width * (sin _relDir * _dist) - _newWidth/2, _height/2 - _height * (cos _relDir * _dist) - _newHeight/2, _newWidth, _newHeight ]; - -_ctrl ctrlSetPosition _ctrlPos; _ctrl ctrlSetAngle [_dir,0.5,0.5,false]; _ctrl ctrlCommit 0;