ACE3/addons/maptools/functions/fnc_updateMapToolMarkers.sqf

49 lines
1.5 KiB
Plaintext
Raw Normal View History

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
*
* Return value:
* Nothing
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
#include "script_component.hpp"
2015-01-15 09:51:18 +00:00
#define TEXTURE_WIDTH_IN_M 6205
#define CENTER_OFFSET_Y_PERC 0.1606
#define CONSTANT_SCALE 0.2
2015-04-07 19:38:35 +00:00
PARAMS_1(_theMap);
2015-01-15 09:51:18 +00:00
2015-04-17 23:13:09 +00:00
private ["_rotatingTexture", "_textureWidth", "_scale", "_xPos", "_yPos"];
2015-01-16 08:13:29 +00:00
if (!("ACE_MapTools" in items ACE_player)|| {GVAR(mapTool_Shown) == 0}) exitWith {};
2015-01-15 09:51:18 +00:00
2015-04-07 19:38:35 +00:00
_rotatingTexture = "";
_textureWidth = 0;
if (GVAR(mapTool_Shown) == 1) then {
_rotatingTexture = QUOTE(PATHTOF(data\mapToolRotatingNormal.paa));
_textureWidth = TEXTURE_WIDTH_IN_M;
} else {
_rotatingTexture = QUOTE(PATHTOF(data\mapToolRotatingSmall.paa));
_textureWidth = TEXTURE_WIDTH_IN_M / 2;
2015-01-15 09:51:18 +00:00
};
// Update scale of both parts
2015-04-07 19:38:35 +00:00
_scale = _textureWidth * CONSTANT_SCALE * (call FUNC(calculateMapScale));
2015-01-15 09:51:18 +00:00
// Position of the fixed part
2015-01-15 21:50:48 +00:00
_xPos = GVAR(mapTool_pos) select 0;
_yPos = (GVAR(mapTool_pos) select 1) + _textureWidth * CENTER_OFFSET_Y_PERC;
2015-04-07 19:38:35 +00:00
_theMap drawIcon [QUOTE(PATHTOF(data\mapToolFixed.paa)), [1,1,1,1], [_xPos,_yPos], (32 * _scale), (32 * _scale), 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
_theMap drawIcon [_rotatingTexture, [1,1,1,1], [_xPos,_yPos], (32 * _scale), (32 * _scale), GVAR(mapTool_angle), "", 0];