Replaced all spawn, sleep, and fsm code.

This commit is contained in:
ulteq 2015-06-09 22:46:04 +02:00
parent fb76cd730f
commit 2a929c4c6b
9 changed files with 630 additions and 7989 deletions

File diff suppressed because it is too large Load Diff

View File

@ -144,7 +144,8 @@ class DAGR_Menu {
fadein = 0;
fadeout = 0;
name = "Dagr_Menu";
onLoad="uiNamespace setVariable ['DAGR_Menu', _this select 0]";
onLoad = "uiNamespace setVariable ['DAGR_Menu', _this select 0]";
onUnload = "DAGR_PWR = true";
controls[] = {"DAGR_MENU_UI", "DAGR_PWR_Button", "DAGR_UP_Button", "DAGR_DOWN_Button", "DAGR_LEFT_Button", "DAGR_RIGHT_Button", "DAGR_NEXT_Button",
"DAGR_SEL_Button", "DAGR_MENU_Button", "DAGR_F1_Button", "DAGR_F2_Button", "DAGR_F3_Button", "DAGR_F1_Text", "DAGR_F2_Text", "DAGR_F3_Text", "DAGR_MENU_OPTION0",
"DAGR_MENU_OPTION1", "DAGR_MENU_OPTION2", "DAGR_MENU_OPTION3", "DAGR_MENU_OPTION4", "DAGR_MENU_SELECTION0", "DAGR_MENU_SELECTION1", "DAGR_MENU_SELECTION2",

View File

@ -1,26 +1,25 @@
#include "script_component.hpp"
DAGR_RUN = false;
DAGR_MENU_RUN = false;
DAGR_DIRECTION = true; // true -> degrees; false -> milliradian
DAGR_GRID_VECTOR = "00000000"; // Default
GVAR(run) = false;
GVAR(useDegrees) = true;
GVAR(updateInterval) = 0.5;
DAGR_WP_NUM = 0; // Number of WPs entered into DAGR
DAGR_WP0_String = ""; // Presets all WPs to empty
DAGR_WP1_String = "";
DAGR_WP2_String = "";
DAGR_WP3_String = "";
DAGR_WP4_String = "";
DAGR_WP0 = 0;
DAGR_WP1 = 0;
DAGR_WP2 = 0;
DAGR_WP3 = 0;
DAGR_WP4 = 0;
DAGR_UPDATE_INTERVAL = 0.5; // Update timer on DAGR, set for 0.5 seconds
DAGR_EMPTY_VECTOR = true; // Keeps DAGR Vector display from filling up before use
GVAR(numWaypoints) = 0;
GVAR(wpString0) = "";
GVAR(wpString1) = "";
GVAR(wpString2) = "";
GVAR(wpString3) = "";
GVAR(wpString4) = "";
GVAR(wp0) = 0;
GVAR(wp1) = 0;
GVAR(wp2) = 0;
GVAR(wp3) = 0;
GVAR(wp4) = 0;
DAGR_DISPLAY_SELECTION = "DATA"; // Sets DAGR for data display
GVAR(displaySelection) = "DATA";
DAGR_NO_DISPLAY = true;
GVAR(vectorConnected) = false;
GVAR(noVectorData) = true;
GVAR(vectorGrid) = "00000000";
["RangerfinderData", {_this call FUNC(DAGR_VECTOR)}] call EFUNC(common,addEventHandler);

View File

@ -14,16 +14,593 @@
*/
#include "script_component.hpp"
[] spawn {
if (DAGR_MENU_RUN) then {
#define __dsp (uiNamespace getVariable "DAGR_MENU")
#define __F1 266874
#define __F2 266875
#define __F3 266876
#define __Option0 2668777
#define __Option1 2668778
#define __Option2 2668779
#define __Option3 2668780
#define __Option4 2668781
#define __Selection0 2668783
#define __Selection1 2668784
#define __Selection2 2668785
#define __Selection3 2668786
#define __Selection4 2668787
#define __mainText 2668782
#define __PSelection1 2668788
#define __PSelection2 2668789
#define __PSelection3 2668790
#define __PSelection4 2668791
#define __PSelection5 2668792
#define __PSelection6 2668793
#define __PSelection7 2668794
#define __PSelection8 2668795
135471 cutText ["", "PLAIN"];
closeDialog 0;
createDialog "DAGR_MENU";
GVAR(menu) = "main";
GVAR(selection) = 0;
GVAR(numSelections) = 5;
GVAR(tmpUpdateRate) = GVAR(updateInterval);
GVAR(edit) = false;
GVAR(add) = false;
GVAR(pointer) = 0;
GVAR(digit1) = 0;
GVAR(digit2) = 0;
GVAR(digit3) = 0;
GVAR(digit4) = 0;
GVAR(digit5) = 0;
GVAR(digit6) = 0;
GVAR(digit7) = 0;
GVAR(digit8) = 0;
GVAR(busy) = false;
GVAR(busyTimer) = 0;
GVAR(showNoWaypointsFound) = false;
GVAR(showInfoUpdatin) = false;
GVAR(showDeleting) = false;
GVAR(showOutOfSpace) = false;
DAGR_PWR = false;
[{
if (!dialog || DAGR_PWR) exitWith {
closeDialog 266860;
DAGR_PWR = true;
sleep 0.1;
DAGR_MENU_RUN = false;
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
135471 cutText ["", "PLAIN"];
if (DAGR_MENU_B) then {
GVAR(menu) = "main";
GVAR(selection) = 0;
GVAR(numSelections) = 5;
};
DAGR_RUN = false;
DAGR_MENU_RUN = true;
DAGR_Menu_Handler = [] execFSM QUOTE(PATHTOF(DAGR_MENU.fsm));
};
if (!GVAR(add) && !GVAR(edit)) then {
if (DAGR_DOWN) then {
GVAR(selection) = (GVAR(numSelections) + GVAR(selection) + 1);
};
if (DAGR_UP) then {
GVAR(selection) = (GVAR(numSelections) + GVAR(selection) - 1);
};
GVAR(selection) = if (GVAR(numSelections) > 0) then { GVAR(selection) % GVAR(numSelections) } else { 0 };
};
if (DAGR_LEFT) then {
GVAR(pointer) = (8 + GVAR(pointer) - 1);
};
if (DAGR_RIGHT) then {
GVAR(pointer) = (8 + GVAR(pointer) + 1);
};
GVAR(pointer) = GVAR(pointer) % 8;
(__dsp displayCtrl __PSelection1) ctrlSetText "";
(__dsp displayCtrl __PSelection2) ctrlSetText "";
(__dsp displayCtrl __PSelection3) ctrlSetText "";
(__dsp displayCtrl __PSelection4) ctrlSetText "";
(__dsp displayCtrl __PSelection5) ctrlSetText "";
(__dsp displayCtrl __PSelection6) ctrlSetText "";
(__dsp displayCtrl __PSelection7) ctrlSetText "";
(__dsp displayCtrl __PSelection8) ctrlSetText "";
(__dsp displayCtrl __Selection0) ctrlSetText "";
(__dsp displayCtrl __Selection1) ctrlSetText "";
(__dsp displayCtrl __Selection2) ctrlSetText "";
(__dsp displayCtrl __Selection3) ctrlSetText "";
(__dsp displayCtrl __Selection4) ctrlSetText "";
(__dsp displayCtrl __F1) ctrlSetText "";
(__dsp displayCtrl __F2) ctrlSetText "";
(__dsp displayCtrl __F3) ctrlSetText "";
(__dsp displayCtrl __mainText) ctrlSetText "";
(__dsp displayCtrl __Option0) ctrlSetText "";
(__dsp displayCtrl __Option1) ctrlSetText "";
(__dsp displayCtrl __Option2) ctrlSetText "";
(__dsp displayCtrl __Option3) ctrlSetText "";
(__dsp displayCtrl __Option4) ctrlSetText "";
switch (GVAR(menu)) do {
case "main": {
if (DAGR_SEL) then {
switch (GVAR(selection)) do {
case 0: {
GVAR(displaySelection) = "DATA";
GVAR(vectorConnected) = false;
if (!GVAR(busy)) then {
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
};
(__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data.";
if (ACE_time - GVAR(busyTimer) > 0.5) then {
(__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data..";
};
if (ACE_time - GVAR(busyTimer) > 1.0) then {
(__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data...";
};
if (ACE_time - GVAR(busyTimer) > 1.5) then {
(__dsp displayCtrl __mainText) ctrlSetText "Position Acquired";
};
if (ACE_time - GVAR(busyTimer) > 3.0) then {
GVAR(busy) = false;
};
};
case 1: {
if (GVAR(numWaypoints) < 1) then {
(__dsp displayCtrl __mainText) ctrlSetText "No Waypoints Found";
if (!GVAR(busy)) then {
GVAR(showNoWaypointsFound) = true;
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
};
} else {
GVAR(menu) = "goto_wp"; GVAR(numSelections) = GVAR(numWaypoints); GVAR(selection) = 0;
};
};
case 2: { GVAR(menu) = "wp_list"; GVAR(numSelections) = GVAR(numWaypoints); GVAR(selection) = 0 };
case 3: { GVAR(menu) = "connect"; GVAR(numSelections) = 1; };
case 4: { GVAR(menu) = "options"; GVAR(numSelections) = 2; };
};
};
if (GVAR(busy) && GVAR(showNoWaypointsFound)) then {
if (ACE_time - GVAR(busyTimer) > 2) then {
GVAR(showNoWaypointsFound) = false;
GVAR(busy) = false;
};
};
if (!GVAR(busy)) then {
(__dsp displayCtrl __Option0) ctrlSetText "DATA VIEW";
(__dsp displayCtrl __Option1) ctrlSetText "GOTO WP";
(__dsp displayCtrl __Option2) ctrlSetText "WP LIST";
(__dsp displayCtrl __Option3) ctrlSetText "CONNECT TO";
(__dsp displayCtrl __Option4) ctrlSetText "OPTIONS";
(__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa));
};
};
case "goto_wp": {
if (!GVAR(busy)) then {
(__dsp displayCtrl __Option0) ctrlSetText GVAR(wpString0);
(__dsp displayCtrl __Option1) ctrlSetText GVAR(wpString1);
(__dsp displayCtrl __Option2) ctrlSetText GVAR(wpString2);
(__dsp displayCtrl __Option3) ctrlSetText GVAR(wpString3);
(__dsp displayCtrl __Option4) ctrlSetText GVAR(wpString4);
if (GVAR(numSelections) > 0) then {
(__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa));
};
};
if (DAGR_SEL) then {
GVAR(vectorConnected) = false;
GVAR(displaySelection) = "WP";
switch (GVAR(selection)) do {
case 0: { DAGR_WP_INFO = GVAR(wp0); };
case 1: { DAGR_WP_INFO = GVAR(wp1); };
case 2: { DAGR_WP_INFO = GVAR(wp2); };
case 3: { DAGR_WP_INFO = GVAR(wp3); };
case 4: { DAGR_WP_INFO = GVAR(wp4); };
};
if (!GVAR(busy)) then {
GVAR(showInfoUpdating) = true;
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
};
};
if (GVAR(busy) && GVAR(showInfoUpdating)) then {
(__dsp displayCtrl __mainText) ctrlSetText "Info Update.";
if (ACE_time - GVAR(busyTimer) > 1) then {
(__dsp displayCtrl __mainText) ctrlSetText "Info Update..";
};
if (ACE_time - GVAR(busyTimer) > 1.2) then {
(__dsp displayCtrl __mainText) ctrlSetText "Info Update...";
};
if (ACE_time - GVAR(busyTimer) > 1.4) then {
(__dsp displayCtrl __mainText) ctrlSetText "Info Updated";
};
if (ACE_time - GVAR(busyTimer) > 2.9) then {
GVAR(showInfoUpdating) = false;
GVAR(busy) = false;
};
};
};
case "wp_list": {
if (!GVAR(add) && !GVAR(edit)) then {
if (!GVAR(busy)) then {
(__dsp displayCtrl __Option0) ctrlSetText GVAR(wpString0);
(__dsp displayCtrl __Option1) ctrlSetText GVAR(wpString1);
(__dsp displayCtrl __Option2) ctrlSetText GVAR(wpString2);
(__dsp displayCtrl __Option3) ctrlSetText GVAR(wpString3);
(__dsp displayCtrl __Option4) ctrlSetText GVAR(wpString4);
(__dsp displayCtrl __F1) ctrlSetText "Add";
(__dsp displayCtrl __F2) ctrlSetText "Edit";
(__dsp displayCtrl __F3) ctrlSetText "Delete";
if (GVAR(numSelections) > 0) then {
(__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa));
};
};
if (DAGR_F3 && GVAR(numWaypoints) > 0) then {
if (!GVAR(busy)) then {
switch (GVAR(selection)) do {
case 0: {
GVAR(wpString0) = GVAR(wpString1);
GVAR(wp0) = GVAR(wp1);
GVAR(wpString1) = GVAR(wpString2);
GVAR(wp1) = GVAR(wp2);
GVAR(wpString2) = GVAR(wpString3);
GVAR(wp2) = GVAR(wp3);
GVAR(wpString3) = GVAR(wpString4);
GVAR(wp3) = GVAR(wp4);
GVAR(wpString4) = "";
GVAR(wp4) = "";
};
case 1: {
GVAR(wpString1) = GVAR(wpString2);
GVAR(wp1) = GVAR(wp2);
GVAR(wpString2) = GVAR(wpString3);
GVAR(wp2) = GVAR(wp3);
GVAR(wpString3) = GVAR(wpString4);
GVAR(wp3) = GVAR(wp4);
GVAR(wpString4) = "";
GVAR(wp4) = "";
};
case 2: {
GVAR(wpString2) = GVAR(wpString3);
GVAR(wp2) = GVAR(wp3);
GVAR(wpString3) = GVAR(wpString4);
GVAR(wp3) = GVAR(wp4);
GVAR(wpString4) = "";
GVAR(wp4) = "";
};
case 3: {
GVAR(wpString3) = GVAR(wpString4);
GVAR(wp3) = GVAR(wp4);
GVAR(wpString4) = "";
GVAR(wp4) = "";
};
case 4: {
GVAR(wpString4) = "";
GVAR(wp4) = "";
};
};
GVAR(numWaypoints) = GVAR(numWaypoints) - 1;
GVAR(numSelections) = GVAR(numWaypoints);
GVAR(showDeleting) = true;
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
};
};
if (GVAR(busy) && GVAR(showDeleting)) then {
(__dsp displayCtrl __mainText) ctrlSetText "Deleting.";
if (ACE_time - GVAR(busyTimer) > 1) then {
(__dsp displayCtrl __mainText) ctrlSetText "Deleting..";
};
if (ACE_time - GVAR(busyTimer) > 1.2) then {
(__dsp displayCtrl __mainText) ctrlSetText "Deleting...";
};
if (ACE_time - GVAR(busyTimer) > 1.4) then {
(__dsp displayCtrl __mainText) ctrlSetText "Waypoint Deleted";
};
if (ACE_time - GVAR(busyTimer) > 2.9) then {
GVAR(showDeleting) = false;
GVAR(busy) = false;
};
};
if (DAGR_F1) then {
if (GVAR(numWaypoints) == 5) then {
if (!GVAR(busy)) then {
GVAR(showOutOfSpace) = true;
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
};
} else {
GVAR(digit1) = 0;
GVAR(digit2) = 0;
GVAR(digit3) = 0;
GVAR(digit4) = 0;
GVAR(digit5) = 0;
GVAR(digit6) = 0;
GVAR(digit7) = 0;
GVAR(digit8) = 0;
GVAR(pointer) = 0;
GVAR(add) = true;
};
};
if (GVAR(busy) && GVAR(showOutOfSpace)) then {
(__dsp displayCtrl __mainText) ctrlSetText "Out of Space";
if (ACE_time - GVAR(busyTimer) > 2.5) then {
GVAR(showOutOfSpace) = false;
GVAR(busy) = false;
};
};
if (DAGR_F2 && GVAR(numWaypoints) > 0) then {
GVAR(pointer) = 0;
GVAR(edit) = true;
GVAR(add) = false;
switch (GVAR(selection)) do {
case 0: {
GVAR(digit1) = floor (GVAR(wp0) / 10000000);
GVAR(digit2) = floor (GVAR(wp0) / 1000000 - GVAR(digit1) *10);
GVAR(digit3) = floor (GVAR(wp0) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100);
GVAR(digit4) = floor (GVAR(wp0) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000);
GVAR(digit5) = floor (GVAR(wp0) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000);
GVAR(digit6) = floor (GVAR(wp0) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000);
GVAR(digit7) = floor (GVAR(wp0) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000);
GVAR(digit8) = floor (GVAR(wp0) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000);
};
case 1: {
GVAR(digit1) = floor (GVAR(wp1) / 10000000);
GVAR(digit2) = floor (GVAR(wp1) / 1000000 - GVAR(digit1) *10);
GVAR(digit3) = floor (GVAR(wp1) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100);
GVAR(digit4) = floor (GVAR(wp1) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000);
GVAR(digit5) = floor (GVAR(wp1) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000);
GVAR(digit6) = floor (GVAR(wp1) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000);
GVAR(digit7) = floor (GVAR(wp1) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000);
GVAR(digit8) = floor (GVAR(wp1) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000);
};
case 2: {
GVAR(digit1) = floor (GVAR(wp2) / 10000000);
GVAR(digit2) = floor (GVAR(wp2) / 1000000 - GVAR(digit1) *10);
GVAR(digit3) = floor (GVAR(wp2) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100);
GVAR(digit4) = floor (GVAR(wp2) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000);
GVAR(digit5) = floor (GVAR(wp2) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000);
GVAR(digit6) = floor (GVAR(wp2) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000);
GVAR(digit7) = floor (GVAR(wp2) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000);
GVAR(digit8) = floor (GVAR(wp2) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000);
};
case 3: {
GVAR(digit1) = floor (GVAR(wp3) / 10000000);
GVAR(digit2) = floor (GVAR(wp3) / 1000000 - GVAR(digit1) *10);
GVAR(digit3) = floor (GVAR(wp3) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100);
GVAR(digit4) = floor (GVAR(wp3) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000);
GVAR(digit5) = floor (GVAR(wp3) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000);
GVAR(digit6) = floor (GVAR(wp3) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000);
GVAR(digit7) = floor (GVAR(wp3) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000);
GVAR(digit8) = floor (GVAR(wp3) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000);
};
case 4: {
GVAR(digit1) = floor (GVAR(wp4) / 10000000);
GVAR(digit2) = floor (GVAR(wp4) / 1000000 - GVAR(digit1) *10);
GVAR(digit3) = floor (GVAR(wp4) / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100);
GVAR(digit4) = floor (GVAR(wp4) / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000);
GVAR(digit5) = floor (GVAR(wp4) / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000);
GVAR(digit6) = floor (GVAR(wp4) / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000);
GVAR(digit7) = floor (GVAR(wp4) / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000);
GVAR(digit8) = floor (GVAR(wp4) - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000);
};
};
};
} else {
if (!GVAR(busy)) then {
(__dsp displayCtrl __F1) ctrlSetText "Save";
(__dsp displayCtrl __F2) ctrlSetText "Vector";
(__dsp displayCtrl __F3) ctrlSetText "Cancel";
GVAR(output) = str GVAR(digit1) + str GVAR(digit2) + str GVAR(digit3) + str GVAR(digit4) + str GVAR(digit5) + str GVAR(digit6) + str GVAR(digit7) + str GVAR(digit8);
(__dsp displayCtrl __mainText) ctrlSetText GVAR(output);
(__dsp displayCtrl __PSelection1 + GVAR(pointer)) ctrlSetText QUOTE(PATHTOF(UI\DAGR_PSelection.paa));
};
if (DAGR_F1) then {
if (!GVAR(busy)) then {
if (GVAR(add)) then {
switch (GVAR(numWaypoints)) do {
case 0: { GVAR(wpString0) = GVAR(output); GVAR(wp0) = parseNumber GVAR(output); };
case 1: { GVAR(wpString1) = GVAR(output); GVAR(wp1) = parseNumber GVAR(output); };
case 2: { GVAR(wpString2) = GVAR(output); GVAR(wp2) = parseNumber GVAR(output); };
case 3: { GVAR(wpString3) = GVAR(output); GVAR(wp3) = parseNumber GVAR(output); };
case 4: { GVAR(wpString4) = GVAR(output); GVAR(wp4) = parseNumber GVAR(output); };
};
GVAR(numWaypoints) = GVAR(numWaypoints) + 1;
GVAR(numSelections) = GVAR(numWaypoints);
GVAR(selection) = 0;
};
if (GVAR(edit)) then {
switch (GVAR(selection)) do {
case 0: { GVAR(wpString0) = GVAR(output); GVAR(wp0) = parseNumber GVAR(output); };
case 1: { GVAR(wpString1) = GVAR(output); GVAR(wp1) = parseNumber GVAR(output); };
case 2: { GVAR(wpString2) = GVAR(output); GVAR(wp2) = parseNumber GVAR(output); };
case 3: { GVAR(wpString3) = GVAR(output); GVAR(wp3) = parseNumber GVAR(output); };
case 4: { GVAR(wpString4) = GVAR(output); GVAR(wp4) = parseNumber GVAR(output); };
};
};
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
};
(__dsp displayCtrl __F1) ctrlSetText "";
(__dsp displayCtrl __F2) ctrlSetText "";
(__dsp displayCtrl __F3) ctrlSetText "";
(__dsp displayCtrl __mainText) ctrlSetText "Saving.";
if (ACE_time - GVAR(busyTimer) > 1) then {
(__dsp displayCtrl __mainText) ctrlSetText "Saving..";
};
if (ACE_time - GVAR(busyTimer) > 1.2) then {
(__dsp displayCtrl __mainText) ctrlSetText "Saving...";
};
if (ACE_time - GVAR(busyTimer) > 1.4) then {
(__dsp displayCtrl __mainText) ctrlSetText "Waypoint Saved";
};
if (ACE_time - GVAR(busyTimer) > 2.9) then {
GVAR(edit) = false;
GVAR(add) = false;
GVAR(busy) = false;
};
};
if (DAGR_F2) then {
private ["_grid", "_gridVector"];
_grid = toArray GVAR(vectorGrid);
_grid deleteAt 4;
_grid = toString _grid;
_gridVector = parseNumber _grid;
GVAR(digit1) = floor(_gridVector / 10000000);
GVAR(digit2) = floor(_gridVector / 1000000 - GVAR(digit1) *10);
GVAR(digit3) = floor(_gridVector / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100);
GVAR(digit4) = floor(_gridVector / 10000 - GVAR(digit3) * 10 - GVAR(digit2) * 100 - GVAR(digit1) * 1000);
GVAR(digit5) = floor(_gridVector / 1000 - GVAR(digit4) * 10 - GVAR(digit3) * 100 - GVAR(digit2) * 1000 - GVAR(digit1) * 10000);
GVAR(digit6) = floor(_gridVector / 100 - GVAR(digit5) * 10 - GVAR(digit4) * 100 - GVAR(digit3) * 1000 - GVAR(digit2) * 10000 - GVAR(digit1) * 100000);
GVAR(digit7) = floor(_gridVector / 10- GVAR(digit6) * 10 - GVAR(digit5) * 100 - GVAR(digit4) * 1000 - GVAR(digit3) * 10000 - GVAR(digit2) * 100000 - GVAR(digit1) * 1000000);
GVAR(digit8) = floor(_gridVector - GVAR(digit7) * 10 - GVAR(digit6) * 100 - GVAR(digit5) * 1000 - GVAR(digit4) * 10000 - GVAR(digit3) * 100000 - GVAR(digit2) * 1000000 - GVAR(digit1) * 10000000);
};
if (DAGR_F3) then {
if (!GVAR(busy)) then {
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
} else {
(__dsp displayCtrl __F1) ctrlSetText "Save";
(__dsp displayCtrl __F2) ctrlSetText "Vector";
(__dsp displayCtrl __F3) ctrlSetText "Cancel";
GVAR(output) = str GVAR(digit1) + str GVAR(digit2) + str GVAR(digit3) + str GVAR(digit4) + str GVAR(digit5) + str GVAR(digit6) + str GVAR(digit7) + str GVAR(digit8);
(__dsp displayCtrl __mainText) ctrlSetText GVAR(output);
};
if (ACE_time - GVAR(busyTimer) > 0.1) then {
GVAR(add) = false;
GVAR(edit) = false;
GVAR(busy) = false;
};
};
if (DAGR_UP) then {
switch (GVAR(pointer) + 1) do {
case 1: { GVAR(digit1) = (10 + GVAR(digit1) + 1) % 10 };
case 2: { GVAR(digit2) = (10 + GVAR(digit2) + 1) % 10 };
case 3: { GVAR(digit3) = (10 + GVAR(digit3) + 1) % 10 };
case 4: { GVAR(digit4) = (10 + GVAR(digit4) + 1) % 10 };
case 5: { GVAR(digit5) = (10 + GVAR(digit5) + 1) % 10 };
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 };
};
};
if (DAGR_DOWN) then {
switch (GVAR(pointer) + 1) do {
case 1: { GVAR(digit1) = (10 + GVAR(digit1) - 1) % 10 };
case 2: { GVAR(digit2) = (10 + GVAR(digit2) - 1) % 10 };
case 3: { GVAR(digit3) = (10 + GVAR(digit3) - 1) % 10 };
case 4: { GVAR(digit4) = (10 + GVAR(digit4) - 1) % 10 };
case 5: { GVAR(digit5) = (10 + GVAR(digit5) - 1) % 10 };
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 };
};
};
};
};
case "connect": {
if (!GVAR(busy)) then {
(__dsp displayCtrl __Option0) ctrlSetText "Vector 21";
(__dsp displayCtrl __Selection0) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa));
};
if (DAGR_SEL) then {
if (!GVAR(busy)) then {
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
};
(__dsp displayCtrl __mainText) ctrlSetText "Connecting.";
if (ACE_time - GVAR(busyTimer) > 0.2) then {
(__dsp displayCtrl __mainText) ctrlSetText "Connecting..";
};
if (ACE_time - GVAR(busyTimer) > 0.4) then {
(__dsp displayCtrl __mainText) ctrlSetText "Connecting...";
};
if (ACE_time - GVAR(busyTimer) > 0.6) then {
if (ACE_player hasWeapon "ACE_Vector") then {
GVAR(displaySelection) = "VECTOR";
(__dsp displayCtrl __mainText) ctrlSetText "Vector Connected";
GVAR(vectorConnected) = true;
} else {
(__dsp displayCtrl __mainText) ctrlSetText "No Device Found";
GVAR(vectorConnected) = false;
};
};
if (ACE_time - GVAR(busyTimer) > 3.1) then {
GVAR(busy) = false;
if (GVAR(vectorConnected)) then {
GVAR(menu) = "main"; GVAR(numSelections) = 5;
};
};
};
};
case "options": {
(__dsp displayCtrl __Option0) ctrlSetText "Signal Delay";
(__dsp displayCtrl __Option1) ctrlSetText (if (GVAR(useDegrees)) then { "Direction: Deg" } else { "Direction: MIL" });
(__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa));
if (DAGR_SEL) then {
GVAR(vectorConnected) = false;
switch (GVAR(selection)) do {
case 0: { GVAR(menu) = "update_rate"; GVAR(numSelections) = 1; GVAR(tmpUpdateRate) = GVAR(updateInterval); };
case 1: { GVAR(useDegrees) = !GVAR(useDegrees); };
};
}
};
case "update_rate": {
if (DAGR_F1) then {
GVAR(updateInterval) = GVAR(tmpUpdateRate);
if (!GVAR(busy)) then {
GVAR(busy) = true;
GVAR(busyTimer) = ACE_time;
};
(__dsp displayCtrl __mainText) ctrlSetText "Updating.";
if (ACE_time - GVAR(busyTimer) > 0.2) then {
(__dsp displayCtrl __mainText) ctrlSetText "Updating..";
};
if (ACE_time - GVAR(busyTimer) > 0.4) then {
(__dsp displayCtrl __mainText) ctrlSetText "Updating...";
};
if (ACE_time - GVAR(busyTimer) > 0.6) then {
(__dsp displayCtrl __mainText) ctrlSetText "Update Success";
};
if (ACE_time - GVAR(busyTimer) > 2.1) then {
GVAR(busy) = false;
GVAR(menu) = "options"; GVAR(numSelections) = 2;
};
};
if (DAGR_F3) then {
GVAR(menu) = "options"; GVAR(numSelections) = 2;
};
if (DAGR_DOWN) then {
GVAR(tmpUpdateRate) = GVAR(tmpUpdateRate) - 0.1;
};
if (DAGR_UP) then {
GVAR(tmpUpdateRate) = GVAR(tmpUpdateRate) + 0.1;
};
GVAR(tmpUpdateRate) = 0.1 max GVAR(tmpUpdateRate) min 2.0;
if (!GVAR(busy)) then {
(__dsp displayCtrl __mainText) ctrlSetText (Str(GVAR(tmpUpdateRate) * 1000) + "ms");
(__dsp displayCtrl __F1) ctrlSetText "Save";
(__dsp displayCtrl __F3) ctrlSetText "Cancel";
};
};
};
if (!GVAR(busy)) then {
DAGR_F3 = false;
DAGR_F2 = false;
DAGR_F1 = false;
DAGR_MENU_B = false;
DAGR_SEL = false;
DAGR_NEXT = false;
DAGR_RIGHT = false;
DAGR_LEFT = false;
DAGR_UP = false;
DAGR_Down = false;
DAGR_PWR = false;
};
}, 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -31,7 +31,7 @@ __background ctrlSetText QUOTE(PATHTOF(UI\dagr_gps.paa));
private ["_pos", "_xgrid", "_ygrid", "_xcoord", "_ycoord", "_speed", "_dagrHeading", "_dagrGrid", "_dagrElevation", "_dagrSpeed", "_dagrTime", "_elevation"];
// Abort Condition
if !(DAGR_RUN && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
135471 cutText ["", "PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
@ -87,7 +87,7 @@ __background ctrlSetText QUOTE(PATHTOF(UI\dagr_gps.paa));
_dagrElevation = str _elevation + "m";
// Heading
_dagrHeading = if (!DAGR_DIRECTION) then {
_dagrHeading = if (!GVAR(useDegrees)) then {
floor (DEG_TO_MIL(direction (vehicle ACE_player)))
} else {
floor (direction (vehicle ACE_player))
@ -100,7 +100,7 @@ __background ctrlSetText QUOTE(PATHTOF(UI\dagr_gps.paa));
__gridControl ctrlSetText format ["%1", _dagrGrid];
__speedControl ctrlSetText format ["%1", _dagrSpeed];
__elevationControl ctrlSetText format ["%1", _dagrElevation];
__headingControl ctrlSetText (if (!DAGR_DIRECTION) then { format ["%1", _dagrHeading] } else { format ["%1 °", _dagrHeading] });
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 °", _dagrHeading] });
__timeControl ctrlSetText format ["%1", _dagrTime];
}, DAGR_UPDATE_INTERVAL, []] call CBA_fnc_addPerFrameHandler;
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;

View File

@ -29,7 +29,7 @@ private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dag
__background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa));
if (DAGR_NO_DISPLAY) exitwith {};
if (GVAR(noVectorData)) exitwith {};
_pos = [GVAR(LAZPOS) select 0, GVAR(LAZPOS) select 1];
@ -81,18 +81,18 @@ _dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
// Bearing
_bearing = GVAR(LAZHEADING);
if (_bearing >= 360) then {_bearing = _bearing - 360;};
if (!DAGR_DIRECTION) then {_bearing = DEG_TO_MIL(_bearing)};
if (!GVAR(useDegrees)) then {_bearing = DEG_TO_MIL(_bearing)};
_bearing = floor (_bearing);
// Distance
_dagrDist = str GVAR(LAZDIST) + "m";
// put grid into variable so DAGR menu can access it TODO: check if it is safe to do it in this fashion
DAGR_GRID_VECTOR = _dagrGrid;
// Put grid into variable so DAGR menu can access it
GVAR(vectorGrid) = _dagrGrid;
// OUTPUT
__gridControl ctrlSetText format ["%1", _dagrGrid];
__speedControl ctrlSetText format ["%1", _dagrDist];
__elevationControl ctrlSetText format ["%1", _dagrElevation];
__headingControl ctrlSetText (if (!DAGR_DIRECTION) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] });
__timeControl ctrlSetText format ["%1", _dagrTime];

