2015-01-25 03:56:23 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain
|
2015-01-25 03:56:23 +00:00
|
|
|
* Add line to draw on debug
|
|
|
|
*
|
2015-09-18 06:47:14 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Start point ASL <ARRAY>
|
|
|
|
* 1: End point ASL <ARRAY>
|
|
|
|
* 2: Color <ARRAY>
|
2015-01-25 03:56:23 +00:00
|
|
|
*
|
2016-12-22 19:29:05 +00:00
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2016-12-22 19:29:05 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2017-06-23 03:58:57 +00:00
|
|
|
* [[0,0,0], [1,1,0], [1,0,0,1]] call ace_common_fnc_addLineToDebugDraw;
|
2015-01-25 03:56:23 +00:00
|
|
|
*
|
2015-09-18 06:47:14 +00:00
|
|
|
* Public: No
|
2015-01-25 03:56:23 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-12-22 19:29:05 +00:00
|
|
|
params ["_startASL", "_endASL", "_color"];
|
|
|
|
|
2015-01-25 03:56:23 +00:00
|
|
|
if (isNil QGVAR(debugLines)) then {
|
|
|
|
GVAR(debugLines) = [];
|
|
|
|
GVAR(debugLinesIndex) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (count GVAR(debugLines) < 100) then {
|
2016-12-22 19:29:05 +00:00
|
|
|
GVAR(debugLines) pushBack [ASLtoAGL _startASL, ASLtoAGL _endASL, _color];
|
2015-01-25 03:56:23 +00:00
|
|
|
GVAR(debugLinesIndex) = 0;
|
|
|
|
} else {
|
2016-12-22 19:29:05 +00:00
|
|
|
GVAR(debugLines) set [GVAR(debugLinesIndex), [ASLtoAGL _startASL, ASLtoAGL _endASL, _color]];
|
2015-01-25 03:56:23 +00:00
|
|
|
GVAR(debugLinesIndex) = (GVAR(debugLinesIndex) + 1) mod 100;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (isNil QGVAR(debugDrawHandler)) then {
|
|
|
|
GVAR(debugDrawHandler) = addMissionEventHandler ["Draw3D", {
|
2016-12-22 19:29:05 +00:00
|
|
|
if (GVAR(debugLines) isEqualTo []) exitWith {
|
2015-01-25 04:05:19 +00:00
|
|
|
removeMissionEventHandler ["Draw3D", GVAR(debugDrawHandler)];
|
2015-01-25 03:56:23 +00:00
|
|
|
GVAR(debugDrawHandler) = nil;
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
2016-12-22 19:29:05 +00:00
|
|
|
_x params ["_start", "_end", "_color"];
|
|
|
|
drawLine3D [_start, _end, _color];
|
2015-01-25 03:56:23 +00:00
|
|
|
} forEach GVAR(debugLines);
|
|
|
|
}];
|
2015-09-18 06:47:14 +00:00
|
|
|
};
|