ACE3/addons/maptools/functions/fnc_addLineMarker.sqf
Nicolás Badano 518010be36 Reordered the map, mapfx and pbos:
- mapfx moved inside map
- everything related to map tools and drawing moved to it's own pbo called ace_maptools

Also fixed a couple of bugs in BFT
- Only a single marker was being drawn
- The BFT_HideAi parameter had the opposite effect
2015-03-14 16:58:05 -03:00

43 lines
1.0 KiB
Plaintext

/*
* Author: CAA-Picard
*
* Add the line marker
*
* Argument:
* 0: Marker Name (string)
* 1: Marker start pos (array)
* 2: Marker end pos (array)
* 3: Color index (Number)
*
* Return value:
* Return
*/
#include "script_component.hpp"
_name = _this select 0;
_startPos = _this select 1;
_difPos = (_this select 2) vectorDiff _startPos ;
_color = _this select 3;
_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 {
_name setMarkerSizeLocal [5, _mag / 2];
_name setMarkerDirLocal (180 + (_difPos select 0) atan2 (_difPos select 1) mod 360);
} else {
_name setMarkerSizeLocal [5, 5];
_name setMarkerDirLocal 0;
};
GVAR(drawing_lineMarkers) pushBack (+_this);
if (isServer && GVAR(drawing_syncMarkers)) then {
GVAR(drawing_serverLineMarkers) pushBack (+_this);
publicVariable QGVAR(drawing_serverLineMarkers);
};