2015-06-29 02:34:21 +00:00
|
|
|
/*
|
|
|
|
Author:
|
|
|
|
voiper
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Orient and set compass.
|
2015-07-04 23:10:01 +00:00
|
|
|
|
2015-06-29 02:34:21 +00:00
|
|
|
Arguments:
|
|
|
|
0: Compass <Display>
|
2015-07-04 23:10:01 +00:00
|
|
|
|
2015-06-29 02:34:21 +00:00
|
|
|
Example:
|
|
|
|
[display] call ace_spectator_fnc_compass;
|
|
|
|
|
|
|
|
Return Value:
|
|
|
|
None
|
2015-07-04 23:10:01 +00:00
|
|
|
|
2015-06-29 02:34:21 +00:00
|
|
|
Public:
|
|
|
|
No
|
2015-07-04 23:10:01 +00:00
|
|
|
*/
|
2015-06-29 02:34:21 +00:00
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
#define ARC_W COMPASS_W / 2
|
|
|
|
#define DEGUNIT COMPASS_W / 180
|
|
|
|
|
2015-07-09 16:30:18 +00:00
|
|
|
PARAMS_1(_dialog);
|
2015-06-29 02:34:21 +00:00
|
|
|
|
2015-07-09 16:30:18 +00:00
|
|
|
_Q1 = _dialog displayCtrl 90;
|
2015-07-15 10:38:33 +00:00
|
|
|
_Q2 = _dialog displayCtrl 180;
|
|
|
|
_Q3 = _dialog displayCtrl 270;
|
|
|
|
_Q4 = _dialog displayCtrl 360;
|
2015-06-29 02:34:21 +00:00
|
|
|
_qOrder = [];
|
|
|
|
|
|
|
|
_dir = if GVAR(cameraOn) then {getDir GVAR(cam)} else {getDir GVAR(unit)};
|
|
|
|
_angleFromCentre = _dir - floor(_dir / 90) * 90;
|
|
|
|
_leftEdgePos = _angleFromCentre * DEGUNIT;
|
|
|
|
|
|
|
|
_positions = [
|
2015-07-09 16:30:18 +00:00
|
|
|
[0.5 - _leftEdgePos - ARC_W, safeZoneY],
|
|
|
|
[0.5 - _leftEdgePos, safeZoneY],
|
|
|
|
[0.5 - _leftEdgePos + ARC_W, safeZoneY],
|
2015-06-29 02:34:21 +00:00
|
|
|
[0, safeZoneY - 1]
|
|
|
|
];
|
|
|
|
|
|
|
|
_qOrder = switch (true) do {
|
|
|
|
case ((_dir >= 0) && (_dir < 90)): {[_Q4, _Q1, _Q2, _Q3]};
|
|
|
|
case ((_dir >= 90) && (_dir < 180)): {[_Q1, _Q2, _Q3, _Q4]};
|
|
|
|
case ((_dir >= 180) && (_dir < 270)): {[_Q2, _Q3, _Q4, _Q1]};
|
|
|
|
case (_dir >= 270): {[_Q3, _Q4, _Q1, _Q2]};
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
|
|
|
_x ctrlSetPosition (_positions select _forEachIndex);
|
|
|
|
_x ctrlCommit 0;
|
2015-07-04 23:10:01 +00:00
|
|
|
} forEach _qOrder;
|