From 770a151bf586530eefbd049adda2953b52860845 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 21 Jan 2015 23:49:16 +0100 Subject: [PATCH] CBA keybinding for vector --- addons/vector/XEH_postInit.sqf | 83 ++++++- addons/vector/config.cpp | 27 --- addons/vector/functions/_abort.sqf | 50 ----- addons/vector/functions/_config.sqf | 214 ------------------ addons/vector/functions/_convertFOS.sqf | 226 -------------------- addons/vector/functions/_settings.sqf | 186 ---------------- addons/vector/functions/_tabAzimuthKey.sqf | 112 ---------- addons/vector/functions/_tabDistanceKey.sqf | 112 ---------- 8 files changed, 74 insertions(+), 936 deletions(-) delete mode 100644 addons/vector/functions/_abort.sqf delete mode 100644 addons/vector/functions/_config.sqf delete mode 100644 addons/vector/functions/_convertFOS.sqf delete mode 100644 addons/vector/functions/_settings.sqf delete mode 100644 addons/vector/functions/_tabAzimuthKey.sqf delete mode 100644 addons/vector/functions/_tabDistanceKey.sqf diff --git a/addons/vector/XEH_postInit.sqf b/addons/vector/XEH_postInit.sqf index c3574c3ae0..0a8f031347 100644 --- a/addons/vector/XEH_postInit.sqf +++ b/addons/vector/XEH_postInit.sqf @@ -1,13 +1,78 @@ // by commy2 +#include "script_component.hpp" -/*player setVariable ["AGM_cooldownVector", 0, false]; +["ACE3", + localize "STR_ACE_Vector_AzimuthKey", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"} && {!(GETGVAR(isDownStateKeyAzimuth,false))}) exitWith {false}; -AGM_isVectorReady = true; -AGM_vectorKey = [false, false]; -AGM_vectorConfig = [0, 0]; -AGM_vectorSettings = [false, false, false, false]; + GVAR(isDownStateKeyAzimuth) = true; -0 spawn { - waitUntil {preloadTitleRsc ["AGM_Digit_Preload", "PLAIN"]}; - waitUntil {preloadTitleRsc ["AGM_Debug_Crosshair", "PLAIN"]}; -};*/ + // Statement + ["azimuth"] call FUNC(onKeyDown); + true + }, + [15, [false, false, false]], + false, + "keydown" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_AzimuthKey", + { + GVAR(isDownStateKeyAzimuth) = false; + + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + + // Statement + ["azimuth"] call FUNC(onKeyUp); + true + }, + [15, [false, false, false]], + false, + "keyup" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_DistanceKey", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"} && {!(GETGVAR(isDownStateKeyDistance,false))}) exitWith {false}; + + GVAR(isDownStateKeyDistance) = true; + + // Statement + ["distance"] call FUNC(onKeyDown); + true + }, + [19, [false, false, false]], + false, + "keydown" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_DistanceKey", + { + GVAR(isDownStateKeyDistance) = false; + + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + + // Statement + ["distance"] call FUNC(onKeyUp); + true + }, + [19, [false, false, false]], + false, + "keyup" +] call CBA_fnc_registerKeybind; diff --git a/addons/vector/config.cpp b/addons/vector/config.cpp index 4837ca0001..4603857506 100644 --- a/addons/vector/config.cpp +++ b/addons/vector/config.cpp @@ -15,31 +15,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" - -class ACE_Default_Keys { - class vectorAzimuth { - displayName = "$STR_ACE_Vector_AzimuthKey"; - condition = QUOTE(currentWeapon player == 'ACE_Vector' && {_vehicle == player} && {cameraView == 'GUNNER'}); - statement = QUOTE(['azimuth'] call FUNC(onKeyDown)); - conditionUp = QUOTE(true); - statementUp = QUOTE(['azimuth'] call FUNC(onKeyUp)); - key = 15; - shift = 0; - control = 0; - alt = 0; - }; - - class vectorDistance { - displayName = "$STR_ACE_Vector_DistanceKey"; - condition = QUOTE(currentWeapon player == 'ACE_Vector' && {_vehicle == player} && {cameraView == 'GUNNER'}); - statement = QUOTE(['distance'] call FUNC(onKeyDown)); - conditionUp = QUOTE(true); - statementUp = QUOTE(['distance'] call FUNC(onKeyUp)); - key = 19; - shift = 0; - control = 0; - alt = 0; - }; -}; - #include "RscInGameUI.hpp" diff --git a/addons/vector/functions/_abort.sqf b/addons/vector/functions/_abort.sqf deleted file mode 100644 index e309745c6f..0000000000 --- a/addons/vector/functions/_abort.sqf +++ /dev/null @@ -1,50 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private["_dlgVector", "_ctrlVectorCenter", "_ctrlVectorCrosshair", "_ctrlDigit0", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigit9", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_ctrlDigitE4", "_allControls"]; - -waitUntil {currentWeapon player != "AGM_Vector" || {cameraView != "Gunner"}}; - -terminate AGM_Vector_scriptHandle; - -disableSerialization; -_dlgVector = uiNamespace getVariable "AGM_dlgVector"; -_ctrlVectorCenter = _dlgVector displayCtrl 1; -_ctrlVectorCrosshair = _dlgVector displayCtrl 2; -_ctrlDigit0 = _dlgVector displayCtrl 10; -_ctrlDigit1 = _dlgVector displayCtrl 11; -_ctrlDigit2 = _dlgVector displayCtrl 12; -_ctrlDigit3 = _dlgVector displayCtrl 13; -_ctrlDigit4 = _dlgVector displayCtrl 14; -_ctrlDigit5 = _dlgVector displayCtrl 15; -_ctrlDigit6 = _dlgVector displayCtrl 16; -_ctrlDigit7 = _dlgVector displayCtrl 17; -_ctrlDigit8 = _dlgVector displayCtrl 18; -_ctrlDigit9 = _dlgVector displayCtrl 19; -_ctrlDigitE1 = _dlgVector displayCtrl 21; -_ctrlDigitE2 = _dlgVector displayCtrl 22; -_ctrlDigitE3 = _dlgVector displayCtrl 23; -_ctrlDigitE4 = _dlgVector displayCtrl 24; - -_allControls = [ - _ctrlVectorCenter, - _ctrlVectorCrosshair, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3, - _ctrlDigit4, - _ctrlDigit5, - _ctrlDigit6, - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigitE1, - _ctrlDigitE2, - _ctrlDigitE3, - _ctrlDigitE4 -]; - -{_x ctrlShow false} forEach _allControls; - -AGM_isVectorReady = true; diff --git a/addons/vector/functions/_config.sqf b/addons/vector/functions/_config.sqf deleted file mode 100644 index daaa39ff26..0000000000 --- a/addons/vector/functions/_config.sqf +++ /dev/null @@ -1,214 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private["_dlgVector", "_ctrlVectorCenter", "_ctrlVectorCrosshair", "_ctrlDigit0", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigit9", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_ctrlDigitE4", "_allControls", "_isReticle", "_isNVG", "_time", "_theCount"]; - -disableSerialization; -_dlgVector = uiNamespace getVariable "AGM_dlgVector"; -_ctrlVectorCenter = _dlgVector displayCtrl 1; -_ctrlVectorCrosshair = _dlgVector displayCtrl 2; -_ctrlDigit0 = _dlgVector displayCtrl 10; -_ctrlDigit1 = _dlgVector displayCtrl 11; -_ctrlDigit2 = _dlgVector displayCtrl 12; -_ctrlDigit3 = _dlgVector displayCtrl 13; -_ctrlDigit4 = _dlgVector displayCtrl 14; -_ctrlDigit5 = _dlgVector displayCtrl 15; -_ctrlDigit6 = _dlgVector displayCtrl 16; -_ctrlDigit7 = _dlgVector displayCtrl 17; -_ctrlDigit8 = _dlgVector displayCtrl 18; -_ctrlDigit9 = _dlgVector displayCtrl 19; -_ctrlDigitE1 = _dlgVector displayCtrl 21; -_ctrlDigitE2 = _dlgVector displayCtrl 22; -_ctrlDigitE3 = _dlgVector displayCtrl 23; -_ctrlDigitE4 = _dlgVector displayCtrl 24; - -_allControls = [ - _ctrlVectorCenter, - _ctrlVectorCrosshair, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3, - _ctrlDigit4, - _ctrlDigit5, - _ctrlDigit6, - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigitE1, - _ctrlDigitE2, - _ctrlDigitE3, - _ctrlDigitE4 -]; - -_ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\dC.paa"; -_ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\dq.paa"; -_ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dn.paa"; -_ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dF.paa"; -_ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\di.paa"; -_ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\dG.paa"; - -sleep 2; - -{_x ctrlSetText ""} forEach [ - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2 -]; - -_isReticle = AGM_vectorSettings select 0; -_isNVG = AGM_vectorSettings select 1; - -if (_isReticle) then { - if (_isNVG) then { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\dn.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\di.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\dG.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - } else { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\dr.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - }; - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dq.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dn.paa"; - _ctrlDigit2 ctrlSetText ""; - _ctrlDigit3 ctrlSetText ""; -} else { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\dr.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dq.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dF.paa"; - _ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\dF.paa"; - _ctrlDigit3 ctrlSetText ""; -}; - -waitUntil { - if (AGM_vectorKey select 0) then { - waitUntil { - !(AGM_vectorKey select 0) || {AGM_vectorKey select 1} - }; - if !(AGM_vectorKey select 1) then { - if (_isNVG) then { - _isReticle = false; - _isNVG = false; - } else { - if (_isReticle) then { - _isReticle = true; - _isNVG = true; - } else { - _isReticle = true; - _isNVG = false; - }; - }; - }; - if (_isReticle) then { - if (_isNVG) then { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\dn.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\di.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\dG.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - } else { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\dr.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - }; - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dq.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dn.paa"; - _ctrlDigit2 ctrlSetText ""; - _ctrlDigit3 ctrlSetText ""; - } else { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\dr.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dq.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dF.paa"; - _ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\dF.paa"; - _ctrlDigit3 ctrlSetText ""; - }; - }; - AGM_vectorKey select 1 -}; - -_time = time; -waitUntil { - if (AGM_vectorKey select 0) then {_time = -1}; - !(AGM_vectorKey select 1) || {time > _time + 1} -}; - -_theCount = 1; -waitUntil { - if (AGM_vectorKey select 1) then { - _theCount = _theCount + 1; - _time = time; - waitUntil {!(AGM_vectorKey select 1) || {time > _time + 1}}; - }; - if (AGM_vectorKey select 0) then {_time = -1}; - time > _time + 1 || {_theCount >= 5} -}; - -if (_theCount >= 5) then { - _ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d5.paa"; - _ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - _ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dq.paa"; - _ctrlDigitE4 ctrlSetText "\AGM_Vector\rsc\dr.paa"; - - AGM_vectorSettings set [0, _isReticle]; - AGM_vectorSettings set [1, _isNVG]; - - _ctrlVectorCrosshair ctrlShow (AGM_vectorSettings select 0); - - if (AGM_vectorSettings select 1) then { - {_x ctrlSetTextColor [1, 0, 0, 1]} forEach _allControls; - } else { - {_x ctrlSetTextColor [1, 0, 0, 0.5]} forEach _allControls; - }; - - sleep 2; - - {_x ctrlSetText ""} forEach [ - _ctrlDigit6, - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3, - _ctrlDigitE1, - _ctrlDigitE2, - _ctrlDigitE3, - _ctrlDigitE4 - ]; -} else { - _ctrlDigit6 ctrlSetText ""; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\d0.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\d1.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dd.paa"; - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dC.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dq.paa"; - _ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\dn.paa"; - _ctrlDigit3 ctrlSetText "\AGM_Vector\rsc\dF.paa"; - - sleep 2; - - {_x ctrlSetText ""} forEach [ - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3 - ]; -}; - -AGM_isVectorReady = true; diff --git a/addons/vector/functions/_convertFOS.sqf b/addons/vector/functions/_convertFOS.sqf deleted file mode 100644 index 004bc52218..0000000000 --- a/addons/vector/functions/_convertFOS.sqf +++ /dev/null @@ -1,226 +0,0 @@ -/* -BWA3 script, by commy2 -this code is property of the ArmA 3 Bundeswehr modification -ask us nicely at http://www.bwmod.de/ if you want to re-use any of this script -we don't support changed code based on this work -*/ -#include "script_component.hpp" - -private["_number", "_coordinate", "_isNegative", "_digit0", "_digit1", "_digit2", "_digit3", "_digit4"]; - -_number = _this select 0; -_coordinate = _this select 1; - -_number = round _number; -_isNegative = if (_number < 0) then {true} else {false}; -_number = abs _number; - -if (_number >= 10000) exitWith { - [ - "", - "\AGM_Vector\rsc\d-.paa", - "\AGM_Vector\rsc\d-.paa", - "\AGM_Vector\rsc\d-.paa", - "\AGM_Vector\rsc\d-.paa" - ] -}; - -_digit0 = ""; -_digit1 = floor (_number / 1000); -_digit2 = floor (_number / 100) - _digit1 * 10; -_digit3 = floor (_number / 10) - _digit1 * 100 - _digit2 * 10; -_digit4 = _number mod 10; - -switch (_coordinate) do { - case 0 : { - if (_isNegative) then { - if (_digit1 == 0) then { - if (_digit2 == 0) then { - if (_digit3 == 0) then { - _digit0 = "\AGM_Vector\rsc\dd.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit3 = ""; - _digit4 = ""; - } else { - _digit0 = "\AGM_Vector\rsc\dd.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit4 = ""; - }; - } else { - _digit0 = "\AGM_Vector\rsc\dd.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - }; - } else { - _digit0 = ""; - _digit1 = "\AGM_Vector\rsc\d-.paa"; - _digit2 = "\AGM_Vector\rsc\d-.paa"; - _digit3 = "\AGM_Vector\rsc\d-.paa"; - _digit4 = "\AGM_Vector\rsc\d-.paa"; - }; - } else { - if (_digit1 == 0) then { - if (_digit2 == 0) then { - if (_digit3 == 0) then { - _digit0 = "\AGM_Vector\rsc\dA.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit3 = ""; - _digit4 = ""; - } else { - _digit0 = "\AGM_Vector\rsc\dA.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit4 = ""; - }; - } else { - _digit0 = "\AGM_Vector\rsc\dA.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - }; - } else { - _digit0 = ""; - _digit1 = "\AGM_Vector\rsc\d-.paa"; - _digit2 = "\AGM_Vector\rsc\d-.paa"; - _digit3 = "\AGM_Vector\rsc\d-.paa"; - _digit4 = "\AGM_Vector\rsc\d-.paa"; - }; - }; - }; - case 1 : { - if (_isNegative) then { - if (_digit1 == 0) then { - if (_digit2 == 0) then { - if (_digit3 == 0) then { - _digit0 = "\AGM_Vector\rsc\dL.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit3 = ""; - _digit4 = ""; - } else { - _digit0 = "\AGM_Vector\rsc\dL.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit4 = ""; - }; - } else { - _digit0 = "\AGM_Vector\rsc\dL.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - }; - } else { - _digit0 = ""; - _digit1 = "\AGM_Vector\rsc\d-.paa"; - _digit2 = "\AGM_Vector\rsc\d-.paa"; - _digit3 = "\AGM_Vector\rsc\d-.paa"; - _digit4 = "\AGM_Vector\rsc\d-.paa"; - }; - } else { - if (_digit1 == 0) then { - if (_digit2 == 0) then { - if (_digit3 == 0) then { - _digit0 = "\AGM_Vector\rsc\dr.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit3 = ""; - _digit4 = ""; - } else { - _digit0 = "\AGM_Vector\rsc\dr.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit4 = ""; - }; - } else { - _digit0 = "\AGM_Vector\rsc\dr.paa"; - _digit1 = ""; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - }; - } else { - _digit0 = ""; - _digit1 = "\AGM_Vector\rsc\d-.paa"; - _digit2 = "\AGM_Vector\rsc\d-.paa"; - _digit3 = "\AGM_Vector\rsc\d-.paa"; - _digit4 = "\AGM_Vector\rsc\d-.paa"; - }; - }; - }; - case 2 : { - if (_isNegative) then { - if (_digit1 == 0) then { - if (_digit2 == 0) then { - if (_digit3 == 0) then { - _digit0 = "\AGM_Vector\rsc\dU.paa"; - _digit1 = "\AGM_Vector\rsc\dP.paa"; - _digit2 = ""; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit4 = ""; - } else { - _digit0 = "\AGM_Vector\rsc\dU.paa"; - _digit1 = "\AGM_Vector\rsc\dP.paa"; - _digit2 = ""; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - }; - } else { - _digit0 = "\AGM_Vector\rsc\dU.paa"; - _digit1 = "\AGM_Vector\rsc\dP.paa"; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - }; - } else { - _digit0 = ""; - _digit1 = "\AGM_Vector\rsc\d-.paa"; - _digit2 = "\AGM_Vector\rsc\d-.paa"; - _digit3 = "\AGM_Vector\rsc\d-.paa"; - _digit4 = "\AGM_Vector\rsc\d-.paa"; - }; - } else { - if (_digit1 == 0) then { - if (_digit2 == 0) then { - if (_digit3 == 0) then { - _digit0 = "\AGM_Vector\rsc\dd.paa"; - _digit1 = "\AGM_Vector\rsc\dn.paa"; - _digit2 = ""; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - _digit4 = ""; - } else { - _digit0 = "\AGM_Vector\rsc\dd.paa"; - _digit1 = "\AGM_Vector\rsc\dn.paa"; - _digit2 = ""; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - }; - } else { - _digit0 = "\AGM_Vector\rsc\dd.paa"; - _digit1 = "\AGM_Vector\rsc\dn.paa"; - _digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2]; - _digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3]; - _digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4]; - }; - } else { - _digit0 = ""; - _digit1 = "\AGM_Vector\rsc\d-.paa"; - _digit2 = "\AGM_Vector\rsc\d-.paa"; - _digit3 = "\AGM_Vector\rsc\d-.paa"; - _digit4 = "\AGM_Vector\rsc\d-.paa"; - }; - }; - }; -}; - -[_digit0, _digit1, _digit2, _digit3, _digit4] diff --git a/addons/vector/functions/_settings.sqf b/addons/vector/functions/_settings.sqf deleted file mode 100644 index 5ff16d4b3e..0000000000 --- a/addons/vector/functions/_settings.sqf +++ /dev/null @@ -1,186 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private["_dlgVector", "_ctrlVectorCenter", "_ctrlVectorCrosshair", "_ctrlDigit0", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigit9", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_ctrlDigitE4", "_isFeet", "_isMil", "_time", "_theCount"]; - -disableSerialization; -_dlgVector = uiNamespace getVariable "AGM_dlgVector"; -_ctrlDigit0 = _dlgVector displayCtrl 10; -_ctrlDigit1 = _dlgVector displayCtrl 11; -_ctrlDigit2 = _dlgVector displayCtrl 12; -_ctrlDigit3 = _dlgVector displayCtrl 13; -_ctrlDigit4 = _dlgVector displayCtrl 14; -_ctrlDigit5 = _dlgVector displayCtrl 15; -_ctrlDigit6 = _dlgVector displayCtrl 16; -_ctrlDigit7 = _dlgVector displayCtrl 17; -_ctrlDigit8 = _dlgVector displayCtrl 18; -_ctrlDigit9 = _dlgVector displayCtrl 19; -_ctrlDigitE1 = _dlgVector displayCtrl 21; -_ctrlDigitE2 = _dlgVector displayCtrl 22; -_ctrlDigitE3 = _dlgVector displayCtrl 23; -_ctrlDigitE4 = _dlgVector displayCtrl 24; - -_ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\dU.paa"; -_ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\dn.paa"; -_ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\di.paa"; -_ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dt.paa"; -_ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\d5.paa"; -_ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dE.paa"; -_ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\dt.paa"; -_ctrlDigit3 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - -sleep 2; - -{_x ctrlSetText ""} forEach [ - _ctrlDigit6, - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3 -]; - -_isMil = AGM_vectorSettings select 2; -_isFeet = AGM_vectorSettings select 3; - -if (_isMil) then { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\d6.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\d4.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\d0.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\d0.paa"; -} else { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\d3.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\d6.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\d0.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\do.paa"; -}; -if (_isFeet) then { - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dF.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit3 ctrlSetText "\AGM_Vector\rsc\dt.paa"; -} else { - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\d5.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\d1.paa"; - _ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\d-.paa"; - _ctrlDigit3 ctrlSetText "\AGM_Vector\rsc\dU.paa"; -}; - -waitUntil { - if (AGM_vectorKey select 1) then { - waitUntil { - !(AGM_vectorKey select 1) || AGM_vectorKey select 0 - }; - if !(AGM_vectorKey select 0) then { - if (_isMil) then { - if (_isFeet) then { - _isMil = false; - _isFeet = true; - } else { - _isMil = true; - _isFeet = true; - }; - } else { - if (_isFeet) then { - _isMil = false; - _isFeet = false; - } else { - _isMil = true; - _isFeet = false; - }; - }; - }; - if (_isMil) then { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\d6.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\d4.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\d0.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\d0.paa"; - } else { - _ctrlDigit6 ctrlSetText "\AGM_Vector\rsc\d3.paa"; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\d6.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\d0.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\do.paa"; - }; - if (_isFeet) then { - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dF.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\dE.paa"; - _ctrlDigit3 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - } else { - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\d5.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\d1.paa"; - _ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\d-.paa"; - _ctrlDigit3 ctrlSetText "\AGM_Vector\rsc\dU.paa"; - }; - }; - AGM_vectorKey select 0 -}; - -_time = time; -waitUntil { - if (AGM_vectorKey select 1) then {_time = -1}; - !(AGM_vectorKey select 0) || time > _time + 1 -}; - -_theCount = 1; -waitUntil { - if (AGM_vectorKey select 0) then { - _theCount = _theCount + 1; - _time = time; - waitUntil {!(AGM_vectorKey select 0) || time > _time + 1}; - }; - if (AGM_vectorKey select 1) then {_time = -1}; - time > _time + 1 || {_theCount >= 5} -}; - -if (_theCount >= 5) then { - _ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d5.paa"; - _ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - _ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dq.paa"; - _ctrlDigitE4 ctrlSetText "\AGM_Vector\rsc\dr.paa"; - - AGM_vectorSettings set [2, _isMil]; - AGM_vectorSettings set [3, _isFeet]; - - sleep 2; - - {_x ctrlSetText ""} forEach [ - _ctrlDigit6, - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3, - _ctrlDigitE1, - _ctrlDigitE2, - _ctrlDigitE3, - _ctrlDigitE4 - ]; -} else { - _ctrlDigit6 ctrlSetText ""; - _ctrlDigit7 ctrlSetText "\AGM_Vector\rsc\d0.paa"; - _ctrlDigit8 ctrlSetText "\AGM_Vector\rsc\d1.paa"; - _ctrlDigit9 ctrlSetText "\AGM_Vector\rsc\dd.paa"; - _ctrlDigit0 ctrlSetText "\AGM_Vector\rsc\dU.paa"; - _ctrlDigit1 ctrlSetText "\AGM_Vector\rsc\dn.paa"; - _ctrlDigit2 ctrlSetText "\AGM_Vector\rsc\di.paa"; - _ctrlDigit3 ctrlSetText "\AGM_Vector\rsc\dt.paa"; - - sleep 2; - - {_x ctrlSetText ""} forEach [ - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3 - ]; -}; - -AGM_isVectorReady = true; diff --git a/addons/vector/functions/_tabAzimuthKey.sqf b/addons/vector/functions/_tabAzimuthKey.sqf deleted file mode 100644 index 0d7724dabc..0000000000 --- a/addons/vector/functions/_tabAzimuthKey.sqf +++ /dev/null @@ -1,112 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -#define DELAY 0.3 - -private["_rscLayer", "_dlgVector", "_ctrlVectorCenter", "_ctrlVectorCrosshair", "_ctrlDigit0", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigit9", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_ctrlDigitE4", "_allControls", "_hold", "_time", "_theCount"]; - -disableSerialization; -_rscLayer = ["AGM_Vector"] call BIS_fnc_rscLayer; -_rscLayer cutRsc ["AGM_Vector", "PLAIN", 0, false]; - -_dlgVector = uiNamespace getVariable "AGM_dlgVector"; -_ctrlVectorCenter = _dlgVector displayCtrl 1; -_ctrlVectorCrosshair = _dlgVector displayCtrl 2; -_ctrlDigit0 = _dlgVector displayCtrl 10; -_ctrlDigit1 = _dlgVector displayCtrl 11; -_ctrlDigit2 = _dlgVector displayCtrl 12; -_ctrlDigit3 = _dlgVector displayCtrl 13; -_ctrlDigit4 = _dlgVector displayCtrl 14; -_ctrlDigit5 = _dlgVector displayCtrl 15; -_ctrlDigit6 = _dlgVector displayCtrl 16; -_ctrlDigit7 = _dlgVector displayCtrl 17; -_ctrlDigit8 = _dlgVector displayCtrl 18; -_ctrlDigit9 = _dlgVector displayCtrl 19; -_ctrlDigitE1 = _dlgVector displayCtrl 21; -_ctrlDigitE2 = _dlgVector displayCtrl 22; -_ctrlDigitE3 = _dlgVector displayCtrl 23; -_ctrlDigitE4 = _dlgVector displayCtrl 24; - -_allControls = [ - _ctrlVectorCenter, - _ctrlVectorCrosshair, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3, - _ctrlDigit4, - _ctrlDigit5, - _ctrlDigit6, - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigitE1, - _ctrlDigitE2, - _ctrlDigitE3, - _ctrlDigitE4 -]; - - -if (AGM_vectorSettings select 0) then { - _ctrlVectorCrosshair ctrlShow true; - _ctrlVectorCrosshair ctrlSetText "\AGM_Vector\rsc\Vector_Crosshair.paa"; -}; - -if (AGM_vectorSettings select 1) then { - {_x ctrlSetTextColor [1, 0, 0, 1]} forEach _allControls; -}; - -_hold = true; -_time = time; - -waitUntil { - if !(AGM_vectorKey select 0) then { - _hold = false; - }; - time > _time + DELAY || {!_hold} -}; - -if (_hold) then { - if (AGM_vectorKey select 1) then { - AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeDistanceAzimuth; - } else { - AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeAzimuth; - }; -} else { - waitUntil {time > _time + DELAY}; - if (AGM_vectorKey select 0) then { - if (AGM_vectorKey select 1) then { - //L tab + (L + R) hold - waitUntil {!(AGM_vectorKey select 0)}; - AGM_isVectorReady = true; - } else { - AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeAzimuthInclination; - }; - } else { - if (AGM_vectorKey select 1) then { - //L tab + R hold - waitUntil {!(AGM_vectorKey select 0)}; - AGM_isVectorReady = true; - } else { - //L tab - waitUntil {!(AGM_vectorKey select 0)}; - - _theCount = AGM_vectorConfig select 0; - _time = AGM_vectorConfig select 1; - - if (time < _time + 1 && {_theCount <= 0}) then { - _theCount = _theCount - 1; - if (_theCount <= -5) then { - AGM_vectorConfig = [0, time]; - 0 spawn AGM_Vector_settings; - } else { - AGM_vectorConfig = [_theCount, time]; - AGM_isVectorReady = true; - }; - } else { - AGM_vectorConfig = [-1, time]; - AGM_isVectorReady = true; - }; - }; - }; -}; diff --git a/addons/vector/functions/_tabDistanceKey.sqf b/addons/vector/functions/_tabDistanceKey.sqf deleted file mode 100644 index bdd4587723..0000000000 --- a/addons/vector/functions/_tabDistanceKey.sqf +++ /dev/null @@ -1,112 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -#define DELAY 0.3 - -private["_rscLayer", "_dlgVector", "_ctrlVectorCenter", "_ctrlVectorCrosshair", "_ctrlDigit0", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigit9", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_ctrlDigitE4", "_allControls", "_hold", "_time", "_theCount"]; - -disableSerialization; -_rscLayer = ["AGM_Vector"] call BIS_fnc_rscLayer; -_rscLayer cutRsc ["AGM_Vector", "PLAIN", 0, false]; - -_dlgVector = uiNamespace getVariable "AGM_dlgVector"; -_ctrlVectorCenter = _dlgVector displayCtrl 1; -_ctrlVectorCrosshair = _dlgVector displayCtrl 2; -_ctrlDigit0 = _dlgVector displayCtrl 10; -_ctrlDigit1 = _dlgVector displayCtrl 11; -_ctrlDigit2 = _dlgVector displayCtrl 12; -_ctrlDigit3 = _dlgVector displayCtrl 13; -_ctrlDigit4 = _dlgVector displayCtrl 14; -_ctrlDigit5 = _dlgVector displayCtrl 15; -_ctrlDigit6 = _dlgVector displayCtrl 16; -_ctrlDigit7 = _dlgVector displayCtrl 17; -_ctrlDigit8 = _dlgVector displayCtrl 18; -_ctrlDigit9 = _dlgVector displayCtrl 19; -_ctrlDigitE1 = _dlgVector displayCtrl 21; -_ctrlDigitE2 = _dlgVector displayCtrl 22; -_ctrlDigitE3 = _dlgVector displayCtrl 23; -_ctrlDigitE4 = _dlgVector displayCtrl 24; - -_allControls = [ - _ctrlVectorCenter, - _ctrlVectorCrosshair, - _ctrlDigit0, - _ctrlDigit1, - _ctrlDigit2, - _ctrlDigit3, - _ctrlDigit4, - _ctrlDigit5, - _ctrlDigit6, - _ctrlDigit7, - _ctrlDigit8, - _ctrlDigit9, - _ctrlDigitE1, - _ctrlDigitE2, - _ctrlDigitE3, - _ctrlDigitE4 -]; - - -if (AGM_vectorSettings select 0) then { - _ctrlVectorCrosshair ctrlShow true; - _ctrlVectorCrosshair ctrlSetText "\AGM_Vector\rsc\Vector_Crosshair.paa"; -}; - -if (AGM_vectorSettings select 1) then { - {_x ctrlSetTextColor [1, 0, 0, 1]} forEach _allControls; -}; - -_hold = true; -_time = time; - -waitUntil { - if !(AGM_vectorKey select 1) then { - _hold = false; - }; - time > _time + DELAY || {!_hold} -}; - -if (_hold) then { - if (AGM_vectorKey select 0) then { - AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeDistanceAzimuth; - } else { - AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeDistance; - }; -} else { - waitUntil {time > _time + DELAY}; - if (AGM_vectorKey select 1) then { - if (AGM_vectorKey select 0) then { - //R tab + (L + R) hold - waitUntil {!(AGM_vectorKey select 1)}; - AGM_isVectorReady = true; - } else { - AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeDistanceHeight; - }; - } else { - if (AGM_vectorKey select 0) then { - //R tab + L hold - waitUntil {!(AGM_vectorKey select 1)}; - AGM_isVectorReady = true; - } else { - //R tab - waitUntil {!(AGM_vectorKey select 1)}; - - _theCount = AGM_vectorConfig select 0; - _time = AGM_vectorConfig select 1; - - if (time < _time + 1 && {_theCount >= 0}) then { - _theCount = _theCount + 1; - if (_theCount >= 5) then { - AGM_vectorConfig = [0, time]; - 0 spawn AGM_Vector_config; - } else { - AGM_vectorConfig = [_theCount, time]; - AGM_isVectorReady = true; - }; - } else { - AGM_vectorConfig = [1, time]; - AGM_isVectorReady = true; - }; - }; - }; -};