mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Finished the DAGR port:
* Added keybinds * Shortened the function names * Made use of the GVAR macro for all global variable names
This commit is contained in:
parent
249a55d041
commit
b3538c972f
@ -6,7 +6,7 @@ class CfgVehicles {
|
||||
class GVAR(menu) {
|
||||
displayName = "Configure DAGR";
|
||||
condition = QUOTE([ARR_2(_player,'ACE_DAGR')] call EFUNC(common,hasItem));
|
||||
statement = QUOTE(call FUNC(DAGR_MENU_INIT));
|
||||
statement = QUOTE(call FUNC(menuInit));
|
||||
showDisabled = 0;
|
||||
priority = 0.1;
|
||||
icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa));
|
||||
@ -14,7 +14,7 @@ class CfgVehicles {
|
||||
class GVAR(toggle) {
|
||||
displayName = "Toggle DAGR";
|
||||
condition = QUOTE([ARR_2(_player,'ACE_DAGR')] call EFUNC(common,hasItem));
|
||||
statement = QUOTE(call FUNC(DAGR_START));
|
||||
statement = QUOTE(call FUNC(toggleOverlay));
|
||||
showDisabled = 0;
|
||||
priority = 0.2;
|
||||
icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa));
|
||||
|
@ -145,7 +145,7 @@ class DAGR_Menu {
|
||||
fadeout = 0;
|
||||
name = "Dagr_Menu";
|
||||
onLoad = "uiNamespace setVariable ['DAGR_Menu', _this select 0]";
|
||||
onUnload = "DAGR_PWR = true";
|
||||
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",
|
||||
@ -162,28 +162,28 @@ class DAGR_Menu {
|
||||
|
||||
class DAGR_PWR_Button : DAGR_Button {
|
||||
idc = 266863;
|
||||
action = "DAGR_PWR = true";
|
||||
action = QUOTE(GVAR(PWR) = true);
|
||||
x = 0.40;
|
||||
y = 0.65;
|
||||
};
|
||||
|
||||
class DAGR_UP_Button : DAGR_Button {
|
||||
idc = 266864;
|
||||
action = "DAGR_UP = true";
|
||||
action = QUOTE(GVAR(UP) = true);
|
||||
x = 0.50;
|
||||
y = 0.675;
|
||||
};
|
||||
|
||||
class DAGR_DOWN_Button : DAGR_Button {
|
||||
idc = 266865;
|
||||
action = "DAGR_Down = true";
|
||||
action = QUOTE(GVAR(DOWN) = true);
|
||||
x = 0.50;
|
||||
y = 0.81;
|
||||
};
|
||||
|
||||
class DAGR_LEFT_Button : DAGR_Button {
|
||||
idc = 266866;
|
||||
action = "DAGR_LEFT = true";
|
||||
action = QUOTE(GVAR(LEFT) = true);
|
||||
x = 0.40;
|
||||
y = 0.735;
|
||||
w = 0.05;
|
||||
@ -192,7 +192,7 @@ class DAGR_Menu {
|
||||
|
||||
class DAGR_RIGHT_Button : DAGR_Button {
|
||||
idc = 266867;
|
||||
action = "DAGR_RIGHT = true";
|
||||
action = QUOTE(GVAR(RIGHT) = true);
|
||||
x = 0.62;
|
||||
y = 0.735;
|
||||
w = 0.05;
|
||||
@ -201,14 +201,14 @@ class DAGR_Menu {
|
||||
|
||||
class DAGR_NEXT_Button : DAGR_Button {
|
||||
idc = 266868;
|
||||
action = "DAGR_NEXT = true";
|
||||
action = QUOTE(DAGR_NEXT = true);
|
||||
x = 0.60;
|
||||
y = 0.65;
|
||||
};
|
||||
|
||||
class DAGR_SEL_Button : DAGR_Button {
|
||||
idc = 266869;
|
||||
action = "DAGR_SEL = true";
|
||||
action = QUOTE(GVAR(SEL) = true);
|
||||
x = 0.54;
|
||||
y = 0.735;
|
||||
w = 0.06;
|
||||
@ -217,7 +217,7 @@ class DAGR_Menu {
|
||||
|
||||
class DAGR_MENU_Button : DAGR_Button {
|
||||
idc = 266870;
|
||||
action = "DAGR_MENU_B = true";
|
||||
action = QUOTE(GVAR(MENU_B) = true);
|
||||
x = 0.46;
|
||||
y = 0.735;
|
||||
w = 0.06;
|
||||
@ -226,21 +226,21 @@ class DAGR_Menu {
|
||||
|
||||
class DAGR_F1_Button : DAGR_Button {
|
||||
idc = 266871;
|
||||
action = "DAGR_F1 = true";
|
||||
action = QUOTE(GVAR(F1) = true);
|
||||
x = 0.40;
|
||||
y = 0.575;
|
||||
};
|
||||
|
||||
class DAGR_F2_Button : DAGR_Button {
|
||||
idc = 266872;
|
||||
action = "DAGR_F2 = true";
|
||||
action = QUOTE(GVAR(F2) = true);
|
||||
x = 0.495;
|
||||
y = 0.575;
|
||||
};
|
||||
|
||||
class DAGR_F3_Button : DAGR_Button {
|
||||
idc = 266873;
|
||||
action = "DAGR_F3 = true";
|
||||
action = QUOTE(GVAR(F3) = true);
|
||||
x = 0.59;
|
||||
y = 0.575;
|
||||
};
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "initKeybinds.sqf"
|
||||
|
||||
GVAR(run) = false;
|
||||
GVAR(menuRun) = false;
|
||||
GVAR(useDegrees) = true;
|
||||
GVAR(updateInterval) = 0.5;
|
||||
|
||||
@ -22,4 +25,4 @@ GVAR(vectorConnected) = false;
|
||||
GVAR(noVectorData) = true;
|
||||
GVAR(vectorGrid) = "00000000";
|
||||
|
||||
["RangerfinderData", {_this call FUNC(DAGR_VECTOR)}] call EFUNC(common,addEventHandler);
|
||||
["RangerfinderData", {_this call FUNC(handleRangeFinderData)}] call EFUNC(common,addEventHandler);
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
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(handleRangeFinderData);
|
||||
PREP(menuInit);
|
||||
PREP(outputData);
|
||||
PREP(outputVector);
|
||||
PREP(outputWP);
|
||||
PREP(toggleOverlay);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [1000, 45, 1] call ace_dagr_fnc_DAGR_VECTOR
|
||||
* [1000, 45, 1] call ace_dagr_fnc_handleRangeFinderData
|
||||
*
|
||||
* Public: No
|
||||
*/
|
@ -66,34 +66,35 @@ GVAR(showInfoUpdatin) = false;
|
||||
GVAR(showDeleting) = false;
|
||||
GVAR(showOutOfSpace) = false;
|
||||
|
||||
DAGR_PWR = false;
|
||||
GVAR(PWR) = false;
|
||||
GVAR(menuRun) = true;
|
||||
[{
|
||||
if (!dialog || DAGR_PWR) exitWith {
|
||||
if (!dialog || GVAR(PWR)) exitWith {
|
||||
closeDialog 266860;
|
||||
DAGR_MENU_RUN = false;
|
||||
GVAR(menuRun) = false;
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
if (DAGR_MENU_B) then {
|
||||
if (GVAR(MENU_B)) then {
|
||||
GVAR(menu) = "main";
|
||||
GVAR(selection) = 0;
|
||||
GVAR(numSelections) = 5;
|
||||
};
|
||||
|
||||
if (!GVAR(add) && !GVAR(edit)) then {
|
||||
if (DAGR_DOWN) then {
|
||||
if (GVAR(DOWN)) then {
|
||||
GVAR(selection) = (GVAR(numSelections) + GVAR(selection) + 1);
|
||||
};
|
||||
if (DAGR_UP) then {
|
||||
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 (DAGR_LEFT) then {
|
||||
if (GVAR(LEFT)) then {
|
||||
GVAR(pointer) = (8 + GVAR(pointer) - 1);
|
||||
};
|
||||
if (DAGR_RIGHT) then {
|
||||
if (GVAR(RIGHT)) then {
|
||||
GVAR(pointer) = (8 + GVAR(pointer) + 1);
|
||||
};
|
||||
GVAR(pointer) = GVAR(pointer) % 8;
|
||||
@ -126,7 +127,7 @@ DAGR_PWR = false;
|
||||
|
||||
switch (GVAR(menu)) do {
|
||||
case "main": {
|
||||
if (DAGR_SEL) then {
|
||||
if (GVAR(SEL)) then {
|
||||
switch (GVAR(selection)) do {
|
||||
case 0: {
|
||||
GVAR(displaySelection) = "DATA";
|
||||
@ -192,7 +193,7 @@ DAGR_PWR = false;
|
||||
(__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa));
|
||||
};
|
||||
};
|
||||
if (DAGR_SEL) then {
|
||||
if (GVAR(SEL)) then {
|
||||
GVAR(vectorConnected) = false;
|
||||
GVAR(displaySelection) = "WP";
|
||||
switch (GVAR(selection)) do {
|
||||
@ -240,7 +241,7 @@ DAGR_PWR = false;
|
||||
(__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa));
|
||||
};
|
||||
};
|
||||
if (DAGR_F3 && GVAR(numWaypoints) > 0) then {
|
||||
if (GVAR(F3) && GVAR(numWaypoints) > 0) then {
|
||||
if (!GVAR(busy)) then {
|
||||
switch (GVAR(selection)) do {
|
||||
case 0: {
|
||||
@ -307,7 +308,7 @@ DAGR_PWR = false;
|
||||
GVAR(busy) = false;
|
||||
};
|
||||
};
|
||||
if (DAGR_F1) then {
|
||||
if (GVAR(F1)) then {
|
||||
if (GVAR(numWaypoints) == 5) then {
|
||||
if (!GVAR(busy)) then {
|
||||
GVAR(showOutOfSpace) = true;
|
||||
@ -334,7 +335,7 @@ DAGR_PWR = false;
|
||||
GVAR(busy) = false;
|
||||
};
|
||||
};
|
||||
if (DAGR_F2 && GVAR(numWaypoints) > 0) then {
|
||||
if (GVAR(F2) && GVAR(numWaypoints) > 0) then {
|
||||
GVAR(pointer) = 0;
|
||||
GVAR(edit) = true;
|
||||
GVAR(add) = false;
|
||||
@ -400,7 +401,7 @@ DAGR_PWR = false;
|
||||
(__dsp displayCtrl __mainText) ctrlSetText GVAR(output);
|
||||
(__dsp displayCtrl __PSelection1 + GVAR(pointer)) ctrlSetText QUOTE(PATHTOF(UI\DAGR_PSelection.paa));
|
||||
};
|
||||
if (DAGR_F1) then {
|
||||
if (GVAR(F1)) then {
|
||||
if (!GVAR(busy)) then {
|
||||
if (GVAR(add)) then {
|
||||
switch (GVAR(numWaypoints)) do {
|
||||
@ -445,7 +446,7 @@ DAGR_PWR = false;
|
||||
GVAR(busy) = false;
|
||||
};
|
||||
};
|
||||
if (DAGR_F2) then {
|
||||
if (GVAR(F2)) then {
|
||||
private ["_grid", "_gridVector"];
|
||||
_grid = toArray GVAR(vectorGrid);
|
||||
_grid deleteAt 4;
|
||||
@ -460,7 +461,7 @@ DAGR_PWR = false;
|
||||
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(F3)) then {
|
||||
if (!GVAR(busy)) then {
|
||||
GVAR(busy) = true;
|
||||
GVAR(busyTimer) = ACE_time;
|
||||
@ -477,7 +478,7 @@ DAGR_PWR = false;
|
||||
GVAR(busy) = false;
|
||||
};
|
||||
};
|
||||
if (DAGR_UP) then {
|
||||
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 };
|
||||
@ -489,7 +490,7 @@ DAGR_PWR = false;
|
||||
case 8: { GVAR(digit8) = (10 + GVAR(digit8) + 1) % 10 };
|
||||
};
|
||||
};
|
||||
if (DAGR_DOWN) then {
|
||||
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 };
|
||||
@ -508,7 +509,7 @@ DAGR_PWR = false;
|
||||
(__dsp displayCtrl __Option0) ctrlSetText "Vector 21";
|
||||
(__dsp displayCtrl __Selection0) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa));
|
||||
};
|
||||
if (DAGR_SEL) then {
|
||||
if (GVAR(SEL)) then {
|
||||
if (!GVAR(busy)) then {
|
||||
GVAR(busy) = true;
|
||||
GVAR(busyTimer) = ACE_time;
|
||||
@ -542,7 +543,7 @@ DAGR_PWR = false;
|
||||
(__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 {
|
||||
if (GVAR(SEL)) then {
|
||||
GVAR(vectorConnected) = false;
|
||||
switch (GVAR(selection)) do {
|
||||
case 0: { GVAR(menu) = "update_rate"; GVAR(numSelections) = 1; GVAR(tmpUpdateRate) = GVAR(updateInterval); };
|
||||
@ -551,7 +552,7 @@ DAGR_PWR = false;
|
||||
}
|
||||
};
|
||||
case "update_rate": {
|
||||
if (DAGR_F1) then {
|
||||
if (GVAR(F1)) then {
|
||||
GVAR(updateInterval) = GVAR(tmpUpdateRate);
|
||||
if (!GVAR(busy)) then {
|
||||
GVAR(busy) = true;
|
||||
@ -572,13 +573,13 @@ DAGR_PWR = false;
|
||||
GVAR(menu) = "options"; GVAR(numSelections) = 2;
|
||||
};
|
||||
};
|
||||
if (DAGR_F3) then {
|
||||
if (GVAR(F3)) then {
|
||||
GVAR(menu) = "options"; GVAR(numSelections) = 2;
|
||||
};
|
||||
if (DAGR_DOWN) then {
|
||||
if (GVAR(DOWN)) then {
|
||||
GVAR(tmpUpdateRate) = GVAR(tmpUpdateRate) - 0.1;
|
||||
};
|
||||
if (DAGR_UP) then {
|
||||
if (GVAR(UP)) then {
|
||||
GVAR(tmpUpdateRate) = GVAR(tmpUpdateRate) + 0.1;
|
||||
};
|
||||
GVAR(tmpUpdateRate) = 0.1 max GVAR(tmpUpdateRate) min 2.0;
|
||||
@ -591,16 +592,16 @@ DAGR_PWR = false;
|
||||
};
|
||||
|
||||
if (!GVAR(busy)) then {
|
||||
DAGR_F3 = false;
|
||||
DAGR_F2 = false;
|
||||
DAGR_F1 = false;
|
||||
DAGR_MENU_B = false;
|
||||
DAGR_SEL = false;
|
||||
GVAR(F3) = false;
|
||||
GVAR(F2) = false;
|
||||
GVAR(F1) = false;
|
||||
GVAR(MENU_B) = false;
|
||||
GVAR(SEL) = false;
|
||||
DAGR_NEXT = false;
|
||||
DAGR_RIGHT = false;
|
||||
DAGR_LEFT = false;
|
||||
DAGR_UP = false;
|
||||
DAGR_Down = false;
|
||||
DAGR_PWR = false;
|
||||
GVAR(RIGHT) = false;
|
||||
GVAR(LEFT) = false;
|
||||
GVAR(UP) = false;
|
||||
GVAR(DOWN) = false;
|
||||
GVAR(PWR) = false;
|
||||
};
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
@ -21,13 +21,13 @@ GVAR(run) = !GVAR(run);
|
||||
if (GVAR(run)) then {
|
||||
switch (toUpper GVAR(displaySelection)) do {
|
||||
case "WP" : {
|
||||
call FUNC(DAGR_OUTPUT_WP);
|
||||
call FUNC(outputWP);
|
||||
};
|
||||
case "VECTOR" : {
|
||||
call FUNC(DAGR_OUTPUT_VECTOR);
|
||||
call FUNC(outputVector);
|
||||
};
|
||||
case "DATA" : {
|
||||
call FUNC(DAGR_OUTPUT_DATA);
|
||||
call FUNC(outputData);
|
||||
};
|
||||
};
|
||||
[{
|
30
addons/dagr/initKeybinds.sqf
Normal file
30
addons/dagr/initKeybinds.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
["ACE3 Equipment", QGVAR(MenuKey), "Configure DAGR",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, ["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)
|
Loading…
Reference in New Issue
Block a user