ACE3/addons/maptools/functions/fnc_updateLineMarker.sqf

35 lines
905 B
Plaintext
Raw Normal View History

/*
2015-03-24 04:18:00 +00:00
* Author: esteldunedain
* Updates the line marker position and scale
*
2015-04-07 20:01:44 +00:00
* Arguments:
* 0: Marker Name <STRING>
* 1: Marker start pos <ARRAY>
* 2: Marker end pos <ARRAY>
* 3: Color index <NUMBER>
*
* Return value:
2015-04-07 20:01:44 +00:00
* None
*/
2015-01-15 21:50:48 +00:00
#include "script_component.hpp"
2015-08-18 02:51:40 +00:00
params ["_name", "_startPos", "_endPos", "_color"];
2015-08-18 21:57:56 +00:00
TRACE_4("params",_name,_startPos,_endPos,_color);
2015-04-17 23:13:09 +00:00
private ["_difPos", "_mag"];
_difPos = _endPos vectorDiff _startPos;
2015-03-24 04:18:00 +00:00
_name setMarkerShapeLocal "RECTANGLE";
_name setMarkerAlphaLocal 1;
2015-01-15 21:50:48 +00:00
_name setMarkerColorLocal GVAR(drawing_drawColor);
_name setMarkerPosLocal (_startPos vectorAdd (_difPos vectorMultiply 0.5));
_mag = vectorMagnitude _difPos;
if (_mag > 0) then {
2015-04-07 20:01:44 +00:00
_name setMarkerSizeLocal [5, _mag / 2];
_name setMarkerDirLocal (180 + (_difPos select 0) atan2 (_difPos select 1) mod 360);
} else {
2015-04-07 20:01:44 +00:00
_name setMarkerSizeLocal [5, 5];
_name setMarkerDirLocal 0;
};