Clear workspace

This commit is contained in:
SilentSpike 2015-07-15 13:50:10 +01:00
parent 5dc4dbeb88
commit 784865d634
20 changed files with 0 additions and 1152 deletions

View File

@ -1,22 +0,0 @@
/*
* Author: SilentSpike
* Check if a unit is suitable to spectate
*
* Arguments:
* 0: Unit to check <Object>
*
* Return Value:
* Unit is suitable <BOOL>
*
* 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

View File

@ -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;

View File

@ -1,55 +0,0 @@
/*
Author:
voiper
Description:
Orient and set compass.
Arguments:
0: Compass <Display>
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;

View File

@ -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;
};

View File

@ -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);
};

View File

@ -1,43 +0,0 @@
/*
Author:
voiper
Description:
Draw mines on spectator map.
Arguments:
0: Map control <Control>
1: Zoom level <Scalar>
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;

View File

@ -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;

View File

@ -1,56 +0,0 @@
/*
Author:
voiper
Description:
Draw unit tracks in spectator map.
Arguments:
0: Map control <Control>
1: Zoom level <Scalar>
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);

View File

@ -1,81 +0,0 @@
/*
Author:
voiper
Description:
Draw unit icons on spectator map.
Arguments:
0: Map control <Control>
1: Zoom level <Scalar>
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;
};

View File

@ -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;
};

View File

@ -1,65 +0,0 @@
/*
Author:
voiper
Description:
Killed EH for remote units.
Arguments:
0: Unit <Object>
1: Killer <Object>
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];
};

View File

@ -1,156 +0,0 @@
/*
Author:
voiper
Description:
Manage spectator map.
Arguments:
0: Mode <String>
1: Elements (depending on situation) <Array>
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
};
};

View File

@ -1,106 +0,0 @@
/*
Author:
voiper
Description:
Spectator unit list.
Arguments:
0: Specific function to use <String>
1: Function params <Array>
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);
};
};
};

View File

@ -1,25 +0,0 @@
/*
Author:
voiper
Description:
Respawn EH for remote clients.
Arguments:
0: Unit <Object>
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];

View File

@ -1,66 +0,0 @@
/*
Author:
voiper
Description:
Determine side colour for spectator GUI.
Arguments:
0: Side <Scalar>
Example:
[0 call ace_spectator_fnc_sideColour;
Return Value:
Colour <Array>
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

View File

@ -1,60 +0,0 @@
/*
Author:
voiper
Description:
Render status.
Arguments:
0: Status element <Display>
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;

View File

@ -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);

View File

@ -1,34 +0,0 @@
/*
Author:
voiper
Description:
Retrieve unit name, side, and colour.
Arguments:
0: Unit <Object>
Example:
[player] call ace_spectator_fnc_unitInfo;
Return Value:
Name <String>, Side <Scalar>, Colour <Array>
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]

View File

@ -1,39 +0,0 @@
/*
Author:
voiper
Description:
Retrieve unit's side, even after they join grpNull.
Arguments:
0: Unit to check <Object>
Example:
[unit] call ace_spectator_unitSide;
Return Value:
Side <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

View File

@ -1,38 +0,0 @@
/*
Author: Karel Moricky, modified by voiper
Description:
Set or return an unique object variable (client only).
Arguments:
0: Unit <Object>
Returns:
Variable <String>
*/
#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