View File

@ -31,7 +31,7 @@ __background ctrlSetText QUOTE(PATHTOF(UI\dagr_wp.paa));
private ["_pos", "_xGrid", "_yGrid", "_xCoord", "_yCoord", "_dagrHeading", "_dagrGrid", "_bearing", "_MYpos", "_WPpos", "_dagrDistance", "_distance"];
// Abort Condition
if !(DAGR_RUN && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
135471 cutText ["", "PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
@ -103,7 +103,7 @@ __background ctrlSetText QUOTE(PATHTOF(UI\dagr_wp.paa));
_dagrDistance = str _distance + "m";
// Heading
_dagrHeading = floor (if (DAGR_DIRECTION) then {
_dagrHeading = floor (if (GVAR(useDegrees)) then {
direction (vehicle ACE_player)
} else {
DEG_TO_MIL(direction (vehicle ACE_player))
@ -116,7 +116,7 @@ __background ctrlSetText QUOTE(PATHTOF(UI\dagr_wp.paa));
__gridControl ctrlSetText format ["%1", _dagrGrid];
__speedControl ctrlSetText format ["%1", _bearing];
__elevationControl ctrlSetText format ["%1", _dagrGrid2];
__headingControl ctrlSetText (if (!DAGR_DIRECTION) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] });
__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] });
__timeControl ctrlSetText format ["%1", _dagrDistance];
}, DAGR_UPDATE_INTERVAL, []] call CBA_fnc_addPerFrameHandler;
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;

