From 784865d634588d1b7e84fbf0b54158e5d09e7c0c Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 15 Jul 2015 13:50:10 +0100 Subject: [PATCH] Clear workspace --- .../functions/fnc_canSpectateUnit.sqf | 22 --- addons/spectator/functions/fnc_checkUnits.sqf | 37 ----- addons/spectator/functions/fnc_compass.sqf | 55 ------ addons/spectator/functions/fnc_crosshair.sqf | 29 ---- addons/spectator/functions/fnc_draw3D.sqf | 34 ---- .../spectator/functions/fnc_drawMines2D.sqf | 43 ----- .../spectator/functions/fnc_drawMines3D.sqf | 55 ------ .../spectator/functions/fnc_drawTracks2D.sqf | 56 ------- .../spectator/functions/fnc_drawUnits2D.sqf | 81 --------- .../spectator/functions/fnc_drawUnits3D.sqf | 97 ----------- addons/spectator/functions/fnc_killed.sqf | 65 -------- addons/spectator/functions/fnc_map.sqf | 156 ------------------ addons/spectator/functions/fnc_overlay.sqf | 106 ------------ addons/spectator/functions/fnc_respawn.sqf | 25 --- addons/spectator/functions/fnc_sideColour.sqf | 66 -------- addons/spectator/functions/fnc_status.sqf | 60 ------- addons/spectator/functions/fnc_trackUnits.sqf | 54 ------ addons/spectator/functions/fnc_unitInfo.sqf | 34 ---- addons/spectator/functions/fnc_unitSide.sqf | 39 ----- addons/spectator/functions/fnc_unitVar.sqf | 38 ----- 20 files changed, 1152 deletions(-) delete mode 100644 addons/spectator/functions/fnc_canSpectateUnit.sqf delete mode 100644 addons/spectator/functions/fnc_checkUnits.sqf delete mode 100644 addons/spectator/functions/fnc_compass.sqf delete mode 100644 addons/spectator/functions/fnc_crosshair.sqf delete mode 100644 addons/spectator/functions/fnc_draw3D.sqf delete mode 100644 addons/spectator/functions/fnc_drawMines2D.sqf delete mode 100644 addons/spectator/functions/fnc_drawMines3D.sqf delete mode 100644 addons/spectator/functions/fnc_drawTracks2D.sqf delete mode 100644 addons/spectator/functions/fnc_drawUnits2D.sqf delete mode 100644 addons/spectator/functions/fnc_drawUnits3D.sqf delete mode 100644 addons/spectator/functions/fnc_killed.sqf delete mode 100644 addons/spectator/functions/fnc_map.sqf delete mode 100644 addons/spectator/functions/fnc_overlay.sqf delete mode 100644 addons/spectator/functions/fnc_respawn.sqf delete mode 100644 addons/spectator/functions/fnc_sideColour.sqf delete mode 100644 addons/spectator/functions/fnc_status.sqf delete mode 100644 addons/spectator/functions/fnc_trackUnits.sqf delete mode 100644 addons/spectator/functions/fnc_unitInfo.sqf delete mode 100644 addons/spectator/functions/fnc_unitSide.sqf delete mode 100644 addons/spectator/functions/fnc_unitVar.sqf diff --git a/addons/spectator/functions/fnc_canSpectateUnit.sqf b/addons/spectator/functions/fnc_canSpectateUnit.sqf deleted file mode 100644 index 93a6bc996b..0000000000 --- a/addons/spectator/functions/fnc_canSpectateUnit.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: SilentSpike - * Check if a unit is suitable to spectate - * - * Arguments: - * 0: Unit to check - * - * Return Value: - * Unit is suitable - * - * Public: No - */ - -#include "script_component.hpp" - -_unit = _this select 0; - -(simulationEnabled _unit) && // Simulation enabled -//{!isObjectHidden _unit} && // Not hidden (currently dev branch only) -{!(_unit getVariable [QGVAR(isSpectator), false])} && // Who watches the watchmen? -{(GVAR(AI) || (isPlayer _unit))} && // Only allow AI when setting is enabled -{!GVAR(limitSide) || (([_unit] call FUNC(unitSide)) == GVAR(cachedSide))} // Only allow units of same side when setting is enabled diff --git a/addons/spectator/functions/fnc_checkUnits.sqf b/addons/spectator/functions/fnc_checkUnits.sqf deleted file mode 100644 index 55935ccefb..0000000000 --- a/addons/spectator/functions/fnc_checkUnits.sqf +++ /dev/null @@ -1,37 +0,0 @@ -/* - Author: - voiper - - Description: - Compile array of units to spectate. - - Arguments: - None. - - Example: - call ace_spectator_fnc_checkUnits; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -_units = allUnits; -_units append allDead; -GVAR(units) = []; - -{ - _listed = _x getVariable [QGVAR(listed), false]; - if (!_listed) then { - [_x] call FUNC(unitVar); - _x addEventHandler ["Killed", {_this call FUNC(killed)}]; - _x addEventHandler ["Respawn", {_this call FUNC(respawn)}]; - _x setVariable [QGVAR(listed), true]; - }; - - if ([_x] call FUNC(canSpectateUnit)) then {GVAR(units) pushback _x}; -} forEach _units; diff --git a/addons/spectator/functions/fnc_compass.sqf b/addons/spectator/functions/fnc_compass.sqf deleted file mode 100644 index 38e3991eec..0000000000 --- a/addons/spectator/functions/fnc_compass.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - Author: - voiper - - Description: - Orient and set compass. - - Arguments: - 0: Compass - - Example: - [display] call ace_spectator_fnc_compass; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -#define ARC_W COMPASS_W / 2 -#define DEGUNIT COMPASS_W / 180 - -PARAMS_1(_dialog); - -_Q1 = _dialog displayCtrl 90; -_Q2 = _dialog displayCtrl 180; -_Q3 = _dialog displayCtrl 270; -_Q4 = _dialog displayCtrl 360; -_qOrder = []; - -_dir = if GVAR(cameraOn) then {getDir GVAR(cam)} else {getDir GVAR(unit)}; -_angleFromCentre = _dir - floor(_dir / 90) * 90; -_leftEdgePos = _angleFromCentre * DEGUNIT; - -_positions = [ - [0.5 - _leftEdgePos - ARC_W, safeZoneY], - [0.5 - _leftEdgePos, safeZoneY], - [0.5 - _leftEdgePos + ARC_W, safeZoneY], - [0, safeZoneY - 1] -]; - -_qOrder = switch (true) do { - case ((_dir >= 0) && (_dir < 90)): {[_Q4, _Q1, _Q2, _Q3]}; - case ((_dir >= 90) && (_dir < 180)): {[_Q1, _Q2, _Q3, _Q4]}; - case ((_dir >= 180) && (_dir < 270)): {[_Q2, _Q3, _Q4, _Q1]}; - case (_dir >= 270): {[_Q3, _Q4, _Q1, _Q2]}; -}; - -{ - _x ctrlSetPosition (_positions select _forEachIndex); - _x ctrlCommit 0; -} forEach _qOrder; diff --git a/addons/spectator/functions/fnc_crosshair.sqf b/addons/spectator/functions/fnc_crosshair.sqf deleted file mode 100644 index 96b2f8e8d8..0000000000 --- a/addons/spectator/functions/fnc_crosshair.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/* - Author: - voiper - - Description: - Automatically set crosshair colour. - - Arguments: - None - - Example: - call ace_spectator_fnc_crosshair; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -_xhair = uiNamespace getVariable QGVAR(crosshair); -if (!isNull _xhair) then { - _colour = if ((GVAR(lock) select 0) > -1) then {[1,0,0,0.8]} else { - if (!isNull GVAR(attach)) then {[1,1,0,0.8]} else {[1,1,1,0.8]}; - }; - (_xhair displayCtrl 0) ctrlSetTextColor _colour; -}; diff --git a/addons/spectator/functions/fnc_draw3D.sqf b/addons/spectator/functions/fnc_draw3D.sqf deleted file mode 100644 index f4504e8487..0000000000 --- a/addons/spectator/functions/fnc_draw3D.sqf +++ /dev/null @@ -1,34 +0,0 @@ -/* - Author: - voiper - - Description: - Draw3D EH for spectator. - - Arguments: - None - - Example: - call ace_spectator_fnc_draw3D; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -_map = uiNameSpace getVariable QGVAR(map); -if (!isNull _map) exitWith {}; - -_compass = uiNamespace getVariable QGVAR(compass); -_status = uiNamespace getVariable QGVAR(status); -if (!isNull _compass) then {[_compass] call FUNC(compass)}; -if (!isNull _status) then {[_status] call FUNC(status)}; - -if (GVAR(markers) > 0) then { - call FUNC(drawMines3D); - call FUNC(drawUnits3D); -}; diff --git a/addons/spectator/functions/fnc_drawMines2D.sqf b/addons/spectator/functions/fnc_drawMines2D.sqf deleted file mode 100644 index 77cfd1c032..0000000000 --- a/addons/spectator/functions/fnc_drawMines2D.sqf +++ /dev/null @@ -1,43 +0,0 @@ -/* - Author: - voiper - - Description: - Draw mines on spectator map. - - Arguments: - 0: Map control - 1: Zoom level - - Example: - [map, zoomlevel] call ace_spectator_fnc_drawMines2D; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -#define SCALE 5 * safeZoneH / 100 -#define MIN 300 * SCALE -#define TEXTURE "\A3\ui_f\data\map\markers\military\triangle_CA.paa" - -_map = _this select 0; -_zoom = _this select 1; - -_size = SCALE / _zoom; -_textSize = ((1/4 * _size) max (SCALE / 2) min (SCALE / 1.5)) / 2; -_iconSize = (20 * _size) max SCALE min MIN; -_showText = (GVAR(markers) > 1); - -{ - _name = ""; - if (_showText) then { - _magName = getText (configFile >> "CfgAmmo" >> (typeOf _x) >> "defaultMagazine"); - _name = getText (configFile >> "CfgMagazines" >> _magName >> "displayName"); - }; - _map drawIcon [TEXTURE, [1,0.5,0,1], getPos _x, _iconSize, _iconSize, getDir _x, _name, 1, _textSize, "PuristaMedium"]; -} forEach allMines; diff --git a/addons/spectator/functions/fnc_drawMines3D.sqf b/addons/spectator/functions/fnc_drawMines3D.sqf deleted file mode 100644 index bcf5d6e5e7..0000000000 --- a/addons/spectator/functions/fnc_drawMines3D.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - Author: - voiper - - Description: - Draw mines in 3D. - - Arguments: - None - - Example: - call ace_spectator_fnc_drawMines3D; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -#define SCALE safeZoneH / 100 -#define TEXTMAX (1.5 * SCALE) -#define TEXTMIN 6 * SCALE -#define ICONMAX (30 * SCALE) -#define ICONMIN (120 * SCALE) -#define TEXTURE "\A3\ui_f\data\map\markers\military\triangle_CA.paa" - -_cam = GVAR(cam); -_showText = (GVAR(markers) > 1); - -{ - _pos = getPos _x; - _dist = (_cam distance _pos) + 0.1; - - if (_dist < 2000) then { - - _distScaled = SCALE / sqrt(_dist); - _iconScale = 300 * _distScaled; - //_iconSize = (20 * _size) max _scale min _min; - _iconSize = _iconScale max ICONMAX min ICONMIN; - _textSize = 0; - - if (_showText) then { - _textScale = 10 * _distScaled; - _textSize = _textScale max TEXTMAX min TEXTMIN; - }; - - _magName = getText (configFile >> "CfgAmmo" >> (typeOf _x) >> "defaultMagazine"); - _name = getText (configFile >> "CfgMagazines" >> _magName >> "displayName"); - - drawIcon3D [TEXTURE, [1,0.5,0,1], _pos, _iconSize, _iconSize, 0, _name, 1, _textSize, "PuristaMedium"]; - }; -} forEach allMines; diff --git a/addons/spectator/functions/fnc_drawTracks2D.sqf b/addons/spectator/functions/fnc_drawTracks2D.sqf deleted file mode 100644 index f5e3695056..0000000000 --- a/addons/spectator/functions/fnc_drawTracks2D.sqf +++ /dev/null @@ -1,56 +0,0 @@ -/* - Author: - voiper - - Description: - Draw unit tracks in spectator map. - - Arguments: - 0: Map control - 1: Zoom level - - Example: - [map, zoomlevel] call ace_spectator_fnc_drawTracks2D; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -_map = _this select 0; -_zoom = _this select 1; - -{ - _unit = _x select 0; - - _info = [_unit] call FUNC(unitInfo); - _colour = _info select 2; - - if (_unit == GVAR(unit)) then {_colour = [1,1,0,_colour select 3]}; - - _positions = _x select 1; - _count = count _positions; - _step = floor (10 * _zoom) min 3 max 1; - _lastIndex = 0; - - if (_count > 1) then { - for "_i" from 0 to (_count - 1) step _step do {; - if (_i > 0 && _i < _count) then { - _pos1 = _positions select _i; - _pos2 = _positions select (_i - _step); - _lastIndex = _i; - _map drawLine [_pos1, _pos2, _colour]; - }; - }; - }; - - //((_count - _step + _count mod _step) max 0) - if (alive _unit) then { - _map drawLine [_positions select _lastIndex, getPosVisual _unit, _colour]; - }; - -} forEach GVAR(trackingArray); diff --git a/addons/spectator/functions/fnc_drawUnits2D.sqf b/addons/spectator/functions/fnc_drawUnits2D.sqf deleted file mode 100644 index d6c1ed59f5..0000000000 --- a/addons/spectator/functions/fnc_drawUnits2D.sqf +++ /dev/null @@ -1,81 +0,0 @@ -/* - Author: - voiper - - Description: - Draw unit icons on spectator map. - - Arguments: - 0: Map control - 1: Zoom level - - Example: - [map, zoomlevel] call ace_spectator_fnc_drawUnits2D; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -#define SCALE 5 * safeZoneH / 100 -#define MIN 300 * SCALE - -_map = _this select 0; -_zoom = _this select 1; - -_topIcon = []; - -_size = SCALE / _zoom; -_showText = (GVAR(markers) > 1); -_textSize = (0.25 * _size) max (SCALE / 2) min (SCALE / 1.5); - -{ - _unit = _x; - _isTarget = (_unit == GVAR(unit)); - - if (true) then { - - _veh = vehicle _unit; - _inVeh = (_veh != _unit); - if (!_isTarget && _inVeh && !(_unit == ((crew _veh) select 0))) exitWith {}; - if (!_isTarget && _inVeh && (GVAR(unit) in (crew _veh))) exitWith {}; - - _obj = if (_inVeh) then {_veh} else {_unit}; - _pos = getPosVisual _obj; - _dir = getDir _obj; - - _info = [_unit] call FUNC(unitInfo); - _name = _info select 0; - _colour = _info select 2; - - _icon = getText (configFile >> "CfgVehicles" >> (typeOf _veh) >> "Icon"); - _iconSize = 0; - _iconText = ""; - - if (_inVeh) then { - _iconSize = (50 * _size) max SCALE min (MIN * 2); - if (_showText) then { - _iconText = "[" + (getText (configFile >> "CfgVehicles" >> (typeOf _veh) >> "displayName")) + "] " + _name; - }; - } else { - _iconSize = (50 * _size) max SCALE min MIN; - if (_showText) then { - _iconText = _name; - }; - }; - - if (_isTarget) exitWith { - _topIcon = [_icon, [1,1,0,1], _pos, _iconSize, _iconSize, _dir, _iconText, 1, _textSize, "PuristaBold", "RIGHT"]; - }; - - _map drawIcon [_icon, _colour, _pos, _iconSize, _iconSize, _dir, _iconText, 1, _textSize, "PuristaMedium", "RIGHT"] - }; -} forEach GVAR(units); - -if (count _topIcon > 0) then { - _map drawIcon _topIcon; -}; diff --git a/addons/spectator/functions/fnc_drawUnits3D.sqf b/addons/spectator/functions/fnc_drawUnits3D.sqf deleted file mode 100644 index 785421e5b2..0000000000 --- a/addons/spectator/functions/fnc_drawUnits3D.sqf +++ /dev/null @@ -1,97 +0,0 @@ -/* - Author: - voiper - - Description: - Draw unit icons in 3D. - - Arguments: - None - - Example: - call ace_spectator_fnc_drawUnits3D; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -#define SCALE safeZoneH / 100 -#define TEXTMAX (1.5 * SCALE) -#define TEXTMIN 6 * SCALE -#define ICONMAX (30 * SCALE) -#define ICONMIN (120 * SCALE) - -_cam = GVAR(cam); -_showText = (GVAR(markers) > 1); -_topIcon = []; - -{ - _unit = _x; - - if (true) then { - _veh = vehicle _unit; - _inVeh = (_veh != _unit); - _cmdr = if (_inVeh && (_unit == ((crew _veh) select 0))) then {true} else {false}; - - _obj = if (_inVeh && _cmdr) then {_veh} else {_unit}; - _pos = if (surfaceIsWater getPos _obj) then {getPosASLVisual _obj} else {getPosATLVisual _obj}; - _dist = (_cam distance _pos) + 0.1; - - _isTarget = (_unit == GVAR(unit)); - - //exit if too far - if (_dist > 2000 && !_isTarget) exitWith {}; - - //exit if target not on screen - if ((count (worldToScreen _pos) < 1) && !_isTarget) exitWith {}; - - _info = [_unit] call FUNC(unitInfo); - _name = _info select 0; - _colour = _info select 2; - - _pos set [2, (_pos select 2) + 3]; - _distScaled = SCALE / sqrt(_dist); - - _icon = ""; - _iconScale = 300 * _distScaled; - _iconSize = _iconScale max ICONMAX min ICONMIN; - - _text = if (_showText) then {_name} else {""}; - _textScale = 10 * _distScaled; - _textSize = _textScale max TEXTMAX min TEXTMIN; - - if (_inVeh) then { - if (_cmdr) then { - _icon = getText (configFile >> "CfgVehicles" >> (typeOf _veh) >> "Icon"); - _text = if (_showText) then { - "[" + (getText (configFile >> "CfgVehicles" >> (typeOf _veh) >> "displayName")) + "] " + _text - } else {""}; - _pos set [2, (_pos select 2) + 3]; - } else { - _iconSize = 0; - _textSize = if (_dist < 25) then {_textSize / 1.5} else {0}; - }; - } else { - _icon = getText (configFile >> "CfgVehicles" >> (typeOf _unit) >> "Icon"); - }; - - if (GVAR(markers) > 2) then { - _text = _text + " [" + str ceil(_dist) + "]"; - }; - - if (_isTarget) exitWith { - _topIcon = [_icon, [1,1,0,1], _pos, _iconSize, _iconSize, 0, _text, 2, _textSize, "PuristaBold", "CENTER", true]; - }; - - drawIcon3D [_icon, _colour, _pos, _iconSize, _iconSize, 0, _text, 2, _textSize, "PuristaMedium"]; - }; -} forEach GVAR(units); - -if ((count _topIcon > 0) && GVAR(cameraOn)) then { - drawIcon3D _topIcon; -}; diff --git a/addons/spectator/functions/fnc_killed.sqf b/addons/spectator/functions/fnc_killed.sqf deleted file mode 100644 index 01bd09fdf4..0000000000 --- a/addons/spectator/functions/fnc_killed.sqf +++ /dev/null @@ -1,65 +0,0 @@ -/* - Author: - voiper - - Description: - Killed EH for remote units. - - Arguments: - 0: Unit - 1: Killer - - Example: - [unit, killer] call ace_spectator_fnc_killed; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -_unit = _this select 0; -_killer = _this select 1; - -if (isNil "_unit") exitWith {}; -if (isNil QGVAR(cam)) exitWith {}; -if (isNull _unit) exitWith {}; - -if (!isNull _killer) then { - if (GVAR(markers) > 2 && !difficultyEnabled "deathMessages") then { - _nameUnit = name _unit; - _nameKiller = name _killer; - - _text = if (_killer == _unit) then { - format ["%1 died", _nameUnit] - } else { - format ["%2 killed by %1", _nameUnit, _nameKiller] - }; - systemChat _text; - }; -}; - -if (_unit == GVAR(unit) && !GVAR(cameraOn)) then { - ["Camera", ["Free"]] call FUNC(camera); - GVAR(unit) = objNull; -}; - -_savedUnit = GVAR(savedUnits) find _unit; -if (_savedUnit > -1) then { - GVAR(savedUnits) set [_savedUnit, objNull]; -}; - -if (!isNil QGVAR(trackingArray)) then { - _pos = getPos _unit; - _pos resize 2; - _index = -1; - {if ((_x select 0) == _unit) then {_index = _forEachIndex}} forEach GVAR(trackingArray); - _unitArray = GVAR(trackingArray) select _index; - _tracks = _unitArray select 1; - _tracks pushBack _pos; - _unitArray set [1, _tracks]; - GVAR(trackingArray) set [_index, _unitArray]; -}; diff --git a/addons/spectator/functions/fnc_map.sqf b/addons/spectator/functions/fnc_map.sqf deleted file mode 100644 index c90bb4f226..0000000000 --- a/addons/spectator/functions/fnc_map.sqf +++ /dev/null @@ -1,156 +0,0 @@ -/* - Author: - voiper - - Description: - Manage spectator map. - - Arguments: - 0: Mode - 1: Elements (depending on situation) - - Example: - ["Init", [map]] call ace_spectator_fnc_map; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" -#include "\a3\editor_f\Data\Scripts\dikCodes.h" - -_mode = _this select 0; -_this = _this select 1; - -switch _mode do { - - case "Init": { - _map = _this displayCtrl 1; - - if (isNil QGVAR(mapPos)) then { - GVAR(mapPos) = (getPosASL GVAR(cam)) select [0,2]; - }; - - if (isNil QGVAR(mapZoom)) then { - GVAR(mapZoom) = 0.75; - }; - - _map ctrlMapAnimAdd [0, GVAR(mapZoom), GVAR(mapPos)]; - ctrlMapAnimCommit _map; - setMousePosition [0.5, 0.5]; - - _map ctrlAddEventHandler ["Draw", {['Draw', _this] call FUNC(map)}]; - _map ctrlAddEventHandler ["MouseButtonDblClick", {['Click', _this] call FUNC(map)}]; - }; - - case "Close": { - _map = _this displayCtrl 1; - GVAR(mapPos) = _map ctrlMapScreenToWorld [0.5,0.5]; - GVAR(mapZoom) = ctrlMapScale _map; - }; - - case "Draw": { - _map = _this select 0; - _zoom = ctrlMapScale _map; - - if (GVAR(markers) > 0) then { - if ((GVAR(markers) > 2) && GVAR(tracking)) then { - [_map, _zoom] call FUNC(drawTracks2D); - }; - [_map, _zoom] call FUNC(drawMines2D); - [_map, _zoom] call FUNC(drawUnits2D); - }; - - if (GVAR(cameraOn)) then { - _scale = 5 * safeZoneH / 100; - _map drawIcon ["\A3\ui_f\data\gui\Rsc\RscDisplayMissionEditor\iconcamera_ca.paa", [1,1,1,1], getPos GVAR(cam), 500 * _scale, 500 * _scale, getDir GVAR(cam), "", 0, 0, "PuristaMedium"]; - }; - }; - - case "Click": { - _map = _this select 0; - _button = _this select 1; - _shift = _this select 4; - _mapPos = _map ctrlMapScreenToWorld [_this select 2, _this select 3]; - - if (_shift) then { - if (GVAR(cameraOn)) then { - _dir = [getPos GVAR(cam), _mapPos] call BIS_fnc_dirTo; - GVAR(vector) set [0, _dir]; - [GVAR(cam), GVAR(vector)] call BIS_fnc_setObjectRotation; - }; - } else { - - _newUnit = objNull; - - _scale = ctrlMapScale _map; - _radius = _scale * 250; - _units = []; - - //find units near spot, ignoring height (necessary since nearestObjects takes height into account) - { - if (alive _x) then { - _pos = getPos _x; - _pos set [2, 0]; - if (_pos distance _mapPos <= _radius) then { - _units pushBack _x; - }; - }; - } forEach GVAR(units); - - //find closest unit to spot - if (count _units > 0) then { - _nearest = 0; - for "_i" from 1 to (count _units - 1) do { - if (((_units select _i) distance _mapPos) < ((_units select _nearest) distance _mapPos)) then { - _nearest = _i; - }; - }; - _newUnit = _units select _nearest; - }; - - if (!isNull _newUnit) then { - - if (vehicle _newUnit != _newUnit) then { - _crew = crew (vehicle _newUnit); - _newUnit = _crew select 0; - }; - - GVAR(unit) = _newUnit; - if (GVAR(cameraOn)) then { - ["Camera", ["Third"]] call FUNC(camera); - } else { - if (GVAR(third)) then { - ["Camera", ["Third"]] call FUNC(camera); - } else { - ["Camera", ["First"]] call FUNC(camera); - }; - }; - } else { - - if (!GVAR(cameraOn)) then { - ["Camera", ["Free"]] call FUNC(camera); - }; - _mapPos set [2, 10]; - GVAR(cam) setPosATL _mapPos; - }; - }; - }; - - case "KeyDown": { - _key = _this select 1; - _shift = _this select 2; - _ctrl = _this select 3; - _alt = _this select 4; - _return = false; - - switch (_key) do { - case (DIK_DELETE): {_return = true}; - }; - - _return - }; -}; diff --git a/addons/spectator/functions/fnc_overlay.sqf b/addons/spectator/functions/fnc_overlay.sqf deleted file mode 100644 index 7c29bf5202..0000000000 --- a/addons/spectator/functions/fnc_overlay.sqf +++ /dev/null @@ -1,106 +0,0 @@ -/* - Author: - voiper - - Description: - Spectator unit list. - - Arguments: - 0: Specific function to use - 1: Function params - - Example: - ["Init", [display]] call ace_spectator_fnc_overlay; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -_mode = _this select 0; -_this = _this select 1; - -switch _mode do { - - case "Init": { - - _display = _this select 0; - _ctrl = _display displayCtrl 0; - _count = _ctrl tvCount []; - for "_i" from 0 to _count do { - _ctrl tvDelete [_x]; - }; - - _ctrl tvAdd [[], "Blufor"]; - _ctrl tvAdd [[], "Opfor"]; - _ctrl tvAdd [[], "Independent"]; - _ctrl tvAdd [[], "Civilian"]; - - _unitList = []; - - { - _units = units _x; - private ["_groupNum"]; - { - if ((GVAR(units) find _x > -1) && alive _x) then { - _info = [_x] call FUNC(unitInfo); - _text = _info select 0; - _team = _info select 1; - _side = switch (_team) do { - case BLUFOR: {0}; - case OPFOR: {1}; - case INDEPENDENT: {2}; - case CIVILIAN: {3}; - }; - - _icon = getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "Icon"); - _picture = "\a3\ui_f\data\map\VehicleIcons\" + _icon + "_ca.paa"; - _treeIndex = []; - _unitList pushBack _x; - - _savedUnit = GVAR(savedUnits) find _x; - if (_savedUnit > -1) then {_text = _text + " (#" + str (_savedUnit + 1) + ")"}; - - if (_forEachIndex == 0) then { - _groupNum = _ctrl tvAdd [[_side], _text]; - _treeIndex = [_side, _groupNum]; - } else { - _num = _ctrl tvAdd [[_side, _groupNum], _text]; - _treeIndex = [_side, _groupNum, _num]; - }; - - _ctrl tvSetPicture [_treeIndex, _picture]; - _ctrl tvSetData [_treeIndex, [_x] call FUNC(unitVar)]; - _unitList pushBack _treeIndex; - }; - } forEach _units; - } forEach allGroups; - - if (!isNull GVAR(unit)) then { - if (alive GVAR(unit)) then { - _treeIndex = _unitList select ((_unitList find GVAR(unit)) + 1); - _ctrl tvSetCurSel _treeIndex; - }; - }; - }; - - case "Select": { - - _ctrl = _this select 0; - _selection = _this select 1; - if (count _selection < 2) exitWith {}; - - _str = _ctrl tvData _selection; - _unit = missionNamespace getVariable _str; - GVAR(unit) = _unit; - if (GVAR(cameraOn)) then { - ["Camera", ["Third"]] call FUNC(camera); - } else { - ["Camera", ["SwitchUnit"]] call FUNC(camera); - }; - }; -}; diff --git a/addons/spectator/functions/fnc_respawn.sqf b/addons/spectator/functions/fnc_respawn.sqf deleted file mode 100644 index f01fef1b3a..0000000000 --- a/addons/spectator/functions/fnc_respawn.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/* - Author: - voiper - - Description: - Respawn EH for remote clients. - - Arguments: - 0: Unit - - Example: - ["Init", [false]] call ace_spectator_fnc_camera; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -_unit = _this select 0; -_unit setVariable [QGVAR(name), name _unit, true]; -//_unit setVariable [QGVAR(listed), false]; diff --git a/addons/spectator/functions/fnc_sideColour.sqf b/addons/spectator/functions/fnc_sideColour.sqf deleted file mode 100644 index 0b4f6a21d7..0000000000 --- a/addons/spectator/functions/fnc_sideColour.sqf +++ /dev/null @@ -1,66 +0,0 @@ -/* - Author: - voiper - - Description: - Determine side colour for spectator GUI. - - Arguments: - 0: Side - - Example: - [0 call ace_spectator_fnc_sideColour; - - Return Value: - Colour - - Public: - No -*/ - -#include "script_component.hpp" -#define FACTOR 1.3 -#define GETCOLOUR(a,b) (profileNameSpace getVariable [QUOTE(a), b]) - -PARAMS_1(_side); - -_colour = switch _side do { - case BLUFOR: { - [ - GETCOLOUR('Map_BLUFOR_R', 0), - GETCOLOUR('Map_BLUFOR_G', 0.3), - GETCOLOUR('Map_BLUFOR_B', 0.6) - ] - }; - - case OPFOR: { - [ - GETCOLOUR('Map_OPFOR_R', 0.5), - GETCOLOUR('Map_OPFOR_G', 0), - GETCOLOUR('Map_OPFOR_B', 0) - ] - }; - - case INDEPENDENT: { - [ - GETCOLOUR('Map_Independent_R', 0), - GETCOLOUR('Map_Independent_G', 0.5), - GETCOLOUR('Map_Independent_B', 0) - ] - }; - - case CIVILIAN: { - [ - GETCOLOUR('Map_Civilian_R', 0.4), - GETCOLOUR('Map_Civilian_G', 0), - GETCOLOUR('Map_Civilian_B', 0.5) - ] - }; -}; - -_colour set [0, (_colour select 0) * FACTOR]; -_colour set [1, (_colour select 1) * FACTOR]; -_colour set [2, (_colour select 2) * FACTOR]; -_colour set [3, 1]; - -_colour diff --git a/addons/spectator/functions/fnc_status.sqf b/addons/spectator/functions/fnc_status.sqf deleted file mode 100644 index 2306b1a64a..0000000000 --- a/addons/spectator/functions/fnc_status.sqf +++ /dev/null @@ -1,60 +0,0 @@ -/* - Author: - voiper - - Description: - Render status. - - Arguments: - 0: Status element - - Example: - [display] call ace_spectator_fnc_status; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -_display = _this select 0; - -_speedText = (str ([GVAR(moveScale), 4] call BIS_fnc_cutDecimals)) + "v"; -(_display displayCtrl 0) ctrlSetText _speedText; - -_name = ""; -_colour = [1,1,1,1]; - -if (!isNull GVAR(unit)) then { - _info = [GVAR(unit)] call FUNC(unitInfo); - _name = _info select 0; - _side = _info select 1; - _colour = _info select 2; - _colour set [3, 1]; -}; -(_display displayCtrl 1) ctrlSetText _name; -(_display displayCtrl 1) ctrlSetTextColor _colour; - -_mode = if (GVAR(cameraOn)) then { - if (isNull GVAR(attach)) then {"FREE"} else {"ATTACH"}; -} else { - if (GVAR(third)) then {"THIRD"} else {"FIRST"}; -}; -(_display displayCtrl 2) ctrlSetText _mode; - -_timeText = [dayTime] call BIS_fnc_timeToString; -(_display displayCtrl 3) ctrlSetText _timeText; - -_fovText = (str ([GVAR(fov), 3] call BIS_fnc_cutDecimals)) + "a"; -(_display displayCtrl 4) ctrlSetText _fovText; - -_timeAccText = (str ([GVAR(accTime), 4] call BIS_fnc_cutDecimals)) + "x"; -(_display displayCtrl 5) ctrlSetText _timeAccText; - -_focusDist = [GVAR(focus) select 0, 1] call BIS_fnc_cutDecimals; -_focusBlur = GVAR(focus) select 1; -_focusText = if (_focusDist == -1 && _focusBlur == 1) then {"Auto"} else {if (_focusDist < 0) then {toString [8734]} else {str _focusDist + "m"}}; -(_display displayCtrl 6) ctrlSetText _focusText; diff --git a/addons/spectator/functions/fnc_trackUnits.sqf b/addons/spectator/functions/fnc_trackUnits.sqf deleted file mode 100644 index a91be880cc..0000000000 --- a/addons/spectator/functions/fnc_trackUnits.sqf +++ /dev/null @@ -1,54 +0,0 @@ -/* - Author: - voiper - - Description: - Check and record tracking for all units. - - Arguments: - None - - Example: - call ace_spectator_fnc_trackUnits; - - Return Value: - None - - Public: - No -*/ - -#include "script_component.hpp" - -if (isNil QGVAR(trackingArray)) then { - GVAR(trackingArray) = []; -}; - -if (count GVAR(units) < 1) exitWith {}; - -{ - _unit = _x; - _pos = getPos _unit; - _pos resize 2; - - _index = -1; - - {if ((_x select 0) == _unit) then {_index = _forEachIndex}} forEach GVAR(trackingArray); - if (_index == -1) then { - GVAR(trackingArray) pushBack [_unit, [_pos]] - } else { - _unitArray = GVAR(trackingArray) select _index; - _trackingArray = _unitArray select 1; - _latestIndex = (count _trackingArray) - 1; - _latestPos = _trackingArray select _latestIndex; - _diffX = abs((_latestPos select 0) - (_pos select 0)); - _diffY = abs((_latestPos select 1) - (_pos select 1)); - - if !((_diffX < 20) && (_diffY < 20)) then { - _trackingArray pushBack _pos; - _unitArray set [1, _trackingArray]; - GVAR(trackingArray) set [_index, _unitArray]; - }; - }; - -} forEach GVAR(units); diff --git a/addons/spectator/functions/fnc_unitInfo.sqf b/addons/spectator/functions/fnc_unitInfo.sqf deleted file mode 100644 index df072d51d5..0000000000 --- a/addons/spectator/functions/fnc_unitInfo.sqf +++ /dev/null @@ -1,34 +0,0 @@ -/* - Author: - voiper - - Description: - Retrieve unit name, side, and colour. - - Arguments: - 0: Unit - - Example: - [player] call ace_spectator_fnc_unitInfo; - - Return Value: - Name , Side , Colour - - Public: - No -*/ - -#include "script_component.hpp" - -PARAMS_1(_unit); - -_name = [_unit] call EFUNC(common,getName); -_side = [_unit] call FUNC(unitSide); -_colour = [_side] call FUNC(sideColour); - -if (!alive _unit) then { - {_colour set [_forEachIndex, _x / 2.5]} forEach _colour; - _colour set [3, 0.8]; -}; - -[_name, _side, _colour] diff --git a/addons/spectator/functions/fnc_unitSide.sqf b/addons/spectator/functions/fnc_unitSide.sqf deleted file mode 100644 index 56ea2c0ce7..0000000000 --- a/addons/spectator/functions/fnc_unitSide.sqf +++ /dev/null @@ -1,39 +0,0 @@ -/* - Author: - voiper - - Description: - Retrieve unit's side, even after they join grpNull. - - Arguments: - 0: Unit to check - - Example: - [unit] call ace_spectator_unitSide; - - Return Value: - Side - - Public: - No -*/ - -#include "script_component.hpp" - -PARAMS_1(_unit); - -private ["_side"]; - -if (alive _unit) then { - _side = side (group _unit); -} else { - _sideNum = getNumber (configFile >> "CfgVehicles" >> (typeOf _unit) >> "side"); - _side = switch _sideNum do { - case 0: {OPFOR}; - case 1: {BLUFOR}; - case 2: {INDEPENDENT}; - case 3: {CIVILIAN}; - }; -}; - -_side diff --git a/addons/spectator/functions/fnc_unitVar.sqf b/addons/spectator/functions/fnc_unitVar.sqf deleted file mode 100644 index b2f332a813..0000000000 --- a/addons/spectator/functions/fnc_unitVar.sqf +++ /dev/null @@ -1,38 +0,0 @@ -/* - Author: Karel Moricky, modified by voiper - - Description: - Set or return an unique object variable (client only). - - Arguments: - 0: Unit - - Returns: - Variable -*/ - -#include "script_component.hpp" - -private ["_object","_var"]; - -_object = [_this, 0, objnull, [objnull]] call BIS_fnc_param; - -if (isNull _object) exitwith {""}; - -_var = _object getVariable [QGVAR(objectVar), ""]; - -if (_var == "") then { - _var = vehicleVarname _object; - - if (_var == "") then { - _var = [_this, 1, QGVAR(obj), [""]] call BIS_fnc_param; - _varID = [_var, 1] call BIS_fnc_counter; - _var = _var + str _varID; - }; - - _object setVariable [QGVAR(objectVar), _var]; - missionNamespace setVariable [_var, _object]; - _object setVehicleVarname _var; -}; - -_var