Merge pull request #1534 from acemod/dagr

Initial draft of the ACE2 DAGR port
This commit is contained in:
ulteq 2015-06-12 13:42:25 +02:00
commit 2e0b837190
29 changed files with 1743 additions and 0 deletions

1
addons/dagr/$PBOPREFIX$ Normal file
View File

@ -0,0 +1 @@
z\ace\addons\dagr

View File

@ -0,0 +1,11 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
};
};

View File

@ -0,0 +1,49 @@
class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_SelfActions {
class ACE_Equipment {
class GVAR(menu) {
displayName = "Configure DAGR";
condition = QUOTE([ARR_2(_player,'ACE_DAGR')] call EFUNC(common,hasItem));
statement = QUOTE(call FUNC(menuInit));
showDisabled = 0;
priority = 0.1;
icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa));
exceptions[] = {"isNotInside"};
class GVAR(toggle) {
displayName = "Toggle DAGR";
condition = QUOTE([ARR_2(_player,'ACE_DAGR')] call EFUNC(common,hasItem));
statement = QUOTE(call FUNC(toggleOverlay));
showDisabled = 0;
priority = 0.2;
icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa));
exceptions[] = {"notOnMap", "isNotInside"};
};
};
};
};
};
class Item_Base_F;
class ACE_Item_DAGR: Item_Base_F {
author[] = {"Rosuto", "Ruthberg"};
scope = 2;
scopeCurator = 2;
displayName = "DAGR";
vehicleClass = "Items";
class TransportItems {
class ACE_DAGR {
name = "ACE_DAGR";
count = 1;
};
};
};
class Box_NATO_Support_F;
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_DAGR,6);
};
};
};

View File

@ -0,0 +1,19 @@
class CfgWeapons {
class ACE_ItemCore;
class InventoryItem_Base_F;
class ACE_DAGR: ACE_ItemCore {
author[] = {$STR_ACE_Common_ACETeam, "Ruthberg"};
scope = 2;
displayName = "DAGR";
descriptionShort = "";
picture = PATHTOF(UI\DAGR_Icon.paa);
icon = "iconObject_circle";
mapSize = 0.034;
class ItemInfo: InventoryItem_Base_F {
mass = 10;
};
};
};

424
addons/dagr/Dialog.hpp Normal file
View File