View File

@ -16,23 +16,23 @@
if (cameraView == "GUNNER") exitWith {};
DAGR_RUN = !DAGR_RUN;
GVAR(run) = !GVAR(run);
if (DAGR_RUN) then {
switch (toUpper DAGR_DISPLAY_SELECTION) do {
if (GVAR(run)) then {
switch (toUpper GVAR(displaySelection)) do {
case "WP" : {
[] spawn FUNC(DAGR_OUTPUT_WP);
call FUNC(DAGR_OUTPUT_WP);
};
case "VECTOR" : {
[] spawn FUNC(DAGR_OUTPUT_VECTOR);
call FUNC(DAGR_OUTPUT_VECTOR);
};
case "DATA" : {
[] spawn FUNC(DAGR_OUTPUT_DATA);
call FUNC(DAGR_OUTPUT_DATA);
};
};
[{
EXPLODE_1_PVT(_this select 0,_vehicle);
if (!DAGR_RUN || (!alive ACE_player) || (cameraView == "GUNNER") || (vehicle ACE_player != _vehicle)) exitWith {
if (!GVAR(run) || (!alive ACE_player) || (cameraView == "GUNNER") || (vehicle ACE_player != _vehicle)) exitWith {
135471 cutText ["", "PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
};

View File

@ -21,10 +21,10 @@
PARAMS_3(_slopeDistance,_azimuth,_inclination);
if (!DAGR_EMPTY_VECTOR) then {
if (GVAR(vectorConnected)) then {
GVAR(LAZPOS) = (eyePos player) vectorAdd ([_slopeDistance, _azimuth, _inclination] call CBA_fnc_polar2vect);
GVAR(LAZDIST) = _slopeDistance * cos(_inclination);
GVAR(LAZDIST) = floor (GVAR(LAZDIST) / EMP_RF_ACC) * EMP_RF_ACC;
GVAR(LAZHEADING) = _azimuth;
DAGR_NO_DISPLAY = false;
GVAR(noVectorData) = false;
};