ACE3/addons/huntir/functions/fnc_huntirCompass.sqf

90 lines
2.5 KiB
Plaintext
Raw Normal View History

2015-06-06 12:13:34 +00:00
/*
* Author: Norrin, Rocko, Ruthberg
*
* HuntIR monitor compass
*
* Arguments:
2015-08-13 22:02:19 +00:00
* None
2015-06-06 12:13:34 +00:00
*
* Return Value:
2015-08-13 22:02:19 +00:00
* None
2015-06-06 12:13:34 +00:00
*
* Public: No
*/
#include "script_component.hpp"
disableSerialization;
#define __DSP (uiNamespace getVariable "ace_huntir_cam_rose")
#define __CHAR_N (__DSP displayCtrl 64432)
#define __CHAR_E (__DSP displayCtrl 64433)
#define __CHAR_S (__DSP displayCtrl 64434)
#define __CHAR_W (__DSP displayCtrl 64435)
#define __OFFSET_X 0.003
#define __OFFSET_Y 0.003
#define __WIDTH 0.1
#define __HEIGHT 0.1
#define __RADIUS 0.05
#define __CENTER_X 0.70
#define __CENTER_Y 0.65
private ["_fnc_correctIt"];
_fnc_correctIt = {
2015-08-13 22:00:34 +00:00
params ["_pos", "_dir"];
2015-06-06 12:13:34 +00:00
if (_dir >= 270 || {_dir <= 90}) then {
_pos set [1, (_pos select 1) + __OFFSET_Y]
};
if (_dir >= 0 && {_dir <= 180}) then {
_pos set [0, (_pos select 0) - __OFFSET_X]
};
if (_dir >= 90 && {_dir <= 270}) then {
_pos set [1, (_pos select 1) - __OFFSET_Y]
};
if (_dir >= 180 && {_dir <= 360}) then {
_pos set [0, (_pos select 0) + __OFFSET_X]
};
_pos
};
2015-06-07 11:55:35 +00:00
HUNTIR_CAM_ROSE_LAYER_ID cutRsc ["ace_huntir_cam_rose", "PLAIN"];
2015-06-06 12:13:34 +00:00
[{
2015-08-13 22:00:34 +00:00
params ["_args", "_idPFH"];
_args params ["_fnc_correctIt"];
2015-06-06 12:13:34 +00:00
if (GVAR(stop)) exitWith {
2015-06-07 11:55:35 +00:00
HUNTIR_CAM_ROSE_LAYER_ID cutText ["", "PLAIN"];
2015-08-13 22:00:34 +00:00
[_idPFH] call CBA_fnc_removePerFrameHandler;
2015-06-06 12:13:34 +00:00
};
2015-08-13 22:00:34 +00:00
2015-06-06 12:13:34 +00:00
private ["_dir", "_x1", "_y1", "_pos"];
_dir = getDir GVAR(cam); // direction player;
2015-08-13 22:00:34 +00:00
2015-06-06 12:13:34 +00:00
_x1 = __CENTER_X - (__RADIUS * sin(_dir));
_y1 = __CENTER_Y - (__RADIUS * cos(_dir));
_pos = [[_x1, _y1], _dir] call _fnc_correctIt;
__CHAR_N ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT];
__CHAR_N ctrlCommit 0;
_x1 = __CENTER_X - (__RADIUS * sin(_dir + 90));
_y1 = __CENTER_Y - (__RADIUS * cos(_dir + 90));
_pos = [[_x1, _y1], _dir] call _fnc_correctIt;
__CHAR_W ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT];
__CHAR_W ctrlCommit 0;
_x1 = __CENTER_X - (__RADIUS * sin(_dir + 180));
_y1 = __CENTER_Y - (__RADIUS * cos(_dir + 180));
_pos = [[_x1, _y1], _dir] call _fnc_correctIt;
__CHAR_S ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT];
__CHAR_S ctrlCommit 0;
_x1 = __CENTER_X - (__RADIUS * sin(_dir + 270));
_y1 = __CENTER_Y - (__RADIUS * cos(_dir + 270));
_pos = [[_x1, _y1], _dir] call _fnc_correctIt;
__CHAR_E ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT];
__CHAR_E ctrlCommit 0;
2015-08-13 22:00:34 +00:00
2015-06-06 12:13:34 +00:00
}, 0.01, [_fnc_correctIt]] call CBA_fnc_addPerFrameHandler;