Initial draft of the ACE2 DAGR port

This commit is contained in:
ulteq 2015-06-07 17:53:37 +02:00
parent 5b3fd31b1b
commit eae8c8cae2
30 changed files with 9178 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(DAGR_MENU_INIT));
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(DAGR_START));
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;
};
};
};

7936
addons/dagr/DAGR_MENU.fsm Normal file

File diff suppressed because it is too large Load Diff

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

@ -0,0 +1,423 @@
// 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]";
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 = "DAGR_PWR = true";
x = 0.40;
y = 0.65;
};
class DAGR_UP_Button : DAGR_Button {
idc = 266864;
action = "DAGR_UP = true";
x = 0.50;
y = 0.675;
};
class DAGR_DOWN_Button : DAGR_Button {
idc = 266865;
action = "DAGR_Down = true";
x = 0.50;
y = 0.81;
};
class DAGR_LEFT_Button : DAGR_Button {
idc = 266866;
action = "DAGR_LEFT = true";
x = 0.40;
y = 0.735;
w = 0.05;
h = 0.07;
};
class DAGR_RIGHT_Button : DAGR_Button {
idc = 266867;
action = "DAGR_RIGHT = true";
x = 0.62;
y = 0.735;
w = 0.05;
h = 0.07;
};
class DAGR_NEXT_Button : DAGR_Button {
idc = 266868;
action = "DAGR_NEXT = true";
x = 0.60;
y = 0.65;
};
class DAGR_SEL_Button : DAGR_Button {
idc = 266869;
action = "DAGR_SEL = true";
x = 0.54;
y = 0.735;
w = 0.06;
h = 0.06;
};
class DAGR_MENU_Button : DAGR_Button {
idc = 266870;
action = "DAGR_MENU_B = true";
x = 0.46;
y = 0.735;
w = 0.06;
h = 0.06;
};
class DAGR_F1_Button : DAGR_Button {
idc = 266871;
action = "DAGR_F1 = true";
x = 0.40;
y = 0.575;
};
class DAGR_F2_Button : DAGR_Button {
idc = 266872;
action = "DAGR_F2 = true";
x = 0.495;
y = 0.575;
};
class DAGR_F3_Button : DAGR_Button {
idc = 266873;
action = "DAGR_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"
DAGR_RUN = false;
DAGR_STP = false;
DAGR_MENU_RUN = false;
Dagr_Map_Info = "default";
DAGR_DIRECTION = true; // true -> degrees; false -> milliradian
DAGR_GRID_VECTOR = "00000000"; // Default
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;
DAGRSLEEP = 0.5; // Update timer on DAGR, set for 0.5 seconds
DAGR_EMPTYVECTOR = true; // Keeps DAGR Vector display from filling up before use
DAGR_DISPLAY_SELECTION = "DATA"; // Sets DAGR for data display
NODAGRDISPLAY = true;
["RangerfinderData", {_this call FUNC(DAGR_VECTOR)}] call EFUNC(common,addEventHandler);

View File

@ -0,0 +1,13 @@
#include "script_component.hpp"
ADDON = false;
PREP(DAGR_MENU_INIT);
PREP(DAGR_OUTPUT_DATA);
PREP(DAGR_OUTPUT_VECTOR);
PREP(DAGR_OUTPUT_WP);
PREP(DAGR_START);
PREP(DAGR_VECTOR);
PREP(mapCoord);
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,31 @@
/*
* Author: Rosuto, Ruthberg
* Creates the DAGR menu dialog
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
[] spawn {
if (DAGR_MENU_RUN) then {
closeDialog 266860;
DAGR_PWR = true;
sleep 0.1;
};
135471 cutText ["", "PLAIN"];
DAGR_RUN = false;
DAGR_STP = false;
DAGR_MENU_RUN = true;
DAGR_Menu_Handler = [] execFSM QUOTE(PATHTOF(DAGR_MENU.fsm));
};

View File

@ -0,0 +1,121 @@
/*
* Author: Rosuto
* DAGR data output loop
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
disableSerialization;
private ["_pos", "_x", "_y", "_xgrid", "_pos", "_ygrid", "_lastY", "_lastX", "_xcoord", "_ycoord", "_display", "_speed", "_vic", "_dagrHeading", "_dagrGrid", "_background", "_dagrElevation", "_dagrSpeed", "_dagrTime", "_elevation", "_elevationControl", "_grid", "_gridControl", "_headingControl", "_speedControl", "_timeControl"];
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
_display = (uiNameSpace getVariable "DAGR_DISPLAY");
_gridControl = _display displayCtrl 266851;
_speedControl = _display displayCtrl 266852;
_elevationControl = _display displayCtrl 266853;
_headingControl = _display displayCtrl 266854;
_timeControl = _display displayCtrl 266855;
_background = _display displayCtrl 266856;
_background ctrlSetText QUOTE(PATHTOF(UI\dagr_gps.paa));
while {DAGR_RUN} do {
if (Dagr_Map_Info == "default") then {
_dagrGrid = mapGridPosition ACE_player;
} else {
//GRID
_pos = getPos ACE_player;
_x = _pos select 0;
_y = _pos select 1;
_grid = ACE_player call FUNC(mapCoord);
_xgrid = floor (call compile (_grid select 0));
_ygrid = floor (call compile (_grid select 1));
//Incase grids go neg due to 99-00 boundry
if (_xgrid < 0) then {_xgrid = _xgrid + 9999;};
if (_ygrid < 0) then {_ygrid = _ygrid + 9999;};
_xcoord =
if (_xgrid >= 1000) then {
str _xgrid;
} else {
if (_xgrid >= 100) then {
"0" + str _xgrid;
} else {
if (_xgrid >= 10) then {
"00" + str _xgrid;
} else{
"000" + str _xgrid;
};
};
};
_ycoord =
if (_ygrid >= 1000) then {
str _ygrid;
} else {
if (_ygrid >= 100) then {
"0" + str _ygrid;
} else {
if (_ygrid >= 10) then {
"00" + str _ygrid;
} else{
"000" + str _ygrid;
};
};
};
_dagrGrid = _xcoord + " " + _ycoord;
};
//SPEED
if (vehicle ACE_player != ACE_player) then {
_vic = vehicle ACE_player;
_speed = speed _vic;
} else{
_speed = speed 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
if (vehicle ACE_player != ACE_player) then {
_vic = vehicle ACE_player;
_dagrHeading = if (!DAGR_DIRECTION) then {floor ((direction _vic)/360*6400)} else {floor (direction _vic);};
} else{
_dagrHeading = if (!DAGR_DIRECTION) then {floor ((direction ACE_player)/360*6400)} else {floor (direction 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 (!DAGR_DIRECTION) then { format ["%1", _dagrHeading] } else { format ["%1 °", _dagrHeading] });
_timeControl ctrlSetText format ["%1", _dagrTime];
sleep DAGRSLEEP;
if !([ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
DAGR_RUN = false;
135471 cutText ["", "PLAIN"];
};
};

View File

@ -0,0 +1,109 @@
/*
* Author: Rosuto
* DAGR vector output loop
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
disableSerialization;
private ["_x", "_y", "_xgrid", "_ygrid", "_dsp", "_dagrGrid", "_background", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_display", "_elevation", "_elevationControl", "_grid", "_gridControl", "_headingControl", "_speedControl", "_timeControl", "_xcoord", "_ycoord"];
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
_display = (uiNameSpace getVariable "DAGR_DISPLAY");
_gridControl = _display displayCtrl 266851;
_speedControl = _display displayCtrl 266858;
_elevationControl = _display displayCtrl 266853;
_headingControl = _display displayCtrl 266854;
_timeControl = _display displayCtrl 266855;
_background = _display displayCtrl 266856;
_background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa));
if (NODAGRDISPLAY) exitwith {};
if (Dagr_Map_Info == "default") then {
_dagrGrid = mapGridPosition DAGRLAZPOS;
} else {
//find laser position
_x = DAGRLAZPOS select 0;
_y = DAGRLAZPOS select 1;
_grid = [_x, _y] call ace_fnc_mapCoord;
_xgrid = floor (call compile (_grid select 0));
_ygrid = floor (call compile (_grid select 1));
//Incase grids go neg due to 99-00 boundry
if (_xgrid < 0) then {_xgrid = _xgrid + 9999;};
if (_ygrid < 0) then {_ygrid = _ygrid + 9999;};
_xcoord =
if (_xgrid >= 1000) then {
str _xgrid;
} else {
if (_xgrid >= 100) then {
"0" + str _xgrid;
} else {
if (_xgrid >= 10) then {
"00" + str _xgrid;
}else{
"000" + str _xgrid;
};
};
};
_ycoord =
if (_ygrid >= 1000) then {
str _ygrid;
} else {
if (_ygrid >= 100) then {
"0" + str _ygrid;
} else {
if (_ygrid >= 10) then {
"00" + str _ygrid;
}else{
"000" + str _ygrid;
};
};
};
_dagrGrid = _xcoord + " " + _ycoord;
};
//find target elevation
_elevation = floor ((DAGRLAZPOS select 2) + EGVAR(weather,altitude));
_dagrElevation = str _elevation + "m";
//Time
_dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
//Bearing
_bearing = DAGRLazHeading;
if (_bearing >= 360) then {_bearing = _bearing - 360;};
if (!DAGR_DIRECTION) then {_bearing = floor (_bearing/360*6400)};
_bearing = floor (_bearing);
//Distance
_dagrDist = str DAGRLAZDIST + "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;
//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] });
_timeControl ctrlSetText format ["%1", _dagrTime];

View File

@ -0,0 +1,172 @@
/*
* Author: Rosuto
* DAGR waypoint output loop
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
disableSerialization;
private ["_pos", "_x", "_y", "_xgrid", "_ygrid", "_lastY", "_lastX", "_xcoord", "_ycoord", "_sec", "_min", "_hour", "_time", "_display", "_speed", "_vic", "_dagrHeading", "_WPHeading", "_dagrGrid", "_bearing", "_MYpos", "_WPpos", "_background", "_dagrDistance", "_distance", "_elevationControl", "_grid", "_gridControl", "_headingControl", "_speedControl", "_timeControl"];
135471 cutRsc ["DAGR_DISPLAY", "plain down"];
_display = (uiNameSpace getVariable "DAGR_DISPLAY");
_gridControl = _display displayCtrl 266851;
_speedControl = _display displayCtrl 266858;
_elevationControl = _display displayCtrl 266857;
_headingControl = _display displayCtrl 266854;
_timeControl = _display displayCtrl 266859;
_background = _display displayCtrl 266856;
_background ctrlSetText QUOTE(PATHTOF(UI\dagr_wp.paa));
while {DAGR_RUN} do {
//if (Dagr_Map_Info == "default") exitwith {_gridControl ctrlSetText "ERROR"};
//GRID
_pos = getPos ACE_player;
_x = _pos select 0;
_y = _pos select 1;
_grid = ACE_player call FUNC(mapCoord);
_xgrid = floor (call compile (_grid select 0));
_ygrid = floor (call compile (_grid select 1));
//Incase grids go neg due to 99-00 boundry
if (_xgrid < 0) then {_xgrid = _xgrid + 9999;};
if (_ygrid < 0) then {_ygrid = _ygrid + 9999;};
_xcoord =
if (_xgrid >= 1000) then {
str _xgrid;
} else {
if (_xgrid >= 100) then {
"0" + str _xgrid;
} else {
if (_xgrid >= 10) then {
"00" + str _xgrid;
}else{
"000" + str _xgrid;
};
};
};
_ycoord =
if (_ygrid >= 1000) then {
str _ygrid;
} else {
if (_ygrid >= 100) then {
"0" + str _ygrid;
} else {
if (_ygrid >= 10) then {
"00" + str _ygrid;
}else{
"000" + str _ygrid;
};
};
};
_dagrGrid = _xcoord + " " + _ycoord;
//WP Grid
_xgrid2 = floor (DAGR_WP_INFO / 10000);
_ygrid2 = DAGR_WP_INFO - _xgrid2 * 10000;
_xcoord2 =
if (_xgrid2 >= 1000) then {
str _xgrid2;
} else {
if (_xgrid2 >= 100) then {
"0" + str _xgrid2;
} else {
if (_xgrid2 >= 10) then {
"00" + str _xgrid2;
}else{
"000" + str _xgrid2;
};
};
};
_ycoord2 =
if (_ygrid2 >= 1000) then {
str _ygrid2;
} else {
if (_ygrid2 >= 100) then {
"0" + str _ygrid2;
} else {
if (_ygrid2 >= 10) then {
"00" + str _ygrid2;
}else{
"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);
_distance = _distance / 10;
_dagrDistance = str _distance + "m";
//ACE_player Heading
if (vehicle ACE_player != ACE_player) then {
_vic = vehicle ACE_player;
if (DAGR_DIRECTION) then {
_dagrHeading = floor (direction _vic);
} else {
_dagrHeading = floor ((direction _vic)/360*6400);
};
}else{
if (DAGR_DIRECTION) then {
_dagrHeading = floor (direction ACE_player);
} else {
_dagrHeading = floor ((direction ACE_player)/360*6400);
};
};
//WP Heading
_x = ((_WPpos select 0) - (_MYpos select 0));
_y = ((_WPpos select 1) - (_MYpos select 1));
if (_distance == 0) then {
_bearing = 0;
} else {
_bearing = _x / _distance;
if (_bearing >= 1) then {_bearing = 1;};
if (_bearing <= -1) then {_bearing = -1;};
_bearing = acos _bearing;
//_bearing = floor (_bearing);
if (_x >= 0 && {_y >= 0}) then {_bearing = 0 - _bearing + 90;};
if (_x < 0 && {_y >= 0}) then {_bearing = 0 - _bearing + 450;};
if (_x < 0 && {_y < 0}) then {_bearing = _bearing + 90;};
if (_x >= 0 && {_y < 0}) then {_bearing = _bearing + 90;};
if (!DAGR_DIRECTION) then {_bearing = floor (_bearing/360*6400)} else {_bearing = floor (_bearing)};
};
//output
_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] });
_timeControl ctrlSetText format ["%1", _dagrDistance];
sleep DAGRSLEEP;
if !([ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
DAGR_RUN = false;
135471 cutText ["", "PLAIN"];
};
};

View File

@ -0,0 +1,44 @@
/*
* Author: Rosuto, Ruthberg
* Toggles the DAGR overlay
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
if (cameraView == "GUNNER") exitWith {};
DAGR_RUN = !DAGR_RUN;
if (DAGR_RUN) then {
switch (toUpper DAGR_DISPLAY_SELECTION) do {
case "WP" : {
[] spawn FUNC(DAGR_OUTPUT_WP);
};
case "VECTOR" : {
[] spawn FUNC(DAGR_OUTPUT_VECTOR);
};
case "DATA" : {
[] spawn FUNC(DAGR_OUTPUT_DATA);
};
};
[{
EXPLODE_1_PVT(_this select 0,_vehicle);
if (DAGR_STP || (!alive ACE_player) || (cameraView == "GUNNER") || (vehicle ACE_player != _vehicle)) exitWith {
135471 cutText ["", "PLAIN"];
DAGR_RUN = false;
DAGR_STP = false;
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
}, 0.1, [vehicle ACE_player]] call CBA_fnc_addPerFrameHandler;
} else {
DAGR_STP = true;
};

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_DAGR_VECTOR
*
* Public: No
*/
#include "script_component.hpp"
#define EMP_RF_ACC 5
PARAMS_3(_slopeDistance,_azimuth,_inclination);
if (!DAGR_EMPTYVECTOR) then {
DAGRLAZPOS = (eyePos player) vectorAdd ([_slopeDistance, _azimuth, _inclination] call CBA_fnc_polar2vect);
DAGRLAZDIST = _slopeDistance * cos(_inclination);
DAGRLAZDIST = floor(DAGRLAZDIST / EMP_RF_ACC) * EMP_RF_ACC;
DAGRLazHeading = _azimuth;
NODAGRDISPLAY = false;
};

View File

@ -0,0 +1,50 @@
/*
* Author: Rosuto, Ruthberg
* Converts any kind of position into a position string array
*
* Arguments:
* 0: position <ARRAY|OBJECT|STRING>
*
* Return Value:
* 0: x-pos <STRING>
* 1: y-pos <STRING>
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
private ["_pos", "_grid", "_xGrid", "_yGrid"];
_pos = [0, 0];
switch (typeName _this) do {
//--- Coordinates
case "ARRAY": {
_pos = _this;
};
//--- Unit
case "OBJECT": {
_pos = getPosASL _this;
};
//--- Marker
case "STRING": {
_pos = markerPos _this;
};
};
_grid = toArray (mapGridPosition _pos);
if (count _grid > 4) then {
if (count _grid > 6) then {
_xGrid = toString [_grid select 0, _grid select 1, _grid select 2, _grid select 3];
_yGrid = toString [_grid select 4, _grid select 5, _grid select 6, _grid select 7];
} else {
_xGrid = toString [_grid select 0, _grid select 1, _grid select 2];
_yGrid = toString [_grid select 3, _grid select 4, _grid select 5];
};
} else {
_xGrid = toString [_grid select 0, _grid select 1];
_yGrid = toString [_grid select 2, _grid select 3];
};
[_xGrid, _yGrid]

View File

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

View File

@ -0,0 +1,12 @@
#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"

View File

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