2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain
|
2015-01-11 16:42:31 +00:00
|
|
|
* Add the line marker
|
|
|
|
*
|
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>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
|
|
|
* Return value:
|
2015-04-07 20:01:44 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-15 21:50:48 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-01-17 04:07:53 +00:00
|
|
|
_name = _this select 0;
|
|
|
|
_startPos = _this select 1;
|
|
|
|
_difPos = (_this select 2) vectorDiff _startPos ;
|
|
|
|
_color = _this select 3;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_marker = createMarkerLocal [_name, _startPos];
|
|
|
|
_name setMarkerShapeLocal "RECTANGLE";
|
|
|
|
_name setMarkerAlphaLocal 1;
|
|
|
|
_name setMarkerColorLocal _color;
|
|
|
|
_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);
|
2015-01-11 16:42:31 +00:00
|
|
|
} else {
|
2015-04-07 20:01:44 +00:00
|
|
|
_name setMarkerSizeLocal [5, 5];
|
|
|
|
_name setMarkerDirLocal 0;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-01-15 21:50:48 +00:00
|
|
|
GVAR(drawing_lineMarkers) pushBack (+_this);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-15 21:50:48 +00:00
|
|
|
if (isServer && GVAR(drawing_syncMarkers)) then {
|
2015-04-07 20:01:44 +00:00
|
|
|
GVAR(drawing_serverLineMarkers) pushBack (+_this);
|
|
|
|
publicVariable QGVAR(drawing_serverLineMarkers);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|