Skip to content

Commit f061ea6

Browse files
authored
Update fnc_debugDraw.sqf (#426)
* Update fnc_debugDraw.sqf Enhancements to debug draw banner readability. Added more icons Added show groupMemory positions Added show getUnitState Added colours to many 3D lines Added thicker lines to indicate group membership Removed hid target knowledge to remove clutter Fixed issue when unit is suppressing (has no target knowledge) * Update fnc_debugDraw.sqf Focus: Reduce clutter. Ensure useful information is shown. Added hardcoded 250m distance check to banners (this may have CBA setting next) Added check to prevent multiple banners from being drawn when units stacked Added thickened 'targeting' line Added visualization of current suppressed state Added inside-building flag Added icon change based on movement speed
1 parent 22db03e commit f061ea6

File tree

1 file changed

+65
-25
lines changed

1 file changed

+65
-25
lines changed

addons/main/functions/debug/fnc_debugDraw.sqf

+65-25
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,24 @@ private _fnc_debug_drawRect = {
120120
};
121121

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

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

@@ -146,56 +148,77 @@ private _posCam = positionCameraToWorld [0, 0, 0];
146148
private _knowledge = _unit targetKnowledge _currentTarget;
147149
private _knowledgePosition = ASLToAGL(_knowledge select 6);
148150
private _knowledgeAge = _knowledge select 2;
149-
if (_knowledgeAge == time && _unitIsLocal) then {
151+
if (_knowledgeAge isEqualTo time && _unitIsLocal) then {
150152
_unit setVariable [QGVAR(debug_LastSeenPos), _knowledgePosition, GVAR(debug_functions)];
151153
};
152154
private _lastSeen = _unit getVariable [QGVAR(debug_LastSeenPos), _knowledgePosition];
155+
156+
// fix when particularly engaging suppressTargets
157+
if (_knowledgePosition distanceSqr [0, 0, 0] < 1) then {
158+
_knowledgePosition = getPosATL _currentTarget;
159+
_lastSeen = getPosATL _currentTarget;
160+
};
153161
_targetKnowledge append [
154162
"<t color='#C7CCC1'>Target Knowledge: <br/>",
155163
" Last Seen: ", _lastSeen, " (", _knowledgeAge toFixed 2, ")<br/>",
156164
" Position Error: ", (_knowledge select 5) toFixed 2, "</t><br/>"
157165
];
158166

159-
drawLine3D [_renderPos, _knowledgePosition, [0, 1, 0, 0.5]];
160-
drawIcon3D ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _knowledgePosition, 1, 1, 0, "Estimated Target Position"];
167+
if ((side _unit) isNotEqualTo (side _currentTarget)) then {
168+
drawLine3D [ASLToATL (aimPos _unit), _knowledgePosition, _sideColor, 6 * (1 - needReload _unit)];
169+
drawIcon3D ["\a3\ui_f\data\igui\cfg\targeting\impactpoint_ca.paa", _sideColor, _knowledgePosition, 1, 1, 0, ["Estimated Target Position", ""] select (_knowledgePosition distanceSqr _lastSeen < 1)];
161170

162-
if !(_lastSeen isEqualType "") then {
163-
drawLine3D [_renderPos, _lastSeen, [0, 0, 1, 0.5]];
164-
drawIcon3D ["a3\ui_f\data\Map\Markers\System\dummy_ca.paa", [1, 1, 1, 1], _lastSeen, 1, 1, 0, "Last Seen Position"];
171+
if !(_lastSeen isEqualType "") then {
172+
private _suppressionFactor = (1 + getSuppression _unit) min 2;
173+
drawLine3D [_knowledgePosition, _lastSeen, _sideColor];
174+
drawIcon3D ["\a3\ui_f\data\igui\cfg\targeting\hitprediction_ca.paa", _sideColor, _lastSeen, _suppressionFactor, _suppressionFactor, 0, ["Last Seen Position", ""] select (_knowledgePosition distanceSqr _lastSeen < 1)];
175+
};
165176
};
177+
166178
} else {
167179
_targetKnowledge pushBack [
168180
"<t color'#FFAA00'>RemoteSensors Disabled<br/>",
169181
"<t color'#FFAA00'>and Unit Not Local<br/>"
170182
];
171183
};
172-
drawLine3D [_renderPos, getPosATLVisual _currentTarget, [1, 0, 0, 1]];
184+
//drawLine3D [_renderPos, getPosATLVisual _currentTarget, [1, 0, 0, 1]]; hide direct target lines to reduce clutter ~ nkenny
173185
[name _currentTarget, "None"] select (isNull _currentTarget);
174186
} else {
175187
if (_currentTarget isEqualType []) then {
176-
drawLine3D [_renderPos, _currentTarget call CBA_fnc_getPos, [1, 0, 0, 1]];
188+
drawLine3D [_renderPos, _currentTarget call CBA_fnc_getPos, _sideColor, 6];
189+
drawIcon3D ["\a3\ui_f\data\igui\cfg\targeting\impactpoint_ca.paa", _sideColor, _currentTarget call CBA_fnc_getPos, 1, 1, 0];
177190
format ["POS %1", _currentTarget];
178191
} else {
179192
format ["N/A"];
180-
}
193+
};
181194
};
182195
_textData append [
183196
"Behaviour: ", behaviour _unit, "<br/>",
184197
" Current Task: ", _unit getVariable [QGVAR(currentTask), "None"], "<br/>"
185198
];
186-
if (_unit == leader _unit) then {
199+
if (_isLeader) then {
187200
private _targetCount = count ((_unit targetsQuery [objNull, sideUnknown, "", [], 0]) select {((side _unit) isNotEqualTo (side (_x select 1))) || ((side (_x select 1)) isEqualTo civilian)});
188201
_textData append [
189202
" Current Tactic: ", group _unit getVariable [QGVAR(currentTactic), "None"], "<br/>",
190203
" Known Enemies: ", _targetCount, "<br/>",
191204
" Group Memory: ", count (group _unit getVariable [QGVAR(groupMemory), []]), "<br/>"
192205
];
206+
207+
{
208+
drawIcon3D [
209+
"\a3\ui_f\data\igui\cfg\simpletasks\types\move_ca.paa",
210+
_sideColor,
211+
_x,
212+
0.7,
213+
0.7,
214+
0,
215+
str (_forEachIndex + 1)
216+
];
217+
} forEach (group _unit getVariable [QGVAR(groupMemory), []]);
193218
};
194-
private _currentCommand = currentCommand _unit;
195-
if (_currentCommand == "") then {_currentCommand = "None";};
219+
196220

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

@@ -207,14 +230,19 @@ private _posCam = positionCameraToWorld [0, 0, 0];
207230

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

213-
_textData append _targetKnowledge;
236+
//_textData append _targetKnowledge; ~ Hidden to reduce information overload ~ nkenny
237+
238+
private _currentCommand = currentCommand _unit;
239+
if (_currentCommand == "") then {_currentCommand = "None";};
214240

215241
_textData append [
216242
"Supression: ", getSuppression _unit, "<br/>",
217-
"Morale: ", morale _unit, "<br/>"
243+
"Morale: ", morale _unit, "<br/>",
244+
"Current Command: ", _currentCommand, "<br/>",
245+
"UnitState: ", getUnitState _unit, "<br/>"
218246
];
219247
if !(_unit checkAIFeature "PATH") then {
220248
_textData append ["<t color='#FFAA00'>PATH disabled</t>", "<br/>"];
@@ -229,7 +257,10 @@ private _posCam = positionCameraToWorld [0, 0, 0];
229257
_textData append ["<t color='#FFC0CB'>Fleeing</t>", "<br/>"];
230258
};
231259
if (isHidden _unit) then {
232-
_textData append ["<t color='#1e18d9'>Hidden</t>", "<br/>"];
260+
_textData append ["<t color='#3631de'>Hidden</t>", "<br/>"];
261+
};
262+
if (insideBuilding _unit isEqualTo 1) then {
263+
_textData append ["<t color='#cc18bc'>Inside</t>", "<br/>"];
233264
};
234265
if !(unitReady _unit) then {
235266
_textData append ["<t color='#FFA500'>Busy</t>", "<br/>"];
@@ -239,8 +270,17 @@ private _posCam = positionCameraToWorld [0, 0, 0];
239270
if (GVAR(debug_RenderExpectedDestination)) then {
240271
(expectedDestination _unit) params ["_pos", "_planingMode", "_forceReplan"];
241272
if (_unit distance _pos > _viewDistance) exitWith {};
242-
drawLine3D [_renderPos, _pos, [0, 0, 1, 0.5]];
243-
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]];
273+
drawLine3D [_renderPos, _pos, [1, 1, 1, 1]];
274+
private _iconSize = linearConversion [0, 30, speed _unit, 0.4, 1.2, true];
275+
drawIcon3D [
276+
["\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),
277+
[1, 1, 1, 1],
278+
_pos,
279+
_iconSize,
280+
_iconSize,
281+
0,
282+
format ["%1m: %2%3", floor (_unit distance _pos), _planingMode, ["", " (ForceReplan)"] select _forceReplan]
283+
];
244284
};
245285
};
246286
} forEach (allUnits select {!(isPlayer _x)});

0 commit comments

Comments
 (0)