ACE3/addons/dagr/functions/fnc_outputData.sqf

75 lines
2.3 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
2015-06-07 15:53:37 +00:00
/*
* Author: Rosuto
* DAGR data output loop
*
* Arguments:
* None
2015-06-07 15:53:37 +00:00
*
* Return Value:
* None
2015-06-07 15:53:37 +00:00
*
* Example:
* call ace_dagr_fnc_outputData
2015-06-07 15:53:37 +00:00
*
* Public: No
*/
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
2015-06-08 10:57:16 +00:00
#define __display (uiNameSpace getVariable "DAGR_DISPLAY")
2015-06-07 15:53:37 +00:00
2015-06-08 10:57:16 +00:00
#define __gridControl (__display displayCtrl 266851)
#define __speedControl (__display displayCtrl 266852)
#define __elevationControl (__display displayCtrl 266853)
#define __headingControl (__display displayCtrl 266854)
#define __timeControl (__display displayCtrl 266855)
#define __background (__display displayCtrl 266856)
2015-06-07 15:53:37 +00:00
2016-04-08 18:34:50 +00:00
__background ctrlSetText QPATHTOF(UI\dagr_gps.paa);
2015-06-07 15:53:37 +00:00
2015-06-12 16:23:01 +00:00
if (GVAR(outputPFH) != -1) exitWith {};
GVAR(outputPFH) = [{
2015-06-08 10:57:16 +00:00
// Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
2015-06-12 16:23:01 +00:00
GVAR(outputPFH) = -1;
2015-06-08 10:57:16 +00:00
135471 cutText ["", "PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
2015-08-09 00:33:00 +00:00
2015-06-08 10:57:16 +00:00
// GRID
private _gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
2015-08-09 00:33:00 +00:00
_gridArray params ["_gridArrayX","_gridArrayY"];
private _dagrGrid = format ["%1 %2", ((_gridArrayX) select [0,4]), ((_gridArrayY) select [0,4])];
2015-08-09 00:33:00 +00:00
2015-06-08 10:57:16 +00:00
// SPEED
private _speed = speed (vehicle ACE_player);
2015-06-08 10:57:16 +00:00
_speed = floor (_speed * 10) / 10;
2015-06-07 15:53:37 +00:00
_speed = abs(_speed);
_dagrspeed = str _speed + "kph";
2015-06-08 10:57:16 +00:00
// Elevation
private _elevation = getPosASL ACE_player;
_elevation = floor ((_elevation select 2) + EGVAR(common,mapAltitude));
private _dagrElevation = str _elevation + "m";
2015-06-07 15:53:37 +00:00
2015-06-08 10:57:16 +00:00
// Heading
private _dagrHeading = if (!GVAR(useDegrees)) then {
2015-06-08 10:57:16 +00:00
floor (DEG_TO_MIL(direction (vehicle ACE_player)))
} else {
floor (direction (vehicle ACE_player))
2015-06-07 15:53:37 +00:00
};
2015-06-08 10:57:16 +00:00
// Time
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
// Output
__gridControl ctrlSetText format ["%1", _dagrGrid];
__speedControl ctrlSetText format ["%1", _dagrSpeed];
__elevationControl ctrlSetText format ["%1", _dagrElevation];
2015-08-09 00:33:00 +00:00
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 <20>", _dagrHeading] });
2015-06-08 10:57:16 +00:00
__timeControl ctrlSetText format ["%1", _dagrTime];
2015-08-09 00:33:00 +00:00
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;