ACE3/addons/dagr/functions/fnc_outputData.sqf

76 lines
2.3 KiB
Plaintext
Raw Normal View History

2015-06-07 15:53:37 +00:00
/*
* Author: Rosuto
* DAGR data output loop
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
2015-06-08 10:57:16 +00:00
#include "script_component.hpp"
2015-06-07 15:53:37 +00:00
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
2015-06-08 10:57:16 +00:00
__background ctrlSetText QUOTE(PATHTOF(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-07-16 23:35:38 +00:00
private["_dagrElevation", "_dagrGrid", "_dagrHeading", "_dagrSpeed", "_dagrTime", "_elevation", "_gridArray", "_speed"];
2015-08-09 00:33:00 +00:00
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
2015-07-16 23:35:38 +00:00
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
2015-08-09 00:33:00 +00:00
_gridArray params ["_gridArrayX","_gridArrayY"];
_dagrGrid = format ["%1 %2", ((_gridArrayX) select [0,4]), ((_gridArrayY) select [0,4])];
2015-06-08 10:57:16 +00:00
// SPEED
_speed = speed (vehicle ACE_player);
_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
2015-06-07 15:53:37 +00:00
_elevation = getPosASL ACE_player;
_elevation = floor ((_elevation select 2) + EGVAR(common,mapAltitude));
2015-06-07 15:53:37 +00:00
_dagrElevation = str _elevation + "m";
2015-06-08 10:57:16 +00:00
// Heading
_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
2015-06-07 15:53:37 +00:00
_dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
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;