mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Code cleanup of Dagr module
This commit is contained in:
parent
2b3c936e99
commit
bd1a6d14a8
@ -30,4 +30,4 @@ GVAR(vectorConnected) = false;
|
||||
GVAR(noVectorData) = true;
|
||||
GVAR(vectorGrid) = "00000000";
|
||||
|
||||
["RangerfinderData", {_this call FUNC(handleRangeFinderData)}] call EFUNC(common,addEventHandler);
|
||||
["RangerfinderData", FUNC(handleRangeFinderData)] call EFUNC(common,addEventHandler);
|
||||
|
@ -74,13 +74,13 @@ GVAR(menuRun) = true;
|
||||
GVAR(menuRun) = false;
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
if (GVAR(MENU_B)) then {
|
||||
GVAR(menu) = "main";
|
||||
GVAR(selection) = 0;
|
||||
GVAR(numSelections) = 5;
|
||||
};
|
||||
|
||||
|
||||
if (!GVAR(add) && !GVAR(edit)) then {
|
||||
if (GVAR(DOWN)) then {
|
||||
GVAR(selection) = (GVAR(numSelections) + GVAR(selection) + 1);
|
||||
@ -90,7 +90,7 @@ GVAR(menuRun) = true;
|
||||
};
|
||||
GVAR(selection) = if (GVAR(numSelections) > 0) then { GVAR(selection) % GVAR(numSelections) } else { 0 };
|
||||
};
|
||||
|
||||
|
||||
if (GVAR(LEFT)) then {
|
||||
GVAR(pointer) = (8 + GVAR(pointer) - 1);
|
||||
};
|
||||
@ -98,7 +98,7 @@ GVAR(menuRun) = true;
|
||||
GVAR(pointer) = (8 + GVAR(pointer) + 1);
|
||||
};
|
||||
GVAR(pointer) = GVAR(pointer) % 8;
|
||||
|
||||
|
||||
(__dsp displayCtrl __PSelection1) ctrlSetText "";
|
||||
(__dsp displayCtrl __PSelection2) ctrlSetText "";
|
||||
(__dsp displayCtrl __PSelection3) ctrlSetText "";
|
||||
@ -113,7 +113,7 @@ GVAR(menuRun) = true;
|
||||
(__dsp displayCtrl __Selection2) ctrlSetText "";
|
||||
(__dsp displayCtrl __Selection3) ctrlSetText "";
|
||||
(__dsp displayCtrl __Selection4) ctrlSetText "";
|
||||
|
||||
|
||||
(__dsp displayCtrl __F1) ctrlSetText "";
|
||||
(__dsp displayCtrl __F2) ctrlSetText "";
|
||||
(__dsp displayCtrl __F3) ctrlSetText "";
|
||||
@ -124,7 +124,7 @@ GVAR(menuRun) = true;
|
||||
(__dsp displayCtrl __Option2) ctrlSetText "";
|
||||
(__dsp displayCtrl __Option3) ctrlSetText "";
|
||||
(__dsp displayCtrl __Option4) ctrlSetText "";
|
||||
|
||||
|
||||
switch (GVAR(menu)) do {
|
||||
case "main": {
|
||||
if (GVAR(SEL)) then {
|
||||
@ -500,7 +500,7 @@ GVAR(menuRun) = true;
|
||||
case 6: { GVAR(digit6) = (10 + GVAR(digit6) - 1) % 10 };
|
||||
case 7: { GVAR(digit7) = (10 + GVAR(digit7) - 1) % 10 };
|
||||
case 8: { GVAR(digit8) = (10 + GVAR(digit8) - 1) % 10 };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -590,7 +590,7 @@ GVAR(menuRun) = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
if (!GVAR(busy)) then {
|
||||
GVAR(F3) = false;
|
||||
GVAR(F2) = false;
|
||||
|
@ -31,18 +31,19 @@ if (GVAR(outputPFH) != -1) exitWith {};
|
||||
|
||||
GVAR(outputPFH) = [{
|
||||
private["_dagrElevation", "_dagrGrid", "_dagrHeading", "_dagrSpeed", "_dagrTime", "_elevation", "_gridArray", "_speed"];
|
||||
|
||||
|
||||
// Abort Condition
|
||||
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
|
||||
GVAR(outputPFH) = -1;
|
||||
135471 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
// GRID
|
||||
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
|
||||
_dagrGrid = format ["%1 %2", ((_gridArray select 0) select [0,4]), ((_gridArray select 1) select [0,4])];
|
||||
|
||||
_gridArray params ["_gridArrayX","_gridArrayY"];
|
||||
_dagrGrid = format ["%1 %2", ((_gridArrayX) select [0,4]), ((_gridArrayY) select [0,4])];
|
||||
|
||||
// SPEED
|
||||
_speed = speed (vehicle ACE_player);
|
||||
_speed = floor (_speed * 10) / 10;
|
||||
@ -68,7 +69,7 @@ GVAR(outputPFH) = [{
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _dagrSpeed];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrElevation];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 °", _dagrHeading] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 <EFBFBD>", _dagrHeading] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrTime];
|
||||
|
||||
|
||||
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"];
|
||||
private ["_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"];
|
||||
|
||||
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
|
||||
|
||||
@ -30,15 +30,14 @@ private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dag
|
||||
__background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa));
|
||||
|
||||
if (GVAR(noVectorData)) exitwith {};
|
||||
|
||||
_pos = [GVAR(LAZPOS) select 0, GVAR(LAZPOS) select 1];
|
||||
GVAR(LAZPOS) params ["_lazPosX", "_lazPosY", "_lazPosZ"];
|
||||
|
||||
// Incase grids go neg due to 99-00 boundry
|
||||
if (_pos select 0 < 0) then {_pos set [0, (_pos select 0) + 99999];};
|
||||
if (_pos select 1 < 0) then {_pos set [1, (_pos select 1) + 99999];};
|
||||
|
||||
if (_lazPosX < 0) then { _lazPosX = _lazPosX + 99999;};
|
||||
if (_lazPosY < 0) then {_lazPosY = _lazPosY + 99999;};
|
||||
|
||||
// Find laser position
|
||||
_xGrid = toArray Str(round(_pos select 0));
|
||||
_xGrid = toArray Str(round _lazPosX);
|
||||
|
||||
while {count _xGrid < 5} do {
|
||||
_xGrid = [48] + _xGrid;
|
||||
@ -47,7 +46,7 @@ _xGrid resize 4;
|
||||
_xGrid = toString _xGrid;
|
||||
_xGrid = parseNumber _xGrid;
|
||||
|
||||
_yGrid = toArray Str(round(_pos select 1));
|
||||
_yGrid = toArray Str(round _lazPosY);
|
||||
while {count _yGrid < 5} do {
|
||||
_yGrid = [48] + _yGrid;
|
||||
};
|
||||
@ -72,7 +71,7 @@ _yCoord = switch true do {
|
||||
_dagrGrid = _xCoord + " " + _yCoord;
|
||||
|
||||
// Find target elevation
|
||||
_elevation = floor ((GVAR(LAZPOS) select 2) + EGVAR(common,mapAltitude));
|
||||
_elevation = floor (_lazPosZ) + EGVAR(common,mapAltitude));
|
||||
_dagrElevation = str _elevation + "m";
|
||||
|
||||
// Time
|
||||
@ -94,5 +93,5 @@ GVAR(vectorGrid) = _dagrGrid;
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _dagrDist];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrElevation];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1<EFBFBD>", _bearing] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrTime];
|
||||
|
@ -31,22 +31,23 @@ if (GVAR(outputPFH) != -1) exitWith {};
|
||||
|
||||
GVAR(outputPFH) = [{
|
||||
private["_MYpos", "_WPpos", "_bearing", "_dagrDistance", "_dagrGrid", "_dagrHeading", "_distance", "_gridArray"];
|
||||
|
||||
|
||||
// Abort Condition
|
||||
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
|
||||
GVAR(outputPFH) = -1;
|
||||
135471 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
// GRID
|
||||
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
|
||||
_dagrGrid = format ["%1 %2", ((_gridArray select 0) select [0,4]), ((_gridArray select 1) select [0,4])];
|
||||
_gridArray params ["_gridArrayX","_gridArrayY"];
|
||||
_dagrGrid = format ["%1 %2", (_gridArrayX select [0,4]), (_gridArrayY select [0,4])];
|
||||
|
||||
// WP Grid
|
||||
_xGrid2 = floor (DAGR_WP_INFO / 10000);
|
||||
_yGrid2 = DAGR_WP_INFO - _xGrid2 * 10000;
|
||||
|
||||
|
||||
_xCoord2 = switch true do {
|
||||
case (_xGrid2 >= 1000): { "" + Str(_xGrid2) };
|
||||
case (_xGrid2 >= 100): { "0" + Str(_xGrid2) };
|
||||
@ -60,7 +61,7 @@ GVAR(outputPFH) = [{
|
||||
case (_yGrid2 >= 10): { "00" + Str(_yGrid2) };
|
||||
default { "000" + Str(_yGrid2) };
|
||||
};
|
||||
|
||||
|
||||
_dagrGrid2 = _xCoord2 + " " + _yCoord2;
|
||||
|
||||
// Distance
|
||||
@ -69,7 +70,7 @@ GVAR(outputPFH) = [{
|
||||
_distance = _MYpos distance _WPpos;
|
||||
_distance = floor (_distance * 10) / 10;
|
||||
_dagrDistance = str _distance + "m";
|
||||
|
||||
|
||||
// Heading
|
||||
_dagrHeading = floor (if (GVAR(useDegrees)) then {
|
||||
direction (vehicle ACE_player)
|
||||
@ -79,12 +80,12 @@ GVAR(outputPFH) = [{
|
||||
|
||||
// WP Heading
|
||||
_bearing = floor ((_WPpos vectorDiff _MYpos) call CBA_fnc_vectDir);
|
||||
|
||||
|
||||
// Output
|
||||
__gridControl ctrlSetText format ["%1", _dagrGrid];
|
||||
__speedControl ctrlSetText format ["%1", _bearing];
|
||||
__elevationControl ctrlSetText format ["%1", _dagrGrid2];
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] });
|
||||
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1<EFBFBD>", _dagrHeading] });
|
||||
__timeControl ctrlSetText format ["%1", _dagrDistance];
|
||||
|
||||
|
||||
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -23,11 +23,12 @@ if (GVAR(run)) then {
|
||||
};
|
||||
GVAR(hidden) = true;
|
||||
[{
|
||||
EXPLODE_1_PVT(_this select 0,_vehicle);
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_vehicle"];
|
||||
if (!GVAR(run) || (!alive ACE_player) || (vehicle ACE_player != _vehicle)) exitWith {
|
||||
GVAR(run) = false;
|
||||
135471 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
if (cameraView == "GUNNER") then {
|
||||
if (!GVAR(hidden)) then {
|
||||
|
Loading…
Reference in New Issue
Block a user