Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fnc_debugDraw.sqf #426

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 65 additions & 25 deletions addons/main/functions/debug/fnc_debugDraw.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,24 @@
};

private _sideUnknownColor = GVAR(debug_sideColorLUT) get sideUnknown;
private _viewDistance = viewDistance;
private _viewDistance = viewDistance min 250;
private _posCam = positionCameraToWorld [0, 0, 0];
{
private _unit = _x;
private _renderPos = getPosATLVisual _unit;
if ((_posCam distance _renderPos) <= _viewDistance) then {
private _isLeader = _unit isEqualTo (leader _unit);
private _sideColor = [side (group _unit), false] call BIS_fnc_sideColor;
if ((_posCam distance _renderPos) <= _viewDistance && {((units _unit - [_unit]) findIf {_x distanceSqr _unit < 1}) isEqualTo -1}) then {
if (!GVAR(debug_drawAllUnitsInVehicles) && {_unit isNotEqualTo (effectiveCommander (vehicle _unit))}) exitWith {};
private _textData = ["<t align='bottom' size='%1'>"];

if (_unit == leader _unit) then {
if (_isLeader) then {
{
private _pos2 = getPosATLVisual _x;
drawLine3D [_renderPos, _pos2, [1, 1, 1, 0.5]];
} forEach (units _unit);
drawLine3D [_renderPos, _pos2, [1, 1, 1, 0.5], 10];
} forEach ((units _unit) select {alive _x});
private _color = GVAR(debug_sideColorLUT) getOrDefault [(side _unit), _sideUnknownColor]; // TODO: replace with new Syntax for setting default for hashMap!
_textData pushBack "<t size='%2' color='" + _color + "'>Group Leader</t><br/>";
_textData pushBack "<t shadow='0' size='%2' font='PuristaBold' color='" + _color + "'>" + groupId (group _unit) + "</t><br/>";
};
_unit getVariable [QGVAR(FSMDangerCauseData), [-1, [0, 0, 0], -1]] params [["_dangerType", -1], ["_pos", [0, 0, 0]], ["_time", -1], ["_currentTarget", objNull]];

Expand All @@ -146,56 +148,77 @@
private _knowledge = _unit targetKnowledge _currentTarget;
private _knowledgePosition = ASLToAGL(_knowledge select 6);
private _knowledgeAge = _knowledge select 2;
if (_knowledgeAge == time && _unitIsLocal) then {
if (_knowledgeAge isEqualTo time && _unitIsLocal) then {
_unit setVariable [QGVAR(debug_LastSeenPos), _knowledgePosition, GVAR(debug_functions)];
};
private _lastSeen = _unit getVariable [QGVAR(debug_LastSeenPos), _knowledgePosition];

// fix when particularly engaging suppressTargets
if (_knowledgePosition distanceSqr [0, 0, 0] < 1) then {
_knowledgePosition = getPosATL _currentTarget;
_lastSeen = getPosATL _currentTarget;
};
_targetKnowledge append [
"<t color='#C7CCC1'>Target Knowledge: <br/>",
" Last Seen: ", _lastSeen, " (", _knowledgeAge toFixed 2, ")<br/>",
" Position Error: ", (_knowledge select 5) toFixed 2, "</t><br/>"
];

drawLine3D [_renderPos, _knowledgePosition, [0, 1, 0, 0.5]];
drawIcon3D ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _knowledgePosition, 1, 1, 0, "Estimated Target Position"];
if ((side _unit) isNotEqualTo (side _currentTarget)) then {
drawLine3D [ASLtoATL (aimPos _unit), _knowledgePosition, _sideColor, 6 * (1 - needReload _unit)];

Check notice on line 168 in addons/main/functions/debug/fnc_debugDraw.sqf

View workflow job for this annotation

GitHub Actions / build

`ASLtoATL` does not match the wiki's case

non-standard command case
drawIcon3D ["\a3\ui_f\data\igui\cfg\targeting\impactpoint_ca.paa", _sideColor, _knowledgePosition, 1, 1, 0, ["Estimated Target Position", ""] select (_knowledgePosition distanceSqr _lastSeen < 1)];

if !(_lastSeen isEqualType "") then {
drawLine3D [_renderPos, _lastSeen, [0, 0, 1, 0.5]];
drawIcon3D ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _lastSeen, 1, 1, 0, "Last Seen Position"];
if !(_lastSeen isEqualType "") then {
private _suppressionFactor = (1 + getSuppression _unit) min 2;
drawLine3D [_knowledgePosition, _lastSeen, _sideColor];
drawIcon3D ["\a3\ui_f\data\igui\cfg\targeting\hitprediction_ca.paa", _sideColor, _lastSeen, _suppressionFactor, _suppressionFactor, 0, ["Last Seen Position", ""] select (_knowledgePosition distanceSqr _lastSeen < 1)];
};
};

} else {
_targetKnowledge pushBack [
"<t color'#FFAA00'>RemoteSensors Disabled<br/>",
"<t color'#FFAA00'>and Unit Not Local<br/>"
];
};
drawLine3D [_renderPos, getPosATLVisual _currentTarget, [1, 0, 0, 1]];
//drawLine3D [_renderPos, getPosATLVisual _currentTarget, [1, 0, 0, 1]]; hide direct target lines to reduce clutter ~ nkenny
[name _currentTarget, "None"] select (isNull _currentTarget);
} else {
if (_currentTarget isEqualType []) then {
drawLine3D [_renderPos, _currentTarget call CBA_fnc_getPos, [1, 0, 0, 1]];
drawLine3D [_renderPos, _currentTarget call CBA_fnc_getPos, _sideColor, 6];
drawIcon3D ["\a3\ui_f\data\igui\cfg\targeting\impactpoint_ca.paa", _sideColor, _currentTarget call CBA_fnc_getPos, 1, 1, 0];
format ["POS %1", _currentTarget];
} else {
format ["N/A"];
}
};
};
_textData append [
"Behaviour: ", behaviour _unit, "<br/>",
" Current Task: ", _unit getVariable [QGVAR(currentTask), "None"], "<br/>"
];
if (_unit == leader _unit) then {
if (_isLeader) then {
private _targetCount = count ((_unit targetsQuery [objNull, sideUnknown, "", [], 0]) select {((side _unit) isNotEqualTo (side (_x select 1))) || ((side (_x select 1)) isEqualTo civilian)});
_textData append [
" Current Tactic: ", group _unit getVariable [QGVAR(currentTactic), "None"], "<br/>",
" Known Enemies: ", _targetCount, "<br/>",
" Group Memory: ", count (group _unit getVariable [QGVAR(groupMemory), []]), "<br/>"
];

{
drawIcon3D [
"\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa",
_sideColor,
_x,
0.7,
0.7,
0,
str (_forEachIndex + 1)
];
} forEach (group _unit getVariable [QGVAR(groupMemory), []]);
};
private _currentCommand = currentCommand _unit;
if (_currentCommand == "") then {_currentCommand = "None";};


_textData append [
"Current Command: ", _currentCommand, "<br/>",
"<t color='#C7CCC1'>Danger Cause: ", _dangerType call FUNC(debugDangerType), "<br/>"
];

Expand All @@ -207,14 +230,19 @@

_textData append [
" Danger Timeout: ", format ["%1s", [(_time - time) toFixed 2, 0] select ((_time - time) < 0)], "</t><br/>",
"Current Target: ", format ["%1 (%2 visiblity)", _name, ([objNull, "VIEW", objNull] checkVisibility [eyePos _unit, _currentTarget call _fnc_getEyePos]) toFixed 1], "<br/>"
"Current Target: ", format ["%1 (%2 visibility)", _name, ([objNull, "VIEW", objNull] checkVisibility [eyePos _unit, _currentTarget call _fnc_getEyePos]) toFixed 1], "<br/>"
];

_textData append _targetKnowledge;
//_textData append _targetKnowledge; ~ Hidden to reduce information overload ~ nkenny

private _currentCommand = currentCommand _unit;
if (_currentCommand == "") then {_currentCommand = "None";};

_textData append [
"Supression: ", getSuppression _unit, "<br/>",
"Morale: ", morale _unit, "<br/>"
"Morale: ", morale _unit, "<br/>",
"Current Command: ", _currentCommand, "<br/>",
"UnitState: ", getUnitState _unit, "<br/>"
];
if !(_unit checkAIFeature "PATH") then {
_textData append ["<t color='#FFAA00'>PATH disabled</t>", "<br/>"];
Expand All @@ -229,7 +257,10 @@
_textData append ["<t color='#FFC0CB'>Fleeing</t>", "<br/>"];
};
if (isHidden _unit) then {
_textData append ["<t color='#1e18d9'>Hidden</t>", "<br/>"];
_textData append ["<t color='#3631de'>Hidden</t>", "<br/>"];
};
if (insideBuilding _unit isEqualTo 1) then {
_textData append ["<t color='#cc18bc'>Inside</t>", "<br/>"];
};
if !(unitReady _unit) then {
_textData append ["<t color='#FFA500'>Busy</t>", "<br/>"];
Expand All @@ -239,8 +270,17 @@
if (GVAR(debug_RenderExpectedDestination)) then {
(expectedDestination _unit) params ["_pos", "_planingMode", "_forceReplan"];
if (_unit distance _pos > _viewDistance) exitWith {};
drawLine3D [_renderPos, _pos, [0, 0, 1, 0.5]];
drawIcon3D ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _pos, 1, 1, 0, format ["%1m: %2%3", floor (_unit distance _pos), _planingMode, ["", " (ForceReplan)"] select _forceReplan]];
drawLine3D [_renderPos, _pos, [1, 1, 1, 1]];
private _iconSize = linearConversion [0, 30, speed _unit, 0.4, 1.2, true];
drawIcon3D [
["\a3\ui_f\data\igui\cfg\simpletasks\types\walk_ca.paa", "\a3\ui_f\data\igui\cfg\simpletasks\types\car_ca.paa"] select (speed _unit > 24),
[1, 1, 1, 1],
_pos,
_iconSize,
_iconSize,
0,
format ["%1m: %2%3", floor (_unit distance _pos), _planingMode, ["", " (ForceReplan)"] select _forceReplan]
];
};
};
} forEach (allUnits select {!(isPlayer _x)});
Expand Down
Loading