ACE3/addons/microdagr/functions/fnc_mapOnDrawEH.sqf

68 lines
2.5 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
2015-03-09 15:46:59 +00:00
/*
* Author: PabstMirror
2015-03-11 07:06:07 +00:00
* Handles the draw event from all 3 maps (compass + 2 minimaps)
2015-03-09 15:46:59 +00:00
*
* Arguments:
2015-03-11 07:06:07 +00:00
* 0: The Map <CONTROL>
2015-03-09 15:46:59 +00:00
*
* Return Value:
2015-08-26 03:31:33 +00:00
* None
2015-03-09 15:46:59 +00:00
*
* Example:
2015-03-11 07:06:07 +00:00
* [compassMap] call ace_microdagr_fnc_mapOnDrawEH
2015-03-09 15:46:59 +00:00
*
2015-03-11 07:06:07 +00:00
* Public: No
2015-03-09 15:46:59 +00:00
*/
2015-08-26 03:31:33 +00:00
params ["_theMap"];
private _mapSize = (ctrlPosition _theMap) select 3;
2015-03-09 15:46:59 +00:00
private _waypoints = [] call FUNC(deviceGetWaypoints);
2015-03-09 18:52:15 +00:00
2015-03-09 15:46:59 +00:00
if (GVAR(currentApplicationPage) == 1) then {
_theMap ctrlMapAnimAdd [0, DUMMY_ZOOM, DUMMY_POS];
ctrlMapAnimCommit _theMap;
private _size = 412 * _mapSize;
_theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (([ACE_player] call CBA_fnc_headDir) select 0)), '', 0 ];
2015-03-09 15:46:59 +00:00
_theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [0.533,0.769,0.76,1], DUMMY_POS, _size, _size, 0, '', 0 ];
if (GVAR(currentWaypoint) != -1) then {
private _targetPos = [];
2015-03-09 15:46:59 +00:00
if (GVAR(currentWaypoint) == -2) then {
if ((count GVAR(rangeFinderPositionASL)) == 3) then {
_targetPos = GVAR(rangeFinderPositionASL);
};
} else {
2015-03-09 18:52:15 +00:00
if (GVAR(currentWaypoint) < (count _waypoints)) then {
_targetPos = (_waypoints select GVAR(currentWaypoint)) select 1;
};
2015-03-09 15:46:59 +00:00
};
if ((count _targetPos) == 3) then {
private _relBearing = (ACE_player getDir _targetPos) - (([ACE_player] call CBA_fnc_headDir) select 0);
2015-03-09 15:46:59 +00:00
_theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [1,0.564,0.564,1], DUMMY_POS, _size, _size, _relBearing, '', 0 ];
};
};
} else { //Map Mode:
//Call all added minimap draw event handlers:
{_this call _x;} forEach GVAR(miniMapDrawHandlers);
2015-03-09 15:46:59 +00:00
if (GVAR(mapAutoTrackPosition)) then {
2015-08-26 03:31:33 +00:00
_theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), (getPosASL ACE_player)];
2015-03-09 15:46:59 +00:00
ctrlMapAnimCommit _theMap;
};
private _size = 48 * _mapSize;
_theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ACE_player), _size, _size, (([ACE_player] call CBA_fnc_headDir) select 0), '', 0 ];
2015-03-11 02:48:57 +00:00
if (GVAR(settingShowAllWaypointsOnMap)) then {
2015-03-12 17:31:21 +00:00
_size = 32 * _mapSize;
2015-03-11 02:48:57 +00:00
{
2015-08-26 03:31:33 +00:00
_x params ["_wpName", "_wpPos"];
private _alpha = [0.5, 1] select (_forEachIndex == GVAR(currentWaypoint));
2015-03-11 02:48:57 +00:00
_theMap drawIcon [QUOTE(PATHTO_R(images\icon_mapWaypoints.paa)), [1,1,1,_alpha], _wpPos, _size, _size, 0, '', 0 ];
} forEach _waypoints;
};
2015-03-09 15:46:59 +00:00
};