@ -0,0 +1,424 @@
// Control types
#define CT_STATIC 0
#define CT_BUTTON 1
#define CT_EDIT 2
#define CT_SLIDER 3
#define CT_COMBO 4
#define CT_LISTBOX 5
#define CT_TOOLBOX 6
#define CT_CHECKBOXES 7
#define CT_PROGRESS 8
#define CT_HTML 9
#define CT_STATIC_SKEW 10
#define CT_ACTIVETEXT 11
#define CT_TREE 12
#define CT_STRUCTURED_TEXT 13
#define CT_CONTEXT_MENU 14
#define CT_CONTROLS_GROUP 15
#define CT_SHORTCUT_BUTTON 16 // Arma 2 - textured button
#define CT_XKEYDESC 40
#define CT_XBUTTON 41
#define CT_XLISTBOX 42
#define CT_XSLIDER 43
#define CT_XCOMBO 44
#define CT_ANIMATED_TEXTURE 45
#define CT_OBJECT 80
#define CT_OBJECT_ZOOM 81
#define CT_OBJECT_CONTAINER 82
#define CT_OBJECT_CONT_ANIM 83
#define CT_LINEBREAK 98
#define CT_USER 99
#define CT_MAP 100
#define CT_MAP_MAIN 101
#define CT_List_N_Box 102 // Arma 2 - N columns list box
// Static styles
#define ST_POS 0x0F
#define ST_HPOS 0x03
#define ST_VPOS 0x0C
#define ST_LEFT 0x00
#define ST_RIGHT 0x01
#define ST_CENTER 0x02
#define ST_DOWN 0x04
#define ST_UP 0x08
#define ST_VCENTER 0x0c
#define ST_TYPE 0xF0
#define ST_SINGLE 0
#define ST_MULTI 16
#define ST_TITLE_BAR 32
#define ST_PICTURE 48
#define ST_FRAME 64
#define ST_BACKGROUND 80
#define ST_GROUP_BOX 96
#define ST_GROUP_BOX2 112
#define ST_HUD_BACKGROUND 128
#define ST_TILE_PICTURE 144
#define ST_WITH_RECT 160
#define ST_LINE 176
#define ST_SHADOW 0x100
#define ST_NO_RECT 0x200
#define ST_KEEP_ASPECT_RATIO 0x800
#define ST_TITLE ST_TITLE_BAR + ST_CENTER
// Slider styles
#define SL_DIR 0x400
#define SL_VERT 0
#define SL_HORZ 0x400
#define SL_TEXTURES 0x10
// Listbox styles
#define LB_TEXTURES 0x10
#define LB_MULTI 0x20
#define FontM "PuristaMedium"
class RscText;
class DAGR_Button {
idc = -1;
type = CT_BUTTON;
style = ST_LEFT;
font = "PuristaMedium";
sizeEx = 0.02;
colorText[] = { 0, 1, 0, 1 };
colorFocused[] = { 0, 0, 0, 0 }; // border color for focused state
colorDisabled[] = { 0, 0, 0, 0 }; // text color for disabled state
colorBackground[] = { 0, 0, 0, 0 };
colorBackgroundDisabled[] = { 0, 0, 0, 0 }; // background color for disabled state
colorBackgroundActive[] = { 0, 0, 0, 0 }; // background color for active state
offsetX = 0;
offsetY = 0;
offsetPressedX = 0;
offsetPressedY = 0;
colorShadow[] = { 0, 0, 0, 0 };
colorBorder[] = { 0, 0, 0, 0 };
borderSize = 0;
soundEnter[] = { "", 0, 1 }; // no sound
soundPush[] = { "", 0, 1 };
soundClick[] = { "", 0, 1 }; // no sound
soundEscape[] = { "", 0, 1 }; // no sound
x = 0.5;
y = 0.5;
w = 0.07;
h = 0.05;
text = "";
action = "";
};
class DAGR_Menu_Pic {
type = 0;
idc = -1;
style = 48;
x = 0;
y = 0;
w = 0.7;
h = 1.4;
text = "";
colorBackground[] = {};
colorText[] = {};
font = "PuristaMedium";
sizeEx = 0.04;
waitForLoad = 0;
};
class DAGR_Menu_Text {
type = 0;
idc = -1;
style = 0x00;
x = 0.5;
y = 0.5;
w = 0.15;
h = 0.15;
colorBackground[] = { 0, 0, 0, 0 };
colorText[] = { 0.239, 0.216, 0.153, 1 };
font = "PuristaMedium";
sizeEx = 0.03;
waitForLoad = 0;
text = "";
};
class DAGR_Menu {
idd = 266860;
movingEnable = false;
duration = 100000;
fadein = 0;
fadeout = 0;
name = "Dagr_Menu";
onLoad = "uiNamespace setVariable ['DAGR_Menu', _this select 0]";
onUnload = QUOTE(GVAR(PWR) = true); // Simulate pressing the power button
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",
"DAGR_MENU_SELECTION3", "DAGR_MENU_SELECTION4", "DAGR_MENU_Main_Text", "DAGR_MENU_PSELECTION1", "DAGR_MENU_PSELECTION2", "DAGR_MENU_PSELECTION3",
"DAGR_MENU_PSELECTION4", "DAGR_MENU_PSELECTION5", "DAGR_MENU_PSELECTION6","DAGR_MENU_PSELECTION7", "DAGR_MENU_PSELECTION8"};
class DAGR_MENU_UI : DAGR_Menu_Pic {
idc = 266861;
x = 0.175;
y = -0.173;
text = QUOTE(PATHTOF(UI\dagr_menu.paa));
sizeEx = 0.1;
};
class DAGR_PWR_Button : DAGR_Button {
idc = 266863;
action = QUOTE(GVAR(PWR) = true);
x = 0.40;
y = 0.65;
};
class DAGR_UP_Button : DAGR_Button {
idc = 266864;
action = QUOTE(GVAR(UP) = true);
x = 0.50;
y = 0.675;
};
class DAGR_DOWN_Button : DAGR_Button {
idc = 266865;
action = QUOTE(GVAR(DOWN) = true);
x = 0.50;
y = 0.81;
};
class DAGR_LEFT_Button : DAGR_Button {
idc = 266866;
action = QUOTE(GVAR(LEFT) = true);
x = 0.40;
y = 0.735;
w = 0.05;
h = 0.07;
};
class DAGR_RIGHT_Button : DAGR_Button {
idc = 266867;
action = QUOTE(GVAR(RIGHT) = true);
x = 0.62;
y = 0.735;
w = 0.05;
h = 0.07;
};
class DAGR_NEXT_Button : DAGR_Button {
idc = 266868;
action = QUOTE(DAGR_NEXT = true);
x = 0.60;
y = 0.65;
};
class DAGR_SEL_Button : DAGR_Button {
idc = 266869;
action = QUOTE(GVAR(SEL) = true);
x = 0.54;
y = 0.735;
w = 0.06;
h = 0.06;
};
class DAGR_MENU_Button : DAGR_Button {
idc = 266870;
action = QUOTE(GVAR(MENU_B) = true);
x = 0.46;
y = 0.735;
w = 0.06;
h = 0.06;
};
class DAGR_F1_Button : DAGR_Button {
idc = 266871;
action = QUOTE(GVAR(F1) = true);
x = 0.40;
y = 0.575;
};
class DAGR_F2_Button : DAGR_Button {
idc = 266872;
action = QUOTE(GVAR(F2) = true);
x = 0.495;
y = 0.575;
};
class DAGR_F3_Button : DAGR_Button {
idc = 266873;
action = QUOTE(GVAR(F3) = true);
x = 0.59;
y = 0.575;
};
class DAGR_F1_Text : DAGR_Menu_Text {
idc = 266874;
x = 0.388;
y = 0.38;
text = "";
};
class DAGR_F2_Text : DAGR_Menu_Text {
idc = 266875;
x = 0.506;
y = 0.38;
};
class DAGR_F3_Text : DAGR_Menu_Text {
idc = 266876;
x = 0.612;
y = 0.38;
};
class DAGR_MENU_OPTION0 : DAGR_Menu_Text {
idc = 2668777;
style = 0x02;
sizeEx = 0.035;
x = 0.43;
y = 0.19;
};
class DAGR_MENU_OPTION1 : DAGR_Menu_Text {
idc = 2668778;
style = 0x02;
sizeEx = 0.035;
x = 0.43;
y = 0.225;
};
class DAGR_MENU_OPTION2 : DAGR_Menu_Text {
idc = 2668779;
style = 0x02;
sizeEx = 0.035;
x = 0.43;
y = 0.26;
};
class DAGR_MENU_OPTION3 : DAGR_Menu_Text {
idc = 2668780;
style = 0x02;
sizeEx = 0.035;
x = 0.43;
y = 0.295;
};
class DAGR_MENU_OPTION4 : DAGR_Menu_Text {
idc = 2668781;
style = 0x02;
sizeEx = 0.035;
x = 0.43;
y = 0.33;
};
class DAGR_MENU_SELECTION0 : DAGR_Menu_Pic {
idc = 2668783;
x = 0.42;
y = 0.246;
w = 0.17;
h = 0.035;
sizeEx = 0.05;
};
class DAGR_MENU_SELECTION1 : DAGR_Menu_Pic {
idc = 2668784;
x = 0.42;
y = 0.281;
w = 0.17;
h = 0.035;
sizeEx = 0.05;
};
class DAGR_MENU_SELECTION2 : DAGR_Menu_Pic {
idc = 2668785;
x = 0.42;
y = 0.316;
w = 0.17;
h = 0.035;
sizeEx = 0.05;
};
class DAGR_MENU_SELECTION3 : DAGR_Menu_Pic {
idc = 2668786;
x = 0.42;
y = 0.351;
w = 0.17;
h = 0.035;
sizeEx = 0.05;
};
class DAGR_MENU_SELECTION4 : DAGR_Menu_Pic {
idc = 2668787;
x = 0.42;
y = 0.386;
w = 0.17;
h = 0.035;
sizeEx = 0.05;
};
class DAGR_MENU_Main_Text : DAGR_Menu_Text {
idc = 2668782;
style = ST_CENTER;
x = 0.38;
y = 0.32;
w = 0.25;
h = 0.035;
sizeEx = 0.04;
};
class DAGR_MENU_PSELECTION1 : DAGR_Menu_Pic {
idc = 2668788;
x = 0.451;
y = 0.352;
w = 0.01;
h = 0.003;
};
class DAGR_MENU_PSELECTION2 : DAGR_Menu_Pic {
idc = 2668789;
x = 0.465;
y = 0.352;
w = 0.01;
h = 0.003;
};
class DAGR_MENU_PSELECTION3 : DAGR_Menu_Pic {
idc = 2668790;
x = 0.479;
y = 0.352;
w = 0.01;
h = 0.003;
};
class DAGR_MENU_PSELECTION4 : DAGR_Menu_Pic {
idc = 2668791;
x = 0.493;
y = 0.352;
w = 0.01;
h = 0.003;
};
class DAGR_MENU_PSELECTION5 : DAGR_Menu_Pic {
idc = 2668792;
x = 0.507;
y = 0.352;
w = 0.01;
h = 0.003;
};
class DAGR_MENU_PSELECTION6 : DAGR_Menu_Pic {
idc = 2668793;
x = 0.521;
y = 0.352;
w = 0.01;
h = 0.003;
};
class DAGR_MENU_PSELECTION7 : DAGR_Menu_Pic {
idc = 2668794;
x = 0.535;
y = 0.352;
w = 0.01;
h = 0.003;
};
class DAGR_MENU_PSELECTION8 : DAGR_Menu_Pic {
idc = 2668795;
x = 0.549;
y = 0.352;
w = 0.01;
h = 0.003;
};
};

