ACE3/addons/common/functions/fnc_addLineToDebugDraw.sqf

49 lines
1.2 KiB
Plaintext
Raw Normal View History

/*
2015-03-24 04:18:00 +00:00
* Author: esteldunedain
* 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-09-18 06:47:14 +00:00
* None
*
2015-09-18 06:47:14 +00:00
* Public: No
*/
#include "script_component.hpp"
if (isNil QGVAR(debugLines)) then {
GVAR(debugLines) = [];
GVAR(debugLinesIndex) = 0;
};
if (count GVAR(debugLines) < 100) then {
GVAR(debugLines) pushBack _this;
GVAR(debugLinesIndex) = 0;
} else {
GVAR(debugLines) set [GVAR(debugLinesIndex), _this];
GVAR(debugLinesIndex) = (GVAR(debugLinesIndex) + 1) mod 100;
};
if (isNil QGVAR(debugDrawHandler)) then {
GVAR(debugDrawHandler) = addMissionEventHandler ["Draw3D", {
if (count GVAR(debugLines) == 0) exitWith {
2015-01-25 04:05:19 +00:00
removeMissionEventHandler ["Draw3D", GVAR(debugDrawHandler)];
GVAR(debugDrawHandler) = nil;
};
{
_p0 = _x select 0;
if (!surfaceIsWater _p0) then {
_p0 = ASLtoATL _p0;
};
_p1 = _x select 1;
if (!surfaceIsWater _p1) then {
_p1 = ASLtoATL _p1;
};
drawLine3D [_p0, _p1, _x select 2];
} forEach GVAR(debugLines);
}];
2015-09-18 06:47:14 +00:00
};