2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-01-15 09:51:18 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain
|
2015-01-15 09:51:18 +00:00
|
|
|
* Update the map tool markers, position, size, rotation and visibility.
|
|
|
|
*
|
2015-04-07 19:38:35 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: The Map <CONTROL>
|
2015-01-15 09:51:18 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [CONTROL] call ACE_maptools_fnc_updateMapToolMarkers
|
2015-04-07 20:01:44 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-15 09:51:18 +00:00
|
|
|
*/
|
2015-01-15 21:50:48 +00:00
|
|
|
|
2015-08-18 02:51:40 +00:00
|
|
|
params ["_theMap"];
|
2015-01-15 09:51:18 +00:00
|
|
|
|
2018-09-17 19:03:28 +00:00
|
|
|
if ((GVAR(mapTool_Shown) == 0) || {!("ACE_MapTools" in (ACE_player call EFUNC(common,uniqueItems)))}) exitWith {};
|
2015-04-17 23:13:09 +00:00
|
|
|
|
2022-04-06 21:49:27 +00:00
|
|
|
// open map tools in center of screen when toggled to be shown
|
|
|
|
if (GVAR(mapTool_moveToMouse)) then {
|
|
|
|
private _mousePosition = _theMap ctrlMapScreenToWorld getMousePosition;
|
|
|
|
GVAR(mapTool_pos) = _mousePosition;
|
|
|
|
GVAR(mapTool_moveToMouse) = false; // we only need to do this once after opening the map tool
|
|
|
|
};
|
|
|
|
|
2016-06-02 19:36:25 +00:00
|
|
|
private _rotatingTexture = "";
|
|
|
|
private _textureWidth = 0;
|
2015-04-07 19:38:35 +00:00
|
|
|
if (GVAR(mapTool_Shown) == 1) then {
|
2016-04-08 18:34:50 +00:00
|
|
|
_rotatingTexture = QPATHTOF(data\mapToolRotatingNormal.paa);
|
2015-04-07 19:38:35 +00:00
|
|
|
_textureWidth = TEXTURE_WIDTH_IN_M;
|
|
|
|
} else {
|
2016-04-08 18:34:50 +00:00
|
|
|
_rotatingTexture = QPATHTOF(data\mapToolRotatingSmall.paa);
|
2015-04-07 19:38:35 +00:00
|
|
|
_textureWidth = TEXTURE_WIDTH_IN_M / 2;
|
2015-01-15 09:51:18 +00:00
|
|
|
};
|
|
|
|
|
2016-10-07 22:21:19 +00:00
|
|
|
if (GVAR(freedrawing)) then {[_theMap, _textureWidth] call FUNC(drawLinesOnRoamer);};
|
|
|
|
|
2015-01-15 09:51:18 +00:00
|
|
|
// Update scale of both parts
|
2015-09-01 03:50:01 +00:00
|
|
|
getResolution params ["_resWidth", "_resHeight", "", "", "_aspectRatio"];
|
2016-06-02 19:36:25 +00:00
|
|
|
private _scaleX = 32 * _textureWidth * CONSTANT_SCALE * (call FUNC(calculateMapScale));
|
2023-09-05 13:38:38 +00:00
|
|
|
private _scaleY = _scaleX;
|
2015-01-15 09:51:18 +00:00
|
|
|
|
|
|
|
// Position of the fixed part
|
2016-06-02 19:36:25 +00:00
|
|
|
private _xPos = GVAR(mapTool_pos) select 0;
|
|
|
|
private _yPos = (GVAR(mapTool_pos) select 1) + _textureWidth * CENTER_OFFSET_Y_PERC;
|
2015-04-07 19:38:35 +00:00
|
|
|
|
2016-04-08 18:34:50 +00:00
|
|
|
_theMap drawIcon [QPATHTOF(data\mapToolFixed.paa), [1,1,1,1], [_xPos,_yPos], _scaleX, _scaleY, 0, "", 0];
|
2015-01-15 09:51:18 +00:00
|
|
|
|
|
|
|
// Position and rotation of the rotating part
|
2015-01-15 21:50:48 +00:00
|
|
|
_xPos = (GVAR(mapTool_pos) select 0) + sin(GVAR(mapTool_angle)) * _textureWidth * CENTER_OFFSET_Y_PERC;
|
|
|
|
_yPos = (GVAR(mapTool_pos) select 1) + cos(GVAR(mapTool_angle)) * _textureWidth * CENTER_OFFSET_Y_PERC;
|
2015-04-07 19:38:35 +00:00
|
|
|
|
2015-09-01 03:50:01 +00:00
|
|
|
_theMap drawIcon [_rotatingTexture, [1,1,1,1], [_xPos,_yPos], _scaleX, _scaleY, GVAR(mapTool_angle), "", 0];
|