10
addons/dagr/README.md Normal file
View File

@ -0,0 +1,10 @@
ace_dagr
===============
Defense Advanced GPS Receiver
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [Ruthberg] (http://github.com/Ulteq)

95
addons/dagr/RscTitles.hpp Normal file
View File

@ -0,0 +1,95 @@
class RscTitles {
class DAGR_Text {
type = 0;
idc = -1;
style = 0x01;
x = 0;
y = 0;
w = 0.15;
h = 0.050;
text = "";
colorBackground[] = { 0, 0, 0, 0 };
colorText[] = { 0.239, 0.216, 0.153, 1 };
font = "PuristaMedium";
sizeEx = 0.04;
waitForLoad = 0;
};
class DAGR_Pic {
type = 0;
idc = -1;
style = 48;
x = 0;
y = 0;
w = 0.50;
h = 0.50;
text = "";
colorBackground[] = {};
colorText[] = {};
font = "PuristaMedium";
sizeEx = 0.02;
waitForLoad = 0;
};
class DAGR_Display {
idd = 266850;
movingEnable = false;
duration = 100000;
fadein = 0;
fadeout = 0;
name = "Dagr_Display";
onLoad="uiNamespace setVariable ['DAGR_Display', _this select 0]";
controls[] = {"DAGR_UI", "DAGR_Grid", "DAGR_Speed", "DAGR_Elevation", "DAGR_Heading", "DAGR_Time", "DAGR_WP", "DAGR_Bearing", "DAGR_DIST"};
class DAGR_UI : DAGR_Pic {
idc = 266856;
x = "(SafeZoneW + SafeZoneX) - 0.45";
y = "(SafeZoneH + SafeZoneY) - 0.47";
};
class DAGR_Grid : DAGR_Text {
idc = 266851;
x = "(SafeZoneW + SafeZoneX) - 0.370";// 0.830
y = "(SafeZoneH + SafeZoneY)- 0.250";// 0.845
w = 0.25;
h = 0.06;
sizeEx = 0.07;
};
class DAGR_Speed : DAGR_Text {
idc = 266852;
x = "(SafeZoneW + SafeZoneX) - 0.388"; //0.812
y = "(SafeZoneH + SafeZoneY) - 0.181"; //0.914
};
class DAGR_Elevation : DAGR_Text {
idc = 266853;
x = "(SafeZoneW + SafeZoneX) - 0.270"; //0.930
y = "(SafeZoneH + SafeZoneY) - 0.181"; //0.914
};
class DAGR_Heading : DAGR_Text {
idc = 266854;
x = "(SafeZoneW + SafeZoneX) - 0.413"; //0.787
y = "(SafeZoneH + SafeZoneY) - 0.1294"; //0.9656
};
class DAGR_Time : DAGR_Text {
idc = 266855;
x = "(SafeZoneW + SafeZoneX) - 0.275"; //0.925
y = "(SafeZoneH + SafeZoneY) - 0.129"; //0.965
};
class DAGR_WP : DAGR_Text {
idc = 266857;
x = "(SafeZoneW + SafeZoneX) - 0.235"; //0.965
y = "(SafeZoneH + SafeZoneY) - 0.181"; //0.914
};
class DAGR_Bearing : DAGR_Text {
idc = 266858;
x = "(SafeZoneW + SafeZoneX) - 0.413"; //0.787
y = "(SafeZoneH + SafeZoneY) - 0.181"; //0.914
};
class DAGR_DIST : DAGR_Text {
idc = 266859;
x = "(SafeZoneW + SafeZoneX) - 0.265"; //0.935
y = "(SafeZoneH + SafeZoneY) - 0.129"; //0.965
};
};
};

Binary file not shown.

BIN
addons/dagr/UI/DAGR_GPS.paa Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
addons/dagr/UI/DAGR_WP.paa Normal file

Binary file not shown.

View File

@ -0,0 +1,28 @@
#include "script_component.hpp"
#include "initKeybinds.sqf"
GVAR(run) = false;
GVAR(menuRun) = false;
GVAR(useDegrees) = true;
GVAR(updateInterval) = 0.5;
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;
GVAR(displaySelection) = "DATA";
GVAR(vectorConnected) = false;
GVAR(noVectorData) = true;
GVAR(vectorGrid) = "00000000";
["RangerfinderData", {_this call FUNC(handleRangeFinderData)}] call EFUNC(common,addEventHandler);

View File

@ -0,0 +1,12 @@
#include "script_component.hpp"
ADDON = false;
PREP(handleRangeFinderData);
PREP(menuInit);
PREP(outputData);
PREP(outputVector);
PREP(outputWP);
PREP(toggleOverlay);
ADDON = true;

18
addons/dagr/config.cpp Normal file
View File

@ -0,0 +1,18 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {"ACE_Item_DAGR"};
weapons[] = {"ACE_DAGR"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_weather"};
author[] = {"Rosuto", "Ruthberg"};
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "Dialog.hpp"
#include "RscTitles.hpp"

View File

@ -0,0 +1,30 @@
/*
* Author: Rosuto, Ruthberg
* Handles incoming data packets from the Vectronix Vector LRF
*
* Arguments:
* 0: Slope distance (Meters) <NUMBER>
* 1: Azimuth (Degrees) <NUMBER>
* 2: Inclination (Degrees) <NUMBER>
*
* Return Value:
* Nothing
*
* Example:
* [1000, 45, 1] call ace_dagr_fnc_handleRangeFinderData
*
* Public: No
*/
#include "script_component.hpp"
#define EMP_RF_ACC 5 // Rangefinder Accuracy
PARAMS_3(_slopeDistance,_azimuth,_inclination);
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;
GVAR(noVectorData) = false;
};

View File

@ -0,0 +1,607 @@
/*
* Author: Rosuto, Ruthberg
* Creates the DAGR menu dialog
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
#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;
GVAR(PWR) = false;
GVAR(menuRun) = true;
[{
if (!dialog || GVAR(PWR)) exitWith {
closeDialog 266860;
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);
};
if (GVAR(UP)) then {
GVAR(selection) = (GVAR(numSelections) + GVAR(selection) - 1);
};
GVAR(selection) = if (GVAR(numSelections) > 0) then { GVAR(selection) % GVAR(numSelections) } else { 0 };
};
if (GVAR(LEFT)) then {
GVAR(pointer) = (8 + GVAR(pointer) - 1);
};
if (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(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 (GVAR(F3)) then {
GVAR(menu) = "options"; GVAR(numSelections) = 2;
};
if (GVAR(DOWN)) then {
GVAR(tmpUpdateRate) = GVAR(tmpUpdateRate) - 0.1;
};
if (GVAR(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 {
GVAR(F3) = false;
GVAR(F2) = false;
GVAR(F1) = false;
GVAR(MENU_B) = false;
GVAR(SEL) = false;
DAGR_NEXT = false;
GVAR(RIGHT) = false;
GVAR(LEFT) = false;
GVAR(UP) = false;
GVAR(DOWN) = false;
GVAR(PWR) = false;
};
}, 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,117 @@
/*
* Author: Rosuto
* DAGR data output loop
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
#define __display (uiNameSpace getVariable "DAGR_DISPLAY")
#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)
__background ctrlSetText QUOTE(PATHTOF(UI\dagr_gps.paa));
[{
private ["_pos", "_mapSize", "_gridConfig", "_offsetX", "_offsetY", "_stepX", "_stepY", "_xgrid", "_ygrid", "_xcoord", "_ycoord", "_speed", "_dagrHeading", "_dagrGrid", "_dagrElevation", "_dagrSpeed", "_dagrTime", "_elevation"];
// Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
135471 cutText ["", "PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
// GRID
_pos = getPosASL ACE_player;
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
_gridConfig = (configFile >> "CfgWorlds" >> worldName >> "Grid");
_offsetX = getNumber (_gridConfig >> "offsetX");
_offsetY = getNumber (_gridConfig >> "offsetY");
_stepX = getNumber (_gridConfig >> "Zoom1" >> "stepX");
_stepY = getNumber (_gridConfig >> "Zoom1" >> "stepY");
if (_stepY >= 0) then {
_pos set [1, (_mapSize - 100) - (_pos select 1) - _offsetY];
};
// 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];};
_xGrid = toArray Str(round(_pos select 0));
while {count _xGrid < 5} do {
_xGrid = [48] + _xGrid;
};
_xGrid resize 4;
_xGrid = toString _xGrid;
_xGrid = parseNumber _xGrid;
_yGrid = toArray Str(round(_pos select 1));
while {count _yGrid < 5} do {
_yGrid = [48] + _yGrid;
};
_yGrid resize 4;
_yGrid = toString _yGrid;
_yGrid = parseNumber _yGrid;
_xCoord = switch true do {
case (_xGrid >= 1000): { "" + Str(_xGrid) };
case (_xGrid >= 100): { "0" + Str(_xGrid) };
case (_xGrid >= 10): { "00" + Str(_xGrid) };
default { "000" + Str(_xGrid) };
};
_yCoord = switch true do {
case (_yGrid >= 1000): { "" + Str(_yGrid) };
case (_yGrid >= 100): { "0" + Str(_yGrid) };
case (_yGrid >= 10): { "00" + Str(_yGrid) };
default { "000" + Str(_yGrid) };
};
_dagrGrid = _xcoord + " " + _ycoord;
// SPEED
_speed = speed (vehicle ACE_player);
_speed = floor (_speed * 10) / 10;
_speed = abs(_speed);
_dagrspeed = str _speed + "kph";
// Elevation
_elevation = getPosASL ACE_player;
_elevation = floor ((_elevation select 2) + EGVAR(weather,altitude));
_dagrElevation = str _elevation + "m";
// Heading
_dagrHeading = if (!GVAR(useDegrees)) then {
floor (DEG_TO_MIL(direction (vehicle ACE_player)))
} else {
floor (direction (vehicle ACE_player))
};
// Time
_dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
// Output
__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] });
__timeControl ctrlSetText format ["%1", _dagrTime];
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,98 @@
/*
* Author: Rosuto
* DAGR vector output loop
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
private ["_pos", "_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"];
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
#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)
__background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa));
if (GVAR(noVectorData)) exitwith {};
_pos = [GVAR(LAZPOS) select 0, GVAR(LAZPOS) select 1];
// 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];};
// Find laser position
_xGrid = toArray Str(round(_pos select 0));
while {count _xGrid < 5} do {
_xGrid = [48] + _xGrid;
};
_xGrid resize 4;
_xGrid = toString _xGrid;
_xGrid = parseNumber _xGrid;
_yGrid = toArray Str(round(_pos select 1));
while {count _yGrid < 5} do {
_yGrid = [48] + _yGrid;
};
_yGrid resize 4;
_yGrid = toString _yGrid;
_yGrid = parseNumber _yGrid;
_xCoord = switch true do {
case (_xGrid >= 1000): { "" + Str(_xGrid) };
case (_xGrid >= 100): { "0" + Str(_xGrid) };
case (_xGrid >= 10): { "00" + Str(_xGrid) };
default { "000" + Str(_xGrid) };
};
_yCoord = switch true do {
case (_yGrid >= 1000): { "" + Str(_yGrid) };
case (_yGrid >= 100): { "0" + Str(_yGrid) };
case (_yGrid >= 10): { "00" + Str(_yGrid) };
default { "000" + Str(_yGrid) };
};
_dagrGrid = _xCoord + " " + _yCoord;
// Find target elevation
_elevation = floor ((GVAR(LAZPOS) select 2) + EGVAR(weather,altitude));
_dagrElevation = str _elevation + "m";
// Time
_dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
// Bearing
_bearing = GVAR(LAZHEADING);
if (_bearing >= 360) then {_bearing = _bearing - 360;};
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
GVAR(vectorGrid) = _dagrGrid;
// OUTPUT
__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] });
__timeControl ctrlSetText format ["%1", _dagrTime];

View File

@ -0,0 +1,133 @@
/*
* Author: Rosuto
* DAGR waypoint output loop
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
#define __display (uiNameSpace getVariable "DAGR_DISPLAY")
#define __gridControl (__display displayCtrl 266851)
#define __speedControl (__display displayCtrl 266858)
#define __elevationControl (__display displayCtrl 266857)
#define __headingControl (__display displayCtrl 266854)
#define __timeControl (__display displayCtrl 266859)
#define __background (__display displayCtrl 266856)
__background ctrlSetText QUOTE(PATHTOF(UI\dagr_wp.paa));
[{
private ["_pos", "_mapSize", "_gridConfig", "_offsetX", "_offsetY", "_stepX", "_stepY", "_xGrid", "_yGrid", "_xCoord", "_yCoord", "_dagrHeading", "_dagrGrid", "_bearing", "_MYpos", "_WPpos", "_dagrDistance", "_distance"];
// Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
135471 cutText ["", "PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
// GRID
_pos = getPosASL ACE_player;
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
_gridConfig = (configFile >> "CfgWorlds" >> worldName >> "Grid");
_offsetX = getNumber (_gridConfig >> "offsetX");
_offsetY = getNumber (_gridConfig >> "offsetY");
_stepX = getNumber (_gridConfig >> "Zoom1" >> "stepX");
_stepY = getNumber (_gridConfig >> "Zoom1" >> "stepY");
if (_stepY >= 0) then {
_pos set [1, (_mapSize - 100) - (_pos select 1) - _offsetY];
};
// 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];};
_xGrid = toArray Str(round(_pos select 0));
while {count _xGrid < 5} do {
_xGrid = [48] + _xGrid;
};
_xGrid resize 4;
_xGrid = toString _xGrid;
_xGrid = parseNumber _xGrid;
_yGrid = toArray Str(round(_pos select 1));
while {count _yGrid < 5} do {
_yGrid = [48] + _yGrid;
};
_yGrid resize 4;
_yGrid = toString _yGrid;
_yGrid = parseNumber _yGrid;
_xCoord = switch true do {
case (_xGrid >= 1000): { "" + Str(_xGrid) };
case (_xGrid >= 100): { "0" + Str(_xGrid) };
case (_xGrid >= 10): { "00" + Str(_xGrid) };
default { "000" + Str(_xGrid) };
};
_yCoord = switch true do {
case (_yGrid >= 1000): { "" + Str(_yGrid) };
case (_yGrid >= 100): { "0" + Str(_yGrid) };
case (_yGrid >= 10): { "00" + Str(_yGrid) };
default { "000" + Str(_yGrid) };
};
_dagrGrid = _xCoord + " " + _yCoord;
// 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) };
case (_xGrid2 >= 10): { "00" + Str(_xGrid2) };
default { "000" + Str(_xGrid2) };
};
_yCoord2 = switch true do {
case (_yGrid2 >= 1000): { "" + Str(_yGrid2) };
case (_yGrid2 >= 100): { "0" + Str(_yGrid2) };
case (_yGrid2 >= 10): { "00" + Str(_yGrid2) };
default { "000" + Str(_yGrid2) };
};
_dagrGrid2 = _xCoord2 + " " + _yCoord2;
// Distance
_WPpos = [[_xCoord2, _yCoord2], true] call CBA_fnc_mapGridToPos;
_MYpos = [[_xCoord, _yCoord], true] call CBA_fnc_mapGridToPos;
_distance = _MYpos distance _WPpos;
_distance = floor (_distance * 10) / 10;
_dagrDistance = str _distance + "m";
// Heading
_dagrHeading = floor (if (GVAR(useDegrees)) then {
direction (vehicle ACE_player)
} else {
DEG_TO_MIL(direction (vehicle ACE_player))
});
// 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] });
__timeControl ctrlSetText format ["%1", _dagrDistance];
}, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,40 @@
/*
* Author: Rosuto, Ruthberg
* Toggles the DAGR overlay
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
if (cameraView == "GUNNER") exitWith {};
GVAR(run) = !GVAR(run);
if (GVAR(run)) then {
switch (toUpper GVAR(displaySelection)) do {
case "WP" : {
call FUNC(outputWP);
};
case "VECTOR" : {
call FUNC(outputVector);
};
case "DATA" : {
call FUNC(outputData);
};
};
[{
EXPLODE_1_PVT(_this select 0,_vehicle);
if (!GVAR(run) || (!alive ACE_player) || (cameraView == "GUNNER") || (vehicle ACE_player != _vehicle)) exitWith {
135471 cutText ["", "PLAIN"];
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
}, 0.1, [vehicle ACE_player]] call CBA_fnc_addPerFrameHandler;
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\dagr\script_component.hpp"

View File

@ -0,0 +1,30 @@
["ACE3 Equipment", QGVAR(MenuKey), "Configure DAGR",
{
// Conditions: canInteract
if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
if !([_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {false};
// Statement
if (!GVAR(menuRun)) then {
[] call FUNC(menuInit);
} else {
GVAR(PWR) = true; // Simulate pressing the power button
};
true
},
{false},
[199, [false, true, false]], false] call cba_fnc_addKeybind; // (CTRL + Home)
["ACE3 Equipment", QGVAR(ToggleKey), "Toggle DAGR",
{
// Conditions: canInteract
if !([ACE_player, objNull, ["notOnMap", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
if !([_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {false};
// Statement
[] call FUNC(toggleOverlay);
true
},
{false},
[199, [false, false, false]], false] call cba_fnc_addKeybind; // (Home)

View File

@ -0,0 +1,15 @@
#define COMPONENT dagr
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_DAGR
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_DAGR
#define DEBUG_SETTINGS DEBUG_SETTINGS_DAGR
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define DEG_TO_MIL(d) (d / 360 * 6400)
#define MIL_TO_DEG(d) (d / 6400 * 360)

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="DAGR">
</Package>
</Project>