2017-06-08 13:31:51 +00:00
|
|
|
/*
|
2015-06-07 15:53:37 +00:00
|
|
|
* Author: Rosuto
|
|
|
|
* DAGR vector output loop
|
|
|
|
*
|
|
|
|
* Arguments:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2015-06-07 15:53:37 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2015-06-07 15:53:37 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2017-06-08 13:31:51 +00:00
|
|
|
* call ace_dagr_fnc_outputVector
|
2015-06-07 15:53:37 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2017-06-08 13:31:51 +00:00
|
|
|
|
2015-06-07 15:53:37 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
|
2015-06-08 10:57:16 +00:00
|
|
|
|
|
|
|
#define __display (uiNameSpace getVariable "DAGR_DISPLAY")
|
|
|
|
|
|
|
|
#define __gridControl (__display displayCtrl 266851)
|
|
|
|
#define __speedControl (__display displayCtrl 266858)
|
|
|
|
#define __elevationControl (__display displayCtrl 266853)
|
|
|
|
#define __headingControl (__display displayCtrl 266854)
|
|
|
|
#define __timeControl (__display displayCtrl 266855)
|
|
|
|
#define __background (__display displayCtrl 266856)
|
|
|
|
|
2016-04-08 18:34:50 +00:00
|
|
|
__background ctrlSetText QPATHTOF(UI\dagr_vector.paa);
|
2015-06-08 10:57:16 +00:00
|
|
|
|
2015-11-30 16:14:05 +00:00
|
|
|
if (GVAR(noVectorData)) exitWith {};
|
2015-08-09 00:33:00 +00:00
|
|
|
GVAR(LAZPOS) params ["_lazPosX", "_lazPosY", "_lazPosZ"];
|
2015-06-08 12:32:42 +00:00
|
|
|
|
|
|
|
// Incase grids go neg due to 99-00 boundry
|
2015-08-09 00:33:00 +00:00
|
|
|
if (_lazPosX < 0) then { _lazPosX = _lazPosX + 99999;};
|
|
|
|
if (_lazPosY < 0) then {_lazPosY = _lazPosY + 99999;};
|
|
|
|
|
2015-06-08 10:57:16 +00:00
|
|
|
// Find laser position
|
2017-10-10 14:39:59 +00:00
|
|
|
private _xGrid = toArray Str(round _lazPosX);
|
2015-06-08 12:32:42 +00:00
|
|
|
|
2015-06-08 10:57:16 +00:00
|
|
|
while {count _xGrid < 5} do {
|
|
|
|
_xGrid = [48] + _xGrid;
|
|
|
|
};
|
|
|
|
_xGrid resize 4;
|
|
|
|
_xGrid = toString _xGrid;
|
|
|
|
_xGrid = parseNumber _xGrid;
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _yGrid = toArray Str(round _lazPosY);
|
2015-06-08 10:57:16 +00:00
|
|
|
while {count _yGrid < 5} do {
|
|
|
|
_yGrid = [48] + _yGrid;
|
|
|
|
};
|
|
|
|
_yGrid resize 4;
|
|
|
|
_yGrid = toString _yGrid;
|
|
|
|
_yGrid = parseNumber _yGrid;
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _xCoord = switch true do {
|
2015-06-08 10:57:16 +00:00
|
|
|
case (_xGrid >= 1000): { "" + Str(_xGrid) };
|
|
|
|
case (_xGrid >= 100): { "0" + Str(_xGrid) };
|
|
|
|
case (_xGrid >= 10): { "00" + Str(_xGrid) };
|
|
|
|
default { "000" + Str(_xGrid) };
|
|
|
|
};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _yCoord = switch true do {
|
2015-06-08 10:57:16 +00:00
|
|
|
case (_yGrid >= 1000): { "" + Str(_yGrid) };
|
|
|
|
case (_yGrid >= 100): { "0" + Str(_yGrid) };
|
|
|
|
case (_yGrid >= 10): { "00" + Str(_yGrid) };
|
|
|
|
default { "000" + Str(_yGrid) };
|
2015-06-07 15:53:37 +00:00
|
|
|
};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _dagrGrid = _xCoord + " " + _yCoord;
|
2015-06-08 10:57:16 +00:00
|
|
|
|
|
|
|
// Find target elevation
|
2017-10-10 14:39:59 +00:00
|
|
|
private _elevation = floor ((_lazPosZ) + EGVAR(common,mapAltitude));
|
|
|
|
private _dagrElevation = str _elevation + "m";
|
2015-06-07 15:53:37 +00:00
|
|
|
|
2015-06-08 10:57:16 +00:00
|
|
|
// Time
|
2017-10-10 14:39:59 +00:00
|
|
|
private _dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
|
2015-06-07 15:53:37 +00:00
|
|
|
|
2015-06-08 10:57:16 +00:00
|
|
|
// Bearing
|
2017-10-10 14:39:59 +00:00
|
|
|
private _bearing = GVAR(LAZHEADING);
|
2015-06-07 15:53:37 +00:00
|
|
|
if (_bearing >= 360) then {_bearing = _bearing - 360;};
|
2015-06-09 20:46:04 +00:00
|
|
|
if (!GVAR(useDegrees)) then {_bearing = DEG_TO_MIL(_bearing)};
|
2015-06-07 15:53:37 +00:00
|
|
|
_bearing = floor (_bearing);
|
|
|
|
|
2015-06-08 10:57:16 +00:00
|
|
|
// Distance
|
2017-10-10 14:39:59 +00:00
|
|
|
private _dagrDist = str GVAR(LAZDIST) + "m";
|
2015-06-07 15:53:37 +00:00
|
|
|
|
2015-06-09 20:46:04 +00:00
|
|
|
// Put grid into variable so DAGR menu can access it
|
|
|
|
GVAR(vectorGrid) = _dagrGrid;
|
2015-06-07 15:53:37 +00:00
|
|
|
|
2015-06-08 10:57:16 +00:00
|
|
|
// OUTPUT
|
|
|
|
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
|
|
|
__speedControl ctrlSetText format ["%1", _dagrDist];
|
|
|
|
__elevationControl ctrlSetText format ["%1", _dagrElevation];
|
2015-11-10 22:17:22 +00:00
|
|
|
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
|
2015-06-08 10:57:16 +00:00
|
|
|
__timeControl ctrlSetText format ["%1", _dagrTime];
|